@hotmeshio/long-tail 0.1.16 → 0.1.18

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 (359) hide show
  1. package/build/api/escalations/resolve.js +1 -0
  2. package/build/api/files.d.ts +4 -0
  3. package/build/api/files.js +14 -0
  4. package/build/api/workflows/config.js +5 -0
  5. package/build/index.d.ts +1 -1
  6. package/build/index.js +3 -3
  7. package/build/lib/db/schemas/002_seed.sql +3 -81
  8. package/build/lib/storage/mime.js +20 -0
  9. package/build/routes/file-browser.js +30 -0
  10. package/build/routes/files.js +20 -18
  11. package/build/services/config/sql.d.ts +3 -0
  12. package/build/services/config/sql.js +15 -1
  13. package/build/services/config/write.d.ts +6 -0
  14. package/build/services/config/write.js +64 -0
  15. package/build/services/cron/index.d.ts +5 -0
  16. package/build/services/cron/index.js +30 -0
  17. package/build/services/insight/index.js +3 -0
  18. package/build/services/interceptor/activities/task.d.ts +1 -0
  19. package/build/services/interceptor/activities/task.js +2 -1
  20. package/build/services/interceptor/activities/workflow.js +1 -0
  21. package/build/services/interceptor/index.js +4 -4
  22. package/build/services/interceptor/lifecycle.js +1 -1
  23. package/build/services/mcp/db.d.ts +17 -0
  24. package/build/services/mcp/db.js +50 -0
  25. package/build/services/mcp/sql.d.ts +4 -1
  26. package/build/services/mcp/sql.js +9 -2
  27. package/build/services/oauth/index.js +4 -1
  28. package/build/services/oauth/providers/google.js +7 -2
  29. package/build/services/orchestrator/index.js +5 -0
  30. package/build/services/task/crud.js +1 -0
  31. package/build/services/task/sql.d.ts +1 -1
  32. package/build/services/task/sql.js +2 -2
  33. package/build/services/task/types.d.ts +2 -0
  34. package/build/services/workers/registry.js +3 -1
  35. package/build/services/workflow-invocation.js +8 -1
  36. package/build/start/workers.d.ts +2 -1
  37. package/build/start/workers.js +66 -6
  38. package/build/system/index.d.ts +12 -10
  39. package/build/system/index.js +240 -67
  40. package/build/system/mcp-servers/playwright/schemas.d.ts +12 -12
  41. package/build/system/seed/index.d.ts +0 -7
  42. package/build/system/seed/index.js +5 -46
  43. package/build/tsconfig.tsbuildinfo +1 -1
  44. package/build/types/index.d.ts +1 -1
  45. package/build/types/startup.d.ts +59 -2
  46. package/dashboard/dist/assets/AdminDashboard-CsTOErp1.js +2 -0
  47. package/dashboard/dist/assets/{AdminDashboard-Bprul9Eb.js.map → AdminDashboard-CsTOErp1.js.map} +1 -1
  48. package/dashboard/dist/assets/AvailableEscalationsPage-BqQA3IJp.js +2 -0
  49. package/dashboard/dist/assets/{AvailableEscalationsPage-H_z5mC10.js.map → AvailableEscalationsPage-BqQA3IJp.js.map} +1 -1
  50. package/dashboard/dist/assets/BotPicker-C2xR1xay.js +2 -0
  51. package/dashboard/dist/assets/{BotPicker-DcvILNUf.js.map → BotPicker-C2xR1xay.js.map} +1 -1
  52. package/dashboard/dist/assets/CollapsibleSection-CRtHQsAv.js +2 -0
  53. package/dashboard/dist/assets/{CollapsibleSection-BWPbzgEe.js.map → CollapsibleSection-CRtHQsAv.js.map} +1 -1
  54. package/dashboard/dist/assets/ConfirmDeleteModal-dOxidrSR.js +2 -0
  55. package/dashboard/dist/assets/{ConfirmDeleteModal-Cy6KVLfC.js.map → ConfirmDeleteModal-dOxidrSR.js.map} +1 -1
  56. package/dashboard/dist/assets/CopyableId-DmLF-RqZ.js +2 -0
  57. package/dashboard/dist/assets/{CopyableId-CRED8hvk.js.map → CopyableId-DmLF-RqZ.js.map} +1 -1
  58. package/dashboard/dist/assets/CredentialsPage-C7XT1bnO.js +2 -0
  59. package/dashboard/dist/assets/CredentialsPage-C7XT1bnO.js.map +1 -0
  60. package/dashboard/dist/assets/CustomDurationPicker-BABUv1V2.js +2 -0
  61. package/dashboard/dist/assets/{CustomDurationPicker-eOk2EqQ5.js.map → CustomDurationPicker-BABUv1V2.js.map} +1 -1
  62. package/dashboard/dist/assets/DataTable-D3-wSEf0.js +2 -0
  63. package/dashboard/dist/assets/{DataTable-bd2PTBJd.js.map → DataTable-D3-wSEf0.js.map} +1 -1
  64. package/dashboard/dist/assets/DropZone-DHKmMqRA.js +2 -0
  65. package/dashboard/dist/assets/DropZone-DHKmMqRA.js.map +1 -0
  66. package/dashboard/dist/assets/ElapsedCell-DrJif03B.js +2 -0
  67. package/dashboard/dist/assets/{ElapsedCell-BGo8vyus.js.map → ElapsedCell-DrJif03B.js.map} +1 -1
  68. package/dashboard/dist/assets/EmptyState-BcsfPq9T.js +2 -0
  69. package/dashboard/dist/assets/EmptyState-BcsfPq9T.js.map +1 -0
  70. package/dashboard/dist/assets/EscalationsOverview-H6CwfeR-.js +2 -0
  71. package/dashboard/dist/assets/EscalationsOverview-H6CwfeR-.js.map +1 -0
  72. package/dashboard/dist/assets/EventTable-Dh3_9DAY.js +2 -0
  73. package/dashboard/dist/assets/{EventTable-CmFhswLW.js.map → EventTable-Dh3_9DAY.js.map} +1 -1
  74. package/dashboard/dist/assets/FilterBar-Ck4K4rzu.js +2 -0
  75. package/dashboard/dist/assets/{FilterBar-BQNzsd3A.js.map → FilterBar-Ck4K4rzu.js.map} +1 -1
  76. package/dashboard/dist/assets/ListToolbar-CyEkulVR.js +2 -0
  77. package/dashboard/dist/assets/{ListToolbar-OWOn-HiC.js.map → ListToolbar-CyEkulVR.js.map} +1 -1
  78. package/dashboard/dist/assets/McpOverview-ChLa6Gl7.js +2 -0
  79. package/dashboard/dist/assets/{McpOverview-OkEzvClD.js.map → McpOverview-ChLa6Gl7.js.map} +1 -1
  80. package/dashboard/dist/assets/McpQueryDetailPage-5Dsj6PlL.js +5 -0
  81. package/dashboard/dist/assets/McpQueryDetailPage-5Dsj6PlL.js.map +1 -0
  82. package/dashboard/dist/assets/McpQueryPage-D2DmDFPu.js +2 -0
  83. package/dashboard/dist/assets/McpQueryPage-D2DmDFPu.js.map +1 -0
  84. package/dashboard/dist/assets/McpRunDetailPage-ERVuNEEK.js +2 -0
  85. package/dashboard/dist/assets/{McpRunDetailPage-DMeiG4i_.js.map → McpRunDetailPage-ERVuNEEK.js.map} +1 -1
  86. package/dashboard/dist/assets/McpRunsPage-BKba-3Wl.js +2 -0
  87. package/dashboard/dist/assets/McpRunsPage-BKba-3Wl.js.map +1 -0
  88. package/dashboard/dist/assets/Modal-DEODGeqx.js +2 -0
  89. package/dashboard/dist/assets/{Modal-Dir9Rlnx.js.map → Modal-DEODGeqx.js.map} +1 -1
  90. package/dashboard/dist/assets/OperatorDashboard-CJm_BTPU.js +2 -0
  91. package/dashboard/dist/assets/{OperatorDashboard-OqWC6Azy.js.map → OperatorDashboard-CJm_BTPU.js.map} +1 -1
  92. package/dashboard/dist/assets/PageHeader-B-SN5GZ2.js +2 -0
  93. package/dashboard/dist/assets/PageHeader-B-SN5GZ2.js.map +1 -0
  94. package/dashboard/dist/assets/PageHeaderWithStats-BZ3AGT5s.js +2 -0
  95. package/dashboard/dist/assets/PageHeaderWithStats-BZ3AGT5s.js.map +1 -0
  96. package/dashboard/dist/assets/PriorityBadge-DfQY9St9.js +2 -0
  97. package/dashboard/dist/assets/{PriorityBadge-C7D5d_HY.js.map → PriorityBadge-DfQY9St9.js.map} +1 -1
  98. package/dashboard/dist/assets/ProcessDetailPage-vfnCDyQK.js +2 -0
  99. package/dashboard/dist/assets/{ProcessDetailPage-DZIP6grw.js.map → ProcessDetailPage-vfnCDyQK.js.map} +1 -1
  100. package/dashboard/dist/assets/ProcessesListPage-DcAN6AJK.js +2 -0
  101. package/dashboard/dist/assets/ProcessesListPage-DcAN6AJK.js.map +1 -0
  102. package/dashboard/dist/assets/RolePill-BhVC0cc3.js +2 -0
  103. package/dashboard/dist/assets/{RolePill-D6nMxMvp.js.map → RolePill-BhVC0cc3.js.map} +1 -1
  104. package/dashboard/dist/assets/RolesPage-DYSt2aAr.js +2 -0
  105. package/dashboard/dist/assets/RolesPage-DYSt2aAr.js.map +1 -0
  106. package/dashboard/dist/assets/RowActions-Dg-Fsm5O.js +2 -0
  107. package/dashboard/dist/assets/{RowActions-JqgAB0p3.js.map → RowActions-Dg-Fsm5O.js.map} +1 -1
  108. package/dashboard/dist/assets/RunAsSelector-CD7_Dmb0.js +2 -0
  109. package/dashboard/dist/assets/{RunAsSelector-KAlKtitB.js.map → RunAsSelector-CD7_Dmb0.js.map} +1 -1
  110. package/dashboard/dist/assets/StatCard-DlgF0CJC.js +2 -0
  111. package/dashboard/dist/assets/{StatCard-B-WLhOaH.js.map → StatCard-DlgF0CJC.js.map} +1 -1
  112. package/dashboard/dist/assets/StatusBadge-XQlNFwmH.js +2 -0
  113. package/dashboard/dist/assets/StatusBadge-XQlNFwmH.js.map +1 -0
  114. package/dashboard/dist/assets/StepIndicator-CuUIGxKk.js +2 -0
  115. package/dashboard/dist/assets/{StepIndicator-D9Xvdf18.js.map → StepIndicator-CuUIGxKk.js.map} +1 -1
  116. package/dashboard/dist/assets/StickyPagination-F9FZsRy9.js +2 -0
  117. package/dashboard/dist/assets/{StickyPagination-CJHMzYJj.js.map → StickyPagination-F9FZsRy9.js.map} +1 -1
  118. package/dashboard/dist/assets/SwimlaneTimeline-CUl5RdXU.js +2 -0
  119. package/dashboard/dist/assets/SwimlaneTimeline-CUl5RdXU.js.map +1 -0
  120. package/dashboard/dist/assets/TagInput-DftaRHDV.js +2 -0
  121. package/dashboard/dist/assets/{TagInput-DcPnUnSJ.js.map → TagInput-DftaRHDV.js.map} +1 -1
  122. package/dashboard/dist/assets/TaskDetailPage-BoA-cfwW.js +2 -0
  123. package/dashboard/dist/assets/TaskDetailPage-BoA-cfwW.js.map +1 -0
  124. package/dashboard/dist/assets/TaskQueuePill-Ce8KlXtR.js +2 -0
  125. package/dashboard/dist/assets/TaskQueuePill-Ce8KlXtR.js.map +1 -0
  126. package/dashboard/dist/assets/TasksListPage-g6XIbhju.js +2 -0
  127. package/dashboard/dist/assets/{TasksListPage-DeewV4Gp.js.map → TasksListPage-g6XIbhju.js.map} +1 -1
  128. package/dashboard/dist/assets/TimeAgo-BihIwEbB.js +2 -0
  129. package/dashboard/dist/assets/{TimeAgo-DJZq-e4R.js.map → TimeAgo-BihIwEbB.js.map} +1 -1
  130. package/dashboard/dist/assets/TimestampCell-GOFcvE-i.js +2 -0
  131. package/dashboard/dist/assets/{TimestampCell-Dx5uwGfS.js.map → TimestampCell-GOFcvE-i.js.map} +1 -1
  132. package/dashboard/dist/assets/UserName-CmMVt4vS.js +2 -0
  133. package/dashboard/dist/assets/{UserName-CnGk7MgL.js.map → UserName-CmMVt4vS.js.map} +1 -1
  134. package/dashboard/dist/assets/WorkflowExecutionPage-soRFz_30.js +2 -0
  135. package/dashboard/dist/assets/{WorkflowExecutionPage-CPQ0fIwf.js.map → WorkflowExecutionPage-soRFz_30.js.map} +1 -1
  136. package/dashboard/dist/assets/WorkflowPill-DUDDyBsj.js +2 -0
  137. package/dashboard/dist/assets/{WorkflowPill-BrD5d1AG.js.map → WorkflowPill-DUDDyBsj.js.map} +1 -1
  138. package/dashboard/dist/assets/WorkflowsDashboard-Be1A1zAT.js +2 -0
  139. package/dashboard/dist/assets/WorkflowsDashboard-Be1A1zAT.js.map +1 -0
  140. package/dashboard/dist/assets/WorkflowsOverview-z3Ztiz1y.js +2 -0
  141. package/dashboard/dist/assets/{WorkflowsOverview-lBp2E6rN.js.map → WorkflowsOverview-z3Ztiz1y.js.map} +1 -1
  142. package/dashboard/dist/assets/YamlWorkflowsPage-C6qzcQcJ.js +2 -0
  143. package/dashboard/dist/assets/YamlWorkflowsPage-C6qzcQcJ.js.map +1 -0
  144. package/dashboard/dist/assets/{bots-fc_O_YIq.js → bots-BZPXDh_y.js} +2 -2
  145. package/dashboard/dist/assets/{bots-fc_O_YIq.js.map → bots-BZPXDh_y.js.map} +1 -1
  146. package/dashboard/dist/assets/escalation-DBUIq1Z4.js +2 -0
  147. package/dashboard/dist/assets/{escalation-BYhLYHBz.js.map → escalation-DBUIq1Z4.js.map} +1 -1
  148. package/dashboard/dist/assets/escalation-columns-DL4zsR8Y.js +2 -0
  149. package/dashboard/dist/assets/{escalation-columns-DjJyuC1g.js.map → escalation-columns-DL4zsR8Y.js.map} +1 -1
  150. package/dashboard/dist/assets/helpers-D50KFFkI.js +2 -0
  151. package/dashboard/dist/assets/{helpers-CQG3Rh2y.js.map → helpers-D50KFFkI.js.map} +1 -1
  152. package/dashboard/dist/assets/index-B-ioA6yv.js +2 -0
  153. package/dashboard/dist/assets/index-B-ioA6yv.js.map +1 -0
  154. package/dashboard/dist/assets/index-B-jzKfuv.js +2 -0
  155. package/dashboard/dist/assets/index-B-jzKfuv.js.map +1 -0
  156. package/dashboard/dist/assets/index-BMpoMc4A.js +2 -0
  157. package/dashboard/dist/assets/{index-D51PaQZY.js.map → index-BMpoMc4A.js.map} +1 -1
  158. package/dashboard/dist/assets/index-BU04qgJt.js +15 -0
  159. package/dashboard/dist/assets/index-BU04qgJt.js.map +1 -0
  160. package/dashboard/dist/assets/index-BUjxYyxc.js +63 -0
  161. package/dashboard/dist/assets/index-BUjxYyxc.js.map +1 -0
  162. package/dashboard/dist/assets/index-BpoHVMV7.js +2 -0
  163. package/dashboard/dist/assets/index-BpoHVMV7.js.map +1 -0
  164. package/dashboard/dist/assets/index-CEnDYJOO.js +2 -0
  165. package/dashboard/dist/assets/index-CEnDYJOO.js.map +1 -0
  166. package/dashboard/dist/assets/index-CbuH92vk.js +6 -0
  167. package/dashboard/dist/assets/index-CbuH92vk.js.map +1 -0
  168. package/dashboard/dist/assets/index-D9_hZmsW.js +5 -0
  169. package/dashboard/dist/assets/{index-KYpLvJKB.js.map → index-D9_hZmsW.js.map} +1 -1
  170. package/dashboard/dist/assets/index-DrouIN-M.js +2 -0
  171. package/dashboard/dist/assets/{index-DR4qQvlW.js.map → index-DrouIN-M.js.map} +1 -1
  172. package/dashboard/dist/assets/index-DzICLMI7.js +2 -0
  173. package/dashboard/dist/assets/{index-DNtXXy1o.js.map → index-DzICLMI7.js.map} +1 -1
  174. package/dashboard/dist/assets/index-efS5gKpv.css +1 -0
  175. package/dashboard/dist/assets/index-qT78AZDq.js +2 -0
  176. package/dashboard/dist/assets/index-qT78AZDq.js.map +1 -0
  177. package/dashboard/dist/assets/mcp-D0GrHRFe.js +2 -0
  178. package/dashboard/dist/assets/{mcp-D2XfRh8v.js.map → mcp-D0GrHRFe.js.map} +1 -1
  179. package/dashboard/dist/assets/{mcp-query-CIx_mIC7.js → mcp-query-DC5woQn5.js} +2 -2
  180. package/dashboard/dist/assets/{mcp-query-CIx_mIC7.js.map → mcp-query-DC5woQn5.js.map} +1 -1
  181. package/dashboard/dist/assets/{mcp-runs-C9_J4LIH.js → mcp-runs-CsoVQoPB.js} +2 -2
  182. package/dashboard/dist/assets/{mcp-runs-C9_J4LIH.js.map → mcp-runs-CsoVQoPB.js.map} +1 -1
  183. package/dashboard/dist/assets/namespaces-unpIb4gX.js +2 -0
  184. package/dashboard/dist/assets/{namespaces-BwMljx6f.js.map → namespaces-unpIb4gX.js.map} +1 -1
  185. package/dashboard/dist/assets/{roles-Bd_sTV6I.js → roles--kBaFljg.js} +2 -2
  186. package/dashboard/dist/assets/{roles-Bd_sTV6I.js.map → roles--kBaFljg.js.map} +1 -1
  187. package/dashboard/dist/assets/settings-B96YkawY.js +2 -0
  188. package/dashboard/dist/assets/{settings-BCb8eFyA.js.map → settings-B96YkawY.js.map} +1 -1
  189. package/dashboard/dist/assets/{tasks-Bq54qGGq.js → tasks-D_1NCfOZ.js} +2 -2
  190. package/dashboard/dist/assets/{tasks-Bq54qGGq.js.map → tasks-D_1NCfOZ.js.map} +1 -1
  191. package/dashboard/dist/assets/{useEventHooks-BTbGf536.js → useEventHooks-BPjEkCpD.js} +2 -2
  192. package/dashboard/dist/assets/{useEventHooks-BTbGf536.js.map → useEventHooks-BPjEkCpD.js.map} +1 -1
  193. package/dashboard/dist/assets/{useExpandedRows-Cg9iq6Vy.js → useExpandedRows-CkcEntB-.js} +2 -2
  194. package/dashboard/dist/assets/{useExpandedRows-Cg9iq6Vy.js.map → useExpandedRows-CkcEntB-.js.map} +1 -1
  195. package/dashboard/dist/assets/{useFilterParams-CGRYFw_A.js → useFilterParams-DZCAaBC7.js} +2 -2
  196. package/dashboard/dist/assets/{useFilterParams-CGRYFw_A.js.map → useFilterParams-DZCAaBC7.js.map} +1 -1
  197. package/dashboard/dist/assets/{useYamlActivityEvents-CsYP09W5.js → useYamlActivityEvents-D3RQjfzo.js} +2 -2
  198. package/dashboard/dist/assets/{useYamlActivityEvents-CsYP09W5.js.map → useYamlActivityEvents-D3RQjfzo.js.map} +1 -1
  199. package/dashboard/dist/assets/{users-BTBhafGc.js → users-e2oatvoj.js} +2 -2
  200. package/dashboard/dist/assets/{users-BTBhafGc.js.map → users-e2oatvoj.js.map} +1 -1
  201. package/dashboard/dist/assets/{vendor-icons-CWl44VA6.js → vendor-icons-BkK55L-1.js} +103 -88
  202. package/dashboard/dist/assets/vendor-icons-BkK55L-1.js.map +1 -0
  203. package/dashboard/dist/assets/vendor-query-B2UbickB.js +18 -0
  204. package/dashboard/dist/assets/vendor-query-B2UbickB.js.map +1 -0
  205. package/dashboard/dist/assets/vendor-react-CX88sFS5.js +22 -0
  206. package/dashboard/dist/assets/vendor-react-CX88sFS5.js.map +1 -0
  207. package/dashboard/dist/assets/{workflows-BkzA4ahe.js → workflows-D6diL54s.js} +2 -2
  208. package/dashboard/dist/assets/{workflows-BkzA4ahe.js.map → workflows-D6diL54s.js.map} +1 -1
  209. package/dashboard/dist/assets/{yaml-workflows-Cs0EYp0F.js → yaml-workflows-CAKU7LUu.js} +2 -2
  210. package/dashboard/dist/assets/{yaml-workflows-Cs0EYp0F.js.map → yaml-workflows-CAKU7LUu.js.map} +1 -1
  211. package/dashboard/dist/index.html +5 -5
  212. package/docs/dashboard.md +233 -65
  213. package/package.json +3 -2
  214. package/build/examples/external-mcp-server/server.d.ts +0 -17
  215. package/build/examples/external-mcp-server/server.js +0 -116
  216. package/build/examples/index.d.ts +0 -2
  217. package/build/examples/index.js +0 -7
  218. package/build/examples/seed-data.d.ts +0 -55
  219. package/build/examples/seed-data.js +0 -161
  220. package/build/examples/seed.d.ts +0 -5
  221. package/build/examples/seed.js +0 -132
  222. package/build/examples/types/envelopes.d.ts +0 -69
  223. package/build/examples/types/envelopes.js +0 -8
  224. package/build/examples/types/index.d.ts +0 -10
  225. package/build/examples/types/index.js +0 -9
  226. package/build/examples/types/resolvers.d.ts +0 -27
  227. package/build/examples/types/resolvers.js +0 -9
  228. package/build/examples/workers.d.ts +0 -10
  229. package/build/examples/workers.js +0 -59
  230. package/build/examples/workflows/assembly-line/activities.d.ts +0 -28
  231. package/build/examples/workflows/assembly-line/activities.js +0 -53
  232. package/build/examples/workflows/assembly-line/index.d.ts +0 -17
  233. package/build/examples/workflows/assembly-line/index.js +0 -60
  234. package/build/examples/workflows/assembly-line/iterator.d.ts +0 -12
  235. package/build/examples/workflows/assembly-line/iterator.js +0 -54
  236. package/build/examples/workflows/assembly-line/reverter.d.ts +0 -18
  237. package/build/examples/workflows/assembly-line/reverter.js +0 -89
  238. package/build/examples/workflows/assembly-line/types.d.ts +0 -25
  239. package/build/examples/workflows/assembly-line/types.js +0 -8
  240. package/build/examples/workflows/assembly-line/worker.d.ts +0 -13
  241. package/build/examples/workflows/assembly-line/worker.js +0 -81
  242. package/build/examples/workflows/basic-echo/activities.d.ts +0 -20
  243. package/build/examples/workflows/basic-echo/activities.js +0 -55
  244. package/build/examples/workflows/basic-echo/index.d.ts +0 -14
  245. package/build/examples/workflows/basic-echo/index.js +0 -66
  246. package/build/examples/workflows/basic-signal/activities.d.ts +0 -17
  247. package/build/examples/workflows/basic-signal/activities.js +0 -18
  248. package/build/examples/workflows/basic-signal/index.d.ts +0 -17
  249. package/build/examples/workflows/basic-signal/index.js +0 -116
  250. package/build/examples/workflows/kitchen-sink/activities.d.ts +0 -40
  251. package/build/examples/workflows/kitchen-sink/activities.js +0 -46
  252. package/build/examples/workflows/kitchen-sink/index.d.ts +0 -22
  253. package/build/examples/workflows/kitchen-sink/index.js +0 -123
  254. package/build/examples/workflows/review-content/activities.d.ts +0 -10
  255. package/build/examples/workflows/review-content/activities.js +0 -44
  256. package/build/examples/workflows/review-content/index.d.ts +0 -10
  257. package/build/examples/workflows/review-content/index.js +0 -95
  258. package/build/examples/workflows/review-content/types.d.ts +0 -28
  259. package/build/examples/workflows/review-content/types.js +0 -2
  260. package/build/lib/db/schemas/schemas/001_schema.sql +0 -485
  261. package/build/lib/db/schemas/schemas/002_seed.sql +0 -92
  262. package/build/system/seed/server-definitions.d.ts +0 -3210
  263. package/build/system/seed/server-definitions.js +0 -232
  264. package/dashboard/dist/assets/AdminDashboard-Bprul9Eb.js +0 -2
  265. package/dashboard/dist/assets/AvailableEscalationsPage-H_z5mC10.js +0 -2
  266. package/dashboard/dist/assets/BotPicker-DcvILNUf.js +0 -2
  267. package/dashboard/dist/assets/CollapsibleSection-BWPbzgEe.js +0 -2
  268. package/dashboard/dist/assets/ConfirmDeleteModal-Cy6KVLfC.js +0 -2
  269. package/dashboard/dist/assets/CopyableId-CRED8hvk.js +0 -2
  270. package/dashboard/dist/assets/CredentialsPage-BUdvxiE3.js +0 -2
  271. package/dashboard/dist/assets/CredentialsPage-BUdvxiE3.js.map +0 -1
  272. package/dashboard/dist/assets/CustomDurationPicker-eOk2EqQ5.js +0 -2
  273. package/dashboard/dist/assets/DataTable-bd2PTBJd.js +0 -2
  274. package/dashboard/dist/assets/ElapsedCell-BGo8vyus.js +0 -2
  275. package/dashboard/dist/assets/EmptyState-BygtU-Rh.js +0 -2
  276. package/dashboard/dist/assets/EmptyState-BygtU-Rh.js.map +0 -1
  277. package/dashboard/dist/assets/EscalationsOverview-DUEcN5MP.js +0 -2
  278. package/dashboard/dist/assets/EscalationsOverview-DUEcN5MP.js.map +0 -1
  279. package/dashboard/dist/assets/EventTable-CmFhswLW.js +0 -2
  280. package/dashboard/dist/assets/FilterBar-BQNzsd3A.js +0 -2
  281. package/dashboard/dist/assets/ListToolbar-OWOn-HiC.js +0 -2
  282. package/dashboard/dist/assets/McpOverview-OkEzvClD.js +0 -2
  283. package/dashboard/dist/assets/McpQueryDetailPage-C6Ih5sC_.js +0 -5
  284. package/dashboard/dist/assets/McpQueryDetailPage-C6Ih5sC_.js.map +0 -1
  285. package/dashboard/dist/assets/McpQueryPage-BAuOf5TL.js +0 -2
  286. package/dashboard/dist/assets/McpQueryPage-BAuOf5TL.js.map +0 -1
  287. package/dashboard/dist/assets/McpRunDetailPage-DMeiG4i_.js +0 -2
  288. package/dashboard/dist/assets/McpRunsPage-CG3cNJh8.js +0 -2
  289. package/dashboard/dist/assets/McpRunsPage-CG3cNJh8.js.map +0 -1
  290. package/dashboard/dist/assets/Modal-Dir9Rlnx.js +0 -2
  291. package/dashboard/dist/assets/OperatorDashboard-OqWC6Azy.js +0 -2
  292. package/dashboard/dist/assets/PageHeader-FJIemmrC.js +0 -2
  293. package/dashboard/dist/assets/PageHeader-FJIemmrC.js.map +0 -1
  294. package/dashboard/dist/assets/PageHeaderWithStats-Br5y9qNO.js +0 -2
  295. package/dashboard/dist/assets/PageHeaderWithStats-Br5y9qNO.js.map +0 -1
  296. package/dashboard/dist/assets/PriorityBadge-C7D5d_HY.js +0 -2
  297. package/dashboard/dist/assets/ProcessDetailPage-DZIP6grw.js +0 -2
  298. package/dashboard/dist/assets/ProcessesListPage-BQoPYkeB.js +0 -2
  299. package/dashboard/dist/assets/ProcessesListPage-BQoPYkeB.js.map +0 -1
  300. package/dashboard/dist/assets/RolePill-D6nMxMvp.js +0 -2
  301. package/dashboard/dist/assets/RolesPage-CwLnJFhy.js +0 -2
  302. package/dashboard/dist/assets/RolesPage-CwLnJFhy.js.map +0 -1
  303. package/dashboard/dist/assets/RowActions-JqgAB0p3.js +0 -2
  304. package/dashboard/dist/assets/RunAsSelector-KAlKtitB.js +0 -2
  305. package/dashboard/dist/assets/StatCard-B-WLhOaH.js +0 -2
  306. package/dashboard/dist/assets/StatusBadge-DVCf2ncM.js +0 -2
  307. package/dashboard/dist/assets/StatusBadge-DVCf2ncM.js.map +0 -1
  308. package/dashboard/dist/assets/StepIndicator-D9Xvdf18.js +0 -2
  309. package/dashboard/dist/assets/StickyPagination-CJHMzYJj.js +0 -2
  310. package/dashboard/dist/assets/SwimlaneTimeline-YiXPDyEL.js +0 -2
  311. package/dashboard/dist/assets/SwimlaneTimeline-YiXPDyEL.js.map +0 -1
  312. package/dashboard/dist/assets/TagInput-DcPnUnSJ.js +0 -2
  313. package/dashboard/dist/assets/TaskDetailPage-DftmYWD7.js +0 -2
  314. package/dashboard/dist/assets/TaskDetailPage-DftmYWD7.js.map +0 -1
  315. package/dashboard/dist/assets/TaskQueuePill-BzduBqwy.js +0 -2
  316. package/dashboard/dist/assets/TaskQueuePill-BzduBqwy.js.map +0 -1
  317. package/dashboard/dist/assets/TasksListPage-DeewV4Gp.js +0 -2
  318. package/dashboard/dist/assets/TimeAgo-DJZq-e4R.js +0 -2
  319. package/dashboard/dist/assets/TimestampCell-Dx5uwGfS.js +0 -2
  320. package/dashboard/dist/assets/UserName-CnGk7MgL.js +0 -2
  321. package/dashboard/dist/assets/WorkflowExecutionPage-CPQ0fIwf.js +0 -2
  322. package/dashboard/dist/assets/WorkflowPill-BrD5d1AG.js +0 -2
  323. package/dashboard/dist/assets/WorkflowsDashboard-BzjhABZP.js +0 -2
  324. package/dashboard/dist/assets/WorkflowsDashboard-BzjhABZP.js.map +0 -1
  325. package/dashboard/dist/assets/WorkflowsOverview-lBp2E6rN.js +0 -2
  326. package/dashboard/dist/assets/YamlWorkflowsPage-C_MkAp2i.js +0 -2
  327. package/dashboard/dist/assets/YamlWorkflowsPage-C_MkAp2i.js.map +0 -1
  328. package/dashboard/dist/assets/escalation-BYhLYHBz.js +0 -2
  329. package/dashboard/dist/assets/escalation-columns-DjJyuC1g.js +0 -2
  330. package/dashboard/dist/assets/helpers-CQG3Rh2y.js +0 -2
  331. package/dashboard/dist/assets/index-2nBhR7Dg.js +0 -2
  332. package/dashboard/dist/assets/index-2nBhR7Dg.js.map +0 -1
  333. package/dashboard/dist/assets/index-4IUoh_hd.js +0 -2
  334. package/dashboard/dist/assets/index-4IUoh_hd.js.map +0 -1
  335. package/dashboard/dist/assets/index-B2CqPzLK.js +0 -2
  336. package/dashboard/dist/assets/index-B2CqPzLK.js.map +0 -1
  337. package/dashboard/dist/assets/index-B78xalb4.js +0 -2
  338. package/dashboard/dist/assets/index-B78xalb4.js.map +0 -1
  339. package/dashboard/dist/assets/index-BI8r69O_.js +0 -2
  340. package/dashboard/dist/assets/index-BI8r69O_.js.map +0 -1
  341. package/dashboard/dist/assets/index-C5TUqJu0.css +0 -1
  342. package/dashboard/dist/assets/index-CUqCBBZG.js +0 -6
  343. package/dashboard/dist/assets/index-CUqCBBZG.js.map +0 -1
  344. package/dashboard/dist/assets/index-D51PaQZY.js +0 -2
  345. package/dashboard/dist/assets/index-DNtXXy1o.js +0 -2
  346. package/dashboard/dist/assets/index-DR4qQvlW.js +0 -2
  347. package/dashboard/dist/assets/index-Dh0PCbR-.js +0 -15
  348. package/dashboard/dist/assets/index-Dh0PCbR-.js.map +0 -1
  349. package/dashboard/dist/assets/index-KYpLvJKB.js +0 -5
  350. package/dashboard/dist/assets/index-sNrqYt0Q.js +0 -281
  351. package/dashboard/dist/assets/index-sNrqYt0Q.js.map +0 -1
  352. package/dashboard/dist/assets/mcp-D2XfRh8v.js +0 -2
  353. package/dashboard/dist/assets/namespaces-BwMljx6f.js +0 -2
  354. package/dashboard/dist/assets/settings-BCb8eFyA.js +0 -2
  355. package/dashboard/dist/assets/vendor-icons-CWl44VA6.js.map +0 -1
  356. package/dashboard/dist/assets/vendor-query-DLp59M9_.js +0 -35
  357. package/dashboard/dist/assets/vendor-query-DLp59M9_.js.map +0 -1
  358. package/dashboard/dist/assets/vendor-react-Co3Y8ikm.js +0 -26
  359. package/dashboard/dist/assets/vendor-react-Co3Y8ikm.js.map +0 -1
@@ -0,0 +1,63 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ProcessesListPage-DcAN6AJK.js","assets/vendor-query-B2UbickB.js","assets/tasks-D_1NCfOZ.js","assets/workflows-D6diL54s.js","assets/useEventHooks-BPjEkCpD.js","assets/useFilterParams-DZCAaBC7.js","assets/vendor-react-CX88sFS5.js","assets/DataTable-D3-wSEf0.js","assets/EmptyState-BcsfPq9T.js","assets/TimestampCell-GOFcvE-i.js","assets/StickyPagination-F9FZsRy9.js","assets/FilterBar-Ck4K4rzu.js","assets/PageHeader-B-SN5GZ2.js","assets/vendor-icons-BkK55L-1.js","assets/ListToolbar-CyEkulVR.js","assets/WorkflowPill-DUDDyBsj.js","assets/ProcessDetailPage-vfnCDyQK.js","assets/settings-B96YkawY.js","assets/PageHeaderWithStats-BZ3AGT5s.js","assets/StatusBadge-XQlNFwmH.js","assets/RolePill-BhVC0cc3.js","assets/UserName-CmMVt4vS.js","assets/users-e2oatvoj.js","assets/McpOverview-ChLa6Gl7.js","assets/mcp-D0GrHRFe.js","assets/mcp-runs-CsoVQoPB.js","assets/yaml-workflows-CAKU7LUu.js","assets/namespaces-unpIb4gX.js","assets/StatCard-DlgF0CJC.js","assets/McpRunsPage-BKba-3Wl.js","assets/ElapsedCell-DrJif03B.js","assets/RowActions-Dg-Fsm5O.js","assets/McpRunDetailPage-ERVuNEEK.js","assets/CopyableId-DmLF-RqZ.js","assets/CollapsibleSection-CRtHQsAv.js","assets/EventTable-Dh3_9DAY.js","assets/SwimlaneTimeline-CUl5RdXU.js","assets/McpQueryPage-D2DmDFPu.js","assets/mcp-query-DC5woQn5.js","assets/McpQueryDetailPage-5Dsj6PlL.js","assets/useYamlActivityEvents-D3RQjfzo.js","assets/TagInput-DftaRHDV.js","assets/RunAsSelector-CD7_Dmb0.js","assets/BotPicker-C2xR1xay.js","assets/bots-BZPXDh_y.js","assets/TimeAgo-BihIwEbB.js","assets/EscalationsOverview-H6CwfeR-.js","assets/AvailableEscalationsPage-BqQA3IJp.js","assets/roles--kBaFljg.js","assets/constants-BHkpVaqx.js","assets/CustomDurationPicker-BABUv1V2.js","assets/Modal-DEODGeqx.js","assets/escalation-columns-DL4zsR8Y.js","assets/PriorityBadge-DfQY9St9.js","assets/escalation-DBUIq1Z4.js","assets/OperatorDashboard-CJm_BTPU.js","assets/index-D9_hZmsW.js","assets/WorkflowsOverview-z3Ztiz1y.js","assets/index-CbuH92vk.js","assets/helpers-D50KFFkI.js","assets/WorkflowsDashboard-Be1A1zAT.js","assets/YamlWorkflowsPage-C6qzcQcJ.js","assets/useExpandedRows-CkcEntB-.js","assets/TasksListPage-g6XIbhju.js","assets/TaskDetailPage-BoA-cfwW.js","assets/WorkflowExecutionPage-soRFz_30.js","assets/AdminDashboard-CsTOErp1.js","assets/index-B-jzKfuv.js","assets/TaskQueuePill-Ce8KlXtR.js","assets/index-BU04qgJt.js","assets/ConfirmDeleteModal-dOxidrSR.js","assets/StepIndicator-CuUIGxKk.js","assets/index-B-ioA6yv.js","assets/index-DrouIN-M.js","assets/index-BpoHVMV7.js","assets/RolesPage-DYSt2aAr.js","assets/index-DzICLMI7.js","assets/index-BMpoMc4A.js","assets/CredentialsPage-C7XT1bnO.js","assets/index-CEnDYJOO.js","assets/DropZone-DHKmMqRA.js","assets/index-qT78AZDq.js"])))=>i.map(i=>d[i]);
2
+ var fx=Object.defineProperty;var hx=(r,n,s)=>n in r?fx(r,n,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[n]=s;var v=(r,n,s)=>hx(r,typeof n!="symbol"?n+"":n,s);import{r as dx,a as C,j as p,u as fs,b as Nn,c as Ln,Q as mx,d as px}from"./vendor-query-B2UbickB.js";import{r as gx,L as pr,u as Ei,N as Ac,a as eg,b as Vs,O as bc,c as tg,d as yx,R as bx}from"./vendor-react-CX88sFS5.js";import{R as xx,C as vx,I as _x,B as ng,U as wx,a as Sx,T as Ex,W as Ax,A as Ox,S as jx,P as Tx,L as sg,b as Nx,c as Cx,d as Yf,F as kx,e as Mx,M as ig,f as rg,g as Rx,h as Dx,E as zx,i as qx,j as Ux,k as Qp,X as Gf,G as Bx,l as Lx,m as Hx,n as Px,o as $x}from"./vendor-icons-BkK55L-1.js";(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))a(c);new MutationObserver(c=>{for(const f of c)if(f.type==="childList")for(const h of f.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&a(h)}).observe(document,{childList:!0,subtree:!0});function s(c){const f={};return c.integrity&&(f.integrity=c.integrity),c.referrerPolicy&&(f.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?f.credentials="include":c.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function a(c){if(c.ep)return;c.ep=!0;const f=s(c);fetch(c.href,f)}})();var nf={exports:{}},_a={},sf={exports:{}},rf={};/**
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 Xp;function Yx(){return Xp||(Xp=1,(function(r){function n($,te){var he=$.length;$.push(te);e:for(;0<he;){var xe=he-1>>>1,ye=$[xe];if(0<c(ye,te))$[xe]=te,$[he]=ye,he=xe;else break e}}function s($){return $.length===0?null:$[0]}function a($){if($.length===0)return null;var te=$[0],he=$.pop();if(he!==te){$[0]=he;e:for(var xe=0,ye=$.length,Ae=ye>>>1;xe<Ae;){var ve=2*(xe+1)-1,Oe=$[ve],lt=ve+1,Pt=$[lt];if(0>c(Oe,he))lt<ye&&0>c(Pt,Oe)?($[xe]=Pt,$[lt]=he,xe=lt):($[xe]=Oe,$[ve]=he,xe=ve);else if(lt<ye&&0>c(Pt,he))$[xe]=Pt,$[lt]=he,xe=lt;else break e}}return te}function c($,te){var he=$.sortIndex-te.sortIndex;return he!==0?he:$.id-te.id}if(r.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;r.unstable_now=function(){return f.now()}}else{var h=Date,d=h.now();r.unstable_now=function(){return h.now()-d}}var g=[],y=[],A=1,S=null,j=3,z=!1,R=!1,H=!1,ee=!1,ne=typeof setTimeout=="function"?setTimeout:null,W=typeof clearTimeout=="function"?clearTimeout:null,me=typeof setImmediate<"u"?setImmediate:null;function be($){for(var te=s(y);te!==null;){if(te.callback===null)a(y);else if(te.startTime<=$)a(y),te.sortIndex=te.expirationTime,n(g,te);else break;te=s(y)}}function k($){if(H=!1,be($),!R)if(s(g)!==null)R=!0,I||(I=!0,re());else{var te=s(y);te!==null&&Le(k,te.startTime-$)}}var I=!1,ie=-1,Z=5,Q=-1;function K(){return ee?!0:!(r.unstable_now()-Q<Z)}function ae(){if(ee=!1,I){var $=r.unstable_now();Q=$;var te=!0;try{e:{R=!1,H&&(H=!1,W(ie),ie=-1),z=!0;var he=j;try{t:{for(be($),S=s(g);S!==null&&!(S.expirationTime>$&&K());){var xe=S.callback;if(typeof xe=="function"){S.callback=null,j=S.priorityLevel;var ye=xe(S.expirationTime<=$);if($=r.unstable_now(),typeof ye=="function"){S.callback=ye,be($),te=!0;break t}S===s(g)&&a(g),be($)}else a(g);S=s(g)}if(S!==null)te=!0;else{var Ae=s(y);Ae!==null&&Le(k,Ae.startTime-$),te=!1}}break e}finally{S=null,j=he,z=!1}te=void 0}}finally{te?re():I=!1}}}var re;if(typeof me=="function")re=function(){me(ae)};else if(typeof MessageChannel<"u"){var qe=new MessageChannel,Ge=qe.port2;qe.port1.onmessage=ae,re=function(){Ge.postMessage(null)}}else re=function(){ne(ae,0)};function Le($,te){ie=ne(function(){$(r.unstable_now())},te)}r.unstable_IdlePriority=5,r.unstable_ImmediatePriority=1,r.unstable_LowPriority=4,r.unstable_NormalPriority=3,r.unstable_Profiling=null,r.unstable_UserBlockingPriority=2,r.unstable_cancelCallback=function($){$.callback=null},r.unstable_forceFrameRate=function($){0>$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Z=0<$?Math.floor(1e3/$):5},r.unstable_getCurrentPriorityLevel=function(){return j},r.unstable_next=function($){switch(j){case 1:case 2:case 3:var te=3;break;default:te=j}var he=j;j=te;try{return $()}finally{j=he}},r.unstable_requestPaint=function(){ee=!0},r.unstable_runWithPriority=function($,te){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var he=j;j=$;try{return te()}finally{j=he}},r.unstable_scheduleCallback=function($,te,he){var xe=r.unstable_now();switch(typeof he=="object"&&he!==null?(he=he.delay,he=typeof he=="number"&&0<he?xe+he:xe):he=xe,$){case 1:var ye=-1;break;case 2:ye=250;break;case 5:ye=1073741823;break;case 4:ye=1e4;break;default:ye=5e3}return ye=he+ye,$={id:A++,callback:te,priorityLevel:$,startTime:he,expirationTime:ye,sortIndex:-1},he>xe?($.sortIndex=he,n(y,$),s(g)===null&&$===s(y)&&(H?(W(ie),ie=-1):H=!0,Le(k,he-xe))):($.sortIndex=ye,n(g,$),R||z||(R=!0,I||(I=!0,re()))),$},r.unstable_shouldYield=K,r.unstable_wrapCallback=function($){var te=j;return function(){var he=j;j=te;try{return $.apply(this,arguments)}finally{j=he}}}})(rf)),rf}var Ip;function Gx(){return Ip||(Ip=1,sf.exports=Yx()),sf.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 Kp;function Vx(){if(Kp)return _a;Kp=1;var r=Gx(),n=dx(),s=gx();function a(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var i=2;i<arguments.length;i++)t+="&args[]="+encodeURIComponent(arguments[i])}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 c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function f(e){var t=e,i=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(i=t.return),e=t.return;while(e)}return t.tag===3?i:null}function h(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 d(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 g(e){if(f(e)!==e)throw Error(a(188))}function y(e){var t=e.alternate;if(!t){if(t=f(e),t===null)throw Error(a(188));return t!==e?null:e}for(var i=e,l=t;;){var o=i.return;if(o===null)break;var u=o.alternate;if(u===null){if(l=o.return,l!==null){i=l;continue}break}if(o.child===u.child){for(u=o.child;u;){if(u===i)return g(o),e;if(u===l)return g(o),t;u=u.sibling}throw Error(a(188))}if(i.return!==l.return)i=o,l=u;else{for(var m=!1,b=o.child;b;){if(b===i){m=!0,i=o,l=u;break}if(b===l){m=!0,l=o,i=u;break}b=b.sibling}if(!m){for(b=u.child;b;){if(b===i){m=!0,i=u,l=o;break}if(b===l){m=!0,l=u,i=o;break}b=b.sibling}if(!m)throw Error(a(189))}}if(i.alternate!==l)throw Error(a(190))}if(i.tag!==3)throw Error(a(188));return i.stateNode.current===i?e:t}function A(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=A(e),t!==null)return t;e=e.sibling}return null}var S=Object.assign,j=Symbol.for("react.element"),z=Symbol.for("react.transitional.element"),R=Symbol.for("react.portal"),H=Symbol.for("react.fragment"),ee=Symbol.for("react.strict_mode"),ne=Symbol.for("react.profiler"),W=Symbol.for("react.consumer"),me=Symbol.for("react.context"),be=Symbol.for("react.forward_ref"),k=Symbol.for("react.suspense"),I=Symbol.for("react.suspense_list"),ie=Symbol.for("react.memo"),Z=Symbol.for("react.lazy"),Q=Symbol.for("react.activity"),K=Symbol.for("react.memo_cache_sentinel"),ae=Symbol.iterator;function re(e){return e===null||typeof e!="object"?null:(e=ae&&e[ae]||e["@@iterator"],typeof e=="function"?e:null)}var qe=Symbol.for("react.client.reference");function Ge(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===qe?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case H:return"Fragment";case ne:return"Profiler";case ee:return"StrictMode";case k:return"Suspense";case I:return"SuspenseList";case Q:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case R:return"Portal";case me:return e.displayName||"Context";case W:return(e._context.displayName||"Context")+".Consumer";case be:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ie:return t=e.displayName||null,t!==null?t:Ge(e.type)||"Memo";case Z:t=e._payload,e=e._init;try{return Ge(e(t))}catch{}}return null}var Le=Array.isArray,$=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,te=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,he={pending:!1,data:null,method:null,action:null},xe=[],ye=-1;function Ae(e){return{current:e}}function ve(e){0>ye||(e.current=xe[ye],xe[ye]=null,ye--)}function Oe(e,t){ye++,xe[ye]=e.current,e.current=t}var lt=Ae(null),Pt=Ae(null),sn=Ae(null),Ot=Ae(null);function jt(e,t){switch(Oe(sn,t),Oe(Pt,e),Oe(lt,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?yp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=yp(t),e=bp(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}ve(lt),Oe(lt,e)}function _e(){ve(lt),ve(Pt),ve(sn)}function Tt(e){e.memoizedState!==null&&Oe(Ot,e);var t=lt.current,i=bp(t,e.type);t!==i&&(Oe(Pt,e),Oe(lt,i))}function Zs(e){Pt.current===e&&(ve(lt),ve(Pt)),Ot.current===e&&(ve(Ot),ya._currentValue=he)}var ji,Ws;function rn(e){if(ji===void 0)try{throw Error()}catch(i){var t=i.stack.trim().match(/\n( *(at )?)/);ji=t&&t[1]||"",Ws=-1<i.stack.indexOf(`
19
+ at`)?" (<anonymous>)":-1<i.stack.indexOf("@")?"@unknown:0:0":""}return`
20
+ `+ji+e+Ws}var Ti=!1;function hs(e,t){if(!e||Ti)return"";Ti=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(t){var J=function(){throw Error()};if(Object.defineProperty(J.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(J,[])}catch(P){var B=P}Reflect.construct(e,[],J)}else{try{J.call()}catch(P){B=P}e.call(J.prototype)}}else{try{throw Error()}catch(P){B=P}(J=e())&&typeof J.catch=="function"&&J.catch(function(){})}}catch(P){if(P&&B&&typeof P.stack=="string")return[P.stack,B.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var o=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");o&&o.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var u=l.DetermineComponentFrameRoot(),m=u[0],b=u[1];if(m&&b){var O=m.split(`
21
+ `),U=b.split(`
22
+ `);for(o=l=0;l<O.length&&!O[l].includes("DetermineComponentFrameRoot");)l++;for(;o<U.length&&!U[o].includes("DetermineComponentFrameRoot");)o++;if(l===O.length||o===U.length)for(l=O.length-1,o=U.length-1;1<=l&&0<=o&&O[l]!==U[o];)o--;for(;1<=l&&0<=o;l--,o--)if(O[l]!==U[o]){if(l!==1||o!==1)do if(l--,o--,0>o||O[l]!==U[o]){var Y=`
23
+ `+O[l].replace(" at new "," at ");return e.displayName&&Y.includes("<anonymous>")&&(Y=Y.replace("<anonymous>",e.displayName)),Y}while(1<=l&&0<=o);break}}}finally{Ti=!1,Error.prepareStackTrace=i}return(i=e?e.displayName||e.name:"")?rn(i):""}function Ya(e,t){switch(e.tag){case 26:case 27:case 5:return rn(e.type);case 16:return rn("Lazy");case 13:return e.child!==t&&t!==null?rn("Suspense Fallback"):rn("Suspense");case 19:return rn("SuspenseList");case 0:case 15:return hs(e.type,!1);case 11:return hs(e.type.render,!1);case 1:return hs(e.type,!0);case 31:return rn("Activity");default:return""}}function Ga(e){try{var t="",i=null;do t+=Ya(e,i),i=e,e=e.return;while(e);return t}catch(l){return`
24
+ Error generating stack: `+l.message+`
25
+ `+l.stack}}var jr=Object.prototype.hasOwnProperty,Tr=r.unstable_scheduleCallback,Hn=r.unstable_cancelCallback,Va=r.unstable_shouldYield,Ni=r.unstable_requestPaint,et=r.unstable_now,Vc=r.unstable_getCurrentPriorityLevel,Fa=r.unstable_ImmediatePriority,Ja=r.unstable_UserBlockingPriority,Ci=r.unstable_NormalPriority,Fc=r.unstable_LowPriority,Qa=r.unstable_IdlePriority,Jc=r.log,Xa=r.unstable_setDisableYieldValue,ei=null,ct=null;function $t(e){if(typeof Jc=="function"&&Xa(e),ct&&typeof ct.setStrictMode=="function")try{ct.setStrictMode(ei,e)}catch{}}var Nt=Math.clz32?Math.clz32:ki,Nr=Math.log,Cr=Math.LN2;function ki(e){return e>>>=0,e===0?32:31-(Nr(e)/Cr|0)|0}var ds=256,Pn=262144,ms=4194304;function xn(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 ti(e,t,i){var l=e.pendingLanes;if(l===0)return 0;var o=0,u=e.suspendedLanes,m=e.pingedLanes;e=e.warmLanes;var b=l&134217727;return b!==0?(l=b&~u,l!==0?o=xn(l):(m&=b,m!==0?o=xn(m):i||(i=b&~e,i!==0&&(o=xn(i))))):(b=l&~u,b!==0?o=xn(b):m!==0?o=xn(m):i||(i=l&~e,i!==0&&(o=xn(i)))),o===0?0:t!==0&&t!==o&&(t&u)===0&&(u=o&-o,i=t&-t,u>=i||u===32&&(i&4194048)!==0)?t:o}function ni(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function kr(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 Mi(){var e=ms;return ms<<=1,(ms&62914560)===0&&(ms=4194304),e}function ps(e){for(var t=[],i=0;31>i;i++)t.push(e);return t}function vn(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function gs(e,t,i,l,o,u){var m=e.pendingLanes;e.pendingLanes=i,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=i,e.entangledLanes&=i,e.errorRecoveryDisabledLanes&=i,e.shellSuspendCounter=0;var b=e.entanglements,O=e.expirationTimes,U=e.hiddenUpdates;for(i=m&~i;0<i;){var Y=31-Nt(i),J=1<<Y;b[Y]=0,O[Y]=-1;var B=U[Y];if(B!==null)for(U[Y]=null,Y=0;Y<B.length;Y++){var P=B[Y];P!==null&&(P.lane&=-536870913)}i&=~J}l!==0&&ys(e,l,0),u!==0&&o===0&&e.tag!==0&&(e.suspendedLanes|=u&~(m&~t))}function ys(e,t,i){e.pendingLanes|=t,e.suspendedLanes&=~t;var l=31-Nt(t);e.entangledLanes|=t,e.entanglements[l]=e.entanglements[l]|1073741824|i&261930}function si(e,t){var i=e.entangledLanes|=t;for(e=e.entanglements;i;){var l=31-Nt(i),o=1<<l;o&t|e[l]&t&&(e[l]|=t),i&=~o}}function bs(e,t){var i=t&-t;return i=(i&42)!==0?1:$n(i),(i&(e.suspendedLanes|t))!==0?0:i}function $n(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 ii(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Mr(){var e=te.p;return e!==0?e:(e=window.event,e===void 0?32:Pp(e.type))}function Ia(e,t){var i=te.p;try{return te.p=e,t()}finally{te.p=i}}var Cn=Math.random().toString(36).slice(2),Qe="__reactFiber$"+Cn,it="__reactProps$"+Cn,Yt="__reactContainer$"+Cn,ri="__reactEvents$"+Cn,Rr="__reactListeners$"+Cn,Ka="__reactHandles$"+Cn,Za="__reactResources$"+Cn,yt="__reactMarker$"+Cn;function Ri(e){delete e[Qe],delete e[it],delete e[ri],delete e[Rr],delete e[Ka]}function x(e){var t=e[Qe];if(t)return t;for(var i=e.parentNode;i;){if(t=i[Yt]||i[Qe]){if(i=t.alternate,t.child!==null||i!==null&&i.child!==null)for(e=Ap(e);e!==null;){if(i=e[Qe])return i;e=Ap(e)}return t}e=i,i=e.parentNode}return null}function w(e){if(e=e[Qe]||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(a(33))}function E(e){var t=e[Za];return t||(t=e[Za]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function T(e){e[yt]=!0}var D=new Set,F={};function X(e,t){L(e,t),L(e+"Capture",t)}function L(e,t){for(F[e]=t,e=0;e<t.length;e++)D.add(t[e])}var V=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]*$"),ue={},Ee={};function Ke(e){return jr.call(Ee,e)?!0:jr.call(ue,e)?!1:V.test(e)?Ee[e]=!0:(ue[e]=!0,!1)}function Ct(e,t,i){if(Ke(t))if(i===null)e.removeAttribute(t);else{switch(typeof i){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var l=t.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+i)}}function _n(e,t,i){if(i===null)e.removeAttribute(t);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+i)}}function Yn(e,t,i,l){if(l===null)e.removeAttribute(i);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(i);return}e.setAttributeNS(t,i,""+l)}}function an(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function oh(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function iy(e,t,i){var l=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var o=l.get,u=l.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(m){i=""+m,u.call(this,m)}}),Object.defineProperty(e,t,{enumerable:l.enumerable}),{getValue:function(){return i},setValue:function(m){i=""+m},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Qc(e){if(!e._valueTracker){var t=oh(e)?"checked":"value";e._valueTracker=iy(e,t,""+e[t])}}function uh(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var i=t.getValue(),l="";return e&&(l=oh(e)?e.checked?"true":"false":e.value),e=l,e!==i?(t.setValue(e),!0):!1}function Wa(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 ry=/[\n"\\]/g;function ln(e){return e.replace(ry,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Xc(e,t,i,l,o,u,m,b){e.name="",m!=null&&typeof m!="function"&&typeof m!="symbol"&&typeof m!="boolean"?e.type=m:e.removeAttribute("type"),t!=null?m==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+an(t)):e.value!==""+an(t)&&(e.value=""+an(t)):m!=="submit"&&m!=="reset"||e.removeAttribute("value"),t!=null?Ic(e,m,an(t)):i!=null?Ic(e,m,an(i)):l!=null&&e.removeAttribute("value"),o==null&&u!=null&&(e.defaultChecked=!!u),o!=null&&(e.checked=o&&typeof o!="function"&&typeof o!="symbol"),b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.name=""+an(b):e.removeAttribute("name")}function fh(e,t,i,l,o,u,m,b){if(u!=null&&typeof u!="function"&&typeof u!="symbol"&&typeof u!="boolean"&&(e.type=u),t!=null||i!=null){if(!(u!=="submit"&&u!=="reset"||t!=null)){Qc(e);return}i=i!=null?""+an(i):"",t=t!=null?""+an(t):i,b||t===e.value||(e.value=t),e.defaultValue=t}l=l??o,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=b?e.checked:!!l,e.defaultChecked=!!l,m!=null&&typeof m!="function"&&typeof m!="symbol"&&typeof m!="boolean"&&(e.name=m),Qc(e)}function Ic(e,t,i){t==="number"&&Wa(e.ownerDocument)===e||e.defaultValue===""+i||(e.defaultValue=""+i)}function Di(e,t,i,l){if(e=e.options,t){t={};for(var o=0;o<i.length;o++)t["$"+i[o]]=!0;for(i=0;i<e.length;i++)o=t.hasOwnProperty("$"+e[i].value),e[i].selected!==o&&(e[i].selected=o),o&&l&&(e[i].defaultSelected=!0)}else{for(i=""+an(i),t=null,o=0;o<e.length;o++){if(e[o].value===i){e[o].selected=!0,l&&(e[o].defaultSelected=!0);return}t!==null||e[o].disabled||(t=e[o])}t!==null&&(t.selected=!0)}}function hh(e,t,i){if(t!=null&&(t=""+an(t),t!==e.value&&(e.value=t),i==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=i!=null?""+an(i):""}function dh(e,t,i,l){if(t==null){if(l!=null){if(i!=null)throw Error(a(92));if(Le(l)){if(1<l.length)throw Error(a(93));l=l[0]}i=l}i==null&&(i=""),t=i}i=an(t),e.defaultValue=i,l=e.textContent,l===i&&l!==""&&l!==null&&(e.value=l),Qc(e)}function zi(e,t){if(t){var i=e.firstChild;if(i&&i===e.lastChild&&i.nodeType===3){i.nodeValue=t;return}}e.textContent=t}var ay=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 mh(e,t,i){var l=t.indexOf("--")===0;i==null||typeof i=="boolean"||i===""?l?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":l?e.setProperty(t,i):typeof i!="number"||i===0||ay.has(t)?t==="float"?e.cssFloat=i:e[t]=(""+i).trim():e[t]=i+"px"}function ph(e,t,i){if(t!=null&&typeof t!="object")throw Error(a(62));if(e=e.style,i!=null){for(var l in i)!i.hasOwnProperty(l)||t!=null&&t.hasOwnProperty(l)||(l.indexOf("--")===0?e.setProperty(l,""):l==="float"?e.cssFloat="":e[l]="");for(var o in t)l=t[o],t.hasOwnProperty(o)&&i[o]!==l&&mh(e,o,l)}else for(var u in t)t.hasOwnProperty(u)&&mh(e,u,t[u])}function Kc(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 ly=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"]]),cy=/^[\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 el(e){return cy.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Gn(){}var Zc=null;function Wc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var qi=null,Ui=null;function gh(e){var t=w(e);if(t&&(e=t.stateNode)){var i=e[it]||null;e:switch(e=t.stateNode,t.type){case"input":if(Xc(e,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name),t=i.name,i.type==="radio"&&t!=null){for(i=e;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll('input[name="'+ln(""+t)+'"][type="radio"]'),t=0;t<i.length;t++){var l=i[t];if(l!==e&&l.form===e.form){var o=l[it]||null;if(!o)throw Error(a(90));Xc(l,o.value,o.defaultValue,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name)}}for(t=0;t<i.length;t++)l=i[t],l.form===e.form&&uh(l)}break e;case"textarea":hh(e,i.value,i.defaultValue);break e;case"select":t=i.value,t!=null&&Di(e,!!i.multiple,t,!1)}}}var eo=!1;function yh(e,t,i){if(eo)return e(t,i);eo=!0;try{var l=e(t);return l}finally{if(eo=!1,(qi!==null||Ui!==null)&&(Pl(),qi&&(t=qi,e=Ui,Ui=qi=null,gh(t),e)))for(t=0;t<e.length;t++)gh(e[t])}}function Dr(e,t){var i=e.stateNode;if(i===null)return null;var l=i[it]||null;if(l===null)return null;i=l[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(e=e.type,l=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!l;break e;default:e=!1}if(e)return null;if(i&&typeof i!="function")throw Error(a(231,t,typeof i));return i}var Vn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),to=!1;if(Vn)try{var zr={};Object.defineProperty(zr,"passive",{get:function(){to=!0}}),window.addEventListener("test",zr,zr),window.removeEventListener("test",zr,zr)}catch{to=!1}var xs=null,no=null,tl=null;function bh(){if(tl)return tl;var e,t=no,i=t.length,l,o="value"in xs?xs.value:xs.textContent,u=o.length;for(e=0;e<i&&t[e]===o[e];e++);var m=i-e;for(l=1;l<=m&&t[i-l]===o[u-l];l++);return tl=o.slice(e,1<l?1-l:void 0)}function nl(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 sl(){return!0}function xh(){return!1}function zt(e){function t(i,l,o,u,m){this._reactName=i,this._targetInst=o,this.type=l,this.nativeEvent=u,this.target=m,this.currentTarget=null;for(var b in e)e.hasOwnProperty(b)&&(i=e[b],this[b]=i?i(u):u[b]);return this.isDefaultPrevented=(u.defaultPrevented!=null?u.defaultPrevented:u.returnValue===!1)?sl:xh,this.isPropagationStopped=xh,this}return S(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=sl)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=sl)},persist:function(){},isPersistent:sl}),t}var ai={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},il=zt(ai),qr=S({},ai,{view:0,detail:0}),oy=zt(qr),so,io,Ur,rl=S({},qr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ao,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!==Ur&&(Ur&&e.type==="mousemove"?(so=e.screenX-Ur.screenX,io=e.screenY-Ur.screenY):io=so=0,Ur=e),so)},movementY:function(e){return"movementY"in e?e.movementY:io}}),vh=zt(rl),uy=S({},rl,{dataTransfer:0}),fy=zt(uy),hy=S({},qr,{relatedTarget:0}),ro=zt(hy),dy=S({},ai,{animationName:0,elapsedTime:0,pseudoElement:0}),my=zt(dy),py=S({},ai,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),gy=zt(py),yy=S({},ai,{data:0}),_h=zt(yy),by={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},xy={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"},vy={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function _y(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=vy[e])?!!t[e]:!1}function ao(){return _y}var wy=S({},qr,{key:function(e){if(e.key){var t=by[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=nl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?xy[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ao,charCode:function(e){return e.type==="keypress"?nl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?nl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Sy=zt(wy),Ey=S({},rl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),wh=zt(Ey),Ay=S({},qr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ao}),Oy=zt(Ay),jy=S({},ai,{propertyName:0,elapsedTime:0,pseudoElement:0}),Ty=zt(jy),Ny=S({},rl,{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}),Cy=zt(Ny),ky=S({},ai,{newState:0,oldState:0}),My=zt(ky),Ry=[9,13,27,32],lo=Vn&&"CompositionEvent"in window,Br=null;Vn&&"documentMode"in document&&(Br=document.documentMode);var Dy=Vn&&"TextEvent"in window&&!Br,Sh=Vn&&(!lo||Br&&8<Br&&11>=Br),Eh=" ",Ah=!1;function Oh(e,t){switch(e){case"keyup":return Ry.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function jh(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Bi=!1;function zy(e,t){switch(e){case"compositionend":return jh(t);case"keypress":return t.which!==32?null:(Ah=!0,Eh);case"textInput":return e=t.data,e===Eh&&Ah?null:e;default:return null}}function qy(e,t){if(Bi)return e==="compositionend"||!lo&&Oh(e,t)?(e=bh(),tl=no=xs=null,Bi=!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 Uy={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 Th(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Uy[e.type]:t==="textarea"}function Nh(e,t,i,l){qi?Ui?Ui.push(l):Ui=[l]:qi=l,t=Ql(t,"onChange"),0<t.length&&(i=new il("onChange","change",null,i,l),e.push({event:i,listeners:t}))}var Lr=null,Hr=null;function By(e){fp(e,0)}function al(e){var t=_(e);if(uh(t))return e}function Ch(e,t){if(e==="change")return t}var kh=!1;if(Vn){var co;if(Vn){var oo="oninput"in document;if(!oo){var Mh=document.createElement("div");Mh.setAttribute("oninput","return;"),oo=typeof Mh.oninput=="function"}co=oo}else co=!1;kh=co&&(!document.documentMode||9<document.documentMode)}function Rh(){Lr&&(Lr.detachEvent("onpropertychange",Dh),Hr=Lr=null)}function Dh(e){if(e.propertyName==="value"&&al(Hr)){var t=[];Nh(t,Hr,e,Wc(e)),yh(By,t)}}function Ly(e,t,i){e==="focusin"?(Rh(),Lr=t,Hr=i,Lr.attachEvent("onpropertychange",Dh)):e==="focusout"&&Rh()}function Hy(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return al(Hr)}function Py(e,t){if(e==="click")return al(t)}function $y(e,t){if(e==="input"||e==="change")return al(t)}function Yy(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Gt=typeof Object.is=="function"?Object.is:Yy;function Pr(e,t){if(Gt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var i=Object.keys(e),l=Object.keys(t);if(i.length!==l.length)return!1;for(l=0;l<i.length;l++){var o=i[l];if(!jr.call(t,o)||!Gt(e[o],t[o]))return!1}return!0}function zh(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function qh(e,t){var i=zh(e);e=0;for(var l;i;){if(i.nodeType===3){if(l=e+i.textContent.length,e<=t&&l>=t)return{node:i,offset:t-e};e=l}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=zh(i)}}function Uh(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Uh(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=Wa(e.document);t instanceof e.HTMLIFrameElement;){try{var i=typeof t.contentWindow.location.href=="string"}catch{i=!1}if(i)e=t.contentWindow;else break;t=Wa(e.document)}return t}function uo(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 Gy=Vn&&"documentMode"in document&&11>=document.documentMode,Li=null,fo=null,$r=null,ho=!1;function Lh(e,t,i){var l=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;ho||Li==null||Li!==Wa(l)||(l=Li,"selectionStart"in l&&uo(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),$r&&Pr($r,l)||($r=l,l=Ql(fo,"onSelect"),0<l.length&&(t=new il("onSelect","select",null,t,i),e.push({event:t,listeners:l}),t.target=Li)))}function li(e,t){var i={};return i[e.toLowerCase()]=t.toLowerCase(),i["Webkit"+e]="webkit"+t,i["Moz"+e]="moz"+t,i}var Hi={animationend:li("Animation","AnimationEnd"),animationiteration:li("Animation","AnimationIteration"),animationstart:li("Animation","AnimationStart"),transitionrun:li("Transition","TransitionRun"),transitionstart:li("Transition","TransitionStart"),transitioncancel:li("Transition","TransitionCancel"),transitionend:li("Transition","TransitionEnd")},mo={},Hh={};Vn&&(Hh=document.createElement("div").style,"AnimationEvent"in window||(delete Hi.animationend.animation,delete Hi.animationiteration.animation,delete Hi.animationstart.animation),"TransitionEvent"in window||delete Hi.transitionend.transition);function ci(e){if(mo[e])return mo[e];if(!Hi[e])return e;var t=Hi[e],i;for(i in t)if(t.hasOwnProperty(i)&&i in Hh)return mo[e]=t[i];return e}var Ph=ci("animationend"),$h=ci("animationiteration"),Yh=ci("animationstart"),Vy=ci("transitionrun"),Fy=ci("transitionstart"),Jy=ci("transitioncancel"),Gh=ci("transitionend"),Vh=new Map,po="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(" ");po.push("scrollEnd");function wn(e,t){Vh.set(e,t),X(t,[e])}var ll=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)},cn=[],Pi=0,go=0;function cl(){for(var e=Pi,t=go=Pi=0;t<e;){var i=cn[t];cn[t++]=null;var l=cn[t];cn[t++]=null;var o=cn[t];cn[t++]=null;var u=cn[t];if(cn[t++]=null,l!==null&&o!==null){var m=l.pending;m===null?o.next=o:(o.next=m.next,m.next=o),l.pending=o}u!==0&&Fh(i,o,u)}}function ol(e,t,i,l){cn[Pi++]=e,cn[Pi++]=t,cn[Pi++]=i,cn[Pi++]=l,go|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function yo(e,t,i,l){return ol(e,t,i,l),ul(e)}function oi(e,t){return ol(e,null,null,t),ul(e)}function Fh(e,t,i){e.lanes|=i;var l=e.alternate;l!==null&&(l.lanes|=i);for(var o=!1,u=e.return;u!==null;)u.childLanes|=i,l=u.alternate,l!==null&&(l.childLanes|=i),u.tag===22&&(e=u.stateNode,e===null||e._visibility&1||(o=!0)),e=u,u=u.return;return e.tag===3?(u=e.stateNode,o&&t!==null&&(o=31-Nt(i),e=u.hiddenUpdates,l=e[o],l===null?e[o]=[t]:l.push(t),t.lane=i|536870912),u):null}function ul(e){if(50<ua)throw ua=0,Ou=null,Error(a(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var $i={};function Qy(e,t,i,l){this.tag=e,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Vt(e,t,i,l){return new Qy(e,t,i,l)}function bo(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Fn(e,t){var i=e.alternate;return i===null?(i=Vt(e.tag,t,e.key,e.mode),i.elementType=e.elementType,i.type=e.type,i.stateNode=e.stateNode,i.alternate=e,e.alternate=i):(i.pendingProps=t,i.type=e.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=e.flags&65011712,i.childLanes=e.childLanes,i.lanes=e.lanes,i.child=e.child,i.memoizedProps=e.memoizedProps,i.memoizedState=e.memoizedState,i.updateQueue=e.updateQueue,t=e.dependencies,i.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},i.sibling=e.sibling,i.index=e.index,i.ref=e.ref,i.refCleanup=e.refCleanup,i}function Jh(e,t){e.flags&=65011714;var i=e.alternate;return i===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=i.childLanes,e.lanes=i.lanes,e.child=i.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=i.memoizedProps,e.memoizedState=i.memoizedState,e.updateQueue=i.updateQueue,e.type=i.type,t=i.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function fl(e,t,i,l,o,u){var m=0;if(l=e,typeof e=="function")bo(e)&&(m=1);else if(typeof e=="string")m=Wb(e,i,lt.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case Q:return e=Vt(31,i,t,o),e.elementType=Q,e.lanes=u,e;case H:return ui(i.children,o,u,t);case ee:m=8,o|=24;break;case ne:return e=Vt(12,i,t,o|2),e.elementType=ne,e.lanes=u,e;case k:return e=Vt(13,i,t,o),e.elementType=k,e.lanes=u,e;case I:return e=Vt(19,i,t,o),e.elementType=I,e.lanes=u,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case me:m=10;break e;case W:m=9;break e;case be:m=11;break e;case ie:m=14;break e;case Z:m=16,l=null;break e}m=29,i=Error(a(130,e===null?"null":typeof e,"")),l=null}return t=Vt(m,i,t,o),t.elementType=e,t.type=l,t.lanes=u,t}function ui(e,t,i,l){return e=Vt(7,e,l,t),e.lanes=i,e}function xo(e,t,i){return e=Vt(6,e,null,t),e.lanes=i,e}function Qh(e){var t=Vt(18,null,null,0);return t.stateNode=e,t}function vo(e,t,i){return t=Vt(4,e.children!==null?e.children:[],e.key,t),t.lanes=i,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Xh=new WeakMap;function on(e,t){if(typeof e=="object"&&e!==null){var i=Xh.get(e);return i!==void 0?i:(t={value:e,source:t,stack:Ga(t)},Xh.set(e,t),t)}return{value:e,source:t,stack:Ga(t)}}var Yi=[],Gi=0,hl=null,Yr=0,un=[],fn=0,vs=null,kn=1,Mn="";function Jn(e,t){Yi[Gi++]=Yr,Yi[Gi++]=hl,hl=e,Yr=t}function Ih(e,t,i){un[fn++]=kn,un[fn++]=Mn,un[fn++]=vs,vs=e;var l=kn;e=Mn;var o=32-Nt(l)-1;l&=~(1<<o),i+=1;var u=32-Nt(t)+o;if(30<u){var m=o-o%5;u=(l&(1<<m)-1).toString(32),l>>=m,o-=m,kn=1<<32-Nt(t)+o|i<<o|l,Mn=u+e}else kn=1<<u|i<<o|l,Mn=e}function _o(e){e.return!==null&&(Jn(e,1),Ih(e,1,0))}function wo(e){for(;e===hl;)hl=Yi[--Gi],Yi[Gi]=null,Yr=Yi[--Gi],Yi[Gi]=null;for(;e===vs;)vs=un[--fn],un[fn]=null,Mn=un[--fn],un[fn]=null,kn=un[--fn],un[fn]=null}function Kh(e,t){un[fn++]=kn,un[fn++]=Mn,un[fn++]=vs,kn=t.id,Mn=t.overflow,vs=e}var wt=null,Ze=null,Me=!1,_s=null,hn=!1,So=Error(a(519));function ws(e){var t=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Gr(on(t,e)),So}function Zh(e){var t=e.stateNode,i=e.type,l=e.memoizedProps;switch(t[Qe]=e,t[it]=l,i){case"dialog":Te("cancel",t),Te("close",t);break;case"iframe":case"object":case"embed":Te("load",t);break;case"video":case"audio":for(i=0;i<ha.length;i++)Te(ha[i],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),fh(t,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":Te("invalid",t);break;case"textarea":Te("invalid",t),dh(t,l.value,l.defaultValue,l.children)}i=l.children,typeof i!="string"&&typeof i!="number"&&typeof i!="bigint"||t.textContent===""+i||l.suppressHydrationWarning===!0||pp(t.textContent,i)?(l.popover!=null&&(Te("beforetoggle",t),Te("toggle",t)),l.onScroll!=null&&Te("scroll",t),l.onScrollEnd!=null&&Te("scrollend",t),l.onClick!=null&&(t.onclick=Gn),t=!0):t=!1,t||ws(e,!0)}function Wh(e){for(wt=e.return;wt;)switch(wt.tag){case 5:case 31:case 13:hn=!1;return;case 27:case 3:hn=!0;return;default:wt=wt.return}}function Vi(e){if(e!==wt)return!1;if(!Me)return Wh(e),Me=!0,!1;var t=e.tag,i;if((i=t!==3&&t!==27)&&((i=t===5)&&(i=e.type,i=!(i!=="form"&&i!=="button")||Pu(e.type,e.memoizedProps)),i=!i),i&&Ze&&ws(e),Wh(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(317));Ze=Ep(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(317));Ze=Ep(e)}else t===27?(t=Ze,qs(e.type)?(e=Fu,Fu=null,Ze=e):Ze=t):Ze=wt?mn(e.stateNode.nextSibling):null;return!0}function fi(){Ze=wt=null,Me=!1}function Eo(){var e=_s;return e!==null&&(Lt===null?Lt=e:Lt.push.apply(Lt,e),_s=null),e}function Gr(e){_s===null?_s=[e]:_s.push(e)}var Ao=Ae(null),hi=null,Qn=null;function Ss(e,t,i){Oe(Ao,t._currentValue),t._currentValue=i}function Xn(e){e._currentValue=Ao.current,ve(Ao)}function Oo(e,t,i){for(;e!==null;){var l=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,l!==null&&(l.childLanes|=t)):l!==null&&(l.childLanes&t)!==t&&(l.childLanes|=t),e===i)break;e=e.return}}function jo(e,t,i,l){var o=e.child;for(o!==null&&(o.return=e);o!==null;){var u=o.dependencies;if(u!==null){var m=o.child;u=u.firstContext;e:for(;u!==null;){var b=u;u=o;for(var O=0;O<t.length;O++)if(b.context===t[O]){u.lanes|=i,b=u.alternate,b!==null&&(b.lanes|=i),Oo(u.return,i,e),l||(m=null);break e}u=b.next}}else if(o.tag===18){if(m=o.return,m===null)throw Error(a(341));m.lanes|=i,u=m.alternate,u!==null&&(u.lanes|=i),Oo(m,i,e),m=null}else m=o.child;if(m!==null)m.return=o;else for(m=o;m!==null;){if(m===e){m=null;break}if(o=m.sibling,o!==null){o.return=m.return,m=o;break}m=m.return}o=m}}function Fi(e,t,i,l){e=null;for(var o=t,u=!1;o!==null;){if(!u){if((o.flags&524288)!==0)u=!0;else if((o.flags&262144)!==0)break}if(o.tag===10){var m=o.alternate;if(m===null)throw Error(a(387));if(m=m.memoizedProps,m!==null){var b=o.type;Gt(o.pendingProps.value,m.value)||(e!==null?e.push(b):e=[b])}}else if(o===Ot.current){if(m=o.alternate,m===null)throw Error(a(387));m.memoizedState.memoizedState!==o.memoizedState.memoizedState&&(e!==null?e.push(ya):e=[ya])}o=o.return}e!==null&&jo(t,e,i,l),t.flags|=262144}function dl(e){for(e=e.firstContext;e!==null;){if(!Gt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function di(e){hi=e,Qn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function St(e){return ed(hi,e)}function ml(e,t){return hi===null&&di(e),ed(e,t)}function ed(e,t){var i=t._currentValue;if(t={context:t,memoizedValue:i,next:null},Qn===null){if(e===null)throw Error(a(308));Qn=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Qn=Qn.next=t;return i}var Xy=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(i,l){e.push(l)}};this.abort=function(){t.aborted=!0,e.forEach(function(i){return i()})}},Iy=r.unstable_scheduleCallback,Ky=r.unstable_NormalPriority,ht={$$typeof:me,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function To(){return{controller:new Xy,data:new Map,refCount:0}}function Vr(e){e.refCount--,e.refCount===0&&Iy(Ky,function(){e.controller.abort()})}var Fr=null,No=0,Ji=0,Qi=null;function Zy(e,t){if(Fr===null){var i=Fr=[];No=0,Ji=Mu(),Qi={status:"pending",value:void 0,then:function(l){i.push(l)}}}return No++,t.then(td,td),t}function td(){if(--No===0&&Fr!==null){Qi!==null&&(Qi.status="fulfilled");var e=Fr;Fr=null,Ji=0,Qi=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Wy(e,t){var i=[],l={status:"pending",value:null,reason:null,then:function(o){i.push(o)}};return e.then(function(){l.status="fulfilled",l.value=t;for(var o=0;o<i.length;o++)(0,i[o])(t)},function(o){for(l.status="rejected",l.reason=o,o=0;o<i.length;o++)(0,i[o])(void 0)}),l}var nd=$.S;$.S=function(e,t){Lm=et(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&Zy(e,t),nd!==null&&nd(e,t)};var mi=Ae(null);function Co(){var e=mi.current;return e!==null?e:Xe.pooledCache}function pl(e,t){t===null?Oe(mi,mi.current):Oe(mi,t.pool)}function sd(){var e=Co();return e===null?null:{parent:ht._currentValue,pool:e}}var Xi=Error(a(460)),ko=Error(a(474)),gl=Error(a(542)),yl={then:function(){}};function id(e){return e=e.status,e==="fulfilled"||e==="rejected"}function rd(e,t,i){switch(i=e[i],i===void 0?e.push(t):i!==t&&(t.then(Gn,Gn),t=i),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,ld(e),e;default:if(typeof t.status=="string")t.then(Gn,Gn);else{if(e=Xe,e!==null&&100<e.shellSuspendCounter)throw Error(a(482));e=t,e.status="pending",e.then(function(l){if(t.status==="pending"){var o=t;o.status="fulfilled",o.value=l}},function(l){if(t.status==="pending"){var o=t;o.status="rejected",o.reason=l}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,ld(e),e}throw gi=t,Xi}}function pi(e){try{var t=e._init;return t(e._payload)}catch(i){throw i!==null&&typeof i=="object"&&typeof i.then=="function"?(gi=i,Xi):i}}var gi=null;function ad(){if(gi===null)throw Error(a(459));var e=gi;return gi=null,e}function ld(e){if(e===Xi||e===gl)throw Error(a(483))}var Ii=null,Jr=0;function bl(e){var t=Jr;return Jr+=1,Ii===null&&(Ii=[]),rd(Ii,e,t)}function Qr(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function xl(e,t){throw t.$$typeof===j?Error(a(525)):(e=Object.prototype.toString.call(t),Error(a(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function cd(e){function t(M,N){if(e){var q=M.deletions;q===null?(M.deletions=[N],M.flags|=16):q.push(N)}}function i(M,N){if(!e)return null;for(;N!==null;)t(M,N),N=N.sibling;return null}function l(M){for(var N=new Map;M!==null;)M.key!==null?N.set(M.key,M):N.set(M.index,M),M=M.sibling;return N}function o(M,N){return M=Fn(M,N),M.index=0,M.sibling=null,M}function u(M,N,q){return M.index=q,e?(q=M.alternate,q!==null?(q=q.index,q<N?(M.flags|=67108866,N):q):(M.flags|=67108866,N)):(M.flags|=1048576,N)}function m(M){return e&&M.alternate===null&&(M.flags|=67108866),M}function b(M,N,q,G){return N===null||N.tag!==6?(N=xo(q,M.mode,G),N.return=M,N):(N=o(N,q),N.return=M,N)}function O(M,N,q,G){var pe=q.type;return pe===H?Y(M,N,q.props.children,G,q.key):N!==null&&(N.elementType===pe||typeof pe=="object"&&pe!==null&&pe.$$typeof===Z&&pi(pe)===N.type)?(N=o(N,q.props),Qr(N,q),N.return=M,N):(N=fl(q.type,q.key,q.props,null,M.mode,G),Qr(N,q),N.return=M,N)}function U(M,N,q,G){return N===null||N.tag!==4||N.stateNode.containerInfo!==q.containerInfo||N.stateNode.implementation!==q.implementation?(N=vo(q,M.mode,G),N.return=M,N):(N=o(N,q.children||[]),N.return=M,N)}function Y(M,N,q,G,pe){return N===null||N.tag!==7?(N=ui(q,M.mode,G,pe),N.return=M,N):(N=o(N,q),N.return=M,N)}function J(M,N,q){if(typeof N=="string"&&N!==""||typeof N=="number"||typeof N=="bigint")return N=xo(""+N,M.mode,q),N.return=M,N;if(typeof N=="object"&&N!==null){switch(N.$$typeof){case z:return q=fl(N.type,N.key,N.props,null,M.mode,q),Qr(q,N),q.return=M,q;case R:return N=vo(N,M.mode,q),N.return=M,N;case Z:return N=pi(N),J(M,N,q)}if(Le(N)||re(N))return N=ui(N,M.mode,q,null),N.return=M,N;if(typeof N.then=="function")return J(M,bl(N),q);if(N.$$typeof===me)return J(M,ml(M,N),q);xl(M,N)}return null}function B(M,N,q,G){var pe=N!==null?N.key:null;if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return pe!==null?null:b(M,N,""+q,G);if(typeof q=="object"&&q!==null){switch(q.$$typeof){case z:return q.key===pe?O(M,N,q,G):null;case R:return q.key===pe?U(M,N,q,G):null;case Z:return q=pi(q),B(M,N,q,G)}if(Le(q)||re(q))return pe!==null?null:Y(M,N,q,G,null);if(typeof q.then=="function")return B(M,N,bl(q),G);if(q.$$typeof===me)return B(M,N,ml(M,q),G);xl(M,q)}return null}function P(M,N,q,G,pe){if(typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint")return M=M.get(q)||null,b(N,M,""+G,pe);if(typeof G=="object"&&G!==null){switch(G.$$typeof){case z:return M=M.get(G.key===null?q:G.key)||null,O(N,M,G,pe);case R:return M=M.get(G.key===null?q:G.key)||null,U(N,M,G,pe);case Z:return G=pi(G),P(M,N,q,G,pe)}if(Le(G)||re(G))return M=M.get(q)||null,Y(N,M,G,pe,null);if(typeof G.then=="function")return P(M,N,q,bl(G),pe);if(G.$$typeof===me)return P(M,N,q,ml(N,G),pe);xl(N,G)}return null}function fe(M,N,q,G){for(var pe=null,Ue=null,de=N,Se=N=0,ke=null;de!==null&&Se<q.length;Se++){de.index>Se?(ke=de,de=null):ke=de.sibling;var Be=B(M,de,q[Se],G);if(Be===null){de===null&&(de=ke);break}e&&de&&Be.alternate===null&&t(M,de),N=u(Be,N,Se),Ue===null?pe=Be:Ue.sibling=Be,Ue=Be,de=ke}if(Se===q.length)return i(M,de),Me&&Jn(M,Se),pe;if(de===null){for(;Se<q.length;Se++)de=J(M,q[Se],G),de!==null&&(N=u(de,N,Se),Ue===null?pe=de:Ue.sibling=de,Ue=de);return Me&&Jn(M,Se),pe}for(de=l(de);Se<q.length;Se++)ke=P(de,M,Se,q[Se],G),ke!==null&&(e&&ke.alternate!==null&&de.delete(ke.key===null?Se:ke.key),N=u(ke,N,Se),Ue===null?pe=ke:Ue.sibling=ke,Ue=ke);return e&&de.forEach(function(Ps){return t(M,Ps)}),Me&&Jn(M,Se),pe}function ge(M,N,q,G){if(q==null)throw Error(a(151));for(var pe=null,Ue=null,de=N,Se=N=0,ke=null,Be=q.next();de!==null&&!Be.done;Se++,Be=q.next()){de.index>Se?(ke=de,de=null):ke=de.sibling;var Ps=B(M,de,Be.value,G);if(Ps===null){de===null&&(de=ke);break}e&&de&&Ps.alternate===null&&t(M,de),N=u(Ps,N,Se),Ue===null?pe=Ps:Ue.sibling=Ps,Ue=Ps,de=ke}if(Be.done)return i(M,de),Me&&Jn(M,Se),pe;if(de===null){for(;!Be.done;Se++,Be=q.next())Be=J(M,Be.value,G),Be!==null&&(N=u(Be,N,Se),Ue===null?pe=Be:Ue.sibling=Be,Ue=Be);return Me&&Jn(M,Se),pe}for(de=l(de);!Be.done;Se++,Be=q.next())Be=P(de,M,Se,Be.value,G),Be!==null&&(e&&Be.alternate!==null&&de.delete(Be.key===null?Se:Be.key),N=u(Be,N,Se),Ue===null?pe=Be:Ue.sibling=Be,Ue=Be);return e&&de.forEach(function(ux){return t(M,ux)}),Me&&Jn(M,Se),pe}function Je(M,N,q,G){if(typeof q=="object"&&q!==null&&q.type===H&&q.key===null&&(q=q.props.children),typeof q=="object"&&q!==null){switch(q.$$typeof){case z:e:{for(var pe=q.key;N!==null;){if(N.key===pe){if(pe=q.type,pe===H){if(N.tag===7){i(M,N.sibling),G=o(N,q.props.children),G.return=M,M=G;break e}}else if(N.elementType===pe||typeof pe=="object"&&pe!==null&&pe.$$typeof===Z&&pi(pe)===N.type){i(M,N.sibling),G=o(N,q.props),Qr(G,q),G.return=M,M=G;break e}i(M,N);break}else t(M,N);N=N.sibling}q.type===H?(G=ui(q.props.children,M.mode,G,q.key),G.return=M,M=G):(G=fl(q.type,q.key,q.props,null,M.mode,G),Qr(G,q),G.return=M,M=G)}return m(M);case R:e:{for(pe=q.key;N!==null;){if(N.key===pe)if(N.tag===4&&N.stateNode.containerInfo===q.containerInfo&&N.stateNode.implementation===q.implementation){i(M,N.sibling),G=o(N,q.children||[]),G.return=M,M=G;break e}else{i(M,N);break}else t(M,N);N=N.sibling}G=vo(q,M.mode,G),G.return=M,M=G}return m(M);case Z:return q=pi(q),Je(M,N,q,G)}if(Le(q))return fe(M,N,q,G);if(re(q)){if(pe=re(q),typeof pe!="function")throw Error(a(150));return q=pe.call(q),ge(M,N,q,G)}if(typeof q.then=="function")return Je(M,N,bl(q),G);if(q.$$typeof===me)return Je(M,N,ml(M,q),G);xl(M,q)}return typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint"?(q=""+q,N!==null&&N.tag===6?(i(M,N.sibling),G=o(N,q),G.return=M,M=G):(i(M,N),G=xo(q,M.mode,G),G.return=M,M=G),m(M)):i(M,N)}return function(M,N,q,G){try{Jr=0;var pe=Je(M,N,q,G);return Ii=null,pe}catch(de){if(de===Xi||de===gl)throw de;var Ue=Vt(29,de,null,M.mode);return Ue.lanes=G,Ue.return=M,Ue}finally{}}}var yi=cd(!0),od=cd(!1),Es=!1;function Mo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ro(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 As(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Os(e,t,i){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(He&2)!==0){var o=l.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),l.pending=t,t=ul(e),Fh(e,null,i),t}return ol(e,l,t,i),ul(e)}function Xr(e,t,i){if(t=t.updateQueue,t!==null&&(t=t.shared,(i&4194048)!==0)){var l=t.lanes;l&=e.pendingLanes,i|=l,t.lanes=i,si(e,i)}}function Do(e,t){var i=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,i===l)){var o=null,u=null;if(i=i.firstBaseUpdate,i!==null){do{var m={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};u===null?o=u=m:u=u.next=m,i=i.next}while(i!==null);u===null?o=u=t:u=u.next=t}else o=u=t;i={baseState:l.baseState,firstBaseUpdate:o,lastBaseUpdate:u,shared:l.shared,callbacks:l.callbacks},e.updateQueue=i;return}e=i.lastBaseUpdate,e===null?i.firstBaseUpdate=t:e.next=t,i.lastBaseUpdate=t}var zo=!1;function Ir(){if(zo){var e=Qi;if(e!==null)throw e}}function Kr(e,t,i,l){zo=!1;var o=e.updateQueue;Es=!1;var u=o.firstBaseUpdate,m=o.lastBaseUpdate,b=o.shared.pending;if(b!==null){o.shared.pending=null;var O=b,U=O.next;O.next=null,m===null?u=U:m.next=U,m=O;var Y=e.alternate;Y!==null&&(Y=Y.updateQueue,b=Y.lastBaseUpdate,b!==m&&(b===null?Y.firstBaseUpdate=U:b.next=U,Y.lastBaseUpdate=O))}if(u!==null){var J=o.baseState;m=0,Y=U=O=null,b=u;do{var B=b.lane&-536870913,P=B!==b.lane;if(P?(Ce&B)===B:(l&B)===B){B!==0&&B===Ji&&(zo=!0),Y!==null&&(Y=Y.next={lane:0,tag:b.tag,payload:b.payload,callback:null,next:null});e:{var fe=e,ge=b;B=t;var Je=i;switch(ge.tag){case 1:if(fe=ge.payload,typeof fe=="function"){J=fe.call(Je,J,B);break e}J=fe;break e;case 3:fe.flags=fe.flags&-65537|128;case 0:if(fe=ge.payload,B=typeof fe=="function"?fe.call(Je,J,B):fe,B==null)break e;J=S({},J,B);break e;case 2:Es=!0}}B=b.callback,B!==null&&(e.flags|=64,P&&(e.flags|=8192),P=o.callbacks,P===null?o.callbacks=[B]:P.push(B))}else P={lane:B,tag:b.tag,payload:b.payload,callback:b.callback,next:null},Y===null?(U=Y=P,O=J):Y=Y.next=P,m|=B;if(b=b.next,b===null){if(b=o.shared.pending,b===null)break;P=b,b=P.next,P.next=null,o.lastBaseUpdate=P,o.shared.pending=null}}while(!0);Y===null&&(O=J),o.baseState=O,o.firstBaseUpdate=U,o.lastBaseUpdate=Y,u===null&&(o.shared.lanes=0),ks|=m,e.lanes=m,e.memoizedState=J}}function ud(e,t){if(typeof e!="function")throw Error(a(191,e));e.call(t)}function fd(e,t){var i=e.callbacks;if(i!==null)for(e.callbacks=null,e=0;e<i.length;e++)ud(i[e],t)}var Ki=Ae(null),vl=Ae(0);function hd(e,t){e=is,Oe(vl,e),Oe(Ki,t),is=e|t.baseLanes}function qo(){Oe(vl,is),Oe(Ki,Ki.current)}function Uo(){is=vl.current,ve(Ki),ve(vl)}var Ft=Ae(null),dn=null;function js(e){var t=e.alternate;Oe(ot,ot.current&1),Oe(Ft,e),dn===null&&(t===null||Ki.current!==null||t.memoizedState!==null)&&(dn=e)}function Bo(e){Oe(ot,ot.current),Oe(Ft,e),dn===null&&(dn=e)}function dd(e){e.tag===22?(Oe(ot,ot.current),Oe(Ft,e),dn===null&&(dn=e)):Ts()}function Ts(){Oe(ot,ot.current),Oe(Ft,Ft.current)}function Jt(e){ve(Ft),dn===e&&(dn=null),ve(ot)}var ot=Ae(0);function _l(e){for(var t=e;t!==null;){if(t.tag===13){var i=t.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||Gu(i)||Vu(i)))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 In=0,we=null,Ve=null,dt=null,wl=!1,Zi=!1,bi=!1,Sl=0,Zr=0,Wi=null,eb=0;function rt(){throw Error(a(321))}function Lo(e,t){if(t===null)return!1;for(var i=0;i<t.length&&i<e.length;i++)if(!Gt(e[i],t[i]))return!1;return!0}function Ho(e,t,i,l,o,u){return In=u,we=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,$.H=e===null||e.memoizedState===null?Id:tu,bi=!1,u=i(l,o),bi=!1,Zi&&(u=pd(t,i,l,o)),md(e),u}function md(e){$.H=ta;var t=Ve!==null&&Ve.next!==null;if(In=0,dt=Ve=we=null,wl=!1,Zr=0,Wi=null,t)throw Error(a(300));e===null||mt||(e=e.dependencies,e!==null&&dl(e)&&(mt=!0))}function pd(e,t,i,l){we=e;var o=0;do{if(Zi&&(Wi=null),Zr=0,Zi=!1,25<=o)throw Error(a(301));if(o+=1,dt=Ve=null,e.updateQueue!=null){var u=e.updateQueue;u.lastEffect=null,u.events=null,u.stores=null,u.memoCache!=null&&(u.memoCache.index=0)}$.H=Kd,u=t(i,l)}while(Zi);return u}function tb(){var e=$.H,t=e.useState()[0];return t=typeof t.then=="function"?Wr(t):t,e=e.useState()[0],(Ve!==null?Ve.memoizedState:null)!==e&&(we.flags|=1024),t}function Po(){var e=Sl!==0;return Sl=0,e}function $o(e,t,i){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i}function Yo(e){if(wl){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}wl=!1}In=0,dt=Ve=we=null,Zi=!1,Zr=Sl=0,Wi=null}function kt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return dt===null?we.memoizedState=dt=e:dt=dt.next=e,dt}function ut(){if(Ve===null){var e=we.alternate;e=e!==null?e.memoizedState:null}else e=Ve.next;var t=dt===null?we.memoizedState:dt.next;if(t!==null)dt=t,Ve=e;else{if(e===null)throw we.alternate===null?Error(a(467)):Error(a(310));Ve=e,e={memoizedState:Ve.memoizedState,baseState:Ve.baseState,baseQueue:Ve.baseQueue,queue:Ve.queue,next:null},dt===null?we.memoizedState=dt=e:dt=dt.next=e}return dt}function El(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Wr(e){var t=Zr;return Zr+=1,Wi===null&&(Wi=[]),e=rd(Wi,e,t),t=we,(dt===null?t.memoizedState:dt.next)===null&&(t=t.alternate,$.H=t===null||t.memoizedState===null?Id:tu),e}function Al(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Wr(e);if(e.$$typeof===me)return St(e)}throw Error(a(438,String(e)))}function Go(e){var t=null,i=we.updateQueue;if(i!==null&&(t=i.memoCache),t==null){var l=we.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(t={data:l.data.map(function(o){return o.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),i===null&&(i=El(),we.updateQueue=i),i.memoCache=t,i=t.data[t.index],i===void 0)for(i=t.data[t.index]=Array(e),l=0;l<e;l++)i[l]=K;return t.index++,i}function Kn(e,t){return typeof t=="function"?t(e):t}function Ol(e){var t=ut();return Vo(t,Ve,e)}function Vo(e,t,i){var l=e.queue;if(l===null)throw Error(a(311));l.lastRenderedReducer=i;var o=e.baseQueue,u=l.pending;if(u!==null){if(o!==null){var m=o.next;o.next=u.next,u.next=m}t.baseQueue=o=u,l.pending=null}if(u=e.baseState,o===null)e.memoizedState=u;else{t=o.next;var b=m=null,O=null,U=t,Y=!1;do{var J=U.lane&-536870913;if(J!==U.lane?(Ce&J)===J:(In&J)===J){var B=U.revertLane;if(B===0)O!==null&&(O=O.next={lane:0,revertLane:0,gesture:null,action:U.action,hasEagerState:U.hasEagerState,eagerState:U.eagerState,next:null}),J===Ji&&(Y=!0);else if((In&B)===B){U=U.next,B===Ji&&(Y=!0);continue}else J={lane:0,revertLane:U.revertLane,gesture:null,action:U.action,hasEagerState:U.hasEagerState,eagerState:U.eagerState,next:null},O===null?(b=O=J,m=u):O=O.next=J,we.lanes|=B,ks|=B;J=U.action,bi&&i(u,J),u=U.hasEagerState?U.eagerState:i(u,J)}else B={lane:J,revertLane:U.revertLane,gesture:U.gesture,action:U.action,hasEagerState:U.hasEagerState,eagerState:U.eagerState,next:null},O===null?(b=O=B,m=u):O=O.next=B,we.lanes|=J,ks|=J;U=U.next}while(U!==null&&U!==t);if(O===null?m=u:O.next=b,!Gt(u,e.memoizedState)&&(mt=!0,Y&&(i=Qi,i!==null)))throw i;e.memoizedState=u,e.baseState=m,e.baseQueue=O,l.lastRenderedState=u}return o===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function Fo(e){var t=ut(),i=t.queue;if(i===null)throw Error(a(311));i.lastRenderedReducer=e;var l=i.dispatch,o=i.pending,u=t.memoizedState;if(o!==null){i.pending=null;var m=o=o.next;do u=e(u,m.action),m=m.next;while(m!==o);Gt(u,t.memoizedState)||(mt=!0),t.memoizedState=u,t.baseQueue===null&&(t.baseState=u),i.lastRenderedState=u}return[u,l]}function gd(e,t,i){var l=we,o=ut(),u=Me;if(u){if(i===void 0)throw Error(a(407));i=i()}else i=t();var m=!Gt((Ve||o).memoizedState,i);if(m&&(o.memoizedState=i,mt=!0),o=o.queue,Xo(xd.bind(null,l,o,e),[e]),o.getSnapshot!==t||m||dt!==null&&dt.memoizedState.tag&1){if(l.flags|=2048,er(9,{destroy:void 0},bd.bind(null,l,o,i,t),null),Xe===null)throw Error(a(349));u||(In&127)!==0||yd(l,t,i)}return i}function yd(e,t,i){e.flags|=16384,e={getSnapshot:t,value:i},t=we.updateQueue,t===null?(t=El(),we.updateQueue=t,t.stores=[e]):(i=t.stores,i===null?t.stores=[e]:i.push(e))}function bd(e,t,i,l){t.value=i,t.getSnapshot=l,vd(t)&&_d(e)}function xd(e,t,i){return i(function(){vd(t)&&_d(e)})}function vd(e){var t=e.getSnapshot;e=e.value;try{var i=t();return!Gt(e,i)}catch{return!0}}function _d(e){var t=oi(e,2);t!==null&&Ht(t,e,2)}function Jo(e){var t=kt();if(typeof e=="function"){var i=e;if(e=i(),bi){$t(!0);try{i()}finally{$t(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Kn,lastRenderedState:e},t}function wd(e,t,i,l){return e.baseState=i,Vo(e,Ve,typeof l=="function"?l:Kn)}function nb(e,t,i,l,o){if(Nl(e))throw Error(a(485));if(e=t.action,e!==null){var u={payload:o,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(m){u.listeners.push(m)}};$.T!==null?i(!0):u.isTransition=!1,l(u),i=t.pending,i===null?(u.next=t.pending=u,Sd(t,u)):(u.next=i.next,t.pending=i.next=u)}}function Sd(e,t){var i=t.action,l=t.payload,o=e.state;if(t.isTransition){var u=$.T,m={};$.T=m;try{var b=i(o,l),O=$.S;O!==null&&O(m,b),Ed(e,t,b)}catch(U){Qo(e,t,U)}finally{u!==null&&m.types!==null&&(u.types=m.types),$.T=u}}else try{u=i(o,l),Ed(e,t,u)}catch(U){Qo(e,t,U)}}function Ed(e,t,i){i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(function(l){Ad(e,t,l)},function(l){return Qo(e,t,l)}):Ad(e,t,i)}function Ad(e,t,i){t.status="fulfilled",t.value=i,Od(t),e.state=i,t=e.pending,t!==null&&(i=t.next,i===t?e.pending=null:(i=i.next,t.next=i,Sd(e,i)))}function Qo(e,t,i){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do t.status="rejected",t.reason=i,Od(t),t=t.next;while(t!==l)}e.action=null}function Od(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function jd(e,t){return t}function Td(e,t){if(Me){var i=Xe.formState;if(i!==null){e:{var l=we;if(Me){if(Ze){t:{for(var o=Ze,u=hn;o.nodeType!==8;){if(!u){o=null;break t}if(o=mn(o.nextSibling),o===null){o=null;break t}}u=o.data,o=u==="F!"||u==="F"?o:null}if(o){Ze=mn(o.nextSibling),l=o.data==="F!";break e}}ws(l)}l=!1}l&&(t=i[0])}}return i=kt(),i.memoizedState=i.baseState=t,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:jd,lastRenderedState:t},i.queue=l,i=Jd.bind(null,we,l),l.dispatch=i,l=Jo(!1),u=eu.bind(null,we,!1,l.queue),l=kt(),o={state:t,dispatch:null,action:e,pending:null},l.queue=o,i=nb.bind(null,we,o,u,i),o.dispatch=i,l.memoizedState=e,[t,i,!1]}function Nd(e){var t=ut();return Cd(t,Ve,e)}function Cd(e,t,i){if(t=Vo(e,t,jd)[0],e=Ol(Kn)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var l=Wr(t)}catch(m){throw m===Xi?gl:m}else l=t;t=ut();var o=t.queue,u=o.dispatch;return i!==t.memoizedState&&(we.flags|=2048,er(9,{destroy:void 0},sb.bind(null,o,i),null)),[l,u,e]}function sb(e,t){e.action=t}function kd(e){var t=ut(),i=Ve;if(i!==null)return Cd(t,i,e);ut(),t=t.memoizedState,i=ut();var l=i.queue.dispatch;return i.memoizedState=e,[t,l,!1]}function er(e,t,i,l){return e={tag:e,create:i,deps:l,inst:t,next:null},t=we.updateQueue,t===null&&(t=El(),we.updateQueue=t),i=t.lastEffect,i===null?t.lastEffect=e.next=e:(l=i.next,i.next=e,e.next=l,t.lastEffect=e),e}function Md(){return ut().memoizedState}function jl(e,t,i,l){var o=kt();we.flags|=e,o.memoizedState=er(1|t,{destroy:void 0},i,l===void 0?null:l)}function Tl(e,t,i,l){var o=ut();l=l===void 0?null:l;var u=o.memoizedState.inst;Ve!==null&&l!==null&&Lo(l,Ve.memoizedState.deps)?o.memoizedState=er(t,u,i,l):(we.flags|=e,o.memoizedState=er(1|t,u,i,l))}function Rd(e,t){jl(8390656,8,e,t)}function Xo(e,t){Tl(2048,8,e,t)}function ib(e){we.flags|=4;var t=we.updateQueue;if(t===null)t=El(),we.updateQueue=t,t.events=[e];else{var i=t.events;i===null?t.events=[e]:i.push(e)}}function Dd(e){var t=ut().memoizedState;return ib({ref:t,nextImpl:e}),function(){if((He&2)!==0)throw Error(a(440));return t.impl.apply(void 0,arguments)}}function zd(e,t){return Tl(4,2,e,t)}function qd(e,t){return Tl(4,4,e,t)}function Ud(e,t){if(typeof t=="function"){e=e();var i=t(e);return function(){typeof i=="function"?i():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Bd(e,t,i){i=i!=null?i.concat([e]):null,Tl(4,4,Ud.bind(null,t,e),i)}function Io(){}function Ld(e,t){var i=ut();t=t===void 0?null:t;var l=i.memoizedState;return t!==null&&Lo(t,l[1])?l[0]:(i.memoizedState=[e,t],e)}function Hd(e,t){var i=ut();t=t===void 0?null:t;var l=i.memoizedState;if(t!==null&&Lo(t,l[1]))return l[0];if(l=e(),bi){$t(!0);try{e()}finally{$t(!1)}}return i.memoizedState=[l,t],l}function Ko(e,t,i){return i===void 0||(In&1073741824)!==0&&(Ce&261930)===0?e.memoizedState=t:(e.memoizedState=i,e=Pm(),we.lanes|=e,ks|=e,i)}function Pd(e,t,i,l){return Gt(i,t)?i:Ki.current!==null?(e=Ko(e,i,l),Gt(e,t)||(mt=!0),e):(In&42)===0||(In&1073741824)!==0&&(Ce&261930)===0?(mt=!0,e.memoizedState=i):(e=Pm(),we.lanes|=e,ks|=e,t)}function $d(e,t,i,l,o){var u=te.p;te.p=u!==0&&8>u?u:8;var m=$.T,b={};$.T=b,eu(e,!1,t,i);try{var O=o(),U=$.S;if(U!==null&&U(b,O),O!==null&&typeof O=="object"&&typeof O.then=="function"){var Y=Wy(O,l);ea(e,t,Y,It(e))}else ea(e,t,l,It(e))}catch(J){ea(e,t,{then:function(){},status:"rejected",reason:J},It())}finally{te.p=u,m!==null&&b.types!==null&&(m.types=b.types),$.T=m}}function rb(){}function Zo(e,t,i,l){if(e.tag!==5)throw Error(a(476));var o=Yd(e).queue;$d(e,o,t,he,i===null?rb:function(){return Gd(e),i(l)})}function Yd(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:he,baseState:he,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Kn,lastRenderedState:he},next:null};var i={};return t.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Kn,lastRenderedState:i},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Gd(e){var t=Yd(e);t.next===null&&(t=e.alternate.memoizedState),ea(e,t.next.queue,{},It())}function Wo(){return St(ya)}function Vd(){return ut().memoizedState}function Fd(){return ut().memoizedState}function ab(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var i=It();e=As(i);var l=Os(t,e,i);l!==null&&(Ht(l,t,i),Xr(l,t,i)),t={cache:To()},e.payload=t;return}t=t.return}}function lb(e,t,i){var l=It();i={lane:l,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},Nl(e)?Qd(t,i):(i=yo(e,t,i,l),i!==null&&(Ht(i,e,l),Xd(i,t,l)))}function Jd(e,t,i){var l=It();ea(e,t,i,l)}function ea(e,t,i,l){var o={lane:l,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(Nl(e))Qd(t,o);else{var u=e.alternate;if(e.lanes===0&&(u===null||u.lanes===0)&&(u=t.lastRenderedReducer,u!==null))try{var m=t.lastRenderedState,b=u(m,i);if(o.hasEagerState=!0,o.eagerState=b,Gt(b,m))return ol(e,t,o,0),Xe===null&&cl(),!1}catch{}finally{}if(i=yo(e,t,o,l),i!==null)return Ht(i,e,l),Xd(i,t,l),!0}return!1}function eu(e,t,i,l){if(l={lane:2,revertLane:Mu(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Nl(e)){if(t)throw Error(a(479))}else t=yo(e,i,l,2),t!==null&&Ht(t,e,2)}function Nl(e){var t=e.alternate;return e===we||t!==null&&t===we}function Qd(e,t){Zi=wl=!0;var i=e.pending;i===null?t.next=t:(t.next=i.next,i.next=t),e.pending=t}function Xd(e,t,i){if((i&4194048)!==0){var l=t.lanes;l&=e.pendingLanes,i|=l,t.lanes=i,si(e,i)}}var ta={readContext:St,use:Al,useCallback:rt,useContext:rt,useEffect:rt,useImperativeHandle:rt,useLayoutEffect:rt,useInsertionEffect:rt,useMemo:rt,useReducer:rt,useRef:rt,useState:rt,useDebugValue:rt,useDeferredValue:rt,useTransition:rt,useSyncExternalStore:rt,useId:rt,useHostTransitionStatus:rt,useFormState:rt,useActionState:rt,useOptimistic:rt,useMemoCache:rt,useCacheRefresh:rt};ta.useEffectEvent=rt;var Id={readContext:St,use:Al,useCallback:function(e,t){return kt().memoizedState=[e,t===void 0?null:t],e},useContext:St,useEffect:Rd,useImperativeHandle:function(e,t,i){i=i!=null?i.concat([e]):null,jl(4194308,4,Ud.bind(null,t,e),i)},useLayoutEffect:function(e,t){return jl(4194308,4,e,t)},useInsertionEffect:function(e,t){jl(4,2,e,t)},useMemo:function(e,t){var i=kt();t=t===void 0?null:t;var l=e();if(bi){$t(!0);try{e()}finally{$t(!1)}}return i.memoizedState=[l,t],l},useReducer:function(e,t,i){var l=kt();if(i!==void 0){var o=i(t);if(bi){$t(!0);try{i(t)}finally{$t(!1)}}}else o=t;return l.memoizedState=l.baseState=o,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:o},l.queue=e,e=e.dispatch=lb.bind(null,we,e),[l.memoizedState,e]},useRef:function(e){var t=kt();return e={current:e},t.memoizedState=e},useState:function(e){e=Jo(e);var t=e.queue,i=Jd.bind(null,we,t);return t.dispatch=i,[e.memoizedState,i]},useDebugValue:Io,useDeferredValue:function(e,t){var i=kt();return Ko(i,e,t)},useTransition:function(){var e=Jo(!1);return e=$d.bind(null,we,e.queue,!0,!1),kt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,i){var l=we,o=kt();if(Me){if(i===void 0)throw Error(a(407));i=i()}else{if(i=t(),Xe===null)throw Error(a(349));(Ce&127)!==0||yd(l,t,i)}o.memoizedState=i;var u={value:i,getSnapshot:t};return o.queue=u,Rd(xd.bind(null,l,u,e),[e]),l.flags|=2048,er(9,{destroy:void 0},bd.bind(null,l,u,i,t),null),i},useId:function(){var e=kt(),t=Xe.identifierPrefix;if(Me){var i=Mn,l=kn;i=(l&~(1<<32-Nt(l)-1)).toString(32)+i,t="_"+t+"R_"+i,i=Sl++,0<i&&(t+="H"+i.toString(32)),t+="_"}else i=eb++,t="_"+t+"r_"+i.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Wo,useFormState:Td,useActionState:Td,useOptimistic:function(e){var t=kt();t.memoizedState=t.baseState=e;var i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=i,t=eu.bind(null,we,!0,i),i.dispatch=t,[e,t]},useMemoCache:Go,useCacheRefresh:function(){return kt().memoizedState=ab.bind(null,we)},useEffectEvent:function(e){var t=kt(),i={impl:e};return t.memoizedState=i,function(){if((He&2)!==0)throw Error(a(440));return i.impl.apply(void 0,arguments)}}},tu={readContext:St,use:Al,useCallback:Ld,useContext:St,useEffect:Xo,useImperativeHandle:Bd,useInsertionEffect:zd,useLayoutEffect:qd,useMemo:Hd,useReducer:Ol,useRef:Md,useState:function(){return Ol(Kn)},useDebugValue:Io,useDeferredValue:function(e,t){var i=ut();return Pd(i,Ve.memoizedState,e,t)},useTransition:function(){var e=Ol(Kn)[0],t=ut().memoizedState;return[typeof e=="boolean"?e:Wr(e),t]},useSyncExternalStore:gd,useId:Vd,useHostTransitionStatus:Wo,useFormState:Nd,useActionState:Nd,useOptimistic:function(e,t){var i=ut();return wd(i,Ve,e,t)},useMemoCache:Go,useCacheRefresh:Fd};tu.useEffectEvent=Dd;var Kd={readContext:St,use:Al,useCallback:Ld,useContext:St,useEffect:Xo,useImperativeHandle:Bd,useInsertionEffect:zd,useLayoutEffect:qd,useMemo:Hd,useReducer:Fo,useRef:Md,useState:function(){return Fo(Kn)},useDebugValue:Io,useDeferredValue:function(e,t){var i=ut();return Ve===null?Ko(i,e,t):Pd(i,Ve.memoizedState,e,t)},useTransition:function(){var e=Fo(Kn)[0],t=ut().memoizedState;return[typeof e=="boolean"?e:Wr(e),t]},useSyncExternalStore:gd,useId:Vd,useHostTransitionStatus:Wo,useFormState:kd,useActionState:kd,useOptimistic:function(e,t){var i=ut();return Ve!==null?wd(i,Ve,e,t):(i.baseState=e,[e,i.queue.dispatch])},useMemoCache:Go,useCacheRefresh:Fd};Kd.useEffectEvent=Dd;function nu(e,t,i,l){t=e.memoizedState,i=i(l,t),i=i==null?t:S({},t,i),e.memoizedState=i,e.lanes===0&&(e.updateQueue.baseState=i)}var su={enqueueSetState:function(e,t,i){e=e._reactInternals;var l=It(),o=As(l);o.payload=t,i!=null&&(o.callback=i),t=Os(e,o,l),t!==null&&(Ht(t,e,l),Xr(t,e,l))},enqueueReplaceState:function(e,t,i){e=e._reactInternals;var l=It(),o=As(l);o.tag=1,o.payload=t,i!=null&&(o.callback=i),t=Os(e,o,l),t!==null&&(Ht(t,e,l),Xr(t,e,l))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var i=It(),l=As(i);l.tag=2,t!=null&&(l.callback=t),t=Os(e,l,i),t!==null&&(Ht(t,e,i),Xr(t,e,i))}};function Zd(e,t,i,l,o,u,m){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,u,m):t.prototype&&t.prototype.isPureReactComponent?!Pr(i,l)||!Pr(o,u):!0}function Wd(e,t,i,l){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(i,l),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(i,l),t.state!==e&&su.enqueueReplaceState(t,t.state,null)}function xi(e,t){var i=t;if("ref"in t){i={};for(var l in t)l!=="ref"&&(i[l]=t[l])}if(e=e.defaultProps){i===t&&(i=S({},i));for(var o in e)i[o]===void 0&&(i[o]=e[o])}return i}function em(e){ll(e)}function tm(e){console.error(e)}function nm(e){ll(e)}function Cl(e,t){try{var i=e.onUncaughtError;i(t.value,{componentStack:t.stack})}catch(l){setTimeout(function(){throw l})}}function sm(e,t,i){try{var l=e.onCaughtError;l(i.value,{componentStack:i.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(o){setTimeout(function(){throw o})}}function iu(e,t,i){return i=As(i),i.tag=3,i.payload={element:null},i.callback=function(){Cl(e,t)},i}function im(e){return e=As(e),e.tag=3,e}function rm(e,t,i,l){var o=i.type.getDerivedStateFromError;if(typeof o=="function"){var u=l.value;e.payload=function(){return o(u)},e.callback=function(){sm(t,i,l)}}var m=i.stateNode;m!==null&&typeof m.componentDidCatch=="function"&&(e.callback=function(){sm(t,i,l),typeof o!="function"&&(Ms===null?Ms=new Set([this]):Ms.add(this));var b=l.stack;this.componentDidCatch(l.value,{componentStack:b!==null?b:""})})}function cb(e,t,i,l,o){if(i.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(t=i.alternate,t!==null&&Fi(t,i,o,!0),i=Ft.current,i!==null){switch(i.tag){case 31:case 13:return dn===null?$l():i.alternate===null&&at===0&&(at=3),i.flags&=-257,i.flags|=65536,i.lanes=o,l===yl?i.flags|=16384:(t=i.updateQueue,t===null?i.updateQueue=new Set([l]):t.add(l),Nu(e,l,o)),!1;case 22:return i.flags|=65536,l===yl?i.flags|=16384:(t=i.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([l])},i.updateQueue=t):(i=t.retryQueue,i===null?t.retryQueue=new Set([l]):i.add(l)),Nu(e,l,o)),!1}throw Error(a(435,i.tag))}return Nu(e,l,o),$l(),!1}if(Me)return t=Ft.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=o,l!==So&&(e=Error(a(422),{cause:l}),Gr(on(e,i)))):(l!==So&&(t=Error(a(423),{cause:l}),Gr(on(t,i))),e=e.current.alternate,e.flags|=65536,o&=-o,e.lanes|=o,l=on(l,i),o=iu(e.stateNode,l,o),Do(e,o),at!==4&&(at=2)),!1;var u=Error(a(520),{cause:l});if(u=on(u,i),oa===null?oa=[u]:oa.push(u),at!==4&&(at=2),t===null)return!0;l=on(l,i),i=t;do{switch(i.tag){case 3:return i.flags|=65536,e=o&-o,i.lanes|=e,e=iu(i.stateNode,l,e),Do(i,e),!1;case 1:if(t=i.type,u=i.stateNode,(i.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||u!==null&&typeof u.componentDidCatch=="function"&&(Ms===null||!Ms.has(u))))return i.flags|=65536,o&=-o,i.lanes|=o,o=im(o),rm(o,e,i,l),Do(i,o),!1}i=i.return}while(i!==null);return!1}var ru=Error(a(461)),mt=!1;function Et(e,t,i,l){t.child=e===null?od(t,null,i,l):yi(t,e.child,i,l)}function am(e,t,i,l,o){i=i.render;var u=t.ref;if("ref"in l){var m={};for(var b in l)b!=="ref"&&(m[b]=l[b])}else m=l;return di(t),l=Ho(e,t,i,m,u,o),b=Po(),e!==null&&!mt?($o(e,t,o),Zn(e,t,o)):(Me&&b&&_o(t),t.flags|=1,Et(e,t,l,o),t.child)}function lm(e,t,i,l,o){if(e===null){var u=i.type;return typeof u=="function"&&!bo(u)&&u.defaultProps===void 0&&i.compare===null?(t.tag=15,t.type=u,cm(e,t,u,l,o)):(e=fl(i.type,null,l,t,t.mode,o),e.ref=t.ref,e.return=t,t.child=e)}if(u=e.child,!du(e,o)){var m=u.memoizedProps;if(i=i.compare,i=i!==null?i:Pr,i(m,l)&&e.ref===t.ref)return Zn(e,t,o)}return t.flags|=1,e=Fn(u,l),e.ref=t.ref,e.return=t,t.child=e}function cm(e,t,i,l,o){if(e!==null){var u=e.memoizedProps;if(Pr(u,l)&&e.ref===t.ref)if(mt=!1,t.pendingProps=l=u,du(e,o))(e.flags&131072)!==0&&(mt=!0);else return t.lanes=e.lanes,Zn(e,t,o)}return au(e,t,i,l,o)}function om(e,t,i,l){var o=l.children,u=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((t.flags&128)!==0){if(u=u!==null?u.baseLanes|i:i,e!==null){for(l=t.child=e.child,o=0;l!==null;)o=o|l.lanes|l.childLanes,l=l.sibling;l=o&~u}else l=0,t.child=null;return um(e,t,u,i,l)}if((i&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&pl(t,u!==null?u.cachePool:null),u!==null?hd(t,u):qo(),dd(t);else return l=t.lanes=536870912,um(e,t,u!==null?u.baseLanes|i:i,i,l)}else u!==null?(pl(t,u.cachePool),hd(t,u),Ts(),t.memoizedState=null):(e!==null&&pl(t,null),qo(),Ts());return Et(e,t,o,i),t.child}function na(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function um(e,t,i,l,o){var u=Co();return u=u===null?null:{parent:ht._currentValue,pool:u},t.memoizedState={baseLanes:i,cachePool:u},e!==null&&pl(t,null),qo(),dd(t),e!==null&&Fi(e,t,l,!0),t.childLanes=o,null}function kl(e,t){return t=Rl({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function fm(e,t,i){return yi(t,e.child,null,i),e=kl(t,t.pendingProps),e.flags|=2,Jt(t),t.memoizedState=null,e}function ob(e,t,i){var l=t.pendingProps,o=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Me){if(l.mode==="hidden")return e=kl(t,l),t.lanes=536870912,na(null,e);if(Bo(t),(e=Ze)?(e=Sp(e,hn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:vs!==null?{id:kn,overflow:Mn}:null,retryLane:536870912,hydrationErrors:null},i=Qh(e),i.return=t,t.child=i,wt=t,Ze=null)):e=null,e===null)throw ws(t);return t.lanes=536870912,null}return kl(t,l)}var u=e.memoizedState;if(u!==null){var m=u.dehydrated;if(Bo(t),o)if(t.flags&256)t.flags&=-257,t=fm(e,t,i);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(a(558));else if(mt||Fi(e,t,i,!1),o=(i&e.childLanes)!==0,mt||o){if(l=Xe,l!==null&&(m=bs(l,i),m!==0&&m!==u.retryLane))throw u.retryLane=m,oi(e,m),Ht(l,e,m),ru;$l(),t=fm(e,t,i)}else e=u.treeContext,Ze=mn(m.nextSibling),wt=t,Me=!0,_s=null,hn=!1,e!==null&&Kh(t,e),t=kl(t,l),t.flags|=4096;return t}return e=Fn(e.child,{mode:l.mode,children:l.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Ml(e,t){var i=t.ref;if(i===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof i!="function"&&typeof i!="object")throw Error(a(284));(e===null||e.ref!==i)&&(t.flags|=4194816)}}function au(e,t,i,l,o){return di(t),i=Ho(e,t,i,l,void 0,o),l=Po(),e!==null&&!mt?($o(e,t,o),Zn(e,t,o)):(Me&&l&&_o(t),t.flags|=1,Et(e,t,i,o),t.child)}function hm(e,t,i,l,o,u){return di(t),t.updateQueue=null,i=pd(t,l,i,o),md(e),l=Po(),e!==null&&!mt?($o(e,t,u),Zn(e,t,u)):(Me&&l&&_o(t),t.flags|=1,Et(e,t,i,u),t.child)}function dm(e,t,i,l,o){if(di(t),t.stateNode===null){var u=$i,m=i.contextType;typeof m=="object"&&m!==null&&(u=St(m)),u=new i(l,u),t.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,u.updater=su,t.stateNode=u,u._reactInternals=t,u=t.stateNode,u.props=l,u.state=t.memoizedState,u.refs={},Mo(t),m=i.contextType,u.context=typeof m=="object"&&m!==null?St(m):$i,u.state=t.memoizedState,m=i.getDerivedStateFromProps,typeof m=="function"&&(nu(t,i,m,l),u.state=t.memoizedState),typeof i.getDerivedStateFromProps=="function"||typeof u.getSnapshotBeforeUpdate=="function"||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(m=u.state,typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount(),m!==u.state&&su.enqueueReplaceState(u,u.state,null),Kr(t,l,u,o),Ir(),u.state=t.memoizedState),typeof u.componentDidMount=="function"&&(t.flags|=4194308),l=!0}else if(e===null){u=t.stateNode;var b=t.memoizedProps,O=xi(i,b);u.props=O;var U=u.context,Y=i.contextType;m=$i,typeof Y=="object"&&Y!==null&&(m=St(Y));var J=i.getDerivedStateFromProps;Y=typeof J=="function"||typeof u.getSnapshotBeforeUpdate=="function",b=t.pendingProps!==b,Y||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(b||U!==m)&&Wd(t,u,l,m),Es=!1;var B=t.memoizedState;u.state=B,Kr(t,l,u,o),Ir(),U=t.memoizedState,b||B!==U||Es?(typeof J=="function"&&(nu(t,i,J,l),U=t.memoizedState),(O=Es||Zd(t,i,O,l,B,U,m))?(Y||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount()),typeof u.componentDidMount=="function"&&(t.flags|=4194308)):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=l,t.memoizedState=U),u.props=l,u.state=U,u.context=m,l=O):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),l=!1)}else{u=t.stateNode,Ro(e,t),m=t.memoizedProps,Y=xi(i,m),u.props=Y,J=t.pendingProps,B=u.context,U=i.contextType,O=$i,typeof U=="object"&&U!==null&&(O=St(U)),b=i.getDerivedStateFromProps,(U=typeof b=="function"||typeof u.getSnapshotBeforeUpdate=="function")||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(m!==J||B!==O)&&Wd(t,u,l,O),Es=!1,B=t.memoizedState,u.state=B,Kr(t,l,u,o),Ir();var P=t.memoizedState;m!==J||B!==P||Es||e!==null&&e.dependencies!==null&&dl(e.dependencies)?(typeof b=="function"&&(nu(t,i,b,l),P=t.memoizedState),(Y=Es||Zd(t,i,Y,l,B,P,O)||e!==null&&e.dependencies!==null&&dl(e.dependencies))?(U||typeof u.UNSAFE_componentWillUpdate!="function"&&typeof u.componentWillUpdate!="function"||(typeof u.componentWillUpdate=="function"&&u.componentWillUpdate(l,P,O),typeof u.UNSAFE_componentWillUpdate=="function"&&u.UNSAFE_componentWillUpdate(l,P,O)),typeof u.componentDidUpdate=="function"&&(t.flags|=4),typeof u.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof u.componentDidUpdate!="function"||m===e.memoizedProps&&B===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||m===e.memoizedProps&&B===e.memoizedState||(t.flags|=1024),t.memoizedProps=l,t.memoizedState=P),u.props=l,u.state=P,u.context=O,l=Y):(typeof u.componentDidUpdate!="function"||m===e.memoizedProps&&B===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||m===e.memoizedProps&&B===e.memoizedState||(t.flags|=1024),l=!1)}return u=l,Ml(e,t),l=(t.flags&128)!==0,u||l?(u=t.stateNode,i=l&&typeof i.getDerivedStateFromError!="function"?null:u.render(),t.flags|=1,e!==null&&l?(t.child=yi(t,e.child,null,o),t.child=yi(t,null,i,o)):Et(e,t,i,o),t.memoizedState=u.state,e=t.child):e=Zn(e,t,o),e}function mm(e,t,i,l){return fi(),t.flags|=256,Et(e,t,i,l),t.child}var lu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function cu(e){return{baseLanes:e,cachePool:sd()}}function ou(e,t,i){return e=e!==null?e.childLanes&~i:0,t&&(e|=Xt),e}function pm(e,t,i){var l=t.pendingProps,o=!1,u=(t.flags&128)!==0,m;if((m=u)||(m=e!==null&&e.memoizedState===null?!1:(ot.current&2)!==0),m&&(o=!0,t.flags&=-129),m=(t.flags&32)!==0,t.flags&=-33,e===null){if(Me){if(o?js(t):Ts(),(e=Ze)?(e=Sp(e,hn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:vs!==null?{id:kn,overflow:Mn}:null,retryLane:536870912,hydrationErrors:null},i=Qh(e),i.return=t,t.child=i,wt=t,Ze=null)):e=null,e===null)throw ws(t);return Vu(e)?t.lanes=32:t.lanes=536870912,null}var b=l.children;return l=l.fallback,o?(Ts(),o=t.mode,b=Rl({mode:"hidden",children:b},o),l=ui(l,o,i,null),b.return=t,l.return=t,b.sibling=l,t.child=b,l=t.child,l.memoizedState=cu(i),l.childLanes=ou(e,m,i),t.memoizedState=lu,na(null,l)):(js(t),uu(t,b))}var O=e.memoizedState;if(O!==null&&(b=O.dehydrated,b!==null)){if(u)t.flags&256?(js(t),t.flags&=-257,t=fu(e,t,i)):t.memoizedState!==null?(Ts(),t.child=e.child,t.flags|=128,t=null):(Ts(),b=l.fallback,o=t.mode,l=Rl({mode:"visible",children:l.children},o),b=ui(b,o,i,null),b.flags|=2,l.return=t,b.return=t,l.sibling=b,t.child=l,yi(t,e.child,null,i),l=t.child,l.memoizedState=cu(i),l.childLanes=ou(e,m,i),t.memoizedState=lu,t=na(null,l));else if(js(t),Vu(b)){if(m=b.nextSibling&&b.nextSibling.dataset,m)var U=m.dgst;m=U,l=Error(a(419)),l.stack="",l.digest=m,Gr({value:l,source:null,stack:null}),t=fu(e,t,i)}else if(mt||Fi(e,t,i,!1),m=(i&e.childLanes)!==0,mt||m){if(m=Xe,m!==null&&(l=bs(m,i),l!==0&&l!==O.retryLane))throw O.retryLane=l,oi(e,l),Ht(m,e,l),ru;Gu(b)||$l(),t=fu(e,t,i)}else Gu(b)?(t.flags|=192,t.child=e.child,t=null):(e=O.treeContext,Ze=mn(b.nextSibling),wt=t,Me=!0,_s=null,hn=!1,e!==null&&Kh(t,e),t=uu(t,l.children),t.flags|=4096);return t}return o?(Ts(),b=l.fallback,o=t.mode,O=e.child,U=O.sibling,l=Fn(O,{mode:"hidden",children:l.children}),l.subtreeFlags=O.subtreeFlags&65011712,U!==null?b=Fn(U,b):(b=ui(b,o,i,null),b.flags|=2),b.return=t,l.return=t,l.sibling=b,t.child=l,na(null,l),l=t.child,b=e.child.memoizedState,b===null?b=cu(i):(o=b.cachePool,o!==null?(O=ht._currentValue,o=o.parent!==O?{parent:O,pool:O}:o):o=sd(),b={baseLanes:b.baseLanes|i,cachePool:o}),l.memoizedState=b,l.childLanes=ou(e,m,i),t.memoizedState=lu,na(e.child,l)):(js(t),i=e.child,e=i.sibling,i=Fn(i,{mode:"visible",children:l.children}),i.return=t,i.sibling=null,e!==null&&(m=t.deletions,m===null?(t.deletions=[e],t.flags|=16):m.push(e)),t.child=i,t.memoizedState=null,i)}function uu(e,t){return t=Rl({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Rl(e,t){return e=Vt(22,e,null,t),e.lanes=0,e}function fu(e,t,i){return yi(t,e.child,null,i),e=uu(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function gm(e,t,i){e.lanes|=t;var l=e.alternate;l!==null&&(l.lanes|=t),Oo(e.return,t,i)}function hu(e,t,i,l,o,u){var m=e.memoizedState;m===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:l,tail:i,tailMode:o,treeForkCount:u}:(m.isBackwards=t,m.rendering=null,m.renderingStartTime=0,m.last=l,m.tail=i,m.tailMode=o,m.treeForkCount=u)}function ym(e,t,i){var l=t.pendingProps,o=l.revealOrder,u=l.tail;l=l.children;var m=ot.current,b=(m&2)!==0;if(b?(m=m&1|2,t.flags|=128):m&=1,Oe(ot,m),Et(e,t,l,i),l=Me?Yr:0,!b&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&gm(e,i,t);else if(e.tag===19)gm(e,i,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(o){case"forwards":for(i=t.child,o=null;i!==null;)e=i.alternate,e!==null&&_l(e)===null&&(o=i),i=i.sibling;i=o,i===null?(o=t.child,t.child=null):(o=i.sibling,i.sibling=null),hu(t,!1,o,i,u,l);break;case"backwards":case"unstable_legacy-backwards":for(i=null,o=t.child,t.child=null;o!==null;){if(e=o.alternate,e!==null&&_l(e)===null){t.child=o;break}e=o.sibling,o.sibling=i,i=o,o=e}hu(t,!0,i,null,u,l);break;case"together":hu(t,!1,null,null,void 0,l);break;default:t.memoizedState=null}return t.child}function Zn(e,t,i){if(e!==null&&(t.dependencies=e.dependencies),ks|=t.lanes,(i&t.childLanes)===0)if(e!==null){if(Fi(e,t,i,!1),(i&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(a(153));if(t.child!==null){for(e=t.child,i=Fn(e,e.pendingProps),t.child=i,i.return=t;e.sibling!==null;)e=e.sibling,i=i.sibling=Fn(e,e.pendingProps),i.return=t;i.sibling=null}return t.child}function du(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&dl(e)))}function ub(e,t,i){switch(t.tag){case 3:jt(t,t.stateNode.containerInfo),Ss(t,ht,e.memoizedState.cache),fi();break;case 27:case 5:Tt(t);break;case 4:jt(t,t.stateNode.containerInfo);break;case 10:Ss(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Bo(t),null;break;case 13:var l=t.memoizedState;if(l!==null)return l.dehydrated!==null?(js(t),t.flags|=128,null):(i&t.child.childLanes)!==0?pm(e,t,i):(js(t),e=Zn(e,t,i),e!==null?e.sibling:null);js(t);break;case 19:var o=(e.flags&128)!==0;if(l=(i&t.childLanes)!==0,l||(Fi(e,t,i,!1),l=(i&t.childLanes)!==0),o){if(l)return ym(e,t,i);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),Oe(ot,ot.current),l)break;return null;case 22:return t.lanes=0,om(e,t,i,t.pendingProps);case 24:Ss(t,ht,e.memoizedState.cache)}return Zn(e,t,i)}function bm(e,t,i){if(e!==null)if(e.memoizedProps!==t.pendingProps)mt=!0;else{if(!du(e,i)&&(t.flags&128)===0)return mt=!1,ub(e,t,i);mt=(e.flags&131072)!==0}else mt=!1,Me&&(t.flags&1048576)!==0&&Ih(t,Yr,t.index);switch(t.lanes=0,t.tag){case 16:e:{var l=t.pendingProps;if(e=pi(t.elementType),t.type=e,typeof e=="function")bo(e)?(l=xi(e,l),t.tag=1,t=dm(null,t,e,l,i)):(t.tag=0,t=au(null,t,e,l,i));else{if(e!=null){var o=e.$$typeof;if(o===be){t.tag=11,t=am(null,t,e,l,i);break e}else if(o===ie){t.tag=14,t=lm(null,t,e,l,i);break e}}throw t=Ge(e)||e,Error(a(306,t,""))}}return t;case 0:return au(e,t,t.type,t.pendingProps,i);case 1:return l=t.type,o=xi(l,t.pendingProps),dm(e,t,l,o,i);case 3:e:{if(jt(t,t.stateNode.containerInfo),e===null)throw Error(a(387));l=t.pendingProps;var u=t.memoizedState;o=u.element,Ro(e,t),Kr(t,l,null,i);var m=t.memoizedState;if(l=m.cache,Ss(t,ht,l),l!==u.cache&&jo(t,[ht],i,!0),Ir(),l=m.element,u.isDehydrated)if(u={element:l,isDehydrated:!1,cache:m.cache},t.updateQueue.baseState=u,t.memoizedState=u,t.flags&256){t=mm(e,t,l,i);break e}else if(l!==o){o=on(Error(a(424)),t),Gr(o),t=mm(e,t,l,i);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(Ze=mn(e.firstChild),wt=t,Me=!0,_s=null,hn=!0,i=od(t,null,l,i),t.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling}else{if(fi(),l===o){t=Zn(e,t,i);break e}Et(e,t,l,i)}t=t.child}return t;case 26:return Ml(e,t),e===null?(i=Np(t.type,null,t.pendingProps,null))?t.memoizedState=i:Me||(i=t.type,e=t.pendingProps,l=Xl(sn.current).createElement(i),l[Qe]=t,l[it]=e,At(l,i,e),T(l),t.stateNode=l):t.memoizedState=Np(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Tt(t),e===null&&Me&&(l=t.stateNode=Op(t.type,t.pendingProps,sn.current),wt=t,hn=!0,o=Ze,qs(t.type)?(Fu=o,Ze=mn(l.firstChild)):Ze=o),Et(e,t,t.pendingProps.children,i),Ml(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Me&&((o=l=Ze)&&(l=Hb(l,t.type,t.pendingProps,hn),l!==null?(t.stateNode=l,wt=t,Ze=mn(l.firstChild),hn=!1,o=!0):o=!1),o||ws(t)),Tt(t),o=t.type,u=t.pendingProps,m=e!==null?e.memoizedProps:null,l=u.children,Pu(o,u)?l=null:m!==null&&Pu(o,m)&&(t.flags|=32),t.memoizedState!==null&&(o=Ho(e,t,tb,null,null,i),ya._currentValue=o),Ml(e,t),Et(e,t,l,i),t.child;case 6:return e===null&&Me&&((e=i=Ze)&&(i=Pb(i,t.pendingProps,hn),i!==null?(t.stateNode=i,wt=t,Ze=null,e=!0):e=!1),e||ws(t)),null;case 13:return pm(e,t,i);case 4:return jt(t,t.stateNode.containerInfo),l=t.pendingProps,e===null?t.child=yi(t,null,l,i):Et(e,t,l,i),t.child;case 11:return am(e,t,t.type,t.pendingProps,i);case 7:return Et(e,t,t.pendingProps,i),t.child;case 8:return Et(e,t,t.pendingProps.children,i),t.child;case 12:return Et(e,t,t.pendingProps.children,i),t.child;case 10:return l=t.pendingProps,Ss(t,t.type,l.value),Et(e,t,l.children,i),t.child;case 9:return o=t.type._context,l=t.pendingProps.children,di(t),o=St(o),l=l(o),t.flags|=1,Et(e,t,l,i),t.child;case 14:return lm(e,t,t.type,t.pendingProps,i);case 15:return cm(e,t,t.type,t.pendingProps,i);case 19:return ym(e,t,i);case 31:return ob(e,t,i);case 22:return om(e,t,i,t.pendingProps);case 24:return di(t),l=St(ht),e===null?(o=Co(),o===null&&(o=Xe,u=To(),o.pooledCache=u,u.refCount++,u!==null&&(o.pooledCacheLanes|=i),o=u),t.memoizedState={parent:l,cache:o},Mo(t),Ss(t,ht,o)):((e.lanes&i)!==0&&(Ro(e,t),Kr(t,null,null,i),Ir()),o=e.memoizedState,u=t.memoizedState,o.parent!==l?(o={parent:l,cache:l},t.memoizedState=o,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=o),Ss(t,ht,l)):(l=u.cache,Ss(t,ht,l),l!==o.cache&&jo(t,[ht],i,!0))),Et(e,t,t.pendingProps.children,i),t.child;case 29:throw t.pendingProps}throw Error(a(156,t.tag))}function Wn(e){e.flags|=4}function mu(e,t,i,l,o){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(o&335544128)===o)if(e.stateNode.complete)e.flags|=8192;else if(Vm())e.flags|=8192;else throw gi=yl,ko}else e.flags&=-16777217}function xm(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Dp(t))if(Vm())e.flags|=8192;else throw gi=yl,ko}function Dl(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Mi():536870912,e.lanes|=t,ir|=t)}function sa(e,t){if(!Me)switch(e.tailMode){case"hidden":t=e.tail;for(var i=null;t!==null;)t.alternate!==null&&(i=t),t=t.sibling;i===null?e.tail=null:i.sibling=null;break;case"collapsed":i=e.tail;for(var l=null;i!==null;)i.alternate!==null&&(l=i),i=i.sibling;l===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null}}function We(e){var t=e.alternate!==null&&e.alternate.child===e.child,i=0,l=0;if(t)for(var o=e.child;o!==null;)i|=o.lanes|o.childLanes,l|=o.subtreeFlags&65011712,l|=o.flags&65011712,o.return=e,o=o.sibling;else for(o=e.child;o!==null;)i|=o.lanes|o.childLanes,l|=o.subtreeFlags,l|=o.flags,o.return=e,o=o.sibling;return e.subtreeFlags|=l,e.childLanes=i,t}function fb(e,t,i){var l=t.pendingProps;switch(wo(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return We(t),null;case 1:return We(t),null;case 3:return i=t.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),Xn(ht),_e(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(Vi(t)?Wn(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Eo())),We(t),null;case 26:var o=t.type,u=t.memoizedState;return e===null?(Wn(t),u!==null?(We(t),xm(t,u)):(We(t),mu(t,o,null,l,i))):u?u!==e.memoizedState?(Wn(t),We(t),xm(t,u)):(We(t),t.flags&=-16777217):(e=e.memoizedProps,e!==l&&Wn(t),We(t),mu(t,o,e,l,i)),null;case 27:if(Zs(t),i=sn.current,o=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&Wn(t);else{if(!l){if(t.stateNode===null)throw Error(a(166));return We(t),null}e=lt.current,Vi(t)?Zh(t):(e=Op(o,l,i),t.stateNode=e,Wn(t))}return We(t),null;case 5:if(Zs(t),o=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&Wn(t);else{if(!l){if(t.stateNode===null)throw Error(a(166));return We(t),null}if(u=lt.current,Vi(t))Zh(t);else{var m=Xl(sn.current);switch(u){case 1:u=m.createElementNS("http://www.w3.org/2000/svg",o);break;case 2:u=m.createElementNS("http://www.w3.org/1998/Math/MathML",o);break;default:switch(o){case"svg":u=m.createElementNS("http://www.w3.org/2000/svg",o);break;case"math":u=m.createElementNS("http://www.w3.org/1998/Math/MathML",o);break;case"script":u=m.createElement("div"),u.innerHTML="<script><\/script>",u=u.removeChild(u.firstChild);break;case"select":u=typeof l.is=="string"?m.createElement("select",{is:l.is}):m.createElement("select"),l.multiple?u.multiple=!0:l.size&&(u.size=l.size);break;default:u=typeof l.is=="string"?m.createElement(o,{is:l.is}):m.createElement(o)}}u[Qe]=t,u[it]=l;e:for(m=t.child;m!==null;){if(m.tag===5||m.tag===6)u.appendChild(m.stateNode);else if(m.tag!==4&&m.tag!==27&&m.child!==null){m.child.return=m,m=m.child;continue}if(m===t)break e;for(;m.sibling===null;){if(m.return===null||m.return===t)break e;m=m.return}m.sibling.return=m.return,m=m.sibling}t.stateNode=u;e:switch(At(u,o,l),o){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&Wn(t)}}return We(t),mu(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,i),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==l&&Wn(t);else{if(typeof l!="string"&&t.stateNode===null)throw Error(a(166));if(e=sn.current,Vi(t)){if(e=t.stateNode,i=t.memoizedProps,l=null,o=wt,o!==null)switch(o.tag){case 27:case 5:l=o.memoizedProps}e[Qe]=t,e=!!(e.nodeValue===i||l!==null&&l.suppressHydrationWarning===!0||pp(e.nodeValue,i)),e||ws(t,!0)}else e=Xl(e).createTextNode(l),e[Qe]=t,t.stateNode=e}return We(t),null;case 31:if(i=t.memoizedState,e===null||e.memoizedState!==null){if(l=Vi(t),i!==null){if(e===null){if(!l)throw Error(a(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(557));e[Qe]=t}else fi(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;We(t),e=!1}else i=Eo(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),e=!0;if(!e)return t.flags&256?(Jt(t),t):(Jt(t),null);if((t.flags&128)!==0)throw Error(a(558))}return We(t),null;case 13:if(l=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(o=Vi(t),l!==null&&l.dehydrated!==null){if(e===null){if(!o)throw Error(a(318));if(o=t.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(a(317));o[Qe]=t}else fi(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;We(t),o=!1}else o=Eo(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=o),o=!0;if(!o)return t.flags&256?(Jt(t),t):(Jt(t),null)}return Jt(t),(t.flags&128)!==0?(t.lanes=i,t):(i=l!==null,e=e!==null&&e.memoizedState!==null,i&&(l=t.child,o=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(o=l.alternate.memoizedState.cachePool.pool),u=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(u=l.memoizedState.cachePool.pool),u!==o&&(l.flags|=2048)),i!==e&&i&&(t.child.flags|=8192),Dl(t,t.updateQueue),We(t),null);case 4:return _e(),e===null&&qu(t.stateNode.containerInfo),We(t),null;case 10:return Xn(t.type),We(t),null;case 19:if(ve(ot),l=t.memoizedState,l===null)return We(t),null;if(o=(t.flags&128)!==0,u=l.rendering,u===null)if(o)sa(l,!1);else{if(at!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(u=_l(e),u!==null){for(t.flags|=128,sa(l,!1),e=u.updateQueue,t.updateQueue=e,Dl(t,e),t.subtreeFlags=0,e=i,i=t.child;i!==null;)Jh(i,e),i=i.sibling;return Oe(ot,ot.current&1|2),Me&&Jn(t,l.treeForkCount),t.child}e=e.sibling}l.tail!==null&&et()>Ll&&(t.flags|=128,o=!0,sa(l,!1),t.lanes=4194304)}else{if(!o)if(e=_l(u),e!==null){if(t.flags|=128,o=!0,e=e.updateQueue,t.updateQueue=e,Dl(t,e),sa(l,!0),l.tail===null&&l.tailMode==="hidden"&&!u.alternate&&!Me)return We(t),null}else 2*et()-l.renderingStartTime>Ll&&i!==536870912&&(t.flags|=128,o=!0,sa(l,!1),t.lanes=4194304);l.isBackwards?(u.sibling=t.child,t.child=u):(e=l.last,e!==null?e.sibling=u:t.child=u,l.last=u)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=et(),e.sibling=null,i=ot.current,Oe(ot,o?i&1|2:i&1),Me&&Jn(t,l.treeForkCount),e):(We(t),null);case 22:case 23:return Jt(t),Uo(),l=t.memoizedState!==null,e!==null?e.memoizedState!==null!==l&&(t.flags|=8192):l&&(t.flags|=8192),l?(i&536870912)!==0&&(t.flags&128)===0&&(We(t),t.subtreeFlags&6&&(t.flags|=8192)):We(t),i=t.updateQueue,i!==null&&Dl(t,i.retryQueue),i=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),l=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),l!==i&&(t.flags|=2048),e!==null&&ve(mi),null;case 24:return i=null,e!==null&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),Xn(ht),We(t),null;case 25:return null;case 30:return null}throw Error(a(156,t.tag))}function hb(e,t){switch(wo(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Xn(ht),_e(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Zs(t),null;case 31:if(t.memoizedState!==null){if(Jt(t),t.alternate===null)throw Error(a(340));fi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Jt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(a(340));fi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ve(ot),null;case 4:return _e(),null;case 10:return Xn(t.type),null;case 22:case 23:return Jt(t),Uo(),e!==null&&ve(mi),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Xn(ht),null;case 25:return null;default:return null}}function vm(e,t){switch(wo(t),t.tag){case 3:Xn(ht),_e();break;case 26:case 27:case 5:Zs(t);break;case 4:_e();break;case 31:t.memoizedState!==null&&Jt(t);break;case 13:Jt(t);break;case 19:ve(ot);break;case 10:Xn(t.type);break;case 22:case 23:Jt(t),Uo(),e!==null&&ve(mi);break;case 24:Xn(ht)}}function ia(e,t){try{var i=t.updateQueue,l=i!==null?i.lastEffect:null;if(l!==null){var o=l.next;i=o;do{if((i.tag&e)===e){l=void 0;var u=i.create,m=i.inst;l=u(),m.destroy=l}i=i.next}while(i!==o)}}catch(b){$e(t,t.return,b)}}function Ns(e,t,i){try{var l=t.updateQueue,o=l!==null?l.lastEffect:null;if(o!==null){var u=o.next;l=u;do{if((l.tag&e)===e){var m=l.inst,b=m.destroy;if(b!==void 0){m.destroy=void 0,o=t;var O=i,U=b;try{U()}catch(Y){$e(o,O,Y)}}}l=l.next}while(l!==u)}}catch(Y){$e(t,t.return,Y)}}function _m(e){var t=e.updateQueue;if(t!==null){var i=e.stateNode;try{fd(t,i)}catch(l){$e(e,e.return,l)}}}function wm(e,t,i){i.props=xi(e.type,e.memoizedProps),i.state=e.memoizedState;try{i.componentWillUnmount()}catch(l){$e(e,t,l)}}function ra(e,t){try{var i=e.ref;if(i!==null){switch(e.tag){case 26:case 27:case 5:var l=e.stateNode;break;case 30:l=e.stateNode;break;default:l=e.stateNode}typeof i=="function"?e.refCleanup=i(l):i.current=l}}catch(o){$e(e,t,o)}}function Rn(e,t){var i=e.ref,l=e.refCleanup;if(i!==null)if(typeof l=="function")try{l()}catch(o){$e(e,t,o)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(o){$e(e,t,o)}else i.current=null}function Sm(e){var t=e.type,i=e.memoizedProps,l=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":i.autoFocus&&l.focus();break e;case"img":i.src?l.src=i.src:i.srcSet&&(l.srcset=i.srcSet)}}catch(o){$e(e,e.return,o)}}function pu(e,t,i){try{var l=e.stateNode;Db(l,e.type,i,t),l[it]=t}catch(o){$e(e,e.return,o)}}function Em(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&qs(e.type)||e.tag===4}function gu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Em(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&&qs(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 yu(e,t,i){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i).insertBefore(e,t):(t=i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,t.appendChild(e),i=i._reactRootContainer,i!=null||t.onclick!==null||(t.onclick=Gn));else if(l!==4&&(l===27&&qs(e.type)&&(i=e.stateNode,t=null),e=e.child,e!==null))for(yu(e,t,i),e=e.sibling;e!==null;)yu(e,t,i),e=e.sibling}function zl(e,t,i){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?i.insertBefore(e,t):i.appendChild(e);else if(l!==4&&(l===27&&qs(e.type)&&(i=e.stateNode),e=e.child,e!==null))for(zl(e,t,i),e=e.sibling;e!==null;)zl(e,t,i),e=e.sibling}function Am(e){var t=e.stateNode,i=e.memoizedProps;try{for(var l=e.type,o=t.attributes;o.length;)t.removeAttributeNode(o[0]);At(t,l,i),t[Qe]=e,t[it]=i}catch(u){$e(e,e.return,u)}}var es=!1,pt=!1,bu=!1,Om=typeof WeakSet=="function"?WeakSet:Set,xt=null;function db(e,t){if(e=e.containerInfo,Lu=nc,e=Bh(e),uo(e)){if("selectionStart"in e)var i={start:e.selectionStart,end:e.selectionEnd};else e:{i=(i=e.ownerDocument)&&i.defaultView||window;var l=i.getSelection&&i.getSelection();if(l&&l.rangeCount!==0){i=l.anchorNode;var o=l.anchorOffset,u=l.focusNode;l=l.focusOffset;try{i.nodeType,u.nodeType}catch{i=null;break e}var m=0,b=-1,O=-1,U=0,Y=0,J=e,B=null;t:for(;;){for(var P;J!==i||o!==0&&J.nodeType!==3||(b=m+o),J!==u||l!==0&&J.nodeType!==3||(O=m+l),J.nodeType===3&&(m+=J.nodeValue.length),(P=J.firstChild)!==null;)B=J,J=P;for(;;){if(J===e)break t;if(B===i&&++U===o&&(b=m),B===u&&++Y===l&&(O=m),(P=J.nextSibling)!==null)break;J=B,B=J.parentNode}J=P}i=b===-1||O===-1?null:{start:b,end:O}}else i=null}i=i||{start:0,end:0}}else i=null;for(Hu={focusedElem:e,selectionRange:i},nc=!1,xt=t;xt!==null;)if(t=xt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,xt=e;else for(;xt!==null;){switch(t=xt,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(i=0;i<e.length;i++)o=e[i],o.ref.impl=o.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&u!==null){e=void 0,i=t,o=u.memoizedProps,u=u.memoizedState,l=i.stateNode;try{var fe=xi(i.type,o);e=l.getSnapshotBeforeUpdate(fe,u),l.__reactInternalSnapshotBeforeUpdate=e}catch(ge){$e(i,i.return,ge)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,i=e.nodeType,i===9)Yu(e);else if(i===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Yu(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(a(163))}if(e=t.sibling,e!==null){e.return=t.return,xt=e;break}xt=t.return}}function jm(e,t,i){var l=i.flags;switch(i.tag){case 0:case 11:case 15:ns(e,i),l&4&&ia(5,i);break;case 1:if(ns(e,i),l&4)if(e=i.stateNode,t===null)try{e.componentDidMount()}catch(m){$e(i,i.return,m)}else{var o=xi(i.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(o,t,e.__reactInternalSnapshotBeforeUpdate)}catch(m){$e(i,i.return,m)}}l&64&&_m(i),l&512&&ra(i,i.return);break;case 3:if(ns(e,i),l&64&&(e=i.updateQueue,e!==null)){if(t=null,i.child!==null)switch(i.child.tag){case 27:case 5:t=i.child.stateNode;break;case 1:t=i.child.stateNode}try{fd(e,t)}catch(m){$e(i,i.return,m)}}break;case 27:t===null&&l&4&&Am(i);case 26:case 5:ns(e,i),t===null&&l&4&&Sm(i),l&512&&ra(i,i.return);break;case 12:ns(e,i);break;case 31:ns(e,i),l&4&&Cm(e,i);break;case 13:ns(e,i),l&4&&km(e,i),l&64&&(e=i.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(i=wb.bind(null,i),$b(e,i))));break;case 22:if(l=i.memoizedState!==null||es,!l){t=t!==null&&t.memoizedState!==null||pt,o=es;var u=pt;es=l,(pt=t)&&!u?ss(e,i,(i.subtreeFlags&8772)!==0):ns(e,i),es=o,pt=u}break;case 30:break;default:ns(e,i)}}function Tm(e){var t=e.alternate;t!==null&&(e.alternate=null,Tm(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Ri(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 tt=null,qt=!1;function ts(e,t,i){for(i=i.child;i!==null;)Nm(e,t,i),i=i.sibling}function Nm(e,t,i){if(ct&&typeof ct.onCommitFiberUnmount=="function")try{ct.onCommitFiberUnmount(ei,i)}catch{}switch(i.tag){case 26:pt||Rn(i,t),ts(e,t,i),i.memoizedState?i.memoizedState.count--:i.stateNode&&(i=i.stateNode,i.parentNode.removeChild(i));break;case 27:pt||Rn(i,t);var l=tt,o=qt;qs(i.type)&&(tt=i.stateNode,qt=!1),ts(e,t,i),ma(i.stateNode),tt=l,qt=o;break;case 5:pt||Rn(i,t);case 6:if(l=tt,o=qt,tt=null,ts(e,t,i),tt=l,qt=o,tt!==null)if(qt)try{(tt.nodeType===9?tt.body:tt.nodeName==="HTML"?tt.ownerDocument.body:tt).removeChild(i.stateNode)}catch(u){$e(i,t,u)}else try{tt.removeChild(i.stateNode)}catch(u){$e(i,t,u)}break;case 18:tt!==null&&(qt?(e=tt,_p(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,i.stateNode),hr(e)):_p(tt,i.stateNode));break;case 4:l=tt,o=qt,tt=i.stateNode.containerInfo,qt=!0,ts(e,t,i),tt=l,qt=o;break;case 0:case 11:case 14:case 15:Ns(2,i,t),pt||Ns(4,i,t),ts(e,t,i);break;case 1:pt||(Rn(i,t),l=i.stateNode,typeof l.componentWillUnmount=="function"&&wm(i,t,l)),ts(e,t,i);break;case 21:ts(e,t,i);break;case 22:pt=(l=pt)||i.memoizedState!==null,ts(e,t,i),pt=l;break;default:ts(e,t,i)}}function Cm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{hr(e)}catch(i){$e(t,t.return,i)}}}function km(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{hr(e)}catch(i){$e(t,t.return,i)}}function mb(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Om),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Om),t;default:throw Error(a(435,e.tag))}}function ql(e,t){var i=mb(e);t.forEach(function(l){if(!i.has(l)){i.add(l);var o=Sb.bind(null,e,l);l.then(o,o)}})}function Ut(e,t){var i=t.deletions;if(i!==null)for(var l=0;l<i.length;l++){var o=i[l],u=e,m=t,b=m;e:for(;b!==null;){switch(b.tag){case 27:if(qs(b.type)){tt=b.stateNode,qt=!1;break e}break;case 5:tt=b.stateNode,qt=!1;break e;case 3:case 4:tt=b.stateNode.containerInfo,qt=!0;break e}b=b.return}if(tt===null)throw Error(a(160));Nm(u,m,o),tt=null,qt=!1,u=o.alternate,u!==null&&(u.return=null),o.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Mm(t,e),t=t.sibling}var Sn=null;function Mm(e,t){var i=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Ut(t,e),Bt(e),l&4&&(Ns(3,e,e.return),ia(3,e),Ns(5,e,e.return));break;case 1:Ut(t,e),Bt(e),l&512&&(pt||i===null||Rn(i,i.return)),l&64&&es&&(e=e.updateQueue,e!==null&&(l=e.callbacks,l!==null&&(i=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=i===null?l:i.concat(l))));break;case 26:var o=Sn;if(Ut(t,e),Bt(e),l&512&&(pt||i===null||Rn(i,i.return)),l&4){var u=i!==null?i.memoizedState:null;if(l=e.memoizedState,i===null)if(l===null)if(e.stateNode===null){e:{l=e.type,i=e.memoizedProps,o=o.ownerDocument||o;t:switch(l){case"title":u=o.getElementsByTagName("title")[0],(!u||u[yt]||u[Qe]||u.namespaceURI==="http://www.w3.org/2000/svg"||u.hasAttribute("itemprop"))&&(u=o.createElement(l),o.head.insertBefore(u,o.querySelector("head > title"))),At(u,l,i),u[Qe]=e,T(u),l=u;break e;case"link":var m=Mp("link","href",o).get(l+(i.href||""));if(m){for(var b=0;b<m.length;b++)if(u=m[b],u.getAttribute("href")===(i.href==null||i.href===""?null:i.href)&&u.getAttribute("rel")===(i.rel==null?null:i.rel)&&u.getAttribute("title")===(i.title==null?null:i.title)&&u.getAttribute("crossorigin")===(i.crossOrigin==null?null:i.crossOrigin)){m.splice(b,1);break t}}u=o.createElement(l),At(u,l,i),o.head.appendChild(u);break;case"meta":if(m=Mp("meta","content",o).get(l+(i.content||""))){for(b=0;b<m.length;b++)if(u=m[b],u.getAttribute("content")===(i.content==null?null:""+i.content)&&u.getAttribute("name")===(i.name==null?null:i.name)&&u.getAttribute("property")===(i.property==null?null:i.property)&&u.getAttribute("http-equiv")===(i.httpEquiv==null?null:i.httpEquiv)&&u.getAttribute("charset")===(i.charSet==null?null:i.charSet)){m.splice(b,1);break t}}u=o.createElement(l),At(u,l,i),o.head.appendChild(u);break;default:throw Error(a(468,l))}u[Qe]=e,T(u),l=u}e.stateNode=l}else Rp(o,e.type,e.stateNode);else e.stateNode=kp(o,l,e.memoizedProps);else u!==l?(u===null?i.stateNode!==null&&(i=i.stateNode,i.parentNode.removeChild(i)):u.count--,l===null?Rp(o,e.type,e.stateNode):kp(o,l,e.memoizedProps)):l===null&&e.stateNode!==null&&pu(e,e.memoizedProps,i.memoizedProps)}break;case 27:Ut(t,e),Bt(e),l&512&&(pt||i===null||Rn(i,i.return)),i!==null&&l&4&&pu(e,e.memoizedProps,i.memoizedProps);break;case 5:if(Ut(t,e),Bt(e),l&512&&(pt||i===null||Rn(i,i.return)),e.flags&32){o=e.stateNode;try{zi(o,"")}catch(fe){$e(e,e.return,fe)}}l&4&&e.stateNode!=null&&(o=e.memoizedProps,pu(e,o,i!==null?i.memoizedProps:o)),l&1024&&(bu=!0);break;case 6:if(Ut(t,e),Bt(e),l&4){if(e.stateNode===null)throw Error(a(162));l=e.memoizedProps,i=e.stateNode;try{i.nodeValue=l}catch(fe){$e(e,e.return,fe)}}break;case 3:if(Zl=null,o=Sn,Sn=Il(t.containerInfo),Ut(t,e),Sn=o,Bt(e),l&4&&i!==null&&i.memoizedState.isDehydrated)try{hr(t.containerInfo)}catch(fe){$e(e,e.return,fe)}bu&&(bu=!1,Rm(e));break;case 4:l=Sn,Sn=Il(e.stateNode.containerInfo),Ut(t,e),Bt(e),Sn=l;break;case 12:Ut(t,e),Bt(e);break;case 31:Ut(t,e),Bt(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,ql(e,l)));break;case 13:Ut(t,e),Bt(e),e.child.flags&8192&&e.memoizedState!==null!=(i!==null&&i.memoizedState!==null)&&(Bl=et()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,ql(e,l)));break;case 22:o=e.memoizedState!==null;var O=i!==null&&i.memoizedState!==null,U=es,Y=pt;if(es=U||o,pt=Y||O,Ut(t,e),pt=Y,es=U,Bt(e),l&8192)e:for(t=e.stateNode,t._visibility=o?t._visibility&-2:t._visibility|1,o&&(i===null||O||es||pt||vi(e)),i=null,t=e;;){if(t.tag===5||t.tag===26){if(i===null){O=i=t;try{if(u=O.stateNode,o)m=u.style,typeof m.setProperty=="function"?m.setProperty("display","none","important"):m.display="none";else{b=O.stateNode;var J=O.memoizedProps.style,B=J!=null&&J.hasOwnProperty("display")?J.display:null;b.style.display=B==null||typeof B=="boolean"?"":(""+B).trim()}}catch(fe){$e(O,O.return,fe)}}}else if(t.tag===6){if(i===null){O=t;try{O.stateNode.nodeValue=o?"":O.memoizedProps}catch(fe){$e(O,O.return,fe)}}}else if(t.tag===18){if(i===null){O=t;try{var P=O.stateNode;o?wp(P,!0):wp(O.stateNode,!1)}catch(fe){$e(O,O.return,fe)}}}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;i===t&&(i=null),t=t.return}i===t&&(i=null),t.sibling.return=t.return,t=t.sibling}l&4&&(l=e.updateQueue,l!==null&&(i=l.retryQueue,i!==null&&(l.retryQueue=null,ql(e,i))));break;case 19:Ut(t,e),Bt(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,ql(e,l)));break;case 30:break;case 21:break;default:Ut(t,e),Bt(e)}}function Bt(e){var t=e.flags;if(t&2){try{for(var i,l=e.return;l!==null;){if(Em(l)){i=l;break}l=l.return}if(i==null)throw Error(a(160));switch(i.tag){case 27:var o=i.stateNode,u=gu(e);zl(e,u,o);break;case 5:var m=i.stateNode;i.flags&32&&(zi(m,""),i.flags&=-33);var b=gu(e);zl(e,b,m);break;case 3:case 4:var O=i.stateNode.containerInfo,U=gu(e);yu(e,U,O);break;default:throw Error(a(161))}}catch(Y){$e(e,e.return,Y)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Rm(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Rm(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function ns(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)jm(e,t.alternate,t),t=t.sibling}function vi(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Ns(4,t,t.return),vi(t);break;case 1:Rn(t,t.return);var i=t.stateNode;typeof i.componentWillUnmount=="function"&&wm(t,t.return,i),vi(t);break;case 27:ma(t.stateNode);case 26:case 5:Rn(t,t.return),vi(t);break;case 22:t.memoizedState===null&&vi(t);break;case 30:vi(t);break;default:vi(t)}e=e.sibling}}function ss(e,t,i){for(i=i&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var l=t.alternate,o=e,u=t,m=u.flags;switch(u.tag){case 0:case 11:case 15:ss(o,u,i),ia(4,u);break;case 1:if(ss(o,u,i),l=u,o=l.stateNode,typeof o.componentDidMount=="function")try{o.componentDidMount()}catch(U){$e(l,l.return,U)}if(l=u,o=l.updateQueue,o!==null){var b=l.stateNode;try{var O=o.shared.hiddenCallbacks;if(O!==null)for(o.shared.hiddenCallbacks=null,o=0;o<O.length;o++)ud(O[o],b)}catch(U){$e(l,l.return,U)}}i&&m&64&&_m(u),ra(u,u.return);break;case 27:Am(u);case 26:case 5:ss(o,u,i),i&&l===null&&m&4&&Sm(u),ra(u,u.return);break;case 12:ss(o,u,i);break;case 31:ss(o,u,i),i&&m&4&&Cm(o,u);break;case 13:ss(o,u,i),i&&m&4&&km(o,u);break;case 22:u.memoizedState===null&&ss(o,u,i),ra(u,u.return);break;case 30:break;default:ss(o,u,i)}t=t.sibling}}function xu(e,t){var i=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==i&&(e!=null&&e.refCount++,i!=null&&Vr(i))}function vu(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Vr(e))}function En(e,t,i,l){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Dm(e,t,i,l),t=t.sibling}function Dm(e,t,i,l){var o=t.flags;switch(t.tag){case 0:case 11:case 15:En(e,t,i,l),o&2048&&ia(9,t);break;case 1:En(e,t,i,l);break;case 3:En(e,t,i,l),o&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Vr(e)));break;case 12:if(o&2048){En(e,t,i,l),e=t.stateNode;try{var u=t.memoizedProps,m=u.id,b=u.onPostCommit;typeof b=="function"&&b(m,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(O){$e(t,t.return,O)}}else En(e,t,i,l);break;case 31:En(e,t,i,l);break;case 13:En(e,t,i,l);break;case 23:break;case 22:u=t.stateNode,m=t.alternate,t.memoizedState!==null?u._visibility&2?En(e,t,i,l):aa(e,t):u._visibility&2?En(e,t,i,l):(u._visibility|=2,tr(e,t,i,l,(t.subtreeFlags&10256)!==0||!1)),o&2048&&xu(m,t);break;case 24:En(e,t,i,l),o&2048&&vu(t.alternate,t);break;default:En(e,t,i,l)}}function tr(e,t,i,l,o){for(o=o&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var u=e,m=t,b=i,O=l,U=m.flags;switch(m.tag){case 0:case 11:case 15:tr(u,m,b,O,o),ia(8,m);break;case 23:break;case 22:var Y=m.stateNode;m.memoizedState!==null?Y._visibility&2?tr(u,m,b,O,o):aa(u,m):(Y._visibility|=2,tr(u,m,b,O,o)),o&&U&2048&&xu(m.alternate,m);break;case 24:tr(u,m,b,O,o),o&&U&2048&&vu(m.alternate,m);break;default:tr(u,m,b,O,o)}t=t.sibling}}function aa(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var i=e,l=t,o=l.flags;switch(l.tag){case 22:aa(i,l),o&2048&&xu(l.alternate,l);break;case 24:aa(i,l),o&2048&&vu(l.alternate,l);break;default:aa(i,l)}t=t.sibling}}var la=8192;function nr(e,t,i){if(e.subtreeFlags&la)for(e=e.child;e!==null;)zm(e,t,i),e=e.sibling}function zm(e,t,i){switch(e.tag){case 26:nr(e,t,i),e.flags&la&&e.memoizedState!==null&&ex(i,Sn,e.memoizedState,e.memoizedProps);break;case 5:nr(e,t,i);break;case 3:case 4:var l=Sn;Sn=Il(e.stateNode.containerInfo),nr(e,t,i),Sn=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=la,la=16777216,nr(e,t,i),la=l):nr(e,t,i));break;default:nr(e,t,i)}}function qm(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 ca(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var i=0;i<t.length;i++){var l=t[i];xt=l,Bm(l,e)}qm(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Um(e),e=e.sibling}function Um(e){switch(e.tag){case 0:case 11:case 15:ca(e),e.flags&2048&&Ns(9,e,e.return);break;case 3:ca(e);break;case 12:ca(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Ul(e)):ca(e);break;default:ca(e)}}function Ul(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var i=0;i<t.length;i++){var l=t[i];xt=l,Bm(l,e)}qm(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Ns(8,t,t.return),Ul(t);break;case 22:i=t.stateNode,i._visibility&2&&(i._visibility&=-3,Ul(t));break;default:Ul(t)}e=e.sibling}}function Bm(e,t){for(;xt!==null;){var i=xt;switch(i.tag){case 0:case 11:case 15:Ns(8,i,t);break;case 23:case 22:if(i.memoizedState!==null&&i.memoizedState.cachePool!==null){var l=i.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:Vr(i.memoizedState.cache)}if(l=i.child,l!==null)l.return=i,xt=l;else e:for(i=e;xt!==null;){l=xt;var o=l.sibling,u=l.return;if(Tm(l),l===i){xt=null;break e}if(o!==null){o.return=u,xt=o;break e}xt=u}}}var pb={getCacheForType:function(e){var t=St(ht),i=t.data.get(e);return i===void 0&&(i=e(),t.data.set(e,i)),i},cacheSignal:function(){return St(ht).controller.signal}},gb=typeof WeakMap=="function"?WeakMap:Map,He=0,Xe=null,je=null,Ce=0,Pe=0,Qt=null,Cs=!1,sr=!1,_u=!1,is=0,at=0,ks=0,_i=0,wu=0,Xt=0,ir=0,oa=null,Lt=null,Su=!1,Bl=0,Lm=0,Ll=1/0,Hl=null,Ms=null,bt=0,Rs=null,rr=null,rs=0,Eu=0,Au=null,Hm=null,ua=0,Ou=null;function It(){return(He&2)!==0&&Ce!==0?Ce&-Ce:$.T!==null?Mu():Mr()}function Pm(){if(Xt===0)if((Ce&536870912)===0||Me){var e=Pn;Pn<<=1,(Pn&3932160)===0&&(Pn=262144),Xt=e}else Xt=536870912;return e=Ft.current,e!==null&&(e.flags|=32),Xt}function Ht(e,t,i){(e===Xe&&(Pe===2||Pe===9)||e.cancelPendingCommit!==null)&&(ar(e,0),Ds(e,Ce,Xt,!1)),vn(e,i),((He&2)===0||e!==Xe)&&(e===Xe&&((He&2)===0&&(_i|=i),at===4&&Ds(e,Ce,Xt,!1)),Dn(e))}function $m(e,t,i){if((He&6)!==0)throw Error(a(327));var l=!i&&(t&127)===0&&(t&e.expiredLanes)===0||ni(e,t),o=l?xb(e,t):Tu(e,t,!0),u=l;do{if(o===0){sr&&!l&&Ds(e,t,0,!1);break}else{if(i=e.current.alternate,u&&!yb(i)){o=Tu(e,t,!1),u=!1;continue}if(o===2){if(u=t,e.errorRecoveryDisabledLanes&u)var m=0;else m=e.pendingLanes&-536870913,m=m!==0?m:m&536870912?536870912:0;if(m!==0){t=m;e:{var b=e;o=oa;var O=b.current.memoizedState.isDehydrated;if(O&&(ar(b,m).flags|=256),m=Tu(b,m,!1),m!==2){if(_u&&!O){b.errorRecoveryDisabledLanes|=u,_i|=u,o=4;break e}u=Lt,Lt=o,u!==null&&(Lt===null?Lt=u:Lt.push.apply(Lt,u))}o=m}if(u=!1,o!==2)continue}}if(o===1){ar(e,0),Ds(e,t,0,!0);break}e:{switch(l=e,u=o,u){case 0:case 1:throw Error(a(345));case 4:if((t&4194048)!==t)break;case 6:Ds(l,t,Xt,!Cs);break e;case 2:Lt=null;break;case 3:case 5:break;default:throw Error(a(329))}if((t&62914560)===t&&(o=Bl+300-et(),10<o)){if(Ds(l,t,Xt,!Cs),ti(l,0,!0)!==0)break e;rs=t,l.timeoutHandle=xp(Ym.bind(null,l,i,Lt,Hl,Su,t,Xt,_i,ir,Cs,u,"Throttled",-0,0),o);break e}Ym(l,i,Lt,Hl,Su,t,Xt,_i,ir,Cs,u,null,-0,0)}}break}while(!0);Dn(e)}function Ym(e,t,i,l,o,u,m,b,O,U,Y,J,B,P){if(e.timeoutHandle=-1,J=t.subtreeFlags,J&8192||(J&16785408)===16785408){J={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Gn},zm(t,u,J);var fe=(u&62914560)===u?Bl-et():(u&4194048)===u?Lm-et():0;if(fe=tx(J,fe),fe!==null){rs=u,e.cancelPendingCommit=fe(Km.bind(null,e,t,u,i,l,o,m,b,O,Y,J,null,B,P)),Ds(e,u,m,!U);return}}Km(e,t,u,i,l,o,m,b,O)}function yb(e){for(var t=e;;){var i=t.tag;if((i===0||i===11||i===15)&&t.flags&16384&&(i=t.updateQueue,i!==null&&(i=i.stores,i!==null)))for(var l=0;l<i.length;l++){var o=i[l],u=o.getSnapshot;o=o.value;try{if(!Gt(u(),o))return!1}catch{return!1}}if(i=t.child,t.subtreeFlags&16384&&i!==null)i.return=t,t=i;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 Ds(e,t,i,l){t&=~wu,t&=~_i,e.suspendedLanes|=t,e.pingedLanes&=~t,l&&(e.warmLanes|=t),l=e.expirationTimes;for(var o=t;0<o;){var u=31-Nt(o),m=1<<u;l[u]=-1,o&=~m}i!==0&&ys(e,i,t)}function Pl(){return(He&6)===0?(fa(0),!1):!0}function ju(){if(je!==null){if(Pe===0)var e=je.return;else e=je,Qn=hi=null,Yo(e),Ii=null,Jr=0,e=je;for(;e!==null;)vm(e.alternate,e),e=e.return;je=null}}function ar(e,t){var i=e.timeoutHandle;i!==-1&&(e.timeoutHandle=-1,Ub(i)),i=e.cancelPendingCommit,i!==null&&(e.cancelPendingCommit=null,i()),rs=0,ju(),Xe=e,je=i=Fn(e.current,null),Ce=t,Pe=0,Qt=null,Cs=!1,sr=ni(e,t),_u=!1,ir=Xt=wu=_i=ks=at=0,Lt=oa=null,Su=!1,(t&8)!==0&&(t|=t&32);var l=e.entangledLanes;if(l!==0)for(e=e.entanglements,l&=t;0<l;){var o=31-Nt(l),u=1<<o;t|=e[o],l&=~u}return is=t,cl(),i}function Gm(e,t){we=null,$.H=ta,t===Xi||t===gl?(t=ad(),Pe=3):t===ko?(t=ad(),Pe=4):Pe=t===ru?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Qt=t,je===null&&(at=1,Cl(e,on(t,e.current)))}function Vm(){var e=Ft.current;return e===null?!0:(Ce&4194048)===Ce?dn===null:(Ce&62914560)===Ce||(Ce&536870912)!==0?e===dn:!1}function Fm(){var e=$.H;return $.H=ta,e===null?ta:e}function Jm(){var e=$.A;return $.A=pb,e}function $l(){at=4,Cs||(Ce&4194048)!==Ce&&Ft.current!==null||(sr=!0),(ks&134217727)===0&&(_i&134217727)===0||Xe===null||Ds(Xe,Ce,Xt,!1)}function Tu(e,t,i){var l=He;He|=2;var o=Fm(),u=Jm();(Xe!==e||Ce!==t)&&(Hl=null,ar(e,t)),t=!1;var m=at;e:do try{if(Pe!==0&&je!==null){var b=je,O=Qt;switch(Pe){case 8:ju(),m=6;break e;case 3:case 2:case 9:case 6:Ft.current===null&&(t=!0);var U=Pe;if(Pe=0,Qt=null,lr(e,b,O,U),i&&sr){m=0;break e}break;default:U=Pe,Pe=0,Qt=null,lr(e,b,O,U)}}bb(),m=at;break}catch(Y){Gm(e,Y)}while(!0);return t&&e.shellSuspendCounter++,Qn=hi=null,He=l,$.H=o,$.A=u,je===null&&(Xe=null,Ce=0,cl()),m}function bb(){for(;je!==null;)Qm(je)}function xb(e,t){var i=He;He|=2;var l=Fm(),o=Jm();Xe!==e||Ce!==t?(Hl=null,Ll=et()+500,ar(e,t)):sr=ni(e,t);e:do try{if(Pe!==0&&je!==null){t=je;var u=Qt;t:switch(Pe){case 1:Pe=0,Qt=null,lr(e,t,u,1);break;case 2:case 9:if(id(u)){Pe=0,Qt=null,Xm(t);break}t=function(){Pe!==2&&Pe!==9||Xe!==e||(Pe=7),Dn(e)},u.then(t,t);break e;case 3:Pe=7;break e;case 4:Pe=5;break e;case 7:id(u)?(Pe=0,Qt=null,Xm(t)):(Pe=0,Qt=null,lr(e,t,u,7));break;case 5:var m=null;switch(je.tag){case 26:m=je.memoizedState;case 5:case 27:var b=je;if(m?Dp(m):b.stateNode.complete){Pe=0,Qt=null;var O=b.sibling;if(O!==null)je=O;else{var U=b.return;U!==null?(je=U,Yl(U)):je=null}break t}}Pe=0,Qt=null,lr(e,t,u,5);break;case 6:Pe=0,Qt=null,lr(e,t,u,6);break;case 8:ju(),at=6;break e;default:throw Error(a(462))}}vb();break}catch(Y){Gm(e,Y)}while(!0);return Qn=hi=null,$.H=l,$.A=o,He=i,je!==null?0:(Xe=null,Ce=0,cl(),at)}function vb(){for(;je!==null&&!Va();)Qm(je)}function Qm(e){var t=bm(e.alternate,e,is);e.memoizedProps=e.pendingProps,t===null?Yl(e):je=t}function Xm(e){var t=e,i=t.alternate;switch(t.tag){case 15:case 0:t=hm(i,t,t.pendingProps,t.type,void 0,Ce);break;case 11:t=hm(i,t,t.pendingProps,t.type.render,t.ref,Ce);break;case 5:Yo(t);default:vm(i,t),t=je=Jh(t,is),t=bm(i,t,is)}e.memoizedProps=e.pendingProps,t===null?Yl(e):je=t}function lr(e,t,i,l){Qn=hi=null,Yo(t),Ii=null,Jr=0;var o=t.return;try{if(cb(e,o,t,i,Ce)){at=1,Cl(e,on(i,e.current)),je=null;return}}catch(u){if(o!==null)throw je=o,u;at=1,Cl(e,on(i,e.current)),je=null;return}t.flags&32768?(Me||l===1?e=!0:sr||(Ce&536870912)!==0?e=!1:(Cs=e=!0,(l===2||l===9||l===3||l===6)&&(l=Ft.current,l!==null&&l.tag===13&&(l.flags|=16384))),Im(t,e)):Yl(t)}function Yl(e){var t=e;do{if((t.flags&32768)!==0){Im(t,Cs);return}e=t.return;var i=fb(t.alternate,t,is);if(i!==null){je=i;return}if(t=t.sibling,t!==null){je=t;return}je=t=e}while(t!==null);at===0&&(at=5)}function Im(e,t){do{var i=hb(e.alternate,e);if(i!==null){i.flags&=32767,je=i;return}if(i=e.return,i!==null&&(i.flags|=32768,i.subtreeFlags=0,i.deletions=null),!t&&(e=e.sibling,e!==null)){je=e;return}je=e=i}while(e!==null);at=6,je=null}function Km(e,t,i,l,o,u,m,b,O){e.cancelPendingCommit=null;do Gl();while(bt!==0);if((He&6)!==0)throw Error(a(327));if(t!==null){if(t===e.current)throw Error(a(177));if(u=t.lanes|t.childLanes,u|=go,gs(e,i,u,m,b,O),e===Xe&&(je=Xe=null,Ce=0),rr=t,Rs=e,rs=i,Eu=u,Au=o,Hm=l,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Eb(Ci,function(){return np(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||l){l=$.T,$.T=null,o=te.p,te.p=2,m=He,He|=4;try{db(e,t,i)}finally{He=m,te.p=o,$.T=l}}bt=1,Zm(),Wm(),ep()}}function Zm(){if(bt===1){bt=0;var e=Rs,t=rr,i=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||i){i=$.T,$.T=null;var l=te.p;te.p=2;var o=He;He|=4;try{Mm(t,e);var u=Hu,m=Bh(e.containerInfo),b=u.focusedElem,O=u.selectionRange;if(m!==b&&b&&b.ownerDocument&&Uh(b.ownerDocument.documentElement,b)){if(O!==null&&uo(b)){var U=O.start,Y=O.end;if(Y===void 0&&(Y=U),"selectionStart"in b)b.selectionStart=U,b.selectionEnd=Math.min(Y,b.value.length);else{var J=b.ownerDocument||document,B=J&&J.defaultView||window;if(B.getSelection){var P=B.getSelection(),fe=b.textContent.length,ge=Math.min(O.start,fe),Je=O.end===void 0?ge:Math.min(O.end,fe);!P.extend&&ge>Je&&(m=Je,Je=ge,ge=m);var M=qh(b,ge),N=qh(b,Je);if(M&&N&&(P.rangeCount!==1||P.anchorNode!==M.node||P.anchorOffset!==M.offset||P.focusNode!==N.node||P.focusOffset!==N.offset)){var q=J.createRange();q.setStart(M.node,M.offset),P.removeAllRanges(),ge>Je?(P.addRange(q),P.extend(N.node,N.offset)):(q.setEnd(N.node,N.offset),P.addRange(q))}}}}for(J=[],P=b;P=P.parentNode;)P.nodeType===1&&J.push({element:P,left:P.scrollLeft,top:P.scrollTop});for(typeof b.focus=="function"&&b.focus(),b=0;b<J.length;b++){var G=J[b];G.element.scrollLeft=G.left,G.element.scrollTop=G.top}}nc=!!Lu,Hu=Lu=null}finally{He=o,te.p=l,$.T=i}}e.current=t,bt=2}}function Wm(){if(bt===2){bt=0;var e=Rs,t=rr,i=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||i){i=$.T,$.T=null;var l=te.p;te.p=2;var o=He;He|=4;try{jm(e,t.alternate,t)}finally{He=o,te.p=l,$.T=i}}bt=3}}function ep(){if(bt===4||bt===3){bt=0,Ni();var e=Rs,t=rr,i=rs,l=Hm;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?bt=5:(bt=0,rr=Rs=null,tp(e,e.pendingLanes));var o=e.pendingLanes;if(o===0&&(Ms=null),ii(i),t=t.stateNode,ct&&typeof ct.onCommitFiberRoot=="function")try{ct.onCommitFiberRoot(ei,t,void 0,(t.current.flags&128)===128)}catch{}if(l!==null){t=$.T,o=te.p,te.p=2,$.T=null;try{for(var u=e.onRecoverableError,m=0;m<l.length;m++){var b=l[m];u(b.value,{componentStack:b.stack})}}finally{$.T=t,te.p=o}}(rs&3)!==0&&Gl(),Dn(e),o=e.pendingLanes,(i&261930)!==0&&(o&42)!==0?e===Ou?ua++:(ua=0,Ou=e):ua=0,fa(0)}}function tp(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Vr(t)))}function Gl(){return Zm(),Wm(),ep(),np()}function np(){if(bt!==5)return!1;var e=Rs,t=Eu;Eu=0;var i=ii(rs),l=$.T,o=te.p;try{te.p=32>i?32:i,$.T=null,i=Au,Au=null;var u=Rs,m=rs;if(bt=0,rr=Rs=null,rs=0,(He&6)!==0)throw Error(a(331));var b=He;if(He|=4,Um(u.current),Dm(u,u.current,m,i),He=b,fa(0,!1),ct&&typeof ct.onPostCommitFiberRoot=="function")try{ct.onPostCommitFiberRoot(ei,u)}catch{}return!0}finally{te.p=o,$.T=l,tp(e,t)}}function sp(e,t,i){t=on(i,t),t=iu(e.stateNode,t,2),e=Os(e,t,2),e!==null&&(vn(e,2),Dn(e))}function $e(e,t,i){if(e.tag===3)sp(e,e,i);else for(;t!==null;){if(t.tag===3){sp(t,e,i);break}else if(t.tag===1){var l=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(Ms===null||!Ms.has(l))){e=on(i,e),i=im(2),l=Os(t,i,2),l!==null&&(rm(i,l,t,e),vn(l,2),Dn(l));break}}t=t.return}}function Nu(e,t,i){var l=e.pingCache;if(l===null){l=e.pingCache=new gb;var o=new Set;l.set(t,o)}else o=l.get(t),o===void 0&&(o=new Set,l.set(t,o));o.has(i)||(_u=!0,o.add(i),e=_b.bind(null,e,t,i),t.then(e,e))}function _b(e,t,i){var l=e.pingCache;l!==null&&l.delete(t),e.pingedLanes|=e.suspendedLanes&i,e.warmLanes&=~i,Xe===e&&(Ce&i)===i&&(at===4||at===3&&(Ce&62914560)===Ce&&300>et()-Bl?(He&2)===0&&ar(e,0):wu|=i,ir===Ce&&(ir=0)),Dn(e)}function ip(e,t){t===0&&(t=Mi()),e=oi(e,t),e!==null&&(vn(e,t),Dn(e))}function wb(e){var t=e.memoizedState,i=0;t!==null&&(i=t.retryLane),ip(e,i)}function Sb(e,t){var i=0;switch(e.tag){case 31:case 13:var l=e.stateNode,o=e.memoizedState;o!==null&&(i=o.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(a(314))}l!==null&&l.delete(t),ip(e,i)}function Eb(e,t){return Tr(e,t)}var Vl=null,cr=null,Cu=!1,Fl=!1,ku=!1,zs=0;function Dn(e){e!==cr&&e.next===null&&(cr===null?Vl=cr=e:cr=cr.next=e),Fl=!0,Cu||(Cu=!0,Ob())}function fa(e,t){if(!ku&&Fl){ku=!0;do for(var i=!1,l=Vl;l!==null;){if(e!==0){var o=l.pendingLanes;if(o===0)var u=0;else{var m=l.suspendedLanes,b=l.pingedLanes;u=(1<<31-Nt(42|e)+1)-1,u&=o&~(m&~b),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(i=!0,cp(l,u))}else u=Ce,u=ti(l,l===Xe?u:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(u&3)===0||ni(l,u)||(i=!0,cp(l,u));l=l.next}while(i);ku=!1}}function Ab(){rp()}function rp(){Fl=Cu=!1;var e=0;zs!==0&&qb()&&(e=zs);for(var t=et(),i=null,l=Vl;l!==null;){var o=l.next,u=ap(l,t);u===0?(l.next=null,i===null?Vl=o:i.next=o,o===null&&(cr=i)):(i=l,(e!==0||(u&3)!==0)&&(Fl=!0)),l=o}bt!==0&&bt!==5||fa(e),zs!==0&&(zs=0)}function ap(e,t){for(var i=e.suspendedLanes,l=e.pingedLanes,o=e.expirationTimes,u=e.pendingLanes&-62914561;0<u;){var m=31-Nt(u),b=1<<m,O=o[m];O===-1?((b&i)===0||(b&l)!==0)&&(o[m]=kr(b,t)):O<=t&&(e.expiredLanes|=b),u&=~b}if(t=Xe,i=Ce,i=ti(e,e===t?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,i===0||e===t&&(Pe===2||Pe===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&Hn(l),e.callbackNode=null,e.callbackPriority=0;if((i&3)===0||ni(e,i)){if(t=i&-i,t===e.callbackPriority)return t;switch(l!==null&&Hn(l),ii(i)){case 2:case 8:i=Ja;break;case 32:i=Ci;break;case 268435456:i=Qa;break;default:i=Ci}return l=lp.bind(null,e),i=Tr(i,l),e.callbackPriority=t,e.callbackNode=i,t}return l!==null&&l!==null&&Hn(l),e.callbackPriority=2,e.callbackNode=null,2}function lp(e,t){if(bt!==0&&bt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var i=e.callbackNode;if(Gl()&&e.callbackNode!==i)return null;var l=Ce;return l=ti(e,e===Xe?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:($m(e,l,t),ap(e,et()),e.callbackNode!=null&&e.callbackNode===i?lp.bind(null,e):null)}function cp(e,t){if(Gl())return null;$m(e,t,!0)}function Ob(){Bb(function(){(He&6)!==0?Tr(Fa,Ab):rp()})}function Mu(){if(zs===0){var e=Ji;e===0&&(e=ds,ds<<=1,(ds&261888)===0&&(ds=256)),zs=e}return zs}function op(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:el(""+e)}function up(e,t){var i=t.ownerDocument.createElement("input");return i.name=t.name,i.value=t.value,e.id&&i.setAttribute("form",e.id),t.parentNode.insertBefore(i,t),e=new FormData(e),i.parentNode.removeChild(i),e}function jb(e,t,i,l,o){if(t==="submit"&&i&&i.stateNode===o){var u=op((o[it]||null).action),m=l.submitter;m&&(t=(t=m[it]||null)?op(t.formAction):m.getAttribute("formAction"),t!==null&&(u=t,m=null));var b=new il("action","action",null,l,o);e.push({event:b,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(zs!==0){var O=m?up(o,m):new FormData(o);Zo(i,{pending:!0,data:O,method:o.method,action:u},null,O)}}else typeof u=="function"&&(b.preventDefault(),O=m?up(o,m):new FormData(o),Zo(i,{pending:!0,data:O,method:o.method,action:u},u,O))},currentTarget:o}]})}}for(var Ru=0;Ru<po.length;Ru++){var Du=po[Ru],Tb=Du.toLowerCase(),Nb=Du[0].toUpperCase()+Du.slice(1);wn(Tb,"on"+Nb)}wn(Ph,"onAnimationEnd"),wn($h,"onAnimationIteration"),wn(Yh,"onAnimationStart"),wn("dblclick","onDoubleClick"),wn("focusin","onFocus"),wn("focusout","onBlur"),wn(Vy,"onTransitionRun"),wn(Fy,"onTransitionStart"),wn(Jy,"onTransitionCancel"),wn(Gh,"onTransitionEnd"),L("onMouseEnter",["mouseout","mouseover"]),L("onMouseLeave",["mouseout","mouseover"]),L("onPointerEnter",["pointerout","pointerover"]),L("onPointerLeave",["pointerout","pointerover"]),X("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),X("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),X("onBeforeInput",["compositionend","keypress","textInput","paste"]),X("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),X("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),X("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ha="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(" "),Cb=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ha));function fp(e,t){t=(t&4)!==0;for(var i=0;i<e.length;i++){var l=e[i],o=l.event;l=l.listeners;e:{var u=void 0;if(t)for(var m=l.length-1;0<=m;m--){var b=l[m],O=b.instance,U=b.currentTarget;if(b=b.listener,O!==u&&o.isPropagationStopped())break e;u=b,o.currentTarget=U;try{u(o)}catch(Y){ll(Y)}o.currentTarget=null,u=O}else for(m=0;m<l.length;m++){if(b=l[m],O=b.instance,U=b.currentTarget,b=b.listener,O!==u&&o.isPropagationStopped())break e;u=b,o.currentTarget=U;try{u(o)}catch(Y){ll(Y)}o.currentTarget=null,u=O}}}}function Te(e,t){var i=t[ri];i===void 0&&(i=t[ri]=new Set);var l=e+"__bubble";i.has(l)||(hp(t,e,2,!1),i.add(l))}function zu(e,t,i){var l=0;t&&(l|=4),hp(i,e,l,t)}var Jl="_reactListening"+Math.random().toString(36).slice(2);function qu(e){if(!e[Jl]){e[Jl]=!0,D.forEach(function(i){i!=="selectionchange"&&(Cb.has(i)||zu(i,!1,e),zu(i,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Jl]||(t[Jl]=!0,zu("selectionchange",!1,t))}}function hp(e,t,i,l){switch(Pp(t)){case 2:var o=ix;break;case 8:o=rx;break;default:o=Ku}i=o.bind(null,t,i,e),o=void 0,!to||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(o=!0),l?o!==void 0?e.addEventListener(t,i,{capture:!0,passive:o}):e.addEventListener(t,i,!0):o!==void 0?e.addEventListener(t,i,{passive:o}):e.addEventListener(t,i,!1)}function Uu(e,t,i,l,o){var u=l;if((t&1)===0&&(t&2)===0&&l!==null)e:for(;;){if(l===null)return;var m=l.tag;if(m===3||m===4){var b=l.stateNode.containerInfo;if(b===o)break;if(m===4)for(m=l.return;m!==null;){var O=m.tag;if((O===3||O===4)&&m.stateNode.containerInfo===o)return;m=m.return}for(;b!==null;){if(m=x(b),m===null)return;if(O=m.tag,O===5||O===6||O===26||O===27){l=u=m;continue e}b=b.parentNode}}l=l.return}yh(function(){var U=u,Y=Wc(i),J=[];e:{var B=Vh.get(e);if(B!==void 0){var P=il,fe=e;switch(e){case"keypress":if(nl(i)===0)break e;case"keydown":case"keyup":P=Sy;break;case"focusin":fe="focus",P=ro;break;case"focusout":fe="blur",P=ro;break;case"beforeblur":case"afterblur":P=ro;break;case"click":if(i.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":P=vh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":P=fy;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":P=Oy;break;case Ph:case $h:case Yh:P=my;break;case Gh:P=Ty;break;case"scroll":case"scrollend":P=oy;break;case"wheel":P=Cy;break;case"copy":case"cut":case"paste":P=gy;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":P=wh;break;case"toggle":case"beforetoggle":P=My}var ge=(t&4)!==0,Je=!ge&&(e==="scroll"||e==="scrollend"),M=ge?B!==null?B+"Capture":null:B;ge=[];for(var N=U,q;N!==null;){var G=N;if(q=G.stateNode,G=G.tag,G!==5&&G!==26&&G!==27||q===null||M===null||(G=Dr(N,M),G!=null&&ge.push(da(N,G,q))),Je)break;N=N.return}0<ge.length&&(B=new P(B,fe,null,i,Y),J.push({event:B,listeners:ge}))}}if((t&7)===0){e:{if(B=e==="mouseover"||e==="pointerover",P=e==="mouseout"||e==="pointerout",B&&i!==Zc&&(fe=i.relatedTarget||i.fromElement)&&(x(fe)||fe[Yt]))break e;if((P||B)&&(B=Y.window===Y?Y:(B=Y.ownerDocument)?B.defaultView||B.parentWindow:window,P?(fe=i.relatedTarget||i.toElement,P=U,fe=fe?x(fe):null,fe!==null&&(Je=f(fe),ge=fe.tag,fe!==Je||ge!==5&&ge!==27&&ge!==6)&&(fe=null)):(P=null,fe=U),P!==fe)){if(ge=vh,G="onMouseLeave",M="onMouseEnter",N="mouse",(e==="pointerout"||e==="pointerover")&&(ge=wh,G="onPointerLeave",M="onPointerEnter",N="pointer"),Je=P==null?B:_(P),q=fe==null?B:_(fe),B=new ge(G,N+"leave",P,i,Y),B.target=Je,B.relatedTarget=q,G=null,x(Y)===U&&(ge=new ge(M,N+"enter",fe,i,Y),ge.target=q,ge.relatedTarget=Je,G=ge),Je=G,P&&fe)t:{for(ge=kb,M=P,N=fe,q=0,G=M;G;G=ge(G))q++;G=0;for(var pe=N;pe;pe=ge(pe))G++;for(;0<q-G;)M=ge(M),q--;for(;0<G-q;)N=ge(N),G--;for(;q--;){if(M===N||N!==null&&M===N.alternate){ge=M;break t}M=ge(M),N=ge(N)}ge=null}else ge=null;P!==null&&dp(J,B,P,ge,!1),fe!==null&&Je!==null&&dp(J,Je,fe,ge,!0)}}e:{if(B=U?_(U):window,P=B.nodeName&&B.nodeName.toLowerCase(),P==="select"||P==="input"&&B.type==="file")var Ue=Ch;else if(Th(B))if(kh)Ue=$y;else{Ue=Hy;var de=Ly}else P=B.nodeName,!P||P.toLowerCase()!=="input"||B.type!=="checkbox"&&B.type!=="radio"?U&&Kc(U.elementType)&&(Ue=Ch):Ue=Py;if(Ue&&(Ue=Ue(e,U))){Nh(J,Ue,i,Y);break e}de&&de(e,B,U),e==="focusout"&&U&&B.type==="number"&&U.memoizedProps.value!=null&&Ic(B,"number",B.value)}switch(de=U?_(U):window,e){case"focusin":(Th(de)||de.contentEditable==="true")&&(Li=de,fo=U,$r=null);break;case"focusout":$r=fo=Li=null;break;case"mousedown":ho=!0;break;case"contextmenu":case"mouseup":case"dragend":ho=!1,Lh(J,i,Y);break;case"selectionchange":if(Gy)break;case"keydown":case"keyup":Lh(J,i,Y)}var Se;if(lo)e:{switch(e){case"compositionstart":var ke="onCompositionStart";break e;case"compositionend":ke="onCompositionEnd";break e;case"compositionupdate":ke="onCompositionUpdate";break e}ke=void 0}else Bi?Oh(e,i)&&(ke="onCompositionEnd"):e==="keydown"&&i.keyCode===229&&(ke="onCompositionStart");ke&&(Sh&&i.locale!=="ko"&&(Bi||ke!=="onCompositionStart"?ke==="onCompositionEnd"&&Bi&&(Se=bh()):(xs=Y,no="value"in xs?xs.value:xs.textContent,Bi=!0)),de=Ql(U,ke),0<de.length&&(ke=new _h(ke,e,null,i,Y),J.push({event:ke,listeners:de}),Se?ke.data=Se:(Se=jh(i),Se!==null&&(ke.data=Se)))),(Se=Dy?zy(e,i):qy(e,i))&&(ke=Ql(U,"onBeforeInput"),0<ke.length&&(de=new _h("onBeforeInput","beforeinput",null,i,Y),J.push({event:de,listeners:ke}),de.data=Se)),jb(J,e,U,i,Y)}fp(J,t)})}function da(e,t,i){return{instance:e,listener:t,currentTarget:i}}function Ql(e,t){for(var i=t+"Capture",l=[];e!==null;){var o=e,u=o.stateNode;if(o=o.tag,o!==5&&o!==26&&o!==27||u===null||(o=Dr(e,i),o!=null&&l.unshift(da(e,o,u)),o=Dr(e,t),o!=null&&l.push(da(e,o,u))),e.tag===3)return l;e=e.return}return[]}function kb(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function dp(e,t,i,l,o){for(var u=t._reactName,m=[];i!==null&&i!==l;){var b=i,O=b.alternate,U=b.stateNode;if(b=b.tag,O!==null&&O===l)break;b!==5&&b!==26&&b!==27||U===null||(O=U,o?(U=Dr(i,u),U!=null&&m.unshift(da(i,U,O))):o||(U=Dr(i,u),U!=null&&m.push(da(i,U,O)))),i=i.return}m.length!==0&&e.push({event:t,listeners:m})}var Mb=/\r\n?/g,Rb=/\u0000|\uFFFD/g;function mp(e){return(typeof e=="string"?e:""+e).replace(Mb,`
26
+ `).replace(Rb,"")}function pp(e,t){return t=mp(t),mp(e)===t}function Fe(e,t,i,l,o,u){switch(i){case"children":typeof l=="string"?t==="body"||t==="textarea"&&l===""||zi(e,l):(typeof l=="number"||typeof l=="bigint")&&t!=="body"&&zi(e,""+l);break;case"className":_n(e,"class",l);break;case"tabIndex":_n(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":_n(e,i,l);break;case"style":ph(e,l,u);break;case"data":if(t!=="object"){_n(e,"data",l);break}case"src":case"href":if(l===""&&(t!=="a"||i!=="href")){e.removeAttribute(i);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(i);break}l=el(""+l),e.setAttribute(i,l);break;case"action":case"formAction":if(typeof l=="function"){e.setAttribute(i,"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"&&(i==="formAction"?(t!=="input"&&Fe(e,t,"name",o.name,o,null),Fe(e,t,"formEncType",o.formEncType,o,null),Fe(e,t,"formMethod",o.formMethod,o,null),Fe(e,t,"formTarget",o.formTarget,o,null)):(Fe(e,t,"encType",o.encType,o,null),Fe(e,t,"method",o.method,o,null),Fe(e,t,"target",o.target,o,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(i);break}l=el(""+l),e.setAttribute(i,l);break;case"onClick":l!=null&&(e.onclick=Gn);break;case"onScroll":l!=null&&Te("scroll",e);break;case"onScrollEnd":l!=null&&Te("scrollend",e);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(a(61));if(i=l.__html,i!=null){if(o.children!=null)throw Error(a(60));e.innerHTML=i}}break;case"multiple":e.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":e.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){e.removeAttribute("xlink:href");break}i=el(""+l),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",i);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(i,""+l):e.removeAttribute(i);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":l&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(i,""):e.removeAttribute(i);break;case"capture":case"download":l===!0?e.setAttribute(i,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(i,l):e.removeAttribute(i);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?e.setAttribute(i,l):e.removeAttribute(i);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?e.removeAttribute(i):e.setAttribute(i,l);break;case"popover":Te("beforetoggle",e),Te("toggle",e),Ct(e,"popover",l);break;case"xlinkActuate":Yn(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":Yn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":Yn(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":Yn(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":Yn(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":Yn(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":Yn(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":Yn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":Yn(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":Ct(e,"is",l);break;case"innerText":case"textContent":break;default:(!(2<i.length)||i[0]!=="o"&&i[0]!=="O"||i[1]!=="n"&&i[1]!=="N")&&(i=ly.get(i)||i,Ct(e,i,l))}}function Bu(e,t,i,l,o,u){switch(i){case"style":ph(e,l,u);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(a(61));if(i=l.__html,i!=null){if(o.children!=null)throw Error(a(60));e.innerHTML=i}}break;case"children":typeof l=="string"?zi(e,l):(typeof l=="number"||typeof l=="bigint")&&zi(e,""+l);break;case"onScroll":l!=null&&Te("scroll",e);break;case"onScrollEnd":l!=null&&Te("scrollend",e);break;case"onClick":l!=null&&(e.onclick=Gn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!F.hasOwnProperty(i))e:{if(i[0]==="o"&&i[1]==="n"&&(o=i.endsWith("Capture"),t=i.slice(2,o?i.length-7:void 0),u=e[it]||null,u=u!=null?u[i]:null,typeof u=="function"&&e.removeEventListener(t,u,o),typeof l=="function")){typeof u!="function"&&u!==null&&(i in e?e[i]=null:e.hasAttribute(i)&&e.removeAttribute(i)),e.addEventListener(t,l,o);break e}i in e?e[i]=l:l===!0?e.setAttribute(i,""):Ct(e,i,l)}}}function At(e,t,i){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 l=!1,o=!1,u;for(u in i)if(i.hasOwnProperty(u)){var m=i[u];if(m!=null)switch(u){case"src":l=!0;break;case"srcSet":o=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,t));default:Fe(e,t,u,m,i,null)}}o&&Fe(e,t,"srcSet",i.srcSet,i,null),l&&Fe(e,t,"src",i.src,i,null);return;case"input":Te("invalid",e);var b=u=m=o=null,O=null,U=null;for(l in i)if(i.hasOwnProperty(l)){var Y=i[l];if(Y!=null)switch(l){case"name":o=Y;break;case"type":m=Y;break;case"checked":O=Y;break;case"defaultChecked":U=Y;break;case"value":u=Y;break;case"defaultValue":b=Y;break;case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(a(137,t));break;default:Fe(e,t,l,Y,i,null)}}fh(e,u,b,O,U,m,o,!1);return;case"select":Te("invalid",e),l=m=u=null;for(o in i)if(i.hasOwnProperty(o)&&(b=i[o],b!=null))switch(o){case"value":u=b;break;case"defaultValue":m=b;break;case"multiple":l=b;default:Fe(e,t,o,b,i,null)}t=u,i=m,e.multiple=!!l,t!=null?Di(e,!!l,t,!1):i!=null&&Di(e,!!l,i,!0);return;case"textarea":Te("invalid",e),u=o=l=null;for(m in i)if(i.hasOwnProperty(m)&&(b=i[m],b!=null))switch(m){case"value":l=b;break;case"defaultValue":o=b;break;case"children":u=b;break;case"dangerouslySetInnerHTML":if(b!=null)throw Error(a(91));break;default:Fe(e,t,m,b,i,null)}dh(e,l,o,u);return;case"option":for(O in i)if(i.hasOwnProperty(O)&&(l=i[O],l!=null))switch(O){case"selected":e.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:Fe(e,t,O,l,i,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(l=0;l<ha.length;l++)Te(ha[l],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(U in i)if(i.hasOwnProperty(U)&&(l=i[U],l!=null))switch(U){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,t));default:Fe(e,t,U,l,i,null)}return;default:if(Kc(t)){for(Y in i)i.hasOwnProperty(Y)&&(l=i[Y],l!==void 0&&Bu(e,t,Y,l,i,void 0));return}}for(b in i)i.hasOwnProperty(b)&&(l=i[b],l!=null&&Fe(e,t,b,l,i,null))}function Db(e,t,i,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var o=null,u=null,m=null,b=null,O=null,U=null,Y=null;for(P in i){var J=i[P];if(i.hasOwnProperty(P)&&J!=null)switch(P){case"checked":break;case"value":break;case"defaultValue":O=J;default:l.hasOwnProperty(P)||Fe(e,t,P,null,l,J)}}for(var B in l){var P=l[B];if(J=i[B],l.hasOwnProperty(B)&&(P!=null||J!=null))switch(B){case"type":u=P;break;case"name":o=P;break;case"checked":U=P;break;case"defaultChecked":Y=P;break;case"value":m=P;break;case"defaultValue":b=P;break;case"children":case"dangerouslySetInnerHTML":if(P!=null)throw Error(a(137,t));break;default:P!==J&&Fe(e,t,B,P,l,J)}}Xc(e,m,b,O,U,Y,u,o);return;case"select":P=m=b=B=null;for(u in i)if(O=i[u],i.hasOwnProperty(u)&&O!=null)switch(u){case"value":break;case"multiple":P=O;default:l.hasOwnProperty(u)||Fe(e,t,u,null,l,O)}for(o in l)if(u=l[o],O=i[o],l.hasOwnProperty(o)&&(u!=null||O!=null))switch(o){case"value":B=u;break;case"defaultValue":b=u;break;case"multiple":m=u;default:u!==O&&Fe(e,t,o,u,l,O)}t=b,i=m,l=P,B!=null?Di(e,!!i,B,!1):!!l!=!!i&&(t!=null?Di(e,!!i,t,!0):Di(e,!!i,i?[]:"",!1));return;case"textarea":P=B=null;for(b in i)if(o=i[b],i.hasOwnProperty(b)&&o!=null&&!l.hasOwnProperty(b))switch(b){case"value":break;case"children":break;default:Fe(e,t,b,null,l,o)}for(m in l)if(o=l[m],u=i[m],l.hasOwnProperty(m)&&(o!=null||u!=null))switch(m){case"value":B=o;break;case"defaultValue":P=o;break;case"children":break;case"dangerouslySetInnerHTML":if(o!=null)throw Error(a(91));break;default:o!==u&&Fe(e,t,m,o,l,u)}hh(e,B,P);return;case"option":for(var fe in i)if(B=i[fe],i.hasOwnProperty(fe)&&B!=null&&!l.hasOwnProperty(fe))switch(fe){case"selected":e.selected=!1;break;default:Fe(e,t,fe,null,l,B)}for(O in l)if(B=l[O],P=i[O],l.hasOwnProperty(O)&&B!==P&&(B!=null||P!=null))switch(O){case"selected":e.selected=B&&typeof B!="function"&&typeof B!="symbol";break;default:Fe(e,t,O,B,l,P)}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 ge in i)B=i[ge],i.hasOwnProperty(ge)&&B!=null&&!l.hasOwnProperty(ge)&&Fe(e,t,ge,null,l,B);for(U in l)if(B=l[U],P=i[U],l.hasOwnProperty(U)&&B!==P&&(B!=null||P!=null))switch(U){case"children":case"dangerouslySetInnerHTML":if(B!=null)throw Error(a(137,t));break;default:Fe(e,t,U,B,l,P)}return;default:if(Kc(t)){for(var Je in i)B=i[Je],i.hasOwnProperty(Je)&&B!==void 0&&!l.hasOwnProperty(Je)&&Bu(e,t,Je,void 0,l,B);for(Y in l)B=l[Y],P=i[Y],!l.hasOwnProperty(Y)||B===P||B===void 0&&P===void 0||Bu(e,t,Y,B,l,P);return}}for(var M in i)B=i[M],i.hasOwnProperty(M)&&B!=null&&!l.hasOwnProperty(M)&&Fe(e,t,M,null,l,B);for(J in l)B=l[J],P=i[J],!l.hasOwnProperty(J)||B===P||B==null&&P==null||Fe(e,t,J,B,l,P)}function gp(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function zb(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,i=performance.getEntriesByType("resource"),l=0;l<i.length;l++){var o=i[l],u=o.transferSize,m=o.initiatorType,b=o.duration;if(u&&b&&gp(m)){for(m=0,b=o.responseEnd,l+=1;l<i.length;l++){var O=i[l],U=O.startTime;if(U>b)break;var Y=O.transferSize,J=O.initiatorType;Y&&gp(J)&&(O=O.responseEnd,m+=Y*(O<b?1:(b-U)/(O-U)))}if(--l,t+=8*(u+m)/(o.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 Lu=null,Hu=null;function Xl(e){return e.nodeType===9?e:e.ownerDocument}function yp(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 bp(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 Pu(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 $u=null;function qb(){var e=window.event;return e&&e.type==="popstate"?e===$u?!1:($u=e,!0):($u=null,!1)}var xp=typeof setTimeout=="function"?setTimeout:void 0,Ub=typeof clearTimeout=="function"?clearTimeout:void 0,vp=typeof Promise=="function"?Promise:void 0,Bb=typeof queueMicrotask=="function"?queueMicrotask:typeof vp<"u"?function(e){return vp.resolve(null).then(e).catch(Lb)}:xp;function Lb(e){setTimeout(function(){throw e})}function qs(e){return e==="head"}function _p(e,t){var i=t,l=0;do{var o=i.nextSibling;if(e.removeChild(i),o&&o.nodeType===8)if(i=o.data,i==="/$"||i==="/&"){if(l===0){e.removeChild(o),hr(t);return}l--}else if(i==="$"||i==="$?"||i==="$~"||i==="$!"||i==="&")l++;else if(i==="html")ma(e.ownerDocument.documentElement);else if(i==="head"){i=e.ownerDocument.head,ma(i);for(var u=i.firstChild;u;){var m=u.nextSibling,b=u.nodeName;u[yt]||b==="SCRIPT"||b==="STYLE"||b==="LINK"&&u.rel.toLowerCase()==="stylesheet"||i.removeChild(u),u=m}}else i==="body"&&ma(e.ownerDocument.body);i=o}while(i);hr(t)}function wp(e,t){var i=e;e=0;do{var l=i.nextSibling;if(i.nodeType===1?t?(i._stashedDisplay=i.style.display,i.style.display="none"):(i.style.display=i._stashedDisplay||"",i.getAttribute("style")===""&&i.removeAttribute("style")):i.nodeType===3&&(t?(i._stashedText=i.nodeValue,i.nodeValue=""):i.nodeValue=i._stashedText||""),l&&l.nodeType===8)if(i=l.data,i==="/$"){if(e===0)break;e--}else i!=="$"&&i!=="$?"&&i!=="$~"&&i!=="$!"||e++;i=l}while(i)}function Yu(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var i=t;switch(t=t.nextSibling,i.nodeName){case"HTML":case"HEAD":case"BODY":Yu(i),Ri(i);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(i.rel.toLowerCase()==="stylesheet")continue}e.removeChild(i)}}function Hb(e,t,i,l){for(;e.nodeType===1;){var o=i;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[yt])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!==o.rel||e.getAttribute("href")!==(o.href==null||o.href===""?null:o.href)||e.getAttribute("crossorigin")!==(o.crossOrigin==null?null:o.crossOrigin)||e.getAttribute("title")!==(o.title==null?null:o.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(u=e.getAttribute("src"),(u!==(o.src==null?null:o.src)||e.getAttribute("type")!==(o.type==null?null:o.type)||e.getAttribute("crossorigin")!==(o.crossOrigin==null?null:o.crossOrigin))&&u&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var u=o.name==null?null:""+o.name;if(o.type==="hidden"&&e.getAttribute("name")===u)return e}else return e;if(e=mn(e.nextSibling),e===null)break}return null}function Pb(e,t,i){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!i||(e=mn(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=mn(e.nextSibling),e===null))return null;return e}function Gu(e){return e.data==="$?"||e.data==="$~"}function Vu(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function $b(e,t){var i=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||i.readyState!=="loading")t();else{var l=function(){t(),i.removeEventListener("DOMContentLoaded",l)};i.addEventListener("DOMContentLoaded",l),e._reactRetry=l}}function mn(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 Fu=null;function Ep(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var i=e.data;if(i==="/$"||i==="/&"){if(t===0)return mn(e.nextSibling);t--}else i!=="$"&&i!=="$!"&&i!=="$?"&&i!=="$~"&&i!=="&"||t++}e=e.nextSibling}return null}function Ap(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var i=e.data;if(i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"){if(t===0)return e;t--}else i!=="/$"&&i!=="/&"||t++}e=e.previousSibling}return null}function Op(e,t,i){switch(t=Xl(i),e){case"html":if(e=t.documentElement,!e)throw Error(a(452));return e;case"head":if(e=t.head,!e)throw Error(a(453));return e;case"body":if(e=t.body,!e)throw Error(a(454));return e;default:throw Error(a(451))}}function ma(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Ri(e)}var pn=new Map,jp=new Set;function Il(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var as=te.d;te.d={f:Yb,r:Gb,D:Vb,C:Fb,L:Jb,m:Qb,X:Ib,S:Xb,M:Kb};function Yb(){var e=as.f(),t=Pl();return e||t}function Gb(e){var t=w(e);t!==null&&t.tag===5&&t.type==="form"?Gd(t):as.r(e)}var or=typeof document>"u"?null:document;function Tp(e,t,i){var l=or;if(l&&typeof t=="string"&&t){var o=ln(t);o='link[rel="'+e+'"][href="'+o+'"]',typeof i=="string"&&(o+='[crossorigin="'+i+'"]'),jp.has(o)||(jp.add(o),e={rel:e,crossOrigin:i,href:t},l.querySelector(o)===null&&(t=l.createElement("link"),At(t,"link",e),T(t),l.head.appendChild(t)))}}function Vb(e){as.D(e),Tp("dns-prefetch",e,null)}function Fb(e,t){as.C(e,t),Tp("preconnect",e,t)}function Jb(e,t,i){as.L(e,t,i);var l=or;if(l&&e&&t){var o='link[rel="preload"][as="'+ln(t)+'"]';t==="image"&&i&&i.imageSrcSet?(o+='[imagesrcset="'+ln(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(o+='[imagesizes="'+ln(i.imageSizes)+'"]')):o+='[href="'+ln(e)+'"]';var u=o;switch(t){case"style":u=ur(e);break;case"script":u=fr(e)}pn.has(u)||(e=S({rel:"preload",href:t==="image"&&i&&i.imageSrcSet?void 0:e,as:t},i),pn.set(u,e),l.querySelector(o)!==null||t==="style"&&l.querySelector(pa(u))||t==="script"&&l.querySelector(ga(u))||(t=l.createElement("link"),At(t,"link",e),T(t),l.head.appendChild(t)))}}function Qb(e,t){as.m(e,t);var i=or;if(i&&e){var l=t&&typeof t.as=="string"?t.as:"script",o='link[rel="modulepreload"][as="'+ln(l)+'"][href="'+ln(e)+'"]',u=o;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=fr(e)}if(!pn.has(u)&&(e=S({rel:"modulepreload",href:e},t),pn.set(u,e),i.querySelector(o)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(ga(u)))return}l=i.createElement("link"),At(l,"link",e),T(l),i.head.appendChild(l)}}}function Xb(e,t,i){as.S(e,t,i);var l=or;if(l&&e){var o=E(l).hoistableStyles,u=ur(e);t=t||"default";var m=o.get(u);if(!m){var b={loading:0,preload:null};if(m=l.querySelector(pa(u)))b.loading=5;else{e=S({rel:"stylesheet",href:e,"data-precedence":t},i),(i=pn.get(u))&&Ju(e,i);var O=m=l.createElement("link");T(O),At(O,"link",e),O._p=new Promise(function(U,Y){O.onload=U,O.onerror=Y}),O.addEventListener("load",function(){b.loading|=1}),O.addEventListener("error",function(){b.loading|=2}),b.loading|=4,Kl(m,t,l)}m={type:"stylesheet",instance:m,count:1,state:b},o.set(u,m)}}}function Ib(e,t){as.X(e,t);var i=or;if(i&&e){var l=E(i).hoistableScripts,o=fr(e),u=l.get(o);u||(u=i.querySelector(ga(o)),u||(e=S({src:e,async:!0},t),(t=pn.get(o))&&Qu(e,t),u=i.createElement("script"),T(u),At(u,"link",e),i.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},l.set(o,u))}}function Kb(e,t){as.M(e,t);var i=or;if(i&&e){var l=E(i).hoistableScripts,o=fr(e),u=l.get(o);u||(u=i.querySelector(ga(o)),u||(e=S({src:e,async:!0,type:"module"},t),(t=pn.get(o))&&Qu(e,t),u=i.createElement("script"),T(u),At(u,"link",e),i.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},l.set(o,u))}}function Np(e,t,i,l){var o=(o=sn.current)?Il(o):null;if(!o)throw Error(a(446));switch(e){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(t=ur(i.href),i=E(o).hoistableStyles,l=i.get(t),l||(l={type:"style",instance:null,count:0,state:null},i.set(t,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(i.rel==="stylesheet"&&typeof i.href=="string"&&typeof i.precedence=="string"){e=ur(i.href);var u=E(o).hoistableStyles,m=u.get(e);if(m||(o=o.ownerDocument||o,m={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(e,m),(u=o.querySelector(pa(e)))&&!u._p&&(m.instance=u,m.state.loading=5),pn.has(e)||(i={rel:"preload",as:"style",href:i.href,crossOrigin:i.crossOrigin,integrity:i.integrity,media:i.media,hrefLang:i.hrefLang,referrerPolicy:i.referrerPolicy},pn.set(e,i),u||Zb(o,e,i,m.state))),t&&l===null)throw Error(a(528,""));return m}if(t&&l!==null)throw Error(a(529,""));return null;case"script":return t=i.async,i=i.src,typeof i=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=fr(i),i=E(o).hoistableScripts,l=i.get(t),l||(l={type:"script",instance:null,count:0,state:null},i.set(t,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,e))}}function ur(e){return'href="'+ln(e)+'"'}function pa(e){return'link[rel="stylesheet"]['+e+"]"}function Cp(e){return S({},e,{"data-precedence":e.precedence,precedence:null})}function Zb(e,t,i,l){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?l.loading=1:(t=e.createElement("link"),l.preload=t,t.addEventListener("load",function(){return l.loading|=1}),t.addEventListener("error",function(){return l.loading|=2}),At(t,"link",i),T(t),e.head.appendChild(t))}function fr(e){return'[src="'+ln(e)+'"]'}function ga(e){return"script[async]"+e}function kp(e,t,i){if(t.count++,t.instance===null)switch(t.type){case"style":var l=e.querySelector('style[data-href~="'+ln(i.href)+'"]');if(l)return t.instance=l,T(l),l;var o=S({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),T(l),At(l,"style",o),Kl(l,i.precedence,e),t.instance=l;case"stylesheet":o=ur(i.href);var u=e.querySelector(pa(o));if(u)return t.state.loading|=4,t.instance=u,T(u),u;l=Cp(i),(o=pn.get(o))&&Ju(l,o),u=(e.ownerDocument||e).createElement("link"),T(u);var m=u;return m._p=new Promise(function(b,O){m.onload=b,m.onerror=O}),At(u,"link",l),t.state.loading|=4,Kl(u,i.precedence,e),t.instance=u;case"script":return u=fr(i.src),(o=e.querySelector(ga(u)))?(t.instance=o,T(o),o):(l=i,(o=pn.get(u))&&(l=S({},i),Qu(l,o)),e=e.ownerDocument||e,o=e.createElement("script"),T(o),At(o,"link",l),e.head.appendChild(o),t.instance=o);case"void":return null;default:throw Error(a(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(l=t.instance,t.state.loading|=4,Kl(l,i.precedence,e));return t.instance}function Kl(e,t,i){for(var l=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),o=l.length?l[l.length-1]:null,u=o,m=0;m<l.length;m++){var b=l[m];if(b.dataset.precedence===t)u=b;else if(u!==o)break}u?u.parentNode.insertBefore(e,u.nextSibling):(t=i.nodeType===9?i.head:i,t.insertBefore(e,t.firstChild))}function Ju(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Qu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Zl=null;function Mp(e,t,i){if(Zl===null){var l=new Map,o=Zl=new Map;o.set(i,l)}else o=Zl,l=o.get(i),l||(l=new Map,o.set(i,l));if(l.has(e))return l;for(l.set(e,null),i=i.getElementsByTagName(e),o=0;o<i.length;o++){var u=i[o];if(!(u[yt]||u[Qe]||e==="link"&&u.getAttribute("rel")==="stylesheet")&&u.namespaceURI!=="http://www.w3.org/2000/svg"){var m=u.getAttribute(t)||"";m=e+m;var b=l.get(m);b?b.push(u):l.set(m,[u])}}return l}function Rp(e,t,i){e=e.ownerDocument||e,e.head.insertBefore(i,t==="title"?e.querySelector("head > title"):null)}function Wb(e,t,i){if(i===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 Dp(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function ex(e,t,i,l){if(i.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(i.state.loading&4)===0){if(i.instance===null){var o=ur(l.href),u=t.querySelector(pa(o));if(u){t=u._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Wl.bind(e),t.then(e,e)),i.state.loading|=4,i.instance=u,T(u);return}u=t.ownerDocument||t,l=Cp(l),(o=pn.get(o))&&Ju(l,o),u=u.createElement("link"),T(u);var m=u;m._p=new Promise(function(b,O){m.onload=b,m.onerror=O}),At(u,"link",l),i.instance=u}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(i,t),(t=i.state.preload)&&(i.state.loading&3)===0&&(e.count++,i=Wl.bind(e),t.addEventListener("load",i),t.addEventListener("error",i))}}var Xu=0;function tx(e,t){return e.stylesheets&&e.count===0&&tc(e,e.stylesheets),0<e.count||0<e.imgCount?function(i){var l=setTimeout(function(){if(e.stylesheets&&tc(e,e.stylesheets),e.unsuspend){var u=e.unsuspend;e.unsuspend=null,u()}},6e4+t);0<e.imgBytes&&Xu===0&&(Xu=62500*zb());var o=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&tc(e,e.stylesheets),e.unsuspend)){var u=e.unsuspend;e.unsuspend=null,u()}},(e.imgBytes>Xu?50:800)+t);return e.unsuspend=i,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(o)}}:null}function Wl(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)tc(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var ec=null;function tc(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ec=new Map,t.forEach(nx,e),ec=null,Wl.call(e))}function nx(e,t){if(!(t.state.loading&4)){var i=ec.get(e);if(i)var l=i.get(null);else{i=new Map,ec.set(e,i);for(var o=e.querySelectorAll("link[data-precedence],style[data-precedence]"),u=0;u<o.length;u++){var m=o[u];(m.nodeName==="LINK"||m.getAttribute("media")!=="not all")&&(i.set(m.dataset.precedence,m),l=m)}l&&i.set(null,l)}o=t.instance,m=o.getAttribute("data-precedence"),u=i.get(m)||l,u===l&&i.set(null,o),i.set(m,o),this.count++,l=Wl.bind(this),o.addEventListener("load",l),o.addEventListener("error",l),u?u.parentNode.insertBefore(o,u.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(o,e.firstChild)),t.state.loading|=4}}var ya={$$typeof:me,Provider:null,Consumer:null,_currentValue:he,_currentValue2:he,_threadCount:0};function sx(e,t,i,l,o,u,m,b,O){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=ps(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ps(0),this.hiddenUpdates=ps(null),this.identifierPrefix=l,this.onUncaughtError=o,this.onCaughtError=u,this.onRecoverableError=m,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=O,this.incompleteTransitions=new Map}function zp(e,t,i,l,o,u,m,b,O,U,Y,J){return e=new sx(e,t,i,m,O,U,Y,J,b),t=1,u===!0&&(t|=24),u=Vt(3,null,null,t),e.current=u,u.stateNode=e,t=To(),t.refCount++,e.pooledCache=t,t.refCount++,u.memoizedState={element:l,isDehydrated:i,cache:t},Mo(u),e}function qp(e){return e?(e=$i,e):$i}function Up(e,t,i,l,o,u){o=qp(o),l.context===null?l.context=o:l.pendingContext=o,l=As(t),l.payload={element:i},u=u===void 0?null:u,u!==null&&(l.callback=u),i=Os(e,l,t),i!==null&&(Ht(i,e,t),Xr(i,e,t))}function Bp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var i=e.retryLane;e.retryLane=i!==0&&i<t?i:t}}function Iu(e,t){Bp(e,t),(e=e.alternate)&&Bp(e,t)}function Lp(e){if(e.tag===13||e.tag===31){var t=oi(e,67108864);t!==null&&Ht(t,e,67108864),Iu(e,67108864)}}function Hp(e){if(e.tag===13||e.tag===31){var t=It();t=$n(t);var i=oi(e,t);i!==null&&Ht(i,e,t),Iu(e,t)}}var nc=!0;function ix(e,t,i,l){var o=$.T;$.T=null;var u=te.p;try{te.p=2,Ku(e,t,i,l)}finally{te.p=u,$.T=o}}function rx(e,t,i,l){var o=$.T;$.T=null;var u=te.p;try{te.p=8,Ku(e,t,i,l)}finally{te.p=u,$.T=o}}function Ku(e,t,i,l){if(nc){var o=Zu(l);if(o===null)Uu(e,t,l,sc,i),$p(e,l);else if(lx(o,e,t,i,l))l.stopPropagation();else if($p(e,l),t&4&&-1<ax.indexOf(e)){for(;o!==null;){var u=w(o);if(u!==null)switch(u.tag){case 3:if(u=u.stateNode,u.current.memoizedState.isDehydrated){var m=xn(u.pendingLanes);if(m!==0){var b=u;for(b.pendingLanes|=2,b.entangledLanes|=2;m;){var O=1<<31-Nt(m);b.entanglements[1]|=O,m&=~O}Dn(u),(He&6)===0&&(Ll=et()+500,fa(0))}}break;case 31:case 13:b=oi(u,2),b!==null&&Ht(b,u,2),Pl(),Iu(u,2)}if(u=Zu(l),u===null&&Uu(e,t,l,sc,i),u===o)break;o=u}o!==null&&l.stopPropagation()}else Uu(e,t,l,null,i)}}function Zu(e){return e=Wc(e),Wu(e)}var sc=null;function Wu(e){if(sc=null,e=x(e),e!==null){var t=f(e);if(t===null)e=null;else{var i=t.tag;if(i===13){if(e=h(t),e!==null)return e;e=null}else if(i===31){if(e=d(t),e!==null)return e;e=null}else if(i===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return sc=e,null}function Pp(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(Vc()){case Fa:return 2;case Ja:return 8;case Ci:case Fc:return 32;case Qa:return 268435456;default:return 32}default:return 32}}var ef=!1,Us=null,Bs=null,Ls=null,ba=new Map,xa=new Map,Hs=[],ax="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 $p(e,t){switch(e){case"focusin":case"focusout":Us=null;break;case"dragenter":case"dragleave":Bs=null;break;case"mouseover":case"mouseout":Ls=null;break;case"pointerover":case"pointerout":ba.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":xa.delete(t.pointerId)}}function va(e,t,i,l,o,u){return e===null||e.nativeEvent!==u?(e={blockedOn:t,domEventName:i,eventSystemFlags:l,nativeEvent:u,targetContainers:[o]},t!==null&&(t=w(t),t!==null&&Lp(t)),e):(e.eventSystemFlags|=l,t=e.targetContainers,o!==null&&t.indexOf(o)===-1&&t.push(o),e)}function lx(e,t,i,l,o){switch(t){case"focusin":return Us=va(Us,e,t,i,l,o),!0;case"dragenter":return Bs=va(Bs,e,t,i,l,o),!0;case"mouseover":return Ls=va(Ls,e,t,i,l,o),!0;case"pointerover":var u=o.pointerId;return ba.set(u,va(ba.get(u)||null,e,t,i,l,o)),!0;case"gotpointercapture":return u=o.pointerId,xa.set(u,va(xa.get(u)||null,e,t,i,l,o)),!0}return!1}function Yp(e){var t=x(e.target);if(t!==null){var i=f(t);if(i!==null){if(t=i.tag,t===13){if(t=h(i),t!==null){e.blockedOn=t,Ia(e.priority,function(){Hp(i)});return}}else if(t===31){if(t=d(i),t!==null){e.blockedOn=t,Ia(e.priority,function(){Hp(i)});return}}else if(t===3&&i.stateNode.current.memoizedState.isDehydrated){e.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}e.blockedOn=null}function ic(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var i=Zu(e.nativeEvent);if(i===null){i=e.nativeEvent;var l=new i.constructor(i.type,i);Zc=l,i.target.dispatchEvent(l),Zc=null}else return t=w(i),t!==null&&Lp(t),e.blockedOn=i,!1;t.shift()}return!0}function Gp(e,t,i){ic(e)&&i.delete(t)}function cx(){ef=!1,Us!==null&&ic(Us)&&(Us=null),Bs!==null&&ic(Bs)&&(Bs=null),Ls!==null&&ic(Ls)&&(Ls=null),ba.forEach(Gp),xa.forEach(Gp)}function rc(e,t){e.blockedOn===t&&(e.blockedOn=null,ef||(ef=!0,r.unstable_scheduleCallback(r.unstable_NormalPriority,cx)))}var ac=null;function Vp(e){ac!==e&&(ac=e,r.unstable_scheduleCallback(r.unstable_NormalPriority,function(){ac===e&&(ac=null);for(var t=0;t<e.length;t+=3){var i=e[t],l=e[t+1],o=e[t+2];if(typeof l!="function"){if(Wu(l||i)===null)continue;break}var u=w(i);u!==null&&(e.splice(t,3),t-=3,Zo(u,{pending:!0,data:o,method:i.method,action:l},l,o))}}))}function hr(e){function t(O){return rc(O,e)}Us!==null&&rc(Us,e),Bs!==null&&rc(Bs,e),Ls!==null&&rc(Ls,e),ba.forEach(t),xa.forEach(t);for(var i=0;i<Hs.length;i++){var l=Hs[i];l.blockedOn===e&&(l.blockedOn=null)}for(;0<Hs.length&&(i=Hs[0],i.blockedOn===null);)Yp(i),i.blockedOn===null&&Hs.shift();if(i=(e.ownerDocument||e).$$reactFormReplay,i!=null)for(l=0;l<i.length;l+=3){var o=i[l],u=i[l+1],m=o[it]||null;if(typeof u=="function")m||Vp(i);else if(m){var b=null;if(u&&u.hasAttribute("formAction")){if(o=u,m=u[it]||null)b=m.formAction;else if(Wu(o)!==null)continue}else b=m.action;typeof b=="function"?i[l+1]=b:(i.splice(l,3),l-=3),Vp(i)}}}function Fp(){function e(u){u.canIntercept&&u.info==="react-transition"&&u.intercept({handler:function(){return new Promise(function(m){return o=m})},focusReset:"manual",scroll:"manual"})}function t(){o!==null&&(o(),o=null),l||setTimeout(i,20)}function i(){if(!l&&!navigation.transition){var u=navigation.currentEntry;u&&u.url!=null&&navigation.navigate(u.url,{state:u.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,o=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(i,100),function(){l=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),o!==null&&(o(),o=null)}}}function tf(e){this._internalRoot=e}lc.prototype.render=tf.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(a(409));var i=t.current,l=It();Up(i,l,e,t,null,null)},lc.prototype.unmount=tf.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Up(e.current,2,null,e,null,null),Pl(),t[Yt]=null}};function lc(e){this._internalRoot=e}lc.prototype.unstable_scheduleHydration=function(e){if(e){var t=Mr();e={blockedOn:null,target:e,priority:t};for(var i=0;i<Hs.length&&t!==0&&t<Hs[i].priority;i++);Hs.splice(i,0,e),i===0&&Yp(e)}};var Jp=n.version;if(Jp!=="19.2.4")throw Error(a(527,Jp,"19.2.4"));te.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(a(188)):(e=Object.keys(e).join(","),Error(a(268,e)));return e=y(t),e=e!==null?A(e):null,e=e===null?null:e.stateNode,e};var ox={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:$,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var cc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!cc.isDisabled&&cc.supportsFiber)try{ei=cc.inject(ox),ct=cc}catch{}}return _a.createRoot=function(e,t){if(!c(e))throw Error(a(299));var i=!1,l="",o=em,u=tm,m=nm;return t!=null&&(t.unstable_strictMode===!0&&(i=!0),t.identifierPrefix!==void 0&&(l=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(u=t.onCaughtError),t.onRecoverableError!==void 0&&(m=t.onRecoverableError)),t=zp(e,1,!1,null,null,i,l,null,o,u,m,Fp),e[Yt]=t.current,qu(e),new tf(t)},_a.hydrateRoot=function(e,t,i){if(!c(e))throw Error(a(299));var l=!1,o="",u=em,m=tm,b=nm,O=null;return i!=null&&(i.unstable_strictMode===!0&&(l=!0),i.identifierPrefix!==void 0&&(o=i.identifierPrefix),i.onUncaughtError!==void 0&&(u=i.onUncaughtError),i.onCaughtError!==void 0&&(m=i.onCaughtError),i.onRecoverableError!==void 0&&(b=i.onRecoverableError),i.formState!==void 0&&(O=i.formState)),t=zp(e,1,!0,t,i??null,l,o,O,u,m,b,Fp),t.context=qp(null),i=t.current,l=It(),l=$n(l),o=As(l),o.callback=null,Os(i,o,l),i=l,t.current.lanes=i,vn(t,i),Dn(t),e[Yt]=t.current,qu(e),new lc(t)},_a.version="19.2.4",_a}var Zp;function Fx(){if(Zp)return nf.exports;Zp=1;function r(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(r)}catch(n){console.error(n)}}return r(),nf.exports=Vx(),nf.exports}var Jx=Fx();const Qx="modulepreload",Xx=function(r){return"/"+r},Wp={},ze=function(n,s,a){let c=Promise.resolve();if(s&&s.length>0){let h=function(y){return Promise.all(y.map(A=>Promise.resolve(A).then(S=>({status:"fulfilled",value:S}),S=>({status:"rejected",reason:S}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),g=(d==null?void 0:d.nonce)||(d==null?void 0:d.getAttribute("nonce"));c=h(s.map(y=>{if(y=Xx(y),y in Wp)return;Wp[y]=!0;const A=y.endsWith(".css"),S=A?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${y}"]${S}`))return;const j=document.createElement("link");if(j.rel=A?"stylesheet":Qx,A||(j.as="script"),j.crossOrigin="",j.href=y,g&&j.setAttribute("nonce",g),document.head.appendChild(j),A)return new Promise((z,R)=>{j.addEventListener("load",z),j.addEventListener("error",()=>R(new Error(`Unable to preload CSS for ${y}`)))})}))}function f(h){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=h,window.dispatchEvent(d),!d.defaultPrevented)throw h}return c.then(h=>{for(const d of h||[])d.status==="rejected"&&f(d.reason);return n().catch(f)})};function ag(r){try{const n=r.split(".");if(n.length!==3)return null;const s=atob(n[1].replace(/-/g,"+").replace(/_/g,"/"));return JSON.parse(s)}catch{return null}}function lg(r){const n=ag(r);return!n||typeof n.exp!="number"?null:n.exp}function Vf(r,n=0){const s=lg(r);return s===null?!0:Date.now()/1e3>=s-n}const vf="/api";let Gs=null;function oc(r){Gs=r}function cg(){return Gs}async function e0(){const r=sessionStorage.getItem("lt_credentials");if(!r)return null;try{const{username:n,password:s}=JSON.parse(r),a=await fetch(`${vf}/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:n,password:s})});if(!a.ok)return null;const c=await a.json();return c.token&&c.user&&sessionStorage.setItem("lt_user_info",JSON.stringify({displayName:c.user.display_name,username:c.user.external_id})),c.token??null}catch{return null}}let $s=null;async function Ie(r,n={}){const s={"Content-Type":"application/json",...n.headers};if(Gs){if(Vf(Gs)){$s||($s=e0().finally(()=>{$s=null}));const c=await $s;if(c)Gs=c,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:c}}));else throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}s.Authorization=`Bearer ${Gs}`}let a=await fetch(`${vf}${r}`,{...n,headers:s});if(a.status===401&&Gs){$s||($s=e0().finally(()=>{$s=null}));const c=await $s;if(c&&(Gs=c,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:c}})),s.Authorization=`Bearer ${c}`,a=await fetch(`${vf}${r}`,{...n,headers:s})),a.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}else if(a.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired");if(!a.ok){const c=await a.json().catch(()=>({error:a.statusText}));throw new Error(c.message||c.error||a.statusText)}return a.json()}const og=C.createContext(null),Ix=300;function af(r,n){if(Vf(r))return null;const s=ag(r);if(!s)return null;const a=n??(()=>{try{const c=sessionStorage.getItem("lt_user_info");return c?JSON.parse(c):null}catch{return null}})();return{userId:s.userId,displayName:(a==null?void 0:a.displayName)??null,username:(a==null?void 0:a.username)??null,roles:s.roles??[]}}function Kx({children:r}){const[n,s]=C.useState(()=>{const S=sessionStorage.getItem("lt_token");return S?Vf(S)?(sessionStorage.removeItem("lt_token"),null):(oc(S),af(S)):null}),a=C.useRef(void 0),c=C.useCallback(S=>{clearTimeout(a.current);const j=lg(S);if(!j)return;const z=(j-Ix)*1e3-Date.now();z<=0||(a.current=setTimeout(async()=>{const R=sessionStorage.getItem("lt_credentials");if(R)try{const{username:H,password:ee}=JSON.parse(R),ne=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:H,password:ee})});if(!ne.ok)return;const W=await ne.json();W.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:W.token}}))}catch{}},z))},[]),f=C.useCallback((S,j,z)=>{const R={displayName:(z==null?void 0:z.displayName)??null,username:(z==null?void 0:z.username)??(j==null?void 0:j.username)??null},H=af(S,R);H&&(oc(S),sessionStorage.setItem("lt_token",S),sessionStorage.setItem("lt_user_info",JSON.stringify(R)),j&&sessionStorage.setItem("lt_credentials",JSON.stringify(j)),s(H),c(S))},[c]),h=C.useCallback(()=>{clearTimeout(a.current),oc(null),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info"),s(null)},[]);C.useEffect(()=>{const S=()=>h(),j=z=>{var ee;const R=(ee=z.detail)==null?void 0:ee.token;if(!R)return;const H=af(R);H&&(oc(R),sessionStorage.setItem("lt_token",R),s(H),c(R))};return window.addEventListener("auth:unauthorized",S),window.addEventListener("auth:refreshed",j),()=>{window.removeEventListener("auth:unauthorized",S),window.removeEventListener("auth:refreshed",j)}},[h,c]),C.useEffect(()=>{const S=sessionStorage.getItem("lt_token");return S&&n&&c(S),()=>clearTimeout(a.current)},[]);const d=(n==null?void 0:n.roles.some(S=>S.type==="superadmin"))??!1,g=C.useCallback(S=>(n==null?void 0:n.roles.some(j=>j.role===S))??!1,[n]),y=C.useCallback(S=>(n==null?void 0:n.roles.some(j=>j.type===S))??!1,[n]),A=(n==null?void 0:n.roles.map(S=>S.role))??[];return p.jsx(og.Provider,{value:{user:n,isAuthenticated:!!n,isSuperAdmin:d,login:f,logout:h,hasRole:g,hasRoleType:y,userRoleNames:A},children:r})}function Ai(){const r=C.useContext(og);if(!r)throw new Error("useAuth must be used within AuthProvider");return r}const tn=new Uint8Array(0),Oi=new TextEncoder,Wt=new TextDecoder;function Zx(...r){let n=0;for(let c=0;c<r.length;c++)n+=r[c].length;const s=new Uint8Array(n);let a=0;for(let c=0;c<r.length;c++)s.set(r[c],a),a+=r[c].length;return s}function Ca(...r){const n=[];for(let s=0;s<r.length;s++)n.push(Oi.encode(r[s]));return n.length===0?tn:n.length===1?n[0]:Zx(...n)}function t0(r){return!r||r.length===0?"":Wt.decode(r)}const n0="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",s0=36,Wx=0xcfd41b9100000,i0=33,ev=333,r0=22;function tv(r){for(let n=0;n<r.length;n++)r[n]=Math.floor(Math.random()*255)}function nv(r){var n;(n=globalThis==null?void 0:globalThis.crypto)!=null&&n.getRandomValues?globalThis.crypto.getRandomValues(r):tv(r)}class sv{constructor(){v(this,"buf");v(this,"seq");v(this,"inc");v(this,"inited");this.buf=new Uint8Array(r0),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(Math.random()*Wx),this.inc=Math.floor(Math.random()*(ev-i0)+i0)}setPre(){const n=new Uint8Array(12);nv(n);for(let s=0;s<12;s++){const a=n[s]%36;this.buf[s]=n0.charCodeAt(a)}}fillSeq(){let n=this.seq;for(let s=r0-1;s>=12;s--)this.buf[s]=n0.charCodeAt(n%s0),n=Math.floor(n/s0)}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 Is=new sv;var ls;(function(r){r.Disconnect="disconnect",r.Reconnect="reconnect",r.Update="update",r.LDM="ldm",r.Error="error"})(ls||(ls={}));var yr;(function(r){r.Reconnecting="reconnecting",r.PingTimer="pingTimer",r.StaleConnection="staleConnection",r.ClientInitiatedReconnect="client initiated reconnect"})(yr||(yr={}));var se;(function(r){r.ApiError="BAD API",r.BadAuthentication="BAD_AUTHENTICATION",r.BadCreds="BAD_CREDS",r.BadHeader="BAD_HEADER",r.BadJson="BAD_JSON",r.BadPayload="BAD_PAYLOAD",r.BadSubject="BAD_SUBJECT",r.Cancelled="CANCELLED",r.ConnectionClosed="CONNECTION_CLOSED",r.ConnectionDraining="CONNECTION_DRAINING",r.ConnectionRefused="CONNECTION_REFUSED",r.ConnectionTimeout="CONNECTION_TIMEOUT",r.Disconnect="DISCONNECT",r.InvalidOption="INVALID_OPTION",r.InvalidPayload="INVALID_PAYLOAD",r.MaxPayloadExceeded="MAX_PAYLOAD_EXCEEDED",r.NoResponders="503",r.NotFunction="NOT_FUNC",r.RequestError="REQUEST_ERROR",r.ServerOptionNotAvailable="SERVER_OPT_NA",r.SubClosed="SUB_CLOSED",r.SubDraining="SUB_DRAINING",r.Timeout="TIMEOUT",r.Tls="TLS",r.Unknown="UNKNOWN_ERROR",r.WssRequired="WSS_REQUIRED",r.JetStreamInvalidAck="JESTREAM_INVALID_ACK",r.JetStream404NoMessages="404",r.JetStream408RequestTimeout="408",r.JetStream409MaxAckPendingExceeded="409",r.JetStream409="409",r.JetStreamNotEnabled="503",r.JetStreamIdleHeartBeat="IDLE_HEARTBEAT",r.AuthorizationViolation="AUTHORIZATION_VIOLATION",r.AuthenticationExpired="AUTHENTICATION_EXPIRED",r.ProtocolError="NATS_PROTOCOL_ERR",r.PermissionsViolation="PERMISSIONS_VIOLATION",r.AuthenticationTimeout="AUTHENTICATION_TIMEOUT",r.AccountExpired="ACCOUNT_EXPIRED"})(se||(se={}));function iv(r){return typeof r.code=="string"}class ug{constructor(){v(this,"messages");this.messages=new Map,this.messages.set(se.InvalidPayload,"Invalid payload type - payloads can be 'binary', 'string', or 'json'"),this.messages.set(se.BadJson,"Bad JSON"),this.messages.set(se.WssRequired,"TLS is required, therefore a secure websocket connection is also required")}static getMessage(n){return rv.getMessage(n)}getMessage(n){return this.messages.get(n)||n}}const rv=new ug;class oe extends Error{constructor(s,a,c){super(s);v(this,"name");v(this,"message");v(this,"code");v(this,"permissionContext");v(this,"chainedError");v(this,"api_error");this.name="NatsError",this.message=s,this.code=a,this.chainedError=c}static errorForCode(s,a){const c=ug.getMessage(s);return new oe(c,s,a)}isAuthError(){return this.code===se.AuthenticationExpired||this.code===se.AuthorizationViolation||this.code===se.AccountExpired}isAuthTimeout(){return this.code===se.AuthenticationTimeout}isPermissionError(){return this.code===se.PermissionsViolation}isProtocolError(){return this.code===se.ProtocolError}isJetStreamError(){return this.api_error!==void 0}jsError(){return this.api_error?this.api_error:null}}var Kt;(function(r){r[r.Exact=0]="Exact",r[r.CanonicalMIME=1]="CanonicalMIME",r[r.IgnoreCase=2]="IgnoreCase"})(Kt||(Kt={}));var jn;(function(r){r.Timer="timer",r.Count="count",r.JitterTimer="jitterTimer",r.SentinelMsg="sentinelMsg"})(jn||(jn={}));var ka;(function(r){r.STATS="io.nats.micro.v1.stats_response",r.INFO="io.nats.micro.v1.info_response",r.PING="io.nats.micro.v1.ping_response"})(ka||(ka={}));const Oc="Nats-Service-Error",jc="Nats-Service-Error-Code";class Tc extends Error{constructor(s,a){super(a);v(this,"code");this.code=s}static isServiceError(s){return Tc.toServiceError(s)!==null}static toServiceError(s){var c,f;const a=((c=s==null?void 0:s.headers)==null?void 0:c.get(jc))||"";if(a!==""){const h=parseInt(a)||400,d=((f=s==null?void 0:s.headers)==null?void 0:f.get(Oc))||"";return new Tc(h,d.length?d:a)}return null}}function cs(r=""){if(r=r||"_INBOX",typeof r!="string")throw new Error("prefix must be a string");return r.split(".").forEach(n=>{if(n==="*"||n===">")throw new Error(`inbox prefixes cannot have wildcards '${r}'`)}),`${r}.${Is.next()}`}const _f="127.0.0.1";var Fs;(function(r){r.PING="PING",r.STATS="STATS",r.INFO="INFO"})(Fs||(Fs={}));function Uc(r,...n){for(let s=0;s<n.length;s++){const a=n[s];Object.keys(a).forEach(function(c){r[c]=a[c]})}return r}function uc(r){return Wt.decode(r).replace(/\n/g,"␊").replace(/\r/g,"␍")}function wr(r,n=!0){const s=n?oe.errorForCode(se.Timeout):null;let a,c;const f=new Promise((h,d)=>{a={cancel:()=>{c&&clearTimeout(c)}},c=setTimeout(()=>{d(s===null?oe.errorForCode(se.Timeout):s)},r)});return Object.assign(f,a)}function Ar(r=0){let n;const s=new Promise(a=>{const c=setTimeout(()=>{a()},r);n={cancel:()=>{c&&clearTimeout(c)}}});return Object.assign(s,n)}function st(){let r={};const n=new Promise((s,a)=>{r={resolve:s,reject:a}});return Object.assign(n,r)}function fg(r){for(let n=r.length-1;n>0;n--){const s=Math.floor(Math.random()*(n+1));[r[n],r[s]]=[r[s],r[n]]}return r}function av(r){return r===0?0:Math.floor(r/2+Math.random()*r)}function Ff(r=[0,250,250,500,500,3e3,5e3]){Array.isArray(r)||(r=[0,250,250,500,500,3e3,5e3]);const n=r.length-1;return{backoff(s){return av(s>n?r[n]:r[s])}}}function nt(r){return r*1e6}function Jf(r){return Math.floor(r/1e6)}function a0(r){let a=!0;const c=new Array(r.length);for(let f=0;f<r.length;f++){let h=r.charCodeAt(f);if(h===58||h<33||h>126)throw new oe(`'${r[f]}' is not a valid character for a header key`,se.BadHeader);a&&97<=h&&h<=122?h-=32:!a&&65<=h&&h<=90&&(h+=32),c[f]=h,a=h==45}return String.fromCharCode(...c)}function os(r=0,n=""){if(r===0&&n!==""||r>0&&n==="")throw new Error("setting status requires both code and description");return new Js(r,n)}const lf="NATS/1.0";class Js{constructor(n=0,s=""){v(this,"_code");v(this,"headers");v(this,"_description");this._code=n,this._description=s,this.headers=new Map}[Symbol.iterator](){return this.headers.entries()}size(){return this.headers.size}equals(n){if(n&&this.headers.size===n.headers.size&&this._code===n._code){for(const[s,a]of this.headers){const c=n.values(s);if(a.length!==c.length)return!1;const f=[...a].sort(),h=[...c].sort();for(let d=0;d<f.length;d++)if(f[d]!==h[d])return!1}return!0}return!1}static decode(n){const s=new Js,c=Wt.decode(n).split(`\r
27
+ `),f=c[0];if(f!==lf){let h=f.replace(lf,"").trim();if(h.length>0){s._code=parseInt(h,10),isNaN(s._code)&&(s._code=0);const d=s._code.toString();h=h.replace(d,""),s._description=h.trim()}}return c.length>=1&&c.slice(1).map(h=>{if(h){const d=h.indexOf(":");if(d>-1){const g=h.slice(0,d),y=h.slice(d+1).trim();s.append(g,y)}}}),s}toString(){if(this.headers.size===0&&this._code===0)return"";let n=lf;this._code>0&&this._description!==""&&(n+=` ${this._code} ${this._description}`);for(const[s,a]of this.headers)for(let c=0;c<a.length;c++)n=`${n}\r
28
+ ${s}: ${a[c]}`;return`${n}\r
29
+ \r
30
+ `}encode(){return Oi.encode(this.toString())}static validHeaderValue(n){if(/[\r\n]/.test(n))throw new oe("invalid header value - \\r and \\n are not allowed.",se.BadHeader);return n.trim()}keys(){const n=[];for(const s of this.headers.keys())n.push(s);return n}findKeys(n,s=Kt.Exact){const a=this.keys();switch(s){case Kt.Exact:return a.filter(c=>c===n);case Kt.CanonicalMIME:return n=a0(n),a.filter(c=>c===n);default:{const c=n.toLowerCase();return a.filter(f=>c===f.toLowerCase())}}}get(n,s=Kt.Exact){const a=this.findKeys(n,s);if(a.length){const c=this.headers.get(a[0]);if(c)return Array.isArray(c)?c[0]:c}return""}last(n,s=Kt.Exact){const a=this.findKeys(n,s);if(a.length){const c=this.headers.get(a[0]);if(c)return Array.isArray(c)?c[c.length-1]:c}return""}has(n,s=Kt.Exact){return this.findKeys(n,s).length>0}set(n,s,a=Kt.Exact){this.delete(n,a),this.append(n,s,a)}append(n,s,a=Kt.Exact){const c=a0(n);a===Kt.CanonicalMIME&&(n=c);const f=this.findKeys(n,a);n=f.length>0?f[0]:n;const h=Js.validHeaderValue(s);let d=this.headers.get(n);d||(d=[],this.headers.set(n,d)),d.push(h)}values(n,s=Kt.Exact){const a=[];return this.findKeys(n,s).forEach(f=>{const h=this.headers.get(f);h&&a.push(...h)}),a}delete(n,s=Kt.Exact){this.findKeys(n,s).forEach(c=>{this.headers.delete(c)})}get hasError(){return this._code>=300}get status(){return`${this._code} ${this._description}`.trim()}toRecord(){const n={};return this.keys().forEach(s=>{n[s]=this.values(s)}),n}get code(){return this._code}get description(){return this._description}static fromRecord(n){const s=new Js;for(const a in n)s.headers.set(a,n[a]);return s}}function wf(){return{encode(r){return Oi.encode(r)},decode(r){return Wt.decode(r)}}}function Tn(r){return{encode(n){try{return n===void 0&&(n=null),Oi.encode(JSON.stringify(n))}catch(s){throw oe.errorForCode(se.BadJson,s)}},decode(n){try{return JSON.parse(Wt.decode(n),r)}catch(s){throw oe.errorForCode(se.BadJson,s)}}}}function hg(r){var n;return r&&r.data.length===0&&((n=r.headers)==null?void 0:n.code)===503?oe.errorForCode(se.NoResponders):null}class Qf{constructor(n,s,a){v(this,"_headers");v(this,"_msg");v(this,"_rdata");v(this,"_reply");v(this,"_subject");v(this,"publisher");this._msg=n,this._rdata=s,this.publisher=a}get subject(){return this._subject?this._subject:(this._subject=Wt.decode(this._msg.subject),this._subject)}get reply(){return this._reply?this._reply:(this._reply=Wt.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=Js.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=tn,s){return this.reply?(this.publisher.publish(this.reply,n,s),!0):!1}size(){var c;const n=this._msg.subject.length,s=((c=this._msg.reply)==null?void 0:c.length)||0,a=this._msg.size===-1?0:this._msg.size;return n+s+a}json(n){return Tn(n).decode(this.data)}string(){return Wt.decode(this.data)}requestInfo(){var s;const n=(s=this.headers)==null?void 0:s.get("Nats-Request-Info");return n?JSON.parse(n,function(a,c){return(a==="start"||a==="stop")&&c!==""?new Date(Date.parse(c)):c}):null}}v(Qf,"jc");function br(r){return Bc("durable",r)}function Mt(r){return Bc("stream",r)}function Bc(r,n=""){if(n==="")throw Error(`${r} name required`);return[".","*",">","/","\\"," "," ",`
31
+ `,"\r"].forEach(a=>{if(n.indexOf(a)!==-1){switch(a){case`
32
+ `:a="\\n";break;case"\r":a="\\r";break;case" ":a="\\t";break}throw Error(`invalid ${r} name - ${r} name cannot contain '${a}'`)}}),""}function ja(r,n=""){if(n==="")throw Error(`${r} name required`);const s=lv(n);if(s.length)throw new Error(`invalid ${r} name - ${r} name ${s}`)}function lv(r=""){if(r==="")throw Error("name required");const n=/^[-\w]+$/g;if(r.match(n)===null){for(const a of r.split(""))if(a.match(n)===null)return`cannot contain '${a}'`}return""}function Sf(r){if(r.data.length>0)return!1;const n=r.headers;return n?n.code>=100&&n.code<200:!1}function Ef(r){var n;return Sf(r)&&((n=r.headers)==null?void 0:n.description)==="Idle Heartbeat"}function cv(r,n,s){const a=os(r,n),c={hdr:1,sid:0,size:0},f=new Qf(c,tn,{});return f._headers=a,f._subject=s,f}function xr(r){if(r.data.length!==0)return null;const n=r.headers;return n?dg(n.code,n.description):null}var yn;(function(r){r.MaxBatchExceeded="exceeded maxrequestbatch of",r.MaxExpiresExceeded="exceeded maxrequestexpires of",r.MaxBytesExceeded="exceeded maxrequestmaxbytes of",r.MaxMessageSizeExceeded="message size exceeds maxbytes",r.PushConsumer="consumer is push based",r.MaxWaitingExceeded="exceeded maxwaiting",r.IdleHeartbeatMissed="idle heartbeats missed",r.ConsumerDeleted="consumer deleted"})(yn||(yn={}));function ov(r){return r.code!==se.JetStream409?!1:[yn.MaxBatchExceeded,yn.MaxExpiresExceeded,yn.MaxBytesExceeded,yn.MaxMessageSizeExceeded,yn.PushConsumer,yn.IdleHeartbeatMissed,yn.ConsumerDeleted].find(s=>r.message.indexOf(s)!==-1)!==void 0}function dg(r,n=""){if(r<300)return null;switch(n=n.toLowerCase(),r){case 404:return new oe(n,se.JetStream404NoMessages);case 408:return new oe(n,se.JetStream408RequestTimeout);case 409:{const s=n.startsWith(yn.IdleHeartbeatMissed)?se.JetStreamIdleHeartBeat:se.JetStream409;return new oe(n,s)}case 503:return oe.errorForCode(se.JetStreamNotEnabled,new Error(n));default:return n===""&&(n=se.Unknown),new oe(n,`${r}`)}}class _t{constructor(){v(this,"inflight");v(this,"processed");v(this,"received");v(this,"noIterator");v(this,"iterClosed");v(this,"done");v(this,"signal");v(this,"yields");v(this,"filtered");v(this,"pendingFiltered");v(this,"ingestionFilterFn");v(this,"protocolFilterFn");v(this,"dispatchedFn");v(this,"ctx");v(this,"_data");v(this,"err");v(this,"time");v(this,"yielding");this.inflight=0,this.filtered=0,this.pendingFiltered=0,this.processed=0,this.received=0,this.noIterator=!1,this.done=!1,this.signal=st(),this.yields=[],this.iterClosed=st(),this.time=0,this.yielding=!1}[Symbol.asyncIterator](){return this.iterate()}push(n){if(this.done)return;if(typeof n=="function"){this.yields.push(n),this.signal.resolve();return}const{ingest:s,protocol:a}=this.ingestionFilterFn?this.ingestionFilterFn(n,this.ctx||this):{ingest:!0,protocol:!1};s&&(a&&(this.filtered++,this.pendingFiltered++),this.yields.push(n),this.signal.resolve())}async*iterate(){if(this.noIterator)throw new oe("unsupported iterator",se.ApiError);if(this.yielding)throw new oe("already yielding",se.ApiError);this.yielding=!0;try{for(;;){if(this.yields.length===0&&await this.signal,this.err)throw this.err;const n=this.yields;this.inflight=n.length,this.yields=[];for(let s=0;s<n.length;s++){if(typeof n[s]=="function"){const c=n[s];try{c()}catch(f){throw f}if(this.err)throw this.err;continue}if(this.protocolFilterFn?this.protocolFilterFn(n[s]):!0){this.processed++;const c=Date.now();yield n[s],this.time=Date.now()-c,this.dispatchedFn&&n[s]&&this.dispatchedFn(n[s])}else this.pendingFiltered--;this.inflight--}if(this.done)break;this.yields.length===0&&(n.length=0,this.yields=n,this.signal=st())}}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 Xf{constructor(n,s,a={maxOut:2}){v(this,"interval");v(this,"maxOut");v(this,"cancelAfter");v(this,"timer");v(this,"autoCancelTimer");v(this,"last");v(this,"missed");v(this,"count");v(this,"callback");this.interval=n,this.maxOut=(a==null?void 0:a.maxOut)||2,this.cancelAfter=(a==null?void 0:a.cancelAfter)||0,this.last=Date.now(),this.missed=0,this.count=0,this.callback=s,this._schedule()}cancel(){this.autoCancelTimer&&clearTimeout(this.autoCancelTimer),this.timer&&clearInterval(this.timer),this.timer=0,this.autoCancelTimer=0,this.missed=0}work(){this.last=Date.now(),this.missed=0}_change(n,s=0,a=2){this.interval=n,this.maxOut=a,this.cancelAfter=s,this.restart()}restart(){this.cancel(),this._schedule()}_schedule(){this.cancelAfter>0&&(this.autoCancelTimer=setTimeout(()=>{this.cancel()},this.cancelAfter)),this.timer=setInterval(()=>{if(this.count++,Date.now()-this.last>this.interval&&this.missed++,this.missed>=this.maxOut)try{this.callback(this.missed)===!0&&this.cancel()}catch(n){console.log(n)}},this.interval)}}var Af;(function(r){r.Limits="limits",r.Interest="interest",r.Workqueue="workqueue"})(Af||(Af={}));var za;(function(r){r.Old="old",r.New="new"})(za||(za={}));var Of;(function(r){r.File="file",r.Memory="memory"})(Of||(Of={}));var ft;(function(r){r.All="all",r.Last="last",r.New="new",r.StartSequence="by_start_sequence",r.StartTime="by_start_time",r.LastPerSubject="last_per_subject"})(ft||(ft={}));var vt;(function(r){r.None="none",r.All="all",r.Explicit="explicit",r.NotSet=""})(vt||(vt={}));var Sr;(function(r){r.Instant="instant",r.Original="original"})(Sr||(Sr={}));var Ks;(function(r){r.None="none",r.S2="s2"})(Ks||(Ks={}));var Nc;(function(r){r.CreateOrUpdate="",r.Update="update",r.Create="create"})(Nc||(Nc={}));function uv(r,n={}){return Object.assign({name:r,deliver_policy:ft.All,ack_policy:vt.Explicit,ack_wait:nt(30*1e3),replay_policy:Sr.Instant},n)}var l0;(function(r){r.API="api_audit",r.StreamAction="stream_action",r.ConsumerAction="consumer_action",r.SnapshotCreate="snapshot_create",r.SnapshotComplete="snapshot_complete",r.RestoreCreate="restore_create",r.RestoreComplete="restore_complete",r.MaxDeliver="max_deliver",r.Terminated="terminated",r.Ack="consumer_ack",r.StreamLeaderElected="stream_leader_elected",r.StreamQuorumLost="stream_quorum_lost",r.ConsumerLeaderElected="consumer_leader_elected",r.ConsumerQuorumLost="consumer_quorum_lost"})(l0||(l0={}));var Dt;(function(r){r.StreamSourceHdr="Nats-Stream-Source",r.LastConsumerSeqHdr="Nats-Last-Consumer",r.LastStreamSeqHdr="Nats-Last-Stream",r.ConsumerStalledHdr="Nats-Consumer-Stalled",r.MessageSizeHdr="Nats-Msg-Size",r.RollupHdr="Nats-Rollup",r.RollupValueSubject="sub",r.RollupValueAll="all",r.PendingMessagesHdr="Nats-Pending-Messages",r.PendingBytesHdr="Nats-Pending-Bytes"})(Dt||(Dt={}));var An;(function(r){r.LastValue="",r.AllHistory="history",r.UpdatesOnly="updates"})(An||(An={}));var gr;(function(r){r.Stream="Nats-Stream",r.Sequence="Nats-Sequence",r.TimeStamp="Nats-Time-Stamp",r.Subject="Nats-Subject"})(gr||(gr={}));var c0;(function(r){r.Stream="Nats-Stream",r.Subject="Nats-Subject",r.Sequence="Nats-Sequence",r.LastSequence="Nats-Last-Sequence",r.Size="Nats-Msg-Size"})(c0||(c0={}));const Zt="KV_";class fv{constructor(n){v(this,"config");v(this,"ordered");v(this,"mack");v(this,"stream");v(this,"callbackFn");v(this,"max");v(this,"qname");v(this,"isBind");v(this,"filters");this.stream="",this.mack=!1,this.ordered=!1,this.config=uv("",n||{})}getOpts(){var s;const n={};if(n.config=Object.assign({},this.config),n.config.filter_subject&&(this.filterSubject(n.config.filter_subject),n.config.filter_subject=void 0),n.config.filter_subjects&&((s=n.config.filter_subjects)==null||s.forEach(a=>{this.filterSubject(a)}),n.config.filter_subjects=void 0),n.mack=this.mack,n.stream=this.stream,n.callbackFn=this.callbackFn,n.max=this.max,n.queue=this.qname,n.ordered=this.ordered,n.config.ack_policy=n.ordered?vt.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 br(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=ft.StartSequence,this.config.opt_start_seq=n,this}startTime(n){return this.config.deliver_policy=ft.StartTime,this.config.opt_start_time=n.toISOString(),this}deliverAll(){return this.config.deliver_policy=ft.All,this}deliverLastPerSubject(){return this.config.deliver_policy=ft.LastPerSubject,this}deliverLast(){return this.config.deliver_policy=ft.Last,this}deliverNew(){return this.config.deliver_policy=ft.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=vt.None,this}ackAll(){return this.config.ack_policy=vt.All,this}ackExplicit(){return this.config.ack_policy=vt.Explicit,this}ackWait(n){return this.config.ack_wait=nt(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=Sr.Instant,this}replayOriginal(){return this.config.replay_policy=Sr.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=nt(n),this}flowControl(){return this.config.flow_control=!0,this}deliverGroup(n){return this.queue(n),this}manualAck(){return this.mack=!0,this}maxMessages(n){return this.max=n,this}callback(n){return this.callbackFn=n,this}queue(n){return this.qname=n,this.config.deliver_group=n,this}orderedConsumer(){return this.ordered=!0,this}bind(n,s){return this.stream=n,this.config.durable_name=s,this.isBind=!0,this}bindStream(n){return this.stream=n,this}inactiveEphemeralThreshold(n){return this.config.inactive_threshold=nt(n),this}maxPullBatch(n){return this.config.max_batch=n,this}maxPullRequestExpires(n){return this.config.max_expires=nt(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 Qs(r){return new fv(r)}function o0(r){return typeof r.getOpts=="function"}class hv{static encode(n){if(typeof n=="string")return btoa(n);const s=Array.from(n);return btoa(String.fromCharCode(...s))}static decode(n,s=!1){const a=atob(n);return s?Uint8Array.from(a,c=>c.charCodeAt(0)):a}}class vr{static encode(n){return vr.toB64URLEncoding(hv.encode(n))}static decode(n,s=!1){return vr.decode(vr.fromB64URLEncoding(n),s)}static toB64URLEncoding(n){return n.replace(/\+/g,"-").replace(/\//g,"_")}static fromB64URLEncoding(n){return n.replace(/_/g,"/").replace(/-/g,"+")}}class Er{constructor(){v(this,"buffers");v(this,"byteLength");this.buffers=[],this.byteLength=0}static concat(...n){let s=0;for(let f=0;f<n.length;f++)s+=n[f].length;const a=new Uint8Array(s);let c=0;for(let f=0;f<n.length;f++)a.set(n[f],c),c+=n[f].length;return a}static fromAscii(n){return n||(n=""),Oi.encode(n)}static toAscii(n){return Wt.decode(n)}reset(){this.buffers.length=0,this.byteLength=0}pack(){if(this.buffers.length>1){const n=new Uint8Array(this.byteLength);let s=0;for(let a=0;a<this.buffers.length;a++)n.set(this.buffers[a],s),s+=this.buffers[a].length;this.buffers.length=0,this.buffers.push(n)}}shift(){if(this.buffers.length){const n=this.buffers.shift();if(n)return this.byteLength-=n.length,n}return new Uint8Array(0)}drain(n){if(this.buffers.length){this.pack();const s=this.buffers.pop();if(s){const a=this.byteLength;(n===void 0||n>a)&&(n=a);const c=s.subarray(0,n);return a>n&&this.buffers.push(s.subarray(n)),this.byteLength=a-n,c}}return new Uint8Array(0)}fill(n,...s){n&&(this.buffers.push(n),this.byteLength+=n.length);for(let a=0;a<s.length;a++)s[a]&&s[a].length&&(this.buffers.push(s[a]),this.byteLength+=s[a].length)}peek(){return this.buffers.length?(this.pack(),this.buffers[0]):new Uint8Array(0)}size(){return this.byteLength}length(){return this.buffers.length}}function dv(r,n){return n.forEach(function(s){s&&typeof s!="string"&&!Array.isArray(s)&&Object.keys(s).forEach(function(a){if(a!=="default"&&!(a in r)){var c=Object.getOwnPropertyDescriptor(s,a);Object.defineProperty(r,a,c.get?c:{enumerable:!0,get:function(){return s[a]}})}})}),Object.freeze(r)}var mv=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},wa=mv.performance||{};wa.now||wa.mozNow||wa.msNow||wa.oNow||wa.webkitNow;var u0={versions:{}},pv=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function gv(r){if(r.__esModule)return r;var n=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(r).forEach(function(s){var a=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(n,s,a.get?a:{enumerable:!0,get:function(){return r[s]}})}),n}var cf,Lc={exports:{}},f0={},h0=gv(dv({__proto__:null,default:f0},[f0]));cf=Lc,(function(){var r="input is invalid type",n=typeof window=="object",s=n?window:{};s.JS_SHA256_NO_WINDOW&&(n=!1);var a=!n&&typeof self=="object",c=!s.JS_SHA256_NO_NODE_JS&&u0.versions&&u0.versions.node;c?s=pv:a&&(s=self);var f=!s.JS_SHA256_NO_COMMON_JS&&cf.exports,h=!s.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",d="0123456789abcdef".split(""),g=[-2147483648,8388608,32768,128],y=[24,16,8,0],A=[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],S=["hex","array","digest","arrayBuffer"],j=[];!s.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(k){return Object.prototype.toString.call(k)==="[object Array]"}),!h||!s.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(k){return typeof k=="object"&&k.buffer&&k.buffer.constructor===ArrayBuffer});var z=function(k,I){return function(ie){return new W(I,!0).update(ie)[k]()}},R=function(k){var I=z("hex",k);c&&(I=H(I,k)),I.create=function(){return new W(k)},I.update=function(Q){return I.create().update(Q)};for(var ie=0;ie<S.length;++ie){var Z=S[ie];I[Z]=z(Z,k)}return I},H=function(k,I){var ie,Z=h0,Q=h0.Buffer,K=I?"sha224":"sha256";return ie=Q.from&&!s.JS_SHA256_NO_BUFFER_FROM?Q.from:function(ae){return new Q(ae)},function(ae){if(typeof ae=="string")return Z.createHash(K).update(ae,"utf8").digest("hex");if(ae==null)throw new Error(r);return ae.constructor===ArrayBuffer&&(ae=new Uint8Array(ae)),Array.isArray(ae)||ArrayBuffer.isView(ae)||ae.constructor===Q?Z.createHash(K).update(ie(ae)).digest("hex"):k(ae)}},ee=function(k,I){return function(ie,Z){return new me(ie,I,!0).update(Z)[k]()}},ne=function(k){var I=ee("hex",k);I.create=function(Q){return new me(Q,k)},I.update=function(Q,K){return I.create(Q).update(K)};for(var ie=0;ie<S.length;++ie){var Z=S[ie];I[Z]=ee(Z,k)}return I};function W(k,I){I?(j[0]=j[16]=j[1]=j[2]=j[3]=j[4]=j[5]=j[6]=j[7]=j[8]=j[9]=j[10]=j[11]=j[12]=j[13]=j[14]=j[15]=0,this.blocks=j):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],k?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=k}function me(k,I,ie){var Z,Q=typeof k;if(Q==="string"){var K,ae=[],re=k.length,qe=0;for(Z=0;Z<re;++Z)(K=k.charCodeAt(Z))<128?ae[qe++]=K:K<2048?(ae[qe++]=192|K>>>6,ae[qe++]=128|63&K):K<55296||K>=57344?(ae[qe++]=224|K>>>12,ae[qe++]=128|K>>>6&63,ae[qe++]=128|63&K):(K=65536+((1023&K)<<10|1023&k.charCodeAt(++Z)),ae[qe++]=240|K>>>18,ae[qe++]=128|K>>>12&63,ae[qe++]=128|K>>>6&63,ae[qe++]=128|63&K);k=ae}else{if(Q!=="object")throw new Error(r);if(k===null)throw new Error(r);if(h&&k.constructor===ArrayBuffer)k=new Uint8Array(k);else if(!(Array.isArray(k)||h&&ArrayBuffer.isView(k)))throw new Error(r)}k.length>64&&(k=new W(I,!0).update(k).array());var Ge=[],Le=[];for(Z=0;Z<64;++Z){var $=k[Z]||0;Ge[Z]=92^$,Le[Z]=54^$}W.call(this,I,ie),this.update(Le),this.oKeyPad=Ge,this.inner=!0,this.sharedMemory=ie}W.prototype.update=function(k){if(!this.finalized){var I,ie=typeof k;if(ie!=="string"){if(ie!=="object")throw new Error(r);if(k===null)throw new Error(r);if(h&&k.constructor===ArrayBuffer)k=new Uint8Array(k);else if(!(Array.isArray(k)||h&&ArrayBuffer.isView(k)))throw new Error(r);I=!0}for(var Z,Q,K=0,ae=k.length,re=this.blocks;K<ae;){if(this.hashed&&(this.hashed=!1,re[0]=this.block,this.block=re[16]=re[1]=re[2]=re[3]=re[4]=re[5]=re[6]=re[7]=re[8]=re[9]=re[10]=re[11]=re[12]=re[13]=re[14]=re[15]=0),I)for(Q=this.start;K<ae&&Q<64;++K)re[Q>>>2]|=k[K]<<y[3&Q++];else for(Q=this.start;K<ae&&Q<64;++K)(Z=k.charCodeAt(K))<128?re[Q>>>2]|=Z<<y[3&Q++]:Z<2048?(re[Q>>>2]|=(192|Z>>>6)<<y[3&Q++],re[Q>>>2]|=(128|63&Z)<<y[3&Q++]):Z<55296||Z>=57344?(re[Q>>>2]|=(224|Z>>>12)<<y[3&Q++],re[Q>>>2]|=(128|Z>>>6&63)<<y[3&Q++],re[Q>>>2]|=(128|63&Z)<<y[3&Q++]):(Z=65536+((1023&Z)<<10|1023&k.charCodeAt(++K)),re[Q>>>2]|=(240|Z>>>18)<<y[3&Q++],re[Q>>>2]|=(128|Z>>>12&63)<<y[3&Q++],re[Q>>>2]|=(128|Z>>>6&63)<<y[3&Q++],re[Q>>>2]|=(128|63&Z)<<y[3&Q++]);this.lastByteIndex=Q,this.bytes+=Q-this.start,Q>=64?(this.block=re[16],this.start=Q-64,this.hash(),this.hashed=!0):this.start=Q}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},W.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var k=this.blocks,I=this.lastByteIndex;k[16]=this.block,k[I>>>2]|=g[3&I],this.block=k[16],I>=56&&(this.hashed||this.hash(),k[0]=this.block,k[16]=k[1]=k[2]=k[3]=k[4]=k[5]=k[6]=k[7]=k[8]=k[9]=k[10]=k[11]=k[12]=k[13]=k[14]=k[15]=0),k[14]=this.hBytes<<3|this.bytes>>>29,k[15]=this.bytes<<3,this.hash()}},W.prototype.hash=function(){var k,I,ie,Z,Q,K,ae,re,qe,Ge=this.h0,Le=this.h1,$=this.h2,te=this.h3,he=this.h4,xe=this.h5,ye=this.h6,Ae=this.h7,ve=this.blocks;for(k=16;k<64;++k)I=((Q=ve[k-15])>>>7|Q<<25)^(Q>>>18|Q<<14)^Q>>>3,ie=((Q=ve[k-2])>>>17|Q<<15)^(Q>>>19|Q<<13)^Q>>>10,ve[k]=ve[k-16]+I+ve[k-7]+ie|0;for(qe=Le&$,k=0;k<64;k+=4)this.first?(this.is224?(K=300032,Ae=(Q=ve[0]-1413257819)-150054599|0,te=Q+24177077|0):(K=704751109,Ae=(Q=ve[0]-210244248)-1521486534|0,te=Q+143694565|0),this.first=!1):(I=(Ge>>>2|Ge<<30)^(Ge>>>13|Ge<<19)^(Ge>>>22|Ge<<10),Z=(K=Ge&Le)^Ge&$^qe,Ae=te+(Q=Ae+(ie=(he>>>6|he<<26)^(he>>>11|he<<21)^(he>>>25|he<<7))+(he&xe^~he&ye)+A[k]+ve[k])|0,te=Q+(I+Z)|0),I=(te>>>2|te<<30)^(te>>>13|te<<19)^(te>>>22|te<<10),Z=(ae=te&Ge)^te&Le^K,ye=$+(Q=ye+(ie=(Ae>>>6|Ae<<26)^(Ae>>>11|Ae<<21)^(Ae>>>25|Ae<<7))+(Ae&he^~Ae&xe)+A[k+1]+ve[k+1])|0,I=(($=Q+(I+Z)|0)>>>2|$<<30)^($>>>13|$<<19)^($>>>22|$<<10),Z=(re=$&te)^$&Ge^ae,xe=Le+(Q=xe+(ie=(ye>>>6|ye<<26)^(ye>>>11|ye<<21)^(ye>>>25|ye<<7))+(ye&Ae^~ye&he)+A[k+2]+ve[k+2])|0,I=((Le=Q+(I+Z)|0)>>>2|Le<<30)^(Le>>>13|Le<<19)^(Le>>>22|Le<<10),Z=(qe=Le&$)^Le&te^re,he=Ge+(Q=he+(ie=(xe>>>6|xe<<26)^(xe>>>11|xe<<21)^(xe>>>25|xe<<7))+(xe&ye^~xe&Ae)+A[k+3]+ve[k+3])|0,Ge=Q+(I+Z)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+Ge|0,this.h1=this.h1+Le|0,this.h2=this.h2+$|0,this.h3=this.h3+te|0,this.h4=this.h4+he|0,this.h5=this.h5+xe|0,this.h6=this.h6+ye|0,this.h7=this.h7+Ae|0},W.prototype.hex=function(){this.finalize();var k=this.h0,I=this.h1,ie=this.h2,Z=this.h3,Q=this.h4,K=this.h5,ae=this.h6,re=this.h7,qe=d[k>>>28&15]+d[k>>>24&15]+d[k>>>20&15]+d[k>>>16&15]+d[k>>>12&15]+d[k>>>8&15]+d[k>>>4&15]+d[15&k]+d[I>>>28&15]+d[I>>>24&15]+d[I>>>20&15]+d[I>>>16&15]+d[I>>>12&15]+d[I>>>8&15]+d[I>>>4&15]+d[15&I]+d[ie>>>28&15]+d[ie>>>24&15]+d[ie>>>20&15]+d[ie>>>16&15]+d[ie>>>12&15]+d[ie>>>8&15]+d[ie>>>4&15]+d[15&ie]+d[Z>>>28&15]+d[Z>>>24&15]+d[Z>>>20&15]+d[Z>>>16&15]+d[Z>>>12&15]+d[Z>>>8&15]+d[Z>>>4&15]+d[15&Z]+d[Q>>>28&15]+d[Q>>>24&15]+d[Q>>>20&15]+d[Q>>>16&15]+d[Q>>>12&15]+d[Q>>>8&15]+d[Q>>>4&15]+d[15&Q]+d[K>>>28&15]+d[K>>>24&15]+d[K>>>20&15]+d[K>>>16&15]+d[K>>>12&15]+d[K>>>8&15]+d[K>>>4&15]+d[15&K]+d[ae>>>28&15]+d[ae>>>24&15]+d[ae>>>20&15]+d[ae>>>16&15]+d[ae>>>12&15]+d[ae>>>8&15]+d[ae>>>4&15]+d[15&ae];return this.is224||(qe+=d[re>>>28&15]+d[re>>>24&15]+d[re>>>20&15]+d[re>>>16&15]+d[re>>>12&15]+d[re>>>8&15]+d[re>>>4&15]+d[15&re]),qe},W.prototype.toString=W.prototype.hex,W.prototype.digest=function(){this.finalize();var k=this.h0,I=this.h1,ie=this.h2,Z=this.h3,Q=this.h4,K=this.h5,ae=this.h6,re=this.h7,qe=[k>>>24&255,k>>>16&255,k>>>8&255,255&k,I>>>24&255,I>>>16&255,I>>>8&255,255&I,ie>>>24&255,ie>>>16&255,ie>>>8&255,255&ie,Z>>>24&255,Z>>>16&255,Z>>>8&255,255&Z,Q>>>24&255,Q>>>16&255,Q>>>8&255,255&Q,K>>>24&255,K>>>16&255,K>>>8&255,255&K,ae>>>24&255,ae>>>16&255,ae>>>8&255,255&ae];return this.is224||qe.push(re>>>24&255,re>>>16&255,re>>>8&255,255&re),qe},W.prototype.array=W.prototype.digest,W.prototype.arrayBuffer=function(){this.finalize();var k=new ArrayBuffer(this.is224?28:32),I=new DataView(k);return I.setUint32(0,this.h0),I.setUint32(4,this.h1),I.setUint32(8,this.h2),I.setUint32(12,this.h3),I.setUint32(16,this.h4),I.setUint32(20,this.h5),I.setUint32(24,this.h6),this.is224||I.setUint32(28,this.h7),k},me.prototype=new W,me.prototype.finalize=function(){if(W.prototype.finalize.call(this),this.inner){this.inner=!1;var k=this.array();W.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(k),W.prototype.finalize.call(this)}};var be=R();be.sha256=be,be.sha224=R(!0),be.sha256.hmac=ne(),be.sha224.hmac=ne(!0),f?cf.exports=be:(s.sha256=be.sha256,s.sha224=be.sha224)})();Lc.exports;Lc.exports.sha224;var d0=Lc.exports.sha256;function jf(r){return wv(r)}function yv(r){if(!/^[0-9A-Fa-f]+$/.test(r))return!1;const s=/^[0-9A-F]+$/.test(r),a=/^[0-9a-f]+$/.test(r);return s||a?r.length%2===0:!1}function bv(r){return/^[A-Za-z0-9\-_]*(={0,2})?$/.test(r)||/^[A-Za-z0-9+/]*(={0,2})?$/.test(r)}function xv(r){return yv(r)?"hex":bv(r)?"b64":""}function vv(r){if(r.length%2!==0)throw new Error("hex string must have an even length");const n=new Uint8Array(r.length/2);for(let s=0;s<r.length;s+=2)n[s/2]=parseInt(r.substring(s,s+2),16);return n}function _v(r){r=r.replace(/-/g,"+"),r=r.replace(/_/g,"/");const n=atob(r);return Uint8Array.from(n,s=>s.charCodeAt(0))}function wv(r){switch(xv(r)){case"hex":return vv(r);case"b64":return _v(r)}return null}function Sv(r,n){const s=typeof r=="string"?jf(r):r,a=typeof n=="string"?jf(n):n;if(s===null||a===null||s.length!==a.length)return!1;for(let c=0;c<s.length;c++)if(s[c]!==a[c])return!1;return!0}class mg{constructor(n,s,a=!0){v(this,"token");v(this,"received");v(this,"ctx");v(this,"requestSubject");v(this,"mux");this.mux=n,this.requestSubject=s,this.received=0,this.token=Is.next(),a&&(this.ctx=new Error)}}class Ev extends mg{constructor(s,a,c={maxWait:1e3}){super(s,a);v(this,"callback");v(this,"done");v(this,"timer");v(this,"max");v(this,"opts");if(this.opts=c,typeof this.opts.callback!="function")throw new Error("callback is required");this.callback=this.opts.callback,this.max=typeof c.maxMessages=="number"&&c.maxMessages>0?c.maxMessages:-1,this.done=st(),this.done.then(()=>{this.callback(null,null)}),this.timer=setTimeout(()=>{this.cancel()},c.maxWait)}cancel(s){s&&this.callback(s,null),clearTimeout(this.timer),this.mux.cancel(this),this.done.resolve()}resolver(s,a){s?(this.ctx&&(s.stack+=`
33
+
34
+ ${this.ctx.stack}`),this.cancel(s)):(this.callback(null,a),this.opts.strategy===jn.Count&&(this.max--,this.max===0&&this.cancel()),this.opts.strategy===jn.JitterTimer&&(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.cancel()},this.opts.jitter||300)),this.opts.strategy===jn.SentinelMsg&&a&&a.data.length===0&&this.cancel())}}class pg extends mg{constructor(s,a,c={timeout:1e3},f=!0){super(s,a,f);v(this,"deferred");v(this,"timer");this.deferred=st(),this.timer=wr(c.timeout,f)}resolver(s,a){this.timer&&this.timer.cancel(),s?(this.ctx&&(s.stack+=`
35
+
36
+ ${this.ctx.stack}`),this.deferred.reject(s)):this.deferred.resolve(a),this.cancel()}cancel(s){this.timer&&this.timer.cancel(),this.mux.cancel(this),this.deferred.reject(s||oe.errorForCode(se.Cancelled))}}const Av="$JS.API";function Ov(r){return r=r||{},r.domain&&(r.apiPrefix=`$JS.${r.domain}.API`,delete r.domain),Uc({apiPrefix:Av,timeout:5e3},r)}class Ha{constructor(n,s){v(this,"nc");v(this,"opts");v(this,"prefix");v(this,"timeout");v(this,"jc");this.nc=n,this.opts=Ov(s),this._parseOpts(),this.prefix=this.opts.apiPrefix,this.timeout=this.opts.timeout,this.jc=Tn()}getOptions(){return Object.assign({},this.opts)}_parseOpts(){let n=this.opts.apiPrefix;if(!n||n.length===0)throw new Error("invalid empty prefix");n[n.length-1]==="."&&(n=n.substr(0,n.length-1)),this.opts.apiPrefix=n}async _request(n,s=null,a){a=a||{},a.timeout=this.timeout;let c=tn;s&&(c=this.jc.encode(s));let{retries:f}=a;f=f||1,f=f===-1?Number.MAX_SAFE_INTEGER:f;const h=Ff();for(let d=0;d<f;d++)try{const g=await this.nc.request(n,c,a);return this.parseJsResponse(g)}catch(g){const y=g;if((y.code==="503"||y.code===se.Timeout)&&d+1<f)await Ar(h.backoff(d));else throw g}}async findStream(n){const s={subject:n},c=await this._request(`${this.prefix}.STREAM.NAMES`,s);if(!c.streams||c.streams.length!==1)throw new Error("no stream matches subject");return c.streams[0]}getConnection(){return this.nc}parseJsResponse(n){const s=this.jc.decode(n.data),a=s;if(a.error){const c=dg(a.error.code,a.error.description);if(c!==null)throw c.api_error=a.error,c}return s}}class Ta{constructor(n,s,a,c){v(this,"err");v(this,"offset");v(this,"pageInfo");v(this,"subject");v(this,"jsm");v(this,"filter");v(this,"payload");if(!n)throw new Error("subject is required");this.subject=n,this.jsm=a,this.offset=0,this.pageInfo={},this.filter=s,this.payload=c||{}}async next(){if(this.err)return[];if(this.pageInfo&&this.offset>=this.pageInfo.total)return[];const n={offset:this.offset};this.payload&&Object.assign(n,this.payload);try{const s=await this.jsm._request(this.subject,n,{timeout:this.jsm.timeout});this.pageInfo=s;const a=this.countResponse(s);return a===0?[]:(this.offset+=a,this.filter(s))}catch(s){throw this.err=s,s}}countResponse(n){var s,a,c;switch(n==null?void 0:n.type){case"io.nats.jetstream.api.v1.stream_names_response":case"io.nats.jetstream.api.v1.stream_list_response":return((s=n.streams)==null?void 0:s.length)||0;case"io.nats.jetstream.api.v1.consumer_list_response":return((a=n.consumers)==null?void 0:a.length)||0;default:return console.error(`jslister.ts: unknown API response for paged output: ${n==null?void 0:n.type}`),((c=n.streams)==null?void 0:c.length)||0}return 0}async*[Symbol.asyncIterator](){let n=await this.next();for(;n.length>0;){for(const s of n)yield s;n=await this.next()}}}function Si(r=""){const n=r.match(/(\d+).(\d+).(\d+)/);if(n)return{major:parseInt(n[1]),minor:parseInt(n[2]),micro:parseInt(n[3])};throw new Error(`'${r}' is not a semver value`)}function Tf(r,n){return r.major<n.major?-1:r.major>n.major?1:r.minor<n.minor?-1:r.minor>n.minor?1:r.micro<n.micro?-1:r.micro>n.micro?1:0}var De;(function(r){r.JS_KV="js_kv",r.JS_OBJECTSTORE="js_objectstore",r.JS_PULL_MAX_BYTES="js_pull_max_bytes",r.JS_NEW_CONSUMER_CREATE_API="js_new_consumer_create",r.JS_ALLOW_DIRECT="js_allow_direct",r.JS_MULTIPLE_CONSUMER_FILTER="js_multiple_consumer_filter",r.JS_SIMPLIFICATION="js_simplification",r.JS_STREAM_CONSUMER_METADATA="js_stream_consumer_metadata",r.JS_CONSUMER_FILTER_SUBJECTS="js_consumer_filter_subjects",r.JS_STREAM_FIRST_SEQ="js_stream_first_seq",r.JS_STREAM_SUBJECT_TRANSFORM="js_stream_subject_transform",r.JS_STREAM_SOURCE_SUBJECT_TRANSFORM="js_stream_source_subject_transform",r.JS_STREAM_COMPRESSION="js_stream_compression",r.JS_DEFAULT_CONSUMER_LIMITS="js_default_consumer_limits",r.JS_BATCH_DIRECT_GET="js_batch_direct_get"})(De||(De={}));class jv{constructor(n){v(this,"server");v(this,"features");v(this,"disabled");this.features=new Map,this.disabled=[],this.update(n)}resetDisabled(){this.disabled.length=0,this.update(this.server)}disable(n){this.disabled.push(n),this.update(this.server)}isDisabled(n){return this.disabled.indexOf(n)!==-1}update(n){typeof n=="string"&&(n=Si(n)),this.server=n,this.set(De.JS_KV,"2.6.2"),this.set(De.JS_OBJECTSTORE,"2.6.3"),this.set(De.JS_PULL_MAX_BYTES,"2.8.3"),this.set(De.JS_NEW_CONSUMER_CREATE_API,"2.9.0"),this.set(De.JS_ALLOW_DIRECT,"2.9.0"),this.set(De.JS_MULTIPLE_CONSUMER_FILTER,"2.10.0"),this.set(De.JS_SIMPLIFICATION,"2.9.4"),this.set(De.JS_STREAM_CONSUMER_METADATA,"2.10.0"),this.set(De.JS_CONSUMER_FILTER_SUBJECTS,"2.10.0"),this.set(De.JS_STREAM_FIRST_SEQ,"2.10.0"),this.set(De.JS_STREAM_SUBJECT_TRANSFORM,"2.10.0"),this.set(De.JS_STREAM_SOURCE_SUBJECT_TRANSFORM,"2.10.0"),this.set(De.JS_STREAM_COMPRESSION,"2.10.0"),this.set(De.JS_DEFAULT_CONSUMER_LIMITS,"2.10.0"),this.set(De.JS_BATCH_DIRECT_GET,"2.11.0"),this.disabled.forEach(s=>{this.features.delete(s)})}set(n,s){this.features.set(n,{min:s,ok:Tf(this.server,Si(s))>=0})}get(n){return this.features.get(n)||{min:"unknown",ok:!1}}supports(n){var s;return((s=this.get(n))==null?void 0:s.ok)||!1}require(n){return typeof n=="string"&&(n=Si(n)),Tf(this.server,n)>=0}}class Cc extends Ha{constructor(n,s){super(n,s)}async add(n,s,a=Nc.Create){if(Mt(n),s.deliver_group&&s.flow_control)throw new Error("jetstream flow control is not supported with queue groups");if(s.deliver_group&&s.idle_heartbeat)throw new Error("jetstream idle heartbeat is not supported with queue groups");const c={};c.config=s,c.stream_name=n,c.action=a,c.config.durable_name&&br(c.config.durable_name);const f=this.nc;let{min:h,ok:d}=f.features.get(De.JS_NEW_CONSUMER_CREATE_API);const g=s.name===""?void 0:s.name;if(g&&!d)throw new Error(`consumer 'name' requires server ${h}`);if(g)try{Bc("name",g)}catch(j){const z=j.message,R=z.indexOf("cannot contain");throw R!==-1?new Error(`consumer 'name' ${z.substring(R)}`):j}let y,A="";if(Array.isArray(s.filter_subjects)){const{min:j,ok:z}=f.features.get(De.JS_MULTIPLE_CONSUMER_FILTER);if(!z)throw new Error(`consumer 'filter_subjects' requires server ${j}`);d=!1}if(s.metadata){const{min:j,ok:z}=f.features.get(De.JS_STREAM_CONSUMER_METADATA);if(!z)throw new Error(`consumer 'metadata' requires server ${j}`)}if(d&&(A=s.name??s.durable_name??""),A!==""){let j=s.filter_subject??void 0;j===">"&&(j=void 0),y=j!==void 0?`${this.prefix}.CONSUMER.CREATE.${n}.${A}.${j}`:`${this.prefix}.CONSUMER.CREATE.${n}.${A}`}else y=s.durable_name?`${this.prefix}.CONSUMER.DURABLE.CREATE.${n}.${s.durable_name}`:`${this.prefix}.CONSUMER.CREATE.${n}`;return await this._request(y,c)}async update(n,s,a){const c=await this.info(n,s),f=a;return this.add(n,Object.assign(c.config,f),Nc.Update)}async info(n,s){return Mt(n),br(s),await this._request(`${this.prefix}.CONSUMER.INFO.${n}.${s}`)}async delete(n,s){return Mt(n),br(s),(await this._request(`${this.prefix}.CONSUMER.DELETE.${n}.${s}`)).success}list(n){Mt(n);const s=c=>c.consumers,a=`${this.prefix}.CONSUMER.LIST.${n}`;return new Ta(a,s,this)}pause(n,s,a){const c=`${this.prefix}.CONSUMER.PAUSE.${n}.${s}`,f={pause_until:a.toISOString()};return this._request(c,f)}resume(n,s){return this.pause(n,s,new Date(0))}}function dr(r,n,s=!1){if(s===!0&&!r)throw oe.errorForCode(se.ApiError,new Error(`${n} is not a function`));if(r&&typeof r!="function")throw oe.errorForCode(se.ApiError,new Error(`${n} is not a function`))}class Tv extends _t{constructor(s,a,c){super();v(this,"sub");v(this,"adapter");v(this,"subIterDone");dr(c.adapter,"adapter",!0),this.adapter=c.adapter,c.callback&&dr(c.callback,"callback"),this.noIterator=typeof c.callback=="function",c.ingestionFilterFn&&(dr(c.ingestionFilterFn,"ingestionFilterFn"),this.ingestionFilterFn=c.ingestionFilterFn),c.protocolFilterFn&&(dr(c.protocolFilterFn,"protocolFilterFn"),this.protocolFilterFn=c.protocolFilterFn),c.dispatchedFn&&(dr(c.dispatchedFn,"dispatchedFn"),this.dispatchedFn=c.dispatchedFn),c.cleanupFn&&dr(c.cleanupFn,"cleanupFn");let f=(A,S)=>{this.callback(A,S)};if(c.callback){const A=c.callback;f=(S,j)=>{const[z,R]=this.adapter(S,j);if(z){A(z,null);return}const{ingest:H}=this.ingestionFilterFn?this.ingestionFilterFn(R,this):{ingest:!0};H&&(!this.protocolFilterFn||this.protocolFilterFn(R))&&(A(z,R),this.dispatchedFn&&R&&this.dispatchedFn(R))}}const{max:h,queue:d,timeout:g}=c,y={queue:d,timeout:g,callback:f};h&&h>0&&(y.max=h),this.sub=s.subscribe(a,y),c.cleanupFn&&(this.sub.cleanupFn=c.cleanupFn),this.noIterator||this.iterClosed.then(()=>{this.unsubscribe()}),this.subIterDone=st(),Promise.all([this.sub.closed,this.iterClosed]).then(()=>{this.subIterDone.resolve()}).catch(()=>{this.subIterDone.resolve()}),(async A=>{await A.closed,this.stop()})(this.sub).then().catch()}unsubscribe(s){this.sub.unsubscribe(s)}drain(){return this.sub.drain()}isDraining(){return this.sub.isDraining()}isClosed(){return this.sub.isClosed()}callback(s,a){this.sub.cancelTimeout();const[c,f]=this.adapter(s,a);c&&this.stop(c),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 en;function Nv(r){en=r}function gg(){return en!==void 0&&en.defaultPort!==void 0?en.defaultPort:4222}function of(){return en!==void 0&&en.urlParseFn?en.urlParseFn:void 0}function Cv(){if(!en||typeof en.factory!="function")throw new Error("transport fn is not set");return en.factory()}function Nf(){return en!==void 0&&en.dnsResolveFn?en.dnsResolveFn:void 0}const xc=`\r
37
+ `,kc=Er.fromAscii(xc),kv=new Uint8Array(kc)[0],Mv=new Uint8Array(kc)[1];function Rv(r){for(let n=0;n<r.length;n++){const s=n+1;if(r.byteLength>s&&r[n]===kv&&r[s]===Mv)return s+1}return 0}function Dv(r){const n=Rv(r);if(n>0){const a=new Uint8Array(r).slice(0,n);return Wt.decode(a)}return""}const zv=4,yg=48,qv=65,Uv=97;function Bv(r,n,s,a){const c=new Uint8Array(16);return[0,0,0,0,0,0,0,0,0,0,255,255].forEach((h,d)=>{c[d]=h}),c[12]=r,c[13]=n,c[14]=s,c[15]=a,c}function Cf(r){return Lv(r)!==void 0}function Lv(r){for(let n=0;n<r.length;n++)switch(r[n]){case".":return bg(r);case":":return Hv(r)}}function bg(r){const n=new Uint8Array(4);for(let s=0;s<4;s++){if(r.length===0)return;if(s>0){if(r[0]!==".")return;r=r.substring(1)}const{n:a,c,ok:f}=Pv(r);if(!f||a>255)return;r=r.substring(c),n[s]=a}return Bv(n[0],n[1],n[2],n[3])}function Hv(r){const n=new Uint8Array(16);let s=-1;if(r.length>=2&&r[0]===":"&&r[1]===":"&&(s=0,r=r.substring(2),r.length===0))return n;let a=0;for(;a<16;){const{n:c,c:f,ok:h}=$v(r);if(!h||c>65535)return;if(f<r.length&&r[f]==="."){if(s<0&&a!=12||a+4>16)return;const d=bg(r);if(d===void 0)return;n[a]=d[12],n[a+1]=d[13],n[a+2]=d[14],n[a+3]=d[15],r="",a+=zv;break}if(n[a]=c>>8,n[a+1]=c,a+=2,r=r.substring(f),r.length===0)break;if(r[0]!==":"||r.length==1)return;if(r=r.substring(1),r[0]===":"){if(s>=0)return;if(s=a,r=r.substring(1),r.length===0)break}}if(r.length===0){if(a<16){if(s<0)return;const c=16-a;for(let f=a-1;f>=s;f--)n[f+c]=n[f];for(let f=s+c-1;f>=s;f--)n[f]=0}else if(s>=0)return;return n}}function Pv(r){let n=0,s=0;for(n=0;n<r.length&&48<=r.charCodeAt(n)&&r.charCodeAt(n)<=57;n++)if(s=s*10+(r.charCodeAt(n)-yg),s>=16777215)return{n:16777215,c:n,ok:!1};return n===0?{n:0,c:0,ok:!1}:{n:s,c:n,ok:!0}}function $v(r){let n=0,s=0;for(s=0;s<r.length;s++){if(48<=r.charCodeAt(s)&&r.charCodeAt(s)<=57)n*=16,n+=r.charCodeAt(s)-yg;else if(97<=r.charCodeAt(s)&&r.charCodeAt(s)<=102)n*=16,n+=r.charCodeAt(s)-Uv+10;else if(65<=r.charCodeAt(s)&&r.charCodeAt(s)<=70)n*=16,n+=r.charCodeAt(s)-qv+10;else break;if(n>=16777215)return{n:0,c:s,ok:!1}}return s===0?{n:0,c:s,ok:!1}:{n,c:s,ok:!0}}function Yv(r){return r.indexOf("[")!==-1||r.indexOf("::")!==-1?!1:r.indexOf(".")!==-1||r.split(":").length<=2}function kf(r){return!Yv(r)}function Gv(r){const n="::FFFF:",s=r.toUpperCase().indexOf(n);if(s!==-1&&r.indexOf(".")!==-1){let a=r.substring(s+n.length);return a=a.replace("[",""),a.replace("]","")}return r}function Vv(r){r=r.trim(),r.match(/^(.*:\/\/)(.*)/m)&&(r=r.replace(/^(.*:\/\/)(.*)/gm,"$2")),r=Gv(r),kf(r)&&r.indexOf("[")===-1&&(r=`[${r}]`);const n=kf(r)?r.match(/(]:)(\d+)/):r.match(/(:)(\d+)/),s=n&&n.length===3&&n[1]&&n[2]?parseInt(n[2]):4222,a=s===80?"https":"http",c=new URL(`${a}://${r}`);c.port=`${s}`;let f=c.hostname;return f.charAt(0)==="["&&(f=f.substring(1,f.length-1)),{listen:c.host,hostname:f,port:s}}class Ma{constructor(n,s=!1){v(this,"src");v(this,"listen");v(this,"hostname");v(this,"port");v(this,"didConnect");v(this,"reconnects");v(this,"lastConnect");v(this,"gossiped");v(this,"tlsName");v(this,"resolves");this.src=n,this.tlsName="";const a=Vv(n);this.listen=a.listen,this.hostname=a.hostname,this.port=a.port,this.didConnect=!1,this.reconnects=0,this.lastConnect=0,this.gossiped=s}toString(){return this.listen}async resolve(n){if(!n.fn||n.resolve===!1)return[this];const s=[];if(Cf(this.hostname))return[this];{const a=await n.fn(this.hostname);n.debug&&console.log(`resolve ${this.hostname} = ${a.join(",")}`);for(const c of a){const f=this.port===80?"https":"http",h=new URL(`${f}://${kf(c)?"["+c+"]":c}`);h.port=`${this.port}`;const d=new Ma(h.host,!1);d.tlsName=this.hostname,s.push(d)}}return n.randomize&&fg(s),this.resolves=s,s}}class Fv{constructor(n=[],s={}){v(this,"firstSelect");v(this,"servers");v(this,"currentServer");v(this,"tlsName");v(this,"randomize");this.firstSelect=!0,this.servers=[],this.tlsName="",this.randomize=s.randomize||!1;const a=of();n&&(n.forEach(c=>{c=a?a(c):c,this.servers.push(new Ma(c))}),this.randomize&&(this.servers=fg(this.servers))),this.servers.length===0&&this.addServer(`${_f}:${gg()}`,!1),this.currentServer=this.servers[0]}clear(){this.servers.length=0}updateTLSName(){const n=this.getCurrentServer();Cf(n.hostname)||(this.tlsName=n.hostname,this.servers.forEach(s=>{s.gossiped&&(s.tlsName=this.tlsName)}))}getCurrentServer(){return this.currentServer}addServer(n,s=!1){const a=of();n=a?a(n):n;const c=new Ma(n,s);Cf(c.hostname)&&(c.tlsName=this.tlsName),this.servers.push(c)}selectServer(){if(this.firstSelect)return this.firstSelect=!1,this.currentServer;const n=this.servers.shift();return n&&(this.servers.push(n),this.currentServer=n),n}removeCurrentServer(){this.removeServer(this.currentServer)}removeServer(n){if(n){const s=this.servers.indexOf(n);this.servers.splice(s,1)}}length(){return this.servers.length}next(){return this.servers.length?this.servers[0]:void 0}getServers(){return this.servers}update(n,s){const a=[];let c=[];const f=of(),h=new Map;n.connect_urls&&n.connect_urls.length>0&&n.connect_urls.forEach(g=>{g=f?f(g,s):g;const y=new Ma(g,!0);h.set(g,y)});const d=[];return this.servers.forEach((g,y)=>{const A=g.listen;g.gossiped&&this.currentServer.listen!==A&&h.get(A)===void 0&&d.push(y),h.delete(A)}),d.reverse(),d.forEach(g=>{const y=this.servers.splice(g,1);c=c.concat(y[0].listen)}),h.forEach((g,y)=>{this.servers.push(g),a.push(y)}),{added:a,deleted:c}}}class Jv{constructor(){v(this,"baseInbox");v(this,"reqs");this.reqs=new Map}size(){return this.reqs.size}init(n){return this.baseInbox=`${cs(n)}.`,this.baseInbox}add(n){isNaN(n.received)||(n.received=0),this.reqs.set(n.token,n)}get(n){return this.reqs.get(n)}cancel(n){this.reqs.delete(n.token)}getToken(n){const s=n.subject||"";return s.indexOf(this.baseInbox)===0?s.substring(this.baseInbox.length):null}all(){return Array.from(this.reqs.values())}handleError(n,s){if(s&&s.permissionContext){if(n)return this.all().forEach(c=>{c.resolver(s,{})}),!0;const a=s.permissionContext;if(a.operation==="publish"){const c=this.all().find(f=>f.requestSubject===a.subject);if(c)return c.resolver(s,{}),!0}}return!1}dispatcher(){return(n,s)=>{const a=this.getToken(s);if(a){const c=this.get(a);c&&(n===null&&s.headers&&(n=hg(s)),c.resolver(n,s))}}}close(){const n=oe.errorForCode(se.Timeout);this.reqs.forEach(s=>{s.resolver(n,{})})}}class Qv{constructor(n,s,a){v(this,"ph");v(this,"interval");v(this,"maxOut");v(this,"timer");v(this,"pendings");this.ph=n,this.interval=s,this.maxOut=a,this.pendings=[]}start(){this.cancel(),this._schedule()}cancel(n){this.timer&&(clearTimeout(this.timer),this.timer=void 0),this._reset(),n&&this.ph.disconnect()}_schedule(){this.timer=setTimeout(()=>{if(this.ph.dispatchStatus({type:yr.PingTimer,data:`${this.pendings.length+1}`}),this.pendings.length===this.maxOut){this.cancel(!0);return}const n=st();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 Xv extends Error{constructor(n){super(n),this.name="AssertionError"}}function Iv(r,n="Assertion failed."){if(!r)throw new Xv(n)}const m0=32*1024,uf=2**32-2;function fc(r,n,s=0){const a=n.byteLength-s;return r.byteLength>a&&(r=r.subarray(0,a)),n.set(r,s),r.byteLength}class ff{constructor(n){v(this,"_buf");v(this,"_off");if(this._off=0,n==null){this._buf=new Uint8Array(0);return}this._buf=new Uint8Array(n)}bytes(n={copy:!0}){return n.copy===!1?this._buf.subarray(this._off):this._buf.slice(this._off)}empty(){return this._buf.byteLength<=this._off}get length(){return this._buf.byteLength-this._off}get capacity(){return this._buf.buffer.byteLength}truncate(n){if(n===0){this.reset();return}if(n<0||n>this.length)throw Error("bytes.Buffer: truncation out of range");this._reslice(this._off+n)}reset(){this._reslice(0),this._off=0}_tryGrowByReslice(n){const s=this._buf.byteLength;return n<=this.capacity-s?(this._reslice(s+n),s):-1}_reslice(n){Iv(n<=this._buf.buffer.byteLength),this._buf=new Uint8Array(this._buf.buffer,0,n)}readByte(){const n=new Uint8Array(1);return this.read(n)?n[0]:null}read(n){if(this.empty())return this.reset(),n.byteLength===0?0:null;const s=fc(this._buf.subarray(this._off),n);return this._off+=s,s}writeByte(n){return this.write(Uint8Array.of(n))}writeString(n){return this.write(Oi.encode(n))}write(n){const s=this._grow(n.byteLength);return fc(n,this._buf,s)}_grow(n){const s=this.length;s===0&&this._off!==0&&this.reset();const a=this._tryGrowByReslice(n);if(a>=0)return a;const c=this.capacity;if(n<=Math.floor(c/2)-s)fc(this._buf.subarray(this._off),this._buf);else{if(c+n>uf)throw new Error("The buffer cannot be grown beyond the maximum size.");{const f=new Uint8Array(Math.min(2*c+n,uf));fc(this._buf.subarray(this._off),f),this._buf=f}}return this._off=0,this._reslice(Math.min(s+n,uf)),s}grow(n){if(n<0)throw Error("Buffer._grow: negative count");const s=this._grow(n);this._reslice(s)}readFrom(n){let s=0;const a=new Uint8Array(m0);for(;;){const c=this.capacity-this.length<m0,f=c?a:new Uint8Array(this._buf.buffer,this.length),h=n.read(f);if(h===null)return s;c?this.write(f.subarray(0,h)):this._reslice(this.length+h),s+=h}}}var Rt;(function(r){r[r.OK=0]="OK",r[r.ERR=1]="ERR",r[r.MSG=2]="MSG",r[r.INFO=3]="INFO",r[r.PING=4]="PING",r[r.PONG=5]="PONG"})(Rt||(Rt={}));function p0(){const r={};return r.sid=-1,r.hdr=-1,r.size=-1,r}const Kv=48;class g0{constructor(n){v(this,"dispatcher");v(this,"state");v(this,"as");v(this,"drop");v(this,"hdr");v(this,"ma");v(this,"argBuf");v(this,"msgBuf");this.dispatcher=n,this.state=le.OP_START,this.as=0,this.drop=0,this.hdr=0}parse(n){let s;for(s=0;s<n.length;s++){const a=n[s];switch(this.state){case le.OP_START:switch(a){case ce.M:case ce.m:this.state=le.OP_M,this.hdr=-1,this.ma=p0();break;case ce.H:case ce.h:this.state=le.OP_H,this.hdr=0,this.ma=p0();break;case ce.P:case ce.p:this.state=le.OP_P;break;case ce.PLUS:this.state=le.OP_PLUS;break;case ce.MINUS:this.state=le.OP_MINUS;break;case ce.I:case ce.i:this.state=le.OP_I;break;default:throw this.fail(n.subarray(s))}break;case le.OP_H:switch(a){case ce.M:case ce.m:this.state=le.OP_M;break;default:throw this.fail(n.subarray(s))}break;case le.OP_M:switch(a){case ce.S:case ce.s:this.state=le.OP_MS;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MS:switch(a){case ce.G:case ce.g:this.state=le.OP_MSG;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MSG:switch(a){case ce.SPACE:case ce.TAB:this.state=le.OP_MSG_SPC;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MSG_SPC:switch(a){case ce.SPACE:case ce.TAB:continue;default:this.state=le.MSG_ARG,this.as=s}break;case le.MSG_ARG:switch(a){case ce.CR:this.drop=1;break;case ce.NL:{const c=this.argBuf?this.argBuf.bytes():n.subarray(this.as,s-this.drop);this.processMsgArgs(c),this.drop=0,this.as=s+1,this.state=le.MSG_PAYLOAD,s=this.as+this.ma.size-1;break}default:this.argBuf&&this.argBuf.writeByte(a)}break;case le.MSG_PAYLOAD:if(this.msgBuf)if(this.msgBuf.length>=this.ma.size){const c=this.msgBuf.bytes({copy:!1});this.dispatcher.push({kind:Rt.MSG,msg:this.ma,data:c}),this.argBuf=void 0,this.msgBuf=void 0,this.state=le.MSG_END}else{let c=this.ma.size-this.msgBuf.length;const f=n.length-s;f<c&&(c=f),c>0?(this.msgBuf.write(n.subarray(s,s+c)),s=s+c-1):this.msgBuf.writeByte(a)}else s-this.as>=this.ma.size&&(this.dispatcher.push({kind:Rt.MSG,msg:this.ma,data:n.subarray(this.as,s)}),this.argBuf=void 0,this.msgBuf=void 0,this.state=le.MSG_END);break;case le.MSG_END:switch(a){case ce.NL:this.drop=0,this.as=s+1,this.state=le.OP_START;break;default:continue}break;case le.OP_PLUS:switch(a){case ce.O:case ce.o:this.state=le.OP_PLUS_O;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PLUS_O:switch(a){case ce.K:case ce.k:this.state=le.OP_PLUS_OK;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PLUS_OK:switch(a){case ce.NL:this.dispatcher.push({kind:Rt.OK}),this.drop=0,this.state=le.OP_START;break}break;case le.OP_MINUS:switch(a){case ce.E:case ce.e:this.state=le.OP_MINUS_E;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MINUS_E:switch(a){case ce.R:case ce.r:this.state=le.OP_MINUS_ER;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MINUS_ER:switch(a){case ce.R:case ce.r:this.state=le.OP_MINUS_ERR;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MINUS_ERR:switch(a){case ce.SPACE:case ce.TAB:this.state=le.OP_MINUS_ERR_SPC;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MINUS_ERR_SPC:switch(a){case ce.SPACE:case ce.TAB:continue;default:this.state=le.MINUS_ERR_ARG,this.as=s}break;case le.MINUS_ERR_ARG:switch(a){case ce.CR:this.drop=1;break;case ce.NL:{let c;this.argBuf?(c=this.argBuf.bytes(),this.argBuf=void 0):c=n.subarray(this.as,s-this.drop),this.dispatcher.push({kind:Rt.ERR,data:c}),this.drop=0,this.as=s+1,this.state=le.OP_START;break}default:this.argBuf&&this.argBuf.write(Uint8Array.of(a))}break;case le.OP_P:switch(a){case ce.I:case ce.i:this.state=le.OP_PI;break;case ce.O:case ce.o:this.state=le.OP_PO;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PO:switch(a){case ce.N:case ce.n:this.state=le.OP_PON;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PON:switch(a){case ce.G:case ce.g:this.state=le.OP_PONG;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PONG:switch(a){case ce.NL:this.dispatcher.push({kind:Rt.PONG}),this.drop=0,this.state=le.OP_START;break}break;case le.OP_PI:switch(a){case ce.N:case ce.n:this.state=le.OP_PIN;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PIN:switch(a){case ce.G:case ce.g:this.state=le.OP_PING;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PING:switch(a){case ce.NL:this.dispatcher.push({kind:Rt.PING}),this.drop=0,this.state=le.OP_START;break}break;case le.OP_I:switch(a){case ce.N:case ce.n:this.state=le.OP_IN;break;default:throw this.fail(n.subarray(s))}break;case le.OP_IN:switch(a){case ce.F:case ce.f:this.state=le.OP_INF;break;default:throw this.fail(n.subarray(s))}break;case le.OP_INF:switch(a){case ce.O:case ce.o:this.state=le.OP_INFO;break;default:throw this.fail(n.subarray(s))}break;case le.OP_INFO:switch(a){case ce.SPACE:case ce.TAB:this.state=le.OP_INFO_SPC;break;default:throw this.fail(n.subarray(s))}break;case le.OP_INFO_SPC:switch(a){case ce.SPACE:case ce.TAB:continue;default:this.state=le.INFO_ARG,this.as=s}break;case le.INFO_ARG:switch(a){case ce.CR:this.drop=1;break;case ce.NL:{let c;this.argBuf?(c=this.argBuf.bytes(),this.argBuf=void 0):c=n.subarray(this.as,s-this.drop),this.dispatcher.push({kind:Rt.INFO,data:c}),this.drop=0,this.as=s+1,this.state=le.OP_START;break}default:this.argBuf&&this.argBuf.writeByte(a)}break;default:throw this.fail(n.subarray(s))}}(this.state===le.MSG_ARG||this.state===le.MINUS_ERR_ARG||this.state===le.INFO_ARG)&&!this.argBuf&&(this.argBuf=new ff(n.subarray(this.as,s-this.drop))),this.state===le.MSG_PAYLOAD&&!this.msgBuf&&(this.argBuf||this.cloneMsgArg(),this.msgBuf=new ff(n.subarray(this.as)))}cloneMsgArg(){const n=this.ma.subject.length,s=this.ma.reply?this.ma.reply.length:0,a=new Uint8Array(n+s);a.set(this.ma.subject),this.ma.reply&&a.set(this.ma.reply,n),this.argBuf=new ff(a),this.ma.subject=a.subarray(0,n),this.ma.reply&&(this.ma.reply=a.subarray(n))}processMsgArgs(n){if(this.hdr>=0)return this.processHeaderMsgArgs(n);const s=[];let a=-1;for(let c=0;c<n.length;c++)switch(n[c]){case ce.SPACE:case ce.TAB:case ce.CR:case ce.NL:a>=0&&(s.push(n.subarray(a,c)),a=-1);break;default:a<0&&(a=c)}switch(a>=0&&s.push(n.subarray(a)),s.length){case 3:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=void 0,this.ma.size=this.protoParseInt(s[2]);break;case 4:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=s[2],this.ma.size=this.protoParseInt(s[3]);break;default:throw this.fail(n,"processMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(n,"processMsgArgs Bad or Missing Sid Error");if(this.ma.size<0)throw this.fail(n,"processMsgArgs Bad or Missing Size Error")}fail(n,s=""){return s?s=`${s} [${this.state}]`:s=`parse error [${this.state}]`,new Error(`${s}: ${Wt.decode(n)}`)}processHeaderMsgArgs(n){const s=[];let a=-1;for(let c=0;c<n.length;c++)switch(n[c]){case ce.SPACE:case ce.TAB:case ce.CR:case ce.NL:a>=0&&(s.push(n.subarray(a,c)),a=-1);break;default:a<0&&(a=c)}switch(a>=0&&s.push(n.subarray(a)),s.length){case 4:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=void 0,this.ma.hdr=this.protoParseInt(s[2]),this.ma.size=this.protoParseInt(s[3]);break;case 5:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=s[2],this.ma.hdr=this.protoParseInt(s[3]),this.ma.size=this.protoParseInt(s[4]);break;default:throw this.fail(n,"processHeaderMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Sid Error");if(this.ma.hdr<0||this.ma.hdr>this.ma.size)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Header Size Error");if(this.ma.size<0)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Size Error")}protoParseInt(n){if(n.length===0)return-1;let s=0;for(let a=0;a<n.length;a++){if(n[a]<48||n[a]>57)return-1;s=s*10+(n[a]-Kv)}return s}}var le;(function(r){r[r.OP_START=0]="OP_START",r[r.OP_PLUS=1]="OP_PLUS",r[r.OP_PLUS_O=2]="OP_PLUS_O",r[r.OP_PLUS_OK=3]="OP_PLUS_OK",r[r.OP_MINUS=4]="OP_MINUS",r[r.OP_MINUS_E=5]="OP_MINUS_E",r[r.OP_MINUS_ER=6]="OP_MINUS_ER",r[r.OP_MINUS_ERR=7]="OP_MINUS_ERR",r[r.OP_MINUS_ERR_SPC=8]="OP_MINUS_ERR_SPC",r[r.MINUS_ERR_ARG=9]="MINUS_ERR_ARG",r[r.OP_M=10]="OP_M",r[r.OP_MS=11]="OP_MS",r[r.OP_MSG=12]="OP_MSG",r[r.OP_MSG_SPC=13]="OP_MSG_SPC",r[r.MSG_ARG=14]="MSG_ARG",r[r.MSG_PAYLOAD=15]="MSG_PAYLOAD",r[r.MSG_END=16]="MSG_END",r[r.OP_H=17]="OP_H",r[r.OP_P=18]="OP_P",r[r.OP_PI=19]="OP_PI",r[r.OP_PIN=20]="OP_PIN",r[r.OP_PING=21]="OP_PING",r[r.OP_PO=22]="OP_PO",r[r.OP_PON=23]="OP_PON",r[r.OP_PONG=24]="OP_PONG",r[r.OP_I=25]="OP_I",r[r.OP_IN=26]="OP_IN",r[r.OP_INF=27]="OP_INF",r[r.OP_INFO=28]="OP_INFO",r[r.OP_INFO_SPC=29]="OP_INFO_SPC",r[r.INFO_ARG=30]="INFO_ARG"})(le||(le={}));var ce;(function(r){r[r.CR=13]="CR",r[r.E=69]="E",r[r.e=101]="e",r[r.F=70]="F",r[r.f=102]="f",r[r.G=71]="G",r[r.g=103]="g",r[r.H=72]="H",r[r.h=104]="h",r[r.I=73]="I",r[r.i=105]="i",r[r.K=75]="K",r[r.k=107]="k",r[r.M=77]="M",r[r.m=109]="m",r[r.MINUS=45]="MINUS",r[r.N=78]="N",r[r.n=110]="n",r[r.NL=10]="NL",r[r.O=79]="O",r[r.o=111]="o",r[r.P=80]="P",r[r.p=112]="p",r[r.PLUS=43]="PLUS",r[r.R=82]="R",r[r.r=114]="r",r[r.S=83]="S",r[r.s=115]="s",r[r.SPACE=32]="SPACE",r[r.TAB=9]="TAB"})(ce||(ce={}));(function(r){var n=function(x,w){this.hi=x|0,this.lo=w|0},s=function(x){var w,_=new Float64Array(16);if(x)for(w=0;w<x.length;w++)_[w]=x[w];return _},a=function(){throw new Error("no PRNG")},c=new Uint8Array(16),f=new Uint8Array(32);f[0]=9;var h=s(),d=s([1]),g=s([56129,1]),y=s([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),A=s([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),S=s([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),j=s([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),z=s([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function R(x,w){return x<<w|x>>>32-w}function H(x,w){var _=x[w+3]&255;return _=_<<8|x[w+2]&255,_=_<<8|x[w+1]&255,_<<8|x[w+0]&255}function ee(x,w){var _=x[w]<<24|x[w+1]<<16|x[w+2]<<8|x[w+3],E=x[w+4]<<24|x[w+5]<<16|x[w+6]<<8|x[w+7];return new n(_,E)}function ne(x,w,_){var E;for(E=0;E<4;E++)x[w+E]=_&255,_>>>=8}function W(x,w,_){x[w]=_.hi>>24&255,x[w+1]=_.hi>>16&255,x[w+2]=_.hi>>8&255,x[w+3]=_.hi&255,x[w+4]=_.lo>>24&255,x[w+5]=_.lo>>16&255,x[w+6]=_.lo>>8&255,x[w+7]=_.lo&255}function me(x,w,_,E,T){var D,F=0;for(D=0;D<T;D++)F|=x[w+D]^_[E+D];return(1&F-1>>>8)-1}function be(x,w,_,E){return me(x,w,_,E,16)}function k(x,w,_,E){return me(x,w,_,E,32)}function I(x,w,_,E,T){var D=new Uint32Array(16),F=new Uint32Array(16),X=new Uint32Array(16),L=new Uint32Array(4),V,ue,Ee;for(V=0;V<4;V++)F[5*V]=H(E,4*V),F[1+V]=H(_,4*V),F[6+V]=H(w,4*V),F[11+V]=H(_,16+4*V);for(V=0;V<16;V++)X[V]=F[V];for(V=0;V<20;V++){for(ue=0;ue<4;ue++){for(Ee=0;Ee<4;Ee++)L[Ee]=F[(5*ue+4*Ee)%16];for(L[1]^=R(L[0]+L[3]|0,7),L[2]^=R(L[1]+L[0]|0,9),L[3]^=R(L[2]+L[1]|0,13),L[0]^=R(L[3]+L[2]|0,18),Ee=0;Ee<4;Ee++)D[4*ue+(ue+Ee)%4]=L[Ee]}for(Ee=0;Ee<16;Ee++)F[Ee]=D[Ee]}if(T){for(V=0;V<16;V++)F[V]=F[V]+X[V]|0;for(V=0;V<4;V++)F[5*V]=F[5*V]-H(E,4*V)|0,F[6+V]=F[6+V]-H(w,4*V)|0;for(V=0;V<4;V++)ne(x,4*V,F[5*V]),ne(x,16+4*V,F[6+V])}else for(V=0;V<16;V++)ne(x,4*V,F[V]+X[V]|0)}function ie(x,w,_,E){return I(x,w,_,E,!1),0}function Z(x,w,_,E){return I(x,w,_,E,!0),0}var Q=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function K(x,w,_,E,T,D,F){var X=new Uint8Array(16),L=new Uint8Array(64),V,ue;if(!T)return 0;for(ue=0;ue<16;ue++)X[ue]=0;for(ue=0;ue<8;ue++)X[ue]=D[ue];for(;T>=64;){for(ie(L,X,F,Q),ue=0;ue<64;ue++)x[w+ue]=(_?_[E+ue]:0)^L[ue];for(V=1,ue=8;ue<16;ue++)V=V+(X[ue]&255)|0,X[ue]=V&255,V>>>=8;T-=64,w+=64,_&&(E+=64)}if(T>0)for(ie(L,X,F,Q),ue=0;ue<T;ue++)x[w+ue]=(_?_[E+ue]:0)^L[ue];return 0}function ae(x,w,_,E,T){return K(x,w,null,0,_,E,T)}function re(x,w,_,E,T){var D=new Uint8Array(32);return Z(D,E,T,Q),ae(x,w,_,E.subarray(16),D)}function qe(x,w,_,E,T,D,F){var X=new Uint8Array(32);return Z(X,D,F,Q),K(x,w,_,E,T,D.subarray(16),X)}function Ge(x,w){var _,E=0;for(_=0;_<17;_++)E=E+(x[_]+w[_]|0)|0,x[_]=E&255,E>>>=8}var Le=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]);function $(x,w,_,E,T,D){var F,X,L,V,ue=new Uint32Array(17),Ee=new Uint32Array(17),Ke=new Uint32Array(17),Ct=new Uint32Array(17),_n=new Uint32Array(17);for(L=0;L<17;L++)Ee[L]=Ke[L]=0;for(L=0;L<16;L++)Ee[L]=D[L];for(Ee[3]&=15,Ee[4]&=252,Ee[7]&=15,Ee[8]&=252,Ee[11]&=15,Ee[12]&=252,Ee[15]&=15;T>0;){for(L=0;L<17;L++)Ct[L]=0;for(L=0;L<16&&L<T;++L)Ct[L]=_[E+L];for(Ct[L]=1,E+=L,T-=L,Ge(Ke,Ct),X=0;X<17;X++)for(ue[X]=0,L=0;L<17;L++)ue[X]=ue[X]+Ke[L]*(L<=X?Ee[X-L]:320*Ee[X+17-L]|0)|0|0;for(X=0;X<17;X++)Ke[X]=ue[X];for(V=0,L=0;L<16;L++)V=V+Ke[L]|0,Ke[L]=V&255,V>>>=8;for(V=V+Ke[16]|0,Ke[16]=V&3,V=5*(V>>>2)|0,L=0;L<16;L++)V=V+Ke[L]|0,Ke[L]=V&255,V>>>=8;V=V+Ke[16]|0,Ke[16]=V}for(L=0;L<17;L++)_n[L]=Ke[L];for(Ge(Ke,Le),F=-(Ke[16]>>>7)|0,L=0;L<17;L++)Ke[L]^=F&(_n[L]^Ke[L]);for(L=0;L<16;L++)Ct[L]=D[L+16];for(Ct[16]=0,Ge(Ke,Ct),L=0;L<16;L++)x[w+L]=Ke[L];return 0}function te(x,w,_,E,T,D){var F=new Uint8Array(16);return $(F,0,_,E,T,D),be(x,w,F,0)}function he(x,w,_,E,T){var D;if(_<32)return-1;for(qe(x,0,w,0,_,E,T),$(x,16,x,32,_-32,x),D=0;D<16;D++)x[D]=0;return 0}function xe(x,w,_,E,T){var D,F=new Uint8Array(32);if(_<32||(re(F,0,32,E,T),te(w,16,w,32,_-32,F)!==0))return-1;for(qe(x,0,w,0,_,E,T),D=0;D<32;D++)x[D]=0;return 0}function ye(x,w){var _;for(_=0;_<16;_++)x[_]=w[_]|0}function Ae(x){var w,_;for(_=0;_<16;_++)x[_]+=65536,w=Math.floor(x[_]/65536),x[(_+1)*(_<15?1:0)]+=w-1+37*(w-1)*(_===15?1:0),x[_]-=w*65536}function ve(x,w,_){for(var E,T=~(_-1),D=0;D<16;D++)E=T&(x[D]^w[D]),x[D]^=E,w[D]^=E}function Oe(x,w){var _,E,T,D=s(),F=s();for(_=0;_<16;_++)F[_]=w[_];for(Ae(F),Ae(F),Ae(F),E=0;E<2;E++){for(D[0]=F[0]-65517,_=1;_<15;_++)D[_]=F[_]-65535-(D[_-1]>>16&1),D[_-1]&=65535;D[15]=F[15]-32767-(D[14]>>16&1),T=D[15]>>16&1,D[14]&=65535,ve(F,D,1-T)}for(_=0;_<16;_++)x[2*_]=F[_]&255,x[2*_+1]=F[_]>>8}function lt(x,w){var _=new Uint8Array(32),E=new Uint8Array(32);return Oe(_,x),Oe(E,w),k(_,0,E,0)}function Pt(x){var w=new Uint8Array(32);return Oe(w,x),w[0]&1}function sn(x,w){var _;for(_=0;_<16;_++)x[_]=w[2*_]+(w[2*_+1]<<8);x[15]&=32767}function Ot(x,w,_){var E;for(E=0;E<16;E++)x[E]=w[E]+_[E]|0}function jt(x,w,_){var E;for(E=0;E<16;E++)x[E]=w[E]-_[E]|0}function _e(x,w,_){var E,T,D=new Float64Array(31);for(E=0;E<31;E++)D[E]=0;for(E=0;E<16;E++)for(T=0;T<16;T++)D[E+T]+=w[E]*_[T];for(E=0;E<15;E++)D[E]+=38*D[E+16];for(E=0;E<16;E++)x[E]=D[E];Ae(x),Ae(x)}function Tt(x,w){_e(x,w,w)}function Zs(x,w){var _=s(),E;for(E=0;E<16;E++)_[E]=w[E];for(E=253;E>=0;E--)Tt(_,_),E!==2&&E!==4&&_e(_,_,w);for(E=0;E<16;E++)x[E]=_[E]}function ji(x,w){var _=s(),E;for(E=0;E<16;E++)_[E]=w[E];for(E=250;E>=0;E--)Tt(_,_),E!==1&&_e(_,_,w);for(E=0;E<16;E++)x[E]=_[E]}function Ws(x,w,_){var E=new Uint8Array(32),T=new Float64Array(80),D,F,X=s(),L=s(),V=s(),ue=s(),Ee=s(),Ke=s();for(F=0;F<31;F++)E[F]=w[F];for(E[31]=w[31]&127|64,E[0]&=248,sn(T,_),F=0;F<16;F++)L[F]=T[F],ue[F]=X[F]=V[F]=0;for(X[0]=ue[0]=1,F=254;F>=0;--F)D=E[F>>>3]>>>(F&7)&1,ve(X,L,D),ve(V,ue,D),Ot(Ee,X,V),jt(X,X,V),Ot(V,L,ue),jt(L,L,ue),Tt(ue,Ee),Tt(Ke,X),_e(X,V,X),_e(V,L,Ee),Ot(Ee,X,V),jt(X,X,V),Tt(L,X),jt(V,ue,Ke),_e(X,V,g),Ot(X,X,ue),_e(V,V,X),_e(X,ue,Ke),_e(ue,L,T),Tt(L,Ee),ve(X,L,D),ve(V,ue,D);for(F=0;F<16;F++)T[F+16]=X[F],T[F+32]=V[F],T[F+48]=L[F],T[F+64]=ue[F];var Ct=T.subarray(32),_n=T.subarray(16);return Zs(Ct,Ct),_e(_n,_n,Ct),Oe(x,_n),0}function rn(x,w){return Ws(x,w,f)}function Ti(x,w){return a(w,32),rn(x,w)}function hs(x,w,_){var E=new Uint8Array(32);return Ws(E,_,w),Z(x,c,E,Q)}var Ya=he,Ga=xe;function jr(x,w,_,E,T,D){var F=new Uint8Array(32);return hs(F,T,D),Ya(x,w,_,E,F)}function Tr(x,w,_,E,T,D){var F=new Uint8Array(32);return hs(F,T,D),Ga(x,w,_,E,F)}function Hn(){var x=0,w=0,_=0,E=0,T=65535,D,F,X;for(X=0;X<arguments.length;X++)D=arguments[X].lo,F=arguments[X].hi,x+=D&T,w+=D>>>16,_+=F&T,E+=F>>>16;return w+=x>>>16,_+=w>>>16,E+=_>>>16,new n(_&T|E<<16,x&T|w<<16)}function Va(x,w){return new n(x.hi>>>w,x.lo>>>w|x.hi<<32-w)}function Ni(){var x=0,w=0,_;for(_=0;_<arguments.length;_++)x^=arguments[_].lo,w^=arguments[_].hi;return new n(w,x)}function et(x,w){var _,E,T=32-w;return w<32?(_=x.hi>>>w|x.lo<<T,E=x.lo>>>w|x.hi<<T):w<64&&(_=x.lo>>>w|x.hi<<T,E=x.hi>>>w|x.lo<<T),new n(_,E)}function Vc(x,w,_){var E=x.hi&w.hi^~x.hi&_.hi,T=x.lo&w.lo^~x.lo&_.lo;return new n(E,T)}function Fa(x,w,_){var E=x.hi&w.hi^x.hi&_.hi^w.hi&_.hi,T=x.lo&w.lo^x.lo&_.lo^w.lo&_.lo;return new n(E,T)}function Ja(x){return Ni(et(x,28),et(x,34),et(x,39))}function Ci(x){return Ni(et(x,14),et(x,18),et(x,41))}function Fc(x){return Ni(et(x,1),et(x,8),Va(x,7))}function Qa(x){return Ni(et(x,19),et(x,61),Va(x,6))}var Jc=[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 Xa(x,w,_){var E=[],T=[],D=[],F=[],X,L,V;for(L=0;L<8;L++)E[L]=D[L]=ee(x,8*L);for(var ue=0;_>=128;){for(L=0;L<16;L++)F[L]=ee(w,8*L+ue);for(L=0;L<80;L++){for(V=0;V<8;V++)T[V]=D[V];for(X=Hn(D[7],Ci(D[4]),Vc(D[4],D[5],D[6]),Jc[L],F[L%16]),T[7]=Hn(X,Ja(D[0]),Fa(D[0],D[1],D[2])),T[3]=Hn(T[3],X),V=0;V<8;V++)D[(V+1)%8]=T[V];if(L%16===15)for(V=0;V<16;V++)F[V]=Hn(F[V],F[(V+9)%16],Fc(F[(V+1)%16]),Qa(F[(V+14)%16]))}for(L=0;L<8;L++)D[L]=Hn(D[L],E[L]),E[L]=D[L];ue+=128,_-=128}for(L=0;L<8;L++)W(x,8*L,E[L]);return _}var ei=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 ct(x,w,_){var E=new Uint8Array(64),T=new Uint8Array(256),D,F=_;for(D=0;D<64;D++)E[D]=ei[D];for(Xa(E,w,_),_%=128,D=0;D<256;D++)T[D]=0;for(D=0;D<_;D++)T[D]=w[F-_+D];for(T[_]=128,_=256-128*(_<112?1:0),T[_-9]=0,W(T,_-8,new n(F/536870912|0,F<<3)),Xa(E,T,_),D=0;D<64;D++)x[D]=E[D];return 0}function $t(x,w){var _=s(),E=s(),T=s(),D=s(),F=s(),X=s(),L=s(),V=s(),ue=s();jt(_,x[1],x[0]),jt(ue,w[1],w[0]),_e(_,_,ue),Ot(E,x[0],x[1]),Ot(ue,w[0],w[1]),_e(E,E,ue),_e(T,x[3],w[3]),_e(T,T,A),_e(D,x[2],w[2]),Ot(D,D,D),jt(F,E,_),jt(X,D,T),Ot(L,D,T),Ot(V,E,_),_e(x[0],F,X),_e(x[1],V,L),_e(x[2],L,X),_e(x[3],F,V)}function Nt(x,w,_){var E;for(E=0;E<4;E++)ve(x[E],w[E],_)}function Nr(x,w){var _=s(),E=s(),T=s();Zs(T,w[2]),_e(_,w[0],T),_e(E,w[1],T),Oe(x,E),x[31]^=Pt(_)<<7}function Cr(x,w,_){var E,T;for(ye(x[0],h),ye(x[1],d),ye(x[2],d),ye(x[3],h),T=255;T>=0;--T)E=_[T/8|0]>>(T&7)&1,Nt(x,w,E),$t(w,x),$t(x,x),Nt(x,w,E)}function ki(x,w){var _=[s(),s(),s(),s()];ye(_[0],S),ye(_[1],j),ye(_[2],d),_e(_[3],S,j),Cr(x,_,w)}function ds(x,w,_){var E=new Uint8Array(64),T=[s(),s(),s(),s()],D;for(_||a(w,32),ct(E,w,32),E[0]&=248,E[31]&=127,E[31]|=64,ki(T,E),Nr(x,T),D=0;D<32;D++)w[D+32]=x[D];return 0}var Pn=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 ms(x,w){var _,E,T,D;for(E=63;E>=32;--E){for(_=0,T=E-32,D=E-12;T<D;++T)w[T]+=_-16*w[E]*Pn[T-(E-32)],_=Math.floor((w[T]+128)/256),w[T]-=_*256;w[T]+=_,w[E]=0}for(_=0,T=0;T<32;T++)w[T]+=_-(w[31]>>4)*Pn[T],_=w[T]>>8,w[T]&=255;for(T=0;T<32;T++)w[T]-=_*Pn[T];for(E=0;E<32;E++)w[E+1]+=w[E]>>8,x[E]=w[E]&255}function xn(x){var w=new Float64Array(64),_;for(_=0;_<64;_++)w[_]=x[_];for(_=0;_<64;_++)x[_]=0;ms(x,w)}function ti(x,w,_,E){var T=new Uint8Array(64),D=new Uint8Array(64),F=new Uint8Array(64),X,L,V=new Float64Array(64),ue=[s(),s(),s(),s()];ct(T,E,32),T[0]&=248,T[31]&=127,T[31]|=64;var Ee=_+64;for(X=0;X<_;X++)x[64+X]=w[X];for(X=0;X<32;X++)x[32+X]=T[32+X];for(ct(F,x.subarray(32),_+32),xn(F),ki(ue,F),Nr(x,ue),X=32;X<64;X++)x[X]=E[X];for(ct(D,x,_+64),xn(D),X=0;X<64;X++)V[X]=0;for(X=0;X<32;X++)V[X]=F[X];for(X=0;X<32;X++)for(L=0;L<32;L++)V[X+L]+=D[X]*T[L];return ms(x.subarray(32),V),Ee}function ni(x,w){var _=s(),E=s(),T=s(),D=s(),F=s(),X=s(),L=s();return ye(x[2],d),sn(x[1],w),Tt(T,x[1]),_e(D,T,y),jt(T,T,x[2]),Ot(D,x[2],D),Tt(F,D),Tt(X,F),_e(L,X,F),_e(_,L,T),_e(_,_,D),ji(_,_),_e(_,_,T),_e(_,_,D),_e(_,_,D),_e(x[0],_,D),Tt(E,x[0]),_e(E,E,D),lt(E,T)&&_e(x[0],x[0],z),Tt(E,x[0]),_e(E,E,D),lt(E,T)?-1:(Pt(x[0])===w[31]>>7&&jt(x[0],h,x[0]),_e(x[3],x[0],x[1]),0)}function kr(x,w,_,E){var T,D=new Uint8Array(32),F=new Uint8Array(64),X=[s(),s(),s(),s()],L=[s(),s(),s(),s()];if(_<64||ni(L,E))return-1;for(T=0;T<_;T++)x[T]=w[T];for(T=0;T<32;T++)x[T+32]=E[T];if(ct(F,x,_),xn(F),Cr(X,L,F),ki(L,w.subarray(32)),$t(X,L),Nr(D,X),_-=64,k(w,0,D,0)){for(T=0;T<_;T++)x[T]=0;return-1}for(T=0;T<_;T++)x[T]=w[T+64];return _}var Mi=32,ps=24,vn=32,gs=16,ys=32,si=32,bs=32,$n=32,ii=32,Mr=ps,Ia=vn,Cn=gs,Qe=64,it=32,Yt=64,ri=32,Rr=64;r.lowlevel={crypto_core_hsalsa20:Z,crypto_stream_xor:qe,crypto_stream:re,crypto_stream_salsa20_xor:K,crypto_stream_salsa20:ae,crypto_onetimeauth:$,crypto_onetimeauth_verify:te,crypto_verify_16:be,crypto_verify_32:k,crypto_secretbox:he,crypto_secretbox_open:xe,crypto_scalarmult:Ws,crypto_scalarmult_base:rn,crypto_box_beforenm:hs,crypto_box_afternm:Ya,crypto_box:jr,crypto_box_open:Tr,crypto_box_keypair:Ti,crypto_hash:ct,crypto_sign:ti,crypto_sign_keypair:ds,crypto_sign_open:kr,crypto_secretbox_KEYBYTES:Mi,crypto_secretbox_NONCEBYTES:ps,crypto_secretbox_ZEROBYTES:vn,crypto_secretbox_BOXZEROBYTES:gs,crypto_scalarmult_BYTES:ys,crypto_scalarmult_SCALARBYTES:si,crypto_box_PUBLICKEYBYTES:bs,crypto_box_SECRETKEYBYTES:$n,crypto_box_BEFORENMBYTES:ii,crypto_box_NONCEBYTES:Mr,crypto_box_ZEROBYTES:Ia,crypto_box_BOXZEROBYTES:Cn,crypto_sign_BYTES:Qe,crypto_sign_PUBLICKEYBYTES:it,crypto_sign_SECRETKEYBYTES:Yt,crypto_sign_SEEDBYTES:ri,crypto_hash_BYTES:Rr,gf:s,D:y,L:Pn,pack25519:Oe,unpack25519:sn,M:_e,A:Ot,S:Tt,Z:jt,pow2523:ji,add:$t,set25519:ye,modL:ms,scalarmult:Cr,scalarbase:ki};function Ka(x,w){if(x.length!==Mi)throw new Error("bad key size");if(w.length!==ps)throw new Error("bad nonce size")}function Za(x,w){if(x.length!==bs)throw new Error("bad public key size");if(w.length!==$n)throw new Error("bad secret key size")}function yt(){for(var x=0;x<arguments.length;x++)if(!(arguments[x]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function Ri(x){for(var w=0;w<x.length;w++)x[w]=0}r.randomBytes=function(x){var w=new Uint8Array(x);return a(w,x),w},r.secretbox=function(x,w,_){yt(x,w,_),Ka(_,w);for(var E=new Uint8Array(vn+x.length),T=new Uint8Array(E.length),D=0;D<x.length;D++)E[D+vn]=x[D];return he(T,E,E.length,w,_),T.subarray(gs)},r.secretbox.open=function(x,w,_){yt(x,w,_),Ka(_,w);for(var E=new Uint8Array(gs+x.length),T=new Uint8Array(E.length),D=0;D<x.length;D++)E[D+gs]=x[D];return E.length<32||xe(T,E,E.length,w,_)!==0?null:T.subarray(vn)},r.secretbox.keyLength=Mi,r.secretbox.nonceLength=ps,r.secretbox.overheadLength=gs,r.scalarMult=function(x,w){if(yt(x,w),x.length!==si)throw new Error("bad n size");if(w.length!==ys)throw new Error("bad p size");var _=new Uint8Array(ys);return Ws(_,x,w),_},r.scalarMult.base=function(x){if(yt(x),x.length!==si)throw new Error("bad n size");var w=new Uint8Array(ys);return rn(w,x),w},r.scalarMult.scalarLength=si,r.scalarMult.groupElementLength=ys,r.box=function(x,w,_,E){var T=r.box.before(_,E);return r.secretbox(x,w,T)},r.box.before=function(x,w){yt(x,w),Za(x,w);var _=new Uint8Array(ii);return hs(_,x,w),_},r.box.after=r.secretbox,r.box.open=function(x,w,_,E){var T=r.box.before(_,E);return r.secretbox.open(x,w,T)},r.box.open.after=r.secretbox.open,r.box.keyPair=function(){var x=new Uint8Array(bs),w=new Uint8Array($n);return Ti(x,w),{publicKey:x,secretKey:w}},r.box.keyPair.fromSecretKey=function(x){if(yt(x),x.length!==$n)throw new Error("bad secret key size");var w=new Uint8Array(bs);return rn(w,x),{publicKey:w,secretKey:new Uint8Array(x)}},r.box.publicKeyLength=bs,r.box.secretKeyLength=$n,r.box.sharedKeyLength=ii,r.box.nonceLength=Mr,r.box.overheadLength=r.secretbox.overheadLength,r.sign=function(x,w){if(yt(x,w),w.length!==Yt)throw new Error("bad secret key size");var _=new Uint8Array(Qe+x.length);return ti(_,x,x.length,w),_},r.sign.open=function(x,w){if(yt(x,w),w.length!==it)throw new Error("bad public key size");var _=new Uint8Array(x.length),E=kr(_,x,x.length,w);if(E<0)return null;for(var T=new Uint8Array(E),D=0;D<T.length;D++)T[D]=_[D];return T},r.sign.detached=function(x,w){for(var _=r.sign(x,w),E=new Uint8Array(Qe),T=0;T<E.length;T++)E[T]=_[T];return E},r.sign.detached.verify=function(x,w,_){if(yt(x,w,_),w.length!==Qe)throw new Error("bad signature size");if(_.length!==it)throw new Error("bad public key size");var E=new Uint8Array(Qe+x.length),T=new Uint8Array(Qe+x.length),D;for(D=0;D<Qe;D++)E[D]=w[D];for(D=0;D<x.length;D++)E[D+Qe]=x[D];return kr(T,E,E.length,_)>=0},r.sign.keyPair=function(){var x=new Uint8Array(it),w=new Uint8Array(Yt);return ds(x,w),{publicKey:x,secretKey:w}},r.sign.keyPair.fromSecretKey=function(x){if(yt(x),x.length!==Yt)throw new Error("bad secret key size");for(var w=new Uint8Array(it),_=0;_<w.length;_++)w[_]=x[32+_];return{publicKey:w,secretKey:new Uint8Array(x)}},r.sign.keyPair.fromSeed=function(x){if(yt(x),x.length!==ri)throw new Error("bad seed size");for(var w=new Uint8Array(it),_=new Uint8Array(Yt),E=0;E<32;E++)_[E]=x[E];return ds(w,_,!0),{publicKey:w,secretKey:_}},r.sign.publicKeyLength=it,r.sign.secretKeyLength=Yt,r.sign.seedLength=ri,r.sign.signatureLength=Qe,r.hash=function(x){yt(x);var w=new Uint8Array(Rr);return ct(w,x,x.length),w},r.hash.hashLength=Rr,r.verify=function(x,w){return yt(x,w),x.length===0||w.length===0||x.length!==w.length?!1:me(x,0,w,0,x.length)===0},r.setPRNG=function(x){a=x},(function(){var x=typeof globalThis<"u"?globalThis.crypto||globalThis.msCrypto:null;if(x&&x.getRandomValues){var w=65536;r.setPRNG(function(_,E){var T,D=new Uint8Array(E);for(T=0;T<E;T+=w)x.getRandomValues(D.subarray(T,T+Math.min(E-T,w)));for(T=0;T<E;T++)_[T]=D[T];Ri(D)})}else typeof require<"u"&&(x=require("crypto"),x&&x.randomBytes&&r.setPRNG(function(_,E){var T,D=x.randomBytes(E);for(T=0;T<E;T++)_[T]=D[T];Ri(D)}))})()})(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const hc=typeof module<"u"&&module.exports?module.exports:globalThis.nacl;hc.sign.keyPair.fromSeed,hc.sign.detached,hc.sign.detached.verify,hc.randomBytes;var y0;(function(r){r.InvalidPrefixByte="nkeys: invalid prefix byte",r.InvalidKey="nkeys: invalid key",r.InvalidPublicKey="nkeys: invalid public key",r.InvalidSeedLen="nkeys: invalid seed length",r.InvalidSeed="nkeys: invalid seed",r.InvalidEncoding="nkeys: invalid encoded key",r.InvalidSignature="nkeys: signature verification failed",r.CannotSign="nkeys: cannot sign, no private key available",r.PublicKeyOnly="nkeys: no seed or private key available",r.InvalidChecksum="nkeys: invalid checksum",r.SerializationError="nkeys: serialization error",r.ApiError="nkeys: api error",r.ClearedPair="nkeys: pair is cleared"})(y0||(y0={}));var b0;(function(r){r[r.Seed=144]="Seed",r[r.Private=120]="Private",r[r.Operator=112]="Operator",r[r.Server=104]="Server",r[r.Cluster=16]="Cluster",r[r.Account=0]="Account",r[r.User=160]="User"})(b0||(b0={}));function Zv(r){return n=>{let s={};return r.forEach(a=>{const c=a(n)||{};s=Object.assign(s,c)}),s}}function Wv(){return()=>{}}function e1(r,n){return()=>{const s=typeof r=="function"?r():r,a=typeof n=="function"?n():n;return{user:s,pass:a}}}function t1(r){return()=>({auth_token:typeof r=="function"?r():r})}const xg=120*1e3,n1=2,vg=2*1e3;function s1(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:xg,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:1e3,reconnectTimeWait:vg,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function i1(r){const n=[];return typeof r.authenticator=="function"&&n.push(r.authenticator),Array.isArray(r.authenticator)&&n.push(...r.authenticator),r.token&&n.push(t1(r.token)),r.user&&n.push(e1(r.user,r.pass)),n.length===0?Wv():Zv(n)}function r1(r){const n=`${_f}:${gg()}`;if(r=r||{servers:[n]},r.servers=r.servers||[],typeof r.servers=="string"&&(r.servers=[r.servers]),r.servers.length>0&&r.port)throw new oe("port and servers options are mutually exclusive",se.InvalidOption);r.servers.length===0&&r.port&&(r.servers=[`${_f}:${r.port}`]),r.servers&&r.servers.length===0&&(r.servers=[n]);const s=Uc(s1(),r);if(s.authenticator=i1(s),["reconnectDelayHandler","authenticator"].forEach(a=>{if(s[a]&&typeof s[a]!="function")throw new oe(`${a} option should be a function`,se.NotFunction)}),s.reconnectDelayHandler||(s.reconnectDelayHandler=()=>{let a=s.tls?s.reconnectJitterTLS:s.reconnectJitter;return a&&(a++,a=Math.floor(Math.random()*a)),s.reconnectTimeWait+a}),s.inboxPrefix)try{cs(s.inboxPrefix)}catch(a){throw new oe(a.message,se.ApiError)}if(s.resolve===void 0&&(s.resolve=typeof Nf()=="function"),s.resolve&&typeof Nf()!="function")throw new oe("'resolve' is not supported on this client",se.InvalidOption);return s}function a1(r,n){const{proto:s,tls_required:a,tls_available:c}=r;if((s===void 0||s<1)&&n.noEcho)throw new oe("noEcho",se.ServerOptionNotAvailable);const f=a||c||!1;if(n.tls&&!f)throw new oe("tls",se.ServerOptionNotAvailable)}const l1=1024*32,c1=/^INFO\s+([^\r\n]+)\r\n/i,o1=Ca(`PONG\r
38
+ `),x0=Ca(`PING\r
39
+ `);class u1{constructor(n,s,a){v(this,"echo");v(this,"no_responders");v(this,"protocol");v(this,"verbose");v(this,"pedantic");v(this,"jwt");v(this,"nkey");v(this,"sig");v(this,"user");v(this,"pass");v(this,"auth_token");v(this,"tls_required");v(this,"name");v(this,"lang");v(this,"version");v(this,"headers");this.protocol=1,this.version=n.version,this.lang=n.lang,this.echo=s.noEcho?!1:void 0,this.verbose=s.verbose,this.pedantic=s.pedantic,this.tls_required=s.tls?!0:void 0,this.name=s.name;const c=(s&&typeof s.authenticator=="function"?s.authenticator(a):{})||{};Uc(this,c)}}class _g extends _t{constructor(s,a,c={}){var h;super();v(this,"sid");v(this,"queue");v(this,"draining");v(this,"max");v(this,"subject");v(this,"drained");v(this,"protocol");v(this,"timer");v(this,"info");v(this,"cleanupFn");v(this,"closed");v(this,"requestSubject");Uc(this,c),this.protocol=s,this.subject=a,this.draining=!1,this.noIterator=typeof c.callback=="function",this.closed=st();const f=!((h=s.options)!=null&&h.noAsyncTraces);c.timeout&&(this.timer=wr(c.timeout,f),this.timer.then(()=>{this.timer=void 0}).catch(d=>{this.stop(d),this.noIterator&&this.callback(d,{})})),this.noIterator||this.iterClosed.then(()=>{this.closed.resolve(),this.unsubscribe()})}setPrePostHandlers(s){if(this.noIterator){const a=this.callback,c=s.ingestionFilterFn?s.ingestionFilterFn:()=>({ingest:!0,protocol:!1}),f=s.protocolFilterFn?s.protocolFilterFn:()=>!0,h=s.dispatchedFn?s.dispatchedFn:()=>{};this.callback=(d,g)=>{const{ingest:y}=c(g);y&&f(g)&&(a(d,g),h(g))}}else this.protocolFilterFn=s.protocolFilterFn,this.dispatchedFn=s.dispatchedFn}callback(s,a){this.cancelTimeout(),s?this.stop(s):this.push(a)}close(){if(!this.isClosed()){this.cancelTimeout();const s=()=>{if(this.stop(),this.cleanupFn)try{this.cleanupFn(this,this.info)}catch{}this.closed.resolve()};this.noIterator?s():this.push(s)}}unsubscribe(s){this.protocol.unsubscribe(this,s)}cancelTimeout(){this.timer&&(this.timer.cancel(),this.timer=void 0)}drain(){return this.protocol.isClosed()?Promise.reject(oe.errorForCode(se.ConnectionClosed)):this.isClosed()?Promise.reject(oe.errorForCode(se.SubClosed)):(this.drained||(this.draining=!0,this.protocol.unsub(this),this.drained=this.protocol.flush(st()).then(()=>{this.protocol.subscriptions.cancel(this)}).catch(()=>{this.protocol.subscriptions.cancel(this)})),this.drained)}isDraining(){return this.draining}isClosed(){return this.done}getSubject(){return this.subject}getMax(){return this.max}getID(){return this.sid}}class f1{constructor(){v(this,"mux");v(this,"subs");v(this,"sidCounter");this.sidCounter=0,this.mux=null,this.subs=new Map}size(){return this.subs.size}add(n){return this.sidCounter++,n.sid=this.sidCounter,this.subs.set(n.sid,n),n}setMux(n){return this.mux=n,n}getMux(){return this.mux}get(n){return this.subs.get(n)}resub(n){return this.sidCounter++,this.subs.delete(n.sid),n.sid=this.sidCounter,this.subs.set(n.sid,n),n}all(){return Array.from(this.subs.values())}cancel(n){n&&(n.close(),this.subs.delete(n.sid))}handleError(n){if(n&&n.permissionContext){const s=n.permissionContext,a=this.all();let c;if(s.operation==="subscription"&&(c=a.find(f=>f.subject===s.subject&&f.queue===s.queue)),s.operation==="publish"&&(c=a.find(f=>f.requestSubject===s.subject)),c)return c.callback(n,{}),c.close(),this.subs.delete(c.sid),c!==this.mux}return!1}close(){this.subs.forEach(n=>{n.close()})}}class Mc{constructor(n,s){v(this,"connected");v(this,"connectedOnce");v(this,"infoReceived");v(this,"info");v(this,"muxSubscriptions");v(this,"options");v(this,"outbound");v(this,"pongs");v(this,"subscriptions");v(this,"transport");v(this,"noMorePublishing");v(this,"connectError");v(this,"publisher");v(this,"_closed");v(this,"closed");v(this,"listeners");v(this,"heartbeats");v(this,"parser");v(this,"outMsgs");v(this,"inMsgs");v(this,"outBytes");v(this,"inBytes");v(this,"pendingLimit");v(this,"lastError");v(this,"abortReconnect");v(this,"whyClosed");v(this,"servers");v(this,"server");v(this,"features");v(this,"connectPromise");this._closed=!1,this.connected=!1,this.connectedOnce=!1,this.infoReceived=!1,this.noMorePublishing=!1,this.abortReconnect=!1,this.listeners=[],this.pendingLimit=l1,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=n,this.publisher=s,this.subscriptions=new f1,this.muxSubscriptions=new Jv,this.outbound=new Er,this.pongs=[],this.whyClosed="",this.pendingLimit=n.pendingLimit||this.pendingLimit,this.features=new jv({major:0,minor:0,micro:0}),this.connectPromise=null;const a=typeof n.servers=="string"?[n.servers]:n.servers;this.servers=new Fv(a,{randomize:!n.noRandomize}),this.closed=st(),this.parser=new g0(this),this.heartbeats=new Qv(this,this.options.pingInterval||xg,this.options.maxPingOut||n1)}resetOutbound(){this.outbound.reset();const n=this.pongs;this.pongs=[];const s=oe.errorForCode(se.Disconnect);s.stack="",n.forEach(a=>{a.reject(s)}),this.parser=new g0(this),this.infoReceived=!1}dispatchStatus(n){this.listeners.forEach(s=>{s.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=st();return n.catch(()=>{}),this.pongs.unshift(n),this.connectError=s=>{n.reject(s)},this.transport=Cv(),this.transport.closed().then(async s=>{if(this.connected=!1,!this.isClosed()){await this.disconnected(this.transport.closeError||this.lastError);return}}),n}disconnect(){this.dispatchStatus({type:yr.StaleConnection,data:""}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:yr.ClientInitiatedReconnect,data:""}),this.transport.disconnect()),Promise.resolve()}async disconnected(n){this.dispatchStatus({type:ls.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{var s;this.dispatchStatus({type:ls.Reconnect,data:this.servers.getCurrentServer().toString()}),((s=this.lastError)==null?void 0:s.code)===se.AuthenticationExpired&&(this.lastError=void 0)}).catch(s=>{this._close(s)}):await this._close(n)}async dial(n){const s=this.prepare();let a;try{a=wr(this.options.timeout||2e4);const c=this.transport.connect(n,this.options);await Promise.race([c,a]),(async()=>{try{for await(const f of this.transport)this.parser.parse(f)}catch(f){console.log("reader closed",f)}})().then()}catch(c){s.reject(c)}try{await Promise.race([a,s]),a&&a.cancel(),this.connected=!0,this.connectError=void 0,this.sendSubscriptions(),this.connectedOnce=!0,this.server.didConnect=!0,this.server.reconnects=0,this.flushPending(),this.heartbeats.start()}catch(c){throw a&&a.cancel(),await this.transport.close(c),c}}async _doDial(n){const{resolve:s}=this.options,a=await n.resolve({fn:Nf(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:s});let c=null;for(const f of a)try{c=null,this.dispatchStatus({type:yr.Reconnecting,data:f.toString()}),await this.dial(f);return}catch(h){c=h}throw c}dialLoop(){return this.connectPromise===null&&(this.connectPromise=this.dodialLoop(),this.connectPromise.then(()=>{}).catch(()=>{}).finally(()=>{this.connectPromise=null})),this.connectPromise}async dodialLoop(){let n;for(;;){this._closed&&this.servers.clear();const s=this.options.reconnectDelayHandler?this.options.reconnectDelayHandler():vg;let a=s;const c=this.selectServer();if(!c||this.abortReconnect)throw n||(this.lastError?this.lastError:oe.errorForCode(se.ConnectionRefused));const f=Date.now();if(c.lastConnect===0||c.lastConnect+s<=f){c.lastConnect=Date.now();try{await this._doDial(c);break}catch(h){if(n=h,!this.connectedOnce){if(this.options.waitOnFirstConnect)continue;this.servers.removeCurrentServer()}c.reconnects++;const d=this.options.maxReconnectAttempts||0;d!==-1&&c.reconnects>=d&&this.servers.removeCurrentServer()}}else a=Math.min(a,c.lastConnect+s-f),await Ar(a)}}static async connect(n,s){const a=new Mc(n,s);return await a.dialLoop(),a}static toError(n){const s=n?n.toLowerCase():"";if(s.indexOf("permissions violation")!==-1){const a=new oe(n,se.PermissionsViolation),c=n.match(/(Publish|Subscription) to "(\S+)"/);if(c){a.permissionContext={operation:c[1].toLowerCase(),subject:c[2],queue:void 0};const f=n.match(/using queue "(\S+)"/);f&&(a.permissionContext.queue=f[1])}return a}else return s.indexOf("authorization violation")!==-1?new oe(n,se.AuthorizationViolation):s.indexOf("user authentication expired")!==-1?new oe(n,se.AuthenticationExpired):s.indexOf("account authentication expired")!=-1?new oe(n,se.AccountExpired):s.indexOf("authentication timeout")!==-1?new oe(n,se.AuthenticationTimeout):new oe(n,se.ProtocolError)}processMsg(n,s){if(this.inMsgs++,this.inBytes+=s.length,!this.subscriptions.sidCounter)return;const a=this.subscriptions.get(n.sid);a&&(a.received+=1,a.callback&&a.callback(null,new Qf(n,s,this)),a.max!==void 0&&a.received>=a.max&&a.unsubscribe())}processError(n){const s=t0(n),a=Mc.toError(s),c={type:ls.Error,data:a.code};if(a.isPermissionError()){let f=!1;if(a.permissionContext){c.permissionContext=a.permissionContext;const h=this.subscriptions.getMux();f=(h==null?void 0:h.subject)===a.permissionContext.subject}this.subscriptions.handleError(a),this.muxSubscriptions.handleError(f,a),f&&this.subscriptions.setMux(null)}this.dispatchStatus(c),this.handleError(a)}handleError(n){n.isAuthError()?this.handleAuthError(n):n.isProtocolError()?this.lastError=n:n.isAuthTimeout()&&(this.lastError=n),n.isPermissionError()||(this.lastError=n)}handleAuthError(n){this.lastError&&n.code===this.lastError.code&&this.options.ignoreAuthErrorAbort===!1&&(this.abortReconnect=!0),this.connectError?this.connectError(n):this.disconnect()}processPing(){this.transport.send(o1)}processPong(){const n=this.pongs.shift();n&&n.resolve()}processInfo(n){const s=JSON.parse(t0(n));this.info=s;const a=this.options&&this.options.ignoreClusterUpdates?void 0:this.servers.update(s,this.transport.isEncrypted());if(!this.infoReceived){this.features.update(Si(s.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();const{version:f,lang:h}=this.transport;try{const d=new u1({version:f,lang:h},this.options,s.nonce);s.headers&&(d.headers=!0,d.no_responders=!0);const g=JSON.stringify(d);this.transport.send(Ca(`CONNECT ${g}${xc}`)),this.transport.send(x0)}catch(d){this._close(d)}}a&&this.dispatchStatus({type:ls.Update,data:a}),(s.ldm!==void 0?s.ldm:!1)&&this.dispatchStatus({type:ls.LDM,data:this.servers.getCurrentServer().toString()})}push(n){switch(n.kind){case Rt.MSG:{const{msg:s,data:a}=n;this.processMsg(s,a);break}case Rt.OK:break;case Rt.ERR:this.processError(n.data);break;case Rt.PING:this.processPing();break;case Rt.PONG:this.processPong();break;case Rt.INFO:this.processInfo(n.data);break}}sendCommand(n,...s){const a=this.outbound.length();let c;typeof n=="string"?c=Ca(n):c=n,this.outbound.fill(c,...s),a===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(n,s=tn,a){let c;if(s instanceof Uint8Array)c=s;else if(typeof s=="string")c=Oi.encode(s);else throw oe.errorForCode(se.BadPayload);let f=c.length;a=a||{},a.reply=a.reply||"";let h=tn,d=0;if(a.headers){if(this.info&&!this.info.headers)throw new oe("headers",se.ServerOptionNotAvailable);h=a.headers.encode(),d=h.length,f=c.length+d}if(this.info&&f>this.info.max_payload)throw oe.errorForCode(se.MaxPayloadExceeded);this.outBytes+=f,this.outMsgs++;let g;a.headers?(a.reply?g=`HPUB ${n} ${a.reply} ${d} ${f}\r
40
+ `:g=`HPUB ${n} ${d} ${f}\r
41
+ `,this.sendCommand(g,h,c,kc)):(a.reply?g=`PUB ${n} ${a.reply} ${f}\r
42
+ `:g=`PUB ${n} ${f}\r
43
+ `,this.sendCommand(g,c,kc))}request(n){return this.initMux(),this.muxSubscriptions.add(n),n}subscribe(n){return this.subscriptions.add(n),this._subunsub(n),n}_sub(n){n.queue?this.sendCommand(`SUB ${n.subject} ${n.queue} ${n.sid}\r
44
+ `):this.sendCommand(`SUB ${n.subject} ${n.sid}\r
45
+ `)}_subunsub(n){return this._sub(n),n.max&&this.unsubscribe(n,n.max),n}unsubscribe(n,s){this.unsub(n,s),(n.max===void 0||n.received>=n.max)&&this.subscriptions.cancel(n)}unsub(n,s){!n||this.isClosed()||(s?this.sendCommand(`UNSUB ${n.sid} ${s}\r
46
+ `):this.sendCommand(`UNSUB ${n.sid}\r
47
+ `),n.max=s)}resub(n,s){!n||this.isClosed()||(this.unsub(n),n.subject=s,this.subscriptions.resub(n),this._sub(n))}flush(n){return n||(n=st()),this.pongs.push(n),this.outbound.fill(x0),this.flushPending(),n}sendSubscriptions(){const n=[];this.subscriptions.all().forEach(s=>{const a=s;a.queue?n.push(`SUB ${a.subject} ${a.queue} ${a.sid}${xc}`):n.push(`SUB ${a.subject} ${a.sid}${xc}`)}),n.length&&this.transport.send(Ca(n.join("")))}async _close(n){this._closed||(this.whyClosed=new Error("close trace").stack||"",this.heartbeats.cancel(),this.connectError&&(this.connectError(n),this.connectError=void 0),this.muxSubscriptions.close(),this.subscriptions.close(),this.listeners.forEach(s=>{s.stop()}),this._closed=!0,await this.transport.close(n),await this.closed.resolve(n))}close(){return this._close()}isClosed(){return this._closed}drain(){const n=this.subscriptions.all(),s=[];return n.forEach(a=>{s.push(a.drain())}),Promise.all(s).then(async()=>(this.noMorePublishing=!0,await this.flush(),this.close())).catch(()=>{})}flushPending(){if(!(!this.infoReceived||!this.connected)&&this.outbound.size()){const n=this.outbound.drain();this.transport.send(n)}}initMux(){if(!this.subscriptions.getMux()){const s=this.muxSubscriptions.init(this.options.inboxPrefix),a=new _g(this,`${s}*`);a.callback=this.muxSubscriptions.dispatcher(),this.subscriptions.setMux(a),this.subscribe(a)}}selectServer(){const n=this.servers.selectServer();if(n!==void 0)return this.server=n,this.server}getServer(){return this.server}}const h1="$SRV";class v0{constructor(n){v(this,"msg");this.msg=n}get data(){return this.msg.data}get sid(){return this.msg.sid}get subject(){return this.msg.subject}get reply(){return this.msg.reply||""}get headers(){return this.msg.headers}respond(n,s){return this.msg.respond(n,s)}respondError(n,s,a,c){var f,h;return c=c||{},c.headers=c.headers||os(),(f=c.headers)==null||f.set(jc,`${n}`),(h=c.headers)==null||h.set(Oc,s),this.msg.respond(a,c)}json(n){return this.msg.json(n)}string(){return this.msg.string()}}class qa{constructor(n,s="",a=""){v(this,"subject");v(this,"queue");v(this,"srv");s!==""&&m1("service group",s);let c="";if(n instanceof Pa)this.srv=n,c="";else if(n instanceof qa){const f=n;this.srv=f.srv,a===""&&f.queue!==""&&(a=f.queue),c=f.subject}else throw new Error("unknown ServiceGroup type");this.subject=this.calcSubject(c,s),this.queue=a}calcSubject(n,s=""){return s===""?n:n!==""?`${n}.${s}`:s}addEndpoint(n="",s){s=s||{subject:n};const a=typeof s=="function"?{handler:s,subject:n}:s;ja("endpoint",n);let{subject:c,handler:f,metadata:h,queue:d}=a;c=c||n,d=d||this.queue,d1("endpoint subject",c),c=this.calcSubject(this.subject,c);const g={name:n,subject:c,queue:d,handler:f,metadata:h};return this.srv._addEndpoint(g)}addGroup(n="",s=""){return new qa(this,n,s)}}function d1(r,n){if(n==="")throw new Error(`${r} cannot be empty`);if(n.indexOf(" ")!==-1)throw new Error(`${r} cannot contain spaces: '${n}'`);const s=n.split(".");s.forEach((a,c)=>{if(a===">"&&c!==s.length-1)throw new Error(`${r} cannot have internal '>': '${n}'`)})}function m1(r,n){if(n.indexOf(" ")!==-1)throw new Error(`${r} cannot contain spaces: '${n}'`);n.split(".").forEach(a=>{if(a===">")throw new Error(`${r} name cannot contain internal '>': '${n}'`)})}class Pa{constructor(n,s={name:"",version:""}){v(this,"nc");v(this,"_id");v(this,"config");v(this,"handlers");v(this,"internal");v(this,"_stopped");v(this,"_done");v(this,"started");this.nc=n,this.config=Object.assign({},s),this.config.queue||(this.config.queue="q"),ja("name",this.config.name),ja("queue",this.config.queue),Si(this.config.version),this._id=Is.next(),this.internal=[],this._done=st(),this._stopped=!1,this.handlers=[],this.started=new Date().toISOString(),this.reset(),this.nc.closed().then(()=>{this.close().catch()}).catch(a=>{this.close(a).catch()})}static controlSubject(n,s="",a="",c){const f=c??h1;return s===""&&a===""?`${f}.${n}`:(ja("control subject name",s),a!==""?(ja("control subject id",a),`${f}.${n}.${s}.${a}`):`${f}.${n}.${s}`)}get subjects(){return this.handlers.filter(n=>n.internal===!1).map(n=>n.subject)}get id(){return this._id}get name(){return this.config.name}get description(){return this.config.description??""}get version(){return this.config.version}get metadata(){return this.config.metadata}errorToHeader(n){const s=os();if(n instanceof Tc){const a=n;s.set(Oc,a.message),s.set(jc,`${a.code}`)}else s.set(Oc,n.message),s.set(jc,"500");return s}setupHandler(n,s=!1){const a=s?"":n.queue?n.queue:this.config.queue,{name:c,subject:f,handler:h}=n,d=n;d.internal=s,s&&this.internal.push(d),d.stats=new p1(c,f,a),d.queue=a;const g=h?(y,A)=>{if(y){this.close(y);return}const S=Date.now();try{h(y,new v0(A))}catch(j){d.stats.countError(j),A==null||A.respond(tn,{headers:this.errorToHeader(j)})}finally{d.stats.countLatency(S)}}:void 0;return d.sub=this.nc.subscribe(f,{callback:g,queue:a}),d.sub.closed.then(()=>{this._stopped||this.close(new Error(`required subscription ${n.subject} stopped`)).catch()}).catch(y=>{if(!this._stopped){const A=new Error(`required subscription ${n.subject} errored: ${y.message}`);A.stack=y.stack,this.close(A).catch()}}),d}info(){return{type:ka.INFO,name:this.name,id:this.id,version:this.version,description:this.description,metadata:this.metadata,endpoints:this.endpoints()}}endpoints(){return this.handlers.map(n=>{const{subject:s,metadata:a,name:c,queue:f}=n;return{subject:s,metadata:a,name:c,queue_group:f}})}async stats(){const n=[];for(const s of this.handlers){if(typeof this.config.statsHandler=="function")try{s.stats.data=await this.config.statsHandler(s)}catch(a){s.stats.countError(a)}n.push(s.stats.stats(s.qi))}return{type:ka.STATS,name:this.name,id:this.id,version:this.version,started:this.started,metadata:this.metadata,endpoints:n}}addInternalHandler(n,s){const a=`${n}`.toUpperCase();this._doAddInternalHandler(`${a}-all`,n,s),this._doAddInternalHandler(`${a}-kind`,n,s,this.name),this._doAddInternalHandler(`${a}`,n,s,this.name,this.id)}_doAddInternalHandler(n,s,a,c="",f=""){const h={};h.name=n,h.subject=Pa.controlSubject(s,c,f),h.handler=a,this.setupHandler(h,!0)}start(){const n=Tn(),s=(h,d)=>h?(this.close(h),Promise.reject(h)):this.stats().then(g=>(d==null||d.respond(n.encode(g)),Promise.resolve())),a=(h,d)=>h?(this.close(h),Promise.reject(h)):(d==null||d.respond(n.encode(this.info())),Promise.resolve()),c=n.encode(this.ping()),f=(h,d)=>h?(this.close(h).then().catch(),Promise.reject(h)):(d.respond(c),Promise.resolve());return this.addInternalHandler(Fs.PING,f),this.addInternalHandler(Fs.STATS,s),this.addInternalHandler(Fs.INFO,a),this.handlers.forEach(h=>{const{subject:d}=h;typeof d=="string"&&h.handler!==null&&this.setupHandler(h)}),Promise.resolve(this)}close(n){if(this._stopped)return this._done;this._stopped=!0;let s=[];return this.nc.isClosed()||(s=this.handlers.concat(this.internal).map(a=>a.sub.drain())),Promise.allSettled(s).then(()=>{this._done.resolve(n||null)}),this._done}get stopped(){return this._done}get isStopped(){return this._stopped}stop(n){return this.close(n)}ping(){return{type:ka.PING,name:this.name,id:this.id,version:this.version,metadata:this.metadata}}reset(){if(this.started=new Date().toISOString(),this.handlers)for(const n of this.handlers)n.stats.reset(n.qi)}addGroup(n,s){return new qa(this,n,s)}addEndpoint(n,s){return new qa(this).addEndpoint(n,s)}_addEndpoint(n){const s=new _t;s.noIterator=typeof n.handler=="function",s.noIterator||(n.handler=(c,f)=>{c?this.stop(c).catch():s.push(new v0(f))},s.iterClosed.then(()=>{this.close().catch()}));const a=this.setupHandler(n,!1);return a.qi=s,this.handlers.push(a),s}}class p1{constructor(n,s,a=""){v(this,"name");v(this,"subject");v(this,"average_processing_time");v(this,"num_requests");v(this,"processing_time");v(this,"num_errors");v(this,"last_error");v(this,"data");v(this,"metadata");v(this,"queue");this.name=n,this.subject=s,this.average_processing_time=0,this.num_errors=0,this.num_requests=0,this.processing_time=0,this.queue=a}reset(n){this.num_requests=0,this.processing_time=0,this.average_processing_time=0,this.num_errors=0,this.last_error=void 0,this.data=void 0;const s=n;s&&(s.time=0,s.processed=0)}countLatency(n){this.num_requests++,this.processing_time+=nt(Date.now()-n),this.average_processing_time=Math.round(this.processing_time/this.num_requests)}countError(n){this.num_errors++,this.last_error=n.message}_stats(){const{name:n,subject:s,average_processing_time:a,num_errors:c,num_requests:f,processing_time:h,last_error:d,data:g,queue:y}=this;return{name:n,subject:s,average_processing_time:a,num_errors:c,num_requests:f,processing_time:h,last_error:d,data:g,queue_group:y}}stats(n){const s=n;return(s==null?void 0:s.noIterator)===!1&&(this.processing_time=nt(s.time),this.num_requests=s.processed,this.average_processing_time=this.processing_time>0&&this.num_requests>0?this.processing_time/this.num_requests:0),this._stats()}}class g1{constructor(n,s={strategy:jn.JitterTimer,maxWait:2e3},a){v(this,"nc");v(this,"prefix");v(this,"opts");this.nc=n,this.prefix=a,this.opts=s}ping(n="",s=""){return this.q(Fs.PING,n,s)}stats(n="",s=""){return this.q(Fs.STATS,n,s)}info(n="",s=""){return this.q(Fs.INFO,n,s)}async q(n,s="",a=""){const c=new _t,f=Tn(),h=Pa.controlSubject(n,s,a,this.prefix),d=await this.nc.requestMany(h,tn,this.opts);return(async()=>{for await(const g of d)try{const y=f.decode(g.data);c.push(y)}catch(y){c.push(()=>{c.stop(y)})}c.push(()=>{c.stop()})})().catch(g=>{c.stop(g)}),c}}function wg(){return{key:{encode(r){return r},decode(r){return r}},value:{encode(r){return r},decode(r){return r}}}}function y1(){return{replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:wg(),storage:Of.File}}const Rc="KV-Operation",_0="$KV",b1=/^[-/=.\w]+$/,x1=/^[-/=.>*\w]+$/,v1=/^[-\w]+$/;function _1(r){if(r.startsWith(".")||r.endsWith(".")||!b1.test(r))throw new Error(`invalid key: ${r}`)}function w1(r){if(r.startsWith(".")||r.endsWith(".")||!x1.test(r))throw new Error(`invalid key: ${r}`)}function S1(r){if(r.startsWith(".")||r.endsWith("."))throw new Error(`invalid key: ${r}`);const n=r.split(".");let s=!1;for(let a=0;a<n.length;a++)switch(n[a]){case"*":s=!0;break;case">":if(a!==n.length-1)throw new Error(`invalid key: ${r}`);s=!0;break}return s}function vc(r){if(!v1.test(r))throw new Error(`invalid bucket name: ${r}`)}var zn;(function(r){r.MsgIdHdr="Nats-Msg-Id",r.ExpectedStreamHdr="Nats-Expected-Stream",r.ExpectedLastSeqHdr="Nats-Expected-Last-Sequence",r.ExpectedLastMsgIdHdr="Nats-Expected-Last-Msg-Id",r.ExpectedLastSubjectSequenceHdr="Nats-Expected-Last-Subject-Sequence"})(zn||(zn={}));class Ua{constructor(n,s,a){v(this,"js");v(this,"jsm");v(this,"stream");v(this,"bucket");v(this,"direct");v(this,"codec");v(this,"prefix");v(this,"editPrefix");v(this,"useJsPrefix");v(this,"_prefixLen");v(this,"validateKey",_1);v(this,"validateSearchKey",w1);v(this,"hasWildcards",S1);vc(n),this.js=s,this.jsm=a,this.bucket=n,this.prefix=_0,this.editPrefix="",this.useJsPrefix=!1,this._prefixLen=0}static async create(n,s,a={}){vc(s);const c=await n.jetstreamManager(),f=new Ua(s,n,c);return await f.init(a),f}static async bind(n,s,a={}){const c=await n.jetstreamManager(),f={config:{allow_direct:a.allow_direct}};vc(s);const h=new Ua(s,n,c);return f.config.name=a.streamName??h.bucketName(),Object.assign(h,f),h.stream=f.config.name,h.codec=a.codec||wg(),h.direct=f.config.allow_direct??!1,h.initializePrefixes(f),h}async init(n={}){const s=Object.assign(y1(),n);this.codec=s.codec;const a={};this.stream=a.name=n.streamName??this.bucketName(),a.retention=Af.Limits,a.max_msgs_per_subject=s.history,s.maxBucketSize&&(s.max_bytes=s.maxBucketSize),s.max_bytes&&(a.max_bytes=s.max_bytes),a.max_msg_size=s.maxValueSize,a.storage=s.storage;const c=n.placementCluster??"";if(c&&(n.placement={},n.placement.cluster=c,n.placement.tags=[]),n.placement&&(a.placement=n.placement),n.republish&&(a.republish=n.republish),n.description&&(a.description=n.description),n.mirror){const S=Object.assign({},n.mirror);S.name.startsWith(Zt)||(S.name=`${Zt}${S.name}`),a.mirror=S,a.mirror_direct=!0}else if(n.sources){const S=n.sources.map(j=>{const z=Object.assign({},j),R=z.name.startsWith(Zt)?z.name.substring(Zt.length):z.name;return z.name.startsWith(Zt)||(z.name=`${Zt}${z.name}`),!j.external&&R!==this.bucket&&(z.subject_transforms=[{src:`$KV.${R}.>`,dest:`$KV.${this.bucket}.>`}]),z});a.sources=S,a.subjects=[this.subjectForBucket()]}else a.subjects=[this.subjectForBucket()];n.metadata&&(a.metadata=n.metadata),typeof n.compression=="boolean"&&(a.compression=n.compression?Ks.S2:Ks.None);const f=this.js.nc,h=f.getServerVersion(),d=h?Tf(h,Si("2.7.2"))>=0:!1;a.discard=d?za.New:za.Old;const{ok:g,min:y}=f.features.get(De.JS_ALLOW_DIRECT);if(!g&&n.allow_direct===!0){const S=h?`${h.major}.${h.minor}.${h.micro}`:"unknown";return Promise.reject(new Error(`allow_direct is not available on server version ${S} - requires ${y}`))}n.allow_direct=typeof n.allow_direct=="boolean"?n.allow_direct:g,a.allow_direct=n.allow_direct,this.direct=a.allow_direct,a.num_replicas=s.replicas,s.ttl&&(a.max_age=nt(s.ttl)),a.allow_rollup_hdrs=!0;let A;try{A=await this.jsm.streams.info(a.name),!A.config.allow_direct&&this.direct===!0&&(this.direct=!1)}catch(S){if(S.message==="stream not found")A=await this.jsm.streams.add(a);else throw S}this.initializePrefixes(A)}initializePrefixes(n){this._prefixLen=0,this.prefix=`$KV.${this.bucket}`,this.useJsPrefix=this.js.apiPrefix!=="$JS.API";const{mirror:s}=n.config;if(s){let a=s.name;if(a.startsWith(Zt)&&(a=a.substring(Zt.length)),s.external&&s.external.api!==""){const c=s.name.substring(Zt.length);this.useJsPrefix=!1,this.prefix=`$KV.${c}`,this.editPrefix=`${s.external.api}.$KV.${a}`}else this.editPrefix=this.prefix}}bucketName(){return this.stream??`${Zt}${this.bucket}`}subjectForBucket(){return`${this.prefix}.${this.bucket}.>`}subjectForKey(n,s=!1){const a=[];return s?(this.useJsPrefix&&a.push(this.js.apiPrefix),this.editPrefix!==""?a.push(this.editPrefix):a.push(this.prefix)):this.prefix&&a.push(this.prefix),a.push(n),a.join(".")}fullKeyName(n){return this.prefix!==""?`${this.prefix}.${n}`:`${_0}.${this.bucket}.${n}`}get prefixLen(){return this._prefixLen===0&&(this._prefixLen=this.prefix.length+1),this._prefixLen}encodeKey(n){const s=[];for(const a of n.split("."))switch(a){case">":case"*":s.push(a);break;default:s.push(this.codec.key.encode(a));break}return s.join(".")}decodeKey(n){const s=[];for(const a of n.split("."))switch(a){case">":case"*":s.push(a);break;default:s.push(this.codec.key.decode(a));break}return s.join(".")}close(){return Promise.resolve()}dataLen(n,s){const a=s&&s.get(Dt.MessageSizeHdr)||"";return a!==""?parseInt(a,10):n.length}smToEntry(n){return new B1(this.bucket,this.prefixLen,n)}jmToEntry(n){const s=this.decodeKey(n.subject.substring(this.prefixLen));return new L1(this.bucket,s,n)}async create(n,s){var f;let a;try{const h=await this.put(n,s,{previousSeq:0});return Promise.resolve(h)}catch(h){if(a=h,((f=h==null?void 0:h.api_error)==null?void 0:f.err_code)!==10071)return Promise.reject(h)}let c=0;try{const h=await this.get(n);return(h==null?void 0:h.operation)==="DEL"||(h==null?void 0:h.operation)==="PURGE"?(c=h!==null?h.revision:0,this.update(n,s,c)):Promise.reject(a)}catch(h){return Promise.reject(h)}}update(n,s,a){if(a<=0)throw new Error("version must be greater than 0");return this.put(n,s,{previousSeq:a})}async put(n,s,a={}){var h,d;const c=this.encodeKey(n);this.validateKey(c);const f={};if(a.previousSeq!==void 0){const g=os();f.headers=g,g.set(zn.ExpectedLastSubjectSequenceHdr,`${a.previousSeq}`)}try{return(await this.js.publish(this.subjectForKey(c,!0),s,f)).seq}catch(g){const y=g;return y.isJetStreamError()?(y.message=(h=y.api_error)==null?void 0:h.description,y.code=`${(d=y.api_error)==null?void 0:d.code}`,Promise.reject(y)):Promise.reject(g)}}async get(n,s){const a=this.encodeKey(n);this.validateKey(a);let c={last_by_subj:this.subjectForKey(a)};s&&s.revision>0&&(c={seq:s.revision});let f;try{this.direct?f=await this.jsm.direct.getMessage(this.bucketName(),c):f=await this.jsm.streams.getMessage(this.bucketName(),c);const h=this.smToEntry(f);return h.key!==a?null:h}catch(h){if(h.code===se.JetStream404NoMessages)return null;throw h}}purge(n,s){return this._deleteOrPurge(n,"PURGE",s)}delete(n,s){return this._deleteOrPurge(n,"DEL",s)}async purgeDeletes(n=1800*1e3){const s=st(),a=[],c=await this.watch({key:">",initializedFn:()=>{s.resolve()}});(async()=>{for await(const g of c)(g.operation==="DEL"||g.operation==="PURGE")&&a.push(g)})().then(),await s,c.stop();const f=Date.now()-n,h=a.map(g=>{const y=this.subjectForKey(g.key);return g.created.getTime()>=f?this.jsm.streams.purge(this.stream,{filter:y,keep:1}):this.jsm.streams.purge(this.stream,{filter:y,keep:0})}),d=await Promise.all(h);return d.unshift({success:!0,purged:0}),d.reduce((g,y)=>(g.purged+=y.purged,g))}async _deleteOrPurge(n,s,a){if(!this.hasWildcards(n))return this._doDeleteOrPurge(n,s,a);const c=await this.keys(n),f=[];for await(const h of c)f.push(this._doDeleteOrPurge(h,s)),f.length===100&&(await Promise.all(f),f.length=0);f.length>0&&await Promise.all(f)}async _doDeleteOrPurge(n,s,a){const c=this.encodeKey(n);this.validateKey(c);const f=os();f.set(Rc,s),s==="PURGE"&&f.set(Dt.RollupHdr,Dt.RollupValueSubject),a!=null&&a.previousSeq&&f.set(zn.ExpectedLastSubjectSequenceHdr,`${a.previousSeq}`),await this.js.publish(this.subjectForKey(c,!0),tn,{headers:f})}_buildCC(n,s,a={}){let f=(Array.isArray(n)?n:[n]).map(g=>{const y=this.encodeKey(g);return this.validateSearchKey(g),this.fullKeyName(y)}),h=ft.LastPerSubject;s===An.AllHistory&&(h=ft.All),s===An.UpdatesOnly&&(h=ft.New);let d;return f.length===1&&(d=f[0],f=void 0),Object.assign({deliver_policy:h,ack_policy:vt.None,filter_subjects:f,filter_subject:d,flow_control:!0,idle_heartbeat:nt(5*1e3)},a)}remove(n){return this.purge(n)}async history(n={}){const s=n.key??">",a=new _t,c={};c.headers_only=n.headers_only||!1;let f;f=()=>{a.stop()};let h=0;const d=this._buildCC(s,An.AllHistory,c),g=d.filter_subject,y=Qs(d);y.bindStream(this.stream),y.orderedConsumer(),y.callback((S,j)=>{if(S){a.stop(S);return}if(j){const z=this.jmToEntry(j);a.push(z),a.received++,(f&&h>0&&a.received>=h||j.info.pending===0)&&(a.push(f),f=void 0)}});const A=await this.js.subscribe(g,y);if(f){const{info:{last:S}}=A,j=S.num_pending+S.delivered.consumer_seq;if(j===0||a.received>=j)try{f()}catch(z){a.stop(z)}finally{f=void 0}else h=j}return a._data=A,a.iterClosed.then(()=>{A.unsubscribe()}),A.closed.then(()=>{a.stop()}).catch(S=>{a.stop(S)}),a}canSetWatcherName(){const s=this.js.nc,{ok:a}=s.features.get(De.JS_NEW_CONSUMER_CREATE_API);return a}async watch(n={}){const s=n.key??">",a=new _t,c={};c.headers_only=n.headers_only||!1;let f=An.LastValue;n.include===An.AllHistory?f=An.AllHistory:n.include===An.UpdatesOnly&&(f=An.UpdatesOnly);const h=n.ignoreDeletes===!0;let d=n.initializedFn,g=0;const y=this._buildCC(s,f,c),A=y.filter_subject,S=Qs(y);this.canSetWatcherName()&&S.consumerName(Is.next()),S.bindStream(this.stream),n.resumeFromRevision&&n.resumeFromRevision>0&&S.startSequence(n.resumeFromRevision),S.orderedConsumer(),S.callback((z,R)=>{if(z){a.stop(z);return}if(R){const H=this.jmToEntry(R);if(h&&H.operation==="DEL")return;a.push(H),a.received++,d&&(g>0&&a.received>=g||R.info.pending===0)&&(a.push(d),d=void 0)}});const j=await this.js.subscribe(A,S);if(d){const{info:{last:z}}=j,R=z.num_pending+z.delivered.consumer_seq;if(R===0||a.received>=R)try{d()}catch(H){a.stop(H)}finally{d=void 0}else g=R}return a._data=j,a.iterClosed.then(()=>{j.unsubscribe()}),j.closed.then(()=>{a.stop()}).catch(z=>{a.stop(z)}),a}async keys(n=">"){const s=new _t,a=this._buildCC(n,An.LastValue,{headers_only:!0}),c=Array.isArray(n)?">":a.filter_subject,f=Qs(a);f.bindStream(this.stream),f.orderedConsumer();const h=await this.js.subscribe(c,f);return(async()=>{var g;for await(const y of h){const A=(g=y.headers)==null?void 0:g.get(Rc);if(A!=="DEL"&&A!=="PURGE"){const S=this.decodeKey(y.subject.substring(this.prefixLen));s.push(S)}y.info.pending===0&&h.unsubscribe()}})().then(()=>{s.stop()}).catch(g=>{s.stop(g)}),h.info.last.num_pending===0&&h.unsubscribe(),s}purgeBucket(n){return this.jsm.streams.purge(this.bucketName(),n)}destroy(){return this.jsm.streams.delete(this.bucketName())}async status(){var f;const s=((f=this.js.nc.info)==null?void 0:f.cluster)??"",a=this.bucketName(),c=await this.jsm.streams.info(a);return new Sg(c,s)}}class Sg{constructor(n,s=""){v(this,"si");v(this,"cluster");this.si=n,this.cluster=s}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!==Ks.None:!1}}const If="OBJ_",w0="SHA-256=";function E1(r){return vc(r),`${If}${r}`}function A1(r){return r.startsWith(If)?r.substring(4):r}class Mf{constructor(n){v(this,"si");v(this,"backingStore");this.si=n,this.backingStore="JetStream"}get bucket(){return A1(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!==Ks.None:!1}}function dc(r){if(r===void 0)return;const{domain:n}=r;if(n===void 0)return r;const s=Object.assign({},r);if(delete s.domain,n==="")return s;if(s.external)throw new Error("domain and external are both set");return s.external={api:`$JS.${n}.API`},s}var gn;(function(r){r[r.Unset=-1]="Unset",r[r.Consume=0]="Consume",r[r.Fetch=1]="Fetch"})(gn||(gn={}));var qn;(function(r){r.HeartbeatsMissed="heartbeats_missed",r.ConsumerNotFound="consumer_not_found",r.StreamNotFound="stream_not_found",r.ConsumerDeleted="consumer_deleted",r.OrderedConsumerRecreated="ordered_consumer_recreated",r.NoResponders="no_responders"})(qn||(qn={}));var _r;(function(r){r.DebugEvent="debug",r.Discard="discard",r.Reset="reset",r.Next="next"})(_r||(_r={}));const S0=Uint8Array.of(43,65,67,75),O1=Uint8Array.of(45,78,65,75),Sa=Uint8Array.of(43,87,80,73),j1=Uint8Array.of(43,78,88,84),T1=Uint8Array.of(43,84,69,82,77),N1=Uint8Array.of(32);function Ba(r,n=5e3){return new F1(r,n)}class hf extends _t{constructor(s,a,c=!1){super();v(this,"consumer");v(this,"opts");v(this,"sub");v(this,"monitor");v(this,"pending");v(this,"inbox");v(this,"refilling");v(this,"pong");v(this,"callback");v(this,"timeout");v(this,"cleanupHandler");v(this,"listeners");v(this,"statusIterator");v(this,"forOrderedConsumer");v(this,"resetHandler");v(this,"abortOnMissingResource");v(this,"bind");v(this,"inBackOff");this.consumer=s;const f=a;this.opts=this.parseOptions(a,c),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=c,this.timeout=null,this.inbox=cs(s.api.nc.options.inboxPrefix),this.listeners=[],this.forOrderedConsumer=!1,this.abortOnMissingResource=f.abort_on_missing_resource===!0,this.bind=f.bind===!0,this.inBackOff=!1,this.start()}start(){const{max_messages:s,max_bytes:a,idle_heartbeat:c,threshold_bytes:f,threshold_messages:h}=this.opts;this.closed().then(g=>{if(this.cleanupHandler)try{this.cleanupHandler(g)}catch{}});const{sub:d}=this;d&&d.unsubscribe(),this.sub=this.consumer.api.nc.subscribe(this.inbox,{callback:(g,y)=>{var S,j,z,R;if(g){this.stop(g);return}if((S=this.monitor)==null||S.work(),y.subject===this.inbox){if(Ef(y))return;const H=(j=y.headers)==null?void 0:j.code,ee=((R=(z=y.headers)==null?void 0:z.description)==null?void 0:R.toLowerCase())||"unknown",{msgsLeft:ne,bytesLeft:W}=this.parseDiscard(y.headers);if(ne>0||W>0)this.pending.msgs-=ne,this.pending.bytes-=W,this.pending.requests--,this.notify(_r.Discard,{msgsLeft:ne,bytesLeft:W});else if(H===400){this.stop(new oe(ee,`${H}`));return}else if(H===409&&ee==="consumer deleted"){if(this.notify(qn.ConsumerDeleted,`${H} ${ee}`),!this.refilling||this.abortOnMissingResource){const me=new oe(ee,`${H}`);this.stop(me);return}}else if(H===503){if(this.notify(qn.NoResponders,`${H} No Responders`),!this.refilling||this.abortOnMissingResource){const me=new oe("no responders",`${H}`);this.stop(me);return}}else this.notify(_r.DebugEvent,`${H} ${ee}`)}else this._push(Ba(y,this.consumer.api.timeout)),this.received++,this.pending.msgs&&this.pending.msgs--,this.pending.bytes&&(this.pending.bytes-=y.size());if(this.pending.msgs===0&&this.pending.bytes===0&&(this.pending.requests=0),this.refilling){if(s&&this.pending.msgs<=h||a&&this.pending.bytes<=f){const H=this.pullOptions();this.pull(H)}}else this.pending.requests===0&&this._push(()=>{this.stop()})}}),this.sub.closed.then(()=>{this.sub.draining&&this._push(()=>{this.stop()})}),c&&(this.monitor=new Xf(c,g=>(this.notify(qn.HeartbeatsMissed,g),this.resetPending().then(()=>{}).catch(()=>{}),!1),{maxOut:2})),(async()=>{var y;const g=this.consumer.api.nc.status();this.statusIterator=g;for await(const A of g)switch(A.type){case ls.Disconnect:(y=this.monitor)==null||y.cancel();break;case ls.Reconnect:this.resetPending().then(S=>{var j;S&&((j=this.monitor)==null||j.restart())}).catch(()=>{});break}})(),this.pull(this.pullOptions())}_push(s){if(!this.callback)super.push(s);else{const a=typeof s=="function"?s:null;try{a?a():this.callback(s)}catch(c){this.stop(c)}}}notify(s,a){this.listeners.length>0&&this.listeners.forEach(c=>{c.done||c.push({type:s,data:a})})}resetPending(){return this.bind?this.resetPendingNoInfo():this.resetPendingWithInfo()}resetPendingNoInfo(){return this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),Promise.resolve(!0)}async resetPendingWithInfo(){if(this.inBackOff)return!1;let s=0,a=0;const c=Ff([this.opts.expires]);let f=0;for(;;){if(this.done)return!1;if(this.consumer.api.nc.isClosed())return console.error("aborting resetPending - connection is closed"),!1;try{return await this.consumer.info(),this.inBackOff=!1,s=0,this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),!0}catch(h){if(h.message==="stream not found"){if(a++,this.notify(qn.StreamNotFound,a),!this.refilling||this.abortOnMissingResource)return this.stop(h),!1}else if(h.message==="consumer not found"){if(s++,this.notify(qn.ConsumerNotFound,s),this.resetHandler)try{this.resetHandler()}catch{}if(!this.refilling||this.abortOnMissingResource)return this.stop(h),!1;if(this.forOrderedConsumer)return!1}else s=0,a=0;this.inBackOff=!0;const d=c.backoff(f),g=Ar(d);await Promise.race([g,this.consumer.api.nc.closed()]),g.cancel(),f++}}}pull(s){this.pending.bytes+=s.max_bytes??0,this.pending.msgs+=s.batch??0,this.pending.requests++;const a=this.consumer.api.nc;this._push(()=>{a.publish(`${this.consumer.api.prefix}.CONSUMER.MSG.NEXT.${this.consumer.stream}.${this.consumer.name}`,this.consumer.api.jc.encode(s),{reply:this.inbox}),this.notify(_r.Next,s)})}pullOptions(){const s=this.opts.max_messages-this.pending.msgs,a=this.opts.max_bytes-this.pending.bytes,c=nt(this.opts.idle_heartbeat),f=nt(this.opts.expires);return{batch:s,max_bytes:a,idle_heartbeat:c,expires:f}}parseDiscard(s){const a={msgsLeft:0,bytesLeft:0},c=s==null?void 0:s.get(Dt.PendingMessagesHdr);c&&(a.msgsLeft=parseInt(c));const f=s==null?void 0:s.get(Dt.PendingBytesHdr);return f&&(a.bytesLeft=parseInt(f)),a}trackTimeout(s){this.timeout=s}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}clearTimers(){var s,a;(s=this.monitor)==null||s.cancel(),this.monitor=null,(a=this.timeout)==null||a.cancel(),this.timeout=null}setCleanupHandler(s){this.cleanupHandler=s}stop(s){var a,c;this.done||((a=this.sub)==null||a.unsubscribe(),this.clearTimers(),(c=this.statusIterator)==null||c.stop(),this._push(()=>{super.stop(s),this.listeners.forEach(f=>{f.stop()})}))}parseOptions(s,a=!1){const c=s||{};if(c.max_messages=c.max_messages||0,c.max_bytes=c.max_bytes||0,c.max_messages!==0&&c.max_bytes!==0)throw new Error("only specify one of max_messages or max_bytes");if(c.max_messages===0&&(c.max_messages=100),c.expires=c.expires||3e4,c.expires<1e3)throw new Error("expires should be at least 1000ms");if(c.idle_heartbeat=c.idle_heartbeat||c.expires/2,c.idle_heartbeat=c.idle_heartbeat>3e4?3e4:c.idle_heartbeat,a){const f=Math.round(c.max_messages*.75)||1;c.threshold_messages=c.threshold_messages||f;const h=Math.round(c.max_bytes*.75)||1;c.threshold_bytes=c.threshold_bytes||h}return c}status(){const s=new _t;return this.listeners.push(s),Promise.resolve(s)}}class C1 extends _t{constructor(){super();v(this,"src");v(this,"listeners");this.listeners=[]}setSource(s){this.src&&(this.src.resetHandler=void 0,this.src.setCleanupHandler(),this.src.stop()),this.src=s,this.src.setCleanupHandler(a=>{this.stop(a||void 0)}),(async()=>{const a=await this.src.status();for await(const c of a)this.notify(c.type,c.data)})().catch(()=>{})}notify(s,a){this.listeners.length>0&&this.listeners.forEach(c=>{c.done||c.push({type:s,data:a})})}stop(s){var a;this.done||((a=this.src)==null||a.stop(s),super.stop(s),this.listeners.forEach(c=>{c.stop()}))}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}status(){const s=new _t;return this.listeners.push(s),Promise.resolve(s)}}class Rf{constructor(n,s){v(this,"api");v(this,"_info");v(this,"stream");v(this,"name");this.api=n,this._info=s,this.stream=s.stream_name,this.name=s.name}consume(n={max_messages:100,expires:3e4}){return Promise.resolve(new hf(this,n,!0))}fetch(n={max_messages:100,expires:3e4}){const s=new hf(this,n,!1),a=Math.round(s.opts.expires*1.05),c=wr(a);return s.closed().catch(()=>{}).finally(()=>{c.cancel()}),c.catch(()=>{s.close().catch()}),s.trackTimeout(c),Promise.resolve(s)}next(n={expires:3e4}){const s=st(),a=n;a.max_messages=1;const c=new hf(this,a,!1),f=Math.round(c.opts.expires*1.05);f>=6e4&&(async()=>{for await(const d of await c.status())if(d.type===qn.HeartbeatsMissed&&d.data>=2){s.reject(new Error("consumer missed heartbeats"));break}})().catch(),(async()=>{for await(const d of c){s.resolve(d);break}})().catch(()=>{});const h=wr(f);return c.closed().then(d=>{d?s.reject(d):s.resolve(null)}).catch(d=>{s.reject(d)}).finally(()=>{h.cancel()}),h.catch(d=>{s.resolve(null),c.close().catch()}),c.trackTimeout(h),s}delete(){const{stream_name:n,name:s}=this._info;return this.api.delete(n,s)}info(n=!1){if(n)return Promise.resolve(this._info);const{stream_name:s,name:a}=this._info;return this.api.info(s,a).then(c=>(this._info=c,this._info))}}class k1{constructor(n,s,a={}){v(this,"api");v(this,"consumerOpts");v(this,"consumer");v(this,"opts");v(this,"cursor");v(this,"stream");v(this,"namePrefix");v(this,"serial");v(this,"currentConsumer");v(this,"userCallback");v(this,"iter");v(this,"type");v(this,"startSeq");v(this,"maxInitialReset");this.api=n,this.stream=s,this.cursor={stream_seq:1,deliver_seq:0},this.namePrefix=Is.next(),typeof a.name_prefix=="string"&&(Bc("name_prefix",a.name_prefix),this.namePrefix=a.name_prefix+this.namePrefix),this.serial=0,this.currentConsumer=null,this.userCallback=null,this.iter=null,this.type=gn.Unset,this.consumerOpts=a,this.maxInitialReset=30,this.startSeq=this.consumerOpts.opt_start_seq||0,this.cursor.stream_seq=this.startSeq>0?this.startSeq-1:0}getConsumerOpts(n){this.serial++;const s=`${this.namePrefix}_${this.serial}`;n=n===0?1:n;const a={name:s,deliver_policy:ft.StartSequence,opt_start_seq:n,ack_policy:vt.None,inactive_threshold:nt(300*1e3),num_replicas:1};return this.consumerOpts.headers_only===!0&&(a.headers_only=!0),Array.isArray(this.consumerOpts.filterSubjects)&&(a.filter_subjects=this.consumerOpts.filterSubjects),typeof this.consumerOpts.filterSubjects=="string"&&(a.filter_subject=this.consumerOpts.filterSubjects),this.consumerOpts.replay_policy&&(a.replay_policy=this.consumerOpts.replay_policy),n===this.startSeq+1&&(a.deliver_policy=this.consumerOpts.deliver_policy||ft.StartSequence,(this.consumerOpts.deliver_policy===ft.LastPerSubject||this.consumerOpts.deliver_policy===ft.New||this.consumerOpts.deliver_policy===ft.Last)&&(delete a.opt_start_seq,a.deliver_policy=this.consumerOpts.deliver_policy),a.deliver_policy===ft.LastPerSubject&&typeof a.filter_subjects>"u"&&typeof a.filter_subject>"u"&&(a.filter_subject=">"),this.consumerOpts.opt_start_time&&(delete a.opt_start_seq,a.deliver_policy=ft.StartTime,a.opt_start_time=this.consumerOpts.opt_start_time),this.consumerOpts.inactive_threshold&&(a.inactive_threshold=nt(this.consumerOpts.inactive_threshold))),a}async resetConsumer(n=0){var h,d,g,y,A;Is.next();const s=this.serial===0;(h=this.consumer)==null||h.delete().catch(()=>{}),n=n===0?1:n,this.cursor.deliver_seq=0;const a=this.getConsumerOpts(n);a.max_deliver=1,a.mem_storage=!0;const c=Ff([((d=this.opts)==null?void 0:d.expires)||3e4]);let f;for(let S=0;;S++)try{f=await this.api.add(this.stream,a),(g=this.iter)==null||g.notify(qn.OrderedConsumerRecreated,f.name);break}catch(j){if(j.message==="stream not found"&&((y=this.iter)==null||y.notify(qn.StreamNotFound,S),this.type===gn.Fetch||this.opts.abort_on_missing_resource===!0))return(A=this.iter)==null||A.stop(j),Promise.reject(j);if(s&&S>=this.maxInitialReset)throw j;await Ar(c.backoff(S+1))}return f}internalHandler(n){return s=>{var c;if(this.serial!==n)return;const a=s.info.deliverySequence;if(a!==this.cursor.deliver_seq+1){this.notifyOrderedResetAndReset();return}this.cursor.deliver_seq=a,this.cursor.stream_seq=s.info.streamSequence,this.userCallback?this.userCallback(s):(c=this.iter)==null||c.push(s)}}async reset(n={max_messages:100,expires:3e4},s){var g,y;s=s||{};const a=s.fromFetch||!1,c=s.orderedReset||!1;if(this.type===gn.Fetch&&c){(g=this.iter)==null||g.src.stop(),await((y=this.iter)==null?void 0:y.closed()),this.currentConsumer=null;return}(this.currentConsumer===null||c)&&(this.currentConsumer=await this.resetConsumer(this.cursor.stream_seq+1)),(this.iter===null||a)&&(this.iter=new C1),this.consumer=new Rf(this.api,this.currentConsumer);const f=n;f.callback=this.internalHandler(this.serial);let h=null;this.type===gn.Fetch&&a?h=await this.consumer.fetch(n):this.type===gn.Consume&&(h=await this.consumer.consume(n));const d=h;d.forOrderedConsumer=!0,d.resetHandler=()=>{this.notifyOrderedResetAndReset()},this.iter.setSource(d)}notifyOrderedResetAndReset(){var n;(n=this.iter)==null||n.notify(_r.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===gn.Fetch)return Promise.reject(new Error("ordered consumer initialized as fetch"));if(this.type===gn.Consume)return Promise.reject(new Error("ordered consumer doesn't support concurrent consume"));const{callback:a}=n;return a&&(this.userCallback=a),this.type=gn.Consume,this.opts=n,await this.reset(n),this.iter}async fetch(n={max_messages:100,expires:3e4}){var c;if(n.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===gn.Consume)return Promise.reject(new Error("ordered consumer already initialized as consume"));if(((c=this.iter)==null?void 0:c.done)===!1)return Promise.reject(new Error("ordered consumer doesn't support concurrent fetch"));const{callback:a}=n;return a&&(this.userCallback=a),this.type=gn.Fetch,this.opts=n,await this.reset(n,{fromFetch:!0}),this.iter}async next(n={expires:3e4}){const s=n;if(s.bind)return Promise.reject(new Error("bind is not supported"));s.max_messages=1;const a=st();return s.callback=f=>{this.userCallback=null,a.resolve(f)},(await this.fetch(s)).iterClosed.then(f=>{f&&a.reject(f),a.resolve(null)}).catch(f=>{a.reject(f)}),a}delete(){return this.currentConsumer?this.api.delete(this.stream,this.currentConsumer.name).then(n=>Promise.resolve(n)).catch(n=>Promise.reject(n)).finally(()=>{this.currentConsumer=null}):Promise.resolve(!1)}async info(n){return this.currentConsumer==null?(this.currentConsumer=await this.resetConsumer(this.startSeq),Promise.resolve(this.currentConsumer)):n&&this.currentConsumer?Promise.resolve(this.currentConsumer):this.api.info(this.stream,this.currentConsumer.name)}}class Df{constructor(n){v(this,"api");v(this,"notified");this.api=n,this.notified=!1}checkVersion(){const n=this.api.nc.features.get(De.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 Rf(this.api,n)}async get(n,s={}){return typeof s=="object"?this.ordered(n,s):(await this.checkVersion(),this.api.info(n,s).then(a=>a.config.deliver_subject!==void 0?Promise.reject(new Error("push consumer not supported")):new Rf(this.api,a)).catch(a=>Promise.reject(a)))}async ordered(n,s){await this.checkVersion();const a=this.api;return new Kf(a.nc,a.opts).info(n).then(f=>Promise.resolve(new k1(this.api,n,s))).catch(f=>Promise.reject(f))}}class Hc{constructor(n,s){v(this,"api");v(this,"_info");this.api=n,this._info=s}get name(){return this._info.config.name}alternates(){return this.info().then(n=>n.alternates?n.alternates:[])}async best(){if(await this.info(),this._info.alternates){const n=await this.api.info(this._info.alternates[0].name);return new Hc(this.api,n)}else return this}info(n=!1,s){return n?Promise.resolve(this._info):this.api.info(this.name,s).then(a=>(this._info=a,this._info))}getConsumerFromInfo(n){return new Df(new Cc(this.api.nc,this.api.opts)).getPullConsumerFor(n)}getConsumer(n){return new Df(new Cc(this.api.nc,this.api.opts)).get(this.name,n)}getMessage(n){return this.api.getMessage(this.name,n)}deleteMessage(n,s){return this.api.deleteMessage(this.name,n,s)}}class Kf extends Ha{constructor(n,s){super(n,s)}checkStreamConfigVersions(n){const s=this.nc;if(n.metadata){const{min:c,ok:f}=s.features.get(De.JS_STREAM_CONSUMER_METADATA);if(!f)throw new Error(`stream 'metadata' requires server ${c}`)}if(n.first_seq){const{min:c,ok:f}=s.features.get(De.JS_STREAM_FIRST_SEQ);if(!f)throw new Error(`stream 'first_seq' requires server ${c}`)}if(n.subject_transform){const{min:c,ok:f}=s.features.get(De.JS_STREAM_SUBJECT_TRANSFORM);if(!f)throw new Error(`stream 'subject_transform' requires server ${c}`)}if(n.compression){const{min:c,ok:f}=s.features.get(De.JS_STREAM_COMPRESSION);if(!f)throw new Error(`stream 'compression' requires server ${c}`)}if(n.consumer_limits){const{min:c,ok:f}=s.features.get(De.JS_DEFAULT_CONSUMER_LIMITS);if(!f)throw new Error(`stream 'consumer_limits' requires server ${c}`)}function a(c,f){var d;if((((d=f==null?void 0:f.subject_transforms)==null?void 0:d.length)||0)>0){const{min:g,ok:y}=s.features.get(De.JS_STREAM_SOURCE_SUBJECT_TRANSFORM);if(!y)throw new Error(`${c} 'subject_transforms' requires server ${g}`)}}n.sources&&n.sources.forEach(c=>{a("stream sources",c)}),n.mirror&&a("stream mirror",n.mirror)}async add(n={}){var c;this.checkStreamConfigVersions(n),Mt(n.name),n.mirror=dc(n.mirror),n.sources=(c=n.sources)==null?void 0:c.map(dc);const a=await this._request(`${this.prefix}.STREAM.CREATE.${n.name}`,n);return this._fixInfo(a),a}async delete(n){return Mt(n),(await this._request(`${this.prefix}.STREAM.DELETE.${n}`)).success}async update(n,s={}){var d;if(typeof n=="object"){const g=n;n=g.name,s=g,console.trace("\x1B[33m >> streams.update(config: StreamConfig) api changed to streams.update(name: string, config: StreamUpdateConfig) - this shim will be removed - update your code. \x1B[0m")}this.checkStreamConfigVersions(s),Mt(n);const a=await this.info(n),c=Object.assign(a.config,s);c.mirror=dc(c.mirror),c.sources=(d=c.sources)==null?void 0:d.map(dc);const h=await this._request(`${this.prefix}.STREAM.UPDATE.${n}`,c);return this._fixInfo(h),h}async info(n,s){Mt(n);const a=`${this.prefix}.STREAM.INFO.${n}`;let f=await this._request(a,s),{total:h,limit:d}=f,g=f.state.subjects?Object.getOwnPropertyNames(f.state.subjects).length:1;if(h&&h>g){const y=[f],A=s||{};let S=0;for(;h>g;){S++,A.offset=d*S;const z=await this._request(a,A);h=z.total,y.push(z);const R=Object.getOwnPropertyNames(z.state.subjects).length;if(g+=R,R<d)break}let j={};for(let z=0;z<y.length;z++)f=y[z],f.state.subjects&&(j=Object.assign(j,f.state.subjects));f.offset=0,f.total=0,f.limit=0,f.state.subjects=j}return this._fixInfo(f),f}list(n=""){const s=n!=null&&n.length?{subject:n}:{},a=f=>{const h=f;return h.streams.forEach(d=>{this._fixInfo(d)}),h.streams},c=`${this.prefix}.STREAM.LIST`;return new Ta(c,a,this,s)}_fixInfo(n){n.config.sealed=n.config.sealed||!1,n.config.deny_delete=n.config.deny_delete||!1,n.config.deny_purge=n.config.deny_purge||!1,n.config.allow_rollup_hdrs=n.config.allow_rollup_hdrs||!1}async purge(n,s){if(s){const{keep:c,seq:f}=s;if(typeof c=="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}`,s)}async deleteMessage(n,s,a=!0){Mt(n);const c={seq:s};return a||(c.no_erase=!0),(await this._request(`${this.prefix}.STREAM.MSG.DELETE.${n}`,c)).success}async getMessage(n,s){Mt(n);const c=await this._request(`${this.prefix}.STREAM.MSG.GET.${n}`,s);return new Eg(c)}find(n){return this.findStream(n)}listKvs(){const n=a=>{var g;const f=a.streams.filter(y=>y.config.name.startsWith(Zt));f.forEach(y=>{this._fixInfo(y)});let h="";return f.length&&(h=((g=this.nc.info)==null?void 0:g.cluster)??""),f.map(y=>new Sg(y,h))},s=`${this.prefix}.STREAM.LIST`;return new Ta(s,n,this)}listObjectStores(){const n=a=>{const f=a.streams.filter(d=>d.config.name.startsWith(If));return f.forEach(d=>{this._fixInfo(d)}),f.map(d=>new Mf(d))},s=`${this.prefix}.STREAM.LIST`;return new Ta(s,n,this)}names(n=""){const s=n!=null&&n.length?{subject:n}:{},a=f=>f.streams,c=`${this.prefix}.STREAM.NAMES`;return new Ta(c,a,this,s)}async get(n){const s=await this.info(n);return Promise.resolve(new Hc(this,s))}}class M1 extends Ha{constructor(n,s){super(n,s)}async getMessage(n,s){Mt(n);let a=s;const{last_by_subj:c}=a;c&&(a=null);const f=a?this.jc.encode(a):tn,h=this.opts.apiPrefix||"$JS.API",d=c?`${h}.DIRECT.GET.${n}.${c}`:`${h}.DIRECT.GET.${n}`,g=await this.nc.request(d,f,{timeout:this.timeout}),y=xr(g);if(y)return Promise.reject(y);const A=new zf(g);return Promise.resolve(A)}async getBatch(n,s){Mt(n);const c=`${this.opts.apiPrefix||"$JS.API"}.DIRECT.GET.${n}`;if(!Array.isArray(s.multi_last)||s.multi_last.length===0)return Promise.reject("multi_last is required");const f=JSON.stringify(s,(g,y)=>g==="up_to_time"&&y instanceof Date?y.toISOString():y),h=new _t,d=await this.nc.requestMany(c,f,{strategy:jn.SentinelMsg});return(async()=>{var S,j,z;let g=!1,y=!1,A;for await(const R of d){if(!g){g=!0;const H=((S=R.headers)==null?void 0:S.code)||0;if(H!==0&&H<200||H>299){A=(j=R.headers)==null?void 0:j.description.toLowerCase();break}if(((z=R.headers)==null?void 0:z.get("Nats-Num-Pending"))===""){y=!0;break}}if(R.data.length===0)break;h.push(new zf(R))}h.push(()=>{if(y)throw new Error("batch direct get not supported by the server");if(A)throw new Error(`bad request: ${A}`);h.stop()})})(),Promise.resolve(h)}}class zf{constructor(n){v(this,"data");v(this,"header");if(!n.headers)throw new Error("headers expected");this.data=n.data,this.header=n.headers}get subject(){return this.header.last(gr.Subject)}get seq(){const n=this.header.last(gr.Sequence);return typeof n=="string"?parseInt(n):0}get time(){return new Date(Date.parse(this.timestamp))}get timestamp(){return this.header.last(gr.TimeStamp)}get stream(){return this.header.last(gr.Stream)}json(n){return Tn(n).decode(this.data)}string(){return Wt.decode(this.data)}}v(zf,"jc");class R1 extends Ha{constructor(s,a){super(s,a);v(this,"streams");v(this,"consumers");v(this,"direct");this.streams=new Kf(s,a),this.consumers=new Cc(s,a),this.direct=new M1(s,a)}async getAccountInfo(){return await this._request(`${this.prefix}.INFO`)}jetstream(){return this.nc.jetstream(this.getOptions())}advisories(){const s=new _t;return this.nc.subscribe("$JS.EVENT.ADVISORY.>",{callback:(a,c)=>{if(a)throw a;try{const f=this.parseJsResponse(c),h=f.type.split("."),d=h[h.length-1];s.push({kind:d,data:f})}catch(f){s.stop(f)}}}),s}}class Eg{constructor(n){v(this,"_header");v(this,"smr");this.smr=n}get subject(){return this.smr.message.subject}get seq(){return this.smr.message.seq}get timestamp(){return this.smr.message.time}get time(){return new Date(Date.parse(this.timestamp))}get data(){return this.smr.message.data?this._parse(this.smr.message.data):tn}get header(){if(!this._header)if(this.smr.message.hdrs){const n=this._parse(this.smr.message.hdrs);this._header=Js.decode(n)}else this._header=os();return this._header}_parse(n){const s=atob(n),a=s.length,c=new Uint8Array(a);for(let f=0;f<a;f++)c[f]=s.charCodeAt(f);return c}json(n){return Tn(n).decode(this.data)}string(){return Wt.decode(this.data)}}v(Eg,"jc");class D1{constructor(n){v(this,"api");this.api=n}get(n){return this.api.info(n).then(s=>new Hc(this.api,s))}}class df{constructor(n){v(this,"info");v(this,"hdrs");this.info=n}get name(){return this.info.name}get description(){return this.info.description??""}get headers(){return this.hdrs||(this.hdrs=Js.fromRecord(this.info.headers||{})),this.hdrs}get options(){return this.info.options}get bucket(){return this.info.bucket}get chunks(){return this.info.chunks}get deleted(){return this.info.deleted??!1}get digest(){return this.info.digest}get mtime(){return this.info.mtime}get nuid(){return this.info.nuid}get size(){return this.info.size}get revision(){return this.info.revision}get metadata(){return this.info.metadata||{}}isLink(){var n,s;return((n=this.info.options)==null?void 0:n.link)!==void 0&&((s=this.info.options)==null?void 0:s.link)!==null}}function E0(r){const n={name:r.name,description:r.description??"",options:r.options,metadata:r.metadata};if(r.headers){const s=r.headers;n.headers=s.toRecord()}return n}function z1(){return new ReadableStream({pull(r){r.enqueue(new Uint8Array(0)),r.close()}})}class Ra{constructor(n,s,a){v(this,"jsm");v(this,"js");v(this,"stream");v(this,"name");this.name=n,this.jsm=s,this.js=a}_checkNotEmpty(n){return!n||n.length===0?{name:n,error:new Error("name cannot be empty")}:{name:n}}async info(n){const s=await this.rawInfo(n);return s?new df(s):null}async list(){const n=[],s=await this.watch({ignoreDeletes:!0,includeHistory:!0});for await(const a of s){if(a===null)break;n.push(a)}return Promise.resolve(n)}async rawInfo(n){const{name:s,error:a}=this._checkNotEmpty(n);if(a)return Promise.reject(a);const c=this._metaSubject(s);try{const f=await this.jsm.streams.getMessage(this.stream,{last_by_subj:c}),d=Tn().decode(f.data);return d.revision=f.seq,d}catch(f){return f.code==="404"?null:Promise.reject(f)}}async _si(n){try{return await this.jsm.streams.info(this.stream,n)}catch(s){return s.code==="404"?null:Promise.reject(s)}}async seal(){let n=await this._si();return n===null?Promise.reject(new Error("object store not found")):(n.config.sealed=!0,n=await this.jsm.streams.update(this.stream,n.config),Promise.resolve(new Mf(n)))}async status(n){const s=await this._si(n);return s===null?Promise.reject(new Error("object store not found")):Promise.resolve(new Mf(s))}destroy(){return this.jsm.streams.delete(this.stream)}async _put(n,s,a){var be;const c=this.js.getOptions();a=a||{timeout:c.timeout},a.timeout=a.timeout||c.timeout,a.previousRevision=a.previousRevision??void 0;const{timeout:f,previousRevision:h}=a,d=this.js.nc.info,g=(d==null?void 0:d.max_payload)||1024;n=n||{},n.options=n.options||{};let y=((be=n.options)==null?void 0:be.max_chunk_size)||128*1024;y=y>g?g:y,n.options.max_chunk_size=y;const A=await this.info(n.name),{name:S,error:j}=this._checkNotEmpty(n.name);if(j)return Promise.reject(j);const z=Is.next(),R=this._chunkSubject(z),H=this._metaSubject(S),ee=Object.assign({bucket:this.name,nuid:z,size:0,chunks:0},E0(n)),ne=st(),W=[],me=new Er;try{const k=s?s.getReader():null,I=d0.create();for(;;){const{done:ie,value:Z}=k?await k.read():{done:!0,value:void 0};if(ie){if(me.size()>0){const re=me.drain();I.update(re),ee.chunks++,ee.size+=re.length,W.push(this.js.publish(R,re,{timeout:f}))}await Promise.all(W),W.length=0,ee.mtime=new Date().toISOString();const Q=vr.encode(I.digest());ee.digest=`${w0}${Q}`,ee.deleted=!1;const K=os();typeof h=="number"&&K.set(zn.ExpectedLastSubjectSequenceHdr,`${h}`),K.set(Dt.RollupHdr,Dt.RollupValueSubject);const ae=await this.js.publish(H,Tn().encode(ee),{headers:K,timeout:f});if(ee.revision=ae.seq,A)try{await this.jsm.streams.purge(this.stream,{filter:`$O.${this.name}.C.${A.nuid}`})}catch{}ne.resolve(new df(ee));break}if(Z)for(me.fill(Z);me.size()>y;){ee.chunks++,ee.size+=y;const Q=me.drain(n.options.max_chunk_size);I.update(Q),W.push(this.js.publish(R,Q,{timeout:f}))}}}catch(k){await this.jsm.streams.purge(this.stream,{filter:R}),ne.reject(k)}return ne}putBlob(n,s,a){function c(f){return new ReadableStream({pull(h){h.enqueue(f),h.close()}})}return s===null&&(s=new Uint8Array(0)),this.put(n,c(s),a)}put(n,s,a){var c;return(c=n==null?void 0:n.options)!=null&&c.link?Promise.reject(new Error("link cannot be set when putting the object in bucket")):this._put(n,s,a)}async getBlob(n){async function s(f){const h=new Er,d=f.getReader();for(;;){const{done:g,value:y}=await d.read();if(g)return h.drain();y&&y.length&&h.fill(y)}}const a=await this.get(n);if(a===null)return Promise.resolve(null);const c=await Promise.all([a.error,s(a.data)]);return c[0]?Promise.reject(c[0]):Promise.resolve(c[1])}async get(n){const s=await this.rawInfo(n);if(s===null||s.deleted)return Promise.resolve(null);if(s.options&&s.options.link){const S=s.options.link.name||"";if(S==="")throw new Error("link is a bucket");return(s.options.link.bucket!==this.name?await Ra.create(this.js,s.options.link.bucket):this).get(S)}if(!s.digest.startsWith(w0))return Promise.reject(new Error(`unknown digest type: ${s.digest}`));const a=jf(s.digest.substring(8));if(a===null)return Promise.reject(new Error(`unable to parse digest: ${s.digest}`));const c=st(),f={info:new df(s),error:c};if(s.size===0)return f.data=z1(),c.resolve(null),Promise.resolve(f);let h;const d=Qs();d.orderedConsumer();const g=d0.create(),y=`$O.${this.name}.C.${s.nuid}`,A=await this.js.subscribe(y,d);return(async()=>{for await(const S of A)S.data.length>0&&(g.update(S.data),h.enqueue(S.data)),S.info.pending===0&&(Sv(a,g.digest())?h.close():h.error(new Error(`received a corrupt object, digests do not match received: ${s.digest} calculated ${a}`)),A.unsubscribe())})().then(()=>{c.resolve()}).catch(S=>{h.error(S),c.reject(S)}),f.data=new ReadableStream({start(S){h=S},cancel(){A.unsubscribe()}}),f}linkStore(n,s){if(!(s instanceof Ra))return Promise.reject("bucket required");const a=s,{name:c,error:f}=this._checkNotEmpty(n);if(f)return Promise.reject(f);const h={name:c,options:{link:{bucket:a.name}}};return this._put(h,null)}async link(n,s){const{name:a,error:c}=this._checkNotEmpty(n);if(c)return Promise.reject(c);if(s.deleted)return Promise.reject(new Error("src object is deleted"));if(s.isLink())return Promise.reject(new Error("src object is a link"));const f=await this.rawInfo(n);if(f!==null&&!f.deleted)return Promise.reject(new Error("an object already exists with that name"));const h={bucket:s.bucket,name:s.name},d={name:a,bucket:s.bucket,options:{link:h}};await this.js.publish(this._metaSubject(n),JSON.stringify(d));const g=await this.info(n);return Promise.resolve(g)}async delete(n){const s=await this.rawInfo(n);if(s===null)return Promise.resolve({purged:0,success:!1});s.deleted=!0,s.size=0,s.chunks=0,s.digest="";const a=Tn(),c=os();return c.set(Dt.RollupHdr,Dt.RollupValueSubject),await this.js.publish(this._metaSubject(s.name),a.encode(s),{headers:c}),this.jsm.streams.purge(this.stream,{filter:this._chunkSubject(s.nuid)})}async update(n,s={}){const a=await this.rawInfo(n);if(a===null)return Promise.reject(new Error("object not found"));if(a.deleted)return Promise.reject(new Error("cannot update meta for a deleted object"));s.name=s.name??a.name;const{name:c,error:f}=this._checkNotEmpty(s.name);if(f)return Promise.reject(f);if(n!==s.name){const g=await this.info(s.name);if(g&&!g.deleted)return Promise.reject(new Error("an object already exists with that name"))}s.name=c;const h=Object.assign({},a,E0(s)),d=await this.js.publish(this._metaSubject(h.name),JSON.stringify(h));return n!==s.name&&await this.jsm.streams.purge(this.stream,{filter:this._metaSubject(n)}),Promise.resolve(d)}async watch(n={}){n.includeHistory=n.includeHistory??!1,n.ignoreDeletes=n.ignoreDeletes??!1;let s=!1;const a=new _t,c=this._metaSubjectAll();try{await this.jsm.streams.getMessage(this.stream,{last_by_subj:c})}catch(g){g.code==="404"?(a.push(null),s=!0):a.stop(g)}const f=Tn(),h=Qs();h.orderedConsumer(),n.includeHistory?h.deliverLastPerSubject():(s=!0,h.deliverNew()),h.callback((g,y)=>{var A;if(g){a.stop(g);return}if(y!==null){const S=f.decode(y.data);S.deleted&&n.ignoreDeletes===!0||a.push(S),((A=y.info)==null?void 0:A.pending)===0&&!s&&(s=!0,a.push(null))}});const d=await this.js.subscribe(c,h);return a._data=d,a.iterClosed.then(()=>{d.unsubscribe()}),d.closed.then(()=>{a.stop()}).catch(g=>{a.stop(g)}),a}_chunkSubject(n){return`$O.${this.name}.C.${n}`}_metaSubject(n){return`$O.${this.name}.M.${vr.encode(n)}`}_metaSubjectAll(){return`$O.${this.name}.M.>`}async init(n={}){try{this.stream=E1(this.name)}catch(c){return Promise.reject(c)}const s=(n==null?void 0:n.ttl)||0;delete n.ttl;const a=Object.assign({max_age:s},n);a.name=this.stream,a.num_replicas=n.replicas??1,a.allow_direct=!0,a.allow_rollup_hdrs=!0,a.discard=za.New,a.subjects=[`$O.${this.name}.C.>`,`$O.${this.name}.M.>`],n.placement&&(a.placement=n.placement),n.metadata&&(a.metadata=n.metadata),typeof n.compression=="boolean"&&(a.compression=n.compression?Ks.S2:Ks.None);try{await this.jsm.streams.info(a.name)}catch(c){c.message==="stream not found"&&await this.jsm.streams.add(a)}}static async create(n,s,a={}){const c=await n.jetstreamManager(),f=new Ra(s,c,n);return await f.init(a),Promise.resolve(f)}}class q1{constructor(n){v(this,"js");this.js=n}kv(n,s={}){const a=this.js,{ok:c,min:f}=a.nc.features.get(De.JS_KV);return c?s.bindOnly?Ua.bind(this.js,n,s):Ua.create(this.js,n,s):Promise.reject(new Error(`kv is only supported on servers ${f} or better`))}os(n,s={}){var h;if(typeof((h=crypto==null?void 0:crypto.subtle)==null?void 0:h.digest)!="function")return Promise.reject(new Error("objectstore: unable to calculate hashes - crypto.subtle.digest with sha256 support is required"));const a=this.js,{ok:c,min:f}=a.nc.features.get(De.JS_OBJECTSTORE);return c?Ra.create(this.js,n,s):Promise.reject(new Error(`objectstore is only supported on servers ${f} or better`))}}class Zf extends Ha{constructor(s,a){super(s,a);v(this,"consumers");v(this,"streams");v(this,"consumerAPI");v(this,"streamAPI");this.consumerAPI=new Cc(s,a),this.streamAPI=new Kf(s,a),this.consumers=new Df(this.consumerAPI),this.streams=new D1(this.streamAPI)}jetstreamManager(s){s===void 0&&(s=this.opts.checkAPI);const a=Object.assign({},this.opts,{checkAPI:s});return this.nc.jetstreamManager(a)}get apiPrefix(){return this.prefix}get views(){return new q1(this)}async publish(s,a=tn,c){c=c||{},c.expect=c.expect||{};const f=(c==null?void 0:c.headers)||os();c&&(c.msgID&&f.set(zn.MsgIdHdr,c.msgID),c.expect.lastMsgID&&f.set(zn.ExpectedLastMsgIdHdr,c.expect.lastMsgID),c.expect.streamName&&f.set(zn.ExpectedStreamHdr,c.expect.streamName),typeof c.expect.lastSequence=="number"&&f.set(zn.ExpectedLastSeqHdr,`${c.expect.lastSequence}`),typeof c.expect.lastSubjectSequence=="number"&&f.set(zn.ExpectedLastSubjectSequenceHdr,`${c.expect.lastSubjectSequence}`));const h=c.timeout||this.timeout,d={};h&&(d.timeout=h),c&&(d.headers=f);let{retries:g,retry_delay:y}=c;g=g||1,y=y||250;let A;for(let j=0;j<g;j++)try{A=await this.nc.request(s,a,d);break}catch(z){if(z.code==="503"&&j+1<g)await Ar(y);else throw z}const S=this.parseJsResponse(A);if(S.stream==="")throw oe.errorForCode(se.JetStreamInvalidAck);return S.duplicate=S.duplicate?S.duplicate:!1,S}async pull(s,a,c=0){Mt(s),br(a);let f=this.timeout;c>f&&(f=c),c=c<0?0:nt(c);const h={batch:1,no_wait:c===0,expires:c},d=await this.nc.request(`${this.prefix}.CONSUMER.MSG.NEXT.${s}.${a}`,this.jc.encode(h),{noMux:!0,timeout:f}),g=xr(d);if(g)throw g;return Ba(d,this.timeout)}fetch(s,a,c={}){Mt(s),br(a);let f=null;const h=(c.max_bytes??0)>0;let d=0;const g=h?c.max_bytes:0;let y=null;const A={};if(A.batch=c.batch||1,g){const W=this.nc.features.get(De.JS_PULL_MAX_BYTES);if(!W.ok)throw new Error(`max_bytes is only supported on servers ${W.min} or better`);A.max_bytes=g}A.no_wait=c.no_wait||!1,A.no_wait&&A.expires&&(A.expires=0);const S=c.expires||0;if(S&&(A.expires=nt(S)),S===0&&A.no_wait===!1)throw new Error("expires or no_wait is required");const j=c.idle_heartbeat||0;j&&(A.idle_heartbeat=nt(j),c.delay_heartbeat===!0&&(A.idle_heartbeat=nt(j*4)));const z=new _t,R=A.batch;let H=0;z.protocolFilterFn=(W,me=!1)=>Ef(W.msg)?(y==null||y.work(),!1):!0,z.dispatchedFn=W=>{if(W){if(h&&(d+=W.data.length),H++,f&&W.info.pending===0)return;(z.getPending()===1&&W.info.pending===0||R===H||g>0&&d>=g)&&z.stop()}};const ee=cs(this.nc.options.inboxPrefix),ne=this.nc.subscribe(ee,{max:c.batch,callback:(W,me)=>{W===null&&(W=xr(me)),W!==null?(f&&(f.cancel(),f=null),iv(W)?z.stop(Og(W)===null?void 0:W):z.stop(W)):(y==null||y.work(),z.received++,z.push(Ba(me,this.timeout)))}});return S&&(f=wr(S),f.catch(()=>{ne.isClosed()||(ne.drain().catch(()=>{}),f=null),y&&y.cancel()})),(async()=>{try{j&&(y=new Xf(j,W=>(z.push(()=>{z.err=new oe(`${yn.IdleHeartbeatMissed}: ${W}`,se.JetStreamIdleHeartBeat)}),!0)))}catch{}await ne.closed,f!==null&&(f.cancel(),f=null),y&&y.cancel(),z.stop()})().catch(),this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${s}.${a}`,this.jc.encode(A),{reply:ee}),z}async pullSubscribe(s,a=Qs()){const c=await this._processOptions(s,a);if(c.ordered)throw new Error("pull subscribers cannot be be ordered");if(c.config.deliver_subject)throw new Error("consumer info specifies deliver_subject - pull consumers cannot have deliver_subject set");const f=c.config.ack_policy;if(f===vt.None||f===vt.All)throw new Error("ack policy for pull consumers must be explicit");const h=this._buildTypedSubscriptionOpts(c),d=new H1(this,c.deliver,h);d.info=c;try{await this._maybeCreateConsumer(c)}catch(g){throw d.unsubscribe(),g}return d}async subscribe(s,a=Qs()){const c=await this._processOptions(s,a);if(!c.isBind&&!c.config.deliver_subject)throw new Error("push consumer requires deliver_subject");const f=this._buildTypedSubscriptionOpts(c),h=new Ag(this,c.deliver,f);h.info=c;try{await this._maybeCreateConsumer(c)}catch(d){throw h.unsubscribe(),d}return h._maybeSetupHbMonitoring(),h}async _processOptions(s,a=Qs()){const c=o0(a)?a.getOpts():a;if(c.isBind=o0(a)?a.isBind:!1,c.flow_control={heartbeat_count:0,fc_count:0,consumer_restarts:0},c.ordered){if(c.ordered_consumer_sequence={stream_seq:0,delivery_seq:0},c.config.ack_policy!==vt.NotSet&&c.config.ack_policy!==vt.None)throw new oe("ordered consumer: ack_policy can only be set to 'none'",se.ApiError);if(c.config.durable_name&&c.config.durable_name.length>0)throw new oe("ordered consumer: durable_name cannot be set",se.ApiError);if(c.config.deliver_subject&&c.config.deliver_subject.length>0)throw new oe("ordered consumer: deliver_subject cannot be set",se.ApiError);if(c.config.max_deliver!==void 0&&c.config.max_deliver>1)throw new oe("ordered consumer: max_deliver cannot be set",se.ApiError);if(c.config.deliver_group&&c.config.deliver_group.length>0)throw new oe("ordered consumer: deliver_group cannot be set",se.ApiError);c.config.deliver_subject=cs(this.nc.options.inboxPrefix),c.config.ack_policy=vt.None,c.config.max_deliver=1,c.config.flow_control=!0,c.config.idle_heartbeat=c.config.idle_heartbeat||nt(5e3),c.config.ack_wait=nt(1320*60*1e3),c.config.mem_storage=!0,c.config.num_replicas=1}if(c.config.ack_policy===vt.NotSet&&(c.config.ack_policy=vt.All),c.api=this,c.config=c.config||{},c.stream=c.stream?c.stream:await this.findStream(s),c.attached=!1,c.config.durable_name)try{const f=await this.consumerAPI.info(c.stream,c.config.durable_name);if(f){if(f.config.filter_subject&&f.config.filter_subject!==s)throw new Error("subject does not match consumer");const h=c.config.deliver_group??"";if(h===""&&f.push_bound===!0)throw new Error("duplicate subscription");const d=f.config.deliver_group??"";if(h!==d)throw d===""?new Error("durable requires no queue group"):new Error(`durable requires queue group '${d}'`);c.last=f,c.config=f.config,c.attached=!0,c.config.durable_name||(c.name=f.name)}}catch(f){if(f.code!=="404")throw f}return!c.attached&&c.config.filter_subject===void 0&&c.config.filter_subjects===void 0&&(c.config.filter_subject=s),c.deliver=c.config.deliver_subject||cs(this.nc.options.inboxPrefix),c}_buildTypedSubscriptionOpts(s){const a={};return a.adapter=P1(s.callbackFn===void 0,this.timeout),a.ingestionFilterFn=Zf.ingestionFn(s.ordered),a.protocolFilterFn=(c,f=!1)=>{const h=c;return Sf(h.msg)?(f||h.msg.respond(),!1):!0},!s.mack&&s.config.ack_policy!==vt.None&&(a.dispatchedFn=G1),s.callbackFn&&(a.callback=s.callbackFn),a.max=s.max||0,a.queue=s.queue,a}async _maybeCreateConsumer(s){if(s.attached)return;if(s.isBind)throw new Error(`unable to bind - durable consumer ${s.config.durable_name} doesn't exist in ${s.stream}`);s.config=Object.assign({deliver_policy:ft.All,ack_policy:vt.Explicit,ack_wait:nt(30*1e3),replay_policy:Sr.Instant},s.config);const a=await this.consumerAPI.add(s.stream,s.config);if(Array.isArray(s.config.filter_subjects&&!Array.isArray(a.config.filter_subjects)))throw new Error("jetstream server doesn't support consumers with multiple filter subjects");s.name=a.name,s.config=a.config,s.last=a}static ingestionFn(s){return(a,c)=>{var g;const f=c;if(!a)return{ingest:!1,protocol:!1};const h=a;if(xr(h.msg)||(g=f.monitor)==null||g.work(),Ef(h.msg)){const y=s?f._checkHbOrderConsumer(h.msg):!0;return s||f.info.flow_control.heartbeat_count++,{ingest:y,protocol:!0}}else if(Sf(h.msg))return f.info.flow_control.fc_count++,{ingest:!0,protocol:!0};return{ingest:s?f._checkOrderedConsumer(a):!0,protocol:!1}}}}class Wf{constructor(n){v(this,"options");v(this,"protocol");v(this,"draining");v(this,"listeners");v(this,"_services");this.draining=!1,this.options=r1(n),this.listeners=[]}static connect(n={}){return new Promise((s,a)=>{const c=new Wf(n);Mc.connect(c.options,c).then(f=>{c.protocol=f,(async function(){for await(const h of f.status())c.listeners.forEach(d=>{d.push(h)})})(),s(c)}).catch(f=>{a(f)})})}closed(){return this.protocol.closed}async close(){await this.protocol.close()}_check(n,s,a){if(this.isClosed())throw oe.errorForCode(se.ConnectionClosed);if(s&&this.isDraining()||a&&this.protocol.noMorePublishing)throw oe.errorForCode(se.ConnectionDraining);if(n=n||"",n.length===0)throw oe.errorForCode(se.BadSubject)}publish(n,s,a){this._check(n,!1,!0),this.protocol.publish(n,s,a)}publishMessage(n){return this.publish(n.subject,n.data,{reply:n.reply,headers:n.headers})}respondMessage(n){return n.reply?(this.publish(n.reply,n.data,{reply:n.reply,headers:n.headers}),!0):!1}subscribe(n,s={}){this._check(n,!0,!1);const a=new _g(this.protocol,n,s);return this.protocol.subscribe(a),a}_resub(n,s,a){this._check(s,!0,!1);const c=n;c.max=a,a&&(c.max=a+c.received),this.protocol.resub(c,s)}requestMany(n,s=tn,a={maxWait:1e3,maxMessages:-1}){const c=!this.protocol.options.noAsyncTraces;try{this._check(n,!0,!0)}catch(g){return Promise.reject(g)}if(a.strategy=a.strategy||jn.Timer,a.maxWait=a.maxWait||1e3,a.maxWait<1)return Promise.reject(new oe("timeout",se.InvalidOption));const f=new _t;function h(g){f.push(()=>{f.stop(g)})}function d(g,y){g||y===null?h(g===null?void 0:g):f.push(y)}if(a.noMux){const g=c?new Error().stack:null;let y=typeof a.maxMessages=="number"&&a.maxMessages>0?a.maxMessages:-1;const A=this.subscribe(cs(this.options.inboxPrefix),{callback:(R,H)=>{var ee,ne;if(((ee=H==null?void 0:H.data)==null?void 0:ee.length)===0&&((ne=H==null?void 0:H.headers)==null?void 0:ne.status)===se.NoResponders&&(R=oe.errorForCode(se.NoResponders)),R){g&&(R.stack+=`
48
+
49
+ ${g}`),S(R);return}d(null,H),a.strategy===jn.Count&&(y--,y===0&&S()),a.strategy===jn.JitterTimer&&(z(),j=setTimeout(()=>{S()},300)),a.strategy===jn.SentinelMsg&&H&&H.data.length===0&&S()}});A.requestSubject=n,A.closed.then(()=>{h()}).catch(R=>{f.stop(R)});const S=R=>{R&&f.push(()=>{throw R}),z(),A.drain().then(()=>{h()}).catch(H=>{h()})};f.iterClosed.then(()=>{z(),A==null||A.unsubscribe()}).catch(R=>{z(),A==null||A.unsubscribe()});try{this.publish(n,s,{reply:A.getSubject()})}catch(R){S(R)}let j=setTimeout(()=>{S()},a.maxWait);const z=()=>{j&&clearTimeout(j)}}else{const g=a;g.callback=d,f.iterClosed.then(()=>{y.cancel()}).catch(A=>{y.cancel(A)});const y=new Ev(this.protocol.muxSubscriptions,n,g);this.protocol.request(y);try{this.publish(n,s,{reply:`${this.protocol.muxSubscriptions.baseInbox}${y.token}`,headers:a.headers})}catch(A){y.cancel(A)}}return Promise.resolve(f)}request(n,s,a={timeout:1e3,noMux:!1}){try{this._check(n,!0,!0)}catch(f){return Promise.reject(f)}const c=!this.protocol.options.noAsyncTraces;if(a.timeout=a.timeout||1e3,a.timeout<1)return Promise.reject(new oe("timeout",se.InvalidOption));if(!a.noMux&&a.reply)return Promise.reject(new oe("reply can only be used with noMux",se.InvalidOption));if(a.noMux){const f=a.reply?a.reply:cs(this.options.inboxPrefix),h=st(),d=c?new Error:null,g=this.subscribe(f,{max:1,timeout:a.timeout,callback:(y,A)=>{y?(d&&y.code!==se.Timeout&&(y.stack+=`
50
+
51
+ ${d.stack}`),g.unsubscribe(),h.reject(y)):(y=hg(A),y?(d&&(y.stack+=`
52
+
53
+ ${d.stack}`),h.reject(y)):h.resolve(A))}});return g.requestSubject=n,this.protocol.publish(n,s,{reply:f,headers:a.headers}),h}else{const f=new pg(this.protocol.muxSubscriptions,n,a,c);this.protocol.request(f);try{this.publish(n,s,{reply:`${this.protocol.muxSubscriptions.baseInbox}${f.token}`,headers:a.headers})}catch(d){f.cancel(d)}const h=Promise.race([f.timer,f.deferred]);return h.catch(()=>{f.cancel()}),h}}flush(){return this.isClosed()?Promise.reject(oe.errorForCode(se.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(oe.errorForCode(se.ConnectionClosed)):this.isDraining()?Promise.reject(oe.errorForCode(se.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 s=this.listeners.indexOf(n);this.listeners.splice(s,1)}),this.listeners.push(n),n}get info(){return this.protocol.isClosed()?void 0:this.protocol.info}async context(){return(await this.request("$SYS.REQ.USER.INFO")).json((s,a)=>s==="time"?new Date(Date.parse(a)):a)}stats(){return{inBytes:this.protocol.inBytes,outBytes:this.protocol.outBytes,inMsgs:this.protocol.inMsgs,outMsgs:this.protocol.outMsgs}}async jetstreamManager(n={}){const s=new R1(this,n);if(n.checkAPI!==!1)try{await s.getAccountInfo()}catch(a){const c=a;throw c.code===se.NoResponders&&(c.code=se.JetStreamNotEnabled),c}return s}jetstream(n={}){return new Zf(this,n)}getServerVersion(){const n=this.info;return n?Si(n.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw oe.errorForCode(se.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 U1(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(oe.errorForCode(se.ConnectionClosed)):this.isDraining()?Promise.reject(oe.errorForCode(se.ConnectionDraining)):this.protocol.reconnect()}}class U1{constructor(n){v(this,"nc");this.nc=n}add(n){try{return new Pa(this.nc,n).start()}catch(s){return Promise.reject(s)}}client(n,s){return new g1(this.nc,n,s)}}class B1{constructor(n,s,a){v(this,"bucket");v(this,"sm");v(this,"prefixLen");this.bucket=n,this.prefixLen=s,this.sm=a}get key(){return this.sm.subject.substring(this.prefixLen)}get value(){return this.sm.data}get delta(){return 0}get created(){return this.sm.time}get revision(){return this.sm.seq}get operation(){return this.sm.header.get(Rc)||"PUT"}get length(){const n=this.sm.header.get(Dt.MessageSizeHdr)||"";return n!==""?parseInt(n,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class L1{constructor(n,s,a){v(this,"bucket");v(this,"key");v(this,"sm");this.bucket=n,this.key=s,this.sm=a}get value(){return this.sm.data}get created(){return new Date(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(Rc))||"PUT"}get delta(){return this.sm.info.pending}get length(){var s;const n=((s=this.sm.headers)==null?void 0:s.get(Dt.MessageSizeHdr))||"";return n!==""?parseInt(n,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class Ag extends Tv{constructor(s,a,c){super(s.nc,a,c);v(this,"js");v(this,"monitor");this.js=s,this.monitor=null,this.sub.closed.then(()=>{this.monitor&&this.monitor.cancel()})}set info(s){this.sub.info=s}get info(){return this.sub.info}_resetOrderedConsumer(s){if(this.info===null||this.sub.isClosed())return;const a=cs(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,a);const f=this.info;f.config.name=Is.next(),f.ordered_consumer_sequence.delivery_seq=0,f.flow_control.heartbeat_count=0,f.flow_control.fc_count=0,f.flow_control.consumer_restarts++,f.deliver=a,f.config.deliver_subject=a,f.config.deliver_policy=ft.StartSequence,f.config.opt_start_seq=s;const h={};h.stream_name=this.info.stream,h.config=f.config;const d=`${f.api.prefix}.CONSUMER.CREATE.${f.stream}`;this.js._request(d,h,{retries:-1}).then(g=>{const y=g,A=this.sub.info;A.last=y,this.info.config=y.config,this.info.name=y.name}).catch(g=>{const y=new oe(`unable to recreate ordered consumer ${f.stream} at seq ${s}`,se.RequestError,g);this.sub.callback(y,{})})}_maybeSetupHbMonitoring(){var a,c;const s=((c=(a=this.info)==null?void 0:a.config)==null?void 0:c.idle_heartbeat)||0;s&&this._setupHbMonitoring(Jf(s))}_setupHbMonitoring(s,a=0){const c={cancelAfter:0,maxOut:2};a&&(c.cancelAfter=a);const f=this.sub,h=d=>{var A,S,j,z;const g=cv(409,`${yn.IdleHeartbeatMissed}: ${d}`,this.sub.subject);if(!((A=this.info)==null?void 0:A.ordered))this.sub.callback(null,g);else{if(!this.js.nc.protocol.connected)return!1;const R=((j=(S=this.info)==null?void 0:S.ordered_consumer_sequence)==null?void 0:j.stream_seq)||0;return this._resetOrderedConsumer(R+1),(z=this.monitor)==null||z.restart(),!1}return!f.noIterator};this.monitor=new Xf(s,h,c)}_checkHbOrderConsumer(s){const a=s.headers.get(Dt.ConsumerStalledHdr);a!==""&&this.js.nc.publish(a);const c=parseInt(s.headers.get(Dt.LastConsumerSeqHdr),10),f=this.info.ordered_consumer_sequence;return this.info.flow_control.heartbeat_count++,c!==f.delivery_seq&&this._resetOrderedConsumer(f.stream_seq+1),!1}_checkOrderedConsumer(s){const a=this.info.ordered_consumer_sequence,c=s.info.streamSequence,f=s.info.deliverySequence;return f!=a.delivery_seq+1?(this._resetOrderedConsumer(a.stream_seq+1),!1):(a.delivery_seq=f,a.stream_seq=c,!0)}async destroy(){this.isClosed()||await this.drain();const s=this.sub.info,a=s.config.durable_name||s.name,c=`${s.api.prefix}.CONSUMER.DELETE.${s.stream}.${a}`;await s.api._request(c)}async consumerInfo(){const s=this.sub.info,a=s.config.durable_name||s.name,c=`${s.api.prefix}.CONSUMER.INFO.${s.stream}.${a}`,f=await s.api._request(c);return s.last=f,f}}class H1 extends Ag{constructor(n,s,a){super(n,s,a)}pull(n={batch:1}){const{stream:s,config:a,name:c}=this.sub.info,f=a.durable_name??c,h={};if(h.batch=n.batch||1,h.no_wait=n.no_wait||!1,(n.max_bytes??0)>0){const y=this.js.nc.features.get(De.JS_PULL_MAX_BYTES);if(!y.ok)throw new Error(`max_bytes is only supported on servers ${y.min} or better`);h.max_bytes=n.max_bytes}let d=0;n.expires&&n.expires>0&&(d=n.expires,h.expires=nt(d));let g=0;if(n.idle_heartbeat&&n.idle_heartbeat>0&&(g=n.idle_heartbeat,h.idle_heartbeat=nt(g)),g&&d===0)throw new Error("idle_heartbeat requires expires");if(g>d)throw new Error("expires must be greater than idle_heartbeat");if(this.info){this.monitor&&this.monitor.cancel(),d&&g&&(this.monitor?this.monitor._change(g,d):this._setupHbMonitoring(g,d));const y=this.info.api,A=`${y.prefix}.CONSUMER.MSG.NEXT.${s}.${f}`,S=this.sub.subject;y.nc.publish(A,y.jc.encode(h),{reply:S})}}}function P1(r,n){return r?Y1(n):$1(n)}function $1(r){return(n,s)=>n?[n,null]:(n=xr(s),n?[n,null]:[null,Ba(s,r)])}function Y1(r){return(n,s)=>{if(n)return[n,null];const a=xr(s);return a!==null?[Og(a),null]:[null,Ba(s,r)]}}function Og(r){if(r!==null)switch(r.code){case se.JetStream404NoMessages:case se.JetStream408RequestTimeout:return null;case se.JetStream409:return ov(r)?r:null;default:return r}return null}function G1(r){r&&r.ack()}function V1(r){const n=r.split(".");if(n.length===9&&n.splice(2,0,"_",""),n.length<11||n[0]!=="$JS"||n[1]!=="ACK")throw new Error("not js message");const s={};return s.domain=n[2]==="_"?"":n[2],s.account_hash=n[3],s.stream=n[4],s.consumer=n[5],s.deliveryCount=parseInt(n[6],10),s.redeliveryCount=s.deliveryCount,s.redelivered=s.deliveryCount>1,s.streamSequence=parseInt(n[7],10),s.deliverySequence=parseInt(n[8],10),s.timestampNanos=parseInt(n[9],10),s.pending=parseInt(n[10],10),s}class F1{constructor(n,s){v(this,"msg");v(this,"di");v(this,"didAck");v(this,"timeout");this.msg=n,this.didAck=!1,this.timeout=s}get subject(){return this.msg.subject}get sid(){return this.msg.sid}get data(){return this.msg.data}get headers(){return this.msg.headers}get info(){return this.di||(this.di=V1(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]===Sa[0]&&n[1]===Sa[1]&&n[2]===Sa[2]&&n[3]===Sa[3]}async ackAck(n){var a;n=n||{},n.timeout=n.timeout||this.timeout;const s=st();if(this.didAck)s.resolve(!1);else if(this.didAck=!0,this.msg.reply){const f=this.msg.publisher,h=!((a=f.options)!=null&&a.noAsyncTraces),d=new pg(f.muxSubscriptions,this.msg.reply,{timeout:n.timeout},h);f.request(d);try{f.publish(this.msg.reply,S0,{reply:`${f.muxSubscriptions.baseInbox}${d.token}`})}catch(g){d.cancel(g)}try{await Promise.race([d.timer,d.deferred]),s.resolve(!0)}catch(g){d.cancel(g),s.reject(g)}}else s.resolve(!1);return s}ack(){this.doAck(S0)}nak(n){let s=O1;n&&(s=wf().encode(`-NAK ${JSON.stringify({delay:nt(n)})}`)),this.doAck(s)}working(){this.doAck(Sa)}next(n,s={batch:1}){const a={};a.batch=s.batch||1,a.no_wait=s.no_wait||!1,s.expires&&s.expires>0&&(a.expires=nt(s.expires));const c=Tn().encode(a),f=Er.concat(j1,N1,c),h=n?{reply:n}:void 0;this.msg.respond(f,h)}term(n=""){let s=T1;(n==null?void 0:n.length)>0&&(s=wf().encode(`+TERM ${n}`)),this.doAck(s)}json(){return this.msg.json()}string(){return this.msg.string()}}const J1="1.30.3",Q1="nats.ws";class X1{constructor(){v(this,"version");v(this,"lang");v(this,"closeError");v(this,"connected");v(this,"done");v(this,"socket");v(this,"options");v(this,"socketClosed");v(this,"encrypted");v(this,"peeked");v(this,"yields");v(this,"signal");v(this,"closedNotification");this.version=J1,this.lang=Q1,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=st(),this.closedNotification=st()}async connect(n,s){const a=st();if(s.tls)return a.reject(new oe("tls",se.InvalidOption)),a;this.options=s;const c=n.src;if(s.wsFactory){const{socket:f,encrypted:h}=await s.wsFactory(n.src,s);this.socket=f,this.encrypted=h}else this.encrypted=c.indexOf("wss://")===0,this.socket=new WebSocket(c);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 h=Er.concat(...this.yields),d=Dv(h);if(d!==""){const g=c1.exec(d);if(!g){s.debug&&console.error("!!!",uc(h)),a.reject(new Error("unexpected response from server"));return}try{const y=JSON.parse(g[1]);a1(y,this.options),this.peeked=!0,this.connected=!0,this.signal.resolve(),a.resolve()}catch(y){a.reject(y);return}}},this.socket.onclose=f=>{if(this.isDiscarded())return;this.socketClosed=!0;let h;this.done||(f.wasClean||(h=new Error(f.reason)),this._closed(h))},this.socket.onerror=f=>{if(this.isDiscarded())return;const h=f,d=new oe(h.message,se.Unknown,new Error(h.error));a.reject(d)},a}disconnect(){this._closed(void 0,!0)}async _closed(n,s=!0){if(!this.isDiscarded()&&this.connected&&!this.done){if(this.closeError=n,!n)for(;!this.socketClosed&&this.socket.bufferedAmount>0;)await Ar(100);this.done=!0;try{this.socket.close(n?1002:1e3,n?n.message:void 0)}catch{}s&&this.closedNotification.resolve(n)}}get isClosed(){return this.done}[Symbol.asyncIterator](){return this.iterate()}async*iterate(){for(;;){if(this.isDiscarded())return;this.yields.length===0&&await this.signal;const n=this.yields;this.yields=[];for(let s=0;s<n.length;s++)this.options.debug&&console.info(`> ${uc(n[s])}`),yield n[s];if(this.done)break;this.yields.length===0&&(n.length=0,this.yields=n,this.signal=st())}}isEncrypted(){return this.connected&&this.encrypted}send(n){if(!this.isDiscarded())try{this.socket.send(n.buffer),this.options.debug&&console.info(`< ${uc(n)}`);return}catch(s){this.options.debug&&console.error(`!!! ${uc(n)}: ${s}`)}}close(n){return this._closed(n,!1)}closed(){return this.closedNotification}isDiscarded(){return this.done?(this.discard(),!0):!1}discard(){var n;this.done=!0;try{(n=this.socket)==null||n.close()}catch{}}}function I1(r,n){/^(.*:\/\/)(.*)/.test(r)||(typeof n=="boolean"?r=`${n===!0?"https":"http"}://${r}`:r=`https://${r}`);let a=new URL(r);const c=a.protocol.toLowerCase();c==="ws:"&&(n=!1),c==="wss:"&&(n=!0),c!=="https:"&&c!=="http"&&(r=r.replace(/^(.*:\/\/)(.*)/gm,"$2"),a=new URL(`http://${r}`));let f,h;const d=a.hostname,g=a.pathname,y=a.search||"";switch(c){case"http:":case"ws:":case"nats:":h=a.port||"80",f="ws:";break;case"https:":case"wss:":case"tls:":h=a.port||"443",f="wss:";break;default:h=a.port||n===!0?"443":"80",f=n===!0?"wss:":"ws:";break}return`${f}//${d}:${h}${g}${y}`}function K1(r={}){return Nv({defaultPort:443,urlParseFn:I1,factory:()=>new X1}),Wf.connect(r)}const Z1="ws://localhost:9222",W1="dev_api_secret",e_="lt.events";function jg(r,n){const s=r.split("."),a=n.split(".");for(let c=0;c<a.length;c++){const f=a[c];if(f===">")return!0;if(c>=s.length||f!=="*"&&f!==s[c])return!1}return s.length===a.length}const Pc=C.createContext({connected:!1,subscribe:()=>()=>{}});function t_(){const{connected:r}=C.useContext(Pc);return{connected:r}}function Tg(r,n){const{subscribe:s}=C.useContext(Pc),a=C.useRef(n);a.current=n,C.useEffect(()=>s(r,f=>a.current(f)),[s,r])}const n_=C.createContext({connected:!1,subscribe:()=>()=>{}}),s_=wf();function i_({children:r,url:n,token:s}){const a=C.useRef(null),c=C.useRef(null),[f,h]=C.useState(!1),d=C.useRef(null),g=C.useRef(new Map),y=C.useCallback((j,z)=>{const R=g.current;return R.has(j)||R.set(j,new Set),R.get(j).add(z),()=>{const H=R.get(j);H&&(H.delete(z),H.size===0&&R.delete(j))}},[]),A=C.useCallback((j,z)=>{for(const[R,H]of g.current)if(jg(j,R))for(const ee of H)try{ee(z)}catch{}},[]),S=C.useCallback(async()=>{try{if(a.current)return;const j=await K1({servers:n||Z1,token:s||W1,reconnect:!0,maxReconnectAttempts:-1,reconnectTimeWait:2e3});a.current=j,h(!0);const z=j.subscribe("lt.>");c.current=z,(async()=>{for await(const R of z)try{const H=JSON.parse(s_.decode(R.data));A(R.subject,H)}catch{}})(),(async()=>{for await(const R of j.status())R.type==="disconnect"||R.type==="error"?h(!1):R.type==="reconnect"&&h(!0)})()}catch{h(!1),d.current=setTimeout(S,3e3)}},[A]);return C.useEffect(()=>(S(),()=>{d.current&&clearTimeout(d.current),c.current&&c.current.unsubscribe(),a.current&&(a.current.close().catch(()=>{}),a.current=null),h(!1)}),[S]),p.jsx(n_.Provider,{value:{connected:f,subscribe:y},children:p.jsx(Pc.Provider,{value:{connected:f,subscribe:y},children:r})})}const Bn=Object.create(null);Bn.open="0";Bn.close="1";Bn.ping="2";Bn.pong="3";Bn.message="4";Bn.upgrade="5";Bn.noop="6";const _c=Object.create(null);Object.keys(Bn).forEach(r=>{_c[Bn[r]]=r});const qf={type:"error",data:"parser error"},Ng=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Cg=typeof ArrayBuffer=="function",kg=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r&&r.buffer instanceof ArrayBuffer,eh=({type:r,data:n},s,a)=>Ng&&n instanceof Blob?s?a(n):A0(n,a):Cg&&(n instanceof ArrayBuffer||kg(n))?s?a(n):A0(new Blob([n]),a):a(Bn[r]+(n||"")),A0=(r,n)=>{const s=new FileReader;return s.onload=function(){const a=s.result.split(",")[1];n("b"+(a||""))},s.readAsDataURL(r)};function O0(r){return r instanceof Uint8Array?r:r instanceof ArrayBuffer?new Uint8Array(r):new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}let mf;function r_(r,n){if(Ng&&r.data instanceof Blob)return r.data.arrayBuffer().then(O0).then(n);if(Cg&&(r.data instanceof ArrayBuffer||kg(r.data)))return n(O0(r.data));eh(r,!1,s=>{mf||(mf=new TextEncoder),n(mf.encode(s))})}const j0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Na=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let r=0;r<j0.length;r++)Na[j0.charCodeAt(r)]=r;const a_=r=>{let n=r.length*.75,s=r.length,a,c=0,f,h,d,g;r[r.length-1]==="="&&(n--,r[r.length-2]==="="&&n--);const y=new ArrayBuffer(n),A=new Uint8Array(y);for(a=0;a<s;a+=4)f=Na[r.charCodeAt(a)],h=Na[r.charCodeAt(a+1)],d=Na[r.charCodeAt(a+2)],g=Na[r.charCodeAt(a+3)],A[c++]=f<<2|h>>4,A[c++]=(h&15)<<4|d>>2,A[c++]=(d&3)<<6|g&63;return y},l_=typeof ArrayBuffer=="function",th=(r,n)=>{if(typeof r!="string")return{type:"message",data:Mg(r,n)};const s=r.charAt(0);return s==="b"?{type:"message",data:c_(r.substring(1),n)}:_c[s]?r.length>1?{type:_c[s],data:r.substring(1)}:{type:_c[s]}:qf},c_=(r,n)=>{if(l_){const s=a_(r);return Mg(s,n)}else return{base64:!0,data:r}},Mg=(r,n)=>{switch(n){case"blob":return r instanceof Blob?r:new Blob([r]);case"arraybuffer":default:return r instanceof ArrayBuffer?r:r.buffer}},Rg="",o_=(r,n)=>{const s=r.length,a=new Array(s);let c=0;r.forEach((f,h)=>{eh(f,!1,d=>{a[h]=d,++c===s&&n(a.join(Rg))})})},u_=(r,n)=>{const s=r.split(Rg),a=[];for(let c=0;c<s.length;c++){const f=th(s[c],n);if(a.push(f),f.type==="error")break}return a};function f_(){return new TransformStream({transform(r,n){r_(r,s=>{const a=s.length;let c;if(a<126)c=new Uint8Array(1),new DataView(c.buffer).setUint8(0,a);else if(a<65536){c=new Uint8Array(3);const f=new DataView(c.buffer);f.setUint8(0,126),f.setUint16(1,a)}else{c=new Uint8Array(9);const f=new DataView(c.buffer);f.setUint8(0,127),f.setBigUint64(1,BigInt(a))}r.data&&typeof r.data!="string"&&(c[0]|=128),n.enqueue(c),n.enqueue(s)})}})}let pf;function mc(r){return r.reduce((n,s)=>n+s.length,0)}function pc(r,n){if(r[0].length===n)return r.shift();const s=new Uint8Array(n);let a=0;for(let c=0;c<n;c++)s[c]=r[0][a++],a===r[0].length&&(r.shift(),a=0);return r.length&&a<r[0].length&&(r[0]=r[0].slice(a)),s}function h_(r,n){pf||(pf=new TextDecoder);const s=[];let a=0,c=-1,f=!1;return new TransformStream({transform(h,d){for(s.push(h);;){if(a===0){if(mc(s)<1)break;const g=pc(s,1);f=(g[0]&128)===128,c=g[0]&127,c<126?a=3:c===126?a=1:a=2}else if(a===1){if(mc(s)<2)break;const g=pc(s,2);c=new DataView(g.buffer,g.byteOffset,g.length).getUint16(0),a=3}else if(a===2){if(mc(s)<8)break;const g=pc(s,8),y=new DataView(g.buffer,g.byteOffset,g.length),A=y.getUint32(0);if(A>Math.pow(2,21)-1){d.enqueue(qf);break}c=A*Math.pow(2,32)+y.getUint32(4),a=3}else{if(mc(s)<c)break;const g=pc(s,c);d.enqueue(th(f?g:pf.decode(g),n)),a=0}if(c===0||c>r){d.enqueue(qf);break}}}})}const Dg=4;function gt(r){if(r)return d_(r)}function d_(r){for(var n in gt.prototype)r[n]=gt.prototype[n];return r}gt.prototype.on=gt.prototype.addEventListener=function(r,n){return this._callbacks=this._callbacks||{},(this._callbacks["$"+r]=this._callbacks["$"+r]||[]).push(n),this};gt.prototype.once=function(r,n){function s(){this.off(r,s),n.apply(this,arguments)}return s.fn=n,this.on(r,s),this};gt.prototype.off=gt.prototype.removeListener=gt.prototype.removeAllListeners=gt.prototype.removeEventListener=function(r,n){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var s=this._callbacks["$"+r];if(!s)return this;if(arguments.length==1)return delete this._callbacks["$"+r],this;for(var a,c=0;c<s.length;c++)if(a=s[c],a===n||a.fn===n){s.splice(c,1);break}return s.length===0&&delete this._callbacks["$"+r],this};gt.prototype.emit=function(r){this._callbacks=this._callbacks||{};for(var n=new Array(arguments.length-1),s=this._callbacks["$"+r],a=1;a<arguments.length;a++)n[a-1]=arguments[a];if(s){s=s.slice(0);for(var a=0,c=s.length;a<c;++a)s[a].apply(this,n)}return this};gt.prototype.emitReserved=gt.prototype.emit;gt.prototype.listeners=function(r){return this._callbacks=this._callbacks||{},this._callbacks["$"+r]||[]};gt.prototype.hasListeners=function(r){return!!this.listeners(r).length};const $c=typeof Promise=="function"&&typeof Promise.resolve=="function"?n=>Promise.resolve().then(n):(n,s)=>s(n,0),bn=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),m_="arraybuffer";function zg(r,...n){return n.reduce((s,a)=>(r.hasOwnProperty(a)&&(s[a]=r[a]),s),{})}const p_=bn.setTimeout,g_=bn.clearTimeout;function Yc(r,n){n.useNativeTimers?(r.setTimeoutFn=p_.bind(bn),r.clearTimeoutFn=g_.bind(bn)):(r.setTimeoutFn=bn.setTimeout.bind(bn),r.clearTimeoutFn=bn.clearTimeout.bind(bn))}const y_=1.33;function b_(r){return typeof r=="string"?x_(r):Math.ceil((r.byteLength||r.size)*y_)}function x_(r){let n=0,s=0;for(let a=0,c=r.length;a<c;a++)n=r.charCodeAt(a),n<128?s+=1:n<2048?s+=2:n<55296||n>=57344?s+=3:(a++,s+=4);return s}function qg(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function v_(r){let n="";for(let s in r)r.hasOwnProperty(s)&&(n.length&&(n+="&"),n+=encodeURIComponent(s)+"="+encodeURIComponent(r[s]));return n}function __(r){let n={},s=r.split("&");for(let a=0,c=s.length;a<c;a++){let f=s[a].split("=");n[decodeURIComponent(f[0])]=decodeURIComponent(f[1])}return n}class w_ extends Error{constructor(n,s,a){super(n),this.description=s,this.context=a,this.type="TransportError"}}class nh extends gt{constructor(n){super(),this.writable=!1,Yc(this,n),this.opts=n,this.query=n.query,this.socket=n.socket,this.supportsBinary=!n.forceBase64}onError(n,s,a){return super.emitReserved("error",new w_(n,s,a)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(n){this.readyState==="open"&&this.write(n)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(n){const s=th(n,this.socket.binaryType);this.onPacket(s)}onPacket(n){super.emitReserved("packet",n)}onClose(n){this.readyState="closed",super.emitReserved("close",n)}pause(n){}createUri(n,s={}){return n+"://"+this._hostname()+this._port()+this.opts.path+this._query(s)}_hostname(){const n=this.opts.hostname;return n.indexOf(":")===-1?n:"["+n+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(n){const s=v_(n);return s.length?"?"+s:""}}class S_ extends nh{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(n){this.readyState="pausing";const s=()=>{this.readyState="paused",n()};if(this._polling||!this.writable){let a=0;this._polling&&(a++,this.once("pollComplete",function(){--a||s()})),this.writable||(a++,this.once("drain",function(){--a||s()}))}else s()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(n){const s=a=>{if(this.readyState==="opening"&&a.type==="open"&&this.onOpen(),a.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(a)};u_(n,this.socket.binaryType).forEach(s),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const n=()=>{this.write([{type:"close"}])};this.readyState==="open"?n():this.once("open",n)}write(n){this.writable=!1,o_(n,s=>{this.doWrite(s,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const n=this.opts.secure?"https":"http",s=this.query||{};return this.opts.timestampRequests!==!1&&(s[this.opts.timestampParam]=qg()),!this.supportsBinary&&!s.sid&&(s.b64=1),this.createUri(n,s)}}let Ug=!1;try{Ug=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const E_=Ug;function A_(){}class O_ extends S_{constructor(n){if(super(n),typeof location<"u"){const s=location.protocol==="https:";let a=location.port;a||(a=s?"443":"80"),this.xd=typeof location<"u"&&n.hostname!==location.hostname||a!==n.port}}doWrite(n,s){const a=this.request({method:"POST",data:n});a.on("success",s),a.on("error",(c,f)=>{this.onError("xhr post error",c,f)})}doPoll(){const n=this.request();n.on("data",this.onData.bind(this)),n.on("error",(s,a)=>{this.onError("xhr poll error",s,a)}),this.pollXhr=n}}class Un extends gt{constructor(n,s,a){super(),this.createRequest=n,Yc(this,a),this._opts=a,this._method=a.method||"GET",this._uri=s,this._data=a.data!==void 0?a.data:null,this._create()}_create(){var n;const s=zg(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");s.xdomain=!!this._opts.xd;const a=this._xhr=this.createRequest(s);try{a.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){a.setDisableHeaderCheck&&a.setDisableHeaderCheck(!0);for(let c in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(c)&&a.setRequestHeader(c,this._opts.extraHeaders[c])}}catch{}if(this._method==="POST")try{a.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{a.setRequestHeader("Accept","*/*")}catch{}(n=this._opts.cookieJar)===null||n===void 0||n.addCookies(a),"withCredentials"in a&&(a.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(a.timeout=this._opts.requestTimeout),a.onreadystatechange=()=>{var c;a.readyState===3&&((c=this._opts.cookieJar)===null||c===void 0||c.parseCookies(a.getResponseHeader("set-cookie"))),a.readyState===4&&(a.status===200||a.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof a.status=="number"?a.status:0)},0))},a.send(this._data)}catch(c){this.setTimeoutFn(()=>{this._onError(c)},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=A_,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",T0);else if(typeof addEventListener=="function"){const r="onpagehide"in bn?"pagehide":"unload";addEventListener(r,T0,!1)}}function T0(){for(let r in Un.requests)Un.requests.hasOwnProperty(r)&&Un.requests[r].abort()}const j_=(function(){const r=Bg({xdomain:!1});return r&&r.responseType!==null})();class T_ extends O_{constructor(n){super(n);const s=n&&n.forceBase64;this.supportsBinary=j_&&!s}request(n={}){return Object.assign(n,{xd:this.xd},this.opts),new Un(Bg,this.uri(),n)}}function Bg(r){const n=r.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!n||E_))return new XMLHttpRequest}catch{}if(!n)try{return new bn[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Lg=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class N_ extends nh{get name(){return"websocket"}doOpen(){const n=this.uri(),s=this.opts.protocols,a=Lg?{}:zg(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(a.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(n,s,a)}catch(c){return this.emitReserved("error",c)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=n=>this.onClose({description:"websocket connection closed",context:n}),this.ws.onmessage=n=>this.onData(n.data),this.ws.onerror=n=>this.onError("websocket error",n)}write(n){this.writable=!1;for(let s=0;s<n.length;s++){const a=n[s],c=s===n.length-1;eh(a,this.supportsBinary,f=>{try{this.doWrite(a,f)}catch{}c&&$c(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const n=this.opts.secure?"wss":"ws",s=this.query||{};return this.opts.timestampRequests&&(s[this.opts.timestampParam]=qg()),this.supportsBinary||(s.b64=1),this.createUri(n,s)}}const gf=bn.WebSocket||bn.MozWebSocket;class C_ extends N_{createSocket(n,s,a){return Lg?new gf(n,s,a):s?new gf(n,s):new gf(n)}doWrite(n,s){this.ws.send(s)}}class k_ extends nh{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(n){return this.emitReserved("error",n)}this._transport.closed.then(()=>{this.onClose()}).catch(n=>{this.onError("webtransport error",n)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(n=>{const s=h_(Number.MAX_SAFE_INTEGER,this.socket.binaryType),a=n.readable.pipeThrough(s).getReader(),c=f_();c.readable.pipeTo(n.writable),this._writer=c.writable.getWriter();const f=()=>{a.read().then(({done:d,value:g})=>{d||(this.onPacket(g),f())}).catch(d=>{})};f();const h={type:"open"};this.query.sid&&(h.data=`{"sid":"${this.query.sid}"}`),this._writer.write(h).then(()=>this.onOpen())})})}write(n){this.writable=!1;for(let s=0;s<n.length;s++){const a=n[s],c=s===n.length-1;this._writer.write(a).then(()=>{c&&$c(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var n;(n=this._transport)===null||n===void 0||n.close()}}const M_={websocket:C_,webtransport:k_,polling:T_},R_=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,D_=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Uf(r){if(r.length>8e3)throw"URI too long";const n=r,s=r.indexOf("["),a=r.indexOf("]");s!=-1&&a!=-1&&(r=r.substring(0,s)+r.substring(s,a).replace(/:/g,";")+r.substring(a,r.length));let c=R_.exec(r||""),f={},h=14;for(;h--;)f[D_[h]]=c[h]||"";return s!=-1&&a!=-1&&(f.source=n,f.host=f.host.substring(1,f.host.length-1).replace(/;/g,":"),f.authority=f.authority.replace("[","").replace("]","").replace(/;/g,":"),f.ipv6uri=!0),f.pathNames=z_(f,f.path),f.queryKey=q_(f,f.query),f}function z_(r,n){const s=/\/{2,9}/g,a=n.replace(s,"/").split("/");return(n.slice(0,1)=="/"||n.length===0)&&a.splice(0,1),n.slice(-1)=="/"&&a.splice(a.length-1,1),a}function q_(r,n){const s={};return n.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(a,c,f){c&&(s[c]=f)}),s}const Bf=typeof addEventListener=="function"&&typeof removeEventListener=="function",wc=[];Bf&&addEventListener("offline",()=>{wc.forEach(r=>r())},!1);class Xs extends gt{constructor(n,s){if(super(),this.binaryType=m_,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,n&&typeof n=="object"&&(s=n,n=null),n){const a=Uf(n);s.hostname=a.host,s.secure=a.protocol==="https"||a.protocol==="wss",s.port=a.port,a.query&&(s.query=a.query)}else s.host&&(s.hostname=Uf(s.host).host);Yc(this,s),this.secure=s.secure!=null?s.secure:typeof location<"u"&&location.protocol==="https:",s.hostname&&!s.port&&(s.port=this.secure?"443":"80"),this.hostname=s.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=s.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},s.transports.forEach(a=>{const c=a.prototype.name;this.transports.push(c),this._transportsByName[c]=a}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},s),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=__(this.opts.query)),Bf&&(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"})},wc.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(n){const s=Object.assign({},this.opts.query);s.EIO=Dg,s.transport=n,this.id&&(s.sid=this.id);const a=Object.assign({},this.opts,{query:s,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[n]);return new this._transportsByName[n](a)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const n=this.opts.rememberUpgrade&&Xs.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const s=this.createTransport(n);s.open(),this.setTransport(s)}setTransport(n){this.transport&&this.transport.removeAllListeners(),this.transport=n,n.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",s=>this._onClose("transport close",s))}onOpen(){this.readyState="open",Xs.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",n),this.emitReserved("heartbeat"),n.type){case"open":this.onHandshake(JSON.parse(n.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const s=new Error("server error");s.code=n.data,this._onError(s);break;case"message":this.emitReserved("data",n.data),this.emitReserved("message",n.data);break}}onHandshake(n){this.emitReserved("handshake",n),this.id=n.sid,this.transport.query.sid=n.sid,this._pingInterval=n.pingInterval,this._pingTimeout=n.pingTimeout,this._maxPayload=n.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const n=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+n,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},n),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const n=this._getWritablePackets();this.transport.send(n),this._prevBufferLen=n.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let s=1;for(let a=0;a<this.writeBuffer.length;a++){const c=this.writeBuffer[a].data;if(c&&(s+=b_(c)),a>0&&s>this._maxPayload)return this.writeBuffer.slice(0,a);s+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const n=Date.now()>this._pingTimeoutTime;return n&&(this._pingTimeoutTime=0,$c(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),n}write(n,s,a){return this._sendPacket("message",n,s,a),this}send(n,s,a){return this._sendPacket("message",n,s,a),this}_sendPacket(n,s,a,c){if(typeof s=="function"&&(c=s,s=void 0),typeof a=="function"&&(c=a,a=null),this.readyState==="closing"||this.readyState==="closed")return;a=a||{},a.compress=a.compress!==!1;const f={type:n,data:s,options:a};this.emitReserved("packetCreate",f),this.writeBuffer.push(f),c&&this.once("flush",c),this.flush()}close(){const n=()=>{this._onClose("forced close"),this.transport.close()},s=()=>{this.off("upgrade",s),this.off("upgradeError",s),n()},a=()=>{this.once("upgrade",s),this.once("upgradeError",s)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?a():n()}):this.upgrading?a():n()),this}_onError(n){if(Xs.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",n),this._onClose("transport error",n)}_onClose(n,s){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Bf&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const a=wc.indexOf(this._offlineEventListener);a!==-1&&wc.splice(a,1)}this.readyState="closed",this.id=null,this.emitReserved("close",n,s),this.writeBuffer=[],this._prevBufferLen=0}}}Xs.protocol=Dg;class U_ extends Xs{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let n=0;n<this._upgrades.length;n++)this._probe(this._upgrades[n])}_probe(n){let s=this.createTransport(n),a=!1;Xs.priorWebsocketSuccess=!1;const c=()=>{a||(s.send([{type:"ping",data:"probe"}]),s.once("packet",S=>{if(!a)if(S.type==="pong"&&S.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",s),!s)return;Xs.priorWebsocketSuccess=s.name==="websocket",this.transport.pause(()=>{a||this.readyState!=="closed"&&(A(),this.setTransport(s),s.send([{type:"upgrade"}]),this.emitReserved("upgrade",s),s=null,this.upgrading=!1,this.flush())})}else{const j=new Error("probe error");j.transport=s.name,this.emitReserved("upgradeError",j)}}))};function f(){a||(a=!0,A(),s.close(),s=null)}const h=S=>{const j=new Error("probe error: "+S);j.transport=s.name,f(),this.emitReserved("upgradeError",j)};function d(){h("transport closed")}function g(){h("socket closed")}function y(S){s&&S.name!==s.name&&f()}const A=()=>{s.removeListener("open",c),s.removeListener("error",h),s.removeListener("close",d),this.off("close",g),this.off("upgrading",y)};s.once("open",c),s.once("error",h),s.once("close",d),this.once("close",g),this.once("upgrading",y),this._upgrades.indexOf("webtransport")!==-1&&n!=="webtransport"?this.setTimeoutFn(()=>{a||s.open()},200):s.open()}onHandshake(n){this._upgrades=this._filterUpgrades(n.upgrades),super.onHandshake(n)}_filterUpgrades(n){const s=[];for(let a=0;a<n.length;a++)~this.transports.indexOf(n[a])&&s.push(n[a]);return s}}let B_=class extends U_{constructor(n,s={}){const a=typeof n=="object"?n:s;(!a.transports||a.transports&&typeof a.transports[0]=="string")&&(a.transports=(a.transports||["polling","websocket","webtransport"]).map(c=>M_[c]).filter(c=>!!c)),super(n,a)}};function L_(r,n="",s){let a=r;s=s||typeof location<"u"&&location,r==null&&(r=s.protocol+"//"+s.host),typeof r=="string"&&(r.charAt(0)==="/"&&(r.charAt(1)==="/"?r=s.protocol+r:r=s.host+r),/^(https?|wss?):\/\//.test(r)||(typeof s<"u"?r=s.protocol+"//"+r:r="https://"+r),a=Uf(r)),a.port||(/^(http|ws)$/.test(a.protocol)?a.port="80":/^(http|ws)s$/.test(a.protocol)&&(a.port="443")),a.path=a.path||"/";const f=a.host.indexOf(":")!==-1?"["+a.host+"]":a.host;return a.id=a.protocol+"://"+f+":"+a.port+n,a.href=a.protocol+"://"+f+(s&&s.port===a.port?"":":"+a.port),a}const H_=typeof ArrayBuffer=="function",P_=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r.buffer instanceof ArrayBuffer,Hg=Object.prototype.toString,$_=typeof Blob=="function"||typeof Blob<"u"&&Hg.call(Blob)==="[object BlobConstructor]",Y_=typeof File=="function"||typeof File<"u"&&Hg.call(File)==="[object FileConstructor]";function sh(r){return H_&&(r instanceof ArrayBuffer||P_(r))||$_&&r instanceof Blob||Y_&&r instanceof File}function Sc(r,n){if(!r||typeof r!="object")return!1;if(Array.isArray(r)){for(let s=0,a=r.length;s<a;s++)if(Sc(r[s]))return!0;return!1}if(sh(r))return!0;if(r.toJSON&&typeof r.toJSON=="function"&&arguments.length===1)return Sc(r.toJSON(),!0);for(const s in r)if(Object.prototype.hasOwnProperty.call(r,s)&&Sc(r[s]))return!0;return!1}function G_(r){const n=[],s=r.data,a=r;return a.data=Lf(s,n),a.attachments=n.length,{packet:a,buffers:n}}function Lf(r,n){if(!r)return r;if(sh(r)){const s={_placeholder:!0,num:n.length};return n.push(r),s}else if(Array.isArray(r)){const s=new Array(r.length);for(let a=0;a<r.length;a++)s[a]=Lf(r[a],n);return s}else if(typeof r=="object"&&!(r instanceof Date)){const s={};for(const a in r)Object.prototype.hasOwnProperty.call(r,a)&&(s[a]=Lf(r[a],n));return s}return r}function V_(r,n){return r.data=Hf(r.data,n),delete r.attachments,r}function Hf(r,n){if(!r)return r;if(r&&r._placeholder===!0){if(typeof r.num=="number"&&r.num>=0&&r.num<n.length)return n[r.num];throw new Error("illegal attachments")}else if(Array.isArray(r))for(let s=0;s<r.length;s++)r[s]=Hf(r[s],n);else if(typeof r=="object")for(const s in r)Object.prototype.hasOwnProperty.call(r,s)&&(r[s]=Hf(r[s],n));return r}const F_=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var Re;(function(r){r[r.CONNECT=0]="CONNECT",r[r.DISCONNECT=1]="DISCONNECT",r[r.EVENT=2]="EVENT",r[r.ACK=3]="ACK",r[r.CONNECT_ERROR=4]="CONNECT_ERROR",r[r.BINARY_EVENT=5]="BINARY_EVENT",r[r.BINARY_ACK=6]="BINARY_ACK"})(Re||(Re={}));class J_{constructor(n){this.replacer=n}encode(n){return(n.type===Re.EVENT||n.type===Re.ACK)&&Sc(n)?this.encodeAsBinary({type:n.type===Re.EVENT?Re.BINARY_EVENT:Re.BINARY_ACK,nsp:n.nsp,data:n.data,id:n.id}):[this.encodeAsString(n)]}encodeAsString(n){let s=""+n.type;return(n.type===Re.BINARY_EVENT||n.type===Re.BINARY_ACK)&&(s+=n.attachments+"-"),n.nsp&&n.nsp!=="/"&&(s+=n.nsp+","),n.id!=null&&(s+=n.id),n.data!=null&&(s+=JSON.stringify(n.data,this.replacer)),s}encodeAsBinary(n){const s=G_(n),a=this.encodeAsString(s.packet),c=s.buffers;return c.unshift(a),c}}class ih extends gt{constructor(n){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof n=="function"?{reviver:n}:n)}add(n){let s;if(typeof n=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");s=this.decodeString(n);const a=s.type===Re.BINARY_EVENT;a||s.type===Re.BINARY_ACK?(s.type=a?Re.EVENT:Re.ACK,this.reconstructor=new Q_(s),s.attachments===0&&super.emitReserved("decoded",s)):super.emitReserved("decoded",s)}else if(sh(n)||n.base64)if(this.reconstructor)s=this.reconstructor.takeBinaryData(n),s&&(this.reconstructor=null,super.emitReserved("decoded",s));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+n)}decodeString(n){let s=0;const a={type:Number(n.charAt(0))};if(Re[a.type]===void 0)throw new Error("unknown packet type "+a.type);if(a.type===Re.BINARY_EVENT||a.type===Re.BINARY_ACK){const f=s+1;for(;n.charAt(++s)!=="-"&&s!=n.length;);const h=n.substring(f,s);if(h!=Number(h)||n.charAt(s)!=="-")throw new Error("Illegal attachments");const d=Number(h);if(!X_(d)||d<0)throw new Error("Illegal attachments");if(d>this.opts.maxAttachments)throw new Error("too many attachments");a.attachments=d}if(n.charAt(s+1)==="/"){const f=s+1;for(;++s&&!(n.charAt(s)===","||s===n.length););a.nsp=n.substring(f,s)}else a.nsp="/";const c=n.charAt(s+1);if(c!==""&&Number(c)==c){const f=s+1;for(;++s;){const h=n.charAt(s);if(h==null||Number(h)!=h){--s;break}if(s===n.length)break}a.id=Number(n.substring(f,s+1))}if(n.charAt(++s)){const f=this.tryParse(n.substr(s));if(ih.isPayloadValid(a.type,f))a.data=f;else throw new Error("invalid payload")}return a}tryParse(n){try{return JSON.parse(n,this.opts.reviver)}catch{return!1}}static isPayloadValid(n,s){switch(n){case Re.CONNECT:return N0(s);case Re.DISCONNECT:return s===void 0;case Re.CONNECT_ERROR:return typeof s=="string"||N0(s);case Re.EVENT:case Re.BINARY_EVENT:return Array.isArray(s)&&(typeof s[0]=="number"||typeof s[0]=="string"&&F_.indexOf(s[0])===-1);case Re.ACK:case Re.BINARY_ACK:return Array.isArray(s)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Q_{constructor(n){this.packet=n,this.buffers=[],this.reconPack=n}takeBinaryData(n){if(this.buffers.push(n),this.buffers.length===this.reconPack.attachments){const s=V_(this.reconPack,this.buffers);return this.finishedReconstruction(),s}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const X_=Number.isInteger||function(r){return typeof r=="number"&&isFinite(r)&&Math.floor(r)===r};function N0(r){return Object.prototype.toString.call(r)==="[object Object]"}const I_=Object.freeze(Object.defineProperty({__proto__:null,Decoder:ih,Encoder:J_,get PacketType(){return Re}},Symbol.toStringTag,{value:"Module"}));function On(r,n,s){return r.on(n,s),function(){r.off(n,s)}}const K_=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Pg extends gt{constructor(n,s,a){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=n,this.nsp=s,a&&a.auth&&(this.auth=a.auth),this._opts=Object.assign({},a),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const n=this.io;this.subs=[On(n,"open",this.onopen.bind(this)),On(n,"packet",this.onpacket.bind(this)),On(n,"error",this.onerror.bind(this)),On(n,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...n){return n.unshift("message"),this.emit.apply(this,n),this}emit(n,...s){var a,c,f;if(K_.hasOwnProperty(n))throw new Error('"'+n.toString()+'" is a reserved event name');if(s.unshift(n),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(s),this;const h={type:Re.EVENT,data:s};if(h.options={},h.options.compress=this.flags.compress!==!1,typeof s[s.length-1]=="function"){const A=this.ids++,S=s.pop();this._registerAckCallback(A,S),h.id=A}const d=(c=(a=this.io.engine)===null||a===void 0?void 0:a.transport)===null||c===void 0?void 0:c.writable,g=this.connected&&!(!((f=this.io.engine)===null||f===void 0)&&f._hasPingExpired());return this.flags.volatile&&!d||(g?(this.notifyOutgoingListeners(h),this.packet(h)):this.sendBuffer.push(h)),this.flags={},this}_registerAckCallback(n,s){var a;const c=(a=this.flags.timeout)!==null&&a!==void 0?a:this._opts.ackTimeout;if(c===void 0){this.acks[n]=s;return}const f=this.io.setTimeoutFn(()=>{delete this.acks[n];for(let d=0;d<this.sendBuffer.length;d++)this.sendBuffer[d].id===n&&this.sendBuffer.splice(d,1);s.call(this,new Error("operation has timed out"))},c),h=(...d)=>{this.io.clearTimeoutFn(f),s.apply(this,d)};h.withError=!0,this.acks[n]=h}emitWithAck(n,...s){return new Promise((a,c)=>{const f=(h,d)=>h?c(h):a(d);f.withError=!0,s.push(f),this.emit(n,...s)})}_addToQueue(n){let s;typeof n[n.length-1]=="function"&&(s=n.pop());const a={id:this._queueSeq++,tryCount:0,pending:!1,args:n,flags:Object.assign({fromQueue:!0},this.flags)};n.push((c,...f)=>(this._queue[0],c!==null?a.tryCount>this._opts.retries&&(this._queue.shift(),s&&s(c)):(this._queue.shift(),s&&s(null,...f)),a.pending=!1,this._drainQueue())),this._queue.push(a),this._drainQueue()}_drainQueue(n=!1){if(!this.connected||this._queue.length===0)return;const s=this._queue[0];s.pending&&!n||(s.pending=!0,s.tryCount++,this.flags=s.flags,this.emit.apply(this,s.args))}packet(n){n.nsp=this.nsp,this.io._packet(n)}onopen(){typeof this.auth=="function"?this.auth(n=>{this._sendConnectPacket(n)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(n){this.packet({type:Re.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},n):n})}onerror(n){this.connected||this.emitReserved("connect_error",n)}onclose(n,s){this.connected=!1,delete this.id,this.emitReserved("disconnect",n,s),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(n=>{if(!this.sendBuffer.some(a=>String(a.id)===n)){const a=this.acks[n];delete this.acks[n],a.withError&&a.call(this,new Error("socket has been disconnected"))}})}onpacket(n){if(n.nsp===this.nsp)switch(n.type){case Re.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 Re.EVENT:case Re.BINARY_EVENT:this.onevent(n);break;case Re.ACK:case Re.BINARY_ACK:this.onack(n);break;case Re.DISCONNECT:this.ondisconnect();break;case Re.CONNECT_ERROR:this.destroy();const a=new Error(n.data.message);a.data=n.data.data,this.emitReserved("connect_error",a);break}}onevent(n){const s=n.data||[];n.id!=null&&s.push(this.ack(n.id)),this.connected?this.emitEvent(s):this.receiveBuffer.push(Object.freeze(s))}emitEvent(n){if(this._anyListeners&&this._anyListeners.length){const s=this._anyListeners.slice();for(const a of s)a.apply(this,n)}super.emit.apply(this,n),this._pid&&n.length&&typeof n[n.length-1]=="string"&&(this._lastOffset=n[n.length-1])}ack(n){const s=this;let a=!1;return function(...c){a||(a=!0,s.packet({type:Re.ACK,id:n,data:c}))}}onack(n){const s=this.acks[n.id];typeof s=="function"&&(delete this.acks[n.id],s.withError&&n.data.unshift(null),s.apply(this,n.data))}onconnect(n,s){this.id=n,this.recovered=s&&this._pid===s,this._pid=s,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(n=>this.emitEvent(n)),this.receiveBuffer=[],this.sendBuffer.forEach(n=>{this.notifyOutgoingListeners(n),this.packet(n)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(n=>n()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Re.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(n){return this.flags.compress=n,this}get volatile(){return this.flags.volatile=!0,this}timeout(n){return this.flags.timeout=n,this}onAny(n){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(n),this}prependAny(n){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(n),this}offAny(n){if(!this._anyListeners)return this;if(n){const s=this._anyListeners;for(let a=0;a<s.length;a++)if(n===s[a])return s.splice(a,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(n){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(n),this}prependAnyOutgoing(n){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(n),this}offAnyOutgoing(n){if(!this._anyOutgoingListeners)return this;if(n){const s=this._anyOutgoingListeners;for(let a=0;a<s.length;a++)if(n===s[a])return s.splice(a,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(n){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const s=this._anyOutgoingListeners.slice();for(const a of s)a.apply(this,n.data)}}}function Or(r){r=r||{},this.ms=r.min||100,this.max=r.max||1e4,this.factor=r.factor||2,this.jitter=r.jitter>0&&r.jitter<=1?r.jitter:0,this.attempts=0}Or.prototype.duration=function(){var r=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var n=Math.random(),s=Math.floor(n*this.jitter*r);r=(Math.floor(n*10)&1)==0?r-s:r+s}return Math.min(r,this.max)|0};Or.prototype.reset=function(){this.attempts=0};Or.prototype.setMin=function(r){this.ms=r};Or.prototype.setMax=function(r){this.max=r};Or.prototype.setJitter=function(r){this.jitter=r};class Pf extends gt{constructor(n,s){var a;super(),this.nsps={},this.subs=[],n&&typeof n=="object"&&(s=n,n=void 0),s=s||{},s.path=s.path||"/socket.io",this.opts=s,Yc(this,s),this.reconnection(s.reconnection!==!1),this.reconnectionAttempts(s.reconnectionAttempts||1/0),this.reconnectionDelay(s.reconnectionDelay||1e3),this.reconnectionDelayMax(s.reconnectionDelayMax||5e3),this.randomizationFactor((a=s.randomizationFactor)!==null&&a!==void 0?a:.5),this.backoff=new Or({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(s.timeout==null?2e4:s.timeout),this._readyState="closed",this.uri=n;const c=s.parser||I_;this.encoder=new c.Encoder,this.decoder=new c.Decoder,this._autoConnect=s.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(n){return arguments.length?(this._reconnection=!!n,n||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(n){return n===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=n,this)}reconnectionDelay(n){var s;return n===void 0?this._reconnectionDelay:(this._reconnectionDelay=n,(s=this.backoff)===null||s===void 0||s.setMin(n),this)}randomizationFactor(n){var s;return n===void 0?this._randomizationFactor:(this._randomizationFactor=n,(s=this.backoff)===null||s===void 0||s.setJitter(n),this)}reconnectionDelayMax(n){var s;return n===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=n,(s=this.backoff)===null||s===void 0||s.setMax(n),this)}timeout(n){return arguments.length?(this._timeout=n,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(n){if(~this._readyState.indexOf("open"))return this;this.engine=new B_(this.uri,this.opts);const s=this.engine,a=this;this._readyState="opening",this.skipReconnect=!1;const c=On(s,"open",function(){a.onopen(),n&&n()}),f=d=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",d),n?n(d):this.maybeReconnectOnOpen()},h=On(s,"error",f);if(this._timeout!==!1){const d=this._timeout,g=this.setTimeoutFn(()=>{c(),f(new Error("timeout")),s.close()},d);this.opts.autoUnref&&g.unref(),this.subs.push(()=>{this.clearTimeoutFn(g)})}return this.subs.push(c),this.subs.push(h),this}connect(n){return this.open(n)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const n=this.engine;this.subs.push(On(n,"ping",this.onping.bind(this)),On(n,"data",this.ondata.bind(this)),On(n,"error",this.onerror.bind(this)),On(n,"close",this.onclose.bind(this)),On(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(n){try{this.decoder.add(n)}catch(s){this.onclose("parse error",s)}}ondecoded(n){$c(()=>{this.emitReserved("packet",n)},this.setTimeoutFn)}onerror(n){this.emitReserved("error",n)}socket(n,s){let a=this.nsps[n];return a?this._autoConnect&&!a.active&&a.connect():(a=new Pg(this,n,s),this.nsps[n]=a),a}_destroy(n){const s=Object.keys(this.nsps);for(const a of s)if(this.nsps[a].active)return;this._close()}_packet(n){const s=this.encoder.encode(n);for(let a=0;a<s.length;a++)this.engine.write(s[a],n.options)}cleanup(){this.subs.forEach(n=>n()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(n,s){var a;this.cleanup(),(a=this.engine)===null||a===void 0||a.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",n,s),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const n=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const s=this.backoff.duration();this._reconnecting=!0;const a=this.setTimeoutFn(()=>{n.skipReconnect||(this.emitReserved("reconnect_attempt",n.backoff.attempts),!n.skipReconnect&&n.open(c=>{c?(n._reconnecting=!1,n.reconnect(),this.emitReserved("reconnect_error",c)):n.onreconnect()}))},s);this.opts.autoUnref&&a.unref(),this.subs.push(()=>{this.clearTimeoutFn(a)})}}onreconnect(){const n=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",n)}}const Ea={};function Ec(r,n){typeof r=="object"&&(n=r,r=void 0),n=n||{};const s=L_(r,n.path||"/socket.io"),a=s.source,c=s.id,f=s.path,h=Ea[c]&&f in Ea[c].nsps,d=n.forceNew||n["force new connection"]||n.multiplex===!1||h;let g;return d?g=new Pf(a,n):(Ea[c]||(Ea[c]=new Pf(a,n)),g=Ea[c]),s.query&&!n.query&&(n.query=s.queryKey),g.socket(s.path,n)}Object.assign(Ec,{Manager:Pf,Socket:Pg,io:Ec,connect:Ec});const Z_=C.createContext({connected:!1,subscribe:()=>()=>{}});function W_({children:r}){const n=C.useRef(null),[s,a]=C.useState(!1),c=C.useRef(new Map),f=C.useCallback((d,g)=>{const y=c.current;return y.has(d)||y.set(d,new Set),y.get(d).add(g),()=>{const A=y.get(d);A&&(A.delete(g),A.size===0&&y.delete(d))}},[]),h=C.useCallback((d,g)=>{for(const[y,A]of c.current)if(jg(d,y))for(const S of A)try{S(g)}catch{}},[]);return C.useEffect(()=>{const d=cg(),g=Ec({path:"/socket.io",transports:["polling","websocket"],upgrade:!0,reconnection:!0,reconnectionAttempts:1/0,reconnectionDelay:2e3,...d?{auth:{token:d}}:{}});return n.current=g,console.log("[lt-socketio] connecting..."),g.on("connect",()=>{console.log("[lt-socketio] connected, id:",g.id),a(!0)}),g.on("disconnect",y=>{console.log("[lt-socketio] disconnected:",y),a(!1)}),g.on("connect_error",y=>{console.warn("[lt-socketio] connect error:",y.message),a(!1)}),g.onAny((y,A)=>{if(y.startsWith("lt."))try{const S=typeof A=="string"?JSON.parse(A):A;h(y,S)}catch{}}),()=>{g.removeAllListeners(),g.disconnect(),n.current=null,a(!1)}},[h]),p.jsx(Z_.Provider,{value:{connected:s,subscribe:f},children:p.jsx(Pc.Provider,{value:{connected:s,subscribe:f},children:r})})}function ew({children:r}){const[n,s]=C.useState(null),[a,c]=C.useState({url:null,token:null});return C.useEffect(()=>{let f=!1;async function h(){var d;try{console.log("[lt-transport] detecting event transport...");const g=await fetch("/api/settings");if(!g.ok){console.warn("[lt-transport] settings fetch failed, falling back to socketio"),f||s("socketio");return}const y=await g.json(),A=(d=y==null?void 0:y.events)==null?void 0:d.transport;if(console.log("[lt-transport] server reports:",A),!f){if(A==="nats"){let S=y.events.natsWsUrl??null,j=null;const z=cg();if(z)try{const R=await fetch("/api/nats-credentials",{headers:{Authorization:`Bearer ${z}`}});if(R.ok){const H=await R.json();S=H.natsWsUrl??S,j=H.natsToken??null}}catch{console.warn("[lt-transport] failed to fetch NATS credentials")}c({url:S,token:j})}s(A==="nats"?"nats":"socketio")}}catch(g){console.warn("[lt-transport] settings fetch error, falling back to socketio",g),f||s("socketio")}}return h(),()=>{f=!0}},[]),n==="nats"?p.jsx(i_,{url:a.url,token:a.token,children:r}):n==="socketio"?p.jsx(W_,{children:r}):p.jsx(p.Fragment,{children:r})}const $g=C.createContext(null),C0="lt_sidebar_collapsed";function tw({children:r}){const[n,s]=C.useState(()=>{try{return localStorage.getItem(C0)==="true"}catch{return!1}}),a=C.useCallback(()=>{s(c=>{const f=!c;try{localStorage.setItem(C0,String(f))}catch{}return f})},[]);return p.jsx($g.Provider,{value:{collapsed:n,toggle:a},children:r})}function Yg(){const r=C.useContext($g);if(!r)throw new Error("useSidebar must be used within SidebarProvider");return r}function iE(r){const n=r?`?period=${r}`:"";return fs({queryKey:["escalationStats",r],queryFn:()=>Ie(`/escalations/stats${n}`)})}function rE(){return fs({queryKey:["escalationTypes"],queryFn:()=>Ie("/escalations/types")})}function nw(r){const n=new URLSearchParams;return r.status&&n.set("status",r.status),r.role&&n.set("role",r.role),r.type&&n.set("type",r.type),r.subtype&&n.set("subtype",r.subtype),r.assigned_to&&n.set("assigned_to",r.assigned_to),r.priority&&n.set("priority",String(r.priority)),r.limit&&n.set("limit",String(r.limit)),r.offset!==void 0&&n.set("offset",String(r.offset)),r.sort_by&&n.set("sort_by",r.sort_by),r.order&&n.set("order",r.order),fs({queryKey:["escalations",r],queryFn:()=>Ie(`/escalations?${n}`)})}function sw(r){const n=new URLSearchParams;return r.role&&n.set("role",r.role),r.type&&n.set("type",r.type),r.subtype&&n.set("subtype",r.subtype),r.priority&&n.set("priority",String(r.priority)),r.limit&&n.set("limit",String(r.limit)),r.offset!==void 0&&n.set("offset",String(r.offset)),r.sort_by&&n.set("sort_by",r.sort_by),r.order&&n.set("order",r.order),fs({queryKey:["escalations","available",r],queryFn:()=>Ie(`/escalations/available?${n}`)})}function aE(r){return fs({queryKey:["escalations","by-workflow",r],queryFn:()=>Ie(`/escalations/by-workflow/${r}`),enabled:!!r})}function lE(r){return fs({queryKey:["escalations",r],queryFn:()=>Ie(`/escalations/${r}`),enabled:!!r})}function cE(){const r=Nn();return Ln({mutationFn:({id:n,durationMinutes:s})=>Ie(`/escalations/${n}/claim`,{method:"POST",body:JSON.stringify({durationMinutes:s})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function oE(){const r=Nn();return Ln({mutationFn:n=>Ie(`/escalations/${n}/release`,{method:"POST"}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function uE(){const r=Nn();return Ln({mutationFn:({id:n,resolverPayload:s})=>Ie(`/escalations/${n}/resolve`,{method:"POST",body:JSON.stringify({resolverPayload:s})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"}),r.invalidateQueries({queryKey:["tasks"],refetchType:"all"}),r.invalidateQueries({queryKey:["jobs"],refetchType:"all"})}})}function fE(){const r=Nn();return Ln({mutationFn:({id:n,targetRole:s})=>Ie(`/escalations/${n}/escalate`,{method:"PATCH",body:JSON.stringify({targetRole:s})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function hE(){const r=Nn();return Ln({mutationFn:({ids:n,priority:s})=>Ie("/escalations/priority",{method:"PATCH",body:JSON.stringify({ids:n,priority:s})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function dE(){const r=Nn();return Ln({mutationFn:({ids:n,durationMinutes:s})=>Ie("/escalations/bulk-claim",{method:"POST",body:JSON.stringify({ids:n,durationMinutes:s})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function mE(){const r=Nn();return Ln({mutationFn:({ids:n,targetUserId:s,durationMinutes:a})=>Ie("/escalations/bulk-assign",{method:"POST",body:JSON.stringify({ids:n,targetUserId:s,durationMinutes:a})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function pE(){const r=Nn();return Ln({mutationFn:({ids:n,targetRole:s})=>Ie("/escalations/bulk-escalate",{method:"PATCH",body:JSON.stringify({ids:n,targetRole:s})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function gE(){const r=Nn();return Ln({mutationFn:({ids:n,hint:s})=>Ie("/escalations/bulk-triage",{method:"POST",body:JSON.stringify({ids:n,...s?{hint:s}:{}})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function iw(){const{user:r}=Ai(),n=r==null?void 0:r.userId,s=Nn(),a=C.useRef(null),c=C.useCallback(()=>{a.current||(a.current=setTimeout(()=>{a.current=null,s.invalidateQueries({queryKey:["escalations"]})},15e3))},[s]);Tg(`${e_}.escalation.>`,c);const{data:f}=sw({limit:1}),{data:h}=nw({assigned_to:n,status:"pending",limit:200}),d=new Date,g=((h==null?void 0:h.escalations)??[]).filter(y=>y.assigned_until&&new Date(y.assigned_until)>d);return{available:(f==null?void 0:f.total)??0,mine:g.length}}function rw({className:r="",onClick:n}){const{connected:s}=t_();return p.jsxs("button",{type:"button",onClick:n,className:`relative text-text-tertiary hover:text-accent transition-colors ${r}`,title:s?"Live events enabled":"Live events disconnected","aria-label":s?"Live events enabled":"Live events disconnected",children:[p.jsx(xx,{className:"w-4 h-4",strokeWidth:1.5}),p.jsx("span",{className:`absolute -top-1 -right-1 w-2 h-2 rounded-full ${s?"bg-emerald-500":"bg-text-tertiary"}`,"data-testid":"nats-status-dot"})]})}function rh({size:r="sm",hideLabel:n=!1}){const s=r==="lg",a=s?"w-[16rem] h-[16rem] -rotate-[120deg] opacity-40 -ml-10":"w-[12.5rem] h-[12.5rem] -rotate-[120deg] opacity-40 -ml-8",c=s?"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 p.jsxs("div",{className:"flex items-center",style:{height:"50px"},children:[p.jsx("img",{src:"/logo512.png",alt:"LongTail",className:`shrink-0 z-0 ${a}`}),p.jsx("span",{className:`z-[1] transition-opacity duration-300 ${c} ${n?"opacity-0":""}`,children:"LongTail"})]})}function k0({count:r,active:n,color:s="bg-blue-500",textColor:a="text-blue-500"}){return p.jsxs(p.Fragment,{children:[p.jsx("span",{className:`absolute -top-1 -right-1 w-2 h-2 rounded-full ${n?s:"bg-text-tertiary/40"}`}),p.jsx("span",{className:`absolute -top-2.5 -right-3 text-[8px] font-bold tabular-nums ${n?a:"text-text-tertiary"}`,children:r})]})}function aw({onToggleEventFeed:r,onToggleDocs:n}){const{user:s,logout:a}=Ai(),{available:c,mine:f}=iw(),[h,d]=C.useState(!1),g=C.useRef(null);return C.useEffect(()=>{if(!h)return;const y=A=>{g.current&&!g.current.contains(A.target)&&d(!1)};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[h]),p.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:[p.jsx("div",{className:"flex items-center gap-4",children:p.jsx(pr,{to:"/","aria-label":"Home",children:p.jsx(rh,{})})}),p.jsxs("div",{className:"flex items-center gap-4",children:[p.jsxs(pr,{to:"/escalations/available",className:"relative text-text-tertiary hover:text-accent transition-colors","aria-label":"Available escalations",title:"Available escalations",children:[p.jsx(vx,{className:"w-4 h-4",strokeWidth:1.5}),p.jsx(k0,{count:c,active:c>0})]}),p.jsxs(pr,{to:"/escalations/queue",className:"relative text-text-tertiary hover:text-accent transition-colors","aria-label":"My escalation queue",title:"My escalation queue",children:[p.jsx(_x,{className:"w-4 h-4",strokeWidth:1.5}),p.jsx(k0,{count:f,active:f>0,color:"bg-status-warning",textColor:"text-status-warning"})]}),p.jsx("div",{className:"w-px h-5 bg-surface-border"}),p.jsx(rw,{onClick:r}),p.jsx("button",{onClick:n,className:"text-text-tertiary hover:text-accent transition-colors","aria-label":"Documentation",title:"Documentation",children:p.jsx(ng,{className:"w-4 h-4",strokeWidth:1.5})}),s&&p.jsxs("div",{className:"relative",ref:g,children:[p.jsxs("button",{onClick:()=>d(y=>!y),className:"btn-ghost text-xs flex items-center gap-1",children:[p.jsx(wx,{className:"w-3.5 h-3.5 text-accent/75",strokeWidth:1.5}),s.displayName||s.username||s.userId,p.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),h&&p.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:[p.jsx(pr,{to:"/credentials",onClick:()=>d(!1),className:"block px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Credentials"}),p.jsx("button",{onClick:()=>{d(!1),a()},className:"block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Sign Out"})]})]})]})]})}function ah({open:r,children:n}){const[s,a]=C.useState(r);return C.useEffect(()=>{r&&a(!0)},[r]),p.jsx("div",{className:`grid transition-[grid-template-rows] duration-300 ease-out ${r?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,onTransitionEnd:()=>{r||a(!1)},children:p.jsx("div",{className:"overflow-hidden",children:s?n:null})})}function $f(r){return({isActive:n})=>{const s="flex items-center rounded-md transition-colors duration-150",a="bg-surface-hover text-text-primary font-medium",c="text-text-secondary hover:text-text-primary hover:bg-surface-hover";return r?`${s} justify-center w-10 h-10 mx-auto ${n?a:c}`:`${s} gap-3 px-4 py-2 text-sm ${n?a:c}`}}function lw(){return({isActive:r})=>`flex items-center gap-3 pl-11 pr-4 py-1.5 text-xs rounded-md transition-colors duration-150 ${r?"text-text-primary font-medium":"text-text-secondary hover:text-text-primary"}`}function cw({group:r,collapsed:n}){const{pathname:s}=Ei(),a=r.matchPaths.some(d=>s.startsWith(d)),[c,f]=C.useState(a),h=c||a;return n?p.jsx(p.Fragment,{children:r.items.map(d=>p.jsx(Ac,{to:d.to,className:$f(!0),title:d.label,children:d.icon&&p.jsx(d.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})},d.to))}):p.jsxs("div",{children:[p.jsxs("button",{onClick:()=>f(d=>!d),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:[p.jsxs("span",{className:"flex items-center gap-3",children:[r.icon&&p.jsx(r.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),p.jsx("span",{children:r.label})]}),p.jsx("svg",{className:`w-3.5 h-3.5 text-text-tertiary transition-transform duration-150 ${h?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),p.jsx(ah,{open:h,children:r.items.map(d=>p.jsxs(Ac,{to:d.to,end:d.end,className:lw(),children:[d.icon&&p.jsx(d.icon,{className:"w-4 h-4 shrink-0 text-accent/75",strokeWidth:1.5}),p.jsx("span",{children:d.label})]},d.to))})]})}function ow(r){return r.kind==="group"}function uw({entry:r,collapsed:n}){const{pathname:s,search:a}=Ei();if(r.to.includes("?")){const[f,h]=r.to.split("?"),d=s===f&&a===`?${h}`,g=$f(n)({isActive:d});return p.jsxs(Ac,{to:r.to,className:g,title:n?r.label:void 0,children:[r.icon&&p.jsx(r.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),!n&&p.jsx("span",{children:r.label})]})}return p.jsxs(Ac,{to:r.to,end:r.end,className:$f(n),title:n?r.label:void 0,children:[r.icon&&p.jsx(r.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),!n&&p.jsx("span",{children:r.label})]})}function Gc({heading:r,entries:n}){const{collapsed:s}=Yg();return p.jsxs("div",{className:"space-y-1",children:[s?p.jsx("div",{className:"h-px bg-surface-border mx-3 my-2",title:r}):p.jsx("p",{className:"px-4 pt-5 pb-2 text-xs font-semibold uppercase tracking-wider text-accent/80",children:r}),n.map(a=>ow(a)?p.jsx(cw,{group:a,collapsed:s},a.label):p.jsx(uw,{entry:a,collapsed:s},a.to))]})}const fw=[{to:"/admin/users",label:"Accounts",icon:Sx},{to:"/admin/roles",label:"Roles & Permissions",icon:Ex},{to:"/admin/maintenance",label:"DB Maintenance",icon:Ax},{to:"/admin/controlplane",label:"Task Queues",icon:Ox}];function hw(){return p.jsx(Gc,{heading:"Admin",entries:fw})}const dw=[{to:"/workflows/registry",label:"Workflow Registry",icon:jx},{to:"/workflows/start",label:"Invoke Workflow",icon:Tx},{to:"/workflows/executions",label:"Durable Executions",icon:sg}];function mw(){return p.jsx(Gc,{heading:"Durable Workflows",entries:dw})}const pw=[{to:"/mcp/queries",label:"MCP Tool Designer",icon:Nx},{to:"/mcp/servers",label:"MCP Server Tools",icon:Cx},{to:"/mcp/workflows",label:"MCP Pipeline Tools",icon:Yf},{to:"/mcp/executions",label:"Pipeline Executions",icon:sg}];function gw(){return p.jsx(Gc,{heading:"MCP Workflows",entries:pw})}const yw=[{to:"/files",label:"Files",icon:kx},{to:"/knowledge",label:"Knowledge",icon:Mx}];function bw(){return p.jsx(Gc,{heading:"Storage",entries:yw})}function xw({children:r,className:n=""}){return p.jsx("p",{className:`text-[10px] font-semibold uppercase tracking-widest text-text-tertiary ${n}`,children:r})}const yf=280,M0="cubic-bezier(0.4, 0, 0.2, 1)",gc=40;function vw(r){if(!r)return"scale(0.92)";const n=window.innerWidth,s=window.innerHeight,a=n-gc*2,c=s-gc*2,f=r.width/a,h=r.height/c,d=r.left+r.width/2-(gc+a/2),g=r.top+r.height/2-(gc+c/2);return`translate(${d}px, ${g}px) scale(${f}, ${h})`}function Gg({open:r,onClose:n,sourceRef:s,children:a}){const[c,f]=C.useState(null),h=C.useRef(null),d=C.useRef(!1);C.useEffect(()=>{var j,z;r&&!d.current?(h.current=((j=s==null?void 0:s.current)==null?void 0:j.getBoundingClientRect())??null,f("entering")):!r&&d.current&&c==="open"&&(h.current=((z=s==null?void 0:s.current)==null?void 0:z.getBoundingClientRect())??null,f("exiting")),d.current=r},[r,s,c]),C.useEffect(()=>{if(c!=="entering")return;const j=requestAnimationFrame(()=>{requestAnimationFrame(()=>f("open"))});return()=>cancelAnimationFrame(j)},[c]),C.useEffect(()=>{if(c)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[c]),C.useEffect(()=>{if(!c)return;const j=z=>{z.key==="Escape"&&n()};return document.addEventListener("keydown",j),()=>document.removeEventListener("keydown",j)},[c,n]);const g=C.useCallback(j=>{j.propertyName==="transform"&&c==="exiting"&&f(null)},[c]);if(C.useEffect(()=>{if(c!=="exiting")return;const j=setTimeout(()=>f(null),yf+50);return()=>clearTimeout(j)},[c]),!c)return null;const y=c==="entering"||c==="exiting",A=y?vw(h.current):"none",S=y?0:1;return eg.createPortal(p.jsx("div",{className:"fixed inset-0 z-50 overflow-auto p-10",style:{transformOrigin:"center center",transition:`transform ${yf}ms ${M0}, opacity ${yf}ms ${M0}`,transform:A,opacity:S,backgroundColor:"#FFFFFF"},onTransitionEnd:g,children:a}),document.body)}function _w({className:r}){return p.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M4 12h8M4 18h12"})})}function ww({className:r}){return p.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 7l-5 5 5 5M16 7l5 5-5 5"})})}function Sw({className:r}){return p.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:p.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 Ew({className:r}){return p.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}function Aw({className:r}){return p.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:p.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 Ow({className:r}){return p.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:p.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 jw(r){const n=r.trim().split(`
54
+ `);if(n.length<2)return r;const s=d=>d.split("|").map(g=>g.trim()).filter(Boolean),a=s(n[0]),c=n.slice(2),f=a.map(d=>`<th class="px-3 py-1.5 text-left text-[10px] font-semibold uppercase tracking-wider text-text-tertiary">${d}</th>`).join(""),h=c.map(d=>`<tr class="border-t border-surface-border">${s(d).map(A=>`<td class="px-3 py-1.5 text-xs text-text-secondary">${A}</td>`).join("")}</tr>`).join("");return`<table class="w-full my-3 text-xs"><thead><tr class="border-b border-surface-border">${f}</tr></thead><tbody>${h}</tbody></table>`}function yc(r){return r.toLowerCase().replace(/<[^>]+>/g,"").replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").trim()}function Tw(r){const n=[];let s=r.replace(/```(\w*)\n([\s\S]*?)```/g,(g,y,A)=>{const S=n.length;return n.push(`<pre class="bg-surface-sunken rounded p-3 my-2 overflow-x-auto text-[11px] leading-relaxed"><code>${A}</code></pre>`),`\0CODE${S}\0`});const a=/^(\|.+\|)\n(\|[-| :]+\|)\n((?:\|.+\|\n?)+)/gm;s=s.replace(a,(g,y,A,S)=>jw(`${y}
55
+ ${A}
56
+ ${S.trimEnd()}`)),s=s.replace(/`([^`]+)`/g,'<code class="bg-surface-sunken px-1 py-0.5 rounded text-[11px]">$1</code>'),s=s.replace(/^#### (.+)$/gm,(g,y)=>`<h4 id="${yc(y)}" class="text-xs font-semibold text-text-primary mt-4 mb-1">${y}</h4>`).replace(/^### (.+)$/gm,(g,y)=>`<h3 id="${yc(y)}" class="text-sm font-semibold text-text-primary mt-5 mb-1.5">${y}</h3>`).replace(/^## (.+)$/gm,(g,y)=>`<h2 id="${yc(y)}" class="text-base font-semibold text-text-primary mt-6 mb-2 pb-1 border-b border-surface-border">${y}</h2>`).replace(/^# (.+)$/gm,(g,y)=>`<h1 id="${yc(y)}" class="text-lg font-bold text-text-primary mb-3">${y}</h1>`),s=s.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/\[([^\]]+)\]\(#([^)]+)\)/g,'<a data-anchor="$2" class="text-accent hover:underline cursor-pointer">$1</a>').replace(/\[([^\]]+)\]\(([^)]*\.md(?:#[^)]*)?)\)/g,'<a data-doc-link="$2" class="text-accent hover:underline cursor-pointer">$1</a>').replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" class="text-accent hover:underline">$1</a>').replace(/^ - (.+)$/gm,'<li class="ml-8 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^ - (.+)$/gm,'<li class="ml-8 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^- (.+)$/gm,'<li class="ml-4 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^\d+\. (.+)$/gm,'<li class="ml-4 list-decimal text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^---+$/gm,'<hr class="border-surface-border my-4" />').replace(/(?:^> (.+)$\n?)+/gm,g=>{const y=g.replace(/^> /gm,"").trim(),A=/⚠️|warning|caution/i.test(y),S=/note:|ℹ️|info/i.test(y);return`<div class="${A?"bg-status-warning/5":S?"bg-accent/5":"bg-surface-sunken/50"} ${A?"border-status-warning":S?"border-accent":"border-text-tertiary"} border-l-2 rounded-r-md px-3 py-2 my-3 text-xs text-text-secondary leading-relaxed">${y}</div>`}).replace(/\n\n/g,"\0PARA\0").replace(/\n/g,"<br/>");const c=g=>g.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),f=g=>new RegExp(`(${c(g)}[\\s\\S]*?<\\/li>(?:<br\\/>)?)+`,"g");s=s.replace(f('<li class="ml-8 list-disc'),g=>`<ul class="mb-3">${g}</ul>`),s=s.replace(f('<li class="ml-4 list-disc'),g=>`<ul class="mb-3">${g}</ul>`),s=s.replace(f('<li class="ml-4 list-decimal'),g=>`<ol class="list-decimal mb-3">${g}</ol>`),s=s.replace(/\x00CODE(\d+)\x00/g,(g,y)=>n[parseInt(y,10)]);const h="text-xs leading-relaxed text-text-secondary mb-2",d=/<\/(h[1-4]|pre|table|ul|ol|hr|div)>/;return s=s.split("\0PARA\0").map(g=>{const y=g.trim();if(!y)return"";const A=[];let S=y,j;for(;(j=d.exec(S))!==null;){const z=j.index+j[0].length;A.push(S.slice(0,z)),S=S.slice(z).replace(/^<br\/>/,"").trim(),d.lastIndex=0}return S&&A.push(S),A.map(z=>{const R=z.trim();return R?/^\s*<(h[1-4]|pre|table|ul|ol|hr|div)/.test(R)?R:`<p class="${h}">${R}</p>`:""}).join("")}).join(""),s}const Nw=/(\*\*|^#{1,4}\s|^- |^\d+\.\s|```|^\|.*\|$|\[.+\]\(.+\))/m;function Cw(r){return Nw.test(r)}function lh({content:r,className:n,onClick:s}){const a=C.useMemo(()=>Tw(r),[r]);return p.jsx("div",{className:n,onClick:s,dangerouslySetInnerHTML:{__html:a}})}function Dc({data:r,depth:n=0,generation:s}){const c=s!==void 0&&s>0&&s%2===1?!1:n>0,[f,h]=C.useState(c),[d,g]=C.useState(s);if(s!==void 0&&s!==d&&(g(s),h(s%2===0&&n>0)),r==null)return p.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof r=="string")return p.jsxs("span",{className:"text-text-primary",children:['"',r,'"']});if(typeof r=="number"||typeof r=="boolean")return p.jsx("span",{className:"text-text-primary font-medium",children:String(r)});if(Array.isArray(r))return r.length===0?p.jsx("span",{className:"text-text-tertiary",children:"[]"}):f?p.jsxs("button",{onClick:()=>h(!1),className:"text-text-secondary hover:text-text-primary",children:["[",r.length," items]"]}):p.jsxs("span",{children:[p.jsx("button",{onClick:()=>h(!0),className:"text-text-tertiary hover:text-text-primary",children:"["}),p.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:r.map((y,A)=>p.jsxs("div",{children:[p.jsx(Dc,{data:y,depth:n+1,generation:s}),A<r.length-1&&p.jsx("span",{className:"text-text-tertiary",children:","})]},A))}),p.jsx("span",{className:"text-text-tertiary",children:"]"})]});if(typeof r=="object"){const y=Object.entries(r);return y.length===0?p.jsx("span",{className:"text-text-tertiary",children:"{}"}):f?p.jsxs("button",{onClick:()=>h(!1),className:"text-text-secondary hover:text-text-primary",children:["{","...","}"]}):p.jsxs("span",{children:[p.jsx("button",{onClick:()=>h(!0),className:"text-text-tertiary hover:text-text-primary",children:"{"}),p.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:y.map(([A,S],j)=>p.jsxs("div",{children:[p.jsx("span",{className:"text-text-secondary",children:A}),p.jsx("span",{className:"text-text-tertiary",children:": "}),p.jsx(Dc,{data:S,depth:n+1,generation:s}),j<y.length-1&&p.jsx("span",{className:"text-text-tertiary",children:","})]},A))}),p.jsx("span",{className:"text-text-tertiary",children:"}"})]})}return p.jsx("span",{children:String(r)})}function Da({data:r,depth:n=0}){if(r==null)return p.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof r=="string")return r.length>40&&Cw(r)?p.jsx(lh,{content:r}):p.jsx("span",{className:"text-text-primary",children:r});if(typeof r=="number"||typeof r=="boolean")return p.jsx("span",{className:"text-text-primary font-medium",children:String(r)});if(Array.isArray(r))return r.length===0?p.jsx("span",{className:"text-text-tertiary italic",children:"empty list"}):p.jsx("div",{className:"space-y-2",children:r.map((s,a)=>p.jsxs("div",{className:"flex items-baseline gap-2",children:[p.jsxs("span",{className:"text-text-tertiary text-[10px] shrink-0",children:[a+1,"."]}),p.jsx("div",{className:"flex-1",children:p.jsx(Da,{data:s,depth:n+1})})]},a))});if(typeof r=="object"){const s=Object.entries(r);return s.length===0?p.jsx("span",{className:"text-text-tertiary italic",children:"empty"}):p.jsx("div",{className:n>0?"pl-4 border-l border-surface-border space-y-3":"space-y-3",children:s.map(([a,c])=>{const f=c===null||typeof c!="object";return p.jsxs("div",{children:[p.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-0.5",children:a.replace(/[_-]/g," ")}),f?p.jsx("p",{className:"text-sm text-text-primary",children:p.jsx(Da,{data:c,depth:n+1})}):p.jsx(Da,{data:c,depth:n+1})]},a)})})}return p.jsx("span",{children:String(r)})}function R0({mode:r,setMode:n,isCollapsed:s,onToggleCollapse:a,onCopy:c,copied:f,onFullscreen:h,onClose:d,large:g}){const y=g?"w-5 h-5":"w-3.5 h-3.5",A=`${g?"p-2":"p-1.5"} rounded text-text-tertiary hover:text-text-primary hover:bg-surface-raised transition-colors duration-150`;return p.jsxs("div",{className:"flex items-center gap-0.5 bg-surface-sunken/80 rounded-md backdrop-blur-sm",children:[r==="json"&&p.jsx("button",{onClick:a,className:A,title:s?"Expand all":"Collapse all",children:s?p.jsx(Ow,{className:y}):p.jsx(Aw,{className:y})}),p.jsx("button",{onClick:()=>n(r==="json"?"tree":"json"),className:A,title:r==="json"?"Outline view":"JSON view",children:r==="json"?p.jsx(_w,{className:y}):p.jsx(ww,{className:y})}),p.jsx("button",{onClick:c,className:A,title:"Copy to clipboard",children:f?p.jsx(Ew,{className:`${y} text-status-success`}):p.jsx(Sw,{className:y})}),h&&p.jsx("button",{onClick:h,className:A,title:"Fullscreen",children:p.jsx(ig,{className:y})}),d&&p.jsx("button",{onClick:d,className:A,title:"Close (Esc)",children:p.jsx(rg,{className:y})})]})}function kw({data:r,label:n,variant:s,defaultCollapsed:a=!1,defaultMode:c}){const f=C.useRef(null),[h,d]=C.useState(c??"json"),[g,y]=C.useState(!1),[A,S]=C.useState(!1),[j,z]=C.useState(0),[R,H]=C.useState(1),ee=j%2===0,ne=R%2===0,W=C.useCallback(()=>z(K=>K+1),[]),me=C.useCallback(()=>H(K=>K+1),[]);let be=r;if(typeof r=="string")try{be=JSON.parse(r)}catch{}const k=async()=>{const K=typeof r=="string"?r:JSON.stringify(be,null,2);await navigator.clipboard.writeText(K),y(!0),setTimeout(()=>y(!1),2e3)},I=C.useCallback(()=>{H(1),S(!0)},[]),ie=s==="panel",Z=ie?"border border-accent-muted/40 rounded-lg p-3 bg-surface-hover/30":"",Q=ie?"font-mono text-xs leading-relaxed bg-white rounded-md p-4 overflow-x-auto break-all":"font-mono text-xs leading-relaxed bg-surface-sunken rounded-md p-4 overflow-x-auto break-all";return p.jsxs("div",{className:Z,children:[n&&p.jsx(xw,{children:n}),p.jsxs("div",{ref:f,className:"relative",children:[p.jsx("div",{className:"absolute top-2 right-2 z-[5]",children:p.jsx(R0,{mode:h,setMode:d,isCollapsed:ee,onToggleCollapse:W,onCopy:k,copied:g,onFullscreen:I})}),p.jsx("div",{className:Q,children:h==="json"?p.jsx(Dc,{data:be,generation:j}):p.jsx(Da,{data:be})})]}),p.jsxs(Gg,{open:A,onClose:()=>S(!1),sourceRef:f,children:[p.jsx("div",{className:"sticky top-0 float-right z-10",children:p.jsx(R0,{mode:h,setMode:d,isCollapsed:ne,onToggleCollapse:me,onCopy:k,copied:g,onClose:()=>S(!1),large:!0})}),p.jsx("div",{className:"font-mono text-sm leading-relaxed",children:h==="json"?p.jsx(Dc,{data:be,generation:R}):p.jsx(Da,{data:be})})]})]})}const Mw=100,D0=500;let Rw=0;const Vg={"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 z0({event:r,forceExpanded:n=!1}){var j,z;const[s,a]=C.useState(n),c=Vg[r.type]||"text-text-tertiary";C.useEffect(()=>{a(n)},[n]);const f=n,h=f?"text-xs":"text-[9px]",d=f?"text-xs":"text-[9px]",g=f?"text-xs":"text-[9px]",y=f?"w-3.5 h-3.5":"w-2.5 h-2.5",A=f?"py-2 px-4":"py-1 px-3",S=f?"pb-4 px-4":"pb-2 px-3";return p.jsxs("div",{className:"border-b border-surface-border/30 last:border-b-0",children:[p.jsxs("button",{onClick:()=>a(!s),className:`flex items-center gap-2 ${A} w-full text-left hover:bg-surface-hover/50 transition-colors`,children:[p.jsx("span",{className:`${h} font-mono text-text-tertiary whitespace-nowrap tabular-nums shrink-0`,children:new Date(r.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}),p.jsx("span",{className:`${d} font-medium px-1 py-0.5 rounded ${c} bg-surface-sunken whitespace-nowrap shrink-0`,children:r.type}),p.jsxs("span",{className:`${g} text-text-tertiary font-mono flex-1 min-w-0 truncate`,children:[(j=r.data)!=null&&j.workflowId?String(r.data.workflowId):"",(z=r.data)!=null&&z.escalationId?` esc:${String(r.data.escalationId).slice(0,12)}`:""]}),p.jsx("svg",{className:`${y} text-text-tertiary shrink-0 transition-transform duration-150 ${s?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),p.jsx(ah,{open:s,children:p.jsx("div",{className:S,children:p.jsx(kw,{data:r.data})})})]})}function Dw({open:r,onToggle:n}){const[s,a]=C.useState([]),[c,f]=C.useState(!1),h=C.useRef(null),d=C.useRef(new Map);return Tg("lt.events.>",C.useCallback(g=>{const y=String(g.type||"unknown");if(y.startsWith("mesh."))return;const A=`${y}:${g.timestamp||""}:${g.escalationId||g.workflowId||g.taskId||""}`,S=Date.now(),j=d.current.get(A);if(!(j&&S-j<D0)){if(d.current.set(A,S),d.current.size>200)for(const[z,R]of d.current)S-R>D0*2&&d.current.delete(z);a(z=>[{id:++Rw,type:y,timestamp:g.timestamp||new Date().toISOString(),data:g},...z].slice(0,Mw))}},[])),C.useEffect(()=>{r&&h.current&&(h.current.scrollTop=0)},[s.length,r]),p.jsxs("div",{className:"fixed bottom-0 left-0 right-0 z-40 border-t border-surface-border bg-surface-raised",children:[p.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:[r?p.jsx(Rx,{className:"w-3 h-3 text-text-tertiary"}):p.jsx(Dx,{className:"w-3 h-3 text-text-tertiary"}),p.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary",children:"Event Stream"}),s.length>0&&p.jsxs("span",{className:"text-[9px] text-text-tertiary",children:[s.length," events"]}),s.length>0&&!r&&p.jsx("span",{className:`text-[9px] font-medium px-1 py-0.5 rounded ${Vg[s[0].type]||"text-text-tertiary"} bg-surface-sunken`,children:s[0].type}),s.length>0&&p.jsxs("span",{className:"ml-auto flex items-center gap-1",children:[p.jsx("span",{className:"text-text-tertiary hover:text-text-primary p-0.5 cursor-pointer",title:"Fullscreen",onClick:g=>{g.stopPropagation(),f(!0)},children:p.jsx(ig,{className:"w-3 h-3"})}),p.jsx("span",{className:"text-text-tertiary hover:text-text-primary p-0.5 cursor-pointer",title:"Clear events",onClick:g=>{g.stopPropagation(),a([])},children:p.jsx(zx,{className:"w-3 h-3"})})]})]}),p.jsx(ah,{open:r,children:p.jsx("div",{ref:h,className:"h-48 overflow-y-auto",children:s.length===0?p.jsx("p",{className:"text-[10px] text-text-tertiary py-4 text-center",children:"Waiting for events..."}):s.map(g=>p.jsx(z0,{event:g},g.id))})}),p.jsxs(Gg,{open:c,onClose:()=>f(!1),sourceRef:h,children:[p.jsx("div",{className:"sticky top-0 float-right z-10",children:p.jsx("button",{onClick:()=>f(!1),className:"p-2 rounded text-text-tertiary hover:text-text-primary hover:bg-surface-raised transition-colors duration-150 bg-surface-sunken/80 backdrop-blur-sm",title:"Close (Esc)",children:p.jsx(rg,{className:"w-5 h-5"})})}),s.length===0?p.jsx("p",{className:"text-sm text-text-tertiary py-8",children:"No events captured"}):s.map(g=>p.jsx(z0,{event:g,forceExpanded:!0},g.id))]})]})}function zw(){return fs({queryKey:["docs"],queryFn:()=>Ie("/docs"),staleTime:5*6e4})}function qw(r){return fs({queryKey:["docs",r],queryFn:()=>Ie(`/docs/read?path=${encodeURIComponent(r)}`),enabled:!!r,staleTime:5*6e4})}function Uw(){const[r,n]=C.useState([]),[s,a]=C.useState([]),[c,f]=C.useState(null),h=C.useRef(c),d=C.useRef(r),g=C.useRef(s);h.current=c,d.current=r,g.current=s;const y=C.useCallback((R,H)=>{var ne;const ee=h.current;if(ee){const W=((ne=H==null?void 0:H.current)==null?void 0:ne.scrollTop)??0;n([...d.current,{...ee,scrollTop:W}])}a([]),f({path:R,scrollTop:0})},[]),A=C.useCallback(R=>{var W;const H=d.current;if(H.length===0)return;const ee=H[H.length-1],ne=h.current;if(ne){const me=((W=R==null?void 0:R.current)==null?void 0:W.scrollTop)??0;a([...g.current,{...ne,scrollTop:me}])}n(H.slice(0,-1)),f(ee),requestAnimationFrame(()=>{R!=null&&R.current&&(R.current.scrollTop=ee.scrollTop)})},[]),S=C.useCallback(R=>{var W;const H=g.current;if(H.length===0)return;const ee=H[H.length-1],ne=h.current;if(ne){const me=((W=R==null?void 0:R.current)==null?void 0:W.scrollTop)??0;n([...d.current,{...ne,scrollTop:me}])}a(H.slice(0,-1)),f(ee),requestAnimationFrame(()=>{R!=null&&R.current&&(R.current.scrollTop=ee.scrollTop)})},[]),j=C.useCallback(R=>{var ne,W;const H=h.current;if(!H)return;const ee=((ne=R==null?void 0:R.current)==null?void 0:ne.scrollTop)??0;n([...d.current,{...H,scrollTop:ee}]),a([]),f({...H,scrollTop:((W=R==null?void 0:R.current)==null?void 0:W.scrollTop)??0})},[]),z=C.useCallback(()=>{n([]),a([]),f(null)},[]);return{current:c,backStack:r,forwardStack:s,navigate:y,goBack:A,goForward:S,pushScrollPosition:j,reset:z}}function Bw(r,n){const[s,a]=r.split("#");let c=s;if(c.startsWith("./")||c.startsWith("../")){const h=((n?n.replace(/[^/]+$/,""):"")+c).split("/"),d=[];for(const g of h)g===".."?d.pop():g&&g!=="."&&d.push(g);c=d.join("/")}return{path:c,anchor:a}}function Lw(r){if(!r.startsWith("#docs"))return null;const n=r.slice(1).split(":"),s=n[1]||"README.md",a=n[2]||void 0;return{path:s,anchor:a}}function Hw(r){return!r||r==="README.md"?"#docs":`#docs:${r}`}function Pw({content:r,currentPath:n,onNavigate:s,onAnchorClick:a}){const c=f=>{var y;const h=f.target,d=h.closest("[data-anchor]");if(d){f.preventDefault(),a();const A=d.dataset.anchor,S=(y=d.closest(".docs-content"))==null?void 0:y.querySelector(`#${CSS.escape(A)}`);S==null||S.scrollIntoView({behavior:"smooth",block:"start"});return}const g=h.closest("[data-doc-link]");if(g){f.preventDefault();const{path:A,anchor:S}=Bw(g.dataset.docLink,n);s(A,S);return}};return p.jsx(lh,{content:r,className:"docs-content",onClick:c})}function $w(r){const n=[],s=new Map;for(const a of r){const c=a.path.split("/");if(c.length===1){n.push(a);continue}let f=s;for(let h=0;h<c.length-1;h++){const d=c[h];f.has(d)||f.set(d,{label:d,children:[],subdirs:new Map});const g=f.get(d);h===c.length-2?g.children.push(a):f=g.subdirs}}return{topLevel:n,dirs:s}}function Yw({docs:r,selected:n,onSelect:s}){const{topLevel:a,dirs:c}=$w(r),f=d=>`block w-full text-left px-3 py-1 text-xs rounded truncate transition-colors ${n===d?"bg-accent/10 text-accent":"text-text-secondary hover:bg-surface-hover"}`;function h(d,g){return p.jsxs("details",{open:!0,children:[p.jsxs("summary",{className:"flex items-center gap-1.5 px-3 py-1 text-[10px] font-semibold uppercase tracking-widest text-text-tertiary cursor-pointer",children:[p.jsx(qx,{className:"w-3 h-3",strokeWidth:1.5}),d.label]}),p.jsxs("div",{className:"pl-2 space-y-0.5",children:[[...d.subdirs.values()].map(y=>h(y)),d.children.map(y=>p.jsx("button",{className:f(y.path),onClick:()=>s(y.path),children:y.title},y.path))]})]},d.label)}return p.jsxs("div",{className:"space-y-0.5",children:[a.map(d=>p.jsx("button",{className:f(d.path),onClick:()=>s(d.path),children:d.title},d.path)),[...c.values()].map(d=>h(d))]})}function Gw({open:r,onClose:n}){var ie,Z,Q;const[s,a]=C.useState(!1),{data:c}=zw(),f=Uw(),{data:h,isLoading:d}=qw(((ie=f.current)==null?void 0:ie.path)??null),g=C.useRef(null),[y,A]=C.useState(null);C.useEffect(()=>{y&&(h!=null&&h.content)&&g.current&&requestAnimationFrame(()=>{var ae;const K=(ae=g.current)==null?void 0:ae.querySelector(`#${CSS.escape(y)}`);K==null||K.scrollIntoView({behavior:"smooth",block:"start"}),A(null)})},[y,h]);const S=C.useCallback(()=>{var re;const K=Lw(window.location.hash),ae=(K==null?void 0:K.path)??"README.md";((re=f.current)==null?void 0:re.path)!==ae&&f.navigate(ae,g),K!=null&&K.anchor&&A(K.anchor)},[f]),j=C.useRef(!0);C.useEffect(()=>{if(!r||!f.current)return;if(j.current){j.current=!1;return}const K=Hw(f.current.path);window.location.hash!==K&&window.history.replaceState(null,"",window.location.pathname+window.location.search+K)},[r,(Z=f.current)==null?void 0:Z.path]),C.useEffect(()=>{if(!r)return;const K=()=>{window.location.hash.startsWith("#docs")&&S()};return window.addEventListener("hashchange",K),()=>window.removeEventListener("hashchange",K)},[r,S]);const z=C.useCallback((K,ae)=>{ae&&A(ae),f.navigate(K,g)},[f]),R=C.useCallback(K=>{f.navigate(K,g)},[f]),H=C.useCallback(()=>{f.goBack(g)},[f]),ee=C.useCallback(()=>{f.goForward(g)},[f]),ne=C.useCallback(()=>{f.pushScrollPosition(g)},[f]);if(C.useEffect(()=>{if(r){j.current=!0,S();const K=requestAnimationFrame(()=>a(!0));return()=>cancelAnimationFrame(K)}},[r]),!(r||s))return null;const me=()=>{a(!1),setTimeout(()=>{n(),f.reset()},200)},be=((Q=f.current)==null?void 0:Q.path)??null,k=f.backStack.length>0,I=f.forwardStack.length>0;return p.jsxs("div",{className:"fixed inset-y-0 right-0 z-50 flex",children:[p.jsx("div",{className:`fixed inset-0 bg-black/20 transition-opacity duration-200 ${s&&r?"opacity-100":"opacity-0"}`,onClick:me}),p.jsxs("div",{className:`relative ml-auto w-[40vw] min-w-[800px] max-w-[90vw] h-full bg-surface-raised border-l border-surface-border flex flex-col shadow-xl transition-transform duration-200 ease-out ${s&&r?"translate-x-0":"translate-x-full"}`,children:[p.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border shrink-0",children:[p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsx("button",{onClick:H,disabled:!k,className:`p-0.5 transition-colors ${k?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Back",children:p.jsx(Ux,{className:"w-4 h-4"})}),p.jsx("button",{onClick:ee,disabled:!I,className:`p-0.5 transition-colors ${I?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Forward",children:p.jsx(Qp,{className:"w-4 h-4"})}),p.jsx(ng,{className:"w-4 h-4 text-accent ml-1",strokeWidth:1.5}),p.jsx("span",{className:"text-sm font-medium text-text-primary",children:"Documentation"})]}),p.jsx("button",{onClick:me,className:"p-1 text-text-tertiary hover:text-text-primary",children:p.jsx(Gf,{className:"w-4 h-4"})})]}),p.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[p.jsx("div",{className:"w-48 shrink-0 border-r border-surface-border overflow-y-auto py-2",children:c!=null&&c.docs?p.jsx(Yw,{docs:c.docs,selected:be,onSelect:R}):p.jsx("div",{className:"px-3 py-2 text-xs text-text-tertiary",children:"Loading..."})}),p.jsx("div",{ref:g,className:"flex-1 overflow-y-auto px-6 py-4",children:be?d?p.jsxs("div",{className:"animate-pulse space-y-2",children:[p.jsx("div",{className:"h-6 bg-surface-sunken rounded w-48"}),p.jsx("div",{className:"h-4 bg-surface-sunken rounded w-full"}),p.jsx("div",{className:"h-4 bg-surface-sunken rounded w-3/4"})]}):h!=null&&h.content?p.jsx(Pw,{content:h.content,currentPath:be,onNavigate:z,onAnchorClick:ne}):p.jsx("p",{className:"text-xs text-text-tertiary",children:"Document not found."}):p.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-text-tertiary",children:[p.jsx(Qp,{className:"w-5 h-5 mb-2"}),p.jsx("p",{className:"text-xs",children:"Select a document"})]})})]})]})]})}function Vw(r){if(r.includes("/escalations"))return["escalation","human-queue"]}const q0=2e3;function Fw(r){const s=r.filter(c=>!c.pending).slice(-8);return s.length===0?"":`[Prior conversation]
57
+ ${s.map(c=>`${c.role==="user"?"User":"Assistant"}: ${c.content}`).join(`
58
+ `)}
59
+ [End prior conversation]
60
+
61
+ `}function Jw(r){const n=r.summary,s=r.title;if(n){const a=n.search(/\n\s*\{[\s\S]*"title"\s*:/);return a>0?n.slice(0,a).trim():n}return s||(typeof r=="string"?r:"Query completed.")}const Fg=C.createContext(null);function Qw({children:r}){const n=Ei(),[s,a]=C.useState(!1),[c,f]=C.useState([]),[h,d]=C.useState(null),[g,y]=C.useState({}),A=C.useRef(null),S={page:n.pathname.split("/").filter(Boolean).join("-")||"home",route:n.pathname,params:{},...g,suggestedTags:g.suggestedTags??Vw(n.pathname)};C.useEffect(()=>()=>{A.current&&clearInterval(A.current)},[]);const j=C.useCallback(()=>a(ne=>!ne),[]),z=C.useCallback(ne=>{y(ne)},[]),R=C.useCallback(()=>{f([]),d(null)},[]),H=C.useCallback(async ne=>{var Z;const W=new Date().toISOString(),me={id:`user-${Date.now()}`,role:"user",content:ne,timestamp:W},be={id:`pending-${Date.now()}`,role:"assistant",content:"",timestamp:W,pending:!0};f(Q=>[...Q,me,be]);const k={...S};(Z=k.entities)!=null&&Z.yamlContent&&k.entities.yamlContent.length>q0&&(k.entities={...k.entities,yamlContent:k.entities.yamlContent.slice(0,q0)+`
62
+ ... (truncated)`});const ie=`${Fw(c.concat(me))}${ne}`;try{const K=(await Ie("/insight/mcp-query",{method:"POST",body:JSON.stringify({prompt:ie,tags:k.suggestedTags,context:k,wait:!1,direct:!0})})).workflow_id;d(K),f(ae=>ae.map(re=>re.id===be.id?{...re,workflowId:K}:re)),A.current&&clearInterval(A.current),A.current=setInterval(async()=>{var ae;try{const re=await Ie(`/workflows/${K}/result`),qe=(ae=re==null?void 0:re.result)==null?void 0:ae.data;if(qe){A.current&&clearInterval(A.current),A.current=null,d(null);const Ge=Jw(qe);let Le;try{Le=(await Ie(`/workflow-states/${K}/execution`)).duration_ms}catch{}f($=>$.map(te=>te.id===be.id?{...te,content:Ge,timestamp:new Date().toISOString(),pending:!1,durationMs:Le}:te))}}catch{}},3e3)}catch{f(Q=>Q.map(K=>K.id===be.id?{...K,content:"Failed to submit query. Please try again.",pending:!1}:K))}},[c,S]),ee=C.useCallback(async ne=>{const W=c.find(k=>k.id===ne);if(!(W!=null&&W.workflowId)||W.compilationStatus==="compiling"||W.compilationStatus==="done")return;const me=c.indexOf(W),be=c.slice(0,me).reverse().find(k=>k.role==="user");if(be){f(k=>k.map(I=>I.id===ne?{...I,compilationStatus:"compiling"}:I));try{const k=await Ie("/insight/mcp-query/describe",{method:"POST",body:JSON.stringify({prompt:be.content,summary:W.content})}),I=await Ie("/yaml-workflows",{method:"POST",body:JSON.stringify({workflow_id:W.workflowId,task_queue:"long-tail-system",workflow_name:"mcpQuery",name:k.tool_name,description:k.description,tags:k.tags,app_id:"longtail"})});await Ie(`/yaml-workflows/${I.id}/deploy`,{method:"POST"}),f(ie=>ie.map(Z=>Z.id===ne?{...Z,compilationStatus:"done"}:Z))}catch(k){const I=k instanceof Error?k.message:"Compilation failed";f(ie=>ie.map(Z=>Z.id===ne?{...Z,compilationStatus:"error",compilationError:I}:Z))}}},[c]);return p.jsx(Fg.Provider,{value:{helpOpen:s,setHelpOpen:a,toggleHelp:j,messages:c,sendMessage:H,pageContext:S,setPageContext:z,activeWorkflowId:h,clearMessages:R,compileMessage:ee},children:r})}function Jg(){const r=C.useContext(Fg);if(!r)throw new Error("useHelpAssistant must be used within HelpAssistantProvider");return r}function Xw(){const{helpOpen:r,toggleHelp:n}=Jg();return p.jsx("button",{onClick:n,className:"fixed right-3 z-[45] flex items-center justify-center w-10 h-10 rounded-full bg-surface-raised shadow-lg hover:scale-110 transition-transform duration-150 border border-accent/30",style:{bottom:"calc(var(--feed-height, 32px) + 12px)"},"aria-label":r?"Close help":"Ask for help",children:r?p.jsx(Gf,{className:"w-5 h-5 text-text-tertiary",strokeWidth:1.5}):p.jsx("img",{src:"/logo512.png",alt:"Help",className:"w-8 h-8 -rotate-[120deg]"})})}const Qg=6048e5,Iw=864e5,U0=6e4,B0=525600,L0=43200,H0=1440,P0=Symbol.for("constructDateFrom");function us(r,n){return typeof r=="function"?r(n):r&&typeof r=="object"&&P0 in r?r[P0](n):r instanceof Date?new r.constructor(n):new Date(n)}function nn(r,n){return us(n||r,r)}let Kw={};function $a(){return Kw}function La(r,n){var d,g,y,A;const s=$a(),a=(n==null?void 0:n.weekStartsOn)??((g=(d=n==null?void 0:n.locale)==null?void 0:d.options)==null?void 0:g.weekStartsOn)??s.weekStartsOn??((A=(y=s.locale)==null?void 0:y.options)==null?void 0:A.weekStartsOn)??0,c=nn(r,n==null?void 0:n.in),f=c.getDay(),h=(f<a?7:0)+f-a;return c.setDate(c.getDate()-h),c.setHours(0,0,0,0),c}function zc(r,n){return La(r,{...n,weekStartsOn:1})}function Xg(r,n){const s=nn(r,n==null?void 0:n.in),a=s.getFullYear(),c=us(s,0);c.setFullYear(a+1,0,4),c.setHours(0,0,0,0);const f=zc(c),h=us(s,0);h.setFullYear(a,0,4),h.setHours(0,0,0,0);const d=zc(h);return s.getTime()>=f.getTime()?a+1:s.getTime()>=d.getTime()?a:a-1}function qc(r){const n=nn(r),s=new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()));return s.setUTCFullYear(n.getFullYear()),+r-+s}function Ig(r,...n){const s=us.bind(null,r||n.find(a=>typeof a=="object"));return n.map(s)}function $0(r,n){const s=nn(r,n==null?void 0:n.in);return s.setHours(0,0,0,0),s}function Zw(r,n,s){const[a,c]=Ig(s==null?void 0:s.in,r,n),f=$0(a),h=$0(c),d=+f-qc(f),g=+h-qc(h);return Math.round((d-g)/Iw)}function Ww(r,n){const s=Xg(r,n),a=us(r,0);return a.setFullYear(s,0,4),a.setHours(0,0,0,0),zc(a)}function e2(r,n){const s=+nn(r)-+nn(n);return s<0?-1:s>0?1:s}function t2(r){return us(r,Date.now())}function n2(r){return r instanceof Date||typeof r=="object"&&Object.prototype.toString.call(r)==="[object Date]"}function s2(r){return!(!n2(r)&&typeof r!="number"||isNaN(+nn(r)))}function i2(r){return n=>{const a=(r?Math[r]:Math.trunc)(n);return a===0?0:a}}function r2(r,n){const s=nn(r,n==null?void 0:n.in);return s.setFullYear(s.getFullYear(),0,1),s.setHours(0,0,0,0),s}const a2={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},l2=(r,n,s)=>{let a;const c=a2[r];return typeof c=="string"?a=c:n===1?a=c.one:a=c.other.replace("{{count}}",n.toString()),s!=null&&s.addSuffix?s.comparison&&s.comparison>0?"in "+a:a+" ago":a};function bf(r){return(n={})=>{const s=n.width?String(n.width):r.defaultWidth;return r.formats[s]||r.formats[r.defaultWidth]}}const c2={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},o2={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},u2={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},f2={date:bf({formats:c2,defaultWidth:"full"}),time:bf({formats:o2,defaultWidth:"full"}),dateTime:bf({formats:u2,defaultWidth:"full"})},h2={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},d2=(r,n,s,a)=>h2[r];function Aa(r){return(n,s)=>{const a=s!=null&&s.context?String(s.context):"standalone";let c;if(a==="formatting"&&r.formattingValues){const h=r.defaultFormattingWidth||r.defaultWidth,d=s!=null&&s.width?String(s.width):h;c=r.formattingValues[d]||r.formattingValues[h]}else{const h=r.defaultWidth,d=s!=null&&s.width?String(s.width):r.defaultWidth;c=r.values[d]||r.values[h]}const f=r.argumentCallback?r.argumentCallback(n):n;return c[f]}}const m2={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},p2={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},g2={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},y2={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},b2={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},x2={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},v2=(r,n)=>{const s=Number(r),a=s%100;if(a>20||a<10)switch(a%10){case 1:return s+"st";case 2:return s+"nd";case 3:return s+"rd"}return s+"th"},_2={ordinalNumber:v2,era:Aa({values:m2,defaultWidth:"wide"}),quarter:Aa({values:p2,defaultWidth:"wide",argumentCallback:r=>r-1}),month:Aa({values:g2,defaultWidth:"wide"}),day:Aa({values:y2,defaultWidth:"wide"}),dayPeriod:Aa({values:b2,defaultWidth:"wide",formattingValues:x2,defaultFormattingWidth:"wide"})};function Oa(r){return(n,s={})=>{const a=s.width,c=a&&r.matchPatterns[a]||r.matchPatterns[r.defaultMatchWidth],f=n.match(c);if(!f)return null;const h=f[0],d=a&&r.parsePatterns[a]||r.parsePatterns[r.defaultParseWidth],g=Array.isArray(d)?S2(d,S=>S.test(h)):w2(d,S=>S.test(h));let y;y=r.valueCallback?r.valueCallback(g):g,y=s.valueCallback?s.valueCallback(y):y;const A=n.slice(h.length);return{value:y,rest:A}}}function w2(r,n){for(const s in r)if(Object.prototype.hasOwnProperty.call(r,s)&&n(r[s]))return s}function S2(r,n){for(let s=0;s<r.length;s++)if(n(r[s]))return s}function E2(r){return(n,s={})=>{const a=n.match(r.matchPattern);if(!a)return null;const c=a[0],f=n.match(r.parsePattern);if(!f)return null;let h=r.valueCallback?r.valueCallback(f[0]):f[0];h=s.valueCallback?s.valueCallback(h):h;const d=n.slice(c.length);return{value:h,rest:d}}}const A2=/^(\d+)(th|st|nd|rd)?/i,O2=/\d+/i,j2={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},T2={any:[/^b/i,/^(a|c)/i]},N2={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},C2={any:[/1/i,/2/i,/3/i,/4/i]},k2={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},M2={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},R2={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},D2={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},z2={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},q2={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},U2={ordinalNumber:E2({matchPattern:A2,parsePattern:O2,valueCallback:r=>parseInt(r,10)}),era:Oa({matchPatterns:j2,defaultMatchWidth:"wide",parsePatterns:T2,defaultParseWidth:"any"}),quarter:Oa({matchPatterns:N2,defaultMatchWidth:"wide",parsePatterns:C2,defaultParseWidth:"any",valueCallback:r=>r+1}),month:Oa({matchPatterns:k2,defaultMatchWidth:"wide",parsePatterns:M2,defaultParseWidth:"any"}),day:Oa({matchPatterns:R2,defaultMatchWidth:"wide",parsePatterns:D2,defaultParseWidth:"any"}),dayPeriod:Oa({matchPatterns:z2,defaultMatchWidth:"any",parsePatterns:q2,defaultParseWidth:"any"})},Kg={code:"en-US",formatDistance:l2,formatLong:f2,formatRelative:d2,localize:_2,match:U2,options:{weekStartsOn:0,firstWeekContainsDate:1}};function B2(r,n){const s=nn(r,n==null?void 0:n.in);return Zw(s,r2(s))+1}function L2(r,n){const s=nn(r,n==null?void 0:n.in),a=+zc(s)-+Ww(s);return Math.round(a/Qg)+1}function Zg(r,n){var A,S,j,z;const s=nn(r,n==null?void 0:n.in),a=s.getFullYear(),c=$a(),f=(n==null?void 0:n.firstWeekContainsDate)??((S=(A=n==null?void 0:n.locale)==null?void 0:A.options)==null?void 0:S.firstWeekContainsDate)??c.firstWeekContainsDate??((z=(j=c.locale)==null?void 0:j.options)==null?void 0:z.firstWeekContainsDate)??1,h=us((n==null?void 0:n.in)||r,0);h.setFullYear(a+1,0,f),h.setHours(0,0,0,0);const d=La(h,n),g=us((n==null?void 0:n.in)||r,0);g.setFullYear(a,0,f),g.setHours(0,0,0,0);const y=La(g,n);return+s>=+d?a+1:+s>=+y?a:a-1}function H2(r,n){var d,g,y,A;const s=$a(),a=(n==null?void 0:n.firstWeekContainsDate)??((g=(d=n==null?void 0:n.locale)==null?void 0:d.options)==null?void 0:g.firstWeekContainsDate)??s.firstWeekContainsDate??((A=(y=s.locale)==null?void 0:y.options)==null?void 0:A.firstWeekContainsDate)??1,c=Zg(r,n),f=us((n==null?void 0:n.in)||r,0);return f.setFullYear(c,0,a),f.setHours(0,0,0,0),La(f,n)}function P2(r,n){const s=nn(r,n==null?void 0:n.in),a=+La(s,n)-+H2(s,n);return Math.round(a/Qg)+1}function Ye(r,n){const s=r<0?"-":"",a=Math.abs(r).toString().padStart(n,"0");return s+a}const Ys={y(r,n){const s=r.getFullYear(),a=s>0?s:1-s;return Ye(n==="yy"?a%100:a,n.length)},M(r,n){const s=r.getMonth();return n==="M"?String(s+1):Ye(s+1,2)},d(r,n){return Ye(r.getDate(),n.length)},a(r,n){const s=r.getHours()/12>=1?"pm":"am";switch(n){case"a":case"aa":return s.toUpperCase();case"aaa":return s;case"aaaaa":return s[0];case"aaaa":default:return s==="am"?"a.m.":"p.m."}},h(r,n){return Ye(r.getHours()%12||12,n.length)},H(r,n){return Ye(r.getHours(),n.length)},m(r,n){return Ye(r.getMinutes(),n.length)},s(r,n){return Ye(r.getSeconds(),n.length)},S(r,n){const s=n.length,a=r.getMilliseconds(),c=Math.trunc(a*Math.pow(10,s-3));return Ye(c,n.length)}},mr={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Y0={G:function(r,n,s){const a=r.getFullYear()>0?1:0;switch(n){case"G":case"GG":case"GGG":return s.era(a,{width:"abbreviated"});case"GGGGG":return s.era(a,{width:"narrow"});case"GGGG":default:return s.era(a,{width:"wide"})}},y:function(r,n,s){if(n==="yo"){const a=r.getFullYear(),c=a>0?a:1-a;return s.ordinalNumber(c,{unit:"year"})}return Ys.y(r,n)},Y:function(r,n,s,a){const c=Zg(r,a),f=c>0?c:1-c;if(n==="YY"){const h=f%100;return Ye(h,2)}return n==="Yo"?s.ordinalNumber(f,{unit:"year"}):Ye(f,n.length)},R:function(r,n){const s=Xg(r);return Ye(s,n.length)},u:function(r,n){const s=r.getFullYear();return Ye(s,n.length)},Q:function(r,n,s){const a=Math.ceil((r.getMonth()+1)/3);switch(n){case"Q":return String(a);case"QQ":return Ye(a,2);case"Qo":return s.ordinalNumber(a,{unit:"quarter"});case"QQQ":return s.quarter(a,{width:"abbreviated",context:"formatting"});case"QQQQQ":return s.quarter(a,{width:"narrow",context:"formatting"});case"QQQQ":default:return s.quarter(a,{width:"wide",context:"formatting"})}},q:function(r,n,s){const a=Math.ceil((r.getMonth()+1)/3);switch(n){case"q":return String(a);case"qq":return Ye(a,2);case"qo":return s.ordinalNumber(a,{unit:"quarter"});case"qqq":return s.quarter(a,{width:"abbreviated",context:"standalone"});case"qqqqq":return s.quarter(a,{width:"narrow",context:"standalone"});case"qqqq":default:return s.quarter(a,{width:"wide",context:"standalone"})}},M:function(r,n,s){const a=r.getMonth();switch(n){case"M":case"MM":return Ys.M(r,n);case"Mo":return s.ordinalNumber(a+1,{unit:"month"});case"MMM":return s.month(a,{width:"abbreviated",context:"formatting"});case"MMMMM":return s.month(a,{width:"narrow",context:"formatting"});case"MMMM":default:return s.month(a,{width:"wide",context:"formatting"})}},L:function(r,n,s){const a=r.getMonth();switch(n){case"L":return String(a+1);case"LL":return Ye(a+1,2);case"Lo":return s.ordinalNumber(a+1,{unit:"month"});case"LLL":return s.month(a,{width:"abbreviated",context:"standalone"});case"LLLLL":return s.month(a,{width:"narrow",context:"standalone"});case"LLLL":default:return s.month(a,{width:"wide",context:"standalone"})}},w:function(r,n,s,a){const c=P2(r,a);return n==="wo"?s.ordinalNumber(c,{unit:"week"}):Ye(c,n.length)},I:function(r,n,s){const a=L2(r);return n==="Io"?s.ordinalNumber(a,{unit:"week"}):Ye(a,n.length)},d:function(r,n,s){return n==="do"?s.ordinalNumber(r.getDate(),{unit:"date"}):Ys.d(r,n)},D:function(r,n,s){const a=B2(r);return n==="Do"?s.ordinalNumber(a,{unit:"dayOfYear"}):Ye(a,n.length)},E:function(r,n,s){const a=r.getDay();switch(n){case"E":case"EE":case"EEE":return s.day(a,{width:"abbreviated",context:"formatting"});case"EEEEE":return s.day(a,{width:"narrow",context:"formatting"});case"EEEEEE":return s.day(a,{width:"short",context:"formatting"});case"EEEE":default:return s.day(a,{width:"wide",context:"formatting"})}},e:function(r,n,s,a){const c=r.getDay(),f=(c-a.weekStartsOn+8)%7||7;switch(n){case"e":return String(f);case"ee":return Ye(f,2);case"eo":return s.ordinalNumber(f,{unit:"day"});case"eee":return s.day(c,{width:"abbreviated",context:"formatting"});case"eeeee":return s.day(c,{width:"narrow",context:"formatting"});case"eeeeee":return s.day(c,{width:"short",context:"formatting"});case"eeee":default:return s.day(c,{width:"wide",context:"formatting"})}},c:function(r,n,s,a){const c=r.getDay(),f=(c-a.weekStartsOn+8)%7||7;switch(n){case"c":return String(f);case"cc":return Ye(f,n.length);case"co":return s.ordinalNumber(f,{unit:"day"});case"ccc":return s.day(c,{width:"abbreviated",context:"standalone"});case"ccccc":return s.day(c,{width:"narrow",context:"standalone"});case"cccccc":return s.day(c,{width:"short",context:"standalone"});case"cccc":default:return s.day(c,{width:"wide",context:"standalone"})}},i:function(r,n,s){const a=r.getDay(),c=a===0?7:a;switch(n){case"i":return String(c);case"ii":return Ye(c,n.length);case"io":return s.ordinalNumber(c,{unit:"day"});case"iii":return s.day(a,{width:"abbreviated",context:"formatting"});case"iiiii":return s.day(a,{width:"narrow",context:"formatting"});case"iiiiii":return s.day(a,{width:"short",context:"formatting"});case"iiii":default:return s.day(a,{width:"wide",context:"formatting"})}},a:function(r,n,s){const c=r.getHours()/12>=1?"pm":"am";switch(n){case"a":case"aa":return s.dayPeriod(c,{width:"abbreviated",context:"formatting"});case"aaa":return s.dayPeriod(c,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return s.dayPeriod(c,{width:"narrow",context:"formatting"});case"aaaa":default:return s.dayPeriod(c,{width:"wide",context:"formatting"})}},b:function(r,n,s){const a=r.getHours();let c;switch(a===12?c=mr.noon:a===0?c=mr.midnight:c=a/12>=1?"pm":"am",n){case"b":case"bb":return s.dayPeriod(c,{width:"abbreviated",context:"formatting"});case"bbb":return s.dayPeriod(c,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return s.dayPeriod(c,{width:"narrow",context:"formatting"});case"bbbb":default:return s.dayPeriod(c,{width:"wide",context:"formatting"})}},B:function(r,n,s){const a=r.getHours();let c;switch(a>=17?c=mr.evening:a>=12?c=mr.afternoon:a>=4?c=mr.morning:c=mr.night,n){case"B":case"BB":case"BBB":return s.dayPeriod(c,{width:"abbreviated",context:"formatting"});case"BBBBB":return s.dayPeriod(c,{width:"narrow",context:"formatting"});case"BBBB":default:return s.dayPeriod(c,{width:"wide",context:"formatting"})}},h:function(r,n,s){if(n==="ho"){let a=r.getHours()%12;return a===0&&(a=12),s.ordinalNumber(a,{unit:"hour"})}return Ys.h(r,n)},H:function(r,n,s){return n==="Ho"?s.ordinalNumber(r.getHours(),{unit:"hour"}):Ys.H(r,n)},K:function(r,n,s){const a=r.getHours()%12;return n==="Ko"?s.ordinalNumber(a,{unit:"hour"}):Ye(a,n.length)},k:function(r,n,s){let a=r.getHours();return a===0&&(a=24),n==="ko"?s.ordinalNumber(a,{unit:"hour"}):Ye(a,n.length)},m:function(r,n,s){return n==="mo"?s.ordinalNumber(r.getMinutes(),{unit:"minute"}):Ys.m(r,n)},s:function(r,n,s){return n==="so"?s.ordinalNumber(r.getSeconds(),{unit:"second"}):Ys.s(r,n)},S:function(r,n){return Ys.S(r,n)},X:function(r,n,s){const a=r.getTimezoneOffset();if(a===0)return"Z";switch(n){case"X":return V0(a);case"XXXX":case"XX":return wi(a);case"XXXXX":case"XXX":default:return wi(a,":")}},x:function(r,n,s){const a=r.getTimezoneOffset();switch(n){case"x":return V0(a);case"xxxx":case"xx":return wi(a);case"xxxxx":case"xxx":default:return wi(a,":")}},O:function(r,n,s){const a=r.getTimezoneOffset();switch(n){case"O":case"OO":case"OOO":return"GMT"+G0(a,":");case"OOOO":default:return"GMT"+wi(a,":")}},z:function(r,n,s){const a=r.getTimezoneOffset();switch(n){case"z":case"zz":case"zzz":return"GMT"+G0(a,":");case"zzzz":default:return"GMT"+wi(a,":")}},t:function(r,n,s){const a=Math.trunc(+r/1e3);return Ye(a,n.length)},T:function(r,n,s){return Ye(+r,n.length)}};function G0(r,n=""){const s=r>0?"-":"+",a=Math.abs(r),c=Math.trunc(a/60),f=a%60;return f===0?s+String(c):s+String(c)+n+Ye(f,2)}function V0(r,n){return r%60===0?(r>0?"-":"+")+Ye(Math.abs(r)/60,2):wi(r,n)}function wi(r,n=""){const s=r>0?"-":"+",a=Math.abs(r),c=Ye(Math.trunc(a/60),2),f=Ye(a%60,2);return s+c+n+f}const F0=(r,n)=>{switch(r){case"P":return n.date({width:"short"});case"PP":return n.date({width:"medium"});case"PPP":return n.date({width:"long"});case"PPPP":default:return n.date({width:"full"})}},Wg=(r,n)=>{switch(r){case"p":return n.time({width:"short"});case"pp":return n.time({width:"medium"});case"ppp":return n.time({width:"long"});case"pppp":default:return n.time({width:"full"})}},$2=(r,n)=>{const s=r.match(/(P+)(p+)?/)||[],a=s[1],c=s[2];if(!c)return F0(r,n);let f;switch(a){case"P":f=n.dateTime({width:"short"});break;case"PP":f=n.dateTime({width:"medium"});break;case"PPP":f=n.dateTime({width:"long"});break;case"PPPP":default:f=n.dateTime({width:"full"});break}return f.replace("{{date}}",F0(a,n)).replace("{{time}}",Wg(c,n))},Y2={p:Wg,P:$2},G2=/^D+$/,V2=/^Y+$/,F2=["D","DD","YY","YYYY"];function J2(r){return G2.test(r)}function Q2(r){return V2.test(r)}function X2(r,n,s){const a=I2(r,n,s);if(console.warn(a),F2.includes(r))throw new RangeError(a)}function I2(r,n,s){const a=r[0]==="Y"?"years":"days of the month";return`Use \`${r.toLowerCase()}\` instead of \`${r}\` (in \`${n}\`) for formatting ${a} to the input \`${s}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const K2=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Z2=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,W2=/^'([^]*?)'?$/,eS=/''/g,tS=/[a-zA-Z]/;function ey(r,n,s){var A,S,j,z;const a=$a(),c=a.locale??Kg,f=a.firstWeekContainsDate??((S=(A=a.locale)==null?void 0:A.options)==null?void 0:S.firstWeekContainsDate)??1,h=a.weekStartsOn??((z=(j=a.locale)==null?void 0:j.options)==null?void 0:z.weekStartsOn)??0,d=nn(r,s==null?void 0:s.in);if(!s2(d))throw new RangeError("Invalid time value");let g=n.match(Z2).map(R=>{const H=R[0];if(H==="p"||H==="P"){const ee=Y2[H];return ee(R,c.formatLong)}return R}).join("").match(K2).map(R=>{if(R==="''")return{isToken:!1,value:"'"};const H=R[0];if(H==="'")return{isToken:!1,value:nS(R)};if(Y0[H])return{isToken:!0,value:R};if(H.match(tS))throw new RangeError("Format string contains an unescaped latin alphabet character `"+H+"`");return{isToken:!1,value:R}});c.localize.preprocessor&&(g=c.localize.preprocessor(d,g));const y={firstWeekContainsDate:f,weekStartsOn:h,locale:c};return g.map(R=>{if(!R.isToken)return R.value;const H=R.value;(Q2(H)||J2(H))&&X2(H,n,String(r));const ee=Y0[H[0]];return ee(d,H,c.localize,y)}).join("")}function nS(r){const n=r.match(W2);return n?n[1].replace(eS,"'"):r}function sS(r,n,s){const a=$a(),c=(s==null?void 0:s.locale)??a.locale??Kg,f=e2(r,n);if(isNaN(f))throw new RangeError("Invalid time value");const h=Object.assign({},s,{addSuffix:s==null?void 0:s.addSuffix,comparison:f}),[d,g]=Ig(s==null?void 0:s.in,...f>0?[n,r]:[r,n]),y=i2((s==null?void 0:s.roundingMethod)??"round"),A=g.getTime()-d.getTime(),S=A/U0,j=qc(g)-qc(d),z=(A-j)/U0,R=s==null?void 0:s.unit;let H;if(R?H=R:S<1?H="second":S<60?H="minute":S<H0?H="hour":z<L0?H="day":z<B0?H="month":H="year",H==="second"){const ee=y(A/1e3);return c.formatDistance("xSeconds",ee,h)}else if(H==="minute"){const ee=y(S);return c.formatDistance("xMinutes",ee,h)}else if(H==="hour"){const ee=y(S/60);return c.formatDistance("xHours",ee,h)}else if(H==="day"){const ee=y(z/H0);return c.formatDistance("xDays",ee,h)}else if(H==="month"){const ee=y(z/L0);return ee===12&&R!=="month"?c.formatDistance("xYears",1,h):c.formatDistance("xMonths",ee,h)}else{const ee=y(z/B0);return c.formatDistance("xYears",ee,h)}}function iS(r,n){return sS(r,t2(r),n)}function rS(r){const n=new Date(r);return n.getTime()>Date.now()?"just now":iS(n,{addSuffix:!0})}function yE(r){return r<=0?"Expired":ch(r)}function aS(r){return r==null?"--":ch(r)}function ch(r){if(r<1e3)return`${Math.round(r)}ms`;if(r<6e4){const h=r/1e3;return Number.isInteger(h)?`${h}s`:`${h.toFixed(1)}s`}const n=Math.floor(r/1e3),s=Math.floor(n/86400),a=Math.floor(n%86400/3600),c=Math.floor(n%3600/60),f=n%60;return s>0?a>0?`${s}d ${a}h`:`${s}d`:a>0?c>0?`${a}h ${c}m`:`${a}h`:f>0?`${c}m ${f}s`:`${c}m`}function bE(r,n){const s=new Date(r).getTime(),a=n?new Date(n).getTime():Date.now();return ch(a-s)}function ty({options:r,children:n,className:s=""}){const[a,c]=C.useState(!1),[f,h]=C.useState(null),[d,g]=C.useState(null),y=C.useRef(null),A=C.useRef(void 0),S=C.useRef(void 0),j=220,z=C.useCallback(()=>{if(!y.current)return;const ne=y.current.getBoundingClientRect(),W=window.innerWidth-j-8,me=Math.max(8,Math.min(ne.left,W));g({top:ne.bottom+4,left:me})},[]),R=C.useCallback(async(ne,W)=>{try{await navigator.clipboard.writeText(ne),h(W),clearTimeout(A.current),A.current=setTimeout(()=>h(null),1200)}catch{}},[]),H=C.useCallback(()=>{clearTimeout(S.current),z(),c(!0)},[z]),ee=C.useCallback(()=>{S.current=setTimeout(()=>c(!1),150)},[]);return C.useEffect(()=>()=>{clearTimeout(A.current),clearTimeout(S.current)},[]),p.jsxs("span",{ref:y,className:`inline-flex items-center cursor-default ${s}`,onMouseEnter:H,onMouseLeave:ee,children:[n,a&&d&&eg.createPortal(p.jsx("span",{className:"fixed z-[9999] bg-surface-raised border border-surface-border rounded shadow-lg py-1 min-w-[180px]",style:{top:d.top,left:d.left},onMouseEnter:H,onMouseLeave:ee,children:r.map(ne=>p.jsxs("button",{onClick:W=>{W.stopPropagation(),R(ne.value,ne.label)},className:"flex items-center justify-between w-full px-2.5 py-1 text-left hover:bg-surface-hover transition-colors",children:[p.jsx("span",{className:"text-[9px] font-medium uppercase tracking-wider text-text-tertiary w-10 shrink-0",children:ne.label}),p.jsx("span",{className:"text-[10px] font-mono text-text-secondary truncate ml-2",children:f===ne.label?"✓":ne.value})]},ne.label))}),document.body)]})}function lS(r,n){const s=new Date(r);switch(n){case"relative":return rS(r);case"datetime":return ey(s,"MMM d, yyyy h:mm a");case"time":return s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}}function cS(r){const n=new Date(r);return[{label:"ms",value:String(n.getTime())},{label:"utc",value:n.toISOString()},{label:"local",value:ey(n,"MMM d, yyyy h:mm:ss a")}]}function oS({date:r,format:n="relative",className:s=""}){const[,a]=C.useState(0);C.useEffect(()=>{if(n!=="relative")return;const f=setInterval(()=>a(h=>h+1),3e4);return()=>clearInterval(f)},[n]);const c=C.useMemo(()=>cS(r),[r]);return p.jsx(ty,{options:c,children:p.jsx("time",{dateTime:r,className:`text-xs text-text-tertiary ${s}`,children:lS(r,n)})})}function uS({ms:r,className:n=""}){const s=aS(r),a=C.useMemo(()=>r==null?[]:[{label:"ms",value:String(r)},{label:"sec",value:`${(r/1e3).toFixed(3)}s`},{label:"text",value:s}],[r,s]);return r==null?p.jsx("span",{className:`text-xs text-text-tertiary ${n}`,children:"--"}):p.jsx(ty,{options:a,children:p.jsx("span",{className:`text-xs text-text-tertiary ${n}`,children:s})})}const fS=["sm","md","lg","full"],J0={sm:"w-[28rem] max-h-[40vh]",md:"w-[36rem] max-h-[60vh]",lg:"w-[48rem] max-h-[80vh]",full:"inset-4 w-auto max-h-none"},Q0={sm:"Small",md:"Medium",lg:"Large",full:"Fullscreen"};function hS({which:r}){const n="stroke-current";switch(r){case"sm":return p.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:p.jsx("rect",{x:"5",y:"5",width:"7",height:"7",rx:"1.5",className:n,strokeWidth:"1.5"})});case"md":return p.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:p.jsx("rect",{x:"3",y:"3",width:"9",height:"9",rx:"1.5",className:n,strokeWidth:"1.5"})});case"lg":return p.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:p.jsx("rect",{x:"1.5",y:"1.5",width:"11",height:"11",rx:"1.5",className:n,strokeWidth:"1.5"})});case"full":return p.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:p.jsx("rect",{x:"0.75",y:"0.75",width:"12.5",height:"12.5",rx:"1.5",className:n,strokeWidth:"1.5"})})}}function dS({msg:r}){const[n,s]=C.useState(0);C.useEffect(()=>{const h=new Date(r.timestamp).getTime(),d=()=>s(Math.floor((Date.now()-h)/1e3));d();const g=setInterval(d,1e3);return()=>clearInterval(g)},[r.timestamp]);const a=Math.floor(n/60),c=n%60,f=a>0?`${a}m ${c}s`:`${c}s`;return p.jsxs("span",{className:"inline-flex flex-col gap-1.5",children:[p.jsxs("span",{className:"inline-flex items-center gap-1",children:[p.jsx("span",{className:"text-text-tertiary",children:"Thinking"}),p.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse"}),p.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse [animation-delay:150ms]"}),p.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse [animation-delay:300ms]"}),p.jsx("span",{className:"text-text-muted ml-1 tabular-nums",children:f})]}),r.workflowId&&p.jsxs(pr,{to:`/workflows/executions/${r.workflowId}`,className:"inline-flex items-center gap-1 text-[10px] text-accent/70 hover:text-accent transition-colors",children:[p.jsx(Yf,{className:"w-2.5 h-2.5",strokeWidth:1.5}),"watch execution"]})]})}function mS({msg:r,compileMessage:n}){const s=r.role==="assistant";return p.jsxs("div",{className:`flex items-center gap-1.5 ${s?"justify-start":"justify-end"}`,children:[p.jsx(oS,{date:r.timestamp,format:"time",className:"!text-[9px] text-text-muted/50"}),r.durationMs!=null&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"text-text-muted/30 text-[8px]",children:"·"}),p.jsx(uS,{ms:r.durationMs,className:"!text-[9px] text-text-muted/50"})]}),r.workflowId&&p.jsx(pr,{to:`/workflows/executions/${r.workflowId}`,className:"text-text-muted/40 hover:text-accent transition-colors",title:"View workflow execution",children:p.jsx(Yf,{className:"w-2.5 h-2.5",strokeWidth:1.5})}),s&&r.workflowId&&!r.pending&&p.jsx("button",{onClick:()=>n(r.id),disabled:r.compilationStatus==="compiling"||r.compilationStatus==="done",className:"transition-colors",title:r.compilationStatus==="done"?"Compiled — future queries will match this pipeline":r.compilationStatus==="error"?r.compilationError??"Compilation failed":r.compilationStatus==="compiling"?"Compiling...":"Compile to fast pipeline",children:p.jsx(Bx,{className:`w-2.5 h-2.5 ${r.compilationStatus==="done"?"text-status-success":r.compilationStatus==="error"?"text-status-error":r.compilationStatus==="compiling"?"text-accent/40 animate-pulse":"text-text-muted/40 hover:text-accent"}`,strokeWidth:1.5})})]})}function pS(){const{helpOpen:r,setHelpOpen:n,messages:s,sendMessage:a,pageContext:c,activeWorkflowId:f,clearMessages:h,compileMessage:d}=Jg(),[g,y]=C.useState(""),[A,S]=C.useState("md"),[j,z]=C.useState(!0),R=C.useRef(null),H=C.useRef(null);if(C.useEffect(()=>{R.current&&(R.current.scrollTop=R.current.scrollHeight)},[s]),C.useEffect(()=>{r&&H.current&&H.current.focus()},[r]),C.useEffect(()=>{if(!r)return;const k=I=>{I.key==="Escape"&&(A==="full"?S("lg"):A==="lg"?S("md"):A==="md"?S("sm"):n(!1))};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[r,A,n]),!r)return null;const ee=()=>{const k=g.trim();!k||f||(a(k),y(""),H.current&&(H.current.style.height="auto"))},ne=k=>{k.key==="Enter"&&!k.shiftKey&&(k.preventDefault(),ee())},W=A==="full",me=c.page.replace(/-/g," "),be=W?{}:{bottom:"calc(var(--feed-height, 32px) + 76px)"};return p.jsxs("div",{className:`fixed z-[45] flex flex-col border border-surface-border rounded-lg overflow-hidden transition-all duration-300 ${W?J0.full:`right-6 ${J0[A]}`} ${j?"bg-surface-raised shadow-xl":"bg-surface-raised/[0.03] shadow-lg shadow-black/5"}`,style:be,onMouseEnter:()=>z(!0),onMouseLeave:()=>z(!1),children:[p.jsxs("div",{className:`flex items-center justify-between px-4 py-2.5 border-b border-surface-border shrink-0 transition-all duration-300 ${j?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[p.jsxs("div",{className:"min-w-0 flex-1",children:[p.jsx("p",{className:"text-xs font-medium text-text-primary truncate",children:"Help Assistant"}),p.jsx("p",{className:"text-[10px] text-text-tertiary truncate",children:me})]}),p.jsxs("div",{className:"flex items-center gap-1 ml-2",children:[p.jsx("div",{className:"flex items-center gap-0.5 border border-surface-border rounded p-0.5",role:"radiogroup","aria-label":"Panel size",children:fS.map(k=>p.jsx("button",{onClick:()=>S(k),className:`p-1 rounded transition-colors ${k===A?"bg-accent/15 text-accent":"text-text-muted hover:text-text-secondary hover:bg-surface-hover"}`,role:"radio","aria-checked":k===A,"aria-label":Q0[k],title:Q0[k],children:p.jsx(hS,{which:k})},k))}),s.length>0&&p.jsx("button",{onClick:h,className:"p-1 text-text-tertiary hover:text-text-secondary transition-colors","aria-label":"Clear conversation",title:"Clear conversation",children:p.jsx(Lx,{className:"w-3.5 h-3.5",strokeWidth:1.5})}),p.jsx("button",{onClick:()=>n(!1),className:"p-1 text-text-tertiary hover:text-text-primary transition-colors","aria-label":"Close",title:"Close",children:p.jsx(Gf,{className:"w-3.5 h-3.5",strokeWidth:1.5})})]})]}),p.jsxs("div",{ref:R,className:`flex-1 overflow-y-auto px-4 py-3 space-y-3 min-h-[120px] transition-all duration-300 ${j?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[s.length===0&&p.jsx("p",{className:"text-xs text-text-tertiary text-center py-6",children:"Ask anything about what you're viewing."}),s.map(k=>p.jsxs("div",{className:`text-xs leading-relaxed ${k.role==="user"?"text-right":"text-left"}`,children:[p.jsx("div",{className:`inline-block max-w-[85%] px-3 py-2 rounded-md whitespace-pre-wrap ${k.role==="user"?"bg-accent/10 text-text-primary":"bg-surface-sunken text-text-secondary"}`,children:k.pending?p.jsx(dS,{msg:k}):k.role==="assistant"?p.jsx(lh,{content:k.content}):k.content}),!k.pending&&p.jsx("div",{className:"mt-0.5",children:p.jsx(mS,{msg:k,compileMessage:d})})]},k.id))]}),p.jsxs("div",{className:`border-t border-surface-border px-3 py-2.5 flex gap-2 shrink-0 transition-all duration-300 ${j?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[p.jsx("textarea",{ref:H,value:g,onChange:k=>{y(k.target.value);const I=k.target;I.style.height="auto",I.style.height=`${Math.min(I.scrollHeight,120)}px`},onKeyDown:ne,placeholder:"Ask a question...",rows:2,className:"flex-1 resize-none bg-surface text-xs text-text-primary placeholder:text-text-tertiary rounded px-2.5 py-1.5 border border-surface-border focus:outline-none focus:border-accent",style:{minHeight:"2.5rem"},disabled:!!f}),p.jsx("button",{onClick:ee,disabled:!g.trim()||!!f,className:"px-2.5 py-1.5 text-accent hover:text-accent-hover disabled:text-text-muted transition-colors self-end","aria-label":"Send",children:p.jsx(Hx,{className:"w-4 h-4",strokeWidth:1.5})})]})]})}function gS(){const{isSuperAdmin:r,hasRoleType:n,hasRole:s}=Ai(),{collapsed:a,toggle:c}=Yg(),[f,h]=C.useState(!1),[d,g]=C.useState(()=>window.location.hash.startsWith("#docs")),y=Ei(),A=C.useRef(null);return C.useEffect(()=>{const S=A.current;S&&(S.classList.remove("animate-page-in"),S.offsetWidth,S.classList.add("animate-page-in"))},[y.pathname]),C.useEffect(()=>{const S=()=>{window.location.hash.startsWith("#docs")&&g(!0)};return window.addEventListener("hashchange",S),()=>window.removeEventListener("hashchange",S)},[]),p.jsxs("div",{className:"h-screen bg-surface flex flex-col",style:{"--feed-height":f?"224px":"32px"},children:[p.jsx(aw,{onToggleEventFeed:()=>h(S=>!S),onToggleDocs:()=>g(S=>!S)}),p.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[p.jsxs("aside",{className:`${a?"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:[p.jsxs("nav",{className:"flex-1 px-3 pt-[36px] pb-4 space-y-2 overflow-y-auto overflow-x-hidden",children:[(r||n("admin")||s("engineer"))&&p.jsx(mw,{}),(r||n("admin")||s("engineer"))&&p.jsx(gw,{}),(r||n("admin")||s("engineer"))&&p.jsx(bw,{}),(r||n("admin"))&&p.jsx(hw,{})]}),p.jsx("button",{onClick:c,className:`shrink-0 py-3 text-text-tertiary hover:text-text-secondary transition-colors duration-150 ${a?"flex justify-center":"flex items-center px-7"}`,"aria-label":a?"Expand sidebar":"Collapse sidebar",children:a?p.jsx(Px,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5}):p.jsx($x,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5})})]}),p.jsx("main",{className:"flex-1 overflow-y-auto",children:p.jsx("div",{ref:A,className:`max-w-dashboard mx-auto px-10 py-10 animate-page-in ${f?"pb-60":"pb-16"}`,children:p.jsx(bc,{})})})]}),p.jsx(Dw,{open:f,onToggle:()=>h(S=>!S)}),p.jsx(Gw,{open:d,onClose:()=>{g(!1),history.replaceState(null,"",window.location.pathname+window.location.search)}}),p.jsx(Xw,{}),p.jsx(pS,{})]})}function yS(){const{isAuthenticated:r}=Ai(),n=Ei();return r?p.jsx(tw,{children:p.jsx(Qw,{children:p.jsx(gS,{})})}):p.jsx(Vs,{to:"/login",state:{from:n.pathname},replace:!0})}function ny({provider:r,className:n="w-5 h-5"}){switch(r){case"google":return p.jsxs("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:[p.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"}),p.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"}),p.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"}),p.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 p.jsx("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:p.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 p.jsxs("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:[p.jsx("path",{d:"M3 3h8.5v8.5H3z",fill:"#F25022"}),p.jsx("path",{d:"M12.5 3H21v8.5h-8.5z",fill:"#7FBA00"}),p.jsx("path",{d:"M3 12.5h8.5V21H3z",fill:"#00A4EF"}),p.jsx("path",{d:"M12.5 12.5H21V21h-8.5z",fill:"#FFB900"})]});case"anthropic":return p.jsx("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:p.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 p.jsxs("svg",{className:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[p.jsx("circle",{cx:"12",cy:"12",r:"10"}),p.jsx("path",{d:"M12 8v4l3 3"})]})}}async function bS(){return Ie("/auth/oauth/providers")}async function xS(r,n){const s=n?`?label=${encodeURIComponent(n)}`:"";return Ie(`/auth/oauth/connections/${r}${s}`,{method:"DELETE"})}function xE(){return fs({queryKey:["oauth-connections"],queryFn:()=>Ie("/auth/oauth/connections")})}function vE(){const r=Nn();return Ln({mutationFn:({provider:n,label:s})=>xS(n,s),onSuccess:()=>{r.invalidateQueries({queryKey:["oauth-connections"]})}})}function vS(){var I;const{login:r,isAuthenticated:n}=Ai(),s=tg(),a=Ei(),c=new URLSearchParams(a.search),f=c.get("token"),h=c.get("error"),d=((I=a.state)==null?void 0:I.from)??c.get("returnTo")??"/",g=C.useRef(!1);f&&!g.current&&(g.current=!0,r(f,void 0,{displayName:c.get("displayName"),username:c.get("username")}));const[y,A]=C.useState(""),[S,j]=C.useState(""),[z,R]=C.useState(h||""),[H,ee]=C.useState(!1),[ne,W]=C.useState(!!f),[me,be]=C.useState([]);if(C.useEffect(()=>{f||bS().then(be).catch(()=>{})},[]),C.useEffect(()=>{if(!ne)return;const ie=setTimeout(()=>s(d,{replace:!0}),1500);return()=>clearTimeout(ie)},[ne]),n&&!ne)return p.jsx(Vs,{to:d,replace:!0});const k=async ie=>{var Z,Q;if(ie.preventDefault(),R(""),!y.trim()||!S){R("Username and password are required");return}ee(!0);try{const K=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:y.trim(),password:S})}),ae=await K.json();if(!K.ok){R(ae.error||"Login failed");return}W(!0),r(ae.token,{username:y.trim(),password:S},{displayName:(Z=ae.user)==null?void 0:Z.display_name,username:(Q=ae.user)==null?void 0:Q.external_id})}catch{R("Unable to connect to server")}finally{ee(!1)}};return p.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center overflow-hidden",children:p.jsxs("div",{className:"w-full max-w-md p-10",children:[p.jsx("div",{className:`mb-10 transition-all duration-[1500ms] ease-in ${ne?"translate-x-[120vw] -translate-y-[60vh] scale-[3] opacity-0":""}`,children:p.jsx(rh,{size:"lg",hideLabel:ne})}),p.jsxs("form",{onSubmit:k,className:`space-y-5 transition-opacity duration-300 ${ne?"opacity-0":""}`,children:[p.jsxs("div",{children:[p.jsx("label",{htmlFor:"username",className:"block text-sm font-medium text-text-secondary mb-2",children:"Username"}),p.jsx("input",{id:"username",type:"text",value:y,onChange:ie=>A(ie.target.value),className:"input",placeholder:"Enter your username",autoFocus:!ne,autoComplete:"username"})]}),p.jsxs("div",{children:[p.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-text-secondary mb-2",children:"Password"}),p.jsx("input",{id:"password",type:"password",value:S,onChange:ie=>j(ie.target.value),className:"input",placeholder:"Enter your password",autoComplete:"current-password"})]}),z&&p.jsx("p",{className:"text-sm text-status-error",children:z}),p.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:H||ne,children:H?"Signing in...":"Sign In"}),me.length>0&&p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"flex items-center gap-3 mt-6",children:[p.jsx("div",{className:"flex-1 h-px bg-border"}),p.jsx("span",{className:"text-xs text-text-tertiary",children:"or continue with"}),p.jsx("div",{className:"flex-1 h-px bg-border"})]}),p.jsx("div",{className:"space-y-2",children:me.filter(ie=>ie.provider!=="anthropic").map(ie=>p.jsxs("a",{href:`/api/auth/oauth/${ie.provider}?returnTo=${encodeURIComponent(d)}`,className:"btn-secondary w-full flex items-center justify-center gap-2",children:[p.jsx(ny,{provider:ie.provider}),"Sign in with ",ie.name]},ie.provider))})]})]})]})})}function X0(){const{isAuthenticated:r}=Ai(),n=tg(),s=Ei(),a=new URLSearchParams(s.search),c=a.get("state")||"";C.useEffect(()=>{r||n(`/login?returnTo=${encodeURIComponent(s.pathname+s.search)}`)},[r]);const[f,h]=C.useState(""),[d,g]=C.useState(a.get("label")||"default"),[y,A]=C.useState(""),[S,j]=C.useState(!1),z=f.trim().startsWith("sk-ant-oat"),R=f.trim().startsWith("sk-ant-api"),H=ee=>{ee.preventDefault();const ne=f.trim();if(!ne){A("A token or API key is required");return}if(!ne.startsWith("sk-ant-")){A('Invalid format. Must start with "sk-ant-oat" (OAuth token) or "sk-ant-api" (API key)');return}j(!0),A("");const W=`/api/auth/oauth/anthropic/callback?code=${encodeURIComponent(ne)}&state=${encodeURIComponent(c)}`;window.location.href=W};return p.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center",children:p.jsxs("div",{className:"w-full max-w-md p-10",children:[p.jsx("div",{className:"mb-10",children:p.jsx(rh,{size:"lg"})}),p.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[p.jsx(ny,{provider:"anthropic",className:"w-6 h-6"}),p.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:"Connect Anthropic"})]}),p.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."}),p.jsxs("form",{onSubmit:H,className:"space-y-5",children:[p.jsxs("div",{children:[p.jsx("label",{htmlFor:"token",className:"block text-sm font-medium text-text-secondary mb-2",children:"OAuth Token or API Key"}),p.jsx("input",{id:"token",type:"password",value:f,onChange:ee=>h(ee.target.value),className:"input",placeholder:"sk-ant-oat01-... or sk-ant-api03-...",autoFocus:!0,autoComplete:"off"}),z&&p.jsx("p",{className:"text-xs text-status-success mt-1",children:"OAuth token detected — uses your Claude subscription (flat rate)"}),R&&p.jsx("p",{className:"text-xs text-status-warning mt-1",children:"API key detected — billed per-token from your Anthropic API account"})]}),p.jsxs("div",{children:[p.jsx("label",{htmlFor:"label",className:"block text-sm font-medium text-text-secondary mb-2",children:"Label"}),p.jsx("input",{id:"label",type:"text",value:d,onChange:ee=>g(ee.target.value.replace(/\s+/g,"-").toLowerCase()),className:"input",placeholder:"default",autoComplete:"off"}),p.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").'})]}),y&&p.jsx("p",{className:"text-sm text-status-error",children:y}),p.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:S,children:S?"Validating...":"Connect"}),p.jsx("a",{href:"/",className:"block text-center text-sm text-text-tertiary hover:text-text-secondary",children:"Cancel"})]}),p.jsxs("div",{className:"mt-6 space-y-3 text-xs text-text-tertiary",children:[p.jsxs("div",{children:[p.jsx("span",{className:"font-medium text-text-secondary",children:"Recommended:"})," ","Run"," ",p.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."]}),p.jsxs("div",{children:[p.jsx("span",{className:"font-medium text-text-secondary",children:"Alternative:"})," ","Use an API key from"," ",p.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 xf({roleTypes:r,roleNames:n,redirectTo:s="/"}){const{isSuperAdmin:a,hasRole:c,hasRoleType:f}=Ai();return a?p.jsx(bc,{}):r&&r.some(h=>f(h))?p.jsx(bc,{}):n&&n.some(h=>c(h))?p.jsx(bc,{}):p.jsx(Vs,{to:s,replace:!0})}const I0=C.lazy(()=>ze(()=>import("./ProcessesListPage-DcAN6AJK.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15])).then(r=>({default:r.ProcessesListPage}))),_S=C.lazy(()=>ze(()=>import("./ProcessDetailPage-vfnCDyQK.js"),__vite__mapDeps([16,1,2,4,17,18,13,19,15,9,6,20,21,22])).then(r=>({default:r.ProcessDetailPage}))),wS=C.lazy(()=>ze(()=>import("./McpOverview-ChLa6Gl7.js"),__vite__mapDeps([23,1,24,25,26,27,12,13,28,6])).then(r=>({default:r.McpOverview}))),SS=C.lazy(()=>ze(()=>import("./McpRunsPage-BKba-3Wl.js"),__vite__mapDeps([29,1,25,26,27,5,6,7,8,15,13,9,30,12,11,10,14,31])).then(r=>({default:r.McpRunsPage}))),ES=C.lazy(()=>ze(()=>import("./McpRunDetailPage-ERVuNEEK.js"),__vite__mapDeps([32,1,25,17,19,12,13,33,6,34,35,11,36,14])).then(r=>({default:r.McpRunDetailPage}))),AS=C.lazy(()=>ze(()=>import("./McpQueryPage-D2DmDFPu.js"),__vite__mapDeps([37,1,12,13,7,8,11,10,14,9,30,15,31,5,6,4,38])).then(r=>({default:r.McpQueryPage}))),OS=C.lazy(()=>ze(()=>import("./McpQueryDetailPage-5Dsj6PlL.js"),__vite__mapDeps([39,1,12,13,19,38,40,6,26,4,41,34,25,3,2,42,43,44,33,45,36])).then(r=>({default:r.McpQueryDetailPage}))),jS=C.lazy(()=>ze(()=>import("./EscalationsOverview-H6CwfeR-.js"),__vite__mapDeps([46,1,4,12,13,28,6])).then(r=>({default:r.EscalationsOverview}))),TS=C.lazy(()=>ze(()=>import("./AvailableEscalationsPage-BqQA3IJp.js"),__vite__mapDeps([47,1,4,48,5,6,7,8,10,12,13,49,50,17,51,22,52,11,53,20,15,9,54,31,14])).then(r=>({default:r.AvailableEscalationsPage}))),NS=C.lazy(()=>ze(()=>import("./OperatorDashboard-CJm_BTPU.js"),__vite__mapDeps([55,1,4,48,5,6,7,8,12,13,10,31,52,11,53,20,15,9,54,14])).then(r=>({default:r.OperatorDashboard}))),CS=C.lazy(()=>ze(()=>import("./index-D9_hZmsW.js"),__vite__mapDeps([56,1,48,12,13,54,3,17,4,21,22,50,49,19,20,33,6,34])).then(r=>({default:r.EscalationDetailPage}))),kS=C.lazy(()=>ze(()=>import("./WorkflowsOverview-z3Ztiz1y.js"),__vite__mapDeps([57,1,3,4,12,13,28,6])).then(r=>({default:r.WorkflowsOverview}))),MS=C.lazy(()=>ze(()=>import("./index-CbuH92vk.js"),__vite__mapDeps([58,1,3,12,13,15,43,44,6,7,8,59,45,19])).then(r=>({default:r.StartWorkflowPage}))),RS=C.lazy(()=>ze(()=>import("./index-CbuH92vk.js"),__vite__mapDeps([58,1,3,12,13,15,43,44,6,7,8,59,45,19])).then(r=>({default:r.DurableInvokePage}))),DS=C.lazy(()=>ze(()=>import("./WorkflowsDashboard-Be1A1zAT.js"),__vite__mapDeps([60,1,9,30,3,4,5,6,7,8,15,13,12,11,10,14,31])).then(r=>({default:()=>r.WorkflowsDashboard({tier:"durable"})}))),zS=C.lazy(()=>ze(()=>import("./WorkflowsDashboard-Be1A1zAT.js"),__vite__mapDeps([60,1,9,30,3,4,5,6,7,8,15,13,12,11,10,14,31])).then(r=>({default:()=>r.WorkflowsDashboard({tier:"all"})}))),qS=C.lazy(()=>ze(()=>import("./YamlWorkflowsPage-C6qzcQcJ.js"),__vite__mapDeps([61,1,26,40,5,6,62,12,13,11,8,42,43,44,59,45,19])).then(r=>({default:r.YamlWorkflowsPage}))),US=C.lazy(()=>ze(()=>import("./TasksListPage-g6XIbhju.js"),__vite__mapDeps([63,1,2,3,5,6,7,8,19,53,45,10,11,12,13,15])).then(r=>({default:r.TasksListPage}))),BS=C.lazy(()=>ze(()=>import("./TaskDetailPage-BoA-cfwW.js"),__vite__mapDeps([64,1,2,19,53,12,13,6])).then(r=>({default:r.TaskDetailPage}))),K0=C.lazy(()=>ze(()=>import("./WorkflowExecutionPage-soRFz_30.js"),__vite__mapDeps([65,1,3,4,35,11,36,19,6,2,12,13,34,14])).then(r=>({default:r.WorkflowExecutionPage}))),LS=C.lazy(()=>ze(()=>import("./AdminDashboard-CsTOErp1.js"),__vite__mapDeps([66,1,2,4,24,18,13,6])).then(r=>({default:r.AdminDashboard}))),HS=C.lazy(()=>ze(()=>import("./index-B-jzKfuv.js"),__vite__mapDeps([67,1,3,7,8,11,31,5,6,12,13,68,15])).then(r=>({default:r.WorkersPage}))),PS=C.lazy(()=>ze(()=>import("./index-BU04qgJt.js"),__vite__mapDeps([69,1,3,7,8,70,51,6,11,31,5,12,13,20,68,15,71,48,43,44])).then(r=>({default:r.WorkflowConfigsPage}))),Z0=C.lazy(()=>ze(()=>import("./index-BU04qgJt.js"),__vite__mapDeps([69,1,3,7,8,70,51,6,11,31,5,12,13,20,68,15,71,48,43,44])).then(r=>({default:r.WorkflowConfigDetailPage}))),$S=C.lazy(()=>ze(()=>import("./index-B-ioA6yv.js"),__vite__mapDeps([72,1,24,8,70,51,6,12,13,11,10,5,62,42,43,44,31,19])).then(r=>({default:r.McpServersPage}))),W0=C.lazy(()=>ze(()=>import("./index-DrouIN-M.js"),__vite__mapDeps([73,1,24,71,12,13,41,6])).then(r=>({default:r.McpServerDetailPage}))),YS=C.lazy(()=>ze(()=>import("./index-BpoHVMV7.js"),__vite__mapDeps([74,1,22,5,6,7,8,10,11,9,70,51,31,12,13,20,44,48,45])).then(r=>({default:r.UsersPage}))),GS=C.lazy(()=>ze(()=>import("./RolesPage-DYSt2aAr.js"),__vite__mapDeps([75,1,48,7,8,70,51,6,12,13,20,31])).then(r=>({default:r.RolesPage}))),VS=C.lazy(()=>ze(()=>import("./index-DzICLMI7.js"),__vite__mapDeps([76,1,12,13,51,6,49])).then(r=>({default:r.MaintenancePage}))),FS=C.lazy(()=>ze(()=>import("./index-BMpoMc4A.js"),__vite__mapDeps([77,1,18,13,11,5,6,31,51,7,8,34,68])).then(r=>({default:r.ControlPlanePage}))),JS=C.lazy(()=>ze(()=>import("./CredentialsPage-C7XT1bnO.js"),__vite__mapDeps([78,1,12,13,45,70,51,6])).then(r=>({default:r.CredentialsPage}))),QS=C.lazy(()=>ze(()=>import("./index-CEnDYJOO.js"),__vite__mapDeps([79,1,6,12,13,11,14,8,80,45])).then(r=>({default:r.FilesPage}))),XS=C.lazy(()=>ze(()=>import("./index-qT78AZDq.js"),__vite__mapDeps([81,1,12,13,11,14,10,8,80,45,41,6])).then(r=>({default:r.KnowledgePage})));function IS(){return p.jsxs("div",{className:"animate-pulse space-y-4",children:[p.jsx("div",{className:"h-8 bg-surface-sunken rounded w-48"}),p.jsx("div",{className:"h-40 bg-surface-sunken rounded"})]})}function Ne({children:r}){return p.jsx(C.Suspense,{fallback:p.jsx(IS,{}),children:p.jsx("div",{className:"animate-page-enter",children:r})})}const sy=new mx({defaultOptions:{queries:{staleTime:1e4,retry:(r,n)=>n instanceof Error&&n.message==="Session expired"?!1:r<1}}});window.addEventListener("auth:unauthorized",()=>{sy.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 KS=yx([{path:"/login",element:p.jsx(vS,{})},{path:"/connect/anthropic",element:p.jsx(X0,{})},{path:"/connect/:provider",element:p.jsx(X0,{})},{path:"/",element:p.jsx(yS,{}),children:[{index:!0,element:p.jsx(Ne,{children:p.jsx(I0,{})})},{path:"processes/all",element:p.jsx(Ne,{children:p.jsx(I0,{})})},{path:"processes/detail/:originId",element:p.jsx(Ne,{children:p.jsx(_S,{})})},{path:"credentials",element:p.jsx(Ne,{children:p.jsx(JS,{})})},{path:"connections",element:p.jsx(Vs,{to:"/credentials",replace:!0})},{path:"escalations",element:p.jsx(Ne,{children:p.jsx(jS,{})})},{path:"escalations/available",element:p.jsx(Ne,{children:p.jsx(TS,{})})},{path:"escalations/queue",element:p.jsx(Ne,{children:p.jsx(NS,{})})},{path:"escalations/detail/:id",element:p.jsx(Ne,{children:p.jsx(CS,{})})},{element:p.jsx(xf,{roleTypes:["admin","superadmin"],roleNames:["engineer"]}),children:[{path:"workflows",element:p.jsx(Ne,{children:p.jsx(kS,{})})},{path:"workflows/executions",element:p.jsx(Ne,{children:p.jsx(zS,{})})},{path:"workflows/durable/executions",element:p.jsx(Ne,{children:p.jsx(DS,{})})},{path:"workflows/durable/executions/:workflowId",element:p.jsx(Ne,{children:p.jsx(K0,{})})},{path:"workflows/tasks",element:p.jsx(Ne,{children:p.jsx(US,{})})},{path:"workflows/tasks/detail/:id",element:p.jsx(Ne,{children:p.jsx(BS,{})})},{path:"workflows/executions/:workflowId",element:p.jsx(Ne,{children:p.jsx(K0,{})})},{path:"workflows/start",element:p.jsx(Ne,{children:p.jsx(MS,{})})},{path:"workflows/durable/invoke",element:p.jsx(Ne,{children:p.jsx(RS,{})})},{path:"workflows/cron",element:p.jsx(Vs,{to:"/workflows/start?mode=schedule",replace:!0})},{path:"workflows/workers",element:p.jsx(Ne,{children:p.jsx(HS,{})})},{path:"workflows/registry",element:p.jsx(Ne,{children:p.jsx(PS,{})})},{path:"workflows/registry/new",element:p.jsx(Ne,{children:p.jsx(Z0,{})})},{path:"workflows/registry/:workflowType",element:p.jsx(Ne,{children:p.jsx(Z0,{})})}]},{element:p.jsx(xf,{roleTypes:["admin","superadmin"],roleNames:["engineer"]}),children:[{path:"mcp",element:p.jsx(Ne,{children:p.jsx(wS,{})})},{path:"mcp/queries",element:p.jsx(Ne,{children:p.jsx(AS,{})})},{path:"mcp/queries/:workflowId",element:p.jsx(Ne,{children:p.jsx(OS,{})})},{path:"mcp/tools",element:p.jsx(Vs,{to:"/mcp/servers",replace:!0})},{path:"mcp/servers",element:p.jsx(Ne,{children:p.jsx($S,{})})},{path:"mcp/servers/new",element:p.jsx(Ne,{children:p.jsx(W0,{})})},{path:"mcp/servers/:serverId",element:p.jsx(Ne,{children:p.jsx(W0,{})})},{path:"mcp/workflows",element:p.jsx(Ne,{children:p.jsx(qS,{})})},{path:"mcp/executions",element:p.jsx(Ne,{children:p.jsx(SS,{})})},{path:"mcp/executions/:jobId",element:p.jsx(Ne,{children:p.jsx(ES,{})})},{path:"files",element:p.jsx(Ne,{children:p.jsx(QS,{})})},{path:"knowledge",element:p.jsx(Ne,{children:p.jsx(XS,{})})}]},{element:p.jsx(xf,{roleTypes:["admin","superadmin"]}),children:[{path:"admin",element:p.jsx(Ne,{children:p.jsx(LS,{})})},{path:"admin/users",element:p.jsx(Ne,{children:p.jsx(YS,{})})},{path:"admin/bots",element:p.jsx(Vs,{to:"/admin/users?tab=service-accounts",replace:!0})},{path:"admin/escalation-chains",element:p.jsx(Vs,{to:"/admin/roles",replace:!0})},{path:"admin/roles",element:p.jsx(Ne,{children:p.jsx(GS,{})})},{path:"admin/maintenance",element:p.jsx(Ne,{children:p.jsx(VS,{})})},{path:"admin/controlplane",element:p.jsx(Ne,{children:p.jsx(FS,{})})}]}]}]);function ZS(){return p.jsx(px,{client:sy,children:p.jsx(ew,{children:p.jsx(Kx,{children:p.jsx(bx,{router:KS})})})})}Jx.createRoot(document.getElementById("root")).render(p.jsx(C.StrictMode,{children:p.jsx(ZS,{})}));export{cg as A,ah as C,uS as D,Gg as F,kw as J,e_ as N,ny as O,xw as S,bE as a,Ie as b,oS as c,aE as d,cE as e,aS as f,uE as g,iE as h,Ai as i,hE as j,dE as k,mE as l,pE as m,gE as n,rE as o,nw as p,oE as q,lE as r,fE as s,ey as t,Tg as u,ty as v,yE as w,ch as x,xE as y,vE as z};
63
+ //# sourceMappingURL=index-BUjxYyxc.js.map