@hotmeshio/long-tail 0.10.13 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (373) hide show
  1. package/README.md +2 -4
  2. package/build/api/escalations/analytics.d.ts +6 -0
  3. package/build/api/escalations/analytics.js +123 -0
  4. package/build/api/escalations/index.d.ts +1 -0
  5. package/build/api/escalations/index.js +4 -1
  6. package/build/api/escalations/metadata.js +1 -1
  7. package/build/api/escalations/resolve.js +4 -4
  8. package/build/api/roles.d.ts +4 -0
  9. package/build/api/roles.js +8 -0
  10. package/build/api/scan-codes/choice.d.ts +11 -0
  11. package/build/api/scan-codes/choice.js +136 -0
  12. package/build/api/scan-codes/context.d.ts +24 -0
  13. package/build/api/scan-codes/context.js +86 -0
  14. package/build/api/scan-codes/execute.d.ts +1 -0
  15. package/build/api/scan-codes/execute.js +49 -244
  16. package/build/api/scan-codes/identity.d.ts +18 -0
  17. package/build/api/scan-codes/identity.js +116 -0
  18. package/build/api/scan-codes/index.d.ts +2 -0
  19. package/build/api/scan-codes/index.js +6 -1
  20. package/build/api/scan-codes/locate.d.ts +14 -0
  21. package/build/api/scan-codes/locate.js +127 -0
  22. package/build/api/scan-codes/present.d.ts +9 -0
  23. package/build/api/scan-codes/present.js +59 -0
  24. package/build/api/scan-codes/verbs.d.ts +15 -0
  25. package/build/api/scan-codes/verbs.js +205 -0
  26. package/build/bin/ltc.js +33 -0
  27. package/build/lib/cli/commands/escalations.d.ts +31 -0
  28. package/build/lib/cli/commands/escalations.js +88 -0
  29. package/build/lib/db/schemas/028_role_entity_facet.sql +18 -0
  30. package/build/lib/db/schemas/029_scan_scheme_kind.sql +31 -0
  31. package/build/modules/config.d.ts +5 -0
  32. package/build/modules/config.js +12 -0
  33. package/build/routes/escalations/acting.d.ts +12 -0
  34. package/build/routes/escalations/acting.js +25 -0
  35. package/build/routes/escalations/analytics.d.ts +8 -0
  36. package/build/routes/escalations/analytics.js +63 -0
  37. package/build/routes/escalations/index.js +3 -0
  38. package/build/routes/escalations/resolve.js +8 -1
  39. package/build/routes/escalations/single.js +13 -4
  40. package/build/routes/roles.js +1 -1
  41. package/build/routes/scan-codes.js +28 -2
  42. package/build/scripts/ortho-populate.js +14 -0
  43. package/build/scripts/printer-cycle.d.ts +25 -0
  44. package/build/scripts/printer-cycle.js +169 -0
  45. package/build/scripts/twin-farm.js +19 -5
  46. package/build/sdk/index.d.ts +2 -0
  47. package/build/sdk/index.js +3 -0
  48. package/build/services/escalation/aggregate-sql.d.ts +36 -0
  49. package/build/services/escalation/aggregate-sql.js +253 -0
  50. package/build/services/escalation/aggregate-validate.d.ts +57 -0
  51. package/build/services/escalation/aggregate-validate.js +218 -0
  52. package/build/services/escalation/aggregates.d.ts +26 -0
  53. package/build/services/escalation/aggregates.js +204 -0
  54. package/build/services/escalation/client.js +57 -21
  55. package/build/services/escalation/facet-sql.js +17 -0
  56. package/build/services/escalation/index.d.ts +2 -0
  57. package/build/services/escalation/index.js +8 -1
  58. package/build/services/escalation/metrics-cache.d.ts +18 -0
  59. package/build/services/escalation/metrics-cache.js +47 -1
  60. package/build/services/escalation/queries.js +2 -0
  61. package/build/services/escalation/resolver-validation.d.ts +1 -1
  62. package/build/services/escalation/resolver-validation.js +12 -5
  63. package/build/services/escalation/submit-guard.d.ts +29 -0
  64. package/build/services/escalation/submit-guard.js +57 -0
  65. package/build/services/iam/acting-identity.d.ts +16 -0
  66. package/build/services/iam/acting-identity.js +60 -0
  67. package/build/services/role/index.js +2 -0
  68. package/build/services/role/sql.d.ts +10 -2
  69. package/build/services/role/sql.js +14 -1
  70. package/build/services/role/types.d.ts +16 -0
  71. package/build/services/scan-code/read.js +4 -0
  72. package/build/services/scan-code/sql.d.ts +4 -4
  73. package/build/services/scan-code/sql.js +14 -8
  74. package/build/services/scan-code/validate.d.ts +2 -0
  75. package/build/services/scan-code/validate.js +86 -0
  76. package/build/services/scan-code/write.d.ts +4 -0
  77. package/build/services/scan-code/write.js +16 -2
  78. package/build/services/user/crud.d.ts +6 -0
  79. package/build/services/user/crud.js +16 -0
  80. package/build/services/user/index.d.ts +1 -1
  81. package/build/services/user/index.js +2 -1
  82. package/build/services/user/sql.d.ts +8 -0
  83. package/build/services/user/sql.js +9 -1
  84. package/build/shared/form-validation/index.d.ts +4 -0
  85. package/build/shared/form-validation/index.js +4 -0
  86. package/build/shared/form-validation/x-lt-labels.d.ts +28 -0
  87. package/build/shared/form-validation/x-lt-labels.js +42 -0
  88. package/build/shared/form-validation/x-lt-query.d.ts +56 -0
  89. package/build/shared/form-validation/x-lt-query.js +49 -0
  90. package/build/shared/form-validation/x-lt-submit-guard.d.ts +46 -0
  91. package/build/shared/form-validation/x-lt-submit-guard.js +25 -0
  92. package/build/shared/form-validation/x-lt-submit-on-claim.d.ts +22 -0
  93. package/build/shared/form-validation/x-lt-submit-on-claim.js +28 -0
  94. package/build/system/mcp-servers/admin/escalations.js +34 -0
  95. package/build/system/mcp-servers/admin/scan-codes.js +17 -1
  96. package/build/system/mcp-servers/admin/schemas.d.ts +643 -25
  97. package/build/system/mcp-servers/admin/schemas.js +127 -19
  98. package/build/system/mcp-servers/admin/users.js +3 -1
  99. package/build/system/mcp-servers/human-queue-schemas.d.ts +2 -2
  100. package/build/system/seed/tool-manifests-admin.d.ts +2283 -0
  101. package/build/system/seed/tool-manifests-admin.js +8 -5
  102. package/build/tsconfig.tsbuildinfo +1 -1
  103. package/build/types/analytics.d.ts +154 -0
  104. package/build/types/analytics.js +14 -0
  105. package/build/types/facets.d.ts +13 -0
  106. package/build/types/index.d.ts +5 -2
  107. package/build/types/index.js +5 -1
  108. package/build/types/scan-choice.d.ts +49 -0
  109. package/build/types/scan-choice.js +9 -0
  110. package/build/types/scan-code.d.ts +72 -1
  111. package/build/types/scan-code.js +30 -1
  112. package/dashboard/dist/assets/{AdminDashboard-Bv3pHBzn.js → AdminDashboard-DJ3LJQ09.js} +2 -2
  113. package/dashboard/dist/assets/{AdminDashboard-Bv3pHBzn.js.map → AdminDashboard-DJ3LJQ09.js.map} +1 -1
  114. package/dashboard/dist/assets/{AgentConfigPage-Dk2zlvDb.js → AgentConfigPage-BMMvaD0z.js} +2 -2
  115. package/dashboard/dist/assets/{AgentConfigPage-Dk2zlvDb.js.map → AgentConfigPage-BMMvaD0z.js.map} +1 -1
  116. package/dashboard/dist/assets/{AgentDetailPage-DUno6EGs.js → AgentDetailPage-C6wfsnRe.js} +2 -2
  117. package/dashboard/dist/assets/{AgentDetailPage-DUno6EGs.js.map → AgentDetailPage-C6wfsnRe.js.map} +1 -1
  118. package/dashboard/dist/assets/AgentsPage-Cwqka7nE.js +2 -0
  119. package/dashboard/dist/assets/{AgentsPage-CToVu1qj.js.map → AgentsPage-Cwqka7nE.js.map} +1 -1
  120. package/dashboard/dist/assets/AvailableEscalationsPage-CVlG_AVC.js +2 -0
  121. package/dashboard/dist/assets/AvailableEscalationsPage-CVlG_AVC.js.map +1 -0
  122. package/dashboard/dist/assets/{BotPicker-DQOpVB4M.js → BotPicker-BBkJBXZB.js} +2 -2
  123. package/dashboard/dist/assets/{BotPicker-DQOpVB4M.js.map → BotPicker-BBkJBXZB.js.map} +1 -1
  124. package/dashboard/dist/assets/{CapabilitiesPage-Dmf46PUJ.js → CapabilitiesPage-wxmE4917.js} +2 -2
  125. package/dashboard/dist/assets/{CapabilitiesPage-Dmf46PUJ.js.map → CapabilitiesPage-wxmE4917.js.map} +1 -1
  126. package/dashboard/dist/assets/{CollapsibleSection-CDADefUY.js → CollapsibleSection-B3FsrHwH.js} +2 -2
  127. package/dashboard/dist/assets/{CollapsibleSection-CDADefUY.js.map → CollapsibleSection-B3FsrHwH.js.map} +1 -1
  128. package/dashboard/dist/assets/CountdownTimer-B3nCqJdC.js +2 -0
  129. package/dashboard/dist/assets/CountdownTimer-B3nCqJdC.js.map +1 -0
  130. package/dashboard/dist/assets/{CredentialsPage-8LIEvomi.js → CredentialsPage-Bv875IHe.js} +2 -2
  131. package/dashboard/dist/assets/{CredentialsPage-8LIEvomi.js.map → CredentialsPage-Bv875IHe.js.map} +1 -1
  132. package/dashboard/dist/assets/{CronLabel-CK3WSsM5.js → CronLabel-CSzjWuwj.js} +2 -2
  133. package/dashboard/dist/assets/{CronLabel-CK3WSsM5.js.map → CronLabel-CSzjWuwj.js.map} +1 -1
  134. package/dashboard/dist/assets/{CustomDurationPicker-FPmlA6cE.js → CustomDurationPicker-CCpqf3e4.js} +2 -2
  135. package/dashboard/dist/assets/{CustomDurationPicker-FPmlA6cE.js.map → CustomDurationPicker-CCpqf3e4.js.map} +1 -1
  136. package/dashboard/dist/assets/{DropZone-CL9gA7pu.js → DropZone-CJkk-U3o.js} +2 -2
  137. package/dashboard/dist/assets/{DropZone-CL9gA7pu.js.map → DropZone-CJkk-U3o.js.map} +1 -1
  138. package/dashboard/dist/assets/{ElapsedCell-BZVkVxE0.js → ElapsedCell-WV6pUaKo.js} +2 -2
  139. package/dashboard/dist/assets/{ElapsedCell-BZVkVxE0.js.map → ElapsedCell-WV6pUaKo.js.map} +1 -1
  140. package/dashboard/dist/assets/EntityTimelinePanel-DrL86Yrf.js +2 -0
  141. package/dashboard/dist/assets/EntityTimelinePanel-DrL86Yrf.js.map +1 -0
  142. package/dashboard/dist/assets/{EscalationListSchemaPage-kYLdUtZX.js → EscalationListSchemaPage-CTQCALw4.js} +3 -3
  143. package/dashboard/dist/assets/{EscalationListSchemaPage-kYLdUtZX.js.map → EscalationListSchemaPage-CTQCALw4.js.map} +1 -1
  144. package/dashboard/dist/assets/{EscalationSchemaPage-kUmCDivo.js → EscalationSchemaPage-D_UgP0pv.js} +3 -3
  145. package/dashboard/dist/assets/{EscalationSchemaPage-kUmCDivo.js.map → EscalationSchemaPage-D_UgP0pv.js.map} +1 -1
  146. package/dashboard/dist/assets/{EscalationsOverview-D17auO-m.js → EscalationsOverview-DuIUyxr0.js} +2 -2
  147. package/dashboard/dist/assets/{EscalationsOverview-D17auO-m.js.map → EscalationsOverview-DuIUyxr0.js.map} +1 -1
  148. package/dashboard/dist/assets/EventTable-BV6unphX.js +2 -0
  149. package/dashboard/dist/assets/EventTable-BV6unphX.js.map +1 -0
  150. package/dashboard/dist/assets/FilterBar-DYFgzXNB.js +2 -0
  151. package/dashboard/dist/assets/FilterBar-DYFgzXNB.js.map +1 -0
  152. package/dashboard/dist/assets/{GraphInvokePage-D11uOnZi.js → GraphInvokePage-BGHVUipJ.js} +2 -2
  153. package/dashboard/dist/assets/{GraphInvokePage-D11uOnZi.js.map → GraphInvokePage-BGHVUipJ.js.map} +1 -1
  154. package/dashboard/dist/assets/HomePage-B-S2cK3E.js +2 -0
  155. package/dashboard/dist/assets/{HomePage-Bcq10Bxx.js.map → HomePage-B-S2cK3E.js.map} +1 -1
  156. package/dashboard/dist/assets/ListToolbar-Bl7F3A28.js +2 -0
  157. package/dashboard/dist/assets/{ListToolbar-IPXsTb3Q.js.map → ListToolbar-Bl7F3A28.js.map} +1 -1
  158. package/dashboard/dist/assets/{McpOverview-Dx2j0KkF.js → McpOverview-_T9IsCD_.js} +2 -2
  159. package/dashboard/dist/assets/{McpOverview-Dx2j0KkF.js.map → McpOverview-_T9IsCD_.js.map} +1 -1
  160. package/dashboard/dist/assets/{McpQueryDetailPage-CzF_bna8.js → McpQueryDetailPage-DtsVqKPw.js} +2 -2
  161. package/dashboard/dist/assets/{McpQueryDetailPage-CzF_bna8.js.map → McpQueryDetailPage-DtsVqKPw.js.map} +1 -1
  162. package/dashboard/dist/assets/McpQueryPage-DX5u-1bx.js +2 -0
  163. package/dashboard/dist/assets/{McpQueryPage-CNsuiw_q.js.map → McpQueryPage-DX5u-1bx.js.map} +1 -1
  164. package/dashboard/dist/assets/McpRunDetailPage-BhcqqtYS.js +2 -0
  165. package/dashboard/dist/assets/McpRunDetailPage-BhcqqtYS.js.map +1 -0
  166. package/dashboard/dist/assets/{McpRunsPage-CK96s3Nt.js → McpRunsPage-L-1y8wnX.js} +2 -2
  167. package/dashboard/dist/assets/{McpRunsPage-CK96s3Nt.js.map → McpRunsPage-L-1y8wnX.js.map} +1 -1
  168. package/dashboard/dist/assets/{NamespacePill-B9Vc_Pz2.js → NamespacePill-in1SLd0W.js} +2 -2
  169. package/dashboard/dist/assets/{NamespacePill-B9Vc_Pz2.js.map → NamespacePill-in1SLd0W.js.map} +1 -1
  170. package/dashboard/dist/assets/OperationsPage-i8KcDpKo.js +3 -0
  171. package/dashboard/dist/assets/OperationsPage-i8KcDpKo.js.map +1 -0
  172. package/dashboard/dist/assets/OperatorDashboard-CIbDzOlh.js +2 -0
  173. package/dashboard/dist/assets/{OperatorDashboard-C-jE0IRA.js.map → OperatorDashboard-CIbDzOlh.js.map} +1 -1
  174. package/dashboard/dist/assets/{PageHeader-Ce4GcIYo.js → PageHeader-BJgWMZtw.js} +2 -2
  175. package/dashboard/dist/assets/{PageHeader-Ce4GcIYo.js.map → PageHeader-BJgWMZtw.js.map} +1 -1
  176. package/dashboard/dist/assets/{PageHeaderWithStats-Ck0KZvXD.js → PageHeaderWithStats-Ccio4vyG.js} +2 -2
  177. package/dashboard/dist/assets/{PageHeaderWithStats-Ck0KZvXD.js.map → PageHeaderWithStats-Ccio4vyG.js.map} +1 -1
  178. package/dashboard/dist/assets/{PersonaDetailPage-CJ6jqo7h.js → PersonaDetailPage-BOaf0TW1.js} +2 -2
  179. package/dashboard/dist/assets/{PersonaDetailPage-CJ6jqo7h.js.map → PersonaDetailPage-BOaf0TW1.js.map} +1 -1
  180. package/dashboard/dist/assets/{PersonasPage-D8hL3kL5.js → PersonasPage-DSdRb90f.js} +2 -2
  181. package/dashboard/dist/assets/{PersonasPage-D8hL3kL5.js.map → PersonasPage-DSdRb90f.js.map} +1 -1
  182. package/dashboard/dist/assets/{ProcessDetailPage-Vnx8Z5_y.js → ProcessDetailPage-DN9NqfeP.js} +2 -2
  183. package/dashboard/dist/assets/{ProcessDetailPage-Vnx8Z5_y.js.map → ProcessDetailPage-DN9NqfeP.js.map} +1 -1
  184. package/dashboard/dist/assets/{ProcessesListPage-DRYtvS3N.js → ProcessesListPage-CfQEWaD4.js} +2 -2
  185. package/dashboard/dist/assets/{ProcessesListPage-DRYtvS3N.js.map → ProcessesListPage-CfQEWaD4.js.map} +1 -1
  186. package/dashboard/dist/assets/RoleDetailPage-BC5HL7ls.js +8 -0
  187. package/dashboard/dist/assets/RoleDetailPage-BC5HL7ls.js.map +1 -0
  188. package/dashboard/dist/assets/{RolePill-CnuBPhPw.js → RolePill-BNAP-uK6.js} +2 -2
  189. package/dashboard/dist/assets/{RolePill-CnuBPhPw.js.map → RolePill-BNAP-uK6.js.map} +1 -1
  190. package/dashboard/dist/assets/RolesPage-DCnW0VmD.js +2 -0
  191. package/dashboard/dist/assets/RolesPage-DCnW0VmD.js.map +1 -0
  192. package/dashboard/dist/assets/RunAsSelector-twbuX7fB.js +2 -0
  193. package/dashboard/dist/assets/{RunAsSelector-CS3KQ-BF.js.map → RunAsSelector-twbuX7fB.js.map} +1 -1
  194. package/dashboard/dist/assets/ScanCodesPage-CPNg6K--.js +2 -0
  195. package/dashboard/dist/assets/ScanCodesPage-CPNg6K--.js.map +1 -0
  196. package/dashboard/dist/assets/ScanSchemeDetailPage-DyLmCamO.js +2 -0
  197. package/dashboard/dist/assets/ScanSchemeDetailPage-DyLmCamO.js.map +1 -0
  198. package/dashboard/dist/assets/ScanStationPage-DoZccU5B.js +2 -0
  199. package/dashboard/dist/assets/ScanStationPage-DoZccU5B.js.map +1 -0
  200. package/dashboard/dist/assets/{ScopeBadge-BUpYpS3x.js → ScopeBadge-BG7KkZ8Q.js} +2 -2
  201. package/dashboard/dist/assets/{ScopeBadge-BUpYpS3x.js.map → ScopeBadge-BG7KkZ8Q.js.map} +1 -1
  202. package/dashboard/dist/assets/SegmentedTabs-DXNzY05q.js +2 -0
  203. package/dashboard/dist/assets/SegmentedTabs-DXNzY05q.js.map +1 -0
  204. package/dashboard/dist/assets/StickyPagination-DIeYMPPd.js +2 -0
  205. package/dashboard/dist/assets/StickyPagination-DIeYMPPd.js.map +1 -0
  206. package/dashboard/dist/assets/{StreamMessageDetail-DyJyZwBl.js → StreamMessageDetail-gU4CUeQI.js} +2 -2
  207. package/dashboard/dist/assets/{StreamMessageDetail-DyJyZwBl.js.map → StreamMessageDetail-gU4CUeQI.js.map} +1 -1
  208. package/dashboard/dist/assets/{SwimlaneTimeline-BlzV74V5.js → SwimlaneTimeline-Br-nBA4l.js} +2 -2
  209. package/dashboard/dist/assets/{SwimlaneTimeline-BlzV74V5.js.map → SwimlaneTimeline-Br-nBA4l.js.map} +1 -1
  210. package/dashboard/dist/assets/{TagInput-BbZ25nNe.js → TagInput-CvM5n6ww.js} +2 -2
  211. package/dashboard/dist/assets/{TagInput-BbZ25nNe.js.map → TagInput-CvM5n6ww.js.map} +1 -1
  212. package/dashboard/dist/assets/{TaskDetailPage-B0p_Z4J_.js → TaskDetailPage-_9cr_R0u.js} +2 -2
  213. package/dashboard/dist/assets/{TaskDetailPage-B0p_Z4J_.js.map → TaskDetailPage-_9cr_R0u.js.map} +1 -1
  214. package/dashboard/dist/assets/{TaskQueuePill-D0QKBrN3.js → TaskQueuePill-D4JPHXOq.js} +2 -2
  215. package/dashboard/dist/assets/{TaskQueuePill-D0QKBrN3.js.map → TaskQueuePill-D4JPHXOq.js.map} +1 -1
  216. package/dashboard/dist/assets/{TasksListPage-CiGR2QiQ.js → TasksListPage-DVENC9Jp.js} +2 -2
  217. package/dashboard/dist/assets/{TasksListPage-CiGR2QiQ.js.map → TasksListPage-DVENC9Jp.js.map} +1 -1
  218. package/dashboard/dist/assets/{TimeAgo-D_DA9ucC.js → TimeAgo-C9yYnOui.js} +2 -2
  219. package/dashboard/dist/assets/{TimeAgo-D_DA9ucC.js.map → TimeAgo-C9yYnOui.js.map} +1 -1
  220. package/dashboard/dist/assets/{TimestampCell-C7rkC9nh.js → TimestampCell-DoB8cYgw.js} +2 -2
  221. package/dashboard/dist/assets/{TimestampCell-C7rkC9nh.js.map → TimestampCell-DoB8cYgw.js.map} +1 -1
  222. package/dashboard/dist/assets/{ToolPill-8xY9rkoc.js → ToolPill-BUjbC-Tj.js} +2 -2
  223. package/dashboard/dist/assets/{ToolPill-8xY9rkoc.js.map → ToolPill-BUjbC-Tj.js.map} +1 -1
  224. package/dashboard/dist/assets/{ToolTestPanel-E8efYGYs.js → ToolTestPanel-CBtsIP8K.js} +2 -2
  225. package/dashboard/dist/assets/{ToolTestPanel-E8efYGYs.js.map → ToolTestPanel-CBtsIP8K.js.map} +1 -1
  226. package/dashboard/dist/assets/{TopicDetailPage-B455XrRc.js → TopicDetailPage-mR4Jaz83.js} +4 -4
  227. package/dashboard/dist/assets/{TopicDetailPage-B455XrRc.js.map → TopicDetailPage-mR4Jaz83.js.map} +1 -1
  228. package/dashboard/dist/assets/TopicsPage-CP7HFxIC.js +2 -0
  229. package/dashboard/dist/assets/{TopicsPage-1VAc29Qw.js.map → TopicsPage-CP7HFxIC.js.map} +1 -1
  230. package/dashboard/dist/assets/{UserName-DikzjQHJ.js → UserName-BnLF6yhz.js} +2 -2
  231. package/dashboard/dist/assets/{UserName-DikzjQHJ.js.map → UserName-BnLF6yhz.js.map} +1 -1
  232. package/dashboard/dist/assets/WorkflowExecutionPage-xL956RZi.js +2 -0
  233. package/dashboard/dist/assets/WorkflowExecutionPage-xL956RZi.js.map +1 -0
  234. package/dashboard/dist/assets/{WorkflowPill-Da406nEj.js → WorkflowPill-tXU0-eXu.js} +2 -2
  235. package/dashboard/dist/assets/{WorkflowPill-Da406nEj.js.map → WorkflowPill-tXU0-eXu.js.map} +1 -1
  236. package/dashboard/dist/assets/WorkflowsDashboard-B-u7zFKM.js +2 -0
  237. package/dashboard/dist/assets/{WorkflowsDashboard-BMQd_0tW.js.map → WorkflowsDashboard-B-u7zFKM.js.map} +1 -1
  238. package/dashboard/dist/assets/{WorkflowsOverview-CdxjVifp.js → WorkflowsOverview-CqZVarK-.js} +2 -2
  239. package/dashboard/dist/assets/{WorkflowsOverview-CdxjVifp.js.map → WorkflowsOverview-CqZVarK-.js.map} +1 -1
  240. package/dashboard/dist/assets/{YamlWorkflowDetailPage-DNVffIXa.js → YamlWorkflowDetailPage-DiFLavW0.js} +10 -10
  241. package/dashboard/dist/assets/{YamlWorkflowDetailPage-DNVffIXa.js.map → YamlWorkflowDetailPage-DiFLavW0.js.map} +1 -1
  242. package/dashboard/dist/assets/{YamlWorkflowsPage-BGP8wuos.js → YamlWorkflowsPage-BuQM6uZA.js} +2 -2
  243. package/dashboard/dist/assets/{YamlWorkflowsPage-BGP8wuos.js.map → YamlWorkflowsPage-BuQM6uZA.js.map} +1 -1
  244. package/dashboard/dist/assets/{agents-BZJLIJ4h.js → agents-DU9GPovp.js} +2 -2
  245. package/dashboard/dist/assets/{agents-BZJLIJ4h.js.map → agents-DU9GPovp.js.map} +1 -1
  246. package/dashboard/dist/assets/{bots-ClLcDGJb.js → bots-Cy-Hmg7w.js} +2 -2
  247. package/dashboard/dist/assets/{bots-ClLcDGJb.js.map → bots-Cy-Hmg7w.js.map} +1 -1
  248. package/dashboard/dist/assets/capabilities-sSJJqrp-.js +2 -0
  249. package/dashboard/dist/assets/{capabilities-IaCcS7ge.js.map → capabilities-sSJJqrp-.js.map} +1 -1
  250. package/dashboard/dist/assets/{controlplane-Zi4m_MSx.js → controlplane-TVCjDHQ-.js} +2 -2
  251. package/dashboard/dist/assets/{controlplane-Zi4m_MSx.js.map → controlplane-TVCjDHQ-.js.map} +1 -1
  252. package/dashboard/dist/assets/escalation-columns-BpkjKYGd.js +2 -0
  253. package/dashboard/dist/assets/escalation-columns-BpkjKYGd.js.map +1 -0
  254. package/dashboard/dist/assets/index-5TblaCXQ.css +1 -0
  255. package/dashboard/dist/assets/index-7BP6FaCZ.js +2 -0
  256. package/dashboard/dist/assets/{index-Dldi3Q3M.js.map → index-7BP6FaCZ.js.map} +1 -1
  257. package/dashboard/dist/assets/{index-BzkE48xJ.js → index-B7IaBPBg.js} +4 -4
  258. package/dashboard/dist/assets/{index-BzkE48xJ.js.map → index-B7IaBPBg.js.map} +1 -1
  259. package/dashboard/dist/assets/index-BE0phFw0.js +2 -0
  260. package/dashboard/dist/assets/{index-CLmZaNTK.js.map → index-BE0phFw0.js.map} +1 -1
  261. package/dashboard/dist/assets/{index-BqGnhkh0.js → index-BYNN9N1T.js} +2 -2
  262. package/dashboard/dist/assets/{index-BqGnhkh0.js.map → index-BYNN9N1T.js.map} +1 -1
  263. package/dashboard/dist/assets/{index-kiKZresb.js → index-CLPVqbVY.js} +2 -2
  264. package/dashboard/dist/assets/{index-kiKZresb.js.map → index-CLPVqbVY.js.map} +1 -1
  265. package/dashboard/dist/assets/{index-C3o4OisO.js → index-Cfv86_L9.js} +2 -2
  266. package/dashboard/dist/assets/{index-C3o4OisO.js.map → index-Cfv86_L9.js.map} +1 -1
  267. package/dashboard/dist/assets/{index-yGNt29V9.js → index-CtwbQ_-m.js} +2 -2
  268. package/dashboard/dist/assets/{index-yGNt29V9.js.map → index-CtwbQ_-m.js.map} +1 -1
  269. package/dashboard/dist/assets/index-DOai950R.js +3 -0
  270. package/dashboard/dist/assets/index-DOai950R.js.map +1 -0
  271. package/dashboard/dist/assets/index-DTtHNC-D.js +5 -0
  272. package/dashboard/dist/assets/{index-CvNBdkB1.js.map → index-DTtHNC-D.js.map} +1 -1
  273. package/dashboard/dist/assets/{index-CJu2PBNx.js → index-DsWnVyVN.js} +2 -2
  274. package/dashboard/dist/assets/{index-CJu2PBNx.js.map → index-DsWnVyVN.js.map} +1 -1
  275. package/dashboard/dist/assets/{index-D0zFReGL.js → index-Dy-MMYti.js} +2 -2
  276. package/dashboard/dist/assets/{index-D0zFReGL.js.map → index-Dy-MMYti.js.map} +1 -1
  277. package/dashboard/dist/assets/index-errgQT5x.js +65 -0
  278. package/dashboard/dist/assets/index-errgQT5x.js.map +1 -0
  279. package/dashboard/dist/assets/{index-CmnNqpWg.js → index-fgBDhnI6.js} +2 -2
  280. package/dashboard/dist/assets/{index-CmnNqpWg.js.map → index-fgBDhnI6.js.map} +1 -1
  281. package/dashboard/dist/assets/{knowledge-DWLxGTib.js → knowledge-arh4NfmL.js} +2 -2
  282. package/dashboard/dist/assets/{knowledge-DWLxGTib.js.map → knowledge-arh4NfmL.js.map} +1 -1
  283. package/dashboard/dist/assets/{mcp-B6AARZ2I.js → mcp-QGf5jHCo.js} +2 -2
  284. package/dashboard/dist/assets/{mcp-B6AARZ2I.js.map → mcp-QGf5jHCo.js.map} +1 -1
  285. package/dashboard/dist/assets/{mcp-query-DrkvBU3a.js → mcp-query-BEJN1nMZ.js} +2 -2
  286. package/dashboard/dist/assets/{mcp-query-DrkvBU3a.js.map → mcp-query-BEJN1nMZ.js.map} +1 -1
  287. package/dashboard/dist/assets/{personas-Cmz2SAEU.js → personas-DYtw1COf.js} +2 -2
  288. package/dashboard/dist/assets/{personas-Cmz2SAEU.js.map → personas-DYtw1COf.js.map} +1 -1
  289. package/dashboard/dist/assets/{pipelines-CSgfVCMy.js → pipelines-Byi6PnbE.js} +2 -2
  290. package/dashboard/dist/assets/{pipelines-CSgfVCMy.js.map → pipelines-Byi6PnbE.js.map} +1 -1
  291. package/dashboard/dist/assets/{tasks-UOtUkDk-.js → tasks-D0SQdENz.js} +2 -2
  292. package/dashboard/dist/assets/{tasks-UOtUkDk-.js.map → tasks-D0SQdENz.js.map} +1 -1
  293. package/dashboard/dist/assets/{topics-Df5hGh6o.js → topics-DgDv5ZXP.js} +2 -2
  294. package/dashboard/dist/assets/{topics-Df5hGh6o.js.map → topics-DgDv5ZXP.js.map} +1 -1
  295. package/dashboard/dist/assets/useEventHooks-DZaYzE7s.js +2 -0
  296. package/dashboard/dist/assets/{useEventHooks-PDbuSJ12.js.map → useEventHooks-DZaYzE7s.js.map} +1 -1
  297. package/dashboard/dist/assets/{useNamespace-tZSOlge3.js → useNamespace-C1OqiNXN.js} +2 -2
  298. package/dashboard/dist/assets/{useNamespace-tZSOlge3.js.map → useNamespace-C1OqiNXN.js.map} +1 -1
  299. package/dashboard/dist/assets/{useYamlActivityEvents-CINLzE32.js → useYamlActivityEvents-CkmXDm-Z.js} +2 -2
  300. package/dashboard/dist/assets/{useYamlActivityEvents-CINLzE32.js.map → useYamlActivityEvents-CkmXDm-Z.js.map} +1 -1
  301. package/dashboard/dist/assets/{users-G8qwyZKS.js → users-D4DCFPH1.js} +2 -2
  302. package/dashboard/dist/assets/{users-G8qwyZKS.js.map → users-D4DCFPH1.js.map} +1 -1
  303. package/dashboard/dist/assets/{vendor-icons-BpZiWH2f.js → vendor-icons-BxuyFxH2.js} +156 -136
  304. package/dashboard/dist/assets/vendor-icons-BxuyFxH2.js.map +1 -0
  305. package/dashboard/dist/assets/{workflows-DbPqi1TW.js → workflows-qyc0ku_5.js} +2 -2
  306. package/dashboard/dist/assets/{workflows-DbPqi1TW.js.map → workflows-qyc0ku_5.js.map} +1 -1
  307. package/dashboard/dist/assets/{yaml-workflows-DozD8hpR.js → yaml-workflows-DWFww9Xn.js} +2 -2
  308. package/dashboard/dist/assets/{yaml-workflows-DozD8hpR.js.map → yaml-workflows-DWFww9Xn.js.map} +1 -1
  309. package/dashboard/dist/index.html +3 -3
  310. package/docs/api/http/escalations.md +133 -0
  311. package/docs/api/http/roles.md +6 -0
  312. package/docs/api/mcp/admin.md +53 -0
  313. package/docs/api/sdk/escalations.md +58 -0
  314. package/docs/cli.md +11 -0
  315. package/docs/dashboard.md +22 -20
  316. package/docs/data.md +12 -4
  317. package/docs/design-principles.md +9 -7
  318. package/docs/escalation-analytics.md +251 -0
  319. package/docs/hitl/roles.md +1 -1
  320. package/docs/hitl/x-lt-embed.md +8 -4
  321. package/docs/hitl/x-lt-footer.md +67 -0
  322. package/docs/hitl/x-lt-list-schema.md +10 -3
  323. package/docs/hitl-guide.md +11 -2
  324. package/docs/iam.md +12 -0
  325. package/docs/operations.md +17 -0
  326. package/docs/scan-codes.md +112 -0
  327. package/docs/sdk.md +1 -1
  328. package/package.json +2 -1
  329. package/dashboard/dist/assets/AgentsPage-CToVu1qj.js +0 -2
  330. package/dashboard/dist/assets/AvailableEscalationsPage-DldboL4W.js +0 -2
  331. package/dashboard/dist/assets/AvailableEscalationsPage-DldboL4W.js.map +0 -1
  332. package/dashboard/dist/assets/CountdownTimer-DPjIkerB.js +0 -2
  333. package/dashboard/dist/assets/CountdownTimer-DPjIkerB.js.map +0 -1
  334. package/dashboard/dist/assets/EventTable-CwPWl163.js +0 -2
  335. package/dashboard/dist/assets/EventTable-CwPWl163.js.map +0 -1
  336. package/dashboard/dist/assets/FilterBar-D7GghUsU.js +0 -2
  337. package/dashboard/dist/assets/FilterBar-D7GghUsU.js.map +0 -1
  338. package/dashboard/dist/assets/HomePage-Bcq10Bxx.js +0 -2
  339. package/dashboard/dist/assets/ListToolbar-IPXsTb3Q.js +0 -2
  340. package/dashboard/dist/assets/McpQueryPage-CNsuiw_q.js +0 -2
  341. package/dashboard/dist/assets/McpRunDetailPage-BJguEMS0.js +0 -2
  342. package/dashboard/dist/assets/McpRunDetailPage-BJguEMS0.js.map +0 -1
  343. package/dashboard/dist/assets/OperationsPage-DvWrLuH6.js +0 -2
  344. package/dashboard/dist/assets/OperationsPage-DvWrLuH6.js.map +0 -1
  345. package/dashboard/dist/assets/OperatorDashboard-C-jE0IRA.js +0 -2
  346. package/dashboard/dist/assets/RoleDetailPage-BKkUvTO-.js +0 -8
  347. package/dashboard/dist/assets/RoleDetailPage-BKkUvTO-.js.map +0 -1
  348. package/dashboard/dist/assets/RolesPage-BHzWK9n6.js +0 -2
  349. package/dashboard/dist/assets/RolesPage-BHzWK9n6.js.map +0 -1
  350. package/dashboard/dist/assets/RunAsSelector-CS3KQ-BF.js +0 -2
  351. package/dashboard/dist/assets/ScanCodesPage-BW4P4zWf.js +0 -2
  352. package/dashboard/dist/assets/ScanCodesPage-BW4P4zWf.js.map +0 -1
  353. package/dashboard/dist/assets/ScanSchemeDetailPage-BLykA4j-.js +0 -2
  354. package/dashboard/dist/assets/ScanSchemeDetailPage-BLykA4j-.js.map +0 -1
  355. package/dashboard/dist/assets/StickyPagination-hMrnLXde.js +0 -2
  356. package/dashboard/dist/assets/StickyPagination-hMrnLXde.js.map +0 -1
  357. package/dashboard/dist/assets/TopicsPage-1VAc29Qw.js +0 -2
  358. package/dashboard/dist/assets/WorkflowExecutionPage-C15GSAoe.js +0 -2
  359. package/dashboard/dist/assets/WorkflowExecutionPage-C15GSAoe.js.map +0 -1
  360. package/dashboard/dist/assets/WorkflowsDashboard-BMQd_0tW.js +0 -2
  361. package/dashboard/dist/assets/capabilities-IaCcS7ge.js +0 -2
  362. package/dashboard/dist/assets/escalation-columns-BY2mg9DY.js +0 -2
  363. package/dashboard/dist/assets/escalation-columns-BY2mg9DY.js.map +0 -1
  364. package/dashboard/dist/assets/index-CLmZaNTK.js +0 -2
  365. package/dashboard/dist/assets/index-CfAi1OsI.js +0 -65
  366. package/dashboard/dist/assets/index-CfAi1OsI.js.map +0 -1
  367. package/dashboard/dist/assets/index-CvNBdkB1.js +0 -5
  368. package/dashboard/dist/assets/index-Dldi3Q3M.js +0 -2
  369. package/dashboard/dist/assets/index-mKcQGi2B.js +0 -3
  370. package/dashboard/dist/assets/index-mKcQGi2B.js.map +0 -1
  371. package/dashboard/dist/assets/index-zQiUPfxA.css +0 -1
  372. package/dashboard/dist/assets/useEventHooks-PDbuSJ12.js +0 -2
  373. package/dashboard/dist/assets/vendor-icons-BpZiWH2f.js.map +0 -1
@@ -0,0 +1,65 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ProcessesListPage-CfQEWaD4.js","./vendor-query-RUZdMvN6.js","./tasks-D0SQdENz.js","./workflows-qyc0ku_5.js","./useEventHooks-DZaYzE7s.js","./useFilterParams-crmlBw_l.js","./vendor-react-CdqEC2zv.js","./useDebouncedValue-C4P2jQuh.js","./api-path-u2Jf9QXS.js","./DataTable-Bir0Xs1p.js","./EmptyState-lpUFYfun.js","./TimestampCell-DoB8cYgw.js","./StickyPagination-DIeYMPPd.js","./FilterBar-DYFgzXNB.js","./vendor-icons-BxuyFxH2.js","./PageHeader-BJgWMZtw.js","./ListToolbar-Bl7F3A28.js","./WorkflowPill-tXU0-eXu.js","./ProcessDetailPage-DN9NqfeP.js","./PageHeaderWithStats-Ccio4vyG.js","./StatusBadge-DkgllZHv.js","./RolePill-BNAP-uK6.js","./UserName-BnLF6yhz.js","./users-D4DCFPH1.js","./McpOverview-_T9IsCD_.js","./mcp-QGf5jHCo.js","./pipelines-Byi6PnbE.js","./yaml-workflows-DWFww9Xn.js","./controlplane-TVCjDHQ-.js","./StatCard-BXQ8dD9Y.js","./McpRunsPage-L-1y8wnX.js","./useNamespace-C1OqiNXN.js","./ElapsedCell-WV6pUaKo.js","./RowActions-eYrzgQSj.js","./McpRunDetailPage-BhcqqtYS.js","./SegmentedTabs-DXNzY05q.js","./EventTable-BV6unphX.js","./SwimlaneTimeline-Br-nBA4l.js","./StreamMessageDetail-gU4CUeQI.js","./CopyableId-4Lqlc5cU.js","./McpQueryPage-DX5u-1bx.js","./mcp-query-BEJN1nMZ.js","./McpQueryDetailPage-DtsVqKPw.js","./TagInput-CvM5n6ww.js","./CollapsibleSection-B3FsrHwH.js","./useYamlActivityEvents-CkmXDm-Z.js","./helpers-DzO-OGPe.js","./RunAsSelector-twbuX7fB.js","./BotPicker-BBkJBXZB.js","./bots-Cy-Hmg7w.js","./ToolPill-BUjbC-Tj.js","./TimeAgo-C9yYnOui.js","./EscalationsOverview-DuIUyxr0.js","./AvailableEscalationsPage-CVlG_AVC.js","./task-queues-7-sHKPsN.js","./CustomDurationPicker-CCpqf3e4.js","./Modal-BU7No9NH.js","./constants-BHkpVaqx.js","./escalation-columns-BpkjKYGd.js","./EntityTimelinePanel-DrL86Yrf.js","./PriorityBadge-BETdj4M-.js","./CountdownTimer-B3nCqJdC.js","./OperatorDashboard-CIbDzOlh.js","./index-DOai950R.js","./WorkflowsOverview-CqZVarK-.js","./index-B7IaBPBg.js","./NamespacePill-in1SLd0W.js","./WorkflowsDashboard-B-u7zFKM.js","./YamlWorkflowsPage-BuQM6uZA.js","./GraphInvokePage-BGHVUipJ.js","./YamlWorkflowDetailPage-DiFLavW0.js","./TasksListPage-DVENC9Jp.js","./TaskDetailPage-_9cr_R0u.js","./WorkflowExecutionPage-xL956RZi.js","./AdminDashboard-DJ3LJQ09.js","./index-CtwbQ_-m.js","./TaskQueuePill-D4JPHXOq.js","./index-DTtHNC-D.js","./ConfirmDeleteModal-CQsJUzEa.js","./index-fgBDhnI6.js","./ToolTestPanel-CBtsIP8K.js","./index-Cfv86_L9.js","./index-BE0phFw0.js","./personas-DYtw1COf.js","./ScopeBadge-BG7KkZ8Q.js","./RolesPage-DCnW0VmD.js","./RoleDetailPage-BC5HL7ls.js","./AutoGrowTextarea-DgEQeRQw.js","./PersonasPage-DSdRb90f.js","./PersonaDetailPage-BOaf0TW1.js","./EscalationSchemaPage-D_UgP0pv.js","./EscalationListSchemaPage-CTQCALw4.js","./ScanCodesPage-CPNg6K--.js","./ScanSchemeDetailPage-DyLmCamO.js","./ScanStationPage-DoZccU5B.js","./index-7BP6FaCZ.js","./OperationsPage-i8KcDpKo.js","./index-DsWnVyVN.js","./index-CLPVqbVY.js","./CredentialsPage-Bv875IHe.js","./index-BYNN9N1T.js","./DropZone-CJkk-U3o.js","./index-Dy-MMYti.js","./knowledge-arh4NfmL.js","./HomePage-B-S2cK3E.js","./AgentsPage-Cwqka7nE.js","./agents-DU9GPovp.js","./AgentDetailPage-C6wfsnRe.js","./CronLabel-CSzjWuwj.js","./AgentConfigPage-BMMvaD0z.js","./capabilities-sSJJqrp-.js","./topics-DgDv5ZXP.js","./CapabilitiesPage-wxmE4917.js","./TopicsPage-CP7HFxIC.js","./TopicDetailPage-mR4Jaz83.js"])))=>i.map(i=>d[i]);
2
+ var Y_=Object.defineProperty;var X_=(i,t,r)=>t in i?Y_(i,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):i[t]=r;var A=(i,t,r)=>X_(i,typeof t!="symbol"?t+"":t,r);import{r as K_,a as j,j as y,u as pt,b as gt,c as Et,g as J_,Q as Q_,d as Z_}from"./vendor-query-RUZdMvN6.js";import{r as W_,u as go,a as mn,L as Ii,N as Hs,b as rb,c as Xn,O as Ls,d as ew,R as tw}from"./vendor-react-CdqEC2zv.js";import{X as Cn,E as nw,S as rw,a as ou,M as iw,C as ib,b as Yh,I as Xh,R as sb,B as ab,U as sw,c as aw,L as ow,d as lw,Z as cw,P as zg,e as ob,f as uw,g as Ug,h as Pg,i as Ig,j as fw,W as wd,k as hw,l as dw,F as mw,m as pw,n as gw,D as yw,N as bw,o as vw,p as xw,q as lb,r as cb,s as _w,t as ww,u as Sw,v as Ew,w as Ow,G as Aw,T as jw,x as Tw,y as Nw,z as kw}from"./vendor-icons-BxuyFxH2.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))s(l);new MutationObserver(l=>{for(const c of l)if(c.type==="childList")for(const m of c.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&s(m)}).observe(document,{childList:!0,subtree:!0});function r(l){const c={};return l.integrity&&(c.integrity=l.integrity),l.referrerPolicy&&(c.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?c.credentials="include":l.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function s(l){if(l.ep)return;l.ep=!0;const c=r(l);fetch(l.href,c)}})();var Th={exports:{}},Ga={},Nh={exports:{}},kh={};/**
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 $g;function Cw(){return $g||($g=1,(function(i){function t(Y,oe){var de=Y.length;Y.push(oe);e:for(;0<de;){var Oe=de-1>>>1,le=Y[Oe];if(0<l(le,oe))Y[Oe]=oe,Y[de]=le,de=Oe;else break e}}function r(Y){return Y.length===0?null:Y[0]}function s(Y){if(Y.length===0)return null;var oe=Y[0],de=Y.pop();if(de!==oe){Y[0]=de;e:for(var Oe=0,le=Y.length,je=le>>>1;Oe<je;){var Se=2*(Oe+1)-1,Ne=Y[Se],be=Se+1,at=Y[be];if(0>l(Ne,de))be<le&&0>l(at,Ne)?(Y[Oe]=at,Y[be]=de,Oe=be):(Y[Oe]=Ne,Y[Se]=de,Oe=Se);else if(be<le&&0>l(at,de))Y[Oe]=at,Y[be]=de,Oe=be;else break e}}return oe}function l(Y,oe){var de=Y.sortIndex-oe.sortIndex;return de!==0?de:Y.id-oe.id}if(i.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;i.unstable_now=function(){return c.now()}}else{var m=Date,p=m.now();i.unstable_now=function(){return m.now()-p}}var g=[],f=[],d=1,b=null,v=3,_=!1,w=!1,S=!1,M=!1,L=typeof setTimeout=="function"?setTimeout:null,z=typeof clearTimeout=="function"?clearTimeout:null,ie=typeof setImmediate<"u"?setImmediate:null;function ae(Y){for(var oe=r(f);oe!==null;){if(oe.callback===null)s(f);else if(oe.startTime<=Y)s(f),oe.sortIndex=oe.expirationTime,t(g,oe);else break;oe=r(f)}}function C(Y){if(S=!1,ae(Y),!w)if(r(g)!==null)w=!0,I||(I=!0,Q());else{var oe=r(f);oe!==null&&Te(C,oe.startTime-Y)}}var I=!1,re=-1,K=5,B=-1;function G(){return M?!0:!(i.unstable_now()-B<K)}function W(){if(M=!1,I){var Y=i.unstable_now();B=Y;var oe=!0;try{e:{w=!1,S&&(S=!1,z(re),re=-1),_=!0;var de=v;try{t:{for(ae(Y),b=r(g);b!==null&&!(b.expirationTime>Y&&G());){var Oe=b.callback;if(typeof Oe=="function"){b.callback=null,v=b.priorityLevel;var le=Oe(b.expirationTime<=Y);if(Y=i.unstable_now(),typeof le=="function"){b.callback=le,ae(Y),oe=!0;break t}b===r(g)&&s(g),ae(Y)}else s(g);b=r(g)}if(b!==null)oe=!0;else{var je=r(f);je!==null&&Te(C,je.startTime-Y),oe=!1}}break e}finally{b=null,v=de,_=!1}oe=void 0}}finally{oe?Q():I=!1}}}var Q;if(typeof ie=="function")Q=function(){ie(W)};else if(typeof MessageChannel<"u"){var he=new MessageChannel,_e=he.port2;he.port1.onmessage=W,Q=function(){_e.postMessage(null)}}else Q=function(){L(W,0)};function Te(Y,oe){re=L(function(){Y(i.unstable_now())},oe)}i.unstable_IdlePriority=5,i.unstable_ImmediatePriority=1,i.unstable_LowPriority=4,i.unstable_NormalPriority=3,i.unstable_Profiling=null,i.unstable_UserBlockingPriority=2,i.unstable_cancelCallback=function(Y){Y.callback=null},i.unstable_forceFrameRate=function(Y){0>Y||125<Y?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):K=0<Y?Math.floor(1e3/Y):5},i.unstable_getCurrentPriorityLevel=function(){return v},i.unstable_next=function(Y){switch(v){case 1:case 2:case 3:var oe=3;break;default:oe=v}var de=v;v=oe;try{return Y()}finally{v=de}},i.unstable_requestPaint=function(){M=!0},i.unstable_runWithPriority=function(Y,oe){switch(Y){case 1:case 2:case 3:case 4:case 5:break;default:Y=3}var de=v;v=Y;try{return oe()}finally{v=de}},i.unstable_scheduleCallback=function(Y,oe,de){var Oe=i.unstable_now();switch(typeof de=="object"&&de!==null?(de=de.delay,de=typeof de=="number"&&0<de?Oe+de:Oe):de=Oe,Y){case 1:var le=-1;break;case 2:le=250;break;case 5:le=1073741823;break;case 4:le=1e4;break;default:le=5e3}return le=de+le,Y={id:d++,callback:oe,priorityLevel:Y,startTime:de,expirationTime:le,sortIndex:-1},de>Oe?(Y.sortIndex=de,t(f,Y),r(g)===null&&Y===r(f)&&(S?(z(re),re=-1):S=!0,Te(C,de-Oe))):(Y.sortIndex=le,t(g,Y),w||_||(w=!0,I||(I=!0,Q()))),Y},i.unstable_shouldYield=G,i.unstable_wrapCallback=function(Y){var oe=v;return function(){var de=v;v=oe;try{return Y.apply(this,arguments)}finally{v=de}}}})(kh)),kh}var Hg;function Mw(){return Hg||(Hg=1,Nh.exports=Cw()),Nh.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 Gg;function Rw(){if(Gg)return Ga;Gg=1;var i=Mw(),t=K_(),r=W_();function s(e){var n="https://react.dev/errors/"+e;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)n+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+e+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function c(e){var n=e,a=e;if(e.alternate)for(;n.return;)n=n.return;else{e=n;do n=e,(n.flags&4098)!==0&&(a=n.return),e=n.return;while(e)}return n.tag===3?a:null}function m(e){if(e.tag===13){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function p(e){if(e.tag===31){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function g(e){if(c(e)!==e)throw Error(s(188))}function f(e){var n=e.alternate;if(!n){if(n=c(e),n===null)throw Error(s(188));return n!==e?null:e}for(var a=e,o=n;;){var u=a.return;if(u===null)break;var h=u.alternate;if(h===null){if(o=u.return,o!==null){a=o;continue}break}if(u.child===h.child){for(h=u.child;h;){if(h===a)return g(u),e;if(h===o)return g(u),n;h=h.sibling}throw Error(s(188))}if(a.return!==o.return)a=u,o=h;else{for(var x=!1,E=u.child;E;){if(E===a){x=!0,a=u,o=h;break}if(E===o){x=!0,o=u,a=h;break}E=E.sibling}if(!x){for(E=h.child;E;){if(E===a){x=!0,a=h,o=u;break}if(E===o){x=!0,o=h,a=u;break}E=E.sibling}if(!x)throw Error(s(189))}}if(a.alternate!==o)throw Error(s(190))}if(a.tag!==3)throw Error(s(188));return a.stateNode.current===a?e:n}function d(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e;for(e=e.child;e!==null;){if(n=d(e),n!==null)return n;e=e.sibling}return null}var b=Object.assign,v=Symbol.for("react.element"),_=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),M=Symbol.for("react.strict_mode"),L=Symbol.for("react.profiler"),z=Symbol.for("react.consumer"),ie=Symbol.for("react.context"),ae=Symbol.for("react.forward_ref"),C=Symbol.for("react.suspense"),I=Symbol.for("react.suspense_list"),re=Symbol.for("react.memo"),K=Symbol.for("react.lazy"),B=Symbol.for("react.activity"),G=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 he=Symbol.for("react.client.reference");function _e(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===he?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case S:return"Fragment";case L:return"Profiler";case M:return"StrictMode";case C:return"Suspense";case I:return"SuspenseList";case B:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case w:return"Portal";case ie:return e.displayName||"Context";case z:return(e._context.displayName||"Context")+".Consumer";case ae:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case re:return n=e.displayName||null,n!==null?n:_e(e.type)||"Memo";case K:n=e._payload,e=e._init;try{return _e(e(n))}catch{}}return null}var Te=Array.isArray,Y=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,oe=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,de={pending:!1,data:null,method:null,action:null},Oe=[],le=-1;function je(e){return{current:e}}function Se(e){0>le||(e.current=Oe[le],Oe[le]=null,le--)}function Ne(e,n){le++,Oe[le]=e.current,e.current=n}var be=je(null),at=je(null),Ht=je(null),Rt=je(null);function Dt(e,n){switch(Ne(Ht,n),Ne(at,e),Ne(be,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?og(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=og(n),e=lg(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Se(be),Ne(be,e)}function ke(){Se(be),Se(at),Se(Ht)}function qt(e){e.memoizedState!==null&&Ne(Rt,e);var n=be.current,a=lg(n,e.type);n!==a&&(Ne(at,e),Ne(be,a))}function di(e){at.current===e&&(Se(be),Se(at)),Rt.current===e&&(Se(Rt),Pa._currentValue=de)}var Gi,mi;function yn(e){if(Gi===void 0)try{throw Error()}catch(a){var n=a.stack.trim().match(/\n( *(at )?)/);Gi=n&&n[1]||"",mi=-1<a.stack.indexOf(`
19
+ at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
20
+ `+Gi+e+mi}var Fi=!1;function Ar(e,n){if(!e||Fi)return"";Fi=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var o={DetermineComponentFrameRoot:function(){try{if(n){var ne=function(){throw Error()};if(Object.defineProperty(ne.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ne,[])}catch(X){var F=X}Reflect.construct(e,[],ne)}else{try{ne.call()}catch(X){F=X}e.call(ne.prototype)}}else{try{throw Error()}catch(X){F=X}(ne=e())&&typeof ne.catch=="function"&&ne.catch(function(){})}}catch(X){if(X&&F&&typeof X.stack=="string")return[X.stack,F.stack]}return[null,null]}};o.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var u=Object.getOwnPropertyDescriptor(o.DetermineComponentFrameRoot,"name");u&&u.configurable&&Object.defineProperty(o.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var h=o.DetermineComponentFrameRoot(),x=h[0],E=h[1];if(x&&E){var R=x.split(`
21
+ `),H=E.split(`
22
+ `);for(u=o=0;o<R.length&&!R[o].includes("DetermineComponentFrameRoot");)o++;for(;u<H.length&&!H[u].includes("DetermineComponentFrameRoot");)u++;if(o===R.length||u===H.length)for(o=R.length-1,u=H.length-1;1<=o&&0<=u&&R[o]!==H[u];)u--;for(;1<=o&&0<=u;o--,u--)if(R[o]!==H[u]){if(o!==1||u!==1)do if(o--,u--,0>u||R[o]!==H[u]){var J=`
23
+ `+R[o].replace(" at new "," at ");return e.displayName&&J.includes("<anonymous>")&&(J=J.replace("<anonymous>",e.displayName)),J}while(1<=o&&0<=u);break}}}finally{Fi=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?yn(a):""}function Eo(e,n){switch(e.tag){case 26:case 27:case 5:return yn(e.type);case 16:return yn("Lazy");case 13:return e.child!==n&&n!==null?yn("Suspense Fallback"):yn("Suspense");case 19:return yn("SuspenseList");case 0:case 15:return Ar(e.type,!1);case 11:return Ar(e.type.render,!1);case 1:return Ar(e.type,!0);case 31:return yn("Activity");default:return""}}function Oo(e){try{var n="",a=null;do n+=Eo(e,a),a=e,e=e.return;while(e);return n}catch(o){return`
24
+ Error generating stack: `+o.message+`
25
+ `+o.stack}}var Js=Object.prototype.hasOwnProperty,Qs=i.unstable_scheduleCallback,Wn=i.unstable_cancelCallback,Ao=i.unstable_shouldYield,Vi=i.unstable_requestPaint,nt=i.unstable_now,yu=i.unstable_getCurrentPriorityLevel,jo=i.unstable_ImmediatePriority,To=i.unstable_UserBlockingPriority,Yi=i.unstable_NormalPriority,bu=i.unstable_LowPriority,No=i.unstable_IdlePriority,vu=i.log,ko=i.unstable_setDisableYieldValue,pi=null,ft=null;function Jt(e){if(typeof vu=="function"&&ko(e),ft&&typeof ft.setStrictMode=="function")try{ft.setStrictMode(pi,e)}catch{}}var Bt=Math.clz32?Math.clz32:Xi,Zs=Math.log,Ws=Math.LN2;function Xi(e){return e>>>=0,e===0?32:31-(Zs(e)/Ws|0)|0}var jr=256,er=262144,Tr=4194304;function Mn(e){var n=e&42;if(n!==0)return n;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function gi(e,n,a){var o=e.pendingLanes;if(o===0)return 0;var u=0,h=e.suspendedLanes,x=e.pingedLanes;e=e.warmLanes;var E=o&134217727;return E!==0?(o=E&~h,o!==0?u=Mn(o):(x&=E,x!==0?u=Mn(x):a||(a=E&~e,a!==0&&(u=Mn(a))))):(E=o&~h,E!==0?u=Mn(E):x!==0?u=Mn(x):a||(a=o&~e,a!==0&&(u=Mn(a)))),u===0?0:n!==0&&n!==u&&(n&h)===0&&(h=u&-u,a=n&-n,h>=a||h===32&&(a&4194048)!==0)?n:u}function yi(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)===0}function ea(e,n){switch(e){case 1:case 2:case 4:case 8:case 64:return n+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ki(){var e=Tr;return Tr<<=1,(Tr&62914560)===0&&(Tr=4194304),e}function Nr(e){for(var n=[],a=0;31>a;a++)n.push(e);return n}function Rn(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function kr(e,n,a,o,u,h){var x=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,H=e.hiddenUpdates;for(a=x&~a;0<a;){var J=31-Bt(a),ne=1<<J;E[J]=0,R[J]=-1;var F=H[J];if(F!==null)for(H[J]=null,J=0;J<F.length;J++){var X=F[J];X!==null&&(X.lane&=-536870913)}a&=~ne}o!==0&&Cr(e,o,0),h!==0&&u===0&&e.tag!==0&&(e.suspendedLanes|=h&~(x&~n))}function Cr(e,n,a){e.pendingLanes|=n,e.suspendedLanes&=~n;var o=31-Bt(n);e.entangledLanes|=n,e.entanglements[o]=e.entanglements[o]|1073741824|a&261930}function bi(e,n){var a=e.entangledLanes|=n;for(e=e.entanglements;a;){var o=31-Bt(a),u=1<<o;u&n|e[o]&n&&(e[o]|=n),a&=~u}}function Mr(e,n){var a=n&-n;return a=(a&42)!==0?1:tr(a),(a&(e.suspendedLanes|n))!==0?0:a}function tr(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 vi(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function ta(){var e=oe.p;return e!==0?e:(e=window.event,e===void 0?32:Cg(e.type))}function Co(e,n){var a=oe.p;try{return oe.p=e,n()}finally{oe.p=a}}var Hn=Math.random().toString(36).slice(2),Qe="__reactFiber$"+Hn,ot="__reactProps$"+Hn,Qt="__reactContainer$"+Hn,xi="__reactEvents$"+Hn,na="__reactListeners$"+Hn,Mo="__reactHandles$"+Hn,Ro="__reactResources$"+Hn,wt="__reactMarker$"+Hn;function Ji(e){delete e[Qe],delete e[ot],delete e[xi],delete e[na],delete e[Mo]}function O(e){var n=e[Qe];if(n)return n;for(var a=e.parentNode;a;){if(n=a[Qt]||a[Qe]){if(a=n.alternate,n.child!==null||a!==null&&a.child!==null)for(e=pg(e);e!==null;){if(a=e[Qe])return a;e=pg(e)}return n}e=a,a=e.parentNode}return null}function N(e){if(e=e[Qe]||e[Qt]){var n=e.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return e}return null}function T(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e.stateNode;throw Error(s(33))}function k(e){var n=e[Ro];return n||(n=e[Ro]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function D(e){e[wt]=!0}var P=new Set,te={};function se(e,n){V(e,n),V(e+"Capture",n)}function V(e,n){for(te[e]=n,e=0;e<n.length;e++)P.add(n[e])}var ee=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),pe={},Re={};function We(e){return Js.call(Re,e)?!0:Js.call(pe,e)?!1:ee.test(e)?Re[e]=!0:(pe[e]=!0,!1)}function Lt(e,n,a){if(We(n))if(a===null)e.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":e.removeAttribute(n);return;case"boolean":var o=n.toLowerCase().slice(0,5);if(o!=="data-"&&o!=="aria-"){e.removeAttribute(n);return}}e.setAttribute(n,""+a)}}function Dn(e,n,a){if(a===null)e.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttribute(n,""+a)}}function nr(e,n,a,o){if(o===null)e.removeAttribute(a);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttributeNS(n,a,""+o)}}function bn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Wd(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function Pv(e,n,a){var o=Object.getOwnPropertyDescriptor(e.constructor.prototype,n);if(!e.hasOwnProperty(n)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var u=o.get,h=o.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return u.call(this)},set:function(x){a=""+x,h.call(this,x)}}),Object.defineProperty(e,n,{enumerable:o.enumerable}),{getValue:function(){return a},setValue:function(x){a=""+x},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function xu(e){if(!e._valueTracker){var n=Wd(e)?"checked":"value";e._valueTracker=Pv(e,n,""+e[n])}}function em(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var a=n.getValue(),o="";return e&&(o=Wd(e)?e.checked?"true":"false":e.value),e=o,e!==a?(n.setValue(e),!0):!1}function Do(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 Iv=/[\n"\\]/g;function vn(e){return e.replace(Iv,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function _u(e,n,a,o,u,h,x,E){e.name="",x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"?e.type=x:e.removeAttribute("type"),n!=null?x==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+bn(n)):e.value!==""+bn(n)&&(e.value=""+bn(n)):x!=="submit"&&x!=="reset"||e.removeAttribute("value"),n!=null?wu(e,x,bn(n)):a!=null?wu(e,x,bn(a)):o!=null&&e.removeAttribute("value"),u==null&&h!=null&&(e.defaultChecked=!!h),u!=null&&(e.checked=u&&typeof u!="function"&&typeof u!="symbol"),E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"?e.name=""+bn(E):e.removeAttribute("name")}function tm(e,n,a,o,u,h,x,E){if(h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"&&(e.type=h),n!=null||a!=null){if(!(h!=="submit"&&h!=="reset"||n!=null)){xu(e);return}a=a!=null?""+bn(a):"",n=n!=null?""+bn(n):a,E||n===e.value||(e.value=n),e.defaultValue=n}o=o??u,o=typeof o!="function"&&typeof o!="symbol"&&!!o,e.checked=E?e.checked:!!o,e.defaultChecked=!!o,x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(e.name=x),xu(e)}function wu(e,n,a){n==="number"&&Do(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function Qi(e,n,a,o){if(e=e.options,n){n={};for(var u=0;u<a.length;u++)n["$"+a[u]]=!0;for(a=0;a<e.length;a++)u=n.hasOwnProperty("$"+e[a].value),e[a].selected!==u&&(e[a].selected=u),u&&o&&(e[a].defaultSelected=!0)}else{for(a=""+bn(a),n=null,u=0;u<e.length;u++){if(e[u].value===a){e[u].selected=!0,o&&(e[u].defaultSelected=!0);return}n!==null||e[u].disabled||(n=e[u])}n!==null&&(n.selected=!0)}}function nm(e,n,a){if(n!=null&&(n=""+bn(n),n!==e.value&&(e.value=n),a==null)){e.defaultValue!==n&&(e.defaultValue=n);return}e.defaultValue=a!=null?""+bn(a):""}function rm(e,n,a,o){if(n==null){if(o!=null){if(a!=null)throw Error(s(92));if(Te(o)){if(1<o.length)throw Error(s(93));o=o[0]}a=o}a==null&&(a=""),n=a}a=bn(n),e.defaultValue=a,o=e.textContent,o===a&&o!==""&&o!==null&&(e.value=o),xu(e)}function Zi(e,n){if(n){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=n;return}}e.textContent=n}var $v=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 im(e,n,a){var o=n.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?o?e.setProperty(n,""):n==="float"?e.cssFloat="":e[n]="":o?e.setProperty(n,a):typeof a!="number"||a===0||$v.has(n)?n==="float"?e.cssFloat=a:e[n]=(""+a).trim():e[n]=a+"px"}function sm(e,n,a){if(n!=null&&typeof n!="object")throw Error(s(62));if(e=e.style,a!=null){for(var o in a)!a.hasOwnProperty(o)||n!=null&&n.hasOwnProperty(o)||(o.indexOf("--")===0?e.setProperty(o,""):o==="float"?e.cssFloat="":e[o]="");for(var u in n)o=n[u],n.hasOwnProperty(u)&&a[u]!==o&&im(e,u,o)}else for(var h in n)n.hasOwnProperty(h)&&im(e,h,n[h])}function Su(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 Hv=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"]]),Gv=/^[\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 qo(e){return Gv.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function rr(){}var Eu=null;function Ou(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Wi=null,es=null;function am(e){var n=N(e);if(n&&(e=n.stateNode)){var a=e[ot]||null;e:switch(e=n.stateNode,n.type){case"input":if(_u(e,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),n=a.name,a.type==="radio"&&n!=null){for(a=e;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+vn(""+n)+'"][type="radio"]'),n=0;n<a.length;n++){var o=a[n];if(o!==e&&o.form===e.form){var u=o[ot]||null;if(!u)throw Error(s(90));_u(o,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name)}}for(n=0;n<a.length;n++)o=a[n],o.form===e.form&&em(o)}break e;case"textarea":nm(e,a.value,a.defaultValue);break e;case"select":n=a.value,n!=null&&Qi(e,!!a.multiple,n,!1)}}}var Au=!1;function om(e,n,a){if(Au)return e(n,a);Au=!0;try{var o=e(n);return o}finally{if(Au=!1,(Wi!==null||es!==null)&&(wl(),Wi&&(n=Wi,e=es,es=Wi=null,am(n),e)))for(n=0;n<e.length;n++)am(e[n])}}function ra(e,n){var a=e.stateNode;if(a===null)return null;var o=a[ot]||null;if(o===null)return null;a=o[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(o=!o.disabled)||(e=e.type,o=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!o;break e;default:e=!1}if(e)return null;if(a&&typeof a!="function")throw Error(s(231,n,typeof a));return a}var ir=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ju=!1;if(ir)try{var ia={};Object.defineProperty(ia,"passive",{get:function(){ju=!0}}),window.addEventListener("test",ia,ia),window.removeEventListener("test",ia,ia)}catch{ju=!1}var Rr=null,Tu=null,Bo=null;function lm(){if(Bo)return Bo;var e,n=Tu,a=n.length,o,u="value"in Rr?Rr.value:Rr.textContent,h=u.length;for(e=0;e<a&&n[e]===u[e];e++);var x=a-e;for(o=1;o<=x&&n[a-o]===u[h-o];o++);return Bo=u.slice(e,1<o?1-o:void 0)}function Lo(e){var n=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&n===13&&(e=13)):e=n,e===10&&(e=13),32<=e||e===13?e:0}function zo(){return!0}function cm(){return!1}function Gt(e){function n(a,o,u,h,x){this._reactName=a,this._targetInst=u,this.type=o,this.nativeEvent=h,this.target=x,this.currentTarget=null;for(var E in e)e.hasOwnProperty(E)&&(a=e[E],this[E]=a?a(h):h[E]);return this.isDefaultPrevented=(h.defaultPrevented!=null?h.defaultPrevented:h.returnValue===!1)?zo:cm,this.isPropagationStopped=cm,this}return b(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=zo)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=zo)},persist:function(){},isPersistent:zo}),n}var _i={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Uo=Gt(_i),sa=b({},_i,{view:0,detail:0}),Fv=Gt(sa),Nu,ku,aa,Po=b({},sa,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Mu,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!==aa&&(aa&&e.type==="mousemove"?(Nu=e.screenX-aa.screenX,ku=e.screenY-aa.screenY):ku=Nu=0,aa=e),Nu)},movementY:function(e){return"movementY"in e?e.movementY:ku}}),um=Gt(Po),Vv=b({},Po,{dataTransfer:0}),Yv=Gt(Vv),Xv=b({},sa,{relatedTarget:0}),Cu=Gt(Xv),Kv=b({},_i,{animationName:0,elapsedTime:0,pseudoElement:0}),Jv=Gt(Kv),Qv=b({},_i,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Zv=Gt(Qv),Wv=b({},_i,{data:0}),fm=Gt(Wv),ex={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},tx={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"},nx={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function rx(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=nx[e])?!!n[e]:!1}function Mu(){return rx}var ix=b({},sa,{key:function(e){if(e.key){var n=ex[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=Lo(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?tx[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Mu,charCode:function(e){return e.type==="keypress"?Lo(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Lo(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),sx=Gt(ix),ax=b({},Po,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),hm=Gt(ax),ox=b({},sa,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Mu}),lx=Gt(ox),cx=b({},_i,{propertyName:0,elapsedTime:0,pseudoElement:0}),ux=Gt(cx),fx=b({},Po,{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}),hx=Gt(fx),dx=b({},_i,{newState:0,oldState:0}),mx=Gt(dx),px=[9,13,27,32],Ru=ir&&"CompositionEvent"in window,oa=null;ir&&"documentMode"in document&&(oa=document.documentMode);var gx=ir&&"TextEvent"in window&&!oa,dm=ir&&(!Ru||oa&&8<oa&&11>=oa),mm=" ",pm=!1;function gm(e,n){switch(e){case"keyup":return px.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ym(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ts=!1;function yx(e,n){switch(e){case"compositionend":return ym(n);case"keypress":return n.which!==32?null:(pm=!0,mm);case"textInput":return e=n.data,e===mm&&pm?null:e;default:return null}}function bx(e,n){if(ts)return e==="compositionend"||!Ru&&gm(e,n)?(e=lm(),Bo=Tu=Rr=null,ts=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return dm&&n.locale!=="ko"?null:n.data;default:return null}}var vx={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 bm(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n==="input"?!!vx[e.type]:n==="textarea"}function vm(e,n,a,o){Wi?es?es.push(o):es=[o]:Wi=o,n=Nl(n,"onChange"),0<n.length&&(a=new Uo("onChange","change",null,a,o),e.push({event:a,listeners:n}))}var la=null,ca=null;function xx(e){tg(e,0)}function Io(e){var n=T(e);if(em(n))return e}function xm(e,n){if(e==="change")return n}var _m=!1;if(ir){var Du;if(ir){var qu="oninput"in document;if(!qu){var wm=document.createElement("div");wm.setAttribute("oninput","return;"),qu=typeof wm.oninput=="function"}Du=qu}else Du=!1;_m=Du&&(!document.documentMode||9<document.documentMode)}function Sm(){la&&(la.detachEvent("onpropertychange",Em),ca=la=null)}function Em(e){if(e.propertyName==="value"&&Io(ca)){var n=[];vm(n,ca,e,Ou(e)),om(xx,n)}}function _x(e,n,a){e==="focusin"?(Sm(),la=n,ca=a,la.attachEvent("onpropertychange",Em)):e==="focusout"&&Sm()}function wx(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Io(ca)}function Sx(e,n){if(e==="click")return Io(n)}function Ex(e,n){if(e==="input"||e==="change")return Io(n)}function Ox(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var Zt=typeof Object.is=="function"?Object.is:Ox;function ua(e,n){if(Zt(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;var a=Object.keys(e),o=Object.keys(n);if(a.length!==o.length)return!1;for(o=0;o<a.length;o++){var u=a[o];if(!Js.call(n,u)||!Zt(e[u],n[u]))return!1}return!0}function Om(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Am(e,n){var a=Om(e);e=0;for(var o;a;){if(a.nodeType===3){if(o=e+a.textContent.length,e<=n&&o>=n)return{node:a,offset:n-e};e=o}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Om(a)}}function jm(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?jm(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function Tm(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=Do(e.document);n instanceof e.HTMLIFrameElement;){try{var a=typeof n.contentWindow.location.href=="string"}catch{a=!1}if(a)e=n.contentWindow;else break;n=Do(e.document)}return n}function Bu(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}var Ax=ir&&"documentMode"in document&&11>=document.documentMode,ns=null,Lu=null,fa=null,zu=!1;function Nm(e,n,a){var o=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;zu||ns==null||ns!==Do(o)||(o=ns,"selectionStart"in o&&Bu(o)?o={start:o.selectionStart,end:o.selectionEnd}:(o=(o.ownerDocument&&o.ownerDocument.defaultView||window).getSelection(),o={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}),fa&&ua(fa,o)||(fa=o,o=Nl(Lu,"onSelect"),0<o.length&&(n=new Uo("onSelect","select",null,n,a),e.push({event:n,listeners:o}),n.target=ns)))}function wi(e,n){var a={};return a[e.toLowerCase()]=n.toLowerCase(),a["Webkit"+e]="webkit"+n,a["Moz"+e]="moz"+n,a}var rs={animationend:wi("Animation","AnimationEnd"),animationiteration:wi("Animation","AnimationIteration"),animationstart:wi("Animation","AnimationStart"),transitionrun:wi("Transition","TransitionRun"),transitionstart:wi("Transition","TransitionStart"),transitioncancel:wi("Transition","TransitionCancel"),transitionend:wi("Transition","TransitionEnd")},Uu={},km={};ir&&(km=document.createElement("div").style,"AnimationEvent"in window||(delete rs.animationend.animation,delete rs.animationiteration.animation,delete rs.animationstart.animation),"TransitionEvent"in window||delete rs.transitionend.transition);function Si(e){if(Uu[e])return Uu[e];if(!rs[e])return e;var n=rs[e],a;for(a in n)if(n.hasOwnProperty(a)&&a in km)return Uu[e]=n[a];return e}var Cm=Si("animationend"),Mm=Si("animationiteration"),Rm=Si("animationstart"),jx=Si("transitionrun"),Tx=Si("transitionstart"),Nx=Si("transitioncancel"),Dm=Si("transitionend"),qm=new Map,Pu="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(" ");Pu.push("scrollEnd");function qn(e,n){qm.set(e,n),se(n,[e])}var $o=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},xn=[],is=0,Iu=0;function Ho(){for(var e=is,n=Iu=is=0;n<e;){var a=xn[n];xn[n++]=null;var o=xn[n];xn[n++]=null;var u=xn[n];xn[n++]=null;var h=xn[n];if(xn[n++]=null,o!==null&&u!==null){var x=o.pending;x===null?u.next=u:(u.next=x.next,x.next=u),o.pending=u}h!==0&&Bm(a,u,h)}}function Go(e,n,a,o){xn[is++]=e,xn[is++]=n,xn[is++]=a,xn[is++]=o,Iu|=o,e.lanes|=o,e=e.alternate,e!==null&&(e.lanes|=o)}function $u(e,n,a,o){return Go(e,n,a,o),Fo(e)}function Ei(e,n){return Go(e,null,null,n),Fo(e)}function Bm(e,n,a){e.lanes|=a;var o=e.alternate;o!==null&&(o.lanes|=a);for(var u=!1,h=e.return;h!==null;)h.childLanes|=a,o=h.alternate,o!==null&&(o.childLanes|=a),h.tag===22&&(e=h.stateNode,e===null||e._visibility&1||(u=!0)),e=h,h=h.return;return e.tag===3?(h=e.stateNode,u&&n!==null&&(u=31-Bt(a),e=h.hiddenUpdates,o=e[u],o===null?e[u]=[n]:o.push(n),n.lane=a|536870912),h):null}function Fo(e){if(50<Ra)throw Ra=0,Zf=null,Error(s(185));for(var n=e.return;n!==null;)e=n,n=e.return;return e.tag===3?e.stateNode:null}var ss={};function kx(e,n,a,o){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=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=o,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Wt(e,n,a,o){return new kx(e,n,a,o)}function Hu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function sr(e,n){var a=e.alternate;return a===null?(a=Wt(e.tag,n,e.key,e.mode),a.elementType=e.elementType,a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=n,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,n=e.dependencies,a.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a.refCleanup=e.refCleanup,a}function Lm(e,n){e.flags&=65011714;var a=e.alternate;return a===null?(e.childLanes=0,e.lanes=n,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=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,n=a.dependencies,e.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),e}function Vo(e,n,a,o,u,h){var x=0;if(o=e,typeof e=="function")Hu(e)&&(x=1);else if(typeof e=="string")x=q_(e,a,be.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case B:return e=Wt(31,a,n,u),e.elementType=B,e.lanes=h,e;case S:return Oi(a.children,u,h,n);case M:x=8,u|=24;break;case L:return e=Wt(12,a,n,u|2),e.elementType=L,e.lanes=h,e;case C:return e=Wt(13,a,n,u),e.elementType=C,e.lanes=h,e;case I:return e=Wt(19,a,n,u),e.elementType=I,e.lanes=h,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case ie:x=10;break e;case z:x=9;break e;case ae:x=11;break e;case re:x=14;break e;case K:x=16,o=null;break e}x=29,a=Error(s(130,e===null?"null":typeof e,"")),o=null}return n=Wt(x,a,n,u),n.elementType=e,n.type=o,n.lanes=h,n}function Oi(e,n,a,o){return e=Wt(7,e,o,n),e.lanes=a,e}function Gu(e,n,a){return e=Wt(6,e,null,n),e.lanes=a,e}function zm(e){var n=Wt(18,null,null,0);return n.stateNode=e,n}function Fu(e,n,a){return n=Wt(4,e.children!==null?e.children:[],e.key,n),n.lanes=a,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}var Um=new WeakMap;function _n(e,n){if(typeof e=="object"&&e!==null){var a=Um.get(e);return a!==void 0?a:(n={value:e,source:n,stack:Oo(n)},Um.set(e,n),n)}return{value:e,source:n,stack:Oo(n)}}var as=[],os=0,Yo=null,ha=0,wn=[],Sn=0,Dr=null,Gn=1,Fn="";function ar(e,n){as[os++]=ha,as[os++]=Yo,Yo=e,ha=n}function Pm(e,n,a){wn[Sn++]=Gn,wn[Sn++]=Fn,wn[Sn++]=Dr,Dr=e;var o=Gn;e=Fn;var u=32-Bt(o)-1;o&=~(1<<u),a+=1;var h=32-Bt(n)+u;if(30<h){var x=u-u%5;h=(o&(1<<x)-1).toString(32),o>>=x,u-=x,Gn=1<<32-Bt(n)+u|a<<u|o,Fn=h+e}else Gn=1<<h|a<<u|o,Fn=e}function Vu(e){e.return!==null&&(ar(e,1),Pm(e,1,0))}function Yu(e){for(;e===Yo;)Yo=as[--os],as[os]=null,ha=as[--os],as[os]=null;for(;e===Dr;)Dr=wn[--Sn],wn[Sn]=null,Fn=wn[--Sn],wn[Sn]=null,Gn=wn[--Sn],wn[Sn]=null}function Im(e,n){wn[Sn++]=Gn,wn[Sn++]=Fn,wn[Sn++]=Dr,Gn=n.id,Fn=n.overflow,Dr=e}var Tt=null,et=null,ze=!1,qr=null,En=!1,Xu=Error(s(519));function Br(e){var n=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw da(_n(n,e)),Xu}function $m(e){var n=e.stateNode,a=e.type,o=e.memoizedProps;switch(n[Qe]=e,n[ot]=o,a){case"dialog":qe("cancel",n),qe("close",n);break;case"iframe":case"object":case"embed":qe("load",n);break;case"video":case"audio":for(a=0;a<qa.length;a++)qe(qa[a],n);break;case"source":qe("error",n);break;case"img":case"image":case"link":qe("error",n),qe("load",n);break;case"details":qe("toggle",n);break;case"input":qe("invalid",n),tm(n,o.value,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name,!0);break;case"select":qe("invalid",n);break;case"textarea":qe("invalid",n),rm(n,o.value,o.defaultValue,o.children)}a=o.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||n.textContent===""+a||o.suppressHydrationWarning===!0||sg(n.textContent,a)?(o.popover!=null&&(qe("beforetoggle",n),qe("toggle",n)),o.onScroll!=null&&qe("scroll",n),o.onScrollEnd!=null&&qe("scrollend",n),o.onClick!=null&&(n.onclick=rr),n=!0):n=!1,n||Br(e,!0)}function Hm(e){for(Tt=e.return;Tt;)switch(Tt.tag){case 5:case 31:case 13:En=!1;return;case 27:case 3:En=!0;return;default:Tt=Tt.return}}function ls(e){if(e!==Tt)return!1;if(!ze)return Hm(e),ze=!0,!1;var n=e.tag,a;if((a=n!==3&&n!==27)&&((a=n===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||dh(e.type,e.memoizedProps)),a=!a),a&&et&&Br(e),Hm(e),n===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(s(317));et=mg(e)}else if(n===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(s(317));et=mg(e)}else n===27?(n=et,Jr(e.type)?(e=bh,bh=null,et=e):et=n):et=Tt?An(e.stateNode.nextSibling):null;return!0}function Ai(){et=Tt=null,ze=!1}function Ku(){var e=qr;return e!==null&&(Xt===null?Xt=e:Xt.push.apply(Xt,e),qr=null),e}function da(e){qr===null?qr=[e]:qr.push(e)}var Ju=je(null),ji=null,or=null;function Lr(e,n,a){Ne(Ju,n._currentValue),n._currentValue=a}function lr(e){e._currentValue=Ju.current,Se(Ju)}function Qu(e,n,a){for(;e!==null;){var o=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,o!==null&&(o.childLanes|=n)):o!==null&&(o.childLanes&n)!==n&&(o.childLanes|=n),e===a)break;e=e.return}}function Zu(e,n,a,o){var u=e.child;for(u!==null&&(u.return=e);u!==null;){var h=u.dependencies;if(h!==null){var x=u.child;h=h.firstContext;e:for(;h!==null;){var E=h;h=u;for(var R=0;R<n.length;R++)if(E.context===n[R]){h.lanes|=a,E=h.alternate,E!==null&&(E.lanes|=a),Qu(h.return,a,e),o||(x=null);break e}h=E.next}}else if(u.tag===18){if(x=u.return,x===null)throw Error(s(341));x.lanes|=a,h=x.alternate,h!==null&&(h.lanes|=a),Qu(x,a,e),x=null}else x=u.child;if(x!==null)x.return=u;else for(x=u;x!==null;){if(x===e){x=null;break}if(u=x.sibling,u!==null){u.return=x.return,x=u;break}x=x.return}u=x}}function cs(e,n,a,o){e=null;for(var u=n,h=!1;u!==null;){if(!h){if((u.flags&524288)!==0)h=!0;else if((u.flags&262144)!==0)break}if(u.tag===10){var x=u.alternate;if(x===null)throw Error(s(387));if(x=x.memoizedProps,x!==null){var E=u.type;Zt(u.pendingProps.value,x.value)||(e!==null?e.push(E):e=[E])}}else if(u===Rt.current){if(x=u.alternate,x===null)throw Error(s(387));x.memoizedState.memoizedState!==u.memoizedState.memoizedState&&(e!==null?e.push(Pa):e=[Pa])}u=u.return}e!==null&&Zu(n,e,a,o),n.flags|=262144}function Xo(e){for(e=e.firstContext;e!==null;){if(!Zt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Ti(e){ji=e,or=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Nt(e){return Gm(ji,e)}function Ko(e,n){return ji===null&&Ti(e),Gm(e,n)}function Gm(e,n){var a=n._currentValue;if(n={context:n,memoizedValue:a,next:null},or===null){if(e===null)throw Error(s(308));or=n,e.dependencies={lanes:0,firstContext:n},e.flags|=524288}else or=or.next=n;return a}var Cx=typeof AbortController<"u"?AbortController:function(){var e=[],n=this.signal={aborted:!1,addEventListener:function(a,o){e.push(o)}};this.abort=function(){n.aborted=!0,e.forEach(function(a){return a()})}},Mx=i.unstable_scheduleCallback,Rx=i.unstable_NormalPriority,yt={$$typeof:ie,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Wu(){return{controller:new Cx,data:new Map,refCount:0}}function ma(e){e.refCount--,e.refCount===0&&Mx(Rx,function(){e.controller.abort()})}var pa=null,ef=0,us=0,fs=null;function Dx(e,n){if(pa===null){var a=pa=[];ef=0,us=ih(),fs={status:"pending",value:void 0,then:function(o){a.push(o)}}}return ef++,n.then(Fm,Fm),n}function Fm(){if(--ef===0&&pa!==null){fs!==null&&(fs.status="fulfilled");var e=pa;pa=null,us=0,fs=null;for(var n=0;n<e.length;n++)(0,e[n])()}}function qx(e,n){var a=[],o={status:"pending",value:null,reason:null,then:function(u){a.push(u)}};return e.then(function(){o.status="fulfilled",o.value=n;for(var u=0;u<a.length;u++)(0,a[u])(n)},function(u){for(o.status="rejected",o.reason=u,u=0;u<a.length;u++)(0,a[u])(void 0)}),o}var Vm=Y.S;Y.S=function(e,n){Np=nt(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&Dx(e,n),Vm!==null&&Vm(e,n)};var Ni=je(null);function tf(){var e=Ni.current;return e!==null?e:Ze.pooledCache}function Jo(e,n){n===null?Ne(Ni,Ni.current):Ne(Ni,n.pool)}function Ym(){var e=tf();return e===null?null:{parent:yt._currentValue,pool:e}}var hs=Error(s(460)),nf=Error(s(474)),Qo=Error(s(542)),Zo={then:function(){}};function Xm(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Km(e,n,a){switch(a=e[a],a===void 0?e.push(n):a!==n&&(n.then(rr,rr),n=a),n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,Qm(e),e;default:if(typeof n.status=="string")n.then(rr,rr);else{if(e=Ze,e!==null&&100<e.shellSuspendCounter)throw Error(s(482));e=n,e.status="pending",e.then(function(o){if(n.status==="pending"){var u=n;u.status="fulfilled",u.value=o}},function(o){if(n.status==="pending"){var u=n;u.status="rejected",u.reason=o}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,Qm(e),e}throw Ci=n,hs}}function ki(e){try{var n=e._init;return n(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(Ci=a,hs):a}}var Ci=null;function Jm(){if(Ci===null)throw Error(s(459));var e=Ci;return Ci=null,e}function Qm(e){if(e===hs||e===Qo)throw Error(s(483))}var ds=null,ga=0;function Wo(e){var n=ga;return ga+=1,ds===null&&(ds=[]),Km(ds,e,n)}function ya(e,n){n=n.props.ref,e.ref=n!==void 0?n:null}function el(e,n){throw n.$$typeof===v?Error(s(525)):(e=Object.prototype.toString.call(n),Error(s(31,e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e)))}function Zm(e){function n(U,q){if(e){var $=U.deletions;$===null?(U.deletions=[q],U.flags|=16):$.push(q)}}function a(U,q){if(!e)return null;for(;q!==null;)n(U,q),q=q.sibling;return null}function o(U){for(var q=new Map;U!==null;)U.key!==null?q.set(U.key,U):q.set(U.index,U),U=U.sibling;return q}function u(U,q){return U=sr(U,q),U.index=0,U.sibling=null,U}function h(U,q,$){return U.index=$,e?($=U.alternate,$!==null?($=$.index,$<q?(U.flags|=67108866,q):$):(U.flags|=67108866,q)):(U.flags|=1048576,q)}function x(U){return e&&U.alternate===null&&(U.flags|=67108866),U}function E(U,q,$,Z){return q===null||q.tag!==6?(q=Gu($,U.mode,Z),q.return=U,q):(q=u(q,$),q.return=U,q)}function R(U,q,$,Z){var xe=$.type;return xe===S?J(U,q,$.props.children,Z,$.key):q!==null&&(q.elementType===xe||typeof xe=="object"&&xe!==null&&xe.$$typeof===K&&ki(xe)===q.type)?(q=u(q,$.props),ya(q,$),q.return=U,q):(q=Vo($.type,$.key,$.props,null,U.mode,Z),ya(q,$),q.return=U,q)}function H(U,q,$,Z){return q===null||q.tag!==4||q.stateNode.containerInfo!==$.containerInfo||q.stateNode.implementation!==$.implementation?(q=Fu($,U.mode,Z),q.return=U,q):(q=u(q,$.children||[]),q.return=U,q)}function J(U,q,$,Z,xe){return q===null||q.tag!==7?(q=Oi($,U.mode,Z,xe),q.return=U,q):(q=u(q,$),q.return=U,q)}function ne(U,q,$){if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return q=Gu(""+q,U.mode,$),q.return=U,q;if(typeof q=="object"&&q!==null){switch(q.$$typeof){case _:return $=Vo(q.type,q.key,q.props,null,U.mode,$),ya($,q),$.return=U,$;case w:return q=Fu(q,U.mode,$),q.return=U,q;case K:return q=ki(q),ne(U,q,$)}if(Te(q)||Q(q))return q=Oi(q,U.mode,$,null),q.return=U,q;if(typeof q.then=="function")return ne(U,Wo(q),$);if(q.$$typeof===ie)return ne(U,Ko(U,q),$);el(U,q)}return null}function F(U,q,$,Z){var xe=q!==null?q.key:null;if(typeof $=="string"&&$!==""||typeof $=="number"||typeof $=="bigint")return xe!==null?null:E(U,q,""+$,Z);if(typeof $=="object"&&$!==null){switch($.$$typeof){case _:return $.key===xe?R(U,q,$,Z):null;case w:return $.key===xe?H(U,q,$,Z):null;case K:return $=ki($),F(U,q,$,Z)}if(Te($)||Q($))return xe!==null?null:J(U,q,$,Z,null);if(typeof $.then=="function")return F(U,q,Wo($),Z);if($.$$typeof===ie)return F(U,q,Ko(U,$),Z);el(U,$)}return null}function X(U,q,$,Z,xe){if(typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint")return U=U.get($)||null,E(q,U,""+Z,xe);if(typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case _:return U=U.get(Z.key===null?$:Z.key)||null,R(q,U,Z,xe);case w:return U=U.get(Z.key===null?$:Z.key)||null,H(q,U,Z,xe);case K:return Z=ki(Z),X(U,q,$,Z,xe)}if(Te(Z)||Q(Z))return U=U.get($)||null,J(q,U,Z,xe,null);if(typeof Z.then=="function")return X(U,q,$,Wo(Z),xe);if(Z.$$typeof===ie)return X(U,q,$,Ko(q,Z),xe);el(q,Z)}return null}function ge(U,q,$,Z){for(var xe=null,$e=null,ye=q,Me=q=0,Le=null;ye!==null&&Me<$.length;Me++){ye.index>Me?(Le=ye,ye=null):Le=ye.sibling;var He=F(U,ye,$[Me],Z);if(He===null){ye===null&&(ye=Le);break}e&&ye&&He.alternate===null&&n(U,ye),q=h(He,q,Me),$e===null?xe=He:$e.sibling=He,$e=He,ye=Le}if(Me===$.length)return a(U,ye),ze&&ar(U,Me),xe;if(ye===null){for(;Me<$.length;Me++)ye=ne(U,$[Me],Z),ye!==null&&(q=h(ye,q,Me),$e===null?xe=ye:$e.sibling=ye,$e=ye);return ze&&ar(U,Me),xe}for(ye=o(ye);Me<$.length;Me++)Le=X(ye,U,Me,$[Me],Z),Le!==null&&(e&&Le.alternate!==null&&ye.delete(Le.key===null?Me:Le.key),q=h(Le,q,Me),$e===null?xe=Le:$e.sibling=Le,$e=Le);return e&&ye.forEach(function(ti){return n(U,ti)}),ze&&ar(U,Me),xe}function Ee(U,q,$,Z){if($==null)throw Error(s(151));for(var xe=null,$e=null,ye=q,Me=q=0,Le=null,He=$.next();ye!==null&&!He.done;Me++,He=$.next()){ye.index>Me?(Le=ye,ye=null):Le=ye.sibling;var ti=F(U,ye,He.value,Z);if(ti===null){ye===null&&(ye=Le);break}e&&ye&&ti.alternate===null&&n(U,ye),q=h(ti,q,Me),$e===null?xe=ti:$e.sibling=ti,$e=ti,ye=Le}if(He.done)return a(U,ye),ze&&ar(U,Me),xe;if(ye===null){for(;!He.done;Me++,He=$.next())He=ne(U,He.value,Z),He!==null&&(q=h(He,q,Me),$e===null?xe=He:$e.sibling=He,$e=He);return ze&&ar(U,Me),xe}for(ye=o(ye);!He.done;Me++,He=$.next())He=X(ye,U,Me,He.value,Z),He!==null&&(e&&He.alternate!==null&&ye.delete(He.key===null?Me:He.key),q=h(He,q,Me),$e===null?xe=He:$e.sibling=He,$e=He);return e&&ye.forEach(function(V_){return n(U,V_)}),ze&&ar(U,Me),xe}function Je(U,q,$,Z){if(typeof $=="object"&&$!==null&&$.type===S&&$.key===null&&($=$.props.children),typeof $=="object"&&$!==null){switch($.$$typeof){case _:e:{for(var xe=$.key;q!==null;){if(q.key===xe){if(xe=$.type,xe===S){if(q.tag===7){a(U,q.sibling),Z=u(q,$.props.children),Z.return=U,U=Z;break e}}else if(q.elementType===xe||typeof xe=="object"&&xe!==null&&xe.$$typeof===K&&ki(xe)===q.type){a(U,q.sibling),Z=u(q,$.props),ya(Z,$),Z.return=U,U=Z;break e}a(U,q);break}else n(U,q);q=q.sibling}$.type===S?(Z=Oi($.props.children,U.mode,Z,$.key),Z.return=U,U=Z):(Z=Vo($.type,$.key,$.props,null,U.mode,Z),ya(Z,$),Z.return=U,U=Z)}return x(U);case w:e:{for(xe=$.key;q!==null;){if(q.key===xe)if(q.tag===4&&q.stateNode.containerInfo===$.containerInfo&&q.stateNode.implementation===$.implementation){a(U,q.sibling),Z=u(q,$.children||[]),Z.return=U,U=Z;break e}else{a(U,q);break}else n(U,q);q=q.sibling}Z=Fu($,U.mode,Z),Z.return=U,U=Z}return x(U);case K:return $=ki($),Je(U,q,$,Z)}if(Te($))return ge(U,q,$,Z);if(Q($)){if(xe=Q($),typeof xe!="function")throw Error(s(150));return $=xe.call($),Ee(U,q,$,Z)}if(typeof $.then=="function")return Je(U,q,Wo($),Z);if($.$$typeof===ie)return Je(U,q,Ko(U,$),Z);el(U,$)}return typeof $=="string"&&$!==""||typeof $=="number"||typeof $=="bigint"?($=""+$,q!==null&&q.tag===6?(a(U,q.sibling),Z=u(q,$),Z.return=U,U=Z):(a(U,q),Z=Gu($,U.mode,Z),Z.return=U,U=Z),x(U)):a(U,q)}return function(U,q,$,Z){try{ga=0;var xe=Je(U,q,$,Z);return ds=null,xe}catch(ye){if(ye===hs||ye===Qo)throw ye;var $e=Wt(29,ye,null,U.mode);return $e.lanes=Z,$e.return=U,$e}finally{}}}var Mi=Zm(!0),Wm=Zm(!1),zr=!1;function rf(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function sf(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ur(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Pr(e,n,a){var o=e.updateQueue;if(o===null)return null;if(o=o.shared,(Ge&2)!==0){var u=o.pending;return u===null?n.next=n:(n.next=u.next,u.next=n),o.pending=n,n=Fo(e),Bm(e,null,a),n}return Go(e,o,n,a),Fo(e)}function ba(e,n,a){if(n=n.updateQueue,n!==null&&(n=n.shared,(a&4194048)!==0)){var o=n.lanes;o&=e.pendingLanes,a|=o,n.lanes=a,bi(e,a)}}function af(e,n){var a=e.updateQueue,o=e.alternate;if(o!==null&&(o=o.updateQueue,a===o)){var u=null,h=null;if(a=a.firstBaseUpdate,a!==null){do{var x={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};h===null?u=h=x:h=h.next=x,a=a.next}while(a!==null);h===null?u=h=n:h=h.next=n}else u=h=n;a={baseState:o.baseState,firstBaseUpdate:u,lastBaseUpdate:h,shared:o.shared,callbacks:o.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=n:e.next=n,a.lastBaseUpdate=n}var of=!1;function va(){if(of){var e=fs;if(e!==null)throw e}}function xa(e,n,a,o){of=!1;var u=e.updateQueue;zr=!1;var h=u.firstBaseUpdate,x=u.lastBaseUpdate,E=u.shared.pending;if(E!==null){u.shared.pending=null;var R=E,H=R.next;R.next=null,x===null?h=H:x.next=H,x=R;var J=e.alternate;J!==null&&(J=J.updateQueue,E=J.lastBaseUpdate,E!==x&&(E===null?J.firstBaseUpdate=H:E.next=H,J.lastBaseUpdate=R))}if(h!==null){var ne=u.baseState;x=0,J=H=R=null,E=h;do{var F=E.lane&-536870913,X=F!==E.lane;if(X?(Be&F)===F:(o&F)===F){F!==0&&F===us&&(of=!0),J!==null&&(J=J.next={lane:0,tag:E.tag,payload:E.payload,callback:null,next:null});e:{var ge=e,Ee=E;F=n;var Je=a;switch(Ee.tag){case 1:if(ge=Ee.payload,typeof ge=="function"){ne=ge.call(Je,ne,F);break e}ne=ge;break e;case 3:ge.flags=ge.flags&-65537|128;case 0:if(ge=Ee.payload,F=typeof ge=="function"?ge.call(Je,ne,F):ge,F==null)break e;ne=b({},ne,F);break e;case 2:zr=!0}}F=E.callback,F!==null&&(e.flags|=64,X&&(e.flags|=8192),X=u.callbacks,X===null?u.callbacks=[F]:X.push(F))}else X={lane:F,tag:E.tag,payload:E.payload,callback:E.callback,next:null},J===null?(H=J=X,R=ne):J=J.next=X,x|=F;if(E=E.next,E===null){if(E=u.shared.pending,E===null)break;X=E,E=X.next,X.next=null,u.lastBaseUpdate=X,u.shared.pending=null}}while(!0);J===null&&(R=ne),u.baseState=R,u.firstBaseUpdate=H,u.lastBaseUpdate=J,h===null&&(u.shared.lanes=0),Fr|=x,e.lanes=x,e.memoizedState=ne}}function e0(e,n){if(typeof e!="function")throw Error(s(191,e));e.call(n)}function t0(e,n){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)e0(a[e],n)}var ms=je(null),tl=je(0);function n0(e,n){e=yr,Ne(tl,e),Ne(ms,n),yr=e|n.baseLanes}function lf(){Ne(tl,yr),Ne(ms,ms.current)}function cf(){yr=tl.current,Se(ms),Se(tl)}var en=je(null),On=null;function Ir(e){var n=e.alternate;Ne(ht,ht.current&1),Ne(en,e),On===null&&(n===null||ms.current!==null||n.memoizedState!==null)&&(On=e)}function uf(e){Ne(ht,ht.current),Ne(en,e),On===null&&(On=e)}function r0(e){e.tag===22?(Ne(ht,ht.current),Ne(en,e),On===null&&(On=e)):$r()}function $r(){Ne(ht,ht.current),Ne(en,en.current)}function tn(e){Se(en),On===e&&(On=null),Se(ht)}var ht=je(0);function nl(e){for(var n=e;n!==null;){if(n.tag===13){var a=n.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||gh(a)||yh(a)))return n}else if(n.tag===19&&(n.memoizedProps.revealOrder==="forwards"||n.memoizedProps.revealOrder==="backwards"||n.memoizedProps.revealOrder==="unstable_legacy-backwards"||n.memoizedProps.revealOrder==="together")){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var cr=0,Ce=null,Xe=null,bt=null,rl=!1,ps=!1,Ri=!1,il=0,_a=0,gs=null,Bx=0;function lt(){throw Error(s(321))}function ff(e,n){if(n===null)return!1;for(var a=0;a<n.length&&a<e.length;a++)if(!Zt(e[a],n[a]))return!1;return!0}function hf(e,n,a,o,u,h){return cr=h,Ce=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,Y.H=e===null||e.memoizedState===null?P0:jf,Ri=!1,h=a(o,u),Ri=!1,ps&&(h=s0(n,a,o,u)),i0(e),h}function i0(e){Y.H=Ea;var n=Xe!==null&&Xe.next!==null;if(cr=0,bt=Xe=Ce=null,rl=!1,_a=0,gs=null,n)throw Error(s(300));e===null||vt||(e=e.dependencies,e!==null&&Xo(e)&&(vt=!0))}function s0(e,n,a,o){Ce=e;var u=0;do{if(ps&&(gs=null),_a=0,ps=!1,25<=u)throw Error(s(301));if(u+=1,bt=Xe=null,e.updateQueue!=null){var h=e.updateQueue;h.lastEffect=null,h.events=null,h.stores=null,h.memoCache!=null&&(h.memoCache.index=0)}Y.H=I0,h=n(a,o)}while(ps);return h}function Lx(){var e=Y.H,n=e.useState()[0];return n=typeof n.then=="function"?wa(n):n,e=e.useState()[0],(Xe!==null?Xe.memoizedState:null)!==e&&(Ce.flags|=1024),n}function df(){var e=il!==0;return il=0,e}function mf(e,n,a){n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~a}function pf(e){if(rl){for(e=e.memoizedState;e!==null;){var n=e.queue;n!==null&&(n.pending=null),e=e.next}rl=!1}cr=0,bt=Xe=Ce=null,ps=!1,_a=il=0,gs=null}function zt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return bt===null?Ce.memoizedState=bt=e:bt=bt.next=e,bt}function dt(){if(Xe===null){var e=Ce.alternate;e=e!==null?e.memoizedState:null}else e=Xe.next;var n=bt===null?Ce.memoizedState:bt.next;if(n!==null)bt=n,Xe=e;else{if(e===null)throw Ce.alternate===null?Error(s(467)):Error(s(310));Xe=e,e={memoizedState:Xe.memoizedState,baseState:Xe.baseState,baseQueue:Xe.baseQueue,queue:Xe.queue,next:null},bt===null?Ce.memoizedState=bt=e:bt=bt.next=e}return bt}function sl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function wa(e){var n=_a;return _a+=1,gs===null&&(gs=[]),e=Km(gs,e,n),n=Ce,(bt===null?n.memoizedState:bt.next)===null&&(n=n.alternate,Y.H=n===null||n.memoizedState===null?P0:jf),e}function al(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return wa(e);if(e.$$typeof===ie)return Nt(e)}throw Error(s(438,String(e)))}function gf(e){var n=null,a=Ce.updateQueue;if(a!==null&&(n=a.memoCache),n==null){var o=Ce.alternate;o!==null&&(o=o.updateQueue,o!==null&&(o=o.memoCache,o!=null&&(n={data:o.data.map(function(u){return u.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),a===null&&(a=sl(),Ce.updateQueue=a),a.memoCache=n,a=n.data[n.index],a===void 0)for(a=n.data[n.index]=Array(e),o=0;o<e;o++)a[o]=G;return n.index++,a}function ur(e,n){return typeof n=="function"?n(e):n}function ol(e){var n=dt();return yf(n,Xe,e)}function yf(e,n,a){var o=e.queue;if(o===null)throw Error(s(311));o.lastRenderedReducer=a;var u=e.baseQueue,h=o.pending;if(h!==null){if(u!==null){var x=u.next;u.next=h.next,h.next=x}n.baseQueue=u=h,o.pending=null}if(h=e.baseState,u===null)e.memoizedState=h;else{n=u.next;var E=x=null,R=null,H=n,J=!1;do{var ne=H.lane&-536870913;if(ne!==H.lane?(Be&ne)===ne:(cr&ne)===ne){var F=H.revertLane;if(F===0)R!==null&&(R=R.next={lane:0,revertLane:0,gesture:null,action:H.action,hasEagerState:H.hasEagerState,eagerState:H.eagerState,next:null}),ne===us&&(J=!0);else if((cr&F)===F){H=H.next,F===us&&(J=!0);continue}else ne={lane:0,revertLane:H.revertLane,gesture:null,action:H.action,hasEagerState:H.hasEagerState,eagerState:H.eagerState,next:null},R===null?(E=R=ne,x=h):R=R.next=ne,Ce.lanes|=F,Fr|=F;ne=H.action,Ri&&a(h,ne),h=H.hasEagerState?H.eagerState:a(h,ne)}else F={lane:ne,revertLane:H.revertLane,gesture:H.gesture,action:H.action,hasEagerState:H.hasEagerState,eagerState:H.eagerState,next:null},R===null?(E=R=F,x=h):R=R.next=F,Ce.lanes|=ne,Fr|=ne;H=H.next}while(H!==null&&H!==n);if(R===null?x=h:R.next=E,!Zt(h,e.memoizedState)&&(vt=!0,J&&(a=fs,a!==null)))throw a;e.memoizedState=h,e.baseState=x,e.baseQueue=R,o.lastRenderedState=h}return u===null&&(o.lanes=0),[e.memoizedState,o.dispatch]}function bf(e){var n=dt(),a=n.queue;if(a===null)throw Error(s(311));a.lastRenderedReducer=e;var o=a.dispatch,u=a.pending,h=n.memoizedState;if(u!==null){a.pending=null;var x=u=u.next;do h=e(h,x.action),x=x.next;while(x!==u);Zt(h,n.memoizedState)||(vt=!0),n.memoizedState=h,n.baseQueue===null&&(n.baseState=h),a.lastRenderedState=h}return[h,o]}function a0(e,n,a){var o=Ce,u=dt(),h=ze;if(h){if(a===void 0)throw Error(s(407));a=a()}else a=n();var x=!Zt((Xe||u).memoizedState,a);if(x&&(u.memoizedState=a,vt=!0),u=u.queue,_f(c0.bind(null,o,u,e),[e]),u.getSnapshot!==n||x||bt!==null&&bt.memoizedState.tag&1){if(o.flags|=2048,ys(9,{destroy:void 0},l0.bind(null,o,u,a,n),null),Ze===null)throw Error(s(349));h||(cr&127)!==0||o0(o,n,a)}return a}function o0(e,n,a){e.flags|=16384,e={getSnapshot:n,value:a},n=Ce.updateQueue,n===null?(n=sl(),Ce.updateQueue=n,n.stores=[e]):(a=n.stores,a===null?n.stores=[e]:a.push(e))}function l0(e,n,a,o){n.value=a,n.getSnapshot=o,u0(n)&&f0(e)}function c0(e,n,a){return a(function(){u0(n)&&f0(e)})}function u0(e){var n=e.getSnapshot;e=e.value;try{var a=n();return!Zt(e,a)}catch{return!0}}function f0(e){var n=Ei(e,2);n!==null&&Kt(n,e,2)}function vf(e){var n=zt();if(typeof e=="function"){var a=e;if(e=a(),Ri){Jt(!0);try{a()}finally{Jt(!1)}}}return n.memoizedState=n.baseState=e,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ur,lastRenderedState:e},n}function h0(e,n,a,o){return e.baseState=a,yf(e,Xe,typeof o=="function"?o:ur)}function zx(e,n,a,o,u){if(ul(e))throw Error(s(485));if(e=n.action,e!==null){var h={payload:u,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(x){h.listeners.push(x)}};Y.T!==null?a(!0):h.isTransition=!1,o(h),a=n.pending,a===null?(h.next=n.pending=h,d0(n,h)):(h.next=a.next,n.pending=a.next=h)}}function d0(e,n){var a=n.action,o=n.payload,u=e.state;if(n.isTransition){var h=Y.T,x={};Y.T=x;try{var E=a(u,o),R=Y.S;R!==null&&R(x,E),m0(e,n,E)}catch(H){xf(e,n,H)}finally{h!==null&&x.types!==null&&(h.types=x.types),Y.T=h}}else try{h=a(u,o),m0(e,n,h)}catch(H){xf(e,n,H)}}function m0(e,n,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(o){p0(e,n,o)},function(o){return xf(e,n,o)}):p0(e,n,a)}function p0(e,n,a){n.status="fulfilled",n.value=a,g0(n),e.state=a,n=e.pending,n!==null&&(a=n.next,a===n?e.pending=null:(a=a.next,n.next=a,d0(e,a)))}function xf(e,n,a){var o=e.pending;if(e.pending=null,o!==null){o=o.next;do n.status="rejected",n.reason=a,g0(n),n=n.next;while(n!==o)}e.action=null}function g0(e){e=e.listeners;for(var n=0;n<e.length;n++)(0,e[n])()}function y0(e,n){return n}function b0(e,n){if(ze){var a=Ze.formState;if(a!==null){e:{var o=Ce;if(ze){if(et){t:{for(var u=et,h=En;u.nodeType!==8;){if(!h){u=null;break t}if(u=An(u.nextSibling),u===null){u=null;break t}}h=u.data,u=h==="F!"||h==="F"?u:null}if(u){et=An(u.nextSibling),o=u.data==="F!";break e}}Br(o)}o=!1}o&&(n=a[0])}}return a=zt(),a.memoizedState=a.baseState=n,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:y0,lastRenderedState:n},a.queue=o,a=L0.bind(null,Ce,o),o.dispatch=a,o=vf(!1),h=Af.bind(null,Ce,!1,o.queue),o=zt(),u={state:n,dispatch:null,action:e,pending:null},o.queue=u,a=zx.bind(null,Ce,u,h,a),u.dispatch=a,o.memoizedState=e,[n,a,!1]}function v0(e){var n=dt();return x0(n,Xe,e)}function x0(e,n,a){if(n=yf(e,n,y0)[0],e=ol(ur)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var o=wa(n)}catch(x){throw x===hs?Qo:x}else o=n;n=dt();var u=n.queue,h=u.dispatch;return a!==n.memoizedState&&(Ce.flags|=2048,ys(9,{destroy:void 0},Ux.bind(null,u,a),null)),[o,h,e]}function Ux(e,n){e.action=n}function _0(e){var n=dt(),a=Xe;if(a!==null)return x0(n,a,e);dt(),n=n.memoizedState,a=dt();var o=a.queue.dispatch;return a.memoizedState=e,[n,o,!1]}function ys(e,n,a,o){return e={tag:e,create:a,deps:o,inst:n,next:null},n=Ce.updateQueue,n===null&&(n=sl(),Ce.updateQueue=n),a=n.lastEffect,a===null?n.lastEffect=e.next=e:(o=a.next,a.next=e,e.next=o,n.lastEffect=e),e}function w0(){return dt().memoizedState}function ll(e,n,a,o){var u=zt();Ce.flags|=e,u.memoizedState=ys(1|n,{destroy:void 0},a,o===void 0?null:o)}function cl(e,n,a,o){var u=dt();o=o===void 0?null:o;var h=u.memoizedState.inst;Xe!==null&&o!==null&&ff(o,Xe.memoizedState.deps)?u.memoizedState=ys(n,h,a,o):(Ce.flags|=e,u.memoizedState=ys(1|n,h,a,o))}function S0(e,n){ll(8390656,8,e,n)}function _f(e,n){cl(2048,8,e,n)}function Px(e){Ce.flags|=4;var n=Ce.updateQueue;if(n===null)n=sl(),Ce.updateQueue=n,n.events=[e];else{var a=n.events;a===null?n.events=[e]:a.push(e)}}function E0(e){var n=dt().memoizedState;return Px({ref:n,nextImpl:e}),function(){if((Ge&2)!==0)throw Error(s(440));return n.impl.apply(void 0,arguments)}}function O0(e,n){return cl(4,2,e,n)}function A0(e,n){return cl(4,4,e,n)}function j0(e,n){if(typeof n=="function"){e=e();var a=n(e);return function(){typeof a=="function"?a():n(null)}}if(n!=null)return e=e(),n.current=e,function(){n.current=null}}function T0(e,n,a){a=a!=null?a.concat([e]):null,cl(4,4,j0.bind(null,n,e),a)}function wf(){}function N0(e,n){var a=dt();n=n===void 0?null:n;var o=a.memoizedState;return n!==null&&ff(n,o[1])?o[0]:(a.memoizedState=[e,n],e)}function k0(e,n){var a=dt();n=n===void 0?null:n;var o=a.memoizedState;if(n!==null&&ff(n,o[1]))return o[0];if(o=e(),Ri){Jt(!0);try{e()}finally{Jt(!1)}}return a.memoizedState=[o,n],o}function Sf(e,n,a){return a===void 0||(cr&1073741824)!==0&&(Be&261930)===0?e.memoizedState=n:(e.memoizedState=a,e=Cp(),Ce.lanes|=e,Fr|=e,a)}function C0(e,n,a,o){return Zt(a,n)?a:ms.current!==null?(e=Sf(e,a,o),Zt(e,n)||(vt=!0),e):(cr&42)===0||(cr&1073741824)!==0&&(Be&261930)===0?(vt=!0,e.memoizedState=a):(e=Cp(),Ce.lanes|=e,Fr|=e,n)}function M0(e,n,a,o,u){var h=oe.p;oe.p=h!==0&&8>h?h:8;var x=Y.T,E={};Y.T=E,Af(e,!1,n,a);try{var R=u(),H=Y.S;if(H!==null&&H(E,R),R!==null&&typeof R=="object"&&typeof R.then=="function"){var J=qx(R,o);Sa(e,n,J,sn(e))}else Sa(e,n,o,sn(e))}catch(ne){Sa(e,n,{then:function(){},status:"rejected",reason:ne},sn())}finally{oe.p=h,x!==null&&E.types!==null&&(x.types=E.types),Y.T=x}}function Ix(){}function Ef(e,n,a,o){if(e.tag!==5)throw Error(s(476));var u=R0(e).queue;M0(e,u,n,de,a===null?Ix:function(){return D0(e),a(o)})}function R0(e){var n=e.memoizedState;if(n!==null)return n;n={memoizedState:de,baseState:de,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ur,lastRenderedState:de},next:null};var a={};return n.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ur,lastRenderedState:a},next:null},e.memoizedState=n,e=e.alternate,e!==null&&(e.memoizedState=n),n}function D0(e){var n=R0(e);n.next===null&&(n=e.alternate.memoizedState),Sa(e,n.next.queue,{},sn())}function Of(){return Nt(Pa)}function q0(){return dt().memoizedState}function B0(){return dt().memoizedState}function $x(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var a=sn();e=Ur(a);var o=Pr(n,e,a);o!==null&&(Kt(o,n,a),ba(o,n,a)),n={cache:Wu()},e.payload=n;return}n=n.return}}function Hx(e,n,a){var o=sn();a={lane:o,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},ul(e)?z0(n,a):(a=$u(e,n,a,o),a!==null&&(Kt(a,e,o),U0(a,n,o)))}function L0(e,n,a){var o=sn();Sa(e,n,a,o)}function Sa(e,n,a,o){var u={lane:o,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(ul(e))z0(n,u);else{var h=e.alternate;if(e.lanes===0&&(h===null||h.lanes===0)&&(h=n.lastRenderedReducer,h!==null))try{var x=n.lastRenderedState,E=h(x,a);if(u.hasEagerState=!0,u.eagerState=E,Zt(E,x))return Go(e,n,u,0),Ze===null&&Ho(),!1}catch{}finally{}if(a=$u(e,n,u,o),a!==null)return Kt(a,e,o),U0(a,n,o),!0}return!1}function Af(e,n,a,o){if(o={lane:2,revertLane:ih(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},ul(e)){if(n)throw Error(s(479))}else n=$u(e,a,o,2),n!==null&&Kt(n,e,2)}function ul(e){var n=e.alternate;return e===Ce||n!==null&&n===Ce}function z0(e,n){ps=rl=!0;var a=e.pending;a===null?n.next=n:(n.next=a.next,a.next=n),e.pending=n}function U0(e,n,a){if((a&4194048)!==0){var o=n.lanes;o&=e.pendingLanes,a|=o,n.lanes=a,bi(e,a)}}var Ea={readContext:Nt,use:al,useCallback:lt,useContext:lt,useEffect:lt,useImperativeHandle:lt,useLayoutEffect:lt,useInsertionEffect:lt,useMemo:lt,useReducer:lt,useRef:lt,useState:lt,useDebugValue:lt,useDeferredValue:lt,useTransition:lt,useSyncExternalStore:lt,useId:lt,useHostTransitionStatus:lt,useFormState:lt,useActionState:lt,useOptimistic:lt,useMemoCache:lt,useCacheRefresh:lt};Ea.useEffectEvent=lt;var P0={readContext:Nt,use:al,useCallback:function(e,n){return zt().memoizedState=[e,n===void 0?null:n],e},useContext:Nt,useEffect:S0,useImperativeHandle:function(e,n,a){a=a!=null?a.concat([e]):null,ll(4194308,4,j0.bind(null,n,e),a)},useLayoutEffect:function(e,n){return ll(4194308,4,e,n)},useInsertionEffect:function(e,n){ll(4,2,e,n)},useMemo:function(e,n){var a=zt();n=n===void 0?null:n;var o=e();if(Ri){Jt(!0);try{e()}finally{Jt(!1)}}return a.memoizedState=[o,n],o},useReducer:function(e,n,a){var o=zt();if(a!==void 0){var u=a(n);if(Ri){Jt(!0);try{a(n)}finally{Jt(!1)}}}else u=n;return o.memoizedState=o.baseState=u,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:u},o.queue=e,e=e.dispatch=Hx.bind(null,Ce,e),[o.memoizedState,e]},useRef:function(e){var n=zt();return e={current:e},n.memoizedState=e},useState:function(e){e=vf(e);var n=e.queue,a=L0.bind(null,Ce,n);return n.dispatch=a,[e.memoizedState,a]},useDebugValue:wf,useDeferredValue:function(e,n){var a=zt();return Sf(a,e,n)},useTransition:function(){var e=vf(!1);return e=M0.bind(null,Ce,e.queue,!0,!1),zt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,a){var o=Ce,u=zt();if(ze){if(a===void 0)throw Error(s(407));a=a()}else{if(a=n(),Ze===null)throw Error(s(349));(Be&127)!==0||o0(o,n,a)}u.memoizedState=a;var h={value:a,getSnapshot:n};return u.queue=h,S0(c0.bind(null,o,h,e),[e]),o.flags|=2048,ys(9,{destroy:void 0},l0.bind(null,o,h,a,n),null),a},useId:function(){var e=zt(),n=Ze.identifierPrefix;if(ze){var a=Fn,o=Gn;a=(o&~(1<<32-Bt(o)-1)).toString(32)+a,n="_"+n+"R_"+a,a=il++,0<a&&(n+="H"+a.toString(32)),n+="_"}else a=Bx++,n="_"+n+"r_"+a.toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:Of,useFormState:b0,useActionState:b0,useOptimistic:function(e){var n=zt();n.memoizedState=n.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=a,n=Af.bind(null,Ce,!0,a),a.dispatch=n,[e,n]},useMemoCache:gf,useCacheRefresh:function(){return zt().memoizedState=$x.bind(null,Ce)},useEffectEvent:function(e){var n=zt(),a={impl:e};return n.memoizedState=a,function(){if((Ge&2)!==0)throw Error(s(440));return a.impl.apply(void 0,arguments)}}},jf={readContext:Nt,use:al,useCallback:N0,useContext:Nt,useEffect:_f,useImperativeHandle:T0,useInsertionEffect:O0,useLayoutEffect:A0,useMemo:k0,useReducer:ol,useRef:w0,useState:function(){return ol(ur)},useDebugValue:wf,useDeferredValue:function(e,n){var a=dt();return C0(a,Xe.memoizedState,e,n)},useTransition:function(){var e=ol(ur)[0],n=dt().memoizedState;return[typeof e=="boolean"?e:wa(e),n]},useSyncExternalStore:a0,useId:q0,useHostTransitionStatus:Of,useFormState:v0,useActionState:v0,useOptimistic:function(e,n){var a=dt();return h0(a,Xe,e,n)},useMemoCache:gf,useCacheRefresh:B0};jf.useEffectEvent=E0;var I0={readContext:Nt,use:al,useCallback:N0,useContext:Nt,useEffect:_f,useImperativeHandle:T0,useInsertionEffect:O0,useLayoutEffect:A0,useMemo:k0,useReducer:bf,useRef:w0,useState:function(){return bf(ur)},useDebugValue:wf,useDeferredValue:function(e,n){var a=dt();return Xe===null?Sf(a,e,n):C0(a,Xe.memoizedState,e,n)},useTransition:function(){var e=bf(ur)[0],n=dt().memoizedState;return[typeof e=="boolean"?e:wa(e),n]},useSyncExternalStore:a0,useId:q0,useHostTransitionStatus:Of,useFormState:_0,useActionState:_0,useOptimistic:function(e,n){var a=dt();return Xe!==null?h0(a,Xe,e,n):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:gf,useCacheRefresh:B0};I0.useEffectEvent=E0;function Tf(e,n,a,o){n=e.memoizedState,a=a(o,n),a=a==null?n:b({},n,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var Nf={enqueueSetState:function(e,n,a){e=e._reactInternals;var o=sn(),u=Ur(o);u.payload=n,a!=null&&(u.callback=a),n=Pr(e,u,o),n!==null&&(Kt(n,e,o),ba(n,e,o))},enqueueReplaceState:function(e,n,a){e=e._reactInternals;var o=sn(),u=Ur(o);u.tag=1,u.payload=n,a!=null&&(u.callback=a),n=Pr(e,u,o),n!==null&&(Kt(n,e,o),ba(n,e,o))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var a=sn(),o=Ur(a);o.tag=2,n!=null&&(o.callback=n),n=Pr(e,o,a),n!==null&&(Kt(n,e,a),ba(n,e,a))}};function $0(e,n,a,o,u,h,x){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(o,h,x):n.prototype&&n.prototype.isPureReactComponent?!ua(a,o)||!ua(u,h):!0}function H0(e,n,a,o){e=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(a,o),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(a,o),n.state!==e&&Nf.enqueueReplaceState(n,n.state,null)}function Di(e,n){var a=n;if("ref"in n){a={};for(var o in n)o!=="ref"&&(a[o]=n[o])}if(e=e.defaultProps){a===n&&(a=b({},a));for(var u in e)a[u]===void 0&&(a[u]=e[u])}return a}function G0(e){$o(e)}function F0(e){console.error(e)}function V0(e){$o(e)}function fl(e,n){try{var a=e.onUncaughtError;a(n.value,{componentStack:n.stack})}catch(o){setTimeout(function(){throw o})}}function Y0(e,n,a){try{var o=e.onCaughtError;o(a.value,{componentStack:a.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(u){setTimeout(function(){throw u})}}function kf(e,n,a){return a=Ur(a),a.tag=3,a.payload={element:null},a.callback=function(){fl(e,n)},a}function X0(e){return e=Ur(e),e.tag=3,e}function K0(e,n,a,o){var u=a.type.getDerivedStateFromError;if(typeof u=="function"){var h=o.value;e.payload=function(){return u(h)},e.callback=function(){Y0(n,a,o)}}var x=a.stateNode;x!==null&&typeof x.componentDidCatch=="function"&&(e.callback=function(){Y0(n,a,o),typeof u!="function"&&(Vr===null?Vr=new Set([this]):Vr.add(this));var E=o.stack;this.componentDidCatch(o.value,{componentStack:E!==null?E:""})})}function Gx(e,n,a,o,u){if(a.flags|=32768,o!==null&&typeof o=="object"&&typeof o.then=="function"){if(n=a.alternate,n!==null&&cs(n,a,u,!0),a=en.current,a!==null){switch(a.tag){case 31:case 13:return On===null?Sl():a.alternate===null&&ct===0&&(ct=3),a.flags&=-257,a.flags|=65536,a.lanes=u,o===Zo?a.flags|=16384:(n=a.updateQueue,n===null?a.updateQueue=new Set([o]):n.add(o),th(e,o,u)),!1;case 22:return a.flags|=65536,o===Zo?a.flags|=16384:(n=a.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([o])},a.updateQueue=n):(a=n.retryQueue,a===null?n.retryQueue=new Set([o]):a.add(o)),th(e,o,u)),!1}throw Error(s(435,a.tag))}return th(e,o,u),Sl(),!1}if(ze)return n=en.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=u,o!==Xu&&(e=Error(s(422),{cause:o}),da(_n(e,a)))):(o!==Xu&&(n=Error(s(423),{cause:o}),da(_n(n,a))),e=e.current.alternate,e.flags|=65536,u&=-u,e.lanes|=u,o=_n(o,a),u=kf(e.stateNode,o,u),af(e,u),ct!==4&&(ct=2)),!1;var h=Error(s(520),{cause:o});if(h=_n(h,a),Ma===null?Ma=[h]:Ma.push(h),ct!==4&&(ct=2),n===null)return!0;o=_n(o,a),a=n;do{switch(a.tag){case 3:return a.flags|=65536,e=u&-u,a.lanes|=e,e=kf(a.stateNode,o,e),af(a,e),!1;case 1:if(n=a.type,h=a.stateNode,(a.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||h!==null&&typeof h.componentDidCatch=="function"&&(Vr===null||!Vr.has(h))))return a.flags|=65536,u&=-u,a.lanes|=u,u=X0(u),K0(u,e,a,o),af(a,u),!1}a=a.return}while(a!==null);return!1}var Cf=Error(s(461)),vt=!1;function kt(e,n,a,o){n.child=e===null?Wm(n,null,a,o):Mi(n,e.child,a,o)}function J0(e,n,a,o,u){a=a.render;var h=n.ref;if("ref"in o){var x={};for(var E in o)E!=="ref"&&(x[E]=o[E])}else x=o;return Ti(n),o=hf(e,n,a,x,h,u),E=df(),e!==null&&!vt?(mf(e,n,u),fr(e,n,u)):(ze&&E&&Vu(n),n.flags|=1,kt(e,n,o,u),n.child)}function Q0(e,n,a,o,u){if(e===null){var h=a.type;return typeof h=="function"&&!Hu(h)&&h.defaultProps===void 0&&a.compare===null?(n.tag=15,n.type=h,Z0(e,n,h,o,u)):(e=Vo(a.type,null,o,n,n.mode,u),e.ref=n.ref,e.return=n,n.child=e)}if(h=e.child,!Uf(e,u)){var x=h.memoizedProps;if(a=a.compare,a=a!==null?a:ua,a(x,o)&&e.ref===n.ref)return fr(e,n,u)}return n.flags|=1,e=sr(h,o),e.ref=n.ref,e.return=n,n.child=e}function Z0(e,n,a,o,u){if(e!==null){var h=e.memoizedProps;if(ua(h,o)&&e.ref===n.ref)if(vt=!1,n.pendingProps=o=h,Uf(e,u))(e.flags&131072)!==0&&(vt=!0);else return n.lanes=e.lanes,fr(e,n,u)}return Mf(e,n,a,o,u)}function W0(e,n,a,o){var u=o.children,h=e!==null?e.memoizedState:null;if(e===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),o.mode==="hidden"){if((n.flags&128)!==0){if(h=h!==null?h.baseLanes|a:a,e!==null){for(o=n.child=e.child,u=0;o!==null;)u=u|o.lanes|o.childLanes,o=o.sibling;o=u&~h}else o=0,n.child=null;return ep(e,n,h,a,o)}if((a&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},e!==null&&Jo(n,h!==null?h.cachePool:null),h!==null?n0(n,h):lf(),r0(n);else return o=n.lanes=536870912,ep(e,n,h!==null?h.baseLanes|a:a,a,o)}else h!==null?(Jo(n,h.cachePool),n0(n,h),$r(),n.memoizedState=null):(e!==null&&Jo(n,null),lf(),$r());return kt(e,n,u,a),n.child}function Oa(e,n){return e!==null&&e.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function ep(e,n,a,o,u){var h=tf();return h=h===null?null:{parent:yt._currentValue,pool:h},n.memoizedState={baseLanes:a,cachePool:h},e!==null&&Jo(n,null),lf(),r0(n),e!==null&&cs(e,n,o,!0),n.childLanes=u,null}function hl(e,n){return n=ml({mode:n.mode,children:n.children},e.mode),n.ref=e.ref,e.child=n,n.return=e,n}function tp(e,n,a){return Mi(n,e.child,null,a),e=hl(n,n.pendingProps),e.flags|=2,tn(n),n.memoizedState=null,e}function Fx(e,n,a){var o=n.pendingProps,u=(n.flags&128)!==0;if(n.flags&=-129,e===null){if(ze){if(o.mode==="hidden")return e=hl(n,o),n.lanes=536870912,Oa(null,e);if(uf(n),(e=et)?(e=dg(e,En),e=e!==null&&e.data==="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:Dr!==null?{id:Gn,overflow:Fn}:null,retryLane:536870912,hydrationErrors:null},a=zm(e),a.return=n,n.child=a,Tt=n,et=null)):e=null,e===null)throw Br(n);return n.lanes=536870912,null}return hl(n,o)}var h=e.memoizedState;if(h!==null){var x=h.dehydrated;if(uf(n),u)if(n.flags&256)n.flags&=-257,n=tp(e,n,a);else if(n.memoizedState!==null)n.child=e.child,n.flags|=128,n=null;else throw Error(s(558));else if(vt||cs(e,n,a,!1),u=(a&e.childLanes)!==0,vt||u){if(o=Ze,o!==null&&(x=Mr(o,a),x!==0&&x!==h.retryLane))throw h.retryLane=x,Ei(e,x),Kt(o,e,x),Cf;Sl(),n=tp(e,n,a)}else e=h.treeContext,et=An(x.nextSibling),Tt=n,ze=!0,qr=null,En=!1,e!==null&&Im(n,e),n=hl(n,o),n.flags|=4096;return n}return e=sr(e.child,{mode:o.mode,children:o.children}),e.ref=n.ref,n.child=e,e.return=n,e}function dl(e,n){var a=n.ref;if(a===null)e!==null&&e.ref!==null&&(n.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(s(284));(e===null||e.ref!==a)&&(n.flags|=4194816)}}function Mf(e,n,a,o,u){return Ti(n),a=hf(e,n,a,o,void 0,u),o=df(),e!==null&&!vt?(mf(e,n,u),fr(e,n,u)):(ze&&o&&Vu(n),n.flags|=1,kt(e,n,a,u),n.child)}function np(e,n,a,o,u,h){return Ti(n),n.updateQueue=null,a=s0(n,o,a,u),i0(e),o=df(),e!==null&&!vt?(mf(e,n,h),fr(e,n,h)):(ze&&o&&Vu(n),n.flags|=1,kt(e,n,a,h),n.child)}function rp(e,n,a,o,u){if(Ti(n),n.stateNode===null){var h=ss,x=a.contextType;typeof x=="object"&&x!==null&&(h=Nt(x)),h=new a(o,h),n.memoizedState=h.state!==null&&h.state!==void 0?h.state:null,h.updater=Nf,n.stateNode=h,h._reactInternals=n,h=n.stateNode,h.props=o,h.state=n.memoizedState,h.refs={},rf(n),x=a.contextType,h.context=typeof x=="object"&&x!==null?Nt(x):ss,h.state=n.memoizedState,x=a.getDerivedStateFromProps,typeof x=="function"&&(Tf(n,a,x,o),h.state=n.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof h.getSnapshotBeforeUpdate=="function"||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(x=h.state,typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount(),x!==h.state&&Nf.enqueueReplaceState(h,h.state,null),xa(n,o,h,u),va(),h.state=n.memoizedState),typeof h.componentDidMount=="function"&&(n.flags|=4194308),o=!0}else if(e===null){h=n.stateNode;var E=n.memoizedProps,R=Di(a,E);h.props=R;var H=h.context,J=a.contextType;x=ss,typeof J=="object"&&J!==null&&(x=Nt(J));var ne=a.getDerivedStateFromProps;J=typeof ne=="function"||typeof h.getSnapshotBeforeUpdate=="function",E=n.pendingProps!==E,J||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(E||H!==x)&&H0(n,h,o,x),zr=!1;var F=n.memoizedState;h.state=F,xa(n,o,h,u),va(),H=n.memoizedState,E||F!==H||zr?(typeof ne=="function"&&(Tf(n,a,ne,o),H=n.memoizedState),(R=zr||$0(n,a,R,o,F,H,x))?(J||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount()),typeof h.componentDidMount=="function"&&(n.flags|=4194308)):(typeof h.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=o,n.memoizedState=H),h.props=o,h.state=H,h.context=x,o=R):(typeof h.componentDidMount=="function"&&(n.flags|=4194308),o=!1)}else{h=n.stateNode,sf(e,n),x=n.memoizedProps,J=Di(a,x),h.props=J,ne=n.pendingProps,F=h.context,H=a.contextType,R=ss,typeof H=="object"&&H!==null&&(R=Nt(H)),E=a.getDerivedStateFromProps,(H=typeof E=="function"||typeof h.getSnapshotBeforeUpdate=="function")||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(x!==ne||F!==R)&&H0(n,h,o,R),zr=!1,F=n.memoizedState,h.state=F,xa(n,o,h,u),va();var X=n.memoizedState;x!==ne||F!==X||zr||e!==null&&e.dependencies!==null&&Xo(e.dependencies)?(typeof E=="function"&&(Tf(n,a,E,o),X=n.memoizedState),(J=zr||$0(n,a,J,o,F,X,R)||e!==null&&e.dependencies!==null&&Xo(e.dependencies))?(H||typeof h.UNSAFE_componentWillUpdate!="function"&&typeof h.componentWillUpdate!="function"||(typeof h.componentWillUpdate=="function"&&h.componentWillUpdate(o,X,R),typeof h.UNSAFE_componentWillUpdate=="function"&&h.UNSAFE_componentWillUpdate(o,X,R)),typeof h.componentDidUpdate=="function"&&(n.flags|=4),typeof h.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof h.componentDidUpdate!="function"||x===e.memoizedProps&&F===e.memoizedState||(n.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||x===e.memoizedProps&&F===e.memoizedState||(n.flags|=1024),n.memoizedProps=o,n.memoizedState=X),h.props=o,h.state=X,h.context=R,o=J):(typeof h.componentDidUpdate!="function"||x===e.memoizedProps&&F===e.memoizedState||(n.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||x===e.memoizedProps&&F===e.memoizedState||(n.flags|=1024),o=!1)}return h=o,dl(e,n),o=(n.flags&128)!==0,h||o?(h=n.stateNode,a=o&&typeof a.getDerivedStateFromError!="function"?null:h.render(),n.flags|=1,e!==null&&o?(n.child=Mi(n,e.child,null,u),n.child=Mi(n,null,a,u)):kt(e,n,a,u),n.memoizedState=h.state,e=n.child):e=fr(e,n,u),e}function ip(e,n,a,o){return Ai(),n.flags|=256,kt(e,n,a,o),n.child}var Rf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Df(e){return{baseLanes:e,cachePool:Ym()}}function qf(e,n,a){return e=e!==null?e.childLanes&~a:0,n&&(e|=rn),e}function sp(e,n,a){var o=n.pendingProps,u=!1,h=(n.flags&128)!==0,x;if((x=h)||(x=e!==null&&e.memoizedState===null?!1:(ht.current&2)!==0),x&&(u=!0,n.flags&=-129),x=(n.flags&32)!==0,n.flags&=-33,e===null){if(ze){if(u?Ir(n):$r(),(e=et)?(e=dg(e,En),e=e!==null&&e.data!=="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:Dr!==null?{id:Gn,overflow:Fn}:null,retryLane:536870912,hydrationErrors:null},a=zm(e),a.return=n,n.child=a,Tt=n,et=null)):e=null,e===null)throw Br(n);return yh(e)?n.lanes=32:n.lanes=536870912,null}var E=o.children;return o=o.fallback,u?($r(),u=n.mode,E=ml({mode:"hidden",children:E},u),o=Oi(o,u,a,null),E.return=n,o.return=n,E.sibling=o,n.child=E,o=n.child,o.memoizedState=Df(a),o.childLanes=qf(e,x,a),n.memoizedState=Rf,Oa(null,o)):(Ir(n),Bf(n,E))}var R=e.memoizedState;if(R!==null&&(E=R.dehydrated,E!==null)){if(h)n.flags&256?(Ir(n),n.flags&=-257,n=Lf(e,n,a)):n.memoizedState!==null?($r(),n.child=e.child,n.flags|=128,n=null):($r(),E=o.fallback,u=n.mode,o=ml({mode:"visible",children:o.children},u),E=Oi(E,u,a,null),E.flags|=2,o.return=n,E.return=n,o.sibling=E,n.child=o,Mi(n,e.child,null,a),o=n.child,o.memoizedState=Df(a),o.childLanes=qf(e,x,a),n.memoizedState=Rf,n=Oa(null,o));else if(Ir(n),yh(E)){if(x=E.nextSibling&&E.nextSibling.dataset,x)var H=x.dgst;x=H,o=Error(s(419)),o.stack="",o.digest=x,da({value:o,source:null,stack:null}),n=Lf(e,n,a)}else if(vt||cs(e,n,a,!1),x=(a&e.childLanes)!==0,vt||x){if(x=Ze,x!==null&&(o=Mr(x,a),o!==0&&o!==R.retryLane))throw R.retryLane=o,Ei(e,o),Kt(x,e,o),Cf;gh(E)||Sl(),n=Lf(e,n,a)}else gh(E)?(n.flags|=192,n.child=e.child,n=null):(e=R.treeContext,et=An(E.nextSibling),Tt=n,ze=!0,qr=null,En=!1,e!==null&&Im(n,e),n=Bf(n,o.children),n.flags|=4096);return n}return u?($r(),E=o.fallback,u=n.mode,R=e.child,H=R.sibling,o=sr(R,{mode:"hidden",children:o.children}),o.subtreeFlags=R.subtreeFlags&65011712,H!==null?E=sr(H,E):(E=Oi(E,u,a,null),E.flags|=2),E.return=n,o.return=n,o.sibling=E,n.child=o,Oa(null,o),o=n.child,E=e.child.memoizedState,E===null?E=Df(a):(u=E.cachePool,u!==null?(R=yt._currentValue,u=u.parent!==R?{parent:R,pool:R}:u):u=Ym(),E={baseLanes:E.baseLanes|a,cachePool:u}),o.memoizedState=E,o.childLanes=qf(e,x,a),n.memoizedState=Rf,Oa(e.child,o)):(Ir(n),a=e.child,e=a.sibling,a=sr(a,{mode:"visible",children:o.children}),a.return=n,a.sibling=null,e!==null&&(x=n.deletions,x===null?(n.deletions=[e],n.flags|=16):x.push(e)),n.child=a,n.memoizedState=null,a)}function Bf(e,n){return n=ml({mode:"visible",children:n},e.mode),n.return=e,e.child=n}function ml(e,n){return e=Wt(22,e,null,n),e.lanes=0,e}function Lf(e,n,a){return Mi(n,e.child,null,a),e=Bf(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function ap(e,n,a){e.lanes|=n;var o=e.alternate;o!==null&&(o.lanes|=n),Qu(e.return,n,a)}function zf(e,n,a,o,u,h){var x=e.memoizedState;x===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:o,tail:a,tailMode:u,treeForkCount:h}:(x.isBackwards=n,x.rendering=null,x.renderingStartTime=0,x.last=o,x.tail=a,x.tailMode=u,x.treeForkCount=h)}function op(e,n,a){var o=n.pendingProps,u=o.revealOrder,h=o.tail;o=o.children;var x=ht.current,E=(x&2)!==0;if(E?(x=x&1|2,n.flags|=128):x&=1,Ne(ht,x),kt(e,n,o,a),o=ze?ha:0,!E&&e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&ap(e,a,n);else if(e.tag===19)ap(e,a,n);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break e;for(;e.sibling===null;){if(e.return===null||e.return===n)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(u){case"forwards":for(a=n.child,u=null;a!==null;)e=a.alternate,e!==null&&nl(e)===null&&(u=a),a=a.sibling;a=u,a===null?(u=n.child,n.child=null):(u=a.sibling,a.sibling=null),zf(n,!1,u,a,h,o);break;case"backwards":case"unstable_legacy-backwards":for(a=null,u=n.child,n.child=null;u!==null;){if(e=u.alternate,e!==null&&nl(e)===null){n.child=u;break}e=u.sibling,u.sibling=a,a=u,u=e}zf(n,!0,a,null,h,o);break;case"together":zf(n,!1,null,null,void 0,o);break;default:n.memoizedState=null}return n.child}function fr(e,n,a){if(e!==null&&(n.dependencies=e.dependencies),Fr|=n.lanes,(a&n.childLanes)===0)if(e!==null){if(cs(e,n,a,!1),(a&n.childLanes)===0)return null}else return null;if(e!==null&&n.child!==e.child)throw Error(s(153));if(n.child!==null){for(e=n.child,a=sr(e,e.pendingProps),n.child=a,a.return=n;e.sibling!==null;)e=e.sibling,a=a.sibling=sr(e,e.pendingProps),a.return=n;a.sibling=null}return n.child}function Uf(e,n){return(e.lanes&n)!==0?!0:(e=e.dependencies,!!(e!==null&&Xo(e)))}function Vx(e,n,a){switch(n.tag){case 3:Dt(n,n.stateNode.containerInfo),Lr(n,yt,e.memoizedState.cache),Ai();break;case 27:case 5:qt(n);break;case 4:Dt(n,n.stateNode.containerInfo);break;case 10:Lr(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,uf(n),null;break;case 13:var o=n.memoizedState;if(o!==null)return o.dehydrated!==null?(Ir(n),n.flags|=128,null):(a&n.child.childLanes)!==0?sp(e,n,a):(Ir(n),e=fr(e,n,a),e!==null?e.sibling:null);Ir(n);break;case 19:var u=(e.flags&128)!==0;if(o=(a&n.childLanes)!==0,o||(cs(e,n,a,!1),o=(a&n.childLanes)!==0),u){if(o)return op(e,n,a);n.flags|=128}if(u=n.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),Ne(ht,ht.current),o)break;return null;case 22:return n.lanes=0,W0(e,n,a,n.pendingProps);case 24:Lr(n,yt,e.memoizedState.cache)}return fr(e,n,a)}function lp(e,n,a){if(e!==null)if(e.memoizedProps!==n.pendingProps)vt=!0;else{if(!Uf(e,a)&&(n.flags&128)===0)return vt=!1,Vx(e,n,a);vt=(e.flags&131072)!==0}else vt=!1,ze&&(n.flags&1048576)!==0&&Pm(n,ha,n.index);switch(n.lanes=0,n.tag){case 16:e:{var o=n.pendingProps;if(e=ki(n.elementType),n.type=e,typeof e=="function")Hu(e)?(o=Di(e,o),n.tag=1,n=rp(null,n,e,o,a)):(n.tag=0,n=Mf(null,n,e,o,a));else{if(e!=null){var u=e.$$typeof;if(u===ae){n.tag=11,n=J0(null,n,e,o,a);break e}else if(u===re){n.tag=14,n=Q0(null,n,e,o,a);break e}}throw n=_e(e)||e,Error(s(306,n,""))}}return n;case 0:return Mf(e,n,n.type,n.pendingProps,a);case 1:return o=n.type,u=Di(o,n.pendingProps),rp(e,n,o,u,a);case 3:e:{if(Dt(n,n.stateNode.containerInfo),e===null)throw Error(s(387));o=n.pendingProps;var h=n.memoizedState;u=h.element,sf(e,n),xa(n,o,null,a);var x=n.memoizedState;if(o=x.cache,Lr(n,yt,o),o!==h.cache&&Zu(n,[yt],a,!0),va(),o=x.element,h.isDehydrated)if(h={element:o,isDehydrated:!1,cache:x.cache},n.updateQueue.baseState=h,n.memoizedState=h,n.flags&256){n=ip(e,n,o,a);break e}else if(o!==u){u=_n(Error(s(424)),n),da(u),n=ip(e,n,o,a);break e}else{switch(e=n.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(et=An(e.firstChild),Tt=n,ze=!0,qr=null,En=!0,a=Wm(n,null,o,a),n.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(Ai(),o===u){n=fr(e,n,a);break e}kt(e,n,o,a)}n=n.child}return n;case 26:return dl(e,n),e===null?(a=vg(n.type,null,n.pendingProps,null))?n.memoizedState=a:ze||(a=n.type,e=n.pendingProps,o=kl(Ht.current).createElement(a),o[Qe]=n,o[ot]=e,Ct(o,a,e),D(o),n.stateNode=o):n.memoizedState=vg(n.type,e.memoizedProps,n.pendingProps,e.memoizedState),null;case 27:return qt(n),e===null&&ze&&(o=n.stateNode=gg(n.type,n.pendingProps,Ht.current),Tt=n,En=!0,u=et,Jr(n.type)?(bh=u,et=An(o.firstChild)):et=u),kt(e,n,n.pendingProps.children,a),dl(e,n),e===null&&(n.flags|=4194304),n.child;case 5:return e===null&&ze&&((u=o=et)&&(o=w_(o,n.type,n.pendingProps,En),o!==null?(n.stateNode=o,Tt=n,et=An(o.firstChild),En=!1,u=!0):u=!1),u||Br(n)),qt(n),u=n.type,h=n.pendingProps,x=e!==null?e.memoizedProps:null,o=h.children,dh(u,h)?o=null:x!==null&&dh(u,x)&&(n.flags|=32),n.memoizedState!==null&&(u=hf(e,n,Lx,null,null,a),Pa._currentValue=u),dl(e,n),kt(e,n,o,a),n.child;case 6:return e===null&&ze&&((e=a=et)&&(a=S_(a,n.pendingProps,En),a!==null?(n.stateNode=a,Tt=n,et=null,e=!0):e=!1),e||Br(n)),null;case 13:return sp(e,n,a);case 4:return Dt(n,n.stateNode.containerInfo),o=n.pendingProps,e===null?n.child=Mi(n,null,o,a):kt(e,n,o,a),n.child;case 11:return J0(e,n,n.type,n.pendingProps,a);case 7:return kt(e,n,n.pendingProps,a),n.child;case 8:return kt(e,n,n.pendingProps.children,a),n.child;case 12:return kt(e,n,n.pendingProps.children,a),n.child;case 10:return o=n.pendingProps,Lr(n,n.type,o.value),kt(e,n,o.children,a),n.child;case 9:return u=n.type._context,o=n.pendingProps.children,Ti(n),u=Nt(u),o=o(u),n.flags|=1,kt(e,n,o,a),n.child;case 14:return Q0(e,n,n.type,n.pendingProps,a);case 15:return Z0(e,n,n.type,n.pendingProps,a);case 19:return op(e,n,a);case 31:return Fx(e,n,a);case 22:return W0(e,n,a,n.pendingProps);case 24:return Ti(n),o=Nt(yt),e===null?(u=tf(),u===null&&(u=Ze,h=Wu(),u.pooledCache=h,h.refCount++,h!==null&&(u.pooledCacheLanes|=a),u=h),n.memoizedState={parent:o,cache:u},rf(n),Lr(n,yt,u)):((e.lanes&a)!==0&&(sf(e,n),xa(n,null,null,a),va()),u=e.memoizedState,h=n.memoizedState,u.parent!==o?(u={parent:o,cache:o},n.memoizedState=u,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=u),Lr(n,yt,o)):(o=h.cache,Lr(n,yt,o),o!==u.cache&&Zu(n,[yt],a,!0))),kt(e,n,n.pendingProps.children,a),n.child;case 29:throw n.pendingProps}throw Error(s(156,n.tag))}function hr(e){e.flags|=4}function Pf(e,n,a,o,u){if((n=(e.mode&32)!==0)&&(n=!1),n){if(e.flags|=16777216,(u&335544128)===u)if(e.stateNode.complete)e.flags|=8192;else if(qp())e.flags|=8192;else throw Ci=Zo,nf}else e.flags&=-16777217}function cp(e,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Eg(n))if(qp())e.flags|=8192;else throw Ci=Zo,nf}function pl(e,n){n!==null&&(e.flags|=4),e.flags&16384&&(n=e.tag!==22?Ki():536870912,e.lanes|=n,_s|=n)}function Aa(e,n){if(!ze)switch(e.tailMode){case"hidden":n=e.tail;for(var a=null;n!==null;)n.alternate!==null&&(a=n),n=n.sibling;a===null?e.tail=null:a.sibling=null;break;case"collapsed":a=e.tail;for(var o=null;a!==null;)a.alternate!==null&&(o=a),a=a.sibling;o===null?n||e.tail===null?e.tail=null:e.tail.sibling=null:o.sibling=null}}function tt(e){var n=e.alternate!==null&&e.alternate.child===e.child,a=0,o=0;if(n)for(var u=e.child;u!==null;)a|=u.lanes|u.childLanes,o|=u.subtreeFlags&65011712,o|=u.flags&65011712,u.return=e,u=u.sibling;else for(u=e.child;u!==null;)a|=u.lanes|u.childLanes,o|=u.subtreeFlags,o|=u.flags,u.return=e,u=u.sibling;return e.subtreeFlags|=o,e.childLanes=a,n}function Yx(e,n,a){var o=n.pendingProps;switch(Yu(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return tt(n),null;case 1:return tt(n),null;case 3:return a=n.stateNode,o=null,e!==null&&(o=e.memoizedState.cache),n.memoizedState.cache!==o&&(n.flags|=2048),lr(yt),ke(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(ls(n)?hr(n):e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,Ku())),tt(n),null;case 26:var u=n.type,h=n.memoizedState;return e===null?(hr(n),h!==null?(tt(n),cp(n,h)):(tt(n),Pf(n,u,null,o,a))):h?h!==e.memoizedState?(hr(n),tt(n),cp(n,h)):(tt(n),n.flags&=-16777217):(e=e.memoizedProps,e!==o&&hr(n),tt(n),Pf(n,u,e,o,a)),null;case 27:if(di(n),a=Ht.current,u=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==o&&hr(n);else{if(!o){if(n.stateNode===null)throw Error(s(166));return tt(n),null}e=be.current,ls(n)?$m(n):(e=gg(u,o,a),n.stateNode=e,hr(n))}return tt(n),null;case 5:if(di(n),u=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==o&&hr(n);else{if(!o){if(n.stateNode===null)throw Error(s(166));return tt(n),null}if(h=be.current,ls(n))$m(n);else{var x=kl(Ht.current);switch(h){case 1:h=x.createElementNS("http://www.w3.org/2000/svg",u);break;case 2:h=x.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;default:switch(u){case"svg":h=x.createElementNS("http://www.w3.org/2000/svg",u);break;case"math":h=x.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;case"script":h=x.createElement("div"),h.innerHTML="<script><\/script>",h=h.removeChild(h.firstChild);break;case"select":h=typeof o.is=="string"?x.createElement("select",{is:o.is}):x.createElement("select"),o.multiple?h.multiple=!0:o.size&&(h.size=o.size);break;default:h=typeof o.is=="string"?x.createElement(u,{is:o.is}):x.createElement(u)}}h[Qe]=n,h[ot]=o;e:for(x=n.child;x!==null;){if(x.tag===5||x.tag===6)h.appendChild(x.stateNode);else if(x.tag!==4&&x.tag!==27&&x.child!==null){x.child.return=x,x=x.child;continue}if(x===n)break e;for(;x.sibling===null;){if(x.return===null||x.return===n)break e;x=x.return}x.sibling.return=x.return,x=x.sibling}n.stateNode=h;e:switch(Ct(h,u,o),u){case"button":case"input":case"select":case"textarea":o=!!o.autoFocus;break e;case"img":o=!0;break e;default:o=!1}o&&hr(n)}}return tt(n),Pf(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,a),null;case 6:if(e&&n.stateNode!=null)e.memoizedProps!==o&&hr(n);else{if(typeof o!="string"&&n.stateNode===null)throw Error(s(166));if(e=Ht.current,ls(n)){if(e=n.stateNode,a=n.memoizedProps,o=null,u=Tt,u!==null)switch(u.tag){case 27:case 5:o=u.memoizedProps}e[Qe]=n,e=!!(e.nodeValue===a||o!==null&&o.suppressHydrationWarning===!0||sg(e.nodeValue,a)),e||Br(n,!0)}else e=kl(e).createTextNode(o),e[Qe]=n,n.stateNode=e}return tt(n),null;case 31:if(a=n.memoizedState,e===null||e.memoizedState!==null){if(o=ls(n),a!==null){if(e===null){if(!o)throw Error(s(318));if(e=n.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(s(557));e[Qe]=n}else Ai(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;tt(n),e=!1}else a=Ku(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return n.flags&256?(tn(n),n):(tn(n),null);if((n.flags&128)!==0)throw Error(s(558))}return tt(n),null;case 13:if(o=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(u=ls(n),o!==null&&o.dehydrated!==null){if(e===null){if(!u)throw Error(s(318));if(u=n.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(s(317));u[Qe]=n}else Ai(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;tt(n),u=!1}else u=Ku(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=u),u=!0;if(!u)return n.flags&256?(tn(n),n):(tn(n),null)}return tn(n),(n.flags&128)!==0?(n.lanes=a,n):(a=o!==null,e=e!==null&&e.memoizedState!==null,a&&(o=n.child,u=null,o.alternate!==null&&o.alternate.memoizedState!==null&&o.alternate.memoizedState.cachePool!==null&&(u=o.alternate.memoizedState.cachePool.pool),h=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(h=o.memoizedState.cachePool.pool),h!==u&&(o.flags|=2048)),a!==e&&a&&(n.child.flags|=8192),pl(n,n.updateQueue),tt(n),null);case 4:return ke(),e===null&&lh(n.stateNode.containerInfo),tt(n),null;case 10:return lr(n.type),tt(n),null;case 19:if(Se(ht),o=n.memoizedState,o===null)return tt(n),null;if(u=(n.flags&128)!==0,h=o.rendering,h===null)if(u)Aa(o,!1);else{if(ct!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(h=nl(e),h!==null){for(n.flags|=128,Aa(o,!1),e=h.updateQueue,n.updateQueue=e,pl(n,e),n.subtreeFlags=0,e=a,a=n.child;a!==null;)Lm(a,e),a=a.sibling;return Ne(ht,ht.current&1|2),ze&&ar(n,o.treeForkCount),n.child}e=e.sibling}o.tail!==null&&nt()>xl&&(n.flags|=128,u=!0,Aa(o,!1),n.lanes=4194304)}else{if(!u)if(e=nl(h),e!==null){if(n.flags|=128,u=!0,e=e.updateQueue,n.updateQueue=e,pl(n,e),Aa(o,!0),o.tail===null&&o.tailMode==="hidden"&&!h.alternate&&!ze)return tt(n),null}else 2*nt()-o.renderingStartTime>xl&&a!==536870912&&(n.flags|=128,u=!0,Aa(o,!1),n.lanes=4194304);o.isBackwards?(h.sibling=n.child,n.child=h):(e=o.last,e!==null?e.sibling=h:n.child=h,o.last=h)}return o.tail!==null?(e=o.tail,o.rendering=e,o.tail=e.sibling,o.renderingStartTime=nt(),e.sibling=null,a=ht.current,Ne(ht,u?a&1|2:a&1),ze&&ar(n,o.treeForkCount),e):(tt(n),null);case 22:case 23:return tn(n),cf(),o=n.memoizedState!==null,e!==null?e.memoizedState!==null!==o&&(n.flags|=8192):o&&(n.flags|=8192),o?(a&536870912)!==0&&(n.flags&128)===0&&(tt(n),n.subtreeFlags&6&&(n.flags|=8192)):tt(n),a=n.updateQueue,a!==null&&pl(n,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),o=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(o=n.memoizedState.cachePool.pool),o!==a&&(n.flags|=2048),e!==null&&Se(Ni),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),n.memoizedState.cache!==a&&(n.flags|=2048),lr(yt),tt(n),null;case 25:return null;case 30:return null}throw Error(s(156,n.tag))}function Xx(e,n){switch(Yu(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return lr(yt),ke(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 26:case 27:case 5:return di(n),null;case 31:if(n.memoizedState!==null){if(tn(n),n.alternate===null)throw Error(s(340));Ai()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 13:if(tn(n),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(s(340));Ai()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return Se(ht),null;case 4:return ke(),null;case 10:return lr(n.type),null;case 22:case 23:return tn(n),cf(),e!==null&&Se(Ni),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return lr(yt),null;case 25:return null;default:return null}}function up(e,n){switch(Yu(n),n.tag){case 3:lr(yt),ke();break;case 26:case 27:case 5:di(n);break;case 4:ke();break;case 31:n.memoizedState!==null&&tn(n);break;case 13:tn(n);break;case 19:Se(ht);break;case 10:lr(n.type);break;case 22:case 23:tn(n),cf(),e!==null&&Se(Ni);break;case 24:lr(yt)}}function ja(e,n){try{var a=n.updateQueue,o=a!==null?a.lastEffect:null;if(o!==null){var u=o.next;a=u;do{if((a.tag&e)===e){o=void 0;var h=a.create,x=a.inst;o=h(),x.destroy=o}a=a.next}while(a!==u)}}catch(E){Ve(n,n.return,E)}}function Hr(e,n,a){try{var o=n.updateQueue,u=o!==null?o.lastEffect:null;if(u!==null){var h=u.next;o=h;do{if((o.tag&e)===e){var x=o.inst,E=x.destroy;if(E!==void 0){x.destroy=void 0,u=n;var R=a,H=E;try{H()}catch(J){Ve(u,R,J)}}}o=o.next}while(o!==h)}}catch(J){Ve(n,n.return,J)}}function fp(e){var n=e.updateQueue;if(n!==null){var a=e.stateNode;try{t0(n,a)}catch(o){Ve(e,e.return,o)}}}function hp(e,n,a){a.props=Di(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(o){Ve(e,n,o)}}function Ta(e,n){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var o=e.stateNode;break;case 30:o=e.stateNode;break;default:o=e.stateNode}typeof a=="function"?e.refCleanup=a(o):a.current=o}}catch(u){Ve(e,n,u)}}function Vn(e,n){var a=e.ref,o=e.refCleanup;if(a!==null)if(typeof o=="function")try{o()}catch(u){Ve(e,n,u)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(u){Ve(e,n,u)}else a.current=null}function dp(e){var n=e.type,a=e.memoizedProps,o=e.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":a.autoFocus&&o.focus();break e;case"img":a.src?o.src=a.src:a.srcSet&&(o.srcset=a.srcSet)}}catch(u){Ve(e,e.return,u)}}function If(e,n,a){try{var o=e.stateNode;g_(o,e.type,a,n),o[ot]=n}catch(u){Ve(e,e.return,u)}}function mp(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Jr(e.type)||e.tag===4}function $f(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||mp(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&&Jr(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 Hf(e,n,a){var o=e.tag;if(o===5||o===6)e=e.stateNode,n?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,n):(n=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,n.appendChild(e),a=a._reactRootContainer,a!=null||n.onclick!==null||(n.onclick=rr));else if(o!==4&&(o===27&&Jr(e.type)&&(a=e.stateNode,n=null),e=e.child,e!==null))for(Hf(e,n,a),e=e.sibling;e!==null;)Hf(e,n,a),e=e.sibling}function gl(e,n,a){var o=e.tag;if(o===5||o===6)e=e.stateNode,n?a.insertBefore(e,n):a.appendChild(e);else if(o!==4&&(o===27&&Jr(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(gl(e,n,a),e=e.sibling;e!==null;)gl(e,n,a),e=e.sibling}function pp(e){var n=e.stateNode,a=e.memoizedProps;try{for(var o=e.type,u=n.attributes;u.length;)n.removeAttributeNode(u[0]);Ct(n,o,a),n[Qe]=e,n[ot]=a}catch(h){Ve(e,e.return,h)}}var dr=!1,xt=!1,Gf=!1,gp=typeof WeakSet=="function"?WeakSet:Set,Ot=null;function Kx(e,n){if(e=e.containerInfo,fh=Ll,e=Tm(e),Bu(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var o=a.getSelection&&a.getSelection();if(o&&o.rangeCount!==0){a=o.anchorNode;var u=o.anchorOffset,h=o.focusNode;o=o.focusOffset;try{a.nodeType,h.nodeType}catch{a=null;break e}var x=0,E=-1,R=-1,H=0,J=0,ne=e,F=null;t:for(;;){for(var X;ne!==a||u!==0&&ne.nodeType!==3||(E=x+u),ne!==h||o!==0&&ne.nodeType!==3||(R=x+o),ne.nodeType===3&&(x+=ne.nodeValue.length),(X=ne.firstChild)!==null;)F=ne,ne=X;for(;;){if(ne===e)break t;if(F===a&&++H===u&&(E=x),F===h&&++J===o&&(R=x),(X=ne.nextSibling)!==null)break;ne=F,F=ne.parentNode}ne=X}a=E===-1||R===-1?null:{start:E,end:R}}else a=null}a=a||{start:0,end:0}}else a=null;for(hh={focusedElem:e,selectionRange:a},Ll=!1,Ot=n;Ot!==null;)if(n=Ot,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,Ot=e;else for(;Ot!==null;){switch(n=Ot,h=n.alternate,e=n.flags,n.tag){case 0:if((e&4)!==0&&(e=n.updateQueue,e=e!==null?e.events:null,e!==null))for(a=0;a<e.length;a++)u=e[a],u.ref.impl=u.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&h!==null){e=void 0,a=n,u=h.memoizedProps,h=h.memoizedState,o=a.stateNode;try{var ge=Di(a.type,u);e=o.getSnapshotBeforeUpdate(ge,h),o.__reactInternalSnapshotBeforeUpdate=e}catch(Ee){Ve(a,a.return,Ee)}}break;case 3:if((e&1024)!==0){if(e=n.stateNode.containerInfo,a=e.nodeType,a===9)ph(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":ph(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(s(163))}if(e=n.sibling,e!==null){e.return=n.return,Ot=e;break}Ot=n.return}}function yp(e,n,a){var o=a.flags;switch(a.tag){case 0:case 11:case 15:pr(e,a),o&4&&ja(5,a);break;case 1:if(pr(e,a),o&4)if(e=a.stateNode,n===null)try{e.componentDidMount()}catch(x){Ve(a,a.return,x)}else{var u=Di(a.type,n.memoizedProps);n=n.memoizedState;try{e.componentDidUpdate(u,n,e.__reactInternalSnapshotBeforeUpdate)}catch(x){Ve(a,a.return,x)}}o&64&&fp(a),o&512&&Ta(a,a.return);break;case 3:if(pr(e,a),o&64&&(e=a.updateQueue,e!==null)){if(n=null,a.child!==null)switch(a.child.tag){case 27:case 5:n=a.child.stateNode;break;case 1:n=a.child.stateNode}try{t0(e,n)}catch(x){Ve(a,a.return,x)}}break;case 27:n===null&&o&4&&pp(a);case 26:case 5:pr(e,a),n===null&&o&4&&dp(a),o&512&&Ta(a,a.return);break;case 12:pr(e,a);break;case 31:pr(e,a),o&4&&xp(e,a);break;case 13:pr(e,a),o&4&&_p(e,a),o&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=i_.bind(null,a),E_(e,a))));break;case 22:if(o=a.memoizedState!==null||dr,!o){n=n!==null&&n.memoizedState!==null||xt,u=dr;var h=xt;dr=o,(xt=n)&&!h?gr(e,a,(a.subtreeFlags&8772)!==0):pr(e,a),dr=u,xt=h}break;case 30:break;default:pr(e,a)}}function bp(e){var n=e.alternate;n!==null&&(e.alternate=null,bp(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&Ji(n)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var rt=null,Ft=!1;function mr(e,n,a){for(a=a.child;a!==null;)vp(e,n,a),a=a.sibling}function vp(e,n,a){if(ft&&typeof ft.onCommitFiberUnmount=="function")try{ft.onCommitFiberUnmount(pi,a)}catch{}switch(a.tag){case 26:xt||Vn(a,n),mr(e,n,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:xt||Vn(a,n);var o=rt,u=Ft;Jr(a.type)&&(rt=a.stateNode,Ft=!1),mr(e,n,a),La(a.stateNode),rt=o,Ft=u;break;case 5:xt||Vn(a,n);case 6:if(o=rt,u=Ft,rt=null,mr(e,n,a),rt=o,Ft=u,rt!==null)if(Ft)try{(rt.nodeType===9?rt.body:rt.nodeName==="HTML"?rt.ownerDocument.body:rt).removeChild(a.stateNode)}catch(h){Ve(a,n,h)}else try{rt.removeChild(a.stateNode)}catch(h){Ve(a,n,h)}break;case 18:rt!==null&&(Ft?(e=rt,fg(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),Ns(e)):fg(rt,a.stateNode));break;case 4:o=rt,u=Ft,rt=a.stateNode.containerInfo,Ft=!0,mr(e,n,a),rt=o,Ft=u;break;case 0:case 11:case 14:case 15:Hr(2,a,n),xt||Hr(4,a,n),mr(e,n,a);break;case 1:xt||(Vn(a,n),o=a.stateNode,typeof o.componentWillUnmount=="function"&&hp(a,n,o)),mr(e,n,a);break;case 21:mr(e,n,a);break;case 22:xt=(o=xt)||a.memoizedState!==null,mr(e,n,a),xt=o;break;default:mr(e,n,a)}}function xp(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Ns(e)}catch(a){Ve(n,n.return,a)}}}function _p(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Ns(e)}catch(a){Ve(n,n.return,a)}}function Jx(e){switch(e.tag){case 31:case 13:case 19:var n=e.stateNode;return n===null&&(n=e.stateNode=new gp),n;case 22:return e=e.stateNode,n=e._retryCache,n===null&&(n=e._retryCache=new gp),n;default:throw Error(s(435,e.tag))}}function yl(e,n){var a=Jx(e);n.forEach(function(o){if(!a.has(o)){a.add(o);var u=s_.bind(null,e,o);o.then(u,u)}})}function Vt(e,n){var a=n.deletions;if(a!==null)for(var o=0;o<a.length;o++){var u=a[o],h=e,x=n,E=x;e:for(;E!==null;){switch(E.tag){case 27:if(Jr(E.type)){rt=E.stateNode,Ft=!1;break e}break;case 5:rt=E.stateNode,Ft=!1;break e;case 3:case 4:rt=E.stateNode.containerInfo,Ft=!0;break e}E=E.return}if(rt===null)throw Error(s(160));vp(h,x,u),rt=null,Ft=!1,h=u.alternate,h!==null&&(h.return=null),u.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)wp(n,e),n=n.sibling}var Bn=null;function wp(e,n){var a=e.alternate,o=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Vt(n,e),Yt(e),o&4&&(Hr(3,e,e.return),ja(3,e),Hr(5,e,e.return));break;case 1:Vt(n,e),Yt(e),o&512&&(xt||a===null||Vn(a,a.return)),o&64&&dr&&(e=e.updateQueue,e!==null&&(o=e.callbacks,o!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?o:a.concat(o))));break;case 26:var u=Bn;if(Vt(n,e),Yt(e),o&512&&(xt||a===null||Vn(a,a.return)),o&4){var h=a!==null?a.memoizedState:null;if(o=e.memoizedState,a===null)if(o===null)if(e.stateNode===null){e:{o=e.type,a=e.memoizedProps,u=u.ownerDocument||u;t:switch(o){case"title":h=u.getElementsByTagName("title")[0],(!h||h[wt]||h[Qe]||h.namespaceURI==="http://www.w3.org/2000/svg"||h.hasAttribute("itemprop"))&&(h=u.createElement(o),u.head.insertBefore(h,u.querySelector("head > title"))),Ct(h,o,a),h[Qe]=e,D(h),o=h;break e;case"link":var x=wg("link","href",u).get(o+(a.href||""));if(x){for(var E=0;E<x.length;E++)if(h=x[E],h.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&h.getAttribute("rel")===(a.rel==null?null:a.rel)&&h.getAttribute("title")===(a.title==null?null:a.title)&&h.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){x.splice(E,1);break t}}h=u.createElement(o),Ct(h,o,a),u.head.appendChild(h);break;case"meta":if(x=wg("meta","content",u).get(o+(a.content||""))){for(E=0;E<x.length;E++)if(h=x[E],h.getAttribute("content")===(a.content==null?null:""+a.content)&&h.getAttribute("name")===(a.name==null?null:a.name)&&h.getAttribute("property")===(a.property==null?null:a.property)&&h.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&h.getAttribute("charset")===(a.charSet==null?null:a.charSet)){x.splice(E,1);break t}}h=u.createElement(o),Ct(h,o,a),u.head.appendChild(h);break;default:throw Error(s(468,o))}h[Qe]=e,D(h),o=h}e.stateNode=o}else Sg(u,e.type,e.stateNode);else e.stateNode=_g(u,o,e.memoizedProps);else h!==o?(h===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):h.count--,o===null?Sg(u,e.type,e.stateNode):_g(u,o,e.memoizedProps)):o===null&&e.stateNode!==null&&If(e,e.memoizedProps,a.memoizedProps)}break;case 27:Vt(n,e),Yt(e),o&512&&(xt||a===null||Vn(a,a.return)),a!==null&&o&4&&If(e,e.memoizedProps,a.memoizedProps);break;case 5:if(Vt(n,e),Yt(e),o&512&&(xt||a===null||Vn(a,a.return)),e.flags&32){u=e.stateNode;try{Zi(u,"")}catch(ge){Ve(e,e.return,ge)}}o&4&&e.stateNode!=null&&(u=e.memoizedProps,If(e,u,a!==null?a.memoizedProps:u)),o&1024&&(Gf=!0);break;case 6:if(Vt(n,e),Yt(e),o&4){if(e.stateNode===null)throw Error(s(162));o=e.memoizedProps,a=e.stateNode;try{a.nodeValue=o}catch(ge){Ve(e,e.return,ge)}}break;case 3:if(Rl=null,u=Bn,Bn=Cl(n.containerInfo),Vt(n,e),Bn=u,Yt(e),o&4&&a!==null&&a.memoizedState.isDehydrated)try{Ns(n.containerInfo)}catch(ge){Ve(e,e.return,ge)}Gf&&(Gf=!1,Sp(e));break;case 4:o=Bn,Bn=Cl(e.stateNode.containerInfo),Vt(n,e),Yt(e),Bn=o;break;case 12:Vt(n,e),Yt(e);break;case 31:Vt(n,e),Yt(e),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,yl(e,o)));break;case 13:Vt(n,e),Yt(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(vl=nt()),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,yl(e,o)));break;case 22:u=e.memoizedState!==null;var R=a!==null&&a.memoizedState!==null,H=dr,J=xt;if(dr=H||u,xt=J||R,Vt(n,e),xt=J,dr=H,Yt(e),o&8192)e:for(n=e.stateNode,n._visibility=u?n._visibility&-2:n._visibility|1,u&&(a===null||R||dr||xt||qi(e)),a=null,n=e;;){if(n.tag===5||n.tag===26){if(a===null){R=a=n;try{if(h=R.stateNode,u)x=h.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none";else{E=R.stateNode;var ne=R.memoizedProps.style,F=ne!=null&&ne.hasOwnProperty("display")?ne.display:null;E.style.display=F==null||typeof F=="boolean"?"":(""+F).trim()}}catch(ge){Ve(R,R.return,ge)}}}else if(n.tag===6){if(a===null){R=n;try{R.stateNode.nodeValue=u?"":R.memoizedProps}catch(ge){Ve(R,R.return,ge)}}}else if(n.tag===18){if(a===null){R=n;try{var X=R.stateNode;u?hg(X,!0):hg(R.stateNode,!1)}catch(ge){Ve(R,R.return,ge)}}}else if((n.tag!==22&&n.tag!==23||n.memoizedState===null||n===e)&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break e;for(;n.sibling===null;){if(n.return===null||n.return===e)break e;a===n&&(a=null),n=n.return}a===n&&(a=null),n.sibling.return=n.return,n=n.sibling}o&4&&(o=e.updateQueue,o!==null&&(a=o.retryQueue,a!==null&&(o.retryQueue=null,yl(e,a))));break;case 19:Vt(n,e),Yt(e),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,yl(e,o)));break;case 30:break;case 21:break;default:Vt(n,e),Yt(e)}}function Yt(e){var n=e.flags;if(n&2){try{for(var a,o=e.return;o!==null;){if(mp(o)){a=o;break}o=o.return}if(a==null)throw Error(s(160));switch(a.tag){case 27:var u=a.stateNode,h=$f(e);gl(e,h,u);break;case 5:var x=a.stateNode;a.flags&32&&(Zi(x,""),a.flags&=-33);var E=$f(e);gl(e,E,x);break;case 3:case 4:var R=a.stateNode.containerInfo,H=$f(e);Hf(e,H,R);break;default:throw Error(s(161))}}catch(J){Ve(e,e.return,J)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function Sp(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var n=e;Sp(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),e=e.sibling}}function pr(e,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)yp(e,n.alternate,n),n=n.sibling}function qi(e){for(e=e.child;e!==null;){var n=e;switch(n.tag){case 0:case 11:case 14:case 15:Hr(4,n,n.return),qi(n);break;case 1:Vn(n,n.return);var a=n.stateNode;typeof a.componentWillUnmount=="function"&&hp(n,n.return,a),qi(n);break;case 27:La(n.stateNode);case 26:case 5:Vn(n,n.return),qi(n);break;case 22:n.memoizedState===null&&qi(n);break;case 30:qi(n);break;default:qi(n)}e=e.sibling}}function gr(e,n,a){for(a=a&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var o=n.alternate,u=e,h=n,x=h.flags;switch(h.tag){case 0:case 11:case 15:gr(u,h,a),ja(4,h);break;case 1:if(gr(u,h,a),o=h,u=o.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(H){Ve(o,o.return,H)}if(o=h,u=o.updateQueue,u!==null){var E=o.stateNode;try{var R=u.shared.hiddenCallbacks;if(R!==null)for(u.shared.hiddenCallbacks=null,u=0;u<R.length;u++)e0(R[u],E)}catch(H){Ve(o,o.return,H)}}a&&x&64&&fp(h),Ta(h,h.return);break;case 27:pp(h);case 26:case 5:gr(u,h,a),a&&o===null&&x&4&&dp(h),Ta(h,h.return);break;case 12:gr(u,h,a);break;case 31:gr(u,h,a),a&&x&4&&xp(u,h);break;case 13:gr(u,h,a),a&&x&4&&_p(u,h);break;case 22:h.memoizedState===null&&gr(u,h,a),Ta(h,h.return);break;case 30:break;default:gr(u,h,a)}n=n.sibling}}function Ff(e,n){var a=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),e=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(e=n.memoizedState.cachePool.pool),e!==a&&(e!=null&&e.refCount++,a!=null&&ma(a))}function Vf(e,n){e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&ma(e))}function Ln(e,n,a,o){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Ep(e,n,a,o),n=n.sibling}function Ep(e,n,a,o){var u=n.flags;switch(n.tag){case 0:case 11:case 15:Ln(e,n,a,o),u&2048&&ja(9,n);break;case 1:Ln(e,n,a,o);break;case 3:Ln(e,n,a,o),u&2048&&(e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&ma(e)));break;case 12:if(u&2048){Ln(e,n,a,o),e=n.stateNode;try{var h=n.memoizedProps,x=h.id,E=h.onPostCommit;typeof E=="function"&&E(x,n.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(R){Ve(n,n.return,R)}}else Ln(e,n,a,o);break;case 31:Ln(e,n,a,o);break;case 13:Ln(e,n,a,o);break;case 23:break;case 22:h=n.stateNode,x=n.alternate,n.memoizedState!==null?h._visibility&2?Ln(e,n,a,o):Na(e,n):h._visibility&2?Ln(e,n,a,o):(h._visibility|=2,bs(e,n,a,o,(n.subtreeFlags&10256)!==0||!1)),u&2048&&Ff(x,n);break;case 24:Ln(e,n,a,o),u&2048&&Vf(n.alternate,n);break;default:Ln(e,n,a,o)}}function bs(e,n,a,o,u){for(u=u&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var h=e,x=n,E=a,R=o,H=x.flags;switch(x.tag){case 0:case 11:case 15:bs(h,x,E,R,u),ja(8,x);break;case 23:break;case 22:var J=x.stateNode;x.memoizedState!==null?J._visibility&2?bs(h,x,E,R,u):Na(h,x):(J._visibility|=2,bs(h,x,E,R,u)),u&&H&2048&&Ff(x.alternate,x);break;case 24:bs(h,x,E,R,u),u&&H&2048&&Vf(x.alternate,x);break;default:bs(h,x,E,R,u)}n=n.sibling}}function Na(e,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var a=e,o=n,u=o.flags;switch(o.tag){case 22:Na(a,o),u&2048&&Ff(o.alternate,o);break;case 24:Na(a,o),u&2048&&Vf(o.alternate,o);break;default:Na(a,o)}n=n.sibling}}var ka=8192;function vs(e,n,a){if(e.subtreeFlags&ka)for(e=e.child;e!==null;)Op(e,n,a),e=e.sibling}function Op(e,n,a){switch(e.tag){case 26:vs(e,n,a),e.flags&ka&&e.memoizedState!==null&&B_(a,Bn,e.memoizedState,e.memoizedProps);break;case 5:vs(e,n,a);break;case 3:case 4:var o=Bn;Bn=Cl(e.stateNode.containerInfo),vs(e,n,a),Bn=o;break;case 22:e.memoizedState===null&&(o=e.alternate,o!==null&&o.memoizedState!==null?(o=ka,ka=16777216,vs(e,n,a),ka=o):vs(e,n,a));break;default:vs(e,n,a)}}function Ap(e){var n=e.alternate;if(n!==null&&(e=n.child,e!==null)){n.child=null;do n=e.sibling,e.sibling=null,e=n;while(e!==null)}}function Ca(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var o=n[a];Ot=o,Tp(o,e)}Ap(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)jp(e),e=e.sibling}function jp(e){switch(e.tag){case 0:case 11:case 15:Ca(e),e.flags&2048&&Hr(9,e,e.return);break;case 3:Ca(e);break;case 12:Ca(e);break;case 22:var n=e.stateNode;e.memoizedState!==null&&n._visibility&2&&(e.return===null||e.return.tag!==13)?(n._visibility&=-3,bl(e)):Ca(e);break;default:Ca(e)}}function bl(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var o=n[a];Ot=o,Tp(o,e)}Ap(e)}for(e=e.child;e!==null;){switch(n=e,n.tag){case 0:case 11:case 15:Hr(8,n,n.return),bl(n);break;case 22:a=n.stateNode,a._visibility&2&&(a._visibility&=-3,bl(n));break;default:bl(n)}e=e.sibling}}function Tp(e,n){for(;Ot!==null;){var a=Ot;switch(a.tag){case 0:case 11:case 15:Hr(8,a,n);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var o=a.memoizedState.cachePool.pool;o!=null&&o.refCount++}break;case 24:ma(a.memoizedState.cache)}if(o=a.child,o!==null)o.return=a,Ot=o;else e:for(a=e;Ot!==null;){o=Ot;var u=o.sibling,h=o.return;if(bp(o),o===a){Ot=null;break e}if(u!==null){u.return=h,Ot=u;break e}Ot=h}}}var Qx={getCacheForType:function(e){var n=Nt(yt),a=n.data.get(e);return a===void 0&&(a=e(),n.data.set(e,a)),a},cacheSignal:function(){return Nt(yt).controller.signal}},Zx=typeof WeakMap=="function"?WeakMap:Map,Ge=0,Ze=null,De=null,Be=0,Fe=0,nn=null,Gr=!1,xs=!1,Yf=!1,yr=0,ct=0,Fr=0,Bi=0,Xf=0,rn=0,_s=0,Ma=null,Xt=null,Kf=!1,vl=0,Np=0,xl=1/0,_l=null,Vr=null,St=0,Yr=null,ws=null,br=0,Jf=0,Qf=null,kp=null,Ra=0,Zf=null;function sn(){return(Ge&2)!==0&&Be!==0?Be&-Be:Y.T!==null?ih():ta()}function Cp(){if(rn===0)if((Be&536870912)===0||ze){var e=er;er<<=1,(er&3932160)===0&&(er=262144),rn=e}else rn=536870912;return e=en.current,e!==null&&(e.flags|=32),rn}function Kt(e,n,a){(e===Ze&&(Fe===2||Fe===9)||e.cancelPendingCommit!==null)&&(Ss(e,0),Xr(e,Be,rn,!1)),Rn(e,a),((Ge&2)===0||e!==Ze)&&(e===Ze&&((Ge&2)===0&&(Bi|=a),ct===4&&Xr(e,Be,rn,!1)),Yn(e))}function Mp(e,n,a){if((Ge&6)!==0)throw Error(s(327));var o=!a&&(n&127)===0&&(n&e.expiredLanes)===0||yi(e,n),u=o?t_(e,n):eh(e,n,!0),h=o;do{if(u===0){xs&&!o&&Xr(e,n,0,!1);break}else{if(a=e.current.alternate,h&&!Wx(a)){u=eh(e,n,!1),h=!1;continue}if(u===2){if(h=n,e.errorRecoveryDisabledLanes&h)var x=0;else x=e.pendingLanes&-536870913,x=x!==0?x:x&536870912?536870912:0;if(x!==0){n=x;e:{var E=e;u=Ma;var R=E.current.memoizedState.isDehydrated;if(R&&(Ss(E,x).flags|=256),x=eh(E,x,!1),x!==2){if(Yf&&!R){E.errorRecoveryDisabledLanes|=h,Bi|=h,u=4;break e}h=Xt,Xt=u,h!==null&&(Xt===null?Xt=h:Xt.push.apply(Xt,h))}u=x}if(h=!1,u!==2)continue}}if(u===1){Ss(e,0),Xr(e,n,0,!0);break}e:{switch(o=e,h=u,h){case 0:case 1:throw Error(s(345));case 4:if((n&4194048)!==n)break;case 6:Xr(o,n,rn,!Gr);break e;case 2:Xt=null;break;case 3:case 5:break;default:throw Error(s(329))}if((n&62914560)===n&&(u=vl+300-nt(),10<u)){if(Xr(o,n,rn,!Gr),gi(o,0,!0)!==0)break e;br=n,o.timeoutHandle=cg(Rp.bind(null,o,a,Xt,_l,Kf,n,rn,Bi,_s,Gr,h,"Throttled",-0,0),u);break e}Rp(o,a,Xt,_l,Kf,n,rn,Bi,_s,Gr,h,null,-0,0)}}break}while(!0);Yn(e)}function Rp(e,n,a,o,u,h,x,E,R,H,J,ne,F,X){if(e.timeoutHandle=-1,ne=n.subtreeFlags,ne&8192||(ne&16785408)===16785408){ne={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:rr},Op(n,h,ne);var ge=(h&62914560)===h?vl-nt():(h&4194048)===h?Np-nt():0;if(ge=L_(ne,ge),ge!==null){br=h,e.cancelPendingCommit=ge(Ip.bind(null,e,n,h,a,o,u,x,E,R,J,ne,null,F,X)),Xr(e,h,x,!H);return}}Ip(e,n,h,a,o,u,x,E,R)}function Wx(e){for(var n=e;;){var a=n.tag;if((a===0||a===11||a===15)&&n.flags&16384&&(a=n.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var o=0;o<a.length;o++){var u=a[o],h=u.getSnapshot;u=u.value;try{if(!Zt(h(),u))return!1}catch{return!1}}if(a=n.child,n.subtreeFlags&16384&&a!==null)a.return=n,n=a;else{if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function Xr(e,n,a,o){n&=~Xf,n&=~Bi,e.suspendedLanes|=n,e.pingedLanes&=~n,o&&(e.warmLanes|=n),o=e.expirationTimes;for(var u=n;0<u;){var h=31-Bt(u),x=1<<h;o[h]=-1,u&=~x}a!==0&&Cr(e,a,n)}function wl(){return(Ge&6)===0?(Da(0),!1):!0}function Wf(){if(De!==null){if(Fe===0)var e=De.return;else e=De,or=ji=null,pf(e),ds=null,ga=0,e=De;for(;e!==null;)up(e.alternate,e),e=e.return;De=null}}function Ss(e,n){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,v_(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),br=0,Wf(),Ze=e,De=a=sr(e.current,null),Be=n,Fe=0,nn=null,Gr=!1,xs=yi(e,n),Yf=!1,_s=rn=Xf=Bi=Fr=ct=0,Xt=Ma=null,Kf=!1,(n&8)!==0&&(n|=n&32);var o=e.entangledLanes;if(o!==0)for(e=e.entanglements,o&=n;0<o;){var u=31-Bt(o),h=1<<u;n|=e[u],o&=~h}return yr=n,Ho(),a}function Dp(e,n){Ce=null,Y.H=Ea,n===hs||n===Qo?(n=Jm(),Fe=3):n===nf?(n=Jm(),Fe=4):Fe=n===Cf?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,nn=n,De===null&&(ct=1,fl(e,_n(n,e.current)))}function qp(){var e=en.current;return e===null?!0:(Be&4194048)===Be?On===null:(Be&62914560)===Be||(Be&536870912)!==0?e===On:!1}function Bp(){var e=Y.H;return Y.H=Ea,e===null?Ea:e}function Lp(){var e=Y.A;return Y.A=Qx,e}function Sl(){ct=4,Gr||(Be&4194048)!==Be&&en.current!==null||(xs=!0),(Fr&134217727)===0&&(Bi&134217727)===0||Ze===null||Xr(Ze,Be,rn,!1)}function eh(e,n,a){var o=Ge;Ge|=2;var u=Bp(),h=Lp();(Ze!==e||Be!==n)&&(_l=null,Ss(e,n)),n=!1;var x=ct;e:do try{if(Fe!==0&&De!==null){var E=De,R=nn;switch(Fe){case 8:Wf(),x=6;break e;case 3:case 2:case 9:case 6:en.current===null&&(n=!0);var H=Fe;if(Fe=0,nn=null,Es(e,E,R,H),a&&xs){x=0;break e}break;default:H=Fe,Fe=0,nn=null,Es(e,E,R,H)}}e_(),x=ct;break}catch(J){Dp(e,J)}while(!0);return n&&e.shellSuspendCounter++,or=ji=null,Ge=o,Y.H=u,Y.A=h,De===null&&(Ze=null,Be=0,Ho()),x}function e_(){for(;De!==null;)zp(De)}function t_(e,n){var a=Ge;Ge|=2;var o=Bp(),u=Lp();Ze!==e||Be!==n?(_l=null,xl=nt()+500,Ss(e,n)):xs=yi(e,n);e:do try{if(Fe!==0&&De!==null){n=De;var h=nn;t:switch(Fe){case 1:Fe=0,nn=null,Es(e,n,h,1);break;case 2:case 9:if(Xm(h)){Fe=0,nn=null,Up(n);break}n=function(){Fe!==2&&Fe!==9||Ze!==e||(Fe=7),Yn(e)},h.then(n,n);break e;case 3:Fe=7;break e;case 4:Fe=5;break e;case 7:Xm(h)?(Fe=0,nn=null,Up(n)):(Fe=0,nn=null,Es(e,n,h,7));break;case 5:var x=null;switch(De.tag){case 26:x=De.memoizedState;case 5:case 27:var E=De;if(x?Eg(x):E.stateNode.complete){Fe=0,nn=null;var R=E.sibling;if(R!==null)De=R;else{var H=E.return;H!==null?(De=H,El(H)):De=null}break t}}Fe=0,nn=null,Es(e,n,h,5);break;case 6:Fe=0,nn=null,Es(e,n,h,6);break;case 8:Wf(),ct=6;break e;default:throw Error(s(462))}}n_();break}catch(J){Dp(e,J)}while(!0);return or=ji=null,Y.H=o,Y.A=u,Ge=a,De!==null?0:(Ze=null,Be=0,Ho(),ct)}function n_(){for(;De!==null&&!Ao();)zp(De)}function zp(e){var n=lp(e.alternate,e,yr);e.memoizedProps=e.pendingProps,n===null?El(e):De=n}function Up(e){var n=e,a=n.alternate;switch(n.tag){case 15:case 0:n=np(a,n,n.pendingProps,n.type,void 0,Be);break;case 11:n=np(a,n,n.pendingProps,n.type.render,n.ref,Be);break;case 5:pf(n);default:up(a,n),n=De=Lm(n,yr),n=lp(a,n,yr)}e.memoizedProps=e.pendingProps,n===null?El(e):De=n}function Es(e,n,a,o){or=ji=null,pf(n),ds=null,ga=0;var u=n.return;try{if(Gx(e,u,n,a,Be)){ct=1,fl(e,_n(a,e.current)),De=null;return}}catch(h){if(u!==null)throw De=u,h;ct=1,fl(e,_n(a,e.current)),De=null;return}n.flags&32768?(ze||o===1?e=!0:xs||(Be&536870912)!==0?e=!1:(Gr=e=!0,(o===2||o===9||o===3||o===6)&&(o=en.current,o!==null&&o.tag===13&&(o.flags|=16384))),Pp(n,e)):El(n)}function El(e){var n=e;do{if((n.flags&32768)!==0){Pp(n,Gr);return}e=n.return;var a=Yx(n.alternate,n,yr);if(a!==null){De=a;return}if(n=n.sibling,n!==null){De=n;return}De=n=e}while(n!==null);ct===0&&(ct=5)}function Pp(e,n){do{var a=Xx(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),!n&&(e=e.sibling,e!==null)){De=e;return}De=e=a}while(e!==null);ct=6,De=null}function Ip(e,n,a,o,u,h,x,E,R){e.cancelPendingCommit=null;do Ol();while(St!==0);if((Ge&6)!==0)throw Error(s(327));if(n!==null){if(n===e.current)throw Error(s(177));if(h=n.lanes|n.childLanes,h|=Iu,kr(e,a,h,x,E,R),e===Ze&&(De=Ze=null,Be=0),ws=n,Yr=e,br=a,Jf=h,Qf=u,kp=o,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,a_(Yi,function(){return Vp(),null})):(e.callbackNode=null,e.callbackPriority=0),o=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||o){o=Y.T,Y.T=null,u=oe.p,oe.p=2,x=Ge,Ge|=4;try{Kx(e,n,a)}finally{Ge=x,oe.p=u,Y.T=o}}St=1,$p(),Hp(),Gp()}}function $p(){if(St===1){St=0;var e=Yr,n=ws,a=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||a){a=Y.T,Y.T=null;var o=oe.p;oe.p=2;var u=Ge;Ge|=4;try{wp(n,e);var h=hh,x=Tm(e.containerInfo),E=h.focusedElem,R=h.selectionRange;if(x!==E&&E&&E.ownerDocument&&jm(E.ownerDocument.documentElement,E)){if(R!==null&&Bu(E)){var H=R.start,J=R.end;if(J===void 0&&(J=H),"selectionStart"in E)E.selectionStart=H,E.selectionEnd=Math.min(J,E.value.length);else{var ne=E.ownerDocument||document,F=ne&&ne.defaultView||window;if(F.getSelection){var X=F.getSelection(),ge=E.textContent.length,Ee=Math.min(R.start,ge),Je=R.end===void 0?Ee:Math.min(R.end,ge);!X.extend&&Ee>Je&&(x=Je,Je=Ee,Ee=x);var U=Am(E,Ee),q=Am(E,Je);if(U&&q&&(X.rangeCount!==1||X.anchorNode!==U.node||X.anchorOffset!==U.offset||X.focusNode!==q.node||X.focusOffset!==q.offset)){var $=ne.createRange();$.setStart(U.node,U.offset),X.removeAllRanges(),Ee>Je?(X.addRange($),X.extend(q.node,q.offset)):($.setEnd(q.node,q.offset),X.addRange($))}}}}for(ne=[],X=E;X=X.parentNode;)X.nodeType===1&&ne.push({element:X,left:X.scrollLeft,top:X.scrollTop});for(typeof E.focus=="function"&&E.focus(),E=0;E<ne.length;E++){var Z=ne[E];Z.element.scrollLeft=Z.left,Z.element.scrollTop=Z.top}}Ll=!!fh,hh=fh=null}finally{Ge=u,oe.p=o,Y.T=a}}e.current=n,St=2}}function Hp(){if(St===2){St=0;var e=Yr,n=ws,a=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||a){a=Y.T,Y.T=null;var o=oe.p;oe.p=2;var u=Ge;Ge|=4;try{yp(e,n.alternate,n)}finally{Ge=u,oe.p=o,Y.T=a}}St=3}}function Gp(){if(St===4||St===3){St=0,Vi();var e=Yr,n=ws,a=br,o=kp;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?St=5:(St=0,ws=Yr=null,Fp(e,e.pendingLanes));var u=e.pendingLanes;if(u===0&&(Vr=null),vi(a),n=n.stateNode,ft&&typeof ft.onCommitFiberRoot=="function")try{ft.onCommitFiberRoot(pi,n,void 0,(n.current.flags&128)===128)}catch{}if(o!==null){n=Y.T,u=oe.p,oe.p=2,Y.T=null;try{for(var h=e.onRecoverableError,x=0;x<o.length;x++){var E=o[x];h(E.value,{componentStack:E.stack})}}finally{Y.T=n,oe.p=u}}(br&3)!==0&&Ol(),Yn(e),u=e.pendingLanes,(a&261930)!==0&&(u&42)!==0?e===Zf?Ra++:(Ra=0,Zf=e):Ra=0,Da(0)}}function Fp(e,n){(e.pooledCacheLanes&=n)===0&&(n=e.pooledCache,n!=null&&(e.pooledCache=null,ma(n)))}function Ol(){return $p(),Hp(),Gp(),Vp()}function Vp(){if(St!==5)return!1;var e=Yr,n=Jf;Jf=0;var a=vi(br),o=Y.T,u=oe.p;try{oe.p=32>a?32:a,Y.T=null,a=Qf,Qf=null;var h=Yr,x=br;if(St=0,ws=Yr=null,br=0,(Ge&6)!==0)throw Error(s(331));var E=Ge;if(Ge|=4,jp(h.current),Ep(h,h.current,x,a),Ge=E,Da(0,!1),ft&&typeof ft.onPostCommitFiberRoot=="function")try{ft.onPostCommitFiberRoot(pi,h)}catch{}return!0}finally{oe.p=u,Y.T=o,Fp(e,n)}}function Yp(e,n,a){n=_n(a,n),n=kf(e.stateNode,n,2),e=Pr(e,n,2),e!==null&&(Rn(e,2),Yn(e))}function Ve(e,n,a){if(e.tag===3)Yp(e,e,a);else for(;n!==null;){if(n.tag===3){Yp(n,e,a);break}else if(n.tag===1){var o=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(Vr===null||!Vr.has(o))){e=_n(a,e),a=X0(2),o=Pr(n,a,2),o!==null&&(K0(a,o,n,e),Rn(o,2),Yn(o));break}}n=n.return}}function th(e,n,a){var o=e.pingCache;if(o===null){o=e.pingCache=new Zx;var u=new Set;o.set(n,u)}else u=o.get(n),u===void 0&&(u=new Set,o.set(n,u));u.has(a)||(Yf=!0,u.add(a),e=r_.bind(null,e,n,a),n.then(e,e))}function r_(e,n,a){var o=e.pingCache;o!==null&&o.delete(n),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,Ze===e&&(Be&a)===a&&(ct===4||ct===3&&(Be&62914560)===Be&&300>nt()-vl?(Ge&2)===0&&Ss(e,0):Xf|=a,_s===Be&&(_s=0)),Yn(e)}function Xp(e,n){n===0&&(n=Ki()),e=Ei(e,n),e!==null&&(Rn(e,n),Yn(e))}function i_(e){var n=e.memoizedState,a=0;n!==null&&(a=n.retryLane),Xp(e,a)}function s_(e,n){var a=0;switch(e.tag){case 31:case 13:var o=e.stateNode,u=e.memoizedState;u!==null&&(a=u.retryLane);break;case 19:o=e.stateNode;break;case 22:o=e.stateNode._retryCache;break;default:throw Error(s(314))}o!==null&&o.delete(n),Xp(e,a)}function a_(e,n){return Qs(e,n)}var Al=null,Os=null,nh=!1,jl=!1,rh=!1,Kr=0;function Yn(e){e!==Os&&e.next===null&&(Os===null?Al=Os=e:Os=Os.next=e),jl=!0,nh||(nh=!0,l_())}function Da(e,n){if(!rh&&jl){rh=!0;do for(var a=!1,o=Al;o!==null;){if(e!==0){var u=o.pendingLanes;if(u===0)var h=0;else{var x=o.suspendedLanes,E=o.pingedLanes;h=(1<<31-Bt(42|e)+1)-1,h&=u&~(x&~E),h=h&201326741?h&201326741|1:h?h|2:0}h!==0&&(a=!0,Zp(o,h))}else h=Be,h=gi(o,o===Ze?h:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(h&3)===0||yi(o,h)||(a=!0,Zp(o,h));o=o.next}while(a);rh=!1}}function o_(){Kp()}function Kp(){jl=nh=!1;var e=0;Kr!==0&&b_()&&(e=Kr);for(var n=nt(),a=null,o=Al;o!==null;){var u=o.next,h=Jp(o,n);h===0?(o.next=null,a===null?Al=u:a.next=u,u===null&&(Os=a)):(a=o,(e!==0||(h&3)!==0)&&(jl=!0)),o=u}St!==0&&St!==5||Da(e),Kr!==0&&(Kr=0)}function Jp(e,n){for(var a=e.suspendedLanes,o=e.pingedLanes,u=e.expirationTimes,h=e.pendingLanes&-62914561;0<h;){var x=31-Bt(h),E=1<<x,R=u[x];R===-1?((E&a)===0||(E&o)!==0)&&(u[x]=ea(E,n)):R<=n&&(e.expiredLanes|=E),h&=~E}if(n=Ze,a=Be,a=gi(e,e===n?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),o=e.callbackNode,a===0||e===n&&(Fe===2||Fe===9)||e.cancelPendingCommit!==null)return o!==null&&o!==null&&Wn(o),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||yi(e,a)){if(n=a&-a,n===e.callbackPriority)return n;switch(o!==null&&Wn(o),vi(a)){case 2:case 8:a=To;break;case 32:a=Yi;break;case 268435456:a=No;break;default:a=Yi}return o=Qp.bind(null,e),a=Qs(a,o),e.callbackPriority=n,e.callbackNode=a,n}return o!==null&&o!==null&&Wn(o),e.callbackPriority=2,e.callbackNode=null,2}function Qp(e,n){if(St!==0&&St!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(Ol()&&e.callbackNode!==a)return null;var o=Be;return o=gi(e,e===Ze?o:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),o===0?null:(Mp(e,o,n),Jp(e,nt()),e.callbackNode!=null&&e.callbackNode===a?Qp.bind(null,e):null)}function Zp(e,n){if(Ol())return null;Mp(e,n,!0)}function l_(){x_(function(){(Ge&6)!==0?Qs(jo,o_):Kp()})}function ih(){if(Kr===0){var e=us;e===0&&(e=jr,jr<<=1,(jr&261888)===0&&(jr=256)),Kr=e}return Kr}function Wp(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:qo(""+e)}function eg(e,n){var a=n.ownerDocument.createElement("input");return a.name=n.name,a.value=n.value,e.id&&a.setAttribute("form",e.id),n.parentNode.insertBefore(a,n),e=new FormData(e),a.parentNode.removeChild(a),e}function c_(e,n,a,o,u){if(n==="submit"&&a&&a.stateNode===u){var h=Wp((u[ot]||null).action),x=o.submitter;x&&(n=(n=x[ot]||null)?Wp(n.formAction):x.getAttribute("formAction"),n!==null&&(h=n,x=null));var E=new Uo("action","action",null,o,u);e.push({event:E,listeners:[{instance:null,listener:function(){if(o.defaultPrevented){if(Kr!==0){var R=x?eg(u,x):new FormData(u);Ef(a,{pending:!0,data:R,method:u.method,action:h},null,R)}}else typeof h=="function"&&(E.preventDefault(),R=x?eg(u,x):new FormData(u),Ef(a,{pending:!0,data:R,method:u.method,action:h},h,R))},currentTarget:u}]})}}for(var sh=0;sh<Pu.length;sh++){var ah=Pu[sh],u_=ah.toLowerCase(),f_=ah[0].toUpperCase()+ah.slice(1);qn(u_,"on"+f_)}qn(Cm,"onAnimationEnd"),qn(Mm,"onAnimationIteration"),qn(Rm,"onAnimationStart"),qn("dblclick","onDoubleClick"),qn("focusin","onFocus"),qn("focusout","onBlur"),qn(jx,"onTransitionRun"),qn(Tx,"onTransitionStart"),qn(Nx,"onTransitionCancel"),qn(Dm,"onTransitionEnd"),V("onMouseEnter",["mouseout","mouseover"]),V("onMouseLeave",["mouseout","mouseover"]),V("onPointerEnter",["pointerout","pointerover"]),V("onPointerLeave",["pointerout","pointerover"]),se("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),se("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),se("onBeforeInput",["compositionend","keypress","textInput","paste"]),se("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),se("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),se("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var qa="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(" "),h_=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(qa));function tg(e,n){n=(n&4)!==0;for(var a=0;a<e.length;a++){var o=e[a],u=o.event;o=o.listeners;e:{var h=void 0;if(n)for(var x=o.length-1;0<=x;x--){var E=o[x],R=E.instance,H=E.currentTarget;if(E=E.listener,R!==h&&u.isPropagationStopped())break e;h=E,u.currentTarget=H;try{h(u)}catch(J){$o(J)}u.currentTarget=null,h=R}else for(x=0;x<o.length;x++){if(E=o[x],R=E.instance,H=E.currentTarget,E=E.listener,R!==h&&u.isPropagationStopped())break e;h=E,u.currentTarget=H;try{h(u)}catch(J){$o(J)}u.currentTarget=null,h=R}}}}function qe(e,n){var a=n[xi];a===void 0&&(a=n[xi]=new Set);var o=e+"__bubble";a.has(o)||(ng(n,e,2,!1),a.add(o))}function oh(e,n,a){var o=0;n&&(o|=4),ng(a,e,o,n)}var Tl="_reactListening"+Math.random().toString(36).slice(2);function lh(e){if(!e[Tl]){e[Tl]=!0,P.forEach(function(a){a!=="selectionchange"&&(h_.has(a)||oh(a,!1,e),oh(a,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[Tl]||(n[Tl]=!0,oh("selectionchange",!1,n))}}function ng(e,n,a,o){switch(Cg(n)){case 2:var u=P_;break;case 8:u=I_;break;default:u=Sh}a=u.bind(null,n,a,e),u=void 0,!ju||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(u=!0),o?u!==void 0?e.addEventListener(n,a,{capture:!0,passive:u}):e.addEventListener(n,a,!0):u!==void 0?e.addEventListener(n,a,{passive:u}):e.addEventListener(n,a,!1)}function ch(e,n,a,o,u){var h=o;if((n&1)===0&&(n&2)===0&&o!==null)e:for(;;){if(o===null)return;var x=o.tag;if(x===3||x===4){var E=o.stateNode.containerInfo;if(E===u)break;if(x===4)for(x=o.return;x!==null;){var R=x.tag;if((R===3||R===4)&&x.stateNode.containerInfo===u)return;x=x.return}for(;E!==null;){if(x=O(E),x===null)return;if(R=x.tag,R===5||R===6||R===26||R===27){o=h=x;continue e}E=E.parentNode}}o=o.return}om(function(){var H=h,J=Ou(a),ne=[];e:{var F=qm.get(e);if(F!==void 0){var X=Uo,ge=e;switch(e){case"keypress":if(Lo(a)===0)break e;case"keydown":case"keyup":X=sx;break;case"focusin":ge="focus",X=Cu;break;case"focusout":ge="blur",X=Cu;break;case"beforeblur":case"afterblur":X=Cu;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":X=um;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":X=Yv;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":X=lx;break;case Cm:case Mm:case Rm:X=Jv;break;case Dm:X=ux;break;case"scroll":case"scrollend":X=Fv;break;case"wheel":X=hx;break;case"copy":case"cut":case"paste":X=Zv;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":X=hm;break;case"toggle":case"beforetoggle":X=mx}var Ee=(n&4)!==0,Je=!Ee&&(e==="scroll"||e==="scrollend"),U=Ee?F!==null?F+"Capture":null:F;Ee=[];for(var q=H,$;q!==null;){var Z=q;if($=Z.stateNode,Z=Z.tag,Z!==5&&Z!==26&&Z!==27||$===null||U===null||(Z=ra(q,U),Z!=null&&Ee.push(Ba(q,Z,$))),Je)break;q=q.return}0<Ee.length&&(F=new X(F,ge,null,a,J),ne.push({event:F,listeners:Ee}))}}if((n&7)===0){e:{if(F=e==="mouseover"||e==="pointerover",X=e==="mouseout"||e==="pointerout",F&&a!==Eu&&(ge=a.relatedTarget||a.fromElement)&&(O(ge)||ge[Qt]))break e;if((X||F)&&(F=J.window===J?J:(F=J.ownerDocument)?F.defaultView||F.parentWindow:window,X?(ge=a.relatedTarget||a.toElement,X=H,ge=ge?O(ge):null,ge!==null&&(Je=c(ge),Ee=ge.tag,ge!==Je||Ee!==5&&Ee!==27&&Ee!==6)&&(ge=null)):(X=null,ge=H),X!==ge)){if(Ee=um,Z="onMouseLeave",U="onMouseEnter",q="mouse",(e==="pointerout"||e==="pointerover")&&(Ee=hm,Z="onPointerLeave",U="onPointerEnter",q="pointer"),Je=X==null?F:T(X),$=ge==null?F:T(ge),F=new Ee(Z,q+"leave",X,a,J),F.target=Je,F.relatedTarget=$,Z=null,O(J)===H&&(Ee=new Ee(U,q+"enter",ge,a,J),Ee.target=$,Ee.relatedTarget=Je,Z=Ee),Je=Z,X&&ge)t:{for(Ee=d_,U=X,q=ge,$=0,Z=U;Z;Z=Ee(Z))$++;Z=0;for(var xe=q;xe;xe=Ee(xe))Z++;for(;0<$-Z;)U=Ee(U),$--;for(;0<Z-$;)q=Ee(q),Z--;for(;$--;){if(U===q||q!==null&&U===q.alternate){Ee=U;break t}U=Ee(U),q=Ee(q)}Ee=null}else Ee=null;X!==null&&rg(ne,F,X,Ee,!1),ge!==null&&Je!==null&&rg(ne,Je,ge,Ee,!0)}}e:{if(F=H?T(H):window,X=F.nodeName&&F.nodeName.toLowerCase(),X==="select"||X==="input"&&F.type==="file")var $e=xm;else if(bm(F))if(_m)$e=Ex;else{$e=wx;var ye=_x}else X=F.nodeName,!X||X.toLowerCase()!=="input"||F.type!=="checkbox"&&F.type!=="radio"?H&&Su(H.elementType)&&($e=xm):$e=Sx;if($e&&($e=$e(e,H))){vm(ne,$e,a,J);break e}ye&&ye(e,F,H),e==="focusout"&&H&&F.type==="number"&&H.memoizedProps.value!=null&&wu(F,"number",F.value)}switch(ye=H?T(H):window,e){case"focusin":(bm(ye)||ye.contentEditable==="true")&&(ns=ye,Lu=H,fa=null);break;case"focusout":fa=Lu=ns=null;break;case"mousedown":zu=!0;break;case"contextmenu":case"mouseup":case"dragend":zu=!1,Nm(ne,a,J);break;case"selectionchange":if(Ax)break;case"keydown":case"keyup":Nm(ne,a,J)}var Me;if(Ru)e:{switch(e){case"compositionstart":var Le="onCompositionStart";break e;case"compositionend":Le="onCompositionEnd";break e;case"compositionupdate":Le="onCompositionUpdate";break e}Le=void 0}else ts?gm(e,a)&&(Le="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(Le="onCompositionStart");Le&&(dm&&a.locale!=="ko"&&(ts||Le!=="onCompositionStart"?Le==="onCompositionEnd"&&ts&&(Me=lm()):(Rr=J,Tu="value"in Rr?Rr.value:Rr.textContent,ts=!0)),ye=Nl(H,Le),0<ye.length&&(Le=new fm(Le,e,null,a,J),ne.push({event:Le,listeners:ye}),Me?Le.data=Me:(Me=ym(a),Me!==null&&(Le.data=Me)))),(Me=gx?yx(e,a):bx(e,a))&&(Le=Nl(H,"onBeforeInput"),0<Le.length&&(ye=new fm("onBeforeInput","beforeinput",null,a,J),ne.push({event:ye,listeners:Le}),ye.data=Me)),c_(ne,e,H,a,J)}tg(ne,n)})}function Ba(e,n,a){return{instance:e,listener:n,currentTarget:a}}function Nl(e,n){for(var a=n+"Capture",o=[];e!==null;){var u=e,h=u.stateNode;if(u=u.tag,u!==5&&u!==26&&u!==27||h===null||(u=ra(e,a),u!=null&&o.unshift(Ba(e,u,h)),u=ra(e,n),u!=null&&o.push(Ba(e,u,h))),e.tag===3)return o;e=e.return}return[]}function d_(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function rg(e,n,a,o,u){for(var h=n._reactName,x=[];a!==null&&a!==o;){var E=a,R=E.alternate,H=E.stateNode;if(E=E.tag,R!==null&&R===o)break;E!==5&&E!==26&&E!==27||H===null||(R=H,u?(H=ra(a,h),H!=null&&x.unshift(Ba(a,H,R))):u||(H=ra(a,h),H!=null&&x.push(Ba(a,H,R)))),a=a.return}x.length!==0&&e.push({event:n,listeners:x})}var m_=/\r\n?/g,p_=/\u0000|\uFFFD/g;function ig(e){return(typeof e=="string"?e:""+e).replace(m_,`
26
+ `).replace(p_,"")}function sg(e,n){return n=ig(n),ig(e)===n}function Ke(e,n,a,o,u,h){switch(a){case"children":typeof o=="string"?n==="body"||n==="textarea"&&o===""||Zi(e,o):(typeof o=="number"||typeof o=="bigint")&&n!=="body"&&Zi(e,""+o);break;case"className":Dn(e,"class",o);break;case"tabIndex":Dn(e,"tabindex",o);break;case"dir":case"role":case"viewBox":case"width":case"height":Dn(e,a,o);break;case"style":sm(e,o,h);break;case"data":if(n!=="object"){Dn(e,"data",o);break}case"src":case"href":if(o===""&&(n!=="a"||a!=="href")){e.removeAttribute(a);break}if(o==null||typeof o=="function"||typeof o=="symbol"||typeof o=="boolean"){e.removeAttribute(a);break}o=qo(""+o),e.setAttribute(a,o);break;case"action":case"formAction":if(typeof o=="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 h=="function"&&(a==="formAction"?(n!=="input"&&Ke(e,n,"name",u.name,u,null),Ke(e,n,"formEncType",u.formEncType,u,null),Ke(e,n,"formMethod",u.formMethod,u,null),Ke(e,n,"formTarget",u.formTarget,u,null)):(Ke(e,n,"encType",u.encType,u,null),Ke(e,n,"method",u.method,u,null),Ke(e,n,"target",u.target,u,null)));if(o==null||typeof o=="symbol"||typeof o=="boolean"){e.removeAttribute(a);break}o=qo(""+o),e.setAttribute(a,o);break;case"onClick":o!=null&&(e.onclick=rr);break;case"onScroll":o!=null&&qe("scroll",e);break;case"onScrollEnd":o!=null&&qe("scrollend",e);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(s(61));if(a=o.__html,a!=null){if(u.children!=null)throw Error(s(60));e.innerHTML=a}}break;case"multiple":e.multiple=o&&typeof o!="function"&&typeof o!="symbol";break;case"muted":e.muted=o&&typeof o!="function"&&typeof o!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(o==null||typeof o=="function"||typeof o=="boolean"||typeof o=="symbol"){e.removeAttribute("xlink:href");break}a=qo(""+o),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":o!=null&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(a,""+o):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":o&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(a,""):e.removeAttribute(a);break;case"capture":case"download":o===!0?e.setAttribute(a,""):o!==!1&&o!=null&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(a,o):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":o!=null&&typeof o!="function"&&typeof o!="symbol"&&!isNaN(o)&&1<=o?e.setAttribute(a,o):e.removeAttribute(a);break;case"rowSpan":case"start":o==null||typeof o=="function"||typeof o=="symbol"||isNaN(o)?e.removeAttribute(a):e.setAttribute(a,o);break;case"popover":qe("beforetoggle",e),qe("toggle",e),Lt(e,"popover",o);break;case"xlinkActuate":nr(e,"http://www.w3.org/1999/xlink","xlink:actuate",o);break;case"xlinkArcrole":nr(e,"http://www.w3.org/1999/xlink","xlink:arcrole",o);break;case"xlinkRole":nr(e,"http://www.w3.org/1999/xlink","xlink:role",o);break;case"xlinkShow":nr(e,"http://www.w3.org/1999/xlink","xlink:show",o);break;case"xlinkTitle":nr(e,"http://www.w3.org/1999/xlink","xlink:title",o);break;case"xlinkType":nr(e,"http://www.w3.org/1999/xlink","xlink:type",o);break;case"xmlBase":nr(e,"http://www.w3.org/XML/1998/namespace","xml:base",o);break;case"xmlLang":nr(e,"http://www.w3.org/XML/1998/namespace","xml:lang",o);break;case"xmlSpace":nr(e,"http://www.w3.org/XML/1998/namespace","xml:space",o);break;case"is":Lt(e,"is",o);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=Hv.get(a)||a,Lt(e,a,o))}}function uh(e,n,a,o,u,h){switch(a){case"style":sm(e,o,h);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(s(61));if(a=o.__html,a!=null){if(u.children!=null)throw Error(s(60));e.innerHTML=a}}break;case"children":typeof o=="string"?Zi(e,o):(typeof o=="number"||typeof o=="bigint")&&Zi(e,""+o);break;case"onScroll":o!=null&&qe("scroll",e);break;case"onScrollEnd":o!=null&&qe("scrollend",e);break;case"onClick":o!=null&&(e.onclick=rr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!te.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(u=a.endsWith("Capture"),n=a.slice(2,u?a.length-7:void 0),h=e[ot]||null,h=h!=null?h[a]:null,typeof h=="function"&&e.removeEventListener(n,h,u),typeof o=="function")){typeof h!="function"&&h!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(n,o,u);break e}a in e?e[a]=o:o===!0?e.setAttribute(a,""):Lt(e,a,o)}}}function Ct(e,n,a){switch(n){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 o=!1,u=!1,h;for(h in a)if(a.hasOwnProperty(h)){var x=a[h];if(x!=null)switch(h){case"src":o=!0;break;case"srcSet":u=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,n));default:Ke(e,n,h,x,a,null)}}u&&Ke(e,n,"srcSet",a.srcSet,a,null),o&&Ke(e,n,"src",a.src,a,null);return;case"input":qe("invalid",e);var E=h=x=u=null,R=null,H=null;for(o in a)if(a.hasOwnProperty(o)){var J=a[o];if(J!=null)switch(o){case"name":u=J;break;case"type":x=J;break;case"checked":R=J;break;case"defaultChecked":H=J;break;case"value":h=J;break;case"defaultValue":E=J;break;case"children":case"dangerouslySetInnerHTML":if(J!=null)throw Error(s(137,n));break;default:Ke(e,n,o,J,a,null)}}tm(e,h,E,R,H,x,u,!1);return;case"select":qe("invalid",e),o=x=h=null;for(u in a)if(a.hasOwnProperty(u)&&(E=a[u],E!=null))switch(u){case"value":h=E;break;case"defaultValue":x=E;break;case"multiple":o=E;default:Ke(e,n,u,E,a,null)}n=h,a=x,e.multiple=!!o,n!=null?Qi(e,!!o,n,!1):a!=null&&Qi(e,!!o,a,!0);return;case"textarea":qe("invalid",e),h=u=o=null;for(x in a)if(a.hasOwnProperty(x)&&(E=a[x],E!=null))switch(x){case"value":o=E;break;case"defaultValue":u=E;break;case"children":h=E;break;case"dangerouslySetInnerHTML":if(E!=null)throw Error(s(91));break;default:Ke(e,n,x,E,a,null)}rm(e,o,u,h);return;case"option":for(R in a)if(a.hasOwnProperty(R)&&(o=a[R],o!=null))switch(R){case"selected":e.selected=o&&typeof o!="function"&&typeof o!="symbol";break;default:Ke(e,n,R,o,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(o=0;o<qa.length;o++)qe(qa[o],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(H in a)if(a.hasOwnProperty(H)&&(o=a[H],o!=null))switch(H){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,n));default:Ke(e,n,H,o,a,null)}return;default:if(Su(n)){for(J in a)a.hasOwnProperty(J)&&(o=a[J],o!==void 0&&uh(e,n,J,o,a,void 0));return}}for(E in a)a.hasOwnProperty(E)&&(o=a[E],o!=null&&Ke(e,n,E,o,a,null))}function g_(e,n,a,o){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var u=null,h=null,x=null,E=null,R=null,H=null,J=null;for(X in a){var ne=a[X];if(a.hasOwnProperty(X)&&ne!=null)switch(X){case"checked":break;case"value":break;case"defaultValue":R=ne;default:o.hasOwnProperty(X)||Ke(e,n,X,null,o,ne)}}for(var F in o){var X=o[F];if(ne=a[F],o.hasOwnProperty(F)&&(X!=null||ne!=null))switch(F){case"type":h=X;break;case"name":u=X;break;case"checked":H=X;break;case"defaultChecked":J=X;break;case"value":x=X;break;case"defaultValue":E=X;break;case"children":case"dangerouslySetInnerHTML":if(X!=null)throw Error(s(137,n));break;default:X!==ne&&Ke(e,n,F,X,o,ne)}}_u(e,x,E,R,H,J,h,u);return;case"select":X=x=E=F=null;for(h in a)if(R=a[h],a.hasOwnProperty(h)&&R!=null)switch(h){case"value":break;case"multiple":X=R;default:o.hasOwnProperty(h)||Ke(e,n,h,null,o,R)}for(u in o)if(h=o[u],R=a[u],o.hasOwnProperty(u)&&(h!=null||R!=null))switch(u){case"value":F=h;break;case"defaultValue":E=h;break;case"multiple":x=h;default:h!==R&&Ke(e,n,u,h,o,R)}n=E,a=x,o=X,F!=null?Qi(e,!!a,F,!1):!!o!=!!a&&(n!=null?Qi(e,!!a,n,!0):Qi(e,!!a,a?[]:"",!1));return;case"textarea":X=F=null;for(E in a)if(u=a[E],a.hasOwnProperty(E)&&u!=null&&!o.hasOwnProperty(E))switch(E){case"value":break;case"children":break;default:Ke(e,n,E,null,o,u)}for(x in o)if(u=o[x],h=a[x],o.hasOwnProperty(x)&&(u!=null||h!=null))switch(x){case"value":F=u;break;case"defaultValue":X=u;break;case"children":break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(s(91));break;default:u!==h&&Ke(e,n,x,u,o,h)}nm(e,F,X);return;case"option":for(var ge in a)if(F=a[ge],a.hasOwnProperty(ge)&&F!=null&&!o.hasOwnProperty(ge))switch(ge){case"selected":e.selected=!1;break;default:Ke(e,n,ge,null,o,F)}for(R in o)if(F=o[R],X=a[R],o.hasOwnProperty(R)&&F!==X&&(F!=null||X!=null))switch(R){case"selected":e.selected=F&&typeof F!="function"&&typeof F!="symbol";break;default:Ke(e,n,R,F,o,X)}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 Ee in a)F=a[Ee],a.hasOwnProperty(Ee)&&F!=null&&!o.hasOwnProperty(Ee)&&Ke(e,n,Ee,null,o,F);for(H in o)if(F=o[H],X=a[H],o.hasOwnProperty(H)&&F!==X&&(F!=null||X!=null))switch(H){case"children":case"dangerouslySetInnerHTML":if(F!=null)throw Error(s(137,n));break;default:Ke(e,n,H,F,o,X)}return;default:if(Su(n)){for(var Je in a)F=a[Je],a.hasOwnProperty(Je)&&F!==void 0&&!o.hasOwnProperty(Je)&&uh(e,n,Je,void 0,o,F);for(J in o)F=o[J],X=a[J],!o.hasOwnProperty(J)||F===X||F===void 0&&X===void 0||uh(e,n,J,F,o,X);return}}for(var U in a)F=a[U],a.hasOwnProperty(U)&&F!=null&&!o.hasOwnProperty(U)&&Ke(e,n,U,null,o,F);for(ne in o)F=o[ne],X=a[ne],!o.hasOwnProperty(ne)||F===X||F==null&&X==null||Ke(e,n,ne,F,o,X)}function ag(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function y_(){if(typeof performance.getEntriesByType=="function"){for(var e=0,n=0,a=performance.getEntriesByType("resource"),o=0;o<a.length;o++){var u=a[o],h=u.transferSize,x=u.initiatorType,E=u.duration;if(h&&E&&ag(x)){for(x=0,E=u.responseEnd,o+=1;o<a.length;o++){var R=a[o],H=R.startTime;if(H>E)break;var J=R.transferSize,ne=R.initiatorType;J&&ag(ne)&&(R=R.responseEnd,x+=J*(R<E?1:(E-H)/(R-H)))}if(--o,n+=8*(h+x)/(u.duration/1e3),e++,10<e)break}}if(0<e)return n/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var fh=null,hh=null;function kl(e){return e.nodeType===9?e:e.ownerDocument}function og(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 lg(e,n){if(e===0)switch(n){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&n==="foreignObject"?0:e}function dh(e,n){return e==="textarea"||e==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.children=="bigint"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var mh=null;function b_(){var e=window.event;return e&&e.type==="popstate"?e===mh?!1:(mh=e,!0):(mh=null,!1)}var cg=typeof setTimeout=="function"?setTimeout:void 0,v_=typeof clearTimeout=="function"?clearTimeout:void 0,ug=typeof Promise=="function"?Promise:void 0,x_=typeof queueMicrotask=="function"?queueMicrotask:typeof ug<"u"?function(e){return ug.resolve(null).then(e).catch(__)}:cg;function __(e){setTimeout(function(){throw e})}function Jr(e){return e==="head"}function fg(e,n){var a=n,o=0;do{var u=a.nextSibling;if(e.removeChild(a),u&&u.nodeType===8)if(a=u.data,a==="/$"||a==="/&"){if(o===0){e.removeChild(u),Ns(n);return}o--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")o++;else if(a==="html")La(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,La(a);for(var h=a.firstChild;h;){var x=h.nextSibling,E=h.nodeName;h[wt]||E==="SCRIPT"||E==="STYLE"||E==="LINK"&&h.rel.toLowerCase()==="stylesheet"||a.removeChild(h),h=x}}else a==="body"&&La(e.ownerDocument.body);a=u}while(a);Ns(n)}function hg(e,n){var a=e;e=0;do{var o=a.nextSibling;if(a.nodeType===1?n?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(n?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),o&&o.nodeType===8)if(a=o.data,a==="/$"){if(e===0)break;e--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||e++;a=o}while(a)}function ph(e){var n=e.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var a=n;switch(n=n.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":ph(a),Ji(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function w_(e,n,a,o){for(;e.nodeType===1;){var u=a;if(e.nodeName.toLowerCase()!==n.toLowerCase()){if(!o&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(o){if(!e[wt])switch(n){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(h=e.getAttribute("rel"),h==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(h!==u.rel||e.getAttribute("href")!==(u.href==null||u.href===""?null:u.href)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin)||e.getAttribute("title")!==(u.title==null?null:u.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(h=e.getAttribute("src"),(h!==(u.src==null?null:u.src)||e.getAttribute("type")!==(u.type==null?null:u.type)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin))&&h&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(n==="input"&&e.type==="hidden"){var h=u.name==null?null:""+u.name;if(u.type==="hidden"&&e.getAttribute("name")===h)return e}else return e;if(e=An(e.nextSibling),e===null)break}return null}function S_(e,n,a){if(n==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=An(e.nextSibling),e===null))return null;return e}function dg(e,n){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=An(e.nextSibling),e===null))return null;return e}function gh(e){return e.data==="$?"||e.data==="$~"}function yh(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function E_(e,n){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=n;else if(e.data!=="$?"||a.readyState!=="loading")n();else{var o=function(){n(),a.removeEventListener("DOMContentLoaded",o)};a.addEventListener("DOMContentLoaded",o),e._reactRetry=o}}function An(e){for(;e!=null;e=e.nextSibling){var n=e.nodeType;if(n===1||n===3)break;if(n===8){if(n=e.data,n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"||n==="F!"||n==="F")break;if(n==="/$"||n==="/&")return null}}return e}var bh=null;function mg(e){e=e.nextSibling;for(var n=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(n===0)return An(e.nextSibling);n--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||n++}e=e.nextSibling}return null}function pg(e){e=e.previousSibling;for(var n=0;e;){if(e.nodeType===8){var a=e.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(n===0)return e;n--}else a!=="/$"&&a!=="/&"||n++}e=e.previousSibling}return null}function gg(e,n,a){switch(n=kl(a),e){case"html":if(e=n.documentElement,!e)throw Error(s(452));return e;case"head":if(e=n.head,!e)throw Error(s(453));return e;case"body":if(e=n.body,!e)throw Error(s(454));return e;default:throw Error(s(451))}}function La(e){for(var n=e.attributes;n.length;)e.removeAttributeNode(n[0]);Ji(e)}var jn=new Map,yg=new Set;function Cl(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var vr=oe.d;oe.d={f:O_,r:A_,D:j_,C:T_,L:N_,m:k_,X:M_,S:C_,M:R_};function O_(){var e=vr.f(),n=wl();return e||n}function A_(e){var n=N(e);n!==null&&n.tag===5&&n.type==="form"?D0(n):vr.r(e)}var As=typeof document>"u"?null:document;function bg(e,n,a){var o=As;if(o&&typeof n=="string"&&n){var u=vn(n);u='link[rel="'+e+'"][href="'+u+'"]',typeof a=="string"&&(u+='[crossorigin="'+a+'"]'),yg.has(u)||(yg.add(u),e={rel:e,crossOrigin:a,href:n},o.querySelector(u)===null&&(n=o.createElement("link"),Ct(n,"link",e),D(n),o.head.appendChild(n)))}}function j_(e){vr.D(e),bg("dns-prefetch",e,null)}function T_(e,n){vr.C(e,n),bg("preconnect",e,n)}function N_(e,n,a){vr.L(e,n,a);var o=As;if(o&&e&&n){var u='link[rel="preload"][as="'+vn(n)+'"]';n==="image"&&a&&a.imageSrcSet?(u+='[imagesrcset="'+vn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(u+='[imagesizes="'+vn(a.imageSizes)+'"]')):u+='[href="'+vn(e)+'"]';var h=u;switch(n){case"style":h=js(e);break;case"script":h=Ts(e)}jn.has(h)||(e=b({rel:"preload",href:n==="image"&&a&&a.imageSrcSet?void 0:e,as:n},a),jn.set(h,e),o.querySelector(u)!==null||n==="style"&&o.querySelector(za(h))||n==="script"&&o.querySelector(Ua(h))||(n=o.createElement("link"),Ct(n,"link",e),D(n),o.head.appendChild(n)))}}function k_(e,n){vr.m(e,n);var a=As;if(a&&e){var o=n&&typeof n.as=="string"?n.as:"script",u='link[rel="modulepreload"][as="'+vn(o)+'"][href="'+vn(e)+'"]',h=u;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":h=Ts(e)}if(!jn.has(h)&&(e=b({rel:"modulepreload",href:e},n),jn.set(h,e),a.querySelector(u)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Ua(h)))return}o=a.createElement("link"),Ct(o,"link",e),D(o),a.head.appendChild(o)}}}function C_(e,n,a){vr.S(e,n,a);var o=As;if(o&&e){var u=k(o).hoistableStyles,h=js(e);n=n||"default";var x=u.get(h);if(!x){var E={loading:0,preload:null};if(x=o.querySelector(za(h)))E.loading=5;else{e=b({rel:"stylesheet",href:e,"data-precedence":n},a),(a=jn.get(h))&&vh(e,a);var R=x=o.createElement("link");D(R),Ct(R,"link",e),R._p=new Promise(function(H,J){R.onload=H,R.onerror=J}),R.addEventListener("load",function(){E.loading|=1}),R.addEventListener("error",function(){E.loading|=2}),E.loading|=4,Ml(x,n,o)}x={type:"stylesheet",instance:x,count:1,state:E},u.set(h,x)}}}function M_(e,n){vr.X(e,n);var a=As;if(a&&e){var o=k(a).hoistableScripts,u=Ts(e),h=o.get(u);h||(h=a.querySelector(Ua(u)),h||(e=b({src:e,async:!0},n),(n=jn.get(u))&&xh(e,n),h=a.createElement("script"),D(h),Ct(h,"link",e),a.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},o.set(u,h))}}function R_(e,n){vr.M(e,n);var a=As;if(a&&e){var o=k(a).hoistableScripts,u=Ts(e),h=o.get(u);h||(h=a.querySelector(Ua(u)),h||(e=b({src:e,async:!0,type:"module"},n),(n=jn.get(u))&&xh(e,n),h=a.createElement("script"),D(h),Ct(h,"link",e),a.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},o.set(u,h))}}function vg(e,n,a,o){var u=(u=Ht.current)?Cl(u):null;if(!u)throw Error(s(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(n=js(a.href),a=k(u).hoistableStyles,o=a.get(n),o||(o={type:"style",instance:null,count:0,state:null},a.set(n,o)),o):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=js(a.href);var h=k(u).hoistableStyles,x=h.get(e);if(x||(u=u.ownerDocument||u,x={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},h.set(e,x),(h=u.querySelector(za(e)))&&!h._p&&(x.instance=h,x.state.loading=5),jn.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},jn.set(e,a),h||D_(u,e,a,x.state))),n&&o===null)throw Error(s(528,""));return x}if(n&&o!==null)throw Error(s(529,""));return null;case"script":return n=a.async,a=a.src,typeof a=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=Ts(a),a=k(u).hoistableScripts,o=a.get(n),o||(o={type:"script",instance:null,count:0,state:null},a.set(n,o)),o):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,e))}}function js(e){return'href="'+vn(e)+'"'}function za(e){return'link[rel="stylesheet"]['+e+"]"}function xg(e){return b({},e,{"data-precedence":e.precedence,precedence:null})}function D_(e,n,a,o){e.querySelector('link[rel="preload"][as="style"]['+n+"]")?o.loading=1:(n=e.createElement("link"),o.preload=n,n.addEventListener("load",function(){return o.loading|=1}),n.addEventListener("error",function(){return o.loading|=2}),Ct(n,"link",a),D(n),e.head.appendChild(n))}function Ts(e){return'[src="'+vn(e)+'"]'}function Ua(e){return"script[async]"+e}function _g(e,n,a){if(n.count++,n.instance===null)switch(n.type){case"style":var o=e.querySelector('style[data-href~="'+vn(a.href)+'"]');if(o)return n.instance=o,D(o),o;var u=b({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return o=(e.ownerDocument||e).createElement("style"),D(o),Ct(o,"style",u),Ml(o,a.precedence,e),n.instance=o;case"stylesheet":u=js(a.href);var h=e.querySelector(za(u));if(h)return n.state.loading|=4,n.instance=h,D(h),h;o=xg(a),(u=jn.get(u))&&vh(o,u),h=(e.ownerDocument||e).createElement("link"),D(h);var x=h;return x._p=new Promise(function(E,R){x.onload=E,x.onerror=R}),Ct(h,"link",o),n.state.loading|=4,Ml(h,a.precedence,e),n.instance=h;case"script":return h=Ts(a.src),(u=e.querySelector(Ua(h)))?(n.instance=u,D(u),u):(o=a,(u=jn.get(h))&&(o=b({},a),xh(o,u)),e=e.ownerDocument||e,u=e.createElement("script"),D(u),Ct(u,"link",o),e.head.appendChild(u),n.instance=u);case"void":return null;default:throw Error(s(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(o=n.instance,n.state.loading|=4,Ml(o,a.precedence,e));return n.instance}function Ml(e,n,a){for(var o=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=o.length?o[o.length-1]:null,h=u,x=0;x<o.length;x++){var E=o[x];if(E.dataset.precedence===n)h=E;else if(h!==u)break}h?h.parentNode.insertBefore(e,h.nextSibling):(n=a.nodeType===9?a.head:a,n.insertBefore(e,n.firstChild))}function vh(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.title==null&&(e.title=n.title)}function xh(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.integrity==null&&(e.integrity=n.integrity)}var Rl=null;function wg(e,n,a){if(Rl===null){var o=new Map,u=Rl=new Map;u.set(a,o)}else u=Rl,o=u.get(a),o||(o=new Map,u.set(a,o));if(o.has(e))return o;for(o.set(e,null),a=a.getElementsByTagName(e),u=0;u<a.length;u++){var h=a[u];if(!(h[wt]||h[Qe]||e==="link"&&h.getAttribute("rel")==="stylesheet")&&h.namespaceURI!=="http://www.w3.org/2000/svg"){var x=h.getAttribute(n)||"";x=e+x;var E=o.get(x);E?E.push(h):o.set(x,[h])}}return o}function Sg(e,n,a){e=e.ownerDocument||e,e.head.insertBefore(a,n==="title"?e.querySelector("head > title"):null)}function q_(e,n,a){if(a===1||n.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;switch(n.rel){case"stylesheet":return e=n.disabled,typeof n.precedence=="string"&&e==null;default:return!0}case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function Eg(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function B_(e,n,a,o){if(a.type==="stylesheet"&&(typeof o.media!="string"||matchMedia(o.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var u=js(o.href),h=n.querySelector(za(u));if(h){n=h._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=Dl.bind(e),n.then(e,e)),a.state.loading|=4,a.instance=h,D(h);return}h=n.ownerDocument||n,o=xg(o),(u=jn.get(u))&&vh(o,u),h=h.createElement("link"),D(h);var x=h;x._p=new Promise(function(E,R){x.onload=E,x.onerror=R}),Ct(h,"link",o),a.instance=h}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,n),(n=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=Dl.bind(e),n.addEventListener("load",a),n.addEventListener("error",a))}}var _h=0;function L_(e,n){return e.stylesheets&&e.count===0&&Bl(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var o=setTimeout(function(){if(e.stylesheets&&Bl(e,e.stylesheets),e.unsuspend){var h=e.unsuspend;e.unsuspend=null,h()}},6e4+n);0<e.imgBytes&&_h===0&&(_h=62500*y_());var u=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Bl(e,e.stylesheets),e.unsuspend)){var h=e.unsuspend;e.unsuspend=null,h()}},(e.imgBytes>_h?50:800)+n);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(o),clearTimeout(u)}}:null}function Dl(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Bl(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var ql=null;function Bl(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ql=new Map,n.forEach(z_,e),ql=null,Dl.call(e))}function z_(e,n){if(!(n.state.loading&4)){var a=ql.get(e);if(a)var o=a.get(null);else{a=new Map,ql.set(e,a);for(var u=e.querySelectorAll("link[data-precedence],style[data-precedence]"),h=0;h<u.length;h++){var x=u[h];(x.nodeName==="LINK"||x.getAttribute("media")!=="not all")&&(a.set(x.dataset.precedence,x),o=x)}o&&a.set(null,o)}u=n.instance,x=u.getAttribute("data-precedence"),h=a.get(x)||o,h===o&&a.set(null,u),a.set(x,u),this.count++,o=Dl.bind(this),u.addEventListener("load",o),u.addEventListener("error",o),h?h.parentNode.insertBefore(u,h.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(u,e.firstChild)),n.state.loading|=4}}var Pa={$$typeof:ie,Provider:null,Consumer:null,_currentValue:de,_currentValue2:de,_threadCount:0};function U_(e,n,a,o,u,h,x,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=Nr(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Nr(0),this.hiddenUpdates=Nr(null),this.identifierPrefix=o,this.onUncaughtError=u,this.onCaughtError=h,this.onRecoverableError=x,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=R,this.incompleteTransitions=new Map}function Og(e,n,a,o,u,h,x,E,R,H,J,ne){return e=new U_(e,n,a,x,R,H,J,ne,E),n=1,h===!0&&(n|=24),h=Wt(3,null,null,n),e.current=h,h.stateNode=e,n=Wu(),n.refCount++,e.pooledCache=n,n.refCount++,h.memoizedState={element:o,isDehydrated:a,cache:n},rf(h),e}function Ag(e){return e?(e=ss,e):ss}function jg(e,n,a,o,u,h){u=Ag(u),o.context===null?o.context=u:o.pendingContext=u,o=Ur(n),o.payload={element:a},h=h===void 0?null:h,h!==null&&(o.callback=h),a=Pr(e,o,n),a!==null&&(Kt(a,e,n),ba(a,e,n))}function Tg(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<n?a:n}}function wh(e,n){Tg(e,n),(e=e.alternate)&&Tg(e,n)}function Ng(e){if(e.tag===13||e.tag===31){var n=Ei(e,67108864);n!==null&&Kt(n,e,67108864),wh(e,67108864)}}function kg(e){if(e.tag===13||e.tag===31){var n=sn();n=tr(n);var a=Ei(e,n);a!==null&&Kt(a,e,n),wh(e,n)}}var Ll=!0;function P_(e,n,a,o){var u=Y.T;Y.T=null;var h=oe.p;try{oe.p=2,Sh(e,n,a,o)}finally{oe.p=h,Y.T=u}}function I_(e,n,a,o){var u=Y.T;Y.T=null;var h=oe.p;try{oe.p=8,Sh(e,n,a,o)}finally{oe.p=h,Y.T=u}}function Sh(e,n,a,o){if(Ll){var u=Eh(o);if(u===null)ch(e,n,o,zl,a),Mg(e,o);else if(H_(u,e,n,a,o))o.stopPropagation();else if(Mg(e,o),n&4&&-1<$_.indexOf(e)){for(;u!==null;){var h=N(u);if(h!==null)switch(h.tag){case 3:if(h=h.stateNode,h.current.memoizedState.isDehydrated){var x=Mn(h.pendingLanes);if(x!==0){var E=h;for(E.pendingLanes|=2,E.entangledLanes|=2;x;){var R=1<<31-Bt(x);E.entanglements[1]|=R,x&=~R}Yn(h),(Ge&6)===0&&(xl=nt()+500,Da(0))}}break;case 31:case 13:E=Ei(h,2),E!==null&&Kt(E,h,2),wl(),wh(h,2)}if(h=Eh(o),h===null&&ch(e,n,o,zl,a),h===u)break;u=h}u!==null&&o.stopPropagation()}else ch(e,n,o,null,a)}}function Eh(e){return e=Ou(e),Oh(e)}var zl=null;function Oh(e){if(zl=null,e=O(e),e!==null){var n=c(e);if(n===null)e=null;else{var a=n.tag;if(a===13){if(e=m(n),e!==null)return e;e=null}else if(a===31){if(e=p(n),e!==null)return e;e=null}else if(a===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;e=null}else n!==e&&(e=null)}}return zl=e,null}function Cg(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(yu()){case jo:return 2;case To:return 8;case Yi:case bu:return 32;case No:return 268435456;default:return 32}default:return 32}}var Ah=!1,Qr=null,Zr=null,Wr=null,Ia=new Map,$a=new Map,ei=[],$_="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 Mg(e,n){switch(e){case"focusin":case"focusout":Qr=null;break;case"dragenter":case"dragleave":Zr=null;break;case"mouseover":case"mouseout":Wr=null;break;case"pointerover":case"pointerout":Ia.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":$a.delete(n.pointerId)}}function Ha(e,n,a,o,u,h){return e===null||e.nativeEvent!==h?(e={blockedOn:n,domEventName:a,eventSystemFlags:o,nativeEvent:h,targetContainers:[u]},n!==null&&(n=N(n),n!==null&&Ng(n)),e):(e.eventSystemFlags|=o,n=e.targetContainers,u!==null&&n.indexOf(u)===-1&&n.push(u),e)}function H_(e,n,a,o,u){switch(n){case"focusin":return Qr=Ha(Qr,e,n,a,o,u),!0;case"dragenter":return Zr=Ha(Zr,e,n,a,o,u),!0;case"mouseover":return Wr=Ha(Wr,e,n,a,o,u),!0;case"pointerover":var h=u.pointerId;return Ia.set(h,Ha(Ia.get(h)||null,e,n,a,o,u)),!0;case"gotpointercapture":return h=u.pointerId,$a.set(h,Ha($a.get(h)||null,e,n,a,o,u)),!0}return!1}function Rg(e){var n=O(e.target);if(n!==null){var a=c(n);if(a!==null){if(n=a.tag,n===13){if(n=m(a),n!==null){e.blockedOn=n,Co(e.priority,function(){kg(a)});return}}else if(n===31){if(n=p(a),n!==null){e.blockedOn=n,Co(e.priority,function(){kg(a)});return}}else if(n===3&&a.stateNode.current.memoizedState.isDehydrated){e.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Ul(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var a=Eh(e.nativeEvent);if(a===null){a=e.nativeEvent;var o=new a.constructor(a.type,a);Eu=o,a.target.dispatchEvent(o),Eu=null}else return n=N(a),n!==null&&Ng(n),e.blockedOn=a,!1;n.shift()}return!0}function Dg(e,n,a){Ul(e)&&a.delete(n)}function G_(){Ah=!1,Qr!==null&&Ul(Qr)&&(Qr=null),Zr!==null&&Ul(Zr)&&(Zr=null),Wr!==null&&Ul(Wr)&&(Wr=null),Ia.forEach(Dg),$a.forEach(Dg)}function Pl(e,n){e.blockedOn===n&&(e.blockedOn=null,Ah||(Ah=!0,i.unstable_scheduleCallback(i.unstable_NormalPriority,G_)))}var Il=null;function qg(e){Il!==e&&(Il=e,i.unstable_scheduleCallback(i.unstable_NormalPriority,function(){Il===e&&(Il=null);for(var n=0;n<e.length;n+=3){var a=e[n],o=e[n+1],u=e[n+2];if(typeof o!="function"){if(Oh(o||a)===null)continue;break}var h=N(a);h!==null&&(e.splice(n,3),n-=3,Ef(h,{pending:!0,data:u,method:a.method,action:o},o,u))}}))}function Ns(e){function n(R){return Pl(R,e)}Qr!==null&&Pl(Qr,e),Zr!==null&&Pl(Zr,e),Wr!==null&&Pl(Wr,e),Ia.forEach(n),$a.forEach(n);for(var a=0;a<ei.length;a++){var o=ei[a];o.blockedOn===e&&(o.blockedOn=null)}for(;0<ei.length&&(a=ei[0],a.blockedOn===null);)Rg(a),a.blockedOn===null&&ei.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(o=0;o<a.length;o+=3){var u=a[o],h=a[o+1],x=u[ot]||null;if(typeof h=="function")x||qg(a);else if(x){var E=null;if(h&&h.hasAttribute("formAction")){if(u=h,x=h[ot]||null)E=x.formAction;else if(Oh(u)!==null)continue}else E=x.action;typeof E=="function"?a[o+1]=E:(a.splice(o,3),o-=3),qg(a)}}}function Bg(){function e(h){h.canIntercept&&h.info==="react-transition"&&h.intercept({handler:function(){return new Promise(function(x){return u=x})},focusReset:"manual",scroll:"manual"})}function n(){u!==null&&(u(),u=null),o||setTimeout(a,20)}function a(){if(!o&&!navigation.transition){var h=navigation.currentEntry;h&&h.url!=null&&navigation.navigate(h.url,{state:h.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var o=!1,u=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(a,100),function(){o=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),u!==null&&(u(),u=null)}}}function jh(e){this._internalRoot=e}$l.prototype.render=jh.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(s(409));var a=n.current,o=sn();jg(a,o,e,n,null,null)},$l.prototype.unmount=jh.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;jg(e.current,2,null,e,null,null),wl(),n[Qt]=null}};function $l(e){this._internalRoot=e}$l.prototype.unstable_scheduleHydration=function(e){if(e){var n=ta();e={blockedOn:null,target:e,priority:n};for(var a=0;a<ei.length&&n!==0&&n<ei[a].priority;a++);ei.splice(a,0,e),a===0&&Rg(e)}};var Lg=t.version;if(Lg!=="19.2.4")throw Error(s(527,Lg,"19.2.4"));oe.findDOMNode=function(e){var n=e._reactInternals;if(n===void 0)throw typeof e.render=="function"?Error(s(188)):(e=Object.keys(e).join(","),Error(s(268,e)));return e=f(n),e=e!==null?d(e):null,e=e===null?null:e.stateNode,e};var F_={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:Y,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Hl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Hl.isDisabled&&Hl.supportsFiber)try{pi=Hl.inject(F_),ft=Hl}catch{}}return Ga.createRoot=function(e,n){if(!l(e))throw Error(s(299));var a=!1,o="",u=G0,h=F0,x=V0;return n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onUncaughtError!==void 0&&(u=n.onUncaughtError),n.onCaughtError!==void 0&&(h=n.onCaughtError),n.onRecoverableError!==void 0&&(x=n.onRecoverableError)),n=Og(e,1,!1,null,null,a,o,null,u,h,x,Bg),e[Qt]=n.current,lh(e),new jh(n)},Ga.hydrateRoot=function(e,n,a){if(!l(e))throw Error(s(299));var o=!1,u="",h=G0,x=F0,E=V0,R=null;return a!=null&&(a.unstable_strictMode===!0&&(o=!0),a.identifierPrefix!==void 0&&(u=a.identifierPrefix),a.onUncaughtError!==void 0&&(h=a.onUncaughtError),a.onCaughtError!==void 0&&(x=a.onCaughtError),a.onRecoverableError!==void 0&&(E=a.onRecoverableError),a.formState!==void 0&&(R=a.formState)),n=Og(e,1,!0,n,a??null,o,u,R,h,x,E,Bg),n.context=Ag(null),a=n.current,o=sn(),o=tr(o),u=Ur(o),u.callback=null,Pr(a,u,o),a=o,n.current.lanes=a,Rn(n,a),Yn(n),e[Qt]=n.current,lh(e),new $l(n)},Ga.version="19.2.4",Ga}var Fg;function Dw(){if(Fg)return Th.exports;Fg=1;function i(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(t){console.error(t)}}return i(),Th.exports=Rw(),Th.exports}var qw=Dw();const Bw="modulepreload",Lw=function(i,t){return new URL(i,t).href},Vg={},we=function(t,r,s){let l=Promise.resolve();if(r&&r.length>0){let m=function(d){return Promise.all(d.map(b=>Promise.resolve(b).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};const p=document.getElementsByTagName("link"),g=document.querySelector("meta[property=csp-nonce]"),f=(g==null?void 0:g.nonce)||(g==null?void 0:g.getAttribute("nonce"));l=m(r.map(d=>{if(d=Lw(d,s),d in Vg)return;Vg[d]=!0;const b=d.endsWith(".css"),v=b?'[rel="stylesheet"]':"";if(!!s)for(let S=p.length-1;S>=0;S--){const M=p[S];if(M.href===d&&(!b||M.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${d}"]${v}`))return;const w=document.createElement("link");if(w.rel=b?"stylesheet":Bw,b||(w.as="script"),w.crossOrigin="",w.href=d,f&&w.setAttribute("nonce",f),document.head.appendChild(w),b)return new Promise((S,M)=>{w.addEventListener("load",S),w.addEventListener("error",()=>M(new Error(`Unable to preload CSS for ${d}`)))})}))}function c(m){const p=new Event("vite:preloadError",{cancelable:!0});if(p.payload=m,window.dispatchEvent(p),!p.defaultPrevented)throw m}return l.then(m=>{for(const p of m||[])p.status==="rejected"&&c(p.reason);return t().catch(c)})};function Sd(i){try{const t=i.split(".");if(t.length!==3)return null;const r=atob(t[1].replace(/-/g,"+").replace(/_/g,"/"));return JSON.parse(r)}catch{return null}}function ub(i){const t=Sd(i);return!t||typeof t.exp!="number"?null:t.exp}function Ed(i,t=0){const r=ub(i);return r===null?!0:Date.now()/1e3>=r-t}const Mt=window.__LT_BASE__??"",Kh=`${Mt}/api`;class Yg extends Error{constructor(t,r,s){super(t),this.status=r,this.body=s,this.name="ApiError"}}let si=null;function Gl(i){si=i}function fb(){return si}const zw="X-LT-Acting-Token";let Uc=null,Pc=null;function Xg(i){Uc=i}function Kg(i){Pc=i}function Uw(i){const t=i==null?void 0:i.error;return typeof t=="string"&&/acting[- ]identity/i.test(t)}async function Jg(){const i=sessionStorage.getItem("lt_credentials");if(!i)return null;try{const{username:t,password:r}=JSON.parse(i),s=await fetch(`${Kh}/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:t,password:r})});if(!s.ok)return null;const l=await s.json();return l.token&&l.user&&sessionStorage.setItem("lt_user_info",JSON.stringify({displayName:l.user.display_name,username:l.user.external_id})),l.token??null}catch{return null}}let ni=null;async function Ae(i,t={}){const r={"Content-Type":"application/json",...t.headers};if(si){if(Ed(si)){ni||(ni=Jg().finally(()=>{ni=null}));const c=await ni;if(c)si=c,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:c}}));else throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}r.Authorization=`Bearer ${si}`}const s=(Uc==null?void 0:Uc())??null;s&&(r[zw]=s);let l=await fetch(`${Kh}${i}`,{...t,headers:r});if(l.status===401&&s){const c=await l.clone().json().catch(()=>null);if(Uw(c))throw Pc==null||Pc(),new Yg(c.error,401,c)}if(l.status===401&&si){ni||(ni=Jg().finally(()=>{ni=null}));const c=await ni;if(c&&(si=c,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:c}})),r.Authorization=`Bearer ${c}`,l=await fetch(`${Kh}${i}`,{...t,headers:r})),l.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}else if(l.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired");if(!l.ok){const c=await l.json().catch(()=>({error:l.statusText}));throw new Yg(c.message||c.error||l.statusText,l.status,c)}return l.json()}const hb=j.createContext(null),Pw=300;function Ch(i,t){if(Ed(i))return null;const r=Sd(i);if(!r)return null;const s=t??(()=>{try{const l=sessionStorage.getItem("lt_user_info");return l?JSON.parse(l):null}catch{return null}})();return{userId:r.userId,displayName:(s==null?void 0:s.displayName)??null,username:(s==null?void 0:s.username)??null,roles:r.roles??[]}}function Iw({children:i}){const[t,r]=j.useState(()=>{const b=sessionStorage.getItem("lt_token");return b?Ed(b)?(sessionStorage.removeItem("lt_token"),null):(Gl(b),Ch(b)):null}),s=j.useRef(void 0),l=j.useCallback(b=>{clearTimeout(s.current);const v=ub(b);if(!v)return;const _=(v-Pw)*1e3-Date.now();_<=0||(s.current=setTimeout(async()=>{try{const w=Sd(b);if(w!=null&&w.sso){const ae=await fetch(`${Mt}/api/auth/sso`,{method:"POST"});if(!ae.ok)return;const C=await ae.json();C.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:C.token}}));return}const S=sessionStorage.getItem("lt_credentials");if(!S)return;const{username:M,password:L}=JSON.parse(S),z=await fetch(`${Mt}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:M,password:L})});if(!z.ok)return;const ie=await z.json();ie.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:ie.token}}))}catch{}},_))},[]),c=j.useCallback((b,v,_)=>{const w={displayName:(_==null?void 0:_.displayName)??null,username:(_==null?void 0:_.username)??(v==null?void 0:v.username)??null},S=Ch(b,w);S&&(Gl(b),sessionStorage.setItem("lt_token",b),sessionStorage.setItem("lt_user_info",JSON.stringify(w)),v&&sessionStorage.setItem("lt_credentials",JSON.stringify(v)),r(S),l(b))},[l]),m=j.useCallback(()=>{clearTimeout(s.current);const b=sessionStorage.getItem("lt_sso_logout_url");Gl(null),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info"),sessionStorage.removeItem("lt_sso_logout_url"),r(null),b&&(window.location.href=b)},[]);j.useEffect(()=>{const b=()=>m(),v=_=>{var M;const w=(M=_.detail)==null?void 0:M.token;if(!w)return;const S=Ch(w);S&&(Gl(w),sessionStorage.setItem("lt_token",w),r(S),l(w))};return window.addEventListener("auth:unauthorized",b),window.addEventListener("auth:refreshed",v),()=>{window.removeEventListener("auth:unauthorized",b),window.removeEventListener("auth:refreshed",v)}},[m,l]),j.useEffect(()=>{const b=sessionStorage.getItem("lt_token");return b&&t&&l(b),()=>clearTimeout(s.current)},[]);const p=(t==null?void 0:t.roles.some(b=>b.type==="superadmin"))??!1,g=j.useCallback(b=>(t==null?void 0:t.roles.some(v=>v.role===b))??!1,[t]),f=j.useCallback(b=>(t==null?void 0:t.roles.some(v=>v.type===b))??!1,[t]),d=(t==null?void 0:t.roles.map(b=>b.role))??[];return y.jsx(hb.Provider,{value:{user:t,isAuthenticated:!!t,isSuperAdmin:p,login:c,logout:m,hasRole:g,hasRoleType:f,userRoleNames:d},children:i})}function pn(){const i=j.useContext(hb);if(!i)throw new Error("useAuth must be used within AuthProvider");return i}const hn=new Uint8Array(0),Hi=new TextEncoder,un=new TextDecoder;function $w(...i){let t=0;for(let l=0;l<i.length;l++)t+=i[l].length;const r=new Uint8Array(t);let s=0;for(let l=0;l<i.length;l++)r.set(i[l],s),s+=i[l].length;return r}function so(...i){const t=[];for(let r=0;r<i.length;r++)t.push(Hi.encode(i[r]));return t.length===0?hn:t.length===1?t[0]:$w(...t)}function Qg(i){return!i||i.length===0?"":un.decode(i)}const Zg="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",Wg=36,Hw=0xcfd41b9100000,ey=33,Gw=333,ty=22;function Fw(i){for(let t=0;t<i.length;t++)i[t]=Math.floor(Math.random()*255)}function Vw(i){var t;(t=globalThis==null?void 0:globalThis.crypto)!=null&&t.getRandomValues?globalThis.crypto.getRandomValues(i):Fw(i)}class Yw{constructor(){A(this,"buf");A(this,"seq");A(this,"inc");A(this,"inited");this.buf=new Uint8Array(ty),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(Math.random()*Hw),this.inc=Math.floor(Math.random()*(Gw-ey)+ey)}setPre(){const t=new Uint8Array(12);Vw(t);for(let r=0;r<12;r++){const s=t[r]%36;this.buf[r]=Zg.charCodeAt(s)}}fillSeq(){let t=this.seq;for(let r=ty-1;r>=12;r--)this.buf[r]=Zg.charCodeAt(t%Wg),t=Math.floor(t/Wg)}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 fi=new Yw;var _r;(function(i){i.Disconnect="disconnect",i.Reconnect="reconnect",i.Update="update",i.LDM="ldm",i.Error="error"})(_r||(_r={}));var zs;(function(i){i.Reconnecting="reconnecting",i.PingTimer="pingTimer",i.StaleConnection="staleConnection",i.ClientInitiatedReconnect="client initiated reconnect"})(zs||(zs={}));var ce;(function(i){i.ApiError="BAD API",i.BadAuthentication="BAD_AUTHENTICATION",i.BadCreds="BAD_CREDS",i.BadHeader="BAD_HEADER",i.BadJson="BAD_JSON",i.BadPayload="BAD_PAYLOAD",i.BadSubject="BAD_SUBJECT",i.Cancelled="CANCELLED",i.ConnectionClosed="CONNECTION_CLOSED",i.ConnectionDraining="CONNECTION_DRAINING",i.ConnectionRefused="CONNECTION_REFUSED",i.ConnectionTimeout="CONNECTION_TIMEOUT",i.Disconnect="DISCONNECT",i.InvalidOption="INVALID_OPTION",i.InvalidPayload="INVALID_PAYLOAD",i.MaxPayloadExceeded="MAX_PAYLOAD_EXCEEDED",i.NoResponders="503",i.NotFunction="NOT_FUNC",i.RequestError="REQUEST_ERROR",i.ServerOptionNotAvailable="SERVER_OPT_NA",i.SubClosed="SUB_CLOSED",i.SubDraining="SUB_DRAINING",i.Timeout="TIMEOUT",i.Tls="TLS",i.Unknown="UNKNOWN_ERROR",i.WssRequired="WSS_REQUIRED",i.JetStreamInvalidAck="JESTREAM_INVALID_ACK",i.JetStream404NoMessages="404",i.JetStream408RequestTimeout="408",i.JetStream409MaxAckPendingExceeded="409",i.JetStream409="409",i.JetStreamNotEnabled="503",i.JetStreamIdleHeartBeat="IDLE_HEARTBEAT",i.AuthorizationViolation="AUTHORIZATION_VIOLATION",i.AuthenticationExpired="AUTHENTICATION_EXPIRED",i.ProtocolError="NATS_PROTOCOL_ERR",i.PermissionsViolation="PERMISSIONS_VIOLATION",i.AuthenticationTimeout="AUTHENTICATION_TIMEOUT",i.AccountExpired="ACCOUNT_EXPIRED"})(ce||(ce={}));function Xw(i){return typeof i.code=="string"}class db{constructor(){A(this,"messages");this.messages=new Map,this.messages.set(ce.InvalidPayload,"Invalid payload type - payloads can be 'binary', 'string', or 'json'"),this.messages.set(ce.BadJson,"Bad JSON"),this.messages.set(ce.WssRequired,"TLS is required, therefore a secure websocket connection is also required")}static getMessage(t){return Kw.getMessage(t)}getMessage(t){return this.messages.get(t)||t}}const Kw=new db;class me extends Error{constructor(r,s,l){super(r);A(this,"name");A(this,"message");A(this,"code");A(this,"permissionContext");A(this,"chainedError");A(this,"api_error");this.name="NatsError",this.message=r,this.code=s,this.chainedError=l}static errorForCode(r,s){const l=db.getMessage(r);return new me(l,r,s)}isAuthError(){return this.code===ce.AuthenticationExpired||this.code===ce.AuthorizationViolation||this.code===ce.AccountExpired}isAuthTimeout(){return this.code===ce.AuthenticationTimeout}isPermissionError(){return this.code===ce.PermissionsViolation}isProtocolError(){return this.code===ce.ProtocolError}isJetStreamError(){return this.api_error!==void 0}jsError(){return this.api_error?this.api_error:null}}var ln;(function(i){i[i.Exact=0]="Exact",i[i.CanonicalMIME=1]="CanonicalMIME",i[i.IgnoreCase=2]="IgnoreCase"})(ln||(ln={}));var In;(function(i){i.Timer="timer",i.Count="count",i.JitterTimer="jitterTimer",i.SentinelMsg="sentinelMsg"})(In||(In={}));var ao;(function(i){i.STATS="io.nats.micro.v1.stats_response",i.INFO="io.nats.micro.v1.info_response",i.PING="io.nats.micro.v1.ping_response"})(ao||(ao={}));const Xc="Nats-Service-Error",Kc="Nats-Service-Error-Code";class Jc extends Error{constructor(r,s){super(s);A(this,"code");this.code=r}static isServiceError(r){return Jc.toServiceError(r)!==null}static toServiceError(r){var l,c;const s=((l=r==null?void 0:r.headers)==null?void 0:l.get(Kc))||"";if(s!==""){const m=parseInt(s)||400,p=((c=r==null?void 0:r.headers)==null?void 0:c.get(Xc))||"";return new Jc(m,p.length?p:s)}return null}}function wr(i=""){if(i=i||"_INBOX",typeof i!="string")throw new Error("prefix must be a string");return i.split(".").forEach(t=>{if(t==="*"||t===">")throw new Error(`inbox prefixes cannot have wildcards '${i}'`)}),`${i}.${fi.next()}`}const Jh="127.0.0.1";var ai;(function(i){i.PING="PING",i.STATS="STATS",i.INFO="INFO"})(ai||(ai={}));function lu(i,...t){for(let r=0;r<t.length;r++){const s=t[r];Object.keys(s).forEach(function(l){i[l]=s[l]})}return i}function Fl(i){return un.decode(i).replace(/\n/g,"␊").replace(/\r/g,"␍")}function Gs(i,t=!0){const r=t?me.errorForCode(ce.Timeout):null;let s,l;const c=new Promise((m,p)=>{s={cancel:()=>{l&&clearTimeout(l)}},l=setTimeout(()=>{p(r===null?me.errorForCode(ce.Timeout):r)},i)});return Object.assign(c,s)}function Ys(i=0){let t;const r=new Promise(s=>{const l=setTimeout(()=>{s()},i);t={cancel:()=>{l&&clearTimeout(l)}}});return Object.assign(r,t)}function st(){let i={};const t=new Promise((r,s)=>{i={resolve:r,reject:s}});return Object.assign(t,i)}function mb(i){for(let t=i.length-1;t>0;t--){const r=Math.floor(Math.random()*(t+1));[i[t],i[r]]=[i[r],i[t]]}return i}function Jw(i){return i===0?0:Math.floor(i/2+Math.random()*i)}function Od(i=[0,250,250,500,500,3e3,5e3]){Array.isArray(i)||(i=[0,250,250,500,500,3e3,5e3]);const t=i.length-1;return{backoff(r){return Jw(r>t?i[t]:i[r])}}}function it(i){return i*1e6}function Ad(i){return Math.floor(i/1e6)}function ny(i){let s=!0;const l=new Array(i.length);for(let c=0;c<i.length;c++){let m=i.charCodeAt(c);if(m===58||m<33||m>126)throw new me(`'${i[c]}' is not a valid character for a header key`,ce.BadHeader);s&&97<=m&&m<=122?m-=32:!s&&65<=m&&m<=90&&(m+=32),l[c]=m,s=m==45}return String.fromCharCode(...l)}function Sr(i=0,t=""){if(i===0&&t!==""||i>0&&t==="")throw new Error("setting status requires both code and description");return new oi(i,t)}const Mh="NATS/1.0";class oi{constructor(t=0,r=""){A(this,"_code");A(this,"headers");A(this,"_description");this._code=t,this._description=r,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[r,s]of this.headers){const l=t.values(r);if(s.length!==l.length)return!1;const c=[...s].sort(),m=[...l].sort();for(let p=0;p<c.length;p++)if(c[p]!==m[p])return!1}return!0}return!1}static decode(t){const r=new oi,l=un.decode(t).split(`\r
27
+ `),c=l[0];if(c!==Mh){let m=c.replace(Mh,"").trim();if(m.length>0){r._code=parseInt(m,10),isNaN(r._code)&&(r._code=0);const p=r._code.toString();m=m.replace(p,""),r._description=m.trim()}}return l.length>=1&&l.slice(1).map(m=>{if(m){const p=m.indexOf(":");if(p>-1){const g=m.slice(0,p),f=m.slice(p+1).trim();r.append(g,f)}}}),r}toString(){if(this.headers.size===0&&this._code===0)return"";let t=Mh;this._code>0&&this._description!==""&&(t+=` ${this._code} ${this._description}`);for(const[r,s]of this.headers)for(let l=0;l<s.length;l++)t=`${t}\r
28
+ ${r}: ${s[l]}`;return`${t}\r
29
+ \r
30
+ `}encode(){return Hi.encode(this.toString())}static validHeaderValue(t){if(/[\r\n]/.test(t))throw new me("invalid header value - \\r and \\n are not allowed.",ce.BadHeader);return t.trim()}keys(){const t=[];for(const r of this.headers.keys())t.push(r);return t}findKeys(t,r=ln.Exact){const s=this.keys();switch(r){case ln.Exact:return s.filter(l=>l===t);case ln.CanonicalMIME:return t=ny(t),s.filter(l=>l===t);default:{const l=t.toLowerCase();return s.filter(c=>l===c.toLowerCase())}}}get(t,r=ln.Exact){const s=this.findKeys(t,r);if(s.length){const l=this.headers.get(s[0]);if(l)return Array.isArray(l)?l[0]:l}return""}last(t,r=ln.Exact){const s=this.findKeys(t,r);if(s.length){const l=this.headers.get(s[0]);if(l)return Array.isArray(l)?l[l.length-1]:l}return""}has(t,r=ln.Exact){return this.findKeys(t,r).length>0}set(t,r,s=ln.Exact){this.delete(t,s),this.append(t,r,s)}append(t,r,s=ln.Exact){const l=ny(t);s===ln.CanonicalMIME&&(t=l);const c=this.findKeys(t,s);t=c.length>0?c[0]:t;const m=oi.validHeaderValue(r);let p=this.headers.get(t);p||(p=[],this.headers.set(t,p)),p.push(m)}values(t,r=ln.Exact){const s=[];return this.findKeys(t,r).forEach(c=>{const m=this.headers.get(c);m&&s.push(...m)}),s}delete(t,r=ln.Exact){this.findKeys(t,r).forEach(l=>{this.headers.delete(l)})}get hasError(){return this._code>=300}get status(){return`${this._code} ${this._description}`.trim()}toRecord(){const t={};return this.keys().forEach(r=>{t[r]=this.values(r)}),t}get code(){return this._code}get description(){return this._description}static fromRecord(t){const r=new oi;for(const s in t)r.headers.set(s,t[s]);return r}}function Qh(){return{encode(i){return Hi.encode(i)},decode(i){return un.decode(i)}}}function $n(i){return{encode(t){try{return t===void 0&&(t=null),Hi.encode(JSON.stringify(t))}catch(r){throw me.errorForCode(ce.BadJson,r)}},decode(t){try{return JSON.parse(un.decode(t),i)}catch(r){throw me.errorForCode(ce.BadJson,r)}}}}function pb(i){var t;return i&&i.data.length===0&&((t=i.headers)==null?void 0:t.code)===503?me.errorForCode(ce.NoResponders):null}class jd{constructor(t,r,s){A(this,"_headers");A(this,"_msg");A(this,"_rdata");A(this,"_reply");A(this,"_subject");A(this,"publisher");this._msg=t,this._rdata=r,this.publisher=s}get subject(){return this._subject?this._subject:(this._subject=un.decode(this._msg.subject),this._subject)}get reply(){return this._reply?this._reply:(this._reply=un.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=oi.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=hn,r){return this.reply?(this.publisher.publish(this.reply,t,r),!0):!1}size(){var l;const t=this._msg.subject.length,r=((l=this._msg.reply)==null?void 0:l.length)||0,s=this._msg.size===-1?0:this._msg.size;return t+r+s}json(t){return $n(t).decode(this.data)}string(){return un.decode(this.data)}requestInfo(){var r;const t=(r=this.headers)==null?void 0:r.get("Nats-Request-Info");return t?JSON.parse(t,function(s,l){return(s==="start"||s==="stop")&&l!==""?new Date(Date.parse(l)):l}):null}}A(jd,"jc");function Us(i){return cu("durable",i)}function Pt(i){return cu("stream",i)}function cu(i,t=""){if(t==="")throw Error(`${i} name required`);return[".","*",">","/","\\"," "," ",`
31
+ `,"\r"].forEach(s=>{if(t.indexOf(s)!==-1){switch(s){case`
32
+ `:s="\\n";break;case"\r":s="\\r";break;case" ":s="\\t";break}throw Error(`invalid ${i} name - ${i} name cannot contain '${s}'`)}}),""}function no(i,t=""){if(t==="")throw Error(`${i} name required`);const r=Qw(t);if(r.length)throw new Error(`invalid ${i} name - ${i} name ${r}`)}function Qw(i=""){if(i==="")throw Error("name required");const t=/^[-\w]+$/g;if(i.match(t)===null){for(const s of i.split(""))if(s.match(t)===null)return`cannot contain '${s}'`}return""}function Zh(i){if(i.data.length>0)return!1;const t=i.headers;return t?t.code>=100&&t.code<200:!1}function Wh(i){var t;return Zh(i)&&((t=i.headers)==null?void 0:t.description)==="Idle Heartbeat"}function Zw(i,t,r){const s=Sr(i,t),l={hdr:1,sid:0,size:0},c=new jd(l,hn,{});return c._headers=s,c._subject=r,c}function Ps(i){if(i.data.length!==0)return null;const t=i.headers;return t?gb(t.code,t.description):null}var Nn;(function(i){i.MaxBatchExceeded="exceeded maxrequestbatch of",i.MaxExpiresExceeded="exceeded maxrequestexpires of",i.MaxBytesExceeded="exceeded maxrequestmaxbytes of",i.MaxMessageSizeExceeded="message size exceeds maxbytes",i.PushConsumer="consumer is push based",i.MaxWaitingExceeded="exceeded maxwaiting",i.IdleHeartbeatMissed="idle heartbeats missed",i.ConsumerDeleted="consumer deleted"})(Nn||(Nn={}));function Ww(i){return i.code!==ce.JetStream409?!1:[Nn.MaxBatchExceeded,Nn.MaxExpiresExceeded,Nn.MaxBytesExceeded,Nn.MaxMessageSizeExceeded,Nn.PushConsumer,Nn.IdleHeartbeatMissed,Nn.ConsumerDeleted].find(r=>i.message.indexOf(r)!==-1)!==void 0}function gb(i,t=""){if(i<300)return null;switch(t=t.toLowerCase(),i){case 404:return new me(t,ce.JetStream404NoMessages);case 408:return new me(t,ce.JetStream408RequestTimeout);case 409:{const r=t.startsWith(Nn.IdleHeartbeatMissed)?ce.JetStreamIdleHeartBeat:ce.JetStream409;return new me(t,r)}case 503:return me.errorForCode(ce.JetStreamNotEnabled,new Error(t));default:return t===""&&(t=ce.Unknown),new me(t,`${i}`)}}class jt{constructor(){A(this,"inflight");A(this,"processed");A(this,"received");A(this,"noIterator");A(this,"iterClosed");A(this,"done");A(this,"signal");A(this,"yields");A(this,"filtered");A(this,"pendingFiltered");A(this,"ingestionFilterFn");A(this,"protocolFilterFn");A(this,"dispatchedFn");A(this,"ctx");A(this,"_data");A(this,"err");A(this,"time");A(this,"yielding");this.inflight=0,this.filtered=0,this.pendingFiltered=0,this.processed=0,this.received=0,this.noIterator=!1,this.done=!1,this.signal=st(),this.yields=[],this.iterClosed=st(),this.time=0,this.yielding=!1}[Symbol.asyncIterator](){return this.iterate()}push(t){if(this.done)return;if(typeof t=="function"){this.yields.push(t),this.signal.resolve();return}const{ingest:r,protocol:s}=this.ingestionFilterFn?this.ingestionFilterFn(t,this.ctx||this):{ingest:!0,protocol:!1};r&&(s&&(this.filtered++,this.pendingFiltered++),this.yields.push(t),this.signal.resolve())}async*iterate(){if(this.noIterator)throw new me("unsupported iterator",ce.ApiError);if(this.yielding)throw new me("already yielding",ce.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 r=0;r<t.length;r++){if(typeof t[r]=="function"){const l=t[r];try{l()}catch(c){throw c}if(this.err)throw this.err;continue}if(this.protocolFilterFn?this.protocolFilterFn(t[r]):!0){this.processed++;const l=Date.now();yield t[r],this.time=Date.now()-l,this.dispatchedFn&&t[r]&&this.dispatchedFn(t[r])}else this.pendingFiltered--;this.inflight--}if(this.done)break;this.yields.length===0&&(t.length=0,this.yields=t,this.signal=st())}}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 Td{constructor(t,r,s={maxOut:2}){A(this,"interval");A(this,"maxOut");A(this,"cancelAfter");A(this,"timer");A(this,"autoCancelTimer");A(this,"last");A(this,"missed");A(this,"count");A(this,"callback");this.interval=t,this.maxOut=(s==null?void 0:s.maxOut)||2,this.cancelAfter=(s==null?void 0:s.cancelAfter)||0,this.last=Date.now(),this.missed=0,this.count=0,this.callback=r,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,r=0,s=2){this.interval=t,this.maxOut=s,this.cancelAfter=r,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 ed;(function(i){i.Limits="limits",i.Interest="interest",i.Workqueue="workqueue"})(ed||(ed={}));var uo;(function(i){i.Old="old",i.New="new"})(uo||(uo={}));var td;(function(i){i.File="file",i.Memory="memory"})(td||(td={}));var mt;(function(i){i.All="all",i.Last="last",i.New="new",i.StartSequence="by_start_sequence",i.StartTime="by_start_time",i.LastPerSubject="last_per_subject"})(mt||(mt={}));var At;(function(i){i.None="none",i.All="all",i.Explicit="explicit",i.NotSet=""})(At||(At={}));var Fs;(function(i){i.Instant="instant",i.Original="original"})(Fs||(Fs={}));var hi;(function(i){i.None="none",i.S2="s2"})(hi||(hi={}));var Qc;(function(i){i.CreateOrUpdate="",i.Update="update",i.Create="create"})(Qc||(Qc={}));function eS(i,t={}){return Object.assign({name:i,deliver_policy:mt.All,ack_policy:At.Explicit,ack_wait:it(30*1e3),replay_policy:Fs.Instant},t)}var ry;(function(i){i.API="api_audit",i.StreamAction="stream_action",i.ConsumerAction="consumer_action",i.SnapshotCreate="snapshot_create",i.SnapshotComplete="snapshot_complete",i.RestoreCreate="restore_create",i.RestoreComplete="restore_complete",i.MaxDeliver="max_deliver",i.Terminated="terminated",i.Ack="consumer_ack",i.StreamLeaderElected="stream_leader_elected",i.StreamQuorumLost="stream_quorum_lost",i.ConsumerLeaderElected="consumer_leader_elected",i.ConsumerQuorumLost="consumer_quorum_lost"})(ry||(ry={}));var $t;(function(i){i.StreamSourceHdr="Nats-Stream-Source",i.LastConsumerSeqHdr="Nats-Last-Consumer",i.LastStreamSeqHdr="Nats-Last-Stream",i.ConsumerStalledHdr="Nats-Consumer-Stalled",i.MessageSizeHdr="Nats-Msg-Size",i.RollupHdr="Nats-Rollup",i.RollupValueSubject="sub",i.RollupValueAll="all",i.PendingMessagesHdr="Nats-Pending-Messages",i.PendingBytesHdr="Nats-Pending-Bytes"})($t||($t={}));var Un;(function(i){i.LastValue="",i.AllHistory="history",i.UpdatesOnly="updates"})(Un||(Un={}));var Bs;(function(i){i.Stream="Nats-Stream",i.Sequence="Nats-Sequence",i.TimeStamp="Nats-Time-Stamp",i.Subject="Nats-Subject"})(Bs||(Bs={}));var iy;(function(i){i.Stream="Nats-Stream",i.Subject="Nats-Subject",i.Sequence="Nats-Sequence",i.LastSequence="Nats-Last-Sequence",i.Size="Nats-Msg-Size"})(iy||(iy={}));const cn="KV_";class tS{constructor(t){A(this,"config");A(this,"ordered");A(this,"mack");A(this,"stream");A(this,"callbackFn");A(this,"max");A(this,"qname");A(this,"isBind");A(this,"filters");this.stream="",this.mack=!1,this.ordered=!1,this.config=eS("",t||{})}getOpts(){var r;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&&((r=t.config.filter_subjects)==null||r.forEach(s=>{this.filterSubject(s)}),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?At.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 Us(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=mt.StartSequence,this.config.opt_start_seq=t,this}startTime(t){return this.config.deliver_policy=mt.StartTime,this.config.opt_start_time=t.toISOString(),this}deliverAll(){return this.config.deliver_policy=mt.All,this}deliverLastPerSubject(){return this.config.deliver_policy=mt.LastPerSubject,this}deliverLast(){return this.config.deliver_policy=mt.Last,this}deliverNew(){return this.config.deliver_policy=mt.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=At.None,this}ackAll(){return this.config.ack_policy=At.All,this}ackExplicit(){return this.config.ack_policy=At.Explicit,this}ackWait(t){return this.config.ack_wait=it(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=Fs.Instant,this}replayOriginal(){return this.config.replay_policy=Fs.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=it(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,r){return this.stream=t,this.config.durable_name=r,this.isBind=!0,this}bindStream(t){return this.stream=t,this}inactiveEphemeralThreshold(t){return this.config.inactive_threshold=it(t),this}maxPullBatch(t){return this.config.max_batch=t,this}maxPullRequestExpires(t){return this.config.max_expires=it(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 li(i){return new tS(i)}function sy(i){return typeof i.getOpts=="function"}class nS{static encode(t){if(typeof t=="string")return btoa(t);const r=Array.from(t);return btoa(String.fromCharCode(...r))}static decode(t,r=!1){const s=atob(t);return r?Uint8Array.from(s,l=>l.charCodeAt(0)):s}}class Is{static encode(t){return Is.toB64URLEncoding(nS.encode(t))}static decode(t,r=!1){return Is.decode(Is.fromB64URLEncoding(t),r)}static toB64URLEncoding(t){return t.replace(/\+/g,"-").replace(/\//g,"_")}static fromB64URLEncoding(t){return t.replace(/_/g,"/").replace(/-/g,"+")}}class Vs{constructor(){A(this,"buffers");A(this,"byteLength");this.buffers=[],this.byteLength=0}static concat(...t){let r=0;for(let c=0;c<t.length;c++)r+=t[c].length;const s=new Uint8Array(r);let l=0;for(let c=0;c<t.length;c++)s.set(t[c],l),l+=t[c].length;return s}static fromAscii(t){return t||(t=""),Hi.encode(t)}static toAscii(t){return un.decode(t)}reset(){this.buffers.length=0,this.byteLength=0}pack(){if(this.buffers.length>1){const t=new Uint8Array(this.byteLength);let r=0;for(let s=0;s<this.buffers.length;s++)t.set(this.buffers[s],r),r+=this.buffers[s].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 r=this.buffers.pop();if(r){const s=this.byteLength;(t===void 0||t>s)&&(t=s);const l=r.subarray(0,t);return s>t&&this.buffers.push(r.subarray(t)),this.byteLength=s-t,l}}return new Uint8Array(0)}fill(t,...r){t&&(this.buffers.push(t),this.byteLength+=t.length);for(let s=0;s<r.length;s++)r[s]&&r[s].length&&(this.buffers.push(r[s]),this.byteLength+=r[s].length)}peek(){return this.buffers.length?(this.pack(),this.buffers[0]):new Uint8Array(0)}size(){return this.byteLength}length(){return this.buffers.length}}function rS(i,t){return t.forEach(function(r){r&&typeof r!="string"&&!Array.isArray(r)&&Object.keys(r).forEach(function(s){if(s!=="default"&&!(s in i)){var l=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(i,s,l.get?l:{enumerable:!0,get:function(){return r[s]}})}})}),Object.freeze(i)}var iS=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},Fa=iS.performance||{};Fa.now||Fa.mozNow||Fa.msNow||Fa.oNow||Fa.webkitNow;var ay={versions:{}},sS=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function aS(i){if(i.__esModule)return i;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(i).forEach(function(r){var s=Object.getOwnPropertyDescriptor(i,r);Object.defineProperty(t,r,s.get?s:{enumerable:!0,get:function(){return i[r]}})}),t}var Rh,uu={exports:{}},oy={},ly=aS(rS({__proto__:null,default:oy},[oy]));Rh=uu,(function(){var i="input is invalid type",t=typeof window=="object",r=t?window:{};r.JS_SHA256_NO_WINDOW&&(t=!1);var s=!t&&typeof self=="object",l=!r.JS_SHA256_NO_NODE_JS&&ay.versions&&ay.versions.node;l?r=sS:s&&(r=self);var c=!r.JS_SHA256_NO_COMMON_JS&&Rh.exports,m=!r.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",p="0123456789abcdef".split(""),g=[-2147483648,8388608,32768,128],f=[24,16,8,0],d=[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"],v=[];!r.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(C){return Object.prototype.toString.call(C)==="[object Array]"}),!m||!r.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(C){return typeof C=="object"&&C.buffer&&C.buffer.constructor===ArrayBuffer});var _=function(C,I){return function(re){return new z(I,!0).update(re)[C]()}},w=function(C){var I=_("hex",C);l&&(I=S(I,C)),I.create=function(){return new z(C)},I.update=function(B){return I.create().update(B)};for(var re=0;re<b.length;++re){var K=b[re];I[K]=_(K,C)}return I},S=function(C,I){var re,K=ly,B=ly.Buffer,G=I?"sha224":"sha256";return re=B.from&&!r.JS_SHA256_NO_BUFFER_FROM?B.from:function(W){return new B(W)},function(W){if(typeof W=="string")return K.createHash(G).update(W,"utf8").digest("hex");if(W==null)throw new Error(i);return W.constructor===ArrayBuffer&&(W=new Uint8Array(W)),Array.isArray(W)||ArrayBuffer.isView(W)||W.constructor===B?K.createHash(G).update(re(W)).digest("hex"):C(W)}},M=function(C,I){return function(re,K){return new ie(re,I,!0).update(K)[C]()}},L=function(C){var I=M("hex",C);I.create=function(B){return new ie(B,C)},I.update=function(B,G){return I.create(B).update(G)};for(var re=0;re<b.length;++re){var K=b[re];I[K]=M(K,C)}return I};function z(C,I){I?(v[0]=v[16]=v[1]=v[2]=v[3]=v[4]=v[5]=v[6]=v[7]=v[8]=v[9]=v[10]=v[11]=v[12]=v[13]=v[14]=v[15]=0,this.blocks=v):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],C?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=C}function ie(C,I,re){var K,B=typeof C;if(B==="string"){var G,W=[],Q=C.length,he=0;for(K=0;K<Q;++K)(G=C.charCodeAt(K))<128?W[he++]=G:G<2048?(W[he++]=192|G>>>6,W[he++]=128|63&G):G<55296||G>=57344?(W[he++]=224|G>>>12,W[he++]=128|G>>>6&63,W[he++]=128|63&G):(G=65536+((1023&G)<<10|1023&C.charCodeAt(++K)),W[he++]=240|G>>>18,W[he++]=128|G>>>12&63,W[he++]=128|G>>>6&63,W[he++]=128|63&G);C=W}else{if(B!=="object")throw new Error(i);if(C===null)throw new Error(i);if(m&&C.constructor===ArrayBuffer)C=new Uint8Array(C);else if(!(Array.isArray(C)||m&&ArrayBuffer.isView(C)))throw new Error(i)}C.length>64&&(C=new z(I,!0).update(C).array());var _e=[],Te=[];for(K=0;K<64;++K){var Y=C[K]||0;_e[K]=92^Y,Te[K]=54^Y}z.call(this,I,re),this.update(Te),this.oKeyPad=_e,this.inner=!0,this.sharedMemory=re}z.prototype.update=function(C){if(!this.finalized){var I,re=typeof C;if(re!=="string"){if(re!=="object")throw new Error(i);if(C===null)throw new Error(i);if(m&&C.constructor===ArrayBuffer)C=new Uint8Array(C);else if(!(Array.isArray(C)||m&&ArrayBuffer.isView(C)))throw new Error(i);I=!0}for(var K,B,G=0,W=C.length,Q=this.blocks;G<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),I)for(B=this.start;G<W&&B<64;++G)Q[B>>>2]|=C[G]<<f[3&B++];else for(B=this.start;G<W&&B<64;++G)(K=C.charCodeAt(G))<128?Q[B>>>2]|=K<<f[3&B++]:K<2048?(Q[B>>>2]|=(192|K>>>6)<<f[3&B++],Q[B>>>2]|=(128|63&K)<<f[3&B++]):K<55296||K>=57344?(Q[B>>>2]|=(224|K>>>12)<<f[3&B++],Q[B>>>2]|=(128|K>>>6&63)<<f[3&B++],Q[B>>>2]|=(128|63&K)<<f[3&B++]):(K=65536+((1023&K)<<10|1023&C.charCodeAt(++G)),Q[B>>>2]|=(240|K>>>18)<<f[3&B++],Q[B>>>2]|=(128|K>>>12&63)<<f[3&B++],Q[B>>>2]|=(128|K>>>6&63)<<f[3&B++],Q[B>>>2]|=(128|63&K)<<f[3&B++]);this.lastByteIndex=B,this.bytes+=B-this.start,B>=64?(this.block=Q[16],this.start=B-64,this.hash(),this.hashed=!0):this.start=B}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},z.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var C=this.blocks,I=this.lastByteIndex;C[16]=this.block,C[I>>>2]|=g[3&I],this.block=C[16],I>=56&&(this.hashed||this.hash(),C[0]=this.block,C[16]=C[1]=C[2]=C[3]=C[4]=C[5]=C[6]=C[7]=C[8]=C[9]=C[10]=C[11]=C[12]=C[13]=C[14]=C[15]=0),C[14]=this.hBytes<<3|this.bytes>>>29,C[15]=this.bytes<<3,this.hash()}},z.prototype.hash=function(){var C,I,re,K,B,G,W,Q,he,_e=this.h0,Te=this.h1,Y=this.h2,oe=this.h3,de=this.h4,Oe=this.h5,le=this.h6,je=this.h7,Se=this.blocks;for(C=16;C<64;++C)I=((B=Se[C-15])>>>7|B<<25)^(B>>>18|B<<14)^B>>>3,re=((B=Se[C-2])>>>17|B<<15)^(B>>>19|B<<13)^B>>>10,Se[C]=Se[C-16]+I+Se[C-7]+re|0;for(he=Te&Y,C=0;C<64;C+=4)this.first?(this.is224?(G=300032,je=(B=Se[0]-1413257819)-150054599|0,oe=B+24177077|0):(G=704751109,je=(B=Se[0]-210244248)-1521486534|0,oe=B+143694565|0),this.first=!1):(I=(_e>>>2|_e<<30)^(_e>>>13|_e<<19)^(_e>>>22|_e<<10),K=(G=_e&Te)^_e&Y^he,je=oe+(B=je+(re=(de>>>6|de<<26)^(de>>>11|de<<21)^(de>>>25|de<<7))+(de&Oe^~de&le)+d[C]+Se[C])|0,oe=B+(I+K)|0),I=(oe>>>2|oe<<30)^(oe>>>13|oe<<19)^(oe>>>22|oe<<10),K=(W=oe&_e)^oe&Te^G,le=Y+(B=le+(re=(je>>>6|je<<26)^(je>>>11|je<<21)^(je>>>25|je<<7))+(je&de^~je&Oe)+d[C+1]+Se[C+1])|0,I=((Y=B+(I+K)|0)>>>2|Y<<30)^(Y>>>13|Y<<19)^(Y>>>22|Y<<10),K=(Q=Y&oe)^Y&_e^W,Oe=Te+(B=Oe+(re=(le>>>6|le<<26)^(le>>>11|le<<21)^(le>>>25|le<<7))+(le&je^~le&de)+d[C+2]+Se[C+2])|0,I=((Te=B+(I+K)|0)>>>2|Te<<30)^(Te>>>13|Te<<19)^(Te>>>22|Te<<10),K=(he=Te&Y)^Te&oe^Q,de=_e+(B=de+(re=(Oe>>>6|Oe<<26)^(Oe>>>11|Oe<<21)^(Oe>>>25|Oe<<7))+(Oe&le^~Oe&je)+d[C+3]+Se[C+3])|0,_e=B+(I+K)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+_e|0,this.h1=this.h1+Te|0,this.h2=this.h2+Y|0,this.h3=this.h3+oe|0,this.h4=this.h4+de|0,this.h5=this.h5+Oe|0,this.h6=this.h6+le|0,this.h7=this.h7+je|0},z.prototype.hex=function(){this.finalize();var C=this.h0,I=this.h1,re=this.h2,K=this.h3,B=this.h4,G=this.h5,W=this.h6,Q=this.h7,he=p[C>>>28&15]+p[C>>>24&15]+p[C>>>20&15]+p[C>>>16&15]+p[C>>>12&15]+p[C>>>8&15]+p[C>>>4&15]+p[15&C]+p[I>>>28&15]+p[I>>>24&15]+p[I>>>20&15]+p[I>>>16&15]+p[I>>>12&15]+p[I>>>8&15]+p[I>>>4&15]+p[15&I]+p[re>>>28&15]+p[re>>>24&15]+p[re>>>20&15]+p[re>>>16&15]+p[re>>>12&15]+p[re>>>8&15]+p[re>>>4&15]+p[15&re]+p[K>>>28&15]+p[K>>>24&15]+p[K>>>20&15]+p[K>>>16&15]+p[K>>>12&15]+p[K>>>8&15]+p[K>>>4&15]+p[15&K]+p[B>>>28&15]+p[B>>>24&15]+p[B>>>20&15]+p[B>>>16&15]+p[B>>>12&15]+p[B>>>8&15]+p[B>>>4&15]+p[15&B]+p[G>>>28&15]+p[G>>>24&15]+p[G>>>20&15]+p[G>>>16&15]+p[G>>>12&15]+p[G>>>8&15]+p[G>>>4&15]+p[15&G]+p[W>>>28&15]+p[W>>>24&15]+p[W>>>20&15]+p[W>>>16&15]+p[W>>>12&15]+p[W>>>8&15]+p[W>>>4&15]+p[15&W];return this.is224||(he+=p[Q>>>28&15]+p[Q>>>24&15]+p[Q>>>20&15]+p[Q>>>16&15]+p[Q>>>12&15]+p[Q>>>8&15]+p[Q>>>4&15]+p[15&Q]),he},z.prototype.toString=z.prototype.hex,z.prototype.digest=function(){this.finalize();var C=this.h0,I=this.h1,re=this.h2,K=this.h3,B=this.h4,G=this.h5,W=this.h6,Q=this.h7,he=[C>>>24&255,C>>>16&255,C>>>8&255,255&C,I>>>24&255,I>>>16&255,I>>>8&255,255&I,re>>>24&255,re>>>16&255,re>>>8&255,255&re,K>>>24&255,K>>>16&255,K>>>8&255,255&K,B>>>24&255,B>>>16&255,B>>>8&255,255&B,G>>>24&255,G>>>16&255,G>>>8&255,255&G,W>>>24&255,W>>>16&255,W>>>8&255,255&W];return this.is224||he.push(Q>>>24&255,Q>>>16&255,Q>>>8&255,255&Q),he},z.prototype.array=z.prototype.digest,z.prototype.arrayBuffer=function(){this.finalize();var C=new ArrayBuffer(this.is224?28:32),I=new DataView(C);return I.setUint32(0,this.h0),I.setUint32(4,this.h1),I.setUint32(8,this.h2),I.setUint32(12,this.h3),I.setUint32(16,this.h4),I.setUint32(20,this.h5),I.setUint32(24,this.h6),this.is224||I.setUint32(28,this.h7),C},ie.prototype=new z,ie.prototype.finalize=function(){if(z.prototype.finalize.call(this),this.inner){this.inner=!1;var C=this.array();z.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(C),z.prototype.finalize.call(this)}};var ae=w();ae.sha256=ae,ae.sha224=w(!0),ae.sha256.hmac=L(),ae.sha224.hmac=L(!0),c?Rh.exports=ae:(r.sha256=ae.sha256,r.sha224=ae.sha224)})();uu.exports;uu.exports.sha224;var cy=uu.exports.sha256;function nd(i){return hS(i)}function oS(i){if(!/^[0-9A-Fa-f]+$/.test(i))return!1;const r=/^[0-9A-F]+$/.test(i),s=/^[0-9a-f]+$/.test(i);return r||s?i.length%2===0:!1}function lS(i){return/^[A-Za-z0-9\-_]*(={0,2})?$/.test(i)||/^[A-Za-z0-9+/]*(={0,2})?$/.test(i)}function cS(i){return oS(i)?"hex":lS(i)?"b64":""}function uS(i){if(i.length%2!==0)throw new Error("hex string must have an even length");const t=new Uint8Array(i.length/2);for(let r=0;r<i.length;r+=2)t[r/2]=parseInt(i.substring(r,r+2),16);return t}function fS(i){i=i.replace(/-/g,"+"),i=i.replace(/_/g,"/");const t=atob(i);return Uint8Array.from(t,r=>r.charCodeAt(0))}function hS(i){switch(cS(i)){case"hex":return uS(i);case"b64":return fS(i)}return null}function dS(i,t){const r=typeof i=="string"?nd(i):i,s=typeof t=="string"?nd(t):t;if(r===null||s===null||r.length!==s.length)return!1;for(let l=0;l<r.length;l++)if(r[l]!==s[l])return!1;return!0}class yb{constructor(t,r,s=!0){A(this,"token");A(this,"received");A(this,"ctx");A(this,"requestSubject");A(this,"mux");this.mux=t,this.requestSubject=r,this.received=0,this.token=fi.next(),s&&(this.ctx=new Error)}}class mS extends yb{constructor(r,s,l={maxWait:1e3}){super(r,s);A(this,"callback");A(this,"done");A(this,"timer");A(this,"max");A(this,"opts");if(this.opts=l,typeof this.opts.callback!="function")throw new Error("callback is required");this.callback=this.opts.callback,this.max=typeof l.maxMessages=="number"&&l.maxMessages>0?l.maxMessages:-1,this.done=st(),this.done.then(()=>{this.callback(null,null)}),this.timer=setTimeout(()=>{this.cancel()},l.maxWait)}cancel(r){r&&this.callback(r,null),clearTimeout(this.timer),this.mux.cancel(this),this.done.resolve()}resolver(r,s){r?(this.ctx&&(r.stack+=`
33
+
34
+ ${this.ctx.stack}`),this.cancel(r)):(this.callback(null,s),this.opts.strategy===In.Count&&(this.max--,this.max===0&&this.cancel()),this.opts.strategy===In.JitterTimer&&(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.cancel()},this.opts.jitter||300)),this.opts.strategy===In.SentinelMsg&&s&&s.data.length===0&&this.cancel())}}class bb extends yb{constructor(r,s,l={timeout:1e3},c=!0){super(r,s,c);A(this,"deferred");A(this,"timer");this.deferred=st(),this.timer=Gs(l.timeout,c)}resolver(r,s){this.timer&&this.timer.cancel(),r?(this.ctx&&(r.stack+=`
35
+
36
+ ${this.ctx.stack}`),this.deferred.reject(r)):this.deferred.resolve(s),this.cancel()}cancel(r){this.timer&&this.timer.cancel(),this.mux.cancel(this),this.deferred.reject(r||me.errorForCode(ce.Cancelled))}}const pS="$JS.API";function gS(i){return i=i||{},i.domain&&(i.apiPrefix=`$JS.${i.domain}.API`,delete i.domain),lu({apiPrefix:pS,timeout:5e3},i)}class yo{constructor(t,r){A(this,"nc");A(this,"opts");A(this,"prefix");A(this,"timeout");A(this,"jc");this.nc=t,this.opts=gS(r),this._parseOpts(),this.prefix=this.opts.apiPrefix,this.timeout=this.opts.timeout,this.jc=$n()}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,r=null,s){s=s||{},s.timeout=this.timeout;let l=hn;r&&(l=this.jc.encode(r));let{retries:c}=s;c=c||1,c=c===-1?Number.MAX_SAFE_INTEGER:c;const m=Od();for(let p=0;p<c;p++)try{const g=await this.nc.request(t,l,s);return this.parseJsResponse(g)}catch(g){const f=g;if((f.code==="503"||f.code===ce.Timeout)&&p+1<c)await Ys(m.backoff(p));else throw g}}async findStream(t){const r={subject:t},l=await this._request(`${this.prefix}.STREAM.NAMES`,r);if(!l.streams||l.streams.length!==1)throw new Error("no stream matches subject");return l.streams[0]}getConnection(){return this.nc}parseJsResponse(t){const r=this.jc.decode(t.data),s=r;if(s.error){const l=gb(s.error.code,s.error.description);if(l!==null)throw l.api_error=s.error,l}return r}}class ro{constructor(t,r,s,l){A(this,"err");A(this,"offset");A(this,"pageInfo");A(this,"subject");A(this,"jsm");A(this,"filter");A(this,"payload");if(!t)throw new Error("subject is required");this.subject=t,this.jsm=s,this.offset=0,this.pageInfo={},this.filter=r,this.payload=l||{}}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 r=await this.jsm._request(this.subject,t,{timeout:this.jsm.timeout});this.pageInfo=r;const s=this.countResponse(r);return s===0?[]:(this.offset+=s,this.filter(r))}catch(r){throw this.err=r,r}}countResponse(t){var r,s,l;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((r=t.streams)==null?void 0:r.length)||0;case"io.nats.jetstream.api.v1.consumer_list_response":return((s=t.consumers)==null?void 0:s.length)||0;default:return console.error(`jslister.ts: unknown API response for paged output: ${t==null?void 0:t.type}`),((l=t.streams)==null?void 0:l.length)||0}return 0}async*[Symbol.asyncIterator](){let t=await this.next();for(;t.length>0;){for(const r of t)yield r;t=await this.next()}}}function $i(i=""){const t=i.match(/(\d+).(\d+).(\d+)/);if(t)return{major:parseInt(t[1]),minor:parseInt(t[2]),micro:parseInt(t[3])};throw new Error(`'${i}' is not a semver value`)}function rd(i,t){return i.major<t.major?-1:i.major>t.major?1:i.minor<t.minor?-1:i.minor>t.minor?1:i.micro<t.micro?-1:i.micro>t.micro?1:0}var Ie;(function(i){i.JS_KV="js_kv",i.JS_OBJECTSTORE="js_objectstore",i.JS_PULL_MAX_BYTES="js_pull_max_bytes",i.JS_NEW_CONSUMER_CREATE_API="js_new_consumer_create",i.JS_ALLOW_DIRECT="js_allow_direct",i.JS_MULTIPLE_CONSUMER_FILTER="js_multiple_consumer_filter",i.JS_SIMPLIFICATION="js_simplification",i.JS_STREAM_CONSUMER_METADATA="js_stream_consumer_metadata",i.JS_CONSUMER_FILTER_SUBJECTS="js_consumer_filter_subjects",i.JS_STREAM_FIRST_SEQ="js_stream_first_seq",i.JS_STREAM_SUBJECT_TRANSFORM="js_stream_subject_transform",i.JS_STREAM_SOURCE_SUBJECT_TRANSFORM="js_stream_source_subject_transform",i.JS_STREAM_COMPRESSION="js_stream_compression",i.JS_DEFAULT_CONSUMER_LIMITS="js_default_consumer_limits",i.JS_BATCH_DIRECT_GET="js_batch_direct_get"})(Ie||(Ie={}));class yS{constructor(t){A(this,"server");A(this,"features");A(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=$i(t)),this.server=t,this.set(Ie.JS_KV,"2.6.2"),this.set(Ie.JS_OBJECTSTORE,"2.6.3"),this.set(Ie.JS_PULL_MAX_BYTES,"2.8.3"),this.set(Ie.JS_NEW_CONSUMER_CREATE_API,"2.9.0"),this.set(Ie.JS_ALLOW_DIRECT,"2.9.0"),this.set(Ie.JS_MULTIPLE_CONSUMER_FILTER,"2.10.0"),this.set(Ie.JS_SIMPLIFICATION,"2.9.4"),this.set(Ie.JS_STREAM_CONSUMER_METADATA,"2.10.0"),this.set(Ie.JS_CONSUMER_FILTER_SUBJECTS,"2.10.0"),this.set(Ie.JS_STREAM_FIRST_SEQ,"2.10.0"),this.set(Ie.JS_STREAM_SUBJECT_TRANSFORM,"2.10.0"),this.set(Ie.JS_STREAM_SOURCE_SUBJECT_TRANSFORM,"2.10.0"),this.set(Ie.JS_STREAM_COMPRESSION,"2.10.0"),this.set(Ie.JS_DEFAULT_CONSUMER_LIMITS,"2.10.0"),this.set(Ie.JS_BATCH_DIRECT_GET,"2.11.0"),this.disabled.forEach(r=>{this.features.delete(r)})}set(t,r){this.features.set(t,{min:r,ok:rd(this.server,$i(r))>=0})}get(t){return this.features.get(t)||{min:"unknown",ok:!1}}supports(t){var r;return((r=this.get(t))==null?void 0:r.ok)||!1}require(t){return typeof t=="string"&&(t=$i(t)),rd(this.server,t)>=0}}class Zc extends yo{constructor(t,r){super(t,r)}async add(t,r,s=Qc.Create){if(Pt(t),r.deliver_group&&r.flow_control)throw new Error("jetstream flow control is not supported with queue groups");if(r.deliver_group&&r.idle_heartbeat)throw new Error("jetstream idle heartbeat is not supported with queue groups");const l={};l.config=r,l.stream_name=t,l.action=s,l.config.durable_name&&Us(l.config.durable_name);const c=this.nc;let{min:m,ok:p}=c.features.get(Ie.JS_NEW_CONSUMER_CREATE_API);const g=r.name===""?void 0:r.name;if(g&&!p)throw new Error(`consumer 'name' requires server ${m}`);if(g)try{cu("name",g)}catch(v){const _=v.message,w=_.indexOf("cannot contain");throw w!==-1?new Error(`consumer 'name' ${_.substring(w)}`):v}let f,d="";if(Array.isArray(r.filter_subjects)){const{min:v,ok:_}=c.features.get(Ie.JS_MULTIPLE_CONSUMER_FILTER);if(!_)throw new Error(`consumer 'filter_subjects' requires server ${v}`);p=!1}if(r.metadata){const{min:v,ok:_}=c.features.get(Ie.JS_STREAM_CONSUMER_METADATA);if(!_)throw new Error(`consumer 'metadata' requires server ${v}`)}if(p&&(d=r.name??r.durable_name??""),d!==""){let v=r.filter_subject??void 0;v===">"&&(v=void 0),f=v!==void 0?`${this.prefix}.CONSUMER.CREATE.${t}.${d}.${v}`:`${this.prefix}.CONSUMER.CREATE.${t}.${d}`}else f=r.durable_name?`${this.prefix}.CONSUMER.DURABLE.CREATE.${t}.${r.durable_name}`:`${this.prefix}.CONSUMER.CREATE.${t}`;return await this._request(f,l)}async update(t,r,s){const l=await this.info(t,r),c=s;return this.add(t,Object.assign(l.config,c),Qc.Update)}async info(t,r){return Pt(t),Us(r),await this._request(`${this.prefix}.CONSUMER.INFO.${t}.${r}`)}async delete(t,r){return Pt(t),Us(r),(await this._request(`${this.prefix}.CONSUMER.DELETE.${t}.${r}`)).success}list(t){Pt(t);const r=l=>l.consumers,s=`${this.prefix}.CONSUMER.LIST.${t}`;return new ro(s,r,this)}pause(t,r,s){const l=`${this.prefix}.CONSUMER.PAUSE.${t}.${r}`,c={pause_until:s.toISOString()};return this._request(l,c)}resume(t,r){return this.pause(t,r,new Date(0))}}function ks(i,t,r=!1){if(r===!0&&!i)throw me.errorForCode(ce.ApiError,new Error(`${t} is not a function`));if(i&&typeof i!="function")throw me.errorForCode(ce.ApiError,new Error(`${t} is not a function`))}class bS extends jt{constructor(r,s,l){super();A(this,"sub");A(this,"adapter");A(this,"subIterDone");ks(l.adapter,"adapter",!0),this.adapter=l.adapter,l.callback&&ks(l.callback,"callback"),this.noIterator=typeof l.callback=="function",l.ingestionFilterFn&&(ks(l.ingestionFilterFn,"ingestionFilterFn"),this.ingestionFilterFn=l.ingestionFilterFn),l.protocolFilterFn&&(ks(l.protocolFilterFn,"protocolFilterFn"),this.protocolFilterFn=l.protocolFilterFn),l.dispatchedFn&&(ks(l.dispatchedFn,"dispatchedFn"),this.dispatchedFn=l.dispatchedFn),l.cleanupFn&&ks(l.cleanupFn,"cleanupFn");let c=(d,b)=>{this.callback(d,b)};if(l.callback){const d=l.callback;c=(b,v)=>{const[_,w]=this.adapter(b,v);if(_){d(_,null);return}const{ingest:S}=this.ingestionFilterFn?this.ingestionFilterFn(w,this):{ingest:!0};S&&(!this.protocolFilterFn||this.protocolFilterFn(w))&&(d(_,w),this.dispatchedFn&&w&&this.dispatchedFn(w))}}const{max:m,queue:p,timeout:g}=l,f={queue:p,timeout:g,callback:c};m&&m>0&&(f.max=m),this.sub=r.subscribe(s,f),l.cleanupFn&&(this.sub.cleanupFn=l.cleanupFn),this.noIterator||this.iterClosed.then(()=>{this.unsubscribe()}),this.subIterDone=st(),Promise.all([this.sub.closed,this.iterClosed]).then(()=>{this.subIterDone.resolve()}).catch(()=>{this.subIterDone.resolve()}),(async d=>{await d.closed,this.stop()})(this.sub).then().catch()}unsubscribe(r){this.sub.unsubscribe(r)}drain(){return this.sub.drain()}isDraining(){return this.sub.isDraining()}isClosed(){return this.sub.isClosed()}callback(r,s){this.sub.cancelTimeout();const[l,c]=this.adapter(r,s);l&&this.stop(l),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 fn;function vS(i){fn=i}function vb(){return fn!==void 0&&fn.defaultPort!==void 0?fn.defaultPort:4222}function Dh(){return fn!==void 0&&fn.urlParseFn?fn.urlParseFn:void 0}function xS(){if(!fn||typeof fn.factory!="function")throw new Error("transport fn is not set");return fn.factory()}function id(){return fn!==void 0&&fn.dnsResolveFn?fn.dnsResolveFn:void 0}const Ic=`\r
37
+ `,Wc=Vs.fromAscii(Ic),_S=new Uint8Array(Wc)[0],wS=new Uint8Array(Wc)[1];function SS(i){for(let t=0;t<i.length;t++){const r=t+1;if(i.byteLength>r&&i[t]===_S&&i[r]===wS)return r+1}return 0}function ES(i){const t=SS(i);if(t>0){const s=new Uint8Array(i).slice(0,t);return un.decode(s)}return""}const OS=4,xb=48,AS=65,jS=97;function TS(i,t,r,s){const l=new Uint8Array(16);return[0,0,0,0,0,0,0,0,0,0,255,255].forEach((m,p)=>{l[p]=m}),l[12]=i,l[13]=t,l[14]=r,l[15]=s,l}function sd(i){return NS(i)!==void 0}function NS(i){for(let t=0;t<i.length;t++)switch(i[t]){case".":return _b(i);case":":return kS(i)}}function _b(i){const t=new Uint8Array(4);for(let r=0;r<4;r++){if(i.length===0)return;if(r>0){if(i[0]!==".")return;i=i.substring(1)}const{n:s,c:l,ok:c}=CS(i);if(!c||s>255)return;i=i.substring(l),t[r]=s}return TS(t[0],t[1],t[2],t[3])}function kS(i){const t=new Uint8Array(16);let r=-1;if(i.length>=2&&i[0]===":"&&i[1]===":"&&(r=0,i=i.substring(2),i.length===0))return t;let s=0;for(;s<16;){const{n:l,c,ok:m}=MS(i);if(!m||l>65535)return;if(c<i.length&&i[c]==="."){if(r<0&&s!=12||s+4>16)return;const p=_b(i);if(p===void 0)return;t[s]=p[12],t[s+1]=p[13],t[s+2]=p[14],t[s+3]=p[15],i="",s+=OS;break}if(t[s]=l>>8,t[s+1]=l,s+=2,i=i.substring(c),i.length===0)break;if(i[0]!==":"||i.length==1)return;if(i=i.substring(1),i[0]===":"){if(r>=0)return;if(r=s,i=i.substring(1),i.length===0)break}}if(i.length===0){if(s<16){if(r<0)return;const l=16-s;for(let c=s-1;c>=r;c--)t[c+l]=t[c];for(let c=r+l-1;c>=r;c--)t[c]=0}else if(r>=0)return;return t}}function CS(i){let t=0,r=0;for(t=0;t<i.length&&48<=i.charCodeAt(t)&&i.charCodeAt(t)<=57;t++)if(r=r*10+(i.charCodeAt(t)-xb),r>=16777215)return{n:16777215,c:t,ok:!1};return t===0?{n:0,c:0,ok:!1}:{n:r,c:t,ok:!0}}function MS(i){let t=0,r=0;for(r=0;r<i.length;r++){if(48<=i.charCodeAt(r)&&i.charCodeAt(r)<=57)t*=16,t+=i.charCodeAt(r)-xb;else if(97<=i.charCodeAt(r)&&i.charCodeAt(r)<=102)t*=16,t+=i.charCodeAt(r)-jS+10;else if(65<=i.charCodeAt(r)&&i.charCodeAt(r)<=70)t*=16,t+=i.charCodeAt(r)-AS+10;else break;if(t>=16777215)return{n:0,c:r,ok:!1}}return r===0?{n:0,c:r,ok:!1}:{n:t,c:r,ok:!0}}function RS(i){return i.indexOf("[")!==-1||i.indexOf("::")!==-1?!1:i.indexOf(".")!==-1||i.split(":").length<=2}function ad(i){return!RS(i)}function DS(i){const t="::FFFF:",r=i.toUpperCase().indexOf(t);if(r!==-1&&i.indexOf(".")!==-1){let s=i.substring(r+t.length);return s=s.replace("[",""),s.replace("]","")}return i}function qS(i){i=i.trim(),i.match(/^(.*:\/\/)(.*)/m)&&(i=i.replace(/^(.*:\/\/)(.*)/gm,"$2")),i=DS(i),ad(i)&&i.indexOf("[")===-1&&(i=`[${i}]`);const t=ad(i)?i.match(/(]:)(\d+)/):i.match(/(:)(\d+)/),r=t&&t.length===3&&t[1]&&t[2]?parseInt(t[2]):4222,s=r===80?"https":"http",l=new URL(`${s}://${i}`);l.port=`${r}`;let c=l.hostname;return c.charAt(0)==="["&&(c=c.substring(1,c.length-1)),{listen:l.host,hostname:c,port:r}}class oo{constructor(t,r=!1){A(this,"src");A(this,"listen");A(this,"hostname");A(this,"port");A(this,"didConnect");A(this,"reconnects");A(this,"lastConnect");A(this,"gossiped");A(this,"tlsName");A(this,"resolves");this.src=t,this.tlsName="";const s=qS(t);this.listen=s.listen,this.hostname=s.hostname,this.port=s.port,this.didConnect=!1,this.reconnects=0,this.lastConnect=0,this.gossiped=r}toString(){return this.listen}async resolve(t){if(!t.fn||t.resolve===!1)return[this];const r=[];if(sd(this.hostname))return[this];{const s=await t.fn(this.hostname);t.debug&&console.log(`resolve ${this.hostname} = ${s.join(",")}`);for(const l of s){const c=this.port===80?"https":"http",m=new URL(`${c}://${ad(l)?"["+l+"]":l}`);m.port=`${this.port}`;const p=new oo(m.host,!1);p.tlsName=this.hostname,r.push(p)}}return t.randomize&&mb(r),this.resolves=r,r}}class BS{constructor(t=[],r={}){A(this,"firstSelect");A(this,"servers");A(this,"currentServer");A(this,"tlsName");A(this,"randomize");this.firstSelect=!0,this.servers=[],this.tlsName="",this.randomize=r.randomize||!1;const s=Dh();t&&(t.forEach(l=>{l=s?s(l):l,this.servers.push(new oo(l))}),this.randomize&&(this.servers=mb(this.servers))),this.servers.length===0&&this.addServer(`${Jh}:${vb()}`,!1),this.currentServer=this.servers[0]}clear(){this.servers.length=0}updateTLSName(){const t=this.getCurrentServer();sd(t.hostname)||(this.tlsName=t.hostname,this.servers.forEach(r=>{r.gossiped&&(r.tlsName=this.tlsName)}))}getCurrentServer(){return this.currentServer}addServer(t,r=!1){const s=Dh();t=s?s(t):t;const l=new oo(t,r);sd(l.hostname)&&(l.tlsName=this.tlsName),this.servers.push(l)}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 r=this.servers.indexOf(t);this.servers.splice(r,1)}}length(){return this.servers.length}next(){return this.servers.length?this.servers[0]:void 0}getServers(){return this.servers}update(t,r){const s=[];let l=[];const c=Dh(),m=new Map;t.connect_urls&&t.connect_urls.length>0&&t.connect_urls.forEach(g=>{g=c?c(g,r):g;const f=new oo(g,!0);m.set(g,f)});const p=[];return this.servers.forEach((g,f)=>{const d=g.listen;g.gossiped&&this.currentServer.listen!==d&&m.get(d)===void 0&&p.push(f),m.delete(d)}),p.reverse(),p.forEach(g=>{const f=this.servers.splice(g,1);l=l.concat(f[0].listen)}),m.forEach((g,f)=>{this.servers.push(g),s.push(f)}),{added:s,deleted:l}}}class LS{constructor(){A(this,"baseInbox");A(this,"reqs");this.reqs=new Map}size(){return this.reqs.size}init(t){return this.baseInbox=`${wr(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 r=t.subject||"";return r.indexOf(this.baseInbox)===0?r.substring(this.baseInbox.length):null}all(){return Array.from(this.reqs.values())}handleError(t,r){if(r&&r.permissionContext){if(t)return this.all().forEach(l=>{l.resolver(r,{})}),!0;const s=r.permissionContext;if(s.operation==="publish"){const l=this.all().find(c=>c.requestSubject===s.subject);if(l)return l.resolver(r,{}),!0}}return!1}dispatcher(){return(t,r)=>{const s=this.getToken(r);if(s){const l=this.get(s);l&&(t===null&&r.headers&&(t=pb(r)),l.resolver(t,r))}}}close(){const t=me.errorForCode(ce.Timeout);this.reqs.forEach(r=>{r.resolver(t,{})})}}class zS{constructor(t,r,s){A(this,"ph");A(this,"interval");A(this,"maxOut");A(this,"timer");A(this,"pendings");this.ph=t,this.interval=r,this.maxOut=s,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:zs.PingTimer,data:`${this.pendings.length+1}`}),this.pendings.length===this.maxOut){this.cancel(!0);return}const t=st();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 US extends Error{constructor(t){super(t),this.name="AssertionError"}}function PS(i,t="Assertion failed."){if(!i)throw new US(t)}const uy=32*1024,qh=2**32-2;function Vl(i,t,r=0){const s=t.byteLength-r;return i.byteLength>s&&(i=i.subarray(0,s)),t.set(i,r),i.byteLength}class Bh{constructor(t){A(this,"_buf");A(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 r=this._buf.byteLength;return t<=this.capacity-r?(this._reslice(r+t),r):-1}_reslice(t){PS(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 r=Vl(this._buf.subarray(this._off),t);return this._off+=r,r}writeByte(t){return this.write(Uint8Array.of(t))}writeString(t){return this.write(Hi.encode(t))}write(t){const r=this._grow(t.byteLength);return Vl(t,this._buf,r)}_grow(t){const r=this.length;r===0&&this._off!==0&&this.reset();const s=this._tryGrowByReslice(t);if(s>=0)return s;const l=this.capacity;if(t<=Math.floor(l/2)-r)Vl(this._buf.subarray(this._off),this._buf);else{if(l+t>qh)throw new Error("The buffer cannot be grown beyond the maximum size.");{const c=new Uint8Array(Math.min(2*l+t,qh));Vl(this._buf.subarray(this._off),c),this._buf=c}}return this._off=0,this._reslice(Math.min(r+t,qh)),r}grow(t){if(t<0)throw Error("Buffer._grow: negative count");const r=this._grow(t);this._reslice(r)}readFrom(t){let r=0;const s=new Uint8Array(uy);for(;;){const l=this.capacity-this.length<uy,c=l?s:new Uint8Array(this._buf.buffer,this.length),m=t.read(c);if(m===null)return r;l?this.write(c.subarray(0,m)):this._reslice(this.length+m),r+=m}}}var It;(function(i){i[i.OK=0]="OK",i[i.ERR=1]="ERR",i[i.MSG=2]="MSG",i[i.INFO=3]="INFO",i[i.PING=4]="PING",i[i.PONG=5]="PONG"})(It||(It={}));function fy(){const i={};return i.sid=-1,i.hdr=-1,i.size=-1,i}const IS=48;class hy{constructor(t){A(this,"dispatcher");A(this,"state");A(this,"as");A(this,"drop");A(this,"hdr");A(this,"ma");A(this,"argBuf");A(this,"msgBuf");this.dispatcher=t,this.state=ue.OP_START,this.as=0,this.drop=0,this.hdr=0}parse(t){let r;for(r=0;r<t.length;r++){const s=t[r];switch(this.state){case ue.OP_START:switch(s){case fe.M:case fe.m:this.state=ue.OP_M,this.hdr=-1,this.ma=fy();break;case fe.H:case fe.h:this.state=ue.OP_H,this.hdr=0,this.ma=fy();break;case fe.P:case fe.p:this.state=ue.OP_P;break;case fe.PLUS:this.state=ue.OP_PLUS;break;case fe.MINUS:this.state=ue.OP_MINUS;break;case fe.I:case fe.i:this.state=ue.OP_I;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_H:switch(s){case fe.M:case fe.m:this.state=ue.OP_M;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_M:switch(s){case fe.S:case fe.s:this.state=ue.OP_MS;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_MS:switch(s){case fe.G:case fe.g:this.state=ue.OP_MSG;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_MSG:switch(s){case fe.SPACE:case fe.TAB:this.state=ue.OP_MSG_SPC;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_MSG_SPC:switch(s){case fe.SPACE:case fe.TAB:continue;default:this.state=ue.MSG_ARG,this.as=r}break;case ue.MSG_ARG:switch(s){case fe.CR:this.drop=1;break;case fe.NL:{const l=this.argBuf?this.argBuf.bytes():t.subarray(this.as,r-this.drop);this.processMsgArgs(l),this.drop=0,this.as=r+1,this.state=ue.MSG_PAYLOAD,r=this.as+this.ma.size-1;break}default:this.argBuf&&this.argBuf.writeByte(s)}break;case ue.MSG_PAYLOAD:if(this.msgBuf)if(this.msgBuf.length>=this.ma.size){const l=this.msgBuf.bytes({copy:!1});this.dispatcher.push({kind:It.MSG,msg:this.ma,data:l}),this.argBuf=void 0,this.msgBuf=void 0,this.state=ue.MSG_END}else{let l=this.ma.size-this.msgBuf.length;const c=t.length-r;c<l&&(l=c),l>0?(this.msgBuf.write(t.subarray(r,r+l)),r=r+l-1):this.msgBuf.writeByte(s)}else r-this.as>=this.ma.size&&(this.dispatcher.push({kind:It.MSG,msg:this.ma,data:t.subarray(this.as,r)}),this.argBuf=void 0,this.msgBuf=void 0,this.state=ue.MSG_END);break;case ue.MSG_END:switch(s){case fe.NL:this.drop=0,this.as=r+1,this.state=ue.OP_START;break;default:continue}break;case ue.OP_PLUS:switch(s){case fe.O:case fe.o:this.state=ue.OP_PLUS_O;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_PLUS_O:switch(s){case fe.K:case fe.k:this.state=ue.OP_PLUS_OK;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_PLUS_OK:switch(s){case fe.NL:this.dispatcher.push({kind:It.OK}),this.drop=0,this.state=ue.OP_START;break}break;case ue.OP_MINUS:switch(s){case fe.E:case fe.e:this.state=ue.OP_MINUS_E;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_MINUS_E:switch(s){case fe.R:case fe.r:this.state=ue.OP_MINUS_ER;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_MINUS_ER:switch(s){case fe.R:case fe.r:this.state=ue.OP_MINUS_ERR;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_MINUS_ERR:switch(s){case fe.SPACE:case fe.TAB:this.state=ue.OP_MINUS_ERR_SPC;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_MINUS_ERR_SPC:switch(s){case fe.SPACE:case fe.TAB:continue;default:this.state=ue.MINUS_ERR_ARG,this.as=r}break;case ue.MINUS_ERR_ARG:switch(s){case fe.CR:this.drop=1;break;case fe.NL:{let l;this.argBuf?(l=this.argBuf.bytes(),this.argBuf=void 0):l=t.subarray(this.as,r-this.drop),this.dispatcher.push({kind:It.ERR,data:l}),this.drop=0,this.as=r+1,this.state=ue.OP_START;break}default:this.argBuf&&this.argBuf.write(Uint8Array.of(s))}break;case ue.OP_P:switch(s){case fe.I:case fe.i:this.state=ue.OP_PI;break;case fe.O:case fe.o:this.state=ue.OP_PO;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_PO:switch(s){case fe.N:case fe.n:this.state=ue.OP_PON;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_PON:switch(s){case fe.G:case fe.g:this.state=ue.OP_PONG;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_PONG:switch(s){case fe.NL:this.dispatcher.push({kind:It.PONG}),this.drop=0,this.state=ue.OP_START;break}break;case ue.OP_PI:switch(s){case fe.N:case fe.n:this.state=ue.OP_PIN;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_PIN:switch(s){case fe.G:case fe.g:this.state=ue.OP_PING;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_PING:switch(s){case fe.NL:this.dispatcher.push({kind:It.PING}),this.drop=0,this.state=ue.OP_START;break}break;case ue.OP_I:switch(s){case fe.N:case fe.n:this.state=ue.OP_IN;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_IN:switch(s){case fe.F:case fe.f:this.state=ue.OP_INF;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_INF:switch(s){case fe.O:case fe.o:this.state=ue.OP_INFO;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_INFO:switch(s){case fe.SPACE:case fe.TAB:this.state=ue.OP_INFO_SPC;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_INFO_SPC:switch(s){case fe.SPACE:case fe.TAB:continue;default:this.state=ue.INFO_ARG,this.as=r}break;case ue.INFO_ARG:switch(s){case fe.CR:this.drop=1;break;case fe.NL:{let l;this.argBuf?(l=this.argBuf.bytes(),this.argBuf=void 0):l=t.subarray(this.as,r-this.drop),this.dispatcher.push({kind:It.INFO,data:l}),this.drop=0,this.as=r+1,this.state=ue.OP_START;break}default:this.argBuf&&this.argBuf.writeByte(s)}break;default:throw this.fail(t.subarray(r))}}(this.state===ue.MSG_ARG||this.state===ue.MINUS_ERR_ARG||this.state===ue.INFO_ARG)&&!this.argBuf&&(this.argBuf=new Bh(t.subarray(this.as,r-this.drop))),this.state===ue.MSG_PAYLOAD&&!this.msgBuf&&(this.argBuf||this.cloneMsgArg(),this.msgBuf=new Bh(t.subarray(this.as)))}cloneMsgArg(){const t=this.ma.subject.length,r=this.ma.reply?this.ma.reply.length:0,s=new Uint8Array(t+r);s.set(this.ma.subject),this.ma.reply&&s.set(this.ma.reply,t),this.argBuf=new Bh(s),this.ma.subject=s.subarray(0,t),this.ma.reply&&(this.ma.reply=s.subarray(t))}processMsgArgs(t){if(this.hdr>=0)return this.processHeaderMsgArgs(t);const r=[];let s=-1;for(let l=0;l<t.length;l++)switch(t[l]){case fe.SPACE:case fe.TAB:case fe.CR:case fe.NL:s>=0&&(r.push(t.subarray(s,l)),s=-1);break;default:s<0&&(s=l)}switch(s>=0&&r.push(t.subarray(s)),r.length){case 3:this.ma.subject=r[0],this.ma.sid=this.protoParseInt(r[1]),this.ma.reply=void 0,this.ma.size=this.protoParseInt(r[2]);break;case 4:this.ma.subject=r[0],this.ma.sid=this.protoParseInt(r[1]),this.ma.reply=r[2],this.ma.size=this.protoParseInt(r[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,r=""){return r?r=`${r} [${this.state}]`:r=`parse error [${this.state}]`,new Error(`${r}: ${un.decode(t)}`)}processHeaderMsgArgs(t){const r=[];let s=-1;for(let l=0;l<t.length;l++)switch(t[l]){case fe.SPACE:case fe.TAB:case fe.CR:case fe.NL:s>=0&&(r.push(t.subarray(s,l)),s=-1);break;default:s<0&&(s=l)}switch(s>=0&&r.push(t.subarray(s)),r.length){case 4:this.ma.subject=r[0],this.ma.sid=this.protoParseInt(r[1]),this.ma.reply=void 0,this.ma.hdr=this.protoParseInt(r[2]),this.ma.size=this.protoParseInt(r[3]);break;case 5:this.ma.subject=r[0],this.ma.sid=this.protoParseInt(r[1]),this.ma.reply=r[2],this.ma.hdr=this.protoParseInt(r[3]),this.ma.size=this.protoParseInt(r[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 r=0;for(let s=0;s<t.length;s++){if(t[s]<48||t[s]>57)return-1;r=r*10+(t[s]-IS)}return r}}var ue;(function(i){i[i.OP_START=0]="OP_START",i[i.OP_PLUS=1]="OP_PLUS",i[i.OP_PLUS_O=2]="OP_PLUS_O",i[i.OP_PLUS_OK=3]="OP_PLUS_OK",i[i.OP_MINUS=4]="OP_MINUS",i[i.OP_MINUS_E=5]="OP_MINUS_E",i[i.OP_MINUS_ER=6]="OP_MINUS_ER",i[i.OP_MINUS_ERR=7]="OP_MINUS_ERR",i[i.OP_MINUS_ERR_SPC=8]="OP_MINUS_ERR_SPC",i[i.MINUS_ERR_ARG=9]="MINUS_ERR_ARG",i[i.OP_M=10]="OP_M",i[i.OP_MS=11]="OP_MS",i[i.OP_MSG=12]="OP_MSG",i[i.OP_MSG_SPC=13]="OP_MSG_SPC",i[i.MSG_ARG=14]="MSG_ARG",i[i.MSG_PAYLOAD=15]="MSG_PAYLOAD",i[i.MSG_END=16]="MSG_END",i[i.OP_H=17]="OP_H",i[i.OP_P=18]="OP_P",i[i.OP_PI=19]="OP_PI",i[i.OP_PIN=20]="OP_PIN",i[i.OP_PING=21]="OP_PING",i[i.OP_PO=22]="OP_PO",i[i.OP_PON=23]="OP_PON",i[i.OP_PONG=24]="OP_PONG",i[i.OP_I=25]="OP_I",i[i.OP_IN=26]="OP_IN",i[i.OP_INF=27]="OP_INF",i[i.OP_INFO=28]="OP_INFO",i[i.OP_INFO_SPC=29]="OP_INFO_SPC",i[i.INFO_ARG=30]="INFO_ARG"})(ue||(ue={}));var fe;(function(i){i[i.CR=13]="CR",i[i.E=69]="E",i[i.e=101]="e",i[i.F=70]="F",i[i.f=102]="f",i[i.G=71]="G",i[i.g=103]="g",i[i.H=72]="H",i[i.h=104]="h",i[i.I=73]="I",i[i.i=105]="i",i[i.K=75]="K",i[i.k=107]="k",i[i.M=77]="M",i[i.m=109]="m",i[i.MINUS=45]="MINUS",i[i.N=78]="N",i[i.n=110]="n",i[i.NL=10]="NL",i[i.O=79]="O",i[i.o=111]="o",i[i.P=80]="P",i[i.p=112]="p",i[i.PLUS=43]="PLUS",i[i.R=82]="R",i[i.r=114]="r",i[i.S=83]="S",i[i.s=115]="s",i[i.SPACE=32]="SPACE",i[i.TAB=9]="TAB"})(fe||(fe={}));(function(i){var t=function(O,N){this.hi=O|0,this.lo=N|0},r=function(O){var N,T=new Float64Array(16);if(O)for(N=0;N<O.length;N++)T[N]=O[N];return T},s=function(){throw new Error("no PRNG")},l=new Uint8Array(16),c=new Uint8Array(32);c[0]=9;var m=r(),p=r([1]),g=r([56129,1]),f=r([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),d=r([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),b=r([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),v=r([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),_=r([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function w(O,N){return O<<N|O>>>32-N}function S(O,N){var T=O[N+3]&255;return T=T<<8|O[N+2]&255,T=T<<8|O[N+1]&255,T<<8|O[N+0]&255}function M(O,N){var T=O[N]<<24|O[N+1]<<16|O[N+2]<<8|O[N+3],k=O[N+4]<<24|O[N+5]<<16|O[N+6]<<8|O[N+7];return new t(T,k)}function L(O,N,T){var k;for(k=0;k<4;k++)O[N+k]=T&255,T>>>=8}function z(O,N,T){O[N]=T.hi>>24&255,O[N+1]=T.hi>>16&255,O[N+2]=T.hi>>8&255,O[N+3]=T.hi&255,O[N+4]=T.lo>>24&255,O[N+5]=T.lo>>16&255,O[N+6]=T.lo>>8&255,O[N+7]=T.lo&255}function ie(O,N,T,k,D){var P,te=0;for(P=0;P<D;P++)te|=O[N+P]^T[k+P];return(1&te-1>>>8)-1}function ae(O,N,T,k){return ie(O,N,T,k,16)}function C(O,N,T,k){return ie(O,N,T,k,32)}function I(O,N,T,k,D){var P=new Uint32Array(16),te=new Uint32Array(16),se=new Uint32Array(16),V=new Uint32Array(4),ee,pe,Re;for(ee=0;ee<4;ee++)te[5*ee]=S(k,4*ee),te[1+ee]=S(T,4*ee),te[6+ee]=S(N,4*ee),te[11+ee]=S(T,16+4*ee);for(ee=0;ee<16;ee++)se[ee]=te[ee];for(ee=0;ee<20;ee++){for(pe=0;pe<4;pe++){for(Re=0;Re<4;Re++)V[Re]=te[(5*pe+4*Re)%16];for(V[1]^=w(V[0]+V[3]|0,7),V[2]^=w(V[1]+V[0]|0,9),V[3]^=w(V[2]+V[1]|0,13),V[0]^=w(V[3]+V[2]|0,18),Re=0;Re<4;Re++)P[4*pe+(pe+Re)%4]=V[Re]}for(Re=0;Re<16;Re++)te[Re]=P[Re]}if(D){for(ee=0;ee<16;ee++)te[ee]=te[ee]+se[ee]|0;for(ee=0;ee<4;ee++)te[5*ee]=te[5*ee]-S(k,4*ee)|0,te[6+ee]=te[6+ee]-S(N,4*ee)|0;for(ee=0;ee<4;ee++)L(O,4*ee,te[5*ee]),L(O,16+4*ee,te[6+ee])}else for(ee=0;ee<16;ee++)L(O,4*ee,te[ee]+se[ee]|0)}function re(O,N,T,k){return I(O,N,T,k,!1),0}function K(O,N,T,k){return I(O,N,T,k,!0),0}var B=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function G(O,N,T,k,D,P,te){var se=new Uint8Array(16),V=new Uint8Array(64),ee,pe;if(!D)return 0;for(pe=0;pe<16;pe++)se[pe]=0;for(pe=0;pe<8;pe++)se[pe]=P[pe];for(;D>=64;){for(re(V,se,te,B),pe=0;pe<64;pe++)O[N+pe]=(T?T[k+pe]:0)^V[pe];for(ee=1,pe=8;pe<16;pe++)ee=ee+(se[pe]&255)|0,se[pe]=ee&255,ee>>>=8;D-=64,N+=64,T&&(k+=64)}if(D>0)for(re(V,se,te,B),pe=0;pe<D;pe++)O[N+pe]=(T?T[k+pe]:0)^V[pe];return 0}function W(O,N,T,k,D){return G(O,N,null,0,T,k,D)}function Q(O,N,T,k,D){var P=new Uint8Array(32);return K(P,k,D,B),W(O,N,T,k.subarray(16),P)}function he(O,N,T,k,D,P,te){var se=new Uint8Array(32);return K(se,P,te,B),G(O,N,T,k,D,P.subarray(16),se)}function _e(O,N){var T,k=0;for(T=0;T<17;T++)k=k+(O[T]+N[T]|0)|0,O[T]=k&255,k>>>=8}var Te=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]);function Y(O,N,T,k,D,P){var te,se,V,ee,pe=new Uint32Array(17),Re=new Uint32Array(17),We=new Uint32Array(17),Lt=new Uint32Array(17),Dn=new Uint32Array(17);for(V=0;V<17;V++)Re[V]=We[V]=0;for(V=0;V<16;V++)Re[V]=P[V];for(Re[3]&=15,Re[4]&=252,Re[7]&=15,Re[8]&=252,Re[11]&=15,Re[12]&=252,Re[15]&=15;D>0;){for(V=0;V<17;V++)Lt[V]=0;for(V=0;V<16&&V<D;++V)Lt[V]=T[k+V];for(Lt[V]=1,k+=V,D-=V,_e(We,Lt),se=0;se<17;se++)for(pe[se]=0,V=0;V<17;V++)pe[se]=pe[se]+We[V]*(V<=se?Re[se-V]:320*Re[se+17-V]|0)|0|0;for(se=0;se<17;se++)We[se]=pe[se];for(ee=0,V=0;V<16;V++)ee=ee+We[V]|0,We[V]=ee&255,ee>>>=8;for(ee=ee+We[16]|0,We[16]=ee&3,ee=5*(ee>>>2)|0,V=0;V<16;V++)ee=ee+We[V]|0,We[V]=ee&255,ee>>>=8;ee=ee+We[16]|0,We[16]=ee}for(V=0;V<17;V++)Dn[V]=We[V];for(_e(We,Te),te=-(We[16]>>>7)|0,V=0;V<17;V++)We[V]^=te&(Dn[V]^We[V]);for(V=0;V<16;V++)Lt[V]=P[V+16];for(Lt[16]=0,_e(We,Lt),V=0;V<16;V++)O[N+V]=We[V];return 0}function oe(O,N,T,k,D,P){var te=new Uint8Array(16);return Y(te,0,T,k,D,P),ae(O,N,te,0)}function de(O,N,T,k,D){var P;if(T<32)return-1;for(he(O,0,N,0,T,k,D),Y(O,16,O,32,T-32,O),P=0;P<16;P++)O[P]=0;return 0}function Oe(O,N,T,k,D){var P,te=new Uint8Array(32);if(T<32||(Q(te,0,32,k,D),oe(N,16,N,32,T-32,te)!==0))return-1;for(he(O,0,N,0,T,k,D),P=0;P<32;P++)O[P]=0;return 0}function le(O,N){var T;for(T=0;T<16;T++)O[T]=N[T]|0}function je(O){var N,T;for(T=0;T<16;T++)O[T]+=65536,N=Math.floor(O[T]/65536),O[(T+1)*(T<15?1:0)]+=N-1+37*(N-1)*(T===15?1:0),O[T]-=N*65536}function Se(O,N,T){for(var k,D=~(T-1),P=0;P<16;P++)k=D&(O[P]^N[P]),O[P]^=k,N[P]^=k}function Ne(O,N){var T,k,D,P=r(),te=r();for(T=0;T<16;T++)te[T]=N[T];for(je(te),je(te),je(te),k=0;k<2;k++){for(P[0]=te[0]-65517,T=1;T<15;T++)P[T]=te[T]-65535-(P[T-1]>>16&1),P[T-1]&=65535;P[15]=te[15]-32767-(P[14]>>16&1),D=P[15]>>16&1,P[14]&=65535,Se(te,P,1-D)}for(T=0;T<16;T++)O[2*T]=te[T]&255,O[2*T+1]=te[T]>>8}function be(O,N){var T=new Uint8Array(32),k=new Uint8Array(32);return Ne(T,O),Ne(k,N),C(T,0,k,0)}function at(O){var N=new Uint8Array(32);return Ne(N,O),N[0]&1}function Ht(O,N){var T;for(T=0;T<16;T++)O[T]=N[2*T]+(N[2*T+1]<<8);O[15]&=32767}function Rt(O,N,T){var k;for(k=0;k<16;k++)O[k]=N[k]+T[k]|0}function Dt(O,N,T){var k;for(k=0;k<16;k++)O[k]=N[k]-T[k]|0}function ke(O,N,T){var k,D,P=new Float64Array(31);for(k=0;k<31;k++)P[k]=0;for(k=0;k<16;k++)for(D=0;D<16;D++)P[k+D]+=N[k]*T[D];for(k=0;k<15;k++)P[k]+=38*P[k+16];for(k=0;k<16;k++)O[k]=P[k];je(O),je(O)}function qt(O,N){ke(O,N,N)}function di(O,N){var T=r(),k;for(k=0;k<16;k++)T[k]=N[k];for(k=253;k>=0;k--)qt(T,T),k!==2&&k!==4&&ke(T,T,N);for(k=0;k<16;k++)O[k]=T[k]}function Gi(O,N){var T=r(),k;for(k=0;k<16;k++)T[k]=N[k];for(k=250;k>=0;k--)qt(T,T),k!==1&&ke(T,T,N);for(k=0;k<16;k++)O[k]=T[k]}function mi(O,N,T){var k=new Uint8Array(32),D=new Float64Array(80),P,te,se=r(),V=r(),ee=r(),pe=r(),Re=r(),We=r();for(te=0;te<31;te++)k[te]=N[te];for(k[31]=N[31]&127|64,k[0]&=248,Ht(D,T),te=0;te<16;te++)V[te]=D[te],pe[te]=se[te]=ee[te]=0;for(se[0]=pe[0]=1,te=254;te>=0;--te)P=k[te>>>3]>>>(te&7)&1,Se(se,V,P),Se(ee,pe,P),Rt(Re,se,ee),Dt(se,se,ee),Rt(ee,V,pe),Dt(V,V,pe),qt(pe,Re),qt(We,se),ke(se,ee,se),ke(ee,V,Re),Rt(Re,se,ee),Dt(se,se,ee),qt(V,se),Dt(ee,pe,We),ke(se,ee,g),Rt(se,se,pe),ke(ee,ee,se),ke(se,pe,We),ke(pe,V,D),qt(V,Re),Se(se,V,P),Se(ee,pe,P);for(te=0;te<16;te++)D[te+16]=se[te],D[te+32]=ee[te],D[te+48]=V[te],D[te+64]=pe[te];var Lt=D.subarray(32),Dn=D.subarray(16);return di(Lt,Lt),ke(Dn,Dn,Lt),Ne(O,Dn),0}function yn(O,N){return mi(O,N,c)}function Fi(O,N){return s(N,32),yn(O,N)}function Ar(O,N,T){var k=new Uint8Array(32);return mi(k,T,N),K(O,l,k,B)}var Eo=de,Oo=Oe;function Js(O,N,T,k,D,P){var te=new Uint8Array(32);return Ar(te,D,P),Eo(O,N,T,k,te)}function Qs(O,N,T,k,D,P){var te=new Uint8Array(32);return Ar(te,D,P),Oo(O,N,T,k,te)}function Wn(){var O=0,N=0,T=0,k=0,D=65535,P,te,se;for(se=0;se<arguments.length;se++)P=arguments[se].lo,te=arguments[se].hi,O+=P&D,N+=P>>>16,T+=te&D,k+=te>>>16;return N+=O>>>16,T+=N>>>16,k+=T>>>16,new t(T&D|k<<16,O&D|N<<16)}function Ao(O,N){return new t(O.hi>>>N,O.lo>>>N|O.hi<<32-N)}function Vi(){var O=0,N=0,T;for(T=0;T<arguments.length;T++)O^=arguments[T].lo,N^=arguments[T].hi;return new t(N,O)}function nt(O,N){var T,k,D=32-N;return N<32?(T=O.hi>>>N|O.lo<<D,k=O.lo>>>N|O.hi<<D):N<64&&(T=O.lo>>>N|O.hi<<D,k=O.hi>>>N|O.lo<<D),new t(T,k)}function yu(O,N,T){var k=O.hi&N.hi^~O.hi&T.hi,D=O.lo&N.lo^~O.lo&T.lo;return new t(k,D)}function jo(O,N,T){var k=O.hi&N.hi^O.hi&T.hi^N.hi&T.hi,D=O.lo&N.lo^O.lo&T.lo^N.lo&T.lo;return new t(k,D)}function To(O){return Vi(nt(O,28),nt(O,34),nt(O,39))}function Yi(O){return Vi(nt(O,14),nt(O,18),nt(O,41))}function bu(O){return Vi(nt(O,1),nt(O,8),Ao(O,7))}function No(O){return Vi(nt(O,19),nt(O,61),Ao(O,6))}var vu=[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 ko(O,N,T){var k=[],D=[],P=[],te=[],se,V,ee;for(V=0;V<8;V++)k[V]=P[V]=M(O,8*V);for(var pe=0;T>=128;){for(V=0;V<16;V++)te[V]=M(N,8*V+pe);for(V=0;V<80;V++){for(ee=0;ee<8;ee++)D[ee]=P[ee];for(se=Wn(P[7],Yi(P[4]),yu(P[4],P[5],P[6]),vu[V],te[V%16]),D[7]=Wn(se,To(P[0]),jo(P[0],P[1],P[2])),D[3]=Wn(D[3],se),ee=0;ee<8;ee++)P[(ee+1)%8]=D[ee];if(V%16===15)for(ee=0;ee<16;ee++)te[ee]=Wn(te[ee],te[(ee+9)%16],bu(te[(ee+1)%16]),No(te[(ee+14)%16]))}for(V=0;V<8;V++)P[V]=Wn(P[V],k[V]),k[V]=P[V];pe+=128,T-=128}for(V=0;V<8;V++)z(O,8*V,k[V]);return T}var pi=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 ft(O,N,T){var k=new Uint8Array(64),D=new Uint8Array(256),P,te=T;for(P=0;P<64;P++)k[P]=pi[P];for(ko(k,N,T),T%=128,P=0;P<256;P++)D[P]=0;for(P=0;P<T;P++)D[P]=N[te-T+P];for(D[T]=128,T=256-128*(T<112?1:0),D[T-9]=0,z(D,T-8,new t(te/536870912|0,te<<3)),ko(k,D,T),P=0;P<64;P++)O[P]=k[P];return 0}function Jt(O,N){var T=r(),k=r(),D=r(),P=r(),te=r(),se=r(),V=r(),ee=r(),pe=r();Dt(T,O[1],O[0]),Dt(pe,N[1],N[0]),ke(T,T,pe),Rt(k,O[0],O[1]),Rt(pe,N[0],N[1]),ke(k,k,pe),ke(D,O[3],N[3]),ke(D,D,d),ke(P,O[2],N[2]),Rt(P,P,P),Dt(te,k,T),Dt(se,P,D),Rt(V,P,D),Rt(ee,k,T),ke(O[0],te,se),ke(O[1],ee,V),ke(O[2],V,se),ke(O[3],te,ee)}function Bt(O,N,T){var k;for(k=0;k<4;k++)Se(O[k],N[k],T)}function Zs(O,N){var T=r(),k=r(),D=r();di(D,N[2]),ke(T,N[0],D),ke(k,N[1],D),Ne(O,k),O[31]^=at(T)<<7}function Ws(O,N,T){var k,D;for(le(O[0],m),le(O[1],p),le(O[2],p),le(O[3],m),D=255;D>=0;--D)k=T[D/8|0]>>(D&7)&1,Bt(O,N,k),Jt(N,O),Jt(O,O),Bt(O,N,k)}function Xi(O,N){var T=[r(),r(),r(),r()];le(T[0],b),le(T[1],v),le(T[2],p),ke(T[3],b,v),Ws(O,T,N)}function jr(O,N,T){var k=new Uint8Array(64),D=[r(),r(),r(),r()],P;for(T||s(N,32),ft(k,N,32),k[0]&=248,k[31]&=127,k[31]|=64,Xi(D,k),Zs(O,D),P=0;P<32;P++)N[P+32]=O[P];return 0}var er=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 Tr(O,N){var T,k,D,P;for(k=63;k>=32;--k){for(T=0,D=k-32,P=k-12;D<P;++D)N[D]+=T-16*N[k]*er[D-(k-32)],T=Math.floor((N[D]+128)/256),N[D]-=T*256;N[D]+=T,N[k]=0}for(T=0,D=0;D<32;D++)N[D]+=T-(N[31]>>4)*er[D],T=N[D]>>8,N[D]&=255;for(D=0;D<32;D++)N[D]-=T*er[D];for(k=0;k<32;k++)N[k+1]+=N[k]>>8,O[k]=N[k]&255}function Mn(O){var N=new Float64Array(64),T;for(T=0;T<64;T++)N[T]=O[T];for(T=0;T<64;T++)O[T]=0;Tr(O,N)}function gi(O,N,T,k){var D=new Uint8Array(64),P=new Uint8Array(64),te=new Uint8Array(64),se,V,ee=new Float64Array(64),pe=[r(),r(),r(),r()];ft(D,k,32),D[0]&=248,D[31]&=127,D[31]|=64;var Re=T+64;for(se=0;se<T;se++)O[64+se]=N[se];for(se=0;se<32;se++)O[32+se]=D[32+se];for(ft(te,O.subarray(32),T+32),Mn(te),Xi(pe,te),Zs(O,pe),se=32;se<64;se++)O[se]=k[se];for(ft(P,O,T+64),Mn(P),se=0;se<64;se++)ee[se]=0;for(se=0;se<32;se++)ee[se]=te[se];for(se=0;se<32;se++)for(V=0;V<32;V++)ee[se+V]+=P[se]*D[V];return Tr(O.subarray(32),ee),Re}function yi(O,N){var T=r(),k=r(),D=r(),P=r(),te=r(),se=r(),V=r();return le(O[2],p),Ht(O[1],N),qt(D,O[1]),ke(P,D,f),Dt(D,D,O[2]),Rt(P,O[2],P),qt(te,P),qt(se,te),ke(V,se,te),ke(T,V,D),ke(T,T,P),Gi(T,T),ke(T,T,D),ke(T,T,P),ke(T,T,P),ke(O[0],T,P),qt(k,O[0]),ke(k,k,P),be(k,D)&&ke(O[0],O[0],_),qt(k,O[0]),ke(k,k,P),be(k,D)?-1:(at(O[0])===N[31]>>7&&Dt(O[0],m,O[0]),ke(O[3],O[0],O[1]),0)}function ea(O,N,T,k){var D,P=new Uint8Array(32),te=new Uint8Array(64),se=[r(),r(),r(),r()],V=[r(),r(),r(),r()];if(T<64||yi(V,k))return-1;for(D=0;D<T;D++)O[D]=N[D];for(D=0;D<32;D++)O[D+32]=k[D];if(ft(te,O,T),Mn(te),Ws(se,V,te),Xi(V,N.subarray(32)),Jt(se,V),Zs(P,se),T-=64,C(N,0,P,0)){for(D=0;D<T;D++)O[D]=0;return-1}for(D=0;D<T;D++)O[D]=N[D+64];return T}var Ki=32,Nr=24,Rn=32,kr=16,Cr=32,bi=32,Mr=32,tr=32,vi=32,ta=Nr,Co=Rn,Hn=kr,Qe=64,ot=32,Qt=64,xi=32,na=64;i.lowlevel={crypto_core_hsalsa20:K,crypto_stream_xor:he,crypto_stream:Q,crypto_stream_salsa20_xor:G,crypto_stream_salsa20:W,crypto_onetimeauth:Y,crypto_onetimeauth_verify:oe,crypto_verify_16:ae,crypto_verify_32:C,crypto_secretbox:de,crypto_secretbox_open:Oe,crypto_scalarmult:mi,crypto_scalarmult_base:yn,crypto_box_beforenm:Ar,crypto_box_afternm:Eo,crypto_box:Js,crypto_box_open:Qs,crypto_box_keypair:Fi,crypto_hash:ft,crypto_sign:gi,crypto_sign_keypair:jr,crypto_sign_open:ea,crypto_secretbox_KEYBYTES:Ki,crypto_secretbox_NONCEBYTES:Nr,crypto_secretbox_ZEROBYTES:Rn,crypto_secretbox_BOXZEROBYTES:kr,crypto_scalarmult_BYTES:Cr,crypto_scalarmult_SCALARBYTES:bi,crypto_box_PUBLICKEYBYTES:Mr,crypto_box_SECRETKEYBYTES:tr,crypto_box_BEFORENMBYTES:vi,crypto_box_NONCEBYTES:ta,crypto_box_ZEROBYTES:Co,crypto_box_BOXZEROBYTES:Hn,crypto_sign_BYTES:Qe,crypto_sign_PUBLICKEYBYTES:ot,crypto_sign_SECRETKEYBYTES:Qt,crypto_sign_SEEDBYTES:xi,crypto_hash_BYTES:na,gf:r,D:f,L:er,pack25519:Ne,unpack25519:Ht,M:ke,A:Rt,S:qt,Z:Dt,pow2523:Gi,add:Jt,set25519:le,modL:Tr,scalarmult:Ws,scalarbase:Xi};function Mo(O,N){if(O.length!==Ki)throw new Error("bad key size");if(N.length!==Nr)throw new Error("bad nonce size")}function Ro(O,N){if(O.length!==Mr)throw new Error("bad public key size");if(N.length!==tr)throw new Error("bad secret key size")}function wt(){for(var O=0;O<arguments.length;O++)if(!(arguments[O]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function Ji(O){for(var N=0;N<O.length;N++)O[N]=0}i.randomBytes=function(O){var N=new Uint8Array(O);return s(N,O),N},i.secretbox=function(O,N,T){wt(O,N,T),Mo(T,N);for(var k=new Uint8Array(Rn+O.length),D=new Uint8Array(k.length),P=0;P<O.length;P++)k[P+Rn]=O[P];return de(D,k,k.length,N,T),D.subarray(kr)},i.secretbox.open=function(O,N,T){wt(O,N,T),Mo(T,N);for(var k=new Uint8Array(kr+O.length),D=new Uint8Array(k.length),P=0;P<O.length;P++)k[P+kr]=O[P];return k.length<32||Oe(D,k,k.length,N,T)!==0?null:D.subarray(Rn)},i.secretbox.keyLength=Ki,i.secretbox.nonceLength=Nr,i.secretbox.overheadLength=kr,i.scalarMult=function(O,N){if(wt(O,N),O.length!==bi)throw new Error("bad n size");if(N.length!==Cr)throw new Error("bad p size");var T=new Uint8Array(Cr);return mi(T,O,N),T},i.scalarMult.base=function(O){if(wt(O),O.length!==bi)throw new Error("bad n size");var N=new Uint8Array(Cr);return yn(N,O),N},i.scalarMult.scalarLength=bi,i.scalarMult.groupElementLength=Cr,i.box=function(O,N,T,k){var D=i.box.before(T,k);return i.secretbox(O,N,D)},i.box.before=function(O,N){wt(O,N),Ro(O,N);var T=new Uint8Array(vi);return Ar(T,O,N),T},i.box.after=i.secretbox,i.box.open=function(O,N,T,k){var D=i.box.before(T,k);return i.secretbox.open(O,N,D)},i.box.open.after=i.secretbox.open,i.box.keyPair=function(){var O=new Uint8Array(Mr),N=new Uint8Array(tr);return Fi(O,N),{publicKey:O,secretKey:N}},i.box.keyPair.fromSecretKey=function(O){if(wt(O),O.length!==tr)throw new Error("bad secret key size");var N=new Uint8Array(Mr);return yn(N,O),{publicKey:N,secretKey:new Uint8Array(O)}},i.box.publicKeyLength=Mr,i.box.secretKeyLength=tr,i.box.sharedKeyLength=vi,i.box.nonceLength=ta,i.box.overheadLength=i.secretbox.overheadLength,i.sign=function(O,N){if(wt(O,N),N.length!==Qt)throw new Error("bad secret key size");var T=new Uint8Array(Qe+O.length);return gi(T,O,O.length,N),T},i.sign.open=function(O,N){if(wt(O,N),N.length!==ot)throw new Error("bad public key size");var T=new Uint8Array(O.length),k=ea(T,O,O.length,N);if(k<0)return null;for(var D=new Uint8Array(k),P=0;P<D.length;P++)D[P]=T[P];return D},i.sign.detached=function(O,N){for(var T=i.sign(O,N),k=new Uint8Array(Qe),D=0;D<k.length;D++)k[D]=T[D];return k},i.sign.detached.verify=function(O,N,T){if(wt(O,N,T),N.length!==Qe)throw new Error("bad signature size");if(T.length!==ot)throw new Error("bad public key size");var k=new Uint8Array(Qe+O.length),D=new Uint8Array(Qe+O.length),P;for(P=0;P<Qe;P++)k[P]=N[P];for(P=0;P<O.length;P++)k[P+Qe]=O[P];return ea(D,k,k.length,T)>=0},i.sign.keyPair=function(){var O=new Uint8Array(ot),N=new Uint8Array(Qt);return jr(O,N),{publicKey:O,secretKey:N}},i.sign.keyPair.fromSecretKey=function(O){if(wt(O),O.length!==Qt)throw new Error("bad secret key size");for(var N=new Uint8Array(ot),T=0;T<N.length;T++)N[T]=O[32+T];return{publicKey:N,secretKey:new Uint8Array(O)}},i.sign.keyPair.fromSeed=function(O){if(wt(O),O.length!==xi)throw new Error("bad seed size");for(var N=new Uint8Array(ot),T=new Uint8Array(Qt),k=0;k<32;k++)T[k]=O[k];return jr(N,T,!0),{publicKey:N,secretKey:T}},i.sign.publicKeyLength=ot,i.sign.secretKeyLength=Qt,i.sign.seedLength=xi,i.sign.signatureLength=Qe,i.hash=function(O){wt(O);var N=new Uint8Array(na);return ft(N,O,O.length),N},i.hash.hashLength=na,i.verify=function(O,N){return wt(O,N),O.length===0||N.length===0||O.length!==N.length?!1:ie(O,0,N,0,O.length)===0},i.setPRNG=function(O){s=O},(function(){var O=typeof globalThis<"u"?globalThis.crypto||globalThis.msCrypto:null;if(O&&O.getRandomValues){var N=65536;i.setPRNG(function(T,k){var D,P=new Uint8Array(k);for(D=0;D<k;D+=N)O.getRandomValues(P.subarray(D,D+Math.min(k-D,N)));for(D=0;D<k;D++)T[D]=P[D];Ji(P)})}else typeof require<"u"&&(O=require("crypto"),O&&O.randomBytes&&i.setPRNG(function(T,k){var D,P=O.randomBytes(k);for(D=0;D<k;D++)T[D]=P[D];Ji(P)}))})()})(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const Yl=typeof module<"u"&&module.exports?module.exports:globalThis.nacl;Yl.sign.keyPair.fromSeed,Yl.sign.detached,Yl.sign.detached.verify,Yl.randomBytes;var dy;(function(i){i.InvalidPrefixByte="nkeys: invalid prefix byte",i.InvalidKey="nkeys: invalid key",i.InvalidPublicKey="nkeys: invalid public key",i.InvalidSeedLen="nkeys: invalid seed length",i.InvalidSeed="nkeys: invalid seed",i.InvalidEncoding="nkeys: invalid encoded key",i.InvalidSignature="nkeys: signature verification failed",i.CannotSign="nkeys: cannot sign, no private key available",i.PublicKeyOnly="nkeys: no seed or private key available",i.InvalidChecksum="nkeys: invalid checksum",i.SerializationError="nkeys: serialization error",i.ApiError="nkeys: api error",i.ClearedPair="nkeys: pair is cleared"})(dy||(dy={}));var my;(function(i){i[i.Seed=144]="Seed",i[i.Private=120]="Private",i[i.Operator=112]="Operator",i[i.Server=104]="Server",i[i.Cluster=16]="Cluster",i[i.Account=0]="Account",i[i.User=160]="User"})(my||(my={}));function $S(i){return t=>{let r={};return i.forEach(s=>{const l=s(t)||{};r=Object.assign(r,l)}),r}}function HS(){return()=>{}}function GS(i,t){return()=>{const r=typeof i=="function"?i():i,s=typeof t=="function"?t():t;return{user:r,pass:s}}}function FS(i){return()=>({auth_token:typeof i=="function"?i():i})}const wb=120*1e3,VS=2,Sb=2*1e3;function YS(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:wb,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:1e3,reconnectTimeWait:Sb,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function XS(i){const t=[];return typeof i.authenticator=="function"&&t.push(i.authenticator),Array.isArray(i.authenticator)&&t.push(...i.authenticator),i.token&&t.push(FS(i.token)),i.user&&t.push(GS(i.user,i.pass)),t.length===0?HS():$S(t)}function KS(i){const t=`${Jh}:${vb()}`;if(i=i||{servers:[t]},i.servers=i.servers||[],typeof i.servers=="string"&&(i.servers=[i.servers]),i.servers.length>0&&i.port)throw new me("port and servers options are mutually exclusive",ce.InvalidOption);i.servers.length===0&&i.port&&(i.servers=[`${Jh}:${i.port}`]),i.servers&&i.servers.length===0&&(i.servers=[t]);const r=lu(YS(),i);if(r.authenticator=XS(r),["reconnectDelayHandler","authenticator"].forEach(s=>{if(r[s]&&typeof r[s]!="function")throw new me(`${s} option should be a function`,ce.NotFunction)}),r.reconnectDelayHandler||(r.reconnectDelayHandler=()=>{let s=r.tls?r.reconnectJitterTLS:r.reconnectJitter;return s&&(s++,s=Math.floor(Math.random()*s)),r.reconnectTimeWait+s}),r.inboxPrefix)try{wr(r.inboxPrefix)}catch(s){throw new me(s.message,ce.ApiError)}if(r.resolve===void 0&&(r.resolve=typeof id()=="function"),r.resolve&&typeof id()!="function")throw new me("'resolve' is not supported on this client",ce.InvalidOption);return r}function JS(i,t){const{proto:r,tls_required:s,tls_available:l}=i;if((r===void 0||r<1)&&t.noEcho)throw new me("noEcho",ce.ServerOptionNotAvailable);const c=s||l||!1;if(t.tls&&!c)throw new me("tls",ce.ServerOptionNotAvailable)}const QS=1024*32,ZS=/^INFO\s+([^\r\n]+)\r\n/i,WS=so(`PONG\r
38
+ `),py=so(`PING\r
39
+ `);class eE{constructor(t,r,s){A(this,"echo");A(this,"no_responders");A(this,"protocol");A(this,"verbose");A(this,"pedantic");A(this,"jwt");A(this,"nkey");A(this,"sig");A(this,"user");A(this,"pass");A(this,"auth_token");A(this,"tls_required");A(this,"name");A(this,"lang");A(this,"version");A(this,"headers");this.protocol=1,this.version=t.version,this.lang=t.lang,this.echo=r.noEcho?!1:void 0,this.verbose=r.verbose,this.pedantic=r.pedantic,this.tls_required=r.tls?!0:void 0,this.name=r.name;const l=(r&&typeof r.authenticator=="function"?r.authenticator(s):{})||{};lu(this,l)}}class Eb extends jt{constructor(r,s,l={}){var m;super();A(this,"sid");A(this,"queue");A(this,"draining");A(this,"max");A(this,"subject");A(this,"drained");A(this,"protocol");A(this,"timer");A(this,"info");A(this,"cleanupFn");A(this,"closed");A(this,"requestSubject");lu(this,l),this.protocol=r,this.subject=s,this.draining=!1,this.noIterator=typeof l.callback=="function",this.closed=st();const c=!((m=r.options)!=null&&m.noAsyncTraces);l.timeout&&(this.timer=Gs(l.timeout,c),this.timer.then(()=>{this.timer=void 0}).catch(p=>{this.stop(p),this.noIterator&&this.callback(p,{})})),this.noIterator||this.iterClosed.then(()=>{this.closed.resolve(),this.unsubscribe()})}setPrePostHandlers(r){if(this.noIterator){const s=this.callback,l=r.ingestionFilterFn?r.ingestionFilterFn:()=>({ingest:!0,protocol:!1}),c=r.protocolFilterFn?r.protocolFilterFn:()=>!0,m=r.dispatchedFn?r.dispatchedFn:()=>{};this.callback=(p,g)=>{const{ingest:f}=l(g);f&&c(g)&&(s(p,g),m(g))}}else this.protocolFilterFn=r.protocolFilterFn,this.dispatchedFn=r.dispatchedFn}callback(r,s){this.cancelTimeout(),r?this.stop(r):this.push(s)}close(){if(!this.isClosed()){this.cancelTimeout();const r=()=>{if(this.stop(),this.cleanupFn)try{this.cleanupFn(this,this.info)}catch{}this.closed.resolve()};this.noIterator?r():this.push(r)}}unsubscribe(r){this.protocol.unsubscribe(this,r)}cancelTimeout(){this.timer&&(this.timer.cancel(),this.timer=void 0)}drain(){return this.protocol.isClosed()?Promise.reject(me.errorForCode(ce.ConnectionClosed)):this.isClosed()?Promise.reject(me.errorForCode(ce.SubClosed)):(this.drained||(this.draining=!0,this.protocol.unsub(this),this.drained=this.protocol.flush(st()).then(()=>{this.protocol.subscriptions.cancel(this)}).catch(()=>{this.protocol.subscriptions.cancel(this)})),this.drained)}isDraining(){return this.draining}isClosed(){return this.done}getSubject(){return this.subject}getMax(){return this.max}getID(){return this.sid}}class tE{constructor(){A(this,"mux");A(this,"subs");A(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 r=t.permissionContext,s=this.all();let l;if(r.operation==="subscription"&&(l=s.find(c=>c.subject===r.subject&&c.queue===r.queue)),r.operation==="publish"&&(l=s.find(c=>c.requestSubject===r.subject)),l)return l.callback(t,{}),l.close(),this.subs.delete(l.sid),l!==this.mux}return!1}close(){this.subs.forEach(t=>{t.close()})}}class eu{constructor(t,r){A(this,"connected");A(this,"connectedOnce");A(this,"infoReceived");A(this,"info");A(this,"muxSubscriptions");A(this,"options");A(this,"outbound");A(this,"pongs");A(this,"subscriptions");A(this,"transport");A(this,"noMorePublishing");A(this,"connectError");A(this,"publisher");A(this,"_closed");A(this,"closed");A(this,"listeners");A(this,"heartbeats");A(this,"parser");A(this,"outMsgs");A(this,"inMsgs");A(this,"outBytes");A(this,"inBytes");A(this,"pendingLimit");A(this,"lastError");A(this,"abortReconnect");A(this,"whyClosed");A(this,"servers");A(this,"server");A(this,"features");A(this,"connectPromise");this._closed=!1,this.connected=!1,this.connectedOnce=!1,this.infoReceived=!1,this.noMorePublishing=!1,this.abortReconnect=!1,this.listeners=[],this.pendingLimit=QS,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=t,this.publisher=r,this.subscriptions=new tE,this.muxSubscriptions=new LS,this.outbound=new Vs,this.pongs=[],this.whyClosed="",this.pendingLimit=t.pendingLimit||this.pendingLimit,this.features=new yS({major:0,minor:0,micro:0}),this.connectPromise=null;const s=typeof t.servers=="string"?[t.servers]:t.servers;this.servers=new BS(s,{randomize:!t.noRandomize}),this.closed=st(),this.parser=new hy(this),this.heartbeats=new zS(this,this.options.pingInterval||wb,this.options.maxPingOut||VS)}resetOutbound(){this.outbound.reset();const t=this.pongs;this.pongs=[];const r=me.errorForCode(ce.Disconnect);r.stack="",t.forEach(s=>{s.reject(r)}),this.parser=new hy(this),this.infoReceived=!1}dispatchStatus(t){this.listeners.forEach(r=>{r.push(t)})}status(){const t=new jt;return this.listeners.push(t),t}prepare(){this.transport&&this.transport.discard(),this.info=void 0,this.resetOutbound();const t=st();return t.catch(()=>{}),this.pongs.unshift(t),this.connectError=r=>{t.reject(r)},this.transport=xS(),this.transport.closed().then(async r=>{if(this.connected=!1,!this.isClosed()){await this.disconnected(this.transport.closeError||this.lastError);return}}),t}disconnect(){this.dispatchStatus({type:zs.StaleConnection,data:""}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:zs.ClientInitiatedReconnect,data:""}),this.transport.disconnect()),Promise.resolve()}async disconnected(t){this.dispatchStatus({type:_r.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{var r;this.dispatchStatus({type:_r.Reconnect,data:this.servers.getCurrentServer().toString()}),((r=this.lastError)==null?void 0:r.code)===ce.AuthenticationExpired&&(this.lastError=void 0)}).catch(r=>{this._close(r)}):await this._close(t)}async dial(t){const r=this.prepare();let s;try{s=Gs(this.options.timeout||2e4);const l=this.transport.connect(t,this.options);await Promise.race([l,s]),(async()=>{try{for await(const c of this.transport)this.parser.parse(c)}catch(c){console.log("reader closed",c)}})().then()}catch(l){r.reject(l)}try{await Promise.race([s,r]),s&&s.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(l){throw s&&s.cancel(),await this.transport.close(l),l}}async _doDial(t){const{resolve:r}=this.options,s=await t.resolve({fn:id(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:r});let l=null;for(const c of s)try{l=null,this.dispatchStatus({type:zs.Reconnecting,data:c.toString()}),await this.dial(c);return}catch(m){l=m}throw l}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 r=this.options.reconnectDelayHandler?this.options.reconnectDelayHandler():Sb;let s=r;const l=this.selectServer();if(!l||this.abortReconnect)throw t||(this.lastError?this.lastError:me.errorForCode(ce.ConnectionRefused));const c=Date.now();if(l.lastConnect===0||l.lastConnect+r<=c){l.lastConnect=Date.now();try{await this._doDial(l);break}catch(m){if(t=m,!this.connectedOnce){if(this.options.waitOnFirstConnect)continue;this.servers.removeCurrentServer()}l.reconnects++;const p=this.options.maxReconnectAttempts||0;p!==-1&&l.reconnects>=p&&this.servers.removeCurrentServer()}}else s=Math.min(s,l.lastConnect+r-c),await Ys(s)}}static async connect(t,r){const s=new eu(t,r);return await s.dialLoop(),s}static toError(t){const r=t?t.toLowerCase():"";if(r.indexOf("permissions violation")!==-1){const s=new me(t,ce.PermissionsViolation),l=t.match(/(Publish|Subscription) to "(\S+)"/);if(l){s.permissionContext={operation:l[1].toLowerCase(),subject:l[2],queue:void 0};const c=t.match(/using queue "(\S+)"/);c&&(s.permissionContext.queue=c[1])}return s}else return r.indexOf("authorization violation")!==-1?new me(t,ce.AuthorizationViolation):r.indexOf("user authentication expired")!==-1?new me(t,ce.AuthenticationExpired):r.indexOf("account authentication expired")!=-1?new me(t,ce.AccountExpired):r.indexOf("authentication timeout")!==-1?new me(t,ce.AuthenticationTimeout):new me(t,ce.ProtocolError)}processMsg(t,r){if(this.inMsgs++,this.inBytes+=r.length,!this.subscriptions.sidCounter)return;const s=this.subscriptions.get(t.sid);s&&(s.received+=1,s.callback&&s.callback(null,new jd(t,r,this)),s.max!==void 0&&s.received>=s.max&&s.unsubscribe())}processError(t){const r=Qg(t),s=eu.toError(r),l={type:_r.Error,data:s.code};if(s.isPermissionError()){let c=!1;if(s.permissionContext){l.permissionContext=s.permissionContext;const m=this.subscriptions.getMux();c=(m==null?void 0:m.subject)===s.permissionContext.subject}this.subscriptions.handleError(s),this.muxSubscriptions.handleError(c,s),c&&this.subscriptions.setMux(null)}this.dispatchStatus(l),this.handleError(s)}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(WS)}processPong(){const t=this.pongs.shift();t&&t.resolve()}processInfo(t){const r=JSON.parse(Qg(t));this.info=r;const s=this.options&&this.options.ignoreClusterUpdates?void 0:this.servers.update(r,this.transport.isEncrypted());if(!this.infoReceived){this.features.update($i(r.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();const{version:c,lang:m}=this.transport;try{const p=new eE({version:c,lang:m},this.options,r.nonce);r.headers&&(p.headers=!0,p.no_responders=!0);const g=JSON.stringify(p);this.transport.send(so(`CONNECT ${g}${Ic}`)),this.transport.send(py)}catch(p){this._close(p)}}s&&this.dispatchStatus({type:_r.Update,data:s}),(r.ldm!==void 0?r.ldm:!1)&&this.dispatchStatus({type:_r.LDM,data:this.servers.getCurrentServer().toString()})}push(t){switch(t.kind){case It.MSG:{const{msg:r,data:s}=t;this.processMsg(r,s);break}case It.OK:break;case It.ERR:this.processError(t.data);break;case It.PING:this.processPing();break;case It.PONG:this.processPong();break;case It.INFO:this.processInfo(t.data);break}}sendCommand(t,...r){const s=this.outbound.length();let l;typeof t=="string"?l=so(t):l=t,this.outbound.fill(l,...r),s===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(t,r=hn,s){let l;if(r instanceof Uint8Array)l=r;else if(typeof r=="string")l=Hi.encode(r);else throw me.errorForCode(ce.BadPayload);let c=l.length;s=s||{},s.reply=s.reply||"";let m=hn,p=0;if(s.headers){if(this.info&&!this.info.headers)throw new me("headers",ce.ServerOptionNotAvailable);m=s.headers.encode(),p=m.length,c=l.length+p}if(this.info&&c>this.info.max_payload)throw me.errorForCode(ce.MaxPayloadExceeded);this.outBytes+=c,this.outMsgs++;let g;s.headers?(s.reply?g=`HPUB ${t} ${s.reply} ${p} ${c}\r
40
+ `:g=`HPUB ${t} ${p} ${c}\r
41
+ `,this.sendCommand(g,m,l,Wc)):(s.reply?g=`PUB ${t} ${s.reply} ${c}\r
42
+ `:g=`PUB ${t} ${c}\r
43
+ `,this.sendCommand(g,l,Wc))}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,r){this.unsub(t,r),(t.max===void 0||t.received>=t.max)&&this.subscriptions.cancel(t)}unsub(t,r){!t||this.isClosed()||(r?this.sendCommand(`UNSUB ${t.sid} ${r}\r
46
+ `):this.sendCommand(`UNSUB ${t.sid}\r
47
+ `),t.max=r)}resub(t,r){!t||this.isClosed()||(this.unsub(t),t.subject=r,this.subscriptions.resub(t),this._sub(t))}flush(t){return t||(t=st()),this.pongs.push(t),this.outbound.fill(py),this.flushPending(),t}sendSubscriptions(){const t=[];this.subscriptions.all().forEach(r=>{const s=r;s.queue?t.push(`SUB ${s.subject} ${s.queue} ${s.sid}${Ic}`):t.push(`SUB ${s.subject} ${s.sid}${Ic}`)}),t.length&&this.transport.send(so(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(r=>{r.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(),r=[];return t.forEach(s=>{r.push(s.drain())}),Promise.all(r).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 r=this.muxSubscriptions.init(this.options.inboxPrefix),s=new Eb(this,`${r}*`);s.callback=this.muxSubscriptions.dispatcher(),this.subscriptions.setMux(s),this.subscribe(s)}}selectServer(){const t=this.servers.selectServer();if(t!==void 0)return this.server=t,this.server}getServer(){return this.server}}const nE="$SRV";class gy{constructor(t){A(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,r){return this.msg.respond(t,r)}respondError(t,r,s,l){var c,m;return l=l||{},l.headers=l.headers||Sr(),(c=l.headers)==null||c.set(Kc,`${t}`),(m=l.headers)==null||m.set(Xc,r),this.msg.respond(s,l)}json(t){return this.msg.json(t)}string(){return this.msg.string()}}class fo{constructor(t,r="",s=""){A(this,"subject");A(this,"queue");A(this,"srv");r!==""&&iE("service group",r);let l="";if(t instanceof bo)this.srv=t,l="";else if(t instanceof fo){const c=t;this.srv=c.srv,s===""&&c.queue!==""&&(s=c.queue),l=c.subject}else throw new Error("unknown ServiceGroup type");this.subject=this.calcSubject(l,r),this.queue=s}calcSubject(t,r=""){return r===""?t:t!==""?`${t}.${r}`:r}addEndpoint(t="",r){r=r||{subject:t};const s=typeof r=="function"?{handler:r,subject:t}:r;no("endpoint",t);let{subject:l,handler:c,metadata:m,queue:p}=s;l=l||t,p=p||this.queue,rE("endpoint subject",l),l=this.calcSubject(this.subject,l);const g={name:t,subject:l,queue:p,handler:c,metadata:m};return this.srv._addEndpoint(g)}addGroup(t="",r=""){return new fo(this,t,r)}}function rE(i,t){if(t==="")throw new Error(`${i} cannot be empty`);if(t.indexOf(" ")!==-1)throw new Error(`${i} cannot contain spaces: '${t}'`);const r=t.split(".");r.forEach((s,l)=>{if(s===">"&&l!==r.length-1)throw new Error(`${i} cannot have internal '>': '${t}'`)})}function iE(i,t){if(t.indexOf(" ")!==-1)throw new Error(`${i} cannot contain spaces: '${t}'`);t.split(".").forEach(s=>{if(s===">")throw new Error(`${i} name cannot contain internal '>': '${t}'`)})}class bo{constructor(t,r={name:"",version:""}){A(this,"nc");A(this,"_id");A(this,"config");A(this,"handlers");A(this,"internal");A(this,"_stopped");A(this,"_done");A(this,"started");this.nc=t,this.config=Object.assign({},r),this.config.queue||(this.config.queue="q"),no("name",this.config.name),no("queue",this.config.queue),$i(this.config.version),this._id=fi.next(),this.internal=[],this._done=st(),this._stopped=!1,this.handlers=[],this.started=new Date().toISOString(),this.reset(),this.nc.closed().then(()=>{this.close().catch()}).catch(s=>{this.close(s).catch()})}static controlSubject(t,r="",s="",l){const c=l??nE;return r===""&&s===""?`${c}.${t}`:(no("control subject name",r),s!==""?(no("control subject id",s),`${c}.${t}.${r}.${s}`):`${c}.${t}.${r}`)}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 r=Sr();if(t instanceof Jc){const s=t;r.set(Xc,s.message),r.set(Kc,`${s.code}`)}else r.set(Xc,t.message),r.set(Kc,"500");return r}setupHandler(t,r=!1){const s=r?"":t.queue?t.queue:this.config.queue,{name:l,subject:c,handler:m}=t,p=t;p.internal=r,r&&this.internal.push(p),p.stats=new sE(l,c,s),p.queue=s;const g=m?(f,d)=>{if(f){this.close(f);return}const b=Date.now();try{m(f,new gy(d))}catch(v){p.stats.countError(v),d==null||d.respond(hn,{headers:this.errorToHeader(v)})}finally{p.stats.countLatency(b)}}:void 0;return p.sub=this.nc.subscribe(c,{callback:g,queue:s}),p.sub.closed.then(()=>{this._stopped||this.close(new Error(`required subscription ${t.subject} stopped`)).catch()}).catch(f=>{if(!this._stopped){const d=new Error(`required subscription ${t.subject} errored: ${f.message}`);d.stack=f.stack,this.close(d).catch()}}),p}info(){return{type:ao.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:r,metadata:s,name:l,queue:c}=t;return{subject:r,metadata:s,name:l,queue_group:c}})}async stats(){const t=[];for(const r of this.handlers){if(typeof this.config.statsHandler=="function")try{r.stats.data=await this.config.statsHandler(r)}catch(s){r.stats.countError(s)}t.push(r.stats.stats(r.qi))}return{type:ao.STATS,name:this.name,id:this.id,version:this.version,started:this.started,metadata:this.metadata,endpoints:t}}addInternalHandler(t,r){const s=`${t}`.toUpperCase();this._doAddInternalHandler(`${s}-all`,t,r),this._doAddInternalHandler(`${s}-kind`,t,r,this.name),this._doAddInternalHandler(`${s}`,t,r,this.name,this.id)}_doAddInternalHandler(t,r,s,l="",c=""){const m={};m.name=t,m.subject=bo.controlSubject(r,l,c),m.handler=s,this.setupHandler(m,!0)}start(){const t=$n(),r=(m,p)=>m?(this.close(m),Promise.reject(m)):this.stats().then(g=>(p==null||p.respond(t.encode(g)),Promise.resolve())),s=(m,p)=>m?(this.close(m),Promise.reject(m)):(p==null||p.respond(t.encode(this.info())),Promise.resolve()),l=t.encode(this.ping()),c=(m,p)=>m?(this.close(m).then().catch(),Promise.reject(m)):(p.respond(l),Promise.resolve());return this.addInternalHandler(ai.PING,c),this.addInternalHandler(ai.STATS,r),this.addInternalHandler(ai.INFO,s),this.handlers.forEach(m=>{const{subject:p}=m;typeof p=="string"&&m.handler!==null&&this.setupHandler(m)}),Promise.resolve(this)}close(t){if(this._stopped)return this._done;this._stopped=!0;let r=[];return this.nc.isClosed()||(r=this.handlers.concat(this.internal).map(s=>s.sub.drain())),Promise.allSettled(r).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:ao.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,r){return new fo(this,t,r)}addEndpoint(t,r){return new fo(this).addEndpoint(t,r)}_addEndpoint(t){const r=new jt;r.noIterator=typeof t.handler=="function",r.noIterator||(t.handler=(l,c)=>{l?this.stop(l).catch():r.push(new gy(c))},r.iterClosed.then(()=>{this.close().catch()}));const s=this.setupHandler(t,!1);return s.qi=r,this.handlers.push(s),r}}class sE{constructor(t,r,s=""){A(this,"name");A(this,"subject");A(this,"average_processing_time");A(this,"num_requests");A(this,"processing_time");A(this,"num_errors");A(this,"last_error");A(this,"data");A(this,"metadata");A(this,"queue");this.name=t,this.subject=r,this.average_processing_time=0,this.num_errors=0,this.num_requests=0,this.processing_time=0,this.queue=s}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 r=t;r&&(r.time=0,r.processed=0)}countLatency(t){this.num_requests++,this.processing_time+=it(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:r,average_processing_time:s,num_errors:l,num_requests:c,processing_time:m,last_error:p,data:g,queue:f}=this;return{name:t,subject:r,average_processing_time:s,num_errors:l,num_requests:c,processing_time:m,last_error:p,data:g,queue_group:f}}stats(t){const r=t;return(r==null?void 0:r.noIterator)===!1&&(this.processing_time=it(r.time),this.num_requests=r.processed,this.average_processing_time=this.processing_time>0&&this.num_requests>0?this.processing_time/this.num_requests:0),this._stats()}}class aE{constructor(t,r={strategy:In.JitterTimer,maxWait:2e3},s){A(this,"nc");A(this,"prefix");A(this,"opts");this.nc=t,this.prefix=s,this.opts=r}ping(t="",r=""){return this.q(ai.PING,t,r)}stats(t="",r=""){return this.q(ai.STATS,t,r)}info(t="",r=""){return this.q(ai.INFO,t,r)}async q(t,r="",s=""){const l=new jt,c=$n(),m=bo.controlSubject(t,r,s,this.prefix),p=await this.nc.requestMany(m,hn,this.opts);return(async()=>{for await(const g of p)try{const f=c.decode(g.data);l.push(f)}catch(f){l.push(()=>{l.stop(f)})}l.push(()=>{l.stop()})})().catch(g=>{l.stop(g)}),l}}function Ob(){return{key:{encode(i){return i},decode(i){return i}},value:{encode(i){return i},decode(i){return i}}}}function oE(){return{replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:Ob(),storage:td.File}}const tu="KV-Operation",yy="$KV",lE=/^[-/=.\w]+$/,cE=/^[-/=.>*\w]+$/,uE=/^[-\w]+$/;function fE(i){if(i.startsWith(".")||i.endsWith(".")||!lE.test(i))throw new Error(`invalid key: ${i}`)}function hE(i){if(i.startsWith(".")||i.endsWith(".")||!cE.test(i))throw new Error(`invalid key: ${i}`)}function dE(i){if(i.startsWith(".")||i.endsWith("."))throw new Error(`invalid key: ${i}`);const t=i.split(".");let r=!1;for(let s=0;s<t.length;s++)switch(t[s]){case"*":r=!0;break;case">":if(s!==t.length-1)throw new Error(`invalid key: ${i}`);r=!0;break}return r}function $c(i){if(!uE.test(i))throw new Error(`invalid bucket name: ${i}`)}var Kn;(function(i){i.MsgIdHdr="Nats-Msg-Id",i.ExpectedStreamHdr="Nats-Expected-Stream",i.ExpectedLastSeqHdr="Nats-Expected-Last-Sequence",i.ExpectedLastMsgIdHdr="Nats-Expected-Last-Msg-Id",i.ExpectedLastSubjectSequenceHdr="Nats-Expected-Last-Subject-Sequence"})(Kn||(Kn={}));class ho{constructor(t,r,s){A(this,"js");A(this,"jsm");A(this,"stream");A(this,"bucket");A(this,"direct");A(this,"codec");A(this,"prefix");A(this,"editPrefix");A(this,"useJsPrefix");A(this,"_prefixLen");A(this,"validateKey",fE);A(this,"validateSearchKey",hE);A(this,"hasWildcards",dE);$c(t),this.js=r,this.jsm=s,this.bucket=t,this.prefix=yy,this.editPrefix="",this.useJsPrefix=!1,this._prefixLen=0}static async create(t,r,s={}){$c(r);const l=await t.jetstreamManager(),c=new ho(r,t,l);return await c.init(s),c}static async bind(t,r,s={}){const l=await t.jetstreamManager(),c={config:{allow_direct:s.allow_direct}};$c(r);const m=new ho(r,t,l);return c.config.name=s.streamName??m.bucketName(),Object.assign(m,c),m.stream=c.config.name,m.codec=s.codec||Ob(),m.direct=c.config.allow_direct??!1,m.initializePrefixes(c),m}async init(t={}){const r=Object.assign(oE(),t);this.codec=r.codec;const s={};this.stream=s.name=t.streamName??this.bucketName(),s.retention=ed.Limits,s.max_msgs_per_subject=r.history,r.maxBucketSize&&(r.max_bytes=r.maxBucketSize),r.max_bytes&&(s.max_bytes=r.max_bytes),s.max_msg_size=r.maxValueSize,s.storage=r.storage;const l=t.placementCluster??"";if(l&&(t.placement={},t.placement.cluster=l,t.placement.tags=[]),t.placement&&(s.placement=t.placement),t.republish&&(s.republish=t.republish),t.description&&(s.description=t.description),t.mirror){const b=Object.assign({},t.mirror);b.name.startsWith(cn)||(b.name=`${cn}${b.name}`),s.mirror=b,s.mirror_direct=!0}else if(t.sources){const b=t.sources.map(v=>{const _=Object.assign({},v),w=_.name.startsWith(cn)?_.name.substring(cn.length):_.name;return _.name.startsWith(cn)||(_.name=`${cn}${_.name}`),!v.external&&w!==this.bucket&&(_.subject_transforms=[{src:`$KV.${w}.>`,dest:`$KV.${this.bucket}.>`}]),_});s.sources=b,s.subjects=[this.subjectForBucket()]}else s.subjects=[this.subjectForBucket()];t.metadata&&(s.metadata=t.metadata),typeof t.compression=="boolean"&&(s.compression=t.compression?hi.S2:hi.None);const c=this.js.nc,m=c.getServerVersion(),p=m?rd(m,$i("2.7.2"))>=0:!1;s.discard=p?uo.New:uo.Old;const{ok:g,min:f}=c.features.get(Ie.JS_ALLOW_DIRECT);if(!g&&t.allow_direct===!0){const b=m?`${m.major}.${m.minor}.${m.micro}`:"unknown";return Promise.reject(new Error(`allow_direct is not available on server version ${b} - requires ${f}`))}t.allow_direct=typeof t.allow_direct=="boolean"?t.allow_direct:g,s.allow_direct=t.allow_direct,this.direct=s.allow_direct,s.num_replicas=r.replicas,r.ttl&&(s.max_age=it(r.ttl)),s.allow_rollup_hdrs=!0;let d;try{d=await this.jsm.streams.info(s.name),!d.config.allow_direct&&this.direct===!0&&(this.direct=!1)}catch(b){if(b.message==="stream not found")d=await this.jsm.streams.add(s);else throw b}this.initializePrefixes(d)}initializePrefixes(t){this._prefixLen=0,this.prefix=`$KV.${this.bucket}`,this.useJsPrefix=this.js.apiPrefix!=="$JS.API";const{mirror:r}=t.config;if(r){let s=r.name;if(s.startsWith(cn)&&(s=s.substring(cn.length)),r.external&&r.external.api!==""){const l=r.name.substring(cn.length);this.useJsPrefix=!1,this.prefix=`$KV.${l}`,this.editPrefix=`${r.external.api}.$KV.${s}`}else this.editPrefix=this.prefix}}bucketName(){return this.stream??`${cn}${this.bucket}`}subjectForBucket(){return`${this.prefix}.${this.bucket}.>`}subjectForKey(t,r=!1){const s=[];return r?(this.useJsPrefix&&s.push(this.js.apiPrefix),this.editPrefix!==""?s.push(this.editPrefix):s.push(this.prefix)):this.prefix&&s.push(this.prefix),s.push(t),s.join(".")}fullKeyName(t){return this.prefix!==""?`${this.prefix}.${t}`:`${yy}.${this.bucket}.${t}`}get prefixLen(){return this._prefixLen===0&&(this._prefixLen=this.prefix.length+1),this._prefixLen}encodeKey(t){const r=[];for(const s of t.split("."))switch(s){case">":case"*":r.push(s);break;default:r.push(this.codec.key.encode(s));break}return r.join(".")}decodeKey(t){const r=[];for(const s of t.split("."))switch(s){case">":case"*":r.push(s);break;default:r.push(this.codec.key.decode(s));break}return r.join(".")}close(){return Promise.resolve()}dataLen(t,r){const s=r&&r.get($t.MessageSizeHdr)||"";return s!==""?parseInt(s,10):t.length}smToEntry(t){return new TE(this.bucket,this.prefixLen,t)}jmToEntry(t){const r=this.decodeKey(t.subject.substring(this.prefixLen));return new NE(this.bucket,r,t)}async create(t,r){var c;let s;try{const m=await this.put(t,r,{previousSeq:0});return Promise.resolve(m)}catch(m){if(s=m,((c=m==null?void 0:m.api_error)==null?void 0:c.err_code)!==10071)return Promise.reject(m)}let l=0;try{const m=await this.get(t);return(m==null?void 0:m.operation)==="DEL"||(m==null?void 0:m.operation)==="PURGE"?(l=m!==null?m.revision:0,this.update(t,r,l)):Promise.reject(s)}catch(m){return Promise.reject(m)}}update(t,r,s){if(s<=0)throw new Error("version must be greater than 0");return this.put(t,r,{previousSeq:s})}async put(t,r,s={}){var m,p;const l=this.encodeKey(t);this.validateKey(l);const c={};if(s.previousSeq!==void 0){const g=Sr();c.headers=g,g.set(Kn.ExpectedLastSubjectSequenceHdr,`${s.previousSeq}`)}try{return(await this.js.publish(this.subjectForKey(l,!0),r,c)).seq}catch(g){const f=g;return f.isJetStreamError()?(f.message=(m=f.api_error)==null?void 0:m.description,f.code=`${(p=f.api_error)==null?void 0:p.code}`,Promise.reject(f)):Promise.reject(g)}}async get(t,r){const s=this.encodeKey(t);this.validateKey(s);let l={last_by_subj:this.subjectForKey(s)};r&&r.revision>0&&(l={seq:r.revision});let c;try{this.direct?c=await this.jsm.direct.getMessage(this.bucketName(),l):c=await this.jsm.streams.getMessage(this.bucketName(),l);const m=this.smToEntry(c);return m.key!==s?null:m}catch(m){if(m.code===ce.JetStream404NoMessages)return null;throw m}}purge(t,r){return this._deleteOrPurge(t,"PURGE",r)}delete(t,r){return this._deleteOrPurge(t,"DEL",r)}async purgeDeletes(t=1800*1e3){const r=st(),s=[],l=await this.watch({key:">",initializedFn:()=>{r.resolve()}});(async()=>{for await(const g of l)(g.operation==="DEL"||g.operation==="PURGE")&&s.push(g)})().then(),await r,l.stop();const c=Date.now()-t,m=s.map(g=>{const f=this.subjectForKey(g.key);return g.created.getTime()>=c?this.jsm.streams.purge(this.stream,{filter:f,keep:1}):this.jsm.streams.purge(this.stream,{filter:f,keep:0})}),p=await Promise.all(m);return p.unshift({success:!0,purged:0}),p.reduce((g,f)=>(g.purged+=f.purged,g))}async _deleteOrPurge(t,r,s){if(!this.hasWildcards(t))return this._doDeleteOrPurge(t,r,s);const l=await this.keys(t),c=[];for await(const m of l)c.push(this._doDeleteOrPurge(m,r)),c.length===100&&(await Promise.all(c),c.length=0);c.length>0&&await Promise.all(c)}async _doDeleteOrPurge(t,r,s){const l=this.encodeKey(t);this.validateKey(l);const c=Sr();c.set(tu,r),r==="PURGE"&&c.set($t.RollupHdr,$t.RollupValueSubject),s!=null&&s.previousSeq&&c.set(Kn.ExpectedLastSubjectSequenceHdr,`${s.previousSeq}`),await this.js.publish(this.subjectForKey(l,!0),hn,{headers:c})}_buildCC(t,r,s={}){let c=(Array.isArray(t)?t:[t]).map(g=>{const f=this.encodeKey(g);return this.validateSearchKey(g),this.fullKeyName(f)}),m=mt.LastPerSubject;r===Un.AllHistory&&(m=mt.All),r===Un.UpdatesOnly&&(m=mt.New);let p;return c.length===1&&(p=c[0],c=void 0),Object.assign({deliver_policy:m,ack_policy:At.None,filter_subjects:c,filter_subject:p,flow_control:!0,idle_heartbeat:it(5*1e3)},s)}remove(t){return this.purge(t)}async history(t={}){const r=t.key??">",s=new jt,l={};l.headers_only=t.headers_only||!1;let c;c=()=>{s.stop()};let m=0;const p=this._buildCC(r,Un.AllHistory,l),g=p.filter_subject,f=li(p);f.bindStream(this.stream),f.orderedConsumer(),f.callback((b,v)=>{if(b){s.stop(b);return}if(v){const _=this.jmToEntry(v);s.push(_),s.received++,(c&&m>0&&s.received>=m||v.info.pending===0)&&(s.push(c),c=void 0)}});const d=await this.js.subscribe(g,f);if(c){const{info:{last:b}}=d,v=b.num_pending+b.delivered.consumer_seq;if(v===0||s.received>=v)try{c()}catch(_){s.stop(_)}finally{c=void 0}else m=v}return s._data=d,s.iterClosed.then(()=>{d.unsubscribe()}),d.closed.then(()=>{s.stop()}).catch(b=>{s.stop(b)}),s}canSetWatcherName(){const r=this.js.nc,{ok:s}=r.features.get(Ie.JS_NEW_CONSUMER_CREATE_API);return s}async watch(t={}){const r=t.key??">",s=new jt,l={};l.headers_only=t.headers_only||!1;let c=Un.LastValue;t.include===Un.AllHistory?c=Un.AllHistory:t.include===Un.UpdatesOnly&&(c=Un.UpdatesOnly);const m=t.ignoreDeletes===!0;let p=t.initializedFn,g=0;const f=this._buildCC(r,c,l),d=f.filter_subject,b=li(f);this.canSetWatcherName()&&b.consumerName(fi.next()),b.bindStream(this.stream),t.resumeFromRevision&&t.resumeFromRevision>0&&b.startSequence(t.resumeFromRevision),b.orderedConsumer(),b.callback((_,w)=>{if(_){s.stop(_);return}if(w){const S=this.jmToEntry(w);if(m&&S.operation==="DEL")return;s.push(S),s.received++,p&&(g>0&&s.received>=g||w.info.pending===0)&&(s.push(p),p=void 0)}});const v=await this.js.subscribe(d,b);if(p){const{info:{last:_}}=v,w=_.num_pending+_.delivered.consumer_seq;if(w===0||s.received>=w)try{p()}catch(S){s.stop(S)}finally{p=void 0}else g=w}return s._data=v,s.iterClosed.then(()=>{v.unsubscribe()}),v.closed.then(()=>{s.stop()}).catch(_=>{s.stop(_)}),s}async keys(t=">"){const r=new jt,s=this._buildCC(t,Un.LastValue,{headers_only:!0}),l=Array.isArray(t)?">":s.filter_subject,c=li(s);c.bindStream(this.stream),c.orderedConsumer();const m=await this.js.subscribe(l,c);return(async()=>{var g;for await(const f of m){const d=(g=f.headers)==null?void 0:g.get(tu);if(d!=="DEL"&&d!=="PURGE"){const b=this.decodeKey(f.subject.substring(this.prefixLen));r.push(b)}f.info.pending===0&&m.unsubscribe()}})().then(()=>{r.stop()}).catch(g=>{r.stop(g)}),m.info.last.num_pending===0&&m.unsubscribe(),r}purgeBucket(t){return this.jsm.streams.purge(this.bucketName(),t)}destroy(){return this.jsm.streams.delete(this.bucketName())}async status(){var c;const r=((c=this.js.nc.info)==null?void 0:c.cluster)??"",s=this.bucketName(),l=await this.jsm.streams.info(s);return new Ab(l,r)}}class Ab{constructor(t,r=""){A(this,"si");A(this,"cluster");this.si=t,this.cluster=r}get bucket(){return this.si.config.name.startsWith(cn)?this.si.config.name.substring(cn.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 Ad(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!==hi.None:!1}}const Nd="OBJ_",by="SHA-256=";function mE(i){return $c(i),`${Nd}${i}`}function pE(i){return i.startsWith(Nd)?i.substring(4):i}class od{constructor(t){A(this,"si");A(this,"backingStore");this.si=t,this.backingStore="JetStream"}get bucket(){return pE(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!==hi.None:!1}}function Xl(i){if(i===void 0)return;const{domain:t}=i;if(t===void 0)return i;const r=Object.assign({},i);if(delete r.domain,t==="")return r;if(r.external)throw new Error("domain and external are both set");return r.external={api:`$JS.${t}.API`},r}var Tn;(function(i){i[i.Unset=-1]="Unset",i[i.Consume=0]="Consume",i[i.Fetch=1]="Fetch"})(Tn||(Tn={}));var Jn;(function(i){i.HeartbeatsMissed="heartbeats_missed",i.ConsumerNotFound="consumer_not_found",i.StreamNotFound="stream_not_found",i.ConsumerDeleted="consumer_deleted",i.OrderedConsumerRecreated="ordered_consumer_recreated",i.NoResponders="no_responders"})(Jn||(Jn={}));var $s;(function(i){i.DebugEvent="debug",i.Discard="discard",i.Reset="reset",i.Next="next"})($s||($s={}));const vy=Uint8Array.of(43,65,67,75),gE=Uint8Array.of(45,78,65,75),Va=Uint8Array.of(43,87,80,73),yE=Uint8Array.of(43,78,88,84),bE=Uint8Array.of(43,84,69,82,77),vE=Uint8Array.of(32);function mo(i,t=5e3){return new BE(i,t)}class Lh extends jt{constructor(r,s,l=!1){super();A(this,"consumer");A(this,"opts");A(this,"sub");A(this,"monitor");A(this,"pending");A(this,"inbox");A(this,"refilling");A(this,"pong");A(this,"callback");A(this,"timeout");A(this,"cleanupHandler");A(this,"listeners");A(this,"statusIterator");A(this,"forOrderedConsumer");A(this,"resetHandler");A(this,"abortOnMissingResource");A(this,"bind");A(this,"inBackOff");this.consumer=r;const c=s;this.opts=this.parseOptions(s,l),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=l,this.timeout=null,this.inbox=wr(r.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:r,max_bytes:s,idle_heartbeat:l,threshold_bytes:c,threshold_messages:m}=this.opts;this.closed().then(g=>{if(this.cleanupHandler)try{this.cleanupHandler(g)}catch{}});const{sub:p}=this;p&&p.unsubscribe(),this.sub=this.consumer.api.nc.subscribe(this.inbox,{callback:(g,f)=>{var b,v,_,w;if(g){this.stop(g);return}if((b=this.monitor)==null||b.work(),f.subject===this.inbox){if(Wh(f))return;const S=(v=f.headers)==null?void 0:v.code,M=((w=(_=f.headers)==null?void 0:_.description)==null?void 0:w.toLowerCase())||"unknown",{msgsLeft:L,bytesLeft:z}=this.parseDiscard(f.headers);if(L>0||z>0)this.pending.msgs-=L,this.pending.bytes-=z,this.pending.requests--,this.notify($s.Discard,{msgsLeft:L,bytesLeft:z});else if(S===400){this.stop(new me(M,`${S}`));return}else if(S===409&&M==="consumer deleted"){if(this.notify(Jn.ConsumerDeleted,`${S} ${M}`),!this.refilling||this.abortOnMissingResource){const ie=new me(M,`${S}`);this.stop(ie);return}}else if(S===503){if(this.notify(Jn.NoResponders,`${S} No Responders`),!this.refilling||this.abortOnMissingResource){const ie=new me("no responders",`${S}`);this.stop(ie);return}}else this.notify($s.DebugEvent,`${S} ${M}`)}else this._push(mo(f,this.consumer.api.timeout)),this.received++,this.pending.msgs&&this.pending.msgs--,this.pending.bytes&&(this.pending.bytes-=f.size());if(this.pending.msgs===0&&this.pending.bytes===0&&(this.pending.requests=0),this.refilling){if(r&&this.pending.msgs<=m||s&&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()})}),l&&(this.monitor=new Td(l,g=>(this.notify(Jn.HeartbeatsMissed,g),this.resetPending().then(()=>{}).catch(()=>{}),!1),{maxOut:2})),(async()=>{var f;const g=this.consumer.api.nc.status();this.statusIterator=g;for await(const d of g)switch(d.type){case _r.Disconnect:(f=this.monitor)==null||f.cancel();break;case _r.Reconnect:this.resetPending().then(b=>{var v;b&&((v=this.monitor)==null||v.restart())}).catch(()=>{});break}})(),this.pull(this.pullOptions())}_push(r){if(!this.callback)super.push(r);else{const s=typeof r=="function"?r:null;try{s?s():this.callback(r)}catch(l){this.stop(l)}}}notify(r,s){this.listeners.length>0&&this.listeners.forEach(l=>{l.done||l.push({type:r,data:s})})}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 r=0,s=0;const l=Od([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,r=0,this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),!0}catch(m){if(m.message==="stream not found"){if(s++,this.notify(Jn.StreamNotFound,s),!this.refilling||this.abortOnMissingResource)return this.stop(m),!1}else if(m.message==="consumer not found"){if(r++,this.notify(Jn.ConsumerNotFound,r),this.resetHandler)try{this.resetHandler()}catch{}if(!this.refilling||this.abortOnMissingResource)return this.stop(m),!1;if(this.forOrderedConsumer)return!1}else r=0,s=0;this.inBackOff=!0;const p=l.backoff(c),g=Ys(p);await Promise.race([g,this.consumer.api.nc.closed()]),g.cancel(),c++}}}pull(r){this.pending.bytes+=r.max_bytes??0,this.pending.msgs+=r.batch??0,this.pending.requests++;const s=this.consumer.api.nc;this._push(()=>{s.publish(`${this.consumer.api.prefix}.CONSUMER.MSG.NEXT.${this.consumer.stream}.${this.consumer.name}`,this.consumer.api.jc.encode(r),{reply:this.inbox}),this.notify($s.Next,r)})}pullOptions(){const r=this.opts.max_messages-this.pending.msgs,s=this.opts.max_bytes-this.pending.bytes,l=it(this.opts.idle_heartbeat),c=it(this.opts.expires);return{batch:r,max_bytes:s,idle_heartbeat:l,expires:c}}parseDiscard(r){const s={msgsLeft:0,bytesLeft:0},l=r==null?void 0:r.get($t.PendingMessagesHdr);l&&(s.msgsLeft=parseInt(l));const c=r==null?void 0:r.get($t.PendingBytesHdr);return c&&(s.bytesLeft=parseInt(c)),s}trackTimeout(r){this.timeout=r}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}clearTimers(){var r,s;(r=this.monitor)==null||r.cancel(),this.monitor=null,(s=this.timeout)==null||s.cancel(),this.timeout=null}setCleanupHandler(r){this.cleanupHandler=r}stop(r){var s,l;this.done||((s=this.sub)==null||s.unsubscribe(),this.clearTimers(),(l=this.statusIterator)==null||l.stop(),this._push(()=>{super.stop(r),this.listeners.forEach(c=>{c.stop()})}))}parseOptions(r,s=!1){const l=r||{};if(l.max_messages=l.max_messages||0,l.max_bytes=l.max_bytes||0,l.max_messages!==0&&l.max_bytes!==0)throw new Error("only specify one of max_messages or max_bytes");if(l.max_messages===0&&(l.max_messages=100),l.expires=l.expires||3e4,l.expires<1e3)throw new Error("expires should be at least 1000ms");if(l.idle_heartbeat=l.idle_heartbeat||l.expires/2,l.idle_heartbeat=l.idle_heartbeat>3e4?3e4:l.idle_heartbeat,s){const c=Math.round(l.max_messages*.75)||1;l.threshold_messages=l.threshold_messages||c;const m=Math.round(l.max_bytes*.75)||1;l.threshold_bytes=l.threshold_bytes||m}return l}status(){const r=new jt;return this.listeners.push(r),Promise.resolve(r)}}class xE extends jt{constructor(){super();A(this,"src");A(this,"listeners");this.listeners=[]}setSource(r){this.src&&(this.src.resetHandler=void 0,this.src.setCleanupHandler(),this.src.stop()),this.src=r,this.src.setCleanupHandler(s=>{this.stop(s||void 0)}),(async()=>{const s=await this.src.status();for await(const l of s)this.notify(l.type,l.data)})().catch(()=>{})}notify(r,s){this.listeners.length>0&&this.listeners.forEach(l=>{l.done||l.push({type:r,data:s})})}stop(r){var s;this.done||((s=this.src)==null||s.stop(r),super.stop(r),this.listeners.forEach(l=>{l.stop()}))}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}status(){const r=new jt;return this.listeners.push(r),Promise.resolve(r)}}class ld{constructor(t,r){A(this,"api");A(this,"_info");A(this,"stream");A(this,"name");this.api=t,this._info=r,this.stream=r.stream_name,this.name=r.name}consume(t={max_messages:100,expires:3e4}){return Promise.resolve(new Lh(this,t,!0))}fetch(t={max_messages:100,expires:3e4}){const r=new Lh(this,t,!1),s=Math.round(r.opts.expires*1.05),l=Gs(s);return r.closed().catch(()=>{}).finally(()=>{l.cancel()}),l.catch(()=>{r.close().catch()}),r.trackTimeout(l),Promise.resolve(r)}next(t={expires:3e4}){const r=st(),s=t;s.max_messages=1;const l=new Lh(this,s,!1),c=Math.round(l.opts.expires*1.05);c>=6e4&&(async()=>{for await(const p of await l.status())if(p.type===Jn.HeartbeatsMissed&&p.data>=2){r.reject(new Error("consumer missed heartbeats"));break}})().catch(),(async()=>{for await(const p of l){r.resolve(p);break}})().catch(()=>{});const m=Gs(c);return l.closed().then(p=>{p?r.reject(p):r.resolve(null)}).catch(p=>{r.reject(p)}).finally(()=>{m.cancel()}),m.catch(p=>{r.resolve(null),l.close().catch()}),l.trackTimeout(m),r}delete(){const{stream_name:t,name:r}=this._info;return this.api.delete(t,r)}info(t=!1){if(t)return Promise.resolve(this._info);const{stream_name:r,name:s}=this._info;return this.api.info(r,s).then(l=>(this._info=l,this._info))}}class _E{constructor(t,r,s={}){A(this,"api");A(this,"consumerOpts");A(this,"consumer");A(this,"opts");A(this,"cursor");A(this,"stream");A(this,"namePrefix");A(this,"serial");A(this,"currentConsumer");A(this,"userCallback");A(this,"iter");A(this,"type");A(this,"startSeq");A(this,"maxInitialReset");this.api=t,this.stream=r,this.cursor={stream_seq:1,deliver_seq:0},this.namePrefix=fi.next(),typeof s.name_prefix=="string"&&(cu("name_prefix",s.name_prefix),this.namePrefix=s.name_prefix+this.namePrefix),this.serial=0,this.currentConsumer=null,this.userCallback=null,this.iter=null,this.type=Tn.Unset,this.consumerOpts=s,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 r=`${this.namePrefix}_${this.serial}`;t=t===0?1:t;const s={name:r,deliver_policy:mt.StartSequence,opt_start_seq:t,ack_policy:At.None,inactive_threshold:it(300*1e3),num_replicas:1};return this.consumerOpts.headers_only===!0&&(s.headers_only=!0),Array.isArray(this.consumerOpts.filterSubjects)&&(s.filter_subjects=this.consumerOpts.filterSubjects),typeof this.consumerOpts.filterSubjects=="string"&&(s.filter_subject=this.consumerOpts.filterSubjects),this.consumerOpts.replay_policy&&(s.replay_policy=this.consumerOpts.replay_policy),t===this.startSeq+1&&(s.deliver_policy=this.consumerOpts.deliver_policy||mt.StartSequence,(this.consumerOpts.deliver_policy===mt.LastPerSubject||this.consumerOpts.deliver_policy===mt.New||this.consumerOpts.deliver_policy===mt.Last)&&(delete s.opt_start_seq,s.deliver_policy=this.consumerOpts.deliver_policy),s.deliver_policy===mt.LastPerSubject&&typeof s.filter_subjects>"u"&&typeof s.filter_subject>"u"&&(s.filter_subject=">"),this.consumerOpts.opt_start_time&&(delete s.opt_start_seq,s.deliver_policy=mt.StartTime,s.opt_start_time=this.consumerOpts.opt_start_time),this.consumerOpts.inactive_threshold&&(s.inactive_threshold=it(this.consumerOpts.inactive_threshold))),s}async resetConsumer(t=0){var m,p,g,f,d;fi.next();const r=this.serial===0;(m=this.consumer)==null||m.delete().catch(()=>{}),t=t===0?1:t,this.cursor.deliver_seq=0;const s=this.getConsumerOpts(t);s.max_deliver=1,s.mem_storage=!0;const l=Od([((p=this.opts)==null?void 0:p.expires)||3e4]);let c;for(let b=0;;b++)try{c=await this.api.add(this.stream,s),(g=this.iter)==null||g.notify(Jn.OrderedConsumerRecreated,c.name);break}catch(v){if(v.message==="stream not found"&&((f=this.iter)==null||f.notify(Jn.StreamNotFound,b),this.type===Tn.Fetch||this.opts.abort_on_missing_resource===!0))return(d=this.iter)==null||d.stop(v),Promise.reject(v);if(r&&b>=this.maxInitialReset)throw v;await Ys(l.backoff(b+1))}return c}internalHandler(t){return r=>{var l;if(this.serial!==t)return;const s=r.info.deliverySequence;if(s!==this.cursor.deliver_seq+1){this.notifyOrderedResetAndReset();return}this.cursor.deliver_seq=s,this.cursor.stream_seq=r.info.streamSequence,this.userCallback?this.userCallback(r):(l=this.iter)==null||l.push(r)}}async reset(t={max_messages:100,expires:3e4},r){var g,f;r=r||{};const s=r.fromFetch||!1,l=r.orderedReset||!1;if(this.type===Tn.Fetch&&l){(g=this.iter)==null||g.src.stop(),await((f=this.iter)==null?void 0:f.closed()),this.currentConsumer=null;return}(this.currentConsumer===null||l)&&(this.currentConsumer=await this.resetConsumer(this.cursor.stream_seq+1)),(this.iter===null||s)&&(this.iter=new xE),this.consumer=new ld(this.api,this.currentConsumer);const c=t;c.callback=this.internalHandler(this.serial);let m=null;this.type===Tn.Fetch&&s?m=await this.consumer.fetch(t):this.type===Tn.Consume&&(m=await this.consumer.consume(t));const p=m;p.forOrderedConsumer=!0,p.resetHandler=()=>{this.notifyOrderedResetAndReset()},this.iter.setSource(p)}notifyOrderedResetAndReset(){var t;(t=this.iter)==null||t.notify($s.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===Tn.Fetch)return Promise.reject(new Error("ordered consumer initialized as fetch"));if(this.type===Tn.Consume)return Promise.reject(new Error("ordered consumer doesn't support concurrent consume"));const{callback:s}=t;return s&&(this.userCallback=s),this.type=Tn.Consume,this.opts=t,await this.reset(t),this.iter}async fetch(t={max_messages:100,expires:3e4}){var l;if(t.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===Tn.Consume)return Promise.reject(new Error("ordered consumer already initialized as consume"));if(((l=this.iter)==null?void 0:l.done)===!1)return Promise.reject(new Error("ordered consumer doesn't support concurrent fetch"));const{callback:s}=t;return s&&(this.userCallback=s),this.type=Tn.Fetch,this.opts=t,await this.reset(t,{fromFetch:!0}),this.iter}async next(t={expires:3e4}){const r=t;if(r.bind)return Promise.reject(new Error("bind is not supported"));r.max_messages=1;const s=st();return r.callback=c=>{this.userCallback=null,s.resolve(c)},(await this.fetch(r)).iterClosed.then(c=>{c&&s.reject(c),s.resolve(null)}).catch(c=>{s.reject(c)}),s}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 cd{constructor(t){A(this,"api");A(this,"notified");this.api=t,this.notified=!1}checkVersion(){const t=this.api.nc.features.get(Ie.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 ld(this.api,t)}async get(t,r={}){return typeof r=="object"?this.ordered(t,r):(await this.checkVersion(),this.api.info(t,r).then(s=>s.config.deliver_subject!==void 0?Promise.reject(new Error("push consumer not supported")):new ld(this.api,s)).catch(s=>Promise.reject(s)))}async ordered(t,r){await this.checkVersion();const s=this.api;return new kd(s.nc,s.opts).info(t).then(c=>Promise.resolve(new _E(this.api,t,r))).catch(c=>Promise.reject(c))}}class fu{constructor(t,r){A(this,"api");A(this,"_info");this.api=t,this._info=r}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 fu(this.api,t)}else return this}info(t=!1,r){return t?Promise.resolve(this._info):this.api.info(this.name,r).then(s=>(this._info=s,this._info))}getConsumerFromInfo(t){return new cd(new Zc(this.api.nc,this.api.opts)).getPullConsumerFor(t)}getConsumer(t){return new cd(new Zc(this.api.nc,this.api.opts)).get(this.name,t)}getMessage(t){return this.api.getMessage(this.name,t)}deleteMessage(t,r){return this.api.deleteMessage(this.name,t,r)}}class kd extends yo{constructor(t,r){super(t,r)}checkStreamConfigVersions(t){const r=this.nc;if(t.metadata){const{min:l,ok:c}=r.features.get(Ie.JS_STREAM_CONSUMER_METADATA);if(!c)throw new Error(`stream 'metadata' requires server ${l}`)}if(t.first_seq){const{min:l,ok:c}=r.features.get(Ie.JS_STREAM_FIRST_SEQ);if(!c)throw new Error(`stream 'first_seq' requires server ${l}`)}if(t.subject_transform){const{min:l,ok:c}=r.features.get(Ie.JS_STREAM_SUBJECT_TRANSFORM);if(!c)throw new Error(`stream 'subject_transform' requires server ${l}`)}if(t.compression){const{min:l,ok:c}=r.features.get(Ie.JS_STREAM_COMPRESSION);if(!c)throw new Error(`stream 'compression' requires server ${l}`)}if(t.consumer_limits){const{min:l,ok:c}=r.features.get(Ie.JS_DEFAULT_CONSUMER_LIMITS);if(!c)throw new Error(`stream 'consumer_limits' requires server ${l}`)}function s(l,c){var p;if((((p=c==null?void 0:c.subject_transforms)==null?void 0:p.length)||0)>0){const{min:g,ok:f}=r.features.get(Ie.JS_STREAM_SOURCE_SUBJECT_TRANSFORM);if(!f)throw new Error(`${l} 'subject_transforms' requires server ${g}`)}}t.sources&&t.sources.forEach(l=>{s("stream sources",l)}),t.mirror&&s("stream mirror",t.mirror)}async add(t={}){var l;this.checkStreamConfigVersions(t),Pt(t.name),t.mirror=Xl(t.mirror),t.sources=(l=t.sources)==null?void 0:l.map(Xl);const s=await this._request(`${this.prefix}.STREAM.CREATE.${t.name}`,t);return this._fixInfo(s),s}async delete(t){return Pt(t),(await this._request(`${this.prefix}.STREAM.DELETE.${t}`)).success}async update(t,r={}){var p;if(typeof t=="object"){const g=t;t=g.name,r=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(r),Pt(t);const s=await this.info(t),l=Object.assign(s.config,r);l.mirror=Xl(l.mirror),l.sources=(p=l.sources)==null?void 0:p.map(Xl);const m=await this._request(`${this.prefix}.STREAM.UPDATE.${t}`,l);return this._fixInfo(m),m}async info(t,r){Pt(t);const s=`${this.prefix}.STREAM.INFO.${t}`;let c=await this._request(s,r),{total:m,limit:p}=c,g=c.state.subjects?Object.getOwnPropertyNames(c.state.subjects).length:1;if(m&&m>g){const f=[c],d=r||{};let b=0;for(;m>g;){b++,d.offset=p*b;const _=await this._request(s,d);m=_.total,f.push(_);const w=Object.getOwnPropertyNames(_.state.subjects).length;if(g+=w,w<p)break}let v={};for(let _=0;_<f.length;_++)c=f[_],c.state.subjects&&(v=Object.assign(v,c.state.subjects));c.offset=0,c.total=0,c.limit=0,c.state.subjects=v}return this._fixInfo(c),c}list(t=""){const r=t!=null&&t.length?{subject:t}:{},s=c=>{const m=c;return m.streams.forEach(p=>{this._fixInfo(p)}),m.streams},l=`${this.prefix}.STREAM.LIST`;return new ro(l,s,this,r)}_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,r){if(r){const{keep:l,seq:c}=r;if(typeof l=="number"&&typeof c=="number")throw new Error("can specify one of keep or seq")}return Pt(t),await this._request(`${this.prefix}.STREAM.PURGE.${t}`,r)}async deleteMessage(t,r,s=!0){Pt(t);const l={seq:r};return s||(l.no_erase=!0),(await this._request(`${this.prefix}.STREAM.MSG.DELETE.${t}`,l)).success}async getMessage(t,r){Pt(t);const l=await this._request(`${this.prefix}.STREAM.MSG.GET.${t}`,r);return new jb(l)}find(t){return this.findStream(t)}listKvs(){const t=s=>{var g;const c=s.streams.filter(f=>f.config.name.startsWith(cn));c.forEach(f=>{this._fixInfo(f)});let m="";return c.length&&(m=((g=this.nc.info)==null?void 0:g.cluster)??""),c.map(f=>new Ab(f,m))},r=`${this.prefix}.STREAM.LIST`;return new ro(r,t,this)}listObjectStores(){const t=s=>{const c=s.streams.filter(p=>p.config.name.startsWith(Nd));return c.forEach(p=>{this._fixInfo(p)}),c.map(p=>new od(p))},r=`${this.prefix}.STREAM.LIST`;return new ro(r,t,this)}names(t=""){const r=t!=null&&t.length?{subject:t}:{},s=c=>c.streams,l=`${this.prefix}.STREAM.NAMES`;return new ro(l,s,this,r)}async get(t){const r=await this.info(t);return Promise.resolve(new fu(this,r))}}class wE extends yo{constructor(t,r){super(t,r)}async getMessage(t,r){Pt(t);let s=r;const{last_by_subj:l}=s;l&&(s=null);const c=s?this.jc.encode(s):hn,m=this.opts.apiPrefix||"$JS.API",p=l?`${m}.DIRECT.GET.${t}.${l}`:`${m}.DIRECT.GET.${t}`,g=await this.nc.request(p,c,{timeout:this.timeout}),f=Ps(g);if(f)return Promise.reject(f);const d=new ud(g);return Promise.resolve(d)}async getBatch(t,r){Pt(t);const l=`${this.opts.apiPrefix||"$JS.API"}.DIRECT.GET.${t}`;if(!Array.isArray(r.multi_last)||r.multi_last.length===0)return Promise.reject("multi_last is required");const c=JSON.stringify(r,(g,f)=>g==="up_to_time"&&f instanceof Date?f.toISOString():f),m=new jt,p=await this.nc.requestMany(l,c,{strategy:In.SentinelMsg});return(async()=>{var b,v,_;let g=!1,f=!1,d;for await(const w of p){if(!g){g=!0;const S=((b=w.headers)==null?void 0:b.code)||0;if(S!==0&&S<200||S>299){d=(v=w.headers)==null?void 0:v.description.toLowerCase();break}if(((_=w.headers)==null?void 0:_.get("Nats-Num-Pending"))===""){f=!0;break}}if(w.data.length===0)break;m.push(new ud(w))}m.push(()=>{if(f)throw new Error("batch direct get not supported by the server");if(d)throw new Error(`bad request: ${d}`);m.stop()})})(),Promise.resolve(m)}}class ud{constructor(t){A(this,"data");A(this,"header");if(!t.headers)throw new Error("headers expected");this.data=t.data,this.header=t.headers}get subject(){return this.header.last(Bs.Subject)}get seq(){const t=this.header.last(Bs.Sequence);return typeof t=="string"?parseInt(t):0}get time(){return new Date(Date.parse(this.timestamp))}get timestamp(){return this.header.last(Bs.TimeStamp)}get stream(){return this.header.last(Bs.Stream)}json(t){return $n(t).decode(this.data)}string(){return un.decode(this.data)}}A(ud,"jc");class SE extends yo{constructor(r,s){super(r,s);A(this,"streams");A(this,"consumers");A(this,"direct");this.streams=new kd(r,s),this.consumers=new Zc(r,s),this.direct=new wE(r,s)}async getAccountInfo(){return await this._request(`${this.prefix}.INFO`)}jetstream(){return this.nc.jetstream(this.getOptions())}advisories(){const r=new jt;return this.nc.subscribe("$JS.EVENT.ADVISORY.>",{callback:(s,l)=>{if(s)throw s;try{const c=this.parseJsResponse(l),m=c.type.split("."),p=m[m.length-1];r.push({kind:p,data:c})}catch(c){r.stop(c)}}}),r}}class jb{constructor(t){A(this,"_header");A(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):hn}get header(){if(!this._header)if(this.smr.message.hdrs){const t=this._parse(this.smr.message.hdrs);this._header=oi.decode(t)}else this._header=Sr();return this._header}_parse(t){const r=atob(t),s=r.length,l=new Uint8Array(s);for(let c=0;c<s;c++)l[c]=r.charCodeAt(c);return l}json(t){return $n(t).decode(this.data)}string(){return un.decode(this.data)}}A(jb,"jc");class EE{constructor(t){A(this,"api");this.api=t}get(t){return this.api.info(t).then(r=>new fu(this.api,r))}}class zh{constructor(t){A(this,"info");A(this,"hdrs");this.info=t}get name(){return this.info.name}get description(){return this.info.description??""}get headers(){return this.hdrs||(this.hdrs=oi.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,r;return((t=this.info.options)==null?void 0:t.link)!==void 0&&((r=this.info.options)==null?void 0:r.link)!==null}}function xy(i){const t={name:i.name,description:i.description??"",options:i.options,metadata:i.metadata};if(i.headers){const r=i.headers;t.headers=r.toRecord()}return t}function OE(){return new ReadableStream({pull(i){i.enqueue(new Uint8Array(0)),i.close()}})}class lo{constructor(t,r,s){A(this,"jsm");A(this,"js");A(this,"stream");A(this,"name");this.name=t,this.jsm=r,this.js=s}_checkNotEmpty(t){return!t||t.length===0?{name:t,error:new Error("name cannot be empty")}:{name:t}}async info(t){const r=await this.rawInfo(t);return r?new zh(r):null}async list(){const t=[],r=await this.watch({ignoreDeletes:!0,includeHistory:!0});for await(const s of r){if(s===null)break;t.push(s)}return Promise.resolve(t)}async rawInfo(t){const{name:r,error:s}=this._checkNotEmpty(t);if(s)return Promise.reject(s);const l=this._metaSubject(r);try{const c=await this.jsm.streams.getMessage(this.stream,{last_by_subj:l}),p=$n().decode(c.data);return p.revision=c.seq,p}catch(c){return c.code==="404"?null:Promise.reject(c)}}async _si(t){try{return await this.jsm.streams.info(this.stream,t)}catch(r){return r.code==="404"?null:Promise.reject(r)}}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 od(t)))}async status(t){const r=await this._si(t);return r===null?Promise.reject(new Error("object store not found")):Promise.resolve(new od(r))}destroy(){return this.jsm.streams.delete(this.stream)}async _put(t,r,s){var ae;const l=this.js.getOptions();s=s||{timeout:l.timeout},s.timeout=s.timeout||l.timeout,s.previousRevision=s.previousRevision??void 0;const{timeout:c,previousRevision:m}=s,p=this.js.nc.info,g=(p==null?void 0:p.max_payload)||1024;t=t||{},t.options=t.options||{};let f=((ae=t.options)==null?void 0:ae.max_chunk_size)||128*1024;f=f>g?g:f,t.options.max_chunk_size=f;const d=await this.info(t.name),{name:b,error:v}=this._checkNotEmpty(t.name);if(v)return Promise.reject(v);const _=fi.next(),w=this._chunkSubject(_),S=this._metaSubject(b),M=Object.assign({bucket:this.name,nuid:_,size:0,chunks:0},xy(t)),L=st(),z=[],ie=new Vs;try{const C=r?r.getReader():null,I=cy.create();for(;;){const{done:re,value:K}=C?await C.read():{done:!0,value:void 0};if(re){if(ie.size()>0){const Q=ie.drain();I.update(Q),M.chunks++,M.size+=Q.length,z.push(this.js.publish(w,Q,{timeout:c}))}await Promise.all(z),z.length=0,M.mtime=new Date().toISOString();const B=Is.encode(I.digest());M.digest=`${by}${B}`,M.deleted=!1;const G=Sr();typeof m=="number"&&G.set(Kn.ExpectedLastSubjectSequenceHdr,`${m}`),G.set($t.RollupHdr,$t.RollupValueSubject);const W=await this.js.publish(S,$n().encode(M),{headers:G,timeout:c});if(M.revision=W.seq,d)try{await this.jsm.streams.purge(this.stream,{filter:`$O.${this.name}.C.${d.nuid}`})}catch{}L.resolve(new zh(M));break}if(K)for(ie.fill(K);ie.size()>f;){M.chunks++,M.size+=f;const B=ie.drain(t.options.max_chunk_size);I.update(B),z.push(this.js.publish(w,B,{timeout:c}))}}}catch(C){await this.jsm.streams.purge(this.stream,{filter:w}),L.reject(C)}return L}putBlob(t,r,s){function l(c){return new ReadableStream({pull(m){m.enqueue(c),m.close()}})}return r===null&&(r=new Uint8Array(0)),this.put(t,l(r),s)}put(t,r,s){var l;return(l=t==null?void 0:t.options)!=null&&l.link?Promise.reject(new Error("link cannot be set when putting the object in bucket")):this._put(t,r,s)}async getBlob(t){async function r(c){const m=new Vs,p=c.getReader();for(;;){const{done:g,value:f}=await p.read();if(g)return m.drain();f&&f.length&&m.fill(f)}}const s=await this.get(t);if(s===null)return Promise.resolve(null);const l=await Promise.all([s.error,r(s.data)]);return l[0]?Promise.reject(l[0]):Promise.resolve(l[1])}async get(t){const r=await this.rawInfo(t);if(r===null||r.deleted)return Promise.resolve(null);if(r.options&&r.options.link){const b=r.options.link.name||"";if(b==="")throw new Error("link is a bucket");return(r.options.link.bucket!==this.name?await lo.create(this.js,r.options.link.bucket):this).get(b)}if(!r.digest.startsWith(by))return Promise.reject(new Error(`unknown digest type: ${r.digest}`));const s=nd(r.digest.substring(8));if(s===null)return Promise.reject(new Error(`unable to parse digest: ${r.digest}`));const l=st(),c={info:new zh(r),error:l};if(r.size===0)return c.data=OE(),l.resolve(null),Promise.resolve(c);let m;const p=li();p.orderedConsumer();const g=cy.create(),f=`$O.${this.name}.C.${r.nuid}`,d=await this.js.subscribe(f,p);return(async()=>{for await(const b of d)b.data.length>0&&(g.update(b.data),m.enqueue(b.data)),b.info.pending===0&&(dS(s,g.digest())?m.close():m.error(new Error(`received a corrupt object, digests do not match received: ${r.digest} calculated ${s}`)),d.unsubscribe())})().then(()=>{l.resolve()}).catch(b=>{m.error(b),l.reject(b)}),c.data=new ReadableStream({start(b){m=b},cancel(){d.unsubscribe()}}),c}linkStore(t,r){if(!(r instanceof lo))return Promise.reject("bucket required");const s=r,{name:l,error:c}=this._checkNotEmpty(t);if(c)return Promise.reject(c);const m={name:l,options:{link:{bucket:s.name}}};return this._put(m,null)}async link(t,r){const{name:s,error:l}=this._checkNotEmpty(t);if(l)return Promise.reject(l);if(r.deleted)return Promise.reject(new Error("src object is deleted"));if(r.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 m={bucket:r.bucket,name:r.name},p={name:s,bucket:r.bucket,options:{link:m}};await this.js.publish(this._metaSubject(t),JSON.stringify(p));const g=await this.info(t);return Promise.resolve(g)}async delete(t){const r=await this.rawInfo(t);if(r===null)return Promise.resolve({purged:0,success:!1});r.deleted=!0,r.size=0,r.chunks=0,r.digest="";const s=$n(),l=Sr();return l.set($t.RollupHdr,$t.RollupValueSubject),await this.js.publish(this._metaSubject(r.name),s.encode(r),{headers:l}),this.jsm.streams.purge(this.stream,{filter:this._chunkSubject(r.nuid)})}async update(t,r={}){const s=await this.rawInfo(t);if(s===null)return Promise.reject(new Error("object not found"));if(s.deleted)return Promise.reject(new Error("cannot update meta for a deleted object"));r.name=r.name??s.name;const{name:l,error:c}=this._checkNotEmpty(r.name);if(c)return Promise.reject(c);if(t!==r.name){const g=await this.info(r.name);if(g&&!g.deleted)return Promise.reject(new Error("an object already exists with that name"))}r.name=l;const m=Object.assign({},s,xy(r)),p=await this.js.publish(this._metaSubject(m.name),JSON.stringify(m));return t!==r.name&&await this.jsm.streams.purge(this.stream,{filter:this._metaSubject(t)}),Promise.resolve(p)}async watch(t={}){t.includeHistory=t.includeHistory??!1,t.ignoreDeletes=t.ignoreDeletes??!1;let r=!1;const s=new jt,l=this._metaSubjectAll();try{await this.jsm.streams.getMessage(this.stream,{last_by_subj:l})}catch(g){g.code==="404"?(s.push(null),r=!0):s.stop(g)}const c=$n(),m=li();m.orderedConsumer(),t.includeHistory?m.deliverLastPerSubject():(r=!0,m.deliverNew()),m.callback((g,f)=>{var d;if(g){s.stop(g);return}if(f!==null){const b=c.decode(f.data);b.deleted&&t.ignoreDeletes===!0||s.push(b),((d=f.info)==null?void 0:d.pending)===0&&!r&&(r=!0,s.push(null))}});const p=await this.js.subscribe(l,m);return s._data=p,s.iterClosed.then(()=>{p.unsubscribe()}),p.closed.then(()=>{s.stop()}).catch(g=>{s.stop(g)}),s}_chunkSubject(t){return`$O.${this.name}.C.${t}`}_metaSubject(t){return`$O.${this.name}.M.${Is.encode(t)}`}_metaSubjectAll(){return`$O.${this.name}.M.>`}async init(t={}){try{this.stream=mE(this.name)}catch(l){return Promise.reject(l)}const r=(t==null?void 0:t.ttl)||0;delete t.ttl;const s=Object.assign({max_age:r},t);s.name=this.stream,s.num_replicas=t.replicas??1,s.allow_direct=!0,s.allow_rollup_hdrs=!0,s.discard=uo.New,s.subjects=[`$O.${this.name}.C.>`,`$O.${this.name}.M.>`],t.placement&&(s.placement=t.placement),t.metadata&&(s.metadata=t.metadata),typeof t.compression=="boolean"&&(s.compression=t.compression?hi.S2:hi.None);try{await this.jsm.streams.info(s.name)}catch(l){l.message==="stream not found"&&await this.jsm.streams.add(s)}}static async create(t,r,s={}){const l=await t.jetstreamManager(),c=new lo(r,l,t);return await c.init(s),Promise.resolve(c)}}class AE{constructor(t){A(this,"js");this.js=t}kv(t,r={}){const s=this.js,{ok:l,min:c}=s.nc.features.get(Ie.JS_KV);return l?r.bindOnly?ho.bind(this.js,t,r):ho.create(this.js,t,r):Promise.reject(new Error(`kv is only supported on servers ${c} or better`))}os(t,r={}){var m;if(typeof((m=crypto==null?void 0:crypto.subtle)==null?void 0:m.digest)!="function")return Promise.reject(new Error("objectstore: unable to calculate hashes - crypto.subtle.digest with sha256 support is required"));const s=this.js,{ok:l,min:c}=s.nc.features.get(Ie.JS_OBJECTSTORE);return l?lo.create(this.js,t,r):Promise.reject(new Error(`objectstore is only supported on servers ${c} or better`))}}class Cd extends yo{constructor(r,s){super(r,s);A(this,"consumers");A(this,"streams");A(this,"consumerAPI");A(this,"streamAPI");this.consumerAPI=new Zc(r,s),this.streamAPI=new kd(r,s),this.consumers=new cd(this.consumerAPI),this.streams=new EE(this.streamAPI)}jetstreamManager(r){r===void 0&&(r=this.opts.checkAPI);const s=Object.assign({},this.opts,{checkAPI:r});return this.nc.jetstreamManager(s)}get apiPrefix(){return this.prefix}get views(){return new AE(this)}async publish(r,s=hn,l){l=l||{},l.expect=l.expect||{};const c=(l==null?void 0:l.headers)||Sr();l&&(l.msgID&&c.set(Kn.MsgIdHdr,l.msgID),l.expect.lastMsgID&&c.set(Kn.ExpectedLastMsgIdHdr,l.expect.lastMsgID),l.expect.streamName&&c.set(Kn.ExpectedStreamHdr,l.expect.streamName),typeof l.expect.lastSequence=="number"&&c.set(Kn.ExpectedLastSeqHdr,`${l.expect.lastSequence}`),typeof l.expect.lastSubjectSequence=="number"&&c.set(Kn.ExpectedLastSubjectSequenceHdr,`${l.expect.lastSubjectSequence}`));const m=l.timeout||this.timeout,p={};m&&(p.timeout=m),l&&(p.headers=c);let{retries:g,retry_delay:f}=l;g=g||1,f=f||250;let d;for(let v=0;v<g;v++)try{d=await this.nc.request(r,s,p);break}catch(_){if(_.code==="503"&&v+1<g)await Ys(f);else throw _}const b=this.parseJsResponse(d);if(b.stream==="")throw me.errorForCode(ce.JetStreamInvalidAck);return b.duplicate=b.duplicate?b.duplicate:!1,b}async pull(r,s,l=0){Pt(r),Us(s);let c=this.timeout;l>c&&(c=l),l=l<0?0:it(l);const m={batch:1,no_wait:l===0,expires:l},p=await this.nc.request(`${this.prefix}.CONSUMER.MSG.NEXT.${r}.${s}`,this.jc.encode(m),{noMux:!0,timeout:c}),g=Ps(p);if(g)throw g;return mo(p,this.timeout)}fetch(r,s,l={}){Pt(r),Us(s);let c=null;const m=(l.max_bytes??0)>0;let p=0;const g=m?l.max_bytes:0;let f=null;const d={};if(d.batch=l.batch||1,g){const z=this.nc.features.get(Ie.JS_PULL_MAX_BYTES);if(!z.ok)throw new Error(`max_bytes is only supported on servers ${z.min} or better`);d.max_bytes=g}d.no_wait=l.no_wait||!1,d.no_wait&&d.expires&&(d.expires=0);const b=l.expires||0;if(b&&(d.expires=it(b)),b===0&&d.no_wait===!1)throw new Error("expires or no_wait is required");const v=l.idle_heartbeat||0;v&&(d.idle_heartbeat=it(v),l.delay_heartbeat===!0&&(d.idle_heartbeat=it(v*4)));const _=new jt,w=d.batch;let S=0;_.protocolFilterFn=(z,ie=!1)=>Wh(z.msg)?(f==null||f.work(),!1):!0,_.dispatchedFn=z=>{if(z){if(m&&(p+=z.data.length),S++,c&&z.info.pending===0)return;(_.getPending()===1&&z.info.pending===0||w===S||g>0&&p>=g)&&_.stop()}};const M=wr(this.nc.options.inboxPrefix),L=this.nc.subscribe(M,{max:l.batch,callback:(z,ie)=>{z===null&&(z=Ps(ie)),z!==null?(c&&(c.cancel(),c=null),Xw(z)?_.stop(Nb(z)===null?void 0:z):_.stop(z)):(f==null||f.work(),_.received++,_.push(mo(ie,this.timeout)))}});return b&&(c=Gs(b),c.catch(()=>{L.isClosed()||(L.drain().catch(()=>{}),c=null),f&&f.cancel()})),(async()=>{try{v&&(f=new Td(v,z=>(_.push(()=>{_.err=new me(`${Nn.IdleHeartbeatMissed}: ${z}`,ce.JetStreamIdleHeartBeat)}),!0)))}catch{}await L.closed,c!==null&&(c.cancel(),c=null),f&&f.cancel(),_.stop()})().catch(),this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${r}.${s}`,this.jc.encode(d),{reply:M}),_}async pullSubscribe(r,s=li()){const l=await this._processOptions(r,s);if(l.ordered)throw new Error("pull subscribers cannot be be ordered");if(l.config.deliver_subject)throw new Error("consumer info specifies deliver_subject - pull consumers cannot have deliver_subject set");const c=l.config.ack_policy;if(c===At.None||c===At.All)throw new Error("ack policy for pull consumers must be explicit");const m=this._buildTypedSubscriptionOpts(l),p=new kE(this,l.deliver,m);p.info=l;try{await this._maybeCreateConsumer(l)}catch(g){throw p.unsubscribe(),g}return p}async subscribe(r,s=li()){const l=await this._processOptions(r,s);if(!l.isBind&&!l.config.deliver_subject)throw new Error("push consumer requires deliver_subject");const c=this._buildTypedSubscriptionOpts(l),m=new Tb(this,l.deliver,c);m.info=l;try{await this._maybeCreateConsumer(l)}catch(p){throw m.unsubscribe(),p}return m._maybeSetupHbMonitoring(),m}async _processOptions(r,s=li()){const l=sy(s)?s.getOpts():s;if(l.isBind=sy(s)?s.isBind:!1,l.flow_control={heartbeat_count:0,fc_count:0,consumer_restarts:0},l.ordered){if(l.ordered_consumer_sequence={stream_seq:0,delivery_seq:0},l.config.ack_policy!==At.NotSet&&l.config.ack_policy!==At.None)throw new me("ordered consumer: ack_policy can only be set to 'none'",ce.ApiError);if(l.config.durable_name&&l.config.durable_name.length>0)throw new me("ordered consumer: durable_name cannot be set",ce.ApiError);if(l.config.deliver_subject&&l.config.deliver_subject.length>0)throw new me("ordered consumer: deliver_subject cannot be set",ce.ApiError);if(l.config.max_deliver!==void 0&&l.config.max_deliver>1)throw new me("ordered consumer: max_deliver cannot be set",ce.ApiError);if(l.config.deliver_group&&l.config.deliver_group.length>0)throw new me("ordered consumer: deliver_group cannot be set",ce.ApiError);l.config.deliver_subject=wr(this.nc.options.inboxPrefix),l.config.ack_policy=At.None,l.config.max_deliver=1,l.config.flow_control=!0,l.config.idle_heartbeat=l.config.idle_heartbeat||it(5e3),l.config.ack_wait=it(1320*60*1e3),l.config.mem_storage=!0,l.config.num_replicas=1}if(l.config.ack_policy===At.NotSet&&(l.config.ack_policy=At.All),l.api=this,l.config=l.config||{},l.stream=l.stream?l.stream:await this.findStream(r),l.attached=!1,l.config.durable_name)try{const c=await this.consumerAPI.info(l.stream,l.config.durable_name);if(c){if(c.config.filter_subject&&c.config.filter_subject!==r)throw new Error("subject does not match consumer");const m=l.config.deliver_group??"";if(m===""&&c.push_bound===!0)throw new Error("duplicate subscription");const p=c.config.deliver_group??"";if(m!==p)throw p===""?new Error("durable requires no queue group"):new Error(`durable requires queue group '${p}'`);l.last=c,l.config=c.config,l.attached=!0,l.config.durable_name||(l.name=c.name)}}catch(c){if(c.code!=="404")throw c}return!l.attached&&l.config.filter_subject===void 0&&l.config.filter_subjects===void 0&&(l.config.filter_subject=r),l.deliver=l.config.deliver_subject||wr(this.nc.options.inboxPrefix),l}_buildTypedSubscriptionOpts(r){const s={};return s.adapter=CE(r.callbackFn===void 0,this.timeout),s.ingestionFilterFn=Cd.ingestionFn(r.ordered),s.protocolFilterFn=(l,c=!1)=>{const m=l;return Zh(m.msg)?(c||m.msg.respond(),!1):!0},!r.mack&&r.config.ack_policy!==At.None&&(s.dispatchedFn=DE),r.callbackFn&&(s.callback=r.callbackFn),s.max=r.max||0,s.queue=r.queue,s}async _maybeCreateConsumer(r){if(r.attached)return;if(r.isBind)throw new Error(`unable to bind - durable consumer ${r.config.durable_name} doesn't exist in ${r.stream}`);r.config=Object.assign({deliver_policy:mt.All,ack_policy:At.Explicit,ack_wait:it(30*1e3),replay_policy:Fs.Instant},r.config);const s=await this.consumerAPI.add(r.stream,r.config);if(Array.isArray(r.config.filter_subjects&&!Array.isArray(s.config.filter_subjects)))throw new Error("jetstream server doesn't support consumers with multiple filter subjects");r.name=s.name,r.config=s.config,r.last=s}static ingestionFn(r){return(s,l)=>{var g;const c=l;if(!s)return{ingest:!1,protocol:!1};const m=s;if(Ps(m.msg)||(g=c.monitor)==null||g.work(),Wh(m.msg)){const f=r?c._checkHbOrderConsumer(m.msg):!0;return r||c.info.flow_control.heartbeat_count++,{ingest:f,protocol:!0}}else if(Zh(m.msg))return c.info.flow_control.fc_count++,{ingest:!0,protocol:!0};return{ingest:r?c._checkOrderedConsumer(s):!0,protocol:!1}}}}class Md{constructor(t){A(this,"options");A(this,"protocol");A(this,"draining");A(this,"listeners");A(this,"_services");this.draining=!1,this.options=KS(t),this.listeners=[]}static connect(t={}){return new Promise((r,s)=>{const l=new Md(t);eu.connect(l.options,l).then(c=>{l.protocol=c,(async function(){for await(const m of c.status())l.listeners.forEach(p=>{p.push(m)})})(),r(l)}).catch(c=>{s(c)})})}closed(){return this.protocol.closed}async close(){await this.protocol.close()}_check(t,r,s){if(this.isClosed())throw me.errorForCode(ce.ConnectionClosed);if(r&&this.isDraining()||s&&this.protocol.noMorePublishing)throw me.errorForCode(ce.ConnectionDraining);if(t=t||"",t.length===0)throw me.errorForCode(ce.BadSubject)}publish(t,r,s){this._check(t,!1,!0),this.protocol.publish(t,r,s)}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,r={}){this._check(t,!0,!1);const s=new Eb(this.protocol,t,r);return this.protocol.subscribe(s),s}_resub(t,r,s){this._check(r,!0,!1);const l=t;l.max=s,s&&(l.max=s+l.received),this.protocol.resub(l,r)}requestMany(t,r=hn,s={maxWait:1e3,maxMessages:-1}){const l=!this.protocol.options.noAsyncTraces;try{this._check(t,!0,!0)}catch(g){return Promise.reject(g)}if(s.strategy=s.strategy||In.Timer,s.maxWait=s.maxWait||1e3,s.maxWait<1)return Promise.reject(new me("timeout",ce.InvalidOption));const c=new jt;function m(g){c.push(()=>{c.stop(g)})}function p(g,f){g||f===null?m(g===null?void 0:g):c.push(f)}if(s.noMux){const g=l?new Error().stack:null;let f=typeof s.maxMessages=="number"&&s.maxMessages>0?s.maxMessages:-1;const d=this.subscribe(wr(this.options.inboxPrefix),{callback:(w,S)=>{var M,L;if(((M=S==null?void 0:S.data)==null?void 0:M.length)===0&&((L=S==null?void 0:S.headers)==null?void 0:L.status)===ce.NoResponders&&(w=me.errorForCode(ce.NoResponders)),w){g&&(w.stack+=`
48
+
49
+ ${g}`),b(w);return}p(null,S),s.strategy===In.Count&&(f--,f===0&&b()),s.strategy===In.JitterTimer&&(_(),v=setTimeout(()=>{b()},300)),s.strategy===In.SentinelMsg&&S&&S.data.length===0&&b()}});d.requestSubject=t,d.closed.then(()=>{m()}).catch(w=>{c.stop(w)});const b=w=>{w&&c.push(()=>{throw w}),_(),d.drain().then(()=>{m()}).catch(S=>{m()})};c.iterClosed.then(()=>{_(),d==null||d.unsubscribe()}).catch(w=>{_(),d==null||d.unsubscribe()});try{this.publish(t,r,{reply:d.getSubject()})}catch(w){b(w)}let v=setTimeout(()=>{b()},s.maxWait);const _=()=>{v&&clearTimeout(v)}}else{const g=s;g.callback=p,c.iterClosed.then(()=>{f.cancel()}).catch(d=>{f.cancel(d)});const f=new mS(this.protocol.muxSubscriptions,t,g);this.protocol.request(f);try{this.publish(t,r,{reply:`${this.protocol.muxSubscriptions.baseInbox}${f.token}`,headers:s.headers})}catch(d){f.cancel(d)}}return Promise.resolve(c)}request(t,r,s={timeout:1e3,noMux:!1}){try{this._check(t,!0,!0)}catch(c){return Promise.reject(c)}const l=!this.protocol.options.noAsyncTraces;if(s.timeout=s.timeout||1e3,s.timeout<1)return Promise.reject(new me("timeout",ce.InvalidOption));if(!s.noMux&&s.reply)return Promise.reject(new me("reply can only be used with noMux",ce.InvalidOption));if(s.noMux){const c=s.reply?s.reply:wr(this.options.inboxPrefix),m=st(),p=l?new Error:null,g=this.subscribe(c,{max:1,timeout:s.timeout,callback:(f,d)=>{f?(p&&f.code!==ce.Timeout&&(f.stack+=`
50
+
51
+ ${p.stack}`),g.unsubscribe(),m.reject(f)):(f=pb(d),f?(p&&(f.stack+=`
52
+
53
+ ${p.stack}`),m.reject(f)):m.resolve(d))}});return g.requestSubject=t,this.protocol.publish(t,r,{reply:c,headers:s.headers}),m}else{const c=new bb(this.protocol.muxSubscriptions,t,s,l);this.protocol.request(c);try{this.publish(t,r,{reply:`${this.protocol.muxSubscriptions.baseInbox}${c.token}`,headers:s.headers})}catch(p){c.cancel(p)}const m=Promise.race([c.timer,c.deferred]);return m.catch(()=>{c.cancel()}),m}}flush(){return this.isClosed()?Promise.reject(me.errorForCode(ce.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(me.errorForCode(ce.ConnectionClosed)):this.isDraining()?Promise.reject(me.errorForCode(ce.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 jt;return t.iterClosed.then(()=>{const r=this.listeners.indexOf(t);this.listeners.splice(r,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((r,s)=>r==="time"?new Date(Date.parse(s)):s)}stats(){return{inBytes:this.protocol.inBytes,outBytes:this.protocol.outBytes,inMsgs:this.protocol.inMsgs,outMsgs:this.protocol.outMsgs}}async jetstreamManager(t={}){const r=new SE(this,t);if(t.checkAPI!==!1)try{await r.getAccountInfo()}catch(s){const l=s;throw l.code===ce.NoResponders&&(l.code=ce.JetStreamNotEnabled),l}return r}jetstream(t={}){return new Cd(this,t)}getServerVersion(){const t=this.info;return t?$i(t.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw me.errorForCode(ce.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 jE(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(me.errorForCode(ce.ConnectionClosed)):this.isDraining()?Promise.reject(me.errorForCode(ce.ConnectionDraining)):this.protocol.reconnect()}}class jE{constructor(t){A(this,"nc");this.nc=t}add(t){try{return new bo(this.nc,t).start()}catch(r){return Promise.reject(r)}}client(t,r){return new aE(this.nc,t,r)}}class TE{constructor(t,r,s){A(this,"bucket");A(this,"sm");A(this,"prefixLen");this.bucket=t,this.prefixLen=r,this.sm=s}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(tu)||"PUT"}get length(){const t=this.sm.header.get($t.MessageSizeHdr)||"";return t!==""?parseInt(t,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class NE{constructor(t,r,s){A(this,"bucket");A(this,"key");A(this,"sm");this.bucket=t,this.key=r,this.sm=s}get value(){return this.sm.data}get created(){return new Date(Ad(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){var t;return((t=this.sm.headers)==null?void 0:t.get(tu))||"PUT"}get delta(){return this.sm.info.pending}get length(){var r;const t=((r=this.sm.headers)==null?void 0:r.get($t.MessageSizeHdr))||"";return t!==""?parseInt(t,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class Tb extends bS{constructor(r,s,l){super(r.nc,s,l);A(this,"js");A(this,"monitor");this.js=r,this.monitor=null,this.sub.closed.then(()=>{this.monitor&&this.monitor.cancel()})}set info(r){this.sub.info=r}get info(){return this.sub.info}_resetOrderedConsumer(r){if(this.info===null||this.sub.isClosed())return;const s=wr(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,s);const c=this.info;c.config.name=fi.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=s,c.config.deliver_subject=s,c.config.deliver_policy=mt.StartSequence,c.config.opt_start_seq=r;const m={};m.stream_name=this.info.stream,m.config=c.config;const p=`${c.api.prefix}.CONSUMER.CREATE.${c.stream}`;this.js._request(p,m,{retries:-1}).then(g=>{const f=g,d=this.sub.info;d.last=f,this.info.config=f.config,this.info.name=f.name}).catch(g=>{const f=new me(`unable to recreate ordered consumer ${c.stream} at seq ${r}`,ce.RequestError,g);this.sub.callback(f,{})})}_maybeSetupHbMonitoring(){var s,l;const r=((l=(s=this.info)==null?void 0:s.config)==null?void 0:l.idle_heartbeat)||0;r&&this._setupHbMonitoring(Ad(r))}_setupHbMonitoring(r,s=0){const l={cancelAfter:0,maxOut:2};s&&(l.cancelAfter=s);const c=this.sub,m=p=>{var d,b,v,_;const g=Zw(409,`${Nn.IdleHeartbeatMissed}: ${p}`,this.sub.subject);if(!((d=this.info)==null?void 0:d.ordered))this.sub.callback(null,g);else{if(!this.js.nc.protocol.connected)return!1;const w=((v=(b=this.info)==null?void 0:b.ordered_consumer_sequence)==null?void 0:v.stream_seq)||0;return this._resetOrderedConsumer(w+1),(_=this.monitor)==null||_.restart(),!1}return!c.noIterator};this.monitor=new Td(r,m,l)}_checkHbOrderConsumer(r){const s=r.headers.get($t.ConsumerStalledHdr);s!==""&&this.js.nc.publish(s);const l=parseInt(r.headers.get($t.LastConsumerSeqHdr),10),c=this.info.ordered_consumer_sequence;return this.info.flow_control.heartbeat_count++,l!==c.delivery_seq&&this._resetOrderedConsumer(c.stream_seq+1),!1}_checkOrderedConsumer(r){const s=this.info.ordered_consumer_sequence,l=r.info.streamSequence,c=r.info.deliverySequence;return c!=s.delivery_seq+1?(this._resetOrderedConsumer(s.stream_seq+1),!1):(s.delivery_seq=c,s.stream_seq=l,!0)}async destroy(){this.isClosed()||await this.drain();const r=this.sub.info,s=r.config.durable_name||r.name,l=`${r.api.prefix}.CONSUMER.DELETE.${r.stream}.${s}`;await r.api._request(l)}async consumerInfo(){const r=this.sub.info,s=r.config.durable_name||r.name,l=`${r.api.prefix}.CONSUMER.INFO.${r.stream}.${s}`,c=await r.api._request(l);return r.last=c,c}}class kE extends Tb{constructor(t,r,s){super(t,r,s)}pull(t={batch:1}){const{stream:r,config:s,name:l}=this.sub.info,c=s.durable_name??l,m={};if(m.batch=t.batch||1,m.no_wait=t.no_wait||!1,(t.max_bytes??0)>0){const f=this.js.nc.features.get(Ie.JS_PULL_MAX_BYTES);if(!f.ok)throw new Error(`max_bytes is only supported on servers ${f.min} or better`);m.max_bytes=t.max_bytes}let p=0;t.expires&&t.expires>0&&(p=t.expires,m.expires=it(p));let g=0;if(t.idle_heartbeat&&t.idle_heartbeat>0&&(g=t.idle_heartbeat,m.idle_heartbeat=it(g)),g&&p===0)throw new Error("idle_heartbeat requires expires");if(g>p)throw new Error("expires must be greater than idle_heartbeat");if(this.info){this.monitor&&this.monitor.cancel(),p&&g&&(this.monitor?this.monitor._change(g,p):this._setupHbMonitoring(g,p));const f=this.info.api,d=`${f.prefix}.CONSUMER.MSG.NEXT.${r}.${c}`,b=this.sub.subject;f.nc.publish(d,f.jc.encode(m),{reply:b})}}}function CE(i,t){return i?RE(t):ME(t)}function ME(i){return(t,r)=>t?[t,null]:(t=Ps(r),t?[t,null]:[null,mo(r,i)])}function RE(i){return(t,r)=>{if(t)return[t,null];const s=Ps(r);return s!==null?[Nb(s),null]:[null,mo(r,i)]}}function Nb(i){if(i!==null)switch(i.code){case ce.JetStream404NoMessages:case ce.JetStream408RequestTimeout:return null;case ce.JetStream409:return Ww(i)?i:null;default:return i}return null}function DE(i){i&&i.ack()}function qE(i){const t=i.split(".");if(t.length===9&&t.splice(2,0,"_",""),t.length<11||t[0]!=="$JS"||t[1]!=="ACK")throw new Error("not js message");const r={};return r.domain=t[2]==="_"?"":t[2],r.account_hash=t[3],r.stream=t[4],r.consumer=t[5],r.deliveryCount=parseInt(t[6],10),r.redeliveryCount=r.deliveryCount,r.redelivered=r.deliveryCount>1,r.streamSequence=parseInt(t[7],10),r.deliverySequence=parseInt(t[8],10),r.timestampNanos=parseInt(t[9],10),r.pending=parseInt(t[10],10),r}class BE{constructor(t,r){A(this,"msg");A(this,"di");A(this,"didAck");A(this,"timeout");this.msg=t,this.didAck=!1,this.timeout=r}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=qE(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]===Va[0]&&t[1]===Va[1]&&t[2]===Va[2]&&t[3]===Va[3]}async ackAck(t){var s;t=t||{},t.timeout=t.timeout||this.timeout;const r=st();if(this.didAck)r.resolve(!1);else if(this.didAck=!0,this.msg.reply){const c=this.msg.publisher,m=!((s=c.options)!=null&&s.noAsyncTraces),p=new bb(c.muxSubscriptions,this.msg.reply,{timeout:t.timeout},m);c.request(p);try{c.publish(this.msg.reply,vy,{reply:`${c.muxSubscriptions.baseInbox}${p.token}`})}catch(g){p.cancel(g)}try{await Promise.race([p.timer,p.deferred]),r.resolve(!0)}catch(g){p.cancel(g),r.reject(g)}}else r.resolve(!1);return r}ack(){this.doAck(vy)}nak(t){let r=gE;t&&(r=Qh().encode(`-NAK ${JSON.stringify({delay:it(t)})}`)),this.doAck(r)}working(){this.doAck(Va)}next(t,r={batch:1}){const s={};s.batch=r.batch||1,s.no_wait=r.no_wait||!1,r.expires&&r.expires>0&&(s.expires=it(r.expires));const l=$n().encode(s),c=Vs.concat(yE,vE,l),m=t?{reply:t}:void 0;this.msg.respond(c,m)}term(t=""){let r=bE;(t==null?void 0:t.length)>0&&(r=Qh().encode(`+TERM ${t}`)),this.doAck(r)}json(){return this.msg.json()}string(){return this.msg.string()}}const LE="1.30.3",zE="nats.ws";class UE{constructor(){A(this,"version");A(this,"lang");A(this,"closeError");A(this,"connected");A(this,"done");A(this,"socket");A(this,"options");A(this,"socketClosed");A(this,"encrypted");A(this,"peeked");A(this,"yields");A(this,"signal");A(this,"closedNotification");this.version=LE,this.lang=zE,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=st(),this.closedNotification=st()}async connect(t,r){const s=st();if(r.tls)return s.reject(new me("tls",ce.InvalidOption)),s;this.options=r;const l=t.src;if(r.wsFactory){const{socket:c,encrypted:m}=await r.wsFactory(t.src,r);this.socket=c,this.encrypted=m}else this.encrypted=l.indexOf("wss://")===0,this.socket=new WebSocket(l);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 m=Vs.concat(...this.yields),p=ES(m);if(p!==""){const g=ZS.exec(p);if(!g){r.debug&&console.error("!!!",Fl(m)),s.reject(new Error("unexpected response from server"));return}try{const f=JSON.parse(g[1]);JS(f,this.options),this.peeked=!0,this.connected=!0,this.signal.resolve(),s.resolve()}catch(f){s.reject(f);return}}},this.socket.onclose=c=>{if(this.isDiscarded())return;this.socketClosed=!0;let m;this.done||(c.wasClean||(m=new Error(c.reason)),this._closed(m))},this.socket.onerror=c=>{if(this.isDiscarded())return;const m=c,p=new me(m.message,ce.Unknown,new Error(m.error));s.reject(p)},s}disconnect(){this._closed(void 0,!0)}async _closed(t,r=!0){if(!this.isDiscarded()&&this.connected&&!this.done){if(this.closeError=t,!t)for(;!this.socketClosed&&this.socket.bufferedAmount>0;)await Ys(100);this.done=!0;try{this.socket.close(t?1002:1e3,t?t.message:void 0)}catch{}r&&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 r=0;r<t.length;r++)this.options.debug&&console.info(`> ${Fl(t[r])}`),yield t[r];if(this.done)break;this.yields.length===0&&(t.length=0,this.yields=t,this.signal=st())}}isEncrypted(){return this.connected&&this.encrypted}send(t){if(!this.isDiscarded())try{this.socket.send(t.buffer),this.options.debug&&console.info(`< ${Fl(t)}`);return}catch(r){this.options.debug&&console.error(`!!! ${Fl(t)}: ${r}`)}}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 PE(i,t){/^(.*:\/\/)(.*)/.test(i)||(typeof t=="boolean"?i=`${t===!0?"https":"http"}://${i}`:i=`https://${i}`);let s=new URL(i);const l=s.protocol.toLowerCase();l==="ws:"&&(t=!1),l==="wss:"&&(t=!0),l!=="https:"&&l!=="http"&&(i=i.replace(/^(.*:\/\/)(.*)/gm,"$2"),s=new URL(`http://${i}`));let c,m;const p=s.hostname,g=s.pathname,f=s.search||"";switch(l){case"http:":case"ws:":case"nats:":m=s.port||"80",c="ws:";break;case"https:":case"wss:":case"tls:":m=s.port||"443",c="wss:";break;default:m=s.port||t===!0?"443":"80",c=t===!0?"wss:":"ws:";break}return`${c}//${p}:${m}${g}${f}`}function IE(i={}){return vS({defaultPort:443,urlParseFn:PE,factory:()=>new UE}),Md.connect(i)}const $E=null,HE=null,GE="lt.events";function kb(i,t){const r=i.split("."),s=t.split(".");for(let l=0;l<s.length;l++){const c=s[l];if(c===">")return!0;if(l>=r.length||c!=="*"&&c!==r[l])return!1}return r.length===s.length}const Xs=j.createContext({connected:!1,subscribe:()=>()=>{}});function FE(){const{connected:i}=j.useContext(Xs);return{connected:i}}function i3(i,t){const{subscribe:r}=j.useContext(Xs),s=j.useRef(t);s.current=t,j.useEffect(()=>r(i,c=>s.current(c)),[r,i])}function Rd(i,t){const{subscribe:r}=j.useContext(Xs),s=j.useRef(t);s.current=t;const l=i.join(","),c=j.useMemo(()=>l.split(",").filter(Boolean),[l]);j.useEffect(()=>{const m=g=>s.current(g),p=c.map(g=>r(g,m));return()=>p.forEach(g=>g())},[r,c])}const VE=j.createContext({connected:!1,subscribe:()=>()=>{}}),YE=Qh();function XE({children:i,url:t,token:r}){const s=j.useRef(null),[l,c]=j.useState(!1),m=j.useRef(null),p=j.useRef(new Map),g=j.useRef(new Map),f=j.useCallback((_,w)=>{(async()=>{for await(const S of w)try{if(!kb(S.subject,_))continue;const M=JSON.parse(YE.decode(S.data)),L=p.current.get(_);if(!L)continue;for(const z of L)try{z(M)}catch{}}catch{}})()},[]),d=j.useCallback(_=>{var S;const w=s.current;if(!(!w||(S=w.isClosed)!=null&&S.call(w)||g.current.has(_)))try{const M=w.subscribe(_);g.current.set(_,M),f(_,M)}catch{}},[f]),b=j.useCallback((_,w)=>{const S=p.current;return S.has(_)||S.set(_,new Set),S.get(_).add(w),d(_),()=>{const M=S.get(_);if(M&&(M.delete(w),M.size===0)){S.delete(_);const L=g.current.get(_);if(L){g.current.delete(_);try{L.unsubscribe()}catch{}}}}},[d]),v=j.useCallback(async()=>{try{if(s.current)return;const _=t||$E;if(!_){console.error("[lt-nats] no NATS WebSocket URL configured — set NATS_WS_URL on the server");return}const w=await IE({servers:_,token:r||HE||void 0,reconnect:!0,maxReconnectAttempts:-1,reconnectTimeWait:2e3});s.current=w,c(!0);for(const S of p.current.keys())d(S);(async()=>{for await(const S of w.status())S.type==="disconnect"||S.type==="error"?c(!1):S.type==="reconnect"&&c(!0)})()}catch{c(!1),m.current=setTimeout(v,3e3)}},[d]);return j.useEffect(()=>(v(),()=>{m.current&&clearTimeout(m.current);for(const _ of g.current.values())try{_.unsubscribe()}catch{}g.current.clear(),s.current&&(s.current.close().catch(()=>{}),s.current=null),c(!1)}),[v]),y.jsx(VE.Provider,{value:{connected:l,subscribe:b},children:y.jsx(Xs.Provider,{value:{connected:l,subscribe:b},children:i})})}const Zn=Object.create(null);Zn.open="0";Zn.close="1";Zn.ping="2";Zn.pong="3";Zn.message="4";Zn.upgrade="5";Zn.noop="6";const Hc=Object.create(null);Object.keys(Zn).forEach(i=>{Hc[Zn[i]]=i});const fd={type:"error",data:"parser error"},Cb=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Mb=typeof ArrayBuffer=="function",Rb=i=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(i):i&&i.buffer instanceof ArrayBuffer,Dd=({type:i,data:t},r,s)=>Cb&&t instanceof Blob?r?s(t):_y(t,s):Mb&&(t instanceof ArrayBuffer||Rb(t))?r?s(t):_y(new Blob([t]),s):s(Zn[i]+(t||"")),_y=(i,t)=>{const r=new FileReader;return r.onload=function(){const s=r.result.split(",")[1];t("b"+(s||""))},r.readAsDataURL(i)};function wy(i){return i instanceof Uint8Array?i:i instanceof ArrayBuffer?new Uint8Array(i):new Uint8Array(i.buffer,i.byteOffset,i.byteLength)}let Uh;function KE(i,t){if(Cb&&i.data instanceof Blob)return i.data.arrayBuffer().then(wy).then(t);if(Mb&&(i.data instanceof ArrayBuffer||Rb(i.data)))return t(wy(i.data));Dd(i,!1,r=>{Uh||(Uh=new TextEncoder),t(Uh.encode(r))})}const Sy="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",io=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let i=0;i<Sy.length;i++)io[Sy.charCodeAt(i)]=i;const JE=i=>{let t=i.length*.75,r=i.length,s,l=0,c,m,p,g;i[i.length-1]==="="&&(t--,i[i.length-2]==="="&&t--);const f=new ArrayBuffer(t),d=new Uint8Array(f);for(s=0;s<r;s+=4)c=io[i.charCodeAt(s)],m=io[i.charCodeAt(s+1)],p=io[i.charCodeAt(s+2)],g=io[i.charCodeAt(s+3)],d[l++]=c<<2|m>>4,d[l++]=(m&15)<<4|p>>2,d[l++]=(p&3)<<6|g&63;return f},QE=typeof ArrayBuffer=="function",qd=(i,t)=>{if(typeof i!="string")return{type:"message",data:Db(i,t)};const r=i.charAt(0);return r==="b"?{type:"message",data:ZE(i.substring(1),t)}:Hc[r]?i.length>1?{type:Hc[r],data:i.substring(1)}:{type:Hc[r]}:fd},ZE=(i,t)=>{if(QE){const r=JE(i);return Db(r,t)}else return{base64:!0,data:i}},Db=(i,t)=>{switch(t){case"blob":return i instanceof Blob?i:new Blob([i]);case"arraybuffer":default:return i instanceof ArrayBuffer?i:i.buffer}},qb="",WE=(i,t)=>{const r=i.length,s=new Array(r);let l=0;i.forEach((c,m)=>{Dd(c,!1,p=>{s[m]=p,++l===r&&t(s.join(qb))})})},e2=(i,t)=>{const r=i.split(qb),s=[];for(let l=0;l<r.length;l++){const c=qd(r[l],t);if(s.push(c),c.type==="error")break}return s};function t2(){return new TransformStream({transform(i,t){KE(i,r=>{const s=r.length;let l;if(s<126)l=new Uint8Array(1),new DataView(l.buffer).setUint8(0,s);else if(s<65536){l=new Uint8Array(3);const c=new DataView(l.buffer);c.setUint8(0,126),c.setUint16(1,s)}else{l=new Uint8Array(9);const c=new DataView(l.buffer);c.setUint8(0,127),c.setBigUint64(1,BigInt(s))}i.data&&typeof i.data!="string"&&(l[0]|=128),t.enqueue(l),t.enqueue(r)})}})}let Ph;function Kl(i){return i.reduce((t,r)=>t+r.length,0)}function Jl(i,t){if(i[0].length===t)return i.shift();const r=new Uint8Array(t);let s=0;for(let l=0;l<t;l++)r[l]=i[0][s++],s===i[0].length&&(i.shift(),s=0);return i.length&&s<i[0].length&&(i[0]=i[0].slice(s)),r}function n2(i,t){Ph||(Ph=new TextDecoder);const r=[];let s=0,l=-1,c=!1;return new TransformStream({transform(m,p){for(r.push(m);;){if(s===0){if(Kl(r)<1)break;const g=Jl(r,1);c=(g[0]&128)===128,l=g[0]&127,l<126?s=3:l===126?s=1:s=2}else if(s===1){if(Kl(r)<2)break;const g=Jl(r,2);l=new DataView(g.buffer,g.byteOffset,g.length).getUint16(0),s=3}else if(s===2){if(Kl(r)<8)break;const g=Jl(r,8),f=new DataView(g.buffer,g.byteOffset,g.length),d=f.getUint32(0);if(d>Math.pow(2,21)-1){p.enqueue(fd);break}l=d*Math.pow(2,32)+f.getUint32(4),s=3}else{if(Kl(r)<l)break;const g=Jl(r,l);p.enqueue(qd(c?g:Ph.decode(g),t)),s=0}if(l===0||l>i){p.enqueue(fd);break}}}})}const Bb=4;function _t(i){if(i)return r2(i)}function r2(i){for(var t in _t.prototype)i[t]=_t.prototype[t];return i}_t.prototype.on=_t.prototype.addEventListener=function(i,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+i]=this._callbacks["$"+i]||[]).push(t),this};_t.prototype.once=function(i,t){function r(){this.off(i,r),t.apply(this,arguments)}return r.fn=t,this.on(i,r),this};_t.prototype.off=_t.prototype.removeListener=_t.prototype.removeAllListeners=_t.prototype.removeEventListener=function(i,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var r=this._callbacks["$"+i];if(!r)return this;if(arguments.length==1)return delete this._callbacks["$"+i],this;for(var s,l=0;l<r.length;l++)if(s=r[l],s===t||s.fn===t){r.splice(l,1);break}return r.length===0&&delete this._callbacks["$"+i],this};_t.prototype.emit=function(i){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),r=this._callbacks["$"+i],s=1;s<arguments.length;s++)t[s-1]=arguments[s];if(r){r=r.slice(0);for(var s=0,l=r.length;s<l;++s)r[s].apply(this,t)}return this};_t.prototype.emitReserved=_t.prototype.emit;_t.prototype.listeners=function(i){return this._callbacks=this._callbacks||{},this._callbacks["$"+i]||[]};_t.prototype.hasListeners=function(i){return!!this.listeners(i).length};const hu=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,r)=>r(t,0),kn=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),i2="arraybuffer";function Lb(i,...t){return t.reduce((r,s)=>(i.hasOwnProperty(s)&&(r[s]=i[s]),r),{})}const s2=kn.setTimeout,a2=kn.clearTimeout;function du(i,t){t.useNativeTimers?(i.setTimeoutFn=s2.bind(kn),i.clearTimeoutFn=a2.bind(kn)):(i.setTimeoutFn=kn.setTimeout.bind(kn),i.clearTimeoutFn=kn.clearTimeout.bind(kn))}const o2=1.33;function l2(i){return typeof i=="string"?c2(i):Math.ceil((i.byteLength||i.size)*o2)}function c2(i){let t=0,r=0;for(let s=0,l=i.length;s<l;s++)t=i.charCodeAt(s),t<128?r+=1:t<2048?r+=2:t<55296||t>=57344?r+=3:(s++,r+=4);return r}function zb(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function u2(i){let t="";for(let r in i)i.hasOwnProperty(r)&&(t.length&&(t+="&"),t+=encodeURIComponent(r)+"="+encodeURIComponent(i[r]));return t}function f2(i){let t={},r=i.split("&");for(let s=0,l=r.length;s<l;s++){let c=r[s].split("=");t[decodeURIComponent(c[0])]=decodeURIComponent(c[1])}return t}class h2 extends Error{constructor(t,r,s){super(t),this.description=r,this.context=s,this.type="TransportError"}}class Bd extends _t{constructor(t){super(),this.writable=!1,du(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,r,s){return super.emitReserved("error",new h2(t,r,s)),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 r=qd(t,this.socket.binaryType);this.onPacket(r)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,r={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(r)}_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 r=u2(t);return r.length?"?"+r:""}}class d2 extends Bd{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";const r=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let s=0;this._polling&&(s++,this.once("pollComplete",function(){--s||r()})),this.writable||(s++,this.once("drain",function(){--s||r()}))}else r()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const r=s=>{if(this.readyState==="opening"&&s.type==="open"&&this.onOpen(),s.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(s)};e2(t,this.socket.binaryType).forEach(r),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,WE(t,r=>{this.doWrite(r,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",r=this.query||{};return this.opts.timestampRequests!==!1&&(r[this.opts.timestampParam]=zb()),!this.supportsBinary&&!r.sid&&(r.b64=1),this.createUri(t,r)}}let Ub=!1;try{Ub=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const m2=Ub;function p2(){}class g2 extends d2{constructor(t){if(super(t),typeof location<"u"){const r=location.protocol==="https:";let s=location.port;s||(s=r?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||s!==t.port}}doWrite(t,r){const s=this.request({method:"POST",data:t});s.on("success",r),s.on("error",(l,c)=>{this.onError("xhr post error",l,c)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(r,s)=>{this.onError("xhr poll error",r,s)}),this.pollXhr=t}}class Qn extends _t{constructor(t,r,s){super(),this.createRequest=t,du(this,s),this._opts=s,this._method=s.method||"GET",this._uri=r,this._data=s.data!==void 0?s.data:null,this._create()}_create(){var t;const r=Lb(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");r.xdomain=!!this._opts.xd;const s=this._xhr=this.createRequest(r);try{s.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){s.setDisableHeaderCheck&&s.setDisableHeaderCheck(!0);for(let l in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(l)&&s.setRequestHeader(l,this._opts.extraHeaders[l])}}catch{}if(this._method==="POST")try{s.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{s.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(s),"withCredentials"in s&&(s.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(s.timeout=this._opts.requestTimeout),s.onreadystatechange=()=>{var l;s.readyState===3&&((l=this._opts.cookieJar)===null||l===void 0||l.parseCookies(s.getResponseHeader("set-cookie"))),s.readyState===4&&(s.status===200||s.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof s.status=="number"?s.status:0)},0))},s.send(this._data)}catch(l){this.setTimeoutFn(()=>{this._onError(l)},0);return}typeof document<"u"&&(this._index=Qn.requestsCount++,Qn.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=p2,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Qn.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()}}Qn.requestsCount=0;Qn.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Ey);else if(typeof addEventListener=="function"){const i="onpagehide"in kn?"pagehide":"unload";addEventListener(i,Ey,!1)}}function Ey(){for(let i in Qn.requests)Qn.requests.hasOwnProperty(i)&&Qn.requests[i].abort()}const y2=(function(){const i=Pb({xdomain:!1});return i&&i.responseType!==null})();class b2 extends g2{constructor(t){super(t);const r=t&&t.forceBase64;this.supportsBinary=y2&&!r}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new Qn(Pb,this.uri(),t)}}function Pb(i){const t=i.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||m2))return new XMLHttpRequest}catch{}if(!t)try{return new kn[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Ib=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class v2 extends Bd{get name(){return"websocket"}doOpen(){const t=this.uri(),r=this.opts.protocols,s=Ib?{}:Lb(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(s.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,r,s)}catch(l){return this.emitReserved("error",l)}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 r=0;r<t.length;r++){const s=t[r],l=r===t.length-1;Dd(s,this.supportsBinary,c=>{try{this.doWrite(s,c)}catch{}l&&hu(()=>{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",r=this.query||{};return this.opts.timestampRequests&&(r[this.opts.timestampParam]=zb()),this.supportsBinary||(r.b64=1),this.createUri(t,r)}}const Ih=kn.WebSocket||kn.MozWebSocket;class x2 extends v2{createSocket(t,r,s){return Ib?new Ih(t,r,s):r?new Ih(t,r):new Ih(t)}doWrite(t,r){this.ws.send(r)}}class _2 extends Bd{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 r=n2(Number.MAX_SAFE_INTEGER,this.socket.binaryType),s=t.readable.pipeThrough(r).getReader(),l=t2();l.readable.pipeTo(t.writable),this._writer=l.writable.getWriter();const c=()=>{s.read().then(({done:p,value:g})=>{p||(this.onPacket(g),c())}).catch(p=>{})};c();const m={type:"open"};this.query.sid&&(m.data=`{"sid":"${this.query.sid}"}`),this._writer.write(m).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let r=0;r<t.length;r++){const s=t[r],l=r===t.length-1;this._writer.write(s).then(()=>{l&&hu(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const w2={websocket:x2,webtransport:_2,polling:b2},S2=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,E2=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function hd(i){if(i.length>8e3)throw"URI too long";const t=i,r=i.indexOf("["),s=i.indexOf("]");r!=-1&&s!=-1&&(i=i.substring(0,r)+i.substring(r,s).replace(/:/g,";")+i.substring(s,i.length));let l=S2.exec(i||""),c={},m=14;for(;m--;)c[E2[m]]=l[m]||"";return r!=-1&&s!=-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=O2(c,c.path),c.queryKey=A2(c,c.query),c}function O2(i,t){const r=/\/{2,9}/g,s=t.replace(r,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&s.splice(0,1),t.slice(-1)=="/"&&s.splice(s.length-1,1),s}function A2(i,t){const r={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(s,l,c){l&&(r[l]=c)}),r}const dd=typeof addEventListener=="function"&&typeof removeEventListener=="function",Gc=[];dd&&addEventListener("offline",()=>{Gc.forEach(i=>i())},!1);class ci extends _t{constructor(t,r){if(super(),this.binaryType=i2,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(r=t,t=null),t){const s=hd(t);r.hostname=s.host,r.secure=s.protocol==="https"||s.protocol==="wss",r.port=s.port,s.query&&(r.query=s.query)}else r.host&&(r.hostname=hd(r.host).host);du(this,r),this.secure=r.secure!=null?r.secure:typeof location<"u"&&location.protocol==="https:",r.hostname&&!r.port&&(r.port=this.secure?"443":"80"),this.hostname=r.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=r.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},r.transports.forEach(s=>{const l=s.prototype.name;this.transports.push(l),this._transportsByName[l]=s}),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},r),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=f2(this.opts.query)),dd&&(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"})},Gc.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const r=Object.assign({},this.opts.query);r.EIO=Bb,r.transport=t,this.id&&(r.sid=this.id);const s=Object.assign({},this.opts,{query:r,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](s)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&ci.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const r=this.createTransport(t);r.open(),this.setTransport(r)}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",r=>this._onClose("transport close",r))}onOpen(){this.readyState="open",ci.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 r=new Error("server error");r.code=t.data,this._onError(r);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 r=1;for(let s=0;s<this.writeBuffer.length;s++){const l=this.writeBuffer[s].data;if(l&&(r+=l2(l)),s>0&&r>this._maxPayload)return this.writeBuffer.slice(0,s);r+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,hu(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,r,s){return this._sendPacket("message",t,r,s),this}send(t,r,s){return this._sendPacket("message",t,r,s),this}_sendPacket(t,r,s,l){if(typeof r=="function"&&(l=r,r=void 0),typeof s=="function"&&(l=s,s=null),this.readyState==="closing"||this.readyState==="closed")return;s=s||{},s.compress=s.compress!==!1;const c={type:t,data:r,options:s};this.emitReserved("packetCreate",c),this.writeBuffer.push(c),l&&this.once("flush",l),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},r=()=>{this.off("upgrade",r),this.off("upgradeError",r),t()},s=()=>{this.once("upgrade",r),this.once("upgradeError",r)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?s():t()}):this.upgrading?s():t()),this}_onError(t){if(ci.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,r){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(),dd&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const s=Gc.indexOf(this._offlineEventListener);s!==-1&&Gc.splice(s,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,r),this.writeBuffer=[],this._prevBufferLen=0}}}ci.protocol=Bb;class j2 extends ci{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 r=this.createTransport(t),s=!1;ci.priorWebsocketSuccess=!1;const l=()=>{s||(r.send([{type:"ping",data:"probe"}]),r.once("packet",b=>{if(!s)if(b.type==="pong"&&b.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",r),!r)return;ci.priorWebsocketSuccess=r.name==="websocket",this.transport.pause(()=>{s||this.readyState!=="closed"&&(d(),this.setTransport(r),r.send([{type:"upgrade"}]),this.emitReserved("upgrade",r),r=null,this.upgrading=!1,this.flush())})}else{const v=new Error("probe error");v.transport=r.name,this.emitReserved("upgradeError",v)}}))};function c(){s||(s=!0,d(),r.close(),r=null)}const m=b=>{const v=new Error("probe error: "+b);v.transport=r.name,c(),this.emitReserved("upgradeError",v)};function p(){m("transport closed")}function g(){m("socket closed")}function f(b){r&&b.name!==r.name&&c()}const d=()=>{r.removeListener("open",l),r.removeListener("error",m),r.removeListener("close",p),this.off("close",g),this.off("upgrading",f)};r.once("open",l),r.once("error",m),r.once("close",p),this.once("close",g),this.once("upgrading",f),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{s||r.open()},200):r.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const r=[];for(let s=0;s<t.length;s++)~this.transports.indexOf(t[s])&&r.push(t[s]);return r}}let T2=class extends j2{constructor(t,r={}){const s=typeof t=="object"?t:r;(!s.transports||s.transports&&typeof s.transports[0]=="string")&&(s.transports=(s.transports||["polling","websocket","webtransport"]).map(l=>w2[l]).filter(l=>!!l)),super(t,s)}};function N2(i,t="",r){let s=i;r=r||typeof location<"u"&&location,i==null&&(i=r.protocol+"//"+r.host),typeof i=="string"&&(i.charAt(0)==="/"&&(i.charAt(1)==="/"?i=r.protocol+i:i=r.host+i),/^(https?|wss?):\/\//.test(i)||(typeof r<"u"?i=r.protocol+"//"+i:i="https://"+i),s=hd(i)),s.port||(/^(http|ws)$/.test(s.protocol)?s.port="80":/^(http|ws)s$/.test(s.protocol)&&(s.port="443")),s.path=s.path||"/";const c=s.host.indexOf(":")!==-1?"["+s.host+"]":s.host;return s.id=s.protocol+"://"+c+":"+s.port+t,s.href=s.protocol+"://"+c+(r&&r.port===s.port?"":":"+s.port),s}const k2=typeof ArrayBuffer=="function",C2=i=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(i):i.buffer instanceof ArrayBuffer,$b=Object.prototype.toString,M2=typeof Blob=="function"||typeof Blob<"u"&&$b.call(Blob)==="[object BlobConstructor]",R2=typeof File=="function"||typeof File<"u"&&$b.call(File)==="[object FileConstructor]";function Ld(i){return k2&&(i instanceof ArrayBuffer||C2(i))||M2&&i instanceof Blob||R2&&i instanceof File}function Fc(i,t){if(!i||typeof i!="object")return!1;if(Array.isArray(i)){for(let r=0,s=i.length;r<s;r++)if(Fc(i[r]))return!0;return!1}if(Ld(i))return!0;if(i.toJSON&&typeof i.toJSON=="function"&&arguments.length===1)return Fc(i.toJSON(),!0);for(const r in i)if(Object.prototype.hasOwnProperty.call(i,r)&&Fc(i[r]))return!0;return!1}function D2(i){const t=[],r=i.data,s=i;return s.data=md(r,t),s.attachments=t.length,{packet:s,buffers:t}}function md(i,t){if(!i)return i;if(Ld(i)){const r={_placeholder:!0,num:t.length};return t.push(i),r}else if(Array.isArray(i)){const r=new Array(i.length);for(let s=0;s<i.length;s++)r[s]=md(i[s],t);return r}else if(typeof i=="object"&&!(i instanceof Date)){const r={};for(const s in i)Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=md(i[s],t));return r}return i}function q2(i,t){return i.data=pd(i.data,t),delete i.attachments,i}function pd(i,t){if(!i)return i;if(i&&i._placeholder===!0){if(typeof i.num=="number"&&i.num>=0&&i.num<t.length)return t[i.num];throw new Error("illegal attachments")}else if(Array.isArray(i))for(let r=0;r<i.length;r++)i[r]=pd(i[r],t);else if(typeof i=="object")for(const r in i)Object.prototype.hasOwnProperty.call(i,r)&&(i[r]=pd(i[r],t));return i}const B2=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var Ue;(function(i){i[i.CONNECT=0]="CONNECT",i[i.DISCONNECT=1]="DISCONNECT",i[i.EVENT=2]="EVENT",i[i.ACK=3]="ACK",i[i.CONNECT_ERROR=4]="CONNECT_ERROR",i[i.BINARY_EVENT=5]="BINARY_EVENT",i[i.BINARY_ACK=6]="BINARY_ACK"})(Ue||(Ue={}));class L2{constructor(t){this.replacer=t}encode(t){return(t.type===Ue.EVENT||t.type===Ue.ACK)&&Fc(t)?this.encodeAsBinary({type:t.type===Ue.EVENT?Ue.BINARY_EVENT:Ue.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let r=""+t.type;return(t.type===Ue.BINARY_EVENT||t.type===Ue.BINARY_ACK)&&(r+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(r+=t.nsp+","),t.id!=null&&(r+=t.id),t.data!=null&&(r+=JSON.stringify(t.data,this.replacer)),r}encodeAsBinary(t){const r=D2(t),s=this.encodeAsString(r.packet),l=r.buffers;return l.unshift(s),l}}class zd extends _t{constructor(t){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof t=="function"?{reviver:t}:t)}add(t){let r;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");r=this.decodeString(t);const s=r.type===Ue.BINARY_EVENT;s||r.type===Ue.BINARY_ACK?(r.type=s?Ue.EVENT:Ue.ACK,this.reconstructor=new z2(r),r.attachments===0&&super.emitReserved("decoded",r)):super.emitReserved("decoded",r)}else if(Ld(t)||t.base64)if(this.reconstructor)r=this.reconstructor.takeBinaryData(t),r&&(this.reconstructor=null,super.emitReserved("decoded",r));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let r=0;const s={type:Number(t.charAt(0))};if(Ue[s.type]===void 0)throw new Error("unknown packet type "+s.type);if(s.type===Ue.BINARY_EVENT||s.type===Ue.BINARY_ACK){const c=r+1;for(;t.charAt(++r)!=="-"&&r!=t.length;);const m=t.substring(c,r);if(m!=Number(m)||t.charAt(r)!=="-")throw new Error("Illegal attachments");const p=Number(m);if(!U2(p)||p<0)throw new Error("Illegal attachments");if(p>this.opts.maxAttachments)throw new Error("too many attachments");s.attachments=p}if(t.charAt(r+1)==="/"){const c=r+1;for(;++r&&!(t.charAt(r)===","||r===t.length););s.nsp=t.substring(c,r)}else s.nsp="/";const l=t.charAt(r+1);if(l!==""&&Number(l)==l){const c=r+1;for(;++r;){const m=t.charAt(r);if(m==null||Number(m)!=m){--r;break}if(r===t.length)break}s.id=Number(t.substring(c,r+1))}if(t.charAt(++r)){const c=this.tryParse(t.substr(r));if(zd.isPayloadValid(s.type,c))s.data=c;else throw new Error("invalid payload")}return s}tryParse(t){try{return JSON.parse(t,this.opts.reviver)}catch{return!1}}static isPayloadValid(t,r){switch(t){case Ue.CONNECT:return Oy(r);case Ue.DISCONNECT:return r===void 0;case Ue.CONNECT_ERROR:return typeof r=="string"||Oy(r);case Ue.EVENT:case Ue.BINARY_EVENT:return Array.isArray(r)&&(typeof r[0]=="number"||typeof r[0]=="string"&&B2.indexOf(r[0])===-1);case Ue.ACK:case Ue.BINARY_ACK:return Array.isArray(r)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class z2{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const r=q2(this.reconPack,this.buffers);return this.finishedReconstruction(),r}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const U2=Number.isInteger||function(i){return typeof i=="number"&&isFinite(i)&&Math.floor(i)===i};function Oy(i){return Object.prototype.toString.call(i)==="[object Object]"}const P2=Object.freeze(Object.defineProperty({__proto__:null,Decoder:zd,Encoder:L2,get PacketType(){return Ue}},Symbol.toStringTag,{value:"Module"}));function Pn(i,t,r){return i.on(t,r),function(){i.off(t,r)}}const I2=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Hb extends _t{constructor(t,r,s){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=r,s&&s.auth&&(this.auth=s.auth),this._opts=Object.assign({},s),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[Pn(t,"open",this.onopen.bind(this)),Pn(t,"packet",this.onpacket.bind(this)),Pn(t,"error",this.onerror.bind(this)),Pn(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,...r){var s,l,c;if(I2.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(r.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(r),this;const m={type:Ue.EVENT,data:r};if(m.options={},m.options.compress=this.flags.compress!==!1,typeof r[r.length-1]=="function"){const d=this.ids++,b=r.pop();this._registerAckCallback(d,b),m.id=d}const p=(l=(s=this.io.engine)===null||s===void 0?void 0:s.transport)===null||l===void 0?void 0:l.writable,g=this.connected&&!(!((c=this.io.engine)===null||c===void 0)&&c._hasPingExpired());return this.flags.volatile&&!p||(g?(this.notifyOutgoingListeners(m),this.packet(m)):this.sendBuffer.push(m)),this.flags={},this}_registerAckCallback(t,r){var s;const l=(s=this.flags.timeout)!==null&&s!==void 0?s:this._opts.ackTimeout;if(l===void 0){this.acks[t]=r;return}const c=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let p=0;p<this.sendBuffer.length;p++)this.sendBuffer[p].id===t&&this.sendBuffer.splice(p,1);r.call(this,new Error("operation has timed out"))},l),m=(...p)=>{this.io.clearTimeoutFn(c),r.apply(this,p)};m.withError=!0,this.acks[t]=m}emitWithAck(t,...r){return new Promise((s,l)=>{const c=(m,p)=>m?l(m):s(p);c.withError=!0,r.push(c),this.emit(t,...r)})}_addToQueue(t){let r;typeof t[t.length-1]=="function"&&(r=t.pop());const s={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((l,...c)=>(this._queue[0],l!==null?s.tryCount>this._opts.retries&&(this._queue.shift(),r&&r(l)):(this._queue.shift(),r&&r(null,...c)),s.pending=!1,this._drainQueue())),this._queue.push(s),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const r=this._queue[0];r.pending&&!t||(r.pending=!0,r.tryCount++,this.flags=r.flags,this.emit.apply(this,r.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:Ue.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,r){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,r),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(s=>String(s.id)===t)){const s=this.acks[t];delete this.acks[t],s.withError&&s.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case Ue.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 Ue.EVENT:case Ue.BINARY_EVENT:this.onevent(t);break;case Ue.ACK:case Ue.BINARY_ACK:this.onack(t);break;case Ue.DISCONNECT:this.ondisconnect();break;case Ue.CONNECT_ERROR:this.destroy();const s=new Error(t.data.message);s.data=t.data.data,this.emitReserved("connect_error",s);break}}onevent(t){const r=t.data||[];t.id!=null&&r.push(this.ack(t.id)),this.connected?this.emitEvent(r):this.receiveBuffer.push(Object.freeze(r))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const r=this._anyListeners.slice();for(const s of r)s.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 r=this;let s=!1;return function(...l){s||(s=!0,r.packet({type:Ue.ACK,id:t,data:l}))}}onack(t){const r=this.acks[t.id];typeof r=="function"&&(delete this.acks[t.id],r.withError&&t.data.unshift(null),r.apply(this,t.data))}onconnect(t,r){this.id=t,this.recovered=r&&this._pid===r,this._pid=r,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:Ue.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 r=this._anyListeners;for(let s=0;s<r.length;s++)if(t===r[s])return r.splice(s,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 r=this._anyOutgoingListeners;for(let s=0;s<r.length;s++)if(t===r[s])return r.splice(s,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const r=this._anyOutgoingListeners.slice();for(const s of r)s.apply(this,t.data)}}}function Ks(i){i=i||{},this.ms=i.min||100,this.max=i.max||1e4,this.factor=i.factor||2,this.jitter=i.jitter>0&&i.jitter<=1?i.jitter:0,this.attempts=0}Ks.prototype.duration=function(){var i=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),r=Math.floor(t*this.jitter*i);i=(Math.floor(t*10)&1)==0?i-r:i+r}return Math.min(i,this.max)|0};Ks.prototype.reset=function(){this.attempts=0};Ks.prototype.setMin=function(i){this.ms=i};Ks.prototype.setMax=function(i){this.max=i};Ks.prototype.setJitter=function(i){this.jitter=i};class gd extends _t{constructor(t,r){var s;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(r=t,t=void 0),r=r||{},r.path=r.path||"/socket.io",this.opts=r,du(this,r),this.reconnection(r.reconnection!==!1),this.reconnectionAttempts(r.reconnectionAttempts||1/0),this.reconnectionDelay(r.reconnectionDelay||1e3),this.reconnectionDelayMax(r.reconnectionDelayMax||5e3),this.randomizationFactor((s=r.randomizationFactor)!==null&&s!==void 0?s:.5),this.backoff=new Ks({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(r.timeout==null?2e4:r.timeout),this._readyState="closed",this.uri=t;const l=r.parser||P2;this.encoder=new l.Encoder,this.decoder=new l.Decoder,this._autoConnect=r.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 r;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(r=this.backoff)===null||r===void 0||r.setMin(t),this)}randomizationFactor(t){var r;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(r=this.backoff)===null||r===void 0||r.setJitter(t),this)}reconnectionDelayMax(t){var r;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(r=this.backoff)===null||r===void 0||r.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 T2(this.uri,this.opts);const r=this.engine,s=this;this._readyState="opening",this.skipReconnect=!1;const l=Pn(r,"open",function(){s.onopen(),t&&t()}),c=p=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",p),t?t(p):this.maybeReconnectOnOpen()},m=Pn(r,"error",c);if(this._timeout!==!1){const p=this._timeout,g=this.setTimeoutFn(()=>{l(),c(new Error("timeout")),r.close()},p);this.opts.autoUnref&&g.unref(),this.subs.push(()=>{this.clearTimeoutFn(g)})}return this.subs.push(l),this.subs.push(m),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Pn(t,"ping",this.onping.bind(this)),Pn(t,"data",this.ondata.bind(this)),Pn(t,"error",this.onerror.bind(this)),Pn(t,"close",this.onclose.bind(this)),Pn(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(r){this.onclose("parse error",r)}}ondecoded(t){hu(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,r){let s=this.nsps[t];return s?this._autoConnect&&!s.active&&s.connect():(s=new Hb(this,t,r),this.nsps[t]=s),s}_destroy(t){const r=Object.keys(this.nsps);for(const s of r)if(this.nsps[s].active)return;this._close()}_packet(t){const r=this.encoder.encode(t);for(let s=0;s<r.length;s++)this.engine.write(r[s],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,r){var s;this.cleanup(),(s=this.engine)===null||s===void 0||s.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,r),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 r=this.backoff.duration();this._reconnecting=!0;const s=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(l=>{l?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",l)):t.onreconnect()}))},r);this.opts.autoUnref&&s.unref(),this.subs.push(()=>{this.clearTimeoutFn(s)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const Ya={};function Vc(i,t){typeof i=="object"&&(t=i,i=void 0),t=t||{};const r=N2(i,t.path||"/socket.io"),s=r.source,l=r.id,c=r.path,m=Ya[l]&&c in Ya[l].nsps,p=t.forceNew||t["force new connection"]||t.multiplex===!1||m;let g;return p?g=new gd(s,t):(Ya[l]||(Ya[l]=new gd(s,t)),g=Ya[l]),r.query&&!t.query&&(t.query=r.queryKey),g.socket(r.path,t)}Object.assign(Vc,{Manager:gd,Socket:Hb,io:Vc,connect:Vc});const $2=j.createContext({connected:!1,subscribe:()=>()=>{}});function H2({children:i}){const t=j.useRef(null),[r,s]=j.useState(!1),l=j.useRef(new Map),c=j.useCallback((p,g)=>{var d;const f=l.current;return f.has(p)||(f.set(p,new Set),(d=t.current)==null||d.emit("lt.subscribe",p)),f.get(p).add(g),()=>{var v;const b=f.get(p);b&&(b.delete(g),b.size===0&&(f.delete(p),(v=t.current)==null||v.emit("lt.unsubscribe",p)))}},[]),m=j.useCallback((p,g)=>{for(const[f,d]of l.current)if(kb(p,f))for(const b of d)try{b(g)}catch{}},[]);return j.useEffect(()=>{const p=fb(),g=Vc({path:`${Mt}/socket.io`,transports:["polling","websocket"],upgrade:!0,reconnection:!0,reconnectionAttempts:1/0,reconnectionDelay:2e3,...p?{auth:{token:p}}:{}});return t.current=g,console.log("[lt-socketio] connecting..."),g.on("connect",()=>{console.log("[lt-socketio] connected, id:",g.id),s(!0);for(const f of l.current.keys())g.emit("lt.subscribe",f)}),g.on("disconnect",f=>{console.log("[lt-socketio] disconnected:",f),s(!1)}),g.on("connect_error",f=>{console.warn("[lt-socketio] connect error:",f.message),s(!1)}),g.onAny((f,d)=>{if(f.startsWith("lt."))try{const b=typeof d=="string"?JSON.parse(d):d;m(f,b)}catch{}}),()=>{g.removeAllListeners(),g.disconnect(),t.current=null,s(!1)}},[m]),y.jsx($2.Provider,{value:{connected:r,subscribe:c},children:y.jsx(Xs.Provider,{value:{connected:r,subscribe:c},children:i})})}function G2({children:i}){const[t,r]=j.useState(null),[s,l]=j.useState({url:null,token:null});return j.useEffect(()=>{let c=!1;async function m(){var p;try{console.log("[lt-transport] detecting event transport...");const g=await fetch(`${Mt}/api/settings`);if(!g.ok){console.warn("[lt-transport] settings fetch failed, falling back to socketio"),c||r("socketio");return}const f=await g.json(),d=(p=f==null?void 0:f.events)==null?void 0:p.transport;if(console.log("[lt-transport] server reports:",d),!c){if(d==="nats"){let b=f.events.natsWsUrl??null,v=null;const _=fb();if(_)try{const w=await fetch(`${Mt}/api/nats-credentials`,{headers:{Authorization:`Bearer ${_}`}});if(w.ok){const S=await w.json();b=S.natsWsUrl??b,v=S.natsToken??null}}catch{console.warn("[lt-transport] failed to fetch NATS credentials")}l({url:b,token:v})}r(d==="nats"?"nats":"socketio")}}catch(g){console.warn("[lt-transport] settings fetch error, falling back to socketio",g),c||r("socketio")}}return m(),()=>{c=!0}},[]),t==="nats"?y.jsx(XE,{url:s.url,token:s.token,children:i}):t==="socketio"?y.jsx(H2,{children:i}):y.jsx(y.Fragment,{children:i})}const Ud="lt_view_as",Pd="lt_ai_override",yd="lt_graph_enabled",Id="lt_scan_override";function Gb(){try{const i=localStorage.getItem(Pd);if(i==="true")return!0;if(i==="false")return!1}catch{}return null}function F2(i){try{localStorage.setItem(Pd,String(i))}catch{}}function V2(){try{localStorage.removeItem(Pd)}catch{}}function $d(){try{const i=localStorage.getItem(Ud);if(i==="admin"||i==="engineer"||i==="operator")return i}catch{}return null}function Y2(i){try{localStorage.setItem(Ud,i)}catch{}window.location.reload()}function bd(){try{localStorage.removeItem(Ud)}catch{}window.location.reload()}function Fb(){try{return localStorage.getItem(yd)==="true"}catch{return!1}}function X2(i){try{i?localStorage.setItem(yd,"true"):localStorage.removeItem(yd)}catch{}}function Vb(){try{const i=localStorage.getItem(Id);if(i==="true")return!0;if(i==="false")return!1}catch{}return null}function K2(i){try{localStorage.setItem(Id,String(i))}catch{}}function J2(){try{localStorage.removeItem(Id)}catch{}}function Yb(){const{isSuperAdmin:i,hasRoleType:t,hasRole:r}=pn(),s=$d(),l=i||r("engineer"),c=t("admin"),m=i||t("admin");return{isBuilder:s?!1:l,isOps:s?s==="admin"||s==="engineer":c,canBulk:s?s==="admin":m,viewAs:s,realIsBuilder:l}}const Q2="lt_ai_override";function Z2(){return Ae("/settings")}function W2(){try{if(localStorage.getItem(Q2)==="off")return!1}catch{}return null}function Or(){var r;const i=pt({queryKey:["settings"],queryFn:Z2,staleTime:1/0}),t=W2();return i.data&&t===!1&&((r=i.data.ai)!=null&&r.enabled)?{...i,data:{...i.data,ai:{enabled:!1}}}:i}function Xb(){var f;const{isSuperAdmin:i,hasRoleType:t,hasRole:r}=pn(),{data:s}=Or(),l=((f=s==null?void 0:s.features)==null?void 0:f.publicPaceBoard)!==!1,c=i?"superadmin":t("admin")?"admin":r("engineer")?"engineer":"operator",m=$d(),p=m==="admin"||m==="engineer"||m==="operator"?m:null,g=p??c;return{tier:g,realTier:c,viewAs:p,canSeePaceBoard:l||g==="superadmin"||g==="admin",canSeeWorkflows:g==="superadmin"||g==="engineer",showTaskQueueCards:g==="operator"&&!l}}function Kb(i){return(i??"").replace(/[^A-Za-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"")||"none"}function vd(i={}){const t=i.role?Kb(i.role):"*",r=i.id??"*",s=i.verb??">";return`${GE}.system.escalation.${t}.${r}.${s}`}function Ay(i){return i.verbs.map(t=>vd({role:i.role,verb:t}))}function Hd(i){const{user:t,isSuperAdmin:r,hasRoleType:s}=pn(),l=r||s("admin"),c=((t==null?void 0:t.roles)??[]).map(p=>p.role).sort().join(","),m=(i??[]).join(",");return j.useMemo(()=>{const p=m?m.split(","):null;return l||!c?p?Ay({verbs:p}):[vd({})]:c.split(",").flatMap(g=>p?Ay({role:g,verbs:p}):[vd({role:g})])},[l,c,m])}const xd="/escalations/detail/";function eO(i){return i.startsWith(xd)&&i.slice(xd.length).split("/")[0]||void 0}function tO(){const{user:i}=pn(),t=go(),r=mn(),s=j.useRef(r.pathname);s.current=r.pathname;const l=j.useRef(i==null?void 0:i.userId);l.current=i==null?void 0:i.userId;const c=j.useCallback(m=>{var b,v,_;if((m==null?void 0:m.assignedAtCreation)!==!0)return;const p=(m==null?void 0:m.escalationId)??((b=m==null?void 0:m.data)==null?void 0:b.id),g=(v=m==null?void 0:m.data)==null?void 0:v.assigned_to,f=(_=m==null?void 0:m.data)==null?void 0:_.parent_id;if(!p||g!==l.current||!f||f!==eO(s.current))return;const d=`${xd}${p}`;s.current!==d&&t(d)},[t]);Rd(Hd(["claimed"]),c)}const Gd=j.createContext(null),$h="lt_sidebar_collapsed",Jb="(max-width: 1023px)";function nO(){try{return window.matchMedia(Jb).matches}catch{return!1}}function rO({children:i}){const[t,r]=j.useState(()=>{if(nO())return!0;try{return localStorage.getItem($h)==="true"}catch{return!1}});j.useEffect(()=>{let l;try{l=window.matchMedia(Jb)}catch{return}const c=m=>{if(m.matches)r(!0);else try{r(localStorage.getItem($h)==="true")}catch{r(!1)}};return l.addEventListener("change",c),()=>l.removeEventListener("change",c)},[]);const s=j.useCallback(()=>{r(l=>{const c=!l;try{localStorage.setItem($h,String(c))}catch{}return c})},[]);return y.jsx(Gd.Provider,{value:{collapsed:t,toggle:s},children:i})}function iO({children:i}){return y.jsx(Gd.Provider,{value:{collapsed:!1,toggle:()=>{}},children:i})}function Fd(){const i=j.useContext(Gd);if(!i)throw new Error("useSidebar must be used within SidebarProvider");return i}const jy=380,Vd=j.createContext(null);function sO({children:i}){const[t,r]=j.useState({node:null,width:jy,open:!1,ownerKey:null}),s=mn(),l=j.useRef(s.pathname),c=j.useCallback((p,g)=>{r({node:p,width:(g==null?void 0:g.width)??jy,open:!0,ownerKey:(g==null?void 0:g.key)??null})},[]),m=j.useCallback(p=>{r(g=>typeof p=="string"&&g.ownerKey!==p?g:{...g,open:!1})},[]);return j.useEffect(()=>{s.pathname!==l.current&&(l.current=s.pathname,r(p=>p.open||p.node?{...p,node:null,open:!1,ownerKey:null}:p))},[s.pathname]),y.jsx(Vd.Provider,{value:{...t,setPanel:c,closePanel:m},children:i})}function Yd(){const i=j.useContext(Vd);if(!i)throw new Error("useShellPanel must be used within ShellPanelProvider");return i}function a3(){return j.useContext(Vd)}function aO({open:i,width:t=380,children:r,className:s=""}){const[l,c]=j.useState(i);return j.useEffect(()=>{i&&c(!0)},[i]),y.jsx("div",{className:`shrink-0 overflow-hidden transition-[width] duration-300 ease-out ${s}`,style:{width:i?t:0,maxWidth:"50%"},onTransitionEnd:m=>{!i&&m.propertyName==="width"&&c(!1)},children:y.jsx("div",{style:{width:t},className:"h-full",children:l?r:null})})}function o3({label:i,children:t}){return y.jsxs("div",{children:[y.jsx("dt",{className:"text-2xs font-medium text-text-secondary uppercase tracking-wide",children:i}),y.jsx("dd",{className:"text-xs text-text-primary mt-0.5",children:t})]})}function l3({views:i,activeId:t,onViewChange:r,onClose:s,headerActions:l,stickyClassName:c,labelInline:m}){const p=i.find(g=>g.id===t)??i[0];return p?y.jsx("div",{className:"h-full bg-surface-hover",children:y.jsxs("div",{className:`flex flex-col ${c??"sticky top-0 z-10 max-h-[calc(100vh-3.5rem)]"}`,children:[y.jsxs("div",{className:`flex items-center justify-between pl-4 pr-3 shrink-0 ${m?"pt-10 pb-2":"pt-3"}`,children:[y.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[y.jsx("div",{className:"flex items-center gap-1 shrink-0",role:"radiogroup","aria-label":"Panel view",children:i.map(g=>{const f=g.icon,d=g.id===p.id;return y.jsx("button",{role:"radio","aria-checked":d,onClick:()=>r(g.id),title:g.label,className:`p-1.5 rounded-md transition-colors ${d?"bg-accent/10 text-accent":"text-accent/60 hover:text-accent hover:bg-surface-hover"}`,children:y.jsx(f,{className:"w-3.5 h-3.5"})},g.id)})}),m&&y.jsx("span",{className:"text-2xs font-semibold uppercase tracking-widest text-text-secondary truncate",children:p.label})]}),y.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[l,s&&y.jsx("button",{onClick:s,title:"Close panel",className:"p-1 rounded text-accent/60 hover:text-accent hover:bg-surface-hover transition-colors",children:y.jsx(Cn,{className:"w-3.5 h-3.5"})})]})]}),!m&&y.jsx("p",{className:"px-5 pt-2 pb-1 text-2xs font-semibold uppercase tracking-widest text-text-secondary shrink-0",children:p.label}),y.jsx("div",{className:`flex-1 overflow-y-auto px-5 ${m?"pt-4 pb-8":"pb-5 pt-1"}`,children:p.content})]})}):null}function Qb(i,t){var r,s,l,c,m;t.facets&&Object.keys(t.facets).length&&i.set("facets",JSON.stringify(t.facets)),(r=t.block)!=null&&r.length&&i.set("block",JSON.stringify(t.block)),(s=t.range)!=null&&s.length&&i.set("range",JSON.stringify(t.range)),(l=t.exists)!=null&&l.length&&i.set("exists",JSON.stringify(t.exists)),(c=t.roles)!=null&&c.length&&i.set("roles",JSON.stringify(t.roles)),(m=t.orderBy)!=null&&m.length&&i.set("orderBy",JSON.stringify(t.orderBy)),t.available!==void 0&&i.set("available",String(t.available)),t.jeopardy===!0&&i.set("jeopardy","1")}function c3(i,t){const r=i??"24h";return pt({queryKey:["stationMetrics",r],queryFn:()=>Ae(`/escalations/station-metrics?period=${r}`),staleTime:5e3,enabled:(t==null?void 0:t.enabled)??!0})}function u3(i){const t=i?`?period=${i}`:"";return pt({queryKey:["escalationStats",i],queryFn:()=>Ae(`/escalations/stats${t}`)})}function f3(){return pt({queryKey:["escalationTypes"],queryFn:()=>Ae("/escalations/types")})}function h3(i=!0){return pt({queryKey:["escalationFacetKeys"],queryFn:()=>Ae("/escalations/facet-keys"),enabled:i,staleTime:6e4})}function Zb(i){const{enabled:t=!0,staleTime:r,...s}=i,l=new URLSearchParams;return s.status&&l.set("status",s.status),s.role&&l.set("role",s.role),s.type&&l.set("type",s.type),s.subtype&&l.set("subtype",s.subtype),s.assigned_to&&l.set("assigned_to",s.assigned_to),s.parent_id&&l.set("parent_id",s.parent_id),s.claimed&&l.set("claimed","true"),s.priority&&l.set("priority",String(s.priority)),s.limit&&l.set("limit",String(s.limit)),s.offset!==void 0&&l.set("offset",String(s.offset)),s.sort_by&&l.set("sort_by",s.sort_by),s.order&&l.set("order",s.order),s.search&&l.set("search",s.search),Qb(l,s),pt({queryKey:["escalations",s],queryFn:()=>Ae(`/escalations?${l}`),enabled:t,...r!==void 0?{staleTime:r}:{}})}function Wb(i){const{enabled:t=!0,staleTime:r,...s}=i,l=new URLSearchParams;return s.role&&l.set("role",s.role),s.type&&l.set("type",s.type),s.subtype&&l.set("subtype",s.subtype),s.priority&&l.set("priority",String(s.priority)),s.limit&&l.set("limit",String(s.limit)),s.offset!==void 0&&l.set("offset",String(s.offset)),s.sort_by&&l.set("sort_by",s.sort_by),s.order&&l.set("order",s.order),s.search&&l.set("search",s.search),Qb(l,s),pt({queryKey:["escalations","available",s],queryFn:()=>Ae(`/escalations/available?${l}`),enabled:t,...r!==void 0?{staleTime:r}:{}})}function d3(i){return pt({queryKey:["escalations","by-workflow",i],queryFn:()=>Ae(`/escalations/by-workflow/${i}`),enabled:!!i})}function m3(i){return pt({queryKey:["escalations",i],queryFn:()=>Ae(`/escalations/${i}`),enabled:!!i})}function p3(){const i=gt();return Et({mutationFn:({id:t,durationMinutes:r})=>Ae(`/escalations/${t}/claim`,{method:"POST",body:JSON.stringify({durationMinutes:r})}),onSuccess:()=>{i.resetQueries({queryKey:["escalations"]}),i.resetQueries({queryKey:["escalationStats"]})}})}function g3(){const i=gt();return Et({mutationFn:t=>Ae(`/escalations/${t}/release`,{method:"POST"}),onSuccess:()=>{i.resetQueries({queryKey:["escalations"]}),i.resetQueries({queryKey:["escalationStats"]})}})}function y3(){const i=gt();return Et({mutationFn:({id:t,resolverPayload:r})=>Ae(`/escalations/${t}/resolve`,{method:"POST",body:JSON.stringify({resolverPayload:r})}),onSuccess:()=>{i.resetQueries({queryKey:["escalations"]}),i.resetQueries({queryKey:["escalationStats"]}),i.resetQueries({queryKey:["tasks"]}),i.resetQueries({queryKey:["jobs"]})}})}function b3(){const i=gt();return Et({mutationFn:({id:t,targetRole:r})=>Ae(`/escalations/${t}/escalate`,{method:"PATCH",body:JSON.stringify({targetRole:r})}),onSuccess:()=>{i.resetQueries({queryKey:["escalations"]}),i.resetQueries({queryKey:["escalationStats"]})}})}function v3(){const i=gt();return Et({mutationFn:({ids:t,priority:r})=>Ae("/escalations/priority",{method:"PATCH",body:JSON.stringify({ids:t,priority:r})}),onSuccess:()=>{i.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),i.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function x3(){const i=gt();return Et({mutationFn:({ids:t,durationMinutes:r})=>Ae("/escalations/bulk-claim",{method:"POST",body:JSON.stringify({ids:t,durationMinutes:r})}),onSuccess:()=>{i.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),i.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function _3(){const i=gt();return Et({mutationFn:({ids:t,targetUserId:r,durationMinutes:s})=>Ae("/escalations/bulk-assign",{method:"POST",body:JSON.stringify({ids:t,targetUserId:r,durationMinutes:s})}),onSuccess:()=>{i.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),i.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function w3(){const i=gt();return Et({mutationFn:({ids:t,hint:r})=>Ae("/escalations/bulk-triage",{method:"POST",body:JSON.stringify({ids:t,...r?{hint:r}:{}})}),onSuccess:()=>{i.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),i.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function S3(){const i=gt();return Et({mutationFn:t=>Ae(`/escalations/${t}/cancel`,{method:"POST"}),onSuccess:()=>{i.resetQueries({queryKey:["escalations"]}),i.resetQueries({queryKey:["escalationStats"]})}})}function E3(){const i=gt();return Et({mutationFn:({ids:t})=>Ae("/escalations/bulk-cancel",{method:"POST",body:JSON.stringify({ids:t})}),onSuccess:()=>{i.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),i.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function oO(){const{user:i}=pn(),t=i==null?void 0:i.userId,r=gt(),s=j.useRef(null),l=j.useCallback(()=>{s.current||(s.current=setTimeout(()=>{s.current=null,r.invalidateQueries({queryKey:["escalations"]})},15e3))},[r]);Rd(Hd(),l);const{data:c}=Wb({limit:1}),{data:m}=Zb({assigned_to:t,status:"pending",limit:1});return{available:(c==null?void 0:c.total)??0,mine:(m==null?void 0:m.total)??0}}function nu({size:i="sm",hideLabel:t=!1,className:r="",appName:s="LongTail",variant:l="full"}){const c=i==="lg";if(l==="comet")return y.jsx("div",{className:`relative overflow-visible ${r}`,style:{width:"2.5rem",height:"2.5rem",flexShrink:0},children:y.jsx("span",{role:"img","aria-label":s,className:"logo-mark absolute pointer-events-none select-none",style:{"--logo-url":`url(${Mt}/logo512.png)`,width:"82px",height:"82px",top:"-12px",left:"-80px",transform:"rotate(232deg)",zIndex:-1,opacity:.55}})});if(l==="mark")return y.jsx("div",{className:`flex items-center ${r}`,children:y.jsx("span",{role:"img","aria-label":s,className:"logo-mark shrink-0 w-7 h-7",style:{"--logo-url":`url(${Mt}/logo512.png)`}})});const m=c?"w-[16rem] h-[16rem] -rotate-[120deg] opacity-55 -ml-10":"w-[12.5rem] h-[12.5rem] -rotate-[120deg] opacity-55 -ml-8",p=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 y.jsxs("div",{className:`flex items-center ${r}`,style:{height:"50px"},children:[y.jsx("span",{role:"img","aria-label":s,className:`logo-mark shrink-0 z-0 ${m}`,style:{"--logo-url":`url(${Mt}/logo512.png)`}}),y.jsx("span",{className:`z-[1] transition-opacity duration-300 ${p} ${t?"opacity-0":""}`,children:s})]})}const lO=[{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"}],cO=["operator","engineer","admin","superadmin"];function Ty(i){return cO.indexOf(i)}function uO(i,t){return Ty(i)>=Ty(t)}function fO({onClose:i}){var oe,de,Oe,le,je,Se,Ne;const{isSuperAdmin:t,hasRoleType:r,hasRole:s}=pn(),{data:l}=Or(),c=$d(),m=!!((oe=l==null?void 0:l.ai)!=null&&oe.enabled),p=Gb(),g=p!==null?p:m,[f,d]=j.useState(g),b=(de=l==null?void 0:l.features)==null?void 0:de.graphWorkflows,v=b==null,[_,w]=j.useState(b===!0||v&&Fb()),S=!!((Oe=l==null?void 0:l.features)!=null&&Oe.scanCodes),M=Vb(),[L,z]=j.useState(M!==null?M:S),ie=t?"superadmin":r("admin")?"admin":s("engineer")?"engineer":"operator",ae=((le=l==null?void 0:l.branding)==null?void 0:le.appName)??"LongTail",C=(je=l==null?void 0:l.environment)==null?void 0:je.longTailVersion,I=(Se=l==null?void 0:l.environment)==null?void 0:Se.hotmeshVersion,re=(Ne=l==null?void 0:l.environment)==null?void 0:Ne.nodeEnv;j.useEffect(()=>{const be=at=>{at.key==="Escape"&&i()};return document.addEventListener("keydown",be),()=>document.removeEventListener("keydown",be)},[i]);const K=lO.filter(be=>uO(ie,be.minTier)),B=K.length>1,G=[...B?[{id:"viewas",label:"View As",icon:nw}]:[],{id:"features",label:"Features",icon:rw}],[W,Q]=j.useState(G[0].id),he=be=>{be===null?bd():Y2(be)},_e=()=>{const be=!f;d(be),be===m?V2():F2(be),window.location.reload()},Te=()=>{const be=!_;w(be),X2(be),window.location.reload()},Y=()=>{const be=!L;z(be),be===S?J2():K2(be),window.location.reload()};return y.jsx("div",{className:"fixed inset-0 z-[100] bg-surface-sunken/75 backdrop-blur-sm flex items-center justify-center",onClick:i,children:y.jsxs("div",{className:"relative w-[440px] max-h-[85vh] overflow-y-auto bg-surface-raised px-12 py-10",onClick:be=>be.stopPropagation(),children:[y.jsx("button",{onClick:i,className:"absolute top-4 right-4 text-text-quaternary hover:text-text-secondary transition-colors p-1","aria-label":"Close",children:y.jsx(Cn,{className:"w-4 h-4",strokeWidth:1.5})}),y.jsxs("div",{className:"flex flex-col items-center gap-3 pb-8",children:[y.jsx("span",{className:"logo-mark block w-20 h-20 opacity-50",style:{"--logo-url":`url(${Mt}/logo512.png)`}}),y.jsxs("div",{className:"text-center",children:[y.jsx("p",{className:"text-2xl font-light text-text-primary tracking-[0.12em]",children:ae}),C&&y.jsxs("p",{className:"mt-1 text-2xs text-text-tertiary",children:["v",C,I&&y.jsxs(y.Fragment,{children:[" · HotMesh v",I]}),re&&re!=="production"&&y.jsx("span",{className:"ml-1 text-status-warning",children:re})]})]})]}),y.jsx("hr",{className:"border-surface-border/50 mb-6"}),G.length>1&&y.jsx("div",{className:"flex items-center justify-center gap-2 mb-8",role:"tablist",children:G.map(be=>{const at=W===be.id;return y.jsxs("button",{role:"tab","aria-selected":at,onClick:()=>Q(be.id),title:be.label,className:`flex flex-col items-center gap-1.5 px-5 py-2.5 rounded-lg transition-colors ${at?"bg-accent/10 text-accent":"text-text-tertiary hover:text-text-secondary hover:bg-surface-hover"}`,children:[y.jsx(be.icon,{className:"w-5 h-5",strokeWidth:1.5,...at?{fill:"currentColor",fillOpacity:.15}:{}}),y.jsx("span",{className:"text-2xs font-medium",children:be.label})]},be.id)})}),W==="viewas"&&B&&y.jsxs("div",{className:"space-y-1",children:[y.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-4",children:"View As"}),K.map(be=>{const at=c===be.id,Ht=be.id===null?`Your view · ${ie}`:be.label;return y.jsxs("button",{onClick:()=>he(be.id),className:"w-full text-left flex items-start gap-3 py-2.5 px-1 group",children:[y.jsx("span",{className:`mt-0.5 w-4 h-4 rounded-full border shrink-0 flex items-center justify-center transition-colors ${at?"border-accent bg-accent":"border-surface-border group-hover:border-accent/60"}`,children:at&&y.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-text-inverse"})}),y.jsxs("span",{children:[y.jsx("span",{className:`block text-sm font-medium transition-colors ${at?"text-accent":"text-text-primary group-hover:text-accent"}`,children:Ht}),y.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:be.description})]})]},String(be.id))})]}),W==="features"&&y.jsxs("div",{children:[y.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-4",children:"Features"}),y.jsxs("button",{onClick:_e,className:"w-full text-left flex items-center justify-between py-2.5 px-1 group",children:[y.jsxs("span",{children:[y.jsx("span",{className:"block text-sm font-medium text-text-primary group-hover:text-accent transition-colors",children:"AI features"}),y.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:f?"Enabled — AI assist, agent labels, bulk AI actions":"Hidden — automation labels, no AI surfaces"})]}),y.jsx("span",{className:`shrink-0 ml-4 w-9 h-5 rounded-full transition-colors flex items-center px-0.5 ${f?"bg-accent":"bg-surface-border"}`,children:y.jsx("span",{className:`w-4 h-4 rounded-full bg-text-inverse shadow-sm transition-transform ${f?"translate-x-4":"translate-x-0"}`})})]}),v&&y.jsxs("button",{onClick:Te,className:"w-full text-left flex items-center justify-between py-2.5 px-1 group",children:[y.jsxs("span",{children:[y.jsx("span",{className:"block text-sm font-medium text-text-primary group-hover:text-accent transition-colors",children:"Graph workflows"}),y.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:_?"Visible — Graph section shown in Orchestrate sidebar":"Hidden — use Procedural workflows instead"})]}),y.jsx("span",{className:`shrink-0 ml-4 w-9 h-5 rounded-full transition-colors flex items-center px-0.5 ${_?"bg-accent":"bg-surface-border"}`,children:y.jsx("span",{className:`w-4 h-4 rounded-full bg-text-inverse shadow-sm transition-transform ${_?"translate-x-4":"translate-x-0"}`})})]}),y.jsxs("button",{onClick:Y,className:"w-full text-left flex items-center justify-between py-2.5 px-1 group",children:[y.jsxs("span",{children:[y.jsx("span",{className:"block text-sm font-medium text-text-primary group-hover:text-accent transition-colors",children:"Scan input"}),y.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:L?"Enabled — header scan affordance, panel, and keyboard-wedge capture":"Hidden — the deployment opts in with features.scanCodes"})]}),y.jsx("span",{className:`shrink-0 ml-4 w-9 h-5 rounded-full transition-colors flex items-center px-0.5 ${L?"bg-accent":"bg-surface-border"}`,children:y.jsx("span",{className:`w-4 h-4 rounded-full bg-text-inverse shadow-sm transition-transform ${L?"translate-x-4":"translate-x-0"}`})})]})]}),y.jsx("hr",{className:"border-surface-border/50 mt-8"}),y.jsx("p",{className:"mt-4 text-2xs text-text-quaternary text-center",children:"Esc or click outside to close"})]})})}const ev=[{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"}],Ny="blue",tv="lt.theme";let nv=[];function hO(i){const t=new Set(ev.map(s=>s.id)),r=new Set;nv=i.filter(s=>!(s!=null&&s.id)||t.has(s.id)||r.has(s.id)?!1:(r.add(s.id),!0))}function dO(){return[...ev,...nv]}function rv(){try{return localStorage.getItem(tv)||Ny}catch{return Ny}}function iv(i){document.documentElement.dataset.theme=i}function mO(i){try{localStorage.setItem(tv,i)}catch{}iv(i)}const sv=j.createContext(null);function pO(){const i=j.useContext(sv);if(!i)throw new Error("useActingIdentity must be used within ActingIdentityProvider");return i}function gO({children:i}){const[t,r]=j.useState(null),s=j.useRef(t);s.current=t,j.useEffect(()=>{if(!(t!=null&&t.expiresAt))return;const g=new Date(t.expiresAt).getTime()-Date.now();if(g<=0){r(null);return}const f=setTimeout(()=>r(null),g);return()=>clearTimeout(f)},[t]);const l=j.useCallback(g=>{var d;if(!g.actingToken||!g.actor)return null;const f=((d=s.current)==null?void 0:d.actingToken)??null;return r({actingToken:g.actingToken,actorId:g.actor.id,displayName:g.actor.displayName,expiresAt:g.expiresAt??null}),f},[]),c=j.useCallback(()=>r(null),[]);j.useEffect(()=>(Xg(()=>{var g;return((g=s.current)==null?void 0:g.actingToken)??null}),Kg(c),()=>{Xg(null),Kg(null)}),[c]);const m=j.useCallback(()=>{var f;const g=(f=s.current)==null?void 0:f.expiresAt;return g?Math.max(0,Math.floor((new Date(g).getTime()-Date.now())/1e3)):0},[]),p=j.useMemo(()=>({identity:t,prime:l,clear:c,remainingSeconds:m}),[t,l,c,m]);return y.jsx(sv.Provider,{value:p,children:i})}const Yc={maxKeyGapMs:500,terminators:["Enter","Tab"],minLength:6,autoFireQuietMs:300,autoFireMaxAvgKeyMs:50},av="lt_scan_wedge_config";function ov(){try{const i=localStorage.getItem(av);return i?{...Yc,...JSON.parse(i)}:Yc}catch{return Yc}}function yO(i){const t={...ov(),...i};return localStorage.setItem(av,JSON.stringify(t)),t}const bO=[/[1-9][0-9]:[0-9]:[a-zA-Z0-9._-]+$/,/[1-9][0-9]{7,}$/];function ky(i){let t=null;for(const r of bO){const s=i.match(r);s&&(!t||s[0].length>t.length)&&(t=s[0])}return t}const vO=new Set(["Shift","CapsLock"]),Ql={suppress:!1,emit:null};function xO(i=Yc){let t={buffer:"",times:[],lastKeyMs:0};function r(){t={buffer:"",times:[],lastKeyMs:0}}function s(m){const{key:p,timeMs:g,hasModifier:f,isRepeat:d}=m;if(vO.has(p))return Ql;if(i.terminators.includes(p)){const S=ky(t.buffer);return r(),S&&S.length>=i.minLength?{suppress:!0,emit:S,consumedLength:S.length}:Ql}if(f||d||p.length!==1)return r(),Ql;const b=g-t.lastKeyMs,v=t.lastKeyMs>0&&b<=i.maxKeyGapMs,_=(v?t.buffer+p:p).slice(-128),w=(v?[...t.times,g]:[g]).slice(-128);return t={buffer:_,times:w,lastKeyMs:g},Ql}function l(){return{buffer:t.buffer}}function c(){const m=ky(t.buffer);if(!m||m.length<i.minLength)return null;const p=t.times.slice(-m.length);return p.length<2||(p[p.length-1]-p[0])/(p.length-1)>i.autoFireMaxAvgKeyMs?null:{code:m,consumedLength:m.length}}return{step:s,reset:r,snapshot:l,pendingAutoFire:c}}function _O(){const i=document.activeElement;return i instanceof HTMLInputElement?["text","search","tel","url","email","password","number"].includes(i.type)?i:null:i instanceof HTMLTextAreaElement?i:null}function wO(i,t,r){var c;const s=i instanceof HTMLInputElement?HTMLInputElement.prototype:HTMLTextAreaElement.prototype,l=(c=Object.getOwnPropertyDescriptor(s,"value"))==null?void 0:c.set;l?l.call(i,t):i.value=t;try{i.setSelectionRange(r,r)}catch{}i.dispatchEvent(new Event("input",{bubbles:!0}))}function Cy(i){if(i<=0)return;const t=_O();if(!t)return;const r=t.selectionStart??t.value.length,s=Math.max(0,r-i);wO(t,t.value.slice(0,s)+t.value.slice(r),s)}function SO({active:i,wedgeConfig:t,diagnosticsOn:r,onScan:s,onDiag:l}){const c=j.useRef({diagnosticsOn:r,onScan:s,onDiag:l});c.current={diagnosticsOn:r,onScan:s,onDiag:l};const m=j.useRef(0),p=j.useRef(0);j.useEffect(()=>{if(!i)return;const g=xO(t);let f=null;const d=()=>{f&&(clearTimeout(f),f=null)},b=(w,S,M)=>{S&&Cy(S),c.current.diagnosticsOn&&(console.debug("[scan]",M),c.current.onDiag({seq:++m.current,key:"(quiet)",code:"",deltaMs:0,buffer:"",note:M})),c.current.onScan(w)},v=()=>{d(),g.pendingAutoFire()&&(f=setTimeout(()=>{f=null;const w=g.pendingAutoFire();w&&(g.reset(),b(w.code,w.consumedLength,`capture → ${w.code} (quiet period — no suffix)`))},t.autoFireQuietMs))},_=w=>{const S=g.snapshot().buffer,{suppress:M,emit:L,consumedLength:z}=g.step({key:w.key,timeMs:w.timeStamp,hasModifier:w.ctrlKey||w.metaKey||w.altKey,isRepeat:w.repeat});if(M&&(w.preventDefault(),w.stopPropagation()),c.current.diagnosticsOn){const ie=g.snapshot().buffer,ae=t.terminators.includes(w.key),C=L?`capture → ${L}`:ae?`terminator — no code tail in "${S.slice(-24)}"`:ie===S?S?"neutral (chord key)":"ignored":ie===""?"reset (edit/chord/non-printable)":ie.length<=1&&S.length>1?"gap — new episode":"accumulate",I=p.current?Math.round(w.timeStamp-p.current):0,re={seq:++m.current,key:w.key,code:w.code!==w.key?w.code:"",deltaMs:I,buffer:ie.slice(-24),note:C};console.debug("[scan]",re.key,re.code,`${re.deltaMs}ms`,re.note),c.current.onDiag(re)}p.current=w.timeStamp,L?(d(),z&&Cy(z),c.current.onScan(L)):v()};return window.addEventListener("keydown",_,{capture:!0}),()=>{d(),window.removeEventListener("keydown",_,{capture:!0})}},[i,t])}const Pe={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"},Zl={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"},O3={ACTION:"action",IDENTITY:"identity"};function EO(i,t){return Ae("/scan-codes/execute",{method:"POST",body:JSON.stringify({code:i,...t!=null&&t.actingToken?{actingToken:t.actingToken}:{},...t!=null&&t.previousActingToken?{previousActingToken:t.previousActingToken}:{}})})}function A3(i){return Ae("/scan-codes/execute-choice",{method:"POST",body:JSON.stringify(i)})}function j3(){return pt({queryKey:["scan-schemes"],queryFn:()=>Ae("/scan-codes/schemes")})}function T3(i){return pt({queryKey:["scan-schemes",i],queryFn:()=>Ae(`/scan-codes/schemes/${i}`),enabled:i!=null})}function N3(){const i=gt();return Et({mutationFn:t=>Ae(`/scan-codes/schemes/${t.version}`,{method:"PUT",body:JSON.stringify(t)}),onSuccess:()=>i.invalidateQueries({queryKey:["scan-schemes"]})})}function k3(){const i=gt();return Et({mutationFn:t=>Ae(`/scan-codes/schemes/${t}`,{method:"DELETE"}),onSuccess:()=>i.invalidateQueries({queryKey:["scan-schemes"]})})}function C3(){const i=gt();return Et({mutationFn:t=>Ae(`/scan-codes/schemes/${t.scheme_version}/actions/${t.category}`,{method:"PUT",body:JSON.stringify(t)}),onSuccess:(t,r)=>i.invalidateQueries({queryKey:["scan-schemes",r.scheme_version]})})}function M3(){const i=gt();return Et({mutationFn:t=>Ae(`/scan-codes/schemes/${t.scheme_version}/actions/${t.category}`,{method:"DELETE"}),onSuccess:(t,r)=>i.invalidateQueries({queryKey:["scan-schemes",r.scheme_version]})})}const My={KEYBOARD_WEDGE:"keyboard-wedge",MANUAL:"manual"},Cs=i=>{if(i)try{return JSON.parse(i)}catch{return}},Ui=i=>i==null||Array.isArray(i)&&i.length===0||typeof i=="object"&&!Array.isArray(i)&&Object.keys(i).length===0;function OO(i){const t={},r=Cs(i.get("facets"));Ui(r)||(t.facets=r);const s=Cs(i.get("block"));Ui(s)||(t.block=s);const l=Cs(i.get("range"));Ui(l)||(t.range=l);const c=Cs(i.get("exists"));Ui(c)||(t.exists=c);const m=Cs(i.get("roles"));Ui(m)||(t.roles=m);const p=Cs(i.get("orderBy"));Ui(p)||(t.orderBy=p),i.get("available")!=null&&(t.available=i.get("available")==="true");const g=i.get("jeopardy");return(g==="1"||g==="true")&&(t.jeopardy=!0),t}function R3(i,t){const r=(s,l)=>Ui(l)?i.delete(s):i.set(s,JSON.stringify(l));r("facets",t.facets),r("block",t.block),r("range",t.range),r("exists",t.exists),r("roles",t.roles),r("orderBy",t.orderBy),t.available==null?i.delete("available"):i.set("available",String(t.available)),t.jeopardy===!0?i.set("jeopardy","1"):i.delete("jeopardy")}function lv(i,t){const r={};for(const[l,c]of Object.entries(i))r[l]=typeof c=="object"&&c!==null?JSON.stringify(c):c;const s=encodeURIComponent(JSON.stringify(r));return t?`/escalations/available?role=${encodeURIComponent(t)}&facets=${s}&status=all`:`/escalations/available?facets=${s}&status=all`}function D3(i,t,r){return lv({[i]:t},r)}function q3(i){var t,r,s;return Object.keys(i.facets??{}).length+(((t=i.block)==null?void 0:t.length)??0)+(((r=i.range)==null?void 0:r.length)??0)+(((s=i.exists)==null?void 0:s.length)??0)+(i.available!=null?1:0)+(i.jeopardy===!0?1:0)}function cv(){var r;const{data:i}=Or(),t=Vb();return t!==null?t:!!((r=i==null?void 0:i.features)!=null&&r.scanCodes)}const uv=j.createContext(null);function fv(){const i=j.useContext(uv);if(!i)throw new Error("useScanInput must be used within ScanInputProvider");return i}const AO="scanPendingAction",jO="scanChoices",TO="/scan/station";function NO({children:i}){const{user:t}=pn(),r=cv(),s=go(),{identity:l,prime:c}=pO(),[m,p]=j.useState(null),[g,f]=j.useState(!1),[d,b]=j.useState(()=>ov()),[v,_]=j.useState([]),[w,S]=j.useState(!1),M=j.useCallback(B=>{var W;const{outcome:G}=B;if(G===Pe.CONFIRM_REQUIRED&&B.pendingAction)return s(`/escalations/detail/${B.pendingAction.escalationId}`,{state:{[AO]:B.pendingAction}}),!0;if(G===Pe.EXECUTED&&B.escalation){const Q=[Zl.SHOW_DETAIL,Zl.CLAIM_SHOW_DETAIL,Zl.CLAIM,Zl.ESCALATE];return B.verb&&Q.includes(B.verb)?(s(`/escalations/detail/${B.escalation.id}`),!0):!1}if(G===Pe.MATCHED_LIST&&B.listQuery){const{targetFacet:Q,target:he,roles:_e}=B.listQuery;return s(lv({[Q]:he},(_e==null?void 0:_e[0])??null)),!0}return G===Pe.CHOICES&&B.choices?(s(TO,{state:{[jO]:B}}),!0):G===Pe.NO_MATCH_FALLBACK&&((W=B.fallback)!=null&&W.route)?(s(B.fallback.route),!0):!1},[s]),L=j.useRef(null);L.current=(l==null?void 0:l.actingToken)??null;const z=j.useRef(null),ie=j.useRef(null),ae=j.useCallback(B=>{ie.current=B},[]),C=j.useCallback(async(B,G=My.MANUAL)=>{var Q;if((Q=ie.current)!=null&&Q.call(ie,B))return;f(!0);const W=Date.now();try{const he=await EO(B,{actingToken:L.current??void 0,previousActingToken:z.current??void 0});he.outcome===Pe.IDENTITY_PRIMED&&(z.current=c(he));const _e=M(he);p({code:B,source:G,at:W,response:he,error:null,navigated:_e})}catch(he){p({code:B,source:G,at:W,response:null,error:he.message,navigated:!1})}finally{f(!1)}},[M,c]),I=j.useRef(C);I.current=C,SO({active:!!t&&r,wedgeConfig:d,diagnosticsOn:w,onScan:B=>void I.current(B,My.KEYBOARD_WEDGE),onDiag:B=>_(G=>[...G.slice(-29),B])});const re=j.useCallback(B=>{b(yO(B))},[]),K=j.useMemo(()=>({submitCode:C,setCodeInterceptor:ae,lastResult:m,busy:g,wedgeConfig:d,updateWedgeConfig:re,diagnostics:v,diagnosticsOn:w,setDiagnosticsOn:S}),[C,ae,m,g,d,re,v,w]);return y.jsx(uv.Provider,{value:K,children:i})}var Wl={},Xa={},ec={},Ry;function gn(){if(Ry)return ec;Ry=1,Object.defineProperty(ec,"__esModule",{value:!0});function i(r,s){if(!(r instanceof s))throw new TypeError("Cannot call a class as a function")}var t=function r(s,l){i(this,r),this.data=s,this.text=l.text||s,this.options=l};return ec.default=t,ec}var Dy;function kO(){if(Dy)return Xa;Dy=1,Object.defineProperty(Xa,"__esModule",{value:!0}),Xa.CODE39=void 0;var i=(function(){function S(M,L){for(var z=0;z<L.length;z++){var ie=L[z];ie.enumerable=ie.enumerable||!1,ie.configurable=!0,"value"in ie&&(ie.writable=!0),Object.defineProperty(M,ie.key,ie)}}return function(M,L,z){return L&&S(M.prototype,L),z&&S(M,z),M}})(),t=gn(),r=s(t);function s(S){return S&&S.__esModule?S:{default:S}}function l(S,M){if(!(S instanceof M))throw new TypeError("Cannot call a class as a function")}function c(S,M){if(!S)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return M&&(typeof M=="object"||typeof M=="function")?M:S}function m(S,M){if(typeof M!="function"&&M!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof M);S.prototype=Object.create(M&&M.prototype,{constructor:{value:S,enumerable:!1,writable:!0,configurable:!0}}),M&&(Object.setPrototypeOf?Object.setPrototypeOf(S,M):S.__proto__=M)}var p=(function(S){m(M,S);function M(L,z){return l(this,M),L=L.toUpperCase(),z.mod43&&(L+=v(w(L))),c(this,(M.__proto__||Object.getPrototypeOf(M)).call(this,L,z))}return i(M,[{key:"encode",value:function(){for(var z=d("*"),ie=0;ie<this.data.length;ie++)z+=d(this.data[ie])+"0";return z+=d("*"),{data:z,text:this.text}}},{key:"valid",value:function(){return this.data.search(/^[0-9A-Z\-\.\ \$\/\+\%]+$/)!==-1}}]),M})(r.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","-","."," ","$","/","+","%","*"],f=[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 d(S){return b(_(S))}function b(S){return f[S].toString(2)}function v(S){return g[S]}function _(S){return g.indexOf(S)}function w(S){for(var M=0,L=0;L<S.length;L++)M+=_(S[L]);return M=M%43,M}return Xa.CODE39=p,Xa}var zn={},tc={},nc={},ut={},qy;function vo(){if(qy)return ut;qy=1,Object.defineProperty(ut,"__esModule",{value:!0});var i;function t(g,f,d){return f in g?Object.defineProperty(g,f,{value:d,enumerable:!0,configurable:!0,writable:!0}):g[f]=d,g}var r=ut.SET_A=0,s=ut.SET_B=1,l=ut.SET_C=2;ut.SHIFT=98;var c=ut.START_A=103,m=ut.START_B=104,p=ut.START_C=105;return ut.MODULO=103,ut.STOP=106,ut.FNC1=207,ut.SET_BY_CODE=(i={},t(i,c,r),t(i,m,s),t(i,p,l),i),ut.SWAP={101:r,100:s,99:l},ut.A_START_CHAR="Ð",ut.B_START_CHAR="Ñ",ut.C_START_CHAR="Ò",ut.A_CHARS="[\0-_È-Ï]",ut.B_CHARS="[ -È-Ï]",ut.C_CHARS="(Ï*[0-9]{2}Ï*)",ut.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],ut}var By;function mu(){if(By)return nc;By=1,Object.defineProperty(nc,"__esModule",{value:!0});var i=(function(){function f(d,b){for(var v=0;v<b.length;v++){var _=b[v];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(d,_.key,_)}}return function(d,b,v){return b&&f(d.prototype,b),v&&f(d,v),d}})(),t=gn(),r=l(t),s=vo();function l(f){return f&&f.__esModule?f:{default:f}}function c(f,d){if(!(f instanceof d))throw new TypeError("Cannot call a class as a function")}function m(f,d){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:f}function p(f,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);f.prototype=Object.create(d&&d.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(f,d):f.__proto__=d)}var g=(function(f){p(d,f);function d(b,v){c(this,d);var _=m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b.substring(1),v));return _.bytes=b.split("").map(function(w){return w.charCodeAt(0)}),_}return i(d,[{key:"valid",value:function(){return/^[\x00-\x7F\xC8-\xD3]+$/.test(this.data)}},{key:"encode",value:function(){var v=this.bytes,_=v.shift()-105,w=s.SET_BY_CODE[_];if(w===void 0)throw new RangeError("The encoding does not start with a start character.");this.shouldEncodeAsEan128()===!0&&v.unshift(s.FNC1);var S=d.next(v,1,w);return{text:this.text===this.data?this.text.replace(/[^\x20-\x7E]/g,""):this.text,data:d.getBar(_)+S.result+d.getBar((S.checksum+_)%s.MODULO)+d.getBar(s.STOP)}}},{key:"shouldEncodeAsEan128",value:function(){var v=this.options.ean128||!1;return typeof v=="string"&&(v=v.toLowerCase()==="true"),v}}],[{key:"getBar",value:function(v){return s.BARS[v]?s.BARS[v].toString():""}},{key:"correctIndex",value:function(v,_){if(_===s.SET_A){var w=v.shift();return w<32?w+64:w-32}else return _===s.SET_B?v.shift()-32:(v.shift()-48)*10+v.shift()-48}},{key:"next",value:function(v,_,w){if(!v.length)return{result:"",checksum:0};var S=void 0,M=void 0;if(v[0]>=200){M=v.shift()-105;var L=s.SWAP[M];L!==void 0?S=d.next(v,_+1,L):((w===s.SET_A||w===s.SET_B)&&M===s.SHIFT&&(v[0]=w===s.SET_A?v[0]>95?v[0]-96:v[0]:v[0]<32?v[0]+96:v[0]),S=d.next(v,_+1,w))}else M=d.correctIndex(v,w),S=d.next(v,_+1,w);var z=d.getBar(M),ie=M*_;return{result:z+S.result,checksum:ie+S.checksum}}}]),d})(r.default);return nc.default=g,nc}var rc={},Ly;function CO(){if(Ly)return rc;Ly=1,Object.defineProperty(rc,"__esModule",{value:!0});var i=vo(),t=function(p){return p.match(new RegExp("^"+i.A_CHARS+"*"))[0].length},r=function(p){return p.match(new RegExp("^"+i.B_CHARS+"*"))[0].length},s=function(p){return p.match(new RegExp("^"+i.C_CHARS+"*"))[0]};function l(m,p){var g=p?i.A_CHARS:i.B_CHARS,f=m.match(new RegExp("^("+g+"+?)(([0-9]{2}){2,})([^0-9]|$)"));if(f)return f[1]+"Ì"+c(m.substring(f[1].length));var d=m.match(new RegExp("^"+g+"+"))[0];return d.length===m.length?m:d+String.fromCharCode(p?205:206)+l(m.substring(d.length),!p)}function c(m){var p=s(m),g=p.length;if(g===m.length)return m;m=m.substring(g);var f=t(m)>=r(m);return p+String.fromCharCode(f?206:205)+l(m,f)}return rc.default=function(m){var p=void 0,g=s(m).length;if(g>=2)p=i.C_START_CHAR+c(m);else{var f=t(m)>r(m);p=(f?i.A_START_CHAR:i.B_START_CHAR)+l(m,f)}return p.replace(/[\xCD\xCE]([^])[\xCD\xCE]/,function(d,b){return"Ë"+b})},rc}var zy;function MO(){if(zy)return tc;zy=1,Object.defineProperty(tc,"__esModule",{value:!0});var i=mu(),t=l(i),r=CO(),s=l(r);function l(f){return f&&f.__esModule?f:{default:f}}function c(f,d){if(!(f instanceof d))throw new TypeError("Cannot call a class as a function")}function m(f,d){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:f}function p(f,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);f.prototype=Object.create(d&&d.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(f,d):f.__proto__=d)}var g=(function(f){p(d,f);function d(b,v){if(c(this,d),/^[\x00-\x7F\xC8-\xD3]+$/.test(b))var _=m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,(0,s.default)(b),v));else var _=m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b,v));return m(_)}return d})(t.default);return tc.default=g,tc}var ic={},Uy;function RO(){if(Uy)return ic;Uy=1,Object.defineProperty(ic,"__esModule",{value:!0});var i=(function(){function f(d,b){for(var v=0;v<b.length;v++){var _=b[v];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(d,_.key,_)}}return function(d,b,v){return b&&f(d.prototype,b),v&&f(d,v),d}})(),t=mu(),r=l(t),s=vo();function l(f){return f&&f.__esModule?f:{default:f}}function c(f,d){if(!(f instanceof d))throw new TypeError("Cannot call a class as a function")}function m(f,d){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:f}function p(f,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);f.prototype=Object.create(d&&d.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(f,d):f.__proto__=d)}var g=(function(f){p(d,f);function d(b,v){return c(this,d),m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,s.A_START_CHAR+b,v))}return i(d,[{key:"valid",value:function(){return new RegExp("^"+s.A_CHARS+"+$").test(this.data)}}]),d})(r.default);return ic.default=g,ic}var sc={},Py;function DO(){if(Py)return sc;Py=1,Object.defineProperty(sc,"__esModule",{value:!0});var i=(function(){function f(d,b){for(var v=0;v<b.length;v++){var _=b[v];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(d,_.key,_)}}return function(d,b,v){return b&&f(d.prototype,b),v&&f(d,v),d}})(),t=mu(),r=l(t),s=vo();function l(f){return f&&f.__esModule?f:{default:f}}function c(f,d){if(!(f instanceof d))throw new TypeError("Cannot call a class as a function")}function m(f,d){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:f}function p(f,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);f.prototype=Object.create(d&&d.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(f,d):f.__proto__=d)}var g=(function(f){p(d,f);function d(b,v){return c(this,d),m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,s.B_START_CHAR+b,v))}return i(d,[{key:"valid",value:function(){return new RegExp("^"+s.B_CHARS+"+$").test(this.data)}}]),d})(r.default);return sc.default=g,sc}var ac={},Iy;function qO(){if(Iy)return ac;Iy=1,Object.defineProperty(ac,"__esModule",{value:!0});var i=(function(){function f(d,b){for(var v=0;v<b.length;v++){var _=b[v];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(d,_.key,_)}}return function(d,b,v){return b&&f(d.prototype,b),v&&f(d,v),d}})(),t=mu(),r=l(t),s=vo();function l(f){return f&&f.__esModule?f:{default:f}}function c(f,d){if(!(f instanceof d))throw new TypeError("Cannot call a class as a function")}function m(f,d){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:f}function p(f,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);f.prototype=Object.create(d&&d.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(f,d):f.__proto__=d)}var g=(function(f){p(d,f);function d(b,v){return c(this,d),m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,s.C_START_CHAR+b,v))}return i(d,[{key:"valid",value:function(){return new RegExp("^"+s.C_CHARS+"+$").test(this.data)}}]),d})(r.default);return ac.default=g,ac}var $y;function BO(){if($y)return zn;$y=1,Object.defineProperty(zn,"__esModule",{value:!0}),zn.CODE128C=zn.CODE128B=zn.CODE128A=zn.CODE128=void 0;var i=MO(),t=g(i),r=RO(),s=g(r),l=DO(),c=g(l),m=qO(),p=g(m);function g(f){return f&&f.__esModule?f:{default:f}}return zn.CODE128=t.default,zn.CODE128A=s.default,zn.CODE128B=c.default,zn.CODE128C=p.default,zn}var Ut={},oc={},xr={},Hy;function xo(){return Hy||(Hy=1,Object.defineProperty(xr,"__esModule",{value:!0}),xr.SIDE_BIN="101",xr.MIDDLE_BIN="01010",xr.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"]},xr.EAN2_STRUCTURE=["LL","LG","GL","GG"],xr.EAN5_STRUCTURE=["GGLLL","GLGLL","GLLGL","GLLLG","LGGLL","LLGGL","LLLGG","LGLGL","LGLLG","LLGLG"],xr.EAN13_STRUCTURE=["LLLLLL","LLGLGG","LLGGLG","LLGGGL","LGLLGG","LGGLLG","LGGGLL","LGLGLG","LGLGGL","LGGLGL"]),xr}var lc={},cc={},Gy;function _o(){if(Gy)return cc;Gy=1,Object.defineProperty(cc,"__esModule",{value:!0});var i=xo(),t=function(s,l,c){var m=s.split("").map(function(g,f){return i.BINARIES[l[f]]}).map(function(g,f){return g?g[s[f]]:""});if(c){var p=s.length-1;m=m.map(function(g,f){return f<p?g+c:g})}return m.join("")};return cc.default=t,cc}var Fy;function hv(){if(Fy)return lc;Fy=1,Object.defineProperty(lc,"__esModule",{value:!0});var i=(function(){function b(v,_){for(var w=0;w<_.length;w++){var S=_[w];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(v,S.key,S)}}return function(v,_,w){return _&&b(v.prototype,_),w&&b(v,w),v}})(),t=xo(),r=_o(),s=m(r),l=gn(),c=m(l);function m(b){return b&&b.__esModule?b:{default:b}}function p(b,v){if(!(b instanceof v))throw new TypeError("Cannot call a class as a function")}function g(b,v){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return v&&(typeof v=="object"||typeof v=="function")?v:b}function f(b,v){if(typeof v!="function"&&v!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof v);b.prototype=Object.create(v&&v.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),v&&(Object.setPrototypeOf?Object.setPrototypeOf(b,v):b.__proto__=v)}var d=(function(b){f(v,b);function v(_,w){p(this,v);var S=g(this,(v.__proto__||Object.getPrototypeOf(v)).call(this,_,w));return S.fontSize=!w.flat&&w.fontSize>w.width*10?w.width*10:w.fontSize,S.guardHeight=w.height+S.fontSize/2+w.textMargin,S}return i(v,[{key:"encode",value:function(){return this.options.flat?this.encodeFlat():this.encodeGuarded()}},{key:"leftText",value:function(w,S){return this.text.substr(w,S)}},{key:"leftEncode",value:function(w,S){return(0,s.default)(w,S)}},{key:"rightText",value:function(w,S){return this.text.substr(w,S)}},{key:"rightEncode",value:function(w,S){return(0,s.default)(w,S)}},{key:"encodeGuarded",value:function(){var w={fontSize:this.fontSize},S={height:this.guardHeight};return[{data:t.SIDE_BIN,options:S},{data:this.leftEncode(),text:this.leftText(),options:w},{data:t.MIDDLE_BIN,options:S},{data:this.rightEncode(),text:this.rightText(),options:w},{data:t.SIDE_BIN,options:S}]}},{key:"encodeFlat",value:function(){var w=[t.SIDE_BIN,this.leftEncode(),t.MIDDLE_BIN,this.rightEncode(),t.SIDE_BIN];return{data:w.join(""),text:this.text}}}]),v})(c.default);return lc.default=d,lc}var Vy;function LO(){if(Vy)return oc;Vy=1,Object.defineProperty(oc,"__esModule",{value:!0});var i=(function(){function b(v,_){for(var w=0;w<_.length;w++){var S=_[w];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(v,S.key,S)}}return function(v,_,w){return _&&b(v.prototype,_),w&&b(v,w),v}})(),t=function b(v,_,w){v===null&&(v=Function.prototype);var S=Object.getOwnPropertyDescriptor(v,_);if(S===void 0){var M=Object.getPrototypeOf(v);return M===null?void 0:b(M,_,w)}else{if("value"in S)return S.value;var L=S.get;return L===void 0?void 0:L.call(w)}},r=xo(),s=hv(),l=c(s);function c(b){return b&&b.__esModule?b:{default:b}}function m(b,v){if(!(b instanceof v))throw new TypeError("Cannot call a class as a function")}function p(b,v){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return v&&(typeof v=="object"||typeof v=="function")?v:b}function g(b,v){if(typeof v!="function"&&v!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof v);b.prototype=Object.create(v&&v.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),v&&(Object.setPrototypeOf?Object.setPrototypeOf(b,v):b.__proto__=v)}var f=function(v){var _=v.substr(0,12).split("").map(function(w){return+w}).reduce(function(w,S,M){return M%2?w+S*3:w+S},0);return(10-_%10)%10},d=(function(b){g(v,b);function v(_,w){m(this,v),_.search(/^[0-9]{12}$/)!==-1&&(_+=f(_));var S=p(this,(v.__proto__||Object.getPrototypeOf(v)).call(this,_,w));return S.lastChar=w.lastChar,S}return i(v,[{key:"valid",value:function(){return this.data.search(/^[0-9]{13}$/)!==-1&&+this.data[12]===f(this.data)}},{key:"leftText",value:function(){return t(v.prototype.__proto__||Object.getPrototypeOf(v.prototype),"leftText",this).call(this,1,6)}},{key:"leftEncode",value:function(){var w=this.data.substr(1,6),S=r.EAN13_STRUCTURE[this.data[0]];return t(v.prototype.__proto__||Object.getPrototypeOf(v.prototype),"leftEncode",this).call(this,w,S)}},{key:"rightText",value:function(){return t(v.prototype.__proto__||Object.getPrototypeOf(v.prototype),"rightText",this).call(this,7,6)}},{key:"rightEncode",value:function(){var w=this.data.substr(7,6);return t(v.prototype.__proto__||Object.getPrototypeOf(v.prototype),"rightEncode",this).call(this,w,"RRRRRR")}},{key:"encodeGuarded",value:function(){var w=t(v.prototype.__proto__||Object.getPrototypeOf(v.prototype),"encodeGuarded",this).call(this);return this.options.displayValue&&(w.unshift({data:"000000000000",text:this.text.substr(0,1),options:{textAlign:"left",fontSize:this.fontSize}}),this.options.lastChar&&(w.push({data:"00"}),w.push({data:"00000",text:this.options.lastChar,options:{fontSize:this.fontSize}}))),w}}]),v})(l.default);return oc.default=d,oc}var uc={},Yy;function zO(){if(Yy)return uc;Yy=1,Object.defineProperty(uc,"__esModule",{value:!0});var i=(function(){function d(b,v){for(var _=0;_<v.length;_++){var w=v[_];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(b,w.key,w)}}return function(b,v,_){return v&&d(b.prototype,v),_&&d(b,_),b}})(),t=function d(b,v,_){b===null&&(b=Function.prototype);var w=Object.getOwnPropertyDescriptor(b,v);if(w===void 0){var S=Object.getPrototypeOf(b);return S===null?void 0:d(S,v,_)}else{if("value"in w)return w.value;var M=w.get;return M===void 0?void 0:M.call(_)}},r=hv(),s=l(r);function l(d){return d&&d.__esModule?d:{default:d}}function c(d,b){if(!(d instanceof b))throw new TypeError("Cannot call a class as a function")}function m(d,b){if(!d)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return b&&(typeof b=="object"||typeof b=="function")?b:d}function p(d,b){if(typeof b!="function"&&b!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof b);d.prototype=Object.create(b&&b.prototype,{constructor:{value:d,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(d,b):d.__proto__=b)}var g=function(b){var v=b.substr(0,7).split("").map(function(_){return+_}).reduce(function(_,w,S){return S%2?_+w:_+w*3},0);return(10-v%10)%10},f=(function(d){p(b,d);function b(v,_){return c(this,b),v.search(/^[0-9]{7}$/)!==-1&&(v+=g(v)),m(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,v,_))}return i(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 _=this.data.substr(0,4);return t(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"leftEncode",this).call(this,_,"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 _=this.data.substr(4,4);return t(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"rightEncode",this).call(this,_,"RRRR")}}]),b})(s.default);return uc.default=f,uc}var fc={},Xy;function UO(){if(Xy)return fc;Xy=1,Object.defineProperty(fc,"__esModule",{value:!0});var i=(function(){function v(_,w){for(var S=0;S<w.length;S++){var M=w[S];M.enumerable=M.enumerable||!1,M.configurable=!0,"value"in M&&(M.writable=!0),Object.defineProperty(_,M.key,M)}}return function(_,w,S){return w&&v(_.prototype,w),S&&v(_,S),_}})(),t=xo(),r=_o(),s=m(r),l=gn(),c=m(l);function m(v){return v&&v.__esModule?v:{default:v}}function p(v,_){if(!(v instanceof _))throw new TypeError("Cannot call a class as a function")}function g(v,_){if(!v)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return _&&(typeof _=="object"||typeof _=="function")?_:v}function f(v,_){if(typeof _!="function"&&_!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof _);v.prototype=Object.create(_&&_.prototype,{constructor:{value:v,enumerable:!1,writable:!0,configurable:!0}}),_&&(Object.setPrototypeOf?Object.setPrototypeOf(v,_):v.__proto__=_)}var d=function(_){var w=_.split("").map(function(S){return+S}).reduce(function(S,M,L){return L%2?S+M*9:S+M*3},0);return w%10},b=(function(v){f(_,v);function _(w,S){return p(this,_),g(this,(_.__proto__||Object.getPrototypeOf(_)).call(this,w,S))}return i(_,[{key:"valid",value:function(){return this.data.search(/^[0-9]{5}$/)!==-1}},{key:"encode",value:function(){var S=t.EAN5_STRUCTURE[d(this.data)];return{data:"1011"+(0,s.default)(this.data,S,"01"),text:this.text}}}]),_})(c.default);return fc.default=b,fc}var hc={},Ky;function PO(){if(Ky)return hc;Ky=1,Object.defineProperty(hc,"__esModule",{value:!0});var i=(function(){function b(v,_){for(var w=0;w<_.length;w++){var S=_[w];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(v,S.key,S)}}return function(v,_,w){return _&&b(v.prototype,_),w&&b(v,w),v}})(),t=xo(),r=_o(),s=m(r),l=gn(),c=m(l);function m(b){return b&&b.__esModule?b:{default:b}}function p(b,v){if(!(b instanceof v))throw new TypeError("Cannot call a class as a function")}function g(b,v){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return v&&(typeof v=="object"||typeof v=="function")?v:b}function f(b,v){if(typeof v!="function"&&v!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof v);b.prototype=Object.create(v&&v.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),v&&(Object.setPrototypeOf?Object.setPrototypeOf(b,v):b.__proto__=v)}var d=(function(b){f(v,b);function v(_,w){return p(this,v),g(this,(v.__proto__||Object.getPrototypeOf(v)).call(this,_,w))}return i(v,[{key:"valid",value:function(){return this.data.search(/^[0-9]{2}$/)!==-1}},{key:"encode",value:function(){var w=t.EAN2_STRUCTURE[parseInt(this.data)%4];return{data:"1011"+(0,s.default)(this.data,w,"01"),text:this.text}}}]),v})(c.default);return hc.default=d,hc}var Ka={},Jy;function dv(){if(Jy)return Ka;Jy=1,Object.defineProperty(Ka,"__esModule",{value:!0});var i=(function(){function b(v,_){for(var w=0;w<_.length;w++){var S=_[w];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(v,S.key,S)}}return function(v,_,w){return _&&b(v.prototype,_),w&&b(v,w),v}})();Ka.checksum=d;var t=_o(),r=c(t),s=gn(),l=c(s);function c(b){return b&&b.__esModule?b:{default:b}}function m(b,v){if(!(b instanceof v))throw new TypeError("Cannot call a class as a function")}function p(b,v){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return v&&(typeof v=="object"||typeof v=="function")?v:b}function g(b,v){if(typeof v!="function"&&v!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof v);b.prototype=Object.create(v&&v.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),v&&(Object.setPrototypeOf?Object.setPrototypeOf(b,v):b.__proto__=v)}var f=(function(b){g(v,b);function v(_,w){m(this,v),_.search(/^[0-9]{11}$/)!==-1&&(_+=d(_));var S=p(this,(v.__proto__||Object.getPrototypeOf(v)).call(this,_,w));return S.displayValue=w.displayValue,w.fontSize>w.width*10?S.fontSize=w.width*10:S.fontSize=w.fontSize,S.guardHeight=w.height+S.fontSize/2+w.textMargin,S}return i(v,[{key:"valid",value:function(){return this.data.search(/^[0-9]{12}$/)!==-1&&this.data[11]==d(this.data)}},{key:"encode",value:function(){return this.options.flat?this.flatEncoding():this.guardedEncoding()}},{key:"flatEncoding",value:function(){var w="";return w+="101",w+=(0,r.default)(this.data.substr(0,6),"LLLLLL"),w+="01010",w+=(0,r.default)(this.data.substr(6,6),"RRRRRR"),w+="101",{data:w,text:this.text}}},{key:"guardedEncoding",value:function(){var w=[];return this.displayValue&&w.push({data:"00000000",text:this.text.substr(0,1),options:{textAlign:"left",fontSize:this.fontSize}}),w.push({data:"101"+(0,r.default)(this.data[0],"L"),options:{height:this.guardHeight}}),w.push({data:(0,r.default)(this.data.substr(1,5),"LLLLL"),text:this.text.substr(1,5),options:{fontSize:this.fontSize}}),w.push({data:"01010",options:{height:this.guardHeight}}),w.push({data:(0,r.default)(this.data.substr(6,5),"RRRRR"),text:this.text.substr(6,5),options:{fontSize:this.fontSize}}),w.push({data:(0,r.default)(this.data[11],"R")+"101",options:{height:this.guardHeight}}),this.displayValue&&w.push({data:"00000000",text:this.text.substr(11,1),options:{textAlign:"right",fontSize:this.fontSize}}),w}}]),v})(l.default);function d(b){var v=0,_;for(_=1;_<11;_+=2)v+=parseInt(b[_]);for(_=0;_<11;_+=2)v+=parseInt(b[_])*3;return(10-v%10)%10}return Ka.default=f,Ka}var dc={},Qy;function IO(){if(Qy)return dc;Qy=1,Object.defineProperty(dc,"__esModule",{value:!0});var i=(function(){function w(S,M){for(var L=0;L<M.length;L++){var z=M[L];z.enumerable=z.enumerable||!1,z.configurable=!0,"value"in z&&(z.writable=!0),Object.defineProperty(S,z.key,z)}}return function(S,M,L){return M&&w(S.prototype,M),L&&w(S,L),S}})(),t=_o(),r=m(t),s=gn(),l=m(s),c=dv();function m(w){return w&&w.__esModule?w:{default:w}}function p(w,S){if(!(w instanceof S))throw new TypeError("Cannot call a class as a function")}function g(w,S){if(!w)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return S&&(typeof S=="object"||typeof S=="function")?S:w}function f(w,S){if(typeof S!="function"&&S!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof S);w.prototype=Object.create(S&&S.prototype,{constructor:{value:w,enumerable:!1,writable:!0,configurable:!0}}),S&&(Object.setPrototypeOf?Object.setPrototypeOf(w,S):w.__proto__=S)}var d=["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"]],v=(function(w){f(S,w);function S(M,L){p(this,S);var z=g(this,(S.__proto__||Object.getPrototypeOf(S)).call(this,M,L));if(z.isValid=!1,M.search(/^[0-9]{6}$/)!==-1)z.middleDigits=M,z.upcA=_(M,"0"),z.text=L.text||""+z.upcA[0]+M+z.upcA[z.upcA.length-1],z.isValid=!0;else if(M.search(/^[01][0-9]{7}$/)!==-1)if(z.middleDigits=M.substring(1,M.length-1),z.upcA=_(z.middleDigits,M[0]),z.upcA[z.upcA.length-1]===M[M.length-1])z.isValid=!0;else return g(z);else return g(z);return z.displayValue=L.displayValue,L.fontSize>L.width*10?z.fontSize=L.width*10:z.fontSize=L.fontSize,z.guardHeight=L.height+z.fontSize/2+L.textMargin,z}return i(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],z=this.upcA[this.upcA.length-1],ie=b[parseInt(z)][parseInt(L)];return(0,r.default)(this.middleDigits,ie)}}]),S})(l.default);function _(w,S){for(var M=parseInt(w[w.length-1]),L=d[M],z="",ie=0,ae=0;ae<L.length;ae++){var C=L[ae];C==="X"?z+=w[ie++]:z+=C}return z=""+S+z,""+z+(0,c.checksum)(z)}return dc.default=v,dc}var Zy;function $O(){if(Zy)return Ut;Zy=1,Object.defineProperty(Ut,"__esModule",{value:!0}),Ut.UPCE=Ut.UPC=Ut.EAN2=Ut.EAN5=Ut.EAN8=Ut.EAN13=void 0;var i=LO(),t=v(i),r=zO(),s=v(r),l=UO(),c=v(l),m=PO(),p=v(m),g=dv(),f=v(g),d=IO(),b=v(d);function v(_){return _&&_.__esModule?_:{default:_}}return Ut.EAN13=t.default,Ut.EAN8=s.default,Ut.EAN5=c.default,Ut.EAN2=p.default,Ut.UPC=f.default,Ut.UPCE=b.default,Ut}var Li={},mc={},Ms={},Wy;function HO(){return Wy||(Wy=1,Object.defineProperty(Ms,"__esModule",{value:!0}),Ms.START_BIN="1010",Ms.END_BIN="11101",Ms.BINARIES=["00110","10001","01001","11000","00101","10100","01100","00011","10010","01010"]),Ms}var e1;function mv(){if(e1)return mc;e1=1,Object.defineProperty(mc,"__esModule",{value:!0});var i=(function(){function f(d,b){for(var v=0;v<b.length;v++){var _=b[v];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(d,_.key,_)}}return function(d,b,v){return b&&f(d.prototype,b),v&&f(d,v),d}})(),t=HO(),r=gn(),s=l(r);function l(f){return f&&f.__esModule?f:{default:f}}function c(f,d){if(!(f instanceof d))throw new TypeError("Cannot call a class as a function")}function m(f,d){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:f}function p(f,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);f.prototype=Object.create(d&&d.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(f,d):f.__proto__=d)}var g=(function(f){p(d,f);function d(){return c(this,d),m(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments))}return i(d,[{key:"valid",value:function(){return this.data.search(/^([0-9]{2})+$/)!==-1}},{key:"encode",value:function(){var v=this,_=this.data.match(/.{2}/g).map(function(w){return v.encodePair(w)}).join("");return{data:t.START_BIN+_+t.END_BIN,text:this.text}}},{key:"encodePair",value:function(v){var _=t.BINARIES[v[1]];return t.BINARIES[v[0]].split("").map(function(w,S){return(w==="1"?"111":"1")+(_[S]==="1"?"000":"0")}).join("")}}]),d})(s.default);return mc.default=g,mc}var pc={},t1;function GO(){if(t1)return pc;t1=1,Object.defineProperty(pc,"__esModule",{value:!0});var i=(function(){function f(d,b){for(var v=0;v<b.length;v++){var _=b[v];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(d,_.key,_)}}return function(d,b,v){return b&&f(d.prototype,b),v&&f(d,v),d}})(),t=mv(),r=s(t);function s(f){return f&&f.__esModule?f:{default:f}}function l(f,d){if(!(f instanceof d))throw new TypeError("Cannot call a class as a function")}function c(f,d){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:f}function m(f,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);f.prototype=Object.create(d&&d.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(f,d):f.__proto__=d)}var p=function(d){var b=d.substr(0,13).split("").map(function(v){return parseInt(v,10)}).reduce(function(v,_,w){return v+_*(3-w%2*2)},0);return Math.ceil(b/10)*10-b},g=(function(f){m(d,f);function d(b,v){return l(this,d),b.search(/^[0-9]{13}$/)!==-1&&(b+=p(b)),c(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b,v))}return i(d,[{key:"valid",value:function(){return this.data.search(/^[0-9]{14}$/)!==-1&&+this.data[13]===p(this.data)}}]),d})(r.default);return pc.default=g,pc}var n1;function FO(){if(n1)return Li;n1=1,Object.defineProperty(Li,"__esModule",{value:!0}),Li.ITF14=Li.ITF=void 0;var i=mv(),t=l(i),r=GO(),s=l(r);function l(c){return c&&c.__esModule?c:{default:c}}return Li.ITF=t.default,Li.ITF14=s.default,Li}var an={},gc={},r1;function wo(){if(r1)return gc;r1=1,Object.defineProperty(gc,"__esModule",{value:!0});var i=(function(){function f(d,b){for(var v=0;v<b.length;v++){var _=b[v];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(d,_.key,_)}}return function(d,b,v){return b&&f(d.prototype,b),v&&f(d,v),d}})(),t=gn(),r=s(t);function s(f){return f&&f.__esModule?f:{default:f}}function l(f,d){if(!(f instanceof d))throw new TypeError("Cannot call a class as a function")}function c(f,d){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:f}function m(f,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);f.prototype=Object.create(d&&d.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(f,d):f.__proto__=d)}var p=(function(f){m(d,f);function d(b,v){return l(this,d),c(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b,v))}return i(d,[{key:"encode",value:function(){for(var v="110",_=0;_<this.data.length;_++){var w=parseInt(this.data[_]),S=w.toString(2);S=g(S,4-S.length);for(var M=0;M<S.length;M++)v+=S[M]=="0"?"100":"110"}return v+="1001",{data:v,text:this.text}}},{key:"valid",value:function(){return this.data.search(/^[0-9]+$/)!==-1}}]),d})(r.default);function g(f,d){for(var b=0;b<d;b++)f="0"+f;return f}return gc.default=p,gc}var yc={},Ja={},i1;function pu(){if(i1)return Ja;i1=1,Object.defineProperty(Ja,"__esModule",{value:!0}),Ja.mod10=i,Ja.mod11=t;function i(r){for(var s=0,l=0;l<r.length;l++){var c=parseInt(r[l]);(l+r.length)%2===0?s+=c:s+=c*2%10+Math.floor(c*2/10)}return(10-s%10)%10}function t(r){for(var s=0,l=[2,3,4,5,6,7],c=0;c<r.length;c++){var m=parseInt(r[r.length-1-c]);s+=l[c%l.length]*m}return(11-s%11)%11}return Ja}var s1;function VO(){if(s1)return yc;s1=1,Object.defineProperty(yc,"__esModule",{value:!0});var i=wo(),t=s(i),r=pu();function s(g){return g&&g.__esModule?g:{default:g}}function l(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}function c(g,f){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:g}function m(g,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);g.prototype=Object.create(f&&f.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(g,f):g.__proto__=f)}var p=(function(g){m(f,g);function f(d,b){return l(this,f),c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,d+(0,r.mod10)(d),b))}return f})(t.default);return yc.default=p,yc}var bc={},a1;function YO(){if(a1)return bc;a1=1,Object.defineProperty(bc,"__esModule",{value:!0});var i=wo(),t=s(i),r=pu();function s(g){return g&&g.__esModule?g:{default:g}}function l(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}function c(g,f){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:g}function m(g,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);g.prototype=Object.create(f&&f.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(g,f):g.__proto__=f)}var p=(function(g){m(f,g);function f(d,b){return l(this,f),c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,d+(0,r.mod11)(d),b))}return f})(t.default);return bc.default=p,bc}var vc={},o1;function XO(){if(o1)return vc;o1=1,Object.defineProperty(vc,"__esModule",{value:!0});var i=wo(),t=s(i),r=pu();function s(g){return g&&g.__esModule?g:{default:g}}function l(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}function c(g,f){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:g}function m(g,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);g.prototype=Object.create(f&&f.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(g,f):g.__proto__=f)}var p=(function(g){m(f,g);function f(d,b){return l(this,f),d+=(0,r.mod10)(d),d+=(0,r.mod10)(d),c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,d,b))}return f})(t.default);return vc.default=p,vc}var xc={},l1;function KO(){if(l1)return xc;l1=1,Object.defineProperty(xc,"__esModule",{value:!0});var i=wo(),t=s(i),r=pu();function s(g){return g&&g.__esModule?g:{default:g}}function l(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}function c(g,f){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:g}function m(g,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);g.prototype=Object.create(f&&f.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(g,f):g.__proto__=f)}var p=(function(g){m(f,g);function f(d,b){return l(this,f),d+=(0,r.mod11)(d),d+=(0,r.mod10)(d),c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,d,b))}return f})(t.default);return xc.default=p,xc}var c1;function JO(){if(c1)return an;c1=1,Object.defineProperty(an,"__esModule",{value:!0}),an.MSI1110=an.MSI1010=an.MSI11=an.MSI10=an.MSI=void 0;var i=wo(),t=d(i),r=VO(),s=d(r),l=YO(),c=d(l),m=XO(),p=d(m),g=KO(),f=d(g);function d(b){return b&&b.__esModule?b:{default:b}}return an.MSI=t.default,an.MSI10=s.default,an.MSI11=c.default,an.MSI1010=p.default,an.MSI1110=f.default,an}var Qa={},u1;function QO(){if(u1)return Qa;u1=1,Object.defineProperty(Qa,"__esModule",{value:!0}),Qa.pharmacode=void 0;var i=(function(){function g(f,d){for(var b=0;b<d.length;b++){var v=d[b];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(f,v.key,v)}}return function(f,d,b){return d&&g(f.prototype,d),b&&g(f,b),f}})(),t=gn(),r=s(t);function s(g){return g&&g.__esModule?g:{default:g}}function l(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}function c(g,f){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:g}function m(g,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);g.prototype=Object.create(f&&f.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(g,f):g.__proto__=f)}var p=(function(g){m(f,g);function f(d,b){l(this,f);var v=c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,d,b));return v.number=parseInt(d,10),v}return i(f,[{key:"encode",value:function(){for(var b=this.number,v="";!isNaN(b)&&b!=0;)b%2===0?(v="11100"+v,b=(b-2)/2):(v="100"+v,b=(b-1)/2);return v=v.slice(0,-2),{data:v,text:this.text}}},{key:"valid",value:function(){return this.number>=3&&this.number<=131070}}]),f})(r.default);return Qa.pharmacode=p,Qa}var Za={},f1;function ZO(){if(f1)return Za;f1=1,Object.defineProperty(Za,"__esModule",{value:!0}),Za.codabar=void 0;var i=(function(){function g(f,d){for(var b=0;b<d.length;b++){var v=d[b];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(f,v.key,v)}}return function(f,d,b){return d&&g(f.prototype,d),b&&g(f,b),f}})(),t=gn(),r=s(t);function s(g){return g&&g.__esModule?g:{default:g}}function l(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}function c(g,f){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:g}function m(g,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);g.prototype=Object.create(f&&f.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(g,f):g.__proto__=f)}var p=(function(g){m(f,g);function f(d,b){l(this,f),d.search(/^[0-9\-\$\:\.\+\/]+$/)===0&&(d="A"+d+"A");var v=c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,d.toUpperCase(),b));return v.text=v.options.text||v.text.replace(/[A-D]/g,""),v}return i(f,[{key:"valid",value:function(){return this.data.search(/^[A-D][0-9\-\$\:\.\+\/]+[A-D]$/)!==-1}},{key:"encode",value:function(){for(var b=[],v=this.getEncodings(),_=0;_<this.data.length;_++)b.push(v[this.data.charAt(_)]),_!==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"}}}]),f})(r.default);return Za.codabar=p,Za}var zi={},_c={},Rs={},h1;function WO(){return h1||(h1=1,Object.defineProperty(Rs,"__esModule",{value:!0}),Rs.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","-","."," ","$","/","+","%","($)","(%)","(/)","(+)","ÿ"],Rs.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"],Rs.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"]}),Rs}var d1;function pv(){if(d1)return _c;d1=1,Object.defineProperty(_c,"__esModule",{value:!0});var i=(function(){function f(d,b){for(var v=0;v<b.length;v++){var _=b[v];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(d,_.key,_)}}return function(d,b,v){return b&&f(d.prototype,b),v&&f(d,v),d}})(),t=WO(),r=gn(),s=l(r);function l(f){return f&&f.__esModule?f:{default:f}}function c(f,d){if(!(f instanceof d))throw new TypeError("Cannot call a class as a function")}function m(f,d){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:f}function p(f,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);f.prototype=Object.create(d&&d.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(f,d):f.__proto__=d)}var g=(function(f){p(d,f);function d(b,v){return c(this,d),m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b,v))}return i(d,[{key:"valid",value:function(){return/^[0-9A-Z\-. $/+%]+$/.test(this.data)}},{key:"encode",value:function(){var v=this.data.split("").flatMap(function(M){return t.MULTI_SYMBOLS[M]||M}),_=v.map(function(M){return d.getEncoding(M)}).join(""),w=d.checksum(v,20),S=d.checksum(v.concat(w),15);return{text:this.text,data:d.getEncoding("ÿ")+_+d.getEncoding(w)+d.getEncoding(S)+d.getEncoding("ÿ")+"1"}}}],[{key:"getEncoding",value:function(v){return t.BINARIES[d.symbolValue(v)]}},{key:"getSymbol",value:function(v){return t.SYMBOLS[v]}},{key:"symbolValue",value:function(v){return t.SYMBOLS.indexOf(v)}},{key:"checksum",value:function(v,_){var w=v.slice().reverse().reduce(function(S,M,L){var z=L%_+1;return S+d.symbolValue(M)*z},0);return d.getSymbol(w%47)}}]),d})(s.default);return _c.default=g,_c}var wc={},m1;function eA(){if(m1)return wc;m1=1,Object.defineProperty(wc,"__esModule",{value:!0});var i=(function(){function g(f,d){for(var b=0;b<d.length;b++){var v=d[b];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(f,v.key,v)}}return function(f,d,b){return d&&g(f.prototype,d),b&&g(f,b),f}})(),t=pv(),r=s(t);function s(g){return g&&g.__esModule?g:{default:g}}function l(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}function c(g,f){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:g}function m(g,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);g.prototype=Object.create(f&&f.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(g,f):g.__proto__=f)}var p=(function(g){m(f,g);function f(d,b){return l(this,f),c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,d,b))}return i(f,[{key:"valid",value:function(){return/^[\x00-\x7f]+$/.test(this.data)}}]),f})(r.default);return wc.default=p,wc}var p1;function tA(){if(p1)return zi;p1=1,Object.defineProperty(zi,"__esModule",{value:!0}),zi.CODE93FullASCII=zi.CODE93=void 0;var i=pv(),t=l(i),r=eA(),s=l(r);function l(c){return c&&c.__esModule?c:{default:c}}return zi.CODE93=t.default,zi.CODE93FullASCII=s.default,zi}var Wa={},g1;function nA(){if(g1)return Wa;g1=1,Object.defineProperty(Wa,"__esModule",{value:!0}),Wa.GenericBarcode=void 0;var i=(function(){function g(f,d){for(var b=0;b<d.length;b++){var v=d[b];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(f,v.key,v)}}return function(f,d,b){return d&&g(f.prototype,d),b&&g(f,b),f}})(),t=gn(),r=s(t);function s(g){return g&&g.__esModule?g:{default:g}}function l(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}function c(g,f){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:g}function m(g,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);g.prototype=Object.create(f&&f.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(g,f):g.__proto__=f)}var p=(function(g){m(f,g);function f(d,b){return l(this,f),c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,d,b))}return i(f,[{key:"encode",value:function(){return{data:"10101010101010101010101010101010101010101",text:this.text}}},{key:"valid",value:function(){return!0}}]),f})(r.default);return Wa.GenericBarcode=p,Wa}var y1;function rA(){if(y1)return Wl;y1=1,Object.defineProperty(Wl,"__esModule",{value:!0});var i=kO(),t=BO(),r=$O(),s=FO(),l=JO(),c=QO(),m=ZO(),p=tA(),g=nA();return Wl.default={CODE39:i.CODE39,CODE128:t.CODE128,CODE128A:t.CODE128A,CODE128B:t.CODE128B,CODE128C:t.CODE128C,EAN13:r.EAN13,EAN8:r.EAN8,EAN5:r.EAN5,EAN2:r.EAN2,UPC:r.UPC,UPCE:r.UPCE,ITF14:s.ITF14,ITF:s.ITF,MSI:l.MSI,MSI10:l.MSI10,MSI11:l.MSI11,MSI1010:l.MSI1010,MSI1110:l.MSI1110,pharmacode:c.pharmacode,codabar:m.codabar,CODE93:p.CODE93,CODE93FullASCII:p.CODE93FullASCII,GenericBarcode:g.GenericBarcode},Wl}var Sc={},b1;function gu(){if(b1)return Sc;b1=1,Object.defineProperty(Sc,"__esModule",{value:!0});var i=Object.assign||function(t){for(var r=1;r<arguments.length;r++){var s=arguments[r];for(var l in s)Object.prototype.hasOwnProperty.call(s,l)&&(t[l]=s[l])}return t};return Sc.default=function(t,r){return i({},t,r)},Sc}var Ec={},v1;function iA(){if(v1)return Ec;v1=1,Object.defineProperty(Ec,"__esModule",{value:!0}),Ec.default=i;function i(t){var r=[];function s(l){if(Array.isArray(l))for(var c=0;c<l.length;c++)s(l[c]);else l.text=l.text||"",l.data=l.data||"",r.push(l)}return s(t),r}return Ec}var Oc={},x1;function sA(){if(x1)return Oc;x1=1,Object.defineProperty(Oc,"__esModule",{value:!0}),Oc.default=i;function i(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 Oc}var Ac={},jc={},Tc={},_1;function gv(){if(_1)return Tc;_1=1,Object.defineProperty(Tc,"__esModule",{value:!0}),Tc.default=i;function i(t){var r=["width","height","textMargin","fontSize","margin","marginTop","marginBottom","marginLeft","marginRight"];for(var s in r)r.hasOwnProperty(s)&&(s=r[s],typeof t[s]=="string"&&(t[s]=parseInt(t[s],10)));return typeof t.displayValue=="string"&&(t.displayValue=t.displayValue!="false"),t}return Tc}var Nc={},w1;function yv(){if(w1)return Nc;w1=1,Object.defineProperty(Nc,"__esModule",{value:!0});var i={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 Nc.default=i,Nc}var S1;function aA(){if(S1)return jc;S1=1,Object.defineProperty(jc,"__esModule",{value:!0});var i=gv(),t=l(i),r=yv(),s=l(r);function l(m){return m&&m.__esModule?m:{default:m}}function c(m){var p={};for(var g in s.default)s.default.hasOwnProperty(g)&&(m.hasAttribute("jsbarcode-"+g.toLowerCase())&&(p[g]=m.getAttribute("jsbarcode-"+g.toLowerCase())),m.hasAttribute("data-"+g.toLowerCase())&&(p[g]=m.getAttribute("data-"+g.toLowerCase())));return p.value=m.getAttribute("jsbarcode-value")||m.getAttribute("data-value"),p=(0,t.default)(p),p}return jc.default=c,jc}var kc={},Cc={},on={},E1;function bv(){if(E1)return on;E1=1,Object.defineProperty(on,"__esModule",{value:!0}),on.getTotalWidthOfEncodings=on.calculateEncodingAttributes=on.getBarcodePadding=on.getEncodingHeight=on.getMaximumHeightOfEncodings=void 0;var i=gu(),t=r(i);function r(f){return f&&f.__esModule?f:{default:f}}function s(f,d){return d.height+(d.displayValue&&f.text.length>0?d.fontSize+d.textMargin:0)+d.marginTop+d.marginBottom}function l(f,d,b){if(b.displayValue&&d<f){if(b.textAlign=="center")return Math.floor((f-d)/2);if(b.textAlign=="left")return 0;if(b.textAlign=="right")return Math.floor(f-d)}return 0}function c(f,d,b){for(var v=0;v<f.length;v++){var _=f[v],w=(0,t.default)(d,_.options),S;w.displayValue?S=g(_.text,w,b):S=0;var M=_.data.length*w.width;_.width=Math.ceil(Math.max(S,M)),_.height=s(_,w),_.barcodePadding=l(S,M,w)}}function m(f){for(var d=0,b=0;b<f.length;b++)d+=f[b].width;return d}function p(f){for(var d=0,b=0;b<f.length;b++)f[b].height>d&&(d=f[b].height);return d}function g(f,d,b){var v;if(b)v=b;else if(typeof document<"u")v=document.createElement("canvas").getContext("2d");else return 0;v.font=d.fontOptions+" "+d.fontSize+"px "+d.font;var _=v.measureText(f);if(!_)return 0;var w=_.width;return w}return on.getMaximumHeightOfEncodings=p,on.getEncodingHeight=s,on.getBarcodePadding=l,on.calculateEncodingAttributes=c,on.getTotalWidthOfEncodings=m,on}var O1;function oA(){if(O1)return Cc;O1=1,Object.defineProperty(Cc,"__esModule",{value:!0});var i=(function(){function p(g,f){for(var d=0;d<f.length;d++){var b=f[d];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(g,b.key,b)}}return function(g,f,d){return f&&p(g.prototype,f),d&&p(g,d),g}})(),t=gu(),r=l(t),s=bv();function l(p){return p&&p.__esModule?p:{default:p}}function c(p,g){if(!(p instanceof g))throw new TypeError("Cannot call a class as a function")}var m=(function(){function p(g,f,d){c(this,p),this.canvas=g,this.encodings=f,this.options=d}return i(p,[{key:"render",value:function(){if(!this.canvas.getContext)throw new Error("The browser does not support canvas.");this.prepareCanvas();for(var f=0;f<this.encodings.length;f++){var d=(0,r.default)(this.options,this.encodings[f].options);this.drawCanvasBarcode(d,this.encodings[f]),this.drawCanvasText(d,this.encodings[f]),this.moveCanvasDrawing(this.encodings[f])}this.restoreCanvas()}},{key:"prepareCanvas",value:function(){var f=this.canvas.getContext("2d");f.save(),(0,s.calculateEncodingAttributes)(this.encodings,this.options,f);var d=(0,s.getTotalWidthOfEncodings)(this.encodings),b=(0,s.getMaximumHeightOfEncodings)(this.encodings);this.canvas.width=d+this.options.marginLeft+this.options.marginRight,this.canvas.height=b,f.clearRect(0,0,this.canvas.width,this.canvas.height),this.options.background&&(f.fillStyle=this.options.background,f.fillRect(0,0,this.canvas.width,this.canvas.height)),f.translate(this.options.marginLeft,0)}},{key:"drawCanvasBarcode",value:function(f,d){var b=this.canvas.getContext("2d"),v=d.data,_;f.textPosition=="top"?_=f.marginTop+f.fontSize+f.textMargin:_=f.marginTop,b.fillStyle=f.lineColor;for(var w=0;w<v.length;w++){var S=w*f.width+d.barcodePadding;v[w]==="1"?b.fillRect(S,_,f.width,f.height):v[w]&&b.fillRect(S,_,f.width,f.height*v[w])}}},{key:"drawCanvasText",value:function(f,d){var b=this.canvas.getContext("2d"),v=f.fontOptions+" "+f.fontSize+"px "+f.font;if(f.displayValue){var _,w;f.textPosition=="top"?w=f.marginTop+f.fontSize-f.textMargin:w=f.height+f.textMargin+f.marginTop+f.fontSize,b.font=v,f.textAlign=="left"||d.barcodePadding>0?(_=0,b.textAlign="left"):f.textAlign=="right"?(_=d.width-1,b.textAlign="right"):(_=d.width/2,b.textAlign="center"),b.fillText(d.text,_,w)}}},{key:"moveCanvasDrawing",value:function(f){var d=this.canvas.getContext("2d");d.translate(f.width,0)}},{key:"restoreCanvas",value:function(){var f=this.canvas.getContext("2d");f.restore()}}]),p})();return Cc.default=m,Cc}var Mc={},A1;function lA(){if(A1)return Mc;A1=1,Object.defineProperty(Mc,"__esModule",{value:!0});var i=(function(){function g(f,d){for(var b=0;b<d.length;b++){var v=d[b];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(f,v.key,v)}}return function(f,d,b){return d&&g(f.prototype,d),b&&g(f,b),f}})(),t=gu(),r=l(t),s=bv();function l(g){return g&&g.__esModule?g:{default:g}}function c(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}var m="http://www.w3.org/2000/svg",p=(function(){function g(f,d,b){c(this,g),this.svg=f,this.encodings=d,this.options=b,this.document=b.xmlDocument||document}return i(g,[{key:"render",value:function(){var d=this.options.marginLeft;this.prepareSVG();for(var b=0;b<this.encodings.length;b++){var v=this.encodings[b],_=(0,r.default)(this.options,v.options),w=this.createGroup(d,_.marginTop,this.svg);this.setGroupOptions(w,_),this.drawSvgBarcode(w,_,v),this.drawSVGText(w,_,v),d+=v.width}}},{key:"prepareSVG",value:function(){for(;this.svg.firstChild;)this.svg.removeChild(this.svg.firstChild);(0,s.calculateEncodingAttributes)(this.encodings,this.options);var d=(0,s.getTotalWidthOfEncodings)(this.encodings),b=(0,s.getMaximumHeightOfEncodings)(this.encodings),v=d+this.options.marginLeft+this.options.marginRight;this.setSvgAttributes(v,b),this.options.background&&this.drawRect(0,0,v,b,this.svg).setAttribute("fill",this.options.background)}},{key:"drawSvgBarcode",value:function(d,b,v){var _=v.data,w;b.textPosition=="top"?w=b.fontSize+b.textMargin:w=0;for(var S=0,M=0,L=0;L<_.length;L++)M=L*b.width+v.barcodePadding,_[L]==="1"?S++:S>0&&(this.drawRect(M-b.width*S,w,b.width*S,b.height,d),S=0);S>0&&this.drawRect(M-b.width*(S-1),w,b.width*S,b.height,d)}},{key:"drawSVGText",value:function(d,b,v){var _=this.document.createElementNS(m,"text");if(b.displayValue){var w,S;_.setAttribute("font-family",b.font),_.setAttribute("font-size",b.fontSize),b.fontOptions.includes("bold")&&_.setAttribute("font-weight","bold"),b.fontOptions.includes("italic")&&_.setAttribute("font-style","italic"),b.textPosition=="top"?S=b.fontSize-b.textMargin:S=b.height+b.textMargin+b.fontSize,b.textAlign=="left"||v.barcodePadding>0?(w=0,_.setAttribute("text-anchor","start")):b.textAlign=="right"?(w=v.width-1,_.setAttribute("text-anchor","end")):(w=v.width/2,_.setAttribute("text-anchor","middle")),_.setAttribute("x",w),_.setAttribute("y",S),_.appendChild(this.document.createTextNode(v.text)),d.appendChild(_)}}},{key:"setSvgAttributes",value:function(d,b){var v=this.svg;v.setAttribute("width",d+"px"),v.setAttribute("height",b+"px"),v.setAttribute("x","0px"),v.setAttribute("y","0px"),v.setAttribute("viewBox","0 0 "+d+" "+b),v.setAttribute("xmlns",m),v.setAttribute("version","1.1")}},{key:"createGroup",value:function(d,b,v){var _=this.document.createElementNS(m,"g");return _.setAttribute("transform","translate("+d+", "+b+")"),v.appendChild(_),_}},{key:"setGroupOptions",value:function(d,b){d.setAttribute("fill",b.lineColor)}},{key:"drawRect",value:function(d,b,v,_,w){var S=this.document.createElementNS(m,"rect");return S.setAttribute("x",d),S.setAttribute("y",b),S.setAttribute("width",v),S.setAttribute("height",_),w.appendChild(S),S}}]),g})();return Mc.default=p,Mc}var Rc={},j1;function cA(){if(j1)return Rc;j1=1,Object.defineProperty(Rc,"__esModule",{value:!0});var i=(function(){function s(l,c){for(var m=0;m<c.length;m++){var p=c[m];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(l,p.key,p)}}return function(l,c,m){return c&&s(l.prototype,c),m&&s(l,m),l}})();function t(s,l){if(!(s instanceof l))throw new TypeError("Cannot call a class as a function")}var r=(function(){function s(l,c,m){t(this,s),this.object=l,this.encodings=c,this.options=m}return i(s,[{key:"render",value:function(){this.object.encodings=this.encodings}}]),s})();return Rc.default=r,Rc}var T1;function uA(){if(T1)return kc;T1=1,Object.defineProperty(kc,"__esModule",{value:!0});var i=oA(),t=m(i),r=lA(),s=m(r),l=cA(),c=m(l);function m(p){return p&&p.__esModule?p:{default:p}}return kc.default={CanvasRenderer:t.default,SVGRenderer:s.default,ObjectRenderer:c.default},kc}var Ds={},N1;function vv(){if(N1)return Ds;N1=1,Object.defineProperty(Ds,"__esModule",{value:!0});function i(m,p){if(!(m instanceof p))throw new TypeError("Cannot call a class as a function")}function t(m,p){if(!m)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p&&(typeof p=="object"||typeof p=="function")?p:m}function r(m,p){if(typeof p!="function"&&p!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof p);m.prototype=Object.create(p&&p.prototype,{constructor:{value:m,enumerable:!1,writable:!0,configurable:!0}}),p&&(Object.setPrototypeOf?Object.setPrototypeOf(m,p):m.__proto__=p)}var s=(function(m){r(p,m);function p(g,f){i(this,p);var d=t(this,(p.__proto__||Object.getPrototypeOf(p)).call(this));return d.name="InvalidInputException",d.symbology=g,d.input=f,d.message='"'+d.input+'" is not a valid input for '+d.symbology,d}return p})(Error),l=(function(m){r(p,m);function p(){i(this,p);var g=t(this,(p.__proto__||Object.getPrototypeOf(p)).call(this));return g.name="InvalidElementException",g.message="Not supported type to render on",g}return p})(Error),c=(function(m){r(p,m);function p(){i(this,p);var g=t(this,(p.__proto__||Object.getPrototypeOf(p)).call(this));return g.name="NoElementException",g.message="No element to render on.",g}return p})(Error);return Ds.InvalidInputException=s,Ds.InvalidElementException=l,Ds.NoElementException=c,Ds}var k1;function fA(){if(k1)return Ac;k1=1,Object.defineProperty(Ac,"__esModule",{value:!0});var i=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(d){return typeof d}:function(d){return d&&typeof Symbol=="function"&&d.constructor===Symbol&&d!==Symbol.prototype?"symbol":typeof d},t=aA(),r=m(t),s=uA(),l=m(s),c=vv();function m(d){return d&&d.__esModule?d:{default:d}}function p(d){if(typeof d=="string")return g(d);if(Array.isArray(d)){for(var b=[],v=0;v<d.length;v++)b.push(p(d[v]));return b}else{if(typeof HTMLCanvasElement<"u"&&d instanceof HTMLImageElement)return f(d);if(d&&d.nodeName&&d.nodeName.toLowerCase()==="svg"||typeof SVGElement<"u"&&d instanceof SVGElement)return{element:d,options:(0,r.default)(d),renderer:l.default.SVGRenderer};if(typeof HTMLCanvasElement<"u"&&d instanceof HTMLCanvasElement)return{element:d,options:(0,r.default)(d),renderer:l.default.CanvasRenderer};if(d&&d.getContext)return{element:d,renderer:l.default.CanvasRenderer};if(d&&(typeof d>"u"?"undefined":i(d))==="object"&&!d.nodeName)return{element:d,renderer:l.default.ObjectRenderer};throw new c.InvalidElementException}}function g(d){var b=document.querySelectorAll(d);if(b.length!==0){for(var v=[],_=0;_<b.length;_++)v.push(p(b[_]));return v}}function f(d){var b=document.createElement("canvas");return{element:b,options:(0,r.default)(d),renderer:l.default.CanvasRenderer,afterRender:function(){d.setAttribute("src",b.toDataURL())}}}return Ac.default=p,Ac}var Dc={},C1;function hA(){if(C1)return Dc;C1=1,Object.defineProperty(Dc,"__esModule",{value:!0});var i=(function(){function s(l,c){for(var m=0;m<c.length;m++){var p=c[m];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(l,p.key,p)}}return function(l,c,m){return c&&s(l.prototype,c),m&&s(l,m),l}})();function t(s,l){if(!(s instanceof l))throw new TypeError("Cannot call a class as a function")}var r=(function(){function s(l){t(this,s),this.api=l}return i(s,[{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 m=c.apply(void 0,arguments);return this.api._options.valid(!0),m}catch(p){return this.handleCatch(p),this.api}}}]),s})();return Dc.default=r,Dc}var Hh,M1;function dA(){if(M1)return Hh;M1=1;var i=rA(),t=L(i),r=gu(),s=L(r),l=iA(),c=L(l),m=sA(),p=L(m),g=fA(),f=L(g),d=gv(),b=L(d),v=hA(),_=L(v),w=vv(),S=yv(),M=L(S);function L(B){return B&&B.__esModule?B:{default:B}}var z=function(){},ie=function(G,W,Q){var he=new z;if(typeof G>"u")throw Error("No element to render on was provided.");return he._renderProperties=(0,f.default)(G),he._encodings=[],he._options=M.default,he._errorHandler=new _.default(he),typeof W<"u"&&(Q=Q||{},Q.format||(Q.format=re()),he.options(Q)[Q.format](W,Q).render()),he};ie.getModule=function(B){return t.default[B]};for(var ae in t.default)t.default.hasOwnProperty(ae)&&C(t.default,ae);function C(B,G){z.prototype[G]=z.prototype[G.toUpperCase()]=z.prototype[G.toLowerCase()]=function(W,Q){var he=this;return he._errorHandler.wrapBarcodeCall(function(){Q.text=typeof Q.text>"u"?void 0:""+Q.text;var _e=(0,s.default)(he._options,Q);_e=(0,b.default)(_e);var Te=B[G],Y=I(W,Te,_e);return he._encodings.push(Y),he})}}function I(B,G,W){B=""+B;var Q=new G(B,W);if(!Q.valid())throw new w.InvalidInputException(Q.constructor.name,B);var he=Q.encode();he=(0,c.default)(he);for(var _e=0;_e<he.length;_e++)he[_e].options=(0,s.default)(W,he[_e].options);return he}function re(){return t.default.CODE128?"CODE128":Object.keys(t.default)[0]}z.prototype.options=function(B){return this._options=(0,s.default)(this._options,B),this},z.prototype.blank=function(B){var G=new Array(B+1).join("0");return this._encodings.push({data:G}),this},z.prototype.init=function(){if(this._renderProperties){Array.isArray(this._renderProperties)||(this._renderProperties=[this._renderProperties]);var B;for(var G in this._renderProperties){B=this._renderProperties[G];var W=(0,s.default)(this._options,B.options);W.format=="auto"&&(W.format=re()),this._errorHandler.wrapBarcodeCall(function(){var Q=W.value,he=t.default[W.format.toUpperCase()],_e=I(Q,he,W);K(B,_e,W)})}}},z.prototype.render=function(){if(!this._renderProperties)throw new w.NoElementException;if(Array.isArray(this._renderProperties))for(var B=0;B<this._renderProperties.length;B++)K(this._renderProperties[B],this._encodings,this._options);else K(this._renderProperties,this._encodings,this._options);return this},z.prototype._defaults=M.default;function K(B,G,W){G=(0,c.default)(G);for(var Q=0;Q<G.length;Q++)G[Q].options=(0,s.default)(W,G[Q].options),(0,p.default)(G[Q].options);(0,p.default)(W);var he=B.renderer,_e=new he(B.element,G,W);_e.render(),B.afterRender&&B.afterRender()}return typeof window<"u"&&(window.JsBarcode=ie),typeof jQuery<"u"&&(jQuery.fn.JsBarcode=function(B,G){var W=[];return jQuery(this).each(function(){W.push(this)}),ie(W,B,G)}),Hh=ie,Hh}var mA=dA();const pA=J_(mA),gA={[Pe.EXECUTED]:"Executed",[Pe.MATCHED_LIST]:"Matched list",[Pe.CONFIRM_REQUIRED]:"Awaiting confirmation",[Pe.NO_MATCH_FALLBACK]:"No match",[Pe.UNCONFIGURED]:"Not configured",[Pe.INVALID_CODE]:"Invalid code",[Pe.FORBIDDEN]:"Not permitted",[Pe.CONFLICT]:"Conflict",[Pe.IDENTITY_PRIMED]:"Identity primed",[Pe.IDENTITY_UNKNOWN]:"Badge not recognized",[Pe.NOT_PRIMED]:"Badge required",[Pe.CHOICES]:"Choices presented"},xv={[Pe.EXECUTED]:"text-status-success",[Pe.MATCHED_LIST]:"text-status-success",[Pe.CONFIRM_REQUIRED]:"text-status-warning",[Pe.NO_MATCH_FALLBACK]:"text-text-secondary",[Pe.UNCONFIGURED]:"text-status-warning",[Pe.INVALID_CODE]:"text-status-error",[Pe.FORBIDDEN]:"text-status-error",[Pe.CONFLICT]:"text-status-warning",[Pe.IDENTITY_PRIMED]:"text-status-success",[Pe.IDENTITY_UNKNOWN]:"text-status-warning",[Pe.NOT_PRIMED]:"text-status-warning",[Pe.CHOICES]:"text-status-success"};function _v(i){return i.outcome===Pe.IDENTITY_PRIMED&&i.actor?`Hi ${i.actor.displayName}`:`${gA[i.outcome]}${i.rule?` — ${i.rule.name}`:""}`}function ru(i){var t,r,s;return i.outcome===Pe.NO_MATCH_FALLBACK?((t=i.fallback)==null?void 0:t.markdown)??null:i.outcome===Pe.IDENTITY_UNKNOWN?((r=i.fallback)==null?void 0:r.markdown)??null:i.outcome===Pe.NOT_PRIMED?((s=i.notPrimed)==null?void 0:s.markdown)??null:null}function ri(i){return i.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 wv({content:i,compact:t}){const r=[],s=/^```(\w*)\n([\s\S]*?)^```$/gm;let l=0,c;for(;(c=s.exec(i))!==null;)c.index>l&&r.push({type:"text",text:i.slice(l,c.index)}),r.push({type:"code",lang:c[1],code:c[2].replace(/\n$/,"")}),l=c.index+c[0].length;l<i.length&&r.push({type:"text",text:i.slice(l)});const m=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"},p=[];for(const g of r){if(g.type==="code"){const f=g.code.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");p.push(`<pre class="my-2 p-2.5 bg-surface-sunken rounded-md overflow-x-auto"><code class="${m.code} font-mono text-text-secondary leading-relaxed">${f}</code></pre>`);continue}p.push(...yA(g.text,m))}return y.jsx("div",{className:"prose-sm",dangerouslySetInnerHTML:{__html:p.join(`
54
+ `)}})}function yA(i,t){const r=i.split(`
55
+ `),s=[];let l=!1,c=!1,m=[];for(const p of r){const g=p.trim();if(g.startsWith("|")&&g.endsWith("|")){const f=g.slice(1,-1).split("|").map(d=>d.trim());if(f.every(d=>/^[-:]+$/.test(d)))continue;c||(c=!0,m=[]),m.push(f);continue}if(c){c=!1;const[f,...d]=m;s.push('<div class="overflow-x-auto my-2"><table class="text-xs w-full"><thead><tr>');for(const b of f)s.push(`<th class="text-left py-1 px-2 border-b border-border text-text-secondary font-medium">${ri(b)}</th>`);s.push("</tr></thead><tbody>");for(const b of d){s.push("<tr>");for(const v of b)s.push(`<td class="py-1 px-2 border-b border-border/50">${ri(v)}</td>`);s.push("</tr>")}s.push("</tbody></table></div>"),m=[]}if(!g){l&&(s.push("</ul>"),l=!1);continue}if(g.startsWith("### ")){l&&(s.push("</ul>"),l=!1),s.push(`<h4 class="${t.heading} font-semibold text-text-primary mt-3 mb-1">${ri(g.slice(4))}</h4>`);continue}if(g.startsWith("## ")){l&&(s.push("</ul>"),l=!1),s.push(`<h3 class="${t.heading} font-semibold text-text-primary mt-3 mb-1">${ri(g.slice(3))}</h3>`);continue}if(/^[-*_]{3,}$/.test(g)){l&&(s.push("</ul>"),l=!1),s.push('<hr class="border-border my-3" />');continue}if(/^[-*] /.test(g)){l||(s.push('<ul class="space-y-1 my-1">'),l=!0),s.push(`<li class="${t.list} text-text-secondary flex gap-2"><span class="text-text-tertiary shrink-0">-</span><span>${ri(g.slice(2))}</span></li>`);continue}l&&(s.push("</ul>"),l=!1),s.push(`<p class="${t.text} text-text-secondary my-1">${ri(g)}</p>`)}if(c&&m.length){const[p,...g]=m;s.push('<div class="overflow-x-auto my-2"><table class="text-xs w-full"><thead><tr>');for(const f of p)s.push(`<th class="text-left py-1 px-2 border-b border-border text-text-secondary font-medium">${ri(f)}</th>`);s.push("</tr></thead><tbody>");for(const f of g){s.push("<tr>");for(const d of f)s.push(`<td class="py-1 px-2 border-b border-border/50">${ri(d)}</td>`);s.push("</tr>")}s.push("</tbody></table></div>")}return l&&s.push("</ul>"),s}function bA(i){return i.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 vA(i){const t=new Set;for(const r of i){const s=r.codePointAt(0);(s>127||s<32)&&t.add(`"${s<32?"\\x"+s.toString(16).padStart(2,"0"):r}" U+${s.toString(16).toUpperCase().padStart(4,"0")}`)}return[...t]}function xA({value:i}){const t=j.useRef(null),[r,s]=j.useState(!1);return j.useEffect(()=>{if(!(!t.current||!i))try{pA(t.current,i,{format:"CODE128",width:2,height:88,margin:12,displayValue:!0,fontSize:13,background:"#ffffff",lineColor:"#000000"}),s(!1)}catch{s(!0)}},[i]),i?y.jsxs("div",{children:[y.jsx("span",{className:"block text-xs uppercase tracking-wide text-text-tertiary mb-1",children:"Barcode"}),r?y.jsxs("p",{className:"text-xs text-status-error",children:["This value has characters Code 128 cannot carry:"," ",y.jsx("span",{className:"font-mono",children:vA(i).join(", ")||"unknown"})]}):y.jsx("div",{className:"bg-white rounded p-1 inline-block max-w-full overflow-hidden",children:y.jsx("svg",{ref:t,className:"max-w-full"})})]}):null}function _A({onClose:i}){const{submitCode:t,lastResult:r,busy:s,wedgeConfig:l,updateWedgeConfig:c,diagnostics:m,diagnosticsOn:p,setDiagnosticsOn:g}=fv(),[f,d]=j.useState(""),[b,v]=j.useState(!1),_=S=>{S.preventDefault();const M=f.trim();M&&(d(""),t(M))},w=(r==null?void 0:r.response)??null;return y.jsxs("div",{className:"flex flex-col h-full",children:[y.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border",children:[y.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-text-primary",children:[y.jsx(ou,{className:"w-4 h-4"}),"Scan"]}),y.jsx("button",{type:"button",onClick:i,className:"text-text-tertiary hover:text-text-primary",title:"Close",children:y.jsx(Cn,{className:"w-4 h-4"})})]}),y.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-4 space-y-6",children:[y.jsxs("form",{onSubmit:_,className:"space-y-2",children:[y.jsx("label",{className:"block text-xs uppercase tracking-wide text-text-tertiary",children:"Enter a code"}),y.jsxs("div",{className:"flex gap-2",children:[y.jsx("input",{value:f,onChange:S=>d(bA(S.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}),y.jsx("button",{type:"submit",disabled:s||!f.trim(),className:"px-3 py-1.5 text-sm rounded bg-accent text-text-inverse disabled:opacity-50",children:"Go"})]}),y.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."})]}),y.jsx(xA,{value:f.trim()}),r&&y.jsxs("div",{className:"space-y-2",children:[y.jsx("div",{className:"text-xs uppercase tracking-wide text-text-tertiary",children:"Last scan"}),y.jsx("div",{className:"text-sm font-mono text-text-primary",children:r.code}),w?y.jsxs(y.Fragment,{children:[y.jsx("div",{className:`text-sm font-medium ${xv[w.outcome]}`,children:_v(w)}),w.error&&y.jsx("div",{className:"text-xs text-text-tertiary",children:w.error}),ru(w)&&y.jsx("div",{className:"text-sm border-t border-surface-border pt-2",children:y.jsx(wv,{content:ru(w),compact:!0})})]}):y.jsx("div",{className:"text-sm text-status-error",children:r.error})]}),y.jsxs("div",{className:"space-y-2",children:[y.jsxs("button",{type:"button",onClick:()=>v(S=>!S),className:"text-xs uppercase tracking-wide text-text-tertiary hover:text-text-primary",children:["Capture settings ",b?"▾":"▸"]}),b&&y.jsxs("div",{className:"space-y-3",children:[y.jsxs("label",{className:"block text-sm text-text-primary",children:[y.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"}),y.jsx("input",{type:"number",min:100,max:2e3,step:50,value:l.maxKeyGapMs,onChange:S=>c({maxKeyGapMs:Number(S.target.value)}),className:"w-24 px-2 py-1 text-sm bg-surface-raised border border-surface-border rounded"})]}),y.jsxs("label",{className:"flex items-center gap-2 text-sm text-text-primary",children:[y.jsx("input",{type:"checkbox",checked:p,onChange:S=>g(S.target.checked)}),y.jsx("span",{children:"Diagnostics — trace every keydown the capture sees (also logged to the console)"})]}),p&&y.jsxs("div",{className:"border border-surface-border rounded",children:[y.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"}),y.jsxs("div",{className:"max-h-64 overflow-y-auto font-mono text-2xs leading-5 px-2 py-1",children:[m.length===0&&y.jsx("div",{className:"text-text-tertiary",children:"Waiting for keys…"}),m.map(S=>y.jsxs("div",{className:"whitespace-nowrap overflow-hidden text-ellipsis",title:`buffer: ${S.buffer}`,children:[y.jsxs("span",{className:"text-text-tertiary",children:[String(S.deltaMs).padStart(4),"ms "]}),y.jsx("span",{className:"text",children:JSON.stringify(S.key)}),S.code&&y.jsxs("span",{className:"text-text-tertiary",children:[" (",S.code,")"]}),y.jsxs("span",{className:"text-text-tertiary",children:[" — ",S.note]})]},S.seq))]}),y.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"," ",y.jsx("span",{className:"font-mono",children:'"Enter"'})," row saying"," ",y.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'," ",y.jsx("span",{className:"font-mono",children:'"Unidentified"'})," mean the decode arrives outside the keydown path."]})]})]})]})]})]})}const Sv="lt:bookmarks",qc="scan";function wA(){try{const i=localStorage.getItem(Sv);if(!i)return[];const t=JSON.parse(i);return Array.isArray(t)?t:[]}catch{return[]}}function R1(i){try{localStorage.setItem(Sv,JSON.stringify(i))}catch{}}function SA({onToggleEventFeed:i,onToggleDocs:t,onToggleNav:r}){var de,Oe;const s=go(),{user:l,logout:c}=pn(),{viewAs:m,realIsBuilder:p}=Yb(),{available:g,mine:f}=oO();Xb();const{connected:d}=FE(),{data:b}=Or(),{setPanel:v,closePanel:_,open:w,ownerKey:S}=Yd(),M=cv(),L=mn(),z=()=>{w&&S===qc?_(qc):v(y.jsx(_A,{onClose:()=>_(qc)}),{width:360,key:qc})},[ie,ae]=j.useState(!1),[C,I]=j.useState(!1),[re,K]=j.useState(rv),[B,G]=j.useState(wA),W=j.useRef(null),Q=(de=b==null?void 0:b.branding)==null?void 0:de.appName,he=(Oe=b==null?void 0:b.branding)==null?void 0:Oe.themes,_e=j.useMemo(()=>(hO(he??[]),dO()),[he]),Te=le=>{mO(le),K(le)},Y=()=>{const le=window.prompt("Bookmark label:");if(!(le!=null&&le.trim()))return;const je=L.pathname+L.search,Se=[...B,{label:le.trim(),url:je}].sort((Ne,be)=>Ne.label.localeCompare(be.label));G(Se),R1(Se),ae(!1)},oe=le=>{const je=B.filter(Se=>!(Se.label===le.label&&Se.url===le.url));G(je),R1(je)};return j.useEffect(()=>{if(!ie)return;const le=je=>{W.current&&!W.current.contains(je.target)&&ae(!1)};return document.addEventListener("mousedown",le),()=>document.removeEventListener("mousedown",le)},[ie]),y.jsxs(y.Fragment,{children:[y.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 ${ie?"z-[100]":"z-30"}`,children:[y.jsxs("div",{className:"flex items-center gap-1 min-w-0",children:[r&&y.jsx("button",{onClick:r,className:"lg:hidden p-2 text-text-secondary hover:text-text-primary transition-colors","aria-label":"Open navigation",children:y.jsx(iw,{className:"w-5 h-5",strokeWidth:1.5})}),y.jsxs(Ii,{to:"/","aria-label":"Home",className:"shrink-0",onClick:le=>{(le.ctrlKey||le.metaKey)&&(le.preventDefault(),I(!0))},children:[y.jsx(nu,{appName:Q,className:"hidden lg:flex"}),y.jsx(nu,{appName:Q,variant:"comet",className:"flex lg:hidden"})]}),y.jsx("div",{className:"hidden lg:block w-px h-4 bg-surface-border mx-1"}),y.jsx("button",{onClick:()=>s(-1),className:"p-2 text-accent/60 hover:text-accent transition-colors","aria-label":"Go back",children:y.jsx(ib,{className:"w-5 h-5",strokeWidth:2})}),y.jsx("button",{onClick:()=>s(1),className:"p-2 text-accent/60 hover:text-accent transition-colors","aria-label":"Go forward",children:y.jsx(Yh,{className:"w-5 h-5",strokeWidth:2})})]}),y.jsxs("div",{className:"flex items-center gap-5",children:[y.jsxs(Ii,{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:[y.jsx(Xh,{className:"w-4 h-4",strokeWidth:1.5}),y.jsx("span",{className:"hidden lg:inline",children:"all"}),g>0&&y.jsx("sup",{className:"tabular-nums font-medium text-[0.5em]",children:g})]}),y.jsxs(Ii,{to:"/escalations/queue",className:`flex items-center gap-1.5 text-xs transition-colors ${f>0?"text-status-claimed":"text-text-quaternary hover:text-text-secondary"}`,title:"My escalation queue",children:[y.jsx(Xh,{className:"w-4 h-4",strokeWidth:1.5}),y.jsx("span",{className:"hidden lg:inline",children:"mine"}),f>0&&y.jsx("sup",{className:"tabular-nums font-medium text-[0.5em]",children:f})]}),y.jsx("div",{className:"hidden lg:block w-px h-4 bg-surface-border"}),M&&y.jsxs("button",{type:"button",onClick:z,className:"flex items-center gap-1.5 text-xs text-text-quaternary hover:text-text-secondary transition-colors",title:"Scan a code",children:[y.jsx(ou,{className:"w-4 h-4",strokeWidth:1.5}),y.jsx("span",{className:"hidden lg:inline",children:"scan"})]}),y.jsxs("button",{type:"button",onClick:()=>{d?i==null||i():window.location.reload()},className:`hidden lg:flex items-center gap-1.5 text-xs transition-colors ${d?"text-status-success hover:text-status-success/80":"text-text-quaternary hover:text-text-secondary"}`,title:d?"Live events — click to toggle feed":"Events disconnected — click to reconnect",children:[y.jsx(sb,{className:"w-4 h-4",strokeWidth:1.5}),"events"]}),p&&y.jsx(y.Fragment,{children:y.jsxs("button",{onClick:t,className:"hidden lg:flex items-center gap-1.5 text-xs text-text-quaternary hover:text-text-secondary transition-colors",title:"Documentation",children:[y.jsx(ab,{className:"w-4 h-4",strokeWidth:1.5}),"docs"]})}),m&&y.jsx(y.Fragment,{children:y.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:[y.jsxs("span",{className:"capitalize font-medium tracking-wide",children:[m," View"]}),y.jsx("button",{onClick:bd,title:"Restore your real view",className:"ml-0.5 rounded-full p-0.5 hover:bg-accent/20 transition-colors",children:y.jsx(Cn,{className:"w-2.5 h-2.5"})})]})}),y.jsx("div",{className:"hidden lg:block w-px h-4 bg-surface-border"}),l&&y.jsxs("div",{className:"relative",ref:W,children:[y.jsxs("button",{onClick:()=>ae(le=>!le),className:"btn-ghost flex items-center gap-1",children:[y.jsxs("span",{className:"relative",children:[y.jsx(sw,{className:"w-4 h-4 text-accent/75",strokeWidth:1.5}),m&&y.jsx("span",{className:"lg:hidden absolute -top-0.5 -right-0.5 w-2 h-2 rounded-full bg-accent"})]}),y.jsx("span",{className:"hidden lg:inline whitespace-nowrap",children:l.displayName||l.username||l.userId}),y.jsx("svg",{className:"hidden lg:block w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),ie&&y.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:[y.jsx(Ii,{to:"/credentials",onClick:()=>ae(!1),className:"block px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Credentials"}),y.jsx("button",{onClick:()=>{ae(!1),d?i==null||i():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:d?"Events":"Reconnect events"}),p&&y.jsx("button",{onClick:()=>{ae(!1),t==null||t()},className:"lg:hidden block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Docs"}),m&&y.jsxs("button",{onClick:()=>{ae(!1),bd()},className:"lg:hidden block w-full text-left px-3 py-2 text-xs text-accent hover:bg-surface-hover capitalize",children:["Exit ",m," view"]}),y.jsxs("div",{className:"px-3 py-2 border-t border-surface-border/60",children:[y.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-1.5",children:"Theme"}),y.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:_e.map(le=>y.jsx("button",{type:"button",onClick:()=>Te(le.id),title:le.label,"aria-label":`${le.label} theme`,className:`w-4 h-4 rounded-full transition-transform hover:scale-110 ${re===le.id?"ring-2 ring-offset-1 ring-surface-border":""}`,style:{backgroundColor:le.swatch}},le.id))})]}),y.jsx("button",{onClick:()=>{ae(!1),c()},className:"block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Sign Out"}),y.jsxs("div",{className:"border-t border-surface-border/60 pt-1",children:[B.map(le=>y.jsxs("div",{className:"flex items-center group px-3 py-1.5 hover:bg-surface-hover",children:[y.jsx(Ii,{to:le.url,onClick:()=>ae(!1),title:le.url,className:"flex-1 min-w-0 text-xs text-text-secondary hover:text-text-primary truncate",children:le.label}),y.jsx("button",{type:"button",onClick:()=>oe(le),title:`Remove "${le.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:y.jsx(Cn,{className:"w-3 h-3"})})]},`${le.label}::${le.url}`)),y.jsx("hr",{className:"border-surface-border/60 mx-3 my-0.5"}),y.jsxs("button",{type:"button",onClick:Y,className:"flex items-center gap-1.5 w-full px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:[y.jsx(aw,{className:"w-3.5 h-3.5 shrink-0",strokeWidth:1.5}),"Add Bookmark"]})]})]})]})]})]}),C&&y.jsx(fO,{onClose:()=>I(!1)})]})}function Xd({open:i,children:t}){const[r,s]=j.useState(i);return j.useEffect(()=>{i&&s(!0)},[i]),y.jsx("div",{className:`grid transition-[grid-template-rows] duration-300 ease-out ${i?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,onTransitionEnd:()=>{i||s(!1)},children:y.jsx("div",{className:"overflow-hidden",children:r?t:null})})}function _d(i){return({isActive:t})=>{const r="flex items-center rounded-md transition-colors duration-150",s="bg-surface-hover text-text-primary font-medium",l="text-text-secondary hover:text-text-primary hover:bg-surface-hover";return i?`${r} justify-center w-10 h-10 mx-auto ${t?s:l}`:`${r} gap-3 px-4 py-2 text-sm ${t?s:l}`}}function EA(){return({isActive:i})=>`flex items-center gap-3 pl-11 pr-4 py-1.5 text-xs rounded-md transition-colors duration-150 ${i?"text-text-primary font-medium":"text-text-secondary hover:text-text-primary"}`}function OA({group:i,collapsed:t}){const{pathname:r}=mn(),s=i.matchPaths.some(p=>r.startsWith(p)),[l,c]=j.useState(s),m=l||s;return t?y.jsx(y.Fragment,{children:i.items.map(p=>y.jsx(Hs,{to:p.to,className:_d(!0),title:p.label,children:p.icon&&y.jsx(p.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})},p.to))}):y.jsxs("div",{children:[y.jsxs("button",{onClick:()=>c(p=>!p),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:[y.jsxs("span",{className:"flex items-center gap-3",children:[i.icon&&y.jsx(i.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),y.jsx("span",{children:i.label})]}),y.jsx("svg",{className:`w-3.5 h-3.5 text-text-tertiary transition-transform duration-150 ${m?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),y.jsx(Xd,{open:m,children:i.items.map(p=>y.jsxs(Hs,{to:p.to,end:p.end,className:EA(),children:[p.icon&&y.jsx(p.icon,{className:"w-4 h-4 shrink-0 text-accent/75",strokeWidth:1.5}),y.jsx("span",{children:p.label})]},p.to))})]})}function AA(i){return i.kind==="group"}function jA({entry:i,collapsed:t}){const{pathname:r,search:s}=mn(),l=i.to.includes("?"),c=i.icon&&y.jsx(i.icon,{className:`w-5 h-5 shrink-0 text-accent/75 ${i.iconClassName??""}`,strokeWidth:1.5,...i.solid?{fill:"currentColor"}:{}});if(l){const[m,p]=i.to.split("?"),g=r===m&&s===`?${p}`,f=_d(t)({isActive:g});return y.jsxs(Hs,{to:i.to,className:f,title:t?i.label:void 0,children:[c,!t&&y.jsx("span",{children:i.label})]})}return y.jsxs(Hs,{to:i.to,end:i.end,className:_d(t),title:t?i.label:void 0,children:[c,!t&&y.jsx("span",{children:i.label})]})}function ui({heading:i,entries:t}){const{collapsed:r}=Fd();return y.jsxs("div",{className:"space-y-1",children:[r?y.jsx("div",{className:"h-px bg-surface-border mx-3 my-2",title:i}):y.jsx("p",{className:"px-4 pt-5 pb-2 text-xs font-semibold uppercase tracking-wider text-text-tertiary",children:i}),t.map(s=>AA(s)?y.jsx(OA,{group:s,collapsed:r},s.label):y.jsx(jA,{entry:s,collapsed:r},s.to))]})}function TA({aiEnabled:i=!1,isBuilder:t=!1,isOps:r=!1,viewAs:s=null,canSeePaceBoard:l=!1}){const c={to:"/operations",label:"Pace Board",icon:ow};if(!t&&(!r||s==="engineer"||s==="operator"))return l?y.jsx(ui,{heading:"Monitor",entries:[c]}):null;if(!t)return y.jsx(ui,{heading:"Monitor",entries:l?[c]:[]});const m=[...l?[c]:[],{to:"/topics",label:"Event Topics",icon:sb},{to:"/agents",label:i?"Agents":"Automations",icon:lw},{to:"/capabilities",label:"Capabilities",icon:cw}];return y.jsx(ui,{heading:"Monitor",entries:m})}function B3(){return pt({queryKey:["roles"],queryFn:()=>Ae("/roles")})}function NA(i){return pt({queryKey:["roles","details"],queryFn:()=>Ae("/roles/details"),enabled:(i==null?void 0:i.enabled)??!0})}function L3(i,t,r=!0){return pt({queryKey:["roles",i,"schema",t??"latest"],queryFn:()=>Ae(`/roles/${encodeURIComponent(i)}/schema${t!=null?`?version=${t}`:""}`),enabled:r&&!!i})}function z3(i){return pt({queryKey:["roles",i,"schema-versions"],queryFn:()=>Ae(`/roles/${encodeURIComponent(i)}/schema/versions`),enabled:!!i})}function U3(i,t,r=!0){return pt({queryKey:["roles",i,"list-schema",t??"latest"],queryFn:()=>Ae(`/roles/${encodeURIComponent(i)}/list-schema${t!=null?`?version=${t}`:""}`),enabled:r&&!!i})}function P3(i){return pt({queryKey:["roles",i,"list-schema-versions"],queryFn:()=>Ae(`/roles/${encodeURIComponent(i)}/list-schema/versions`),enabled:!!i})}function I3(){const i=gt();return Et({mutationFn:t=>Ae("/roles",{method:"POST",body:JSON.stringify({role:t})}),onSuccess:()=>{i.invalidateQueries({queryKey:["roles"]})}})}function $3(){const i=gt();return Et({mutationFn:({role:t,...r})=>Ae(`/roles/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify(r)}),onMutate:async({role:t,...r})=>{await i.cancelQueries({queryKey:["roles","details"]});const s=i.getQueryData(["roles","details"]);return s&&i.setQueryData(["roles","details"],{roles:s.roles.map(l=>l.role===t?{...l,...r}:l)}),{previous:s}},onError:(t,r,s)=>{s!=null&&s.previous&&i.setQueryData(["roles","details"],s.previous)},onSuccess:()=>{i.invalidateQueries({queryKey:["roles"]})}})}function H3(){const i=gt();return Et({mutationFn:t=>Ae(`/roles/${encodeURIComponent(t)}`,{method:"DELETE"}),onSuccess:()=>{i.invalidateQueries({queryKey:["roles"]})}})}function kA(){return pt({queryKey:["me","preferences"],queryFn:()=>Ae("/me/preferences"),staleTime:6e4})}function CA(){const i=gt();return Et({mutationFn:t=>Ae("/me/preferences",{method:"PATCH",body:JSON.stringify(t)}),onSuccess:t=>{i.setQueryData(["me","preferences"],t)}})}function MA(i){return i.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").split(/[-_\s]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function RA(i){var t;return((t=i.title)==null?void 0:t.trim())||MA(i.role)}function DA(i,t){const r=(i==null?void 0:i.pinnedViews)??[],s=new Set((i==null?void 0:i.hiddenRolePins)??[]),l=new Set(r.map(p=>p.label)),c=[...r],m=new Set;for(const{role:p,pins:g}of t)for(const f of g)l.has(f.label)||s.has(f.label)||m.has(f.label)||(m.add(f.label),c.push({...f,id:`role:${p}:${f.label}`,fromRole:p}));return c}function qA(i){let t;try{t=new URL(i,"http://local")}catch{return null}if(t.pathname!=="/escalations/available"&&t.pathname!=="/escalations")return null;const r=t.searchParams,s=OO(r),l=r.get("status")||void 0,c=t.pathname==="/escalations/available"&&(l===void 0||l==="available");return{available:c,params:{...s,role:r.get("role")||void 0,type:r.get("type")||void 0,priority:r.get("priority")?parseInt(r.get("priority"),10):void 0,status:c||l==="all"?void 0:l,search:r.get("search")||void 0}}}function BA(){return`pin-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function LA(){var C;const{collapsed:i}=Fd(),{user:t}=pn(),r=kA(),s=CA(),l=j.useMemo(()=>new Set(((t==null?void 0:t.roles)??[]).map(I=>I.role)),[t]),{data:c}=NA({enabled:l.size>0}),m=gt();Rd(Hd(),()=>{m.invalidateQueries({queryKey:["escalations"]})});const p=(C=r.data)==null?void 0:C.preferences,g=j.useMemo(()=>((c==null?void 0:c.roles)??[]).filter(I=>l.has(I.role)&&Array.isArray(I.default_pins)&&I.default_pins.length>0).map(I=>({role:I.role,pins:I.default_pins})),[c,l]),f=j.useMemo(()=>DA(p,g),[p,g]),d=j.useMemo(()=>new Map(((c==null?void 0:c.roles)??[]).map(I=>[I.role,RA(I)])),[c]),b=j.useMemo(()=>f.filter(I=>!I.fromRole),[f]),v=j.useMemo(()=>g.map(({role:I})=>({role:I,title:d.get(I)??I,pins:f.filter(re=>re.fromRole===I)})).filter(I=>I.pins.length>0),[g,d,f]),_=(p==null?void 0:p.pinnedViews)??[],w=j.useRef(null),S=I=>s.mutate({pinnedViews:I}),M=I=>S(_.filter(re=>re.id!==I)),L=I=>S([..._,{id:BA(),label:I.label,url:I.url,badge:I.badge}]),z=I=>s.mutate({hiddenRolePins:[...(p==null?void 0:p.hiddenRolePins)??[],I]}),ie=(I,re)=>{if(I===re)return;const K=[..._],[B]=K.splice(I,1);K.splice(re,0,B),S(K)};if(f.length===0)return null;const ae="px-4 pt-5 pb-2 text-xs font-semibold uppercase tracking-wider text-text-tertiary truncate";return y.jsxs("div",{className:"space-y-1",children:[i&&y.jsx("div",{className:"h-px bg-surface-border mx-3 my-2",title:"Pinned"}),!i&&b.length>0&&y.jsx("p",{className:ae,children:"Pinned"}),b.map(I=>{const re=_.findIndex(K=>K.id===I.id);return y.jsx(D1,{pin:I,collapsed:i,draggable:re!==-1,onDragStart:()=>{w.current=re},onDropOn:()=>{w.current!==null&&re!==-1&&ie(w.current,re),w.current=null},onRemove:()=>M(I.id)},I.id)}),v.map(I=>y.jsxs("div",{children:[!i&&y.jsx("p",{className:ae,title:`${I.title} — pins from the ${I.role} role`,"data-testid":"pin-group-label",children:I.title}),I.pins.map(re=>y.jsx(D1,{pin:re,collapsed:i,draggable:!1,onDragStart:()=>{},onDropOn:()=>{},onPromote:()=>L(re),onHide:()=>z(re.label)},re.id))]},I.role))]})}function D1({pin:i,collapsed:t,draggable:r,onDragStart:s,onDropOn:l,onRemove:c,onPromote:m,onHide:p}){const{pathname:g,search:f}=mn(),[d,b=""]=i.url.split("?"),v=g===d&&f===(b?`?${b}`:""),_="group flex items-center rounded-md transition-colors duration-150",w=v?"bg-surface-hover text-text-primary font-medium":"text-text-secondary hover:text-text-primary hover:bg-surface-hover";return t?y.jsx(Hs,{to:i.url,className:`${_} ${w} justify-center w-10 h-10 mx-auto`,title:i.label,children:y.jsx(zg,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})}):y.jsxs("div",{className:`${_} ${w} relative`,draggable:r,onDragStart:s,onDragOver:S=>S.preventDefault(),onDrop:l,children:[y.jsxs(Hs,{to:i.url,title:i.label,className:"flex items-center gap-2.5 pl-4 pr-3 py-1.5 text-[0.7875rem] flex-1 min-w-0",children:[y.jsx(zg,{className:"w-4 h-4 shrink-0 text-accent/75",strokeWidth:1.5,...i.fromRole?{}:{fill:"currentColor",fillOpacity:.15}}),y.jsx("span",{className:"truncate flex-1 min-w-0",children:i.label}),i.badge&&y.jsx(zA,{url:i.url})]}),y.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:[m&&y.jsx("button",{onClick:m,title:"Make mine — copy into my pins",className:"p-1 text-text-quaternary hover:text-accent transition-colors",children:y.jsx(ob,{className:"w-3 h-3"})}),p&&y.jsx("button",{onClick:p,title:"Hide this role pin",className:"p-1 text-text-quaternary hover:text-status-error transition-colors",children:y.jsx(uw,{className:"w-3 h-3"})}),c&&y.jsx("button",{onClick:c,title:`Remove "${i.label}"`,className:"p-1 text-text-quaternary hover:text-status-error transition-colors",children:y.jsx(Cn,{className:"w-3 h-3"})})]})]})}function zA({url:i}){var m;const t=j.useMemo(()=>qA(i),[i]),r={limit:1,staleTime:15e3},s=Wb({...(t==null?void 0:t.params)??{},...r,enabled:!!t&&t.available}),l=Zb({...(t==null?void 0:t.params)??{},...r,enabled:!!t&&!t.available});if(!t)return null;const c=t.available?s:l;return c.isError||((m=c.data)==null?void 0:m.total)===void 0?null:y.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 UA(){var c;const{data:i}=Or(),t=(c=i==null?void 0:i.features)==null?void 0:c.graphWorkflows,r=t===!0||t!==!1&&Fb(),s=[{to:"/workflows/registry",label:"Registry",icon:Ug},{to:"/workflows/durable/invoke",label:"Invoke",icon:Pg},{to:"/workflows/executions",label:"Executions",icon:Ig}],l=r?[{kind:"group",label:"Procedural",icon:fw,matchPaths:["/workflows/registry","/workflows/durable/invoke","/workflows/executions","/workflows/durable/executions","/workflows/start","/workflows/workers","/workflows/tasks"],items:s},{kind:"group",label:"Graph",icon:wd,matchPaths:["/mcp/workflows","/mcp/executions"],items:[{to:"/mcp/workflows",label:"Configure",icon:Ug,end:!0},{to:"/mcp/workflows/invoke",label:"Invoke",icon:Pg},{to:"/mcp/executions",label:"Executions",icon:Ig}]}]:s;return y.jsx(ui,{heading:"Orchestrate",entries:l})}const PA=[{to:"/mcp/queries",label:"Designer",icon:hw},{to:"/mcp/servers",label:"Servers & Tools",icon:dw}];function IA(){return y.jsx(ui,{heading:"Design",entries:PA})}const $A=[{to:"/files",label:"Files",icon:mw},{to:"/knowledge",label:"Knowledge",icon:pw}];function HA(){return y.jsx(ui,{heading:"Storage",entries:$A})}function GA({isBuilder:i=!1,isOps:t=!1}){var m;const{data:r}=Or(),s=((m=r==null?void 0:r.features)==null?void 0:m.dbMaintenance)!==!1,l=[{to:"/admin/users",label:"Accounts",icon:gw},...i||t?[{to:"/admin/roles",label:"Roles",icon:Xh},{to:"/admin/personas",label:"Personas",icon:yw},{to:"/admin/scan-codes",label:"Scan Codes",icon:ou}]:[]],c=[{to:"/admin/controlplane",label:"Routers",icon:bw},{to:"/admin/streams",label:"Messages",icon:vw},...s?[{to:"/admin/maintenance",label:"DB Maintenance",icon:xw}]:[]];return y.jsxs(y.Fragment,{children:[y.jsx(ui,{heading:"Identity & Access",entries:l}),i&&y.jsx(ui,{heading:"Infrastructure",entries:c})]})}function Ev({aiEnabled:i,isBuilder:t,isOps:r,viewAs:s,canSeePaceBoard:l}){return y.jsxs(y.Fragment,{children:[y.jsx(TA,{aiEnabled:i,isBuilder:t,isOps:r,viewAs:s,canSeePaceBoard:l}),y.jsx(LA,{}),t&&y.jsx(UA,{}),t&&i&&y.jsx(IA,{}),t&&y.jsx(HA,{}),(t||r)&&y.jsx(GA,{isBuilder:t,isOps:r})]})}function FA({open:i,onClose:t,...r}){const s=mn();return j.useEffect(()=>{t()},[s.pathname]),y.jsxs("div",{className:`lg:hidden fixed inset-y-0 left-0 z-40 flex ${i?"":"pointer-events-none"}`,children:[y.jsx("div",{className:`fixed inset-0 bg-black/20 transition-opacity duration-200 ${i?"opacity-100":"opacity-0"}`,onClick:t,"aria-hidden":!0}),y.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 ${i?"translate-x-0":"-translate-x-full"}`,children:[y.jsx("div",{className:"flex items-center justify-end px-3 pt-3 shrink-0",children:y.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:y.jsx(Cn,{className:"w-4 h-4"})})}),y.jsx("nav",{className:"flex-1 px-3 pb-4 space-y-2 overflow-y-auto overflow-x-hidden",children:y.jsx(iO,{children:y.jsx(Ev,{...r})})})]})]})}const Ov="lt_event_feed_patterns";function VA(i,t){if(i.startsWith("/topics/")){const m=decodeURIComponent(i.replace("/topics/",""));if(m&&!m.includes("/"))return`lt.events.${m}`}const r=i.match(/^\/escalations\/detail\/(.+)/);if(r)return`lt.events.system.escalation.*.${r[1]}.>`;if(i.startsWith("/escalations")){const m=new URLSearchParams(t).get("role");return m?`lt.events.system.escalation.${Kb(m)}.>`:"lt.events.system.escalation.>"}const s=i.match(/^\/workflows\/(?:durable\/)?executions\/(.+)/);if(s)return`lt.events.system.workflow.${s[1]}.>`;if(i.startsWith("/workflows"))return"lt.events.system.workflow.>";const l=i.match(/^\/agents\/([^/]+)$/);if(l&&l[1]!=="new")return`lt.events.system.agent.${l[1]}.>`;if(i.startsWith("/agents"))return"lt.events.system.agent.>";if(i.startsWith("/knowledge"))return"lt.events.system.knowledge.>";if(i.startsWith("/files"))return"lt.events.system.file.>";if(i==="/")return"lt.events.system.>";const c=i.match(/^\/mcp\/executions\/(.+)/);return c?`lt.events.system.*.${c[1]}.>`:(i.startsWith("/mcp"),"lt.events.system.>")}function YA(){try{const i=localStorage.getItem(Ov);return i?JSON.parse(i):[]}catch{return[]}}function Gh(i){try{localStorage.setItem(Ov,JSON.stringify(i))}catch{}}function XA(){const{pathname:i,search:t}=mn(),[r,s]=j.useState(YA),l=j.useMemo(()=>VA(i,t),[i,t]),c=j.useMemo(()=>{const f=new Set([l,...r]);return Array.from(f)},[l,r]),m=j.useCallback(f=>{const d=f.startsWith("lt.events.")?f:`lt.events.${f}`;s(b=>{if(b.includes(d))return b;const v=[...b,d];return Gh(v),v})},[]),p=j.useCallback(f=>{s(d=>{const b=d.filter(v=>v!==f);return Gh(b),b})},[]),g=j.useCallback(()=>{s([]),Gh([])},[]);return{patterns:c,pagePattern:l,userPatterns:r,addPattern:m,removePattern:p,clearUserPatterns:g}}function KA({children:i,className:t=""}){return y.jsx("p",{className:`text-2xs font-semibold uppercase tracking-widest text-text-tertiary ${t}`,children:i})}const Fh=280,q1="cubic-bezier(0.4, 0, 0.2, 1)",Bc=40;function JA(i){if(!i)return"scale(0.92)";const t=window.innerWidth,r=window.innerHeight,s=t-Bc*2,l=r-Bc*2,c=i.width/s,m=i.height/l,p=i.left+i.width/2-(Bc+s/2),g=i.top+i.height/2-(Bc+l/2);return`translate(${p}px, ${g}px) scale(${c}, ${m})`}function Av({open:i,onClose:t,sourceRef:r,children:s}){const[l,c]=j.useState(null),m=j.useRef(null),p=j.useRef(!1);j.useEffect(()=>{var v,_;i&&!p.current?(m.current=((v=r==null?void 0:r.current)==null?void 0:v.getBoundingClientRect())??null,c("entering")):!i&&p.current&&l==="open"&&(m.current=((_=r==null?void 0:r.current)==null?void 0:_.getBoundingClientRect())??null,c("exiting")),p.current=i},[i,r,l]),j.useEffect(()=>{if(l!=="entering")return;const v=requestAnimationFrame(()=>{requestAnimationFrame(()=>c("open"))});return()=>cancelAnimationFrame(v)},[l]),j.useEffect(()=>{if(l)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[l]),j.useEffect(()=>{if(!l)return;const v=_=>{_.key==="Escape"&&t()};return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[l,t]);const g=j.useCallback(v=>{v.propertyName==="transform"&&l==="exiting"&&c(null)},[l]);if(j.useEffect(()=>{if(l!=="exiting")return;const v=setTimeout(()=>c(null),Fh+50);return()=>clearTimeout(v)},[l]),!l)return null;const f=l==="entering"||l==="exiting",d=f?JA(m.current):"none",b=f?0:1;return rb.createPortal(y.jsx("div",{className:"fixed inset-0 z-50 overflow-auto p-10",style:{transformOrigin:"center center",transition:`transform ${Fh}ms ${q1}, opacity ${Fh}ms ${q1}`,transform:d,opacity:b,backgroundColor:"rgb(var(--lt-surface))"},onTransitionEnd:g,children:s}),document.body)}function QA({className:i}){return y.jsx("svg",{className:i,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M4 12h8M4 18h12"})})}function ZA({className:i}){return y.jsx("svg",{className:i,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 7l-5 5 5 5M16 7l5 5-5 5"})})}function WA({className:i}){return y.jsx("svg",{className:i,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:y.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 ej({className:i}){return y.jsx("svg",{className:i,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}function tj({className:i}){return y.jsx("svg",{className:i,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:y.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 nj({className:i}){return y.jsx("svg",{className:i,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:y.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 rj(i){const t=i.trim().split(`
56
+ `);if(t.length<2)return i;const r=p=>p.split("|").map(g=>g.trim()).filter(Boolean),s=r(t[0]),l=t.slice(2),c=s.map(p=>`<th class="px-3 py-1.5 text-left text-2xs font-semibold uppercase tracking-wider text-text-tertiary">${p}</th>`).join(""),m=l.map(p=>`<tr class="border-t border-surface-border">${r(p).map(d=>`<td class="px-3 py-1.5 text-xs text-text-secondary">${d}</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>${m}</tbody></table>`}function Lc(i){return i.toLowerCase().replace(/<[^>]+>/g,"").replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").trim()}function ij(i){const t=[];let r=i.replace(/```(\w*)\n([\s\S]*?)```/g,(g,f,d)=>{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>${d}</code></pre>`),`\0CODE${b}\0`});const s=/^(\|.+\|)\n(\|[-| :]+\|)\n((?:\|.+\|\n?)+)/gm;r=r.replace(s,(g,f,d,b)=>rj(`${f}
57
+ ${d}
58
+ ${b.trimEnd()}`)),r=r.replace(/`([^`]+)`/g,'<code class="bg-surface-sunken px-1 py-0.5 rounded text-2xs">$1</code>'),r=r.replace(/^#### (.+)$/gm,(g,f)=>`<h4 id="${Lc(f)}" class="text-xs font-semibold text-text-primary mt-4 mb-1">${f}</h4>`).replace(/^### (.+)$/gm,(g,f)=>`<h3 id="${Lc(f)}" class="text-sm font-semibold text-text-primary mt-5 mb-1.5">${f}</h3>`).replace(/^## (.+)$/gm,(g,f)=>`<h2 id="${Lc(f)}" class="text-base font-semibold text-text-primary mt-6 mb-2 pb-1 border-b border-surface-border">${f}</h2>`).replace(/^# (.+)$/gm,(g,f)=>`<h1 id="${Lc(f)}" class="text-lg font-bold text-text-primary mb-3">${f}</h1>`),r=r.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 f=g.replace(/^> /gm,"").trim(),d=/⚠️|warning|caution/i.test(f),b=/note:|ℹ️|info/i.test(f);return`<div class="${d?"bg-status-warning/5":b?"bg-accent/5":"bg-surface-sunken/50"} ${d?"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">${f}</div>`}).replace(/\n\n/g,"\0PARA\0").replace(/\n/g,"<br/>");const l=g=>g.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),c=g=>new RegExp(`(${l(g)}[\\s\\S]*?<\\/li>(?:<br\\/>)?)+`,"g");r=r.replace(c('<li class="ml-8 list-disc'),g=>`<ul class="mb-3">${g}</ul>`),r=r.replace(c('<li class="ml-4 list-disc'),g=>`<ul class="mb-3">${g}</ul>`),r=r.replace(c('<li class="ml-4 list-decimal'),g=>`<ol class="list-decimal mb-3">${g}</ol>`),r=r.replace(/\x00CODE(\d+)\x00/g,(g,f)=>t[parseInt(f,10)]);const m="text-xs leading-relaxed text-text-secondary mb-2",p=/<\/(h[1-4]|pre|table|ul|ol|hr|div)>/;return r=r.split("\0PARA\0").map(g=>{const f=g.trim();if(!f)return"";const d=[];let b=f,v;for(;(v=p.exec(b))!==null;){const _=v.index+v[0].length;d.push(b.slice(0,_)),b=b.slice(_).replace(/^<br\/>/,"").trim(),p.lastIndex=0}return b&&d.push(b),d.map(_=>{const w=_.trim();return w?/^\s*<(h[1-4]|pre|table|ul|ol|hr|div)/.test(w)?w:`<p class="${m}">${w}</p>`:""}).join("")}).join(""),r}const sj=/(\*\*|^#{1,4}\s|^- |^\d+\.\s|```|^\|.*\|$|\[.+\]\(.+\))/m;function aj(i){return sj.test(i)}function Kd({content:i,className:t,onClick:r}){const s=j.useMemo(()=>ij(i),[i]);return y.jsx("div",{className:t,onClick:r,dangerouslySetInnerHTML:{__html:s}})}function iu({data:i,depth:t=0,generation:r}){const l=r!==void 0&&r>0&&r%2===1?!1:t>0,[c,m]=j.useState(l),[p,g]=j.useState(r);if(r!==void 0&&r!==p&&(g(r),m(r%2===0&&t>0)),i==null)return y.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof i=="string")return y.jsxs("span",{className:"text-text-primary",children:['"',i,'"']});if(typeof i=="number"||typeof i=="boolean")return y.jsx("span",{className:"text-text-primary font-medium",children:String(i)});if(Array.isArray(i))return i.length===0?y.jsx("span",{className:"text-text-tertiary",children:"[]"}):c?y.jsxs("button",{onClick:()=>m(!1),className:"text-text-secondary hover:text-text-primary",children:["[",i.length," items]"]}):y.jsxs("span",{children:[y.jsx("button",{onClick:()=>m(!0),className:"text-text-tertiary hover:text-text-primary",children:"["}),y.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:i.map((f,d)=>y.jsxs("div",{children:[y.jsx(iu,{data:f,depth:t+1,generation:r}),d<i.length-1&&y.jsx("span",{className:"text-text-tertiary",children:","})]},d))}),y.jsx("span",{className:"text-text-tertiary",children:"]"})]});if(typeof i=="object"){const f=Object.entries(i);return f.length===0?y.jsx("span",{className:"text-text-tertiary",children:"{}"}):c?y.jsxs("button",{onClick:()=>m(!1),className:"text-text-secondary hover:text-text-primary",children:["{","...","}"]}):y.jsxs("span",{children:[y.jsx("button",{onClick:()=>m(!0),className:"text-text-tertiary hover:text-text-primary",children:"{"}),y.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:f.map(([d,b],v)=>y.jsxs("div",{children:[y.jsx("span",{className:"text-text-secondary",children:d}),y.jsx("span",{className:"text-text-tertiary",children:": "}),y.jsx(iu,{data:b,depth:t+1,generation:r}),v<f.length-1&&y.jsx("span",{className:"text-text-tertiary",children:","})]},d))}),y.jsx("span",{className:"text-text-tertiary",children:"}"})]})}return y.jsx("span",{children:String(i)})}function co({data:i,depth:t=0}){if(i==null)return y.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof i=="string")return i.length>40&&aj(i)?y.jsx(Kd,{content:i}):y.jsx("span",{className:"text-text-primary",children:i});if(typeof i=="number"||typeof i=="boolean")return y.jsx("span",{className:"text-text-primary font-medium",children:String(i)});if(Array.isArray(i))return i.length===0?y.jsx("span",{className:"text-text-tertiary italic",children:"empty list"}):y.jsx("div",{className:"space-y-2",children:i.map((r,s)=>y.jsxs("div",{className:"flex items-baseline gap-2",children:[y.jsxs("span",{className:"text-text-tertiary text-2xs shrink-0",children:[s+1,"."]}),y.jsx("div",{className:"flex-1",children:y.jsx(co,{data:r,depth:t+1})})]},s))});if(typeof i=="object"){const r=Object.entries(i);return r.length===0?y.jsx("span",{className:"text-text-tertiary italic",children:"empty"}):y.jsx("div",{className:t>0?"pl-4 border-l border-surface-border space-y-3":"space-y-3",children:r.map(([s,l])=>{const c=l===null||typeof l!="object";return y.jsxs("div",{children:[y.jsx("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-0.5",children:s.replace(/[_-]/g," ")}),c?y.jsx("p",{className:"text-sm text-text-primary",children:y.jsx(co,{data:l,depth:t+1})}):y.jsx(co,{data:l,depth:t+1})]},s)})})}return y.jsx("span",{children:String(i)})}function B1({mode:i,setMode:t,isCollapsed:r,onToggleCollapse:s,onCopy:l,copied:c,onFullscreen:m,onClose:p,large:g}){const f=g?"w-5 h-5":"w-3.5 h-3.5",d=`${g?"p-2":"p-1.5"} rounded text-accent/60 hover:text-accent hover:bg-surface-raised transition-colors duration-150`;return y.jsxs("div",{className:"flex items-center gap-0.5 bg-surface-sunken/80 rounded-md backdrop-blur-sm",children:[i==="json"&&y.jsx("button",{onClick:s,className:d,title:r?"Expand all":"Collapse all",children:r?y.jsx(nj,{className:f}):y.jsx(tj,{className:f})}),y.jsx("button",{onClick:()=>t(i==="json"?"tree":"json"),className:d,title:i==="json"?"Outline view":"JSON view",children:i==="json"?y.jsx(QA,{className:f}):y.jsx(ZA,{className:f})}),y.jsx("button",{onClick:l,className:d,title:"Copy to clipboard",children:c?y.jsx(ej,{className:`${f} text-status-success`}):y.jsx(WA,{className:f})}),m&&y.jsx("button",{onClick:m,className:d,title:"Fullscreen",children:y.jsx(lb,{className:f})}),p&&y.jsx("button",{onClick:p,className:d,title:"Close (Esc)",children:y.jsx(cb,{className:f})})]})}function oj({data:i,label:t,variant:r,defaultCollapsed:s=!1,defaultMode:l}){const c=j.useRef(null),[m,p]=j.useState(l??"json"),[g,f]=j.useState(!1),[d,b]=j.useState(!1),[v,_]=j.useState(s?0:1),[w,S]=j.useState(1),M=v%2===0,L=w%2===0,z=j.useCallback(()=>_(G=>G+1),[]),ie=j.useCallback(()=>S(G=>G+1),[]);let ae=i;if(typeof i=="string")try{ae=JSON.parse(i)}catch{}const C=async()=>{const G=typeof i=="string"?i:JSON.stringify(ae,null,2);await navigator.clipboard.writeText(G),f(!0),setTimeout(()=>f(!1),2e3)},I=j.useCallback(()=>{S(1),b(!0)},[]),re=r==="panel",K=re?"border border-accent-muted/40 rounded-lg p-3 bg-surface-hover/30":"",B=re?"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 y.jsxs("div",{className:K,children:[t&&y.jsx(KA,{children:t}),y.jsxs("div",{ref:c,className:"relative",children:[y.jsx("div",{className:"absolute top-2 right-2 z-[5]",children:y.jsx(B1,{mode:m,setMode:p,isCollapsed:M,onToggleCollapse:z,onCopy:C,copied:g,onFullscreen:I})}),y.jsx("div",{className:B,children:m==="json"?y.jsx(iu,{data:ae,generation:v}):y.jsx(co,{data:ae})})]}),y.jsxs(Av,{open:d,onClose:()=>b(!1),sourceRef:c,children:[y.jsx("div",{className:"sticky top-0 float-right z-10",children:y.jsx(B1,{mode:m,setMode:p,isCollapsed:L,onToggleCollapse:ie,onCopy:C,copied:g,onClose:()=>b(!1),large:!0})}),y.jsx("div",{className:"font-mono text-sm leading-relaxed",children:m==="json"?y.jsx(iu,{data:ae,generation:w}):y.jsx(co,{data:ae})})]})]})}const lj=100,L1=500;let cj=0;const jv={"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 Tv(i){const t=i.split(".");return t[0]==="system"&&t.length>=3?`${t[1]}.${t[t.length-1]}`:i}function z1({event:i,forceExpanded:t=!1}){var v,_;const[r,s]=j.useState(t),l=jv[Tv(i.type)]||"text-text-tertiary";j.useEffect(()=>{s(t)},[t]);const c=t,m=c?"text-xs":"text-2xs",p=c?"text-xs":"text-2xs",g=c?"text-xs":"text-2xs",f=c?"w-3.5 h-3.5":"w-2.5 h-2.5",d=c?"py-2 px-4":"py-1 px-3",b=c?"pb-4 px-4":"pb-2 px-3";return y.jsxs("div",{className:"border-b border-surface-border/30 last:border-b-0",children:[y.jsxs("button",{onClick:()=>s(!r),className:`flex items-center gap-2 ${d} w-full text-left hover:bg-surface-hover/50 transition-colors`,children:[y.jsx("span",{className:`${m} font-mono text-text-tertiary whitespace-nowrap tabular-nums shrink-0`,children:new Date(i.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}),y.jsx("span",{className:`${p} font-medium px-1 py-0.5 rounded ${l} bg-surface-sunken whitespace-nowrap shrink-0`,children:i.type}),y.jsxs("span",{className:`${g} text-text-tertiary font-mono flex-1 min-w-0 truncate`,children:[(v=i.data)!=null&&v.workflowId?String(i.data.workflowId):"",(_=i.data)!=null&&_.escalationId?` esc:${String(i.data.escalationId).slice(0,12)}`:""]}),y.jsx("svg",{className:`${f} text-text-tertiary shrink-0 transition-transform duration-150 ${r?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),y.jsx(Xd,{open:r,children:y.jsx("div",{className:b,children:y.jsx(oj,{data:i.data})})})]})}function uj({open:i,onToggle:t,configOpen:r,onToggleConfig:s}){const[l,c]=j.useState([]),[m,p]=j.useState(!1),[g,f]=j.useState(""),d=j.useRef(null),b=j.useRef(new Map),{subscribe:v}=j.useContext(Xs),{patterns:_,pagePattern:w,userPatterns:S,addPattern:M,removePattern:L}=XA(),z=j.useCallback(C=>{const I=String(C.type||"unknown");if(I.startsWith("mesh."))return;const re=`${I}:${C.timestamp||""}:${C.escalationId||C.workflowId||C.taskId||""}`,K=Date.now(),B=b.current.get(re);if(!(B&&K-B<L1)){if(b.current.set(re,K),b.current.size>200)for(const[G,W]of b.current)K-W>L1*2&&b.current.delete(G);c(G=>[{id:++cj,type:I,timestamp:C.timestamp||new Date().toISOString(),data:C},...G].slice(0,lj))}},[]),ie=j.useRef(z);ie.current=z;const ae=i||m||r;return j.useEffect(()=>{if(!ae)return;const C=_.map(I=>v(I,re=>ie.current(re)));return()=>C.forEach(I=>I())},[v,_.join(","),ae]),j.useEffect(()=>{i&&d.current&&(d.current.scrollTop=0)},[l.length,i]),y.jsxs("div",{className:"shrink-0 border-t border-surface-border bg-surface-raised",children:[y.jsxs("button",{onClick:t,className:"flex items-center gap-2 w-full px-4 py-1.5 text-left hover:bg-surface-hover transition-colors",children:[i?y.jsx(_w,{className:"w-3 h-3 text-text-tertiary"}):y.jsx(ww,{className:"w-3 h-3 text-text-tertiary"}),y.jsx("span",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary",children:"Event Stream"}),l.length>0&&y.jsxs("span",{className:"text-2xs text-text-tertiary",children:[l.length," events"]}),l.length>0&&!i&&y.jsx("span",{className:`text-2xs font-medium px-1 py-0.5 rounded ${jv[Tv(l[0].type)]||"text-text-tertiary"} bg-surface-sunken`,children:l[0].type}),y.jsxs("span",{className:"ml-auto flex items-center gap-1",children:[y.jsx("span",{className:`p-0.5 cursor-pointer ${r?"text-accent":"text-text-tertiary hover:text-text-primary"}`,title:"Subscription config",onClick:C=>{C.stopPropagation(),s()},children:y.jsx(Sw,{className:"w-3 h-3"})}),l.length>0&&y.jsxs(y.Fragment,{children:[y.jsx("span",{className:"text-text-tertiary hover:text-text-primary p-0.5 cursor-pointer",title:"Fullscreen",onClick:C=>{C.stopPropagation(),p(!0)},children:y.jsx(lb,{className:"w-3 h-3"})}),y.jsx("span",{className:"text-text-tertiary hover:text-text-primary p-0.5 cursor-pointer",title:"Clear events",onClick:C=>{C.stopPropagation(),c([])},children:y.jsx(Ew,{className:"w-3 h-3"})})]})]})]}),r&&y.jsxs("div",{className:"px-4 py-2 border-t border-surface-border/50 bg-surface-sunken/30",children:[y.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 mb-1.5",children:[y.jsx("span",{className:"text-2xs text-text-quaternary uppercase tracking-wider shrink-0",children:"Subscribed:"}),y.jsx("span",{className:"text-2xs font-mono text-accent px-1.5 py-0.5 bg-accent/10 rounded",children:w.replace("lt.events.","")}),S.map(C=>y.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:[C.replace("lt.events.",""),y.jsx("button",{onClick:()=>L(C),className:"text-text-quaternary hover:text-status-error",children:y.jsx(Cn,{className:"w-2 h-2"})})]},C))]}),y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("input",{type:"text",value:g,onChange:C=>f(C.target.value),onKeyDown:C=>{C.key==="Enter"&&g.trim()&&(M(g.trim()),f(""))},placeholder:"task.> or file.stored",className:"input text-2xs font-mono flex-1 py-1"}),y.jsxs("button",{onClick:()=>{g.trim()&&(M(g.trim()),f(""))},className:"text-2xs text-accent hover:text-accent-hover flex items-center gap-0.5",children:[y.jsx(ob,{className:"w-2.5 h-2.5"})," Add"]})]})]}),y.jsx(Xd,{open:i,children:y.jsx("div",{ref:d,className:"h-48 overflow-y-auto",children:l.length===0?y.jsx("p",{className:"text-2xs text-text-tertiary py-4 text-center",children:"Waiting for events..."}):l.map(C=>y.jsx(z1,{event:C},C.id))})}),y.jsxs(Av,{open:m,onClose:()=>p(!1),sourceRef:d,children:[y.jsx("div",{className:"sticky top-0 float-right z-10",children:y.jsx("button",{onClick:()=>p(!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:y.jsx(cb,{className:"w-5 h-5"})})}),l.length===0?y.jsx("p",{className:"text-sm text-text-tertiary py-8",children:"No events captured"}):l.map(C=>y.jsx(z1,{event:C,forceExpanded:!0},C.id))]})]})}function fj(){return pt({queryKey:["docs"],queryFn:()=>Ae("/docs"),staleTime:5*6e4})}function hj(i){return pt({queryKey:["docs",i],queryFn:()=>Ae(`/docs/read?path=${encodeURIComponent(i)}`),enabled:!!i,staleTime:5*6e4})}function dj(){const[i,t]=j.useState([]),[r,s]=j.useState([]),[l,c]=j.useState(null),m=j.useRef(l),p=j.useRef(i),g=j.useRef(r);m.current=l,p.current=i,g.current=r;const f=j.useCallback((w,S)=>{var L;const M=m.current;if(M){const z=((L=S==null?void 0:S.current)==null?void 0:L.scrollTop)??0;t([...p.current,{...M,scrollTop:z}])}s([]),c({path:w,scrollTop:0})},[]),d=j.useCallback(w=>{var z;const S=p.current;if(S.length===0)return;const M=S[S.length-1],L=m.current;if(L){const ie=((z=w==null?void 0:w.current)==null?void 0:z.scrollTop)??0;s([...g.current,{...L,scrollTop:ie}])}t(S.slice(0,-1)),c(M),requestAnimationFrame(()=>{w!=null&&w.current&&(w.current.scrollTop=M.scrollTop)})},[]),b=j.useCallback(w=>{var z;const S=g.current;if(S.length===0)return;const M=S[S.length-1],L=m.current;if(L){const ie=((z=w==null?void 0:w.current)==null?void 0:z.scrollTop)??0;t([...p.current,{...L,scrollTop:ie}])}s(S.slice(0,-1)),c(M),requestAnimationFrame(()=>{w!=null&&w.current&&(w.current.scrollTop=M.scrollTop)})},[]),v=j.useCallback(w=>{var L,z;const S=m.current;if(!S)return;const M=((L=w==null?void 0:w.current)==null?void 0:L.scrollTop)??0;t([...p.current,{...S,scrollTop:M}]),s([]),c({...S,scrollTop:((z=w==null?void 0:w.current)==null?void 0:z.scrollTop)??0})},[]),_=j.useCallback(()=>{t([]),s([]),c(null)},[]);return{current:l,backStack:i,forwardStack:r,navigate:f,goBack:d,goForward:b,pushScrollPosition:v,reset:_}}function mj(i,t){const[r,s]=i.split("#");let l=r;if(l.startsWith("./")||l.startsWith("../")){const m=((t?t.replace(/[^/]+$/,""):"")+l).split("/"),p=[];for(const g of m)g===".."?p.pop():g&&g!=="."&&p.push(g);l=p.join("/")}return{path:l,anchor:s}}function pj(i){if(!i.startsWith("#docs"))return null;const t=i.slice(1).split(":"),r=t[1]||"README.md",s=t[2]||void 0;return{path:r,anchor:s}}function gj(i){return!i||i==="README.md"?"#docs":`#docs:${i}`}function yj({content:i,currentPath:t,onNavigate:r,onAnchorClick:s}){const l=c=>{var f;const m=c.target,p=m.closest("[data-anchor]");if(p){c.preventDefault(),s();const d=p.dataset.anchor,b=(f=p.closest(".docs-content"))==null?void 0:f.querySelector(`#${CSS.escape(d)}`);b==null||b.scrollIntoView({behavior:"smooth",block:"start"});return}const g=m.closest("[data-doc-link]");if(g){c.preventDefault();const{path:d,anchor:b}=mj(g.dataset.docLink,t);r(d,b);return}};return y.jsx(Kd,{content:i,className:"docs-content",onClick:l})}function bj(i){const t=[],r=new Map;for(const s of i){const l=s.path.split("/");if(l.length===1){t.push(s);continue}let c=r;for(let m=0;m<l.length-1;m++){const p=l[m];c.has(p)||c.set(p,{label:p,children:[],subdirs:new Map});const g=c.get(p);m===l.length-2?g.children.push(s):c=g.subdirs}}return{topLevel:t,dirs:r}}function vj({docs:i,selected:t,onSelect:r}){const{topLevel:s,dirs:l}=bj(i),c=p=>`block w-full text-left px-3 py-1 text-xs rounded truncate transition-colors ${t===p?"bg-accent/10 text-accent":"text-text-secondary hover:bg-surface-hover"}`;function m(p,g){return y.jsxs("details",{open:!0,children:[y.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:[y.jsx(Ow,{className:"w-3 h-3",strokeWidth:1.5}),p.label]}),y.jsxs("div",{className:"pl-2 space-y-0.5",children:[[...p.subdirs.values()].map(f=>m(f)),p.children.map(f=>y.jsx("button",{className:c(f.path),onClick:()=>r(f.path),children:f.title},f.path))]})]},p.label)}return y.jsxs("div",{className:"space-y-0.5",children:[s.map(p=>y.jsx("button",{className:c(p.path),onClick:()=>r(p.path),children:p.title},p.path)),[...l.values()].map(p=>m(p))]})}function xj({open:i,onClose:t}){var re,K,B;const[r,s]=j.useState(!1),{data:l}=fj(),c=dj(),{data:m,isLoading:p}=hj(((re=c.current)==null?void 0:re.path)??null),g=j.useRef(null),[f,d]=j.useState(null);j.useEffect(()=>{f&&(m!=null&&m.content)&&g.current&&requestAnimationFrame(()=>{var W;const G=(W=g.current)==null?void 0:W.querySelector(`#${CSS.escape(f)}`);G==null||G.scrollIntoView({behavior:"smooth",block:"start"}),d(null)})},[f,m]);const b=j.useCallback(()=>{var Q;const G=pj(window.location.hash),W=(G==null?void 0:G.path)??"README.md";((Q=c.current)==null?void 0:Q.path)!==W&&c.navigate(W,g),G!=null&&G.anchor&&d(G.anchor)},[c]),v=j.useRef(!0);j.useEffect(()=>{if(!i||!c.current)return;if(v.current){v.current=!1;return}const G=gj(c.current.path);window.location.hash!==G&&window.history.replaceState(null,"",window.location.pathname+window.location.search+G)},[i,(K=c.current)==null?void 0:K.path]),j.useEffect(()=>{if(!i)return;const G=()=>{window.location.hash.startsWith("#docs")&&b()};return window.addEventListener("hashchange",G),()=>window.removeEventListener("hashchange",G)},[i,b]);const _=j.useCallback((G,W)=>{W&&d(W),c.navigate(G,g)},[c]),w=j.useCallback(G=>{c.navigate(G,g)},[c]),S=j.useCallback(()=>{c.goBack(g)},[c]),M=j.useCallback(()=>{c.goForward(g)},[c]),L=j.useCallback(()=>{c.pushScrollPosition(g)},[c]);if(j.useEffect(()=>{if(i){v.current=!0,b();const G=requestAnimationFrame(()=>s(!0));return()=>cancelAnimationFrame(G)}},[i]),!(i||r))return null;const ie=()=>{s(!1),setTimeout(()=>{t(),c.reset()},200)},ae=((B=c.current)==null?void 0:B.path)??null,C=c.backStack.length>0,I=c.forwardStack.length>0;return y.jsxs("div",{className:"fixed inset-y-0 right-0 z-50 flex",children:[y.jsx("div",{className:`fixed inset-0 bg-black/20 transition-opacity duration-200 ${r&&i?"opacity-100":"opacity-0"}`,onClick:ie}),y.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 ${r&&i?"translate-x-0":"translate-x-full"}`,children:[y.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border shrink-0",children:[y.jsxs("div",{className:"flex items-center gap-1",children:[y.jsx("button",{onClick:S,disabled:!C,className:`p-0.5 transition-colors ${C?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Back",children:y.jsx(ib,{className:"w-4 h-4"})}),y.jsx("button",{onClick:M,disabled:!I,className:`p-0.5 transition-colors ${I?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Forward",children:y.jsx(Yh,{className:"w-4 h-4"})}),y.jsx(ab,{className:"w-4 h-4 text-accent ml-1",strokeWidth:1.5}),y.jsx("span",{className:"text-sm font-medium text-text-primary",children:"Documentation"})]}),y.jsx("button",{onClick:ie,className:"p-1 text-text-tertiary hover:text-text-primary",children:y.jsx(Cn,{className:"w-4 h-4"})})]}),y.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[y.jsx("div",{className:"w-48 shrink-0 border-r border-surface-border overflow-y-auto py-2",children:l!=null&&l.docs?y.jsx(vj,{docs:l.docs,selected:ae,onSelect:w}):y.jsx("div",{className:"px-3 py-2 text-xs text-text-tertiary",children:"Loading..."})}),y.jsx("div",{ref:g,className:"flex-1 overflow-y-auto px-6 py-4",children:ae?p?y.jsxs("div",{className:"animate-pulse space-y-2",children:[y.jsx("div",{className:"h-6 bg-surface-sunken rounded w-48"}),y.jsx("div",{className:"h-4 bg-surface-sunken rounded w-full"}),y.jsx("div",{className:"h-4 bg-surface-sunken rounded w-3/4"})]}):m!=null&&m.content?y.jsx(yj,{content:m.content,currentPath:ae,onNavigate:_,onAnchorClick:L}):y.jsx("p",{className:"text-xs text-text-tertiary",children:"Document not found."}):y.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-text-tertiary",children:[y.jsx(Yh,{className:"w-5 h-5 mb-2"}),y.jsx("p",{className:"text-xs",children:"Select a document"})]})})]})]})]})}function _j(i){if(i.includes("/escalations"))return["escalation","human-queue"]}const U1=2e3;function wj(i){const r=i.filter(l=>!l.pending).slice(-8);return r.length===0?"":`[Prior conversation]
59
+ ${r.map(l=>`${l.role==="user"?"User":"Assistant"}: ${l.content}`).join(`
60
+ `)}
61
+ [End prior conversation]
62
+
63
+ `}function Sj(i){const t=i.summary,r=i.title;if(t){const s=t.search(/\n\s*\{[\s\S]*"title"\s*:/);return s>0?t.slice(0,s).trim():t}return r||(typeof i=="string"?i:"Query completed.")}const Nv=j.createContext(null);function Ej({children:i}){const t=mn(),[r,s]=j.useState(!1),[l,c]=j.useState([]),[m,p]=j.useState(null),[g,f]=j.useState({}),d=j.useRef(null),b={page:t.pathname.split("/").filter(Boolean).join("-")||"home",route:t.pathname,params:{},...g,suggestedTags:g.suggestedTags??_j(t.pathname)};j.useEffect(()=>()=>{d.current&&clearInterval(d.current)},[]);const v=j.useCallback(()=>s(L=>!L),[]),_=j.useCallback(L=>{f(L)},[]),w=j.useCallback(()=>{c([]),p(null)},[]),S=j.useCallback(async L=>{var K;const z=new Date().toISOString(),ie={id:`user-${Date.now()}`,role:"user",content:L,timestamp:z},ae={id:`pending-${Date.now()}`,role:"assistant",content:"",timestamp:z,pending:!0};c(B=>[...B,ie,ae]);const C={...b};(K=C.entities)!=null&&K.yamlContent&&C.entities.yamlContent.length>U1&&(C.entities={...C.entities,yamlContent:C.entities.yamlContent.slice(0,U1)+`
64
+ ... (truncated)`});const re=`${wj(l.concat(ie))}${L}`;try{const G=(await Ae("/insight/mcp-query",{method:"POST",body:JSON.stringify({prompt:re,tags:C.suggestedTags,context:C,wait:!1,direct:!0})})).workflow_id;p(G),c(W=>W.map(Q=>Q.id===ae.id?{...Q,workflowId:G}:Q)),d.current&&clearInterval(d.current),d.current=setInterval(async()=>{var W;try{const Q=await Ae(`/workflows/${G}/result`),he=(W=Q==null?void 0:Q.result)==null?void 0:W.data;if(he){d.current&&clearInterval(d.current),d.current=null,p(null);const _e=Sj(he);let Te;try{Te=(await Ae(`/workflow-states/${G}/execution`)).duration_ms}catch{}c(Y=>Y.map(oe=>oe.id===ae.id?{...oe,content:_e,timestamp:new Date().toISOString(),pending:!1,durationMs:Te}:oe))}}catch{}},3e3)}catch{c(B=>B.map(G=>G.id===ae.id?{...G,content:"Failed to submit query. Please try again.",pending:!1}:G))}},[l,b]),M=j.useCallback(async L=>{const z=l.find(C=>C.id===L);if(!(z!=null&&z.workflowId)||z.compilationStatus==="compiling"||z.compilationStatus==="done")return;const ie=l.indexOf(z),ae=l.slice(0,ie).reverse().find(C=>C.role==="user");if(ae){c(C=>C.map(I=>I.id===L?{...I,compilationStatus:"compiling"}:I));try{const C=await Ae("/insight/mcp-query/describe",{method:"POST",body:JSON.stringify({prompt:ae.content,summary:z.content})}),I=await Ae("/yaml-workflows",{method:"POST",body:JSON.stringify({workflow_id:z.workflowId,task_queue:"long-tail-system",workflow_name:"mcpQuery",name:C.tool_name,description:C.description,tags:C.tags,app_id:""})});await Ae(`/yaml-workflows/${I.id}/deploy`,{method:"POST"}),c(re=>re.map(K=>K.id===L?{...K,compilationStatus:"done"}:K))}catch(C){const I=C instanceof Error?C.message:"Compilation failed";c(re=>re.map(K=>K.id===L?{...K,compilationStatus:"error",compilationError:I}:K))}}},[l]);return y.jsx(Nv.Provider,{value:{helpOpen:r,setHelpOpen:s,toggleHelp:v,messages:l,sendMessage:S,pageContext:b,setPageContext:_,activeWorkflowId:m,clearMessages:w,compileMessage:M},children:i})}function kv(){const i=j.useContext(Nv);if(!i)throw new Error("useHelpAssistant must be used within HelpAssistantProvider");return i}function Oj(){const{helpOpen:i,toggleHelp:t}=kv();return y.jsx("button",{onClick:t,className:"fixed right-3 z-[45] flex items-center justify-center w-10 h-10 rounded-full bg-surface-raised shadow-lg hover:scale-110 transition-transform duration-150 border border-accent/30",style:{bottom:"44px"},"aria-label":i?"Close help":"Ask for help",children:i?y.jsx(Cn,{className:"w-5 h-5 text-text-tertiary",strokeWidth:1.5}):y.jsx("span",{role:"img","aria-label":"Help",className:"logo-mark w-8 h-8 -rotate-[120deg]",style:{"--logo-url":`url(${Mt}/logo512.png)`}})})}const Cv=6048e5,Aj=864e5,P1=6e4,I1=525600,$1=43200,H1=1440,G1=Symbol.for("constructDateFrom");function Er(i,t){return typeof i=="function"?i(t):i&&typeof i=="object"&&G1 in i?i[G1](t):i instanceof Date?new i.constructor(t):new Date(t)}function dn(i,t){return Er(t||i,i)}let jj={};function So(){return jj}function po(i,t){var p,g,f,d;const r=So(),s=(t==null?void 0:t.weekStartsOn)??((g=(p=t==null?void 0:t.locale)==null?void 0:p.options)==null?void 0:g.weekStartsOn)??r.weekStartsOn??((d=(f=r.locale)==null?void 0:f.options)==null?void 0:d.weekStartsOn)??0,l=dn(i,t==null?void 0:t.in),c=l.getDay(),m=(c<s?7:0)+c-s;return l.setDate(l.getDate()-m),l.setHours(0,0,0,0),l}function su(i,t){return po(i,{...t,weekStartsOn:1})}function Mv(i,t){const r=dn(i,t==null?void 0:t.in),s=r.getFullYear(),l=Er(r,0);l.setFullYear(s+1,0,4),l.setHours(0,0,0,0);const c=su(l),m=Er(r,0);m.setFullYear(s,0,4),m.setHours(0,0,0,0);const p=su(m);return r.getTime()>=c.getTime()?s+1:r.getTime()>=p.getTime()?s:s-1}function au(i){const t=dn(i),r=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return r.setUTCFullYear(t.getFullYear()),+i-+r}function Rv(i,...t){const r=Er.bind(null,i||t.find(s=>typeof s=="object"));return t.map(r)}function F1(i,t){const r=dn(i,t==null?void 0:t.in);return r.setHours(0,0,0,0),r}function Tj(i,t,r){const[s,l]=Rv(r==null?void 0:r.in,i,t),c=F1(s),m=F1(l),p=+c-au(c),g=+m-au(m);return Math.round((p-g)/Aj)}function Nj(i,t){const r=Mv(i,t),s=Er(i,0);return s.setFullYear(r,0,4),s.setHours(0,0,0,0),su(s)}function kj(i,t){const r=+dn(i)-+dn(t);return r<0?-1:r>0?1:r}function Cj(i){return Er(i,Date.now())}function Mj(i){return i instanceof Date||typeof i=="object"&&Object.prototype.toString.call(i)==="[object Date]"}function Rj(i){return!(!Mj(i)&&typeof i!="number"||isNaN(+dn(i)))}function Dj(i){return t=>{const s=(i?Math[i]:Math.trunc)(t);return s===0?0:s}}function qj(i,t){const r=dn(i,t==null?void 0:t.in);return r.setFullYear(r.getFullYear(),0,1),r.setHours(0,0,0,0),r}const Bj={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"}},Lj=(i,t,r)=>{let s;const l=Bj[i];return typeof l=="string"?s=l:t===1?s=l.one:s=l.other.replace("{{count}}",t.toString()),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"in "+s:s+" ago":s};function Vh(i){return(t={})=>{const r=t.width?String(t.width):i.defaultWidth;return i.formats[r]||i.formats[i.defaultWidth]}}const zj={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Uj={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Pj={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Ij={date:Vh({formats:zj,defaultWidth:"full"}),time:Vh({formats:Uj,defaultWidth:"full"}),dateTime:Vh({formats:Pj,defaultWidth:"full"})},$j={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Hj=(i,t,r,s)=>$j[i];function eo(i){return(t,r)=>{const s=r!=null&&r.context?String(r.context):"standalone";let l;if(s==="formatting"&&i.formattingValues){const m=i.defaultFormattingWidth||i.defaultWidth,p=r!=null&&r.width?String(r.width):m;l=i.formattingValues[p]||i.formattingValues[m]}else{const m=i.defaultWidth,p=r!=null&&r.width?String(r.width):i.defaultWidth;l=i.values[p]||i.values[m]}const c=i.argumentCallback?i.argumentCallback(t):t;return l[c]}}const Gj={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Fj={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Vj={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"]},Yj={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"]},Xj={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"}},Kj={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"}},Jj=(i,t)=>{const r=Number(i),s=r%100;if(s>20||s<10)switch(s%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},Qj={ordinalNumber:Jj,era:eo({values:Gj,defaultWidth:"wide"}),quarter:eo({values:Fj,defaultWidth:"wide",argumentCallback:i=>i-1}),month:eo({values:Vj,defaultWidth:"wide"}),day:eo({values:Yj,defaultWidth:"wide"}),dayPeriod:eo({values:Xj,defaultWidth:"wide",formattingValues:Kj,defaultFormattingWidth:"wide"})};function to(i){return(t,r={})=>{const s=r.width,l=s&&i.matchPatterns[s]||i.matchPatterns[i.defaultMatchWidth],c=t.match(l);if(!c)return null;const m=c[0],p=s&&i.parsePatterns[s]||i.parsePatterns[i.defaultParseWidth],g=Array.isArray(p)?Wj(p,b=>b.test(m)):Zj(p,b=>b.test(m));let f;f=i.valueCallback?i.valueCallback(g):g,f=r.valueCallback?r.valueCallback(f):f;const d=t.slice(m.length);return{value:f,rest:d}}}function Zj(i,t){for(const r in i)if(Object.prototype.hasOwnProperty.call(i,r)&&t(i[r]))return r}function Wj(i,t){for(let r=0;r<i.length;r++)if(t(i[r]))return r}function eT(i){return(t,r={})=>{const s=t.match(i.matchPattern);if(!s)return null;const l=s[0],c=t.match(i.parsePattern);if(!c)return null;let m=i.valueCallback?i.valueCallback(c[0]):c[0];m=r.valueCallback?r.valueCallback(m):m;const p=t.slice(l.length);return{value:m,rest:p}}}const tT=/^(\d+)(th|st|nd|rd)?/i,nT=/\d+/i,rT={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},iT={any:[/^b/i,/^(a|c)/i]},sT={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},aT={any:[/1/i,/2/i,/3/i,/4/i]},oT={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},lT={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]},cT={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},uT={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]},fT={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},hT={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}},dT={ordinalNumber:eT({matchPattern:tT,parsePattern:nT,valueCallback:i=>parseInt(i,10)}),era:to({matchPatterns:rT,defaultMatchWidth:"wide",parsePatterns:iT,defaultParseWidth:"any"}),quarter:to({matchPatterns:sT,defaultMatchWidth:"wide",parsePatterns:aT,defaultParseWidth:"any",valueCallback:i=>i+1}),month:to({matchPatterns:oT,defaultMatchWidth:"wide",parsePatterns:lT,defaultParseWidth:"any"}),day:to({matchPatterns:cT,defaultMatchWidth:"wide",parsePatterns:uT,defaultParseWidth:"any"}),dayPeriod:to({matchPatterns:fT,defaultMatchWidth:"any",parsePatterns:hT,defaultParseWidth:"any"})},Dv={code:"en-US",formatDistance:Lj,formatLong:Ij,formatRelative:Hj,localize:Qj,match:dT,options:{weekStartsOn:0,firstWeekContainsDate:1}};function mT(i,t){const r=dn(i,t==null?void 0:t.in);return Tj(r,qj(r))+1}function pT(i,t){const r=dn(i,t==null?void 0:t.in),s=+su(r)-+Nj(r);return Math.round(s/Cv)+1}function qv(i,t){var d,b,v,_;const r=dn(i,t==null?void 0:t.in),s=r.getFullYear(),l=So(),c=(t==null?void 0:t.firstWeekContainsDate)??((b=(d=t==null?void 0:t.locale)==null?void 0:d.options)==null?void 0:b.firstWeekContainsDate)??l.firstWeekContainsDate??((_=(v=l.locale)==null?void 0:v.options)==null?void 0:_.firstWeekContainsDate)??1,m=Er((t==null?void 0:t.in)||i,0);m.setFullYear(s+1,0,c),m.setHours(0,0,0,0);const p=po(m,t),g=Er((t==null?void 0:t.in)||i,0);g.setFullYear(s,0,c),g.setHours(0,0,0,0);const f=po(g,t);return+r>=+p?s+1:+r>=+f?s:s-1}function gT(i,t){var p,g,f,d;const r=So(),s=(t==null?void 0:t.firstWeekContainsDate)??((g=(p=t==null?void 0:t.locale)==null?void 0:p.options)==null?void 0:g.firstWeekContainsDate)??r.firstWeekContainsDate??((d=(f=r.locale)==null?void 0:f.options)==null?void 0:d.firstWeekContainsDate)??1,l=qv(i,t),c=Er((t==null?void 0:t.in)||i,0);return c.setFullYear(l,0,s),c.setHours(0,0,0,0),po(c,t)}function yT(i,t){const r=dn(i,t==null?void 0:t.in),s=+po(r,t)-+gT(r,t);return Math.round(s/Cv)+1}function Ye(i,t){const r=i<0?"-":"",s=Math.abs(i).toString().padStart(t,"0");return r+s}const ii={y(i,t){const r=i.getFullYear(),s=r>0?r:1-r;return Ye(t==="yy"?s%100:s,t.length)},M(i,t){const r=i.getMonth();return t==="M"?String(r+1):Ye(r+1,2)},d(i,t){return Ye(i.getDate(),t.length)},a(i,t){const r=i.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];case"aaaa":default:return r==="am"?"a.m.":"p.m."}},h(i,t){return Ye(i.getHours()%12||12,t.length)},H(i,t){return Ye(i.getHours(),t.length)},m(i,t){return Ye(i.getMinutes(),t.length)},s(i,t){return Ye(i.getSeconds(),t.length)},S(i,t){const r=t.length,s=i.getMilliseconds(),l=Math.trunc(s*Math.pow(10,r-3));return Ye(l,t.length)}},qs={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},V1={G:function(i,t,r){const s=i.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return r.era(s,{width:"abbreviated"});case"GGGGG":return r.era(s,{width:"narrow"});case"GGGG":default:return r.era(s,{width:"wide"})}},y:function(i,t,r){if(t==="yo"){const s=i.getFullYear(),l=s>0?s:1-s;return r.ordinalNumber(l,{unit:"year"})}return ii.y(i,t)},Y:function(i,t,r,s){const l=qv(i,s),c=l>0?l:1-l;if(t==="YY"){const m=c%100;return Ye(m,2)}return t==="Yo"?r.ordinalNumber(c,{unit:"year"}):Ye(c,t.length)},R:function(i,t){const r=Mv(i);return Ye(r,t.length)},u:function(i,t){const r=i.getFullYear();return Ye(r,t.length)},Q:function(i,t,r){const s=Math.ceil((i.getMonth()+1)/3);switch(t){case"Q":return String(s);case"QQ":return Ye(s,2);case"Qo":return r.ordinalNumber(s,{unit:"quarter"});case"QQQ":return r.quarter(s,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(s,{width:"narrow",context:"formatting"});case"QQQQ":default:return r.quarter(s,{width:"wide",context:"formatting"})}},q:function(i,t,r){const s=Math.ceil((i.getMonth()+1)/3);switch(t){case"q":return String(s);case"qq":return Ye(s,2);case"qo":return r.ordinalNumber(s,{unit:"quarter"});case"qqq":return r.quarter(s,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(s,{width:"narrow",context:"standalone"});case"qqqq":default:return r.quarter(s,{width:"wide",context:"standalone"})}},M:function(i,t,r){const s=i.getMonth();switch(t){case"M":case"MM":return ii.M(i,t);case"Mo":return r.ordinalNumber(s+1,{unit:"month"});case"MMM":return r.month(s,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(s,{width:"narrow",context:"formatting"});case"MMMM":default:return r.month(s,{width:"wide",context:"formatting"})}},L:function(i,t,r){const s=i.getMonth();switch(t){case"L":return String(s+1);case"LL":return Ye(s+1,2);case"Lo":return r.ordinalNumber(s+1,{unit:"month"});case"LLL":return r.month(s,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(s,{width:"narrow",context:"standalone"});case"LLLL":default:return r.month(s,{width:"wide",context:"standalone"})}},w:function(i,t,r,s){const l=yT(i,s);return t==="wo"?r.ordinalNumber(l,{unit:"week"}):Ye(l,t.length)},I:function(i,t,r){const s=pT(i);return t==="Io"?r.ordinalNumber(s,{unit:"week"}):Ye(s,t.length)},d:function(i,t,r){return t==="do"?r.ordinalNumber(i.getDate(),{unit:"date"}):ii.d(i,t)},D:function(i,t,r){const s=mT(i);return t==="Do"?r.ordinalNumber(s,{unit:"dayOfYear"}):Ye(s,t.length)},E:function(i,t,r){const s=i.getDay();switch(t){case"E":case"EE":case"EEE":return r.day(s,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(s,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(s,{width:"short",context:"formatting"});case"EEEE":default:return r.day(s,{width:"wide",context:"formatting"})}},e:function(i,t,r,s){const l=i.getDay(),c=(l-s.weekStartsOn+8)%7||7;switch(t){case"e":return String(c);case"ee":return Ye(c,2);case"eo":return r.ordinalNumber(c,{unit:"day"});case"eee":return r.day(l,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(l,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(l,{width:"short",context:"formatting"});case"eeee":default:return r.day(l,{width:"wide",context:"formatting"})}},c:function(i,t,r,s){const l=i.getDay(),c=(l-s.weekStartsOn+8)%7||7;switch(t){case"c":return String(c);case"cc":return Ye(c,t.length);case"co":return r.ordinalNumber(c,{unit:"day"});case"ccc":return r.day(l,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(l,{width:"narrow",context:"standalone"});case"cccccc":return r.day(l,{width:"short",context:"standalone"});case"cccc":default:return r.day(l,{width:"wide",context:"standalone"})}},i:function(i,t,r){const s=i.getDay(),l=s===0?7:s;switch(t){case"i":return String(l);case"ii":return Ye(l,t.length);case"io":return r.ordinalNumber(l,{unit:"day"});case"iii":return r.day(s,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(s,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(s,{width:"short",context:"formatting"});case"iiii":default:return r.day(s,{width:"wide",context:"formatting"})}},a:function(i,t,r){const l=i.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.dayPeriod(l,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(l,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(l,{width:"narrow",context:"formatting"});case"aaaa":default:return r.dayPeriod(l,{width:"wide",context:"formatting"})}},b:function(i,t,r){const s=i.getHours();let l;switch(s===12?l=qs.noon:s===0?l=qs.midnight:l=s/12>=1?"pm":"am",t){case"b":case"bb":return r.dayPeriod(l,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(l,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(l,{width:"narrow",context:"formatting"});case"bbbb":default:return r.dayPeriod(l,{width:"wide",context:"formatting"})}},B:function(i,t,r){const s=i.getHours();let l;switch(s>=17?l=qs.evening:s>=12?l=qs.afternoon:s>=4?l=qs.morning:l=qs.night,t){case"B":case"BB":case"BBB":return r.dayPeriod(l,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(l,{width:"narrow",context:"formatting"});case"BBBB":default:return r.dayPeriod(l,{width:"wide",context:"formatting"})}},h:function(i,t,r){if(t==="ho"){let s=i.getHours()%12;return s===0&&(s=12),r.ordinalNumber(s,{unit:"hour"})}return ii.h(i,t)},H:function(i,t,r){return t==="Ho"?r.ordinalNumber(i.getHours(),{unit:"hour"}):ii.H(i,t)},K:function(i,t,r){const s=i.getHours()%12;return t==="Ko"?r.ordinalNumber(s,{unit:"hour"}):Ye(s,t.length)},k:function(i,t,r){let s=i.getHours();return s===0&&(s=24),t==="ko"?r.ordinalNumber(s,{unit:"hour"}):Ye(s,t.length)},m:function(i,t,r){return t==="mo"?r.ordinalNumber(i.getMinutes(),{unit:"minute"}):ii.m(i,t)},s:function(i,t,r){return t==="so"?r.ordinalNumber(i.getSeconds(),{unit:"second"}):ii.s(i,t)},S:function(i,t){return ii.S(i,t)},X:function(i,t,r){const s=i.getTimezoneOffset();if(s===0)return"Z";switch(t){case"X":return X1(s);case"XXXX":case"XX":return Pi(s);case"XXXXX":case"XXX":default:return Pi(s,":")}},x:function(i,t,r){const s=i.getTimezoneOffset();switch(t){case"x":return X1(s);case"xxxx":case"xx":return Pi(s);case"xxxxx":case"xxx":default:return Pi(s,":")}},O:function(i,t,r){const s=i.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Y1(s,":");case"OOOO":default:return"GMT"+Pi(s,":")}},z:function(i,t,r){const s=i.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Y1(s,":");case"zzzz":default:return"GMT"+Pi(s,":")}},t:function(i,t,r){const s=Math.trunc(+i/1e3);return Ye(s,t.length)},T:function(i,t,r){return Ye(+i,t.length)}};function Y1(i,t=""){const r=i>0?"-":"+",s=Math.abs(i),l=Math.trunc(s/60),c=s%60;return c===0?r+String(l):r+String(l)+t+Ye(c,2)}function X1(i,t){return i%60===0?(i>0?"-":"+")+Ye(Math.abs(i)/60,2):Pi(i,t)}function Pi(i,t=""){const r=i>0?"-":"+",s=Math.abs(i),l=Ye(Math.trunc(s/60),2),c=Ye(s%60,2);return r+l+t+c}const K1=(i,t)=>{switch(i){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},Bv=(i,t)=>{switch(i){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},bT=(i,t)=>{const r=i.match(/(P+)(p+)?/)||[],s=r[1],l=r[2];if(!l)return K1(i,t);let c;switch(s){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}}",K1(s,t)).replace("{{time}}",Bv(l,t))},vT={p:Bv,P:bT},xT=/^D+$/,_T=/^Y+$/,wT=["D","DD","YY","YYYY"];function ST(i){return xT.test(i)}function ET(i){return _T.test(i)}function OT(i,t,r){const s=AT(i,t,r);if(console.warn(s),wT.includes(i))throw new RangeError(s)}function AT(i,t,r){const s=i[0]==="Y"?"years":"days of the month";return`Use \`${i.toLowerCase()}\` instead of \`${i}\` (in \`${t}\`) for formatting ${s} to the input \`${r}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const jT=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,TT=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,NT=/^'([^]*?)'?$/,kT=/''/g,CT=/[a-zA-Z]/;function Jd(i,t,r){var d,b,v,_;const s=So(),l=s.locale??Dv,c=s.firstWeekContainsDate??((b=(d=s.locale)==null?void 0:d.options)==null?void 0:b.firstWeekContainsDate)??1,m=s.weekStartsOn??((_=(v=s.locale)==null?void 0:v.options)==null?void 0:_.weekStartsOn)??0,p=dn(i,r==null?void 0:r.in);if(!Rj(p))throw new RangeError("Invalid time value");let g=t.match(TT).map(w=>{const S=w[0];if(S==="p"||S==="P"){const M=vT[S];return M(w,l.formatLong)}return w}).join("").match(jT).map(w=>{if(w==="''")return{isToken:!1,value:"'"};const S=w[0];if(S==="'")return{isToken:!1,value:MT(w)};if(V1[S])return{isToken:!0,value:w};if(S.match(CT))throw new RangeError("Format string contains an unescaped latin alphabet character `"+S+"`");return{isToken:!1,value:w}});l.localize.preprocessor&&(g=l.localize.preprocessor(p,g));const f={firstWeekContainsDate:c,weekStartsOn:m,locale:l};return g.map(w=>{if(!w.isToken)return w.value;const S=w.value;(ET(S)||ST(S))&&OT(S,t,String(i));const M=V1[S[0]];return M(p,S,l.localize,f)}).join("")}function MT(i){const t=i.match(NT);return t?t[1].replace(kT,"'"):i}function RT(i,t,r){const s=So(),l=(r==null?void 0:r.locale)??s.locale??Dv,c=kj(i,t);if(isNaN(c))throw new RangeError("Invalid time value");const m=Object.assign({},r,{addSuffix:r==null?void 0:r.addSuffix,comparison:c}),[p,g]=Rv(r==null?void 0:r.in,...c>0?[t,i]:[i,t]),f=Dj((r==null?void 0:r.roundingMethod)??"round"),d=g.getTime()-p.getTime(),b=d/P1,v=au(g)-au(p),_=(d-v)/P1,w=r==null?void 0:r.unit;let S;if(w?S=w:b<1?S="second":b<60?S="minute":b<H1?S="hour":_<$1?S="day":_<I1?S="month":S="year",S==="second"){const M=f(d/1e3);return l.formatDistance("xSeconds",M,m)}else if(S==="minute"){const M=f(b);return l.formatDistance("xMinutes",M,m)}else if(S==="hour"){const M=f(b/60);return l.formatDistance("xHours",M,m)}else if(S==="day"){const M=f(_/H1);return l.formatDistance("xDays",M,m)}else if(S==="month"){const M=f(_/$1);return M===12&&w!=="month"?l.formatDistance("xYears",1,m):l.formatDistance("xMonths",M,m)}else{const M=f(_/I1);return l.formatDistance("xYears",M,m)}}function DT(i,t){return RT(i,Cj(i),t)}function G3(i){return i.toLocaleString()}function F3(i){return i>=1e9?`${(i/1e9).toFixed(1).replace(/\.0$/,"")}B`:i>=1e6?`${(i/1e6).toFixed(1).replace(/\.0$/,"")}M`:i>=1e4?`${(i/1e3).toFixed(1).replace(/\.0$/,"")}K`:i.toLocaleString()}function qT(i){const t=new Date(i);return t.getTime()>Date.now()?"just now":DT(t,{addSuffix:!0})}function V3(i){const t=Date.now()-new Date(i).getTime();if(t<0)return"now";const r=Math.floor(t/1e3);if(r<60)return`${r}s`;const s=Math.floor(r/60);if(s<60)return`${s}m`;const l=Math.floor(s/60);if(l<24)return`${l}h`;const c=Math.floor(l/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 Y3(i){return i<=0?"Expired":Qd(i)}function BT(i){return i==null?"--":Qd(i)}function X3(i){return i?Jd(new Date(i),"MMM d, yyyy h:mm a"):"--"}function Qd(i){if(i<1e3)return`${Math.round(i)}ms`;if(i<6e4){const m=i/1e3;return Number.isInteger(m)?`${m}s`:`${m.toFixed(1)}s`}const t=Math.floor(i/1e3),r=Math.floor(t/86400),s=Math.floor(t%86400/3600),l=Math.floor(t%3600/60),c=t%60;return r>0?s>0?`${r}d ${s}h`:`${r}d`:s>0?l>0?`${s}h ${l}m`:`${s}h`:c>0?`${l}m ${c}s`:`${l}m`}function K3(i,t){const r=new Date(i).getTime(),s=t?new Date(t).getTime():Date.now();return Qd(s-r)}function Lv({options:i,children:t,className:r=""}){const[s,l]=j.useState(!1),[c,m]=j.useState(null),[p,g]=j.useState(null),f=j.useRef(null),d=j.useRef(void 0),b=j.useRef(void 0),v=220,_=j.useCallback(()=>{if(!f.current)return;const L=f.current.getBoundingClientRect(),z=window.innerWidth-v-8,ie=Math.max(8,Math.min(L.left,z));g({top:L.bottom+4,left:ie})},[]),w=j.useCallback(async(L,z)=>{try{await navigator.clipboard.writeText(L),m(z),clearTimeout(d.current),d.current=setTimeout(()=>m(null),1200)}catch{}},[]),S=j.useCallback(()=>{clearTimeout(b.current),_(),l(!0)},[_]),M=j.useCallback(()=>{b.current=setTimeout(()=>l(!1),150)},[]);return j.useEffect(()=>()=>{clearTimeout(d.current),clearTimeout(b.current)},[]),y.jsxs("span",{ref:f,className:`inline-flex items-center cursor-default ${r}`,onMouseEnter:S,onMouseLeave:M,children:[t,s&&p&&rb.createPortal(y.jsx("span",{className:"fixed z-[9999] bg-surface-raised border border-surface-border rounded shadow-lg py-1 min-w-[180px]",style:{top:p.top,left:p.left},onMouseEnter:S,onMouseLeave:M,children:i.map(L=>y.jsxs("button",{onClick:z=>{z.stopPropagation(),w(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:[y.jsx("span",{className:"text-2xs font-medium uppercase tracking-wider text-text-tertiary w-10 shrink-0",children:L.label}),y.jsx("span",{className:"text-2xs font-mono text-text-secondary truncate ml-2",children:c===L.label?"✓":L.value})]},L.label))}),document.body)]})}function LT(i,t){const r=new Date(i);switch(t){case"relative":return qT(i);case"datetime":return Jd(r,"MMM d, yyyy h:mm a");case"time":return r.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}}function zT(i){const t=new Date(i);return[{label:"ms",value:String(t.getTime())},{label:"utc",value:t.toISOString()},{label:"local",value:Jd(t,"MMM d, yyyy h:mm:ss a")}]}function UT({date:i,format:t="relative",className:r=""}){const[,s]=j.useState(0);j.useEffect(()=>{if(t!=="relative")return;const c=setInterval(()=>s(m=>m+1),3e4);return()=>clearInterval(c)},[t]);const l=j.useMemo(()=>zT(i),[i]);return y.jsx(Lv,{options:l,children:y.jsx("time",{dateTime:i,className:`text-xs text-text-tertiary ${r}`,children:LT(i,t)})})}function PT({ms:i,className:t=""}){const r=BT(i),s=j.useMemo(()=>i==null?[]:[{label:"ms",value:String(i)},{label:"sec",value:`${(i/1e3).toFixed(3)}s`},{label:"text",value:r}],[i,r]);return i==null?y.jsx("span",{className:`text-xs text-text-tertiary ${t}`,children:"--"}):y.jsx(Lv,{options:s,children:y.jsx("span",{className:`text-xs text-text-tertiary ${t}`,children:r})})}const IT=["sm","md","lg","full"],J1={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"},Q1={sm:"Small",md:"Medium",lg:"Large",full:"Fullscreen"};function $T({which:i}){const t="stroke-current";switch(i){case"sm":return y.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:y.jsx("rect",{x:"5",y:"5",width:"7",height:"7",rx:"1.5",className:t,strokeWidth:"1.5"})});case"md":return y.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:y.jsx("rect",{x:"3",y:"3",width:"9",height:"9",rx:"1.5",className:t,strokeWidth:"1.5"})});case"lg":return y.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:y.jsx("rect",{x:"1.5",y:"1.5",width:"11",height:"11",rx:"1.5",className:t,strokeWidth:"1.5"})});case"full":return y.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:y.jsx("rect",{x:"0.75",y:"0.75",width:"12.5",height:"12.5",rx:"1.5",className:t,strokeWidth:"1.5"})})}}function HT({msg:i}){const[t,r]=j.useState(0);j.useEffect(()=>{const m=new Date(i.timestamp).getTime(),p=()=>r(Math.floor((Date.now()-m)/1e3));p();const g=setInterval(p,1e3);return()=>clearInterval(g)},[i.timestamp]);const s=Math.floor(t/60),l=t%60,c=s>0?`${s}m ${l}s`:`${l}s`;return y.jsxs("span",{className:"inline-flex flex-col gap-1.5",children:[y.jsxs("span",{className:"inline-flex items-center gap-1",children:[y.jsx("span",{className:"text-text-tertiary",children:"Thinking"}),y.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse"}),y.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse [animation-delay:150ms]"}),y.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse [animation-delay:300ms]"}),y.jsx("span",{className:"text-text-muted ml-1 tabular-nums",children:c})]}),i.workflowId&&y.jsxs(Ii,{to:`/workflows/executions/${i.workflowId}`,className:"inline-flex items-center gap-1 text-2xs text-accent/70 hover:text-accent transition-colors",children:[y.jsx(wd,{className:"w-2.5 h-2.5",strokeWidth:1.5}),"watch execution"]})]})}function GT({msg:i,compileMessage:t}){const r=i.role==="assistant";return y.jsxs("div",{className:`flex items-center gap-1.5 ${r?"justify-start":"justify-end"}`,children:[y.jsx(UT,{date:i.timestamp,format:"time",className:"!text-2xs text-text-muted/50"}),i.durationMs!=null&&y.jsxs(y.Fragment,{children:[y.jsx("span",{className:"text-text-muted/30 text-2xs",children:"·"}),y.jsx(PT,{ms:i.durationMs,className:"!text-2xs text-text-muted/50"})]}),i.workflowId&&y.jsx(Ii,{to:`/workflows/executions/${i.workflowId}`,className:"text-text-muted/40 hover:text-accent transition-colors",title:"View workflow execution",children:y.jsx(wd,{className:"w-2.5 h-2.5",strokeWidth:1.5})}),r&&i.workflowId&&!i.pending&&y.jsx("button",{onClick:()=>t(i.id),disabled:i.compilationStatus==="compiling"||i.compilationStatus==="done",className:"transition-colors",title:i.compilationStatus==="done"?"Compiled — future queries will match this pipeline":i.compilationStatus==="error"?i.compilationError??"Compilation failed":i.compilationStatus==="compiling"?"Compiling...":"Compile to fast pipeline",children:y.jsx(Aw,{className:`w-2.5 h-2.5 ${i.compilationStatus==="done"?"text-status-success":i.compilationStatus==="error"?"text-status-error":i.compilationStatus==="compiling"?"text-accent/40 animate-pulse":"text-text-muted/40 hover:text-accent"}`,strokeWidth:1.5})})]})}function FT(){const{helpOpen:i,setHelpOpen:t,messages:r,sendMessage:s,pageContext:l,activeWorkflowId:c,clearMessages:m,compileMessage:p}=kv(),[g,f]=j.useState(""),[d,b]=j.useState("md"),[v,_]=j.useState(!0),w=j.useRef(null),S=j.useRef(null);if(j.useEffect(()=>{w.current&&(w.current.scrollTop=w.current.scrollHeight)},[r]),j.useEffect(()=>{i&&S.current&&S.current.focus()},[i]),j.useEffect(()=>{if(!i)return;const C=I=>{I.key==="Escape"&&(d==="full"?b("lg"):d==="lg"?b("md"):d==="md"?b("sm"):t(!1))};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[i,d,t]),!i)return null;const M=()=>{const C=g.trim();!C||c||(s(C),f(""),S.current&&(S.current.style.height="auto"))},L=C=>{C.key==="Enter"&&!C.shiftKey&&(C.preventDefault(),M())},z=d==="full",ie=l.page.replace(/-/g," "),ae=z?{}:{bottom:"108px"};return y.jsxs("div",{className:`fixed z-[45] flex flex-col border border-surface-border rounded-lg overflow-hidden transition-all duration-300 ${z?J1.full:`right-6 ${J1[d]}`} ${v?"bg-surface-raised shadow-xl":"bg-surface-raised/[0.03] shadow-lg shadow-black/5"}`,style:ae,onMouseEnter:()=>_(!0),onMouseLeave:()=>_(!1),children:[y.jsxs("div",{className:`flex items-center justify-between px-4 py-2.5 border-b border-surface-border shrink-0 transition-all duration-300 ${v?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[y.jsxs("div",{className:"min-w-0 flex-1",children:[y.jsx("p",{className:"text-xs font-medium text-text-primary truncate",children:"Help Assistant"}),y.jsx("p",{className:"text-2xs text-text-tertiary truncate",children:ie})]}),y.jsxs("div",{className:"flex items-center gap-1 ml-2",children:[y.jsx("div",{className:"flex items-center gap-0.5 border border-surface-border rounded p-0.5",role:"radiogroup","aria-label":"Panel size",children:IT.map(C=>y.jsx("button",{onClick:()=>b(C),className:`p-1 rounded transition-colors ${C===d?"bg-accent/15 text-accent":"text-text-muted hover:text-text-secondary hover:bg-surface-hover"}`,role:"radio","aria-checked":C===d,"aria-label":Q1[C],title:Q1[C],children:y.jsx($T,{which:C})},C))}),r.length>0&&y.jsx("button",{onClick:m,className:"p-1 text-text-tertiary hover:text-text-secondary transition-colors","aria-label":"Clear conversation",title:"Clear conversation",children:y.jsx(jw,{className:"w-3.5 h-3.5",strokeWidth:1.5})}),y.jsx("button",{onClick:()=>t(!1),className:"p-1 text-text-tertiary hover:text-text-primary transition-colors","aria-label":"Close",title:"Close",children:y.jsx(Cn,{className:"w-3.5 h-3.5",strokeWidth:1.5})})]})]}),y.jsxs("div",{ref:w,className:`flex-1 overflow-y-auto px-4 py-3 space-y-3 min-h-[120px] transition-all duration-300 ${v?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[r.length===0&&y.jsx("p",{className:"text-xs text-text-tertiary text-center py-6",children:"Ask anything about what you're viewing."}),r.map(C=>y.jsxs("div",{className:`text-xs leading-relaxed ${C.role==="user"?"text-right":"text-left"}`,children:[y.jsx("div",{className:`inline-block max-w-[85%] px-3 py-2 rounded-md whitespace-pre-wrap ${C.role==="user"?"bg-accent/10 text-text-primary":"bg-surface-sunken text-text-secondary"}`,children:C.pending?y.jsx(HT,{msg:C}):C.role==="assistant"?y.jsx(Kd,{content:C.content}):C.content}),!C.pending&&y.jsx("div",{className:"mt-0.5",children:y.jsx(GT,{msg:C,compileMessage:p})})]},C.id))]}),y.jsxs("div",{className:`border-t border-surface-border px-3 py-2.5 flex gap-2 shrink-0 transition-all duration-300 ${v?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[y.jsx("textarea",{ref:S,value:g,onChange:C=>{f(C.target.value);const I=C.target;I.style.height="auto",I.style.height=`${Math.min(I.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}),y.jsx("button",{onClick:M,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:y.jsx(Tw,{className:"w-4 h-4",strokeWidth:1.5})})]})]})}const VT=6e3,YT="scan";function XT(){const{lastResult:i}=fv(),{open:t,ownerKey:r}=Yd(),[s,l]=j.useState(null);if(j.useEffect(()=>{if(!i)return;const m=setTimeout(()=>l(i.at),VT);return()=>clearTimeout(m)},[i]),!i||i.navigated||s===i.at||t&&r===YT)return null;const{response:c}=i;return y.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:y.jsxs("div",{className:"flex items-start gap-2.5 px-3.5 py-3",children:[y.jsx(ou,{className:"w-4 h-4 mt-0.5 text-accent-muted shrink-0",strokeWidth:1.5}),y.jsxs("div",{className:"flex-1 min-w-0",children:[y.jsx("div",{className:"text-sm font-mono text-text-secondary truncate",children:i.code}),c?y.jsxs(y.Fragment,{children:[y.jsx("div",{className:`text-sm font-medium ${xv[c.outcome]}`,children:_v(c)}),c.error&&y.jsx("div",{className:"text-xs text-text-tertiary mt-0.5",children:c.error}),ru(c)&&y.jsx("div",{className:"text-xs text-text-secondary mt-1.5",children:y.jsx(wv,{content:ru(c),compact:!0})})]}):y.jsx("div",{className:"text-sm text-status-error",children:i.error})]}),y.jsx("button",{type:"button",onClick:()=>l(i.at),className:"text-text-tertiary hover:text-text-primary shrink-0",title:"Dismiss",children:y.jsx(Cn,{className:"w-3.5 h-3.5"})})]})})}function KT(){var ie;const{isBuilder:i,isOps:t,viewAs:r}=Yb(),{canSeePaceBoard:s}=Xb();tO();const{data:l}=Or(),c=Gb(),m=c!==null?c:!!((ie=l==null?void 0:l.ai)!=null&&ie.enabled),{collapsed:p,toggle:g}=Fd(),[f,d]=j.useState(!1),[b,v]=j.useState(!1),[_,w]=j.useState(!1),[S,M]=j.useState(()=>window.location.hash.startsWith("#docs")),L=mn(),z=j.useRef(null);return j.useEffect(()=>{const ae=z.current;ae&&(ae.classList.remove("animate-page-in"),ae.offsetWidth,ae.classList.add("animate-page-in"))},[L.pathname]),j.useEffect(()=>{const ae=()=>{window.location.hash.startsWith("#docs")&&M(!0)};return window.addEventListener("hashchange",ae),()=>window.removeEventListener("hashchange",ae)},[]),y.jsxs("div",{className:"h-screen bg-surface flex flex-col",children:[y.jsx(SA,{onToggleEventFeed:()=>d(ae=>!ae),onToggleDocs:()=>M(ae=>!ae),onToggleNav:()=>v(ae=>!ae)}),y.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[y.jsxs("aside",{className:`${p?"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:[y.jsx("nav",{className:"flex-1 px-3 pt-[36px] pb-4 space-y-2 overflow-y-auto overflow-x-hidden",children:y.jsx(Ev,{aiEnabled:m,isBuilder:i,isOps:t,viewAs:r,canSeePaceBoard:s})}),y.jsx("button",{onClick:g,className:`shrink-0 py-3 text-text-tertiary hover:text-text-secondary transition-colors duration-150 ${p?"flex justify-center":"flex items-center px-7"}`,"aria-label":p?"Expand sidebar":"Collapse sidebar",children:p?y.jsx(Nw,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5}):y.jsx(kw,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5})}),!p&&(l==null?void 0:l.environment)&&y.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${l.environment.longTailVersion} · HotMesh v${l.environment.hotmeshVersion} · Node ${l.environment.nodeVersion} · ${l.environment.nodeEnv}`,children:["long-tail v",l.environment.longTailVersion,y.jsx("span",{className:"mx-1 text-surface-border",children:"·"}),"HotMesh v",l.environment.hotmeshVersion]})]}),y.jsx("main",{className:"flex-1 min-w-0 overflow-y-auto",children:y.jsx("div",{ref:z,className:"w-full px-page-x py-8 pb-16 animate-page-in h-full flex flex-col @container",children:y.jsx(Ls,{})})}),y.jsx(JT,{})]}),y.jsx(FA,{open:b,onClose:()=>v(!1),aiEnabled:m,isBuilder:i,isOps:t,viewAs:r,canSeePaceBoard:s}),y.jsx(uj,{open:f,onToggle:()=>d(ae=>!ae),configOpen:_,onToggleConfig:()=>w(ae=>!ae)}),y.jsx(xj,{open:S,onClose:()=>{M(!1),history.replaceState(null,"",window.location.pathname+window.location.search)}}),m&&y.jsx(Oj,{}),m&&y.jsx(FT,{}),y.jsx(XT,{})]})}function JT(){const{node:i,width:t,open:r}=Yd();return y.jsx(aO,{open:r,width:t,className:"border-l border-surface-border bg-surface-raised",children:i})}function QT(){const{isAuthenticated:i}=pn(),t=mn();return i?y.jsx(rO,{children:y.jsx(sO,{children:y.jsx(Ej,{children:y.jsx(gO,{children:y.jsx(NO,{children:y.jsx(KT,{})})})})})}):y.jsx(Xn,{to:"/login",state:{from:t.pathname},replace:!0})}function zv({provider:i,className:t="w-5 h-5"}){switch(i){case"google":return y.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor",children:[y.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"}),y.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"}),y.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"}),y.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 y.jsx("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor",children:y.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 y.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor",children:[y.jsx("path",{d:"M3 3h8.5v8.5H3z",fill:"#F25022"}),y.jsx("path",{d:"M12.5 3H21v8.5h-8.5z",fill:"#7FBA00"}),y.jsx("path",{d:"M3 12.5h8.5V21H3z",fill:"#00A4EF"}),y.jsx("path",{d:"M12.5 12.5H21V21h-8.5z",fill:"#FFB900"})]});case"anthropic":return y.jsx("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor",children:y.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 y.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[y.jsx("circle",{cx:"12",cy:"12",r:"10"}),y.jsx("path",{d:"M12 8v4l3 3"})]})}}async function ZT(){return Ae("/auth/oauth/providers")}async function WT(i,t){const r=t?`?label=${encodeURIComponent(t)}`:"";return Ae(`/auth/oauth/connections/${i}${r}`,{method:"DELETE"})}function J3(){return pt({queryKey:["oauth-connections"],queryFn:()=>Ae("/auth/oauth/connections")})}function Q3(){const i=gt();return Et({mutationFn:({provider:t,label:r})=>WT(t,r),onSuccess:()=>{i.invalidateQueries({queryKey:["oauth-connections"]})}})}function eN(){var re;const{login:i,isAuthenticated:t}=pn(),r=go(),s=mn(),l=new URLSearchParams(s.search),c=l.get("token"),m=l.get("error"),p=((re=s.state)==null?void 0:re.from)??l.get("returnTo")??"/",g=j.useRef(!1);c&&!g.current&&(g.current=!0,i(c,void 0,{displayName:l.get("displayName"),username:l.get("username")}));const[f,d]=j.useState(""),[b,v]=j.useState(""),[_,w]=j.useState(m||""),[S,M]=j.useState(!1),[L,z]=j.useState(!!c),[ie,ae]=j.useState([]),C=j.useRef(!1);if(j.useEffect(()=>{c||C.current||(C.current=!0,(async()=>{var K,B,G,W;try{const Q=await fetch(`${Mt}/api/settings`);if(!Q.ok)return;const he=await Q.json();if(!((K=he.auth)!=null&&K.sso))return;const _e=await fetch(`${Mt}/api/auth/sso`,{method:"POST"});if(!_e.ok){w("Host authentication required — please log in to your organization first");return}const Te=await _e.json();Te.token&&((B=he.auth)!=null&&B.ssoLogoutUrl&&sessionStorage.setItem("lt_sso_logout_url",he.auth.ssoLogoutUrl),z(!0),i(Te.token,void 0,{displayName:(G=Te.user)==null?void 0:G.display_name,username:(W=Te.user)==null?void 0:W.external_id}))}catch{}})())},[]),j.useEffect(()=>{c||ZT().then(ae).catch(()=>{})},[]),j.useEffect(()=>{if(!L)return;const K=setTimeout(()=>r(p,{replace:!0}),1500);return()=>clearTimeout(K)},[L]),t&&!L)return y.jsx(Xn,{to:p,replace:!0});const I=async K=>{var B,G;if(K.preventDefault(),w(""),!f.trim()||!b){w("Username and password are required");return}M(!0);try{const W=await fetch(`${Mt}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:f.trim(),password:b})}),Q=await W.json();if(!W.ok){w(Q.error||"Login failed");return}z(!0),i(Q.token,{username:f.trim(),password:b},{displayName:(B=Q.user)==null?void 0:B.display_name,username:(G=Q.user)==null?void 0:G.external_id})}catch{w("Unable to connect to server")}finally{M(!1)}};return y.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center overflow-hidden",children:y.jsxs("div",{className:"w-full max-w-md p-10",children:[y.jsx("div",{className:`mb-10 transition-all duration-[1500ms] ease-in ${L?"translate-x-[120vw] -translate-y-[60vh] scale-[3] opacity-0":""}`,children:y.jsx(nu,{size:"lg",hideLabel:L})}),y.jsxs("form",{onSubmit:I,className:`space-y-5 transition-opacity duration-300 ${L?"opacity-0":""}`,children:[y.jsxs("div",{children:[y.jsx("label",{htmlFor:"username",className:"block text-sm font-medium text-text-secondary mb-2",children:"Username"}),y.jsx("input",{id:"username",type:"text",value:f,onChange:K=>d(K.target.value),className:"input",placeholder:"Enter your username",autoFocus:!L,autoComplete:"username"})]}),y.jsxs("div",{children:[y.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-text-secondary mb-2",children:"Password"}),y.jsx("input",{id:"password",type:"password",value:b,onChange:K=>v(K.target.value),className:"input",placeholder:"Enter your password",autoComplete:"current-password"})]}),_&&y.jsx("p",{className:"text-sm text-status-error",children:_}),y.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:S||L,children:S?"Signing in...":"Sign In"}),ie.length>0&&y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"flex items-center gap-3 mt-6",children:[y.jsx("div",{className:"flex-1 h-px bg-border"}),y.jsx("span",{className:"text-xs text-text-tertiary",children:"or continue with"}),y.jsx("div",{className:"flex-1 h-px bg-border"})]}),y.jsx("div",{className:"space-y-2",children:ie.filter(K=>K.provider!=="anthropic").map(K=>y.jsxs("a",{href:`${Mt}/api/auth/oauth/${K.provider}?returnTo=${encodeURIComponent(p)}`,className:"btn-secondary w-full flex items-center justify-center gap-2",children:[y.jsx(zv,{provider:K.provider}),"Sign in with ",K.name]},K.provider))})]})]})]})})}function Z1(){const{isAuthenticated:i}=pn(),t=go(),r=mn(),s=new URLSearchParams(r.search),l=s.get("state")||"";j.useEffect(()=>{i||t(`/login?returnTo=${encodeURIComponent(r.pathname+r.search)}`)},[i]);const[c,m]=j.useState(""),[p,g]=j.useState(s.get("label")||"default"),[f,d]=j.useState(""),[b,v]=j.useState(!1),_=c.trim().startsWith("sk-ant-oat"),w=c.trim().startsWith("sk-ant-api"),S=M=>{M.preventDefault();const L=c.trim();if(!L){d("A token or API key is required");return}if(!L.startsWith("sk-ant-")){d('Invalid format. Must start with "sk-ant-oat" (OAuth token) or "sk-ant-api" (API key)');return}v(!0),d("");const z=`${Mt}/api/auth/oauth/anthropic/callback?code=${encodeURIComponent(L)}&state=${encodeURIComponent(l)}`;window.location.href=z};return y.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center",children:y.jsxs("div",{className:"w-full max-w-md p-10",children:[y.jsx("div",{className:"mb-10",children:y.jsx(nu,{size:"lg"})}),y.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[y.jsx(zv,{provider:"anthropic",className:"w-6 h-6"}),y.jsx("h2",{className:"heading-3",children:"Connect Anthropic"})]}),y.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."}),y.jsxs("form",{onSubmit:S,className:"space-y-5",children:[y.jsxs("div",{children:[y.jsx("label",{htmlFor:"token",className:"block text-sm font-medium text-text-secondary mb-2",children:"OAuth Token or API Key"}),y.jsx("input",{id:"token",type:"password",value:c,onChange:M=>m(M.target.value),className:"input",placeholder:"sk-ant-oat01-... or sk-ant-api03-...",autoFocus:!0,autoComplete:"off"}),_&&y.jsx("p",{className:"text-xs text-status-success mt-1",children:"OAuth token detected — uses your Claude subscription (flat rate)"}),w&&y.jsx("p",{className:"text-xs text-status-warning mt-1",children:"API key detected — billed per-token from your Anthropic API account"})]}),y.jsxs("div",{children:[y.jsx("label",{htmlFor:"label",className:"block text-sm font-medium text-text-secondary mb-2",children:"Label"}),y.jsx("input",{id:"label",type:"text",value:p,onChange:M=>g(M.target.value.replace(/\s+/g,"-").toLowerCase()),className:"input",placeholder:"default",autoComplete:"off"}),y.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").'})]}),f&&y.jsx("p",{className:"text-sm text-status-error",children:f}),y.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:b,children:b?"Validating...":"Connect"}),y.jsx("a",{href:"/",className:"block text-center text-sm text-text-tertiary hover:text-text-secondary",children:"Cancel"})]}),y.jsxs("div",{className:"mt-6 space-y-3 text-xs text-text-tertiary",children:[y.jsxs("div",{children:[y.jsx("span",{className:"font-medium text-text-secondary",children:"Recommended:"})," ","Run"," ",y.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."]}),y.jsxs("div",{children:[y.jsx("span",{className:"font-medium text-text-secondary",children:"Alternative:"})," ","Use an API key from"," ",y.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 zc({roleTypes:i,roleNames:t,redirectTo:r="/"}){const{isSuperAdmin:s,hasRole:l,hasRoleType:c}=pn();return s?y.jsx(Ls,{}):i&&i.some(m=>c(m))?y.jsx(Ls,{}):t&&t.some(m=>l(m))?y.jsx(Ls,{}):y.jsx(Xn,{to:r,replace:!0})}function tN({redirectTo:i="/"}){var s;const{data:t,isLoading:r}=Or();return r||!t?null:(s=t.ai)!=null&&s.enabled?y.jsx(Ls,{}):y.jsx(Xn,{to:i,replace:!0})}function nN({flag:i,redirectTo:t="/"}){var l;const{data:r,isLoading:s}=Or();return s||!r?null:((l=r.features)==null?void 0:l[i])===!1?y.jsx(Xn,{to:t,replace:!0}):y.jsx(Ls,{})}const rN=j.lazy(()=>we(()=>import("./ProcessesListPage-CfQEWaD4.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]),import.meta.url).then(i=>({default:i.ProcessesListPage}))),iN=j.lazy(()=>we(()=>import("./ProcessDetailPage-DN9NqfeP.js"),__vite__mapDeps([18,1,2,4,19,14,20,17,11,6,21,22,23]),import.meta.url).then(i=>({default:i.ProcessDetailPage}))),sN=j.lazy(()=>we(()=>import("./McpOverview-_T9IsCD_.js"),__vite__mapDeps([24,1,25,26,27,28,15,14,29,6]),import.meta.url).then(i=>({default:i.McpOverview}))),aN=j.lazy(()=>we(()=>import("./McpRunsPage-L-1y8wnX.js"),__vite__mapDeps([30,1,26,27,5,6,31,28,8,9,10,17,14,32,15,13,12,16,33]),import.meta.url).then(i=>({default:i.McpRunsPage}))),oN=j.lazy(()=>we(()=>import("./McpRunDetailPage-BhcqqtYS.js"),__vite__mapDeps([34,1,26,15,14,35,36,13,37,20,6,38,16,39]),import.meta.url).then(i=>({default:i.McpRunDetailPage}))),lN=j.lazy(()=>we(()=>import("./McpQueryPage-DX5u-1bx.js"),__vite__mapDeps([40,1,15,14,9,10,13,12,16,8,11,32,17,33,5,6,4,41]),import.meta.url).then(i=>({default:i.McpQueryPage}))),cN=j.lazy(()=>we(()=>import("./McpQueryDetailPage-DtsVqKPw.js"),__vite__mapDeps([42,1,15,14,20,41,6,27,4,43,44,26,3,2,45,46,47,48,49,50,39,51,37,38]),import.meta.url).then(i=>({default:i.McpQueryDetailPage}))),uN=j.lazy(()=>we(()=>import("./EscalationsOverview-DuIUyxr0.js"),__vite__mapDeps([52,1,4,15,14,29,6]),import.meta.url).then(i=>({default:i.EscalationsOverview}))),fN=j.lazy(()=>we(()=>import("./AvailableEscalationsPage-CVlG_AVC.js"),__vite__mapDeps([53,1,54,4,14,55,56,6,57,58,59,13,60,21,17,61,9,10,20,12,5,7,8,23,33,16]),import.meta.url).then(i=>({default:i.AvailableEscalationsPage}))),hN=j.lazy(()=>we(()=>import("./OperatorDashboard-CIbDzOlh.js"),__vite__mapDeps([62,1,4,5,6,7,8,54,9,10,12,33,58,14,59,13,60,21,17,61,20,56,16]),import.meta.url).then(i=>({default:i.OperatorDashboard}))),dN=j.lazy(()=>we(()=>import("./index-DOai950R.js"),__vite__mapDeps([63,1,55,56,6,57,15,14,16,61,9,10,20,12,3,4,21,39,22,23]),import.meta.url).then(i=>({default:i.EscalationDetailPage}))),mN=j.lazy(()=>we(()=>import("./WorkflowsOverview-CqZVarK-.js"),__vite__mapDeps([64,1,3,4,15,14,29,6]),import.meta.url).then(i=>({default:i.WorkflowsOverview}))),pN=j.lazy(()=>we(()=>import("./index-B7IaBPBg.js"),__vite__mapDeps([65,1,3,15,14,13,17,66,48,49,6]),import.meta.url).then(i=>({default:i.StartWorkflowPage}))),gN=j.lazy(()=>we(()=>import("./index-B7IaBPBg.js"),__vite__mapDeps([65,1,3,15,14,13,17,66,48,49,6]),import.meta.url).then(i=>({default:i.DurableInvokePage}))),yN=j.lazy(()=>we(()=>import("./WorkflowsDashboard-B-u7zFKM.js"),__vite__mapDeps([67,1,32,3,31,28,6,4,5,8,9,10,17,14,15,13,12,16,33]),import.meta.url).then(i=>({default:()=>i.WorkflowsDashboard({tier:"durable"})}))),bN=j.lazy(()=>we(()=>import("./WorkflowsDashboard-B-u7zFKM.js"),__vite__mapDeps([67,1,32,3,31,28,6,4,5,8,9,10,17,14,15,13,12,16,33]),import.meta.url).then(i=>({default:()=>i.WorkflowsDashboard({tier:"all"})}))),vN=j.lazy(()=>we(()=>import("./YamlWorkflowsPage-BuQM6uZA.js"),__vite__mapDeps([68,1,27,5,6,15,14,13,10,50,66,20]),import.meta.url).then(i=>({default:i.YamlWorkflowsPage}))),xN=j.lazy(()=>we(()=>import("./GraphInvokePage-BGHVUipJ.js"),__vite__mapDeps([69,1,27,15,14,45,47,48,49,46,6,50,66]),import.meta.url).then(i=>({default:i.GraphInvokePage}))),_N=j.lazy(()=>we(()=>import("./YamlWorkflowDetailPage-DiFLavW0.js"),__vite__mapDeps([70,1,27,20,66,14,6]),import.meta.url).then(i=>({default:i.YamlWorkflowDetailPage}))),wN=j.lazy(()=>we(()=>import("./TasksListPage-DVENC9Jp.js"),__vite__mapDeps([71,1,2,3,5,6,9,10,20,60,51,12,13,14,15,17]),import.meta.url).then(i=>({default:i.TasksListPage}))),SN=j.lazy(()=>we(()=>import("./TaskDetailPage-_9cr_R0u.js"),__vite__mapDeps([72,1,2,20,60,15,14,6]),import.meta.url).then(i=>({default:i.TaskDetailPage}))),W1=j.lazy(()=>we(()=>import("./WorkflowExecutionPage-xL956RZi.js"),__vite__mapDeps([73,1,3,4,36,13,14,37,20,6,38,2,15,35,16,39]),import.meta.url).then(i=>({default:i.WorkflowExecutionPage}))),EN=j.lazy(()=>we(()=>import("./AdminDashboard-DJ3LJQ09.js"),__vite__mapDeps([74,1,2,4,25,19,14,6]),import.meta.url).then(i=>({default:i.AdminDashboard}))),ON=j.lazy(()=>we(()=>import("./index-CtwbQ_-m.js"),__vite__mapDeps([75,1,3,9,10,13,14,33,5,6,15,76,17]),import.meta.url).then(i=>({default:i.WorkersPage}))),AN=j.lazy(()=>we(()=>import("./index-DTtHNC-D.js"),__vite__mapDeps([77,1,3,13,14,78,56,6,21,17,15,48,49,66]),import.meta.url).then(i=>({default:i.WorkflowConfigsPage}))),eb=j.lazy(()=>we(()=>import("./index-DTtHNC-D.js"),__vite__mapDeps([77,1,3,13,14,78,56,6,21,17,15,48,49,66]),import.meta.url).then(i=>({default:i.WorkflowConfigDetailPage}))),jN=j.lazy(()=>we(()=>import("./index-fgBDhnI6.js"),__vite__mapDeps([79,1,25,10,78,56,6,15,14,13,12,5,80,47,48,49,50,46,33,20]),import.meta.url).then(i=>({default:i.McpServersPage}))),tb=j.lazy(()=>we(()=>import("./index-Cfv86_L9.js"),__vite__mapDeps([81,1,25,15,14,43,6]),import.meta.url).then(i=>({default:i.McpServerDetailPage}))),TN=j.lazy(()=>we(()=>import("./index-BE0phFw0.js"),__vite__mapDeps([82,1,23,5,6,9,10,12,13,14,78,56,33,15,21,49,51,83,84,35]),import.meta.url).then(i=>({default:i.UsersPage}))),NN=j.lazy(()=>we(()=>import("./RolesPage-DCnW0VmD.js"),__vite__mapDeps([85,1,15,14,21,56,6]),import.meta.url).then(i=>({default:i.RolesPage}))),kN=j.lazy(()=>we(()=>import("./RoleDetailPage-BC5HL7ls.js"),__vite__mapDeps([86,1,23,87,78,56,6,14]),import.meta.url).then(i=>({default:i.RoleDetailPage}))),CN=j.lazy(()=>we(()=>import("./PersonasPage-DSdRb90f.js"),__vite__mapDeps([88,1,83,15,14,21,56,6,23,7]),import.meta.url).then(i=>({default:i.PersonasPage}))),MN=j.lazy(()=>we(()=>import("./PersonaDetailPage-BOaf0TW1.js"),__vite__mapDeps([89,1,83,21,14,84,87,78,56,6]),import.meta.url).then(i=>({default:i.PersonaDetailPage}))),RN=j.lazy(()=>we(()=>import("./EscalationSchemaPage-D_UgP0pv.js"),__vite__mapDeps([90,1,14,6]),import.meta.url).then(i=>({default:i.EscalationSchemaPage}))),DN=j.lazy(()=>we(()=>import("./EscalationListSchemaPage-CTQCALw4.js"),__vite__mapDeps([91,1,14,6]),import.meta.url).then(i=>({default:i.EscalationListSchemaPage}))),qN=j.lazy(()=>we(()=>import("./ScanCodesPage-CPNg6K--.js"),__vite__mapDeps([92,1,15,14,6]),import.meta.url).then(i=>({default:i.ScanCodesPage}))),BN=j.lazy(()=>we(()=>import("./ScanSchemeDetailPage-DyLmCamO.js"),__vite__mapDeps([93,1,78,56,6,15,14]),import.meta.url).then(i=>({default:i.ScanSchemeDetailPage}))),LN=j.lazy(()=>we(()=>import("./ScanStationPage-DoZccU5B.js"),__vite__mapDeps([94,1,14,56,6]),import.meta.url).then(i=>({default:i.ScanStationPage}))),zN=j.lazy(()=>we(()=>import("./index-7BP6FaCZ.js"),__vite__mapDeps([95,1,15,14,56,6,57]),import.meta.url).then(i=>({default:i.MaintenancePage}))),UN=j.lazy(()=>we(()=>import("./OperationsPage-i8KcDpKo.js").then(i=>i.O),__vite__mapDeps([96,1,4,59,14,15,6]),import.meta.url).then(i=>({default:i.OperationsPage}))),PN=j.lazy(()=>we(()=>import("./index-DsWnVyVN.js"),__vite__mapDeps([97,1,19,14,13,5,6,31,28,56,44,76,9,10,33]),import.meta.url).then(i=>({default:i.ControlPlanePage}))),IN=j.lazy(()=>we(()=>import("./index-CLPVqbVY.js"),__vite__mapDeps([98,1,38,14,5,6,31,28,8,9,10,12,13,15,16]),import.meta.url).then(i=>({default:i.StreamMessagesPage}))),$N=j.lazy(()=>we(()=>import("./CredentialsPage-Bv875IHe.js"),__vite__mapDeps([99,1,15,14,51,78,56,6]),import.meta.url).then(i=>({default:i.CredentialsPage}))),HN=j.lazy(()=>we(()=>import("./index-BYNN9N1T.js"),__vite__mapDeps([100,1,6,15,14,13,16,8,10,101,51]),import.meta.url).then(i=>({default:i.FilesPage}))),GN=j.lazy(()=>we(()=>import("./index-Dy-MMYti.js"),__vite__mapDeps([102,1,15,14,13,16,12,10,101,51,103,43,6]),import.meta.url).then(i=>({default:i.KnowledgePage}))),FN=j.lazy(()=>we(()=>import("./HomePage-B-S2cK3E.js"),__vite__mapDeps([104,1,3,26,28,4,21,14,17,16,96,59,15,6,54]),import.meta.url).then(i=>({default:i.HomePage}))),VN=j.lazy(()=>we(()=>import("./AgentsPage-Cwqka7nE.js"),__vite__mapDeps([105,1,106,4,5,6,8,9,10,12,13,14,15,16]),import.meta.url).then(i=>({default:i.AgentsPage}))),YN=j.lazy(()=>we(()=>import("./AgentDetailPage-C6wfsnRe.js"),__vite__mapDeps([107,1,106,108,14,4,17,6]),import.meta.url).then(i=>({default:i.AgentDetailPage}))),nb=j.lazy(()=>we(()=>import("./AgentConfigPage-BMMvaD0z.js"),__vite__mapDeps([109,1,106,108,14,15,103,47,48,49,3,27,110,111,17,6]),import.meta.url).then(i=>({default:i.AgentConfigPage}))),XN=j.lazy(()=>we(()=>import("./CapabilitiesPage-wxmE4917.js"),__vite__mapDeps([112,1,110,80,25,47,48,49,14,50,6,46,15,13]),import.meta.url).then(i=>({default:i.CapabilitiesPage}))),KN=j.lazy(()=>we(()=>import("./TopicsPage-CP7HFxIC.js"),__vite__mapDeps([113,1,111,15,14,13,6]),import.meta.url).then(i=>({default:i.TopicsPage}))),JN=j.lazy(()=>we(()=>import("./TopicDetailPage-mR4Jaz83.js"),__vite__mapDeps([114,1,111,16,14,6]),import.meta.url).then(i=>({default:i.TopicDetailPage})));function QN(){return y.jsxs("div",{className:"animate-pulse space-y-4",children:[y.jsx("div",{className:"h-8 bg-surface-sunken rounded w-48"}),y.jsx("div",{className:"h-40 bg-surface-sunken rounded"})]})}function ve({children:i}){return y.jsx(j.Suspense,{fallback:y.jsx(QN,{}),children:y.jsx("div",{className:"animate-page-enter flex flex-col flex-1 min-h-0",children:i})})}const Uv=new Q_({defaultOptions:{queries:{staleTime:1e4,retry:(i,t)=>t instanceof Error&&t.message==="Session expired"?!1:i<1}}});window.addEventListener("auth:unauthorized",()=>{Uv.clear(),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info");const i=window.__LT_BASE__||"",t=`${i}/login`;if(window.location.pathname!==t){const r=window.location.pathname+window.location.search,s=i&&r.startsWith(i)?r.slice(i.length)||"/":r;window.location.href=`${t}?returnTo=${encodeURIComponent(s)}`}});const ZN=ew([{path:"/login",element:y.jsx(eN,{})},{path:"/connect/anthropic",element:y.jsx(Z1,{})},{path:"/connect/:provider",element:y.jsx(Z1,{})},{path:"/",element:y.jsx(QT,{}),children:[{index:!0,element:y.jsx(ve,{children:y.jsx(FN,{})})},{path:"processes/all",element:y.jsx(ve,{children:y.jsx(rN,{})})},{path:"processes/detail/:originId",element:y.jsx(ve,{children:y.jsx(iN,{})})},{path:"credentials",element:y.jsx(ve,{children:y.jsx($N,{})})},{path:"connections",element:y.jsx(Xn,{to:"/credentials",replace:!0})},{path:"escalations",element:y.jsx(ve,{children:y.jsx(uN,{})})},{path:"escalations/available",element:y.jsx(ve,{children:y.jsx(fN,{})})},{path:"escalations/queue",element:y.jsx(ve,{children:y.jsx(hN,{})})},{path:"escalations/detail/:id",element:y.jsx(ve,{children:y.jsx(dN,{})})},{path:"scan/station",element:y.jsx(ve,{children:y.jsx(LN,{})})},{path:"capabilities",element:y.jsx(ve,{children:y.jsx(XN,{})})},{path:"agents",element:y.jsx(ve,{children:y.jsx(VN,{})})},{path:"agents/new",element:y.jsx(ve,{children:y.jsx(nb,{})})},{path:"agents/:id",element:y.jsx(ve,{children:y.jsx(YN,{})})},{path:"agents/:id/edit",element:y.jsx(ve,{children:y.jsx(nb,{})})},{path:"topics",element:y.jsx(ve,{children:y.jsx(KN,{})})},{path:"topics/:topic",element:y.jsx(ve,{children:y.jsx(JN,{})})},{element:y.jsx(zc,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"workflows",element:y.jsx(ve,{children:y.jsx(mN,{})})},{path:"workflows/executions",element:y.jsx(ve,{children:y.jsx(bN,{})})},{path:"workflows/durable/executions",element:y.jsx(ve,{children:y.jsx(yN,{})})},{path:"workflows/durable/executions/:workflowId",element:y.jsx(ve,{children:y.jsx(W1,{})})},{path:"workflows/tasks",element:y.jsx(ve,{children:y.jsx(wN,{})})},{path:"workflows/tasks/detail/:id",element:y.jsx(ve,{children:y.jsx(SN,{})})},{path:"workflows/executions/:workflowId",element:y.jsx(ve,{children:y.jsx(W1,{})})},{path:"workflows/start",element:y.jsx(ve,{children:y.jsx(pN,{})})},{path:"workflows/durable/invoke",element:y.jsx(ve,{children:y.jsx(gN,{})})},{path:"workflows/cron",element:y.jsx(Xn,{to:"/workflows/start?mode=schedule",replace:!0})},{path:"workflows/workers",element:y.jsx(ve,{children:y.jsx(ON,{})})},{path:"workflows/registry",element:y.jsx(ve,{children:y.jsx(AN,{})})},{path:"workflows/registry/new",element:y.jsx(ve,{children:y.jsx(eb,{})})},{path:"workflows/registry/:workflowType",element:y.jsx(ve,{children:y.jsx(eb,{})})}]},{element:y.jsx(zc,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"mcp/workflows",element:y.jsx(ve,{children:y.jsx(vN,{})})},{path:"mcp/workflows/invoke",element:y.jsx(ve,{children:y.jsx(xN,{})})},{path:"mcp/workflows/:id",element:y.jsx(ve,{children:y.jsx(_N,{})})},{path:"mcp/executions",element:y.jsx(ve,{children:y.jsx(aN,{})})},{path:"mcp/executions/:jobId",element:y.jsx(ve,{children:y.jsx(oN,{})})},{path:"files",element:y.jsx(ve,{children:y.jsx(HN,{})})},{path:"knowledge",element:y.jsx(ve,{children:y.jsx(GN,{})})},{element:y.jsx(tN,{}),children:[{path:"mcp",element:y.jsx(ve,{children:y.jsx(sN,{})})},{path:"mcp/queries",element:y.jsx(ve,{children:y.jsx(lN,{})})},{path:"mcp/queries/:workflowId",element:y.jsx(ve,{children:y.jsx(cN,{})})},{path:"mcp/tools",element:y.jsx(Xn,{to:"/mcp/servers",replace:!0})},{path:"mcp/servers",element:y.jsx(ve,{children:y.jsx(jN,{})})},{path:"mcp/servers/new",element:y.jsx(ve,{children:y.jsx(tb,{})})},{path:"mcp/servers/:serverId",element:y.jsx(ve,{children:y.jsx(tb,{})})}]}]},{path:"operations",element:y.jsx(ve,{children:y.jsx(UN,{})})},{element:y.jsx(zc,{roleTypes:["admin","superadmin"],roleNames:["engineer"]}),children:[{path:"admin",element:y.jsx(ve,{children:y.jsx(EN,{})})},{path:"admin/users",element:y.jsx(ve,{children:y.jsx(TN,{})})},{path:"admin/escalation-chains",element:y.jsx(Xn,{to:"/admin/roles",replace:!0})},{path:"admin/roles",element:y.jsx(ve,{children:y.jsx(NN,{})})},{path:"admin/roles/:role",element:y.jsx(ve,{children:y.jsx(kN,{})})},{path:"admin/roles/:role/schema",element:y.jsx(ve,{children:y.jsx(RN,{})})},{path:"admin/roles/:role/list-schema",element:y.jsx(ve,{children:y.jsx(DN,{})})},{path:"admin/scan-codes",element:y.jsx(ve,{children:y.jsx(qN,{})})},{path:"admin/scan-codes/:version",element:y.jsx(ve,{children:y.jsx(BN,{})})},{path:"admin/personas",element:y.jsx(ve,{children:y.jsx(CN,{})})},{path:"admin/personas/:key",element:y.jsx(ve,{children:y.jsx(MN,{})})}]},{element:y.jsx(zc,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"admin/bots",element:y.jsx(Xn,{to:"/admin/users?tab=service-accounts",replace:!0})},{element:y.jsx(nN,{flag:"dbMaintenance"}),children:[{path:"admin/maintenance",element:y.jsx(ve,{children:y.jsx(zN,{})})}]},{path:"admin/controlplane",element:y.jsx(ve,{children:y.jsx(PN,{})})},{path:"admin/streams",element:y.jsx(ve,{children:y.jsx(IN,{})})}]}]}],{basename:window.__LT_BASE__||"/"});function WN(){return y.jsx(Z_,{client:Uv,children:y.jsx(Iw,{children:y.jsx(G2,{children:y.jsx(tw,{router:ZN})})})})}iv(rv());const Zd=document.createElement("link");Zd.rel="stylesheet";Zd.href=`${Mt}/api/settings/custom.css`;document.head.appendChild(Zd);qw.createRoot(document.getElementById("root")).render(y.jsx(j.StrictMode,{children:y.jsx(WN,{})}));export{pO as $,_3 as A,w3 as B,Xd as C,PT as D,E3 as E,Av as F,B3 as G,NA as H,f3 as I,oj as J,RA as K,Wb as L,Zb as M,GE as N,U3 as O,o3 as P,Qd as Q,g3 as R,KA as S,MA as T,V3 as U,a3 as V,AO as W,Zl as X,Kd as Y,wv as Z,m3 as _,K3 as a,cv as a0,b3 as a1,S3 as a2,Yg as a3,lv as a4,Jd as a5,Lv as a6,Y3 as a7,I3 as a8,H3 as a9,zv as aA,Hd as aB,Xb as aC,F3 as aD,$3 as aa,z3 as ab,L3 as ac,vd as ad,Ay as ae,Rd as af,G3 as ag,Mt as ah,fb as ai,X3 as aj,P3 as ak,j3 as al,O3 as am,N3 as an,C3 as ao,M3 as ap,T3 as aq,k3 as ar,fv as as,qT as at,jO as au,A3 as av,Pe as aw,c3 as ax,J3 as ay,Q3 as az,UT as b,aO as c,l3 as d,i3 as e,BT as f,Ae as g,d3 as h,p3 as i,y3 as j,u3 as k,Gb as l,pn as m,D3 as n,h3 as o,OO as p,q3 as q,Yd as r,kA as s,CA as t,Or as u,BA as v,R3 as w,Yb as x,v3 as y,x3 as z};
65
+ //# sourceMappingURL=index-errgQT5x.js.map