@hotmeshio/long-tail 0.1.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 (809) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +262 -0
  3. package/build/examples/external-mcp-server/server.d.ts +17 -0
  4. package/build/examples/external-mcp-server/server.js +116 -0
  5. package/build/examples/index.d.ts +2 -0
  6. package/build/examples/index.js +7 -0
  7. package/build/examples/seed.d.ts +5 -0
  8. package/build/examples/seed.js +221 -0
  9. package/build/examples/types/envelopes.d.ts +34 -0
  10. package/build/examples/types/envelopes.js +8 -0
  11. package/build/examples/types/index.d.ts +10 -0
  12. package/build/examples/types/index.js +9 -0
  13. package/build/examples/types/resolvers.d.ts +27 -0
  14. package/build/examples/types/resolvers.js +9 -0
  15. package/build/examples/workers.d.ts +10 -0
  16. package/build/examples/workers.js +49 -0
  17. package/build/examples/workflows/basic-echo/activities.d.ts +20 -0
  18. package/build/examples/workflows/basic-echo/activities.js +55 -0
  19. package/build/examples/workflows/basic-echo/index.d.ts +14 -0
  20. package/build/examples/workflows/basic-echo/index.js +66 -0
  21. package/build/examples/workflows/kitchen-sink/activities.d.ts +40 -0
  22. package/build/examples/workflows/kitchen-sink/activities.js +46 -0
  23. package/build/examples/workflows/kitchen-sink/index.d.ts +22 -0
  24. package/build/examples/workflows/kitchen-sink/index.js +123 -0
  25. package/build/examples/workflows/review-content/activities.d.ts +10 -0
  26. package/build/examples/workflows/review-content/activities.js +44 -0
  27. package/build/examples/workflows/review-content/index.d.ts +10 -0
  28. package/build/examples/workflows/review-content/index.js +95 -0
  29. package/build/examples/workflows/review-content/types.d.ts +28 -0
  30. package/build/examples/workflows/review-content/types.js +2 -0
  31. package/build/index.d.ts +37 -0
  32. package/build/index.js +151 -0
  33. package/build/modules/auth.d.ts +58 -0
  34. package/build/modules/auth.js +163 -0
  35. package/build/modules/config.d.ts +19 -0
  36. package/build/modules/config.js +26 -0
  37. package/build/modules/defaults.d.ts +58 -0
  38. package/build/modules/defaults.js +95 -0
  39. package/build/modules/ltconfig.d.ts +21 -0
  40. package/build/modules/ltconfig.js +110 -0
  41. package/build/modules/maintenance.d.ts +18 -0
  42. package/build/modules/maintenance.js +47 -0
  43. package/build/routes/auth.d.ts +2 -0
  44. package/build/routes/auth.js +48 -0
  45. package/build/routes/bot-accounts.d.ts +2 -0
  46. package/build/routes/bot-accounts.js +280 -0
  47. package/build/routes/controlplane.d.ts +2 -0
  48. package/build/routes/controlplane.js +144 -0
  49. package/build/routes/dba.d.ts +2 -0
  50. package/build/routes/dba.js +86 -0
  51. package/build/routes/delegation.d.ts +2 -0
  52. package/build/routes/delegation.js +81 -0
  53. package/build/routes/escalations/bulk.d.ts +2 -0
  54. package/build/routes/escalations/bulk.js +324 -0
  55. package/build/routes/escalations/helpers.d.ts +5 -0
  56. package/build/routes/escalations/helpers.js +48 -0
  57. package/build/routes/escalations/index.d.ts +2 -0
  58. package/build/routes/escalations/index.js +20 -0
  59. package/build/routes/escalations/list.d.ts +2 -0
  60. package/build/routes/escalations/list.js +140 -0
  61. package/build/routes/escalations/resolve.d.ts +2 -0
  62. package/build/routes/escalations/resolve.js +240 -0
  63. package/build/routes/escalations/single.d.ts +2 -0
  64. package/build/routes/escalations/single.js +195 -0
  65. package/build/routes/exports.d.ts +2 -0
  66. package/build/routes/exports.js +163 -0
  67. package/build/routes/files.d.ts +2 -0
  68. package/build/routes/files.js +47 -0
  69. package/build/routes/index.d.ts +2 -0
  70. package/build/routes/index.js +52 -0
  71. package/build/routes/insight.d.ts +2 -0
  72. package/build/routes/insight.js +58 -0
  73. package/build/routes/maintenance.d.ts +2 -0
  74. package/build/routes/maintenance.js +38 -0
  75. package/build/routes/mcp-runs.d.ts +2 -0
  76. package/build/routes/mcp-runs.js +85 -0
  77. package/build/routes/mcp.d.ts +2 -0
  78. package/build/routes/mcp.js +264 -0
  79. package/build/routes/namespaces.d.ts +2 -0
  80. package/build/routes/namespaces.js +71 -0
  81. package/build/routes/oauth.d.ts +7 -0
  82. package/build/routes/oauth.js +217 -0
  83. package/build/routes/resolve.d.ts +9 -0
  84. package/build/routes/resolve.js +19 -0
  85. package/build/routes/roles.d.ts +2 -0
  86. package/build/routes/roles.js +195 -0
  87. package/build/routes/settings.d.ts +2 -0
  88. package/build/routes/settings.js +35 -0
  89. package/build/routes/tasks.d.ts +2 -0
  90. package/build/routes/tasks.js +133 -0
  91. package/build/routes/users.d.ts +2 -0
  92. package/build/routes/users.js +206 -0
  93. package/build/routes/workflows/config.d.ts +2 -0
  94. package/build/routes/workflows/config.js +123 -0
  95. package/build/routes/workflows/discovery.d.ts +2 -0
  96. package/build/routes/workflows/discovery.js +146 -0
  97. package/build/routes/workflows/index.d.ts +2 -0
  98. package/build/routes/workflows/index.js +18 -0
  99. package/build/routes/workflows/invocation.d.ts +2 -0
  100. package/build/routes/workflows/invocation.js +162 -0
  101. package/build/routes/yaml-workflows/crud.d.ts +2 -0
  102. package/build/routes/yaml-workflows/crud.js +276 -0
  103. package/build/routes/yaml-workflows/deployment.d.ts +2 -0
  104. package/build/routes/yaml-workflows/deployment.js +179 -0
  105. package/build/routes/yaml-workflows/helpers.d.ts +2 -0
  106. package/build/routes/yaml-workflows/helpers.js +8 -0
  107. package/build/routes/yaml-workflows/index.d.ts +2 -0
  108. package/build/routes/yaml-workflows/index.js +21 -0
  109. package/build/routes/yaml-workflows/versions.d.ts +2 -0
  110. package/build/routes/yaml-workflows/versions.js +116 -0
  111. package/build/scripts/process-helpers.d.ts +11 -0
  112. package/build/scripts/process-helpers.js +59 -0
  113. package/build/scripts/process.d.ts +18 -0
  114. package/build/scripts/process.js +191 -0
  115. package/build/scripts/token.d.ts +13 -0
  116. package/build/scripts/token.js +42 -0
  117. package/build/services/auth/bot-api-key.d.ts +32 -0
  118. package/build/services/auth/bot-api-key.js +112 -0
  119. package/build/services/auth/delegation.d.ts +20 -0
  120. package/build/services/auth/delegation.js +53 -0
  121. package/build/services/auth/service-token.d.ts +23 -0
  122. package/build/services/auth/service-token.js +105 -0
  123. package/build/services/config/cache.d.ts +2 -0
  124. package/build/services/config/cache.js +24 -0
  125. package/build/services/config/index.d.ts +4 -0
  126. package/build/services/config/index.js +13 -0
  127. package/build/services/config/provider.d.ts +2 -0
  128. package/build/services/config/provider.js +30 -0
  129. package/build/services/config/read.d.ts +3 -0
  130. package/build/services/config/read.js +68 -0
  131. package/build/services/config/sql.d.ts +14 -0
  132. package/build/services/config/sql.js +58 -0
  133. package/build/services/config/write.d.ts +5 -0
  134. package/build/services/config/write.js +61 -0
  135. package/build/services/controlplane/index.d.ts +47 -0
  136. package/build/services/controlplane/index.js +124 -0
  137. package/build/services/controlplane/quorum-bridge.d.ts +15 -0
  138. package/build/services/controlplane/quorum-bridge.js +62 -0
  139. package/build/services/controlplane/sql.d.ts +21 -0
  140. package/build/services/controlplane/sql.js +70 -0
  141. package/build/services/controlplane/types.d.ts +13 -0
  142. package/build/services/controlplane/types.js +3 -0
  143. package/build/services/cron/index.d.ts +46 -0
  144. package/build/services/cron/index.js +199 -0
  145. package/build/services/db/index.d.ts +3 -0
  146. package/build/services/db/index.js +19 -0
  147. package/build/services/db/migrate.d.ts +1 -0
  148. package/build/services/db/migrate.js +78 -0
  149. package/build/services/dba.d.ts +28 -0
  150. package/build/services/dba.js +32 -0
  151. package/build/services/escalation/bulk.d.ts +27 -0
  152. package/build/services/escalation/bulk.js +57 -0
  153. package/build/services/escalation/crud.d.ts +47 -0
  154. package/build/services/escalation/crud.js +150 -0
  155. package/build/services/escalation/index.d.ts +4 -0
  156. package/build/services/escalation/index.js +20 -0
  157. package/build/services/escalation/queries.d.ts +37 -0
  158. package/build/services/escalation/queries.js +163 -0
  159. package/build/services/escalation/sql.d.ts +21 -0
  160. package/build/services/escalation/sql.js +135 -0
  161. package/build/services/escalation/types.d.ts +43 -0
  162. package/build/services/escalation/types.js +13 -0
  163. package/build/services/escalation-strategy/default.d.ts +12 -0
  164. package/build/services/escalation-strategy/default.js +17 -0
  165. package/build/services/escalation-strategy/index.d.ts +21 -0
  166. package/build/services/escalation-strategy/index.js +32 -0
  167. package/build/services/escalation-strategy/mcp.d.ts +13 -0
  168. package/build/services/escalation-strategy/mcp.js +51 -0
  169. package/build/services/events/index.d.ts +37 -0
  170. package/build/services/events/index.js +64 -0
  171. package/build/services/events/memory.d.ts +27 -0
  172. package/build/services/events/memory.js +40 -0
  173. package/build/services/events/nats.d.ts +29 -0
  174. package/build/services/events/nats.js +50 -0
  175. package/build/services/events/publish.d.ts +72 -0
  176. package/build/services/events/publish.js +106 -0
  177. package/build/services/events/socketio.d.ts +33 -0
  178. package/build/services/events/socketio.js +70 -0
  179. package/build/services/export/client.d.ts +2 -0
  180. package/build/services/export/client.js +16 -0
  181. package/build/services/export/index.d.ts +39 -0
  182. package/build/services/export/index.js +158 -0
  183. package/build/services/export/post-process.d.ts +16 -0
  184. package/build/services/export/post-process.js +133 -0
  185. package/build/services/export/types.d.ts +25 -0
  186. package/build/services/export/types.js +2 -0
  187. package/build/services/hotmesh-utils.d.ts +61 -0
  188. package/build/services/hotmesh-utils.js +204 -0
  189. package/build/services/iam/activity.d.ts +52 -0
  190. package/build/services/iam/activity.js +59 -0
  191. package/build/services/iam/bots.d.ts +83 -0
  192. package/build/services/iam/bots.js +157 -0
  193. package/build/services/iam/context.d.ts +14 -0
  194. package/build/services/iam/context.js +61 -0
  195. package/build/services/iam/credentials.d.ts +42 -0
  196. package/build/services/iam/credentials.js +86 -0
  197. package/build/services/iam/envelope.d.ts +10 -0
  198. package/build/services/iam/envelope.js +32 -0
  199. package/build/services/iam/ephemeral.d.ts +50 -0
  200. package/build/services/iam/ephemeral.js +131 -0
  201. package/build/services/iam/index.d.ts +19 -0
  202. package/build/services/iam/index.js +37 -0
  203. package/build/services/iam/principal.d.ts +12 -0
  204. package/build/services/iam/principal.js +53 -0
  205. package/build/services/iam/resolve.d.ts +48 -0
  206. package/build/services/iam/resolve.js +89 -0
  207. package/build/services/insight/index.d.ts +30 -0
  208. package/build/services/insight/index.js +81 -0
  209. package/build/services/insight/prompts.d.ts +4 -0
  210. package/build/services/insight/prompts.js +15 -0
  211. package/build/services/interceptor/activities/config.d.ts +21 -0
  212. package/build/services/interceptor/activities/config.js +26 -0
  213. package/build/services/interceptor/activities/escalation.d.ts +58 -0
  214. package/build/services/interceptor/activities/escalation.js +110 -0
  215. package/build/services/interceptor/activities/index.d.ts +4 -0
  216. package/build/services/interceptor/activities/index.js +23 -0
  217. package/build/services/interceptor/activities/task.d.ts +65 -0
  218. package/build/services/interceptor/activities/task.js +168 -0
  219. package/build/services/interceptor/activities/workflow.d.ts +26 -0
  220. package/build/services/interceptor/activities/workflow.js +41 -0
  221. package/build/services/interceptor/activity-interceptor.d.ts +32 -0
  222. package/build/services/interceptor/activity-interceptor.js +86 -0
  223. package/build/services/interceptor/completion.d.ts +16 -0
  224. package/build/services/interceptor/completion.js +149 -0
  225. package/build/services/interceptor/context.d.ts +11 -0
  226. package/build/services/interceptor/context.js +20 -0
  227. package/build/services/interceptor/escalation.d.ts +26 -0
  228. package/build/services/interceptor/escalation.js +150 -0
  229. package/build/services/interceptor/index.d.ts +45 -0
  230. package/build/services/interceptor/index.js +160 -0
  231. package/build/services/interceptor/lifecycle.d.ts +44 -0
  232. package/build/services/interceptor/lifecycle.js +174 -0
  233. package/build/services/interceptor/state.d.ts +22 -0
  234. package/build/services/interceptor/state.js +36 -0
  235. package/build/services/interceptor/types.d.ts +43 -0
  236. package/build/services/interceptor/types.js +3 -0
  237. package/build/services/llm/detect.d.ts +16 -0
  238. package/build/services/llm/detect.js +33 -0
  239. package/build/services/llm/index.d.ts +34 -0
  240. package/build/services/llm/index.js +106 -0
  241. package/build/services/llm/providers/anthropic.d.ts +11 -0
  242. package/build/services/llm/providers/anthropic.js +85 -0
  243. package/build/services/llm/providers/openai.d.ts +9 -0
  244. package/build/services/llm/providers/openai.js +46 -0
  245. package/build/services/llm/translate.d.ts +66 -0
  246. package/build/services/llm/translate.js +192 -0
  247. package/build/services/llm/types.d.ts +64 -0
  248. package/build/services/llm/types.js +8 -0
  249. package/build/services/logger/index.d.ts +32 -0
  250. package/build/services/logger/index.js +69 -0
  251. package/build/services/logger/pino.d.ts +24 -0
  252. package/build/services/logger/pino.js +59 -0
  253. package/build/services/maintenance/index.d.ts +43 -0
  254. package/build/services/maintenance/index.js +183 -0
  255. package/build/services/mcp/adapter.d.ts +23 -0
  256. package/build/services/mcp/adapter.js +119 -0
  257. package/build/services/mcp/client/connection.d.ts +46 -0
  258. package/build/services/mcp/client/connection.js +280 -0
  259. package/build/services/mcp/client/index.d.ts +2 -0
  260. package/build/services/mcp/client/index.js +16 -0
  261. package/build/services/mcp/client/tools.d.ts +22 -0
  262. package/build/services/mcp/client/tools.js +118 -0
  263. package/build/services/mcp/db-server/index.d.ts +25 -0
  264. package/build/services/mcp/db-server/index.js +49 -0
  265. package/build/services/mcp/db-server/schemas.d.ts +52 -0
  266. package/build/services/mcp/db-server/schemas.js +34 -0
  267. package/build/services/mcp/db-server/tools.d.ts +5 -0
  268. package/build/services/mcp/db-server/tools.js +224 -0
  269. package/build/services/mcp/db.d.ts +26 -0
  270. package/build/services/mcp/db.js +141 -0
  271. package/build/services/mcp/index.d.ts +25 -0
  272. package/build/services/mcp/index.js +47 -0
  273. package/build/services/mcp/playwright-server/index.d.ts +14 -0
  274. package/build/services/mcp/playwright-server/index.js +25 -0
  275. package/build/services/mcp/playwright-server/lifecycle.d.ts +7 -0
  276. package/build/services/mcp/playwright-server/lifecycle.js +63 -0
  277. package/build/services/mcp/playwright-server/schemas.d.ts +81 -0
  278. package/build/services/mcp/playwright-server/schemas.js +48 -0
  279. package/build/services/mcp/playwright-server/tools.d.ts +2 -0
  280. package/build/services/mcp/playwright-server/tools.js +224 -0
  281. package/build/services/mcp/server.d.ts +26 -0
  282. package/build/services/mcp/server.js +286 -0
  283. package/build/services/mcp/sql.d.ts +12 -0
  284. package/build/services/mcp/sql.js +59 -0
  285. package/build/services/mcp/types.d.ts +17 -0
  286. package/build/services/mcp/types.js +3 -0
  287. package/build/services/mcp/vision-server.d.ts +15 -0
  288. package/build/services/mcp/vision-server.js +214 -0
  289. package/build/services/mcp/workflow-compiler-server.d.ts +15 -0
  290. package/build/services/mcp/workflow-compiler-server.js +206 -0
  291. package/build/services/mcp/workflow-server.d.ts +24 -0
  292. package/build/services/mcp/workflow-server.js +230 -0
  293. package/build/services/mcp-runs/enrichment.d.ts +12 -0
  294. package/build/services/mcp-runs/enrichment.js +39 -0
  295. package/build/services/mcp-runs/events.d.ts +6 -0
  296. package/build/services/mcp-runs/events.js +126 -0
  297. package/build/services/mcp-runs/execution-builder.d.ts +12 -0
  298. package/build/services/mcp-runs/execution-builder.js +100 -0
  299. package/build/services/mcp-runs/index.d.ts +4 -0
  300. package/build/services/mcp-runs/index.js +8 -0
  301. package/build/services/mcp-runs/queries.d.ts +28 -0
  302. package/build/services/mcp-runs/queries.js +71 -0
  303. package/build/services/mcp-runs/sql.d.ts +4 -0
  304. package/build/services/mcp-runs/sql.js +17 -0
  305. package/build/services/mcp-runs/types.d.ts +65 -0
  306. package/build/services/mcp-runs/types.js +2 -0
  307. package/build/services/namespace/index.d.ts +17 -0
  308. package/build/services/namespace/index.js +41 -0
  309. package/build/services/namespace/sql.d.ts +4 -0
  310. package/build/services/namespace/sql.js +23 -0
  311. package/build/services/namespace/types.d.ts +11 -0
  312. package/build/services/namespace/types.js +3 -0
  313. package/build/services/oauth/crypto.d.ts +19 -0
  314. package/build/services/oauth/crypto.js +95 -0
  315. package/build/services/oauth/db.d.ts +20 -0
  316. package/build/services/oauth/db.js +140 -0
  317. package/build/services/oauth/index.d.ts +12 -0
  318. package/build/services/oauth/index.js +77 -0
  319. package/build/services/oauth/providers/anthropic.d.ts +3 -0
  320. package/build/services/oauth/providers/anthropic.js +111 -0
  321. package/build/services/oauth/providers/github.d.ts +3 -0
  322. package/build/services/oauth/providers/github.js +46 -0
  323. package/build/services/oauth/providers/google.d.ts +3 -0
  324. package/build/services/oauth/providers/google.js +44 -0
  325. package/build/services/oauth/providers/index.d.ts +2 -0
  326. package/build/services/oauth/providers/index.js +7 -0
  327. package/build/services/oauth/providers/microsoft.d.ts +3 -0
  328. package/build/services/oauth/providers/microsoft.js +46 -0
  329. package/build/services/oauth/providers/mock.d.ts +3 -0
  330. package/build/services/oauth/providers/mock.js +76 -0
  331. package/build/services/oauth/providers/registry.d.ts +8 -0
  332. package/build/services/oauth/providers/registry.js +46 -0
  333. package/build/services/oauth/providers/types.d.ts +13 -0
  334. package/build/services/oauth/providers/types.js +2 -0
  335. package/build/services/oauth/state.d.ts +30 -0
  336. package/build/services/oauth/state.js +83 -0
  337. package/build/services/orchestrator/index.d.ts +23 -0
  338. package/build/services/orchestrator/index.js +156 -0
  339. package/build/services/orchestrator/types.d.ts +15 -0
  340. package/build/services/orchestrator/types.js +3 -0
  341. package/build/services/role/index.d.ts +47 -0
  342. package/build/services/role/index.js +136 -0
  343. package/build/services/role/sql.d.ts +14 -0
  344. package/build/services/role/sql.js +80 -0
  345. package/build/services/role/types.d.ts +11 -0
  346. package/build/services/role/types.js +3 -0
  347. package/build/services/storage/index.d.ts +12 -0
  348. package/build/services/storage/index.js +31 -0
  349. package/build/services/storage/local.d.ts +26 -0
  350. package/build/services/storage/local.js +129 -0
  351. package/build/services/storage/s3.d.ts +31 -0
  352. package/build/services/storage/s3.js +180 -0
  353. package/build/services/storage/types.d.ts +41 -0
  354. package/build/services/storage/types.js +2 -0
  355. package/build/services/task/crud.d.ts +21 -0
  356. package/build/services/task/crud.js +123 -0
  357. package/build/services/task/index.d.ts +4 -0
  358. package/build/services/task/index.js +20 -0
  359. package/build/services/task/process.d.ts +14 -0
  360. package/build/services/task/process.js +98 -0
  361. package/build/services/task/resolve.d.ts +12 -0
  362. package/build/services/task/resolve.js +49 -0
  363. package/build/services/task/sql.d.ts +19 -0
  364. package/build/services/task/sql.js +92 -0
  365. package/build/services/task/types.d.ts +56 -0
  366. package/build/services/task/types.js +9 -0
  367. package/build/services/telemetry/honeycomb.d.ts +53 -0
  368. package/build/services/telemetry/honeycomb.js +79 -0
  369. package/build/services/telemetry/index.d.ts +46 -0
  370. package/build/services/telemetry/index.js +68 -0
  371. package/build/services/user/auth.d.ts +7 -0
  372. package/build/services/user/auth.js +26 -0
  373. package/build/services/user/crud.d.ts +19 -0
  374. package/build/services/user/crud.js +151 -0
  375. package/build/services/user/index.d.ts +5 -0
  376. package/build/services/user/index.js +26 -0
  377. package/build/services/user/rbac.d.ts +15 -0
  378. package/build/services/user/rbac.js +32 -0
  379. package/build/services/user/roles.d.ts +7 -0
  380. package/build/services/user/roles.js +42 -0
  381. package/build/services/user/sql.d.ts +22 -0
  382. package/build/services/user/sql.js +45 -0
  383. package/build/services/user/types.d.ts +23 -0
  384. package/build/services/user/types.js +4 -0
  385. package/build/services/workers/registry.d.ts +10 -0
  386. package/build/services/workers/registry.js +26 -0
  387. package/build/services/workflow-invocation.d.ts +46 -0
  388. package/build/services/workflow-invocation.js +184 -0
  389. package/build/services/yaml-workflow/db-utils.d.ts +25 -0
  390. package/build/services/yaml-workflow/db-utils.js +93 -0
  391. package/build/services/yaml-workflow/db.d.ts +27 -0
  392. package/build/services/yaml-workflow/db.js +196 -0
  393. package/build/services/yaml-workflow/deployer-helpers.d.ts +13 -0
  394. package/build/services/yaml-workflow/deployer-helpers.js +133 -0
  395. package/build/services/yaml-workflow/deployer.d.ts +54 -0
  396. package/build/services/yaml-workflow/deployer.js +203 -0
  397. package/build/services/yaml-workflow/generator.d.ts +21 -0
  398. package/build/services/yaml-workflow/generator.js +117 -0
  399. package/build/services/yaml-workflow/index.d.ts +4 -0
  400. package/build/services/yaml-workflow/index.js +20 -0
  401. package/build/services/yaml-workflow/input-analyzer-helpers.d.ts +48 -0
  402. package/build/services/yaml-workflow/input-analyzer-helpers.js +183 -0
  403. package/build/services/yaml-workflow/input-analyzer.d.ts +30 -0
  404. package/build/services/yaml-workflow/input-analyzer.js +109 -0
  405. package/build/services/yaml-workflow/pattern-detector/array-source.d.ts +22 -0
  406. package/build/services/yaml-workflow/pattern-detector/array-source.js +120 -0
  407. package/build/services/yaml-workflow/pattern-detector/collapse.d.ts +27 -0
  408. package/build/services/yaml-workflow/pattern-detector/collapse.js +92 -0
  409. package/build/services/yaml-workflow/pattern-detector/index.d.ts +18 -0
  410. package/build/services/yaml-workflow/pattern-detector/index.js +22 -0
  411. package/build/services/yaml-workflow/pattern-detector/run-detection.d.ts +28 -0
  412. package/build/services/yaml-workflow/pattern-detector/run-detection.js +81 -0
  413. package/build/services/yaml-workflow/pattern-detector/types.d.ts +29 -0
  414. package/build/services/yaml-workflow/pattern-detector/types.js +8 -0
  415. package/build/services/yaml-workflow/pipeline/analyze.d.ts +11 -0
  416. package/build/services/yaml-workflow/pipeline/analyze.js +64 -0
  417. package/build/services/yaml-workflow/pipeline/build/dag.d.ts +25 -0
  418. package/build/services/yaml-workflow/pipeline/build/dag.js +254 -0
  419. package/build/services/yaml-workflow/pipeline/build/index.d.ts +20 -0
  420. package/build/services/yaml-workflow/pipeline/build/index.js +115 -0
  421. package/build/services/yaml-workflow/pipeline/build/iteration.d.ts +25 -0
  422. package/build/services/yaml-workflow/pipeline/build/iteration.js +231 -0
  423. package/build/services/yaml-workflow/pipeline/build/metadata.d.ts +15 -0
  424. package/build/services/yaml-workflow/pipeline/build/metadata.js +126 -0
  425. package/build/services/yaml-workflow/pipeline/build/transform.d.ts +17 -0
  426. package/build/services/yaml-workflow/pipeline/build/transform.js +94 -0
  427. package/build/services/yaml-workflow/pipeline/build/utils.d.ts +22 -0
  428. package/build/services/yaml-workflow/pipeline/build/utils.js +129 -0
  429. package/build/services/yaml-workflow/pipeline/build/wiring.d.ts +9 -0
  430. package/build/services/yaml-workflow/pipeline/build/wiring.js +148 -0
  431. package/build/services/yaml-workflow/pipeline/compile/index.d.ts +17 -0
  432. package/build/services/yaml-workflow/pipeline/compile/index.js +64 -0
  433. package/build/services/yaml-workflow/pipeline/compile/llm-call.d.ts +14 -0
  434. package/build/services/yaml-workflow/pipeline/compile/llm-call.js +153 -0
  435. package/build/services/yaml-workflow/pipeline/compile/parse-plan.d.ts +12 -0
  436. package/build/services/yaml-workflow/pipeline/compile/parse-plan.js +88 -0
  437. package/build/services/yaml-workflow/pipeline/compile/summarize.d.ts +39 -0
  438. package/build/services/yaml-workflow/pipeline/compile/summarize.js +174 -0
  439. package/build/services/yaml-workflow/pipeline/extract-helpers.d.ts +42 -0
  440. package/build/services/yaml-workflow/pipeline/extract-helpers.js +88 -0
  441. package/build/services/yaml-workflow/pipeline/extract.d.ts +24 -0
  442. package/build/services/yaml-workflow/pipeline/extract.js +235 -0
  443. package/build/services/yaml-workflow/pipeline/prompts.d.ts +15 -0
  444. package/build/services/yaml-workflow/pipeline/prompts.js +254 -0
  445. package/build/services/yaml-workflow/pipeline/validate.d.ts +12 -0
  446. package/build/services/yaml-workflow/pipeline/validate.js +111 -0
  447. package/build/services/yaml-workflow/sql.d.ts +19 -0
  448. package/build/services/yaml-workflow/sql.js +83 -0
  449. package/build/services/yaml-workflow/types.d.ts +223 -0
  450. package/build/services/yaml-workflow/types.js +8 -0
  451. package/build/services/yaml-workflow/workers/callbacks.d.ts +17 -0
  452. package/build/services/yaml-workflow/workers/callbacks.js +194 -0
  453. package/build/services/yaml-workflow/workers/events.d.ts +7 -0
  454. package/build/services/yaml-workflow/workers/events.js +49 -0
  455. package/build/services/yaml-workflow/workers/index.d.ts +4 -0
  456. package/build/services/yaml-workflow/workers/index.js +15 -0
  457. package/build/services/yaml-workflow/workers/register.d.ts +15 -0
  458. package/build/services/yaml-workflow/workers/register.js +233 -0
  459. package/build/services/yaml-workflow/workers/scope.d.ts +13 -0
  460. package/build/services/yaml-workflow/workers/scope.js +37 -0
  461. package/build/start/adapters.d.ts +6 -0
  462. package/build/start/adapters.js +80 -0
  463. package/build/start/config.d.ts +10 -0
  464. package/build/start/config.js +88 -0
  465. package/build/start/index.d.ts +21 -0
  466. package/build/start/index.js +87 -0
  467. package/build/start/server.d.ts +6 -0
  468. package/build/start/server.js +46 -0
  469. package/build/start/workers.d.ts +32 -0
  470. package/build/start/workers.js +144 -0
  471. package/build/system/activities/claude-code.d.ts +56 -0
  472. package/build/system/activities/claude-code.js +258 -0
  473. package/build/system/activities/file-storage.d.ts +31 -0
  474. package/build/system/activities/file-storage.js +71 -0
  475. package/build/system/activities/http.d.ts +27 -0
  476. package/build/system/activities/http.js +56 -0
  477. package/build/system/activities/oauth.d.ts +39 -0
  478. package/build/system/activities/oauth.js +33 -0
  479. package/build/system/activities/triage/cache.d.ts +7 -0
  480. package/build/system/activities/triage/cache.js +10 -0
  481. package/build/system/activities/triage/context.d.ts +21 -0
  482. package/build/system/activities/triage/context.js +92 -0
  483. package/build/system/activities/triage/discovery.d.ts +25 -0
  484. package/build/system/activities/triage/discovery.js +170 -0
  485. package/build/system/activities/triage/index.d.ts +5 -0
  486. package/build/system/activities/triage/index.js +22 -0
  487. package/build/system/activities/triage/llm.d.ts +9 -0
  488. package/build/system/activities/triage/llm.js +34 -0
  489. package/build/system/activities/triage/tools.d.ts +24 -0
  490. package/build/system/activities/triage/tools.js +178 -0
  491. package/build/system/index.d.ts +16 -0
  492. package/build/system/index.js +100 -0
  493. package/build/system/mcp-servers/claude-code.d.ts +17 -0
  494. package/build/system/mcp-servers/claude-code.js +110 -0
  495. package/build/system/mcp-servers/db-query/index.d.ts +25 -0
  496. package/build/system/mcp-servers/db-query/index.js +49 -0
  497. package/build/system/mcp-servers/db-query/schemas.d.ts +52 -0
  498. package/build/system/mcp-servers/db-query/schemas.js +34 -0
  499. package/build/system/mcp-servers/db-query/tools.d.ts +5 -0
  500. package/build/system/mcp-servers/db-query/tools.js +224 -0
  501. package/build/system/mcp-servers/document-vision.d.ts +15 -0
  502. package/build/system/mcp-servers/document-vision.js +228 -0
  503. package/build/system/mcp-servers/file-storage.d.ts +4 -0
  504. package/build/system/mcp-servers/file-storage.js +101 -0
  505. package/build/system/mcp-servers/http-fetch.d.ts +4 -0
  506. package/build/system/mcp-servers/http-fetch.js +100 -0
  507. package/build/system/mcp-servers/human-queue.d.ts +26 -0
  508. package/build/system/mcp-servers/human-queue.js +287 -0
  509. package/build/system/mcp-servers/oauth.d.ts +11 -0
  510. package/build/system/mcp-servers/oauth.js +100 -0
  511. package/build/system/mcp-servers/playwright/browser-lifecycle.d.ts +26 -0
  512. package/build/system/mcp-servers/playwright/browser-lifecycle.js +125 -0
  513. package/build/system/mcp-servers/playwright/index.d.ts +25 -0
  514. package/build/system/mcp-servers/playwright/index.js +42 -0
  515. package/build/system/mcp-servers/playwright/schemas.d.ts +383 -0
  516. package/build/system/mcp-servers/playwright/schemas.js +87 -0
  517. package/build/system/mcp-servers/playwright/tools-atomic.d.ts +2 -0
  518. package/build/system/mcp-servers/playwright/tools-atomic.js +9 -0
  519. package/build/system/mcp-servers/playwright/tools-navigation.d.ts +2 -0
  520. package/build/system/mcp-servers/playwright/tools-navigation.js +140 -0
  521. package/build/system/mcp-servers/playwright/tools-page-interaction.d.ts +2 -0
  522. package/build/system/mcp-servers/playwright/tools-page-interaction.js +162 -0
  523. package/build/system/mcp-servers/playwright/tools-run-script.d.ts +2 -0
  524. package/build/system/mcp-servers/playwright/tools-run-script.js +190 -0
  525. package/build/system/mcp-servers/playwright/types.d.ts +8 -0
  526. package/build/system/mcp-servers/playwright/types.js +30 -0
  527. package/build/system/mcp-servers/playwright-cli/helpers.d.ts +11 -0
  528. package/build/system/mcp-servers/playwright-cli/helpers.js +20 -0
  529. package/build/system/mcp-servers/playwright-cli/index.d.ts +4 -0
  530. package/build/system/mcp-servers/playwright-cli/index.js +15 -0
  531. package/build/system/mcp-servers/playwright-cli/schemas.d.ts +219 -0
  532. package/build/system/mcp-servers/playwright-cli/schemas.js +75 -0
  533. package/build/system/mcp-servers/playwright-cli/tools-auth.d.ts +2 -0
  534. package/build/system/mcp-servers/playwright-cli/tools-auth.js +183 -0
  535. package/build/system/mcp-servers/playwright-cli/tools-capture.d.ts +2 -0
  536. package/build/system/mcp-servers/playwright-cli/tools-capture.js +267 -0
  537. package/build/system/mcp-servers/prompts.d.ts +4 -0
  538. package/build/system/mcp-servers/prompts.js +10 -0
  539. package/build/system/mcp-servers/workflow-compiler.d.ts +15 -0
  540. package/build/system/mcp-servers/workflow-compiler.js +230 -0
  541. package/build/system/mcp-servers/workflow.d.ts +24 -0
  542. package/build/system/mcp-servers/workflow.js +231 -0
  543. package/build/system/seed/index.d.ts +7 -0
  544. package/build/system/seed/index.js +36 -0
  545. package/build/system/seed/server-definitions.d.ts +1460 -0
  546. package/build/system/seed/server-definitions.js +160 -0
  547. package/build/system/seed/tool-manifests-browser.d.ts +577 -0
  548. package/build/system/seed/tool-manifests-browser.js +158 -0
  549. package/build/system/seed/tool-manifests-data.d.ts +322 -0
  550. package/build/system/seed/tool-manifests-data.js +173 -0
  551. package/build/system/seed/tool-manifests-escalation.d.ts +173 -0
  552. package/build/system/seed/tool-manifests-escalation.js +76 -0
  553. package/build/system/seed/tool-manifests-workflows.d.ts +211 -0
  554. package/build/system/seed/tool-manifests-workflows.js +136 -0
  555. package/build/system/workflows/mcp-deterministic/activities.d.ts +6 -0
  556. package/build/system/workflows/mcp-deterministic/activities.js +56 -0
  557. package/build/system/workflows/mcp-deterministic/index.d.ts +9 -0
  558. package/build/system/workflows/mcp-deterministic/index.js +72 -0
  559. package/build/system/workflows/mcp-query/activities/caches.d.ts +7 -0
  560. package/build/system/workflows/mcp-query/activities/caches.js +10 -0
  561. package/build/system/workflows/mcp-query/activities/discovery.d.ts +31 -0
  562. package/build/system/workflows/mcp-query/activities/discovery.js +172 -0
  563. package/build/system/workflows/mcp-query/activities/index.d.ts +4 -0
  564. package/build/system/workflows/mcp-query/activities/index.js +13 -0
  565. package/build/system/workflows/mcp-query/activities/llm.d.ts +8 -0
  566. package/build/system/workflows/mcp-query/activities/llm.js +33 -0
  567. package/build/system/workflows/mcp-query/activities/tool-executor.d.ts +5 -0
  568. package/build/system/workflows/mcp-query/activities/tool-executor.js +112 -0
  569. package/build/system/workflows/mcp-query/activities/tool-loader.d.ts +14 -0
  570. package/build/system/workflows/mcp-query/activities/tool-loader.js +93 -0
  571. package/build/system/workflows/mcp-query/index.d.ts +14 -0
  572. package/build/system/workflows/mcp-query/index.js +227 -0
  573. package/build/system/workflows/mcp-query/prompts.d.ts +4 -0
  574. package/build/system/workflows/mcp-query/prompts.js +101 -0
  575. package/build/system/workflows/mcp-query/strategy-advisors.d.ts +14 -0
  576. package/build/system/workflows/mcp-query/strategy-advisors.js +109 -0
  577. package/build/system/workflows/mcp-query/types.d.ts +10 -0
  578. package/build/system/workflows/mcp-query/types.js +3 -0
  579. package/build/system/workflows/mcp-query-router/activities.d.ts +6 -0
  580. package/build/system/workflows/mcp-query-router/activities.js +12 -0
  581. package/build/system/workflows/mcp-query-router/index.d.ts +13 -0
  582. package/build/system/workflows/mcp-query-router/index.js +107 -0
  583. package/build/system/workflows/mcp-query-router/prompts.d.ts +1 -0
  584. package/build/system/workflows/mcp-query-router/prompts.js +8 -0
  585. package/build/system/workflows/mcp-triage/index.d.ts +31 -0
  586. package/build/system/workflows/mcp-triage/index.js +222 -0
  587. package/build/system/workflows/mcp-triage/prompts.d.ts +7 -0
  588. package/build/system/workflows/mcp-triage/prompts.js +159 -0
  589. package/build/system/workflows/mcp-triage/response-builders.d.ts +17 -0
  590. package/build/system/workflows/mcp-triage/response-builders.js +96 -0
  591. package/build/system/workflows/mcp-triage/response.d.ts +8 -0
  592. package/build/system/workflows/mcp-triage/response.js +157 -0
  593. package/build/system/workflows/mcp-triage/types.d.ts +20 -0
  594. package/build/system/workflows/mcp-triage/types.js +3 -0
  595. package/build/system/workflows/mcp-triage-deterministic/activities.d.ts +4 -0
  596. package/build/system/workflows/mcp-triage-deterministic/activities.js +8 -0
  597. package/build/system/workflows/mcp-triage-deterministic/index.d.ts +12 -0
  598. package/build/system/workflows/mcp-triage-deterministic/index.js +83 -0
  599. package/build/system/workflows/mcp-triage-router/activities.d.ts +9 -0
  600. package/build/system/workflows/mcp-triage-router/activities.js +15 -0
  601. package/build/system/workflows/mcp-triage-router/index.d.ts +13 -0
  602. package/build/system/workflows/mcp-triage-router/index.js +122 -0
  603. package/build/tsconfig.tsbuildinfo +1 -0
  604. package/build/types/auth.d.ts +34 -0
  605. package/build/types/auth.js +2 -0
  606. package/build/types/config.d.ts +48 -0
  607. package/build/types/config.js +2 -0
  608. package/build/types/delegation.d.ts +41 -0
  609. package/build/types/delegation.js +2 -0
  610. package/build/types/discovery.d.ts +12 -0
  611. package/build/types/discovery.js +3 -0
  612. package/build/types/envelope.d.ts +53 -0
  613. package/build/types/envelope.js +2 -0
  614. package/build/types/escalation-strategy.d.ts +37 -0
  615. package/build/types/escalation-strategy.js +2 -0
  616. package/build/types/escalation.d.ts +39 -0
  617. package/build/types/escalation.js +21 -0
  618. package/build/types/events.d.ts +65 -0
  619. package/build/types/events.js +2 -0
  620. package/build/types/export.d.ts +78 -0
  621. package/build/types/export.js +11 -0
  622. package/build/types/index.d.ts +21 -0
  623. package/build/types/index.js +6 -0
  624. package/build/types/logger.d.ts +26 -0
  625. package/build/types/logger.js +2 -0
  626. package/build/types/maintenance.d.ts +24 -0
  627. package/build/types/maintenance.js +2 -0
  628. package/build/types/mcp.d.ts +80 -0
  629. package/build/types/mcp.js +2 -0
  630. package/build/types/oauth.d.ts +74 -0
  631. package/build/types/oauth.js +2 -0
  632. package/build/types/startup.d.ts +110 -0
  633. package/build/types/startup.js +2 -0
  634. package/build/types/task.d.ts +39 -0
  635. package/build/types/task.js +2 -0
  636. package/build/types/telemetry.d.ts +32 -0
  637. package/build/types/telemetry.js +2 -0
  638. package/build/types/tool-context.d.ts +68 -0
  639. package/build/types/tool-context.js +14 -0
  640. package/build/types/user.d.ts +18 -0
  641. package/build/types/user.js +2 -0
  642. package/build/types/workflow.d.ts +35 -0
  643. package/build/types/workflow.js +2 -0
  644. package/build/types/yaml-workflow.d.ts +101 -0
  645. package/build/types/yaml-workflow.js +5 -0
  646. package/build/vitest.config.d.ts +2 -0
  647. package/build/vitest.config.js +32 -0
  648. package/build/vitest.integration.config.d.ts +2 -0
  649. package/build/vitest.integration.config.js +25 -0
  650. package/build/workers/index.d.ts +6 -0
  651. package/build/workers/index.js +20 -0
  652. package/dashboard/dist/assets/AdminDashboard-jfacvOC7.js +2 -0
  653. package/dashboard/dist/assets/AdminDashboard-jfacvOC7.js.map +1 -0
  654. package/dashboard/dist/assets/AvailableEscalationsPage-BglLDoT8.js +2 -0
  655. package/dashboard/dist/assets/AvailableEscalationsPage-BglLDoT8.js.map +1 -0
  656. package/dashboard/dist/assets/BotPicker-D6FYW1Gt.js +2 -0
  657. package/dashboard/dist/assets/BotPicker-D6FYW1Gt.js.map +1 -0
  658. package/dashboard/dist/assets/CollapsibleSection-Cxk4wvjT.js +2 -0
  659. package/dashboard/dist/assets/CollapsibleSection-Cxk4wvjT.js.map +1 -0
  660. package/dashboard/dist/assets/ConfirmDeleteModal-FSXyKjaB.js +2 -0
  661. package/dashboard/dist/assets/ConfirmDeleteModal-FSXyKjaB.js.map +1 -0
  662. package/dashboard/dist/assets/CopyableId-CBdxWfp8.js +2 -0
  663. package/dashboard/dist/assets/CopyableId-CBdxWfp8.js.map +1 -0
  664. package/dashboard/dist/assets/CredentialsPage-Ikzsot0w.js +2 -0
  665. package/dashboard/dist/assets/CredentialsPage-Ikzsot0w.js.map +1 -0
  666. package/dashboard/dist/assets/CustomDurationPicker-CAninCbl.js +2 -0
  667. package/dashboard/dist/assets/CustomDurationPicker-CAninCbl.js.map +1 -0
  668. package/dashboard/dist/assets/DataTable-BDn1WBHS.js +2 -0
  669. package/dashboard/dist/assets/DataTable-BDn1WBHS.js.map +1 -0
  670. package/dashboard/dist/assets/EmptyState-2CmV-IaS.js +2 -0
  671. package/dashboard/dist/assets/EmptyState-2CmV-IaS.js.map +1 -0
  672. package/dashboard/dist/assets/EscalationsOverview-GXYFPASS.js +2 -0
  673. package/dashboard/dist/assets/EscalationsOverview-GXYFPASS.js.map +1 -0
  674. package/dashboard/dist/assets/EventTable-B01oJf6Y.js +2 -0
  675. package/dashboard/dist/assets/EventTable-B01oJf6Y.js.map +1 -0
  676. package/dashboard/dist/assets/Field-DuFBAYhu.js +2 -0
  677. package/dashboard/dist/assets/Field-DuFBAYhu.js.map +1 -0
  678. package/dashboard/dist/assets/FilterBar-Ck4K4rzu.js +2 -0
  679. package/dashboard/dist/assets/FilterBar-Ck4K4rzu.js.map +1 -0
  680. package/dashboard/dist/assets/McpOverview-JkvRcX2e.js +2 -0
  681. package/dashboard/dist/assets/McpOverview-JkvRcX2e.js.map +1 -0
  682. package/dashboard/dist/assets/McpQueryDetailPage-CUMqhQdS.js +2 -0
  683. package/dashboard/dist/assets/McpQueryDetailPage-CUMqhQdS.js.map +1 -0
  684. package/dashboard/dist/assets/McpQueryPage-DRRhw4nN.js +2 -0
  685. package/dashboard/dist/assets/McpQueryPage-DRRhw4nN.js.map +1 -0
  686. package/dashboard/dist/assets/McpRunDetailPage-CmPs5EvE.js +2 -0
  687. package/dashboard/dist/assets/McpRunDetailPage-CmPs5EvE.js.map +1 -0
  688. package/dashboard/dist/assets/McpRunsPage-Dl5Y2u6k.js +2 -0
  689. package/dashboard/dist/assets/McpRunsPage-Dl5Y2u6k.js.map +1 -0
  690. package/dashboard/dist/assets/Modal-B4rbIVAn.js +2 -0
  691. package/dashboard/dist/assets/Modal-B4rbIVAn.js.map +1 -0
  692. package/dashboard/dist/assets/OperatorDashboard-B56il28q.js +2 -0
  693. package/dashboard/dist/assets/OperatorDashboard-B56il28q.js.map +1 -0
  694. package/dashboard/dist/assets/PageHeader-CpWFly5S.js +2 -0
  695. package/dashboard/dist/assets/PageHeader-CpWFly5S.js.map +1 -0
  696. package/dashboard/dist/assets/PriorityBadge-DfQY9St9.js +2 -0
  697. package/dashboard/dist/assets/PriorityBadge-DfQY9St9.js.map +1 -0
  698. package/dashboard/dist/assets/ProcessDetailPage-CMLq4M7D.js +2 -0
  699. package/dashboard/dist/assets/ProcessDetailPage-CMLq4M7D.js.map +1 -0
  700. package/dashboard/dist/assets/ProcessesListPage-CZ_HF06v.js +2 -0
  701. package/dashboard/dist/assets/ProcessesListPage-CZ_HF06v.js.map +1 -0
  702. package/dashboard/dist/assets/RolePill-BTPa8L-P.js +2 -0
  703. package/dashboard/dist/assets/RolePill-BTPa8L-P.js.map +1 -0
  704. package/dashboard/dist/assets/RolesPage-9grZW7yR.js +2 -0
  705. package/dashboard/dist/assets/RolesPage-9grZW7yR.js.map +1 -0
  706. package/dashboard/dist/assets/RowActions-Dg-Fsm5O.js +2 -0
  707. package/dashboard/dist/assets/RowActions-Dg-Fsm5O.js.map +1 -0
  708. package/dashboard/dist/assets/SimpleMarkdown-CBlvaWP4.js +4 -0
  709. package/dashboard/dist/assets/SimpleMarkdown-CBlvaWP4.js.map +1 -0
  710. package/dashboard/dist/assets/StatCard-DlgF0CJC.js +2 -0
  711. package/dashboard/dist/assets/StatCard-DlgF0CJC.js.map +1 -0
  712. package/dashboard/dist/assets/StatusBadge-TlC4jiig.js +2 -0
  713. package/dashboard/dist/assets/StatusBadge-TlC4jiig.js.map +1 -0
  714. package/dashboard/dist/assets/StickyPagination-F9FZsRy9.js +2 -0
  715. package/dashboard/dist/assets/StickyPagination-F9FZsRy9.js.map +1 -0
  716. package/dashboard/dist/assets/SwimlaneTimeline-7SiwATsZ.js +2 -0
  717. package/dashboard/dist/assets/SwimlaneTimeline-7SiwATsZ.js.map +1 -0
  718. package/dashboard/dist/assets/TaskDetailPage-CbPVTakt.js +2 -0
  719. package/dashboard/dist/assets/TaskDetailPage-CbPVTakt.js.map +1 -0
  720. package/dashboard/dist/assets/TaskQueuePill-awmtb0qw.js +2 -0
  721. package/dashboard/dist/assets/TaskQueuePill-awmtb0qw.js.map +1 -0
  722. package/dashboard/dist/assets/TasksListPage-C_QF23c1.js +2 -0
  723. package/dashboard/dist/assets/TasksListPage-C_QF23c1.js.map +1 -0
  724. package/dashboard/dist/assets/TimeAgo-UPG6DoH8.js +2 -0
  725. package/dashboard/dist/assets/TimeAgo-UPG6DoH8.js.map +1 -0
  726. package/dashboard/dist/assets/TimestampCell-DoWMKg6w.js +2 -0
  727. package/dashboard/dist/assets/TimestampCell-DoWMKg6w.js.map +1 -0
  728. package/dashboard/dist/assets/UserName-DaP4YAKr.js +2 -0
  729. package/dashboard/dist/assets/UserName-DaP4YAKr.js.map +1 -0
  730. package/dashboard/dist/assets/VersionHistory-Bt7WBr6m.js +5 -0
  731. package/dashboard/dist/assets/VersionHistory-Bt7WBr6m.js.map +1 -0
  732. package/dashboard/dist/assets/WorkflowExecutionPage-DjtAQ3hy.js +2 -0
  733. package/dashboard/dist/assets/WorkflowExecutionPage-DjtAQ3hy.js.map +1 -0
  734. package/dashboard/dist/assets/WorkflowPill-CCDSVaQj.js +2 -0
  735. package/dashboard/dist/assets/WorkflowPill-CCDSVaQj.js.map +1 -0
  736. package/dashboard/dist/assets/WorkflowsDashboard-D8z9uBNB.js +2 -0
  737. package/dashboard/dist/assets/WorkflowsDashboard-D8z9uBNB.js.map +1 -0
  738. package/dashboard/dist/assets/WorkflowsOverview-D9OzzQqw.js +2 -0
  739. package/dashboard/dist/assets/WorkflowsOverview-D9OzzQqw.js.map +1 -0
  740. package/dashboard/dist/assets/YamlWorkflowDetailPage-DrDvvP62.js +3 -0
  741. package/dashboard/dist/assets/YamlWorkflowDetailPage-DrDvvP62.js.map +1 -0
  742. package/dashboard/dist/assets/YamlWorkflowsPage-COqiNCQK.js +2 -0
  743. package/dashboard/dist/assets/YamlWorkflowsPage-COqiNCQK.js.map +1 -0
  744. package/dashboard/dist/assets/bots-BkKVMbUW.js +2 -0
  745. package/dashboard/dist/assets/bots-BkKVMbUW.js.map +1 -0
  746. package/dashboard/dist/assets/constants-CgaZfe5d.js +2 -0
  747. package/dashboard/dist/assets/constants-CgaZfe5d.js.map +1 -0
  748. package/dashboard/dist/assets/escalation-columns-D6aqStaY.js +2 -0
  749. package/dashboard/dist/assets/escalation-columns-D6aqStaY.js.map +1 -0
  750. package/dashboard/dist/assets/escalation-qalymbKB.js +2 -0
  751. package/dashboard/dist/assets/escalation-qalymbKB.js.map +1 -0
  752. package/dashboard/dist/assets/format-gXZXQ-HJ.js +2 -0
  753. package/dashboard/dist/assets/format-gXZXQ-HJ.js.map +1 -0
  754. package/dashboard/dist/assets/helpers-0gSleuzT.js +2 -0
  755. package/dashboard/dist/assets/helpers-0gSleuzT.js.map +1 -0
  756. package/dashboard/dist/assets/index-BWvMHed7.js +6 -0
  757. package/dashboard/dist/assets/index-BWvMHed7.js.map +1 -0
  758. package/dashboard/dist/assets/index-BaszoPO_.css +1 -0
  759. package/dashboard/dist/assets/index-Cn2jyj9A.js +2 -0
  760. package/dashboard/dist/assets/index-Cn2jyj9A.js.map +1 -0
  761. package/dashboard/dist/assets/index-D8VH6K8B.js +54 -0
  762. package/dashboard/dist/assets/index-D8VH6K8B.js.map +1 -0
  763. package/dashboard/dist/assets/index-D9SYwJsi.js +3 -0
  764. package/dashboard/dist/assets/index-D9SYwJsi.js.map +1 -0
  765. package/dashboard/dist/assets/index-DTPzZr_X.js +2 -0
  766. package/dashboard/dist/assets/index-DTPzZr_X.js.map +1 -0
  767. package/dashboard/dist/assets/index-D_6AB5BE.js +2 -0
  768. package/dashboard/dist/assets/index-D_6AB5BE.js.map +1 -0
  769. package/dashboard/dist/assets/index-S9Ks2Lj2.js +2 -0
  770. package/dashboard/dist/assets/index-S9Ks2Lj2.js.map +1 -0
  771. package/dashboard/dist/assets/index-X85K5bHC.js +17 -0
  772. package/dashboard/dist/assets/index-X85K5bHC.js.map +1 -0
  773. package/dashboard/dist/assets/index-rjmgHlSH.js +2 -0
  774. package/dashboard/dist/assets/index-rjmgHlSH.js.map +1 -0
  775. package/dashboard/dist/assets/mcp-blCW6IL7.js +2 -0
  776. package/dashboard/dist/assets/mcp-blCW6IL7.js.map +1 -0
  777. package/dashboard/dist/assets/mcp-query-DoAyPbjC.js +2 -0
  778. package/dashboard/dist/assets/mcp-query-DoAyPbjC.js.map +1 -0
  779. package/dashboard/dist/assets/mcp-runs-ChPbpvXK.js +2 -0
  780. package/dashboard/dist/assets/mcp-runs-ChPbpvXK.js.map +1 -0
  781. package/dashboard/dist/assets/namespaces-BgbaC3ow.js +2 -0
  782. package/dashboard/dist/assets/namespaces-BgbaC3ow.js.map +1 -0
  783. package/dashboard/dist/assets/roles-ZNrqqnQl.js +2 -0
  784. package/dashboard/dist/assets/roles-ZNrqqnQl.js.map +1 -0
  785. package/dashboard/dist/assets/settings-eBRSE0mQ.js +2 -0
  786. package/dashboard/dist/assets/settings-eBRSE0mQ.js.map +1 -0
  787. package/dashboard/dist/assets/tasks-tRqClPns.js +2 -0
  788. package/dashboard/dist/assets/tasks-tRqClPns.js.map +1 -0
  789. package/dashboard/dist/assets/useFilterParams-BaXUAkYK.js +2 -0
  790. package/dashboard/dist/assets/useFilterParams-BaXUAkYK.js.map +1 -0
  791. package/dashboard/dist/assets/useNatsEvents-Xr43X1fG.js +2 -0
  792. package/dashboard/dist/assets/useNatsEvents-Xr43X1fG.js.map +1 -0
  793. package/dashboard/dist/assets/useYamlActivityEvents-BO51u8tm.js +2 -0
  794. package/dashboard/dist/assets/useYamlActivityEvents-BO51u8tm.js.map +1 -0
  795. package/dashboard/dist/assets/users-tMvNyOo8.js +2 -0
  796. package/dashboard/dist/assets/users-tMvNyOo8.js.map +1 -0
  797. package/dashboard/dist/assets/vendor-icons-ZTAKVwGc.js +292 -0
  798. package/dashboard/dist/assets/vendor-icons-ZTAKVwGc.js.map +1 -0
  799. package/dashboard/dist/assets/vendor-query-B2UbickB.js +18 -0
  800. package/dashboard/dist/assets/vendor-query-B2UbickB.js.map +1 -0
  801. package/dashboard/dist/assets/vendor-react-Cw8Gy8NJ.js +22 -0
  802. package/dashboard/dist/assets/vendor-react-Cw8Gy8NJ.js.map +1 -0
  803. package/dashboard/dist/assets/workflows-Cc4VHcrp.js +2 -0
  804. package/dashboard/dist/assets/workflows-Cc4VHcrp.js.map +1 -0
  805. package/dashboard/dist/assets/yaml-workflows-BL4V5CQy.js +2 -0
  806. package/dashboard/dist/assets/yaml-workflows-BL4V5CQy.js.map +1 -0
  807. package/dashboard/dist/index.html +20 -0
  808. package/dashboard/dist/logo512.png +0 -0
  809. package/package.json +96 -0
@@ -0,0 +1,54 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ProcessesListPage-CZ_HF06v.js","assets/vendor-query-B2UbickB.js","assets/tasks-tRqClPns.js","assets/workflows-Cc4VHcrp.js","assets/useNatsEvents-Xr43X1fG.js","assets/useFilterParams-BaXUAkYK.js","assets/vendor-react-Cw8Gy8NJ.js","assets/DataTable-BDn1WBHS.js","assets/EmptyState-2CmV-IaS.js","assets/TimeAgo-UPG6DoH8.js","assets/format-gXZXQ-HJ.js","assets/StickyPagination-F9FZsRy9.js","assets/FilterBar-Ck4K4rzu.js","assets/PageHeader-CpWFly5S.js","assets/WorkflowPill-CCDSVaQj.js","assets/vendor-icons-ZTAKVwGc.js","assets/ProcessDetailPage-CMLq4M7D.js","assets/settings-eBRSE0mQ.js","assets/StatCard-DlgF0CJC.js","assets/StatusBadge-TlC4jiig.js","assets/RolePill-BTPa8L-P.js","assets/UserName-DaP4YAKr.js","assets/users-tMvNyOo8.js","assets/McpOverview-JkvRcX2e.js","assets/mcp-blCW6IL7.js","assets/mcp-runs-ChPbpvXK.js","assets/yaml-workflows-BL4V5CQy.js","assets/namespaces-BgbaC3ow.js","assets/McpRunsPage-Dl5Y2u6k.js","assets/McpRunDetailPage-CmPs5EvE.js","assets/CopyableId-CBdxWfp8.js","assets/CollapsibleSection-Cxk4wvjT.js","assets/EventTable-B01oJf6Y.js","assets/SwimlaneTimeline-7SiwATsZ.js","assets/McpQueryPage-DRRhw4nN.js","assets/TimestampCell-DoWMKg6w.js","assets/mcp-query-DoAyPbjC.js","assets/McpQueryDetailPage-CUMqhQdS.js","assets/SimpleMarkdown-CBlvaWP4.js","assets/VersionHistory-Bt7WBr6m.js","assets/Modal-B4rbIVAn.js","assets/useYamlActivityEvents-BO51u8tm.js","assets/helpers-0gSleuzT.js","assets/EscalationsOverview-GXYFPASS.js","assets/AvailableEscalationsPage-BglLDoT8.js","assets/roles-ZNrqqnQl.js","assets/constants-CgaZfe5d.js","assets/CustomDurationPicker-CAninCbl.js","assets/escalation-columns-D6aqStaY.js","assets/PriorityBadge-DfQY9St9.js","assets/escalation-qalymbKB.js","assets/RowActions-Dg-Fsm5O.js","assets/OperatorDashboard-B56il28q.js","assets/index-D9SYwJsi.js","assets/WorkflowsOverview-D9OzzQqw.js","assets/index-BWvMHed7.js","assets/BotPicker-D6FYW1Gt.js","assets/bots-BkKVMbUW.js","assets/WorkflowsDashboard-D8z9uBNB.js","assets/YamlWorkflowsPage-COqiNCQK.js","assets/YamlWorkflowDetailPage-DrDvvP62.js","assets/Field-DuFBAYhu.js","assets/TasksListPage-C_QF23c1.js","assets/TaskDetailPage-CbPVTakt.js","assets/WorkflowExecutionPage-DjtAQ3hy.js","assets/AdminDashboard-jfacvOC7.js","assets/index-DTPzZr_X.js","assets/TaskQueuePill-awmtb0qw.js","assets/index-X85K5bHC.js","assets/ConfirmDeleteModal-FSXyKjaB.js","assets/index-rjmgHlSH.js","assets/index-S9Ks2Lj2.js","assets/RolesPage-9grZW7yR.js","assets/index-D_6AB5BE.js","assets/index-Cn2jyj9A.js","assets/CredentialsPage-Ikzsot0w.js"])))=>i.map(i=>d[i]);
2
+ var ub=Object.defineProperty;var fb=(a,n,i)=>n in a?ub(a,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):a[n]=i;var b=(a,n,i)=>fb(a,typeof n!="symbol"?n+"":n,i);import{r as hb,a as Q,j as g,u as yr,b as Tn,c as Dn,Q as db,d as mb}from"./vendor-query-B2UbickB.js";import{r as pb,L as Lu,u as gr,N as hc,a as Hs,O as ic,b as p0,c as yb,R as gb}from"./vendor-react-Cw8Gy8NJ.js";import{R as bb,I as _b,U as vb,a as xb,T as Sb,W as wb,A as Eb,S as Ab,P as Ob,b as Tb,L as y0,c as jb,d as Nb,e as Cb,C as Mb,f as kb,E as Rb,g as zb,h as Ub}from"./vendor-icons-ZTAKVwGc.js";(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))l(o);new MutationObserver(o=>{for(const f of o)if(f.type==="childList")for(const d of f.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&l(d)}).observe(document,{childList:!0,subtree:!0});function i(o){const f={};return o.integrity&&(f.integrity=o.integrity),o.referrerPolicy&&(f.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?f.credentials="include":o.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function l(o){if(o.ep)return;o.ep=!0;const f=i(o);fetch(o.href,f)}})();var Hu={exports:{}},ma={},Gu={exports:{}},Yu={};/**
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 jp;function qb(){return jp||(jp=1,(function(a){function n(D,K){var oe=D.length;D.push(K);e:for(;0<oe;){var ge=oe-1>>>1,pe=D[ge];if(0<o(pe,K))D[ge]=K,D[oe]=pe,oe=ge;else break e}}function i(D){return D.length===0?null:D[0]}function l(D){if(D.length===0)return null;var K=D[0],oe=D.pop();if(oe!==K){D[0]=oe;e:for(var ge=0,pe=D.length,Ee=pe>>>1;ge<Ee;){var _e=2*(ge+1)-1,Ae=D[_e],rt=_e+1,Ht=D[rt];if(0>o(Ae,oe))rt<pe&&0>o(Ht,Ae)?(D[ge]=Ht,D[rt]=oe,ge=rt):(D[ge]=Ae,D[_e]=oe,ge=_e);else if(rt<pe&&0>o(Ht,oe))D[ge]=Ht,D[rt]=oe,ge=rt;else break e}}return K}function o(D,K){var oe=D.sortIndex-K.sortIndex;return oe!==0?oe:D.id-K.id}if(a.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;a.unstable_now=function(){return f.now()}}else{var d=Date,m=d.now();a.unstable_now=function(){return d.now()-m}}var v=[],S=[],N=1,O=null,M=3,G=!1,$=!1,W=!1,de=!1,ye=typeof setTimeout=="function"?setTimeout:null,ie=typeof clearTimeout=="function"?clearTimeout:null,be=typeof setImmediate<"u"?setImmediate:null;function Xe(D){for(var K=i(S);K!==null;){if(K.callback===null)l(S);else if(K.startTime<=D)l(S),K.sortIndex=K.expirationTime,n(v,K);else break;K=i(S)}}function B(D){if(W=!1,Xe(D),!$)if(i(v)!==null)$=!0,F||(F=!0,se());else{var K=i(S);K!==null&&Ge(B,K.startTime-D)}}var F=!1,ne=-1,Z=5,X=-1;function ae(){return de?!0:!(a.unstable_now()-X<Z)}function ue(){if(de=!1,F){var D=a.unstable_now();X=D;var K=!0;try{e:{$=!1,W&&(W=!1,ie(ne),ne=-1),G=!0;var oe=M;try{t:{for(Xe(D),O=i(v);O!==null&&!(O.expirationTime>D&&ae());){var ge=O.callback;if(typeof ge=="function"){O.callback=null,M=O.priorityLevel;var pe=ge(O.expirationTime<=D);if(D=a.unstable_now(),typeof pe=="function"){O.callback=pe,Xe(D),K=!0;break t}O===i(v)&&l(v),Xe(D)}else l(v);O=i(v)}if(O!==null)K=!0;else{var Ee=i(S);Ee!==null&&Ge(B,Ee.startTime-D),K=!1}}break e}finally{O=null,M=oe,G=!1}K=void 0}}finally{K?se():F=!1}}}var se;if(typeof be=="function")se=function(){be(ue)};else if(typeof MessageChannel<"u"){var Be=new MessageChannel,$e=Be.port2;Be.port1.onmessage=ue,se=function(){$e.postMessage(null)}}else se=function(){ye(ue,0)};function Ge(D,K){ne=ye(function(){D(a.unstable_now())},K)}a.unstable_IdlePriority=5,a.unstable_ImmediatePriority=1,a.unstable_LowPriority=4,a.unstable_NormalPriority=3,a.unstable_Profiling=null,a.unstable_UserBlockingPriority=2,a.unstable_cancelCallback=function(D){D.callback=null},a.unstable_forceFrameRate=function(D){0>D||125<D?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Z=0<D?Math.floor(1e3/D):5},a.unstable_getCurrentPriorityLevel=function(){return M},a.unstable_next=function(D){switch(M){case 1:case 2:case 3:var K=3;break;default:K=M}var oe=M;M=K;try{return D()}finally{M=oe}},a.unstable_requestPaint=function(){de=!0},a.unstable_runWithPriority=function(D,K){switch(D){case 1:case 2:case 3:case 4:case 5:break;default:D=3}var oe=M;M=D;try{return K()}finally{M=oe}},a.unstable_scheduleCallback=function(D,K,oe){var ge=a.unstable_now();switch(typeof oe=="object"&&oe!==null?(oe=oe.delay,oe=typeof oe=="number"&&0<oe?ge+oe:ge):oe=ge,D){case 1:var pe=-1;break;case 2:pe=250;break;case 5:pe=1073741823;break;case 4:pe=1e4;break;default:pe=5e3}return pe=oe+pe,D={id:N++,callback:K,priorityLevel:D,startTime:oe,expirationTime:pe,sortIndex:-1},oe>ge?(D.sortIndex=oe,n(S,D),i(v)===null&&D===i(S)&&(W?(ie(ne),ne=-1):W=!0,Ge(B,oe-ge))):(D.sortIndex=pe,n(v,D),$||G||($=!0,F||(F=!0,se()))),D},a.unstable_shouldYield=ae,a.unstable_wrapCallback=function(D){var K=M;return function(){var oe=M;M=K;try{return D.apply(this,arguments)}finally{M=oe}}}})(Yu)),Yu}var Np;function Db(){return Np||(Np=1,Gu.exports=qb()),Gu.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 Cp;function Bb(){if(Cp)return ma;Cp=1;var a=Db(),n=hb(),i=pb();function l(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var s=2;s<arguments.length;s++)t+="&args[]="+encodeURIComponent(arguments[s])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function f(e){var t=e,s=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(s=t.return),e=t.return;while(e)}return t.tag===3?s:null}function d(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function m(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function v(e){if(f(e)!==e)throw Error(l(188))}function S(e){var t=e.alternate;if(!t){if(t=f(e),t===null)throw Error(l(188));return t!==e?null:e}for(var s=e,r=t;;){var c=s.return;if(c===null)break;var u=c.alternate;if(u===null){if(r=c.return,r!==null){s=r;continue}break}if(c.child===u.child){for(u=c.child;u;){if(u===s)return v(c),e;if(u===r)return v(c),t;u=u.sibling}throw Error(l(188))}if(s.return!==r.return)s=c,r=u;else{for(var h=!1,p=c.child;p;){if(p===s){h=!0,s=c,r=u;break}if(p===r){h=!0,r=c,s=u;break}p=p.sibling}if(!h){for(p=u.child;p;){if(p===s){h=!0,s=u,r=c;break}if(p===r){h=!0,r=u,s=c;break}p=p.sibling}if(!h)throw Error(l(189))}}if(s.alternate!==r)throw Error(l(190))}if(s.tag!==3)throw Error(l(188));return s.stateNode.current===s?e:t}function N(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=N(e),t!==null)return t;e=e.sibling}return null}var O=Object.assign,M=Symbol.for("react.element"),G=Symbol.for("react.transitional.element"),$=Symbol.for("react.portal"),W=Symbol.for("react.fragment"),de=Symbol.for("react.strict_mode"),ye=Symbol.for("react.profiler"),ie=Symbol.for("react.consumer"),be=Symbol.for("react.context"),Xe=Symbol.for("react.forward_ref"),B=Symbol.for("react.suspense"),F=Symbol.for("react.suspense_list"),ne=Symbol.for("react.memo"),Z=Symbol.for("react.lazy"),X=Symbol.for("react.activity"),ae=Symbol.for("react.memo_cache_sentinel"),ue=Symbol.iterator;function se(e){return e===null||typeof e!="object"?null:(e=ue&&e[ue]||e["@@iterator"],typeof e=="function"?e:null)}var Be=Symbol.for("react.client.reference");function $e(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===Be?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case W:return"Fragment";case ye:return"Profiler";case de:return"StrictMode";case B:return"Suspense";case F:return"SuspenseList";case X:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case $:return"Portal";case be:return e.displayName||"Context";case ie:return(e._context.displayName||"Context")+".Consumer";case Xe:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ne:return t=e.displayName||null,t!==null?t:$e(e.type)||"Memo";case Z:t=e._payload,e=e._init;try{return $e(e(t))}catch{}}return null}var Ge=Array.isArray,D=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,oe={pending:!1,data:null,method:null,action:null},ge=[],pe=-1;function Ee(e){return{current:e}}function _e(e){0>pe||(e.current=ge[pe],ge[pe]=null,pe--)}function Ae(e,t){pe++,ge[pe]=e.current,e.current=t}var rt=Ee(null),Ht=Ee(null),tn=Ee(null),At=Ee(null);function Ot(e,t){switch(Ae(tn,t),Ae(Ht,e),Ae(rt,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Zm(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Zm(t),e=Im(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}_e(rt),Ae(rt,e)}function ve(){_e(rt),_e(Ht),_e(tn)}function Tt(e){e.memoizedState!==null&&Ae(At,e);var t=rt.current,s=Im(t,e.type);t!==s&&(Ae(Ht,e),Ae(rt,s))}function Xs(e){Ht.current===e&&(_e(rt),_e(Ht)),At.current===e&&(_e(At),ua._currentValue=oe)}var vi,$s;function nn(e){if(vi===void 0)try{throw Error()}catch(s){var t=s.stack.trim().match(/\n( *(at )?)/);vi=t&&t[1]||"",$s=-1<s.stack.indexOf(`
19
+ at`)?" (<anonymous>)":-1<s.stack.indexOf("@")?"@unknown:0:0":""}return`
20
+ `+vi+e+$s}var xi=!1;function cs(e,t){if(!e||xi)return"";xi=!0;var s=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var P=function(){throw Error()};if(Object.defineProperty(P.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(P,[])}catch(q){var z=q}Reflect.construct(e,[],P)}else{try{P.call()}catch(q){z=q}e.call(P.prototype)}}else{try{throw Error()}catch(q){z=q}(P=e())&&typeof P.catch=="function"&&P.catch(function(){})}}catch(q){if(q&&z&&typeof q.stack=="string")return[q.stack,z.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var c=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,"name");c&&c.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var u=r.DetermineComponentFrameRoot(),h=u[0],p=u[1];if(h&&p){var E=h.split(`
21
+ `),R=p.split(`
22
+ `);for(c=r=0;r<E.length&&!E[r].includes("DetermineComponentFrameRoot");)r++;for(;c<R.length&&!R[c].includes("DetermineComponentFrameRoot");)c++;if(r===E.length||c===R.length)for(r=E.length-1,c=R.length-1;1<=r&&0<=c&&E[r]!==R[c];)c--;for(;1<=r&&0<=c;r--,c--)if(E[r]!==R[c]){if(r!==1||c!==1)do if(r--,c--,0>c||E[r]!==R[c]){var L=`
23
+ `+E[r].replace(" at new "," at ");return e.displayName&&L.includes("<anonymous>")&&(L=L.replace("<anonymous>",e.displayName)),L}while(1<=r&&0<=c);break}}}finally{xi=!1,Error.prepareStackTrace=s}return(s=e?e.displayName||e.name:"")?nn(s):""}function Ma(e,t){switch(e.tag){case 26:case 27:case 5:return nn(e.type);case 16:return nn("Lazy");case 13:return e.child!==t&&t!==null?nn("Suspense Fallback"):nn("Suspense");case 19:return nn("SuspenseList");case 0:case 15:return cs(e.type,!1);case 11:return cs(e.type.render,!1);case 1:return cs(e.type,!0);case 31:return nn("Activity");default:return""}}function ka(e){try{var t="",s=null;do t+=Ma(e,s),s=e,e=e.return;while(e);return t}catch(r){return`
24
+ Error generating stack: `+r.message+`
25
+ `+r.stack}}var vr=Object.prototype.hasOwnProperty,xr=a.unstable_scheduleCallback,Bn=a.unstable_cancelCallback,Ra=a.unstable_shouldYield,Si=a.unstable_requestPaint,Ie=a.unstable_now,jc=a.unstable_getCurrentPriorityLevel,za=a.unstable_ImmediatePriority,Ua=a.unstable_UserBlockingPriority,wi=a.unstable_NormalPriority,Nc=a.unstable_LowPriority,qa=a.unstable_IdlePriority,Cc=a.log,Da=a.unstable_setDisableYieldValue,Ks=null,at=null;function Gt(e){if(typeof Cc=="function"&&Da(e),at&&typeof at.setStrictMode=="function")try{at.setStrictMode(Ks,e)}catch{}}var jt=Math.clz32?Math.clz32:Ei,Sr=Math.log,wr=Math.LN2;function Ei(e){return e>>>=0,e===0?32:31-(Sr(e)/wr|0)|0}var os=256,Ln=262144,us=4194304;function gn(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Fs(e,t,s){var r=e.pendingLanes;if(r===0)return 0;var c=0,u=e.suspendedLanes,h=e.pingedLanes;e=e.warmLanes;var p=r&134217727;return p!==0?(r=p&~u,r!==0?c=gn(r):(h&=p,h!==0?c=gn(h):s||(s=p&~e,s!==0&&(c=gn(s))))):(p=r&~u,p!==0?c=gn(p):h!==0?c=gn(h):s||(s=r&~e,s!==0&&(c=gn(s)))),c===0?0:t!==0&&t!==c&&(t&u)===0&&(u=c&-c,s=t&-t,u>=s||u===32&&(s&4194048)!==0)?t:c}function Zs(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Er(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ai(){var e=us;return us<<=1,(us&62914560)===0&&(us=4194304),e}function fs(e){for(var t=[],s=0;31>s;s++)t.push(e);return t}function bn(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function hs(e,t,s,r,c,u){var h=e.pendingLanes;e.pendingLanes=s,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=s,e.entangledLanes&=s,e.errorRecoveryDisabledLanes&=s,e.shellSuspendCounter=0;var p=e.entanglements,E=e.expirationTimes,R=e.hiddenUpdates;for(s=h&~s;0<s;){var L=31-jt(s),P=1<<L;p[L]=0,E[L]=-1;var z=R[L];if(z!==null)for(R[L]=null,L=0;L<z.length;L++){var q=z[L];q!==null&&(q.lane&=-536870913)}s&=~P}r!==0&&ds(e,r,0),u!==0&&c===0&&e.tag!==0&&(e.suspendedLanes|=u&~(h&~t))}function ds(e,t,s){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-jt(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|s&261930}function Is(e,t){var s=e.entangledLanes|=t;for(e=e.entanglements;s;){var r=31-jt(s),c=1<<r;c&t|e[r]&t&&(e[r]|=t),s&=~c}}function ms(e,t){var s=t&-t;return s=(s&42)!==0?1:Hn(s),(s&(e.suspendedLanes|t))!==0?0:s}function Hn(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 Ws(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Ar(){var e=K.p;return e!==0?e:(e=window.event,e===void 0?32:xp(e.type))}function Ba(e,t){var s=K.p;try{return K.p=e,t()}finally{K.p=s}}var jn=Math.random().toString(36).slice(2),Je="__reactFiber$"+jn,nt="__reactProps$"+jn,Yt="__reactContainer$"+jn,ei="__reactEvents$"+jn,Or="__reactListeners$"+jn,La="__reactHandles$"+jn,Ha="__reactResources$"+jn,pt="__reactMarker$"+jn;function Oi(e){delete e[Je],delete e[nt],delete e[ei],delete e[Or],delete e[La]}function y(e){var t=e[Je];if(t)return t;for(var s=e.parentNode;s;){if(t=s[Yt]||s[Je]){if(s=t.alternate,t.child!==null||s!==null&&s.child!==null)for(e=rp(e);e!==null;){if(s=e[Je])return s;e=rp(e)}return t}e=s,s=e.parentNode}return null}function x(e){if(e=e[Je]||e[Yt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function _(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(l(33))}function w(e){var t=e[Ha];return t||(t=e[Ha]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function A(e){e[pt]=!0}var C=new Set,V={};function J(e,t){U(e,t),U(e+"Capture",t)}function U(e,t){for(V[e]=t,e=0;e<t.length;e++)C.add(t[e])}var Y=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]*$"),le={},we={};function Ke(e){return vr.call(we,e)?!0:vr.call(le,e)?!1:Y.test(e)?we[e]=!0:(le[e]=!0,!1)}function Nt(e,t,s){if(Ke(t))if(s===null)e.removeAttribute(t);else{switch(typeof s){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var r=t.toLowerCase().slice(0,5);if(r!=="data-"&&r!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+s)}}function _n(e,t,s){if(s===null)e.removeAttribute(t);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+s)}}function Gn(e,t,s,r){if(r===null)e.removeAttribute(s);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(s);return}e.setAttributeNS(t,s,""+r)}}function sn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Vf(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function sy(e,t,s){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var c=r.get,u=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return c.call(this)},set:function(h){s=""+h,u.call(this,h)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return s},setValue:function(h){s=""+h},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Mc(e){if(!e._valueTracker){var t=Vf(e)?"checked":"value";e._valueTracker=sy(e,t,""+e[t])}}function Pf(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var s=t.getValue(),r="";return e&&(r=Vf(e)?e.checked?"true":"false":e.value),e=r,e!==s?(t.setValue(e),!0):!1}function Ga(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 iy=/[\n"\\]/g;function rn(e){return e.replace(iy,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function kc(e,t,s,r,c,u,h,p){e.name="",h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"?e.type=h:e.removeAttribute("type"),t!=null?h==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+sn(t)):e.value!==""+sn(t)&&(e.value=""+sn(t)):h!=="submit"&&h!=="reset"||e.removeAttribute("value"),t!=null?Rc(e,h,sn(t)):s!=null?Rc(e,h,sn(s)):r!=null&&e.removeAttribute("value"),c==null&&u!=null&&(e.defaultChecked=!!u),c!=null&&(e.checked=c&&typeof c!="function"&&typeof c!="symbol"),p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"?e.name=""+sn(p):e.removeAttribute("name")}function Jf(e,t,s,r,c,u,h,p){if(u!=null&&typeof u!="function"&&typeof u!="symbol"&&typeof u!="boolean"&&(e.type=u),t!=null||s!=null){if(!(u!=="submit"&&u!=="reset"||t!=null)){Mc(e);return}s=s!=null?""+sn(s):"",t=t!=null?""+sn(t):s,p||t===e.value||(e.value=t),e.defaultValue=t}r=r??c,r=typeof r!="function"&&typeof r!="symbol"&&!!r,e.checked=p?e.checked:!!r,e.defaultChecked=!!r,h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"&&(e.name=h),Mc(e)}function Rc(e,t,s){t==="number"&&Ga(e.ownerDocument)===e||e.defaultValue===""+s||(e.defaultValue=""+s)}function Ti(e,t,s,r){if(e=e.options,t){t={};for(var c=0;c<s.length;c++)t["$"+s[c]]=!0;for(s=0;s<e.length;s++)c=t.hasOwnProperty("$"+e[s].value),e[s].selected!==c&&(e[s].selected=c),c&&r&&(e[s].defaultSelected=!0)}else{for(s=""+sn(s),t=null,c=0;c<e.length;c++){if(e[c].value===s){e[c].selected=!0,r&&(e[c].defaultSelected=!0);return}t!==null||e[c].disabled||(t=e[c])}t!==null&&(t.selected=!0)}}function Qf(e,t,s){if(t!=null&&(t=""+sn(t),t!==e.value&&(e.value=t),s==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=s!=null?""+sn(s):""}function Xf(e,t,s,r){if(t==null){if(r!=null){if(s!=null)throw Error(l(92));if(Ge(r)){if(1<r.length)throw Error(l(93));r=r[0]}s=r}s==null&&(s=""),t=s}s=sn(t),e.defaultValue=s,r=e.textContent,r===s&&r!==""&&r!==null&&(e.value=r),Mc(e)}function ji(e,t){if(t){var s=e.firstChild;if(s&&s===e.lastChild&&s.nodeType===3){s.nodeValue=t;return}}e.textContent=t}var ry=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 $f(e,t,s){var r=t.indexOf("--")===0;s==null||typeof s=="boolean"||s===""?r?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":r?e.setProperty(t,s):typeof s!="number"||s===0||ry.has(t)?t==="float"?e.cssFloat=s:e[t]=(""+s).trim():e[t]=s+"px"}function Kf(e,t,s){if(t!=null&&typeof t!="object")throw Error(l(62));if(e=e.style,s!=null){for(var r in s)!s.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf("--")===0?e.setProperty(r,""):r==="float"?e.cssFloat="":e[r]="");for(var c in t)r=t[c],t.hasOwnProperty(c)&&s[c]!==r&&$f(e,c,r)}else for(var u in t)t.hasOwnProperty(u)&&$f(e,u,t[u])}function zc(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 ay=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"]]),ly=/^[\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 Ya(e){return ly.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Yn(){}var Uc=null;function qc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ni=null,Ci=null;function Ff(e){var t=x(e);if(t&&(e=t.stateNode)){var s=e[nt]||null;e:switch(e=t.stateNode,t.type){case"input":if(kc(e,s.value,s.defaultValue,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name),t=s.name,s.type==="radio"&&t!=null){for(s=e;s.parentNode;)s=s.parentNode;for(s=s.querySelectorAll('input[name="'+rn(""+t)+'"][type="radio"]'),t=0;t<s.length;t++){var r=s[t];if(r!==e&&r.form===e.form){var c=r[nt]||null;if(!c)throw Error(l(90));kc(r,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name)}}for(t=0;t<s.length;t++)r=s[t],r.form===e.form&&Pf(r)}break e;case"textarea":Qf(e,s.value,s.defaultValue);break e;case"select":t=s.value,t!=null&&Ti(e,!!s.multiple,t,!1)}}}var Dc=!1;function Zf(e,t,s){if(Dc)return e(t,s);Dc=!0;try{var r=e(t);return r}finally{if(Dc=!1,(Ni!==null||Ci!==null)&&(Nl(),Ni&&(t=Ni,e=Ci,Ci=Ni=null,Ff(t),e)))for(t=0;t<e.length;t++)Ff(e[t])}}function Tr(e,t){var s=e.stateNode;if(s===null)return null;var r=s[nt]||null;if(r===null)return null;s=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(s&&typeof s!="function")throw Error(l(231,t,typeof s));return s}var Vn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Bc=!1;if(Vn)try{var jr={};Object.defineProperty(jr,"passive",{get:function(){Bc=!0}}),window.addEventListener("test",jr,jr),window.removeEventListener("test",jr,jr)}catch{Bc=!1}var ps=null,Lc=null,Va=null;function If(){if(Va)return Va;var e,t=Lc,s=t.length,r,c="value"in ps?ps.value:ps.textContent,u=c.length;for(e=0;e<s&&t[e]===c[e];e++);var h=s-e;for(r=1;r<=h&&t[s-r]===c[u-r];r++);return Va=c.slice(e,1<r?1-r:void 0)}function Pa(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Ja(){return!0}function Wf(){return!1}function zt(e){function t(s,r,c,u,h){this._reactName=s,this._targetInst=c,this.type=r,this.nativeEvent=u,this.target=h,this.currentTarget=null;for(var p in e)e.hasOwnProperty(p)&&(s=e[p],this[p]=s?s(u):u[p]);return this.isDefaultPrevented=(u.defaultPrevented!=null?u.defaultPrevented:u.returnValue===!1)?Ja:Wf,this.isPropagationStopped=Wf,this}return O(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var s=this.nativeEvent;s&&(s.preventDefault?s.preventDefault():typeof s.returnValue!="unknown"&&(s.returnValue=!1),this.isDefaultPrevented=Ja)},stopPropagation:function(){var s=this.nativeEvent;s&&(s.stopPropagation?s.stopPropagation():typeof s.cancelBubble!="unknown"&&(s.cancelBubble=!0),this.isPropagationStopped=Ja)},persist:function(){},isPersistent:Ja}),t}var ti={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Qa=zt(ti),Nr=O({},ti,{view:0,detail:0}),cy=zt(Nr),Hc,Gc,Cr,Xa=O({},Nr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Vc,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!==Cr&&(Cr&&e.type==="mousemove"?(Hc=e.screenX-Cr.screenX,Gc=e.screenY-Cr.screenY):Gc=Hc=0,Cr=e),Hc)},movementY:function(e){return"movementY"in e?e.movementY:Gc}}),eh=zt(Xa),oy=O({},Xa,{dataTransfer:0}),uy=zt(oy),fy=O({},Nr,{relatedTarget:0}),Yc=zt(fy),hy=O({},ti,{animationName:0,elapsedTime:0,pseudoElement:0}),dy=zt(hy),my=O({},ti,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),py=zt(my),yy=O({},ti,{data:0}),th=zt(yy),gy={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},by={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"},_y={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function vy(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=_y[e])?!!t[e]:!1}function Vc(){return vy}var xy=O({},Nr,{key:function(e){if(e.key){var t=gy[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Pa(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?by[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Vc,charCode:function(e){return e.type==="keypress"?Pa(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Pa(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Sy=zt(xy),wy=O({},Xa,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),nh=zt(wy),Ey=O({},Nr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Vc}),Ay=zt(Ey),Oy=O({},ti,{propertyName:0,elapsedTime:0,pseudoElement:0}),Ty=zt(Oy),jy=O({},Xa,{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}),Ny=zt(jy),Cy=O({},ti,{newState:0,oldState:0}),My=zt(Cy),ky=[9,13,27,32],Pc=Vn&&"CompositionEvent"in window,Mr=null;Vn&&"documentMode"in document&&(Mr=document.documentMode);var Ry=Vn&&"TextEvent"in window&&!Mr,sh=Vn&&(!Pc||Mr&&8<Mr&&11>=Mr),ih=" ",rh=!1;function ah(e,t){switch(e){case"keyup":return ky.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function lh(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Mi=!1;function zy(e,t){switch(e){case"compositionend":return lh(t);case"keypress":return t.which!==32?null:(rh=!0,ih);case"textInput":return e=t.data,e===ih&&rh?null:e;default:return null}}function Uy(e,t){if(Mi)return e==="compositionend"||!Pc&&ah(e,t)?(e=If(),Va=Lc=ps=null,Mi=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return sh&&t.locale!=="ko"?null:t.data;default:return null}}var qy={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 ch(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!qy[e.type]:t==="textarea"}function oh(e,t,s,r){Ni?Ci?Ci.push(r):Ci=[r]:Ni=r,t=ql(t,"onChange"),0<t.length&&(s=new Qa("onChange","change",null,s,r),e.push({event:s,listeners:t}))}var kr=null,Rr=null;function Dy(e){Jm(e,0)}function $a(e){var t=_(e);if(Pf(t))return e}function uh(e,t){if(e==="change")return t}var fh=!1;if(Vn){var Jc;if(Vn){var Qc="oninput"in document;if(!Qc){var hh=document.createElement("div");hh.setAttribute("oninput","return;"),Qc=typeof hh.oninput=="function"}Jc=Qc}else Jc=!1;fh=Jc&&(!document.documentMode||9<document.documentMode)}function dh(){kr&&(kr.detachEvent("onpropertychange",mh),Rr=kr=null)}function mh(e){if(e.propertyName==="value"&&$a(Rr)){var t=[];oh(t,Rr,e,qc(e)),Zf(Dy,t)}}function By(e,t,s){e==="focusin"?(dh(),kr=t,Rr=s,kr.attachEvent("onpropertychange",mh)):e==="focusout"&&dh()}function Ly(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return $a(Rr)}function Hy(e,t){if(e==="click")return $a(t)}function Gy(e,t){if(e==="input"||e==="change")return $a(t)}function Yy(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Vt=typeof Object.is=="function"?Object.is:Yy;function zr(e,t){if(Vt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var s=Object.keys(e),r=Object.keys(t);if(s.length!==r.length)return!1;for(r=0;r<s.length;r++){var c=s[r];if(!vr.call(t,c)||!Vt(e[c],t[c]))return!1}return!0}function ph(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function yh(e,t){var s=ph(e);e=0;for(var r;s;){if(s.nodeType===3){if(r=e+s.textContent.length,e<=t&&r>=t)return{node:s,offset:t-e};e=r}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=ph(s)}}function gh(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?gh(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function bh(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Ga(e.document);t instanceof e.HTMLIFrameElement;){try{var s=typeof t.contentWindow.location.href=="string"}catch{s=!1}if(s)e=t.contentWindow;else break;t=Ga(e.document)}return t}function Xc(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var Vy=Vn&&"documentMode"in document&&11>=document.documentMode,ki=null,$c=null,Ur=null,Kc=!1;function _h(e,t,s){var r=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;Kc||ki==null||ki!==Ga(r)||(r=ki,"selectionStart"in r&&Xc(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Ur&&zr(Ur,r)||(Ur=r,r=ql($c,"onSelect"),0<r.length&&(t=new Qa("onSelect","select",null,t,s),e.push({event:t,listeners:r}),t.target=ki)))}function ni(e,t){var s={};return s[e.toLowerCase()]=t.toLowerCase(),s["Webkit"+e]="webkit"+t,s["Moz"+e]="moz"+t,s}var Ri={animationend:ni("Animation","AnimationEnd"),animationiteration:ni("Animation","AnimationIteration"),animationstart:ni("Animation","AnimationStart"),transitionrun:ni("Transition","TransitionRun"),transitionstart:ni("Transition","TransitionStart"),transitioncancel:ni("Transition","TransitionCancel"),transitionend:ni("Transition","TransitionEnd")},Fc={},vh={};Vn&&(vh=document.createElement("div").style,"AnimationEvent"in window||(delete Ri.animationend.animation,delete Ri.animationiteration.animation,delete Ri.animationstart.animation),"TransitionEvent"in window||delete Ri.transitionend.transition);function si(e){if(Fc[e])return Fc[e];if(!Ri[e])return e;var t=Ri[e],s;for(s in t)if(t.hasOwnProperty(s)&&s in vh)return Fc[e]=t[s];return e}var xh=si("animationend"),Sh=si("animationiteration"),wh=si("animationstart"),Py=si("transitionrun"),Jy=si("transitionstart"),Qy=si("transitioncancel"),Eh=si("transitionend"),Ah=new Map,Zc="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(" ");Zc.push("scrollEnd");function vn(e,t){Ah.set(e,t),J(t,[e])}var Ka=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},an=[],zi=0,Ic=0;function Fa(){for(var e=zi,t=Ic=zi=0;t<e;){var s=an[t];an[t++]=null;var r=an[t];an[t++]=null;var c=an[t];an[t++]=null;var u=an[t];if(an[t++]=null,r!==null&&c!==null){var h=r.pending;h===null?c.next=c:(c.next=h.next,h.next=c),r.pending=c}u!==0&&Oh(s,c,u)}}function Za(e,t,s,r){an[zi++]=e,an[zi++]=t,an[zi++]=s,an[zi++]=r,Ic|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Wc(e,t,s,r){return Za(e,t,s,r),Ia(e)}function ii(e,t){return Za(e,null,null,t),Ia(e)}function Oh(e,t,s){e.lanes|=s;var r=e.alternate;r!==null&&(r.lanes|=s);for(var c=!1,u=e.return;u!==null;)u.childLanes|=s,r=u.alternate,r!==null&&(r.childLanes|=s),u.tag===22&&(e=u.stateNode,e===null||e._visibility&1||(c=!0)),e=u,u=u.return;return e.tag===3?(u=e.stateNode,c&&t!==null&&(c=31-jt(s),e=u.hiddenUpdates,r=e[c],r===null?e[c]=[t]:r.push(t),t.lane=s|536870912),u):null}function Ia(e){if(50<sa)throw sa=0,ou=null,Error(l(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Ui={};function Xy(e,t,s,r){this.tag=e,this.key=s,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Pt(e,t,s,r){return new Xy(e,t,s,r)}function eo(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Pn(e,t){var s=e.alternate;return s===null?(s=Pt(e.tag,t,e.key,e.mode),s.elementType=e.elementType,s.type=e.type,s.stateNode=e.stateNode,s.alternate=e,e.alternate=s):(s.pendingProps=t,s.type=e.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=e.flags&65011712,s.childLanes=e.childLanes,s.lanes=e.lanes,s.child=e.child,s.memoizedProps=e.memoizedProps,s.memoizedState=e.memoizedState,s.updateQueue=e.updateQueue,t=e.dependencies,s.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},s.sibling=e.sibling,s.index=e.index,s.ref=e.ref,s.refCleanup=e.refCleanup,s}function Th(e,t){e.flags&=65011714;var s=e.alternate;return s===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=s.childLanes,e.lanes=s.lanes,e.child=s.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=s.memoizedProps,e.memoizedState=s.memoizedState,e.updateQueue=s.updateQueue,e.type=s.type,t=s.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Wa(e,t,s,r,c,u){var h=0;if(r=e,typeof e=="function")eo(e)&&(h=1);else if(typeof e=="string")h=Ig(e,s,rt.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case X:return e=Pt(31,s,t,c),e.elementType=X,e.lanes=u,e;case W:return ri(s.children,c,u,t);case de:h=8,c|=24;break;case ye:return e=Pt(12,s,t,c|2),e.elementType=ye,e.lanes=u,e;case B:return e=Pt(13,s,t,c),e.elementType=B,e.lanes=u,e;case F:return e=Pt(19,s,t,c),e.elementType=F,e.lanes=u,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case be:h=10;break e;case ie:h=9;break e;case Xe:h=11;break e;case ne:h=14;break e;case Z:h=16,r=null;break e}h=29,s=Error(l(130,e===null?"null":typeof e,"")),r=null}return t=Pt(h,s,t,c),t.elementType=e,t.type=r,t.lanes=u,t}function ri(e,t,s,r){return e=Pt(7,e,r,t),e.lanes=s,e}function to(e,t,s){return e=Pt(6,e,null,t),e.lanes=s,e}function jh(e){var t=Pt(18,null,null,0);return t.stateNode=e,t}function no(e,t,s){return t=Pt(4,e.children!==null?e.children:[],e.key,t),t.lanes=s,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Nh=new WeakMap;function ln(e,t){if(typeof e=="object"&&e!==null){var s=Nh.get(e);return s!==void 0?s:(t={value:e,source:t,stack:ka(t)},Nh.set(e,t),t)}return{value:e,source:t,stack:ka(t)}}var qi=[],Di=0,el=null,qr=0,cn=[],on=0,ys=null,Nn=1,Cn="";function Jn(e,t){qi[Di++]=qr,qi[Di++]=el,el=e,qr=t}function Ch(e,t,s){cn[on++]=Nn,cn[on++]=Cn,cn[on++]=ys,ys=e;var r=Nn;e=Cn;var c=32-jt(r)-1;r&=~(1<<c),s+=1;var u=32-jt(t)+c;if(30<u){var h=c-c%5;u=(r&(1<<h)-1).toString(32),r>>=h,c-=h,Nn=1<<32-jt(t)+c|s<<c|r,Cn=u+e}else Nn=1<<u|s<<c|r,Cn=e}function so(e){e.return!==null&&(Jn(e,1),Ch(e,1,0))}function io(e){for(;e===el;)el=qi[--Di],qi[Di]=null,qr=qi[--Di],qi[Di]=null;for(;e===ys;)ys=cn[--on],cn[on]=null,Cn=cn[--on],cn[on]=null,Nn=cn[--on],cn[on]=null}function Mh(e,t){cn[on++]=Nn,cn[on++]=Cn,cn[on++]=ys,Nn=t.id,Cn=t.overflow,ys=e}var vt=null,Fe=null,Ce=!1,gs=null,un=!1,ro=Error(l(519));function bs(e){var t=Error(l(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Dr(ln(t,e)),ro}function kh(e){var t=e.stateNode,s=e.type,r=e.memoizedProps;switch(t[Je]=e,t[nt]=r,s){case"dialog":Te("cancel",t),Te("close",t);break;case"iframe":case"object":case"embed":Te("load",t);break;case"video":case"audio":for(s=0;s<ra.length;s++)Te(ra[s],t);break;case"source":Te("error",t);break;case"img":case"image":case"link":Te("error",t),Te("load",t);break;case"details":Te("toggle",t);break;case"input":Te("invalid",t),Jf(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case"select":Te("invalid",t);break;case"textarea":Te("invalid",t),Xf(t,r.value,r.defaultValue,r.children)}s=r.children,typeof s!="string"&&typeof s!="number"&&typeof s!="bigint"||t.textContent===""+s||r.suppressHydrationWarning===!0||Km(t.textContent,s)?(r.popover!=null&&(Te("beforetoggle",t),Te("toggle",t)),r.onScroll!=null&&Te("scroll",t),r.onScrollEnd!=null&&Te("scrollend",t),r.onClick!=null&&(t.onclick=Yn),t=!0):t=!1,t||bs(e,!0)}function Rh(e){for(vt=e.return;vt;)switch(vt.tag){case 5:case 31:case 13:un=!1;return;case 27:case 3:un=!0;return;default:vt=vt.return}}function Bi(e){if(e!==vt)return!1;if(!Ce)return Rh(e),Ce=!0,!1;var t=e.tag,s;if((s=t!==3&&t!==27)&&((s=t===5)&&(s=e.type,s=!(s!=="form"&&s!=="button")||Eu(e.type,e.memoizedProps)),s=!s),s&&Fe&&bs(e),Rh(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(317));Fe=ip(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(317));Fe=ip(e)}else t===27?(t=Fe,ks(e.type)?(e=Nu,Nu=null,Fe=e):Fe=t):Fe=vt?hn(e.stateNode.nextSibling):null;return!0}function ai(){Fe=vt=null,Ce=!1}function ao(){var e=gs;return e!==null&&(Bt===null?Bt=e:Bt.push.apply(Bt,e),gs=null),e}function Dr(e){gs===null?gs=[e]:gs.push(e)}var lo=Ee(null),li=null,Qn=null;function _s(e,t,s){Ae(lo,t._currentValue),t._currentValue=s}function Xn(e){e._currentValue=lo.current,_e(lo)}function co(e,t,s){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===s)break;e=e.return}}function oo(e,t,s,r){var c=e.child;for(c!==null&&(c.return=e);c!==null;){var u=c.dependencies;if(u!==null){var h=c.child;u=u.firstContext;e:for(;u!==null;){var p=u;u=c;for(var E=0;E<t.length;E++)if(p.context===t[E]){u.lanes|=s,p=u.alternate,p!==null&&(p.lanes|=s),co(u.return,s,e),r||(h=null);break e}u=p.next}}else if(c.tag===18){if(h=c.return,h===null)throw Error(l(341));h.lanes|=s,u=h.alternate,u!==null&&(u.lanes|=s),co(h,s,e),h=null}else h=c.child;if(h!==null)h.return=c;else for(h=c;h!==null;){if(h===e){h=null;break}if(c=h.sibling,c!==null){c.return=h.return,h=c;break}h=h.return}c=h}}function Li(e,t,s,r){e=null;for(var c=t,u=!1;c!==null;){if(!u){if((c.flags&524288)!==0)u=!0;else if((c.flags&262144)!==0)break}if(c.tag===10){var h=c.alternate;if(h===null)throw Error(l(387));if(h=h.memoizedProps,h!==null){var p=c.type;Vt(c.pendingProps.value,h.value)||(e!==null?e.push(p):e=[p])}}else if(c===At.current){if(h=c.alternate,h===null)throw Error(l(387));h.memoizedState.memoizedState!==c.memoizedState.memoizedState&&(e!==null?e.push(ua):e=[ua])}c=c.return}e!==null&&oo(t,e,s,r),t.flags|=262144}function tl(e){for(e=e.firstContext;e!==null;){if(!Vt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ci(e){li=e,Qn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function xt(e){return zh(li,e)}function nl(e,t){return li===null&&ci(e),zh(e,t)}function zh(e,t){var s=t._currentValue;if(t={context:t,memoizedValue:s,next:null},Qn===null){if(e===null)throw Error(l(308));Qn=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Qn=Qn.next=t;return s}var $y=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(s,r){e.push(r)}};this.abort=function(){t.aborted=!0,e.forEach(function(s){return s()})}},Ky=a.unstable_scheduleCallback,Fy=a.unstable_NormalPriority,ut={$$typeof:be,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function uo(){return{controller:new $y,data:new Map,refCount:0}}function Br(e){e.refCount--,e.refCount===0&&Ky(Fy,function(){e.controller.abort()})}var Lr=null,fo=0,Hi=0,Gi=null;function Zy(e,t){if(Lr===null){var s=Lr=[];fo=0,Hi=pu(),Gi={status:"pending",value:void 0,then:function(r){s.push(r)}}}return fo++,t.then(Uh,Uh),t}function Uh(){if(--fo===0&&Lr!==null){Gi!==null&&(Gi.status="fulfilled");var e=Lr;Lr=null,Hi=0,Gi=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Iy(e,t){var s=[],r={status:"pending",value:null,reason:null,then:function(c){s.push(c)}};return e.then(function(){r.status="fulfilled",r.value=t;for(var c=0;c<s.length;c++)(0,s[c])(t)},function(c){for(r.status="rejected",r.reason=c,c=0;c<s.length;c++)(0,s[c])(void 0)}),r}var qh=D.S;D.S=function(e,t){_m=Ie(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&Zy(e,t),qh!==null&&qh(e,t)};var oi=Ee(null);function ho(){var e=oi.current;return e!==null?e:Qe.pooledCache}function sl(e,t){t===null?Ae(oi,oi.current):Ae(oi,t.pool)}function Dh(){var e=ho();return e===null?null:{parent:ut._currentValue,pool:e}}var Yi=Error(l(460)),mo=Error(l(474)),il=Error(l(542)),rl={then:function(){}};function Bh(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Lh(e,t,s){switch(s=e[s],s===void 0?e.push(t):s!==t&&(t.then(Yn,Yn),t=s),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Gh(e),e;default:if(typeof t.status=="string")t.then(Yn,Yn);else{if(e=Qe,e!==null&&100<e.shellSuspendCounter)throw Error(l(482));e=t,e.status="pending",e.then(function(r){if(t.status==="pending"){var c=t;c.status="fulfilled",c.value=r}},function(r){if(t.status==="pending"){var c=t;c.status="rejected",c.reason=r}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Gh(e),e}throw fi=t,Yi}}function ui(e){try{var t=e._init;return t(e._payload)}catch(s){throw s!==null&&typeof s=="object"&&typeof s.then=="function"?(fi=s,Yi):s}}var fi=null;function Hh(){if(fi===null)throw Error(l(459));var e=fi;return fi=null,e}function Gh(e){if(e===Yi||e===il)throw Error(l(483))}var Vi=null,Hr=0;function al(e){var t=Hr;return Hr+=1,Vi===null&&(Vi=[]),Lh(Vi,e,t)}function Gr(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function ll(e,t){throw t.$$typeof===M?Error(l(525)):(e=Object.prototype.toString.call(t),Error(l(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Yh(e){function t(j,T){if(e){var k=j.deletions;k===null?(j.deletions=[T],j.flags|=16):k.push(T)}}function s(j,T){if(!e)return null;for(;T!==null;)t(j,T),T=T.sibling;return null}function r(j){for(var T=new Map;j!==null;)j.key!==null?T.set(j.key,j):T.set(j.index,j),j=j.sibling;return T}function c(j,T){return j=Pn(j,T),j.index=0,j.sibling=null,j}function u(j,T,k){return j.index=k,e?(k=j.alternate,k!==null?(k=k.index,k<T?(j.flags|=67108866,T):k):(j.flags|=67108866,T)):(j.flags|=1048576,T)}function h(j){return e&&j.alternate===null&&(j.flags|=67108866),j}function p(j,T,k,H){return T===null||T.tag!==6?(T=to(k,j.mode,H),T.return=j,T):(T=c(T,k),T.return=j,T)}function E(j,T,k,H){var he=k.type;return he===W?L(j,T,k.props.children,H,k.key):T!==null&&(T.elementType===he||typeof he=="object"&&he!==null&&he.$$typeof===Z&&ui(he)===T.type)?(T=c(T,k.props),Gr(T,k),T.return=j,T):(T=Wa(k.type,k.key,k.props,null,j.mode,H),Gr(T,k),T.return=j,T)}function R(j,T,k,H){return T===null||T.tag!==4||T.stateNode.containerInfo!==k.containerInfo||T.stateNode.implementation!==k.implementation?(T=no(k,j.mode,H),T.return=j,T):(T=c(T,k.children||[]),T.return=j,T)}function L(j,T,k,H,he){return T===null||T.tag!==7?(T=ri(k,j.mode,H,he),T.return=j,T):(T=c(T,k),T.return=j,T)}function P(j,T,k){if(typeof T=="string"&&T!==""||typeof T=="number"||typeof T=="bigint")return T=to(""+T,j.mode,k),T.return=j,T;if(typeof T=="object"&&T!==null){switch(T.$$typeof){case G:return k=Wa(T.type,T.key,T.props,null,j.mode,k),Gr(k,T),k.return=j,k;case $:return T=no(T,j.mode,k),T.return=j,T;case Z:return T=ui(T),P(j,T,k)}if(Ge(T)||se(T))return T=ri(T,j.mode,k,null),T.return=j,T;if(typeof T.then=="function")return P(j,al(T),k);if(T.$$typeof===be)return P(j,nl(j,T),k);ll(j,T)}return null}function z(j,T,k,H){var he=T!==null?T.key:null;if(typeof k=="string"&&k!==""||typeof k=="number"||typeof k=="bigint")return he!==null?null:p(j,T,""+k,H);if(typeof k=="object"&&k!==null){switch(k.$$typeof){case G:return k.key===he?E(j,T,k,H):null;case $:return k.key===he?R(j,T,k,H):null;case Z:return k=ui(k),z(j,T,k,H)}if(Ge(k)||se(k))return he!==null?null:L(j,T,k,H,null);if(typeof k.then=="function")return z(j,T,al(k),H);if(k.$$typeof===be)return z(j,T,nl(j,k),H);ll(j,k)}return null}function q(j,T,k,H,he){if(typeof H=="string"&&H!==""||typeof H=="number"||typeof H=="bigint")return j=j.get(k)||null,p(T,j,""+H,he);if(typeof H=="object"&&H!==null){switch(H.$$typeof){case G:return j=j.get(H.key===null?k:H.key)||null,E(T,j,H,he);case $:return j=j.get(H.key===null?k:H.key)||null,R(T,j,H,he);case Z:return H=ui(H),q(j,T,k,H,he)}if(Ge(H)||se(H))return j=j.get(k)||null,L(T,j,H,he,null);if(typeof H.then=="function")return q(j,T,k,al(H),he);if(H.$$typeof===be)return q(j,T,k,nl(T,H),he);ll(T,H)}return null}function ce(j,T,k,H){for(var he=null,ze=null,fe=T,Se=T=0,Ne=null;fe!==null&&Se<k.length;Se++){fe.index>Se?(Ne=fe,fe=null):Ne=fe.sibling;var Ue=z(j,fe,k[Se],H);if(Ue===null){fe===null&&(fe=Ne);break}e&&fe&&Ue.alternate===null&&t(j,fe),T=u(Ue,T,Se),ze===null?he=Ue:ze.sibling=Ue,ze=Ue,fe=Ne}if(Se===k.length)return s(j,fe),Ce&&Jn(j,Se),he;if(fe===null){for(;Se<k.length;Se++)fe=P(j,k[Se],H),fe!==null&&(T=u(fe,T,Se),ze===null?he=fe:ze.sibling=fe,ze=fe);return Ce&&Jn(j,Se),he}for(fe=r(fe);Se<k.length;Se++)Ne=q(fe,j,Se,k[Se],H),Ne!==null&&(e&&Ne.alternate!==null&&fe.delete(Ne.key===null?Se:Ne.key),T=u(Ne,T,Se),ze===null?he=Ne:ze.sibling=Ne,ze=Ne);return e&&fe.forEach(function(Ds){return t(j,Ds)}),Ce&&Jn(j,Se),he}function me(j,T,k,H){if(k==null)throw Error(l(151));for(var he=null,ze=null,fe=T,Se=T=0,Ne=null,Ue=k.next();fe!==null&&!Ue.done;Se++,Ue=k.next()){fe.index>Se?(Ne=fe,fe=null):Ne=fe.sibling;var Ds=z(j,fe,Ue.value,H);if(Ds===null){fe===null&&(fe=Ne);break}e&&fe&&Ds.alternate===null&&t(j,fe),T=u(Ds,T,Se),ze===null?he=Ds:ze.sibling=Ds,ze=Ds,fe=Ne}if(Ue.done)return s(j,fe),Ce&&Jn(j,Se),he;if(fe===null){for(;!Ue.done;Se++,Ue=k.next())Ue=P(j,Ue.value,H),Ue!==null&&(T=u(Ue,T,Se),ze===null?he=Ue:ze.sibling=Ue,ze=Ue);return Ce&&Jn(j,Se),he}for(fe=r(fe);!Ue.done;Se++,Ue=k.next())Ue=q(fe,j,Se,Ue.value,H),Ue!==null&&(e&&Ue.alternate!==null&&fe.delete(Ue.key===null?Se:Ue.key),T=u(Ue,T,Se),ze===null?he=Ue:ze.sibling=Ue,ze=Ue);return e&&fe.forEach(function(ob){return t(j,ob)}),Ce&&Jn(j,Se),he}function Pe(j,T,k,H){if(typeof k=="object"&&k!==null&&k.type===W&&k.key===null&&(k=k.props.children),typeof k=="object"&&k!==null){switch(k.$$typeof){case G:e:{for(var he=k.key;T!==null;){if(T.key===he){if(he=k.type,he===W){if(T.tag===7){s(j,T.sibling),H=c(T,k.props.children),H.return=j,j=H;break e}}else if(T.elementType===he||typeof he=="object"&&he!==null&&he.$$typeof===Z&&ui(he)===T.type){s(j,T.sibling),H=c(T,k.props),Gr(H,k),H.return=j,j=H;break e}s(j,T);break}else t(j,T);T=T.sibling}k.type===W?(H=ri(k.props.children,j.mode,H,k.key),H.return=j,j=H):(H=Wa(k.type,k.key,k.props,null,j.mode,H),Gr(H,k),H.return=j,j=H)}return h(j);case $:e:{for(he=k.key;T!==null;){if(T.key===he)if(T.tag===4&&T.stateNode.containerInfo===k.containerInfo&&T.stateNode.implementation===k.implementation){s(j,T.sibling),H=c(T,k.children||[]),H.return=j,j=H;break e}else{s(j,T);break}else t(j,T);T=T.sibling}H=no(k,j.mode,H),H.return=j,j=H}return h(j);case Z:return k=ui(k),Pe(j,T,k,H)}if(Ge(k))return ce(j,T,k,H);if(se(k)){if(he=se(k),typeof he!="function")throw Error(l(150));return k=he.call(k),me(j,T,k,H)}if(typeof k.then=="function")return Pe(j,T,al(k),H);if(k.$$typeof===be)return Pe(j,T,nl(j,k),H);ll(j,k)}return typeof k=="string"&&k!==""||typeof k=="number"||typeof k=="bigint"?(k=""+k,T!==null&&T.tag===6?(s(j,T.sibling),H=c(T,k),H.return=j,j=H):(s(j,T),H=to(k,j.mode,H),H.return=j,j=H),h(j)):s(j,T)}return function(j,T,k,H){try{Hr=0;var he=Pe(j,T,k,H);return Vi=null,he}catch(fe){if(fe===Yi||fe===il)throw fe;var ze=Pt(29,fe,null,j.mode);return ze.lanes=H,ze.return=j,ze}finally{}}}var hi=Yh(!0),Vh=Yh(!1),vs=!1;function po(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function yo(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function xs(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ss(e,t,s){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,(qe&2)!==0){var c=r.pending;return c===null?t.next=t:(t.next=c.next,c.next=t),r.pending=t,t=Ia(e),Oh(e,null,s),t}return Za(e,r,t,s),Ia(e)}function Yr(e,t,s){if(t=t.updateQueue,t!==null&&(t=t.shared,(s&4194048)!==0)){var r=t.lanes;r&=e.pendingLanes,s|=r,t.lanes=s,Is(e,s)}}function go(e,t){var s=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,s===r)){var c=null,u=null;if(s=s.firstBaseUpdate,s!==null){do{var h={lane:s.lane,tag:s.tag,payload:s.payload,callback:null,next:null};u===null?c=u=h:u=u.next=h,s=s.next}while(s!==null);u===null?c=u=t:u=u.next=t}else c=u=t;s={baseState:r.baseState,firstBaseUpdate:c,lastBaseUpdate:u,shared:r.shared,callbacks:r.callbacks},e.updateQueue=s;return}e=s.lastBaseUpdate,e===null?s.firstBaseUpdate=t:e.next=t,s.lastBaseUpdate=t}var bo=!1;function Vr(){if(bo){var e=Gi;if(e!==null)throw e}}function Pr(e,t,s,r){bo=!1;var c=e.updateQueue;vs=!1;var u=c.firstBaseUpdate,h=c.lastBaseUpdate,p=c.shared.pending;if(p!==null){c.shared.pending=null;var E=p,R=E.next;E.next=null,h===null?u=R:h.next=R,h=E;var L=e.alternate;L!==null&&(L=L.updateQueue,p=L.lastBaseUpdate,p!==h&&(p===null?L.firstBaseUpdate=R:p.next=R,L.lastBaseUpdate=E))}if(u!==null){var P=c.baseState;h=0,L=R=E=null,p=u;do{var z=p.lane&-536870913,q=z!==p.lane;if(q?(je&z)===z:(r&z)===z){z!==0&&z===Hi&&(bo=!0),L!==null&&(L=L.next={lane:0,tag:p.tag,payload:p.payload,callback:null,next:null});e:{var ce=e,me=p;z=t;var Pe=s;switch(me.tag){case 1:if(ce=me.payload,typeof ce=="function"){P=ce.call(Pe,P,z);break e}P=ce;break e;case 3:ce.flags=ce.flags&-65537|128;case 0:if(ce=me.payload,z=typeof ce=="function"?ce.call(Pe,P,z):ce,z==null)break e;P=O({},P,z);break e;case 2:vs=!0}}z=p.callback,z!==null&&(e.flags|=64,q&&(e.flags|=8192),q=c.callbacks,q===null?c.callbacks=[z]:q.push(z))}else q={lane:z,tag:p.tag,payload:p.payload,callback:p.callback,next:null},L===null?(R=L=q,E=P):L=L.next=q,h|=z;if(p=p.next,p===null){if(p=c.shared.pending,p===null)break;q=p,p=q.next,q.next=null,c.lastBaseUpdate=q,c.shared.pending=null}}while(!0);L===null&&(E=P),c.baseState=E,c.firstBaseUpdate=R,c.lastBaseUpdate=L,u===null&&(c.shared.lanes=0),Ts|=h,e.lanes=h,e.memoizedState=P}}function Ph(e,t){if(typeof e!="function")throw Error(l(191,e));e.call(t)}function Jh(e,t){var s=e.callbacks;if(s!==null)for(e.callbacks=null,e=0;e<s.length;e++)Ph(s[e],t)}var Pi=Ee(null),cl=Ee(0);function Qh(e,t){e=ns,Ae(cl,e),Ae(Pi,t),ns=e|t.baseLanes}function _o(){Ae(cl,ns),Ae(Pi,Pi.current)}function vo(){ns=cl.current,_e(Pi),_e(cl)}var Jt=Ee(null),fn=null;function ws(e){var t=e.alternate;Ae(lt,lt.current&1),Ae(Jt,e),fn===null&&(t===null||Pi.current!==null||t.memoizedState!==null)&&(fn=e)}function xo(e){Ae(lt,lt.current),Ae(Jt,e),fn===null&&(fn=e)}function Xh(e){e.tag===22?(Ae(lt,lt.current),Ae(Jt,e),fn===null&&(fn=e)):Es()}function Es(){Ae(lt,lt.current),Ae(Jt,Jt.current)}function Qt(e){_e(Jt),fn===e&&(fn=null),_e(lt)}var lt=Ee(0);function ol(e){for(var t=e;t!==null;){if(t.tag===13){var s=t.memoizedState;if(s!==null&&(s=s.dehydrated,s===null||Tu(s)||ju(s)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var $n=0,xe=null,Ye=null,ft=null,ul=!1,Ji=!1,di=!1,fl=0,Jr=0,Qi=null,Wy=0;function st(){throw Error(l(321))}function So(e,t){if(t===null)return!1;for(var s=0;s<t.length&&s<e.length;s++)if(!Vt(e[s],t[s]))return!1;return!0}function wo(e,t,s,r,c,u){return $n=u,xe=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,D.H=e===null||e.memoizedState===null?Cd:Bo,di=!1,u=s(r,c),di=!1,Ji&&(u=Kh(t,s,r,c)),$h(e),u}function $h(e){D.H=$r;var t=Ye!==null&&Ye.next!==null;if($n=0,ft=Ye=xe=null,ul=!1,Jr=0,Qi=null,t)throw Error(l(300));e===null||ht||(e=e.dependencies,e!==null&&tl(e)&&(ht=!0))}function Kh(e,t,s,r){xe=e;var c=0;do{if(Ji&&(Qi=null),Jr=0,Ji=!1,25<=c)throw Error(l(301));if(c+=1,ft=Ye=null,e.updateQueue!=null){var u=e.updateQueue;u.lastEffect=null,u.events=null,u.stores=null,u.memoCache!=null&&(u.memoCache.index=0)}D.H=Md,u=t(s,r)}while(Ji);return u}function eg(){var e=D.H,t=e.useState()[0];return t=typeof t.then=="function"?Qr(t):t,e=e.useState()[0],(Ye!==null?Ye.memoizedState:null)!==e&&(xe.flags|=1024),t}function Eo(){var e=fl!==0;return fl=0,e}function Ao(e,t,s){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s}function Oo(e){if(ul){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}ul=!1}$n=0,ft=Ye=xe=null,Ji=!1,Jr=fl=0,Qi=null}function Ct(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ft===null?xe.memoizedState=ft=e:ft=ft.next=e,ft}function ct(){if(Ye===null){var e=xe.alternate;e=e!==null?e.memoizedState:null}else e=Ye.next;var t=ft===null?xe.memoizedState:ft.next;if(t!==null)ft=t,Ye=e;else{if(e===null)throw xe.alternate===null?Error(l(467)):Error(l(310));Ye=e,e={memoizedState:Ye.memoizedState,baseState:Ye.baseState,baseQueue:Ye.baseQueue,queue:Ye.queue,next:null},ft===null?xe.memoizedState=ft=e:ft=ft.next=e}return ft}function hl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Qr(e){var t=Jr;return Jr+=1,Qi===null&&(Qi=[]),e=Lh(Qi,e,t),t=xe,(ft===null?t.memoizedState:ft.next)===null&&(t=t.alternate,D.H=t===null||t.memoizedState===null?Cd:Bo),e}function dl(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Qr(e);if(e.$$typeof===be)return xt(e)}throw Error(l(438,String(e)))}function To(e){var t=null,s=xe.updateQueue;if(s!==null&&(t=s.memoCache),t==null){var r=xe.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(c){return c.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),s===null&&(s=hl(),xe.updateQueue=s),s.memoCache=t,s=t.data[t.index],s===void 0)for(s=t.data[t.index]=Array(e),r=0;r<e;r++)s[r]=ae;return t.index++,s}function Kn(e,t){return typeof t=="function"?t(e):t}function ml(e){var t=ct();return jo(t,Ye,e)}function jo(e,t,s){var r=e.queue;if(r===null)throw Error(l(311));r.lastRenderedReducer=s;var c=e.baseQueue,u=r.pending;if(u!==null){if(c!==null){var h=c.next;c.next=u.next,u.next=h}t.baseQueue=c=u,r.pending=null}if(u=e.baseState,c===null)e.memoizedState=u;else{t=c.next;var p=h=null,E=null,R=t,L=!1;do{var P=R.lane&-536870913;if(P!==R.lane?(je&P)===P:($n&P)===P){var z=R.revertLane;if(z===0)E!==null&&(E=E.next={lane:0,revertLane:0,gesture:null,action:R.action,hasEagerState:R.hasEagerState,eagerState:R.eagerState,next:null}),P===Hi&&(L=!0);else if(($n&z)===z){R=R.next,z===Hi&&(L=!0);continue}else P={lane:0,revertLane:R.revertLane,gesture:null,action:R.action,hasEagerState:R.hasEagerState,eagerState:R.eagerState,next:null},E===null?(p=E=P,h=u):E=E.next=P,xe.lanes|=z,Ts|=z;P=R.action,di&&s(u,P),u=R.hasEagerState?R.eagerState:s(u,P)}else z={lane:P,revertLane:R.revertLane,gesture:R.gesture,action:R.action,hasEagerState:R.hasEagerState,eagerState:R.eagerState,next:null},E===null?(p=E=z,h=u):E=E.next=z,xe.lanes|=P,Ts|=P;R=R.next}while(R!==null&&R!==t);if(E===null?h=u:E.next=p,!Vt(u,e.memoizedState)&&(ht=!0,L&&(s=Gi,s!==null)))throw s;e.memoizedState=u,e.baseState=h,e.baseQueue=E,r.lastRenderedState=u}return c===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function No(e){var t=ct(),s=t.queue;if(s===null)throw Error(l(311));s.lastRenderedReducer=e;var r=s.dispatch,c=s.pending,u=t.memoizedState;if(c!==null){s.pending=null;var h=c=c.next;do u=e(u,h.action),h=h.next;while(h!==c);Vt(u,t.memoizedState)||(ht=!0),t.memoizedState=u,t.baseQueue===null&&(t.baseState=u),s.lastRenderedState=u}return[u,r]}function Fh(e,t,s){var r=xe,c=ct(),u=Ce;if(u){if(s===void 0)throw Error(l(407));s=s()}else s=t();var h=!Vt((Ye||c).memoizedState,s);if(h&&(c.memoizedState=s,ht=!0),c=c.queue,ko(Wh.bind(null,r,c,e),[e]),c.getSnapshot!==t||h||ft!==null&&ft.memoizedState.tag&1){if(r.flags|=2048,Xi(9,{destroy:void 0},Ih.bind(null,r,c,s,t),null),Qe===null)throw Error(l(349));u||($n&127)!==0||Zh(r,t,s)}return s}function Zh(e,t,s){e.flags|=16384,e={getSnapshot:t,value:s},t=xe.updateQueue,t===null?(t=hl(),xe.updateQueue=t,t.stores=[e]):(s=t.stores,s===null?t.stores=[e]:s.push(e))}function Ih(e,t,s,r){t.value=s,t.getSnapshot=r,ed(t)&&td(e)}function Wh(e,t,s){return s(function(){ed(t)&&td(e)})}function ed(e){var t=e.getSnapshot;e=e.value;try{var s=t();return!Vt(e,s)}catch{return!0}}function td(e){var t=ii(e,2);t!==null&&Lt(t,e,2)}function Co(e){var t=Ct();if(typeof e=="function"){var s=e;if(e=s(),di){Gt(!0);try{s()}finally{Gt(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Kn,lastRenderedState:e},t}function nd(e,t,s,r){return e.baseState=s,jo(e,Ye,typeof r=="function"?r:Kn)}function tg(e,t,s,r,c){if(gl(e))throw Error(l(485));if(e=t.action,e!==null){var u={payload:c,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(h){u.listeners.push(h)}};D.T!==null?s(!0):u.isTransition=!1,r(u),s=t.pending,s===null?(u.next=t.pending=u,sd(t,u)):(u.next=s.next,t.pending=s.next=u)}}function sd(e,t){var s=t.action,r=t.payload,c=e.state;if(t.isTransition){var u=D.T,h={};D.T=h;try{var p=s(c,r),E=D.S;E!==null&&E(h,p),id(e,t,p)}catch(R){Mo(e,t,R)}finally{u!==null&&h.types!==null&&(u.types=h.types),D.T=u}}else try{u=s(c,r),id(e,t,u)}catch(R){Mo(e,t,R)}}function id(e,t,s){s!==null&&typeof s=="object"&&typeof s.then=="function"?s.then(function(r){rd(e,t,r)},function(r){return Mo(e,t,r)}):rd(e,t,s)}function rd(e,t,s){t.status="fulfilled",t.value=s,ad(t),e.state=s,t=e.pending,t!==null&&(s=t.next,s===t?e.pending=null:(s=s.next,t.next=s,sd(e,s)))}function Mo(e,t,s){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status="rejected",t.reason=s,ad(t),t=t.next;while(t!==r)}e.action=null}function ad(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function ld(e,t){return t}function cd(e,t){if(Ce){var s=Qe.formState;if(s!==null){e:{var r=xe;if(Ce){if(Fe){t:{for(var c=Fe,u=un;c.nodeType!==8;){if(!u){c=null;break t}if(c=hn(c.nextSibling),c===null){c=null;break t}}u=c.data,c=u==="F!"||u==="F"?c:null}if(c){Fe=hn(c.nextSibling),r=c.data==="F!";break e}}bs(r)}r=!1}r&&(t=s[0])}}return s=Ct(),s.memoizedState=s.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ld,lastRenderedState:t},s.queue=r,s=Td.bind(null,xe,r),r.dispatch=s,r=Co(!1),u=Do.bind(null,xe,!1,r.queue),r=Ct(),c={state:t,dispatch:null,action:e,pending:null},r.queue=c,s=tg.bind(null,xe,c,u,s),c.dispatch=s,r.memoizedState=e,[t,s,!1]}function od(e){var t=ct();return ud(t,Ye,e)}function ud(e,t,s){if(t=jo(e,t,ld)[0],e=ml(Kn)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var r=Qr(t)}catch(h){throw h===Yi?il:h}else r=t;t=ct();var c=t.queue,u=c.dispatch;return s!==t.memoizedState&&(xe.flags|=2048,Xi(9,{destroy:void 0},ng.bind(null,c,s),null)),[r,u,e]}function ng(e,t){e.action=t}function fd(e){var t=ct(),s=Ye;if(s!==null)return ud(t,s,e);ct(),t=t.memoizedState,s=ct();var r=s.queue.dispatch;return s.memoizedState=e,[t,r,!1]}function Xi(e,t,s,r){return e={tag:e,create:s,deps:r,inst:t,next:null},t=xe.updateQueue,t===null&&(t=hl(),xe.updateQueue=t),s=t.lastEffect,s===null?t.lastEffect=e.next=e:(r=s.next,s.next=e,e.next=r,t.lastEffect=e),e}function hd(){return ct().memoizedState}function pl(e,t,s,r){var c=Ct();xe.flags|=e,c.memoizedState=Xi(1|t,{destroy:void 0},s,r===void 0?null:r)}function yl(e,t,s,r){var c=ct();r=r===void 0?null:r;var u=c.memoizedState.inst;Ye!==null&&r!==null&&So(r,Ye.memoizedState.deps)?c.memoizedState=Xi(t,u,s,r):(xe.flags|=e,c.memoizedState=Xi(1|t,u,s,r))}function dd(e,t){pl(8390656,8,e,t)}function ko(e,t){yl(2048,8,e,t)}function sg(e){xe.flags|=4;var t=xe.updateQueue;if(t===null)t=hl(),xe.updateQueue=t,t.events=[e];else{var s=t.events;s===null?t.events=[e]:s.push(e)}}function md(e){var t=ct().memoizedState;return sg({ref:t,nextImpl:e}),function(){if((qe&2)!==0)throw Error(l(440));return t.impl.apply(void 0,arguments)}}function pd(e,t){return yl(4,2,e,t)}function yd(e,t){return yl(4,4,e,t)}function gd(e,t){if(typeof t=="function"){e=e();var s=t(e);return function(){typeof s=="function"?s():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function bd(e,t,s){s=s!=null?s.concat([e]):null,yl(4,4,gd.bind(null,t,e),s)}function Ro(){}function _d(e,t){var s=ct();t=t===void 0?null:t;var r=s.memoizedState;return t!==null&&So(t,r[1])?r[0]:(s.memoizedState=[e,t],e)}function vd(e,t){var s=ct();t=t===void 0?null:t;var r=s.memoizedState;if(t!==null&&So(t,r[1]))return r[0];if(r=e(),di){Gt(!0);try{e()}finally{Gt(!1)}}return s.memoizedState=[r,t],r}function zo(e,t,s){return s===void 0||($n&1073741824)!==0&&(je&261930)===0?e.memoizedState=t:(e.memoizedState=s,e=xm(),xe.lanes|=e,Ts|=e,s)}function xd(e,t,s,r){return Vt(s,t)?s:Pi.current!==null?(e=zo(e,s,r),Vt(e,t)||(ht=!0),e):($n&42)===0||($n&1073741824)!==0&&(je&261930)===0?(ht=!0,e.memoizedState=s):(e=xm(),xe.lanes|=e,Ts|=e,t)}function Sd(e,t,s,r,c){var u=K.p;K.p=u!==0&&8>u?u:8;var h=D.T,p={};D.T=p,Do(e,!1,t,s);try{var E=c(),R=D.S;if(R!==null&&R(p,E),E!==null&&typeof E=="object"&&typeof E.then=="function"){var L=Iy(E,r);Xr(e,t,L,Kt(e))}else Xr(e,t,r,Kt(e))}catch(P){Xr(e,t,{then:function(){},status:"rejected",reason:P},Kt())}finally{K.p=u,h!==null&&p.types!==null&&(h.types=p.types),D.T=h}}function ig(){}function Uo(e,t,s,r){if(e.tag!==5)throw Error(l(476));var c=wd(e).queue;Sd(e,c,t,oe,s===null?ig:function(){return Ed(e),s(r)})}function wd(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:oe,baseState:oe,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Kn,lastRenderedState:oe},next:null};var s={};return t.next={memoizedState:s,baseState:s,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Kn,lastRenderedState:s},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Ed(e){var t=wd(e);t.next===null&&(t=e.alternate.memoizedState),Xr(e,t.next.queue,{},Kt())}function qo(){return xt(ua)}function Ad(){return ct().memoizedState}function Od(){return ct().memoizedState}function rg(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var s=Kt();e=xs(s);var r=Ss(t,e,s);r!==null&&(Lt(r,t,s),Yr(r,t,s)),t={cache:uo()},e.payload=t;return}t=t.return}}function ag(e,t,s){var r=Kt();s={lane:r,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},gl(e)?jd(t,s):(s=Wc(e,t,s,r),s!==null&&(Lt(s,e,r),Nd(s,t,r)))}function Td(e,t,s){var r=Kt();Xr(e,t,s,r)}function Xr(e,t,s,r){var c={lane:r,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null};if(gl(e))jd(t,c);else{var u=e.alternate;if(e.lanes===0&&(u===null||u.lanes===0)&&(u=t.lastRenderedReducer,u!==null))try{var h=t.lastRenderedState,p=u(h,s);if(c.hasEagerState=!0,c.eagerState=p,Vt(p,h))return Za(e,t,c,0),Qe===null&&Fa(),!1}catch{}finally{}if(s=Wc(e,t,c,r),s!==null)return Lt(s,e,r),Nd(s,t,r),!0}return!1}function Do(e,t,s,r){if(r={lane:2,revertLane:pu(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},gl(e)){if(t)throw Error(l(479))}else t=Wc(e,s,r,2),t!==null&&Lt(t,e,2)}function gl(e){var t=e.alternate;return e===xe||t!==null&&t===xe}function jd(e,t){Ji=ul=!0;var s=e.pending;s===null?t.next=t:(t.next=s.next,s.next=t),e.pending=t}function Nd(e,t,s){if((s&4194048)!==0){var r=t.lanes;r&=e.pendingLanes,s|=r,t.lanes=s,Is(e,s)}}var $r={readContext:xt,use:dl,useCallback:st,useContext:st,useEffect:st,useImperativeHandle:st,useLayoutEffect:st,useInsertionEffect:st,useMemo:st,useReducer:st,useRef:st,useState:st,useDebugValue:st,useDeferredValue:st,useTransition:st,useSyncExternalStore:st,useId:st,useHostTransitionStatus:st,useFormState:st,useActionState:st,useOptimistic:st,useMemoCache:st,useCacheRefresh:st};$r.useEffectEvent=st;var Cd={readContext:xt,use:dl,useCallback:function(e,t){return Ct().memoizedState=[e,t===void 0?null:t],e},useContext:xt,useEffect:dd,useImperativeHandle:function(e,t,s){s=s!=null?s.concat([e]):null,pl(4194308,4,gd.bind(null,t,e),s)},useLayoutEffect:function(e,t){return pl(4194308,4,e,t)},useInsertionEffect:function(e,t){pl(4,2,e,t)},useMemo:function(e,t){var s=Ct();t=t===void 0?null:t;var r=e();if(di){Gt(!0);try{e()}finally{Gt(!1)}}return s.memoizedState=[r,t],r},useReducer:function(e,t,s){var r=Ct();if(s!==void 0){var c=s(t);if(di){Gt(!0);try{s(t)}finally{Gt(!1)}}}else c=t;return r.memoizedState=r.baseState=c,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:c},r.queue=e,e=e.dispatch=ag.bind(null,xe,e),[r.memoizedState,e]},useRef:function(e){var t=Ct();return e={current:e},t.memoizedState=e},useState:function(e){e=Co(e);var t=e.queue,s=Td.bind(null,xe,t);return t.dispatch=s,[e.memoizedState,s]},useDebugValue:Ro,useDeferredValue:function(e,t){var s=Ct();return zo(s,e,t)},useTransition:function(){var e=Co(!1);return e=Sd.bind(null,xe,e.queue,!0,!1),Ct().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,s){var r=xe,c=Ct();if(Ce){if(s===void 0)throw Error(l(407));s=s()}else{if(s=t(),Qe===null)throw Error(l(349));(je&127)!==0||Zh(r,t,s)}c.memoizedState=s;var u={value:s,getSnapshot:t};return c.queue=u,dd(Wh.bind(null,r,u,e),[e]),r.flags|=2048,Xi(9,{destroy:void 0},Ih.bind(null,r,u,s,t),null),s},useId:function(){var e=Ct(),t=Qe.identifierPrefix;if(Ce){var s=Cn,r=Nn;s=(r&~(1<<32-jt(r)-1)).toString(32)+s,t="_"+t+"R_"+s,s=fl++,0<s&&(t+="H"+s.toString(32)),t+="_"}else s=Wy++,t="_"+t+"r_"+s.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:qo,useFormState:cd,useActionState:cd,useOptimistic:function(e){var t=Ct();t.memoizedState=t.baseState=e;var s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=s,t=Do.bind(null,xe,!0,s),s.dispatch=t,[e,t]},useMemoCache:To,useCacheRefresh:function(){return Ct().memoizedState=rg.bind(null,xe)},useEffectEvent:function(e){var t=Ct(),s={impl:e};return t.memoizedState=s,function(){if((qe&2)!==0)throw Error(l(440));return s.impl.apply(void 0,arguments)}}},Bo={readContext:xt,use:dl,useCallback:_d,useContext:xt,useEffect:ko,useImperativeHandle:bd,useInsertionEffect:pd,useLayoutEffect:yd,useMemo:vd,useReducer:ml,useRef:hd,useState:function(){return ml(Kn)},useDebugValue:Ro,useDeferredValue:function(e,t){var s=ct();return xd(s,Ye.memoizedState,e,t)},useTransition:function(){var e=ml(Kn)[0],t=ct().memoizedState;return[typeof e=="boolean"?e:Qr(e),t]},useSyncExternalStore:Fh,useId:Ad,useHostTransitionStatus:qo,useFormState:od,useActionState:od,useOptimistic:function(e,t){var s=ct();return nd(s,Ye,e,t)},useMemoCache:To,useCacheRefresh:Od};Bo.useEffectEvent=md;var Md={readContext:xt,use:dl,useCallback:_d,useContext:xt,useEffect:ko,useImperativeHandle:bd,useInsertionEffect:pd,useLayoutEffect:yd,useMemo:vd,useReducer:No,useRef:hd,useState:function(){return No(Kn)},useDebugValue:Ro,useDeferredValue:function(e,t){var s=ct();return Ye===null?zo(s,e,t):xd(s,Ye.memoizedState,e,t)},useTransition:function(){var e=No(Kn)[0],t=ct().memoizedState;return[typeof e=="boolean"?e:Qr(e),t]},useSyncExternalStore:Fh,useId:Ad,useHostTransitionStatus:qo,useFormState:fd,useActionState:fd,useOptimistic:function(e,t){var s=ct();return Ye!==null?nd(s,Ye,e,t):(s.baseState=e,[e,s.queue.dispatch])},useMemoCache:To,useCacheRefresh:Od};Md.useEffectEvent=md;function Lo(e,t,s,r){t=e.memoizedState,s=s(r,t),s=s==null?t:O({},t,s),e.memoizedState=s,e.lanes===0&&(e.updateQueue.baseState=s)}var Ho={enqueueSetState:function(e,t,s){e=e._reactInternals;var r=Kt(),c=xs(r);c.payload=t,s!=null&&(c.callback=s),t=Ss(e,c,r),t!==null&&(Lt(t,e,r),Yr(t,e,r))},enqueueReplaceState:function(e,t,s){e=e._reactInternals;var r=Kt(),c=xs(r);c.tag=1,c.payload=t,s!=null&&(c.callback=s),t=Ss(e,c,r),t!==null&&(Lt(t,e,r),Yr(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var s=Kt(),r=xs(s);r.tag=2,t!=null&&(r.callback=t),t=Ss(e,r,s),t!==null&&(Lt(t,e,s),Yr(t,e,s))}};function kd(e,t,s,r,c,u,h){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,u,h):t.prototype&&t.prototype.isPureReactComponent?!zr(s,r)||!zr(c,u):!0}function Rd(e,t,s,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(s,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(s,r),t.state!==e&&Ho.enqueueReplaceState(t,t.state,null)}function mi(e,t){var s=t;if("ref"in t){s={};for(var r in t)r!=="ref"&&(s[r]=t[r])}if(e=e.defaultProps){s===t&&(s=O({},s));for(var c in e)s[c]===void 0&&(s[c]=e[c])}return s}function zd(e){Ka(e)}function Ud(e){console.error(e)}function qd(e){Ka(e)}function bl(e,t){try{var s=e.onUncaughtError;s(t.value,{componentStack:t.stack})}catch(r){setTimeout(function(){throw r})}}function Dd(e,t,s){try{var r=e.onCaughtError;r(s.value,{componentStack:s.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(c){setTimeout(function(){throw c})}}function Go(e,t,s){return s=xs(s),s.tag=3,s.payload={element:null},s.callback=function(){bl(e,t)},s}function Bd(e){return e=xs(e),e.tag=3,e}function Ld(e,t,s,r){var c=s.type.getDerivedStateFromError;if(typeof c=="function"){var u=r.value;e.payload=function(){return c(u)},e.callback=function(){Dd(t,s,r)}}var h=s.stateNode;h!==null&&typeof h.componentDidCatch=="function"&&(e.callback=function(){Dd(t,s,r),typeof c!="function"&&(js===null?js=new Set([this]):js.add(this));var p=r.stack;this.componentDidCatch(r.value,{componentStack:p!==null?p:""})})}function lg(e,t,s,r,c){if(s.flags|=32768,r!==null&&typeof r=="object"&&typeof r.then=="function"){if(t=s.alternate,t!==null&&Li(t,s,c,!0),s=Jt.current,s!==null){switch(s.tag){case 31:case 13:return fn===null?Cl():s.alternate===null&&it===0&&(it=3),s.flags&=-257,s.flags|=65536,s.lanes=c,r===rl?s.flags|=16384:(t=s.updateQueue,t===null?s.updateQueue=new Set([r]):t.add(r),hu(e,r,c)),!1;case 22:return s.flags|=65536,r===rl?s.flags|=16384:(t=s.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},s.updateQueue=t):(s=t.retryQueue,s===null?t.retryQueue=new Set([r]):s.add(r)),hu(e,r,c)),!1}throw Error(l(435,s.tag))}return hu(e,r,c),Cl(),!1}if(Ce)return t=Jt.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=c,r!==ro&&(e=Error(l(422),{cause:r}),Dr(ln(e,s)))):(r!==ro&&(t=Error(l(423),{cause:r}),Dr(ln(t,s))),e=e.current.alternate,e.flags|=65536,c&=-c,e.lanes|=c,r=ln(r,s),c=Go(e.stateNode,r,c),go(e,c),it!==4&&(it=2)),!1;var u=Error(l(520),{cause:r});if(u=ln(u,s),na===null?na=[u]:na.push(u),it!==4&&(it=2),t===null)return!0;r=ln(r,s),s=t;do{switch(s.tag){case 3:return s.flags|=65536,e=c&-c,s.lanes|=e,e=Go(s.stateNode,r,e),go(s,e),!1;case 1:if(t=s.type,u=s.stateNode,(s.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||u!==null&&typeof u.componentDidCatch=="function"&&(js===null||!js.has(u))))return s.flags|=65536,c&=-c,s.lanes|=c,c=Bd(c),Ld(c,e,s,r),go(s,c),!1}s=s.return}while(s!==null);return!1}var Yo=Error(l(461)),ht=!1;function St(e,t,s,r){t.child=e===null?Vh(t,null,s,r):hi(t,e.child,s,r)}function Hd(e,t,s,r,c){s=s.render;var u=t.ref;if("ref"in r){var h={};for(var p in r)p!=="ref"&&(h[p]=r[p])}else h=r;return ci(t),r=wo(e,t,s,h,u,c),p=Eo(),e!==null&&!ht?(Ao(e,t,c),Fn(e,t,c)):(Ce&&p&&so(t),t.flags|=1,St(e,t,r,c),t.child)}function Gd(e,t,s,r,c){if(e===null){var u=s.type;return typeof u=="function"&&!eo(u)&&u.defaultProps===void 0&&s.compare===null?(t.tag=15,t.type=u,Yd(e,t,u,r,c)):(e=Wa(s.type,null,r,t,t.mode,c),e.ref=t.ref,e.return=t,t.child=e)}if(u=e.child,!Fo(e,c)){var h=u.memoizedProps;if(s=s.compare,s=s!==null?s:zr,s(h,r)&&e.ref===t.ref)return Fn(e,t,c)}return t.flags|=1,e=Pn(u,r),e.ref=t.ref,e.return=t,t.child=e}function Yd(e,t,s,r,c){if(e!==null){var u=e.memoizedProps;if(zr(u,r)&&e.ref===t.ref)if(ht=!1,t.pendingProps=r=u,Fo(e,c))(e.flags&131072)!==0&&(ht=!0);else return t.lanes=e.lanes,Fn(e,t,c)}return Vo(e,t,s,r,c)}function Vd(e,t,s,r){var c=r.children,u=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode==="hidden"){if((t.flags&128)!==0){if(u=u!==null?u.baseLanes|s:s,e!==null){for(r=t.child=e.child,c=0;r!==null;)c=c|r.lanes|r.childLanes,r=r.sibling;r=c&~u}else r=0,t.child=null;return Pd(e,t,u,s,r)}if((s&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&sl(t,u!==null?u.cachePool:null),u!==null?Qh(t,u):_o(),Xh(t);else return r=t.lanes=536870912,Pd(e,t,u!==null?u.baseLanes|s:s,s,r)}else u!==null?(sl(t,u.cachePool),Qh(t,u),Es(),t.memoizedState=null):(e!==null&&sl(t,null),_o(),Es());return St(e,t,c,s),t.child}function Kr(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Pd(e,t,s,r,c){var u=ho();return u=u===null?null:{parent:ut._currentValue,pool:u},t.memoizedState={baseLanes:s,cachePool:u},e!==null&&sl(t,null),_o(),Xh(t),e!==null&&Li(e,t,r,!0),t.childLanes=c,null}function _l(e,t){return t=xl({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Jd(e,t,s){return hi(t,e.child,null,s),e=_l(t,t.pendingProps),e.flags|=2,Qt(t),t.memoizedState=null,e}function cg(e,t,s){var r=t.pendingProps,c=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Ce){if(r.mode==="hidden")return e=_l(t,r),t.lanes=536870912,Kr(null,e);if(xo(t),(e=Fe)?(e=sp(e,un),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ys!==null?{id:Nn,overflow:Cn}:null,retryLane:536870912,hydrationErrors:null},s=jh(e),s.return=t,t.child=s,vt=t,Fe=null)):e=null,e===null)throw bs(t);return t.lanes=536870912,null}return _l(t,r)}var u=e.memoizedState;if(u!==null){var h=u.dehydrated;if(xo(t),c)if(t.flags&256)t.flags&=-257,t=Jd(e,t,s);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(l(558));else if(ht||Li(e,t,s,!1),c=(s&e.childLanes)!==0,ht||c){if(r=Qe,r!==null&&(h=ms(r,s),h!==0&&h!==u.retryLane))throw u.retryLane=h,ii(e,h),Lt(r,e,h),Yo;Cl(),t=Jd(e,t,s)}else e=u.treeContext,Fe=hn(h.nextSibling),vt=t,Ce=!0,gs=null,un=!1,e!==null&&Mh(t,e),t=_l(t,r),t.flags|=4096;return t}return e=Pn(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function vl(e,t){var s=t.ref;if(s===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof s!="function"&&typeof s!="object")throw Error(l(284));(e===null||e.ref!==s)&&(t.flags|=4194816)}}function Vo(e,t,s,r,c){return ci(t),s=wo(e,t,s,r,void 0,c),r=Eo(),e!==null&&!ht?(Ao(e,t,c),Fn(e,t,c)):(Ce&&r&&so(t),t.flags|=1,St(e,t,s,c),t.child)}function Qd(e,t,s,r,c,u){return ci(t),t.updateQueue=null,s=Kh(t,r,s,c),$h(e),r=Eo(),e!==null&&!ht?(Ao(e,t,u),Fn(e,t,u)):(Ce&&r&&so(t),t.flags|=1,St(e,t,s,u),t.child)}function Xd(e,t,s,r,c){if(ci(t),t.stateNode===null){var u=Ui,h=s.contextType;typeof h=="object"&&h!==null&&(u=xt(h)),u=new s(r,u),t.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,u.updater=Ho,t.stateNode=u,u._reactInternals=t,u=t.stateNode,u.props=r,u.state=t.memoizedState,u.refs={},po(t),h=s.contextType,u.context=typeof h=="object"&&h!==null?xt(h):Ui,u.state=t.memoizedState,h=s.getDerivedStateFromProps,typeof h=="function"&&(Lo(t,s,h,r),u.state=t.memoizedState),typeof s.getDerivedStateFromProps=="function"||typeof u.getSnapshotBeforeUpdate=="function"||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(h=u.state,typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount(),h!==u.state&&Ho.enqueueReplaceState(u,u.state,null),Pr(t,r,u,c),Vr(),u.state=t.memoizedState),typeof u.componentDidMount=="function"&&(t.flags|=4194308),r=!0}else if(e===null){u=t.stateNode;var p=t.memoizedProps,E=mi(s,p);u.props=E;var R=u.context,L=s.contextType;h=Ui,typeof L=="object"&&L!==null&&(h=xt(L));var P=s.getDerivedStateFromProps;L=typeof P=="function"||typeof u.getSnapshotBeforeUpdate=="function",p=t.pendingProps!==p,L||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(p||R!==h)&&Rd(t,u,r,h),vs=!1;var z=t.memoizedState;u.state=z,Pr(t,r,u,c),Vr(),R=t.memoizedState,p||z!==R||vs?(typeof P=="function"&&(Lo(t,s,P,r),R=t.memoizedState),(E=vs||kd(t,s,E,r,z,R,h))?(L||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount()),typeof u.componentDidMount=="function"&&(t.flags|=4194308)):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=R),u.props=r,u.state=R,u.context=h,r=E):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{u=t.stateNode,yo(e,t),h=t.memoizedProps,L=mi(s,h),u.props=L,P=t.pendingProps,z=u.context,R=s.contextType,E=Ui,typeof R=="object"&&R!==null&&(E=xt(R)),p=s.getDerivedStateFromProps,(R=typeof p=="function"||typeof u.getSnapshotBeforeUpdate=="function")||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(h!==P||z!==E)&&Rd(t,u,r,E),vs=!1,z=t.memoizedState,u.state=z,Pr(t,r,u,c),Vr();var q=t.memoizedState;h!==P||z!==q||vs||e!==null&&e.dependencies!==null&&tl(e.dependencies)?(typeof p=="function"&&(Lo(t,s,p,r),q=t.memoizedState),(L=vs||kd(t,s,L,r,z,q,E)||e!==null&&e.dependencies!==null&&tl(e.dependencies))?(R||typeof u.UNSAFE_componentWillUpdate!="function"&&typeof u.componentWillUpdate!="function"||(typeof u.componentWillUpdate=="function"&&u.componentWillUpdate(r,q,E),typeof u.UNSAFE_componentWillUpdate=="function"&&u.UNSAFE_componentWillUpdate(r,q,E)),typeof u.componentDidUpdate=="function"&&(t.flags|=4),typeof u.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof u.componentDidUpdate!="function"||h===e.memoizedProps&&z===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||h===e.memoizedProps&&z===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=q),u.props=r,u.state=q,u.context=E,r=L):(typeof u.componentDidUpdate!="function"||h===e.memoizedProps&&z===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||h===e.memoizedProps&&z===e.memoizedState||(t.flags|=1024),r=!1)}return u=r,vl(e,t),r=(t.flags&128)!==0,u||r?(u=t.stateNode,s=r&&typeof s.getDerivedStateFromError!="function"?null:u.render(),t.flags|=1,e!==null&&r?(t.child=hi(t,e.child,null,c),t.child=hi(t,null,s,c)):St(e,t,s,c),t.memoizedState=u.state,e=t.child):e=Fn(e,t,c),e}function $d(e,t,s,r){return ai(),t.flags|=256,St(e,t,s,r),t.child}var Po={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Jo(e){return{baseLanes:e,cachePool:Dh()}}function Qo(e,t,s){return e=e!==null?e.childLanes&~s:0,t&&(e|=$t),e}function Kd(e,t,s){var r=t.pendingProps,c=!1,u=(t.flags&128)!==0,h;if((h=u)||(h=e!==null&&e.memoizedState===null?!1:(lt.current&2)!==0),h&&(c=!0,t.flags&=-129),h=(t.flags&32)!==0,t.flags&=-33,e===null){if(Ce){if(c?ws(t):Es(),(e=Fe)?(e=sp(e,un),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ys!==null?{id:Nn,overflow:Cn}:null,retryLane:536870912,hydrationErrors:null},s=jh(e),s.return=t,t.child=s,vt=t,Fe=null)):e=null,e===null)throw bs(t);return ju(e)?t.lanes=32:t.lanes=536870912,null}var p=r.children;return r=r.fallback,c?(Es(),c=t.mode,p=xl({mode:"hidden",children:p},c),r=ri(r,c,s,null),p.return=t,r.return=t,p.sibling=r,t.child=p,r=t.child,r.memoizedState=Jo(s),r.childLanes=Qo(e,h,s),t.memoizedState=Po,Kr(null,r)):(ws(t),Xo(t,p))}var E=e.memoizedState;if(E!==null&&(p=E.dehydrated,p!==null)){if(u)t.flags&256?(ws(t),t.flags&=-257,t=$o(e,t,s)):t.memoizedState!==null?(Es(),t.child=e.child,t.flags|=128,t=null):(Es(),p=r.fallback,c=t.mode,r=xl({mode:"visible",children:r.children},c),p=ri(p,c,s,null),p.flags|=2,r.return=t,p.return=t,r.sibling=p,t.child=r,hi(t,e.child,null,s),r=t.child,r.memoizedState=Jo(s),r.childLanes=Qo(e,h,s),t.memoizedState=Po,t=Kr(null,r));else if(ws(t),ju(p)){if(h=p.nextSibling&&p.nextSibling.dataset,h)var R=h.dgst;h=R,r=Error(l(419)),r.stack="",r.digest=h,Dr({value:r,source:null,stack:null}),t=$o(e,t,s)}else if(ht||Li(e,t,s,!1),h=(s&e.childLanes)!==0,ht||h){if(h=Qe,h!==null&&(r=ms(h,s),r!==0&&r!==E.retryLane))throw E.retryLane=r,ii(e,r),Lt(h,e,r),Yo;Tu(p)||Cl(),t=$o(e,t,s)}else Tu(p)?(t.flags|=192,t.child=e.child,t=null):(e=E.treeContext,Fe=hn(p.nextSibling),vt=t,Ce=!0,gs=null,un=!1,e!==null&&Mh(t,e),t=Xo(t,r.children),t.flags|=4096);return t}return c?(Es(),p=r.fallback,c=t.mode,E=e.child,R=E.sibling,r=Pn(E,{mode:"hidden",children:r.children}),r.subtreeFlags=E.subtreeFlags&65011712,R!==null?p=Pn(R,p):(p=ri(p,c,s,null),p.flags|=2),p.return=t,r.return=t,r.sibling=p,t.child=r,Kr(null,r),r=t.child,p=e.child.memoizedState,p===null?p=Jo(s):(c=p.cachePool,c!==null?(E=ut._currentValue,c=c.parent!==E?{parent:E,pool:E}:c):c=Dh(),p={baseLanes:p.baseLanes|s,cachePool:c}),r.memoizedState=p,r.childLanes=Qo(e,h,s),t.memoizedState=Po,Kr(e.child,r)):(ws(t),s=e.child,e=s.sibling,s=Pn(s,{mode:"visible",children:r.children}),s.return=t,s.sibling=null,e!==null&&(h=t.deletions,h===null?(t.deletions=[e],t.flags|=16):h.push(e)),t.child=s,t.memoizedState=null,s)}function Xo(e,t){return t=xl({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function xl(e,t){return e=Pt(22,e,null,t),e.lanes=0,e}function $o(e,t,s){return hi(t,e.child,null,s),e=Xo(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Fd(e,t,s){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),co(e.return,t,s)}function Ko(e,t,s,r,c,u){var h=e.memoizedState;h===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:s,tailMode:c,treeForkCount:u}:(h.isBackwards=t,h.rendering=null,h.renderingStartTime=0,h.last=r,h.tail=s,h.tailMode=c,h.treeForkCount=u)}function Zd(e,t,s){var r=t.pendingProps,c=r.revealOrder,u=r.tail;r=r.children;var h=lt.current,p=(h&2)!==0;if(p?(h=h&1|2,t.flags|=128):h&=1,Ae(lt,h),St(e,t,r,s),r=Ce?qr:0,!p&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Fd(e,s,t);else if(e.tag===19)Fd(e,s,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(c){case"forwards":for(s=t.child,c=null;s!==null;)e=s.alternate,e!==null&&ol(e)===null&&(c=s),s=s.sibling;s=c,s===null?(c=t.child,t.child=null):(c=s.sibling,s.sibling=null),Ko(t,!1,c,s,u,r);break;case"backwards":case"unstable_legacy-backwards":for(s=null,c=t.child,t.child=null;c!==null;){if(e=c.alternate,e!==null&&ol(e)===null){t.child=c;break}e=c.sibling,c.sibling=s,s=c,c=e}Ko(t,!0,s,null,u,r);break;case"together":Ko(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Fn(e,t,s){if(e!==null&&(t.dependencies=e.dependencies),Ts|=t.lanes,(s&t.childLanes)===0)if(e!==null){if(Li(e,t,s,!1),(s&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(l(153));if(t.child!==null){for(e=t.child,s=Pn(e,e.pendingProps),t.child=s,s.return=t;e.sibling!==null;)e=e.sibling,s=s.sibling=Pn(e,e.pendingProps),s.return=t;s.sibling=null}return t.child}function Fo(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&tl(e)))}function og(e,t,s){switch(t.tag){case 3:Ot(t,t.stateNode.containerInfo),_s(t,ut,e.memoizedState.cache),ai();break;case 27:case 5:Tt(t);break;case 4:Ot(t,t.stateNode.containerInfo);break;case 10:_s(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,xo(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated!==null?(ws(t),t.flags|=128,null):(s&t.child.childLanes)!==0?Kd(e,t,s):(ws(t),e=Fn(e,t,s),e!==null?e.sibling:null);ws(t);break;case 19:var c=(e.flags&128)!==0;if(r=(s&t.childLanes)!==0,r||(Li(e,t,s,!1),r=(s&t.childLanes)!==0),c){if(r)return Zd(e,t,s);t.flags|=128}if(c=t.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),Ae(lt,lt.current),r)break;return null;case 22:return t.lanes=0,Vd(e,t,s,t.pendingProps);case 24:_s(t,ut,e.memoizedState.cache)}return Fn(e,t,s)}function Id(e,t,s){if(e!==null)if(e.memoizedProps!==t.pendingProps)ht=!0;else{if(!Fo(e,s)&&(t.flags&128)===0)return ht=!1,og(e,t,s);ht=(e.flags&131072)!==0}else ht=!1,Ce&&(t.flags&1048576)!==0&&Ch(t,qr,t.index);switch(t.lanes=0,t.tag){case 16:e:{var r=t.pendingProps;if(e=ui(t.elementType),t.type=e,typeof e=="function")eo(e)?(r=mi(e,r),t.tag=1,t=Xd(null,t,e,r,s)):(t.tag=0,t=Vo(null,t,e,r,s));else{if(e!=null){var c=e.$$typeof;if(c===Xe){t.tag=11,t=Hd(null,t,e,r,s);break e}else if(c===ne){t.tag=14,t=Gd(null,t,e,r,s);break e}}throw t=$e(e)||e,Error(l(306,t,""))}}return t;case 0:return Vo(e,t,t.type,t.pendingProps,s);case 1:return r=t.type,c=mi(r,t.pendingProps),Xd(e,t,r,c,s);case 3:e:{if(Ot(t,t.stateNode.containerInfo),e===null)throw Error(l(387));r=t.pendingProps;var u=t.memoizedState;c=u.element,yo(e,t),Pr(t,r,null,s);var h=t.memoizedState;if(r=h.cache,_s(t,ut,r),r!==u.cache&&oo(t,[ut],s,!0),Vr(),r=h.element,u.isDehydrated)if(u={element:r,isDehydrated:!1,cache:h.cache},t.updateQueue.baseState=u,t.memoizedState=u,t.flags&256){t=$d(e,t,r,s);break e}else if(r!==c){c=ln(Error(l(424)),t),Dr(c),t=$d(e,t,r,s);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(Fe=hn(e.firstChild),vt=t,Ce=!0,gs=null,un=!0,s=Vh(t,null,r,s),t.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling}else{if(ai(),r===c){t=Fn(e,t,s);break e}St(e,t,r,s)}t=t.child}return t;case 26:return vl(e,t),e===null?(s=op(t.type,null,t.pendingProps,null))?t.memoizedState=s:Ce||(s=t.type,e=t.pendingProps,r=Dl(tn.current).createElement(s),r[Je]=t,r[nt]=e,wt(r,s,e),A(r),t.stateNode=r):t.memoizedState=op(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Tt(t),e===null&&Ce&&(r=t.stateNode=ap(t.type,t.pendingProps,tn.current),vt=t,un=!0,c=Fe,ks(t.type)?(Nu=c,Fe=hn(r.firstChild)):Fe=c),St(e,t,t.pendingProps.children,s),vl(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Ce&&((c=r=Fe)&&(r=Lg(r,t.type,t.pendingProps,un),r!==null?(t.stateNode=r,vt=t,Fe=hn(r.firstChild),un=!1,c=!0):c=!1),c||bs(t)),Tt(t),c=t.type,u=t.pendingProps,h=e!==null?e.memoizedProps:null,r=u.children,Eu(c,u)?r=null:h!==null&&Eu(c,h)&&(t.flags|=32),t.memoizedState!==null&&(c=wo(e,t,eg,null,null,s),ua._currentValue=c),vl(e,t),St(e,t,r,s),t.child;case 6:return e===null&&Ce&&((e=s=Fe)&&(s=Hg(s,t.pendingProps,un),s!==null?(t.stateNode=s,vt=t,Fe=null,e=!0):e=!1),e||bs(t)),null;case 13:return Kd(e,t,s);case 4:return Ot(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=hi(t,null,r,s):St(e,t,r,s),t.child;case 11:return Hd(e,t,t.type,t.pendingProps,s);case 7:return St(e,t,t.pendingProps,s),t.child;case 8:return St(e,t,t.pendingProps.children,s),t.child;case 12:return St(e,t,t.pendingProps.children,s),t.child;case 10:return r=t.pendingProps,_s(t,t.type,r.value),St(e,t,r.children,s),t.child;case 9:return c=t.type._context,r=t.pendingProps.children,ci(t),c=xt(c),r=r(c),t.flags|=1,St(e,t,r,s),t.child;case 14:return Gd(e,t,t.type,t.pendingProps,s);case 15:return Yd(e,t,t.type,t.pendingProps,s);case 19:return Zd(e,t,s);case 31:return cg(e,t,s);case 22:return Vd(e,t,s,t.pendingProps);case 24:return ci(t),r=xt(ut),e===null?(c=ho(),c===null&&(c=Qe,u=uo(),c.pooledCache=u,u.refCount++,u!==null&&(c.pooledCacheLanes|=s),c=u),t.memoizedState={parent:r,cache:c},po(t),_s(t,ut,c)):((e.lanes&s)!==0&&(yo(e,t),Pr(t,null,null,s),Vr()),c=e.memoizedState,u=t.memoizedState,c.parent!==r?(c={parent:r,cache:r},t.memoizedState=c,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=c),_s(t,ut,r)):(r=u.cache,_s(t,ut,r),r!==c.cache&&oo(t,[ut],s,!0))),St(e,t,t.pendingProps.children,s),t.child;case 29:throw t.pendingProps}throw Error(l(156,t.tag))}function Zn(e){e.flags|=4}function Zo(e,t,s,r,c){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(c&335544128)===c)if(e.stateNode.complete)e.flags|=8192;else if(Am())e.flags|=8192;else throw fi=rl,mo}else e.flags&=-16777217}function Wd(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!mp(t))if(Am())e.flags|=8192;else throw fi=rl,mo}function Sl(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Ai():536870912,e.lanes|=t,Zi|=t)}function Fr(e,t){if(!Ce)switch(e.tailMode){case"hidden":t=e.tail;for(var s=null;t!==null;)t.alternate!==null&&(s=t),t=t.sibling;s===null?e.tail=null:s.sibling=null;break;case"collapsed":s=e.tail;for(var r=null;s!==null;)s.alternate!==null&&(r=s),s=s.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Ze(e){var t=e.alternate!==null&&e.alternate.child===e.child,s=0,r=0;if(t)for(var c=e.child;c!==null;)s|=c.lanes|c.childLanes,r|=c.subtreeFlags&65011712,r|=c.flags&65011712,c.return=e,c=c.sibling;else for(c=e.child;c!==null;)s|=c.lanes|c.childLanes,r|=c.subtreeFlags,r|=c.flags,c.return=e,c=c.sibling;return e.subtreeFlags|=r,e.childLanes=s,t}function ug(e,t,s){var r=t.pendingProps;switch(io(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ze(t),null;case 1:return Ze(t),null;case 3:return s=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Xn(ut),ve(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),(e===null||e.child===null)&&(Bi(t)?Zn(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,ao())),Ze(t),null;case 26:var c=t.type,u=t.memoizedState;return e===null?(Zn(t),u!==null?(Ze(t),Wd(t,u)):(Ze(t),Zo(t,c,null,r,s))):u?u!==e.memoizedState?(Zn(t),Ze(t),Wd(t,u)):(Ze(t),t.flags&=-16777217):(e=e.memoizedProps,e!==r&&Zn(t),Ze(t),Zo(t,c,e,r,s)),null;case 27:if(Xs(t),s=tn.current,c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Zn(t);else{if(!r){if(t.stateNode===null)throw Error(l(166));return Ze(t),null}e=rt.current,Bi(t)?kh(t):(e=ap(c,r,s),t.stateNode=e,Zn(t))}return Ze(t),null;case 5:if(Xs(t),c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Zn(t);else{if(!r){if(t.stateNode===null)throw Error(l(166));return Ze(t),null}if(u=rt.current,Bi(t))kh(t);else{var h=Dl(tn.current);switch(u){case 1:u=h.createElementNS("http://www.w3.org/2000/svg",c);break;case 2:u=h.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;default:switch(c){case"svg":u=h.createElementNS("http://www.w3.org/2000/svg",c);break;case"math":u=h.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;case"script":u=h.createElement("div"),u.innerHTML="<script><\/script>",u=u.removeChild(u.firstChild);break;case"select":u=typeof r.is=="string"?h.createElement("select",{is:r.is}):h.createElement("select"),r.multiple?u.multiple=!0:r.size&&(u.size=r.size);break;default:u=typeof r.is=="string"?h.createElement(c,{is:r.is}):h.createElement(c)}}u[Je]=t,u[nt]=r;e:for(h=t.child;h!==null;){if(h.tag===5||h.tag===6)u.appendChild(h.stateNode);else if(h.tag!==4&&h.tag!==27&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===t)break e;for(;h.sibling===null;){if(h.return===null||h.return===t)break e;h=h.return}h.sibling.return=h.return,h=h.sibling}t.stateNode=u;e:switch(wt(u,c,r),c){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}r&&Zn(t)}}return Ze(t),Zo(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,s),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Zn(t);else{if(typeof r!="string"&&t.stateNode===null)throw Error(l(166));if(e=tn.current,Bi(t)){if(e=t.stateNode,s=t.memoizedProps,r=null,c=vt,c!==null)switch(c.tag){case 27:case 5:r=c.memoizedProps}e[Je]=t,e=!!(e.nodeValue===s||r!==null&&r.suppressHydrationWarning===!0||Km(e.nodeValue,s)),e||bs(t,!0)}else e=Dl(e).createTextNode(r),e[Je]=t,t.stateNode=e}return Ze(t),null;case 31:if(s=t.memoizedState,e===null||e.memoizedState!==null){if(r=Bi(t),s!==null){if(e===null){if(!r)throw Error(l(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(557));e[Je]=t}else ai(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ze(t),e=!1}else s=ao(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=s),e=!0;if(!e)return t.flags&256?(Qt(t),t):(Qt(t),null);if((t.flags&128)!==0)throw Error(l(558))}return Ze(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(c=Bi(t),r!==null&&r.dehydrated!==null){if(e===null){if(!c)throw Error(l(318));if(c=t.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(l(317));c[Je]=t}else ai(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ze(t),c=!1}else c=ao(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=c),c=!0;if(!c)return t.flags&256?(Qt(t),t):(Qt(t),null)}return Qt(t),(t.flags&128)!==0?(t.lanes=s,t):(s=r!==null,e=e!==null&&e.memoizedState!==null,s&&(r=t.child,c=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(c=r.alternate.memoizedState.cachePool.pool),u=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(u=r.memoizedState.cachePool.pool),u!==c&&(r.flags|=2048)),s!==e&&s&&(t.child.flags|=8192),Sl(t,t.updateQueue),Ze(t),null);case 4:return ve(),e===null&&_u(t.stateNode.containerInfo),Ze(t),null;case 10:return Xn(t.type),Ze(t),null;case 19:if(_e(lt),r=t.memoizedState,r===null)return Ze(t),null;if(c=(t.flags&128)!==0,u=r.rendering,u===null)if(c)Fr(r,!1);else{if(it!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(u=ol(e),u!==null){for(t.flags|=128,Fr(r,!1),e=u.updateQueue,t.updateQueue=e,Sl(t,e),t.subtreeFlags=0,e=s,s=t.child;s!==null;)Th(s,e),s=s.sibling;return Ae(lt,lt.current&1|2),Ce&&Jn(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Ie()>Tl&&(t.flags|=128,c=!0,Fr(r,!1),t.lanes=4194304)}else{if(!c)if(e=ol(u),e!==null){if(t.flags|=128,c=!0,e=e.updateQueue,t.updateQueue=e,Sl(t,e),Fr(r,!0),r.tail===null&&r.tailMode==="hidden"&&!u.alternate&&!Ce)return Ze(t),null}else 2*Ie()-r.renderingStartTime>Tl&&s!==536870912&&(t.flags|=128,c=!0,Fr(r,!1),t.lanes=4194304);r.isBackwards?(u.sibling=t.child,t.child=u):(e=r.last,e!==null?e.sibling=u:t.child=u,r.last=u)}return r.tail!==null?(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Ie(),e.sibling=null,s=lt.current,Ae(lt,c?s&1|2:s&1),Ce&&Jn(t,r.treeForkCount),e):(Ze(t),null);case 22:case 23:return Qt(t),vo(),r=t.memoizedState!==null,e!==null?e.memoizedState!==null!==r&&(t.flags|=8192):r&&(t.flags|=8192),r?(s&536870912)!==0&&(t.flags&128)===0&&(Ze(t),t.subtreeFlags&6&&(t.flags|=8192)):Ze(t),s=t.updateQueue,s!==null&&Sl(t,s.retryQueue),s=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(s=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==s&&(t.flags|=2048),e!==null&&_e(oi),null;case 24:return s=null,e!==null&&(s=e.memoizedState.cache),t.memoizedState.cache!==s&&(t.flags|=2048),Xn(ut),Ze(t),null;case 25:return null;case 30:return null}throw Error(l(156,t.tag))}function fg(e,t){switch(io(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Xn(ut),ve(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Xs(t),null;case 31:if(t.memoizedState!==null){if(Qt(t),t.alternate===null)throw Error(l(340));ai()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Qt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(l(340));ai()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return _e(lt),null;case 4:return ve(),null;case 10:return Xn(t.type),null;case 22:case 23:return Qt(t),vo(),e!==null&&_e(oi),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Xn(ut),null;case 25:return null;default:return null}}function em(e,t){switch(io(t),t.tag){case 3:Xn(ut),ve();break;case 26:case 27:case 5:Xs(t);break;case 4:ve();break;case 31:t.memoizedState!==null&&Qt(t);break;case 13:Qt(t);break;case 19:_e(lt);break;case 10:Xn(t.type);break;case 22:case 23:Qt(t),vo(),e!==null&&_e(oi);break;case 24:Xn(ut)}}function Zr(e,t){try{var s=t.updateQueue,r=s!==null?s.lastEffect:null;if(r!==null){var c=r.next;s=c;do{if((s.tag&e)===e){r=void 0;var u=s.create,h=s.inst;r=u(),h.destroy=r}s=s.next}while(s!==c)}}catch(p){He(t,t.return,p)}}function As(e,t,s){try{var r=t.updateQueue,c=r!==null?r.lastEffect:null;if(c!==null){var u=c.next;r=u;do{if((r.tag&e)===e){var h=r.inst,p=h.destroy;if(p!==void 0){h.destroy=void 0,c=t;var E=s,R=p;try{R()}catch(L){He(c,E,L)}}}r=r.next}while(r!==u)}}catch(L){He(t,t.return,L)}}function tm(e){var t=e.updateQueue;if(t!==null){var s=e.stateNode;try{Jh(t,s)}catch(r){He(e,e.return,r)}}}function nm(e,t,s){s.props=mi(e.type,e.memoizedProps),s.state=e.memoizedState;try{s.componentWillUnmount()}catch(r){He(e,t,r)}}function Ir(e,t){try{var s=e.ref;if(s!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof s=="function"?e.refCleanup=s(r):s.current=r}}catch(c){He(e,t,c)}}function Mn(e,t){var s=e.ref,r=e.refCleanup;if(s!==null)if(typeof r=="function")try{r()}catch(c){He(e,t,c)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof s=="function")try{s(null)}catch(c){He(e,t,c)}else s.current=null}function sm(e){var t=e.type,s=e.memoizedProps,r=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":s.autoFocus&&r.focus();break e;case"img":s.src?r.src=s.src:s.srcSet&&(r.srcset=s.srcSet)}}catch(c){He(e,e.return,c)}}function Io(e,t,s){try{var r=e.stateNode;Rg(r,e.type,s,t),r[nt]=t}catch(c){He(e,e.return,c)}}function im(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&ks(e.type)||e.tag===4}function Wo(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||im(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&&ks(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 eu(e,t,s){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s).insertBefore(e,t):(t=s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,t.appendChild(e),s=s._reactRootContainer,s!=null||t.onclick!==null||(t.onclick=Yn));else if(r!==4&&(r===27&&ks(e.type)&&(s=e.stateNode,t=null),e=e.child,e!==null))for(eu(e,t,s),e=e.sibling;e!==null;)eu(e,t,s),e=e.sibling}function wl(e,t,s){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?s.insertBefore(e,t):s.appendChild(e);else if(r!==4&&(r===27&&ks(e.type)&&(s=e.stateNode),e=e.child,e!==null))for(wl(e,t,s),e=e.sibling;e!==null;)wl(e,t,s),e=e.sibling}function rm(e){var t=e.stateNode,s=e.memoizedProps;try{for(var r=e.type,c=t.attributes;c.length;)t.removeAttributeNode(c[0]);wt(t,r,s),t[Je]=e,t[nt]=s}catch(u){He(e,e.return,u)}}var In=!1,dt=!1,tu=!1,am=typeof WeakSet=="function"?WeakSet:Set,gt=null;function hg(e,t){if(e=e.containerInfo,Su=Pl,e=bh(e),Xc(e)){if("selectionStart"in e)var s={start:e.selectionStart,end:e.selectionEnd};else e:{s=(s=e.ownerDocument)&&s.defaultView||window;var r=s.getSelection&&s.getSelection();if(r&&r.rangeCount!==0){s=r.anchorNode;var c=r.anchorOffset,u=r.focusNode;r=r.focusOffset;try{s.nodeType,u.nodeType}catch{s=null;break e}var h=0,p=-1,E=-1,R=0,L=0,P=e,z=null;t:for(;;){for(var q;P!==s||c!==0&&P.nodeType!==3||(p=h+c),P!==u||r!==0&&P.nodeType!==3||(E=h+r),P.nodeType===3&&(h+=P.nodeValue.length),(q=P.firstChild)!==null;)z=P,P=q;for(;;){if(P===e)break t;if(z===s&&++R===c&&(p=h),z===u&&++L===r&&(E=h),(q=P.nextSibling)!==null)break;P=z,z=P.parentNode}P=q}s=p===-1||E===-1?null:{start:p,end:E}}else s=null}s=s||{start:0,end:0}}else s=null;for(wu={focusedElem:e,selectionRange:s},Pl=!1,gt=t;gt!==null;)if(t=gt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,gt=e;else for(;gt!==null;){switch(t=gt,u=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(s=0;s<e.length;s++)c=e[s],c.ref.impl=c.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&u!==null){e=void 0,s=t,c=u.memoizedProps,u=u.memoizedState,r=s.stateNode;try{var ce=mi(s.type,c);e=r.getSnapshotBeforeUpdate(ce,u),r.__reactInternalSnapshotBeforeUpdate=e}catch(me){He(s,s.return,me)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,s=e.nodeType,s===9)Ou(e);else if(s===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Ou(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(l(163))}if(e=t.sibling,e!==null){e.return=t.return,gt=e;break}gt=t.return}}function lm(e,t,s){var r=s.flags;switch(s.tag){case 0:case 11:case 15:es(e,s),r&4&&Zr(5,s);break;case 1:if(es(e,s),r&4)if(e=s.stateNode,t===null)try{e.componentDidMount()}catch(h){He(s,s.return,h)}else{var c=mi(s.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(c,t,e.__reactInternalSnapshotBeforeUpdate)}catch(h){He(s,s.return,h)}}r&64&&tm(s),r&512&&Ir(s,s.return);break;case 3:if(es(e,s),r&64&&(e=s.updateQueue,e!==null)){if(t=null,s.child!==null)switch(s.child.tag){case 27:case 5:t=s.child.stateNode;break;case 1:t=s.child.stateNode}try{Jh(e,t)}catch(h){He(s,s.return,h)}}break;case 27:t===null&&r&4&&rm(s);case 26:case 5:es(e,s),t===null&&r&4&&sm(s),r&512&&Ir(s,s.return);break;case 12:es(e,s);break;case 31:es(e,s),r&4&&um(e,s);break;case 13:es(e,s),r&4&&fm(e,s),r&64&&(e=s.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(s=xg.bind(null,s),Gg(e,s))));break;case 22:if(r=s.memoizedState!==null||In,!r){t=t!==null&&t.memoizedState!==null||dt,c=In;var u=dt;In=r,(dt=t)&&!u?ts(e,s,(s.subtreeFlags&8772)!==0):es(e,s),In=c,dt=u}break;case 30:break;default:es(e,s)}}function cm(e){var t=e.alternate;t!==null&&(e.alternate=null,cm(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Oi(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var We=null,Ut=!1;function Wn(e,t,s){for(s=s.child;s!==null;)om(e,t,s),s=s.sibling}function om(e,t,s){if(at&&typeof at.onCommitFiberUnmount=="function")try{at.onCommitFiberUnmount(Ks,s)}catch{}switch(s.tag){case 26:dt||Mn(s,t),Wn(e,t,s),s.memoizedState?s.memoizedState.count--:s.stateNode&&(s=s.stateNode,s.parentNode.removeChild(s));break;case 27:dt||Mn(s,t);var r=We,c=Ut;ks(s.type)&&(We=s.stateNode,Ut=!1),Wn(e,t,s),la(s.stateNode),We=r,Ut=c;break;case 5:dt||Mn(s,t);case 6:if(r=We,c=Ut,We=null,Wn(e,t,s),We=r,Ut=c,We!==null)if(Ut)try{(We.nodeType===9?We.body:We.nodeName==="HTML"?We.ownerDocument.body:We).removeChild(s.stateNode)}catch(u){He(s,t,u)}else try{We.removeChild(s.stateNode)}catch(u){He(s,t,u)}break;case 18:We!==null&&(Ut?(e=We,tp(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,s.stateNode),rr(e)):tp(We,s.stateNode));break;case 4:r=We,c=Ut,We=s.stateNode.containerInfo,Ut=!0,Wn(e,t,s),We=r,Ut=c;break;case 0:case 11:case 14:case 15:As(2,s,t),dt||As(4,s,t),Wn(e,t,s);break;case 1:dt||(Mn(s,t),r=s.stateNode,typeof r.componentWillUnmount=="function"&&nm(s,t,r)),Wn(e,t,s);break;case 21:Wn(e,t,s);break;case 22:dt=(r=dt)||s.memoizedState!==null,Wn(e,t,s),dt=r;break;default:Wn(e,t,s)}}function um(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{rr(e)}catch(s){He(t,t.return,s)}}}function fm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{rr(e)}catch(s){He(t,t.return,s)}}function dg(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new am),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new am),t;default:throw Error(l(435,e.tag))}}function El(e,t){var s=dg(e);t.forEach(function(r){if(!s.has(r)){s.add(r);var c=Sg.bind(null,e,r);r.then(c,c)}})}function qt(e,t){var s=t.deletions;if(s!==null)for(var r=0;r<s.length;r++){var c=s[r],u=e,h=t,p=h;e:for(;p!==null;){switch(p.tag){case 27:if(ks(p.type)){We=p.stateNode,Ut=!1;break e}break;case 5:We=p.stateNode,Ut=!1;break e;case 3:case 4:We=p.stateNode.containerInfo,Ut=!0;break e}p=p.return}if(We===null)throw Error(l(160));om(u,h,c),We=null,Ut=!1,u=c.alternate,u!==null&&(u.return=null),c.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)hm(t,e),t=t.sibling}var xn=null;function hm(e,t){var s=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:qt(t,e),Dt(e),r&4&&(As(3,e,e.return),Zr(3,e),As(5,e,e.return));break;case 1:qt(t,e),Dt(e),r&512&&(dt||s===null||Mn(s,s.return)),r&64&&In&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(s=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=s===null?r:s.concat(r))));break;case 26:var c=xn;if(qt(t,e),Dt(e),r&512&&(dt||s===null||Mn(s,s.return)),r&4){var u=s!==null?s.memoizedState:null;if(r=e.memoizedState,s===null)if(r===null)if(e.stateNode===null){e:{r=e.type,s=e.memoizedProps,c=c.ownerDocument||c;t:switch(r){case"title":u=c.getElementsByTagName("title")[0],(!u||u[pt]||u[Je]||u.namespaceURI==="http://www.w3.org/2000/svg"||u.hasAttribute("itemprop"))&&(u=c.createElement(r),c.head.insertBefore(u,c.querySelector("head > title"))),wt(u,r,s),u[Je]=e,A(u),r=u;break e;case"link":var h=hp("link","href",c).get(r+(s.href||""));if(h){for(var p=0;p<h.length;p++)if(u=h[p],u.getAttribute("href")===(s.href==null||s.href===""?null:s.href)&&u.getAttribute("rel")===(s.rel==null?null:s.rel)&&u.getAttribute("title")===(s.title==null?null:s.title)&&u.getAttribute("crossorigin")===(s.crossOrigin==null?null:s.crossOrigin)){h.splice(p,1);break t}}u=c.createElement(r),wt(u,r,s),c.head.appendChild(u);break;case"meta":if(h=hp("meta","content",c).get(r+(s.content||""))){for(p=0;p<h.length;p++)if(u=h[p],u.getAttribute("content")===(s.content==null?null:""+s.content)&&u.getAttribute("name")===(s.name==null?null:s.name)&&u.getAttribute("property")===(s.property==null?null:s.property)&&u.getAttribute("http-equiv")===(s.httpEquiv==null?null:s.httpEquiv)&&u.getAttribute("charset")===(s.charSet==null?null:s.charSet)){h.splice(p,1);break t}}u=c.createElement(r),wt(u,r,s),c.head.appendChild(u);break;default:throw Error(l(468,r))}u[Je]=e,A(u),r=u}e.stateNode=r}else dp(c,e.type,e.stateNode);else e.stateNode=fp(c,r,e.memoizedProps);else u!==r?(u===null?s.stateNode!==null&&(s=s.stateNode,s.parentNode.removeChild(s)):u.count--,r===null?dp(c,e.type,e.stateNode):fp(c,r,e.memoizedProps)):r===null&&e.stateNode!==null&&Io(e,e.memoizedProps,s.memoizedProps)}break;case 27:qt(t,e),Dt(e),r&512&&(dt||s===null||Mn(s,s.return)),s!==null&&r&4&&Io(e,e.memoizedProps,s.memoizedProps);break;case 5:if(qt(t,e),Dt(e),r&512&&(dt||s===null||Mn(s,s.return)),e.flags&32){c=e.stateNode;try{ji(c,"")}catch(ce){He(e,e.return,ce)}}r&4&&e.stateNode!=null&&(c=e.memoizedProps,Io(e,c,s!==null?s.memoizedProps:c)),r&1024&&(tu=!0);break;case 6:if(qt(t,e),Dt(e),r&4){if(e.stateNode===null)throw Error(l(162));r=e.memoizedProps,s=e.stateNode;try{s.nodeValue=r}catch(ce){He(e,e.return,ce)}}break;case 3:if(Hl=null,c=xn,xn=Bl(t.containerInfo),qt(t,e),xn=c,Dt(e),r&4&&s!==null&&s.memoizedState.isDehydrated)try{rr(t.containerInfo)}catch(ce){He(e,e.return,ce)}tu&&(tu=!1,dm(e));break;case 4:r=xn,xn=Bl(e.stateNode.containerInfo),qt(t,e),Dt(e),xn=r;break;case 12:qt(t,e),Dt(e);break;case 31:qt(t,e),Dt(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,El(e,r)));break;case 13:qt(t,e),Dt(e),e.child.flags&8192&&e.memoizedState!==null!=(s!==null&&s.memoizedState!==null)&&(Ol=Ie()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,El(e,r)));break;case 22:c=e.memoizedState!==null;var E=s!==null&&s.memoizedState!==null,R=In,L=dt;if(In=R||c,dt=L||E,qt(t,e),dt=L,In=R,Dt(e),r&8192)e:for(t=e.stateNode,t._visibility=c?t._visibility&-2:t._visibility|1,c&&(s===null||E||In||dt||pi(e)),s=null,t=e;;){if(t.tag===5||t.tag===26){if(s===null){E=s=t;try{if(u=E.stateNode,c)h=u.style,typeof h.setProperty=="function"?h.setProperty("display","none","important"):h.display="none";else{p=E.stateNode;var P=E.memoizedProps.style,z=P!=null&&P.hasOwnProperty("display")?P.display:null;p.style.display=z==null||typeof z=="boolean"?"":(""+z).trim()}}catch(ce){He(E,E.return,ce)}}}else if(t.tag===6){if(s===null){E=t;try{E.stateNode.nodeValue=c?"":E.memoizedProps}catch(ce){He(E,E.return,ce)}}}else if(t.tag===18){if(s===null){E=t;try{var q=E.stateNode;c?np(q,!0):np(E.stateNode,!1)}catch(ce){He(E,E.return,ce)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;s===t&&(s=null),t=t.return}s===t&&(s=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(s=r.retryQueue,s!==null&&(r.retryQueue=null,El(e,s))));break;case 19:qt(t,e),Dt(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,El(e,r)));break;case 30:break;case 21:break;default:qt(t,e),Dt(e)}}function Dt(e){var t=e.flags;if(t&2){try{for(var s,r=e.return;r!==null;){if(im(r)){s=r;break}r=r.return}if(s==null)throw Error(l(160));switch(s.tag){case 27:var c=s.stateNode,u=Wo(e);wl(e,u,c);break;case 5:var h=s.stateNode;s.flags&32&&(ji(h,""),s.flags&=-33);var p=Wo(e);wl(e,p,h);break;case 3:case 4:var E=s.stateNode.containerInfo,R=Wo(e);eu(e,R,E);break;default:throw Error(l(161))}}catch(L){He(e,e.return,L)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function dm(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;dm(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function es(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)lm(e,t.alternate,t),t=t.sibling}function pi(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:As(4,t,t.return),pi(t);break;case 1:Mn(t,t.return);var s=t.stateNode;typeof s.componentWillUnmount=="function"&&nm(t,t.return,s),pi(t);break;case 27:la(t.stateNode);case 26:case 5:Mn(t,t.return),pi(t);break;case 22:t.memoizedState===null&&pi(t);break;case 30:pi(t);break;default:pi(t)}e=e.sibling}}function ts(e,t,s){for(s=s&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var r=t.alternate,c=e,u=t,h=u.flags;switch(u.tag){case 0:case 11:case 15:ts(c,u,s),Zr(4,u);break;case 1:if(ts(c,u,s),r=u,c=r.stateNode,typeof c.componentDidMount=="function")try{c.componentDidMount()}catch(R){He(r,r.return,R)}if(r=u,c=r.updateQueue,c!==null){var p=r.stateNode;try{var E=c.shared.hiddenCallbacks;if(E!==null)for(c.shared.hiddenCallbacks=null,c=0;c<E.length;c++)Ph(E[c],p)}catch(R){He(r,r.return,R)}}s&&h&64&&tm(u),Ir(u,u.return);break;case 27:rm(u);case 26:case 5:ts(c,u,s),s&&r===null&&h&4&&sm(u),Ir(u,u.return);break;case 12:ts(c,u,s);break;case 31:ts(c,u,s),s&&h&4&&um(c,u);break;case 13:ts(c,u,s),s&&h&4&&fm(c,u);break;case 22:u.memoizedState===null&&ts(c,u,s),Ir(u,u.return);break;case 30:break;default:ts(c,u,s)}t=t.sibling}}function nu(e,t){var s=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(s=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==s&&(e!=null&&e.refCount++,s!=null&&Br(s))}function su(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Br(e))}function Sn(e,t,s,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)mm(e,t,s,r),t=t.sibling}function mm(e,t,s,r){var c=t.flags;switch(t.tag){case 0:case 11:case 15:Sn(e,t,s,r),c&2048&&Zr(9,t);break;case 1:Sn(e,t,s,r);break;case 3:Sn(e,t,s,r),c&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Br(e)));break;case 12:if(c&2048){Sn(e,t,s,r),e=t.stateNode;try{var u=t.memoizedProps,h=u.id,p=u.onPostCommit;typeof p=="function"&&p(h,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(E){He(t,t.return,E)}}else Sn(e,t,s,r);break;case 31:Sn(e,t,s,r);break;case 13:Sn(e,t,s,r);break;case 23:break;case 22:u=t.stateNode,h=t.alternate,t.memoizedState!==null?u._visibility&2?Sn(e,t,s,r):Wr(e,t):u._visibility&2?Sn(e,t,s,r):(u._visibility|=2,$i(e,t,s,r,(t.subtreeFlags&10256)!==0||!1)),c&2048&&nu(h,t);break;case 24:Sn(e,t,s,r),c&2048&&su(t.alternate,t);break;default:Sn(e,t,s,r)}}function $i(e,t,s,r,c){for(c=c&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var u=e,h=t,p=s,E=r,R=h.flags;switch(h.tag){case 0:case 11:case 15:$i(u,h,p,E,c),Zr(8,h);break;case 23:break;case 22:var L=h.stateNode;h.memoizedState!==null?L._visibility&2?$i(u,h,p,E,c):Wr(u,h):(L._visibility|=2,$i(u,h,p,E,c)),c&&R&2048&&nu(h.alternate,h);break;case 24:$i(u,h,p,E,c),c&&R&2048&&su(h.alternate,h);break;default:$i(u,h,p,E,c)}t=t.sibling}}function Wr(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var s=e,r=t,c=r.flags;switch(r.tag){case 22:Wr(s,r),c&2048&&nu(r.alternate,r);break;case 24:Wr(s,r),c&2048&&su(r.alternate,r);break;default:Wr(s,r)}t=t.sibling}}var ea=8192;function Ki(e,t,s){if(e.subtreeFlags&ea)for(e=e.child;e!==null;)pm(e,t,s),e=e.sibling}function pm(e,t,s){switch(e.tag){case 26:Ki(e,t,s),e.flags&ea&&e.memoizedState!==null&&Wg(s,xn,e.memoizedState,e.memoizedProps);break;case 5:Ki(e,t,s);break;case 3:case 4:var r=xn;xn=Bl(e.stateNode.containerInfo),Ki(e,t,s),xn=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=ea,ea=16777216,Ki(e,t,s),ea=r):Ki(e,t,s));break;default:Ki(e,t,s)}}function ym(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function ta(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var s=0;s<t.length;s++){var r=t[s];gt=r,bm(r,e)}ym(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)gm(e),e=e.sibling}function gm(e){switch(e.tag){case 0:case 11:case 15:ta(e),e.flags&2048&&As(9,e,e.return);break;case 3:ta(e);break;case 12:ta(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Al(e)):ta(e);break;default:ta(e)}}function Al(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var s=0;s<t.length;s++){var r=t[s];gt=r,bm(r,e)}ym(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:As(8,t,t.return),Al(t);break;case 22:s=t.stateNode,s._visibility&2&&(s._visibility&=-3,Al(t));break;default:Al(t)}e=e.sibling}}function bm(e,t){for(;gt!==null;){var s=gt;switch(s.tag){case 0:case 11:case 15:As(8,s,t);break;case 23:case 22:if(s.memoizedState!==null&&s.memoizedState.cachePool!==null){var r=s.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:Br(s.memoizedState.cache)}if(r=s.child,r!==null)r.return=s,gt=r;else e:for(s=e;gt!==null;){r=gt;var c=r.sibling,u=r.return;if(cm(r),r===s){gt=null;break e}if(c!==null){c.return=u,gt=c;break e}gt=u}}}var mg={getCacheForType:function(e){var t=xt(ut),s=t.data.get(e);return s===void 0&&(s=e(),t.data.set(e,s)),s},cacheSignal:function(){return xt(ut).controller.signal}},pg=typeof WeakMap=="function"?WeakMap:Map,qe=0,Qe=null,Oe=null,je=0,Le=0,Xt=null,Os=!1,Fi=!1,iu=!1,ns=0,it=0,Ts=0,yi=0,ru=0,$t=0,Zi=0,na=null,Bt=null,au=!1,Ol=0,_m=0,Tl=1/0,jl=null,js=null,yt=0,Ns=null,Ii=null,ss=0,lu=0,cu=null,vm=null,sa=0,ou=null;function Kt(){return(qe&2)!==0&&je!==0?je&-je:D.T!==null?pu():Ar()}function xm(){if($t===0)if((je&536870912)===0||Ce){var e=Ln;Ln<<=1,(Ln&3932160)===0&&(Ln=262144),$t=e}else $t=536870912;return e=Jt.current,e!==null&&(e.flags|=32),$t}function Lt(e,t,s){(e===Qe&&(Le===2||Le===9)||e.cancelPendingCommit!==null)&&(Wi(e,0),Cs(e,je,$t,!1)),bn(e,s),((qe&2)===0||e!==Qe)&&(e===Qe&&((qe&2)===0&&(yi|=s),it===4&&Cs(e,je,$t,!1)),kn(e))}function Sm(e,t,s){if((qe&6)!==0)throw Error(l(327));var r=!s&&(t&127)===0&&(t&e.expiredLanes)===0||Zs(e,t),c=r?bg(e,t):fu(e,t,!0),u=r;do{if(c===0){Fi&&!r&&Cs(e,t,0,!1);break}else{if(s=e.current.alternate,u&&!yg(s)){c=fu(e,t,!1),u=!1;continue}if(c===2){if(u=t,e.errorRecoveryDisabledLanes&u)var h=0;else h=e.pendingLanes&-536870913,h=h!==0?h:h&536870912?536870912:0;if(h!==0){t=h;e:{var p=e;c=na;var E=p.current.memoizedState.isDehydrated;if(E&&(Wi(p,h).flags|=256),h=fu(p,h,!1),h!==2){if(iu&&!E){p.errorRecoveryDisabledLanes|=u,yi|=u,c=4;break e}u=Bt,Bt=c,u!==null&&(Bt===null?Bt=u:Bt.push.apply(Bt,u))}c=h}if(u=!1,c!==2)continue}}if(c===1){Wi(e,0),Cs(e,t,0,!0);break}e:{switch(r=e,u=c,u){case 0:case 1:throw Error(l(345));case 4:if((t&4194048)!==t)break;case 6:Cs(r,t,$t,!Os);break e;case 2:Bt=null;break;case 3:case 5:break;default:throw Error(l(329))}if((t&62914560)===t&&(c=Ol+300-Ie(),10<c)){if(Cs(r,t,$t,!Os),Fs(r,0,!0)!==0)break e;ss=t,r.timeoutHandle=Wm(wm.bind(null,r,s,Bt,jl,au,t,$t,yi,Zi,Os,u,"Throttled",-0,0),c);break e}wm(r,s,Bt,jl,au,t,$t,yi,Zi,Os,u,null,-0,0)}}break}while(!0);kn(e)}function wm(e,t,s,r,c,u,h,p,E,R,L,P,z,q){if(e.timeoutHandle=-1,P=t.subtreeFlags,P&8192||(P&16785408)===16785408){P={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Yn},pm(t,u,P);var ce=(u&62914560)===u?Ol-Ie():(u&4194048)===u?_m-Ie():0;if(ce=eb(P,ce),ce!==null){ss=u,e.cancelPendingCommit=ce(Mm.bind(null,e,t,u,s,r,c,h,p,E,L,P,null,z,q)),Cs(e,u,h,!R);return}}Mm(e,t,u,s,r,c,h,p,E)}function yg(e){for(var t=e;;){var s=t.tag;if((s===0||s===11||s===15)&&t.flags&16384&&(s=t.updateQueue,s!==null&&(s=s.stores,s!==null)))for(var r=0;r<s.length;r++){var c=s[r],u=c.getSnapshot;c=c.value;try{if(!Vt(u(),c))return!1}catch{return!1}}if(s=t.child,t.subtreeFlags&16384&&s!==null)s.return=t,t=s;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Cs(e,t,s,r){t&=~ru,t&=~yi,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var c=t;0<c;){var u=31-jt(c),h=1<<u;r[u]=-1,c&=~h}s!==0&&ds(e,s,t)}function Nl(){return(qe&6)===0?(ia(0),!1):!0}function uu(){if(Oe!==null){if(Le===0)var e=Oe.return;else e=Oe,Qn=li=null,Oo(e),Vi=null,Hr=0,e=Oe;for(;e!==null;)em(e.alternate,e),e=e.return;Oe=null}}function Wi(e,t){var s=e.timeoutHandle;s!==-1&&(e.timeoutHandle=-1,qg(s)),s=e.cancelPendingCommit,s!==null&&(e.cancelPendingCommit=null,s()),ss=0,uu(),Qe=e,Oe=s=Pn(e.current,null),je=t,Le=0,Xt=null,Os=!1,Fi=Zs(e,t),iu=!1,Zi=$t=ru=yi=Ts=it=0,Bt=na=null,au=!1,(t&8)!==0&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var c=31-jt(r),u=1<<c;t|=e[c],r&=~u}return ns=t,Fa(),s}function Em(e,t){xe=null,D.H=$r,t===Yi||t===il?(t=Hh(),Le=3):t===mo?(t=Hh(),Le=4):Le=t===Yo?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Xt=t,Oe===null&&(it=1,bl(e,ln(t,e.current)))}function Am(){var e=Jt.current;return e===null?!0:(je&4194048)===je?fn===null:(je&62914560)===je||(je&536870912)!==0?e===fn:!1}function Om(){var e=D.H;return D.H=$r,e===null?$r:e}function Tm(){var e=D.A;return D.A=mg,e}function Cl(){it=4,Os||(je&4194048)!==je&&Jt.current!==null||(Fi=!0),(Ts&134217727)===0&&(yi&134217727)===0||Qe===null||Cs(Qe,je,$t,!1)}function fu(e,t,s){var r=qe;qe|=2;var c=Om(),u=Tm();(Qe!==e||je!==t)&&(jl=null,Wi(e,t)),t=!1;var h=it;e:do try{if(Le!==0&&Oe!==null){var p=Oe,E=Xt;switch(Le){case 8:uu(),h=6;break e;case 3:case 2:case 9:case 6:Jt.current===null&&(t=!0);var R=Le;if(Le=0,Xt=null,er(e,p,E,R),s&&Fi){h=0;break e}break;default:R=Le,Le=0,Xt=null,er(e,p,E,R)}}gg(),h=it;break}catch(L){Em(e,L)}while(!0);return t&&e.shellSuspendCounter++,Qn=li=null,qe=r,D.H=c,D.A=u,Oe===null&&(Qe=null,je=0,Fa()),h}function gg(){for(;Oe!==null;)jm(Oe)}function bg(e,t){var s=qe;qe|=2;var r=Om(),c=Tm();Qe!==e||je!==t?(jl=null,Tl=Ie()+500,Wi(e,t)):Fi=Zs(e,t);e:do try{if(Le!==0&&Oe!==null){t=Oe;var u=Xt;t:switch(Le){case 1:Le=0,Xt=null,er(e,t,u,1);break;case 2:case 9:if(Bh(u)){Le=0,Xt=null,Nm(t);break}t=function(){Le!==2&&Le!==9||Qe!==e||(Le=7),kn(e)},u.then(t,t);break e;case 3:Le=7;break e;case 4:Le=5;break e;case 7:Bh(u)?(Le=0,Xt=null,Nm(t)):(Le=0,Xt=null,er(e,t,u,7));break;case 5:var h=null;switch(Oe.tag){case 26:h=Oe.memoizedState;case 5:case 27:var p=Oe;if(h?mp(h):p.stateNode.complete){Le=0,Xt=null;var E=p.sibling;if(E!==null)Oe=E;else{var R=p.return;R!==null?(Oe=R,Ml(R)):Oe=null}break t}}Le=0,Xt=null,er(e,t,u,5);break;case 6:Le=0,Xt=null,er(e,t,u,6);break;case 8:uu(),it=6;break e;default:throw Error(l(462))}}_g();break}catch(L){Em(e,L)}while(!0);return Qn=li=null,D.H=r,D.A=c,qe=s,Oe!==null?0:(Qe=null,je=0,Fa(),it)}function _g(){for(;Oe!==null&&!Ra();)jm(Oe)}function jm(e){var t=Id(e.alternate,e,ns);e.memoizedProps=e.pendingProps,t===null?Ml(e):Oe=t}function Nm(e){var t=e,s=t.alternate;switch(t.tag){case 15:case 0:t=Qd(s,t,t.pendingProps,t.type,void 0,je);break;case 11:t=Qd(s,t,t.pendingProps,t.type.render,t.ref,je);break;case 5:Oo(t);default:em(s,t),t=Oe=Th(t,ns),t=Id(s,t,ns)}e.memoizedProps=e.pendingProps,t===null?Ml(e):Oe=t}function er(e,t,s,r){Qn=li=null,Oo(t),Vi=null,Hr=0;var c=t.return;try{if(lg(e,c,t,s,je)){it=1,bl(e,ln(s,e.current)),Oe=null;return}}catch(u){if(c!==null)throw Oe=c,u;it=1,bl(e,ln(s,e.current)),Oe=null;return}t.flags&32768?(Ce||r===1?e=!0:Fi||(je&536870912)!==0?e=!1:(Os=e=!0,(r===2||r===9||r===3||r===6)&&(r=Jt.current,r!==null&&r.tag===13&&(r.flags|=16384))),Cm(t,e)):Ml(t)}function Ml(e){var t=e;do{if((t.flags&32768)!==0){Cm(t,Os);return}e=t.return;var s=ug(t.alternate,t,ns);if(s!==null){Oe=s;return}if(t=t.sibling,t!==null){Oe=t;return}Oe=t=e}while(t!==null);it===0&&(it=5)}function Cm(e,t){do{var s=fg(e.alternate,e);if(s!==null){s.flags&=32767,Oe=s;return}if(s=e.return,s!==null&&(s.flags|=32768,s.subtreeFlags=0,s.deletions=null),!t&&(e=e.sibling,e!==null)){Oe=e;return}Oe=e=s}while(e!==null);it=6,Oe=null}function Mm(e,t,s,r,c,u,h,p,E){e.cancelPendingCommit=null;do kl();while(yt!==0);if((qe&6)!==0)throw Error(l(327));if(t!==null){if(t===e.current)throw Error(l(177));if(u=t.lanes|t.childLanes,u|=Ic,hs(e,s,u,h,p,E),e===Qe&&(Oe=Qe=null,je=0),Ii=t,Ns=e,ss=s,lu=u,cu=c,vm=r,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,wg(wi,function(){return qm(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||r){r=D.T,D.T=null,c=K.p,K.p=2,h=qe,qe|=4;try{hg(e,t,s)}finally{qe=h,K.p=c,D.T=r}}yt=1,km(),Rm(),zm()}}function km(){if(yt===1){yt=0;var e=Ns,t=Ii,s=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||s){s=D.T,D.T=null;var r=K.p;K.p=2;var c=qe;qe|=4;try{hm(t,e);var u=wu,h=bh(e.containerInfo),p=u.focusedElem,E=u.selectionRange;if(h!==p&&p&&p.ownerDocument&&gh(p.ownerDocument.documentElement,p)){if(E!==null&&Xc(p)){var R=E.start,L=E.end;if(L===void 0&&(L=R),"selectionStart"in p)p.selectionStart=R,p.selectionEnd=Math.min(L,p.value.length);else{var P=p.ownerDocument||document,z=P&&P.defaultView||window;if(z.getSelection){var q=z.getSelection(),ce=p.textContent.length,me=Math.min(E.start,ce),Pe=E.end===void 0?me:Math.min(E.end,ce);!q.extend&&me>Pe&&(h=Pe,Pe=me,me=h);var j=yh(p,me),T=yh(p,Pe);if(j&&T&&(q.rangeCount!==1||q.anchorNode!==j.node||q.anchorOffset!==j.offset||q.focusNode!==T.node||q.focusOffset!==T.offset)){var k=P.createRange();k.setStart(j.node,j.offset),q.removeAllRanges(),me>Pe?(q.addRange(k),q.extend(T.node,T.offset)):(k.setEnd(T.node,T.offset),q.addRange(k))}}}}for(P=[],q=p;q=q.parentNode;)q.nodeType===1&&P.push({element:q,left:q.scrollLeft,top:q.scrollTop});for(typeof p.focus=="function"&&p.focus(),p=0;p<P.length;p++){var H=P[p];H.element.scrollLeft=H.left,H.element.scrollTop=H.top}}Pl=!!Su,wu=Su=null}finally{qe=c,K.p=r,D.T=s}}e.current=t,yt=2}}function Rm(){if(yt===2){yt=0;var e=Ns,t=Ii,s=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||s){s=D.T,D.T=null;var r=K.p;K.p=2;var c=qe;qe|=4;try{lm(e,t.alternate,t)}finally{qe=c,K.p=r,D.T=s}}yt=3}}function zm(){if(yt===4||yt===3){yt=0,Si();var e=Ns,t=Ii,s=ss,r=vm;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?yt=5:(yt=0,Ii=Ns=null,Um(e,e.pendingLanes));var c=e.pendingLanes;if(c===0&&(js=null),Ws(s),t=t.stateNode,at&&typeof at.onCommitFiberRoot=="function")try{at.onCommitFiberRoot(Ks,t,void 0,(t.current.flags&128)===128)}catch{}if(r!==null){t=D.T,c=K.p,K.p=2,D.T=null;try{for(var u=e.onRecoverableError,h=0;h<r.length;h++){var p=r[h];u(p.value,{componentStack:p.stack})}}finally{D.T=t,K.p=c}}(ss&3)!==0&&kl(),kn(e),c=e.pendingLanes,(s&261930)!==0&&(c&42)!==0?e===ou?sa++:(sa=0,ou=e):sa=0,ia(0)}}function Um(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Br(t)))}function kl(){return km(),Rm(),zm(),qm()}function qm(){if(yt!==5)return!1;var e=Ns,t=lu;lu=0;var s=Ws(ss),r=D.T,c=K.p;try{K.p=32>s?32:s,D.T=null,s=cu,cu=null;var u=Ns,h=ss;if(yt=0,Ii=Ns=null,ss=0,(qe&6)!==0)throw Error(l(331));var p=qe;if(qe|=4,gm(u.current),mm(u,u.current,h,s),qe=p,ia(0,!1),at&&typeof at.onPostCommitFiberRoot=="function")try{at.onPostCommitFiberRoot(Ks,u)}catch{}return!0}finally{K.p=c,D.T=r,Um(e,t)}}function Dm(e,t,s){t=ln(s,t),t=Go(e.stateNode,t,2),e=Ss(e,t,2),e!==null&&(bn(e,2),kn(e))}function He(e,t,s){if(e.tag===3)Dm(e,e,s);else for(;t!==null;){if(t.tag===3){Dm(t,e,s);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(js===null||!js.has(r))){e=ln(s,e),s=Bd(2),r=Ss(t,s,2),r!==null&&(Ld(s,r,t,e),bn(r,2),kn(r));break}}t=t.return}}function hu(e,t,s){var r=e.pingCache;if(r===null){r=e.pingCache=new pg;var c=new Set;r.set(t,c)}else c=r.get(t),c===void 0&&(c=new Set,r.set(t,c));c.has(s)||(iu=!0,c.add(s),e=vg.bind(null,e,t,s),t.then(e,e))}function vg(e,t,s){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&s,e.warmLanes&=~s,Qe===e&&(je&s)===s&&(it===4||it===3&&(je&62914560)===je&&300>Ie()-Ol?(qe&2)===0&&Wi(e,0):ru|=s,Zi===je&&(Zi=0)),kn(e)}function Bm(e,t){t===0&&(t=Ai()),e=ii(e,t),e!==null&&(bn(e,t),kn(e))}function xg(e){var t=e.memoizedState,s=0;t!==null&&(s=t.retryLane),Bm(e,s)}function Sg(e,t){var s=0;switch(e.tag){case 31:case 13:var r=e.stateNode,c=e.memoizedState;c!==null&&(s=c.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(l(314))}r!==null&&r.delete(t),Bm(e,s)}function wg(e,t){return xr(e,t)}var Rl=null,tr=null,du=!1,zl=!1,mu=!1,Ms=0;function kn(e){e!==tr&&e.next===null&&(tr===null?Rl=tr=e:tr=tr.next=e),zl=!0,du||(du=!0,Ag())}function ia(e,t){if(!mu&&zl){mu=!0;do for(var s=!1,r=Rl;r!==null;){if(e!==0){var c=r.pendingLanes;if(c===0)var u=0;else{var h=r.suspendedLanes,p=r.pingedLanes;u=(1<<31-jt(42|e)+1)-1,u&=c&~(h&~p),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(s=!0,Ym(r,u))}else u=je,u=Fs(r,r===Qe?u:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),(u&3)===0||Zs(r,u)||(s=!0,Ym(r,u));r=r.next}while(s);mu=!1}}function Eg(){Lm()}function Lm(){zl=du=!1;var e=0;Ms!==0&&Ug()&&(e=Ms);for(var t=Ie(),s=null,r=Rl;r!==null;){var c=r.next,u=Hm(r,t);u===0?(r.next=null,s===null?Rl=c:s.next=c,c===null&&(tr=s)):(s=r,(e!==0||(u&3)!==0)&&(zl=!0)),r=c}yt!==0&&yt!==5||ia(e),Ms!==0&&(Ms=0)}function Hm(e,t){for(var s=e.suspendedLanes,r=e.pingedLanes,c=e.expirationTimes,u=e.pendingLanes&-62914561;0<u;){var h=31-jt(u),p=1<<h,E=c[h];E===-1?((p&s)===0||(p&r)!==0)&&(c[h]=Er(p,t)):E<=t&&(e.expiredLanes|=p),u&=~p}if(t=Qe,s=je,s=Fs(e,e===t?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,s===0||e===t&&(Le===2||Le===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Bn(r),e.callbackNode=null,e.callbackPriority=0;if((s&3)===0||Zs(e,s)){if(t=s&-s,t===e.callbackPriority)return t;switch(r!==null&&Bn(r),Ws(s)){case 2:case 8:s=Ua;break;case 32:s=wi;break;case 268435456:s=qa;break;default:s=wi}return r=Gm.bind(null,e),s=xr(s,r),e.callbackPriority=t,e.callbackNode=s,t}return r!==null&&r!==null&&Bn(r),e.callbackPriority=2,e.callbackNode=null,2}function Gm(e,t){if(yt!==0&&yt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var s=e.callbackNode;if(kl()&&e.callbackNode!==s)return null;var r=je;return r=Fs(e,e===Qe?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Sm(e,r,t),Hm(e,Ie()),e.callbackNode!=null&&e.callbackNode===s?Gm.bind(null,e):null)}function Ym(e,t){if(kl())return null;Sm(e,t,!0)}function Ag(){Dg(function(){(qe&6)!==0?xr(za,Eg):Lm()})}function pu(){if(Ms===0){var e=Hi;e===0&&(e=os,os<<=1,(os&261888)===0&&(os=256)),Ms=e}return Ms}function Vm(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Ya(""+e)}function Pm(e,t){var s=t.ownerDocument.createElement("input");return s.name=t.name,s.value=t.value,e.id&&s.setAttribute("form",e.id),t.parentNode.insertBefore(s,t),e=new FormData(e),s.parentNode.removeChild(s),e}function Og(e,t,s,r,c){if(t==="submit"&&s&&s.stateNode===c){var u=Vm((c[nt]||null).action),h=r.submitter;h&&(t=(t=h[nt]||null)?Vm(t.formAction):h.getAttribute("formAction"),t!==null&&(u=t,h=null));var p=new Qa("action","action",null,r,c);e.push({event:p,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(Ms!==0){var E=h?Pm(c,h):new FormData(c);Uo(s,{pending:!0,data:E,method:c.method,action:u},null,E)}}else typeof u=="function"&&(p.preventDefault(),E=h?Pm(c,h):new FormData(c),Uo(s,{pending:!0,data:E,method:c.method,action:u},u,E))},currentTarget:c}]})}}for(var yu=0;yu<Zc.length;yu++){var gu=Zc[yu],Tg=gu.toLowerCase(),jg=gu[0].toUpperCase()+gu.slice(1);vn(Tg,"on"+jg)}vn(xh,"onAnimationEnd"),vn(Sh,"onAnimationIteration"),vn(wh,"onAnimationStart"),vn("dblclick","onDoubleClick"),vn("focusin","onFocus"),vn("focusout","onBlur"),vn(Py,"onTransitionRun"),vn(Jy,"onTransitionStart"),vn(Qy,"onTransitionCancel"),vn(Eh,"onTransitionEnd"),U("onMouseEnter",["mouseout","mouseover"]),U("onMouseLeave",["mouseout","mouseover"]),U("onPointerEnter",["pointerout","pointerover"]),U("onPointerLeave",["pointerout","pointerover"]),J("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),J("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),J("onBeforeInput",["compositionend","keypress","textInput","paste"]),J("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),J("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),J("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ra="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(" "),Ng=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ra));function Jm(e,t){t=(t&4)!==0;for(var s=0;s<e.length;s++){var r=e[s],c=r.event;r=r.listeners;e:{var u=void 0;if(t)for(var h=r.length-1;0<=h;h--){var p=r[h],E=p.instance,R=p.currentTarget;if(p=p.listener,E!==u&&c.isPropagationStopped())break e;u=p,c.currentTarget=R;try{u(c)}catch(L){Ka(L)}c.currentTarget=null,u=E}else for(h=0;h<r.length;h++){if(p=r[h],E=p.instance,R=p.currentTarget,p=p.listener,E!==u&&c.isPropagationStopped())break e;u=p,c.currentTarget=R;try{u(c)}catch(L){Ka(L)}c.currentTarget=null,u=E}}}}function Te(e,t){var s=t[ei];s===void 0&&(s=t[ei]=new Set);var r=e+"__bubble";s.has(r)||(Qm(t,e,2,!1),s.add(r))}function bu(e,t,s){var r=0;t&&(r|=4),Qm(s,e,r,t)}var Ul="_reactListening"+Math.random().toString(36).slice(2);function _u(e){if(!e[Ul]){e[Ul]=!0,C.forEach(function(s){s!=="selectionchange"&&(Ng.has(s)||bu(s,!1,e),bu(s,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Ul]||(t[Ul]=!0,bu("selectionchange",!1,t))}}function Qm(e,t,s,r){switch(xp(t)){case 2:var c=sb;break;case 8:c=ib;break;default:c=zu}s=c.bind(null,t,s,e),c=void 0,!Bc||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(c=!0),r?c!==void 0?e.addEventListener(t,s,{capture:!0,passive:c}):e.addEventListener(t,s,!0):c!==void 0?e.addEventListener(t,s,{passive:c}):e.addEventListener(t,s,!1)}function vu(e,t,s,r,c){var u=r;if((t&1)===0&&(t&2)===0&&r!==null)e:for(;;){if(r===null)return;var h=r.tag;if(h===3||h===4){var p=r.stateNode.containerInfo;if(p===c)break;if(h===4)for(h=r.return;h!==null;){var E=h.tag;if((E===3||E===4)&&h.stateNode.containerInfo===c)return;h=h.return}for(;p!==null;){if(h=y(p),h===null)return;if(E=h.tag,E===5||E===6||E===26||E===27){r=u=h;continue e}p=p.parentNode}}r=r.return}Zf(function(){var R=u,L=qc(s),P=[];e:{var z=Ah.get(e);if(z!==void 0){var q=Qa,ce=e;switch(e){case"keypress":if(Pa(s)===0)break e;case"keydown":case"keyup":q=Sy;break;case"focusin":ce="focus",q=Yc;break;case"focusout":ce="blur",q=Yc;break;case"beforeblur":case"afterblur":q=Yc;break;case"click":if(s.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":q=eh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":q=uy;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":q=Ay;break;case xh:case Sh:case wh:q=dy;break;case Eh:q=Ty;break;case"scroll":case"scrollend":q=cy;break;case"wheel":q=Ny;break;case"copy":case"cut":case"paste":q=py;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":q=nh;break;case"toggle":case"beforetoggle":q=My}var me=(t&4)!==0,Pe=!me&&(e==="scroll"||e==="scrollend"),j=me?z!==null?z+"Capture":null:z;me=[];for(var T=R,k;T!==null;){var H=T;if(k=H.stateNode,H=H.tag,H!==5&&H!==26&&H!==27||k===null||j===null||(H=Tr(T,j),H!=null&&me.push(aa(T,H,k))),Pe)break;T=T.return}0<me.length&&(z=new q(z,ce,null,s,L),P.push({event:z,listeners:me}))}}if((t&7)===0){e:{if(z=e==="mouseover"||e==="pointerover",q=e==="mouseout"||e==="pointerout",z&&s!==Uc&&(ce=s.relatedTarget||s.fromElement)&&(y(ce)||ce[Yt]))break e;if((q||z)&&(z=L.window===L?L:(z=L.ownerDocument)?z.defaultView||z.parentWindow:window,q?(ce=s.relatedTarget||s.toElement,q=R,ce=ce?y(ce):null,ce!==null&&(Pe=f(ce),me=ce.tag,ce!==Pe||me!==5&&me!==27&&me!==6)&&(ce=null)):(q=null,ce=R),q!==ce)){if(me=eh,H="onMouseLeave",j="onMouseEnter",T="mouse",(e==="pointerout"||e==="pointerover")&&(me=nh,H="onPointerLeave",j="onPointerEnter",T="pointer"),Pe=q==null?z:_(q),k=ce==null?z:_(ce),z=new me(H,T+"leave",q,s,L),z.target=Pe,z.relatedTarget=k,H=null,y(L)===R&&(me=new me(j,T+"enter",ce,s,L),me.target=k,me.relatedTarget=Pe,H=me),Pe=H,q&&ce)t:{for(me=Cg,j=q,T=ce,k=0,H=j;H;H=me(H))k++;H=0;for(var he=T;he;he=me(he))H++;for(;0<k-H;)j=me(j),k--;for(;0<H-k;)T=me(T),H--;for(;k--;){if(j===T||T!==null&&j===T.alternate){me=j;break t}j=me(j),T=me(T)}me=null}else me=null;q!==null&&Xm(P,z,q,me,!1),ce!==null&&Pe!==null&&Xm(P,Pe,ce,me,!0)}}e:{if(z=R?_(R):window,q=z.nodeName&&z.nodeName.toLowerCase(),q==="select"||q==="input"&&z.type==="file")var ze=uh;else if(ch(z))if(fh)ze=Gy;else{ze=Ly;var fe=By}else q=z.nodeName,!q||q.toLowerCase()!=="input"||z.type!=="checkbox"&&z.type!=="radio"?R&&zc(R.elementType)&&(ze=uh):ze=Hy;if(ze&&(ze=ze(e,R))){oh(P,ze,s,L);break e}fe&&fe(e,z,R),e==="focusout"&&R&&z.type==="number"&&R.memoizedProps.value!=null&&Rc(z,"number",z.value)}switch(fe=R?_(R):window,e){case"focusin":(ch(fe)||fe.contentEditable==="true")&&(ki=fe,$c=R,Ur=null);break;case"focusout":Ur=$c=ki=null;break;case"mousedown":Kc=!0;break;case"contextmenu":case"mouseup":case"dragend":Kc=!1,_h(P,s,L);break;case"selectionchange":if(Vy)break;case"keydown":case"keyup":_h(P,s,L)}var Se;if(Pc)e:{switch(e){case"compositionstart":var Ne="onCompositionStart";break e;case"compositionend":Ne="onCompositionEnd";break e;case"compositionupdate":Ne="onCompositionUpdate";break e}Ne=void 0}else Mi?ah(e,s)&&(Ne="onCompositionEnd"):e==="keydown"&&s.keyCode===229&&(Ne="onCompositionStart");Ne&&(sh&&s.locale!=="ko"&&(Mi||Ne!=="onCompositionStart"?Ne==="onCompositionEnd"&&Mi&&(Se=If()):(ps=L,Lc="value"in ps?ps.value:ps.textContent,Mi=!0)),fe=ql(R,Ne),0<fe.length&&(Ne=new th(Ne,e,null,s,L),P.push({event:Ne,listeners:fe}),Se?Ne.data=Se:(Se=lh(s),Se!==null&&(Ne.data=Se)))),(Se=Ry?zy(e,s):Uy(e,s))&&(Ne=ql(R,"onBeforeInput"),0<Ne.length&&(fe=new th("onBeforeInput","beforeinput",null,s,L),P.push({event:fe,listeners:Ne}),fe.data=Se)),Og(P,e,R,s,L)}Jm(P,t)})}function aa(e,t,s){return{instance:e,listener:t,currentTarget:s}}function ql(e,t){for(var s=t+"Capture",r=[];e!==null;){var c=e,u=c.stateNode;if(c=c.tag,c!==5&&c!==26&&c!==27||u===null||(c=Tr(e,s),c!=null&&r.unshift(aa(e,c,u)),c=Tr(e,t),c!=null&&r.push(aa(e,c,u))),e.tag===3)return r;e=e.return}return[]}function Cg(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Xm(e,t,s,r,c){for(var u=t._reactName,h=[];s!==null&&s!==r;){var p=s,E=p.alternate,R=p.stateNode;if(p=p.tag,E!==null&&E===r)break;p!==5&&p!==26&&p!==27||R===null||(E=R,c?(R=Tr(s,u),R!=null&&h.unshift(aa(s,R,E))):c||(R=Tr(s,u),R!=null&&h.push(aa(s,R,E)))),s=s.return}h.length!==0&&e.push({event:t,listeners:h})}var Mg=/\r\n?/g,kg=/\u0000|\uFFFD/g;function $m(e){return(typeof e=="string"?e:""+e).replace(Mg,`
26
+ `).replace(kg,"")}function Km(e,t){return t=$m(t),$m(e)===t}function Ve(e,t,s,r,c,u){switch(s){case"children":typeof r=="string"?t==="body"||t==="textarea"&&r===""||ji(e,r):(typeof r=="number"||typeof r=="bigint")&&t!=="body"&&ji(e,""+r);break;case"className":_n(e,"class",r);break;case"tabIndex":_n(e,"tabindex",r);break;case"dir":case"role":case"viewBox":case"width":case"height":_n(e,s,r);break;case"style":Kf(e,r,u);break;case"data":if(t!=="object"){_n(e,"data",r);break}case"src":case"href":if(r===""&&(t!=="a"||s!=="href")){e.removeAttribute(s);break}if(r==null||typeof r=="function"||typeof r=="symbol"||typeof r=="boolean"){e.removeAttribute(s);break}r=Ya(""+r),e.setAttribute(s,r);break;case"action":case"formAction":if(typeof r=="function"){e.setAttribute(s,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof u=="function"&&(s==="formAction"?(t!=="input"&&Ve(e,t,"name",c.name,c,null),Ve(e,t,"formEncType",c.formEncType,c,null),Ve(e,t,"formMethod",c.formMethod,c,null),Ve(e,t,"formTarget",c.formTarget,c,null)):(Ve(e,t,"encType",c.encType,c,null),Ve(e,t,"method",c.method,c,null),Ve(e,t,"target",c.target,c,null)));if(r==null||typeof r=="symbol"||typeof r=="boolean"){e.removeAttribute(s);break}r=Ya(""+r),e.setAttribute(s,r);break;case"onClick":r!=null&&(e.onclick=Yn);break;case"onScroll":r!=null&&Te("scroll",e);break;case"onScrollEnd":r!=null&&Te("scrollend",e);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(l(61));if(s=r.__html,s!=null){if(c.children!=null)throw Error(l(60));e.innerHTML=s}}break;case"multiple":e.multiple=r&&typeof r!="function"&&typeof r!="symbol";break;case"muted":e.muted=r&&typeof r!="function"&&typeof r!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(r==null||typeof r=="function"||typeof r=="boolean"||typeof r=="symbol"){e.removeAttribute("xlink:href");break}s=Ya(""+r),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",s);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":r!=null&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(s,""+r):e.removeAttribute(s);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":r&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(s,""):e.removeAttribute(s);break;case"capture":case"download":r===!0?e.setAttribute(s,""):r!==!1&&r!=null&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(s,r):e.removeAttribute(s);break;case"cols":case"rows":case"size":case"span":r!=null&&typeof r!="function"&&typeof r!="symbol"&&!isNaN(r)&&1<=r?e.setAttribute(s,r):e.removeAttribute(s);break;case"rowSpan":case"start":r==null||typeof r=="function"||typeof r=="symbol"||isNaN(r)?e.removeAttribute(s):e.setAttribute(s,r);break;case"popover":Te("beforetoggle",e),Te("toggle",e),Nt(e,"popover",r);break;case"xlinkActuate":Gn(e,"http://www.w3.org/1999/xlink","xlink:actuate",r);break;case"xlinkArcrole":Gn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",r);break;case"xlinkRole":Gn(e,"http://www.w3.org/1999/xlink","xlink:role",r);break;case"xlinkShow":Gn(e,"http://www.w3.org/1999/xlink","xlink:show",r);break;case"xlinkTitle":Gn(e,"http://www.w3.org/1999/xlink","xlink:title",r);break;case"xlinkType":Gn(e,"http://www.w3.org/1999/xlink","xlink:type",r);break;case"xmlBase":Gn(e,"http://www.w3.org/XML/1998/namespace","xml:base",r);break;case"xmlLang":Gn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",r);break;case"xmlSpace":Gn(e,"http://www.w3.org/XML/1998/namespace","xml:space",r);break;case"is":Nt(e,"is",r);break;case"innerText":case"textContent":break;default:(!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(s=ay.get(s)||s,Nt(e,s,r))}}function xu(e,t,s,r,c,u){switch(s){case"style":Kf(e,r,u);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(l(61));if(s=r.__html,s!=null){if(c.children!=null)throw Error(l(60));e.innerHTML=s}}break;case"children":typeof r=="string"?ji(e,r):(typeof r=="number"||typeof r=="bigint")&&ji(e,""+r);break;case"onScroll":r!=null&&Te("scroll",e);break;case"onScrollEnd":r!=null&&Te("scrollend",e);break;case"onClick":r!=null&&(e.onclick=Yn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!V.hasOwnProperty(s))e:{if(s[0]==="o"&&s[1]==="n"&&(c=s.endsWith("Capture"),t=s.slice(2,c?s.length-7:void 0),u=e[nt]||null,u=u!=null?u[s]:null,typeof u=="function"&&e.removeEventListener(t,u,c),typeof r=="function")){typeof u!="function"&&u!==null&&(s in e?e[s]=null:e.hasAttribute(s)&&e.removeAttribute(s)),e.addEventListener(t,r,c);break e}s in e?e[s]=r:r===!0?e.setAttribute(s,""):Nt(e,s,r)}}}function wt(e,t,s){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Te("error",e),Te("load",e);var r=!1,c=!1,u;for(u in s)if(s.hasOwnProperty(u)){var h=s[u];if(h!=null)switch(u){case"src":r=!0;break;case"srcSet":c=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(l(137,t));default:Ve(e,t,u,h,s,null)}}c&&Ve(e,t,"srcSet",s.srcSet,s,null),r&&Ve(e,t,"src",s.src,s,null);return;case"input":Te("invalid",e);var p=u=h=c=null,E=null,R=null;for(r in s)if(s.hasOwnProperty(r)){var L=s[r];if(L!=null)switch(r){case"name":c=L;break;case"type":h=L;break;case"checked":E=L;break;case"defaultChecked":R=L;break;case"value":u=L;break;case"defaultValue":p=L;break;case"children":case"dangerouslySetInnerHTML":if(L!=null)throw Error(l(137,t));break;default:Ve(e,t,r,L,s,null)}}Jf(e,u,p,E,R,h,c,!1);return;case"select":Te("invalid",e),r=h=u=null;for(c in s)if(s.hasOwnProperty(c)&&(p=s[c],p!=null))switch(c){case"value":u=p;break;case"defaultValue":h=p;break;case"multiple":r=p;default:Ve(e,t,c,p,s,null)}t=u,s=h,e.multiple=!!r,t!=null?Ti(e,!!r,t,!1):s!=null&&Ti(e,!!r,s,!0);return;case"textarea":Te("invalid",e),u=c=r=null;for(h in s)if(s.hasOwnProperty(h)&&(p=s[h],p!=null))switch(h){case"value":r=p;break;case"defaultValue":c=p;break;case"children":u=p;break;case"dangerouslySetInnerHTML":if(p!=null)throw Error(l(91));break;default:Ve(e,t,h,p,s,null)}Xf(e,r,c,u);return;case"option":for(E in s)if(s.hasOwnProperty(E)&&(r=s[E],r!=null))switch(E){case"selected":e.selected=r&&typeof r!="function"&&typeof r!="symbol";break;default:Ve(e,t,E,r,s,null)}return;case"dialog":Te("beforetoggle",e),Te("toggle",e),Te("cancel",e),Te("close",e);break;case"iframe":case"object":Te("load",e);break;case"video":case"audio":for(r=0;r<ra.length;r++)Te(ra[r],e);break;case"image":Te("error",e),Te("load",e);break;case"details":Te("toggle",e);break;case"embed":case"source":case"link":Te("error",e),Te("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(R in s)if(s.hasOwnProperty(R)&&(r=s[R],r!=null))switch(R){case"children":case"dangerouslySetInnerHTML":throw Error(l(137,t));default:Ve(e,t,R,r,s,null)}return;default:if(zc(t)){for(L in s)s.hasOwnProperty(L)&&(r=s[L],r!==void 0&&xu(e,t,L,r,s,void 0));return}}for(p in s)s.hasOwnProperty(p)&&(r=s[p],r!=null&&Ve(e,t,p,r,s,null))}function Rg(e,t,s,r){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var c=null,u=null,h=null,p=null,E=null,R=null,L=null;for(q in s){var P=s[q];if(s.hasOwnProperty(q)&&P!=null)switch(q){case"checked":break;case"value":break;case"defaultValue":E=P;default:r.hasOwnProperty(q)||Ve(e,t,q,null,r,P)}}for(var z in r){var q=r[z];if(P=s[z],r.hasOwnProperty(z)&&(q!=null||P!=null))switch(z){case"type":u=q;break;case"name":c=q;break;case"checked":R=q;break;case"defaultChecked":L=q;break;case"value":h=q;break;case"defaultValue":p=q;break;case"children":case"dangerouslySetInnerHTML":if(q!=null)throw Error(l(137,t));break;default:q!==P&&Ve(e,t,z,q,r,P)}}kc(e,h,p,E,R,L,u,c);return;case"select":q=h=p=z=null;for(u in s)if(E=s[u],s.hasOwnProperty(u)&&E!=null)switch(u){case"value":break;case"multiple":q=E;default:r.hasOwnProperty(u)||Ve(e,t,u,null,r,E)}for(c in r)if(u=r[c],E=s[c],r.hasOwnProperty(c)&&(u!=null||E!=null))switch(c){case"value":z=u;break;case"defaultValue":p=u;break;case"multiple":h=u;default:u!==E&&Ve(e,t,c,u,r,E)}t=p,s=h,r=q,z!=null?Ti(e,!!s,z,!1):!!r!=!!s&&(t!=null?Ti(e,!!s,t,!0):Ti(e,!!s,s?[]:"",!1));return;case"textarea":q=z=null;for(p in s)if(c=s[p],s.hasOwnProperty(p)&&c!=null&&!r.hasOwnProperty(p))switch(p){case"value":break;case"children":break;default:Ve(e,t,p,null,r,c)}for(h in r)if(c=r[h],u=s[h],r.hasOwnProperty(h)&&(c!=null||u!=null))switch(h){case"value":z=c;break;case"defaultValue":q=c;break;case"children":break;case"dangerouslySetInnerHTML":if(c!=null)throw Error(l(91));break;default:c!==u&&Ve(e,t,h,c,r,u)}Qf(e,z,q);return;case"option":for(var ce in s)if(z=s[ce],s.hasOwnProperty(ce)&&z!=null&&!r.hasOwnProperty(ce))switch(ce){case"selected":e.selected=!1;break;default:Ve(e,t,ce,null,r,z)}for(E in r)if(z=r[E],q=s[E],r.hasOwnProperty(E)&&z!==q&&(z!=null||q!=null))switch(E){case"selected":e.selected=z&&typeof z!="function"&&typeof z!="symbol";break;default:Ve(e,t,E,z,r,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 me in s)z=s[me],s.hasOwnProperty(me)&&z!=null&&!r.hasOwnProperty(me)&&Ve(e,t,me,null,r,z);for(R in r)if(z=r[R],q=s[R],r.hasOwnProperty(R)&&z!==q&&(z!=null||q!=null))switch(R){case"children":case"dangerouslySetInnerHTML":if(z!=null)throw Error(l(137,t));break;default:Ve(e,t,R,z,r,q)}return;default:if(zc(t)){for(var Pe in s)z=s[Pe],s.hasOwnProperty(Pe)&&z!==void 0&&!r.hasOwnProperty(Pe)&&xu(e,t,Pe,void 0,r,z);for(L in r)z=r[L],q=s[L],!r.hasOwnProperty(L)||z===q||z===void 0&&q===void 0||xu(e,t,L,z,r,q);return}}for(var j in s)z=s[j],s.hasOwnProperty(j)&&z!=null&&!r.hasOwnProperty(j)&&Ve(e,t,j,null,r,z);for(P in r)z=r[P],q=s[P],!r.hasOwnProperty(P)||z===q||z==null&&q==null||Ve(e,t,P,z,r,q)}function Fm(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function zg(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,s=performance.getEntriesByType("resource"),r=0;r<s.length;r++){var c=s[r],u=c.transferSize,h=c.initiatorType,p=c.duration;if(u&&p&&Fm(h)){for(h=0,p=c.responseEnd,r+=1;r<s.length;r++){var E=s[r],R=E.startTime;if(R>p)break;var L=E.transferSize,P=E.initiatorType;L&&Fm(P)&&(E=E.responseEnd,h+=L*(E<p?1:(p-R)/(E-R)))}if(--r,t+=8*(u+h)/(c.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Su=null,wu=null;function Dl(e){return e.nodeType===9?e:e.ownerDocument}function Zm(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 Im(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function Eu(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Au=null;function Ug(){var e=window.event;return e&&e.type==="popstate"?e===Au?!1:(Au=e,!0):(Au=null,!1)}var Wm=typeof setTimeout=="function"?setTimeout:void 0,qg=typeof clearTimeout=="function"?clearTimeout:void 0,ep=typeof Promise=="function"?Promise:void 0,Dg=typeof queueMicrotask=="function"?queueMicrotask:typeof ep<"u"?function(e){return ep.resolve(null).then(e).catch(Bg)}:Wm;function Bg(e){setTimeout(function(){throw e})}function ks(e){return e==="head"}function tp(e,t){var s=t,r=0;do{var c=s.nextSibling;if(e.removeChild(s),c&&c.nodeType===8)if(s=c.data,s==="/$"||s==="/&"){if(r===0){e.removeChild(c),rr(t);return}r--}else if(s==="$"||s==="$?"||s==="$~"||s==="$!"||s==="&")r++;else if(s==="html")la(e.ownerDocument.documentElement);else if(s==="head"){s=e.ownerDocument.head,la(s);for(var u=s.firstChild;u;){var h=u.nextSibling,p=u.nodeName;u[pt]||p==="SCRIPT"||p==="STYLE"||p==="LINK"&&u.rel.toLowerCase()==="stylesheet"||s.removeChild(u),u=h}}else s==="body"&&la(e.ownerDocument.body);s=c}while(s);rr(t)}function np(e,t){var s=e;e=0;do{var r=s.nextSibling;if(s.nodeType===1?t?(s._stashedDisplay=s.style.display,s.style.display="none"):(s.style.display=s._stashedDisplay||"",s.getAttribute("style")===""&&s.removeAttribute("style")):s.nodeType===3&&(t?(s._stashedText=s.nodeValue,s.nodeValue=""):s.nodeValue=s._stashedText||""),r&&r.nodeType===8)if(s=r.data,s==="/$"){if(e===0)break;e--}else s!=="$"&&s!=="$?"&&s!=="$~"&&s!=="$!"||e++;s=r}while(s)}function Ou(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var s=t;switch(t=t.nextSibling,s.nodeName){case"HTML":case"HEAD":case"BODY":Ou(s),Oi(s);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(s.rel.toLowerCase()==="stylesheet")continue}e.removeChild(s)}}function Lg(e,t,s,r){for(;e.nodeType===1;){var c=s;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(r){if(!e[pt])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(u=e.getAttribute("rel"),u==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(u!==c.rel||e.getAttribute("href")!==(c.href==null||c.href===""?null:c.href)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin)||e.getAttribute("title")!==(c.title==null?null:c.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(u=e.getAttribute("src"),(u!==(c.src==null?null:c.src)||e.getAttribute("type")!==(c.type==null?null:c.type)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin))&&u&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var u=c.name==null?null:""+c.name;if(c.type==="hidden"&&e.getAttribute("name")===u)return e}else return e;if(e=hn(e.nextSibling),e===null)break}return null}function Hg(e,t,s){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!s||(e=hn(e.nextSibling),e===null))return null;return e}function sp(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=hn(e.nextSibling),e===null))return null;return e}function Tu(e){return e.data==="$?"||e.data==="$~"}function ju(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Gg(e,t){var s=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||s.readyState!=="loading")t();else{var r=function(){t(),s.removeEventListener("DOMContentLoaded",r)};s.addEventListener("DOMContentLoaded",r),e._reactRetry=r}}function hn(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var Nu=null;function ip(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var s=e.data;if(s==="/$"||s==="/&"){if(t===0)return hn(e.nextSibling);t--}else s!=="$"&&s!=="$!"&&s!=="$?"&&s!=="$~"&&s!=="&"||t++}e=e.nextSibling}return null}function rp(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var s=e.data;if(s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"){if(t===0)return e;t--}else s!=="/$"&&s!=="/&"||t++}e=e.previousSibling}return null}function ap(e,t,s){switch(t=Dl(s),e){case"html":if(e=t.documentElement,!e)throw Error(l(452));return e;case"head":if(e=t.head,!e)throw Error(l(453));return e;case"body":if(e=t.body,!e)throw Error(l(454));return e;default:throw Error(l(451))}}function la(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Oi(e)}var dn=new Map,lp=new Set;function Bl(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var is=K.d;K.d={f:Yg,r:Vg,D:Pg,C:Jg,L:Qg,m:Xg,X:Kg,S:$g,M:Fg};function Yg(){var e=is.f(),t=Nl();return e||t}function Vg(e){var t=x(e);t!==null&&t.tag===5&&t.type==="form"?Ed(t):is.r(e)}var nr=typeof document>"u"?null:document;function cp(e,t,s){var r=nr;if(r&&typeof t=="string"&&t){var c=rn(t);c='link[rel="'+e+'"][href="'+c+'"]',typeof s=="string"&&(c+='[crossorigin="'+s+'"]'),lp.has(c)||(lp.add(c),e={rel:e,crossOrigin:s,href:t},r.querySelector(c)===null&&(t=r.createElement("link"),wt(t,"link",e),A(t),r.head.appendChild(t)))}}function Pg(e){is.D(e),cp("dns-prefetch",e,null)}function Jg(e,t){is.C(e,t),cp("preconnect",e,t)}function Qg(e,t,s){is.L(e,t,s);var r=nr;if(r&&e&&t){var c='link[rel="preload"][as="'+rn(t)+'"]';t==="image"&&s&&s.imageSrcSet?(c+='[imagesrcset="'+rn(s.imageSrcSet)+'"]',typeof s.imageSizes=="string"&&(c+='[imagesizes="'+rn(s.imageSizes)+'"]')):c+='[href="'+rn(e)+'"]';var u=c;switch(t){case"style":u=sr(e);break;case"script":u=ir(e)}dn.has(u)||(e=O({rel:"preload",href:t==="image"&&s&&s.imageSrcSet?void 0:e,as:t},s),dn.set(u,e),r.querySelector(c)!==null||t==="style"&&r.querySelector(ca(u))||t==="script"&&r.querySelector(oa(u))||(t=r.createElement("link"),wt(t,"link",e),A(t),r.head.appendChild(t)))}}function Xg(e,t){is.m(e,t);var s=nr;if(s&&e){var r=t&&typeof t.as=="string"?t.as:"script",c='link[rel="modulepreload"][as="'+rn(r)+'"][href="'+rn(e)+'"]',u=c;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=ir(e)}if(!dn.has(u)&&(e=O({rel:"modulepreload",href:e},t),dn.set(u,e),s.querySelector(c)===null)){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(s.querySelector(oa(u)))return}r=s.createElement("link"),wt(r,"link",e),A(r),s.head.appendChild(r)}}}function $g(e,t,s){is.S(e,t,s);var r=nr;if(r&&e){var c=w(r).hoistableStyles,u=sr(e);t=t||"default";var h=c.get(u);if(!h){var p={loading:0,preload:null};if(h=r.querySelector(ca(u)))p.loading=5;else{e=O({rel:"stylesheet",href:e,"data-precedence":t},s),(s=dn.get(u))&&Cu(e,s);var E=h=r.createElement("link");A(E),wt(E,"link",e),E._p=new Promise(function(R,L){E.onload=R,E.onerror=L}),E.addEventListener("load",function(){p.loading|=1}),E.addEventListener("error",function(){p.loading|=2}),p.loading|=4,Ll(h,t,r)}h={type:"stylesheet",instance:h,count:1,state:p},c.set(u,h)}}}function Kg(e,t){is.X(e,t);var s=nr;if(s&&e){var r=w(s).hoistableScripts,c=ir(e),u=r.get(c);u||(u=s.querySelector(oa(c)),u||(e=O({src:e,async:!0},t),(t=dn.get(c))&&Mu(e,t),u=s.createElement("script"),A(u),wt(u,"link",e),s.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},r.set(c,u))}}function Fg(e,t){is.M(e,t);var s=nr;if(s&&e){var r=w(s).hoistableScripts,c=ir(e),u=r.get(c);u||(u=s.querySelector(oa(c)),u||(e=O({src:e,async:!0,type:"module"},t),(t=dn.get(c))&&Mu(e,t),u=s.createElement("script"),A(u),wt(u,"link",e),s.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},r.set(c,u))}}function op(e,t,s,r){var c=(c=tn.current)?Bl(c):null;if(!c)throw Error(l(446));switch(e){case"meta":case"title":return null;case"style":return typeof s.precedence=="string"&&typeof s.href=="string"?(t=sr(s.href),s=w(c).hoistableStyles,r=s.get(t),r||(r={type:"style",instance:null,count:0,state:null},s.set(t,r)),r):{type:"void",instance:null,count:0,state:null};case"link":if(s.rel==="stylesheet"&&typeof s.href=="string"&&typeof s.precedence=="string"){e=sr(s.href);var u=w(c).hoistableStyles,h=u.get(e);if(h||(c=c.ownerDocument||c,h={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(e,h),(u=c.querySelector(ca(e)))&&!u._p&&(h.instance=u,h.state.loading=5),dn.has(e)||(s={rel:"preload",as:"style",href:s.href,crossOrigin:s.crossOrigin,integrity:s.integrity,media:s.media,hrefLang:s.hrefLang,referrerPolicy:s.referrerPolicy},dn.set(e,s),u||Zg(c,e,s,h.state))),t&&r===null)throw Error(l(528,""));return h}if(t&&r!==null)throw Error(l(529,""));return null;case"script":return t=s.async,s=s.src,typeof s=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=ir(s),s=w(c).hoistableScripts,r=s.get(t),r||(r={type:"script",instance:null,count:0,state:null},s.set(t,r)),r):{type:"void",instance:null,count:0,state:null};default:throw Error(l(444,e))}}function sr(e){return'href="'+rn(e)+'"'}function ca(e){return'link[rel="stylesheet"]['+e+"]"}function up(e){return O({},e,{"data-precedence":e.precedence,precedence:null})}function Zg(e,t,s,r){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?r.loading=1:(t=e.createElement("link"),r.preload=t,t.addEventListener("load",function(){return r.loading|=1}),t.addEventListener("error",function(){return r.loading|=2}),wt(t,"link",s),A(t),e.head.appendChild(t))}function ir(e){return'[src="'+rn(e)+'"]'}function oa(e){return"script[async]"+e}function fp(e,t,s){if(t.count++,t.instance===null)switch(t.type){case"style":var r=e.querySelector('style[data-href~="'+rn(s.href)+'"]');if(r)return t.instance=r,A(r),r;var c=O({},s,{"data-href":s.href,"data-precedence":s.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement("style"),A(r),wt(r,"style",c),Ll(r,s.precedence,e),t.instance=r;case"stylesheet":c=sr(s.href);var u=e.querySelector(ca(c));if(u)return t.state.loading|=4,t.instance=u,A(u),u;r=up(s),(c=dn.get(c))&&Cu(r,c),u=(e.ownerDocument||e).createElement("link"),A(u);var h=u;return h._p=new Promise(function(p,E){h.onload=p,h.onerror=E}),wt(u,"link",r),t.state.loading|=4,Ll(u,s.precedence,e),t.instance=u;case"script":return u=ir(s.src),(c=e.querySelector(oa(u)))?(t.instance=c,A(c),c):(r=s,(c=dn.get(u))&&(r=O({},s),Mu(r,c)),e=e.ownerDocument||e,c=e.createElement("script"),A(c),wt(c,"link",r),e.head.appendChild(c),t.instance=c);case"void":return null;default:throw Error(l(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(r=t.instance,t.state.loading|=4,Ll(r,s.precedence,e));return t.instance}function Ll(e,t,s){for(var r=s.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),c=r.length?r[r.length-1]:null,u=c,h=0;h<r.length;h++){var p=r[h];if(p.dataset.precedence===t)u=p;else if(u!==c)break}u?u.parentNode.insertBefore(e,u.nextSibling):(t=s.nodeType===9?s.head:s,t.insertBefore(e,t.firstChild))}function Cu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Mu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Hl=null;function hp(e,t,s){if(Hl===null){var r=new Map,c=Hl=new Map;c.set(s,r)}else c=Hl,r=c.get(s),r||(r=new Map,c.set(s,r));if(r.has(e))return r;for(r.set(e,null),s=s.getElementsByTagName(e),c=0;c<s.length;c++){var u=s[c];if(!(u[pt]||u[Je]||e==="link"&&u.getAttribute("rel")==="stylesheet")&&u.namespaceURI!=="http://www.w3.org/2000/svg"){var h=u.getAttribute(t)||"";h=e+h;var p=r.get(h);p?p.push(u):r.set(h,[u])}}return r}function dp(e,t,s){e=e.ownerDocument||e,e.head.insertBefore(s,t==="title"?e.querySelector("head > title"):null)}function Ig(e,t,s){if(s===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function mp(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Wg(e,t,s,r){if(s.type==="stylesheet"&&(typeof r.media!="string"||matchMedia(r.media).matches!==!1)&&(s.state.loading&4)===0){if(s.instance===null){var c=sr(r.href),u=t.querySelector(ca(c));if(u){t=u._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Gl.bind(e),t.then(e,e)),s.state.loading|=4,s.instance=u,A(u);return}u=t.ownerDocument||t,r=up(r),(c=dn.get(c))&&Cu(r,c),u=u.createElement("link"),A(u);var h=u;h._p=new Promise(function(p,E){h.onload=p,h.onerror=E}),wt(u,"link",r),s.instance=u}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(s,t),(t=s.state.preload)&&(s.state.loading&3)===0&&(e.count++,s=Gl.bind(e),t.addEventListener("load",s),t.addEventListener("error",s))}}var ku=0;function eb(e,t){return e.stylesheets&&e.count===0&&Vl(e,e.stylesheets),0<e.count||0<e.imgCount?function(s){var r=setTimeout(function(){if(e.stylesheets&&Vl(e,e.stylesheets),e.unsuspend){var u=e.unsuspend;e.unsuspend=null,u()}},6e4+t);0<e.imgBytes&&ku===0&&(ku=62500*zg());var c=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Vl(e,e.stylesheets),e.unsuspend)){var u=e.unsuspend;e.unsuspend=null,u()}},(e.imgBytes>ku?50:800)+t);return e.unsuspend=s,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(c)}}:null}function Gl(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Vl(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Yl=null;function Vl(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Yl=new Map,t.forEach(tb,e),Yl=null,Gl.call(e))}function tb(e,t){if(!(t.state.loading&4)){var s=Yl.get(e);if(s)var r=s.get(null);else{s=new Map,Yl.set(e,s);for(var c=e.querySelectorAll("link[data-precedence],style[data-precedence]"),u=0;u<c.length;u++){var h=c[u];(h.nodeName==="LINK"||h.getAttribute("media")!=="not all")&&(s.set(h.dataset.precedence,h),r=h)}r&&s.set(null,r)}c=t.instance,h=c.getAttribute("data-precedence"),u=s.get(h)||r,u===r&&s.set(null,c),s.set(h,c),this.count++,r=Gl.bind(this),c.addEventListener("load",r),c.addEventListener("error",r),u?u.parentNode.insertBefore(c,u.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(c,e.firstChild)),t.state.loading|=4}}var ua={$$typeof:be,Provider:null,Consumer:null,_currentValue:oe,_currentValue2:oe,_threadCount:0};function nb(e,t,s,r,c,u,h,p,E){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=fs(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=fs(0),this.hiddenUpdates=fs(null),this.identifierPrefix=r,this.onUncaughtError=c,this.onCaughtError=u,this.onRecoverableError=h,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=E,this.incompleteTransitions=new Map}function pp(e,t,s,r,c,u,h,p,E,R,L,P){return e=new nb(e,t,s,h,E,R,L,P,p),t=1,u===!0&&(t|=24),u=Pt(3,null,null,t),e.current=u,u.stateNode=e,t=uo(),t.refCount++,e.pooledCache=t,t.refCount++,u.memoizedState={element:r,isDehydrated:s,cache:t},po(u),e}function yp(e){return e?(e=Ui,e):Ui}function gp(e,t,s,r,c,u){c=yp(c),r.context===null?r.context=c:r.pendingContext=c,r=xs(t),r.payload={element:s},u=u===void 0?null:u,u!==null&&(r.callback=u),s=Ss(e,r,t),s!==null&&(Lt(s,e,t),Yr(s,e,t))}function bp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var s=e.retryLane;e.retryLane=s!==0&&s<t?s:t}}function Ru(e,t){bp(e,t),(e=e.alternate)&&bp(e,t)}function _p(e){if(e.tag===13||e.tag===31){var t=ii(e,67108864);t!==null&&Lt(t,e,67108864),Ru(e,67108864)}}function vp(e){if(e.tag===13||e.tag===31){var t=Kt();t=Hn(t);var s=ii(e,t);s!==null&&Lt(s,e,t),Ru(e,t)}}var Pl=!0;function sb(e,t,s,r){var c=D.T;D.T=null;var u=K.p;try{K.p=2,zu(e,t,s,r)}finally{K.p=u,D.T=c}}function ib(e,t,s,r){var c=D.T;D.T=null;var u=K.p;try{K.p=8,zu(e,t,s,r)}finally{K.p=u,D.T=c}}function zu(e,t,s,r){if(Pl){var c=Uu(r);if(c===null)vu(e,t,r,Jl,s),Sp(e,r);else if(ab(c,e,t,s,r))r.stopPropagation();else if(Sp(e,r),t&4&&-1<rb.indexOf(e)){for(;c!==null;){var u=x(c);if(u!==null)switch(u.tag){case 3:if(u=u.stateNode,u.current.memoizedState.isDehydrated){var h=gn(u.pendingLanes);if(h!==0){var p=u;for(p.pendingLanes|=2,p.entangledLanes|=2;h;){var E=1<<31-jt(h);p.entanglements[1]|=E,h&=~E}kn(u),(qe&6)===0&&(Tl=Ie()+500,ia(0))}}break;case 31:case 13:p=ii(u,2),p!==null&&Lt(p,u,2),Nl(),Ru(u,2)}if(u=Uu(r),u===null&&vu(e,t,r,Jl,s),u===c)break;c=u}c!==null&&r.stopPropagation()}else vu(e,t,r,null,s)}}function Uu(e){return e=qc(e),qu(e)}var Jl=null;function qu(e){if(Jl=null,e=y(e),e!==null){var t=f(e);if(t===null)e=null;else{var s=t.tag;if(s===13){if(e=d(t),e!==null)return e;e=null}else if(s===31){if(e=m(t),e!==null)return e;e=null}else if(s===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Jl=e,null}function xp(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(jc()){case za:return 2;case Ua:return 8;case wi:case Nc:return 32;case qa:return 268435456;default:return 32}default:return 32}}var Du=!1,Rs=null,zs=null,Us=null,fa=new Map,ha=new Map,qs=[],rb="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 Sp(e,t){switch(e){case"focusin":case"focusout":Rs=null;break;case"dragenter":case"dragleave":zs=null;break;case"mouseover":case"mouseout":Us=null;break;case"pointerover":case"pointerout":fa.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":ha.delete(t.pointerId)}}function da(e,t,s,r,c,u){return e===null||e.nativeEvent!==u?(e={blockedOn:t,domEventName:s,eventSystemFlags:r,nativeEvent:u,targetContainers:[c]},t!==null&&(t=x(t),t!==null&&_p(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,c!==null&&t.indexOf(c)===-1&&t.push(c),e)}function ab(e,t,s,r,c){switch(t){case"focusin":return Rs=da(Rs,e,t,s,r,c),!0;case"dragenter":return zs=da(zs,e,t,s,r,c),!0;case"mouseover":return Us=da(Us,e,t,s,r,c),!0;case"pointerover":var u=c.pointerId;return fa.set(u,da(fa.get(u)||null,e,t,s,r,c)),!0;case"gotpointercapture":return u=c.pointerId,ha.set(u,da(ha.get(u)||null,e,t,s,r,c)),!0}return!1}function wp(e){var t=y(e.target);if(t!==null){var s=f(t);if(s!==null){if(t=s.tag,t===13){if(t=d(s),t!==null){e.blockedOn=t,Ba(e.priority,function(){vp(s)});return}}else if(t===31){if(t=m(s),t!==null){e.blockedOn=t,Ba(e.priority,function(){vp(s)});return}}else if(t===3&&s.stateNode.current.memoizedState.isDehydrated){e.blockedOn=s.tag===3?s.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Ql(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var s=Uu(e.nativeEvent);if(s===null){s=e.nativeEvent;var r=new s.constructor(s.type,s);Uc=r,s.target.dispatchEvent(r),Uc=null}else return t=x(s),t!==null&&_p(t),e.blockedOn=s,!1;t.shift()}return!0}function Ep(e,t,s){Ql(e)&&s.delete(t)}function lb(){Du=!1,Rs!==null&&Ql(Rs)&&(Rs=null),zs!==null&&Ql(zs)&&(zs=null),Us!==null&&Ql(Us)&&(Us=null),fa.forEach(Ep),ha.forEach(Ep)}function Xl(e,t){e.blockedOn===t&&(e.blockedOn=null,Du||(Du=!0,a.unstable_scheduleCallback(a.unstable_NormalPriority,lb)))}var $l=null;function Ap(e){$l!==e&&($l=e,a.unstable_scheduleCallback(a.unstable_NormalPriority,function(){$l===e&&($l=null);for(var t=0;t<e.length;t+=3){var s=e[t],r=e[t+1],c=e[t+2];if(typeof r!="function"){if(qu(r||s)===null)continue;break}var u=x(s);u!==null&&(e.splice(t,3),t-=3,Uo(u,{pending:!0,data:c,method:s.method,action:r},r,c))}}))}function rr(e){function t(E){return Xl(E,e)}Rs!==null&&Xl(Rs,e),zs!==null&&Xl(zs,e),Us!==null&&Xl(Us,e),fa.forEach(t),ha.forEach(t);for(var s=0;s<qs.length;s++){var r=qs[s];r.blockedOn===e&&(r.blockedOn=null)}for(;0<qs.length&&(s=qs[0],s.blockedOn===null);)wp(s),s.blockedOn===null&&qs.shift();if(s=(e.ownerDocument||e).$$reactFormReplay,s!=null)for(r=0;r<s.length;r+=3){var c=s[r],u=s[r+1],h=c[nt]||null;if(typeof u=="function")h||Ap(s);else if(h){var p=null;if(u&&u.hasAttribute("formAction")){if(c=u,h=u[nt]||null)p=h.formAction;else if(qu(c)!==null)continue}else p=h.action;typeof p=="function"?s[r+1]=p:(s.splice(r,3),r-=3),Ap(s)}}}function Op(){function e(u){u.canIntercept&&u.info==="react-transition"&&u.intercept({handler:function(){return new Promise(function(h){return c=h})},focusReset:"manual",scroll:"manual"})}function t(){c!==null&&(c(),c=null),r||setTimeout(s,20)}function s(){if(!r&&!navigation.transition){var u=navigation.currentEntry;u&&u.url!=null&&navigation.navigate(u.url,{state:u.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var r=!1,c=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(s,100),function(){r=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),c!==null&&(c(),c=null)}}}function Bu(e){this._internalRoot=e}Kl.prototype.render=Bu.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(l(409));var s=t.current,r=Kt();gp(s,r,e,t,null,null)},Kl.prototype.unmount=Bu.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;gp(e.current,2,null,e,null,null),Nl(),t[Yt]=null}};function Kl(e){this._internalRoot=e}Kl.prototype.unstable_scheduleHydration=function(e){if(e){var t=Ar();e={blockedOn:null,target:e,priority:t};for(var s=0;s<qs.length&&t!==0&&t<qs[s].priority;s++);qs.splice(s,0,e),s===0&&wp(e)}};var Tp=n.version;if(Tp!=="19.2.4")throw Error(l(527,Tp,"19.2.4"));K.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(l(188)):(e=Object.keys(e).join(","),Error(l(268,e)));return e=S(t),e=e!==null?N(e):null,e=e===null?null:e.stateNode,e};var cb={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:D,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Fl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Fl.isDisabled&&Fl.supportsFiber)try{Ks=Fl.inject(cb),at=Fl}catch{}}return ma.createRoot=function(e,t){if(!o(e))throw Error(l(299));var s=!1,r="",c=zd,u=Ud,h=qd;return t!=null&&(t.unstable_strictMode===!0&&(s=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(c=t.onUncaughtError),t.onCaughtError!==void 0&&(u=t.onCaughtError),t.onRecoverableError!==void 0&&(h=t.onRecoverableError)),t=pp(e,1,!1,null,null,s,r,null,c,u,h,Op),e[Yt]=t.current,_u(e),new Bu(t)},ma.hydrateRoot=function(e,t,s){if(!o(e))throw Error(l(299));var r=!1,c="",u=zd,h=Ud,p=qd,E=null;return s!=null&&(s.unstable_strictMode===!0&&(r=!0),s.identifierPrefix!==void 0&&(c=s.identifierPrefix),s.onUncaughtError!==void 0&&(u=s.onUncaughtError),s.onCaughtError!==void 0&&(h=s.onCaughtError),s.onRecoverableError!==void 0&&(p=s.onRecoverableError),s.formState!==void 0&&(E=s.formState)),t=pp(e,1,!0,t,s??null,r,c,E,u,h,p,Op),t.context=yp(null),s=t.current,r=Kt(),r=Hn(r),c=xs(r),c.callback=null,Ss(s,c,r),s=r,t.current.lanes=s,bn(t,s),kn(t),e[Yt]=t.current,_u(e),new Kl(t)},ma.version="19.2.4",ma}var Mp;function Lb(){if(Mp)return Hu.exports;Mp=1;function a(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(n){console.error(n)}}return a(),Hu.exports=Bb(),Hu.exports}var Hb=Lb();const Gb="modulepreload",Yb=function(a){return"/"+a},kp={},De=function(n,i,l){let o=Promise.resolve();if(i&&i.length>0){let d=function(S){return Promise.all(S.map(N=>Promise.resolve(N).then(O=>({status:"fulfilled",value:O}),O=>({status:"rejected",reason:O}))))};document.getElementsByTagName("link");const m=document.querySelector("meta[property=csp-nonce]"),v=(m==null?void 0:m.nonce)||(m==null?void 0:m.getAttribute("nonce"));o=d(i.map(S=>{if(S=Yb(S),S in kp)return;kp[S]=!0;const N=S.endsWith(".css"),O=N?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${S}"]${O}`))return;const M=document.createElement("link");if(M.rel=N?"stylesheet":Gb,N||(M.as="script"),M.crossOrigin="",M.href=S,v&&M.setAttribute("nonce",v),document.head.appendChild(M),N)return new Promise((G,$)=>{M.addEventListener("load",G),M.addEventListener("error",()=>$(new Error(`Unable to preload CSS for ${S}`)))})}))}function f(d){const m=new Event("vite:preloadError",{cancelable:!0});if(m.payload=d,window.dispatchEvent(m),!m.defaultPrevented)throw d}return o.then(d=>{for(const m of d||[])m.status==="rejected"&&f(m.reason);return n().catch(f)})};function g0(a){try{const n=a.split(".");if(n.length!==3)return null;const i=atob(n[1].replace(/-/g,"+").replace(/_/g,"/"));return JSON.parse(i)}catch{return null}}function b0(a){const n=g0(a);return!n||typeof n.exp!="number"?null:n.exp}function Of(a,n=0){const i=b0(a);return i===null?!0:Date.now()/1e3>=i-n}const tf="/api";let Ls=null;function Zl(a){Ls=a}function l2(){return Ls}async function Rp(){const a=sessionStorage.getItem("lt_credentials");if(!a)return null;try{const{username:n,password:i}=JSON.parse(a),l=await fetch(`${tf}/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:n,password:i})});if(!l.ok)return null;const o=await l.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 Bs=null;async function Et(a,n={}){const i={"Content-Type":"application/json",...n.headers};if(Ls){if(Of(Ls)){Bs||(Bs=Rp().finally(()=>{Bs=null}));const o=await Bs;if(o)Ls=o,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:o}}));else throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}i.Authorization=`Bearer ${Ls}`}let l=await fetch(`${tf}${a}`,{...n,headers:i});if((l.status===401||l.status===403)&&Ls){Bs||(Bs=Rp().finally(()=>{Bs=null}));const o=await Bs;if(o&&(Ls=o,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:o}})),i.Authorization=`Bearer ${o}`,l=await fetch(`${tf}${a}`,{...n,headers:i})),l.status===401||l.status===403)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}else if(l.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired");if(!l.ok){const o=await l.json().catch(()=>({error:l.statusText}));throw new Error(o.message||o.error||l.statusText)}return l.json()}const _0=Q.createContext(null),Vb=300;function Vu(a,n){if(Of(a))return null;const i=g0(a);if(!i)return null;const l=n??(()=>{try{const o=sessionStorage.getItem("lt_user_info");return o?JSON.parse(o):null}catch{return null}})();return{userId:i.userId,displayName:(l==null?void 0:l.displayName)??null,username:(l==null?void 0:l.username)??null,roles:i.roles??[]}}function Pb({children:a}){const[n,i]=Q.useState(()=>{const O=sessionStorage.getItem("lt_token");return O?Of(O)?(sessionStorage.removeItem("lt_token"),null):(Zl(O),Vu(O)):null}),l=Q.useRef(void 0),o=Q.useCallback(O=>{clearTimeout(l.current);const M=b0(O);if(!M)return;const G=(M-Vb)*1e3-Date.now();G<=0||(l.current=setTimeout(async()=>{const $=sessionStorage.getItem("lt_credentials");if($)try{const{username:W,password:de}=JSON.parse($),ye=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:W,password:de})});if(!ye.ok)return;const ie=await ye.json();ie.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:ie.token}}))}catch{}},G))},[]),f=Q.useCallback((O,M,G)=>{const $={displayName:(G==null?void 0:G.displayName)??null,username:(G==null?void 0:G.username)??(M==null?void 0:M.username)??null},W=Vu(O,$);W&&(Zl(O),sessionStorage.setItem("lt_token",O),sessionStorage.setItem("lt_user_info",JSON.stringify($)),M&&sessionStorage.setItem("lt_credentials",JSON.stringify(M)),i(W),o(O))},[o]),d=Q.useCallback(()=>{clearTimeout(l.current),Zl(null),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info"),i(null)},[]);Q.useEffect(()=>{const O=()=>d(),M=G=>{var de;const $=(de=G.detail)==null?void 0:de.token;if(!$)return;const W=Vu($);W&&(Zl($),sessionStorage.setItem("lt_token",$),i(W),o($))};return window.addEventListener("auth:unauthorized",O),window.addEventListener("auth:refreshed",M),()=>{window.removeEventListener("auth:unauthorized",O),window.removeEventListener("auth:refreshed",M)}},[d,o]),Q.useEffect(()=>{const O=sessionStorage.getItem("lt_token");return O&&n&&o(O),()=>clearTimeout(l.current)},[]);const m=(n==null?void 0:n.roles.some(O=>O.type==="superadmin"))??!1,v=Q.useCallback(O=>(n==null?void 0:n.roles.some(M=>M.role===O))??!1,[n]),S=Q.useCallback(O=>(n==null?void 0:n.roles.some(M=>M.type===O))??!1,[n]),N=(n==null?void 0:n.roles.map(O=>O.role))??[];return g.jsx(_0.Provider,{value:{user:n,isAuthenticated:!!n,isSuperAdmin:m,login:f,logout:d,hasRole:v,hasRoleType:S,userRoleNames:N},children:a})}function bi(){const a=Q.useContext(_0);if(!a)throw new Error("useAuth must be used within AuthProvider");return a}const en=new Uint8Array(0),_i=new TextEncoder,It=new TextDecoder;function Jb(...a){let n=0;for(let o=0;o<a.length;o++)n+=a[o].length;const i=new Uint8Array(n);let l=0;for(let o=0;o<a.length;o++)i.set(a[o],l),l+=a[o].length;return i}function xa(...a){const n=[];for(let i=0;i<a.length;i++)n.push(_i.encode(a[i]));return n.length===0?en:n.length===1?n[0]:Jb(...n)}function zp(a){return!a||a.length===0?"":It.decode(a)}const Up="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",qp=36,Qb=0xcfd41b9100000,Dp=33,Xb=333,Bp=22;function $b(a){for(let n=0;n<a.length;n++)a[n]=Math.floor(Math.random()*255)}function Kb(a){var n;(n=globalThis==null?void 0:globalThis.crypto)!=null&&n.getRandomValues?globalThis.crypto.getRandomValues(a):$b(a)}class Fb{constructor(){b(this,"buf");b(this,"seq");b(this,"inc");b(this,"inited");this.buf=new Uint8Array(Bp),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(Math.random()*Qb),this.inc=Math.floor(Math.random()*(Xb-Dp)+Dp)}setPre(){const n=new Uint8Array(12);Kb(n);for(let i=0;i<12;i++){const l=n[i]%36;this.buf[i]=Up.charCodeAt(l)}}fillSeq(){let n=this.seq;for(let i=Bp-1;i>=12;i--)this.buf[i]=Up.charCodeAt(n%qp),n=Math.floor(n/qp)}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 Js=new Fb;var rs;(function(a){a.Disconnect="disconnect",a.Reconnect="reconnect",a.Update="update",a.LDM="ldm",a.Error="error"})(rs||(rs={}));var cr;(function(a){a.Reconnecting="reconnecting",a.PingTimer="pingTimer",a.StaleConnection="staleConnection",a.ClientInitiatedReconnect="client initiated reconnect"})(cr||(cr={}));var I;(function(a){a.ApiError="BAD API",a.BadAuthentication="BAD_AUTHENTICATION",a.BadCreds="BAD_CREDS",a.BadHeader="BAD_HEADER",a.BadJson="BAD_JSON",a.BadPayload="BAD_PAYLOAD",a.BadSubject="BAD_SUBJECT",a.Cancelled="CANCELLED",a.ConnectionClosed="CONNECTION_CLOSED",a.ConnectionDraining="CONNECTION_DRAINING",a.ConnectionRefused="CONNECTION_REFUSED",a.ConnectionTimeout="CONNECTION_TIMEOUT",a.Disconnect="DISCONNECT",a.InvalidOption="INVALID_OPTION",a.InvalidPayload="INVALID_PAYLOAD",a.MaxPayloadExceeded="MAX_PAYLOAD_EXCEEDED",a.NoResponders="503",a.NotFunction="NOT_FUNC",a.RequestError="REQUEST_ERROR",a.ServerOptionNotAvailable="SERVER_OPT_NA",a.SubClosed="SUB_CLOSED",a.SubDraining="SUB_DRAINING",a.Timeout="TIMEOUT",a.Tls="TLS",a.Unknown="UNKNOWN_ERROR",a.WssRequired="WSS_REQUIRED",a.JetStreamInvalidAck="JESTREAM_INVALID_ACK",a.JetStream404NoMessages="404",a.JetStream408RequestTimeout="408",a.JetStream409MaxAckPendingExceeded="409",a.JetStream409="409",a.JetStreamNotEnabled="503",a.JetStreamIdleHeartBeat="IDLE_HEARTBEAT",a.AuthorizationViolation="AUTHORIZATION_VIOLATION",a.AuthenticationExpired="AUTHENTICATION_EXPIRED",a.ProtocolError="NATS_PROTOCOL_ERR",a.PermissionsViolation="PERMISSIONS_VIOLATION",a.AuthenticationTimeout="AUTHENTICATION_TIMEOUT",a.AccountExpired="ACCOUNT_EXPIRED"})(I||(I={}));function Zb(a){return typeof a.code=="string"}class v0{constructor(){b(this,"messages");this.messages=new Map,this.messages.set(I.InvalidPayload,"Invalid payload type - payloads can be 'binary', 'string', or 'json'"),this.messages.set(I.BadJson,"Bad JSON"),this.messages.set(I.WssRequired,"TLS is required, therefore a secure websocket connection is also required")}static getMessage(n){return Ib.getMessage(n)}getMessage(n){return this.messages.get(n)||n}}const Ib=new v0;class re extends Error{constructor(i,l,o){super(i);b(this,"name");b(this,"message");b(this,"code");b(this,"permissionContext");b(this,"chainedError");b(this,"api_error");this.name="NatsError",this.message=i,this.code=l,this.chainedError=o}static errorForCode(i,l){const o=v0.getMessage(i);return new re(o,i,l)}isAuthError(){return this.code===I.AuthenticationExpired||this.code===I.AuthorizationViolation||this.code===I.AccountExpired}isAuthTimeout(){return this.code===I.AuthenticationTimeout}isPermissionError(){return this.code===I.PermissionsViolation}isProtocolError(){return this.code===I.ProtocolError}isJetStreamError(){return this.api_error!==void 0}jsError(){return this.api_error?this.api_error:null}}var Ft;(function(a){a[a.Exact=0]="Exact",a[a.CanonicalMIME=1]="CanonicalMIME",a[a.IgnoreCase=2]="IgnoreCase"})(Ft||(Ft={}));var An;(function(a){a.Timer="timer",a.Count="count",a.JitterTimer="jitterTimer",a.SentinelMsg="sentinelMsg"})(An||(An={}));var Sa;(function(a){a.STATS="io.nats.micro.v1.stats_response",a.INFO="io.nats.micro.v1.info_response",a.PING="io.nats.micro.v1.ping_response"})(Sa||(Sa={}));const dc="Nats-Service-Error",mc="Nats-Service-Error-Code";class pc extends Error{constructor(i,l){super(l);b(this,"code");this.code=i}static isServiceError(i){return pc.toServiceError(i)!==null}static toServiceError(i){var o,f;const l=((o=i==null?void 0:i.headers)==null?void 0:o.get(mc))||"";if(l!==""){const d=parseInt(l)||400,m=((f=i==null?void 0:i.headers)==null?void 0:f.get(dc))||"";return new pc(d,m.length?m:l)}return null}}function as(a=""){if(a=a||"_INBOX",typeof a!="string")throw new Error("prefix must be a string");return a.split(".").forEach(n=>{if(n==="*"||n===">")throw new Error(`inbox prefixes cannot have wildcards '${a}'`)}),`${a}.${Js.next()}`}const nf="127.0.0.1";var Gs;(function(a){a.PING="PING",a.STATS="STATS",a.INFO="INFO"})(Gs||(Gs={}));function xc(a,...n){for(let i=0;i<n.length;i++){const l=n[i];Object.keys(l).forEach(function(o){a[o]=l[o]})}return a}function Il(a){return It.decode(a).replace(/\n/g,"␊").replace(/\r/g,"␍")}function dr(a,n=!0){const i=n?re.errorForCode(I.Timeout):null;let l,o;const f=new Promise((d,m)=>{l={cancel:()=>{o&&clearTimeout(o)}},o=setTimeout(()=>{m(i===null?re.errorForCode(I.Timeout):i)},a)});return Object.assign(f,l)}function br(a=0){let n;const i=new Promise(l=>{const o=setTimeout(()=>{l()},a);n={cancel:()=>{o&&clearTimeout(o)}}});return Object.assign(i,n)}function tt(){let a={};const n=new Promise((i,l)=>{a={resolve:i,reject:l}});return Object.assign(n,a)}function x0(a){for(let n=a.length-1;n>0;n--){const i=Math.floor(Math.random()*(n+1));[a[n],a[i]]=[a[i],a[n]]}return a}function Wb(a){return a===0?0:Math.floor(a/2+Math.random()*a)}function Tf(a=[0,250,250,500,500,3e3,5e3]){Array.isArray(a)||(a=[0,250,250,500,500,3e3,5e3]);const n=a.length-1;return{backoff(i){return Wb(i>n?a[n]:a[i])}}}function et(a){return a*1e6}function jf(a){return Math.floor(a/1e6)}function Lp(a){let l=!0;const o=new Array(a.length);for(let f=0;f<a.length;f++){let d=a.charCodeAt(f);if(d===58||d<33||d>126)throw new re(`'${a[f]}' is not a valid character for a header key`,I.BadHeader);l&&97<=d&&d<=122?d-=32:!l&&65<=d&&d<=90&&(d+=32),o[f]=d,l=d==45}return String.fromCharCode(...o)}function ls(a=0,n=""){if(a===0&&n!==""||a>0&&n==="")throw new Error("setting status requires both code and description");return new Ys(a,n)}const Pu="NATS/1.0";class Ys{constructor(n=0,i=""){b(this,"_code");b(this,"headers");b(this,"_description");this._code=n,this._description=i,this.headers=new Map}[Symbol.iterator](){return this.headers.entries()}size(){return this.headers.size}equals(n){if(n&&this.headers.size===n.headers.size&&this._code===n._code){for(const[i,l]of this.headers){const o=n.values(i);if(l.length!==o.length)return!1;const f=[...l].sort(),d=[...o].sort();for(let m=0;m<f.length;m++)if(f[m]!==d[m])return!1}return!0}return!1}static decode(n){const i=new Ys,o=It.decode(n).split(`\r
27
+ `),f=o[0];if(f!==Pu){let d=f.replace(Pu,"").trim();if(d.length>0){i._code=parseInt(d,10),isNaN(i._code)&&(i._code=0);const m=i._code.toString();d=d.replace(m,""),i._description=d.trim()}}return o.length>=1&&o.slice(1).map(d=>{if(d){const m=d.indexOf(":");if(m>-1){const v=d.slice(0,m),S=d.slice(m+1).trim();i.append(v,S)}}}),i}toString(){if(this.headers.size===0&&this._code===0)return"";let n=Pu;this._code>0&&this._description!==""&&(n+=` ${this._code} ${this._description}`);for(const[i,l]of this.headers)for(let o=0;o<l.length;o++)n=`${n}\r
28
+ ${i}: ${l[o]}`;return`${n}\r
29
+ \r
30
+ `}encode(){return _i.encode(this.toString())}static validHeaderValue(n){if(/[\r\n]/.test(n))throw new re("invalid header value - \\r and \\n are not allowed.",I.BadHeader);return n.trim()}keys(){const n=[];for(const i of this.headers.keys())n.push(i);return n}findKeys(n,i=Ft.Exact){const l=this.keys();switch(i){case Ft.Exact:return l.filter(o=>o===n);case Ft.CanonicalMIME:return n=Lp(n),l.filter(o=>o===n);default:{const o=n.toLowerCase();return l.filter(f=>o===f.toLowerCase())}}}get(n,i=Ft.Exact){const l=this.findKeys(n,i);if(l.length){const o=this.headers.get(l[0]);if(o)return Array.isArray(o)?o[0]:o}return""}last(n,i=Ft.Exact){const l=this.findKeys(n,i);if(l.length){const o=this.headers.get(l[0]);if(o)return Array.isArray(o)?o[o.length-1]:o}return""}has(n,i=Ft.Exact){return this.findKeys(n,i).length>0}set(n,i,l=Ft.Exact){this.delete(n,l),this.append(n,i,l)}append(n,i,l=Ft.Exact){const o=Lp(n);l===Ft.CanonicalMIME&&(n=o);const f=this.findKeys(n,l);n=f.length>0?f[0]:n;const d=Ys.validHeaderValue(i);let m=this.headers.get(n);m||(m=[],this.headers.set(n,m)),m.push(d)}values(n,i=Ft.Exact){const l=[];return this.findKeys(n,i).forEach(f=>{const d=this.headers.get(f);d&&l.push(...d)}),l}delete(n,i=Ft.Exact){this.findKeys(n,i).forEach(o=>{this.headers.delete(o)})}get hasError(){return this._code>=300}get status(){return`${this._code} ${this._description}`.trim()}toRecord(){const n={};return this.keys().forEach(i=>{n[i]=this.values(i)}),n}get code(){return this._code}get description(){return this._description}static fromRecord(n){const i=new Ys;for(const l in n)i.headers.set(l,n[l]);return i}}function sf(){return{encode(a){return _i.encode(a)},decode(a){return It.decode(a)}}}function On(a){return{encode(n){try{return n===void 0&&(n=null),_i.encode(JSON.stringify(n))}catch(i){throw re.errorForCode(I.BadJson,i)}},decode(n){try{return JSON.parse(It.decode(n),a)}catch(i){throw re.errorForCode(I.BadJson,i)}}}}function S0(a){var n;return a&&a.data.length===0&&((n=a.headers)==null?void 0:n.code)===503?re.errorForCode(I.NoResponders):null}class Nf{constructor(n,i,l){b(this,"_headers");b(this,"_msg");b(this,"_rdata");b(this,"_reply");b(this,"_subject");b(this,"publisher");this._msg=n,this._rdata=i,this.publisher=l}get subject(){return this._subject?this._subject:(this._subject=It.decode(this._msg.subject),this._subject)}get reply(){return this._reply?this._reply:(this._reply=It.decode(this._msg.reply),this._reply)}get sid(){return this._msg.sid}get headers(){if(this._msg.hdr>-1&&!this._headers){const n=this._rdata.subarray(0,this._msg.hdr);this._headers=Ys.decode(n)}return this._headers}get data(){return this._rdata?this._msg.hdr>-1?this._rdata.subarray(this._msg.hdr):this._rdata:new Uint8Array(0)}respond(n=en,i){return this.reply?(this.publisher.publish(this.reply,n,i),!0):!1}size(){var o;const n=this._msg.subject.length,i=((o=this._msg.reply)==null?void 0:o.length)||0,l=this._msg.size===-1?0:this._msg.size;return n+i+l}json(n){return On(n).decode(this.data)}string(){return It.decode(this.data)}requestInfo(){var i;const n=(i=this.headers)==null?void 0:i.get("Nats-Request-Info");return n?JSON.parse(n,function(l,o){return(l==="start"||l==="stop")&&o!==""?new Date(Date.parse(o)):o}):null}}b(Nf,"jc");function or(a){return Sc("durable",a)}function Mt(a){return Sc("stream",a)}function Sc(a,n=""){if(n==="")throw Error(`${a} name required`);return[".","*",">","/","\\"," "," ",`
31
+ `,"\r"].forEach(l=>{if(n.indexOf(l)!==-1){switch(l){case`
32
+ `:l="\\n";break;case"\r":l="\\r";break;case" ":l="\\t";break}throw Error(`invalid ${a} name - ${a} name cannot contain '${l}'`)}}),""}function ba(a,n=""){if(n==="")throw Error(`${a} name required`);const i=e_(n);if(i.length)throw new Error(`invalid ${a} name - ${a} name ${i}`)}function e_(a=""){if(a==="")throw Error("name required");const n=/^[-\w]+$/g;if(a.match(n)===null){for(const l of a.split(""))if(l.match(n)===null)return`cannot contain '${l}'`}return""}function rf(a){if(a.data.length>0)return!1;const n=a.headers;return n?n.code>=100&&n.code<200:!1}function af(a){var n;return rf(a)&&((n=a.headers)==null?void 0:n.description)==="Idle Heartbeat"}function t_(a,n,i){const l=ls(a,n),o={hdr:1,sid:0,size:0},f=new Nf(o,en,{});return f._headers=l,f._subject=i,f}function ur(a){if(a.data.length!==0)return null;const n=a.headers;return n?w0(n.code,n.description):null}var pn;(function(a){a.MaxBatchExceeded="exceeded maxrequestbatch of",a.MaxExpiresExceeded="exceeded maxrequestexpires of",a.MaxBytesExceeded="exceeded maxrequestmaxbytes of",a.MaxMessageSizeExceeded="message size exceeds maxbytes",a.PushConsumer="consumer is push based",a.MaxWaitingExceeded="exceeded maxwaiting",a.IdleHeartbeatMissed="idle heartbeats missed",a.ConsumerDeleted="consumer deleted"})(pn||(pn={}));function n_(a){return a.code!==I.JetStream409?!1:[pn.MaxBatchExceeded,pn.MaxExpiresExceeded,pn.MaxBytesExceeded,pn.MaxMessageSizeExceeded,pn.PushConsumer,pn.IdleHeartbeatMissed,pn.ConsumerDeleted].find(i=>a.message.indexOf(i)!==-1)!==void 0}function w0(a,n=""){if(a<300)return null;switch(n=n.toLowerCase(),a){case 404:return new re(n,I.JetStream404NoMessages);case 408:return new re(n,I.JetStream408RequestTimeout);case 409:{const i=n.startsWith(pn.IdleHeartbeatMissed)?I.JetStreamIdleHeartBeat:I.JetStream409;return new re(n,i)}case 503:return re.errorForCode(I.JetStreamNotEnabled,new Error(n));default:return n===""&&(n=I.Unknown),new re(n,`${a}`)}}class _t{constructor(){b(this,"inflight");b(this,"processed");b(this,"received");b(this,"noIterator");b(this,"iterClosed");b(this,"done");b(this,"signal");b(this,"yields");b(this,"filtered");b(this,"pendingFiltered");b(this,"ingestionFilterFn");b(this,"protocolFilterFn");b(this,"dispatchedFn");b(this,"ctx");b(this,"_data");b(this,"err");b(this,"time");b(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=tt(),this.yields=[],this.iterClosed=tt(),this.time=0,this.yielding=!1}[Symbol.asyncIterator](){return this.iterate()}push(n){if(this.done)return;if(typeof n=="function"){this.yields.push(n),this.signal.resolve();return}const{ingest:i,protocol:l}=this.ingestionFilterFn?this.ingestionFilterFn(n,this.ctx||this):{ingest:!0,protocol:!1};i&&(l&&(this.filtered++,this.pendingFiltered++),this.yields.push(n),this.signal.resolve())}async*iterate(){if(this.noIterator)throw new re("unsupported iterator",I.ApiError);if(this.yielding)throw new re("already yielding",I.ApiError);this.yielding=!0;try{for(;;){if(this.yields.length===0&&await this.signal,this.err)throw this.err;const n=this.yields;this.inflight=n.length,this.yields=[];for(let i=0;i<n.length;i++){if(typeof n[i]=="function"){const o=n[i];try{o()}catch(f){throw f}if(this.err)throw this.err;continue}if(this.protocolFilterFn?this.protocolFilterFn(n[i]):!0){this.processed++;const o=Date.now();yield n[i],this.time=Date.now()-o,this.dispatchedFn&&n[i]&&this.dispatchedFn(n[i])}else this.pendingFiltered--;this.inflight--}if(this.done)break;this.yields.length===0&&(n.length=0,this.yields=n,this.signal=tt())}}finally{this.stop()}}stop(n){this.done||(this.err=n,this.done=!0,this.signal.resolve(),this.iterClosed.resolve(n))}getProcessed(){return this.noIterator?this.received:this.processed}getPending(){return this.yields.length+this.inflight-this.pendingFiltered}getReceived(){return this.received-this.filtered}}class Cf{constructor(n,i,l={maxOut:2}){b(this,"interval");b(this,"maxOut");b(this,"cancelAfter");b(this,"timer");b(this,"autoCancelTimer");b(this,"last");b(this,"missed");b(this,"count");b(this,"callback");this.interval=n,this.maxOut=(l==null?void 0:l.maxOut)||2,this.cancelAfter=(l==null?void 0:l.cancelAfter)||0,this.last=Date.now(),this.missed=0,this.count=0,this.callback=i,this._schedule()}cancel(){this.autoCancelTimer&&clearTimeout(this.autoCancelTimer),this.timer&&clearInterval(this.timer),this.timer=0,this.autoCancelTimer=0,this.missed=0}work(){this.last=Date.now(),this.missed=0}_change(n,i=0,l=2){this.interval=n,this.maxOut=l,this.cancelAfter=i,this.restart()}restart(){this.cancel(),this._schedule()}_schedule(){this.cancelAfter>0&&(this.autoCancelTimer=setTimeout(()=>{this.cancel()},this.cancelAfter)),this.timer=setInterval(()=>{if(this.count++,Date.now()-this.last>this.interval&&this.missed++,this.missed>=this.maxOut)try{this.callback(this.missed)===!0&&this.cancel()}catch(n){console.log(n)}},this.interval)}}var lf;(function(a){a.Limits="limits",a.Interest="interest",a.Workqueue="workqueue"})(lf||(lf={}));var Aa;(function(a){a.Old="old",a.New="new"})(Aa||(Aa={}));var cf;(function(a){a.File="file",a.Memory="memory"})(cf||(cf={}));var ot;(function(a){a.All="all",a.Last="last",a.New="new",a.StartSequence="by_start_sequence",a.StartTime="by_start_time",a.LastPerSubject="last_per_subject"})(ot||(ot={}));var bt;(function(a){a.None="none",a.All="all",a.Explicit="explicit",a.NotSet=""})(bt||(bt={}));var mr;(function(a){a.Instant="instant",a.Original="original"})(mr||(mr={}));var Qs;(function(a){a.None="none",a.S2="s2"})(Qs||(Qs={}));var yc;(function(a){a.CreateOrUpdate="",a.Update="update",a.Create="create"})(yc||(yc={}));function s_(a,n={}){return Object.assign({name:a,deliver_policy:ot.All,ack_policy:bt.Explicit,ack_wait:et(30*1e3),replay_policy:mr.Instant},n)}var Hp;(function(a){a.API="api_audit",a.StreamAction="stream_action",a.ConsumerAction="consumer_action",a.SnapshotCreate="snapshot_create",a.SnapshotComplete="snapshot_complete",a.RestoreCreate="restore_create",a.RestoreComplete="restore_complete",a.MaxDeliver="max_deliver",a.Terminated="terminated",a.Ack="consumer_ack",a.StreamLeaderElected="stream_leader_elected",a.StreamQuorumLost="stream_quorum_lost",a.ConsumerLeaderElected="consumer_leader_elected",a.ConsumerQuorumLost="consumer_quorum_lost"})(Hp||(Hp={}));var Rt;(function(a){a.StreamSourceHdr="Nats-Stream-Source",a.LastConsumerSeqHdr="Nats-Last-Consumer",a.LastStreamSeqHdr="Nats-Last-Stream",a.ConsumerStalledHdr="Nats-Consumer-Stalled",a.MessageSizeHdr="Nats-Msg-Size",a.RollupHdr="Nats-Rollup",a.RollupValueSubject="sub",a.RollupValueAll="all",a.PendingMessagesHdr="Nats-Pending-Messages",a.PendingBytesHdr="Nats-Pending-Bytes"})(Rt||(Rt={}));var wn;(function(a){a.LastValue="",a.AllHistory="history",a.UpdatesOnly="updates"})(wn||(wn={}));var lr;(function(a){a.Stream="Nats-Stream",a.Sequence="Nats-Sequence",a.TimeStamp="Nats-Time-Stamp",a.Subject="Nats-Subject"})(lr||(lr={}));var Gp;(function(a){a.Stream="Nats-Stream",a.Subject="Nats-Subject",a.Sequence="Nats-Sequence",a.LastSequence="Nats-Last-Sequence",a.Size="Nats-Msg-Size"})(Gp||(Gp={}));const Zt="KV_";class i_{constructor(n){b(this,"config");b(this,"ordered");b(this,"mack");b(this,"stream");b(this,"callbackFn");b(this,"max");b(this,"qname");b(this,"isBind");b(this,"filters");this.stream="",this.mack=!1,this.ordered=!1,this.config=s_("",n||{})}getOpts(){var i;const n={};if(n.config=Object.assign({},this.config),n.config.filter_subject&&(this.filterSubject(n.config.filter_subject),n.config.filter_subject=void 0),n.config.filter_subjects&&((i=n.config.filter_subjects)==null||i.forEach(l=>{this.filterSubject(l)}),n.config.filter_subjects=void 0),n.mack=this.mack,n.stream=this.stream,n.callbackFn=this.callbackFn,n.max=this.max,n.queue=this.qname,n.ordered=this.ordered,n.config.ack_policy=n.ordered?bt.None:n.config.ack_policy,n.isBind=n.isBind||!1,this.filters)switch(this.filters.length){case 0:break;case 1:n.config.filter_subject=this.filters[0];break;default:n.config.filter_subjects=this.filters}return n}description(n){return this.config.description=n,this}deliverTo(n){return this.config.deliver_subject=n,this}durable(n){return or(n),this.config.durable_name=n,this}startSequence(n){if(n<=0)throw new Error("sequence must be greater than 0");return this.config.deliver_policy=ot.StartSequence,this.config.opt_start_seq=n,this}startTime(n){return this.config.deliver_policy=ot.StartTime,this.config.opt_start_time=n.toISOString(),this}deliverAll(){return this.config.deliver_policy=ot.All,this}deliverLastPerSubject(){return this.config.deliver_policy=ot.LastPerSubject,this}deliverLast(){return this.config.deliver_policy=ot.Last,this}deliverNew(){return this.config.deliver_policy=ot.New,this}startAtTimeDelta(n){return this.startTime(new Date(Date.now()-n)),this}headersOnly(){return this.config.headers_only=!0,this}ackNone(){return this.config.ack_policy=bt.None,this}ackAll(){return this.config.ack_policy=bt.All,this}ackExplicit(){return this.config.ack_policy=bt.Explicit,this}ackWait(n){return this.config.ack_wait=et(n),this}maxDeliver(n){return this.config.max_deliver=n,this}filterSubject(n){return this.filters=this.filters||[],this.filters.push(n),this}replayInstantly(){return this.config.replay_policy=mr.Instant,this}replayOriginal(){return this.config.replay_policy=mr.Original,this}sample(n){if(n=Math.trunc(n),n<0||n>100)throw new Error("value must be between 0-100");return this.config.sample_freq=`${n}%`,this}limit(n){return this.config.rate_limit_bps=n,this}maxWaiting(n){return this.config.max_waiting=n,this}maxAckPending(n){return this.config.max_ack_pending=n,this}idleHeartbeat(n){return this.config.idle_heartbeat=et(n),this}flowControl(){return this.config.flow_control=!0,this}deliverGroup(n){return this.queue(n),this}manualAck(){return this.mack=!0,this}maxMessages(n){return this.max=n,this}callback(n){return this.callbackFn=n,this}queue(n){return this.qname=n,this.config.deliver_group=n,this}orderedConsumer(){return this.ordered=!0,this}bind(n,i){return this.stream=n,this.config.durable_name=i,this.isBind=!0,this}bindStream(n){return this.stream=n,this}inactiveEphemeralThreshold(n){return this.config.inactive_threshold=et(n),this}maxPullBatch(n){return this.config.max_batch=n,this}maxPullRequestExpires(n){return this.config.max_expires=et(n),this}memory(){return this.config.mem_storage=!0,this}numReplicas(n){return this.config.num_replicas=n,this}consumerName(n){return this.config.name=n,this}}function Vs(a){return new i_(a)}function Yp(a){return typeof a.getOpts=="function"}class r_{static encode(n){if(typeof n=="string")return btoa(n);const i=Array.from(n);return btoa(String.fromCharCode(...i))}static decode(n,i=!1){const l=atob(n);return i?Uint8Array.from(l,o=>o.charCodeAt(0)):l}}class fr{static encode(n){return fr.toB64URLEncoding(r_.encode(n))}static decode(n,i=!1){return fr.decode(fr.fromB64URLEncoding(n),i)}static toB64URLEncoding(n){return n.replace(/\+/g,"-").replace(/\//g,"_")}static fromB64URLEncoding(n){return n.replace(/_/g,"/").replace(/-/g,"+")}}class pr{constructor(){b(this,"buffers");b(this,"byteLength");this.buffers=[],this.byteLength=0}static concat(...n){let i=0;for(let f=0;f<n.length;f++)i+=n[f].length;const l=new Uint8Array(i);let o=0;for(let f=0;f<n.length;f++)l.set(n[f],o),o+=n[f].length;return l}static fromAscii(n){return n||(n=""),_i.encode(n)}static toAscii(n){return It.decode(n)}reset(){this.buffers.length=0,this.byteLength=0}pack(){if(this.buffers.length>1){const n=new Uint8Array(this.byteLength);let i=0;for(let l=0;l<this.buffers.length;l++)n.set(this.buffers[l],i),i+=this.buffers[l].length;this.buffers.length=0,this.buffers.push(n)}}shift(){if(this.buffers.length){const n=this.buffers.shift();if(n)return this.byteLength-=n.length,n}return new Uint8Array(0)}drain(n){if(this.buffers.length){this.pack();const i=this.buffers.pop();if(i){const l=this.byteLength;(n===void 0||n>l)&&(n=l);const o=i.subarray(0,n);return l>n&&this.buffers.push(i.subarray(n)),this.byteLength=l-n,o}}return new Uint8Array(0)}fill(n,...i){n&&(this.buffers.push(n),this.byteLength+=n.length);for(let l=0;l<i.length;l++)i[l]&&i[l].length&&(this.buffers.push(i[l]),this.byteLength+=i[l].length)}peek(){return this.buffers.length?(this.pack(),this.buffers[0]):new Uint8Array(0)}size(){return this.byteLength}length(){return this.buffers.length}}function a_(a,n){return n.forEach(function(i){i&&typeof i!="string"&&!Array.isArray(i)&&Object.keys(i).forEach(function(l){if(l!=="default"&&!(l in a)){var o=Object.getOwnPropertyDescriptor(i,l);Object.defineProperty(a,l,o.get?o:{enumerable:!0,get:function(){return i[l]}})}})}),Object.freeze(a)}var l_=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},pa=l_.performance||{};pa.now||pa.mozNow||pa.msNow||pa.oNow||pa.webkitNow;var Vp={versions:{}},c_=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function o_(a){if(a.__esModule)return a;var n=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(a).forEach(function(i){var l=Object.getOwnPropertyDescriptor(a,i);Object.defineProperty(n,i,l.get?l:{enumerable:!0,get:function(){return a[i]}})}),n}var Ju,wc={exports:{}},Pp={},Jp=o_(a_({__proto__:null,default:Pp},[Pp]));Ju=wc,(function(){var a="input is invalid type",n=typeof window=="object",i=n?window:{};i.JS_SHA256_NO_WINDOW&&(n=!1);var l=!n&&typeof self=="object",o=!i.JS_SHA256_NO_NODE_JS&&Vp.versions&&Vp.versions.node;o?i=c_:l&&(i=self);var f=!i.JS_SHA256_NO_COMMON_JS&&Ju.exports,d=!i.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",m="0123456789abcdef".split(""),v=[-2147483648,8388608,32768,128],S=[24,16,8,0],N=[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],O=["hex","array","digest","arrayBuffer"],M=[];!i.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(B){return Object.prototype.toString.call(B)==="[object Array]"}),!d||!i.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(B){return typeof B=="object"&&B.buffer&&B.buffer.constructor===ArrayBuffer});var G=function(B,F){return function(ne){return new ie(F,!0).update(ne)[B]()}},$=function(B){var F=G("hex",B);o&&(F=W(F,B)),F.create=function(){return new ie(B)},F.update=function(X){return F.create().update(X)};for(var ne=0;ne<O.length;++ne){var Z=O[ne];F[Z]=G(Z,B)}return F},W=function(B,F){var ne,Z=Jp,X=Jp.Buffer,ae=F?"sha224":"sha256";return ne=X.from&&!i.JS_SHA256_NO_BUFFER_FROM?X.from:function(ue){return new X(ue)},function(ue){if(typeof ue=="string")return Z.createHash(ae).update(ue,"utf8").digest("hex");if(ue==null)throw new Error(a);return ue.constructor===ArrayBuffer&&(ue=new Uint8Array(ue)),Array.isArray(ue)||ArrayBuffer.isView(ue)||ue.constructor===X?Z.createHash(ae).update(ne(ue)).digest("hex"):B(ue)}},de=function(B,F){return function(ne,Z){return new be(ne,F,!0).update(Z)[B]()}},ye=function(B){var F=de("hex",B);F.create=function(X){return new be(X,B)},F.update=function(X,ae){return F.create(X).update(ae)};for(var ne=0;ne<O.length;++ne){var Z=O[ne];F[Z]=de(Z,B)}return F};function ie(B,F){F?(M[0]=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,this.blocks=M):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],B?(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=B}function be(B,F,ne){var Z,X=typeof B;if(X==="string"){var ae,ue=[],se=B.length,Be=0;for(Z=0;Z<se;++Z)(ae=B.charCodeAt(Z))<128?ue[Be++]=ae:ae<2048?(ue[Be++]=192|ae>>>6,ue[Be++]=128|63&ae):ae<55296||ae>=57344?(ue[Be++]=224|ae>>>12,ue[Be++]=128|ae>>>6&63,ue[Be++]=128|63&ae):(ae=65536+((1023&ae)<<10|1023&B.charCodeAt(++Z)),ue[Be++]=240|ae>>>18,ue[Be++]=128|ae>>>12&63,ue[Be++]=128|ae>>>6&63,ue[Be++]=128|63&ae);B=ue}else{if(X!=="object")throw new Error(a);if(B===null)throw new Error(a);if(d&&B.constructor===ArrayBuffer)B=new Uint8Array(B);else if(!(Array.isArray(B)||d&&ArrayBuffer.isView(B)))throw new Error(a)}B.length>64&&(B=new ie(F,!0).update(B).array());var $e=[],Ge=[];for(Z=0;Z<64;++Z){var D=B[Z]||0;$e[Z]=92^D,Ge[Z]=54^D}ie.call(this,F,ne),this.update(Ge),this.oKeyPad=$e,this.inner=!0,this.sharedMemory=ne}ie.prototype.update=function(B){if(!this.finalized){var F,ne=typeof B;if(ne!=="string"){if(ne!=="object")throw new Error(a);if(B===null)throw new Error(a);if(d&&B.constructor===ArrayBuffer)B=new Uint8Array(B);else if(!(Array.isArray(B)||d&&ArrayBuffer.isView(B)))throw new Error(a);F=!0}for(var Z,X,ae=0,ue=B.length,se=this.blocks;ae<ue;){if(this.hashed&&(this.hashed=!1,se[0]=this.block,this.block=se[16]=se[1]=se[2]=se[3]=se[4]=se[5]=se[6]=se[7]=se[8]=se[9]=se[10]=se[11]=se[12]=se[13]=se[14]=se[15]=0),F)for(X=this.start;ae<ue&&X<64;++ae)se[X>>>2]|=B[ae]<<S[3&X++];else for(X=this.start;ae<ue&&X<64;++ae)(Z=B.charCodeAt(ae))<128?se[X>>>2]|=Z<<S[3&X++]:Z<2048?(se[X>>>2]|=(192|Z>>>6)<<S[3&X++],se[X>>>2]|=(128|63&Z)<<S[3&X++]):Z<55296||Z>=57344?(se[X>>>2]|=(224|Z>>>12)<<S[3&X++],se[X>>>2]|=(128|Z>>>6&63)<<S[3&X++],se[X>>>2]|=(128|63&Z)<<S[3&X++]):(Z=65536+((1023&Z)<<10|1023&B.charCodeAt(++ae)),se[X>>>2]|=(240|Z>>>18)<<S[3&X++],se[X>>>2]|=(128|Z>>>12&63)<<S[3&X++],se[X>>>2]|=(128|Z>>>6&63)<<S[3&X++],se[X>>>2]|=(128|63&Z)<<S[3&X++]);this.lastByteIndex=X,this.bytes+=X-this.start,X>=64?(this.block=se[16],this.start=X-64,this.hash(),this.hashed=!0):this.start=X}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},ie.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var B=this.blocks,F=this.lastByteIndex;B[16]=this.block,B[F>>>2]|=v[3&F],this.block=B[16],F>=56&&(this.hashed||this.hash(),B[0]=this.block,B[16]=B[1]=B[2]=B[3]=B[4]=B[5]=B[6]=B[7]=B[8]=B[9]=B[10]=B[11]=B[12]=B[13]=B[14]=B[15]=0),B[14]=this.hBytes<<3|this.bytes>>>29,B[15]=this.bytes<<3,this.hash()}},ie.prototype.hash=function(){var B,F,ne,Z,X,ae,ue,se,Be,$e=this.h0,Ge=this.h1,D=this.h2,K=this.h3,oe=this.h4,ge=this.h5,pe=this.h6,Ee=this.h7,_e=this.blocks;for(B=16;B<64;++B)F=((X=_e[B-15])>>>7|X<<25)^(X>>>18|X<<14)^X>>>3,ne=((X=_e[B-2])>>>17|X<<15)^(X>>>19|X<<13)^X>>>10,_e[B]=_e[B-16]+F+_e[B-7]+ne|0;for(Be=Ge&D,B=0;B<64;B+=4)this.first?(this.is224?(ae=300032,Ee=(X=_e[0]-1413257819)-150054599|0,K=X+24177077|0):(ae=704751109,Ee=(X=_e[0]-210244248)-1521486534|0,K=X+143694565|0),this.first=!1):(F=($e>>>2|$e<<30)^($e>>>13|$e<<19)^($e>>>22|$e<<10),Z=(ae=$e&Ge)^$e&D^Be,Ee=K+(X=Ee+(ne=(oe>>>6|oe<<26)^(oe>>>11|oe<<21)^(oe>>>25|oe<<7))+(oe&ge^~oe&pe)+N[B]+_e[B])|0,K=X+(F+Z)|0),F=(K>>>2|K<<30)^(K>>>13|K<<19)^(K>>>22|K<<10),Z=(ue=K&$e)^K&Ge^ae,pe=D+(X=pe+(ne=(Ee>>>6|Ee<<26)^(Ee>>>11|Ee<<21)^(Ee>>>25|Ee<<7))+(Ee&oe^~Ee&ge)+N[B+1]+_e[B+1])|0,F=((D=X+(F+Z)|0)>>>2|D<<30)^(D>>>13|D<<19)^(D>>>22|D<<10),Z=(se=D&K)^D&$e^ue,ge=Ge+(X=ge+(ne=(pe>>>6|pe<<26)^(pe>>>11|pe<<21)^(pe>>>25|pe<<7))+(pe&Ee^~pe&oe)+N[B+2]+_e[B+2])|0,F=((Ge=X+(F+Z)|0)>>>2|Ge<<30)^(Ge>>>13|Ge<<19)^(Ge>>>22|Ge<<10),Z=(Be=Ge&D)^Ge&K^se,oe=$e+(X=oe+(ne=(ge>>>6|ge<<26)^(ge>>>11|ge<<21)^(ge>>>25|ge<<7))+(ge&pe^~ge&Ee)+N[B+3]+_e[B+3])|0,$e=X+(F+Z)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+$e|0,this.h1=this.h1+Ge|0,this.h2=this.h2+D|0,this.h3=this.h3+K|0,this.h4=this.h4+oe|0,this.h5=this.h5+ge|0,this.h6=this.h6+pe|0,this.h7=this.h7+Ee|0},ie.prototype.hex=function(){this.finalize();var B=this.h0,F=this.h1,ne=this.h2,Z=this.h3,X=this.h4,ae=this.h5,ue=this.h6,se=this.h7,Be=m[B>>>28&15]+m[B>>>24&15]+m[B>>>20&15]+m[B>>>16&15]+m[B>>>12&15]+m[B>>>8&15]+m[B>>>4&15]+m[15&B]+m[F>>>28&15]+m[F>>>24&15]+m[F>>>20&15]+m[F>>>16&15]+m[F>>>12&15]+m[F>>>8&15]+m[F>>>4&15]+m[15&F]+m[ne>>>28&15]+m[ne>>>24&15]+m[ne>>>20&15]+m[ne>>>16&15]+m[ne>>>12&15]+m[ne>>>8&15]+m[ne>>>4&15]+m[15&ne]+m[Z>>>28&15]+m[Z>>>24&15]+m[Z>>>20&15]+m[Z>>>16&15]+m[Z>>>12&15]+m[Z>>>8&15]+m[Z>>>4&15]+m[15&Z]+m[X>>>28&15]+m[X>>>24&15]+m[X>>>20&15]+m[X>>>16&15]+m[X>>>12&15]+m[X>>>8&15]+m[X>>>4&15]+m[15&X]+m[ae>>>28&15]+m[ae>>>24&15]+m[ae>>>20&15]+m[ae>>>16&15]+m[ae>>>12&15]+m[ae>>>8&15]+m[ae>>>4&15]+m[15&ae]+m[ue>>>28&15]+m[ue>>>24&15]+m[ue>>>20&15]+m[ue>>>16&15]+m[ue>>>12&15]+m[ue>>>8&15]+m[ue>>>4&15]+m[15&ue];return this.is224||(Be+=m[se>>>28&15]+m[se>>>24&15]+m[se>>>20&15]+m[se>>>16&15]+m[se>>>12&15]+m[se>>>8&15]+m[se>>>4&15]+m[15&se]),Be},ie.prototype.toString=ie.prototype.hex,ie.prototype.digest=function(){this.finalize();var B=this.h0,F=this.h1,ne=this.h2,Z=this.h3,X=this.h4,ae=this.h5,ue=this.h6,se=this.h7,Be=[B>>>24&255,B>>>16&255,B>>>8&255,255&B,F>>>24&255,F>>>16&255,F>>>8&255,255&F,ne>>>24&255,ne>>>16&255,ne>>>8&255,255&ne,Z>>>24&255,Z>>>16&255,Z>>>8&255,255&Z,X>>>24&255,X>>>16&255,X>>>8&255,255&X,ae>>>24&255,ae>>>16&255,ae>>>8&255,255&ae,ue>>>24&255,ue>>>16&255,ue>>>8&255,255&ue];return this.is224||Be.push(se>>>24&255,se>>>16&255,se>>>8&255,255&se),Be},ie.prototype.array=ie.prototype.digest,ie.prototype.arrayBuffer=function(){this.finalize();var B=new ArrayBuffer(this.is224?28:32),F=new DataView(B);return F.setUint32(0,this.h0),F.setUint32(4,this.h1),F.setUint32(8,this.h2),F.setUint32(12,this.h3),F.setUint32(16,this.h4),F.setUint32(20,this.h5),F.setUint32(24,this.h6),this.is224||F.setUint32(28,this.h7),B},be.prototype=new ie,be.prototype.finalize=function(){if(ie.prototype.finalize.call(this),this.inner){this.inner=!1;var B=this.array();ie.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(B),ie.prototype.finalize.call(this)}};var Xe=$();Xe.sha256=Xe,Xe.sha224=$(!0),Xe.sha256.hmac=ye(),Xe.sha224.hmac=ye(!0),f?Ju.exports=Xe:(i.sha256=Xe.sha256,i.sha224=Xe.sha224)})();wc.exports;wc.exports.sha224;var Qp=wc.exports.sha256;function of(a){return p_(a)}function u_(a){if(!/^[0-9A-Fa-f]+$/.test(a))return!1;const i=/^[0-9A-F]+$/.test(a),l=/^[0-9a-f]+$/.test(a);return i||l?a.length%2===0:!1}function f_(a){return/^[A-Za-z0-9\-_]*(={0,2})?$/.test(a)||/^[A-Za-z0-9+/]*(={0,2})?$/.test(a)}function h_(a){return u_(a)?"hex":f_(a)?"b64":""}function d_(a){if(a.length%2!==0)throw new Error("hex string must have an even length");const n=new Uint8Array(a.length/2);for(let i=0;i<a.length;i+=2)n[i/2]=parseInt(a.substring(i,i+2),16);return n}function m_(a){a=a.replace(/-/g,"+"),a=a.replace(/_/g,"/");const n=atob(a);return Uint8Array.from(n,i=>i.charCodeAt(0))}function p_(a){switch(h_(a)){case"hex":return d_(a);case"b64":return m_(a)}return null}function y_(a,n){const i=typeof a=="string"?of(a):a,l=typeof n=="string"?of(n):n;if(i===null||l===null||i.length!==l.length)return!1;for(let o=0;o<i.length;o++)if(i[o]!==l[o])return!1;return!0}class E0{constructor(n,i,l=!0){b(this,"token");b(this,"received");b(this,"ctx");b(this,"requestSubject");b(this,"mux");this.mux=n,this.requestSubject=i,this.received=0,this.token=Js.next(),l&&(this.ctx=new Error)}}class g_ extends E0{constructor(i,l,o={maxWait:1e3}){super(i,l);b(this,"callback");b(this,"done");b(this,"timer");b(this,"max");b(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=tt(),this.done.then(()=>{this.callback(null,null)}),this.timer=setTimeout(()=>{this.cancel()},o.maxWait)}cancel(i){i&&this.callback(i,null),clearTimeout(this.timer),this.mux.cancel(this),this.done.resolve()}resolver(i,l){i?(this.ctx&&(i.stack+=`
33
+
34
+ ${this.ctx.stack}`),this.cancel(i)):(this.callback(null,l),this.opts.strategy===An.Count&&(this.max--,this.max===0&&this.cancel()),this.opts.strategy===An.JitterTimer&&(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.cancel()},this.opts.jitter||300)),this.opts.strategy===An.SentinelMsg&&l&&l.data.length===0&&this.cancel())}}class A0 extends E0{constructor(i,l,o={timeout:1e3},f=!0){super(i,l,f);b(this,"deferred");b(this,"timer");this.deferred=tt(),this.timer=dr(o.timeout,f)}resolver(i,l){this.timer&&this.timer.cancel(),i?(this.ctx&&(i.stack+=`
35
+
36
+ ${this.ctx.stack}`),this.deferred.reject(i)):this.deferred.resolve(l),this.cancel()}cancel(i){this.timer&&this.timer.cancel(),this.mux.cancel(this),this.deferred.reject(i||re.errorForCode(I.Cancelled))}}const b_="$JS.API";function __(a){return a=a||{},a.domain&&(a.apiPrefix=`$JS.${a.domain}.API`,delete a.domain),xc({apiPrefix:b_,timeout:5e3},a)}class Na{constructor(n,i){b(this,"nc");b(this,"opts");b(this,"prefix");b(this,"timeout");b(this,"jc");this.nc=n,this.opts=__(i),this._parseOpts(),this.prefix=this.opts.apiPrefix,this.timeout=this.opts.timeout,this.jc=On()}getOptions(){return Object.assign({},this.opts)}_parseOpts(){let n=this.opts.apiPrefix;if(!n||n.length===0)throw new Error("invalid empty prefix");n[n.length-1]==="."&&(n=n.substr(0,n.length-1)),this.opts.apiPrefix=n}async _request(n,i=null,l){l=l||{},l.timeout=this.timeout;let o=en;i&&(o=this.jc.encode(i));let{retries:f}=l;f=f||1,f=f===-1?Number.MAX_SAFE_INTEGER:f;const d=Tf();for(let m=0;m<f;m++)try{const v=await this.nc.request(n,o,l);return this.parseJsResponse(v)}catch(v){const S=v;if((S.code==="503"||S.code===I.Timeout)&&m+1<f)await br(d.backoff(m));else throw v}}async findStream(n){const i={subject:n},o=await this._request(`${this.prefix}.STREAM.NAMES`,i);if(!o.streams||o.streams.length!==1)throw new Error("no stream matches subject");return o.streams[0]}getConnection(){return this.nc}parseJsResponse(n){const i=this.jc.decode(n.data),l=i;if(l.error){const o=w0(l.error.code,l.error.description);if(o!==null)throw o.api_error=l.error,o}return i}}class _a{constructor(n,i,l,o){b(this,"err");b(this,"offset");b(this,"pageInfo");b(this,"subject");b(this,"jsm");b(this,"filter");b(this,"payload");if(!n)throw new Error("subject is required");this.subject=n,this.jsm=l,this.offset=0,this.pageInfo={},this.filter=i,this.payload=o||{}}async next(){if(this.err)return[];if(this.pageInfo&&this.offset>=this.pageInfo.total)return[];const n={offset:this.offset};this.payload&&Object.assign(n,this.payload);try{const i=await this.jsm._request(this.subject,n,{timeout:this.jsm.timeout});this.pageInfo=i;const l=this.countResponse(i);return l===0?[]:(this.offset+=l,this.filter(i))}catch(i){throw this.err=i,i}}countResponse(n){var i,l,o;switch(n==null?void 0:n.type){case"io.nats.jetstream.api.v1.stream_names_response":case"io.nats.jetstream.api.v1.stream_list_response":return((i=n.streams)==null?void 0:i.length)||0;case"io.nats.jetstream.api.v1.consumer_list_response":return((l=n.consumers)==null?void 0:l.length)||0;default:return console.error(`jslister.ts: unknown API response for paged output: ${n==null?void 0:n.type}`),((o=n.streams)==null?void 0:o.length)||0}return 0}async*[Symbol.asyncIterator](){let n=await this.next();for(;n.length>0;){for(const i of n)yield i;n=await this.next()}}}function gi(a=""){const n=a.match(/(\d+).(\d+).(\d+)/);if(n)return{major:parseInt(n[1]),minor:parseInt(n[2]),micro:parseInt(n[3])};throw new Error(`'${a}' is not a semver value`)}function uf(a,n){return a.major<n.major?-1:a.major>n.major?1:a.minor<n.minor?-1:a.minor>n.minor?1:a.micro<n.micro?-1:a.micro>n.micro?1:0}var Re;(function(a){a.JS_KV="js_kv",a.JS_OBJECTSTORE="js_objectstore",a.JS_PULL_MAX_BYTES="js_pull_max_bytes",a.JS_NEW_CONSUMER_CREATE_API="js_new_consumer_create",a.JS_ALLOW_DIRECT="js_allow_direct",a.JS_MULTIPLE_CONSUMER_FILTER="js_multiple_consumer_filter",a.JS_SIMPLIFICATION="js_simplification",a.JS_STREAM_CONSUMER_METADATA="js_stream_consumer_metadata",a.JS_CONSUMER_FILTER_SUBJECTS="js_consumer_filter_subjects",a.JS_STREAM_FIRST_SEQ="js_stream_first_seq",a.JS_STREAM_SUBJECT_TRANSFORM="js_stream_subject_transform",a.JS_STREAM_SOURCE_SUBJECT_TRANSFORM="js_stream_source_subject_transform",a.JS_STREAM_COMPRESSION="js_stream_compression",a.JS_DEFAULT_CONSUMER_LIMITS="js_default_consumer_limits",a.JS_BATCH_DIRECT_GET="js_batch_direct_get"})(Re||(Re={}));class v_{constructor(n){b(this,"server");b(this,"features");b(this,"disabled");this.features=new Map,this.disabled=[],this.update(n)}resetDisabled(){this.disabled.length=0,this.update(this.server)}disable(n){this.disabled.push(n),this.update(this.server)}isDisabled(n){return this.disabled.indexOf(n)!==-1}update(n){typeof n=="string"&&(n=gi(n)),this.server=n,this.set(Re.JS_KV,"2.6.2"),this.set(Re.JS_OBJECTSTORE,"2.6.3"),this.set(Re.JS_PULL_MAX_BYTES,"2.8.3"),this.set(Re.JS_NEW_CONSUMER_CREATE_API,"2.9.0"),this.set(Re.JS_ALLOW_DIRECT,"2.9.0"),this.set(Re.JS_MULTIPLE_CONSUMER_FILTER,"2.10.0"),this.set(Re.JS_SIMPLIFICATION,"2.9.4"),this.set(Re.JS_STREAM_CONSUMER_METADATA,"2.10.0"),this.set(Re.JS_CONSUMER_FILTER_SUBJECTS,"2.10.0"),this.set(Re.JS_STREAM_FIRST_SEQ,"2.10.0"),this.set(Re.JS_STREAM_SUBJECT_TRANSFORM,"2.10.0"),this.set(Re.JS_STREAM_SOURCE_SUBJECT_TRANSFORM,"2.10.0"),this.set(Re.JS_STREAM_COMPRESSION,"2.10.0"),this.set(Re.JS_DEFAULT_CONSUMER_LIMITS,"2.10.0"),this.set(Re.JS_BATCH_DIRECT_GET,"2.11.0"),this.disabled.forEach(i=>{this.features.delete(i)})}set(n,i){this.features.set(n,{min:i,ok:uf(this.server,gi(i))>=0})}get(n){return this.features.get(n)||{min:"unknown",ok:!1}}supports(n){var i;return((i=this.get(n))==null?void 0:i.ok)||!1}require(n){return typeof n=="string"&&(n=gi(n)),uf(this.server,n)>=0}}class gc extends Na{constructor(n,i){super(n,i)}async add(n,i,l=yc.Create){if(Mt(n),i.deliver_group&&i.flow_control)throw new Error("jetstream flow control is not supported with queue groups");if(i.deliver_group&&i.idle_heartbeat)throw new Error("jetstream idle heartbeat is not supported with queue groups");const o={};o.config=i,o.stream_name=n,o.action=l,o.config.durable_name&&or(o.config.durable_name);const f=this.nc;let{min:d,ok:m}=f.features.get(Re.JS_NEW_CONSUMER_CREATE_API);const v=i.name===""?void 0:i.name;if(v&&!m)throw new Error(`consumer 'name' requires server ${d}`);if(v)try{Sc("name",v)}catch(M){const G=M.message,$=G.indexOf("cannot contain");throw $!==-1?new Error(`consumer 'name' ${G.substring($)}`):M}let S,N="";if(Array.isArray(i.filter_subjects)){const{min:M,ok:G}=f.features.get(Re.JS_MULTIPLE_CONSUMER_FILTER);if(!G)throw new Error(`consumer 'filter_subjects' requires server ${M}`);m=!1}if(i.metadata){const{min:M,ok:G}=f.features.get(Re.JS_STREAM_CONSUMER_METADATA);if(!G)throw new Error(`consumer 'metadata' requires server ${M}`)}if(m&&(N=i.name??i.durable_name??""),N!==""){let M=i.filter_subject??void 0;M===">"&&(M=void 0),S=M!==void 0?`${this.prefix}.CONSUMER.CREATE.${n}.${N}.${M}`:`${this.prefix}.CONSUMER.CREATE.${n}.${N}`}else S=i.durable_name?`${this.prefix}.CONSUMER.DURABLE.CREATE.${n}.${i.durable_name}`:`${this.prefix}.CONSUMER.CREATE.${n}`;return await this._request(S,o)}async update(n,i,l){const o=await this.info(n,i),f=l;return this.add(n,Object.assign(o.config,f),yc.Update)}async info(n,i){return Mt(n),or(i),await this._request(`${this.prefix}.CONSUMER.INFO.${n}.${i}`)}async delete(n,i){return Mt(n),or(i),(await this._request(`${this.prefix}.CONSUMER.DELETE.${n}.${i}`)).success}list(n){Mt(n);const i=o=>o.consumers,l=`${this.prefix}.CONSUMER.LIST.${n}`;return new _a(l,i,this)}pause(n,i,l){const o=`${this.prefix}.CONSUMER.PAUSE.${n}.${i}`,f={pause_until:l.toISOString()};return this._request(o,f)}resume(n,i){return this.pause(n,i,new Date(0))}}function ar(a,n,i=!1){if(i===!0&&!a)throw re.errorForCode(I.ApiError,new Error(`${n} is not a function`));if(a&&typeof a!="function")throw re.errorForCode(I.ApiError,new Error(`${n} is not a function`))}class x_ extends _t{constructor(i,l,o){super();b(this,"sub");b(this,"adapter");b(this,"subIterDone");ar(o.adapter,"adapter",!0),this.adapter=o.adapter,o.callback&&ar(o.callback,"callback"),this.noIterator=typeof o.callback=="function",o.ingestionFilterFn&&(ar(o.ingestionFilterFn,"ingestionFilterFn"),this.ingestionFilterFn=o.ingestionFilterFn),o.protocolFilterFn&&(ar(o.protocolFilterFn,"protocolFilterFn"),this.protocolFilterFn=o.protocolFilterFn),o.dispatchedFn&&(ar(o.dispatchedFn,"dispatchedFn"),this.dispatchedFn=o.dispatchedFn),o.cleanupFn&&ar(o.cleanupFn,"cleanupFn");let f=(N,O)=>{this.callback(N,O)};if(o.callback){const N=o.callback;f=(O,M)=>{const[G,$]=this.adapter(O,M);if(G){N(G,null);return}const{ingest:W}=this.ingestionFilterFn?this.ingestionFilterFn($,this):{ingest:!0};W&&(!this.protocolFilterFn||this.protocolFilterFn($))&&(N(G,$),this.dispatchedFn&&$&&this.dispatchedFn($))}}const{max:d,queue:m,timeout:v}=o,S={queue:m,timeout:v,callback:f};d&&d>0&&(S.max=d),this.sub=i.subscribe(l,S),o.cleanupFn&&(this.sub.cleanupFn=o.cleanupFn),this.noIterator||this.iterClosed.then(()=>{this.unsubscribe()}),this.subIterDone=tt(),Promise.all([this.sub.closed,this.iterClosed]).then(()=>{this.subIterDone.resolve()}).catch(()=>{this.subIterDone.resolve()}),(async N=>{await N.closed,this.stop()})(this.sub).then().catch()}unsubscribe(i){this.sub.unsubscribe(i)}drain(){return this.sub.drain()}isDraining(){return this.sub.isDraining()}isClosed(){return this.sub.isClosed()}callback(i,l){this.sub.cancelTimeout();const[o,f]=this.adapter(i,l);o&&this.stop(o),f&&this.push(f)}getSubject(){return this.sub.getSubject()}getReceived(){return this.sub.getReceived()}getProcessed(){return this.sub.getProcessed()}getPending(){return this.sub.getPending()}getID(){return this.sub.getID()}getMax(){return this.sub.getMax()}get closed(){return this.sub.closed}}let Wt;function S_(a){Wt=a}function O0(){return Wt!==void 0&&Wt.defaultPort!==void 0?Wt.defaultPort:4222}function Qu(){return Wt!==void 0&&Wt.urlParseFn?Wt.urlParseFn:void 0}function w_(){if(!Wt||typeof Wt.factory!="function")throw new Error("transport fn is not set");return Wt.factory()}function ff(){return Wt!==void 0&&Wt.dnsResolveFn?Wt.dnsResolveFn:void 0}const rc=`\r
37
+ `,bc=pr.fromAscii(rc),E_=new Uint8Array(bc)[0],A_=new Uint8Array(bc)[1];function O_(a){for(let n=0;n<a.length;n++){const i=n+1;if(a.byteLength>i&&a[n]===E_&&a[i]===A_)return i+1}return 0}function T_(a){const n=O_(a);if(n>0){const l=new Uint8Array(a).slice(0,n);return It.decode(l)}return""}const j_=4,T0=48,N_=65,C_=97;function M_(a,n,i,l){const o=new Uint8Array(16);return[0,0,0,0,0,0,0,0,0,0,255,255].forEach((d,m)=>{o[m]=d}),o[12]=a,o[13]=n,o[14]=i,o[15]=l,o}function hf(a){return k_(a)!==void 0}function k_(a){for(let n=0;n<a.length;n++)switch(a[n]){case".":return j0(a);case":":return R_(a)}}function j0(a){const n=new Uint8Array(4);for(let i=0;i<4;i++){if(a.length===0)return;if(i>0){if(a[0]!==".")return;a=a.substring(1)}const{n:l,c:o,ok:f}=z_(a);if(!f||l>255)return;a=a.substring(o),n[i]=l}return M_(n[0],n[1],n[2],n[3])}function R_(a){const n=new Uint8Array(16);let i=-1;if(a.length>=2&&a[0]===":"&&a[1]===":"&&(i=0,a=a.substring(2),a.length===0))return n;let l=0;for(;l<16;){const{n:o,c:f,ok:d}=U_(a);if(!d||o>65535)return;if(f<a.length&&a[f]==="."){if(i<0&&l!=12||l+4>16)return;const m=j0(a);if(m===void 0)return;n[l]=m[12],n[l+1]=m[13],n[l+2]=m[14],n[l+3]=m[15],a="",l+=j_;break}if(n[l]=o>>8,n[l+1]=o,l+=2,a=a.substring(f),a.length===0)break;if(a[0]!==":"||a.length==1)return;if(a=a.substring(1),a[0]===":"){if(i>=0)return;if(i=l,a=a.substring(1),a.length===0)break}}if(a.length===0){if(l<16){if(i<0)return;const o=16-l;for(let f=l-1;f>=i;f--)n[f+o]=n[f];for(let f=i+o-1;f>=i;f--)n[f]=0}else if(i>=0)return;return n}}function z_(a){let n=0,i=0;for(n=0;n<a.length&&48<=a.charCodeAt(n)&&a.charCodeAt(n)<=57;n++)if(i=i*10+(a.charCodeAt(n)-T0),i>=16777215)return{n:16777215,c:n,ok:!1};return n===0?{n:0,c:0,ok:!1}:{n:i,c:n,ok:!0}}function U_(a){let n=0,i=0;for(i=0;i<a.length;i++){if(48<=a.charCodeAt(i)&&a.charCodeAt(i)<=57)n*=16,n+=a.charCodeAt(i)-T0;else if(97<=a.charCodeAt(i)&&a.charCodeAt(i)<=102)n*=16,n+=a.charCodeAt(i)-C_+10;else if(65<=a.charCodeAt(i)&&a.charCodeAt(i)<=70)n*=16,n+=a.charCodeAt(i)-N_+10;else break;if(n>=16777215)return{n:0,c:i,ok:!1}}return i===0?{n:0,c:i,ok:!1}:{n,c:i,ok:!0}}function q_(a){return a.indexOf("[")!==-1||a.indexOf("::")!==-1?!1:a.indexOf(".")!==-1||a.split(":").length<=2}function df(a){return!q_(a)}function D_(a){const n="::FFFF:",i=a.toUpperCase().indexOf(n);if(i!==-1&&a.indexOf(".")!==-1){let l=a.substring(i+n.length);return l=l.replace("[",""),l.replace("]","")}return a}function B_(a){a=a.trim(),a.match(/^(.*:\/\/)(.*)/m)&&(a=a.replace(/^(.*:\/\/)(.*)/gm,"$2")),a=D_(a),df(a)&&a.indexOf("[")===-1&&(a=`[${a}]`);const n=df(a)?a.match(/(]:)(\d+)/):a.match(/(:)(\d+)/),i=n&&n.length===3&&n[1]&&n[2]?parseInt(n[2]):4222,l=i===80?"https":"http",o=new URL(`${l}://${a}`);o.port=`${i}`;let f=o.hostname;return f.charAt(0)==="["&&(f=f.substring(1,f.length-1)),{listen:o.host,hostname:f,port:i}}class wa{constructor(n,i=!1){b(this,"src");b(this,"listen");b(this,"hostname");b(this,"port");b(this,"didConnect");b(this,"reconnects");b(this,"lastConnect");b(this,"gossiped");b(this,"tlsName");b(this,"resolves");this.src=n,this.tlsName="";const l=B_(n);this.listen=l.listen,this.hostname=l.hostname,this.port=l.port,this.didConnect=!1,this.reconnects=0,this.lastConnect=0,this.gossiped=i}toString(){return this.listen}async resolve(n){if(!n.fn||n.resolve===!1)return[this];const i=[];if(hf(this.hostname))return[this];{const l=await n.fn(this.hostname);n.debug&&console.log(`resolve ${this.hostname} = ${l.join(",")}`);for(const o of l){const f=this.port===80?"https":"http",d=new URL(`${f}://${df(o)?"["+o+"]":o}`);d.port=`${this.port}`;const m=new wa(d.host,!1);m.tlsName=this.hostname,i.push(m)}}return n.randomize&&x0(i),this.resolves=i,i}}class L_{constructor(n=[],i={}){b(this,"firstSelect");b(this,"servers");b(this,"currentServer");b(this,"tlsName");b(this,"randomize");this.firstSelect=!0,this.servers=[],this.tlsName="",this.randomize=i.randomize||!1;const l=Qu();n&&(n.forEach(o=>{o=l?l(o):o,this.servers.push(new wa(o))}),this.randomize&&(this.servers=x0(this.servers))),this.servers.length===0&&this.addServer(`${nf}:${O0()}`,!1),this.currentServer=this.servers[0]}clear(){this.servers.length=0}updateTLSName(){const n=this.getCurrentServer();hf(n.hostname)||(this.tlsName=n.hostname,this.servers.forEach(i=>{i.gossiped&&(i.tlsName=this.tlsName)}))}getCurrentServer(){return this.currentServer}addServer(n,i=!1){const l=Qu();n=l?l(n):n;const o=new wa(n,i);hf(o.hostname)&&(o.tlsName=this.tlsName),this.servers.push(o)}selectServer(){if(this.firstSelect)return this.firstSelect=!1,this.currentServer;const n=this.servers.shift();return n&&(this.servers.push(n),this.currentServer=n),n}removeCurrentServer(){this.removeServer(this.currentServer)}removeServer(n){if(n){const i=this.servers.indexOf(n);this.servers.splice(i,1)}}length(){return this.servers.length}next(){return this.servers.length?this.servers[0]:void 0}getServers(){return this.servers}update(n,i){const l=[];let o=[];const f=Qu(),d=new Map;n.connect_urls&&n.connect_urls.length>0&&n.connect_urls.forEach(v=>{v=f?f(v,i):v;const S=new wa(v,!0);d.set(v,S)});const m=[];return this.servers.forEach((v,S)=>{const N=v.listen;v.gossiped&&this.currentServer.listen!==N&&d.get(N)===void 0&&m.push(S),d.delete(N)}),m.reverse(),m.forEach(v=>{const S=this.servers.splice(v,1);o=o.concat(S[0].listen)}),d.forEach((v,S)=>{this.servers.push(v),l.push(S)}),{added:l,deleted:o}}}class H_{constructor(){b(this,"baseInbox");b(this,"reqs");this.reqs=new Map}size(){return this.reqs.size}init(n){return this.baseInbox=`${as(n)}.`,this.baseInbox}add(n){isNaN(n.received)||(n.received=0),this.reqs.set(n.token,n)}get(n){return this.reqs.get(n)}cancel(n){this.reqs.delete(n.token)}getToken(n){const i=n.subject||"";return i.indexOf(this.baseInbox)===0?i.substring(this.baseInbox.length):null}all(){return Array.from(this.reqs.values())}handleError(n,i){if(i&&i.permissionContext){if(n)return this.all().forEach(o=>{o.resolver(i,{})}),!0;const l=i.permissionContext;if(l.operation==="publish"){const o=this.all().find(f=>f.requestSubject===l.subject);if(o)return o.resolver(i,{}),!0}}return!1}dispatcher(){return(n,i)=>{const l=this.getToken(i);if(l){const o=this.get(l);o&&(n===null&&i.headers&&(n=S0(i)),o.resolver(n,i))}}}close(){const n=re.errorForCode(I.Timeout);this.reqs.forEach(i=>{i.resolver(n,{})})}}class G_{constructor(n,i,l){b(this,"ph");b(this,"interval");b(this,"maxOut");b(this,"timer");b(this,"pendings");this.ph=n,this.interval=i,this.maxOut=l,this.pendings=[]}start(){this.cancel(),this._schedule()}cancel(n){this.timer&&(clearTimeout(this.timer),this.timer=void 0),this._reset(),n&&this.ph.disconnect()}_schedule(){this.timer=setTimeout(()=>{if(this.ph.dispatchStatus({type:cr.PingTimer,data:`${this.pendings.length+1}`}),this.pendings.length===this.maxOut){this.cancel(!0);return}const n=tt();this.ph.flush(n).then(()=>{this._reset()}).catch(()=>{this.cancel()}),this.pendings.push(n),this._schedule()},this.interval)}_reset(){this.pendings=this.pendings.filter(n=>(n.resolve(),!1))}}class Y_ extends Error{constructor(n){super(n),this.name="AssertionError"}}function V_(a,n="Assertion failed."){if(!a)throw new Y_(n)}const Xp=32*1024,Xu=2**32-2;function Wl(a,n,i=0){const l=n.byteLength-i;return a.byteLength>l&&(a=a.subarray(0,l)),n.set(a,i),a.byteLength}class $u{constructor(n){b(this,"_buf");b(this,"_off");if(this._off=0,n==null){this._buf=new Uint8Array(0);return}this._buf=new Uint8Array(n)}bytes(n={copy:!0}){return n.copy===!1?this._buf.subarray(this._off):this._buf.slice(this._off)}empty(){return this._buf.byteLength<=this._off}get length(){return this._buf.byteLength-this._off}get capacity(){return this._buf.buffer.byteLength}truncate(n){if(n===0){this.reset();return}if(n<0||n>this.length)throw Error("bytes.Buffer: truncation out of range");this._reslice(this._off+n)}reset(){this._reslice(0),this._off=0}_tryGrowByReslice(n){const i=this._buf.byteLength;return n<=this.capacity-i?(this._reslice(i+n),i):-1}_reslice(n){V_(n<=this._buf.buffer.byteLength),this._buf=new Uint8Array(this._buf.buffer,0,n)}readByte(){const n=new Uint8Array(1);return this.read(n)?n[0]:null}read(n){if(this.empty())return this.reset(),n.byteLength===0?0:null;const i=Wl(this._buf.subarray(this._off),n);return this._off+=i,i}writeByte(n){return this.write(Uint8Array.of(n))}writeString(n){return this.write(_i.encode(n))}write(n){const i=this._grow(n.byteLength);return Wl(n,this._buf,i)}_grow(n){const i=this.length;i===0&&this._off!==0&&this.reset();const l=this._tryGrowByReslice(n);if(l>=0)return l;const o=this.capacity;if(n<=Math.floor(o/2)-i)Wl(this._buf.subarray(this._off),this._buf);else{if(o+n>Xu)throw new Error("The buffer cannot be grown beyond the maximum size.");{const f=new Uint8Array(Math.min(2*o+n,Xu));Wl(this._buf.subarray(this._off),f),this._buf=f}}return this._off=0,this._reslice(Math.min(i+n,Xu)),i}grow(n){if(n<0)throw Error("Buffer._grow: negative count");const i=this._grow(n);this._reslice(i)}readFrom(n){let i=0;const l=new Uint8Array(Xp);for(;;){const o=this.capacity-this.length<Xp,f=o?l:new Uint8Array(this._buf.buffer,this.length),d=n.read(f);if(d===null)return i;o?this.write(f.subarray(0,d)):this._reslice(this.length+d),i+=d}}}var kt;(function(a){a[a.OK=0]="OK",a[a.ERR=1]="ERR",a[a.MSG=2]="MSG",a[a.INFO=3]="INFO",a[a.PING=4]="PING",a[a.PONG=5]="PONG"})(kt||(kt={}));function $p(){const a={};return a.sid=-1,a.hdr=-1,a.size=-1,a}const P_=48;class Kp{constructor(n){b(this,"dispatcher");b(this,"state");b(this,"as");b(this,"drop");b(this,"hdr");b(this,"ma");b(this,"argBuf");b(this,"msgBuf");this.dispatcher=n,this.state=ee.OP_START,this.as=0,this.drop=0,this.hdr=0}parse(n){let i;for(i=0;i<n.length;i++){const l=n[i];switch(this.state){case ee.OP_START:switch(l){case te.M:case te.m:this.state=ee.OP_M,this.hdr=-1,this.ma=$p();break;case te.H:case te.h:this.state=ee.OP_H,this.hdr=0,this.ma=$p();break;case te.P:case te.p:this.state=ee.OP_P;break;case te.PLUS:this.state=ee.OP_PLUS;break;case te.MINUS:this.state=ee.OP_MINUS;break;case te.I:case te.i:this.state=ee.OP_I;break;default:throw this.fail(n.subarray(i))}break;case ee.OP_H:switch(l){case te.M:case te.m:this.state=ee.OP_M;break;default:throw this.fail(n.subarray(i))}break;case ee.OP_M:switch(l){case te.S:case te.s:this.state=ee.OP_MS;break;default:throw this.fail(n.subarray(i))}break;case ee.OP_MS:switch(l){case te.G:case te.g:this.state=ee.OP_MSG;break;default:throw this.fail(n.subarray(i))}break;case ee.OP_MSG:switch(l){case te.SPACE:case te.TAB:this.state=ee.OP_MSG_SPC;break;default:throw this.fail(n.subarray(i))}break;case ee.OP_MSG_SPC:switch(l){case te.SPACE:case te.TAB:continue;default:this.state=ee.MSG_ARG,this.as=i}break;case ee.MSG_ARG:switch(l){case te.CR:this.drop=1;break;case te.NL:{const o=this.argBuf?this.argBuf.bytes():n.subarray(this.as,i-this.drop);this.processMsgArgs(o),this.drop=0,this.as=i+1,this.state=ee.MSG_PAYLOAD,i=this.as+this.ma.size-1;break}default:this.argBuf&&this.argBuf.writeByte(l)}break;case ee.MSG_PAYLOAD:if(this.msgBuf)if(this.msgBuf.length>=this.ma.size){const o=this.msgBuf.bytes({copy:!1});this.dispatcher.push({kind:kt.MSG,msg:this.ma,data:o}),this.argBuf=void 0,this.msgBuf=void 0,this.state=ee.MSG_END}else{let o=this.ma.size-this.msgBuf.length;const f=n.length-i;f<o&&(o=f),o>0?(this.msgBuf.write(n.subarray(i,i+o)),i=i+o-1):this.msgBuf.writeByte(l)}else i-this.as>=this.ma.size&&(this.dispatcher.push({kind:kt.MSG,msg:this.ma,data:n.subarray(this.as,i)}),this.argBuf=void 0,this.msgBuf=void 0,this.state=ee.MSG_END);break;case ee.MSG_END:switch(l){case te.NL:this.drop=0,this.as=i+1,this.state=ee.OP_START;break;default:continue}break;case ee.OP_PLUS:switch(l){case te.O:case te.o:this.state=ee.OP_PLUS_O;break;default:throw this.fail(n.subarray(i))}break;case ee.OP_PLUS_O:switch(l){case te.K:case te.k:this.state=ee.OP_PLUS_OK;break;default:throw this.fail(n.subarray(i))}break;case ee.OP_PLUS_OK:switch(l){case te.NL:this.dispatcher.push({kind:kt.OK}),this.drop=0,this.state=ee.OP_START;break}break;case ee.OP_MINUS:switch(l){case te.E:case te.e:this.state=ee.OP_MINUS_E;break;default:throw this.fail(n.subarray(i))}break;case ee.OP_MINUS_E:switch(l){case te.R:case te.r:this.state=ee.OP_MINUS_ER;break;default:throw this.fail(n.subarray(i))}break;case ee.OP_MINUS_ER:switch(l){case te.R:case te.r:this.state=ee.OP_MINUS_ERR;break;default:throw this.fail(n.subarray(i))}break;case ee.OP_MINUS_ERR:switch(l){case te.SPACE:case te.TAB:this.state=ee.OP_MINUS_ERR_SPC;break;default:throw this.fail(n.subarray(i))}break;case ee.OP_MINUS_ERR_SPC:switch(l){case te.SPACE:case te.TAB:continue;default:this.state=ee.MINUS_ERR_ARG,this.as=i}break;case ee.MINUS_ERR_ARG:switch(l){case te.CR:this.drop=1;break;case te.NL:{let o;this.argBuf?(o=this.argBuf.bytes(),this.argBuf=void 0):o=n.subarray(this.as,i-this.drop),this.dispatcher.push({kind:kt.ERR,data:o}),this.drop=0,this.as=i+1,this.state=ee.OP_START;break}default:this.argBuf&&this.argBuf.write(Uint8Array.of(l))}break;case ee.OP_P:switch(l){case te.I:case te.i:this.state=ee.OP_PI;break;case te.O:case te.o:this.state=ee.OP_PO;break;default:throw this.fail(n.subarray(i))}break;case ee.OP_PO:switch(l){case te.N:case te.n:this.state=ee.OP_PON;break;default:throw this.fail(n.subarray(i))}break;case ee.OP_PON:switch(l){case te.G:case te.g:this.state=ee.OP_PONG;break;default:throw this.fail(n.subarray(i))}break;case ee.OP_PONG:switch(l){case te.NL:this.dispatcher.push({kind:kt.PONG}),this.drop=0,this.state=ee.OP_START;break}break;case ee.OP_PI:switch(l){case te.N:case te.n:this.state=ee.OP_PIN;break;default:throw this.fail(n.subarray(i))}break;case ee.OP_PIN:switch(l){case te.G:case te.g:this.state=ee.OP_PING;break;default:throw this.fail(n.subarray(i))}break;case ee.OP_PING:switch(l){case te.NL:this.dispatcher.push({kind:kt.PING}),this.drop=0,this.state=ee.OP_START;break}break;case ee.OP_I:switch(l){case te.N:case te.n:this.state=ee.OP_IN;break;default:throw this.fail(n.subarray(i))}break;case ee.OP_IN:switch(l){case te.F:case te.f:this.state=ee.OP_INF;break;default:throw this.fail(n.subarray(i))}break;case ee.OP_INF:switch(l){case te.O:case te.o:this.state=ee.OP_INFO;break;default:throw this.fail(n.subarray(i))}break;case ee.OP_INFO:switch(l){case te.SPACE:case te.TAB:this.state=ee.OP_INFO_SPC;break;default:throw this.fail(n.subarray(i))}break;case ee.OP_INFO_SPC:switch(l){case te.SPACE:case te.TAB:continue;default:this.state=ee.INFO_ARG,this.as=i}break;case ee.INFO_ARG:switch(l){case te.CR:this.drop=1;break;case te.NL:{let o;this.argBuf?(o=this.argBuf.bytes(),this.argBuf=void 0):o=n.subarray(this.as,i-this.drop),this.dispatcher.push({kind:kt.INFO,data:o}),this.drop=0,this.as=i+1,this.state=ee.OP_START;break}default:this.argBuf&&this.argBuf.writeByte(l)}break;default:throw this.fail(n.subarray(i))}}(this.state===ee.MSG_ARG||this.state===ee.MINUS_ERR_ARG||this.state===ee.INFO_ARG)&&!this.argBuf&&(this.argBuf=new $u(n.subarray(this.as,i-this.drop))),this.state===ee.MSG_PAYLOAD&&!this.msgBuf&&(this.argBuf||this.cloneMsgArg(),this.msgBuf=new $u(n.subarray(this.as)))}cloneMsgArg(){const n=this.ma.subject.length,i=this.ma.reply?this.ma.reply.length:0,l=new Uint8Array(n+i);l.set(this.ma.subject),this.ma.reply&&l.set(this.ma.reply,n),this.argBuf=new $u(l),this.ma.subject=l.subarray(0,n),this.ma.reply&&(this.ma.reply=l.subarray(n))}processMsgArgs(n){if(this.hdr>=0)return this.processHeaderMsgArgs(n);const i=[];let l=-1;for(let o=0;o<n.length;o++)switch(n[o]){case te.SPACE:case te.TAB:case te.CR:case te.NL:l>=0&&(i.push(n.subarray(l,o)),l=-1);break;default:l<0&&(l=o)}switch(l>=0&&i.push(n.subarray(l)),i.length){case 3:this.ma.subject=i[0],this.ma.sid=this.protoParseInt(i[1]),this.ma.reply=void 0,this.ma.size=this.protoParseInt(i[2]);break;case 4:this.ma.subject=i[0],this.ma.sid=this.protoParseInt(i[1]),this.ma.reply=i[2],this.ma.size=this.protoParseInt(i[3]);break;default:throw this.fail(n,"processMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(n,"processMsgArgs Bad or Missing Sid Error");if(this.ma.size<0)throw this.fail(n,"processMsgArgs Bad or Missing Size Error")}fail(n,i=""){return i?i=`${i} [${this.state}]`:i=`parse error [${this.state}]`,new Error(`${i}: ${It.decode(n)}`)}processHeaderMsgArgs(n){const i=[];let l=-1;for(let o=0;o<n.length;o++)switch(n[o]){case te.SPACE:case te.TAB:case te.CR:case te.NL:l>=0&&(i.push(n.subarray(l,o)),l=-1);break;default:l<0&&(l=o)}switch(l>=0&&i.push(n.subarray(l)),i.length){case 4:this.ma.subject=i[0],this.ma.sid=this.protoParseInt(i[1]),this.ma.reply=void 0,this.ma.hdr=this.protoParseInt(i[2]),this.ma.size=this.protoParseInt(i[3]);break;case 5:this.ma.subject=i[0],this.ma.sid=this.protoParseInt(i[1]),this.ma.reply=i[2],this.ma.hdr=this.protoParseInt(i[3]),this.ma.size=this.protoParseInt(i[4]);break;default:throw this.fail(n,"processHeaderMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Sid Error");if(this.ma.hdr<0||this.ma.hdr>this.ma.size)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Header Size Error");if(this.ma.size<0)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Size Error")}protoParseInt(n){if(n.length===0)return-1;let i=0;for(let l=0;l<n.length;l++){if(n[l]<48||n[l]>57)return-1;i=i*10+(n[l]-P_)}return i}}var ee;(function(a){a[a.OP_START=0]="OP_START",a[a.OP_PLUS=1]="OP_PLUS",a[a.OP_PLUS_O=2]="OP_PLUS_O",a[a.OP_PLUS_OK=3]="OP_PLUS_OK",a[a.OP_MINUS=4]="OP_MINUS",a[a.OP_MINUS_E=5]="OP_MINUS_E",a[a.OP_MINUS_ER=6]="OP_MINUS_ER",a[a.OP_MINUS_ERR=7]="OP_MINUS_ERR",a[a.OP_MINUS_ERR_SPC=8]="OP_MINUS_ERR_SPC",a[a.MINUS_ERR_ARG=9]="MINUS_ERR_ARG",a[a.OP_M=10]="OP_M",a[a.OP_MS=11]="OP_MS",a[a.OP_MSG=12]="OP_MSG",a[a.OP_MSG_SPC=13]="OP_MSG_SPC",a[a.MSG_ARG=14]="MSG_ARG",a[a.MSG_PAYLOAD=15]="MSG_PAYLOAD",a[a.MSG_END=16]="MSG_END",a[a.OP_H=17]="OP_H",a[a.OP_P=18]="OP_P",a[a.OP_PI=19]="OP_PI",a[a.OP_PIN=20]="OP_PIN",a[a.OP_PING=21]="OP_PING",a[a.OP_PO=22]="OP_PO",a[a.OP_PON=23]="OP_PON",a[a.OP_PONG=24]="OP_PONG",a[a.OP_I=25]="OP_I",a[a.OP_IN=26]="OP_IN",a[a.OP_INF=27]="OP_INF",a[a.OP_INFO=28]="OP_INFO",a[a.OP_INFO_SPC=29]="OP_INFO_SPC",a[a.INFO_ARG=30]="INFO_ARG"})(ee||(ee={}));var te;(function(a){a[a.CR=13]="CR",a[a.E=69]="E",a[a.e=101]="e",a[a.F=70]="F",a[a.f=102]="f",a[a.G=71]="G",a[a.g=103]="g",a[a.H=72]="H",a[a.h=104]="h",a[a.I=73]="I",a[a.i=105]="i",a[a.K=75]="K",a[a.k=107]="k",a[a.M=77]="M",a[a.m=109]="m",a[a.MINUS=45]="MINUS",a[a.N=78]="N",a[a.n=110]="n",a[a.NL=10]="NL",a[a.O=79]="O",a[a.o=111]="o",a[a.P=80]="P",a[a.p=112]="p",a[a.PLUS=43]="PLUS",a[a.R=82]="R",a[a.r=114]="r",a[a.S=83]="S",a[a.s=115]="s",a[a.SPACE=32]="SPACE",a[a.TAB=9]="TAB"})(te||(te={}));(function(a){var n=function(y,x){this.hi=y|0,this.lo=x|0},i=function(y){var x,_=new Float64Array(16);if(y)for(x=0;x<y.length;x++)_[x]=y[x];return _},l=function(){throw new Error("no PRNG")},o=new Uint8Array(16),f=new Uint8Array(32);f[0]=9;var d=i(),m=i([1]),v=i([56129,1]),S=i([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),N=i([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),O=i([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),M=i([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),G=i([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function $(y,x){return y<<x|y>>>32-x}function W(y,x){var _=y[x+3]&255;return _=_<<8|y[x+2]&255,_=_<<8|y[x+1]&255,_<<8|y[x+0]&255}function de(y,x){var _=y[x]<<24|y[x+1]<<16|y[x+2]<<8|y[x+3],w=y[x+4]<<24|y[x+5]<<16|y[x+6]<<8|y[x+7];return new n(_,w)}function ye(y,x,_){var w;for(w=0;w<4;w++)y[x+w]=_&255,_>>>=8}function ie(y,x,_){y[x]=_.hi>>24&255,y[x+1]=_.hi>>16&255,y[x+2]=_.hi>>8&255,y[x+3]=_.hi&255,y[x+4]=_.lo>>24&255,y[x+5]=_.lo>>16&255,y[x+6]=_.lo>>8&255,y[x+7]=_.lo&255}function be(y,x,_,w,A){var C,V=0;for(C=0;C<A;C++)V|=y[x+C]^_[w+C];return(1&V-1>>>8)-1}function Xe(y,x,_,w){return be(y,x,_,w,16)}function B(y,x,_,w){return be(y,x,_,w,32)}function F(y,x,_,w,A){var C=new Uint32Array(16),V=new Uint32Array(16),J=new Uint32Array(16),U=new Uint32Array(4),Y,le,we;for(Y=0;Y<4;Y++)V[5*Y]=W(w,4*Y),V[1+Y]=W(_,4*Y),V[6+Y]=W(x,4*Y),V[11+Y]=W(_,16+4*Y);for(Y=0;Y<16;Y++)J[Y]=V[Y];for(Y=0;Y<20;Y++){for(le=0;le<4;le++){for(we=0;we<4;we++)U[we]=V[(5*le+4*we)%16];for(U[1]^=$(U[0]+U[3]|0,7),U[2]^=$(U[1]+U[0]|0,9),U[3]^=$(U[2]+U[1]|0,13),U[0]^=$(U[3]+U[2]|0,18),we=0;we<4;we++)C[4*le+(le+we)%4]=U[we]}for(we=0;we<16;we++)V[we]=C[we]}if(A){for(Y=0;Y<16;Y++)V[Y]=V[Y]+J[Y]|0;for(Y=0;Y<4;Y++)V[5*Y]=V[5*Y]-W(w,4*Y)|0,V[6+Y]=V[6+Y]-W(x,4*Y)|0;for(Y=0;Y<4;Y++)ye(y,4*Y,V[5*Y]),ye(y,16+4*Y,V[6+Y])}else for(Y=0;Y<16;Y++)ye(y,4*Y,V[Y]+J[Y]|0)}function ne(y,x,_,w){return F(y,x,_,w,!1),0}function Z(y,x,_,w){return F(y,x,_,w,!0),0}var X=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function ae(y,x,_,w,A,C,V){var J=new Uint8Array(16),U=new Uint8Array(64),Y,le;if(!A)return 0;for(le=0;le<16;le++)J[le]=0;for(le=0;le<8;le++)J[le]=C[le];for(;A>=64;){for(ne(U,J,V,X),le=0;le<64;le++)y[x+le]=(_?_[w+le]:0)^U[le];for(Y=1,le=8;le<16;le++)Y=Y+(J[le]&255)|0,J[le]=Y&255,Y>>>=8;A-=64,x+=64,_&&(w+=64)}if(A>0)for(ne(U,J,V,X),le=0;le<A;le++)y[x+le]=(_?_[w+le]:0)^U[le];return 0}function ue(y,x,_,w,A){return ae(y,x,null,0,_,w,A)}function se(y,x,_,w,A){var C=new Uint8Array(32);return Z(C,w,A,X),ue(y,x,_,w.subarray(16),C)}function Be(y,x,_,w,A,C,V){var J=new Uint8Array(32);return Z(J,C,V,X),ae(y,x,_,w,A,C.subarray(16),J)}function $e(y,x){var _,w=0;for(_=0;_<17;_++)w=w+(y[_]+x[_]|0)|0,y[_]=w&255,w>>>=8}var Ge=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]);function D(y,x,_,w,A,C){var V,J,U,Y,le=new Uint32Array(17),we=new Uint32Array(17),Ke=new Uint32Array(17),Nt=new Uint32Array(17),_n=new Uint32Array(17);for(U=0;U<17;U++)we[U]=Ke[U]=0;for(U=0;U<16;U++)we[U]=C[U];for(we[3]&=15,we[4]&=252,we[7]&=15,we[8]&=252,we[11]&=15,we[12]&=252,we[15]&=15;A>0;){for(U=0;U<17;U++)Nt[U]=0;for(U=0;U<16&&U<A;++U)Nt[U]=_[w+U];for(Nt[U]=1,w+=U,A-=U,$e(Ke,Nt),J=0;J<17;J++)for(le[J]=0,U=0;U<17;U++)le[J]=le[J]+Ke[U]*(U<=J?we[J-U]:320*we[J+17-U]|0)|0|0;for(J=0;J<17;J++)Ke[J]=le[J];for(Y=0,U=0;U<16;U++)Y=Y+Ke[U]|0,Ke[U]=Y&255,Y>>>=8;for(Y=Y+Ke[16]|0,Ke[16]=Y&3,Y=5*(Y>>>2)|0,U=0;U<16;U++)Y=Y+Ke[U]|0,Ke[U]=Y&255,Y>>>=8;Y=Y+Ke[16]|0,Ke[16]=Y}for(U=0;U<17;U++)_n[U]=Ke[U];for($e(Ke,Ge),V=-(Ke[16]>>>7)|0,U=0;U<17;U++)Ke[U]^=V&(_n[U]^Ke[U]);for(U=0;U<16;U++)Nt[U]=C[U+16];for(Nt[16]=0,$e(Ke,Nt),U=0;U<16;U++)y[x+U]=Ke[U];return 0}function K(y,x,_,w,A,C){var V=new Uint8Array(16);return D(V,0,_,w,A,C),Xe(y,x,V,0)}function oe(y,x,_,w,A){var C;if(_<32)return-1;for(Be(y,0,x,0,_,w,A),D(y,16,y,32,_-32,y),C=0;C<16;C++)y[C]=0;return 0}function ge(y,x,_,w,A){var C,V=new Uint8Array(32);if(_<32||(se(V,0,32,w,A),K(x,16,x,32,_-32,V)!==0))return-1;for(Be(y,0,x,0,_,w,A),C=0;C<32;C++)y[C]=0;return 0}function pe(y,x){var _;for(_=0;_<16;_++)y[_]=x[_]|0}function Ee(y){var x,_;for(_=0;_<16;_++)y[_]+=65536,x=Math.floor(y[_]/65536),y[(_+1)*(_<15?1:0)]+=x-1+37*(x-1)*(_===15?1:0),y[_]-=x*65536}function _e(y,x,_){for(var w,A=~(_-1),C=0;C<16;C++)w=A&(y[C]^x[C]),y[C]^=w,x[C]^=w}function Ae(y,x){var _,w,A,C=i(),V=i();for(_=0;_<16;_++)V[_]=x[_];for(Ee(V),Ee(V),Ee(V),w=0;w<2;w++){for(C[0]=V[0]-65517,_=1;_<15;_++)C[_]=V[_]-65535-(C[_-1]>>16&1),C[_-1]&=65535;C[15]=V[15]-32767-(C[14]>>16&1),A=C[15]>>16&1,C[14]&=65535,_e(V,C,1-A)}for(_=0;_<16;_++)y[2*_]=V[_]&255,y[2*_+1]=V[_]>>8}function rt(y,x){var _=new Uint8Array(32),w=new Uint8Array(32);return Ae(_,y),Ae(w,x),B(_,0,w,0)}function Ht(y){var x=new Uint8Array(32);return Ae(x,y),x[0]&1}function tn(y,x){var _;for(_=0;_<16;_++)y[_]=x[2*_]+(x[2*_+1]<<8);y[15]&=32767}function At(y,x,_){var w;for(w=0;w<16;w++)y[w]=x[w]+_[w]|0}function Ot(y,x,_){var w;for(w=0;w<16;w++)y[w]=x[w]-_[w]|0}function ve(y,x,_){var w,A,C=new Float64Array(31);for(w=0;w<31;w++)C[w]=0;for(w=0;w<16;w++)for(A=0;A<16;A++)C[w+A]+=x[w]*_[A];for(w=0;w<15;w++)C[w]+=38*C[w+16];for(w=0;w<16;w++)y[w]=C[w];Ee(y),Ee(y)}function Tt(y,x){ve(y,x,x)}function Xs(y,x){var _=i(),w;for(w=0;w<16;w++)_[w]=x[w];for(w=253;w>=0;w--)Tt(_,_),w!==2&&w!==4&&ve(_,_,x);for(w=0;w<16;w++)y[w]=_[w]}function vi(y,x){var _=i(),w;for(w=0;w<16;w++)_[w]=x[w];for(w=250;w>=0;w--)Tt(_,_),w!==1&&ve(_,_,x);for(w=0;w<16;w++)y[w]=_[w]}function $s(y,x,_){var w=new Uint8Array(32),A=new Float64Array(80),C,V,J=i(),U=i(),Y=i(),le=i(),we=i(),Ke=i();for(V=0;V<31;V++)w[V]=x[V];for(w[31]=x[31]&127|64,w[0]&=248,tn(A,_),V=0;V<16;V++)U[V]=A[V],le[V]=J[V]=Y[V]=0;for(J[0]=le[0]=1,V=254;V>=0;--V)C=w[V>>>3]>>>(V&7)&1,_e(J,U,C),_e(Y,le,C),At(we,J,Y),Ot(J,J,Y),At(Y,U,le),Ot(U,U,le),Tt(le,we),Tt(Ke,J),ve(J,Y,J),ve(Y,U,we),At(we,J,Y),Ot(J,J,Y),Tt(U,J),Ot(Y,le,Ke),ve(J,Y,v),At(J,J,le),ve(Y,Y,J),ve(J,le,Ke),ve(le,U,A),Tt(U,we),_e(J,U,C),_e(Y,le,C);for(V=0;V<16;V++)A[V+16]=J[V],A[V+32]=Y[V],A[V+48]=U[V],A[V+64]=le[V];var Nt=A.subarray(32),_n=A.subarray(16);return Xs(Nt,Nt),ve(_n,_n,Nt),Ae(y,_n),0}function nn(y,x){return $s(y,x,f)}function xi(y,x){return l(x,32),nn(y,x)}function cs(y,x,_){var w=new Uint8Array(32);return $s(w,_,x),Z(y,o,w,X)}var Ma=oe,ka=ge;function vr(y,x,_,w,A,C){var V=new Uint8Array(32);return cs(V,A,C),Ma(y,x,_,w,V)}function xr(y,x,_,w,A,C){var V=new Uint8Array(32);return cs(V,A,C),ka(y,x,_,w,V)}function Bn(){var y=0,x=0,_=0,w=0,A=65535,C,V,J;for(J=0;J<arguments.length;J++)C=arguments[J].lo,V=arguments[J].hi,y+=C&A,x+=C>>>16,_+=V&A,w+=V>>>16;return x+=y>>>16,_+=x>>>16,w+=_>>>16,new n(_&A|w<<16,y&A|x<<16)}function Ra(y,x){return new n(y.hi>>>x,y.lo>>>x|y.hi<<32-x)}function Si(){var y=0,x=0,_;for(_=0;_<arguments.length;_++)y^=arguments[_].lo,x^=arguments[_].hi;return new n(x,y)}function Ie(y,x){var _,w,A=32-x;return x<32?(_=y.hi>>>x|y.lo<<A,w=y.lo>>>x|y.hi<<A):x<64&&(_=y.lo>>>x|y.hi<<A,w=y.hi>>>x|y.lo<<A),new n(_,w)}function jc(y,x,_){var w=y.hi&x.hi^~y.hi&_.hi,A=y.lo&x.lo^~y.lo&_.lo;return new n(w,A)}function za(y,x,_){var w=y.hi&x.hi^y.hi&_.hi^x.hi&_.hi,A=y.lo&x.lo^y.lo&_.lo^x.lo&_.lo;return new n(w,A)}function Ua(y){return Si(Ie(y,28),Ie(y,34),Ie(y,39))}function wi(y){return Si(Ie(y,14),Ie(y,18),Ie(y,41))}function Nc(y){return Si(Ie(y,1),Ie(y,8),Ra(y,7))}function qa(y){return Si(Ie(y,19),Ie(y,61),Ra(y,6))}var Cc=[new n(1116352408,3609767458),new n(1899447441,602891725),new n(3049323471,3964484399),new n(3921009573,2173295548),new n(961987163,4081628472),new n(1508970993,3053834265),new n(2453635748,2937671579),new n(2870763221,3664609560),new n(3624381080,2734883394),new n(310598401,1164996542),new n(607225278,1323610764),new n(1426881987,3590304994),new n(1925078388,4068182383),new n(2162078206,991336113),new n(2614888103,633803317),new n(3248222580,3479774868),new n(3835390401,2666613458),new n(4022224774,944711139),new n(264347078,2341262773),new n(604807628,2007800933),new n(770255983,1495990901),new n(1249150122,1856431235),new n(1555081692,3175218132),new n(1996064986,2198950837),new n(2554220882,3999719339),new n(2821834349,766784016),new n(2952996808,2566594879),new n(3210313671,3203337956),new n(3336571891,1034457026),new n(3584528711,2466948901),new n(113926993,3758326383),new n(338241895,168717936),new n(666307205,1188179964),new n(773529912,1546045734),new n(1294757372,1522805485),new n(1396182291,2643833823),new n(1695183700,2343527390),new n(1986661051,1014477480),new n(2177026350,1206759142),new n(2456956037,344077627),new n(2730485921,1290863460),new n(2820302411,3158454273),new n(3259730800,3505952657),new n(3345764771,106217008),new n(3516065817,3606008344),new n(3600352804,1432725776),new n(4094571909,1467031594),new n(275423344,851169720),new n(430227734,3100823752),new n(506948616,1363258195),new n(659060556,3750685593),new n(883997877,3785050280),new n(958139571,3318307427),new n(1322822218,3812723403),new n(1537002063,2003034995),new n(1747873779,3602036899),new n(1955562222,1575990012),new n(2024104815,1125592928),new n(2227730452,2716904306),new n(2361852424,442776044),new n(2428436474,593698344),new n(2756734187,3733110249),new n(3204031479,2999351573),new n(3329325298,3815920427),new n(3391569614,3928383900),new n(3515267271,566280711),new n(3940187606,3454069534),new n(4118630271,4000239992),new n(116418474,1914138554),new n(174292421,2731055270),new n(289380356,3203993006),new n(460393269,320620315),new n(685471733,587496836),new n(852142971,1086792851),new n(1017036298,365543100),new n(1126000580,2618297676),new n(1288033470,3409855158),new n(1501505948,4234509866),new n(1607167915,987167468),new n(1816402316,1246189591)];function Da(y,x,_){var w=[],A=[],C=[],V=[],J,U,Y;for(U=0;U<8;U++)w[U]=C[U]=de(y,8*U);for(var le=0;_>=128;){for(U=0;U<16;U++)V[U]=de(x,8*U+le);for(U=0;U<80;U++){for(Y=0;Y<8;Y++)A[Y]=C[Y];for(J=Bn(C[7],wi(C[4]),jc(C[4],C[5],C[6]),Cc[U],V[U%16]),A[7]=Bn(J,Ua(C[0]),za(C[0],C[1],C[2])),A[3]=Bn(A[3],J),Y=0;Y<8;Y++)C[(Y+1)%8]=A[Y];if(U%16===15)for(Y=0;Y<16;Y++)V[Y]=Bn(V[Y],V[(Y+9)%16],Nc(V[(Y+1)%16]),qa(V[(Y+14)%16]))}for(U=0;U<8;U++)C[U]=Bn(C[U],w[U]),w[U]=C[U];le+=128,_-=128}for(U=0;U<8;U++)ie(y,8*U,w[U]);return _}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 at(y,x,_){var w=new Uint8Array(64),A=new Uint8Array(256),C,V=_;for(C=0;C<64;C++)w[C]=Ks[C];for(Da(w,x,_),_%=128,C=0;C<256;C++)A[C]=0;for(C=0;C<_;C++)A[C]=x[V-_+C];for(A[_]=128,_=256-128*(_<112?1:0),A[_-9]=0,ie(A,_-8,new n(V/536870912|0,V<<3)),Da(w,A,_),C=0;C<64;C++)y[C]=w[C];return 0}function Gt(y,x){var _=i(),w=i(),A=i(),C=i(),V=i(),J=i(),U=i(),Y=i(),le=i();Ot(_,y[1],y[0]),Ot(le,x[1],x[0]),ve(_,_,le),At(w,y[0],y[1]),At(le,x[0],x[1]),ve(w,w,le),ve(A,y[3],x[3]),ve(A,A,N),ve(C,y[2],x[2]),At(C,C,C),Ot(V,w,_),Ot(J,C,A),At(U,C,A),At(Y,w,_),ve(y[0],V,J),ve(y[1],Y,U),ve(y[2],U,J),ve(y[3],V,Y)}function jt(y,x,_){var w;for(w=0;w<4;w++)_e(y[w],x[w],_)}function Sr(y,x){var _=i(),w=i(),A=i();Xs(A,x[2]),ve(_,x[0],A),ve(w,x[1],A),Ae(y,w),y[31]^=Ht(_)<<7}function wr(y,x,_){var w,A;for(pe(y[0],d),pe(y[1],m),pe(y[2],m),pe(y[3],d),A=255;A>=0;--A)w=_[A/8|0]>>(A&7)&1,jt(y,x,w),Gt(x,y),Gt(y,y),jt(y,x,w)}function Ei(y,x){var _=[i(),i(),i(),i()];pe(_[0],O),pe(_[1],M),pe(_[2],m),ve(_[3],O,M),wr(y,_,x)}function os(y,x,_){var w=new Uint8Array(64),A=[i(),i(),i(),i()],C;for(_||l(x,32),at(w,x,32),w[0]&=248,w[31]&=127,w[31]|=64,Ei(A,w),Sr(y,A),C=0;C<32;C++)x[C+32]=y[C];return 0}var Ln=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 us(y,x){var _,w,A,C;for(w=63;w>=32;--w){for(_=0,A=w-32,C=w-12;A<C;++A)x[A]+=_-16*x[w]*Ln[A-(w-32)],_=Math.floor((x[A]+128)/256),x[A]-=_*256;x[A]+=_,x[w]=0}for(_=0,A=0;A<32;A++)x[A]+=_-(x[31]>>4)*Ln[A],_=x[A]>>8,x[A]&=255;for(A=0;A<32;A++)x[A]-=_*Ln[A];for(w=0;w<32;w++)x[w+1]+=x[w]>>8,y[w]=x[w]&255}function gn(y){var x=new Float64Array(64),_;for(_=0;_<64;_++)x[_]=y[_];for(_=0;_<64;_++)y[_]=0;us(y,x)}function Fs(y,x,_,w){var A=new Uint8Array(64),C=new Uint8Array(64),V=new Uint8Array(64),J,U,Y=new Float64Array(64),le=[i(),i(),i(),i()];at(A,w,32),A[0]&=248,A[31]&=127,A[31]|=64;var we=_+64;for(J=0;J<_;J++)y[64+J]=x[J];for(J=0;J<32;J++)y[32+J]=A[32+J];for(at(V,y.subarray(32),_+32),gn(V),Ei(le,V),Sr(y,le),J=32;J<64;J++)y[J]=w[J];for(at(C,y,_+64),gn(C),J=0;J<64;J++)Y[J]=0;for(J=0;J<32;J++)Y[J]=V[J];for(J=0;J<32;J++)for(U=0;U<32;U++)Y[J+U]+=C[J]*A[U];return us(y.subarray(32),Y),we}function Zs(y,x){var _=i(),w=i(),A=i(),C=i(),V=i(),J=i(),U=i();return pe(y[2],m),tn(y[1],x),Tt(A,y[1]),ve(C,A,S),Ot(A,A,y[2]),At(C,y[2],C),Tt(V,C),Tt(J,V),ve(U,J,V),ve(_,U,A),ve(_,_,C),vi(_,_),ve(_,_,A),ve(_,_,C),ve(_,_,C),ve(y[0],_,C),Tt(w,y[0]),ve(w,w,C),rt(w,A)&&ve(y[0],y[0],G),Tt(w,y[0]),ve(w,w,C),rt(w,A)?-1:(Ht(y[0])===x[31]>>7&&Ot(y[0],d,y[0]),ve(y[3],y[0],y[1]),0)}function Er(y,x,_,w){var A,C=new Uint8Array(32),V=new Uint8Array(64),J=[i(),i(),i(),i()],U=[i(),i(),i(),i()];if(_<64||Zs(U,w))return-1;for(A=0;A<_;A++)y[A]=x[A];for(A=0;A<32;A++)y[A+32]=w[A];if(at(V,y,_),gn(V),wr(J,U,V),Ei(U,x.subarray(32)),Gt(J,U),Sr(C,J),_-=64,B(x,0,C,0)){for(A=0;A<_;A++)y[A]=0;return-1}for(A=0;A<_;A++)y[A]=x[A+64];return _}var Ai=32,fs=24,bn=32,hs=16,ds=32,Is=32,ms=32,Hn=32,Ws=32,Ar=fs,Ba=bn,jn=hs,Je=64,nt=32,Yt=64,ei=32,Or=64;a.lowlevel={crypto_core_hsalsa20:Z,crypto_stream_xor:Be,crypto_stream:se,crypto_stream_salsa20_xor:ae,crypto_stream_salsa20:ue,crypto_onetimeauth:D,crypto_onetimeauth_verify:K,crypto_verify_16:Xe,crypto_verify_32:B,crypto_secretbox:oe,crypto_secretbox_open:ge,crypto_scalarmult:$s,crypto_scalarmult_base:nn,crypto_box_beforenm:cs,crypto_box_afternm:Ma,crypto_box:vr,crypto_box_open:xr,crypto_box_keypair:xi,crypto_hash:at,crypto_sign:Fs,crypto_sign_keypair:os,crypto_sign_open:Er,crypto_secretbox_KEYBYTES:Ai,crypto_secretbox_NONCEBYTES:fs,crypto_secretbox_ZEROBYTES:bn,crypto_secretbox_BOXZEROBYTES:hs,crypto_scalarmult_BYTES:ds,crypto_scalarmult_SCALARBYTES:Is,crypto_box_PUBLICKEYBYTES:ms,crypto_box_SECRETKEYBYTES:Hn,crypto_box_BEFORENMBYTES:Ws,crypto_box_NONCEBYTES:Ar,crypto_box_ZEROBYTES:Ba,crypto_box_BOXZEROBYTES:jn,crypto_sign_BYTES:Je,crypto_sign_PUBLICKEYBYTES:nt,crypto_sign_SECRETKEYBYTES:Yt,crypto_sign_SEEDBYTES:ei,crypto_hash_BYTES:Or,gf:i,D:S,L:Ln,pack25519:Ae,unpack25519:tn,M:ve,A:At,S:Tt,Z:Ot,pow2523:vi,add:Gt,set25519:pe,modL:us,scalarmult:wr,scalarbase:Ei};function La(y,x){if(y.length!==Ai)throw new Error("bad key size");if(x.length!==fs)throw new Error("bad nonce size")}function Ha(y,x){if(y.length!==ms)throw new Error("bad public key size");if(x.length!==Hn)throw new Error("bad secret key size")}function pt(){for(var y=0;y<arguments.length;y++)if(!(arguments[y]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function Oi(y){for(var x=0;x<y.length;x++)y[x]=0}a.randomBytes=function(y){var x=new Uint8Array(y);return l(x,y),x},a.secretbox=function(y,x,_){pt(y,x,_),La(_,x);for(var w=new Uint8Array(bn+y.length),A=new Uint8Array(w.length),C=0;C<y.length;C++)w[C+bn]=y[C];return oe(A,w,w.length,x,_),A.subarray(hs)},a.secretbox.open=function(y,x,_){pt(y,x,_),La(_,x);for(var w=new Uint8Array(hs+y.length),A=new Uint8Array(w.length),C=0;C<y.length;C++)w[C+hs]=y[C];return w.length<32||ge(A,w,w.length,x,_)!==0?null:A.subarray(bn)},a.secretbox.keyLength=Ai,a.secretbox.nonceLength=fs,a.secretbox.overheadLength=hs,a.scalarMult=function(y,x){if(pt(y,x),y.length!==Is)throw new Error("bad n size");if(x.length!==ds)throw new Error("bad p size");var _=new Uint8Array(ds);return $s(_,y,x),_},a.scalarMult.base=function(y){if(pt(y),y.length!==Is)throw new Error("bad n size");var x=new Uint8Array(ds);return nn(x,y),x},a.scalarMult.scalarLength=Is,a.scalarMult.groupElementLength=ds,a.box=function(y,x,_,w){var A=a.box.before(_,w);return a.secretbox(y,x,A)},a.box.before=function(y,x){pt(y,x),Ha(y,x);var _=new Uint8Array(Ws);return cs(_,y,x),_},a.box.after=a.secretbox,a.box.open=function(y,x,_,w){var A=a.box.before(_,w);return a.secretbox.open(y,x,A)},a.box.open.after=a.secretbox.open,a.box.keyPair=function(){var y=new Uint8Array(ms),x=new Uint8Array(Hn);return xi(y,x),{publicKey:y,secretKey:x}},a.box.keyPair.fromSecretKey=function(y){if(pt(y),y.length!==Hn)throw new Error("bad secret key size");var x=new Uint8Array(ms);return nn(x,y),{publicKey:x,secretKey:new Uint8Array(y)}},a.box.publicKeyLength=ms,a.box.secretKeyLength=Hn,a.box.sharedKeyLength=Ws,a.box.nonceLength=Ar,a.box.overheadLength=a.secretbox.overheadLength,a.sign=function(y,x){if(pt(y,x),x.length!==Yt)throw new Error("bad secret key size");var _=new Uint8Array(Je+y.length);return Fs(_,y,y.length,x),_},a.sign.open=function(y,x){if(pt(y,x),x.length!==nt)throw new Error("bad public key size");var _=new Uint8Array(y.length),w=Er(_,y,y.length,x);if(w<0)return null;for(var A=new Uint8Array(w),C=0;C<A.length;C++)A[C]=_[C];return A},a.sign.detached=function(y,x){for(var _=a.sign(y,x),w=new Uint8Array(Je),A=0;A<w.length;A++)w[A]=_[A];return w},a.sign.detached.verify=function(y,x,_){if(pt(y,x,_),x.length!==Je)throw new Error("bad signature size");if(_.length!==nt)throw new Error("bad public key size");var w=new Uint8Array(Je+y.length),A=new Uint8Array(Je+y.length),C;for(C=0;C<Je;C++)w[C]=x[C];for(C=0;C<y.length;C++)w[C+Je]=y[C];return Er(A,w,w.length,_)>=0},a.sign.keyPair=function(){var y=new Uint8Array(nt),x=new Uint8Array(Yt);return os(y,x),{publicKey:y,secretKey:x}},a.sign.keyPair.fromSecretKey=function(y){if(pt(y),y.length!==Yt)throw new Error("bad secret key size");for(var x=new Uint8Array(nt),_=0;_<x.length;_++)x[_]=y[32+_];return{publicKey:x,secretKey:new Uint8Array(y)}},a.sign.keyPair.fromSeed=function(y){if(pt(y),y.length!==ei)throw new Error("bad seed size");for(var x=new Uint8Array(nt),_=new Uint8Array(Yt),w=0;w<32;w++)_[w]=y[w];return os(x,_,!0),{publicKey:x,secretKey:_}},a.sign.publicKeyLength=nt,a.sign.secretKeyLength=Yt,a.sign.seedLength=ei,a.sign.signatureLength=Je,a.hash=function(y){pt(y);var x=new Uint8Array(Or);return at(x,y,y.length),x},a.hash.hashLength=Or,a.verify=function(y,x){return pt(y,x),y.length===0||x.length===0||y.length!==x.length?!1:be(y,0,x,0,y.length)===0},a.setPRNG=function(y){l=y},(function(){var y=typeof globalThis<"u"?globalThis.crypto||globalThis.msCrypto:null;if(y&&y.getRandomValues){var x=65536;a.setPRNG(function(_,w){var A,C=new Uint8Array(w);for(A=0;A<w;A+=x)y.getRandomValues(C.subarray(A,A+Math.min(w-A,x)));for(A=0;A<w;A++)_[A]=C[A];Oi(C)})}else typeof require<"u"&&(y=require("crypto"),y&&y.randomBytes&&a.setPRNG(function(_,w){var A,C=y.randomBytes(w);for(A=0;A<w;A++)_[A]=C[A];Oi(C)}))})()})(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const ec=typeof module<"u"&&module.exports?module.exports:globalThis.nacl;ec.sign.keyPair.fromSeed,ec.sign.detached,ec.sign.detached.verify,ec.randomBytes;var Fp;(function(a){a.InvalidPrefixByte="nkeys: invalid prefix byte",a.InvalidKey="nkeys: invalid key",a.InvalidPublicKey="nkeys: invalid public key",a.InvalidSeedLen="nkeys: invalid seed length",a.InvalidSeed="nkeys: invalid seed",a.InvalidEncoding="nkeys: invalid encoded key",a.InvalidSignature="nkeys: signature verification failed",a.CannotSign="nkeys: cannot sign, no private key available",a.PublicKeyOnly="nkeys: no seed or private key available",a.InvalidChecksum="nkeys: invalid checksum",a.SerializationError="nkeys: serialization error",a.ApiError="nkeys: api error",a.ClearedPair="nkeys: pair is cleared"})(Fp||(Fp={}));var Zp;(function(a){a[a.Seed=144]="Seed",a[a.Private=120]="Private",a[a.Operator=112]="Operator",a[a.Server=104]="Server",a[a.Cluster=16]="Cluster",a[a.Account=0]="Account",a[a.User=160]="User"})(Zp||(Zp={}));function J_(a){return n=>{let i={};return a.forEach(l=>{const o=l(n)||{};i=Object.assign(i,o)}),i}}function Q_(){return()=>{}}function X_(a,n){return()=>{const i=typeof a=="function"?a():a,l=typeof n=="function"?n():n;return{user:i,pass:l}}}function $_(a){return()=>({auth_token:typeof a=="function"?a():a})}const N0=120*1e3,K_=2,C0=2*1e3;function F_(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:N0,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:1e3,reconnectTimeWait:C0,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function Z_(a){const n=[];return typeof a.authenticator=="function"&&n.push(a.authenticator),Array.isArray(a.authenticator)&&n.push(...a.authenticator),a.token&&n.push($_(a.token)),a.user&&n.push(X_(a.user,a.pass)),n.length===0?Q_():J_(n)}function I_(a){const n=`${nf}:${O0()}`;if(a=a||{servers:[n]},a.servers=a.servers||[],typeof a.servers=="string"&&(a.servers=[a.servers]),a.servers.length>0&&a.port)throw new re("port and servers options are mutually exclusive",I.InvalidOption);a.servers.length===0&&a.port&&(a.servers=[`${nf}:${a.port}`]),a.servers&&a.servers.length===0&&(a.servers=[n]);const i=xc(F_(),a);if(i.authenticator=Z_(i),["reconnectDelayHandler","authenticator"].forEach(l=>{if(i[l]&&typeof i[l]!="function")throw new re(`${l} option should be a function`,I.NotFunction)}),i.reconnectDelayHandler||(i.reconnectDelayHandler=()=>{let l=i.tls?i.reconnectJitterTLS:i.reconnectJitter;return l&&(l++,l=Math.floor(Math.random()*l)),i.reconnectTimeWait+l}),i.inboxPrefix)try{as(i.inboxPrefix)}catch(l){throw new re(l.message,I.ApiError)}if(i.resolve===void 0&&(i.resolve=typeof ff()=="function"),i.resolve&&typeof ff()!="function")throw new re("'resolve' is not supported on this client",I.InvalidOption);return i}function W_(a,n){const{proto:i,tls_required:l,tls_available:o}=a;if((i===void 0||i<1)&&n.noEcho)throw new re("noEcho",I.ServerOptionNotAvailable);const f=l||o||!1;if(n.tls&&!f)throw new re("tls",I.ServerOptionNotAvailable)}const e1=1024*32,t1=/^INFO\s+([^\r\n]+)\r\n/i,n1=xa(`PONG\r
38
+ `),Ip=xa(`PING\r
39
+ `);class s1{constructor(n,i,l){b(this,"echo");b(this,"no_responders");b(this,"protocol");b(this,"verbose");b(this,"pedantic");b(this,"jwt");b(this,"nkey");b(this,"sig");b(this,"user");b(this,"pass");b(this,"auth_token");b(this,"tls_required");b(this,"name");b(this,"lang");b(this,"version");b(this,"headers");this.protocol=1,this.version=n.version,this.lang=n.lang,this.echo=i.noEcho?!1:void 0,this.verbose=i.verbose,this.pedantic=i.pedantic,this.tls_required=i.tls?!0:void 0,this.name=i.name;const o=(i&&typeof i.authenticator=="function"?i.authenticator(l):{})||{};xc(this,o)}}class M0 extends _t{constructor(i,l,o={}){var d;super();b(this,"sid");b(this,"queue");b(this,"draining");b(this,"max");b(this,"subject");b(this,"drained");b(this,"protocol");b(this,"timer");b(this,"info");b(this,"cleanupFn");b(this,"closed");b(this,"requestSubject");xc(this,o),this.protocol=i,this.subject=l,this.draining=!1,this.noIterator=typeof o.callback=="function",this.closed=tt();const f=!((d=i.options)!=null&&d.noAsyncTraces);o.timeout&&(this.timer=dr(o.timeout,f),this.timer.then(()=>{this.timer=void 0}).catch(m=>{this.stop(m),this.noIterator&&this.callback(m,{})})),this.noIterator||this.iterClosed.then(()=>{this.closed.resolve(),this.unsubscribe()})}setPrePostHandlers(i){if(this.noIterator){const l=this.callback,o=i.ingestionFilterFn?i.ingestionFilterFn:()=>({ingest:!0,protocol:!1}),f=i.protocolFilterFn?i.protocolFilterFn:()=>!0,d=i.dispatchedFn?i.dispatchedFn:()=>{};this.callback=(m,v)=>{const{ingest:S}=o(v);S&&f(v)&&(l(m,v),d(v))}}else this.protocolFilterFn=i.protocolFilterFn,this.dispatchedFn=i.dispatchedFn}callback(i,l){this.cancelTimeout(),i?this.stop(i):this.push(l)}close(){if(!this.isClosed()){this.cancelTimeout();const i=()=>{if(this.stop(),this.cleanupFn)try{this.cleanupFn(this,this.info)}catch{}this.closed.resolve()};this.noIterator?i():this.push(i)}}unsubscribe(i){this.protocol.unsubscribe(this,i)}cancelTimeout(){this.timer&&(this.timer.cancel(),this.timer=void 0)}drain(){return this.protocol.isClosed()?Promise.reject(re.errorForCode(I.ConnectionClosed)):this.isClosed()?Promise.reject(re.errorForCode(I.SubClosed)):(this.drained||(this.draining=!0,this.protocol.unsub(this),this.drained=this.protocol.flush(tt()).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 i1{constructor(){b(this,"mux");b(this,"subs");b(this,"sidCounter");this.sidCounter=0,this.mux=null,this.subs=new Map}size(){return this.subs.size}add(n){return this.sidCounter++,n.sid=this.sidCounter,this.subs.set(n.sid,n),n}setMux(n){return this.mux=n,n}getMux(){return this.mux}get(n){return this.subs.get(n)}resub(n){return this.sidCounter++,this.subs.delete(n.sid),n.sid=this.sidCounter,this.subs.set(n.sid,n),n}all(){return Array.from(this.subs.values())}cancel(n){n&&(n.close(),this.subs.delete(n.sid))}handleError(n){if(n&&n.permissionContext){const i=n.permissionContext,l=this.all();let o;if(i.operation==="subscription"&&(o=l.find(f=>f.subject===i.subject&&f.queue===i.queue)),i.operation==="publish"&&(o=l.find(f=>f.requestSubject===i.subject)),o)return o.callback(n,{}),o.close(),this.subs.delete(o.sid),o!==this.mux}return!1}close(){this.subs.forEach(n=>{n.close()})}}class _c{constructor(n,i){b(this,"connected");b(this,"connectedOnce");b(this,"infoReceived");b(this,"info");b(this,"muxSubscriptions");b(this,"options");b(this,"outbound");b(this,"pongs");b(this,"subscriptions");b(this,"transport");b(this,"noMorePublishing");b(this,"connectError");b(this,"publisher");b(this,"_closed");b(this,"closed");b(this,"listeners");b(this,"heartbeats");b(this,"parser");b(this,"outMsgs");b(this,"inMsgs");b(this,"outBytes");b(this,"inBytes");b(this,"pendingLimit");b(this,"lastError");b(this,"abortReconnect");b(this,"whyClosed");b(this,"servers");b(this,"server");b(this,"features");b(this,"connectPromise");this._closed=!1,this.connected=!1,this.connectedOnce=!1,this.infoReceived=!1,this.noMorePublishing=!1,this.abortReconnect=!1,this.listeners=[],this.pendingLimit=e1,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=n,this.publisher=i,this.subscriptions=new i1,this.muxSubscriptions=new H_,this.outbound=new pr,this.pongs=[],this.whyClosed="",this.pendingLimit=n.pendingLimit||this.pendingLimit,this.features=new v_({major:0,minor:0,micro:0}),this.connectPromise=null;const l=typeof n.servers=="string"?[n.servers]:n.servers;this.servers=new L_(l,{randomize:!n.noRandomize}),this.closed=tt(),this.parser=new Kp(this),this.heartbeats=new G_(this,this.options.pingInterval||N0,this.options.maxPingOut||K_)}resetOutbound(){this.outbound.reset();const n=this.pongs;this.pongs=[];const i=re.errorForCode(I.Disconnect);i.stack="",n.forEach(l=>{l.reject(i)}),this.parser=new Kp(this),this.infoReceived=!1}dispatchStatus(n){this.listeners.forEach(i=>{i.push(n)})}status(){const n=new _t;return this.listeners.push(n),n}prepare(){this.transport&&this.transport.discard(),this.info=void 0,this.resetOutbound();const n=tt();return n.catch(()=>{}),this.pongs.unshift(n),this.connectError=i=>{n.reject(i)},this.transport=w_(),this.transport.closed().then(async i=>{if(this.connected=!1,!this.isClosed()){await this.disconnected(this.transport.closeError||this.lastError);return}}),n}disconnect(){this.dispatchStatus({type:cr.StaleConnection,data:""}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:cr.ClientInitiatedReconnect,data:""}),this.transport.disconnect()),Promise.resolve()}async disconnected(n){this.dispatchStatus({type:rs.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{var i;this.dispatchStatus({type:rs.Reconnect,data:this.servers.getCurrentServer().toString()}),((i=this.lastError)==null?void 0:i.code)===I.AuthenticationExpired&&(this.lastError=void 0)}).catch(i=>{this._close(i)}):await this._close(n)}async dial(n){const i=this.prepare();let l;try{l=dr(this.options.timeout||2e4);const o=this.transport.connect(n,this.options);await Promise.race([o,l]),(async()=>{try{for await(const f of this.transport)this.parser.parse(f)}catch(f){console.log("reader closed",f)}})().then()}catch(o){i.reject(o)}try{await Promise.race([l,i]),l&&l.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 l&&l.cancel(),await this.transport.close(o),o}}async _doDial(n){const{resolve:i}=this.options,l=await n.resolve({fn:ff(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:i});let o=null;for(const f of l)try{o=null,this.dispatchStatus({type:cr.Reconnecting,data:f.toString()}),await this.dial(f);return}catch(d){o=d}throw o}dialLoop(){return this.connectPromise===null&&(this.connectPromise=this.dodialLoop(),this.connectPromise.then(()=>{}).catch(()=>{}).finally(()=>{this.connectPromise=null})),this.connectPromise}async dodialLoop(){let n;for(;;){this._closed&&this.servers.clear();const i=this.options.reconnectDelayHandler?this.options.reconnectDelayHandler():C0;let l=i;const o=this.selectServer();if(!o||this.abortReconnect)throw n||(this.lastError?this.lastError:re.errorForCode(I.ConnectionRefused));const f=Date.now();if(o.lastConnect===0||o.lastConnect+i<=f){o.lastConnect=Date.now();try{await this._doDial(o);break}catch(d){if(n=d,!this.connectedOnce){if(this.options.waitOnFirstConnect)continue;this.servers.removeCurrentServer()}o.reconnects++;const m=this.options.maxReconnectAttempts||0;m!==-1&&o.reconnects>=m&&this.servers.removeCurrentServer()}}else l=Math.min(l,o.lastConnect+i-f),await br(l)}}static async connect(n,i){const l=new _c(n,i);return await l.dialLoop(),l}static toError(n){const i=n?n.toLowerCase():"";if(i.indexOf("permissions violation")!==-1){const l=new re(n,I.PermissionsViolation),o=n.match(/(Publish|Subscription) to "(\S+)"/);if(o){l.permissionContext={operation:o[1].toLowerCase(),subject:o[2],queue:void 0};const f=n.match(/using queue "(\S+)"/);f&&(l.permissionContext.queue=f[1])}return l}else return i.indexOf("authorization violation")!==-1?new re(n,I.AuthorizationViolation):i.indexOf("user authentication expired")!==-1?new re(n,I.AuthenticationExpired):i.indexOf("account authentication expired")!=-1?new re(n,I.AccountExpired):i.indexOf("authentication timeout")!==-1?new re(n,I.AuthenticationTimeout):new re(n,I.ProtocolError)}processMsg(n,i){if(this.inMsgs++,this.inBytes+=i.length,!this.subscriptions.sidCounter)return;const l=this.subscriptions.get(n.sid);l&&(l.received+=1,l.callback&&l.callback(null,new Nf(n,i,this)),l.max!==void 0&&l.received>=l.max&&l.unsubscribe())}processError(n){const i=zp(n),l=_c.toError(i),o={type:rs.Error,data:l.code};if(l.isPermissionError()){let f=!1;if(l.permissionContext){o.permissionContext=l.permissionContext;const d=this.subscriptions.getMux();f=(d==null?void 0:d.subject)===l.permissionContext.subject}this.subscriptions.handleError(l),this.muxSubscriptions.handleError(f,l),f&&this.subscriptions.setMux(null)}this.dispatchStatus(o),this.handleError(l)}handleError(n){n.isAuthError()?this.handleAuthError(n):n.isProtocolError()?this.lastError=n:n.isAuthTimeout()&&(this.lastError=n),n.isPermissionError()||(this.lastError=n)}handleAuthError(n){this.lastError&&n.code===this.lastError.code&&this.options.ignoreAuthErrorAbort===!1&&(this.abortReconnect=!0),this.connectError?this.connectError(n):this.disconnect()}processPing(){this.transport.send(n1)}processPong(){const n=this.pongs.shift();n&&n.resolve()}processInfo(n){const i=JSON.parse(zp(n));this.info=i;const l=this.options&&this.options.ignoreClusterUpdates?void 0:this.servers.update(i,this.transport.isEncrypted());if(!this.infoReceived){this.features.update(gi(i.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();const{version:f,lang:d}=this.transport;try{const m=new s1({version:f,lang:d},this.options,i.nonce);i.headers&&(m.headers=!0,m.no_responders=!0);const v=JSON.stringify(m);this.transport.send(xa(`CONNECT ${v}${rc}`)),this.transport.send(Ip)}catch(m){this._close(m)}}l&&this.dispatchStatus({type:rs.Update,data:l}),(i.ldm!==void 0?i.ldm:!1)&&this.dispatchStatus({type:rs.LDM,data:this.servers.getCurrentServer().toString()})}push(n){switch(n.kind){case kt.MSG:{const{msg:i,data:l}=n;this.processMsg(i,l);break}case kt.OK:break;case kt.ERR:this.processError(n.data);break;case kt.PING:this.processPing();break;case kt.PONG:this.processPong();break;case kt.INFO:this.processInfo(n.data);break}}sendCommand(n,...i){const l=this.outbound.length();let o;typeof n=="string"?o=xa(n):o=n,this.outbound.fill(o,...i),l===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(n,i=en,l){let o;if(i instanceof Uint8Array)o=i;else if(typeof i=="string")o=_i.encode(i);else throw re.errorForCode(I.BadPayload);let f=o.length;l=l||{},l.reply=l.reply||"";let d=en,m=0;if(l.headers){if(this.info&&!this.info.headers)throw new re("headers",I.ServerOptionNotAvailable);d=l.headers.encode(),m=d.length,f=o.length+m}if(this.info&&f>this.info.max_payload)throw re.errorForCode(I.MaxPayloadExceeded);this.outBytes+=f,this.outMsgs++;let v;l.headers?(l.reply?v=`HPUB ${n} ${l.reply} ${m} ${f}\r
40
+ `:v=`HPUB ${n} ${m} ${f}\r
41
+ `,this.sendCommand(v,d,o,bc)):(l.reply?v=`PUB ${n} ${l.reply} ${f}\r
42
+ `:v=`PUB ${n} ${f}\r
43
+ `,this.sendCommand(v,o,bc))}request(n){return this.initMux(),this.muxSubscriptions.add(n),n}subscribe(n){return this.subscriptions.add(n),this._subunsub(n),n}_sub(n){n.queue?this.sendCommand(`SUB ${n.subject} ${n.queue} ${n.sid}\r
44
+ `):this.sendCommand(`SUB ${n.subject} ${n.sid}\r
45
+ `)}_subunsub(n){return this._sub(n),n.max&&this.unsubscribe(n,n.max),n}unsubscribe(n,i){this.unsub(n,i),(n.max===void 0||n.received>=n.max)&&this.subscriptions.cancel(n)}unsub(n,i){!n||this.isClosed()||(i?this.sendCommand(`UNSUB ${n.sid} ${i}\r
46
+ `):this.sendCommand(`UNSUB ${n.sid}\r
47
+ `),n.max=i)}resub(n,i){!n||this.isClosed()||(this.unsub(n),n.subject=i,this.subscriptions.resub(n),this._sub(n))}flush(n){return n||(n=tt()),this.pongs.push(n),this.outbound.fill(Ip),this.flushPending(),n}sendSubscriptions(){const n=[];this.subscriptions.all().forEach(i=>{const l=i;l.queue?n.push(`SUB ${l.subject} ${l.queue} ${l.sid}${rc}`):n.push(`SUB ${l.subject} ${l.sid}${rc}`)}),n.length&&this.transport.send(xa(n.join("")))}async _close(n){this._closed||(this.whyClosed=new Error("close trace").stack||"",this.heartbeats.cancel(),this.connectError&&(this.connectError(n),this.connectError=void 0),this.muxSubscriptions.close(),this.subscriptions.close(),this.listeners.forEach(i=>{i.stop()}),this._closed=!0,await this.transport.close(n),await this.closed.resolve(n))}close(){return this._close()}isClosed(){return this._closed}drain(){const n=this.subscriptions.all(),i=[];return n.forEach(l=>{i.push(l.drain())}),Promise.all(i).then(async()=>(this.noMorePublishing=!0,await this.flush(),this.close())).catch(()=>{})}flushPending(){if(!(!this.infoReceived||!this.connected)&&this.outbound.size()){const n=this.outbound.drain();this.transport.send(n)}}initMux(){if(!this.subscriptions.getMux()){const i=this.muxSubscriptions.init(this.options.inboxPrefix),l=new M0(this,`${i}*`);l.callback=this.muxSubscriptions.dispatcher(),this.subscriptions.setMux(l),this.subscribe(l)}}selectServer(){const n=this.servers.selectServer();if(n!==void 0)return this.server=n,this.server}getServer(){return this.server}}const r1="$SRV";class Wp{constructor(n){b(this,"msg");this.msg=n}get data(){return this.msg.data}get sid(){return this.msg.sid}get subject(){return this.msg.subject}get reply(){return this.msg.reply||""}get headers(){return this.msg.headers}respond(n,i){return this.msg.respond(n,i)}respondError(n,i,l,o){var f,d;return o=o||{},o.headers=o.headers||ls(),(f=o.headers)==null||f.set(mc,`${n}`),(d=o.headers)==null||d.set(dc,i),this.msg.respond(l,o)}json(n){return this.msg.json(n)}string(){return this.msg.string()}}class Oa{constructor(n,i="",l=""){b(this,"subject");b(this,"queue");b(this,"srv");i!==""&&l1("service group",i);let o="";if(n instanceof Ca)this.srv=n,o="";else if(n instanceof Oa){const f=n;this.srv=f.srv,l===""&&f.queue!==""&&(l=f.queue),o=f.subject}else throw new Error("unknown ServiceGroup type");this.subject=this.calcSubject(o,i),this.queue=l}calcSubject(n,i=""){return i===""?n:n!==""?`${n}.${i}`:i}addEndpoint(n="",i){i=i||{subject:n};const l=typeof i=="function"?{handler:i,subject:n}:i;ba("endpoint",n);let{subject:o,handler:f,metadata:d,queue:m}=l;o=o||n,m=m||this.queue,a1("endpoint subject",o),o=this.calcSubject(this.subject,o);const v={name:n,subject:o,queue:m,handler:f,metadata:d};return this.srv._addEndpoint(v)}addGroup(n="",i=""){return new Oa(this,n,i)}}function a1(a,n){if(n==="")throw new Error(`${a} cannot be empty`);if(n.indexOf(" ")!==-1)throw new Error(`${a} cannot contain spaces: '${n}'`);const i=n.split(".");i.forEach((l,o)=>{if(l===">"&&o!==i.length-1)throw new Error(`${a} cannot have internal '>': '${n}'`)})}function l1(a,n){if(n.indexOf(" ")!==-1)throw new Error(`${a} cannot contain spaces: '${n}'`);n.split(".").forEach(l=>{if(l===">")throw new Error(`${a} name cannot contain internal '>': '${n}'`)})}class Ca{constructor(n,i={name:"",version:""}){b(this,"nc");b(this,"_id");b(this,"config");b(this,"handlers");b(this,"internal");b(this,"_stopped");b(this,"_done");b(this,"started");this.nc=n,this.config=Object.assign({},i),this.config.queue||(this.config.queue="q"),ba("name",this.config.name),ba("queue",this.config.queue),gi(this.config.version),this._id=Js.next(),this.internal=[],this._done=tt(),this._stopped=!1,this.handlers=[],this.started=new Date().toISOString(),this.reset(),this.nc.closed().then(()=>{this.close().catch()}).catch(l=>{this.close(l).catch()})}static controlSubject(n,i="",l="",o){const f=o??r1;return i===""&&l===""?`${f}.${n}`:(ba("control subject name",i),l!==""?(ba("control subject id",l),`${f}.${n}.${i}.${l}`):`${f}.${n}.${i}`)}get subjects(){return this.handlers.filter(n=>n.internal===!1).map(n=>n.subject)}get id(){return this._id}get name(){return this.config.name}get description(){return this.config.description??""}get version(){return this.config.version}get metadata(){return this.config.metadata}errorToHeader(n){const i=ls();if(n instanceof pc){const l=n;i.set(dc,l.message),i.set(mc,`${l.code}`)}else i.set(dc,n.message),i.set(mc,"500");return i}setupHandler(n,i=!1){const l=i?"":n.queue?n.queue:this.config.queue,{name:o,subject:f,handler:d}=n,m=n;m.internal=i,i&&this.internal.push(m),m.stats=new c1(o,f,l),m.queue=l;const v=d?(S,N)=>{if(S){this.close(S);return}const O=Date.now();try{d(S,new Wp(N))}catch(M){m.stats.countError(M),N==null||N.respond(en,{headers:this.errorToHeader(M)})}finally{m.stats.countLatency(O)}}:void 0;return m.sub=this.nc.subscribe(f,{callback:v,queue:l}),m.sub.closed.then(()=>{this._stopped||this.close(new Error(`required subscription ${n.subject} stopped`)).catch()}).catch(S=>{if(!this._stopped){const N=new Error(`required subscription ${n.subject} errored: ${S.message}`);N.stack=S.stack,this.close(N).catch()}}),m}info(){return{type:Sa.INFO,name:this.name,id:this.id,version:this.version,description:this.description,metadata:this.metadata,endpoints:this.endpoints()}}endpoints(){return this.handlers.map(n=>{const{subject:i,metadata:l,name:o,queue:f}=n;return{subject:i,metadata:l,name:o,queue_group:f}})}async stats(){const n=[];for(const i of this.handlers){if(typeof this.config.statsHandler=="function")try{i.stats.data=await this.config.statsHandler(i)}catch(l){i.stats.countError(l)}n.push(i.stats.stats(i.qi))}return{type:Sa.STATS,name:this.name,id:this.id,version:this.version,started:this.started,metadata:this.metadata,endpoints:n}}addInternalHandler(n,i){const l=`${n}`.toUpperCase();this._doAddInternalHandler(`${l}-all`,n,i),this._doAddInternalHandler(`${l}-kind`,n,i,this.name),this._doAddInternalHandler(`${l}`,n,i,this.name,this.id)}_doAddInternalHandler(n,i,l,o="",f=""){const d={};d.name=n,d.subject=Ca.controlSubject(i,o,f),d.handler=l,this.setupHandler(d,!0)}start(){const n=On(),i=(d,m)=>d?(this.close(d),Promise.reject(d)):this.stats().then(v=>(m==null||m.respond(n.encode(v)),Promise.resolve())),l=(d,m)=>d?(this.close(d),Promise.reject(d)):(m==null||m.respond(n.encode(this.info())),Promise.resolve()),o=n.encode(this.ping()),f=(d,m)=>d?(this.close(d).then().catch(),Promise.reject(d)):(m.respond(o),Promise.resolve());return this.addInternalHandler(Gs.PING,f),this.addInternalHandler(Gs.STATS,i),this.addInternalHandler(Gs.INFO,l),this.handlers.forEach(d=>{const{subject:m}=d;typeof m=="string"&&d.handler!==null&&this.setupHandler(d)}),Promise.resolve(this)}close(n){if(this._stopped)return this._done;this._stopped=!0;let i=[];return this.nc.isClosed()||(i=this.handlers.concat(this.internal).map(l=>l.sub.drain())),Promise.allSettled(i).then(()=>{this._done.resolve(n||null)}),this._done}get stopped(){return this._done}get isStopped(){return this._stopped}stop(n){return this.close(n)}ping(){return{type:Sa.PING,name:this.name,id:this.id,version:this.version,metadata:this.metadata}}reset(){if(this.started=new Date().toISOString(),this.handlers)for(const n of this.handlers)n.stats.reset(n.qi)}addGroup(n,i){return new Oa(this,n,i)}addEndpoint(n,i){return new Oa(this).addEndpoint(n,i)}_addEndpoint(n){const i=new _t;i.noIterator=typeof n.handler=="function",i.noIterator||(n.handler=(o,f)=>{o?this.stop(o).catch():i.push(new Wp(f))},i.iterClosed.then(()=>{this.close().catch()}));const l=this.setupHandler(n,!1);return l.qi=i,this.handlers.push(l),i}}class c1{constructor(n,i,l=""){b(this,"name");b(this,"subject");b(this,"average_processing_time");b(this,"num_requests");b(this,"processing_time");b(this,"num_errors");b(this,"last_error");b(this,"data");b(this,"metadata");b(this,"queue");this.name=n,this.subject=i,this.average_processing_time=0,this.num_errors=0,this.num_requests=0,this.processing_time=0,this.queue=l}reset(n){this.num_requests=0,this.processing_time=0,this.average_processing_time=0,this.num_errors=0,this.last_error=void 0,this.data=void 0;const i=n;i&&(i.time=0,i.processed=0)}countLatency(n){this.num_requests++,this.processing_time+=et(Date.now()-n),this.average_processing_time=Math.round(this.processing_time/this.num_requests)}countError(n){this.num_errors++,this.last_error=n.message}_stats(){const{name:n,subject:i,average_processing_time:l,num_errors:o,num_requests:f,processing_time:d,last_error:m,data:v,queue:S}=this;return{name:n,subject:i,average_processing_time:l,num_errors:o,num_requests:f,processing_time:d,last_error:m,data:v,queue_group:S}}stats(n){const i=n;return(i==null?void 0:i.noIterator)===!1&&(this.processing_time=et(i.time),this.num_requests=i.processed,this.average_processing_time=this.processing_time>0&&this.num_requests>0?this.processing_time/this.num_requests:0),this._stats()}}class o1{constructor(n,i={strategy:An.JitterTimer,maxWait:2e3},l){b(this,"nc");b(this,"prefix");b(this,"opts");this.nc=n,this.prefix=l,this.opts=i}ping(n="",i=""){return this.q(Gs.PING,n,i)}stats(n="",i=""){return this.q(Gs.STATS,n,i)}info(n="",i=""){return this.q(Gs.INFO,n,i)}async q(n,i="",l=""){const o=new _t,f=On(),d=Ca.controlSubject(n,i,l,this.prefix),m=await this.nc.requestMany(d,en,this.opts);return(async()=>{for await(const v of m)try{const S=f.decode(v.data);o.push(S)}catch(S){o.push(()=>{o.stop(S)})}o.push(()=>{o.stop()})})().catch(v=>{o.stop(v)}),o}}function k0(){return{key:{encode(a){return a},decode(a){return a}},value:{encode(a){return a},decode(a){return a}}}}function u1(){return{replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:k0(),storage:cf.File}}const vc="KV-Operation",e0="$KV",f1=/^[-/=.\w]+$/,h1=/^[-/=.>*\w]+$/,d1=/^[-\w]+$/;function m1(a){if(a.startsWith(".")||a.endsWith(".")||!f1.test(a))throw new Error(`invalid key: ${a}`)}function p1(a){if(a.startsWith(".")||a.endsWith(".")||!h1.test(a))throw new Error(`invalid key: ${a}`)}function y1(a){if(a.startsWith(".")||a.endsWith("."))throw new Error(`invalid key: ${a}`);const n=a.split(".");let i=!1;for(let l=0;l<n.length;l++)switch(n[l]){case"*":i=!0;break;case">":if(l!==n.length-1)throw new Error(`invalid key: ${a}`);i=!0;break}return i}function ac(a){if(!d1.test(a))throw new Error(`invalid bucket name: ${a}`)}var Rn;(function(a){a.MsgIdHdr="Nats-Msg-Id",a.ExpectedStreamHdr="Nats-Expected-Stream",a.ExpectedLastSeqHdr="Nats-Expected-Last-Sequence",a.ExpectedLastMsgIdHdr="Nats-Expected-Last-Msg-Id",a.ExpectedLastSubjectSequenceHdr="Nats-Expected-Last-Subject-Sequence"})(Rn||(Rn={}));class Ta{constructor(n,i,l){b(this,"js");b(this,"jsm");b(this,"stream");b(this,"bucket");b(this,"direct");b(this,"codec");b(this,"prefix");b(this,"editPrefix");b(this,"useJsPrefix");b(this,"_prefixLen");b(this,"validateKey",m1);b(this,"validateSearchKey",p1);b(this,"hasWildcards",y1);ac(n),this.js=i,this.jsm=l,this.bucket=n,this.prefix=e0,this.editPrefix="",this.useJsPrefix=!1,this._prefixLen=0}static async create(n,i,l={}){ac(i);const o=await n.jetstreamManager(),f=new Ta(i,n,o);return await f.init(l),f}static async bind(n,i,l={}){const o=await n.jetstreamManager(),f={config:{allow_direct:l.allow_direct}};ac(i);const d=new Ta(i,n,o);return f.config.name=l.streamName??d.bucketName(),Object.assign(d,f),d.stream=f.config.name,d.codec=l.codec||k0(),d.direct=f.config.allow_direct??!1,d.initializePrefixes(f),d}async init(n={}){const i=Object.assign(u1(),n);this.codec=i.codec;const l={};this.stream=l.name=n.streamName??this.bucketName(),l.retention=lf.Limits,l.max_msgs_per_subject=i.history,i.maxBucketSize&&(i.max_bytes=i.maxBucketSize),i.max_bytes&&(l.max_bytes=i.max_bytes),l.max_msg_size=i.maxValueSize,l.storage=i.storage;const o=n.placementCluster??"";if(o&&(n.placement={},n.placement.cluster=o,n.placement.tags=[]),n.placement&&(l.placement=n.placement),n.republish&&(l.republish=n.republish),n.description&&(l.description=n.description),n.mirror){const O=Object.assign({},n.mirror);O.name.startsWith(Zt)||(O.name=`${Zt}${O.name}`),l.mirror=O,l.mirror_direct=!0}else if(n.sources){const O=n.sources.map(M=>{const G=Object.assign({},M),$=G.name.startsWith(Zt)?G.name.substring(Zt.length):G.name;return G.name.startsWith(Zt)||(G.name=`${Zt}${G.name}`),!M.external&&$!==this.bucket&&(G.subject_transforms=[{src:`$KV.${$}.>`,dest:`$KV.${this.bucket}.>`}]),G});l.sources=O,l.subjects=[this.subjectForBucket()]}else l.subjects=[this.subjectForBucket()];n.metadata&&(l.metadata=n.metadata),typeof n.compression=="boolean"&&(l.compression=n.compression?Qs.S2:Qs.None);const f=this.js.nc,d=f.getServerVersion(),m=d?uf(d,gi("2.7.2"))>=0:!1;l.discard=m?Aa.New:Aa.Old;const{ok:v,min:S}=f.features.get(Re.JS_ALLOW_DIRECT);if(!v&&n.allow_direct===!0){const O=d?`${d.major}.${d.minor}.${d.micro}`:"unknown";return Promise.reject(new Error(`allow_direct is not available on server version ${O} - requires ${S}`))}n.allow_direct=typeof n.allow_direct=="boolean"?n.allow_direct:v,l.allow_direct=n.allow_direct,this.direct=l.allow_direct,l.num_replicas=i.replicas,i.ttl&&(l.max_age=et(i.ttl)),l.allow_rollup_hdrs=!0;let N;try{N=await this.jsm.streams.info(l.name),!N.config.allow_direct&&this.direct===!0&&(this.direct=!1)}catch(O){if(O.message==="stream not found")N=await this.jsm.streams.add(l);else throw O}this.initializePrefixes(N)}initializePrefixes(n){this._prefixLen=0,this.prefix=`$KV.${this.bucket}`,this.useJsPrefix=this.js.apiPrefix!=="$JS.API";const{mirror:i}=n.config;if(i){let l=i.name;if(l.startsWith(Zt)&&(l=l.substring(Zt.length)),i.external&&i.external.api!==""){const o=i.name.substring(Zt.length);this.useJsPrefix=!1,this.prefix=`$KV.${o}`,this.editPrefix=`${i.external.api}.$KV.${l}`}else this.editPrefix=this.prefix}}bucketName(){return this.stream??`${Zt}${this.bucket}`}subjectForBucket(){return`${this.prefix}.${this.bucket}.>`}subjectForKey(n,i=!1){const l=[];return i?(this.useJsPrefix&&l.push(this.js.apiPrefix),this.editPrefix!==""?l.push(this.editPrefix):l.push(this.prefix)):this.prefix&&l.push(this.prefix),l.push(n),l.join(".")}fullKeyName(n){return this.prefix!==""?`${this.prefix}.${n}`:`${e0}.${this.bucket}.${n}`}get prefixLen(){return this._prefixLen===0&&(this._prefixLen=this.prefix.length+1),this._prefixLen}encodeKey(n){const i=[];for(const l of n.split("."))switch(l){case">":case"*":i.push(l);break;default:i.push(this.codec.key.encode(l));break}return i.join(".")}decodeKey(n){const i=[];for(const l of n.split("."))switch(l){case">":case"*":i.push(l);break;default:i.push(this.codec.key.decode(l));break}return i.join(".")}close(){return Promise.resolve()}dataLen(n,i){const l=i&&i.get(Rt.MessageSizeHdr)||"";return l!==""?parseInt(l,10):n.length}smToEntry(n){return new M1(this.bucket,this.prefixLen,n)}jmToEntry(n){const i=this.decodeKey(n.subject.substring(this.prefixLen));return new k1(this.bucket,i,n)}async create(n,i){var f;let l;try{const d=await this.put(n,i,{previousSeq:0});return Promise.resolve(d)}catch(d){if(l=d,((f=d==null?void 0:d.api_error)==null?void 0:f.err_code)!==10071)return Promise.reject(d)}let o=0;try{const d=await this.get(n);return(d==null?void 0:d.operation)==="DEL"||(d==null?void 0:d.operation)==="PURGE"?(o=d!==null?d.revision:0,this.update(n,i,o)):Promise.reject(l)}catch(d){return Promise.reject(d)}}update(n,i,l){if(l<=0)throw new Error("version must be greater than 0");return this.put(n,i,{previousSeq:l})}async put(n,i,l={}){var d,m;const o=this.encodeKey(n);this.validateKey(o);const f={};if(l.previousSeq!==void 0){const v=ls();f.headers=v,v.set(Rn.ExpectedLastSubjectSequenceHdr,`${l.previousSeq}`)}try{return(await this.js.publish(this.subjectForKey(o,!0),i,f)).seq}catch(v){const S=v;return S.isJetStreamError()?(S.message=(d=S.api_error)==null?void 0:d.description,S.code=`${(m=S.api_error)==null?void 0:m.code}`,Promise.reject(S)):Promise.reject(v)}}async get(n,i){const l=this.encodeKey(n);this.validateKey(l);let o={last_by_subj:this.subjectForKey(l)};i&&i.revision>0&&(o={seq:i.revision});let f;try{this.direct?f=await this.jsm.direct.getMessage(this.bucketName(),o):f=await this.jsm.streams.getMessage(this.bucketName(),o);const d=this.smToEntry(f);return d.key!==l?null:d}catch(d){if(d.code===I.JetStream404NoMessages)return null;throw d}}purge(n,i){return this._deleteOrPurge(n,"PURGE",i)}delete(n,i){return this._deleteOrPurge(n,"DEL",i)}async purgeDeletes(n=1800*1e3){const i=tt(),l=[],o=await this.watch({key:">",initializedFn:()=>{i.resolve()}});(async()=>{for await(const v of o)(v.operation==="DEL"||v.operation==="PURGE")&&l.push(v)})().then(),await i,o.stop();const f=Date.now()-n,d=l.map(v=>{const S=this.subjectForKey(v.key);return v.created.getTime()>=f?this.jsm.streams.purge(this.stream,{filter:S,keep:1}):this.jsm.streams.purge(this.stream,{filter:S,keep:0})}),m=await Promise.all(d);return m.unshift({success:!0,purged:0}),m.reduce((v,S)=>(v.purged+=S.purged,v))}async _deleteOrPurge(n,i,l){if(!this.hasWildcards(n))return this._doDeleteOrPurge(n,i,l);const o=await this.keys(n),f=[];for await(const d of o)f.push(this._doDeleteOrPurge(d,i)),f.length===100&&(await Promise.all(f),f.length=0);f.length>0&&await Promise.all(f)}async _doDeleteOrPurge(n,i,l){const o=this.encodeKey(n);this.validateKey(o);const f=ls();f.set(vc,i),i==="PURGE"&&f.set(Rt.RollupHdr,Rt.RollupValueSubject),l!=null&&l.previousSeq&&f.set(Rn.ExpectedLastSubjectSequenceHdr,`${l.previousSeq}`),await this.js.publish(this.subjectForKey(o,!0),en,{headers:f})}_buildCC(n,i,l={}){let f=(Array.isArray(n)?n:[n]).map(v=>{const S=this.encodeKey(v);return this.validateSearchKey(v),this.fullKeyName(S)}),d=ot.LastPerSubject;i===wn.AllHistory&&(d=ot.All),i===wn.UpdatesOnly&&(d=ot.New);let m;return f.length===1&&(m=f[0],f=void 0),Object.assign({deliver_policy:d,ack_policy:bt.None,filter_subjects:f,filter_subject:m,flow_control:!0,idle_heartbeat:et(5*1e3)},l)}remove(n){return this.purge(n)}async history(n={}){const i=n.key??">",l=new _t,o={};o.headers_only=n.headers_only||!1;let f;f=()=>{l.stop()};let d=0;const m=this._buildCC(i,wn.AllHistory,o),v=m.filter_subject,S=Vs(m);S.bindStream(this.stream),S.orderedConsumer(),S.callback((O,M)=>{if(O){l.stop(O);return}if(M){const G=this.jmToEntry(M);l.push(G),l.received++,(f&&d>0&&l.received>=d||M.info.pending===0)&&(l.push(f),f=void 0)}});const N=await this.js.subscribe(v,S);if(f){const{info:{last:O}}=N,M=O.num_pending+O.delivered.consumer_seq;if(M===0||l.received>=M)try{f()}catch(G){l.stop(G)}finally{f=void 0}else d=M}return l._data=N,l.iterClosed.then(()=>{N.unsubscribe()}),N.closed.then(()=>{l.stop()}).catch(O=>{l.stop(O)}),l}canSetWatcherName(){const i=this.js.nc,{ok:l}=i.features.get(Re.JS_NEW_CONSUMER_CREATE_API);return l}async watch(n={}){const i=n.key??">",l=new _t,o={};o.headers_only=n.headers_only||!1;let f=wn.LastValue;n.include===wn.AllHistory?f=wn.AllHistory:n.include===wn.UpdatesOnly&&(f=wn.UpdatesOnly);const d=n.ignoreDeletes===!0;let m=n.initializedFn,v=0;const S=this._buildCC(i,f,o),N=S.filter_subject,O=Vs(S);this.canSetWatcherName()&&O.consumerName(Js.next()),O.bindStream(this.stream),n.resumeFromRevision&&n.resumeFromRevision>0&&O.startSequence(n.resumeFromRevision),O.orderedConsumer(),O.callback((G,$)=>{if(G){l.stop(G);return}if($){const W=this.jmToEntry($);if(d&&W.operation==="DEL")return;l.push(W),l.received++,m&&(v>0&&l.received>=v||$.info.pending===0)&&(l.push(m),m=void 0)}});const M=await this.js.subscribe(N,O);if(m){const{info:{last:G}}=M,$=G.num_pending+G.delivered.consumer_seq;if($===0||l.received>=$)try{m()}catch(W){l.stop(W)}finally{m=void 0}else v=$}return l._data=M,l.iterClosed.then(()=>{M.unsubscribe()}),M.closed.then(()=>{l.stop()}).catch(G=>{l.stop(G)}),l}async keys(n=">"){const i=new _t,l=this._buildCC(n,wn.LastValue,{headers_only:!0}),o=Array.isArray(n)?">":l.filter_subject,f=Vs(l);f.bindStream(this.stream),f.orderedConsumer();const d=await this.js.subscribe(o,f);return(async()=>{var v;for await(const S of d){const N=(v=S.headers)==null?void 0:v.get(vc);if(N!=="DEL"&&N!=="PURGE"){const O=this.decodeKey(S.subject.substring(this.prefixLen));i.push(O)}S.info.pending===0&&d.unsubscribe()}})().then(()=>{i.stop()}).catch(v=>{i.stop(v)}),d.info.last.num_pending===0&&d.unsubscribe(),i}purgeBucket(n){return this.jsm.streams.purge(this.bucketName(),n)}destroy(){return this.jsm.streams.delete(this.bucketName())}async status(){var f;const i=((f=this.js.nc.info)==null?void 0:f.cluster)??"",l=this.bucketName(),o=await this.jsm.streams.info(l);return new R0(o,i)}}class R0{constructor(n,i=""){b(this,"si");b(this,"cluster");this.si=n,this.cluster=i}get bucket(){return this.si.config.name.startsWith(Zt)?this.si.config.name.substring(Zt.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 jf(this.si.config.max_age)}get bucket_location(){return this.cluster}get backingStore(){return this.si.config.storage}get storage(){return this.si.config.storage}get replicas(){return this.si.config.num_replicas}get description(){return this.si.config.description??""}get maxBucketSize(){return this.si.config.max_bytes}get maxValueSize(){return this.si.config.max_msg_size}get max_bytes(){return this.si.config.max_bytes}get placement(){return this.si.config.placement||{cluster:"",tags:[]}}get placementCluster(){var n;return((n=this.si.config.placement)==null?void 0:n.cluster)??""}get republish(){return this.si.config.republish??{src:"",dest:""}}get streamInfo(){return this.si}get size(){return this.si.state.bytes}get metadata(){return this.si.config.metadata??{}}get compression(){return this.si.config.compression?this.si.config.compression!==Qs.None:!1}}const Mf="OBJ_",t0="SHA-256=";function g1(a){return ac(a),`${Mf}${a}`}function b1(a){return a.startsWith(Mf)?a.substring(4):a}class mf{constructor(n){b(this,"si");b(this,"backingStore");this.si=n,this.backingStore="JetStream"}get bucket(){return b1(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!==Qs.None:!1}}function tc(a){if(a===void 0)return;const{domain:n}=a;if(n===void 0)return a;const i=Object.assign({},a);if(delete i.domain,n==="")return i;if(i.external)throw new Error("domain and external are both set");return i.external={api:`$JS.${n}.API`},i}var mn;(function(a){a[a.Unset=-1]="Unset",a[a.Consume=0]="Consume",a[a.Fetch=1]="Fetch"})(mn||(mn={}));var zn;(function(a){a.HeartbeatsMissed="heartbeats_missed",a.ConsumerNotFound="consumer_not_found",a.StreamNotFound="stream_not_found",a.ConsumerDeleted="consumer_deleted",a.OrderedConsumerRecreated="ordered_consumer_recreated",a.NoResponders="no_responders"})(zn||(zn={}));var hr;(function(a){a.DebugEvent="debug",a.Discard="discard",a.Reset="reset",a.Next="next"})(hr||(hr={}));const n0=Uint8Array.of(43,65,67,75),_1=Uint8Array.of(45,78,65,75),ya=Uint8Array.of(43,87,80,73),v1=Uint8Array.of(43,78,88,84),x1=Uint8Array.of(43,84,69,82,77),S1=Uint8Array.of(32);function ja(a,n=5e3){return new L1(a,n)}class Ku extends _t{constructor(i,l,o=!1){super();b(this,"consumer");b(this,"opts");b(this,"sub");b(this,"monitor");b(this,"pending");b(this,"inbox");b(this,"refilling");b(this,"pong");b(this,"callback");b(this,"timeout");b(this,"cleanupHandler");b(this,"listeners");b(this,"statusIterator");b(this,"forOrderedConsumer");b(this,"resetHandler");b(this,"abortOnMissingResource");b(this,"bind");b(this,"inBackOff");this.consumer=i;const f=l;this.opts=this.parseOptions(l,o),this.callback=f.callback||null,this.noIterator=typeof this.callback=="function",this.monitor=null,this.pong=null,this.pending={msgs:0,bytes:0,requests:0},this.refilling=o,this.timeout=null,this.inbox=as(i.api.nc.options.inboxPrefix),this.listeners=[],this.forOrderedConsumer=!1,this.abortOnMissingResource=f.abort_on_missing_resource===!0,this.bind=f.bind===!0,this.inBackOff=!1,this.start()}start(){const{max_messages:i,max_bytes:l,idle_heartbeat:o,threshold_bytes:f,threshold_messages:d}=this.opts;this.closed().then(v=>{if(this.cleanupHandler)try{this.cleanupHandler(v)}catch{}});const{sub:m}=this;m&&m.unsubscribe(),this.sub=this.consumer.api.nc.subscribe(this.inbox,{callback:(v,S)=>{var O,M,G,$;if(v){this.stop(v);return}if((O=this.monitor)==null||O.work(),S.subject===this.inbox){if(af(S))return;const W=(M=S.headers)==null?void 0:M.code,de=(($=(G=S.headers)==null?void 0:G.description)==null?void 0:$.toLowerCase())||"unknown",{msgsLeft:ye,bytesLeft:ie}=this.parseDiscard(S.headers);if(ye>0||ie>0)this.pending.msgs-=ye,this.pending.bytes-=ie,this.pending.requests--,this.notify(hr.Discard,{msgsLeft:ye,bytesLeft:ie});else if(W===400){this.stop(new re(de,`${W}`));return}else if(W===409&&de==="consumer deleted"){if(this.notify(zn.ConsumerDeleted,`${W} ${de}`),!this.refilling||this.abortOnMissingResource){const be=new re(de,`${W}`);this.stop(be);return}}else if(W===503){if(this.notify(zn.NoResponders,`${W} No Responders`),!this.refilling||this.abortOnMissingResource){const be=new re("no responders",`${W}`);this.stop(be);return}}else this.notify(hr.DebugEvent,`${W} ${de}`)}else this._push(ja(S,this.consumer.api.timeout)),this.received++,this.pending.msgs&&this.pending.msgs--,this.pending.bytes&&(this.pending.bytes-=S.size());if(this.pending.msgs===0&&this.pending.bytes===0&&(this.pending.requests=0),this.refilling){if(i&&this.pending.msgs<=d||l&&this.pending.bytes<=f){const W=this.pullOptions();this.pull(W)}}else this.pending.requests===0&&this._push(()=>{this.stop()})}}),this.sub.closed.then(()=>{this.sub.draining&&this._push(()=>{this.stop()})}),o&&(this.monitor=new Cf(o,v=>(this.notify(zn.HeartbeatsMissed,v),this.resetPending().then(()=>{}).catch(()=>{}),!1),{maxOut:2})),(async()=>{var S;const v=this.consumer.api.nc.status();this.statusIterator=v;for await(const N of v)switch(N.type){case rs.Disconnect:(S=this.monitor)==null||S.cancel();break;case rs.Reconnect:this.resetPending().then(O=>{var M;O&&((M=this.monitor)==null||M.restart())}).catch(()=>{});break}})(),this.pull(this.pullOptions())}_push(i){if(!this.callback)super.push(i);else{const l=typeof i=="function"?i:null;try{l?l():this.callback(i)}catch(o){this.stop(o)}}}notify(i,l){this.listeners.length>0&&this.listeners.forEach(o=>{o.done||o.push({type:i,data:l})})}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 i=0,l=0;const o=Tf([this.opts.expires]);let f=0;for(;;){if(this.done)return!1;if(this.consumer.api.nc.isClosed())return console.error("aborting resetPending - connection is closed"),!1;try{return await this.consumer.info(),this.inBackOff=!1,i=0,this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),!0}catch(d){if(d.message==="stream not found"){if(l++,this.notify(zn.StreamNotFound,l),!this.refilling||this.abortOnMissingResource)return this.stop(d),!1}else if(d.message==="consumer not found"){if(i++,this.notify(zn.ConsumerNotFound,i),this.resetHandler)try{this.resetHandler()}catch{}if(!this.refilling||this.abortOnMissingResource)return this.stop(d),!1;if(this.forOrderedConsumer)return!1}else i=0,l=0;this.inBackOff=!0;const m=o.backoff(f),v=br(m);await Promise.race([v,this.consumer.api.nc.closed()]),v.cancel(),f++}}}pull(i){this.pending.bytes+=i.max_bytes??0,this.pending.msgs+=i.batch??0,this.pending.requests++;const l=this.consumer.api.nc;this._push(()=>{l.publish(`${this.consumer.api.prefix}.CONSUMER.MSG.NEXT.${this.consumer.stream}.${this.consumer.name}`,this.consumer.api.jc.encode(i),{reply:this.inbox}),this.notify(hr.Next,i)})}pullOptions(){const i=this.opts.max_messages-this.pending.msgs,l=this.opts.max_bytes-this.pending.bytes,o=et(this.opts.idle_heartbeat),f=et(this.opts.expires);return{batch:i,max_bytes:l,idle_heartbeat:o,expires:f}}parseDiscard(i){const l={msgsLeft:0,bytesLeft:0},o=i==null?void 0:i.get(Rt.PendingMessagesHdr);o&&(l.msgsLeft=parseInt(o));const f=i==null?void 0:i.get(Rt.PendingBytesHdr);return f&&(l.bytesLeft=parseInt(f)),l}trackTimeout(i){this.timeout=i}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}clearTimers(){var i,l;(i=this.monitor)==null||i.cancel(),this.monitor=null,(l=this.timeout)==null||l.cancel(),this.timeout=null}setCleanupHandler(i){this.cleanupHandler=i}stop(i){var l,o;this.done||((l=this.sub)==null||l.unsubscribe(),this.clearTimers(),(o=this.statusIterator)==null||o.stop(),this._push(()=>{super.stop(i),this.listeners.forEach(f=>{f.stop()})}))}parseOptions(i,l=!1){const o=i||{};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,l){const f=Math.round(o.max_messages*.75)||1;o.threshold_messages=o.threshold_messages||f;const d=Math.round(o.max_bytes*.75)||1;o.threshold_bytes=o.threshold_bytes||d}return o}status(){const i=new _t;return this.listeners.push(i),Promise.resolve(i)}}class w1 extends _t{constructor(){super();b(this,"src");b(this,"listeners");this.listeners=[]}setSource(i){this.src&&(this.src.resetHandler=void 0,this.src.setCleanupHandler(),this.src.stop()),this.src=i,this.src.setCleanupHandler(l=>{this.stop(l||void 0)}),(async()=>{const l=await this.src.status();for await(const o of l)this.notify(o.type,o.data)})().catch(()=>{})}notify(i,l){this.listeners.length>0&&this.listeners.forEach(o=>{o.done||o.push({type:i,data:l})})}stop(i){var l;this.done||((l=this.src)==null||l.stop(i),super.stop(i),this.listeners.forEach(o=>{o.stop()}))}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}status(){const i=new _t;return this.listeners.push(i),Promise.resolve(i)}}class pf{constructor(n,i){b(this,"api");b(this,"_info");b(this,"stream");b(this,"name");this.api=n,this._info=i,this.stream=i.stream_name,this.name=i.name}consume(n={max_messages:100,expires:3e4}){return Promise.resolve(new Ku(this,n,!0))}fetch(n={max_messages:100,expires:3e4}){const i=new Ku(this,n,!1),l=Math.round(i.opts.expires*1.05),o=dr(l);return i.closed().catch(()=>{}).finally(()=>{o.cancel()}),o.catch(()=>{i.close().catch()}),i.trackTimeout(o),Promise.resolve(i)}next(n={expires:3e4}){const i=tt(),l=n;l.max_messages=1;const o=new Ku(this,l,!1),f=Math.round(o.opts.expires*1.05);f>=6e4&&(async()=>{for await(const m of await o.status())if(m.type===zn.HeartbeatsMissed&&m.data>=2){i.reject(new Error("consumer missed heartbeats"));break}})().catch(),(async()=>{for await(const m of o){i.resolve(m);break}})().catch(()=>{});const d=dr(f);return o.closed().then(m=>{m?i.reject(m):i.resolve(null)}).catch(m=>{i.reject(m)}).finally(()=>{d.cancel()}),d.catch(m=>{i.resolve(null),o.close().catch()}),o.trackTimeout(d),i}delete(){const{stream_name:n,name:i}=this._info;return this.api.delete(n,i)}info(n=!1){if(n)return Promise.resolve(this._info);const{stream_name:i,name:l}=this._info;return this.api.info(i,l).then(o=>(this._info=o,this._info))}}class E1{constructor(n,i,l={}){b(this,"api");b(this,"consumerOpts");b(this,"consumer");b(this,"opts");b(this,"cursor");b(this,"stream");b(this,"namePrefix");b(this,"serial");b(this,"currentConsumer");b(this,"userCallback");b(this,"iter");b(this,"type");b(this,"startSeq");b(this,"maxInitialReset");this.api=n,this.stream=i,this.cursor={stream_seq:1,deliver_seq:0},this.namePrefix=Js.next(),typeof l.name_prefix=="string"&&(Sc("name_prefix",l.name_prefix),this.namePrefix=l.name_prefix+this.namePrefix),this.serial=0,this.currentConsumer=null,this.userCallback=null,this.iter=null,this.type=mn.Unset,this.consumerOpts=l,this.maxInitialReset=30,this.startSeq=this.consumerOpts.opt_start_seq||0,this.cursor.stream_seq=this.startSeq>0?this.startSeq-1:0}getConsumerOpts(n){this.serial++;const i=`${this.namePrefix}_${this.serial}`;n=n===0?1:n;const l={name:i,deliver_policy:ot.StartSequence,opt_start_seq:n,ack_policy:bt.None,inactive_threshold:et(300*1e3),num_replicas:1};return this.consumerOpts.headers_only===!0&&(l.headers_only=!0),Array.isArray(this.consumerOpts.filterSubjects)&&(l.filter_subjects=this.consumerOpts.filterSubjects),typeof this.consumerOpts.filterSubjects=="string"&&(l.filter_subject=this.consumerOpts.filterSubjects),this.consumerOpts.replay_policy&&(l.replay_policy=this.consumerOpts.replay_policy),n===this.startSeq+1&&(l.deliver_policy=this.consumerOpts.deliver_policy||ot.StartSequence,(this.consumerOpts.deliver_policy===ot.LastPerSubject||this.consumerOpts.deliver_policy===ot.New||this.consumerOpts.deliver_policy===ot.Last)&&(delete l.opt_start_seq,l.deliver_policy=this.consumerOpts.deliver_policy),l.deliver_policy===ot.LastPerSubject&&typeof l.filter_subjects>"u"&&typeof l.filter_subject>"u"&&(l.filter_subject=">"),this.consumerOpts.opt_start_time&&(delete l.opt_start_seq,l.deliver_policy=ot.StartTime,l.opt_start_time=this.consumerOpts.opt_start_time),this.consumerOpts.inactive_threshold&&(l.inactive_threshold=et(this.consumerOpts.inactive_threshold))),l}async resetConsumer(n=0){var d,m,v,S,N;Js.next();const i=this.serial===0;(d=this.consumer)==null||d.delete().catch(()=>{}),n=n===0?1:n,this.cursor.deliver_seq=0;const l=this.getConsumerOpts(n);l.max_deliver=1,l.mem_storage=!0;const o=Tf([((m=this.opts)==null?void 0:m.expires)||3e4]);let f;for(let O=0;;O++)try{f=await this.api.add(this.stream,l),(v=this.iter)==null||v.notify(zn.OrderedConsumerRecreated,f.name);break}catch(M){if(M.message==="stream not found"&&((S=this.iter)==null||S.notify(zn.StreamNotFound,O),this.type===mn.Fetch||this.opts.abort_on_missing_resource===!0))return(N=this.iter)==null||N.stop(M),Promise.reject(M);if(i&&O>=this.maxInitialReset)throw M;await br(o.backoff(O+1))}return f}internalHandler(n){return i=>{var o;if(this.serial!==n)return;const l=i.info.deliverySequence;if(l!==this.cursor.deliver_seq+1){this.notifyOrderedResetAndReset();return}this.cursor.deliver_seq=l,this.cursor.stream_seq=i.info.streamSequence,this.userCallback?this.userCallback(i):(o=this.iter)==null||o.push(i)}}async reset(n={max_messages:100,expires:3e4},i){var v,S;i=i||{};const l=i.fromFetch||!1,o=i.orderedReset||!1;if(this.type===mn.Fetch&&o){(v=this.iter)==null||v.src.stop(),await((S=this.iter)==null?void 0:S.closed()),this.currentConsumer=null;return}(this.currentConsumer===null||o)&&(this.currentConsumer=await this.resetConsumer(this.cursor.stream_seq+1)),(this.iter===null||l)&&(this.iter=new w1),this.consumer=new pf(this.api,this.currentConsumer);const f=n;f.callback=this.internalHandler(this.serial);let d=null;this.type===mn.Fetch&&l?d=await this.consumer.fetch(n):this.type===mn.Consume&&(d=await this.consumer.consume(n));const m=d;m.forOrderedConsumer=!0,m.resetHandler=()=>{this.notifyOrderedResetAndReset()},this.iter.setSource(m)}notifyOrderedResetAndReset(){var n;(n=this.iter)==null||n.notify(hr.Reset,""),this.reset(this.opts,{orderedReset:!0})}async consume(n={max_messages:100,expires:3e4}){if(n.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===mn.Fetch)return Promise.reject(new Error("ordered consumer initialized as fetch"));if(this.type===mn.Consume)return Promise.reject(new Error("ordered consumer doesn't support concurrent consume"));const{callback:l}=n;return l&&(this.userCallback=l),this.type=mn.Consume,this.opts=n,await this.reset(n),this.iter}async fetch(n={max_messages:100,expires:3e4}){var o;if(n.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===mn.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:l}=n;return l&&(this.userCallback=l),this.type=mn.Fetch,this.opts=n,await this.reset(n,{fromFetch:!0}),this.iter}async next(n={expires:3e4}){const i=n;if(i.bind)return Promise.reject(new Error("bind is not supported"));i.max_messages=1;const l=tt();return i.callback=f=>{this.userCallback=null,l.resolve(f)},(await this.fetch(i)).iterClosed.then(f=>{f&&l.reject(f),l.resolve(null)}).catch(f=>{l.reject(f)}),l}delete(){return this.currentConsumer?this.api.delete(this.stream,this.currentConsumer.name).then(n=>Promise.resolve(n)).catch(n=>Promise.reject(n)).finally(()=>{this.currentConsumer=null}):Promise.resolve(!1)}async info(n){return this.currentConsumer==null?(this.currentConsumer=await this.resetConsumer(this.startSeq),Promise.resolve(this.currentConsumer)):n&&this.currentConsumer?Promise.resolve(this.currentConsumer):this.api.info(this.stream,this.currentConsumer.name)}}class yf{constructor(n){b(this,"api");b(this,"notified");this.api=n,this.notified=!1}checkVersion(){const n=this.api.nc.features.get(Re.JS_SIMPLIFICATION);return n.ok?Promise.resolve():Promise.reject(new Error(`consumers framework is only supported on servers ${n.min} or better`))}getPullConsumerFor(n){if(n.config.deliver_subject!==void 0)throw new Error("push consumer not supported");return new pf(this.api,n)}async get(n,i={}){return typeof i=="object"?this.ordered(n,i):(await this.checkVersion(),this.api.info(n,i).then(l=>l.config.deliver_subject!==void 0?Promise.reject(new Error("push consumer not supported")):new pf(this.api,l)).catch(l=>Promise.reject(l)))}async ordered(n,i){await this.checkVersion();const l=this.api;return new kf(l.nc,l.opts).info(n).then(f=>Promise.resolve(new E1(this.api,n,i))).catch(f=>Promise.reject(f))}}class Ec{constructor(n,i){b(this,"api");b(this,"_info");this.api=n,this._info=i}get name(){return this._info.config.name}alternates(){return this.info().then(n=>n.alternates?n.alternates:[])}async best(){if(await this.info(),this._info.alternates){const n=await this.api.info(this._info.alternates[0].name);return new Ec(this.api,n)}else return this}info(n=!1,i){return n?Promise.resolve(this._info):this.api.info(this.name,i).then(l=>(this._info=l,this._info))}getConsumerFromInfo(n){return new yf(new gc(this.api.nc,this.api.opts)).getPullConsumerFor(n)}getConsumer(n){return new yf(new gc(this.api.nc,this.api.opts)).get(this.name,n)}getMessage(n){return this.api.getMessage(this.name,n)}deleteMessage(n,i){return this.api.deleteMessage(this.name,n,i)}}class kf extends Na{constructor(n,i){super(n,i)}checkStreamConfigVersions(n){const i=this.nc;if(n.metadata){const{min:o,ok:f}=i.features.get(Re.JS_STREAM_CONSUMER_METADATA);if(!f)throw new Error(`stream 'metadata' requires server ${o}`)}if(n.first_seq){const{min:o,ok:f}=i.features.get(Re.JS_STREAM_FIRST_SEQ);if(!f)throw new Error(`stream 'first_seq' requires server ${o}`)}if(n.subject_transform){const{min:o,ok:f}=i.features.get(Re.JS_STREAM_SUBJECT_TRANSFORM);if(!f)throw new Error(`stream 'subject_transform' requires server ${o}`)}if(n.compression){const{min:o,ok:f}=i.features.get(Re.JS_STREAM_COMPRESSION);if(!f)throw new Error(`stream 'compression' requires server ${o}`)}if(n.consumer_limits){const{min:o,ok:f}=i.features.get(Re.JS_DEFAULT_CONSUMER_LIMITS);if(!f)throw new Error(`stream 'consumer_limits' requires server ${o}`)}function l(o,f){var m;if((((m=f==null?void 0:f.subject_transforms)==null?void 0:m.length)||0)>0){const{min:v,ok:S}=i.features.get(Re.JS_STREAM_SOURCE_SUBJECT_TRANSFORM);if(!S)throw new Error(`${o} 'subject_transforms' requires server ${v}`)}}n.sources&&n.sources.forEach(o=>{l("stream sources",o)}),n.mirror&&l("stream mirror",n.mirror)}async add(n={}){var o;this.checkStreamConfigVersions(n),Mt(n.name),n.mirror=tc(n.mirror),n.sources=(o=n.sources)==null?void 0:o.map(tc);const l=await this._request(`${this.prefix}.STREAM.CREATE.${n.name}`,n);return this._fixInfo(l),l}async delete(n){return Mt(n),(await this._request(`${this.prefix}.STREAM.DELETE.${n}`)).success}async update(n,i={}){var m;if(typeof n=="object"){const v=n;n=v.name,i=v,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(i),Mt(n);const l=await this.info(n),o=Object.assign(l.config,i);o.mirror=tc(o.mirror),o.sources=(m=o.sources)==null?void 0:m.map(tc);const d=await this._request(`${this.prefix}.STREAM.UPDATE.${n}`,o);return this._fixInfo(d),d}async info(n,i){Mt(n);const l=`${this.prefix}.STREAM.INFO.${n}`;let f=await this._request(l,i),{total:d,limit:m}=f,v=f.state.subjects?Object.getOwnPropertyNames(f.state.subjects).length:1;if(d&&d>v){const S=[f],N=i||{};let O=0;for(;d>v;){O++,N.offset=m*O;const G=await this._request(l,N);d=G.total,S.push(G);const $=Object.getOwnPropertyNames(G.state.subjects).length;if(v+=$,$<m)break}let M={};for(let G=0;G<S.length;G++)f=S[G],f.state.subjects&&(M=Object.assign(M,f.state.subjects));f.offset=0,f.total=0,f.limit=0,f.state.subjects=M}return this._fixInfo(f),f}list(n=""){const i=n!=null&&n.length?{subject:n}:{},l=f=>{const d=f;return d.streams.forEach(m=>{this._fixInfo(m)}),d.streams},o=`${this.prefix}.STREAM.LIST`;return new _a(o,l,this,i)}_fixInfo(n){n.config.sealed=n.config.sealed||!1,n.config.deny_delete=n.config.deny_delete||!1,n.config.deny_purge=n.config.deny_purge||!1,n.config.allow_rollup_hdrs=n.config.allow_rollup_hdrs||!1}async purge(n,i){if(i){const{keep:o,seq:f}=i;if(typeof o=="number"&&typeof f=="number")throw new Error("can specify one of keep or seq")}return Mt(n),await this._request(`${this.prefix}.STREAM.PURGE.${n}`,i)}async deleteMessage(n,i,l=!0){Mt(n);const o={seq:i};return l||(o.no_erase=!0),(await this._request(`${this.prefix}.STREAM.MSG.DELETE.${n}`,o)).success}async getMessage(n,i){Mt(n);const o=await this._request(`${this.prefix}.STREAM.MSG.GET.${n}`,i);return new z0(o)}find(n){return this.findStream(n)}listKvs(){const n=l=>{var v;const f=l.streams.filter(S=>S.config.name.startsWith(Zt));f.forEach(S=>{this._fixInfo(S)});let d="";return f.length&&(d=((v=this.nc.info)==null?void 0:v.cluster)??""),f.map(S=>new R0(S,d))},i=`${this.prefix}.STREAM.LIST`;return new _a(i,n,this)}listObjectStores(){const n=l=>{const f=l.streams.filter(m=>m.config.name.startsWith(Mf));return f.forEach(m=>{this._fixInfo(m)}),f.map(m=>new mf(m))},i=`${this.prefix}.STREAM.LIST`;return new _a(i,n,this)}names(n=""){const i=n!=null&&n.length?{subject:n}:{},l=f=>f.streams,o=`${this.prefix}.STREAM.NAMES`;return new _a(o,l,this,i)}async get(n){const i=await this.info(n);return Promise.resolve(new Ec(this,i))}}class A1 extends Na{constructor(n,i){super(n,i)}async getMessage(n,i){Mt(n);let l=i;const{last_by_subj:o}=l;o&&(l=null);const f=l?this.jc.encode(l):en,d=this.opts.apiPrefix||"$JS.API",m=o?`${d}.DIRECT.GET.${n}.${o}`:`${d}.DIRECT.GET.${n}`,v=await this.nc.request(m,f,{timeout:this.timeout}),S=ur(v);if(S)return Promise.reject(S);const N=new gf(v);return Promise.resolve(N)}async getBatch(n,i){Mt(n);const o=`${this.opts.apiPrefix||"$JS.API"}.DIRECT.GET.${n}`;if(!Array.isArray(i.multi_last)||i.multi_last.length===0)return Promise.reject("multi_last is required");const f=JSON.stringify(i,(v,S)=>v==="up_to_time"&&S instanceof Date?S.toISOString():S),d=new _t,m=await this.nc.requestMany(o,f,{strategy:An.SentinelMsg});return(async()=>{var O,M,G;let v=!1,S=!1,N;for await(const $ of m){if(!v){v=!0;const W=((O=$.headers)==null?void 0:O.code)||0;if(W!==0&&W<200||W>299){N=(M=$.headers)==null?void 0:M.description.toLowerCase();break}if(((G=$.headers)==null?void 0:G.get("Nats-Num-Pending"))===""){S=!0;break}}if($.data.length===0)break;d.push(new gf($))}d.push(()=>{if(S)throw new Error("batch direct get not supported by the server");if(N)throw new Error(`bad request: ${N}`);d.stop()})})(),Promise.resolve(d)}}class gf{constructor(n){b(this,"data");b(this,"header");if(!n.headers)throw new Error("headers expected");this.data=n.data,this.header=n.headers}get subject(){return this.header.last(lr.Subject)}get seq(){const n=this.header.last(lr.Sequence);return typeof n=="string"?parseInt(n):0}get time(){return new Date(Date.parse(this.timestamp))}get timestamp(){return this.header.last(lr.TimeStamp)}get stream(){return this.header.last(lr.Stream)}json(n){return On(n).decode(this.data)}string(){return It.decode(this.data)}}b(gf,"jc");class O1 extends Na{constructor(i,l){super(i,l);b(this,"streams");b(this,"consumers");b(this,"direct");this.streams=new kf(i,l),this.consumers=new gc(i,l),this.direct=new A1(i,l)}async getAccountInfo(){return await this._request(`${this.prefix}.INFO`)}jetstream(){return this.nc.jetstream(this.getOptions())}advisories(){const i=new _t;return this.nc.subscribe("$JS.EVENT.ADVISORY.>",{callback:(l,o)=>{if(l)throw l;try{const f=this.parseJsResponse(o),d=f.type.split("."),m=d[d.length-1];i.push({kind:m,data:f})}catch(f){i.stop(f)}}}),i}}class z0{constructor(n){b(this,"_header");b(this,"smr");this.smr=n}get subject(){return this.smr.message.subject}get seq(){return this.smr.message.seq}get timestamp(){return this.smr.message.time}get time(){return new Date(Date.parse(this.timestamp))}get data(){return this.smr.message.data?this._parse(this.smr.message.data):en}get header(){if(!this._header)if(this.smr.message.hdrs){const n=this._parse(this.smr.message.hdrs);this._header=Ys.decode(n)}else this._header=ls();return this._header}_parse(n){const i=atob(n),l=i.length,o=new Uint8Array(l);for(let f=0;f<l;f++)o[f]=i.charCodeAt(f);return o}json(n){return On(n).decode(this.data)}string(){return It.decode(this.data)}}b(z0,"jc");class T1{constructor(n){b(this,"api");this.api=n}get(n){return this.api.info(n).then(i=>new Ec(this.api,i))}}class Fu{constructor(n){b(this,"info");b(this,"hdrs");this.info=n}get name(){return this.info.name}get description(){return this.info.description??""}get headers(){return this.hdrs||(this.hdrs=Ys.fromRecord(this.info.headers||{})),this.hdrs}get options(){return this.info.options}get bucket(){return this.info.bucket}get chunks(){return this.info.chunks}get deleted(){return this.info.deleted??!1}get digest(){return this.info.digest}get mtime(){return this.info.mtime}get nuid(){return this.info.nuid}get size(){return this.info.size}get revision(){return this.info.revision}get metadata(){return this.info.metadata||{}}isLink(){var n,i;return((n=this.info.options)==null?void 0:n.link)!==void 0&&((i=this.info.options)==null?void 0:i.link)!==null}}function s0(a){const n={name:a.name,description:a.description??"",options:a.options,metadata:a.metadata};if(a.headers){const i=a.headers;n.headers=i.toRecord()}return n}function j1(){return new ReadableStream({pull(a){a.enqueue(new Uint8Array(0)),a.close()}})}class Ea{constructor(n,i,l){b(this,"jsm");b(this,"js");b(this,"stream");b(this,"name");this.name=n,this.jsm=i,this.js=l}_checkNotEmpty(n){return!n||n.length===0?{name:n,error:new Error("name cannot be empty")}:{name:n}}async info(n){const i=await this.rawInfo(n);return i?new Fu(i):null}async list(){const n=[],i=await this.watch({ignoreDeletes:!0,includeHistory:!0});for await(const l of i){if(l===null)break;n.push(l)}return Promise.resolve(n)}async rawInfo(n){const{name:i,error:l}=this._checkNotEmpty(n);if(l)return Promise.reject(l);const o=this._metaSubject(i);try{const f=await this.jsm.streams.getMessage(this.stream,{last_by_subj:o}),m=On().decode(f.data);return m.revision=f.seq,m}catch(f){return f.code==="404"?null:Promise.reject(f)}}async _si(n){try{return await this.jsm.streams.info(this.stream,n)}catch(i){return i.code==="404"?null:Promise.reject(i)}}async seal(){let n=await this._si();return n===null?Promise.reject(new Error("object store not found")):(n.config.sealed=!0,n=await this.jsm.streams.update(this.stream,n.config),Promise.resolve(new mf(n)))}async status(n){const i=await this._si(n);return i===null?Promise.reject(new Error("object store not found")):Promise.resolve(new mf(i))}destroy(){return this.jsm.streams.delete(this.stream)}async _put(n,i,l){var Xe;const o=this.js.getOptions();l=l||{timeout:o.timeout},l.timeout=l.timeout||o.timeout,l.previousRevision=l.previousRevision??void 0;const{timeout:f,previousRevision:d}=l,m=this.js.nc.info,v=(m==null?void 0:m.max_payload)||1024;n=n||{},n.options=n.options||{};let S=((Xe=n.options)==null?void 0:Xe.max_chunk_size)||128*1024;S=S>v?v:S,n.options.max_chunk_size=S;const N=await this.info(n.name),{name:O,error:M}=this._checkNotEmpty(n.name);if(M)return Promise.reject(M);const G=Js.next(),$=this._chunkSubject(G),W=this._metaSubject(O),de=Object.assign({bucket:this.name,nuid:G,size:0,chunks:0},s0(n)),ye=tt(),ie=[],be=new pr;try{const B=i?i.getReader():null,F=Qp.create();for(;;){const{done:ne,value:Z}=B?await B.read():{done:!0,value:void 0};if(ne){if(be.size()>0){const se=be.drain();F.update(se),de.chunks++,de.size+=se.length,ie.push(this.js.publish($,se,{timeout:f}))}await Promise.all(ie),ie.length=0,de.mtime=new Date().toISOString();const X=fr.encode(F.digest());de.digest=`${t0}${X}`,de.deleted=!1;const ae=ls();typeof d=="number"&&ae.set(Rn.ExpectedLastSubjectSequenceHdr,`${d}`),ae.set(Rt.RollupHdr,Rt.RollupValueSubject);const ue=await this.js.publish(W,On().encode(de),{headers:ae,timeout:f});if(de.revision=ue.seq,N)try{await this.jsm.streams.purge(this.stream,{filter:`$O.${this.name}.C.${N.nuid}`})}catch{}ye.resolve(new Fu(de));break}if(Z)for(be.fill(Z);be.size()>S;){de.chunks++,de.size+=S;const X=be.drain(n.options.max_chunk_size);F.update(X),ie.push(this.js.publish($,X,{timeout:f}))}}}catch(B){await this.jsm.streams.purge(this.stream,{filter:$}),ye.reject(B)}return ye}putBlob(n,i,l){function o(f){return new ReadableStream({pull(d){d.enqueue(f),d.close()}})}return i===null&&(i=new Uint8Array(0)),this.put(n,o(i),l)}put(n,i,l){var o;return(o=n==null?void 0:n.options)!=null&&o.link?Promise.reject(new Error("link cannot be set when putting the object in bucket")):this._put(n,i,l)}async getBlob(n){async function i(f){const d=new pr,m=f.getReader();for(;;){const{done:v,value:S}=await m.read();if(v)return d.drain();S&&S.length&&d.fill(S)}}const l=await this.get(n);if(l===null)return Promise.resolve(null);const o=await Promise.all([l.error,i(l.data)]);return o[0]?Promise.reject(o[0]):Promise.resolve(o[1])}async get(n){const i=await this.rawInfo(n);if(i===null||i.deleted)return Promise.resolve(null);if(i.options&&i.options.link){const O=i.options.link.name||"";if(O==="")throw new Error("link is a bucket");return(i.options.link.bucket!==this.name?await Ea.create(this.js,i.options.link.bucket):this).get(O)}if(!i.digest.startsWith(t0))return Promise.reject(new Error(`unknown digest type: ${i.digest}`));const l=of(i.digest.substring(8));if(l===null)return Promise.reject(new Error(`unable to parse digest: ${i.digest}`));const o=tt(),f={info:new Fu(i),error:o};if(i.size===0)return f.data=j1(),o.resolve(null),Promise.resolve(f);let d;const m=Vs();m.orderedConsumer();const v=Qp.create(),S=`$O.${this.name}.C.${i.nuid}`,N=await this.js.subscribe(S,m);return(async()=>{for await(const O of N)O.data.length>0&&(v.update(O.data),d.enqueue(O.data)),O.info.pending===0&&(y_(l,v.digest())?d.close():d.error(new Error(`received a corrupt object, digests do not match received: ${i.digest} calculated ${l}`)),N.unsubscribe())})().then(()=>{o.resolve()}).catch(O=>{d.error(O),o.reject(O)}),f.data=new ReadableStream({start(O){d=O},cancel(){N.unsubscribe()}}),f}linkStore(n,i){if(!(i instanceof Ea))return Promise.reject("bucket required");const l=i,{name:o,error:f}=this._checkNotEmpty(n);if(f)return Promise.reject(f);const d={name:o,options:{link:{bucket:l.name}}};return this._put(d,null)}async link(n,i){const{name:l,error:o}=this._checkNotEmpty(n);if(o)return Promise.reject(o);if(i.deleted)return Promise.reject(new Error("src object is deleted"));if(i.isLink())return Promise.reject(new Error("src object is a link"));const f=await this.rawInfo(n);if(f!==null&&!f.deleted)return Promise.reject(new Error("an object already exists with that name"));const d={bucket:i.bucket,name:i.name},m={name:l,bucket:i.bucket,options:{link:d}};await this.js.publish(this._metaSubject(n),JSON.stringify(m));const v=await this.info(n);return Promise.resolve(v)}async delete(n){const i=await this.rawInfo(n);if(i===null)return Promise.resolve({purged:0,success:!1});i.deleted=!0,i.size=0,i.chunks=0,i.digest="";const l=On(),o=ls();return o.set(Rt.RollupHdr,Rt.RollupValueSubject),await this.js.publish(this._metaSubject(i.name),l.encode(i),{headers:o}),this.jsm.streams.purge(this.stream,{filter:this._chunkSubject(i.nuid)})}async update(n,i={}){const l=await this.rawInfo(n);if(l===null)return Promise.reject(new Error("object not found"));if(l.deleted)return Promise.reject(new Error("cannot update meta for a deleted object"));i.name=i.name??l.name;const{name:o,error:f}=this._checkNotEmpty(i.name);if(f)return Promise.reject(f);if(n!==i.name){const v=await this.info(i.name);if(v&&!v.deleted)return Promise.reject(new Error("an object already exists with that name"))}i.name=o;const d=Object.assign({},l,s0(i)),m=await this.js.publish(this._metaSubject(d.name),JSON.stringify(d));return n!==i.name&&await this.jsm.streams.purge(this.stream,{filter:this._metaSubject(n)}),Promise.resolve(m)}async watch(n={}){n.includeHistory=n.includeHistory??!1,n.ignoreDeletes=n.ignoreDeletes??!1;let i=!1;const l=new _t,o=this._metaSubjectAll();try{await this.jsm.streams.getMessage(this.stream,{last_by_subj:o})}catch(v){v.code==="404"?(l.push(null),i=!0):l.stop(v)}const f=On(),d=Vs();d.orderedConsumer(),n.includeHistory?d.deliverLastPerSubject():(i=!0,d.deliverNew()),d.callback((v,S)=>{var N;if(v){l.stop(v);return}if(S!==null){const O=f.decode(S.data);O.deleted&&n.ignoreDeletes===!0||l.push(O),((N=S.info)==null?void 0:N.pending)===0&&!i&&(i=!0,l.push(null))}});const m=await this.js.subscribe(o,d);return l._data=m,l.iterClosed.then(()=>{m.unsubscribe()}),m.closed.then(()=>{l.stop()}).catch(v=>{l.stop(v)}),l}_chunkSubject(n){return`$O.${this.name}.C.${n}`}_metaSubject(n){return`$O.${this.name}.M.${fr.encode(n)}`}_metaSubjectAll(){return`$O.${this.name}.M.>`}async init(n={}){try{this.stream=g1(this.name)}catch(o){return Promise.reject(o)}const i=(n==null?void 0:n.ttl)||0;delete n.ttl;const l=Object.assign({max_age:i},n);l.name=this.stream,l.num_replicas=n.replicas??1,l.allow_direct=!0,l.allow_rollup_hdrs=!0,l.discard=Aa.New,l.subjects=[`$O.${this.name}.C.>`,`$O.${this.name}.M.>`],n.placement&&(l.placement=n.placement),n.metadata&&(l.metadata=n.metadata),typeof n.compression=="boolean"&&(l.compression=n.compression?Qs.S2:Qs.None);try{await this.jsm.streams.info(l.name)}catch(o){o.message==="stream not found"&&await this.jsm.streams.add(l)}}static async create(n,i,l={}){const o=await n.jetstreamManager(),f=new Ea(i,o,n);return await f.init(l),Promise.resolve(f)}}class N1{constructor(n){b(this,"js");this.js=n}kv(n,i={}){const l=this.js,{ok:o,min:f}=l.nc.features.get(Re.JS_KV);return o?i.bindOnly?Ta.bind(this.js,n,i):Ta.create(this.js,n,i):Promise.reject(new Error(`kv is only supported on servers ${f} or better`))}os(n,i={}){var d;if(typeof((d=crypto==null?void 0:crypto.subtle)==null?void 0:d.digest)!="function")return Promise.reject(new Error("objectstore: unable to calculate hashes - crypto.subtle.digest with sha256 support is required"));const l=this.js,{ok:o,min:f}=l.nc.features.get(Re.JS_OBJECTSTORE);return o?Ea.create(this.js,n,i):Promise.reject(new Error(`objectstore is only supported on servers ${f} or better`))}}class Rf extends Na{constructor(i,l){super(i,l);b(this,"consumers");b(this,"streams");b(this,"consumerAPI");b(this,"streamAPI");this.consumerAPI=new gc(i,l),this.streamAPI=new kf(i,l),this.consumers=new yf(this.consumerAPI),this.streams=new T1(this.streamAPI)}jetstreamManager(i){i===void 0&&(i=this.opts.checkAPI);const l=Object.assign({},this.opts,{checkAPI:i});return this.nc.jetstreamManager(l)}get apiPrefix(){return this.prefix}get views(){return new N1(this)}async publish(i,l=en,o){o=o||{},o.expect=o.expect||{};const f=(o==null?void 0:o.headers)||ls();o&&(o.msgID&&f.set(Rn.MsgIdHdr,o.msgID),o.expect.lastMsgID&&f.set(Rn.ExpectedLastMsgIdHdr,o.expect.lastMsgID),o.expect.streamName&&f.set(Rn.ExpectedStreamHdr,o.expect.streamName),typeof o.expect.lastSequence=="number"&&f.set(Rn.ExpectedLastSeqHdr,`${o.expect.lastSequence}`),typeof o.expect.lastSubjectSequence=="number"&&f.set(Rn.ExpectedLastSubjectSequenceHdr,`${o.expect.lastSubjectSequence}`));const d=o.timeout||this.timeout,m={};d&&(m.timeout=d),o&&(m.headers=f);let{retries:v,retry_delay:S}=o;v=v||1,S=S||250;let N;for(let M=0;M<v;M++)try{N=await this.nc.request(i,l,m);break}catch(G){if(G.code==="503"&&M+1<v)await br(S);else throw G}const O=this.parseJsResponse(N);if(O.stream==="")throw re.errorForCode(I.JetStreamInvalidAck);return O.duplicate=O.duplicate?O.duplicate:!1,O}async pull(i,l,o=0){Mt(i),or(l);let f=this.timeout;o>f&&(f=o),o=o<0?0:et(o);const d={batch:1,no_wait:o===0,expires:o},m=await this.nc.request(`${this.prefix}.CONSUMER.MSG.NEXT.${i}.${l}`,this.jc.encode(d),{noMux:!0,timeout:f}),v=ur(m);if(v)throw v;return ja(m,this.timeout)}fetch(i,l,o={}){Mt(i),or(l);let f=null;const d=(o.max_bytes??0)>0;let m=0;const v=d?o.max_bytes:0;let S=null;const N={};if(N.batch=o.batch||1,v){const ie=this.nc.features.get(Re.JS_PULL_MAX_BYTES);if(!ie.ok)throw new Error(`max_bytes is only supported on servers ${ie.min} or better`);N.max_bytes=v}N.no_wait=o.no_wait||!1,N.no_wait&&N.expires&&(N.expires=0);const O=o.expires||0;if(O&&(N.expires=et(O)),O===0&&N.no_wait===!1)throw new Error("expires or no_wait is required");const M=o.idle_heartbeat||0;M&&(N.idle_heartbeat=et(M),o.delay_heartbeat===!0&&(N.idle_heartbeat=et(M*4)));const G=new _t,$=N.batch;let W=0;G.protocolFilterFn=(ie,be=!1)=>af(ie.msg)?(S==null||S.work(),!1):!0,G.dispatchedFn=ie=>{if(ie){if(d&&(m+=ie.data.length),W++,f&&ie.info.pending===0)return;(G.getPending()===1&&ie.info.pending===0||$===W||v>0&&m>=v)&&G.stop()}};const de=as(this.nc.options.inboxPrefix),ye=this.nc.subscribe(de,{max:o.batch,callback:(ie,be)=>{ie===null&&(ie=ur(be)),ie!==null?(f&&(f.cancel(),f=null),Zb(ie)?G.stop(q0(ie)===null?void 0:ie):G.stop(ie)):(S==null||S.work(),G.received++,G.push(ja(be,this.timeout)))}});return O&&(f=dr(O),f.catch(()=>{ye.isClosed()||(ye.drain().catch(()=>{}),f=null),S&&S.cancel()})),(async()=>{try{M&&(S=new Cf(M,ie=>(G.push(()=>{G.err=new re(`${pn.IdleHeartbeatMissed}: ${ie}`,I.JetStreamIdleHeartBeat)}),!0)))}catch{}await ye.closed,f!==null&&(f.cancel(),f=null),S&&S.cancel(),G.stop()})().catch(),this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${i}.${l}`,this.jc.encode(N),{reply:de}),G}async pullSubscribe(i,l=Vs()){const o=await this._processOptions(i,l);if(o.ordered)throw new Error("pull subscribers cannot be be ordered");if(o.config.deliver_subject)throw new Error("consumer info specifies deliver_subject - pull consumers cannot have deliver_subject set");const f=o.config.ack_policy;if(f===bt.None||f===bt.All)throw new Error("ack policy for pull consumers must be explicit");const d=this._buildTypedSubscriptionOpts(o),m=new R1(this,o.deliver,d);m.info=o;try{await this._maybeCreateConsumer(o)}catch(v){throw m.unsubscribe(),v}return m}async subscribe(i,l=Vs()){const o=await this._processOptions(i,l);if(!o.isBind&&!o.config.deliver_subject)throw new Error("push consumer requires deliver_subject");const f=this._buildTypedSubscriptionOpts(o),d=new U0(this,o.deliver,f);d.info=o;try{await this._maybeCreateConsumer(o)}catch(m){throw d.unsubscribe(),m}return d._maybeSetupHbMonitoring(),d}async _processOptions(i,l=Vs()){const o=Yp(l)?l.getOpts():l;if(o.isBind=Yp(l)?l.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 re("ordered consumer: ack_policy can only be set to 'none'",I.ApiError);if(o.config.durable_name&&o.config.durable_name.length>0)throw new re("ordered consumer: durable_name cannot be set",I.ApiError);if(o.config.deliver_subject&&o.config.deliver_subject.length>0)throw new re("ordered consumer: deliver_subject cannot be set",I.ApiError);if(o.config.max_deliver!==void 0&&o.config.max_deliver>1)throw new re("ordered consumer: max_deliver cannot be set",I.ApiError);if(o.config.deliver_group&&o.config.deliver_group.length>0)throw new re("ordered consumer: deliver_group cannot be set",I.ApiError);o.config.deliver_subject=as(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||et(5e3),o.config.ack_wait=et(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(i),o.attached=!1,o.config.durable_name)try{const f=await this.consumerAPI.info(o.stream,o.config.durable_name);if(f){if(f.config.filter_subject&&f.config.filter_subject!==i)throw new Error("subject does not match consumer");const d=o.config.deliver_group??"";if(d===""&&f.push_bound===!0)throw new Error("duplicate subscription");const m=f.config.deliver_group??"";if(d!==m)throw m===""?new Error("durable requires no queue group"):new Error(`durable requires queue group '${m}'`);o.last=f,o.config=f.config,o.attached=!0,o.config.durable_name||(o.name=f.name)}}catch(f){if(f.code!=="404")throw f}return!o.attached&&o.config.filter_subject===void 0&&o.config.filter_subjects===void 0&&(o.config.filter_subject=i),o.deliver=o.config.deliver_subject||as(this.nc.options.inboxPrefix),o}_buildTypedSubscriptionOpts(i){const l={};return l.adapter=z1(i.callbackFn===void 0,this.timeout),l.ingestionFilterFn=Rf.ingestionFn(i.ordered),l.protocolFilterFn=(o,f=!1)=>{const d=o;return rf(d.msg)?(f||d.msg.respond(),!1):!0},!i.mack&&i.config.ack_policy!==bt.None&&(l.dispatchedFn=D1),i.callbackFn&&(l.callback=i.callbackFn),l.max=i.max||0,l.queue=i.queue,l}async _maybeCreateConsumer(i){if(i.attached)return;if(i.isBind)throw new Error(`unable to bind - durable consumer ${i.config.durable_name} doesn't exist in ${i.stream}`);i.config=Object.assign({deliver_policy:ot.All,ack_policy:bt.Explicit,ack_wait:et(30*1e3),replay_policy:mr.Instant},i.config);const l=await this.consumerAPI.add(i.stream,i.config);if(Array.isArray(i.config.filter_subjects&&!Array.isArray(l.config.filter_subjects)))throw new Error("jetstream server doesn't support consumers with multiple filter subjects");i.name=l.name,i.config=l.config,i.last=l}static ingestionFn(i){return(l,o)=>{var v;const f=o;if(!l)return{ingest:!1,protocol:!1};const d=l;if(ur(d.msg)||(v=f.monitor)==null||v.work(),af(d.msg)){const S=i?f._checkHbOrderConsumer(d.msg):!0;return i||f.info.flow_control.heartbeat_count++,{ingest:S,protocol:!0}}else if(rf(d.msg))return f.info.flow_control.fc_count++,{ingest:!0,protocol:!0};return{ingest:i?f._checkOrderedConsumer(l):!0,protocol:!1}}}}class zf{constructor(n){b(this,"options");b(this,"protocol");b(this,"draining");b(this,"listeners");b(this,"_services");this.draining=!1,this.options=I_(n),this.listeners=[]}static connect(n={}){return new Promise((i,l)=>{const o=new zf(n);_c.connect(o.options,o).then(f=>{o.protocol=f,(async function(){for await(const d of f.status())o.listeners.forEach(m=>{m.push(d)})})(),i(o)}).catch(f=>{l(f)})})}closed(){return this.protocol.closed}async close(){await this.protocol.close()}_check(n,i,l){if(this.isClosed())throw re.errorForCode(I.ConnectionClosed);if(i&&this.isDraining()||l&&this.protocol.noMorePublishing)throw re.errorForCode(I.ConnectionDraining);if(n=n||"",n.length===0)throw re.errorForCode(I.BadSubject)}publish(n,i,l){this._check(n,!1,!0),this.protocol.publish(n,i,l)}publishMessage(n){return this.publish(n.subject,n.data,{reply:n.reply,headers:n.headers})}respondMessage(n){return n.reply?(this.publish(n.reply,n.data,{reply:n.reply,headers:n.headers}),!0):!1}subscribe(n,i={}){this._check(n,!0,!1);const l=new M0(this.protocol,n,i);return this.protocol.subscribe(l),l}_resub(n,i,l){this._check(i,!0,!1);const o=n;o.max=l,l&&(o.max=l+o.received),this.protocol.resub(o,i)}requestMany(n,i=en,l={maxWait:1e3,maxMessages:-1}){const o=!this.protocol.options.noAsyncTraces;try{this._check(n,!0,!0)}catch(v){return Promise.reject(v)}if(l.strategy=l.strategy||An.Timer,l.maxWait=l.maxWait||1e3,l.maxWait<1)return Promise.reject(new re("timeout",I.InvalidOption));const f=new _t;function d(v){f.push(()=>{f.stop(v)})}function m(v,S){v||S===null?d(v===null?void 0:v):f.push(S)}if(l.noMux){const v=o?new Error().stack:null;let S=typeof l.maxMessages=="number"&&l.maxMessages>0?l.maxMessages:-1;const N=this.subscribe(as(this.options.inboxPrefix),{callback:($,W)=>{var de,ye;if(((de=W==null?void 0:W.data)==null?void 0:de.length)===0&&((ye=W==null?void 0:W.headers)==null?void 0:ye.status)===I.NoResponders&&($=re.errorForCode(I.NoResponders)),$){v&&($.stack+=`
48
+
49
+ ${v}`),O($);return}m(null,W),l.strategy===An.Count&&(S--,S===0&&O()),l.strategy===An.JitterTimer&&(G(),M=setTimeout(()=>{O()},300)),l.strategy===An.SentinelMsg&&W&&W.data.length===0&&O()}});N.requestSubject=n,N.closed.then(()=>{d()}).catch($=>{f.stop($)});const O=$=>{$&&f.push(()=>{throw $}),G(),N.drain().then(()=>{d()}).catch(W=>{d()})};f.iterClosed.then(()=>{G(),N==null||N.unsubscribe()}).catch($=>{G(),N==null||N.unsubscribe()});try{this.publish(n,i,{reply:N.getSubject()})}catch($){O($)}let M=setTimeout(()=>{O()},l.maxWait);const G=()=>{M&&clearTimeout(M)}}else{const v=l;v.callback=m,f.iterClosed.then(()=>{S.cancel()}).catch(N=>{S.cancel(N)});const S=new g_(this.protocol.muxSubscriptions,n,v);this.protocol.request(S);try{this.publish(n,i,{reply:`${this.protocol.muxSubscriptions.baseInbox}${S.token}`,headers:l.headers})}catch(N){S.cancel(N)}}return Promise.resolve(f)}request(n,i,l={timeout:1e3,noMux:!1}){try{this._check(n,!0,!0)}catch(f){return Promise.reject(f)}const o=!this.protocol.options.noAsyncTraces;if(l.timeout=l.timeout||1e3,l.timeout<1)return Promise.reject(new re("timeout",I.InvalidOption));if(!l.noMux&&l.reply)return Promise.reject(new re("reply can only be used with noMux",I.InvalidOption));if(l.noMux){const f=l.reply?l.reply:as(this.options.inboxPrefix),d=tt(),m=o?new Error:null,v=this.subscribe(f,{max:1,timeout:l.timeout,callback:(S,N)=>{S?(m&&S.code!==I.Timeout&&(S.stack+=`
50
+
51
+ ${m.stack}`),v.unsubscribe(),d.reject(S)):(S=S0(N),S?(m&&(S.stack+=`
52
+
53
+ ${m.stack}`),d.reject(S)):d.resolve(N))}});return v.requestSubject=n,this.protocol.publish(n,i,{reply:f,headers:l.headers}),d}else{const f=new A0(this.protocol.muxSubscriptions,n,l,o);this.protocol.request(f);try{this.publish(n,i,{reply:`${this.protocol.muxSubscriptions.baseInbox}${f.token}`,headers:l.headers})}catch(m){f.cancel(m)}const d=Promise.race([f.timer,f.deferred]);return d.catch(()=>{f.cancel()}),d}}flush(){return this.isClosed()?Promise.reject(re.errorForCode(I.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(re.errorForCode(I.ConnectionClosed)):this.isDraining()?Promise.reject(re.errorForCode(I.ConnectionDraining)):(this.draining=!0,this.protocol.drain())}isClosed(){return this.protocol.isClosed()}isDraining(){return this.draining}getServer(){const n=this.protocol.getServer();return n?n.listen:""}status(){const n=new _t;return n.iterClosed.then(()=>{const i=this.listeners.indexOf(n);this.listeners.splice(i,1)}),this.listeners.push(n),n}get info(){return this.protocol.isClosed()?void 0:this.protocol.info}async context(){return(await this.request("$SYS.REQ.USER.INFO")).json((i,l)=>i==="time"?new Date(Date.parse(l)):l)}stats(){return{inBytes:this.protocol.inBytes,outBytes:this.protocol.outBytes,inMsgs:this.protocol.inMsgs,outMsgs:this.protocol.outMsgs}}async jetstreamManager(n={}){const i=new O1(this,n);if(n.checkAPI!==!1)try{await i.getAccountInfo()}catch(l){const o=l;throw o.code===I.NoResponders&&(o.code=I.JetStreamNotEnabled),o}return i}jetstream(n={}){return new Rf(this,n)}getServerVersion(){const n=this.info;return n?gi(n.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw re.errorForCode(I.Disconnect);const n=Date.now();return await this.flush(),Date.now()-n}get features(){return this.protocol.features}get services(){return this._services||(this._services=new C1(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(re.errorForCode(I.ConnectionClosed)):this.isDraining()?Promise.reject(re.errorForCode(I.ConnectionDraining)):this.protocol.reconnect()}}class C1{constructor(n){b(this,"nc");this.nc=n}add(n){try{return new Ca(this.nc,n).start()}catch(i){return Promise.reject(i)}}client(n,i){return new o1(this.nc,n,i)}}class M1{constructor(n,i,l){b(this,"bucket");b(this,"sm");b(this,"prefixLen");this.bucket=n,this.prefixLen=i,this.sm=l}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(vc)||"PUT"}get length(){const n=this.sm.header.get(Rt.MessageSizeHdr)||"";return n!==""?parseInt(n,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class k1{constructor(n,i,l){b(this,"bucket");b(this,"key");b(this,"sm");this.bucket=n,this.key=i,this.sm=l}get value(){return this.sm.data}get created(){return new Date(jf(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){var n;return((n=this.sm.headers)==null?void 0:n.get(vc))||"PUT"}get delta(){return this.sm.info.pending}get length(){var i;const n=((i=this.sm.headers)==null?void 0:i.get(Rt.MessageSizeHdr))||"";return n!==""?parseInt(n,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class U0 extends x_{constructor(i,l,o){super(i.nc,l,o);b(this,"js");b(this,"monitor");this.js=i,this.monitor=null,this.sub.closed.then(()=>{this.monitor&&this.monitor.cancel()})}set info(i){this.sub.info=i}get info(){return this.sub.info}_resetOrderedConsumer(i){if(this.info===null||this.sub.isClosed())return;const l=as(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,l);const f=this.info;f.config.name=Js.next(),f.ordered_consumer_sequence.delivery_seq=0,f.flow_control.heartbeat_count=0,f.flow_control.fc_count=0,f.flow_control.consumer_restarts++,f.deliver=l,f.config.deliver_subject=l,f.config.deliver_policy=ot.StartSequence,f.config.opt_start_seq=i;const d={};d.stream_name=this.info.stream,d.config=f.config;const m=`${f.api.prefix}.CONSUMER.CREATE.${f.stream}`;this.js._request(m,d,{retries:-1}).then(v=>{const S=v,N=this.sub.info;N.last=S,this.info.config=S.config,this.info.name=S.name}).catch(v=>{const S=new re(`unable to recreate ordered consumer ${f.stream} at seq ${i}`,I.RequestError,v);this.sub.callback(S,{})})}_maybeSetupHbMonitoring(){var l,o;const i=((o=(l=this.info)==null?void 0:l.config)==null?void 0:o.idle_heartbeat)||0;i&&this._setupHbMonitoring(jf(i))}_setupHbMonitoring(i,l=0){const o={cancelAfter:0,maxOut:2};l&&(o.cancelAfter=l);const f=this.sub,d=m=>{var N,O,M,G;const v=t_(409,`${pn.IdleHeartbeatMissed}: ${m}`,this.sub.subject);if(!((N=this.info)==null?void 0:N.ordered))this.sub.callback(null,v);else{if(!this.js.nc.protocol.connected)return!1;const $=((M=(O=this.info)==null?void 0:O.ordered_consumer_sequence)==null?void 0:M.stream_seq)||0;return this._resetOrderedConsumer($+1),(G=this.monitor)==null||G.restart(),!1}return!f.noIterator};this.monitor=new Cf(i,d,o)}_checkHbOrderConsumer(i){const l=i.headers.get(Rt.ConsumerStalledHdr);l!==""&&this.js.nc.publish(l);const o=parseInt(i.headers.get(Rt.LastConsumerSeqHdr),10),f=this.info.ordered_consumer_sequence;return this.info.flow_control.heartbeat_count++,o!==f.delivery_seq&&this._resetOrderedConsumer(f.stream_seq+1),!1}_checkOrderedConsumer(i){const l=this.info.ordered_consumer_sequence,o=i.info.streamSequence,f=i.info.deliverySequence;return f!=l.delivery_seq+1?(this._resetOrderedConsumer(l.stream_seq+1),!1):(l.delivery_seq=f,l.stream_seq=o,!0)}async destroy(){this.isClosed()||await this.drain();const i=this.sub.info,l=i.config.durable_name||i.name,o=`${i.api.prefix}.CONSUMER.DELETE.${i.stream}.${l}`;await i.api._request(o)}async consumerInfo(){const i=this.sub.info,l=i.config.durable_name||i.name,o=`${i.api.prefix}.CONSUMER.INFO.${i.stream}.${l}`,f=await i.api._request(o);return i.last=f,f}}class R1 extends U0{constructor(n,i,l){super(n,i,l)}pull(n={batch:1}){const{stream:i,config:l,name:o}=this.sub.info,f=l.durable_name??o,d={};if(d.batch=n.batch||1,d.no_wait=n.no_wait||!1,(n.max_bytes??0)>0){const S=this.js.nc.features.get(Re.JS_PULL_MAX_BYTES);if(!S.ok)throw new Error(`max_bytes is only supported on servers ${S.min} or better`);d.max_bytes=n.max_bytes}let m=0;n.expires&&n.expires>0&&(m=n.expires,d.expires=et(m));let v=0;if(n.idle_heartbeat&&n.idle_heartbeat>0&&(v=n.idle_heartbeat,d.idle_heartbeat=et(v)),v&&m===0)throw new Error("idle_heartbeat requires expires");if(v>m)throw new Error("expires must be greater than idle_heartbeat");if(this.info){this.monitor&&this.monitor.cancel(),m&&v&&(this.monitor?this.monitor._change(v,m):this._setupHbMonitoring(v,m));const S=this.info.api,N=`${S.prefix}.CONSUMER.MSG.NEXT.${i}.${f}`,O=this.sub.subject;S.nc.publish(N,S.jc.encode(d),{reply:O})}}}function z1(a,n){return a?q1(n):U1(n)}function U1(a){return(n,i)=>n?[n,null]:(n=ur(i),n?[n,null]:[null,ja(i,a)])}function q1(a){return(n,i)=>{if(n)return[n,null];const l=ur(i);return l!==null?[q0(l),null]:[null,ja(i,a)]}}function q0(a){if(a!==null)switch(a.code){case I.JetStream404NoMessages:case I.JetStream408RequestTimeout:return null;case I.JetStream409:return n_(a)?a:null;default:return a}return null}function D1(a){a&&a.ack()}function B1(a){const n=a.split(".");if(n.length===9&&n.splice(2,0,"_",""),n.length<11||n[0]!=="$JS"||n[1]!=="ACK")throw new Error("not js message");const i={};return i.domain=n[2]==="_"?"":n[2],i.account_hash=n[3],i.stream=n[4],i.consumer=n[5],i.deliveryCount=parseInt(n[6],10),i.redeliveryCount=i.deliveryCount,i.redelivered=i.deliveryCount>1,i.streamSequence=parseInt(n[7],10),i.deliverySequence=parseInt(n[8],10),i.timestampNanos=parseInt(n[9],10),i.pending=parseInt(n[10],10),i}class L1{constructor(n,i){b(this,"msg");b(this,"di");b(this,"didAck");b(this,"timeout");this.msg=n,this.didAck=!1,this.timeout=i}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=B1(this.reply)),this.di}get redelivered(){return this.info.deliveryCount>1}get reply(){return this.msg.reply||""}get seq(){return this.info.streamSequence}doAck(n){this.didAck||(this.didAck=!this.isWIP(n),this.msg.respond(n))}isWIP(n){return n.length===4&&n[0]===ya[0]&&n[1]===ya[1]&&n[2]===ya[2]&&n[3]===ya[3]}async ackAck(n){var l;n=n||{},n.timeout=n.timeout||this.timeout;const i=tt();if(this.didAck)i.resolve(!1);else if(this.didAck=!0,this.msg.reply){const f=this.msg.publisher,d=!((l=f.options)!=null&&l.noAsyncTraces),m=new A0(f.muxSubscriptions,this.msg.reply,{timeout:n.timeout},d);f.request(m);try{f.publish(this.msg.reply,n0,{reply:`${f.muxSubscriptions.baseInbox}${m.token}`})}catch(v){m.cancel(v)}try{await Promise.race([m.timer,m.deferred]),i.resolve(!0)}catch(v){m.cancel(v),i.reject(v)}}else i.resolve(!1);return i}ack(){this.doAck(n0)}nak(n){let i=_1;n&&(i=sf().encode(`-NAK ${JSON.stringify({delay:et(n)})}`)),this.doAck(i)}working(){this.doAck(ya)}next(n,i={batch:1}){const l={};l.batch=i.batch||1,l.no_wait=i.no_wait||!1,i.expires&&i.expires>0&&(l.expires=et(i.expires));const o=On().encode(l),f=pr.concat(v1,S1,o),d=n?{reply:n}:void 0;this.msg.respond(f,d)}term(n=""){let i=x1;(n==null?void 0:n.length)>0&&(i=sf().encode(`+TERM ${n}`)),this.doAck(i)}json(){return this.msg.json()}string(){return this.msg.string()}}const H1="1.30.3",G1="nats.ws";class Y1{constructor(){b(this,"version");b(this,"lang");b(this,"closeError");b(this,"connected");b(this,"done");b(this,"socket");b(this,"options");b(this,"socketClosed");b(this,"encrypted");b(this,"peeked");b(this,"yields");b(this,"signal");b(this,"closedNotification");this.version=H1,this.lang=G1,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=tt(),this.closedNotification=tt()}async connect(n,i){const l=tt();if(i.tls)return l.reject(new re("tls",I.InvalidOption)),l;this.options=i;const o=n.src;if(i.wsFactory){const{socket:f,encrypted:d}=await i.wsFactory(n.src,i);this.socket=f,this.encrypted=d}else this.encrypted=o.indexOf("wss://")===0,this.socket=new WebSocket(o);return this.socket.binaryType="arraybuffer",this.socket.onopen=()=>{this.isDiscarded()},this.socket.onmessage=f=>{if(this.isDiscarded())return;if(this.yields.push(new Uint8Array(f.data)),this.peeked){this.signal.resolve();return}const d=pr.concat(...this.yields),m=T_(d);if(m!==""){const v=t1.exec(m);if(!v){i.debug&&console.error("!!!",Il(d)),l.reject(new Error("unexpected response from server"));return}try{const S=JSON.parse(v[1]);W_(S,this.options),this.peeked=!0,this.connected=!0,this.signal.resolve(),l.resolve()}catch(S){l.reject(S);return}}},this.socket.onclose=f=>{if(this.isDiscarded())return;this.socketClosed=!0;let d;this.done||(f.wasClean||(d=new Error(f.reason)),this._closed(d))},this.socket.onerror=f=>{if(this.isDiscarded())return;const d=f,m=new re(d.message,I.Unknown,new Error(d.error));l.reject(m)},l}disconnect(){this._closed(void 0,!0)}async _closed(n,i=!0){if(!this.isDiscarded()&&this.connected&&!this.done){if(this.closeError=n,!n)for(;!this.socketClosed&&this.socket.bufferedAmount>0;)await br(100);this.done=!0;try{this.socket.close(n?1002:1e3,n?n.message:void 0)}catch{}i&&this.closedNotification.resolve(n)}}get isClosed(){return this.done}[Symbol.asyncIterator](){return this.iterate()}async*iterate(){for(;;){if(this.isDiscarded())return;this.yields.length===0&&await this.signal;const n=this.yields;this.yields=[];for(let i=0;i<n.length;i++)this.options.debug&&console.info(`> ${Il(n[i])}`),yield n[i];if(this.done)break;this.yields.length===0&&(n.length=0,this.yields=n,this.signal=tt())}}isEncrypted(){return this.connected&&this.encrypted}send(n){if(!this.isDiscarded())try{this.socket.send(n.buffer),this.options.debug&&console.info(`< ${Il(n)}`);return}catch(i){this.options.debug&&console.error(`!!! ${Il(n)}: ${i}`)}}close(n){return this._closed(n,!1)}closed(){return this.closedNotification}isDiscarded(){return this.done?(this.discard(),!0):!1}discard(){var n;this.done=!0;try{(n=this.socket)==null||n.close()}catch{}}}function V1(a,n){/^(.*:\/\/)(.*)/.test(a)||(typeof n=="boolean"?a=`${n===!0?"https":"http"}://${a}`:a=`https://${a}`);let l=new URL(a);const o=l.protocol.toLowerCase();o==="ws:"&&(n=!1),o==="wss:"&&(n=!0),o!=="https:"&&o!=="http"&&(a=a.replace(/^(.*:\/\/)(.*)/gm,"$2"),l=new URL(`http://${a}`));let f,d;const m=l.hostname,v=l.pathname,S=l.search||"";switch(o){case"http:":case"ws:":case"nats:":d=l.port||"80",f="ws:";break;case"https:":case"wss:":case"tls:":d=l.port||"443",f="wss:";break;default:d=l.port||n===!0?"443":"80",f=n===!0?"wss:":"ws:";break}return`${f}//${m}:${d}${v}${S}`}function P1(a={}){return S_({defaultPort:443,urlParseFn:V1,factory:()=>new Y1}),zf.connect(a)}const J1="ws://localhost:9222",Q1="dev_api_secret",X1="lt.events";function D0(a,n){const i=a.split("."),l=n.split(".");for(let o=0;o<l.length;o++){const f=l[o];if(f===">")return!0;if(o>=i.length||f!=="*"&&f!==i[o])return!1}return i.length===l.length}const Ac=Q.createContext({connected:!1,subscribe:()=>()=>{}});function $1(){const{connected:a}=Q.useContext(Ac);return{connected:a}}function B0(a,n){const{subscribe:i}=Q.useContext(Ac),l=Q.useRef(n);l.current=n,Q.useEffect(()=>i(a,f=>l.current(f)),[i,a])}const K1=Q.createContext({connected:!1,subscribe:()=>()=>{}}),F1=sf();function Z1({children:a}){const n=Q.useRef(null),i=Q.useRef(null),[l,o]=Q.useState(!1),f=Q.useRef(null),d=Q.useRef(new Map),m=Q.useCallback((N,O)=>{const M=d.current;return M.has(N)||M.set(N,new Set),M.get(N).add(O),()=>{const G=M.get(N);G&&(G.delete(O),G.size===0&&M.delete(N))}},[]),v=Q.useCallback((N,O)=>{for(const[M,G]of d.current)if(D0(N,M))for(const $ of G)try{$(O)}catch{}},[]),S=Q.useCallback(async()=>{try{if(n.current)return;const N=await P1({servers:J1,token:Q1,reconnect:!0,maxReconnectAttempts:-1,reconnectTimeWait:2e3});n.current=N,o(!0);const O=N.subscribe("lt.>");i.current=O,(async()=>{for await(const M of O)try{const G=JSON.parse(F1.decode(M.data));v(M.subject,G)}catch{}})(),(async()=>{for await(const M of N.status())M.type==="disconnect"||M.type==="error"?o(!1):M.type==="reconnect"&&o(!0)})()}catch{o(!1),f.current=setTimeout(S,3e3)}},[v]);return Q.useEffect(()=>(S(),()=>{f.current&&clearTimeout(f.current),i.current&&i.current.unsubscribe(),n.current&&(n.current.close().catch(()=>{}),n.current=null),o(!1)}),[S]),g.jsx(K1.Provider,{value:{connected:l,subscribe:m},children:g.jsx(Ac.Provider,{value:{connected:l,subscribe:m},children:a})})}const qn=Object.create(null);qn.open="0";qn.close="1";qn.ping="2";qn.pong="3";qn.message="4";qn.upgrade="5";qn.noop="6";const lc=Object.create(null);Object.keys(qn).forEach(a=>{lc[qn[a]]=a});const bf={type:"error",data:"parser error"},L0=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",H0=typeof ArrayBuffer=="function",G0=a=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(a):a&&a.buffer instanceof ArrayBuffer,Uf=({type:a,data:n},i,l)=>L0&&n instanceof Blob?i?l(n):i0(n,l):H0&&(n instanceof ArrayBuffer||G0(n))?i?l(n):i0(new Blob([n]),l):l(qn[a]+(n||"")),i0=(a,n)=>{const i=new FileReader;return i.onload=function(){const l=i.result.split(",")[1];n("b"+(l||""))},i.readAsDataURL(a)};function r0(a){return a instanceof Uint8Array?a:a instanceof ArrayBuffer?new Uint8Array(a):new Uint8Array(a.buffer,a.byteOffset,a.byteLength)}let Zu;function I1(a,n){if(L0&&a.data instanceof Blob)return a.data.arrayBuffer().then(r0).then(n);if(H0&&(a.data instanceof ArrayBuffer||G0(a.data)))return n(r0(a.data));Uf(a,!1,i=>{Zu||(Zu=new TextEncoder),n(Zu.encode(i))})}const a0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",va=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let a=0;a<a0.length;a++)va[a0.charCodeAt(a)]=a;const W1=a=>{let n=a.length*.75,i=a.length,l,o=0,f,d,m,v;a[a.length-1]==="="&&(n--,a[a.length-2]==="="&&n--);const S=new ArrayBuffer(n),N=new Uint8Array(S);for(l=0;l<i;l+=4)f=va[a.charCodeAt(l)],d=va[a.charCodeAt(l+1)],m=va[a.charCodeAt(l+2)],v=va[a.charCodeAt(l+3)],N[o++]=f<<2|d>>4,N[o++]=(d&15)<<4|m>>2,N[o++]=(m&3)<<6|v&63;return S},ev=typeof ArrayBuffer=="function",qf=(a,n)=>{if(typeof a!="string")return{type:"message",data:Y0(a,n)};const i=a.charAt(0);return i==="b"?{type:"message",data:tv(a.substring(1),n)}:lc[i]?a.length>1?{type:lc[i],data:a.substring(1)}:{type:lc[i]}:bf},tv=(a,n)=>{if(ev){const i=W1(a);return Y0(i,n)}else return{base64:!0,data:a}},Y0=(a,n)=>{switch(n){case"blob":return a instanceof Blob?a:new Blob([a]);case"arraybuffer":default:return a instanceof ArrayBuffer?a:a.buffer}},V0="",nv=(a,n)=>{const i=a.length,l=new Array(i);let o=0;a.forEach((f,d)=>{Uf(f,!1,m=>{l[d]=m,++o===i&&n(l.join(V0))})})},sv=(a,n)=>{const i=a.split(V0),l=[];for(let o=0;o<i.length;o++){const f=qf(i[o],n);if(l.push(f),f.type==="error")break}return l};function iv(){return new TransformStream({transform(a,n){I1(a,i=>{const l=i.length;let o;if(l<126)o=new Uint8Array(1),new DataView(o.buffer).setUint8(0,l);else if(l<65536){o=new Uint8Array(3);const f=new DataView(o.buffer);f.setUint8(0,126),f.setUint16(1,l)}else{o=new Uint8Array(9);const f=new DataView(o.buffer);f.setUint8(0,127),f.setBigUint64(1,BigInt(l))}a.data&&typeof a.data!="string"&&(o[0]|=128),n.enqueue(o),n.enqueue(i)})}})}let Iu;function nc(a){return a.reduce((n,i)=>n+i.length,0)}function sc(a,n){if(a[0].length===n)return a.shift();const i=new Uint8Array(n);let l=0;for(let o=0;o<n;o++)i[o]=a[0][l++],l===a[0].length&&(a.shift(),l=0);return a.length&&l<a[0].length&&(a[0]=a[0].slice(l)),i}function rv(a,n){Iu||(Iu=new TextDecoder);const i=[];let l=0,o=-1,f=!1;return new TransformStream({transform(d,m){for(i.push(d);;){if(l===0){if(nc(i)<1)break;const v=sc(i,1);f=(v[0]&128)===128,o=v[0]&127,o<126?l=3:o===126?l=1:l=2}else if(l===1){if(nc(i)<2)break;const v=sc(i,2);o=new DataView(v.buffer,v.byteOffset,v.length).getUint16(0),l=3}else if(l===2){if(nc(i)<8)break;const v=sc(i,8),S=new DataView(v.buffer,v.byteOffset,v.length),N=S.getUint32(0);if(N>Math.pow(2,21)-1){m.enqueue(bf);break}o=N*Math.pow(2,32)+S.getUint32(4),l=3}else{if(nc(i)<o)break;const v=sc(i,o);m.enqueue(qf(f?v:Iu.decode(v),n)),l=0}if(o===0||o>a){m.enqueue(bf);break}}}})}const P0=4;function mt(a){if(a)return av(a)}function av(a){for(var n in mt.prototype)a[n]=mt.prototype[n];return a}mt.prototype.on=mt.prototype.addEventListener=function(a,n){return this._callbacks=this._callbacks||{},(this._callbacks["$"+a]=this._callbacks["$"+a]||[]).push(n),this};mt.prototype.once=function(a,n){function i(){this.off(a,i),n.apply(this,arguments)}return i.fn=n,this.on(a,i),this};mt.prototype.off=mt.prototype.removeListener=mt.prototype.removeAllListeners=mt.prototype.removeEventListener=function(a,n){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var i=this._callbacks["$"+a];if(!i)return this;if(arguments.length==1)return delete this._callbacks["$"+a],this;for(var l,o=0;o<i.length;o++)if(l=i[o],l===n||l.fn===n){i.splice(o,1);break}return i.length===0&&delete this._callbacks["$"+a],this};mt.prototype.emit=function(a){this._callbacks=this._callbacks||{};for(var n=new Array(arguments.length-1),i=this._callbacks["$"+a],l=1;l<arguments.length;l++)n[l-1]=arguments[l];if(i){i=i.slice(0);for(var l=0,o=i.length;l<o;++l)i[l].apply(this,n)}return this};mt.prototype.emitReserved=mt.prototype.emit;mt.prototype.listeners=function(a){return this._callbacks=this._callbacks||{},this._callbacks["$"+a]||[]};mt.prototype.hasListeners=function(a){return!!this.listeners(a).length};const Oc=typeof Promise=="function"&&typeof Promise.resolve=="function"?n=>Promise.resolve().then(n):(n,i)=>i(n,0),yn=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),lv="arraybuffer";function J0(a,...n){return n.reduce((i,l)=>(a.hasOwnProperty(l)&&(i[l]=a[l]),i),{})}const cv=yn.setTimeout,ov=yn.clearTimeout;function Tc(a,n){n.useNativeTimers?(a.setTimeoutFn=cv.bind(yn),a.clearTimeoutFn=ov.bind(yn)):(a.setTimeoutFn=yn.setTimeout.bind(yn),a.clearTimeoutFn=yn.clearTimeout.bind(yn))}const uv=1.33;function fv(a){return typeof a=="string"?hv(a):Math.ceil((a.byteLength||a.size)*uv)}function hv(a){let n=0,i=0;for(let l=0,o=a.length;l<o;l++)n=a.charCodeAt(l),n<128?i+=1:n<2048?i+=2:n<55296||n>=57344?i+=3:(l++,i+=4);return i}function Q0(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function dv(a){let n="";for(let i in a)a.hasOwnProperty(i)&&(n.length&&(n+="&"),n+=encodeURIComponent(i)+"="+encodeURIComponent(a[i]));return n}function mv(a){let n={},i=a.split("&");for(let l=0,o=i.length;l<o;l++){let f=i[l].split("=");n[decodeURIComponent(f[0])]=decodeURIComponent(f[1])}return n}class pv extends Error{constructor(n,i,l){super(n),this.description=i,this.context=l,this.type="TransportError"}}class Df extends mt{constructor(n){super(),this.writable=!1,Tc(this,n),this.opts=n,this.query=n.query,this.socket=n.socket,this.supportsBinary=!n.forceBase64}onError(n,i,l){return super.emitReserved("error",new pv(n,i,l)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(n){this.readyState==="open"&&this.write(n)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(n){const i=qf(n,this.socket.binaryType);this.onPacket(i)}onPacket(n){super.emitReserved("packet",n)}onClose(n){this.readyState="closed",super.emitReserved("close",n)}pause(n){}createUri(n,i={}){return n+"://"+this._hostname()+this._port()+this.opts.path+this._query(i)}_hostname(){const n=this.opts.hostname;return n.indexOf(":")===-1?n:"["+n+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(n){const i=dv(n);return i.length?"?"+i:""}}class yv extends Df{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(n){this.readyState="pausing";const i=()=>{this.readyState="paused",n()};if(this._polling||!this.writable){let l=0;this._polling&&(l++,this.once("pollComplete",function(){--l||i()})),this.writable||(l++,this.once("drain",function(){--l||i()}))}else i()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(n){const i=l=>{if(this.readyState==="opening"&&l.type==="open"&&this.onOpen(),l.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(l)};sv(n,this.socket.binaryType).forEach(i),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const n=()=>{this.write([{type:"close"}])};this.readyState==="open"?n():this.once("open",n)}write(n){this.writable=!1,nv(n,i=>{this.doWrite(i,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const n=this.opts.secure?"https":"http",i=this.query||{};return this.opts.timestampRequests!==!1&&(i[this.opts.timestampParam]=Q0()),!this.supportsBinary&&!i.sid&&(i.b64=1),this.createUri(n,i)}}let X0=!1;try{X0=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const gv=X0;function bv(){}class _v extends yv{constructor(n){if(super(n),typeof location<"u"){const i=location.protocol==="https:";let l=location.port;l||(l=i?"443":"80"),this.xd=typeof location<"u"&&n.hostname!==location.hostname||l!==n.port}}doWrite(n,i){const l=this.request({method:"POST",data:n});l.on("success",i),l.on("error",(o,f)=>{this.onError("xhr post error",o,f)})}doPoll(){const n=this.request();n.on("data",this.onData.bind(this)),n.on("error",(i,l)=>{this.onError("xhr poll error",i,l)}),this.pollXhr=n}}class Un extends mt{constructor(n,i,l){super(),this.createRequest=n,Tc(this,l),this._opts=l,this._method=l.method||"GET",this._uri=i,this._data=l.data!==void 0?l.data:null,this._create()}_create(){var n;const i=J0(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");i.xdomain=!!this._opts.xd;const l=this._xhr=this.createRequest(i);try{l.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){l.setDisableHeaderCheck&&l.setDisableHeaderCheck(!0);for(let o in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(o)&&l.setRequestHeader(o,this._opts.extraHeaders[o])}}catch{}if(this._method==="POST")try{l.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{l.setRequestHeader("Accept","*/*")}catch{}(n=this._opts.cookieJar)===null||n===void 0||n.addCookies(l),"withCredentials"in l&&(l.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(l.timeout=this._opts.requestTimeout),l.onreadystatechange=()=>{var o;l.readyState===3&&((o=this._opts.cookieJar)===null||o===void 0||o.parseCookies(l.getResponseHeader("set-cookie"))),l.readyState===4&&(l.status===200||l.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof l.status=="number"?l.status:0)},0))},l.send(this._data)}catch(o){this.setTimeoutFn(()=>{this._onError(o)},0);return}typeof document<"u"&&(this._index=Un.requestsCount++,Un.requests[this._index]=this)}_onError(n){this.emitReserved("error",n,this._xhr),this._cleanup(!0)}_cleanup(n){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=bv,n)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Un.requests[this._index],this._xhr=null}}_onLoad(){const n=this._xhr.responseText;n!==null&&(this.emitReserved("data",n),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}Un.requestsCount=0;Un.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",l0);else if(typeof addEventListener=="function"){const a="onpagehide"in yn?"pagehide":"unload";addEventListener(a,l0,!1)}}function l0(){for(let a in Un.requests)Un.requests.hasOwnProperty(a)&&Un.requests[a].abort()}const vv=(function(){const a=$0({xdomain:!1});return a&&a.responseType!==null})();class xv extends _v{constructor(n){super(n);const i=n&&n.forceBase64;this.supportsBinary=vv&&!i}request(n={}){return Object.assign(n,{xd:this.xd},this.opts),new Un($0,this.uri(),n)}}function $0(a){const n=a.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!n||gv))return new XMLHttpRequest}catch{}if(!n)try{return new yn[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const K0=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class Sv extends Df{get name(){return"websocket"}doOpen(){const n=this.uri(),i=this.opts.protocols,l=K0?{}:J0(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(l.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(n,i,l)}catch(o){return this.emitReserved("error",o)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=n=>this.onClose({description:"websocket connection closed",context:n}),this.ws.onmessage=n=>this.onData(n.data),this.ws.onerror=n=>this.onError("websocket error",n)}write(n){this.writable=!1;for(let i=0;i<n.length;i++){const l=n[i],o=i===n.length-1;Uf(l,this.supportsBinary,f=>{try{this.doWrite(l,f)}catch{}o&&Oc(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const n=this.opts.secure?"wss":"ws",i=this.query||{};return this.opts.timestampRequests&&(i[this.opts.timestampParam]=Q0()),this.supportsBinary||(i.b64=1),this.createUri(n,i)}}const Wu=yn.WebSocket||yn.MozWebSocket;class wv extends Sv{createSocket(n,i,l){return K0?new Wu(n,i,l):i?new Wu(n,i):new Wu(n)}doWrite(n,i){this.ws.send(i)}}class Ev extends Df{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(n){return this.emitReserved("error",n)}this._transport.closed.then(()=>{this.onClose()}).catch(n=>{this.onError("webtransport error",n)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(n=>{const i=rv(Number.MAX_SAFE_INTEGER,this.socket.binaryType),l=n.readable.pipeThrough(i).getReader(),o=iv();o.readable.pipeTo(n.writable),this._writer=o.writable.getWriter();const f=()=>{l.read().then(({done:m,value:v})=>{m||(this.onPacket(v),f())}).catch(m=>{})};f();const d={type:"open"};this.query.sid&&(d.data=`{"sid":"${this.query.sid}"}`),this._writer.write(d).then(()=>this.onOpen())})})}write(n){this.writable=!1;for(let i=0;i<n.length;i++){const l=n[i],o=i===n.length-1;this._writer.write(l).then(()=>{o&&Oc(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var n;(n=this._transport)===null||n===void 0||n.close()}}const Av={websocket:wv,webtransport:Ev,polling:xv},Ov=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Tv=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function _f(a){if(a.length>8e3)throw"URI too long";const n=a,i=a.indexOf("["),l=a.indexOf("]");i!=-1&&l!=-1&&(a=a.substring(0,i)+a.substring(i,l).replace(/:/g,";")+a.substring(l,a.length));let o=Ov.exec(a||""),f={},d=14;for(;d--;)f[Tv[d]]=o[d]||"";return i!=-1&&l!=-1&&(f.source=n,f.host=f.host.substring(1,f.host.length-1).replace(/;/g,":"),f.authority=f.authority.replace("[","").replace("]","").replace(/;/g,":"),f.ipv6uri=!0),f.pathNames=jv(f,f.path),f.queryKey=Nv(f,f.query),f}function jv(a,n){const i=/\/{2,9}/g,l=n.replace(i,"/").split("/");return(n.slice(0,1)=="/"||n.length===0)&&l.splice(0,1),n.slice(-1)=="/"&&l.splice(l.length-1,1),l}function Nv(a,n){const i={};return n.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(l,o,f){o&&(i[o]=f)}),i}const vf=typeof addEventListener=="function"&&typeof removeEventListener=="function",cc=[];vf&&addEventListener("offline",()=>{cc.forEach(a=>a())},!1);class Ps extends mt{constructor(n,i){if(super(),this.binaryType=lv,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,n&&typeof n=="object"&&(i=n,n=null),n){const l=_f(n);i.hostname=l.host,i.secure=l.protocol==="https"||l.protocol==="wss",i.port=l.port,l.query&&(i.query=l.query)}else i.host&&(i.hostname=_f(i.host).host);Tc(this,i),this.secure=i.secure!=null?i.secure:typeof location<"u"&&location.protocol==="https:",i.hostname&&!i.port&&(i.port=this.secure?"443":"80"),this.hostname=i.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=i.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},i.transports.forEach(l=>{const o=l.prototype.name;this.transports.push(o),this._transportsByName[o]=l}),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},i),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=mv(this.opts.query)),vf&&(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"})},cc.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(n){const i=Object.assign({},this.opts.query);i.EIO=P0,i.transport=n,this.id&&(i.sid=this.id);const l=Object.assign({},this.opts,{query:i,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[n]);return new this._transportsByName[n](l)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const n=this.opts.rememberUpgrade&&Ps.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const i=this.createTransport(n);i.open(),this.setTransport(i)}setTransport(n){this.transport&&this.transport.removeAllListeners(),this.transport=n,n.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",i=>this._onClose("transport close",i))}onOpen(){this.readyState="open",Ps.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",n),this.emitReserved("heartbeat"),n.type){case"open":this.onHandshake(JSON.parse(n.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const i=new Error("server error");i.code=n.data,this._onError(i);break;case"message":this.emitReserved("data",n.data),this.emitReserved("message",n.data);break}}onHandshake(n){this.emitReserved("handshake",n),this.id=n.sid,this.transport.query.sid=n.sid,this._pingInterval=n.pingInterval,this._pingTimeout=n.pingTimeout,this._maxPayload=n.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const n=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+n,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},n),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const n=this._getWritablePackets();this.transport.send(n),this._prevBufferLen=n.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let i=1;for(let l=0;l<this.writeBuffer.length;l++){const o=this.writeBuffer[l].data;if(o&&(i+=fv(o)),l>0&&i>this._maxPayload)return this.writeBuffer.slice(0,l);i+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const n=Date.now()>this._pingTimeoutTime;return n&&(this._pingTimeoutTime=0,Oc(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),n}write(n,i,l){return this._sendPacket("message",n,i,l),this}send(n,i,l){return this._sendPacket("message",n,i,l),this}_sendPacket(n,i,l,o){if(typeof i=="function"&&(o=i,i=void 0),typeof l=="function"&&(o=l,l=null),this.readyState==="closing"||this.readyState==="closed")return;l=l||{},l.compress=l.compress!==!1;const f={type:n,data:i,options:l};this.emitReserved("packetCreate",f),this.writeBuffer.push(f),o&&this.once("flush",o),this.flush()}close(){const n=()=>{this._onClose("forced close"),this.transport.close()},i=()=>{this.off("upgrade",i),this.off("upgradeError",i),n()},l=()=>{this.once("upgrade",i),this.once("upgradeError",i)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?l():n()}):this.upgrading?l():n()),this}_onError(n){if(Ps.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",n),this._onClose("transport error",n)}_onClose(n,i){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(),vf&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const l=cc.indexOf(this._offlineEventListener);l!==-1&&cc.splice(l,1)}this.readyState="closed",this.id=null,this.emitReserved("close",n,i),this.writeBuffer=[],this._prevBufferLen=0}}}Ps.protocol=P0;class Cv extends Ps{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let n=0;n<this._upgrades.length;n++)this._probe(this._upgrades[n])}_probe(n){let i=this.createTransport(n),l=!1;Ps.priorWebsocketSuccess=!1;const o=()=>{l||(i.send([{type:"ping",data:"probe"}]),i.once("packet",O=>{if(!l)if(O.type==="pong"&&O.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",i),!i)return;Ps.priorWebsocketSuccess=i.name==="websocket",this.transport.pause(()=>{l||this.readyState!=="closed"&&(N(),this.setTransport(i),i.send([{type:"upgrade"}]),this.emitReserved("upgrade",i),i=null,this.upgrading=!1,this.flush())})}else{const M=new Error("probe error");M.transport=i.name,this.emitReserved("upgradeError",M)}}))};function f(){l||(l=!0,N(),i.close(),i=null)}const d=O=>{const M=new Error("probe error: "+O);M.transport=i.name,f(),this.emitReserved("upgradeError",M)};function m(){d("transport closed")}function v(){d("socket closed")}function S(O){i&&O.name!==i.name&&f()}const N=()=>{i.removeListener("open",o),i.removeListener("error",d),i.removeListener("close",m),this.off("close",v),this.off("upgrading",S)};i.once("open",o),i.once("error",d),i.once("close",m),this.once("close",v),this.once("upgrading",S),this._upgrades.indexOf("webtransport")!==-1&&n!=="webtransport"?this.setTimeoutFn(()=>{l||i.open()},200):i.open()}onHandshake(n){this._upgrades=this._filterUpgrades(n.upgrades),super.onHandshake(n)}_filterUpgrades(n){const i=[];for(let l=0;l<n.length;l++)~this.transports.indexOf(n[l])&&i.push(n[l]);return i}}let Mv=class extends Cv{constructor(n,i={}){const l=typeof n=="object"?n:i;(!l.transports||l.transports&&typeof l.transports[0]=="string")&&(l.transports=(l.transports||["polling","websocket","webtransport"]).map(o=>Av[o]).filter(o=>!!o)),super(n,l)}};function kv(a,n="",i){let l=a;i=i||typeof location<"u"&&location,a==null&&(a=i.protocol+"//"+i.host),typeof a=="string"&&(a.charAt(0)==="/"&&(a.charAt(1)==="/"?a=i.protocol+a:a=i.host+a),/^(https?|wss?):\/\//.test(a)||(typeof i<"u"?a=i.protocol+"//"+a:a="https://"+a),l=_f(a)),l.port||(/^(http|ws)$/.test(l.protocol)?l.port="80":/^(http|ws)s$/.test(l.protocol)&&(l.port="443")),l.path=l.path||"/";const f=l.host.indexOf(":")!==-1?"["+l.host+"]":l.host;return l.id=l.protocol+"://"+f+":"+l.port+n,l.href=l.protocol+"://"+f+(i&&i.port===l.port?"":":"+l.port),l}const Rv=typeof ArrayBuffer=="function",zv=a=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(a):a.buffer instanceof ArrayBuffer,F0=Object.prototype.toString,Uv=typeof Blob=="function"||typeof Blob<"u"&&F0.call(Blob)==="[object BlobConstructor]",qv=typeof File=="function"||typeof File<"u"&&F0.call(File)==="[object FileConstructor]";function Bf(a){return Rv&&(a instanceof ArrayBuffer||zv(a))||Uv&&a instanceof Blob||qv&&a instanceof File}function oc(a,n){if(!a||typeof a!="object")return!1;if(Array.isArray(a)){for(let i=0,l=a.length;i<l;i++)if(oc(a[i]))return!0;return!1}if(Bf(a))return!0;if(a.toJSON&&typeof a.toJSON=="function"&&arguments.length===1)return oc(a.toJSON(),!0);for(const i in a)if(Object.prototype.hasOwnProperty.call(a,i)&&oc(a[i]))return!0;return!1}function Dv(a){const n=[],i=a.data,l=a;return l.data=xf(i,n),l.attachments=n.length,{packet:l,buffers:n}}function xf(a,n){if(!a)return a;if(Bf(a)){const i={_placeholder:!0,num:n.length};return n.push(a),i}else if(Array.isArray(a)){const i=new Array(a.length);for(let l=0;l<a.length;l++)i[l]=xf(a[l],n);return i}else if(typeof a=="object"&&!(a instanceof Date)){const i={};for(const l in a)Object.prototype.hasOwnProperty.call(a,l)&&(i[l]=xf(a[l],n));return i}return a}function Bv(a,n){return a.data=Sf(a.data,n),delete a.attachments,a}function Sf(a,n){if(!a)return a;if(a&&a._placeholder===!0){if(typeof a.num=="number"&&a.num>=0&&a.num<n.length)return n[a.num];throw new Error("illegal attachments")}else if(Array.isArray(a))for(let i=0;i<a.length;i++)a[i]=Sf(a[i],n);else if(typeof a=="object")for(const i in a)Object.prototype.hasOwnProperty.call(a,i)&&(a[i]=Sf(a[i],n));return a}const Lv=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var Me;(function(a){a[a.CONNECT=0]="CONNECT",a[a.DISCONNECT=1]="DISCONNECT",a[a.EVENT=2]="EVENT",a[a.ACK=3]="ACK",a[a.CONNECT_ERROR=4]="CONNECT_ERROR",a[a.BINARY_EVENT=5]="BINARY_EVENT",a[a.BINARY_ACK=6]="BINARY_ACK"})(Me||(Me={}));class Hv{constructor(n){this.replacer=n}encode(n){return(n.type===Me.EVENT||n.type===Me.ACK)&&oc(n)?this.encodeAsBinary({type:n.type===Me.EVENT?Me.BINARY_EVENT:Me.BINARY_ACK,nsp:n.nsp,data:n.data,id:n.id}):[this.encodeAsString(n)]}encodeAsString(n){let i=""+n.type;return(n.type===Me.BINARY_EVENT||n.type===Me.BINARY_ACK)&&(i+=n.attachments+"-"),n.nsp&&n.nsp!=="/"&&(i+=n.nsp+","),n.id!=null&&(i+=n.id),n.data!=null&&(i+=JSON.stringify(n.data,this.replacer)),i}encodeAsBinary(n){const i=Dv(n),l=this.encodeAsString(i.packet),o=i.buffers;return o.unshift(l),o}}class Lf extends mt{constructor(n){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof n=="function"?{reviver:n}:n)}add(n){let i;if(typeof n=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");i=this.decodeString(n);const l=i.type===Me.BINARY_EVENT;l||i.type===Me.BINARY_ACK?(i.type=l?Me.EVENT:Me.ACK,this.reconstructor=new Gv(i),i.attachments===0&&super.emitReserved("decoded",i)):super.emitReserved("decoded",i)}else if(Bf(n)||n.base64)if(this.reconstructor)i=this.reconstructor.takeBinaryData(n),i&&(this.reconstructor=null,super.emitReserved("decoded",i));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+n)}decodeString(n){let i=0;const l={type:Number(n.charAt(0))};if(Me[l.type]===void 0)throw new Error("unknown packet type "+l.type);if(l.type===Me.BINARY_EVENT||l.type===Me.BINARY_ACK){const f=i+1;for(;n.charAt(++i)!=="-"&&i!=n.length;);const d=n.substring(f,i);if(d!=Number(d)||n.charAt(i)!=="-")throw new Error("Illegal attachments");const m=Number(d);if(!Yv(m)||m<0)throw new Error("Illegal attachments");if(m>this.opts.maxAttachments)throw new Error("too many attachments");l.attachments=m}if(n.charAt(i+1)==="/"){const f=i+1;for(;++i&&!(n.charAt(i)===","||i===n.length););l.nsp=n.substring(f,i)}else l.nsp="/";const o=n.charAt(i+1);if(o!==""&&Number(o)==o){const f=i+1;for(;++i;){const d=n.charAt(i);if(d==null||Number(d)!=d){--i;break}if(i===n.length)break}l.id=Number(n.substring(f,i+1))}if(n.charAt(++i)){const f=this.tryParse(n.substr(i));if(Lf.isPayloadValid(l.type,f))l.data=f;else throw new Error("invalid payload")}return l}tryParse(n){try{return JSON.parse(n,this.opts.reviver)}catch{return!1}}static isPayloadValid(n,i){switch(n){case Me.CONNECT:return c0(i);case Me.DISCONNECT:return i===void 0;case Me.CONNECT_ERROR:return typeof i=="string"||c0(i);case Me.EVENT:case Me.BINARY_EVENT:return Array.isArray(i)&&(typeof i[0]=="number"||typeof i[0]=="string"&&Lv.indexOf(i[0])===-1);case Me.ACK:case Me.BINARY_ACK:return Array.isArray(i)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Gv{constructor(n){this.packet=n,this.buffers=[],this.reconPack=n}takeBinaryData(n){if(this.buffers.push(n),this.buffers.length===this.reconPack.attachments){const i=Bv(this.reconPack,this.buffers);return this.finishedReconstruction(),i}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const Yv=Number.isInteger||function(a){return typeof a=="number"&&isFinite(a)&&Math.floor(a)===a};function c0(a){return Object.prototype.toString.call(a)==="[object Object]"}const Vv=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Lf,Encoder:Hv,get PacketType(){return Me}},Symbol.toStringTag,{value:"Module"}));function En(a,n,i){return a.on(n,i),function(){a.off(n,i)}}const Pv=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Z0 extends mt{constructor(n,i,l){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=n,this.nsp=i,l&&l.auth&&(this.auth=l.auth),this._opts=Object.assign({},l),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const n=this.io;this.subs=[En(n,"open",this.onopen.bind(this)),En(n,"packet",this.onpacket.bind(this)),En(n,"error",this.onerror.bind(this)),En(n,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...n){return n.unshift("message"),this.emit.apply(this,n),this}emit(n,...i){var l,o,f;if(Pv.hasOwnProperty(n))throw new Error('"'+n.toString()+'" is a reserved event name');if(i.unshift(n),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(i),this;const d={type:Me.EVENT,data:i};if(d.options={},d.options.compress=this.flags.compress!==!1,typeof i[i.length-1]=="function"){const N=this.ids++,O=i.pop();this._registerAckCallback(N,O),d.id=N}const m=(o=(l=this.io.engine)===null||l===void 0?void 0:l.transport)===null||o===void 0?void 0:o.writable,v=this.connected&&!(!((f=this.io.engine)===null||f===void 0)&&f._hasPingExpired());return this.flags.volatile&&!m||(v?(this.notifyOutgoingListeners(d),this.packet(d)):this.sendBuffer.push(d)),this.flags={},this}_registerAckCallback(n,i){var l;const o=(l=this.flags.timeout)!==null&&l!==void 0?l:this._opts.ackTimeout;if(o===void 0){this.acks[n]=i;return}const f=this.io.setTimeoutFn(()=>{delete this.acks[n];for(let m=0;m<this.sendBuffer.length;m++)this.sendBuffer[m].id===n&&this.sendBuffer.splice(m,1);i.call(this,new Error("operation has timed out"))},o),d=(...m)=>{this.io.clearTimeoutFn(f),i.apply(this,m)};d.withError=!0,this.acks[n]=d}emitWithAck(n,...i){return new Promise((l,o)=>{const f=(d,m)=>d?o(d):l(m);f.withError=!0,i.push(f),this.emit(n,...i)})}_addToQueue(n){let i;typeof n[n.length-1]=="function"&&(i=n.pop());const l={id:this._queueSeq++,tryCount:0,pending:!1,args:n,flags:Object.assign({fromQueue:!0},this.flags)};n.push((o,...f)=>(this._queue[0],o!==null?l.tryCount>this._opts.retries&&(this._queue.shift(),i&&i(o)):(this._queue.shift(),i&&i(null,...f)),l.pending=!1,this._drainQueue())),this._queue.push(l),this._drainQueue()}_drainQueue(n=!1){if(!this.connected||this._queue.length===0)return;const i=this._queue[0];i.pending&&!n||(i.pending=!0,i.tryCount++,this.flags=i.flags,this.emit.apply(this,i.args))}packet(n){n.nsp=this.nsp,this.io._packet(n)}onopen(){typeof this.auth=="function"?this.auth(n=>{this._sendConnectPacket(n)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(n){this.packet({type:Me.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},n):n})}onerror(n){this.connected||this.emitReserved("connect_error",n)}onclose(n,i){this.connected=!1,delete this.id,this.emitReserved("disconnect",n,i),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(n=>{if(!this.sendBuffer.some(l=>String(l.id)===n)){const l=this.acks[n];delete this.acks[n],l.withError&&l.call(this,new Error("socket has been disconnected"))}})}onpacket(n){if(n.nsp===this.nsp)switch(n.type){case Me.CONNECT:n.data&&n.data.sid?this.onconnect(n.data.sid,n.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Me.EVENT:case Me.BINARY_EVENT:this.onevent(n);break;case Me.ACK:case Me.BINARY_ACK:this.onack(n);break;case Me.DISCONNECT:this.ondisconnect();break;case Me.CONNECT_ERROR:this.destroy();const l=new Error(n.data.message);l.data=n.data.data,this.emitReserved("connect_error",l);break}}onevent(n){const i=n.data||[];n.id!=null&&i.push(this.ack(n.id)),this.connected?this.emitEvent(i):this.receiveBuffer.push(Object.freeze(i))}emitEvent(n){if(this._anyListeners&&this._anyListeners.length){const i=this._anyListeners.slice();for(const l of i)l.apply(this,n)}super.emit.apply(this,n),this._pid&&n.length&&typeof n[n.length-1]=="string"&&(this._lastOffset=n[n.length-1])}ack(n){const i=this;let l=!1;return function(...o){l||(l=!0,i.packet({type:Me.ACK,id:n,data:o}))}}onack(n){const i=this.acks[n.id];typeof i=="function"&&(delete this.acks[n.id],i.withError&&n.data.unshift(null),i.apply(this,n.data))}onconnect(n,i){this.id=n,this.recovered=i&&this._pid===i,this._pid=i,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(n=>this.emitEvent(n)),this.receiveBuffer=[],this.sendBuffer.forEach(n=>{this.notifyOutgoingListeners(n),this.packet(n)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(n=>n()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Me.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(n){return this.flags.compress=n,this}get volatile(){return this.flags.volatile=!0,this}timeout(n){return this.flags.timeout=n,this}onAny(n){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(n),this}prependAny(n){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(n),this}offAny(n){if(!this._anyListeners)return this;if(n){const i=this._anyListeners;for(let l=0;l<i.length;l++)if(n===i[l])return i.splice(l,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(n){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(n),this}prependAnyOutgoing(n){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(n),this}offAnyOutgoing(n){if(!this._anyOutgoingListeners)return this;if(n){const i=this._anyOutgoingListeners;for(let l=0;l<i.length;l++)if(n===i[l])return i.splice(l,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(n){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const i=this._anyOutgoingListeners.slice();for(const l of i)l.apply(this,n.data)}}}function _r(a){a=a||{},this.ms=a.min||100,this.max=a.max||1e4,this.factor=a.factor||2,this.jitter=a.jitter>0&&a.jitter<=1?a.jitter:0,this.attempts=0}_r.prototype.duration=function(){var a=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var n=Math.random(),i=Math.floor(n*this.jitter*a);a=(Math.floor(n*10)&1)==0?a-i:a+i}return Math.min(a,this.max)|0};_r.prototype.reset=function(){this.attempts=0};_r.prototype.setMin=function(a){this.ms=a};_r.prototype.setMax=function(a){this.max=a};_r.prototype.setJitter=function(a){this.jitter=a};class wf extends mt{constructor(n,i){var l;super(),this.nsps={},this.subs=[],n&&typeof n=="object"&&(i=n,n=void 0),i=i||{},i.path=i.path||"/socket.io",this.opts=i,Tc(this,i),this.reconnection(i.reconnection!==!1),this.reconnectionAttempts(i.reconnectionAttempts||1/0),this.reconnectionDelay(i.reconnectionDelay||1e3),this.reconnectionDelayMax(i.reconnectionDelayMax||5e3),this.randomizationFactor((l=i.randomizationFactor)!==null&&l!==void 0?l:.5),this.backoff=new _r({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(i.timeout==null?2e4:i.timeout),this._readyState="closed",this.uri=n;const o=i.parser||Vv;this.encoder=new o.Encoder,this.decoder=new o.Decoder,this._autoConnect=i.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(n){return arguments.length?(this._reconnection=!!n,n||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(n){return n===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=n,this)}reconnectionDelay(n){var i;return n===void 0?this._reconnectionDelay:(this._reconnectionDelay=n,(i=this.backoff)===null||i===void 0||i.setMin(n),this)}randomizationFactor(n){var i;return n===void 0?this._randomizationFactor:(this._randomizationFactor=n,(i=this.backoff)===null||i===void 0||i.setJitter(n),this)}reconnectionDelayMax(n){var i;return n===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=n,(i=this.backoff)===null||i===void 0||i.setMax(n),this)}timeout(n){return arguments.length?(this._timeout=n,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(n){if(~this._readyState.indexOf("open"))return this;this.engine=new Mv(this.uri,this.opts);const i=this.engine,l=this;this._readyState="opening",this.skipReconnect=!1;const o=En(i,"open",function(){l.onopen(),n&&n()}),f=m=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",m),n?n(m):this.maybeReconnectOnOpen()},d=En(i,"error",f);if(this._timeout!==!1){const m=this._timeout,v=this.setTimeoutFn(()=>{o(),f(new Error("timeout")),i.close()},m);this.opts.autoUnref&&v.unref(),this.subs.push(()=>{this.clearTimeoutFn(v)})}return this.subs.push(o),this.subs.push(d),this}connect(n){return this.open(n)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const n=this.engine;this.subs.push(En(n,"ping",this.onping.bind(this)),En(n,"data",this.ondata.bind(this)),En(n,"error",this.onerror.bind(this)),En(n,"close",this.onclose.bind(this)),En(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(n){try{this.decoder.add(n)}catch(i){this.onclose("parse error",i)}}ondecoded(n){Oc(()=>{this.emitReserved("packet",n)},this.setTimeoutFn)}onerror(n){this.emitReserved("error",n)}socket(n,i){let l=this.nsps[n];return l?this._autoConnect&&!l.active&&l.connect():(l=new Z0(this,n,i),this.nsps[n]=l),l}_destroy(n){const i=Object.keys(this.nsps);for(const l of i)if(this.nsps[l].active)return;this._close()}_packet(n){const i=this.encoder.encode(n);for(let l=0;l<i.length;l++)this.engine.write(i[l],n.options)}cleanup(){this.subs.forEach(n=>n()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(n,i){var l;this.cleanup(),(l=this.engine)===null||l===void 0||l.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",n,i),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const n=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const i=this.backoff.duration();this._reconnecting=!0;const l=this.setTimeoutFn(()=>{n.skipReconnect||(this.emitReserved("reconnect_attempt",n.backoff.attempts),!n.skipReconnect&&n.open(o=>{o?(n._reconnecting=!1,n.reconnect(),this.emitReserved("reconnect_error",o)):n.onreconnect()}))},i);this.opts.autoUnref&&l.unref(),this.subs.push(()=>{this.clearTimeoutFn(l)})}}onreconnect(){const n=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",n)}}const ga={};function uc(a,n){typeof a=="object"&&(n=a,a=void 0),n=n||{};const i=kv(a,n.path||"/socket.io"),l=i.source,o=i.id,f=i.path,d=ga[o]&&f in ga[o].nsps,m=n.forceNew||n["force new connection"]||n.multiplex===!1||d;let v;return m?v=new wf(l,n):(ga[o]||(ga[o]=new wf(l,n)),v=ga[o]),i.query&&!n.query&&(n.query=i.queryKey),v.socket(i.path,n)}Object.assign(uc,{Manager:wf,Socket:Z0,io:uc,connect:uc});const Jv=Q.createContext({connected:!1,subscribe:()=>()=>{}});function Qv({children:a}){const n=Q.useRef(null),[i,l]=Q.useState(!1),o=Q.useRef(new Map),f=Q.useCallback((m,v)=>{const S=o.current;return S.has(m)||S.set(m,new Set),S.get(m).add(v),()=>{const N=S.get(m);N&&(N.delete(v),N.size===0&&S.delete(m))}},[]),d=Q.useCallback((m,v)=>{for(const[S,N]of o.current)if(D0(m,S))for(const O of N)try{O(v)}catch{}},[]);return Q.useEffect(()=>{const m=uc({path:"/socket.io",transports:["polling","websocket"],upgrade:!0,reconnection:!0,reconnectionAttempts:1/0,reconnectionDelay:2e3});return n.current=m,console.log("[lt-socketio] connecting..."),m.on("connect",()=>{console.log("[lt-socketio] connected, id:",m.id),l(!0)}),m.on("disconnect",v=>{console.log("[lt-socketio] disconnected:",v),l(!1)}),m.on("connect_error",v=>{console.warn("[lt-socketio] connect error:",v.message),l(!1)}),m.onAny((v,S)=>{if(v.startsWith("lt."))try{const N=typeof S=="string"?JSON.parse(S):S;d(v,N)}catch{}}),()=>{m.removeAllListeners(),m.disconnect(),n.current=null,l(!1)}},[d]),g.jsx(Jv.Provider,{value:{connected:i,subscribe:f},children:g.jsx(Ac.Provider,{value:{connected:i,subscribe:f},children:a})})}function Xv({children:a}){const[n,i]=Q.useState(null);return Q.useEffect(()=>{let l=!1;async function o(){var f;try{console.log("[lt-transport] detecting event transport...");const d=await fetch("/api/settings");if(!d.ok){console.warn("[lt-transport] settings fetch failed, falling back to socketio"),l||i("socketio");return}const m=await d.json(),v=(f=m==null?void 0:m.events)==null?void 0:f.transport;console.log("[lt-transport] server reports:",v),l||i(v==="nats"?"nats":"socketio")}catch(d){console.warn("[lt-transport] settings fetch error, falling back to socketio",d),l||i("socketio")}}return o(),()=>{l=!0}},[]),n==="nats"?g.jsx(Z1,{children:a}):n==="socketio"?g.jsx(Qv,{children:a}):g.jsx(g.Fragment,{children:a})}const I0=Q.createContext(null),o0="lt_sidebar_collapsed";function $v({children:a}){const[n,i]=Q.useState(()=>{try{return localStorage.getItem(o0)==="true"}catch{return!1}}),l=Q.useCallback(()=>{i(o=>{const f=!o;try{localStorage.setItem(o0,String(f))}catch{}return f})},[]);return g.jsx(I0.Provider,{value:{collapsed:n,toggle:l},children:a})}function W0(){const a=Q.useContext(I0);if(!a)throw new Error("useSidebar must be used within SidebarProvider");return a}function o2(a){const n=a?`?period=${a}`:"";return yr({queryKey:["escalationStats",a],queryFn:()=>Et(`/escalations/stats${n}`)})}function u2(){return yr({queryKey:["escalationTypes"],queryFn:()=>Et("/escalations/types")})}function Kv(a){const n=new URLSearchParams;return a.status&&n.set("status",a.status),a.role&&n.set("role",a.role),a.type&&n.set("type",a.type),a.subtype&&n.set("subtype",a.subtype),a.assigned_to&&n.set("assigned_to",a.assigned_to),a.priority&&n.set("priority",String(a.priority)),a.limit&&n.set("limit",String(a.limit)),a.offset!==void 0&&n.set("offset",String(a.offset)),a.sort_by&&n.set("sort_by",a.sort_by),a.order&&n.set("order",a.order),yr({queryKey:["escalations",a],queryFn:()=>Et(`/escalations?${n}`)})}function f2(a){return yr({queryKey:["escalations","by-workflow",a],queryFn:()=>Et(`/escalations/by-workflow/${a}`),enabled:!!a})}function h2(a){return yr({queryKey:["escalations",a],queryFn:()=>Et(`/escalations/${a}`),enabled:!!a})}function d2(){const a=Tn();return Dn({mutationFn:({id:n,durationMinutes:i})=>Et(`/escalations/${n}/claim`,{method:"POST",body:JSON.stringify({durationMinutes:i})}),onSuccess:()=>{a.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),a.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function m2(){const a=Tn();return Dn({mutationFn:n=>Et(`/escalations/${n}/release`,{method:"POST"}),onSuccess:()=>{a.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),a.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function p2(){const a=Tn();return Dn({mutationFn:({id:n,resolverPayload:i})=>Et(`/escalations/${n}/resolve`,{method:"POST",body:JSON.stringify({resolverPayload:i})}),onSuccess:()=>{a.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),a.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"}),a.invalidateQueries({queryKey:["tasks"],refetchType:"all"}),a.invalidateQueries({queryKey:["jobs"],refetchType:"all"})}})}function y2(){const a=Tn();return Dn({mutationFn:({id:n,targetRole:i})=>Et(`/escalations/${n}/escalate`,{method:"PATCH",body:JSON.stringify({targetRole:i})}),onSuccess:()=>{a.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),a.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function g2(){const a=Tn();return Dn({mutationFn:({ids:n,priority:i})=>Et("/escalations/priority",{method:"PATCH",body:JSON.stringify({ids:n,priority:i})}),onSuccess:()=>{a.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),a.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function b2(){const a=Tn();return Dn({mutationFn:({ids:n,durationMinutes:i})=>Et("/escalations/bulk-claim",{method:"POST",body:JSON.stringify({ids:n,durationMinutes:i})}),onSuccess:()=>{a.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),a.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function _2(){const a=Tn();return Dn({mutationFn:({ids:n,targetUserId:i,durationMinutes:l})=>Et("/escalations/bulk-assign",{method:"POST",body:JSON.stringify({ids:n,targetUserId:i,durationMinutes:l})}),onSuccess:()=>{a.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),a.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function v2(){const a=Tn();return Dn({mutationFn:({ids:n,targetRole:i})=>Et("/escalations/bulk-escalate",{method:"PATCH",body:JSON.stringify({ids:n,targetRole:i})}),onSuccess:()=>{a.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),a.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function x2(){const a=Tn();return Dn({mutationFn:({ids:n,hint:i})=>Et("/escalations/bulk-triage",{method:"POST",body:JSON.stringify({ids:n,...i?{hint:i}:{}})}),onSuccess:()=>{a.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),a.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function Fv(){const{user:a}=bi(),n=a==null?void 0:a.userId,i=Tn(),{data:l}=Kv({assigned_to:n,status:"pending"});B0(`${X1}.escalation.>`,()=>{n&&i.invalidateQueries({queryKey:["escalations"]})});const o=new Date;return((l==null?void 0:l.escalations)??[]).filter(d=>d.assigned_until&&new Date(d.assigned_until)>o).length}function Zv({className:a="",onClick:n}){const{connected:i}=$1();return g.jsxs("button",{type:"button",onClick:n,className:`relative text-text-tertiary hover:text-accent transition-colors ${a}`,title:i?"Live events enabled":"Live events disconnected","aria-label":i?"Live events enabled":"Live events disconnected",children:[g.jsx(bb,{className:"w-4 h-4",strokeWidth:1.5}),g.jsx("span",{className:`absolute -top-1 -right-1 w-2 h-2 rounded-full ${i?"bg-emerald-500":"bg-text-tertiary"}`,"data-testid":"nats-status-dot"})]})}function Hf({size:a="sm",hideLabel:n=!1}){const i=a==="lg",l=i?"w-[16rem] h-[16rem] -rotate-[120deg] opacity-40 -ml-10":"w-[12.5rem] h-[12.5rem] -rotate-[120deg] opacity-40 -ml-8",o=i?"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 g.jsxs("div",{className:"flex items-center",style:{height:"50px"},children:[g.jsx("img",{src:"/logo512.png",alt:"LongTail",className:`shrink-0 z-0 ${l}`}),g.jsx("span",{className:`z-[1] transition-opacity duration-300 ${o} ${n?"opacity-0":""}`,children:"LongTail"})]})}function Iv({onToggleEventFeed:a}){const{user:n,logout:i}=bi(),l=Fv(),[o,f]=Q.useState(!1),d=Q.useRef(null);return Q.useEffect(()=>{if(!o)return;const m=v=>{d.current&&!d.current.contains(v.target)&&f(!1)};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[o]),g.jsxs("header",{className:"h-14 shrink-0 border-b border-surface-border bg-surface-raised flex items-center justify-between px-5 relative z-30",children:[g.jsx(Lu,{to:"/","aria-label":"Home",children:g.jsx(Hf,{})}),g.jsxs("div",{className:"flex items-center gap-4",children:[g.jsxs(Lu,{to:"/escalations/queue",className:"relative text-text-tertiary hover:text-accent transition-colors","aria-label":"Escalation inbox",title:"Escalation inbox",children:[g.jsx(_b,{className:"w-4 h-4",strokeWidth:1.5}),g.jsx("span",{className:`absolute -top-1 -right-1 w-2 h-2 rounded-full ${l>0?"bg-status-warning":"bg-text-tertiary"}`}),g.jsx("span",{className:`absolute -top-2.5 -right-3 text-[8px] font-bold tabular-nums ${l>0?"text-status-warning":"text-text-tertiary"}`,children:l})]}),g.jsx(Zv,{onClick:a}),n&&g.jsxs("div",{className:"relative",ref:d,children:[g.jsxs("button",{onClick:()=>f(m=>!m),className:"btn-ghost text-xs flex items-center gap-1",children:[g.jsx(vb,{className:"w-3.5 h-3.5 text-accent/75",strokeWidth:1.5}),n.displayName||n.username||n.userId,g.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),o&&g.jsxs("div",{className:"absolute right-0 top-full mt-1 w-48 bg-surface-raised border border-surface-border rounded-md shadow-lg py-1 z-50",children:[g.jsx(Lu,{to:"/credentials",onClick:()=>f(!1),className:"block px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Credentials"}),g.jsx("button",{onClick:()=>{f(!1),i()},className:"block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Sign Out"})]})]})]})]})}function Gf({open:a,children:n}){const[i,l]=Q.useState(a);return Q.useEffect(()=>{a&&l(!0)},[a]),g.jsx("div",{className:`grid transition-[grid-template-rows] duration-300 ease-out ${a?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,onTransitionEnd:()=>{a||l(!1)},children:g.jsx("div",{className:"overflow-hidden",children:i?n:null})})}function Ef(a){return({isActive:n})=>{const i="flex items-center rounded-md transition-colors duration-150",l="bg-surface-hover text-text-primary font-medium",o="text-text-secondary hover:text-text-primary hover:bg-surface-hover";return a?`${i} justify-center w-10 h-10 mx-auto ${n?l:o}`:`${i} gap-3 px-4 py-2 text-sm ${n?l:o}`}}function Wv(){return({isActive:a})=>`flex items-center gap-3 pl-11 pr-4 py-1.5 text-xs rounded-md transition-colors duration-150 ${a?"text-text-primary font-medium":"text-text-secondary hover:text-text-primary"}`}function ex({group:a,collapsed:n}){const{pathname:i}=gr(),l=a.matchPaths.some(m=>i.startsWith(m)),[o,f]=Q.useState(l),d=o||l;return n?g.jsx(g.Fragment,{children:a.items.map(m=>g.jsx(hc,{to:m.to,className:Ef(!0),title:m.label,children:m.icon&&g.jsx(m.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})},m.to))}):g.jsxs("div",{children:[g.jsxs("button",{onClick:()=>f(m=>!m),className:"w-full flex items-center justify-between px-4 py-2 text-sm rounded-md transition-colors duration-150 text-text-secondary hover:text-text-primary hover:bg-surface-hover",children:[g.jsxs("span",{className:"flex items-center gap-3",children:[a.icon&&g.jsx(a.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),g.jsx("span",{children:a.label})]}),g.jsx("svg",{className:`w-3.5 h-3.5 text-text-tertiary transition-transform duration-150 ${d?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),g.jsx(Gf,{open:d,children:a.items.map(m=>g.jsxs(hc,{to:m.to,end:m.end,className:Wv(),children:[m.icon&&g.jsx(m.icon,{className:"w-4 h-4 shrink-0 text-accent/75",strokeWidth:1.5}),g.jsx("span",{children:m.label})]},m.to))})]})}function tx(a){return a.kind==="group"}function nx({entry:a,collapsed:n}){const{pathname:i,search:l}=gr();if(a.to.includes("?")){const[f,d]=a.to.split("?"),m=i===f&&l===`?${d}`,v=Ef(n)({isActive:m});return g.jsxs(hc,{to:a.to,className:v,title:n?a.label:void 0,children:[a.icon&&g.jsx(a.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),!n&&g.jsx("span",{children:a.label})]})}return g.jsxs(hc,{to:a.to,end:a.end,className:Ef(n),title:n?a.label:void 0,children:[a.icon&&g.jsx(a.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),!n&&g.jsx("span",{children:a.label})]})}function Yf({heading:a,entries:n}){const{collapsed:i}=W0();return g.jsxs("div",{className:"space-y-1",children:[i?g.jsx("div",{className:"h-px bg-surface-border mx-3 my-2",title:a}):g.jsx("p",{className:"px-4 py-2 text-[10px] font-semibold uppercase tracking-widest text-text-tertiary",children:a}),n.map(l=>tx(l)?g.jsx(ex,{group:l,collapsed:i},l.label):g.jsx(nx,{entry:l,collapsed:i},l.to))]})}const sx=[{to:"/admin/users",label:"Accounts",icon:xb},{to:"/admin/roles",label:"Roles & Permissions",icon:Sb},{to:"/admin/maintenance",label:"DB Maintenance",icon:wb},{to:"/admin/controlplane",label:"Task Queues",icon:Eb}];function ix(){return g.jsx(Yf,{heading:"Admin",entries:sx})}const rx=[{to:"/workflows/registry",label:"Workflow Registry",icon:Ab},{to:"/workflows/start",label:"Invoke Workflow",icon:Ob},{to:"/escalations/available",label:"All Escalations",icon:Tb},{to:"/workflows/executions",label:"Durable Executions",icon:y0}];function ax(){return g.jsx(Yf,{heading:"Durable Workflows",entries:rx})}const lx=[{to:"/mcp/servers",label:"MCP Server Tools",icon:jb},{to:"/mcp/workflows",label:"MCP Pipeline Tools",icon:Nb},{to:"/mcp/queries",label:"Pipeline Designer",icon:Cb},{to:"/mcp/executions",label:"Pipeline Executions",icon:y0}];function cx(){return g.jsx(Yf,{heading:"MCP Workflows",entries:lx})}function ox({children:a,className:n=""}){return g.jsx("p",{className:`text-[10px] font-semibold uppercase tracking-widest text-text-tertiary ${n}`,children:a})}function ux({className:a}){return g.jsx("svg",{className:a,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M4 12h8M4 18h12"})})}function fx({className:a}){return g.jsx("svg",{className:a,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 7l-5 5 5 5M16 7l5 5-5 5"})})}function hx({className:a}){return g.jsx("svg",{className:a,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:g.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 dx({className:a}){return g.jsx("svg",{className:a,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}function mx({className:a}){return g.jsx("svg",{className:a,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:g.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 px({className:a}){return g.jsx("svg",{className:a,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:g.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 Af({data:a,depth:n=0,generation:i}){const o=i!==void 0&&i>0&&i%2===1?!1:n>0,[f,d]=Q.useState(o),[m,v]=Q.useState(i);if(i!==void 0&&i!==m&&(v(i),d(i%2===0&&n>0)),a==null)return g.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof a=="string")return g.jsxs("span",{className:"text-text-primary",children:['"',a,'"']});if(typeof a=="number"||typeof a=="boolean")return g.jsx("span",{className:"text-text-primary font-medium",children:String(a)});if(Array.isArray(a))return a.length===0?g.jsx("span",{className:"text-text-tertiary",children:"[]"}):f?g.jsxs("button",{onClick:()=>d(!1),className:"text-text-secondary hover:text-text-primary",children:["[",a.length," items]"]}):g.jsxs("span",{children:[g.jsx("button",{onClick:()=>d(!0),className:"text-text-tertiary hover:text-text-primary",children:"["}),g.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:a.map((S,N)=>g.jsxs("div",{children:[g.jsx(Af,{data:S,depth:n+1,generation:i}),N<a.length-1&&g.jsx("span",{className:"text-text-tertiary",children:","})]},N))}),g.jsx("span",{className:"text-text-tertiary",children:"]"})]});if(typeof a=="object"){const S=Object.entries(a);return S.length===0?g.jsx("span",{className:"text-text-tertiary",children:"{}"}):f?g.jsxs("button",{onClick:()=>d(!1),className:"text-text-secondary hover:text-text-primary",children:["{","...","}"]}):g.jsxs("span",{children:[g.jsx("button",{onClick:()=>d(!0),className:"text-text-tertiary hover:text-text-primary",children:"{"}),g.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:S.map(([N,O],M)=>g.jsxs("div",{children:[g.jsx("span",{className:"text-text-secondary",children:N}),g.jsx("span",{className:"text-text-tertiary",children:": "}),g.jsx(Af,{data:O,depth:n+1,generation:i}),M<S.length-1&&g.jsx("span",{className:"text-text-tertiary",children:","})]},N))}),g.jsx("span",{className:"text-text-tertiary",children:"}"})]})}return g.jsx("span",{children:String(a)})}function fc({data:a,depth:n=0}){if(a==null)return g.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof a=="string")return g.jsx("span",{className:"text-text-primary",children:a});if(typeof a=="number"||typeof a=="boolean")return g.jsx("span",{className:"text-text-primary font-medium",children:String(a)});if(Array.isArray(a))return a.length===0?g.jsx("span",{className:"text-text-tertiary italic",children:"empty list"}):g.jsx("div",{className:"space-y-2",children:a.map((i,l)=>g.jsxs("div",{className:"flex items-baseline gap-2",children:[g.jsxs("span",{className:"text-text-tertiary text-[10px] shrink-0",children:[l+1,"."]}),g.jsx("div",{className:"flex-1",children:g.jsx(fc,{data:i,depth:n+1})})]},l))});if(typeof a=="object"){const i=Object.entries(a);return i.length===0?g.jsx("span",{className:"text-text-tertiary italic",children:"empty"}):g.jsx("div",{className:n>0?"pl-4 border-l border-surface-border space-y-3":"space-y-3",children:i.map(([l,o])=>{const f=o===null||typeof o!="object";return g.jsxs("div",{children:[g.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-0.5",children:l.replace(/[_-]/g," ")}),f?g.jsx("p",{className:"text-sm text-text-primary",children:g.jsx(fc,{data:o,depth:n+1})}):g.jsx(fc,{data:o,depth:n+1})]},l)})})}return g.jsx("span",{children:String(a)})}function yx({data:a,label:n,variant:i,defaultCollapsed:l=!1,defaultMode:o}){const[f,d]=Q.useState(o??"json"),[m,v]=Q.useState(!1),[S,N]=Q.useState(0),O=S%2===0,M=Q.useCallback(()=>N(be=>be+1),[]);let G=a;if(typeof a=="string")try{G=JSON.parse(a)}catch{}const $=async()=>{const be=typeof a=="string"?a:JSON.stringify(G,null,2);await navigator.clipboard.writeText(be),v(!0),setTimeout(()=>v(!1),2e3)},W="p-1.5 rounded text-text-tertiary hover:text-text-primary hover:bg-surface-raised transition-colors duration-150",de=i==="panel",ye=de?"border border-accent-muted/40 rounded-lg p-3 bg-surface-hover/30":"",ie=de?"font-mono text-xs leading-relaxed bg-white rounded-md p-4 overflow-x-auto":"font-mono text-xs leading-relaxed bg-surface-sunken rounded-md p-4 overflow-x-auto";return g.jsxs("div",{className:ye,children:[g.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n?g.jsx(ox,{children:n}):g.jsx("span",{}),g.jsxs("div",{className:"flex items-center gap-1",children:[f==="json"&&g.jsx("button",{onClick:M,className:W,title:O?"Expand all":"Collapse all",children:O?g.jsx(px,{className:"w-3.5 h-3.5"}):g.jsx(mx,{className:"w-3.5 h-3.5"})}),g.jsx("button",{onClick:()=>d(f==="json"?"tree":"json"),className:W,title:f==="json"?"Switch to outline view":"Switch to JSON view",children:f==="json"?g.jsx(ux,{className:"w-3.5 h-3.5"}):g.jsx(fx,{className:"w-3.5 h-3.5"})}),g.jsx("button",{onClick:$,className:W,title:"Copy to clipboard",children:m?g.jsx(dx,{className:"w-3.5 h-3.5 text-status-success"}):g.jsx(hx,{className:"w-3.5 h-3.5"})})]})]}),g.jsx("div",{className:ie,children:f==="json"?g.jsx(Af,{data:G,generation:S}):g.jsx(fc,{data:G})})]})}const gx=100,u0=500;let bx=0;const ey={"escalation.created":"text-status-warning","escalation.claimed":"text-blue-400","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-blue-400","activity.completed":"text-status-success","activity.failed":"text-status-error",milestone:"text-violet-400"};function _x({event:a}){var o,f;const[n,i]=Q.useState(!1),l=ey[a.type]||"text-text-tertiary";return g.jsxs("div",{className:"border-b border-surface-border/30 last:border-b-0",children:[g.jsxs("button",{onClick:()=>i(!n),className:"flex items-center gap-2 py-1 w-full text-left hover:bg-surface-hover/50 transition-colors px-3",children:[g.jsx("span",{className:"text-[9px] font-mono text-text-tertiary whitespace-nowrap tabular-nums shrink-0",children:new Date(a.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}),g.jsx("span",{className:`text-[9px] font-medium px-1 py-0.5 rounded ${l} bg-surface-sunken whitespace-nowrap shrink-0`,children:a.type}),g.jsxs("span",{className:"text-[9px] text-text-tertiary font-mono flex-1 min-w-0 truncate",children:[(o=a.data)!=null&&o.workflowId?String(a.data.workflowId):"",(f=a.data)!=null&&f.escalationId?` esc:${String(a.data.escalationId).slice(0,12)}`:""]}),g.jsx("svg",{className:`w-2.5 h-2.5 text-text-tertiary shrink-0 transition-transform duration-150 ${n?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),g.jsx(Gf,{open:n,children:g.jsx("div",{className:"pb-2 px-3",children:g.jsx(yx,{data:a.data})})})]})}function vx({open:a,onToggle:n}){const[i,l]=Q.useState([]),o=Q.useRef(null),f=Q.useRef(new Map);return B0("lt.events.>",Q.useCallback(d=>{const m=String(d.type||"unknown");if(m.startsWith("mesh."))return;const v=`${m}:${d.timestamp||""}:${d.escalationId||d.workflowId||d.taskId||""}`,S=Date.now(),N=f.current.get(v);if(!(N&&S-N<u0)){if(f.current.set(v,S),f.current.size>200)for(const[O,M]of f.current)S-M>u0*2&&f.current.delete(O);l(O=>[{id:++bx,type:m,timestamp:d.timestamp||new Date().toISOString(),data:d},...O].slice(0,gx))}},[])),Q.useEffect(()=>{a&&o.current&&(o.current.scrollTop=0)},[i.length,a]),g.jsxs("div",{className:"fixed bottom-0 left-0 right-0 z-40 border-t border-surface-border bg-surface-raised",children:[g.jsxs("button",{onClick:n,className:"flex items-center gap-2 w-full px-4 py-1.5 text-left hover:bg-surface-hover transition-colors",children:[a?g.jsx(Mb,{className:"w-3 h-3 text-text-tertiary"}):g.jsx(kb,{className:"w-3 h-3 text-text-tertiary"}),g.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary",children:"Event Stream"}),i.length>0&&g.jsxs("span",{className:"text-[9px] text-text-tertiary",children:[i.length," events"]}),i.length>0&&!a&&g.jsx("span",{className:`text-[9px] font-medium px-1 py-0.5 rounded ${ey[i[0].type]||"text-text-tertiary"} bg-surface-sunken`,children:i[0].type}),i.length>0&&g.jsx("span",{className:"ml-auto text-text-tertiary hover:text-text-primary p-0.5",title:"Clear events",onClick:d=>{d.stopPropagation(),l([])},children:g.jsx(Rb,{className:"w-3 h-3"})})]}),g.jsx(Gf,{open:a,children:g.jsx("div",{ref:o,className:"h-48 overflow-y-auto",children:i.length===0?g.jsx("p",{className:"text-[10px] text-text-tertiary py-4 text-center",children:"Waiting for events..."}):i.map(d=>g.jsx(_x,{event:d},d.id))})})]})}function xx(){const{isSuperAdmin:a,hasRoleType:n,hasRole:i}=bi(),{collapsed:l,toggle:o}=W0(),[f,d]=Q.useState(!1),m=gr(),v=Q.useRef(null);return Q.useEffect(()=>{const S=v.current;S&&(S.classList.remove("animate-page-in"),S.offsetWidth,S.classList.add("animate-page-in"))},[m.pathname]),g.jsxs("div",{className:"h-screen bg-surface flex flex-col",style:{"--feed-height":f?"224px":"32px"},children:[g.jsx(Iv,{onToggleEventFeed:()=>d(S=>!S)}),g.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[g.jsxs("aside",{className:`${l?"w-16":"w-60"} shrink-0 bg-surface-raised border-r border-surface-border flex flex-col transition-[width] duration-200 ease-out overflow-hidden relative z-20`,children:[g.jsxs("nav",{className:"flex-1 px-3 pt-[36px] pb-4 space-y-2 overflow-y-auto overflow-x-hidden",children:[(a||n("admin")||i("engineer"))&&g.jsx(ax,{}),(a||n("admin")||i("engineer"))&&g.jsx(cx,{}),(a||n("admin"))&&g.jsx(ix,{})]}),g.jsx("button",{onClick:o,className:`shrink-0 py-3 text-text-tertiary hover:text-text-secondary transition-colors duration-150 ${l?"flex justify-center":"flex items-center px-7"}`,"aria-label":l?"Expand sidebar":"Collapse sidebar",children:l?g.jsx(zb,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5}):g.jsx(Ub,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5})})]}),g.jsx("main",{className:"flex-1 overflow-y-auto",children:g.jsx("div",{ref:v,className:`max-w-dashboard mx-auto px-10 py-10 animate-page-in ${f?"pb-60":"pb-16"}`,children:g.jsx(ic,{})})})]}),g.jsx(vx,{open:f,onToggle:()=>d(S=>!S)})]})}function Sx(){const{isAuthenticated:a}=bi(),n=gr();return a?g.jsx($v,{children:g.jsx(xx,{})}):g.jsx(Hs,{to:"/login",state:{from:n.pathname},replace:!0})}function ty({provider:a,className:n="w-5 h-5"}){switch(a){case"google":return g.jsxs("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:[g.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"}),g.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"}),g.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"}),g.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 g.jsx("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:g.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 g.jsxs("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:[g.jsx("path",{d:"M3 3h8.5v8.5H3z",fill:"#F25022"}),g.jsx("path",{d:"M12.5 3H21v8.5h-8.5z",fill:"#7FBA00"}),g.jsx("path",{d:"M3 12.5h8.5V21H3z",fill:"#00A4EF"}),g.jsx("path",{d:"M12.5 12.5H21V21h-8.5z",fill:"#FFB900"})]});case"anthropic":return g.jsx("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:g.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 g.jsxs("svg",{className:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[g.jsx("circle",{cx:"12",cy:"12",r:"10"}),g.jsx("path",{d:"M12 8v4l3 3"})]})}}async function wx(){return Et("/auth/oauth/providers")}async function Ex(a,n){const i=n?`?label=${encodeURIComponent(n)}`:"";return Et(`/auth/oauth/connections/${a}${i}`,{method:"DELETE"})}function S2(){return yr({queryKey:["oauth-connections"],queryFn:()=>Et("/auth/oauth/connections")})}function w2(){const a=Tn();return Dn({mutationFn:({provider:n,label:i})=>Ex(n,i),onSuccess:()=>{a.invalidateQueries({queryKey:["oauth-connections"]})}})}function Ax(){var F;const{login:a,isAuthenticated:n}=bi(),i=p0(),l=gr(),o=new URLSearchParams(l.search),f=o.get("token"),d=o.get("error"),m=((F=l.state)==null?void 0:F.from)??o.get("returnTo")??"/",v=Q.useRef(!1);f&&!v.current&&(v.current=!0,a(f,void 0,{displayName:o.get("displayName"),username:o.get("username")}));const[S,N]=Q.useState(""),[O,M]=Q.useState(""),[G,$]=Q.useState(d||""),[W,de]=Q.useState(!1),[ye,ie]=Q.useState(!!f),[be,Xe]=Q.useState([]);if(Q.useEffect(()=>{f||wx().then(Xe).catch(()=>{})},[]),Q.useEffect(()=>{if(!ye)return;const ne=setTimeout(()=>i(m,{replace:!0}),1500);return()=>clearTimeout(ne)},[ye]),n&&!ye)return g.jsx(Hs,{to:m,replace:!0});const B=async ne=>{var Z,X;if(ne.preventDefault(),$(""),!S.trim()||!O){$("Username and password are required");return}de(!0);try{const ae=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:S.trim(),password:O})}),ue=await ae.json();if(!ae.ok){$(ue.error||"Login failed");return}ie(!0),a(ue.token,{username:S.trim(),password:O},{displayName:(Z=ue.user)==null?void 0:Z.display_name,username:(X=ue.user)==null?void 0:X.external_id})}catch{$("Unable to connect to server")}finally{de(!1)}};return g.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center overflow-hidden",children:g.jsxs("div",{className:"w-full max-w-md p-10",children:[g.jsx("div",{className:`mb-10 transition-all duration-[1500ms] ease-in ${ye?"translate-x-[120vw] -translate-y-[60vh] scale-[3] opacity-0":""}`,children:g.jsx(Hf,{size:"lg",hideLabel:ye})}),g.jsxs("form",{onSubmit:B,className:`space-y-5 transition-opacity duration-300 ${ye?"opacity-0":""}`,children:[g.jsxs("div",{children:[g.jsx("label",{htmlFor:"username",className:"block text-sm font-medium text-text-secondary mb-2",children:"Username"}),g.jsx("input",{id:"username",type:"text",value:S,onChange:ne=>N(ne.target.value),className:"input",placeholder:"Enter your username",autoFocus:!ye,autoComplete:"username"})]}),g.jsxs("div",{children:[g.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-text-secondary mb-2",children:"Password"}),g.jsx("input",{id:"password",type:"password",value:O,onChange:ne=>M(ne.target.value),className:"input",placeholder:"Enter your password",autoComplete:"current-password"})]}),G&&g.jsx("p",{className:"text-sm text-status-error",children:G}),g.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:W||ye,children:W?"Signing in...":"Sign In"}),be.length>0&&g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"flex items-center gap-3 mt-6",children:[g.jsx("div",{className:"flex-1 h-px bg-border"}),g.jsx("span",{className:"text-xs text-text-tertiary",children:"or continue with"}),g.jsx("div",{className:"flex-1 h-px bg-border"})]}),g.jsx("div",{className:"space-y-2",children:be.filter(ne=>ne.provider!=="anthropic").map(ne=>g.jsxs("a",{href:`/api/auth/oauth/${ne.provider}?returnTo=${encodeURIComponent(m)}`,className:"btn-secondary w-full flex items-center justify-center gap-2",children:[g.jsx(ty,{provider:ne.provider}),"Sign in with ",ne.name]},ne.provider))})]})]})]})})}function f0(){const{isAuthenticated:a}=bi(),n=p0(),i=gr(),l=new URLSearchParams(i.search),o=l.get("state")||"";Q.useEffect(()=>{a||n(`/login?returnTo=${encodeURIComponent(i.pathname+i.search)}`)},[a]);const[f,d]=Q.useState(""),[m,v]=Q.useState(l.get("label")||"default"),[S,N]=Q.useState(""),[O,M]=Q.useState(!1),G=f.trim().startsWith("sk-ant-oat"),$=f.trim().startsWith("sk-ant-api"),W=de=>{de.preventDefault();const ye=f.trim();if(!ye){N("A token or API key is required");return}if(!ye.startsWith("sk-ant-")){N('Invalid format. Must start with "sk-ant-oat" (OAuth token) or "sk-ant-api" (API key)');return}M(!0),N("");const ie=`/api/auth/oauth/anthropic/callback?code=${encodeURIComponent(ye)}&state=${encodeURIComponent(o)}`;window.location.href=ie};return g.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center",children:g.jsxs("div",{className:"w-full max-w-md p-10",children:[g.jsx("div",{className:"mb-10",children:g.jsx(Hf,{size:"lg"})}),g.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[g.jsx(ty,{provider:"anthropic",className:"w-6 h-6"}),g.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:"Connect Anthropic"})]}),g.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."}),g.jsxs("form",{onSubmit:W,className:"space-y-5",children:[g.jsxs("div",{children:[g.jsx("label",{htmlFor:"token",className:"block text-sm font-medium text-text-secondary mb-2",children:"OAuth Token or API Key"}),g.jsx("input",{id:"token",type:"password",value:f,onChange:de=>d(de.target.value),className:"input",placeholder:"sk-ant-oat01-... or sk-ant-api03-...",autoFocus:!0,autoComplete:"off"}),G&&g.jsx("p",{className:"text-xs text-status-success mt-1",children:"OAuth token detected — uses your Claude subscription (flat rate)"}),$&&g.jsx("p",{className:"text-xs text-status-warning mt-1",children:"API key detected — billed per-token from your Anthropic API account"})]}),g.jsxs("div",{children:[g.jsx("label",{htmlFor:"label",className:"block text-sm font-medium text-text-secondary mb-2",children:"Label"}),g.jsx("input",{id:"label",type:"text",value:m,onChange:de=>v(de.target.value.replace(/\s+/g,"-").toLowerCase()),className:"input",placeholder:"default",autoComplete:"off"}),g.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").'})]}),S&&g.jsx("p",{className:"text-sm text-status-error",children:S}),g.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:O,children:O?"Validating...":"Connect"}),g.jsx("a",{href:"/",className:"block text-center text-sm text-text-tertiary hover:text-text-secondary",children:"Cancel"})]}),g.jsxs("div",{className:"mt-6 space-y-3 text-xs text-text-tertiary",children:[g.jsxs("div",{children:[g.jsx("span",{className:"font-medium text-text-secondary",children:"Recommended:"})," ","Run"," ",g.jsx("code",{className:"px-1 py-0.5 bg-surface-sunken rounded text-[11px]",children:"claude setup-token"})," ","in your terminal to generate an OAuth token that uses your subscription."]}),g.jsxs("div",{children:[g.jsx("span",{className:"font-medium text-text-secondary",children:"Alternative:"})," ","Use an API key from"," ",g.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 ef({roleTypes:a,roleNames:n,redirectTo:i="/"}){const{isSuperAdmin:l,hasRole:o,hasRoleType:f}=bi();return l?g.jsx(ic,{}):a&&a.some(d=>f(d))?g.jsx(ic,{}):n&&n.some(d=>o(d))?g.jsx(ic,{}):g.jsx(Hs,{to:i,replace:!0})}const h0=Q.lazy(()=>De(()=>import("./ProcessesListPage-CZ_HF06v.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15])).then(a=>({default:a.ProcessesListPage}))),Ox=Q.lazy(()=>De(()=>import("./ProcessDetailPage-CMLq4M7D.js"),__vite__mapDeps([16,1,2,17,13,18,10,19,14,15,9,6,20,21,22])).then(a=>({default:a.ProcessDetailPage}))),Tx=Q.lazy(()=>De(()=>import("./McpOverview-JkvRcX2e.js"),__vite__mapDeps([23,1,24,25,26,27,13,18,15,6])).then(a=>({default:a.McpOverview}))),jx=Q.lazy(()=>De(()=>import("./McpRunsPage-Dl5Y2u6k.js"),__vite__mapDeps([28,1,25,26,27,5,6,7,8,19,13,12,11,15])).then(a=>({default:a.McpRunsPage}))),Nx=Q.lazy(()=>De(()=>import("./McpRunDetailPage-CmPs5EvE.js"),__vite__mapDeps([29,1,25,26,17,19,13,30,6,31,32,12,33,10,15])).then(a=>({default:a.McpRunDetailPage}))),Cx=Q.lazy(()=>De(()=>import("./McpQueryPage-DRRhw4nN.js"),__vite__mapDeps([34,1,13,7,8,12,11,35,9,10,14,15,5,6,4,36])).then(a=>({default:a.McpQueryPage}))),Mx=Q.lazy(()=>De(()=>import("./McpQueryDetailPage-CUMqhQdS.js"),__vite__mapDeps([37,1,13,19,30,6,9,10,4,36,26,3,2,38,33,39,15,31,40,25,41,42])).then(a=>({default:a.McpQueryDetailPage}))),kx=Q.lazy(()=>De(()=>import("./EscalationsOverview-GXYFPASS.js"),__vite__mapDeps([43,1,4,13,18,6,15])).then(a=>({default:a.EscalationsOverview}))),Rx=Q.lazy(()=>De(()=>import("./AvailableEscalationsPage-BglLDoT8.js"),__vite__mapDeps([44,1,4,45,5,6,7,8,11,40,13,46,47,17,22,48,12,49,20,15,14,35,9,10,50,51])).then(a=>({default:a.AvailableEscalationsPage}))),zx=Q.lazy(()=>De(()=>import("./OperatorDashboard-B56il28q.js"),__vite__mapDeps([52,1,4,45,5,6,7,8,13,11,51,48,12,49,20,15,14,35,9,10,50])).then(a=>({default:a.OperatorDashboard}))),Ux=Q.lazy(()=>De(()=>import("./index-D9SYwJsi.js"),__vite__mapDeps([53,1,45,13,31,50,10,3,17,4,38,6,21,22,47,46,19,20,15,9,30])).then(a=>({default:a.EscalationDetailPage}))),qx=Q.lazy(()=>De(()=>import("./WorkflowsOverview-D9OzzQqw.js"),__vite__mapDeps([54,1,3,4,13,18,6,15])).then(a=>({default:a.WorkflowsOverview}))),Dx=Q.lazy(()=>De(()=>import("./index-BWvMHed7.js"),__vite__mapDeps([55,1,3,13,7,8,56,57,15,9,10,19,6])).then(a=>({default:a.StartWorkflowPage}))),Bx=Q.lazy(()=>De(()=>import("./index-BWvMHed7.js"),__vite__mapDeps([55,1,3,13,7,8,56,57,15,9,10,19,6])).then(a=>({default:a.DurableInvokePage}))),Lx=Q.lazy(()=>De(()=>import("./WorkflowsDashboard-D8z9uBNB.js"),__vite__mapDeps([58,1,35,9,10,3,4,5,6,7,8,14,15,13,12,11,51])).then(a=>({default:()=>a.WorkflowsDashboard({tier:"durable"})}))),Hx=Q.lazy(()=>De(()=>import("./WorkflowsDashboard-D8z9uBNB.js"),__vite__mapDeps([58,1,35,9,10,3,4,5,6,7,8,14,15,13,12,11,51])).then(a=>({default:()=>a.WorkflowsDashboard({tier:"all"})}))),Gx=Q.lazy(()=>De(()=>import("./YamlWorkflowsPage-COqiNCQK.js"),__vite__mapDeps([59,1,26,5,6,19,13,12,8,40,41,42,15])).then(a=>({default:a.YamlWorkflowsPage}))),Yx=Q.lazy(()=>De(()=>import("./YamlWorkflowDetailPage-DrDvvP62.js"),__vite__mapDeps([60,1,39,15,31,26,19,13,61,17,42,6])).then(a=>({default:a.YamlWorkflowDetailPage}))),Vx=Q.lazy(()=>De(()=>import("./TasksListPage-C_QF23c1.js"),__vite__mapDeps([62,1,2,3,5,6,7,8,19,49,9,10,11,12,13,14,15])).then(a=>({default:a.TasksListPage}))),Px=Q.lazy(()=>De(()=>import("./TaskDetailPage-CbPVTakt.js"),__vite__mapDeps([63,1,2,19,49,61,13,6,15])).then(a=>({default:a.TaskDetailPage}))),d0=Q.lazy(()=>De(()=>import("./WorkflowExecutionPage-DjtAQ3hy.js"),__vite__mapDeps([64,1,3,4,32,12,33,19,10,6,2,13,31,15])).then(a=>({default:a.WorkflowExecutionPage}))),Jx=Q.lazy(()=>De(()=>import("./AdminDashboard-jfacvOC7.js"),__vite__mapDeps([65,1,2,4,24,6,15])).then(a=>({default:a.AdminDashboard}))),Qx=Q.lazy(()=>De(()=>import("./index-DTPzZr_X.js"),__vite__mapDeps([66,1,3,7,8,12,51,5,6,13,67,15,14])).then(a=>({default:a.WorkersPage}))),Xx=Q.lazy(()=>De(()=>import("./index-X85K5bHC.js"),__vite__mapDeps([68,1,3,7,8,69,40,6,12,51,5,13,20,15,67,14,45,56,57])).then(a=>({default:a.WorkflowConfigsPage}))),m0=Q.lazy(()=>De(()=>import("./index-X85K5bHC.js"),__vite__mapDeps([68,1,3,7,8,69,40,6,12,51,5,13,20,15,67,14,45,56,57])).then(a=>({default:a.WorkflowConfigDetailPage}))),$x=Q.lazy(()=>De(()=>import("./index-rjmgHlSH.js"),__vite__mapDeps([70,1,24,8,69,40,6,13,12,11,5,15,51,19])).then(a=>({default:a.McpServersPage}))),Kx=Q.lazy(()=>De(()=>import("./index-S9Ks2Lj2.js"),__vite__mapDeps([71,1,22,45,5,6,7,8,11,12,9,10,69,40,51,13,20,15,57])).then(a=>({default:a.UsersPage}))),Fx=Q.lazy(()=>De(()=>import("./RolesPage-9grZW7yR.js"),__vite__mapDeps([72,1,45,7,8,69,40,6,13,20,15])).then(a=>({default:a.RolesPage}))),Zx=Q.lazy(()=>De(()=>import("./index-D_6AB5BE.js"),__vite__mapDeps([73,1,13,40,6,46,7,8,15])).then(a=>({default:a.MaintenancePage}))),Ix=Q.lazy(()=>De(()=>import("./index-Cn2jyj9A.js"),__vite__mapDeps([74,1,13,7,8,12,5,6,67,15,18,40])).then(a=>({default:a.ControlPlanePage}))),Wx=Q.lazy(()=>De(()=>import("./CredentialsPage-Ikzsot0w.js"),__vite__mapDeps([75,1,13,9,10,69,40,6,15])).then(a=>({default:a.CredentialsPage})));function e2(){return g.jsxs("div",{className:"animate-pulse space-y-4",children:[g.jsx("div",{className:"h-8 bg-surface-sunken rounded w-48"}),g.jsx("div",{className:"h-40 bg-surface-sunken rounded"})]})}function ke({children:a}){return g.jsx(Q.Suspense,{fallback:g.jsx(e2,{}),children:g.jsx("div",{className:"animate-page-enter",children:a})})}const ny=new db({defaultOptions:{queries:{staleTime:1e4,retry:(a,n)=>n instanceof Error&&n.message==="Session expired"?!1:a<1}}});window.addEventListener("auth:unauthorized",()=>{ny.clear(),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info"),window.location.pathname!=="/login"&&(window.location.href=`/login?returnTo=${encodeURIComponent(window.location.pathname)}`)});const t2=yb([{path:"/login",element:g.jsx(Ax,{})},{path:"/connect/anthropic",element:g.jsx(f0,{})},{path:"/connect/:provider",element:g.jsx(f0,{})},{path:"/",element:g.jsx(Sx,{}),children:[{index:!0,element:g.jsx(ke,{children:g.jsx(h0,{})})},{path:"processes/all",element:g.jsx(ke,{children:g.jsx(h0,{})})},{path:"processes/detail/:originId",element:g.jsx(ke,{children:g.jsx(Ox,{})})},{path:"credentials",element:g.jsx(ke,{children:g.jsx(Wx,{})})},{path:"connections",element:g.jsx(Hs,{to:"/credentials",replace:!0})},{path:"escalations",element:g.jsx(ke,{children:g.jsx(kx,{})})},{path:"escalations/available",element:g.jsx(ke,{children:g.jsx(Rx,{})})},{path:"escalations/queue",element:g.jsx(ke,{children:g.jsx(zx,{})})},{path:"escalations/detail/:id",element:g.jsx(ke,{children:g.jsx(Ux,{})})},{element:g.jsx(ef,{roleTypes:["admin","superadmin"],roleNames:["engineer"]}),children:[{path:"workflows",element:g.jsx(ke,{children:g.jsx(qx,{})})},{path:"workflows/executions",element:g.jsx(ke,{children:g.jsx(Hx,{})})},{path:"workflows/durable/executions",element:g.jsx(ke,{children:g.jsx(Lx,{})})},{path:"workflows/durable/executions/:workflowId",element:g.jsx(ke,{children:g.jsx(d0,{})})},{path:"workflows/tasks",element:g.jsx(ke,{children:g.jsx(Vx,{})})},{path:"workflows/tasks/detail/:id",element:g.jsx(ke,{children:g.jsx(Px,{})})},{path:"workflows/executions/:workflowId",element:g.jsx(ke,{children:g.jsx(d0,{})})},{path:"workflows/start",element:g.jsx(ke,{children:g.jsx(Dx,{})})},{path:"workflows/durable/invoke",element:g.jsx(ke,{children:g.jsx(Bx,{})})},{path:"workflows/cron",element:g.jsx(Hs,{to:"/workflows/start?mode=schedule",replace:!0})},{path:"workflows/workers",element:g.jsx(ke,{children:g.jsx(Qx,{})})},{path:"workflows/registry",element:g.jsx(ke,{children:g.jsx(Xx,{})})},{path:"workflows/registry/new",element:g.jsx(ke,{children:g.jsx(m0,{})})},{path:"workflows/registry/:workflowType",element:g.jsx(ke,{children:g.jsx(m0,{})})}]},{element:g.jsx(ef,{roleTypes:["admin","superadmin"],roleNames:["engineer"]}),children:[{path:"mcp",element:g.jsx(ke,{children:g.jsx(Tx,{})})},{path:"mcp/queries",element:g.jsx(ke,{children:g.jsx(Cx,{})})},{path:"mcp/queries/:workflowId",element:g.jsx(ke,{children:g.jsx(Mx,{})})},{path:"mcp/tools",element:g.jsx(Hs,{to:"/mcp/servers",replace:!0})},{path:"mcp/servers",element:g.jsx(ke,{children:g.jsx($x,{})})},{path:"mcp/workflows",element:g.jsx(ke,{children:g.jsx(Gx,{})})},{path:"mcp/workflows/:id",element:g.jsx(ke,{children:g.jsx(Yx,{})})},{path:"mcp/executions",element:g.jsx(ke,{children:g.jsx(jx,{})})},{path:"mcp/executions/:jobId",element:g.jsx(ke,{children:g.jsx(Nx,{})})}]},{element:g.jsx(ef,{roleTypes:["admin","superadmin"]}),children:[{path:"admin",element:g.jsx(ke,{children:g.jsx(Jx,{})})},{path:"admin/users",element:g.jsx(ke,{children:g.jsx(Kx,{})})},{path:"admin/bots",element:g.jsx(Hs,{to:"/admin/users?tab=service-accounts",replace:!0})},{path:"admin/escalation-chains",element:g.jsx(Hs,{to:"/admin/roles",replace:!0})},{path:"admin/roles",element:g.jsx(ke,{children:g.jsx(Fx,{})})},{path:"admin/maintenance",element:g.jsx(ke,{children:g.jsx(Zx,{})})},{path:"admin/controlplane",element:g.jsx(ke,{children:g.jsx(Ix,{})})}]}]}]);function n2(){return g.jsx(mb,{client:ny,children:g.jsx(Xv,{children:g.jsx(Pb,{children:g.jsx(gb,{router:t2})})})})}Hb.createRoot(document.getElementById("root")).render(g.jsx(Q.StrictMode,{children:g.jsx(n2,{})}));export{Gf as C,yx as J,X1 as N,ty as O,ox as S,Et as a,f2 as b,d2 as c,p2 as d,o2 as e,bi as f,g2 as g,b2 as h,_2 as i,v2 as j,x2 as k,u2 as l,Kv as m,m2 as n,h2 as o,y2 as p,S2 as q,w2 as r,l2 as s,B0 as u};
54
+ //# sourceMappingURL=index-D8VH6K8B.js.map