@hotmeshio/long-tail 0.23.1 → 0.24.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 (562) hide show
  1. package/build/adapters/express.d.ts +9 -1
  2. package/build/adapters/express.js +32 -41
  3. package/build/api/auth-sso.d.ts +1 -1
  4. package/build/api/bot-accounts.d.ts +2 -0
  5. package/build/api/bot-accounts.js +4 -0
  6. package/build/api/capabilities.d.ts +7 -2
  7. package/build/api/capabilities.js +13 -2
  8. package/build/api/escalations/analytics.js +5 -0
  9. package/build/api/escalations/bulk.d.ts +2 -0
  10. package/build/api/escalations/bulk.js +9 -4
  11. package/build/api/escalations/helpers.d.ts +5 -0
  12. package/build/api/escalations/helpers.js +7 -0
  13. package/build/api/escalations/index.d.ts +1 -0
  14. package/build/api/escalations/index.js +4 -1
  15. package/build/api/escalations/list.d.ts +5 -0
  16. package/build/api/escalations/list.js +19 -5
  17. package/build/api/escalations/metadata.js +3 -0
  18. package/build/api/escalations/related.d.ts +18 -0
  19. package/build/api/escalations/related.js +205 -0
  20. package/build/api/escalations/single.d.ts +3 -2
  21. package/build/api/escalations/single.js +8 -3
  22. package/build/api/mcp/tools.d.ts +12 -0
  23. package/build/api/mcp/tools.js +113 -9
  24. package/build/api/roles.js +4 -0
  25. package/build/api/scan-codes/choice.js +31 -7
  26. package/build/api/scan-codes/present.js +5 -1
  27. package/build/api/settings.d.ts +1 -1
  28. package/build/api/settings.js +12 -1
  29. package/build/api/tasks.d.ts +3 -3
  30. package/build/api/tasks.js +30 -7
  31. package/build/api/workflows/input-lookups.js +1 -1
  32. package/build/api/workflows/invocable.js +2 -2
  33. package/build/api/workflows/invocation.js +1 -1
  34. package/build/api/yaml-workflows/deploy.d.ts +10 -2
  35. package/build/api/yaml-workflows/deploy.js +42 -2
  36. package/build/lib/db/schemas/038_oauth_server.sql +46 -0
  37. package/build/lib/events/browser-view.d.ts +15 -0
  38. package/build/lib/events/browser-view.js +101 -0
  39. package/build/lib/events/nats-ws-filter.d.ts +29 -0
  40. package/build/lib/events/nats-ws-filter.js +94 -0
  41. package/build/lib/events/nats-ws-proxy.d.ts +2 -0
  42. package/build/lib/events/nats-ws-proxy.js +39 -5
  43. package/build/lib/events/nats-ws-server-filter.d.ts +16 -0
  44. package/build/lib/events/nats-ws-server-filter.js +56 -0
  45. package/build/lib/events/nats-ws-ticket.d.ts +10 -0
  46. package/build/lib/events/nats-ws-ticket.js +42 -0
  47. package/build/lib/events/socketio.d.ts +10 -1
  48. package/build/lib/events/socketio.js +10 -3
  49. package/build/lib/http/index.d.ts +27 -0
  50. package/build/lib/http/index.js +55 -0
  51. package/build/modules/auth.d.ts +15 -24
  52. package/build/modules/auth.js +43 -126
  53. package/build/modules/capabilities.d.ts +62 -0
  54. package/build/modules/capabilities.js +188 -0
  55. package/build/modules/config.d.ts +14 -0
  56. package/build/modules/config.js +20 -0
  57. package/build/modules/defaults.d.ts +10 -0
  58. package/build/modules/defaults.js +12 -1
  59. package/build/modules/display.d.ts +15 -0
  60. package/build/modules/display.js +27 -0
  61. package/build/modules/mcp-auth.d.ts +11 -0
  62. package/build/modules/mcp-auth.js +56 -0
  63. package/build/modules/oauth-server.d.ts +18 -0
  64. package/build/modules/oauth-server.js +40 -0
  65. package/build/routes/agents.js +46 -14
  66. package/build/routes/announcements.js +2 -2
  67. package/build/routes/auth-sso.js +2 -2
  68. package/build/routes/auth.js +2 -2
  69. package/build/routes/bot-accounts.js +26 -3
  70. package/build/routes/capabilities.js +4 -4
  71. package/build/routes/controlplane.js +2 -2
  72. package/build/routes/dba.js +2 -2
  73. package/build/routes/delegation.js +2 -2
  74. package/build/routes/diagnostics.js +2 -2
  75. package/build/routes/docs.js +2 -2
  76. package/build/routes/domain.js +2 -2
  77. package/build/routes/escalations/accumulate.d.ts +1 -1
  78. package/build/routes/escalations/acting.d.ts +1 -1
  79. package/build/routes/escalations/analytics.d.ts +1 -1
  80. package/build/routes/escalations/bulk.d.ts +1 -1
  81. package/build/routes/escalations/facets.d.ts +1 -1
  82. package/build/routes/escalations/index.js +5 -2
  83. package/build/routes/escalations/list.d.ts +1 -1
  84. package/build/routes/escalations/list.js +2 -0
  85. package/build/routes/escalations/metadata.d.ts +1 -1
  86. package/build/routes/escalations/related.d.ts +7 -0
  87. package/build/routes/escalations/related.js +60 -0
  88. package/build/routes/escalations/resolve.d.ts +1 -1
  89. package/build/routes/escalations/single.d.ts +1 -1
  90. package/build/routes/escalations/single.js +1 -1
  91. package/build/routes/exports.js +14 -13
  92. package/build/routes/file-browser.js +9 -8
  93. package/build/routes/files.js +2 -2
  94. package/build/routes/index.js +4 -2
  95. package/build/routes/insight.js +5 -4
  96. package/build/routes/knowledge.js +2 -2
  97. package/build/routes/maintenance.js +2 -2
  98. package/build/routes/mcp-endpoint.d.ts +3 -1
  99. package/build/routes/mcp-endpoint.js +18 -8
  100. package/build/routes/mcp.js +35 -15
  101. package/build/routes/me.js +2 -2
  102. package/build/routes/namespaces.js +4 -3
  103. package/build/routes/nats-credentials.js +27 -3
  104. package/build/routes/oauth-server/authorize.d.ts +2 -0
  105. package/build/routes/oauth-server/authorize.js +108 -0
  106. package/build/routes/oauth-server/grants.d.ts +2 -0
  107. package/build/routes/oauth-server/grants.js +35 -0
  108. package/build/routes/oauth-server/index.d.ts +8 -0
  109. package/build/routes/oauth-server/index.js +52 -0
  110. package/build/routes/oauth-server/registration.d.ts +2 -0
  111. package/build/routes/oauth-server/registration.js +38 -0
  112. package/build/routes/oauth-server/token.d.ts +2 -0
  113. package/build/routes/oauth-server/token.js +100 -0
  114. package/build/routes/oauth-well-known.d.ts +8 -0
  115. package/build/routes/oauth-well-known.js +31 -0
  116. package/build/routes/oauth.js +2 -2
  117. package/build/routes/overview.js +2 -2
  118. package/build/routes/personas.js +2 -2
  119. package/build/routes/pipelines.js +6 -5
  120. package/build/routes/roles.js +2 -2
  121. package/build/routes/scan-codes.js +2 -2
  122. package/build/routes/settings.js +2 -2
  123. package/build/routes/tasks.js +5 -5
  124. package/build/routes/topics.js +21 -9
  125. package/build/routes/users.js +25 -22
  126. package/build/routes/workflow-sets.js +13 -12
  127. package/build/routes/workflows/config.js +15 -2
  128. package/build/routes/workflows/discovery.js +2 -2
  129. package/build/routes/workflows/index.js +2 -2
  130. package/build/routes/workflows/invocation.js +11 -10
  131. package/build/routes/yaml-workflows/cron.js +19 -6
  132. package/build/routes/yaml-workflows/crud.js +13 -12
  133. package/build/routes/yaml-workflows/deployment.js +11 -10
  134. package/build/routes/yaml-workflows/index.js +2 -2
  135. package/build/routes/yaml-workflows/versions.js +2 -2
  136. package/build/scripts/consolidation-sim.d.ts +25 -0
  137. package/build/scripts/consolidation-sim.js +141 -0
  138. package/build/sdk/index.d.ts +12 -0
  139. package/build/sdk/index.js +2 -0
  140. package/build/services/agent/authority.d.ts +14 -0
  141. package/build/services/agent/authority.js +53 -0
  142. package/build/services/auth/bot-api-key.d.ts +2 -0
  143. package/build/services/auth/bot-api-key.js +10 -0
  144. package/build/services/auth/oauth-server/access-token.d.ts +36 -0
  145. package/build/services/auth/oauth-server/access-token.js +80 -0
  146. package/build/services/auth/oauth-server/authorization.d.ts +47 -0
  147. package/build/services/auth/oauth-server/authorization.js +54 -0
  148. package/build/services/auth/oauth-server/constants.d.ts +11 -0
  149. package/build/services/auth/oauth-server/constants.js +16 -0
  150. package/build/services/auth/oauth-server/index.d.ts +3 -0
  151. package/build/services/auth/oauth-server/index.js +26 -0
  152. package/build/services/auth/oauth-server/metadata.d.ts +21 -0
  153. package/build/services/auth/oauth-server/metadata.js +53 -0
  154. package/build/services/auth/oauth-server/registration.d.ts +42 -0
  155. package/build/services/auth/oauth-server/registration.js +134 -0
  156. package/build/services/auth/oauth-server/sql.d.ts +34 -0
  157. package/build/services/auth/oauth-server/sql.js +123 -0
  158. package/build/services/auth/oauth-server/store.d.ts +74 -0
  159. package/build/services/auth/oauth-server/store.js +151 -0
  160. package/build/services/auth/sql.d.ts +1 -0
  161. package/build/services/auth/sql.js +3 -1
  162. package/build/services/escalation/grouped-list.d.ts +19 -0
  163. package/build/services/escalation/grouped-list.js +54 -0
  164. package/build/services/escalation/index.d.ts +4 -0
  165. package/build/services/escalation/index.js +9 -1
  166. package/build/services/escalation/queries.d.ts +17 -13
  167. package/build/services/escalation/queries.js +38 -42
  168. package/build/services/escalation/read-scope-sql.d.ts +13 -0
  169. package/build/services/escalation/read-scope-sql.js +19 -0
  170. package/build/services/escalation/related.d.ts +58 -0
  171. package/build/services/escalation/related.js +196 -0
  172. package/build/services/export/index.d.ts +10 -0
  173. package/build/services/export/index.js +27 -0
  174. package/build/services/invocation-access.d.ts +25 -4
  175. package/build/services/invocation-access.js +39 -7
  176. package/build/services/mcp/client/connection-dispatch.d.ts +6 -1
  177. package/build/services/mcp/client/connection-dispatch.js +3 -2
  178. package/build/services/mcp/client/connection-lifecycle.d.ts +10 -2
  179. package/build/services/mcp/client/connection-lifecycle.js +45 -7
  180. package/build/services/mcp/client/connection-test.js +2 -6
  181. package/build/services/mcp/client/connection.d.ts +1 -1
  182. package/build/services/mcp/client/connection.js +3 -1
  183. package/build/services/mcp/client/index.d.ts +2 -2
  184. package/build/services/mcp/client/index.js +4 -1
  185. package/build/services/mcp/client/network-transport.d.ts +12 -0
  186. package/build/services/mcp/client/network-transport.js +20 -0
  187. package/build/services/mcp/client/tools.d.ts +13 -0
  188. package/build/services/mcp/client/tools.js +18 -0
  189. package/build/services/mcp/db-server/index.js +2 -1
  190. package/build/services/mcp/external-server.d.ts +9 -4
  191. package/build/services/mcp/external-server.js +34 -11
  192. package/build/services/mcp/playwright-server/index.js +2 -1
  193. package/build/services/mcp/registered-tools.d.ts +3 -0
  194. package/build/services/mcp/registered-tools.js +7 -0
  195. package/build/services/mcp/server-lifecycle.js +2 -1
  196. package/build/services/role/index.js +6 -0
  197. package/build/services/role/seed.js +4 -0
  198. package/build/services/scan-code/validate-facts.d.ts +1 -1
  199. package/build/services/scan-code/validate-facts.js +12 -1
  200. package/build/services/workflow-invocation.d.ts +16 -3
  201. package/build/services/workflow-invocation.js +42 -10
  202. package/build/services/yaml-workflow/deployer.d.ts +10 -2
  203. package/build/services/yaml-workflow/deployer.js +17 -5
  204. package/build/services/yaml-workflow/invoke.js +27 -26
  205. package/build/shared/form-validation/x-lt-scan.d.ts +8 -0
  206. package/build/shared/form-validation/x-lt-scan.js +20 -1
  207. package/build/shared/list-schema/index.d.ts +3 -0
  208. package/build/shared/list-schema/index.js +27 -0
  209. package/build/shared/list-schema/template.d.ts +14 -0
  210. package/build/shared/list-schema/template.js +85 -0
  211. package/build/shared/list-schema/types.d.ts +154 -0
  212. package/build/shared/list-schema/types.js +55 -0
  213. package/build/shared/list-schema/validate.d.ts +12 -0
  214. package/build/shared/list-schema/validate.js +204 -0
  215. package/build/shared/roles/segment.d.ts +22 -0
  216. package/build/shared/roles/segment.js +42 -0
  217. package/build/start/adapters.js +2 -0
  218. package/build/start/config.js +7 -0
  219. package/build/start/index.js +4 -22
  220. package/build/start/server.d.ts +6 -4
  221. package/build/start/server.js +11 -35
  222. package/build/start/socket-auth.js +2 -1
  223. package/build/start/workers.js +1 -1
  224. package/build/system/mcp-servers/admin/agent-subscriptions.js +24 -1
  225. package/build/system/mcp-servers/admin/agents.js +25 -2
  226. package/build/system/mcp-servers/admin/announcements.js +3 -2
  227. package/build/system/mcp-servers/admin/bot-accounts.js +37 -5
  228. package/build/system/mcp-servers/admin/escalations.d.ts +3 -5
  229. package/build/system/mcp-servers/admin/escalations.js +74 -70
  230. package/build/system/mcp-servers/admin/exports.js +7 -1
  231. package/build/system/mcp-servers/admin/index.js +24 -25
  232. package/build/system/mcp-servers/admin/overview.d.ts +2 -2
  233. package/build/system/mcp-servers/admin/run-read.d.ts +2 -0
  234. package/build/system/mcp-servers/admin/run-read.js +5 -0
  235. package/build/system/mcp-servers/admin/scan-codes.d.ts +2 -2
  236. package/build/system/mcp-servers/admin/scan-codes.js +5 -11
  237. package/build/system/mcp-servers/admin/schemas.d.ts +20 -20
  238. package/build/system/mcp-servers/admin/tasks.js +7 -2
  239. package/build/system/mcp-servers/admin/users.js +39 -4
  240. package/build/system/mcp-servers/admin/workflow-config.js +12 -1
  241. package/build/system/mcp-servers/admin/workflows.js +27 -5
  242. package/build/system/mcp-servers/admin/yaml-workflows.js +7 -1
  243. package/build/system/mcp-servers/caller-auth.d.ts +18 -0
  244. package/build/system/mcp-servers/caller-auth.js +29 -0
  245. package/build/system/mcp-servers/claude-code.js +2 -1
  246. package/build/system/mcp-servers/db-query/index.js +2 -1
  247. package/build/system/mcp-servers/file-storage.js +2 -1
  248. package/build/system/mcp-servers/http-fetch.js +2 -1
  249. package/build/system/mcp-servers/human-queue.js +7 -3
  250. package/build/system/mcp-servers/oauth.js +31 -4
  251. package/build/system/mcp-servers/schema-exchange.js +2 -1
  252. package/build/system/mcp-servers/vision.d.ts +1 -0
  253. package/build/system/mcp-servers/vision.js +17 -7
  254. package/build/system/seed/tool-manifests-admin.d.ts +2 -17985
  255. package/build/system/seed/tool-manifests-admin.js +121 -121
  256. package/build/system/seed/tool-manifests-data.d.ts +8 -374
  257. package/build/system/seed/tool-manifests-data.js +22 -4
  258. package/build/system/seed/tool-manifests-escalation.d.ts +2 -352
  259. package/build/system/seed/tool-manifests-escalation.js +11 -1
  260. package/build/system/seed/tool-manifests-events.d.ts +2 -116
  261. package/build/system/seed/tool-manifests-events.js +6 -2
  262. package/build/system/seed/tool-manifests-knowledge.d.ts +2 -221
  263. package/build/system/seed/tool-manifests-knowledge.js +41 -1
  264. package/build/system/seed/tool-manifests-workflows.d.ts +2 -71
  265. package/build/system/seed/tool-manifests-workflows.js +3 -1
  266. package/build/system/workflows/shared/principal-tools.d.ts +20 -0
  267. package/build/system/workflows/shared/principal-tools.js +64 -0
  268. package/build/system/workflows/shared/tool-executor.js +21 -11
  269. package/build/system/workflows/shared/tool-loader.js +8 -1
  270. package/build/tsconfig.tsbuildinfo +1 -1
  271. package/build/types/auth.d.ts +1 -1
  272. package/build/types/capability.d.ts +14 -0
  273. package/build/types/capability.js +2 -0
  274. package/build/types/events.d.ts +1 -1
  275. package/build/types/index.d.ts +5 -3
  276. package/build/types/index.js +2 -1
  277. package/build/types/mcp.d.ts +3 -1
  278. package/build/types/oauth-server.d.ts +52 -0
  279. package/build/types/oauth-server.js +2 -0
  280. package/build/types/scan-code/constants.d.ts +7 -0
  281. package/build/types/scan-code/constants.js +7 -1
  282. package/build/types/scan-code/response.d.ts +3 -2
  283. package/build/types/scan-code/rule.d.ts +6 -1
  284. package/build/types/startup.d.ts +23 -7
  285. package/build/vitest.config.js +2 -1
  286. package/build/vitest.fast.config.d.ts +2 -0
  287. package/build/vitest.fast.config.js +20 -0
  288. package/build/vitest.llm.config.d.ts +2 -0
  289. package/build/vitest.llm.config.js +16 -0
  290. package/dashboard/dist/assets/{AdminDashboard-DKrqLGjn.js → AdminDashboard-B3mkMIOT.js} +2 -2
  291. package/dashboard/dist/assets/{AdminDashboard-DKrqLGjn.js.map → AdminDashboard-B3mkMIOT.js.map} +1 -1
  292. package/dashboard/dist/assets/{AgentConfigPage-BoQhRW6U.js → AgentConfigPage-CQj2B678.js} +2 -2
  293. package/dashboard/dist/assets/{AgentConfigPage-BoQhRW6U.js.map → AgentConfigPage-CQj2B678.js.map} +1 -1
  294. package/dashboard/dist/assets/{AgentDetailPage-DZhzuZmO.js → AgentDetailPage-CzrD8JJI.js} +3 -3
  295. package/dashboard/dist/assets/{AgentDetailPage-DZhzuZmO.js.map → AgentDetailPage-CzrD8JJI.js.map} +1 -1
  296. package/dashboard/dist/assets/{AgentsPage-5MynmbWX.js → AgentsPage-jg2OFwyW.js} +2 -2
  297. package/dashboard/dist/assets/{AgentsPage-5MynmbWX.js.map → AgentsPage-jg2OFwyW.js.map} +1 -1
  298. package/dashboard/dist/assets/AvailableEscalationsPage-IS28XBRe.js +2 -0
  299. package/dashboard/dist/assets/AvailableEscalationsPage-IS28XBRe.js.map +1 -0
  300. package/dashboard/dist/assets/{BotPicker-C3LR6Sqy.js → BotPicker-DvEJFpwS.js} +2 -2
  301. package/dashboard/dist/assets/{BotPicker-C3LR6Sqy.js.map → BotPicker-DvEJFpwS.js.map} +1 -1
  302. package/dashboard/dist/assets/{BulkAssignModal-COjoOIIH.js → BulkAssignModal-BoQCi-YC.js} +2 -2
  303. package/dashboard/dist/assets/{BulkAssignModal-COjoOIIH.js.map → BulkAssignModal-BoQCi-YC.js.map} +1 -1
  304. package/dashboard/dist/assets/CapabilitiesPage-kwlrcb_t.js +2 -0
  305. package/dashboard/dist/assets/{CapabilitiesPage-DKxLvOfB.js.map → CapabilitiesPage-kwlrcb_t.js.map} +1 -1
  306. package/dashboard/dist/assets/{CollapsibleSection-Cz5sRx-r.js → CollapsibleSection-UMIV4KIj.js} +2 -2
  307. package/dashboard/dist/assets/{CollapsibleSection-Cz5sRx-r.js.map → CollapsibleSection-UMIV4KIj.js.map} +1 -1
  308. package/dashboard/dist/assets/ConfirmDeleteModal-C5puwMg7.js +2 -0
  309. package/dashboard/dist/assets/ConfirmDeleteModal-C5puwMg7.js.map +1 -0
  310. package/dashboard/dist/assets/ConnectedAppsPage-drZa65kP.js +2 -0
  311. package/dashboard/dist/assets/ConnectedAppsPage-drZa65kP.js.map +1 -0
  312. package/dashboard/dist/assets/CountdownTimer-LG03dVgR.js +2 -0
  313. package/dashboard/dist/assets/CountdownTimer-LG03dVgR.js.map +1 -0
  314. package/dashboard/dist/assets/{CredentialsPage-DhiHiPsG.js → CredentialsPage-CaFQ6vLb.js} +2 -2
  315. package/dashboard/dist/assets/{CredentialsPage-DhiHiPsG.js.map → CredentialsPage-CaFQ6vLb.js.map} +1 -1
  316. package/dashboard/dist/assets/{CronLabel-C9SkawB-.js → CronLabel-Co5j7tzW.js} +2 -2
  317. package/dashboard/dist/assets/{CronLabel-C9SkawB-.js.map → CronLabel-Co5j7tzW.js.map} +1 -1
  318. package/dashboard/dist/assets/DataTable-FjFhx0SE.js +2 -0
  319. package/dashboard/dist/assets/DataTable-FjFhx0SE.js.map +1 -0
  320. package/dashboard/dist/assets/{ElapsedCell-BeK1SUDK.js → ElapsedCell-WJyE9G0T.js} +2 -2
  321. package/dashboard/dist/assets/{ElapsedCell-BeK1SUDK.js.map → ElapsedCell-WJyE9G0T.js.map} +1 -1
  322. package/dashboard/dist/assets/{EntityTimelinePanel-BThdefKj.js → EntityTimelinePanel-CDFFfX9d.js} +2 -2
  323. package/dashboard/dist/assets/{EntityTimelinePanel-BThdefKj.js.map → EntityTimelinePanel-CDFFfX9d.js.map} +1 -1
  324. package/dashboard/dist/assets/{EscalationListSchemaPage-DlDIYb-p.js → EscalationListSchemaPage-CMrUlaKI.js} +3 -3
  325. package/dashboard/dist/assets/{EscalationListSchemaPage-DlDIYb-p.js.map → EscalationListSchemaPage-CMrUlaKI.js.map} +1 -1
  326. package/dashboard/dist/assets/{EscalationSchemaPage-CQt-Embr.js → EscalationSchemaPage-Dx2Lyfrz.js} +3 -3
  327. package/dashboard/dist/assets/{EscalationSchemaPage-CQt-Embr.js.map → EscalationSchemaPage-Dx2Lyfrz.js.map} +1 -1
  328. package/dashboard/dist/assets/EscalationTimeline-d3nvshOk.js +2 -0
  329. package/dashboard/dist/assets/EscalationTimeline-d3nvshOk.js.map +1 -0
  330. package/dashboard/dist/assets/{EscalationTitleSelect-Dewrv8wX.js → EscalationTitleSelect-DWQieOM9.js} +2 -2
  331. package/dashboard/dist/assets/{EscalationTitleSelect-Dewrv8wX.js.map → EscalationTitleSelect-DWQieOM9.js.map} +1 -1
  332. package/dashboard/dist/assets/{EscalationsOverview-BzH-Y-5x.js → EscalationsOverview-BX8Cpi0X.js} +2 -2
  333. package/dashboard/dist/assets/{EscalationsOverview-BzH-Y-5x.js.map → EscalationsOverview-BX8Cpi0X.js.map} +1 -1
  334. package/dashboard/dist/assets/{EventTable-C97m6IZv.js → EventTable-D1-ITVXS.js} +2 -2
  335. package/dashboard/dist/assets/{EventTable-C97m6IZv.js.map → EventTable-D1-ITVXS.js.map} +1 -1
  336. package/dashboard/dist/assets/{FilterBar-D-6xVHIw.js → FilterBar-ABC9ctin.js} +2 -2
  337. package/dashboard/dist/assets/{FilterBar-D-6xVHIw.js.map → FilterBar-ABC9ctin.js.map} +1 -1
  338. package/dashboard/dist/assets/FormattedValue-k27T4bG7.js +2 -0
  339. package/dashboard/dist/assets/FormattedValue-k27T4bG7.js.map +1 -0
  340. package/dashboard/dist/assets/{GraphInvokePage-Bwi8EF9Y.js → GraphInvokePage-DKUErxWc.js} +2 -2
  341. package/dashboard/dist/assets/{GraphInvokePage-Bwi8EF9Y.js.map → GraphInvokePage-DKUErxWc.js.map} +1 -1
  342. package/dashboard/dist/assets/{HomePage-Z_Q03C0z.js → HomePage-C6u9dIpR.js} +2 -2
  343. package/dashboard/dist/assets/{HomePage-Z_Q03C0z.js.map → HomePage-C6u9dIpR.js.map} +1 -1
  344. package/dashboard/dist/assets/{ListToolbar-_jWTw5no.js → ListToolbar-gA5rFzkz.js} +2 -2
  345. package/dashboard/dist/assets/{ListToolbar-_jWTw5no.js.map → ListToolbar-gA5rFzkz.js.map} +1 -1
  346. package/dashboard/dist/assets/{McpOverview-CjqTuP0N.js → McpOverview-BOPo3J_i.js} +2 -2
  347. package/dashboard/dist/assets/{McpOverview-CjqTuP0N.js.map → McpOverview-BOPo3J_i.js.map} +1 -1
  348. package/dashboard/dist/assets/{McpQueryDetailPage-leCsje1U.js → McpQueryDetailPage-BRVVi0Zh.js} +2 -2
  349. package/dashboard/dist/assets/{McpQueryDetailPage-leCsje1U.js.map → McpQueryDetailPage-BRVVi0Zh.js.map} +1 -1
  350. package/dashboard/dist/assets/{McpQueryPage-C-PyXYX4.js → McpQueryPage-Dmbb6SAc.js} +2 -2
  351. package/dashboard/dist/assets/{McpQueryPage-C-PyXYX4.js.map → McpQueryPage-Dmbb6SAc.js.map} +1 -1
  352. package/dashboard/dist/assets/{McpRunDetailPage-JDrr3uUQ.js → McpRunDetailPage-bMXNO-6V.js} +2 -2
  353. package/dashboard/dist/assets/{McpRunDetailPage-JDrr3uUQ.js.map → McpRunDetailPage-bMXNO-6V.js.map} +1 -1
  354. package/dashboard/dist/assets/{McpRunsPage-DERXQLgZ.js → McpRunsPage-Bi9AMWja.js} +2 -2
  355. package/dashboard/dist/assets/{McpRunsPage-DERXQLgZ.js.map → McpRunsPage-Bi9AMWja.js.map} +1 -1
  356. package/dashboard/dist/assets/{OperationsPage-B2DA7n9m.js → OperationsPage-CvR74ZUJ.js} +3 -3
  357. package/dashboard/dist/assets/OperationsPage-CvR74ZUJ.js.map +1 -0
  358. package/dashboard/dist/assets/OperatorDashboard-DctmZw10.js +2 -0
  359. package/dashboard/dist/assets/OperatorDashboard-DctmZw10.js.map +1 -0
  360. package/dashboard/dist/assets/{PersonaDetailPage-ChXwJ6u5.js → PersonaDetailPage-Ubqm2rQH.js} +2 -2
  361. package/dashboard/dist/assets/{PersonaDetailPage-ChXwJ6u5.js.map → PersonaDetailPage-Ubqm2rQH.js.map} +1 -1
  362. package/dashboard/dist/assets/{PersonasPage-BFFxncSE.js → PersonasPage-BpFL2rpo.js} +2 -2
  363. package/dashboard/dist/assets/{PersonasPage-BFFxncSE.js.map → PersonasPage-BpFL2rpo.js.map} +1 -1
  364. package/dashboard/dist/assets/PortalPage-Dfc_Q02R.js +2 -0
  365. package/dashboard/dist/assets/PortalPage-Dfc_Q02R.js.map +1 -0
  366. package/dashboard/dist/assets/ProcessDetailPage-liJspvQh.js +2 -0
  367. package/dashboard/dist/assets/{ProcessDetailPage-D7EYwW-j.js.map → ProcessDetailPage-liJspvQh.js.map} +1 -1
  368. package/dashboard/dist/assets/{ProcessesListPage-CakYRtnE.js → ProcessesListPage-C3OM5ZUy.js} +2 -2
  369. package/dashboard/dist/assets/{ProcessesListPage-CakYRtnE.js.map → ProcessesListPage-C3OM5ZUy.js.map} +1 -1
  370. package/dashboard/dist/assets/ResolverForm-B1_x8Blv.js +8 -0
  371. package/dashboard/dist/assets/ResolverForm-B1_x8Blv.js.map +1 -0
  372. package/dashboard/dist/assets/{RoleDetailPage-CKbGwezP.js → RoleDetailPage-CrlYCh-R.js} +2 -2
  373. package/dashboard/dist/assets/{RoleDetailPage-CKbGwezP.js.map → RoleDetailPage-CrlYCh-R.js.map} +1 -1
  374. package/dashboard/dist/assets/{RolesPage-Czu7Zku4.js → RolesPage-BaazL_pt.js} +2 -2
  375. package/dashboard/dist/assets/{RolesPage-Czu7Zku4.js.map → RolesPage-BaazL_pt.js.map} +1 -1
  376. package/dashboard/dist/assets/{RunAsSelector-6BLScYTX.js → RunAsSelector-DxuV0fa1.js} +2 -2
  377. package/dashboard/dist/assets/{RunAsSelector-6BLScYTX.js.map → RunAsSelector-DxuV0fa1.js.map} +1 -1
  378. package/dashboard/dist/assets/{ScanCodesPage-Cv9q8Bvt.js → ScanCodesPage-C0mvmYTq.js} +2 -2
  379. package/dashboard/dist/assets/{ScanCodesPage-Cv9q8Bvt.js.map → ScanCodesPage-C0mvmYTq.js.map} +1 -1
  380. package/dashboard/dist/assets/{ScanSchemeDetailPage-BxazXYIc.js → ScanSchemeDetailPage-CiJgt5dZ.js} +2 -2
  381. package/dashboard/dist/assets/{ScanSchemeDetailPage-BxazXYIc.js.map → ScanSchemeDetailPage-CiJgt5dZ.js.map} +1 -1
  382. package/dashboard/dist/assets/ScanStationPage-DzGaXc40.js +2 -0
  383. package/dashboard/dist/assets/ScanStationPage-DzGaXc40.js.map +1 -0
  384. package/dashboard/dist/assets/{StickyPagination-DsdtYoXR.js → StickyPagination-CqbjVY6T.js} +2 -2
  385. package/dashboard/dist/assets/{StickyPagination-DsdtYoXR.js.map → StickyPagination-CqbjVY6T.js.map} +1 -1
  386. package/dashboard/dist/assets/{StreamMessageDetail-CT3FQoT3.js → StreamMessageDetail-wX3i0aqs.js} +2 -2
  387. package/dashboard/dist/assets/{StreamMessageDetail-CT3FQoT3.js.map → StreamMessageDetail-wX3i0aqs.js.map} +1 -1
  388. package/dashboard/dist/assets/{SwimlaneTimeline-C8TjkJ10.js → SwimlaneTimeline-C50PsFoV.js} +2 -2
  389. package/dashboard/dist/assets/{SwimlaneTimeline-C8TjkJ10.js.map → SwimlaneTimeline-C50PsFoV.js.map} +1 -1
  390. package/dashboard/dist/assets/{TaskDetailPage-DGUzdBFN.js → TaskDetailPage-bbNSv4Ae.js} +2 -2
  391. package/dashboard/dist/assets/{TaskDetailPage-DGUzdBFN.js.map → TaskDetailPage-bbNSv4Ae.js.map} +1 -1
  392. package/dashboard/dist/assets/{TasksListPage-BVIP6-EZ.js → TasksListPage-CDWnm_d9.js} +2 -2
  393. package/dashboard/dist/assets/{TasksListPage-BVIP6-EZ.js.map → TasksListPage-CDWnm_d9.js.map} +1 -1
  394. package/dashboard/dist/assets/{TimeAgo-C-rd9F9g.js → TimeAgo-BLjqlfoX.js} +2 -2
  395. package/dashboard/dist/assets/{TimeAgo-C-rd9F9g.js.map → TimeAgo-BLjqlfoX.js.map} +1 -1
  396. package/dashboard/dist/assets/{TimestampCell-DPbchDOI.js → TimestampCell-CnW0ENb5.js} +2 -2
  397. package/dashboard/dist/assets/{TimestampCell-DPbchDOI.js.map → TimestampCell-CnW0ENb5.js.map} +1 -1
  398. package/dashboard/dist/assets/{ToolTestPanel-DAUC8DHK.js → ToolTestPanel-DkMgCB-k.js} +2 -2
  399. package/dashboard/dist/assets/{ToolTestPanel-DAUC8DHK.js.map → ToolTestPanel-DkMgCB-k.js.map} +1 -1
  400. package/dashboard/dist/assets/{TopicDetailPage-70mMKBzG.js → TopicDetailPage-g3pljKKX.js} +2 -2
  401. package/dashboard/dist/assets/{TopicDetailPage-70mMKBzG.js.map → TopicDetailPage-g3pljKKX.js.map} +1 -1
  402. package/dashboard/dist/assets/{TopicsPage-CE3hBthn.js → TopicsPage-CVcCYdy-.js} +2 -2
  403. package/dashboard/dist/assets/{TopicsPage-CE3hBthn.js.map → TopicsPage-CVcCYdy-.js.map} +1 -1
  404. package/dashboard/dist/assets/{UserName-BDBDA-LR.js → UserName-D6zGIK2i.js} +2 -2
  405. package/dashboard/dist/assets/{UserName-BDBDA-LR.js.map → UserName-D6zGIK2i.js.map} +1 -1
  406. package/dashboard/dist/assets/{WorkflowExecutionPage-BbkLZ1co.js → WorkflowExecutionPage-B8g81FCJ.js} +2 -2
  407. package/dashboard/dist/assets/{WorkflowExecutionPage-BbkLZ1co.js.map → WorkflowExecutionPage-B8g81FCJ.js.map} +1 -1
  408. package/dashboard/dist/assets/{WorkflowsDashboard-Bp1L7Ggz.js → WorkflowsDashboard-nxT3bv6W.js} +2 -2
  409. package/dashboard/dist/assets/{WorkflowsDashboard-Bp1L7Ggz.js.map → WorkflowsDashboard-nxT3bv6W.js.map} +1 -1
  410. package/dashboard/dist/assets/{WorkflowsOverview-IeTKHAi4.js → WorkflowsOverview-grI-KAI2.js} +2 -2
  411. package/dashboard/dist/assets/{WorkflowsOverview-IeTKHAi4.js.map → WorkflowsOverview-grI-KAI2.js.map} +1 -1
  412. package/dashboard/dist/assets/{YamlWorkflowDetailPage-DtKCXnKt.js → YamlWorkflowDetailPage-BoZ-hfBE.js} +2 -2
  413. package/dashboard/dist/assets/{YamlWorkflowDetailPage-DtKCXnKt.js.map → YamlWorkflowDetailPage-BoZ-hfBE.js.map} +1 -1
  414. package/dashboard/dist/assets/{YamlWorkflowsPage-CEcZBV_3.js → YamlWorkflowsPage-Bf04rwRv.js} +2 -2
  415. package/dashboard/dist/assets/{YamlWorkflowsPage-CEcZBV_3.js.map → YamlWorkflowsPage-Bf04rwRv.js.map} +1 -1
  416. package/dashboard/dist/assets/{agents-BT-sEk81.js → agents-Dphpdi8l.js} +2 -2
  417. package/dashboard/dist/assets/{agents-BT-sEk81.js.map → agents-Dphpdi8l.js.map} +1 -1
  418. package/dashboard/dist/assets/{bots-DRoAdLek.js → bots-DIFE298x.js} +2 -2
  419. package/dashboard/dist/assets/{bots-DRoAdLek.js.map → bots-DIFE298x.js.map} +1 -1
  420. package/dashboard/dist/assets/{capabilities-Bc-nJk6y.js → capabilities-D7Y7LClY.js} +2 -2
  421. package/dashboard/dist/assets/{capabilities-Bc-nJk6y.js.map → capabilities-D7Y7LClY.js.map} +1 -1
  422. package/dashboard/dist/assets/{controlplane-aXceSIRf.js → controlplane-D1TGcYsS.js} +2 -2
  423. package/dashboard/dist/assets/{controlplane-aXceSIRf.js.map → controlplane-D1TGcYsS.js.map} +1 -1
  424. package/dashboard/dist/assets/escalation-columns-cwZE6xyo.js +2 -0
  425. package/dashboard/dist/assets/escalation-columns-cwZE6xyo.js.map +1 -0
  426. package/dashboard/dist/assets/{index-CuBGGwXf.js → index-BzYcUPdD.js} +2 -2
  427. package/dashboard/dist/assets/{index-CuBGGwXf.js.map → index-BzYcUPdD.js.map} +1 -1
  428. package/dashboard/dist/assets/index-CeCtqujG.js +67 -0
  429. package/dashboard/dist/assets/index-CeCtqujG.js.map +1 -0
  430. package/dashboard/dist/assets/{index-h2gX31B2.js → index-ChV7pBjM.js} +2 -2
  431. package/dashboard/dist/assets/{index-h2gX31B2.js.map → index-ChV7pBjM.js.map} +1 -1
  432. package/dashboard/dist/assets/index-CniRa65p.js +3 -0
  433. package/dashboard/dist/assets/index-CniRa65p.js.map +1 -0
  434. package/dashboard/dist/assets/index-CxdjT1Yk.js +2 -0
  435. package/dashboard/dist/assets/{index-BCFEQEMC.js.map → index-CxdjT1Yk.js.map} +1 -1
  436. package/dashboard/dist/assets/{index-CZyO9hRb.js → index-DAvi5_2T.js} +2 -2
  437. package/dashboard/dist/assets/{index-CZyO9hRb.js.map → index-DAvi5_2T.js.map} +1 -1
  438. package/dashboard/dist/assets/{index-Djsoi8DI.js → index-DN-kX7hL.js} +2 -2
  439. package/dashboard/dist/assets/{index-Djsoi8DI.js.map → index-DN-kX7hL.js.map} +1 -1
  440. package/dashboard/dist/assets/index-Dl_8hbYI.js +2 -0
  441. package/dashboard/dist/assets/index-Dl_8hbYI.js.map +1 -0
  442. package/dashboard/dist/assets/{index-DBxpyIw5.js → index-DpKOr311.js} +2 -2
  443. package/dashboard/dist/assets/{index-DBxpyIw5.js.map → index-DpKOr311.js.map} +1 -1
  444. package/dashboard/dist/assets/{index-Ba-s5Yb5.js → index-Dy1wWu2e.js} +2 -2
  445. package/dashboard/dist/assets/{index-Ba-s5Yb5.js.map → index-Dy1wWu2e.js.map} +1 -1
  446. package/dashboard/dist/assets/{index-DH03y-UT.js → index-HLu98Sqh.js} +2 -2
  447. package/dashboard/dist/assets/{index-DH03y-UT.js.map → index-HLu98Sqh.js.map} +1 -1
  448. package/dashboard/dist/assets/{index-C3VTJcrp.js → index-ag2pCAPu.js} +2 -2
  449. package/dashboard/dist/assets/{index-C3VTJcrp.js.map → index-ag2pCAPu.js.map} +1 -1
  450. package/dashboard/dist/assets/index-gkxPN7Vx.js +13 -0
  451. package/dashboard/dist/assets/{index-BEPKAjna.js.map → index-gkxPN7Vx.js.map} +1 -1
  452. package/dashboard/dist/assets/index-m9A3UYst.css +1 -0
  453. package/dashboard/dist/assets/{knowledge-BhW8V-Hq.js → knowledge-DnMs-SOJ.js} +2 -2
  454. package/dashboard/dist/assets/{knowledge-BhW8V-Hq.js.map → knowledge-DnMs-SOJ.js.map} +1 -1
  455. package/dashboard/dist/assets/{mcp-BYfSMQzh.js → mcp-CwW-K3r4.js} +2 -2
  456. package/dashboard/dist/assets/{mcp-BYfSMQzh.js.map → mcp-CwW-K3r4.js.map} +1 -1
  457. package/dashboard/dist/assets/{mcp-query-DUJoOk_q.js → mcp-query-BZt5e8_Q.js} +2 -2
  458. package/dashboard/dist/assets/{mcp-query-DUJoOk_q.js.map → mcp-query-BZt5e8_Q.js.map} +1 -1
  459. package/dashboard/dist/assets/{personas-jT1O_SB4.js → personas-UA-Xn60f.js} +2 -2
  460. package/dashboard/dist/assets/{personas-jT1O_SB4.js.map → personas-UA-Xn60f.js.map} +1 -1
  461. package/dashboard/dist/assets/{pipelines-Bp-wIaz2.js → pipelines-Cu3PARum.js} +2 -2
  462. package/dashboard/dist/assets/{pipelines-Bp-wIaz2.js.map → pipelines-Cu3PARum.js.map} +1 -1
  463. package/dashboard/dist/assets/{tasks-CCrvnXbz.js → tasks-BO6h8GJE.js} +2 -2
  464. package/dashboard/dist/assets/{tasks-CCrvnXbz.js.map → tasks-BO6h8GJE.js.map} +1 -1
  465. package/dashboard/dist/assets/{topics-Blft0I1L.js → topics-CWjCR-17.js} +2 -2
  466. package/dashboard/dist/assets/{topics-Blft0I1L.js.map → topics-CWjCR-17.js.map} +1 -1
  467. package/dashboard/dist/assets/{useDebouncedValue-BYqbcism.js → useDebouncedValue-6t0jx1RB.js} +2 -2
  468. package/dashboard/dist/assets/{useDebouncedValue-BYqbcism.js.map → useDebouncedValue-6t0jx1RB.js.map} +1 -1
  469. package/dashboard/dist/assets/{useNamespace-BfxJAUgG.js → useNamespace-CqpoQx6D.js} +2 -2
  470. package/dashboard/dist/assets/{useNamespace-BfxJAUgG.js.map → useNamespace-CqpoQx6D.js.map} +1 -1
  471. package/dashboard/dist/assets/{useYamlActivityEvents-BukJuWpb.js → useYamlActivityEvents-hmCQQwzB.js} +2 -2
  472. package/dashboard/dist/assets/{useYamlActivityEvents-BukJuWpb.js.map → useYamlActivityEvents-hmCQQwzB.js.map} +1 -1
  473. package/dashboard/dist/assets/validate-BIRn4a6d.js +2 -0
  474. package/dashboard/dist/assets/validate-BIRn4a6d.js.map +1 -0
  475. package/dashboard/dist/assets/{yaml-workflows-DeRWqMGk.js → yaml-workflows-ziUdZhKY.js} +2 -2
  476. package/dashboard/dist/assets/{yaml-workflows-DeRWqMGk.js.map → yaml-workflows-ziUdZhKY.js.map} +1 -1
  477. package/dashboard/dist/index.html +2 -2
  478. package/docs/agents.md +3 -1
  479. package/docs/api/http/agents.md +15 -1
  480. package/docs/api/http/escalations.md +49 -3
  481. package/docs/api/http/exports.md +3 -1
  482. package/docs/api/http/file-browser.md +3 -1
  483. package/docs/api/http/mcp-endpoint.md +5 -2
  484. package/docs/api/http/mcp-servers.md +34 -4
  485. package/docs/api/http/namespaces.md +2 -0
  486. package/docs/api/http/pipelines.md +2 -0
  487. package/docs/api/http/roles.md +11 -8
  488. package/docs/api/http/service-accounts.md +8 -2
  489. package/docs/api/http/settings.md +29 -2
  490. package/docs/api/http/tasks.md +3 -1
  491. package/docs/api/http/topics.md +7 -1
  492. package/docs/api/http/users.md +8 -2
  493. package/docs/api/http/workflows.md +25 -10
  494. package/docs/api/http/yaml-workflows.md +21 -0
  495. package/docs/api/mcp/admin.md +409 -49
  496. package/docs/api/mcp/file-storage.md +4 -0
  497. package/docs/api/mcp/http-fetch.md +6 -2
  498. package/docs/api/mcp/human-queue.md +53 -0
  499. package/docs/api/mcp/index.md +13 -10
  500. package/docs/api/mcp/knowledge.md +34 -0
  501. package/docs/api/mcp/oauth.md +1 -1
  502. package/docs/api/mcp/ortho.md +113 -0
  503. package/docs/api/mcp/vision.md +1 -1
  504. package/docs/api/sdk/bot-accounts.md +1 -0
  505. package/docs/api/sdk/escalations.md +18 -2
  506. package/docs/api/sdk/mcp.md +2 -2
  507. package/docs/api/sdk/settings.md +1 -1
  508. package/docs/api/sdk/tasks.md +2 -2
  509. package/docs/api/sdk/workflows.md +2 -2
  510. package/docs/api/sdk/yaml-workflows.md +1 -1
  511. package/docs/architecture.md +3 -1
  512. package/docs/auth.md +3 -2
  513. package/docs/cloud.md +7 -2
  514. package/docs/code-owned-configuration.md +12 -0
  515. package/docs/dashboard.md +16 -7
  516. package/docs/data.md +1 -1
  517. package/docs/escalation-strategies.md +9 -20
  518. package/docs/events.md +6 -0
  519. package/docs/hitl/portal.md +2 -0
  520. package/docs/hitl/x-lt-list-schema.md +88 -1
  521. package/docs/hitl/x-lt-scan.md +4 -1
  522. package/docs/iam.md +7 -5
  523. package/docs/mcp.md +159 -210
  524. package/docs/oauth-and-delegation.md +32 -21
  525. package/docs/scan-codes.md +7 -1
  526. package/docs/topics.md +2 -0
  527. package/docs/workflows.md +14 -112
  528. package/package.json +6 -3
  529. package/dashboard/dist/assets/AvailableEscalationsPage-CWMyy3IL.js +0 -2
  530. package/dashboard/dist/assets/AvailableEscalationsPage-CWMyy3IL.js.map +0 -1
  531. package/dashboard/dist/assets/CapabilitiesPage-DKxLvOfB.js +0 -2
  532. package/dashboard/dist/assets/ConfirmDeleteModal-Beq1vQtY.js +0 -2
  533. package/dashboard/dist/assets/ConfirmDeleteModal-Beq1vQtY.js.map +0 -1
  534. package/dashboard/dist/assets/CountdownTimer-BUBl_4mP.js +0 -2
  535. package/dashboard/dist/assets/CountdownTimer-BUBl_4mP.js.map +0 -1
  536. package/dashboard/dist/assets/DataTable-spX1dFyb.js +0 -2
  537. package/dashboard/dist/assets/DataTable-spX1dFyb.js.map +0 -1
  538. package/dashboard/dist/assets/EscalationListView-DTIVuym4.js +0 -2
  539. package/dashboard/dist/assets/EscalationListView-DTIVuym4.js.map +0 -1
  540. package/dashboard/dist/assets/EscalationTimeline-DNKNp6pL.js +0 -2
  541. package/dashboard/dist/assets/EscalationTimeline-DNKNp6pL.js.map +0 -1
  542. package/dashboard/dist/assets/OperationsPage-B2DA7n9m.js.map +0 -1
  543. package/dashboard/dist/assets/OperatorDashboard-C8RtPv8P.js +0 -2
  544. package/dashboard/dist/assets/OperatorDashboard-C8RtPv8P.js.map +0 -1
  545. package/dashboard/dist/assets/PortalPage-Xk1zVneM.js +0 -2
  546. package/dashboard/dist/assets/PortalPage-Xk1zVneM.js.map +0 -1
  547. package/dashboard/dist/assets/ProcessDetailPage-D7EYwW-j.js +0 -2
  548. package/dashboard/dist/assets/ResolverForm-BwVOJUpJ.js +0 -8
  549. package/dashboard/dist/assets/ResolverForm-BwVOJUpJ.js.map +0 -1
  550. package/dashboard/dist/assets/ScanStationPage-Cg8LCFR7.js +0 -2
  551. package/dashboard/dist/assets/ScanStationPage-Cg8LCFR7.js.map +0 -1
  552. package/dashboard/dist/assets/escalation-columns-Bf09Q89t.js +0 -2
  553. package/dashboard/dist/assets/escalation-columns-Bf09Q89t.js.map +0 -1
  554. package/dashboard/dist/assets/index-BCFEQEMC.js +0 -2
  555. package/dashboard/dist/assets/index-BEPKAjna.js +0 -13
  556. package/dashboard/dist/assets/index-BUYokcrl.js +0 -67
  557. package/dashboard/dist/assets/index-BUYokcrl.js.map +0 -1
  558. package/dashboard/dist/assets/index-CcgmR-7-.js +0 -2
  559. package/dashboard/dist/assets/index-CcgmR-7-.js.map +0 -1
  560. package/dashboard/dist/assets/index-D1mKf_qz.js +0 -3
  561. package/dashboard/dist/assets/index-D1mKf_qz.js.map +0 -1
  562. package/dashboard/dist/assets/index-DcppjzP5.css +0 -1
@@ -0,0 +1,67 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ProcessesListPage-C3OM5ZUy.js","./vendor-query-DvWWuNIB.js","./tasks-BO6h8GJE.js","./useFilterParams-DBRw1Hcv.js","./vendor-react-_9U4mKFr.js","./useDebouncedValue-6t0jx1RB.js","./api-path-u2Jf9QXS.js","./DataTable-FjFhx0SE.js","./EmptyState-DgC_6njU.js","./useContainerWidth-DSLp1gEm.js","./TimestampCell-CnW0ENb5.js","./StickyPagination-CqbjVY6T.js","./FilterBar-ABC9ctin.js","./vendor-icons-CeVtUKyP.js","./PageHeader-CMd3f4bz.js","./ListToolbar-gA5rFzkz.js","./WorkflowPill-Dg7BDTyM.js","./ProcessDetailPage-liJspvQh.js","./PageHeaderWithStats-DHj8Mqox.js","./StatusBadge-DHVwxre2.js","./RolePill-Di2CAHuD.js","./UserName-D6zGIK2i.js","./McpOverview-BOPo3J_i.js","./mcp-CwW-K3r4.js","./pipelines-Cu3PARum.js","./yaml-workflows-ziUdZhKY.js","./controlplane-D1TGcYsS.js","./StatCard-nWY4sndl.js","./McpRunsPage-Bi9AMWja.js","./useNamespace-CqpoQx6D.js","./ElapsedCell-WJyE9G0T.js","./RowActions-Bdd7z4eB.js","./McpRunDetailPage-bMXNO-6V.js","./SegmentedTabs-BpJh4Hwn.js","./EventTable-D1-ITVXS.js","./SwimlaneTimeline-C50PsFoV.js","./StreamMessageDetail-wX3i0aqs.js","./CopyableId-Bn02zYxt.js","./McpQueryPage-Dmbb6SAc.js","./mcp-query-BZt5e8_Q.js","./McpQueryDetailPage-BRVVi0Zh.js","./TagInput-CAgdLN_b.js","./CollapsibleSection-UMIV4KIj.js","./useYamlActivityEvents-hmCQQwzB.js","./helpers-DzO-OGPe.js","./RunAsSelector-DxuV0fa1.js","./BotPicker-DvEJFpwS.js","./bots-DIFE298x.js","./ToolPill-CQCsVdzD.js","./TimeAgo-BLjqlfoX.js","./EscalationsOverview-BX8Cpi0X.js","./AvailableEscalationsPage-IS28XBRe.js","./task-queues-7-sHKPsN.js","./BulkAssignModal-BoQCi-YC.js","./constants-CeBBTzf5.js","./EscalationTitleSelect-DWQieOM9.js","./EscalationTimeline-d3nvshOk.js","./validate-BIRn4a6d.js","./escalation-columns-cwZE6xyo.js","./FormattedValue-k27T4bG7.js","./CountdownTimer-LG03dVgR.js","./EntityTimelinePanel-CDFFfX9d.js","./PriorityBadge-r33mpDju.js","./OperatorDashboard-DctmZw10.js","./index-CniRa65p.js","./ResolverForm-B1_x8Blv.js","./metadata-display-B7X5hGxG.js","./WorkflowsOverview-grI-KAI2.js","./index-CxdjT1Yk.js","./NamespacePill-DwM5pNA4.js","./WorkflowsDashboard-nxT3bv6W.js","./YamlWorkflowsPage-Bf04rwRv.js","./GraphInvokePage-DKUErxWc.js","./YamlWorkflowDetailPage-BoZ-hfBE.js","./TasksListPage-CDWnm_d9.js","./TaskDetailPage-bbNSv4Ae.js","./WorkflowExecutionPage-B8g81FCJ.js","./AdminDashboard-B3mkMIOT.js","./index-ag2pCAPu.js","./TaskQueuePill-h0oorVMe.js","./index-gkxPN7Vx.js","./ConfirmDeleteModal-C5puwMg7.js","./index-DN-kX7hL.js","./ToolTestPanel-DkMgCB-k.js","./index-Dl_8hbYI.js","./index-HLu98Sqh.js","./personas-UA-Xn60f.js","./ScopeBadge-CSItPVOH.js","./RolesPage-BaazL_pt.js","./RoleDetailPage-CrlYCh-R.js","./AutoGrowTextarea-7X3T9La8.js","./PersonasPage-BpFL2rpo.js","./PersonaDetailPage-Ubqm2rQH.js","./EscalationSchemaPage-Dx2Lyfrz.js","./PortalPage-Dfc_Q02R.js","./EscalationListSchemaPage-CMrUlaKI.js","./ScanCodesPage-C0mvmYTq.js","./GrantScopeField-BzWGzBfA.js","./ScanSchemeDetailPage-CiJgt5dZ.js","./ScanStationPage-DzGaXc40.js","./index-Dy1wWu2e.js","./OperationsPage-CvR74ZUJ.js","./index-BzYcUPdD.js","./index-DpKOr311.js","./CredentialsPage-CaFQ6vLb.js","./ConnectedAppsPage-drZa65kP.js","./index-ChV7pBjM.js","./DropZone-B1Tdfddc.js","./index-DAvi5_2T.js","./knowledge-DnMs-SOJ.js","./HomePage-C6u9dIpR.js","./AgentsPage-jg2OFwyW.js","./agents-Dphpdi8l.js","./AgentDetailPage-CzrD8JJI.js","./CronLabel-Co5j7tzW.js","./AgentConfigPage-CQj2B678.js","./capabilities-D7Y7LClY.js","./topics-CWjCR-17.js","./CapabilitiesPage-kwlrcb_t.js","./TopicsPage-CVcCYdy-.js","./TopicDetailPage-g3pljKKX.js"])))=>i.map(i=>d[i]);
2
+ var iS=Object.defineProperty;var aS=(n,t,s)=>t in n?iS(n,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[t]=s;var j=(n,t,s)=>aS(n,typeof t!="symbol"?t+"":t,s);import{r as oS,u as qe,a as E,j as h,b as Be,c as Fe,g as lS,d as cS,Q as uS,e as fS}from"./vendor-query-DvWWuNIB.js";import{r as hS,u as ni,a as en,b as rm,L as ar,N as Es,c as Sn,O as ei,d as dS,R as mS}from"./vendor-react-_9U4mKFr.js";import{X as Zt,E as pS,S as yS,M as gS,a as Mo,C as sm,b as bS,c as xS,d as ax,e as yd,I as gd,U as vS,L as bd,B as _S,G as wS,T as SS,R as ox,f as ES,Z as OS,P as Tg,g as lx,h as AS,i as Cg,j as xd,k as Mg,l as jS,W as im,m as kS,n as NS,F as TS,o as cx,p as CS,D as MS,N as RS,q as DS,r as ux,s as fx,t as hx,u as LS,v as qS,w as PS,x as BS,y as US,z as zS,A as IS,H as $S,J as HS}from"./vendor-icons-CeVtUKyP.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))i(o);new MutationObserver(o=>{for(const c of o)if(c.type==="childList")for(const m of c.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&i(m)}).observe(document,{childList:!0,subtree:!0});function s(o){const c={};return o.integrity&&(c.integrity=o.integrity),o.referrerPolicy&&(c.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?c.credentials="include":o.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function i(o){if(o.ep)return;o.ep=!0;const c=s(o);fetch(o.href,c)}})();var Kh={exports:{}},no={},Jh={exports:{}},Qh={};/**
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 Rg;function FS(){return Rg||(Rg=1,(function(n){function t(F,J){var le=F.length;F.push(J);e:for(;0<le;){var pe=le-1>>>1,ye=F[pe];if(0<o(ye,J))F[pe]=J,F[le]=ye,le=pe;else break e}}function s(F){return F.length===0?null:F[0]}function i(F){if(F.length===0)return null;var J=F[0],le=F.pop();if(le!==J){F[0]=le;e:for(var pe=0,ye=F.length,Ce=ye>>>1;pe<Ce;){var Ne=2*(pe+1)-1,Me=F[Ne],We=Ne+1,pt=F[We];if(0>o(Me,le))We<ye&&0>o(pt,Me)?(F[pe]=pt,F[We]=le,pe=We):(F[pe]=Me,F[Ne]=le,pe=Ne);else if(We<ye&&0>o(pt,le))F[pe]=pt,F[We]=le,pe=We;else break e}}return J}function o(F,J){var le=F.sortIndex-J.sortIndex;return le!==0?le:F.id-J.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;n.unstable_now=function(){return c.now()}}else{var m=Date,p=m.now();n.unstable_now=function(){return m.now()-p}}var g=[],u=[],d=1,b=null,x=3,v=!1,w=!1,S=!1,C=!1,P=typeof setTimeout=="function"?setTimeout:null,q=typeof clearTimeout=="function"?clearTimeout:null,re=typeof setImmediate<"u"?setImmediate:null;function se(F){for(var J=s(u);J!==null;){if(J.callback===null)i(u);else if(J.startTime<=F)i(u),J.sortIndex=J.expirationTime,t(g,J);else break;J=s(u)}}function M(F){if(S=!1,se(F),!w)if(s(g)!==null)w=!0,U||(U=!0,W());else{var J=s(u);J!==null&&Oe(M,J.startTime-F)}}var U=!1,ae=-1,z=5,I=-1;function D(){return C?!0:!(n.unstable_now()-I<z)}function X(){if(C=!1,U){var F=n.unstable_now();I=F;var J=!0;try{e:{w=!1,S&&(S=!1,q(ae),ae=-1),v=!0;var le=x;try{t:{for(se(F),b=s(g);b!==null&&!(b.expirationTime>F&&D());){var pe=b.callback;if(typeof pe=="function"){b.callback=null,x=b.priorityLevel;var ye=pe(b.expirationTime<=F);if(F=n.unstable_now(),typeof ye=="function"){b.callback=ye,se(F),J=!0;break t}b===s(g)&&i(g),se(F)}else i(g);b=s(g)}if(b!==null)J=!0;else{var Ce=s(u);Ce!==null&&Oe(M,Ce.startTime-F),J=!1}}break e}finally{b=null,x=le,v=!1}J=void 0}}finally{J?W():U=!1}}}var W;if(typeof re=="function")W=function(){re(X)};else if(typeof MessageChannel<"u"){var he=new MessageChannel,we=he.port2;he.port1.onmessage=X,W=function(){we.postMessage(null)}}else W=function(){P(X,0)};function Oe(F,J){ae=P(function(){F(n.unstable_now())},J)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(F){F.callback=null},n.unstable_forceFrameRate=function(F){0>F||125<F?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):z=0<F?Math.floor(1e3/F):5},n.unstable_getCurrentPriorityLevel=function(){return x},n.unstable_next=function(F){switch(x){case 1:case 2:case 3:var J=3;break;default:J=x}var le=x;x=J;try{return F()}finally{x=le}},n.unstable_requestPaint=function(){C=!0},n.unstable_runWithPriority=function(F,J){switch(F){case 1:case 2:case 3:case 4:case 5:break;default:F=3}var le=x;x=F;try{return J()}finally{x=le}},n.unstable_scheduleCallback=function(F,J,le){var pe=n.unstable_now();switch(typeof le=="object"&&le!==null?(le=le.delay,le=typeof le=="number"&&0<le?pe+le:pe):le=pe,F){case 1:var ye=-1;break;case 2:ye=250;break;case 5:ye=1073741823;break;case 4:ye=1e4;break;default:ye=5e3}return ye=le+ye,F={id:d++,callback:J,priorityLevel:F,startTime:le,expirationTime:ye,sortIndex:-1},le>pe?(F.sortIndex=le,t(u,F),s(g)===null&&F===s(u)&&(S?(q(ae),ae=-1):S=!0,Oe(M,le-pe))):(F.sortIndex=ye,t(g,F),w||v||(w=!0,U||(U=!0,W()))),F},n.unstable_shouldYield=D,n.unstable_wrapCallback=function(F){var J=x;return function(){var le=x;x=J;try{return F.apply(this,arguments)}finally{x=le}}}})(Qh)),Qh}var Dg;function GS(){return Dg||(Dg=1,Jh.exports=FS()),Jh.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 Lg;function VS(){if(Lg)return no;Lg=1;var n=GS(),t=oS(),s=hS();function i(e){var r="https://react.dev/errors/"+e;if(1<arguments.length){r+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)r+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+e+"; visit "+r+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function c(e){var r=e,a=e;if(e.alternate)for(;r.return;)r=r.return;else{e=r;do r=e,(r.flags&4098)!==0&&(a=r.return),e=r.return;while(e)}return r.tag===3?a:null}function m(e){if(e.tag===13){var r=e.memoizedState;if(r===null&&(e=e.alternate,e!==null&&(r=e.memoizedState)),r!==null)return r.dehydrated}return null}function p(e){if(e.tag===31){var r=e.memoizedState;if(r===null&&(e=e.alternate,e!==null&&(r=e.memoizedState)),r!==null)return r.dehydrated}return null}function g(e){if(c(e)!==e)throw Error(i(188))}function u(e){var r=e.alternate;if(!r){if(r=c(e),r===null)throw Error(i(188));return r!==e?null:e}for(var a=e,l=r;;){var f=a.return;if(f===null)break;var y=f.alternate;if(y===null){if(l=f.return,l!==null){a=l;continue}break}if(f.child===y.child){for(y=f.child;y;){if(y===a)return g(f),e;if(y===l)return g(f),r;y=y.sibling}throw Error(i(188))}if(a.return!==l.return)a=f,l=y;else{for(var _=!1,O=f.child;O;){if(O===a){_=!0,a=f,l=y;break}if(O===l){_=!0,l=f,a=y;break}O=O.sibling}if(!_){for(O=y.child;O;){if(O===a){_=!0,a=y,l=f;break}if(O===l){_=!0,l=y,a=f;break}O=O.sibling}if(!_)throw Error(i(189))}}if(a.alternate!==l)throw Error(i(190))}if(a.tag!==3)throw Error(i(188));return a.stateNode.current===a?e:r}function d(e){var r=e.tag;if(r===5||r===26||r===27||r===6)return e;for(e=e.child;e!==null;){if(r=d(e),r!==null)return r;e=e.sibling}return null}var b=Object.assign,x=Symbol.for("react.element"),v=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),P=Symbol.for("react.profiler"),q=Symbol.for("react.consumer"),re=Symbol.for("react.context"),se=Symbol.for("react.forward_ref"),M=Symbol.for("react.suspense"),U=Symbol.for("react.suspense_list"),ae=Symbol.for("react.memo"),z=Symbol.for("react.lazy"),I=Symbol.for("react.activity"),D=Symbol.for("react.memo_cache_sentinel"),X=Symbol.iterator;function W(e){return e===null||typeof e!="object"?null:(e=X&&e[X]||e["@@iterator"],typeof e=="function"?e:null)}var he=Symbol.for("react.client.reference");function we(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 P:return"Profiler";case C:return"StrictMode";case M:return"Suspense";case U:return"SuspenseList";case I:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case w:return"Portal";case re:return e.displayName||"Context";case q:return(e._context.displayName||"Context")+".Consumer";case se:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ae:return r=e.displayName||null,r!==null?r:we(e.type)||"Memo";case z:r=e._payload,e=e._init;try{return we(e(r))}catch{}}return null}var Oe=Array.isArray,F=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,J=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,le={pending:!1,data:null,method:null,action:null},pe=[],ye=-1;function Ce(e){return{current:e}}function Ne(e){0>ye||(e.current=pe[ye],pe[ye]=null,ye--)}function Me(e,r){ye++,pe[ye]=e.current,e.current=r}var We=Ce(null),pt=Ce(null),Ct=Ce(null),Se=Ce(null);function Re(e,r){switch(Me(Ct,r),Me(pt,e),Me(We,null),r.nodeType){case 9:case 11:e=(e=r.documentElement)&&(e=e.namespaceURI)?Zy(e):0;break;default:if(e=r.tagName,r=r.namespaceURI)r=Zy(r),e=eg(r,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Ne(We),Me(We,e)}function ce(){Ne(We),Ne(pt),Ne(Ct)}function Ue(e){e.memoizedState!==null&&Me(Se,e);var r=We.current,a=eg(r,e.type);r!==a&&(Me(pt,e),Me(We,a))}function Xe(e){pt.current===e&&(Ne(We),Ne(pt)),Se.current===e&&(Ne(Se),Wa._currentValue=le)}var cn,Mt;function be(e){if(cn===void 0)try{throw Error()}catch(a){var r=a.stack.trim().match(/\n( *(at )?)/);cn=r&&r[1]||"",Mt=-1<a.stack.indexOf(`
19
+ at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
20
+ `+cn+e+Mt}var it=!1;function yt(e,r){if(!e||it)return"";it=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(r){var ie=function(){throw Error()};if(Object.defineProperty(ie.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ie,[])}catch(Q){var Y=Q}Reflect.construct(e,[],ie)}else{try{ie.call()}catch(Q){Y=Q}e.call(ie.prototype)}}else{try{throw Error()}catch(Q){Y=Q}(ie=e())&&typeof ie.catch=="function"&&ie.catch(function(){})}}catch(Q){if(Q&&Y&&typeof Q.stack=="string")return[Q.stack,Y.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var f=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");f&&f.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var y=l.DetermineComponentFrameRoot(),_=y[0],O=y[1];if(_&&O){var R=_.split(`
21
+ `),V=O.split(`
22
+ `);for(f=l=0;l<R.length&&!R[l].includes("DetermineComponentFrameRoot");)l++;for(;f<V.length&&!V[f].includes("DetermineComponentFrameRoot");)f++;if(l===R.length||f===V.length)for(l=R.length-1,f=V.length-1;1<=l&&0<=f&&R[l]!==V[f];)f--;for(;1<=l&&0<=f;l--,f--)if(R[l]!==V[f]){if(l!==1||f!==1)do if(l--,f--,0>f||R[l]!==V[f]){var Z=`
23
+ `+R[l].replace(" at new "," at ");return e.displayName&&Z.includes("<anonymous>")&&(Z=Z.replace("<anonymous>",e.displayName)),Z}while(1<=l&&0<=f);break}}}finally{it=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?be(a):""}function Ot(e,r){switch(e.tag){case 26:case 27:case 5:return be(e.type);case 16:return be("Lazy");case 13:return e.child!==r&&r!==null?be("Suspense Fallback"):be("Suspense");case 19:return be("SuspenseList");case 0:case 15:return yt(e.type,!1);case 11:return yt(e.type.render,!1);case 1:return yt(e.type,!0);case 31:return be("Activity");default:return""}}function Ur(e){try{var r="",a=null;do r+=Ot(e,a),a=e,e=e.return;while(e);return r}catch(l){return`
24
+ Error generating stack: `+l.message+`
25
+ `+l.stack}}var la=Object.prototype.hasOwnProperty,ca=n.unstable_scheduleCallback,hr=n.unstable_cancelCallback,zo=n.unstable_shouldYield,si=n.unstable_requestPaint,ft=n.unstable_now,Pu=n.unstable_getCurrentPriorityLevel,Io=n.unstable_ImmediatePriority,$o=n.unstable_UserBlockingPriority,ii=n.unstable_NormalPriority,Bu=n.unstable_LowPriority,Ho=n.unstable_IdlePriority,Uu=n.log,Fo=n.unstable_setDisableYieldValue,ks=null,_t=null;function un(e){if(typeof Uu=="function"&&Fo(e),_t&&typeof _t.setStrictMode=="function")try{_t.setStrictMode(ks,e)}catch{}}var Ft=Math.clz32?Math.clz32:ai,ua=Math.log,fa=Math.LN2;function ai(e){return e>>>=0,e===0?32:31-(ua(e)/fa|0)|0}var zr=256,dr=262144,Ir=4194304;function Hn(e){var r=e&42;if(r!==0)return r;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Ns(e,r,a){var l=e.pendingLanes;if(l===0)return 0;var f=0,y=e.suspendedLanes,_=e.pingedLanes;e=e.warmLanes;var O=l&134217727;return O!==0?(l=O&~y,l!==0?f=Hn(l):(_&=O,_!==0?f=Hn(_):a||(a=O&~e,a!==0&&(f=Hn(a))))):(O=l&~y,O!==0?f=Hn(O):_!==0?f=Hn(_):a||(a=l&~e,a!==0&&(f=Hn(a)))),f===0?0:r!==0&&r!==f&&(r&y)===0&&(y=f&-f,a=r&-r,y>=a||y===32&&(a&4194048)!==0)?r:f}function Ts(e,r){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&r)===0}function ha(e,r){switch(e){case 1:case 2:case 4:case 8:case 64:return r+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return r+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function oi(){var e=Ir;return Ir<<=1,(Ir&62914560)===0&&(Ir=4194304),e}function $r(e){for(var r=[],a=0;31>a;a++)r.push(e);return r}function Fn(e,r){e.pendingLanes|=r,r!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Hr(e,r,a,l,f,y){var _=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 O=e.entanglements,R=e.expirationTimes,V=e.hiddenUpdates;for(a=_&~a;0<a;){var Z=31-Ft(a),ie=1<<Z;O[Z]=0,R[Z]=-1;var Y=V[Z];if(Y!==null)for(V[Z]=null,Z=0;Z<Y.length;Z++){var Q=Y[Z];Q!==null&&(Q.lane&=-536870913)}a&=~ie}l!==0&&Fr(e,l,0),y!==0&&f===0&&e.tag!==0&&(e.suspendedLanes|=y&~(_&~r))}function Fr(e,r,a){e.pendingLanes|=r,e.suspendedLanes&=~r;var l=31-Ft(r);e.entangledLanes|=r,e.entanglements[l]=e.entanglements[l]|1073741824|a&261930}function Cs(e,r){var a=e.entangledLanes|=r;for(e=e.entanglements;a;){var l=31-Ft(a),f=1<<l;f&r|e[l]&r&&(e[l]|=r),a&=~f}}function Gr(e,r){var a=r&-r;return a=(a&42)!==0?1:mr(a),(a&(e.suspendedLanes|r))!==0?0:a}function mr(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 Ms(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function da(){var e=J.p;return e!==0?e:(e=window.event,e===void 0?32:Sg(e.type))}function Go(e,r){var a=J.p;try{return J.p=e,r()}finally{J.p=a}}var tr=Math.random().toString(36).slice(2),at="__reactFiber$"+tr,gt="__reactProps$"+tr,fn="__reactContainer$"+tr,Rs="__reactEvents$"+tr,ma="__reactListeners$"+tr,Vo="__reactHandles$"+tr,Yo="__reactResources$"+tr,Rt="__reactMarker$"+tr;function li(e){delete e[at],delete e[gt],delete e[Rs],delete e[ma],delete e[Vo]}function A(e){var r=e[at];if(r)return r;for(var a=e.parentNode;a;){if(r=a[fn]||a[at]){if(a=r.alternate,r.child!==null||a!==null&&a.child!==null)for(e=og(e);e!==null;){if(a=e[at])return a;e=og(e)}return r}e=a,a=e.parentNode}return null}function N(e){if(e=e[at]||e[fn]){var r=e.tag;if(r===5||r===6||r===13||r===31||r===26||r===27||r===3)return e}return null}function k(e){var r=e.tag;if(r===5||r===26||r===27||r===6)return e.stateNode;throw Error(i(33))}function T(e){var r=e[Yo];return r||(r=e[Yo]={hoistableStyles:new Map,hoistableScripts:new Map}),r}function L(e){e[Rt]=!0}var H=new Set,ne={};function oe(e,r){K(e,r),K(e+"Capture",r)}function K(e,r){for(ne[e]=r,e=0;e<r.length;e++)H.add(r[e])}var te=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),xe={},Pe={};function lt(e){return la.call(Pe,e)?!0:la.call(xe,e)?!1:te.test(e)?Pe[e]=!0:(xe[e]=!0,!1)}function Gt(e,r,a){if(lt(r))if(a===null)e.removeAttribute(r);else{switch(typeof a){case"undefined":case"function":case"symbol":e.removeAttribute(r);return;case"boolean":var l=r.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){e.removeAttribute(r);return}}e.setAttribute(r,""+a)}}function Gn(e,r,a){if(a===null)e.removeAttribute(r);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(r);return}e.setAttribute(r,""+a)}}function pr(e,r,a,l){if(l===null)e.removeAttribute(a);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttributeNS(r,a,""+l)}}function Tn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Gm(e){var r=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function Wv(e,r,a){var l=Object.getOwnPropertyDescriptor(e.constructor.prototype,r);if(!e.hasOwnProperty(r)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var f=l.get,y=l.set;return Object.defineProperty(e,r,{configurable:!0,get:function(){return f.call(this)},set:function(_){a=""+_,y.call(this,_)}}),Object.defineProperty(e,r,{enumerable:l.enumerable}),{getValue:function(){return a},setValue:function(_){a=""+_},stopTracking:function(){e._valueTracker=null,delete e[r]}}}}function zu(e){if(!e._valueTracker){var r=Gm(e)?"checked":"value";e._valueTracker=Wv(e,r,""+e[r])}}function Vm(e){if(!e)return!1;var r=e._valueTracker;if(!r)return!0;var a=r.getValue(),l="";return e&&(l=Gm(e)?e.checked?"true":"false":e.value),e=l,e!==a?(r.setValue(e),!0):!1}function Ko(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 Zv=/[\n"\\]/g;function Cn(e){return e.replace(Zv,function(r){return"\\"+r.charCodeAt(0).toString(16)+" "})}function Iu(e,r,a,l,f,y,_,O){e.name="",_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"?e.type=_:e.removeAttribute("type"),r!=null?_==="number"?(r===0&&e.value===""||e.value!=r)&&(e.value=""+Tn(r)):e.value!==""+Tn(r)&&(e.value=""+Tn(r)):_!=="submit"&&_!=="reset"||e.removeAttribute("value"),r!=null?$u(e,_,Tn(r)):a!=null?$u(e,_,Tn(a)):l!=null&&e.removeAttribute("value"),f==null&&y!=null&&(e.defaultChecked=!!y),f!=null&&(e.checked=f&&typeof f!="function"&&typeof f!="symbol"),O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"?e.name=""+Tn(O):e.removeAttribute("name")}function Ym(e,r,a,l,f,y,_,O){if(y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(e.type=y),r!=null||a!=null){if(!(y!=="submit"&&y!=="reset"||r!=null)){zu(e);return}a=a!=null?""+Tn(a):"",r=r!=null?""+Tn(r):a,O||r===e.value||(e.value=r),e.defaultValue=r}l=l??f,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=O?e.checked:!!l,e.defaultChecked=!!l,_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"&&(e.name=_),zu(e)}function $u(e,r,a){r==="number"&&Ko(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function ci(e,r,a,l){if(e=e.options,r){r={};for(var f=0;f<a.length;f++)r["$"+a[f]]=!0;for(a=0;a<e.length;a++)f=r.hasOwnProperty("$"+e[a].value),e[a].selected!==f&&(e[a].selected=f),f&&l&&(e[a].defaultSelected=!0)}else{for(a=""+Tn(a),r=null,f=0;f<e.length;f++){if(e[f].value===a){e[f].selected=!0,l&&(e[f].defaultSelected=!0);return}r!==null||e[f].disabled||(r=e[f])}r!==null&&(r.selected=!0)}}function Km(e,r,a){if(r!=null&&(r=""+Tn(r),r!==e.value&&(e.value=r),a==null)){e.defaultValue!==r&&(e.defaultValue=r);return}e.defaultValue=a!=null?""+Tn(a):""}function Jm(e,r,a,l){if(r==null){if(l!=null){if(a!=null)throw Error(i(92));if(Oe(l)){if(1<l.length)throw Error(i(93));l=l[0]}a=l}a==null&&(a=""),r=a}a=Tn(r),e.defaultValue=a,l=e.textContent,l===a&&l!==""&&l!==null&&(e.value=l),zu(e)}function ui(e,r){if(r){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=r;return}}e.textContent=r}var e_=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 Qm(e,r,a){var l=r.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?l?e.setProperty(r,""):r==="float"?e.cssFloat="":e[r]="":l?e.setProperty(r,a):typeof a!="number"||a===0||e_.has(r)?r==="float"?e.cssFloat=a:e[r]=(""+a).trim():e[r]=a+"px"}function Xm(e,r,a){if(r!=null&&typeof r!="object")throw Error(i(62));if(e=e.style,a!=null){for(var l in a)!a.hasOwnProperty(l)||r!=null&&r.hasOwnProperty(l)||(l.indexOf("--")===0?e.setProperty(l,""):l==="float"?e.cssFloat="":e[l]="");for(var f in r)l=r[f],r.hasOwnProperty(f)&&a[f]!==l&&Qm(e,f,l)}else for(var y in r)r.hasOwnProperty(y)&&Qm(e,y,r[y])}function Hu(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 t_=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"]]),n_=/^[\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 Jo(e){return n_.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function yr(){}var Fu=null;function Gu(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var fi=null,hi=null;function Wm(e){var r=N(e);if(r&&(e=r.stateNode)){var a=e[gt]||null;e:switch(e=r.stateNode,r.type){case"input":if(Iu(e,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),r=a.name,a.type==="radio"&&r!=null){for(a=e;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+Cn(""+r)+'"][type="radio"]'),r=0;r<a.length;r++){var l=a[r];if(l!==e&&l.form===e.form){var f=l[gt]||null;if(!f)throw Error(i(90));Iu(l,f.value,f.defaultValue,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name)}}for(r=0;r<a.length;r++)l=a[r],l.form===e.form&&Vm(l)}break e;case"textarea":Km(e,a.value,a.defaultValue);break e;case"select":r=a.value,r!=null&&ci(e,!!a.multiple,r,!1)}}}var Vu=!1;function Zm(e,r,a){if(Vu)return e(r,a);Vu=!0;try{var l=e(r);return l}finally{if(Vu=!1,(fi!==null||hi!==null)&&(ql(),fi&&(r=fi,e=hi,hi=fi=null,Wm(r),e)))for(r=0;r<e.length;r++)Wm(e[r])}}function pa(e,r){var a=e.stateNode;if(a===null)return null;var l=a[gt]||null;if(l===null)return null;a=l[r];e:switch(r){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(e=e.type,l=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!l;break e;default:e=!1}if(e)return null;if(a&&typeof a!="function")throw Error(i(231,r,typeof a));return a}var gr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Yu=!1;if(gr)try{var ya={};Object.defineProperty(ya,"passive",{get:function(){Yu=!0}}),window.addEventListener("test",ya,ya),window.removeEventListener("test",ya,ya)}catch{Yu=!1}var Vr=null,Ku=null,Qo=null;function e0(){if(Qo)return Qo;var e,r=Ku,a=r.length,l,f="value"in Vr?Vr.value:Vr.textContent,y=f.length;for(e=0;e<a&&r[e]===f[e];e++);var _=a-e;for(l=1;l<=_&&r[a-l]===f[y-l];l++);return Qo=f.slice(e,1<l?1-l:void 0)}function Xo(e){var r=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&r===13&&(e=13)):e=r,e===10&&(e=13),32<=e||e===13?e:0}function Wo(){return!0}function t0(){return!1}function nn(e){function r(a,l,f,y,_){this._reactName=a,this._targetInst=f,this.type=l,this.nativeEvent=y,this.target=_,this.currentTarget=null;for(var O in e)e.hasOwnProperty(O)&&(a=e[O],this[O]=a?a(y):y[O]);return this.isDefaultPrevented=(y.defaultPrevented!=null?y.defaultPrevented:y.returnValue===!1)?Wo:t0,this.isPropagationStopped=t0,this}return b(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=Wo)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Wo)},persist:function(){},isPersistent:Wo}),r}var Ds={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Zo=nn(Ds),ga=b({},Ds,{view:0,detail:0}),r_=nn(ga),Ju,Qu,ba,el=b({},ga,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Wu,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!==ba&&(ba&&e.type==="mousemove"?(Ju=e.screenX-ba.screenX,Qu=e.screenY-ba.screenY):Qu=Ju=0,ba=e),Ju)},movementY:function(e){return"movementY"in e?e.movementY:Qu}}),n0=nn(el),s_=b({},el,{dataTransfer:0}),i_=nn(s_),a_=b({},ga,{relatedTarget:0}),Xu=nn(a_),o_=b({},Ds,{animationName:0,elapsedTime:0,pseudoElement:0}),l_=nn(o_),c_=b({},Ds,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),u_=nn(c_),f_=b({},Ds,{data:0}),r0=nn(f_),h_={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},d_={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"},m_={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function p_(e){var r=this.nativeEvent;return r.getModifierState?r.getModifierState(e):(e=m_[e])?!!r[e]:!1}function Wu(){return p_}var y_=b({},ga,{key:function(e){if(e.key){var r=h_[e.key]||e.key;if(r!=="Unidentified")return r}return e.type==="keypress"?(e=Xo(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?d_[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Wu,charCode:function(e){return e.type==="keypress"?Xo(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Xo(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),g_=nn(y_),b_=b({},el,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),s0=nn(b_),x_=b({},ga,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Wu}),v_=nn(x_),__=b({},Ds,{propertyName:0,elapsedTime:0,pseudoElement:0}),w_=nn(__),S_=b({},el,{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}),E_=nn(S_),O_=b({},Ds,{newState:0,oldState:0}),A_=nn(O_),j_=[9,13,27,32],Zu=gr&&"CompositionEvent"in window,xa=null;gr&&"documentMode"in document&&(xa=document.documentMode);var k_=gr&&"TextEvent"in window&&!xa,i0=gr&&(!Zu||xa&&8<xa&&11>=xa),a0=" ",o0=!1;function l0(e,r){switch(e){case"keyup":return j_.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function c0(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var di=!1;function N_(e,r){switch(e){case"compositionend":return c0(r);case"keypress":return r.which!==32?null:(o0=!0,a0);case"textInput":return e=r.data,e===a0&&o0?null:e;default:return null}}function T_(e,r){if(di)return e==="compositionend"||!Zu&&l0(e,r)?(e=e0(),Qo=Ku=Vr=null,di=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(r.ctrlKey||r.altKey||r.metaKey)||r.ctrlKey&&r.altKey){if(r.char&&1<r.char.length)return r.char;if(r.which)return String.fromCharCode(r.which)}return null;case"compositionend":return i0&&r.locale!=="ko"?null:r.data;default:return null}}var C_={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 u0(e){var r=e&&e.nodeName&&e.nodeName.toLowerCase();return r==="input"?!!C_[e.type]:r==="textarea"}function f0(e,r,a,l){fi?hi?hi.push(l):hi=[l]:fi=l,r=Hl(r,"onChange"),0<r.length&&(a=new Zo("onChange","change",null,a,l),e.push({event:a,listeners:r}))}var va=null,_a=null;function M_(e){Yy(e,0)}function tl(e){var r=k(e);if(Vm(r))return e}function h0(e,r){if(e==="change")return r}var d0=!1;if(gr){var ef;if(gr){var tf="oninput"in document;if(!tf){var m0=document.createElement("div");m0.setAttribute("oninput","return;"),tf=typeof m0.oninput=="function"}ef=tf}else ef=!1;d0=ef&&(!document.documentMode||9<document.documentMode)}function p0(){va&&(va.detachEvent("onpropertychange",y0),_a=va=null)}function y0(e){if(e.propertyName==="value"&&tl(_a)){var r=[];f0(r,_a,e,Gu(e)),Zm(M_,r)}}function R_(e,r,a){e==="focusin"?(p0(),va=r,_a=a,va.attachEvent("onpropertychange",y0)):e==="focusout"&&p0()}function D_(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return tl(_a)}function L_(e,r){if(e==="click")return tl(r)}function q_(e,r){if(e==="input"||e==="change")return tl(r)}function P_(e,r){return e===r&&(e!==0||1/e===1/r)||e!==e&&r!==r}var hn=typeof Object.is=="function"?Object.is:P_;function wa(e,r){if(hn(e,r))return!0;if(typeof e!="object"||e===null||typeof r!="object"||r===null)return!1;var a=Object.keys(e),l=Object.keys(r);if(a.length!==l.length)return!1;for(l=0;l<a.length;l++){var f=a[l];if(!la.call(r,f)||!hn(e[f],r[f]))return!1}return!0}function g0(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function b0(e,r){var a=g0(e);e=0;for(var l;a;){if(a.nodeType===3){if(l=e+a.textContent.length,e<=r&&l>=r)return{node:a,offset:r-e};e=l}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=g0(a)}}function x0(e,r){return e&&r?e===r?!0:e&&e.nodeType===3?!1:r&&r.nodeType===3?x0(e,r.parentNode):"contains"in e?e.contains(r):e.compareDocumentPosition?!!(e.compareDocumentPosition(r)&16):!1:!1}function v0(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var r=Ko(e.document);r instanceof e.HTMLIFrameElement;){try{var a=typeof r.contentWindow.location.href=="string"}catch{a=!1}if(a)e=r.contentWindow;else break;r=Ko(e.document)}return r}function nf(e){var r=e&&e.nodeName&&e.nodeName.toLowerCase();return r&&(r==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||r==="textarea"||e.contentEditable==="true")}var B_=gr&&"documentMode"in document&&11>=document.documentMode,mi=null,rf=null,Sa=null,sf=!1;function _0(e,r,a){var l=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;sf||mi==null||mi!==Ko(l)||(l=mi,"selectionStart"in l&&nf(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),Sa&&wa(Sa,l)||(Sa=l,l=Hl(rf,"onSelect"),0<l.length&&(r=new Zo("onSelect","select",null,r,a),e.push({event:r,listeners:l}),r.target=mi)))}function Ls(e,r){var a={};return a[e.toLowerCase()]=r.toLowerCase(),a["Webkit"+e]="webkit"+r,a["Moz"+e]="moz"+r,a}var pi={animationend:Ls("Animation","AnimationEnd"),animationiteration:Ls("Animation","AnimationIteration"),animationstart:Ls("Animation","AnimationStart"),transitionrun:Ls("Transition","TransitionRun"),transitionstart:Ls("Transition","TransitionStart"),transitioncancel:Ls("Transition","TransitionCancel"),transitionend:Ls("Transition","TransitionEnd")},af={},w0={};gr&&(w0=document.createElement("div").style,"AnimationEvent"in window||(delete pi.animationend.animation,delete pi.animationiteration.animation,delete pi.animationstart.animation),"TransitionEvent"in window||delete pi.transitionend.transition);function qs(e){if(af[e])return af[e];if(!pi[e])return e;var r=pi[e],a;for(a in r)if(r.hasOwnProperty(a)&&a in w0)return af[e]=r[a];return e}var S0=qs("animationend"),E0=qs("animationiteration"),O0=qs("animationstart"),U_=qs("transitionrun"),z_=qs("transitionstart"),I_=qs("transitioncancel"),A0=qs("transitionend"),j0=new Map,of="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(" ");of.push("scrollEnd");function Vn(e,r){j0.set(e,r),oe(r,[e])}var nl=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var r=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(r))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Mn=[],yi=0,lf=0;function rl(){for(var e=yi,r=lf=yi=0;r<e;){var a=Mn[r];Mn[r++]=null;var l=Mn[r];Mn[r++]=null;var f=Mn[r];Mn[r++]=null;var y=Mn[r];if(Mn[r++]=null,l!==null&&f!==null){var _=l.pending;_===null?f.next=f:(f.next=_.next,_.next=f),l.pending=f}y!==0&&k0(a,f,y)}}function sl(e,r,a,l){Mn[yi++]=e,Mn[yi++]=r,Mn[yi++]=a,Mn[yi++]=l,lf|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function cf(e,r,a,l){return sl(e,r,a,l),il(e)}function Ps(e,r){return sl(e,null,null,r),il(e)}function k0(e,r,a){e.lanes|=a;var l=e.alternate;l!==null&&(l.lanes|=a);for(var f=!1,y=e.return;y!==null;)y.childLanes|=a,l=y.alternate,l!==null&&(l.childLanes|=a),y.tag===22&&(e=y.stateNode,e===null||e._visibility&1||(f=!0)),e=y,y=y.return;return e.tag===3?(y=e.stateNode,f&&r!==null&&(f=31-Ft(a),e=y.hiddenUpdates,l=e[f],l===null?e[f]=[r]:l.push(r),r.lane=a|536870912),y):null}function il(e){if(50<Ga)throw Ga=0,bh=null,Error(i(185));for(var r=e.return;r!==null;)e=r,r=e.return;return e.tag===3?e.stateNode:null}var gi={};function $_(e,r,a,l){this.tag=e,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=r,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function dn(e,r,a,l){return new $_(e,r,a,l)}function uf(e){return e=e.prototype,!(!e||!e.isReactComponent)}function br(e,r){var a=e.alternate;return a===null?(a=dn(e.tag,r,e.key,e.mode),a.elementType=e.elementType,a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=r,a.type=e.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=e.flags&65011712,a.childLanes=e.childLanes,a.lanes=e.lanes,a.child=e.child,a.memoizedProps=e.memoizedProps,a.memoizedState=e.memoizedState,a.updateQueue=e.updateQueue,r=e.dependencies,a.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext},a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a.refCleanup=e.refCleanup,a}function N0(e,r){e.flags&=65011714;var a=e.alternate;return a===null?(e.childLanes=0,e.lanes=r,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=a.childLanes,e.lanes=a.lanes,e.child=a.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=a.memoizedProps,e.memoizedState=a.memoizedState,e.updateQueue=a.updateQueue,e.type=a.type,r=a.dependencies,e.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),e}function al(e,r,a,l,f,y){var _=0;if(l=e,typeof e=="function")uf(e)&&(_=1);else if(typeof e=="string")_=Yw(e,a,We.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case I:return e=dn(31,a,r,f),e.elementType=I,e.lanes=y,e;case S:return Bs(a.children,f,y,r);case C:_=8,f|=24;break;case P:return e=dn(12,a,r,f|2),e.elementType=P,e.lanes=y,e;case M:return e=dn(13,a,r,f),e.elementType=M,e.lanes=y,e;case U:return e=dn(19,a,r,f),e.elementType=U,e.lanes=y,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case re:_=10;break e;case q:_=9;break e;case se:_=11;break e;case ae:_=14;break e;case z:_=16,l=null;break e}_=29,a=Error(i(130,e===null?"null":typeof e,"")),l=null}return r=dn(_,a,r,f),r.elementType=e,r.type=l,r.lanes=y,r}function Bs(e,r,a,l){return e=dn(7,e,l,r),e.lanes=a,e}function ff(e,r,a){return e=dn(6,e,null,r),e.lanes=a,e}function T0(e){var r=dn(18,null,null,0);return r.stateNode=e,r}function hf(e,r,a){return r=dn(4,e.children!==null?e.children:[],e.key,r),r.lanes=a,r.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},r}var C0=new WeakMap;function Rn(e,r){if(typeof e=="object"&&e!==null){var a=C0.get(e);return a!==void 0?a:(r={value:e,source:r,stack:Ur(r)},C0.set(e,r),r)}return{value:e,source:r,stack:Ur(r)}}var bi=[],xi=0,ol=null,Ea=0,Dn=[],Ln=0,Yr=null,nr=1,rr="";function xr(e,r){bi[xi++]=Ea,bi[xi++]=ol,ol=e,Ea=r}function M0(e,r,a){Dn[Ln++]=nr,Dn[Ln++]=rr,Dn[Ln++]=Yr,Yr=e;var l=nr;e=rr;var f=32-Ft(l)-1;l&=~(1<<f),a+=1;var y=32-Ft(r)+f;if(30<y){var _=f-f%5;y=(l&(1<<_)-1).toString(32),l>>=_,f-=_,nr=1<<32-Ft(r)+f|a<<f|l,rr=y+e}else nr=1<<y|a<<f|l,rr=e}function df(e){e.return!==null&&(xr(e,1),M0(e,1,0))}function mf(e){for(;e===ol;)ol=bi[--xi],bi[xi]=null,Ea=bi[--xi],bi[xi]=null;for(;e===Yr;)Yr=Dn[--Ln],Dn[Ln]=null,rr=Dn[--Ln],Dn[Ln]=null,nr=Dn[--Ln],Dn[Ln]=null}function R0(e,r){Dn[Ln++]=nr,Dn[Ln++]=rr,Dn[Ln++]=Yr,nr=r.id,rr=r.overflow,Yr=e}var zt=null,ct=null,Ge=!1,Kr=null,qn=!1,pf=Error(i(519));function Jr(e){var r=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Oa(Rn(r,e)),pf}function D0(e){var r=e.stateNode,a=e.type,l=e.memoizedProps;switch(r[at]=e,r[gt]=l,a){case"dialog":Ie("cancel",r),Ie("close",r);break;case"iframe":case"object":case"embed":Ie("load",r);break;case"video":case"audio":for(a=0;a<Ya.length;a++)Ie(Ya[a],r);break;case"source":Ie("error",r);break;case"img":case"image":case"link":Ie("error",r),Ie("load",r);break;case"details":Ie("toggle",r);break;case"input":Ie("invalid",r),Ym(r,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":Ie("invalid",r);break;case"textarea":Ie("invalid",r),Jm(r,l.value,l.defaultValue,l.children)}a=l.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||r.textContent===""+a||l.suppressHydrationWarning===!0||Xy(r.textContent,a)?(l.popover!=null&&(Ie("beforetoggle",r),Ie("toggle",r)),l.onScroll!=null&&Ie("scroll",r),l.onScrollEnd!=null&&Ie("scrollend",r),l.onClick!=null&&(r.onclick=yr),r=!0):r=!1,r||Jr(e,!0)}function L0(e){for(zt=e.return;zt;)switch(zt.tag){case 5:case 31:case 13:qn=!1;return;case 27:case 3:qn=!0;return;default:zt=zt.return}}function vi(e){if(e!==zt)return!1;if(!Ge)return L0(e),Ge=!0,!1;var r=e.tag,a;if((a=r!==3&&r!==27)&&((a=r===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||Rh(e.type,e.memoizedProps)),a=!a),a&&ct&&Jr(e),L0(e),r===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(317));ct=ag(e)}else if(r===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(317));ct=ag(e)}else r===27?(r=ct,cs(e.type)?(e=Bh,Bh=null,ct=e):ct=r):ct=zt?Bn(e.stateNode.nextSibling):null;return!0}function Us(){ct=zt=null,Ge=!1}function yf(){var e=Kr;return e!==null&&(on===null?on=e:on.push.apply(on,e),Kr=null),e}function Oa(e){Kr===null?Kr=[e]:Kr.push(e)}var gf=Ce(null),zs=null,vr=null;function Qr(e,r,a){Me(gf,r._currentValue),r._currentValue=a}function _r(e){e._currentValue=gf.current,Ne(gf)}function bf(e,r,a){for(;e!==null;){var l=e.alternate;if((e.childLanes&r)!==r?(e.childLanes|=r,l!==null&&(l.childLanes|=r)):l!==null&&(l.childLanes&r)!==r&&(l.childLanes|=r),e===a)break;e=e.return}}function xf(e,r,a,l){var f=e.child;for(f!==null&&(f.return=e);f!==null;){var y=f.dependencies;if(y!==null){var _=f.child;y=y.firstContext;e:for(;y!==null;){var O=y;y=f;for(var R=0;R<r.length;R++)if(O.context===r[R]){y.lanes|=a,O=y.alternate,O!==null&&(O.lanes|=a),bf(y.return,a,e),l||(_=null);break e}y=O.next}}else if(f.tag===18){if(_=f.return,_===null)throw Error(i(341));_.lanes|=a,y=_.alternate,y!==null&&(y.lanes|=a),bf(_,a,e),_=null}else _=f.child;if(_!==null)_.return=f;else for(_=f;_!==null;){if(_===e){_=null;break}if(f=_.sibling,f!==null){f.return=_.return,_=f;break}_=_.return}f=_}}function _i(e,r,a,l){e=null;for(var f=r,y=!1;f!==null;){if(!y){if((f.flags&524288)!==0)y=!0;else if((f.flags&262144)!==0)break}if(f.tag===10){var _=f.alternate;if(_===null)throw Error(i(387));if(_=_.memoizedProps,_!==null){var O=f.type;hn(f.pendingProps.value,_.value)||(e!==null?e.push(O):e=[O])}}else if(f===Se.current){if(_=f.alternate,_===null)throw Error(i(387));_.memoizedState.memoizedState!==f.memoizedState.memoizedState&&(e!==null?e.push(Wa):e=[Wa])}f=f.return}e!==null&&xf(r,e,a,l),r.flags|=262144}function ll(e){for(e=e.firstContext;e!==null;){if(!hn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Is(e){zs=e,vr=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function It(e){return q0(zs,e)}function cl(e,r){return zs===null&&Is(e),q0(e,r)}function q0(e,r){var a=r._currentValue;if(r={context:r,memoizedValue:a,next:null},vr===null){if(e===null)throw Error(i(308));vr=r,e.dependencies={lanes:0,firstContext:r},e.flags|=524288}else vr=vr.next=r;return a}var H_=typeof AbortController<"u"?AbortController:function(){var e=[],r=this.signal={aborted:!1,addEventListener:function(a,l){e.push(l)}};this.abort=function(){r.aborted=!0,e.forEach(function(a){return a()})}},F_=n.unstable_scheduleCallback,G_=n.unstable_NormalPriority,At={$$typeof:re,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function vf(){return{controller:new H_,data:new Map,refCount:0}}function Aa(e){e.refCount--,e.refCount===0&&F_(G_,function(){e.controller.abort()})}var ja=null,_f=0,wi=0,Si=null;function V_(e,r){if(ja===null){var a=ja=[];_f=0,wi=Eh(),Si={status:"pending",value:void 0,then:function(l){a.push(l)}}}return _f++,r.then(P0,P0),r}function P0(){if(--_f===0&&ja!==null){Si!==null&&(Si.status="fulfilled");var e=ja;ja=null,wi=0,Si=null;for(var r=0;r<e.length;r++)(0,e[r])()}}function Y_(e,r){var a=[],l={status:"pending",value:null,reason:null,then:function(f){a.push(f)}};return e.then(function(){l.status="fulfilled",l.value=r;for(var f=0;f<a.length;f++)(0,a[f])(r)},function(f){for(l.status="rejected",l.reason=f,f=0;f<a.length;f++)(0,a[f])(void 0)}),l}var B0=F.S;F.S=function(e,r){_y=ft(),typeof r=="object"&&r!==null&&typeof r.then=="function"&&V_(e,r),B0!==null&&B0(e,r)};var $s=Ce(null);function wf(){var e=$s.current;return e!==null?e:ot.pooledCache}function ul(e,r){r===null?Me($s,$s.current):Me($s,r.pool)}function U0(){var e=wf();return e===null?null:{parent:At._currentValue,pool:e}}var Ei=Error(i(460)),Sf=Error(i(474)),fl=Error(i(542)),hl={then:function(){}};function z0(e){return e=e.status,e==="fulfilled"||e==="rejected"}function I0(e,r,a){switch(a=e[a],a===void 0?e.push(r):a!==r&&(r.then(yr,yr),r=a),r.status){case"fulfilled":return r.value;case"rejected":throw e=r.reason,H0(e),e;default:if(typeof r.status=="string")r.then(yr,yr);else{if(e=ot,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=r,e.status="pending",e.then(function(l){if(r.status==="pending"){var f=r;f.status="fulfilled",f.value=l}},function(l){if(r.status==="pending"){var f=r;f.status="rejected",f.reason=l}})}switch(r.status){case"fulfilled":return r.value;case"rejected":throw e=r.reason,H0(e),e}throw Fs=r,Ei}}function Hs(e){try{var r=e._init;return r(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(Fs=a,Ei):a}}var Fs=null;function $0(){if(Fs===null)throw Error(i(459));var e=Fs;return Fs=null,e}function H0(e){if(e===Ei||e===fl)throw Error(i(483))}var Oi=null,ka=0;function dl(e){var r=ka;return ka+=1,Oi===null&&(Oi=[]),I0(Oi,e,r)}function Na(e,r){r=r.props.ref,e.ref=r!==void 0?r:null}function ml(e,r){throw r.$$typeof===x?Error(i(525)):(e=Object.prototype.toString.call(r),Error(i(31,e==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":e)))}function F0(e){function r($,B){if(e){var G=$.deletions;G===null?($.deletions=[B],$.flags|=16):G.push(B)}}function a($,B){if(!e)return null;for(;B!==null;)r($,B),B=B.sibling;return null}function l($){for(var B=new Map;$!==null;)$.key!==null?B.set($.key,$):B.set($.index,$),$=$.sibling;return B}function f($,B){return $=br($,B),$.index=0,$.sibling=null,$}function y($,B,G){return $.index=G,e?(G=$.alternate,G!==null?(G=G.index,G<B?($.flags|=67108866,B):G):($.flags|=67108866,B)):($.flags|=1048576,B)}function _($){return e&&$.alternate===null&&($.flags|=67108866),$}function O($,B,G,ee){return B===null||B.tag!==6?(B=ff(G,$.mode,ee),B.return=$,B):(B=f(B,G),B.return=$,B)}function R($,B,G,ee){var Ae=G.type;return Ae===S?Z($,B,G.props.children,ee,G.key):B!==null&&(B.elementType===Ae||typeof Ae=="object"&&Ae!==null&&Ae.$$typeof===z&&Hs(Ae)===B.type)?(B=f(B,G.props),Na(B,G),B.return=$,B):(B=al(G.type,G.key,G.props,null,$.mode,ee),Na(B,G),B.return=$,B)}function V($,B,G,ee){return B===null||B.tag!==4||B.stateNode.containerInfo!==G.containerInfo||B.stateNode.implementation!==G.implementation?(B=hf(G,$.mode,ee),B.return=$,B):(B=f(B,G.children||[]),B.return=$,B)}function Z($,B,G,ee,Ae){return B===null||B.tag!==7?(B=Bs(G,$.mode,ee,Ae),B.return=$,B):(B=f(B,G),B.return=$,B)}function ie($,B,G){if(typeof B=="string"&&B!==""||typeof B=="number"||typeof B=="bigint")return B=ff(""+B,$.mode,G),B.return=$,B;if(typeof B=="object"&&B!==null){switch(B.$$typeof){case v:return G=al(B.type,B.key,B.props,null,$.mode,G),Na(G,B),G.return=$,G;case w:return B=hf(B,$.mode,G),B.return=$,B;case z:return B=Hs(B),ie($,B,G)}if(Oe(B)||W(B))return B=Bs(B,$.mode,G,null),B.return=$,B;if(typeof B.then=="function")return ie($,dl(B),G);if(B.$$typeof===re)return ie($,cl($,B),G);ml($,B)}return null}function Y($,B,G,ee){var Ae=B!==null?B.key:null;if(typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint")return Ae!==null?null:O($,B,""+G,ee);if(typeof G=="object"&&G!==null){switch(G.$$typeof){case v:return G.key===Ae?R($,B,G,ee):null;case w:return G.key===Ae?V($,B,G,ee):null;case z:return G=Hs(G),Y($,B,G,ee)}if(Oe(G)||W(G))return Ae!==null?null:Z($,B,G,ee,null);if(typeof G.then=="function")return Y($,B,dl(G),ee);if(G.$$typeof===re)return Y($,B,cl($,G),ee);ml($,G)}return null}function Q($,B,G,ee,Ae){if(typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint")return $=$.get(G)||null,O(B,$,""+ee,Ae);if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case v:return $=$.get(ee.key===null?G:ee.key)||null,R(B,$,ee,Ae);case w:return $=$.get(ee.key===null?G:ee.key)||null,V(B,$,ee,Ae);case z:return ee=Hs(ee),Q($,B,G,ee,Ae)}if(Oe(ee)||W(ee))return $=$.get(G)||null,Z(B,$,ee,Ae,null);if(typeof ee.then=="function")return Q($,B,G,dl(ee),Ae);if(ee.$$typeof===re)return Q($,B,G,cl(B,ee),Ae);ml(B,ee)}return null}function ve($,B,G,ee){for(var Ae=null,Ke=null,_e=B,Le=B=0,He=null;_e!==null&&Le<G.length;Le++){_e.index>Le?(He=_e,_e=null):He=_e.sibling;var Je=Y($,_e,G[Le],ee);if(Je===null){_e===null&&(_e=He);break}e&&_e&&Je.alternate===null&&r($,_e),B=y(Je,B,Le),Ke===null?Ae=Je:Ke.sibling=Je,Ke=Je,_e=He}if(Le===G.length)return a($,_e),Ge&&xr($,Le),Ae;if(_e===null){for(;Le<G.length;Le++)_e=ie($,G[Le],ee),_e!==null&&(B=y(_e,B,Le),Ke===null?Ae=_e:Ke.sibling=_e,Ke=_e);return Ge&&xr($,Le),Ae}for(_e=l(_e);Le<G.length;Le++)He=Q(_e,$,Le,G[Le],ee),He!==null&&(e&&He.alternate!==null&&_e.delete(He.key===null?Le:He.key),B=y(He,B,Le),Ke===null?Ae=He:Ke.sibling=He,Ke=He);return e&&_e.forEach(function(ms){return r($,ms)}),Ge&&xr($,Le),Ae}function Te($,B,G,ee){if(G==null)throw Error(i(151));for(var Ae=null,Ke=null,_e=B,Le=B=0,He=null,Je=G.next();_e!==null&&!Je.done;Le++,Je=G.next()){_e.index>Le?(He=_e,_e=null):He=_e.sibling;var ms=Y($,_e,Je.value,ee);if(ms===null){_e===null&&(_e=He);break}e&&_e&&ms.alternate===null&&r($,_e),B=y(ms,B,Le),Ke===null?Ae=ms:Ke.sibling=ms,Ke=ms,_e=He}if(Je.done)return a($,_e),Ge&&xr($,Le),Ae;if(_e===null){for(;!Je.done;Le++,Je=G.next())Je=ie($,Je.value,ee),Je!==null&&(B=y(Je,B,Le),Ke===null?Ae=Je:Ke.sibling=Je,Ke=Je);return Ge&&xr($,Le),Ae}for(_e=l(_e);!Je.done;Le++,Je=G.next())Je=Q(_e,$,Le,Je.value,ee),Je!==null&&(e&&Je.alternate!==null&&_e.delete(Je.key===null?Le:Je.key),B=y(Je,B,Le),Ke===null?Ae=Je:Ke.sibling=Je,Ke=Je);return e&&_e.forEach(function(sS){return r($,sS)}),Ge&&xr($,Le),Ae}function st($,B,G,ee){if(typeof G=="object"&&G!==null&&G.type===S&&G.key===null&&(G=G.props.children),typeof G=="object"&&G!==null){switch(G.$$typeof){case v:e:{for(var Ae=G.key;B!==null;){if(B.key===Ae){if(Ae=G.type,Ae===S){if(B.tag===7){a($,B.sibling),ee=f(B,G.props.children),ee.return=$,$=ee;break e}}else if(B.elementType===Ae||typeof Ae=="object"&&Ae!==null&&Ae.$$typeof===z&&Hs(Ae)===B.type){a($,B.sibling),ee=f(B,G.props),Na(ee,G),ee.return=$,$=ee;break e}a($,B);break}else r($,B);B=B.sibling}G.type===S?(ee=Bs(G.props.children,$.mode,ee,G.key),ee.return=$,$=ee):(ee=al(G.type,G.key,G.props,null,$.mode,ee),Na(ee,G),ee.return=$,$=ee)}return _($);case w:e:{for(Ae=G.key;B!==null;){if(B.key===Ae)if(B.tag===4&&B.stateNode.containerInfo===G.containerInfo&&B.stateNode.implementation===G.implementation){a($,B.sibling),ee=f(B,G.children||[]),ee.return=$,$=ee;break e}else{a($,B);break}else r($,B);B=B.sibling}ee=hf(G,$.mode,ee),ee.return=$,$=ee}return _($);case z:return G=Hs(G),st($,B,G,ee)}if(Oe(G))return ve($,B,G,ee);if(W(G)){if(Ae=W(G),typeof Ae!="function")throw Error(i(150));return G=Ae.call(G),Te($,B,G,ee)}if(typeof G.then=="function")return st($,B,dl(G),ee);if(G.$$typeof===re)return st($,B,cl($,G),ee);ml($,G)}return typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint"?(G=""+G,B!==null&&B.tag===6?(a($,B.sibling),ee=f(B,G),ee.return=$,$=ee):(a($,B),ee=ff(G,$.mode,ee),ee.return=$,$=ee),_($)):a($,B)}return function($,B,G,ee){try{ka=0;var Ae=st($,B,G,ee);return Oi=null,Ae}catch(_e){if(_e===Ei||_e===fl)throw _e;var Ke=dn(29,_e,null,$.mode);return Ke.lanes=ee,Ke.return=$,Ke}finally{}}}var Gs=F0(!0),G0=F0(!1),Xr=!1;function Ef(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Of(e,r){e=e.updateQueue,r.updateQueue===e&&(r.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Wr(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Zr(e,r,a){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(Qe&2)!==0){var f=l.pending;return f===null?r.next=r:(r.next=f.next,f.next=r),l.pending=r,r=il(e),k0(e,null,a),r}return sl(e,l,r,a),il(e)}function Ta(e,r,a){if(r=r.updateQueue,r!==null&&(r=r.shared,(a&4194048)!==0)){var l=r.lanes;l&=e.pendingLanes,a|=l,r.lanes=a,Cs(e,a)}}function Af(e,r){var a=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,a===l)){var f=null,y=null;if(a=a.firstBaseUpdate,a!==null){do{var _={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};y===null?f=y=_:y=y.next=_,a=a.next}while(a!==null);y===null?f=y=r:y=y.next=r}else f=y=r;a={baseState:l.baseState,firstBaseUpdate:f,lastBaseUpdate:y,shared:l.shared,callbacks:l.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=r:e.next=r,a.lastBaseUpdate=r}var jf=!1;function Ca(){if(jf){var e=Si;if(e!==null)throw e}}function Ma(e,r,a,l){jf=!1;var f=e.updateQueue;Xr=!1;var y=f.firstBaseUpdate,_=f.lastBaseUpdate,O=f.shared.pending;if(O!==null){f.shared.pending=null;var R=O,V=R.next;R.next=null,_===null?y=V:_.next=V,_=R;var Z=e.alternate;Z!==null&&(Z=Z.updateQueue,O=Z.lastBaseUpdate,O!==_&&(O===null?Z.firstBaseUpdate=V:O.next=V,Z.lastBaseUpdate=R))}if(y!==null){var ie=f.baseState;_=0,Z=V=R=null,O=y;do{var Y=O.lane&-536870913,Q=Y!==O.lane;if(Q?($e&Y)===Y:(l&Y)===Y){Y!==0&&Y===wi&&(jf=!0),Z!==null&&(Z=Z.next={lane:0,tag:O.tag,payload:O.payload,callback:null,next:null});e:{var ve=e,Te=O;Y=r;var st=a;switch(Te.tag){case 1:if(ve=Te.payload,typeof ve=="function"){ie=ve.call(st,ie,Y);break e}ie=ve;break e;case 3:ve.flags=ve.flags&-65537|128;case 0:if(ve=Te.payload,Y=typeof ve=="function"?ve.call(st,ie,Y):ve,Y==null)break e;ie=b({},ie,Y);break e;case 2:Xr=!0}}Y=O.callback,Y!==null&&(e.flags|=64,Q&&(e.flags|=8192),Q=f.callbacks,Q===null?f.callbacks=[Y]:Q.push(Y))}else Q={lane:Y,tag:O.tag,payload:O.payload,callback:O.callback,next:null},Z===null?(V=Z=Q,R=ie):Z=Z.next=Q,_|=Y;if(O=O.next,O===null){if(O=f.shared.pending,O===null)break;Q=O,O=Q.next,Q.next=null,f.lastBaseUpdate=Q,f.shared.pending=null}}while(!0);Z===null&&(R=ie),f.baseState=R,f.firstBaseUpdate=V,f.lastBaseUpdate=Z,y===null&&(f.shared.lanes=0),ss|=_,e.lanes=_,e.memoizedState=ie}}function V0(e,r){if(typeof e!="function")throw Error(i(191,e));e.call(r)}function Y0(e,r){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)V0(a[e],r)}var Ai=Ce(null),pl=Ce(0);function K0(e,r){e=Tr,Me(pl,e),Me(Ai,r),Tr=e|r.baseLanes}function kf(){Me(pl,Tr),Me(Ai,Ai.current)}function Nf(){Tr=pl.current,Ne(Ai),Ne(pl)}var mn=Ce(null),Pn=null;function es(e){var r=e.alternate;Me(wt,wt.current&1),Me(mn,e),Pn===null&&(r===null||Ai.current!==null||r.memoizedState!==null)&&(Pn=e)}function Tf(e){Me(wt,wt.current),Me(mn,e),Pn===null&&(Pn=e)}function J0(e){e.tag===22?(Me(wt,wt.current),Me(mn,e),Pn===null&&(Pn=e)):ts()}function ts(){Me(wt,wt.current),Me(mn,mn.current)}function pn(e){Ne(mn),Pn===e&&(Pn=null),Ne(wt)}var wt=Ce(0);function yl(e){for(var r=e;r!==null;){if(r.tag===13){var a=r.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||qh(a)||Ph(a)))return r}else if(r.tag===19&&(r.memoizedProps.revealOrder==="forwards"||r.memoizedProps.revealOrder==="backwards"||r.memoizedProps.revealOrder==="unstable_legacy-backwards"||r.memoizedProps.revealOrder==="together")){if((r.flags&128)!==0)return r}else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===e)break;for(;r.sibling===null;){if(r.return===null||r.return===e)return null;r=r.return}r.sibling.return=r.return,r=r.sibling}return null}var wr=0,De=null,nt=null,jt=null,gl=!1,ji=!1,Vs=!1,bl=0,Ra=0,ki=null,K_=0;function bt(){throw Error(i(321))}function Cf(e,r){if(r===null)return!1;for(var a=0;a<r.length&&a<e.length;a++)if(!hn(e[a],r[a]))return!1;return!0}function Mf(e,r,a,l,f,y){return wr=y,De=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,F.H=e===null||e.memoizedState===null?Mp:Yf,Vs=!1,y=a(l,f),Vs=!1,ji&&(y=X0(r,a,l,f)),Q0(e),y}function Q0(e){F.H=qa;var r=nt!==null&&nt.next!==null;if(wr=0,jt=nt=De=null,gl=!1,Ra=0,ki=null,r)throw Error(i(300));e===null||kt||(e=e.dependencies,e!==null&&ll(e)&&(kt=!0))}function X0(e,r,a,l){De=e;var f=0;do{if(ji&&(ki=null),Ra=0,ji=!1,25<=f)throw Error(i(301));if(f+=1,jt=nt=null,e.updateQueue!=null){var y=e.updateQueue;y.lastEffect=null,y.events=null,y.stores=null,y.memoCache!=null&&(y.memoCache.index=0)}F.H=Rp,y=r(a,l)}while(ji);return y}function J_(){var e=F.H,r=e.useState()[0];return r=typeof r.then=="function"?Da(r):r,e=e.useState()[0],(nt!==null?nt.memoizedState:null)!==e&&(De.flags|=1024),r}function Rf(){var e=bl!==0;return bl=0,e}function Df(e,r,a){r.updateQueue=e.updateQueue,r.flags&=-2053,e.lanes&=~a}function Lf(e){if(gl){for(e=e.memoizedState;e!==null;){var r=e.queue;r!==null&&(r.pending=null),e=e.next}gl=!1}wr=0,jt=nt=De=null,ji=!1,Ra=bl=0,ki=null}function Yt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return jt===null?De.memoizedState=jt=e:jt=jt.next=e,jt}function St(){if(nt===null){var e=De.alternate;e=e!==null?e.memoizedState:null}else e=nt.next;var r=jt===null?De.memoizedState:jt.next;if(r!==null)jt=r,nt=e;else{if(e===null)throw De.alternate===null?Error(i(467)):Error(i(310));nt=e,e={memoizedState:nt.memoizedState,baseState:nt.baseState,baseQueue:nt.baseQueue,queue:nt.queue,next:null},jt===null?De.memoizedState=jt=e:jt=jt.next=e}return jt}function xl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Da(e){var r=Ra;return Ra+=1,ki===null&&(ki=[]),e=I0(ki,e,r),r=De,(jt===null?r.memoizedState:jt.next)===null&&(r=r.alternate,F.H=r===null||r.memoizedState===null?Mp:Yf),e}function vl(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Da(e);if(e.$$typeof===re)return It(e)}throw Error(i(438,String(e)))}function qf(e){var r=null,a=De.updateQueue;if(a!==null&&(r=a.memoCache),r==null){var l=De.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(r={data:l.data.map(function(f){return f.slice()}),index:0})))}if(r==null&&(r={data:[],index:0}),a===null&&(a=xl(),De.updateQueue=a),a.memoCache=r,a=r.data[r.index],a===void 0)for(a=r.data[r.index]=Array(e),l=0;l<e;l++)a[l]=D;return r.index++,a}function Sr(e,r){return typeof r=="function"?r(e):r}function _l(e){var r=St();return Pf(r,nt,e)}function Pf(e,r,a){var l=e.queue;if(l===null)throw Error(i(311));l.lastRenderedReducer=a;var f=e.baseQueue,y=l.pending;if(y!==null){if(f!==null){var _=f.next;f.next=y.next,y.next=_}r.baseQueue=f=y,l.pending=null}if(y=e.baseState,f===null)e.memoizedState=y;else{r=f.next;var O=_=null,R=null,V=r,Z=!1;do{var ie=V.lane&-536870913;if(ie!==V.lane?($e&ie)===ie:(wr&ie)===ie){var Y=V.revertLane;if(Y===0)R!==null&&(R=R.next={lane:0,revertLane:0,gesture:null,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null}),ie===wi&&(Z=!0);else if((wr&Y)===Y){V=V.next,Y===wi&&(Z=!0);continue}else ie={lane:0,revertLane:V.revertLane,gesture:null,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null},R===null?(O=R=ie,_=y):R=R.next=ie,De.lanes|=Y,ss|=Y;ie=V.action,Vs&&a(y,ie),y=V.hasEagerState?V.eagerState:a(y,ie)}else Y={lane:ie,revertLane:V.revertLane,gesture:V.gesture,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null},R===null?(O=R=Y,_=y):R=R.next=Y,De.lanes|=ie,ss|=ie;V=V.next}while(V!==null&&V!==r);if(R===null?_=y:R.next=O,!hn(y,e.memoizedState)&&(kt=!0,Z&&(a=Si,a!==null)))throw a;e.memoizedState=y,e.baseState=_,e.baseQueue=R,l.lastRenderedState=y}return f===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function Bf(e){var r=St(),a=r.queue;if(a===null)throw Error(i(311));a.lastRenderedReducer=e;var l=a.dispatch,f=a.pending,y=r.memoizedState;if(f!==null){a.pending=null;var _=f=f.next;do y=e(y,_.action),_=_.next;while(_!==f);hn(y,r.memoizedState)||(kt=!0),r.memoizedState=y,r.baseQueue===null&&(r.baseState=y),a.lastRenderedState=y}return[y,l]}function W0(e,r,a){var l=De,f=St(),y=Ge;if(y){if(a===void 0)throw Error(i(407));a=a()}else a=r();var _=!hn((nt||f).memoizedState,a);if(_&&(f.memoizedState=a,kt=!0),f=f.queue,If(tp.bind(null,l,f,e),[e]),f.getSnapshot!==r||_||jt!==null&&jt.memoizedState.tag&1){if(l.flags|=2048,Ni(9,{destroy:void 0},ep.bind(null,l,f,a,r),null),ot===null)throw Error(i(349));y||(wr&127)!==0||Z0(l,r,a)}return a}function Z0(e,r,a){e.flags|=16384,e={getSnapshot:r,value:a},r=De.updateQueue,r===null?(r=xl(),De.updateQueue=r,r.stores=[e]):(a=r.stores,a===null?r.stores=[e]:a.push(e))}function ep(e,r,a,l){r.value=a,r.getSnapshot=l,np(r)&&rp(e)}function tp(e,r,a){return a(function(){np(r)&&rp(e)})}function np(e){var r=e.getSnapshot;e=e.value;try{var a=r();return!hn(e,a)}catch{return!0}}function rp(e){var r=Ps(e,2);r!==null&&ln(r,e,2)}function Uf(e){var r=Yt();if(typeof e=="function"){var a=e;if(e=a(),Vs){un(!0);try{a()}finally{un(!1)}}}return r.memoizedState=r.baseState=e,r.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Sr,lastRenderedState:e},r}function sp(e,r,a,l){return e.baseState=a,Pf(e,nt,typeof l=="function"?l:Sr)}function Q_(e,r,a,l,f){if(El(e))throw Error(i(485));if(e=r.action,e!==null){var y={payload:f,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(_){y.listeners.push(_)}};F.T!==null?a(!0):y.isTransition=!1,l(y),a=r.pending,a===null?(y.next=r.pending=y,ip(r,y)):(y.next=a.next,r.pending=a.next=y)}}function ip(e,r){var a=r.action,l=r.payload,f=e.state;if(r.isTransition){var y=F.T,_={};F.T=_;try{var O=a(f,l),R=F.S;R!==null&&R(_,O),ap(e,r,O)}catch(V){zf(e,r,V)}finally{y!==null&&_.types!==null&&(y.types=_.types),F.T=y}}else try{y=a(f,l),ap(e,r,y)}catch(V){zf(e,r,V)}}function ap(e,r,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(l){op(e,r,l)},function(l){return zf(e,r,l)}):op(e,r,a)}function op(e,r,a){r.status="fulfilled",r.value=a,lp(r),e.state=a,r=e.pending,r!==null&&(a=r.next,a===r?e.pending=null:(a=a.next,r.next=a,ip(e,a)))}function zf(e,r,a){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do r.status="rejected",r.reason=a,lp(r),r=r.next;while(r!==l)}e.action=null}function lp(e){e=e.listeners;for(var r=0;r<e.length;r++)(0,e[r])()}function cp(e,r){return r}function up(e,r){if(Ge){var a=ot.formState;if(a!==null){e:{var l=De;if(Ge){if(ct){t:{for(var f=ct,y=qn;f.nodeType!==8;){if(!y){f=null;break t}if(f=Bn(f.nextSibling),f===null){f=null;break t}}y=f.data,f=y==="F!"||y==="F"?f:null}if(f){ct=Bn(f.nextSibling),l=f.data==="F!";break e}}Jr(l)}l=!1}l&&(r=a[0])}}return a=Yt(),a.memoizedState=a.baseState=r,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:cp,lastRenderedState:r},a.queue=l,a=Np.bind(null,De,l),l.dispatch=a,l=Uf(!1),y=Vf.bind(null,De,!1,l.queue),l=Yt(),f={state:r,dispatch:null,action:e,pending:null},l.queue=f,a=Q_.bind(null,De,f,y,a),f.dispatch=a,l.memoizedState=e,[r,a,!1]}function fp(e){var r=St();return hp(r,nt,e)}function hp(e,r,a){if(r=Pf(e,r,cp)[0],e=_l(Sr)[0],typeof r=="object"&&r!==null&&typeof r.then=="function")try{var l=Da(r)}catch(_){throw _===Ei?fl:_}else l=r;r=St();var f=r.queue,y=f.dispatch;return a!==r.memoizedState&&(De.flags|=2048,Ni(9,{destroy:void 0},X_.bind(null,f,a),null)),[l,y,e]}function X_(e,r){e.action=r}function dp(e){var r=St(),a=nt;if(a!==null)return hp(r,a,e);St(),r=r.memoizedState,a=St();var l=a.queue.dispatch;return a.memoizedState=e,[r,l,!1]}function Ni(e,r,a,l){return e={tag:e,create:a,deps:l,inst:r,next:null},r=De.updateQueue,r===null&&(r=xl(),De.updateQueue=r),a=r.lastEffect,a===null?r.lastEffect=e.next=e:(l=a.next,a.next=e,e.next=l,r.lastEffect=e),e}function mp(){return St().memoizedState}function wl(e,r,a,l){var f=Yt();De.flags|=e,f.memoizedState=Ni(1|r,{destroy:void 0},a,l===void 0?null:l)}function Sl(e,r,a,l){var f=St();l=l===void 0?null:l;var y=f.memoizedState.inst;nt!==null&&l!==null&&Cf(l,nt.memoizedState.deps)?f.memoizedState=Ni(r,y,a,l):(De.flags|=e,f.memoizedState=Ni(1|r,y,a,l))}function pp(e,r){wl(8390656,8,e,r)}function If(e,r){Sl(2048,8,e,r)}function W_(e){De.flags|=4;var r=De.updateQueue;if(r===null)r=xl(),De.updateQueue=r,r.events=[e];else{var a=r.events;a===null?r.events=[e]:a.push(e)}}function yp(e){var r=St().memoizedState;return W_({ref:r,nextImpl:e}),function(){if((Qe&2)!==0)throw Error(i(440));return r.impl.apply(void 0,arguments)}}function gp(e,r){return Sl(4,2,e,r)}function bp(e,r){return Sl(4,4,e,r)}function xp(e,r){if(typeof r=="function"){e=e();var a=r(e);return function(){typeof a=="function"?a():r(null)}}if(r!=null)return e=e(),r.current=e,function(){r.current=null}}function vp(e,r,a){a=a!=null?a.concat([e]):null,Sl(4,4,xp.bind(null,r,e),a)}function $f(){}function _p(e,r){var a=St();r=r===void 0?null:r;var l=a.memoizedState;return r!==null&&Cf(r,l[1])?l[0]:(a.memoizedState=[e,r],e)}function wp(e,r){var a=St();r=r===void 0?null:r;var l=a.memoizedState;if(r!==null&&Cf(r,l[1]))return l[0];if(l=e(),Vs){un(!0);try{e()}finally{un(!1)}}return a.memoizedState=[l,r],l}function Hf(e,r,a){return a===void 0||(wr&1073741824)!==0&&($e&261930)===0?e.memoizedState=r:(e.memoizedState=a,e=Sy(),De.lanes|=e,ss|=e,a)}function Sp(e,r,a,l){return hn(a,r)?a:Ai.current!==null?(e=Hf(e,a,l),hn(e,r)||(kt=!0),e):(wr&42)===0||(wr&1073741824)!==0&&($e&261930)===0?(kt=!0,e.memoizedState=a):(e=Sy(),De.lanes|=e,ss|=e,r)}function Ep(e,r,a,l,f){var y=J.p;J.p=y!==0&&8>y?y:8;var _=F.T,O={};F.T=O,Vf(e,!1,r,a);try{var R=f(),V=F.S;if(V!==null&&V(O,R),R!==null&&typeof R=="object"&&typeof R.then=="function"){var Z=Y_(R,l);La(e,r,Z,bn(e))}else La(e,r,l,bn(e))}catch(ie){La(e,r,{then:function(){},status:"rejected",reason:ie},bn())}finally{J.p=y,_!==null&&O.types!==null&&(_.types=O.types),F.T=_}}function Z_(){}function Ff(e,r,a,l){if(e.tag!==5)throw Error(i(476));var f=Op(e).queue;Ep(e,f,r,le,a===null?Z_:function(){return Ap(e),a(l)})}function Op(e){var r=e.memoizedState;if(r!==null)return r;r={memoizedState:le,baseState:le,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Sr,lastRenderedState:le},next:null};var a={};return r.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Sr,lastRenderedState:a},next:null},e.memoizedState=r,e=e.alternate,e!==null&&(e.memoizedState=r),r}function Ap(e){var r=Op(e);r.next===null&&(r=e.alternate.memoizedState),La(e,r.next.queue,{},bn())}function Gf(){return It(Wa)}function jp(){return St().memoizedState}function kp(){return St().memoizedState}function ew(e){for(var r=e.return;r!==null;){switch(r.tag){case 24:case 3:var a=bn();e=Wr(a);var l=Zr(r,e,a);l!==null&&(ln(l,r,a),Ta(l,r,a)),r={cache:vf()},e.payload=r;return}r=r.return}}function tw(e,r,a){var l=bn();a={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},El(e)?Tp(r,a):(a=cf(e,r,a,l),a!==null&&(ln(a,e,l),Cp(a,r,l)))}function Np(e,r,a){var l=bn();La(e,r,a,l)}function La(e,r,a,l){var f={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(El(e))Tp(r,f);else{var y=e.alternate;if(e.lanes===0&&(y===null||y.lanes===0)&&(y=r.lastRenderedReducer,y!==null))try{var _=r.lastRenderedState,O=y(_,a);if(f.hasEagerState=!0,f.eagerState=O,hn(O,_))return sl(e,r,f,0),ot===null&&rl(),!1}catch{}finally{}if(a=cf(e,r,f,l),a!==null)return ln(a,e,l),Cp(a,r,l),!0}return!1}function Vf(e,r,a,l){if(l={lane:2,revertLane:Eh(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},El(e)){if(r)throw Error(i(479))}else r=cf(e,a,l,2),r!==null&&ln(r,e,2)}function El(e){var r=e.alternate;return e===De||r!==null&&r===De}function Tp(e,r){ji=gl=!0;var a=e.pending;a===null?r.next=r:(r.next=a.next,a.next=r),e.pending=r}function Cp(e,r,a){if((a&4194048)!==0){var l=r.lanes;l&=e.pendingLanes,a|=l,r.lanes=a,Cs(e,a)}}var qa={readContext:It,use:vl,useCallback:bt,useContext:bt,useEffect:bt,useImperativeHandle:bt,useLayoutEffect:bt,useInsertionEffect:bt,useMemo:bt,useReducer:bt,useRef:bt,useState:bt,useDebugValue:bt,useDeferredValue:bt,useTransition:bt,useSyncExternalStore:bt,useId:bt,useHostTransitionStatus:bt,useFormState:bt,useActionState:bt,useOptimistic:bt,useMemoCache:bt,useCacheRefresh:bt};qa.useEffectEvent=bt;var Mp={readContext:It,use:vl,useCallback:function(e,r){return Yt().memoizedState=[e,r===void 0?null:r],e},useContext:It,useEffect:pp,useImperativeHandle:function(e,r,a){a=a!=null?a.concat([e]):null,wl(4194308,4,xp.bind(null,r,e),a)},useLayoutEffect:function(e,r){return wl(4194308,4,e,r)},useInsertionEffect:function(e,r){wl(4,2,e,r)},useMemo:function(e,r){var a=Yt();r=r===void 0?null:r;var l=e();if(Vs){un(!0);try{e()}finally{un(!1)}}return a.memoizedState=[l,r],l},useReducer:function(e,r,a){var l=Yt();if(a!==void 0){var f=a(r);if(Vs){un(!0);try{a(r)}finally{un(!1)}}}else f=r;return l.memoizedState=l.baseState=f,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:f},l.queue=e,e=e.dispatch=tw.bind(null,De,e),[l.memoizedState,e]},useRef:function(e){var r=Yt();return e={current:e},r.memoizedState=e},useState:function(e){e=Uf(e);var r=e.queue,a=Np.bind(null,De,r);return r.dispatch=a,[e.memoizedState,a]},useDebugValue:$f,useDeferredValue:function(e,r){var a=Yt();return Hf(a,e,r)},useTransition:function(){var e=Uf(!1);return e=Ep.bind(null,De,e.queue,!0,!1),Yt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,r,a){var l=De,f=Yt();if(Ge){if(a===void 0)throw Error(i(407));a=a()}else{if(a=r(),ot===null)throw Error(i(349));($e&127)!==0||Z0(l,r,a)}f.memoizedState=a;var y={value:a,getSnapshot:r};return f.queue=y,pp(tp.bind(null,l,y,e),[e]),l.flags|=2048,Ni(9,{destroy:void 0},ep.bind(null,l,y,a,r),null),a},useId:function(){var e=Yt(),r=ot.identifierPrefix;if(Ge){var a=rr,l=nr;a=(l&~(1<<32-Ft(l)-1)).toString(32)+a,r="_"+r+"R_"+a,a=bl++,0<a&&(r+="H"+a.toString(32)),r+="_"}else a=K_++,r="_"+r+"r_"+a.toString(32)+"_";return e.memoizedState=r},useHostTransitionStatus:Gf,useFormState:up,useActionState:up,useOptimistic:function(e){var r=Yt();r.memoizedState=r.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return r.queue=a,r=Vf.bind(null,De,!0,a),a.dispatch=r,[e,r]},useMemoCache:qf,useCacheRefresh:function(){return Yt().memoizedState=ew.bind(null,De)},useEffectEvent:function(e){var r=Yt(),a={impl:e};return r.memoizedState=a,function(){if((Qe&2)!==0)throw Error(i(440));return a.impl.apply(void 0,arguments)}}},Yf={readContext:It,use:vl,useCallback:_p,useContext:It,useEffect:If,useImperativeHandle:vp,useInsertionEffect:gp,useLayoutEffect:bp,useMemo:wp,useReducer:_l,useRef:mp,useState:function(){return _l(Sr)},useDebugValue:$f,useDeferredValue:function(e,r){var a=St();return Sp(a,nt.memoizedState,e,r)},useTransition:function(){var e=_l(Sr)[0],r=St().memoizedState;return[typeof e=="boolean"?e:Da(e),r]},useSyncExternalStore:W0,useId:jp,useHostTransitionStatus:Gf,useFormState:fp,useActionState:fp,useOptimistic:function(e,r){var a=St();return sp(a,nt,e,r)},useMemoCache:qf,useCacheRefresh:kp};Yf.useEffectEvent=yp;var Rp={readContext:It,use:vl,useCallback:_p,useContext:It,useEffect:If,useImperativeHandle:vp,useInsertionEffect:gp,useLayoutEffect:bp,useMemo:wp,useReducer:Bf,useRef:mp,useState:function(){return Bf(Sr)},useDebugValue:$f,useDeferredValue:function(e,r){var a=St();return nt===null?Hf(a,e,r):Sp(a,nt.memoizedState,e,r)},useTransition:function(){var e=Bf(Sr)[0],r=St().memoizedState;return[typeof e=="boolean"?e:Da(e),r]},useSyncExternalStore:W0,useId:jp,useHostTransitionStatus:Gf,useFormState:dp,useActionState:dp,useOptimistic:function(e,r){var a=St();return nt!==null?sp(a,nt,e,r):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:qf,useCacheRefresh:kp};Rp.useEffectEvent=yp;function Kf(e,r,a,l){r=e.memoizedState,a=a(l,r),a=a==null?r:b({},r,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var Jf={enqueueSetState:function(e,r,a){e=e._reactInternals;var l=bn(),f=Wr(l);f.payload=r,a!=null&&(f.callback=a),r=Zr(e,f,l),r!==null&&(ln(r,e,l),Ta(r,e,l))},enqueueReplaceState:function(e,r,a){e=e._reactInternals;var l=bn(),f=Wr(l);f.tag=1,f.payload=r,a!=null&&(f.callback=a),r=Zr(e,f,l),r!==null&&(ln(r,e,l),Ta(r,e,l))},enqueueForceUpdate:function(e,r){e=e._reactInternals;var a=bn(),l=Wr(a);l.tag=2,r!=null&&(l.callback=r),r=Zr(e,l,a),r!==null&&(ln(r,e,a),Ta(r,e,a))}};function Dp(e,r,a,l,f,y,_){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,y,_):r.prototype&&r.prototype.isPureReactComponent?!wa(a,l)||!wa(f,y):!0}function Lp(e,r,a,l){e=r.state,typeof r.componentWillReceiveProps=="function"&&r.componentWillReceiveProps(a,l),typeof r.UNSAFE_componentWillReceiveProps=="function"&&r.UNSAFE_componentWillReceiveProps(a,l),r.state!==e&&Jf.enqueueReplaceState(r,r.state,null)}function Ys(e,r){var a=r;if("ref"in r){a={};for(var l in r)l!=="ref"&&(a[l]=r[l])}if(e=e.defaultProps){a===r&&(a=b({},a));for(var f in e)a[f]===void 0&&(a[f]=e[f])}return a}function qp(e){nl(e)}function Pp(e){console.error(e)}function Bp(e){nl(e)}function Ol(e,r){try{var a=e.onUncaughtError;a(r.value,{componentStack:r.stack})}catch(l){setTimeout(function(){throw l})}}function Up(e,r,a){try{var l=e.onCaughtError;l(a.value,{componentStack:a.stack,errorBoundary:r.tag===1?r.stateNode:null})}catch(f){setTimeout(function(){throw f})}}function Qf(e,r,a){return a=Wr(a),a.tag=3,a.payload={element:null},a.callback=function(){Ol(e,r)},a}function zp(e){return e=Wr(e),e.tag=3,e}function Ip(e,r,a,l){var f=a.type.getDerivedStateFromError;if(typeof f=="function"){var y=l.value;e.payload=function(){return f(y)},e.callback=function(){Up(r,a,l)}}var _=a.stateNode;_!==null&&typeof _.componentDidCatch=="function"&&(e.callback=function(){Up(r,a,l),typeof f!="function"&&(is===null?is=new Set([this]):is.add(this));var O=l.stack;this.componentDidCatch(l.value,{componentStack:O!==null?O:""})})}function nw(e,r,a,l,f){if(a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(r=a.alternate,r!==null&&_i(r,a,f,!0),a=mn.current,a!==null){switch(a.tag){case 31:case 13:return Pn===null?Pl():a.alternate===null&&xt===0&&(xt=3),a.flags&=-257,a.flags|=65536,a.lanes=f,l===hl?a.flags|=16384:(r=a.updateQueue,r===null?a.updateQueue=new Set([l]):r.add(l),_h(e,l,f)),!1;case 22:return a.flags|=65536,l===hl?a.flags|=16384:(r=a.updateQueue,r===null?(r={transitions:null,markerInstances:null,retryQueue:new Set([l])},a.updateQueue=r):(a=r.retryQueue,a===null?r.retryQueue=new Set([l]):a.add(l)),_h(e,l,f)),!1}throw Error(i(435,a.tag))}return _h(e,l,f),Pl(),!1}if(Ge)return r=mn.current,r!==null?((r.flags&65536)===0&&(r.flags|=256),r.flags|=65536,r.lanes=f,l!==pf&&(e=Error(i(422),{cause:l}),Oa(Rn(e,a)))):(l!==pf&&(r=Error(i(423),{cause:l}),Oa(Rn(r,a))),e=e.current.alternate,e.flags|=65536,f&=-f,e.lanes|=f,l=Rn(l,a),f=Qf(e.stateNode,l,f),Af(e,f),xt!==4&&(xt=2)),!1;var y=Error(i(520),{cause:l});if(y=Rn(y,a),Fa===null?Fa=[y]:Fa.push(y),xt!==4&&(xt=2),r===null)return!0;l=Rn(l,a),a=r;do{switch(a.tag){case 3:return a.flags|=65536,e=f&-f,a.lanes|=e,e=Qf(a.stateNode,l,e),Af(a,e),!1;case 1:if(r=a.type,y=a.stateNode,(a.flags&128)===0&&(typeof r.getDerivedStateFromError=="function"||y!==null&&typeof y.componentDidCatch=="function"&&(is===null||!is.has(y))))return a.flags|=65536,f&=-f,a.lanes|=f,f=zp(f),Ip(f,e,a,l),Af(a,f),!1}a=a.return}while(a!==null);return!1}var Xf=Error(i(461)),kt=!1;function $t(e,r,a,l){r.child=e===null?G0(r,null,a,l):Gs(r,e.child,a,l)}function $p(e,r,a,l,f){a=a.render;var y=r.ref;if("ref"in l){var _={};for(var O in l)O!=="ref"&&(_[O]=l[O])}else _=l;return Is(r),l=Mf(e,r,a,_,y,f),O=Rf(),e!==null&&!kt?(Df(e,r,f),Er(e,r,f)):(Ge&&O&&df(r),r.flags|=1,$t(e,r,l,f),r.child)}function Hp(e,r,a,l,f){if(e===null){var y=a.type;return typeof y=="function"&&!uf(y)&&y.defaultProps===void 0&&a.compare===null?(r.tag=15,r.type=y,Fp(e,r,y,l,f)):(e=al(a.type,null,l,r,r.mode,f),e.ref=r.ref,e.return=r,r.child=e)}if(y=e.child,!ih(e,f)){var _=y.memoizedProps;if(a=a.compare,a=a!==null?a:wa,a(_,l)&&e.ref===r.ref)return Er(e,r,f)}return r.flags|=1,e=br(y,l),e.ref=r.ref,e.return=r,r.child=e}function Fp(e,r,a,l,f){if(e!==null){var y=e.memoizedProps;if(wa(y,l)&&e.ref===r.ref)if(kt=!1,r.pendingProps=l=y,ih(e,f))(e.flags&131072)!==0&&(kt=!0);else return r.lanes=e.lanes,Er(e,r,f)}return Wf(e,r,a,l,f)}function Gp(e,r,a,l){var f=l.children,y=e!==null?e.memoizedState:null;if(e===null&&r.stateNode===null&&(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((r.flags&128)!==0){if(y=y!==null?y.baseLanes|a:a,e!==null){for(l=r.child=e.child,f=0;l!==null;)f=f|l.lanes|l.childLanes,l=l.sibling;l=f&~y}else l=0,r.child=null;return Vp(e,r,y,a,l)}if((a&536870912)!==0)r.memoizedState={baseLanes:0,cachePool:null},e!==null&&ul(r,y!==null?y.cachePool:null),y!==null?K0(r,y):kf(),J0(r);else return l=r.lanes=536870912,Vp(e,r,y!==null?y.baseLanes|a:a,a,l)}else y!==null?(ul(r,y.cachePool),K0(r,y),ts(),r.memoizedState=null):(e!==null&&ul(r,null),kf(),ts());return $t(e,r,f,a),r.child}function Pa(e,r){return e!==null&&e.tag===22||r.stateNode!==null||(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.sibling}function Vp(e,r,a,l,f){var y=wf();return y=y===null?null:{parent:At._currentValue,pool:y},r.memoizedState={baseLanes:a,cachePool:y},e!==null&&ul(r,null),kf(),J0(r),e!==null&&_i(e,r,l,!0),r.childLanes=f,null}function Al(e,r){return r=kl({mode:r.mode,children:r.children},e.mode),r.ref=e.ref,e.child=r,r.return=e,r}function Yp(e,r,a){return Gs(r,e.child,null,a),e=Al(r,r.pendingProps),e.flags|=2,pn(r),r.memoizedState=null,e}function rw(e,r,a){var l=r.pendingProps,f=(r.flags&128)!==0;if(r.flags&=-129,e===null){if(Ge){if(l.mode==="hidden")return e=Al(r,l),r.lanes=536870912,Pa(null,e);if(Tf(r),(e=ct)?(e=ig(e,qn),e=e!==null&&e.data==="&"?e:null,e!==null&&(r.memoizedState={dehydrated:e,treeContext:Yr!==null?{id:nr,overflow:rr}:null,retryLane:536870912,hydrationErrors:null},a=T0(e),a.return=r,r.child=a,zt=r,ct=null)):e=null,e===null)throw Jr(r);return r.lanes=536870912,null}return Al(r,l)}var y=e.memoizedState;if(y!==null){var _=y.dehydrated;if(Tf(r),f)if(r.flags&256)r.flags&=-257,r=Yp(e,r,a);else if(r.memoizedState!==null)r.child=e.child,r.flags|=128,r=null;else throw Error(i(558));else if(kt||_i(e,r,a,!1),f=(a&e.childLanes)!==0,kt||f){if(l=ot,l!==null&&(_=Gr(l,a),_!==0&&_!==y.retryLane))throw y.retryLane=_,Ps(e,_),ln(l,e,_),Xf;Pl(),r=Yp(e,r,a)}else e=y.treeContext,ct=Bn(_.nextSibling),zt=r,Ge=!0,Kr=null,qn=!1,e!==null&&R0(r,e),r=Al(r,l),r.flags|=4096;return r}return e=br(e.child,{mode:l.mode,children:l.children}),e.ref=r.ref,r.child=e,e.return=r,e}function jl(e,r){var a=r.ref;if(a===null)e!==null&&e.ref!==null&&(r.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(i(284));(e===null||e.ref!==a)&&(r.flags|=4194816)}}function Wf(e,r,a,l,f){return Is(r),a=Mf(e,r,a,l,void 0,f),l=Rf(),e!==null&&!kt?(Df(e,r,f),Er(e,r,f)):(Ge&&l&&df(r),r.flags|=1,$t(e,r,a,f),r.child)}function Kp(e,r,a,l,f,y){return Is(r),r.updateQueue=null,a=X0(r,l,a,f),Q0(e),l=Rf(),e!==null&&!kt?(Df(e,r,y),Er(e,r,y)):(Ge&&l&&df(r),r.flags|=1,$t(e,r,a,y),r.child)}function Jp(e,r,a,l,f){if(Is(r),r.stateNode===null){var y=gi,_=a.contextType;typeof _=="object"&&_!==null&&(y=It(_)),y=new a(l,y),r.memoizedState=y.state!==null&&y.state!==void 0?y.state:null,y.updater=Jf,r.stateNode=y,y._reactInternals=r,y=r.stateNode,y.props=l,y.state=r.memoizedState,y.refs={},Ef(r),_=a.contextType,y.context=typeof _=="object"&&_!==null?It(_):gi,y.state=r.memoizedState,_=a.getDerivedStateFromProps,typeof _=="function"&&(Kf(r,a,_,l),y.state=r.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof y.getSnapshotBeforeUpdate=="function"||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(_=y.state,typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount(),_!==y.state&&Jf.enqueueReplaceState(y,y.state,null),Ma(r,l,y,f),Ca(),y.state=r.memoizedState),typeof y.componentDidMount=="function"&&(r.flags|=4194308),l=!0}else if(e===null){y=r.stateNode;var O=r.memoizedProps,R=Ys(a,O);y.props=R;var V=y.context,Z=a.contextType;_=gi,typeof Z=="object"&&Z!==null&&(_=It(Z));var ie=a.getDerivedStateFromProps;Z=typeof ie=="function"||typeof y.getSnapshotBeforeUpdate=="function",O=r.pendingProps!==O,Z||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(O||V!==_)&&Lp(r,y,l,_),Xr=!1;var Y=r.memoizedState;y.state=Y,Ma(r,l,y,f),Ca(),V=r.memoizedState,O||Y!==V||Xr?(typeof ie=="function"&&(Kf(r,a,ie,l),V=r.memoizedState),(R=Xr||Dp(r,a,R,l,Y,V,_))?(Z||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount()),typeof y.componentDidMount=="function"&&(r.flags|=4194308)):(typeof y.componentDidMount=="function"&&(r.flags|=4194308),r.memoizedProps=l,r.memoizedState=V),y.props=l,y.state=V,y.context=_,l=R):(typeof y.componentDidMount=="function"&&(r.flags|=4194308),l=!1)}else{y=r.stateNode,Of(e,r),_=r.memoizedProps,Z=Ys(a,_),y.props=Z,ie=r.pendingProps,Y=y.context,V=a.contextType,R=gi,typeof V=="object"&&V!==null&&(R=It(V)),O=a.getDerivedStateFromProps,(V=typeof O=="function"||typeof y.getSnapshotBeforeUpdate=="function")||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(_!==ie||Y!==R)&&Lp(r,y,l,R),Xr=!1,Y=r.memoizedState,y.state=Y,Ma(r,l,y,f),Ca();var Q=r.memoizedState;_!==ie||Y!==Q||Xr||e!==null&&e.dependencies!==null&&ll(e.dependencies)?(typeof O=="function"&&(Kf(r,a,O,l),Q=r.memoizedState),(Z=Xr||Dp(r,a,Z,l,Y,Q,R)||e!==null&&e.dependencies!==null&&ll(e.dependencies))?(V||typeof y.UNSAFE_componentWillUpdate!="function"&&typeof y.componentWillUpdate!="function"||(typeof y.componentWillUpdate=="function"&&y.componentWillUpdate(l,Q,R),typeof y.UNSAFE_componentWillUpdate=="function"&&y.UNSAFE_componentWillUpdate(l,Q,R)),typeof y.componentDidUpdate=="function"&&(r.flags|=4),typeof y.getSnapshotBeforeUpdate=="function"&&(r.flags|=1024)):(typeof y.componentDidUpdate!="function"||_===e.memoizedProps&&Y===e.memoizedState||(r.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||_===e.memoizedProps&&Y===e.memoizedState||(r.flags|=1024),r.memoizedProps=l,r.memoizedState=Q),y.props=l,y.state=Q,y.context=R,l=Z):(typeof y.componentDidUpdate!="function"||_===e.memoizedProps&&Y===e.memoizedState||(r.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||_===e.memoizedProps&&Y===e.memoizedState||(r.flags|=1024),l=!1)}return y=l,jl(e,r),l=(r.flags&128)!==0,y||l?(y=r.stateNode,a=l&&typeof a.getDerivedStateFromError!="function"?null:y.render(),r.flags|=1,e!==null&&l?(r.child=Gs(r,e.child,null,f),r.child=Gs(r,null,a,f)):$t(e,r,a,f),r.memoizedState=y.state,e=r.child):e=Er(e,r,f),e}function Qp(e,r,a,l){return Us(),r.flags|=256,$t(e,r,a,l),r.child}var Zf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function eh(e){return{baseLanes:e,cachePool:U0()}}function th(e,r,a){return e=e!==null?e.childLanes&~a:0,r&&(e|=gn),e}function Xp(e,r,a){var l=r.pendingProps,f=!1,y=(r.flags&128)!==0,_;if((_=y)||(_=e!==null&&e.memoizedState===null?!1:(wt.current&2)!==0),_&&(f=!0,r.flags&=-129),_=(r.flags&32)!==0,r.flags&=-33,e===null){if(Ge){if(f?es(r):ts(),(e=ct)?(e=ig(e,qn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(r.memoizedState={dehydrated:e,treeContext:Yr!==null?{id:nr,overflow:rr}:null,retryLane:536870912,hydrationErrors:null},a=T0(e),a.return=r,r.child=a,zt=r,ct=null)):e=null,e===null)throw Jr(r);return Ph(e)?r.lanes=32:r.lanes=536870912,null}var O=l.children;return l=l.fallback,f?(ts(),f=r.mode,O=kl({mode:"hidden",children:O},f),l=Bs(l,f,a,null),O.return=r,l.return=r,O.sibling=l,r.child=O,l=r.child,l.memoizedState=eh(a),l.childLanes=th(e,_,a),r.memoizedState=Zf,Pa(null,l)):(es(r),nh(r,O))}var R=e.memoizedState;if(R!==null&&(O=R.dehydrated,O!==null)){if(y)r.flags&256?(es(r),r.flags&=-257,r=rh(e,r,a)):r.memoizedState!==null?(ts(),r.child=e.child,r.flags|=128,r=null):(ts(),O=l.fallback,f=r.mode,l=kl({mode:"visible",children:l.children},f),O=Bs(O,f,a,null),O.flags|=2,l.return=r,O.return=r,l.sibling=O,r.child=l,Gs(r,e.child,null,a),l=r.child,l.memoizedState=eh(a),l.childLanes=th(e,_,a),r.memoizedState=Zf,r=Pa(null,l));else if(es(r),Ph(O)){if(_=O.nextSibling&&O.nextSibling.dataset,_)var V=_.dgst;_=V,l=Error(i(419)),l.stack="",l.digest=_,Oa({value:l,source:null,stack:null}),r=rh(e,r,a)}else if(kt||_i(e,r,a,!1),_=(a&e.childLanes)!==0,kt||_){if(_=ot,_!==null&&(l=Gr(_,a),l!==0&&l!==R.retryLane))throw R.retryLane=l,Ps(e,l),ln(_,e,l),Xf;qh(O)||Pl(),r=rh(e,r,a)}else qh(O)?(r.flags|=192,r.child=e.child,r=null):(e=R.treeContext,ct=Bn(O.nextSibling),zt=r,Ge=!0,Kr=null,qn=!1,e!==null&&R0(r,e),r=nh(r,l.children),r.flags|=4096);return r}return f?(ts(),O=l.fallback,f=r.mode,R=e.child,V=R.sibling,l=br(R,{mode:"hidden",children:l.children}),l.subtreeFlags=R.subtreeFlags&65011712,V!==null?O=br(V,O):(O=Bs(O,f,a,null),O.flags|=2),O.return=r,l.return=r,l.sibling=O,r.child=l,Pa(null,l),l=r.child,O=e.child.memoizedState,O===null?O=eh(a):(f=O.cachePool,f!==null?(R=At._currentValue,f=f.parent!==R?{parent:R,pool:R}:f):f=U0(),O={baseLanes:O.baseLanes|a,cachePool:f}),l.memoizedState=O,l.childLanes=th(e,_,a),r.memoizedState=Zf,Pa(e.child,l)):(es(r),a=e.child,e=a.sibling,a=br(a,{mode:"visible",children:l.children}),a.return=r,a.sibling=null,e!==null&&(_=r.deletions,_===null?(r.deletions=[e],r.flags|=16):_.push(e)),r.child=a,r.memoizedState=null,a)}function nh(e,r){return r=kl({mode:"visible",children:r},e.mode),r.return=e,e.child=r}function kl(e,r){return e=dn(22,e,null,r),e.lanes=0,e}function rh(e,r,a){return Gs(r,e.child,null,a),e=nh(r,r.pendingProps.children),e.flags|=2,r.memoizedState=null,e}function Wp(e,r,a){e.lanes|=r;var l=e.alternate;l!==null&&(l.lanes|=r),bf(e.return,r,a)}function sh(e,r,a,l,f,y){var _=e.memoizedState;_===null?e.memoizedState={isBackwards:r,rendering:null,renderingStartTime:0,last:l,tail:a,tailMode:f,treeForkCount:y}:(_.isBackwards=r,_.rendering=null,_.renderingStartTime=0,_.last=l,_.tail=a,_.tailMode=f,_.treeForkCount=y)}function Zp(e,r,a){var l=r.pendingProps,f=l.revealOrder,y=l.tail;l=l.children;var _=wt.current,O=(_&2)!==0;if(O?(_=_&1|2,r.flags|=128):_&=1,Me(wt,_),$t(e,r,l,a),l=Ge?Ea:0,!O&&e!==null&&(e.flags&128)!==0)e:for(e=r.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Wp(e,a,r);else if(e.tag===19)Wp(e,a,r);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===r)break e;for(;e.sibling===null;){if(e.return===null||e.return===r)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(f){case"forwards":for(a=r.child,f=null;a!==null;)e=a.alternate,e!==null&&yl(e)===null&&(f=a),a=a.sibling;a=f,a===null?(f=r.child,r.child=null):(f=a.sibling,a.sibling=null),sh(r,!1,f,a,y,l);break;case"backwards":case"unstable_legacy-backwards":for(a=null,f=r.child,r.child=null;f!==null;){if(e=f.alternate,e!==null&&yl(e)===null){r.child=f;break}e=f.sibling,f.sibling=a,a=f,f=e}sh(r,!0,a,null,y,l);break;case"together":sh(r,!1,null,null,void 0,l);break;default:r.memoizedState=null}return r.child}function Er(e,r,a){if(e!==null&&(r.dependencies=e.dependencies),ss|=r.lanes,(a&r.childLanes)===0)if(e!==null){if(_i(e,r,a,!1),(a&r.childLanes)===0)return null}else return null;if(e!==null&&r.child!==e.child)throw Error(i(153));if(r.child!==null){for(e=r.child,a=br(e,e.pendingProps),r.child=a,a.return=r;e.sibling!==null;)e=e.sibling,a=a.sibling=br(e,e.pendingProps),a.return=r;a.sibling=null}return r.child}function ih(e,r){return(e.lanes&r)!==0?!0:(e=e.dependencies,!!(e!==null&&ll(e)))}function sw(e,r,a){switch(r.tag){case 3:Re(r,r.stateNode.containerInfo),Qr(r,At,e.memoizedState.cache),Us();break;case 27:case 5:Ue(r);break;case 4:Re(r,r.stateNode.containerInfo);break;case 10:Qr(r,r.type,r.memoizedProps.value);break;case 31:if(r.memoizedState!==null)return r.flags|=128,Tf(r),null;break;case 13:var l=r.memoizedState;if(l!==null)return l.dehydrated!==null?(es(r),r.flags|=128,null):(a&r.child.childLanes)!==0?Xp(e,r,a):(es(r),e=Er(e,r,a),e!==null?e.sibling:null);es(r);break;case 19:var f=(e.flags&128)!==0;if(l=(a&r.childLanes)!==0,l||(_i(e,r,a,!1),l=(a&r.childLanes)!==0),f){if(l)return Zp(e,r,a);r.flags|=128}if(f=r.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),Me(wt,wt.current),l)break;return null;case 22:return r.lanes=0,Gp(e,r,a,r.pendingProps);case 24:Qr(r,At,e.memoizedState.cache)}return Er(e,r,a)}function ey(e,r,a){if(e!==null)if(e.memoizedProps!==r.pendingProps)kt=!0;else{if(!ih(e,a)&&(r.flags&128)===0)return kt=!1,sw(e,r,a);kt=(e.flags&131072)!==0}else kt=!1,Ge&&(r.flags&1048576)!==0&&M0(r,Ea,r.index);switch(r.lanes=0,r.tag){case 16:e:{var l=r.pendingProps;if(e=Hs(r.elementType),r.type=e,typeof e=="function")uf(e)?(l=Ys(e,l),r.tag=1,r=Jp(null,r,e,l,a)):(r.tag=0,r=Wf(null,r,e,l,a));else{if(e!=null){var f=e.$$typeof;if(f===se){r.tag=11,r=$p(null,r,e,l,a);break e}else if(f===ae){r.tag=14,r=Hp(null,r,e,l,a);break e}}throw r=we(e)||e,Error(i(306,r,""))}}return r;case 0:return Wf(e,r,r.type,r.pendingProps,a);case 1:return l=r.type,f=Ys(l,r.pendingProps),Jp(e,r,l,f,a);case 3:e:{if(Re(r,r.stateNode.containerInfo),e===null)throw Error(i(387));l=r.pendingProps;var y=r.memoizedState;f=y.element,Of(e,r),Ma(r,l,null,a);var _=r.memoizedState;if(l=_.cache,Qr(r,At,l),l!==y.cache&&xf(r,[At],a,!0),Ca(),l=_.element,y.isDehydrated)if(y={element:l,isDehydrated:!1,cache:_.cache},r.updateQueue.baseState=y,r.memoizedState=y,r.flags&256){r=Qp(e,r,l,a);break e}else if(l!==f){f=Rn(Error(i(424)),r),Oa(f),r=Qp(e,r,l,a);break e}else{switch(e=r.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(ct=Bn(e.firstChild),zt=r,Ge=!0,Kr=null,qn=!0,a=G0(r,null,l,a),r.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(Us(),l===f){r=Er(e,r,a);break e}$t(e,r,l,a)}r=r.child}return r;case 26:return jl(e,r),e===null?(a=fg(r.type,null,r.pendingProps,null))?r.memoizedState=a:Ge||(a=r.type,e=r.pendingProps,l=Fl(Ct.current).createElement(a),l[at]=r,l[gt]=e,Ht(l,a,e),L(l),r.stateNode=l):r.memoizedState=fg(r.type,e.memoizedProps,r.pendingProps,e.memoizedState),null;case 27:return Ue(r),e===null&&Ge&&(l=r.stateNode=lg(r.type,r.pendingProps,Ct.current),zt=r,qn=!0,f=ct,cs(r.type)?(Bh=f,ct=Bn(l.firstChild)):ct=f),$t(e,r,r.pendingProps.children,a),jl(e,r),e===null&&(r.flags|=4194304),r.child;case 5:return e===null&&Ge&&((f=l=ct)&&(l=Dw(l,r.type,r.pendingProps,qn),l!==null?(r.stateNode=l,zt=r,ct=Bn(l.firstChild),qn=!1,f=!0):f=!1),f||Jr(r)),Ue(r),f=r.type,y=r.pendingProps,_=e!==null?e.memoizedProps:null,l=y.children,Rh(f,y)?l=null:_!==null&&Rh(f,_)&&(r.flags|=32),r.memoizedState!==null&&(f=Mf(e,r,J_,null,null,a),Wa._currentValue=f),jl(e,r),$t(e,r,l,a),r.child;case 6:return e===null&&Ge&&((e=a=ct)&&(a=Lw(a,r.pendingProps,qn),a!==null?(r.stateNode=a,zt=r,ct=null,e=!0):e=!1),e||Jr(r)),null;case 13:return Xp(e,r,a);case 4:return Re(r,r.stateNode.containerInfo),l=r.pendingProps,e===null?r.child=Gs(r,null,l,a):$t(e,r,l,a),r.child;case 11:return $p(e,r,r.type,r.pendingProps,a);case 7:return $t(e,r,r.pendingProps,a),r.child;case 8:return $t(e,r,r.pendingProps.children,a),r.child;case 12:return $t(e,r,r.pendingProps.children,a),r.child;case 10:return l=r.pendingProps,Qr(r,r.type,l.value),$t(e,r,l.children,a),r.child;case 9:return f=r.type._context,l=r.pendingProps.children,Is(r),f=It(f),l=l(f),r.flags|=1,$t(e,r,l,a),r.child;case 14:return Hp(e,r,r.type,r.pendingProps,a);case 15:return Fp(e,r,r.type,r.pendingProps,a);case 19:return Zp(e,r,a);case 31:return rw(e,r,a);case 22:return Gp(e,r,a,r.pendingProps);case 24:return Is(r),l=It(At),e===null?(f=wf(),f===null&&(f=ot,y=vf(),f.pooledCache=y,y.refCount++,y!==null&&(f.pooledCacheLanes|=a),f=y),r.memoizedState={parent:l,cache:f},Ef(r),Qr(r,At,f)):((e.lanes&a)!==0&&(Of(e,r),Ma(r,null,null,a),Ca()),f=e.memoizedState,y=r.memoizedState,f.parent!==l?(f={parent:l,cache:l},r.memoizedState=f,r.lanes===0&&(r.memoizedState=r.updateQueue.baseState=f),Qr(r,At,l)):(l=y.cache,Qr(r,At,l),l!==f.cache&&xf(r,[At],a,!0))),$t(e,r,r.pendingProps.children,a),r.child;case 29:throw r.pendingProps}throw Error(i(156,r.tag))}function Or(e){e.flags|=4}function ah(e,r,a,l,f){if((r=(e.mode&32)!==0)&&(r=!1),r){if(e.flags|=16777216,(f&335544128)===f)if(e.stateNode.complete)e.flags|=8192;else if(jy())e.flags|=8192;else throw Fs=hl,Sf}else e.flags&=-16777217}function ty(e,r){if(r.type!=="stylesheet"||(r.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!yg(r))if(jy())e.flags|=8192;else throw Fs=hl,Sf}function Nl(e,r){r!==null&&(e.flags|=4),e.flags&16384&&(r=e.tag!==22?oi():536870912,e.lanes|=r,Ri|=r)}function Ba(e,r){if(!Ge)switch(e.tailMode){case"hidden":r=e.tail;for(var a=null;r!==null;)r.alternate!==null&&(a=r),r=r.sibling;a===null?e.tail=null:a.sibling=null;break;case"collapsed":a=e.tail;for(var l=null;a!==null;)a.alternate!==null&&(l=a),a=a.sibling;l===null?r||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null}}function ut(e){var r=e.alternate!==null&&e.alternate.child===e.child,a=0,l=0;if(r)for(var f=e.child;f!==null;)a|=f.lanes|f.childLanes,l|=f.subtreeFlags&65011712,l|=f.flags&65011712,f.return=e,f=f.sibling;else for(f=e.child;f!==null;)a|=f.lanes|f.childLanes,l|=f.subtreeFlags,l|=f.flags,f.return=e,f=f.sibling;return e.subtreeFlags|=l,e.childLanes=a,r}function iw(e,r,a){var l=r.pendingProps;switch(mf(r),r.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ut(r),null;case 1:return ut(r),null;case 3:return a=r.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),r.memoizedState.cache!==l&&(r.flags|=2048),_r(At),ce(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(vi(r)?Or(r):e===null||e.memoizedState.isDehydrated&&(r.flags&256)===0||(r.flags|=1024,yf())),ut(r),null;case 26:var f=r.type,y=r.memoizedState;return e===null?(Or(r),y!==null?(ut(r),ty(r,y)):(ut(r),ah(r,f,null,l,a))):y?y!==e.memoizedState?(Or(r),ut(r),ty(r,y)):(ut(r),r.flags&=-16777217):(e=e.memoizedProps,e!==l&&Or(r),ut(r),ah(r,f,e,l,a)),null;case 27:if(Xe(r),a=Ct.current,f=r.type,e!==null&&r.stateNode!=null)e.memoizedProps!==l&&Or(r);else{if(!l){if(r.stateNode===null)throw Error(i(166));return ut(r),null}e=We.current,vi(r)?D0(r):(e=lg(f,l,a),r.stateNode=e,Or(r))}return ut(r),null;case 5:if(Xe(r),f=r.type,e!==null&&r.stateNode!=null)e.memoizedProps!==l&&Or(r);else{if(!l){if(r.stateNode===null)throw Error(i(166));return ut(r),null}if(y=We.current,vi(r))D0(r);else{var _=Fl(Ct.current);switch(y){case 1:y=_.createElementNS("http://www.w3.org/2000/svg",f);break;case 2:y=_.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;default:switch(f){case"svg":y=_.createElementNS("http://www.w3.org/2000/svg",f);break;case"math":y=_.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;case"script":y=_.createElement("div"),y.innerHTML="<script><\/script>",y=y.removeChild(y.firstChild);break;case"select":y=typeof l.is=="string"?_.createElement("select",{is:l.is}):_.createElement("select"),l.multiple?y.multiple=!0:l.size&&(y.size=l.size);break;default:y=typeof l.is=="string"?_.createElement(f,{is:l.is}):_.createElement(f)}}y[at]=r,y[gt]=l;e:for(_=r.child;_!==null;){if(_.tag===5||_.tag===6)y.appendChild(_.stateNode);else if(_.tag!==4&&_.tag!==27&&_.child!==null){_.child.return=_,_=_.child;continue}if(_===r)break e;for(;_.sibling===null;){if(_.return===null||_.return===r)break e;_=_.return}_.sibling.return=_.return,_=_.sibling}r.stateNode=y;e:switch(Ht(y,f,l),f){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&Or(r)}}return ut(r),ah(r,r.type,e===null?null:e.memoizedProps,r.pendingProps,a),null;case 6:if(e&&r.stateNode!=null)e.memoizedProps!==l&&Or(r);else{if(typeof l!="string"&&r.stateNode===null)throw Error(i(166));if(e=Ct.current,vi(r)){if(e=r.stateNode,a=r.memoizedProps,l=null,f=zt,f!==null)switch(f.tag){case 27:case 5:l=f.memoizedProps}e[at]=r,e=!!(e.nodeValue===a||l!==null&&l.suppressHydrationWarning===!0||Xy(e.nodeValue,a)),e||Jr(r,!0)}else e=Fl(e).createTextNode(l),e[at]=r,r.stateNode=e}return ut(r),null;case 31:if(a=r.memoizedState,e===null||e.memoizedState!==null){if(l=vi(r),a!==null){if(e===null){if(!l)throw Error(i(318));if(e=r.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(557));e[at]=r}else Us(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;ut(r),e=!1}else a=yf(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return r.flags&256?(pn(r),r):(pn(r),null);if((r.flags&128)!==0)throw Error(i(558))}return ut(r),null;case 13:if(l=r.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(f=vi(r),l!==null&&l.dehydrated!==null){if(e===null){if(!f)throw Error(i(318));if(f=r.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(i(317));f[at]=r}else Us(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;ut(r),f=!1}else f=yf(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=f),f=!0;if(!f)return r.flags&256?(pn(r),r):(pn(r),null)}return pn(r),(r.flags&128)!==0?(r.lanes=a,r):(a=l!==null,e=e!==null&&e.memoizedState!==null,a&&(l=r.child,f=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(f=l.alternate.memoizedState.cachePool.pool),y=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(y=l.memoizedState.cachePool.pool),y!==f&&(l.flags|=2048)),a!==e&&a&&(r.child.flags|=8192),Nl(r,r.updateQueue),ut(r),null);case 4:return ce(),e===null&&kh(r.stateNode.containerInfo),ut(r),null;case 10:return _r(r.type),ut(r),null;case 19:if(Ne(wt),l=r.memoizedState,l===null)return ut(r),null;if(f=(r.flags&128)!==0,y=l.rendering,y===null)if(f)Ba(l,!1);else{if(xt!==0||e!==null&&(e.flags&128)!==0)for(e=r.child;e!==null;){if(y=yl(e),y!==null){for(r.flags|=128,Ba(l,!1),e=y.updateQueue,r.updateQueue=e,Nl(r,e),r.subtreeFlags=0,e=a,a=r.child;a!==null;)N0(a,e),a=a.sibling;return Me(wt,wt.current&1|2),Ge&&xr(r,l.treeForkCount),r.child}e=e.sibling}l.tail!==null&&ft()>Dl&&(r.flags|=128,f=!0,Ba(l,!1),r.lanes=4194304)}else{if(!f)if(e=yl(y),e!==null){if(r.flags|=128,f=!0,e=e.updateQueue,r.updateQueue=e,Nl(r,e),Ba(l,!0),l.tail===null&&l.tailMode==="hidden"&&!y.alternate&&!Ge)return ut(r),null}else 2*ft()-l.renderingStartTime>Dl&&a!==536870912&&(r.flags|=128,f=!0,Ba(l,!1),r.lanes=4194304);l.isBackwards?(y.sibling=r.child,r.child=y):(e=l.last,e!==null?e.sibling=y:r.child=y,l.last=y)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=ft(),e.sibling=null,a=wt.current,Me(wt,f?a&1|2:a&1),Ge&&xr(r,l.treeForkCount),e):(ut(r),null);case 22:case 23:return pn(r),Nf(),l=r.memoizedState!==null,e!==null?e.memoizedState!==null!==l&&(r.flags|=8192):l&&(r.flags|=8192),l?(a&536870912)!==0&&(r.flags&128)===0&&(ut(r),r.subtreeFlags&6&&(r.flags|=8192)):ut(r),a=r.updateQueue,a!==null&&Nl(r,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),l=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(l=r.memoizedState.cachePool.pool),l!==a&&(r.flags|=2048),e!==null&&Ne($s),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),r.memoizedState.cache!==a&&(r.flags|=2048),_r(At),ut(r),null;case 25:return null;case 30:return null}throw Error(i(156,r.tag))}function aw(e,r){switch(mf(r),r.tag){case 1:return e=r.flags,e&65536?(r.flags=e&-65537|128,r):null;case 3:return _r(At),ce(),e=r.flags,(e&65536)!==0&&(e&128)===0?(r.flags=e&-65537|128,r):null;case 26:case 27:case 5:return Xe(r),null;case 31:if(r.memoizedState!==null){if(pn(r),r.alternate===null)throw Error(i(340));Us()}return e=r.flags,e&65536?(r.flags=e&-65537|128,r):null;case 13:if(pn(r),e=r.memoizedState,e!==null&&e.dehydrated!==null){if(r.alternate===null)throw Error(i(340));Us()}return e=r.flags,e&65536?(r.flags=e&-65537|128,r):null;case 19:return Ne(wt),null;case 4:return ce(),null;case 10:return _r(r.type),null;case 22:case 23:return pn(r),Nf(),e!==null&&Ne($s),e=r.flags,e&65536?(r.flags=e&-65537|128,r):null;case 24:return _r(At),null;case 25:return null;default:return null}}function ny(e,r){switch(mf(r),r.tag){case 3:_r(At),ce();break;case 26:case 27:case 5:Xe(r);break;case 4:ce();break;case 31:r.memoizedState!==null&&pn(r);break;case 13:pn(r);break;case 19:Ne(wt);break;case 10:_r(r.type);break;case 22:case 23:pn(r),Nf(),e!==null&&Ne($s);break;case 24:_r(At)}}function Ua(e,r){try{var a=r.updateQueue,l=a!==null?a.lastEffect:null;if(l!==null){var f=l.next;a=f;do{if((a.tag&e)===e){l=void 0;var y=a.create,_=a.inst;l=y(),_.destroy=l}a=a.next}while(a!==f)}}catch(O){et(r,r.return,O)}}function ns(e,r,a){try{var l=r.updateQueue,f=l!==null?l.lastEffect:null;if(f!==null){var y=f.next;l=y;do{if((l.tag&e)===e){var _=l.inst,O=_.destroy;if(O!==void 0){_.destroy=void 0,f=r;var R=a,V=O;try{V()}catch(Z){et(f,R,Z)}}}l=l.next}while(l!==y)}}catch(Z){et(r,r.return,Z)}}function ry(e){var r=e.updateQueue;if(r!==null){var a=e.stateNode;try{Y0(r,a)}catch(l){et(e,e.return,l)}}}function sy(e,r,a){a.props=Ys(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(l){et(e,r,l)}}function za(e,r){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var l=e.stateNode;break;case 30:l=e.stateNode;break;default:l=e.stateNode}typeof a=="function"?e.refCleanup=a(l):a.current=l}}catch(f){et(e,r,f)}}function sr(e,r){var a=e.ref,l=e.refCleanup;if(a!==null)if(typeof l=="function")try{l()}catch(f){et(e,r,f)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(f){et(e,r,f)}else a.current=null}function iy(e){var r=e.type,a=e.memoizedProps,l=e.stateNode;try{e:switch(r){case"button":case"input":case"select":case"textarea":a.autoFocus&&l.focus();break e;case"img":a.src?l.src=a.src:a.srcSet&&(l.srcset=a.srcSet)}}catch(f){et(e,e.return,f)}}function oh(e,r,a){try{var l=e.stateNode;kw(l,e.type,a,r),l[gt]=r}catch(f){et(e,e.return,f)}}function ay(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&cs(e.type)||e.tag===4}function lh(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||ay(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&&cs(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 ch(e,r,a){var l=e.tag;if(l===5||l===6)e=e.stateNode,r?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,r):(r=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,r.appendChild(e),a=a._reactRootContainer,a!=null||r.onclick!==null||(r.onclick=yr));else if(l!==4&&(l===27&&cs(e.type)&&(a=e.stateNode,r=null),e=e.child,e!==null))for(ch(e,r,a),e=e.sibling;e!==null;)ch(e,r,a),e=e.sibling}function Tl(e,r,a){var l=e.tag;if(l===5||l===6)e=e.stateNode,r?a.insertBefore(e,r):a.appendChild(e);else if(l!==4&&(l===27&&cs(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(Tl(e,r,a),e=e.sibling;e!==null;)Tl(e,r,a),e=e.sibling}function oy(e){var r=e.stateNode,a=e.memoizedProps;try{for(var l=e.type,f=r.attributes;f.length;)r.removeAttributeNode(f[0]);Ht(r,l,a),r[at]=e,r[gt]=a}catch(y){et(e,e.return,y)}}var Ar=!1,Nt=!1,uh=!1,ly=typeof WeakSet=="function"?WeakSet:Set,Pt=null;function ow(e,r){if(e=e.containerInfo,Ch=Xl,e=v0(e),nf(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var l=a.getSelection&&a.getSelection();if(l&&l.rangeCount!==0){a=l.anchorNode;var f=l.anchorOffset,y=l.focusNode;l=l.focusOffset;try{a.nodeType,y.nodeType}catch{a=null;break e}var _=0,O=-1,R=-1,V=0,Z=0,ie=e,Y=null;t:for(;;){for(var Q;ie!==a||f!==0&&ie.nodeType!==3||(O=_+f),ie!==y||l!==0&&ie.nodeType!==3||(R=_+l),ie.nodeType===3&&(_+=ie.nodeValue.length),(Q=ie.firstChild)!==null;)Y=ie,ie=Q;for(;;){if(ie===e)break t;if(Y===a&&++V===f&&(O=_),Y===y&&++Z===l&&(R=_),(Q=ie.nextSibling)!==null)break;ie=Y,Y=ie.parentNode}ie=Q}a=O===-1||R===-1?null:{start:O,end:R}}else a=null}a=a||{start:0,end:0}}else a=null;for(Mh={focusedElem:e,selectionRange:a},Xl=!1,Pt=r;Pt!==null;)if(r=Pt,e=r.child,(r.subtreeFlags&1028)!==0&&e!==null)e.return=r,Pt=e;else for(;Pt!==null;){switch(r=Pt,y=r.alternate,e=r.flags,r.tag){case 0:if((e&4)!==0&&(e=r.updateQueue,e=e!==null?e.events:null,e!==null))for(a=0;a<e.length;a++)f=e[a],f.ref.impl=f.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&y!==null){e=void 0,a=r,f=y.memoizedProps,y=y.memoizedState,l=a.stateNode;try{var ve=Ys(a.type,f);e=l.getSnapshotBeforeUpdate(ve,y),l.__reactInternalSnapshotBeforeUpdate=e}catch(Te){et(a,a.return,Te)}}break;case 3:if((e&1024)!==0){if(e=r.stateNode.containerInfo,a=e.nodeType,a===9)Lh(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Lh(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(i(163))}if(e=r.sibling,e!==null){e.return=r.return,Pt=e;break}Pt=r.return}}function cy(e,r,a){var l=a.flags;switch(a.tag){case 0:case 11:case 15:kr(e,a),l&4&&Ua(5,a);break;case 1:if(kr(e,a),l&4)if(e=a.stateNode,r===null)try{e.componentDidMount()}catch(_){et(a,a.return,_)}else{var f=Ys(a.type,r.memoizedProps);r=r.memoizedState;try{e.componentDidUpdate(f,r,e.__reactInternalSnapshotBeforeUpdate)}catch(_){et(a,a.return,_)}}l&64&&ry(a),l&512&&za(a,a.return);break;case 3:if(kr(e,a),l&64&&(e=a.updateQueue,e!==null)){if(r=null,a.child!==null)switch(a.child.tag){case 27:case 5:r=a.child.stateNode;break;case 1:r=a.child.stateNode}try{Y0(e,r)}catch(_){et(a,a.return,_)}}break;case 27:r===null&&l&4&&oy(a);case 26:case 5:kr(e,a),r===null&&l&4&&iy(a),l&512&&za(a,a.return);break;case 12:kr(e,a);break;case 31:kr(e,a),l&4&&hy(e,a);break;case 13:kr(e,a),l&4&&dy(e,a),l&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=yw.bind(null,a),qw(e,a))));break;case 22:if(l=a.memoizedState!==null||Ar,!l){r=r!==null&&r.memoizedState!==null||Nt,f=Ar;var y=Nt;Ar=l,(Nt=r)&&!y?Nr(e,a,(a.subtreeFlags&8772)!==0):kr(e,a),Ar=f,Nt=y}break;case 30:break;default:kr(e,a)}}function uy(e){var r=e.alternate;r!==null&&(e.alternate=null,uy(r)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(r=e.stateNode,r!==null&&li(r)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var ht=null,rn=!1;function jr(e,r,a){for(a=a.child;a!==null;)fy(e,r,a),a=a.sibling}function fy(e,r,a){if(_t&&typeof _t.onCommitFiberUnmount=="function")try{_t.onCommitFiberUnmount(ks,a)}catch{}switch(a.tag){case 26:Nt||sr(a,r),jr(e,r,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:Nt||sr(a,r);var l=ht,f=rn;cs(a.type)&&(ht=a.stateNode,rn=!1),jr(e,r,a),Ja(a.stateNode),ht=l,rn=f;break;case 5:Nt||sr(a,r);case 6:if(l=ht,f=rn,ht=null,jr(e,r,a),ht=l,rn=f,ht!==null)if(rn)try{(ht.nodeType===9?ht.body:ht.nodeName==="HTML"?ht.ownerDocument.body:ht).removeChild(a.stateNode)}catch(y){et(a,r,y)}else try{ht.removeChild(a.stateNode)}catch(y){et(a,r,y)}break;case 18:ht!==null&&(rn?(e=ht,rg(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),Ii(e)):rg(ht,a.stateNode));break;case 4:l=ht,f=rn,ht=a.stateNode.containerInfo,rn=!0,jr(e,r,a),ht=l,rn=f;break;case 0:case 11:case 14:case 15:ns(2,a,r),Nt||ns(4,a,r),jr(e,r,a);break;case 1:Nt||(sr(a,r),l=a.stateNode,typeof l.componentWillUnmount=="function"&&sy(a,r,l)),jr(e,r,a);break;case 21:jr(e,r,a);break;case 22:Nt=(l=Nt)||a.memoizedState!==null,jr(e,r,a),Nt=l;break;default:jr(e,r,a)}}function hy(e,r){if(r.memoizedState===null&&(e=r.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Ii(e)}catch(a){et(r,r.return,a)}}}function dy(e,r){if(r.memoizedState===null&&(e=r.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Ii(e)}catch(a){et(r,r.return,a)}}function lw(e){switch(e.tag){case 31:case 13:case 19:var r=e.stateNode;return r===null&&(r=e.stateNode=new ly),r;case 22:return e=e.stateNode,r=e._retryCache,r===null&&(r=e._retryCache=new ly),r;default:throw Error(i(435,e.tag))}}function Cl(e,r){var a=lw(e);r.forEach(function(l){if(!a.has(l)){a.add(l);var f=gw.bind(null,e,l);l.then(f,f)}})}function sn(e,r){var a=r.deletions;if(a!==null)for(var l=0;l<a.length;l++){var f=a[l],y=e,_=r,O=_;e:for(;O!==null;){switch(O.tag){case 27:if(cs(O.type)){ht=O.stateNode,rn=!1;break e}break;case 5:ht=O.stateNode,rn=!1;break e;case 3:case 4:ht=O.stateNode.containerInfo,rn=!0;break e}O=O.return}if(ht===null)throw Error(i(160));fy(y,_,f),ht=null,rn=!1,y=f.alternate,y!==null&&(y.return=null),f.return=null}if(r.subtreeFlags&13886)for(r=r.child;r!==null;)my(r,e),r=r.sibling}var Yn=null;function my(e,r){var a=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:sn(r,e),an(e),l&4&&(ns(3,e,e.return),Ua(3,e),ns(5,e,e.return));break;case 1:sn(r,e),an(e),l&512&&(Nt||a===null||sr(a,a.return)),l&64&&Ar&&(e=e.updateQueue,e!==null&&(l=e.callbacks,l!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?l:a.concat(l))));break;case 26:var f=Yn;if(sn(r,e),an(e),l&512&&(Nt||a===null||sr(a,a.return)),l&4){var y=a!==null?a.memoizedState:null;if(l=e.memoizedState,a===null)if(l===null)if(e.stateNode===null){e:{l=e.type,a=e.memoizedProps,f=f.ownerDocument||f;t:switch(l){case"title":y=f.getElementsByTagName("title")[0],(!y||y[Rt]||y[at]||y.namespaceURI==="http://www.w3.org/2000/svg"||y.hasAttribute("itemprop"))&&(y=f.createElement(l),f.head.insertBefore(y,f.querySelector("head > title"))),Ht(y,l,a),y[at]=e,L(y),l=y;break e;case"link":var _=mg("link","href",f).get(l+(a.href||""));if(_){for(var O=0;O<_.length;O++)if(y=_[O],y.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&y.getAttribute("rel")===(a.rel==null?null:a.rel)&&y.getAttribute("title")===(a.title==null?null:a.title)&&y.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){_.splice(O,1);break t}}y=f.createElement(l),Ht(y,l,a),f.head.appendChild(y);break;case"meta":if(_=mg("meta","content",f).get(l+(a.content||""))){for(O=0;O<_.length;O++)if(y=_[O],y.getAttribute("content")===(a.content==null?null:""+a.content)&&y.getAttribute("name")===(a.name==null?null:a.name)&&y.getAttribute("property")===(a.property==null?null:a.property)&&y.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&y.getAttribute("charset")===(a.charSet==null?null:a.charSet)){_.splice(O,1);break t}}y=f.createElement(l),Ht(y,l,a),f.head.appendChild(y);break;default:throw Error(i(468,l))}y[at]=e,L(y),l=y}e.stateNode=l}else pg(f,e.type,e.stateNode);else e.stateNode=dg(f,l,e.memoizedProps);else y!==l?(y===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):y.count--,l===null?pg(f,e.type,e.stateNode):dg(f,l,e.memoizedProps)):l===null&&e.stateNode!==null&&oh(e,e.memoizedProps,a.memoizedProps)}break;case 27:sn(r,e),an(e),l&512&&(Nt||a===null||sr(a,a.return)),a!==null&&l&4&&oh(e,e.memoizedProps,a.memoizedProps);break;case 5:if(sn(r,e),an(e),l&512&&(Nt||a===null||sr(a,a.return)),e.flags&32){f=e.stateNode;try{ui(f,"")}catch(ve){et(e,e.return,ve)}}l&4&&e.stateNode!=null&&(f=e.memoizedProps,oh(e,f,a!==null?a.memoizedProps:f)),l&1024&&(uh=!0);break;case 6:if(sn(r,e),an(e),l&4){if(e.stateNode===null)throw Error(i(162));l=e.memoizedProps,a=e.stateNode;try{a.nodeValue=l}catch(ve){et(e,e.return,ve)}}break;case 3:if(Yl=null,f=Yn,Yn=Gl(r.containerInfo),sn(r,e),Yn=f,an(e),l&4&&a!==null&&a.memoizedState.isDehydrated)try{Ii(r.containerInfo)}catch(ve){et(e,e.return,ve)}uh&&(uh=!1,py(e));break;case 4:l=Yn,Yn=Gl(e.stateNode.containerInfo),sn(r,e),an(e),Yn=l;break;case 12:sn(r,e),an(e);break;case 31:sn(r,e),an(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Cl(e,l)));break;case 13:sn(r,e),an(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Rl=ft()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Cl(e,l)));break;case 22:f=e.memoizedState!==null;var R=a!==null&&a.memoizedState!==null,V=Ar,Z=Nt;if(Ar=V||f,Nt=Z||R,sn(r,e),Nt=Z,Ar=V,an(e),l&8192)e:for(r=e.stateNode,r._visibility=f?r._visibility&-2:r._visibility|1,f&&(a===null||R||Ar||Nt||Ks(e)),a=null,r=e;;){if(r.tag===5||r.tag===26){if(a===null){R=a=r;try{if(y=R.stateNode,f)_=y.style,typeof _.setProperty=="function"?_.setProperty("display","none","important"):_.display="none";else{O=R.stateNode;var ie=R.memoizedProps.style,Y=ie!=null&&ie.hasOwnProperty("display")?ie.display:null;O.style.display=Y==null||typeof Y=="boolean"?"":(""+Y).trim()}}catch(ve){et(R,R.return,ve)}}}else if(r.tag===6){if(a===null){R=r;try{R.stateNode.nodeValue=f?"":R.memoizedProps}catch(ve){et(R,R.return,ve)}}}else if(r.tag===18){if(a===null){R=r;try{var Q=R.stateNode;f?sg(Q,!0):sg(R.stateNode,!1)}catch(ve){et(R,R.return,ve)}}}else if((r.tag!==22&&r.tag!==23||r.memoizedState===null||r===e)&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===e)break e;for(;r.sibling===null;){if(r.return===null||r.return===e)break e;a===r&&(a=null),r=r.return}a===r&&(a=null),r.sibling.return=r.return,r=r.sibling}l&4&&(l=e.updateQueue,l!==null&&(a=l.retryQueue,a!==null&&(l.retryQueue=null,Cl(e,a))));break;case 19:sn(r,e),an(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Cl(e,l)));break;case 30:break;case 21:break;default:sn(r,e),an(e)}}function an(e){var r=e.flags;if(r&2){try{for(var a,l=e.return;l!==null;){if(ay(l)){a=l;break}l=l.return}if(a==null)throw Error(i(160));switch(a.tag){case 27:var f=a.stateNode,y=lh(e);Tl(e,y,f);break;case 5:var _=a.stateNode;a.flags&32&&(ui(_,""),a.flags&=-33);var O=lh(e);Tl(e,O,_);break;case 3:case 4:var R=a.stateNode.containerInfo,V=lh(e);ch(e,V,R);break;default:throw Error(i(161))}}catch(Z){et(e,e.return,Z)}e.flags&=-3}r&4096&&(e.flags&=-4097)}function py(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var r=e;py(r),r.tag===5&&r.flags&1024&&r.stateNode.reset(),e=e.sibling}}function kr(e,r){if(r.subtreeFlags&8772)for(r=r.child;r!==null;)cy(e,r.alternate,r),r=r.sibling}function Ks(e){for(e=e.child;e!==null;){var r=e;switch(r.tag){case 0:case 11:case 14:case 15:ns(4,r,r.return),Ks(r);break;case 1:sr(r,r.return);var a=r.stateNode;typeof a.componentWillUnmount=="function"&&sy(r,r.return,a),Ks(r);break;case 27:Ja(r.stateNode);case 26:case 5:sr(r,r.return),Ks(r);break;case 22:r.memoizedState===null&&Ks(r);break;case 30:Ks(r);break;default:Ks(r)}e=e.sibling}}function Nr(e,r,a){for(a=a&&(r.subtreeFlags&8772)!==0,r=r.child;r!==null;){var l=r.alternate,f=e,y=r,_=y.flags;switch(y.tag){case 0:case 11:case 15:Nr(f,y,a),Ua(4,y);break;case 1:if(Nr(f,y,a),l=y,f=l.stateNode,typeof f.componentDidMount=="function")try{f.componentDidMount()}catch(V){et(l,l.return,V)}if(l=y,f=l.updateQueue,f!==null){var O=l.stateNode;try{var R=f.shared.hiddenCallbacks;if(R!==null)for(f.shared.hiddenCallbacks=null,f=0;f<R.length;f++)V0(R[f],O)}catch(V){et(l,l.return,V)}}a&&_&64&&ry(y),za(y,y.return);break;case 27:oy(y);case 26:case 5:Nr(f,y,a),a&&l===null&&_&4&&iy(y),za(y,y.return);break;case 12:Nr(f,y,a);break;case 31:Nr(f,y,a),a&&_&4&&hy(f,y);break;case 13:Nr(f,y,a),a&&_&4&&dy(f,y);break;case 22:y.memoizedState===null&&Nr(f,y,a),za(y,y.return);break;case 30:break;default:Nr(f,y,a)}r=r.sibling}}function fh(e,r){var a=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),e=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(e=r.memoizedState.cachePool.pool),e!==a&&(e!=null&&e.refCount++,a!=null&&Aa(a))}function hh(e,r){e=null,r.alternate!==null&&(e=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==e&&(r.refCount++,e!=null&&Aa(e))}function Kn(e,r,a,l){if(r.subtreeFlags&10256)for(r=r.child;r!==null;)yy(e,r,a,l),r=r.sibling}function yy(e,r,a,l){var f=r.flags;switch(r.tag){case 0:case 11:case 15:Kn(e,r,a,l),f&2048&&Ua(9,r);break;case 1:Kn(e,r,a,l);break;case 3:Kn(e,r,a,l),f&2048&&(e=null,r.alternate!==null&&(e=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==e&&(r.refCount++,e!=null&&Aa(e)));break;case 12:if(f&2048){Kn(e,r,a,l),e=r.stateNode;try{var y=r.memoizedProps,_=y.id,O=y.onPostCommit;typeof O=="function"&&O(_,r.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(R){et(r,r.return,R)}}else Kn(e,r,a,l);break;case 31:Kn(e,r,a,l);break;case 13:Kn(e,r,a,l);break;case 23:break;case 22:y=r.stateNode,_=r.alternate,r.memoizedState!==null?y._visibility&2?Kn(e,r,a,l):Ia(e,r):y._visibility&2?Kn(e,r,a,l):(y._visibility|=2,Ti(e,r,a,l,(r.subtreeFlags&10256)!==0||!1)),f&2048&&fh(_,r);break;case 24:Kn(e,r,a,l),f&2048&&hh(r.alternate,r);break;default:Kn(e,r,a,l)}}function Ti(e,r,a,l,f){for(f=f&&((r.subtreeFlags&10256)!==0||!1),r=r.child;r!==null;){var y=e,_=r,O=a,R=l,V=_.flags;switch(_.tag){case 0:case 11:case 15:Ti(y,_,O,R,f),Ua(8,_);break;case 23:break;case 22:var Z=_.stateNode;_.memoizedState!==null?Z._visibility&2?Ti(y,_,O,R,f):Ia(y,_):(Z._visibility|=2,Ti(y,_,O,R,f)),f&&V&2048&&fh(_.alternate,_);break;case 24:Ti(y,_,O,R,f),f&&V&2048&&hh(_.alternate,_);break;default:Ti(y,_,O,R,f)}r=r.sibling}}function Ia(e,r){if(r.subtreeFlags&10256)for(r=r.child;r!==null;){var a=e,l=r,f=l.flags;switch(l.tag){case 22:Ia(a,l),f&2048&&fh(l.alternate,l);break;case 24:Ia(a,l),f&2048&&hh(l.alternate,l);break;default:Ia(a,l)}r=r.sibling}}var $a=8192;function Ci(e,r,a){if(e.subtreeFlags&$a)for(e=e.child;e!==null;)gy(e,r,a),e=e.sibling}function gy(e,r,a){switch(e.tag){case 26:Ci(e,r,a),e.flags&$a&&e.memoizedState!==null&&Kw(a,Yn,e.memoizedState,e.memoizedProps);break;case 5:Ci(e,r,a);break;case 3:case 4:var l=Yn;Yn=Gl(e.stateNode.containerInfo),Ci(e,r,a),Yn=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=$a,$a=16777216,Ci(e,r,a),$a=l):Ci(e,r,a));break;default:Ci(e,r,a)}}function by(e){var r=e.alternate;if(r!==null&&(e=r.child,e!==null)){r.child=null;do r=e.sibling,e.sibling=null,e=r;while(e!==null)}}function Ha(e){var r=e.deletions;if((e.flags&16)!==0){if(r!==null)for(var a=0;a<r.length;a++){var l=r[a];Pt=l,vy(l,e)}by(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)xy(e),e=e.sibling}function xy(e){switch(e.tag){case 0:case 11:case 15:Ha(e),e.flags&2048&&ns(9,e,e.return);break;case 3:Ha(e);break;case 12:Ha(e);break;case 22:var r=e.stateNode;e.memoizedState!==null&&r._visibility&2&&(e.return===null||e.return.tag!==13)?(r._visibility&=-3,Ml(e)):Ha(e);break;default:Ha(e)}}function Ml(e){var r=e.deletions;if((e.flags&16)!==0){if(r!==null)for(var a=0;a<r.length;a++){var l=r[a];Pt=l,vy(l,e)}by(e)}for(e=e.child;e!==null;){switch(r=e,r.tag){case 0:case 11:case 15:ns(8,r,r.return),Ml(r);break;case 22:a=r.stateNode,a._visibility&2&&(a._visibility&=-3,Ml(r));break;default:Ml(r)}e=e.sibling}}function vy(e,r){for(;Pt!==null;){var a=Pt;switch(a.tag){case 0:case 11:case 15:ns(8,a,r);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var l=a.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:Aa(a.memoizedState.cache)}if(l=a.child,l!==null)l.return=a,Pt=l;else e:for(a=e;Pt!==null;){l=Pt;var f=l.sibling,y=l.return;if(uy(l),l===a){Pt=null;break e}if(f!==null){f.return=y,Pt=f;break e}Pt=y}}}var cw={getCacheForType:function(e){var r=It(At),a=r.data.get(e);return a===void 0&&(a=e(),r.data.set(e,a)),a},cacheSignal:function(){return It(At).controller.signal}},uw=typeof WeakMap=="function"?WeakMap:Map,Qe=0,ot=null,ze=null,$e=0,Ze=0,yn=null,rs=!1,Mi=!1,dh=!1,Tr=0,xt=0,ss=0,Js=0,mh=0,gn=0,Ri=0,Fa=null,on=null,ph=!1,Rl=0,_y=0,Dl=1/0,Ll=null,is=null,Dt=0,as=null,Di=null,Cr=0,yh=0,gh=null,wy=null,Ga=0,bh=null;function bn(){return(Qe&2)!==0&&$e!==0?$e&-$e:F.T!==null?Eh():da()}function Sy(){if(gn===0)if(($e&536870912)===0||Ge){var e=dr;dr<<=1,(dr&3932160)===0&&(dr=262144),gn=e}else gn=536870912;return e=mn.current,e!==null&&(e.flags|=32),gn}function ln(e,r,a){(e===ot&&(Ze===2||Ze===9)||e.cancelPendingCommit!==null)&&(Li(e,0),os(e,$e,gn,!1)),Fn(e,a),((Qe&2)===0||e!==ot)&&(e===ot&&((Qe&2)===0&&(Js|=a),xt===4&&os(e,$e,gn,!1)),ir(e))}function Ey(e,r,a){if((Qe&6)!==0)throw Error(i(327));var l=!a&&(r&127)===0&&(r&e.expiredLanes)===0||Ts(e,r),f=l?dw(e,r):vh(e,r,!0),y=l;do{if(f===0){Mi&&!l&&os(e,r,0,!1);break}else{if(a=e.current.alternate,y&&!fw(a)){f=vh(e,r,!1),y=!1;continue}if(f===2){if(y=r,e.errorRecoveryDisabledLanes&y)var _=0;else _=e.pendingLanes&-536870913,_=_!==0?_:_&536870912?536870912:0;if(_!==0){r=_;e:{var O=e;f=Fa;var R=O.current.memoizedState.isDehydrated;if(R&&(Li(O,_).flags|=256),_=vh(O,_,!1),_!==2){if(dh&&!R){O.errorRecoveryDisabledLanes|=y,Js|=y,f=4;break e}y=on,on=f,y!==null&&(on===null?on=y:on.push.apply(on,y))}f=_}if(y=!1,f!==2)continue}}if(f===1){Li(e,0),os(e,r,0,!0);break}e:{switch(l=e,y=f,y){case 0:case 1:throw Error(i(345));case 4:if((r&4194048)!==r)break;case 6:os(l,r,gn,!rs);break e;case 2:on=null;break;case 3:case 5:break;default:throw Error(i(329))}if((r&62914560)===r&&(f=Rl+300-ft(),10<f)){if(os(l,r,gn,!rs),Ns(l,0,!0)!==0)break e;Cr=r,l.timeoutHandle=tg(Oy.bind(null,l,a,on,Ll,ph,r,gn,Js,Ri,rs,y,"Throttled",-0,0),f);break e}Oy(l,a,on,Ll,ph,r,gn,Js,Ri,rs,y,null,-0,0)}}break}while(!0);ir(e)}function Oy(e,r,a,l,f,y,_,O,R,V,Z,ie,Y,Q){if(e.timeoutHandle=-1,ie=r.subtreeFlags,ie&8192||(ie&16785408)===16785408){ie={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:yr},gy(r,y,ie);var ve=(y&62914560)===y?Rl-ft():(y&4194048)===y?_y-ft():0;if(ve=Jw(ie,ve),ve!==null){Cr=y,e.cancelPendingCommit=ve(Ry.bind(null,e,r,y,a,l,f,_,O,R,Z,ie,null,Y,Q)),os(e,y,_,!V);return}}Ry(e,r,y,a,l,f,_,O,R)}function fw(e){for(var r=e;;){var a=r.tag;if((a===0||a===11||a===15)&&r.flags&16384&&(a=r.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var l=0;l<a.length;l++){var f=a[l],y=f.getSnapshot;f=f.value;try{if(!hn(y(),f))return!1}catch{return!1}}if(a=r.child,r.subtreeFlags&16384&&a!==null)a.return=r,r=a;else{if(r===e)break;for(;r.sibling===null;){if(r.return===null||r.return===e)return!0;r=r.return}r.sibling.return=r.return,r=r.sibling}}return!0}function os(e,r,a,l){r&=~mh,r&=~Js,e.suspendedLanes|=r,e.pingedLanes&=~r,l&&(e.warmLanes|=r),l=e.expirationTimes;for(var f=r;0<f;){var y=31-Ft(f),_=1<<y;l[y]=-1,f&=~_}a!==0&&Fr(e,a,r)}function ql(){return(Qe&6)===0?(Va(0),!1):!0}function xh(){if(ze!==null){if(Ze===0)var e=ze.return;else e=ze,vr=zs=null,Lf(e),Oi=null,ka=0,e=ze;for(;e!==null;)ny(e.alternate,e),e=e.return;ze=null}}function Li(e,r){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,Cw(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),Cr=0,xh(),ot=e,ze=a=br(e.current,null),$e=r,Ze=0,yn=null,rs=!1,Mi=Ts(e,r),dh=!1,Ri=gn=mh=Js=ss=xt=0,on=Fa=null,ph=!1,(r&8)!==0&&(r|=r&32);var l=e.entangledLanes;if(l!==0)for(e=e.entanglements,l&=r;0<l;){var f=31-Ft(l),y=1<<f;r|=e[f],l&=~y}return Tr=r,rl(),a}function Ay(e,r){De=null,F.H=qa,r===Ei||r===fl?(r=$0(),Ze=3):r===Sf?(r=$0(),Ze=4):Ze=r===Xf?8:r!==null&&typeof r=="object"&&typeof r.then=="function"?6:1,yn=r,ze===null&&(xt=1,Ol(e,Rn(r,e.current)))}function jy(){var e=mn.current;return e===null?!0:($e&4194048)===$e?Pn===null:($e&62914560)===$e||($e&536870912)!==0?e===Pn:!1}function ky(){var e=F.H;return F.H=qa,e===null?qa:e}function Ny(){var e=F.A;return F.A=cw,e}function Pl(){xt=4,rs||($e&4194048)!==$e&&mn.current!==null||(Mi=!0),(ss&134217727)===0&&(Js&134217727)===0||ot===null||os(ot,$e,gn,!1)}function vh(e,r,a){var l=Qe;Qe|=2;var f=ky(),y=Ny();(ot!==e||$e!==r)&&(Ll=null,Li(e,r)),r=!1;var _=xt;e:do try{if(Ze!==0&&ze!==null){var O=ze,R=yn;switch(Ze){case 8:xh(),_=6;break e;case 3:case 2:case 9:case 6:mn.current===null&&(r=!0);var V=Ze;if(Ze=0,yn=null,qi(e,O,R,V),a&&Mi){_=0;break e}break;default:V=Ze,Ze=0,yn=null,qi(e,O,R,V)}}hw(),_=xt;break}catch(Z){Ay(e,Z)}while(!0);return r&&e.shellSuspendCounter++,vr=zs=null,Qe=l,F.H=f,F.A=y,ze===null&&(ot=null,$e=0,rl()),_}function hw(){for(;ze!==null;)Ty(ze)}function dw(e,r){var a=Qe;Qe|=2;var l=ky(),f=Ny();ot!==e||$e!==r?(Ll=null,Dl=ft()+500,Li(e,r)):Mi=Ts(e,r);e:do try{if(Ze!==0&&ze!==null){r=ze;var y=yn;t:switch(Ze){case 1:Ze=0,yn=null,qi(e,r,y,1);break;case 2:case 9:if(z0(y)){Ze=0,yn=null,Cy(r);break}r=function(){Ze!==2&&Ze!==9||ot!==e||(Ze=7),ir(e)},y.then(r,r);break e;case 3:Ze=7;break e;case 4:Ze=5;break e;case 7:z0(y)?(Ze=0,yn=null,Cy(r)):(Ze=0,yn=null,qi(e,r,y,7));break;case 5:var _=null;switch(ze.tag){case 26:_=ze.memoizedState;case 5:case 27:var O=ze;if(_?yg(_):O.stateNode.complete){Ze=0,yn=null;var R=O.sibling;if(R!==null)ze=R;else{var V=O.return;V!==null?(ze=V,Bl(V)):ze=null}break t}}Ze=0,yn=null,qi(e,r,y,5);break;case 6:Ze=0,yn=null,qi(e,r,y,6);break;case 8:xh(),xt=6;break e;default:throw Error(i(462))}}mw();break}catch(Z){Ay(e,Z)}while(!0);return vr=zs=null,F.H=l,F.A=f,Qe=a,ze!==null?0:(ot=null,$e=0,rl(),xt)}function mw(){for(;ze!==null&&!zo();)Ty(ze)}function Ty(e){var r=ey(e.alternate,e,Tr);e.memoizedProps=e.pendingProps,r===null?Bl(e):ze=r}function Cy(e){var r=e,a=r.alternate;switch(r.tag){case 15:case 0:r=Kp(a,r,r.pendingProps,r.type,void 0,$e);break;case 11:r=Kp(a,r,r.pendingProps,r.type.render,r.ref,$e);break;case 5:Lf(r);default:ny(a,r),r=ze=N0(r,Tr),r=ey(a,r,Tr)}e.memoizedProps=e.pendingProps,r===null?Bl(e):ze=r}function qi(e,r,a,l){vr=zs=null,Lf(r),Oi=null,ka=0;var f=r.return;try{if(nw(e,f,r,a,$e)){xt=1,Ol(e,Rn(a,e.current)),ze=null;return}}catch(y){if(f!==null)throw ze=f,y;xt=1,Ol(e,Rn(a,e.current)),ze=null;return}r.flags&32768?(Ge||l===1?e=!0:Mi||($e&536870912)!==0?e=!1:(rs=e=!0,(l===2||l===9||l===3||l===6)&&(l=mn.current,l!==null&&l.tag===13&&(l.flags|=16384))),My(r,e)):Bl(r)}function Bl(e){var r=e;do{if((r.flags&32768)!==0){My(r,rs);return}e=r.return;var a=iw(r.alternate,r,Tr);if(a!==null){ze=a;return}if(r=r.sibling,r!==null){ze=r;return}ze=r=e}while(r!==null);xt===0&&(xt=5)}function My(e,r){do{var a=aw(e.alternate,e);if(a!==null){a.flags&=32767,ze=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!r&&(e=e.sibling,e!==null)){ze=e;return}ze=e=a}while(e!==null);xt=6,ze=null}function Ry(e,r,a,l,f,y,_,O,R){e.cancelPendingCommit=null;do Ul();while(Dt!==0);if((Qe&6)!==0)throw Error(i(327));if(r!==null){if(r===e.current)throw Error(i(177));if(y=r.lanes|r.childLanes,y|=lf,Hr(e,a,y,_,O,R),e===ot&&(ze=ot=null,$e=0),Di=r,as=e,Cr=a,yh=y,gh=f,wy=l,(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,bw(ii,function(){return By(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(r.flags&13878)!==0,(r.subtreeFlags&13878)!==0||l){l=F.T,F.T=null,f=J.p,J.p=2,_=Qe,Qe|=4;try{ow(e,r,a)}finally{Qe=_,J.p=f,F.T=l}}Dt=1,Dy(),Ly(),qy()}}function Dy(){if(Dt===1){Dt=0;var e=as,r=Di,a=(r.flags&13878)!==0;if((r.subtreeFlags&13878)!==0||a){a=F.T,F.T=null;var l=J.p;J.p=2;var f=Qe;Qe|=4;try{my(r,e);var y=Mh,_=v0(e.containerInfo),O=y.focusedElem,R=y.selectionRange;if(_!==O&&O&&O.ownerDocument&&x0(O.ownerDocument.documentElement,O)){if(R!==null&&nf(O)){var V=R.start,Z=R.end;if(Z===void 0&&(Z=V),"selectionStart"in O)O.selectionStart=V,O.selectionEnd=Math.min(Z,O.value.length);else{var ie=O.ownerDocument||document,Y=ie&&ie.defaultView||window;if(Y.getSelection){var Q=Y.getSelection(),ve=O.textContent.length,Te=Math.min(R.start,ve),st=R.end===void 0?Te:Math.min(R.end,ve);!Q.extend&&Te>st&&(_=st,st=Te,Te=_);var $=b0(O,Te),B=b0(O,st);if($&&B&&(Q.rangeCount!==1||Q.anchorNode!==$.node||Q.anchorOffset!==$.offset||Q.focusNode!==B.node||Q.focusOffset!==B.offset)){var G=ie.createRange();G.setStart($.node,$.offset),Q.removeAllRanges(),Te>st?(Q.addRange(G),Q.extend(B.node,B.offset)):(G.setEnd(B.node,B.offset),Q.addRange(G))}}}}for(ie=[],Q=O;Q=Q.parentNode;)Q.nodeType===1&&ie.push({element:Q,left:Q.scrollLeft,top:Q.scrollTop});for(typeof O.focus=="function"&&O.focus(),O=0;O<ie.length;O++){var ee=ie[O];ee.element.scrollLeft=ee.left,ee.element.scrollTop=ee.top}}Xl=!!Ch,Mh=Ch=null}finally{Qe=f,J.p=l,F.T=a}}e.current=r,Dt=2}}function Ly(){if(Dt===2){Dt=0;var e=as,r=Di,a=(r.flags&8772)!==0;if((r.subtreeFlags&8772)!==0||a){a=F.T,F.T=null;var l=J.p;J.p=2;var f=Qe;Qe|=4;try{cy(e,r.alternate,r)}finally{Qe=f,J.p=l,F.T=a}}Dt=3}}function qy(){if(Dt===4||Dt===3){Dt=0,si();var e=as,r=Di,a=Cr,l=wy;(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?Dt=5:(Dt=0,Di=as=null,Py(e,e.pendingLanes));var f=e.pendingLanes;if(f===0&&(is=null),Ms(a),r=r.stateNode,_t&&typeof _t.onCommitFiberRoot=="function")try{_t.onCommitFiberRoot(ks,r,void 0,(r.current.flags&128)===128)}catch{}if(l!==null){r=F.T,f=J.p,J.p=2,F.T=null;try{for(var y=e.onRecoverableError,_=0;_<l.length;_++){var O=l[_];y(O.value,{componentStack:O.stack})}}finally{F.T=r,J.p=f}}(Cr&3)!==0&&Ul(),ir(e),f=e.pendingLanes,(a&261930)!==0&&(f&42)!==0?e===bh?Ga++:(Ga=0,bh=e):Ga=0,Va(0)}}function Py(e,r){(e.pooledCacheLanes&=r)===0&&(r=e.pooledCache,r!=null&&(e.pooledCache=null,Aa(r)))}function Ul(){return Dy(),Ly(),qy(),By()}function By(){if(Dt!==5)return!1;var e=as,r=yh;yh=0;var a=Ms(Cr),l=F.T,f=J.p;try{J.p=32>a?32:a,F.T=null,a=gh,gh=null;var y=as,_=Cr;if(Dt=0,Di=as=null,Cr=0,(Qe&6)!==0)throw Error(i(331));var O=Qe;if(Qe|=4,xy(y.current),yy(y,y.current,_,a),Qe=O,Va(0,!1),_t&&typeof _t.onPostCommitFiberRoot=="function")try{_t.onPostCommitFiberRoot(ks,y)}catch{}return!0}finally{J.p=f,F.T=l,Py(e,r)}}function Uy(e,r,a){r=Rn(a,r),r=Qf(e.stateNode,r,2),e=Zr(e,r,2),e!==null&&(Fn(e,2),ir(e))}function et(e,r,a){if(e.tag===3)Uy(e,e,a);else for(;r!==null;){if(r.tag===3){Uy(r,e,a);break}else if(r.tag===1){var l=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(is===null||!is.has(l))){e=Rn(a,e),a=zp(2),l=Zr(r,a,2),l!==null&&(Ip(a,l,r,e),Fn(l,2),ir(l));break}}r=r.return}}function _h(e,r,a){var l=e.pingCache;if(l===null){l=e.pingCache=new uw;var f=new Set;l.set(r,f)}else f=l.get(r),f===void 0&&(f=new Set,l.set(r,f));f.has(a)||(dh=!0,f.add(a),e=pw.bind(null,e,r,a),r.then(e,e))}function pw(e,r,a){var l=e.pingCache;l!==null&&l.delete(r),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,ot===e&&($e&a)===a&&(xt===4||xt===3&&($e&62914560)===$e&&300>ft()-Rl?(Qe&2)===0&&Li(e,0):mh|=a,Ri===$e&&(Ri=0)),ir(e)}function zy(e,r){r===0&&(r=oi()),e=Ps(e,r),e!==null&&(Fn(e,r),ir(e))}function yw(e){var r=e.memoizedState,a=0;r!==null&&(a=r.retryLane),zy(e,a)}function gw(e,r){var a=0;switch(e.tag){case 31:case 13:var l=e.stateNode,f=e.memoizedState;f!==null&&(a=f.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(i(314))}l!==null&&l.delete(r),zy(e,a)}function bw(e,r){return ca(e,r)}var zl=null,Pi=null,wh=!1,Il=!1,Sh=!1,ls=0;function ir(e){e!==Pi&&e.next===null&&(Pi===null?zl=Pi=e:Pi=Pi.next=e),Il=!0,wh||(wh=!0,vw())}function Va(e,r){if(!Sh&&Il){Sh=!0;do for(var a=!1,l=zl;l!==null;){if(e!==0){var f=l.pendingLanes;if(f===0)var y=0;else{var _=l.suspendedLanes,O=l.pingedLanes;y=(1<<31-Ft(42|e)+1)-1,y&=f&~(_&~O),y=y&201326741?y&201326741|1:y?y|2:0}y!==0&&(a=!0,Fy(l,y))}else y=$e,y=Ns(l,l===ot?y:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(y&3)===0||Ts(l,y)||(a=!0,Fy(l,y));l=l.next}while(a);Sh=!1}}function xw(){Iy()}function Iy(){Il=wh=!1;var e=0;ls!==0&&Tw()&&(e=ls);for(var r=ft(),a=null,l=zl;l!==null;){var f=l.next,y=$y(l,r);y===0?(l.next=null,a===null?zl=f:a.next=f,f===null&&(Pi=a)):(a=l,(e!==0||(y&3)!==0)&&(Il=!0)),l=f}Dt!==0&&Dt!==5||Va(e),ls!==0&&(ls=0)}function $y(e,r){for(var a=e.suspendedLanes,l=e.pingedLanes,f=e.expirationTimes,y=e.pendingLanes&-62914561;0<y;){var _=31-Ft(y),O=1<<_,R=f[_];R===-1?((O&a)===0||(O&l)!==0)&&(f[_]=ha(O,r)):R<=r&&(e.expiredLanes|=O),y&=~O}if(r=ot,a=$e,a=Ns(e,e===r?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,a===0||e===r&&(Ze===2||Ze===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&hr(l),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||Ts(e,a)){if(r=a&-a,r===e.callbackPriority)return r;switch(l!==null&&hr(l),Ms(a)){case 2:case 8:a=$o;break;case 32:a=ii;break;case 268435456:a=Ho;break;default:a=ii}return l=Hy.bind(null,e),a=ca(a,l),e.callbackPriority=r,e.callbackNode=a,r}return l!==null&&l!==null&&hr(l),e.callbackPriority=2,e.callbackNode=null,2}function Hy(e,r){if(Dt!==0&&Dt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(Ul()&&e.callbackNode!==a)return null;var l=$e;return l=Ns(e,e===ot?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(Ey(e,l,r),$y(e,ft()),e.callbackNode!=null&&e.callbackNode===a?Hy.bind(null,e):null)}function Fy(e,r){if(Ul())return null;Ey(e,r,!0)}function vw(){Mw(function(){(Qe&6)!==0?ca(Io,xw):Iy()})}function Eh(){if(ls===0){var e=wi;e===0&&(e=zr,zr<<=1,(zr&261888)===0&&(zr=256)),ls=e}return ls}function Gy(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Jo(""+e)}function Vy(e,r){var a=r.ownerDocument.createElement("input");return a.name=r.name,a.value=r.value,e.id&&a.setAttribute("form",e.id),r.parentNode.insertBefore(a,r),e=new FormData(e),a.parentNode.removeChild(a),e}function _w(e,r,a,l,f){if(r==="submit"&&a&&a.stateNode===f){var y=Gy((f[gt]||null).action),_=l.submitter;_&&(r=(r=_[gt]||null)?Gy(r.formAction):_.getAttribute("formAction"),r!==null&&(y=r,_=null));var O=new Zo("action","action",null,l,f);e.push({event:O,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(ls!==0){var R=_?Vy(f,_):new FormData(f);Ff(a,{pending:!0,data:R,method:f.method,action:y},null,R)}}else typeof y=="function"&&(O.preventDefault(),R=_?Vy(f,_):new FormData(f),Ff(a,{pending:!0,data:R,method:f.method,action:y},y,R))},currentTarget:f}]})}}for(var Oh=0;Oh<of.length;Oh++){var Ah=of[Oh],ww=Ah.toLowerCase(),Sw=Ah[0].toUpperCase()+Ah.slice(1);Vn(ww,"on"+Sw)}Vn(S0,"onAnimationEnd"),Vn(E0,"onAnimationIteration"),Vn(O0,"onAnimationStart"),Vn("dblclick","onDoubleClick"),Vn("focusin","onFocus"),Vn("focusout","onBlur"),Vn(U_,"onTransitionRun"),Vn(z_,"onTransitionStart"),Vn(I_,"onTransitionCancel"),Vn(A0,"onTransitionEnd"),K("onMouseEnter",["mouseout","mouseover"]),K("onMouseLeave",["mouseout","mouseover"]),K("onPointerEnter",["pointerout","pointerover"]),K("onPointerLeave",["pointerout","pointerover"]),oe("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),oe("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),oe("onBeforeInput",["compositionend","keypress","textInput","paste"]),oe("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),oe("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),oe("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ya="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(" "),Ew=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ya));function Yy(e,r){r=(r&4)!==0;for(var a=0;a<e.length;a++){var l=e[a],f=l.event;l=l.listeners;e:{var y=void 0;if(r)for(var _=l.length-1;0<=_;_--){var O=l[_],R=O.instance,V=O.currentTarget;if(O=O.listener,R!==y&&f.isPropagationStopped())break e;y=O,f.currentTarget=V;try{y(f)}catch(Z){nl(Z)}f.currentTarget=null,y=R}else for(_=0;_<l.length;_++){if(O=l[_],R=O.instance,V=O.currentTarget,O=O.listener,R!==y&&f.isPropagationStopped())break e;y=O,f.currentTarget=V;try{y(f)}catch(Z){nl(Z)}f.currentTarget=null,y=R}}}}function Ie(e,r){var a=r[Rs];a===void 0&&(a=r[Rs]=new Set);var l=e+"__bubble";a.has(l)||(Ky(r,e,2,!1),a.add(l))}function jh(e,r,a){var l=0;r&&(l|=4),Ky(a,e,l,r)}var $l="_reactListening"+Math.random().toString(36).slice(2);function kh(e){if(!e[$l]){e[$l]=!0,H.forEach(function(a){a!=="selectionchange"&&(Ew.has(a)||jh(a,!1,e),jh(a,!0,e))});var r=e.nodeType===9?e:e.ownerDocument;r===null||r[$l]||(r[$l]=!0,jh("selectionchange",!1,r))}}function Ky(e,r,a,l){switch(Sg(r)){case 2:var f=Ww;break;case 8:f=Zw;break;default:f=Hh}a=f.bind(null,r,a,e),f=void 0,!Yu||r!=="touchstart"&&r!=="touchmove"&&r!=="wheel"||(f=!0),l?f!==void 0?e.addEventListener(r,a,{capture:!0,passive:f}):e.addEventListener(r,a,!0):f!==void 0?e.addEventListener(r,a,{passive:f}):e.addEventListener(r,a,!1)}function Nh(e,r,a,l,f){var y=l;if((r&1)===0&&(r&2)===0&&l!==null)e:for(;;){if(l===null)return;var _=l.tag;if(_===3||_===4){var O=l.stateNode.containerInfo;if(O===f)break;if(_===4)for(_=l.return;_!==null;){var R=_.tag;if((R===3||R===4)&&_.stateNode.containerInfo===f)return;_=_.return}for(;O!==null;){if(_=A(O),_===null)return;if(R=_.tag,R===5||R===6||R===26||R===27){l=y=_;continue e}O=O.parentNode}}l=l.return}Zm(function(){var V=y,Z=Gu(a),ie=[];e:{var Y=j0.get(e);if(Y!==void 0){var Q=Zo,ve=e;switch(e){case"keypress":if(Xo(a)===0)break e;case"keydown":case"keyup":Q=g_;break;case"focusin":ve="focus",Q=Xu;break;case"focusout":ve="blur",Q=Xu;break;case"beforeblur":case"afterblur":Q=Xu;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":Q=n0;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Q=i_;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Q=v_;break;case S0:case E0:case O0:Q=l_;break;case A0:Q=w_;break;case"scroll":case"scrollend":Q=r_;break;case"wheel":Q=E_;break;case"copy":case"cut":case"paste":Q=u_;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Q=s0;break;case"toggle":case"beforetoggle":Q=A_}var Te=(r&4)!==0,st=!Te&&(e==="scroll"||e==="scrollend"),$=Te?Y!==null?Y+"Capture":null:Y;Te=[];for(var B=V,G;B!==null;){var ee=B;if(G=ee.stateNode,ee=ee.tag,ee!==5&&ee!==26&&ee!==27||G===null||$===null||(ee=pa(B,$),ee!=null&&Te.push(Ka(B,ee,G))),st)break;B=B.return}0<Te.length&&(Y=new Q(Y,ve,null,a,Z),ie.push({event:Y,listeners:Te}))}}if((r&7)===0){e:{if(Y=e==="mouseover"||e==="pointerover",Q=e==="mouseout"||e==="pointerout",Y&&a!==Fu&&(ve=a.relatedTarget||a.fromElement)&&(A(ve)||ve[fn]))break e;if((Q||Y)&&(Y=Z.window===Z?Z:(Y=Z.ownerDocument)?Y.defaultView||Y.parentWindow:window,Q?(ve=a.relatedTarget||a.toElement,Q=V,ve=ve?A(ve):null,ve!==null&&(st=c(ve),Te=ve.tag,ve!==st||Te!==5&&Te!==27&&Te!==6)&&(ve=null)):(Q=null,ve=V),Q!==ve)){if(Te=n0,ee="onMouseLeave",$="onMouseEnter",B="mouse",(e==="pointerout"||e==="pointerover")&&(Te=s0,ee="onPointerLeave",$="onPointerEnter",B="pointer"),st=Q==null?Y:k(Q),G=ve==null?Y:k(ve),Y=new Te(ee,B+"leave",Q,a,Z),Y.target=st,Y.relatedTarget=G,ee=null,A(Z)===V&&(Te=new Te($,B+"enter",ve,a,Z),Te.target=G,Te.relatedTarget=st,ee=Te),st=ee,Q&&ve)t:{for(Te=Ow,$=Q,B=ve,G=0,ee=$;ee;ee=Te(ee))G++;ee=0;for(var Ae=B;Ae;Ae=Te(Ae))ee++;for(;0<G-ee;)$=Te($),G--;for(;0<ee-G;)B=Te(B),ee--;for(;G--;){if($===B||B!==null&&$===B.alternate){Te=$;break t}$=Te($),B=Te(B)}Te=null}else Te=null;Q!==null&&Jy(ie,Y,Q,Te,!1),ve!==null&&st!==null&&Jy(ie,st,ve,Te,!0)}}e:{if(Y=V?k(V):window,Q=Y.nodeName&&Y.nodeName.toLowerCase(),Q==="select"||Q==="input"&&Y.type==="file")var Ke=h0;else if(u0(Y))if(d0)Ke=q_;else{Ke=D_;var _e=R_}else Q=Y.nodeName,!Q||Q.toLowerCase()!=="input"||Y.type!=="checkbox"&&Y.type!=="radio"?V&&Hu(V.elementType)&&(Ke=h0):Ke=L_;if(Ke&&(Ke=Ke(e,V))){f0(ie,Ke,a,Z);break e}_e&&_e(e,Y,V),e==="focusout"&&V&&Y.type==="number"&&V.memoizedProps.value!=null&&$u(Y,"number",Y.value)}switch(_e=V?k(V):window,e){case"focusin":(u0(_e)||_e.contentEditable==="true")&&(mi=_e,rf=V,Sa=null);break;case"focusout":Sa=rf=mi=null;break;case"mousedown":sf=!0;break;case"contextmenu":case"mouseup":case"dragend":sf=!1,_0(ie,a,Z);break;case"selectionchange":if(B_)break;case"keydown":case"keyup":_0(ie,a,Z)}var Le;if(Zu)e:{switch(e){case"compositionstart":var He="onCompositionStart";break e;case"compositionend":He="onCompositionEnd";break e;case"compositionupdate":He="onCompositionUpdate";break e}He=void 0}else di?l0(e,a)&&(He="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(He="onCompositionStart");He&&(i0&&a.locale!=="ko"&&(di||He!=="onCompositionStart"?He==="onCompositionEnd"&&di&&(Le=e0()):(Vr=Z,Ku="value"in Vr?Vr.value:Vr.textContent,di=!0)),_e=Hl(V,He),0<_e.length&&(He=new r0(He,e,null,a,Z),ie.push({event:He,listeners:_e}),Le?He.data=Le:(Le=c0(a),Le!==null&&(He.data=Le)))),(Le=k_?N_(e,a):T_(e,a))&&(He=Hl(V,"onBeforeInput"),0<He.length&&(_e=new r0("onBeforeInput","beforeinput",null,a,Z),ie.push({event:_e,listeners:He}),_e.data=Le)),_w(ie,e,V,a,Z)}Yy(ie,r)})}function Ka(e,r,a){return{instance:e,listener:r,currentTarget:a}}function Hl(e,r){for(var a=r+"Capture",l=[];e!==null;){var f=e,y=f.stateNode;if(f=f.tag,f!==5&&f!==26&&f!==27||y===null||(f=pa(e,a),f!=null&&l.unshift(Ka(e,f,y)),f=pa(e,r),f!=null&&l.push(Ka(e,f,y))),e.tag===3)return l;e=e.return}return[]}function Ow(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Jy(e,r,a,l,f){for(var y=r._reactName,_=[];a!==null&&a!==l;){var O=a,R=O.alternate,V=O.stateNode;if(O=O.tag,R!==null&&R===l)break;O!==5&&O!==26&&O!==27||V===null||(R=V,f?(V=pa(a,y),V!=null&&_.unshift(Ka(a,V,R))):f||(V=pa(a,y),V!=null&&_.push(Ka(a,V,R)))),a=a.return}_.length!==0&&e.push({event:r,listeners:_})}var Aw=/\r\n?/g,jw=/\u0000|\uFFFD/g;function Qy(e){return(typeof e=="string"?e:""+e).replace(Aw,`
26
+ `).replace(jw,"")}function Xy(e,r){return r=Qy(r),Qy(e)===r}function rt(e,r,a,l,f,y){switch(a){case"children":typeof l=="string"?r==="body"||r==="textarea"&&l===""||ui(e,l):(typeof l=="number"||typeof l=="bigint")&&r!=="body"&&ui(e,""+l);break;case"className":Gn(e,"class",l);break;case"tabIndex":Gn(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":Gn(e,a,l);break;case"style":Xm(e,l,y);break;case"data":if(r!=="object"){Gn(e,"data",l);break}case"src":case"href":if(l===""&&(r!=="a"||a!=="href")){e.removeAttribute(a);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(a);break}l=Jo(""+l),e.setAttribute(a,l);break;case"action":case"formAction":if(typeof l=="function"){e.setAttribute(a,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof y=="function"&&(a==="formAction"?(r!=="input"&&rt(e,r,"name",f.name,f,null),rt(e,r,"formEncType",f.formEncType,f,null),rt(e,r,"formMethod",f.formMethod,f,null),rt(e,r,"formTarget",f.formTarget,f,null)):(rt(e,r,"encType",f.encType,f,null),rt(e,r,"method",f.method,f,null),rt(e,r,"target",f.target,f,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(a);break}l=Jo(""+l),e.setAttribute(a,l);break;case"onClick":l!=null&&(e.onclick=yr);break;case"onScroll":l!=null&&Ie("scroll",e);break;case"onScrollEnd":l!=null&&Ie("scrollend",e);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(i(61));if(a=l.__html,a!=null){if(f.children!=null)throw Error(i(60));e.innerHTML=a}}break;case"multiple":e.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":e.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){e.removeAttribute("xlink:href");break}a=Jo(""+l),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(a,""+l):e.removeAttribute(a);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":l&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(a,""):e.removeAttribute(a);break;case"capture":case"download":l===!0?e.setAttribute(a,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(a,l):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?e.setAttribute(a,l):e.removeAttribute(a);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?e.removeAttribute(a):e.setAttribute(a,l);break;case"popover":Ie("beforetoggle",e),Ie("toggle",e),Gt(e,"popover",l);break;case"xlinkActuate":pr(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":pr(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":pr(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":pr(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":pr(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":pr(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":pr(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":pr(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":pr(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":Gt(e,"is",l);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=t_.get(a)||a,Gt(e,a,l))}}function Th(e,r,a,l,f,y){switch(a){case"style":Xm(e,l,y);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(i(61));if(a=l.__html,a!=null){if(f.children!=null)throw Error(i(60));e.innerHTML=a}}break;case"children":typeof l=="string"?ui(e,l):(typeof l=="number"||typeof l=="bigint")&&ui(e,""+l);break;case"onScroll":l!=null&&Ie("scroll",e);break;case"onScrollEnd":l!=null&&Ie("scrollend",e);break;case"onClick":l!=null&&(e.onclick=yr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!ne.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(f=a.endsWith("Capture"),r=a.slice(2,f?a.length-7:void 0),y=e[gt]||null,y=y!=null?y[a]:null,typeof y=="function"&&e.removeEventListener(r,y,f),typeof l=="function")){typeof y!="function"&&y!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(r,l,f);break e}a in e?e[a]=l:l===!0?e.setAttribute(a,""):Gt(e,a,l)}}}function Ht(e,r,a){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ie("error",e),Ie("load",e);var l=!1,f=!1,y;for(y in a)if(a.hasOwnProperty(y)){var _=a[y];if(_!=null)switch(y){case"src":l=!0;break;case"srcSet":f=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,r));default:rt(e,r,y,_,a,null)}}f&&rt(e,r,"srcSet",a.srcSet,a,null),l&&rt(e,r,"src",a.src,a,null);return;case"input":Ie("invalid",e);var O=y=_=f=null,R=null,V=null;for(l in a)if(a.hasOwnProperty(l)){var Z=a[l];if(Z!=null)switch(l){case"name":f=Z;break;case"type":_=Z;break;case"checked":R=Z;break;case"defaultChecked":V=Z;break;case"value":y=Z;break;case"defaultValue":O=Z;break;case"children":case"dangerouslySetInnerHTML":if(Z!=null)throw Error(i(137,r));break;default:rt(e,r,l,Z,a,null)}}Ym(e,y,O,R,V,_,f,!1);return;case"select":Ie("invalid",e),l=_=y=null;for(f in a)if(a.hasOwnProperty(f)&&(O=a[f],O!=null))switch(f){case"value":y=O;break;case"defaultValue":_=O;break;case"multiple":l=O;default:rt(e,r,f,O,a,null)}r=y,a=_,e.multiple=!!l,r!=null?ci(e,!!l,r,!1):a!=null&&ci(e,!!l,a,!0);return;case"textarea":Ie("invalid",e),y=f=l=null;for(_ in a)if(a.hasOwnProperty(_)&&(O=a[_],O!=null))switch(_){case"value":l=O;break;case"defaultValue":f=O;break;case"children":y=O;break;case"dangerouslySetInnerHTML":if(O!=null)throw Error(i(91));break;default:rt(e,r,_,O,a,null)}Jm(e,l,f,y);return;case"option":for(R in a)if(a.hasOwnProperty(R)&&(l=a[R],l!=null))switch(R){case"selected":e.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:rt(e,r,R,l,a,null)}return;case"dialog":Ie("beforetoggle",e),Ie("toggle",e),Ie("cancel",e),Ie("close",e);break;case"iframe":case"object":Ie("load",e);break;case"video":case"audio":for(l=0;l<Ya.length;l++)Ie(Ya[l],e);break;case"image":Ie("error",e),Ie("load",e);break;case"details":Ie("toggle",e);break;case"embed":case"source":case"link":Ie("error",e),Ie("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(V in a)if(a.hasOwnProperty(V)&&(l=a[V],l!=null))switch(V){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,r));default:rt(e,r,V,l,a,null)}return;default:if(Hu(r)){for(Z in a)a.hasOwnProperty(Z)&&(l=a[Z],l!==void 0&&Th(e,r,Z,l,a,void 0));return}}for(O in a)a.hasOwnProperty(O)&&(l=a[O],l!=null&&rt(e,r,O,l,a,null))}function kw(e,r,a,l){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var f=null,y=null,_=null,O=null,R=null,V=null,Z=null;for(Q in a){var ie=a[Q];if(a.hasOwnProperty(Q)&&ie!=null)switch(Q){case"checked":break;case"value":break;case"defaultValue":R=ie;default:l.hasOwnProperty(Q)||rt(e,r,Q,null,l,ie)}}for(var Y in l){var Q=l[Y];if(ie=a[Y],l.hasOwnProperty(Y)&&(Q!=null||ie!=null))switch(Y){case"type":y=Q;break;case"name":f=Q;break;case"checked":V=Q;break;case"defaultChecked":Z=Q;break;case"value":_=Q;break;case"defaultValue":O=Q;break;case"children":case"dangerouslySetInnerHTML":if(Q!=null)throw Error(i(137,r));break;default:Q!==ie&&rt(e,r,Y,Q,l,ie)}}Iu(e,_,O,R,V,Z,y,f);return;case"select":Q=_=O=Y=null;for(y in a)if(R=a[y],a.hasOwnProperty(y)&&R!=null)switch(y){case"value":break;case"multiple":Q=R;default:l.hasOwnProperty(y)||rt(e,r,y,null,l,R)}for(f in l)if(y=l[f],R=a[f],l.hasOwnProperty(f)&&(y!=null||R!=null))switch(f){case"value":Y=y;break;case"defaultValue":O=y;break;case"multiple":_=y;default:y!==R&&rt(e,r,f,y,l,R)}r=O,a=_,l=Q,Y!=null?ci(e,!!a,Y,!1):!!l!=!!a&&(r!=null?ci(e,!!a,r,!0):ci(e,!!a,a?[]:"",!1));return;case"textarea":Q=Y=null;for(O in a)if(f=a[O],a.hasOwnProperty(O)&&f!=null&&!l.hasOwnProperty(O))switch(O){case"value":break;case"children":break;default:rt(e,r,O,null,l,f)}for(_ in l)if(f=l[_],y=a[_],l.hasOwnProperty(_)&&(f!=null||y!=null))switch(_){case"value":Y=f;break;case"defaultValue":Q=f;break;case"children":break;case"dangerouslySetInnerHTML":if(f!=null)throw Error(i(91));break;default:f!==y&&rt(e,r,_,f,l,y)}Km(e,Y,Q);return;case"option":for(var ve in a)if(Y=a[ve],a.hasOwnProperty(ve)&&Y!=null&&!l.hasOwnProperty(ve))switch(ve){case"selected":e.selected=!1;break;default:rt(e,r,ve,null,l,Y)}for(R in l)if(Y=l[R],Q=a[R],l.hasOwnProperty(R)&&Y!==Q&&(Y!=null||Q!=null))switch(R){case"selected":e.selected=Y&&typeof Y!="function"&&typeof Y!="symbol";break;default:rt(e,r,R,Y,l,Q)}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 Te in a)Y=a[Te],a.hasOwnProperty(Te)&&Y!=null&&!l.hasOwnProperty(Te)&&rt(e,r,Te,null,l,Y);for(V in l)if(Y=l[V],Q=a[V],l.hasOwnProperty(V)&&Y!==Q&&(Y!=null||Q!=null))switch(V){case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(i(137,r));break;default:rt(e,r,V,Y,l,Q)}return;default:if(Hu(r)){for(var st in a)Y=a[st],a.hasOwnProperty(st)&&Y!==void 0&&!l.hasOwnProperty(st)&&Th(e,r,st,void 0,l,Y);for(Z in l)Y=l[Z],Q=a[Z],!l.hasOwnProperty(Z)||Y===Q||Y===void 0&&Q===void 0||Th(e,r,Z,Y,l,Q);return}}for(var $ in a)Y=a[$],a.hasOwnProperty($)&&Y!=null&&!l.hasOwnProperty($)&&rt(e,r,$,null,l,Y);for(ie in l)Y=l[ie],Q=a[ie],!l.hasOwnProperty(ie)||Y===Q||Y==null&&Q==null||rt(e,r,ie,Y,l,Q)}function Wy(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Nw(){if(typeof performance.getEntriesByType=="function"){for(var e=0,r=0,a=performance.getEntriesByType("resource"),l=0;l<a.length;l++){var f=a[l],y=f.transferSize,_=f.initiatorType,O=f.duration;if(y&&O&&Wy(_)){for(_=0,O=f.responseEnd,l+=1;l<a.length;l++){var R=a[l],V=R.startTime;if(V>O)break;var Z=R.transferSize,ie=R.initiatorType;Z&&Wy(ie)&&(R=R.responseEnd,_+=Z*(R<O?1:(O-V)/(R-V)))}if(--l,r+=8*(y+_)/(f.duration/1e3),e++,10<e)break}}if(0<e)return r/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Ch=null,Mh=null;function Fl(e){return e.nodeType===9?e:e.ownerDocument}function Zy(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 eg(e,r){if(e===0)switch(r){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&r==="foreignObject"?0:e}function Rh(e,r){return e==="textarea"||e==="noscript"||typeof r.children=="string"||typeof r.children=="number"||typeof r.children=="bigint"||typeof r.dangerouslySetInnerHTML=="object"&&r.dangerouslySetInnerHTML!==null&&r.dangerouslySetInnerHTML.__html!=null}var Dh=null;function Tw(){var e=window.event;return e&&e.type==="popstate"?e===Dh?!1:(Dh=e,!0):(Dh=null,!1)}var tg=typeof setTimeout=="function"?setTimeout:void 0,Cw=typeof clearTimeout=="function"?clearTimeout:void 0,ng=typeof Promise=="function"?Promise:void 0,Mw=typeof queueMicrotask=="function"?queueMicrotask:typeof ng<"u"?function(e){return ng.resolve(null).then(e).catch(Rw)}:tg;function Rw(e){setTimeout(function(){throw e})}function cs(e){return e==="head"}function rg(e,r){var a=r,l=0;do{var f=a.nextSibling;if(e.removeChild(a),f&&f.nodeType===8)if(a=f.data,a==="/$"||a==="/&"){if(l===0){e.removeChild(f),Ii(r);return}l--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")l++;else if(a==="html")Ja(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,Ja(a);for(var y=a.firstChild;y;){var _=y.nextSibling,O=y.nodeName;y[Rt]||O==="SCRIPT"||O==="STYLE"||O==="LINK"&&y.rel.toLowerCase()==="stylesheet"||a.removeChild(y),y=_}}else a==="body"&&Ja(e.ownerDocument.body);a=f}while(a);Ii(r)}function sg(e,r){var a=e;e=0;do{var l=a.nextSibling;if(a.nodeType===1?r?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(r?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),l&&l.nodeType===8)if(a=l.data,a==="/$"){if(e===0)break;e--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||e++;a=l}while(a)}function Lh(e){var r=e.firstChild;for(r&&r.nodeType===10&&(r=r.nextSibling);r;){var a=r;switch(r=r.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":Lh(a),li(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function Dw(e,r,a,l){for(;e.nodeType===1;){var f=a;if(e.nodeName.toLowerCase()!==r.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[Rt])switch(r){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(y=e.getAttribute("rel"),y==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(y!==f.rel||e.getAttribute("href")!==(f.href==null||f.href===""?null:f.href)||e.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin)||e.getAttribute("title")!==(f.title==null?null:f.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(y=e.getAttribute("src"),(y!==(f.src==null?null:f.src)||e.getAttribute("type")!==(f.type==null?null:f.type)||e.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin))&&y&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(r==="input"&&e.type==="hidden"){var y=f.name==null?null:""+f.name;if(f.type==="hidden"&&e.getAttribute("name")===y)return e}else return e;if(e=Bn(e.nextSibling),e===null)break}return null}function Lw(e,r,a){if(r==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=Bn(e.nextSibling),e===null))return null;return e}function ig(e,r){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!r||(e=Bn(e.nextSibling),e===null))return null;return e}function qh(e){return e.data==="$?"||e.data==="$~"}function Ph(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function qw(e,r){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=r;else if(e.data!=="$?"||a.readyState!=="loading")r();else{var l=function(){r(),a.removeEventListener("DOMContentLoaded",l)};a.addEventListener("DOMContentLoaded",l),e._reactRetry=l}}function Bn(e){for(;e!=null;e=e.nextSibling){var r=e.nodeType;if(r===1||r===3)break;if(r===8){if(r=e.data,r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"||r==="F!"||r==="F")break;if(r==="/$"||r==="/&")return null}}return e}var Bh=null;function ag(e){e=e.nextSibling;for(var r=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(r===0)return Bn(e.nextSibling);r--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||r++}e=e.nextSibling}return null}function og(e){e=e.previousSibling;for(var r=0;e;){if(e.nodeType===8){var a=e.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(r===0)return e;r--}else a!=="/$"&&a!=="/&"||r++}e=e.previousSibling}return null}function lg(e,r,a){switch(r=Fl(a),e){case"html":if(e=r.documentElement,!e)throw Error(i(452));return e;case"head":if(e=r.head,!e)throw Error(i(453));return e;case"body":if(e=r.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function Ja(e){for(var r=e.attributes;r.length;)e.removeAttributeNode(r[0]);li(e)}var Un=new Map,cg=new Set;function Gl(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Mr=J.d;J.d={f:Pw,r:Bw,D:Uw,C:zw,L:Iw,m:$w,X:Fw,S:Hw,M:Gw};function Pw(){var e=Mr.f(),r=ql();return e||r}function Bw(e){var r=N(e);r!==null&&r.tag===5&&r.type==="form"?Ap(r):Mr.r(e)}var Bi=typeof document>"u"?null:document;function ug(e,r,a){var l=Bi;if(l&&typeof r=="string"&&r){var f=Cn(r);f='link[rel="'+e+'"][href="'+f+'"]',typeof a=="string"&&(f+='[crossorigin="'+a+'"]'),cg.has(f)||(cg.add(f),e={rel:e,crossOrigin:a,href:r},l.querySelector(f)===null&&(r=l.createElement("link"),Ht(r,"link",e),L(r),l.head.appendChild(r)))}}function Uw(e){Mr.D(e),ug("dns-prefetch",e,null)}function zw(e,r){Mr.C(e,r),ug("preconnect",e,r)}function Iw(e,r,a){Mr.L(e,r,a);var l=Bi;if(l&&e&&r){var f='link[rel="preload"][as="'+Cn(r)+'"]';r==="image"&&a&&a.imageSrcSet?(f+='[imagesrcset="'+Cn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(f+='[imagesizes="'+Cn(a.imageSizes)+'"]')):f+='[href="'+Cn(e)+'"]';var y=f;switch(r){case"style":y=Ui(e);break;case"script":y=zi(e)}Un.has(y)||(e=b({rel:"preload",href:r==="image"&&a&&a.imageSrcSet?void 0:e,as:r},a),Un.set(y,e),l.querySelector(f)!==null||r==="style"&&l.querySelector(Qa(y))||r==="script"&&l.querySelector(Xa(y))||(r=l.createElement("link"),Ht(r,"link",e),L(r),l.head.appendChild(r)))}}function $w(e,r){Mr.m(e,r);var a=Bi;if(a&&e){var l=r&&typeof r.as=="string"?r.as:"script",f='link[rel="modulepreload"][as="'+Cn(l)+'"][href="'+Cn(e)+'"]',y=f;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":y=zi(e)}if(!Un.has(y)&&(e=b({rel:"modulepreload",href:e},r),Un.set(y,e),a.querySelector(f)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Xa(y)))return}l=a.createElement("link"),Ht(l,"link",e),L(l),a.head.appendChild(l)}}}function Hw(e,r,a){Mr.S(e,r,a);var l=Bi;if(l&&e){var f=T(l).hoistableStyles,y=Ui(e);r=r||"default";var _=f.get(y);if(!_){var O={loading:0,preload:null};if(_=l.querySelector(Qa(y)))O.loading=5;else{e=b({rel:"stylesheet",href:e,"data-precedence":r},a),(a=Un.get(y))&&Uh(e,a);var R=_=l.createElement("link");L(R),Ht(R,"link",e),R._p=new Promise(function(V,Z){R.onload=V,R.onerror=Z}),R.addEventListener("load",function(){O.loading|=1}),R.addEventListener("error",function(){O.loading|=2}),O.loading|=4,Vl(_,r,l)}_={type:"stylesheet",instance:_,count:1,state:O},f.set(y,_)}}}function Fw(e,r){Mr.X(e,r);var a=Bi;if(a&&e){var l=T(a).hoistableScripts,f=zi(e),y=l.get(f);y||(y=a.querySelector(Xa(f)),y||(e=b({src:e,async:!0},r),(r=Un.get(f))&&zh(e,r),y=a.createElement("script"),L(y),Ht(y,"link",e),a.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},l.set(f,y))}}function Gw(e,r){Mr.M(e,r);var a=Bi;if(a&&e){var l=T(a).hoistableScripts,f=zi(e),y=l.get(f);y||(y=a.querySelector(Xa(f)),y||(e=b({src:e,async:!0,type:"module"},r),(r=Un.get(f))&&zh(e,r),y=a.createElement("script"),L(y),Ht(y,"link",e),a.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},l.set(f,y))}}function fg(e,r,a,l){var f=(f=Ct.current)?Gl(f):null;if(!f)throw Error(i(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(r=Ui(a.href),a=T(f).hoistableStyles,l=a.get(r),l||(l={type:"style",instance:null,count:0,state:null},a.set(r,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=Ui(a.href);var y=T(f).hoistableStyles,_=y.get(e);if(_||(f=f.ownerDocument||f,_={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},y.set(e,_),(y=f.querySelector(Qa(e)))&&!y._p&&(_.instance=y,_.state.loading=5),Un.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},Un.set(e,a),y||Vw(f,e,a,_.state))),r&&l===null)throw Error(i(528,""));return _}if(r&&l!==null)throw Error(i(529,""));return null;case"script":return r=a.async,a=a.src,typeof a=="string"&&r&&typeof r!="function"&&typeof r!="symbol"?(r=zi(a),a=T(f).hoistableScripts,l=a.get(r),l||(l={type:"script",instance:null,count:0,state:null},a.set(r,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Ui(e){return'href="'+Cn(e)+'"'}function Qa(e){return'link[rel="stylesheet"]['+e+"]"}function hg(e){return b({},e,{"data-precedence":e.precedence,precedence:null})}function Vw(e,r,a,l){e.querySelector('link[rel="preload"][as="style"]['+r+"]")?l.loading=1:(r=e.createElement("link"),l.preload=r,r.addEventListener("load",function(){return l.loading|=1}),r.addEventListener("error",function(){return l.loading|=2}),Ht(r,"link",a),L(r),e.head.appendChild(r))}function zi(e){return'[src="'+Cn(e)+'"]'}function Xa(e){return"script[async]"+e}function dg(e,r,a){if(r.count++,r.instance===null)switch(r.type){case"style":var l=e.querySelector('style[data-href~="'+Cn(a.href)+'"]');if(l)return r.instance=l,L(l),l;var f=b({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),L(l),Ht(l,"style",f),Vl(l,a.precedence,e),r.instance=l;case"stylesheet":f=Ui(a.href);var y=e.querySelector(Qa(f));if(y)return r.state.loading|=4,r.instance=y,L(y),y;l=hg(a),(f=Un.get(f))&&Uh(l,f),y=(e.ownerDocument||e).createElement("link"),L(y);var _=y;return _._p=new Promise(function(O,R){_.onload=O,_.onerror=R}),Ht(y,"link",l),r.state.loading|=4,Vl(y,a.precedence,e),r.instance=y;case"script":return y=zi(a.src),(f=e.querySelector(Xa(y)))?(r.instance=f,L(f),f):(l=a,(f=Un.get(y))&&(l=b({},a),zh(l,f)),e=e.ownerDocument||e,f=e.createElement("script"),L(f),Ht(f,"link",l),e.head.appendChild(f),r.instance=f);case"void":return null;default:throw Error(i(443,r.type))}else r.type==="stylesheet"&&(r.state.loading&4)===0&&(l=r.instance,r.state.loading|=4,Vl(l,a.precedence,e));return r.instance}function Vl(e,r,a){for(var l=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),f=l.length?l[l.length-1]:null,y=f,_=0;_<l.length;_++){var O=l[_];if(O.dataset.precedence===r)y=O;else if(y!==f)break}y?y.parentNode.insertBefore(e,y.nextSibling):(r=a.nodeType===9?a.head:a,r.insertBefore(e,r.firstChild))}function Uh(e,r){e.crossOrigin==null&&(e.crossOrigin=r.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=r.referrerPolicy),e.title==null&&(e.title=r.title)}function zh(e,r){e.crossOrigin==null&&(e.crossOrigin=r.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=r.referrerPolicy),e.integrity==null&&(e.integrity=r.integrity)}var Yl=null;function mg(e,r,a){if(Yl===null){var l=new Map,f=Yl=new Map;f.set(a,l)}else f=Yl,l=f.get(a),l||(l=new Map,f.set(a,l));if(l.has(e))return l;for(l.set(e,null),a=a.getElementsByTagName(e),f=0;f<a.length;f++){var y=a[f];if(!(y[Rt]||y[at]||e==="link"&&y.getAttribute("rel")==="stylesheet")&&y.namespaceURI!=="http://www.w3.org/2000/svg"){var _=y.getAttribute(r)||"";_=e+_;var O=l.get(_);O?O.push(y):l.set(_,[y])}}return l}function pg(e,r,a){e=e.ownerDocument||e,e.head.insertBefore(a,r==="title"?e.querySelector("head > title"):null)}function Yw(e,r,a){if(a===1||r.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof r.precedence!="string"||typeof r.href!="string"||r.href==="")break;return!0;case"link":if(typeof r.rel!="string"||typeof r.href!="string"||r.href===""||r.onLoad||r.onError)break;switch(r.rel){case"stylesheet":return e=r.disabled,typeof r.precedence=="string"&&e==null;default:return!0}case"script":if(r.async&&typeof r.async!="function"&&typeof r.async!="symbol"&&!r.onLoad&&!r.onError&&r.src&&typeof r.src=="string")return!0}return!1}function yg(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Kw(e,r,a,l){if(a.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var f=Ui(l.href),y=r.querySelector(Qa(f));if(y){r=y._p,r!==null&&typeof r=="object"&&typeof r.then=="function"&&(e.count++,e=Kl.bind(e),r.then(e,e)),a.state.loading|=4,a.instance=y,L(y);return}y=r.ownerDocument||r,l=hg(l),(f=Un.get(f))&&Uh(l,f),y=y.createElement("link"),L(y);var _=y;_._p=new Promise(function(O,R){_.onload=O,_.onerror=R}),Ht(y,"link",l),a.instance=y}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,r),(r=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=Kl.bind(e),r.addEventListener("load",a),r.addEventListener("error",a))}}var Ih=0;function Jw(e,r){return e.stylesheets&&e.count===0&&Ql(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var l=setTimeout(function(){if(e.stylesheets&&Ql(e,e.stylesheets),e.unsuspend){var y=e.unsuspend;e.unsuspend=null,y()}},6e4+r);0<e.imgBytes&&Ih===0&&(Ih=62500*Nw());var f=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Ql(e,e.stylesheets),e.unsuspend)){var y=e.unsuspend;e.unsuspend=null,y()}},(e.imgBytes>Ih?50:800)+r);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(f)}}:null}function Kl(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Ql(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Jl=null;function Ql(e,r){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Jl=new Map,r.forEach(Qw,e),Jl=null,Kl.call(e))}function Qw(e,r){if(!(r.state.loading&4)){var a=Jl.get(e);if(a)var l=a.get(null);else{a=new Map,Jl.set(e,a);for(var f=e.querySelectorAll("link[data-precedence],style[data-precedence]"),y=0;y<f.length;y++){var _=f[y];(_.nodeName==="LINK"||_.getAttribute("media")!=="not all")&&(a.set(_.dataset.precedence,_),l=_)}l&&a.set(null,l)}f=r.instance,_=f.getAttribute("data-precedence"),y=a.get(_)||l,y===l&&a.set(null,f),a.set(_,f),this.count++,l=Kl.bind(this),f.addEventListener("load",l),f.addEventListener("error",l),y?y.parentNode.insertBefore(f,y.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(f,e.firstChild)),r.state.loading|=4}}var Wa={$$typeof:re,Provider:null,Consumer:null,_currentValue:le,_currentValue2:le,_threadCount:0};function Xw(e,r,a,l,f,y,_,O,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=$r(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=$r(0),this.hiddenUpdates=$r(null),this.identifierPrefix=l,this.onUncaughtError=f,this.onCaughtError=y,this.onRecoverableError=_,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=R,this.incompleteTransitions=new Map}function gg(e,r,a,l,f,y,_,O,R,V,Z,ie){return e=new Xw(e,r,a,_,R,V,Z,ie,O),r=1,y===!0&&(r|=24),y=dn(3,null,null,r),e.current=y,y.stateNode=e,r=vf(),r.refCount++,e.pooledCache=r,r.refCount++,y.memoizedState={element:l,isDehydrated:a,cache:r},Ef(y),e}function bg(e){return e?(e=gi,e):gi}function xg(e,r,a,l,f,y){f=bg(f),l.context===null?l.context=f:l.pendingContext=f,l=Wr(r),l.payload={element:a},y=y===void 0?null:y,y!==null&&(l.callback=y),a=Zr(e,l,r),a!==null&&(ln(a,e,r),Ta(a,e,r))}function vg(e,r){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<r?a:r}}function $h(e,r){vg(e,r),(e=e.alternate)&&vg(e,r)}function _g(e){if(e.tag===13||e.tag===31){var r=Ps(e,67108864);r!==null&&ln(r,e,67108864),$h(e,67108864)}}function wg(e){if(e.tag===13||e.tag===31){var r=bn();r=mr(r);var a=Ps(e,r);a!==null&&ln(a,e,r),$h(e,r)}}var Xl=!0;function Ww(e,r,a,l){var f=F.T;F.T=null;var y=J.p;try{J.p=2,Hh(e,r,a,l)}finally{J.p=y,F.T=f}}function Zw(e,r,a,l){var f=F.T;F.T=null;var y=J.p;try{J.p=8,Hh(e,r,a,l)}finally{J.p=y,F.T=f}}function Hh(e,r,a,l){if(Xl){var f=Fh(l);if(f===null)Nh(e,r,l,Wl,a),Eg(e,l);else if(tS(f,e,r,a,l))l.stopPropagation();else if(Eg(e,l),r&4&&-1<eS.indexOf(e)){for(;f!==null;){var y=N(f);if(y!==null)switch(y.tag){case 3:if(y=y.stateNode,y.current.memoizedState.isDehydrated){var _=Hn(y.pendingLanes);if(_!==0){var O=y;for(O.pendingLanes|=2,O.entangledLanes|=2;_;){var R=1<<31-Ft(_);O.entanglements[1]|=R,_&=~R}ir(y),(Qe&6)===0&&(Dl=ft()+500,Va(0))}}break;case 31:case 13:O=Ps(y,2),O!==null&&ln(O,y,2),ql(),$h(y,2)}if(y=Fh(l),y===null&&Nh(e,r,l,Wl,a),y===f)break;f=y}f!==null&&l.stopPropagation()}else Nh(e,r,l,null,a)}}function Fh(e){return e=Gu(e),Gh(e)}var Wl=null;function Gh(e){if(Wl=null,e=A(e),e!==null){var r=c(e);if(r===null)e=null;else{var a=r.tag;if(a===13){if(e=m(r),e!==null)return e;e=null}else if(a===31){if(e=p(r),e!==null)return e;e=null}else if(a===3){if(r.stateNode.current.memoizedState.isDehydrated)return r.tag===3?r.stateNode.containerInfo:null;e=null}else r!==e&&(e=null)}}return Wl=e,null}function Sg(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(Pu()){case Io:return 2;case $o:return 8;case ii:case Bu:return 32;case Ho:return 268435456;default:return 32}default:return 32}}var Vh=!1,us=null,fs=null,hs=null,Za=new Map,eo=new Map,ds=[],eS="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 Eg(e,r){switch(e){case"focusin":case"focusout":us=null;break;case"dragenter":case"dragleave":fs=null;break;case"mouseover":case"mouseout":hs=null;break;case"pointerover":case"pointerout":Za.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":eo.delete(r.pointerId)}}function to(e,r,a,l,f,y){return e===null||e.nativeEvent!==y?(e={blockedOn:r,domEventName:a,eventSystemFlags:l,nativeEvent:y,targetContainers:[f]},r!==null&&(r=N(r),r!==null&&_g(r)),e):(e.eventSystemFlags|=l,r=e.targetContainers,f!==null&&r.indexOf(f)===-1&&r.push(f),e)}function tS(e,r,a,l,f){switch(r){case"focusin":return us=to(us,e,r,a,l,f),!0;case"dragenter":return fs=to(fs,e,r,a,l,f),!0;case"mouseover":return hs=to(hs,e,r,a,l,f),!0;case"pointerover":var y=f.pointerId;return Za.set(y,to(Za.get(y)||null,e,r,a,l,f)),!0;case"gotpointercapture":return y=f.pointerId,eo.set(y,to(eo.get(y)||null,e,r,a,l,f)),!0}return!1}function Og(e){var r=A(e.target);if(r!==null){var a=c(r);if(a!==null){if(r=a.tag,r===13){if(r=m(a),r!==null){e.blockedOn=r,Go(e.priority,function(){wg(a)});return}}else if(r===31){if(r=p(a),r!==null){e.blockedOn=r,Go(e.priority,function(){wg(a)});return}}else if(r===3&&a.stateNode.current.memoizedState.isDehydrated){e.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Zl(e){if(e.blockedOn!==null)return!1;for(var r=e.targetContainers;0<r.length;){var a=Fh(e.nativeEvent);if(a===null){a=e.nativeEvent;var l=new a.constructor(a.type,a);Fu=l,a.target.dispatchEvent(l),Fu=null}else return r=N(a),r!==null&&_g(r),e.blockedOn=a,!1;r.shift()}return!0}function Ag(e,r,a){Zl(e)&&a.delete(r)}function nS(){Vh=!1,us!==null&&Zl(us)&&(us=null),fs!==null&&Zl(fs)&&(fs=null),hs!==null&&Zl(hs)&&(hs=null),Za.forEach(Ag),eo.forEach(Ag)}function ec(e,r){e.blockedOn===r&&(e.blockedOn=null,Vh||(Vh=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,nS)))}var tc=null;function jg(e){tc!==e&&(tc=e,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){tc===e&&(tc=null);for(var r=0;r<e.length;r+=3){var a=e[r],l=e[r+1],f=e[r+2];if(typeof l!="function"){if(Gh(l||a)===null)continue;break}var y=N(a);y!==null&&(e.splice(r,3),r-=3,Ff(y,{pending:!0,data:f,method:a.method,action:l},l,f))}}))}function Ii(e){function r(R){return ec(R,e)}us!==null&&ec(us,e),fs!==null&&ec(fs,e),hs!==null&&ec(hs,e),Za.forEach(r),eo.forEach(r);for(var a=0;a<ds.length;a++){var l=ds[a];l.blockedOn===e&&(l.blockedOn=null)}for(;0<ds.length&&(a=ds[0],a.blockedOn===null);)Og(a),a.blockedOn===null&&ds.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(l=0;l<a.length;l+=3){var f=a[l],y=a[l+1],_=f[gt]||null;if(typeof y=="function")_||jg(a);else if(_){var O=null;if(y&&y.hasAttribute("formAction")){if(f=y,_=y[gt]||null)O=_.formAction;else if(Gh(f)!==null)continue}else O=_.action;typeof O=="function"?a[l+1]=O:(a.splice(l,3),l-=3),jg(a)}}}function kg(){function e(y){y.canIntercept&&y.info==="react-transition"&&y.intercept({handler:function(){return new Promise(function(_){return f=_})},focusReset:"manual",scroll:"manual"})}function r(){f!==null&&(f(),f=null),l||setTimeout(a,20)}function a(){if(!l&&!navigation.transition){var y=navigation.currentEntry;y&&y.url!=null&&navigation.navigate(y.url,{state:y.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,f=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",r),navigation.addEventListener("navigateerror",r),setTimeout(a,100),function(){l=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",r),navigation.removeEventListener("navigateerror",r),f!==null&&(f(),f=null)}}}function Yh(e){this._internalRoot=e}nc.prototype.render=Yh.prototype.render=function(e){var r=this._internalRoot;if(r===null)throw Error(i(409));var a=r.current,l=bn();xg(a,l,e,r,null,null)},nc.prototype.unmount=Yh.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var r=e.containerInfo;xg(e.current,2,null,e,null,null),ql(),r[fn]=null}};function nc(e){this._internalRoot=e}nc.prototype.unstable_scheduleHydration=function(e){if(e){var r=da();e={blockedOn:null,target:e,priority:r};for(var a=0;a<ds.length&&r!==0&&r<ds[a].priority;a++);ds.splice(a,0,e),a===0&&Og(e)}};var Ng=t.version;if(Ng!=="19.2.4")throw Error(i(527,Ng,"19.2.4"));J.findDOMNode=function(e){var r=e._reactInternals;if(r===void 0)throw typeof e.render=="function"?Error(i(188)):(e=Object.keys(e).join(","),Error(i(268,e)));return e=u(r),e=e!==null?d(e):null,e=e===null?null:e.stateNode,e};var rS={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:F,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var rc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!rc.isDisabled&&rc.supportsFiber)try{ks=rc.inject(rS),_t=rc}catch{}}return no.createRoot=function(e,r){if(!o(e))throw Error(i(299));var a=!1,l="",f=qp,y=Pp,_=Bp;return r!=null&&(r.unstable_strictMode===!0&&(a=!0),r.identifierPrefix!==void 0&&(l=r.identifierPrefix),r.onUncaughtError!==void 0&&(f=r.onUncaughtError),r.onCaughtError!==void 0&&(y=r.onCaughtError),r.onRecoverableError!==void 0&&(_=r.onRecoverableError)),r=gg(e,1,!1,null,null,a,l,null,f,y,_,kg),e[fn]=r.current,kh(e),new Yh(r)},no.hydrateRoot=function(e,r,a){if(!o(e))throw Error(i(299));var l=!1,f="",y=qp,_=Pp,O=Bp,R=null;return a!=null&&(a.unstable_strictMode===!0&&(l=!0),a.identifierPrefix!==void 0&&(f=a.identifierPrefix),a.onUncaughtError!==void 0&&(y=a.onUncaughtError),a.onCaughtError!==void 0&&(_=a.onCaughtError),a.onRecoverableError!==void 0&&(O=a.onRecoverableError),a.formState!==void 0&&(R=a.formState)),r=gg(e,1,!0,r,a??null,l,f,R,y,_,O,kg),r.context=bg(null),a=r.current,l=bn(),l=mr(l),f=Wr(l),f.callback=null,Zr(a,f,l),a=l,r.current.lanes=a,Fn(r,a),ir(r),e[fn]=r.current,kh(e),new nc(r)},no.version="19.2.4",no}var qg;function YS(){if(qg)return Kh.exports;qg=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(t){console.error(t)}}return n(),Kh.exports=VS(),Kh.exports}var KS=YS();const JS="modulepreload",QS=function(n,t){return new URL(n,t).href},Pg={},ke=function(t,s,i){let o=Promise.resolve();if(s&&s.length>0){let m=function(d){return Promise.all(d.map(b=>Promise.resolve(b).then(x=>({status:"fulfilled",value:x}),x=>({status:"rejected",reason:x}))))};const p=document.getElementsByTagName("link"),g=document.querySelector("meta[property=csp-nonce]"),u=(g==null?void 0:g.nonce)||(g==null?void 0:g.getAttribute("nonce"));o=m(s.map(d=>{if(d=QS(d,i),d in Pg)return;Pg[d]=!0;const b=d.endsWith(".css"),x=b?'[rel="stylesheet"]':"";if(!!i)for(let S=p.length-1;S>=0;S--){const C=p[S];if(C.href===d&&(!b||C.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${d}"]${x}`))return;const w=document.createElement("link");if(w.rel=b?"stylesheet":JS,b||(w.as="script"),w.crossOrigin="",w.href=d,u&&w.setAttribute("nonce",u),document.head.appendChild(w),b)return new Promise((S,C)=>{w.addEventListener("load",S),w.addEventListener("error",()=>C(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 o.then(m=>{for(const p of m||[])p.status==="rejected"&&c(p.reason);return t().catch(c)})};function Eu(n){try{const t=n.split(".");if(t.length!==3)return null;const s=atob(t[1].replace(/-/g,"+").replace(/_/g,"/"));return JSON.parse(s)}catch{return null}}function dx(n){const t=Eu(n);return!t||typeof t.exp!="number"?null:t.exp}function am(n,t=0){const s=dx(n);return s===null?!0:Date.now()/1e3>=s-t}const Vt=window.__LT_BASE__??"",vd=`${Vt}/api`;class Bg extends Error{constructor(t,s,i){super(t),this.status=s,this.body=i,this.name="ApiError"}}let bs=null;function sc(n){bs=n}function _d(){return bs}const XS="X-LT-Acting-Token",WS="X-LT-Acting-Remaining";let eu=null,tu=null;function Ug(n){eu=n}let nu=null;function zg(n){nu=n}function Ig(n){tu=n}function ZS(n){const t=n==null?void 0:n.error;return typeof t=="string"&&/acting[- ]identity/i.test(t)}async function $g(){const n=sessionStorage.getItem("lt_credentials");if(!n)return null;try{const{username:t,password:s}=JSON.parse(n),i=await fetch(`${vd}/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:t,password:s})});if(!i.ok)return null;const o=await i.json();return o.token&&o.user&&sessionStorage.setItem("lt_user_info",JSON.stringify({displayName:o.user.display_name,username:o.user.external_id})),o.token??null}catch{return null}}let ps=null;async function ue(n,t={}){const s={"Content-Type":"application/json",...t.headers};if(bs){if(am(bs)){ps||(ps=$g().finally(()=>{ps=null}));const p=await ps;if(p)bs=p,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:p}}));else throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}s.Authorization=`Bearer ${bs}`}const o=(t.method??"GET").toUpperCase()==="GET"?null:(eu==null?void 0:eu())??null;o&&(s[XS]=o);let c=await fetch(`${vd}${n}`,{...t,headers:s});const m=o?c.headers.get(WS):null;if(o&&m!==null&&(nu==null||nu(o,m==="unbounded"?null:Number(m))),c.status===401&&o){const p=await c.clone().json().catch(()=>null);if(ZS(p))throw tu==null||tu(),new Bg(p.error,401,p)}if(c.status===401&&bs){ps||(ps=$g().finally(()=>{ps=null}));const p=await ps;if(p&&(bs=p,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:p}})),s.Authorization=`Bearer ${p}`,c=await fetch(`${vd}${n}`,{...t,headers:s})),c.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}else if(c.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired");if(!c.ok){const p=await c.json().catch(()=>({error:c.statusText}));throw new Bg(p.message||p.error||c.statusText,c.status,p)}return c.json()}const eE="lt_ai_override";let ic=null;function om(){return ic||(ic=fetch(`${Vt}/api/settings`).then(n=>{if(!n.ok)throw new Error(`settings ${n.status}`);return n.json()}).catch(n=>{throw ic=null,n})),ic}function tE(){try{if(localStorage.getItem(eE)==="off")return!1}catch{}return null}function er(){var s;const n=qe({queryKey:["settings"],queryFn:om,staleTime:1/0}),t=tE();return n.data&&t===!1&&((s=n.data.ai)!=null&&s.enabled)?{...n,data:{...n.data,ai:{enabled:!1}}}:n}function nE(n){var u,d,b;const{data:t}=er(),s=((u=t==null?void 0:t.auth)==null?void 0:u.ssoKeepaliveSeconds)??0,i=((d=t==null?void 0:t.auth)==null?void 0:d.ssoKeepaliveIdleTimeoutSeconds)??0,o=E.useRef(Date.now()),c=E.useRef(Date.now()),m=E.useRef(!1),g=!!n&&((b=Eu(n))==null?void 0:b.sso)===!0&&s>0;E.useEffect(()=>{if(!g)return;const x=()=>{o.current=Date.now()};window.addEventListener("pointerdown",x,{passive:!0}),window.addEventListener("keydown",x,{passive:!0}),window.addEventListener("wheel",x,{passive:!0});const v=async()=>{if(!m.current&&document.visibilityState==="visible"&&!(i>0&&Date.now()-o.current>i*1e3)){m.current=!0;try{const C=await fetch(`${Vt}/api/auth/sso`,{method:"POST"});if(C.status===401||C.status===403){window.dispatchEvent(new CustomEvent("auth:unauthorized"));return}if(!C.ok)return;const P=await C.json().catch(()=>null);P!=null&&P.token&&(c.current=Date.now(),window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:P.token}})))}catch{}finally{m.current=!1}}},w=setInterval(v,s*1e3),S=()=>{document.visibilityState==="visible"&&Date.now()-c.current>s*1e3&&v()};return document.addEventListener("visibilitychange",S),()=>{clearInterval(w),document.removeEventListener("visibilitychange",S),window.removeEventListener("pointerdown",x),window.removeEventListener("keydown",x),window.removeEventListener("wheel",x)}},[g,s,i])}const mx=E.createContext(null),rE=300;function Xh(n,t){if(am(n))return null;const s=Eu(n);if(!s)return null;const i=t??(()=>{try{const o=sessionStorage.getItem("lt_user_info");return o?JSON.parse(o):null}catch{return null}})();return{userId:s.userId,displayName:(i==null?void 0:i.displayName)??null,username:(i==null?void 0:i.username)??null,roles:s.roles??[]}}function sE({children:n}){const[t,s]=E.useState(()=>{const b=sessionStorage.getItem("lt_token");return b?am(b)?(sessionStorage.removeItem("lt_token"),null):(sc(b),Xh(b)):null}),i=E.useRef(void 0),o=E.useCallback(b=>{clearTimeout(i.current);const x=dx(b);if(!x)return;const v=(x-rE)*1e3-Date.now();v<=0||(i.current=setTimeout(async()=>{try{const w=Eu(b);if(w!=null&&w.sso){const se=await fetch(`${Vt}/api/auth/sso`,{method:"POST"});if(!se.ok)return;const M=await se.json();M.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:M.token}}));return}const S=sessionStorage.getItem("lt_credentials");if(!S)return;const{username:C,password:P}=JSON.parse(S),q=await fetch(`${Vt}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:C,password:P})});if(!q.ok)return;const re=await q.json();re.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:re.token}}))}catch{}},v))},[]),c=E.useCallback((b,x,v)=>{const w={displayName:(v==null?void 0:v.displayName)??null,username:(v==null?void 0:v.username)??(x==null?void 0:x.username)??null},S=Xh(b,w);S&&(sc(b),sessionStorage.setItem("lt_token",b),sessionStorage.setItem("lt_user_info",JSON.stringify(w)),x&&sessionStorage.setItem("lt_credentials",JSON.stringify(x)),s(S),o(b))},[o]),m=E.useCallback(()=>{clearTimeout(i.current);const b=sessionStorage.getItem("lt_sso_logout_url");sc(null),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info"),sessionStorage.removeItem("lt_sso_logout_url"),s(null),b&&(window.location.href=b)},[]);E.useEffect(()=>{const b=()=>m(),x=v=>{var C;const w=(C=v.detail)==null?void 0:C.token;if(!w)return;const S=Xh(w);S&&(sc(w),sessionStorage.setItem("lt_token",w),s(S),o(w))};return window.addEventListener("auth:unauthorized",b),window.addEventListener("auth:refreshed",x),()=>{window.removeEventListener("auth:unauthorized",b),window.removeEventListener("auth:refreshed",x)}},[m,o]),E.useEffect(()=>{const b=sessionStorage.getItem("lt_token");return b&&t&&o(b),()=>clearTimeout(i.current)},[]);const p=(t==null?void 0:t.roles.some(b=>b.type==="superadmin"))??!1,g=E.useCallback(b=>(t==null?void 0:t.roles.some(x=>x.role===b))??!1,[t]),u=E.useCallback(b=>(t==null?void 0:t.roles.some(x=>x.type===b))??!1,[t]),d=(t==null?void 0:t.roles.map(b=>b.role))??[];return h.jsxs(mx.Provider,{value:{user:t,isAuthenticated:!!t,isSuperAdmin:p,login:c,logout:m,hasRole:g,hasRoleType:u,userRoleNames:d},children:[h.jsx(iE,{authenticated:t!==null}),n]})}function iE({authenticated:n}){return nE(n?sessionStorage.getItem("lt_token"):null),null}function qt(){const n=E.useContext(mx);if(!n)throw new Error("useAuth must be used within AuthProvider");return n}async function aE(n){if(!_d())return{kind:"session-ended"};try{const t=await ue("/nats-credentials"),s=t.natsWsUrl??n;return s?{kind:"ok",url:s,token:t.natsToken??null}:{kind:"unavailable"}}catch{return _d()?{kind:"unavailable"}:{kind:"session-ended"}}}const yo={initialDelayMs:1e3,maxDelayMs:6e4,noticeAfterMs:3e4,spreadMs:5e3};function oE(n,t,s=Math.random){const i=Math.min(t.maxDelayMs,t.initialDelayMs*2**Math.max(0,n));return Math.round(i/2+s()*(i/2))}function Hg(n,t=Math.random){return Math.round(t()*n.spreadMs)}function Fg(n){const t=(s,i)=>typeof s=="number"&&Number.isFinite(s)&&s>0?s:i;return{initialDelayMs:t(n==null?void 0:n.initialDelayMs,yo.initialDelayMs),maxDelayMs:t(n==null?void 0:n.maxDelayMs,yo.maxDelayMs),noticeAfterMs:t(n==null?void 0:n.noticeAfterMs,yo.noticeAfterMs),spreadMs:t(n==null?void 0:n.spreadMs,yo.spreadMs)}}const jn=new Uint8Array(0),ri=new TextEncoder,En=new TextDecoder;function lE(...n){let t=0;for(let o=0;o<n.length;o++)t+=n[o].length;const s=new Uint8Array(t);let i=0;for(let o=0;o<n.length;o++)s.set(n[o],i),i+=n[o].length;return s}function vo(...n){const t=[];for(let s=0;s<n.length;s++)t.push(ri.encode(n[s]));return t.length===0?jn:t.length===1?t[0]:lE(...t)}function Gg(n){return!n||n.length===0?"":En.decode(n)}const Vg="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",Yg=36,cE=0xcfd41b9100000,Kg=33,uE=333,Jg=22;function fE(n){for(let t=0;t<n.length;t++)n[t]=Math.floor(Math.random()*255)}function hE(n){var t;(t=globalThis==null?void 0:globalThis.crypto)!=null&&t.getRandomValues?globalThis.crypto.getRandomValues(n):fE(n)}class dE{constructor(){j(this,"buf");j(this,"seq");j(this,"inc");j(this,"inited");this.buf=new Uint8Array(Jg),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(Math.random()*cE),this.inc=Math.floor(Math.random()*(uE-Kg)+Kg)}setPre(){const t=new Uint8Array(12);hE(t);for(let s=0;s<12;s++){const i=t[s]%36;this.buf[s]=Vg.charCodeAt(i)}}fillSeq(){let t=this.seq;for(let s=Jg-1;s>=12;s--)this.buf[s]=Vg.charCodeAt(t%Yg),t=Math.floor(t/Yg)}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 Os=new dE;var Dr;(function(n){n.Disconnect="disconnect",n.Reconnect="reconnect",n.Update="update",n.LDM="ldm",n.Error="error"})(Dr||(Dr={}));var Ji;(function(n){n.Reconnecting="reconnecting",n.PingTimer="pingTimer",n.StaleConnection="staleConnection",n.ClientInitiatedReconnect="client initiated reconnect"})(Ji||(Ji={}));var fe;(function(n){n.ApiError="BAD API",n.BadAuthentication="BAD_AUTHENTICATION",n.BadCreds="BAD_CREDS",n.BadHeader="BAD_HEADER",n.BadJson="BAD_JSON",n.BadPayload="BAD_PAYLOAD",n.BadSubject="BAD_SUBJECT",n.Cancelled="CANCELLED",n.ConnectionClosed="CONNECTION_CLOSED",n.ConnectionDraining="CONNECTION_DRAINING",n.ConnectionRefused="CONNECTION_REFUSED",n.ConnectionTimeout="CONNECTION_TIMEOUT",n.Disconnect="DISCONNECT",n.InvalidOption="INVALID_OPTION",n.InvalidPayload="INVALID_PAYLOAD",n.MaxPayloadExceeded="MAX_PAYLOAD_EXCEEDED",n.NoResponders="503",n.NotFunction="NOT_FUNC",n.RequestError="REQUEST_ERROR",n.ServerOptionNotAvailable="SERVER_OPT_NA",n.SubClosed="SUB_CLOSED",n.SubDraining="SUB_DRAINING",n.Timeout="TIMEOUT",n.Tls="TLS",n.Unknown="UNKNOWN_ERROR",n.WssRequired="WSS_REQUIRED",n.JetStreamInvalidAck="JESTREAM_INVALID_ACK",n.JetStream404NoMessages="404",n.JetStream408RequestTimeout="408",n.JetStream409MaxAckPendingExceeded="409",n.JetStream409="409",n.JetStreamNotEnabled="503",n.JetStreamIdleHeartBeat="IDLE_HEARTBEAT",n.AuthorizationViolation="AUTHORIZATION_VIOLATION",n.AuthenticationExpired="AUTHENTICATION_EXPIRED",n.ProtocolError="NATS_PROTOCOL_ERR",n.PermissionsViolation="PERMISSIONS_VIOLATION",n.AuthenticationTimeout="AUTHENTICATION_TIMEOUT",n.AccountExpired="ACCOUNT_EXPIRED"})(fe||(fe={}));function mE(n){return typeof n.code=="string"}class px{constructor(){j(this,"messages");this.messages=new Map,this.messages.set(fe.InvalidPayload,"Invalid payload type - payloads can be 'binary', 'string', or 'json'"),this.messages.set(fe.BadJson,"Bad JSON"),this.messages.set(fe.WssRequired,"TLS is required, therefore a secure websocket connection is also required")}static getMessage(t){return pE.getMessage(t)}getMessage(t){return this.messages.get(t)||t}}const pE=new px;class ge extends Error{constructor(s,i,o){super(s);j(this,"name");j(this,"message");j(this,"code");j(this,"permissionContext");j(this,"chainedError");j(this,"api_error");this.name="NatsError",this.message=s,this.code=i,this.chainedError=o}static errorForCode(s,i){const o=px.getMessage(s);return new ge(o,s,i)}isAuthError(){return this.code===fe.AuthenticationExpired||this.code===fe.AuthorizationViolation||this.code===fe.AccountExpired}isAuthTimeout(){return this.code===fe.AuthenticationTimeout}isPermissionError(){return this.code===fe.PermissionsViolation}isProtocolError(){return this.code===fe.ProtocolError}isJetStreamError(){return this.api_error!==void 0}jsError(){return this.api_error?this.api_error:null}}var _n;(function(n){n[n.Exact=0]="Exact",n[n.CanonicalMIME=1]="CanonicalMIME",n[n.IgnoreCase=2]="IgnoreCase"})(_n||(_n={}));var Wn;(function(n){n.Timer="timer",n.Count="count",n.JitterTimer="jitterTimer",n.SentinelMsg="sentinelMsg"})(Wn||(Wn={}));var _o;(function(n){n.STATS="io.nats.micro.v1.stats_response",n.INFO="io.nats.micro.v1.info_response",n.PING="io.nats.micro.v1.ping_response"})(_o||(_o={}));const uu="Nats-Service-Error",fu="Nats-Service-Error-Code";class hu extends Error{constructor(s,i){super(i);j(this,"code");this.code=s}static isServiceError(s){return hu.toServiceError(s)!==null}static toServiceError(s){var o,c;const i=((o=s==null?void 0:s.headers)==null?void 0:o.get(fu))||"";if(i!==""){const m=parseInt(i)||400,p=((c=s==null?void 0:s.headers)==null?void 0:c.get(uu))||"";return new hu(m,p.length?p:i)}return null}}function Lr(n=""){if(n=n||"_INBOX",typeof n!="string")throw new Error("prefix must be a string");return n.split(".").forEach(t=>{if(t==="*"||t===">")throw new Error(`inbox prefixes cannot have wildcards '${n}'`)}),`${n}.${Os.next()}`}const wd="127.0.0.1";var vs;(function(n){n.PING="PING",n.STATS="STATS",n.INFO="INFO"})(vs||(vs={}));function Ou(n,...t){for(let s=0;s<t.length;s++){const i=t[s];Object.keys(i).forEach(function(o){n[o]=i[o]})}return n}function ac(n){return En.decode(n).replace(/\n/g,"␊").replace(/\r/g,"␍")}function na(n,t=!0){const s=t?ge.errorForCode(fe.Timeout):null;let i,o;const c=new Promise((m,p)=>{i={cancel:()=>{o&&clearTimeout(o)}},o=setTimeout(()=>{p(s===null?ge.errorForCode(fe.Timeout):s)},n)});return Object.assign(c,i)}function ia(n=0){let t;const s=new Promise(i=>{const o=setTimeout(()=>{i()},n);t={cancel:()=>{o&&clearTimeout(o)}}});return Object.assign(s,t)}function mt(){let n={};const t=new Promise((s,i)=>{n={resolve:s,reject:i}});return Object.assign(t,n)}function yx(n){for(let t=n.length-1;t>0;t--){const s=Math.floor(Math.random()*(t+1));[n[t],n[s]]=[n[s],n[t]]}return n}function yE(n){return n===0?0:Math.floor(n/2+Math.random()*n)}function lm(n=[0,250,250,500,500,3e3,5e3]){Array.isArray(n)||(n=[0,250,250,500,500,3e3,5e3]);const t=n.length-1;return{backoff(s){return yE(s>t?n[t]:n[s])}}}function dt(n){return n*1e6}function cm(n){return Math.floor(n/1e6)}function Qg(n){let i=!0;const o=new Array(n.length);for(let c=0;c<n.length;c++){let m=n.charCodeAt(c);if(m===58||m<33||m>126)throw new ge(`'${n[c]}' is not a valid character for a header key`,fe.BadHeader);i&&97<=m&&m<=122?m-=32:!i&&65<=m&&m<=90&&(m+=32),o[c]=m,i=m==45}return String.fromCharCode(...o)}function Pr(n=0,t=""){if(n===0&&t!==""||n>0&&t==="")throw new Error("setting status requires both code and description");return new _s(n,t)}const Wh="NATS/1.0";class _s{constructor(t=0,s=""){j(this,"_code");j(this,"headers");j(this,"_description");this._code=t,this._description=s,this.headers=new Map}[Symbol.iterator](){return this.headers.entries()}size(){return this.headers.size}equals(t){if(t&&this.headers.size===t.headers.size&&this._code===t._code){for(const[s,i]of this.headers){const o=t.values(s);if(i.length!==o.length)return!1;const c=[...i].sort(),m=[...o].sort();for(let p=0;p<c.length;p++)if(c[p]!==m[p])return!1}return!0}return!1}static decode(t){const s=new _s,o=En.decode(t).split(`\r
27
+ `),c=o[0];if(c!==Wh){let m=c.replace(Wh,"").trim();if(m.length>0){s._code=parseInt(m,10),isNaN(s._code)&&(s._code=0);const p=s._code.toString();m=m.replace(p,""),s._description=m.trim()}}return o.length>=1&&o.slice(1).map(m=>{if(m){const p=m.indexOf(":");if(p>-1){const g=m.slice(0,p),u=m.slice(p+1).trim();s.append(g,u)}}}),s}toString(){if(this.headers.size===0&&this._code===0)return"";let t=Wh;this._code>0&&this._description!==""&&(t+=` ${this._code} ${this._description}`);for(const[s,i]of this.headers)for(let o=0;o<i.length;o++)t=`${t}\r
28
+ ${s}: ${i[o]}`;return`${t}\r
29
+ \r
30
+ `}encode(){return ri.encode(this.toString())}static validHeaderValue(t){if(/[\r\n]/.test(t))throw new ge("invalid header value - \\r and \\n are not allowed.",fe.BadHeader);return t.trim()}keys(){const t=[];for(const s of this.headers.keys())t.push(s);return t}findKeys(t,s=_n.Exact){const i=this.keys();switch(s){case _n.Exact:return i.filter(o=>o===t);case _n.CanonicalMIME:return t=Qg(t),i.filter(o=>o===t);default:{const o=t.toLowerCase();return i.filter(c=>o===c.toLowerCase())}}}get(t,s=_n.Exact){const i=this.findKeys(t,s);if(i.length){const o=this.headers.get(i[0]);if(o)return Array.isArray(o)?o[0]:o}return""}last(t,s=_n.Exact){const i=this.findKeys(t,s);if(i.length){const o=this.headers.get(i[0]);if(o)return Array.isArray(o)?o[o.length-1]:o}return""}has(t,s=_n.Exact){return this.findKeys(t,s).length>0}set(t,s,i=_n.Exact){this.delete(t,i),this.append(t,s,i)}append(t,s,i=_n.Exact){const o=Qg(t);i===_n.CanonicalMIME&&(t=o);const c=this.findKeys(t,i);t=c.length>0?c[0]:t;const m=_s.validHeaderValue(s);let p=this.headers.get(t);p||(p=[],this.headers.set(t,p)),p.push(m)}values(t,s=_n.Exact){const i=[];return this.findKeys(t,s).forEach(c=>{const m=this.headers.get(c);m&&i.push(...m)}),i}delete(t,s=_n.Exact){this.findKeys(t,s).forEach(o=>{this.headers.delete(o)})}get hasError(){return this._code>=300}get status(){return`${this._code} ${this._description}`.trim()}toRecord(){const t={};return this.keys().forEach(s=>{t[s]=this.values(s)}),t}get code(){return this._code}get description(){return this._description}static fromRecord(t){const s=new _s;for(const i in t)s.headers.set(i,t[i]);return s}}function Sd(){return{encode(n){return ri.encode(n)},decode(n){return En.decode(n)}}}function Zn(n){return{encode(t){try{return t===void 0&&(t=null),ri.encode(JSON.stringify(t))}catch(s){throw ge.errorForCode(fe.BadJson,s)}},decode(t){try{return JSON.parse(En.decode(t),n)}catch(s){throw ge.errorForCode(fe.BadJson,s)}}}}function gx(n){var t;return n&&n.data.length===0&&((t=n.headers)==null?void 0:t.code)===503?ge.errorForCode(fe.NoResponders):null}class um{constructor(t,s,i){j(this,"_headers");j(this,"_msg");j(this,"_rdata");j(this,"_reply");j(this,"_subject");j(this,"publisher");this._msg=t,this._rdata=s,this.publisher=i}get subject(){return this._subject?this._subject:(this._subject=En.decode(this._msg.subject),this._subject)}get reply(){return this._reply?this._reply:(this._reply=En.decode(this._msg.reply),this._reply)}get sid(){return this._msg.sid}get headers(){if(this._msg.hdr>-1&&!this._headers){const t=this._rdata.subarray(0,this._msg.hdr);this._headers=_s.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=jn,s){return this.reply?(this.publisher.publish(this.reply,t,s),!0):!1}size(){var o;const t=this._msg.subject.length,s=((o=this._msg.reply)==null?void 0:o.length)||0,i=this._msg.size===-1?0:this._msg.size;return t+s+i}json(t){return Zn(t).decode(this.data)}string(){return En.decode(this.data)}requestInfo(){var s;const t=(s=this.headers)==null?void 0:s.get("Nats-Request-Info");return t?JSON.parse(t,function(i,o){return(i==="start"||i==="stop")&&o!==""?new Date(Date.parse(o)):o}):null}}j(um,"jc");function Qi(n){return Au("durable",n)}function Jt(n){return Au("stream",n)}function Au(n,t=""){if(t==="")throw Error(`${n} name required`);return[".","*",">","/","\\"," "," ",`
31
+ `,"\r"].forEach(i=>{if(t.indexOf(i)!==-1){switch(i){case`
32
+ `:i="\\n";break;case"\r":i="\\r";break;case" ":i="\\t";break}throw Error(`invalid ${n} name - ${n} name cannot contain '${i}'`)}}),""}function go(n,t=""){if(t==="")throw Error(`${n} name required`);const s=gE(t);if(s.length)throw new Error(`invalid ${n} name - ${n} name ${s}`)}function gE(n=""){if(n==="")throw Error("name required");const t=/^[-\w]+$/g;if(n.match(t)===null){for(const i of n.split(""))if(i.match(t)===null)return`cannot contain '${i}'`}return""}function Ed(n){if(n.data.length>0)return!1;const t=n.headers;return t?t.code>=100&&t.code<200:!1}function Od(n){var t;return Ed(n)&&((t=n.headers)==null?void 0:t.description)==="Idle Heartbeat"}function bE(n,t,s){const i=Pr(n,t),o={hdr:1,sid:0,size:0},c=new um(o,jn,{});return c._headers=i,c._subject=s,c}function Xi(n){if(n.data.length!==0)return null;const t=n.headers;return t?bx(t.code,t.description):null}var In;(function(n){n.MaxBatchExceeded="exceeded maxrequestbatch of",n.MaxExpiresExceeded="exceeded maxrequestexpires of",n.MaxBytesExceeded="exceeded maxrequestmaxbytes of",n.MaxMessageSizeExceeded="message size exceeds maxbytes",n.PushConsumer="consumer is push based",n.MaxWaitingExceeded="exceeded maxwaiting",n.IdleHeartbeatMissed="idle heartbeats missed",n.ConsumerDeleted="consumer deleted"})(In||(In={}));function xE(n){return n.code!==fe.JetStream409?!1:[In.MaxBatchExceeded,In.MaxExpiresExceeded,In.MaxBytesExceeded,In.MaxMessageSizeExceeded,In.PushConsumer,In.IdleHeartbeatMissed,In.ConsumerDeleted].find(s=>n.message.indexOf(s)!==-1)!==void 0}function bx(n,t=""){if(n<300)return null;switch(t=t.toLowerCase(),n){case 404:return new ge(t,fe.JetStream404NoMessages);case 408:return new ge(t,fe.JetStream408RequestTimeout);case 409:{const s=t.startsWith(In.IdleHeartbeatMissed)?fe.JetStreamIdleHeartBeat:fe.JetStream409;return new ge(t,s)}case 503:return ge.errorForCode(fe.JetStreamNotEnabled,new Error(t));default:return t===""&&(t=fe.Unknown),new ge(t,`${n}`)}}class Ut{constructor(){j(this,"inflight");j(this,"processed");j(this,"received");j(this,"noIterator");j(this,"iterClosed");j(this,"done");j(this,"signal");j(this,"yields");j(this,"filtered");j(this,"pendingFiltered");j(this,"ingestionFilterFn");j(this,"protocolFilterFn");j(this,"dispatchedFn");j(this,"ctx");j(this,"_data");j(this,"err");j(this,"time");j(this,"yielding");this.inflight=0,this.filtered=0,this.pendingFiltered=0,this.processed=0,this.received=0,this.noIterator=!1,this.done=!1,this.signal=mt(),this.yields=[],this.iterClosed=mt(),this.time=0,this.yielding=!1}[Symbol.asyncIterator](){return this.iterate()}push(t){if(this.done)return;if(typeof t=="function"){this.yields.push(t),this.signal.resolve();return}const{ingest:s,protocol:i}=this.ingestionFilterFn?this.ingestionFilterFn(t,this.ctx||this):{ingest:!0,protocol:!1};s&&(i&&(this.filtered++,this.pendingFiltered++),this.yields.push(t),this.signal.resolve())}async*iterate(){if(this.noIterator)throw new ge("unsupported iterator",fe.ApiError);if(this.yielding)throw new ge("already yielding",fe.ApiError);this.yielding=!0;try{for(;;){if(this.yields.length===0&&await this.signal,this.err)throw this.err;const t=this.yields;this.inflight=t.length,this.yields=[];for(let s=0;s<t.length;s++){if(typeof t[s]=="function"){const o=t[s];try{o()}catch(c){throw c}if(this.err)throw this.err;continue}if(this.protocolFilterFn?this.protocolFilterFn(t[s]):!0){this.processed++;const o=Date.now();yield t[s],this.time=Date.now()-o,this.dispatchedFn&&t[s]&&this.dispatchedFn(t[s])}else this.pendingFiltered--;this.inflight--}if(this.done)break;this.yields.length===0&&(t.length=0,this.yields=t,this.signal=mt())}}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 fm{constructor(t,s,i={maxOut:2}){j(this,"interval");j(this,"maxOut");j(this,"cancelAfter");j(this,"timer");j(this,"autoCancelTimer");j(this,"last");j(this,"missed");j(this,"count");j(this,"callback");this.interval=t,this.maxOut=(i==null?void 0:i.maxOut)||2,this.cancelAfter=(i==null?void 0:i.cancelAfter)||0,this.last=Date.now(),this.missed=0,this.count=0,this.callback=s,this._schedule()}cancel(){this.autoCancelTimer&&clearTimeout(this.autoCancelTimer),this.timer&&clearInterval(this.timer),this.timer=0,this.autoCancelTimer=0,this.missed=0}work(){this.last=Date.now(),this.missed=0}_change(t,s=0,i=2){this.interval=t,this.maxOut=i,this.cancelAfter=s,this.restart()}restart(){this.cancel(),this._schedule()}_schedule(){this.cancelAfter>0&&(this.autoCancelTimer=setTimeout(()=>{this.cancel()},this.cancelAfter)),this.timer=setInterval(()=>{if(this.count++,Date.now()-this.last>this.interval&&this.missed++,this.missed>=this.maxOut)try{this.callback(this.missed)===!0&&this.cancel()}catch(t){console.log(t)}},this.interval)}}var Ad;(function(n){n.Limits="limits",n.Interest="interest",n.Workqueue="workqueue"})(Ad||(Ad={}));var Oo;(function(n){n.Old="old",n.New="new"})(Oo||(Oo={}));var jd;(function(n){n.File="file",n.Memory="memory"})(jd||(jd={}));var Et;(function(n){n.All="all",n.Last="last",n.New="new",n.StartSequence="by_start_sequence",n.StartTime="by_start_time",n.LastPerSubject="last_per_subject"})(Et||(Et={}));var Bt;(function(n){n.None="none",n.All="all",n.Explicit="explicit",n.NotSet=""})(Bt||(Bt={}));var ra;(function(n){n.Instant="instant",n.Original="original"})(ra||(ra={}));var As;(function(n){n.None="none",n.S2="s2"})(As||(As={}));var du;(function(n){n.CreateOrUpdate="",n.Update="update",n.Create="create"})(du||(du={}));function vE(n,t={}){return Object.assign({name:n,deliver_policy:Et.All,ack_policy:Bt.Explicit,ack_wait:dt(30*1e3),replay_policy:ra.Instant},t)}var Xg;(function(n){n.API="api_audit",n.StreamAction="stream_action",n.ConsumerAction="consumer_action",n.SnapshotCreate="snapshot_create",n.SnapshotComplete="snapshot_complete",n.RestoreCreate="restore_create",n.RestoreComplete="restore_complete",n.MaxDeliver="max_deliver",n.Terminated="terminated",n.Ack="consumer_ack",n.StreamLeaderElected="stream_leader_elected",n.StreamQuorumLost="stream_quorum_lost",n.ConsumerLeaderElected="consumer_leader_elected",n.ConsumerQuorumLost="consumer_quorum_lost"})(Xg||(Xg={}));var Wt;(function(n){n.StreamSourceHdr="Nats-Stream-Source",n.LastConsumerSeqHdr="Nats-Last-Consumer",n.LastStreamSeqHdr="Nats-Last-Stream",n.ConsumerStalledHdr="Nats-Consumer-Stalled",n.MessageSizeHdr="Nats-Msg-Size",n.RollupHdr="Nats-Rollup",n.RollupValueSubject="sub",n.RollupValueAll="all",n.PendingMessagesHdr="Nats-Pending-Messages",n.PendingBytesHdr="Nats-Pending-Bytes"})(Wt||(Wt={}));var Qn;(function(n){n.LastValue="",n.AllHistory="history",n.UpdatesOnly="updates"})(Qn||(Qn={}));var Ki;(function(n){n.Stream="Nats-Stream",n.Sequence="Nats-Sequence",n.TimeStamp="Nats-Time-Stamp",n.Subject="Nats-Subject"})(Ki||(Ki={}));var Wg;(function(n){n.Stream="Nats-Stream",n.Subject="Nats-Subject",n.Sequence="Nats-Sequence",n.LastSequence="Nats-Last-Sequence",n.Size="Nats-Msg-Size"})(Wg||(Wg={}));const wn="KV_";class _E{constructor(t){j(this,"config");j(this,"ordered");j(this,"mack");j(this,"stream");j(this,"callbackFn");j(this,"max");j(this,"qname");j(this,"isBind");j(this,"filters");this.stream="",this.mack=!1,this.ordered=!1,this.config=vE("",t||{})}getOpts(){var s;const t={};if(t.config=Object.assign({},this.config),t.config.filter_subject&&(this.filterSubject(t.config.filter_subject),t.config.filter_subject=void 0),t.config.filter_subjects&&((s=t.config.filter_subjects)==null||s.forEach(i=>{this.filterSubject(i)}),t.config.filter_subjects=void 0),t.mack=this.mack,t.stream=this.stream,t.callbackFn=this.callbackFn,t.max=this.max,t.queue=this.qname,t.ordered=this.ordered,t.config.ack_policy=t.ordered?Bt.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 Qi(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=Et.StartSequence,this.config.opt_start_seq=t,this}startTime(t){return this.config.deliver_policy=Et.StartTime,this.config.opt_start_time=t.toISOString(),this}deliverAll(){return this.config.deliver_policy=Et.All,this}deliverLastPerSubject(){return this.config.deliver_policy=Et.LastPerSubject,this}deliverLast(){return this.config.deliver_policy=Et.Last,this}deliverNew(){return this.config.deliver_policy=Et.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=Bt.None,this}ackAll(){return this.config.ack_policy=Bt.All,this}ackExplicit(){return this.config.ack_policy=Bt.Explicit,this}ackWait(t){return this.config.ack_wait=dt(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=ra.Instant,this}replayOriginal(){return this.config.replay_policy=ra.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=dt(t),this}flowControl(){return this.config.flow_control=!0,this}deliverGroup(t){return this.queue(t),this}manualAck(){return this.mack=!0,this}maxMessages(t){return this.max=t,this}callback(t){return this.callbackFn=t,this}queue(t){return this.qname=t,this.config.deliver_group=t,this}orderedConsumer(){return this.ordered=!0,this}bind(t,s){return this.stream=t,this.config.durable_name=s,this.isBind=!0,this}bindStream(t){return this.stream=t,this}inactiveEphemeralThreshold(t){return this.config.inactive_threshold=dt(t),this}maxPullBatch(t){return this.config.max_batch=t,this}maxPullRequestExpires(t){return this.config.max_expires=dt(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 ws(n){return new _E(n)}function Zg(n){return typeof n.getOpts=="function"}class wE{static encode(t){if(typeof t=="string")return btoa(t);const s=Array.from(t);return btoa(String.fromCharCode(...s))}static decode(t,s=!1){const i=atob(t);return s?Uint8Array.from(i,o=>o.charCodeAt(0)):i}}class Wi{static encode(t){return Wi.toB64URLEncoding(wE.encode(t))}static decode(t,s=!1){return Wi.decode(Wi.fromB64URLEncoding(t),s)}static toB64URLEncoding(t){return t.replace(/\+/g,"-").replace(/\//g,"_")}static fromB64URLEncoding(t){return t.replace(/_/g,"/").replace(/-/g,"+")}}class sa{constructor(){j(this,"buffers");j(this,"byteLength");this.buffers=[],this.byteLength=0}static concat(...t){let s=0;for(let c=0;c<t.length;c++)s+=t[c].length;const i=new Uint8Array(s);let o=0;for(let c=0;c<t.length;c++)i.set(t[c],o),o+=t[c].length;return i}static fromAscii(t){return t||(t=""),ri.encode(t)}static toAscii(t){return En.decode(t)}reset(){this.buffers.length=0,this.byteLength=0}pack(){if(this.buffers.length>1){const t=new Uint8Array(this.byteLength);let s=0;for(let i=0;i<this.buffers.length;i++)t.set(this.buffers[i],s),s+=this.buffers[i].length;this.buffers.length=0,this.buffers.push(t)}}shift(){if(this.buffers.length){const t=this.buffers.shift();if(t)return this.byteLength-=t.length,t}return new Uint8Array(0)}drain(t){if(this.buffers.length){this.pack();const s=this.buffers.pop();if(s){const i=this.byteLength;(t===void 0||t>i)&&(t=i);const o=s.subarray(0,t);return i>t&&this.buffers.push(s.subarray(t)),this.byteLength=i-t,o}}return new Uint8Array(0)}fill(t,...s){t&&(this.buffers.push(t),this.byteLength+=t.length);for(let i=0;i<s.length;i++)s[i]&&s[i].length&&(this.buffers.push(s[i]),this.byteLength+=s[i].length)}peek(){return this.buffers.length?(this.pack(),this.buffers[0]):new Uint8Array(0)}size(){return this.byteLength}length(){return this.buffers.length}}function SE(n,t){return t.forEach(function(s){s&&typeof s!="string"&&!Array.isArray(s)&&Object.keys(s).forEach(function(i){if(i!=="default"&&!(i in n)){var o=Object.getOwnPropertyDescriptor(s,i);Object.defineProperty(n,i,o.get?o:{enumerable:!0,get:function(){return s[i]}})}})}),Object.freeze(n)}var EE=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},ro=EE.performance||{};ro.now||ro.mozNow||ro.msNow||ro.oNow||ro.webkitNow;var eb={versions:{}},OE=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function AE(n){if(n.__esModule)return n;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(n).forEach(function(s){var i=Object.getOwnPropertyDescriptor(n,s);Object.defineProperty(t,s,i.get?i:{enumerable:!0,get:function(){return n[s]}})}),t}var Zh,ju={exports:{}},tb={},nb=AE(SE({__proto__:null,default:tb},[tb]));Zh=ju,(function(){var n="input is invalid type",t=typeof window=="object",s=t?window:{};s.JS_SHA256_NO_WINDOW&&(t=!1);var i=!t&&typeof self=="object",o=!s.JS_SHA256_NO_NODE_JS&&eb.versions&&eb.versions.node;o?s=OE:i&&(s=self);var c=!s.JS_SHA256_NO_COMMON_JS&&Zh.exports,m=!s.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",p="0123456789abcdef".split(""),g=[-2147483648,8388608,32768,128],u=[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"],x=[];!s.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(M){return Object.prototype.toString.call(M)==="[object Array]"}),!m||!s.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(M){return typeof M=="object"&&M.buffer&&M.buffer.constructor===ArrayBuffer});var v=function(M,U){return function(ae){return new q(U,!0).update(ae)[M]()}},w=function(M){var U=v("hex",M);o&&(U=S(U,M)),U.create=function(){return new q(M)},U.update=function(I){return U.create().update(I)};for(var ae=0;ae<b.length;++ae){var z=b[ae];U[z]=v(z,M)}return U},S=function(M,U){var ae,z=nb,I=nb.Buffer,D=U?"sha224":"sha256";return ae=I.from&&!s.JS_SHA256_NO_BUFFER_FROM?I.from:function(X){return new I(X)},function(X){if(typeof X=="string")return z.createHash(D).update(X,"utf8").digest("hex");if(X==null)throw new Error(n);return X.constructor===ArrayBuffer&&(X=new Uint8Array(X)),Array.isArray(X)||ArrayBuffer.isView(X)||X.constructor===I?z.createHash(D).update(ae(X)).digest("hex"):M(X)}},C=function(M,U){return function(ae,z){return new re(ae,U,!0).update(z)[M]()}},P=function(M){var U=C("hex",M);U.create=function(I){return new re(I,M)},U.update=function(I,D){return U.create(I).update(D)};for(var ae=0;ae<b.length;++ae){var z=b[ae];U[z]=C(z,M)}return U};function q(M,U){U?(x[0]=x[16]=x[1]=x[2]=x[3]=x[4]=x[5]=x[6]=x[7]=x[8]=x[9]=x[10]=x[11]=x[12]=x[13]=x[14]=x[15]=0,this.blocks=x):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],M?(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=M}function re(M,U,ae){var z,I=typeof M;if(I==="string"){var D,X=[],W=M.length,he=0;for(z=0;z<W;++z)(D=M.charCodeAt(z))<128?X[he++]=D:D<2048?(X[he++]=192|D>>>6,X[he++]=128|63&D):D<55296||D>=57344?(X[he++]=224|D>>>12,X[he++]=128|D>>>6&63,X[he++]=128|63&D):(D=65536+((1023&D)<<10|1023&M.charCodeAt(++z)),X[he++]=240|D>>>18,X[he++]=128|D>>>12&63,X[he++]=128|D>>>6&63,X[he++]=128|63&D);M=X}else{if(I!=="object")throw new Error(n);if(M===null)throw new Error(n);if(m&&M.constructor===ArrayBuffer)M=new Uint8Array(M);else if(!(Array.isArray(M)||m&&ArrayBuffer.isView(M)))throw new Error(n)}M.length>64&&(M=new q(U,!0).update(M).array());var we=[],Oe=[];for(z=0;z<64;++z){var F=M[z]||0;we[z]=92^F,Oe[z]=54^F}q.call(this,U,ae),this.update(Oe),this.oKeyPad=we,this.inner=!0,this.sharedMemory=ae}q.prototype.update=function(M){if(!this.finalized){var U,ae=typeof M;if(ae!=="string"){if(ae!=="object")throw new Error(n);if(M===null)throw new Error(n);if(m&&M.constructor===ArrayBuffer)M=new Uint8Array(M);else if(!(Array.isArray(M)||m&&ArrayBuffer.isView(M)))throw new Error(n);U=!0}for(var z,I,D=0,X=M.length,W=this.blocks;D<X;){if(this.hashed&&(this.hashed=!1,W[0]=this.block,this.block=W[16]=W[1]=W[2]=W[3]=W[4]=W[5]=W[6]=W[7]=W[8]=W[9]=W[10]=W[11]=W[12]=W[13]=W[14]=W[15]=0),U)for(I=this.start;D<X&&I<64;++D)W[I>>>2]|=M[D]<<u[3&I++];else for(I=this.start;D<X&&I<64;++D)(z=M.charCodeAt(D))<128?W[I>>>2]|=z<<u[3&I++]:z<2048?(W[I>>>2]|=(192|z>>>6)<<u[3&I++],W[I>>>2]|=(128|63&z)<<u[3&I++]):z<55296||z>=57344?(W[I>>>2]|=(224|z>>>12)<<u[3&I++],W[I>>>2]|=(128|z>>>6&63)<<u[3&I++],W[I>>>2]|=(128|63&z)<<u[3&I++]):(z=65536+((1023&z)<<10|1023&M.charCodeAt(++D)),W[I>>>2]|=(240|z>>>18)<<u[3&I++],W[I>>>2]|=(128|z>>>12&63)<<u[3&I++],W[I>>>2]|=(128|z>>>6&63)<<u[3&I++],W[I>>>2]|=(128|63&z)<<u[3&I++]);this.lastByteIndex=I,this.bytes+=I-this.start,I>=64?(this.block=W[16],this.start=I-64,this.hash(),this.hashed=!0):this.start=I}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},q.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var M=this.blocks,U=this.lastByteIndex;M[16]=this.block,M[U>>>2]|=g[3&U],this.block=M[16],U>=56&&(this.hashed||this.hash(),M[0]=this.block,M[16]=M[1]=M[2]=M[3]=M[4]=M[5]=M[6]=M[7]=M[8]=M[9]=M[10]=M[11]=M[12]=M[13]=M[14]=M[15]=0),M[14]=this.hBytes<<3|this.bytes>>>29,M[15]=this.bytes<<3,this.hash()}},q.prototype.hash=function(){var M,U,ae,z,I,D,X,W,he,we=this.h0,Oe=this.h1,F=this.h2,J=this.h3,le=this.h4,pe=this.h5,ye=this.h6,Ce=this.h7,Ne=this.blocks;for(M=16;M<64;++M)U=((I=Ne[M-15])>>>7|I<<25)^(I>>>18|I<<14)^I>>>3,ae=((I=Ne[M-2])>>>17|I<<15)^(I>>>19|I<<13)^I>>>10,Ne[M]=Ne[M-16]+U+Ne[M-7]+ae|0;for(he=Oe&F,M=0;M<64;M+=4)this.first?(this.is224?(D=300032,Ce=(I=Ne[0]-1413257819)-150054599|0,J=I+24177077|0):(D=704751109,Ce=(I=Ne[0]-210244248)-1521486534|0,J=I+143694565|0),this.first=!1):(U=(we>>>2|we<<30)^(we>>>13|we<<19)^(we>>>22|we<<10),z=(D=we&Oe)^we&F^he,Ce=J+(I=Ce+(ae=(le>>>6|le<<26)^(le>>>11|le<<21)^(le>>>25|le<<7))+(le&pe^~le&ye)+d[M]+Ne[M])|0,J=I+(U+z)|0),U=(J>>>2|J<<30)^(J>>>13|J<<19)^(J>>>22|J<<10),z=(X=J&we)^J&Oe^D,ye=F+(I=ye+(ae=(Ce>>>6|Ce<<26)^(Ce>>>11|Ce<<21)^(Ce>>>25|Ce<<7))+(Ce&le^~Ce&pe)+d[M+1]+Ne[M+1])|0,U=((F=I+(U+z)|0)>>>2|F<<30)^(F>>>13|F<<19)^(F>>>22|F<<10),z=(W=F&J)^F&we^X,pe=Oe+(I=pe+(ae=(ye>>>6|ye<<26)^(ye>>>11|ye<<21)^(ye>>>25|ye<<7))+(ye&Ce^~ye&le)+d[M+2]+Ne[M+2])|0,U=((Oe=I+(U+z)|0)>>>2|Oe<<30)^(Oe>>>13|Oe<<19)^(Oe>>>22|Oe<<10),z=(he=Oe&F)^Oe&J^W,le=we+(I=le+(ae=(pe>>>6|pe<<26)^(pe>>>11|pe<<21)^(pe>>>25|pe<<7))+(pe&ye^~pe&Ce)+d[M+3]+Ne[M+3])|0,we=I+(U+z)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+we|0,this.h1=this.h1+Oe|0,this.h2=this.h2+F|0,this.h3=this.h3+J|0,this.h4=this.h4+le|0,this.h5=this.h5+pe|0,this.h6=this.h6+ye|0,this.h7=this.h7+Ce|0},q.prototype.hex=function(){this.finalize();var M=this.h0,U=this.h1,ae=this.h2,z=this.h3,I=this.h4,D=this.h5,X=this.h6,W=this.h7,he=p[M>>>28&15]+p[M>>>24&15]+p[M>>>20&15]+p[M>>>16&15]+p[M>>>12&15]+p[M>>>8&15]+p[M>>>4&15]+p[15&M]+p[U>>>28&15]+p[U>>>24&15]+p[U>>>20&15]+p[U>>>16&15]+p[U>>>12&15]+p[U>>>8&15]+p[U>>>4&15]+p[15&U]+p[ae>>>28&15]+p[ae>>>24&15]+p[ae>>>20&15]+p[ae>>>16&15]+p[ae>>>12&15]+p[ae>>>8&15]+p[ae>>>4&15]+p[15&ae]+p[z>>>28&15]+p[z>>>24&15]+p[z>>>20&15]+p[z>>>16&15]+p[z>>>12&15]+p[z>>>8&15]+p[z>>>4&15]+p[15&z]+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[D>>>28&15]+p[D>>>24&15]+p[D>>>20&15]+p[D>>>16&15]+p[D>>>12&15]+p[D>>>8&15]+p[D>>>4&15]+p[15&D]+p[X>>>28&15]+p[X>>>24&15]+p[X>>>20&15]+p[X>>>16&15]+p[X>>>12&15]+p[X>>>8&15]+p[X>>>4&15]+p[15&X];return this.is224||(he+=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]),he},q.prototype.toString=q.prototype.hex,q.prototype.digest=function(){this.finalize();var M=this.h0,U=this.h1,ae=this.h2,z=this.h3,I=this.h4,D=this.h5,X=this.h6,W=this.h7,he=[M>>>24&255,M>>>16&255,M>>>8&255,255&M,U>>>24&255,U>>>16&255,U>>>8&255,255&U,ae>>>24&255,ae>>>16&255,ae>>>8&255,255&ae,z>>>24&255,z>>>16&255,z>>>8&255,255&z,I>>>24&255,I>>>16&255,I>>>8&255,255&I,D>>>24&255,D>>>16&255,D>>>8&255,255&D,X>>>24&255,X>>>16&255,X>>>8&255,255&X];return this.is224||he.push(W>>>24&255,W>>>16&255,W>>>8&255,255&W),he},q.prototype.array=q.prototype.digest,q.prototype.arrayBuffer=function(){this.finalize();var M=new ArrayBuffer(this.is224?28:32),U=new DataView(M);return U.setUint32(0,this.h0),U.setUint32(4,this.h1),U.setUint32(8,this.h2),U.setUint32(12,this.h3),U.setUint32(16,this.h4),U.setUint32(20,this.h5),U.setUint32(24,this.h6),this.is224||U.setUint32(28,this.h7),M},re.prototype=new q,re.prototype.finalize=function(){if(q.prototype.finalize.call(this),this.inner){this.inner=!1;var M=this.array();q.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(M),q.prototype.finalize.call(this)}};var se=w();se.sha256=se,se.sha224=w(!0),se.sha256.hmac=P(),se.sha224.hmac=P(!0),c?Zh.exports=se:(s.sha256=se.sha256,s.sha224=se.sha224)})();ju.exports;ju.exports.sha224;var rb=ju.exports.sha256;function kd(n){return ME(n)}function jE(n){if(!/^[0-9A-Fa-f]+$/.test(n))return!1;const s=/^[0-9A-F]+$/.test(n),i=/^[0-9a-f]+$/.test(n);return s||i?n.length%2===0:!1}function kE(n){return/^[A-Za-z0-9\-_]*(={0,2})?$/.test(n)||/^[A-Za-z0-9+/]*(={0,2})?$/.test(n)}function NE(n){return jE(n)?"hex":kE(n)?"b64":""}function TE(n){if(n.length%2!==0)throw new Error("hex string must have an even length");const t=new Uint8Array(n.length/2);for(let s=0;s<n.length;s+=2)t[s/2]=parseInt(n.substring(s,s+2),16);return t}function CE(n){n=n.replace(/-/g,"+"),n=n.replace(/_/g,"/");const t=atob(n);return Uint8Array.from(t,s=>s.charCodeAt(0))}function ME(n){switch(NE(n)){case"hex":return TE(n);case"b64":return CE(n)}return null}function RE(n,t){const s=typeof n=="string"?kd(n):n,i=typeof t=="string"?kd(t):t;if(s===null||i===null||s.length!==i.length)return!1;for(let o=0;o<s.length;o++)if(s[o]!==i[o])return!1;return!0}class xx{constructor(t,s,i=!0){j(this,"token");j(this,"received");j(this,"ctx");j(this,"requestSubject");j(this,"mux");this.mux=t,this.requestSubject=s,this.received=0,this.token=Os.next(),i&&(this.ctx=new Error)}}class DE extends xx{constructor(s,i,o={maxWait:1e3}){super(s,i);j(this,"callback");j(this,"done");j(this,"timer");j(this,"max");j(this,"opts");if(this.opts=o,typeof this.opts.callback!="function")throw new Error("callback is required");this.callback=this.opts.callback,this.max=typeof o.maxMessages=="number"&&o.maxMessages>0?o.maxMessages:-1,this.done=mt(),this.done.then(()=>{this.callback(null,null)}),this.timer=setTimeout(()=>{this.cancel()},o.maxWait)}cancel(s){s&&this.callback(s,null),clearTimeout(this.timer),this.mux.cancel(this),this.done.resolve()}resolver(s,i){s?(this.ctx&&(s.stack+=`
33
+
34
+ ${this.ctx.stack}`),this.cancel(s)):(this.callback(null,i),this.opts.strategy===Wn.Count&&(this.max--,this.max===0&&this.cancel()),this.opts.strategy===Wn.JitterTimer&&(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.cancel()},this.opts.jitter||300)),this.opts.strategy===Wn.SentinelMsg&&i&&i.data.length===0&&this.cancel())}}class vx extends xx{constructor(s,i,o={timeout:1e3},c=!0){super(s,i,c);j(this,"deferred");j(this,"timer");this.deferred=mt(),this.timer=na(o.timeout,c)}resolver(s,i){this.timer&&this.timer.cancel(),s?(this.ctx&&(s.stack+=`
35
+
36
+ ${this.ctx.stack}`),this.deferred.reject(s)):this.deferred.resolve(i),this.cancel()}cancel(s){this.timer&&this.timer.cancel(),this.mux.cancel(this),this.deferred.reject(s||ge.errorForCode(fe.Cancelled))}}const LE="$JS.API";function qE(n){return n=n||{},n.domain&&(n.apiPrefix=`$JS.${n.domain}.API`,delete n.domain),Ou({apiPrefix:LE,timeout:5e3},n)}class Ro{constructor(t,s){j(this,"nc");j(this,"opts");j(this,"prefix");j(this,"timeout");j(this,"jc");this.nc=t,this.opts=qE(s),this._parseOpts(),this.prefix=this.opts.apiPrefix,this.timeout=this.opts.timeout,this.jc=Zn()}getOptions(){return Object.assign({},this.opts)}_parseOpts(){let t=this.opts.apiPrefix;if(!t||t.length===0)throw new Error("invalid empty prefix");t[t.length-1]==="."&&(t=t.substr(0,t.length-1)),this.opts.apiPrefix=t}async _request(t,s=null,i){i=i||{},i.timeout=this.timeout;let o=jn;s&&(o=this.jc.encode(s));let{retries:c}=i;c=c||1,c=c===-1?Number.MAX_SAFE_INTEGER:c;const m=lm();for(let p=0;p<c;p++)try{const g=await this.nc.request(t,o,i);return this.parseJsResponse(g)}catch(g){const u=g;if((u.code==="503"||u.code===fe.Timeout)&&p+1<c)await ia(m.backoff(p));else throw g}}async findStream(t){const s={subject:t},o=await this._request(`${this.prefix}.STREAM.NAMES`,s);if(!o.streams||o.streams.length!==1)throw new Error("no stream matches subject");return o.streams[0]}getConnection(){return this.nc}parseJsResponse(t){const s=this.jc.decode(t.data),i=s;if(i.error){const o=bx(i.error.code,i.error.description);if(o!==null)throw o.api_error=i.error,o}return s}}class bo{constructor(t,s,i,o){j(this,"err");j(this,"offset");j(this,"pageInfo");j(this,"subject");j(this,"jsm");j(this,"filter");j(this,"payload");if(!t)throw new Error("subject is required");this.subject=t,this.jsm=i,this.offset=0,this.pageInfo={},this.filter=s,this.payload=o||{}}async next(){if(this.err)return[];if(this.pageInfo&&this.offset>=this.pageInfo.total)return[];const t={offset:this.offset};this.payload&&Object.assign(t,this.payload);try{const s=await this.jsm._request(this.subject,t,{timeout:this.jsm.timeout});this.pageInfo=s;const i=this.countResponse(s);return i===0?[]:(this.offset+=i,this.filter(s))}catch(s){throw this.err=s,s}}countResponse(t){var s,i,o;switch(t==null?void 0:t.type){case"io.nats.jetstream.api.v1.stream_names_response":case"io.nats.jetstream.api.v1.stream_list_response":return((s=t.streams)==null?void 0:s.length)||0;case"io.nats.jetstream.api.v1.consumer_list_response":return((i=t.consumers)==null?void 0:i.length)||0;default:return console.error(`jslister.ts: unknown API response for paged output: ${t==null?void 0:t.type}`),((o=t.streams)==null?void 0:o.length)||0}return 0}async*[Symbol.asyncIterator](){let t=await this.next();for(;t.length>0;){for(const s of t)yield s;t=await this.next()}}}function ti(n=""){const t=n.match(/(\d+).(\d+).(\d+)/);if(t)return{major:parseInt(t[1]),minor:parseInt(t[2]),micro:parseInt(t[3])};throw new Error(`'${n}' is not a semver value`)}function Nd(n,t){return n.major<t.major?-1:n.major>t.major?1:n.minor<t.minor?-1:n.minor>t.minor?1:n.micro<t.micro?-1:n.micro>t.micro?1:0}var Ye;(function(n){n.JS_KV="js_kv",n.JS_OBJECTSTORE="js_objectstore",n.JS_PULL_MAX_BYTES="js_pull_max_bytes",n.JS_NEW_CONSUMER_CREATE_API="js_new_consumer_create",n.JS_ALLOW_DIRECT="js_allow_direct",n.JS_MULTIPLE_CONSUMER_FILTER="js_multiple_consumer_filter",n.JS_SIMPLIFICATION="js_simplification",n.JS_STREAM_CONSUMER_METADATA="js_stream_consumer_metadata",n.JS_CONSUMER_FILTER_SUBJECTS="js_consumer_filter_subjects",n.JS_STREAM_FIRST_SEQ="js_stream_first_seq",n.JS_STREAM_SUBJECT_TRANSFORM="js_stream_subject_transform",n.JS_STREAM_SOURCE_SUBJECT_TRANSFORM="js_stream_source_subject_transform",n.JS_STREAM_COMPRESSION="js_stream_compression",n.JS_DEFAULT_CONSUMER_LIMITS="js_default_consumer_limits",n.JS_BATCH_DIRECT_GET="js_batch_direct_get"})(Ye||(Ye={}));class PE{constructor(t){j(this,"server");j(this,"features");j(this,"disabled");this.features=new Map,this.disabled=[],this.update(t)}resetDisabled(){this.disabled.length=0,this.update(this.server)}disable(t){this.disabled.push(t),this.update(this.server)}isDisabled(t){return this.disabled.indexOf(t)!==-1}update(t){typeof t=="string"&&(t=ti(t)),this.server=t,this.set(Ye.JS_KV,"2.6.2"),this.set(Ye.JS_OBJECTSTORE,"2.6.3"),this.set(Ye.JS_PULL_MAX_BYTES,"2.8.3"),this.set(Ye.JS_NEW_CONSUMER_CREATE_API,"2.9.0"),this.set(Ye.JS_ALLOW_DIRECT,"2.9.0"),this.set(Ye.JS_MULTIPLE_CONSUMER_FILTER,"2.10.0"),this.set(Ye.JS_SIMPLIFICATION,"2.9.4"),this.set(Ye.JS_STREAM_CONSUMER_METADATA,"2.10.0"),this.set(Ye.JS_CONSUMER_FILTER_SUBJECTS,"2.10.0"),this.set(Ye.JS_STREAM_FIRST_SEQ,"2.10.0"),this.set(Ye.JS_STREAM_SUBJECT_TRANSFORM,"2.10.0"),this.set(Ye.JS_STREAM_SOURCE_SUBJECT_TRANSFORM,"2.10.0"),this.set(Ye.JS_STREAM_COMPRESSION,"2.10.0"),this.set(Ye.JS_DEFAULT_CONSUMER_LIMITS,"2.10.0"),this.set(Ye.JS_BATCH_DIRECT_GET,"2.11.0"),this.disabled.forEach(s=>{this.features.delete(s)})}set(t,s){this.features.set(t,{min:s,ok:Nd(this.server,ti(s))>=0})}get(t){return this.features.get(t)||{min:"unknown",ok:!1}}supports(t){var s;return((s=this.get(t))==null?void 0:s.ok)||!1}require(t){return typeof t=="string"&&(t=ti(t)),Nd(this.server,t)>=0}}class mu extends Ro{constructor(t,s){super(t,s)}async add(t,s,i=du.Create){if(Jt(t),s.deliver_group&&s.flow_control)throw new Error("jetstream flow control is not supported with queue groups");if(s.deliver_group&&s.idle_heartbeat)throw new Error("jetstream idle heartbeat is not supported with queue groups");const o={};o.config=s,o.stream_name=t,o.action=i,o.config.durable_name&&Qi(o.config.durable_name);const c=this.nc;let{min:m,ok:p}=c.features.get(Ye.JS_NEW_CONSUMER_CREATE_API);const g=s.name===""?void 0:s.name;if(g&&!p)throw new Error(`consumer 'name' requires server ${m}`);if(g)try{Au("name",g)}catch(x){const v=x.message,w=v.indexOf("cannot contain");throw w!==-1?new Error(`consumer 'name' ${v.substring(w)}`):x}let u,d="";if(Array.isArray(s.filter_subjects)){const{min:x,ok:v}=c.features.get(Ye.JS_MULTIPLE_CONSUMER_FILTER);if(!v)throw new Error(`consumer 'filter_subjects' requires server ${x}`);p=!1}if(s.metadata){const{min:x,ok:v}=c.features.get(Ye.JS_STREAM_CONSUMER_METADATA);if(!v)throw new Error(`consumer 'metadata' requires server ${x}`)}if(p&&(d=s.name??s.durable_name??""),d!==""){let x=s.filter_subject??void 0;x===">"&&(x=void 0),u=x!==void 0?`${this.prefix}.CONSUMER.CREATE.${t}.${d}.${x}`:`${this.prefix}.CONSUMER.CREATE.${t}.${d}`}else u=s.durable_name?`${this.prefix}.CONSUMER.DURABLE.CREATE.${t}.${s.durable_name}`:`${this.prefix}.CONSUMER.CREATE.${t}`;return await this._request(u,o)}async update(t,s,i){const o=await this.info(t,s),c=i;return this.add(t,Object.assign(o.config,c),du.Update)}async info(t,s){return Jt(t),Qi(s),await this._request(`${this.prefix}.CONSUMER.INFO.${t}.${s}`)}async delete(t,s){return Jt(t),Qi(s),(await this._request(`${this.prefix}.CONSUMER.DELETE.${t}.${s}`)).success}list(t){Jt(t);const s=o=>o.consumers,i=`${this.prefix}.CONSUMER.LIST.${t}`;return new bo(i,s,this)}pause(t,s,i){const o=`${this.prefix}.CONSUMER.PAUSE.${t}.${s}`,c={pause_until:i.toISOString()};return this._request(o,c)}resume(t,s){return this.pause(t,s,new Date(0))}}function $i(n,t,s=!1){if(s===!0&&!n)throw ge.errorForCode(fe.ApiError,new Error(`${t} is not a function`));if(n&&typeof n!="function")throw ge.errorForCode(fe.ApiError,new Error(`${t} is not a function`))}class BE extends Ut{constructor(s,i,o){super();j(this,"sub");j(this,"adapter");j(this,"subIterDone");$i(o.adapter,"adapter",!0),this.adapter=o.adapter,o.callback&&$i(o.callback,"callback"),this.noIterator=typeof o.callback=="function",o.ingestionFilterFn&&($i(o.ingestionFilterFn,"ingestionFilterFn"),this.ingestionFilterFn=o.ingestionFilterFn),o.protocolFilterFn&&($i(o.protocolFilterFn,"protocolFilterFn"),this.protocolFilterFn=o.protocolFilterFn),o.dispatchedFn&&($i(o.dispatchedFn,"dispatchedFn"),this.dispatchedFn=o.dispatchedFn),o.cleanupFn&&$i(o.cleanupFn,"cleanupFn");let c=(d,b)=>{this.callback(d,b)};if(o.callback){const d=o.callback;c=(b,x)=>{const[v,w]=this.adapter(b,x);if(v){d(v,null);return}const{ingest:S}=this.ingestionFilterFn?this.ingestionFilterFn(w,this):{ingest:!0};S&&(!this.protocolFilterFn||this.protocolFilterFn(w))&&(d(v,w),this.dispatchedFn&&w&&this.dispatchedFn(w))}}const{max:m,queue:p,timeout:g}=o,u={queue:p,timeout:g,callback:c};m&&m>0&&(u.max=m),this.sub=s.subscribe(i,u),o.cleanupFn&&(this.sub.cleanupFn=o.cleanupFn),this.noIterator||this.iterClosed.then(()=>{this.unsubscribe()}),this.subIterDone=mt(),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(s){this.sub.unsubscribe(s)}drain(){return this.sub.drain()}isDraining(){return this.sub.isDraining()}isClosed(){return this.sub.isClosed()}callback(s,i){this.sub.cancelTimeout();const[o,c]=this.adapter(s,i);o&&this.stop(o),c&&this.push(c)}getSubject(){return this.sub.getSubject()}getReceived(){return this.sub.getReceived()}getProcessed(){return this.sub.getProcessed()}getPending(){return this.sub.getPending()}getID(){return this.sub.getID()}getMax(){return this.sub.getMax()}get closed(){return this.sub.closed}}let On;function UE(n){On=n}function _x(){return On!==void 0&&On.defaultPort!==void 0?On.defaultPort:4222}function ed(){return On!==void 0&&On.urlParseFn?On.urlParseFn:void 0}function zE(){if(!On||typeof On.factory!="function")throw new Error("transport fn is not set");return On.factory()}function Td(){return On!==void 0&&On.dnsResolveFn?On.dnsResolveFn:void 0}const ru=`\r
37
+ `,pu=sa.fromAscii(ru),IE=new Uint8Array(pu)[0],$E=new Uint8Array(pu)[1];function HE(n){for(let t=0;t<n.length;t++){const s=t+1;if(n.byteLength>s&&n[t]===IE&&n[s]===$E)return s+1}return 0}function FE(n){const t=HE(n);if(t>0){const i=new Uint8Array(n).slice(0,t);return En.decode(i)}return""}const GE=4,wx=48,VE=65,YE=97;function KE(n,t,s,i){const o=new Uint8Array(16);return[0,0,0,0,0,0,0,0,0,0,255,255].forEach((m,p)=>{o[p]=m}),o[12]=n,o[13]=t,o[14]=s,o[15]=i,o}function Cd(n){return JE(n)!==void 0}function JE(n){for(let t=0;t<n.length;t++)switch(n[t]){case".":return Sx(n);case":":return QE(n)}}function Sx(n){const t=new Uint8Array(4);for(let s=0;s<4;s++){if(n.length===0)return;if(s>0){if(n[0]!==".")return;n=n.substring(1)}const{n:i,c:o,ok:c}=XE(n);if(!c||i>255)return;n=n.substring(o),t[s]=i}return KE(t[0],t[1],t[2],t[3])}function QE(n){const t=new Uint8Array(16);let s=-1;if(n.length>=2&&n[0]===":"&&n[1]===":"&&(s=0,n=n.substring(2),n.length===0))return t;let i=0;for(;i<16;){const{n:o,c,ok:m}=WE(n);if(!m||o>65535)return;if(c<n.length&&n[c]==="."){if(s<0&&i!=12||i+4>16)return;const p=Sx(n);if(p===void 0)return;t[i]=p[12],t[i+1]=p[13],t[i+2]=p[14],t[i+3]=p[15],n="",i+=GE;break}if(t[i]=o>>8,t[i+1]=o,i+=2,n=n.substring(c),n.length===0)break;if(n[0]!==":"||n.length==1)return;if(n=n.substring(1),n[0]===":"){if(s>=0)return;if(s=i,n=n.substring(1),n.length===0)break}}if(n.length===0){if(i<16){if(s<0)return;const o=16-i;for(let c=i-1;c>=s;c--)t[c+o]=t[c];for(let c=s+o-1;c>=s;c--)t[c]=0}else if(s>=0)return;return t}}function XE(n){let t=0,s=0;for(t=0;t<n.length&&48<=n.charCodeAt(t)&&n.charCodeAt(t)<=57;t++)if(s=s*10+(n.charCodeAt(t)-wx),s>=16777215)return{n:16777215,c:t,ok:!1};return t===0?{n:0,c:0,ok:!1}:{n:s,c:t,ok:!0}}function WE(n){let t=0,s=0;for(s=0;s<n.length;s++){if(48<=n.charCodeAt(s)&&n.charCodeAt(s)<=57)t*=16,t+=n.charCodeAt(s)-wx;else if(97<=n.charCodeAt(s)&&n.charCodeAt(s)<=102)t*=16,t+=n.charCodeAt(s)-YE+10;else if(65<=n.charCodeAt(s)&&n.charCodeAt(s)<=70)t*=16,t+=n.charCodeAt(s)-VE+10;else break;if(t>=16777215)return{n:0,c:s,ok:!1}}return s===0?{n:0,c:s,ok:!1}:{n:t,c:s,ok:!0}}function ZE(n){return n.indexOf("[")!==-1||n.indexOf("::")!==-1?!1:n.indexOf(".")!==-1||n.split(":").length<=2}function Md(n){return!ZE(n)}function e2(n){const t="::FFFF:",s=n.toUpperCase().indexOf(t);if(s!==-1&&n.indexOf(".")!==-1){let i=n.substring(s+t.length);return i=i.replace("[",""),i.replace("]","")}return n}function t2(n){n=n.trim(),n.match(/^(.*:\/\/)(.*)/m)&&(n=n.replace(/^(.*:\/\/)(.*)/gm,"$2")),n=e2(n),Md(n)&&n.indexOf("[")===-1&&(n=`[${n}]`);const t=Md(n)?n.match(/(]:)(\d+)/):n.match(/(:)(\d+)/),s=t&&t.length===3&&t[1]&&t[2]?parseInt(t[2]):4222,i=s===80?"https":"http",o=new URL(`${i}://${n}`);o.port=`${s}`;let c=o.hostname;return c.charAt(0)==="["&&(c=c.substring(1,c.length-1)),{listen:o.host,hostname:c,port:s}}class wo{constructor(t,s=!1){j(this,"src");j(this,"listen");j(this,"hostname");j(this,"port");j(this,"didConnect");j(this,"reconnects");j(this,"lastConnect");j(this,"gossiped");j(this,"tlsName");j(this,"resolves");this.src=t,this.tlsName="";const i=t2(t);this.listen=i.listen,this.hostname=i.hostname,this.port=i.port,this.didConnect=!1,this.reconnects=0,this.lastConnect=0,this.gossiped=s}toString(){return this.listen}async resolve(t){if(!t.fn||t.resolve===!1)return[this];const s=[];if(Cd(this.hostname))return[this];{const i=await t.fn(this.hostname);t.debug&&console.log(`resolve ${this.hostname} = ${i.join(",")}`);for(const o of i){const c=this.port===80?"https":"http",m=new URL(`${c}://${Md(o)?"["+o+"]":o}`);m.port=`${this.port}`;const p=new wo(m.host,!1);p.tlsName=this.hostname,s.push(p)}}return t.randomize&&yx(s),this.resolves=s,s}}class n2{constructor(t=[],s={}){j(this,"firstSelect");j(this,"servers");j(this,"currentServer");j(this,"tlsName");j(this,"randomize");this.firstSelect=!0,this.servers=[],this.tlsName="",this.randomize=s.randomize||!1;const i=ed();t&&(t.forEach(o=>{o=i?i(o):o,this.servers.push(new wo(o))}),this.randomize&&(this.servers=yx(this.servers))),this.servers.length===0&&this.addServer(`${wd}:${_x()}`,!1),this.currentServer=this.servers[0]}clear(){this.servers.length=0}updateTLSName(){const t=this.getCurrentServer();Cd(t.hostname)||(this.tlsName=t.hostname,this.servers.forEach(s=>{s.gossiped&&(s.tlsName=this.tlsName)}))}getCurrentServer(){return this.currentServer}addServer(t,s=!1){const i=ed();t=i?i(t):t;const o=new wo(t,s);Cd(o.hostname)&&(o.tlsName=this.tlsName),this.servers.push(o)}selectServer(){if(this.firstSelect)return this.firstSelect=!1,this.currentServer;const t=this.servers.shift();return t&&(this.servers.push(t),this.currentServer=t),t}removeCurrentServer(){this.removeServer(this.currentServer)}removeServer(t){if(t){const s=this.servers.indexOf(t);this.servers.splice(s,1)}}length(){return this.servers.length}next(){return this.servers.length?this.servers[0]:void 0}getServers(){return this.servers}update(t,s){const i=[];let o=[];const c=ed(),m=new Map;t.connect_urls&&t.connect_urls.length>0&&t.connect_urls.forEach(g=>{g=c?c(g,s):g;const u=new wo(g,!0);m.set(g,u)});const p=[];return this.servers.forEach((g,u)=>{const d=g.listen;g.gossiped&&this.currentServer.listen!==d&&m.get(d)===void 0&&p.push(u),m.delete(d)}),p.reverse(),p.forEach(g=>{const u=this.servers.splice(g,1);o=o.concat(u[0].listen)}),m.forEach((g,u)=>{this.servers.push(g),i.push(u)}),{added:i,deleted:o}}}class r2{constructor(){j(this,"baseInbox");j(this,"reqs");this.reqs=new Map}size(){return this.reqs.size}init(t){return this.baseInbox=`${Lr(t)}.`,this.baseInbox}add(t){isNaN(t.received)||(t.received=0),this.reqs.set(t.token,t)}get(t){return this.reqs.get(t)}cancel(t){this.reqs.delete(t.token)}getToken(t){const s=t.subject||"";return s.indexOf(this.baseInbox)===0?s.substring(this.baseInbox.length):null}all(){return Array.from(this.reqs.values())}handleError(t,s){if(s&&s.permissionContext){if(t)return this.all().forEach(o=>{o.resolver(s,{})}),!0;const i=s.permissionContext;if(i.operation==="publish"){const o=this.all().find(c=>c.requestSubject===i.subject);if(o)return o.resolver(s,{}),!0}}return!1}dispatcher(){return(t,s)=>{const i=this.getToken(s);if(i){const o=this.get(i);o&&(t===null&&s.headers&&(t=gx(s)),o.resolver(t,s))}}}close(){const t=ge.errorForCode(fe.Timeout);this.reqs.forEach(s=>{s.resolver(t,{})})}}class s2{constructor(t,s,i){j(this,"ph");j(this,"interval");j(this,"maxOut");j(this,"timer");j(this,"pendings");this.ph=t,this.interval=s,this.maxOut=i,this.pendings=[]}start(){this.cancel(),this._schedule()}cancel(t){this.timer&&(clearTimeout(this.timer),this.timer=void 0),this._reset(),t&&this.ph.disconnect()}_schedule(){this.timer=setTimeout(()=>{if(this.ph.dispatchStatus({type:Ji.PingTimer,data:`${this.pendings.length+1}`}),this.pendings.length===this.maxOut){this.cancel(!0);return}const t=mt();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 i2 extends Error{constructor(t){super(t),this.name="AssertionError"}}function a2(n,t="Assertion failed."){if(!n)throw new i2(t)}const sb=32*1024,td=2**32-2;function oc(n,t,s=0){const i=t.byteLength-s;return n.byteLength>i&&(n=n.subarray(0,i)),t.set(n,s),n.byteLength}class nd{constructor(t){j(this,"_buf");j(this,"_off");if(this._off=0,t==null){this._buf=new Uint8Array(0);return}this._buf=new Uint8Array(t)}bytes(t={copy:!0}){return t.copy===!1?this._buf.subarray(this._off):this._buf.slice(this._off)}empty(){return this._buf.byteLength<=this._off}get length(){return this._buf.byteLength-this._off}get capacity(){return this._buf.buffer.byteLength}truncate(t){if(t===0){this.reset();return}if(t<0||t>this.length)throw Error("bytes.Buffer: truncation out of range");this._reslice(this._off+t)}reset(){this._reslice(0),this._off=0}_tryGrowByReslice(t){const s=this._buf.byteLength;return t<=this.capacity-s?(this._reslice(s+t),s):-1}_reslice(t){a2(t<=this._buf.buffer.byteLength),this._buf=new Uint8Array(this._buf.buffer,0,t)}readByte(){const t=new Uint8Array(1);return this.read(t)?t[0]:null}read(t){if(this.empty())return this.reset(),t.byteLength===0?0:null;const s=oc(this._buf.subarray(this._off),t);return this._off+=s,s}writeByte(t){return this.write(Uint8Array.of(t))}writeString(t){return this.write(ri.encode(t))}write(t){const s=this._grow(t.byteLength);return oc(t,this._buf,s)}_grow(t){const s=this.length;s===0&&this._off!==0&&this.reset();const i=this._tryGrowByReslice(t);if(i>=0)return i;const o=this.capacity;if(t<=Math.floor(o/2)-s)oc(this._buf.subarray(this._off),this._buf);else{if(o+t>td)throw new Error("The buffer cannot be grown beyond the maximum size.");{const c=new Uint8Array(Math.min(2*o+t,td));oc(this._buf.subarray(this._off),c),this._buf=c}}return this._off=0,this._reslice(Math.min(s+t,td)),s}grow(t){if(t<0)throw Error("Buffer._grow: negative count");const s=this._grow(t);this._reslice(s)}readFrom(t){let s=0;const i=new Uint8Array(sb);for(;;){const o=this.capacity-this.length<sb,c=o?i:new Uint8Array(this._buf.buffer,this.length),m=t.read(c);if(m===null)return s;o?this.write(c.subarray(0,m)):this._reslice(this.length+m),s+=m}}}var Qt;(function(n){n[n.OK=0]="OK",n[n.ERR=1]="ERR",n[n.MSG=2]="MSG",n[n.INFO=3]="INFO",n[n.PING=4]="PING",n[n.PONG=5]="PONG"})(Qt||(Qt={}));function ib(){const n={};return n.sid=-1,n.hdr=-1,n.size=-1,n}const o2=48;class ab{constructor(t){j(this,"dispatcher");j(this,"state");j(this,"as");j(this,"drop");j(this,"hdr");j(this,"ma");j(this,"argBuf");j(this,"msgBuf");this.dispatcher=t,this.state=de.OP_START,this.as=0,this.drop=0,this.hdr=0}parse(t){let s;for(s=0;s<t.length;s++){const i=t[s];switch(this.state){case de.OP_START:switch(i){case me.M:case me.m:this.state=de.OP_M,this.hdr=-1,this.ma=ib();break;case me.H:case me.h:this.state=de.OP_H,this.hdr=0,this.ma=ib();break;case me.P:case me.p:this.state=de.OP_P;break;case me.PLUS:this.state=de.OP_PLUS;break;case me.MINUS:this.state=de.OP_MINUS;break;case me.I:case me.i:this.state=de.OP_I;break;default:throw this.fail(t.subarray(s))}break;case de.OP_H:switch(i){case me.M:case me.m:this.state=de.OP_M;break;default:throw this.fail(t.subarray(s))}break;case de.OP_M:switch(i){case me.S:case me.s:this.state=de.OP_MS;break;default:throw this.fail(t.subarray(s))}break;case de.OP_MS:switch(i){case me.G:case me.g:this.state=de.OP_MSG;break;default:throw this.fail(t.subarray(s))}break;case de.OP_MSG:switch(i){case me.SPACE:case me.TAB:this.state=de.OP_MSG_SPC;break;default:throw this.fail(t.subarray(s))}break;case de.OP_MSG_SPC:switch(i){case me.SPACE:case me.TAB:continue;default:this.state=de.MSG_ARG,this.as=s}break;case de.MSG_ARG:switch(i){case me.CR:this.drop=1;break;case me.NL:{const o=this.argBuf?this.argBuf.bytes():t.subarray(this.as,s-this.drop);this.processMsgArgs(o),this.drop=0,this.as=s+1,this.state=de.MSG_PAYLOAD,s=this.as+this.ma.size-1;break}default:this.argBuf&&this.argBuf.writeByte(i)}break;case de.MSG_PAYLOAD:if(this.msgBuf)if(this.msgBuf.length>=this.ma.size){const o=this.msgBuf.bytes({copy:!1});this.dispatcher.push({kind:Qt.MSG,msg:this.ma,data:o}),this.argBuf=void 0,this.msgBuf=void 0,this.state=de.MSG_END}else{let o=this.ma.size-this.msgBuf.length;const c=t.length-s;c<o&&(o=c),o>0?(this.msgBuf.write(t.subarray(s,s+o)),s=s+o-1):this.msgBuf.writeByte(i)}else s-this.as>=this.ma.size&&(this.dispatcher.push({kind:Qt.MSG,msg:this.ma,data:t.subarray(this.as,s)}),this.argBuf=void 0,this.msgBuf=void 0,this.state=de.MSG_END);break;case de.MSG_END:switch(i){case me.NL:this.drop=0,this.as=s+1,this.state=de.OP_START;break;default:continue}break;case de.OP_PLUS:switch(i){case me.O:case me.o:this.state=de.OP_PLUS_O;break;default:throw this.fail(t.subarray(s))}break;case de.OP_PLUS_O:switch(i){case me.K:case me.k:this.state=de.OP_PLUS_OK;break;default:throw this.fail(t.subarray(s))}break;case de.OP_PLUS_OK:switch(i){case me.NL:this.dispatcher.push({kind:Qt.OK}),this.drop=0,this.state=de.OP_START;break}break;case de.OP_MINUS:switch(i){case me.E:case me.e:this.state=de.OP_MINUS_E;break;default:throw this.fail(t.subarray(s))}break;case de.OP_MINUS_E:switch(i){case me.R:case me.r:this.state=de.OP_MINUS_ER;break;default:throw this.fail(t.subarray(s))}break;case de.OP_MINUS_ER:switch(i){case me.R:case me.r:this.state=de.OP_MINUS_ERR;break;default:throw this.fail(t.subarray(s))}break;case de.OP_MINUS_ERR:switch(i){case me.SPACE:case me.TAB:this.state=de.OP_MINUS_ERR_SPC;break;default:throw this.fail(t.subarray(s))}break;case de.OP_MINUS_ERR_SPC:switch(i){case me.SPACE:case me.TAB:continue;default:this.state=de.MINUS_ERR_ARG,this.as=s}break;case de.MINUS_ERR_ARG:switch(i){case me.CR:this.drop=1;break;case me.NL:{let o;this.argBuf?(o=this.argBuf.bytes(),this.argBuf=void 0):o=t.subarray(this.as,s-this.drop),this.dispatcher.push({kind:Qt.ERR,data:o}),this.drop=0,this.as=s+1,this.state=de.OP_START;break}default:this.argBuf&&this.argBuf.write(Uint8Array.of(i))}break;case de.OP_P:switch(i){case me.I:case me.i:this.state=de.OP_PI;break;case me.O:case me.o:this.state=de.OP_PO;break;default:throw this.fail(t.subarray(s))}break;case de.OP_PO:switch(i){case me.N:case me.n:this.state=de.OP_PON;break;default:throw this.fail(t.subarray(s))}break;case de.OP_PON:switch(i){case me.G:case me.g:this.state=de.OP_PONG;break;default:throw this.fail(t.subarray(s))}break;case de.OP_PONG:switch(i){case me.NL:this.dispatcher.push({kind:Qt.PONG}),this.drop=0,this.state=de.OP_START;break}break;case de.OP_PI:switch(i){case me.N:case me.n:this.state=de.OP_PIN;break;default:throw this.fail(t.subarray(s))}break;case de.OP_PIN:switch(i){case me.G:case me.g:this.state=de.OP_PING;break;default:throw this.fail(t.subarray(s))}break;case de.OP_PING:switch(i){case me.NL:this.dispatcher.push({kind:Qt.PING}),this.drop=0,this.state=de.OP_START;break}break;case de.OP_I:switch(i){case me.N:case me.n:this.state=de.OP_IN;break;default:throw this.fail(t.subarray(s))}break;case de.OP_IN:switch(i){case me.F:case me.f:this.state=de.OP_INF;break;default:throw this.fail(t.subarray(s))}break;case de.OP_INF:switch(i){case me.O:case me.o:this.state=de.OP_INFO;break;default:throw this.fail(t.subarray(s))}break;case de.OP_INFO:switch(i){case me.SPACE:case me.TAB:this.state=de.OP_INFO_SPC;break;default:throw this.fail(t.subarray(s))}break;case de.OP_INFO_SPC:switch(i){case me.SPACE:case me.TAB:continue;default:this.state=de.INFO_ARG,this.as=s}break;case de.INFO_ARG:switch(i){case me.CR:this.drop=1;break;case me.NL:{let o;this.argBuf?(o=this.argBuf.bytes(),this.argBuf=void 0):o=t.subarray(this.as,s-this.drop),this.dispatcher.push({kind:Qt.INFO,data:o}),this.drop=0,this.as=s+1,this.state=de.OP_START;break}default:this.argBuf&&this.argBuf.writeByte(i)}break;default:throw this.fail(t.subarray(s))}}(this.state===de.MSG_ARG||this.state===de.MINUS_ERR_ARG||this.state===de.INFO_ARG)&&!this.argBuf&&(this.argBuf=new nd(t.subarray(this.as,s-this.drop))),this.state===de.MSG_PAYLOAD&&!this.msgBuf&&(this.argBuf||this.cloneMsgArg(),this.msgBuf=new nd(t.subarray(this.as)))}cloneMsgArg(){const t=this.ma.subject.length,s=this.ma.reply?this.ma.reply.length:0,i=new Uint8Array(t+s);i.set(this.ma.subject),this.ma.reply&&i.set(this.ma.reply,t),this.argBuf=new nd(i),this.ma.subject=i.subarray(0,t),this.ma.reply&&(this.ma.reply=i.subarray(t))}processMsgArgs(t){if(this.hdr>=0)return this.processHeaderMsgArgs(t);const s=[];let i=-1;for(let o=0;o<t.length;o++)switch(t[o]){case me.SPACE:case me.TAB:case me.CR:case me.NL:i>=0&&(s.push(t.subarray(i,o)),i=-1);break;default:i<0&&(i=o)}switch(i>=0&&s.push(t.subarray(i)),s.length){case 3:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=void 0,this.ma.size=this.protoParseInt(s[2]);break;case 4:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=s[2],this.ma.size=this.protoParseInt(s[3]);break;default:throw this.fail(t,"processMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(t,"processMsgArgs Bad or Missing Sid Error");if(this.ma.size<0)throw this.fail(t,"processMsgArgs Bad or Missing Size Error")}fail(t,s=""){return s?s=`${s} [${this.state}]`:s=`parse error [${this.state}]`,new Error(`${s}: ${En.decode(t)}`)}processHeaderMsgArgs(t){const s=[];let i=-1;for(let o=0;o<t.length;o++)switch(t[o]){case me.SPACE:case me.TAB:case me.CR:case me.NL:i>=0&&(s.push(t.subarray(i,o)),i=-1);break;default:i<0&&(i=o)}switch(i>=0&&s.push(t.subarray(i)),s.length){case 4:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=void 0,this.ma.hdr=this.protoParseInt(s[2]),this.ma.size=this.protoParseInt(s[3]);break;case 5:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=s[2],this.ma.hdr=this.protoParseInt(s[3]),this.ma.size=this.protoParseInt(s[4]);break;default:throw this.fail(t,"processHeaderMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(t,"processHeaderMsgArgs Bad or Missing Sid Error");if(this.ma.hdr<0||this.ma.hdr>this.ma.size)throw this.fail(t,"processHeaderMsgArgs Bad or Missing Header Size Error");if(this.ma.size<0)throw this.fail(t,"processHeaderMsgArgs Bad or Missing Size Error")}protoParseInt(t){if(t.length===0)return-1;let s=0;for(let i=0;i<t.length;i++){if(t[i]<48||t[i]>57)return-1;s=s*10+(t[i]-o2)}return s}}var de;(function(n){n[n.OP_START=0]="OP_START",n[n.OP_PLUS=1]="OP_PLUS",n[n.OP_PLUS_O=2]="OP_PLUS_O",n[n.OP_PLUS_OK=3]="OP_PLUS_OK",n[n.OP_MINUS=4]="OP_MINUS",n[n.OP_MINUS_E=5]="OP_MINUS_E",n[n.OP_MINUS_ER=6]="OP_MINUS_ER",n[n.OP_MINUS_ERR=7]="OP_MINUS_ERR",n[n.OP_MINUS_ERR_SPC=8]="OP_MINUS_ERR_SPC",n[n.MINUS_ERR_ARG=9]="MINUS_ERR_ARG",n[n.OP_M=10]="OP_M",n[n.OP_MS=11]="OP_MS",n[n.OP_MSG=12]="OP_MSG",n[n.OP_MSG_SPC=13]="OP_MSG_SPC",n[n.MSG_ARG=14]="MSG_ARG",n[n.MSG_PAYLOAD=15]="MSG_PAYLOAD",n[n.MSG_END=16]="MSG_END",n[n.OP_H=17]="OP_H",n[n.OP_P=18]="OP_P",n[n.OP_PI=19]="OP_PI",n[n.OP_PIN=20]="OP_PIN",n[n.OP_PING=21]="OP_PING",n[n.OP_PO=22]="OP_PO",n[n.OP_PON=23]="OP_PON",n[n.OP_PONG=24]="OP_PONG",n[n.OP_I=25]="OP_I",n[n.OP_IN=26]="OP_IN",n[n.OP_INF=27]="OP_INF",n[n.OP_INFO=28]="OP_INFO",n[n.OP_INFO_SPC=29]="OP_INFO_SPC",n[n.INFO_ARG=30]="INFO_ARG"})(de||(de={}));var me;(function(n){n[n.CR=13]="CR",n[n.E=69]="E",n[n.e=101]="e",n[n.F=70]="F",n[n.f=102]="f",n[n.G=71]="G",n[n.g=103]="g",n[n.H=72]="H",n[n.h=104]="h",n[n.I=73]="I",n[n.i=105]="i",n[n.K=75]="K",n[n.k=107]="k",n[n.M=77]="M",n[n.m=109]="m",n[n.MINUS=45]="MINUS",n[n.N=78]="N",n[n.n=110]="n",n[n.NL=10]="NL",n[n.O=79]="O",n[n.o=111]="o",n[n.P=80]="P",n[n.p=112]="p",n[n.PLUS=43]="PLUS",n[n.R=82]="R",n[n.r=114]="r",n[n.S=83]="S",n[n.s=115]="s",n[n.SPACE=32]="SPACE",n[n.TAB=9]="TAB"})(me||(me={}));(function(n){var t=function(A,N){this.hi=A|0,this.lo=N|0},s=function(A){var N,k=new Float64Array(16);if(A)for(N=0;N<A.length;N++)k[N]=A[N];return k},i=function(){throw new Error("no PRNG")},o=new Uint8Array(16),c=new Uint8Array(32);c[0]=9;var m=s(),p=s([1]),g=s([56129,1]),u=s([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),d=s([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),b=s([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),x=s([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),v=s([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function w(A,N){return A<<N|A>>>32-N}function S(A,N){var k=A[N+3]&255;return k=k<<8|A[N+2]&255,k=k<<8|A[N+1]&255,k<<8|A[N+0]&255}function C(A,N){var k=A[N]<<24|A[N+1]<<16|A[N+2]<<8|A[N+3],T=A[N+4]<<24|A[N+5]<<16|A[N+6]<<8|A[N+7];return new t(k,T)}function P(A,N,k){var T;for(T=0;T<4;T++)A[N+T]=k&255,k>>>=8}function q(A,N,k){A[N]=k.hi>>24&255,A[N+1]=k.hi>>16&255,A[N+2]=k.hi>>8&255,A[N+3]=k.hi&255,A[N+4]=k.lo>>24&255,A[N+5]=k.lo>>16&255,A[N+6]=k.lo>>8&255,A[N+7]=k.lo&255}function re(A,N,k,T,L){var H,ne=0;for(H=0;H<L;H++)ne|=A[N+H]^k[T+H];return(1&ne-1>>>8)-1}function se(A,N,k,T){return re(A,N,k,T,16)}function M(A,N,k,T){return re(A,N,k,T,32)}function U(A,N,k,T,L){var H=new Uint32Array(16),ne=new Uint32Array(16),oe=new Uint32Array(16),K=new Uint32Array(4),te,xe,Pe;for(te=0;te<4;te++)ne[5*te]=S(T,4*te),ne[1+te]=S(k,4*te),ne[6+te]=S(N,4*te),ne[11+te]=S(k,16+4*te);for(te=0;te<16;te++)oe[te]=ne[te];for(te=0;te<20;te++){for(xe=0;xe<4;xe++){for(Pe=0;Pe<4;Pe++)K[Pe]=ne[(5*xe+4*Pe)%16];for(K[1]^=w(K[0]+K[3]|0,7),K[2]^=w(K[1]+K[0]|0,9),K[3]^=w(K[2]+K[1]|0,13),K[0]^=w(K[3]+K[2]|0,18),Pe=0;Pe<4;Pe++)H[4*xe+(xe+Pe)%4]=K[Pe]}for(Pe=0;Pe<16;Pe++)ne[Pe]=H[Pe]}if(L){for(te=0;te<16;te++)ne[te]=ne[te]+oe[te]|0;for(te=0;te<4;te++)ne[5*te]=ne[5*te]-S(T,4*te)|0,ne[6+te]=ne[6+te]-S(N,4*te)|0;for(te=0;te<4;te++)P(A,4*te,ne[5*te]),P(A,16+4*te,ne[6+te])}else for(te=0;te<16;te++)P(A,4*te,ne[te]+oe[te]|0)}function ae(A,N,k,T){return U(A,N,k,T,!1),0}function z(A,N,k,T){return U(A,N,k,T,!0),0}var I=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function D(A,N,k,T,L,H,ne){var oe=new Uint8Array(16),K=new Uint8Array(64),te,xe;if(!L)return 0;for(xe=0;xe<16;xe++)oe[xe]=0;for(xe=0;xe<8;xe++)oe[xe]=H[xe];for(;L>=64;){for(ae(K,oe,ne,I),xe=0;xe<64;xe++)A[N+xe]=(k?k[T+xe]:0)^K[xe];for(te=1,xe=8;xe<16;xe++)te=te+(oe[xe]&255)|0,oe[xe]=te&255,te>>>=8;L-=64,N+=64,k&&(T+=64)}if(L>0)for(ae(K,oe,ne,I),xe=0;xe<L;xe++)A[N+xe]=(k?k[T+xe]:0)^K[xe];return 0}function X(A,N,k,T,L){return D(A,N,null,0,k,T,L)}function W(A,N,k,T,L){var H=new Uint8Array(32);return z(H,T,L,I),X(A,N,k,T.subarray(16),H)}function he(A,N,k,T,L,H,ne){var oe=new Uint8Array(32);return z(oe,H,ne,I),D(A,N,k,T,L,H.subarray(16),oe)}function we(A,N){var k,T=0;for(k=0;k<17;k++)T=T+(A[k]+N[k]|0)|0,A[k]=T&255,T>>>=8}var Oe=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]);function F(A,N,k,T,L,H){var ne,oe,K,te,xe=new Uint32Array(17),Pe=new Uint32Array(17),lt=new Uint32Array(17),Gt=new Uint32Array(17),Gn=new Uint32Array(17);for(K=0;K<17;K++)Pe[K]=lt[K]=0;for(K=0;K<16;K++)Pe[K]=H[K];for(Pe[3]&=15,Pe[4]&=252,Pe[7]&=15,Pe[8]&=252,Pe[11]&=15,Pe[12]&=252,Pe[15]&=15;L>0;){for(K=0;K<17;K++)Gt[K]=0;for(K=0;K<16&&K<L;++K)Gt[K]=k[T+K];for(Gt[K]=1,T+=K,L-=K,we(lt,Gt),oe=0;oe<17;oe++)for(xe[oe]=0,K=0;K<17;K++)xe[oe]=xe[oe]+lt[K]*(K<=oe?Pe[oe-K]:320*Pe[oe+17-K]|0)|0|0;for(oe=0;oe<17;oe++)lt[oe]=xe[oe];for(te=0,K=0;K<16;K++)te=te+lt[K]|0,lt[K]=te&255,te>>>=8;for(te=te+lt[16]|0,lt[16]=te&3,te=5*(te>>>2)|0,K=0;K<16;K++)te=te+lt[K]|0,lt[K]=te&255,te>>>=8;te=te+lt[16]|0,lt[16]=te}for(K=0;K<17;K++)Gn[K]=lt[K];for(we(lt,Oe),ne=-(lt[16]>>>7)|0,K=0;K<17;K++)lt[K]^=ne&(Gn[K]^lt[K]);for(K=0;K<16;K++)Gt[K]=H[K+16];for(Gt[16]=0,we(lt,Gt),K=0;K<16;K++)A[N+K]=lt[K];return 0}function J(A,N,k,T,L,H){var ne=new Uint8Array(16);return F(ne,0,k,T,L,H),se(A,N,ne,0)}function le(A,N,k,T,L){var H;if(k<32)return-1;for(he(A,0,N,0,k,T,L),F(A,16,A,32,k-32,A),H=0;H<16;H++)A[H]=0;return 0}function pe(A,N,k,T,L){var H,ne=new Uint8Array(32);if(k<32||(W(ne,0,32,T,L),J(N,16,N,32,k-32,ne)!==0))return-1;for(he(A,0,N,0,k,T,L),H=0;H<32;H++)A[H]=0;return 0}function ye(A,N){var k;for(k=0;k<16;k++)A[k]=N[k]|0}function Ce(A){var N,k;for(k=0;k<16;k++)A[k]+=65536,N=Math.floor(A[k]/65536),A[(k+1)*(k<15?1:0)]+=N-1+37*(N-1)*(k===15?1:0),A[k]-=N*65536}function Ne(A,N,k){for(var T,L=~(k-1),H=0;H<16;H++)T=L&(A[H]^N[H]),A[H]^=T,N[H]^=T}function Me(A,N){var k,T,L,H=s(),ne=s();for(k=0;k<16;k++)ne[k]=N[k];for(Ce(ne),Ce(ne),Ce(ne),T=0;T<2;T++){for(H[0]=ne[0]-65517,k=1;k<15;k++)H[k]=ne[k]-65535-(H[k-1]>>16&1),H[k-1]&=65535;H[15]=ne[15]-32767-(H[14]>>16&1),L=H[15]>>16&1,H[14]&=65535,Ne(ne,H,1-L)}for(k=0;k<16;k++)A[2*k]=ne[k]&255,A[2*k+1]=ne[k]>>8}function We(A,N){var k=new Uint8Array(32),T=new Uint8Array(32);return Me(k,A),Me(T,N),M(k,0,T,0)}function pt(A){var N=new Uint8Array(32);return Me(N,A),N[0]&1}function Ct(A,N){var k;for(k=0;k<16;k++)A[k]=N[2*k]+(N[2*k+1]<<8);A[15]&=32767}function Se(A,N,k){var T;for(T=0;T<16;T++)A[T]=N[T]+k[T]|0}function Re(A,N,k){var T;for(T=0;T<16;T++)A[T]=N[T]-k[T]|0}function ce(A,N,k){var T,L,H=new Float64Array(31);for(T=0;T<31;T++)H[T]=0;for(T=0;T<16;T++)for(L=0;L<16;L++)H[T+L]+=N[T]*k[L];for(T=0;T<15;T++)H[T]+=38*H[T+16];for(T=0;T<16;T++)A[T]=H[T];Ce(A),Ce(A)}function Ue(A,N){ce(A,N,N)}function Xe(A,N){var k=s(),T;for(T=0;T<16;T++)k[T]=N[T];for(T=253;T>=0;T--)Ue(k,k),T!==2&&T!==4&&ce(k,k,N);for(T=0;T<16;T++)A[T]=k[T]}function cn(A,N){var k=s(),T;for(T=0;T<16;T++)k[T]=N[T];for(T=250;T>=0;T--)Ue(k,k),T!==1&&ce(k,k,N);for(T=0;T<16;T++)A[T]=k[T]}function Mt(A,N,k){var T=new Uint8Array(32),L=new Float64Array(80),H,ne,oe=s(),K=s(),te=s(),xe=s(),Pe=s(),lt=s();for(ne=0;ne<31;ne++)T[ne]=N[ne];for(T[31]=N[31]&127|64,T[0]&=248,Ct(L,k),ne=0;ne<16;ne++)K[ne]=L[ne],xe[ne]=oe[ne]=te[ne]=0;for(oe[0]=xe[0]=1,ne=254;ne>=0;--ne)H=T[ne>>>3]>>>(ne&7)&1,Ne(oe,K,H),Ne(te,xe,H),Se(Pe,oe,te),Re(oe,oe,te),Se(te,K,xe),Re(K,K,xe),Ue(xe,Pe),Ue(lt,oe),ce(oe,te,oe),ce(te,K,Pe),Se(Pe,oe,te),Re(oe,oe,te),Ue(K,oe),Re(te,xe,lt),ce(oe,te,g),Se(oe,oe,xe),ce(te,te,oe),ce(oe,xe,lt),ce(xe,K,L),Ue(K,Pe),Ne(oe,K,H),Ne(te,xe,H);for(ne=0;ne<16;ne++)L[ne+16]=oe[ne],L[ne+32]=te[ne],L[ne+48]=K[ne],L[ne+64]=xe[ne];var Gt=L.subarray(32),Gn=L.subarray(16);return Xe(Gt,Gt),ce(Gn,Gn,Gt),Me(A,Gn),0}function be(A,N){return Mt(A,N,c)}function it(A,N){return i(N,32),be(A,N)}function yt(A,N,k){var T=new Uint8Array(32);return Mt(T,k,N),z(A,o,T,I)}var Ot=le,Ur=pe;function la(A,N,k,T,L,H){var ne=new Uint8Array(32);return yt(ne,L,H),Ot(A,N,k,T,ne)}function ca(A,N,k,T,L,H){var ne=new Uint8Array(32);return yt(ne,L,H),Ur(A,N,k,T,ne)}function hr(){var A=0,N=0,k=0,T=0,L=65535,H,ne,oe;for(oe=0;oe<arguments.length;oe++)H=arguments[oe].lo,ne=arguments[oe].hi,A+=H&L,N+=H>>>16,k+=ne&L,T+=ne>>>16;return N+=A>>>16,k+=N>>>16,T+=k>>>16,new t(k&L|T<<16,A&L|N<<16)}function zo(A,N){return new t(A.hi>>>N,A.lo>>>N|A.hi<<32-N)}function si(){var A=0,N=0,k;for(k=0;k<arguments.length;k++)A^=arguments[k].lo,N^=arguments[k].hi;return new t(N,A)}function ft(A,N){var k,T,L=32-N;return N<32?(k=A.hi>>>N|A.lo<<L,T=A.lo>>>N|A.hi<<L):N<64&&(k=A.lo>>>N|A.hi<<L,T=A.hi>>>N|A.lo<<L),new t(k,T)}function Pu(A,N,k){var T=A.hi&N.hi^~A.hi&k.hi,L=A.lo&N.lo^~A.lo&k.lo;return new t(T,L)}function Io(A,N,k){var T=A.hi&N.hi^A.hi&k.hi^N.hi&k.hi,L=A.lo&N.lo^A.lo&k.lo^N.lo&k.lo;return new t(T,L)}function $o(A){return si(ft(A,28),ft(A,34),ft(A,39))}function ii(A){return si(ft(A,14),ft(A,18),ft(A,41))}function Bu(A){return si(ft(A,1),ft(A,8),zo(A,7))}function Ho(A){return si(ft(A,19),ft(A,61),zo(A,6))}var Uu=[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 Fo(A,N,k){var T=[],L=[],H=[],ne=[],oe,K,te;for(K=0;K<8;K++)T[K]=H[K]=C(A,8*K);for(var xe=0;k>=128;){for(K=0;K<16;K++)ne[K]=C(N,8*K+xe);for(K=0;K<80;K++){for(te=0;te<8;te++)L[te]=H[te];for(oe=hr(H[7],ii(H[4]),Pu(H[4],H[5],H[6]),Uu[K],ne[K%16]),L[7]=hr(oe,$o(H[0]),Io(H[0],H[1],H[2])),L[3]=hr(L[3],oe),te=0;te<8;te++)H[(te+1)%8]=L[te];if(K%16===15)for(te=0;te<16;te++)ne[te]=hr(ne[te],ne[(te+9)%16],Bu(ne[(te+1)%16]),Ho(ne[(te+14)%16]))}for(K=0;K<8;K++)H[K]=hr(H[K],T[K]),T[K]=H[K];xe+=128,k-=128}for(K=0;K<8;K++)q(A,8*K,T[K]);return k}var ks=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 _t(A,N,k){var T=new Uint8Array(64),L=new Uint8Array(256),H,ne=k;for(H=0;H<64;H++)T[H]=ks[H];for(Fo(T,N,k),k%=128,H=0;H<256;H++)L[H]=0;for(H=0;H<k;H++)L[H]=N[ne-k+H];for(L[k]=128,k=256-128*(k<112?1:0),L[k-9]=0,q(L,k-8,new t(ne/536870912|0,ne<<3)),Fo(T,L,k),H=0;H<64;H++)A[H]=T[H];return 0}function un(A,N){var k=s(),T=s(),L=s(),H=s(),ne=s(),oe=s(),K=s(),te=s(),xe=s();Re(k,A[1],A[0]),Re(xe,N[1],N[0]),ce(k,k,xe),Se(T,A[0],A[1]),Se(xe,N[0],N[1]),ce(T,T,xe),ce(L,A[3],N[3]),ce(L,L,d),ce(H,A[2],N[2]),Se(H,H,H),Re(ne,T,k),Re(oe,H,L),Se(K,H,L),Se(te,T,k),ce(A[0],ne,oe),ce(A[1],te,K),ce(A[2],K,oe),ce(A[3],ne,te)}function Ft(A,N,k){var T;for(T=0;T<4;T++)Ne(A[T],N[T],k)}function ua(A,N){var k=s(),T=s(),L=s();Xe(L,N[2]),ce(k,N[0],L),ce(T,N[1],L),Me(A,T),A[31]^=pt(k)<<7}function fa(A,N,k){var T,L;for(ye(A[0],m),ye(A[1],p),ye(A[2],p),ye(A[3],m),L=255;L>=0;--L)T=k[L/8|0]>>(L&7)&1,Ft(A,N,T),un(N,A),un(A,A),Ft(A,N,T)}function ai(A,N){var k=[s(),s(),s(),s()];ye(k[0],b),ye(k[1],x),ye(k[2],p),ce(k[3],b,x),fa(A,k,N)}function zr(A,N,k){var T=new Uint8Array(64),L=[s(),s(),s(),s()],H;for(k||i(N,32),_t(T,N,32),T[0]&=248,T[31]&=127,T[31]|=64,ai(L,T),ua(A,L),H=0;H<32;H++)N[H+32]=A[H];return 0}var dr=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 Ir(A,N){var k,T,L,H;for(T=63;T>=32;--T){for(k=0,L=T-32,H=T-12;L<H;++L)N[L]+=k-16*N[T]*dr[L-(T-32)],k=Math.floor((N[L]+128)/256),N[L]-=k*256;N[L]+=k,N[T]=0}for(k=0,L=0;L<32;L++)N[L]+=k-(N[31]>>4)*dr[L],k=N[L]>>8,N[L]&=255;for(L=0;L<32;L++)N[L]-=k*dr[L];for(T=0;T<32;T++)N[T+1]+=N[T]>>8,A[T]=N[T]&255}function Hn(A){var N=new Float64Array(64),k;for(k=0;k<64;k++)N[k]=A[k];for(k=0;k<64;k++)A[k]=0;Ir(A,N)}function Ns(A,N,k,T){var L=new Uint8Array(64),H=new Uint8Array(64),ne=new Uint8Array(64),oe,K,te=new Float64Array(64),xe=[s(),s(),s(),s()];_t(L,T,32),L[0]&=248,L[31]&=127,L[31]|=64;var Pe=k+64;for(oe=0;oe<k;oe++)A[64+oe]=N[oe];for(oe=0;oe<32;oe++)A[32+oe]=L[32+oe];for(_t(ne,A.subarray(32),k+32),Hn(ne),ai(xe,ne),ua(A,xe),oe=32;oe<64;oe++)A[oe]=T[oe];for(_t(H,A,k+64),Hn(H),oe=0;oe<64;oe++)te[oe]=0;for(oe=0;oe<32;oe++)te[oe]=ne[oe];for(oe=0;oe<32;oe++)for(K=0;K<32;K++)te[oe+K]+=H[oe]*L[K];return Ir(A.subarray(32),te),Pe}function Ts(A,N){var k=s(),T=s(),L=s(),H=s(),ne=s(),oe=s(),K=s();return ye(A[2],p),Ct(A[1],N),Ue(L,A[1]),ce(H,L,u),Re(L,L,A[2]),Se(H,A[2],H),Ue(ne,H),Ue(oe,ne),ce(K,oe,ne),ce(k,K,L),ce(k,k,H),cn(k,k),ce(k,k,L),ce(k,k,H),ce(k,k,H),ce(A[0],k,H),Ue(T,A[0]),ce(T,T,H),We(T,L)&&ce(A[0],A[0],v),Ue(T,A[0]),ce(T,T,H),We(T,L)?-1:(pt(A[0])===N[31]>>7&&Re(A[0],m,A[0]),ce(A[3],A[0],A[1]),0)}function ha(A,N,k,T){var L,H=new Uint8Array(32),ne=new Uint8Array(64),oe=[s(),s(),s(),s()],K=[s(),s(),s(),s()];if(k<64||Ts(K,T))return-1;for(L=0;L<k;L++)A[L]=N[L];for(L=0;L<32;L++)A[L+32]=T[L];if(_t(ne,A,k),Hn(ne),fa(oe,K,ne),ai(K,N.subarray(32)),un(oe,K),ua(H,oe),k-=64,M(N,0,H,0)){for(L=0;L<k;L++)A[L]=0;return-1}for(L=0;L<k;L++)A[L]=N[L+64];return k}var oi=32,$r=24,Fn=32,Hr=16,Fr=32,Cs=32,Gr=32,mr=32,Ms=32,da=$r,Go=Fn,tr=Hr,at=64,gt=32,fn=64,Rs=32,ma=64;n.lowlevel={crypto_core_hsalsa20:z,crypto_stream_xor:he,crypto_stream:W,crypto_stream_salsa20_xor:D,crypto_stream_salsa20:X,crypto_onetimeauth:F,crypto_onetimeauth_verify:J,crypto_verify_16:se,crypto_verify_32:M,crypto_secretbox:le,crypto_secretbox_open:pe,crypto_scalarmult:Mt,crypto_scalarmult_base:be,crypto_box_beforenm:yt,crypto_box_afternm:Ot,crypto_box:la,crypto_box_open:ca,crypto_box_keypair:it,crypto_hash:_t,crypto_sign:Ns,crypto_sign_keypair:zr,crypto_sign_open:ha,crypto_secretbox_KEYBYTES:oi,crypto_secretbox_NONCEBYTES:$r,crypto_secretbox_ZEROBYTES:Fn,crypto_secretbox_BOXZEROBYTES:Hr,crypto_scalarmult_BYTES:Fr,crypto_scalarmult_SCALARBYTES:Cs,crypto_box_PUBLICKEYBYTES:Gr,crypto_box_SECRETKEYBYTES:mr,crypto_box_BEFORENMBYTES:Ms,crypto_box_NONCEBYTES:da,crypto_box_ZEROBYTES:Go,crypto_box_BOXZEROBYTES:tr,crypto_sign_BYTES:at,crypto_sign_PUBLICKEYBYTES:gt,crypto_sign_SECRETKEYBYTES:fn,crypto_sign_SEEDBYTES:Rs,crypto_hash_BYTES:ma,gf:s,D:u,L:dr,pack25519:Me,unpack25519:Ct,M:ce,A:Se,S:Ue,Z:Re,pow2523:cn,add:un,set25519:ye,modL:Ir,scalarmult:fa,scalarbase:ai};function Vo(A,N){if(A.length!==oi)throw new Error("bad key size");if(N.length!==$r)throw new Error("bad nonce size")}function Yo(A,N){if(A.length!==Gr)throw new Error("bad public key size");if(N.length!==mr)throw new Error("bad secret key size")}function Rt(){for(var A=0;A<arguments.length;A++)if(!(arguments[A]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function li(A){for(var N=0;N<A.length;N++)A[N]=0}n.randomBytes=function(A){var N=new Uint8Array(A);return i(N,A),N},n.secretbox=function(A,N,k){Rt(A,N,k),Vo(k,N);for(var T=new Uint8Array(Fn+A.length),L=new Uint8Array(T.length),H=0;H<A.length;H++)T[H+Fn]=A[H];return le(L,T,T.length,N,k),L.subarray(Hr)},n.secretbox.open=function(A,N,k){Rt(A,N,k),Vo(k,N);for(var T=new Uint8Array(Hr+A.length),L=new Uint8Array(T.length),H=0;H<A.length;H++)T[H+Hr]=A[H];return T.length<32||pe(L,T,T.length,N,k)!==0?null:L.subarray(Fn)},n.secretbox.keyLength=oi,n.secretbox.nonceLength=$r,n.secretbox.overheadLength=Hr,n.scalarMult=function(A,N){if(Rt(A,N),A.length!==Cs)throw new Error("bad n size");if(N.length!==Fr)throw new Error("bad p size");var k=new Uint8Array(Fr);return Mt(k,A,N),k},n.scalarMult.base=function(A){if(Rt(A),A.length!==Cs)throw new Error("bad n size");var N=new Uint8Array(Fr);return be(N,A),N},n.scalarMult.scalarLength=Cs,n.scalarMult.groupElementLength=Fr,n.box=function(A,N,k,T){var L=n.box.before(k,T);return n.secretbox(A,N,L)},n.box.before=function(A,N){Rt(A,N),Yo(A,N);var k=new Uint8Array(Ms);return yt(k,A,N),k},n.box.after=n.secretbox,n.box.open=function(A,N,k,T){var L=n.box.before(k,T);return n.secretbox.open(A,N,L)},n.box.open.after=n.secretbox.open,n.box.keyPair=function(){var A=new Uint8Array(Gr),N=new Uint8Array(mr);return it(A,N),{publicKey:A,secretKey:N}},n.box.keyPair.fromSecretKey=function(A){if(Rt(A),A.length!==mr)throw new Error("bad secret key size");var N=new Uint8Array(Gr);return be(N,A),{publicKey:N,secretKey:new Uint8Array(A)}},n.box.publicKeyLength=Gr,n.box.secretKeyLength=mr,n.box.sharedKeyLength=Ms,n.box.nonceLength=da,n.box.overheadLength=n.secretbox.overheadLength,n.sign=function(A,N){if(Rt(A,N),N.length!==fn)throw new Error("bad secret key size");var k=new Uint8Array(at+A.length);return Ns(k,A,A.length,N),k},n.sign.open=function(A,N){if(Rt(A,N),N.length!==gt)throw new Error("bad public key size");var k=new Uint8Array(A.length),T=ha(k,A,A.length,N);if(T<0)return null;for(var L=new Uint8Array(T),H=0;H<L.length;H++)L[H]=k[H];return L},n.sign.detached=function(A,N){for(var k=n.sign(A,N),T=new Uint8Array(at),L=0;L<T.length;L++)T[L]=k[L];return T},n.sign.detached.verify=function(A,N,k){if(Rt(A,N,k),N.length!==at)throw new Error("bad signature size");if(k.length!==gt)throw new Error("bad public key size");var T=new Uint8Array(at+A.length),L=new Uint8Array(at+A.length),H;for(H=0;H<at;H++)T[H]=N[H];for(H=0;H<A.length;H++)T[H+at]=A[H];return ha(L,T,T.length,k)>=0},n.sign.keyPair=function(){var A=new Uint8Array(gt),N=new Uint8Array(fn);return zr(A,N),{publicKey:A,secretKey:N}},n.sign.keyPair.fromSecretKey=function(A){if(Rt(A),A.length!==fn)throw new Error("bad secret key size");for(var N=new Uint8Array(gt),k=0;k<N.length;k++)N[k]=A[32+k];return{publicKey:N,secretKey:new Uint8Array(A)}},n.sign.keyPair.fromSeed=function(A){if(Rt(A),A.length!==Rs)throw new Error("bad seed size");for(var N=new Uint8Array(gt),k=new Uint8Array(fn),T=0;T<32;T++)k[T]=A[T];return zr(N,k,!0),{publicKey:N,secretKey:k}},n.sign.publicKeyLength=gt,n.sign.secretKeyLength=fn,n.sign.seedLength=Rs,n.sign.signatureLength=at,n.hash=function(A){Rt(A);var N=new Uint8Array(ma);return _t(N,A,A.length),N},n.hash.hashLength=ma,n.verify=function(A,N){return Rt(A,N),A.length===0||N.length===0||A.length!==N.length?!1:re(A,0,N,0,A.length)===0},n.setPRNG=function(A){i=A},(function(){var A=typeof globalThis<"u"?globalThis.crypto||globalThis.msCrypto:null;if(A&&A.getRandomValues){var N=65536;n.setPRNG(function(k,T){var L,H=new Uint8Array(T);for(L=0;L<T;L+=N)A.getRandomValues(H.subarray(L,L+Math.min(T-L,N)));for(L=0;L<T;L++)k[L]=H[L];li(H)})}else typeof require<"u"&&(A=require("crypto"),A&&A.randomBytes&&n.setPRNG(function(k,T){var L,H=A.randomBytes(T);for(L=0;L<T;L++)k[L]=H[L];li(H)}))})()})(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const lc=typeof module<"u"&&module.exports?module.exports:globalThis.nacl;lc.sign.keyPair.fromSeed,lc.sign.detached,lc.sign.detached.verify,lc.randomBytes;var ob;(function(n){n.InvalidPrefixByte="nkeys: invalid prefix byte",n.InvalidKey="nkeys: invalid key",n.InvalidPublicKey="nkeys: invalid public key",n.InvalidSeedLen="nkeys: invalid seed length",n.InvalidSeed="nkeys: invalid seed",n.InvalidEncoding="nkeys: invalid encoded key",n.InvalidSignature="nkeys: signature verification failed",n.CannotSign="nkeys: cannot sign, no private key available",n.PublicKeyOnly="nkeys: no seed or private key available",n.InvalidChecksum="nkeys: invalid checksum",n.SerializationError="nkeys: serialization error",n.ApiError="nkeys: api error",n.ClearedPair="nkeys: pair is cleared"})(ob||(ob={}));var lb;(function(n){n[n.Seed=144]="Seed",n[n.Private=120]="Private",n[n.Operator=112]="Operator",n[n.Server=104]="Server",n[n.Cluster=16]="Cluster",n[n.Account=0]="Account",n[n.User=160]="User"})(lb||(lb={}));function l2(n){return t=>{let s={};return n.forEach(i=>{const o=i(t)||{};s=Object.assign(s,o)}),s}}function c2(){return()=>{}}function u2(n,t){return()=>{const s=typeof n=="function"?n():n,i=typeof t=="function"?t():t;return{user:s,pass:i}}}function f2(n){return()=>({auth_token:typeof n=="function"?n():n})}const Ex=120*1e3,h2=2,Ox=2*1e3;function d2(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:Ex,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:1e3,reconnectTimeWait:Ox,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function m2(n){const t=[];return typeof n.authenticator=="function"&&t.push(n.authenticator),Array.isArray(n.authenticator)&&t.push(...n.authenticator),n.token&&t.push(f2(n.token)),n.user&&t.push(u2(n.user,n.pass)),t.length===0?c2():l2(t)}function p2(n){const t=`${wd}:${_x()}`;if(n=n||{servers:[t]},n.servers=n.servers||[],typeof n.servers=="string"&&(n.servers=[n.servers]),n.servers.length>0&&n.port)throw new ge("port and servers options are mutually exclusive",fe.InvalidOption);n.servers.length===0&&n.port&&(n.servers=[`${wd}:${n.port}`]),n.servers&&n.servers.length===0&&(n.servers=[t]);const s=Ou(d2(),n);if(s.authenticator=m2(s),["reconnectDelayHandler","authenticator"].forEach(i=>{if(s[i]&&typeof s[i]!="function")throw new ge(`${i} option should be a function`,fe.NotFunction)}),s.reconnectDelayHandler||(s.reconnectDelayHandler=()=>{let i=s.tls?s.reconnectJitterTLS:s.reconnectJitter;return i&&(i++,i=Math.floor(Math.random()*i)),s.reconnectTimeWait+i}),s.inboxPrefix)try{Lr(s.inboxPrefix)}catch(i){throw new ge(i.message,fe.ApiError)}if(s.resolve===void 0&&(s.resolve=typeof Td()=="function"),s.resolve&&typeof Td()!="function")throw new ge("'resolve' is not supported on this client",fe.InvalidOption);return s}function y2(n,t){const{proto:s,tls_required:i,tls_available:o}=n;if((s===void 0||s<1)&&t.noEcho)throw new ge("noEcho",fe.ServerOptionNotAvailable);const c=i||o||!1;if(t.tls&&!c)throw new ge("tls",fe.ServerOptionNotAvailable)}const g2=1024*32,b2=/^INFO\s+([^\r\n]+)\r\n/i,x2=vo(`PONG\r
38
+ `),cb=vo(`PING\r
39
+ `);class v2{constructor(t,s,i){j(this,"echo");j(this,"no_responders");j(this,"protocol");j(this,"verbose");j(this,"pedantic");j(this,"jwt");j(this,"nkey");j(this,"sig");j(this,"user");j(this,"pass");j(this,"auth_token");j(this,"tls_required");j(this,"name");j(this,"lang");j(this,"version");j(this,"headers");this.protocol=1,this.version=t.version,this.lang=t.lang,this.echo=s.noEcho?!1:void 0,this.verbose=s.verbose,this.pedantic=s.pedantic,this.tls_required=s.tls?!0:void 0,this.name=s.name;const o=(s&&typeof s.authenticator=="function"?s.authenticator(i):{})||{};Ou(this,o)}}class Ax extends Ut{constructor(s,i,o={}){var m;super();j(this,"sid");j(this,"queue");j(this,"draining");j(this,"max");j(this,"subject");j(this,"drained");j(this,"protocol");j(this,"timer");j(this,"info");j(this,"cleanupFn");j(this,"closed");j(this,"requestSubject");Ou(this,o),this.protocol=s,this.subject=i,this.draining=!1,this.noIterator=typeof o.callback=="function",this.closed=mt();const c=!((m=s.options)!=null&&m.noAsyncTraces);o.timeout&&(this.timer=na(o.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(s){if(this.noIterator){const i=this.callback,o=s.ingestionFilterFn?s.ingestionFilterFn:()=>({ingest:!0,protocol:!1}),c=s.protocolFilterFn?s.protocolFilterFn:()=>!0,m=s.dispatchedFn?s.dispatchedFn:()=>{};this.callback=(p,g)=>{const{ingest:u}=o(g);u&&c(g)&&(i(p,g),m(g))}}else this.protocolFilterFn=s.protocolFilterFn,this.dispatchedFn=s.dispatchedFn}callback(s,i){this.cancelTimeout(),s?this.stop(s):this.push(i)}close(){if(!this.isClosed()){this.cancelTimeout();const s=()=>{if(this.stop(),this.cleanupFn)try{this.cleanupFn(this,this.info)}catch{}this.closed.resolve()};this.noIterator?s():this.push(s)}}unsubscribe(s){this.protocol.unsubscribe(this,s)}cancelTimeout(){this.timer&&(this.timer.cancel(),this.timer=void 0)}drain(){return this.protocol.isClosed()?Promise.reject(ge.errorForCode(fe.ConnectionClosed)):this.isClosed()?Promise.reject(ge.errorForCode(fe.SubClosed)):(this.drained||(this.draining=!0,this.protocol.unsub(this),this.drained=this.protocol.flush(mt()).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 _2{constructor(){j(this,"mux");j(this,"subs");j(this,"sidCounter");this.sidCounter=0,this.mux=null,this.subs=new Map}size(){return this.subs.size}add(t){return this.sidCounter++,t.sid=this.sidCounter,this.subs.set(t.sid,t),t}setMux(t){return this.mux=t,t}getMux(){return this.mux}get(t){return this.subs.get(t)}resub(t){return this.sidCounter++,this.subs.delete(t.sid),t.sid=this.sidCounter,this.subs.set(t.sid,t),t}all(){return Array.from(this.subs.values())}cancel(t){t&&(t.close(),this.subs.delete(t.sid))}handleError(t){if(t&&t.permissionContext){const s=t.permissionContext,i=this.all();let o;if(s.operation==="subscription"&&(o=i.find(c=>c.subject===s.subject&&c.queue===s.queue)),s.operation==="publish"&&(o=i.find(c=>c.requestSubject===s.subject)),o)return o.callback(t,{}),o.close(),this.subs.delete(o.sid),o!==this.mux}return!1}close(){this.subs.forEach(t=>{t.close()})}}class yu{constructor(t,s){j(this,"connected");j(this,"connectedOnce");j(this,"infoReceived");j(this,"info");j(this,"muxSubscriptions");j(this,"options");j(this,"outbound");j(this,"pongs");j(this,"subscriptions");j(this,"transport");j(this,"noMorePublishing");j(this,"connectError");j(this,"publisher");j(this,"_closed");j(this,"closed");j(this,"listeners");j(this,"heartbeats");j(this,"parser");j(this,"outMsgs");j(this,"inMsgs");j(this,"outBytes");j(this,"inBytes");j(this,"pendingLimit");j(this,"lastError");j(this,"abortReconnect");j(this,"whyClosed");j(this,"servers");j(this,"server");j(this,"features");j(this,"connectPromise");this._closed=!1,this.connected=!1,this.connectedOnce=!1,this.infoReceived=!1,this.noMorePublishing=!1,this.abortReconnect=!1,this.listeners=[],this.pendingLimit=g2,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=t,this.publisher=s,this.subscriptions=new _2,this.muxSubscriptions=new r2,this.outbound=new sa,this.pongs=[],this.whyClosed="",this.pendingLimit=t.pendingLimit||this.pendingLimit,this.features=new PE({major:0,minor:0,micro:0}),this.connectPromise=null;const i=typeof t.servers=="string"?[t.servers]:t.servers;this.servers=new n2(i,{randomize:!t.noRandomize}),this.closed=mt(),this.parser=new ab(this),this.heartbeats=new s2(this,this.options.pingInterval||Ex,this.options.maxPingOut||h2)}resetOutbound(){this.outbound.reset();const t=this.pongs;this.pongs=[];const s=ge.errorForCode(fe.Disconnect);s.stack="",t.forEach(i=>{i.reject(s)}),this.parser=new ab(this),this.infoReceived=!1}dispatchStatus(t){this.listeners.forEach(s=>{s.push(t)})}status(){const t=new Ut;return this.listeners.push(t),t}prepare(){this.transport&&this.transport.discard(),this.info=void 0,this.resetOutbound();const t=mt();return t.catch(()=>{}),this.pongs.unshift(t),this.connectError=s=>{t.reject(s)},this.transport=zE(),this.transport.closed().then(async s=>{if(this.connected=!1,!this.isClosed()){await this.disconnected(this.transport.closeError||this.lastError);return}}),t}disconnect(){this.dispatchStatus({type:Ji.StaleConnection,data:""}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:Ji.ClientInitiatedReconnect,data:""}),this.transport.disconnect()),Promise.resolve()}async disconnected(t){this.dispatchStatus({type:Dr.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{var s;this.dispatchStatus({type:Dr.Reconnect,data:this.servers.getCurrentServer().toString()}),((s=this.lastError)==null?void 0:s.code)===fe.AuthenticationExpired&&(this.lastError=void 0)}).catch(s=>{this._close(s)}):await this._close(t)}async dial(t){const s=this.prepare();let i;try{i=na(this.options.timeout||2e4);const o=this.transport.connect(t,this.options);await Promise.race([o,i]),(async()=>{try{for await(const c of this.transport)this.parser.parse(c)}catch(c){console.log("reader closed",c)}})().then()}catch(o){s.reject(o)}try{await Promise.race([i,s]),i&&i.cancel(),this.connected=!0,this.connectError=void 0,this.sendSubscriptions(),this.connectedOnce=!0,this.server.didConnect=!0,this.server.reconnects=0,this.flushPending(),this.heartbeats.start()}catch(o){throw i&&i.cancel(),await this.transport.close(o),o}}async _doDial(t){const{resolve:s}=this.options,i=await t.resolve({fn:Td(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:s});let o=null;for(const c of i)try{o=null,this.dispatchStatus({type:Ji.Reconnecting,data:c.toString()}),await this.dial(c);return}catch(m){o=m}throw o}dialLoop(){return this.connectPromise===null&&(this.connectPromise=this.dodialLoop(),this.connectPromise.then(()=>{}).catch(()=>{}).finally(()=>{this.connectPromise=null})),this.connectPromise}async dodialLoop(){let t;for(;;){this._closed&&this.servers.clear();const s=this.options.reconnectDelayHandler?this.options.reconnectDelayHandler():Ox;let i=s;const o=this.selectServer();if(!o||this.abortReconnect)throw t||(this.lastError?this.lastError:ge.errorForCode(fe.ConnectionRefused));const c=Date.now();if(o.lastConnect===0||o.lastConnect+s<=c){o.lastConnect=Date.now();try{await this._doDial(o);break}catch(m){if(t=m,!this.connectedOnce){if(this.options.waitOnFirstConnect)continue;this.servers.removeCurrentServer()}o.reconnects++;const p=this.options.maxReconnectAttempts||0;p!==-1&&o.reconnects>=p&&this.servers.removeCurrentServer()}}else i=Math.min(i,o.lastConnect+s-c),await ia(i)}}static async connect(t,s){const i=new yu(t,s);return await i.dialLoop(),i}static toError(t){const s=t?t.toLowerCase():"";if(s.indexOf("permissions violation")!==-1){const i=new ge(t,fe.PermissionsViolation),o=t.match(/(Publish|Subscription) to "(\S+)"/);if(o){i.permissionContext={operation:o[1].toLowerCase(),subject:o[2],queue:void 0};const c=t.match(/using queue "(\S+)"/);c&&(i.permissionContext.queue=c[1])}return i}else return s.indexOf("authorization violation")!==-1?new ge(t,fe.AuthorizationViolation):s.indexOf("user authentication expired")!==-1?new ge(t,fe.AuthenticationExpired):s.indexOf("account authentication expired")!=-1?new ge(t,fe.AccountExpired):s.indexOf("authentication timeout")!==-1?new ge(t,fe.AuthenticationTimeout):new ge(t,fe.ProtocolError)}processMsg(t,s){if(this.inMsgs++,this.inBytes+=s.length,!this.subscriptions.sidCounter)return;const i=this.subscriptions.get(t.sid);i&&(i.received+=1,i.callback&&i.callback(null,new um(t,s,this)),i.max!==void 0&&i.received>=i.max&&i.unsubscribe())}processError(t){const s=Gg(t),i=yu.toError(s),o={type:Dr.Error,data:i.code};if(i.isPermissionError()){let c=!1;if(i.permissionContext){o.permissionContext=i.permissionContext;const m=this.subscriptions.getMux();c=(m==null?void 0:m.subject)===i.permissionContext.subject}this.subscriptions.handleError(i),this.muxSubscriptions.handleError(c,i),c&&this.subscriptions.setMux(null)}this.dispatchStatus(o),this.handleError(i)}handleError(t){t.isAuthError()?this.handleAuthError(t):t.isProtocolError()?this.lastError=t:t.isAuthTimeout()&&(this.lastError=t),t.isPermissionError()||(this.lastError=t)}handleAuthError(t){this.lastError&&t.code===this.lastError.code&&this.options.ignoreAuthErrorAbort===!1&&(this.abortReconnect=!0),this.connectError?this.connectError(t):this.disconnect()}processPing(){this.transport.send(x2)}processPong(){const t=this.pongs.shift();t&&t.resolve()}processInfo(t){const s=JSON.parse(Gg(t));this.info=s;const i=this.options&&this.options.ignoreClusterUpdates?void 0:this.servers.update(s,this.transport.isEncrypted());if(!this.infoReceived){this.features.update(ti(s.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();const{version:c,lang:m}=this.transport;try{const p=new v2({version:c,lang:m},this.options,s.nonce);s.headers&&(p.headers=!0,p.no_responders=!0);const g=JSON.stringify(p);this.transport.send(vo(`CONNECT ${g}${ru}`)),this.transport.send(cb)}catch(p){this._close(p)}}i&&this.dispatchStatus({type:Dr.Update,data:i}),(s.ldm!==void 0?s.ldm:!1)&&this.dispatchStatus({type:Dr.LDM,data:this.servers.getCurrentServer().toString()})}push(t){switch(t.kind){case Qt.MSG:{const{msg:s,data:i}=t;this.processMsg(s,i);break}case Qt.OK:break;case Qt.ERR:this.processError(t.data);break;case Qt.PING:this.processPing();break;case Qt.PONG:this.processPong();break;case Qt.INFO:this.processInfo(t.data);break}}sendCommand(t,...s){const i=this.outbound.length();let o;typeof t=="string"?o=vo(t):o=t,this.outbound.fill(o,...s),i===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(t,s=jn,i){let o;if(s instanceof Uint8Array)o=s;else if(typeof s=="string")o=ri.encode(s);else throw ge.errorForCode(fe.BadPayload);let c=o.length;i=i||{},i.reply=i.reply||"";let m=jn,p=0;if(i.headers){if(this.info&&!this.info.headers)throw new ge("headers",fe.ServerOptionNotAvailable);m=i.headers.encode(),p=m.length,c=o.length+p}if(this.info&&c>this.info.max_payload)throw ge.errorForCode(fe.MaxPayloadExceeded);this.outBytes+=c,this.outMsgs++;let g;i.headers?(i.reply?g=`HPUB ${t} ${i.reply} ${p} ${c}\r
40
+ `:g=`HPUB ${t} ${p} ${c}\r
41
+ `,this.sendCommand(g,m,o,pu)):(i.reply?g=`PUB ${t} ${i.reply} ${c}\r
42
+ `:g=`PUB ${t} ${c}\r
43
+ `,this.sendCommand(g,o,pu))}request(t){return this.initMux(),this.muxSubscriptions.add(t),t}subscribe(t){return this.subscriptions.add(t),this._subunsub(t),t}_sub(t){t.queue?this.sendCommand(`SUB ${t.subject} ${t.queue} ${t.sid}\r
44
+ `):this.sendCommand(`SUB ${t.subject} ${t.sid}\r
45
+ `)}_subunsub(t){return this._sub(t),t.max&&this.unsubscribe(t,t.max),t}unsubscribe(t,s){this.unsub(t,s),(t.max===void 0||t.received>=t.max)&&this.subscriptions.cancel(t)}unsub(t,s){!t||this.isClosed()||(s?this.sendCommand(`UNSUB ${t.sid} ${s}\r
46
+ `):this.sendCommand(`UNSUB ${t.sid}\r
47
+ `),t.max=s)}resub(t,s){!t||this.isClosed()||(this.unsub(t),t.subject=s,this.subscriptions.resub(t),this._sub(t))}flush(t){return t||(t=mt()),this.pongs.push(t),this.outbound.fill(cb),this.flushPending(),t}sendSubscriptions(){const t=[];this.subscriptions.all().forEach(s=>{const i=s;i.queue?t.push(`SUB ${i.subject} ${i.queue} ${i.sid}${ru}`):t.push(`SUB ${i.subject} ${i.sid}${ru}`)}),t.length&&this.transport.send(vo(t.join("")))}async _close(t){this._closed||(this.whyClosed=new Error("close trace").stack||"",this.heartbeats.cancel(),this.connectError&&(this.connectError(t),this.connectError=void 0),this.muxSubscriptions.close(),this.subscriptions.close(),this.listeners.forEach(s=>{s.stop()}),this._closed=!0,await this.transport.close(t),await this.closed.resolve(t))}close(){return this._close()}isClosed(){return this._closed}drain(){const t=this.subscriptions.all(),s=[];return t.forEach(i=>{s.push(i.drain())}),Promise.all(s).then(async()=>(this.noMorePublishing=!0,await this.flush(),this.close())).catch(()=>{})}flushPending(){if(!(!this.infoReceived||!this.connected)&&this.outbound.size()){const t=this.outbound.drain();this.transport.send(t)}}initMux(){if(!this.subscriptions.getMux()){const s=this.muxSubscriptions.init(this.options.inboxPrefix),i=new Ax(this,`${s}*`);i.callback=this.muxSubscriptions.dispatcher(),this.subscriptions.setMux(i),this.subscribe(i)}}selectServer(){const t=this.servers.selectServer();if(t!==void 0)return this.server=t,this.server}getServer(){return this.server}}const w2="$SRV";class ub{constructor(t){j(this,"msg");this.msg=t}get data(){return this.msg.data}get sid(){return this.msg.sid}get subject(){return this.msg.subject}get reply(){return this.msg.reply||""}get headers(){return this.msg.headers}respond(t,s){return this.msg.respond(t,s)}respondError(t,s,i,o){var c,m;return o=o||{},o.headers=o.headers||Pr(),(c=o.headers)==null||c.set(fu,`${t}`),(m=o.headers)==null||m.set(uu,s),this.msg.respond(i,o)}json(t){return this.msg.json(t)}string(){return this.msg.string()}}class Ao{constructor(t,s="",i=""){j(this,"subject");j(this,"queue");j(this,"srv");s!==""&&E2("service group",s);let o="";if(t instanceof Do)this.srv=t,o="";else if(t instanceof Ao){const c=t;this.srv=c.srv,i===""&&c.queue!==""&&(i=c.queue),o=c.subject}else throw new Error("unknown ServiceGroup type");this.subject=this.calcSubject(o,s),this.queue=i}calcSubject(t,s=""){return s===""?t:t!==""?`${t}.${s}`:s}addEndpoint(t="",s){s=s||{subject:t};const i=typeof s=="function"?{handler:s,subject:t}:s;go("endpoint",t);let{subject:o,handler:c,metadata:m,queue:p}=i;o=o||t,p=p||this.queue,S2("endpoint subject",o),o=this.calcSubject(this.subject,o);const g={name:t,subject:o,queue:p,handler:c,metadata:m};return this.srv._addEndpoint(g)}addGroup(t="",s=""){return new Ao(this,t,s)}}function S2(n,t){if(t==="")throw new Error(`${n} cannot be empty`);if(t.indexOf(" ")!==-1)throw new Error(`${n} cannot contain spaces: '${t}'`);const s=t.split(".");s.forEach((i,o)=>{if(i===">"&&o!==s.length-1)throw new Error(`${n} cannot have internal '>': '${t}'`)})}function E2(n,t){if(t.indexOf(" ")!==-1)throw new Error(`${n} cannot contain spaces: '${t}'`);t.split(".").forEach(i=>{if(i===">")throw new Error(`${n} name cannot contain internal '>': '${t}'`)})}class Do{constructor(t,s={name:"",version:""}){j(this,"nc");j(this,"_id");j(this,"config");j(this,"handlers");j(this,"internal");j(this,"_stopped");j(this,"_done");j(this,"started");this.nc=t,this.config=Object.assign({},s),this.config.queue||(this.config.queue="q"),go("name",this.config.name),go("queue",this.config.queue),ti(this.config.version),this._id=Os.next(),this.internal=[],this._done=mt(),this._stopped=!1,this.handlers=[],this.started=new Date().toISOString(),this.reset(),this.nc.closed().then(()=>{this.close().catch()}).catch(i=>{this.close(i).catch()})}static controlSubject(t,s="",i="",o){const c=o??w2;return s===""&&i===""?`${c}.${t}`:(go("control subject name",s),i!==""?(go("control subject id",i),`${c}.${t}.${s}.${i}`):`${c}.${t}.${s}`)}get subjects(){return this.handlers.filter(t=>t.internal===!1).map(t=>t.subject)}get id(){return this._id}get name(){return this.config.name}get description(){return this.config.description??""}get version(){return this.config.version}get metadata(){return this.config.metadata}errorToHeader(t){const s=Pr();if(t instanceof hu){const i=t;s.set(uu,i.message),s.set(fu,`${i.code}`)}else s.set(uu,t.message),s.set(fu,"500");return s}setupHandler(t,s=!1){const i=s?"":t.queue?t.queue:this.config.queue,{name:o,subject:c,handler:m}=t,p=t;p.internal=s,s&&this.internal.push(p),p.stats=new O2(o,c,i),p.queue=i;const g=m?(u,d)=>{if(u){this.close(u);return}const b=Date.now();try{m(u,new ub(d))}catch(x){p.stats.countError(x),d==null||d.respond(jn,{headers:this.errorToHeader(x)})}finally{p.stats.countLatency(b)}}:void 0;return p.sub=this.nc.subscribe(c,{callback:g,queue:i}),p.sub.closed.then(()=>{this._stopped||this.close(new Error(`required subscription ${t.subject} stopped`)).catch()}).catch(u=>{if(!this._stopped){const d=new Error(`required subscription ${t.subject} errored: ${u.message}`);d.stack=u.stack,this.close(d).catch()}}),p}info(){return{type:_o.INFO,name:this.name,id:this.id,version:this.version,description:this.description,metadata:this.metadata,endpoints:this.endpoints()}}endpoints(){return this.handlers.map(t=>{const{subject:s,metadata:i,name:o,queue:c}=t;return{subject:s,metadata:i,name:o,queue_group:c}})}async stats(){const t=[];for(const s of this.handlers){if(typeof this.config.statsHandler=="function")try{s.stats.data=await this.config.statsHandler(s)}catch(i){s.stats.countError(i)}t.push(s.stats.stats(s.qi))}return{type:_o.STATS,name:this.name,id:this.id,version:this.version,started:this.started,metadata:this.metadata,endpoints:t}}addInternalHandler(t,s){const i=`${t}`.toUpperCase();this._doAddInternalHandler(`${i}-all`,t,s),this._doAddInternalHandler(`${i}-kind`,t,s,this.name),this._doAddInternalHandler(`${i}`,t,s,this.name,this.id)}_doAddInternalHandler(t,s,i,o="",c=""){const m={};m.name=t,m.subject=Do.controlSubject(s,o,c),m.handler=i,this.setupHandler(m,!0)}start(){const t=Zn(),s=(m,p)=>m?(this.close(m),Promise.reject(m)):this.stats().then(g=>(p==null||p.respond(t.encode(g)),Promise.resolve())),i=(m,p)=>m?(this.close(m),Promise.reject(m)):(p==null||p.respond(t.encode(this.info())),Promise.resolve()),o=t.encode(this.ping()),c=(m,p)=>m?(this.close(m).then().catch(),Promise.reject(m)):(p.respond(o),Promise.resolve());return this.addInternalHandler(vs.PING,c),this.addInternalHandler(vs.STATS,s),this.addInternalHandler(vs.INFO,i),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 s=[];return this.nc.isClosed()||(s=this.handlers.concat(this.internal).map(i=>i.sub.drain())),Promise.allSettled(s).then(()=>{this._done.resolve(t||null)}),this._done}get stopped(){return this._done}get isStopped(){return this._stopped}stop(t){return this.close(t)}ping(){return{type:_o.PING,name:this.name,id:this.id,version:this.version,metadata:this.metadata}}reset(){if(this.started=new Date().toISOString(),this.handlers)for(const t of this.handlers)t.stats.reset(t.qi)}addGroup(t,s){return new Ao(this,t,s)}addEndpoint(t,s){return new Ao(this).addEndpoint(t,s)}_addEndpoint(t){const s=new Ut;s.noIterator=typeof t.handler=="function",s.noIterator||(t.handler=(o,c)=>{o?this.stop(o).catch():s.push(new ub(c))},s.iterClosed.then(()=>{this.close().catch()}));const i=this.setupHandler(t,!1);return i.qi=s,this.handlers.push(i),s}}class O2{constructor(t,s,i=""){j(this,"name");j(this,"subject");j(this,"average_processing_time");j(this,"num_requests");j(this,"processing_time");j(this,"num_errors");j(this,"last_error");j(this,"data");j(this,"metadata");j(this,"queue");this.name=t,this.subject=s,this.average_processing_time=0,this.num_errors=0,this.num_requests=0,this.processing_time=0,this.queue=i}reset(t){this.num_requests=0,this.processing_time=0,this.average_processing_time=0,this.num_errors=0,this.last_error=void 0,this.data=void 0;const s=t;s&&(s.time=0,s.processed=0)}countLatency(t){this.num_requests++,this.processing_time+=dt(Date.now()-t),this.average_processing_time=Math.round(this.processing_time/this.num_requests)}countError(t){this.num_errors++,this.last_error=t.message}_stats(){const{name:t,subject:s,average_processing_time:i,num_errors:o,num_requests:c,processing_time:m,last_error:p,data:g,queue:u}=this;return{name:t,subject:s,average_processing_time:i,num_errors:o,num_requests:c,processing_time:m,last_error:p,data:g,queue_group:u}}stats(t){const s=t;return(s==null?void 0:s.noIterator)===!1&&(this.processing_time=dt(s.time),this.num_requests=s.processed,this.average_processing_time=this.processing_time>0&&this.num_requests>0?this.processing_time/this.num_requests:0),this._stats()}}class A2{constructor(t,s={strategy:Wn.JitterTimer,maxWait:2e3},i){j(this,"nc");j(this,"prefix");j(this,"opts");this.nc=t,this.prefix=i,this.opts=s}ping(t="",s=""){return this.q(vs.PING,t,s)}stats(t="",s=""){return this.q(vs.STATS,t,s)}info(t="",s=""){return this.q(vs.INFO,t,s)}async q(t,s="",i=""){const o=new Ut,c=Zn(),m=Do.controlSubject(t,s,i,this.prefix),p=await this.nc.requestMany(m,jn,this.opts);return(async()=>{for await(const g of p)try{const u=c.decode(g.data);o.push(u)}catch(u){o.push(()=>{o.stop(u)})}o.push(()=>{o.stop()})})().catch(g=>{o.stop(g)}),o}}function jx(){return{key:{encode(n){return n},decode(n){return n}},value:{encode(n){return n},decode(n){return n}}}}function j2(){return{replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:jx(),storage:jd.File}}const gu="KV-Operation",fb="$KV",k2=/^[-/=.\w]+$/,N2=/^[-/=.>*\w]+$/,T2=/^[-\w]+$/;function C2(n){if(n.startsWith(".")||n.endsWith(".")||!k2.test(n))throw new Error(`invalid key: ${n}`)}function M2(n){if(n.startsWith(".")||n.endsWith(".")||!N2.test(n))throw new Error(`invalid key: ${n}`)}function R2(n){if(n.startsWith(".")||n.endsWith("."))throw new Error(`invalid key: ${n}`);const t=n.split(".");let s=!1;for(let i=0;i<t.length;i++)switch(t[i]){case"*":s=!0;break;case">":if(i!==t.length-1)throw new Error(`invalid key: ${n}`);s=!0;break}return s}function su(n){if(!T2.test(n))throw new Error(`invalid bucket name: ${n}`)}var or;(function(n){n.MsgIdHdr="Nats-Msg-Id",n.ExpectedStreamHdr="Nats-Expected-Stream",n.ExpectedLastSeqHdr="Nats-Expected-Last-Sequence",n.ExpectedLastMsgIdHdr="Nats-Expected-Last-Msg-Id",n.ExpectedLastSubjectSequenceHdr="Nats-Expected-Last-Subject-Sequence"})(or||(or={}));class jo{constructor(t,s,i){j(this,"js");j(this,"jsm");j(this,"stream");j(this,"bucket");j(this,"direct");j(this,"codec");j(this,"prefix");j(this,"editPrefix");j(this,"useJsPrefix");j(this,"_prefixLen");j(this,"validateKey",C2);j(this,"validateSearchKey",M2);j(this,"hasWildcards",R2);su(t),this.js=s,this.jsm=i,this.bucket=t,this.prefix=fb,this.editPrefix="",this.useJsPrefix=!1,this._prefixLen=0}static async create(t,s,i={}){su(s);const o=await t.jetstreamManager(),c=new jo(s,t,o);return await c.init(i),c}static async bind(t,s,i={}){const o=await t.jetstreamManager(),c={config:{allow_direct:i.allow_direct}};su(s);const m=new jo(s,t,o);return c.config.name=i.streamName??m.bucketName(),Object.assign(m,c),m.stream=c.config.name,m.codec=i.codec||jx(),m.direct=c.config.allow_direct??!1,m.initializePrefixes(c),m}async init(t={}){const s=Object.assign(j2(),t);this.codec=s.codec;const i={};this.stream=i.name=t.streamName??this.bucketName(),i.retention=Ad.Limits,i.max_msgs_per_subject=s.history,s.maxBucketSize&&(s.max_bytes=s.maxBucketSize),s.max_bytes&&(i.max_bytes=s.max_bytes),i.max_msg_size=s.maxValueSize,i.storage=s.storage;const o=t.placementCluster??"";if(o&&(t.placement={},t.placement.cluster=o,t.placement.tags=[]),t.placement&&(i.placement=t.placement),t.republish&&(i.republish=t.republish),t.description&&(i.description=t.description),t.mirror){const b=Object.assign({},t.mirror);b.name.startsWith(wn)||(b.name=`${wn}${b.name}`),i.mirror=b,i.mirror_direct=!0}else if(t.sources){const b=t.sources.map(x=>{const v=Object.assign({},x),w=v.name.startsWith(wn)?v.name.substring(wn.length):v.name;return v.name.startsWith(wn)||(v.name=`${wn}${v.name}`),!x.external&&w!==this.bucket&&(v.subject_transforms=[{src:`$KV.${w}.>`,dest:`$KV.${this.bucket}.>`}]),v});i.sources=b,i.subjects=[this.subjectForBucket()]}else i.subjects=[this.subjectForBucket()];t.metadata&&(i.metadata=t.metadata),typeof t.compression=="boolean"&&(i.compression=t.compression?As.S2:As.None);const c=this.js.nc,m=c.getServerVersion(),p=m?Nd(m,ti("2.7.2"))>=0:!1;i.discard=p?Oo.New:Oo.Old;const{ok:g,min:u}=c.features.get(Ye.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 ${u}`))}t.allow_direct=typeof t.allow_direct=="boolean"?t.allow_direct:g,i.allow_direct=t.allow_direct,this.direct=i.allow_direct,i.num_replicas=s.replicas,s.ttl&&(i.max_age=dt(s.ttl)),i.allow_rollup_hdrs=!0;let d;try{d=await this.jsm.streams.info(i.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(i);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:s}=t.config;if(s){let i=s.name;if(i.startsWith(wn)&&(i=i.substring(wn.length)),s.external&&s.external.api!==""){const o=s.name.substring(wn.length);this.useJsPrefix=!1,this.prefix=`$KV.${o}`,this.editPrefix=`${s.external.api}.$KV.${i}`}else this.editPrefix=this.prefix}}bucketName(){return this.stream??`${wn}${this.bucket}`}subjectForBucket(){return`${this.prefix}.${this.bucket}.>`}subjectForKey(t,s=!1){const i=[];return s?(this.useJsPrefix&&i.push(this.js.apiPrefix),this.editPrefix!==""?i.push(this.editPrefix):i.push(this.prefix)):this.prefix&&i.push(this.prefix),i.push(t),i.join(".")}fullKeyName(t){return this.prefix!==""?`${this.prefix}.${t}`:`${fb}.${this.bucket}.${t}`}get prefixLen(){return this._prefixLen===0&&(this._prefixLen=this.prefix.length+1),this._prefixLen}encodeKey(t){const s=[];for(const i of t.split("."))switch(i){case">":case"*":s.push(i);break;default:s.push(this.codec.key.encode(i));break}return s.join(".")}decodeKey(t){const s=[];for(const i of t.split("."))switch(i){case">":case"*":s.push(i);break;default:s.push(this.codec.key.decode(i));break}return s.join(".")}close(){return Promise.resolve()}dataLen(t,s){const i=s&&s.get(Wt.MessageSizeHdr)||"";return i!==""?parseInt(i,10):t.length}smToEntry(t){return new K2(this.bucket,this.prefixLen,t)}jmToEntry(t){const s=this.decodeKey(t.subject.substring(this.prefixLen));return new J2(this.bucket,s,t)}async create(t,s){var c;let i;try{const m=await this.put(t,s,{previousSeq:0});return Promise.resolve(m)}catch(m){if(i=m,((c=m==null?void 0:m.api_error)==null?void 0:c.err_code)!==10071)return Promise.reject(m)}let o=0;try{const m=await this.get(t);return(m==null?void 0:m.operation)==="DEL"||(m==null?void 0:m.operation)==="PURGE"?(o=m!==null?m.revision:0,this.update(t,s,o)):Promise.reject(i)}catch(m){return Promise.reject(m)}}update(t,s,i){if(i<=0)throw new Error("version must be greater than 0");return this.put(t,s,{previousSeq:i})}async put(t,s,i={}){var m,p;const o=this.encodeKey(t);this.validateKey(o);const c={};if(i.previousSeq!==void 0){const g=Pr();c.headers=g,g.set(or.ExpectedLastSubjectSequenceHdr,`${i.previousSeq}`)}try{return(await this.js.publish(this.subjectForKey(o,!0),s,c)).seq}catch(g){const u=g;return u.isJetStreamError()?(u.message=(m=u.api_error)==null?void 0:m.description,u.code=`${(p=u.api_error)==null?void 0:p.code}`,Promise.reject(u)):Promise.reject(g)}}async get(t,s){const i=this.encodeKey(t);this.validateKey(i);let o={last_by_subj:this.subjectForKey(i)};s&&s.revision>0&&(o={seq:s.revision});let c;try{this.direct?c=await this.jsm.direct.getMessage(this.bucketName(),o):c=await this.jsm.streams.getMessage(this.bucketName(),o);const m=this.smToEntry(c);return m.key!==i?null:m}catch(m){if(m.code===fe.JetStream404NoMessages)return null;throw m}}purge(t,s){return this._deleteOrPurge(t,"PURGE",s)}delete(t,s){return this._deleteOrPurge(t,"DEL",s)}async purgeDeletes(t=1800*1e3){const s=mt(),i=[],o=await this.watch({key:">",initializedFn:()=>{s.resolve()}});(async()=>{for await(const g of o)(g.operation==="DEL"||g.operation==="PURGE")&&i.push(g)})().then(),await s,o.stop();const c=Date.now()-t,m=i.map(g=>{const u=this.subjectForKey(g.key);return g.created.getTime()>=c?this.jsm.streams.purge(this.stream,{filter:u,keep:1}):this.jsm.streams.purge(this.stream,{filter:u,keep:0})}),p=await Promise.all(m);return p.unshift({success:!0,purged:0}),p.reduce((g,u)=>(g.purged+=u.purged,g))}async _deleteOrPurge(t,s,i){if(!this.hasWildcards(t))return this._doDeleteOrPurge(t,s,i);const o=await this.keys(t),c=[];for await(const m of o)c.push(this._doDeleteOrPurge(m,s)),c.length===100&&(await Promise.all(c),c.length=0);c.length>0&&await Promise.all(c)}async _doDeleteOrPurge(t,s,i){const o=this.encodeKey(t);this.validateKey(o);const c=Pr();c.set(gu,s),s==="PURGE"&&c.set(Wt.RollupHdr,Wt.RollupValueSubject),i!=null&&i.previousSeq&&c.set(or.ExpectedLastSubjectSequenceHdr,`${i.previousSeq}`),await this.js.publish(this.subjectForKey(o,!0),jn,{headers:c})}_buildCC(t,s,i={}){let c=(Array.isArray(t)?t:[t]).map(g=>{const u=this.encodeKey(g);return this.validateSearchKey(g),this.fullKeyName(u)}),m=Et.LastPerSubject;s===Qn.AllHistory&&(m=Et.All),s===Qn.UpdatesOnly&&(m=Et.New);let p;return c.length===1&&(p=c[0],c=void 0),Object.assign({deliver_policy:m,ack_policy:Bt.None,filter_subjects:c,filter_subject:p,flow_control:!0,idle_heartbeat:dt(5*1e3)},i)}remove(t){return this.purge(t)}async history(t={}){const s=t.key??">",i=new Ut,o={};o.headers_only=t.headers_only||!1;let c;c=()=>{i.stop()};let m=0;const p=this._buildCC(s,Qn.AllHistory,o),g=p.filter_subject,u=ws(p);u.bindStream(this.stream),u.orderedConsumer(),u.callback((b,x)=>{if(b){i.stop(b);return}if(x){const v=this.jmToEntry(x);i.push(v),i.received++,(c&&m>0&&i.received>=m||x.info.pending===0)&&(i.push(c),c=void 0)}});const d=await this.js.subscribe(g,u);if(c){const{info:{last:b}}=d,x=b.num_pending+b.delivered.consumer_seq;if(x===0||i.received>=x)try{c()}catch(v){i.stop(v)}finally{c=void 0}else m=x}return i._data=d,i.iterClosed.then(()=>{d.unsubscribe()}),d.closed.then(()=>{i.stop()}).catch(b=>{i.stop(b)}),i}canSetWatcherName(){const s=this.js.nc,{ok:i}=s.features.get(Ye.JS_NEW_CONSUMER_CREATE_API);return i}async watch(t={}){const s=t.key??">",i=new Ut,o={};o.headers_only=t.headers_only||!1;let c=Qn.LastValue;t.include===Qn.AllHistory?c=Qn.AllHistory:t.include===Qn.UpdatesOnly&&(c=Qn.UpdatesOnly);const m=t.ignoreDeletes===!0;let p=t.initializedFn,g=0;const u=this._buildCC(s,c,o),d=u.filter_subject,b=ws(u);this.canSetWatcherName()&&b.consumerName(Os.next()),b.bindStream(this.stream),t.resumeFromRevision&&t.resumeFromRevision>0&&b.startSequence(t.resumeFromRevision),b.orderedConsumer(),b.callback((v,w)=>{if(v){i.stop(v);return}if(w){const S=this.jmToEntry(w);if(m&&S.operation==="DEL")return;i.push(S),i.received++,p&&(g>0&&i.received>=g||w.info.pending===0)&&(i.push(p),p=void 0)}});const x=await this.js.subscribe(d,b);if(p){const{info:{last:v}}=x,w=v.num_pending+v.delivered.consumer_seq;if(w===0||i.received>=w)try{p()}catch(S){i.stop(S)}finally{p=void 0}else g=w}return i._data=x,i.iterClosed.then(()=>{x.unsubscribe()}),x.closed.then(()=>{i.stop()}).catch(v=>{i.stop(v)}),i}async keys(t=">"){const s=new Ut,i=this._buildCC(t,Qn.LastValue,{headers_only:!0}),o=Array.isArray(t)?">":i.filter_subject,c=ws(i);c.bindStream(this.stream),c.orderedConsumer();const m=await this.js.subscribe(o,c);return(async()=>{var g;for await(const u of m){const d=(g=u.headers)==null?void 0:g.get(gu);if(d!=="DEL"&&d!=="PURGE"){const b=this.decodeKey(u.subject.substring(this.prefixLen));s.push(b)}u.info.pending===0&&m.unsubscribe()}})().then(()=>{s.stop()}).catch(g=>{s.stop(g)}),m.info.last.num_pending===0&&m.unsubscribe(),s}purgeBucket(t){return this.jsm.streams.purge(this.bucketName(),t)}destroy(){return this.jsm.streams.delete(this.bucketName())}async status(){var c;const s=((c=this.js.nc.info)==null?void 0:c.cluster)??"",i=this.bucketName(),o=await this.jsm.streams.info(i);return new kx(o,s)}}class kx{constructor(t,s=""){j(this,"si");j(this,"cluster");this.si=t,this.cluster=s}get bucket(){return this.si.config.name.startsWith(wn)?this.si.config.name.substring(wn.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 cm(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!==As.None:!1}}const hm="OBJ_",hb="SHA-256=";function D2(n){return su(n),`${hm}${n}`}function L2(n){return n.startsWith(hm)?n.substring(4):n}class Rd{constructor(t){j(this,"si");j(this,"backingStore");this.si=t,this.backingStore="JetStream"}get bucket(){return L2(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!==As.None:!1}}function cc(n){if(n===void 0)return;const{domain:t}=n;if(t===void 0)return n;const s=Object.assign({},n);if(delete s.domain,t==="")return s;if(s.external)throw new Error("domain and external are both set");return s.external={api:`$JS.${t}.API`},s}var zn;(function(n){n[n.Unset=-1]="Unset",n[n.Consume=0]="Consume",n[n.Fetch=1]="Fetch"})(zn||(zn={}));var lr;(function(n){n.HeartbeatsMissed="heartbeats_missed",n.ConsumerNotFound="consumer_not_found",n.StreamNotFound="stream_not_found",n.ConsumerDeleted="consumer_deleted",n.OrderedConsumerRecreated="ordered_consumer_recreated",n.NoResponders="no_responders"})(lr||(lr={}));var Zi;(function(n){n.DebugEvent="debug",n.Discard="discard",n.Reset="reset",n.Next="next"})(Zi||(Zi={}));const db=Uint8Array.of(43,65,67,75),q2=Uint8Array.of(45,78,65,75),so=Uint8Array.of(43,87,80,73),P2=Uint8Array.of(43,78,88,84),B2=Uint8Array.of(43,84,69,82,77),U2=Uint8Array.of(32);function ko(n,t=5e3){return new nO(n,t)}class rd extends Ut{constructor(s,i,o=!1){super();j(this,"consumer");j(this,"opts");j(this,"sub");j(this,"monitor");j(this,"pending");j(this,"inbox");j(this,"refilling");j(this,"pong");j(this,"callback");j(this,"timeout");j(this,"cleanupHandler");j(this,"listeners");j(this,"statusIterator");j(this,"forOrderedConsumer");j(this,"resetHandler");j(this,"abortOnMissingResource");j(this,"bind");j(this,"inBackOff");this.consumer=s;const c=i;this.opts=this.parseOptions(i,o),this.callback=c.callback||null,this.noIterator=typeof this.callback=="function",this.monitor=null,this.pong=null,this.pending={msgs:0,bytes:0,requests:0},this.refilling=o,this.timeout=null,this.inbox=Lr(s.api.nc.options.inboxPrefix),this.listeners=[],this.forOrderedConsumer=!1,this.abortOnMissingResource=c.abort_on_missing_resource===!0,this.bind=c.bind===!0,this.inBackOff=!1,this.start()}start(){const{max_messages:s,max_bytes:i,idle_heartbeat:o,threshold_bytes:c,threshold_messages: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,u)=>{var b,x,v,w;if(g){this.stop(g);return}if((b=this.monitor)==null||b.work(),u.subject===this.inbox){if(Od(u))return;const S=(x=u.headers)==null?void 0:x.code,C=((w=(v=u.headers)==null?void 0:v.description)==null?void 0:w.toLowerCase())||"unknown",{msgsLeft:P,bytesLeft:q}=this.parseDiscard(u.headers);if(P>0||q>0)this.pending.msgs-=P,this.pending.bytes-=q,this.pending.requests--,this.notify(Zi.Discard,{msgsLeft:P,bytesLeft:q});else if(S===400){this.stop(new ge(C,`${S}`));return}else if(S===409&&C==="consumer deleted"){if(this.notify(lr.ConsumerDeleted,`${S} ${C}`),!this.refilling||this.abortOnMissingResource){const re=new ge(C,`${S}`);this.stop(re);return}}else if(S===503){if(this.notify(lr.NoResponders,`${S} No Responders`),!this.refilling||this.abortOnMissingResource){const re=new ge("no responders",`${S}`);this.stop(re);return}}else this.notify(Zi.DebugEvent,`${S} ${C}`)}else this._push(ko(u,this.consumer.api.timeout)),this.received++,this.pending.msgs&&this.pending.msgs--,this.pending.bytes&&(this.pending.bytes-=u.size());if(this.pending.msgs===0&&this.pending.bytes===0&&(this.pending.requests=0),this.refilling){if(s&&this.pending.msgs<=m||i&&this.pending.bytes<=c){const S=this.pullOptions();this.pull(S)}}else this.pending.requests===0&&this._push(()=>{this.stop()})}}),this.sub.closed.then(()=>{this.sub.draining&&this._push(()=>{this.stop()})}),o&&(this.monitor=new fm(o,g=>(this.notify(lr.HeartbeatsMissed,g),this.resetPending().then(()=>{}).catch(()=>{}),!1),{maxOut:2})),(async()=>{var u;const g=this.consumer.api.nc.status();this.statusIterator=g;for await(const d of g)switch(d.type){case Dr.Disconnect:(u=this.monitor)==null||u.cancel();break;case Dr.Reconnect:this.resetPending().then(b=>{var x;b&&((x=this.monitor)==null||x.restart())}).catch(()=>{});break}})(),this.pull(this.pullOptions())}_push(s){if(!this.callback)super.push(s);else{const i=typeof s=="function"?s:null;try{i?i():this.callback(s)}catch(o){this.stop(o)}}}notify(s,i){this.listeners.length>0&&this.listeners.forEach(o=>{o.done||o.push({type:s,data:i})})}resetPending(){return this.bind?this.resetPendingNoInfo():this.resetPendingWithInfo()}resetPendingNoInfo(){return this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),Promise.resolve(!0)}async resetPendingWithInfo(){if(this.inBackOff)return!1;let s=0,i=0;const o=lm([this.opts.expires]);let c=0;for(;;){if(this.done)return!1;if(this.consumer.api.nc.isClosed())return console.error("aborting resetPending - connection is closed"),!1;try{return await this.consumer.info(),this.inBackOff=!1,s=0,this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),!0}catch(m){if(m.message==="stream not found"){if(i++,this.notify(lr.StreamNotFound,i),!this.refilling||this.abortOnMissingResource)return this.stop(m),!1}else if(m.message==="consumer not found"){if(s++,this.notify(lr.ConsumerNotFound,s),this.resetHandler)try{this.resetHandler()}catch{}if(!this.refilling||this.abortOnMissingResource)return this.stop(m),!1;if(this.forOrderedConsumer)return!1}else s=0,i=0;this.inBackOff=!0;const p=o.backoff(c),g=ia(p);await Promise.race([g,this.consumer.api.nc.closed()]),g.cancel(),c++}}}pull(s){this.pending.bytes+=s.max_bytes??0,this.pending.msgs+=s.batch??0,this.pending.requests++;const i=this.consumer.api.nc;this._push(()=>{i.publish(`${this.consumer.api.prefix}.CONSUMER.MSG.NEXT.${this.consumer.stream}.${this.consumer.name}`,this.consumer.api.jc.encode(s),{reply:this.inbox}),this.notify(Zi.Next,s)})}pullOptions(){const s=this.opts.max_messages-this.pending.msgs,i=this.opts.max_bytes-this.pending.bytes,o=dt(this.opts.idle_heartbeat),c=dt(this.opts.expires);return{batch:s,max_bytes:i,idle_heartbeat:o,expires:c}}parseDiscard(s){const i={msgsLeft:0,bytesLeft:0},o=s==null?void 0:s.get(Wt.PendingMessagesHdr);o&&(i.msgsLeft=parseInt(o));const c=s==null?void 0:s.get(Wt.PendingBytesHdr);return c&&(i.bytesLeft=parseInt(c)),i}trackTimeout(s){this.timeout=s}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}clearTimers(){var s,i;(s=this.monitor)==null||s.cancel(),this.monitor=null,(i=this.timeout)==null||i.cancel(),this.timeout=null}setCleanupHandler(s){this.cleanupHandler=s}stop(s){var i,o;this.done||((i=this.sub)==null||i.unsubscribe(),this.clearTimers(),(o=this.statusIterator)==null||o.stop(),this._push(()=>{super.stop(s),this.listeners.forEach(c=>{c.stop()})}))}parseOptions(s,i=!1){const o=s||{};if(o.max_messages=o.max_messages||0,o.max_bytes=o.max_bytes||0,o.max_messages!==0&&o.max_bytes!==0)throw new Error("only specify one of max_messages or max_bytes");if(o.max_messages===0&&(o.max_messages=100),o.expires=o.expires||3e4,o.expires<1e3)throw new Error("expires should be at least 1000ms");if(o.idle_heartbeat=o.idle_heartbeat||o.expires/2,o.idle_heartbeat=o.idle_heartbeat>3e4?3e4:o.idle_heartbeat,i){const c=Math.round(o.max_messages*.75)||1;o.threshold_messages=o.threshold_messages||c;const m=Math.round(o.max_bytes*.75)||1;o.threshold_bytes=o.threshold_bytes||m}return o}status(){const s=new Ut;return this.listeners.push(s),Promise.resolve(s)}}class z2 extends Ut{constructor(){super();j(this,"src");j(this,"listeners");this.listeners=[]}setSource(s){this.src&&(this.src.resetHandler=void 0,this.src.setCleanupHandler(),this.src.stop()),this.src=s,this.src.setCleanupHandler(i=>{this.stop(i||void 0)}),(async()=>{const i=await this.src.status();for await(const o of i)this.notify(o.type,o.data)})().catch(()=>{})}notify(s,i){this.listeners.length>0&&this.listeners.forEach(o=>{o.done||o.push({type:s,data:i})})}stop(s){var i;this.done||((i=this.src)==null||i.stop(s),super.stop(s),this.listeners.forEach(o=>{o.stop()}))}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}status(){const s=new Ut;return this.listeners.push(s),Promise.resolve(s)}}class Dd{constructor(t,s){j(this,"api");j(this,"_info");j(this,"stream");j(this,"name");this.api=t,this._info=s,this.stream=s.stream_name,this.name=s.name}consume(t={max_messages:100,expires:3e4}){return Promise.resolve(new rd(this,t,!0))}fetch(t={max_messages:100,expires:3e4}){const s=new rd(this,t,!1),i=Math.round(s.opts.expires*1.05),o=na(i);return s.closed().catch(()=>{}).finally(()=>{o.cancel()}),o.catch(()=>{s.close().catch()}),s.trackTimeout(o),Promise.resolve(s)}next(t={expires:3e4}){const s=mt(),i=t;i.max_messages=1;const o=new rd(this,i,!1),c=Math.round(o.opts.expires*1.05);c>=6e4&&(async()=>{for await(const p of await o.status())if(p.type===lr.HeartbeatsMissed&&p.data>=2){s.reject(new Error("consumer missed heartbeats"));break}})().catch(),(async()=>{for await(const p of o){s.resolve(p);break}})().catch(()=>{});const m=na(c);return o.closed().then(p=>{p?s.reject(p):s.resolve(null)}).catch(p=>{s.reject(p)}).finally(()=>{m.cancel()}),m.catch(p=>{s.resolve(null),o.close().catch()}),o.trackTimeout(m),s}delete(){const{stream_name:t,name:s}=this._info;return this.api.delete(t,s)}info(t=!1){if(t)return Promise.resolve(this._info);const{stream_name:s,name:i}=this._info;return this.api.info(s,i).then(o=>(this._info=o,this._info))}}class I2{constructor(t,s,i={}){j(this,"api");j(this,"consumerOpts");j(this,"consumer");j(this,"opts");j(this,"cursor");j(this,"stream");j(this,"namePrefix");j(this,"serial");j(this,"currentConsumer");j(this,"userCallback");j(this,"iter");j(this,"type");j(this,"startSeq");j(this,"maxInitialReset");this.api=t,this.stream=s,this.cursor={stream_seq:1,deliver_seq:0},this.namePrefix=Os.next(),typeof i.name_prefix=="string"&&(Au("name_prefix",i.name_prefix),this.namePrefix=i.name_prefix+this.namePrefix),this.serial=0,this.currentConsumer=null,this.userCallback=null,this.iter=null,this.type=zn.Unset,this.consumerOpts=i,this.maxInitialReset=30,this.startSeq=this.consumerOpts.opt_start_seq||0,this.cursor.stream_seq=this.startSeq>0?this.startSeq-1:0}getConsumerOpts(t){this.serial++;const s=`${this.namePrefix}_${this.serial}`;t=t===0?1:t;const i={name:s,deliver_policy:Et.StartSequence,opt_start_seq:t,ack_policy:Bt.None,inactive_threshold:dt(300*1e3),num_replicas:1};return this.consumerOpts.headers_only===!0&&(i.headers_only=!0),Array.isArray(this.consumerOpts.filterSubjects)&&(i.filter_subjects=this.consumerOpts.filterSubjects),typeof this.consumerOpts.filterSubjects=="string"&&(i.filter_subject=this.consumerOpts.filterSubjects),this.consumerOpts.replay_policy&&(i.replay_policy=this.consumerOpts.replay_policy),t===this.startSeq+1&&(i.deliver_policy=this.consumerOpts.deliver_policy||Et.StartSequence,(this.consumerOpts.deliver_policy===Et.LastPerSubject||this.consumerOpts.deliver_policy===Et.New||this.consumerOpts.deliver_policy===Et.Last)&&(delete i.opt_start_seq,i.deliver_policy=this.consumerOpts.deliver_policy),i.deliver_policy===Et.LastPerSubject&&typeof i.filter_subjects>"u"&&typeof i.filter_subject>"u"&&(i.filter_subject=">"),this.consumerOpts.opt_start_time&&(delete i.opt_start_seq,i.deliver_policy=Et.StartTime,i.opt_start_time=this.consumerOpts.opt_start_time),this.consumerOpts.inactive_threshold&&(i.inactive_threshold=dt(this.consumerOpts.inactive_threshold))),i}async resetConsumer(t=0){var m,p,g,u,d;Os.next();const s=this.serial===0;(m=this.consumer)==null||m.delete().catch(()=>{}),t=t===0?1:t,this.cursor.deliver_seq=0;const i=this.getConsumerOpts(t);i.max_deliver=1,i.mem_storage=!0;const o=lm([((p=this.opts)==null?void 0:p.expires)||3e4]);let c;for(let b=0;;b++)try{c=await this.api.add(this.stream,i),(g=this.iter)==null||g.notify(lr.OrderedConsumerRecreated,c.name);break}catch(x){if(x.message==="stream not found"&&((u=this.iter)==null||u.notify(lr.StreamNotFound,b),this.type===zn.Fetch||this.opts.abort_on_missing_resource===!0))return(d=this.iter)==null||d.stop(x),Promise.reject(x);if(s&&b>=this.maxInitialReset)throw x;await ia(o.backoff(b+1))}return c}internalHandler(t){return s=>{var o;if(this.serial!==t)return;const i=s.info.deliverySequence;if(i!==this.cursor.deliver_seq+1){this.notifyOrderedResetAndReset();return}this.cursor.deliver_seq=i,this.cursor.stream_seq=s.info.streamSequence,this.userCallback?this.userCallback(s):(o=this.iter)==null||o.push(s)}}async reset(t={max_messages:100,expires:3e4},s){var g,u;s=s||{};const i=s.fromFetch||!1,o=s.orderedReset||!1;if(this.type===zn.Fetch&&o){(g=this.iter)==null||g.src.stop(),await((u=this.iter)==null?void 0:u.closed()),this.currentConsumer=null;return}(this.currentConsumer===null||o)&&(this.currentConsumer=await this.resetConsumer(this.cursor.stream_seq+1)),(this.iter===null||i)&&(this.iter=new z2),this.consumer=new Dd(this.api,this.currentConsumer);const c=t;c.callback=this.internalHandler(this.serial);let m=null;this.type===zn.Fetch&&i?m=await this.consumer.fetch(t):this.type===zn.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(Zi.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===zn.Fetch)return Promise.reject(new Error("ordered consumer initialized as fetch"));if(this.type===zn.Consume)return Promise.reject(new Error("ordered consumer doesn't support concurrent consume"));const{callback:i}=t;return i&&(this.userCallback=i),this.type=zn.Consume,this.opts=t,await this.reset(t),this.iter}async fetch(t={max_messages:100,expires:3e4}){var o;if(t.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===zn.Consume)return Promise.reject(new Error("ordered consumer already initialized as consume"));if(((o=this.iter)==null?void 0:o.done)===!1)return Promise.reject(new Error("ordered consumer doesn't support concurrent fetch"));const{callback:i}=t;return i&&(this.userCallback=i),this.type=zn.Fetch,this.opts=t,await this.reset(t,{fromFetch:!0}),this.iter}async next(t={expires:3e4}){const s=t;if(s.bind)return Promise.reject(new Error("bind is not supported"));s.max_messages=1;const i=mt();return s.callback=c=>{this.userCallback=null,i.resolve(c)},(await this.fetch(s)).iterClosed.then(c=>{c&&i.reject(c),i.resolve(null)}).catch(c=>{i.reject(c)}),i}delete(){return this.currentConsumer?this.api.delete(this.stream,this.currentConsumer.name).then(t=>Promise.resolve(t)).catch(t=>Promise.reject(t)).finally(()=>{this.currentConsumer=null}):Promise.resolve(!1)}async info(t){return this.currentConsumer==null?(this.currentConsumer=await this.resetConsumer(this.startSeq),Promise.resolve(this.currentConsumer)):t&&this.currentConsumer?Promise.resolve(this.currentConsumer):this.api.info(this.stream,this.currentConsumer.name)}}class Ld{constructor(t){j(this,"api");j(this,"notified");this.api=t,this.notified=!1}checkVersion(){const t=this.api.nc.features.get(Ye.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 Dd(this.api,t)}async get(t,s={}){return typeof s=="object"?this.ordered(t,s):(await this.checkVersion(),this.api.info(t,s).then(i=>i.config.deliver_subject!==void 0?Promise.reject(new Error("push consumer not supported")):new Dd(this.api,i)).catch(i=>Promise.reject(i)))}async ordered(t,s){await this.checkVersion();const i=this.api;return new dm(i.nc,i.opts).info(t).then(c=>Promise.resolve(new I2(this.api,t,s))).catch(c=>Promise.reject(c))}}class ku{constructor(t,s){j(this,"api");j(this,"_info");this.api=t,this._info=s}get name(){return this._info.config.name}alternates(){return this.info().then(t=>t.alternates?t.alternates:[])}async best(){if(await this.info(),this._info.alternates){const t=await this.api.info(this._info.alternates[0].name);return new ku(this.api,t)}else return this}info(t=!1,s){return t?Promise.resolve(this._info):this.api.info(this.name,s).then(i=>(this._info=i,this._info))}getConsumerFromInfo(t){return new Ld(new mu(this.api.nc,this.api.opts)).getPullConsumerFor(t)}getConsumer(t){return new Ld(new mu(this.api.nc,this.api.opts)).get(this.name,t)}getMessage(t){return this.api.getMessage(this.name,t)}deleteMessage(t,s){return this.api.deleteMessage(this.name,t,s)}}class dm extends Ro{constructor(t,s){super(t,s)}checkStreamConfigVersions(t){const s=this.nc;if(t.metadata){const{min:o,ok:c}=s.features.get(Ye.JS_STREAM_CONSUMER_METADATA);if(!c)throw new Error(`stream 'metadata' requires server ${o}`)}if(t.first_seq){const{min:o,ok:c}=s.features.get(Ye.JS_STREAM_FIRST_SEQ);if(!c)throw new Error(`stream 'first_seq' requires server ${o}`)}if(t.subject_transform){const{min:o,ok:c}=s.features.get(Ye.JS_STREAM_SUBJECT_TRANSFORM);if(!c)throw new Error(`stream 'subject_transform' requires server ${o}`)}if(t.compression){const{min:o,ok:c}=s.features.get(Ye.JS_STREAM_COMPRESSION);if(!c)throw new Error(`stream 'compression' requires server ${o}`)}if(t.consumer_limits){const{min:o,ok:c}=s.features.get(Ye.JS_DEFAULT_CONSUMER_LIMITS);if(!c)throw new Error(`stream 'consumer_limits' requires server ${o}`)}function i(o,c){var p;if((((p=c==null?void 0:c.subject_transforms)==null?void 0:p.length)||0)>0){const{min:g,ok:u}=s.features.get(Ye.JS_STREAM_SOURCE_SUBJECT_TRANSFORM);if(!u)throw new Error(`${o} 'subject_transforms' requires server ${g}`)}}t.sources&&t.sources.forEach(o=>{i("stream sources",o)}),t.mirror&&i("stream mirror",t.mirror)}async add(t={}){var o;this.checkStreamConfigVersions(t),Jt(t.name),t.mirror=cc(t.mirror),t.sources=(o=t.sources)==null?void 0:o.map(cc);const i=await this._request(`${this.prefix}.STREAM.CREATE.${t.name}`,t);return this._fixInfo(i),i}async delete(t){return Jt(t),(await this._request(`${this.prefix}.STREAM.DELETE.${t}`)).success}async update(t,s={}){var p;if(typeof t=="object"){const g=t;t=g.name,s=g,console.trace("\x1B[33m >> streams.update(config: StreamConfig) api changed to streams.update(name: string, config: StreamUpdateConfig) - this shim will be removed - update your code. \x1B[0m")}this.checkStreamConfigVersions(s),Jt(t);const i=await this.info(t),o=Object.assign(i.config,s);o.mirror=cc(o.mirror),o.sources=(p=o.sources)==null?void 0:p.map(cc);const m=await this._request(`${this.prefix}.STREAM.UPDATE.${t}`,o);return this._fixInfo(m),m}async info(t,s){Jt(t);const i=`${this.prefix}.STREAM.INFO.${t}`;let c=await this._request(i,s),{total:m,limit:p}=c,g=c.state.subjects?Object.getOwnPropertyNames(c.state.subjects).length:1;if(m&&m>g){const u=[c],d=s||{};let b=0;for(;m>g;){b++,d.offset=p*b;const v=await this._request(i,d);m=v.total,u.push(v);const w=Object.getOwnPropertyNames(v.state.subjects).length;if(g+=w,w<p)break}let x={};for(let v=0;v<u.length;v++)c=u[v],c.state.subjects&&(x=Object.assign(x,c.state.subjects));c.offset=0,c.total=0,c.limit=0,c.state.subjects=x}return this._fixInfo(c),c}list(t=""){const s=t!=null&&t.length?{subject:t}:{},i=c=>{const m=c;return m.streams.forEach(p=>{this._fixInfo(p)}),m.streams},o=`${this.prefix}.STREAM.LIST`;return new bo(o,i,this,s)}_fixInfo(t){t.config.sealed=t.config.sealed||!1,t.config.deny_delete=t.config.deny_delete||!1,t.config.deny_purge=t.config.deny_purge||!1,t.config.allow_rollup_hdrs=t.config.allow_rollup_hdrs||!1}async purge(t,s){if(s){const{keep:o,seq:c}=s;if(typeof o=="number"&&typeof c=="number")throw new Error("can specify one of keep or seq")}return Jt(t),await this._request(`${this.prefix}.STREAM.PURGE.${t}`,s)}async deleteMessage(t,s,i=!0){Jt(t);const o={seq:s};return i||(o.no_erase=!0),(await this._request(`${this.prefix}.STREAM.MSG.DELETE.${t}`,o)).success}async getMessage(t,s){Jt(t);const o=await this._request(`${this.prefix}.STREAM.MSG.GET.${t}`,s);return new Nx(o)}find(t){return this.findStream(t)}listKvs(){const t=i=>{var g;const c=i.streams.filter(u=>u.config.name.startsWith(wn));c.forEach(u=>{this._fixInfo(u)});let m="";return c.length&&(m=((g=this.nc.info)==null?void 0:g.cluster)??""),c.map(u=>new kx(u,m))},s=`${this.prefix}.STREAM.LIST`;return new bo(s,t,this)}listObjectStores(){const t=i=>{const c=i.streams.filter(p=>p.config.name.startsWith(hm));return c.forEach(p=>{this._fixInfo(p)}),c.map(p=>new Rd(p))},s=`${this.prefix}.STREAM.LIST`;return new bo(s,t,this)}names(t=""){const s=t!=null&&t.length?{subject:t}:{},i=c=>c.streams,o=`${this.prefix}.STREAM.NAMES`;return new bo(o,i,this,s)}async get(t){const s=await this.info(t);return Promise.resolve(new ku(this,s))}}class $2 extends Ro{constructor(t,s){super(t,s)}async getMessage(t,s){Jt(t);let i=s;const{last_by_subj:o}=i;o&&(i=null);const c=i?this.jc.encode(i):jn,m=this.opts.apiPrefix||"$JS.API",p=o?`${m}.DIRECT.GET.${t}.${o}`:`${m}.DIRECT.GET.${t}`,g=await this.nc.request(p,c,{timeout:this.timeout}),u=Xi(g);if(u)return Promise.reject(u);const d=new qd(g);return Promise.resolve(d)}async getBatch(t,s){Jt(t);const o=`${this.opts.apiPrefix||"$JS.API"}.DIRECT.GET.${t}`;if(!Array.isArray(s.multi_last)||s.multi_last.length===0)return Promise.reject("multi_last is required");const c=JSON.stringify(s,(g,u)=>g==="up_to_time"&&u instanceof Date?u.toISOString():u),m=new Ut,p=await this.nc.requestMany(o,c,{strategy:Wn.SentinelMsg});return(async()=>{var b,x,v;let g=!1,u=!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=(x=w.headers)==null?void 0:x.description.toLowerCase();break}if(((v=w.headers)==null?void 0:v.get("Nats-Num-Pending"))===""){u=!0;break}}if(w.data.length===0)break;m.push(new qd(w))}m.push(()=>{if(u)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 qd{constructor(t){j(this,"data");j(this,"header");if(!t.headers)throw new Error("headers expected");this.data=t.data,this.header=t.headers}get subject(){return this.header.last(Ki.Subject)}get seq(){const t=this.header.last(Ki.Sequence);return typeof t=="string"?parseInt(t):0}get time(){return new Date(Date.parse(this.timestamp))}get timestamp(){return this.header.last(Ki.TimeStamp)}get stream(){return this.header.last(Ki.Stream)}json(t){return Zn(t).decode(this.data)}string(){return En.decode(this.data)}}j(qd,"jc");class H2 extends Ro{constructor(s,i){super(s,i);j(this,"streams");j(this,"consumers");j(this,"direct");this.streams=new dm(s,i),this.consumers=new mu(s,i),this.direct=new $2(s,i)}async getAccountInfo(){return await this._request(`${this.prefix}.INFO`)}jetstream(){return this.nc.jetstream(this.getOptions())}advisories(){const s=new Ut;return this.nc.subscribe("$JS.EVENT.ADVISORY.>",{callback:(i,o)=>{if(i)throw i;try{const c=this.parseJsResponse(o),m=c.type.split("."),p=m[m.length-1];s.push({kind:p,data:c})}catch(c){s.stop(c)}}}),s}}class Nx{constructor(t){j(this,"_header");j(this,"smr");this.smr=t}get subject(){return this.smr.message.subject}get seq(){return this.smr.message.seq}get timestamp(){return this.smr.message.time}get time(){return new Date(Date.parse(this.timestamp))}get data(){return this.smr.message.data?this._parse(this.smr.message.data):jn}get header(){if(!this._header)if(this.smr.message.hdrs){const t=this._parse(this.smr.message.hdrs);this._header=_s.decode(t)}else this._header=Pr();return this._header}_parse(t){const s=atob(t),i=s.length,o=new Uint8Array(i);for(let c=0;c<i;c++)o[c]=s.charCodeAt(c);return o}json(t){return Zn(t).decode(this.data)}string(){return En.decode(this.data)}}j(Nx,"jc");class F2{constructor(t){j(this,"api");this.api=t}get(t){return this.api.info(t).then(s=>new ku(this.api,s))}}class sd{constructor(t){j(this,"info");j(this,"hdrs");this.info=t}get name(){return this.info.name}get description(){return this.info.description??""}get headers(){return this.hdrs||(this.hdrs=_s.fromRecord(this.info.headers||{})),this.hdrs}get options(){return this.info.options}get bucket(){return this.info.bucket}get chunks(){return this.info.chunks}get deleted(){return this.info.deleted??!1}get digest(){return this.info.digest}get mtime(){return this.info.mtime}get nuid(){return this.info.nuid}get size(){return this.info.size}get revision(){return this.info.revision}get metadata(){return this.info.metadata||{}}isLink(){var t,s;return((t=this.info.options)==null?void 0:t.link)!==void 0&&((s=this.info.options)==null?void 0:s.link)!==null}}function mb(n){const t={name:n.name,description:n.description??"",options:n.options,metadata:n.metadata};if(n.headers){const s=n.headers;t.headers=s.toRecord()}return t}function G2(){return new ReadableStream({pull(n){n.enqueue(new Uint8Array(0)),n.close()}})}class So{constructor(t,s,i){j(this,"jsm");j(this,"js");j(this,"stream");j(this,"name");this.name=t,this.jsm=s,this.js=i}_checkNotEmpty(t){return!t||t.length===0?{name:t,error:new Error("name cannot be empty")}:{name:t}}async info(t){const s=await this.rawInfo(t);return s?new sd(s):null}async list(){const t=[],s=await this.watch({ignoreDeletes:!0,includeHistory:!0});for await(const i of s){if(i===null)break;t.push(i)}return Promise.resolve(t)}async rawInfo(t){const{name:s,error:i}=this._checkNotEmpty(t);if(i)return Promise.reject(i);const o=this._metaSubject(s);try{const c=await this.jsm.streams.getMessage(this.stream,{last_by_subj:o}),p=Zn().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(s){return s.code==="404"?null:Promise.reject(s)}}async seal(){let t=await this._si();return t===null?Promise.reject(new Error("object store not found")):(t.config.sealed=!0,t=await this.jsm.streams.update(this.stream,t.config),Promise.resolve(new Rd(t)))}async status(t){const s=await this._si(t);return s===null?Promise.reject(new Error("object store not found")):Promise.resolve(new Rd(s))}destroy(){return this.jsm.streams.delete(this.stream)}async _put(t,s,i){var se;const o=this.js.getOptions();i=i||{timeout:o.timeout},i.timeout=i.timeout||o.timeout,i.previousRevision=i.previousRevision??void 0;const{timeout:c,previousRevision:m}=i,p=this.js.nc.info,g=(p==null?void 0:p.max_payload)||1024;t=t||{},t.options=t.options||{};let u=((se=t.options)==null?void 0:se.max_chunk_size)||128*1024;u=u>g?g:u,t.options.max_chunk_size=u;const d=await this.info(t.name),{name:b,error:x}=this._checkNotEmpty(t.name);if(x)return Promise.reject(x);const v=Os.next(),w=this._chunkSubject(v),S=this._metaSubject(b),C=Object.assign({bucket:this.name,nuid:v,size:0,chunks:0},mb(t)),P=mt(),q=[],re=new sa;try{const M=s?s.getReader():null,U=rb.create();for(;;){const{done:ae,value:z}=M?await M.read():{done:!0,value:void 0};if(ae){if(re.size()>0){const W=re.drain();U.update(W),C.chunks++,C.size+=W.length,q.push(this.js.publish(w,W,{timeout:c}))}await Promise.all(q),q.length=0,C.mtime=new Date().toISOString();const I=Wi.encode(U.digest());C.digest=`${hb}${I}`,C.deleted=!1;const D=Pr();typeof m=="number"&&D.set(or.ExpectedLastSubjectSequenceHdr,`${m}`),D.set(Wt.RollupHdr,Wt.RollupValueSubject);const X=await this.js.publish(S,Zn().encode(C),{headers:D,timeout:c});if(C.revision=X.seq,d)try{await this.jsm.streams.purge(this.stream,{filter:`$O.${this.name}.C.${d.nuid}`})}catch{}P.resolve(new sd(C));break}if(z)for(re.fill(z);re.size()>u;){C.chunks++,C.size+=u;const I=re.drain(t.options.max_chunk_size);U.update(I),q.push(this.js.publish(w,I,{timeout:c}))}}}catch(M){await this.jsm.streams.purge(this.stream,{filter:w}),P.reject(M)}return P}putBlob(t,s,i){function o(c){return new ReadableStream({pull(m){m.enqueue(c),m.close()}})}return s===null&&(s=new Uint8Array(0)),this.put(t,o(s),i)}put(t,s,i){var o;return(o=t==null?void 0:t.options)!=null&&o.link?Promise.reject(new Error("link cannot be set when putting the object in bucket")):this._put(t,s,i)}async getBlob(t){async function s(c){const m=new sa,p=c.getReader();for(;;){const{done:g,value:u}=await p.read();if(g)return m.drain();u&&u.length&&m.fill(u)}}const i=await this.get(t);if(i===null)return Promise.resolve(null);const o=await Promise.all([i.error,s(i.data)]);return o[0]?Promise.reject(o[0]):Promise.resolve(o[1])}async get(t){const s=await this.rawInfo(t);if(s===null||s.deleted)return Promise.resolve(null);if(s.options&&s.options.link){const b=s.options.link.name||"";if(b==="")throw new Error("link is a bucket");return(s.options.link.bucket!==this.name?await So.create(this.js,s.options.link.bucket):this).get(b)}if(!s.digest.startsWith(hb))return Promise.reject(new Error(`unknown digest type: ${s.digest}`));const i=kd(s.digest.substring(8));if(i===null)return Promise.reject(new Error(`unable to parse digest: ${s.digest}`));const o=mt(),c={info:new sd(s),error:o};if(s.size===0)return c.data=G2(),o.resolve(null),Promise.resolve(c);let m;const p=ws();p.orderedConsumer();const g=rb.create(),u=`$O.${this.name}.C.${s.nuid}`,d=await this.js.subscribe(u,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&&(RE(i,g.digest())?m.close():m.error(new Error(`received a corrupt object, digests do not match received: ${s.digest} calculated ${i}`)),d.unsubscribe())})().then(()=>{o.resolve()}).catch(b=>{m.error(b),o.reject(b)}),c.data=new ReadableStream({start(b){m=b},cancel(){d.unsubscribe()}}),c}linkStore(t,s){if(!(s instanceof So))return Promise.reject("bucket required");const i=s,{name:o,error:c}=this._checkNotEmpty(t);if(c)return Promise.reject(c);const m={name:o,options:{link:{bucket:i.name}}};return this._put(m,null)}async link(t,s){const{name:i,error:o}=this._checkNotEmpty(t);if(o)return Promise.reject(o);if(s.deleted)return Promise.reject(new Error("src object is deleted"));if(s.isLink())return Promise.reject(new Error("src object is a link"));const c=await this.rawInfo(t);if(c!==null&&!c.deleted)return Promise.reject(new Error("an object already exists with that name"));const m={bucket:s.bucket,name:s.name},p={name:i,bucket:s.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 s=await this.rawInfo(t);if(s===null)return Promise.resolve({purged:0,success:!1});s.deleted=!0,s.size=0,s.chunks=0,s.digest="";const i=Zn(),o=Pr();return o.set(Wt.RollupHdr,Wt.RollupValueSubject),await this.js.publish(this._metaSubject(s.name),i.encode(s),{headers:o}),this.jsm.streams.purge(this.stream,{filter:this._chunkSubject(s.nuid)})}async update(t,s={}){const i=await this.rawInfo(t);if(i===null)return Promise.reject(new Error("object not found"));if(i.deleted)return Promise.reject(new Error("cannot update meta for a deleted object"));s.name=s.name??i.name;const{name:o,error:c}=this._checkNotEmpty(s.name);if(c)return Promise.reject(c);if(t!==s.name){const g=await this.info(s.name);if(g&&!g.deleted)return Promise.reject(new Error("an object already exists with that name"))}s.name=o;const m=Object.assign({},i,mb(s)),p=await this.js.publish(this._metaSubject(m.name),JSON.stringify(m));return t!==s.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 s=!1;const i=new Ut,o=this._metaSubjectAll();try{await this.jsm.streams.getMessage(this.stream,{last_by_subj:o})}catch(g){g.code==="404"?(i.push(null),s=!0):i.stop(g)}const c=Zn(),m=ws();m.orderedConsumer(),t.includeHistory?m.deliverLastPerSubject():(s=!0,m.deliverNew()),m.callback((g,u)=>{var d;if(g){i.stop(g);return}if(u!==null){const b=c.decode(u.data);b.deleted&&t.ignoreDeletes===!0||i.push(b),((d=u.info)==null?void 0:d.pending)===0&&!s&&(s=!0,i.push(null))}});const p=await this.js.subscribe(o,m);return i._data=p,i.iterClosed.then(()=>{p.unsubscribe()}),p.closed.then(()=>{i.stop()}).catch(g=>{i.stop(g)}),i}_chunkSubject(t){return`$O.${this.name}.C.${t}`}_metaSubject(t){return`$O.${this.name}.M.${Wi.encode(t)}`}_metaSubjectAll(){return`$O.${this.name}.M.>`}async init(t={}){try{this.stream=D2(this.name)}catch(o){return Promise.reject(o)}const s=(t==null?void 0:t.ttl)||0;delete t.ttl;const i=Object.assign({max_age:s},t);i.name=this.stream,i.num_replicas=t.replicas??1,i.allow_direct=!0,i.allow_rollup_hdrs=!0,i.discard=Oo.New,i.subjects=[`$O.${this.name}.C.>`,`$O.${this.name}.M.>`],t.placement&&(i.placement=t.placement),t.metadata&&(i.metadata=t.metadata),typeof t.compression=="boolean"&&(i.compression=t.compression?As.S2:As.None);try{await this.jsm.streams.info(i.name)}catch(o){o.message==="stream not found"&&await this.jsm.streams.add(i)}}static async create(t,s,i={}){const o=await t.jetstreamManager(),c=new So(s,o,t);return await c.init(i),Promise.resolve(c)}}class V2{constructor(t){j(this,"js");this.js=t}kv(t,s={}){const i=this.js,{ok:o,min:c}=i.nc.features.get(Ye.JS_KV);return o?s.bindOnly?jo.bind(this.js,t,s):jo.create(this.js,t,s):Promise.reject(new Error(`kv is only supported on servers ${c} or better`))}os(t,s={}){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 i=this.js,{ok:o,min:c}=i.nc.features.get(Ye.JS_OBJECTSTORE);return o?So.create(this.js,t,s):Promise.reject(new Error(`objectstore is only supported on servers ${c} or better`))}}class mm extends Ro{constructor(s,i){super(s,i);j(this,"consumers");j(this,"streams");j(this,"consumerAPI");j(this,"streamAPI");this.consumerAPI=new mu(s,i),this.streamAPI=new dm(s,i),this.consumers=new Ld(this.consumerAPI),this.streams=new F2(this.streamAPI)}jetstreamManager(s){s===void 0&&(s=this.opts.checkAPI);const i=Object.assign({},this.opts,{checkAPI:s});return this.nc.jetstreamManager(i)}get apiPrefix(){return this.prefix}get views(){return new V2(this)}async publish(s,i=jn,o){o=o||{},o.expect=o.expect||{};const c=(o==null?void 0:o.headers)||Pr();o&&(o.msgID&&c.set(or.MsgIdHdr,o.msgID),o.expect.lastMsgID&&c.set(or.ExpectedLastMsgIdHdr,o.expect.lastMsgID),o.expect.streamName&&c.set(or.ExpectedStreamHdr,o.expect.streamName),typeof o.expect.lastSequence=="number"&&c.set(or.ExpectedLastSeqHdr,`${o.expect.lastSequence}`),typeof o.expect.lastSubjectSequence=="number"&&c.set(or.ExpectedLastSubjectSequenceHdr,`${o.expect.lastSubjectSequence}`));const m=o.timeout||this.timeout,p={};m&&(p.timeout=m),o&&(p.headers=c);let{retries:g,retry_delay:u}=o;g=g||1,u=u||250;let d;for(let x=0;x<g;x++)try{d=await this.nc.request(s,i,p);break}catch(v){if(v.code==="503"&&x+1<g)await ia(u);else throw v}const b=this.parseJsResponse(d);if(b.stream==="")throw ge.errorForCode(fe.JetStreamInvalidAck);return b.duplicate=b.duplicate?b.duplicate:!1,b}async pull(s,i,o=0){Jt(s),Qi(i);let c=this.timeout;o>c&&(c=o),o=o<0?0:dt(o);const m={batch:1,no_wait:o===0,expires:o},p=await this.nc.request(`${this.prefix}.CONSUMER.MSG.NEXT.${s}.${i}`,this.jc.encode(m),{noMux:!0,timeout:c}),g=Xi(p);if(g)throw g;return ko(p,this.timeout)}fetch(s,i,o={}){Jt(s),Qi(i);let c=null;const m=(o.max_bytes??0)>0;let p=0;const g=m?o.max_bytes:0;let u=null;const d={};if(d.batch=o.batch||1,g){const q=this.nc.features.get(Ye.JS_PULL_MAX_BYTES);if(!q.ok)throw new Error(`max_bytes is only supported on servers ${q.min} or better`);d.max_bytes=g}d.no_wait=o.no_wait||!1,d.no_wait&&d.expires&&(d.expires=0);const b=o.expires||0;if(b&&(d.expires=dt(b)),b===0&&d.no_wait===!1)throw new Error("expires or no_wait is required");const x=o.idle_heartbeat||0;x&&(d.idle_heartbeat=dt(x),o.delay_heartbeat===!0&&(d.idle_heartbeat=dt(x*4)));const v=new Ut,w=d.batch;let S=0;v.protocolFilterFn=(q,re=!1)=>Od(q.msg)?(u==null||u.work(),!1):!0,v.dispatchedFn=q=>{if(q){if(m&&(p+=q.data.length),S++,c&&q.info.pending===0)return;(v.getPending()===1&&q.info.pending===0||w===S||g>0&&p>=g)&&v.stop()}};const C=Lr(this.nc.options.inboxPrefix),P=this.nc.subscribe(C,{max:o.batch,callback:(q,re)=>{q===null&&(q=Xi(re)),q!==null?(c&&(c.cancel(),c=null),mE(q)?v.stop(Cx(q)===null?void 0:q):v.stop(q)):(u==null||u.work(),v.received++,v.push(ko(re,this.timeout)))}});return b&&(c=na(b),c.catch(()=>{P.isClosed()||(P.drain().catch(()=>{}),c=null),u&&u.cancel()})),(async()=>{try{x&&(u=new fm(x,q=>(v.push(()=>{v.err=new ge(`${In.IdleHeartbeatMissed}: ${q}`,fe.JetStreamIdleHeartBeat)}),!0)))}catch{}await P.closed,c!==null&&(c.cancel(),c=null),u&&u.cancel(),v.stop()})().catch(),this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${s}.${i}`,this.jc.encode(d),{reply:C}),v}async pullSubscribe(s,i=ws()){const o=await this._processOptions(s,i);if(o.ordered)throw new Error("pull subscribers cannot be be ordered");if(o.config.deliver_subject)throw new Error("consumer info specifies deliver_subject - pull consumers cannot have deliver_subject set");const c=o.config.ack_policy;if(c===Bt.None||c===Bt.All)throw new Error("ack policy for pull consumers must be explicit");const m=this._buildTypedSubscriptionOpts(o),p=new Q2(this,o.deliver,m);p.info=o;try{await this._maybeCreateConsumer(o)}catch(g){throw p.unsubscribe(),g}return p}async subscribe(s,i=ws()){const o=await this._processOptions(s,i);if(!o.isBind&&!o.config.deliver_subject)throw new Error("push consumer requires deliver_subject");const c=this._buildTypedSubscriptionOpts(o),m=new Tx(this,o.deliver,c);m.info=o;try{await this._maybeCreateConsumer(o)}catch(p){throw m.unsubscribe(),p}return m._maybeSetupHbMonitoring(),m}async _processOptions(s,i=ws()){const o=Zg(i)?i.getOpts():i;if(o.isBind=Zg(i)?i.isBind:!1,o.flow_control={heartbeat_count:0,fc_count:0,consumer_restarts:0},o.ordered){if(o.ordered_consumer_sequence={stream_seq:0,delivery_seq:0},o.config.ack_policy!==Bt.NotSet&&o.config.ack_policy!==Bt.None)throw new ge("ordered consumer: ack_policy can only be set to 'none'",fe.ApiError);if(o.config.durable_name&&o.config.durable_name.length>0)throw new ge("ordered consumer: durable_name cannot be set",fe.ApiError);if(o.config.deliver_subject&&o.config.deliver_subject.length>0)throw new ge("ordered consumer: deliver_subject cannot be set",fe.ApiError);if(o.config.max_deliver!==void 0&&o.config.max_deliver>1)throw new ge("ordered consumer: max_deliver cannot be set",fe.ApiError);if(o.config.deliver_group&&o.config.deliver_group.length>0)throw new ge("ordered consumer: deliver_group cannot be set",fe.ApiError);o.config.deliver_subject=Lr(this.nc.options.inboxPrefix),o.config.ack_policy=Bt.None,o.config.max_deliver=1,o.config.flow_control=!0,o.config.idle_heartbeat=o.config.idle_heartbeat||dt(5e3),o.config.ack_wait=dt(1320*60*1e3),o.config.mem_storage=!0,o.config.num_replicas=1}if(o.config.ack_policy===Bt.NotSet&&(o.config.ack_policy=Bt.All),o.api=this,o.config=o.config||{},o.stream=o.stream?o.stream:await this.findStream(s),o.attached=!1,o.config.durable_name)try{const c=await this.consumerAPI.info(o.stream,o.config.durable_name);if(c){if(c.config.filter_subject&&c.config.filter_subject!==s)throw new Error("subject does not match consumer");const m=o.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}'`);o.last=c,o.config=c.config,o.attached=!0,o.config.durable_name||(o.name=c.name)}}catch(c){if(c.code!=="404")throw c}return!o.attached&&o.config.filter_subject===void 0&&o.config.filter_subjects===void 0&&(o.config.filter_subject=s),o.deliver=o.config.deliver_subject||Lr(this.nc.options.inboxPrefix),o}_buildTypedSubscriptionOpts(s){const i={};return i.adapter=X2(s.callbackFn===void 0,this.timeout),i.ingestionFilterFn=mm.ingestionFn(s.ordered),i.protocolFilterFn=(o,c=!1)=>{const m=o;return Ed(m.msg)?(c||m.msg.respond(),!1):!0},!s.mack&&s.config.ack_policy!==Bt.None&&(i.dispatchedFn=eO),s.callbackFn&&(i.callback=s.callbackFn),i.max=s.max||0,i.queue=s.queue,i}async _maybeCreateConsumer(s){if(s.attached)return;if(s.isBind)throw new Error(`unable to bind - durable consumer ${s.config.durable_name} doesn't exist in ${s.stream}`);s.config=Object.assign({deliver_policy:Et.All,ack_policy:Bt.Explicit,ack_wait:dt(30*1e3),replay_policy:ra.Instant},s.config);const i=await this.consumerAPI.add(s.stream,s.config);if(Array.isArray(s.config.filter_subjects&&!Array.isArray(i.config.filter_subjects)))throw new Error("jetstream server doesn't support consumers with multiple filter subjects");s.name=i.name,s.config=i.config,s.last=i}static ingestionFn(s){return(i,o)=>{var g;const c=o;if(!i)return{ingest:!1,protocol:!1};const m=i;if(Xi(m.msg)||(g=c.monitor)==null||g.work(),Od(m.msg)){const u=s?c._checkHbOrderConsumer(m.msg):!0;return s||c.info.flow_control.heartbeat_count++,{ingest:u,protocol:!0}}else if(Ed(m.msg))return c.info.flow_control.fc_count++,{ingest:!0,protocol:!0};return{ingest:s?c._checkOrderedConsumer(i):!0,protocol:!1}}}}class pm{constructor(t){j(this,"options");j(this,"protocol");j(this,"draining");j(this,"listeners");j(this,"_services");this.draining=!1,this.options=p2(t),this.listeners=[]}static connect(t={}){return new Promise((s,i)=>{const o=new pm(t);yu.connect(o.options,o).then(c=>{o.protocol=c,(async function(){for await(const m of c.status())o.listeners.forEach(p=>{p.push(m)})})(),s(o)}).catch(c=>{i(c)})})}closed(){return this.protocol.closed}async close(){await this.protocol.close()}_check(t,s,i){if(this.isClosed())throw ge.errorForCode(fe.ConnectionClosed);if(s&&this.isDraining()||i&&this.protocol.noMorePublishing)throw ge.errorForCode(fe.ConnectionDraining);if(t=t||"",t.length===0)throw ge.errorForCode(fe.BadSubject)}publish(t,s,i){this._check(t,!1,!0),this.protocol.publish(t,s,i)}publishMessage(t){return this.publish(t.subject,t.data,{reply:t.reply,headers:t.headers})}respondMessage(t){return t.reply?(this.publish(t.reply,t.data,{reply:t.reply,headers:t.headers}),!0):!1}subscribe(t,s={}){this._check(t,!0,!1);const i=new Ax(this.protocol,t,s);return this.protocol.subscribe(i),i}_resub(t,s,i){this._check(s,!0,!1);const o=t;o.max=i,i&&(o.max=i+o.received),this.protocol.resub(o,s)}requestMany(t,s=jn,i={maxWait:1e3,maxMessages:-1}){const o=!this.protocol.options.noAsyncTraces;try{this._check(t,!0,!0)}catch(g){return Promise.reject(g)}if(i.strategy=i.strategy||Wn.Timer,i.maxWait=i.maxWait||1e3,i.maxWait<1)return Promise.reject(new ge("timeout",fe.InvalidOption));const c=new Ut;function m(g){c.push(()=>{c.stop(g)})}function p(g,u){g||u===null?m(g===null?void 0:g):c.push(u)}if(i.noMux){const g=o?new Error().stack:null;let u=typeof i.maxMessages=="number"&&i.maxMessages>0?i.maxMessages:-1;const d=this.subscribe(Lr(this.options.inboxPrefix),{callback:(w,S)=>{var C,P;if(((C=S==null?void 0:S.data)==null?void 0:C.length)===0&&((P=S==null?void 0:S.headers)==null?void 0:P.status)===fe.NoResponders&&(w=ge.errorForCode(fe.NoResponders)),w){g&&(w.stack+=`
48
+
49
+ ${g}`),b(w);return}p(null,S),i.strategy===Wn.Count&&(u--,u===0&&b()),i.strategy===Wn.JitterTimer&&(v(),x=setTimeout(()=>{b()},300)),i.strategy===Wn.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}),v(),d.drain().then(()=>{m()}).catch(S=>{m()})};c.iterClosed.then(()=>{v(),d==null||d.unsubscribe()}).catch(w=>{v(),d==null||d.unsubscribe()});try{this.publish(t,s,{reply:d.getSubject()})}catch(w){b(w)}let x=setTimeout(()=>{b()},i.maxWait);const v=()=>{x&&clearTimeout(x)}}else{const g=i;g.callback=p,c.iterClosed.then(()=>{u.cancel()}).catch(d=>{u.cancel(d)});const u=new DE(this.protocol.muxSubscriptions,t,g);this.protocol.request(u);try{this.publish(t,s,{reply:`${this.protocol.muxSubscriptions.baseInbox}${u.token}`,headers:i.headers})}catch(d){u.cancel(d)}}return Promise.resolve(c)}request(t,s,i={timeout:1e3,noMux:!1}){try{this._check(t,!0,!0)}catch(c){return Promise.reject(c)}const o=!this.protocol.options.noAsyncTraces;if(i.timeout=i.timeout||1e3,i.timeout<1)return Promise.reject(new ge("timeout",fe.InvalidOption));if(!i.noMux&&i.reply)return Promise.reject(new ge("reply can only be used with noMux",fe.InvalidOption));if(i.noMux){const c=i.reply?i.reply:Lr(this.options.inboxPrefix),m=mt(),p=o?new Error:null,g=this.subscribe(c,{max:1,timeout:i.timeout,callback:(u,d)=>{u?(p&&u.code!==fe.Timeout&&(u.stack+=`
50
+
51
+ ${p.stack}`),g.unsubscribe(),m.reject(u)):(u=gx(d),u?(p&&(u.stack+=`
52
+
53
+ ${p.stack}`),m.reject(u)):m.resolve(d))}});return g.requestSubject=t,this.protocol.publish(t,s,{reply:c,headers:i.headers}),m}else{const c=new vx(this.protocol.muxSubscriptions,t,i,o);this.protocol.request(c);try{this.publish(t,s,{reply:`${this.protocol.muxSubscriptions.baseInbox}${c.token}`,headers:i.headers})}catch(p){c.cancel(p)}const m=Promise.race([c.timer,c.deferred]);return m.catch(()=>{c.cancel()}),m}}flush(){return this.isClosed()?Promise.reject(ge.errorForCode(fe.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(ge.errorForCode(fe.ConnectionClosed)):this.isDraining()?Promise.reject(ge.errorForCode(fe.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 Ut;return t.iterClosed.then(()=>{const s=this.listeners.indexOf(t);this.listeners.splice(s,1)}),this.listeners.push(t),t}get info(){return this.protocol.isClosed()?void 0:this.protocol.info}async context(){return(await this.request("$SYS.REQ.USER.INFO")).json((s,i)=>s==="time"?new Date(Date.parse(i)):i)}stats(){return{inBytes:this.protocol.inBytes,outBytes:this.protocol.outBytes,inMsgs:this.protocol.inMsgs,outMsgs:this.protocol.outMsgs}}async jetstreamManager(t={}){const s=new H2(this,t);if(t.checkAPI!==!1)try{await s.getAccountInfo()}catch(i){const o=i;throw o.code===fe.NoResponders&&(o.code=fe.JetStreamNotEnabled),o}return s}jetstream(t={}){return new mm(this,t)}getServerVersion(){const t=this.info;return t?ti(t.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw ge.errorForCode(fe.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 Y2(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(ge.errorForCode(fe.ConnectionClosed)):this.isDraining()?Promise.reject(ge.errorForCode(fe.ConnectionDraining)):this.protocol.reconnect()}}class Y2{constructor(t){j(this,"nc");this.nc=t}add(t){try{return new Do(this.nc,t).start()}catch(s){return Promise.reject(s)}}client(t,s){return new A2(this.nc,t,s)}}class K2{constructor(t,s,i){j(this,"bucket");j(this,"sm");j(this,"prefixLen");this.bucket=t,this.prefixLen=s,this.sm=i}get key(){return this.sm.subject.substring(this.prefixLen)}get value(){return this.sm.data}get delta(){return 0}get created(){return this.sm.time}get revision(){return this.sm.seq}get operation(){return this.sm.header.get(gu)||"PUT"}get length(){const t=this.sm.header.get(Wt.MessageSizeHdr)||"";return t!==""?parseInt(t,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class J2{constructor(t,s,i){j(this,"bucket");j(this,"key");j(this,"sm");this.bucket=t,this.key=s,this.sm=i}get value(){return this.sm.data}get created(){return new Date(cm(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){var t;return((t=this.sm.headers)==null?void 0:t.get(gu))||"PUT"}get delta(){return this.sm.info.pending}get length(){var s;const t=((s=this.sm.headers)==null?void 0:s.get(Wt.MessageSizeHdr))||"";return t!==""?parseInt(t,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class Tx extends BE{constructor(s,i,o){super(s.nc,i,o);j(this,"js");j(this,"monitor");this.js=s,this.monitor=null,this.sub.closed.then(()=>{this.monitor&&this.monitor.cancel()})}set info(s){this.sub.info=s}get info(){return this.sub.info}_resetOrderedConsumer(s){if(this.info===null||this.sub.isClosed())return;const i=Lr(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,i);const c=this.info;c.config.name=Os.next(),c.ordered_consumer_sequence.delivery_seq=0,c.flow_control.heartbeat_count=0,c.flow_control.fc_count=0,c.flow_control.consumer_restarts++,c.deliver=i,c.config.deliver_subject=i,c.config.deliver_policy=Et.StartSequence,c.config.opt_start_seq=s;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 u=g,d=this.sub.info;d.last=u,this.info.config=u.config,this.info.name=u.name}).catch(g=>{const u=new ge(`unable to recreate ordered consumer ${c.stream} at seq ${s}`,fe.RequestError,g);this.sub.callback(u,{})})}_maybeSetupHbMonitoring(){var i,o;const s=((o=(i=this.info)==null?void 0:i.config)==null?void 0:o.idle_heartbeat)||0;s&&this._setupHbMonitoring(cm(s))}_setupHbMonitoring(s,i=0){const o={cancelAfter:0,maxOut:2};i&&(o.cancelAfter=i);const c=this.sub,m=p=>{var d,b,x,v;const g=bE(409,`${In.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=((x=(b=this.info)==null?void 0:b.ordered_consumer_sequence)==null?void 0:x.stream_seq)||0;return this._resetOrderedConsumer(w+1),(v=this.monitor)==null||v.restart(),!1}return!c.noIterator};this.monitor=new fm(s,m,o)}_checkHbOrderConsumer(s){const i=s.headers.get(Wt.ConsumerStalledHdr);i!==""&&this.js.nc.publish(i);const o=parseInt(s.headers.get(Wt.LastConsumerSeqHdr),10),c=this.info.ordered_consumer_sequence;return this.info.flow_control.heartbeat_count++,o!==c.delivery_seq&&this._resetOrderedConsumer(c.stream_seq+1),!1}_checkOrderedConsumer(s){const i=this.info.ordered_consumer_sequence,o=s.info.streamSequence,c=s.info.deliverySequence;return c!=i.delivery_seq+1?(this._resetOrderedConsumer(i.stream_seq+1),!1):(i.delivery_seq=c,i.stream_seq=o,!0)}async destroy(){this.isClosed()||await this.drain();const s=this.sub.info,i=s.config.durable_name||s.name,o=`${s.api.prefix}.CONSUMER.DELETE.${s.stream}.${i}`;await s.api._request(o)}async consumerInfo(){const s=this.sub.info,i=s.config.durable_name||s.name,o=`${s.api.prefix}.CONSUMER.INFO.${s.stream}.${i}`,c=await s.api._request(o);return s.last=c,c}}class Q2 extends Tx{constructor(t,s,i){super(t,s,i)}pull(t={batch:1}){const{stream:s,config:i,name:o}=this.sub.info,c=i.durable_name??o,m={};if(m.batch=t.batch||1,m.no_wait=t.no_wait||!1,(t.max_bytes??0)>0){const u=this.js.nc.features.get(Ye.JS_PULL_MAX_BYTES);if(!u.ok)throw new Error(`max_bytes is only supported on servers ${u.min} or better`);m.max_bytes=t.max_bytes}let p=0;t.expires&&t.expires>0&&(p=t.expires,m.expires=dt(p));let g=0;if(t.idle_heartbeat&&t.idle_heartbeat>0&&(g=t.idle_heartbeat,m.idle_heartbeat=dt(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 u=this.info.api,d=`${u.prefix}.CONSUMER.MSG.NEXT.${s}.${c}`,b=this.sub.subject;u.nc.publish(d,u.jc.encode(m),{reply:b})}}}function X2(n,t){return n?Z2(t):W2(t)}function W2(n){return(t,s)=>t?[t,null]:(t=Xi(s),t?[t,null]:[null,ko(s,n)])}function Z2(n){return(t,s)=>{if(t)return[t,null];const i=Xi(s);return i!==null?[Cx(i),null]:[null,ko(s,n)]}}function Cx(n){if(n!==null)switch(n.code){case fe.JetStream404NoMessages:case fe.JetStream408RequestTimeout:return null;case fe.JetStream409:return xE(n)?n:null;default:return n}return null}function eO(n){n&&n.ack()}function tO(n){const t=n.split(".");if(t.length===9&&t.splice(2,0,"_",""),t.length<11||t[0]!=="$JS"||t[1]!=="ACK")throw new Error("not js message");const s={};return s.domain=t[2]==="_"?"":t[2],s.account_hash=t[3],s.stream=t[4],s.consumer=t[5],s.deliveryCount=parseInt(t[6],10),s.redeliveryCount=s.deliveryCount,s.redelivered=s.deliveryCount>1,s.streamSequence=parseInt(t[7],10),s.deliverySequence=parseInt(t[8],10),s.timestampNanos=parseInt(t[9],10),s.pending=parseInt(t[10],10),s}class nO{constructor(t,s){j(this,"msg");j(this,"di");j(this,"didAck");j(this,"timeout");this.msg=t,this.didAck=!1,this.timeout=s}get subject(){return this.msg.subject}get sid(){return this.msg.sid}get data(){return this.msg.data}get headers(){return this.msg.headers}get info(){return this.di||(this.di=tO(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]===so[0]&&t[1]===so[1]&&t[2]===so[2]&&t[3]===so[3]}async ackAck(t){var i;t=t||{},t.timeout=t.timeout||this.timeout;const s=mt();if(this.didAck)s.resolve(!1);else if(this.didAck=!0,this.msg.reply){const c=this.msg.publisher,m=!((i=c.options)!=null&&i.noAsyncTraces),p=new vx(c.muxSubscriptions,this.msg.reply,{timeout:t.timeout},m);c.request(p);try{c.publish(this.msg.reply,db,{reply:`${c.muxSubscriptions.baseInbox}${p.token}`})}catch(g){p.cancel(g)}try{await Promise.race([p.timer,p.deferred]),s.resolve(!0)}catch(g){p.cancel(g),s.reject(g)}}else s.resolve(!1);return s}ack(){this.doAck(db)}nak(t){let s=q2;t&&(s=Sd().encode(`-NAK ${JSON.stringify({delay:dt(t)})}`)),this.doAck(s)}working(){this.doAck(so)}next(t,s={batch:1}){const i={};i.batch=s.batch||1,i.no_wait=s.no_wait||!1,s.expires&&s.expires>0&&(i.expires=dt(s.expires));const o=Zn().encode(i),c=sa.concat(P2,U2,o),m=t?{reply:t}:void 0;this.msg.respond(c,m)}term(t=""){let s=B2;(t==null?void 0:t.length)>0&&(s=Sd().encode(`+TERM ${t}`)),this.doAck(s)}json(){return this.msg.json()}string(){return this.msg.string()}}const rO="1.30.3",sO="nats.ws";class iO{constructor(){j(this,"version");j(this,"lang");j(this,"closeError");j(this,"connected");j(this,"done");j(this,"socket");j(this,"options");j(this,"socketClosed");j(this,"encrypted");j(this,"peeked");j(this,"yields");j(this,"signal");j(this,"closedNotification");this.version=rO,this.lang=sO,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=mt(),this.closedNotification=mt()}async connect(t,s){const i=mt();if(s.tls)return i.reject(new ge("tls",fe.InvalidOption)),i;this.options=s;const o=t.src;if(s.wsFactory){const{socket:c,encrypted:m}=await s.wsFactory(t.src,s);this.socket=c,this.encrypted=m}else this.encrypted=o.indexOf("wss://")===0,this.socket=new WebSocket(o);return this.socket.binaryType="arraybuffer",this.socket.onopen=()=>{this.isDiscarded()},this.socket.onmessage=c=>{if(this.isDiscarded())return;if(this.yields.push(new Uint8Array(c.data)),this.peeked){this.signal.resolve();return}const m=sa.concat(...this.yields),p=FE(m);if(p!==""){const g=b2.exec(p);if(!g){s.debug&&console.error("!!!",ac(m)),i.reject(new Error("unexpected response from server"));return}try{const u=JSON.parse(g[1]);y2(u,this.options),this.peeked=!0,this.connected=!0,this.signal.resolve(),i.resolve()}catch(u){i.reject(u);return}}},this.socket.onclose=c=>{if(this.isDiscarded())return;this.socketClosed=!0;let 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 ge(m.message,fe.Unknown,new Error(m.error));i.reject(p)},i}disconnect(){this._closed(void 0,!0)}async _closed(t,s=!0){if(!this.isDiscarded()&&this.connected&&!this.done){if(this.closeError=t,!t)for(;!this.socketClosed&&this.socket.bufferedAmount>0;)await ia(100);this.done=!0;try{this.socket.close(t?1002:1e3,t?t.message:void 0)}catch{}s&&this.closedNotification.resolve(t)}}get isClosed(){return this.done}[Symbol.asyncIterator](){return this.iterate()}async*iterate(){for(;;){if(this.isDiscarded())return;this.yields.length===0&&await this.signal;const t=this.yields;this.yields=[];for(let s=0;s<t.length;s++)this.options.debug&&console.info(`> ${ac(t[s])}`),yield t[s];if(this.done)break;this.yields.length===0&&(t.length=0,this.yields=t,this.signal=mt())}}isEncrypted(){return this.connected&&this.encrypted}send(t){if(!this.isDiscarded())try{this.socket.send(t.buffer),this.options.debug&&console.info(`< ${ac(t)}`);return}catch(s){this.options.debug&&console.error(`!!! ${ac(t)}: ${s}`)}}close(t){return this._closed(t,!1)}closed(){return this.closedNotification}isDiscarded(){return this.done?(this.discard(),!0):!1}discard(){var t;this.done=!0;try{(t=this.socket)==null||t.close()}catch{}}}function aO(n,t){/^(.*:\/\/)(.*)/.test(n)||(typeof t=="boolean"?n=`${t===!0?"https":"http"}://${n}`:n=`https://${n}`);let i=new URL(n);const o=i.protocol.toLowerCase();o==="ws:"&&(t=!1),o==="wss:"&&(t=!0),o!=="https:"&&o!=="http"&&(n=n.replace(/^(.*:\/\/)(.*)/gm,"$2"),i=new URL(`http://${n}`));let c,m;const p=i.hostname,g=i.pathname,u=i.search||"";switch(o){case"http:":case"ws:":case"nats:":m=i.port||"80",c="ws:";break;case"https:":case"wss:":case"tls:":m=i.port||"443",c="wss:";break;default:m=i.port||t===!0?"443":"80",c=t===!0?"wss:":"ws:";break}return`${c}//${p}:${m}${g}${u}`}function oO(n={}){return UE({defaultPort:443,urlParseFn:aO,factory:()=>new iO}),pm.connect(n)}const lO=null,cO=null,Xt="lt.events";function Mx(n,t){const s=n.split("."),i=t.split(".");for(let o=0;o<i.length;o++){const c=i[o];if(c===">")return!0;if(o>=s.length||c!=="*"&&c!==s[o])return!1}return s.length===i.length}const aa=E.createContext({connected:!1,subscribe:()=>()=>{}});function Rx(){const{connected:n}=E.useContext(aa);return{connected:n}}function An(n,t){const{subscribe:s}=E.useContext(aa),i=E.useRef(t);i.current=t,E.useEffect(()=>s(n,c=>i.current(c)),[s,n])}function js(n,t){const{subscribe:s}=E.useContext(aa),i=E.useRef(t);i.current=t;const o=n.join(","),c=E.useMemo(()=>o.split(",").filter(Boolean),[o]);E.useEffect(()=>{const m=g=>i.current(g),p=c.map(g=>s(g,m));return()=>p.forEach(g=>g())},[s,c])}const Dx=E.createContext({connected:!1,unavailable:!1,subscribe:()=>()=>{}});function uO(){const{connected:n,unavailable:t}=E.useContext(Dx);return{connected:n,unavailable:t}}const fO=Sd();function hO({children:n,url:t,token:s,resolveCredentials:i,policy:o=yo,onReconnect:c,sessionKey:m}){const p=E.useRef(null),[g,u]=E.useState(!1),[d,b]=E.useState(!1),[x,v]=E.useState(!1),w=E.useRef({url:t,token:s,resolveCredentials:i,policy:o,onReconnect:c});w.current={url:t,token:s,resolveCredentials:i,policy:o,onReconnect:c};const S=E.useRef(new Map),C=E.useRef(new Map),P=E.useCallback((se,M)=>{(async()=>{for await(const U of M)try{if(!Mx(U.subject,se))continue;const ae=JSON.parse(fO.decode(U.data)),z=S.current.get(se);if(!z)continue;for(const I of z)try{I(ae)}catch{}}catch{}})()},[]),q=E.useCallback(se=>{var U;const M=p.current;if(!(!M||(U=M.isClosed)!=null&&U.call(M)||C.current.has(se)))try{const ae=M.subscribe(se);C.current.set(se,ae),P(se,ae)}catch{}},[P]),re=E.useCallback((se,M)=>{const U=S.current;return U.has(se)||U.set(se,new Set),U.get(se).add(M),q(se),()=>{const ae=U.get(se);if(ae&&(ae.delete(M),ae.size===0)){U.delete(se);const z=C.current.get(se);if(z){C.current.delete(se);try{z.unsubscribe()}catch{}}}}},[q]);return E.useEffect(()=>{let se=!1,M=!1,U=!1,ae=!1,z=0,I,D;v(!1);const X=()=>typeof document<"u"&&document.visibilityState==="hidden",W=async()=>{const{url:J,token:le,resolveCredentials:pe}=w.current;if(pe)return pe();const ye=J||lO;return ye?{kind:"ok",url:ye,token:le||cO||null}:{kind:"unavailable"}},he=(J=oE(z++,w.current.policy))=>{se||M||(I=setTimeout(Oe,J))},we=J=>{J.closed().then(()=>{p.current===J&&(p.current=null,C.current.clear(),u(!1),he(Hg(w.current.policy)))})};async function Oe(){if(I=void 0,!(se||M||U||p.current)&&!X()){U=!0;try{const J=await W();if(se)return;if(J.kind==="session-ended"){M=!0,v(!0);return}if(J.kind==="unavailable"){he();return}const le=await oO({servers:J.url,token:J.token??void 0,reconnect:!1});if(se){le.close().catch(()=>{});return}p.current=le,z=0,u(!0),C.current.clear();for(const pe of S.current.keys())q(pe);ae&&(D=setTimeout(()=>{var pe,ye;return(ye=(pe=w.current).onReconnect)==null?void 0:ye.call(pe)},Hg(w.current.policy))),ae=!0,we(le)}catch{se||he()}finally{U=!1}}}const F=()=>{se||M||U||p.current||X()||(I&&clearTimeout(I),z=0,Oe())};return document.addEventListener("visibilitychange",F),window.addEventListener("online",F),Oe(),()=>{se=!0,I&&clearTimeout(I),D&&clearTimeout(D),document.removeEventListener("visibilitychange",F),window.removeEventListener("online",F);for(const J of C.current.values())try{J.unsubscribe()}catch{}C.current.clear(),p.current&&(p.current.close().catch(()=>{}),p.current=null),u(!1)}},[q,m]),E.useEffect(()=>{if(g||x){b(!1);return}const se=setTimeout(()=>b(!0),o.noticeAfterMs);return()=>clearTimeout(se)},[g,x,o.noticeAfterMs]),h.jsx(Dx.Provider,{value:{connected:g,unavailable:d,subscribe:re},children:h.jsx(aa.Provider,{value:{connected:g,subscribe:re},children:n})})}const ur=Object.create(null);ur.open="0";ur.close="1";ur.ping="2";ur.pong="3";ur.message="4";ur.upgrade="5";ur.noop="6";const iu=Object.create(null);Object.keys(ur).forEach(n=>{iu[ur[n]]=n});const Pd={type:"error",data:"parser error"},Lx=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",qx=typeof ArrayBuffer=="function",Px=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n&&n.buffer instanceof ArrayBuffer,ym=({type:n,data:t},s,i)=>Lx&&t instanceof Blob?s?i(t):pb(t,i):qx&&(t instanceof ArrayBuffer||Px(t))?s?i(t):pb(new Blob([t]),i):i(ur[n]+(t||"")),pb=(n,t)=>{const s=new FileReader;return s.onload=function(){const i=s.result.split(",")[1];t("b"+(i||""))},s.readAsDataURL(n)};function yb(n){return n instanceof Uint8Array?n:n instanceof ArrayBuffer?new Uint8Array(n):new Uint8Array(n.buffer,n.byteOffset,n.byteLength)}let id;function dO(n,t){if(Lx&&n.data instanceof Blob)return n.data.arrayBuffer().then(yb).then(t);if(qx&&(n.data instanceof ArrayBuffer||Px(n.data)))return t(yb(n.data));ym(n,!1,s=>{id||(id=new TextEncoder),t(id.encode(s))})}const gb="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",xo=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let n=0;n<gb.length;n++)xo[gb.charCodeAt(n)]=n;const mO=n=>{let t=n.length*.75,s=n.length,i,o=0,c,m,p,g;n[n.length-1]==="="&&(t--,n[n.length-2]==="="&&t--);const u=new ArrayBuffer(t),d=new Uint8Array(u);for(i=0;i<s;i+=4)c=xo[n.charCodeAt(i)],m=xo[n.charCodeAt(i+1)],p=xo[n.charCodeAt(i+2)],g=xo[n.charCodeAt(i+3)],d[o++]=c<<2|m>>4,d[o++]=(m&15)<<4|p>>2,d[o++]=(p&3)<<6|g&63;return u},pO=typeof ArrayBuffer=="function",gm=(n,t)=>{if(typeof n!="string")return{type:"message",data:Bx(n,t)};const s=n.charAt(0);return s==="b"?{type:"message",data:yO(n.substring(1),t)}:iu[s]?n.length>1?{type:iu[s],data:n.substring(1)}:{type:iu[s]}:Pd},yO=(n,t)=>{if(pO){const s=mO(n);return Bx(s,t)}else return{base64:!0,data:n}},Bx=(n,t)=>{switch(t){case"blob":return n instanceof Blob?n:new Blob([n]);case"arraybuffer":default:return n instanceof ArrayBuffer?n:n.buffer}},Ux="",gO=(n,t)=>{const s=n.length,i=new Array(s);let o=0;n.forEach((c,m)=>{ym(c,!1,p=>{i[m]=p,++o===s&&t(i.join(Ux))})})},bO=(n,t)=>{const s=n.split(Ux),i=[];for(let o=0;o<s.length;o++){const c=gm(s[o],t);if(i.push(c),c.type==="error")break}return i};function xO(){return new TransformStream({transform(n,t){dO(n,s=>{const i=s.length;let o;if(i<126)o=new Uint8Array(1),new DataView(o.buffer).setUint8(0,i);else if(i<65536){o=new Uint8Array(3);const c=new DataView(o.buffer);c.setUint8(0,126),c.setUint16(1,i)}else{o=new Uint8Array(9);const c=new DataView(o.buffer);c.setUint8(0,127),c.setBigUint64(1,BigInt(i))}n.data&&typeof n.data!="string"&&(o[0]|=128),t.enqueue(o),t.enqueue(s)})}})}let ad;function uc(n){return n.reduce((t,s)=>t+s.length,0)}function fc(n,t){if(n[0].length===t)return n.shift();const s=new Uint8Array(t);let i=0;for(let o=0;o<t;o++)s[o]=n[0][i++],i===n[0].length&&(n.shift(),i=0);return n.length&&i<n[0].length&&(n[0]=n[0].slice(i)),s}function vO(n,t){ad||(ad=new TextDecoder);const s=[];let i=0,o=-1,c=!1;return new TransformStream({transform(m,p){for(s.push(m);;){if(i===0){if(uc(s)<1)break;const g=fc(s,1);c=(g[0]&128)===128,o=g[0]&127,o<126?i=3:o===126?i=1:i=2}else if(i===1){if(uc(s)<2)break;const g=fc(s,2);o=new DataView(g.buffer,g.byteOffset,g.length).getUint16(0),i=3}else if(i===2){if(uc(s)<8)break;const g=fc(s,8),u=new DataView(g.buffer,g.byteOffset,g.length),d=u.getUint32(0);if(d>Math.pow(2,21)-1){p.enqueue(Pd);break}o=d*Math.pow(2,32)+u.getUint32(4),i=3}else{if(uc(s)<o)break;const g=fc(s,o);p.enqueue(gm(c?g:ad.decode(g),t)),i=0}if(o===0||o>n){p.enqueue(Pd);break}}}})}const zx=4;function Tt(n){if(n)return _O(n)}function _O(n){for(var t in Tt.prototype)n[t]=Tt.prototype[t];return n}Tt.prototype.on=Tt.prototype.addEventListener=function(n,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+n]=this._callbacks["$"+n]||[]).push(t),this};Tt.prototype.once=function(n,t){function s(){this.off(n,s),t.apply(this,arguments)}return s.fn=t,this.on(n,s),this};Tt.prototype.off=Tt.prototype.removeListener=Tt.prototype.removeAllListeners=Tt.prototype.removeEventListener=function(n,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var s=this._callbacks["$"+n];if(!s)return this;if(arguments.length==1)return delete this._callbacks["$"+n],this;for(var i,o=0;o<s.length;o++)if(i=s[o],i===t||i.fn===t){s.splice(o,1);break}return s.length===0&&delete this._callbacks["$"+n],this};Tt.prototype.emit=function(n){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),s=this._callbacks["$"+n],i=1;i<arguments.length;i++)t[i-1]=arguments[i];if(s){s=s.slice(0);for(var i=0,o=s.length;i<o;++i)s[i].apply(this,t)}return this};Tt.prototype.emitReserved=Tt.prototype.emit;Tt.prototype.listeners=function(n){return this._callbacks=this._callbacks||{},this._callbacks["$"+n]||[]};Tt.prototype.hasListeners=function(n){return!!this.listeners(n).length};const Nu=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,s)=>s(t,0),$n=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),wO="arraybuffer";function Ix(n,...t){return t.reduce((s,i)=>(n.hasOwnProperty(i)&&(s[i]=n[i]),s),{})}const SO=$n.setTimeout,EO=$n.clearTimeout;function Tu(n,t){t.useNativeTimers?(n.setTimeoutFn=SO.bind($n),n.clearTimeoutFn=EO.bind($n)):(n.setTimeoutFn=$n.setTimeout.bind($n),n.clearTimeoutFn=$n.clearTimeout.bind($n))}const OO=1.33;function AO(n){return typeof n=="string"?jO(n):Math.ceil((n.byteLength||n.size)*OO)}function jO(n){let t=0,s=0;for(let i=0,o=n.length;i<o;i++)t=n.charCodeAt(i),t<128?s+=1:t<2048?s+=2:t<55296||t>=57344?s+=3:(i++,s+=4);return s}function $x(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function kO(n){let t="";for(let s in n)n.hasOwnProperty(s)&&(t.length&&(t+="&"),t+=encodeURIComponent(s)+"="+encodeURIComponent(n[s]));return t}function NO(n){let t={},s=n.split("&");for(let i=0,o=s.length;i<o;i++){let c=s[i].split("=");t[decodeURIComponent(c[0])]=decodeURIComponent(c[1])}return t}class TO extends Error{constructor(t,s,i){super(t),this.description=s,this.context=i,this.type="TransportError"}}class bm extends Tt{constructor(t){super(),this.writable=!1,Tu(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,s,i){return super.emitReserved("error",new TO(t,s,i)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const s=gm(t,this.socket.binaryType);this.onPacket(s)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,s={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(s)}_hostname(){const t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){const s=kO(t);return s.length?"?"+s:""}}class CO extends bm{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";const s=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let i=0;this._polling&&(i++,this.once("pollComplete",function(){--i||s()})),this.writable||(i++,this.once("drain",function(){--i||s()}))}else s()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const s=i=>{if(this.readyState==="opening"&&i.type==="open"&&this.onOpen(),i.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(i)};bO(t,this.socket.binaryType).forEach(s),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,gO(t,s=>{this.doWrite(s,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",s=this.query||{};return this.opts.timestampRequests!==!1&&(s[this.opts.timestampParam]=$x()),!this.supportsBinary&&!s.sid&&(s.b64=1),this.createUri(t,s)}}let Hx=!1;try{Hx=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const MO=Hx;function RO(){}class DO extends CO{constructor(t){if(super(t),typeof location<"u"){const s=location.protocol==="https:";let i=location.port;i||(i=s?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||i!==t.port}}doWrite(t,s){const i=this.request({method:"POST",data:t});i.on("success",s),i.on("error",(o,c)=>{this.onError("xhr post error",o,c)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(s,i)=>{this.onError("xhr poll error",s,i)}),this.pollXhr=t}}class cr extends Tt{constructor(t,s,i){super(),this.createRequest=t,Tu(this,i),this._opts=i,this._method=i.method||"GET",this._uri=s,this._data=i.data!==void 0?i.data:null,this._create()}_create(){var t;const s=Ix(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");s.xdomain=!!this._opts.xd;const i=this._xhr=this.createRequest(s);try{i.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){i.setDisableHeaderCheck&&i.setDisableHeaderCheck(!0);for(let o in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(o)&&i.setRequestHeader(o,this._opts.extraHeaders[o])}}catch{}if(this._method==="POST")try{i.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{i.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(i),"withCredentials"in i&&(i.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(i.timeout=this._opts.requestTimeout),i.onreadystatechange=()=>{var o;i.readyState===3&&((o=this._opts.cookieJar)===null||o===void 0||o.parseCookies(i.getResponseHeader("set-cookie"))),i.readyState===4&&(i.status===200||i.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof i.status=="number"?i.status:0)},0))},i.send(this._data)}catch(o){this.setTimeoutFn(()=>{this._onError(o)},0);return}typeof document<"u"&&(this._index=cr.requestsCount++,cr.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=RO,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete cr.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()}}cr.requestsCount=0;cr.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",bb);else if(typeof addEventListener=="function"){const n="onpagehide"in $n?"pagehide":"unload";addEventListener(n,bb,!1)}}function bb(){for(let n in cr.requests)cr.requests.hasOwnProperty(n)&&cr.requests[n].abort()}const LO=(function(){const n=Fx({xdomain:!1});return n&&n.responseType!==null})();class qO extends DO{constructor(t){super(t);const s=t&&t.forceBase64;this.supportsBinary=LO&&!s}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new cr(Fx,this.uri(),t)}}function Fx(n){const t=n.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||MO))return new XMLHttpRequest}catch{}if(!t)try{return new $n[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Gx=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class PO extends bm{get name(){return"websocket"}doOpen(){const t=this.uri(),s=this.opts.protocols,i=Gx?{}:Ix(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(i.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,s,i)}catch(o){return this.emitReserved("error",o)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let s=0;s<t.length;s++){const i=t[s],o=s===t.length-1;ym(i,this.supportsBinary,c=>{try{this.doWrite(i,c)}catch{}o&&Nu(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",s=this.query||{};return this.opts.timestampRequests&&(s[this.opts.timestampParam]=$x()),this.supportsBinary||(s.b64=1),this.createUri(t,s)}}const od=$n.WebSocket||$n.MozWebSocket;class BO extends PO{createSocket(t,s,i){return Gx?new od(t,s,i):s?new od(t,s):new od(t)}doWrite(t,s){this.ws.send(s)}}class UO extends bm{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{const s=vO(Number.MAX_SAFE_INTEGER,this.socket.binaryType),i=t.readable.pipeThrough(s).getReader(),o=xO();o.readable.pipeTo(t.writable),this._writer=o.writable.getWriter();const c=()=>{i.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 s=0;s<t.length;s++){const i=t[s],o=s===t.length-1;this._writer.write(i).then(()=>{o&&Nu(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const zO={websocket:BO,webtransport:UO,polling:qO},IO=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,$O=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Bd(n){if(n.length>8e3)throw"URI too long";const t=n,s=n.indexOf("["),i=n.indexOf("]");s!=-1&&i!=-1&&(n=n.substring(0,s)+n.substring(s,i).replace(/:/g,";")+n.substring(i,n.length));let o=IO.exec(n||""),c={},m=14;for(;m--;)c[$O[m]]=o[m]||"";return s!=-1&&i!=-1&&(c.source=t,c.host=c.host.substring(1,c.host.length-1).replace(/;/g,":"),c.authority=c.authority.replace("[","").replace("]","").replace(/;/g,":"),c.ipv6uri=!0),c.pathNames=HO(c,c.path),c.queryKey=FO(c,c.query),c}function HO(n,t){const s=/\/{2,9}/g,i=t.replace(s,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&i.splice(0,1),t.slice(-1)=="/"&&i.splice(i.length-1,1),i}function FO(n,t){const s={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(i,o,c){o&&(s[o]=c)}),s}const Ud=typeof addEventListener=="function"&&typeof removeEventListener=="function",au=[];Ud&&addEventListener("offline",()=>{au.forEach(n=>n())},!1);class Ss extends Tt{constructor(t,s){if(super(),this.binaryType=wO,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(s=t,t=null),t){const i=Bd(t);s.hostname=i.host,s.secure=i.protocol==="https"||i.protocol==="wss",s.port=i.port,i.query&&(s.query=i.query)}else s.host&&(s.hostname=Bd(s.host).host);Tu(this,s),this.secure=s.secure!=null?s.secure:typeof location<"u"&&location.protocol==="https:",s.hostname&&!s.port&&(s.port=this.secure?"443":"80"),this.hostname=s.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=s.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},s.transports.forEach(i=>{const o=i.prototype.name;this.transports.push(o),this._transportsByName[o]=i}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},s),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=NO(this.opts.query)),Ud&&(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"})},au.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const s=Object.assign({},this.opts.query);s.EIO=zx,s.transport=t,this.id&&(s.sid=this.id);const i=Object.assign({},this.opts,{query:s,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](i)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&Ss.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const s=this.createTransport(t);s.open(),this.setTransport(s)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",s=>this._onClose("transport close",s))}onOpen(){this.readyState="open",Ss.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const s=new Error("server error");s.code=t.data,this._onError(s);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let s=1;for(let i=0;i<this.writeBuffer.length;i++){const o=this.writeBuffer[i].data;if(o&&(s+=AO(o)),i>0&&s>this._maxPayload)return this.writeBuffer.slice(0,i);s+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,Nu(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,s,i){return this._sendPacket("message",t,s,i),this}send(t,s,i){return this._sendPacket("message",t,s,i),this}_sendPacket(t,s,i,o){if(typeof s=="function"&&(o=s,s=void 0),typeof i=="function"&&(o=i,i=null),this.readyState==="closing"||this.readyState==="closed")return;i=i||{},i.compress=i.compress!==!1;const c={type:t,data:s,options:i};this.emitReserved("packetCreate",c),this.writeBuffer.push(c),o&&this.once("flush",o),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},s=()=>{this.off("upgrade",s),this.off("upgradeError",s),t()},i=()=>{this.once("upgrade",s),this.once("upgradeError",s)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?i():t()}):this.upgrading?i():t()),this}_onError(t){if(Ss.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,s){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Ud&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const i=au.indexOf(this._offlineEventListener);i!==-1&&au.splice(i,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,s),this.writeBuffer=[],this._prevBufferLen=0}}}Ss.protocol=zx;class GO extends Ss{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let s=this.createTransport(t),i=!1;Ss.priorWebsocketSuccess=!1;const o=()=>{i||(s.send([{type:"ping",data:"probe"}]),s.once("packet",b=>{if(!i)if(b.type==="pong"&&b.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",s),!s)return;Ss.priorWebsocketSuccess=s.name==="websocket",this.transport.pause(()=>{i||this.readyState!=="closed"&&(d(),this.setTransport(s),s.send([{type:"upgrade"}]),this.emitReserved("upgrade",s),s=null,this.upgrading=!1,this.flush())})}else{const x=new Error("probe error");x.transport=s.name,this.emitReserved("upgradeError",x)}}))};function c(){i||(i=!0,d(),s.close(),s=null)}const m=b=>{const x=new Error("probe error: "+b);x.transport=s.name,c(),this.emitReserved("upgradeError",x)};function p(){m("transport closed")}function g(){m("socket closed")}function u(b){s&&b.name!==s.name&&c()}const d=()=>{s.removeListener("open",o),s.removeListener("error",m),s.removeListener("close",p),this.off("close",g),this.off("upgrading",u)};s.once("open",o),s.once("error",m),s.once("close",p),this.once("close",g),this.once("upgrading",u),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{i||s.open()},200):s.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const s=[];for(let i=0;i<t.length;i++)~this.transports.indexOf(t[i])&&s.push(t[i]);return s}}let VO=class extends GO{constructor(t,s={}){const i=typeof t=="object"?t:s;(!i.transports||i.transports&&typeof i.transports[0]=="string")&&(i.transports=(i.transports||["polling","websocket","webtransport"]).map(o=>zO[o]).filter(o=>!!o)),super(t,i)}};function YO(n,t="",s){let i=n;s=s||typeof location<"u"&&location,n==null&&(n=s.protocol+"//"+s.host),typeof n=="string"&&(n.charAt(0)==="/"&&(n.charAt(1)==="/"?n=s.protocol+n:n=s.host+n),/^(https?|wss?):\/\//.test(n)||(typeof s<"u"?n=s.protocol+"//"+n:n="https://"+n),i=Bd(n)),i.port||(/^(http|ws)$/.test(i.protocol)?i.port="80":/^(http|ws)s$/.test(i.protocol)&&(i.port="443")),i.path=i.path||"/";const c=i.host.indexOf(":")!==-1?"["+i.host+"]":i.host;return i.id=i.protocol+"://"+c+":"+i.port+t,i.href=i.protocol+"://"+c+(s&&s.port===i.port?"":":"+i.port),i}const KO=typeof ArrayBuffer=="function",JO=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n.buffer instanceof ArrayBuffer,Vx=Object.prototype.toString,QO=typeof Blob=="function"||typeof Blob<"u"&&Vx.call(Blob)==="[object BlobConstructor]",XO=typeof File=="function"||typeof File<"u"&&Vx.call(File)==="[object FileConstructor]";function xm(n){return KO&&(n instanceof ArrayBuffer||JO(n))||QO&&n instanceof Blob||XO&&n instanceof File}function ou(n,t){if(!n||typeof n!="object")return!1;if(Array.isArray(n)){for(let s=0,i=n.length;s<i;s++)if(ou(n[s]))return!0;return!1}if(xm(n))return!0;if(n.toJSON&&typeof n.toJSON=="function"&&arguments.length===1)return ou(n.toJSON(),!0);for(const s in n)if(Object.prototype.hasOwnProperty.call(n,s)&&ou(n[s]))return!0;return!1}function WO(n){const t=[],s=n.data,i=n;return i.data=zd(s,t),i.attachments=t.length,{packet:i,buffers:t}}function zd(n,t){if(!n)return n;if(xm(n)){const s={_placeholder:!0,num:t.length};return t.push(n),s}else if(Array.isArray(n)){const s=new Array(n.length);for(let i=0;i<n.length;i++)s[i]=zd(n[i],t);return s}else if(typeof n=="object"&&!(n instanceof Date)){const s={};for(const i in n)Object.prototype.hasOwnProperty.call(n,i)&&(s[i]=zd(n[i],t));return s}return n}function ZO(n,t){return n.data=Id(n.data,t),delete n.attachments,n}function Id(n,t){if(!n)return n;if(n&&n._placeholder===!0){if(typeof n.num=="number"&&n.num>=0&&n.num<t.length)return t[n.num];throw new Error("illegal attachments")}else if(Array.isArray(n))for(let s=0;s<n.length;s++)n[s]=Id(n[s],t);else if(typeof n=="object")for(const s in n)Object.prototype.hasOwnProperty.call(n,s)&&(n[s]=Id(n[s],t));return n}const eA=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var Ve;(function(n){n[n.CONNECT=0]="CONNECT",n[n.DISCONNECT=1]="DISCONNECT",n[n.EVENT=2]="EVENT",n[n.ACK=3]="ACK",n[n.CONNECT_ERROR=4]="CONNECT_ERROR",n[n.BINARY_EVENT=5]="BINARY_EVENT",n[n.BINARY_ACK=6]="BINARY_ACK"})(Ve||(Ve={}));class tA{constructor(t){this.replacer=t}encode(t){return(t.type===Ve.EVENT||t.type===Ve.ACK)&&ou(t)?this.encodeAsBinary({type:t.type===Ve.EVENT?Ve.BINARY_EVENT:Ve.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let s=""+t.type;return(t.type===Ve.BINARY_EVENT||t.type===Ve.BINARY_ACK)&&(s+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(s+=t.nsp+","),t.id!=null&&(s+=t.id),t.data!=null&&(s+=JSON.stringify(t.data,this.replacer)),s}encodeAsBinary(t){const s=WO(t),i=this.encodeAsString(s.packet),o=s.buffers;return o.unshift(i),o}}class vm extends Tt{constructor(t){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof t=="function"?{reviver:t}:t)}add(t){let s;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");s=this.decodeString(t);const i=s.type===Ve.BINARY_EVENT;i||s.type===Ve.BINARY_ACK?(s.type=i?Ve.EVENT:Ve.ACK,this.reconstructor=new nA(s),s.attachments===0&&super.emitReserved("decoded",s)):super.emitReserved("decoded",s)}else if(xm(t)||t.base64)if(this.reconstructor)s=this.reconstructor.takeBinaryData(t),s&&(this.reconstructor=null,super.emitReserved("decoded",s));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let s=0;const i={type:Number(t.charAt(0))};if(Ve[i.type]===void 0)throw new Error("unknown packet type "+i.type);if(i.type===Ve.BINARY_EVENT||i.type===Ve.BINARY_ACK){const c=s+1;for(;t.charAt(++s)!=="-"&&s!=t.length;);const m=t.substring(c,s);if(m!=Number(m)||t.charAt(s)!=="-")throw new Error("Illegal attachments");const p=Number(m);if(!rA(p)||p<0)throw new Error("Illegal attachments");if(p>this.opts.maxAttachments)throw new Error("too many attachments");i.attachments=p}if(t.charAt(s+1)==="/"){const c=s+1;for(;++s&&!(t.charAt(s)===","||s===t.length););i.nsp=t.substring(c,s)}else i.nsp="/";const o=t.charAt(s+1);if(o!==""&&Number(o)==o){const c=s+1;for(;++s;){const m=t.charAt(s);if(m==null||Number(m)!=m){--s;break}if(s===t.length)break}i.id=Number(t.substring(c,s+1))}if(t.charAt(++s)){const c=this.tryParse(t.substr(s));if(vm.isPayloadValid(i.type,c))i.data=c;else throw new Error("invalid payload")}return i}tryParse(t){try{return JSON.parse(t,this.opts.reviver)}catch{return!1}}static isPayloadValid(t,s){switch(t){case Ve.CONNECT:return xb(s);case Ve.DISCONNECT:return s===void 0;case Ve.CONNECT_ERROR:return typeof s=="string"||xb(s);case Ve.EVENT:case Ve.BINARY_EVENT:return Array.isArray(s)&&(typeof s[0]=="number"||typeof s[0]=="string"&&eA.indexOf(s[0])===-1);case Ve.ACK:case Ve.BINARY_ACK:return Array.isArray(s)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class nA{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const s=ZO(this.reconPack,this.buffers);return this.finishedReconstruction(),s}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const rA=Number.isInteger||function(n){return typeof n=="number"&&isFinite(n)&&Math.floor(n)===n};function xb(n){return Object.prototype.toString.call(n)==="[object Object]"}const sA=Object.freeze(Object.defineProperty({__proto__:null,Decoder:vm,Encoder:tA,get PacketType(){return Ve}},Symbol.toStringTag,{value:"Module"}));function Xn(n,t,s){return n.on(t,s),function(){n.off(t,s)}}const iA=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Yx extends Tt{constructor(t,s,i){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=s,i&&i.auth&&(this.auth=i.auth),this._opts=Object.assign({},i),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[Xn(t,"open",this.onopen.bind(this)),Xn(t,"packet",this.onpacket.bind(this)),Xn(t,"error",this.onerror.bind(this)),Xn(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...s){var i,o,c;if(iA.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(s.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(s),this;const m={type:Ve.EVENT,data:s};if(m.options={},m.options.compress=this.flags.compress!==!1,typeof s[s.length-1]=="function"){const d=this.ids++,b=s.pop();this._registerAckCallback(d,b),m.id=d}const p=(o=(i=this.io.engine)===null||i===void 0?void 0:i.transport)===null||o===void 0?void 0:o.writable,g=this.connected&&!(!((c=this.io.engine)===null||c===void 0)&&c._hasPingExpired());return this.flags.volatile&&!p||(g?(this.notifyOutgoingListeners(m),this.packet(m)):this.sendBuffer.push(m)),this.flags={},this}_registerAckCallback(t,s){var i;const o=(i=this.flags.timeout)!==null&&i!==void 0?i:this._opts.ackTimeout;if(o===void 0){this.acks[t]=s;return}const c=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let p=0;p<this.sendBuffer.length;p++)this.sendBuffer[p].id===t&&this.sendBuffer.splice(p,1);s.call(this,new Error("operation has timed out"))},o),m=(...p)=>{this.io.clearTimeoutFn(c),s.apply(this,p)};m.withError=!0,this.acks[t]=m}emitWithAck(t,...s){return new Promise((i,o)=>{const c=(m,p)=>m?o(m):i(p);c.withError=!0,s.push(c),this.emit(t,...s)})}_addToQueue(t){let s;typeof t[t.length-1]=="function"&&(s=t.pop());const i={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((o,...c)=>(this._queue[0],o!==null?i.tryCount>this._opts.retries&&(this._queue.shift(),s&&s(o)):(this._queue.shift(),s&&s(null,...c)),i.pending=!1,this._drainQueue())),this._queue.push(i),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const s=this._queue[0];s.pending&&!t||(s.pending=!0,s.tryCount++,this.flags=s.flags,this.emit.apply(this,s.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:Ve.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,s){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,s),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(i=>String(i.id)===t)){const i=this.acks[t];delete this.acks[t],i.withError&&i.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case Ve.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 Ve.EVENT:case Ve.BINARY_EVENT:this.onevent(t);break;case Ve.ACK:case Ve.BINARY_ACK:this.onack(t);break;case Ve.DISCONNECT:this.ondisconnect();break;case Ve.CONNECT_ERROR:this.destroy();const i=new Error(t.data.message);i.data=t.data.data,this.emitReserved("connect_error",i);break}}onevent(t){const s=t.data||[];t.id!=null&&s.push(this.ack(t.id)),this.connected?this.emitEvent(s):this.receiveBuffer.push(Object.freeze(s))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const s=this._anyListeners.slice();for(const i of s)i.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const s=this;let i=!1;return function(...o){i||(i=!0,s.packet({type:Ve.ACK,id:t,data:o}))}}onack(t){const s=this.acks[t.id];typeof s=="function"&&(delete this.acks[t.id],s.withError&&t.data.unshift(null),s.apply(this,t.data))}onconnect(t,s){this.id=t,this.recovered=s&&this._pid===s,this._pid=s,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Ve.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const s=this._anyListeners;for(let i=0;i<s.length;i++)if(t===s[i])return s.splice(i,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const s=this._anyOutgoingListeners;for(let i=0;i<s.length;i++)if(t===s[i])return s.splice(i,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const s=this._anyOutgoingListeners.slice();for(const i of s)i.apply(this,t.data)}}}function oa(n){n=n||{},this.ms=n.min||100,this.max=n.max||1e4,this.factor=n.factor||2,this.jitter=n.jitter>0&&n.jitter<=1?n.jitter:0,this.attempts=0}oa.prototype.duration=function(){var n=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),s=Math.floor(t*this.jitter*n);n=(Math.floor(t*10)&1)==0?n-s:n+s}return Math.min(n,this.max)|0};oa.prototype.reset=function(){this.attempts=0};oa.prototype.setMin=function(n){this.ms=n};oa.prototype.setMax=function(n){this.max=n};oa.prototype.setJitter=function(n){this.jitter=n};class $d extends Tt{constructor(t,s){var i;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(s=t,t=void 0),s=s||{},s.path=s.path||"/socket.io",this.opts=s,Tu(this,s),this.reconnection(s.reconnection!==!1),this.reconnectionAttempts(s.reconnectionAttempts||1/0),this.reconnectionDelay(s.reconnectionDelay||1e3),this.reconnectionDelayMax(s.reconnectionDelayMax||5e3),this.randomizationFactor((i=s.randomizationFactor)!==null&&i!==void 0?i:.5),this.backoff=new oa({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(s.timeout==null?2e4:s.timeout),this._readyState="closed",this.uri=t;const o=s.parser||sA;this.encoder=new o.Encoder,this.decoder=new o.Decoder,this._autoConnect=s.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var s;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(s=this.backoff)===null||s===void 0||s.setMin(t),this)}randomizationFactor(t){var s;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(s=this.backoff)===null||s===void 0||s.setJitter(t),this)}reconnectionDelayMax(t){var s;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(s=this.backoff)===null||s===void 0||s.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new VO(this.uri,this.opts);const s=this.engine,i=this;this._readyState="opening",this.skipReconnect=!1;const o=Xn(s,"open",function(){i.onopen(),t&&t()}),c=p=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",p),t?t(p):this.maybeReconnectOnOpen()},m=Xn(s,"error",c);if(this._timeout!==!1){const p=this._timeout,g=this.setTimeoutFn(()=>{o(),c(new Error("timeout")),s.close()},p);this.opts.autoUnref&&g.unref(),this.subs.push(()=>{this.clearTimeoutFn(g)})}return this.subs.push(o),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(Xn(t,"ping",this.onping.bind(this)),Xn(t,"data",this.ondata.bind(this)),Xn(t,"error",this.onerror.bind(this)),Xn(t,"close",this.onclose.bind(this)),Xn(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(s){this.onclose("parse error",s)}}ondecoded(t){Nu(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,s){let i=this.nsps[t];return i?this._autoConnect&&!i.active&&i.connect():(i=new Yx(this,t,s),this.nsps[t]=i),i}_destroy(t){const s=Object.keys(this.nsps);for(const i of s)if(this.nsps[i].active)return;this._close()}_packet(t){const s=this.encoder.encode(t);for(let i=0;i<s.length;i++)this.engine.write(s[i],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,s){var i;this.cleanup(),(i=this.engine)===null||i===void 0||i.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,s),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const s=this.backoff.duration();this._reconnecting=!0;const i=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(o=>{o?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",o)):t.onreconnect()}))},s);this.opts.autoUnref&&i.unref(),this.subs.push(()=>{this.clearTimeoutFn(i)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const io={};function lu(n,t){typeof n=="object"&&(t=n,n=void 0),t=t||{};const s=YO(n,t.path||"/socket.io"),i=s.source,o=s.id,c=s.path,m=io[o]&&c in io[o].nsps,p=t.forceNew||t["force new connection"]||t.multiplex===!1||m;let g;return p?g=new $d(i,t):(io[o]||(io[o]=new $d(i,t)),g=io[o]),s.query&&!t.query&&(t.query=s.queryKey),g.socket(s.path,t)}Object.assign(lu,{Manager:$d,Socket:Yx,io:lu,connect:lu});const aA=E.createContext({connected:!1,subscribe:()=>()=>{}});function oA({children:n}){const{isAuthenticated:t}=qt(),s=E.useRef(null),[i,o]=E.useState(!1),c=E.useRef(new Map),m=E.useCallback((g,u)=>{var b;const d=c.current;return d.has(g)||(d.set(g,new Set),(b=s.current)==null||b.emit("lt.subscribe",g)),d.get(g).add(u),()=>{var v;const x=d.get(g);x&&(x.delete(u),x.size===0&&(d.delete(g),(v=s.current)==null||v.emit("lt.unsubscribe",g)))}},[]),p=E.useCallback((g,u)=>{for(const[d,b]of c.current)if(Mx(g,d))for(const x of b)try{x(u)}catch{}},[]);return E.useEffect(()=>{if(!t)return;const g=lu({path:`${Vt}/socket.io`,transports:["polling","websocket"],upgrade:!0,reconnection:!0,reconnectionAttempts:1/0,reconnectionDelay:2e3,auth:u=>{const d=_d();u(d?{token:d}:{})}});return s.current=g,console.log("[lt-socketio] connecting..."),g.on("connect",()=>{console.log("[lt-socketio] connected, id:",g.id),o(!0);for(const u of c.current.keys())g.emit("lt.subscribe",u)}),g.on("disconnect",u=>{console.log("[lt-socketio] disconnected:",u),o(!1)}),g.on("connect_error",u=>{console.warn("[lt-socketio] connect error:",u.message),o(!1)}),g.onAny((u,d)=>{if(u.startsWith("lt."))try{const b=typeof d=="string"?JSON.parse(d):d;p(u,b)}catch{}}),()=>{g.removeAllListeners(),g.disconnect(),s.current=null,o(!1)}},[p,t]),h.jsx(aA.Provider,{value:{connected:i,subscribe:m},children:h.jsx(aa.Provider,{value:{connected:i,subscribe:m},children:n})})}function lA({children:n}){const{isAuthenticated:t}=qt(),s=Be(),[i,o]=E.useState(null),[c,m]=E.useState({url:null,policy:Fg(null)});E.useEffect(()=>{let u=!1;async function d(){var b;try{console.log("[lt-transport] detecting event transport...");const x=await om(),v=(b=x==null?void 0:x.events)==null?void 0:b.transport;console.log("[lt-transport] server reports:",v),u||(v==="nats"&&m({url:x.events.natsWsUrl??null,policy:Fg(x.events.reconnect)}),o(v==="nats"?"nats":"socketio"))}catch(x){console.warn("[lt-transport] settings fetch error, falling back to socketio",x),u||o("socketio")}}return d(),()=>{u=!0}},[t]);const p=E.useCallback(()=>aE(c.url),[c.url]),g=E.useCallback(()=>{s.invalidateQueries({refetchType:"active"})},[s]);return i==="nats"?h.jsx(hO,{resolveCredentials:p,policy:c.policy,onReconnect:g,sessionKey:t,children:n}):i==="socketio"?h.jsx(oA,{children:n}):h.jsx(h.Fragment,{children:n})}const _m="lt_view_as",wm="lt_ai_override",Hd="lt_graph_enabled",Fd="lt_infrastructure_enabled",Sm="lt_scan_override";function Kx(){try{const n=localStorage.getItem(wm);if(n==="true")return!0;if(n==="false")return!1}catch{}return null}function cA(n){try{localStorage.setItem(wm,String(n))}catch{}}function uA(){try{localStorage.removeItem(wm)}catch{}}function Em(){try{const n=localStorage.getItem(_m);if(n==="admin"||n==="engineer"||n==="operator")return n}catch{}return null}function fA(n){try{localStorage.setItem(_m,n)}catch{}window.location.reload()}function Gd(){try{localStorage.removeItem(_m)}catch{}window.location.reload()}function Jx(){try{return localStorage.getItem(Hd)==="true"}catch{return!1}}function hA(n){try{n?localStorage.setItem(Hd,"true"):localStorage.removeItem(Hd)}catch{}}function Qx(){try{return localStorage.getItem(Fd)==="true"}catch{return!1}}function dA(n){try{n?localStorage.setItem(Fd,"true"):localStorage.removeItem(Fd)}catch{}}function Xx(){try{const n=localStorage.getItem(Sm);if(n==="true")return!0;if(n==="false")return!1}catch{}return null}function mA(n){try{localStorage.setItem(Sm,String(n))}catch{}}function pA(){try{localStorage.removeItem(Sm)}catch{}}function Wx(){const{isSuperAdmin:n,hasRoleType:t,hasRole:s}=qt(),i=Em(),o=n||s("engineer"),c=t("admin"),m=n||t("admin");return{isBuilder:i?!1:o,isOps:i?i==="admin"||i==="engineer":c,canBulk:i?i==="admin":m,viewAs:i,realIsBuilder:o}}function Zx(){var u;const{isSuperAdmin:n,hasRoleType:t,hasRole:s}=qt(),{data:i}=er(),o=((u=i==null?void 0:i.features)==null?void 0:u.publicPaceBoard)!==!1,c=n?"superadmin":t("admin")?"admin":s("engineer")?"engineer":"operator",m=Em(),p=m==="admin"||m==="engineer"||m==="operator"?m:null,g=p??c;return{tier:g,realTier:c,viewAs:p,canSeePaceBoard:o||g==="superadmin"||g==="admin",canSeeWorkflows:g==="superadmin"||g==="engineer",showTaskQueueCards:g==="operator"&&!o}}const ev=E.createContext(null);function tv(){const n=E.useContext(ev);if(!n)throw new Error("useActingIdentity must be used within ActingIdentityProvider");return n}function yA({children:n}){const[t,s]=E.useState(null),i=E.useRef(t);i.current=t,E.useEffect(()=>{if(!(t!=null&&t.expiresAt))return;const d=new Date(t.expiresAt).getTime()-Date.now();if(d<=0){s(null);return}const b=setTimeout(()=>s(null),d);return()=>clearTimeout(b)},[t]);const o=E.useCallback(d=>{var x;if(!d.actingToken||!d.actor)return null;const b=((x=i.current)==null?void 0:x.actingToken)??null;return s({actingToken:d.actingToken,actorId:d.actor.id,displayName:d.actor.displayName,expiresAt:d.expiresAt??null,subjectScoped:d.grantScope==="subject"}),b},[]),c=E.useCallback(()=>s(null),[]),m=E.useCallback((d,b)=>{const x=i.current;b===0&&(x==null?void 0:x.actingToken)===d&&s(null)},[]),p=E.useCallback((d,b)=>{const x=i.current;if(!x||x.actingToken!==d||!b.acting)return;const{consumed:v,remaining:w,bound:S}=b.acting;(v&&w===0||S&&b.clearSubject)&&s(null)},[]);E.useEffect(()=>(Ug(()=>{var d;return((d=i.current)==null?void 0:d.actingToken)??null}),Ig(c),zg(m),()=>{Ug(null),Ig(null),zg(null)}),[c,m]);const g=E.useCallback(()=>{var b;const d=(b=i.current)==null?void 0:b.expiresAt;return d?Math.max(0,Math.floor((new Date(d).getTime()-Date.now())/1e3)):0},[]),u=E.useMemo(()=>({identity:t,prime:o,clear:c,settle:p,remainingSeconds:g}),[t,o,c,p,g]);return h.jsx(ev.Provider,{value:u,children:n})}function gA(){const{user:n}=qt(),{identity:t}=tv(),s=n==null?void 0:n.userId,i=t==null?void 0:t.actorId,o=E.useCallback(c=>!!c&&(c===i||c===s),[i,s]);return{viewerId:i??s,isViewer:o}}function nv(n){return(n??"").replace(/[^A-Za-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"")||"none"}function fr(n={}){const t=n.role?nv(n.role):"*",s=n.id??"*",i=n.verb??">";return`${Xt}.system.escalation.${t}.${s}.${i}`}function Vd(n){return n.verbs.map(t=>fr({role:n.role,verb:t}))}function Om(n){const{user:t,isSuperAdmin:s,hasRoleType:i}=qt(),o=s||i("admin"),c=((t==null?void 0:t.roles)??[]).map(p=>p.role).sort().join(","),m=(n??[]).join(",");return E.useMemo(()=>{const p=m?m.split(","):null;return o||!c?p?Vd({verbs:p}):[fr({})]:c.split(",").flatMap(g=>p?Vd({role:g,verbs:p}):[fr({role:g})])},[o,c,m])}const Yd="/escalations/detail/";function bA(n){return n.startsWith(Yd)&&n.slice(Yd.length).split("/")[0]||void 0}function xA(){const{isViewer:n}=gA(),t=ni(),s=en(),i=E.useRef(s.pathname);i.current=s.pathname;const o=E.useRef(n);o.current=n;const c=E.useCallback(m=>{var b,x,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=(x=m==null?void 0:m.data)==null?void 0:x.assigned_to,u=(v=m==null?void 0:m.data)==null?void 0:v.parent_id;if(!p||!o.current(g)||!u||u!==bA(i.current))return;const d=`${Yd}${p}`;i.current!==d&&t(d)},[t]);js(Om(["claimed"]),c)}const rv=6048e5,vA=864e5,vb=6e4,_b=525600,wb=43200,Sb=1440,Eb=Symbol.for("constructDateFrom");function Br(n,t){return typeof n=="function"?n(t):n&&typeof n=="object"&&Eb in n?n[Eb](t):n instanceof Date?new n.constructor(t):new Date(t)}function kn(n,t){return Br(t||n,n)}let _A={};function Lo(){return _A}function No(n,t){var p,g,u,d;const s=Lo(),i=(t==null?void 0:t.weekStartsOn)??((g=(p=t==null?void 0:t.locale)==null?void 0:p.options)==null?void 0:g.weekStartsOn)??s.weekStartsOn??((d=(u=s.locale)==null?void 0:u.options)==null?void 0:d.weekStartsOn)??0,o=kn(n,t==null?void 0:t.in),c=o.getDay(),m=(c<i?7:0)+c-i;return o.setDate(o.getDate()-m),o.setHours(0,0,0,0),o}function bu(n,t){return No(n,{...t,weekStartsOn:1})}function sv(n,t){const s=kn(n,t==null?void 0:t.in),i=s.getFullYear(),o=Br(s,0);o.setFullYear(i+1,0,4),o.setHours(0,0,0,0);const c=bu(o),m=Br(s,0);m.setFullYear(i,0,4),m.setHours(0,0,0,0);const p=bu(m);return s.getTime()>=c.getTime()?i+1:s.getTime()>=p.getTime()?i:i-1}function xu(n){const t=kn(n),s=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return s.setUTCFullYear(t.getFullYear()),+n-+s}function iv(n,...t){const s=Br.bind(null,n||t.find(i=>typeof i=="object"));return t.map(s)}function Ob(n,t){const s=kn(n,t==null?void 0:t.in);return s.setHours(0,0,0,0),s}function wA(n,t,s){const[i,o]=iv(s==null?void 0:s.in,n,t),c=Ob(i),m=Ob(o),p=+c-xu(c),g=+m-xu(m);return Math.round((p-g)/vA)}function SA(n,t){const s=sv(n,t),i=Br(n,0);return i.setFullYear(s,0,4),i.setHours(0,0,0,0),bu(i)}function EA(n,t){const s=+kn(n)-+kn(t);return s<0?-1:s>0?1:s}function OA(n){return Br(n,Date.now())}function AA(n){return n instanceof Date||typeof n=="object"&&Object.prototype.toString.call(n)==="[object Date]"}function jA(n){return!(!AA(n)&&typeof n!="number"||isNaN(+kn(n)))}function kA(n){return t=>{const i=(n?Math[n]:Math.trunc)(t);return i===0?0:i}}function NA(n,t){const s=kn(n,t==null?void 0:t.in);return s.setFullYear(s.getFullYear(),0,1),s.setHours(0,0,0,0),s}const TA={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"}},CA=(n,t,s)=>{let i;const o=TA[n];return typeof o=="string"?i=o:t===1?i=o.one:i=o.other.replace("{{count}}",t.toString()),s!=null&&s.addSuffix?s.comparison&&s.comparison>0?"in "+i:i+" ago":i};function ld(n){return(t={})=>{const s=t.width?String(t.width):n.defaultWidth;return n.formats[s]||n.formats[n.defaultWidth]}}const MA={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},RA={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},DA={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},LA={date:ld({formats:MA,defaultWidth:"full"}),time:ld({formats:RA,defaultWidth:"full"}),dateTime:ld({formats:DA,defaultWidth:"full"})},qA={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},PA=(n,t,s,i)=>qA[n];function ao(n){return(t,s)=>{const i=s!=null&&s.context?String(s.context):"standalone";let o;if(i==="formatting"&&n.formattingValues){const m=n.defaultFormattingWidth||n.defaultWidth,p=s!=null&&s.width?String(s.width):m;o=n.formattingValues[p]||n.formattingValues[m]}else{const m=n.defaultWidth,p=s!=null&&s.width?String(s.width):n.defaultWidth;o=n.values[p]||n.values[m]}const c=n.argumentCallback?n.argumentCallback(t):t;return o[c]}}const BA={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},UA={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},zA={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},IA={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},$A={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"}},HA={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"}},FA=(n,t)=>{const s=Number(n),i=s%100;if(i>20||i<10)switch(i%10){case 1:return s+"st";case 2:return s+"nd";case 3:return s+"rd"}return s+"th"},GA={ordinalNumber:FA,era:ao({values:BA,defaultWidth:"wide"}),quarter:ao({values:UA,defaultWidth:"wide",argumentCallback:n=>n-1}),month:ao({values:zA,defaultWidth:"wide"}),day:ao({values:IA,defaultWidth:"wide"}),dayPeriod:ao({values:$A,defaultWidth:"wide",formattingValues:HA,defaultFormattingWidth:"wide"})};function oo(n){return(t,s={})=>{const i=s.width,o=i&&n.matchPatterns[i]||n.matchPatterns[n.defaultMatchWidth],c=t.match(o);if(!c)return null;const m=c[0],p=i&&n.parsePatterns[i]||n.parsePatterns[n.defaultParseWidth],g=Array.isArray(p)?YA(p,b=>b.test(m)):VA(p,b=>b.test(m));let u;u=n.valueCallback?n.valueCallback(g):g,u=s.valueCallback?s.valueCallback(u):u;const d=t.slice(m.length);return{value:u,rest:d}}}function VA(n,t){for(const s in n)if(Object.prototype.hasOwnProperty.call(n,s)&&t(n[s]))return s}function YA(n,t){for(let s=0;s<n.length;s++)if(t(n[s]))return s}function KA(n){return(t,s={})=>{const i=t.match(n.matchPattern);if(!i)return null;const o=i[0],c=t.match(n.parsePattern);if(!c)return null;let m=n.valueCallback?n.valueCallback(c[0]):c[0];m=s.valueCallback?s.valueCallback(m):m;const p=t.slice(o.length);return{value:m,rest:p}}}const JA=/^(\d+)(th|st|nd|rd)?/i,QA=/\d+/i,XA={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},WA={any:[/^b/i,/^(a|c)/i]},ZA={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},ej={any:[/1/i,/2/i,/3/i,/4/i]},tj={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},nj={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]},rj={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},sj={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]},ij={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},aj={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}},oj={ordinalNumber:KA({matchPattern:JA,parsePattern:QA,valueCallback:n=>parseInt(n,10)}),era:oo({matchPatterns:XA,defaultMatchWidth:"wide",parsePatterns:WA,defaultParseWidth:"any"}),quarter:oo({matchPatterns:ZA,defaultMatchWidth:"wide",parsePatterns:ej,defaultParseWidth:"any",valueCallback:n=>n+1}),month:oo({matchPatterns:tj,defaultMatchWidth:"wide",parsePatterns:nj,defaultParseWidth:"any"}),day:oo({matchPatterns:rj,defaultMatchWidth:"wide",parsePatterns:sj,defaultParseWidth:"any"}),dayPeriod:oo({matchPatterns:ij,defaultMatchWidth:"any",parsePatterns:aj,defaultParseWidth:"any"})},av={code:"en-US",formatDistance:CA,formatLong:LA,formatRelative:PA,localize:GA,match:oj,options:{weekStartsOn:0,firstWeekContainsDate:1}};function lj(n,t){const s=kn(n,t==null?void 0:t.in);return wA(s,NA(s))+1}function cj(n,t){const s=kn(n,t==null?void 0:t.in),i=+bu(s)-+SA(s);return Math.round(i/rv)+1}function ov(n,t){var d,b,x,v;const s=kn(n,t==null?void 0:t.in),i=s.getFullYear(),o=Lo(),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)??o.firstWeekContainsDate??((v=(x=o.locale)==null?void 0:x.options)==null?void 0:v.firstWeekContainsDate)??1,m=Br((t==null?void 0:t.in)||n,0);m.setFullYear(i+1,0,c),m.setHours(0,0,0,0);const p=No(m,t),g=Br((t==null?void 0:t.in)||n,0);g.setFullYear(i,0,c),g.setHours(0,0,0,0);const u=No(g,t);return+s>=+p?i+1:+s>=+u?i:i-1}function uj(n,t){var p,g,u,d;const s=Lo(),i=(t==null?void 0:t.firstWeekContainsDate)??((g=(p=t==null?void 0:t.locale)==null?void 0:p.options)==null?void 0:g.firstWeekContainsDate)??s.firstWeekContainsDate??((d=(u=s.locale)==null?void 0:u.options)==null?void 0:d.firstWeekContainsDate)??1,o=ov(n,t),c=Br((t==null?void 0:t.in)||n,0);return c.setFullYear(o,0,i),c.setHours(0,0,0,0),No(c,t)}function fj(n,t){const s=kn(n,t==null?void 0:t.in),i=+No(s,t)-+uj(s,t);return Math.round(i/rv)+1}function tt(n,t){const s=n<0?"-":"",i=Math.abs(n).toString().padStart(t,"0");return s+i}const ys={y(n,t){const s=n.getFullYear(),i=s>0?s:1-s;return tt(t==="yy"?i%100:i,t.length)},M(n,t){const s=n.getMonth();return t==="M"?String(s+1):tt(s+1,2)},d(n,t){return tt(n.getDate(),t.length)},a(n,t){const s=n.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return s.toUpperCase();case"aaa":return s;case"aaaaa":return s[0];case"aaaa":default:return s==="am"?"a.m.":"p.m."}},h(n,t){return tt(n.getHours()%12||12,t.length)},H(n,t){return tt(n.getHours(),t.length)},m(n,t){return tt(n.getMinutes(),t.length)},s(n,t){return tt(n.getSeconds(),t.length)},S(n,t){const s=t.length,i=n.getMilliseconds(),o=Math.trunc(i*Math.pow(10,s-3));return tt(o,t.length)}},Hi={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Ab={G:function(n,t,s){const i=n.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return s.era(i,{width:"abbreviated"});case"GGGGG":return s.era(i,{width:"narrow"});case"GGGG":default:return s.era(i,{width:"wide"})}},y:function(n,t,s){if(t==="yo"){const i=n.getFullYear(),o=i>0?i:1-i;return s.ordinalNumber(o,{unit:"year"})}return ys.y(n,t)},Y:function(n,t,s,i){const o=ov(n,i),c=o>0?o:1-o;if(t==="YY"){const m=c%100;return tt(m,2)}return t==="Yo"?s.ordinalNumber(c,{unit:"year"}):tt(c,t.length)},R:function(n,t){const s=sv(n);return tt(s,t.length)},u:function(n,t){const s=n.getFullYear();return tt(s,t.length)},Q:function(n,t,s){const i=Math.ceil((n.getMonth()+1)/3);switch(t){case"Q":return String(i);case"QQ":return tt(i,2);case"Qo":return s.ordinalNumber(i,{unit:"quarter"});case"QQQ":return s.quarter(i,{width:"abbreviated",context:"formatting"});case"QQQQQ":return s.quarter(i,{width:"narrow",context:"formatting"});case"QQQQ":default:return s.quarter(i,{width:"wide",context:"formatting"})}},q:function(n,t,s){const i=Math.ceil((n.getMonth()+1)/3);switch(t){case"q":return String(i);case"qq":return tt(i,2);case"qo":return s.ordinalNumber(i,{unit:"quarter"});case"qqq":return s.quarter(i,{width:"abbreviated",context:"standalone"});case"qqqqq":return s.quarter(i,{width:"narrow",context:"standalone"});case"qqqq":default:return s.quarter(i,{width:"wide",context:"standalone"})}},M:function(n,t,s){const i=n.getMonth();switch(t){case"M":case"MM":return ys.M(n,t);case"Mo":return s.ordinalNumber(i+1,{unit:"month"});case"MMM":return s.month(i,{width:"abbreviated",context:"formatting"});case"MMMMM":return s.month(i,{width:"narrow",context:"formatting"});case"MMMM":default:return s.month(i,{width:"wide",context:"formatting"})}},L:function(n,t,s){const i=n.getMonth();switch(t){case"L":return String(i+1);case"LL":return tt(i+1,2);case"Lo":return s.ordinalNumber(i+1,{unit:"month"});case"LLL":return s.month(i,{width:"abbreviated",context:"standalone"});case"LLLLL":return s.month(i,{width:"narrow",context:"standalone"});case"LLLL":default:return s.month(i,{width:"wide",context:"standalone"})}},w:function(n,t,s,i){const o=fj(n,i);return t==="wo"?s.ordinalNumber(o,{unit:"week"}):tt(o,t.length)},I:function(n,t,s){const i=cj(n);return t==="Io"?s.ordinalNumber(i,{unit:"week"}):tt(i,t.length)},d:function(n,t,s){return t==="do"?s.ordinalNumber(n.getDate(),{unit:"date"}):ys.d(n,t)},D:function(n,t,s){const i=lj(n);return t==="Do"?s.ordinalNumber(i,{unit:"dayOfYear"}):tt(i,t.length)},E:function(n,t,s){const i=n.getDay();switch(t){case"E":case"EE":case"EEE":return s.day(i,{width:"abbreviated",context:"formatting"});case"EEEEE":return s.day(i,{width:"narrow",context:"formatting"});case"EEEEEE":return s.day(i,{width:"short",context:"formatting"});case"EEEE":default:return s.day(i,{width:"wide",context:"formatting"})}},e:function(n,t,s,i){const o=n.getDay(),c=(o-i.weekStartsOn+8)%7||7;switch(t){case"e":return String(c);case"ee":return tt(c,2);case"eo":return s.ordinalNumber(c,{unit:"day"});case"eee":return s.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return s.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return s.day(o,{width:"short",context:"formatting"});case"eeee":default:return s.day(o,{width:"wide",context:"formatting"})}},c:function(n,t,s,i){const o=n.getDay(),c=(o-i.weekStartsOn+8)%7||7;switch(t){case"c":return String(c);case"cc":return tt(c,t.length);case"co":return s.ordinalNumber(c,{unit:"day"});case"ccc":return s.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return s.day(o,{width:"narrow",context:"standalone"});case"cccccc":return s.day(o,{width:"short",context:"standalone"});case"cccc":default:return s.day(o,{width:"wide",context:"standalone"})}},i:function(n,t,s){const i=n.getDay(),o=i===0?7:i;switch(t){case"i":return String(o);case"ii":return tt(o,t.length);case"io":return s.ordinalNumber(o,{unit:"day"});case"iii":return s.day(i,{width:"abbreviated",context:"formatting"});case"iiiii":return s.day(i,{width:"narrow",context:"formatting"});case"iiiiii":return s.day(i,{width:"short",context:"formatting"});case"iiii":default:return s.day(i,{width:"wide",context:"formatting"})}},a:function(n,t,s){const o=n.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"aaa":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"aaaa":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},b:function(n,t,s){const i=n.getHours();let o;switch(i===12?o=Hi.noon:i===0?o=Hi.midnight:o=i/12>=1?"pm":"am",t){case"b":case"bb":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"bbb":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"bbbb":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},B:function(n,t,s){const i=n.getHours();let o;switch(i>=17?o=Hi.evening:i>=12?o=Hi.afternoon:i>=4?o=Hi.morning:o=Hi.night,t){case"B":case"BB":case"BBB":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"BBBBB":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"BBBB":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},h:function(n,t,s){if(t==="ho"){let i=n.getHours()%12;return i===0&&(i=12),s.ordinalNumber(i,{unit:"hour"})}return ys.h(n,t)},H:function(n,t,s){return t==="Ho"?s.ordinalNumber(n.getHours(),{unit:"hour"}):ys.H(n,t)},K:function(n,t,s){const i=n.getHours()%12;return t==="Ko"?s.ordinalNumber(i,{unit:"hour"}):tt(i,t.length)},k:function(n,t,s){let i=n.getHours();return i===0&&(i=24),t==="ko"?s.ordinalNumber(i,{unit:"hour"}):tt(i,t.length)},m:function(n,t,s){return t==="mo"?s.ordinalNumber(n.getMinutes(),{unit:"minute"}):ys.m(n,t)},s:function(n,t,s){return t==="so"?s.ordinalNumber(n.getSeconds(),{unit:"second"}):ys.s(n,t)},S:function(n,t){return ys.S(n,t)},X:function(n,t,s){const i=n.getTimezoneOffset();if(i===0)return"Z";switch(t){case"X":return kb(i);case"XXXX":case"XX":return Ws(i);case"XXXXX":case"XXX":default:return Ws(i,":")}},x:function(n,t,s){const i=n.getTimezoneOffset();switch(t){case"x":return kb(i);case"xxxx":case"xx":return Ws(i);case"xxxxx":case"xxx":default:return Ws(i,":")}},O:function(n,t,s){const i=n.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+jb(i,":");case"OOOO":default:return"GMT"+Ws(i,":")}},z:function(n,t,s){const i=n.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+jb(i,":");case"zzzz":default:return"GMT"+Ws(i,":")}},t:function(n,t,s){const i=Math.trunc(+n/1e3);return tt(i,t.length)},T:function(n,t,s){return tt(+n,t.length)}};function jb(n,t=""){const s=n>0?"-":"+",i=Math.abs(n),o=Math.trunc(i/60),c=i%60;return c===0?s+String(o):s+String(o)+t+tt(c,2)}function kb(n,t){return n%60===0?(n>0?"-":"+")+tt(Math.abs(n)/60,2):Ws(n,t)}function Ws(n,t=""){const s=n>0?"-":"+",i=Math.abs(n),o=tt(Math.trunc(i/60),2),c=tt(i%60,2);return s+o+t+c}const Nb=(n,t)=>{switch(n){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},lv=(n,t)=>{switch(n){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},hj=(n,t)=>{const s=n.match(/(P+)(p+)?/)||[],i=s[1],o=s[2];if(!o)return Nb(n,t);let c;switch(i){case"P":c=t.dateTime({width:"short"});break;case"PP":c=t.dateTime({width:"medium"});break;case"PPP":c=t.dateTime({width:"long"});break;case"PPPP":default:c=t.dateTime({width:"full"});break}return c.replace("{{date}}",Nb(i,t)).replace("{{time}}",lv(o,t))},dj={p:lv,P:hj},mj=/^D+$/,pj=/^Y+$/,yj=["D","DD","YY","YYYY"];function gj(n){return mj.test(n)}function bj(n){return pj.test(n)}function xj(n,t,s){const i=vj(n,t,s);if(console.warn(i),yj.includes(n))throw new RangeError(i)}function vj(n,t,s){const i=n[0]==="Y"?"years":"days of the month";return`Use \`${n.toLowerCase()}\` instead of \`${n}\` (in \`${t}\`) for formatting ${i} to the input \`${s}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const _j=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,wj=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Sj=/^'([^]*?)'?$/,Ej=/''/g,Oj=/[a-zA-Z]/;function Aj(n,t,s){var d,b,x,v;const i=Lo(),o=i.locale??av,c=i.firstWeekContainsDate??((b=(d=i.locale)==null?void 0:d.options)==null?void 0:b.firstWeekContainsDate)??1,m=i.weekStartsOn??((v=(x=i.locale)==null?void 0:x.options)==null?void 0:v.weekStartsOn)??0,p=kn(n,s==null?void 0:s.in);if(!jA(p))throw new RangeError("Invalid time value");let g=t.match(wj).map(w=>{const S=w[0];if(S==="p"||S==="P"){const C=dj[S];return C(w,o.formatLong)}return w}).join("").match(_j).map(w=>{if(w==="''")return{isToken:!1,value:"'"};const S=w[0];if(S==="'")return{isToken:!1,value:jj(w)};if(Ab[S])return{isToken:!0,value:w};if(S.match(Oj))throw new RangeError("Format string contains an unescaped latin alphabet character `"+S+"`");return{isToken:!1,value:w}});o.localize.preprocessor&&(g=o.localize.preprocessor(p,g));const u={firstWeekContainsDate:c,weekStartsOn:m,locale:o};return g.map(w=>{if(!w.isToken)return w.value;const S=w.value;(bj(S)||gj(S))&&xj(S,t,String(n));const C=Ab[S[0]];return C(p,S,o.localize,u)}).join("")}function jj(n){const t=n.match(Sj);return t?t[1].replace(Ej,"'"):n}function kj(n,t,s){const i=Lo(),o=(s==null?void 0:s.locale)??i.locale??av,c=EA(n,t);if(isNaN(c))throw new RangeError("Invalid time value");const m=Object.assign({},s,{addSuffix:s==null?void 0:s.addSuffix,comparison:c}),[p,g]=iv(s==null?void 0:s.in,...c>0?[t,n]:[n,t]),u=kA((s==null?void 0:s.roundingMethod)??"round"),d=g.getTime()-p.getTime(),b=d/vb,x=xu(g)-xu(p),v=(d-x)/vb,w=s==null?void 0:s.unit;let S;if(w?S=w:b<1?S="second":b<60?S="minute":b<Sb?S="hour":v<wb?S="day":v<_b?S="month":S="year",S==="second"){const C=u(d/1e3);return o.formatDistance("xSeconds",C,m)}else if(S==="minute"){const C=u(b);return o.formatDistance("xMinutes",C,m)}else if(S==="hour"){const C=u(b/60);return o.formatDistance("xHours",C,m)}else if(S==="day"){const C=u(v/Sb);return o.formatDistance("xDays",C,m)}else if(S==="month"){const C=u(v/wb);return C===12&&w!=="month"?o.formatDistance("xYears",1,m):o.formatDistance("xMonths",C,m)}else{const C=u(v/_b);return o.formatDistance("xYears",C,m)}}function Nj(n,t){return kj(n,OA(n),t)}let vu=null;function Tj(n){vu=n||null}function Cj(){return vu}function Mj(n,t,s){const i=new Intl.DateTimeFormat("en-US",{timeZone:t,year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit",...s?{second:"2-digit"}:{},hour12:!0}).formatToParts(n);return Object.fromEntries(i.map(o=>[o.type,o.value]))}function Am(n,t=!1){const s=typeof n=="string"?new Date(n):n;if(Number.isNaN(s.getTime()))return String(n);if(!vu)return Aj(s,t?"MMM d, yyyy h:mm:ss a":"MMM d, yyyy h:mm a");const i=Mj(s,vu,t),o=`${i.hour}:${i.minute}${t?`:${i.second}`:""}`;return`${i.month} ${i.day}, ${i.year} ${o} ${i.dayPeriod}`}function Rj(n){const t=n??[];return t.length>0&&t.every(s=>s.type==="member"&&s.write_scope==="none")}const jm={staleTime:5*6e4,refetchOnWindowFocus:!1};function i5(n={},t={}){const s=new URLSearchParams;return n.role&&s.set("role",n.role),n.roleType&&s.set("roleType",n.roleType),n.status&&s.set("status",n.status),n.search&&s.set("search",n.search),n.limit&&s.set("limit",String(n.limit)),n.offset!==void 0&&s.set("offset",String(n.offset)),qe({queryKey:["users",n],queryFn:()=>ue(`/users?${s}`),enabled:t.enabled??!0,...jm})}const Tb=200;async function Dj(n){const t=[];for(let s=0;s<n.length;s+=Tb){const i=await ue("/users/names",{method:"POST",body:JSON.stringify({ids:n.slice(s,s+Tb)})});t.push(...i.users??[])}return t}let Kd=[],Jd=new Map,Qd=!1;function Lj(){const n=Kd,t=Jd;Kd=[],Jd=new Map,Qd=!1,Dj(n).then(s=>{const i=new Map(s.map(o=>[o.id,o]));for(const[o,c]of t)c.resolve(i.get(o)??null)}).catch(s=>{for(const i of t.values())i.reject(s)})}function qj(n){return new Promise((t,s)=>{Kd.push(n),Jd.set(n,{resolve:t,reject:s}),Qd||(Qd=!0,setTimeout(Lj,0))})}function a5(n){return qe({queryKey:["user-name",n],queryFn:()=>qj(n),enabled:!!n,...jm})}function Pj(n){return qe({queryKey:["users",n,"roles"],queryFn:async()=>(await ue(`/users/${n}/roles`)).roles??[],enabled:!!n,...jm})}function o5(){const n=Be();return Fe({mutationFn:t=>ue("/users",{method:"POST",body:JSON.stringify(t)}),onSuccess:()=>{n.invalidateQueries({queryKey:["users"]})}})}function l5(){const n=Be();return Fe({mutationFn:({id:t,...s})=>ue(`/users/${t}`,{method:"PUT",body:JSON.stringify(s)}),onSuccess:()=>{n.invalidateQueries({queryKey:["users"]})}})}function c5(){const n=Be();return Fe({mutationFn:({id:t,ops:s})=>ue(`/users/${t}/properties`,{method:"PATCH",body:JSON.stringify(s)}),onSuccess:()=>{n.invalidateQueries({queryKey:["users"]})}})}function u5(){return qe({queryKey:["users","system-property-keys"],queryFn:()=>ue("/users/system-property-keys")})}function f5(){const n=Be();return Fe({mutationFn:t=>ue(`/users/${t}`,{method:"DELETE"}),onSuccess:()=>{n.invalidateQueries({queryKey:["users"]})}})}function h5(){const n=Be();return Fe({mutationFn:({userId:t,role:s,type:i,read_scope:o,write_scope:c})=>ue(`/users/${t}/roles`,{method:"POST",body:JSON.stringify({role:s,type:i,read_scope:o,write_scope:c})}),onSuccess:()=>{n.invalidateQueries({queryKey:["users"]})}})}function d5(){const n=Be();return Fe({mutationFn:({userId:t,role:s})=>ue(`/users/${t}/roles/${encodeURIComponent(s)}`,{method:"DELETE"}),onSuccess:()=>{n.invalidateQueries({queryKey:["users"]})}})}const m5={MAX_PORTALS:12,MAX_ROWS:4,MAX_COLS:6,MAX_COUNTS:8};function Bj(){return qe({queryKey:["roles"],queryFn:()=>ue("/roles")})}function Cu(n){return qe({queryKey:["roles","details"],queryFn:()=>ue("/roles/details"),enabled:(n==null?void 0:n.enabled)??!0})}function p5(n,t,s=!0){return qe({queryKey:["roles",n,"schema",t??"latest"],queryFn:()=>ue(`/roles/${encodeURIComponent(n)}/schema${t!=null?`?version=${t}`:""}`),enabled:s&&!!n})}function y5(n){return qe({queryKey:["roles",n,"schema-versions"],queryFn:()=>ue(`/roles/${encodeURIComponent(n)}/schema/versions`),enabled:!!n})}function g5(n,t,s=!0){return qe({queryKey:["roles",n,"list-schema",t??"latest"],queryFn:()=>ue(`/roles/${encodeURIComponent(n)}/list-schema${t!=null?`?version=${t}`:""}`),enabled:s&&!!n})}function b5(n){return qe({queryKey:["roles",n,"list-schema-versions"],queryFn:()=>ue(`/roles/${encodeURIComponent(n)}/list-schema/versions`),enabled:!!n})}function x5(){const n=Be();return Fe({mutationFn:t=>ue("/roles",{method:"POST",body:JSON.stringify({role:t})}),onSuccess:()=>{n.invalidateQueries({queryKey:["roles"]})}})}function v5(){const n=Be();return Fe({mutationFn:({role:t,...s})=>ue(`/roles/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify(s)}),onMutate:async({role:t,...s})=>{await n.cancelQueries({queryKey:["roles","details"]});const i=n.getQueryData(["roles","details"]);return i&&n.setQueryData(["roles","details"],{roles:i.roles.map(o=>o.role===t?{...o,...s}:o)}),{previous:i}},onError:(t,s,i)=>{i!=null&&i.previous&&n.setQueryData(["roles","details"],i.previous)},onSuccess:()=>{n.invalidateQueries({queryKey:["roles"]})}})}function _5(){const n=Be();return Fe({mutationFn:t=>ue(`/roles/${encodeURIComponent(t)}`,{method:"DELETE"}),onSuccess:()=>{n.invalidateQueries({queryKey:["roles"]})}})}const cv="lt:station:kiosk-role:";function Xd(n){return`${cv}${n}`}const Wd=new Set;function Uj(){for(const n of Wd)n()}function zj(n){try{return localStorage.getItem(Xd(n))}catch{return null}}function Ij(n,t){try{t===null?localStorage.removeItem(Xd(n)):localStorage.setItem(Xd(n),t)}catch{}Uj()}function $j(n){Wd.add(n);const t=s=>{(s.key===null||s.key.startsWith(cv))&&n()};try{window.addEventListener("storage",t)}catch{}return()=>{Wd.delete(n);try{window.removeEventListener("storage",t)}catch{}}}function Hj(n){return E.useSyncExternalStore($j,()=>n?zj(n):null)}const _u="/portal";function Fj(n){return n===_u||n.startsWith(`${_u}/`)}function km(n,t){const s=`${_u}/${encodeURIComponent(n)}`;return t?`${s}/${encodeURIComponent(t)}`:s}function ea(n){return Array.isArray(n==null?void 0:n.portals)?n.portals:[]}function Gj(n){return ea(n).length>0}function w5(n,t){const s=n.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)||"portal",i=new Set(t);if(!i.has(s))return s;let o=2;for(;i.has(`${s}-${o}`);)o+=1;return`${s}-${o}`}function uv(n,t){return t.length>0?km(n,t[0].key):`/escalations/available?role=${encodeURIComponent(n)}&status=available`}function Nm(){const{user:n}=qt(),t=(n==null?void 0:n.userId)??null,{data:s}=Pj(t),{data:i}=Cu(),o=Hj(t),c=E.useCallback(m=>{t&&Ij(t,m)},[t]);return E.useMemo(()=>{const m={kiosk:!1,role:null,homePath:null,targets:[],selectable:!1,selectRole:c},p=s??[];if(p.length===0||p.some(v=>v.type!=="member"))return m;const g=v=>{var w;return(w=i==null?void 0:i.roles)==null?void 0:w.find(S=>S.role===v)},u=v=>{var w,S;return((S=(w=g(v))==null?void 0:w.properties)==null?void 0:S.kiosk)===!0},d=p.map(v=>v.role).filter(u),b=v=>({kiosk:!0,role:v,homePath:uv(v,ea(g(v))),targets:d,selectable:d.length>=2,selectRole:c});if(p.length===1)return d.length===1?b(d[0]):m;if(!Rj(p)||d.length===0)return m;const x=o&&d.includes(o)?o:d.length===1?d[0]:null;return x?b(x):{...m,targets:d,selectable:!0}},[s,i,o,c])}const Vj="/escalations/available",Yj=["/escalations",_u,"/scan","/login"];function Kj(n,t=""){if(n===Vj){const s=new URLSearchParams(t);if(!s.get("role")&&!s.get("facets"))return!1}return Yj.some(s=>n===s||n.startsWith(`${s}/`)||n.startsWith(`${s}?`))}const Tm=E.createContext(null),cd="lt_sidebar_collapsed",fv="(max-width: 1023px)";function Jj(){try{return window.matchMedia(fv).matches}catch{return!1}}function Qj({children:n}){const[t,s]=E.useState(()=>{if(Jj())return!0;try{return localStorage.getItem(cd)==="true"}catch{return!1}});E.useEffect(()=>{let o;try{o=window.matchMedia(fv)}catch{return}const c=m=>{if(m.matches)s(!0);else try{s(localStorage.getItem(cd)==="true")}catch{s(!1)}};return o.addEventListener("change",c),()=>o.removeEventListener("change",c)},[]);const i=E.useCallback(()=>{s(o=>{const c=!o;try{localStorage.setItem(cd,String(c))}catch{}return c})},[]);return h.jsx(Tm.Provider,{value:{collapsed:t,toggle:i},children:n})}function Xj({children:n}){return h.jsx(Tm.Provider,{value:{collapsed:!1,toggle:()=>{}},children:n})}function Cm(){const n=E.useContext(Tm);if(!n)throw new Error("useSidebar must be used within SidebarProvider");return n}const Cb=380,Mm=E.createContext(null);function Wj({children:n}){const[t,s]=E.useState({node:null,width:Cb,open:!1,ownerKey:null}),i=en(),o=E.useRef(i.pathname),c=E.useCallback((p,g)=>{s({node:p,width:(g==null?void 0:g.width)??Cb,open:!0,ownerKey:(g==null?void 0:g.key)??null})},[]),m=E.useCallback(p=>{s(g=>typeof p=="string"&&g.ownerKey!==p?g:{...g,open:!1})},[]);return E.useEffect(()=>{i.pathname!==o.current&&(o.current=i.pathname,s(p=>p.open||p.node?{...p,node:null,open:!1,ownerKey:null}:p))},[i.pathname]),h.jsx(Mm.Provider,{value:{...t,setPanel:c,closePanel:m},children:n})}function Rm(){const n=E.useContext(Mm);if(!n)throw new Error("useShellPanel must be used within ShellPanelProvider");return n}function S5(){return E.useContext(Mm)}function Zj({open:n,width:t=380,children:s,className:i=""}){const[o,c]=E.useState(n);return E.useEffect(()=>{n&&c(!0)},[n]),h.jsx("div",{className:`shrink-0 overflow-hidden transition-[width] duration-300 ease-out ${i}`,style:{width:n?t:0,maxWidth:"50%"},onTransitionEnd:m=>{!n&&m.propertyName==="width"&&c(!1)},children:h.jsx("div",{style:{width:t},className:"h-full",children:o?s:null})})}function E5({label:n,children:t}){return h.jsxs("div",{children:[h.jsx("dt",{className:"text-2xs font-medium text-text-secondary uppercase tracking-wide",children:n}),h.jsx("dd",{className:"text-xs text-text-primary mt-0.5",children:t})]})}function O5({views:n,activeId:t,onViewChange:s,onClose:i,headerActions:o,stickyClassName:c,labelInline:m}){const p=n.find(g=>g.id===t)??n[0];return p?h.jsx("div",{className:"h-full bg-surface-hover",children:h.jsxs("div",{className:`flex flex-col ${c??"sticky top-0 z-10 max-h-[calc(100vh-3.5rem)]"}`,children:[h.jsxs("div",{className:`flex items-center justify-between pl-4 pr-3 shrink-0 ${m?"pt-10 pb-2":"pt-3"}`,children:[h.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[h.jsx("div",{className:"flex items-center gap-1 shrink-0",role:"radiogroup","aria-label":"Panel view",children:n.map(g=>{const u=g.icon,d=g.id===p.id;return h.jsx("button",{role:"radio","aria-checked":d,onClick:()=>s(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:h.jsx(u,{className:"w-3.5 h-3.5"})},g.id)})}),m&&h.jsx("span",{className:"text-2xs font-semibold uppercase tracking-widest text-text-secondary truncate",children:p.label})]}),h.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[o,i&&h.jsx("button",{onClick:i,title:"Close panel",className:"p-1 rounded text-accent/60 hover:text-accent hover:bg-surface-hover transition-colors",children:h.jsx(Zt,{className:"w-3.5 h-3.5"})})]})]}),!m&&h.jsx("p",{className:"px-5 pt-2 pb-1 text-2xs font-semibold uppercase tracking-widest text-text-secondary shrink-0",children:p.label}),h.jsx("div",{className:`flex-1 overflow-y-auto px-5 ${m?"pt-4 pb-8":"pb-5 pt-1"}`,children:p.content})]})}):null}function hv(n,t){var s,i,o,c,m;t.facets&&Object.keys(t.facets).length&&n.set("facets",JSON.stringify(t.facets)),(s=t.block)!=null&&s.length&&n.set("block",JSON.stringify(t.block)),(i=t.range)!=null&&i.length&&n.set("range",JSON.stringify(t.range)),(o=t.exists)!=null&&o.length&&n.set("exists",JSON.stringify(t.exists)),(c=t.roles)!=null&&c.length&&n.set("roles",JSON.stringify(t.roles)),(m=t.orderBy)!=null&&m.length&&n.set("orderBy",JSON.stringify(t.orderBy)),t.available!==void 0&&n.set("available",String(t.available)),t.jeopardy===!0&&n.set("jeopardy","1"),t.include&&n.set("include",t.include),t.groupBy&&n.set("groupBy",t.groupBy)}function A5(n,t,s){const i=n??"24h",o=t&&Object.keys(t).length?JSON.stringify(t):null;return qe({queryKey:["stationMetrics",i,o],queryFn:()=>ue(`/escalations/station-metrics?period=${i}${o?`&facets=${encodeURIComponent(o)}`:""}`),staleTime:5e3,enabled:(s==null?void 0:s.enabled)??!0})}function j5(n){const t=n?`?period=${n}`:"";return qe({queryKey:["escalationStats",n],queryFn:()=>ue(`/escalations/stats${t}`)})}function k5(){return qe({queryKey:["escalationTypes"],queryFn:()=>ue("/escalations/types")})}function N5(n=!0){return qe({queryKey:["escalationFacetKeys"],queryFn:()=>ue("/escalations/facet-keys"),enabled:n,staleTime:6e4})}function ek(n){return qe({queryKey:["escalationFacetValues",n],queryFn:()=>ue(`/escalations/facet-values?key=${encodeURIComponent(n)}`),enabled:!!n,staleTime:6e4})}function dv(n){const{enabled:t=!0,staleTime:s,...i}=n,o=new URLSearchParams;return i.status&&o.set("status",i.status),i.role&&o.set("role",i.role),i.type&&o.set("type",i.type),i.subtype&&o.set("subtype",i.subtype),i.assigned_to&&o.set("assigned_to",i.assigned_to),i.parent_id&&o.set("parent_id",i.parent_id),i.claimed&&o.set("claimed","true"),i.priority&&o.set("priority",String(i.priority)),i.limit&&o.set("limit",String(i.limit)),i.offset!==void 0&&o.set("offset",String(i.offset)),i.sort_by&&o.set("sort_by",i.sort_by),i.order&&o.set("order",i.order),i.search&&o.set("search",i.search),hv(o,i),qe({queryKey:["escalations",i],queryFn:()=>ue(`/escalations?${o}`),enabled:t,...s!==void 0?{staleTime:s}:{}})}function mv(n){const{enabled:t=!0,staleTime:s,...i}=n,o=new URLSearchParams;return i.role&&o.set("role",i.role),i.type&&o.set("type",i.type),i.subtype&&o.set("subtype",i.subtype),i.priority&&o.set("priority",String(i.priority)),i.limit&&o.set("limit",String(i.limit)),i.offset!==void 0&&o.set("offset",String(i.offset)),i.sort_by&&o.set("sort_by",i.sort_by),i.order&&o.set("order",i.order),i.search&&o.set("search",i.search),hv(o,i),qe({queryKey:["escalations","available",i],queryFn:()=>ue(`/escalations/available?${o}`),enabled:t,...s!==void 0?{staleTime:s}:{}})}function T5(n){return qe({queryKey:["escalations","by-workflow",n],queryFn:()=>ue(`/escalations/by-workflow/${n}`),enabled:!!n})}function C5(n){return qe({queryKey:["escalations",n],queryFn:()=>ue(`/escalations/${n}`),enabled:!!n})}function M5(n,t){return qe({queryKey:["escalations",n,"lookups"],queryFn:()=>ue(`/escalations/${n}/lookups`),enabled:!!n&&t,staleTime:0,refetchOnWindowFocus:!1})}function R5(){const n=Be();return Fe({mutationFn:({id:t,durationMinutes:s})=>ue(`/escalations/${t}/claim`,{method:"POST",body:JSON.stringify({durationMinutes:s})}),onSuccess:()=>{n.resetQueries({queryKey:["escalations"]}),n.resetQueries({queryKey:["escalationStats"]})}})}function D5(){const n=Be();return Fe({mutationFn:t=>ue(`/escalations/${t}/release`,{method:"POST"}),onSuccess:()=>{n.resetQueries({queryKey:["escalations"]}),n.resetQueries({queryKey:["escalationStats"]})}})}function L5(){const n=Be();return Fe({mutationFn:({id:t,resolverPayload:s})=>ue(`/escalations/${t}/resolve`,{method:"POST",body:JSON.stringify({resolverPayload:s})}),onSuccess:()=>{n.resetQueries({queryKey:["escalations"]}),n.resetQueries({queryKey:["escalationStats"]}),n.resetQueries({queryKey:["tasks"]}),n.resetQueries({queryKey:["jobs"]})}})}function q5(){const n=Be();return Fe({mutationFn:({id:t,itemKey:s,payload:i})=>ue(`/escalations/${t}/accumulate`,{method:"POST",body:JSON.stringify({itemKey:s,...i?{payload:i}:{}})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"]})}})}function P5(){const n=Be();return Fe({mutationFn:({id:t,itemKey:s})=>ue(`/escalations/${t}/remove-item`,{method:"POST",body:JSON.stringify({itemKey:s})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"]})}})}function B5(){const n=Be();return Fe({mutationFn:({id:t,targetRole:s})=>ue(`/escalations/${t}/escalate`,{method:"PATCH",body:JSON.stringify({targetRole:s})}),onSuccess:()=>{n.resetQueries({queryKey:["escalations"]}),n.resetQueries({queryKey:["escalationStats"]})}})}function U5(){const n=Be();return Fe({mutationFn:({ids:t,priority:s})=>ue("/escalations/priority",{method:"PATCH",body:JSON.stringify({ids:t,priority:s})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),n.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function z5(){const n=Be();return Fe({mutationFn:({ids:t,durationMinutes:s})=>ue("/escalations/bulk-claim",{method:"POST",body:JSON.stringify({ids:t,durationMinutes:s})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),n.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function I5(){const n=Be();return Fe({mutationFn:({ids:t,targetUserId:s,durationMinutes:i,reassign:o})=>ue("/escalations/bulk-assign",{method:"POST",body:JSON.stringify({ids:t,targetUserId:s,durationMinutes:i,...o?{reassign:!0}:{}})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),n.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function $5(){const n=Be();return Fe({mutationFn:({ids:t})=>ue("/escalations/bulk-unassign",{method:"POST",body:JSON.stringify({ids:t})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),n.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function H5(){const n=Be();return Fe({mutationFn:({ids:t,hint:s})=>ue("/escalations/bulk-triage",{method:"POST",body:JSON.stringify({ids:t,...s?{hint:s}:{}})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),n.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function F5(){const n=Be();return Fe({mutationFn:t=>ue(`/escalations/${t}/cancel`,{method:"POST"}),onSuccess:()=>{n.resetQueries({queryKey:["escalations"]}),n.resetQueries({queryKey:["escalationStats"]})}})}function G5(){const n=Be();return Fe({mutationFn:({ids:t})=>ue("/escalations/bulk-cancel",{method:"POST",body:JSON.stringify({ids:t})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),n.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function Dm(n){const t=[],s=n.type.split(".");switch(s[0]==="system"?s[1]:s[0]){case"task":t.push(["tasks"]),t.push(["jobs"]),t.push(["processes"]),n.workflowId&&(t.push(["workflowExecution",n.workflowId]),t.push(["workflowState",n.workflowId]),t.push(["mcpQueryExecution",n.workflowId])),n.originId&&t.push(["processes",n.originId]);break;case"escalation":t.push(["escalations"]),t.push(["escalationStats"]),t.push(["stationMetrics"]),n.workflowId&&t.push(["workflowExecution",n.workflowId]);break;case"workflow":t.push(["jobs"]),t.push(["tasks"]),t.push(["processes"]),n.workflowId&&(t.push(["workflowExecution",n.workflowId]),t.push(["workflowState",n.workflowId]),t.push(["mcpQueryExecution",n.workflowId]),t.push(["mcpQueryResult",n.workflowId]),t.push(["builderResult",n.workflowId]));break;case"activity":n.workflowId&&t.push(["mcpRunExecution",n.workflowId]),t.push(["mcpRuns"]);break;case"milestone":n.workflowId&&(t.push(["workflowExecution",n.workflowId]),t.push(["mcpQueryExecution",n.workflowId])),t.push(["tasks"]);break;case"knowledge":t.push(["knowledge"]);break;case"file":t.push(["files"]);break;case"agent":t.push(["agents"]);break;default:t.push(["jobs"]),t.push(["tasks"]);break}return t}const tk={DETAIL:{coalesceMs:300,minIntervalMs:2e3},LIST:{coalesceMs:500,minIntervalMs:3e3},SUMMARY:{coalesceMs:1e3,minIntervalMs:1e4}},V5=300,Mb={DETAIL:0,LIST:1,SUMMARY:2};function nk(n){const t=new Map,s={},i={};let o=!1;const c=()=>typeof document<"u"&&document.visibilityState==="hidden";function m(d){delete s[d],i[d]=Date.now();const b=[];for(const[v,w]of t)w===d&&b.push(v);for(const v of b)t.delete(v);if(b.length===0)return;const x=c();x&&(o=!0);for(const v of b)n.invalidateQueries({queryKey:JSON.parse(v),...x?{refetchType:"none"}:{}})}function p(d){if(s[d])return;const{coalesceMs:b,minIntervalMs:x}=tk[d],v=i[d],w=v===void 0?0:v+x-Date.now(),S=Math.max(b,w);s[d]=setTimeout(()=>m(d),S)}function g(d,b){for(const x of b){const v=JSON.stringify(x),w=t.get(v);(w===void 0||Mb[d]<Mb[w])&&t.set(v,d)}p(d)}const u=()=>{typeof document>"u"||document.visibilityState==="visible"&&o&&(o=!1,n.refetchQueries({type:"active",stale:!0}))};return typeof document<"u"&&document.addEventListener("visibilitychange",u),{request:g,dispose(){for(const d of Object.keys(s)){const b=s[d];b&&clearTimeout(b),delete s[d]}t.clear(),typeof document<"u"&&document.removeEventListener("visibilitychange",u)}}}const Rb=new WeakMap;function rk(n){let t=Rb.get(n);return t||(t=nk(n),Rb.set(n,t)),t}function tn(n){const t=Be();return E.useCallback(s=>{rk(t).request(n,s)},[t,n])}function Lm(n){return n?[`${Xt}.system.workflow.>`,`${Xt}.system.activity.>`,`${Xt}.system.milestone.>`,`${Xt}.system.task.>`,`${Xt}.system.escalation.>`]:[]}function Y5(){const n=tn("LIST");An(`${Xt}.system.task.>`,()=>{n([["jobs"]])}),An(`${Xt}.system.workflow.>`,()=>{n([["jobs"]])})}function K5(n){const t=tn("DETAIL");js(Lm(n),s=>{var p;if(!n||!(s.workflowId===n||((p=s.workflowId)==null?void 0:p.includes(n))))return;const o=s.type.split("."),c=o[0]==="system"?o[1]:o[0],m=Dm(s);c==="escalation"&&m.push(["escalations","by-workflow",n]),t(m)})}function J5(n){const t=tn("DETAIL");js(Lm(n),s=>{var p;if(!n||!(s.workflowId===n||((p=s.workflowId)==null?void 0:p.includes(n))))return;const o=s.type.split("."),c=o[0]==="system"?o[1]:o[0],m=Dm(s);c==="escalation"&&m.push(["escalations","by-workflow",n]),t(m)})}function Q5(n){const t=tn("DETAIL");js(Lm(n),s=>{var c;if(!n||!(s.workflowId===n||((c=s.workflowId)==null?void 0:c.includes(n))))return;const o=Dm(s);o.push(["workflowSets"]),o.push(["yamlWorkflows"]),t(o)})}function X5(n){const t=tn("DETAIL"),s=E.useCallback(i=>{n&&(i.originId!==n&&i.workflowId!==n||t([["processes",n]]))},[n,t]);An(`${Xt}.system.task.>`,s),An(`${Xt}.system.workflow.>`,s),An(`${Xt}.system.escalation.>`,s)}function W5(){const n=tn("SUMMARY");An(fr({}),()=>{n([["escalationStats"]])})}function Z5(){const n=tn("SUMMARY");An(fr({}),()=>{n([["stationMetrics"]])})}function eM(){const n=tn("SUMMARY");An(fr({}),()=>{n([["escAggregate"],["escTimeline"]])})}function tM(n){const t=tn("LIST"),s=(n==null?void 0:n.role)??null,i=((n==null?void 0:n.verbs)??[]).join(","),o=E.useMemo(()=>{const c=i?i.split(","):null;return c?Vd({role:s,verbs:c}):[fr({role:s})]},[s,i]);js(o,()=>{t([["escalations"]])})}const sk=[["escalations","related"],["escalations","related-rows"]];function nM(n){const t=tn("LIST"),s=[...new Set(n)].sort().join(","),i=E.useMemo(()=>s?s.split(",").map(o=>fr({role:o})):[],[s]);js(i,()=>{t(sk)})}function rM(n){const t=tn("DETAIL");An(fr(n?{id:n}:{id:"__none__"}),s=>{!n||s.escalationId!==n||t([["escalations",n]])})}function sM(){const n=tn("LIST");An(`${Xt}.system.agent.>`,()=>{n([["agents"]])})}function iM(){const n=tn("LIST");An(`${Xt}.system.task.>`,()=>{n([["processes"]])}),An(`${Xt}.system.workflow.>`,()=>{n([["processes"]])})}function ik(){const{user:n}=qt(),t=n==null?void 0:n.userId,s=tn("SUMMARY");js(Om(),()=>{s([["escalations"]])});const{data:i}=mv({limit:1}),{data:o}=dv({assigned_to:t,status:"pending",limit:1});return{available:(i==null?void 0:i.total)??0,mine:(o==null?void 0:o.total)??0}}function Mu({size:n="sm",hideLabel:t=!1,className:s="",appName:i="LongTail",variant:o="full"}){const c=n==="lg";if(o==="comet")return h.jsx("div",{className:`relative overflow-visible ${s}`,style:{width:"2.5rem",height:"2.5rem",flexShrink:0},children:h.jsx("span",{role:"img","aria-label":i,className:"logo-mark absolute pointer-events-none select-none",style:{"--logo-url":`url(${Vt}/logo512.png)`,width:"82px",height:"82px",top:"-12px",left:"-80px",transform:"rotate(232deg)",zIndex:-1,opacity:.55}})});if(o==="mark")return h.jsx("div",{className:`flex items-center ${s}`,children:h.jsx("span",{role:"img","aria-label":i,className:"logo-mark shrink-0 w-7 h-7",style:{"--logo-url":`url(${Vt}/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 h.jsxs("div",{className:`flex items-center ${s}`,style:{height:"50px"},children:[h.jsx("span",{role:"img","aria-label":i,className:`logo-mark shrink-0 z-0 ${m}`,style:{"--logo-url":`url(${Vt}/logo512.png)`}}),h.jsx("span",{className:`z-[1] transition-opacity duration-300 ${p} ${t?"opacity-0":""}`,children:i})]})}const ak="system.surfaces.dashboard",ok=`${Xt}.${ak}`;function pv(n=!0){return qe({queryKey:["announcements"],queryFn:()=>ue("/announcements"),enabled:n,staleTime:3e4})}function lk(){const n=Be();return Fe({mutationFn:t=>ue("/announcements",{method:"POST",body:JSON.stringify(t)}),onSuccess:()=>{n.invalidateQueries({queryKey:["announcements"]})}})}function ck(){const n=Be();return Fe({mutationFn:t=>ue(`/announcements/${encodeURIComponent(t)}`,{method:"DELETE"}),onSuccess:()=>{n.invalidateQueries({queryKey:["announcements"]})}})}function aM(n){return n.toLocaleString()}function oM(n){return n>=1e9?`${(n/1e9).toFixed(1).replace(/\.0$/,"")}B`:n>=1e6?`${(n/1e6).toFixed(1).replace(/\.0$/,"")}M`:n>=1e4?`${(n/1e3).toFixed(1).replace(/\.0$/,"")}K`:n.toLocaleString()}function uk(n){const t=new Date(n);return t.getTime()>Date.now()?"just now":Nj(t,{addSuffix:!0})}function lM(n){const t=Date.now()-new Date(n).getTime();if(t<0)return"now";const s=Math.floor(t/1e3);if(s<60)return`${s}s`;const i=Math.floor(s/60);if(i<60)return`${i}m`;const o=Math.floor(i/60);if(o<24)return`${o}h`;const c=Math.floor(o/24);return c<7?`${c}d`:c<30?`${Math.floor(c/7)}w`:c<365?`${Math.floor(c/30)}mo`:`${Math.floor(c/365)}y`}function cM(n){return n<=0?"Expired":qm(n)}function fk(n){return n==null?"--":qm(n)}function uM(n){return n?Am(n):"--"}function qm(n){if(n<1e3)return`${Math.round(n)}ms`;if(n<6e4){const m=n/1e3;return Number.isInteger(m)?`${m}s`:`${m.toFixed(1)}s`}const t=Math.floor(n/1e3),s=Math.floor(t/86400),i=Math.floor(t%86400/3600),o=Math.floor(t%3600/60),c=t%60;return s>0?i>0?`${s}d ${i}h`:`${s}d`:i>0?o>0?`${i}h ${o}m`:`${i}h`:c>0?`${o}m ${c}s`:`${o}m`}function fM(n,t){const s=new Date(n).getTime(),i=t?new Date(t).getTime():Date.now();return qm(i-s)}function yv({options:n,children:t,className:s=""}){const[i,o]=E.useState(!1),[c,m]=E.useState(null),[p,g]=E.useState(null),u=E.useRef(null),d=E.useRef(void 0),b=E.useRef(void 0),x=220,v=E.useCallback(()=>{if(!u.current)return;const P=u.current.getBoundingClientRect(),q=window.innerWidth-x-8,re=Math.max(8,Math.min(P.left,q));g({top:P.bottom+4,left:re})},[]),w=E.useCallback(async(P,q)=>{try{await navigator.clipboard.writeText(P),m(q),clearTimeout(d.current),d.current=setTimeout(()=>m(null),1200)}catch{}},[]),S=E.useCallback(()=>{clearTimeout(b.current),v(),o(!0)},[v]),C=E.useCallback(()=>{b.current=setTimeout(()=>o(!1),150)},[]);return E.useEffect(()=>()=>{clearTimeout(d.current),clearTimeout(b.current)},[]),h.jsxs("span",{ref:u,className:`inline-flex items-center cursor-default ${s}`,onMouseEnter:S,onMouseLeave:C,children:[t,i&&p&&rm.createPortal(h.jsx("span",{className:"fixed z-[9999] bg-surface-raised border border-surface-border rounded shadow-lg py-1 min-w-[180px]",style:{top:p.top,left:p.left},onMouseEnter:S,onMouseLeave:C,children:n.map(P=>h.jsxs("button",{onClick:q=>{q.stopPropagation(),w(P.value,P.label)},className:"flex items-center justify-between w-full px-2.5 py-1 text-left hover:bg-surface-hover transition-colors",children:[h.jsx("span",{className:"text-2xs font-medium uppercase tracking-wider text-text-tertiary w-10 shrink-0",children:P.label}),h.jsx("span",{className:"text-2xs font-mono text-text-secondary truncate ml-2",children:c===P.label?"✓":P.value})]},P.label))}),document.body)]})}function hk(n,t){const s=new Date(n);switch(t){case"relative":return uk(n);case"datetime":return Am(s);case"time":return s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit",timeZone:Cj()??void 0})}}function dk(n){const t=new Date(n);return[{label:"ms",value:String(t.getTime())},{label:"utc",value:t.toISOString()},{label:"local",value:Am(t,!0)}]}function gv({date:n,format:t="relative",className:s=""}){const[,i]=E.useState(0);E.useEffect(()=>{if(t!=="relative")return;const c=setInterval(()=>i(m=>m+1),3e4);return()=>clearInterval(c)},[t]);const o=E.useMemo(()=>dk(n),[n]);return h.jsx(yv,{options:o,children:h.jsx("time",{dateTime:n,className:`text-xs text-text-tertiary ${s}`,children:hk(n,t)})})}function mk({values:n,options:t,onChange:s,addLabel:i,emptyText:o,ariaLabel:c}){const m=t.filter(p=>!n.includes(p));return h.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[n.map(p=>h.jsxs("button",{type:"button",onClick:()=>s(n.filter(g=>g!==p)),className:"inline-flex items-center gap-1 text-2xs font-mono text-text-primary border border-surface-border px-1.5 py-0.5 hover:text-status-error hover:border-status-error/50 transition-colors",title:`Remove ${p}`,children:[p,h.jsx(Zt,{className:"w-3 h-3",strokeWidth:1.5})]},p)),n.length===0&&o&&h.jsx("span",{className:"text-2xs text-text-tertiary italic",children:o}),m.length>0&&h.jsxs("select",{value:"",onChange:p=>p.target.value&&s([...n,p.target.value]),className:"select font-mono","aria-label":c??i,children:[h.jsx("option",{value:"",children:i}),m.map(p=>h.jsx("option",{value:p,children:p},p))]})]})}const pk=[{minutes:1,label:"1 minute"},{minutes:15,label:"15 minutes"},{minutes:30,label:"30 minutes"},{minutes:60,label:"1 hour"},{minutes:240,label:"4 hours"},{minutes:1440,label:"24 hours"},{minutes:4320,label:"3 days"},{minutes:10080,label:"7 days"}];function yk(){const{data:n}=pv(),{data:t}=Bj(),s=lk(),i=ck(),[o,c]=E.useState(""),[m,p]=E.useState(""),[g,u]=E.useState(1440),[d,b]=E.useState([]),x=(n==null?void 0:n.announcements)??[],v=()=>{m.trim()&&s.mutate({body:m.trim(),...o.trim()?{title:o.trim()}:{},...d.length?{roles:d}:{},expiresAt:new Date(Date.now()+g*6e4).toISOString()},{onSuccess:()=>{c(""),p(""),b([])}})};return h.jsxs("div",{children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-4",children:"Alerts"}),h.jsxs("div",{className:"space-y-3",children:[h.jsxs("label",{className:"block",children:[h.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Title"}),h.jsx("input",{type:"text",value:o,onChange:w=>c(w.target.value),placeholder:"Optional headline",className:"input text-xs w-full"})]}),h.jsxs("label",{className:"block",children:[h.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Summary"}),h.jsx("textarea",{value:m,onChange:w=>p(w.target.value),placeholder:"What everyone should know (markdown supported)",rows:3,className:"input text-xs w-full resize-y"})]}),h.jsxs("label",{className:"block",children:[h.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Visible for"}),h.jsx("select",{value:g,onChange:w=>u(Number(w.target.value)),className:"select text-xs w-full",children:pk.map(w=>h.jsx("option",{value:w.minutes,children:w.label},w.minutes))})]}),h.jsxs("div",{className:"block",children:[h.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Visible to"}),h.jsx(mk,{values:d,options:(t==null?void 0:t.roles)??[],onChange:b,addLabel:"Add a role…",emptyText:"Everyone",ariaLabel:"Add a role"})]}),s.error&&h.jsx("p",{className:"text-xs text-status-error",children:s.error.message}),h.jsx("button",{onClick:v,disabled:!m.trim()||s.isPending,className:"btn-primary text-xs w-full disabled:opacity-50",children:s.isPending?"Publishing…":"Publish alert"})]}),x.length>0&&h.jsxs("div",{className:"mt-6",children:[h.jsx("p",{className:"text-2xs text-text-tertiary mb-2",children:"Active now — stacked as banner rows, newest first"}),h.jsx("div",{className:"space-y-1",children:x.map(w=>h.jsxs("div",{className:"flex items-start gap-2 py-1.5 border-b border-surface-border/40 last:border-b-0",children:[h.jsxs("span",{className:"min-w-0 flex-1",children:[h.jsx("span",{className:"block text-xs text-text-primary truncate",children:w.title??w.body.split(`
54
+ `)[0]}),h.jsxs("span",{className:"block text-2xs text-text-tertiary",children:["expires ",h.jsx(gv,{date:w.expires_at,format:"relative"})]})]}),h.jsx("button",{onClick:()=>i.mutate(w.id),disabled:i.isPending,className:"icon-link shrink-0 mt-0.5",title:"Remove for everyone","aria-label":`Remove ${w.title??"announcement"}`,children:h.jsx(Zt,{className:"w-3.5 h-3.5",strokeWidth:1.5})})]},w.id))})]})]})}const gk=[{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"}],bk=["operator","engineer","admin","superadmin"];function Db(n){return bk.indexOf(n)}function xk(n,t){return Db(n)>=Db(t)}function vk({onClose:n}){var Ne,Me,We,pt,Ct,Se,Re;const{isSuperAdmin:t,hasRoleType:s,hasRole:i}=qt(),{data:o}=er(),c=Em(),m=!!((Ne=o==null?void 0:o.ai)!=null&&Ne.enabled),p=Kx(),g=p!==null?p:m,[u,d]=E.useState(g),b=(Me=o==null?void 0:o.features)==null?void 0:Me.graphWorkflows,x=b==null,[v,w]=E.useState(b===!0||x&&Jx()),S=t||i("engineer"),[C,P]=E.useState(Qx()),q=!!((We=o==null?void 0:o.features)!=null&&We.scanCodes),re=Xx(),[se,M]=E.useState(re!==null?re:q),U=t?"superadmin":s("admin")?"admin":i("engineer")?"engineer":"operator",ae=((pt=o==null?void 0:o.branding)==null?void 0:pt.appName)??"LongTail",z=(Ct=o==null?void 0:o.environment)==null?void 0:Ct.longTailVersion,I=(Se=o==null?void 0:o.environment)==null?void 0:Se.hotmeshVersion,D=(Re=o==null?void 0:o.environment)==null?void 0:Re.nodeEnv;E.useEffect(()=>{const ce=Ue=>{Ue.key==="Escape"&&n()};return document.addEventListener("keydown",ce),()=>document.removeEventListener("keydown",ce)},[n]);const X=gk.filter(ce=>xk(U,ce.minTier)),W=X.length>1,he=U!=="operator",we=[...W?[{id:"viewas",label:"View As",icon:pS}]:[],{id:"features",label:"Features",icon:yS},...he?[{id:"alerts",label:"Alerts",icon:gS}]:[]],[Oe,F]=E.useState(we[0].id),J=ce=>{ce===null?Gd():fA(ce)},le=()=>{const ce=!u;d(ce),ce===m?uA():cA(ce),window.location.reload()},pe=()=>{const ce=!v;w(ce),hA(ce),window.location.reload()},ye=()=>{const ce=!C;P(ce),dA(ce),window.location.reload()},Ce=()=>{const ce=!se;M(ce),ce===q?pA():mA(ce),window.location.reload()};return h.jsx("div",{className:"fixed inset-0 z-[100] bg-surface-sunken/75 backdrop-blur-sm flex items-center justify-center",onClick:n,children:h.jsxs("div",{className:"relative w-[440px] max-h-[85vh] overflow-y-auto bg-surface-raised px-12 py-10",onClick:ce=>ce.stopPropagation(),children:[h.jsx("button",{onClick:n,className:"absolute top-4 right-4 text-text-quaternary hover:text-text-secondary transition-colors p-1","aria-label":"Close",children:h.jsx(Zt,{className:"w-4 h-4",strokeWidth:1.5})}),h.jsxs("div",{className:"flex flex-col items-center gap-3 pb-8",children:[h.jsx("span",{className:"logo-mark block w-20 h-20 opacity-50",style:{"--logo-url":`url(${Vt}/logo512.png)`}}),h.jsxs("div",{className:"text-center",children:[h.jsx("p",{className:"text-2xl font-light text-text-primary tracking-[0.12em]",children:ae}),z&&h.jsxs("p",{className:"mt-1 text-2xs text-text-tertiary",children:["v",z,I&&h.jsxs(h.Fragment,{children:[" · HotMesh v",I]}),D&&D!=="production"&&h.jsx("span",{className:"ml-1 text-status-warning",children:D})]})]})]}),h.jsx("hr",{className:"border-surface-border/50 mb-6"}),we.length>1&&h.jsx("div",{className:"flex items-center justify-center gap-2 mb-8",role:"tablist",children:we.map(ce=>{const Ue=Oe===ce.id;return h.jsxs("button",{role:"tab","aria-selected":Ue,onClick:()=>F(ce.id),title:ce.label,className:`flex flex-col items-center gap-1.5 px-5 py-2.5 rounded-lg transition-colors ${Ue?"bg-accent/10 text-accent":"text-text-tertiary hover:text-text-secondary hover:bg-surface-hover"}`,children:[h.jsx(ce.icon,{className:"w-5 h-5",strokeWidth:1.5,...Ue?{fill:"currentColor",fillOpacity:.15}:{}}),h.jsx("span",{className:"text-2xs font-medium",children:ce.label})]},ce.id)})}),Oe==="viewas"&&W&&h.jsxs("div",{className:"space-y-1",children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-4",children:"View As"}),X.map(ce=>{const Ue=c===ce.id,Xe=ce.id===null?`Your view · ${U}`:ce.label;return h.jsxs("button",{onClick:()=>J(ce.id),className:"w-full text-left flex items-start gap-3 py-2.5 px-1 group",children:[h.jsx("span",{className:`mt-0.5 w-4 h-4 rounded-full border shrink-0 flex items-center justify-center transition-colors ${Ue?"border-accent bg-accent":"border-surface-border group-hover:border-accent/60"}`,children:Ue&&h.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-text-inverse"})}),h.jsxs("span",{children:[h.jsx("span",{className:`block text-sm font-medium transition-colors ${Ue?"text-accent":"text-text-primary group-hover:text-accent"}`,children:Xe}),h.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:ce.description})]})]},String(ce.id))})]}),Oe==="features"&&h.jsxs("div",{children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-4",children:"Features"}),h.jsxs("button",{onClick:le,className:"w-full text-left flex items-center justify-between py-2.5 px-1 group",children:[h.jsxs("span",{children:[h.jsx("span",{className:"block text-sm font-medium text-text-primary group-hover:text-accent transition-colors",children:"AI features"}),h.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:u?"Enabled — AI assist, agent labels, bulk AI actions":"Hidden — automation labels, no AI surfaces"})]}),h.jsx("span",{className:`shrink-0 ml-4 w-9 h-5 rounded-full transition-colors flex items-center px-0.5 ${u?"bg-accent":"bg-surface-border"}`,children:h.jsx("span",{className:`w-4 h-4 rounded-full bg-text-inverse shadow-sm transition-transform ${u?"translate-x-4":"translate-x-0"}`})})]}),x&&h.jsxs("button",{onClick:pe,className:"w-full text-left flex items-center justify-between py-2.5 px-1 group",children:[h.jsxs("span",{children:[h.jsx("span",{className:"block text-sm font-medium text-text-primary group-hover:text-accent transition-colors",children:"Graph workflows"}),h.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:v?"Visible — Graph section shown in Orchestrate sidebar":"Hidden — use Procedural workflows instead"})]}),h.jsx("span",{className:`shrink-0 ml-4 w-9 h-5 rounded-full transition-colors flex items-center px-0.5 ${v?"bg-accent":"bg-surface-border"}`,children:h.jsx("span",{className:`w-4 h-4 rounded-full bg-text-inverse shadow-sm transition-transform ${v?"translate-x-4":"translate-x-0"}`})})]}),S&&h.jsxs("button",{onClick:ye,className:"w-full text-left flex items-center justify-between py-2.5 px-1 group","data-testid":"feature-infrastructure",children:[h.jsxs("span",{children:[h.jsx("span",{className:"block text-sm font-medium text-text-primary group-hover:text-accent transition-colors",children:"Infrastructure"}),h.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:C?"Visible — Routers, Messages, and DB Maintenance in the sidebar":"Hidden — routers, message streams, and database maintenance"})]}),h.jsx("span",{className:`shrink-0 ml-4 w-9 h-5 rounded-full transition-colors flex items-center px-0.5 ${C?"bg-accent":"bg-surface-border"}`,children:h.jsx("span",{className:`w-4 h-4 rounded-full bg-text-inverse shadow-sm transition-transform ${C?"translate-x-4":"translate-x-0"}`})})]}),h.jsxs("button",{onClick:Ce,className:"w-full text-left flex items-center justify-between py-2.5 px-1 group",children:[h.jsxs("span",{children:[h.jsx("span",{className:"block text-sm font-medium text-text-primary group-hover:text-accent transition-colors",children:"Scan input"}),h.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:se?"Enabled — header scan affordance, panel, and keyboard-wedge capture":"Hidden — the deployment opts in with features.scanCodes"})]}),h.jsx("span",{className:`shrink-0 ml-4 w-9 h-5 rounded-full transition-colors flex items-center px-0.5 ${se?"bg-accent":"bg-surface-border"}`,children:h.jsx("span",{className:`w-4 h-4 rounded-full bg-text-inverse shadow-sm transition-transform ${se?"translate-x-4":"translate-x-0"}`})})]})]}),Oe==="alerts"&&he&&h.jsx(yk,{}),h.jsx("hr",{className:"border-surface-border/50 mt-8"}),h.jsx("p",{className:"mt-4 text-2xs text-text-quaternary text-center",children:"Esc or click outside to close"})]})})}const bv=[{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"}],Lb="blue",xv="lt.theme";let vv=[];function _k(n){const t=new Set(bv.map(i=>i.id)),s=new Set;vv=n.filter(i=>!(i!=null&&i.id)||t.has(i.id)||s.has(i.id)?!1:(s.add(i.id),!0))}function wk(){return[...bv,...vv]}function _v(){try{return localStorage.getItem(xv)||Lb}catch{return Lb}}function wv(n){document.documentElement.dataset.theme=n}function Sk(n){try{localStorage.setItem(xv,n)}catch{}wv(n)}const Ek=[8,12,13,14];function Ok(n){if(!/^[0-9]+$/.test(n)||!Ek.includes(n.length))return!1;const t=n.split("").map(Number),s=t.pop();let i=0;for(let o=t.length-1,c=3;o>=0;o--,c=c===3?1:3)i+=t[o]*c;return(10-i%10)%10===s}function hM(n){return n.padStart(14,"0")}const cu={maxKeyGapMs:500,terminators:["Enter","Tab"],minLength:6,autoFireQuietMs:300,autoFireMaxAvgKeyMs:50},Sv="lt_scan_wedge_config";function Ev(){try{const n=localStorage.getItem(Sv);return n?{...cu,...JSON.parse(n)}:cu}catch{return cu}}function Ak(n){const t={...Ev(),...n};return localStorage.setItem(Sv,JSON.stringify(t)),t}const Pm=[{pattern:/(?:^|[^0-9])([1-9][0-9]:[0-9]:[a-zA-Z0-9._-]+)$/,digitsOnly:!1},{pattern:/(?:^|[^0-9])([1-9][0-9]{7,})$/,digitsOnly:!0}];function jk(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function kk(n){const t=[];for(const s of n.filter(i=>i.enabled))if(s.encoding==="delimited"){const i=jk(s.delimiter);t.push({pattern:new RegExp(`(?:^|[^0-9])(${s.version}${i}[0-9]${i}[a-zA-Z0-9._-]+)$`),digitsOnly:!1})}else if(s.encoding==="fixed"){const i=1+(s.target_length??0);t.push({pattern:new RegExp(`(?:^|[^0-9])(${s.version}[0-9]{${i},${i+1}})$`),digitsOnly:!0})}else s.encoding==="gtin"&&t.push({pattern:/(?:^|[^0-9])([0-9]{8}|[0-9]{12,14})$/,digitsOnly:!0,accept:Ok});return t.length?t:Pm}function Nk(n,t=Pm){var i;let s=null;for(const o of t){const c=(i=n.match(o.pattern))==null?void 0:i[1];!c||o.accept&&!o.accept(c)||(!s||c.length>s.code.length)&&(s={code:c,shape:o})}return s}const Tk=new Set(["Shift","CapsLock"]),hc={suppress:!1,emit:null};function Ck(n=cu,t=Pm){let s={buffer:"",times:[],lastKeyMs:0};function i(u){const d=s.times.slice(-u.length);return d.length<2?!1:(d[d.length-1]-d[0])/(d.length-1)<=n.autoFireMaxAvgKeyMs}function o(){const u=Nk(s.buffer,t);return!u||u.code.length<n.minLength||u.shape.digitsOnly&&!i(u.code)?null:u.code}function c(){s={buffer:"",times:[],lastKeyMs:0}}function m(u){const{key:d,timeMs:b,hasModifier:x,isRepeat:v}=u;if(Tk.has(d))return hc;if(n.terminators.includes(d)){const q=o();return c(),q?{suppress:!0,emit:q,consumedLength:q.length}:hc}if(x||v||d.length!==1)return c(),hc;const w=b-s.lastKeyMs,S=s.lastKeyMs>0&&w<=n.maxKeyGapMs,C=(S?s.buffer+d:d).slice(-128),P=(S?[...s.times,b]:[b]).slice(-128);return s={buffer:C,times:P,lastKeyMs:b},hc}function p(){return{buffer:s.buffer}}function g(){const u=o();return!u||!i(u)?null:{code:u,consumedLength:u.length}}return{step:m,reset:c,snapshot:p,pendingAutoFire:g}}function Mk(){const n=document.activeElement;return n instanceof HTMLInputElement?["text","search","tel","url","email","password","number"].includes(n.type)?n:null:n instanceof HTMLTextAreaElement?n:null}function Rk(n,t,s){var c;const i=n instanceof HTMLInputElement?HTMLInputElement.prototype:HTMLTextAreaElement.prototype,o=(c=Object.getOwnPropertyDescriptor(i,"value"))==null?void 0:c.set;o?o.call(n,t):n.value=t;try{n.setSelectionRange(s,s)}catch{}n.dispatchEvent(new Event("input",{bubbles:!0}))}function qb(n){if(n<=0)return;const t=Mk();if(!t)return;const s=t.selectionStart??t.value.length,i=Math.max(0,s-n);Rk(t,t.value.slice(0,i)+t.value.slice(s),i)}function Dk({active:n,wedgeConfig:t,tailShapes:s,diagnosticsOn:i,onScan:o,onDiag:c}){const m=E.useRef({diagnosticsOn:i,onScan:o,onDiag:c});m.current={diagnosticsOn:i,onScan:o,onDiag:c};const p=E.useRef(0),g=E.useRef(0);E.useEffect(()=>{if(!n)return;const u=Ck(t,s);let d=null;const b=()=>{d&&(clearTimeout(d),d=null)},x=(S,C,P)=>{C&&qb(C),m.current.diagnosticsOn&&(console.debug("[scan]",P),m.current.onDiag({seq:++p.current,key:"(quiet)",code:"",deltaMs:0,buffer:"",note:P})),m.current.onScan(S)},v=()=>{b(),u.pendingAutoFire()&&(d=setTimeout(()=>{d=null;const S=u.pendingAutoFire();S&&(u.reset(),x(S.code,S.consumedLength,`capture → ${S.code} (quiet period — no suffix)`))},t.autoFireQuietMs))},w=S=>{const C=u.snapshot().buffer,{suppress:P,emit:q,consumedLength:re}=u.step({key:S.key,timeMs:S.timeStamp,hasModifier:S.ctrlKey||S.metaKey||S.altKey,isRepeat:S.repeat});if(P&&(S.preventDefault(),S.stopPropagation()),m.current.diagnosticsOn){const se=u.snapshot().buffer,M=t.terminators.includes(S.key),U=q?`capture → ${q}`:M?`terminator — no code tail in "${C.slice(-24)}"`:se===C?C?"neutral (chord key)":"ignored":se===""?"reset (edit/chord/non-printable)":se.length<=1&&C.length>1?"gap — new episode":"accumulate",ae=g.current?Math.round(S.timeStamp-g.current):0,z={seq:++p.current,key:S.key,code:S.code!==S.key?S.code:"",deltaMs:ae,buffer:se.slice(-24),note:U};console.debug("[scan]",z.key,z.code,`${z.deltaMs}ms`,z.note),m.current.onDiag(z)}g.current=S.timeStamp,q?(b(),re&&qb(re),m.current.onScan(q)):v()};return window.addEventListener("keydown",w,{capture:!0}),()=>{b(),window.removeEventListener("keydown",w,{capture:!0})}},[n,t,s])}const je={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",NO_OPEN_CONTAINER:"no_open_container",HELD:"held",REFUSED:"refused",SUBJECT_STALE:"subject_stale"},dc={SHOW_DETAIL:"show-detail",SHOW_LIST:"show-list",CLAIM:"claim",CLAIM_SHOW_DETAIL:"claim-show-detail",RELEASE:"release",RESOLVE:"resolve",ESCALATE:"escalate",CANCEL:"cancel",ACCUMULATE:"accumulate",PRESENT:"present",HOLD:"hold",FILL:"fill"},Lk={ACTION:"action",IDENTITY:"identity"};function qk(n,t){return ue("/scan-codes/execute",{method:"POST",body:JSON.stringify({code:n,...t!=null&&t.actingToken?{actingToken:t.actingToken}:{},...t!=null&&t.previousActingToken?{previousActingToken:t.previousActingToken}:{},...t!=null&&t.subject?{subject:t.subject}:{},...t!=null&&t.stationRole?{stationRole:t.stationRole}:{}})})}function dM(n){return ue("/scan-codes/execute-choice",{method:"POST",body:JSON.stringify(n)})}function Ov(n){return qe({queryKey:["scan-schemes"],queryFn:()=>ue("/scan-codes/schemes"),...n})}function mM(n){return qe({queryKey:["scan-schemes",n],queryFn:()=>ue(`/scan-codes/schemes/${n}`),enabled:n!=null})}function pM(){const n=Be();return Fe({mutationFn:t=>ue(`/scan-codes/schemes/${t.version}`,{method:"PUT",body:JSON.stringify(t)}),onSuccess:()=>n.invalidateQueries({queryKey:["scan-schemes"]})})}function yM(){const n=Be();return Fe({mutationFn:t=>ue(`/scan-codes/schemes/${t}`,{method:"DELETE"}),onSuccess:()=>n.invalidateQueries({queryKey:["scan-schemes"]})})}function gM(){const n=Be();return Fe({mutationFn:t=>ue(`/scan-codes/schemes/${t.scheme_version}/actions/${t.category}`,{method:"PUT",body:JSON.stringify(t)}),onSuccess:(t,s)=>n.invalidateQueries({queryKey:["scan-schemes",s.scheme_version]})})}function bM(){const n=Be();return Fe({mutationFn:t=>ue(`/scan-codes/schemes/${t.scheme_version}/actions/${t.category}`,{method:"DELETE"}),onSuccess:(t,s)=>n.invalidateQueries({queryKey:["scan-schemes",s.scheme_version]})})}const Pk=3e4;function Bk(n,t=Date.now()){if(!(!n||Date.parse(n.expiresAt)<=t))return{code:n.code,escalationId:n.escalationId}}function Pb(n,t,s=Date.now()){if(t.outcome===je.HELD&&t.subject){const i=Math.max(0,Date.parse(t.subject.expiresAt)-s);return{...t.subject,ttlMs:i}}return t.clearSubject||!n?null:t.outcome===je.EXECUTED&&t.progress&&t.progress.remaining>0?{...n,expiresAt:new Date(s+n.ttlMs).toISOString()}:n}function Bb(n){return n.outcome===je.NOT_PRIMED&&n.replayable===!0}function Uk(n,t=Date.now()){return n&&t-n.at<=Pk?n:null}const zk=[je.HELD,je.REFUSED,je.SUBJECT_STALE],To={KEYBOARD_WEDGE:"keyboard-wedge",MANUAL:"manual",TOOLBAR:"toolbar"},Fi=n=>{if(n)try{return JSON.parse(n)}catch{return}},Zs=n=>n==null||Array.isArray(n)&&n.length===0||typeof n=="object"&&!Array.isArray(n)&&Object.keys(n).length===0;function Ik(n){const t={},s=Fi(n.get("facets"));Zs(s)||(t.facets=s);const i=Fi(n.get("block"));Zs(i)||(t.block=i);const o=Fi(n.get("range"));Zs(o)||(t.range=o);const c=Fi(n.get("exists"));Zs(c)||(t.exists=c);const m=Fi(n.get("roles"));Zs(m)||(t.roles=m);const p=Fi(n.get("orderBy"));Zs(p)||(t.orderBy=p),n.get("available")!=null&&(t.available=n.get("available")==="true");const g=n.get("jeopardy");return(g==="1"||g==="true")&&(t.jeopardy=!0),t}function xM(n,t){const s=(i,o)=>Zs(o)?n.delete(i):n.set(i,JSON.stringify(o));s("facets",t.facets),s("block",t.block),s("range",t.range),s("exists",t.exists),s("roles",t.roles),s("orderBy",t.orderBy),t.available==null?n.delete("available"):n.set("available",String(t.available)),t.jeopardy===!0?n.set("jeopardy","1"):n.delete("jeopardy")}const Ub=`&status=all&view=table&orderBy=${encodeURIComponent(JSON.stringify([{field:"created_at",direction:"desc"}]))}`;function Av(n,t){const s={};for(const[o,c]of Object.entries(n))s[o]=typeof c=="object"&&c!==null?JSON.stringify(c):c;const i=encodeURIComponent(JSON.stringify(s));return t?`/escalations/available?role=${encodeURIComponent(t)}&facets=${i}${Ub}`:`/escalations/available?facets=${i}${Ub}`}function $k(n,t,s){return Av({[n]:t},s)}function vM(n){var t,s,i;return Object.keys(n.facets??{}).length+(((t=n.block)==null?void 0:t.length)??0)+(((s=n.range)==null?void 0:s.length)??0)+(((i=n.exists)==null?void 0:i.length)??0)+(n.available!=null?1:0)+(n.jeopardy===!0?1:0)}function Bm(){var s;const{data:n}=er(),t=Xx();return t!==null?t:!!((s=n==null?void 0:n.features)!=null&&s.scanCodes)}const Um=E.createContext(null);function zm(){const n=E.useContext(Um);if(!n)throw new Error("useScanInput must be used within ScanInputProvider");return n}function _M(){return E.useContext(Um)}const Hk="scanPendingAction",Fk="scanChoices",ud="/scan/station";function Gk({children:n}){const{user:t}=qt(),s=Bm(),i=ni(),o=en(),{identity:c,prime:m,clear:p,settle:g}=tv(),[u,d]=E.useState(null),[b,x]=E.useState(null),[v,w]=E.useState(null),{data:S}=Ov({enabled:!!t&&s,staleTime:6e4}),C=E.useRef(null);C.current=Nm().role;const P=E.useMemo(()=>kk((S==null?void 0:S.schemes)??[]),[S]),[q,re]=E.useState(!1),[se,M]=E.useState(()=>Ev()),[U,ae]=E.useState([]),[z,I]=E.useState(!1),D=E.useCallback(Se=>{var Ue;const{outcome:Re}=Se;if(Re===je.CONFIRM_REQUIRED&&Se.pendingAction)return i(`/escalations/detail/${Se.pendingAction.escalationId}`,{state:{[Hk]:Se.pendingAction}}),!0;const ce=Re===je.EXECUTED&&!!F.current;if(zk.includes(Re)||Bb(Se)||ce)return le.current!==ud&&i(ud),!0;if(Re===je.EXECUTED&&Se.escalation){const Xe=[dc.SHOW_DETAIL,dc.CLAIM_SHOW_DETAIL,dc.CLAIM,dc.ESCALATE];return Se.verb&&Xe.includes(Se.verb)?(i(`/escalations/detail/${Se.escalation.id}`),!0):!1}if(Re===je.MATCHED_LIST&&Se.listQuery){const{targetFacet:Xe,target:cn,roles:Mt}=Se.listQuery;return i(Av({[Xe]:cn},(Mt==null?void 0:Mt[0])??null)),!0}return Re===je.CHOICES&&Se.choices?(i(ud,{state:{[Fk]:Se}}),!0):Re===je.NO_MATCH_FALLBACK&&((Ue=Se.fallback)!=null&&Ue.route)?(i(Se.fallback.route),!0):!1},[i]),X=E.useRef(null);X.current=(c==null?void 0:c.actingToken)??null;const W=E.useRef(null),he=E.useRef([]),we=E.useCallback(Se=>(he.current=[Se,...he.current],()=>{he.current=he.current.filter(Re=>Re!==Se)}),[]),Oe=E.useRef(null);Oe.current=b;const F=E.useRef(void 0),J=E.useRef(null);J.current=v;const le=E.useRef(o.pathname);le.current=o.pathname,E.useEffect(()=>{if(!b)return;const Se=Date.parse(b.expiresAt)-Date.now();if(Se<=0){x(null);return}const Re=setTimeout(()=>x(null),Se);return()=>clearTimeout(Re)},[b]);const pe=E.useCallback(async(Se,Re,ce)=>{re(!0);const Ue=Date.now();try{F.current=Bk(Oe.current);const Xe=await qk(Se,{actingToken:ce??void 0,previousActingToken:W.current??void 0,subject:F.current,stationRole:C.current??void 0});if(ce&&g(ce,Xe),x(Mt=>Pb(Mt,Xe)),Xe.outcome===je.IDENTITY_PRIMED){W.current=m(Xe);const Mt=Uk(J.current);if(w(null),Mt&&Xe.actingToken){d({code:Se,source:Re,at:Ue,response:Xe,error:null,navigated:!1}),await pe(Mt.code,Re,Xe.actingToken);return}}else Bb(Xe)?w({code:Se,at:Ue}):w(null);Xe.outcome===je.NOT_PRIMED&&ce&&p();const cn=D(Xe);d({code:Se,source:Re,at:Ue,response:Xe,error:null,navigated:cn})}catch(Xe){d({code:Se,source:Re,at:Ue,response:null,error:Xe.message,navigated:!1})}finally{re(!1)}},[D,m,p,g]),ye=E.useCallback(async(Se,Re=To.MANUAL)=>{for(const ce of he.current)if(ce(Se))return;await pe(Se,Re,X.current)},[pe]),Ce=E.useCallback(()=>x(null),[]),Ne=E.useCallback(Se=>{x(Re=>Pb(Re,Se))},[]),Me=E.useCallback(()=>w(null),[]),We=E.useRef(ye);We.current=ye,Dk({active:!!t&&s,wedgeConfig:se,tailShapes:P,diagnosticsOn:z,onScan:Se=>void We.current(Se,To.KEYBOARD_WEDGE),onDiag:Se=>ae(Re=>[...Re.slice(-29),Se])});const pt=E.useCallback(Se=>{M(Ak(Se))},[]),Ct=E.useMemo(()=>({submitCode:ye,pushCodeInterceptor:we,lastResult:u,subject:b,dropSubject:Ce,adoptResponse:Ne,pendingScan:v,dropPendingScan:Me,busy:q,wedgeConfig:se,updateWedgeConfig:pt,diagnostics:U,diagnosticsOn:z,setDiagnosticsOn:I}),[ye,we,u,b,Ce,Ne,v,Me,q,se,pt,U,z]);return h.jsx(Um.Provider,{value:Ct,children:n})}var mc={},lo={},pc={},zb;function Nn(){if(zb)return pc;zb=1,Object.defineProperty(pc,"__esModule",{value:!0});function n(s,i){if(!(s instanceof i))throw new TypeError("Cannot call a class as a function")}var t=function s(i,o){n(this,s),this.data=i,this.text=o.text||i,this.options=o};return pc.default=t,pc}var Ib;function Vk(){if(Ib)return lo;Ib=1,Object.defineProperty(lo,"__esModule",{value:!0}),lo.CODE39=void 0;var n=(function(){function S(C,P){for(var q=0;q<P.length;q++){var re=P[q];re.enumerable=re.enumerable||!1,re.configurable=!0,"value"in re&&(re.writable=!0),Object.defineProperty(C,re.key,re)}}return function(C,P,q){return P&&S(C.prototype,P),q&&S(C,q),C}})(),t=Nn(),s=i(t);function i(S){return S&&S.__esModule?S:{default:S}}function o(S,C){if(!(S instanceof C))throw new TypeError("Cannot call a class as a function")}function c(S,C){if(!S)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return C&&(typeof C=="object"||typeof C=="function")?C:S}function m(S,C){if(typeof C!="function"&&C!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof C);S.prototype=Object.create(C&&C.prototype,{constructor:{value:S,enumerable:!1,writable:!0,configurable:!0}}),C&&(Object.setPrototypeOf?Object.setPrototypeOf(S,C):S.__proto__=C)}var p=(function(S){m(C,S);function C(P,q){return o(this,C),P=P.toUpperCase(),q.mod43&&(P+=x(w(P))),c(this,(C.__proto__||Object.getPrototypeOf(C)).call(this,P,q))}return n(C,[{key:"encode",value:function(){for(var q=d("*"),re=0;re<this.data.length;re++)q+=d(this.data[re])+"0";return q+=d("*"),{data:q,text:this.text}}},{key:"valid",value:function(){return this.data.search(/^[0-9A-Z\-\.\ \$\/\+\%]+$/)!==-1}}]),C})(s.default),g=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","-","."," ","$","/","+","%","*"],u=[20957,29783,23639,30485,20951,29813,23669,20855,29789,23645,29975,23831,30533,22295,30149,24005,21623,29981,23837,22301,30023,23879,30545,22343,30161,24017,21959,30065,23921,22385,29015,18263,29141,17879,29045,18293,17783,29021,18269,17477,17489,17681,20753,35770];function d(S){return b(v(S))}function b(S){return u[S].toString(2)}function x(S){return g[S]}function v(S){return g.indexOf(S)}function w(S){for(var C=0,P=0;P<S.length;P++)C+=v(S[P]);return C=C%43,C}return lo.CODE39=p,lo}var Jn={},yc={},gc={},vt={},$b;function qo(){if($b)return vt;$b=1,Object.defineProperty(vt,"__esModule",{value:!0});var n;function t(g,u,d){return u in g?Object.defineProperty(g,u,{value:d,enumerable:!0,configurable:!0,writable:!0}):g[u]=d,g}var s=vt.SET_A=0,i=vt.SET_B=1,o=vt.SET_C=2;vt.SHIFT=98;var c=vt.START_A=103,m=vt.START_B=104,p=vt.START_C=105;return vt.MODULO=103,vt.STOP=106,vt.FNC1=207,vt.SET_BY_CODE=(n={},t(n,c,s),t(n,m,i),t(n,p,o),n),vt.SWAP={101:s,100:i,99:o},vt.A_START_CHAR="Ð",vt.B_START_CHAR="Ñ",vt.C_START_CHAR="Ò",vt.A_CHARS="[\0-_È-Ï]",vt.B_CHARS="[ -È-Ï]",vt.C_CHARS="(Ï*[0-9]{2}Ï*)",vt.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],vt}var Hb;function Ru(){if(Hb)return gc;Hb=1,Object.defineProperty(gc,"__esModule",{value:!0});var n=(function(){function u(d,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(d,v.key,v)}}return function(d,b,x){return b&&u(d.prototype,b),x&&u(d,x),d}})(),t=Nn(),s=o(t),i=qo();function o(u){return u&&u.__esModule?u:{default:u}}function c(u,d){if(!(u instanceof d))throw new TypeError("Cannot call a class as a function")}function m(u,d){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:u}function p(u,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);u.prototype=Object.create(d&&d.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(u,d):u.__proto__=d)}var g=(function(u){p(d,u);function d(b,x){c(this,d);var v=m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b.substring(1),x));return v.bytes=b.split("").map(function(w){return w.charCodeAt(0)}),v}return n(d,[{key:"valid",value:function(){return/^[\x00-\x7F\xC8-\xD3]+$/.test(this.data)}},{key:"encode",value:function(){var x=this.bytes,v=x.shift()-105,w=i.SET_BY_CODE[v];if(w===void 0)throw new RangeError("The encoding does not start with a start character.");this.shouldEncodeAsEan128()===!0&&x.unshift(i.FNC1);var S=d.next(x,1,w);return{text:this.text===this.data?this.text.replace(/[^\x20-\x7E]/g,""):this.text,data:d.getBar(v)+S.result+d.getBar((S.checksum+v)%i.MODULO)+d.getBar(i.STOP)}}},{key:"shouldEncodeAsEan128",value:function(){var x=this.options.ean128||!1;return typeof x=="string"&&(x=x.toLowerCase()==="true"),x}}],[{key:"getBar",value:function(x){return i.BARS[x]?i.BARS[x].toString():""}},{key:"correctIndex",value:function(x,v){if(v===i.SET_A){var w=x.shift();return w<32?w+64:w-32}else return v===i.SET_B?x.shift()-32:(x.shift()-48)*10+x.shift()-48}},{key:"next",value:function(x,v,w){if(!x.length)return{result:"",checksum:0};var S=void 0,C=void 0;if(x[0]>=200){C=x.shift()-105;var P=i.SWAP[C];P!==void 0?S=d.next(x,v+1,P):((w===i.SET_A||w===i.SET_B)&&C===i.SHIFT&&(x[0]=w===i.SET_A?x[0]>95?x[0]-96:x[0]:x[0]<32?x[0]+96:x[0]),S=d.next(x,v+1,w))}else C=d.correctIndex(x,w),S=d.next(x,v+1,w);var q=d.getBar(C),re=C*v;return{result:q+S.result,checksum:re+S.checksum}}}]),d})(s.default);return gc.default=g,gc}var bc={},Fb;function Yk(){if(Fb)return bc;Fb=1,Object.defineProperty(bc,"__esModule",{value:!0});var n=qo(),t=function(p){return p.match(new RegExp("^"+n.A_CHARS+"*"))[0].length},s=function(p){return p.match(new RegExp("^"+n.B_CHARS+"*"))[0].length},i=function(p){return p.match(new RegExp("^"+n.C_CHARS+"*"))[0]};function o(m,p){var g=p?n.A_CHARS:n.B_CHARS,u=m.match(new RegExp("^("+g+"+?)(([0-9]{2}){2,})([^0-9]|$)"));if(u)return u[1]+"Ì"+c(m.substring(u[1].length));var d=m.match(new RegExp("^"+g+"+"))[0];return d.length===m.length?m:d+String.fromCharCode(p?205:206)+o(m.substring(d.length),!p)}function c(m){var p=i(m),g=p.length;if(g===m.length)return m;m=m.substring(g);var u=t(m)>=s(m);return p+String.fromCharCode(u?206:205)+o(m,u)}return bc.default=function(m){var p=void 0,g=i(m).length;if(g>=2)p=n.C_START_CHAR+c(m);else{var u=t(m)>s(m);p=(u?n.A_START_CHAR:n.B_START_CHAR)+o(m,u)}return p.replace(/[\xCD\xCE]([^])[\xCD\xCE]/,function(d,b){return"Ë"+b})},bc}var Gb;function Kk(){if(Gb)return yc;Gb=1,Object.defineProperty(yc,"__esModule",{value:!0});var n=Ru(),t=o(n),s=Yk(),i=o(s);function o(u){return u&&u.__esModule?u:{default:u}}function c(u,d){if(!(u instanceof d))throw new TypeError("Cannot call a class as a function")}function m(u,d){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:u}function p(u,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);u.prototype=Object.create(d&&d.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(u,d):u.__proto__=d)}var g=(function(u){p(d,u);function d(b,x){if(c(this,d),/^[\x00-\x7F\xC8-\xD3]+$/.test(b))var v=m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,(0,i.default)(b),x));else var v=m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b,x));return m(v)}return d})(t.default);return yc.default=g,yc}var xc={},Vb;function Jk(){if(Vb)return xc;Vb=1,Object.defineProperty(xc,"__esModule",{value:!0});var n=(function(){function u(d,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(d,v.key,v)}}return function(d,b,x){return b&&u(d.prototype,b),x&&u(d,x),d}})(),t=Ru(),s=o(t),i=qo();function o(u){return u&&u.__esModule?u:{default:u}}function c(u,d){if(!(u instanceof d))throw new TypeError("Cannot call a class as a function")}function m(u,d){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:u}function p(u,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);u.prototype=Object.create(d&&d.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(u,d):u.__proto__=d)}var g=(function(u){p(d,u);function d(b,x){return c(this,d),m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,i.A_START_CHAR+b,x))}return n(d,[{key:"valid",value:function(){return new RegExp("^"+i.A_CHARS+"+$").test(this.data)}}]),d})(s.default);return xc.default=g,xc}var vc={},Yb;function Qk(){if(Yb)return vc;Yb=1,Object.defineProperty(vc,"__esModule",{value:!0});var n=(function(){function u(d,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(d,v.key,v)}}return function(d,b,x){return b&&u(d.prototype,b),x&&u(d,x),d}})(),t=Ru(),s=o(t),i=qo();function o(u){return u&&u.__esModule?u:{default:u}}function c(u,d){if(!(u instanceof d))throw new TypeError("Cannot call a class as a function")}function m(u,d){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:u}function p(u,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);u.prototype=Object.create(d&&d.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(u,d):u.__proto__=d)}var g=(function(u){p(d,u);function d(b,x){return c(this,d),m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,i.B_START_CHAR+b,x))}return n(d,[{key:"valid",value:function(){return new RegExp("^"+i.B_CHARS+"+$").test(this.data)}}]),d})(s.default);return vc.default=g,vc}var _c={},Kb;function Xk(){if(Kb)return _c;Kb=1,Object.defineProperty(_c,"__esModule",{value:!0});var n=(function(){function u(d,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(d,v.key,v)}}return function(d,b,x){return b&&u(d.prototype,b),x&&u(d,x),d}})(),t=Ru(),s=o(t),i=qo();function o(u){return u&&u.__esModule?u:{default:u}}function c(u,d){if(!(u instanceof d))throw new TypeError("Cannot call a class as a function")}function m(u,d){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:u}function p(u,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);u.prototype=Object.create(d&&d.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(u,d):u.__proto__=d)}var g=(function(u){p(d,u);function d(b,x){return c(this,d),m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,i.C_START_CHAR+b,x))}return n(d,[{key:"valid",value:function(){return new RegExp("^"+i.C_CHARS+"+$").test(this.data)}}]),d})(s.default);return _c.default=g,_c}var Jb;function Wk(){if(Jb)return Jn;Jb=1,Object.defineProperty(Jn,"__esModule",{value:!0}),Jn.CODE128C=Jn.CODE128B=Jn.CODE128A=Jn.CODE128=void 0;var n=Kk(),t=g(n),s=Jk(),i=g(s),o=Qk(),c=g(o),m=Xk(),p=g(m);function g(u){return u&&u.__esModule?u:{default:u}}return Jn.CODE128=t.default,Jn.CODE128A=i.default,Jn.CODE128B=c.default,Jn.CODE128C=p.default,Jn}var Kt={},wc={},Rr={},Qb;function Po(){return Qb||(Qb=1,Object.defineProperty(Rr,"__esModule",{value:!0}),Rr.SIDE_BIN="101",Rr.MIDDLE_BIN="01010",Rr.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"]},Rr.EAN2_STRUCTURE=["LL","LG","GL","GG"],Rr.EAN5_STRUCTURE=["GGLLL","GLGLL","GLLGL","GLLLG","LGGLL","LLGGL","LLLGG","LGLGL","LGLLG","LLGLG"],Rr.EAN13_STRUCTURE=["LLLLLL","LLGLGG","LLGGLG","LLGGGL","LGLLGG","LGGLLG","LGGGLL","LGLGLG","LGLGGL","LGGLGL"]),Rr}var Sc={},Ec={},Xb;function Bo(){if(Xb)return Ec;Xb=1,Object.defineProperty(Ec,"__esModule",{value:!0});var n=Po(),t=function(i,o,c){var m=i.split("").map(function(g,u){return n.BINARIES[o[u]]}).map(function(g,u){return g?g[i[u]]:""});if(c){var p=i.length-1;m=m.map(function(g,u){return u<p?g+c:g})}return m.join("")};return Ec.default=t,Ec}var Wb;function jv(){if(Wb)return Sc;Wb=1,Object.defineProperty(Sc,"__esModule",{value:!0});var n=(function(){function b(x,v){for(var w=0;w<v.length;w++){var S=v[w];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(x,S.key,S)}}return function(x,v,w){return v&&b(x.prototype,v),w&&b(x,w),x}})(),t=Po(),s=Bo(),i=m(s),o=Nn(),c=m(o);function m(b){return b&&b.__esModule?b:{default:b}}function p(b,x){if(!(b instanceof x))throw new TypeError("Cannot call a class as a function")}function g(b,x){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return x&&(typeof x=="object"||typeof x=="function")?x:b}function u(b,x){if(typeof x!="function"&&x!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof x);b.prototype=Object.create(x&&x.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),x&&(Object.setPrototypeOf?Object.setPrototypeOf(b,x):b.__proto__=x)}var d=(function(b){u(x,b);function x(v,w){p(this,x);var S=g(this,(x.__proto__||Object.getPrototypeOf(x)).call(this,v,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 n(x,[{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,i.default)(w,S)}},{key:"rightText",value:function(w,S){return this.text.substr(w,S)}},{key:"rightEncode",value:function(w,S){return(0,i.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}}}]),x})(c.default);return Sc.default=d,Sc}var Zb;function Zk(){if(Zb)return wc;Zb=1,Object.defineProperty(wc,"__esModule",{value:!0});var n=(function(){function b(x,v){for(var w=0;w<v.length;w++){var S=v[w];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(x,S.key,S)}}return function(x,v,w){return v&&b(x.prototype,v),w&&b(x,w),x}})(),t=function b(x,v,w){x===null&&(x=Function.prototype);var S=Object.getOwnPropertyDescriptor(x,v);if(S===void 0){var C=Object.getPrototypeOf(x);return C===null?void 0:b(C,v,w)}else{if("value"in S)return S.value;var P=S.get;return P===void 0?void 0:P.call(w)}},s=Po(),i=jv(),o=c(i);function c(b){return b&&b.__esModule?b:{default:b}}function m(b,x){if(!(b instanceof x))throw new TypeError("Cannot call a class as a function")}function p(b,x){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return x&&(typeof x=="object"||typeof x=="function")?x:b}function g(b,x){if(typeof x!="function"&&x!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof x);b.prototype=Object.create(x&&x.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),x&&(Object.setPrototypeOf?Object.setPrototypeOf(b,x):b.__proto__=x)}var u=function(x){var v=x.substr(0,12).split("").map(function(w){return+w}).reduce(function(w,S,C){return C%2?w+S*3:w+S},0);return(10-v%10)%10},d=(function(b){g(x,b);function x(v,w){m(this,x),v.search(/^[0-9]{12}$/)!==-1&&(v+=u(v));var S=p(this,(x.__proto__||Object.getPrototypeOf(x)).call(this,v,w));return S.lastChar=w.lastChar,S}return n(x,[{key:"valid",value:function(){return this.data.search(/^[0-9]{13}$/)!==-1&&+this.data[12]===u(this.data)}},{key:"leftText",value:function(){return t(x.prototype.__proto__||Object.getPrototypeOf(x.prototype),"leftText",this).call(this,1,6)}},{key:"leftEncode",value:function(){var w=this.data.substr(1,6),S=s.EAN13_STRUCTURE[this.data[0]];return t(x.prototype.__proto__||Object.getPrototypeOf(x.prototype),"leftEncode",this).call(this,w,S)}},{key:"rightText",value:function(){return t(x.prototype.__proto__||Object.getPrototypeOf(x.prototype),"rightText",this).call(this,7,6)}},{key:"rightEncode",value:function(){var w=this.data.substr(7,6);return t(x.prototype.__proto__||Object.getPrototypeOf(x.prototype),"rightEncode",this).call(this,w,"RRRRRR")}},{key:"encodeGuarded",value:function(){var w=t(x.prototype.__proto__||Object.getPrototypeOf(x.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}}]),x})(o.default);return wc.default=d,wc}var Oc={},e1;function eN(){if(e1)return Oc;e1=1,Object.defineProperty(Oc,"__esModule",{value:!0});var n=(function(){function d(b,x){for(var v=0;v<x.length;v++){var w=x[v];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(b,w.key,w)}}return function(b,x,v){return x&&d(b.prototype,x),v&&d(b,v),b}})(),t=function d(b,x,v){b===null&&(b=Function.prototype);var w=Object.getOwnPropertyDescriptor(b,x);if(w===void 0){var S=Object.getPrototypeOf(b);return S===null?void 0:d(S,x,v)}else{if("value"in w)return w.value;var C=w.get;return C===void 0?void 0:C.call(v)}},s=jv(),i=o(s);function o(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 x=b.substr(0,7).split("").map(function(v){return+v}).reduce(function(v,w,S){return S%2?v+w:v+w*3},0);return(10-x%10)%10},u=(function(d){p(b,d);function b(x,v){return c(this,b),x.search(/^[0-9]{7}$/)!==-1&&(x+=g(x)),m(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,x,v))}return n(b,[{key:"valid",value:function(){return this.data.search(/^[0-9]{8}$/)!==-1&&+this.data[7]===g(this.data)}},{key:"leftText",value:function(){return t(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"leftText",this).call(this,0,4)}},{key:"leftEncode",value:function(){var v=this.data.substr(0,4);return t(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"leftEncode",this).call(this,v,"LLLL")}},{key:"rightText",value:function(){return t(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"rightText",this).call(this,4,4)}},{key:"rightEncode",value:function(){var v=this.data.substr(4,4);return t(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"rightEncode",this).call(this,v,"RRRR")}}]),b})(i.default);return Oc.default=u,Oc}var Ac={},t1;function tN(){if(t1)return Ac;t1=1,Object.defineProperty(Ac,"__esModule",{value:!0});var n=(function(){function x(v,w){for(var S=0;S<w.length;S++){var C=w[S];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(v,C.key,C)}}return function(v,w,S){return w&&x(v.prototype,w),S&&x(v,S),v}})(),t=Po(),s=Bo(),i=m(s),o=Nn(),c=m(o);function m(x){return x&&x.__esModule?x:{default:x}}function p(x,v){if(!(x instanceof v))throw new TypeError("Cannot call a class as a function")}function g(x,v){if(!x)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return v&&(typeof v=="object"||typeof v=="function")?v:x}function u(x,v){if(typeof v!="function"&&v!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof v);x.prototype=Object.create(v&&v.prototype,{constructor:{value:x,enumerable:!1,writable:!0,configurable:!0}}),v&&(Object.setPrototypeOf?Object.setPrototypeOf(x,v):x.__proto__=v)}var d=function(v){var w=v.split("").map(function(S){return+S}).reduce(function(S,C,P){return P%2?S+C*9:S+C*3},0);return w%10},b=(function(x){u(v,x);function v(w,S){return p(this,v),g(this,(v.__proto__||Object.getPrototypeOf(v)).call(this,w,S))}return n(v,[{key:"valid",value:function(){return this.data.search(/^[0-9]{5}$/)!==-1}},{key:"encode",value:function(){var S=t.EAN5_STRUCTURE[d(this.data)];return{data:"1011"+(0,i.default)(this.data,S,"01"),text:this.text}}}]),v})(c.default);return Ac.default=b,Ac}var jc={},n1;function nN(){if(n1)return jc;n1=1,Object.defineProperty(jc,"__esModule",{value:!0});var n=(function(){function b(x,v){for(var w=0;w<v.length;w++){var S=v[w];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(x,S.key,S)}}return function(x,v,w){return v&&b(x.prototype,v),w&&b(x,w),x}})(),t=Po(),s=Bo(),i=m(s),o=Nn(),c=m(o);function m(b){return b&&b.__esModule?b:{default:b}}function p(b,x){if(!(b instanceof x))throw new TypeError("Cannot call a class as a function")}function g(b,x){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return x&&(typeof x=="object"||typeof x=="function")?x:b}function u(b,x){if(typeof x!="function"&&x!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof x);b.prototype=Object.create(x&&x.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),x&&(Object.setPrototypeOf?Object.setPrototypeOf(b,x):b.__proto__=x)}var d=(function(b){u(x,b);function x(v,w){return p(this,x),g(this,(x.__proto__||Object.getPrototypeOf(x)).call(this,v,w))}return n(x,[{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,i.default)(this.data,w,"01"),text:this.text}}}]),x})(c.default);return jc.default=d,jc}var co={},r1;function kv(){if(r1)return co;r1=1,Object.defineProperty(co,"__esModule",{value:!0});var n=(function(){function b(x,v){for(var w=0;w<v.length;w++){var S=v[w];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(x,S.key,S)}}return function(x,v,w){return v&&b(x.prototype,v),w&&b(x,w),x}})();co.checksum=d;var t=Bo(),s=c(t),i=Nn(),o=c(i);function c(b){return b&&b.__esModule?b:{default:b}}function m(b,x){if(!(b instanceof x))throw new TypeError("Cannot call a class as a function")}function p(b,x){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return x&&(typeof x=="object"||typeof x=="function")?x:b}function g(b,x){if(typeof x!="function"&&x!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof x);b.prototype=Object.create(x&&x.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),x&&(Object.setPrototypeOf?Object.setPrototypeOf(b,x):b.__proto__=x)}var u=(function(b){g(x,b);function x(v,w){m(this,x),v.search(/^[0-9]{11}$/)!==-1&&(v+=d(v));var S=p(this,(x.__proto__||Object.getPrototypeOf(x)).call(this,v,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 n(x,[{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,s.default)(this.data.substr(0,6),"LLLLLL"),w+="01010",w+=(0,s.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,s.default)(this.data[0],"L"),options:{height:this.guardHeight}}),w.push({data:(0,s.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,s.default)(this.data.substr(6,5),"RRRRR"),text:this.text.substr(6,5),options:{fontSize:this.fontSize}}),w.push({data:(0,s.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}}]),x})(o.default);function d(b){var x=0,v;for(v=1;v<11;v+=2)x+=parseInt(b[v]);for(v=0;v<11;v+=2)x+=parseInt(b[v])*3;return(10-x%10)%10}return co.default=u,co}var kc={},s1;function rN(){if(s1)return kc;s1=1,Object.defineProperty(kc,"__esModule",{value:!0});var n=(function(){function w(S,C){for(var P=0;P<C.length;P++){var q=C[P];q.enumerable=q.enumerable||!1,q.configurable=!0,"value"in q&&(q.writable=!0),Object.defineProperty(S,q.key,q)}}return function(S,C,P){return C&&w(S.prototype,C),P&&w(S,P),S}})(),t=Bo(),s=m(t),i=Nn(),o=m(i),c=kv();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 u(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"]],x=(function(w){u(S,w);function S(C,P){p(this,S);var q=g(this,(S.__proto__||Object.getPrototypeOf(S)).call(this,C,P));if(q.isValid=!1,C.search(/^[0-9]{6}$/)!==-1)q.middleDigits=C,q.upcA=v(C,"0"),q.text=P.text||""+q.upcA[0]+C+q.upcA[q.upcA.length-1],q.isValid=!0;else if(C.search(/^[01][0-9]{7}$/)!==-1)if(q.middleDigits=C.substring(1,C.length-1),q.upcA=v(q.middleDigits,C[0]),q.upcA[q.upcA.length-1]===C[C.length-1])q.isValid=!0;else return g(q);else return g(q);return q.displayValue=P.displayValue,P.fontSize>P.width*10?q.fontSize=P.width*10:q.fontSize=P.fontSize,q.guardHeight=P.height+q.fontSize/2+P.textMargin,q}return n(S,[{key:"valid",value:function(){return this.isValid}},{key:"encode",value:function(){return this.options.flat?this.flatEncoding():this.guardedEncoding()}},{key:"flatEncoding",value:function(){var P="";return P+="101",P+=this.encodeMiddleDigits(),P+="010101",{data:P,text:this.text}}},{key:"guardedEncoding",value:function(){var P=[];return this.displayValue&&P.push({data:"00000000",text:this.text[0],options:{textAlign:"left",fontSize:this.fontSize}}),P.push({data:"101",options:{height:this.guardHeight}}),P.push({data:this.encodeMiddleDigits(),text:this.text.substring(1,7),options:{fontSize:this.fontSize}}),P.push({data:"010101",options:{height:this.guardHeight}}),this.displayValue&&P.push({data:"00000000",text:this.text[7],options:{textAlign:"right",fontSize:this.fontSize}}),P}},{key:"encodeMiddleDigits",value:function(){var P=this.upcA[0],q=this.upcA[this.upcA.length-1],re=b[parseInt(q)][parseInt(P)];return(0,s.default)(this.middleDigits,re)}}]),S})(o.default);function v(w,S){for(var C=parseInt(w[w.length-1]),P=d[C],q="",re=0,se=0;se<P.length;se++){var M=P[se];M==="X"?q+=w[re++]:q+=M}return q=""+S+q,""+q+(0,c.checksum)(q)}return kc.default=x,kc}var i1;function sN(){if(i1)return Kt;i1=1,Object.defineProperty(Kt,"__esModule",{value:!0}),Kt.UPCE=Kt.UPC=Kt.EAN2=Kt.EAN5=Kt.EAN8=Kt.EAN13=void 0;var n=Zk(),t=x(n),s=eN(),i=x(s),o=tN(),c=x(o),m=nN(),p=x(m),g=kv(),u=x(g),d=rN(),b=x(d);function x(v){return v&&v.__esModule?v:{default:v}}return Kt.EAN13=t.default,Kt.EAN8=i.default,Kt.EAN5=c.default,Kt.EAN2=p.default,Kt.UPC=u.default,Kt.UPCE=b.default,Kt}var Qs={},Nc={},Gi={},a1;function iN(){return a1||(a1=1,Object.defineProperty(Gi,"__esModule",{value:!0}),Gi.START_BIN="1010",Gi.END_BIN="11101",Gi.BINARIES=["00110","10001","01001","11000","00101","10100","01100","00011","10010","01010"]),Gi}var o1;function Nv(){if(o1)return Nc;o1=1,Object.defineProperty(Nc,"__esModule",{value:!0});var n=(function(){function u(d,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(d,v.key,v)}}return function(d,b,x){return b&&u(d.prototype,b),x&&u(d,x),d}})(),t=iN(),s=Nn(),i=o(s);function o(u){return u&&u.__esModule?u:{default:u}}function c(u,d){if(!(u instanceof d))throw new TypeError("Cannot call a class as a function")}function m(u,d){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:u}function p(u,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);u.prototype=Object.create(d&&d.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(u,d):u.__proto__=d)}var g=(function(u){p(d,u);function d(){return c(this,d),m(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments))}return n(d,[{key:"valid",value:function(){return this.data.search(/^([0-9]{2})+$/)!==-1}},{key:"encode",value:function(){var x=this,v=this.data.match(/.{2}/g).map(function(w){return x.encodePair(w)}).join("");return{data:t.START_BIN+v+t.END_BIN,text:this.text}}},{key:"encodePair",value:function(x){var v=t.BINARIES[x[1]];return t.BINARIES[x[0]].split("").map(function(w,S){return(w==="1"?"111":"1")+(v[S]==="1"?"000":"0")}).join("")}}]),d})(i.default);return Nc.default=g,Nc}var Tc={},l1;function aN(){if(l1)return Tc;l1=1,Object.defineProperty(Tc,"__esModule",{value:!0});var n=(function(){function u(d,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(d,v.key,v)}}return function(d,b,x){return b&&u(d.prototype,b),x&&u(d,x),d}})(),t=Nv(),s=i(t);function i(u){return u&&u.__esModule?u:{default:u}}function o(u,d){if(!(u instanceof d))throw new TypeError("Cannot call a class as a function")}function c(u,d){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:u}function m(u,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);u.prototype=Object.create(d&&d.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(u,d):u.__proto__=d)}var p=function(d){var b=d.substr(0,13).split("").map(function(x){return parseInt(x,10)}).reduce(function(x,v,w){return x+v*(3-w%2*2)},0);return Math.ceil(b/10)*10-b},g=(function(u){m(d,u);function d(b,x){return o(this,d),b.search(/^[0-9]{13}$/)!==-1&&(b+=p(b)),c(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b,x))}return n(d,[{key:"valid",value:function(){return this.data.search(/^[0-9]{14}$/)!==-1&&+this.data[13]===p(this.data)}}]),d})(s.default);return Tc.default=g,Tc}var c1;function oN(){if(c1)return Qs;c1=1,Object.defineProperty(Qs,"__esModule",{value:!0}),Qs.ITF14=Qs.ITF=void 0;var n=Nv(),t=o(n),s=aN(),i=o(s);function o(c){return c&&c.__esModule?c:{default:c}}return Qs.ITF=t.default,Qs.ITF14=i.default,Qs}var xn={},Cc={},u1;function Uo(){if(u1)return Cc;u1=1,Object.defineProperty(Cc,"__esModule",{value:!0});var n=(function(){function u(d,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(d,v.key,v)}}return function(d,b,x){return b&&u(d.prototype,b),x&&u(d,x),d}})(),t=Nn(),s=i(t);function i(u){return u&&u.__esModule?u:{default:u}}function o(u,d){if(!(u instanceof d))throw new TypeError("Cannot call a class as a function")}function c(u,d){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:u}function m(u,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);u.prototype=Object.create(d&&d.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(u,d):u.__proto__=d)}var p=(function(u){m(d,u);function d(b,x){return o(this,d),c(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b,x))}return n(d,[{key:"encode",value:function(){for(var x="110",v=0;v<this.data.length;v++){var w=parseInt(this.data[v]),S=w.toString(2);S=g(S,4-S.length);for(var C=0;C<S.length;C++)x+=S[C]=="0"?"100":"110"}return x+="1001",{data:x,text:this.text}}},{key:"valid",value:function(){return this.data.search(/^[0-9]+$/)!==-1}}]),d})(s.default);function g(u,d){for(var b=0;b<d;b++)u="0"+u;return u}return Cc.default=p,Cc}var Mc={},uo={},f1;function Du(){if(f1)return uo;f1=1,Object.defineProperty(uo,"__esModule",{value:!0}),uo.mod10=n,uo.mod11=t;function n(s){for(var i=0,o=0;o<s.length;o++){var c=parseInt(s[o]);(o+s.length)%2===0?i+=c:i+=c*2%10+Math.floor(c*2/10)}return(10-i%10)%10}function t(s){for(var i=0,o=[2,3,4,5,6,7],c=0;c<s.length;c++){var m=parseInt(s[s.length-1-c]);i+=o[c%o.length]*m}return(11-i%11)%11}return uo}var h1;function lN(){if(h1)return Mc;h1=1,Object.defineProperty(Mc,"__esModule",{value:!0});var n=Uo(),t=i(n),s=Du();function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function m(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var p=(function(g){m(u,g);function u(d,b){return o(this,u),c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,d+(0,s.mod10)(d),b))}return u})(t.default);return Mc.default=p,Mc}var Rc={},d1;function cN(){if(d1)return Rc;d1=1,Object.defineProperty(Rc,"__esModule",{value:!0});var n=Uo(),t=i(n),s=Du();function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function m(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var p=(function(g){m(u,g);function u(d,b){return o(this,u),c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,d+(0,s.mod11)(d),b))}return u})(t.default);return Rc.default=p,Rc}var Dc={},m1;function uN(){if(m1)return Dc;m1=1,Object.defineProperty(Dc,"__esModule",{value:!0});var n=Uo(),t=i(n),s=Du();function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function m(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var p=(function(g){m(u,g);function u(d,b){return o(this,u),d+=(0,s.mod10)(d),d+=(0,s.mod10)(d),c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,d,b))}return u})(t.default);return Dc.default=p,Dc}var Lc={},p1;function fN(){if(p1)return Lc;p1=1,Object.defineProperty(Lc,"__esModule",{value:!0});var n=Uo(),t=i(n),s=Du();function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function m(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var p=(function(g){m(u,g);function u(d,b){return o(this,u),d+=(0,s.mod11)(d),d+=(0,s.mod10)(d),c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,d,b))}return u})(t.default);return Lc.default=p,Lc}var y1;function hN(){if(y1)return xn;y1=1,Object.defineProperty(xn,"__esModule",{value:!0}),xn.MSI1110=xn.MSI1010=xn.MSI11=xn.MSI10=xn.MSI=void 0;var n=Uo(),t=d(n),s=lN(),i=d(s),o=cN(),c=d(o),m=uN(),p=d(m),g=fN(),u=d(g);function d(b){return b&&b.__esModule?b:{default:b}}return xn.MSI=t.default,xn.MSI10=i.default,xn.MSI11=c.default,xn.MSI1010=p.default,xn.MSI1110=u.default,xn}var fo={},g1;function dN(){if(g1)return fo;g1=1,Object.defineProperty(fo,"__esModule",{value:!0}),fo.pharmacode=void 0;var n=(function(){function g(u,d){for(var b=0;b<d.length;b++){var x=d[b];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(u,x.key,x)}}return function(u,d,b){return d&&g(u.prototype,d),b&&g(u,b),u}})(),t=Nn(),s=i(t);function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function m(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var p=(function(g){m(u,g);function u(d,b){o(this,u);var x=c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,d,b));return x.number=parseInt(d,10),x}return n(u,[{key:"encode",value:function(){for(var b=this.number,x="";!isNaN(b)&&b!=0;)b%2===0?(x="11100"+x,b=(b-2)/2):(x="100"+x,b=(b-1)/2);return x=x.slice(0,-2),{data:x,text:this.text}}},{key:"valid",value:function(){return this.number>=3&&this.number<=131070}}]),u})(s.default);return fo.pharmacode=p,fo}var ho={},b1;function mN(){if(b1)return ho;b1=1,Object.defineProperty(ho,"__esModule",{value:!0}),ho.codabar=void 0;var n=(function(){function g(u,d){for(var b=0;b<d.length;b++){var x=d[b];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(u,x.key,x)}}return function(u,d,b){return d&&g(u.prototype,d),b&&g(u,b),u}})(),t=Nn(),s=i(t);function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function m(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var p=(function(g){m(u,g);function u(d,b){o(this,u),d.search(/^[0-9\-\$\:\.\+\/]+$/)===0&&(d="A"+d+"A");var x=c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,d.toUpperCase(),b));return x.text=x.options.text||x.text.replace(/[A-D]/g,""),x}return n(u,[{key:"valid",value:function(){return this.data.search(/^[A-D][0-9\-\$\:\.\+\/]+[A-D]$/)!==-1}},{key:"encode",value:function(){for(var b=[],x=this.getEncodings(),v=0;v<this.data.length;v++)b.push(x[this.data.charAt(v)]),v!==this.data.length-1&&b.push("0");return{text:this.text,data:b.join("")}}},{key:"getEncodings",value:function(){return{0:"101010011",1:"101011001",2:"101001011",3:"110010101",4:"101101001",5:"110101001",6:"100101011",7:"100101101",8:"100110101",9:"110100101","-":"101001101",$:"101100101",":":"1101011011","/":"1101101011",".":"1101101101","+":"1011011011",A:"1011001001",B:"1001001011",C:"1010010011",D:"1010011001"}}}]),u})(s.default);return ho.codabar=p,ho}var Xs={},qc={},Vi={},x1;function pN(){return x1||(x1=1,Object.defineProperty(Vi,"__esModule",{value:!0}),Vi.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","-","."," ","$","/","+","%","($)","(%)","(/)","(+)","ÿ"],Vi.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"],Vi.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"]}),Vi}var v1;function Tv(){if(v1)return qc;v1=1,Object.defineProperty(qc,"__esModule",{value:!0});var n=(function(){function u(d,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(d,v.key,v)}}return function(d,b,x){return b&&u(d.prototype,b),x&&u(d,x),d}})(),t=pN(),s=Nn(),i=o(s);function o(u){return u&&u.__esModule?u:{default:u}}function c(u,d){if(!(u instanceof d))throw new TypeError("Cannot call a class as a function")}function m(u,d){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:u}function p(u,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);u.prototype=Object.create(d&&d.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(u,d):u.__proto__=d)}var g=(function(u){p(d,u);function d(b,x){return c(this,d),m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b,x))}return n(d,[{key:"valid",value:function(){return/^[0-9A-Z\-. $/+%]+$/.test(this.data)}},{key:"encode",value:function(){var x=this.data.split("").flatMap(function(C){return t.MULTI_SYMBOLS[C]||C}),v=x.map(function(C){return d.getEncoding(C)}).join(""),w=d.checksum(x,20),S=d.checksum(x.concat(w),15);return{text:this.text,data:d.getEncoding("ÿ")+v+d.getEncoding(w)+d.getEncoding(S)+d.getEncoding("ÿ")+"1"}}}],[{key:"getEncoding",value:function(x){return t.BINARIES[d.symbolValue(x)]}},{key:"getSymbol",value:function(x){return t.SYMBOLS[x]}},{key:"symbolValue",value:function(x){return t.SYMBOLS.indexOf(x)}},{key:"checksum",value:function(x,v){var w=x.slice().reverse().reduce(function(S,C,P){var q=P%v+1;return S+d.symbolValue(C)*q},0);return d.getSymbol(w%47)}}]),d})(i.default);return qc.default=g,qc}var Pc={},_1;function yN(){if(_1)return Pc;_1=1,Object.defineProperty(Pc,"__esModule",{value:!0});var n=(function(){function g(u,d){for(var b=0;b<d.length;b++){var x=d[b];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(u,x.key,x)}}return function(u,d,b){return d&&g(u.prototype,d),b&&g(u,b),u}})(),t=Tv(),s=i(t);function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function m(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var p=(function(g){m(u,g);function u(d,b){return o(this,u),c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,d,b))}return n(u,[{key:"valid",value:function(){return/^[\x00-\x7f]+$/.test(this.data)}}]),u})(s.default);return Pc.default=p,Pc}var w1;function gN(){if(w1)return Xs;w1=1,Object.defineProperty(Xs,"__esModule",{value:!0}),Xs.CODE93FullASCII=Xs.CODE93=void 0;var n=Tv(),t=o(n),s=yN(),i=o(s);function o(c){return c&&c.__esModule?c:{default:c}}return Xs.CODE93=t.default,Xs.CODE93FullASCII=i.default,Xs}var mo={},S1;function bN(){if(S1)return mo;S1=1,Object.defineProperty(mo,"__esModule",{value:!0}),mo.GenericBarcode=void 0;var n=(function(){function g(u,d){for(var b=0;b<d.length;b++){var x=d[b];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(u,x.key,x)}}return function(u,d,b){return d&&g(u.prototype,d),b&&g(u,b),u}})(),t=Nn(),s=i(t);function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function m(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var p=(function(g){m(u,g);function u(d,b){return o(this,u),c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,d,b))}return n(u,[{key:"encode",value:function(){return{data:"10101010101010101010101010101010101010101",text:this.text}}},{key:"valid",value:function(){return!0}}]),u})(s.default);return mo.GenericBarcode=p,mo}var E1;function xN(){if(E1)return mc;E1=1,Object.defineProperty(mc,"__esModule",{value:!0});var n=Vk(),t=Wk(),s=sN(),i=oN(),o=hN(),c=dN(),m=mN(),p=gN(),g=bN();return mc.default={CODE39:n.CODE39,CODE128:t.CODE128,CODE128A:t.CODE128A,CODE128B:t.CODE128B,CODE128C:t.CODE128C,EAN13:s.EAN13,EAN8:s.EAN8,EAN5:s.EAN5,EAN2:s.EAN2,UPC:s.UPC,UPCE:s.UPCE,ITF14:i.ITF14,ITF:i.ITF,MSI:o.MSI,MSI10:o.MSI10,MSI11:o.MSI11,MSI1010:o.MSI1010,MSI1110:o.MSI1110,pharmacode:c.pharmacode,codabar:m.codabar,CODE93:p.CODE93,CODE93FullASCII:p.CODE93FullASCII,GenericBarcode:g.GenericBarcode},mc}var Bc={},O1;function Lu(){if(O1)return Bc;O1=1,Object.defineProperty(Bc,"__esModule",{value:!0});var n=Object.assign||function(t){for(var s=1;s<arguments.length;s++){var i=arguments[s];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(t[o]=i[o])}return t};return Bc.default=function(t,s){return n({},t,s)},Bc}var Uc={},A1;function vN(){if(A1)return Uc;A1=1,Object.defineProperty(Uc,"__esModule",{value:!0}),Uc.default=n;function n(t){var s=[];function i(o){if(Array.isArray(o))for(var c=0;c<o.length;c++)i(o[c]);else o.text=o.text||"",o.data=o.data||"",s.push(o)}return i(t),s}return Uc}var zc={},j1;function _N(){if(j1)return zc;j1=1,Object.defineProperty(zc,"__esModule",{value:!0}),zc.default=n;function n(t){return t.marginTop=t.marginTop||t.margin,t.marginBottom=t.marginBottom||t.margin,t.marginRight=t.marginRight||t.margin,t.marginLeft=t.marginLeft||t.margin,t}return zc}var Ic={},$c={},Hc={},k1;function Cv(){if(k1)return Hc;k1=1,Object.defineProperty(Hc,"__esModule",{value:!0}),Hc.default=n;function n(t){var s=["width","height","textMargin","fontSize","margin","marginTop","marginBottom","marginLeft","marginRight"];for(var i in s)s.hasOwnProperty(i)&&(i=s[i],typeof t[i]=="string"&&(t[i]=parseInt(t[i],10)));return typeof t.displayValue=="string"&&(t.displayValue=t.displayValue!="false"),t}return Hc}var Fc={},N1;function Mv(){if(N1)return Fc;N1=1,Object.defineProperty(Fc,"__esModule",{value:!0});var n={width:2,height:100,format:"auto",displayValue:!0,fontOptions:"",font:"monospace",text:void 0,textAlign:"center",textPosition:"bottom",textMargin:2,fontSize:20,background:"#ffffff",lineColor:"#000000",margin:10,marginTop:void 0,marginBottom:void 0,marginLeft:void 0,marginRight:void 0,valid:function(){}};return Fc.default=n,Fc}var T1;function wN(){if(T1)return $c;T1=1,Object.defineProperty($c,"__esModule",{value:!0});var n=Cv(),t=o(n),s=Mv(),i=o(s);function o(m){return m&&m.__esModule?m:{default:m}}function c(m){var p={};for(var g in i.default)i.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 $c.default=c,$c}var Gc={},Vc={},vn={},C1;function Rv(){if(C1)return vn;C1=1,Object.defineProperty(vn,"__esModule",{value:!0}),vn.getTotalWidthOfEncodings=vn.calculateEncodingAttributes=vn.getBarcodePadding=vn.getEncodingHeight=vn.getMaximumHeightOfEncodings=void 0;var n=Lu(),t=s(n);function s(u){return u&&u.__esModule?u:{default:u}}function i(u,d){return d.height+(d.displayValue&&u.text.length>0?d.fontSize+d.textMargin:0)+d.marginTop+d.marginBottom}function o(u,d,b){if(b.displayValue&&d<u){if(b.textAlign=="center")return Math.floor((u-d)/2);if(b.textAlign=="left")return 0;if(b.textAlign=="right")return Math.floor(u-d)}return 0}function c(u,d,b){for(var x=0;x<u.length;x++){var v=u[x],w=(0,t.default)(d,v.options),S;w.displayValue?S=g(v.text,w,b):S=0;var C=v.data.length*w.width;v.width=Math.ceil(Math.max(S,C)),v.height=i(v,w),v.barcodePadding=o(S,C,w)}}function m(u){for(var d=0,b=0;b<u.length;b++)d+=u[b].width;return d}function p(u){for(var d=0,b=0;b<u.length;b++)u[b].height>d&&(d=u[b].height);return d}function g(u,d,b){var x;if(b)x=b;else if(typeof document<"u")x=document.createElement("canvas").getContext("2d");else return 0;x.font=d.fontOptions+" "+d.fontSize+"px "+d.font;var v=x.measureText(u);if(!v)return 0;var w=v.width;return w}return vn.getMaximumHeightOfEncodings=p,vn.getEncodingHeight=i,vn.getBarcodePadding=o,vn.calculateEncodingAttributes=c,vn.getTotalWidthOfEncodings=m,vn}var M1;function SN(){if(M1)return Vc;M1=1,Object.defineProperty(Vc,"__esModule",{value:!0});var n=(function(){function p(g,u){for(var d=0;d<u.length;d++){var b=u[d];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(g,b.key,b)}}return function(g,u,d){return u&&p(g.prototype,u),d&&p(g,d),g}})(),t=Lu(),s=o(t),i=Rv();function o(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,u,d){c(this,p),this.canvas=g,this.encodings=u,this.options=d}return n(p,[{key:"render",value:function(){if(!this.canvas.getContext)throw new Error("The browser does not support canvas.");this.prepareCanvas();for(var u=0;u<this.encodings.length;u++){var d=(0,s.default)(this.options,this.encodings[u].options);this.drawCanvasBarcode(d,this.encodings[u]),this.drawCanvasText(d,this.encodings[u]),this.moveCanvasDrawing(this.encodings[u])}this.restoreCanvas()}},{key:"prepareCanvas",value:function(){var u=this.canvas.getContext("2d");u.save(),(0,i.calculateEncodingAttributes)(this.encodings,this.options,u);var d=(0,i.getTotalWidthOfEncodings)(this.encodings),b=(0,i.getMaximumHeightOfEncodings)(this.encodings);this.canvas.width=d+this.options.marginLeft+this.options.marginRight,this.canvas.height=b,u.clearRect(0,0,this.canvas.width,this.canvas.height),this.options.background&&(u.fillStyle=this.options.background,u.fillRect(0,0,this.canvas.width,this.canvas.height)),u.translate(this.options.marginLeft,0)}},{key:"drawCanvasBarcode",value:function(u,d){var b=this.canvas.getContext("2d"),x=d.data,v;u.textPosition=="top"?v=u.marginTop+u.fontSize+u.textMargin:v=u.marginTop,b.fillStyle=u.lineColor;for(var w=0;w<x.length;w++){var S=w*u.width+d.barcodePadding;x[w]==="1"?b.fillRect(S,v,u.width,u.height):x[w]&&b.fillRect(S,v,u.width,u.height*x[w])}}},{key:"drawCanvasText",value:function(u,d){var b=this.canvas.getContext("2d"),x=u.fontOptions+" "+u.fontSize+"px "+u.font;if(u.displayValue){var v,w;u.textPosition=="top"?w=u.marginTop+u.fontSize-u.textMargin:w=u.height+u.textMargin+u.marginTop+u.fontSize,b.font=x,u.textAlign=="left"||d.barcodePadding>0?(v=0,b.textAlign="left"):u.textAlign=="right"?(v=d.width-1,b.textAlign="right"):(v=d.width/2,b.textAlign="center"),b.fillText(d.text,v,w)}}},{key:"moveCanvasDrawing",value:function(u){var d=this.canvas.getContext("2d");d.translate(u.width,0)}},{key:"restoreCanvas",value:function(){var u=this.canvas.getContext("2d");u.restore()}}]),p})();return Vc.default=m,Vc}var Yc={},R1;function EN(){if(R1)return Yc;R1=1,Object.defineProperty(Yc,"__esModule",{value:!0});var n=(function(){function g(u,d){for(var b=0;b<d.length;b++){var x=d[b];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(u,x.key,x)}}return function(u,d,b){return d&&g(u.prototype,d),b&&g(u,b),u}})(),t=Lu(),s=o(t),i=Rv();function o(g){return g&&g.__esModule?g:{default:g}}function c(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}var m="http://www.w3.org/2000/svg",p=(function(){function g(u,d,b){c(this,g),this.svg=u,this.encodings=d,this.options=b,this.document=b.xmlDocument||document}return n(g,[{key:"render",value:function(){var d=this.options.marginLeft;this.prepareSVG();for(var b=0;b<this.encodings.length;b++){var x=this.encodings[b],v=(0,s.default)(this.options,x.options),w=this.createGroup(d,v.marginTop,this.svg);this.setGroupOptions(w,v),this.drawSvgBarcode(w,v,x),this.drawSVGText(w,v,x),d+=x.width}}},{key:"prepareSVG",value:function(){for(;this.svg.firstChild;)this.svg.removeChild(this.svg.firstChild);(0,i.calculateEncodingAttributes)(this.encodings,this.options);var d=(0,i.getTotalWidthOfEncodings)(this.encodings),b=(0,i.getMaximumHeightOfEncodings)(this.encodings),x=d+this.options.marginLeft+this.options.marginRight;this.setSvgAttributes(x,b),this.options.background&&this.drawRect(0,0,x,b,this.svg).setAttribute("fill",this.options.background)}},{key:"drawSvgBarcode",value:function(d,b,x){var v=x.data,w;b.textPosition=="top"?w=b.fontSize+b.textMargin:w=0;for(var S=0,C=0,P=0;P<v.length;P++)C=P*b.width+x.barcodePadding,v[P]==="1"?S++:S>0&&(this.drawRect(C-b.width*S,w,b.width*S,b.height,d),S=0);S>0&&this.drawRect(C-b.width*(S-1),w,b.width*S,b.height,d)}},{key:"drawSVGText",value:function(d,b,x){var v=this.document.createElementNS(m,"text");if(b.displayValue){var w,S;v.setAttribute("font-family",b.font),v.setAttribute("font-size",b.fontSize),b.fontOptions.includes("bold")&&v.setAttribute("font-weight","bold"),b.fontOptions.includes("italic")&&v.setAttribute("font-style","italic"),b.textPosition=="top"?S=b.fontSize-b.textMargin:S=b.height+b.textMargin+b.fontSize,b.textAlign=="left"||x.barcodePadding>0?(w=0,v.setAttribute("text-anchor","start")):b.textAlign=="right"?(w=x.width-1,v.setAttribute("text-anchor","end")):(w=x.width/2,v.setAttribute("text-anchor","middle")),v.setAttribute("x",w),v.setAttribute("y",S),v.appendChild(this.document.createTextNode(x.text)),d.appendChild(v)}}},{key:"setSvgAttributes",value:function(d,b){var x=this.svg;x.setAttribute("width",d+"px"),x.setAttribute("height",b+"px"),x.setAttribute("x","0px"),x.setAttribute("y","0px"),x.setAttribute("viewBox","0 0 "+d+" "+b),x.setAttribute("xmlns",m),x.setAttribute("version","1.1")}},{key:"createGroup",value:function(d,b,x){var v=this.document.createElementNS(m,"g");return v.setAttribute("transform","translate("+d+", "+b+")"),x.appendChild(v),v}},{key:"setGroupOptions",value:function(d,b){d.setAttribute("fill",b.lineColor)}},{key:"drawRect",value:function(d,b,x,v,w){var S=this.document.createElementNS(m,"rect");return S.setAttribute("x",d),S.setAttribute("y",b),S.setAttribute("width",x),S.setAttribute("height",v),w.appendChild(S),S}}]),g})();return Yc.default=p,Yc}var Kc={},D1;function ON(){if(D1)return Kc;D1=1,Object.defineProperty(Kc,"__esModule",{value:!0});var n=(function(){function i(o,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(o,p.key,p)}}return function(o,c,m){return c&&i(o.prototype,c),m&&i(o,m),o}})();function t(i,o){if(!(i instanceof o))throw new TypeError("Cannot call a class as a function")}var s=(function(){function i(o,c,m){t(this,i),this.object=o,this.encodings=c,this.options=m}return n(i,[{key:"render",value:function(){this.object.encodings=this.encodings}}]),i})();return Kc.default=s,Kc}var L1;function AN(){if(L1)return Gc;L1=1,Object.defineProperty(Gc,"__esModule",{value:!0});var n=SN(),t=m(n),s=EN(),i=m(s),o=ON(),c=m(o);function m(p){return p&&p.__esModule?p:{default:p}}return Gc.default={CanvasRenderer:t.default,SVGRenderer:i.default,ObjectRenderer:c.default},Gc}var Yi={},q1;function Dv(){if(q1)return Yi;q1=1,Object.defineProperty(Yi,"__esModule",{value:!0});function n(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 s(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 i=(function(m){s(p,m);function p(g,u){n(this,p);var d=t(this,(p.__proto__||Object.getPrototypeOf(p)).call(this));return d.name="InvalidInputException",d.symbology=g,d.input=u,d.message='"'+d.input+'" is not a valid input for '+d.symbology,d}return p})(Error),o=(function(m){s(p,m);function p(){n(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){s(p,m);function p(){n(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 Yi.InvalidInputException=i,Yi.InvalidElementException=o,Yi.NoElementException=c,Yi}var P1;function jN(){if(P1)return Ic;P1=1,Object.defineProperty(Ic,"__esModule",{value:!0});var n=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=wN(),s=m(t),i=AN(),o=m(i),c=Dv();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=[],x=0;x<d.length;x++)b.push(p(d[x]));return b}else{if(typeof HTMLCanvasElement<"u"&&d instanceof HTMLImageElement)return u(d);if(d&&d.nodeName&&d.nodeName.toLowerCase()==="svg"||typeof SVGElement<"u"&&d instanceof SVGElement)return{element:d,options:(0,s.default)(d),renderer:o.default.SVGRenderer};if(typeof HTMLCanvasElement<"u"&&d instanceof HTMLCanvasElement)return{element:d,options:(0,s.default)(d),renderer:o.default.CanvasRenderer};if(d&&d.getContext)return{element:d,renderer:o.default.CanvasRenderer};if(d&&(typeof d>"u"?"undefined":n(d))==="object"&&!d.nodeName)return{element:d,renderer:o.default.ObjectRenderer};throw new c.InvalidElementException}}function g(d){var b=document.querySelectorAll(d);if(b.length!==0){for(var x=[],v=0;v<b.length;v++)x.push(p(b[v]));return x}}function u(d){var b=document.createElement("canvas");return{element:b,options:(0,s.default)(d),renderer:o.default.CanvasRenderer,afterRender:function(){d.setAttribute("src",b.toDataURL())}}}return Ic.default=p,Ic}var Jc={},B1;function kN(){if(B1)return Jc;B1=1,Object.defineProperty(Jc,"__esModule",{value:!0});var n=(function(){function i(o,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(o,p.key,p)}}return function(o,c,m){return c&&i(o.prototype,c),m&&i(o,m),o}})();function t(i,o){if(!(i instanceof o))throw new TypeError("Cannot call a class as a function")}var s=(function(){function i(o){t(this,i),this.api=o}return n(i,[{key:"handleCatch",value:function(c){if(c.name==="InvalidInputException")if(this.api._options.valid!==this.api._defaults.valid)this.api._options.valid(!1);else throw c.message;else throw c;this.api.render=function(){}}},{key:"wrapBarcodeCall",value:function(c){try{var m=c.apply(void 0,arguments);return this.api._options.valid(!0),m}catch(p){return this.handleCatch(p),this.api}}}]),i})();return Jc.default=s,Jc}var fd,U1;function NN(){if(U1)return fd;U1=1;var n=xN(),t=P(n),s=Lu(),i=P(s),o=vN(),c=P(o),m=_N(),p=P(m),g=jN(),u=P(g),d=Cv(),b=P(d),x=kN(),v=P(x),w=Dv(),S=Mv(),C=P(S);function P(I){return I&&I.__esModule?I:{default:I}}var q=function(){},re=function(D,X,W){var he=new q;if(typeof D>"u")throw Error("No element to render on was provided.");return he._renderProperties=(0,u.default)(D),he._encodings=[],he._options=C.default,he._errorHandler=new v.default(he),typeof X<"u"&&(W=W||{},W.format||(W.format=ae()),he.options(W)[W.format](X,W).render()),he};re.getModule=function(I){return t.default[I]};for(var se in t.default)t.default.hasOwnProperty(se)&&M(t.default,se);function M(I,D){q.prototype[D]=q.prototype[D.toUpperCase()]=q.prototype[D.toLowerCase()]=function(X,W){var he=this;return he._errorHandler.wrapBarcodeCall(function(){W.text=typeof W.text>"u"?void 0:""+W.text;var we=(0,i.default)(he._options,W);we=(0,b.default)(we);var Oe=I[D],F=U(X,Oe,we);return he._encodings.push(F),he})}}function U(I,D,X){I=""+I;var W=new D(I,X);if(!W.valid())throw new w.InvalidInputException(W.constructor.name,I);var he=W.encode();he=(0,c.default)(he);for(var we=0;we<he.length;we++)he[we].options=(0,i.default)(X,he[we].options);return he}function ae(){return t.default.CODE128?"CODE128":Object.keys(t.default)[0]}q.prototype.options=function(I){return this._options=(0,i.default)(this._options,I),this},q.prototype.blank=function(I){var D=new Array(I+1).join("0");return this._encodings.push({data:D}),this},q.prototype.init=function(){if(this._renderProperties){Array.isArray(this._renderProperties)||(this._renderProperties=[this._renderProperties]);var I;for(var D in this._renderProperties){I=this._renderProperties[D];var X=(0,i.default)(this._options,I.options);X.format=="auto"&&(X.format=ae()),this._errorHandler.wrapBarcodeCall(function(){var W=X.value,he=t.default[X.format.toUpperCase()],we=U(W,he,X);z(I,we,X)})}}},q.prototype.render=function(){if(!this._renderProperties)throw new w.NoElementException;if(Array.isArray(this._renderProperties))for(var I=0;I<this._renderProperties.length;I++)z(this._renderProperties[I],this._encodings,this._options);else z(this._renderProperties,this._encodings,this._options);return this},q.prototype._defaults=C.default;function z(I,D,X){D=(0,c.default)(D);for(var W=0;W<D.length;W++)D[W].options=(0,i.default)(X,D[W].options),(0,p.default)(D[W].options);(0,p.default)(X);var he=I.renderer,we=new he(I.element,D,X);we.render(),I.afterRender&&I.afterRender()}return typeof window<"u"&&(window.JsBarcode=re),typeof jQuery<"u"&&(jQuery.fn.JsBarcode=function(I,D){var X=[];return jQuery(this).each(function(){X.push(this)}),re(X,I,D)}),fd=re,fd}var TN=NN();const CN=lS(TN),MN={[je.EXECUTED]:"Executed",[je.MATCHED_LIST]:"Matched list",[je.CONFIRM_REQUIRED]:"Awaiting confirmation",[je.NO_MATCH_FALLBACK]:"No match",[je.UNCONFIGURED]:"Not configured",[je.INVALID_CODE]:"Invalid code",[je.FORBIDDEN]:"Not permitted",[je.CONFLICT]:"Conflict",[je.IDENTITY_PRIMED]:"Identity primed",[je.IDENTITY_UNKNOWN]:"Badge not recognized",[je.NOT_PRIMED]:"Badge required",[je.CHOICES]:"Choices presented",[je.NO_OPEN_CONTAINER]:"Container closing, scan again",[je.HELD]:"Holding",[je.REFUSED]:"Not placed",[je.SUBJECT_STALE]:"Scan it again"},RN={[je.EXECUTED]:"text-status-success",[je.MATCHED_LIST]:"text-status-success",[je.CONFIRM_REQUIRED]:"text-status-warning",[je.NO_MATCH_FALLBACK]:"text-text-secondary",[je.UNCONFIGURED]:"text-status-warning",[je.INVALID_CODE]:"text-status-error",[je.FORBIDDEN]:"text-status-error",[je.CONFLICT]:"text-status-warning",[je.IDENTITY_PRIMED]:"text-status-success",[je.IDENTITY_UNKNOWN]:"text-status-warning",[je.NOT_PRIMED]:"text-status-warning",[je.CHOICES]:"text-status-success",[je.NO_OPEN_CONTAINER]:"text-status-warning",[je.HELD]:"text-status-success",[je.REFUSED]:"text-status-error",[je.SUBJECT_STALE]:"text-status-warning"};function DN(n){return n.outcome===je.IDENTITY_PRIMED&&n.actor?`Hi ${n.actor.displayName}`:`${MN[n.outcome]}${n.rule?` — ${n.rule.name}`:""}`}function LN(n){var t,s,i,o,c,m,p;return n.outcome===je.NO_MATCH_FALLBACK?((t=n.fallback)==null?void 0:t.markdown)??null:n.outcome===je.IDENTITY_UNKNOWN?((s=n.fallback)==null?void 0:s.markdown)??null:n.outcome===je.NOT_PRIMED?((i=n.notPrimed)==null?void 0:i.markdown)??null:n.outcome===je.NO_OPEN_CONTAINER?((o=n.fallback)==null?void 0:o.markdown)??null:n.outcome===je.REFUSED?((c=n.refusal)==null?void 0:c.markdown)??n.error??null:n.outcome===je.HELD?((p=(m=n.subject)==null?void 0:m.expect)==null?void 0:p.prompt)??null:n.outcome===je.SUBJECT_STALE?n.error??null:null}function gs(n){return n.replace(/`([^`]+)`/g,'<code class="px-1 py-0.5 bg-surface-sunken rounded text-xs font-mono">$1</code>').replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>").replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" class="text-accent-primary hover:underline" target="_blank" rel="noopener noreferrer">$1</a>')}function qN({content:n,compact:t,inherit:s}){const i=[],o=/^```(\w*)\n([\s\S]*?)^```$/gm;let c=0,m;for(;(m=o.exec(n))!==null;)m.index>c&&i.push({type:"text",text:n.slice(c,m.index)}),i.push({type:"code",lang:m[1],code:m[2].replace(/\n$/,"")}),c=m.index+m[0].length;c<n.length&&i.push({type:"text",text:n.slice(c)});const p=s?{text:"",heading:"",list:"",code:"text-[0.85em]",tone:""}:t?{text:"text-xs",heading:"text-xs",list:"text-xs",code:"text-2xs",tone:"text-text-secondary"}:{text:"text-sm",heading:"text-sm",list:"text-sm",code:"text-xs",tone:"text-text-secondary"},g=[];for(const u of i){if(u.type==="code"){const d=u.code.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");g.push(`<pre class="my-2 p-2.5 bg-surface-sunken rounded-md overflow-x-auto"><code class="${p.code} font-mono text-text-secondary leading-relaxed">${d}</code></pre>`);continue}g.push(...PN(u.text,p))}return h.jsx("div",{className:s?void 0:"prose-sm",dangerouslySetInnerHTML:{__html:g.join(`
55
+ `)}})}function PN(n,t){const s=n.split(`
56
+ `),i=[];let o=!1,c=!1,m=[];for(const p of s){const g=p.trim();if(g.startsWith("|")&&g.endsWith("|")){const u=g.slice(1,-1).split("|").map(d=>d.trim());if(u.every(d=>/^[-:]+$/.test(d)))continue;c||(c=!0,m=[]),m.push(u);continue}if(c){c=!1;const[u,...d]=m;i.push('<div class="overflow-x-auto my-2"><table class="text-xs w-full"><thead><tr>');for(const b of u)i.push(`<th class="text-left py-1 px-2 border-b border-border text-text-secondary font-medium">${gs(b)}</th>`);i.push("</tr></thead><tbody>");for(const b of d){i.push("<tr>");for(const x of b)i.push(`<td class="py-1 px-2 border-b border-border/50">${gs(x)}</td>`);i.push("</tr>")}i.push("</tbody></table></div>"),m=[]}if(!g){o&&(i.push("</ul>"),o=!1);continue}if(g.startsWith("### ")){o&&(i.push("</ul>"),o=!1),i.push(`<h4 class="${t.heading} font-semibold text-text-primary mt-3 mb-1">${gs(g.slice(4))}</h4>`);continue}if(g.startsWith("## ")){o&&(i.push("</ul>"),o=!1),i.push(`<h3 class="${t.heading} font-semibold text-text-primary mt-3 mb-1">${gs(g.slice(3))}</h3>`);continue}if(/^[-*_]{3,}$/.test(g)){o&&(i.push("</ul>"),o=!1),i.push('<hr class="border-border my-3" />');continue}if(/^[-*] /.test(g)){o||(i.push('<ul class="space-y-1 my-1">'),o=!0),i.push(`<li class="${t.list} ${t.tone} flex gap-2"><span class="text-text-tertiary shrink-0">-</span><span>${gs(g.slice(2))}</span></li>`);continue}o&&(i.push("</ul>"),o=!1),i.push(`<p class="${t.text} ${t.tone} my-1">${gs(g)}</p>`)}if(c&&m.length){const[p,...g]=m;i.push('<div class="overflow-x-auto my-2"><table class="text-xs w-full"><thead><tr>');for(const u of p)i.push(`<th class="text-left py-1 px-2 border-b border-border text-text-secondary font-medium">${gs(u)}</th>`);i.push("</tr></thead><tbody>");for(const u of g){i.push("<tr>");for(const d of u)i.push(`<td class="py-1 px-2 border-b border-border/50">${gs(d)}</td>`);i.push("</tr>")}i.push("</tbody></table></div>")}return o&&i.push("</ul>"),i}function Im({result:n,compact:t=!1}){const{response:s}=n,i=t?"text-xs":"text-sm",o=s?LN(s):null,c=s!=null&&s.error&&s.error!==o?s.error:null;return h.jsxs("div",{className:"min-w-0",children:[h.jsx("div",{className:`${i} font-mono text-text-secondary truncate`,children:n.code}),s?h.jsxs(h.Fragment,{children:[h.jsx("div",{className:`${i} font-medium ${RN[s.outcome]}`,children:DN(s)}),c&&h.jsx("div",{className:"text-xs text-text-tertiary mt-0.5",children:c}),o&&h.jsx("div",{className:"text-xs text-text-secondary mt-1.5",children:h.jsx(qN,{content:o,compact:!0})})]}):h.jsx("div",{className:`${i} text-status-error`,children:n.error})]})}function Lv(n){return n.replace(/[\u2010-\u2015\u2212]/g,"-").replace(/[\u2018\u2019]/g,"'").replace(/[\u201C\u201D]/g,'"').replace(/\u00A0/g," ").replace(/[\u200B-\u200D\uFEFF]/g,"").replace(/[\x00-\x1F\x7F]/g,"").trim()}function BN(n){const t=new Set;for(const s of n){const i=s.codePointAt(0);(i>127||i<32)&&t.add(`"${i<32?"\\x"+i.toString(16).padStart(2,"0"):s}" U+${i.toString(16).toUpperCase().padStart(4,"0")}`)}return[...t]}function UN({value:n}){const t=E.useRef(null),[s,i]=E.useState(!1);return E.useEffect(()=>{if(!(!t.current||!n))try{CN(t.current,n,{format:"CODE128",width:2,height:88,margin:12,displayValue:!0,fontSize:13,background:"#ffffff",lineColor:"#000000"}),i(!1)}catch{i(!0)}},[n]),n?h.jsxs("div",{children:[h.jsx("span",{className:"block text-xs uppercase tracking-wide text-text-tertiary mb-1",children:"Barcode"}),s?h.jsxs("p",{className:"text-xs text-status-error",children:["This value has characters Code 128 cannot carry:"," ",h.jsx("span",{className:"font-mono",children:BN(n).join(", ")||"unknown"})]}):h.jsx("div",{className:"bg-white rounded p-1 inline-block max-w-full overflow-hidden",children:h.jsx("svg",{ref:t,className:"max-w-full"})})]}):null}function zN({onClose:n}){const{submitCode:t,lastResult:s,busy:i,wedgeConfig:o,updateWedgeConfig:c,diagnostics:m,diagnosticsOn:p,setDiagnosticsOn:g}=zm(),[u,d]=E.useState(""),[b,x]=E.useState(!1),v=w=>{w.preventDefault();const S=u.trim();S&&(d(""),t(S))};return h.jsxs("div",{className:"flex flex-col h-full",children:[h.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border",children:[h.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-text-primary",children:[h.jsx(Mo,{className:"w-4 h-4"}),"Scan"]}),h.jsx("button",{type:"button",onClick:n,className:"text-text-tertiary hover:text-text-primary",title:"Close",children:h.jsx(Zt,{className:"w-4 h-4"})})]}),h.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-4 space-y-6",children:[h.jsxs("form",{onSubmit:v,className:"space-y-2",children:[h.jsx("label",{className:"block text-xs uppercase tracking-wide text-text-tertiary",children:"Enter a code"}),h.jsxs("div",{className:"flex gap-2",children:[h.jsx("input",{value:u,onChange:w=>d(Lv(w.target.value)),placeholder:"10:1:SN-12345",className:"flex-1 px-2 py-1.5 text-sm bg-surface-raised border border-surface-border rounded text-text-primary","data-scan-manual-entry":!0}),h.jsx("button",{type:"submit",disabled:i||!u.trim(),className:"px-3 py-1.5 text-sm rounded bg-accent text-text-inverse disabled:opacity-50",children:"Go"})]}),h.jsx("p",{className:"text-xs text-text-tertiary",children:"Scanning with a connected scanner works from any page — this entry exists for testing and for codes you can read but not scan. Typing here also draws the code below; point the scanner at the screen to fire it for real."})]}),h.jsx(UN,{value:u.trim()}),s&&h.jsxs("div",{className:"space-y-2",children:[h.jsx("div",{className:"text-xs uppercase tracking-wide text-text-tertiary",children:"Last scan"}),h.jsx(Im,{result:s})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsxs("button",{type:"button",onClick:()=>x(w=>!w),className:"text-xs uppercase tracking-wide text-text-tertiary hover:text-text-primary",children:["Capture settings ",b?"▾":"▸"]}),b&&h.jsxs("div",{className:"space-y-3",children:[h.jsxs("label",{className:"block text-sm text-text-primary",children:[h.jsx("span",{className:"block text-xs text-text-tertiary mb-1",children:"Key gap limit (ms) — a longer pause between keys starts a new capture; raise it for scanners that pace slowly"}),h.jsx("input",{type:"number",min:100,max:2e3,step:50,value:o.maxKeyGapMs,onChange:w=>c({maxKeyGapMs:Number(w.target.value)}),className:"w-24 px-2 py-1 text-sm bg-surface-raised border border-surface-border rounded"})]}),h.jsxs("label",{className:"flex items-center gap-2 text-sm text-text-primary",children:[h.jsx("input",{type:"checkbox",checked:p,onChange:w=>g(w.target.checked)}),h.jsx("span",{children:"Diagnostics — trace every keydown the capture sees (also logged to the console)"})]}),p&&h.jsxs("div",{className:"border border-surface-border rounded",children:[h.jsx("div",{className:"px-2 py-1.5 text-2xs uppercase tracking-wide text-text-tertiary border-b border-surface-border",children:"Keydown trace — scan now, newest last"}),h.jsxs("div",{className:"max-h-64 overflow-y-auto font-mono text-2xs leading-5 px-2 py-1",children:[m.length===0&&h.jsx("div",{className:"text-text-tertiary",children:"Waiting for keys…"}),m.map(w=>h.jsxs("div",{className:"whitespace-nowrap overflow-hidden text-ellipsis",title:`buffer: ${w.buffer}`,children:[h.jsxs("span",{className:"text-text-tertiary",children:[String(w.deltaMs).padStart(4),"ms "]}),h.jsx("span",{className:"text",children:JSON.stringify(w.key)}),w.code&&h.jsxs("span",{className:"text-text-tertiary",children:[" (",w.code,")"]}),h.jsxs("span",{className:"text-text-tertiary",children:[" — ",w.note]})]},w.seq))]}),h.jsxs("div",{className:"px-2 py-1.5 text-2xs text-text-tertiary border-t border-surface-border",children:["Read it like this: a scan should end with an"," ",h.jsx("span",{className:"font-mono",children:'"Enter"'})," row saying"," ",h.jsx("span",{className:"font-mono",children:"capture → …"}),'. An Enter row saying "no code tail" means the buffer split (raise the gap limit, or a key arrived as something other than one character). No Enter row at all means the scanner sends no suffix — program its Enter/CR suffix. Keys named'," ",h.jsx("span",{className:"font-mono",children:'"Unidentified"'})," mean the decode arrives outside the keydown path."]})]})]})]})]})]})}const qv=/^\{lt:([A-Za-z0-9_]+)\}$/;function wM(n){return`{lt:${n}}`}const Pv="lt:station:link-vars:";function Zd(n){return`${Pv}${n}`}const em=new Set;function IN(){for(const n of em)n()}let wu,Qc={};function Bv(n){let t=null;try{t=localStorage.getItem(Zd(n))}catch{t=null}if(t===wu)return Qc;wu=t;try{const s=t?JSON.parse(t):{};Qc=s&&typeof s=="object"&&!Array.isArray(s)?Object.fromEntries(Object.entries(s).filter(([,i])=>typeof i=="string")):{}}catch{Qc={}}return Qc}function $N(n,t,s){const i={...Bv(n)};s===null||s===""?delete i[t]:i[t]=s;try{Object.keys(i).length===0?localStorage.removeItem(Zd(n)):localStorage.setItem(Zd(n),JSON.stringify(i))}catch{}wu=void 0,IN()}function HN(n){em.add(n);const t=s=>{(s.key===null||s.key.startsWith(Pv))&&(wu=void 0,n())};try{window.addEventListener("storage",t)}catch{}return()=>{em.delete(n);try{window.removeEventListener("storage",t)}catch{}}}const FN={};function GN(n){return E.useSyncExternalStore(HN,()=>n?Bv(n):FN)}function VN(n,t,s){let i;try{i=new URL(n,"http://local")}catch{return n}const o=i.searchParams.get("facets");if(!o)return n;let c;try{const p=JSON.parse(o);if(!p||typeof p!="object"||Array.isArray(p))return n;c=p}catch{return n}let m=!1;for(const[p,g]of Object.entries(c)){if(typeof g!="string")continue;const u=qv.exec(g);if(!u)continue;const d=t[u[1]]??s[u[1]];typeof d=="string"&&d!==""?c[p]=d:delete c[p],m=!0}return m?(Object.keys(c).length===0?i.searchParams.delete("facets"):i.searchParams.set("facets",JSON.stringify(c)),i.pathname+i.search):n}function SM(n){let t;try{t=new URL(n,"http://local")}catch{return[]}const s=t.searchParams.get("facets");if(!s)return[];try{const i=JSON.parse(s);if(!i||typeof i!="object"||Array.isArray(i))return[];const o=[];for(const c of Object.values(i)){if(typeof c!="string")continue;const m=qv.exec(c);m&&!o.includes(m[1])&&o.push(m[1])}return o}catch{return[]}}function $m(){const{user:n,isSuperAdmin:t,hasRoleType:s}=qt(),i=(n==null?void 0:n.userId)??null,o=t||s("admin"),c=E.useMemo(()=>new Set(((n==null?void 0:n.roles)??[]).map(x=>x.role)),[n]),{data:m}=Cu({enabled:o||c.size>0}),p=GN(i),g=E.useMemo(()=>{var w;const x=[],v=new Set;for(const S of(m==null?void 0:m.roles)??[]){if(!o&&!c.has(S.role))continue;const C=(w=S.properties)==null?void 0:w.link_variables;if(Array.isArray(C))for(const P of C){const q=P==null?void 0:P.name;if(typeof q!="string"||q===""||v.has(q))continue;v.add(q);const re=P.label,se=P.default;x.push({name:q,...typeof re=="string"&&re!==""?{label:re}:{},...typeof se=="string"&&se!==""?{default:se}:{},fromRole:S.role})}}return x},[m,c,o]),u=E.useMemo(()=>{const x={};for(const v of g)v.default!==void 0&&(x[v.name]=v.default);return x},[g]),d=E.useCallback(x=>VN(x,p,u),[p,u]),b=E.useCallback((x,v)=>{i&&$N(i,x,v)},[i]);return{declarations:g,values:p,defaults:u,resolveUrl:d,setValue:b}}function YN({open:n,onClose:t,title:s,children:i,maxWidth:o,closeOnBackdrop:c=!0}){return E.useEffect(()=>{if(!n)return;const m=p=>{p.key==="Escape"&&t()};return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[n,t]),n?rm.createPortal(h.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[h.jsx("div",{className:"absolute inset-0 bg-text-primary/30",onClick:c?t:void 0}),h.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"lt-modal-title",className:`relative bg-surface-raised border border-surface-border rounded-lg shadow-xl w-full ${o??"max-w-md"} mx-4 max-h-[85vh] flex flex-col`,children:[h.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b shrink-0",children:[h.jsx("h2",{id:"lt-modal-title",className:"text-sm font-medium text-text-primary",children:s}),h.jsx("button",{onClick:t,"aria-label":"Close dialog",className:"text-text-tertiary hover:text-text-primary text-lg leading-none",children:"×"})]}),h.jsx("div",{className:"px-6 py-5 overflow-y-auto",children:i})]})]}),document.body):null}function KN({open:n,onClose:t}){const{declarations:s,values:i,setValue:o}=$m();return h.jsxs(YN,{open:n,onClose:t,title:"Link Variables",maxWidth:"max-w-lg",children:[h.jsx("p",{className:"text-2xs text-text-tertiary leading-relaxed mb-4",children:"Values bound on this device. Pinned links and the Pace Board open scoped to the value applied; an unbound variable falls back to the role's default, or applies no filter at all."}),h.jsx("div",{className:"divide-y divide-surface-border",children:s.map((c,m)=>h.jsx(JN,{declaration:c,value:i[c.name]??"",autoFocus:m===0,onChange:p=>o(c.name,p),onClear:()=>o(c.name,null),onEnter:t},c.name))}),s.length===0&&h.jsx("p",{className:"text-xs text-text-tertiary",children:"Your roles declare no link variables."}),s.length>0&&h.jsx("div",{className:"flex justify-end pt-4",children:h.jsx("button",{onClick:t,className:"px-3 py-1.5 text-xs rounded bg-accent text-text-inverse hover:bg-accent-hover transition-colors",children:"OK"})})]})}function JN({declaration:n,value:t,autoFocus:s,onChange:i,onClear:o,onEnter:c}){const m=E.useId(),{data:p}=ek(n.name),g=(p==null?void 0:p.values)??[];return h.jsxs("div",{className:"py-3 flex items-center gap-3","data-testid":"link-var-row",children:[h.jsxs("div",{className:"w-40 shrink-0 min-w-0",children:[h.jsx("p",{className:"text-xs font-mono text-text-primary truncate",title:n.name,children:n.name}),h.jsx("p",{className:"text-2xs text-text-quaternary truncate",title:`declared by ${n.fromRole}`,children:n.label??n.fromRole})]}),h.jsx("input",{type:"text",list:m,autoFocus:s,value:t,onChange:u=>i(u.target.value),onKeyDown:u=>{u.key==="Enter"&&c()},placeholder:n.default?`${n.default} (default)`:"no filter","aria-label":`Value for ${n.name}`,className:"input text-xs font-mono flex-1 min-w-0"}),h.jsx("datalist",{id:m,children:g.map(u=>h.jsx("option",{value:u},u))}),h.jsx("button",{onClick:o,disabled:t==="",title:`Clear ${n.name}`,className:"p-1 text-text-quaternary hover:text-status-error transition-colors disabled:opacity-30 disabled:cursor-not-allowed shrink-0",children:"×"})]})}const z1=["escalationId","workflowId"],QN=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,Uv="lt:search:mode",XN="lt:search:facet",Lt={FACET:"facet",COMMAND:"command"};function WN(n,t){return{version:n.version,category:t.category,name:t.name,schemeName:n.name,targetFacet:n.target_facet,encoding:n.encoding,delimiter:n.delimiter,targetLength:n.target_length}}function Co(n){return n.encoding==="delimited"?`${n.version}${n.delimiter}${n.category}${n.delimiter}`:`${n.version}${n.category}`}function ZN(n,t){if(n.encoding==="delimited")return eT(n,t)?{code:t}:{code:`${Co(n)}${t}`};if(!/^[0-9]+$/.test(t))return{error:`${n.name} takes digits only`};const s=n.targetLength;return s&&t.length!==s&&t.length!==s+1?{error:`${n.name} takes ${s} digits`}:{code:`${Co(n)}${t}`}}function eT(n,t){const s=n.delimiter.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`^[1-9][0-9]${s}[0-9]${s}.+$`).test(t)}function tT(n,t){return n==="escalationId"||n==="workflowId"?null:$k(n,t)}function nT(n){return n.kind===Lt.FACET?n.facet:n.command.name}function rT(n){return n.kind===Lt.COMMAND?n.command.targetFacet:n.facet==="escalationId"?"Escalation id":n.facet==="workflowId"?"Workflow id":n.facet}function sT(n){return n.kind===Lt.FACET?{kind:Lt.FACET,facet:n.facet}:{kind:Lt.COMMAND,version:n.command.version,category:n.command.category}}function iT(n,t,s){if((n==null?void 0:n.kind)===Lt.FACET&&t.includes(n.facet))return{kind:Lt.FACET,facet:n.facet};if((n==null?void 0:n.kind)===Lt.COMMAND){const i=s.find(o=>o.version===n.version&&o.category===n.category);if(i)return{kind:Lt.COMMAND,command:i}}return t.length>0?{kind:Lt.FACET,facet:t[0]}:s.length>0?{kind:Lt.COMMAND,command:s[0]}:null}function aT(){try{const n=localStorage.getItem(Uv);if(n){const s=JSON.parse(n);if(s.kind===Lt.FACET&&typeof s.facet=="string"||s.kind===Lt.COMMAND&&typeof s.version=="number"&&typeof s.category=="string")return s}const t=localStorage.getItem(XN);return t?{kind:Lt.FACET,facet:t}:null}catch{return null}}function oT(n){try{localStorage.setItem(Uv,JSON.stringify(n))}catch{}}const I1=5*6e4,lT=n=>({rules:n.map(t=>{var s;return((s=t.data)==null?void 0:s.rules)??null}),loading:n.some(t=>t.isLoading)});function cT(n){const t=Ov({enabled:n,staleTime:I1}),s=E.useMemo(()=>{var m;return(((m=t.data)==null?void 0:m.schemes)??[]).filter(p=>p.enabled&&p.kind===Lk.ACTION).sort((p,g)=>p.version-g.version)},[t.data]),{rules:i,loading:o}=cS({queries:s.map(m=>({queryKey:["scan-schemes",m.version,"actions"],queryFn:()=>ue(`/scan-codes/schemes/${m.version}/actions`),enabled:n,staleTime:I1})),combine:lT});return{commands:E.useMemo(()=>s.flatMap((m,p)=>(i[p]??[]).filter(g=>g.enabled).sort((g,u)=>g.category.localeCompare(u.category)).map(g=>WN(m,g))),[s,i]),loading:t.isLoading||o}}const uT={escalationId:"opens the item",workflowId:"opens the run"};function fT({mode:n,facets:t,commands:s,onSelect:i,onOpenScanPanel:o}){const[c,m]=E.useState(!1),p=E.useRef(null);E.useEffect(()=>{if(!c)return;const x=w=>{p.current&&!p.current.contains(w.target)&&m(!1)},v=w=>{w.key==="Escape"&&m(!1)};return document.addEventListener("mousedown",x),document.addEventListener("keydown",v),()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",v)}},[c]);const g=n.kind===Lt.COMMAND,u=g?`${n.command.schemeName} · ${n.command.name} — ${Co(n.command)}<${n.command.targetFacet}>`:`Search by ${n.facet}`,d=hT(s),b=x=>{i(x),m(!1)};return h.jsxs("div",{ref:p,className:"relative h-full shrink-0",children:[h.jsxs("button",{type:"button",onClick:()=>m(x=>!x),"aria-expanded":c,"aria-haspopup":"listbox","aria-label":"Search or run as",title:u,className:"group flex items-center gap-1 h-full pl-2.5 pr-2 border-l border-surface-field-border hover:bg-surface-hover transition-colors rounded-r-[var(--lt-radius-field)]","data-testid":"search-mode",children:[h.jsx("span",{className:`text-2xs whitespace-nowrap truncate max-w-[9rem] ${g?"font-medium text-accent":"font-mono text-text-tertiary"}`,children:nT(n)}),h.jsx(sm,{className:`w-3 h-3 shrink-0 text-text-quaternary group-hover:text-accent transition-transform ${c?"rotate-180":""}`,strokeWidth:1.5})]}),c&&h.jsxs("div",{role:"listbox","aria-label":"Search or run as",className:"absolute z-50 top-full right-0 mt-1.5 min-w-[17rem] max-w-[24rem] max-h-[70vh] overflow-y-auto bg-surface-raised border border-surface-border rounded-md shadow-lg py-1",children:[t.length>0&&h.jsxs(h.Fragment,{children:[h.jsx($1,{children:"Find"}),t.map(x=>h.jsx(H1,{label:x,mono:!0,note:uT[x]??"filters the list",active:!g&&n.facet===x,onClick:()=>b({kind:Lt.FACET,facet:x})},x))]}),d.map(({schemeName:x,targetFacet:v,items:w})=>h.jsxs("div",{children:[h.jsxs($1,{note:v,children:["Run · ",x]}),w.map(S=>h.jsx(H1,{label:S.name,note:Co(S),noteMono:!0,active:g&&n.command.version===S.version&&n.command.category===S.category,onClick:()=>b({kind:Lt.COMMAND,command:S})},`${S.version}:${S.category}`))]},x)),o&&h.jsxs(h.Fragment,{children:[h.jsx("hr",{className:"border-surface-border/60 my-1"}),h.jsxs("button",{type:"button",onClick:()=>{m(!1),o()},className:"w-full text-left px-3 py-1.5 flex items-center gap-2 text-xs text-accent hover:bg-surface-hover","data-testid":"search-mode-scan-panel",children:[h.jsx(Mo,{className:"w-3.5 h-3.5 shrink-0",strokeWidth:1.5}),"Scanner settings and barcode preview"]})]})]})]})}function hT(n){const t=[];for(const s of n){const i=t.find(o=>o.schemeName===s.schemeName);i?i.items.push(s):t.push({schemeName:s.schemeName,targetFacet:s.targetFacet,items:[s]})}return t}function $1({children:n,note:t}){return h.jsxs("p",{className:"px-3 pt-2 pb-1 flex items-baseline gap-2 text-2xs font-semibold uppercase tracking-widest text-text-quaternary first:pt-1",children:[h.jsx("span",{className:"truncate",children:n}),t&&h.jsx("span",{className:"ml-auto font-mono font-normal normal-case tracking-normal shrink-0",children:t})]})}function H1({label:n,note:t,active:s,mono:i,noteMono:o,onClick:c}){return h.jsxs("button",{type:"button",role:"option","aria-selected":s,onClick:c,className:`w-full text-left pl-3 pr-3 py-1.5 flex items-baseline gap-3 border-l-2 transition-colors ${s?"border-accent bg-accent/10 text-accent":"border-transparent text-text-primary hover:bg-surface-hover"}`,children:[h.jsx("span",{className:`text-xs font-medium truncate ${i?"font-mono":""}`,children:n}),h.jsx("span",{className:`ml-auto text-2xs shrink-0 ${o?"font-mono tabular-nums":""} ${s?"text-accent/70":"text-text-quaternary"}`,children:t})]})}const dT=6e3;function mT({onOpenScanPanel:n}){const t=ni(),{data:s}=er(),i=Bm(),{submitCode:o,busy:c,lastResult:m}=zm(),{commands:p}=cT(i),[g,u]=E.useState(""),[d,b]=E.useState(!1),[x,v]=E.useState(null),[w,S]=E.useState(null),[C,P]=E.useState(""),[q,re]=E.useState(null),[se,M]=E.useState(aT),U=E.useRef(null),ae=E.useMemo(()=>{var le;if(!((le=s==null?void 0:s.search)!=null&&le.enabled))return[];const J=(s.search.facets??[]).filter(pe=>!z1.includes(pe));return[...z1,...J]},[s]),z=E.useMemo(()=>iT(se,ae,p),[se,ae,p]),I=(m==null?void 0:m.source)===To.TOOLBAR&&!m.navigated&&q!==m.at?m:null;E.useEffect(()=>{if(!I)return;const J=setTimeout(()=>re(I.at),dT);return()=>clearTimeout(J)},[I]);const D=()=>{v(null),S(null),m&&re(m.at)},X=J=>{var pe;const le=sT(J);M(le),oT(le),D(),(pe=U.current)==null||pe.focus()},W=(J,le)=>{const pe=ZN(J.command,Lv(le));if("error"in pe){v(pe.error);return}u(""),o(pe.code,To.TOOLBAR)},he=async(J,le)=>{const pe=tT(J,le);if(pe){u(""),t(pe);return}if(J==="escalationId"&&!QN.test(le)){v("That is not a valid escalation id");return}b(!0);try{if(J==="escalationId")await ue(`/escalations/${encodeURIComponent(le)}`),u(""),t(`/escalations/detail/${encodeURIComponent(le)}`);else{const ye=await ue(`/escalations/by-workflow/${encodeURIComponent(le)}`),Ce=(ye==null?void 0:ye.escalations)??[];Ce.length===1?(u(""),t(`/escalations/detail/${Ce[0].id}`)):(P(le),S(Ce))}}catch{v(`No ${J==="escalationId"?"escalation":"workflow"} found for "${le}"`)}finally{b(!1)}},we=()=>{const J=g.trim();!J||d||c||!z||(D(),z.kind===Lt.COMMAND?W(z,J):he(z.facet,J))};if(!z)return null;const Oe=z.kind===Lt.COMMAND,F=d||c;return h.jsxs("div",{className:"relative w-full max-w-[28rem]","data-testid":"global-search",children:[h.jsxs("div",{className:"flex items-center h-8 bg-surface-field border border-surface-field-border rounded-[var(--lt-radius-field)] focus-within:border-accent focus-within:bg-surface-field-focus transition-colors",children:[h.jsxs("label",{htmlFor:"global-search-input",className:"flex items-center gap-1.5 pl-2.5 shrink-0 cursor-text",children:[Oe?h.jsx(Mo,{className:"w-3.5 h-3.5 text-accent/65",strokeWidth:1.5}):h.jsx(bS,{className:"w-3.5 h-3.5 text-text-quaternary",strokeWidth:1.5}),Oe&&h.jsx("span",{className:"font-mono text-xs tabular-nums text-text-tertiary select-none","data-testid":"search-command-prefix",children:Co(z.command)})]}),h.jsx("input",{ref:U,id:"global-search-input",type:"text",value:g,onChange:J=>{u(J.target.value),D()},onKeyDown:J=>{J.key==="Enter"&&we(),J.key==="Escape"&&(u(""),D())},placeholder:rT(z),"aria-label":Oe?"Run target":"Global search",autoComplete:"off",spellCheck:!1,className:`flex-1 min-w-0 h-full bg-transparent text-xs text-text-primary placeholder:text-text-quaternary focus:outline-none ${Oe?"pl-0.5 pr-2 font-mono":"px-2"}`}),F&&h.jsx("span",{className:"w-1.5 h-1.5 mr-2 rounded-full bg-accent animate-pulse shrink-0","aria-label":"Working"}),h.jsx(fT,{mode:z,facets:ae,commands:p,onSelect:X,onOpenScanPanel:n})]}),x&&h.jsx("p",{className:"absolute top-full left-0 mt-1 text-2xs text-status-error whitespace-nowrap",role:"alert",children:x}),I&&h.jsx("div",{role:"status",className:"absolute top-full left-0 mt-1.5 z-50 w-full max-w-96 bg-surface-raised border border-surface-border rounded-md shadow-lg px-3 py-2 animate-fade-in","data-testid":"search-run-outcome",children:h.jsx(Im,{result:I,compact:!0})}),w!==null&&h.jsxs("div",{className:"absolute top-full left-0 mt-1.5 z-50 min-w-72 max-w-96 bg-surface-raised border border-surface-border rounded-md shadow-lg py-1","data-testid":"search-workflow-results",children:[w.map(J=>h.jsxs(ar,{to:`/escalations/detail/${J.id}`,onClick:()=>{S(null),u("")},className:"block px-3 py-1.5 text-xs text-text-secondary hover:bg-surface-hover truncate",children:[h.jsx("span",{className:"font-medium text-text-primary",children:J.role}),h.jsx("span",{className:"mx-1.5 text-text-quaternary",children:"·"}),J.status,h.jsx("span",{className:"mx-1.5 text-text-quaternary",children:"·"}),h.jsx("span",{className:"text-text-tertiary",children:J.type})]},J.id)),w.length===0&&h.jsx("p",{className:"px-3 py-1.5 text-2xs text-text-tertiary",children:"No escalations for this workflow."}),h.jsx("hr",{className:"border-surface-border/60 my-0.5"}),h.jsx(ar,{to:`/workflows/executions/${encodeURIComponent(C)}`,onClick:()=>{S(null),u("")},className:"block px-3 py-1.5 text-xs text-accent hover:bg-surface-hover",children:"Workflow execution →"})]})]})}function pT(n){return n.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").split(/[-_\s]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function tm(n){var t;return((t=n.title)==null?void 0:t.trim())||pT(n.role)}const zv="lt:bookmarks",Xc="scan";function yT(){try{const n=localStorage.getItem(zv);if(!n)return[];const t=JSON.parse(n);return Array.isArray(t)?t:[]}catch{return[]}}function F1(n){try{localStorage.setItem(zv,JSON.stringify(n))}catch{}}function gT({onToggleEventFeed:n,onToggleDocs:t,onToggleNav:s}){var Ue,Xe,cn,Mt;const i=ni(),{user:o,logout:c,isSuperAdmin:m,hasRoleType:p}=qt(),{viewAs:g,realIsBuilder:u}=Wx(),{available:d,mine:b}=ik();Zx();const{connected:x}=Rx(),{data:v}=er(),{role:w,targets:S,selectable:C,selectRole:P}=Nm(),{declarations:q,values:re}=$m(),[se,M]=E.useState(!1),{data:U}=Cu(),ae=E.useMemo(()=>{const be=(U==null?void 0:U.roles)??[],it=new Set(((o==null?void 0:o.roles)??[]).map(Ot=>Ot.role)),yt=m||p("admin");return be.filter(Ot=>ea(Ot).length>0&&(yt||it.has(Ot.role))).map(Ot=>({role:Ot.role,title:tm(Ot),portals:ea(Ot)}))},[U,o,m,p]),{setPanel:z,closePanel:I,open:D,ownerKey:X}=Rm(),W=Bm(),he=en(),we=()=>{D&&X===Xc?I(Xc):z(h.jsx(zN,{onClose:()=>I(Xc)}),{width:360,key:Xc})},[Oe,F]=E.useState(!1),[J,le]=E.useState(!1),[pe,ye]=E.useState(_v),[Ce,Ne]=E.useState(yT),Me=E.useRef(null),We=(Ue=v==null?void 0:v.branding)==null?void 0:Ue.appName,pt=(Xe=v==null?void 0:v.branding)==null?void 0:Xe.themes,Ct=E.useMemo(()=>(_k(pt??[]),wk()),[pt]),Se=be=>{Sk(be),ye(be)},Re=()=>{const be=window.prompt("Bookmark label:");if(!(be!=null&&be.trim()))return;const it=he.pathname+he.search,yt=[...Ce,{label:be.trim(),url:it}].sort((Ot,Ur)=>Ot.label.localeCompare(Ur.label));Ne(yt),F1(yt),F(!1)},ce=be=>{const it=Ce.filter(yt=>!(yt.label===be.label&&yt.url===be.url));Ne(it),F1(it)};return E.useEffect(()=>{if(!Oe)return;const be=it=>{Me.current&&!Me.current.contains(it.target)&&F(!1)};return document.addEventListener("mousedown",be),()=>document.removeEventListener("mousedown",be)},[Oe]),h.jsxs(h.Fragment,{children:[h.jsxs("header",{className:`h-14 shrink-0 border-b border-surface-border bg-surface-raised flex items-center justify-between pl-2 pr-5 relative ${Oe?"z-[100]":"z-30"}`,children:[h.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[s&&h.jsx("button",{onClick:s,className:"lg:hidden p-2 text-text-secondary hover:text-text-primary transition-colors","aria-label":"Open navigation",children:h.jsx(xS,{className:"w-5 h-5",strokeWidth:1.5})}),h.jsx(ar,{to:"/","aria-label":"Home",className:"shrink-0 hidden lg:block",onClick:be=>{(be.ctrlKey||be.metaKey)&&(be.preventDefault(),le(!0))},children:h.jsx(Mu,{appName:We,className:"flex"})}),h.jsx("div",{className:"hidden lg:block w-px h-4 bg-surface-border mx-1"}),h.jsx("button",{onClick:()=>i(-1),className:"p-2 text-accent/60 hover:text-accent transition-colors","aria-label":"Go back",children:h.jsx(ax,{className:"w-5 h-5",strokeWidth:2})}),h.jsx("button",{onClick:()=>i(1),className:"p-2 text-accent/60 hover:text-accent transition-colors","aria-label":"Go forward",children:h.jsx(yd,{className:"w-5 h-5",strokeWidth:2})})]}),(((cn=v==null?void 0:v.search)==null?void 0:cn.enabled)||W)&&h.jsx("div",{className:"hidden md:flex flex-1 min-w-0 justify-center px-4 lg:px-8",children:h.jsx(mT,{onOpenScanPanel:W?we:void 0})}),h.jsxs("div",{className:"flex items-center gap-5 shrink-0",children:[h.jsxs(ar,{to:"/escalations/available",className:`flex items-center gap-1.5 text-xs transition-colors ${d>0?"text-status-queued":"text-text-quaternary hover:text-text-secondary"}`,title:"All escalations",children:[h.jsx(gd,{className:"w-4 h-4",strokeWidth:1.5}),h.jsx("span",{className:"hidden lg:inline",children:"all"}),d>0&&h.jsx("sup",{className:"tabular-nums font-medium text-[0.5em]",children:d})]}),h.jsxs(ar,{to:"/escalations/queue",className:`flex items-center gap-1.5 text-xs transition-colors ${b>0?"text-status-claimed":"text-text-quaternary hover:text-text-secondary"}`,title:"My escalation queue",children:[h.jsx(gd,{className:"w-4 h-4",strokeWidth:1.5}),h.jsx("span",{className:"hidden lg:inline",children:"mine"}),b>0&&h.jsx("sup",{className:"tabular-nums font-medium text-[0.5em]",children:b})]}),g&&h.jsx(h.Fragment,{children:h.jsxs("span",{className:"hidden lg:flex items-center gap-1 pl-2 pr-1 py-0.5 rounded-full bg-accent/10 border border-accent/25 text-2xs text-accent select-none",children:[h.jsxs("span",{className:"capitalize font-medium tracking-wide",children:[g," View"]}),h.jsx("button",{onClick:Gd,title:"Restore your real view",className:"ml-0.5 rounded-full p-0.5 hover:bg-accent/20 transition-colors",children:h.jsx(Zt,{className:"w-2.5 h-2.5"})})]})}),h.jsx("div",{className:"hidden lg:block w-px h-4 bg-surface-border"}),o&&h.jsxs("div",{className:"relative",ref:Me,children:[h.jsxs("button",{onClick:()=>F(be=>!be),className:"btn-ghost flex items-center gap-1",children:[h.jsxs("span",{className:"relative",children:[h.jsx(vS,{className:"w-4 h-4 text-accent/75",strokeWidth:1.5}),g&&h.jsx("span",{className:"lg:hidden absolute -top-0.5 -right-0.5 w-2 h-2 rounded-full bg-accent"})]}),h.jsx("span",{className:"hidden lg:inline whitespace-nowrap",children:o.displayName||o.username||o.userId}),h.jsx("svg",{className:"hidden lg:block w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),Oe&&h.jsxs("div",{className:"absolute right-0 top-full mt-1 w-52 bg-surface-raised border border-surface-border rounded-md shadow-lg py-1 z-[100]",children:[h.jsx(ar,{to:"/credentials",onClick:()=>F(!1),className:"block px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Credentials"}),((Mt=v==null?void 0:v.auth)==null?void 0:Mt.oauthServer)&&h.jsx(ar,{to:"/connected-apps",onClick:()=>F(!1),className:"block px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Connected apps"}),W&&h.jsx("button",{onClick:()=>{F(!1),we()},className:"block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover","data-testid":"menu-scan",children:"Scan a code"}),h.jsx("button",{onClick:()=>{F(!1),x?n==null||n():window.location.reload()},className:"lg:hidden block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:x?"Events":"Reconnect events"}),u&&h.jsx("button",{onClick:()=>{F(!1),t==null||t()},className:"block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover","data-testid":"menu-docs",children:"Docs"}),g&&h.jsxs("button",{onClick:()=>{F(!1),Gd()},className:"lg:hidden block w-full text-left px-3 py-2 text-xs text-accent hover:bg-surface-hover capitalize",children:["Exit ",g," view"]}),h.jsxs("div",{className:"px-3 py-2 border-t border-surface-border/60",children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-1.5",children:"Theme"}),h.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:Ct.map(be=>h.jsx("button",{type:"button",onClick:()=>Se(be.id),title:be.label,"aria-label":`${be.label} theme`,className:`w-4 h-4 rounded-full transition-transform hover:scale-110 ${pe===be.id?"ring-2 ring-offset-1 ring-surface-border":""}`,style:{backgroundColor:be.swatch}},be.id))})]}),C&&h.jsxs("div",{className:"px-3 py-2 border-t border-surface-border/60",children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-1.5",children:"Station queue"}),h.jsxs("div",{className:"flex flex-col",children:[h.jsxs("button",{type:"button",onClick:()=>{F(!1),P(null),i("/")},className:`flex items-center gap-2 -mx-1 px-1 py-1 text-xs text-left rounded hover:bg-surface-hover ${w?"text-text-secondary":"text-accent"}`,children:[h.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${w?"bg-surface-border":"bg-accent"}`}),h.jsx("span",{className:"truncate",children:"Full dashboard"})]}),S.map(be=>{var Ot;const it=(Ot=U==null?void 0:U.roles)==null?void 0:Ot.find(Ur=>Ur.role===be),yt=be===w;return h.jsxs("button",{type:"button",onClick:()=>{F(!1),P(be),i(uv(be,ea(it)))},className:`flex items-center gap-2 -mx-1 px-1 py-1 text-xs text-left rounded hover:bg-surface-hover ${yt?"text-accent":"text-text-secondary"}`,children:[h.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${yt?"bg-accent":"bg-surface-border"}`}),h.jsx("span",{className:"truncate",children:tm({role:be,title:it==null?void 0:it.title})})]},be)})]})]}),ae.length>0&&h.jsxs("div",{className:"px-3 py-2 border-t border-surface-border/60","data-testid":"menu-portals",children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-1.5",children:"Portals"}),h.jsx("div",{className:"flex flex-col gap-1.5",children:ae.map(be=>h.jsxs("div",{children:[ae.length>1&&h.jsx("p",{className:"text-2xs text-text-quaternary truncate",title:be.role,children:be.title}),be.portals.map(it=>{const yt=km(be.role,it.key),Ot=he.pathname===yt;return h.jsxs("button",{type:"button",onClick:()=>{F(!1),i(yt)},className:`flex items-center gap-2 -mx-1 px-1 py-1 w-full text-xs text-left rounded hover:bg-surface-hover ${Ot?"text-accent":"text-text-secondary"}`,"data-testid":`menu-portal-${be.role}-${it.key}`,children:[h.jsx(bd,{className:"w-3.5 h-3.5 shrink-0 text-accent/75",strokeWidth:1.5}),h.jsx("span",{className:"truncate",children:it.label})]},it.key)})]},be.role))})]}),q.length>0&&h.jsxs("div",{className:"px-3 py-2 border-t border-surface-border/60",children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-1.5",children:"Link variables"}),h.jsxs("button",{type:"button",onClick:()=>{F(!1),M(!0)},className:"flex items-center gap-2 -mx-1 px-1 py-1 w-full text-xs text-left rounded text-text-secondary hover:bg-surface-hover","data-testid":"link-vars-menu-entry",children:[h.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${Object.keys(re).length>0?"bg-accent":"bg-surface-border"}`}),h.jsx("span",{className:"truncate",children:Object.keys(re).length>0?Object.entries(re).map(([be,it])=>`${be} = ${it}`).join(", "):"Set values for this device"})]})]}),h.jsx("button",{onClick:()=>{F(!1),c()},className:"block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Sign Out"}),h.jsxs("div",{className:"border-t border-surface-border/60 pt-1",children:[Ce.map(be=>h.jsxs("div",{className:"flex items-center group px-3 py-1.5 hover:bg-surface-hover",children:[h.jsx(ar,{to:be.url,onClick:()=>F(!1),title:be.url,className:"flex-1 min-w-0 text-xs text-text-secondary hover:text-text-primary truncate",children:be.label}),h.jsx("button",{type:"button",onClick:()=>ce(be),title:`Remove "${be.label}"`,className:"opacity-0 group-hover:opacity-100 transition-opacity ml-1 p-0.5 shrink-0 text-text-quaternary hover:text-status-error",children:h.jsx(Zt,{className:"w-3 h-3"})})]},`${be.label}::${be.url}`)),h.jsx("hr",{className:"border-surface-border/60 mx-3 my-0.5"}),h.jsxs("button",{type:"button",onClick:Re,className:"flex items-center gap-1.5 w-full px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:[h.jsx(_S,{className:"w-3.5 h-3.5 shrink-0",strokeWidth:1.5}),"Add Bookmark"]})]})]})]})]})]}),J&&h.jsx(vk,{onClose:()=>le(!1)}),h.jsx(KN,{open:se,onClose:()=>M(!1)})]})}function Hm({open:n,children:t}){const[s,i]=E.useState(n);return E.useEffect(()=>{n&&i(!0)},[n]),h.jsx("div",{className:`grid transition-[grid-template-rows] duration-300 ease-out ${n?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,onTransitionEnd:()=>{n||i(!1)},children:h.jsx("div",{className:"overflow-hidden",children:s?t:null})})}function nm(n){return({isActive:t})=>{const s="flex items-center rounded-md transition-colors duration-150",i="bg-surface-hover text-text-primary font-medium",o="text-text-secondary hover:text-text-primary hover:bg-surface-hover";return n?`${s} justify-center w-10 h-10 mx-auto ${t?i:o}`:`${s} gap-3 px-4 py-2 text-sm ${t?i:o}`}}function bT(){return({isActive:n})=>`flex items-center gap-3 pl-11 pr-4 py-1.5 text-xs rounded-md transition-colors duration-150 ${n?"text-text-primary font-medium":"text-text-secondary hover:text-text-primary"}`}function xT({group:n,collapsed:t}){const{pathname:s}=en(),i=n.matchPaths.some(p=>s.startsWith(p)),[o,c]=E.useState(i),m=o||i;return t?h.jsx(h.Fragment,{children:n.items.map(p=>h.jsx(Es,{to:p.to,className:nm(!0),title:p.label,children:p.icon&&h.jsx(p.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})},p.to))}):h.jsxs("div",{children:[h.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:[h.jsxs("span",{className:"flex items-center gap-3",children:[n.icon&&h.jsx(n.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),h.jsx("span",{children:n.label})]}),h.jsx("svg",{className:`w-3.5 h-3.5 text-text-tertiary transition-transform duration-150 ${m?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),h.jsx(Hm,{open:m,children:n.items.map(p=>h.jsxs(Es,{to:p.to,end:p.end,className:bT(),children:[p.icon&&h.jsx(p.icon,{className:"w-4 h-4 shrink-0 text-accent/75",strokeWidth:1.5}),h.jsx("span",{children:p.label})]},p.to))})]})}function vT(n){return n.kind==="group"}function _T({entry:n,collapsed:t}){const{pathname:s,search:i}=en(),o=n.to.includes("?"),c=n.icon&&h.jsx(n.icon,{className:`w-5 h-5 shrink-0 text-accent/75 ${n.iconClassName??""}`,strokeWidth:1.5,...n.solid?{fill:"currentColor"}:{}});if(o){const[m,p]=n.to.split("?"),g=s===m&&i===`?${p}`,u=nm(t)({isActive:g});return h.jsxs(Es,{to:n.to,className:u,title:t?n.label:void 0,children:[c,!t&&h.jsx("span",{children:n.label})]})}return h.jsxs(Es,{to:n.to,end:n.end,className:nm(t),title:t?n.label:void 0,children:[c,!t&&h.jsx("span",{children:n.label})]})}function qr({heading:n,entries:t}){const{collapsed:s}=Cm();return h.jsxs("div",{className:"space-y-1",children:[s?h.jsx("div",{className:"h-px bg-surface-border mx-3 my-2",title:n}):h.jsx("p",{className:"px-4 pt-5 pb-2 text-xs font-semibold uppercase tracking-wider text-text-tertiary",children:n}),t.map(i=>vT(i)?h.jsx(xT,{group:i,collapsed:s},i.label):h.jsx(_T,{entry:i,collapsed:s},i.to))]})}function wT({aiEnabled:n=!1,isBuilder:t=!1,isOps:s=!1,viewAs:i=null,canSeePaceBoard:o=!1}){const c=[{to:"/pace",label:"Pace Board",icon:wS},{to:"/trends",label:"Trend Board",icon:SS}];if(!t&&(!s||i==="engineer"||i==="operator"))return o?h.jsx(qr,{heading:"Monitor",entries:c}):null;if(!t)return h.jsx(qr,{heading:"Monitor",entries:o?c:[]});const m=[...o?c:[],{to:"/topics",label:"Event Topics",icon:ox},{to:"/agents",label:n?"Agents":"Automations",icon:ES},{to:"/capabilities",label:"Capabilities",icon:OS}];return h.jsx(qr,{heading:"Monitor",entries:m})}function ST(){return qe({queryKey:["me","preferences"],queryFn:()=>ue("/me/preferences"),staleTime:6e4})}function ET(){const n=Be();return Fe({mutationFn:t=>ue("/me/preferences",{method:"PATCH",body:JSON.stringify(t)}),onSuccess:t=>{n.setQueryData(["me","preferences"],t)}})}const xs={TABLE:"table",RICH:"rich",TIMELINE:"timeline"},G1={COMPACT:"compact",CARDS:"cards"},hd={AVAILABLE:"/escalations/available",ALL:"/escalations"},ta={AVAILABLE:"available",CLAIMED:"claimed",RESOLVED:"resolved",CANCELLED:"cancelled",EXPIRED:"expired"},OT={[ta.RESOLVED]:"resolved",[ta.CANCELLED]:"cancelled",[ta.EXPIRED]:"expired"};function AT(n){const t=n===ta.CLAIMED;return{available:n===ta.AVAILABLE,claimed:t,apiStatus:t?"pending":OT[n]}}function jT(n){return n===xs.TABLE||n===xs.RICH||n===xs.TIMELINE}function kT(n){return n===G1.COMPACT||n===G1.CARDS}function NT(n,t=""){const s=n.get("priority"),i=n.get("view"),o=n.get("layout");return{statusFilter:n.get("status")||t,role:n.get("role")||void 0,type:n.get("type")||void 0,subtype:n.get("subtype")||void 0,priority:s?parseInt(s,10):void 0,search:n.get("search")||void 0,facets:Ik(n),view:jT(i)?i:null,layout:kT(o)?o:null}}function TT(n){let t;try{t=new URL(n,"http://local")}catch{return null}if(t.pathname!==hd.AVAILABLE&&t.pathname!==hd.ALL)return null;const s=t.pathname===hd.AVAILABLE?ta.AVAILABLE:"";return NT(t.searchParams,s)}function EM(n){var t;return n.role||(((t=n.facets.roles)==null?void 0:t.length)===1?n.facets.roles[0]:null)}function OM(n,t){return n===xs.TIMELINE?xs.TIMELINE:t&&(!n||n===xs.RICH)?xs.RICH:xs.TABLE}function CT(n,t){const s=(n==null?void 0:n.pinnedViews)??[],i=new Set((n==null?void 0:n.hiddenRolePins)??[]),o=new Set(s.map(p=>p.label)),c=[...s],m=new Set;for(const{role:p,pins:g}of t)for(const u of g)o.has(u.label)||i.has(u.label)||m.has(u.label)||(m.add(u.label),c.push({...u,id:`role:${p}:${u.label}`,fromRole:p}));return c}function MT(n){const t=TT(n);if(!t)return null;const{available:s,claimed:i,apiStatus:o}=AT(t.statusFilter);return{available:s,params:{...t.facets,role:t.role,type:t.type,subtype:t.subtype,priority:t.priority,status:o,...i?{claimed:!0}:{},search:t.search}}}function RT(){return`pin-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function DT(){var I;const{collapsed:n}=Cm(),{user:t}=qt(),s=ST(),i=ET(),o=E.useMemo(()=>new Set(((t==null?void 0:t.roles)??[]).map(D=>D.role)),[t]),{data:c}=Cu({enabled:o.size>0}),m=tn("SUMMARY");js(Om(),()=>{m([["escalations"]])});const p=(I=s.data)==null?void 0:I.preferences,g=E.useMemo(()=>((c==null?void 0:c.roles)??[]).filter(D=>o.has(D.role)&&Array.isArray(D.default_pins)&&D.default_pins.length>0).map(D=>({role:D.role,pins:D.default_pins})),[c,o]),{resolveUrl:u}=$m(),d=E.useMemo(()=>CT(p,g),[p,g]),b=E.useMemo(()=>new Map(d.map(D=>[D.id,D.url])),[d]),x=E.useMemo(()=>d.map(D=>({...D,url:u(D.url)})),[d,u]),v=E.useMemo(()=>new Map(((c==null?void 0:c.roles)??[]).map(D=>[D.role,tm(D)])),[c]),w=E.useMemo(()=>x.filter(D=>!D.fromRole),[x]),S=E.useMemo(()=>new Set(((c==null?void 0:c.roles)??[]).filter(D=>o.has(D.role)&&Gj(D)).map(D=>D.role)),[c,o]),C=E.useMemo(()=>((c==null?void 0:c.roles)??[]).filter(D=>S.has(D.role)||g.some(X=>X.role===D.role)).map(D=>({role:D.role,title:v.get(D.role)??D.role,portals:S.has(D.role)?ea(D):[],pins:x.filter(X=>X.fromRole===D.role)})).filter(D=>D.portals.length>0||D.pins.length>0),[c,g,S,v,x]),P=(p==null?void 0:p.pinnedViews)??[],q=E.useRef(null),re=D=>i.mutate({pinnedViews:D}),se=D=>re(P.filter(X=>X.id!==D)),M=D=>re([...P,{id:RT(),label:D.label,url:b.get(D.id)??D.url,badge:D.badge}]),U=D=>i.mutate({hiddenRolePins:[...(p==null?void 0:p.hiddenRolePins)??[],D]}),ae=(D,X)=>{if(D===X)return;const W=[...P],[he]=W.splice(D,1);W.splice(X,0,he),re(W)};if(x.length===0&&S.size===0)return null;const z="px-4 pt-5 pb-2 text-xs font-semibold uppercase tracking-wider text-text-tertiary truncate";return h.jsxs("div",{className:"space-y-1",children:[n&&h.jsx("div",{className:"h-px bg-surface-border mx-3 my-2",title:"Pinned"}),!n&&w.length>0&&h.jsx("p",{className:z,children:"Pinned"}),w.map(D=>{const X=P.findIndex(W=>W.id===D.id);return h.jsx(V1,{pin:D,collapsed:n,draggable:X!==-1,onDragStart:()=>{q.current=X},onDropOn:()=>{q.current!==null&&X!==-1&&ae(q.current,X),q.current=null},onRemove:()=>se(D.id)},D.id)}),C.map(D=>h.jsxs("div",{children:[!n&&h.jsx("p",{className:z,title:`${D.title} — pins from the ${D.role} role`,"data-testid":"pin-group-label",children:D.title}),D.portals.map(X=>h.jsx(LT,{role:D.role,portal:X,collapsed:n},X.key)),D.pins.map(X=>h.jsx(V1,{pin:X,collapsed:n,draggable:!1,onDragStart:()=>{},onDropOn:()=>{},onPromote:()=>M(X),onHide:()=>U(X.label)},X.id))]},D.role))]})}function LT({role:n,portal:t,collapsed:s}){const i=km(n,t.key),o="flex items-center rounded-md transition-colors duration-150 text-text-secondary hover:text-text-primary hover:bg-surface-hover",c=`portal-link-${n}-${t.key}`;return s?h.jsx(Es,{to:i,className:`${o} justify-center w-10 h-10 mx-auto`,title:t.label,"data-testid":c,children:h.jsx(bd,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})}):h.jsxs(Es,{to:i,title:t.label,className:({isActive:m})=>`${o} gap-2.5 pl-4 pr-3 py-1.5 text-[0.7875rem] ${m?"bg-surface-hover text-text-primary font-medium":""}`,"data-testid":c,children:[h.jsx(bd,{className:"w-4 h-4 shrink-0 text-accent/75",strokeWidth:1.5}),h.jsx("span",{className:"truncate flex-1 min-w-0",children:t.label})]})}function V1({pin:n,collapsed:t,draggable:s,onDragStart:i,onDropOn:o,onRemove:c,onPromote:m,onHide:p}){const{pathname:g,search:u}=en(),[d,b=""]=n.url.split("?"),x=g===d&&u===(b?`?${b}`:""),v="group flex items-center rounded-md transition-colors duration-150",w=x?"bg-surface-hover text-text-primary font-medium":"text-text-secondary hover:text-text-primary hover:bg-surface-hover";return t?h.jsx(Es,{to:n.url,className:`${v} ${w} justify-center w-10 h-10 mx-auto`,title:n.label,children:h.jsx(Tg,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})}):h.jsxs("div",{className:`${v} ${w} relative`,draggable:s,onDragStart:i,onDragOver:S=>S.preventDefault(),onDrop:o,children:[h.jsxs(Es,{to:n.url,title:n.label,className:"flex items-center gap-2.5 pl-4 pr-3 py-1.5 text-[0.7875rem] flex-1 min-w-0",children:[h.jsx(Tg,{className:"w-4 h-4 shrink-0 text-accent/75",strokeWidth:1.5,...n.fromRole?{}:{fill:"currentColor",fillOpacity:.15}}),h.jsx("span",{className:"truncate flex-1 min-w-0",children:n.label}),n.badge&&h.jsx(qT,{url:n.url})]}),h.jsxs("span",{className:"absolute right-1 top-1/2 -translate-y-1/2 flex items-center gap-0.5 rounded px-0.5 bg-surface-hover opacity-0 pointer-events-none group-hover:opacity-100 group-hover:pointer-events-auto transition-opacity",children:[m&&h.jsx("button",{onClick:m,title:"Make mine — copy into my pins",className:"p-1 text-text-quaternary hover:text-accent transition-colors",children:h.jsx(lx,{className:"w-3 h-3"})}),p&&h.jsx("button",{onClick:p,title:"Hide this role pin",className:"p-1 text-text-quaternary hover:text-status-error transition-colors",children:h.jsx(AS,{className:"w-3 h-3"})}),c&&h.jsx("button",{onClick:c,title:`Remove "${n.label}"`,className:"p-1 text-text-quaternary hover:text-status-error transition-colors",children:h.jsx(Zt,{className:"w-3 h-3"})})]})]})}function qT({url:n}){var m;const t=E.useMemo(()=>MT(n),[n]),s={limit:1,staleTime:15e3},i=mv({...(t==null?void 0:t.params)??{},...s,enabled:!!t&&t.available}),o=dv({...(t==null?void 0:t.params)??{},...s,enabled:!!t&&!t.available});if(!t)return null;const c=t.available?i:o;return c.isError||((m=c.data)==null?void 0:m.total)===void 0?null:h.jsx("span",{className:"shrink-0 text-right text-2xs leading-none tabular-nums text-accent/80 relative -top-[0.35em]",title:`${c.data.total} matching now`,children:c.data.total})}function PT(){var c;const{data:n}=er(),t=(c=n==null?void 0:n.features)==null?void 0:c.graphWorkflows,s=t===!0||t!==!1&&Jx(),i=[{to:"/workflows/registry",label:"Registry",icon:Cg},{to:"/workflows/durable/invoke",label:"Invoke Tool",icon:xd},{to:"/workflows/executions",label:"Executions",icon:Mg}],o=s?[{kind:"group",label:"Procedural",icon:jS,matchPaths:["/workflows/registry","/workflows/durable/invoke","/workflows/executions","/workflows/durable/executions","/workflows/start","/workflows/workers","/workflows/tasks"],items:i},{kind:"group",label:"Graph",icon:im,matchPaths:["/mcp/workflows","/mcp/executions"],items:[{to:"/mcp/workflows",label:"Configure",icon:Cg,end:!0},{to:"/mcp/workflows/invoke",label:"Invoke",icon:xd},{to:"/mcp/executions",label:"Executions",icon:Mg}]}]:i;return h.jsx(qr,{heading:"Orchestrate",entries:o})}function AM(){return qe({queryKey:["activeWorkers"],queryFn:async()=>(await ue("/workflows/workers")).workers})}function jM(){return qe({queryKey:["discoveredWorkflows"],queryFn:async()=>(await ue("/workflows/discovered")).workflows})}function kM(){return qe({queryKey:["workflowConfigs"],queryFn:async()=>(await ue("/workflows/config")).workflows})}function Iv(){return qe({queryKey:["invocableWorkflows"],queryFn:async()=>(await ue("/workflows/invocable")).workflows})}function NM(n){return Object.fromEntries(n.filter(t=>!t.missing).map(t=>[t.as??t.key,t.data]))}function TM(n,t){return qe({queryKey:["workflows",n,"input-lookups"],queryFn:()=>ue(`/workflows/${encodeURIComponent(n)}/input-lookups`),enabled:!!n&&t,staleTime:0,refetchOnWindowFocus:!1})}function CM(){return qe({queryKey:["cronStatus"],queryFn:async()=>(await ue("/workflows/cron/status")).schedules})}function MM(n){return qe({queryKey:["workflowExecution",n],queryFn:()=>ue(`/workflow-states/${n}/execution`),enabled:!!n})}function RM(n,t){const s=new URLSearchParams;return n.limit&&s.set("limit",String(n.limit)),n.offset!==void 0&&s.set("offset",String(n.offset)),n.entity&&s.set("entity",n.entity),n.search&&s.set("search",n.search),n.status&&s.set("status",n.status),n.sort_by&&s.set("sort_by",n.sort_by),n.order&&s.set("order",n.order),n.registered&&s.set("registered",n.registered),n.namespace&&s.set("namespace",n.namespace),qe({queryKey:["jobs",n],queryFn:()=>ue(`/workflow-states/jobs?${s}`),enabled:(t==null?void 0:t.enabled)??!0})}function DM(){const n=Be();return Fe({mutationFn:t=>ue(`/workflows/${t}/terminate`,{method:"POST"}),onSuccess:(t,s)=>{n.invalidateQueries({queryKey:["workflowExecution",s],refetchType:"all"}),n.invalidateQueries({queryKey:["jobs"],refetchType:"all"})}})}function LM(){const n=Be();return Fe({mutationFn:({workflow_type:t,...s})=>ue(`/workflows/${encodeURIComponent(t)}/config`,{method:"PUT",body:JSON.stringify(s)}),onSuccess:()=>{n.invalidateQueries({queryKey:["workflowConfigs"],refetchType:"all"})}})}function qM(){const n=Be();return Fe({mutationFn:t=>ue(`/workflows/${encodeURIComponent(t)}/config`,{method:"DELETE"}),onSuccess:()=>{n.invalidateQueries({queryKey:["workflowConfigs"],refetchType:"all"})}})}function PM(){const n=Be();return Fe({mutationFn:({workflowType:t,data:s,metadata:i,execute_as:o})=>ue(`/workflows/${t}/invoke`,{method:"POST",body:JSON.stringify({data:s,metadata:i,...o?{execute_as:o}:{}})}),onSuccess:()=>{n.invalidateQueries({queryKey:["tasks"],refetchType:"all"}),n.invalidateQueries({queryKey:["jobs"],refetchType:"all"})}})}function BT(){const{data:n}=Iv();return n!=null&&n.length?h.jsx(qr,{heading:"Tools",entries:[{to:"/workflows/durable/invoke",label:"Invoke Tool",icon:xd}]}):null}const UT=[{to:"/mcp/queries",label:"Designer",icon:kS},{to:"/mcp/servers",label:"Servers & Tools",icon:NS}];function zT(){return h.jsx(qr,{heading:"Design",entries:UT})}const IT=[{to:"/files",label:"Files",icon:TS},{to:"/knowledge",label:"Knowledge Base",icon:cx}];function $T(){return h.jsx(qr,{heading:"Storage",entries:IT})}function HT({isBuilder:n=!1,isOps:t=!1}){var m;const{data:s}=er(),i=((m=s==null?void 0:s.features)==null?void 0:m.dbMaintenance)!==!1,o=[{to:"/admin/users",label:"Accounts",icon:CS},...n||t?[{to:"/admin/roles",label:"Roles",icon:gd},{to:"/admin/personas",label:"Personas",icon:MS},{to:"/admin/scan-codes",label:"Scan Codes",icon:Mo}]:[]],c=[{to:"/admin/controlplane",label:"Routers",icon:RS},{to:"/admin/streams",label:"Messages",icon:cx},...i?[{to:"/admin/maintenance",label:"DB Maintenance",icon:DS}]:[]];return h.jsxs(h.Fragment,{children:[h.jsx(qr,{heading:"Identity & Access",entries:o}),n&&Qx()&&h.jsx(qr,{heading:"Infrastructure",entries:c})]})}function $v({aiEnabled:n,isBuilder:t,isOps:s,viewAs:i,canSeePaceBoard:o}){return h.jsxs(h.Fragment,{children:[h.jsx(wT,{aiEnabled:n,isBuilder:t,isOps:s,viewAs:i,canSeePaceBoard:o}),h.jsx(DT,{}),!t&&h.jsx(BT,{}),t&&h.jsx(PT,{}),t&&n&&h.jsx(zT,{}),t&&h.jsx($T,{}),(t||s)&&h.jsx(HT,{isBuilder:t,isOps:s})]})}function FT({open:n,onClose:t,...s}){const i=en();return E.useEffect(()=>{t()},[i.pathname]),h.jsxs("div",{className:`lg:hidden fixed inset-y-0 left-0 z-40 flex ${n?"":"pointer-events-none"}`,children:[h.jsx("div",{className:`fixed inset-0 bg-black/20 transition-opacity duration-200 ${n?"opacity-100":"opacity-0"}`,onClick:t,"aria-hidden":!0}),h.jsxs("div",{className:`relative w-72 max-w-[85vw] h-full bg-surface-raised border-r border-surface-border shadow-xl flex flex-col transition-transform duration-200 ease-out ${n?"translate-x-0":"-translate-x-full"}`,children:[h.jsx("div",{className:"flex items-center justify-end px-3 pt-3 shrink-0",children:h.jsx("button",{onClick:t,className:"p-1.5 rounded text-text-tertiary hover:text-text-primary hover:bg-surface-hover transition-colors","aria-label":"Close navigation",children:h.jsx(Zt,{className:"w-4 h-4"})})}),h.jsx("nav",{className:"flex-1 px-3 pb-4 space-y-2 overflow-y-auto overflow-x-hidden",children:h.jsx(Xj,{children:h.jsx($v,{...s})})})]})]})}const Hv="lt_event_feed_patterns";function GT(n,t){if(n.startsWith("/topics/")){const m=decodeURIComponent(n.replace("/topics/",""));if(m&&!m.includes("/"))return`lt.events.${m}`}const s=n.match(/^\/escalations\/detail\/(.+)/);if(s)return`lt.events.system.escalation.*.${s[1]}.>`;if(n.startsWith("/escalations")){const m=new URLSearchParams(t).get("role");return m?`lt.events.system.escalation.${nv(m)}.>`:"lt.events.system.escalation.>"}const i=n.match(/^\/workflows\/(?:durable\/)?executions\/(.+)/);if(i)return`lt.events.system.workflow.${i[1]}.>`;if(n.startsWith("/workflows"))return"lt.events.system.workflow.>";const o=n.match(/^\/agents\/([^/]+)$/);if(o&&o[1]!=="new")return`lt.events.system.agent.${o[1]}.>`;if(n.startsWith("/agents"))return"lt.events.system.agent.>";if(n.startsWith("/knowledge"))return"lt.events.system.knowledge.>";if(n.startsWith("/files"))return"lt.events.system.file.>";if(n==="/")return"lt.events.system.>";const c=n.match(/^\/mcp\/executions\/(.+)/);return c?`lt.events.system.*.${c[1]}.>`:(n.startsWith("/mcp"),"lt.events.system.>")}function VT(){try{const n=localStorage.getItem(Hv);return n?JSON.parse(n):[]}catch{return[]}}function dd(n){try{localStorage.setItem(Hv,JSON.stringify(n))}catch{}}function YT(){const{pathname:n,search:t}=en(),[s,i]=E.useState(VT),o=E.useMemo(()=>GT(n,t),[n,t]),c=E.useMemo(()=>{const u=new Set([o,...s]);return Array.from(u)},[o,s]),m=E.useCallback(u=>{const d=u.startsWith("lt.events.")?u:`lt.events.${u}`;i(b=>{if(b.includes(d))return b;const x=[...b,d];return dd(x),x})},[]),p=E.useCallback(u=>{i(d=>{const b=d.filter(x=>x!==u);return dd(b),b})},[]),g=E.useCallback(()=>{i([]),dd([])},[]);return{patterns:c,pagePattern:o,userPatterns:s,addPattern:m,removePattern:p,clearUserPatterns:g}}function KT({children:n,className:t=""}){return h.jsx("p",{className:`text-2xs font-semibold uppercase tracking-widest text-text-tertiary ${t}`,children:n})}const md=280,Y1="cubic-bezier(0.4, 0, 0.2, 1)",Wc=40;function JT(n){if(!n)return"scale(0.92)";const t=window.innerWidth,s=window.innerHeight,i=t-Wc*2,o=s-Wc*2,c=n.width/i,m=n.height/o,p=n.left+n.width/2-(Wc+i/2),g=n.top+n.height/2-(Wc+o/2);return`translate(${p}px, ${g}px) scale(${c}, ${m})`}function Fv({open:n,onClose:t,sourceRef:s,children:i}){const[o,c]=E.useState(null),m=E.useRef(null),p=E.useRef(!1);E.useEffect(()=>{var x,v;n&&!p.current?(m.current=((x=s==null?void 0:s.current)==null?void 0:x.getBoundingClientRect())??null,c("entering")):!n&&p.current&&o==="open"&&(m.current=((v=s==null?void 0:s.current)==null?void 0:v.getBoundingClientRect())??null,c("exiting")),p.current=n},[n,s,o]),E.useEffect(()=>{if(o!=="entering")return;const x=requestAnimationFrame(()=>{requestAnimationFrame(()=>c("open"))});return()=>cancelAnimationFrame(x)},[o]),E.useEffect(()=>{if(o)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[o]),E.useEffect(()=>{if(!o)return;const x=v=>{v.key==="Escape"&&t()};return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[o,t]);const g=E.useCallback(x=>{x.propertyName==="transform"&&o==="exiting"&&c(null)},[o]);if(E.useEffect(()=>{if(o!=="exiting")return;const x=setTimeout(()=>c(null),md+50);return()=>clearTimeout(x)},[o]),!o)return null;const u=o==="entering"||o==="exiting",d=u?JT(m.current):"none",b=u?0:1;return rm.createPortal(h.jsx("div",{className:"fixed inset-0 z-50 overflow-auto p-10",style:{transformOrigin:"center center",transition:`transform ${md}ms ${Y1}, opacity ${md}ms ${Y1}`,transform:d,opacity:b,backgroundColor:"rgb(var(--lt-surface))"},onTransitionEnd:g,children:i}),document.body)}function QT({className:n}){return h.jsx("svg",{className:n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M4 12h8M4 18h12"})})}function XT({className:n}){return h.jsx("svg",{className:n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 7l-5 5 5 5M16 7l5 5-5 5"})})}function WT({className:n}){return h.jsx("svg",{className:n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 5H6a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2v-1M8 5a2 2 0 002 2h2a2 2 0 002-2M8 5a2 2 0 012-2h2a2 2 0 012 2m0 0h2a2 2 0 012 2v3"})})}function ZT({className:n}){return h.jsx("svg",{className:n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}function eC({className:n}){return h.jsx("svg",{className:n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 9V4.5M9 9H4.5M9 9L3.5 3.5M9 15v4.5M9 15H4.5M9 15l-5.5 5.5M15 9h4.5M15 9V4.5M15 9l5.5-5.5M15 15h4.5M15 15v4.5m0-4.5l5.5 5.5"})})}function tC({className:n}){return h.jsx("svg",{className:n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5v-4m0 4h-4m4 0l-5-5"})})}function nC(n){const t=n.trim().split(`
57
+ `);if(t.length<2)return n;const s=p=>p.split("|").map(g=>g.trim()).filter(Boolean),i=s(t[0]),o=t.slice(2),c=i.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=o.map(p=>`<tr class="border-t border-surface-border">${s(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 Zc(n){return n.toLowerCase().replace(/<[^>]+>/g,"").replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").trim()}function rC(n){const t=[];let s=n.replace(/```(\w*)\n([\s\S]*?)```/g,(g,u,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 i=/^(\|.+\|)\n(\|[-| :]+\|)\n((?:\|.+\|\n?)+)/gm;s=s.replace(i,(g,u,d,b)=>nC(`${u}
58
+ ${d}
59
+ ${b.trimEnd()}`)),s=s.replace(/`([^`]+)`/g,'<code class="bg-surface-sunken px-1 py-0.5 rounded text-2xs">$1</code>'),s=s.replace(/^#### (.+)$/gm,(g,u)=>`<h4 id="${Zc(u)}" class="text-xs font-semibold text-text-primary mt-4 mb-1">${u}</h4>`).replace(/^### (.+)$/gm,(g,u)=>`<h3 id="${Zc(u)}" class="text-sm font-semibold text-text-primary mt-5 mb-1.5">${u}</h3>`).replace(/^## (.+)$/gm,(g,u)=>`<h2 id="${Zc(u)}" class="text-base font-semibold text-text-primary mt-6 mb-2 pb-1 border-b border-surface-border">${u}</h2>`).replace(/^# (.+)$/gm,(g,u)=>`<h1 id="${Zc(u)}" class="text-lg font-bold text-text-primary mb-3">${u}</h1>`),s=s.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/\[([^\]]+)\]\(#([^)]+)\)/g,'<a data-anchor="$2" class="text-accent hover:underline cursor-pointer">$1</a>').replace(/\[([^\]]+)\]\(([^)]*\.md(?:#[^)]*)?)\)/g,'<a data-doc-link="$2" class="text-accent hover:underline cursor-pointer">$1</a>').replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" class="text-accent hover:underline">$1</a>').replace(/^ - (.+)$/gm,'<li class="ml-8 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^ - (.+)$/gm,'<li class="ml-8 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^- (.+)$/gm,'<li class="ml-4 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^\d+\. (.+)$/gm,'<li class="ml-4 list-decimal text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^---+$/gm,'<hr class="border-surface-border my-4" />').replace(/(?:^> (.+)$\n?)+/gm,g=>{const u=g.replace(/^> /gm,"").trim(),d=/⚠️|warning|caution/i.test(u),b=/note:|ℹ️|info/i.test(u);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">${u}</div>`}).replace(/\n\n/g,"\0PARA\0").replace(/\n/g,"<br/>");const o=g=>g.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),c=g=>new RegExp(`(${o(g)}[\\s\\S]*?<\\/li>(?:<br\\/>)?)+`,"g");s=s.replace(c('<li class="ml-8 list-disc'),g=>`<ul class="mb-3">${g}</ul>`),s=s.replace(c('<li class="ml-4 list-disc'),g=>`<ul class="mb-3">${g}</ul>`),s=s.replace(c('<li class="ml-4 list-decimal'),g=>`<ol class="list-decimal mb-3">${g}</ol>`),s=s.replace(/\x00CODE(\d+)\x00/g,(g,u)=>t[parseInt(u,10)]);const m="text-xs leading-relaxed text-text-secondary mb-2",p=/<\/(h[1-4]|pre|table|ul|ol|hr|div)>/;return s=s.split("\0PARA\0").map(g=>{const u=g.trim();if(!u)return"";const d=[];let b=u,x;for(;(x=p.exec(b))!==null;){const v=x.index+x[0].length;d.push(b.slice(0,v)),b=b.slice(v).replace(/^<br\/>/,"").trim(),p.lastIndex=0}return b&&d.push(b),d.map(v=>{const w=v.trim();return w?/^\s*<(h[1-4]|pre|table|ul|ol|hr|div)/.test(w)?w:`<p class="${m}">${w}</p>`:""}).join("")}).join(""),s}const sC=/(\*\*|^#{1,4}\s|^- |^\d+\.\s|```|^\|.*\|$|\[.+\]\(.+\))/m;function iC(n){return sC.test(n)}function qu({content:n,className:t,onClick:s}){const i=E.useMemo(()=>rC(n),[n]);return h.jsx("div",{className:t,onClick:s,dangerouslySetInnerHTML:{__html:i}})}function Su({data:n,depth:t=0,generation:s}){const o=s!==void 0&&s>0&&s%2===1?!1:t>0,[c,m]=E.useState(o),[p,g]=E.useState(s);if(s!==void 0&&s!==p&&(g(s),m(s%2===0&&t>0)),n==null)return h.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof n=="string")return h.jsxs("span",{className:"text-text-primary",children:['"',n,'"']});if(typeof n=="number"||typeof n=="boolean")return h.jsx("span",{className:"text-text-primary font-medium",children:String(n)});if(Array.isArray(n))return n.length===0?h.jsx("span",{className:"text-text-tertiary",children:"[]"}):c?h.jsxs("button",{onClick:()=>m(!1),className:"text-text-secondary hover:text-text-primary",children:["[",n.length," items]"]}):h.jsxs("span",{children:[h.jsx("button",{onClick:()=>m(!0),className:"text-text-tertiary hover:text-text-primary",children:"["}),h.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:n.map((u,d)=>h.jsxs("div",{children:[h.jsx(Su,{data:u,depth:t+1,generation:s}),d<n.length-1&&h.jsx("span",{className:"text-text-tertiary",children:","})]},d))}),h.jsx("span",{className:"text-text-tertiary",children:"]"})]});if(typeof n=="object"){const u=Object.entries(n);return u.length===0?h.jsx("span",{className:"text-text-tertiary",children:"{}"}):c?h.jsxs("button",{onClick:()=>m(!1),className:"text-text-secondary hover:text-text-primary",children:["{","...","}"]}):h.jsxs("span",{children:[h.jsx("button",{onClick:()=>m(!0),className:"text-text-tertiary hover:text-text-primary",children:"{"}),h.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:u.map(([d,b],x)=>h.jsxs("div",{children:[h.jsx("span",{className:"text-text-secondary",children:d}),h.jsx("span",{className:"text-text-tertiary",children:": "}),h.jsx(Su,{data:b,depth:t+1,generation:s}),x<u.length-1&&h.jsx("span",{className:"text-text-tertiary",children:","})]},d))}),h.jsx("span",{className:"text-text-tertiary",children:"}"})]})}return h.jsx("span",{children:String(n)})}function Eo({data:n,depth:t=0}){if(n==null)return h.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof n=="string")return n.length>40&&iC(n)?h.jsx(qu,{content:n}):h.jsx("span",{className:"text-text-primary",children:n});if(typeof n=="number"||typeof n=="boolean")return h.jsx("span",{className:"text-text-primary font-medium",children:String(n)});if(Array.isArray(n))return n.length===0?h.jsx("span",{className:"text-text-tertiary italic",children:"empty list"}):h.jsx("div",{className:"space-y-2",children:n.map((s,i)=>h.jsxs("div",{className:"flex items-baseline gap-2",children:[h.jsxs("span",{className:"text-text-tertiary text-2xs shrink-0",children:[i+1,"."]}),h.jsx("div",{className:"flex-1",children:h.jsx(Eo,{data:s,depth:t+1})})]},i))});if(typeof n=="object"){const s=Object.entries(n);return s.length===0?h.jsx("span",{className:"text-text-tertiary italic",children:"empty"}):h.jsx("div",{className:t>0?"pl-4 border-l border-surface-border space-y-3":"space-y-3",children:s.map(([i,o])=>{const c=o===null||typeof o!="object";return h.jsxs("div",{children:[h.jsx("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-0.5",children:i.replace(/[_-]/g," ")}),c?h.jsx("p",{className:"text-sm text-text-primary",children:h.jsx(Eo,{data:o,depth:t+1})}):h.jsx(Eo,{data:o,depth:t+1})]},i)})})}return h.jsx("span",{children:String(n)})}function K1({mode:n,setMode:t,isCollapsed:s,onToggleCollapse:i,onCopy:o,copied:c,onFullscreen:m,onClose:p,large:g}){const u=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 h.jsxs("div",{className:"flex items-center gap-0.5 bg-surface-sunken/80 rounded-md backdrop-blur-sm",children:[n==="json"&&h.jsx("button",{onClick:i,className:d,title:s?"Expand all":"Collapse all",children:s?h.jsx(tC,{className:u}):h.jsx(eC,{className:u})}),h.jsx("button",{onClick:()=>t(n==="json"?"tree":"json"),className:d,title:n==="json"?"Outline view":"JSON view",children:n==="json"?h.jsx(QT,{className:u}):h.jsx(XT,{className:u})}),h.jsx("button",{onClick:o,className:d,title:"Copy to clipboard",children:c?h.jsx(ZT,{className:`${u} text-status-success`}):h.jsx(WT,{className:u})}),m&&h.jsx("button",{onClick:m,className:d,title:"Fullscreen",children:h.jsx(ux,{className:u})}),p&&h.jsx("button",{onClick:p,className:d,title:"Close (Esc)",children:h.jsx(fx,{className:u})})]})}function aC({data:n,label:t,variant:s,defaultCollapsed:i=!1,defaultMode:o}){const c=E.useRef(null),[m,p]=E.useState(o??"json"),[g,u]=E.useState(!1),[d,b]=E.useState(!1),[x,v]=E.useState(i?0:1),[w,S]=E.useState(1),C=x%2===0,P=w%2===0,q=E.useCallback(()=>v(D=>D+1),[]),re=E.useCallback(()=>S(D=>D+1),[]);let se=n;if(typeof n=="string")try{se=JSON.parse(n)}catch{}const M=async()=>{const D=typeof n=="string"?n:JSON.stringify(se,null,2);await navigator.clipboard.writeText(D),u(!0),setTimeout(()=>u(!1),2e3)},U=E.useCallback(()=>{S(1),b(!0)},[]),ae=s==="panel",z=ae?"border border-accent-muted/40 rounded-lg p-3 bg-surface-hover/30":"",I=ae?"font-mono text-xs leading-relaxed bg-surface-raised rounded-md p-4 overflow-x-auto break-all":"font-mono text-xs leading-relaxed bg-surface-sunken border border-surface-border rounded-md p-4 overflow-x-auto break-all";return h.jsxs("div",{className:z,children:[t&&h.jsx(KT,{children:t}),h.jsxs("div",{ref:c,className:"relative",children:[h.jsx("div",{className:"absolute top-2 right-2 z-[5]",children:h.jsx(K1,{mode:m,setMode:p,isCollapsed:C,onToggleCollapse:q,onCopy:M,copied:g,onFullscreen:U})}),h.jsx("div",{className:I,children:m==="json"?h.jsx(Su,{data:se,generation:x}):h.jsx(Eo,{data:se})})]}),h.jsxs(Fv,{open:d,onClose:()=>b(!1),sourceRef:c,children:[h.jsx("div",{className:"sticky top-0 float-right z-10",children:h.jsx(K1,{mode:m,setMode:p,isCollapsed:P,onToggleCollapse:re,onCopy:M,copied:g,onClose:()=>b(!1),large:!0})}),h.jsx("div",{className:"font-mono text-sm leading-relaxed",children:m==="json"?h.jsx(Su,{data:se,generation:w}):h.jsx(Eo,{data:se})})]})]})}const oC=100,J1=500;let lC=0;const Gv={"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 Vv(n){const t=n.split(".");return t[0]==="system"&&t.length>=3?`${t[1]}.${t[t.length-1]}`:n}function Q1({event:n,forceExpanded:t=!1}){var x,v;const[s,i]=E.useState(t),o=Gv[Vv(n.type)]||"text-text-tertiary";E.useEffect(()=>{i(t)},[t]);const c=t,m=c?"text-xs":"text-2xs",p=c?"text-xs":"text-2xs",g=c?"text-xs":"text-2xs",u=c?"w-3.5 h-3.5":"w-2.5 h-2.5",d=c?"py-2 px-4":"py-1 px-3",b=c?"pb-4 px-4":"pb-2 px-3";return h.jsxs("div",{className:"border-b border-surface-border/30 last:border-b-0",children:[h.jsxs("button",{onClick:()=>i(!s),className:`flex items-center gap-2 ${d} w-full text-left hover:bg-surface-hover/50 transition-colors`,children:[h.jsx("span",{className:`${m} font-mono text-text-tertiary whitespace-nowrap tabular-nums shrink-0`,children:new Date(n.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}),h.jsx("span",{className:`${p} font-medium px-1 py-0.5 rounded ${o} bg-surface-sunken whitespace-nowrap shrink-0`,children:n.type}),h.jsxs("span",{className:`${g} text-text-tertiary font-mono flex-1 min-w-0 truncate`,children:[(x=n.data)!=null&&x.workflowId?String(n.data.workflowId):"",(v=n.data)!=null&&v.escalationId?` esc:${String(n.data.escalationId).slice(0,12)}`:""]}),h.jsx("svg",{className:`${u} text-text-tertiary shrink-0 transition-transform duration-150 ${s?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),h.jsx(Hm,{open:s,children:h.jsx("div",{className:b,children:h.jsx(aC,{data:n.data})})})]})}function cC({open:n,onToggle:t,configOpen:s,onToggleConfig:i}){const[o,c]=E.useState([]),[m,p]=E.useState(!1),[g,u]=E.useState(""),d=E.useRef(null),b=E.useRef(new Map),{subscribe:x}=E.useContext(aa),{connected:v}=Rx(),{patterns:w,pagePattern:S,userPatterns:C,addPattern:P,removePattern:q}=YT(),re=E.useCallback(U=>{const ae=String(U.type||"unknown");if(ae.startsWith("mesh."))return;const z=`${ae}:${U.timestamp||""}:${U.escalationId||U.workflowId||U.taskId||""}`,I=Date.now(),D=b.current.get(z);if(!(D&&I-D<J1)){if(b.current.set(z,I),b.current.size>200)for(const[X,W]of b.current)I-W>J1*2&&b.current.delete(X);c(X=>[{id:++lC,type:ae,timestamp:U.timestamp||new Date().toISOString(),data:U},...X].slice(0,oC))}},[]),se=E.useRef(re);se.current=re;const M=n||m||s;return E.useEffect(()=>{if(!M)return;const U=w.map(ae=>x(ae,z=>se.current(z)));return()=>U.forEach(ae=>ae())},[x,w.join(","),M]),E.useEffect(()=>{n&&d.current&&(d.current.scrollTop=0)},[o.length,n]),h.jsxs("div",{className:"shrink-0 border-t border-surface-border bg-surface-raised",children:[h.jsxs("button",{onClick:t,className:"flex items-center gap-2 w-full px-4 py-1.5 text-left hover:bg-surface-hover transition-colors",children:[n?h.jsx(sm,{className:"w-3 h-3 text-text-tertiary"}):h.jsx(hx,{className:"w-3 h-3 text-text-tertiary"}),h.jsx("span",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary",children:"Event Stream"}),o.length>0&&h.jsxs("span",{className:"text-2xs text-text-tertiary",children:[o.length," events"]}),o.length>0&&!n&&h.jsx("span",{className:`text-2xs font-medium px-1 py-0.5 rounded ${Gv[Vv(o[0].type)]||"text-text-tertiary"} bg-surface-sunken`,children:o[0].type}),h.jsxs("span",{className:"ml-auto flex items-center gap-1",children:[h.jsx("span",{className:`p-0.5 ${v?"text-status-success":"text-status-warning hover:text-text-primary cursor-pointer"}`,title:v?"Live events connected":"Events disconnected — click to reconnect",onClick:U=>{U.stopPropagation(),v||window.location.reload()},children:h.jsx(ox,{className:"w-3 h-3"})}),h.jsx("span",{className:`p-0.5 cursor-pointer ${s?"text-accent":"text-text-tertiary hover:text-text-primary"}`,title:"Subscription config",onClick:U=>{U.stopPropagation(),i()},children:h.jsx(LS,{className:"w-3 h-3"})}),o.length>0&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-text-tertiary hover:text-text-primary p-0.5 cursor-pointer",title:"Fullscreen",onClick:U=>{U.stopPropagation(),p(!0)},children:h.jsx(ux,{className:"w-3 h-3"})}),h.jsx("span",{className:"text-text-tertiary hover:text-text-primary p-0.5 cursor-pointer",title:"Clear events",onClick:U=>{U.stopPropagation(),c([])},children:h.jsx(qS,{className:"w-3 h-3"})})]})]})]}),s&&h.jsxs("div",{className:"px-4 py-2 border-t border-surface-border/50 bg-surface-sunken/30",children:[h.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 mb-1.5",children:[h.jsx("span",{className:"text-2xs text-text-quaternary uppercase tracking-wider shrink-0",children:"Subscribed:"}),h.jsx("span",{className:"text-2xs font-mono text-accent px-1.5 py-0.5 bg-accent/10 rounded",children:S.replace("lt.events.","")}),C.map(U=>h.jsxs("span",{className:"inline-flex items-center gap-1 text-2xs font-mono text-text-secondary px-1.5 py-0.5 bg-surface-sunken rounded",children:[U.replace("lt.events.",""),h.jsx("button",{onClick:()=>q(U),className:"text-text-quaternary hover:text-status-error",children:h.jsx(Zt,{className:"w-2 h-2"})})]},U))]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("input",{type:"text",value:g,onChange:U=>u(U.target.value),onKeyDown:U=>{U.key==="Enter"&&g.trim()&&(P(g.trim()),u(""))},placeholder:"task.> or file.stored",className:"input text-2xs font-mono flex-1 py-1"}),h.jsxs("button",{onClick:()=>{g.trim()&&(P(g.trim()),u(""))},className:"text-2xs text-accent hover:text-accent-hover flex items-center gap-0.5",children:[h.jsx(lx,{className:"w-2.5 h-2.5"})," Add"]})]})]}),h.jsx(Hm,{open:n,children:h.jsx("div",{ref:d,className:"h-48 overflow-y-auto",children:o.length===0?h.jsx("p",{className:"text-2xs text-text-tertiary py-4 text-center",children:"Waiting for events..."}):o.map(U=>h.jsx(Q1,{event:U},U.id))})}),h.jsxs(Fv,{open:m,onClose:()=>p(!1),sourceRef:d,children:[h.jsx("div",{className:"sticky top-0 float-right z-10",children:h.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:h.jsx(fx,{className:"w-5 h-5"})})}),o.length===0?h.jsx("p",{className:"text-sm text-text-tertiary py-8",children:"No events captured"}):o.map(U=>h.jsx(Q1,{event:U,forceExpanded:!0},U.id))]})]})}function uC(){return qe({queryKey:["docs"],queryFn:()=>ue("/docs"),staleTime:5*6e4})}function fC(n){return qe({queryKey:["docs",n],queryFn:()=>ue(`/docs/read?path=${encodeURIComponent(n)}`),enabled:!!n,staleTime:5*6e4})}function hC(){const[n,t]=E.useState([]),[s,i]=E.useState([]),[o,c]=E.useState(null),m=E.useRef(o),p=E.useRef(n),g=E.useRef(s);m.current=o,p.current=n,g.current=s;const u=E.useCallback((w,S)=>{var P;const C=m.current;if(C){const q=((P=S==null?void 0:S.current)==null?void 0:P.scrollTop)??0;t([...p.current,{...C,scrollTop:q}])}i([]),c({path:w,scrollTop:0})},[]),d=E.useCallback(w=>{var q;const S=p.current;if(S.length===0)return;const C=S[S.length-1],P=m.current;if(P){const re=((q=w==null?void 0:w.current)==null?void 0:q.scrollTop)??0;i([...g.current,{...P,scrollTop:re}])}t(S.slice(0,-1)),c(C),requestAnimationFrame(()=>{w!=null&&w.current&&(w.current.scrollTop=C.scrollTop)})},[]),b=E.useCallback(w=>{var q;const S=g.current;if(S.length===0)return;const C=S[S.length-1],P=m.current;if(P){const re=((q=w==null?void 0:w.current)==null?void 0:q.scrollTop)??0;t([...p.current,{...P,scrollTop:re}])}i(S.slice(0,-1)),c(C),requestAnimationFrame(()=>{w!=null&&w.current&&(w.current.scrollTop=C.scrollTop)})},[]),x=E.useCallback(w=>{var P,q;const S=m.current;if(!S)return;const C=((P=w==null?void 0:w.current)==null?void 0:P.scrollTop)??0;t([...p.current,{...S,scrollTop:C}]),i([]),c({...S,scrollTop:((q=w==null?void 0:w.current)==null?void 0:q.scrollTop)??0})},[]),v=E.useCallback(()=>{t([]),i([]),c(null)},[]);return{current:o,backStack:n,forwardStack:s,navigate:u,goBack:d,goForward:b,pushScrollPosition:x,reset:v}}function dC(n,t){const[s,i]=n.split("#");let o=s;if(o.startsWith("./")||o.startsWith("../")){const m=((t?t.replace(/[^/]+$/,""):"")+o).split("/"),p=[];for(const g of m)g===".."?p.pop():g&&g!=="."&&p.push(g);o=p.join("/")}return{path:o,anchor:i}}function mC(n){if(!n.startsWith("#docs"))return null;const t=n.slice(1).split(":"),s=t[1]||"README.md",i=t[2]||void 0;return{path:s,anchor:i}}function pC(n){return!n||n==="README.md"?"#docs":`#docs:${n}`}function yC({content:n,currentPath:t,onNavigate:s,onAnchorClick:i}){const o=c=>{var u;const m=c.target,p=m.closest("[data-anchor]");if(p){c.preventDefault(),i();const d=p.dataset.anchor,b=(u=p.closest(".docs-content"))==null?void 0:u.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}=dC(g.dataset.docLink,t);s(d,b);return}};return h.jsx(qu,{content:n,className:"docs-content",onClick:o})}function gC(n){const t=[],s=new Map;for(const i of n){const o=i.path.split("/");if(o.length===1){t.push(i);continue}let c=s;for(let m=0;m<o.length-1;m++){const p=o[m];c.has(p)||c.set(p,{label:p,children:[],subdirs:new Map});const g=c.get(p);m===o.length-2?g.children.push(i):c=g.subdirs}}return{topLevel:t,dirs:s}}function bC({docs:n,selected:t,onSelect:s}){const{topLevel:i,dirs:o}=gC(n),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 h.jsxs("details",{open:!0,children:[h.jsxs("summary",{className:"flex items-center gap-1.5 px-3 py-1 text-2xs font-semibold uppercase tracking-widest text-text-tertiary cursor-pointer",children:[h.jsx(PS,{className:"w-3 h-3",strokeWidth:1.5}),p.label]}),h.jsxs("div",{className:"pl-2 space-y-0.5",children:[[...p.subdirs.values()].map(u=>m(u)),p.children.map(u=>h.jsx("button",{className:c(u.path),onClick:()=>s(u.path),children:u.title},u.path))]})]},p.label)}return h.jsxs("div",{className:"space-y-0.5",children:[i.map(p=>h.jsx("button",{className:c(p.path),onClick:()=>s(p.path),children:p.title},p.path)),[...o.values()].map(p=>m(p))]})}function xC({open:n,onClose:t}){var ae,z,I;const[s,i]=E.useState(!1),{data:o}=uC(),c=hC(),{data:m,isLoading:p}=fC(((ae=c.current)==null?void 0:ae.path)??null),g=E.useRef(null),[u,d]=E.useState(null);E.useEffect(()=>{u&&(m!=null&&m.content)&&g.current&&requestAnimationFrame(()=>{var X;const D=(X=g.current)==null?void 0:X.querySelector(`#${CSS.escape(u)}`);D==null||D.scrollIntoView({behavior:"smooth",block:"start"}),d(null)})},[u,m]);const b=E.useCallback(()=>{var W;const D=mC(window.location.hash),X=(D==null?void 0:D.path)??"README.md";((W=c.current)==null?void 0:W.path)!==X&&c.navigate(X,g),D!=null&&D.anchor&&d(D.anchor)},[c]),x=E.useRef(!0);E.useEffect(()=>{if(!n||!c.current)return;if(x.current){x.current=!1;return}const D=pC(c.current.path);window.location.hash!==D&&window.history.replaceState(null,"",window.location.pathname+window.location.search+D)},[n,(z=c.current)==null?void 0:z.path]),E.useEffect(()=>{if(!n)return;const D=()=>{window.location.hash.startsWith("#docs")&&b()};return window.addEventListener("hashchange",D),()=>window.removeEventListener("hashchange",D)},[n,b]);const v=E.useCallback((D,X)=>{X&&d(X),c.navigate(D,g)},[c]),w=E.useCallback(D=>{c.navigate(D,g)},[c]),S=E.useCallback(()=>{c.goBack(g)},[c]),C=E.useCallback(()=>{c.goForward(g)},[c]),P=E.useCallback(()=>{c.pushScrollPosition(g)},[c]);if(E.useEffect(()=>{if(n){x.current=!0,b();const D=requestAnimationFrame(()=>i(!0));return()=>cancelAnimationFrame(D)}},[n]),!(n||s))return null;const re=()=>{i(!1),setTimeout(()=>{t(),c.reset()},200)},se=((I=c.current)==null?void 0:I.path)??null,M=c.backStack.length>0,U=c.forwardStack.length>0;return h.jsxs("div",{className:"fixed inset-y-0 right-0 z-50 flex",children:[h.jsx("div",{className:`fixed inset-0 bg-black/20 transition-opacity duration-200 ${s&&n?"opacity-100":"opacity-0"}`,onClick:re}),h.jsxs("div",{className:`relative ml-auto w-[40vw] min-w-[800px] max-w-[90vw] h-full bg-surface-raised border-l border-surface-border flex flex-col shadow-xl transition-transform duration-200 ease-out ${s&&n?"translate-x-0":"translate-x-full"}`,children:[h.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border shrink-0",children:[h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx("button",{onClick:S,disabled:!M,className:`p-0.5 transition-colors ${M?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Back",children:h.jsx(ax,{className:"w-4 h-4"})}),h.jsx("button",{onClick:C,disabled:!U,className:`p-0.5 transition-colors ${U?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Forward",children:h.jsx(yd,{className:"w-4 h-4"})}),h.jsx(BS,{className:"w-4 h-4 text-accent ml-1",strokeWidth:1.5}),h.jsx("span",{className:"text-sm font-medium text-text-primary",children:"Documentation"})]}),h.jsx("button",{onClick:re,className:"p-1 text-text-tertiary hover:text-text-primary",children:h.jsx(Zt,{className:"w-4 h-4"})})]}),h.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[h.jsx("div",{className:"w-48 shrink-0 border-r border-surface-border overflow-y-auto py-2",children:o!=null&&o.docs?h.jsx(bC,{docs:o.docs,selected:se,onSelect:w}):h.jsx("div",{className:"px-3 py-2 text-xs text-text-tertiary",children:"Loading..."})}),h.jsx("div",{ref:g,className:"flex-1 overflow-y-auto px-6 py-4",children:se?p?h.jsxs("div",{className:"animate-pulse space-y-2",children:[h.jsx("div",{className:"h-6 bg-surface-sunken rounded w-48"}),h.jsx("div",{className:"h-4 bg-surface-sunken rounded w-full"}),h.jsx("div",{className:"h-4 bg-surface-sunken rounded w-3/4"})]}):m!=null&&m.content?h.jsx(yC,{content:m.content,currentPath:se,onNavigate:v,onAnchorClick:P}):h.jsx("p",{className:"text-xs text-text-tertiary",children:"Document not found."}):h.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-text-tertiary",children:[h.jsx(yd,{className:"w-5 h-5 mb-2"}),h.jsx("p",{className:"text-xs",children:"Select a document"})]})})]})]})]})}function vC(n){if(n.includes("/escalations"))return["escalation","human-queue"]}const X1=2e3;function _C(n){const s=n.filter(o=>!o.pending).slice(-8);return s.length===0?"":`[Prior conversation]
60
+ ${s.map(o=>`${o.role==="user"?"User":"Assistant"}: ${o.content}`).join(`
61
+ `)}
62
+ [End prior conversation]
63
+
64
+ `}function wC(n){const t=n.summary,s=n.title;if(t){const i=t.search(/\n\s*\{[\s\S]*"title"\s*:/);return i>0?t.slice(0,i).trim():t}return s||(typeof n=="string"?n:"Query completed.")}const Yv=E.createContext(null);function SC({children:n}){const t=en(),[s,i]=E.useState(!1),[o,c]=E.useState([]),[m,p]=E.useState(null),[g,u]=E.useState({}),d=E.useRef(null),b={page:t.pathname.split("/").filter(Boolean).join("-")||"home",route:t.pathname,params:{},...g,suggestedTags:g.suggestedTags??vC(t.pathname)};E.useEffect(()=>()=>{d.current&&clearInterval(d.current)},[]);const x=E.useCallback(()=>i(P=>!P),[]),v=E.useCallback(P=>{u(P)},[]),w=E.useCallback(()=>{c([]),p(null)},[]),S=E.useCallback(async P=>{var z;const q=new Date().toISOString(),re={id:`user-${Date.now()}`,role:"user",content:P,timestamp:q},se={id:`pending-${Date.now()}`,role:"assistant",content:"",timestamp:q,pending:!0};c(I=>[...I,re,se]);const M={...b};(z=M.entities)!=null&&z.yamlContent&&M.entities.yamlContent.length>X1&&(M.entities={...M.entities,yamlContent:M.entities.yamlContent.slice(0,X1)+`
65
+ ... (truncated)`});const ae=`${_C(o.concat(re))}${P}`;try{const D=(await ue("/insight/mcp-query",{method:"POST",body:JSON.stringify({prompt:ae,tags:M.suggestedTags,context:M,wait:!1,direct:!0})})).workflow_id;p(D),c(X=>X.map(W=>W.id===se.id?{...W,workflowId:D}:W)),d.current&&clearInterval(d.current),d.current=setInterval(async()=>{var X;try{const W=await ue(`/workflows/${D}/result`),he=(X=W==null?void 0:W.result)==null?void 0:X.data;if(he){d.current&&clearInterval(d.current),d.current=null,p(null);const we=wC(he);let Oe;try{Oe=(await ue(`/workflow-states/${D}/execution`)).duration_ms}catch{}c(F=>F.map(J=>J.id===se.id?{...J,content:we,timestamp:new Date().toISOString(),pending:!1,durationMs:Oe}:J))}}catch{}},3e3)}catch{c(I=>I.map(D=>D.id===se.id?{...D,content:"Failed to submit query. Please try again.",pending:!1}:D))}},[o,b]),C=E.useCallback(async P=>{const q=o.find(M=>M.id===P);if(!(q!=null&&q.workflowId)||q.compilationStatus==="compiling"||q.compilationStatus==="done")return;const re=o.indexOf(q),se=o.slice(0,re).reverse().find(M=>M.role==="user");if(se){c(M=>M.map(U=>U.id===P?{...U,compilationStatus:"compiling"}:U));try{const M=await ue("/insight/mcp-query/describe",{method:"POST",body:JSON.stringify({prompt:se.content,summary:q.content})}),U=await ue("/yaml-workflows",{method:"POST",body:JSON.stringify({workflow_id:q.workflowId,task_queue:"long-tail-system",workflow_name:"mcpQuery",name:M.tool_name,description:M.description,tags:M.tags,app_id:""})});await ue(`/yaml-workflows/${U.id}/deploy`,{method:"POST"}),c(ae=>ae.map(z=>z.id===P?{...z,compilationStatus:"done"}:z))}catch(M){const U=M instanceof Error?M.message:"Compilation failed";c(ae=>ae.map(z=>z.id===P?{...z,compilationStatus:"error",compilationError:U}:z))}}},[o]);return h.jsx(Yv.Provider,{value:{helpOpen:s,setHelpOpen:i,toggleHelp:x,messages:o,sendMessage:S,pageContext:b,setPageContext:v,activeWorkflowId:m,clearMessages:w,compileMessage:C},children:n})}function Kv(){const n=E.useContext(Yv);if(!n)throw new Error("useHelpAssistant must be used within HelpAssistantProvider");return n}function EC(){const{helpOpen:n,toggleHelp:t}=Kv();return h.jsx("button",{onClick:t,className:"fixed right-3 z-[45] flex items-center justify-center w-10 h-10 rounded-full bg-surface-raised shadow-lg hover:scale-110 transition-transform duration-150 border border-accent/30",style:{bottom:"44px"},"aria-label":n?"Close help":"Ask for help",children:n?h.jsx(Zt,{className:"w-5 h-5 text-text-tertiary",strokeWidth:1.5}):h.jsx("span",{role:"img","aria-label":"Help",className:"logo-mark w-8 h-8 -rotate-[120deg]",style:{"--logo-url":`url(${Vt}/logo512.png)`}})})}function OC({ms:n,className:t=""}){const s=fk(n),i=E.useMemo(()=>n==null?[]:[{label:"ms",value:String(n)},{label:"sec",value:`${(n/1e3).toFixed(3)}s`},{label:"text",value:s}],[n,s]);return n==null?h.jsx("span",{className:`text-xs text-text-tertiary ${t}`,children:"--"}):h.jsx(yv,{options:i,children:h.jsx("span",{className:`text-xs text-text-tertiary ${t}`,children:s})})}const AC=["sm","md","lg","full"],W1={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"},Z1={sm:"Small",md:"Medium",lg:"Large",full:"Fullscreen"};function jC({which:n}){const t="stroke-current";switch(n){case"sm":return h.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:h.jsx("rect",{x:"5",y:"5",width:"7",height:"7",rx:"1.5",className:t,strokeWidth:"1.5"})});case"md":return h.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:h.jsx("rect",{x:"3",y:"3",width:"9",height:"9",rx:"1.5",className:t,strokeWidth:"1.5"})});case"lg":return h.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:h.jsx("rect",{x:"1.5",y:"1.5",width:"11",height:"11",rx:"1.5",className:t,strokeWidth:"1.5"})});case"full":return h.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:h.jsx("rect",{x:"0.75",y:"0.75",width:"12.5",height:"12.5",rx:"1.5",className:t,strokeWidth:"1.5"})})}}function kC({msg:n}){const[t,s]=E.useState(0);E.useEffect(()=>{const m=new Date(n.timestamp).getTime(),p=()=>s(Math.floor((Date.now()-m)/1e3));p();const g=setInterval(p,1e3);return()=>clearInterval(g)},[n.timestamp]);const i=Math.floor(t/60),o=t%60,c=i>0?`${i}m ${o}s`:`${o}s`;return h.jsxs("span",{className:"inline-flex flex-col gap-1.5",children:[h.jsxs("span",{className:"inline-flex items-center gap-1",children:[h.jsx("span",{className:"text-text-tertiary",children:"Thinking"}),h.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse"}),h.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse [animation-delay:150ms]"}),h.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse [animation-delay:300ms]"}),h.jsx("span",{className:"text-text-muted ml-1 tabular-nums",children:c})]}),n.workflowId&&h.jsxs(ar,{to:`/workflows/executions/${n.workflowId}`,className:"inline-flex items-center gap-1 text-2xs text-accent/70 hover:text-accent transition-colors",children:[h.jsx(im,{className:"w-2.5 h-2.5",strokeWidth:1.5}),"watch execution"]})]})}function NC({msg:n,compileMessage:t}){const s=n.role==="assistant";return h.jsxs("div",{className:`flex items-center gap-1.5 ${s?"justify-start":"justify-end"}`,children:[h.jsx(gv,{date:n.timestamp,format:"time",className:"!text-2xs text-text-muted/50"}),n.durationMs!=null&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-text-muted/30 text-2xs",children:"·"}),h.jsx(OC,{ms:n.durationMs,className:"!text-2xs text-text-muted/50"})]}),n.workflowId&&h.jsx(ar,{to:`/workflows/executions/${n.workflowId}`,className:"text-text-muted/40 hover:text-accent transition-colors",title:"View workflow execution",children:h.jsx(im,{className:"w-2.5 h-2.5",strokeWidth:1.5})}),s&&n.workflowId&&!n.pending&&h.jsx("button",{onClick:()=>t(n.id),disabled:n.compilationStatus==="compiling"||n.compilationStatus==="done",className:"transition-colors",title:n.compilationStatus==="done"?"Compiled — future queries will match this pipeline":n.compilationStatus==="error"?n.compilationError??"Compilation failed":n.compilationStatus==="compiling"?"Compiling...":"Compile to fast pipeline",children:h.jsx(US,{className:`w-2.5 h-2.5 ${n.compilationStatus==="done"?"text-status-success":n.compilationStatus==="error"?"text-status-error":n.compilationStatus==="compiling"?"text-accent/40 animate-pulse":"text-text-muted/40 hover:text-accent"}`,strokeWidth:1.5})})]})}function TC(){const{helpOpen:n,setHelpOpen:t,messages:s,sendMessage:i,pageContext:o,activeWorkflowId:c,clearMessages:m,compileMessage:p}=Kv(),[g,u]=E.useState(""),[d,b]=E.useState("md"),[x,v]=E.useState(!0),w=E.useRef(null),S=E.useRef(null);if(E.useEffect(()=>{w.current&&(w.current.scrollTop=w.current.scrollHeight)},[s]),E.useEffect(()=>{n&&S.current&&S.current.focus()},[n]),E.useEffect(()=>{if(!n)return;const M=U=>{U.key==="Escape"&&(d==="full"?b("lg"):d==="lg"?b("md"):d==="md"?b("sm"):t(!1))};return document.addEventListener("keydown",M),()=>document.removeEventListener("keydown",M)},[n,d,t]),!n)return null;const C=()=>{const M=g.trim();!M||c||(i(M),u(""),S.current&&(S.current.style.height="auto"))},P=M=>{M.key==="Enter"&&!M.shiftKey&&(M.preventDefault(),C())},q=d==="full",re=o.page.replace(/-/g," "),se=q?{}:{bottom:"108px"};return h.jsxs("div",{className:`fixed z-[45] flex flex-col border border-surface-border rounded-lg overflow-hidden transition-all duration-300 ${q?W1.full:`right-6 ${W1[d]}`} ${x?"bg-surface-raised shadow-xl":"bg-surface-raised/[0.03] shadow-lg shadow-black/5"}`,style:se,onMouseEnter:()=>v(!0),onMouseLeave:()=>v(!1),children:[h.jsxs("div",{className:`flex items-center justify-between px-4 py-2.5 border-b border-surface-border shrink-0 transition-all duration-300 ${x?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[h.jsxs("div",{className:"min-w-0 flex-1",children:[h.jsx("p",{className:"text-xs font-medium text-text-primary truncate",children:"Help Assistant"}),h.jsx("p",{className:"text-2xs text-text-tertiary truncate",children:re})]}),h.jsxs("div",{className:"flex items-center gap-1 ml-2",children:[h.jsx("div",{className:"flex items-center gap-0.5 border border-surface-border rounded p-0.5",role:"radiogroup","aria-label":"Panel size",children:AC.map(M=>h.jsx("button",{onClick:()=>b(M),className:`p-1 rounded transition-colors ${M===d?"bg-accent/15 text-accent":"text-text-muted hover:text-text-secondary hover:bg-surface-hover"}`,role:"radio","aria-checked":M===d,"aria-label":Z1[M],title:Z1[M],children:h.jsx(jC,{which:M})},M))}),s.length>0&&h.jsx("button",{onClick:m,className:"p-1 text-text-tertiary hover:text-text-secondary transition-colors","aria-label":"Clear conversation",title:"Clear conversation",children:h.jsx(zS,{className:"w-3.5 h-3.5",strokeWidth:1.5})}),h.jsx("button",{onClick:()=>t(!1),className:"p-1 text-text-tertiary hover:text-text-primary transition-colors","aria-label":"Close",title:"Close",children:h.jsx(Zt,{className:"w-3.5 h-3.5",strokeWidth:1.5})})]})]}),h.jsxs("div",{ref:w,className:`flex-1 overflow-y-auto px-4 py-3 space-y-3 min-h-[120px] transition-all duration-300 ${x?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[s.length===0&&h.jsx("p",{className:"text-xs text-text-tertiary text-center py-6",children:"Ask anything about what you're viewing."}),s.map(M=>h.jsxs("div",{className:`text-xs leading-relaxed ${M.role==="user"?"text-right":"text-left"}`,children:[h.jsx("div",{className:`inline-block max-w-[85%] px-3 py-2 rounded-md whitespace-pre-wrap ${M.role==="user"?"bg-accent/10 text-text-primary":"bg-surface-sunken text-text-secondary"}`,children:M.pending?h.jsx(kC,{msg:M}):M.role==="assistant"?h.jsx(qu,{content:M.content}):M.content}),!M.pending&&h.jsx("div",{className:"mt-0.5",children:h.jsx(NC,{msg:M,compileMessage:p})})]},M.id))]}),h.jsxs("div",{className:`border-t border-surface-border px-3 py-2.5 flex gap-2 shrink-0 transition-all duration-300 ${x?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[h.jsx("textarea",{ref:S,value:g,onChange:M=>{u(M.target.value);const U=M.target;U.style.height="auto",U.style.height=`${Math.min(U.scrollHeight,120)}px`},onKeyDown:P,placeholder:"Ask a question...",rows:2,className:"flex-1 resize-none bg-surface text-xs text-text-primary placeholder:text-text-tertiary rounded px-2.5 py-1.5 border border-surface-border focus:outline-none focus:border-accent",style:{minHeight:"2.5rem"},disabled:!!c}),h.jsx("button",{onClick:C,disabled:!g.trim()||!!c,className:"px-2.5 py-1.5 text-accent hover:text-accent-hover disabled:text-text-muted transition-colors self-end","aria-label":"Send",children:h.jsx(IS,{className:"w-4 h-4",strokeWidth:1.5})})]})]})}const CC=6e3,MC="scan";function RC(){const{lastResult:n}=zm(),{open:t,ownerKey:s}=Rm(),[i,o]=E.useState(null);return E.useEffect(()=>{if(!n)return;const c=setTimeout(()=>o(n.at),CC);return()=>clearTimeout(c)},[n]),!n||n.navigated||i===n.at||t&&s===MC||n.source===To.TOOLBAR?null:h.jsx("div",{role:"status",className:"fixed bottom-14 right-4 z-[60] w-80 max-w-[calc(100vw-2rem)] bg-surface-raised border border-surface-border shadow-lg rounded-md animate-page-in",children:h.jsxs("div",{className:"flex items-start gap-2.5 px-3.5 py-3",children:[h.jsx(Mo,{className:"w-4 h-4 mt-0.5 text-accent-muted shrink-0",strokeWidth:1.5}),h.jsx("div",{className:"flex-1 min-w-0",children:h.jsx(Im,{result:n})}),h.jsx("button",{type:"button",onClick:()=>o(n.at),className:"text-text-tertiary hover:text-text-primary shrink-0",title:"Dismiss",children:h.jsx(Zt,{className:"w-3.5 h-3.5"})})]})})}const Jv="lt-announcement-dismissed:",DC="Live updates unavailable. Reconnecting… Refresh if this persists.";function LC(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function qC(n){try{return localStorage.getItem(`${Jv}${n}`)==="1"}catch{return!1}}function PC(){const{isAuthenticated:n,userRoleNames:t}=qt(),{data:s}=pv(n),i=Be(),[o,c]=E.useState(null),[m,p]=E.useState(0),{unavailable:g}=uO();An(ok,()=>{i.invalidateQueries({queryKey:["announcements"]})});const u=Date.now(),d=((s==null?void 0:s.announcements)??[]).filter(x=>!qC(x.id)&&new Date(x.expires_at).getTime()>u&&(x.roles.length===0||x.roles.some(v=>t.includes(v))));if(E.useEffect(()=>{const x=((s==null?void 0:s.announcements)??[]).map(w=>new Date(w.expires_at).getTime()-Date.now()).filter(w=>w>0);if(x.length===0)return;const v=setTimeout(()=>p(w=>w+1),Math.min(...x)+250);return()=>clearTimeout(v)},[s,m]),d.length===0&&!g)return null;const b=x=>{try{localStorage.setItem(`${Jv}${x}`,"1")}catch{}p(v=>v+1)};return h.jsxs("div",{"data-testid":"announcement-banner",className:"relative z-40",children:[g&&h.jsx("div",{"data-testid":"live-updates-notice",role:"status",className:"border-b border-status-warning/25 bg-status-warning/10",children:h.jsxs("div",{className:"flex items-center gap-2 px-4 py-1.5",children:[h.jsx("span",{className:"text-2xs font-semibold uppercase tracking-widest text-status-warning",children:"Notice"}),h.jsx("span",{className:"truncate text-xs text-text-primary",children:DC})]})}),d.map(x=>{const v=o===x.id,w=x.title??x.body.split(`
66
+ `)[0];return h.jsxs("div",{className:"border-b border-accent/25 bg-accent/10",children:[h.jsxs("div",{className:"flex items-center gap-2 px-4 py-1.5",children:[h.jsx("span",{className:"text-2xs font-semibold uppercase tracking-widest text-accent",children:"Notice"}),h.jsxs("button",{type:"button",onClick:()=>c(v?null:x.id),className:"flex items-center gap-1.5 text-xs text-text-primary hover:text-accent transition-colors min-w-0",children:[h.jsx("span",{className:"truncate",children:w}),v?h.jsx(hx,{className:"w-3 h-3 shrink-0",strokeWidth:1.5}):h.jsx(sm,{className:"w-3 h-3 shrink-0",strokeWidth:1.5})]}),h.jsx("div",{className:"flex-1"}),h.jsx("button",{type:"button",onClick:()=>b(x.id),className:"icon-link",title:"Dismiss","aria-label":`Dismiss ${w}`,children:h.jsx(Zt,{className:"w-3.5 h-3.5",strokeWidth:1.5})})]}),v&&h.jsx("div",{className:"px-4 pb-3 text-sm text-text-secondary max-w-measure",children:h.jsx(qu,{content:LC(x.body)})})]},x.id)})]})}function BC(){var U,ae;const{isBuilder:n,isOps:t,viewAs:s}=Wx(),{canSeePaceBoard:i}=Zx();xA();const{data:o}=er();Tj((U=o==null?void 0:o.display)==null?void 0:U.timeZone);const c=Kx(),m=c!==null?c:!!((ae=o==null?void 0:o.ai)!=null&&ae.enabled),{collapsed:p,toggle:g}=Cm(),[u,d]=E.useState(!1),[b,x]=E.useState(!1),[v,w]=E.useState(!1),[S,C]=E.useState(()=>window.location.hash.startsWith("#docs")),P=en(),q=E.useRef(null),{kiosk:re,homePath:se}=Nm(),M=re||Fj(P.pathname);return E.useEffect(()=>{const z=q.current;z&&(z.classList.remove("animate-page-in"),z.offsetWidth,z.classList.add("animate-page-in"))},[P.pathname]),E.useEffect(()=>{const z=()=>{window.location.hash.startsWith("#docs")&&C(!0)};return window.addEventListener("hashchange",z),()=>window.removeEventListener("hashchange",z)},[]),re&&se&&!Kj(P.pathname,P.search)?h.jsx(Sn,{to:se,replace:!0}):h.jsxs("div",{className:"h-screen bg-surface flex flex-col",children:[h.jsx(gT,{onToggleEventFeed:()=>d(z=>!z),onToggleDocs:()=>C(z=>!z),onToggleNav:M?void 0:()=>x(z=>!z)}),h.jsx(PC,{}),h.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[!M&&h.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:[h.jsx("nav",{className:"flex-1 px-3 pt-[36px] pb-4 space-y-2 overflow-y-auto overflow-x-hidden",children:h.jsx($v,{aiEnabled:m,isBuilder:n,isOps:t,viewAs:s,canSeePaceBoard:i})}),h.jsx("button",{onClick:g,className:`shrink-0 py-3 text-text-tertiary hover:text-text-secondary transition-colors duration-150 ${p?"flex justify-center":"flex items-center px-7"}`,"aria-label":p?"Expand sidebar":"Collapse sidebar",children:p?h.jsx($S,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5}):h.jsx(HS,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5})}),!p&&(o==null?void 0:o.environment)&&h.jsxs("div",{className:"shrink-0 px-5 pb-3 text-2xs leading-tight text-text-tertiary whitespace-nowrap overflow-hidden text-ellipsis",title:`long-tail v${o.environment.longTailVersion} · HotMesh v${o.environment.hotmeshVersion} · Node ${o.environment.nodeVersion} · ${o.environment.nodeEnv}`,children:["long-tail v",o.environment.longTailVersion,h.jsx("span",{className:"mx-1 text-surface-border",children:"·"}),"HotMesh v",o.environment.hotmeshVersion]})]}),h.jsx("main",{className:"flex-1 min-w-0 overflow-y-auto",children:h.jsx("div",{ref:q,className:"w-full px-page-x py-8 pb-16 animate-page-in h-full flex flex-col @container",children:h.jsx(ei,{})})}),h.jsx(UC,{})]}),!M&&h.jsx(FT,{open:b,onClose:()=>x(!1),aiEnabled:m,isBuilder:n,isOps:t,viewAs:s,canSeePaceBoard:i}),h.jsx(cC,{open:u,onToggle:()=>d(z=>!z),configOpen:v,onToggleConfig:()=>w(z=>!z)}),h.jsx(xC,{open:S,onClose:()=>{C(!1),history.replaceState(null,"",window.location.pathname+window.location.search)}}),m&&h.jsx(EC,{}),m&&h.jsx(TC,{}),h.jsx(RC,{})]})}function UC(){const{node:n,width:t,open:s}=Rm();return h.jsx(Zj,{open:s,width:t,className:"border-l border-surface-border bg-surface-raised",children:n})}function zC(){const{isAuthenticated:n}=qt(),t=en();return n?h.jsx(Qj,{children:h.jsx(Wj,{children:h.jsx(SC,{children:h.jsx(yA,{children:h.jsx(Gk,{children:h.jsx(BC,{})})})})})}):h.jsx(Sn,{to:"/login",state:{from:t.pathname},replace:!0})}function Qv({provider:n,className:t="w-5 h-5"}){switch(n){case"google":return h.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor",children:[h.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z",fill:"#4285F4"}),h.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z",fill:"#34A853"}),h.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z",fill:"#FBBC05"}),h.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z",fill:"#EA4335"})]});case"github":return h.jsx("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor",children:h.jsx("path",{d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0 1 12 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0 0 22 12.017C22 6.484 17.522 2 12 2z"})});case"microsoft":return h.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor",children:[h.jsx("path",{d:"M3 3h8.5v8.5H3z",fill:"#F25022"}),h.jsx("path",{d:"M12.5 3H21v8.5h-8.5z",fill:"#7FBA00"}),h.jsx("path",{d:"M3 12.5h8.5V21H3z",fill:"#00A4EF"}),h.jsx("path",{d:"M12.5 12.5H21V21h-8.5z",fill:"#FFB900"})]});case"anthropic":return h.jsx("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor",children:h.jsx("path",{d:"M13.827 3.52h3.603L24 20.48h-3.603l-6.57-16.96zm-7.258 0h3.767L16.906 20.48h-3.674l-1.343-3.461H6.396l-1.34 3.461H1.5l5.07-16.96zm2.327 5.14l-2.065 5.326h4.108l-2.043-5.326z"})});default:return h.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[h.jsx("circle",{cx:"12",cy:"12",r:"10"}),h.jsx("path",{d:"M12 8v4l3 3"})]})}}async function IC(){return ue("/auth/oauth/providers")}async function $C(n,t){const s=t?`?label=${encodeURIComponent(t)}`:"";return ue(`/auth/oauth/connections/${n}${s}`,{method:"DELETE"})}function BM(){return qe({queryKey:["oauth-connections"],queryFn:()=>ue("/auth/oauth/connections")})}function UM(){const n=Be();return Fe({mutationFn:({provider:t,label:s})=>$C(t,s),onSuccess:()=>{n.invalidateQueries({queryKey:["oauth-connections"]})}})}function HC(){var ae;const{login:n,isAuthenticated:t}=qt(),s=ni(),i=en(),o=new URLSearchParams(i.search),c=o.get("token"),m=o.get("error"),p=((ae=i.state)==null?void 0:ae.from)??o.get("returnTo")??"/",g=E.useRef(!1);c&&!g.current&&(g.current=!0,n(c,void 0,{displayName:o.get("displayName"),username:o.get("username")}));const[u,d]=E.useState(""),[b,x]=E.useState(""),[v,w]=E.useState(m||""),[S,C]=E.useState(!1),[P,q]=E.useState(!!c),[re,se]=E.useState([]),M=E.useRef(!1);if(E.useEffect(()=>{c||M.current||(M.current=!0,(async()=>{var z,I,D,X;try{const W=await om().catch(()=>null);if(!((z=W==null?void 0:W.auth)!=null&&z.sso))return;const he=await fetch(`${Vt}/api/auth/sso`,{method:"POST"});if(!he.ok){w("Host authentication required — please log in to your organization first");return}const we=await he.json();we.token&&((I=W.auth)!=null&&I.ssoLogoutUrl&&sessionStorage.setItem("lt_sso_logout_url",W.auth.ssoLogoutUrl),q(!0),n(we.token,void 0,{displayName:(D=we.user)==null?void 0:D.display_name,username:(X=we.user)==null?void 0:X.external_id}))}catch{}})())},[]),E.useEffect(()=>{c||IC().then(se).catch(()=>{})},[]),E.useEffect(()=>{if(!P)return;const z=setTimeout(()=>s(p,{replace:!0}),1500);return()=>clearTimeout(z)},[P]),t&&!P)return h.jsx(Sn,{to:p,replace:!0});const U=async z=>{var I,D;if(z.preventDefault(),w(""),!u.trim()||!b){w("Username and password are required");return}C(!0);try{const X=await fetch(`${Vt}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:u.trim(),password:b})}),W=await X.json();if(!X.ok){w(W.error||"Login failed");return}q(!0),n(W.token,{username:u.trim(),password:b},{displayName:(I=W.user)==null?void 0:I.display_name,username:(D=W.user)==null?void 0:D.external_id})}catch{w("Unable to connect to server")}finally{C(!1)}};return h.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center overflow-hidden",children:h.jsxs("div",{className:"w-full max-w-md p-10",children:[h.jsx("div",{className:`mb-10 transition-all duration-[1500ms] ease-in ${P?"translate-x-[120vw] -translate-y-[60vh] scale-[3] opacity-0":""}`,children:h.jsx(Mu,{size:"lg",hideLabel:P})}),h.jsxs("form",{onSubmit:U,className:`space-y-5 transition-opacity duration-300 ${P?"opacity-0":""}`,children:[h.jsxs("div",{children:[h.jsx("label",{htmlFor:"username",className:"block text-sm font-medium text-text-secondary mb-2",children:"Username"}),h.jsx("input",{id:"username",type:"text",value:u,onChange:z=>d(z.target.value),className:"input",placeholder:"Enter your username",autoFocus:!P,autoComplete:"username"})]}),h.jsxs("div",{children:[h.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-text-secondary mb-2",children:"Password"}),h.jsx("input",{id:"password",type:"password",value:b,onChange:z=>x(z.target.value),className:"input",placeholder:"Enter your password",autoComplete:"current-password"})]}),v&&h.jsx("p",{className:"text-sm text-status-error",children:v}),h.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:S||P,children:S?"Signing in...":"Sign In"}),re.length>0&&h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"flex items-center gap-3 mt-6",children:[h.jsx("div",{className:"flex-1 h-px bg-border"}),h.jsx("span",{className:"text-xs text-text-tertiary",children:"or continue with"}),h.jsx("div",{className:"flex-1 h-px bg-border"})]}),h.jsx("div",{className:"space-y-2",children:re.filter(z=>z.provider!=="anthropic").map(z=>h.jsxs("a",{href:`${Vt}/api/auth/oauth/${z.provider}?returnTo=${encodeURIComponent(p)}`,className:"btn-secondary w-full flex items-center justify-center gap-2",children:[h.jsx(Qv,{provider:z.provider}),"Sign in with ",z.name]},z.provider))})]})]})]})})}function ex(){const{isAuthenticated:n}=qt(),t=ni(),s=en(),i=new URLSearchParams(s.search),o=i.get("state")||"";E.useEffect(()=>{n||t(`/login?returnTo=${encodeURIComponent(s.pathname+s.search)}`)},[n]);const[c,m]=E.useState(""),[p,g]=E.useState(i.get("label")||"default"),[u,d]=E.useState(""),[b,x]=E.useState(!1),v=c.trim().startsWith("sk-ant-oat"),w=c.trim().startsWith("sk-ant-api"),S=C=>{C.preventDefault();const P=c.trim();if(!P){d("A token or API key is required");return}if(!P.startsWith("sk-ant-")){d('Invalid format. Must start with "sk-ant-oat" (OAuth token) or "sk-ant-api" (API key)');return}x(!0),d("");const q=`${Vt}/api/auth/oauth/anthropic/callback?code=${encodeURIComponent(P)}&state=${encodeURIComponent(o)}`;window.location.href=q};return h.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center",children:h.jsxs("div",{className:"w-full max-w-md p-10",children:[h.jsx("div",{className:"mb-10",children:h.jsx(Mu,{size:"lg"})}),h.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[h.jsx(Qv,{provider:"anthropic",className:"w-6 h-6"}),h.jsx("h2",{className:"heading-3",children:"Connect Anthropic"})]}),h.jsx("p",{className:"text-sm text-text-secondary mb-4",children:"Connect your Anthropic account so Claude Code tasks run under your credentials. Your token is encrypted at rest."}),h.jsxs("form",{onSubmit:S,className:"space-y-5",children:[h.jsxs("div",{children:[h.jsx("label",{htmlFor:"token",className:"block text-sm font-medium text-text-secondary mb-2",children:"OAuth Token or API Key"}),h.jsx("input",{id:"token",type:"password",value:c,onChange:C=>m(C.target.value),className:"input",placeholder:"sk-ant-oat01-... or sk-ant-api03-...",autoFocus:!0,autoComplete:"off"}),v&&h.jsx("p",{className:"text-xs text-status-success mt-1",children:"OAuth token detected — uses your Claude subscription (flat rate)"}),w&&h.jsx("p",{className:"text-xs text-status-warning mt-1",children:"API key detected — billed per-token from your Anthropic API account"})]}),h.jsxs("div",{children:[h.jsx("label",{htmlFor:"label",className:"block text-sm font-medium text-text-secondary mb-2",children:"Label"}),h.jsx("input",{id:"label",type:"text",value:p,onChange:C=>g(C.target.value.replace(/\s+/g,"-").toLowerCase()),className:"input",placeholder:"default",autoComplete:"off"}),h.jsx("p",{className:"text-xs text-text-tertiary mt-1",children:'A name for this credential. Use different labels to store multiple credentials (e.g., "subscription", "api-batch").'})]}),u&&h.jsx("p",{className:"text-sm text-status-error",children:u}),h.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:b,children:b?"Validating...":"Connect"}),h.jsx("a",{href:"/",className:"block text-center text-sm text-text-tertiary hover:text-text-secondary",children:"Cancel"})]}),h.jsxs("div",{className:"mt-6 space-y-3 text-xs text-text-tertiary",children:[h.jsxs("div",{children:[h.jsx("span",{className:"font-medium text-text-secondary",children:"Recommended:"})," ","Run"," ",h.jsx("code",{className:"px-1 py-0.5 bg-surface-sunken rounded text-2xs",children:"claude setup-token"})," ","in your terminal to generate an OAuth token that uses your subscription."]}),h.jsxs("div",{children:[h.jsx("span",{className:"font-medium text-text-secondary",children:"Alternative:"})," ","Use an API key from"," ",h.jsx("a",{href:"https://console.anthropic.com/settings/keys",target:"_blank",rel:"noopener noreferrer",className:"text-accent-secondary hover:underline",children:"console.anthropic.com"})," ","(billed per-token)."]})]})]})})}function FC({items:n,columns:t=1}){if(n.length===0)return null;const s=t>=2&&n.length>1?"grid-cols-1 @dict-inline:grid-cols-[max-content_1fr] @dict-pairs:grid-cols-[max-content_1fr_max-content_1fr]":"grid-cols-1 @dict-inline:grid-cols-[max-content_1fr]";return h.jsx("div",{className:"@container",children:h.jsx("dl",{className:`grid ${s} items-baseline gap-x-6 @dict-pairs:gap-x-8 gap-y-1.5`,children:n.map(({key:i,label:o,value:c})=>h.jsxs(E.Fragment,{children:[h.jsx("dt",{className:"text-2xs font-semibold uppercase tracking-wide text-text-secondary mt-2 first:mt-0 @dict-inline:mt-0",children:o}),h.jsx("dd",{className:"text-sm text-text-primary break-words whitespace-pre-wrap min-w-0","data-field-key":i,children:GC(c)})]},i))})})}function GC(n){return n==null||n===""?"—":typeof n=="boolean"?n?"Yes":"No":typeof n=="object"?JSON.stringify(n):String(n)}function VC(n){return qe({queryKey:["oauth-client",n],queryFn:()=>ue(`/oauth/clients/${encodeURIComponent(n)}`),enabled:!!n,retry:!1})}function YC(n){return qe({queryKey:["oauth-presets"],queryFn:()=>ue("/oauth/presets"),enabled:n})}function KC(){return Fe({mutationFn:n=>ue(n.preset?"/oauth/authorize":"/oauth/deny",{method:"POST",body:JSON.stringify(n.preset?{...n.request,preset:n.preset}:n.request)})})}function zM(){return qe({queryKey:["oauth-grants"],queryFn:()=>ue("/oauth/grants")})}function IM(){const n=Be();return Fe({mutationFn:t=>ue(`/oauth/grants/${encodeURIComponent(t)}`,{method:"DELETE"}),onSuccess:()=>n.invalidateQueries({queryKey:["oauth-grants"]})})}const JC=["client_id","redirect_uri","code_challenge","code_challenge_method","response_type","state","scope","resource"],pd={read_only:{action:"Allow read-only",effect:"Reads what you can read and runs workflows marked read-safe."},just_me:{action:"Allow as me",effect:"Acts with your full rights: claims, resolves, invokes, and administers wherever you may."}};function QC(n){const t=new URLSearchParams(n),s=JC.map(o=>[o,t.get(o)??void 0]),i=Object.fromEntries(s);return!i.client_id||!i.redirect_uri||!i.code_challenge?null:i}function XC(n){try{return new URL(n).host}catch{return n}}function WC(){var b,x,v;const{isAuthenticated:n,user:t}=qt(),s=ni(),i=en(),o=E.useMemo(()=>QC(i.search),[i.search]);E.useEffect(()=>{n||s(`/login?returnTo=${encodeURIComponent(i.pathname+i.search)}`,{replace:!0})},[n]);const c=VC(n&&o?o.client_id:null),m=YC(n&&!!o),p=KC(),g=w=>{o&&p.mutate({request:o,preset:w},{onSuccess:({redirect:S})=>window.location.assign(S)})};if(!n)return null;const u=!o||c.isError,d=((b=c.data)==null?void 0:b.client_name)||"An app";return h.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center",children:h.jsxs("div",{className:"w-full max-w-lg p-10",children:[h.jsx("div",{className:"mb-10",children:h.jsx(Mu,{size:"lg"})}),u?h.jsxs("div",{role:"alert",children:[h.jsx("h2",{className:"heading-3 mb-3",children:"Sign-in link not valid"}),h.jsx("p",{className:"text-sm text-text-secondary",children:"Start the connection again from the app."})]}):h.jsxs(h.Fragment,{children:[h.jsxs("h2",{className:"heading-2 mb-2",children:["Connect ",d]}),h.jsxs("p",{className:"text-sm text-text-secondary mb-6",children:["Pick how much ",d," may do as you. Disconnect it any time under Connected apps."]}),h.jsx("div",{className:"mb-8",children:h.jsx(FC,{items:[{key:"app",label:"App",value:d},{key:"account",label:"Account",value:(t==null?void 0:t.displayName)||(t==null?void 0:t.username)||(t==null?void 0:t.userId)||null},{key:"returns-to",label:"Returns to",value:XC(o.redirect_uri)},{key:"deployment",label:"Deployment",value:window.location.host}]})}),h.jsx("dl",{className:"space-y-3 mb-8",children:(((x=m.data)==null?void 0:x.presets)??[]).map(w=>h.jsxs("div",{children:[h.jsx("dt",{className:"text-sm font-medium text-text-primary",children:pd[w].action}),h.jsx("dd",{className:"text-sm text-text-secondary",children:pd[w].effect})]},w))}),p.isError&&h.jsx("p",{className:"text-sm text-status-error mb-4",role:"alert",children:p.error.message}),h.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[(((v=m.data)==null?void 0:v.presets)??[]).map(w=>h.jsx("button",{type:"button",className:w==="read_only"?"btn-primary":"btn-secondary",disabled:p.isPending||c.isLoading,onClick:()=>g(w),children:pd[w].action},w)),h.jsx("button",{type:"button",className:"btn-ghost",disabled:p.isPending,onClick:()=>g(null),children:"Deny"})]})]})]})})}function po({roleTypes:n,roleNames:t,redirectTo:s="/"}){const{isSuperAdmin:i,hasRole:o,hasRoleType:c}=qt();return i?h.jsx(ei,{}):n&&n.some(m=>c(m))?h.jsx(ei,{}):t&&t.some(m=>o(m))?h.jsx(ei,{}):h.jsx(Sn,{to:s,replace:!0})}function ZC(){const{data:n,isSuccess:t}=Iv();return t&&n.length===0?h.jsx(Sn,{to:"/",replace:!0}):h.jsx(ei,{})}function e3({redirectTo:n="/"}){var i;const{data:t,isLoading:s}=er();return s||!t?null:(i=t.ai)!=null&&i.enabled?h.jsx(ei,{}):h.jsx(Sn,{to:n,replace:!0})}function t3({flag:n,redirectTo:t="/"}){var o;const{data:s,isLoading:i}=er();return i||!s?null:((o=s.features)==null?void 0:o[n])===!1?h.jsx(Sn,{to:t,replace:!0}):h.jsx(ei,{})}const n3=E.lazy(()=>ke(()=>import("./ProcessesListPage-C3OM5ZUy.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]),import.meta.url).then(n=>({default:n.ProcessesListPage}))),r3=E.lazy(()=>ke(()=>import("./ProcessDetailPage-liJspvQh.js"),__vite__mapDeps([17,1,2,18,13,19,16,10,4,20,21]),import.meta.url).then(n=>({default:n.ProcessDetailPage}))),s3=E.lazy(()=>ke(()=>import("./McpOverview-BOPo3J_i.js"),__vite__mapDeps([22,1,23,24,25,26,14,13,27,4]),import.meta.url).then(n=>({default:n.McpOverview}))),i3=E.lazy(()=>ke(()=>import("./McpRunsPage-Bi9AMWja.js"),__vite__mapDeps([28,1,24,25,3,4,29,26,6,7,8,9,16,13,30,14,12,11,15,31]),import.meta.url).then(n=>({default:n.McpRunsPage}))),a3=E.lazy(()=>ke(()=>import("./McpRunDetailPage-bMXNO-6V.js"),__vite__mapDeps([32,1,24,14,13,33,34,12,35,19,4,36,15,37]),import.meta.url).then(n=>({default:n.McpRunDetailPage}))),o3=E.lazy(()=>ke(()=>import("./McpQueryPage-Dmbb6SAc.js"),__vite__mapDeps([38,1,14,13,7,8,9,12,11,15,6,10,30,16,31,3,4,39]),import.meta.url).then(n=>({default:n.McpQueryPage}))),l3=E.lazy(()=>ke(()=>import("./McpQueryDetailPage-BRVVi0Zh.js"),__vite__mapDeps([40,1,14,13,19,39,4,25,41,42,24,2,43,44,45,46,47,48,37,49,35,36]),import.meta.url).then(n=>({default:n.McpQueryDetailPage}))),c3=E.lazy(()=>ke(()=>import("./EscalationsOverview-BX8Cpi0X.js"),__vite__mapDeps([50,1,14,13,27,4]),import.meta.url).then(n=>({default:n.EscalationsOverview}))),u3=E.lazy(()=>ke(()=>import("./AvailableEscalationsPage-IS28XBRe.js"),__vite__mapDeps([51,1,4,52,13,53,54,5,55,56,57,19,7,8,9,58,59,21,11,60,61,12,62,20,16,3,31]),import.meta.url).then(n=>({default:n.AvailableEscalationsPage}))),f3=E.lazy(()=>ke(()=>import("./OperatorDashboard-DctmZw10.js"),__vite__mapDeps([63,1,3,4,5,6,52,7,8,9,11,31,58,57,19,13,59,21,60,61,12,62,20,16,55,15]),import.meta.url).then(n=>({default:n.OperatorDashboard}))),h3=E.lazy(()=>ke(()=>import("./index-CniRa65p.js"),__vite__mapDeps([64,1,65,13,57,19,4,54,16,53,5,14,15,20,60,37,21,66]),import.meta.url).then(n=>({default:n.EscalationDetailPage}))),d3=E.lazy(()=>ke(()=>import("./WorkflowsOverview-grI-KAI2.js"),__vite__mapDeps([67,1,14,13,27,4]),import.meta.url).then(n=>({default:n.WorkflowsOverview}))),m3=E.lazy(()=>ke(()=>import("./index-CxdjT1Yk.js"),__vite__mapDeps([68,1,14,13,12,16,65,57,19,4,54,69,46,47]),import.meta.url).then(n=>({default:n.StartWorkflowPage}))),p3=E.lazy(()=>ke(()=>import("./index-CxdjT1Yk.js"),__vite__mapDeps([68,1,14,13,12,16,65,57,19,4,54,69,46,47]),import.meta.url).then(n=>({default:n.DurableInvokePage}))),y3=E.lazy(()=>ke(()=>import("./WorkflowsDashboard-nxT3bv6W.js"),__vite__mapDeps([70,1,30,29,26,4,3,6,7,8,9,16,13,14,12,11,15,31]),import.meta.url).then(n=>({default:()=>n.WorkflowsDashboard({tier:"durable"})}))),g3=E.lazy(()=>ke(()=>import("./WorkflowsDashboard-nxT3bv6W.js"),__vite__mapDeps([70,1,30,29,26,4,3,6,7,8,9,16,13,14,12,11,15,31]),import.meta.url).then(n=>({default:()=>n.WorkflowsDashboard({tier:"all"})}))),b3=E.lazy(()=>ke(()=>import("./YamlWorkflowsPage-Bf04rwRv.js"),__vite__mapDeps([71,1,25,3,4,14,13,12,8,48,69,19]),import.meta.url).then(n=>({default:n.YamlWorkflowsPage}))),x3=E.lazy(()=>ke(()=>import("./GraphInvokePage-DKUErxWc.js"),__vite__mapDeps([72,1,25,14,13,43,45,46,47,44,4,48,69]),import.meta.url).then(n=>({default:n.GraphInvokePage}))),v3=E.lazy(()=>ke(()=>import("./YamlWorkflowDetailPage-BoZ-hfBE.js"),__vite__mapDeps([73,1,25,19,69,13,4]),import.meta.url).then(n=>({default:n.YamlWorkflowDetailPage}))),_3=E.lazy(()=>ke(()=>import("./TasksListPage-CDWnm_d9.js"),__vite__mapDeps([74,1,2,3,4,7,8,9,19,62,49,11,12,13,14,16]),import.meta.url).then(n=>({default:n.TasksListPage}))),w3=E.lazy(()=>ke(()=>import("./TaskDetailPage-bbNSv4Ae.js"),__vite__mapDeps([75,1,2,19,62,14,13,4]),import.meta.url).then(n=>({default:n.TaskDetailPage}))),tx=E.lazy(()=>ke(()=>import("./WorkflowExecutionPage-B8g81FCJ.js"),__vite__mapDeps([76,1,34,12,13,35,19,4,36,2,14,33,15,37]),import.meta.url).then(n=>({default:n.WorkflowExecutionPage}))),S3=E.lazy(()=>ke(()=>import("./AdminDashboard-B3mkMIOT.js"),__vite__mapDeps([77,1,2,23,18,13,4]),import.meta.url).then(n=>({default:n.AdminDashboard}))),E3=E.lazy(()=>ke(()=>import("./index-ag2pCAPu.js"),__vite__mapDeps([78,1,7,8,9,12,13,31,3,4,14,79,16]),import.meta.url).then(n=>({default:n.WorkersPage}))),O3=E.lazy(()=>ke(()=>import("./index-gkxPN7Vx.js"),__vite__mapDeps([80,1,12,13,81,20,16,14,4,46,47,69,65,57,19,54]),import.meta.url).then(n=>({default:n.WorkflowConfigsPage}))),nx=E.lazy(()=>ke(()=>import("./index-gkxPN7Vx.js"),__vite__mapDeps([80,1,12,13,81,20,16,14,4,46,47,69,65,57,19,54]),import.meta.url).then(n=>({default:n.WorkflowConfigDetailPage}))),A3=E.lazy(()=>ke(()=>import("./index-DN-kX7hL.js"),__vite__mapDeps([82,1,23,8,81,14,13,12,11,3,4,83,45,46,47,48,44,31,19]),import.meta.url).then(n=>({default:n.McpServersPage}))),rx=E.lazy(()=>ke(()=>import("./index-Dl_8hbYI.js"),__vite__mapDeps([84,1,23,14,13,41,4]),import.meta.url).then(n=>({default:n.McpServerDetailPage}))),j3=E.lazy(()=>ke(()=>import("./index-HLu98Sqh.js"),__vite__mapDeps([85,1,3,4,7,8,9,11,12,13,81,31,14,20,47,49,86,87,33]),import.meta.url).then(n=>({default:n.UsersPage}))),k3=E.lazy(()=>ke(()=>import("./RolesPage-BaazL_pt.js"),__vite__mapDeps([88,1,12,13,14,20,4]),import.meta.url).then(n=>({default:n.RolesPage}))),N3=E.lazy(()=>ke(()=>import("./RoleDetailPage-CrlYCh-R.js"),__vite__mapDeps([89,1,90,81,13,4]),import.meta.url).then(n=>({default:n.RoleDetailPage}))),T3=E.lazy(()=>ke(()=>import("./PersonasPage-BpFL2rpo.js"),__vite__mapDeps([91,1,86,12,13,14,20,4,5]),import.meta.url).then(n=>({default:n.PersonasPage}))),C3=E.lazy(()=>ke(()=>import("./PersonaDetailPage-Ubqm2rQH.js"),__vite__mapDeps([92,1,86,20,13,87,90,81,4]),import.meta.url).then(n=>({default:n.PersonaDetailPage}))),M3=E.lazy(()=>ke(()=>import("./EscalationSchemaPage-Dx2Lyfrz.js"),__vite__mapDeps([93,1,65,13,57,19,4,54,16]),import.meta.url).then(n=>({default:n.EscalationSchemaPage}))),R3=E.lazy(()=>ke(()=>import("./PortalPage-Dfc_Q02R.js"),__vite__mapDeps([94,1,9,56,13,57,19,4,7,8,58,59,21,11,60,61,12,62,20,16]),import.meta.url).then(n=>({default:n.PortalPage}))),D3=E.lazy(()=>ke(()=>import("./EscalationListSchemaPage-CMrUlaKI.js"),__vite__mapDeps([95,1,13,4]),import.meta.url).then(n=>({default:n.EscalationListSchemaPage}))),L3=E.lazy(()=>ke(()=>import("./ScanCodesPage-C0mvmYTq.js"),__vite__mapDeps([96,1,97,14,13,4]),import.meta.url).then(n=>({default:n.ScanCodesPage}))),q3=E.lazy(()=>ke(()=>import("./ScanSchemeDetailPage-CiJgt5dZ.js"),__vite__mapDeps([98,1,81,14,13,97,4]),import.meta.url).then(n=>({default:n.ScanSchemeDetailPage}))),P3=E.lazy(()=>ke(()=>import("./ScanStationPage-DzGaXc40.js"),__vite__mapDeps([99,1,13,66,59,21,4]),import.meta.url).then(n=>({default:n.ScanStationPage}))),B3=E.lazy(()=>ke(()=>import("./index-Dy1wWu2e.js"),__vite__mapDeps([100,1,14,13,54,4]),import.meta.url).then(n=>({default:n.MaintenancePage}))),sx=E.lazy(()=>ke(()=>import("./OperationsPage-CvR74ZUJ.js").then(n=>n.O),__vite__mapDeps([101,1,61,13,4,14,9]),import.meta.url).then(n=>({default:n.OperationsPage}))),U3=E.lazy(()=>ke(()=>import("./index-BzYcUPdD.js"),__vite__mapDeps([102,1,18,13,12,3,4,29,26,42,79,7,8,9,31]),import.meta.url).then(n=>({default:n.ControlPlanePage}))),z3=E.lazy(()=>ke(()=>import("./index-DpKOr311.js"),__vite__mapDeps([103,1,36,13,3,4,29,26,6,7,8,9,11,12,14,15]),import.meta.url).then(n=>({default:n.StreamMessagesPage}))),I3=E.lazy(()=>ke(()=>import("./CredentialsPage-CaFQ6vLb.js"),__vite__mapDeps([104,1,14,13,49,81,4]),import.meta.url).then(n=>({default:n.CredentialsPage}))),$3=E.lazy(()=>ke(()=>import("./ConnectedAppsPage-drZa65kP.js"),__vite__mapDeps([105,1,14,13,49,81,4]),import.meta.url).then(n=>({default:n.ConnectedAppsPage}))),H3=E.lazy(()=>ke(()=>import("./index-ChV7pBjM.js"),__vite__mapDeps([106,1,4,14,13,12,15,6,8,107,49]),import.meta.url).then(n=>({default:n.FilesPage}))),F3=E.lazy(()=>ke(()=>import("./index-DAvi5_2T.js"),__vite__mapDeps([108,1,14,13,12,15,11,8,107,49,109,41,4]),import.meta.url).then(n=>({default:n.KnowledgePage}))),G3=E.lazy(()=>ke(()=>import("./HomePage-C6u9dIpR.js"),__vite__mapDeps([110,1,24,26,20,13,16,15,101,61,4,14,9,52]),import.meta.url).then(n=>({default:n.HomePage}))),V3=E.lazy(()=>ke(()=>import("./AgentsPage-jg2OFwyW.js"),__vite__mapDeps([111,1,112,3,4,6,7,8,9,11,12,13,14,15]),import.meta.url).then(n=>({default:n.AgentsPage}))),Y3=E.lazy(()=>ke(()=>import("./AgentDetailPage-CzrD8JJI.js"),__vite__mapDeps([113,1,112,114,13,16,4]),import.meta.url).then(n=>({default:n.AgentDetailPage}))),ix=E.lazy(()=>ke(()=>import("./AgentConfigPage-CQj2B678.js"),__vite__mapDeps([115,1,112,114,13,14,109,45,46,47,25,116,117,16,4]),import.meta.url).then(n=>({default:n.AgentConfigPage}))),K3=E.lazy(()=>ke(()=>import("./CapabilitiesPage-kwlrcb_t.js"),__vite__mapDeps([118,1,116,83,23,45,46,47,13,48,4,44,14,12]),import.meta.url).then(n=>({default:n.CapabilitiesPage}))),J3=E.lazy(()=>ke(()=>import("./TopicsPage-CVcCYdy-.js"),__vite__mapDeps([119,1,117,14,13,12,4]),import.meta.url).then(n=>({default:n.TopicsPage}))),Q3=E.lazy(()=>ke(()=>import("./TopicDetailPage-g3pljKKX.js"),__vite__mapDeps([120,1,117,15,13,4]),import.meta.url).then(n=>({default:n.TopicDetailPage})));function X3(){return h.jsxs("div",{className:"animate-pulse space-y-4",children:[h.jsx("div",{className:"h-8 bg-surface-sunken rounded w-48"}),h.jsx("div",{className:"h-40 bg-surface-sunken rounded"})]})}function Ee({children:n}){return h.jsx(E.Suspense,{fallback:h.jsx(X3,{}),children:h.jsx("div",{className:"animate-page-enter flex flex-col flex-1 min-h-0",children:n})})}const Xv=new uS({defaultOptions:{queries:{staleTime:1e4,retry:(n,t)=>t instanceof Error&&t.message==="Session expired"?!1:n<1}}});window.addEventListener("auth:unauthorized",()=>{Xv.clear(),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info");const n=window.__LT_BASE__||"",t=`${n}/login`;if(window.location.pathname!==t){const s=window.location.pathname+window.location.search,i=n&&s.startsWith(n)?s.slice(n.length)||"/":s;window.location.href=`${t}?returnTo=${encodeURIComponent(i)}`}});const W3=dS([{path:"/login",element:h.jsx(HC,{})},{path:"/connect/anthropic",element:h.jsx(ex,{})},{path:"/connect/:provider",element:h.jsx(ex,{})},{path:"/oauth/consent",element:h.jsx(WC,{})},{path:"/",element:h.jsx(zC,{}),children:[{index:!0,element:h.jsx(Ee,{children:h.jsx(G3,{})})},{path:"processes/all",element:h.jsx(Ee,{children:h.jsx(n3,{})})},{path:"processes/detail/:originId",element:h.jsx(Ee,{children:h.jsx(r3,{})})},{path:"credentials",element:h.jsx(Ee,{children:h.jsx(I3,{})})},{path:"connected-apps",element:h.jsx(Ee,{children:h.jsx($3,{})})},{path:"connections",element:h.jsx(Sn,{to:"/credentials",replace:!0})},{path:"escalations",element:h.jsx(Ee,{children:h.jsx(c3,{})})},{path:"escalations/available",element:h.jsx(Ee,{children:h.jsx(u3,{})})},{path:"escalations/queue",element:h.jsx(Ee,{children:h.jsx(f3,{})})},{path:"escalations/detail/:id",element:h.jsx(Ee,{children:h.jsx(h3,{})})},{path:"portal/:role/:portal?",element:h.jsx(Ee,{children:h.jsx(R3,{})})},{path:"scan/station",element:h.jsx(Ee,{children:h.jsx(P3,{})})},{path:"capabilities",element:h.jsx(Ee,{children:h.jsx(K3,{})})},{element:h.jsx(po,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"agents",element:h.jsx(Ee,{children:h.jsx(V3,{})})},{path:"agents/new",element:h.jsx(Ee,{children:h.jsx(ix,{})})},{path:"agents/:id",element:h.jsx(Ee,{children:h.jsx(Y3,{})})},{path:"agents/:id/edit",element:h.jsx(Ee,{children:h.jsx(ix,{})})},{path:"topics",element:h.jsx(Ee,{children:h.jsx(J3,{})})},{path:"topics/:topic",element:h.jsx(Ee,{children:h.jsx(Q3,{})})}]},{element:h.jsx(ZC,{}),children:[{path:"workflows/start",element:h.jsx(Ee,{children:h.jsx(m3,{})})},{path:"workflows/durable/invoke",element:h.jsx(Ee,{children:h.jsx(p3,{})})}]},{element:h.jsx(po,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"workflows",element:h.jsx(Ee,{children:h.jsx(d3,{})})},{path:"workflows/executions",element:h.jsx(Ee,{children:h.jsx(g3,{})})},{path:"workflows/durable/executions",element:h.jsx(Ee,{children:h.jsx(y3,{})})},{path:"workflows/durable/executions/:workflowId",element:h.jsx(Ee,{children:h.jsx(tx,{})})},{path:"workflows/tasks",element:h.jsx(Ee,{children:h.jsx(_3,{})})},{path:"workflows/tasks/detail/:id",element:h.jsx(Ee,{children:h.jsx(w3,{})})},{path:"workflows/executions/:workflowId",element:h.jsx(Ee,{children:h.jsx(tx,{})})},{path:"workflows/cron",element:h.jsx(Sn,{to:"/workflows/start?mode=schedule",replace:!0})},{path:"workflows/workers",element:h.jsx(Ee,{children:h.jsx(E3,{})})},{path:"workflows/registry",element:h.jsx(Ee,{children:h.jsx(O3,{})})},{path:"workflows/registry/new",element:h.jsx(Ee,{children:h.jsx(nx,{})})},{path:"workflows/registry/:workflowType",element:h.jsx(Ee,{children:h.jsx(nx,{})})}]},{element:h.jsx(po,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"mcp/workflows",element:h.jsx(Ee,{children:h.jsx(b3,{})})},{path:"mcp/workflows/invoke",element:h.jsx(Ee,{children:h.jsx(x3,{})})},{path:"mcp/workflows/:id",element:h.jsx(Ee,{children:h.jsx(v3,{})})},{path:"mcp/executions",element:h.jsx(Ee,{children:h.jsx(i3,{})})},{path:"mcp/executions/:jobId",element:h.jsx(Ee,{children:h.jsx(a3,{})})},{path:"files",element:h.jsx(Ee,{children:h.jsx(H3,{})})},{path:"knowledge",element:h.jsx(Ee,{children:h.jsx(F3,{})})},{element:h.jsx(e3,{}),children:[{path:"mcp",element:h.jsx(Ee,{children:h.jsx(s3,{})})},{path:"mcp/queries",element:h.jsx(Ee,{children:h.jsx(o3,{})})},{path:"mcp/queries/:workflowId",element:h.jsx(Ee,{children:h.jsx(l3,{})})},{path:"mcp/tools",element:h.jsx(Sn,{to:"/mcp/servers",replace:!0})},{path:"mcp/servers",element:h.jsx(Ee,{children:h.jsx(A3,{})})},{path:"mcp/servers/new",element:h.jsx(Ee,{children:h.jsx(rx,{})})},{path:"mcp/servers/:serverId",element:h.jsx(Ee,{children:h.jsx(rx,{})})}]}]},{path:"pace",element:h.jsx(Ee,{children:h.jsx(sx,{})})},{path:"trends",element:h.jsx(Ee,{children:h.jsx(sx,{})})},{path:"operations",element:h.jsx(Sn,{to:"/pace",replace:!0})},{element:h.jsx(po,{roleTypes:["admin","superadmin"],roleNames:["engineer"]}),children:[{path:"admin",element:h.jsx(Ee,{children:h.jsx(S3,{})})},{path:"admin/users",element:h.jsx(Ee,{children:h.jsx(j3,{})})},{path:"admin/escalation-chains",element:h.jsx(Sn,{to:"/admin/roles",replace:!0})},{path:"admin/roles",element:h.jsx(Ee,{children:h.jsx(k3,{})})},{path:"admin/roles/:role",element:h.jsx(Ee,{children:h.jsx(N3,{})})},{path:"admin/roles/:role/schema",element:h.jsx(Ee,{children:h.jsx(M3,{})})},{path:"admin/roles/:role/list-schema",element:h.jsx(Ee,{children:h.jsx(D3,{})})},{path:"admin/scan-codes",element:h.jsx(Ee,{children:h.jsx(L3,{})})},{path:"admin/scan-codes/:version",element:h.jsx(Ee,{children:h.jsx(q3,{})})},{path:"admin/personas",element:h.jsx(Ee,{children:h.jsx(T3,{})})},{path:"admin/personas/:key",element:h.jsx(Ee,{children:h.jsx(C3,{})})}]},{element:h.jsx(po,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"admin/bots",element:h.jsx(Sn,{to:"/admin/users?tab=service-accounts",replace:!0})},{element:h.jsx(t3,{flag:"dbMaintenance"}),children:[{path:"admin/maintenance",element:h.jsx(Ee,{children:h.jsx(B3,{})})}]},{path:"admin/controlplane",element:h.jsx(Ee,{children:h.jsx(U3,{})})},{path:"admin/streams",element:h.jsx(Ee,{children:h.jsx(z3,{})})}]}]}],{basename:window.__LT_BASE__||"/"});function Z3(){return h.jsx(fS,{client:Xv,children:h.jsx(sE,{children:h.jsx(lA,{children:h.jsx(mS,{router:W3})})})})}wv(_v());const Fm=document.createElement("link");Fm.rel="stylesheet";Fm.href=`${Vt}/api/settings/custom.css`;document.head.appendChild(Fm);KS.createRoot(document.getElementById("root")).render(h.jsx(E.StrictMode,{children:h.jsx(Z3,{})}));export{qt as $,Ik as A,xM as B,Hm as C,OC as D,N5 as E,Fv as F,vM as G,Rm as H,ST as I,aC as J,ET as K,RT as L,YN as M,Xt as N,Wx as O,E5 as P,Nm as Q,U5 as R,KT as S,z5 as T,I5 as U,$5 as V,H5 as W,G5 as X,Bj as Y,Cu as Z,k5 as _,kM as a,lM as a$,tm as a0,NT as a1,p5 as a2,OM as a3,qm as a4,ta as a5,xs as a6,D5 as a7,g5 as a8,dv as a9,NM as aA,Iv as aB,CM as aC,jM as aD,yv as aE,K5 as aF,DM as aG,AM as aH,qM as aI,LM as aJ,o5 as aK,l5 as aL,h5 as aM,d5 as aN,c5 as aO,u5 as aP,f5 as aQ,x5 as aR,_5 as aS,v5 as aT,wM as aU,m5 as aV,km as aW,w5 as aX,TT as aY,S5 as aZ,y5 as a_,pT as aa,Ok as ab,hM as ac,Hk as ad,dc as ae,q5 as af,P5 as ag,qu as ah,$k as ai,qN as aj,_M as ak,Ov as al,tv as am,Bm as an,Pj as ao,gA as ap,C5 as aq,rM as ar,M5 as as,B5 as at,F5 as au,Rj as av,Bg as aw,i5 as ax,RM as ay,TM as az,X5 as b,js as b0,Eo as b1,PM as b2,Rx as b3,FC as b4,aM as b5,Vt as b6,_d as b7,a5 as b8,AT as b9,dM as bA,A5 as bB,Z5 as bC,KN as bD,BM as bE,UM as bF,Qv as bG,zM as bH,IM as bI,Om as bJ,Zx as bK,sM as bL,EM as ba,mv as bb,G1 as bc,Av as bd,nM as be,Am as bf,eM as bg,uM as bh,Aj as bi,cM as bj,fr as bk,nv as bl,oM as bm,ea as bn,b5 as bo,Lk as bp,pM as bq,mk as br,gM as bs,bM as bt,mM as bu,yM as bv,zm as bw,uk as bx,Fk as by,je as bz,er as c,fM as d,V5 as e,fk as f,gv as g,Zj as h,O5 as i,tn as j,An as k,Y5 as l,ue as m,MM as n,J5 as o,Q5 as p,T5 as q,R5 as r,L5 as s,W5 as t,iM as u,j5 as v,$m as w,SM as x,Kx as y,tM as z};
67
+ //# sourceMappingURL=index-CeCtqujG.js.map