@hotmeshio/long-tail 0.13.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (250) hide show
  1. package/build/api/announcements.d.ts +22 -0
  2. package/build/api/announcements.js +96 -0
  3. package/build/api/auth-sso.d.ts +6 -3
  4. package/build/api/auth-sso.js +6 -3
  5. package/build/api/escalations/list.d.ts +8 -0
  6. package/build/api/escalations/list.js +14 -4
  7. package/build/api/index.d.ts +1 -0
  8. package/build/api/index.js +2 -1
  9. package/build/api/workflows/config.d.ts +1 -0
  10. package/build/api/workflows/config.js +1 -0
  11. package/build/api/workflows/discovery.js +1 -0
  12. package/build/lib/db/schemas/031_announcements.sql +30 -0
  13. package/build/lib/db/schemas/032_workflow_read_safe.sql +9 -0
  14. package/build/lib/events/publish.d.ts +15 -0
  15. package/build/lib/events/publish.js +22 -0
  16. package/build/modules/auth.js +9 -3
  17. package/build/routes/announcements.d.ts +2 -0
  18. package/build/routes/announcements.js +64 -0
  19. package/build/routes/auth-sso.js +6 -1
  20. package/build/routes/escalations/list.js +2 -0
  21. package/build/routes/index.js +2 -0
  22. package/build/services/announcement/index.d.ts +30 -0
  23. package/build/services/announcement/index.js +29 -0
  24. package/build/services/announcement/sql.d.ts +8 -0
  25. package/build/services/announcement/sql.js +24 -0
  26. package/build/services/config/cache.js +1 -0
  27. package/build/services/config/read.js +2 -0
  28. package/build/services/config/sql.d.ts +2 -2
  29. package/build/services/config/sql.js +6 -5
  30. package/build/services/config/write.js +5 -0
  31. package/build/services/scan-code/index.d.ts +1 -1
  32. package/build/services/scan-code/index.js +3 -1
  33. package/build/services/scan-code/sql.d.ts +7 -0
  34. package/build/services/scan-code/sql.js +55 -1
  35. package/build/services/scan-code/write.d.ts +8 -0
  36. package/build/services/scan-code/write.js +23 -1
  37. package/build/services/topics/system-topics.js +20 -0
  38. package/build/shared/form-validation/index.d.ts +1 -0
  39. package/build/shared/form-validation/index.js +1 -0
  40. package/build/shared/form-validation/validate-resolver-payload.d.ts +3 -0
  41. package/build/shared/form-validation/validate-resolver-payload.js +19 -0
  42. package/build/shared/form-validation/x-lt-labels.d.ts +17 -6
  43. package/build/shared/form-validation/x-lt-labels.js +12 -4
  44. package/build/shared/form-validation/x-lt-require-any.d.ts +22 -0
  45. package/build/shared/form-validation/x-lt-require-any.js +41 -0
  46. package/build/start/workers.js +50 -0
  47. package/build/system/mcp-servers/admin/announcements.d.ts +7 -0
  48. package/build/system/mcp-servers/admin/announcements.js +69 -0
  49. package/build/system/mcp-servers/admin/index.js +5 -3
  50. package/build/system/mcp-servers/admin/workflows.js +45 -0
  51. package/build/system/seed/tool-manifests-admin.d.ts +357 -0
  52. package/build/system/seed/tool-manifests-admin.js +3 -0
  53. package/build/tsconfig.tsbuildinfo +1 -1
  54. package/build/types/auth.d.ts +21 -7
  55. package/build/types/config.d.ts +8 -0
  56. package/build/types/index.d.ts +1 -1
  57. package/build/types/startup.d.ts +57 -0
  58. package/dashboard/dist/assets/{AdminDashboard-D2unnS2b.js → AdminDashboard-DeZsR4pA.js} +2 -2
  59. package/dashboard/dist/assets/{AdminDashboard-D2unnS2b.js.map → AdminDashboard-DeZsR4pA.js.map} +1 -1
  60. package/dashboard/dist/assets/{AgentConfigPage-CBkf403g.js → AgentConfigPage-Bi5ZAsjf.js} +2 -2
  61. package/dashboard/dist/assets/{AgentConfigPage-CBkf403g.js.map → AgentConfigPage-Bi5ZAsjf.js.map} +1 -1
  62. package/dashboard/dist/assets/{AgentDetailPage-CAIU3yzo.js → AgentDetailPage-CIbKor5E.js} +2 -2
  63. package/dashboard/dist/assets/{AgentDetailPage-CAIU3yzo.js.map → AgentDetailPage-CIbKor5E.js.map} +1 -1
  64. package/dashboard/dist/assets/{AgentsPage-qP9fWMyT.js → AgentsPage-CRFZ6KDu.js} +2 -2
  65. package/dashboard/dist/assets/{AgentsPage-qP9fWMyT.js.map → AgentsPage-CRFZ6KDu.js.map} +1 -1
  66. package/dashboard/dist/assets/AvailableEscalationsPage-DDsmXjpi.js +2 -0
  67. package/dashboard/dist/assets/AvailableEscalationsPage-DDsmXjpi.js.map +1 -0
  68. package/dashboard/dist/assets/{BotPicker-BN-MKITV.js → BotPicker-dUpw1wW6.js} +2 -2
  69. package/dashboard/dist/assets/{BotPicker-BN-MKITV.js.map → BotPicker-dUpw1wW6.js.map} +1 -1
  70. package/dashboard/dist/assets/{CapabilitiesPage-CJfmWokN.js → CapabilitiesPage-Ca2jEln-.js} +2 -2
  71. package/dashboard/dist/assets/{CapabilitiesPage-CJfmWokN.js.map → CapabilitiesPage-Ca2jEln-.js.map} +1 -1
  72. package/dashboard/dist/assets/{CollapsibleSection-BvMHlHyt.js → CollapsibleSection-BXlR5QmW.js} +2 -2
  73. package/dashboard/dist/assets/{CollapsibleSection-BvMHlHyt.js.map → CollapsibleSection-BXlR5QmW.js.map} +1 -1
  74. package/dashboard/dist/assets/CountdownTimer-rnoWmFqx.js +2 -0
  75. package/dashboard/dist/assets/CountdownTimer-rnoWmFqx.js.map +1 -0
  76. package/dashboard/dist/assets/{CredentialsPage-2TvvRwGJ.js → CredentialsPage-CGyCCzGh.js} +2 -2
  77. package/dashboard/dist/assets/{CredentialsPage-2TvvRwGJ.js.map → CredentialsPage-CGyCCzGh.js.map} +1 -1
  78. package/dashboard/dist/assets/{CronLabel-HxmsDSnV.js → CronLabel-CAu2hmQf.js} +2 -2
  79. package/dashboard/dist/assets/{CronLabel-HxmsDSnV.js.map → CronLabel-CAu2hmQf.js.map} +1 -1
  80. package/dashboard/dist/assets/CustomDurationPicker-hlnadaFt.js +2 -0
  81. package/dashboard/dist/assets/CustomDurationPicker-hlnadaFt.js.map +1 -0
  82. package/dashboard/dist/assets/{ElapsedCell-BkRu9Xpd.js → ElapsedCell-B1eoCzEw.js} +2 -2
  83. package/dashboard/dist/assets/{ElapsedCell-BkRu9Xpd.js.map → ElapsedCell-B1eoCzEw.js.map} +1 -1
  84. package/dashboard/dist/assets/{EntityTimelinePanel--E6hLMCM.js → EntityTimelinePanel-CIOyjwjM.js} +2 -2
  85. package/dashboard/dist/assets/{EntityTimelinePanel--E6hLMCM.js.map → EntityTimelinePanel-CIOyjwjM.js.map} +1 -1
  86. package/dashboard/dist/assets/{EscalationListSchemaPage-CdFtqEEX.js → EscalationListSchemaPage-DQNQ7o_4.js} +2 -2
  87. package/dashboard/dist/assets/{EscalationListSchemaPage-CdFtqEEX.js.map → EscalationListSchemaPage-DQNQ7o_4.js.map} +1 -1
  88. package/dashboard/dist/assets/{EscalationSchemaPage-BsjS2axz.js → EscalationSchemaPage-DFgDn4R3.js} +2 -2
  89. package/dashboard/dist/assets/{EscalationSchemaPage-BsjS2axz.js.map → EscalationSchemaPage-DFgDn4R3.js.map} +1 -1
  90. package/dashboard/dist/assets/{EscalationsOverview-FL-xteVc.js → EscalationsOverview-DfbKtXVZ.js} +2 -2
  91. package/dashboard/dist/assets/{EscalationsOverview-FL-xteVc.js.map → EscalationsOverview-DfbKtXVZ.js.map} +1 -1
  92. package/dashboard/dist/assets/{EventTable-BOcgZ78i.js → EventTable-CZPkvhao.js} +2 -2
  93. package/dashboard/dist/assets/{EventTable-BOcgZ78i.js.map → EventTable-CZPkvhao.js.map} +1 -1
  94. package/dashboard/dist/assets/{FilterBar-DfCiCmm-.js → FilterBar-CYjKK9Cp.js} +2 -2
  95. package/dashboard/dist/assets/{FilterBar-DfCiCmm-.js.map → FilterBar-CYjKK9Cp.js.map} +1 -1
  96. package/dashboard/dist/assets/{GraphInvokePage-DfVeiN-8.js → GraphInvokePage-DY9u42vt.js} +2 -2
  97. package/dashboard/dist/assets/{GraphInvokePage-DfVeiN-8.js.map → GraphInvokePage-DY9u42vt.js.map} +1 -1
  98. package/dashboard/dist/assets/{HomePage-C2IhF9WB.js → HomePage-p_CYlGnh.js} +2 -2
  99. package/dashboard/dist/assets/{HomePage-C2IhF9WB.js.map → HomePage-p_CYlGnh.js.map} +1 -1
  100. package/dashboard/dist/assets/{ListToolbar-DA0PTOl5.js → ListToolbar-Dz-1RXSH.js} +2 -2
  101. package/dashboard/dist/assets/{ListToolbar-DA0PTOl5.js.map → ListToolbar-Dz-1RXSH.js.map} +1 -1
  102. package/dashboard/dist/assets/{McpOverview-DstPch5M.js → McpOverview-BUI9sVTk.js} +2 -2
  103. package/dashboard/dist/assets/{McpOverview-DstPch5M.js.map → McpOverview-BUI9sVTk.js.map} +1 -1
  104. package/dashboard/dist/assets/{McpQueryDetailPage-Csv0PKE0.js → McpQueryDetailPage-CVN_UAB3.js} +2 -2
  105. package/dashboard/dist/assets/{McpQueryDetailPage-Csv0PKE0.js.map → McpQueryDetailPage-CVN_UAB3.js.map} +1 -1
  106. package/dashboard/dist/assets/{McpQueryPage-DxmqCkly.js → McpQueryPage-DRTKSPDR.js} +2 -2
  107. package/dashboard/dist/assets/{McpQueryPage-DxmqCkly.js.map → McpQueryPage-DRTKSPDR.js.map} +1 -1
  108. package/dashboard/dist/assets/{McpRunDetailPage-CcJOlp_B.js → McpRunDetailPage-CTb1AxR3.js} +2 -2
  109. package/dashboard/dist/assets/{McpRunDetailPage-CcJOlp_B.js.map → McpRunDetailPage-CTb1AxR3.js.map} +1 -1
  110. package/dashboard/dist/assets/{McpRunsPage-BZCR043j.js → McpRunsPage-BWLwjVd0.js} +2 -2
  111. package/dashboard/dist/assets/{McpRunsPage-BZCR043j.js.map → McpRunsPage-BWLwjVd0.js.map} +1 -1
  112. package/dashboard/dist/assets/{OperationsPage-DMsPXITh.js → OperationsPage-BSl_oUAJ.js} +2 -2
  113. package/dashboard/dist/assets/{OperationsPage-DMsPXITh.js.map → OperationsPage-BSl_oUAJ.js.map} +1 -1
  114. package/dashboard/dist/assets/{OperatorDashboard-DSloftQ5.js → OperatorDashboard-DGs9kPOZ.js} +2 -2
  115. package/dashboard/dist/assets/{OperatorDashboard-DSloftQ5.js.map → OperatorDashboard-DGs9kPOZ.js.map} +1 -1
  116. package/dashboard/dist/assets/{PersonaDetailPage-jDVRCLbU.js → PersonaDetailPage-C33MgXUY.js} +2 -2
  117. package/dashboard/dist/assets/{PersonaDetailPage-jDVRCLbU.js.map → PersonaDetailPage-C33MgXUY.js.map} +1 -1
  118. package/dashboard/dist/assets/{PersonasPage-DnDDwXoy.js → PersonasPage-BbLOHq5X.js} +2 -2
  119. package/dashboard/dist/assets/{PersonasPage-DnDDwXoy.js.map → PersonasPage-BbLOHq5X.js.map} +1 -1
  120. package/dashboard/dist/assets/{ProcessDetailPage-CfAUU6q2.js → ProcessDetailPage-zwd0HCJl.js} +2 -2
  121. package/dashboard/dist/assets/{ProcessDetailPage-CfAUU6q2.js.map → ProcessDetailPage-zwd0HCJl.js.map} +1 -1
  122. package/dashboard/dist/assets/{ProcessesListPage-CnAXzaVv.js → ProcessesListPage-DnfmK6jf.js} +2 -2
  123. package/dashboard/dist/assets/{ProcessesListPage-CnAXzaVv.js.map → ProcessesListPage-DnfmK6jf.js.map} +1 -1
  124. package/dashboard/dist/assets/{RoleDetailPage-Dg1p6Qz_.js → RoleDetailPage-axZtFPC_.js} +2 -2
  125. package/dashboard/dist/assets/{RoleDetailPage-Dg1p6Qz_.js.map → RoleDetailPage-axZtFPC_.js.map} +1 -1
  126. package/dashboard/dist/assets/{RolesPage-DeRVQux8.js → RolesPage-DN6yqH7-.js} +2 -2
  127. package/dashboard/dist/assets/{RolesPage-DeRVQux8.js.map → RolesPage-DN6yqH7-.js.map} +1 -1
  128. package/dashboard/dist/assets/{RunAsSelector-BFNqQGuG.js → RunAsSelector-DrGsUhL8.js} +2 -2
  129. package/dashboard/dist/assets/{RunAsSelector-BFNqQGuG.js.map → RunAsSelector-DrGsUhL8.js.map} +1 -1
  130. package/dashboard/dist/assets/{ScanCodesPage-D0GOdk5m.js → ScanCodesPage-BmQjEyWZ.js} +2 -2
  131. package/dashboard/dist/assets/{ScanCodesPage-D0GOdk5m.js.map → ScanCodesPage-BmQjEyWZ.js.map} +1 -1
  132. package/dashboard/dist/assets/ScanSchemeDetailPage-VODehqGs.js +2 -0
  133. package/dashboard/dist/assets/ScanSchemeDetailPage-VODehqGs.js.map +1 -0
  134. package/dashboard/dist/assets/{ScanStationPage-DH1ynTX9.js → ScanStationPage-Y-9Gs7t5.js} +2 -2
  135. package/dashboard/dist/assets/{ScanStationPage-DH1ynTX9.js.map → ScanStationPage-Y-9Gs7t5.js.map} +1 -1
  136. package/dashboard/dist/assets/{StickyPagination-B99hVu95.js → StickyPagination-9VkHiOsT.js} +2 -2
  137. package/dashboard/dist/assets/{StickyPagination-B99hVu95.js.map → StickyPagination-9VkHiOsT.js.map} +1 -1
  138. package/dashboard/dist/assets/{StreamMessageDetail-DcDGISrv.js → StreamMessageDetail-C37J6Qyz.js} +2 -2
  139. package/dashboard/dist/assets/{StreamMessageDetail-DcDGISrv.js.map → StreamMessageDetail-C37J6Qyz.js.map} +1 -1
  140. package/dashboard/dist/assets/{SwimlaneTimeline-BP3mSQAg.js → SwimlaneTimeline-NVGsBIX-.js} +2 -2
  141. package/dashboard/dist/assets/{SwimlaneTimeline-BP3mSQAg.js.map → SwimlaneTimeline-NVGsBIX-.js.map} +1 -1
  142. package/dashboard/dist/assets/{TaskDetailPage-_XWLJzt-.js → TaskDetailPage-5sbMHi5U.js} +2 -2
  143. package/dashboard/dist/assets/{TaskDetailPage-_XWLJzt-.js.map → TaskDetailPage-5sbMHi5U.js.map} +1 -1
  144. package/dashboard/dist/assets/{TasksListPage-iGriKiO2.js → TasksListPage-C9AN7IBb.js} +2 -2
  145. package/dashboard/dist/assets/{TasksListPage-iGriKiO2.js.map → TasksListPage-C9AN7IBb.js.map} +1 -1
  146. package/dashboard/dist/assets/{TimeAgo-BO33VeFl.js → TimeAgo-CsbQGlSd.js} +2 -2
  147. package/dashboard/dist/assets/{TimeAgo-BO33VeFl.js.map → TimeAgo-CsbQGlSd.js.map} +1 -1
  148. package/dashboard/dist/assets/{TimestampCell-KAjX7w35.js → TimestampCell-DlbIkV-G.js} +2 -2
  149. package/dashboard/dist/assets/{TimestampCell-KAjX7w35.js.map → TimestampCell-DlbIkV-G.js.map} +1 -1
  150. package/dashboard/dist/assets/{ToolTestPanel-BchG2yC6.js → ToolTestPanel-BKbLocvr.js} +2 -2
  151. package/dashboard/dist/assets/{ToolTestPanel-BchG2yC6.js.map → ToolTestPanel-BKbLocvr.js.map} +1 -1
  152. package/dashboard/dist/assets/{TopicDetailPage-BaK8H0o1.js → TopicDetailPage-fOnTfDso.js} +2 -2
  153. package/dashboard/dist/assets/{TopicDetailPage-BaK8H0o1.js.map → TopicDetailPage-fOnTfDso.js.map} +1 -1
  154. package/dashboard/dist/assets/{TopicsPage-DEyvm669.js → TopicsPage-BoVkp7DM.js} +2 -2
  155. package/dashboard/dist/assets/{TopicsPage-DEyvm669.js.map → TopicsPage-BoVkp7DM.js.map} +1 -1
  156. package/dashboard/dist/assets/{UserName-BV6SKI9P.js → UserName-0gjVPU_U.js} +2 -2
  157. package/dashboard/dist/assets/{UserName-BV6SKI9P.js.map → UserName-0gjVPU_U.js.map} +1 -1
  158. package/dashboard/dist/assets/{WorkflowExecutionPage-1sKoEFNC.js → WorkflowExecutionPage-B28OxTS_.js} +2 -2
  159. package/dashboard/dist/assets/{WorkflowExecutionPage-1sKoEFNC.js.map → WorkflowExecutionPage-B28OxTS_.js.map} +1 -1
  160. package/dashboard/dist/assets/{WorkflowsDashboard-YTHDZZOD.js → WorkflowsDashboard-Bzvz6tTY.js} +2 -2
  161. package/dashboard/dist/assets/{WorkflowsDashboard-YTHDZZOD.js.map → WorkflowsDashboard-Bzvz6tTY.js.map} +1 -1
  162. package/dashboard/dist/assets/{WorkflowsOverview-ucXPLTtm.js → WorkflowsOverview-BkcRU4Ej.js} +2 -2
  163. package/dashboard/dist/assets/{WorkflowsOverview-ucXPLTtm.js.map → WorkflowsOverview-BkcRU4Ej.js.map} +1 -1
  164. package/dashboard/dist/assets/{YamlWorkflowDetailPage-C_RTZKqZ.js → YamlWorkflowDetailPage-CmM78sYi.js} +2 -2
  165. package/dashboard/dist/assets/{YamlWorkflowDetailPage-C_RTZKqZ.js.map → YamlWorkflowDetailPage-CmM78sYi.js.map} +1 -1
  166. package/dashboard/dist/assets/{YamlWorkflowsPage-Usid3w2W.js → YamlWorkflowsPage-Dp6vG1au.js} +2 -2
  167. package/dashboard/dist/assets/{YamlWorkflowsPage-Usid3w2W.js.map → YamlWorkflowsPage-Dp6vG1au.js.map} +1 -1
  168. package/dashboard/dist/assets/{agents-BTDsRK8e.js → agents-MeqzOPD6.js} +2 -2
  169. package/dashboard/dist/assets/{agents-BTDsRK8e.js.map → agents-MeqzOPD6.js.map} +1 -1
  170. package/dashboard/dist/assets/{bots-DxLrfdfr.js → bots-DTGXnvX_.js} +2 -2
  171. package/dashboard/dist/assets/{bots-DxLrfdfr.js.map → bots-DTGXnvX_.js.map} +1 -1
  172. package/dashboard/dist/assets/{capabilities-DbTmeW-S.js → capabilities-BjlARR7F.js} +2 -2
  173. package/dashboard/dist/assets/{capabilities-DbTmeW-S.js.map → capabilities-BjlARR7F.js.map} +1 -1
  174. package/dashboard/dist/assets/{controlplane-CEBntAL4.js → controlplane-DMYI0OaL.js} +2 -2
  175. package/dashboard/dist/assets/{controlplane-CEBntAL4.js.map → controlplane-DMYI0OaL.js.map} +1 -1
  176. package/dashboard/dist/assets/{escalation-columns-Carqdwoh.js → escalation-columns-BMO_H3cb.js} +2 -2
  177. package/dashboard/dist/assets/{escalation-columns-Carqdwoh.js.map → escalation-columns-BMO_H3cb.js.map} +1 -1
  178. package/dashboard/dist/assets/{index-De8iV1y2.js → index-3QEnMBNG.js} +2 -2
  179. package/dashboard/dist/assets/{index-De8iV1y2.js.map → index-3QEnMBNG.js.map} +1 -1
  180. package/dashboard/dist/assets/{index-Bqm4zu46.js → index-B3FzpDEG.js} +2 -2
  181. package/dashboard/dist/assets/{index-Bqm4zu46.js.map → index-B3FzpDEG.js.map} +1 -1
  182. package/dashboard/dist/assets/{index-cFHoANSG.css → index-B5jxf81r.css} +1 -1
  183. package/dashboard/dist/assets/{index-DBXm49S6.js → index-BU4oujVO.js} +30 -29
  184. package/dashboard/dist/assets/index-BU4oujVO.js.map +1 -0
  185. package/dashboard/dist/assets/{index-kes8V4Xw.js → index-CGCD5hTX.js} +2 -2
  186. package/dashboard/dist/assets/{index-kes8V4Xw.js.map → index-CGCD5hTX.js.map} +1 -1
  187. package/dashboard/dist/assets/{index-BhapT-Vl.js → index-Ch-OS1pk.js} +2 -2
  188. package/dashboard/dist/assets/{index-BhapT-Vl.js.map → index-Ch-OS1pk.js.map} +1 -1
  189. package/dashboard/dist/assets/{index-B9m7fA3M.js → index-CkkOh8y9.js} +2 -2
  190. package/dashboard/dist/assets/{index-B9m7fA3M.js.map → index-CkkOh8y9.js.map} +1 -1
  191. package/dashboard/dist/assets/{index-B2hz0pUh.js → index-D3iDAWK2.js} +2 -2
  192. package/dashboard/dist/assets/{index-B2hz0pUh.js.map → index-D3iDAWK2.js.map} +1 -1
  193. package/dashboard/dist/assets/{index-C0hSttF5.js → index-D6kXz3H8.js} +2 -2
  194. package/dashboard/dist/assets/{index-C0hSttF5.js.map → index-D6kXz3H8.js.map} +1 -1
  195. package/dashboard/dist/assets/{index-CVBBkW8V.js → index-Dsgqxdyh.js} +2 -2
  196. package/dashboard/dist/assets/{index-CVBBkW8V.js.map → index-Dsgqxdyh.js.map} +1 -1
  197. package/dashboard/dist/assets/{index-nwLh3CK2.js → index-DuhqzYwC.js} +2 -2
  198. package/dashboard/dist/assets/{index-nwLh3CK2.js.map → index-DuhqzYwC.js.map} +1 -1
  199. package/dashboard/dist/assets/{index-CDkg6iOE.js → index-DuyzcDuV.js} +2 -2
  200. package/dashboard/dist/assets/{index-CDkg6iOE.js.map → index-DuyzcDuV.js.map} +1 -1
  201. package/dashboard/dist/assets/index-LF1gEc6w.js +3 -0
  202. package/dashboard/dist/assets/index-LF1gEc6w.js.map +1 -0
  203. package/dashboard/dist/assets/{index-CgIBjZta.js → index-k5vcLICm.js} +2 -2
  204. package/dashboard/dist/assets/{index-CgIBjZta.js.map → index-k5vcLICm.js.map} +1 -1
  205. package/dashboard/dist/assets/{knowledge-oFYAanUp.js → knowledge-DAV1Jy7b.js} +2 -2
  206. package/dashboard/dist/assets/{knowledge-oFYAanUp.js.map → knowledge-DAV1Jy7b.js.map} +1 -1
  207. package/dashboard/dist/assets/{mcp-C9Kw4Ow8.js → mcp-CivbxL1P.js} +2 -2
  208. package/dashboard/dist/assets/{mcp-C9Kw4Ow8.js.map → mcp-CivbxL1P.js.map} +1 -1
  209. package/dashboard/dist/assets/{mcp-query-BwzpZ91Z.js → mcp-query-CGvWNrgo.js} +2 -2
  210. package/dashboard/dist/assets/{mcp-query-BwzpZ91Z.js.map → mcp-query-CGvWNrgo.js.map} +1 -1
  211. package/dashboard/dist/assets/{personas-D5ehmtRb.js → personas-lI3aUr6t.js} +2 -2
  212. package/dashboard/dist/assets/{personas-D5ehmtRb.js.map → personas-lI3aUr6t.js.map} +1 -1
  213. package/dashboard/dist/assets/{pipelines-xgPKGEdD.js → pipelines-DjPfnTmx.js} +2 -2
  214. package/dashboard/dist/assets/{pipelines-xgPKGEdD.js.map → pipelines-DjPfnTmx.js.map} +1 -1
  215. package/dashboard/dist/assets/{tasks-CLyrl-MU.js → tasks-Co_S55BO.js} +2 -2
  216. package/dashboard/dist/assets/{tasks-CLyrl-MU.js.map → tasks-Co_S55BO.js.map} +1 -1
  217. package/dashboard/dist/assets/{topics-B_gO7CQ0.js → topics-2IGhZXBi.js} +2 -2
  218. package/dashboard/dist/assets/{topics-B_gO7CQ0.js.map → topics-2IGhZXBi.js.map} +1 -1
  219. package/dashboard/dist/assets/{useEventHooks-BdWYm63U.js → useEventHooks-D0C5yke4.js} +2 -2
  220. package/dashboard/dist/assets/{useEventHooks-BdWYm63U.js.map → useEventHooks-D0C5yke4.js.map} +1 -1
  221. package/dashboard/dist/assets/{useNamespace-C238M4Qn.js → useNamespace-LG52DTT-.js} +2 -2
  222. package/dashboard/dist/assets/{useNamespace-C238M4Qn.js.map → useNamespace-LG52DTT-.js.map} +1 -1
  223. package/dashboard/dist/assets/{useYamlActivityEvents-B2ryEK4S.js → useYamlActivityEvents-1IZGVpWC.js} +2 -2
  224. package/dashboard/dist/assets/{useYamlActivityEvents-B2ryEK4S.js.map → useYamlActivityEvents-1IZGVpWC.js.map} +1 -1
  225. package/dashboard/dist/assets/{users-BFaTe6Mt.js → users-C-eHT1i6.js} +2 -2
  226. package/dashboard/dist/assets/{users-BFaTe6Mt.js.map → users-C-eHT1i6.js.map} +1 -1
  227. package/dashboard/dist/assets/{workflows-DXz7tZxp.js → workflows-C16CeY4e.js} +2 -2
  228. package/dashboard/dist/assets/{workflows-DXz7tZxp.js.map → workflows-C16CeY4e.js.map} +1 -1
  229. package/dashboard/dist/assets/{yaml-workflows-u3xuRAnS.js → yaml-workflows-BBenayT9.js} +2 -2
  230. package/dashboard/dist/assets/{yaml-workflows-u3xuRAnS.js.map → yaml-workflows-BBenayT9.js.map} +1 -1
  231. package/dashboard/dist/index.html +2 -2
  232. package/docs/auth.md +26 -1
  233. package/docs/code-owned-configuration.md +27 -0
  234. package/docs/dashboard.md +15 -0
  235. package/docs/hitl/x-lt-footer.md +16 -4
  236. package/docs/hitl/x-lt-validation.md +23 -0
  237. package/docs/mcp.md +2 -0
  238. package/docs/scan-codes.md +24 -0
  239. package/package.json +1 -1
  240. package/dashboard/dist/assets/AvailableEscalationsPage-DvWaiafI.js +0 -2
  241. package/dashboard/dist/assets/AvailableEscalationsPage-DvWaiafI.js.map +0 -1
  242. package/dashboard/dist/assets/CountdownTimer-By4rbMDN.js +0 -2
  243. package/dashboard/dist/assets/CountdownTimer-By4rbMDN.js.map +0 -1
  244. package/dashboard/dist/assets/CustomDurationPicker-8Ao-1pKA.js +0 -2
  245. package/dashboard/dist/assets/CustomDurationPicker-8Ao-1pKA.js.map +0 -1
  246. package/dashboard/dist/assets/ScanSchemeDetailPage-vFqoe_P4.js +0 -2
  247. package/dashboard/dist/assets/ScanSchemeDetailPage-vFqoe_P4.js.map +0 -1
  248. package/dashboard/dist/assets/index-DBXm49S6.js.map +0 -1
  249. package/dashboard/dist/assets/index-DsgjFRvA.js +0 -3
  250. package/dashboard/dist/assets/index-DsgjFRvA.js.map +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ProcessesListPage-CnAXzaVv.js","./vendor-query-RUZdMvN6.js","./tasks-CLyrl-MU.js","./workflows-DXz7tZxp.js","./useEventHooks-BdWYm63U.js","./useFilterParams-crmlBw_l.js","./vendor-react-CdqEC2zv.js","./useDebouncedValue-C4P2jQuh.js","./api-path-u2Jf9QXS.js","./DataTable-Bir0Xs1p.js","./EmptyState-lpUFYfun.js","./TimestampCell-KAjX7w35.js","./StickyPagination-B99hVu95.js","./FilterBar-DfCiCmm-.js","./vendor-icons-BPsNpK3Y.js","./PageHeader-BpeBHqyc.js","./ListToolbar-DA0PTOl5.js","./WorkflowPill-BcA7S3gI.js","./ProcessDetailPage-CfAUU6q2.js","./PageHeaderWithStats-JXeUFa_g.js","./StatusBadge-DkgllZHv.js","./RolePill-EocCXZh0.js","./UserName-BV6SKI9P.js","./users-BFaTe6Mt.js","./McpOverview-DstPch5M.js","./mcp-C9Kw4Ow8.js","./pipelines-xgPKGEdD.js","./yaml-workflows-u3xuRAnS.js","./controlplane-CEBntAL4.js","./StatCard-BXQ8dD9Y.js","./McpRunsPage-BZCR043j.js","./useNamespace-C238M4Qn.js","./ElapsedCell-BkRu9Xpd.js","./RowActions-eYrzgQSj.js","./McpRunDetailPage-CcJOlp_B.js","./SegmentedTabs-DXNzY05q.js","./EventTable-BOcgZ78i.js","./SwimlaneTimeline-BP3mSQAg.js","./StreamMessageDetail-DcDGISrv.js","./CopyableId-4Lqlc5cU.js","./McpQueryPage-DxmqCkly.js","./mcp-query-BwzpZ91Z.js","./McpQueryDetailPage-Csv0PKE0.js","./TagInput-Ch5u6iPH.js","./CollapsibleSection-BvMHlHyt.js","./useYamlActivityEvents-B2ryEK4S.js","./helpers-DzO-OGPe.js","./RunAsSelector-BFNqQGuG.js","./BotPicker-BN-MKITV.js","./bots-DxLrfdfr.js","./ToolPill-sj8OkBB0.js","./TimeAgo-BO33VeFl.js","./EscalationsOverview-FL-xteVc.js","./AvailableEscalationsPage-DvWaiafI.js","./task-queues-7-sHKPsN.js","./CustomDurationPicker-8Ao-1pKA.js","./Modal-BU7No9NH.js","./constants-BHkpVaqx.js","./escalation-columns-Carqdwoh.js","./EntityTimelinePanel--E6hLMCM.js","./PriorityBadge-BETdj4M-.js","./CountdownTimer-By4rbMDN.js","./OperatorDashboard-DSloftQ5.js","./index-DsgjFRvA.js","./WorkflowsOverview-ucXPLTtm.js","./index-CDkg6iOE.js","./NamespacePill-BeifzjUm.js","./WorkflowsDashboard-YTHDZZOD.js","./YamlWorkflowsPage-Usid3w2W.js","./GraphInvokePage-DfVeiN-8.js","./YamlWorkflowDetailPage-C_RTZKqZ.js","./TasksListPage-iGriKiO2.js","./TaskDetailPage-_XWLJzt-.js","./WorkflowExecutionPage-1sKoEFNC.js","./AdminDashboard-D2unnS2b.js","./index-De8iV1y2.js","./TaskQueuePill-Bz146p-P.js","./index-CgIBjZta.js","./ConfirmDeleteModal-CQsJUzEa.js","./index-BhapT-Vl.js","./ToolTestPanel-BchG2yC6.js","./index-C0hSttF5.js","./index-Bqm4zu46.js","./personas-D5ehmtRb.js","./ScopeBadge-H5dEqeHi.js","./RolesPage-DeRVQux8.js","./RoleDetailPage-Dg1p6Qz_.js","./AutoGrowTextarea-DgEQeRQw.js","./PersonasPage-DnDDwXoy.js","./PersonaDetailPage-jDVRCLbU.js","./EscalationSchemaPage-BsjS2axz.js","./EscalationListSchemaPage-CdFtqEEX.js","./ScanCodesPage-D0GOdk5m.js","./ScanSchemeDetailPage-vFqoe_P4.js","./ScanStationPage-DH1ynTX9.js","./index-kes8V4Xw.js","./OperationsPage-DMsPXITh.js","./index-B2hz0pUh.js","./index-CVBBkW8V.js","./CredentialsPage-2TvvRwGJ.js","./index-nwLh3CK2.js","./DropZone-DovkhN2p.js","./index-B9m7fA3M.js","./knowledge-oFYAanUp.js","./HomePage-C2IhF9WB.js","./AgentsPage-qP9fWMyT.js","./agents-BTDsRK8e.js","./AgentDetailPage-CAIU3yzo.js","./CronLabel-HxmsDSnV.js","./AgentConfigPage-CBkf403g.js","./capabilities-DbTmeW-S.js","./topics-B_gO7CQ0.js","./CapabilitiesPage-CJfmWokN.js","./TopicsPage-DEyvm669.js","./TopicDetailPage-BaK8H0o1.js"])))=>i.map(i=>d[i]);
2
- var X_=Object.defineProperty;var J_=(i,t,r)=>t in i?X_(i,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):i[t]=r;var A=(i,t,r)=>J_(i,typeof t!="symbol"?t+"":t,r);import{r as Q_,u as pt,a as j,j as y,b as gt,c as Et,g as Z_,Q as W_,d as ew}from"./vendor-query-RUZdMvN6.js";import{r as tw,u as go,a as pn,L as Ii,N as Hs,b as ib,c as In,O as Ls,d as nw,R as rw}from"./vendor-react-CdqEC2zv.js";import{X as Cn,E as iw,S as sw,a as ou,M as aw,C as sb,b as Kh,I as Xh,R as ab,B as ob,U as ow,c as lw,L as cw,d as uw,Z as fw,P as zg,e as lb,f as hw,g as Ug,h as Pg,i as Ig,j as dw,W as Sd,k as mw,l as pw,F as gw,m as yw,n as bw,D as vw,N as xw,o as _w,p as ww,q as cb,r as ub,s as Sw,t as Ew,u as Ow,v as Aw,w as jw,G as Tw,T as Nw,x as kw,y as Cw,z as Mw}from"./vendor-icons-BPsNpK3Y.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))s(l);new MutationObserver(l=>{for(const c of l)if(c.type==="childList")for(const d of c.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&s(d)}).observe(document,{childList:!0,subtree:!0});function r(l){const c={};return l.integrity&&(c.integrity=l.integrity),l.referrerPolicy&&(c.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?c.credentials="include":l.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function s(l){if(l.ep)return;l.ep=!0;const c=r(l);fetch(l.href,c)}})();var Nh={exports:{}},Ga={},kh={exports:{}},Ch={};/**
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ProcessesListPage-DnfmK6jf.js","./vendor-query-RUZdMvN6.js","./tasks-Co_S55BO.js","./workflows-C16CeY4e.js","./useEventHooks-D0C5yke4.js","./useFilterParams-crmlBw_l.js","./vendor-react-CdqEC2zv.js","./useDebouncedValue-C4P2jQuh.js","./api-path-u2Jf9QXS.js","./DataTable-Bir0Xs1p.js","./EmptyState-lpUFYfun.js","./TimestampCell-DlbIkV-G.js","./StickyPagination-9VkHiOsT.js","./FilterBar-CYjKK9Cp.js","./vendor-icons-BPsNpK3Y.js","./PageHeader-BpeBHqyc.js","./ListToolbar-Dz-1RXSH.js","./WorkflowPill-BcA7S3gI.js","./ProcessDetailPage-zwd0HCJl.js","./PageHeaderWithStats-JXeUFa_g.js","./StatusBadge-DkgllZHv.js","./RolePill-EocCXZh0.js","./UserName-0gjVPU_U.js","./users-C-eHT1i6.js","./McpOverview-BUI9sVTk.js","./mcp-CivbxL1P.js","./pipelines-DjPfnTmx.js","./yaml-workflows-BBenayT9.js","./controlplane-DMYI0OaL.js","./StatCard-BXQ8dD9Y.js","./McpRunsPage-BWLwjVd0.js","./useNamespace-LG52DTT-.js","./ElapsedCell-B1eoCzEw.js","./RowActions-eYrzgQSj.js","./McpRunDetailPage-CTb1AxR3.js","./SegmentedTabs-DXNzY05q.js","./EventTable-CZPkvhao.js","./SwimlaneTimeline-NVGsBIX-.js","./StreamMessageDetail-C37J6Qyz.js","./CopyableId-4Lqlc5cU.js","./McpQueryPage-DRTKSPDR.js","./mcp-query-CGvWNrgo.js","./McpQueryDetailPage-CVN_UAB3.js","./TagInput-Ch5u6iPH.js","./CollapsibleSection-BXlR5QmW.js","./useYamlActivityEvents-1IZGVpWC.js","./helpers-DzO-OGPe.js","./RunAsSelector-DrGsUhL8.js","./BotPicker-dUpw1wW6.js","./bots-DTGXnvX_.js","./ToolPill-sj8OkBB0.js","./TimeAgo-CsbQGlSd.js","./EscalationsOverview-DfbKtXVZ.js","./AvailableEscalationsPage-DDsmXjpi.js","./task-queues-7-sHKPsN.js","./CustomDurationPicker-hlnadaFt.js","./Modal-BU7No9NH.js","./constants-BHkpVaqx.js","./escalation-columns-BMO_H3cb.js","./EntityTimelinePanel-CIOyjwjM.js","./PriorityBadge-BETdj4M-.js","./CountdownTimer-rnoWmFqx.js","./OperatorDashboard-DGs9kPOZ.js","./index-LF1gEc6w.js","./WorkflowsOverview-BkcRU4Ej.js","./index-DuyzcDuV.js","./NamespacePill-BeifzjUm.js","./WorkflowsDashboard-Bzvz6tTY.js","./YamlWorkflowsPage-Dp6vG1au.js","./GraphInvokePage-DY9u42vt.js","./YamlWorkflowDetailPage-CmM78sYi.js","./TasksListPage-C9AN7IBb.js","./TaskDetailPage-5sbMHi5U.js","./WorkflowExecutionPage-B28OxTS_.js","./AdminDashboard-DeZsR4pA.js","./index-3QEnMBNG.js","./TaskQueuePill-Bz146p-P.js","./index-k5vcLICm.js","./ConfirmDeleteModal-CQsJUzEa.js","./index-Ch-OS1pk.js","./ToolTestPanel-BKbLocvr.js","./index-D6kXz3H8.js","./index-B3FzpDEG.js","./personas-lI3aUr6t.js","./ScopeBadge-H5dEqeHi.js","./RolesPage-DN6yqH7-.js","./RoleDetailPage-axZtFPC_.js","./AutoGrowTextarea-DgEQeRQw.js","./PersonasPage-BbLOHq5X.js","./PersonaDetailPage-C33MgXUY.js","./EscalationSchemaPage-DFgDn4R3.js","./EscalationListSchemaPage-DQNQ7o_4.js","./ScanCodesPage-BmQjEyWZ.js","./ScanSchemeDetailPage-VODehqGs.js","./ScanStationPage-Y-9Gs7t5.js","./index-CGCD5hTX.js","./OperationsPage-BSl_oUAJ.js","./index-D3iDAWK2.js","./index-Dsgqxdyh.js","./CredentialsPage-CGyCCzGh.js","./index-DuhqzYwC.js","./DropZone-DovkhN2p.js","./index-CkkOh8y9.js","./knowledge-DAV1Jy7b.js","./HomePage-p_CYlGnh.js","./AgentsPage-CRFZ6KDu.js","./agents-MeqzOPD6.js","./AgentDetailPage-CIbKor5E.js","./CronLabel-CAu2hmQf.js","./AgentConfigPage-Bi5ZAsjf.js","./capabilities-BjlARR7F.js","./topics-2IGhZXBi.js","./CapabilitiesPage-Ca2jEln-.js","./TopicsPage-BoVkp7DM.js","./TopicDetailPage-fOnTfDso.js"])))=>i.map(i=>d[i]);
2
+ var W_=Object.defineProperty;var ew=(i,t,r)=>t in i?W_(i,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):i[t]=r;var A=(i,t,r)=>ew(i,typeof t!="symbol"?t+"":t,r);import{r as tw,u as ft,a as j,j as g,b as ht,c as Et,g as nw,Q as rw,d as iw}from"./vendor-query-RUZdMvN6.js";import{r as sw,u as go,a as gn,L as Ii,N as Hs,b as ib,c as In,O as Ls,d as aw,R as ow}from"./vendor-react-CdqEC2zv.js";import{X as dn,E as lw,S as cw,a as ou,M as uw,C as sb,b as Xh,I as Jh,R as ab,B as ob,U as fw,c as hw,L as dw,d as mw,Z as pw,P as zg,e as lb,f as gw,g as Ug,h as Pg,i as Ig,j as yw,W as Ed,k as bw,l as vw,F as xw,m as _w,n as ww,D as Sw,N as Ew,o as Ow,p as Aw,q as cb,r as ub,s as fb,t as hb,u as jw,v as Tw,w as Nw,G as kw,T as Cw,x as Mw,y as Rw,z as Dw}from"./vendor-icons-BPsNpK3Y.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))s(l);new MutationObserver(l=>{for(const c of l)if(c.type==="childList")for(const d of c.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&s(d)}).observe(document,{childList:!0,subtree:!0});function r(l){const c={};return l.integrity&&(c.integrity=l.integrity),l.referrerPolicy&&(c.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?c.credentials="include":l.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function s(l){if(l.ep)return;l.ep=!0;const c=r(l);fetch(l.href,c)}})();var kh={exports:{}},Ga={},Ch={exports:{}},Mh={};/**
3
3
  * @license React
4
4
  * scheduler.production.js
5
5
  *
@@ -7,7 +7,7 @@ var X_=Object.defineProperty;var J_=(i,t,r)=>t in i?X_(i,t,{enumerable:!0,config
7
7
  *
8
8
  * This source code is licensed under the MIT license found in the
9
9
  * LICENSE file in the root directory of this source tree.
10
- */var $g;function Rw(){return $g||($g=1,(function(i){function t(Y,ae){var de=Y.length;Y.push(ae);e:for(;0<de;){var Oe=de-1>>>1,oe=Y[Oe];if(0<l(oe,ae))Y[Oe]=ae,Y[de]=oe,de=Oe;else break e}}function r(Y){return Y.length===0?null:Y[0]}function s(Y){if(Y.length===0)return null;var ae=Y[0],de=Y.pop();if(de!==ae){Y[0]=de;e:for(var Oe=0,oe=Y.length,je=oe>>>1;Oe<je;){var Se=2*(Oe+1)-1,Ne=Y[Se],be=Se+1,at=Y[be];if(0>l(Ne,de))be<oe&&0>l(at,Ne)?(Y[Oe]=at,Y[be]=de,Oe=be):(Y[Oe]=Ne,Y[Se]=de,Oe=Se);else if(be<oe&&0>l(at,de))Y[Oe]=at,Y[be]=de,Oe=be;else break e}}return ae}function l(Y,ae){var de=Y.sortIndex-ae.sortIndex;return de!==0?de:Y.id-ae.id}if(i.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;i.unstable_now=function(){return c.now()}}else{var d=Date,p=d.now();i.unstable_now=function(){return d.now()-p}}var g=[],f=[],m=1,b=null,v=3,_=!1,w=!1,S=!1,M=!1,B=typeof setTimeout=="function"?setTimeout:null,U=typeof clearTimeout=="function"?clearTimeout:null,ie=typeof setImmediate<"u"?setImmediate:null;function ce(Y){for(var ae=r(f);ae!==null;){if(ae.callback===null)s(f);else if(ae.startTime<=Y)s(f),ae.sortIndex=ae.expirationTime,t(g,ae);else break;ae=r(f)}}function C(Y){if(S=!1,ce(Y),!w)if(r(g)!==null)w=!0,z||(z=!0,Q());else{var ae=r(f);ae!==null&&Te(C,ae.startTime-Y)}}var z=!1,re=-1,X=5,L=-1;function G(){return M?!0:!(i.unstable_now()-L<X)}function W(){if(M=!1,z){var Y=i.unstable_now();L=Y;var ae=!0;try{e:{w=!1,S&&(S=!1,U(re),re=-1),_=!0;var de=v;try{t:{for(ce(Y),b=r(g);b!==null&&!(b.expirationTime>Y&&G());){var Oe=b.callback;if(typeof Oe=="function"){b.callback=null,v=b.priorityLevel;var oe=Oe(b.expirationTime<=Y);if(Y=i.unstable_now(),typeof oe=="function"){b.callback=oe,ce(Y),ae=!0;break t}b===r(g)&&s(g),ce(Y)}else s(g);b=r(g)}if(b!==null)ae=!0;else{var je=r(f);je!==null&&Te(C,je.startTime-Y),ae=!1}}break e}finally{b=null,v=de,_=!1}ae=void 0}}finally{ae?Q():z=!1}}}var Q;if(typeof ie=="function")Q=function(){ie(W)};else if(typeof MessageChannel<"u"){var he=new MessageChannel,_e=he.port2;he.port1.onmessage=W,Q=function(){_e.postMessage(null)}}else Q=function(){B(W,0)};function Te(Y,ae){re=B(function(){Y(i.unstable_now())},ae)}i.unstable_IdlePriority=5,i.unstable_ImmediatePriority=1,i.unstable_LowPriority=4,i.unstable_NormalPriority=3,i.unstable_Profiling=null,i.unstable_UserBlockingPriority=2,i.unstable_cancelCallback=function(Y){Y.callback=null},i.unstable_forceFrameRate=function(Y){0>Y||125<Y?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):X=0<Y?Math.floor(1e3/Y):5},i.unstable_getCurrentPriorityLevel=function(){return v},i.unstable_next=function(Y){switch(v){case 1:case 2:case 3:var ae=3;break;default:ae=v}var de=v;v=ae;try{return Y()}finally{v=de}},i.unstable_requestPaint=function(){M=!0},i.unstable_runWithPriority=function(Y,ae){switch(Y){case 1:case 2:case 3:case 4:case 5:break;default:Y=3}var de=v;v=Y;try{return ae()}finally{v=de}},i.unstable_scheduleCallback=function(Y,ae,de){var Oe=i.unstable_now();switch(typeof de=="object"&&de!==null?(de=de.delay,de=typeof de=="number"&&0<de?Oe+de:Oe):de=Oe,Y){case 1:var oe=-1;break;case 2:oe=250;break;case 5:oe=1073741823;break;case 4:oe=1e4;break;default:oe=5e3}return oe=de+oe,Y={id:m++,callback:ae,priorityLevel:Y,startTime:de,expirationTime:oe,sortIndex:-1},de>Oe?(Y.sortIndex=de,t(f,Y),r(g)===null&&Y===r(f)&&(S?(U(re),re=-1):S=!0,Te(C,de-Oe))):(Y.sortIndex=oe,t(g,Y),w||_||(w=!0,z||(z=!0,Q()))),Y},i.unstable_shouldYield=G,i.unstable_wrapCallback=function(Y){var ae=v;return function(){var de=v;v=ae;try{return Y.apply(this,arguments)}finally{v=de}}}})(Ch)),Ch}var Hg;function Dw(){return Hg||(Hg=1,kh.exports=Rw()),kh.exports}/**
10
+ */var $g;function qw(){return $g||($g=1,(function(i){function t(Y,ae){var de=Y.length;Y.push(ae);e:for(;0<de;){var Ae=de-1>>>1,oe=Y[Ae];if(0<l(oe,ae))Y[Ae]=ae,Y[de]=oe,de=Ae;else break e}}function r(Y){return Y.length===0?null:Y[0]}function s(Y){if(Y.length===0)return null;var ae=Y[0],de=Y.pop();if(de!==ae){Y[0]=de;e:for(var Ae=0,oe=Y.length,je=oe>>>1;Ae<je;){var Se=2*(Ae+1)-1,Ne=Y[Se],be=Se+1,at=Y[be];if(0>l(Ne,de))be<oe&&0>l(at,Ne)?(Y[Ae]=at,Y[be]=de,Ae=be):(Y[Ae]=Ne,Y[Se]=de,Ae=Se);else if(be<oe&&0>l(at,de))Y[Ae]=at,Y[be]=de,Ae=be;else break e}}return ae}function l(Y,ae){var de=Y.sortIndex-ae.sortIndex;return de!==0?de:Y.id-ae.id}if(i.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;i.unstable_now=function(){return c.now()}}else{var d=Date,p=d.now();i.unstable_now=function(){return d.now()-p}}var y=[],f=[],m=1,b=null,v=3,_=!1,w=!1,S=!1,M=!1,B=typeof setTimeout=="function"?setTimeout:null,U=typeof clearTimeout=="function"?clearTimeout:null,ie=typeof setImmediate<"u"?setImmediate:null;function ce(Y){for(var ae=r(f);ae!==null;){if(ae.callback===null)s(f);else if(ae.startTime<=Y)s(f),ae.sortIndex=ae.expirationTime,t(y,ae);else break;ae=r(f)}}function C(Y){if(S=!1,ce(Y),!w)if(r(y)!==null)w=!0,z||(z=!0,Q());else{var ae=r(f);ae!==null&&Te(C,ae.startTime-Y)}}var z=!1,re=-1,X=5,L=-1;function G(){return M?!0:!(i.unstable_now()-L<X)}function W(){if(M=!1,z){var Y=i.unstable_now();L=Y;var ae=!0;try{e:{w=!1,S&&(S=!1,U(re),re=-1),_=!0;var de=v;try{t:{for(ce(Y),b=r(y);b!==null&&!(b.expirationTime>Y&&G());){var Ae=b.callback;if(typeof Ae=="function"){b.callback=null,v=b.priorityLevel;var oe=Ae(b.expirationTime<=Y);if(Y=i.unstable_now(),typeof oe=="function"){b.callback=oe,ce(Y),ae=!0;break t}b===r(y)&&s(y),ce(Y)}else s(y);b=r(y)}if(b!==null)ae=!0;else{var je=r(f);je!==null&&Te(C,je.startTime-Y),ae=!1}}break e}finally{b=null,v=de,_=!1}ae=void 0}}finally{ae?Q():z=!1}}}var Q;if(typeof ie=="function")Q=function(){ie(W)};else if(typeof MessageChannel<"u"){var he=new MessageChannel,_e=he.port2;he.port1.onmessage=W,Q=function(){_e.postMessage(null)}}else Q=function(){B(W,0)};function Te(Y,ae){re=B(function(){Y(i.unstable_now())},ae)}i.unstable_IdlePriority=5,i.unstable_ImmediatePriority=1,i.unstable_LowPriority=4,i.unstable_NormalPriority=3,i.unstable_Profiling=null,i.unstable_UserBlockingPriority=2,i.unstable_cancelCallback=function(Y){Y.callback=null},i.unstable_forceFrameRate=function(Y){0>Y||125<Y?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):X=0<Y?Math.floor(1e3/Y):5},i.unstable_getCurrentPriorityLevel=function(){return v},i.unstable_next=function(Y){switch(v){case 1:case 2:case 3:var ae=3;break;default:ae=v}var de=v;v=ae;try{return Y()}finally{v=de}},i.unstable_requestPaint=function(){M=!0},i.unstable_runWithPriority=function(Y,ae){switch(Y){case 1:case 2:case 3:case 4:case 5:break;default:Y=3}var de=v;v=Y;try{return ae()}finally{v=de}},i.unstable_scheduleCallback=function(Y,ae,de){var Ae=i.unstable_now();switch(typeof de=="object"&&de!==null?(de=de.delay,de=typeof de=="number"&&0<de?Ae+de:Ae):de=Ae,Y){case 1:var oe=-1;break;case 2:oe=250;break;case 5:oe=1073741823;break;case 4:oe=1e4;break;default:oe=5e3}return oe=de+oe,Y={id:m++,callback:ae,priorityLevel:Y,startTime:de,expirationTime:oe,sortIndex:-1},de>Ae?(Y.sortIndex=de,t(f,Y),r(y)===null&&Y===r(f)&&(S?(U(re),re=-1):S=!0,Te(C,de-Ae))):(Y.sortIndex=oe,t(y,Y),w||_||(w=!0,z||(z=!0,Q()))),Y},i.unstable_shouldYield=G,i.unstable_wrapCallback=function(Y){var ae=v;return function(){var de=v;v=ae;try{return Y.apply(this,arguments)}finally{v=de}}}})(Mh)),Mh}var Hg;function Bw(){return Hg||(Hg=1,Ch.exports=qw()),Ch.exports}/**
11
11
  * @license React
12
12
  * react-dom-client.production.js
13
13
  *
@@ -15,51 +15,52 @@ var X_=Object.defineProperty;var J_=(i,t,r)=>t in i?X_(i,t,{enumerable:!0,config
15
15
  *
16
16
  * This source code is licensed under the MIT license found in the
17
17
  * LICENSE file in the root directory of this source tree.
18
- */var Gg;function qw(){if(Gg)return Ga;Gg=1;var i=Dw(),t=Q_(),r=tw();function s(e){var n="https://react.dev/errors/"+e;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)n+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+e+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function c(e){var n=e,a=e;if(e.alternate)for(;n.return;)n=n.return;else{e=n;do n=e,(n.flags&4098)!==0&&(a=n.return),e=n.return;while(e)}return n.tag===3?a:null}function d(e){if(e.tag===13){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function p(e){if(e.tag===31){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function g(e){if(c(e)!==e)throw Error(s(188))}function f(e){var n=e.alternate;if(!n){if(n=c(e),n===null)throw Error(s(188));return n!==e?null:e}for(var a=e,o=n;;){var u=a.return;if(u===null)break;var h=u.alternate;if(h===null){if(o=u.return,o!==null){a=o;continue}break}if(u.child===h.child){for(h=u.child;h;){if(h===a)return g(u),e;if(h===o)return g(u),n;h=h.sibling}throw Error(s(188))}if(a.return!==o.return)a=u,o=h;else{for(var x=!1,E=u.child;E;){if(E===a){x=!0,a=u,o=h;break}if(E===o){x=!0,o=u,a=h;break}E=E.sibling}if(!x){for(E=h.child;E;){if(E===a){x=!0,a=h,o=u;break}if(E===o){x=!0,o=h,a=u;break}E=E.sibling}if(!x)throw Error(s(189))}}if(a.alternate!==o)throw Error(s(190))}if(a.tag!==3)throw Error(s(188));return a.stateNode.current===a?e:n}function m(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e;for(e=e.child;e!==null;){if(n=m(e),n!==null)return n;e=e.sibling}return null}var b=Object.assign,v=Symbol.for("react.element"),_=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),M=Symbol.for("react.strict_mode"),B=Symbol.for("react.profiler"),U=Symbol.for("react.consumer"),ie=Symbol.for("react.context"),ce=Symbol.for("react.forward_ref"),C=Symbol.for("react.suspense"),z=Symbol.for("react.suspense_list"),re=Symbol.for("react.memo"),X=Symbol.for("react.lazy"),L=Symbol.for("react.activity"),G=Symbol.for("react.memo_cache_sentinel"),W=Symbol.iterator;function Q(e){return e===null||typeof e!="object"?null:(e=W&&e[W]||e["@@iterator"],typeof e=="function"?e:null)}var he=Symbol.for("react.client.reference");function _e(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===he?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case S:return"Fragment";case B:return"Profiler";case M:return"StrictMode";case C:return"Suspense";case z:return"SuspenseList";case L:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case w:return"Portal";case ie:return e.displayName||"Context";case U:return(e._context.displayName||"Context")+".Consumer";case ce:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case re:return n=e.displayName||null,n!==null?n:_e(e.type)||"Memo";case X:n=e._payload,e=e._init;try{return _e(e(n))}catch{}}return null}var Te=Array.isArray,Y=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ae=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,de={pending:!1,data:null,method:null,action:null},Oe=[],oe=-1;function je(e){return{current:e}}function Se(e){0>oe||(e.current=Oe[oe],Oe[oe]=null,oe--)}function Ne(e,n){oe++,Oe[oe]=e.current,e.current=n}var be=je(null),at=je(null),Ht=je(null),Rt=je(null);function Dt(e,n){switch(Ne(Ht,n),Ne(at,e),Ne(be,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?og(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=og(n),e=lg(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Se(be),Ne(be,e)}function ke(){Se(be),Se(at),Se(Ht)}function qt(e){e.memoizedState!==null&&Ne(Rt,e);var n=be.current,a=lg(n,e.type);n!==a&&(Ne(at,e),Ne(be,a))}function di(e){at.current===e&&(Se(be),Se(at)),Rt.current===e&&(Se(Rt),Pa._currentValue=de)}var Gi,mi;function yn(e){if(Gi===void 0)try{throw Error()}catch(a){var n=a.stack.trim().match(/\n( *(at )?)/);Gi=n&&n[1]||"",mi=-1<a.stack.indexOf(`
18
+ */var Gg;function Lw(){if(Gg)return Ga;Gg=1;var i=Bw(),t=tw(),r=sw();function s(e){var n="https://react.dev/errors/"+e;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)n+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+e+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function c(e){var n=e,a=e;if(e.alternate)for(;n.return;)n=n.return;else{e=n;do n=e,(n.flags&4098)!==0&&(a=n.return),e=n.return;while(e)}return n.tag===3?a:null}function d(e){if(e.tag===13){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function p(e){if(e.tag===31){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function y(e){if(c(e)!==e)throw Error(s(188))}function f(e){var n=e.alternate;if(!n){if(n=c(e),n===null)throw Error(s(188));return n!==e?null:e}for(var a=e,o=n;;){var u=a.return;if(u===null)break;var h=u.alternate;if(h===null){if(o=u.return,o!==null){a=o;continue}break}if(u.child===h.child){for(h=u.child;h;){if(h===a)return y(u),e;if(h===o)return y(u),n;h=h.sibling}throw Error(s(188))}if(a.return!==o.return)a=u,o=h;else{for(var x=!1,E=u.child;E;){if(E===a){x=!0,a=u,o=h;break}if(E===o){x=!0,o=u,a=h;break}E=E.sibling}if(!x){for(E=h.child;E;){if(E===a){x=!0,a=h,o=u;break}if(E===o){x=!0,o=h,a=u;break}E=E.sibling}if(!x)throw Error(s(189))}}if(a.alternate!==o)throw Error(s(190))}if(a.tag!==3)throw Error(s(188));return a.stateNode.current===a?e:n}function m(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e;for(e=e.child;e!==null;){if(n=m(e),n!==null)return n;e=e.sibling}return null}var b=Object.assign,v=Symbol.for("react.element"),_=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),M=Symbol.for("react.strict_mode"),B=Symbol.for("react.profiler"),U=Symbol.for("react.consumer"),ie=Symbol.for("react.context"),ce=Symbol.for("react.forward_ref"),C=Symbol.for("react.suspense"),z=Symbol.for("react.suspense_list"),re=Symbol.for("react.memo"),X=Symbol.for("react.lazy"),L=Symbol.for("react.activity"),G=Symbol.for("react.memo_cache_sentinel"),W=Symbol.iterator;function Q(e){return e===null||typeof e!="object"?null:(e=W&&e[W]||e["@@iterator"],typeof e=="function"?e:null)}var he=Symbol.for("react.client.reference");function _e(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===he?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case S:return"Fragment";case B:return"Profiler";case M:return"StrictMode";case C:return"Suspense";case z:return"SuspenseList";case L:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case w:return"Portal";case ie:return e.displayName||"Context";case U:return(e._context.displayName||"Context")+".Consumer";case ce:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case re:return n=e.displayName||null,n!==null?n:_e(e.type)||"Memo";case X:n=e._payload,e=e._init;try{return _e(e(n))}catch{}}return null}var Te=Array.isArray,Y=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ae=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,de={pending:!1,data:null,method:null,action:null},Ae=[],oe=-1;function je(e){return{current:e}}function Se(e){0>oe||(e.current=Ae[oe],Ae[oe]=null,oe--)}function Ne(e,n){oe++,Ae[oe]=e.current,e.current=n}var be=je(null),at=je(null),Gt=je(null),Rt=je(null);function Dt(e,n){switch(Ne(Gt,n),Ne(at,e),Ne(be,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?og(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=og(n),e=lg(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Se(be),Ne(be,e)}function ke(){Se(be),Se(at),Se(Gt)}function qt(e){e.memoizedState!==null&&Ne(Rt,e);var n=be.current,a=lg(n,e.type);n!==a&&(Ne(at,e),Ne(be,a))}function di(e){at.current===e&&(Se(be),Se(at)),Rt.current===e&&(Se(Rt),Pa._currentValue=de)}var Gi,mi;function bn(e){if(Gi===void 0)try{throw Error()}catch(a){var n=a.stack.trim().match(/\n( *(at )?)/);Gi=n&&n[1]||"",mi=-1<a.stack.indexOf(`
19
19
  at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
20
20
  `+Gi+e+mi}var Fi=!1;function Ar(e,n){if(!e||Fi)return"";Fi=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var o={DetermineComponentFrameRoot:function(){try{if(n){var ne=function(){throw Error()};if(Object.defineProperty(ne.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ne,[])}catch(K){var F=K}Reflect.construct(e,[],ne)}else{try{ne.call()}catch(K){F=K}e.call(ne.prototype)}}else{try{throw Error()}catch(K){F=K}(ne=e())&&typeof ne.catch=="function"&&ne.catch(function(){})}}catch(K){if(K&&F&&typeof K.stack=="string")return[K.stack,F.stack]}return[null,null]}};o.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var u=Object.getOwnPropertyDescriptor(o.DetermineComponentFrameRoot,"name");u&&u.configurable&&Object.defineProperty(o.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var h=o.DetermineComponentFrameRoot(),x=h[0],E=h[1];if(x&&E){var R=x.split(`
21
21
  `),H=E.split(`
22
22
  `);for(u=o=0;o<R.length&&!R[o].includes("DetermineComponentFrameRoot");)o++;for(;u<H.length&&!H[u].includes("DetermineComponentFrameRoot");)u++;if(o===R.length||u===H.length)for(o=R.length-1,u=H.length-1;1<=o&&0<=u&&R[o]!==H[u];)u--;for(;1<=o&&0<=u;o--,u--)if(R[o]!==H[u]){if(o!==1||u!==1)do if(o--,u--,0>u||R[o]!==H[u]){var J=`
23
- `+R[o].replace(" at new "," at ");return e.displayName&&J.includes("<anonymous>")&&(J=J.replace("<anonymous>",e.displayName)),J}while(1<=o&&0<=u);break}}}finally{Fi=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?yn(a):""}function Eo(e,n){switch(e.tag){case 26:case 27:case 5:return yn(e.type);case 16:return yn("Lazy");case 13:return e.child!==n&&n!==null?yn("Suspense Fallback"):yn("Suspense");case 19:return yn("SuspenseList");case 0:case 15:return Ar(e.type,!1);case 11:return Ar(e.type.render,!1);case 1:return Ar(e.type,!0);case 31:return yn("Activity");default:return""}}function Oo(e){try{var n="",a=null;do n+=Eo(e,a),a=e,e=e.return;while(e);return n}catch(o){return`
23
+ `+R[o].replace(" at new "," at ");return e.displayName&&J.includes("<anonymous>")&&(J=J.replace("<anonymous>",e.displayName)),J}while(1<=o&&0<=u);break}}}finally{Fi=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?bn(a):""}function Eo(e,n){switch(e.tag){case 26:case 27:case 5:return bn(e.type);case 16:return bn("Lazy");case 13:return e.child!==n&&n!==null?bn("Suspense Fallback"):bn("Suspense");case 19:return bn("SuspenseList");case 0:case 15:return Ar(e.type,!1);case 11:return Ar(e.type.render,!1);case 1:return Ar(e.type,!0);case 31:return bn("Activity");default:return""}}function Oo(e){try{var n="",a=null;do n+=Eo(e,a),a=e,e=e.return;while(e);return n}catch(o){return`
24
24
  Error generating stack: `+o.message+`
25
- `+o.stack}}var Js=Object.prototype.hasOwnProperty,Qs=i.unstable_scheduleCallback,er=i.unstable_cancelCallback,Ao=i.unstable_shouldYield,Vi=i.unstable_requestPaint,nt=i.unstable_now,bu=i.unstable_getCurrentPriorityLevel,jo=i.unstable_ImmediatePriority,To=i.unstable_UserBlockingPriority,Yi=i.unstable_NormalPriority,vu=i.unstable_LowPriority,No=i.unstable_IdlePriority,xu=i.log,ko=i.unstable_setDisableYieldValue,pi=null,ft=null;function Qt(e){if(typeof xu=="function"&&ko(e),ft&&typeof ft.setStrictMode=="function")try{ft.setStrictMode(pi,e)}catch{}}var Bt=Math.clz32?Math.clz32:Ki,Zs=Math.log,Ws=Math.LN2;function Ki(e){return e>>>=0,e===0?32:31-(Zs(e)/Ws|0)|0}var jr=256,tr=262144,Tr=4194304;function Mn(e){var n=e&42;if(n!==0)return n;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function gi(e,n,a){var o=e.pendingLanes;if(o===0)return 0;var u=0,h=e.suspendedLanes,x=e.pingedLanes;e=e.warmLanes;var E=o&134217727;return E!==0?(o=E&~h,o!==0?u=Mn(o):(x&=E,x!==0?u=Mn(x):a||(a=E&~e,a!==0&&(u=Mn(a))))):(E=o&~h,E!==0?u=Mn(E):x!==0?u=Mn(x):a||(a=o&~e,a!==0&&(u=Mn(a)))),u===0?0:n!==0&&n!==u&&(n&h)===0&&(h=u&-u,a=n&-n,h>=a||h===32&&(a&4194048)!==0)?n:u}function yi(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)===0}function ea(e,n){switch(e){case 1:case 2:case 4:case 8:case 64:return n+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Xi(){var e=Tr;return Tr<<=1,(Tr&62914560)===0&&(Tr=4194304),e}function Nr(e){for(var n=[],a=0;31>a;a++)n.push(e);return n}function Rn(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function kr(e,n,a,o,u,h){var x=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var E=e.entanglements,R=e.expirationTimes,H=e.hiddenUpdates;for(a=x&~a;0<a;){var J=31-Bt(a),ne=1<<J;E[J]=0,R[J]=-1;var F=H[J];if(F!==null)for(H[J]=null,J=0;J<F.length;J++){var K=F[J];K!==null&&(K.lane&=-536870913)}a&=~ne}o!==0&&Cr(e,o,0),h!==0&&u===0&&e.tag!==0&&(e.suspendedLanes|=h&~(x&~n))}function Cr(e,n,a){e.pendingLanes|=n,e.suspendedLanes&=~n;var o=31-Bt(n);e.entangledLanes|=n,e.entanglements[o]=e.entanglements[o]|1073741824|a&261930}function bi(e,n){var a=e.entangledLanes|=n;for(e=e.entanglements;a;){var o=31-Bt(a),u=1<<o;u&n|e[o]&n&&(e[o]|=n),a&=~u}}function Mr(e,n){var a=n&-n;return a=(a&42)!==0?1:nr(a),(a&(e.suspendedLanes|n))!==0?0:a}function nr(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function vi(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function ta(){var e=ae.p;return e!==0?e:(e=window.event,e===void 0?32:Cg(e.type))}function Co(e,n){var a=ae.p;try{return ae.p=e,n()}finally{ae.p=a}}var Gn=Math.random().toString(36).slice(2),Qe="__reactFiber$"+Gn,ot="__reactProps$"+Gn,Zt="__reactContainer$"+Gn,xi="__reactEvents$"+Gn,na="__reactListeners$"+Gn,Mo="__reactHandles$"+Gn,Ro="__reactResources$"+Gn,wt="__reactMarker$"+Gn;function Ji(e){delete e[Qe],delete e[ot],delete e[xi],delete e[na],delete e[Mo]}function O(e){var n=e[Qe];if(n)return n;for(var a=e.parentNode;a;){if(n=a[Zt]||a[Qe]){if(a=n.alternate,n.child!==null||a!==null&&a.child!==null)for(e=pg(e);e!==null;){if(a=e[Qe])return a;e=pg(e)}return n}e=a,a=e.parentNode}return null}function N(e){if(e=e[Qe]||e[Zt]){var n=e.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return e}return null}function T(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e.stateNode;throw Error(s(33))}function k(e){var n=e[Ro];return n||(n=e[Ro]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function D(e){e[wt]=!0}var I=new Set,te={};function se(e,n){V(e,n),V(e+"Capture",n)}function V(e,n){for(te[e]=n,e=0;e<n.length;e++)I.add(n[e])}var ee=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),pe={},Re={};function We(e){return Js.call(Re,e)?!0:Js.call(pe,e)?!1:ee.test(e)?Re[e]=!0:(pe[e]=!0,!1)}function Lt(e,n,a){if(We(n))if(a===null)e.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":e.removeAttribute(n);return;case"boolean":var o=n.toLowerCase().slice(0,5);if(o!=="data-"&&o!=="aria-"){e.removeAttribute(n);return}}e.setAttribute(n,""+a)}}function Dn(e,n,a){if(a===null)e.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttribute(n,""+a)}}function rr(e,n,a,o){if(o===null)e.removeAttribute(a);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttributeNS(n,a,""+o)}}function bn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Wd(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function $v(e,n,a){var o=Object.getOwnPropertyDescriptor(e.constructor.prototype,n);if(!e.hasOwnProperty(n)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var u=o.get,h=o.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return u.call(this)},set:function(x){a=""+x,h.call(this,x)}}),Object.defineProperty(e,n,{enumerable:o.enumerable}),{getValue:function(){return a},setValue:function(x){a=""+x},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function _u(e){if(!e._valueTracker){var n=Wd(e)?"checked":"value";e._valueTracker=$v(e,n,""+e[n])}}function em(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var a=n.getValue(),o="";return e&&(o=Wd(e)?e.checked?"true":"false":e.value),e=o,e!==a?(n.setValue(e),!0):!1}function Do(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var Hv=/[\n"\\]/g;function vn(e){return e.replace(Hv,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function wu(e,n,a,o,u,h,x,E){e.name="",x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"?e.type=x:e.removeAttribute("type"),n!=null?x==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+bn(n)):e.value!==""+bn(n)&&(e.value=""+bn(n)):x!=="submit"&&x!=="reset"||e.removeAttribute("value"),n!=null?Su(e,x,bn(n)):a!=null?Su(e,x,bn(a)):o!=null&&e.removeAttribute("value"),u==null&&h!=null&&(e.defaultChecked=!!h),u!=null&&(e.checked=u&&typeof u!="function"&&typeof u!="symbol"),E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"?e.name=""+bn(E):e.removeAttribute("name")}function tm(e,n,a,o,u,h,x,E){if(h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"&&(e.type=h),n!=null||a!=null){if(!(h!=="submit"&&h!=="reset"||n!=null)){_u(e);return}a=a!=null?""+bn(a):"",n=n!=null?""+bn(n):a,E||n===e.value||(e.value=n),e.defaultValue=n}o=o??u,o=typeof o!="function"&&typeof o!="symbol"&&!!o,e.checked=E?e.checked:!!o,e.defaultChecked=!!o,x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(e.name=x),_u(e)}function Su(e,n,a){n==="number"&&Do(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function Qi(e,n,a,o){if(e=e.options,n){n={};for(var u=0;u<a.length;u++)n["$"+a[u]]=!0;for(a=0;a<e.length;a++)u=n.hasOwnProperty("$"+e[a].value),e[a].selected!==u&&(e[a].selected=u),u&&o&&(e[a].defaultSelected=!0)}else{for(a=""+bn(a),n=null,u=0;u<e.length;u++){if(e[u].value===a){e[u].selected=!0,o&&(e[u].defaultSelected=!0);return}n!==null||e[u].disabled||(n=e[u])}n!==null&&(n.selected=!0)}}function nm(e,n,a){if(n!=null&&(n=""+bn(n),n!==e.value&&(e.value=n),a==null)){e.defaultValue!==n&&(e.defaultValue=n);return}e.defaultValue=a!=null?""+bn(a):""}function rm(e,n,a,o){if(n==null){if(o!=null){if(a!=null)throw Error(s(92));if(Te(o)){if(1<o.length)throw Error(s(93));o=o[0]}a=o}a==null&&(a=""),n=a}a=bn(n),e.defaultValue=a,o=e.textContent,o===a&&o!==""&&o!==null&&(e.value=o),_u(e)}function Zi(e,n){if(n){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=n;return}}e.textContent=n}var Gv=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function im(e,n,a){var o=n.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?o?e.setProperty(n,""):n==="float"?e.cssFloat="":e[n]="":o?e.setProperty(n,a):typeof a!="number"||a===0||Gv.has(n)?n==="float"?e.cssFloat=a:e[n]=(""+a).trim():e[n]=a+"px"}function sm(e,n,a){if(n!=null&&typeof n!="object")throw Error(s(62));if(e=e.style,a!=null){for(var o in a)!a.hasOwnProperty(o)||n!=null&&n.hasOwnProperty(o)||(o.indexOf("--")===0?e.setProperty(o,""):o==="float"?e.cssFloat="":e[o]="");for(var u in n)o=n[u],n.hasOwnProperty(u)&&a[u]!==o&&im(e,u,o)}else for(var h in n)n.hasOwnProperty(h)&&im(e,h,n[h])}function Eu(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 Fv=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"]]),Vv=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function qo(e){return Vv.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function ir(){}var Ou=null;function Au(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Wi=null,es=null;function am(e){var n=N(e);if(n&&(e=n.stateNode)){var a=e[ot]||null;e:switch(e=n.stateNode,n.type){case"input":if(wu(e,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),n=a.name,a.type==="radio"&&n!=null){for(a=e;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+vn(""+n)+'"][type="radio"]'),n=0;n<a.length;n++){var o=a[n];if(o!==e&&o.form===e.form){var u=o[ot]||null;if(!u)throw Error(s(90));wu(o,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name)}}for(n=0;n<a.length;n++)o=a[n],o.form===e.form&&em(o)}break e;case"textarea":nm(e,a.value,a.defaultValue);break e;case"select":n=a.value,n!=null&&Qi(e,!!a.multiple,n,!1)}}}var ju=!1;function om(e,n,a){if(ju)return e(n,a);ju=!0;try{var o=e(n);return o}finally{if(ju=!1,(Wi!==null||es!==null)&&(wl(),Wi&&(n=Wi,e=es,es=Wi=null,am(n),e)))for(n=0;n<e.length;n++)am(e[n])}}function ra(e,n){var a=e.stateNode;if(a===null)return null;var o=a[ot]||null;if(o===null)return null;a=o[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(o=!o.disabled)||(e=e.type,o=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!o;break e;default:e=!1}if(e)return null;if(a&&typeof a!="function")throw Error(s(231,n,typeof a));return a}var sr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Tu=!1;if(sr)try{var ia={};Object.defineProperty(ia,"passive",{get:function(){Tu=!0}}),window.addEventListener("test",ia,ia),window.removeEventListener("test",ia,ia)}catch{Tu=!1}var Rr=null,Nu=null,Bo=null;function lm(){if(Bo)return Bo;var e,n=Nu,a=n.length,o,u="value"in Rr?Rr.value:Rr.textContent,h=u.length;for(e=0;e<a&&n[e]===u[e];e++);var x=a-e;for(o=1;o<=x&&n[a-o]===u[h-o];o++);return Bo=u.slice(e,1<o?1-o:void 0)}function Lo(e){var n=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&n===13&&(e=13)):e=n,e===10&&(e=13),32<=e||e===13?e:0}function zo(){return!0}function cm(){return!1}function Gt(e){function n(a,o,u,h,x){this._reactName=a,this._targetInst=u,this.type=o,this.nativeEvent=h,this.target=x,this.currentTarget=null;for(var E in e)e.hasOwnProperty(E)&&(a=e[E],this[E]=a?a(h):h[E]);return this.isDefaultPrevented=(h.defaultPrevented!=null?h.defaultPrevented:h.returnValue===!1)?zo:cm,this.isPropagationStopped=cm,this}return b(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=zo)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=zo)},persist:function(){},isPersistent:zo}),n}var _i={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Uo=Gt(_i),sa=b({},_i,{view:0,detail:0}),Yv=Gt(sa),ku,Cu,aa,Po=b({},sa,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ru,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==aa&&(aa&&e.type==="mousemove"?(ku=e.screenX-aa.screenX,Cu=e.screenY-aa.screenY):Cu=ku=0,aa=e),ku)},movementY:function(e){return"movementY"in e?e.movementY:Cu}}),um=Gt(Po),Kv=b({},Po,{dataTransfer:0}),Xv=Gt(Kv),Jv=b({},sa,{relatedTarget:0}),Mu=Gt(Jv),Qv=b({},_i,{animationName:0,elapsedTime:0,pseudoElement:0}),Zv=Gt(Qv),Wv=b({},_i,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),ex=Gt(Wv),tx=b({},_i,{data:0}),fm=Gt(tx),nx={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},rx={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"},ix={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function sx(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=ix[e])?!!n[e]:!1}function Ru(){return sx}var ax=b({},sa,{key:function(e){if(e.key){var n=nx[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=Lo(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?rx[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ru,charCode:function(e){return e.type==="keypress"?Lo(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Lo(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),ox=Gt(ax),lx=b({},Po,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),hm=Gt(lx),cx=b({},sa,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ru}),ux=Gt(cx),fx=b({},_i,{propertyName:0,elapsedTime:0,pseudoElement:0}),hx=Gt(fx),dx=b({},Po,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),mx=Gt(dx),px=b({},_i,{newState:0,oldState:0}),gx=Gt(px),yx=[9,13,27,32],Du=sr&&"CompositionEvent"in window,oa=null;sr&&"documentMode"in document&&(oa=document.documentMode);var bx=sr&&"TextEvent"in window&&!oa,dm=sr&&(!Du||oa&&8<oa&&11>=oa),mm=" ",pm=!1;function gm(e,n){switch(e){case"keyup":return yx.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ym(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ts=!1;function vx(e,n){switch(e){case"compositionend":return ym(n);case"keypress":return n.which!==32?null:(pm=!0,mm);case"textInput":return e=n.data,e===mm&&pm?null:e;default:return null}}function xx(e,n){if(ts)return e==="compositionend"||!Du&&gm(e,n)?(e=lm(),Bo=Nu=Rr=null,ts=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return dm&&n.locale!=="ko"?null:n.data;default:return null}}var _x={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function bm(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n==="input"?!!_x[e.type]:n==="textarea"}function vm(e,n,a,o){Wi?es?es.push(o):es=[o]:Wi=o,n=Nl(n,"onChange"),0<n.length&&(a=new Uo("onChange","change",null,a,o),e.push({event:a,listeners:n}))}var la=null,ca=null;function wx(e){tg(e,0)}function Io(e){var n=T(e);if(em(n))return e}function xm(e,n){if(e==="change")return n}var _m=!1;if(sr){var qu;if(sr){var Bu="oninput"in document;if(!Bu){var wm=document.createElement("div");wm.setAttribute("oninput","return;"),Bu=typeof wm.oninput=="function"}qu=Bu}else qu=!1;_m=qu&&(!document.documentMode||9<document.documentMode)}function Sm(){la&&(la.detachEvent("onpropertychange",Em),ca=la=null)}function Em(e){if(e.propertyName==="value"&&Io(ca)){var n=[];vm(n,ca,e,Au(e)),om(wx,n)}}function Sx(e,n,a){e==="focusin"?(Sm(),la=n,ca=a,la.attachEvent("onpropertychange",Em)):e==="focusout"&&Sm()}function Ex(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Io(ca)}function Ox(e,n){if(e==="click")return Io(n)}function Ax(e,n){if(e==="input"||e==="change")return Io(n)}function jx(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var Wt=typeof Object.is=="function"?Object.is:jx;function ua(e,n){if(Wt(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;var a=Object.keys(e),o=Object.keys(n);if(a.length!==o.length)return!1;for(o=0;o<a.length;o++){var u=a[o];if(!Js.call(n,u)||!Wt(e[u],n[u]))return!1}return!0}function Om(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Am(e,n){var a=Om(e);e=0;for(var o;a;){if(a.nodeType===3){if(o=e+a.textContent.length,e<=n&&o>=n)return{node:a,offset:n-e};e=o}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Om(a)}}function jm(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?jm(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function Tm(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=Do(e.document);n instanceof e.HTMLIFrameElement;){try{var a=typeof n.contentWindow.location.href=="string"}catch{a=!1}if(a)e=n.contentWindow;else break;n=Do(e.document)}return n}function Lu(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}var Tx=sr&&"documentMode"in document&&11>=document.documentMode,ns=null,zu=null,fa=null,Uu=!1;function Nm(e,n,a){var o=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Uu||ns==null||ns!==Do(o)||(o=ns,"selectionStart"in o&&Lu(o)?o={start:o.selectionStart,end:o.selectionEnd}:(o=(o.ownerDocument&&o.ownerDocument.defaultView||window).getSelection(),o={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}),fa&&ua(fa,o)||(fa=o,o=Nl(zu,"onSelect"),0<o.length&&(n=new Uo("onSelect","select",null,n,a),e.push({event:n,listeners:o}),n.target=ns)))}function wi(e,n){var a={};return a[e.toLowerCase()]=n.toLowerCase(),a["Webkit"+e]="webkit"+n,a["Moz"+e]="moz"+n,a}var rs={animationend:wi("Animation","AnimationEnd"),animationiteration:wi("Animation","AnimationIteration"),animationstart:wi("Animation","AnimationStart"),transitionrun:wi("Transition","TransitionRun"),transitionstart:wi("Transition","TransitionStart"),transitioncancel:wi("Transition","TransitionCancel"),transitionend:wi("Transition","TransitionEnd")},Pu={},km={};sr&&(km=document.createElement("div").style,"AnimationEvent"in window||(delete rs.animationend.animation,delete rs.animationiteration.animation,delete rs.animationstart.animation),"TransitionEvent"in window||delete rs.transitionend.transition);function Si(e){if(Pu[e])return Pu[e];if(!rs[e])return e;var n=rs[e],a;for(a in n)if(n.hasOwnProperty(a)&&a in km)return Pu[e]=n[a];return e}var Cm=Si("animationend"),Mm=Si("animationiteration"),Rm=Si("animationstart"),Nx=Si("transitionrun"),kx=Si("transitionstart"),Cx=Si("transitioncancel"),Dm=Si("transitionend"),qm=new Map,Iu="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(" ");Iu.push("scrollEnd");function qn(e,n){qm.set(e,n),se(n,[e])}var $o=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},xn=[],is=0,$u=0;function Ho(){for(var e=is,n=$u=is=0;n<e;){var a=xn[n];xn[n++]=null;var o=xn[n];xn[n++]=null;var u=xn[n];xn[n++]=null;var h=xn[n];if(xn[n++]=null,o!==null&&u!==null){var x=o.pending;x===null?u.next=u:(u.next=x.next,x.next=u),o.pending=u}h!==0&&Bm(a,u,h)}}function Go(e,n,a,o){xn[is++]=e,xn[is++]=n,xn[is++]=a,xn[is++]=o,$u|=o,e.lanes|=o,e=e.alternate,e!==null&&(e.lanes|=o)}function Hu(e,n,a,o){return Go(e,n,a,o),Fo(e)}function Ei(e,n){return Go(e,null,null,n),Fo(e)}function Bm(e,n,a){e.lanes|=a;var o=e.alternate;o!==null&&(o.lanes|=a);for(var u=!1,h=e.return;h!==null;)h.childLanes|=a,o=h.alternate,o!==null&&(o.childLanes|=a),h.tag===22&&(e=h.stateNode,e===null||e._visibility&1||(u=!0)),e=h,h=h.return;return e.tag===3?(h=e.stateNode,u&&n!==null&&(u=31-Bt(a),e=h.hiddenUpdates,o=e[u],o===null?e[u]=[n]:o.push(n),n.lane=a|536870912),h):null}function Fo(e){if(50<Ra)throw Ra=0,Wf=null,Error(s(185));for(var n=e.return;n!==null;)e=n,n=e.return;return e.tag===3?e.stateNode:null}var ss={};function Mx(e,n,a,o){this.tag=e,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=o,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function en(e,n,a,o){return new Mx(e,n,a,o)}function Gu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ar(e,n){var a=e.alternate;return a===null?(a=en(e.tag,n,e.key,e.mode),a.elementType=e.elementType,a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=n,a.type=e.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=e.flags&65011712,a.childLanes=e.childLanes,a.lanes=e.lanes,a.child=e.child,a.memoizedProps=e.memoizedProps,a.memoizedState=e.memoizedState,a.updateQueue=e.updateQueue,n=e.dependencies,a.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a.refCleanup=e.refCleanup,a}function Lm(e,n){e.flags&=65011714;var a=e.alternate;return a===null?(e.childLanes=0,e.lanes=n,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=a.childLanes,e.lanes=a.lanes,e.child=a.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=a.memoizedProps,e.memoizedState=a.memoizedState,e.updateQueue=a.updateQueue,e.type=a.type,n=a.dependencies,e.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),e}function Vo(e,n,a,o,u,h){var x=0;if(o=e,typeof e=="function")Gu(e)&&(x=1);else if(typeof e=="string")x=L_(e,a,be.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case L:return e=en(31,a,n,u),e.elementType=L,e.lanes=h,e;case S:return Oi(a.children,u,h,n);case M:x=8,u|=24;break;case B:return e=en(12,a,n,u|2),e.elementType=B,e.lanes=h,e;case C:return e=en(13,a,n,u),e.elementType=C,e.lanes=h,e;case z:return e=en(19,a,n,u),e.elementType=z,e.lanes=h,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case ie:x=10;break e;case U:x=9;break e;case ce:x=11;break e;case re:x=14;break e;case X:x=16,o=null;break e}x=29,a=Error(s(130,e===null?"null":typeof e,"")),o=null}return n=en(x,a,n,u),n.elementType=e,n.type=o,n.lanes=h,n}function Oi(e,n,a,o){return e=en(7,e,o,n),e.lanes=a,e}function Fu(e,n,a){return e=en(6,e,null,n),e.lanes=a,e}function zm(e){var n=en(18,null,null,0);return n.stateNode=e,n}function Vu(e,n,a){return n=en(4,e.children!==null?e.children:[],e.key,n),n.lanes=a,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}var Um=new WeakMap;function _n(e,n){if(typeof e=="object"&&e!==null){var a=Um.get(e);return a!==void 0?a:(n={value:e,source:n,stack:Oo(n)},Um.set(e,n),n)}return{value:e,source:n,stack:Oo(n)}}var as=[],os=0,Yo=null,ha=0,wn=[],Sn=0,Dr=null,Fn=1,Vn="";function or(e,n){as[os++]=ha,as[os++]=Yo,Yo=e,ha=n}function Pm(e,n,a){wn[Sn++]=Fn,wn[Sn++]=Vn,wn[Sn++]=Dr,Dr=e;var o=Fn;e=Vn;var u=32-Bt(o)-1;o&=~(1<<u),a+=1;var h=32-Bt(n)+u;if(30<h){var x=u-u%5;h=(o&(1<<x)-1).toString(32),o>>=x,u-=x,Fn=1<<32-Bt(n)+u|a<<u|o,Vn=h+e}else Fn=1<<h|a<<u|o,Vn=e}function Yu(e){e.return!==null&&(or(e,1),Pm(e,1,0))}function Ku(e){for(;e===Yo;)Yo=as[--os],as[os]=null,ha=as[--os],as[os]=null;for(;e===Dr;)Dr=wn[--Sn],wn[Sn]=null,Vn=wn[--Sn],wn[Sn]=null,Fn=wn[--Sn],wn[Sn]=null}function Im(e,n){wn[Sn++]=Fn,wn[Sn++]=Vn,wn[Sn++]=Dr,Fn=n.id,Vn=n.overflow,Dr=e}var Nt=null,et=null,ze=!1,qr=null,En=!1,Xu=Error(s(519));function Br(e){var n=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw da(_n(n,e)),Xu}function $m(e){var n=e.stateNode,a=e.type,o=e.memoizedProps;switch(n[Qe]=e,n[ot]=o,a){case"dialog":qe("cancel",n),qe("close",n);break;case"iframe":case"object":case"embed":qe("load",n);break;case"video":case"audio":for(a=0;a<qa.length;a++)qe(qa[a],n);break;case"source":qe("error",n);break;case"img":case"image":case"link":qe("error",n),qe("load",n);break;case"details":qe("toggle",n);break;case"input":qe("invalid",n),tm(n,o.value,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name,!0);break;case"select":qe("invalid",n);break;case"textarea":qe("invalid",n),rm(n,o.value,o.defaultValue,o.children)}a=o.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||n.textContent===""+a||o.suppressHydrationWarning===!0||sg(n.textContent,a)?(o.popover!=null&&(qe("beforetoggle",n),qe("toggle",n)),o.onScroll!=null&&qe("scroll",n),o.onScrollEnd!=null&&qe("scrollend",n),o.onClick!=null&&(n.onclick=ir),n=!0):n=!1,n||Br(e,!0)}function Hm(e){for(Nt=e.return;Nt;)switch(Nt.tag){case 5:case 31:case 13:En=!1;return;case 27:case 3:En=!0;return;default:Nt=Nt.return}}function ls(e){if(e!==Nt)return!1;if(!ze)return Hm(e),ze=!0,!1;var n=e.tag,a;if((a=n!==3&&n!==27)&&((a=n===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||mh(e.type,e.memoizedProps)),a=!a),a&&et&&Br(e),Hm(e),n===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(s(317));et=mg(e)}else if(n===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(s(317));et=mg(e)}else n===27?(n=et,Jr(e.type)?(e=vh,vh=null,et=e):et=n):et=Nt?An(e.stateNode.nextSibling):null;return!0}function Ai(){et=Nt=null,ze=!1}function Ju(){var e=qr;return e!==null&&(Kt===null?Kt=e:Kt.push.apply(Kt,e),qr=null),e}function da(e){qr===null?qr=[e]:qr.push(e)}var Qu=je(null),ji=null,lr=null;function Lr(e,n,a){Ne(Qu,n._currentValue),n._currentValue=a}function cr(e){e._currentValue=Qu.current,Se(Qu)}function Zu(e,n,a){for(;e!==null;){var o=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,o!==null&&(o.childLanes|=n)):o!==null&&(o.childLanes&n)!==n&&(o.childLanes|=n),e===a)break;e=e.return}}function Wu(e,n,a,o){var u=e.child;for(u!==null&&(u.return=e);u!==null;){var h=u.dependencies;if(h!==null){var x=u.child;h=h.firstContext;e:for(;h!==null;){var E=h;h=u;for(var R=0;R<n.length;R++)if(E.context===n[R]){h.lanes|=a,E=h.alternate,E!==null&&(E.lanes|=a),Zu(h.return,a,e),o||(x=null);break e}h=E.next}}else if(u.tag===18){if(x=u.return,x===null)throw Error(s(341));x.lanes|=a,h=x.alternate,h!==null&&(h.lanes|=a),Zu(x,a,e),x=null}else x=u.child;if(x!==null)x.return=u;else for(x=u;x!==null;){if(x===e){x=null;break}if(u=x.sibling,u!==null){u.return=x.return,x=u;break}x=x.return}u=x}}function cs(e,n,a,o){e=null;for(var u=n,h=!1;u!==null;){if(!h){if((u.flags&524288)!==0)h=!0;else if((u.flags&262144)!==0)break}if(u.tag===10){var x=u.alternate;if(x===null)throw Error(s(387));if(x=x.memoizedProps,x!==null){var E=u.type;Wt(u.pendingProps.value,x.value)||(e!==null?e.push(E):e=[E])}}else if(u===Rt.current){if(x=u.alternate,x===null)throw Error(s(387));x.memoizedState.memoizedState!==u.memoizedState.memoizedState&&(e!==null?e.push(Pa):e=[Pa])}u=u.return}e!==null&&Wu(n,e,a,o),n.flags|=262144}function Ko(e){for(e=e.firstContext;e!==null;){if(!Wt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Ti(e){ji=e,lr=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function kt(e){return Gm(ji,e)}function Xo(e,n){return ji===null&&Ti(e),Gm(e,n)}function Gm(e,n){var a=n._currentValue;if(n={context:n,memoizedValue:a,next:null},lr===null){if(e===null)throw Error(s(308));lr=n,e.dependencies={lanes:0,firstContext:n},e.flags|=524288}else lr=lr.next=n;return a}var Rx=typeof AbortController<"u"?AbortController:function(){var e=[],n=this.signal={aborted:!1,addEventListener:function(a,o){e.push(o)}};this.abort=function(){n.aborted=!0,e.forEach(function(a){return a()})}},Dx=i.unstable_scheduleCallback,qx=i.unstable_NormalPriority,yt={$$typeof:ie,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ef(){return{controller:new Rx,data:new Map,refCount:0}}function ma(e){e.refCount--,e.refCount===0&&Dx(qx,function(){e.controller.abort()})}var pa=null,tf=0,us=0,fs=null;function Bx(e,n){if(pa===null){var a=pa=[];tf=0,us=sh(),fs={status:"pending",value:void 0,then:function(o){a.push(o)}}}return tf++,n.then(Fm,Fm),n}function Fm(){if(--tf===0&&pa!==null){fs!==null&&(fs.status="fulfilled");var e=pa;pa=null,us=0,fs=null;for(var n=0;n<e.length;n++)(0,e[n])()}}function Lx(e,n){var a=[],o={status:"pending",value:null,reason:null,then:function(u){a.push(u)}};return e.then(function(){o.status="fulfilled",o.value=n;for(var u=0;u<a.length;u++)(0,a[u])(n)},function(u){for(o.status="rejected",o.reason=u,u=0;u<a.length;u++)(0,a[u])(void 0)}),o}var Vm=Y.S;Y.S=function(e,n){Np=nt(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&Bx(e,n),Vm!==null&&Vm(e,n)};var Ni=je(null);function nf(){var e=Ni.current;return e!==null?e:Ze.pooledCache}function Jo(e,n){n===null?Ne(Ni,Ni.current):Ne(Ni,n.pool)}function Ym(){var e=nf();return e===null?null:{parent:yt._currentValue,pool:e}}var hs=Error(s(460)),rf=Error(s(474)),Qo=Error(s(542)),Zo={then:function(){}};function Km(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Xm(e,n,a){switch(a=e[a],a===void 0?e.push(n):a!==n&&(n.then(ir,ir),n=a),n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,Qm(e),e;default:if(typeof n.status=="string")n.then(ir,ir);else{if(e=Ze,e!==null&&100<e.shellSuspendCounter)throw Error(s(482));e=n,e.status="pending",e.then(function(o){if(n.status==="pending"){var u=n;u.status="fulfilled",u.value=o}},function(o){if(n.status==="pending"){var u=n;u.status="rejected",u.reason=o}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,Qm(e),e}throw Ci=n,hs}}function ki(e){try{var n=e._init;return n(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(Ci=a,hs):a}}var Ci=null;function Jm(){if(Ci===null)throw Error(s(459));var e=Ci;return Ci=null,e}function Qm(e){if(e===hs||e===Qo)throw Error(s(483))}var ds=null,ga=0;function Wo(e){var n=ga;return ga+=1,ds===null&&(ds=[]),Xm(ds,e,n)}function ya(e,n){n=n.props.ref,e.ref=n!==void 0?n:null}function el(e,n){throw n.$$typeof===v?Error(s(525)):(e=Object.prototype.toString.call(n),Error(s(31,e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e)))}function Zm(e){function n(P,q){if(e){var $=P.deletions;$===null?(P.deletions=[q],P.flags|=16):$.push(q)}}function a(P,q){if(!e)return null;for(;q!==null;)n(P,q),q=q.sibling;return null}function o(P){for(var q=new Map;P!==null;)P.key!==null?q.set(P.key,P):q.set(P.index,P),P=P.sibling;return q}function u(P,q){return P=ar(P,q),P.index=0,P.sibling=null,P}function h(P,q,$){return P.index=$,e?($=P.alternate,$!==null?($=$.index,$<q?(P.flags|=67108866,q):$):(P.flags|=67108866,q)):(P.flags|=1048576,q)}function x(P){return e&&P.alternate===null&&(P.flags|=67108866),P}function E(P,q,$,Z){return q===null||q.tag!==6?(q=Fu($,P.mode,Z),q.return=P,q):(q=u(q,$),q.return=P,q)}function R(P,q,$,Z){var xe=$.type;return xe===S?J(P,q,$.props.children,Z,$.key):q!==null&&(q.elementType===xe||typeof xe=="object"&&xe!==null&&xe.$$typeof===X&&ki(xe)===q.type)?(q=u(q,$.props),ya(q,$),q.return=P,q):(q=Vo($.type,$.key,$.props,null,P.mode,Z),ya(q,$),q.return=P,q)}function H(P,q,$,Z){return q===null||q.tag!==4||q.stateNode.containerInfo!==$.containerInfo||q.stateNode.implementation!==$.implementation?(q=Vu($,P.mode,Z),q.return=P,q):(q=u(q,$.children||[]),q.return=P,q)}function J(P,q,$,Z,xe){return q===null||q.tag!==7?(q=Oi($,P.mode,Z,xe),q.return=P,q):(q=u(q,$),q.return=P,q)}function ne(P,q,$){if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return q=Fu(""+q,P.mode,$),q.return=P,q;if(typeof q=="object"&&q!==null){switch(q.$$typeof){case _:return $=Vo(q.type,q.key,q.props,null,P.mode,$),ya($,q),$.return=P,$;case w:return q=Vu(q,P.mode,$),q.return=P,q;case X:return q=ki(q),ne(P,q,$)}if(Te(q)||Q(q))return q=Oi(q,P.mode,$,null),q.return=P,q;if(typeof q.then=="function")return ne(P,Wo(q),$);if(q.$$typeof===ie)return ne(P,Xo(P,q),$);el(P,q)}return null}function F(P,q,$,Z){var xe=q!==null?q.key:null;if(typeof $=="string"&&$!==""||typeof $=="number"||typeof $=="bigint")return xe!==null?null:E(P,q,""+$,Z);if(typeof $=="object"&&$!==null){switch($.$$typeof){case _:return $.key===xe?R(P,q,$,Z):null;case w:return $.key===xe?H(P,q,$,Z):null;case X:return $=ki($),F(P,q,$,Z)}if(Te($)||Q($))return xe!==null?null:J(P,q,$,Z,null);if(typeof $.then=="function")return F(P,q,Wo($),Z);if($.$$typeof===ie)return F(P,q,Xo(P,$),Z);el(P,$)}return null}function K(P,q,$,Z,xe){if(typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint")return P=P.get($)||null,E(q,P,""+Z,xe);if(typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case _:return P=P.get(Z.key===null?$:Z.key)||null,R(q,P,Z,xe);case w:return P=P.get(Z.key===null?$:Z.key)||null,H(q,P,Z,xe);case X:return Z=ki(Z),K(P,q,$,Z,xe)}if(Te(Z)||Q(Z))return P=P.get($)||null,J(q,P,Z,xe,null);if(typeof Z.then=="function")return K(P,q,$,Wo(Z),xe);if(Z.$$typeof===ie)return K(P,q,$,Xo(q,Z),xe);el(q,Z)}return null}function ge(P,q,$,Z){for(var xe=null,$e=null,ye=q,Me=q=0,Le=null;ye!==null&&Me<$.length;Me++){ye.index>Me?(Le=ye,ye=null):Le=ye.sibling;var He=F(P,ye,$[Me],Z);if(He===null){ye===null&&(ye=Le);break}e&&ye&&He.alternate===null&&n(P,ye),q=h(He,q,Me),$e===null?xe=He:$e.sibling=He,$e=He,ye=Le}if(Me===$.length)return a(P,ye),ze&&or(P,Me),xe;if(ye===null){for(;Me<$.length;Me++)ye=ne(P,$[Me],Z),ye!==null&&(q=h(ye,q,Me),$e===null?xe=ye:$e.sibling=ye,$e=ye);return ze&&or(P,Me),xe}for(ye=o(ye);Me<$.length;Me++)Le=K(ye,P,Me,$[Me],Z),Le!==null&&(e&&Le.alternate!==null&&ye.delete(Le.key===null?Me:Le.key),q=h(Le,q,Me),$e===null?xe=Le:$e.sibling=Le,$e=Le);return e&&ye.forEach(function(ti){return n(P,ti)}),ze&&or(P,Me),xe}function Ee(P,q,$,Z){if($==null)throw Error(s(151));for(var xe=null,$e=null,ye=q,Me=q=0,Le=null,He=$.next();ye!==null&&!He.done;Me++,He=$.next()){ye.index>Me?(Le=ye,ye=null):Le=ye.sibling;var ti=F(P,ye,He.value,Z);if(ti===null){ye===null&&(ye=Le);break}e&&ye&&ti.alternate===null&&n(P,ye),q=h(ti,q,Me),$e===null?xe=ti:$e.sibling=ti,$e=ti,ye=Le}if(He.done)return a(P,ye),ze&&or(P,Me),xe;if(ye===null){for(;!He.done;Me++,He=$.next())He=ne(P,He.value,Z),He!==null&&(q=h(He,q,Me),$e===null?xe=He:$e.sibling=He,$e=He);return ze&&or(P,Me),xe}for(ye=o(ye);!He.done;Me++,He=$.next())He=K(ye,P,Me,He.value,Z),He!==null&&(e&&He.alternate!==null&&ye.delete(He.key===null?Me:He.key),q=h(He,q,Me),$e===null?xe=He:$e.sibling=He,$e=He);return e&&ye.forEach(function(K_){return n(P,K_)}),ze&&or(P,Me),xe}function Je(P,q,$,Z){if(typeof $=="object"&&$!==null&&$.type===S&&$.key===null&&($=$.props.children),typeof $=="object"&&$!==null){switch($.$$typeof){case _:e:{for(var xe=$.key;q!==null;){if(q.key===xe){if(xe=$.type,xe===S){if(q.tag===7){a(P,q.sibling),Z=u(q,$.props.children),Z.return=P,P=Z;break e}}else if(q.elementType===xe||typeof xe=="object"&&xe!==null&&xe.$$typeof===X&&ki(xe)===q.type){a(P,q.sibling),Z=u(q,$.props),ya(Z,$),Z.return=P,P=Z;break e}a(P,q);break}else n(P,q);q=q.sibling}$.type===S?(Z=Oi($.props.children,P.mode,Z,$.key),Z.return=P,P=Z):(Z=Vo($.type,$.key,$.props,null,P.mode,Z),ya(Z,$),Z.return=P,P=Z)}return x(P);case w:e:{for(xe=$.key;q!==null;){if(q.key===xe)if(q.tag===4&&q.stateNode.containerInfo===$.containerInfo&&q.stateNode.implementation===$.implementation){a(P,q.sibling),Z=u(q,$.children||[]),Z.return=P,P=Z;break e}else{a(P,q);break}else n(P,q);q=q.sibling}Z=Vu($,P.mode,Z),Z.return=P,P=Z}return x(P);case X:return $=ki($),Je(P,q,$,Z)}if(Te($))return ge(P,q,$,Z);if(Q($)){if(xe=Q($),typeof xe!="function")throw Error(s(150));return $=xe.call($),Ee(P,q,$,Z)}if(typeof $.then=="function")return Je(P,q,Wo($),Z);if($.$$typeof===ie)return Je(P,q,Xo(P,$),Z);el(P,$)}return typeof $=="string"&&$!==""||typeof $=="number"||typeof $=="bigint"?($=""+$,q!==null&&q.tag===6?(a(P,q.sibling),Z=u(q,$),Z.return=P,P=Z):(a(P,q),Z=Fu($,P.mode,Z),Z.return=P,P=Z),x(P)):a(P,q)}return function(P,q,$,Z){try{ga=0;var xe=Je(P,q,$,Z);return ds=null,xe}catch(ye){if(ye===hs||ye===Qo)throw ye;var $e=en(29,ye,null,P.mode);return $e.lanes=Z,$e.return=P,$e}finally{}}}var Mi=Zm(!0),Wm=Zm(!1),zr=!1;function sf(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function af(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ur(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Pr(e,n,a){var o=e.updateQueue;if(o===null)return null;if(o=o.shared,(Ge&2)!==0){var u=o.pending;return u===null?n.next=n:(n.next=u.next,u.next=n),o.pending=n,n=Fo(e),Bm(e,null,a),n}return Go(e,o,n,a),Fo(e)}function ba(e,n,a){if(n=n.updateQueue,n!==null&&(n=n.shared,(a&4194048)!==0)){var o=n.lanes;o&=e.pendingLanes,a|=o,n.lanes=a,bi(e,a)}}function of(e,n){var a=e.updateQueue,o=e.alternate;if(o!==null&&(o=o.updateQueue,a===o)){var u=null,h=null;if(a=a.firstBaseUpdate,a!==null){do{var x={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};h===null?u=h=x:h=h.next=x,a=a.next}while(a!==null);h===null?u=h=n:h=h.next=n}else u=h=n;a={baseState:o.baseState,firstBaseUpdate:u,lastBaseUpdate:h,shared:o.shared,callbacks:o.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=n:e.next=n,a.lastBaseUpdate=n}var lf=!1;function va(){if(lf){var e=fs;if(e!==null)throw e}}function xa(e,n,a,o){lf=!1;var u=e.updateQueue;zr=!1;var h=u.firstBaseUpdate,x=u.lastBaseUpdate,E=u.shared.pending;if(E!==null){u.shared.pending=null;var R=E,H=R.next;R.next=null,x===null?h=H:x.next=H,x=R;var J=e.alternate;J!==null&&(J=J.updateQueue,E=J.lastBaseUpdate,E!==x&&(E===null?J.firstBaseUpdate=H:E.next=H,J.lastBaseUpdate=R))}if(h!==null){var ne=u.baseState;x=0,J=H=R=null,E=h;do{var F=E.lane&-536870913,K=F!==E.lane;if(K?(Be&F)===F:(o&F)===F){F!==0&&F===us&&(lf=!0),J!==null&&(J=J.next={lane:0,tag:E.tag,payload:E.payload,callback:null,next:null});e:{var ge=e,Ee=E;F=n;var Je=a;switch(Ee.tag){case 1:if(ge=Ee.payload,typeof ge=="function"){ne=ge.call(Je,ne,F);break e}ne=ge;break e;case 3:ge.flags=ge.flags&-65537|128;case 0:if(ge=Ee.payload,F=typeof ge=="function"?ge.call(Je,ne,F):ge,F==null)break e;ne=b({},ne,F);break e;case 2:zr=!0}}F=E.callback,F!==null&&(e.flags|=64,K&&(e.flags|=8192),K=u.callbacks,K===null?u.callbacks=[F]:K.push(F))}else K={lane:F,tag:E.tag,payload:E.payload,callback:E.callback,next:null},J===null?(H=J=K,R=ne):J=J.next=K,x|=F;if(E=E.next,E===null){if(E=u.shared.pending,E===null)break;K=E,E=K.next,K.next=null,u.lastBaseUpdate=K,u.shared.pending=null}}while(!0);J===null&&(R=ne),u.baseState=R,u.firstBaseUpdate=H,u.lastBaseUpdate=J,h===null&&(u.shared.lanes=0),Fr|=x,e.lanes=x,e.memoizedState=ne}}function e0(e,n){if(typeof e!="function")throw Error(s(191,e));e.call(n)}function t0(e,n){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)e0(a[e],n)}var ms=je(null),tl=je(0);function n0(e,n){e=br,Ne(tl,e),Ne(ms,n),br=e|n.baseLanes}function cf(){Ne(tl,br),Ne(ms,ms.current)}function uf(){br=tl.current,Se(ms),Se(tl)}var tn=je(null),On=null;function Ir(e){var n=e.alternate;Ne(ht,ht.current&1),Ne(tn,e),On===null&&(n===null||ms.current!==null||n.memoizedState!==null)&&(On=e)}function ff(e){Ne(ht,ht.current),Ne(tn,e),On===null&&(On=e)}function r0(e){e.tag===22?(Ne(ht,ht.current),Ne(tn,e),On===null&&(On=e)):$r()}function $r(){Ne(ht,ht.current),Ne(tn,tn.current)}function nn(e){Se(tn),On===e&&(On=null),Se(ht)}var ht=je(0);function nl(e){for(var n=e;n!==null;){if(n.tag===13){var a=n.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||yh(a)||bh(a)))return n}else if(n.tag===19&&(n.memoizedProps.revealOrder==="forwards"||n.memoizedProps.revealOrder==="backwards"||n.memoizedProps.revealOrder==="unstable_legacy-backwards"||n.memoizedProps.revealOrder==="together")){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var ur=0,Ce=null,Ke=null,bt=null,rl=!1,ps=!1,Ri=!1,il=0,_a=0,gs=null,zx=0;function lt(){throw Error(s(321))}function hf(e,n){if(n===null)return!1;for(var a=0;a<n.length&&a<e.length;a++)if(!Wt(e[a],n[a]))return!1;return!0}function df(e,n,a,o,u,h){return ur=h,Ce=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,Y.H=e===null||e.memoizedState===null?P0:Tf,Ri=!1,h=a(o,u),Ri=!1,ps&&(h=s0(n,a,o,u)),i0(e),h}function i0(e){Y.H=Ea;var n=Ke!==null&&Ke.next!==null;if(ur=0,bt=Ke=Ce=null,rl=!1,_a=0,gs=null,n)throw Error(s(300));e===null||vt||(e=e.dependencies,e!==null&&Ko(e)&&(vt=!0))}function s0(e,n,a,o){Ce=e;var u=0;do{if(ps&&(gs=null),_a=0,ps=!1,25<=u)throw Error(s(301));if(u+=1,bt=Ke=null,e.updateQueue!=null){var h=e.updateQueue;h.lastEffect=null,h.events=null,h.stores=null,h.memoCache!=null&&(h.memoCache.index=0)}Y.H=I0,h=n(a,o)}while(ps);return h}function Ux(){var e=Y.H,n=e.useState()[0];return n=typeof n.then=="function"?wa(n):n,e=e.useState()[0],(Ke!==null?Ke.memoizedState:null)!==e&&(Ce.flags|=1024),n}function mf(){var e=il!==0;return il=0,e}function pf(e,n,a){n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~a}function gf(e){if(rl){for(e=e.memoizedState;e!==null;){var n=e.queue;n!==null&&(n.pending=null),e=e.next}rl=!1}ur=0,bt=Ke=Ce=null,ps=!1,_a=il=0,gs=null}function zt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return bt===null?Ce.memoizedState=bt=e:bt=bt.next=e,bt}function dt(){if(Ke===null){var e=Ce.alternate;e=e!==null?e.memoizedState:null}else e=Ke.next;var n=bt===null?Ce.memoizedState:bt.next;if(n!==null)bt=n,Ke=e;else{if(e===null)throw Ce.alternate===null?Error(s(467)):Error(s(310));Ke=e,e={memoizedState:Ke.memoizedState,baseState:Ke.baseState,baseQueue:Ke.baseQueue,queue:Ke.queue,next:null},bt===null?Ce.memoizedState=bt=e:bt=bt.next=e}return bt}function sl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function wa(e){var n=_a;return _a+=1,gs===null&&(gs=[]),e=Xm(gs,e,n),n=Ce,(bt===null?n.memoizedState:bt.next)===null&&(n=n.alternate,Y.H=n===null||n.memoizedState===null?P0:Tf),e}function al(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return wa(e);if(e.$$typeof===ie)return kt(e)}throw Error(s(438,String(e)))}function yf(e){var n=null,a=Ce.updateQueue;if(a!==null&&(n=a.memoCache),n==null){var o=Ce.alternate;o!==null&&(o=o.updateQueue,o!==null&&(o=o.memoCache,o!=null&&(n={data:o.data.map(function(u){return u.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),a===null&&(a=sl(),Ce.updateQueue=a),a.memoCache=n,a=n.data[n.index],a===void 0)for(a=n.data[n.index]=Array(e),o=0;o<e;o++)a[o]=G;return n.index++,a}function fr(e,n){return typeof n=="function"?n(e):n}function ol(e){var n=dt();return bf(n,Ke,e)}function bf(e,n,a){var o=e.queue;if(o===null)throw Error(s(311));o.lastRenderedReducer=a;var u=e.baseQueue,h=o.pending;if(h!==null){if(u!==null){var x=u.next;u.next=h.next,h.next=x}n.baseQueue=u=h,o.pending=null}if(h=e.baseState,u===null)e.memoizedState=h;else{n=u.next;var E=x=null,R=null,H=n,J=!1;do{var ne=H.lane&-536870913;if(ne!==H.lane?(Be&ne)===ne:(ur&ne)===ne){var F=H.revertLane;if(F===0)R!==null&&(R=R.next={lane:0,revertLane:0,gesture:null,action:H.action,hasEagerState:H.hasEagerState,eagerState:H.eagerState,next:null}),ne===us&&(J=!0);else if((ur&F)===F){H=H.next,F===us&&(J=!0);continue}else ne={lane:0,revertLane:H.revertLane,gesture:null,action:H.action,hasEagerState:H.hasEagerState,eagerState:H.eagerState,next:null},R===null?(E=R=ne,x=h):R=R.next=ne,Ce.lanes|=F,Fr|=F;ne=H.action,Ri&&a(h,ne),h=H.hasEagerState?H.eagerState:a(h,ne)}else F={lane:ne,revertLane:H.revertLane,gesture:H.gesture,action:H.action,hasEagerState:H.hasEagerState,eagerState:H.eagerState,next:null},R===null?(E=R=F,x=h):R=R.next=F,Ce.lanes|=ne,Fr|=ne;H=H.next}while(H!==null&&H!==n);if(R===null?x=h:R.next=E,!Wt(h,e.memoizedState)&&(vt=!0,J&&(a=fs,a!==null)))throw a;e.memoizedState=h,e.baseState=x,e.baseQueue=R,o.lastRenderedState=h}return u===null&&(o.lanes=0),[e.memoizedState,o.dispatch]}function vf(e){var n=dt(),a=n.queue;if(a===null)throw Error(s(311));a.lastRenderedReducer=e;var o=a.dispatch,u=a.pending,h=n.memoizedState;if(u!==null){a.pending=null;var x=u=u.next;do h=e(h,x.action),x=x.next;while(x!==u);Wt(h,n.memoizedState)||(vt=!0),n.memoizedState=h,n.baseQueue===null&&(n.baseState=h),a.lastRenderedState=h}return[h,o]}function a0(e,n,a){var o=Ce,u=dt(),h=ze;if(h){if(a===void 0)throw Error(s(407));a=a()}else a=n();var x=!Wt((Ke||u).memoizedState,a);if(x&&(u.memoizedState=a,vt=!0),u=u.queue,wf(c0.bind(null,o,u,e),[e]),u.getSnapshot!==n||x||bt!==null&&bt.memoizedState.tag&1){if(o.flags|=2048,ys(9,{destroy:void 0},l0.bind(null,o,u,a,n),null),Ze===null)throw Error(s(349));h||(ur&127)!==0||o0(o,n,a)}return a}function o0(e,n,a){e.flags|=16384,e={getSnapshot:n,value:a},n=Ce.updateQueue,n===null?(n=sl(),Ce.updateQueue=n,n.stores=[e]):(a=n.stores,a===null?n.stores=[e]:a.push(e))}function l0(e,n,a,o){n.value=a,n.getSnapshot=o,u0(n)&&f0(e)}function c0(e,n,a){return a(function(){u0(n)&&f0(e)})}function u0(e){var n=e.getSnapshot;e=e.value;try{var a=n();return!Wt(e,a)}catch{return!0}}function f0(e){var n=Ei(e,2);n!==null&&Xt(n,e,2)}function xf(e){var n=zt();if(typeof e=="function"){var a=e;if(e=a(),Ri){Qt(!0);try{a()}finally{Qt(!1)}}}return n.memoizedState=n.baseState=e,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:fr,lastRenderedState:e},n}function h0(e,n,a,o){return e.baseState=a,bf(e,Ke,typeof o=="function"?o:fr)}function Px(e,n,a,o,u){if(ul(e))throw Error(s(485));if(e=n.action,e!==null){var h={payload:u,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(x){h.listeners.push(x)}};Y.T!==null?a(!0):h.isTransition=!1,o(h),a=n.pending,a===null?(h.next=n.pending=h,d0(n,h)):(h.next=a.next,n.pending=a.next=h)}}function d0(e,n){var a=n.action,o=n.payload,u=e.state;if(n.isTransition){var h=Y.T,x={};Y.T=x;try{var E=a(u,o),R=Y.S;R!==null&&R(x,E),m0(e,n,E)}catch(H){_f(e,n,H)}finally{h!==null&&x.types!==null&&(h.types=x.types),Y.T=h}}else try{h=a(u,o),m0(e,n,h)}catch(H){_f(e,n,H)}}function m0(e,n,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(o){p0(e,n,o)},function(o){return _f(e,n,o)}):p0(e,n,a)}function p0(e,n,a){n.status="fulfilled",n.value=a,g0(n),e.state=a,n=e.pending,n!==null&&(a=n.next,a===n?e.pending=null:(a=a.next,n.next=a,d0(e,a)))}function _f(e,n,a){var o=e.pending;if(e.pending=null,o!==null){o=o.next;do n.status="rejected",n.reason=a,g0(n),n=n.next;while(n!==o)}e.action=null}function g0(e){e=e.listeners;for(var n=0;n<e.length;n++)(0,e[n])()}function y0(e,n){return n}function b0(e,n){if(ze){var a=Ze.formState;if(a!==null){e:{var o=Ce;if(ze){if(et){t:{for(var u=et,h=En;u.nodeType!==8;){if(!h){u=null;break t}if(u=An(u.nextSibling),u===null){u=null;break t}}h=u.data,u=h==="F!"||h==="F"?u:null}if(u){et=An(u.nextSibling),o=u.data==="F!";break e}}Br(o)}o=!1}o&&(n=a[0])}}return a=zt(),a.memoizedState=a.baseState=n,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:y0,lastRenderedState:n},a.queue=o,a=L0.bind(null,Ce,o),o.dispatch=a,o=xf(!1),h=jf.bind(null,Ce,!1,o.queue),o=zt(),u={state:n,dispatch:null,action:e,pending:null},o.queue=u,a=Px.bind(null,Ce,u,h,a),u.dispatch=a,o.memoizedState=e,[n,a,!1]}function v0(e){var n=dt();return x0(n,Ke,e)}function x0(e,n,a){if(n=bf(e,n,y0)[0],e=ol(fr)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var o=wa(n)}catch(x){throw x===hs?Qo:x}else o=n;n=dt();var u=n.queue,h=u.dispatch;return a!==n.memoizedState&&(Ce.flags|=2048,ys(9,{destroy:void 0},Ix.bind(null,u,a),null)),[o,h,e]}function Ix(e,n){e.action=n}function _0(e){var n=dt(),a=Ke;if(a!==null)return x0(n,a,e);dt(),n=n.memoizedState,a=dt();var o=a.queue.dispatch;return a.memoizedState=e,[n,o,!1]}function ys(e,n,a,o){return e={tag:e,create:a,deps:o,inst:n,next:null},n=Ce.updateQueue,n===null&&(n=sl(),Ce.updateQueue=n),a=n.lastEffect,a===null?n.lastEffect=e.next=e:(o=a.next,a.next=e,e.next=o,n.lastEffect=e),e}function w0(){return dt().memoizedState}function ll(e,n,a,o){var u=zt();Ce.flags|=e,u.memoizedState=ys(1|n,{destroy:void 0},a,o===void 0?null:o)}function cl(e,n,a,o){var u=dt();o=o===void 0?null:o;var h=u.memoizedState.inst;Ke!==null&&o!==null&&hf(o,Ke.memoizedState.deps)?u.memoizedState=ys(n,h,a,o):(Ce.flags|=e,u.memoizedState=ys(1|n,h,a,o))}function S0(e,n){ll(8390656,8,e,n)}function wf(e,n){cl(2048,8,e,n)}function $x(e){Ce.flags|=4;var n=Ce.updateQueue;if(n===null)n=sl(),Ce.updateQueue=n,n.events=[e];else{var a=n.events;a===null?n.events=[e]:a.push(e)}}function E0(e){var n=dt().memoizedState;return $x({ref:n,nextImpl:e}),function(){if((Ge&2)!==0)throw Error(s(440));return n.impl.apply(void 0,arguments)}}function O0(e,n){return cl(4,2,e,n)}function A0(e,n){return cl(4,4,e,n)}function j0(e,n){if(typeof n=="function"){e=e();var a=n(e);return function(){typeof a=="function"?a():n(null)}}if(n!=null)return e=e(),n.current=e,function(){n.current=null}}function T0(e,n,a){a=a!=null?a.concat([e]):null,cl(4,4,j0.bind(null,n,e),a)}function Sf(){}function N0(e,n){var a=dt();n=n===void 0?null:n;var o=a.memoizedState;return n!==null&&hf(n,o[1])?o[0]:(a.memoizedState=[e,n],e)}function k0(e,n){var a=dt();n=n===void 0?null:n;var o=a.memoizedState;if(n!==null&&hf(n,o[1]))return o[0];if(o=e(),Ri){Qt(!0);try{e()}finally{Qt(!1)}}return a.memoizedState=[o,n],o}function Ef(e,n,a){return a===void 0||(ur&1073741824)!==0&&(Be&261930)===0?e.memoizedState=n:(e.memoizedState=a,e=Cp(),Ce.lanes|=e,Fr|=e,a)}function C0(e,n,a,o){return Wt(a,n)?a:ms.current!==null?(e=Ef(e,a,o),Wt(e,n)||(vt=!0),e):(ur&42)===0||(ur&1073741824)!==0&&(Be&261930)===0?(vt=!0,e.memoizedState=a):(e=Cp(),Ce.lanes|=e,Fr|=e,n)}function M0(e,n,a,o,u){var h=ae.p;ae.p=h!==0&&8>h?h:8;var x=Y.T,E={};Y.T=E,jf(e,!1,n,a);try{var R=u(),H=Y.S;if(H!==null&&H(E,R),R!==null&&typeof R=="object"&&typeof R.then=="function"){var J=Lx(R,o);Sa(e,n,J,an(e))}else Sa(e,n,o,an(e))}catch(ne){Sa(e,n,{then:function(){},status:"rejected",reason:ne},an())}finally{ae.p=h,x!==null&&E.types!==null&&(x.types=E.types),Y.T=x}}function Hx(){}function Of(e,n,a,o){if(e.tag!==5)throw Error(s(476));var u=R0(e).queue;M0(e,u,n,de,a===null?Hx:function(){return D0(e),a(o)})}function R0(e){var n=e.memoizedState;if(n!==null)return n;n={memoizedState:de,baseState:de,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:fr,lastRenderedState:de},next:null};var a={};return n.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:fr,lastRenderedState:a},next:null},e.memoizedState=n,e=e.alternate,e!==null&&(e.memoizedState=n),n}function D0(e){var n=R0(e);n.next===null&&(n=e.alternate.memoizedState),Sa(e,n.next.queue,{},an())}function Af(){return kt(Pa)}function q0(){return dt().memoizedState}function B0(){return dt().memoizedState}function Gx(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var a=an();e=Ur(a);var o=Pr(n,e,a);o!==null&&(Xt(o,n,a),ba(o,n,a)),n={cache:ef()},e.payload=n;return}n=n.return}}function Fx(e,n,a){var o=an();a={lane:o,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},ul(e)?z0(n,a):(a=Hu(e,n,a,o),a!==null&&(Xt(a,e,o),U0(a,n,o)))}function L0(e,n,a){var o=an();Sa(e,n,a,o)}function Sa(e,n,a,o){var u={lane:o,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(ul(e))z0(n,u);else{var h=e.alternate;if(e.lanes===0&&(h===null||h.lanes===0)&&(h=n.lastRenderedReducer,h!==null))try{var x=n.lastRenderedState,E=h(x,a);if(u.hasEagerState=!0,u.eagerState=E,Wt(E,x))return Go(e,n,u,0),Ze===null&&Ho(),!1}catch{}finally{}if(a=Hu(e,n,u,o),a!==null)return Xt(a,e,o),U0(a,n,o),!0}return!1}function jf(e,n,a,o){if(o={lane:2,revertLane:sh(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},ul(e)){if(n)throw Error(s(479))}else n=Hu(e,a,o,2),n!==null&&Xt(n,e,2)}function ul(e){var n=e.alternate;return e===Ce||n!==null&&n===Ce}function z0(e,n){ps=rl=!0;var a=e.pending;a===null?n.next=n:(n.next=a.next,a.next=n),e.pending=n}function U0(e,n,a){if((a&4194048)!==0){var o=n.lanes;o&=e.pendingLanes,a|=o,n.lanes=a,bi(e,a)}}var Ea={readContext:kt,use:al,useCallback:lt,useContext:lt,useEffect:lt,useImperativeHandle:lt,useLayoutEffect:lt,useInsertionEffect:lt,useMemo:lt,useReducer:lt,useRef:lt,useState:lt,useDebugValue:lt,useDeferredValue:lt,useTransition:lt,useSyncExternalStore:lt,useId:lt,useHostTransitionStatus:lt,useFormState:lt,useActionState:lt,useOptimistic:lt,useMemoCache:lt,useCacheRefresh:lt};Ea.useEffectEvent=lt;var P0={readContext:kt,use:al,useCallback:function(e,n){return zt().memoizedState=[e,n===void 0?null:n],e},useContext:kt,useEffect:S0,useImperativeHandle:function(e,n,a){a=a!=null?a.concat([e]):null,ll(4194308,4,j0.bind(null,n,e),a)},useLayoutEffect:function(e,n){return ll(4194308,4,e,n)},useInsertionEffect:function(e,n){ll(4,2,e,n)},useMemo:function(e,n){var a=zt();n=n===void 0?null:n;var o=e();if(Ri){Qt(!0);try{e()}finally{Qt(!1)}}return a.memoizedState=[o,n],o},useReducer:function(e,n,a){var o=zt();if(a!==void 0){var u=a(n);if(Ri){Qt(!0);try{a(n)}finally{Qt(!1)}}}else u=n;return o.memoizedState=o.baseState=u,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:u},o.queue=e,e=e.dispatch=Fx.bind(null,Ce,e),[o.memoizedState,e]},useRef:function(e){var n=zt();return e={current:e},n.memoizedState=e},useState:function(e){e=xf(e);var n=e.queue,a=L0.bind(null,Ce,n);return n.dispatch=a,[e.memoizedState,a]},useDebugValue:Sf,useDeferredValue:function(e,n){var a=zt();return Ef(a,e,n)},useTransition:function(){var e=xf(!1);return e=M0.bind(null,Ce,e.queue,!0,!1),zt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,a){var o=Ce,u=zt();if(ze){if(a===void 0)throw Error(s(407));a=a()}else{if(a=n(),Ze===null)throw Error(s(349));(Be&127)!==0||o0(o,n,a)}u.memoizedState=a;var h={value:a,getSnapshot:n};return u.queue=h,S0(c0.bind(null,o,h,e),[e]),o.flags|=2048,ys(9,{destroy:void 0},l0.bind(null,o,h,a,n),null),a},useId:function(){var e=zt(),n=Ze.identifierPrefix;if(ze){var a=Vn,o=Fn;a=(o&~(1<<32-Bt(o)-1)).toString(32)+a,n="_"+n+"R_"+a,a=il++,0<a&&(n+="H"+a.toString(32)),n+="_"}else a=zx++,n="_"+n+"r_"+a.toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:Af,useFormState:b0,useActionState:b0,useOptimistic:function(e){var n=zt();n.memoizedState=n.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=a,n=jf.bind(null,Ce,!0,a),a.dispatch=n,[e,n]},useMemoCache:yf,useCacheRefresh:function(){return zt().memoizedState=Gx.bind(null,Ce)},useEffectEvent:function(e){var n=zt(),a={impl:e};return n.memoizedState=a,function(){if((Ge&2)!==0)throw Error(s(440));return a.impl.apply(void 0,arguments)}}},Tf={readContext:kt,use:al,useCallback:N0,useContext:kt,useEffect:wf,useImperativeHandle:T0,useInsertionEffect:O0,useLayoutEffect:A0,useMemo:k0,useReducer:ol,useRef:w0,useState:function(){return ol(fr)},useDebugValue:Sf,useDeferredValue:function(e,n){var a=dt();return C0(a,Ke.memoizedState,e,n)},useTransition:function(){var e=ol(fr)[0],n=dt().memoizedState;return[typeof e=="boolean"?e:wa(e),n]},useSyncExternalStore:a0,useId:q0,useHostTransitionStatus:Af,useFormState:v0,useActionState:v0,useOptimistic:function(e,n){var a=dt();return h0(a,Ke,e,n)},useMemoCache:yf,useCacheRefresh:B0};Tf.useEffectEvent=E0;var I0={readContext:kt,use:al,useCallback:N0,useContext:kt,useEffect:wf,useImperativeHandle:T0,useInsertionEffect:O0,useLayoutEffect:A0,useMemo:k0,useReducer:vf,useRef:w0,useState:function(){return vf(fr)},useDebugValue:Sf,useDeferredValue:function(e,n){var a=dt();return Ke===null?Ef(a,e,n):C0(a,Ke.memoizedState,e,n)},useTransition:function(){var e=vf(fr)[0],n=dt().memoizedState;return[typeof e=="boolean"?e:wa(e),n]},useSyncExternalStore:a0,useId:q0,useHostTransitionStatus:Af,useFormState:_0,useActionState:_0,useOptimistic:function(e,n){var a=dt();return Ke!==null?h0(a,Ke,e,n):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:yf,useCacheRefresh:B0};I0.useEffectEvent=E0;function Nf(e,n,a,o){n=e.memoizedState,a=a(o,n),a=a==null?n:b({},n,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var kf={enqueueSetState:function(e,n,a){e=e._reactInternals;var o=an(),u=Ur(o);u.payload=n,a!=null&&(u.callback=a),n=Pr(e,u,o),n!==null&&(Xt(n,e,o),ba(n,e,o))},enqueueReplaceState:function(e,n,a){e=e._reactInternals;var o=an(),u=Ur(o);u.tag=1,u.payload=n,a!=null&&(u.callback=a),n=Pr(e,u,o),n!==null&&(Xt(n,e,o),ba(n,e,o))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var a=an(),o=Ur(a);o.tag=2,n!=null&&(o.callback=n),n=Pr(e,o,a),n!==null&&(Xt(n,e,a),ba(n,e,a))}};function $0(e,n,a,o,u,h,x){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(o,h,x):n.prototype&&n.prototype.isPureReactComponent?!ua(a,o)||!ua(u,h):!0}function H0(e,n,a,o){e=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(a,o),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(a,o),n.state!==e&&kf.enqueueReplaceState(n,n.state,null)}function Di(e,n){var a=n;if("ref"in n){a={};for(var o in n)o!=="ref"&&(a[o]=n[o])}if(e=e.defaultProps){a===n&&(a=b({},a));for(var u in e)a[u]===void 0&&(a[u]=e[u])}return a}function G0(e){$o(e)}function F0(e){console.error(e)}function V0(e){$o(e)}function fl(e,n){try{var a=e.onUncaughtError;a(n.value,{componentStack:n.stack})}catch(o){setTimeout(function(){throw o})}}function Y0(e,n,a){try{var o=e.onCaughtError;o(a.value,{componentStack:a.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(u){setTimeout(function(){throw u})}}function Cf(e,n,a){return a=Ur(a),a.tag=3,a.payload={element:null},a.callback=function(){fl(e,n)},a}function K0(e){return e=Ur(e),e.tag=3,e}function X0(e,n,a,o){var u=a.type.getDerivedStateFromError;if(typeof u=="function"){var h=o.value;e.payload=function(){return u(h)},e.callback=function(){Y0(n,a,o)}}var x=a.stateNode;x!==null&&typeof x.componentDidCatch=="function"&&(e.callback=function(){Y0(n,a,o),typeof u!="function"&&(Vr===null?Vr=new Set([this]):Vr.add(this));var E=o.stack;this.componentDidCatch(o.value,{componentStack:E!==null?E:""})})}function Vx(e,n,a,o,u){if(a.flags|=32768,o!==null&&typeof o=="object"&&typeof o.then=="function"){if(n=a.alternate,n!==null&&cs(n,a,u,!0),a=tn.current,a!==null){switch(a.tag){case 31:case 13:return On===null?Sl():a.alternate===null&&ct===0&&(ct=3),a.flags&=-257,a.flags|=65536,a.lanes=u,o===Zo?a.flags|=16384:(n=a.updateQueue,n===null?a.updateQueue=new Set([o]):n.add(o),nh(e,o,u)),!1;case 22:return a.flags|=65536,o===Zo?a.flags|=16384:(n=a.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([o])},a.updateQueue=n):(a=n.retryQueue,a===null?n.retryQueue=new Set([o]):a.add(o)),nh(e,o,u)),!1}throw Error(s(435,a.tag))}return nh(e,o,u),Sl(),!1}if(ze)return n=tn.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=u,o!==Xu&&(e=Error(s(422),{cause:o}),da(_n(e,a)))):(o!==Xu&&(n=Error(s(423),{cause:o}),da(_n(n,a))),e=e.current.alternate,e.flags|=65536,u&=-u,e.lanes|=u,o=_n(o,a),u=Cf(e.stateNode,o,u),of(e,u),ct!==4&&(ct=2)),!1;var h=Error(s(520),{cause:o});if(h=_n(h,a),Ma===null?Ma=[h]:Ma.push(h),ct!==4&&(ct=2),n===null)return!0;o=_n(o,a),a=n;do{switch(a.tag){case 3:return a.flags|=65536,e=u&-u,a.lanes|=e,e=Cf(a.stateNode,o,e),of(a,e),!1;case 1:if(n=a.type,h=a.stateNode,(a.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||h!==null&&typeof h.componentDidCatch=="function"&&(Vr===null||!Vr.has(h))))return a.flags|=65536,u&=-u,a.lanes|=u,u=K0(u),X0(u,e,a,o),of(a,u),!1}a=a.return}while(a!==null);return!1}var Mf=Error(s(461)),vt=!1;function Ct(e,n,a,o){n.child=e===null?Wm(n,null,a,o):Mi(n,e.child,a,o)}function J0(e,n,a,o,u){a=a.render;var h=n.ref;if("ref"in o){var x={};for(var E in o)E!=="ref"&&(x[E]=o[E])}else x=o;return Ti(n),o=df(e,n,a,x,h,u),E=mf(),e!==null&&!vt?(pf(e,n,u),hr(e,n,u)):(ze&&E&&Yu(n),n.flags|=1,Ct(e,n,o,u),n.child)}function Q0(e,n,a,o,u){if(e===null){var h=a.type;return typeof h=="function"&&!Gu(h)&&h.defaultProps===void 0&&a.compare===null?(n.tag=15,n.type=h,Z0(e,n,h,o,u)):(e=Vo(a.type,null,o,n,n.mode,u),e.ref=n.ref,e.return=n,n.child=e)}if(h=e.child,!Pf(e,u)){var x=h.memoizedProps;if(a=a.compare,a=a!==null?a:ua,a(x,o)&&e.ref===n.ref)return hr(e,n,u)}return n.flags|=1,e=ar(h,o),e.ref=n.ref,e.return=n,n.child=e}function Z0(e,n,a,o,u){if(e!==null){var h=e.memoizedProps;if(ua(h,o)&&e.ref===n.ref)if(vt=!1,n.pendingProps=o=h,Pf(e,u))(e.flags&131072)!==0&&(vt=!0);else return n.lanes=e.lanes,hr(e,n,u)}return Rf(e,n,a,o,u)}function W0(e,n,a,o){var u=o.children,h=e!==null?e.memoizedState:null;if(e===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),o.mode==="hidden"){if((n.flags&128)!==0){if(h=h!==null?h.baseLanes|a:a,e!==null){for(o=n.child=e.child,u=0;o!==null;)u=u|o.lanes|o.childLanes,o=o.sibling;o=u&~h}else o=0,n.child=null;return ep(e,n,h,a,o)}if((a&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},e!==null&&Jo(n,h!==null?h.cachePool:null),h!==null?n0(n,h):cf(),r0(n);else return o=n.lanes=536870912,ep(e,n,h!==null?h.baseLanes|a:a,a,o)}else h!==null?(Jo(n,h.cachePool),n0(n,h),$r(),n.memoizedState=null):(e!==null&&Jo(n,null),cf(),$r());return Ct(e,n,u,a),n.child}function Oa(e,n){return e!==null&&e.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function ep(e,n,a,o,u){var h=nf();return h=h===null?null:{parent:yt._currentValue,pool:h},n.memoizedState={baseLanes:a,cachePool:h},e!==null&&Jo(n,null),cf(),r0(n),e!==null&&cs(e,n,o,!0),n.childLanes=u,null}function hl(e,n){return n=ml({mode:n.mode,children:n.children},e.mode),n.ref=e.ref,e.child=n,n.return=e,n}function tp(e,n,a){return Mi(n,e.child,null,a),e=hl(n,n.pendingProps),e.flags|=2,nn(n),n.memoizedState=null,e}function Yx(e,n,a){var o=n.pendingProps,u=(n.flags&128)!==0;if(n.flags&=-129,e===null){if(ze){if(o.mode==="hidden")return e=hl(n,o),n.lanes=536870912,Oa(null,e);if(ff(n),(e=et)?(e=dg(e,En),e=e!==null&&e.data==="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:Dr!==null?{id:Fn,overflow:Vn}:null,retryLane:536870912,hydrationErrors:null},a=zm(e),a.return=n,n.child=a,Nt=n,et=null)):e=null,e===null)throw Br(n);return n.lanes=536870912,null}return hl(n,o)}var h=e.memoizedState;if(h!==null){var x=h.dehydrated;if(ff(n),u)if(n.flags&256)n.flags&=-257,n=tp(e,n,a);else if(n.memoizedState!==null)n.child=e.child,n.flags|=128,n=null;else throw Error(s(558));else if(vt||cs(e,n,a,!1),u=(a&e.childLanes)!==0,vt||u){if(o=Ze,o!==null&&(x=Mr(o,a),x!==0&&x!==h.retryLane))throw h.retryLane=x,Ei(e,x),Xt(o,e,x),Mf;Sl(),n=tp(e,n,a)}else e=h.treeContext,et=An(x.nextSibling),Nt=n,ze=!0,qr=null,En=!1,e!==null&&Im(n,e),n=hl(n,o),n.flags|=4096;return n}return e=ar(e.child,{mode:o.mode,children:o.children}),e.ref=n.ref,n.child=e,e.return=n,e}function dl(e,n){var a=n.ref;if(a===null)e!==null&&e.ref!==null&&(n.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(s(284));(e===null||e.ref!==a)&&(n.flags|=4194816)}}function Rf(e,n,a,o,u){return Ti(n),a=df(e,n,a,o,void 0,u),o=mf(),e!==null&&!vt?(pf(e,n,u),hr(e,n,u)):(ze&&o&&Yu(n),n.flags|=1,Ct(e,n,a,u),n.child)}function np(e,n,a,o,u,h){return Ti(n),n.updateQueue=null,a=s0(n,o,a,u),i0(e),o=mf(),e!==null&&!vt?(pf(e,n,h),hr(e,n,h)):(ze&&o&&Yu(n),n.flags|=1,Ct(e,n,a,h),n.child)}function rp(e,n,a,o,u){if(Ti(n),n.stateNode===null){var h=ss,x=a.contextType;typeof x=="object"&&x!==null&&(h=kt(x)),h=new a(o,h),n.memoizedState=h.state!==null&&h.state!==void 0?h.state:null,h.updater=kf,n.stateNode=h,h._reactInternals=n,h=n.stateNode,h.props=o,h.state=n.memoizedState,h.refs={},sf(n),x=a.contextType,h.context=typeof x=="object"&&x!==null?kt(x):ss,h.state=n.memoizedState,x=a.getDerivedStateFromProps,typeof x=="function"&&(Nf(n,a,x,o),h.state=n.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof h.getSnapshotBeforeUpdate=="function"||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(x=h.state,typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount(),x!==h.state&&kf.enqueueReplaceState(h,h.state,null),xa(n,o,h,u),va(),h.state=n.memoizedState),typeof h.componentDidMount=="function"&&(n.flags|=4194308),o=!0}else if(e===null){h=n.stateNode;var E=n.memoizedProps,R=Di(a,E);h.props=R;var H=h.context,J=a.contextType;x=ss,typeof J=="object"&&J!==null&&(x=kt(J));var ne=a.getDerivedStateFromProps;J=typeof ne=="function"||typeof h.getSnapshotBeforeUpdate=="function",E=n.pendingProps!==E,J||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(E||H!==x)&&H0(n,h,o,x),zr=!1;var F=n.memoizedState;h.state=F,xa(n,o,h,u),va(),H=n.memoizedState,E||F!==H||zr?(typeof ne=="function"&&(Nf(n,a,ne,o),H=n.memoizedState),(R=zr||$0(n,a,R,o,F,H,x))?(J||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount()),typeof h.componentDidMount=="function"&&(n.flags|=4194308)):(typeof h.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=o,n.memoizedState=H),h.props=o,h.state=H,h.context=x,o=R):(typeof h.componentDidMount=="function"&&(n.flags|=4194308),o=!1)}else{h=n.stateNode,af(e,n),x=n.memoizedProps,J=Di(a,x),h.props=J,ne=n.pendingProps,F=h.context,H=a.contextType,R=ss,typeof H=="object"&&H!==null&&(R=kt(H)),E=a.getDerivedStateFromProps,(H=typeof E=="function"||typeof h.getSnapshotBeforeUpdate=="function")||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(x!==ne||F!==R)&&H0(n,h,o,R),zr=!1,F=n.memoizedState,h.state=F,xa(n,o,h,u),va();var K=n.memoizedState;x!==ne||F!==K||zr||e!==null&&e.dependencies!==null&&Ko(e.dependencies)?(typeof E=="function"&&(Nf(n,a,E,o),K=n.memoizedState),(J=zr||$0(n,a,J,o,F,K,R)||e!==null&&e.dependencies!==null&&Ko(e.dependencies))?(H||typeof h.UNSAFE_componentWillUpdate!="function"&&typeof h.componentWillUpdate!="function"||(typeof h.componentWillUpdate=="function"&&h.componentWillUpdate(o,K,R),typeof h.UNSAFE_componentWillUpdate=="function"&&h.UNSAFE_componentWillUpdate(o,K,R)),typeof h.componentDidUpdate=="function"&&(n.flags|=4),typeof h.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof h.componentDidUpdate!="function"||x===e.memoizedProps&&F===e.memoizedState||(n.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||x===e.memoizedProps&&F===e.memoizedState||(n.flags|=1024),n.memoizedProps=o,n.memoizedState=K),h.props=o,h.state=K,h.context=R,o=J):(typeof h.componentDidUpdate!="function"||x===e.memoizedProps&&F===e.memoizedState||(n.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||x===e.memoizedProps&&F===e.memoizedState||(n.flags|=1024),o=!1)}return h=o,dl(e,n),o=(n.flags&128)!==0,h||o?(h=n.stateNode,a=o&&typeof a.getDerivedStateFromError!="function"?null:h.render(),n.flags|=1,e!==null&&o?(n.child=Mi(n,e.child,null,u),n.child=Mi(n,null,a,u)):Ct(e,n,a,u),n.memoizedState=h.state,e=n.child):e=hr(e,n,u),e}function ip(e,n,a,o){return Ai(),n.flags|=256,Ct(e,n,a,o),n.child}var Df={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function qf(e){return{baseLanes:e,cachePool:Ym()}}function Bf(e,n,a){return e=e!==null?e.childLanes&~a:0,n&&(e|=sn),e}function sp(e,n,a){var o=n.pendingProps,u=!1,h=(n.flags&128)!==0,x;if((x=h)||(x=e!==null&&e.memoizedState===null?!1:(ht.current&2)!==0),x&&(u=!0,n.flags&=-129),x=(n.flags&32)!==0,n.flags&=-33,e===null){if(ze){if(u?Ir(n):$r(),(e=et)?(e=dg(e,En),e=e!==null&&e.data!=="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:Dr!==null?{id:Fn,overflow:Vn}:null,retryLane:536870912,hydrationErrors:null},a=zm(e),a.return=n,n.child=a,Nt=n,et=null)):e=null,e===null)throw Br(n);return bh(e)?n.lanes=32:n.lanes=536870912,null}var E=o.children;return o=o.fallback,u?($r(),u=n.mode,E=ml({mode:"hidden",children:E},u),o=Oi(o,u,a,null),E.return=n,o.return=n,E.sibling=o,n.child=E,o=n.child,o.memoizedState=qf(a),o.childLanes=Bf(e,x,a),n.memoizedState=Df,Oa(null,o)):(Ir(n),Lf(n,E))}var R=e.memoizedState;if(R!==null&&(E=R.dehydrated,E!==null)){if(h)n.flags&256?(Ir(n),n.flags&=-257,n=zf(e,n,a)):n.memoizedState!==null?($r(),n.child=e.child,n.flags|=128,n=null):($r(),E=o.fallback,u=n.mode,o=ml({mode:"visible",children:o.children},u),E=Oi(E,u,a,null),E.flags|=2,o.return=n,E.return=n,o.sibling=E,n.child=o,Mi(n,e.child,null,a),o=n.child,o.memoizedState=qf(a),o.childLanes=Bf(e,x,a),n.memoizedState=Df,n=Oa(null,o));else if(Ir(n),bh(E)){if(x=E.nextSibling&&E.nextSibling.dataset,x)var H=x.dgst;x=H,o=Error(s(419)),o.stack="",o.digest=x,da({value:o,source:null,stack:null}),n=zf(e,n,a)}else if(vt||cs(e,n,a,!1),x=(a&e.childLanes)!==0,vt||x){if(x=Ze,x!==null&&(o=Mr(x,a),o!==0&&o!==R.retryLane))throw R.retryLane=o,Ei(e,o),Xt(x,e,o),Mf;yh(E)||Sl(),n=zf(e,n,a)}else yh(E)?(n.flags|=192,n.child=e.child,n=null):(e=R.treeContext,et=An(E.nextSibling),Nt=n,ze=!0,qr=null,En=!1,e!==null&&Im(n,e),n=Lf(n,o.children),n.flags|=4096);return n}return u?($r(),E=o.fallback,u=n.mode,R=e.child,H=R.sibling,o=ar(R,{mode:"hidden",children:o.children}),o.subtreeFlags=R.subtreeFlags&65011712,H!==null?E=ar(H,E):(E=Oi(E,u,a,null),E.flags|=2),E.return=n,o.return=n,o.sibling=E,n.child=o,Oa(null,o),o=n.child,E=e.child.memoizedState,E===null?E=qf(a):(u=E.cachePool,u!==null?(R=yt._currentValue,u=u.parent!==R?{parent:R,pool:R}:u):u=Ym(),E={baseLanes:E.baseLanes|a,cachePool:u}),o.memoizedState=E,o.childLanes=Bf(e,x,a),n.memoizedState=Df,Oa(e.child,o)):(Ir(n),a=e.child,e=a.sibling,a=ar(a,{mode:"visible",children:o.children}),a.return=n,a.sibling=null,e!==null&&(x=n.deletions,x===null?(n.deletions=[e],n.flags|=16):x.push(e)),n.child=a,n.memoizedState=null,a)}function Lf(e,n){return n=ml({mode:"visible",children:n},e.mode),n.return=e,e.child=n}function ml(e,n){return e=en(22,e,null,n),e.lanes=0,e}function zf(e,n,a){return Mi(n,e.child,null,a),e=Lf(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function ap(e,n,a){e.lanes|=n;var o=e.alternate;o!==null&&(o.lanes|=n),Zu(e.return,n,a)}function Uf(e,n,a,o,u,h){var x=e.memoizedState;x===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:o,tail:a,tailMode:u,treeForkCount:h}:(x.isBackwards=n,x.rendering=null,x.renderingStartTime=0,x.last=o,x.tail=a,x.tailMode=u,x.treeForkCount=h)}function op(e,n,a){var o=n.pendingProps,u=o.revealOrder,h=o.tail;o=o.children;var x=ht.current,E=(x&2)!==0;if(E?(x=x&1|2,n.flags|=128):x&=1,Ne(ht,x),Ct(e,n,o,a),o=ze?ha:0,!E&&e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&ap(e,a,n);else if(e.tag===19)ap(e,a,n);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break e;for(;e.sibling===null;){if(e.return===null||e.return===n)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(u){case"forwards":for(a=n.child,u=null;a!==null;)e=a.alternate,e!==null&&nl(e)===null&&(u=a),a=a.sibling;a=u,a===null?(u=n.child,n.child=null):(u=a.sibling,a.sibling=null),Uf(n,!1,u,a,h,o);break;case"backwards":case"unstable_legacy-backwards":for(a=null,u=n.child,n.child=null;u!==null;){if(e=u.alternate,e!==null&&nl(e)===null){n.child=u;break}e=u.sibling,u.sibling=a,a=u,u=e}Uf(n,!0,a,null,h,o);break;case"together":Uf(n,!1,null,null,void 0,o);break;default:n.memoizedState=null}return n.child}function hr(e,n,a){if(e!==null&&(n.dependencies=e.dependencies),Fr|=n.lanes,(a&n.childLanes)===0)if(e!==null){if(cs(e,n,a,!1),(a&n.childLanes)===0)return null}else return null;if(e!==null&&n.child!==e.child)throw Error(s(153));if(n.child!==null){for(e=n.child,a=ar(e,e.pendingProps),n.child=a,a.return=n;e.sibling!==null;)e=e.sibling,a=a.sibling=ar(e,e.pendingProps),a.return=n;a.sibling=null}return n.child}function Pf(e,n){return(e.lanes&n)!==0?!0:(e=e.dependencies,!!(e!==null&&Ko(e)))}function Kx(e,n,a){switch(n.tag){case 3:Dt(n,n.stateNode.containerInfo),Lr(n,yt,e.memoizedState.cache),Ai();break;case 27:case 5:qt(n);break;case 4:Dt(n,n.stateNode.containerInfo);break;case 10:Lr(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,ff(n),null;break;case 13:var o=n.memoizedState;if(o!==null)return o.dehydrated!==null?(Ir(n),n.flags|=128,null):(a&n.child.childLanes)!==0?sp(e,n,a):(Ir(n),e=hr(e,n,a),e!==null?e.sibling:null);Ir(n);break;case 19:var u=(e.flags&128)!==0;if(o=(a&n.childLanes)!==0,o||(cs(e,n,a,!1),o=(a&n.childLanes)!==0),u){if(o)return op(e,n,a);n.flags|=128}if(u=n.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),Ne(ht,ht.current),o)break;return null;case 22:return n.lanes=0,W0(e,n,a,n.pendingProps);case 24:Lr(n,yt,e.memoizedState.cache)}return hr(e,n,a)}function lp(e,n,a){if(e!==null)if(e.memoizedProps!==n.pendingProps)vt=!0;else{if(!Pf(e,a)&&(n.flags&128)===0)return vt=!1,Kx(e,n,a);vt=(e.flags&131072)!==0}else vt=!1,ze&&(n.flags&1048576)!==0&&Pm(n,ha,n.index);switch(n.lanes=0,n.tag){case 16:e:{var o=n.pendingProps;if(e=ki(n.elementType),n.type=e,typeof e=="function")Gu(e)?(o=Di(e,o),n.tag=1,n=rp(null,n,e,o,a)):(n.tag=0,n=Rf(null,n,e,o,a));else{if(e!=null){var u=e.$$typeof;if(u===ce){n.tag=11,n=J0(null,n,e,o,a);break e}else if(u===re){n.tag=14,n=Q0(null,n,e,o,a);break e}}throw n=_e(e)||e,Error(s(306,n,""))}}return n;case 0:return Rf(e,n,n.type,n.pendingProps,a);case 1:return o=n.type,u=Di(o,n.pendingProps),rp(e,n,o,u,a);case 3:e:{if(Dt(n,n.stateNode.containerInfo),e===null)throw Error(s(387));o=n.pendingProps;var h=n.memoizedState;u=h.element,af(e,n),xa(n,o,null,a);var x=n.memoizedState;if(o=x.cache,Lr(n,yt,o),o!==h.cache&&Wu(n,[yt],a,!0),va(),o=x.element,h.isDehydrated)if(h={element:o,isDehydrated:!1,cache:x.cache},n.updateQueue.baseState=h,n.memoizedState=h,n.flags&256){n=ip(e,n,o,a);break e}else if(o!==u){u=_n(Error(s(424)),n),da(u),n=ip(e,n,o,a);break e}else{switch(e=n.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(et=An(e.firstChild),Nt=n,ze=!0,qr=null,En=!0,a=Wm(n,null,o,a),n.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(Ai(),o===u){n=hr(e,n,a);break e}Ct(e,n,o,a)}n=n.child}return n;case 26:return dl(e,n),e===null?(a=vg(n.type,null,n.pendingProps,null))?n.memoizedState=a:ze||(a=n.type,e=n.pendingProps,o=kl(Ht.current).createElement(a),o[Qe]=n,o[ot]=e,Mt(o,a,e),D(o),n.stateNode=o):n.memoizedState=vg(n.type,e.memoizedProps,n.pendingProps,e.memoizedState),null;case 27:return qt(n),e===null&&ze&&(o=n.stateNode=gg(n.type,n.pendingProps,Ht.current),Nt=n,En=!0,u=et,Jr(n.type)?(vh=u,et=An(o.firstChild)):et=u),Ct(e,n,n.pendingProps.children,a),dl(e,n),e===null&&(n.flags|=4194304),n.child;case 5:return e===null&&ze&&((u=o=et)&&(o=E_(o,n.type,n.pendingProps,En),o!==null?(n.stateNode=o,Nt=n,et=An(o.firstChild),En=!1,u=!0):u=!1),u||Br(n)),qt(n),u=n.type,h=n.pendingProps,x=e!==null?e.memoizedProps:null,o=h.children,mh(u,h)?o=null:x!==null&&mh(u,x)&&(n.flags|=32),n.memoizedState!==null&&(u=df(e,n,Ux,null,null,a),Pa._currentValue=u),dl(e,n),Ct(e,n,o,a),n.child;case 6:return e===null&&ze&&((e=a=et)&&(a=O_(a,n.pendingProps,En),a!==null?(n.stateNode=a,Nt=n,et=null,e=!0):e=!1),e||Br(n)),null;case 13:return sp(e,n,a);case 4:return Dt(n,n.stateNode.containerInfo),o=n.pendingProps,e===null?n.child=Mi(n,null,o,a):Ct(e,n,o,a),n.child;case 11:return J0(e,n,n.type,n.pendingProps,a);case 7:return Ct(e,n,n.pendingProps,a),n.child;case 8:return Ct(e,n,n.pendingProps.children,a),n.child;case 12:return Ct(e,n,n.pendingProps.children,a),n.child;case 10:return o=n.pendingProps,Lr(n,n.type,o.value),Ct(e,n,o.children,a),n.child;case 9:return u=n.type._context,o=n.pendingProps.children,Ti(n),u=kt(u),o=o(u),n.flags|=1,Ct(e,n,o,a),n.child;case 14:return Q0(e,n,n.type,n.pendingProps,a);case 15:return Z0(e,n,n.type,n.pendingProps,a);case 19:return op(e,n,a);case 31:return Yx(e,n,a);case 22:return W0(e,n,a,n.pendingProps);case 24:return Ti(n),o=kt(yt),e===null?(u=nf(),u===null&&(u=Ze,h=ef(),u.pooledCache=h,h.refCount++,h!==null&&(u.pooledCacheLanes|=a),u=h),n.memoizedState={parent:o,cache:u},sf(n),Lr(n,yt,u)):((e.lanes&a)!==0&&(af(e,n),xa(n,null,null,a),va()),u=e.memoizedState,h=n.memoizedState,u.parent!==o?(u={parent:o,cache:o},n.memoizedState=u,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=u),Lr(n,yt,o)):(o=h.cache,Lr(n,yt,o),o!==u.cache&&Wu(n,[yt],a,!0))),Ct(e,n,n.pendingProps.children,a),n.child;case 29:throw n.pendingProps}throw Error(s(156,n.tag))}function dr(e){e.flags|=4}function If(e,n,a,o,u){if((n=(e.mode&32)!==0)&&(n=!1),n){if(e.flags|=16777216,(u&335544128)===u)if(e.stateNode.complete)e.flags|=8192;else if(qp())e.flags|=8192;else throw Ci=Zo,rf}else e.flags&=-16777217}function cp(e,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Eg(n))if(qp())e.flags|=8192;else throw Ci=Zo,rf}function pl(e,n){n!==null&&(e.flags|=4),e.flags&16384&&(n=e.tag!==22?Xi():536870912,e.lanes|=n,_s|=n)}function Aa(e,n){if(!ze)switch(e.tailMode){case"hidden":n=e.tail;for(var a=null;n!==null;)n.alternate!==null&&(a=n),n=n.sibling;a===null?e.tail=null:a.sibling=null;break;case"collapsed":a=e.tail;for(var o=null;a!==null;)a.alternate!==null&&(o=a),a=a.sibling;o===null?n||e.tail===null?e.tail=null:e.tail.sibling=null:o.sibling=null}}function tt(e){var n=e.alternate!==null&&e.alternate.child===e.child,a=0,o=0;if(n)for(var u=e.child;u!==null;)a|=u.lanes|u.childLanes,o|=u.subtreeFlags&65011712,o|=u.flags&65011712,u.return=e,u=u.sibling;else for(u=e.child;u!==null;)a|=u.lanes|u.childLanes,o|=u.subtreeFlags,o|=u.flags,u.return=e,u=u.sibling;return e.subtreeFlags|=o,e.childLanes=a,n}function Xx(e,n,a){var o=n.pendingProps;switch(Ku(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return tt(n),null;case 1:return tt(n),null;case 3:return a=n.stateNode,o=null,e!==null&&(o=e.memoizedState.cache),n.memoizedState.cache!==o&&(n.flags|=2048),cr(yt),ke(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(ls(n)?dr(n):e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,Ju())),tt(n),null;case 26:var u=n.type,h=n.memoizedState;return e===null?(dr(n),h!==null?(tt(n),cp(n,h)):(tt(n),If(n,u,null,o,a))):h?h!==e.memoizedState?(dr(n),tt(n),cp(n,h)):(tt(n),n.flags&=-16777217):(e=e.memoizedProps,e!==o&&dr(n),tt(n),If(n,u,e,o,a)),null;case 27:if(di(n),a=Ht.current,u=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==o&&dr(n);else{if(!o){if(n.stateNode===null)throw Error(s(166));return tt(n),null}e=be.current,ls(n)?$m(n):(e=gg(u,o,a),n.stateNode=e,dr(n))}return tt(n),null;case 5:if(di(n),u=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==o&&dr(n);else{if(!o){if(n.stateNode===null)throw Error(s(166));return tt(n),null}if(h=be.current,ls(n))$m(n);else{var x=kl(Ht.current);switch(h){case 1:h=x.createElementNS("http://www.w3.org/2000/svg",u);break;case 2:h=x.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;default:switch(u){case"svg":h=x.createElementNS("http://www.w3.org/2000/svg",u);break;case"math":h=x.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;case"script":h=x.createElement("div"),h.innerHTML="<script><\/script>",h=h.removeChild(h.firstChild);break;case"select":h=typeof o.is=="string"?x.createElement("select",{is:o.is}):x.createElement("select"),o.multiple?h.multiple=!0:o.size&&(h.size=o.size);break;default:h=typeof o.is=="string"?x.createElement(u,{is:o.is}):x.createElement(u)}}h[Qe]=n,h[ot]=o;e:for(x=n.child;x!==null;){if(x.tag===5||x.tag===6)h.appendChild(x.stateNode);else if(x.tag!==4&&x.tag!==27&&x.child!==null){x.child.return=x,x=x.child;continue}if(x===n)break e;for(;x.sibling===null;){if(x.return===null||x.return===n)break e;x=x.return}x.sibling.return=x.return,x=x.sibling}n.stateNode=h;e:switch(Mt(h,u,o),u){case"button":case"input":case"select":case"textarea":o=!!o.autoFocus;break e;case"img":o=!0;break e;default:o=!1}o&&dr(n)}}return tt(n),If(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,a),null;case 6:if(e&&n.stateNode!=null)e.memoizedProps!==o&&dr(n);else{if(typeof o!="string"&&n.stateNode===null)throw Error(s(166));if(e=Ht.current,ls(n)){if(e=n.stateNode,a=n.memoizedProps,o=null,u=Nt,u!==null)switch(u.tag){case 27:case 5:o=u.memoizedProps}e[Qe]=n,e=!!(e.nodeValue===a||o!==null&&o.suppressHydrationWarning===!0||sg(e.nodeValue,a)),e||Br(n,!0)}else e=kl(e).createTextNode(o),e[Qe]=n,n.stateNode=e}return tt(n),null;case 31:if(a=n.memoizedState,e===null||e.memoizedState!==null){if(o=ls(n),a!==null){if(e===null){if(!o)throw Error(s(318));if(e=n.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(s(557));e[Qe]=n}else Ai(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;tt(n),e=!1}else a=Ju(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return n.flags&256?(nn(n),n):(nn(n),null);if((n.flags&128)!==0)throw Error(s(558))}return tt(n),null;case 13:if(o=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(u=ls(n),o!==null&&o.dehydrated!==null){if(e===null){if(!u)throw Error(s(318));if(u=n.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(s(317));u[Qe]=n}else Ai(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;tt(n),u=!1}else u=Ju(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=u),u=!0;if(!u)return n.flags&256?(nn(n),n):(nn(n),null)}return nn(n),(n.flags&128)!==0?(n.lanes=a,n):(a=o!==null,e=e!==null&&e.memoizedState!==null,a&&(o=n.child,u=null,o.alternate!==null&&o.alternate.memoizedState!==null&&o.alternate.memoizedState.cachePool!==null&&(u=o.alternate.memoizedState.cachePool.pool),h=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(h=o.memoizedState.cachePool.pool),h!==u&&(o.flags|=2048)),a!==e&&a&&(n.child.flags|=8192),pl(n,n.updateQueue),tt(n),null);case 4:return ke(),e===null&&ch(n.stateNode.containerInfo),tt(n),null;case 10:return cr(n.type),tt(n),null;case 19:if(Se(ht),o=n.memoizedState,o===null)return tt(n),null;if(u=(n.flags&128)!==0,h=o.rendering,h===null)if(u)Aa(o,!1);else{if(ct!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(h=nl(e),h!==null){for(n.flags|=128,Aa(o,!1),e=h.updateQueue,n.updateQueue=e,pl(n,e),n.subtreeFlags=0,e=a,a=n.child;a!==null;)Lm(a,e),a=a.sibling;return Ne(ht,ht.current&1|2),ze&&or(n,o.treeForkCount),n.child}e=e.sibling}o.tail!==null&&nt()>xl&&(n.flags|=128,u=!0,Aa(o,!1),n.lanes=4194304)}else{if(!u)if(e=nl(h),e!==null){if(n.flags|=128,u=!0,e=e.updateQueue,n.updateQueue=e,pl(n,e),Aa(o,!0),o.tail===null&&o.tailMode==="hidden"&&!h.alternate&&!ze)return tt(n),null}else 2*nt()-o.renderingStartTime>xl&&a!==536870912&&(n.flags|=128,u=!0,Aa(o,!1),n.lanes=4194304);o.isBackwards?(h.sibling=n.child,n.child=h):(e=o.last,e!==null?e.sibling=h:n.child=h,o.last=h)}return o.tail!==null?(e=o.tail,o.rendering=e,o.tail=e.sibling,o.renderingStartTime=nt(),e.sibling=null,a=ht.current,Ne(ht,u?a&1|2:a&1),ze&&or(n,o.treeForkCount),e):(tt(n),null);case 22:case 23:return nn(n),uf(),o=n.memoizedState!==null,e!==null?e.memoizedState!==null!==o&&(n.flags|=8192):o&&(n.flags|=8192),o?(a&536870912)!==0&&(n.flags&128)===0&&(tt(n),n.subtreeFlags&6&&(n.flags|=8192)):tt(n),a=n.updateQueue,a!==null&&pl(n,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),o=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(o=n.memoizedState.cachePool.pool),o!==a&&(n.flags|=2048),e!==null&&Se(Ni),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),n.memoizedState.cache!==a&&(n.flags|=2048),cr(yt),tt(n),null;case 25:return null;case 30:return null}throw Error(s(156,n.tag))}function Jx(e,n){switch(Ku(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return cr(yt),ke(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 26:case 27:case 5:return di(n),null;case 31:if(n.memoizedState!==null){if(nn(n),n.alternate===null)throw Error(s(340));Ai()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 13:if(nn(n),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(s(340));Ai()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return Se(ht),null;case 4:return ke(),null;case 10:return cr(n.type),null;case 22:case 23:return nn(n),uf(),e!==null&&Se(Ni),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return cr(yt),null;case 25:return null;default:return null}}function up(e,n){switch(Ku(n),n.tag){case 3:cr(yt),ke();break;case 26:case 27:case 5:di(n);break;case 4:ke();break;case 31:n.memoizedState!==null&&nn(n);break;case 13:nn(n);break;case 19:Se(ht);break;case 10:cr(n.type);break;case 22:case 23:nn(n),uf(),e!==null&&Se(Ni);break;case 24:cr(yt)}}function ja(e,n){try{var a=n.updateQueue,o=a!==null?a.lastEffect:null;if(o!==null){var u=o.next;a=u;do{if((a.tag&e)===e){o=void 0;var h=a.create,x=a.inst;o=h(),x.destroy=o}a=a.next}while(a!==u)}}catch(E){Ve(n,n.return,E)}}function Hr(e,n,a){try{var o=n.updateQueue,u=o!==null?o.lastEffect:null;if(u!==null){var h=u.next;o=h;do{if((o.tag&e)===e){var x=o.inst,E=x.destroy;if(E!==void 0){x.destroy=void 0,u=n;var R=a,H=E;try{H()}catch(J){Ve(u,R,J)}}}o=o.next}while(o!==h)}}catch(J){Ve(n,n.return,J)}}function fp(e){var n=e.updateQueue;if(n!==null){var a=e.stateNode;try{t0(n,a)}catch(o){Ve(e,e.return,o)}}}function hp(e,n,a){a.props=Di(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(o){Ve(e,n,o)}}function Ta(e,n){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var o=e.stateNode;break;case 30:o=e.stateNode;break;default:o=e.stateNode}typeof a=="function"?e.refCleanup=a(o):a.current=o}}catch(u){Ve(e,n,u)}}function Yn(e,n){var a=e.ref,o=e.refCleanup;if(a!==null)if(typeof o=="function")try{o()}catch(u){Ve(e,n,u)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(u){Ve(e,n,u)}else a.current=null}function dp(e){var n=e.type,a=e.memoizedProps,o=e.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":a.autoFocus&&o.focus();break e;case"img":a.src?o.src=a.src:a.srcSet&&(o.srcset=a.srcSet)}}catch(u){Ve(e,e.return,u)}}function $f(e,n,a){try{var o=e.stateNode;b_(o,e.type,a,n),o[ot]=n}catch(u){Ve(e,e.return,u)}}function mp(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Jr(e.type)||e.tag===4}function Hf(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||mp(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Jr(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Gf(e,n,a){var o=e.tag;if(o===5||o===6)e=e.stateNode,n?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,n):(n=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,n.appendChild(e),a=a._reactRootContainer,a!=null||n.onclick!==null||(n.onclick=ir));else if(o!==4&&(o===27&&Jr(e.type)&&(a=e.stateNode,n=null),e=e.child,e!==null))for(Gf(e,n,a),e=e.sibling;e!==null;)Gf(e,n,a),e=e.sibling}function gl(e,n,a){var o=e.tag;if(o===5||o===6)e=e.stateNode,n?a.insertBefore(e,n):a.appendChild(e);else if(o!==4&&(o===27&&Jr(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(gl(e,n,a),e=e.sibling;e!==null;)gl(e,n,a),e=e.sibling}function pp(e){var n=e.stateNode,a=e.memoizedProps;try{for(var o=e.type,u=n.attributes;u.length;)n.removeAttributeNode(u[0]);Mt(n,o,a),n[Qe]=e,n[ot]=a}catch(h){Ve(e,e.return,h)}}var mr=!1,xt=!1,Ff=!1,gp=typeof WeakSet=="function"?WeakSet:Set,Ot=null;function Qx(e,n){if(e=e.containerInfo,hh=Ll,e=Tm(e),Lu(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var o=a.getSelection&&a.getSelection();if(o&&o.rangeCount!==0){a=o.anchorNode;var u=o.anchorOffset,h=o.focusNode;o=o.focusOffset;try{a.nodeType,h.nodeType}catch{a=null;break e}var x=0,E=-1,R=-1,H=0,J=0,ne=e,F=null;t:for(;;){for(var K;ne!==a||u!==0&&ne.nodeType!==3||(E=x+u),ne!==h||o!==0&&ne.nodeType!==3||(R=x+o),ne.nodeType===3&&(x+=ne.nodeValue.length),(K=ne.firstChild)!==null;)F=ne,ne=K;for(;;){if(ne===e)break t;if(F===a&&++H===u&&(E=x),F===h&&++J===o&&(R=x),(K=ne.nextSibling)!==null)break;ne=F,F=ne.parentNode}ne=K}a=E===-1||R===-1?null:{start:E,end:R}}else a=null}a=a||{start:0,end:0}}else a=null;for(dh={focusedElem:e,selectionRange:a},Ll=!1,Ot=n;Ot!==null;)if(n=Ot,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,Ot=e;else for(;Ot!==null;){switch(n=Ot,h=n.alternate,e=n.flags,n.tag){case 0:if((e&4)!==0&&(e=n.updateQueue,e=e!==null?e.events:null,e!==null))for(a=0;a<e.length;a++)u=e[a],u.ref.impl=u.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&h!==null){e=void 0,a=n,u=h.memoizedProps,h=h.memoizedState,o=a.stateNode;try{var ge=Di(a.type,u);e=o.getSnapshotBeforeUpdate(ge,h),o.__reactInternalSnapshotBeforeUpdate=e}catch(Ee){Ve(a,a.return,Ee)}}break;case 3:if((e&1024)!==0){if(e=n.stateNode.containerInfo,a=e.nodeType,a===9)gh(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":gh(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(s(163))}if(e=n.sibling,e!==null){e.return=n.return,Ot=e;break}Ot=n.return}}function yp(e,n,a){var o=a.flags;switch(a.tag){case 0:case 11:case 15:gr(e,a),o&4&&ja(5,a);break;case 1:if(gr(e,a),o&4)if(e=a.stateNode,n===null)try{e.componentDidMount()}catch(x){Ve(a,a.return,x)}else{var u=Di(a.type,n.memoizedProps);n=n.memoizedState;try{e.componentDidUpdate(u,n,e.__reactInternalSnapshotBeforeUpdate)}catch(x){Ve(a,a.return,x)}}o&64&&fp(a),o&512&&Ta(a,a.return);break;case 3:if(gr(e,a),o&64&&(e=a.updateQueue,e!==null)){if(n=null,a.child!==null)switch(a.child.tag){case 27:case 5:n=a.child.stateNode;break;case 1:n=a.child.stateNode}try{t0(e,n)}catch(x){Ve(a,a.return,x)}}break;case 27:n===null&&o&4&&pp(a);case 26:case 5:gr(e,a),n===null&&o&4&&dp(a),o&512&&Ta(a,a.return);break;case 12:gr(e,a);break;case 31:gr(e,a),o&4&&xp(e,a);break;case 13:gr(e,a),o&4&&_p(e,a),o&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=a_.bind(null,a),A_(e,a))));break;case 22:if(o=a.memoizedState!==null||mr,!o){n=n!==null&&n.memoizedState!==null||xt,u=mr;var h=xt;mr=o,(xt=n)&&!h?yr(e,a,(a.subtreeFlags&8772)!==0):gr(e,a),mr=u,xt=h}break;case 30:break;default:gr(e,a)}}function bp(e){var n=e.alternate;n!==null&&(e.alternate=null,bp(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&Ji(n)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var rt=null,Ft=!1;function pr(e,n,a){for(a=a.child;a!==null;)vp(e,n,a),a=a.sibling}function vp(e,n,a){if(ft&&typeof ft.onCommitFiberUnmount=="function")try{ft.onCommitFiberUnmount(pi,a)}catch{}switch(a.tag){case 26:xt||Yn(a,n),pr(e,n,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:xt||Yn(a,n);var o=rt,u=Ft;Jr(a.type)&&(rt=a.stateNode,Ft=!1),pr(e,n,a),La(a.stateNode),rt=o,Ft=u;break;case 5:xt||Yn(a,n);case 6:if(o=rt,u=Ft,rt=null,pr(e,n,a),rt=o,Ft=u,rt!==null)if(Ft)try{(rt.nodeType===9?rt.body:rt.nodeName==="HTML"?rt.ownerDocument.body:rt).removeChild(a.stateNode)}catch(h){Ve(a,n,h)}else try{rt.removeChild(a.stateNode)}catch(h){Ve(a,n,h)}break;case 18:rt!==null&&(Ft?(e=rt,fg(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),Ns(e)):fg(rt,a.stateNode));break;case 4:o=rt,u=Ft,rt=a.stateNode.containerInfo,Ft=!0,pr(e,n,a),rt=o,Ft=u;break;case 0:case 11:case 14:case 15:Hr(2,a,n),xt||Hr(4,a,n),pr(e,n,a);break;case 1:xt||(Yn(a,n),o=a.stateNode,typeof o.componentWillUnmount=="function"&&hp(a,n,o)),pr(e,n,a);break;case 21:pr(e,n,a);break;case 22:xt=(o=xt)||a.memoizedState!==null,pr(e,n,a),xt=o;break;default:pr(e,n,a)}}function xp(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Ns(e)}catch(a){Ve(n,n.return,a)}}}function _p(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Ns(e)}catch(a){Ve(n,n.return,a)}}function Zx(e){switch(e.tag){case 31:case 13:case 19:var n=e.stateNode;return n===null&&(n=e.stateNode=new gp),n;case 22:return e=e.stateNode,n=e._retryCache,n===null&&(n=e._retryCache=new gp),n;default:throw Error(s(435,e.tag))}}function yl(e,n){var a=Zx(e);n.forEach(function(o){if(!a.has(o)){a.add(o);var u=o_.bind(null,e,o);o.then(u,u)}})}function Vt(e,n){var a=n.deletions;if(a!==null)for(var o=0;o<a.length;o++){var u=a[o],h=e,x=n,E=x;e:for(;E!==null;){switch(E.tag){case 27:if(Jr(E.type)){rt=E.stateNode,Ft=!1;break e}break;case 5:rt=E.stateNode,Ft=!1;break e;case 3:case 4:rt=E.stateNode.containerInfo,Ft=!0;break e}E=E.return}if(rt===null)throw Error(s(160));vp(h,x,u),rt=null,Ft=!1,h=u.alternate,h!==null&&(h.return=null),u.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)wp(n,e),n=n.sibling}var Bn=null;function wp(e,n){var a=e.alternate,o=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Vt(n,e),Yt(e),o&4&&(Hr(3,e,e.return),ja(3,e),Hr(5,e,e.return));break;case 1:Vt(n,e),Yt(e),o&512&&(xt||a===null||Yn(a,a.return)),o&64&&mr&&(e=e.updateQueue,e!==null&&(o=e.callbacks,o!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?o:a.concat(o))));break;case 26:var u=Bn;if(Vt(n,e),Yt(e),o&512&&(xt||a===null||Yn(a,a.return)),o&4){var h=a!==null?a.memoizedState:null;if(o=e.memoizedState,a===null)if(o===null)if(e.stateNode===null){e:{o=e.type,a=e.memoizedProps,u=u.ownerDocument||u;t:switch(o){case"title":h=u.getElementsByTagName("title")[0],(!h||h[wt]||h[Qe]||h.namespaceURI==="http://www.w3.org/2000/svg"||h.hasAttribute("itemprop"))&&(h=u.createElement(o),u.head.insertBefore(h,u.querySelector("head > title"))),Mt(h,o,a),h[Qe]=e,D(h),o=h;break e;case"link":var x=wg("link","href",u).get(o+(a.href||""));if(x){for(var E=0;E<x.length;E++)if(h=x[E],h.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&h.getAttribute("rel")===(a.rel==null?null:a.rel)&&h.getAttribute("title")===(a.title==null?null:a.title)&&h.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){x.splice(E,1);break t}}h=u.createElement(o),Mt(h,o,a),u.head.appendChild(h);break;case"meta":if(x=wg("meta","content",u).get(o+(a.content||""))){for(E=0;E<x.length;E++)if(h=x[E],h.getAttribute("content")===(a.content==null?null:""+a.content)&&h.getAttribute("name")===(a.name==null?null:a.name)&&h.getAttribute("property")===(a.property==null?null:a.property)&&h.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&h.getAttribute("charset")===(a.charSet==null?null:a.charSet)){x.splice(E,1);break t}}h=u.createElement(o),Mt(h,o,a),u.head.appendChild(h);break;default:throw Error(s(468,o))}h[Qe]=e,D(h),o=h}e.stateNode=o}else Sg(u,e.type,e.stateNode);else e.stateNode=_g(u,o,e.memoizedProps);else h!==o?(h===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):h.count--,o===null?Sg(u,e.type,e.stateNode):_g(u,o,e.memoizedProps)):o===null&&e.stateNode!==null&&$f(e,e.memoizedProps,a.memoizedProps)}break;case 27:Vt(n,e),Yt(e),o&512&&(xt||a===null||Yn(a,a.return)),a!==null&&o&4&&$f(e,e.memoizedProps,a.memoizedProps);break;case 5:if(Vt(n,e),Yt(e),o&512&&(xt||a===null||Yn(a,a.return)),e.flags&32){u=e.stateNode;try{Zi(u,"")}catch(ge){Ve(e,e.return,ge)}}o&4&&e.stateNode!=null&&(u=e.memoizedProps,$f(e,u,a!==null?a.memoizedProps:u)),o&1024&&(Ff=!0);break;case 6:if(Vt(n,e),Yt(e),o&4){if(e.stateNode===null)throw Error(s(162));o=e.memoizedProps,a=e.stateNode;try{a.nodeValue=o}catch(ge){Ve(e,e.return,ge)}}break;case 3:if(Rl=null,u=Bn,Bn=Cl(n.containerInfo),Vt(n,e),Bn=u,Yt(e),o&4&&a!==null&&a.memoizedState.isDehydrated)try{Ns(n.containerInfo)}catch(ge){Ve(e,e.return,ge)}Ff&&(Ff=!1,Sp(e));break;case 4:o=Bn,Bn=Cl(e.stateNode.containerInfo),Vt(n,e),Yt(e),Bn=o;break;case 12:Vt(n,e),Yt(e);break;case 31:Vt(n,e),Yt(e),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,yl(e,o)));break;case 13:Vt(n,e),Yt(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(vl=nt()),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,yl(e,o)));break;case 22:u=e.memoizedState!==null;var R=a!==null&&a.memoizedState!==null,H=mr,J=xt;if(mr=H||u,xt=J||R,Vt(n,e),xt=J,mr=H,Yt(e),o&8192)e:for(n=e.stateNode,n._visibility=u?n._visibility&-2:n._visibility|1,u&&(a===null||R||mr||xt||qi(e)),a=null,n=e;;){if(n.tag===5||n.tag===26){if(a===null){R=a=n;try{if(h=R.stateNode,u)x=h.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none";else{E=R.stateNode;var ne=R.memoizedProps.style,F=ne!=null&&ne.hasOwnProperty("display")?ne.display:null;E.style.display=F==null||typeof F=="boolean"?"":(""+F).trim()}}catch(ge){Ve(R,R.return,ge)}}}else if(n.tag===6){if(a===null){R=n;try{R.stateNode.nodeValue=u?"":R.memoizedProps}catch(ge){Ve(R,R.return,ge)}}}else if(n.tag===18){if(a===null){R=n;try{var K=R.stateNode;u?hg(K,!0):hg(R.stateNode,!1)}catch(ge){Ve(R,R.return,ge)}}}else if((n.tag!==22&&n.tag!==23||n.memoizedState===null||n===e)&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break e;for(;n.sibling===null;){if(n.return===null||n.return===e)break e;a===n&&(a=null),n=n.return}a===n&&(a=null),n.sibling.return=n.return,n=n.sibling}o&4&&(o=e.updateQueue,o!==null&&(a=o.retryQueue,a!==null&&(o.retryQueue=null,yl(e,a))));break;case 19:Vt(n,e),Yt(e),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,yl(e,o)));break;case 30:break;case 21:break;default:Vt(n,e),Yt(e)}}function Yt(e){var n=e.flags;if(n&2){try{for(var a,o=e.return;o!==null;){if(mp(o)){a=o;break}o=o.return}if(a==null)throw Error(s(160));switch(a.tag){case 27:var u=a.stateNode,h=Hf(e);gl(e,h,u);break;case 5:var x=a.stateNode;a.flags&32&&(Zi(x,""),a.flags&=-33);var E=Hf(e);gl(e,E,x);break;case 3:case 4:var R=a.stateNode.containerInfo,H=Hf(e);Gf(e,H,R);break;default:throw Error(s(161))}}catch(J){Ve(e,e.return,J)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function Sp(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var n=e;Sp(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),e=e.sibling}}function gr(e,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)yp(e,n.alternate,n),n=n.sibling}function qi(e){for(e=e.child;e!==null;){var n=e;switch(n.tag){case 0:case 11:case 14:case 15:Hr(4,n,n.return),qi(n);break;case 1:Yn(n,n.return);var a=n.stateNode;typeof a.componentWillUnmount=="function"&&hp(n,n.return,a),qi(n);break;case 27:La(n.stateNode);case 26:case 5:Yn(n,n.return),qi(n);break;case 22:n.memoizedState===null&&qi(n);break;case 30:qi(n);break;default:qi(n)}e=e.sibling}}function yr(e,n,a){for(a=a&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var o=n.alternate,u=e,h=n,x=h.flags;switch(h.tag){case 0:case 11:case 15:yr(u,h,a),ja(4,h);break;case 1:if(yr(u,h,a),o=h,u=o.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(H){Ve(o,o.return,H)}if(o=h,u=o.updateQueue,u!==null){var E=o.stateNode;try{var R=u.shared.hiddenCallbacks;if(R!==null)for(u.shared.hiddenCallbacks=null,u=0;u<R.length;u++)e0(R[u],E)}catch(H){Ve(o,o.return,H)}}a&&x&64&&fp(h),Ta(h,h.return);break;case 27:pp(h);case 26:case 5:yr(u,h,a),a&&o===null&&x&4&&dp(h),Ta(h,h.return);break;case 12:yr(u,h,a);break;case 31:yr(u,h,a),a&&x&4&&xp(u,h);break;case 13:yr(u,h,a),a&&x&4&&_p(u,h);break;case 22:h.memoizedState===null&&yr(u,h,a),Ta(h,h.return);break;case 30:break;default:yr(u,h,a)}n=n.sibling}}function Vf(e,n){var a=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),e=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(e=n.memoizedState.cachePool.pool),e!==a&&(e!=null&&e.refCount++,a!=null&&ma(a))}function Yf(e,n){e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&ma(e))}function Ln(e,n,a,o){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Ep(e,n,a,o),n=n.sibling}function Ep(e,n,a,o){var u=n.flags;switch(n.tag){case 0:case 11:case 15:Ln(e,n,a,o),u&2048&&ja(9,n);break;case 1:Ln(e,n,a,o);break;case 3:Ln(e,n,a,o),u&2048&&(e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&ma(e)));break;case 12:if(u&2048){Ln(e,n,a,o),e=n.stateNode;try{var h=n.memoizedProps,x=h.id,E=h.onPostCommit;typeof E=="function"&&E(x,n.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(R){Ve(n,n.return,R)}}else Ln(e,n,a,o);break;case 31:Ln(e,n,a,o);break;case 13:Ln(e,n,a,o);break;case 23:break;case 22:h=n.stateNode,x=n.alternate,n.memoizedState!==null?h._visibility&2?Ln(e,n,a,o):Na(e,n):h._visibility&2?Ln(e,n,a,o):(h._visibility|=2,bs(e,n,a,o,(n.subtreeFlags&10256)!==0||!1)),u&2048&&Vf(x,n);break;case 24:Ln(e,n,a,o),u&2048&&Yf(n.alternate,n);break;default:Ln(e,n,a,o)}}function bs(e,n,a,o,u){for(u=u&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var h=e,x=n,E=a,R=o,H=x.flags;switch(x.tag){case 0:case 11:case 15:bs(h,x,E,R,u),ja(8,x);break;case 23:break;case 22:var J=x.stateNode;x.memoizedState!==null?J._visibility&2?bs(h,x,E,R,u):Na(h,x):(J._visibility|=2,bs(h,x,E,R,u)),u&&H&2048&&Vf(x.alternate,x);break;case 24:bs(h,x,E,R,u),u&&H&2048&&Yf(x.alternate,x);break;default:bs(h,x,E,R,u)}n=n.sibling}}function Na(e,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var a=e,o=n,u=o.flags;switch(o.tag){case 22:Na(a,o),u&2048&&Vf(o.alternate,o);break;case 24:Na(a,o),u&2048&&Yf(o.alternate,o);break;default:Na(a,o)}n=n.sibling}}var ka=8192;function vs(e,n,a){if(e.subtreeFlags&ka)for(e=e.child;e!==null;)Op(e,n,a),e=e.sibling}function Op(e,n,a){switch(e.tag){case 26:vs(e,n,a),e.flags&ka&&e.memoizedState!==null&&z_(a,Bn,e.memoizedState,e.memoizedProps);break;case 5:vs(e,n,a);break;case 3:case 4:var o=Bn;Bn=Cl(e.stateNode.containerInfo),vs(e,n,a),Bn=o;break;case 22:e.memoizedState===null&&(o=e.alternate,o!==null&&o.memoizedState!==null?(o=ka,ka=16777216,vs(e,n,a),ka=o):vs(e,n,a));break;default:vs(e,n,a)}}function Ap(e){var n=e.alternate;if(n!==null&&(e=n.child,e!==null)){n.child=null;do n=e.sibling,e.sibling=null,e=n;while(e!==null)}}function Ca(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var o=n[a];Ot=o,Tp(o,e)}Ap(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)jp(e),e=e.sibling}function jp(e){switch(e.tag){case 0:case 11:case 15:Ca(e),e.flags&2048&&Hr(9,e,e.return);break;case 3:Ca(e);break;case 12:Ca(e);break;case 22:var n=e.stateNode;e.memoizedState!==null&&n._visibility&2&&(e.return===null||e.return.tag!==13)?(n._visibility&=-3,bl(e)):Ca(e);break;default:Ca(e)}}function bl(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var o=n[a];Ot=o,Tp(o,e)}Ap(e)}for(e=e.child;e!==null;){switch(n=e,n.tag){case 0:case 11:case 15:Hr(8,n,n.return),bl(n);break;case 22:a=n.stateNode,a._visibility&2&&(a._visibility&=-3,bl(n));break;default:bl(n)}e=e.sibling}}function Tp(e,n){for(;Ot!==null;){var a=Ot;switch(a.tag){case 0:case 11:case 15:Hr(8,a,n);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var o=a.memoizedState.cachePool.pool;o!=null&&o.refCount++}break;case 24:ma(a.memoizedState.cache)}if(o=a.child,o!==null)o.return=a,Ot=o;else e:for(a=e;Ot!==null;){o=Ot;var u=o.sibling,h=o.return;if(bp(o),o===a){Ot=null;break e}if(u!==null){u.return=h,Ot=u;break e}Ot=h}}}var Wx={getCacheForType:function(e){var n=kt(yt),a=n.data.get(e);return a===void 0&&(a=e(),n.data.set(e,a)),a},cacheSignal:function(){return kt(yt).controller.signal}},e_=typeof WeakMap=="function"?WeakMap:Map,Ge=0,Ze=null,De=null,Be=0,Fe=0,rn=null,Gr=!1,xs=!1,Kf=!1,br=0,ct=0,Fr=0,Bi=0,Xf=0,sn=0,_s=0,Ma=null,Kt=null,Jf=!1,vl=0,Np=0,xl=1/0,_l=null,Vr=null,St=0,Yr=null,ws=null,vr=0,Qf=0,Zf=null,kp=null,Ra=0,Wf=null;function an(){return(Ge&2)!==0&&Be!==0?Be&-Be:Y.T!==null?sh():ta()}function Cp(){if(sn===0)if((Be&536870912)===0||ze){var e=tr;tr<<=1,(tr&3932160)===0&&(tr=262144),sn=e}else sn=536870912;return e=tn.current,e!==null&&(e.flags|=32),sn}function Xt(e,n,a){(e===Ze&&(Fe===2||Fe===9)||e.cancelPendingCommit!==null)&&(Ss(e,0),Kr(e,Be,sn,!1)),Rn(e,a),((Ge&2)===0||e!==Ze)&&(e===Ze&&((Ge&2)===0&&(Bi|=a),ct===4&&Kr(e,Be,sn,!1)),Kn(e))}function Mp(e,n,a){if((Ge&6)!==0)throw Error(s(327));var o=!a&&(n&127)===0&&(n&e.expiredLanes)===0||yi(e,n),u=o?r_(e,n):th(e,n,!0),h=o;do{if(u===0){xs&&!o&&Kr(e,n,0,!1);break}else{if(a=e.current.alternate,h&&!t_(a)){u=th(e,n,!1),h=!1;continue}if(u===2){if(h=n,e.errorRecoveryDisabledLanes&h)var x=0;else x=e.pendingLanes&-536870913,x=x!==0?x:x&536870912?536870912:0;if(x!==0){n=x;e:{var E=e;u=Ma;var R=E.current.memoizedState.isDehydrated;if(R&&(Ss(E,x).flags|=256),x=th(E,x,!1),x!==2){if(Kf&&!R){E.errorRecoveryDisabledLanes|=h,Bi|=h,u=4;break e}h=Kt,Kt=u,h!==null&&(Kt===null?Kt=h:Kt.push.apply(Kt,h))}u=x}if(h=!1,u!==2)continue}}if(u===1){Ss(e,0),Kr(e,n,0,!0);break}e:{switch(o=e,h=u,h){case 0:case 1:throw Error(s(345));case 4:if((n&4194048)!==n)break;case 6:Kr(o,n,sn,!Gr);break e;case 2:Kt=null;break;case 3:case 5:break;default:throw Error(s(329))}if((n&62914560)===n&&(u=vl+300-nt(),10<u)){if(Kr(o,n,sn,!Gr),gi(o,0,!0)!==0)break e;vr=n,o.timeoutHandle=cg(Rp.bind(null,o,a,Kt,_l,Jf,n,sn,Bi,_s,Gr,h,"Throttled",-0,0),u);break e}Rp(o,a,Kt,_l,Jf,n,sn,Bi,_s,Gr,h,null,-0,0)}}break}while(!0);Kn(e)}function Rp(e,n,a,o,u,h,x,E,R,H,J,ne,F,K){if(e.timeoutHandle=-1,ne=n.subtreeFlags,ne&8192||(ne&16785408)===16785408){ne={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ir},Op(n,h,ne);var ge=(h&62914560)===h?vl-nt():(h&4194048)===h?Np-nt():0;if(ge=U_(ne,ge),ge!==null){vr=h,e.cancelPendingCommit=ge(Ip.bind(null,e,n,h,a,o,u,x,E,R,J,ne,null,F,K)),Kr(e,h,x,!H);return}}Ip(e,n,h,a,o,u,x,E,R)}function t_(e){for(var n=e;;){var a=n.tag;if((a===0||a===11||a===15)&&n.flags&16384&&(a=n.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var o=0;o<a.length;o++){var u=a[o],h=u.getSnapshot;u=u.value;try{if(!Wt(h(),u))return!1}catch{return!1}}if(a=n.child,n.subtreeFlags&16384&&a!==null)a.return=n,n=a;else{if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function Kr(e,n,a,o){n&=~Xf,n&=~Bi,e.suspendedLanes|=n,e.pingedLanes&=~n,o&&(e.warmLanes|=n),o=e.expirationTimes;for(var u=n;0<u;){var h=31-Bt(u),x=1<<h;o[h]=-1,u&=~x}a!==0&&Cr(e,a,n)}function wl(){return(Ge&6)===0?(Da(0),!1):!0}function eh(){if(De!==null){if(Fe===0)var e=De.return;else e=De,lr=ji=null,gf(e),ds=null,ga=0,e=De;for(;e!==null;)up(e.alternate,e),e=e.return;De=null}}function Ss(e,n){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,__(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),vr=0,eh(),Ze=e,De=a=ar(e.current,null),Be=n,Fe=0,rn=null,Gr=!1,xs=yi(e,n),Kf=!1,_s=sn=Xf=Bi=Fr=ct=0,Kt=Ma=null,Jf=!1,(n&8)!==0&&(n|=n&32);var o=e.entangledLanes;if(o!==0)for(e=e.entanglements,o&=n;0<o;){var u=31-Bt(o),h=1<<u;n|=e[u],o&=~h}return br=n,Ho(),a}function Dp(e,n){Ce=null,Y.H=Ea,n===hs||n===Qo?(n=Jm(),Fe=3):n===rf?(n=Jm(),Fe=4):Fe=n===Mf?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,rn=n,De===null&&(ct=1,fl(e,_n(n,e.current)))}function qp(){var e=tn.current;return e===null?!0:(Be&4194048)===Be?On===null:(Be&62914560)===Be||(Be&536870912)!==0?e===On:!1}function Bp(){var e=Y.H;return Y.H=Ea,e===null?Ea:e}function Lp(){var e=Y.A;return Y.A=Wx,e}function Sl(){ct=4,Gr||(Be&4194048)!==Be&&tn.current!==null||(xs=!0),(Fr&134217727)===0&&(Bi&134217727)===0||Ze===null||Kr(Ze,Be,sn,!1)}function th(e,n,a){var o=Ge;Ge|=2;var u=Bp(),h=Lp();(Ze!==e||Be!==n)&&(_l=null,Ss(e,n)),n=!1;var x=ct;e:do try{if(Fe!==0&&De!==null){var E=De,R=rn;switch(Fe){case 8:eh(),x=6;break e;case 3:case 2:case 9:case 6:tn.current===null&&(n=!0);var H=Fe;if(Fe=0,rn=null,Es(e,E,R,H),a&&xs){x=0;break e}break;default:H=Fe,Fe=0,rn=null,Es(e,E,R,H)}}n_(),x=ct;break}catch(J){Dp(e,J)}while(!0);return n&&e.shellSuspendCounter++,lr=ji=null,Ge=o,Y.H=u,Y.A=h,De===null&&(Ze=null,Be=0,Ho()),x}function n_(){for(;De!==null;)zp(De)}function r_(e,n){var a=Ge;Ge|=2;var o=Bp(),u=Lp();Ze!==e||Be!==n?(_l=null,xl=nt()+500,Ss(e,n)):xs=yi(e,n);e:do try{if(Fe!==0&&De!==null){n=De;var h=rn;t:switch(Fe){case 1:Fe=0,rn=null,Es(e,n,h,1);break;case 2:case 9:if(Km(h)){Fe=0,rn=null,Up(n);break}n=function(){Fe!==2&&Fe!==9||Ze!==e||(Fe=7),Kn(e)},h.then(n,n);break e;case 3:Fe=7;break e;case 4:Fe=5;break e;case 7:Km(h)?(Fe=0,rn=null,Up(n)):(Fe=0,rn=null,Es(e,n,h,7));break;case 5:var x=null;switch(De.tag){case 26:x=De.memoizedState;case 5:case 27:var E=De;if(x?Eg(x):E.stateNode.complete){Fe=0,rn=null;var R=E.sibling;if(R!==null)De=R;else{var H=E.return;H!==null?(De=H,El(H)):De=null}break t}}Fe=0,rn=null,Es(e,n,h,5);break;case 6:Fe=0,rn=null,Es(e,n,h,6);break;case 8:eh(),ct=6;break e;default:throw Error(s(462))}}i_();break}catch(J){Dp(e,J)}while(!0);return lr=ji=null,Y.H=o,Y.A=u,Ge=a,De!==null?0:(Ze=null,Be=0,Ho(),ct)}function i_(){for(;De!==null&&!Ao();)zp(De)}function zp(e){var n=lp(e.alternate,e,br);e.memoizedProps=e.pendingProps,n===null?El(e):De=n}function Up(e){var n=e,a=n.alternate;switch(n.tag){case 15:case 0:n=np(a,n,n.pendingProps,n.type,void 0,Be);break;case 11:n=np(a,n,n.pendingProps,n.type.render,n.ref,Be);break;case 5:gf(n);default:up(a,n),n=De=Lm(n,br),n=lp(a,n,br)}e.memoizedProps=e.pendingProps,n===null?El(e):De=n}function Es(e,n,a,o){lr=ji=null,gf(n),ds=null,ga=0;var u=n.return;try{if(Vx(e,u,n,a,Be)){ct=1,fl(e,_n(a,e.current)),De=null;return}}catch(h){if(u!==null)throw De=u,h;ct=1,fl(e,_n(a,e.current)),De=null;return}n.flags&32768?(ze||o===1?e=!0:xs||(Be&536870912)!==0?e=!1:(Gr=e=!0,(o===2||o===9||o===3||o===6)&&(o=tn.current,o!==null&&o.tag===13&&(o.flags|=16384))),Pp(n,e)):El(n)}function El(e){var n=e;do{if((n.flags&32768)!==0){Pp(n,Gr);return}e=n.return;var a=Xx(n.alternate,n,br);if(a!==null){De=a;return}if(n=n.sibling,n!==null){De=n;return}De=n=e}while(n!==null);ct===0&&(ct=5)}function Pp(e,n){do{var a=Jx(e.alternate,e);if(a!==null){a.flags&=32767,De=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!n&&(e=e.sibling,e!==null)){De=e;return}De=e=a}while(e!==null);ct=6,De=null}function Ip(e,n,a,o,u,h,x,E,R){e.cancelPendingCommit=null;do Ol();while(St!==0);if((Ge&6)!==0)throw Error(s(327));if(n!==null){if(n===e.current)throw Error(s(177));if(h=n.lanes|n.childLanes,h|=$u,kr(e,a,h,x,E,R),e===Ze&&(De=Ze=null,Be=0),ws=n,Yr=e,vr=a,Qf=h,Zf=u,kp=o,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,l_(Yi,function(){return Vp(),null})):(e.callbackNode=null,e.callbackPriority=0),o=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||o){o=Y.T,Y.T=null,u=ae.p,ae.p=2,x=Ge,Ge|=4;try{Qx(e,n,a)}finally{Ge=x,ae.p=u,Y.T=o}}St=1,$p(),Hp(),Gp()}}function $p(){if(St===1){St=0;var e=Yr,n=ws,a=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||a){a=Y.T,Y.T=null;var o=ae.p;ae.p=2;var u=Ge;Ge|=4;try{wp(n,e);var h=dh,x=Tm(e.containerInfo),E=h.focusedElem,R=h.selectionRange;if(x!==E&&E&&E.ownerDocument&&jm(E.ownerDocument.documentElement,E)){if(R!==null&&Lu(E)){var H=R.start,J=R.end;if(J===void 0&&(J=H),"selectionStart"in E)E.selectionStart=H,E.selectionEnd=Math.min(J,E.value.length);else{var ne=E.ownerDocument||document,F=ne&&ne.defaultView||window;if(F.getSelection){var K=F.getSelection(),ge=E.textContent.length,Ee=Math.min(R.start,ge),Je=R.end===void 0?Ee:Math.min(R.end,ge);!K.extend&&Ee>Je&&(x=Je,Je=Ee,Ee=x);var P=Am(E,Ee),q=Am(E,Je);if(P&&q&&(K.rangeCount!==1||K.anchorNode!==P.node||K.anchorOffset!==P.offset||K.focusNode!==q.node||K.focusOffset!==q.offset)){var $=ne.createRange();$.setStart(P.node,P.offset),K.removeAllRanges(),Ee>Je?(K.addRange($),K.extend(q.node,q.offset)):($.setEnd(q.node,q.offset),K.addRange($))}}}}for(ne=[],K=E;K=K.parentNode;)K.nodeType===1&&ne.push({element:K,left:K.scrollLeft,top:K.scrollTop});for(typeof E.focus=="function"&&E.focus(),E=0;E<ne.length;E++){var Z=ne[E];Z.element.scrollLeft=Z.left,Z.element.scrollTop=Z.top}}Ll=!!hh,dh=hh=null}finally{Ge=u,ae.p=o,Y.T=a}}e.current=n,St=2}}function Hp(){if(St===2){St=0;var e=Yr,n=ws,a=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||a){a=Y.T,Y.T=null;var o=ae.p;ae.p=2;var u=Ge;Ge|=4;try{yp(e,n.alternate,n)}finally{Ge=u,ae.p=o,Y.T=a}}St=3}}function Gp(){if(St===4||St===3){St=0,Vi();var e=Yr,n=ws,a=vr,o=kp;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?St=5:(St=0,ws=Yr=null,Fp(e,e.pendingLanes));var u=e.pendingLanes;if(u===0&&(Vr=null),vi(a),n=n.stateNode,ft&&typeof ft.onCommitFiberRoot=="function")try{ft.onCommitFiberRoot(pi,n,void 0,(n.current.flags&128)===128)}catch{}if(o!==null){n=Y.T,u=ae.p,ae.p=2,Y.T=null;try{for(var h=e.onRecoverableError,x=0;x<o.length;x++){var E=o[x];h(E.value,{componentStack:E.stack})}}finally{Y.T=n,ae.p=u}}(vr&3)!==0&&Ol(),Kn(e),u=e.pendingLanes,(a&261930)!==0&&(u&42)!==0?e===Wf?Ra++:(Ra=0,Wf=e):Ra=0,Da(0)}}function Fp(e,n){(e.pooledCacheLanes&=n)===0&&(n=e.pooledCache,n!=null&&(e.pooledCache=null,ma(n)))}function Ol(){return $p(),Hp(),Gp(),Vp()}function Vp(){if(St!==5)return!1;var e=Yr,n=Qf;Qf=0;var a=vi(vr),o=Y.T,u=ae.p;try{ae.p=32>a?32:a,Y.T=null,a=Zf,Zf=null;var h=Yr,x=vr;if(St=0,ws=Yr=null,vr=0,(Ge&6)!==0)throw Error(s(331));var E=Ge;if(Ge|=4,jp(h.current),Ep(h,h.current,x,a),Ge=E,Da(0,!1),ft&&typeof ft.onPostCommitFiberRoot=="function")try{ft.onPostCommitFiberRoot(pi,h)}catch{}return!0}finally{ae.p=u,Y.T=o,Fp(e,n)}}function Yp(e,n,a){n=_n(a,n),n=Cf(e.stateNode,n,2),e=Pr(e,n,2),e!==null&&(Rn(e,2),Kn(e))}function Ve(e,n,a){if(e.tag===3)Yp(e,e,a);else for(;n!==null;){if(n.tag===3){Yp(n,e,a);break}else if(n.tag===1){var o=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(Vr===null||!Vr.has(o))){e=_n(a,e),a=K0(2),o=Pr(n,a,2),o!==null&&(X0(a,o,n,e),Rn(o,2),Kn(o));break}}n=n.return}}function nh(e,n,a){var o=e.pingCache;if(o===null){o=e.pingCache=new e_;var u=new Set;o.set(n,u)}else u=o.get(n),u===void 0&&(u=new Set,o.set(n,u));u.has(a)||(Kf=!0,u.add(a),e=s_.bind(null,e,n,a),n.then(e,e))}function s_(e,n,a){var o=e.pingCache;o!==null&&o.delete(n),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,Ze===e&&(Be&a)===a&&(ct===4||ct===3&&(Be&62914560)===Be&&300>nt()-vl?(Ge&2)===0&&Ss(e,0):Xf|=a,_s===Be&&(_s=0)),Kn(e)}function Kp(e,n){n===0&&(n=Xi()),e=Ei(e,n),e!==null&&(Rn(e,n),Kn(e))}function a_(e){var n=e.memoizedState,a=0;n!==null&&(a=n.retryLane),Kp(e,a)}function o_(e,n){var a=0;switch(e.tag){case 31:case 13:var o=e.stateNode,u=e.memoizedState;u!==null&&(a=u.retryLane);break;case 19:o=e.stateNode;break;case 22:o=e.stateNode._retryCache;break;default:throw Error(s(314))}o!==null&&o.delete(n),Kp(e,a)}function l_(e,n){return Qs(e,n)}var Al=null,Os=null,rh=!1,jl=!1,ih=!1,Xr=0;function Kn(e){e!==Os&&e.next===null&&(Os===null?Al=Os=e:Os=Os.next=e),jl=!0,rh||(rh=!0,u_())}function Da(e,n){if(!ih&&jl){ih=!0;do for(var a=!1,o=Al;o!==null;){if(e!==0){var u=o.pendingLanes;if(u===0)var h=0;else{var x=o.suspendedLanes,E=o.pingedLanes;h=(1<<31-Bt(42|e)+1)-1,h&=u&~(x&~E),h=h&201326741?h&201326741|1:h?h|2:0}h!==0&&(a=!0,Zp(o,h))}else h=Be,h=gi(o,o===Ze?h:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(h&3)===0||yi(o,h)||(a=!0,Zp(o,h));o=o.next}while(a);ih=!1}}function c_(){Xp()}function Xp(){jl=rh=!1;var e=0;Xr!==0&&x_()&&(e=Xr);for(var n=nt(),a=null,o=Al;o!==null;){var u=o.next,h=Jp(o,n);h===0?(o.next=null,a===null?Al=u:a.next=u,u===null&&(Os=a)):(a=o,(e!==0||(h&3)!==0)&&(jl=!0)),o=u}St!==0&&St!==5||Da(e),Xr!==0&&(Xr=0)}function Jp(e,n){for(var a=e.suspendedLanes,o=e.pingedLanes,u=e.expirationTimes,h=e.pendingLanes&-62914561;0<h;){var x=31-Bt(h),E=1<<x,R=u[x];R===-1?((E&a)===0||(E&o)!==0)&&(u[x]=ea(E,n)):R<=n&&(e.expiredLanes|=E),h&=~E}if(n=Ze,a=Be,a=gi(e,e===n?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),o=e.callbackNode,a===0||e===n&&(Fe===2||Fe===9)||e.cancelPendingCommit!==null)return o!==null&&o!==null&&er(o),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||yi(e,a)){if(n=a&-a,n===e.callbackPriority)return n;switch(o!==null&&er(o),vi(a)){case 2:case 8:a=To;break;case 32:a=Yi;break;case 268435456:a=No;break;default:a=Yi}return o=Qp.bind(null,e),a=Qs(a,o),e.callbackPriority=n,e.callbackNode=a,n}return o!==null&&o!==null&&er(o),e.callbackPriority=2,e.callbackNode=null,2}function Qp(e,n){if(St!==0&&St!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(Ol()&&e.callbackNode!==a)return null;var o=Be;return o=gi(e,e===Ze?o:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),o===0?null:(Mp(e,o,n),Jp(e,nt()),e.callbackNode!=null&&e.callbackNode===a?Qp.bind(null,e):null)}function Zp(e,n){if(Ol())return null;Mp(e,n,!0)}function u_(){w_(function(){(Ge&6)!==0?Qs(jo,c_):Xp()})}function sh(){if(Xr===0){var e=us;e===0&&(e=jr,jr<<=1,(jr&261888)===0&&(jr=256)),Xr=e}return Xr}function Wp(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:qo(""+e)}function eg(e,n){var a=n.ownerDocument.createElement("input");return a.name=n.name,a.value=n.value,e.id&&a.setAttribute("form",e.id),n.parentNode.insertBefore(a,n),e=new FormData(e),a.parentNode.removeChild(a),e}function f_(e,n,a,o,u){if(n==="submit"&&a&&a.stateNode===u){var h=Wp((u[ot]||null).action),x=o.submitter;x&&(n=(n=x[ot]||null)?Wp(n.formAction):x.getAttribute("formAction"),n!==null&&(h=n,x=null));var E=new Uo("action","action",null,o,u);e.push({event:E,listeners:[{instance:null,listener:function(){if(o.defaultPrevented){if(Xr!==0){var R=x?eg(u,x):new FormData(u);Of(a,{pending:!0,data:R,method:u.method,action:h},null,R)}}else typeof h=="function"&&(E.preventDefault(),R=x?eg(u,x):new FormData(u),Of(a,{pending:!0,data:R,method:u.method,action:h},h,R))},currentTarget:u}]})}}for(var ah=0;ah<Iu.length;ah++){var oh=Iu[ah],h_=oh.toLowerCase(),d_=oh[0].toUpperCase()+oh.slice(1);qn(h_,"on"+d_)}qn(Cm,"onAnimationEnd"),qn(Mm,"onAnimationIteration"),qn(Rm,"onAnimationStart"),qn("dblclick","onDoubleClick"),qn("focusin","onFocus"),qn("focusout","onBlur"),qn(Nx,"onTransitionRun"),qn(kx,"onTransitionStart"),qn(Cx,"onTransitionCancel"),qn(Dm,"onTransitionEnd"),V("onMouseEnter",["mouseout","mouseover"]),V("onMouseLeave",["mouseout","mouseover"]),V("onPointerEnter",["pointerout","pointerover"]),V("onPointerLeave",["pointerout","pointerover"]),se("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),se("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),se("onBeforeInput",["compositionend","keypress","textInput","paste"]),se("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),se("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),se("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var qa="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),m_=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(qa));function tg(e,n){n=(n&4)!==0;for(var a=0;a<e.length;a++){var o=e[a],u=o.event;o=o.listeners;e:{var h=void 0;if(n)for(var x=o.length-1;0<=x;x--){var E=o[x],R=E.instance,H=E.currentTarget;if(E=E.listener,R!==h&&u.isPropagationStopped())break e;h=E,u.currentTarget=H;try{h(u)}catch(J){$o(J)}u.currentTarget=null,h=R}else for(x=0;x<o.length;x++){if(E=o[x],R=E.instance,H=E.currentTarget,E=E.listener,R!==h&&u.isPropagationStopped())break e;h=E,u.currentTarget=H;try{h(u)}catch(J){$o(J)}u.currentTarget=null,h=R}}}}function qe(e,n){var a=n[xi];a===void 0&&(a=n[xi]=new Set);var o=e+"__bubble";a.has(o)||(ng(n,e,2,!1),a.add(o))}function lh(e,n,a){var o=0;n&&(o|=4),ng(a,e,o,n)}var Tl="_reactListening"+Math.random().toString(36).slice(2);function ch(e){if(!e[Tl]){e[Tl]=!0,I.forEach(function(a){a!=="selectionchange"&&(m_.has(a)||lh(a,!1,e),lh(a,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[Tl]||(n[Tl]=!0,lh("selectionchange",!1,n))}}function ng(e,n,a,o){switch(Cg(n)){case 2:var u=$_;break;case 8:u=H_;break;default:u=Eh}a=u.bind(null,n,a,e),u=void 0,!Tu||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(u=!0),o?u!==void 0?e.addEventListener(n,a,{capture:!0,passive:u}):e.addEventListener(n,a,!0):u!==void 0?e.addEventListener(n,a,{passive:u}):e.addEventListener(n,a,!1)}function uh(e,n,a,o,u){var h=o;if((n&1)===0&&(n&2)===0&&o!==null)e:for(;;){if(o===null)return;var x=o.tag;if(x===3||x===4){var E=o.stateNode.containerInfo;if(E===u)break;if(x===4)for(x=o.return;x!==null;){var R=x.tag;if((R===3||R===4)&&x.stateNode.containerInfo===u)return;x=x.return}for(;E!==null;){if(x=O(E),x===null)return;if(R=x.tag,R===5||R===6||R===26||R===27){o=h=x;continue e}E=E.parentNode}}o=o.return}om(function(){var H=h,J=Au(a),ne=[];e:{var F=qm.get(e);if(F!==void 0){var K=Uo,ge=e;switch(e){case"keypress":if(Lo(a)===0)break e;case"keydown":case"keyup":K=ox;break;case"focusin":ge="focus",K=Mu;break;case"focusout":ge="blur",K=Mu;break;case"beforeblur":case"afterblur":K=Mu;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":K=um;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":K=Xv;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":K=ux;break;case Cm:case Mm:case Rm:K=Zv;break;case Dm:K=hx;break;case"scroll":case"scrollend":K=Yv;break;case"wheel":K=mx;break;case"copy":case"cut":case"paste":K=ex;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":K=hm;break;case"toggle":case"beforetoggle":K=gx}var Ee=(n&4)!==0,Je=!Ee&&(e==="scroll"||e==="scrollend"),P=Ee?F!==null?F+"Capture":null:F;Ee=[];for(var q=H,$;q!==null;){var Z=q;if($=Z.stateNode,Z=Z.tag,Z!==5&&Z!==26&&Z!==27||$===null||P===null||(Z=ra(q,P),Z!=null&&Ee.push(Ba(q,Z,$))),Je)break;q=q.return}0<Ee.length&&(F=new K(F,ge,null,a,J),ne.push({event:F,listeners:Ee}))}}if((n&7)===0){e:{if(F=e==="mouseover"||e==="pointerover",K=e==="mouseout"||e==="pointerout",F&&a!==Ou&&(ge=a.relatedTarget||a.fromElement)&&(O(ge)||ge[Zt]))break e;if((K||F)&&(F=J.window===J?J:(F=J.ownerDocument)?F.defaultView||F.parentWindow:window,K?(ge=a.relatedTarget||a.toElement,K=H,ge=ge?O(ge):null,ge!==null&&(Je=c(ge),Ee=ge.tag,ge!==Je||Ee!==5&&Ee!==27&&Ee!==6)&&(ge=null)):(K=null,ge=H),K!==ge)){if(Ee=um,Z="onMouseLeave",P="onMouseEnter",q="mouse",(e==="pointerout"||e==="pointerover")&&(Ee=hm,Z="onPointerLeave",P="onPointerEnter",q="pointer"),Je=K==null?F:T(K),$=ge==null?F:T(ge),F=new Ee(Z,q+"leave",K,a,J),F.target=Je,F.relatedTarget=$,Z=null,O(J)===H&&(Ee=new Ee(P,q+"enter",ge,a,J),Ee.target=$,Ee.relatedTarget=Je,Z=Ee),Je=Z,K&&ge)t:{for(Ee=p_,P=K,q=ge,$=0,Z=P;Z;Z=Ee(Z))$++;Z=0;for(var xe=q;xe;xe=Ee(xe))Z++;for(;0<$-Z;)P=Ee(P),$--;for(;0<Z-$;)q=Ee(q),Z--;for(;$--;){if(P===q||q!==null&&P===q.alternate){Ee=P;break t}P=Ee(P),q=Ee(q)}Ee=null}else Ee=null;K!==null&&rg(ne,F,K,Ee,!1),ge!==null&&Je!==null&&rg(ne,Je,ge,Ee,!0)}}e:{if(F=H?T(H):window,K=F.nodeName&&F.nodeName.toLowerCase(),K==="select"||K==="input"&&F.type==="file")var $e=xm;else if(bm(F))if(_m)$e=Ax;else{$e=Ex;var ye=Sx}else K=F.nodeName,!K||K.toLowerCase()!=="input"||F.type!=="checkbox"&&F.type!=="radio"?H&&Eu(H.elementType)&&($e=xm):$e=Ox;if($e&&($e=$e(e,H))){vm(ne,$e,a,J);break e}ye&&ye(e,F,H),e==="focusout"&&H&&F.type==="number"&&H.memoizedProps.value!=null&&Su(F,"number",F.value)}switch(ye=H?T(H):window,e){case"focusin":(bm(ye)||ye.contentEditable==="true")&&(ns=ye,zu=H,fa=null);break;case"focusout":fa=zu=ns=null;break;case"mousedown":Uu=!0;break;case"contextmenu":case"mouseup":case"dragend":Uu=!1,Nm(ne,a,J);break;case"selectionchange":if(Tx)break;case"keydown":case"keyup":Nm(ne,a,J)}var Me;if(Du)e:{switch(e){case"compositionstart":var Le="onCompositionStart";break e;case"compositionend":Le="onCompositionEnd";break e;case"compositionupdate":Le="onCompositionUpdate";break e}Le=void 0}else ts?gm(e,a)&&(Le="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(Le="onCompositionStart");Le&&(dm&&a.locale!=="ko"&&(ts||Le!=="onCompositionStart"?Le==="onCompositionEnd"&&ts&&(Me=lm()):(Rr=J,Nu="value"in Rr?Rr.value:Rr.textContent,ts=!0)),ye=Nl(H,Le),0<ye.length&&(Le=new fm(Le,e,null,a,J),ne.push({event:Le,listeners:ye}),Me?Le.data=Me:(Me=ym(a),Me!==null&&(Le.data=Me)))),(Me=bx?vx(e,a):xx(e,a))&&(Le=Nl(H,"onBeforeInput"),0<Le.length&&(ye=new fm("onBeforeInput","beforeinput",null,a,J),ne.push({event:ye,listeners:Le}),ye.data=Me)),f_(ne,e,H,a,J)}tg(ne,n)})}function Ba(e,n,a){return{instance:e,listener:n,currentTarget:a}}function Nl(e,n){for(var a=n+"Capture",o=[];e!==null;){var u=e,h=u.stateNode;if(u=u.tag,u!==5&&u!==26&&u!==27||h===null||(u=ra(e,a),u!=null&&o.unshift(Ba(e,u,h)),u=ra(e,n),u!=null&&o.push(Ba(e,u,h))),e.tag===3)return o;e=e.return}return[]}function p_(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function rg(e,n,a,o,u){for(var h=n._reactName,x=[];a!==null&&a!==o;){var E=a,R=E.alternate,H=E.stateNode;if(E=E.tag,R!==null&&R===o)break;E!==5&&E!==26&&E!==27||H===null||(R=H,u?(H=ra(a,h),H!=null&&x.unshift(Ba(a,H,R))):u||(H=ra(a,h),H!=null&&x.push(Ba(a,H,R)))),a=a.return}x.length!==0&&e.push({event:n,listeners:x})}var g_=/\r\n?/g,y_=/\u0000|\uFFFD/g;function ig(e){return(typeof e=="string"?e:""+e).replace(g_,`
26
- `).replace(y_,"")}function sg(e,n){return n=ig(n),ig(e)===n}function Xe(e,n,a,o,u,h){switch(a){case"children":typeof o=="string"?n==="body"||n==="textarea"&&o===""||Zi(e,o):(typeof o=="number"||typeof o=="bigint")&&n!=="body"&&Zi(e,""+o);break;case"className":Dn(e,"class",o);break;case"tabIndex":Dn(e,"tabindex",o);break;case"dir":case"role":case"viewBox":case"width":case"height":Dn(e,a,o);break;case"style":sm(e,o,h);break;case"data":if(n!=="object"){Dn(e,"data",o);break}case"src":case"href":if(o===""&&(n!=="a"||a!=="href")){e.removeAttribute(a);break}if(o==null||typeof o=="function"||typeof o=="symbol"||typeof o=="boolean"){e.removeAttribute(a);break}o=qo(""+o),e.setAttribute(a,o);break;case"action":case"formAction":if(typeof o=="function"){e.setAttribute(a,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof h=="function"&&(a==="formAction"?(n!=="input"&&Xe(e,n,"name",u.name,u,null),Xe(e,n,"formEncType",u.formEncType,u,null),Xe(e,n,"formMethod",u.formMethod,u,null),Xe(e,n,"formTarget",u.formTarget,u,null)):(Xe(e,n,"encType",u.encType,u,null),Xe(e,n,"method",u.method,u,null),Xe(e,n,"target",u.target,u,null)));if(o==null||typeof o=="symbol"||typeof o=="boolean"){e.removeAttribute(a);break}o=qo(""+o),e.setAttribute(a,o);break;case"onClick":o!=null&&(e.onclick=ir);break;case"onScroll":o!=null&&qe("scroll",e);break;case"onScrollEnd":o!=null&&qe("scrollend",e);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(s(61));if(a=o.__html,a!=null){if(u.children!=null)throw Error(s(60));e.innerHTML=a}}break;case"multiple":e.multiple=o&&typeof o!="function"&&typeof o!="symbol";break;case"muted":e.muted=o&&typeof o!="function"&&typeof o!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(o==null||typeof o=="function"||typeof o=="boolean"||typeof o=="symbol"){e.removeAttribute("xlink:href");break}a=qo(""+o),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":o!=null&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(a,""+o):e.removeAttribute(a);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":o&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(a,""):e.removeAttribute(a);break;case"capture":case"download":o===!0?e.setAttribute(a,""):o!==!1&&o!=null&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(a,o):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":o!=null&&typeof o!="function"&&typeof o!="symbol"&&!isNaN(o)&&1<=o?e.setAttribute(a,o):e.removeAttribute(a);break;case"rowSpan":case"start":o==null||typeof o=="function"||typeof o=="symbol"||isNaN(o)?e.removeAttribute(a):e.setAttribute(a,o);break;case"popover":qe("beforetoggle",e),qe("toggle",e),Lt(e,"popover",o);break;case"xlinkActuate":rr(e,"http://www.w3.org/1999/xlink","xlink:actuate",o);break;case"xlinkArcrole":rr(e,"http://www.w3.org/1999/xlink","xlink:arcrole",o);break;case"xlinkRole":rr(e,"http://www.w3.org/1999/xlink","xlink:role",o);break;case"xlinkShow":rr(e,"http://www.w3.org/1999/xlink","xlink:show",o);break;case"xlinkTitle":rr(e,"http://www.w3.org/1999/xlink","xlink:title",o);break;case"xlinkType":rr(e,"http://www.w3.org/1999/xlink","xlink:type",o);break;case"xmlBase":rr(e,"http://www.w3.org/XML/1998/namespace","xml:base",o);break;case"xmlLang":rr(e,"http://www.w3.org/XML/1998/namespace","xml:lang",o);break;case"xmlSpace":rr(e,"http://www.w3.org/XML/1998/namespace","xml:space",o);break;case"is":Lt(e,"is",o);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=Fv.get(a)||a,Lt(e,a,o))}}function fh(e,n,a,o,u,h){switch(a){case"style":sm(e,o,h);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(s(61));if(a=o.__html,a!=null){if(u.children!=null)throw Error(s(60));e.innerHTML=a}}break;case"children":typeof o=="string"?Zi(e,o):(typeof o=="number"||typeof o=="bigint")&&Zi(e,""+o);break;case"onScroll":o!=null&&qe("scroll",e);break;case"onScrollEnd":o!=null&&qe("scrollend",e);break;case"onClick":o!=null&&(e.onclick=ir);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!te.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(u=a.endsWith("Capture"),n=a.slice(2,u?a.length-7:void 0),h=e[ot]||null,h=h!=null?h[a]:null,typeof h=="function"&&e.removeEventListener(n,h,u),typeof o=="function")){typeof h!="function"&&h!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(n,o,u);break e}a in e?e[a]=o:o===!0?e.setAttribute(a,""):Lt(e,a,o)}}}function Mt(e,n,a){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":qe("error",e),qe("load",e);var o=!1,u=!1,h;for(h in a)if(a.hasOwnProperty(h)){var x=a[h];if(x!=null)switch(h){case"src":o=!0;break;case"srcSet":u=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,n));default:Xe(e,n,h,x,a,null)}}u&&Xe(e,n,"srcSet",a.srcSet,a,null),o&&Xe(e,n,"src",a.src,a,null);return;case"input":qe("invalid",e);var E=h=x=u=null,R=null,H=null;for(o in a)if(a.hasOwnProperty(o)){var J=a[o];if(J!=null)switch(o){case"name":u=J;break;case"type":x=J;break;case"checked":R=J;break;case"defaultChecked":H=J;break;case"value":h=J;break;case"defaultValue":E=J;break;case"children":case"dangerouslySetInnerHTML":if(J!=null)throw Error(s(137,n));break;default:Xe(e,n,o,J,a,null)}}tm(e,h,E,R,H,x,u,!1);return;case"select":qe("invalid",e),o=x=h=null;for(u in a)if(a.hasOwnProperty(u)&&(E=a[u],E!=null))switch(u){case"value":h=E;break;case"defaultValue":x=E;break;case"multiple":o=E;default:Xe(e,n,u,E,a,null)}n=h,a=x,e.multiple=!!o,n!=null?Qi(e,!!o,n,!1):a!=null&&Qi(e,!!o,a,!0);return;case"textarea":qe("invalid",e),h=u=o=null;for(x in a)if(a.hasOwnProperty(x)&&(E=a[x],E!=null))switch(x){case"value":o=E;break;case"defaultValue":u=E;break;case"children":h=E;break;case"dangerouslySetInnerHTML":if(E!=null)throw Error(s(91));break;default:Xe(e,n,x,E,a,null)}rm(e,o,u,h);return;case"option":for(R in a)if(a.hasOwnProperty(R)&&(o=a[R],o!=null))switch(R){case"selected":e.selected=o&&typeof o!="function"&&typeof o!="symbol";break;default:Xe(e,n,R,o,a,null)}return;case"dialog":qe("beforetoggle",e),qe("toggle",e),qe("cancel",e),qe("close",e);break;case"iframe":case"object":qe("load",e);break;case"video":case"audio":for(o=0;o<qa.length;o++)qe(qa[o],e);break;case"image":qe("error",e),qe("load",e);break;case"details":qe("toggle",e);break;case"embed":case"source":case"link":qe("error",e),qe("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(H in a)if(a.hasOwnProperty(H)&&(o=a[H],o!=null))switch(H){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,n));default:Xe(e,n,H,o,a,null)}return;default:if(Eu(n)){for(J in a)a.hasOwnProperty(J)&&(o=a[J],o!==void 0&&fh(e,n,J,o,a,void 0));return}}for(E in a)a.hasOwnProperty(E)&&(o=a[E],o!=null&&Xe(e,n,E,o,a,null))}function b_(e,n,a,o){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var u=null,h=null,x=null,E=null,R=null,H=null,J=null;for(K in a){var ne=a[K];if(a.hasOwnProperty(K)&&ne!=null)switch(K){case"checked":break;case"value":break;case"defaultValue":R=ne;default:o.hasOwnProperty(K)||Xe(e,n,K,null,o,ne)}}for(var F in o){var K=o[F];if(ne=a[F],o.hasOwnProperty(F)&&(K!=null||ne!=null))switch(F){case"type":h=K;break;case"name":u=K;break;case"checked":H=K;break;case"defaultChecked":J=K;break;case"value":x=K;break;case"defaultValue":E=K;break;case"children":case"dangerouslySetInnerHTML":if(K!=null)throw Error(s(137,n));break;default:K!==ne&&Xe(e,n,F,K,o,ne)}}wu(e,x,E,R,H,J,h,u);return;case"select":K=x=E=F=null;for(h in a)if(R=a[h],a.hasOwnProperty(h)&&R!=null)switch(h){case"value":break;case"multiple":K=R;default:o.hasOwnProperty(h)||Xe(e,n,h,null,o,R)}for(u in o)if(h=o[u],R=a[u],o.hasOwnProperty(u)&&(h!=null||R!=null))switch(u){case"value":F=h;break;case"defaultValue":E=h;break;case"multiple":x=h;default:h!==R&&Xe(e,n,u,h,o,R)}n=E,a=x,o=K,F!=null?Qi(e,!!a,F,!1):!!o!=!!a&&(n!=null?Qi(e,!!a,n,!0):Qi(e,!!a,a?[]:"",!1));return;case"textarea":K=F=null;for(E in a)if(u=a[E],a.hasOwnProperty(E)&&u!=null&&!o.hasOwnProperty(E))switch(E){case"value":break;case"children":break;default:Xe(e,n,E,null,o,u)}for(x in o)if(u=o[x],h=a[x],o.hasOwnProperty(x)&&(u!=null||h!=null))switch(x){case"value":F=u;break;case"defaultValue":K=u;break;case"children":break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(s(91));break;default:u!==h&&Xe(e,n,x,u,o,h)}nm(e,F,K);return;case"option":for(var ge in a)if(F=a[ge],a.hasOwnProperty(ge)&&F!=null&&!o.hasOwnProperty(ge))switch(ge){case"selected":e.selected=!1;break;default:Xe(e,n,ge,null,o,F)}for(R in o)if(F=o[R],K=a[R],o.hasOwnProperty(R)&&F!==K&&(F!=null||K!=null))switch(R){case"selected":e.selected=F&&typeof F!="function"&&typeof F!="symbol";break;default:Xe(e,n,R,F,o,K)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ee in a)F=a[Ee],a.hasOwnProperty(Ee)&&F!=null&&!o.hasOwnProperty(Ee)&&Xe(e,n,Ee,null,o,F);for(H in o)if(F=o[H],K=a[H],o.hasOwnProperty(H)&&F!==K&&(F!=null||K!=null))switch(H){case"children":case"dangerouslySetInnerHTML":if(F!=null)throw Error(s(137,n));break;default:Xe(e,n,H,F,o,K)}return;default:if(Eu(n)){for(var Je in a)F=a[Je],a.hasOwnProperty(Je)&&F!==void 0&&!o.hasOwnProperty(Je)&&fh(e,n,Je,void 0,o,F);for(J in o)F=o[J],K=a[J],!o.hasOwnProperty(J)||F===K||F===void 0&&K===void 0||fh(e,n,J,F,o,K);return}}for(var P in a)F=a[P],a.hasOwnProperty(P)&&F!=null&&!o.hasOwnProperty(P)&&Xe(e,n,P,null,o,F);for(ne in o)F=o[ne],K=a[ne],!o.hasOwnProperty(ne)||F===K||F==null&&K==null||Xe(e,n,ne,F,o,K)}function ag(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function v_(){if(typeof performance.getEntriesByType=="function"){for(var e=0,n=0,a=performance.getEntriesByType("resource"),o=0;o<a.length;o++){var u=a[o],h=u.transferSize,x=u.initiatorType,E=u.duration;if(h&&E&&ag(x)){for(x=0,E=u.responseEnd,o+=1;o<a.length;o++){var R=a[o],H=R.startTime;if(H>E)break;var J=R.transferSize,ne=R.initiatorType;J&&ag(ne)&&(R=R.responseEnd,x+=J*(R<E?1:(E-H)/(R-H)))}if(--o,n+=8*(h+x)/(u.duration/1e3),e++,10<e)break}}if(0<e)return n/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var hh=null,dh=null;function kl(e){return e.nodeType===9?e:e.ownerDocument}function og(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function lg(e,n){if(e===0)switch(n){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&n==="foreignObject"?0:e}function mh(e,n){return e==="textarea"||e==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.children=="bigint"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var ph=null;function x_(){var e=window.event;return e&&e.type==="popstate"?e===ph?!1:(ph=e,!0):(ph=null,!1)}var cg=typeof setTimeout=="function"?setTimeout:void 0,__=typeof clearTimeout=="function"?clearTimeout:void 0,ug=typeof Promise=="function"?Promise:void 0,w_=typeof queueMicrotask=="function"?queueMicrotask:typeof ug<"u"?function(e){return ug.resolve(null).then(e).catch(S_)}:cg;function S_(e){setTimeout(function(){throw e})}function Jr(e){return e==="head"}function fg(e,n){var a=n,o=0;do{var u=a.nextSibling;if(e.removeChild(a),u&&u.nodeType===8)if(a=u.data,a==="/$"||a==="/&"){if(o===0){e.removeChild(u),Ns(n);return}o--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")o++;else if(a==="html")La(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,La(a);for(var h=a.firstChild;h;){var x=h.nextSibling,E=h.nodeName;h[wt]||E==="SCRIPT"||E==="STYLE"||E==="LINK"&&h.rel.toLowerCase()==="stylesheet"||a.removeChild(h),h=x}}else a==="body"&&La(e.ownerDocument.body);a=u}while(a);Ns(n)}function hg(e,n){var a=e;e=0;do{var o=a.nextSibling;if(a.nodeType===1?n?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(n?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),o&&o.nodeType===8)if(a=o.data,a==="/$"){if(e===0)break;e--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||e++;a=o}while(a)}function gh(e){var n=e.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var a=n;switch(n=n.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":gh(a),Ji(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function E_(e,n,a,o){for(;e.nodeType===1;){var u=a;if(e.nodeName.toLowerCase()!==n.toLowerCase()){if(!o&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(o){if(!e[wt])switch(n){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(h=e.getAttribute("rel"),h==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(h!==u.rel||e.getAttribute("href")!==(u.href==null||u.href===""?null:u.href)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin)||e.getAttribute("title")!==(u.title==null?null:u.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(h=e.getAttribute("src"),(h!==(u.src==null?null:u.src)||e.getAttribute("type")!==(u.type==null?null:u.type)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin))&&h&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(n==="input"&&e.type==="hidden"){var h=u.name==null?null:""+u.name;if(u.type==="hidden"&&e.getAttribute("name")===h)return e}else return e;if(e=An(e.nextSibling),e===null)break}return null}function O_(e,n,a){if(n==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=An(e.nextSibling),e===null))return null;return e}function dg(e,n){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=An(e.nextSibling),e===null))return null;return e}function yh(e){return e.data==="$?"||e.data==="$~"}function bh(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function A_(e,n){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=n;else if(e.data!=="$?"||a.readyState!=="loading")n();else{var o=function(){n(),a.removeEventListener("DOMContentLoaded",o)};a.addEventListener("DOMContentLoaded",o),e._reactRetry=o}}function An(e){for(;e!=null;e=e.nextSibling){var n=e.nodeType;if(n===1||n===3)break;if(n===8){if(n=e.data,n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"||n==="F!"||n==="F")break;if(n==="/$"||n==="/&")return null}}return e}var vh=null;function mg(e){e=e.nextSibling;for(var n=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(n===0)return An(e.nextSibling);n--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||n++}e=e.nextSibling}return null}function pg(e){e=e.previousSibling;for(var n=0;e;){if(e.nodeType===8){var a=e.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(n===0)return e;n--}else a!=="/$"&&a!=="/&"||n++}e=e.previousSibling}return null}function gg(e,n,a){switch(n=kl(a),e){case"html":if(e=n.documentElement,!e)throw Error(s(452));return e;case"head":if(e=n.head,!e)throw Error(s(453));return e;case"body":if(e=n.body,!e)throw Error(s(454));return e;default:throw Error(s(451))}}function La(e){for(var n=e.attributes;n.length;)e.removeAttributeNode(n[0]);Ji(e)}var jn=new Map,yg=new Set;function Cl(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var xr=ae.d;ae.d={f:j_,r:T_,D:N_,C:k_,L:C_,m:M_,X:D_,S:R_,M:q_};function j_(){var e=xr.f(),n=wl();return e||n}function T_(e){var n=N(e);n!==null&&n.tag===5&&n.type==="form"?D0(n):xr.r(e)}var As=typeof document>"u"?null:document;function bg(e,n,a){var o=As;if(o&&typeof n=="string"&&n){var u=vn(n);u='link[rel="'+e+'"][href="'+u+'"]',typeof a=="string"&&(u+='[crossorigin="'+a+'"]'),yg.has(u)||(yg.add(u),e={rel:e,crossOrigin:a,href:n},o.querySelector(u)===null&&(n=o.createElement("link"),Mt(n,"link",e),D(n),o.head.appendChild(n)))}}function N_(e){xr.D(e),bg("dns-prefetch",e,null)}function k_(e,n){xr.C(e,n),bg("preconnect",e,n)}function C_(e,n,a){xr.L(e,n,a);var o=As;if(o&&e&&n){var u='link[rel="preload"][as="'+vn(n)+'"]';n==="image"&&a&&a.imageSrcSet?(u+='[imagesrcset="'+vn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(u+='[imagesizes="'+vn(a.imageSizes)+'"]')):u+='[href="'+vn(e)+'"]';var h=u;switch(n){case"style":h=js(e);break;case"script":h=Ts(e)}jn.has(h)||(e=b({rel:"preload",href:n==="image"&&a&&a.imageSrcSet?void 0:e,as:n},a),jn.set(h,e),o.querySelector(u)!==null||n==="style"&&o.querySelector(za(h))||n==="script"&&o.querySelector(Ua(h))||(n=o.createElement("link"),Mt(n,"link",e),D(n),o.head.appendChild(n)))}}function M_(e,n){xr.m(e,n);var a=As;if(a&&e){var o=n&&typeof n.as=="string"?n.as:"script",u='link[rel="modulepreload"][as="'+vn(o)+'"][href="'+vn(e)+'"]',h=u;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":h=Ts(e)}if(!jn.has(h)&&(e=b({rel:"modulepreload",href:e},n),jn.set(h,e),a.querySelector(u)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Ua(h)))return}o=a.createElement("link"),Mt(o,"link",e),D(o),a.head.appendChild(o)}}}function R_(e,n,a){xr.S(e,n,a);var o=As;if(o&&e){var u=k(o).hoistableStyles,h=js(e);n=n||"default";var x=u.get(h);if(!x){var E={loading:0,preload:null};if(x=o.querySelector(za(h)))E.loading=5;else{e=b({rel:"stylesheet",href:e,"data-precedence":n},a),(a=jn.get(h))&&xh(e,a);var R=x=o.createElement("link");D(R),Mt(R,"link",e),R._p=new Promise(function(H,J){R.onload=H,R.onerror=J}),R.addEventListener("load",function(){E.loading|=1}),R.addEventListener("error",function(){E.loading|=2}),E.loading|=4,Ml(x,n,o)}x={type:"stylesheet",instance:x,count:1,state:E},u.set(h,x)}}}function D_(e,n){xr.X(e,n);var a=As;if(a&&e){var o=k(a).hoistableScripts,u=Ts(e),h=o.get(u);h||(h=a.querySelector(Ua(u)),h||(e=b({src:e,async:!0},n),(n=jn.get(u))&&_h(e,n),h=a.createElement("script"),D(h),Mt(h,"link",e),a.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},o.set(u,h))}}function q_(e,n){xr.M(e,n);var a=As;if(a&&e){var o=k(a).hoistableScripts,u=Ts(e),h=o.get(u);h||(h=a.querySelector(Ua(u)),h||(e=b({src:e,async:!0,type:"module"},n),(n=jn.get(u))&&_h(e,n),h=a.createElement("script"),D(h),Mt(h,"link",e),a.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},o.set(u,h))}}function vg(e,n,a,o){var u=(u=Ht.current)?Cl(u):null;if(!u)throw Error(s(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(n=js(a.href),a=k(u).hoistableStyles,o=a.get(n),o||(o={type:"style",instance:null,count:0,state:null},a.set(n,o)),o):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=js(a.href);var h=k(u).hoistableStyles,x=h.get(e);if(x||(u=u.ownerDocument||u,x={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},h.set(e,x),(h=u.querySelector(za(e)))&&!h._p&&(x.instance=h,x.state.loading=5),jn.has(e)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},jn.set(e,a),h||B_(u,e,a,x.state))),n&&o===null)throw Error(s(528,""));return x}if(n&&o!==null)throw Error(s(529,""));return null;case"script":return n=a.async,a=a.src,typeof a=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=Ts(a),a=k(u).hoistableScripts,o=a.get(n),o||(o={type:"script",instance:null,count:0,state:null},a.set(n,o)),o):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,e))}}function js(e){return'href="'+vn(e)+'"'}function za(e){return'link[rel="stylesheet"]['+e+"]"}function xg(e){return b({},e,{"data-precedence":e.precedence,precedence:null})}function B_(e,n,a,o){e.querySelector('link[rel="preload"][as="style"]['+n+"]")?o.loading=1:(n=e.createElement("link"),o.preload=n,n.addEventListener("load",function(){return o.loading|=1}),n.addEventListener("error",function(){return o.loading|=2}),Mt(n,"link",a),D(n),e.head.appendChild(n))}function Ts(e){return'[src="'+vn(e)+'"]'}function Ua(e){return"script[async]"+e}function _g(e,n,a){if(n.count++,n.instance===null)switch(n.type){case"style":var o=e.querySelector('style[data-href~="'+vn(a.href)+'"]');if(o)return n.instance=o,D(o),o;var u=b({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return o=(e.ownerDocument||e).createElement("style"),D(o),Mt(o,"style",u),Ml(o,a.precedence,e),n.instance=o;case"stylesheet":u=js(a.href);var h=e.querySelector(za(u));if(h)return n.state.loading|=4,n.instance=h,D(h),h;o=xg(a),(u=jn.get(u))&&xh(o,u),h=(e.ownerDocument||e).createElement("link"),D(h);var x=h;return x._p=new Promise(function(E,R){x.onload=E,x.onerror=R}),Mt(h,"link",o),n.state.loading|=4,Ml(h,a.precedence,e),n.instance=h;case"script":return h=Ts(a.src),(u=e.querySelector(Ua(h)))?(n.instance=u,D(u),u):(o=a,(u=jn.get(h))&&(o=b({},a),_h(o,u)),e=e.ownerDocument||e,u=e.createElement("script"),D(u),Mt(u,"link",o),e.head.appendChild(u),n.instance=u);case"void":return null;default:throw Error(s(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(o=n.instance,n.state.loading|=4,Ml(o,a.precedence,e));return n.instance}function Ml(e,n,a){for(var o=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=o.length?o[o.length-1]:null,h=u,x=0;x<o.length;x++){var E=o[x];if(E.dataset.precedence===n)h=E;else if(h!==u)break}h?h.parentNode.insertBefore(e,h.nextSibling):(n=a.nodeType===9?a.head:a,n.insertBefore(e,n.firstChild))}function xh(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.title==null&&(e.title=n.title)}function _h(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.integrity==null&&(e.integrity=n.integrity)}var Rl=null;function wg(e,n,a){if(Rl===null){var o=new Map,u=Rl=new Map;u.set(a,o)}else u=Rl,o=u.get(a),o||(o=new Map,u.set(a,o));if(o.has(e))return o;for(o.set(e,null),a=a.getElementsByTagName(e),u=0;u<a.length;u++){var h=a[u];if(!(h[wt]||h[Qe]||e==="link"&&h.getAttribute("rel")==="stylesheet")&&h.namespaceURI!=="http://www.w3.org/2000/svg"){var x=h.getAttribute(n)||"";x=e+x;var E=o.get(x);E?E.push(h):o.set(x,[h])}}return o}function Sg(e,n,a){e=e.ownerDocument||e,e.head.insertBefore(a,n==="title"?e.querySelector("head > title"):null)}function L_(e,n,a){if(a===1||n.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;switch(n.rel){case"stylesheet":return e=n.disabled,typeof n.precedence=="string"&&e==null;default:return!0}case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function Eg(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function z_(e,n,a,o){if(a.type==="stylesheet"&&(typeof o.media!="string"||matchMedia(o.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var u=js(o.href),h=n.querySelector(za(u));if(h){n=h._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=Dl.bind(e),n.then(e,e)),a.state.loading|=4,a.instance=h,D(h);return}h=n.ownerDocument||n,o=xg(o),(u=jn.get(u))&&xh(o,u),h=h.createElement("link"),D(h);var x=h;x._p=new Promise(function(E,R){x.onload=E,x.onerror=R}),Mt(h,"link",o),a.instance=h}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,n),(n=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=Dl.bind(e),n.addEventListener("load",a),n.addEventListener("error",a))}}var wh=0;function U_(e,n){return e.stylesheets&&e.count===0&&Bl(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var o=setTimeout(function(){if(e.stylesheets&&Bl(e,e.stylesheets),e.unsuspend){var h=e.unsuspend;e.unsuspend=null,h()}},6e4+n);0<e.imgBytes&&wh===0&&(wh=62500*v_());var u=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Bl(e,e.stylesheets),e.unsuspend)){var h=e.unsuspend;e.unsuspend=null,h()}},(e.imgBytes>wh?50:800)+n);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(o),clearTimeout(u)}}:null}function Dl(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Bl(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var ql=null;function Bl(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ql=new Map,n.forEach(P_,e),ql=null,Dl.call(e))}function P_(e,n){if(!(n.state.loading&4)){var a=ql.get(e);if(a)var o=a.get(null);else{a=new Map,ql.set(e,a);for(var u=e.querySelectorAll("link[data-precedence],style[data-precedence]"),h=0;h<u.length;h++){var x=u[h];(x.nodeName==="LINK"||x.getAttribute("media")!=="not all")&&(a.set(x.dataset.precedence,x),o=x)}o&&a.set(null,o)}u=n.instance,x=u.getAttribute("data-precedence"),h=a.get(x)||o,h===o&&a.set(null,u),a.set(x,u),this.count++,o=Dl.bind(this),u.addEventListener("load",o),u.addEventListener("error",o),h?h.parentNode.insertBefore(u,h.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(u,e.firstChild)),n.state.loading|=4}}var Pa={$$typeof:ie,Provider:null,Consumer:null,_currentValue:de,_currentValue2:de,_threadCount:0};function I_(e,n,a,o,u,h,x,E,R){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Nr(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Nr(0),this.hiddenUpdates=Nr(null),this.identifierPrefix=o,this.onUncaughtError=u,this.onCaughtError=h,this.onRecoverableError=x,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=R,this.incompleteTransitions=new Map}function Og(e,n,a,o,u,h,x,E,R,H,J,ne){return e=new I_(e,n,a,x,R,H,J,ne,E),n=1,h===!0&&(n|=24),h=en(3,null,null,n),e.current=h,h.stateNode=e,n=ef(),n.refCount++,e.pooledCache=n,n.refCount++,h.memoizedState={element:o,isDehydrated:a,cache:n},sf(h),e}function Ag(e){return e?(e=ss,e):ss}function jg(e,n,a,o,u,h){u=Ag(u),o.context===null?o.context=u:o.pendingContext=u,o=Ur(n),o.payload={element:a},h=h===void 0?null:h,h!==null&&(o.callback=h),a=Pr(e,o,n),a!==null&&(Xt(a,e,n),ba(a,e,n))}function Tg(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<n?a:n}}function Sh(e,n){Tg(e,n),(e=e.alternate)&&Tg(e,n)}function Ng(e){if(e.tag===13||e.tag===31){var n=Ei(e,67108864);n!==null&&Xt(n,e,67108864),Sh(e,67108864)}}function kg(e){if(e.tag===13||e.tag===31){var n=an();n=nr(n);var a=Ei(e,n);a!==null&&Xt(a,e,n),Sh(e,n)}}var Ll=!0;function $_(e,n,a,o){var u=Y.T;Y.T=null;var h=ae.p;try{ae.p=2,Eh(e,n,a,o)}finally{ae.p=h,Y.T=u}}function H_(e,n,a,o){var u=Y.T;Y.T=null;var h=ae.p;try{ae.p=8,Eh(e,n,a,o)}finally{ae.p=h,Y.T=u}}function Eh(e,n,a,o){if(Ll){var u=Oh(o);if(u===null)uh(e,n,o,zl,a),Mg(e,o);else if(F_(u,e,n,a,o))o.stopPropagation();else if(Mg(e,o),n&4&&-1<G_.indexOf(e)){for(;u!==null;){var h=N(u);if(h!==null)switch(h.tag){case 3:if(h=h.stateNode,h.current.memoizedState.isDehydrated){var x=Mn(h.pendingLanes);if(x!==0){var E=h;for(E.pendingLanes|=2,E.entangledLanes|=2;x;){var R=1<<31-Bt(x);E.entanglements[1]|=R,x&=~R}Kn(h),(Ge&6)===0&&(xl=nt()+500,Da(0))}}break;case 31:case 13:E=Ei(h,2),E!==null&&Xt(E,h,2),wl(),Sh(h,2)}if(h=Oh(o),h===null&&uh(e,n,o,zl,a),h===u)break;u=h}u!==null&&o.stopPropagation()}else uh(e,n,o,null,a)}}function Oh(e){return e=Au(e),Ah(e)}var zl=null;function Ah(e){if(zl=null,e=O(e),e!==null){var n=c(e);if(n===null)e=null;else{var a=n.tag;if(a===13){if(e=d(n),e!==null)return e;e=null}else if(a===31){if(e=p(n),e!==null)return e;e=null}else if(a===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;e=null}else n!==e&&(e=null)}}return zl=e,null}function Cg(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(bu()){case jo:return 2;case To:return 8;case Yi:case vu:return 32;case No:return 268435456;default:return 32}default:return 32}}var jh=!1,Qr=null,Zr=null,Wr=null,Ia=new Map,$a=new Map,ei=[],G_="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Mg(e,n){switch(e){case"focusin":case"focusout":Qr=null;break;case"dragenter":case"dragleave":Zr=null;break;case"mouseover":case"mouseout":Wr=null;break;case"pointerover":case"pointerout":Ia.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":$a.delete(n.pointerId)}}function Ha(e,n,a,o,u,h){return e===null||e.nativeEvent!==h?(e={blockedOn:n,domEventName:a,eventSystemFlags:o,nativeEvent:h,targetContainers:[u]},n!==null&&(n=N(n),n!==null&&Ng(n)),e):(e.eventSystemFlags|=o,n=e.targetContainers,u!==null&&n.indexOf(u)===-1&&n.push(u),e)}function F_(e,n,a,o,u){switch(n){case"focusin":return Qr=Ha(Qr,e,n,a,o,u),!0;case"dragenter":return Zr=Ha(Zr,e,n,a,o,u),!0;case"mouseover":return Wr=Ha(Wr,e,n,a,o,u),!0;case"pointerover":var h=u.pointerId;return Ia.set(h,Ha(Ia.get(h)||null,e,n,a,o,u)),!0;case"gotpointercapture":return h=u.pointerId,$a.set(h,Ha($a.get(h)||null,e,n,a,o,u)),!0}return!1}function Rg(e){var n=O(e.target);if(n!==null){var a=c(n);if(a!==null){if(n=a.tag,n===13){if(n=d(a),n!==null){e.blockedOn=n,Co(e.priority,function(){kg(a)});return}}else if(n===31){if(n=p(a),n!==null){e.blockedOn=n,Co(e.priority,function(){kg(a)});return}}else if(n===3&&a.stateNode.current.memoizedState.isDehydrated){e.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Ul(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var a=Oh(e.nativeEvent);if(a===null){a=e.nativeEvent;var o=new a.constructor(a.type,a);Ou=o,a.target.dispatchEvent(o),Ou=null}else return n=N(a),n!==null&&Ng(n),e.blockedOn=a,!1;n.shift()}return!0}function Dg(e,n,a){Ul(e)&&a.delete(n)}function V_(){jh=!1,Qr!==null&&Ul(Qr)&&(Qr=null),Zr!==null&&Ul(Zr)&&(Zr=null),Wr!==null&&Ul(Wr)&&(Wr=null),Ia.forEach(Dg),$a.forEach(Dg)}function Pl(e,n){e.blockedOn===n&&(e.blockedOn=null,jh||(jh=!0,i.unstable_scheduleCallback(i.unstable_NormalPriority,V_)))}var Il=null;function qg(e){Il!==e&&(Il=e,i.unstable_scheduleCallback(i.unstable_NormalPriority,function(){Il===e&&(Il=null);for(var n=0;n<e.length;n+=3){var a=e[n],o=e[n+1],u=e[n+2];if(typeof o!="function"){if(Ah(o||a)===null)continue;break}var h=N(a);h!==null&&(e.splice(n,3),n-=3,Of(h,{pending:!0,data:u,method:a.method,action:o},o,u))}}))}function Ns(e){function n(R){return Pl(R,e)}Qr!==null&&Pl(Qr,e),Zr!==null&&Pl(Zr,e),Wr!==null&&Pl(Wr,e),Ia.forEach(n),$a.forEach(n);for(var a=0;a<ei.length;a++){var o=ei[a];o.blockedOn===e&&(o.blockedOn=null)}for(;0<ei.length&&(a=ei[0],a.blockedOn===null);)Rg(a),a.blockedOn===null&&ei.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(o=0;o<a.length;o+=3){var u=a[o],h=a[o+1],x=u[ot]||null;if(typeof h=="function")x||qg(a);else if(x){var E=null;if(h&&h.hasAttribute("formAction")){if(u=h,x=h[ot]||null)E=x.formAction;else if(Ah(u)!==null)continue}else E=x.action;typeof E=="function"?a[o+1]=E:(a.splice(o,3),o-=3),qg(a)}}}function Bg(){function e(h){h.canIntercept&&h.info==="react-transition"&&h.intercept({handler:function(){return new Promise(function(x){return u=x})},focusReset:"manual",scroll:"manual"})}function n(){u!==null&&(u(),u=null),o||setTimeout(a,20)}function a(){if(!o&&!navigation.transition){var h=navigation.currentEntry;h&&h.url!=null&&navigation.navigate(h.url,{state:h.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var o=!1,u=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(a,100),function(){o=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),u!==null&&(u(),u=null)}}}function Th(e){this._internalRoot=e}$l.prototype.render=Th.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(s(409));var a=n.current,o=an();jg(a,o,e,n,null,null)},$l.prototype.unmount=Th.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;jg(e.current,2,null,e,null,null),wl(),n[Zt]=null}};function $l(e){this._internalRoot=e}$l.prototype.unstable_scheduleHydration=function(e){if(e){var n=ta();e={blockedOn:null,target:e,priority:n};for(var a=0;a<ei.length&&n!==0&&n<ei[a].priority;a++);ei.splice(a,0,e),a===0&&Rg(e)}};var Lg=t.version;if(Lg!=="19.2.4")throw Error(s(527,Lg,"19.2.4"));ae.findDOMNode=function(e){var n=e._reactInternals;if(n===void 0)throw typeof e.render=="function"?Error(s(188)):(e=Object.keys(e).join(","),Error(s(268,e)));return e=f(n),e=e!==null?m(e):null,e=e===null?null:e.stateNode,e};var Y_={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:Y,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Hl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Hl.isDisabled&&Hl.supportsFiber)try{pi=Hl.inject(Y_),ft=Hl}catch{}}return Ga.createRoot=function(e,n){if(!l(e))throw Error(s(299));var a=!1,o="",u=G0,h=F0,x=V0;return n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onUncaughtError!==void 0&&(u=n.onUncaughtError),n.onCaughtError!==void 0&&(h=n.onCaughtError),n.onRecoverableError!==void 0&&(x=n.onRecoverableError)),n=Og(e,1,!1,null,null,a,o,null,u,h,x,Bg),e[Zt]=n.current,ch(e),new Th(n)},Ga.hydrateRoot=function(e,n,a){if(!l(e))throw Error(s(299));var o=!1,u="",h=G0,x=F0,E=V0,R=null;return a!=null&&(a.unstable_strictMode===!0&&(o=!0),a.identifierPrefix!==void 0&&(u=a.identifierPrefix),a.onUncaughtError!==void 0&&(h=a.onUncaughtError),a.onCaughtError!==void 0&&(x=a.onCaughtError),a.onRecoverableError!==void 0&&(E=a.onRecoverableError),a.formState!==void 0&&(R=a.formState)),n=Og(e,1,!0,n,a??null,o,u,R,h,x,E,Bg),n.context=Ag(null),a=n.current,o=an(),o=nr(o),u=Ur(o),u.callback=null,Pr(a,u,o),a=o,n.current.lanes=a,Rn(n,a),Kn(n),e[Zt]=n.current,ch(e),new $l(n)},Ga.version="19.2.4",Ga}var Fg;function Bw(){if(Fg)return Nh.exports;Fg=1;function i(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(t){console.error(t)}}return i(),Nh.exports=qw(),Nh.exports}var Lw=Bw();const zw="modulepreload",Uw=function(i,t){return new URL(i,t).href},Vg={},we=function(t,r,s){let l=Promise.resolve();if(r&&r.length>0){let d=function(m){return Promise.all(m.map(b=>Promise.resolve(b).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};const p=document.getElementsByTagName("link"),g=document.querySelector("meta[property=csp-nonce]"),f=(g==null?void 0:g.nonce)||(g==null?void 0:g.getAttribute("nonce"));l=d(r.map(m=>{if(m=Uw(m,s),m in Vg)return;Vg[m]=!0;const b=m.endsWith(".css"),v=b?'[rel="stylesheet"]':"";if(!!s)for(let S=p.length-1;S>=0;S--){const M=p[S];if(M.href===m&&(!b||M.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${m}"]${v}`))return;const w=document.createElement("link");if(w.rel=b?"stylesheet":zw,b||(w.as="script"),w.crossOrigin="",w.href=m,f&&w.setAttribute("nonce",f),document.head.appendChild(w),b)return new Promise((S,M)=>{w.addEventListener("load",S),w.addEventListener("error",()=>M(new Error(`Unable to preload CSS for ${m}`)))})}))}function c(d){const p=new Event("vite:preloadError",{cancelable:!0});if(p.payload=d,window.dispatchEvent(p),!p.defaultPrevented)throw d}return l.then(d=>{for(const p of d||[])p.status==="rejected"&&c(p.reason);return t().catch(c)})};function lu(i){try{const t=i.split(".");if(t.length!==3)return null;const r=atob(t[1].replace(/-/g,"+").replace(/_/g,"/"));return JSON.parse(r)}catch{return null}}function fb(i){const t=lu(i);return!t||typeof t.exp!="number"?null:t.exp}function Ed(i,t=0){const r=fb(i);return r===null?!0:Date.now()/1e3>=r-t}const jt=window.__LT_BASE__??"",Jh=`${jt}/api`;class Yg extends Error{constructor(t,r,s){super(t),this.status=r,this.body=s,this.name="ApiError"}}let si=null;function Gl(i){si=i}function hb(){return si}const Pw="X-LT-Acting-Token";let Uc=null,Pc=null;function Kg(i){Uc=i}function Xg(i){Pc=i}function Iw(i){const t=i==null?void 0:i.error;return typeof t=="string"&&/acting[- ]identity/i.test(t)}async function Jg(){const i=sessionStorage.getItem("lt_credentials");if(!i)return null;try{const{username:t,password:r}=JSON.parse(i),s=await fetch(`${Jh}/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:t,password:r})});if(!s.ok)return null;const l=await s.json();return l.token&&l.user&&sessionStorage.setItem("lt_user_info",JSON.stringify({displayName:l.user.display_name,username:l.user.external_id})),l.token??null}catch{return null}}let ni=null;async function Ae(i,t={}){const r={"Content-Type":"application/json",...t.headers};if(si){if(Ed(si)){ni||(ni=Jg().finally(()=>{ni=null}));const c=await ni;if(c)si=c,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:c}}));else throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}r.Authorization=`Bearer ${si}`}const s=(Uc==null?void 0:Uc())??null;s&&(r[Pw]=s);let l=await fetch(`${Jh}${i}`,{...t,headers:r});if(l.status===401&&s){const c=await l.clone().json().catch(()=>null);if(Iw(c))throw Pc==null||Pc(),new Yg(c.error,401,c)}if(l.status===401&&si){ni||(ni=Jg().finally(()=>{ni=null}));const c=await ni;if(c&&(si=c,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:c}})),r.Authorization=`Bearer ${c}`,l=await fetch(`${Jh}${i}`,{...t,headers:r})),l.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}else if(l.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired");if(!l.ok){const c=await l.json().catch(()=>({error:l.statusText}));throw new Yg(c.message||c.error||l.statusText,l.status,c)}return l.json()}const $w="lt_ai_override";function Hw(){return Ae("/settings")}function Gw(){try{if(localStorage.getItem($w)==="off")return!1}catch{}return null}function Wn(){var r;const i=pt({queryKey:["settings"],queryFn:Hw,staleTime:1/0}),t=Gw();return i.data&&t===!1&&((r=i.data.ai)!=null&&r.enabled)?{...i,data:{...i.data,ai:{enabled:!1}}}:i}function Fw(i){var f,m,b;const{data:t}=Wn(),r=((f=t==null?void 0:t.auth)==null?void 0:f.ssoKeepaliveSeconds)??0,s=((m=t==null?void 0:t.auth)==null?void 0:m.ssoKeepaliveIdleTimeoutSeconds)??0,l=j.useRef(Date.now()),c=j.useRef(Date.now()),d=j.useRef(!1),g=!!i&&((b=lu(i))==null?void 0:b.sso)===!0&&r>0;j.useEffect(()=>{if(!g)return;const v=()=>{l.current=Date.now()};window.addEventListener("pointerdown",v,{passive:!0}),window.addEventListener("keydown",v,{passive:!0}),window.addEventListener("wheel",v,{passive:!0});const _=async()=>{if(!d.current&&document.visibilityState==="visible"&&!(s>0&&Date.now()-l.current>s*1e3)){d.current=!0;try{const M=await fetch(`${jt}/api/auth/sso`,{method:"POST"});if(M.status===401||M.status===403){window.dispatchEvent(new CustomEvent("auth:unauthorized"));return}if(!M.ok)return;const B=await M.json().catch(()=>null);B!=null&&B.token&&(c.current=Date.now(),window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:B.token}})))}catch{}finally{d.current=!1}}},w=setInterval(_,r*1e3),S=()=>{document.visibilityState==="visible"&&Date.now()-c.current>r*1e3&&_()};return document.addEventListener("visibilitychange",S),()=>{clearInterval(w),document.removeEventListener("visibilitychange",S),window.removeEventListener("pointerdown",v),window.removeEventListener("keydown",v),window.removeEventListener("wheel",v)}},[g,r,s])}const db=j.createContext(null),Vw=300;function Mh(i,t){if(Ed(i))return null;const r=lu(i);if(!r)return null;const s=t??(()=>{try{const l=sessionStorage.getItem("lt_user_info");return l?JSON.parse(l):null}catch{return null}})();return{userId:r.userId,displayName:(s==null?void 0:s.displayName)??null,username:(s==null?void 0:s.username)??null,roles:r.roles??[]}}function Yw({children:i}){const[t,r]=j.useState(()=>{const b=sessionStorage.getItem("lt_token");return b?Ed(b)?(sessionStorage.removeItem("lt_token"),null):(Gl(b),Mh(b)):null}),s=j.useRef(void 0),l=j.useCallback(b=>{clearTimeout(s.current);const v=fb(b);if(!v)return;const _=(v-Vw)*1e3-Date.now();_<=0||(s.current=setTimeout(async()=>{try{const w=lu(b);if(w!=null&&w.sso){const ce=await fetch(`${jt}/api/auth/sso`,{method:"POST"});if(!ce.ok)return;const C=await ce.json();C.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:C.token}}));return}const S=sessionStorage.getItem("lt_credentials");if(!S)return;const{username:M,password:B}=JSON.parse(S),U=await fetch(`${jt}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:M,password:B})});if(!U.ok)return;const ie=await U.json();ie.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:ie.token}}))}catch{}},_))},[]),c=j.useCallback((b,v,_)=>{const w={displayName:(_==null?void 0:_.displayName)??null,username:(_==null?void 0:_.username)??(v==null?void 0:v.username)??null},S=Mh(b,w);S&&(Gl(b),sessionStorage.setItem("lt_token",b),sessionStorage.setItem("lt_user_info",JSON.stringify(w)),v&&sessionStorage.setItem("lt_credentials",JSON.stringify(v)),r(S),l(b))},[l]),d=j.useCallback(()=>{clearTimeout(s.current);const b=sessionStorage.getItem("lt_sso_logout_url");Gl(null),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info"),sessionStorage.removeItem("lt_sso_logout_url"),r(null),b&&(window.location.href=b)},[]);j.useEffect(()=>{const b=()=>d(),v=_=>{var M;const w=(M=_.detail)==null?void 0:M.token;if(!w)return;const S=Mh(w);S&&(Gl(w),sessionStorage.setItem("lt_token",w),r(S),l(w))};return window.addEventListener("auth:unauthorized",b),window.addEventListener("auth:refreshed",v),()=>{window.removeEventListener("auth:unauthorized",b),window.removeEventListener("auth:refreshed",v)}},[d,l]),j.useEffect(()=>{const b=sessionStorage.getItem("lt_token");return b&&t&&l(b),()=>clearTimeout(s.current)},[]);const p=(t==null?void 0:t.roles.some(b=>b.type==="superadmin"))??!1,g=j.useCallback(b=>(t==null?void 0:t.roles.some(v=>v.role===b))??!1,[t]),f=j.useCallback(b=>(t==null?void 0:t.roles.some(v=>v.type===b))??!1,[t]),m=(t==null?void 0:t.roles.map(b=>b.role))??[];return y.jsxs(db.Provider,{value:{user:t,isAuthenticated:!!t,isSuperAdmin:p,login:c,logout:d,hasRole:g,hasRoleType:f,userRoleNames:m},children:[y.jsx(Kw,{authenticated:t!==null}),i]})}function Kw({authenticated:i}){return Fw(i?sessionStorage.getItem("lt_token"):null),null}function Jt(){const i=j.useContext(db);if(!i)throw new Error("useAuth must be used within AuthProvider");return i}const dn=new Uint8Array(0),Hi=new TextEncoder,fn=new TextDecoder;function Xw(...i){let t=0;for(let l=0;l<i.length;l++)t+=i[l].length;const r=new Uint8Array(t);let s=0;for(let l=0;l<i.length;l++)r.set(i[l],s),s+=i[l].length;return r}function so(...i){const t=[];for(let r=0;r<i.length;r++)t.push(Hi.encode(i[r]));return t.length===0?dn:t.length===1?t[0]:Xw(...t)}function Qg(i){return!i||i.length===0?"":fn.decode(i)}const Zg="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",Wg=36,Jw=0xcfd41b9100000,ey=33,Qw=333,ty=22;function Zw(i){for(let t=0;t<i.length;t++)i[t]=Math.floor(Math.random()*255)}function Ww(i){var t;(t=globalThis==null?void 0:globalThis.crypto)!=null&&t.getRandomValues?globalThis.crypto.getRandomValues(i):Zw(i)}class eS{constructor(){A(this,"buf");A(this,"seq");A(this,"inc");A(this,"inited");this.buf=new Uint8Array(ty),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(Math.random()*Jw),this.inc=Math.floor(Math.random()*(Qw-ey)+ey)}setPre(){const t=new Uint8Array(12);Ww(t);for(let r=0;r<12;r++){const s=t[r]%36;this.buf[r]=Zg.charCodeAt(s)}}fillSeq(){let t=this.seq;for(let r=ty-1;r>=12;r--)this.buf[r]=Zg.charCodeAt(t%Wg),t=Math.floor(t/Wg)}next(){return this.inited||this.init(),this.seq+=this.inc,this.seq>0xcfd41b9100000&&(this.setPre(),this.initSeqAndInc()),this.fillSeq(),String.fromCharCode.apply(String,this.buf)}reset(){this.init()}}const fi=new eS;var wr;(function(i){i.Disconnect="disconnect",i.Reconnect="reconnect",i.Update="update",i.LDM="ldm",i.Error="error"})(wr||(wr={}));var zs;(function(i){i.Reconnecting="reconnecting",i.PingTimer="pingTimer",i.StaleConnection="staleConnection",i.ClientInitiatedReconnect="client initiated reconnect"})(zs||(zs={}));var le;(function(i){i.ApiError="BAD API",i.BadAuthentication="BAD_AUTHENTICATION",i.BadCreds="BAD_CREDS",i.BadHeader="BAD_HEADER",i.BadJson="BAD_JSON",i.BadPayload="BAD_PAYLOAD",i.BadSubject="BAD_SUBJECT",i.Cancelled="CANCELLED",i.ConnectionClosed="CONNECTION_CLOSED",i.ConnectionDraining="CONNECTION_DRAINING",i.ConnectionRefused="CONNECTION_REFUSED",i.ConnectionTimeout="CONNECTION_TIMEOUT",i.Disconnect="DISCONNECT",i.InvalidOption="INVALID_OPTION",i.InvalidPayload="INVALID_PAYLOAD",i.MaxPayloadExceeded="MAX_PAYLOAD_EXCEEDED",i.NoResponders="503",i.NotFunction="NOT_FUNC",i.RequestError="REQUEST_ERROR",i.ServerOptionNotAvailable="SERVER_OPT_NA",i.SubClosed="SUB_CLOSED",i.SubDraining="SUB_DRAINING",i.Timeout="TIMEOUT",i.Tls="TLS",i.Unknown="UNKNOWN_ERROR",i.WssRequired="WSS_REQUIRED",i.JetStreamInvalidAck="JESTREAM_INVALID_ACK",i.JetStream404NoMessages="404",i.JetStream408RequestTimeout="408",i.JetStream409MaxAckPendingExceeded="409",i.JetStream409="409",i.JetStreamNotEnabled="503",i.JetStreamIdleHeartBeat="IDLE_HEARTBEAT",i.AuthorizationViolation="AUTHORIZATION_VIOLATION",i.AuthenticationExpired="AUTHENTICATION_EXPIRED",i.ProtocolError="NATS_PROTOCOL_ERR",i.PermissionsViolation="PERMISSIONS_VIOLATION",i.AuthenticationTimeout="AUTHENTICATION_TIMEOUT",i.AccountExpired="ACCOUNT_EXPIRED"})(le||(le={}));function tS(i){return typeof i.code=="string"}class mb{constructor(){A(this,"messages");this.messages=new Map,this.messages.set(le.InvalidPayload,"Invalid payload type - payloads can be 'binary', 'string', or 'json'"),this.messages.set(le.BadJson,"Bad JSON"),this.messages.set(le.WssRequired,"TLS is required, therefore a secure websocket connection is also required")}static getMessage(t){return nS.getMessage(t)}getMessage(t){return this.messages.get(t)||t}}const nS=new mb;class me extends Error{constructor(r,s,l){super(r);A(this,"name");A(this,"message");A(this,"code");A(this,"permissionContext");A(this,"chainedError");A(this,"api_error");this.name="NatsError",this.message=r,this.code=s,this.chainedError=l}static errorForCode(r,s){const l=mb.getMessage(r);return new me(l,r,s)}isAuthError(){return this.code===le.AuthenticationExpired||this.code===le.AuthorizationViolation||this.code===le.AccountExpired}isAuthTimeout(){return this.code===le.AuthenticationTimeout}isPermissionError(){return this.code===le.PermissionsViolation}isProtocolError(){return this.code===le.ProtocolError}isJetStreamError(){return this.api_error!==void 0}jsError(){return this.api_error?this.api_error:null}}var cn;(function(i){i[i.Exact=0]="Exact",i[i.CanonicalMIME=1]="CanonicalMIME",i[i.IgnoreCase=2]="IgnoreCase"})(cn||(cn={}));var $n;(function(i){i.Timer="timer",i.Count="count",i.JitterTimer="jitterTimer",i.SentinelMsg="sentinelMsg"})($n||($n={}));var ao;(function(i){i.STATS="io.nats.micro.v1.stats_response",i.INFO="io.nats.micro.v1.info_response",i.PING="io.nats.micro.v1.ping_response"})(ao||(ao={}));const Kc="Nats-Service-Error",Xc="Nats-Service-Error-Code";class Jc extends Error{constructor(r,s){super(s);A(this,"code");this.code=r}static isServiceError(r){return Jc.toServiceError(r)!==null}static toServiceError(r){var l,c;const s=((l=r==null?void 0:r.headers)==null?void 0:l.get(Xc))||"";if(s!==""){const d=parseInt(s)||400,p=((c=r==null?void 0:r.headers)==null?void 0:c.get(Kc))||"";return new Jc(d,p.length?p:s)}return null}}function Sr(i=""){if(i=i||"_INBOX",typeof i!="string")throw new Error("prefix must be a string");return i.split(".").forEach(t=>{if(t==="*"||t===">")throw new Error(`inbox prefixes cannot have wildcards '${i}'`)}),`${i}.${fi.next()}`}const Qh="127.0.0.1";var ai;(function(i){i.PING="PING",i.STATS="STATS",i.INFO="INFO"})(ai||(ai={}));function cu(i,...t){for(let r=0;r<t.length;r++){const s=t[r];Object.keys(s).forEach(function(l){i[l]=s[l]})}return i}function Fl(i){return fn.decode(i).replace(/\n/g,"␊").replace(/\r/g,"␍")}function Gs(i,t=!0){const r=t?me.errorForCode(le.Timeout):null;let s,l;const c=new Promise((d,p)=>{s={cancel:()=>{l&&clearTimeout(l)}},l=setTimeout(()=>{p(r===null?me.errorForCode(le.Timeout):r)},i)});return Object.assign(c,s)}function Ys(i=0){let t;const r=new Promise(s=>{const l=setTimeout(()=>{s()},i);t={cancel:()=>{l&&clearTimeout(l)}}});return Object.assign(r,t)}function st(){let i={};const t=new Promise((r,s)=>{i={resolve:r,reject:s}});return Object.assign(t,i)}function pb(i){for(let t=i.length-1;t>0;t--){const r=Math.floor(Math.random()*(t+1));[i[t],i[r]]=[i[r],i[t]]}return i}function rS(i){return i===0?0:Math.floor(i/2+Math.random()*i)}function Od(i=[0,250,250,500,500,3e3,5e3]){Array.isArray(i)||(i=[0,250,250,500,500,3e3,5e3]);const t=i.length-1;return{backoff(r){return rS(r>t?i[t]:i[r])}}}function it(i){return i*1e6}function Ad(i){return Math.floor(i/1e6)}function ny(i){let s=!0;const l=new Array(i.length);for(let c=0;c<i.length;c++){let d=i.charCodeAt(c);if(d===58||d<33||d>126)throw new me(`'${i[c]}' is not a valid character for a header key`,le.BadHeader);s&&97<=d&&d<=122?d-=32:!s&&65<=d&&d<=90&&(d+=32),l[c]=d,s=d==45}return String.fromCharCode(...l)}function Er(i=0,t=""){if(i===0&&t!==""||i>0&&t==="")throw new Error("setting status requires both code and description");return new oi(i,t)}const Rh="NATS/1.0";class oi{constructor(t=0,r=""){A(this,"_code");A(this,"headers");A(this,"_description");this._code=t,this._description=r,this.headers=new Map}[Symbol.iterator](){return this.headers.entries()}size(){return this.headers.size}equals(t){if(t&&this.headers.size===t.headers.size&&this._code===t._code){for(const[r,s]of this.headers){const l=t.values(r);if(s.length!==l.length)return!1;const c=[...s].sort(),d=[...l].sort();for(let p=0;p<c.length;p++)if(c[p]!==d[p])return!1}return!0}return!1}static decode(t){const r=new oi,l=fn.decode(t).split(`\r
27
- `),c=l[0];if(c!==Rh){let d=c.replace(Rh,"").trim();if(d.length>0){r._code=parseInt(d,10),isNaN(r._code)&&(r._code=0);const p=r._code.toString();d=d.replace(p,""),r._description=d.trim()}}return l.length>=1&&l.slice(1).map(d=>{if(d){const p=d.indexOf(":");if(p>-1){const g=d.slice(0,p),f=d.slice(p+1).trim();r.append(g,f)}}}),r}toString(){if(this.headers.size===0&&this._code===0)return"";let t=Rh;this._code>0&&this._description!==""&&(t+=` ${this._code} ${this._description}`);for(const[r,s]of this.headers)for(let l=0;l<s.length;l++)t=`${t}\r
25
+ `+o.stack}}var Js=Object.prototype.hasOwnProperty,Qs=i.unstable_scheduleCallback,er=i.unstable_cancelCallback,Ao=i.unstable_shouldYield,Vi=i.unstable_requestPaint,nt=i.unstable_now,vu=i.unstable_getCurrentPriorityLevel,jo=i.unstable_ImmediatePriority,To=i.unstable_UserBlockingPriority,Yi=i.unstable_NormalPriority,xu=i.unstable_LowPriority,No=i.unstable_IdlePriority,_u=i.log,ko=i.unstable_setDisableYieldValue,pi=null,dt=null;function Qt(e){if(typeof _u=="function"&&ko(e),dt&&typeof dt.setStrictMode=="function")try{dt.setStrictMode(pi,e)}catch{}}var Bt=Math.clz32?Math.clz32:Ki,Zs=Math.log,Ws=Math.LN2;function Ki(e){return e>>>=0,e===0?32:31-(Zs(e)/Ws|0)|0}var jr=256,tr=262144,Tr=4194304;function Mn(e){var n=e&42;if(n!==0)return n;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function gi(e,n,a){var o=e.pendingLanes;if(o===0)return 0;var u=0,h=e.suspendedLanes,x=e.pingedLanes;e=e.warmLanes;var E=o&134217727;return E!==0?(o=E&~h,o!==0?u=Mn(o):(x&=E,x!==0?u=Mn(x):a||(a=E&~e,a!==0&&(u=Mn(a))))):(E=o&~h,E!==0?u=Mn(E):x!==0?u=Mn(x):a||(a=o&~e,a!==0&&(u=Mn(a)))),u===0?0:n!==0&&n!==u&&(n&h)===0&&(h=u&-u,a=n&-n,h>=a||h===32&&(a&4194048)!==0)?n:u}function yi(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)===0}function ea(e,n){switch(e){case 1:case 2:case 4:case 8:case 64:return n+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Xi(){var e=Tr;return Tr<<=1,(Tr&62914560)===0&&(Tr=4194304),e}function Nr(e){for(var n=[],a=0;31>a;a++)n.push(e);return n}function Rn(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function kr(e,n,a,o,u,h){var x=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var E=e.entanglements,R=e.expirationTimes,H=e.hiddenUpdates;for(a=x&~a;0<a;){var J=31-Bt(a),ne=1<<J;E[J]=0,R[J]=-1;var F=H[J];if(F!==null)for(H[J]=null,J=0;J<F.length;J++){var K=F[J];K!==null&&(K.lane&=-536870913)}a&=~ne}o!==0&&Cr(e,o,0),h!==0&&u===0&&e.tag!==0&&(e.suspendedLanes|=h&~(x&~n))}function Cr(e,n,a){e.pendingLanes|=n,e.suspendedLanes&=~n;var o=31-Bt(n);e.entangledLanes|=n,e.entanglements[o]=e.entanglements[o]|1073741824|a&261930}function bi(e,n){var a=e.entangledLanes|=n;for(e=e.entanglements;a;){var o=31-Bt(a),u=1<<o;u&n|e[o]&n&&(e[o]|=n),a&=~u}}function Mr(e,n){var a=n&-n;return a=(a&42)!==0?1:nr(a),(a&(e.suspendedLanes|n))!==0?0:a}function nr(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function vi(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function ta(){var e=ae.p;return e!==0?e:(e=window.event,e===void 0?32:Cg(e.type))}function Co(e,n){var a=ae.p;try{return ae.p=e,n()}finally{ae.p=a}}var Gn=Math.random().toString(36).slice(2),Qe="__reactFiber$"+Gn,ot="__reactProps$"+Gn,Zt="__reactContainer$"+Gn,xi="__reactEvents$"+Gn,na="__reactListeners$"+Gn,Mo="__reactHandles$"+Gn,Ro="__reactResources$"+Gn,wt="__reactMarker$"+Gn;function Ji(e){delete e[Qe],delete e[ot],delete e[xi],delete e[na],delete e[Mo]}function O(e){var n=e[Qe];if(n)return n;for(var a=e.parentNode;a;){if(n=a[Zt]||a[Qe]){if(a=n.alternate,n.child!==null||a!==null&&a.child!==null)for(e=pg(e);e!==null;){if(a=e[Qe])return a;e=pg(e)}return n}e=a,a=e.parentNode}return null}function N(e){if(e=e[Qe]||e[Zt]){var n=e.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return e}return null}function T(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e.stateNode;throw Error(s(33))}function k(e){var n=e[Ro];return n||(n=e[Ro]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function D(e){e[wt]=!0}var I=new Set,te={};function se(e,n){V(e,n),V(e+"Capture",n)}function V(e,n){for(te[e]=n,e=0;e<n.length;e++)I.add(n[e])}var ee=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),pe={},Re={};function We(e){return Js.call(Re,e)?!0:Js.call(pe,e)?!1:ee.test(e)?Re[e]=!0:(pe[e]=!0,!1)}function Lt(e,n,a){if(We(n))if(a===null)e.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":e.removeAttribute(n);return;case"boolean":var o=n.toLowerCase().slice(0,5);if(o!=="data-"&&o!=="aria-"){e.removeAttribute(n);return}}e.setAttribute(n,""+a)}}function Dn(e,n,a){if(a===null)e.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttribute(n,""+a)}}function rr(e,n,a,o){if(o===null)e.removeAttribute(a);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttributeNS(n,a,""+o)}}function vn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Wd(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function Vv(e,n,a){var o=Object.getOwnPropertyDescriptor(e.constructor.prototype,n);if(!e.hasOwnProperty(n)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var u=o.get,h=o.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return u.call(this)},set:function(x){a=""+x,h.call(this,x)}}),Object.defineProperty(e,n,{enumerable:o.enumerable}),{getValue:function(){return a},setValue:function(x){a=""+x},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function wu(e){if(!e._valueTracker){var n=Wd(e)?"checked":"value";e._valueTracker=Vv(e,n,""+e[n])}}function em(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var a=n.getValue(),o="";return e&&(o=Wd(e)?e.checked?"true":"false":e.value),e=o,e!==a?(n.setValue(e),!0):!1}function Do(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var Yv=/[\n"\\]/g;function xn(e){return e.replace(Yv,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function Su(e,n,a,o,u,h,x,E){e.name="",x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"?e.type=x:e.removeAttribute("type"),n!=null?x==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+vn(n)):e.value!==""+vn(n)&&(e.value=""+vn(n)):x!=="submit"&&x!=="reset"||e.removeAttribute("value"),n!=null?Eu(e,x,vn(n)):a!=null?Eu(e,x,vn(a)):o!=null&&e.removeAttribute("value"),u==null&&h!=null&&(e.defaultChecked=!!h),u!=null&&(e.checked=u&&typeof u!="function"&&typeof u!="symbol"),E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"?e.name=""+vn(E):e.removeAttribute("name")}function tm(e,n,a,o,u,h,x,E){if(h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"&&(e.type=h),n!=null||a!=null){if(!(h!=="submit"&&h!=="reset"||n!=null)){wu(e);return}a=a!=null?""+vn(a):"",n=n!=null?""+vn(n):a,E||n===e.value||(e.value=n),e.defaultValue=n}o=o??u,o=typeof o!="function"&&typeof o!="symbol"&&!!o,e.checked=E?e.checked:!!o,e.defaultChecked=!!o,x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(e.name=x),wu(e)}function Eu(e,n,a){n==="number"&&Do(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function Qi(e,n,a,o){if(e=e.options,n){n={};for(var u=0;u<a.length;u++)n["$"+a[u]]=!0;for(a=0;a<e.length;a++)u=n.hasOwnProperty("$"+e[a].value),e[a].selected!==u&&(e[a].selected=u),u&&o&&(e[a].defaultSelected=!0)}else{for(a=""+vn(a),n=null,u=0;u<e.length;u++){if(e[u].value===a){e[u].selected=!0,o&&(e[u].defaultSelected=!0);return}n!==null||e[u].disabled||(n=e[u])}n!==null&&(n.selected=!0)}}function nm(e,n,a){if(n!=null&&(n=""+vn(n),n!==e.value&&(e.value=n),a==null)){e.defaultValue!==n&&(e.defaultValue=n);return}e.defaultValue=a!=null?""+vn(a):""}function rm(e,n,a,o){if(n==null){if(o!=null){if(a!=null)throw Error(s(92));if(Te(o)){if(1<o.length)throw Error(s(93));o=o[0]}a=o}a==null&&(a=""),n=a}a=vn(n),e.defaultValue=a,o=e.textContent,o===a&&o!==""&&o!==null&&(e.value=o),wu(e)}function Zi(e,n){if(n){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=n;return}}e.textContent=n}var Kv=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function im(e,n,a){var o=n.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?o?e.setProperty(n,""):n==="float"?e.cssFloat="":e[n]="":o?e.setProperty(n,a):typeof a!="number"||a===0||Kv.has(n)?n==="float"?e.cssFloat=a:e[n]=(""+a).trim():e[n]=a+"px"}function sm(e,n,a){if(n!=null&&typeof n!="object")throw Error(s(62));if(e=e.style,a!=null){for(var o in a)!a.hasOwnProperty(o)||n!=null&&n.hasOwnProperty(o)||(o.indexOf("--")===0?e.setProperty(o,""):o==="float"?e.cssFloat="":e[o]="");for(var u in n)o=n[u],n.hasOwnProperty(u)&&a[u]!==o&&im(e,u,o)}else for(var h in n)n.hasOwnProperty(h)&&im(e,h,n[h])}function Ou(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 Xv=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"]]),Jv=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function qo(e){return Jv.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function ir(){}var Au=null;function ju(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Wi=null,es=null;function am(e){var n=N(e);if(n&&(e=n.stateNode)){var a=e[ot]||null;e:switch(e=n.stateNode,n.type){case"input":if(Su(e,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),n=a.name,a.type==="radio"&&n!=null){for(a=e;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+xn(""+n)+'"][type="radio"]'),n=0;n<a.length;n++){var o=a[n];if(o!==e&&o.form===e.form){var u=o[ot]||null;if(!u)throw Error(s(90));Su(o,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name)}}for(n=0;n<a.length;n++)o=a[n],o.form===e.form&&em(o)}break e;case"textarea":nm(e,a.value,a.defaultValue);break e;case"select":n=a.value,n!=null&&Qi(e,!!a.multiple,n,!1)}}}var Tu=!1;function om(e,n,a){if(Tu)return e(n,a);Tu=!0;try{var o=e(n);return o}finally{if(Tu=!1,(Wi!==null||es!==null)&&(wl(),Wi&&(n=Wi,e=es,es=Wi=null,am(n),e)))for(n=0;n<e.length;n++)am(e[n])}}function ra(e,n){var a=e.stateNode;if(a===null)return null;var o=a[ot]||null;if(o===null)return null;a=o[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(o=!o.disabled)||(e=e.type,o=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!o;break e;default:e=!1}if(e)return null;if(a&&typeof a!="function")throw Error(s(231,n,typeof a));return a}var sr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Nu=!1;if(sr)try{var ia={};Object.defineProperty(ia,"passive",{get:function(){Nu=!0}}),window.addEventListener("test",ia,ia),window.removeEventListener("test",ia,ia)}catch{Nu=!1}var Rr=null,ku=null,Bo=null;function lm(){if(Bo)return Bo;var e,n=ku,a=n.length,o,u="value"in Rr?Rr.value:Rr.textContent,h=u.length;for(e=0;e<a&&n[e]===u[e];e++);var x=a-e;for(o=1;o<=x&&n[a-o]===u[h-o];o++);return Bo=u.slice(e,1<o?1-o:void 0)}function Lo(e){var n=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&n===13&&(e=13)):e=n,e===10&&(e=13),32<=e||e===13?e:0}function zo(){return!0}function cm(){return!1}function Ft(e){function n(a,o,u,h,x){this._reactName=a,this._targetInst=u,this.type=o,this.nativeEvent=h,this.target=x,this.currentTarget=null;for(var E in e)e.hasOwnProperty(E)&&(a=e[E],this[E]=a?a(h):h[E]);return this.isDefaultPrevented=(h.defaultPrevented!=null?h.defaultPrevented:h.returnValue===!1)?zo:cm,this.isPropagationStopped=cm,this}return b(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=zo)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=zo)},persist:function(){},isPersistent:zo}),n}var _i={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Uo=Ft(_i),sa=b({},_i,{view:0,detail:0}),Qv=Ft(sa),Cu,Mu,aa,Po=b({},sa,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Du,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==aa&&(aa&&e.type==="mousemove"?(Cu=e.screenX-aa.screenX,Mu=e.screenY-aa.screenY):Mu=Cu=0,aa=e),Cu)},movementY:function(e){return"movementY"in e?e.movementY:Mu}}),um=Ft(Po),Zv=b({},Po,{dataTransfer:0}),Wv=Ft(Zv),ex=b({},sa,{relatedTarget:0}),Ru=Ft(ex),tx=b({},_i,{animationName:0,elapsedTime:0,pseudoElement:0}),nx=Ft(tx),rx=b({},_i,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),ix=Ft(rx),sx=b({},_i,{data:0}),fm=Ft(sx),ax={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},ox={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"},lx={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function cx(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=lx[e])?!!n[e]:!1}function Du(){return cx}var ux=b({},sa,{key:function(e){if(e.key){var n=ax[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=Lo(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?ox[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Du,charCode:function(e){return e.type==="keypress"?Lo(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Lo(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),fx=Ft(ux),hx=b({},Po,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),hm=Ft(hx),dx=b({},sa,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Du}),mx=Ft(dx),px=b({},_i,{propertyName:0,elapsedTime:0,pseudoElement:0}),gx=Ft(px),yx=b({},Po,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),bx=Ft(yx),vx=b({},_i,{newState:0,oldState:0}),xx=Ft(vx),_x=[9,13,27,32],qu=sr&&"CompositionEvent"in window,oa=null;sr&&"documentMode"in document&&(oa=document.documentMode);var wx=sr&&"TextEvent"in window&&!oa,dm=sr&&(!qu||oa&&8<oa&&11>=oa),mm=" ",pm=!1;function gm(e,n){switch(e){case"keyup":return _x.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ym(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ts=!1;function Sx(e,n){switch(e){case"compositionend":return ym(n);case"keypress":return n.which!==32?null:(pm=!0,mm);case"textInput":return e=n.data,e===mm&&pm?null:e;default:return null}}function Ex(e,n){if(ts)return e==="compositionend"||!qu&&gm(e,n)?(e=lm(),Bo=ku=Rr=null,ts=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return dm&&n.locale!=="ko"?null:n.data;default:return null}}var Ox={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function bm(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n==="input"?!!Ox[e.type]:n==="textarea"}function vm(e,n,a,o){Wi?es?es.push(o):es=[o]:Wi=o,n=Nl(n,"onChange"),0<n.length&&(a=new Uo("onChange","change",null,a,o),e.push({event:a,listeners:n}))}var la=null,ca=null;function Ax(e){tg(e,0)}function Io(e){var n=T(e);if(em(n))return e}function xm(e,n){if(e==="change")return n}var _m=!1;if(sr){var Bu;if(sr){var Lu="oninput"in document;if(!Lu){var wm=document.createElement("div");wm.setAttribute("oninput","return;"),Lu=typeof wm.oninput=="function"}Bu=Lu}else Bu=!1;_m=Bu&&(!document.documentMode||9<document.documentMode)}function Sm(){la&&(la.detachEvent("onpropertychange",Em),ca=la=null)}function Em(e){if(e.propertyName==="value"&&Io(ca)){var n=[];vm(n,ca,e,ju(e)),om(Ax,n)}}function jx(e,n,a){e==="focusin"?(Sm(),la=n,ca=a,la.attachEvent("onpropertychange",Em)):e==="focusout"&&Sm()}function Tx(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Io(ca)}function Nx(e,n){if(e==="click")return Io(n)}function kx(e,n){if(e==="input"||e==="change")return Io(n)}function Cx(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var Wt=typeof Object.is=="function"?Object.is:Cx;function ua(e,n){if(Wt(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;var a=Object.keys(e),o=Object.keys(n);if(a.length!==o.length)return!1;for(o=0;o<a.length;o++){var u=a[o];if(!Js.call(n,u)||!Wt(e[u],n[u]))return!1}return!0}function Om(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Am(e,n){var a=Om(e);e=0;for(var o;a;){if(a.nodeType===3){if(o=e+a.textContent.length,e<=n&&o>=n)return{node:a,offset:n-e};e=o}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Om(a)}}function jm(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?jm(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function Tm(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=Do(e.document);n instanceof e.HTMLIFrameElement;){try{var a=typeof n.contentWindow.location.href=="string"}catch{a=!1}if(a)e=n.contentWindow;else break;n=Do(e.document)}return n}function zu(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}var Mx=sr&&"documentMode"in document&&11>=document.documentMode,ns=null,Uu=null,fa=null,Pu=!1;function Nm(e,n,a){var o=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Pu||ns==null||ns!==Do(o)||(o=ns,"selectionStart"in o&&zu(o)?o={start:o.selectionStart,end:o.selectionEnd}:(o=(o.ownerDocument&&o.ownerDocument.defaultView||window).getSelection(),o={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}),fa&&ua(fa,o)||(fa=o,o=Nl(Uu,"onSelect"),0<o.length&&(n=new Uo("onSelect","select",null,n,a),e.push({event:n,listeners:o}),n.target=ns)))}function wi(e,n){var a={};return a[e.toLowerCase()]=n.toLowerCase(),a["Webkit"+e]="webkit"+n,a["Moz"+e]="moz"+n,a}var rs={animationend:wi("Animation","AnimationEnd"),animationiteration:wi("Animation","AnimationIteration"),animationstart:wi("Animation","AnimationStart"),transitionrun:wi("Transition","TransitionRun"),transitionstart:wi("Transition","TransitionStart"),transitioncancel:wi("Transition","TransitionCancel"),transitionend:wi("Transition","TransitionEnd")},Iu={},km={};sr&&(km=document.createElement("div").style,"AnimationEvent"in window||(delete rs.animationend.animation,delete rs.animationiteration.animation,delete rs.animationstart.animation),"TransitionEvent"in window||delete rs.transitionend.transition);function Si(e){if(Iu[e])return Iu[e];if(!rs[e])return e;var n=rs[e],a;for(a in n)if(n.hasOwnProperty(a)&&a in km)return Iu[e]=n[a];return e}var Cm=Si("animationend"),Mm=Si("animationiteration"),Rm=Si("animationstart"),Rx=Si("transitionrun"),Dx=Si("transitionstart"),qx=Si("transitioncancel"),Dm=Si("transitionend"),qm=new Map,$u="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(" ");$u.push("scrollEnd");function qn(e,n){qm.set(e,n),se(n,[e])}var $o=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},_n=[],is=0,Hu=0;function Ho(){for(var e=is,n=Hu=is=0;n<e;){var a=_n[n];_n[n++]=null;var o=_n[n];_n[n++]=null;var u=_n[n];_n[n++]=null;var h=_n[n];if(_n[n++]=null,o!==null&&u!==null){var x=o.pending;x===null?u.next=u:(u.next=x.next,x.next=u),o.pending=u}h!==0&&Bm(a,u,h)}}function Go(e,n,a,o){_n[is++]=e,_n[is++]=n,_n[is++]=a,_n[is++]=o,Hu|=o,e.lanes|=o,e=e.alternate,e!==null&&(e.lanes|=o)}function Gu(e,n,a,o){return Go(e,n,a,o),Fo(e)}function Ei(e,n){return Go(e,null,null,n),Fo(e)}function Bm(e,n,a){e.lanes|=a;var o=e.alternate;o!==null&&(o.lanes|=a);for(var u=!1,h=e.return;h!==null;)h.childLanes|=a,o=h.alternate,o!==null&&(o.childLanes|=a),h.tag===22&&(e=h.stateNode,e===null||e._visibility&1||(u=!0)),e=h,h=h.return;return e.tag===3?(h=e.stateNode,u&&n!==null&&(u=31-Bt(a),e=h.hiddenUpdates,o=e[u],o===null?e[u]=[n]:o.push(n),n.lane=a|536870912),h):null}function Fo(e){if(50<Ra)throw Ra=0,eh=null,Error(s(185));for(var n=e.return;n!==null;)e=n,n=e.return;return e.tag===3?e.stateNode:null}var ss={};function Bx(e,n,a,o){this.tag=e,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=o,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function en(e,n,a,o){return new Bx(e,n,a,o)}function Fu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ar(e,n){var a=e.alternate;return a===null?(a=en(e.tag,n,e.key,e.mode),a.elementType=e.elementType,a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=n,a.type=e.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=e.flags&65011712,a.childLanes=e.childLanes,a.lanes=e.lanes,a.child=e.child,a.memoizedProps=e.memoizedProps,a.memoizedState=e.memoizedState,a.updateQueue=e.updateQueue,n=e.dependencies,a.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a.refCleanup=e.refCleanup,a}function Lm(e,n){e.flags&=65011714;var a=e.alternate;return a===null?(e.childLanes=0,e.lanes=n,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=a.childLanes,e.lanes=a.lanes,e.child=a.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=a.memoizedProps,e.memoizedState=a.memoizedState,e.updateQueue=a.updateQueue,e.type=a.type,n=a.dependencies,e.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),e}function Vo(e,n,a,o,u,h){var x=0;if(o=e,typeof e=="function")Fu(e)&&(x=1);else if(typeof e=="string")x=I_(e,a,be.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case L:return e=en(31,a,n,u),e.elementType=L,e.lanes=h,e;case S:return Oi(a.children,u,h,n);case M:x=8,u|=24;break;case B:return e=en(12,a,n,u|2),e.elementType=B,e.lanes=h,e;case C:return e=en(13,a,n,u),e.elementType=C,e.lanes=h,e;case z:return e=en(19,a,n,u),e.elementType=z,e.lanes=h,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case ie:x=10;break e;case U:x=9;break e;case ce:x=11;break e;case re:x=14;break e;case X:x=16,o=null;break e}x=29,a=Error(s(130,e===null?"null":typeof e,"")),o=null}return n=en(x,a,n,u),n.elementType=e,n.type=o,n.lanes=h,n}function Oi(e,n,a,o){return e=en(7,e,o,n),e.lanes=a,e}function Vu(e,n,a){return e=en(6,e,null,n),e.lanes=a,e}function zm(e){var n=en(18,null,null,0);return n.stateNode=e,n}function Yu(e,n,a){return n=en(4,e.children!==null?e.children:[],e.key,n),n.lanes=a,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}var Um=new WeakMap;function wn(e,n){if(typeof e=="object"&&e!==null){var a=Um.get(e);return a!==void 0?a:(n={value:e,source:n,stack:Oo(n)},Um.set(e,n),n)}return{value:e,source:n,stack:Oo(n)}}var as=[],os=0,Yo=null,ha=0,Sn=[],En=0,Dr=null,Fn=1,Vn="";function or(e,n){as[os++]=ha,as[os++]=Yo,Yo=e,ha=n}function Pm(e,n,a){Sn[En++]=Fn,Sn[En++]=Vn,Sn[En++]=Dr,Dr=e;var o=Fn;e=Vn;var u=32-Bt(o)-1;o&=~(1<<u),a+=1;var h=32-Bt(n)+u;if(30<h){var x=u-u%5;h=(o&(1<<x)-1).toString(32),o>>=x,u-=x,Fn=1<<32-Bt(n)+u|a<<u|o,Vn=h+e}else Fn=1<<h|a<<u|o,Vn=e}function Ku(e){e.return!==null&&(or(e,1),Pm(e,1,0))}function Xu(e){for(;e===Yo;)Yo=as[--os],as[os]=null,ha=as[--os],as[os]=null;for(;e===Dr;)Dr=Sn[--En],Sn[En]=null,Vn=Sn[--En],Sn[En]=null,Fn=Sn[--En],Sn[En]=null}function Im(e,n){Sn[En++]=Fn,Sn[En++]=Vn,Sn[En++]=Dr,Fn=n.id,Vn=n.overflow,Dr=e}var Nt=null,et=null,ze=!1,qr=null,On=!1,Ju=Error(s(519));function Br(e){var n=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw da(wn(n,e)),Ju}function $m(e){var n=e.stateNode,a=e.type,o=e.memoizedProps;switch(n[Qe]=e,n[ot]=o,a){case"dialog":qe("cancel",n),qe("close",n);break;case"iframe":case"object":case"embed":qe("load",n);break;case"video":case"audio":for(a=0;a<qa.length;a++)qe(qa[a],n);break;case"source":qe("error",n);break;case"img":case"image":case"link":qe("error",n),qe("load",n);break;case"details":qe("toggle",n);break;case"input":qe("invalid",n),tm(n,o.value,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name,!0);break;case"select":qe("invalid",n);break;case"textarea":qe("invalid",n),rm(n,o.value,o.defaultValue,o.children)}a=o.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||n.textContent===""+a||o.suppressHydrationWarning===!0||sg(n.textContent,a)?(o.popover!=null&&(qe("beforetoggle",n),qe("toggle",n)),o.onScroll!=null&&qe("scroll",n),o.onScrollEnd!=null&&qe("scrollend",n),o.onClick!=null&&(n.onclick=ir),n=!0):n=!1,n||Br(e,!0)}function Hm(e){for(Nt=e.return;Nt;)switch(Nt.tag){case 5:case 31:case 13:On=!1;return;case 27:case 3:On=!0;return;default:Nt=Nt.return}}function ls(e){if(e!==Nt)return!1;if(!ze)return Hm(e),ze=!0,!1;var n=e.tag,a;if((a=n!==3&&n!==27)&&((a=n===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||ph(e.type,e.memoizedProps)),a=!a),a&&et&&Br(e),Hm(e),n===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(s(317));et=mg(e)}else if(n===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(s(317));et=mg(e)}else n===27?(n=et,Jr(e.type)?(e=xh,xh=null,et=e):et=n):et=Nt?jn(e.stateNode.nextSibling):null;return!0}function Ai(){et=Nt=null,ze=!1}function Qu(){var e=qr;return e!==null&&(Xt===null?Xt=e:Xt.push.apply(Xt,e),qr=null),e}function da(e){qr===null?qr=[e]:qr.push(e)}var Zu=je(null),ji=null,lr=null;function Lr(e,n,a){Ne(Zu,n._currentValue),n._currentValue=a}function cr(e){e._currentValue=Zu.current,Se(Zu)}function Wu(e,n,a){for(;e!==null;){var o=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,o!==null&&(o.childLanes|=n)):o!==null&&(o.childLanes&n)!==n&&(o.childLanes|=n),e===a)break;e=e.return}}function ef(e,n,a,o){var u=e.child;for(u!==null&&(u.return=e);u!==null;){var h=u.dependencies;if(h!==null){var x=u.child;h=h.firstContext;e:for(;h!==null;){var E=h;h=u;for(var R=0;R<n.length;R++)if(E.context===n[R]){h.lanes|=a,E=h.alternate,E!==null&&(E.lanes|=a),Wu(h.return,a,e),o||(x=null);break e}h=E.next}}else if(u.tag===18){if(x=u.return,x===null)throw Error(s(341));x.lanes|=a,h=x.alternate,h!==null&&(h.lanes|=a),Wu(x,a,e),x=null}else x=u.child;if(x!==null)x.return=u;else for(x=u;x!==null;){if(x===e){x=null;break}if(u=x.sibling,u!==null){u.return=x.return,x=u;break}x=x.return}u=x}}function cs(e,n,a,o){e=null;for(var u=n,h=!1;u!==null;){if(!h){if((u.flags&524288)!==0)h=!0;else if((u.flags&262144)!==0)break}if(u.tag===10){var x=u.alternate;if(x===null)throw Error(s(387));if(x=x.memoizedProps,x!==null){var E=u.type;Wt(u.pendingProps.value,x.value)||(e!==null?e.push(E):e=[E])}}else if(u===Rt.current){if(x=u.alternate,x===null)throw Error(s(387));x.memoizedState.memoizedState!==u.memoizedState.memoizedState&&(e!==null?e.push(Pa):e=[Pa])}u=u.return}e!==null&&ef(n,e,a,o),n.flags|=262144}function Ko(e){for(e=e.firstContext;e!==null;){if(!Wt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Ti(e){ji=e,lr=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function kt(e){return Gm(ji,e)}function Xo(e,n){return ji===null&&Ti(e),Gm(e,n)}function Gm(e,n){var a=n._currentValue;if(n={context:n,memoizedValue:a,next:null},lr===null){if(e===null)throw Error(s(308));lr=n,e.dependencies={lanes:0,firstContext:n},e.flags|=524288}else lr=lr.next=n;return a}var Lx=typeof AbortController<"u"?AbortController:function(){var e=[],n=this.signal={aborted:!1,addEventListener:function(a,o){e.push(o)}};this.abort=function(){n.aborted=!0,e.forEach(function(a){return a()})}},zx=i.unstable_scheduleCallback,Ux=i.unstable_NormalPriority,yt={$$typeof:ie,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function tf(){return{controller:new Lx,data:new Map,refCount:0}}function ma(e){e.refCount--,e.refCount===0&&zx(Ux,function(){e.controller.abort()})}var pa=null,nf=0,us=0,fs=null;function Px(e,n){if(pa===null){var a=pa=[];nf=0,us=ah(),fs={status:"pending",value:void 0,then:function(o){a.push(o)}}}return nf++,n.then(Fm,Fm),n}function Fm(){if(--nf===0&&pa!==null){fs!==null&&(fs.status="fulfilled");var e=pa;pa=null,us=0,fs=null;for(var n=0;n<e.length;n++)(0,e[n])()}}function Ix(e,n){var a=[],o={status:"pending",value:null,reason:null,then:function(u){a.push(u)}};return e.then(function(){o.status="fulfilled",o.value=n;for(var u=0;u<a.length;u++)(0,a[u])(n)},function(u){for(o.status="rejected",o.reason=u,u=0;u<a.length;u++)(0,a[u])(void 0)}),o}var Vm=Y.S;Y.S=function(e,n){Np=nt(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&Px(e,n),Vm!==null&&Vm(e,n)};var Ni=je(null);function rf(){var e=Ni.current;return e!==null?e:Ze.pooledCache}function Jo(e,n){n===null?Ne(Ni,Ni.current):Ne(Ni,n.pool)}function Ym(){var e=rf();return e===null?null:{parent:yt._currentValue,pool:e}}var hs=Error(s(460)),sf=Error(s(474)),Qo=Error(s(542)),Zo={then:function(){}};function Km(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Xm(e,n,a){switch(a=e[a],a===void 0?e.push(n):a!==n&&(n.then(ir,ir),n=a),n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,Qm(e),e;default:if(typeof n.status=="string")n.then(ir,ir);else{if(e=Ze,e!==null&&100<e.shellSuspendCounter)throw Error(s(482));e=n,e.status="pending",e.then(function(o){if(n.status==="pending"){var u=n;u.status="fulfilled",u.value=o}},function(o){if(n.status==="pending"){var u=n;u.status="rejected",u.reason=o}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,Qm(e),e}throw Ci=n,hs}}function ki(e){try{var n=e._init;return n(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(Ci=a,hs):a}}var Ci=null;function Jm(){if(Ci===null)throw Error(s(459));var e=Ci;return Ci=null,e}function Qm(e){if(e===hs||e===Qo)throw Error(s(483))}var ds=null,ga=0;function Wo(e){var n=ga;return ga+=1,ds===null&&(ds=[]),Xm(ds,e,n)}function ya(e,n){n=n.props.ref,e.ref=n!==void 0?n:null}function el(e,n){throw n.$$typeof===v?Error(s(525)):(e=Object.prototype.toString.call(n),Error(s(31,e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e)))}function Zm(e){function n(P,q){if(e){var $=P.deletions;$===null?(P.deletions=[q],P.flags|=16):$.push(q)}}function a(P,q){if(!e)return null;for(;q!==null;)n(P,q),q=q.sibling;return null}function o(P){for(var q=new Map;P!==null;)P.key!==null?q.set(P.key,P):q.set(P.index,P),P=P.sibling;return q}function u(P,q){return P=ar(P,q),P.index=0,P.sibling=null,P}function h(P,q,$){return P.index=$,e?($=P.alternate,$!==null?($=$.index,$<q?(P.flags|=67108866,q):$):(P.flags|=67108866,q)):(P.flags|=1048576,q)}function x(P){return e&&P.alternate===null&&(P.flags|=67108866),P}function E(P,q,$,Z){return q===null||q.tag!==6?(q=Vu($,P.mode,Z),q.return=P,q):(q=u(q,$),q.return=P,q)}function R(P,q,$,Z){var xe=$.type;return xe===S?J(P,q,$.props.children,Z,$.key):q!==null&&(q.elementType===xe||typeof xe=="object"&&xe!==null&&xe.$$typeof===X&&ki(xe)===q.type)?(q=u(q,$.props),ya(q,$),q.return=P,q):(q=Vo($.type,$.key,$.props,null,P.mode,Z),ya(q,$),q.return=P,q)}function H(P,q,$,Z){return q===null||q.tag!==4||q.stateNode.containerInfo!==$.containerInfo||q.stateNode.implementation!==$.implementation?(q=Yu($,P.mode,Z),q.return=P,q):(q=u(q,$.children||[]),q.return=P,q)}function J(P,q,$,Z,xe){return q===null||q.tag!==7?(q=Oi($,P.mode,Z,xe),q.return=P,q):(q=u(q,$),q.return=P,q)}function ne(P,q,$){if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return q=Vu(""+q,P.mode,$),q.return=P,q;if(typeof q=="object"&&q!==null){switch(q.$$typeof){case _:return $=Vo(q.type,q.key,q.props,null,P.mode,$),ya($,q),$.return=P,$;case w:return q=Yu(q,P.mode,$),q.return=P,q;case X:return q=ki(q),ne(P,q,$)}if(Te(q)||Q(q))return q=Oi(q,P.mode,$,null),q.return=P,q;if(typeof q.then=="function")return ne(P,Wo(q),$);if(q.$$typeof===ie)return ne(P,Xo(P,q),$);el(P,q)}return null}function F(P,q,$,Z){var xe=q!==null?q.key:null;if(typeof $=="string"&&$!==""||typeof $=="number"||typeof $=="bigint")return xe!==null?null:E(P,q,""+$,Z);if(typeof $=="object"&&$!==null){switch($.$$typeof){case _:return $.key===xe?R(P,q,$,Z):null;case w:return $.key===xe?H(P,q,$,Z):null;case X:return $=ki($),F(P,q,$,Z)}if(Te($)||Q($))return xe!==null?null:J(P,q,$,Z,null);if(typeof $.then=="function")return F(P,q,Wo($),Z);if($.$$typeof===ie)return F(P,q,Xo(P,$),Z);el(P,$)}return null}function K(P,q,$,Z,xe){if(typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint")return P=P.get($)||null,E(q,P,""+Z,xe);if(typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case _:return P=P.get(Z.key===null?$:Z.key)||null,R(q,P,Z,xe);case w:return P=P.get(Z.key===null?$:Z.key)||null,H(q,P,Z,xe);case X:return Z=ki(Z),K(P,q,$,Z,xe)}if(Te(Z)||Q(Z))return P=P.get($)||null,J(q,P,Z,xe,null);if(typeof Z.then=="function")return K(P,q,$,Wo(Z),xe);if(Z.$$typeof===ie)return K(P,q,$,Xo(q,Z),xe);el(q,Z)}return null}function ge(P,q,$,Z){for(var xe=null,$e=null,ye=q,Me=q=0,Le=null;ye!==null&&Me<$.length;Me++){ye.index>Me?(Le=ye,ye=null):Le=ye.sibling;var He=F(P,ye,$[Me],Z);if(He===null){ye===null&&(ye=Le);break}e&&ye&&He.alternate===null&&n(P,ye),q=h(He,q,Me),$e===null?xe=He:$e.sibling=He,$e=He,ye=Le}if(Me===$.length)return a(P,ye),ze&&or(P,Me),xe;if(ye===null){for(;Me<$.length;Me++)ye=ne(P,$[Me],Z),ye!==null&&(q=h(ye,q,Me),$e===null?xe=ye:$e.sibling=ye,$e=ye);return ze&&or(P,Me),xe}for(ye=o(ye);Me<$.length;Me++)Le=K(ye,P,Me,$[Me],Z),Le!==null&&(e&&Le.alternate!==null&&ye.delete(Le.key===null?Me:Le.key),q=h(Le,q,Me),$e===null?xe=Le:$e.sibling=Le,$e=Le);return e&&ye.forEach(function(ti){return n(P,ti)}),ze&&or(P,Me),xe}function Ee(P,q,$,Z){if($==null)throw Error(s(151));for(var xe=null,$e=null,ye=q,Me=q=0,Le=null,He=$.next();ye!==null&&!He.done;Me++,He=$.next()){ye.index>Me?(Le=ye,ye=null):Le=ye.sibling;var ti=F(P,ye,He.value,Z);if(ti===null){ye===null&&(ye=Le);break}e&&ye&&ti.alternate===null&&n(P,ye),q=h(ti,q,Me),$e===null?xe=ti:$e.sibling=ti,$e=ti,ye=Le}if(He.done)return a(P,ye),ze&&or(P,Me),xe;if(ye===null){for(;!He.done;Me++,He=$.next())He=ne(P,He.value,Z),He!==null&&(q=h(He,q,Me),$e===null?xe=He:$e.sibling=He,$e=He);return ze&&or(P,Me),xe}for(ye=o(ye);!He.done;Me++,He=$.next())He=K(ye,P,Me,He.value,Z),He!==null&&(e&&He.alternate!==null&&ye.delete(He.key===null?Me:He.key),q=h(He,q,Me),$e===null?xe=He:$e.sibling=He,$e=He);return e&&ye.forEach(function(Z_){return n(P,Z_)}),ze&&or(P,Me),xe}function Je(P,q,$,Z){if(typeof $=="object"&&$!==null&&$.type===S&&$.key===null&&($=$.props.children),typeof $=="object"&&$!==null){switch($.$$typeof){case _:e:{for(var xe=$.key;q!==null;){if(q.key===xe){if(xe=$.type,xe===S){if(q.tag===7){a(P,q.sibling),Z=u(q,$.props.children),Z.return=P,P=Z;break e}}else if(q.elementType===xe||typeof xe=="object"&&xe!==null&&xe.$$typeof===X&&ki(xe)===q.type){a(P,q.sibling),Z=u(q,$.props),ya(Z,$),Z.return=P,P=Z;break e}a(P,q);break}else n(P,q);q=q.sibling}$.type===S?(Z=Oi($.props.children,P.mode,Z,$.key),Z.return=P,P=Z):(Z=Vo($.type,$.key,$.props,null,P.mode,Z),ya(Z,$),Z.return=P,P=Z)}return x(P);case w:e:{for(xe=$.key;q!==null;){if(q.key===xe)if(q.tag===4&&q.stateNode.containerInfo===$.containerInfo&&q.stateNode.implementation===$.implementation){a(P,q.sibling),Z=u(q,$.children||[]),Z.return=P,P=Z;break e}else{a(P,q);break}else n(P,q);q=q.sibling}Z=Yu($,P.mode,Z),Z.return=P,P=Z}return x(P);case X:return $=ki($),Je(P,q,$,Z)}if(Te($))return ge(P,q,$,Z);if(Q($)){if(xe=Q($),typeof xe!="function")throw Error(s(150));return $=xe.call($),Ee(P,q,$,Z)}if(typeof $.then=="function")return Je(P,q,Wo($),Z);if($.$$typeof===ie)return Je(P,q,Xo(P,$),Z);el(P,$)}return typeof $=="string"&&$!==""||typeof $=="number"||typeof $=="bigint"?($=""+$,q!==null&&q.tag===6?(a(P,q.sibling),Z=u(q,$),Z.return=P,P=Z):(a(P,q),Z=Vu($,P.mode,Z),Z.return=P,P=Z),x(P)):a(P,q)}return function(P,q,$,Z){try{ga=0;var xe=Je(P,q,$,Z);return ds=null,xe}catch(ye){if(ye===hs||ye===Qo)throw ye;var $e=en(29,ye,null,P.mode);return $e.lanes=Z,$e.return=P,$e}finally{}}}var Mi=Zm(!0),Wm=Zm(!1),zr=!1;function af(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function of(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ur(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Pr(e,n,a){var o=e.updateQueue;if(o===null)return null;if(o=o.shared,(Ge&2)!==0){var u=o.pending;return u===null?n.next=n:(n.next=u.next,u.next=n),o.pending=n,n=Fo(e),Bm(e,null,a),n}return Go(e,o,n,a),Fo(e)}function ba(e,n,a){if(n=n.updateQueue,n!==null&&(n=n.shared,(a&4194048)!==0)){var o=n.lanes;o&=e.pendingLanes,a|=o,n.lanes=a,bi(e,a)}}function lf(e,n){var a=e.updateQueue,o=e.alternate;if(o!==null&&(o=o.updateQueue,a===o)){var u=null,h=null;if(a=a.firstBaseUpdate,a!==null){do{var x={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};h===null?u=h=x:h=h.next=x,a=a.next}while(a!==null);h===null?u=h=n:h=h.next=n}else u=h=n;a={baseState:o.baseState,firstBaseUpdate:u,lastBaseUpdate:h,shared:o.shared,callbacks:o.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=n:e.next=n,a.lastBaseUpdate=n}var cf=!1;function va(){if(cf){var e=fs;if(e!==null)throw e}}function xa(e,n,a,o){cf=!1;var u=e.updateQueue;zr=!1;var h=u.firstBaseUpdate,x=u.lastBaseUpdate,E=u.shared.pending;if(E!==null){u.shared.pending=null;var R=E,H=R.next;R.next=null,x===null?h=H:x.next=H,x=R;var J=e.alternate;J!==null&&(J=J.updateQueue,E=J.lastBaseUpdate,E!==x&&(E===null?J.firstBaseUpdate=H:E.next=H,J.lastBaseUpdate=R))}if(h!==null){var ne=u.baseState;x=0,J=H=R=null,E=h;do{var F=E.lane&-536870913,K=F!==E.lane;if(K?(Be&F)===F:(o&F)===F){F!==0&&F===us&&(cf=!0),J!==null&&(J=J.next={lane:0,tag:E.tag,payload:E.payload,callback:null,next:null});e:{var ge=e,Ee=E;F=n;var Je=a;switch(Ee.tag){case 1:if(ge=Ee.payload,typeof ge=="function"){ne=ge.call(Je,ne,F);break e}ne=ge;break e;case 3:ge.flags=ge.flags&-65537|128;case 0:if(ge=Ee.payload,F=typeof ge=="function"?ge.call(Je,ne,F):ge,F==null)break e;ne=b({},ne,F);break e;case 2:zr=!0}}F=E.callback,F!==null&&(e.flags|=64,K&&(e.flags|=8192),K=u.callbacks,K===null?u.callbacks=[F]:K.push(F))}else K={lane:F,tag:E.tag,payload:E.payload,callback:E.callback,next:null},J===null?(H=J=K,R=ne):J=J.next=K,x|=F;if(E=E.next,E===null){if(E=u.shared.pending,E===null)break;K=E,E=K.next,K.next=null,u.lastBaseUpdate=K,u.shared.pending=null}}while(!0);J===null&&(R=ne),u.baseState=R,u.firstBaseUpdate=H,u.lastBaseUpdate=J,h===null&&(u.shared.lanes=0),Fr|=x,e.lanes=x,e.memoizedState=ne}}function e0(e,n){if(typeof e!="function")throw Error(s(191,e));e.call(n)}function t0(e,n){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)e0(a[e],n)}var ms=je(null),tl=je(0);function n0(e,n){e=br,Ne(tl,e),Ne(ms,n),br=e|n.baseLanes}function uf(){Ne(tl,br),Ne(ms,ms.current)}function ff(){br=tl.current,Se(ms),Se(tl)}var tn=je(null),An=null;function Ir(e){var n=e.alternate;Ne(mt,mt.current&1),Ne(tn,e),An===null&&(n===null||ms.current!==null||n.memoizedState!==null)&&(An=e)}function hf(e){Ne(mt,mt.current),Ne(tn,e),An===null&&(An=e)}function r0(e){e.tag===22?(Ne(mt,mt.current),Ne(tn,e),An===null&&(An=e)):$r()}function $r(){Ne(mt,mt.current),Ne(tn,tn.current)}function nn(e){Se(tn),An===e&&(An=null),Se(mt)}var mt=je(0);function nl(e){for(var n=e;n!==null;){if(n.tag===13){var a=n.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||bh(a)||vh(a)))return n}else if(n.tag===19&&(n.memoizedProps.revealOrder==="forwards"||n.memoizedProps.revealOrder==="backwards"||n.memoizedProps.revealOrder==="unstable_legacy-backwards"||n.memoizedProps.revealOrder==="together")){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var ur=0,Ce=null,Ke=null,bt=null,rl=!1,ps=!1,Ri=!1,il=0,_a=0,gs=null,$x=0;function lt(){throw Error(s(321))}function df(e,n){if(n===null)return!1;for(var a=0;a<n.length&&a<e.length;a++)if(!Wt(e[a],n[a]))return!1;return!0}function mf(e,n,a,o,u,h){return ur=h,Ce=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,Y.H=e===null||e.memoizedState===null?P0:Nf,Ri=!1,h=a(o,u),Ri=!1,ps&&(h=s0(n,a,o,u)),i0(e),h}function i0(e){Y.H=Ea;var n=Ke!==null&&Ke.next!==null;if(ur=0,bt=Ke=Ce=null,rl=!1,_a=0,gs=null,n)throw Error(s(300));e===null||vt||(e=e.dependencies,e!==null&&Ko(e)&&(vt=!0))}function s0(e,n,a,o){Ce=e;var u=0;do{if(ps&&(gs=null),_a=0,ps=!1,25<=u)throw Error(s(301));if(u+=1,bt=Ke=null,e.updateQueue!=null){var h=e.updateQueue;h.lastEffect=null,h.events=null,h.stores=null,h.memoCache!=null&&(h.memoCache.index=0)}Y.H=I0,h=n(a,o)}while(ps);return h}function Hx(){var e=Y.H,n=e.useState()[0];return n=typeof n.then=="function"?wa(n):n,e=e.useState()[0],(Ke!==null?Ke.memoizedState:null)!==e&&(Ce.flags|=1024),n}function pf(){var e=il!==0;return il=0,e}function gf(e,n,a){n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~a}function yf(e){if(rl){for(e=e.memoizedState;e!==null;){var n=e.queue;n!==null&&(n.pending=null),e=e.next}rl=!1}ur=0,bt=Ke=Ce=null,ps=!1,_a=il=0,gs=null}function zt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return bt===null?Ce.memoizedState=bt=e:bt=bt.next=e,bt}function pt(){if(Ke===null){var e=Ce.alternate;e=e!==null?e.memoizedState:null}else e=Ke.next;var n=bt===null?Ce.memoizedState:bt.next;if(n!==null)bt=n,Ke=e;else{if(e===null)throw Ce.alternate===null?Error(s(467)):Error(s(310));Ke=e,e={memoizedState:Ke.memoizedState,baseState:Ke.baseState,baseQueue:Ke.baseQueue,queue:Ke.queue,next:null},bt===null?Ce.memoizedState=bt=e:bt=bt.next=e}return bt}function sl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function wa(e){var n=_a;return _a+=1,gs===null&&(gs=[]),e=Xm(gs,e,n),n=Ce,(bt===null?n.memoizedState:bt.next)===null&&(n=n.alternate,Y.H=n===null||n.memoizedState===null?P0:Nf),e}function al(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return wa(e);if(e.$$typeof===ie)return kt(e)}throw Error(s(438,String(e)))}function bf(e){var n=null,a=Ce.updateQueue;if(a!==null&&(n=a.memoCache),n==null){var o=Ce.alternate;o!==null&&(o=o.updateQueue,o!==null&&(o=o.memoCache,o!=null&&(n={data:o.data.map(function(u){return u.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),a===null&&(a=sl(),Ce.updateQueue=a),a.memoCache=n,a=n.data[n.index],a===void 0)for(a=n.data[n.index]=Array(e),o=0;o<e;o++)a[o]=G;return n.index++,a}function fr(e,n){return typeof n=="function"?n(e):n}function ol(e){var n=pt();return vf(n,Ke,e)}function vf(e,n,a){var o=e.queue;if(o===null)throw Error(s(311));o.lastRenderedReducer=a;var u=e.baseQueue,h=o.pending;if(h!==null){if(u!==null){var x=u.next;u.next=h.next,h.next=x}n.baseQueue=u=h,o.pending=null}if(h=e.baseState,u===null)e.memoizedState=h;else{n=u.next;var E=x=null,R=null,H=n,J=!1;do{var ne=H.lane&-536870913;if(ne!==H.lane?(Be&ne)===ne:(ur&ne)===ne){var F=H.revertLane;if(F===0)R!==null&&(R=R.next={lane:0,revertLane:0,gesture:null,action:H.action,hasEagerState:H.hasEagerState,eagerState:H.eagerState,next:null}),ne===us&&(J=!0);else if((ur&F)===F){H=H.next,F===us&&(J=!0);continue}else ne={lane:0,revertLane:H.revertLane,gesture:null,action:H.action,hasEagerState:H.hasEagerState,eagerState:H.eagerState,next:null},R===null?(E=R=ne,x=h):R=R.next=ne,Ce.lanes|=F,Fr|=F;ne=H.action,Ri&&a(h,ne),h=H.hasEagerState?H.eagerState:a(h,ne)}else F={lane:ne,revertLane:H.revertLane,gesture:H.gesture,action:H.action,hasEagerState:H.hasEagerState,eagerState:H.eagerState,next:null},R===null?(E=R=F,x=h):R=R.next=F,Ce.lanes|=ne,Fr|=ne;H=H.next}while(H!==null&&H!==n);if(R===null?x=h:R.next=E,!Wt(h,e.memoizedState)&&(vt=!0,J&&(a=fs,a!==null)))throw a;e.memoizedState=h,e.baseState=x,e.baseQueue=R,o.lastRenderedState=h}return u===null&&(o.lanes=0),[e.memoizedState,o.dispatch]}function xf(e){var n=pt(),a=n.queue;if(a===null)throw Error(s(311));a.lastRenderedReducer=e;var o=a.dispatch,u=a.pending,h=n.memoizedState;if(u!==null){a.pending=null;var x=u=u.next;do h=e(h,x.action),x=x.next;while(x!==u);Wt(h,n.memoizedState)||(vt=!0),n.memoizedState=h,n.baseQueue===null&&(n.baseState=h),a.lastRenderedState=h}return[h,o]}function a0(e,n,a){var o=Ce,u=pt(),h=ze;if(h){if(a===void 0)throw Error(s(407));a=a()}else a=n();var x=!Wt((Ke||u).memoizedState,a);if(x&&(u.memoizedState=a,vt=!0),u=u.queue,Sf(c0.bind(null,o,u,e),[e]),u.getSnapshot!==n||x||bt!==null&&bt.memoizedState.tag&1){if(o.flags|=2048,ys(9,{destroy:void 0},l0.bind(null,o,u,a,n),null),Ze===null)throw Error(s(349));h||(ur&127)!==0||o0(o,n,a)}return a}function o0(e,n,a){e.flags|=16384,e={getSnapshot:n,value:a},n=Ce.updateQueue,n===null?(n=sl(),Ce.updateQueue=n,n.stores=[e]):(a=n.stores,a===null?n.stores=[e]:a.push(e))}function l0(e,n,a,o){n.value=a,n.getSnapshot=o,u0(n)&&f0(e)}function c0(e,n,a){return a(function(){u0(n)&&f0(e)})}function u0(e){var n=e.getSnapshot;e=e.value;try{var a=n();return!Wt(e,a)}catch{return!0}}function f0(e){var n=Ei(e,2);n!==null&&Jt(n,e,2)}function _f(e){var n=zt();if(typeof e=="function"){var a=e;if(e=a(),Ri){Qt(!0);try{a()}finally{Qt(!1)}}}return n.memoizedState=n.baseState=e,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:fr,lastRenderedState:e},n}function h0(e,n,a,o){return e.baseState=a,vf(e,Ke,typeof o=="function"?o:fr)}function Gx(e,n,a,o,u){if(ul(e))throw Error(s(485));if(e=n.action,e!==null){var h={payload:u,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(x){h.listeners.push(x)}};Y.T!==null?a(!0):h.isTransition=!1,o(h),a=n.pending,a===null?(h.next=n.pending=h,d0(n,h)):(h.next=a.next,n.pending=a.next=h)}}function d0(e,n){var a=n.action,o=n.payload,u=e.state;if(n.isTransition){var h=Y.T,x={};Y.T=x;try{var E=a(u,o),R=Y.S;R!==null&&R(x,E),m0(e,n,E)}catch(H){wf(e,n,H)}finally{h!==null&&x.types!==null&&(h.types=x.types),Y.T=h}}else try{h=a(u,o),m0(e,n,h)}catch(H){wf(e,n,H)}}function m0(e,n,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(o){p0(e,n,o)},function(o){return wf(e,n,o)}):p0(e,n,a)}function p0(e,n,a){n.status="fulfilled",n.value=a,g0(n),e.state=a,n=e.pending,n!==null&&(a=n.next,a===n?e.pending=null:(a=a.next,n.next=a,d0(e,a)))}function wf(e,n,a){var o=e.pending;if(e.pending=null,o!==null){o=o.next;do n.status="rejected",n.reason=a,g0(n),n=n.next;while(n!==o)}e.action=null}function g0(e){e=e.listeners;for(var n=0;n<e.length;n++)(0,e[n])()}function y0(e,n){return n}function b0(e,n){if(ze){var a=Ze.formState;if(a!==null){e:{var o=Ce;if(ze){if(et){t:{for(var u=et,h=On;u.nodeType!==8;){if(!h){u=null;break t}if(u=jn(u.nextSibling),u===null){u=null;break t}}h=u.data,u=h==="F!"||h==="F"?u:null}if(u){et=jn(u.nextSibling),o=u.data==="F!";break e}}Br(o)}o=!1}o&&(n=a[0])}}return a=zt(),a.memoizedState=a.baseState=n,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:y0,lastRenderedState:n},a.queue=o,a=L0.bind(null,Ce,o),o.dispatch=a,o=_f(!1),h=Tf.bind(null,Ce,!1,o.queue),o=zt(),u={state:n,dispatch:null,action:e,pending:null},o.queue=u,a=Gx.bind(null,Ce,u,h,a),u.dispatch=a,o.memoizedState=e,[n,a,!1]}function v0(e){var n=pt();return x0(n,Ke,e)}function x0(e,n,a){if(n=vf(e,n,y0)[0],e=ol(fr)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var o=wa(n)}catch(x){throw x===hs?Qo:x}else o=n;n=pt();var u=n.queue,h=u.dispatch;return a!==n.memoizedState&&(Ce.flags|=2048,ys(9,{destroy:void 0},Fx.bind(null,u,a),null)),[o,h,e]}function Fx(e,n){e.action=n}function _0(e){var n=pt(),a=Ke;if(a!==null)return x0(n,a,e);pt(),n=n.memoizedState,a=pt();var o=a.queue.dispatch;return a.memoizedState=e,[n,o,!1]}function ys(e,n,a,o){return e={tag:e,create:a,deps:o,inst:n,next:null},n=Ce.updateQueue,n===null&&(n=sl(),Ce.updateQueue=n),a=n.lastEffect,a===null?n.lastEffect=e.next=e:(o=a.next,a.next=e,e.next=o,n.lastEffect=e),e}function w0(){return pt().memoizedState}function ll(e,n,a,o){var u=zt();Ce.flags|=e,u.memoizedState=ys(1|n,{destroy:void 0},a,o===void 0?null:o)}function cl(e,n,a,o){var u=pt();o=o===void 0?null:o;var h=u.memoizedState.inst;Ke!==null&&o!==null&&df(o,Ke.memoizedState.deps)?u.memoizedState=ys(n,h,a,o):(Ce.flags|=e,u.memoizedState=ys(1|n,h,a,o))}function S0(e,n){ll(8390656,8,e,n)}function Sf(e,n){cl(2048,8,e,n)}function Vx(e){Ce.flags|=4;var n=Ce.updateQueue;if(n===null)n=sl(),Ce.updateQueue=n,n.events=[e];else{var a=n.events;a===null?n.events=[e]:a.push(e)}}function E0(e){var n=pt().memoizedState;return Vx({ref:n,nextImpl:e}),function(){if((Ge&2)!==0)throw Error(s(440));return n.impl.apply(void 0,arguments)}}function O0(e,n){return cl(4,2,e,n)}function A0(e,n){return cl(4,4,e,n)}function j0(e,n){if(typeof n=="function"){e=e();var a=n(e);return function(){typeof a=="function"?a():n(null)}}if(n!=null)return e=e(),n.current=e,function(){n.current=null}}function T0(e,n,a){a=a!=null?a.concat([e]):null,cl(4,4,j0.bind(null,n,e),a)}function Ef(){}function N0(e,n){var a=pt();n=n===void 0?null:n;var o=a.memoizedState;return n!==null&&df(n,o[1])?o[0]:(a.memoizedState=[e,n],e)}function k0(e,n){var a=pt();n=n===void 0?null:n;var o=a.memoizedState;if(n!==null&&df(n,o[1]))return o[0];if(o=e(),Ri){Qt(!0);try{e()}finally{Qt(!1)}}return a.memoizedState=[o,n],o}function Of(e,n,a){return a===void 0||(ur&1073741824)!==0&&(Be&261930)===0?e.memoizedState=n:(e.memoizedState=a,e=Cp(),Ce.lanes|=e,Fr|=e,a)}function C0(e,n,a,o){return Wt(a,n)?a:ms.current!==null?(e=Of(e,a,o),Wt(e,n)||(vt=!0),e):(ur&42)===0||(ur&1073741824)!==0&&(Be&261930)===0?(vt=!0,e.memoizedState=a):(e=Cp(),Ce.lanes|=e,Fr|=e,n)}function M0(e,n,a,o,u){var h=ae.p;ae.p=h!==0&&8>h?h:8;var x=Y.T,E={};Y.T=E,Tf(e,!1,n,a);try{var R=u(),H=Y.S;if(H!==null&&H(E,R),R!==null&&typeof R=="object"&&typeof R.then=="function"){var J=Ix(R,o);Sa(e,n,J,an(e))}else Sa(e,n,o,an(e))}catch(ne){Sa(e,n,{then:function(){},status:"rejected",reason:ne},an())}finally{ae.p=h,x!==null&&E.types!==null&&(x.types=E.types),Y.T=x}}function Yx(){}function Af(e,n,a,o){if(e.tag!==5)throw Error(s(476));var u=R0(e).queue;M0(e,u,n,de,a===null?Yx:function(){return D0(e),a(o)})}function R0(e){var n=e.memoizedState;if(n!==null)return n;n={memoizedState:de,baseState:de,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:fr,lastRenderedState:de},next:null};var a={};return n.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:fr,lastRenderedState:a},next:null},e.memoizedState=n,e=e.alternate,e!==null&&(e.memoizedState=n),n}function D0(e){var n=R0(e);n.next===null&&(n=e.alternate.memoizedState),Sa(e,n.next.queue,{},an())}function jf(){return kt(Pa)}function q0(){return pt().memoizedState}function B0(){return pt().memoizedState}function Kx(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var a=an();e=Ur(a);var o=Pr(n,e,a);o!==null&&(Jt(o,n,a),ba(o,n,a)),n={cache:tf()},e.payload=n;return}n=n.return}}function Xx(e,n,a){var o=an();a={lane:o,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},ul(e)?z0(n,a):(a=Gu(e,n,a,o),a!==null&&(Jt(a,e,o),U0(a,n,o)))}function L0(e,n,a){var o=an();Sa(e,n,a,o)}function Sa(e,n,a,o){var u={lane:o,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(ul(e))z0(n,u);else{var h=e.alternate;if(e.lanes===0&&(h===null||h.lanes===0)&&(h=n.lastRenderedReducer,h!==null))try{var x=n.lastRenderedState,E=h(x,a);if(u.hasEagerState=!0,u.eagerState=E,Wt(E,x))return Go(e,n,u,0),Ze===null&&Ho(),!1}catch{}finally{}if(a=Gu(e,n,u,o),a!==null)return Jt(a,e,o),U0(a,n,o),!0}return!1}function Tf(e,n,a,o){if(o={lane:2,revertLane:ah(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},ul(e)){if(n)throw Error(s(479))}else n=Gu(e,a,o,2),n!==null&&Jt(n,e,2)}function ul(e){var n=e.alternate;return e===Ce||n!==null&&n===Ce}function z0(e,n){ps=rl=!0;var a=e.pending;a===null?n.next=n:(n.next=a.next,a.next=n),e.pending=n}function U0(e,n,a){if((a&4194048)!==0){var o=n.lanes;o&=e.pendingLanes,a|=o,n.lanes=a,bi(e,a)}}var Ea={readContext:kt,use:al,useCallback:lt,useContext:lt,useEffect:lt,useImperativeHandle:lt,useLayoutEffect:lt,useInsertionEffect:lt,useMemo:lt,useReducer:lt,useRef:lt,useState:lt,useDebugValue:lt,useDeferredValue:lt,useTransition:lt,useSyncExternalStore:lt,useId:lt,useHostTransitionStatus:lt,useFormState:lt,useActionState:lt,useOptimistic:lt,useMemoCache:lt,useCacheRefresh:lt};Ea.useEffectEvent=lt;var P0={readContext:kt,use:al,useCallback:function(e,n){return zt().memoizedState=[e,n===void 0?null:n],e},useContext:kt,useEffect:S0,useImperativeHandle:function(e,n,a){a=a!=null?a.concat([e]):null,ll(4194308,4,j0.bind(null,n,e),a)},useLayoutEffect:function(e,n){return ll(4194308,4,e,n)},useInsertionEffect:function(e,n){ll(4,2,e,n)},useMemo:function(e,n){var a=zt();n=n===void 0?null:n;var o=e();if(Ri){Qt(!0);try{e()}finally{Qt(!1)}}return a.memoizedState=[o,n],o},useReducer:function(e,n,a){var o=zt();if(a!==void 0){var u=a(n);if(Ri){Qt(!0);try{a(n)}finally{Qt(!1)}}}else u=n;return o.memoizedState=o.baseState=u,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:u},o.queue=e,e=e.dispatch=Xx.bind(null,Ce,e),[o.memoizedState,e]},useRef:function(e){var n=zt();return e={current:e},n.memoizedState=e},useState:function(e){e=_f(e);var n=e.queue,a=L0.bind(null,Ce,n);return n.dispatch=a,[e.memoizedState,a]},useDebugValue:Ef,useDeferredValue:function(e,n){var a=zt();return Of(a,e,n)},useTransition:function(){var e=_f(!1);return e=M0.bind(null,Ce,e.queue,!0,!1),zt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,a){var o=Ce,u=zt();if(ze){if(a===void 0)throw Error(s(407));a=a()}else{if(a=n(),Ze===null)throw Error(s(349));(Be&127)!==0||o0(o,n,a)}u.memoizedState=a;var h={value:a,getSnapshot:n};return u.queue=h,S0(c0.bind(null,o,h,e),[e]),o.flags|=2048,ys(9,{destroy:void 0},l0.bind(null,o,h,a,n),null),a},useId:function(){var e=zt(),n=Ze.identifierPrefix;if(ze){var a=Vn,o=Fn;a=(o&~(1<<32-Bt(o)-1)).toString(32)+a,n="_"+n+"R_"+a,a=il++,0<a&&(n+="H"+a.toString(32)),n+="_"}else a=$x++,n="_"+n+"r_"+a.toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:jf,useFormState:b0,useActionState:b0,useOptimistic:function(e){var n=zt();n.memoizedState=n.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=a,n=Tf.bind(null,Ce,!0,a),a.dispatch=n,[e,n]},useMemoCache:bf,useCacheRefresh:function(){return zt().memoizedState=Kx.bind(null,Ce)},useEffectEvent:function(e){var n=zt(),a={impl:e};return n.memoizedState=a,function(){if((Ge&2)!==0)throw Error(s(440));return a.impl.apply(void 0,arguments)}}},Nf={readContext:kt,use:al,useCallback:N0,useContext:kt,useEffect:Sf,useImperativeHandle:T0,useInsertionEffect:O0,useLayoutEffect:A0,useMemo:k0,useReducer:ol,useRef:w0,useState:function(){return ol(fr)},useDebugValue:Ef,useDeferredValue:function(e,n){var a=pt();return C0(a,Ke.memoizedState,e,n)},useTransition:function(){var e=ol(fr)[0],n=pt().memoizedState;return[typeof e=="boolean"?e:wa(e),n]},useSyncExternalStore:a0,useId:q0,useHostTransitionStatus:jf,useFormState:v0,useActionState:v0,useOptimistic:function(e,n){var a=pt();return h0(a,Ke,e,n)},useMemoCache:bf,useCacheRefresh:B0};Nf.useEffectEvent=E0;var I0={readContext:kt,use:al,useCallback:N0,useContext:kt,useEffect:Sf,useImperativeHandle:T0,useInsertionEffect:O0,useLayoutEffect:A0,useMemo:k0,useReducer:xf,useRef:w0,useState:function(){return xf(fr)},useDebugValue:Ef,useDeferredValue:function(e,n){var a=pt();return Ke===null?Of(a,e,n):C0(a,Ke.memoizedState,e,n)},useTransition:function(){var e=xf(fr)[0],n=pt().memoizedState;return[typeof e=="boolean"?e:wa(e),n]},useSyncExternalStore:a0,useId:q0,useHostTransitionStatus:jf,useFormState:_0,useActionState:_0,useOptimistic:function(e,n){var a=pt();return Ke!==null?h0(a,Ke,e,n):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:bf,useCacheRefresh:B0};I0.useEffectEvent=E0;function kf(e,n,a,o){n=e.memoizedState,a=a(o,n),a=a==null?n:b({},n,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var Cf={enqueueSetState:function(e,n,a){e=e._reactInternals;var o=an(),u=Ur(o);u.payload=n,a!=null&&(u.callback=a),n=Pr(e,u,o),n!==null&&(Jt(n,e,o),ba(n,e,o))},enqueueReplaceState:function(e,n,a){e=e._reactInternals;var o=an(),u=Ur(o);u.tag=1,u.payload=n,a!=null&&(u.callback=a),n=Pr(e,u,o),n!==null&&(Jt(n,e,o),ba(n,e,o))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var a=an(),o=Ur(a);o.tag=2,n!=null&&(o.callback=n),n=Pr(e,o,a),n!==null&&(Jt(n,e,a),ba(n,e,a))}};function $0(e,n,a,o,u,h,x){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(o,h,x):n.prototype&&n.prototype.isPureReactComponent?!ua(a,o)||!ua(u,h):!0}function H0(e,n,a,o){e=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(a,o),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(a,o),n.state!==e&&Cf.enqueueReplaceState(n,n.state,null)}function Di(e,n){var a=n;if("ref"in n){a={};for(var o in n)o!=="ref"&&(a[o]=n[o])}if(e=e.defaultProps){a===n&&(a=b({},a));for(var u in e)a[u]===void 0&&(a[u]=e[u])}return a}function G0(e){$o(e)}function F0(e){console.error(e)}function V0(e){$o(e)}function fl(e,n){try{var a=e.onUncaughtError;a(n.value,{componentStack:n.stack})}catch(o){setTimeout(function(){throw o})}}function Y0(e,n,a){try{var o=e.onCaughtError;o(a.value,{componentStack:a.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(u){setTimeout(function(){throw u})}}function Mf(e,n,a){return a=Ur(a),a.tag=3,a.payload={element:null},a.callback=function(){fl(e,n)},a}function K0(e){return e=Ur(e),e.tag=3,e}function X0(e,n,a,o){var u=a.type.getDerivedStateFromError;if(typeof u=="function"){var h=o.value;e.payload=function(){return u(h)},e.callback=function(){Y0(n,a,o)}}var x=a.stateNode;x!==null&&typeof x.componentDidCatch=="function"&&(e.callback=function(){Y0(n,a,o),typeof u!="function"&&(Vr===null?Vr=new Set([this]):Vr.add(this));var E=o.stack;this.componentDidCatch(o.value,{componentStack:E!==null?E:""})})}function Jx(e,n,a,o,u){if(a.flags|=32768,o!==null&&typeof o=="object"&&typeof o.then=="function"){if(n=a.alternate,n!==null&&cs(n,a,u,!0),a=tn.current,a!==null){switch(a.tag){case 31:case 13:return An===null?Sl():a.alternate===null&&ct===0&&(ct=3),a.flags&=-257,a.flags|=65536,a.lanes=u,o===Zo?a.flags|=16384:(n=a.updateQueue,n===null?a.updateQueue=new Set([o]):n.add(o),rh(e,o,u)),!1;case 22:return a.flags|=65536,o===Zo?a.flags|=16384:(n=a.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([o])},a.updateQueue=n):(a=n.retryQueue,a===null?n.retryQueue=new Set([o]):a.add(o)),rh(e,o,u)),!1}throw Error(s(435,a.tag))}return rh(e,o,u),Sl(),!1}if(ze)return n=tn.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=u,o!==Ju&&(e=Error(s(422),{cause:o}),da(wn(e,a)))):(o!==Ju&&(n=Error(s(423),{cause:o}),da(wn(n,a))),e=e.current.alternate,e.flags|=65536,u&=-u,e.lanes|=u,o=wn(o,a),u=Mf(e.stateNode,o,u),lf(e,u),ct!==4&&(ct=2)),!1;var h=Error(s(520),{cause:o});if(h=wn(h,a),Ma===null?Ma=[h]:Ma.push(h),ct!==4&&(ct=2),n===null)return!0;o=wn(o,a),a=n;do{switch(a.tag){case 3:return a.flags|=65536,e=u&-u,a.lanes|=e,e=Mf(a.stateNode,o,e),lf(a,e),!1;case 1:if(n=a.type,h=a.stateNode,(a.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||h!==null&&typeof h.componentDidCatch=="function"&&(Vr===null||!Vr.has(h))))return a.flags|=65536,u&=-u,a.lanes|=u,u=K0(u),X0(u,e,a,o),lf(a,u),!1}a=a.return}while(a!==null);return!1}var Rf=Error(s(461)),vt=!1;function Ct(e,n,a,o){n.child=e===null?Wm(n,null,a,o):Mi(n,e.child,a,o)}function J0(e,n,a,o,u){a=a.render;var h=n.ref;if("ref"in o){var x={};for(var E in o)E!=="ref"&&(x[E]=o[E])}else x=o;return Ti(n),o=mf(e,n,a,x,h,u),E=pf(),e!==null&&!vt?(gf(e,n,u),hr(e,n,u)):(ze&&E&&Ku(n),n.flags|=1,Ct(e,n,o,u),n.child)}function Q0(e,n,a,o,u){if(e===null){var h=a.type;return typeof h=="function"&&!Fu(h)&&h.defaultProps===void 0&&a.compare===null?(n.tag=15,n.type=h,Z0(e,n,h,o,u)):(e=Vo(a.type,null,o,n,n.mode,u),e.ref=n.ref,e.return=n,n.child=e)}if(h=e.child,!If(e,u)){var x=h.memoizedProps;if(a=a.compare,a=a!==null?a:ua,a(x,o)&&e.ref===n.ref)return hr(e,n,u)}return n.flags|=1,e=ar(h,o),e.ref=n.ref,e.return=n,n.child=e}function Z0(e,n,a,o,u){if(e!==null){var h=e.memoizedProps;if(ua(h,o)&&e.ref===n.ref)if(vt=!1,n.pendingProps=o=h,If(e,u))(e.flags&131072)!==0&&(vt=!0);else return n.lanes=e.lanes,hr(e,n,u)}return Df(e,n,a,o,u)}function W0(e,n,a,o){var u=o.children,h=e!==null?e.memoizedState:null;if(e===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),o.mode==="hidden"){if((n.flags&128)!==0){if(h=h!==null?h.baseLanes|a:a,e!==null){for(o=n.child=e.child,u=0;o!==null;)u=u|o.lanes|o.childLanes,o=o.sibling;o=u&~h}else o=0,n.child=null;return ep(e,n,h,a,o)}if((a&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},e!==null&&Jo(n,h!==null?h.cachePool:null),h!==null?n0(n,h):uf(),r0(n);else return o=n.lanes=536870912,ep(e,n,h!==null?h.baseLanes|a:a,a,o)}else h!==null?(Jo(n,h.cachePool),n0(n,h),$r(),n.memoizedState=null):(e!==null&&Jo(n,null),uf(),$r());return Ct(e,n,u,a),n.child}function Oa(e,n){return e!==null&&e.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function ep(e,n,a,o,u){var h=rf();return h=h===null?null:{parent:yt._currentValue,pool:h},n.memoizedState={baseLanes:a,cachePool:h},e!==null&&Jo(n,null),uf(),r0(n),e!==null&&cs(e,n,o,!0),n.childLanes=u,null}function hl(e,n){return n=ml({mode:n.mode,children:n.children},e.mode),n.ref=e.ref,e.child=n,n.return=e,n}function tp(e,n,a){return Mi(n,e.child,null,a),e=hl(n,n.pendingProps),e.flags|=2,nn(n),n.memoizedState=null,e}function Qx(e,n,a){var o=n.pendingProps,u=(n.flags&128)!==0;if(n.flags&=-129,e===null){if(ze){if(o.mode==="hidden")return e=hl(n,o),n.lanes=536870912,Oa(null,e);if(hf(n),(e=et)?(e=dg(e,On),e=e!==null&&e.data==="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:Dr!==null?{id:Fn,overflow:Vn}:null,retryLane:536870912,hydrationErrors:null},a=zm(e),a.return=n,n.child=a,Nt=n,et=null)):e=null,e===null)throw Br(n);return n.lanes=536870912,null}return hl(n,o)}var h=e.memoizedState;if(h!==null){var x=h.dehydrated;if(hf(n),u)if(n.flags&256)n.flags&=-257,n=tp(e,n,a);else if(n.memoizedState!==null)n.child=e.child,n.flags|=128,n=null;else throw Error(s(558));else if(vt||cs(e,n,a,!1),u=(a&e.childLanes)!==0,vt||u){if(o=Ze,o!==null&&(x=Mr(o,a),x!==0&&x!==h.retryLane))throw h.retryLane=x,Ei(e,x),Jt(o,e,x),Rf;Sl(),n=tp(e,n,a)}else e=h.treeContext,et=jn(x.nextSibling),Nt=n,ze=!0,qr=null,On=!1,e!==null&&Im(n,e),n=hl(n,o),n.flags|=4096;return n}return e=ar(e.child,{mode:o.mode,children:o.children}),e.ref=n.ref,n.child=e,e.return=n,e}function dl(e,n){var a=n.ref;if(a===null)e!==null&&e.ref!==null&&(n.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(s(284));(e===null||e.ref!==a)&&(n.flags|=4194816)}}function Df(e,n,a,o,u){return Ti(n),a=mf(e,n,a,o,void 0,u),o=pf(),e!==null&&!vt?(gf(e,n,u),hr(e,n,u)):(ze&&o&&Ku(n),n.flags|=1,Ct(e,n,a,u),n.child)}function np(e,n,a,o,u,h){return Ti(n),n.updateQueue=null,a=s0(n,o,a,u),i0(e),o=pf(),e!==null&&!vt?(gf(e,n,h),hr(e,n,h)):(ze&&o&&Ku(n),n.flags|=1,Ct(e,n,a,h),n.child)}function rp(e,n,a,o,u){if(Ti(n),n.stateNode===null){var h=ss,x=a.contextType;typeof x=="object"&&x!==null&&(h=kt(x)),h=new a(o,h),n.memoizedState=h.state!==null&&h.state!==void 0?h.state:null,h.updater=Cf,n.stateNode=h,h._reactInternals=n,h=n.stateNode,h.props=o,h.state=n.memoizedState,h.refs={},af(n),x=a.contextType,h.context=typeof x=="object"&&x!==null?kt(x):ss,h.state=n.memoizedState,x=a.getDerivedStateFromProps,typeof x=="function"&&(kf(n,a,x,o),h.state=n.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof h.getSnapshotBeforeUpdate=="function"||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(x=h.state,typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount(),x!==h.state&&Cf.enqueueReplaceState(h,h.state,null),xa(n,o,h,u),va(),h.state=n.memoizedState),typeof h.componentDidMount=="function"&&(n.flags|=4194308),o=!0}else if(e===null){h=n.stateNode;var E=n.memoizedProps,R=Di(a,E);h.props=R;var H=h.context,J=a.contextType;x=ss,typeof J=="object"&&J!==null&&(x=kt(J));var ne=a.getDerivedStateFromProps;J=typeof ne=="function"||typeof h.getSnapshotBeforeUpdate=="function",E=n.pendingProps!==E,J||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(E||H!==x)&&H0(n,h,o,x),zr=!1;var F=n.memoizedState;h.state=F,xa(n,o,h,u),va(),H=n.memoizedState,E||F!==H||zr?(typeof ne=="function"&&(kf(n,a,ne,o),H=n.memoizedState),(R=zr||$0(n,a,R,o,F,H,x))?(J||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount()),typeof h.componentDidMount=="function"&&(n.flags|=4194308)):(typeof h.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=o,n.memoizedState=H),h.props=o,h.state=H,h.context=x,o=R):(typeof h.componentDidMount=="function"&&(n.flags|=4194308),o=!1)}else{h=n.stateNode,of(e,n),x=n.memoizedProps,J=Di(a,x),h.props=J,ne=n.pendingProps,F=h.context,H=a.contextType,R=ss,typeof H=="object"&&H!==null&&(R=kt(H)),E=a.getDerivedStateFromProps,(H=typeof E=="function"||typeof h.getSnapshotBeforeUpdate=="function")||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(x!==ne||F!==R)&&H0(n,h,o,R),zr=!1,F=n.memoizedState,h.state=F,xa(n,o,h,u),va();var K=n.memoizedState;x!==ne||F!==K||zr||e!==null&&e.dependencies!==null&&Ko(e.dependencies)?(typeof E=="function"&&(kf(n,a,E,o),K=n.memoizedState),(J=zr||$0(n,a,J,o,F,K,R)||e!==null&&e.dependencies!==null&&Ko(e.dependencies))?(H||typeof h.UNSAFE_componentWillUpdate!="function"&&typeof h.componentWillUpdate!="function"||(typeof h.componentWillUpdate=="function"&&h.componentWillUpdate(o,K,R),typeof h.UNSAFE_componentWillUpdate=="function"&&h.UNSAFE_componentWillUpdate(o,K,R)),typeof h.componentDidUpdate=="function"&&(n.flags|=4),typeof h.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof h.componentDidUpdate!="function"||x===e.memoizedProps&&F===e.memoizedState||(n.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||x===e.memoizedProps&&F===e.memoizedState||(n.flags|=1024),n.memoizedProps=o,n.memoizedState=K),h.props=o,h.state=K,h.context=R,o=J):(typeof h.componentDidUpdate!="function"||x===e.memoizedProps&&F===e.memoizedState||(n.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||x===e.memoizedProps&&F===e.memoizedState||(n.flags|=1024),o=!1)}return h=o,dl(e,n),o=(n.flags&128)!==0,h||o?(h=n.stateNode,a=o&&typeof a.getDerivedStateFromError!="function"?null:h.render(),n.flags|=1,e!==null&&o?(n.child=Mi(n,e.child,null,u),n.child=Mi(n,null,a,u)):Ct(e,n,a,u),n.memoizedState=h.state,e=n.child):e=hr(e,n,u),e}function ip(e,n,a,o){return Ai(),n.flags|=256,Ct(e,n,a,o),n.child}var qf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Bf(e){return{baseLanes:e,cachePool:Ym()}}function Lf(e,n,a){return e=e!==null?e.childLanes&~a:0,n&&(e|=sn),e}function sp(e,n,a){var o=n.pendingProps,u=!1,h=(n.flags&128)!==0,x;if((x=h)||(x=e!==null&&e.memoizedState===null?!1:(mt.current&2)!==0),x&&(u=!0,n.flags&=-129),x=(n.flags&32)!==0,n.flags&=-33,e===null){if(ze){if(u?Ir(n):$r(),(e=et)?(e=dg(e,On),e=e!==null&&e.data!=="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:Dr!==null?{id:Fn,overflow:Vn}:null,retryLane:536870912,hydrationErrors:null},a=zm(e),a.return=n,n.child=a,Nt=n,et=null)):e=null,e===null)throw Br(n);return vh(e)?n.lanes=32:n.lanes=536870912,null}var E=o.children;return o=o.fallback,u?($r(),u=n.mode,E=ml({mode:"hidden",children:E},u),o=Oi(o,u,a,null),E.return=n,o.return=n,E.sibling=o,n.child=E,o=n.child,o.memoizedState=Bf(a),o.childLanes=Lf(e,x,a),n.memoizedState=qf,Oa(null,o)):(Ir(n),zf(n,E))}var R=e.memoizedState;if(R!==null&&(E=R.dehydrated,E!==null)){if(h)n.flags&256?(Ir(n),n.flags&=-257,n=Uf(e,n,a)):n.memoizedState!==null?($r(),n.child=e.child,n.flags|=128,n=null):($r(),E=o.fallback,u=n.mode,o=ml({mode:"visible",children:o.children},u),E=Oi(E,u,a,null),E.flags|=2,o.return=n,E.return=n,o.sibling=E,n.child=o,Mi(n,e.child,null,a),o=n.child,o.memoizedState=Bf(a),o.childLanes=Lf(e,x,a),n.memoizedState=qf,n=Oa(null,o));else if(Ir(n),vh(E)){if(x=E.nextSibling&&E.nextSibling.dataset,x)var H=x.dgst;x=H,o=Error(s(419)),o.stack="",o.digest=x,da({value:o,source:null,stack:null}),n=Uf(e,n,a)}else if(vt||cs(e,n,a,!1),x=(a&e.childLanes)!==0,vt||x){if(x=Ze,x!==null&&(o=Mr(x,a),o!==0&&o!==R.retryLane))throw R.retryLane=o,Ei(e,o),Jt(x,e,o),Rf;bh(E)||Sl(),n=Uf(e,n,a)}else bh(E)?(n.flags|=192,n.child=e.child,n=null):(e=R.treeContext,et=jn(E.nextSibling),Nt=n,ze=!0,qr=null,On=!1,e!==null&&Im(n,e),n=zf(n,o.children),n.flags|=4096);return n}return u?($r(),E=o.fallback,u=n.mode,R=e.child,H=R.sibling,o=ar(R,{mode:"hidden",children:o.children}),o.subtreeFlags=R.subtreeFlags&65011712,H!==null?E=ar(H,E):(E=Oi(E,u,a,null),E.flags|=2),E.return=n,o.return=n,o.sibling=E,n.child=o,Oa(null,o),o=n.child,E=e.child.memoizedState,E===null?E=Bf(a):(u=E.cachePool,u!==null?(R=yt._currentValue,u=u.parent!==R?{parent:R,pool:R}:u):u=Ym(),E={baseLanes:E.baseLanes|a,cachePool:u}),o.memoizedState=E,o.childLanes=Lf(e,x,a),n.memoizedState=qf,Oa(e.child,o)):(Ir(n),a=e.child,e=a.sibling,a=ar(a,{mode:"visible",children:o.children}),a.return=n,a.sibling=null,e!==null&&(x=n.deletions,x===null?(n.deletions=[e],n.flags|=16):x.push(e)),n.child=a,n.memoizedState=null,a)}function zf(e,n){return n=ml({mode:"visible",children:n},e.mode),n.return=e,e.child=n}function ml(e,n){return e=en(22,e,null,n),e.lanes=0,e}function Uf(e,n,a){return Mi(n,e.child,null,a),e=zf(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function ap(e,n,a){e.lanes|=n;var o=e.alternate;o!==null&&(o.lanes|=n),Wu(e.return,n,a)}function Pf(e,n,a,o,u,h){var x=e.memoizedState;x===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:o,tail:a,tailMode:u,treeForkCount:h}:(x.isBackwards=n,x.rendering=null,x.renderingStartTime=0,x.last=o,x.tail=a,x.tailMode=u,x.treeForkCount=h)}function op(e,n,a){var o=n.pendingProps,u=o.revealOrder,h=o.tail;o=o.children;var x=mt.current,E=(x&2)!==0;if(E?(x=x&1|2,n.flags|=128):x&=1,Ne(mt,x),Ct(e,n,o,a),o=ze?ha:0,!E&&e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&ap(e,a,n);else if(e.tag===19)ap(e,a,n);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break e;for(;e.sibling===null;){if(e.return===null||e.return===n)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(u){case"forwards":for(a=n.child,u=null;a!==null;)e=a.alternate,e!==null&&nl(e)===null&&(u=a),a=a.sibling;a=u,a===null?(u=n.child,n.child=null):(u=a.sibling,a.sibling=null),Pf(n,!1,u,a,h,o);break;case"backwards":case"unstable_legacy-backwards":for(a=null,u=n.child,n.child=null;u!==null;){if(e=u.alternate,e!==null&&nl(e)===null){n.child=u;break}e=u.sibling,u.sibling=a,a=u,u=e}Pf(n,!0,a,null,h,o);break;case"together":Pf(n,!1,null,null,void 0,o);break;default:n.memoizedState=null}return n.child}function hr(e,n,a){if(e!==null&&(n.dependencies=e.dependencies),Fr|=n.lanes,(a&n.childLanes)===0)if(e!==null){if(cs(e,n,a,!1),(a&n.childLanes)===0)return null}else return null;if(e!==null&&n.child!==e.child)throw Error(s(153));if(n.child!==null){for(e=n.child,a=ar(e,e.pendingProps),n.child=a,a.return=n;e.sibling!==null;)e=e.sibling,a=a.sibling=ar(e,e.pendingProps),a.return=n;a.sibling=null}return n.child}function If(e,n){return(e.lanes&n)!==0?!0:(e=e.dependencies,!!(e!==null&&Ko(e)))}function Zx(e,n,a){switch(n.tag){case 3:Dt(n,n.stateNode.containerInfo),Lr(n,yt,e.memoizedState.cache),Ai();break;case 27:case 5:qt(n);break;case 4:Dt(n,n.stateNode.containerInfo);break;case 10:Lr(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,hf(n),null;break;case 13:var o=n.memoizedState;if(o!==null)return o.dehydrated!==null?(Ir(n),n.flags|=128,null):(a&n.child.childLanes)!==0?sp(e,n,a):(Ir(n),e=hr(e,n,a),e!==null?e.sibling:null);Ir(n);break;case 19:var u=(e.flags&128)!==0;if(o=(a&n.childLanes)!==0,o||(cs(e,n,a,!1),o=(a&n.childLanes)!==0),u){if(o)return op(e,n,a);n.flags|=128}if(u=n.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),Ne(mt,mt.current),o)break;return null;case 22:return n.lanes=0,W0(e,n,a,n.pendingProps);case 24:Lr(n,yt,e.memoizedState.cache)}return hr(e,n,a)}function lp(e,n,a){if(e!==null)if(e.memoizedProps!==n.pendingProps)vt=!0;else{if(!If(e,a)&&(n.flags&128)===0)return vt=!1,Zx(e,n,a);vt=(e.flags&131072)!==0}else vt=!1,ze&&(n.flags&1048576)!==0&&Pm(n,ha,n.index);switch(n.lanes=0,n.tag){case 16:e:{var o=n.pendingProps;if(e=ki(n.elementType),n.type=e,typeof e=="function")Fu(e)?(o=Di(e,o),n.tag=1,n=rp(null,n,e,o,a)):(n.tag=0,n=Df(null,n,e,o,a));else{if(e!=null){var u=e.$$typeof;if(u===ce){n.tag=11,n=J0(null,n,e,o,a);break e}else if(u===re){n.tag=14,n=Q0(null,n,e,o,a);break e}}throw n=_e(e)||e,Error(s(306,n,""))}}return n;case 0:return Df(e,n,n.type,n.pendingProps,a);case 1:return o=n.type,u=Di(o,n.pendingProps),rp(e,n,o,u,a);case 3:e:{if(Dt(n,n.stateNode.containerInfo),e===null)throw Error(s(387));o=n.pendingProps;var h=n.memoizedState;u=h.element,of(e,n),xa(n,o,null,a);var x=n.memoizedState;if(o=x.cache,Lr(n,yt,o),o!==h.cache&&ef(n,[yt],a,!0),va(),o=x.element,h.isDehydrated)if(h={element:o,isDehydrated:!1,cache:x.cache},n.updateQueue.baseState=h,n.memoizedState=h,n.flags&256){n=ip(e,n,o,a);break e}else if(o!==u){u=wn(Error(s(424)),n),da(u),n=ip(e,n,o,a);break e}else{switch(e=n.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(et=jn(e.firstChild),Nt=n,ze=!0,qr=null,On=!0,a=Wm(n,null,o,a),n.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(Ai(),o===u){n=hr(e,n,a);break e}Ct(e,n,o,a)}n=n.child}return n;case 26:return dl(e,n),e===null?(a=vg(n.type,null,n.pendingProps,null))?n.memoizedState=a:ze||(a=n.type,e=n.pendingProps,o=kl(Gt.current).createElement(a),o[Qe]=n,o[ot]=e,Mt(o,a,e),D(o),n.stateNode=o):n.memoizedState=vg(n.type,e.memoizedProps,n.pendingProps,e.memoizedState),null;case 27:return qt(n),e===null&&ze&&(o=n.stateNode=gg(n.type,n.pendingProps,Gt.current),Nt=n,On=!0,u=et,Jr(n.type)?(xh=u,et=jn(o.firstChild)):et=u),Ct(e,n,n.pendingProps.children,a),dl(e,n),e===null&&(n.flags|=4194304),n.child;case 5:return e===null&&ze&&((u=o=et)&&(o=T_(o,n.type,n.pendingProps,On),o!==null?(n.stateNode=o,Nt=n,et=jn(o.firstChild),On=!1,u=!0):u=!1),u||Br(n)),qt(n),u=n.type,h=n.pendingProps,x=e!==null?e.memoizedProps:null,o=h.children,ph(u,h)?o=null:x!==null&&ph(u,x)&&(n.flags|=32),n.memoizedState!==null&&(u=mf(e,n,Hx,null,null,a),Pa._currentValue=u),dl(e,n),Ct(e,n,o,a),n.child;case 6:return e===null&&ze&&((e=a=et)&&(a=N_(a,n.pendingProps,On),a!==null?(n.stateNode=a,Nt=n,et=null,e=!0):e=!1),e||Br(n)),null;case 13:return sp(e,n,a);case 4:return Dt(n,n.stateNode.containerInfo),o=n.pendingProps,e===null?n.child=Mi(n,null,o,a):Ct(e,n,o,a),n.child;case 11:return J0(e,n,n.type,n.pendingProps,a);case 7:return Ct(e,n,n.pendingProps,a),n.child;case 8:return Ct(e,n,n.pendingProps.children,a),n.child;case 12:return Ct(e,n,n.pendingProps.children,a),n.child;case 10:return o=n.pendingProps,Lr(n,n.type,o.value),Ct(e,n,o.children,a),n.child;case 9:return u=n.type._context,o=n.pendingProps.children,Ti(n),u=kt(u),o=o(u),n.flags|=1,Ct(e,n,o,a),n.child;case 14:return Q0(e,n,n.type,n.pendingProps,a);case 15:return Z0(e,n,n.type,n.pendingProps,a);case 19:return op(e,n,a);case 31:return Qx(e,n,a);case 22:return W0(e,n,a,n.pendingProps);case 24:return Ti(n),o=kt(yt),e===null?(u=rf(),u===null&&(u=Ze,h=tf(),u.pooledCache=h,h.refCount++,h!==null&&(u.pooledCacheLanes|=a),u=h),n.memoizedState={parent:o,cache:u},af(n),Lr(n,yt,u)):((e.lanes&a)!==0&&(of(e,n),xa(n,null,null,a),va()),u=e.memoizedState,h=n.memoizedState,u.parent!==o?(u={parent:o,cache:o},n.memoizedState=u,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=u),Lr(n,yt,o)):(o=h.cache,Lr(n,yt,o),o!==u.cache&&ef(n,[yt],a,!0))),Ct(e,n,n.pendingProps.children,a),n.child;case 29:throw n.pendingProps}throw Error(s(156,n.tag))}function dr(e){e.flags|=4}function $f(e,n,a,o,u){if((n=(e.mode&32)!==0)&&(n=!1),n){if(e.flags|=16777216,(u&335544128)===u)if(e.stateNode.complete)e.flags|=8192;else if(qp())e.flags|=8192;else throw Ci=Zo,sf}else e.flags&=-16777217}function cp(e,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Eg(n))if(qp())e.flags|=8192;else throw Ci=Zo,sf}function pl(e,n){n!==null&&(e.flags|=4),e.flags&16384&&(n=e.tag!==22?Xi():536870912,e.lanes|=n,_s|=n)}function Aa(e,n){if(!ze)switch(e.tailMode){case"hidden":n=e.tail;for(var a=null;n!==null;)n.alternate!==null&&(a=n),n=n.sibling;a===null?e.tail=null:a.sibling=null;break;case"collapsed":a=e.tail;for(var o=null;a!==null;)a.alternate!==null&&(o=a),a=a.sibling;o===null?n||e.tail===null?e.tail=null:e.tail.sibling=null:o.sibling=null}}function tt(e){var n=e.alternate!==null&&e.alternate.child===e.child,a=0,o=0;if(n)for(var u=e.child;u!==null;)a|=u.lanes|u.childLanes,o|=u.subtreeFlags&65011712,o|=u.flags&65011712,u.return=e,u=u.sibling;else for(u=e.child;u!==null;)a|=u.lanes|u.childLanes,o|=u.subtreeFlags,o|=u.flags,u.return=e,u=u.sibling;return e.subtreeFlags|=o,e.childLanes=a,n}function Wx(e,n,a){var o=n.pendingProps;switch(Xu(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return tt(n),null;case 1:return tt(n),null;case 3:return a=n.stateNode,o=null,e!==null&&(o=e.memoizedState.cache),n.memoizedState.cache!==o&&(n.flags|=2048),cr(yt),ke(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(ls(n)?dr(n):e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,Qu())),tt(n),null;case 26:var u=n.type,h=n.memoizedState;return e===null?(dr(n),h!==null?(tt(n),cp(n,h)):(tt(n),$f(n,u,null,o,a))):h?h!==e.memoizedState?(dr(n),tt(n),cp(n,h)):(tt(n),n.flags&=-16777217):(e=e.memoizedProps,e!==o&&dr(n),tt(n),$f(n,u,e,o,a)),null;case 27:if(di(n),a=Gt.current,u=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==o&&dr(n);else{if(!o){if(n.stateNode===null)throw Error(s(166));return tt(n),null}e=be.current,ls(n)?$m(n):(e=gg(u,o,a),n.stateNode=e,dr(n))}return tt(n),null;case 5:if(di(n),u=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==o&&dr(n);else{if(!o){if(n.stateNode===null)throw Error(s(166));return tt(n),null}if(h=be.current,ls(n))$m(n);else{var x=kl(Gt.current);switch(h){case 1:h=x.createElementNS("http://www.w3.org/2000/svg",u);break;case 2:h=x.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;default:switch(u){case"svg":h=x.createElementNS("http://www.w3.org/2000/svg",u);break;case"math":h=x.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;case"script":h=x.createElement("div"),h.innerHTML="<script><\/script>",h=h.removeChild(h.firstChild);break;case"select":h=typeof o.is=="string"?x.createElement("select",{is:o.is}):x.createElement("select"),o.multiple?h.multiple=!0:o.size&&(h.size=o.size);break;default:h=typeof o.is=="string"?x.createElement(u,{is:o.is}):x.createElement(u)}}h[Qe]=n,h[ot]=o;e:for(x=n.child;x!==null;){if(x.tag===5||x.tag===6)h.appendChild(x.stateNode);else if(x.tag!==4&&x.tag!==27&&x.child!==null){x.child.return=x,x=x.child;continue}if(x===n)break e;for(;x.sibling===null;){if(x.return===null||x.return===n)break e;x=x.return}x.sibling.return=x.return,x=x.sibling}n.stateNode=h;e:switch(Mt(h,u,o),u){case"button":case"input":case"select":case"textarea":o=!!o.autoFocus;break e;case"img":o=!0;break e;default:o=!1}o&&dr(n)}}return tt(n),$f(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,a),null;case 6:if(e&&n.stateNode!=null)e.memoizedProps!==o&&dr(n);else{if(typeof o!="string"&&n.stateNode===null)throw Error(s(166));if(e=Gt.current,ls(n)){if(e=n.stateNode,a=n.memoizedProps,o=null,u=Nt,u!==null)switch(u.tag){case 27:case 5:o=u.memoizedProps}e[Qe]=n,e=!!(e.nodeValue===a||o!==null&&o.suppressHydrationWarning===!0||sg(e.nodeValue,a)),e||Br(n,!0)}else e=kl(e).createTextNode(o),e[Qe]=n,n.stateNode=e}return tt(n),null;case 31:if(a=n.memoizedState,e===null||e.memoizedState!==null){if(o=ls(n),a!==null){if(e===null){if(!o)throw Error(s(318));if(e=n.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(s(557));e[Qe]=n}else Ai(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;tt(n),e=!1}else a=Qu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return n.flags&256?(nn(n),n):(nn(n),null);if((n.flags&128)!==0)throw Error(s(558))}return tt(n),null;case 13:if(o=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(u=ls(n),o!==null&&o.dehydrated!==null){if(e===null){if(!u)throw Error(s(318));if(u=n.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(s(317));u[Qe]=n}else Ai(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;tt(n),u=!1}else u=Qu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=u),u=!0;if(!u)return n.flags&256?(nn(n),n):(nn(n),null)}return nn(n),(n.flags&128)!==0?(n.lanes=a,n):(a=o!==null,e=e!==null&&e.memoizedState!==null,a&&(o=n.child,u=null,o.alternate!==null&&o.alternate.memoizedState!==null&&o.alternate.memoizedState.cachePool!==null&&(u=o.alternate.memoizedState.cachePool.pool),h=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(h=o.memoizedState.cachePool.pool),h!==u&&(o.flags|=2048)),a!==e&&a&&(n.child.flags|=8192),pl(n,n.updateQueue),tt(n),null);case 4:return ke(),e===null&&uh(n.stateNode.containerInfo),tt(n),null;case 10:return cr(n.type),tt(n),null;case 19:if(Se(mt),o=n.memoizedState,o===null)return tt(n),null;if(u=(n.flags&128)!==0,h=o.rendering,h===null)if(u)Aa(o,!1);else{if(ct!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(h=nl(e),h!==null){for(n.flags|=128,Aa(o,!1),e=h.updateQueue,n.updateQueue=e,pl(n,e),n.subtreeFlags=0,e=a,a=n.child;a!==null;)Lm(a,e),a=a.sibling;return Ne(mt,mt.current&1|2),ze&&or(n,o.treeForkCount),n.child}e=e.sibling}o.tail!==null&&nt()>xl&&(n.flags|=128,u=!0,Aa(o,!1),n.lanes=4194304)}else{if(!u)if(e=nl(h),e!==null){if(n.flags|=128,u=!0,e=e.updateQueue,n.updateQueue=e,pl(n,e),Aa(o,!0),o.tail===null&&o.tailMode==="hidden"&&!h.alternate&&!ze)return tt(n),null}else 2*nt()-o.renderingStartTime>xl&&a!==536870912&&(n.flags|=128,u=!0,Aa(o,!1),n.lanes=4194304);o.isBackwards?(h.sibling=n.child,n.child=h):(e=o.last,e!==null?e.sibling=h:n.child=h,o.last=h)}return o.tail!==null?(e=o.tail,o.rendering=e,o.tail=e.sibling,o.renderingStartTime=nt(),e.sibling=null,a=mt.current,Ne(mt,u?a&1|2:a&1),ze&&or(n,o.treeForkCount),e):(tt(n),null);case 22:case 23:return nn(n),ff(),o=n.memoizedState!==null,e!==null?e.memoizedState!==null!==o&&(n.flags|=8192):o&&(n.flags|=8192),o?(a&536870912)!==0&&(n.flags&128)===0&&(tt(n),n.subtreeFlags&6&&(n.flags|=8192)):tt(n),a=n.updateQueue,a!==null&&pl(n,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),o=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(o=n.memoizedState.cachePool.pool),o!==a&&(n.flags|=2048),e!==null&&Se(Ni),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),n.memoizedState.cache!==a&&(n.flags|=2048),cr(yt),tt(n),null;case 25:return null;case 30:return null}throw Error(s(156,n.tag))}function e_(e,n){switch(Xu(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return cr(yt),ke(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 26:case 27:case 5:return di(n),null;case 31:if(n.memoizedState!==null){if(nn(n),n.alternate===null)throw Error(s(340));Ai()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 13:if(nn(n),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(s(340));Ai()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return Se(mt),null;case 4:return ke(),null;case 10:return cr(n.type),null;case 22:case 23:return nn(n),ff(),e!==null&&Se(Ni),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return cr(yt),null;case 25:return null;default:return null}}function up(e,n){switch(Xu(n),n.tag){case 3:cr(yt),ke();break;case 26:case 27:case 5:di(n);break;case 4:ke();break;case 31:n.memoizedState!==null&&nn(n);break;case 13:nn(n);break;case 19:Se(mt);break;case 10:cr(n.type);break;case 22:case 23:nn(n),ff(),e!==null&&Se(Ni);break;case 24:cr(yt)}}function ja(e,n){try{var a=n.updateQueue,o=a!==null?a.lastEffect:null;if(o!==null){var u=o.next;a=u;do{if((a.tag&e)===e){o=void 0;var h=a.create,x=a.inst;o=h(),x.destroy=o}a=a.next}while(a!==u)}}catch(E){Ve(n,n.return,E)}}function Hr(e,n,a){try{var o=n.updateQueue,u=o!==null?o.lastEffect:null;if(u!==null){var h=u.next;o=h;do{if((o.tag&e)===e){var x=o.inst,E=x.destroy;if(E!==void 0){x.destroy=void 0,u=n;var R=a,H=E;try{H()}catch(J){Ve(u,R,J)}}}o=o.next}while(o!==h)}}catch(J){Ve(n,n.return,J)}}function fp(e){var n=e.updateQueue;if(n!==null){var a=e.stateNode;try{t0(n,a)}catch(o){Ve(e,e.return,o)}}}function hp(e,n,a){a.props=Di(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(o){Ve(e,n,o)}}function Ta(e,n){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var o=e.stateNode;break;case 30:o=e.stateNode;break;default:o=e.stateNode}typeof a=="function"?e.refCleanup=a(o):a.current=o}}catch(u){Ve(e,n,u)}}function Yn(e,n){var a=e.ref,o=e.refCleanup;if(a!==null)if(typeof o=="function")try{o()}catch(u){Ve(e,n,u)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(u){Ve(e,n,u)}else a.current=null}function dp(e){var n=e.type,a=e.memoizedProps,o=e.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":a.autoFocus&&o.focus();break e;case"img":a.src?o.src=a.src:a.srcSet&&(o.srcset=a.srcSet)}}catch(u){Ve(e,e.return,u)}}function Hf(e,n,a){try{var o=e.stateNode;w_(o,e.type,a,n),o[ot]=n}catch(u){Ve(e,e.return,u)}}function mp(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Jr(e.type)||e.tag===4}function Gf(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||mp(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Jr(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Ff(e,n,a){var o=e.tag;if(o===5||o===6)e=e.stateNode,n?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,n):(n=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,n.appendChild(e),a=a._reactRootContainer,a!=null||n.onclick!==null||(n.onclick=ir));else if(o!==4&&(o===27&&Jr(e.type)&&(a=e.stateNode,n=null),e=e.child,e!==null))for(Ff(e,n,a),e=e.sibling;e!==null;)Ff(e,n,a),e=e.sibling}function gl(e,n,a){var o=e.tag;if(o===5||o===6)e=e.stateNode,n?a.insertBefore(e,n):a.appendChild(e);else if(o!==4&&(o===27&&Jr(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(gl(e,n,a),e=e.sibling;e!==null;)gl(e,n,a),e=e.sibling}function pp(e){var n=e.stateNode,a=e.memoizedProps;try{for(var o=e.type,u=n.attributes;u.length;)n.removeAttributeNode(u[0]);Mt(n,o,a),n[Qe]=e,n[ot]=a}catch(h){Ve(e,e.return,h)}}var mr=!1,xt=!1,Vf=!1,gp=typeof WeakSet=="function"?WeakSet:Set,Ot=null;function t_(e,n){if(e=e.containerInfo,dh=Ll,e=Tm(e),zu(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var o=a.getSelection&&a.getSelection();if(o&&o.rangeCount!==0){a=o.anchorNode;var u=o.anchorOffset,h=o.focusNode;o=o.focusOffset;try{a.nodeType,h.nodeType}catch{a=null;break e}var x=0,E=-1,R=-1,H=0,J=0,ne=e,F=null;t:for(;;){for(var K;ne!==a||u!==0&&ne.nodeType!==3||(E=x+u),ne!==h||o!==0&&ne.nodeType!==3||(R=x+o),ne.nodeType===3&&(x+=ne.nodeValue.length),(K=ne.firstChild)!==null;)F=ne,ne=K;for(;;){if(ne===e)break t;if(F===a&&++H===u&&(E=x),F===h&&++J===o&&(R=x),(K=ne.nextSibling)!==null)break;ne=F,F=ne.parentNode}ne=K}a=E===-1||R===-1?null:{start:E,end:R}}else a=null}a=a||{start:0,end:0}}else a=null;for(mh={focusedElem:e,selectionRange:a},Ll=!1,Ot=n;Ot!==null;)if(n=Ot,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,Ot=e;else for(;Ot!==null;){switch(n=Ot,h=n.alternate,e=n.flags,n.tag){case 0:if((e&4)!==0&&(e=n.updateQueue,e=e!==null?e.events:null,e!==null))for(a=0;a<e.length;a++)u=e[a],u.ref.impl=u.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&h!==null){e=void 0,a=n,u=h.memoizedProps,h=h.memoizedState,o=a.stateNode;try{var ge=Di(a.type,u);e=o.getSnapshotBeforeUpdate(ge,h),o.__reactInternalSnapshotBeforeUpdate=e}catch(Ee){Ve(a,a.return,Ee)}}break;case 3:if((e&1024)!==0){if(e=n.stateNode.containerInfo,a=e.nodeType,a===9)yh(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":yh(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(s(163))}if(e=n.sibling,e!==null){e.return=n.return,Ot=e;break}Ot=n.return}}function yp(e,n,a){var o=a.flags;switch(a.tag){case 0:case 11:case 15:gr(e,a),o&4&&ja(5,a);break;case 1:if(gr(e,a),o&4)if(e=a.stateNode,n===null)try{e.componentDidMount()}catch(x){Ve(a,a.return,x)}else{var u=Di(a.type,n.memoizedProps);n=n.memoizedState;try{e.componentDidUpdate(u,n,e.__reactInternalSnapshotBeforeUpdate)}catch(x){Ve(a,a.return,x)}}o&64&&fp(a),o&512&&Ta(a,a.return);break;case 3:if(gr(e,a),o&64&&(e=a.updateQueue,e!==null)){if(n=null,a.child!==null)switch(a.child.tag){case 27:case 5:n=a.child.stateNode;break;case 1:n=a.child.stateNode}try{t0(e,n)}catch(x){Ve(a,a.return,x)}}break;case 27:n===null&&o&4&&pp(a);case 26:case 5:gr(e,a),n===null&&o&4&&dp(a),o&512&&Ta(a,a.return);break;case 12:gr(e,a);break;case 31:gr(e,a),o&4&&xp(e,a);break;case 13:gr(e,a),o&4&&_p(e,a),o&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=u_.bind(null,a),k_(e,a))));break;case 22:if(o=a.memoizedState!==null||mr,!o){n=n!==null&&n.memoizedState!==null||xt,u=mr;var h=xt;mr=o,(xt=n)&&!h?yr(e,a,(a.subtreeFlags&8772)!==0):gr(e,a),mr=u,xt=h}break;case 30:break;default:gr(e,a)}}function bp(e){var n=e.alternate;n!==null&&(e.alternate=null,bp(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&Ji(n)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var rt=null,Vt=!1;function pr(e,n,a){for(a=a.child;a!==null;)vp(e,n,a),a=a.sibling}function vp(e,n,a){if(dt&&typeof dt.onCommitFiberUnmount=="function")try{dt.onCommitFiberUnmount(pi,a)}catch{}switch(a.tag){case 26:xt||Yn(a,n),pr(e,n,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:xt||Yn(a,n);var o=rt,u=Vt;Jr(a.type)&&(rt=a.stateNode,Vt=!1),pr(e,n,a),La(a.stateNode),rt=o,Vt=u;break;case 5:xt||Yn(a,n);case 6:if(o=rt,u=Vt,rt=null,pr(e,n,a),rt=o,Vt=u,rt!==null)if(Vt)try{(rt.nodeType===9?rt.body:rt.nodeName==="HTML"?rt.ownerDocument.body:rt).removeChild(a.stateNode)}catch(h){Ve(a,n,h)}else try{rt.removeChild(a.stateNode)}catch(h){Ve(a,n,h)}break;case 18:rt!==null&&(Vt?(e=rt,fg(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),Ns(e)):fg(rt,a.stateNode));break;case 4:o=rt,u=Vt,rt=a.stateNode.containerInfo,Vt=!0,pr(e,n,a),rt=o,Vt=u;break;case 0:case 11:case 14:case 15:Hr(2,a,n),xt||Hr(4,a,n),pr(e,n,a);break;case 1:xt||(Yn(a,n),o=a.stateNode,typeof o.componentWillUnmount=="function"&&hp(a,n,o)),pr(e,n,a);break;case 21:pr(e,n,a);break;case 22:xt=(o=xt)||a.memoizedState!==null,pr(e,n,a),xt=o;break;default:pr(e,n,a)}}function xp(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Ns(e)}catch(a){Ve(n,n.return,a)}}}function _p(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Ns(e)}catch(a){Ve(n,n.return,a)}}function n_(e){switch(e.tag){case 31:case 13:case 19:var n=e.stateNode;return n===null&&(n=e.stateNode=new gp),n;case 22:return e=e.stateNode,n=e._retryCache,n===null&&(n=e._retryCache=new gp),n;default:throw Error(s(435,e.tag))}}function yl(e,n){var a=n_(e);n.forEach(function(o){if(!a.has(o)){a.add(o);var u=f_.bind(null,e,o);o.then(u,u)}})}function Yt(e,n){var a=n.deletions;if(a!==null)for(var o=0;o<a.length;o++){var u=a[o],h=e,x=n,E=x;e:for(;E!==null;){switch(E.tag){case 27:if(Jr(E.type)){rt=E.stateNode,Vt=!1;break e}break;case 5:rt=E.stateNode,Vt=!1;break e;case 3:case 4:rt=E.stateNode.containerInfo,Vt=!0;break e}E=E.return}if(rt===null)throw Error(s(160));vp(h,x,u),rt=null,Vt=!1,h=u.alternate,h!==null&&(h.return=null),u.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)wp(n,e),n=n.sibling}var Bn=null;function wp(e,n){var a=e.alternate,o=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Yt(n,e),Kt(e),o&4&&(Hr(3,e,e.return),ja(3,e),Hr(5,e,e.return));break;case 1:Yt(n,e),Kt(e),o&512&&(xt||a===null||Yn(a,a.return)),o&64&&mr&&(e=e.updateQueue,e!==null&&(o=e.callbacks,o!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?o:a.concat(o))));break;case 26:var u=Bn;if(Yt(n,e),Kt(e),o&512&&(xt||a===null||Yn(a,a.return)),o&4){var h=a!==null?a.memoizedState:null;if(o=e.memoizedState,a===null)if(o===null)if(e.stateNode===null){e:{o=e.type,a=e.memoizedProps,u=u.ownerDocument||u;t:switch(o){case"title":h=u.getElementsByTagName("title")[0],(!h||h[wt]||h[Qe]||h.namespaceURI==="http://www.w3.org/2000/svg"||h.hasAttribute("itemprop"))&&(h=u.createElement(o),u.head.insertBefore(h,u.querySelector("head > title"))),Mt(h,o,a),h[Qe]=e,D(h),o=h;break e;case"link":var x=wg("link","href",u).get(o+(a.href||""));if(x){for(var E=0;E<x.length;E++)if(h=x[E],h.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&h.getAttribute("rel")===(a.rel==null?null:a.rel)&&h.getAttribute("title")===(a.title==null?null:a.title)&&h.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){x.splice(E,1);break t}}h=u.createElement(o),Mt(h,o,a),u.head.appendChild(h);break;case"meta":if(x=wg("meta","content",u).get(o+(a.content||""))){for(E=0;E<x.length;E++)if(h=x[E],h.getAttribute("content")===(a.content==null?null:""+a.content)&&h.getAttribute("name")===(a.name==null?null:a.name)&&h.getAttribute("property")===(a.property==null?null:a.property)&&h.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&h.getAttribute("charset")===(a.charSet==null?null:a.charSet)){x.splice(E,1);break t}}h=u.createElement(o),Mt(h,o,a),u.head.appendChild(h);break;default:throw Error(s(468,o))}h[Qe]=e,D(h),o=h}e.stateNode=o}else Sg(u,e.type,e.stateNode);else e.stateNode=_g(u,o,e.memoizedProps);else h!==o?(h===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):h.count--,o===null?Sg(u,e.type,e.stateNode):_g(u,o,e.memoizedProps)):o===null&&e.stateNode!==null&&Hf(e,e.memoizedProps,a.memoizedProps)}break;case 27:Yt(n,e),Kt(e),o&512&&(xt||a===null||Yn(a,a.return)),a!==null&&o&4&&Hf(e,e.memoizedProps,a.memoizedProps);break;case 5:if(Yt(n,e),Kt(e),o&512&&(xt||a===null||Yn(a,a.return)),e.flags&32){u=e.stateNode;try{Zi(u,"")}catch(ge){Ve(e,e.return,ge)}}o&4&&e.stateNode!=null&&(u=e.memoizedProps,Hf(e,u,a!==null?a.memoizedProps:u)),o&1024&&(Vf=!0);break;case 6:if(Yt(n,e),Kt(e),o&4){if(e.stateNode===null)throw Error(s(162));o=e.memoizedProps,a=e.stateNode;try{a.nodeValue=o}catch(ge){Ve(e,e.return,ge)}}break;case 3:if(Rl=null,u=Bn,Bn=Cl(n.containerInfo),Yt(n,e),Bn=u,Kt(e),o&4&&a!==null&&a.memoizedState.isDehydrated)try{Ns(n.containerInfo)}catch(ge){Ve(e,e.return,ge)}Vf&&(Vf=!1,Sp(e));break;case 4:o=Bn,Bn=Cl(e.stateNode.containerInfo),Yt(n,e),Kt(e),Bn=o;break;case 12:Yt(n,e),Kt(e);break;case 31:Yt(n,e),Kt(e),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,yl(e,o)));break;case 13:Yt(n,e),Kt(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(vl=nt()),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,yl(e,o)));break;case 22:u=e.memoizedState!==null;var R=a!==null&&a.memoizedState!==null,H=mr,J=xt;if(mr=H||u,xt=J||R,Yt(n,e),xt=J,mr=H,Kt(e),o&8192)e:for(n=e.stateNode,n._visibility=u?n._visibility&-2:n._visibility|1,u&&(a===null||R||mr||xt||qi(e)),a=null,n=e;;){if(n.tag===5||n.tag===26){if(a===null){R=a=n;try{if(h=R.stateNode,u)x=h.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none";else{E=R.stateNode;var ne=R.memoizedProps.style,F=ne!=null&&ne.hasOwnProperty("display")?ne.display:null;E.style.display=F==null||typeof F=="boolean"?"":(""+F).trim()}}catch(ge){Ve(R,R.return,ge)}}}else if(n.tag===6){if(a===null){R=n;try{R.stateNode.nodeValue=u?"":R.memoizedProps}catch(ge){Ve(R,R.return,ge)}}}else if(n.tag===18){if(a===null){R=n;try{var K=R.stateNode;u?hg(K,!0):hg(R.stateNode,!1)}catch(ge){Ve(R,R.return,ge)}}}else if((n.tag!==22&&n.tag!==23||n.memoizedState===null||n===e)&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break e;for(;n.sibling===null;){if(n.return===null||n.return===e)break e;a===n&&(a=null),n=n.return}a===n&&(a=null),n.sibling.return=n.return,n=n.sibling}o&4&&(o=e.updateQueue,o!==null&&(a=o.retryQueue,a!==null&&(o.retryQueue=null,yl(e,a))));break;case 19:Yt(n,e),Kt(e),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,yl(e,o)));break;case 30:break;case 21:break;default:Yt(n,e),Kt(e)}}function Kt(e){var n=e.flags;if(n&2){try{for(var a,o=e.return;o!==null;){if(mp(o)){a=o;break}o=o.return}if(a==null)throw Error(s(160));switch(a.tag){case 27:var u=a.stateNode,h=Gf(e);gl(e,h,u);break;case 5:var x=a.stateNode;a.flags&32&&(Zi(x,""),a.flags&=-33);var E=Gf(e);gl(e,E,x);break;case 3:case 4:var R=a.stateNode.containerInfo,H=Gf(e);Ff(e,H,R);break;default:throw Error(s(161))}}catch(J){Ve(e,e.return,J)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function Sp(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var n=e;Sp(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),e=e.sibling}}function gr(e,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)yp(e,n.alternate,n),n=n.sibling}function qi(e){for(e=e.child;e!==null;){var n=e;switch(n.tag){case 0:case 11:case 14:case 15:Hr(4,n,n.return),qi(n);break;case 1:Yn(n,n.return);var a=n.stateNode;typeof a.componentWillUnmount=="function"&&hp(n,n.return,a),qi(n);break;case 27:La(n.stateNode);case 26:case 5:Yn(n,n.return),qi(n);break;case 22:n.memoizedState===null&&qi(n);break;case 30:qi(n);break;default:qi(n)}e=e.sibling}}function yr(e,n,a){for(a=a&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var o=n.alternate,u=e,h=n,x=h.flags;switch(h.tag){case 0:case 11:case 15:yr(u,h,a),ja(4,h);break;case 1:if(yr(u,h,a),o=h,u=o.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(H){Ve(o,o.return,H)}if(o=h,u=o.updateQueue,u!==null){var E=o.stateNode;try{var R=u.shared.hiddenCallbacks;if(R!==null)for(u.shared.hiddenCallbacks=null,u=0;u<R.length;u++)e0(R[u],E)}catch(H){Ve(o,o.return,H)}}a&&x&64&&fp(h),Ta(h,h.return);break;case 27:pp(h);case 26:case 5:yr(u,h,a),a&&o===null&&x&4&&dp(h),Ta(h,h.return);break;case 12:yr(u,h,a);break;case 31:yr(u,h,a),a&&x&4&&xp(u,h);break;case 13:yr(u,h,a),a&&x&4&&_p(u,h);break;case 22:h.memoizedState===null&&yr(u,h,a),Ta(h,h.return);break;case 30:break;default:yr(u,h,a)}n=n.sibling}}function Yf(e,n){var a=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),e=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(e=n.memoizedState.cachePool.pool),e!==a&&(e!=null&&e.refCount++,a!=null&&ma(a))}function Kf(e,n){e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&ma(e))}function Ln(e,n,a,o){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Ep(e,n,a,o),n=n.sibling}function Ep(e,n,a,o){var u=n.flags;switch(n.tag){case 0:case 11:case 15:Ln(e,n,a,o),u&2048&&ja(9,n);break;case 1:Ln(e,n,a,o);break;case 3:Ln(e,n,a,o),u&2048&&(e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&ma(e)));break;case 12:if(u&2048){Ln(e,n,a,o),e=n.stateNode;try{var h=n.memoizedProps,x=h.id,E=h.onPostCommit;typeof E=="function"&&E(x,n.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(R){Ve(n,n.return,R)}}else Ln(e,n,a,o);break;case 31:Ln(e,n,a,o);break;case 13:Ln(e,n,a,o);break;case 23:break;case 22:h=n.stateNode,x=n.alternate,n.memoizedState!==null?h._visibility&2?Ln(e,n,a,o):Na(e,n):h._visibility&2?Ln(e,n,a,o):(h._visibility|=2,bs(e,n,a,o,(n.subtreeFlags&10256)!==0||!1)),u&2048&&Yf(x,n);break;case 24:Ln(e,n,a,o),u&2048&&Kf(n.alternate,n);break;default:Ln(e,n,a,o)}}function bs(e,n,a,o,u){for(u=u&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var h=e,x=n,E=a,R=o,H=x.flags;switch(x.tag){case 0:case 11:case 15:bs(h,x,E,R,u),ja(8,x);break;case 23:break;case 22:var J=x.stateNode;x.memoizedState!==null?J._visibility&2?bs(h,x,E,R,u):Na(h,x):(J._visibility|=2,bs(h,x,E,R,u)),u&&H&2048&&Yf(x.alternate,x);break;case 24:bs(h,x,E,R,u),u&&H&2048&&Kf(x.alternate,x);break;default:bs(h,x,E,R,u)}n=n.sibling}}function Na(e,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var a=e,o=n,u=o.flags;switch(o.tag){case 22:Na(a,o),u&2048&&Yf(o.alternate,o);break;case 24:Na(a,o),u&2048&&Kf(o.alternate,o);break;default:Na(a,o)}n=n.sibling}}var ka=8192;function vs(e,n,a){if(e.subtreeFlags&ka)for(e=e.child;e!==null;)Op(e,n,a),e=e.sibling}function Op(e,n,a){switch(e.tag){case 26:vs(e,n,a),e.flags&ka&&e.memoizedState!==null&&$_(a,Bn,e.memoizedState,e.memoizedProps);break;case 5:vs(e,n,a);break;case 3:case 4:var o=Bn;Bn=Cl(e.stateNode.containerInfo),vs(e,n,a),Bn=o;break;case 22:e.memoizedState===null&&(o=e.alternate,o!==null&&o.memoizedState!==null?(o=ka,ka=16777216,vs(e,n,a),ka=o):vs(e,n,a));break;default:vs(e,n,a)}}function Ap(e){var n=e.alternate;if(n!==null&&(e=n.child,e!==null)){n.child=null;do n=e.sibling,e.sibling=null,e=n;while(e!==null)}}function Ca(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var o=n[a];Ot=o,Tp(o,e)}Ap(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)jp(e),e=e.sibling}function jp(e){switch(e.tag){case 0:case 11:case 15:Ca(e),e.flags&2048&&Hr(9,e,e.return);break;case 3:Ca(e);break;case 12:Ca(e);break;case 22:var n=e.stateNode;e.memoizedState!==null&&n._visibility&2&&(e.return===null||e.return.tag!==13)?(n._visibility&=-3,bl(e)):Ca(e);break;default:Ca(e)}}function bl(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var o=n[a];Ot=o,Tp(o,e)}Ap(e)}for(e=e.child;e!==null;){switch(n=e,n.tag){case 0:case 11:case 15:Hr(8,n,n.return),bl(n);break;case 22:a=n.stateNode,a._visibility&2&&(a._visibility&=-3,bl(n));break;default:bl(n)}e=e.sibling}}function Tp(e,n){for(;Ot!==null;){var a=Ot;switch(a.tag){case 0:case 11:case 15:Hr(8,a,n);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var o=a.memoizedState.cachePool.pool;o!=null&&o.refCount++}break;case 24:ma(a.memoizedState.cache)}if(o=a.child,o!==null)o.return=a,Ot=o;else e:for(a=e;Ot!==null;){o=Ot;var u=o.sibling,h=o.return;if(bp(o),o===a){Ot=null;break e}if(u!==null){u.return=h,Ot=u;break e}Ot=h}}}var r_={getCacheForType:function(e){var n=kt(yt),a=n.data.get(e);return a===void 0&&(a=e(),n.data.set(e,a)),a},cacheSignal:function(){return kt(yt).controller.signal}},i_=typeof WeakMap=="function"?WeakMap:Map,Ge=0,Ze=null,De=null,Be=0,Fe=0,rn=null,Gr=!1,xs=!1,Xf=!1,br=0,ct=0,Fr=0,Bi=0,Jf=0,sn=0,_s=0,Ma=null,Xt=null,Qf=!1,vl=0,Np=0,xl=1/0,_l=null,Vr=null,St=0,Yr=null,ws=null,vr=0,Zf=0,Wf=null,kp=null,Ra=0,eh=null;function an(){return(Ge&2)!==0&&Be!==0?Be&-Be:Y.T!==null?ah():ta()}function Cp(){if(sn===0)if((Be&536870912)===0||ze){var e=tr;tr<<=1,(tr&3932160)===0&&(tr=262144),sn=e}else sn=536870912;return e=tn.current,e!==null&&(e.flags|=32),sn}function Jt(e,n,a){(e===Ze&&(Fe===2||Fe===9)||e.cancelPendingCommit!==null)&&(Ss(e,0),Kr(e,Be,sn,!1)),Rn(e,a),((Ge&2)===0||e!==Ze)&&(e===Ze&&((Ge&2)===0&&(Bi|=a),ct===4&&Kr(e,Be,sn,!1)),Kn(e))}function Mp(e,n,a){if((Ge&6)!==0)throw Error(s(327));var o=!a&&(n&127)===0&&(n&e.expiredLanes)===0||yi(e,n),u=o?o_(e,n):nh(e,n,!0),h=o;do{if(u===0){xs&&!o&&Kr(e,n,0,!1);break}else{if(a=e.current.alternate,h&&!s_(a)){u=nh(e,n,!1),h=!1;continue}if(u===2){if(h=n,e.errorRecoveryDisabledLanes&h)var x=0;else x=e.pendingLanes&-536870913,x=x!==0?x:x&536870912?536870912:0;if(x!==0){n=x;e:{var E=e;u=Ma;var R=E.current.memoizedState.isDehydrated;if(R&&(Ss(E,x).flags|=256),x=nh(E,x,!1),x!==2){if(Xf&&!R){E.errorRecoveryDisabledLanes|=h,Bi|=h,u=4;break e}h=Xt,Xt=u,h!==null&&(Xt===null?Xt=h:Xt.push.apply(Xt,h))}u=x}if(h=!1,u!==2)continue}}if(u===1){Ss(e,0),Kr(e,n,0,!0);break}e:{switch(o=e,h=u,h){case 0:case 1:throw Error(s(345));case 4:if((n&4194048)!==n)break;case 6:Kr(o,n,sn,!Gr);break e;case 2:Xt=null;break;case 3:case 5:break;default:throw Error(s(329))}if((n&62914560)===n&&(u=vl+300-nt(),10<u)){if(Kr(o,n,sn,!Gr),gi(o,0,!0)!==0)break e;vr=n,o.timeoutHandle=cg(Rp.bind(null,o,a,Xt,_l,Qf,n,sn,Bi,_s,Gr,h,"Throttled",-0,0),u);break e}Rp(o,a,Xt,_l,Qf,n,sn,Bi,_s,Gr,h,null,-0,0)}}break}while(!0);Kn(e)}function Rp(e,n,a,o,u,h,x,E,R,H,J,ne,F,K){if(e.timeoutHandle=-1,ne=n.subtreeFlags,ne&8192||(ne&16785408)===16785408){ne={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ir},Op(n,h,ne);var ge=(h&62914560)===h?vl-nt():(h&4194048)===h?Np-nt():0;if(ge=H_(ne,ge),ge!==null){vr=h,e.cancelPendingCommit=ge(Ip.bind(null,e,n,h,a,o,u,x,E,R,J,ne,null,F,K)),Kr(e,h,x,!H);return}}Ip(e,n,h,a,o,u,x,E,R)}function s_(e){for(var n=e;;){var a=n.tag;if((a===0||a===11||a===15)&&n.flags&16384&&(a=n.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var o=0;o<a.length;o++){var u=a[o],h=u.getSnapshot;u=u.value;try{if(!Wt(h(),u))return!1}catch{return!1}}if(a=n.child,n.subtreeFlags&16384&&a!==null)a.return=n,n=a;else{if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function Kr(e,n,a,o){n&=~Jf,n&=~Bi,e.suspendedLanes|=n,e.pingedLanes&=~n,o&&(e.warmLanes|=n),o=e.expirationTimes;for(var u=n;0<u;){var h=31-Bt(u),x=1<<h;o[h]=-1,u&=~x}a!==0&&Cr(e,a,n)}function wl(){return(Ge&6)===0?(Da(0),!1):!0}function th(){if(De!==null){if(Fe===0)var e=De.return;else e=De,lr=ji=null,yf(e),ds=null,ga=0,e=De;for(;e!==null;)up(e.alternate,e),e=e.return;De=null}}function Ss(e,n){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,O_(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),vr=0,th(),Ze=e,De=a=ar(e.current,null),Be=n,Fe=0,rn=null,Gr=!1,xs=yi(e,n),Xf=!1,_s=sn=Jf=Bi=Fr=ct=0,Xt=Ma=null,Qf=!1,(n&8)!==0&&(n|=n&32);var o=e.entangledLanes;if(o!==0)for(e=e.entanglements,o&=n;0<o;){var u=31-Bt(o),h=1<<u;n|=e[u],o&=~h}return br=n,Ho(),a}function Dp(e,n){Ce=null,Y.H=Ea,n===hs||n===Qo?(n=Jm(),Fe=3):n===sf?(n=Jm(),Fe=4):Fe=n===Rf?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,rn=n,De===null&&(ct=1,fl(e,wn(n,e.current)))}function qp(){var e=tn.current;return e===null?!0:(Be&4194048)===Be?An===null:(Be&62914560)===Be||(Be&536870912)!==0?e===An:!1}function Bp(){var e=Y.H;return Y.H=Ea,e===null?Ea:e}function Lp(){var e=Y.A;return Y.A=r_,e}function Sl(){ct=4,Gr||(Be&4194048)!==Be&&tn.current!==null||(xs=!0),(Fr&134217727)===0&&(Bi&134217727)===0||Ze===null||Kr(Ze,Be,sn,!1)}function nh(e,n,a){var o=Ge;Ge|=2;var u=Bp(),h=Lp();(Ze!==e||Be!==n)&&(_l=null,Ss(e,n)),n=!1;var x=ct;e:do try{if(Fe!==0&&De!==null){var E=De,R=rn;switch(Fe){case 8:th(),x=6;break e;case 3:case 2:case 9:case 6:tn.current===null&&(n=!0);var H=Fe;if(Fe=0,rn=null,Es(e,E,R,H),a&&xs){x=0;break e}break;default:H=Fe,Fe=0,rn=null,Es(e,E,R,H)}}a_(),x=ct;break}catch(J){Dp(e,J)}while(!0);return n&&e.shellSuspendCounter++,lr=ji=null,Ge=o,Y.H=u,Y.A=h,De===null&&(Ze=null,Be=0,Ho()),x}function a_(){for(;De!==null;)zp(De)}function o_(e,n){var a=Ge;Ge|=2;var o=Bp(),u=Lp();Ze!==e||Be!==n?(_l=null,xl=nt()+500,Ss(e,n)):xs=yi(e,n);e:do try{if(Fe!==0&&De!==null){n=De;var h=rn;t:switch(Fe){case 1:Fe=0,rn=null,Es(e,n,h,1);break;case 2:case 9:if(Km(h)){Fe=0,rn=null,Up(n);break}n=function(){Fe!==2&&Fe!==9||Ze!==e||(Fe=7),Kn(e)},h.then(n,n);break e;case 3:Fe=7;break e;case 4:Fe=5;break e;case 7:Km(h)?(Fe=0,rn=null,Up(n)):(Fe=0,rn=null,Es(e,n,h,7));break;case 5:var x=null;switch(De.tag){case 26:x=De.memoizedState;case 5:case 27:var E=De;if(x?Eg(x):E.stateNode.complete){Fe=0,rn=null;var R=E.sibling;if(R!==null)De=R;else{var H=E.return;H!==null?(De=H,El(H)):De=null}break t}}Fe=0,rn=null,Es(e,n,h,5);break;case 6:Fe=0,rn=null,Es(e,n,h,6);break;case 8:th(),ct=6;break e;default:throw Error(s(462))}}l_();break}catch(J){Dp(e,J)}while(!0);return lr=ji=null,Y.H=o,Y.A=u,Ge=a,De!==null?0:(Ze=null,Be=0,Ho(),ct)}function l_(){for(;De!==null&&!Ao();)zp(De)}function zp(e){var n=lp(e.alternate,e,br);e.memoizedProps=e.pendingProps,n===null?El(e):De=n}function Up(e){var n=e,a=n.alternate;switch(n.tag){case 15:case 0:n=np(a,n,n.pendingProps,n.type,void 0,Be);break;case 11:n=np(a,n,n.pendingProps,n.type.render,n.ref,Be);break;case 5:yf(n);default:up(a,n),n=De=Lm(n,br),n=lp(a,n,br)}e.memoizedProps=e.pendingProps,n===null?El(e):De=n}function Es(e,n,a,o){lr=ji=null,yf(n),ds=null,ga=0;var u=n.return;try{if(Jx(e,u,n,a,Be)){ct=1,fl(e,wn(a,e.current)),De=null;return}}catch(h){if(u!==null)throw De=u,h;ct=1,fl(e,wn(a,e.current)),De=null;return}n.flags&32768?(ze||o===1?e=!0:xs||(Be&536870912)!==0?e=!1:(Gr=e=!0,(o===2||o===9||o===3||o===6)&&(o=tn.current,o!==null&&o.tag===13&&(o.flags|=16384))),Pp(n,e)):El(n)}function El(e){var n=e;do{if((n.flags&32768)!==0){Pp(n,Gr);return}e=n.return;var a=Wx(n.alternate,n,br);if(a!==null){De=a;return}if(n=n.sibling,n!==null){De=n;return}De=n=e}while(n!==null);ct===0&&(ct=5)}function Pp(e,n){do{var a=e_(e.alternate,e);if(a!==null){a.flags&=32767,De=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!n&&(e=e.sibling,e!==null)){De=e;return}De=e=a}while(e!==null);ct=6,De=null}function Ip(e,n,a,o,u,h,x,E,R){e.cancelPendingCommit=null;do Ol();while(St!==0);if((Ge&6)!==0)throw Error(s(327));if(n!==null){if(n===e.current)throw Error(s(177));if(h=n.lanes|n.childLanes,h|=Hu,kr(e,a,h,x,E,R),e===Ze&&(De=Ze=null,Be=0),ws=n,Yr=e,vr=a,Zf=h,Wf=u,kp=o,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,h_(Yi,function(){return Vp(),null})):(e.callbackNode=null,e.callbackPriority=0),o=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||o){o=Y.T,Y.T=null,u=ae.p,ae.p=2,x=Ge,Ge|=4;try{t_(e,n,a)}finally{Ge=x,ae.p=u,Y.T=o}}St=1,$p(),Hp(),Gp()}}function $p(){if(St===1){St=0;var e=Yr,n=ws,a=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||a){a=Y.T,Y.T=null;var o=ae.p;ae.p=2;var u=Ge;Ge|=4;try{wp(n,e);var h=mh,x=Tm(e.containerInfo),E=h.focusedElem,R=h.selectionRange;if(x!==E&&E&&E.ownerDocument&&jm(E.ownerDocument.documentElement,E)){if(R!==null&&zu(E)){var H=R.start,J=R.end;if(J===void 0&&(J=H),"selectionStart"in E)E.selectionStart=H,E.selectionEnd=Math.min(J,E.value.length);else{var ne=E.ownerDocument||document,F=ne&&ne.defaultView||window;if(F.getSelection){var K=F.getSelection(),ge=E.textContent.length,Ee=Math.min(R.start,ge),Je=R.end===void 0?Ee:Math.min(R.end,ge);!K.extend&&Ee>Je&&(x=Je,Je=Ee,Ee=x);var P=Am(E,Ee),q=Am(E,Je);if(P&&q&&(K.rangeCount!==1||K.anchorNode!==P.node||K.anchorOffset!==P.offset||K.focusNode!==q.node||K.focusOffset!==q.offset)){var $=ne.createRange();$.setStart(P.node,P.offset),K.removeAllRanges(),Ee>Je?(K.addRange($),K.extend(q.node,q.offset)):($.setEnd(q.node,q.offset),K.addRange($))}}}}for(ne=[],K=E;K=K.parentNode;)K.nodeType===1&&ne.push({element:K,left:K.scrollLeft,top:K.scrollTop});for(typeof E.focus=="function"&&E.focus(),E=0;E<ne.length;E++){var Z=ne[E];Z.element.scrollLeft=Z.left,Z.element.scrollTop=Z.top}}Ll=!!dh,mh=dh=null}finally{Ge=u,ae.p=o,Y.T=a}}e.current=n,St=2}}function Hp(){if(St===2){St=0;var e=Yr,n=ws,a=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||a){a=Y.T,Y.T=null;var o=ae.p;ae.p=2;var u=Ge;Ge|=4;try{yp(e,n.alternate,n)}finally{Ge=u,ae.p=o,Y.T=a}}St=3}}function Gp(){if(St===4||St===3){St=0,Vi();var e=Yr,n=ws,a=vr,o=kp;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?St=5:(St=0,ws=Yr=null,Fp(e,e.pendingLanes));var u=e.pendingLanes;if(u===0&&(Vr=null),vi(a),n=n.stateNode,dt&&typeof dt.onCommitFiberRoot=="function")try{dt.onCommitFiberRoot(pi,n,void 0,(n.current.flags&128)===128)}catch{}if(o!==null){n=Y.T,u=ae.p,ae.p=2,Y.T=null;try{for(var h=e.onRecoverableError,x=0;x<o.length;x++){var E=o[x];h(E.value,{componentStack:E.stack})}}finally{Y.T=n,ae.p=u}}(vr&3)!==0&&Ol(),Kn(e),u=e.pendingLanes,(a&261930)!==0&&(u&42)!==0?e===eh?Ra++:(Ra=0,eh=e):Ra=0,Da(0)}}function Fp(e,n){(e.pooledCacheLanes&=n)===0&&(n=e.pooledCache,n!=null&&(e.pooledCache=null,ma(n)))}function Ol(){return $p(),Hp(),Gp(),Vp()}function Vp(){if(St!==5)return!1;var e=Yr,n=Zf;Zf=0;var a=vi(vr),o=Y.T,u=ae.p;try{ae.p=32>a?32:a,Y.T=null,a=Wf,Wf=null;var h=Yr,x=vr;if(St=0,ws=Yr=null,vr=0,(Ge&6)!==0)throw Error(s(331));var E=Ge;if(Ge|=4,jp(h.current),Ep(h,h.current,x,a),Ge=E,Da(0,!1),dt&&typeof dt.onPostCommitFiberRoot=="function")try{dt.onPostCommitFiberRoot(pi,h)}catch{}return!0}finally{ae.p=u,Y.T=o,Fp(e,n)}}function Yp(e,n,a){n=wn(a,n),n=Mf(e.stateNode,n,2),e=Pr(e,n,2),e!==null&&(Rn(e,2),Kn(e))}function Ve(e,n,a){if(e.tag===3)Yp(e,e,a);else for(;n!==null;){if(n.tag===3){Yp(n,e,a);break}else if(n.tag===1){var o=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(Vr===null||!Vr.has(o))){e=wn(a,e),a=K0(2),o=Pr(n,a,2),o!==null&&(X0(a,o,n,e),Rn(o,2),Kn(o));break}}n=n.return}}function rh(e,n,a){var o=e.pingCache;if(o===null){o=e.pingCache=new i_;var u=new Set;o.set(n,u)}else u=o.get(n),u===void 0&&(u=new Set,o.set(n,u));u.has(a)||(Xf=!0,u.add(a),e=c_.bind(null,e,n,a),n.then(e,e))}function c_(e,n,a){var o=e.pingCache;o!==null&&o.delete(n),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,Ze===e&&(Be&a)===a&&(ct===4||ct===3&&(Be&62914560)===Be&&300>nt()-vl?(Ge&2)===0&&Ss(e,0):Jf|=a,_s===Be&&(_s=0)),Kn(e)}function Kp(e,n){n===0&&(n=Xi()),e=Ei(e,n),e!==null&&(Rn(e,n),Kn(e))}function u_(e){var n=e.memoizedState,a=0;n!==null&&(a=n.retryLane),Kp(e,a)}function f_(e,n){var a=0;switch(e.tag){case 31:case 13:var o=e.stateNode,u=e.memoizedState;u!==null&&(a=u.retryLane);break;case 19:o=e.stateNode;break;case 22:o=e.stateNode._retryCache;break;default:throw Error(s(314))}o!==null&&o.delete(n),Kp(e,a)}function h_(e,n){return Qs(e,n)}var Al=null,Os=null,ih=!1,jl=!1,sh=!1,Xr=0;function Kn(e){e!==Os&&e.next===null&&(Os===null?Al=Os=e:Os=Os.next=e),jl=!0,ih||(ih=!0,m_())}function Da(e,n){if(!sh&&jl){sh=!0;do for(var a=!1,o=Al;o!==null;){if(e!==0){var u=o.pendingLanes;if(u===0)var h=0;else{var x=o.suspendedLanes,E=o.pingedLanes;h=(1<<31-Bt(42|e)+1)-1,h&=u&~(x&~E),h=h&201326741?h&201326741|1:h?h|2:0}h!==0&&(a=!0,Zp(o,h))}else h=Be,h=gi(o,o===Ze?h:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(h&3)===0||yi(o,h)||(a=!0,Zp(o,h));o=o.next}while(a);sh=!1}}function d_(){Xp()}function Xp(){jl=ih=!1;var e=0;Xr!==0&&E_()&&(e=Xr);for(var n=nt(),a=null,o=Al;o!==null;){var u=o.next,h=Jp(o,n);h===0?(o.next=null,a===null?Al=u:a.next=u,u===null&&(Os=a)):(a=o,(e!==0||(h&3)!==0)&&(jl=!0)),o=u}St!==0&&St!==5||Da(e),Xr!==0&&(Xr=0)}function Jp(e,n){for(var a=e.suspendedLanes,o=e.pingedLanes,u=e.expirationTimes,h=e.pendingLanes&-62914561;0<h;){var x=31-Bt(h),E=1<<x,R=u[x];R===-1?((E&a)===0||(E&o)!==0)&&(u[x]=ea(E,n)):R<=n&&(e.expiredLanes|=E),h&=~E}if(n=Ze,a=Be,a=gi(e,e===n?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),o=e.callbackNode,a===0||e===n&&(Fe===2||Fe===9)||e.cancelPendingCommit!==null)return o!==null&&o!==null&&er(o),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||yi(e,a)){if(n=a&-a,n===e.callbackPriority)return n;switch(o!==null&&er(o),vi(a)){case 2:case 8:a=To;break;case 32:a=Yi;break;case 268435456:a=No;break;default:a=Yi}return o=Qp.bind(null,e),a=Qs(a,o),e.callbackPriority=n,e.callbackNode=a,n}return o!==null&&o!==null&&er(o),e.callbackPriority=2,e.callbackNode=null,2}function Qp(e,n){if(St!==0&&St!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(Ol()&&e.callbackNode!==a)return null;var o=Be;return o=gi(e,e===Ze?o:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),o===0?null:(Mp(e,o,n),Jp(e,nt()),e.callbackNode!=null&&e.callbackNode===a?Qp.bind(null,e):null)}function Zp(e,n){if(Ol())return null;Mp(e,n,!0)}function m_(){A_(function(){(Ge&6)!==0?Qs(jo,d_):Xp()})}function ah(){if(Xr===0){var e=us;e===0&&(e=jr,jr<<=1,(jr&261888)===0&&(jr=256)),Xr=e}return Xr}function Wp(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:qo(""+e)}function eg(e,n){var a=n.ownerDocument.createElement("input");return a.name=n.name,a.value=n.value,e.id&&a.setAttribute("form",e.id),n.parentNode.insertBefore(a,n),e=new FormData(e),a.parentNode.removeChild(a),e}function p_(e,n,a,o,u){if(n==="submit"&&a&&a.stateNode===u){var h=Wp((u[ot]||null).action),x=o.submitter;x&&(n=(n=x[ot]||null)?Wp(n.formAction):x.getAttribute("formAction"),n!==null&&(h=n,x=null));var E=new Uo("action","action",null,o,u);e.push({event:E,listeners:[{instance:null,listener:function(){if(o.defaultPrevented){if(Xr!==0){var R=x?eg(u,x):new FormData(u);Af(a,{pending:!0,data:R,method:u.method,action:h},null,R)}}else typeof h=="function"&&(E.preventDefault(),R=x?eg(u,x):new FormData(u),Af(a,{pending:!0,data:R,method:u.method,action:h},h,R))},currentTarget:u}]})}}for(var oh=0;oh<$u.length;oh++){var lh=$u[oh],g_=lh.toLowerCase(),y_=lh[0].toUpperCase()+lh.slice(1);qn(g_,"on"+y_)}qn(Cm,"onAnimationEnd"),qn(Mm,"onAnimationIteration"),qn(Rm,"onAnimationStart"),qn("dblclick","onDoubleClick"),qn("focusin","onFocus"),qn("focusout","onBlur"),qn(Rx,"onTransitionRun"),qn(Dx,"onTransitionStart"),qn(qx,"onTransitionCancel"),qn(Dm,"onTransitionEnd"),V("onMouseEnter",["mouseout","mouseover"]),V("onMouseLeave",["mouseout","mouseover"]),V("onPointerEnter",["pointerout","pointerover"]),V("onPointerLeave",["pointerout","pointerover"]),se("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),se("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),se("onBeforeInput",["compositionend","keypress","textInput","paste"]),se("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),se("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),se("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var qa="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),b_=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(qa));function tg(e,n){n=(n&4)!==0;for(var a=0;a<e.length;a++){var o=e[a],u=o.event;o=o.listeners;e:{var h=void 0;if(n)for(var x=o.length-1;0<=x;x--){var E=o[x],R=E.instance,H=E.currentTarget;if(E=E.listener,R!==h&&u.isPropagationStopped())break e;h=E,u.currentTarget=H;try{h(u)}catch(J){$o(J)}u.currentTarget=null,h=R}else for(x=0;x<o.length;x++){if(E=o[x],R=E.instance,H=E.currentTarget,E=E.listener,R!==h&&u.isPropagationStopped())break e;h=E,u.currentTarget=H;try{h(u)}catch(J){$o(J)}u.currentTarget=null,h=R}}}}function qe(e,n){var a=n[xi];a===void 0&&(a=n[xi]=new Set);var o=e+"__bubble";a.has(o)||(ng(n,e,2,!1),a.add(o))}function ch(e,n,a){var o=0;n&&(o|=4),ng(a,e,o,n)}var Tl="_reactListening"+Math.random().toString(36).slice(2);function uh(e){if(!e[Tl]){e[Tl]=!0,I.forEach(function(a){a!=="selectionchange"&&(b_.has(a)||ch(a,!1,e),ch(a,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[Tl]||(n[Tl]=!0,ch("selectionchange",!1,n))}}function ng(e,n,a,o){switch(Cg(n)){case 2:var u=V_;break;case 8:u=Y_;break;default:u=Oh}a=u.bind(null,n,a,e),u=void 0,!Nu||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(u=!0),o?u!==void 0?e.addEventListener(n,a,{capture:!0,passive:u}):e.addEventListener(n,a,!0):u!==void 0?e.addEventListener(n,a,{passive:u}):e.addEventListener(n,a,!1)}function fh(e,n,a,o,u){var h=o;if((n&1)===0&&(n&2)===0&&o!==null)e:for(;;){if(o===null)return;var x=o.tag;if(x===3||x===4){var E=o.stateNode.containerInfo;if(E===u)break;if(x===4)for(x=o.return;x!==null;){var R=x.tag;if((R===3||R===4)&&x.stateNode.containerInfo===u)return;x=x.return}for(;E!==null;){if(x=O(E),x===null)return;if(R=x.tag,R===5||R===6||R===26||R===27){o=h=x;continue e}E=E.parentNode}}o=o.return}om(function(){var H=h,J=ju(a),ne=[];e:{var F=qm.get(e);if(F!==void 0){var K=Uo,ge=e;switch(e){case"keypress":if(Lo(a)===0)break e;case"keydown":case"keyup":K=fx;break;case"focusin":ge="focus",K=Ru;break;case"focusout":ge="blur",K=Ru;break;case"beforeblur":case"afterblur":K=Ru;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":K=um;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":K=Wv;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":K=mx;break;case Cm:case Mm:case Rm:K=nx;break;case Dm:K=gx;break;case"scroll":case"scrollend":K=Qv;break;case"wheel":K=bx;break;case"copy":case"cut":case"paste":K=ix;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":K=hm;break;case"toggle":case"beforetoggle":K=xx}var Ee=(n&4)!==0,Je=!Ee&&(e==="scroll"||e==="scrollend"),P=Ee?F!==null?F+"Capture":null:F;Ee=[];for(var q=H,$;q!==null;){var Z=q;if($=Z.stateNode,Z=Z.tag,Z!==5&&Z!==26&&Z!==27||$===null||P===null||(Z=ra(q,P),Z!=null&&Ee.push(Ba(q,Z,$))),Je)break;q=q.return}0<Ee.length&&(F=new K(F,ge,null,a,J),ne.push({event:F,listeners:Ee}))}}if((n&7)===0){e:{if(F=e==="mouseover"||e==="pointerover",K=e==="mouseout"||e==="pointerout",F&&a!==Au&&(ge=a.relatedTarget||a.fromElement)&&(O(ge)||ge[Zt]))break e;if((K||F)&&(F=J.window===J?J:(F=J.ownerDocument)?F.defaultView||F.parentWindow:window,K?(ge=a.relatedTarget||a.toElement,K=H,ge=ge?O(ge):null,ge!==null&&(Je=c(ge),Ee=ge.tag,ge!==Je||Ee!==5&&Ee!==27&&Ee!==6)&&(ge=null)):(K=null,ge=H),K!==ge)){if(Ee=um,Z="onMouseLeave",P="onMouseEnter",q="mouse",(e==="pointerout"||e==="pointerover")&&(Ee=hm,Z="onPointerLeave",P="onPointerEnter",q="pointer"),Je=K==null?F:T(K),$=ge==null?F:T(ge),F=new Ee(Z,q+"leave",K,a,J),F.target=Je,F.relatedTarget=$,Z=null,O(J)===H&&(Ee=new Ee(P,q+"enter",ge,a,J),Ee.target=$,Ee.relatedTarget=Je,Z=Ee),Je=Z,K&&ge)t:{for(Ee=v_,P=K,q=ge,$=0,Z=P;Z;Z=Ee(Z))$++;Z=0;for(var xe=q;xe;xe=Ee(xe))Z++;for(;0<$-Z;)P=Ee(P),$--;for(;0<Z-$;)q=Ee(q),Z--;for(;$--;){if(P===q||q!==null&&P===q.alternate){Ee=P;break t}P=Ee(P),q=Ee(q)}Ee=null}else Ee=null;K!==null&&rg(ne,F,K,Ee,!1),ge!==null&&Je!==null&&rg(ne,Je,ge,Ee,!0)}}e:{if(F=H?T(H):window,K=F.nodeName&&F.nodeName.toLowerCase(),K==="select"||K==="input"&&F.type==="file")var $e=xm;else if(bm(F))if(_m)$e=kx;else{$e=Tx;var ye=jx}else K=F.nodeName,!K||K.toLowerCase()!=="input"||F.type!=="checkbox"&&F.type!=="radio"?H&&Ou(H.elementType)&&($e=xm):$e=Nx;if($e&&($e=$e(e,H))){vm(ne,$e,a,J);break e}ye&&ye(e,F,H),e==="focusout"&&H&&F.type==="number"&&H.memoizedProps.value!=null&&Eu(F,"number",F.value)}switch(ye=H?T(H):window,e){case"focusin":(bm(ye)||ye.contentEditable==="true")&&(ns=ye,Uu=H,fa=null);break;case"focusout":fa=Uu=ns=null;break;case"mousedown":Pu=!0;break;case"contextmenu":case"mouseup":case"dragend":Pu=!1,Nm(ne,a,J);break;case"selectionchange":if(Mx)break;case"keydown":case"keyup":Nm(ne,a,J)}var Me;if(qu)e:{switch(e){case"compositionstart":var Le="onCompositionStart";break e;case"compositionend":Le="onCompositionEnd";break e;case"compositionupdate":Le="onCompositionUpdate";break e}Le=void 0}else ts?gm(e,a)&&(Le="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(Le="onCompositionStart");Le&&(dm&&a.locale!=="ko"&&(ts||Le!=="onCompositionStart"?Le==="onCompositionEnd"&&ts&&(Me=lm()):(Rr=J,ku="value"in Rr?Rr.value:Rr.textContent,ts=!0)),ye=Nl(H,Le),0<ye.length&&(Le=new fm(Le,e,null,a,J),ne.push({event:Le,listeners:ye}),Me?Le.data=Me:(Me=ym(a),Me!==null&&(Le.data=Me)))),(Me=wx?Sx(e,a):Ex(e,a))&&(Le=Nl(H,"onBeforeInput"),0<Le.length&&(ye=new fm("onBeforeInput","beforeinput",null,a,J),ne.push({event:ye,listeners:Le}),ye.data=Me)),p_(ne,e,H,a,J)}tg(ne,n)})}function Ba(e,n,a){return{instance:e,listener:n,currentTarget:a}}function Nl(e,n){for(var a=n+"Capture",o=[];e!==null;){var u=e,h=u.stateNode;if(u=u.tag,u!==5&&u!==26&&u!==27||h===null||(u=ra(e,a),u!=null&&o.unshift(Ba(e,u,h)),u=ra(e,n),u!=null&&o.push(Ba(e,u,h))),e.tag===3)return o;e=e.return}return[]}function v_(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function rg(e,n,a,o,u){for(var h=n._reactName,x=[];a!==null&&a!==o;){var E=a,R=E.alternate,H=E.stateNode;if(E=E.tag,R!==null&&R===o)break;E!==5&&E!==26&&E!==27||H===null||(R=H,u?(H=ra(a,h),H!=null&&x.unshift(Ba(a,H,R))):u||(H=ra(a,h),H!=null&&x.push(Ba(a,H,R)))),a=a.return}x.length!==0&&e.push({event:n,listeners:x})}var x_=/\r\n?/g,__=/\u0000|\uFFFD/g;function ig(e){return(typeof e=="string"?e:""+e).replace(x_,`
26
+ `).replace(__,"")}function sg(e,n){return n=ig(n),ig(e)===n}function Xe(e,n,a,o,u,h){switch(a){case"children":typeof o=="string"?n==="body"||n==="textarea"&&o===""||Zi(e,o):(typeof o=="number"||typeof o=="bigint")&&n!=="body"&&Zi(e,""+o);break;case"className":Dn(e,"class",o);break;case"tabIndex":Dn(e,"tabindex",o);break;case"dir":case"role":case"viewBox":case"width":case"height":Dn(e,a,o);break;case"style":sm(e,o,h);break;case"data":if(n!=="object"){Dn(e,"data",o);break}case"src":case"href":if(o===""&&(n!=="a"||a!=="href")){e.removeAttribute(a);break}if(o==null||typeof o=="function"||typeof o=="symbol"||typeof o=="boolean"){e.removeAttribute(a);break}o=qo(""+o),e.setAttribute(a,o);break;case"action":case"formAction":if(typeof o=="function"){e.setAttribute(a,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof h=="function"&&(a==="formAction"?(n!=="input"&&Xe(e,n,"name",u.name,u,null),Xe(e,n,"formEncType",u.formEncType,u,null),Xe(e,n,"formMethod",u.formMethod,u,null),Xe(e,n,"formTarget",u.formTarget,u,null)):(Xe(e,n,"encType",u.encType,u,null),Xe(e,n,"method",u.method,u,null),Xe(e,n,"target",u.target,u,null)));if(o==null||typeof o=="symbol"||typeof o=="boolean"){e.removeAttribute(a);break}o=qo(""+o),e.setAttribute(a,o);break;case"onClick":o!=null&&(e.onclick=ir);break;case"onScroll":o!=null&&qe("scroll",e);break;case"onScrollEnd":o!=null&&qe("scrollend",e);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(s(61));if(a=o.__html,a!=null){if(u.children!=null)throw Error(s(60));e.innerHTML=a}}break;case"multiple":e.multiple=o&&typeof o!="function"&&typeof o!="symbol";break;case"muted":e.muted=o&&typeof o!="function"&&typeof o!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(o==null||typeof o=="function"||typeof o=="boolean"||typeof o=="symbol"){e.removeAttribute("xlink:href");break}a=qo(""+o),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":o!=null&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(a,""+o):e.removeAttribute(a);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":o&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(a,""):e.removeAttribute(a);break;case"capture":case"download":o===!0?e.setAttribute(a,""):o!==!1&&o!=null&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(a,o):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":o!=null&&typeof o!="function"&&typeof o!="symbol"&&!isNaN(o)&&1<=o?e.setAttribute(a,o):e.removeAttribute(a);break;case"rowSpan":case"start":o==null||typeof o=="function"||typeof o=="symbol"||isNaN(o)?e.removeAttribute(a):e.setAttribute(a,o);break;case"popover":qe("beforetoggle",e),qe("toggle",e),Lt(e,"popover",o);break;case"xlinkActuate":rr(e,"http://www.w3.org/1999/xlink","xlink:actuate",o);break;case"xlinkArcrole":rr(e,"http://www.w3.org/1999/xlink","xlink:arcrole",o);break;case"xlinkRole":rr(e,"http://www.w3.org/1999/xlink","xlink:role",o);break;case"xlinkShow":rr(e,"http://www.w3.org/1999/xlink","xlink:show",o);break;case"xlinkTitle":rr(e,"http://www.w3.org/1999/xlink","xlink:title",o);break;case"xlinkType":rr(e,"http://www.w3.org/1999/xlink","xlink:type",o);break;case"xmlBase":rr(e,"http://www.w3.org/XML/1998/namespace","xml:base",o);break;case"xmlLang":rr(e,"http://www.w3.org/XML/1998/namespace","xml:lang",o);break;case"xmlSpace":rr(e,"http://www.w3.org/XML/1998/namespace","xml:space",o);break;case"is":Lt(e,"is",o);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=Xv.get(a)||a,Lt(e,a,o))}}function hh(e,n,a,o,u,h){switch(a){case"style":sm(e,o,h);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(s(61));if(a=o.__html,a!=null){if(u.children!=null)throw Error(s(60));e.innerHTML=a}}break;case"children":typeof o=="string"?Zi(e,o):(typeof o=="number"||typeof o=="bigint")&&Zi(e,""+o);break;case"onScroll":o!=null&&qe("scroll",e);break;case"onScrollEnd":o!=null&&qe("scrollend",e);break;case"onClick":o!=null&&(e.onclick=ir);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!te.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(u=a.endsWith("Capture"),n=a.slice(2,u?a.length-7:void 0),h=e[ot]||null,h=h!=null?h[a]:null,typeof h=="function"&&e.removeEventListener(n,h,u),typeof o=="function")){typeof h!="function"&&h!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(n,o,u);break e}a in e?e[a]=o:o===!0?e.setAttribute(a,""):Lt(e,a,o)}}}function Mt(e,n,a){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":qe("error",e),qe("load",e);var o=!1,u=!1,h;for(h in a)if(a.hasOwnProperty(h)){var x=a[h];if(x!=null)switch(h){case"src":o=!0;break;case"srcSet":u=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,n));default:Xe(e,n,h,x,a,null)}}u&&Xe(e,n,"srcSet",a.srcSet,a,null),o&&Xe(e,n,"src",a.src,a,null);return;case"input":qe("invalid",e);var E=h=x=u=null,R=null,H=null;for(o in a)if(a.hasOwnProperty(o)){var J=a[o];if(J!=null)switch(o){case"name":u=J;break;case"type":x=J;break;case"checked":R=J;break;case"defaultChecked":H=J;break;case"value":h=J;break;case"defaultValue":E=J;break;case"children":case"dangerouslySetInnerHTML":if(J!=null)throw Error(s(137,n));break;default:Xe(e,n,o,J,a,null)}}tm(e,h,E,R,H,x,u,!1);return;case"select":qe("invalid",e),o=x=h=null;for(u in a)if(a.hasOwnProperty(u)&&(E=a[u],E!=null))switch(u){case"value":h=E;break;case"defaultValue":x=E;break;case"multiple":o=E;default:Xe(e,n,u,E,a,null)}n=h,a=x,e.multiple=!!o,n!=null?Qi(e,!!o,n,!1):a!=null&&Qi(e,!!o,a,!0);return;case"textarea":qe("invalid",e),h=u=o=null;for(x in a)if(a.hasOwnProperty(x)&&(E=a[x],E!=null))switch(x){case"value":o=E;break;case"defaultValue":u=E;break;case"children":h=E;break;case"dangerouslySetInnerHTML":if(E!=null)throw Error(s(91));break;default:Xe(e,n,x,E,a,null)}rm(e,o,u,h);return;case"option":for(R in a)if(a.hasOwnProperty(R)&&(o=a[R],o!=null))switch(R){case"selected":e.selected=o&&typeof o!="function"&&typeof o!="symbol";break;default:Xe(e,n,R,o,a,null)}return;case"dialog":qe("beforetoggle",e),qe("toggle",e),qe("cancel",e),qe("close",e);break;case"iframe":case"object":qe("load",e);break;case"video":case"audio":for(o=0;o<qa.length;o++)qe(qa[o],e);break;case"image":qe("error",e),qe("load",e);break;case"details":qe("toggle",e);break;case"embed":case"source":case"link":qe("error",e),qe("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(H in a)if(a.hasOwnProperty(H)&&(o=a[H],o!=null))switch(H){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,n));default:Xe(e,n,H,o,a,null)}return;default:if(Ou(n)){for(J in a)a.hasOwnProperty(J)&&(o=a[J],o!==void 0&&hh(e,n,J,o,a,void 0));return}}for(E in a)a.hasOwnProperty(E)&&(o=a[E],o!=null&&Xe(e,n,E,o,a,null))}function w_(e,n,a,o){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var u=null,h=null,x=null,E=null,R=null,H=null,J=null;for(K in a){var ne=a[K];if(a.hasOwnProperty(K)&&ne!=null)switch(K){case"checked":break;case"value":break;case"defaultValue":R=ne;default:o.hasOwnProperty(K)||Xe(e,n,K,null,o,ne)}}for(var F in o){var K=o[F];if(ne=a[F],o.hasOwnProperty(F)&&(K!=null||ne!=null))switch(F){case"type":h=K;break;case"name":u=K;break;case"checked":H=K;break;case"defaultChecked":J=K;break;case"value":x=K;break;case"defaultValue":E=K;break;case"children":case"dangerouslySetInnerHTML":if(K!=null)throw Error(s(137,n));break;default:K!==ne&&Xe(e,n,F,K,o,ne)}}Su(e,x,E,R,H,J,h,u);return;case"select":K=x=E=F=null;for(h in a)if(R=a[h],a.hasOwnProperty(h)&&R!=null)switch(h){case"value":break;case"multiple":K=R;default:o.hasOwnProperty(h)||Xe(e,n,h,null,o,R)}for(u in o)if(h=o[u],R=a[u],o.hasOwnProperty(u)&&(h!=null||R!=null))switch(u){case"value":F=h;break;case"defaultValue":E=h;break;case"multiple":x=h;default:h!==R&&Xe(e,n,u,h,o,R)}n=E,a=x,o=K,F!=null?Qi(e,!!a,F,!1):!!o!=!!a&&(n!=null?Qi(e,!!a,n,!0):Qi(e,!!a,a?[]:"",!1));return;case"textarea":K=F=null;for(E in a)if(u=a[E],a.hasOwnProperty(E)&&u!=null&&!o.hasOwnProperty(E))switch(E){case"value":break;case"children":break;default:Xe(e,n,E,null,o,u)}for(x in o)if(u=o[x],h=a[x],o.hasOwnProperty(x)&&(u!=null||h!=null))switch(x){case"value":F=u;break;case"defaultValue":K=u;break;case"children":break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(s(91));break;default:u!==h&&Xe(e,n,x,u,o,h)}nm(e,F,K);return;case"option":for(var ge in a)if(F=a[ge],a.hasOwnProperty(ge)&&F!=null&&!o.hasOwnProperty(ge))switch(ge){case"selected":e.selected=!1;break;default:Xe(e,n,ge,null,o,F)}for(R in o)if(F=o[R],K=a[R],o.hasOwnProperty(R)&&F!==K&&(F!=null||K!=null))switch(R){case"selected":e.selected=F&&typeof F!="function"&&typeof F!="symbol";break;default:Xe(e,n,R,F,o,K)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ee in a)F=a[Ee],a.hasOwnProperty(Ee)&&F!=null&&!o.hasOwnProperty(Ee)&&Xe(e,n,Ee,null,o,F);for(H in o)if(F=o[H],K=a[H],o.hasOwnProperty(H)&&F!==K&&(F!=null||K!=null))switch(H){case"children":case"dangerouslySetInnerHTML":if(F!=null)throw Error(s(137,n));break;default:Xe(e,n,H,F,o,K)}return;default:if(Ou(n)){for(var Je in a)F=a[Je],a.hasOwnProperty(Je)&&F!==void 0&&!o.hasOwnProperty(Je)&&hh(e,n,Je,void 0,o,F);for(J in o)F=o[J],K=a[J],!o.hasOwnProperty(J)||F===K||F===void 0&&K===void 0||hh(e,n,J,F,o,K);return}}for(var P in a)F=a[P],a.hasOwnProperty(P)&&F!=null&&!o.hasOwnProperty(P)&&Xe(e,n,P,null,o,F);for(ne in o)F=o[ne],K=a[ne],!o.hasOwnProperty(ne)||F===K||F==null&&K==null||Xe(e,n,ne,F,o,K)}function ag(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function S_(){if(typeof performance.getEntriesByType=="function"){for(var e=0,n=0,a=performance.getEntriesByType("resource"),o=0;o<a.length;o++){var u=a[o],h=u.transferSize,x=u.initiatorType,E=u.duration;if(h&&E&&ag(x)){for(x=0,E=u.responseEnd,o+=1;o<a.length;o++){var R=a[o],H=R.startTime;if(H>E)break;var J=R.transferSize,ne=R.initiatorType;J&&ag(ne)&&(R=R.responseEnd,x+=J*(R<E?1:(E-H)/(R-H)))}if(--o,n+=8*(h+x)/(u.duration/1e3),e++,10<e)break}}if(0<e)return n/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var dh=null,mh=null;function kl(e){return e.nodeType===9?e:e.ownerDocument}function og(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function lg(e,n){if(e===0)switch(n){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&n==="foreignObject"?0:e}function ph(e,n){return e==="textarea"||e==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.children=="bigint"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var gh=null;function E_(){var e=window.event;return e&&e.type==="popstate"?e===gh?!1:(gh=e,!0):(gh=null,!1)}var cg=typeof setTimeout=="function"?setTimeout:void 0,O_=typeof clearTimeout=="function"?clearTimeout:void 0,ug=typeof Promise=="function"?Promise:void 0,A_=typeof queueMicrotask=="function"?queueMicrotask:typeof ug<"u"?function(e){return ug.resolve(null).then(e).catch(j_)}:cg;function j_(e){setTimeout(function(){throw e})}function Jr(e){return e==="head"}function fg(e,n){var a=n,o=0;do{var u=a.nextSibling;if(e.removeChild(a),u&&u.nodeType===8)if(a=u.data,a==="/$"||a==="/&"){if(o===0){e.removeChild(u),Ns(n);return}o--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")o++;else if(a==="html")La(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,La(a);for(var h=a.firstChild;h;){var x=h.nextSibling,E=h.nodeName;h[wt]||E==="SCRIPT"||E==="STYLE"||E==="LINK"&&h.rel.toLowerCase()==="stylesheet"||a.removeChild(h),h=x}}else a==="body"&&La(e.ownerDocument.body);a=u}while(a);Ns(n)}function hg(e,n){var a=e;e=0;do{var o=a.nextSibling;if(a.nodeType===1?n?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(n?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),o&&o.nodeType===8)if(a=o.data,a==="/$"){if(e===0)break;e--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||e++;a=o}while(a)}function yh(e){var n=e.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var a=n;switch(n=n.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":yh(a),Ji(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function T_(e,n,a,o){for(;e.nodeType===1;){var u=a;if(e.nodeName.toLowerCase()!==n.toLowerCase()){if(!o&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(o){if(!e[wt])switch(n){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(h=e.getAttribute("rel"),h==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(h!==u.rel||e.getAttribute("href")!==(u.href==null||u.href===""?null:u.href)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin)||e.getAttribute("title")!==(u.title==null?null:u.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(h=e.getAttribute("src"),(h!==(u.src==null?null:u.src)||e.getAttribute("type")!==(u.type==null?null:u.type)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin))&&h&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(n==="input"&&e.type==="hidden"){var h=u.name==null?null:""+u.name;if(u.type==="hidden"&&e.getAttribute("name")===h)return e}else return e;if(e=jn(e.nextSibling),e===null)break}return null}function N_(e,n,a){if(n==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=jn(e.nextSibling),e===null))return null;return e}function dg(e,n){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=jn(e.nextSibling),e===null))return null;return e}function bh(e){return e.data==="$?"||e.data==="$~"}function vh(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function k_(e,n){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=n;else if(e.data!=="$?"||a.readyState!=="loading")n();else{var o=function(){n(),a.removeEventListener("DOMContentLoaded",o)};a.addEventListener("DOMContentLoaded",o),e._reactRetry=o}}function jn(e){for(;e!=null;e=e.nextSibling){var n=e.nodeType;if(n===1||n===3)break;if(n===8){if(n=e.data,n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"||n==="F!"||n==="F")break;if(n==="/$"||n==="/&")return null}}return e}var xh=null;function mg(e){e=e.nextSibling;for(var n=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(n===0)return jn(e.nextSibling);n--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||n++}e=e.nextSibling}return null}function pg(e){e=e.previousSibling;for(var n=0;e;){if(e.nodeType===8){var a=e.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(n===0)return e;n--}else a!=="/$"&&a!=="/&"||n++}e=e.previousSibling}return null}function gg(e,n,a){switch(n=kl(a),e){case"html":if(e=n.documentElement,!e)throw Error(s(452));return e;case"head":if(e=n.head,!e)throw Error(s(453));return e;case"body":if(e=n.body,!e)throw Error(s(454));return e;default:throw Error(s(451))}}function La(e){for(var n=e.attributes;n.length;)e.removeAttributeNode(n[0]);Ji(e)}var Tn=new Map,yg=new Set;function Cl(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var xr=ae.d;ae.d={f:C_,r:M_,D:R_,C:D_,L:q_,m:B_,X:z_,S:L_,M:U_};function C_(){var e=xr.f(),n=wl();return e||n}function M_(e){var n=N(e);n!==null&&n.tag===5&&n.type==="form"?D0(n):xr.r(e)}var As=typeof document>"u"?null:document;function bg(e,n,a){var o=As;if(o&&typeof n=="string"&&n){var u=xn(n);u='link[rel="'+e+'"][href="'+u+'"]',typeof a=="string"&&(u+='[crossorigin="'+a+'"]'),yg.has(u)||(yg.add(u),e={rel:e,crossOrigin:a,href:n},o.querySelector(u)===null&&(n=o.createElement("link"),Mt(n,"link",e),D(n),o.head.appendChild(n)))}}function R_(e){xr.D(e),bg("dns-prefetch",e,null)}function D_(e,n){xr.C(e,n),bg("preconnect",e,n)}function q_(e,n,a){xr.L(e,n,a);var o=As;if(o&&e&&n){var u='link[rel="preload"][as="'+xn(n)+'"]';n==="image"&&a&&a.imageSrcSet?(u+='[imagesrcset="'+xn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(u+='[imagesizes="'+xn(a.imageSizes)+'"]')):u+='[href="'+xn(e)+'"]';var h=u;switch(n){case"style":h=js(e);break;case"script":h=Ts(e)}Tn.has(h)||(e=b({rel:"preload",href:n==="image"&&a&&a.imageSrcSet?void 0:e,as:n},a),Tn.set(h,e),o.querySelector(u)!==null||n==="style"&&o.querySelector(za(h))||n==="script"&&o.querySelector(Ua(h))||(n=o.createElement("link"),Mt(n,"link",e),D(n),o.head.appendChild(n)))}}function B_(e,n){xr.m(e,n);var a=As;if(a&&e){var o=n&&typeof n.as=="string"?n.as:"script",u='link[rel="modulepreload"][as="'+xn(o)+'"][href="'+xn(e)+'"]',h=u;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":h=Ts(e)}if(!Tn.has(h)&&(e=b({rel:"modulepreload",href:e},n),Tn.set(h,e),a.querySelector(u)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Ua(h)))return}o=a.createElement("link"),Mt(o,"link",e),D(o),a.head.appendChild(o)}}}function L_(e,n,a){xr.S(e,n,a);var o=As;if(o&&e){var u=k(o).hoistableStyles,h=js(e);n=n||"default";var x=u.get(h);if(!x){var E={loading:0,preload:null};if(x=o.querySelector(za(h)))E.loading=5;else{e=b({rel:"stylesheet",href:e,"data-precedence":n},a),(a=Tn.get(h))&&_h(e,a);var R=x=o.createElement("link");D(R),Mt(R,"link",e),R._p=new Promise(function(H,J){R.onload=H,R.onerror=J}),R.addEventListener("load",function(){E.loading|=1}),R.addEventListener("error",function(){E.loading|=2}),E.loading|=4,Ml(x,n,o)}x={type:"stylesheet",instance:x,count:1,state:E},u.set(h,x)}}}function z_(e,n){xr.X(e,n);var a=As;if(a&&e){var o=k(a).hoistableScripts,u=Ts(e),h=o.get(u);h||(h=a.querySelector(Ua(u)),h||(e=b({src:e,async:!0},n),(n=Tn.get(u))&&wh(e,n),h=a.createElement("script"),D(h),Mt(h,"link",e),a.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},o.set(u,h))}}function U_(e,n){xr.M(e,n);var a=As;if(a&&e){var o=k(a).hoistableScripts,u=Ts(e),h=o.get(u);h||(h=a.querySelector(Ua(u)),h||(e=b({src:e,async:!0,type:"module"},n),(n=Tn.get(u))&&wh(e,n),h=a.createElement("script"),D(h),Mt(h,"link",e),a.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},o.set(u,h))}}function vg(e,n,a,o){var u=(u=Gt.current)?Cl(u):null;if(!u)throw Error(s(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(n=js(a.href),a=k(u).hoistableStyles,o=a.get(n),o||(o={type:"style",instance:null,count:0,state:null},a.set(n,o)),o):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=js(a.href);var h=k(u).hoistableStyles,x=h.get(e);if(x||(u=u.ownerDocument||u,x={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},h.set(e,x),(h=u.querySelector(za(e)))&&!h._p&&(x.instance=h,x.state.loading=5),Tn.has(e)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},Tn.set(e,a),h||P_(u,e,a,x.state))),n&&o===null)throw Error(s(528,""));return x}if(n&&o!==null)throw Error(s(529,""));return null;case"script":return n=a.async,a=a.src,typeof a=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=Ts(a),a=k(u).hoistableScripts,o=a.get(n),o||(o={type:"script",instance:null,count:0,state:null},a.set(n,o)),o):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,e))}}function js(e){return'href="'+xn(e)+'"'}function za(e){return'link[rel="stylesheet"]['+e+"]"}function xg(e){return b({},e,{"data-precedence":e.precedence,precedence:null})}function P_(e,n,a,o){e.querySelector('link[rel="preload"][as="style"]['+n+"]")?o.loading=1:(n=e.createElement("link"),o.preload=n,n.addEventListener("load",function(){return o.loading|=1}),n.addEventListener("error",function(){return o.loading|=2}),Mt(n,"link",a),D(n),e.head.appendChild(n))}function Ts(e){return'[src="'+xn(e)+'"]'}function Ua(e){return"script[async]"+e}function _g(e,n,a){if(n.count++,n.instance===null)switch(n.type){case"style":var o=e.querySelector('style[data-href~="'+xn(a.href)+'"]');if(o)return n.instance=o,D(o),o;var u=b({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return o=(e.ownerDocument||e).createElement("style"),D(o),Mt(o,"style",u),Ml(o,a.precedence,e),n.instance=o;case"stylesheet":u=js(a.href);var h=e.querySelector(za(u));if(h)return n.state.loading|=4,n.instance=h,D(h),h;o=xg(a),(u=Tn.get(u))&&_h(o,u),h=(e.ownerDocument||e).createElement("link"),D(h);var x=h;return x._p=new Promise(function(E,R){x.onload=E,x.onerror=R}),Mt(h,"link",o),n.state.loading|=4,Ml(h,a.precedence,e),n.instance=h;case"script":return h=Ts(a.src),(u=e.querySelector(Ua(h)))?(n.instance=u,D(u),u):(o=a,(u=Tn.get(h))&&(o=b({},a),wh(o,u)),e=e.ownerDocument||e,u=e.createElement("script"),D(u),Mt(u,"link",o),e.head.appendChild(u),n.instance=u);case"void":return null;default:throw Error(s(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(o=n.instance,n.state.loading|=4,Ml(o,a.precedence,e));return n.instance}function Ml(e,n,a){for(var o=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=o.length?o[o.length-1]:null,h=u,x=0;x<o.length;x++){var E=o[x];if(E.dataset.precedence===n)h=E;else if(h!==u)break}h?h.parentNode.insertBefore(e,h.nextSibling):(n=a.nodeType===9?a.head:a,n.insertBefore(e,n.firstChild))}function _h(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.title==null&&(e.title=n.title)}function wh(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.integrity==null&&(e.integrity=n.integrity)}var Rl=null;function wg(e,n,a){if(Rl===null){var o=new Map,u=Rl=new Map;u.set(a,o)}else u=Rl,o=u.get(a),o||(o=new Map,u.set(a,o));if(o.has(e))return o;for(o.set(e,null),a=a.getElementsByTagName(e),u=0;u<a.length;u++){var h=a[u];if(!(h[wt]||h[Qe]||e==="link"&&h.getAttribute("rel")==="stylesheet")&&h.namespaceURI!=="http://www.w3.org/2000/svg"){var x=h.getAttribute(n)||"";x=e+x;var E=o.get(x);E?E.push(h):o.set(x,[h])}}return o}function Sg(e,n,a){e=e.ownerDocument||e,e.head.insertBefore(a,n==="title"?e.querySelector("head > title"):null)}function I_(e,n,a){if(a===1||n.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;switch(n.rel){case"stylesheet":return e=n.disabled,typeof n.precedence=="string"&&e==null;default:return!0}case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function Eg(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function $_(e,n,a,o){if(a.type==="stylesheet"&&(typeof o.media!="string"||matchMedia(o.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var u=js(o.href),h=n.querySelector(za(u));if(h){n=h._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=Dl.bind(e),n.then(e,e)),a.state.loading|=4,a.instance=h,D(h);return}h=n.ownerDocument||n,o=xg(o),(u=Tn.get(u))&&_h(o,u),h=h.createElement("link"),D(h);var x=h;x._p=new Promise(function(E,R){x.onload=E,x.onerror=R}),Mt(h,"link",o),a.instance=h}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,n),(n=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=Dl.bind(e),n.addEventListener("load",a),n.addEventListener("error",a))}}var Sh=0;function H_(e,n){return e.stylesheets&&e.count===0&&Bl(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var o=setTimeout(function(){if(e.stylesheets&&Bl(e,e.stylesheets),e.unsuspend){var h=e.unsuspend;e.unsuspend=null,h()}},6e4+n);0<e.imgBytes&&Sh===0&&(Sh=62500*S_());var u=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Bl(e,e.stylesheets),e.unsuspend)){var h=e.unsuspend;e.unsuspend=null,h()}},(e.imgBytes>Sh?50:800)+n);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(o),clearTimeout(u)}}:null}function Dl(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Bl(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var ql=null;function Bl(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ql=new Map,n.forEach(G_,e),ql=null,Dl.call(e))}function G_(e,n){if(!(n.state.loading&4)){var a=ql.get(e);if(a)var o=a.get(null);else{a=new Map,ql.set(e,a);for(var u=e.querySelectorAll("link[data-precedence],style[data-precedence]"),h=0;h<u.length;h++){var x=u[h];(x.nodeName==="LINK"||x.getAttribute("media")!=="not all")&&(a.set(x.dataset.precedence,x),o=x)}o&&a.set(null,o)}u=n.instance,x=u.getAttribute("data-precedence"),h=a.get(x)||o,h===o&&a.set(null,u),a.set(x,u),this.count++,o=Dl.bind(this),u.addEventListener("load",o),u.addEventListener("error",o),h?h.parentNode.insertBefore(u,h.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(u,e.firstChild)),n.state.loading|=4}}var Pa={$$typeof:ie,Provider:null,Consumer:null,_currentValue:de,_currentValue2:de,_threadCount:0};function F_(e,n,a,o,u,h,x,E,R){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Nr(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Nr(0),this.hiddenUpdates=Nr(null),this.identifierPrefix=o,this.onUncaughtError=u,this.onCaughtError=h,this.onRecoverableError=x,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=R,this.incompleteTransitions=new Map}function Og(e,n,a,o,u,h,x,E,R,H,J,ne){return e=new F_(e,n,a,x,R,H,J,ne,E),n=1,h===!0&&(n|=24),h=en(3,null,null,n),e.current=h,h.stateNode=e,n=tf(),n.refCount++,e.pooledCache=n,n.refCount++,h.memoizedState={element:o,isDehydrated:a,cache:n},af(h),e}function Ag(e){return e?(e=ss,e):ss}function jg(e,n,a,o,u,h){u=Ag(u),o.context===null?o.context=u:o.pendingContext=u,o=Ur(n),o.payload={element:a},h=h===void 0?null:h,h!==null&&(o.callback=h),a=Pr(e,o,n),a!==null&&(Jt(a,e,n),ba(a,e,n))}function Tg(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<n?a:n}}function Eh(e,n){Tg(e,n),(e=e.alternate)&&Tg(e,n)}function Ng(e){if(e.tag===13||e.tag===31){var n=Ei(e,67108864);n!==null&&Jt(n,e,67108864),Eh(e,67108864)}}function kg(e){if(e.tag===13||e.tag===31){var n=an();n=nr(n);var a=Ei(e,n);a!==null&&Jt(a,e,n),Eh(e,n)}}var Ll=!0;function V_(e,n,a,o){var u=Y.T;Y.T=null;var h=ae.p;try{ae.p=2,Oh(e,n,a,o)}finally{ae.p=h,Y.T=u}}function Y_(e,n,a,o){var u=Y.T;Y.T=null;var h=ae.p;try{ae.p=8,Oh(e,n,a,o)}finally{ae.p=h,Y.T=u}}function Oh(e,n,a,o){if(Ll){var u=Ah(o);if(u===null)fh(e,n,o,zl,a),Mg(e,o);else if(X_(u,e,n,a,o))o.stopPropagation();else if(Mg(e,o),n&4&&-1<K_.indexOf(e)){for(;u!==null;){var h=N(u);if(h!==null)switch(h.tag){case 3:if(h=h.stateNode,h.current.memoizedState.isDehydrated){var x=Mn(h.pendingLanes);if(x!==0){var E=h;for(E.pendingLanes|=2,E.entangledLanes|=2;x;){var R=1<<31-Bt(x);E.entanglements[1]|=R,x&=~R}Kn(h),(Ge&6)===0&&(xl=nt()+500,Da(0))}}break;case 31:case 13:E=Ei(h,2),E!==null&&Jt(E,h,2),wl(),Eh(h,2)}if(h=Ah(o),h===null&&fh(e,n,o,zl,a),h===u)break;u=h}u!==null&&o.stopPropagation()}else fh(e,n,o,null,a)}}function Ah(e){return e=ju(e),jh(e)}var zl=null;function jh(e){if(zl=null,e=O(e),e!==null){var n=c(e);if(n===null)e=null;else{var a=n.tag;if(a===13){if(e=d(n),e!==null)return e;e=null}else if(a===31){if(e=p(n),e!==null)return e;e=null}else if(a===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;e=null}else n!==e&&(e=null)}}return zl=e,null}function Cg(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(vu()){case jo:return 2;case To:return 8;case Yi:case xu:return 32;case No:return 268435456;default:return 32}default:return 32}}var Th=!1,Qr=null,Zr=null,Wr=null,Ia=new Map,$a=new Map,ei=[],K_="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Mg(e,n){switch(e){case"focusin":case"focusout":Qr=null;break;case"dragenter":case"dragleave":Zr=null;break;case"mouseover":case"mouseout":Wr=null;break;case"pointerover":case"pointerout":Ia.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":$a.delete(n.pointerId)}}function Ha(e,n,a,o,u,h){return e===null||e.nativeEvent!==h?(e={blockedOn:n,domEventName:a,eventSystemFlags:o,nativeEvent:h,targetContainers:[u]},n!==null&&(n=N(n),n!==null&&Ng(n)),e):(e.eventSystemFlags|=o,n=e.targetContainers,u!==null&&n.indexOf(u)===-1&&n.push(u),e)}function X_(e,n,a,o,u){switch(n){case"focusin":return Qr=Ha(Qr,e,n,a,o,u),!0;case"dragenter":return Zr=Ha(Zr,e,n,a,o,u),!0;case"mouseover":return Wr=Ha(Wr,e,n,a,o,u),!0;case"pointerover":var h=u.pointerId;return Ia.set(h,Ha(Ia.get(h)||null,e,n,a,o,u)),!0;case"gotpointercapture":return h=u.pointerId,$a.set(h,Ha($a.get(h)||null,e,n,a,o,u)),!0}return!1}function Rg(e){var n=O(e.target);if(n!==null){var a=c(n);if(a!==null){if(n=a.tag,n===13){if(n=d(a),n!==null){e.blockedOn=n,Co(e.priority,function(){kg(a)});return}}else if(n===31){if(n=p(a),n!==null){e.blockedOn=n,Co(e.priority,function(){kg(a)});return}}else if(n===3&&a.stateNode.current.memoizedState.isDehydrated){e.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Ul(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var a=Ah(e.nativeEvent);if(a===null){a=e.nativeEvent;var o=new a.constructor(a.type,a);Au=o,a.target.dispatchEvent(o),Au=null}else return n=N(a),n!==null&&Ng(n),e.blockedOn=a,!1;n.shift()}return!0}function Dg(e,n,a){Ul(e)&&a.delete(n)}function J_(){Th=!1,Qr!==null&&Ul(Qr)&&(Qr=null),Zr!==null&&Ul(Zr)&&(Zr=null),Wr!==null&&Ul(Wr)&&(Wr=null),Ia.forEach(Dg),$a.forEach(Dg)}function Pl(e,n){e.blockedOn===n&&(e.blockedOn=null,Th||(Th=!0,i.unstable_scheduleCallback(i.unstable_NormalPriority,J_)))}var Il=null;function qg(e){Il!==e&&(Il=e,i.unstable_scheduleCallback(i.unstable_NormalPriority,function(){Il===e&&(Il=null);for(var n=0;n<e.length;n+=3){var a=e[n],o=e[n+1],u=e[n+2];if(typeof o!="function"){if(jh(o||a)===null)continue;break}var h=N(a);h!==null&&(e.splice(n,3),n-=3,Af(h,{pending:!0,data:u,method:a.method,action:o},o,u))}}))}function Ns(e){function n(R){return Pl(R,e)}Qr!==null&&Pl(Qr,e),Zr!==null&&Pl(Zr,e),Wr!==null&&Pl(Wr,e),Ia.forEach(n),$a.forEach(n);for(var a=0;a<ei.length;a++){var o=ei[a];o.blockedOn===e&&(o.blockedOn=null)}for(;0<ei.length&&(a=ei[0],a.blockedOn===null);)Rg(a),a.blockedOn===null&&ei.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(o=0;o<a.length;o+=3){var u=a[o],h=a[o+1],x=u[ot]||null;if(typeof h=="function")x||qg(a);else if(x){var E=null;if(h&&h.hasAttribute("formAction")){if(u=h,x=h[ot]||null)E=x.formAction;else if(jh(u)!==null)continue}else E=x.action;typeof E=="function"?a[o+1]=E:(a.splice(o,3),o-=3),qg(a)}}}function Bg(){function e(h){h.canIntercept&&h.info==="react-transition"&&h.intercept({handler:function(){return new Promise(function(x){return u=x})},focusReset:"manual",scroll:"manual"})}function n(){u!==null&&(u(),u=null),o||setTimeout(a,20)}function a(){if(!o&&!navigation.transition){var h=navigation.currentEntry;h&&h.url!=null&&navigation.navigate(h.url,{state:h.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var o=!1,u=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(a,100),function(){o=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),u!==null&&(u(),u=null)}}}function Nh(e){this._internalRoot=e}$l.prototype.render=Nh.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(s(409));var a=n.current,o=an();jg(a,o,e,n,null,null)},$l.prototype.unmount=Nh.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;jg(e.current,2,null,e,null,null),wl(),n[Zt]=null}};function $l(e){this._internalRoot=e}$l.prototype.unstable_scheduleHydration=function(e){if(e){var n=ta();e={blockedOn:null,target:e,priority:n};for(var a=0;a<ei.length&&n!==0&&n<ei[a].priority;a++);ei.splice(a,0,e),a===0&&Rg(e)}};var Lg=t.version;if(Lg!=="19.2.4")throw Error(s(527,Lg,"19.2.4"));ae.findDOMNode=function(e){var n=e._reactInternals;if(n===void 0)throw typeof e.render=="function"?Error(s(188)):(e=Object.keys(e).join(","),Error(s(268,e)));return e=f(n),e=e!==null?m(e):null,e=e===null?null:e.stateNode,e};var Q_={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:Y,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Hl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Hl.isDisabled&&Hl.supportsFiber)try{pi=Hl.inject(Q_),dt=Hl}catch{}}return Ga.createRoot=function(e,n){if(!l(e))throw Error(s(299));var a=!1,o="",u=G0,h=F0,x=V0;return n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onUncaughtError!==void 0&&(u=n.onUncaughtError),n.onCaughtError!==void 0&&(h=n.onCaughtError),n.onRecoverableError!==void 0&&(x=n.onRecoverableError)),n=Og(e,1,!1,null,null,a,o,null,u,h,x,Bg),e[Zt]=n.current,uh(e),new Nh(n)},Ga.hydrateRoot=function(e,n,a){if(!l(e))throw Error(s(299));var o=!1,u="",h=G0,x=F0,E=V0,R=null;return a!=null&&(a.unstable_strictMode===!0&&(o=!0),a.identifierPrefix!==void 0&&(u=a.identifierPrefix),a.onUncaughtError!==void 0&&(h=a.onUncaughtError),a.onCaughtError!==void 0&&(x=a.onCaughtError),a.onRecoverableError!==void 0&&(E=a.onRecoverableError),a.formState!==void 0&&(R=a.formState)),n=Og(e,1,!0,n,a??null,o,u,R,h,x,E,Bg),n.context=Ag(null),a=n.current,o=an(),o=nr(o),u=Ur(o),u.callback=null,Pr(a,u,o),a=o,n.current.lanes=a,Rn(n,a),Kn(n),e[Zt]=n.current,uh(e),new $l(n)},Ga.version="19.2.4",Ga}var Fg;function zw(){if(Fg)return kh.exports;Fg=1;function i(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(t){console.error(t)}}return i(),kh.exports=Lw(),kh.exports}var Uw=zw();const Pw="modulepreload",Iw=function(i,t){return new URL(i,t).href},Vg={},we=function(t,r,s){let l=Promise.resolve();if(r&&r.length>0){let d=function(m){return Promise.all(m.map(b=>Promise.resolve(b).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};const p=document.getElementsByTagName("link"),y=document.querySelector("meta[property=csp-nonce]"),f=(y==null?void 0:y.nonce)||(y==null?void 0:y.getAttribute("nonce"));l=d(r.map(m=>{if(m=Iw(m,s),m in Vg)return;Vg[m]=!0;const b=m.endsWith(".css"),v=b?'[rel="stylesheet"]':"";if(!!s)for(let S=p.length-1;S>=0;S--){const M=p[S];if(M.href===m&&(!b||M.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${m}"]${v}`))return;const w=document.createElement("link");if(w.rel=b?"stylesheet":Pw,b||(w.as="script"),w.crossOrigin="",w.href=m,f&&w.setAttribute("nonce",f),document.head.appendChild(w),b)return new Promise((S,M)=>{w.addEventListener("load",S),w.addEventListener("error",()=>M(new Error(`Unable to preload CSS for ${m}`)))})}))}function c(d){const p=new Event("vite:preloadError",{cancelable:!0});if(p.payload=d,window.dispatchEvent(p),!p.defaultPrevented)throw d}return l.then(d=>{for(const p of d||[])p.status==="rejected"&&c(p.reason);return t().catch(c)})};function lu(i){try{const t=i.split(".");if(t.length!==3)return null;const r=atob(t[1].replace(/-/g,"+").replace(/_/g,"/"));return JSON.parse(r)}catch{return null}}function db(i){const t=lu(i);return!t||typeof t.exp!="number"?null:t.exp}function Od(i,t=0){const r=db(i);return r===null?!0:Date.now()/1e3>=r-t}const jt=window.__LT_BASE__??"",Qh=`${jt}/api`;class Yg extends Error{constructor(t,r,s){super(t),this.status=r,this.body=s,this.name="ApiError"}}let si=null;function Gl(i){si=i}function mb(){return si}const $w="X-LT-Acting-Token";let Uc=null,Pc=null;function Kg(i){Uc=i}function Xg(i){Pc=i}function Hw(i){const t=i==null?void 0:i.error;return typeof t=="string"&&/acting[- ]identity/i.test(t)}async function Jg(){const i=sessionStorage.getItem("lt_credentials");if(!i)return null;try{const{username:t,password:r}=JSON.parse(i),s=await fetch(`${Qh}/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:t,password:r})});if(!s.ok)return null;const l=await s.json();return l.token&&l.user&&sessionStorage.setItem("lt_user_info",JSON.stringify({displayName:l.user.display_name,username:l.user.external_id})),l.token??null}catch{return null}}let ni=null;async function Oe(i,t={}){const r={"Content-Type":"application/json",...t.headers};if(si){if(Od(si)){ni||(ni=Jg().finally(()=>{ni=null}));const c=await ni;if(c)si=c,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:c}}));else throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}r.Authorization=`Bearer ${si}`}const s=(Uc==null?void 0:Uc())??null;s&&(r[$w]=s);let l=await fetch(`${Qh}${i}`,{...t,headers:r});if(l.status===401&&s){const c=await l.clone().json().catch(()=>null);if(Hw(c))throw Pc==null||Pc(),new Yg(c.error,401,c)}if(l.status===401&&si){ni||(ni=Jg().finally(()=>{ni=null}));const c=await ni;if(c&&(si=c,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:c}})),r.Authorization=`Bearer ${c}`,l=await fetch(`${Qh}${i}`,{...t,headers:r})),l.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}else if(l.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired");if(!l.ok){const c=await l.json().catch(()=>({error:l.statusText}));throw new Yg(c.message||c.error||l.statusText,l.status,c)}return l.json()}const Gw="lt_ai_override";function Fw(){return Oe("/settings")}function Vw(){try{if(localStorage.getItem(Gw)==="off")return!1}catch{}return null}function Wn(){var r;const i=ft({queryKey:["settings"],queryFn:Fw,staleTime:1/0}),t=Vw();return i.data&&t===!1&&((r=i.data.ai)!=null&&r.enabled)?{...i,data:{...i.data,ai:{enabled:!1}}}:i}function Yw(i){var f,m,b;const{data:t}=Wn(),r=((f=t==null?void 0:t.auth)==null?void 0:f.ssoKeepaliveSeconds)??0,s=((m=t==null?void 0:t.auth)==null?void 0:m.ssoKeepaliveIdleTimeoutSeconds)??0,l=j.useRef(Date.now()),c=j.useRef(Date.now()),d=j.useRef(!1),y=!!i&&((b=lu(i))==null?void 0:b.sso)===!0&&r>0;j.useEffect(()=>{if(!y)return;const v=()=>{l.current=Date.now()};window.addEventListener("pointerdown",v,{passive:!0}),window.addEventListener("keydown",v,{passive:!0}),window.addEventListener("wheel",v,{passive:!0});const _=async()=>{if(!d.current&&document.visibilityState==="visible"&&!(s>0&&Date.now()-l.current>s*1e3)){d.current=!0;try{const M=await fetch(`${jt}/api/auth/sso`,{method:"POST"});if(M.status===401||M.status===403){window.dispatchEvent(new CustomEvent("auth:unauthorized"));return}if(!M.ok)return;const B=await M.json().catch(()=>null);B!=null&&B.token&&(c.current=Date.now(),window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:B.token}})))}catch{}finally{d.current=!1}}},w=setInterval(_,r*1e3),S=()=>{document.visibilityState==="visible"&&Date.now()-c.current>r*1e3&&_()};return document.addEventListener("visibilitychange",S),()=>{clearInterval(w),document.removeEventListener("visibilitychange",S),window.removeEventListener("pointerdown",v),window.removeEventListener("keydown",v),window.removeEventListener("wheel",v)}},[y,r,s])}const pb=j.createContext(null),Kw=300;function Rh(i,t){if(Od(i))return null;const r=lu(i);if(!r)return null;const s=t??(()=>{try{const l=sessionStorage.getItem("lt_user_info");return l?JSON.parse(l):null}catch{return null}})();return{userId:r.userId,displayName:(s==null?void 0:s.displayName)??null,username:(s==null?void 0:s.username)??null,roles:r.roles??[]}}function Xw({children:i}){const[t,r]=j.useState(()=>{const b=sessionStorage.getItem("lt_token");return b?Od(b)?(sessionStorage.removeItem("lt_token"),null):(Gl(b),Rh(b)):null}),s=j.useRef(void 0),l=j.useCallback(b=>{clearTimeout(s.current);const v=db(b);if(!v)return;const _=(v-Kw)*1e3-Date.now();_<=0||(s.current=setTimeout(async()=>{try{const w=lu(b);if(w!=null&&w.sso){const ce=await fetch(`${jt}/api/auth/sso`,{method:"POST"});if(!ce.ok)return;const C=await ce.json();C.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:C.token}}));return}const S=sessionStorage.getItem("lt_credentials");if(!S)return;const{username:M,password:B}=JSON.parse(S),U=await fetch(`${jt}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:M,password:B})});if(!U.ok)return;const ie=await U.json();ie.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:ie.token}}))}catch{}},_))},[]),c=j.useCallback((b,v,_)=>{const w={displayName:(_==null?void 0:_.displayName)??null,username:(_==null?void 0:_.username)??(v==null?void 0:v.username)??null},S=Rh(b,w);S&&(Gl(b),sessionStorage.setItem("lt_token",b),sessionStorage.setItem("lt_user_info",JSON.stringify(w)),v&&sessionStorage.setItem("lt_credentials",JSON.stringify(v)),r(S),l(b))},[l]),d=j.useCallback(()=>{clearTimeout(s.current);const b=sessionStorage.getItem("lt_sso_logout_url");Gl(null),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info"),sessionStorage.removeItem("lt_sso_logout_url"),r(null),b&&(window.location.href=b)},[]);j.useEffect(()=>{const b=()=>d(),v=_=>{var M;const w=(M=_.detail)==null?void 0:M.token;if(!w)return;const S=Rh(w);S&&(Gl(w),sessionStorage.setItem("lt_token",w),r(S),l(w))};return window.addEventListener("auth:unauthorized",b),window.addEventListener("auth:refreshed",v),()=>{window.removeEventListener("auth:unauthorized",b),window.removeEventListener("auth:refreshed",v)}},[d,l]),j.useEffect(()=>{const b=sessionStorage.getItem("lt_token");return b&&t&&l(b),()=>clearTimeout(s.current)},[]);const p=(t==null?void 0:t.roles.some(b=>b.type==="superadmin"))??!1,y=j.useCallback(b=>(t==null?void 0:t.roles.some(v=>v.role===b))??!1,[t]),f=j.useCallback(b=>(t==null?void 0:t.roles.some(v=>v.type===b))??!1,[t]),m=(t==null?void 0:t.roles.map(b=>b.role))??[];return g.jsxs(pb.Provider,{value:{user:t,isAuthenticated:!!t,isSuperAdmin:p,login:c,logout:d,hasRole:y,hasRoleType:f,userRoleNames:m},children:[g.jsx(Jw,{authenticated:t!==null}),i]})}function Jw({authenticated:i}){return Yw(i?sessionStorage.getItem("lt_token"):null),null}function Ht(){const i=j.useContext(pb);if(!i)throw new Error("useAuth must be used within AuthProvider");return i}const mn=new Uint8Array(0),Hi=new TextEncoder,fn=new TextDecoder;function Qw(...i){let t=0;for(let l=0;l<i.length;l++)t+=i[l].length;const r=new Uint8Array(t);let s=0;for(let l=0;l<i.length;l++)r.set(i[l],s),s+=i[l].length;return r}function so(...i){const t=[];for(let r=0;r<i.length;r++)t.push(Hi.encode(i[r]));return t.length===0?mn:t.length===1?t[0]:Qw(...t)}function Qg(i){return!i||i.length===0?"":fn.decode(i)}const Zg="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",Wg=36,Zw=0xcfd41b9100000,ey=33,Ww=333,ty=22;function eS(i){for(let t=0;t<i.length;t++)i[t]=Math.floor(Math.random()*255)}function tS(i){var t;(t=globalThis==null?void 0:globalThis.crypto)!=null&&t.getRandomValues?globalThis.crypto.getRandomValues(i):eS(i)}class nS{constructor(){A(this,"buf");A(this,"seq");A(this,"inc");A(this,"inited");this.buf=new Uint8Array(ty),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(Math.random()*Zw),this.inc=Math.floor(Math.random()*(Ww-ey)+ey)}setPre(){const t=new Uint8Array(12);tS(t);for(let r=0;r<12;r++){const s=t[r]%36;this.buf[r]=Zg.charCodeAt(s)}}fillSeq(){let t=this.seq;for(let r=ty-1;r>=12;r--)this.buf[r]=Zg.charCodeAt(t%Wg),t=Math.floor(t/Wg)}next(){return this.inited||this.init(),this.seq+=this.inc,this.seq>0xcfd41b9100000&&(this.setPre(),this.initSeqAndInc()),this.fillSeq(),String.fromCharCode.apply(String,this.buf)}reset(){this.init()}}const fi=new nS;var wr;(function(i){i.Disconnect="disconnect",i.Reconnect="reconnect",i.Update="update",i.LDM="ldm",i.Error="error"})(wr||(wr={}));var zs;(function(i){i.Reconnecting="reconnecting",i.PingTimer="pingTimer",i.StaleConnection="staleConnection",i.ClientInitiatedReconnect="client initiated reconnect"})(zs||(zs={}));var le;(function(i){i.ApiError="BAD API",i.BadAuthentication="BAD_AUTHENTICATION",i.BadCreds="BAD_CREDS",i.BadHeader="BAD_HEADER",i.BadJson="BAD_JSON",i.BadPayload="BAD_PAYLOAD",i.BadSubject="BAD_SUBJECT",i.Cancelled="CANCELLED",i.ConnectionClosed="CONNECTION_CLOSED",i.ConnectionDraining="CONNECTION_DRAINING",i.ConnectionRefused="CONNECTION_REFUSED",i.ConnectionTimeout="CONNECTION_TIMEOUT",i.Disconnect="DISCONNECT",i.InvalidOption="INVALID_OPTION",i.InvalidPayload="INVALID_PAYLOAD",i.MaxPayloadExceeded="MAX_PAYLOAD_EXCEEDED",i.NoResponders="503",i.NotFunction="NOT_FUNC",i.RequestError="REQUEST_ERROR",i.ServerOptionNotAvailable="SERVER_OPT_NA",i.SubClosed="SUB_CLOSED",i.SubDraining="SUB_DRAINING",i.Timeout="TIMEOUT",i.Tls="TLS",i.Unknown="UNKNOWN_ERROR",i.WssRequired="WSS_REQUIRED",i.JetStreamInvalidAck="JESTREAM_INVALID_ACK",i.JetStream404NoMessages="404",i.JetStream408RequestTimeout="408",i.JetStream409MaxAckPendingExceeded="409",i.JetStream409="409",i.JetStreamNotEnabled="503",i.JetStreamIdleHeartBeat="IDLE_HEARTBEAT",i.AuthorizationViolation="AUTHORIZATION_VIOLATION",i.AuthenticationExpired="AUTHENTICATION_EXPIRED",i.ProtocolError="NATS_PROTOCOL_ERR",i.PermissionsViolation="PERMISSIONS_VIOLATION",i.AuthenticationTimeout="AUTHENTICATION_TIMEOUT",i.AccountExpired="ACCOUNT_EXPIRED"})(le||(le={}));function rS(i){return typeof i.code=="string"}class gb{constructor(){A(this,"messages");this.messages=new Map,this.messages.set(le.InvalidPayload,"Invalid payload type - payloads can be 'binary', 'string', or 'json'"),this.messages.set(le.BadJson,"Bad JSON"),this.messages.set(le.WssRequired,"TLS is required, therefore a secure websocket connection is also required")}static getMessage(t){return iS.getMessage(t)}getMessage(t){return this.messages.get(t)||t}}const iS=new gb;class me extends Error{constructor(r,s,l){super(r);A(this,"name");A(this,"message");A(this,"code");A(this,"permissionContext");A(this,"chainedError");A(this,"api_error");this.name="NatsError",this.message=r,this.code=s,this.chainedError=l}static errorForCode(r,s){const l=gb.getMessage(r);return new me(l,r,s)}isAuthError(){return this.code===le.AuthenticationExpired||this.code===le.AuthorizationViolation||this.code===le.AccountExpired}isAuthTimeout(){return this.code===le.AuthenticationTimeout}isPermissionError(){return this.code===le.PermissionsViolation}isProtocolError(){return this.code===le.ProtocolError}isJetStreamError(){return this.api_error!==void 0}jsError(){return this.api_error?this.api_error:null}}var cn;(function(i){i[i.Exact=0]="Exact",i[i.CanonicalMIME=1]="CanonicalMIME",i[i.IgnoreCase=2]="IgnoreCase"})(cn||(cn={}));var $n;(function(i){i.Timer="timer",i.Count="count",i.JitterTimer="jitterTimer",i.SentinelMsg="sentinelMsg"})($n||($n={}));var ao;(function(i){i.STATS="io.nats.micro.v1.stats_response",i.INFO="io.nats.micro.v1.info_response",i.PING="io.nats.micro.v1.ping_response"})(ao||(ao={}));const Kc="Nats-Service-Error",Xc="Nats-Service-Error-Code";class Jc extends Error{constructor(r,s){super(s);A(this,"code");this.code=r}static isServiceError(r){return Jc.toServiceError(r)!==null}static toServiceError(r){var l,c;const s=((l=r==null?void 0:r.headers)==null?void 0:l.get(Xc))||"";if(s!==""){const d=parseInt(s)||400,p=((c=r==null?void 0:r.headers)==null?void 0:c.get(Kc))||"";return new Jc(d,p.length?p:s)}return null}}function Sr(i=""){if(i=i||"_INBOX",typeof i!="string")throw new Error("prefix must be a string");return i.split(".").forEach(t=>{if(t==="*"||t===">")throw new Error(`inbox prefixes cannot have wildcards '${i}'`)}),`${i}.${fi.next()}`}const Zh="127.0.0.1";var ai;(function(i){i.PING="PING",i.STATS="STATS",i.INFO="INFO"})(ai||(ai={}));function cu(i,...t){for(let r=0;r<t.length;r++){const s=t[r];Object.keys(s).forEach(function(l){i[l]=s[l]})}return i}function Fl(i){return fn.decode(i).replace(/\n/g,"␊").replace(/\r/g,"␍")}function Gs(i,t=!0){const r=t?me.errorForCode(le.Timeout):null;let s,l;const c=new Promise((d,p)=>{s={cancel:()=>{l&&clearTimeout(l)}},l=setTimeout(()=>{p(r===null?me.errorForCode(le.Timeout):r)},i)});return Object.assign(c,s)}function Ys(i=0){let t;const r=new Promise(s=>{const l=setTimeout(()=>{s()},i);t={cancel:()=>{l&&clearTimeout(l)}}});return Object.assign(r,t)}function st(){let i={};const t=new Promise((r,s)=>{i={resolve:r,reject:s}});return Object.assign(t,i)}function yb(i){for(let t=i.length-1;t>0;t--){const r=Math.floor(Math.random()*(t+1));[i[t],i[r]]=[i[r],i[t]]}return i}function sS(i){return i===0?0:Math.floor(i/2+Math.random()*i)}function Ad(i=[0,250,250,500,500,3e3,5e3]){Array.isArray(i)||(i=[0,250,250,500,500,3e3,5e3]);const t=i.length-1;return{backoff(r){return sS(r>t?i[t]:i[r])}}}function it(i){return i*1e6}function jd(i){return Math.floor(i/1e6)}function ny(i){let s=!0;const l=new Array(i.length);for(let c=0;c<i.length;c++){let d=i.charCodeAt(c);if(d===58||d<33||d>126)throw new me(`'${i[c]}' is not a valid character for a header key`,le.BadHeader);s&&97<=d&&d<=122?d-=32:!s&&65<=d&&d<=90&&(d+=32),l[c]=d,s=d==45}return String.fromCharCode(...l)}function Er(i=0,t=""){if(i===0&&t!==""||i>0&&t==="")throw new Error("setting status requires both code and description");return new oi(i,t)}const Dh="NATS/1.0";class oi{constructor(t=0,r=""){A(this,"_code");A(this,"headers");A(this,"_description");this._code=t,this._description=r,this.headers=new Map}[Symbol.iterator](){return this.headers.entries()}size(){return this.headers.size}equals(t){if(t&&this.headers.size===t.headers.size&&this._code===t._code){for(const[r,s]of this.headers){const l=t.values(r);if(s.length!==l.length)return!1;const c=[...s].sort(),d=[...l].sort();for(let p=0;p<c.length;p++)if(c[p]!==d[p])return!1}return!0}return!1}static decode(t){const r=new oi,l=fn.decode(t).split(`\r
27
+ `),c=l[0];if(c!==Dh){let d=c.replace(Dh,"").trim();if(d.length>0){r._code=parseInt(d,10),isNaN(r._code)&&(r._code=0);const p=r._code.toString();d=d.replace(p,""),r._description=d.trim()}}return l.length>=1&&l.slice(1).map(d=>{if(d){const p=d.indexOf(":");if(p>-1){const y=d.slice(0,p),f=d.slice(p+1).trim();r.append(y,f)}}}),r}toString(){if(this.headers.size===0&&this._code===0)return"";let t=Dh;this._code>0&&this._description!==""&&(t+=` ${this._code} ${this._description}`);for(const[r,s]of this.headers)for(let l=0;l<s.length;l++)t=`${t}\r
28
28
  ${r}: ${s[l]}`;return`${t}\r
29
29
  \r
30
- `}encode(){return Hi.encode(this.toString())}static validHeaderValue(t){if(/[\r\n]/.test(t))throw new me("invalid header value - \\r and \\n are not allowed.",le.BadHeader);return t.trim()}keys(){const t=[];for(const r of this.headers.keys())t.push(r);return t}findKeys(t,r=cn.Exact){const s=this.keys();switch(r){case cn.Exact:return s.filter(l=>l===t);case cn.CanonicalMIME:return t=ny(t),s.filter(l=>l===t);default:{const l=t.toLowerCase();return s.filter(c=>l===c.toLowerCase())}}}get(t,r=cn.Exact){const s=this.findKeys(t,r);if(s.length){const l=this.headers.get(s[0]);if(l)return Array.isArray(l)?l[0]:l}return""}last(t,r=cn.Exact){const s=this.findKeys(t,r);if(s.length){const l=this.headers.get(s[0]);if(l)return Array.isArray(l)?l[l.length-1]:l}return""}has(t,r=cn.Exact){return this.findKeys(t,r).length>0}set(t,r,s=cn.Exact){this.delete(t,s),this.append(t,r,s)}append(t,r,s=cn.Exact){const l=ny(t);s===cn.CanonicalMIME&&(t=l);const c=this.findKeys(t,s);t=c.length>0?c[0]:t;const d=oi.validHeaderValue(r);let p=this.headers.get(t);p||(p=[],this.headers.set(t,p)),p.push(d)}values(t,r=cn.Exact){const s=[];return this.findKeys(t,r).forEach(c=>{const d=this.headers.get(c);d&&s.push(...d)}),s}delete(t,r=cn.Exact){this.findKeys(t,r).forEach(l=>{this.headers.delete(l)})}get hasError(){return this._code>=300}get status(){return`${this._code} ${this._description}`.trim()}toRecord(){const t={};return this.keys().forEach(r=>{t[r]=this.values(r)}),t}get code(){return this._code}get description(){return this._description}static fromRecord(t){const r=new oi;for(const s in t)r.headers.set(s,t[s]);return r}}function Zh(){return{encode(i){return Hi.encode(i)},decode(i){return fn.decode(i)}}}function Hn(i){return{encode(t){try{return t===void 0&&(t=null),Hi.encode(JSON.stringify(t))}catch(r){throw me.errorForCode(le.BadJson,r)}},decode(t){try{return JSON.parse(fn.decode(t),i)}catch(r){throw me.errorForCode(le.BadJson,r)}}}}function gb(i){var t;return i&&i.data.length===0&&((t=i.headers)==null?void 0:t.code)===503?me.errorForCode(le.NoResponders):null}class jd{constructor(t,r,s){A(this,"_headers");A(this,"_msg");A(this,"_rdata");A(this,"_reply");A(this,"_subject");A(this,"publisher");this._msg=t,this._rdata=r,this.publisher=s}get subject(){return this._subject?this._subject:(this._subject=fn.decode(this._msg.subject),this._subject)}get reply(){return this._reply?this._reply:(this._reply=fn.decode(this._msg.reply),this._reply)}get sid(){return this._msg.sid}get headers(){if(this._msg.hdr>-1&&!this._headers){const t=this._rdata.subarray(0,this._msg.hdr);this._headers=oi.decode(t)}return this._headers}get data(){return this._rdata?this._msg.hdr>-1?this._rdata.subarray(this._msg.hdr):this._rdata:new Uint8Array(0)}respond(t=dn,r){return this.reply?(this.publisher.publish(this.reply,t,r),!0):!1}size(){var l;const t=this._msg.subject.length,r=((l=this._msg.reply)==null?void 0:l.length)||0,s=this._msg.size===-1?0:this._msg.size;return t+r+s}json(t){return Hn(t).decode(this.data)}string(){return fn.decode(this.data)}requestInfo(){var r;const t=(r=this.headers)==null?void 0:r.get("Nats-Request-Info");return t?JSON.parse(t,function(s,l){return(s==="start"||s==="stop")&&l!==""?new Date(Date.parse(l)):l}):null}}A(jd,"jc");function Us(i){return uu("durable",i)}function Pt(i){return uu("stream",i)}function uu(i,t=""){if(t==="")throw Error(`${i} name required`);return[".","*",">","/","\\"," "," ",`
30
+ `}encode(){return Hi.encode(this.toString())}static validHeaderValue(t){if(/[\r\n]/.test(t))throw new me("invalid header value - \\r and \\n are not allowed.",le.BadHeader);return t.trim()}keys(){const t=[];for(const r of this.headers.keys())t.push(r);return t}findKeys(t,r=cn.Exact){const s=this.keys();switch(r){case cn.Exact:return s.filter(l=>l===t);case cn.CanonicalMIME:return t=ny(t),s.filter(l=>l===t);default:{const l=t.toLowerCase();return s.filter(c=>l===c.toLowerCase())}}}get(t,r=cn.Exact){const s=this.findKeys(t,r);if(s.length){const l=this.headers.get(s[0]);if(l)return Array.isArray(l)?l[0]:l}return""}last(t,r=cn.Exact){const s=this.findKeys(t,r);if(s.length){const l=this.headers.get(s[0]);if(l)return Array.isArray(l)?l[l.length-1]:l}return""}has(t,r=cn.Exact){return this.findKeys(t,r).length>0}set(t,r,s=cn.Exact){this.delete(t,s),this.append(t,r,s)}append(t,r,s=cn.Exact){const l=ny(t);s===cn.CanonicalMIME&&(t=l);const c=this.findKeys(t,s);t=c.length>0?c[0]:t;const d=oi.validHeaderValue(r);let p=this.headers.get(t);p||(p=[],this.headers.set(t,p)),p.push(d)}values(t,r=cn.Exact){const s=[];return this.findKeys(t,r).forEach(c=>{const d=this.headers.get(c);d&&s.push(...d)}),s}delete(t,r=cn.Exact){this.findKeys(t,r).forEach(l=>{this.headers.delete(l)})}get hasError(){return this._code>=300}get status(){return`${this._code} ${this._description}`.trim()}toRecord(){const t={};return this.keys().forEach(r=>{t[r]=this.values(r)}),t}get code(){return this._code}get description(){return this._description}static fromRecord(t){const r=new oi;for(const s in t)r.headers.set(s,t[s]);return r}}function Wh(){return{encode(i){return Hi.encode(i)},decode(i){return fn.decode(i)}}}function Hn(i){return{encode(t){try{return t===void 0&&(t=null),Hi.encode(JSON.stringify(t))}catch(r){throw me.errorForCode(le.BadJson,r)}},decode(t){try{return JSON.parse(fn.decode(t),i)}catch(r){throw me.errorForCode(le.BadJson,r)}}}}function bb(i){var t;return i&&i.data.length===0&&((t=i.headers)==null?void 0:t.code)===503?me.errorForCode(le.NoResponders):null}class Td{constructor(t,r,s){A(this,"_headers");A(this,"_msg");A(this,"_rdata");A(this,"_reply");A(this,"_subject");A(this,"publisher");this._msg=t,this._rdata=r,this.publisher=s}get subject(){return this._subject?this._subject:(this._subject=fn.decode(this._msg.subject),this._subject)}get reply(){return this._reply?this._reply:(this._reply=fn.decode(this._msg.reply),this._reply)}get sid(){return this._msg.sid}get headers(){if(this._msg.hdr>-1&&!this._headers){const t=this._rdata.subarray(0,this._msg.hdr);this._headers=oi.decode(t)}return this._headers}get data(){return this._rdata?this._msg.hdr>-1?this._rdata.subarray(this._msg.hdr):this._rdata:new Uint8Array(0)}respond(t=mn,r){return this.reply?(this.publisher.publish(this.reply,t,r),!0):!1}size(){var l;const t=this._msg.subject.length,r=((l=this._msg.reply)==null?void 0:l.length)||0,s=this._msg.size===-1?0:this._msg.size;return t+r+s}json(t){return Hn(t).decode(this.data)}string(){return fn.decode(this.data)}requestInfo(){var r;const t=(r=this.headers)==null?void 0:r.get("Nats-Request-Info");return t?JSON.parse(t,function(s,l){return(s==="start"||s==="stop")&&l!==""?new Date(Date.parse(l)):l}):null}}A(Td,"jc");function Us(i){return uu("durable",i)}function Pt(i){return uu("stream",i)}function uu(i,t=""){if(t==="")throw Error(`${i} name required`);return[".","*",">","/","\\"," "," ",`
31
31
  `,"\r"].forEach(s=>{if(t.indexOf(s)!==-1){switch(s){case`
32
- `:s="\\n";break;case"\r":s="\\r";break;case" ":s="\\t";break}throw Error(`invalid ${i} name - ${i} name cannot contain '${s}'`)}}),""}function no(i,t=""){if(t==="")throw Error(`${i} name required`);const r=iS(t);if(r.length)throw new Error(`invalid ${i} name - ${i} name ${r}`)}function iS(i=""){if(i==="")throw Error("name required");const t=/^[-\w]+$/g;if(i.match(t)===null){for(const s of i.split(""))if(s.match(t)===null)return`cannot contain '${s}'`}return""}function Wh(i){if(i.data.length>0)return!1;const t=i.headers;return t?t.code>=100&&t.code<200:!1}function ed(i){var t;return Wh(i)&&((t=i.headers)==null?void 0:t.description)==="Idle Heartbeat"}function sS(i,t,r){const s=Er(i,t),l={hdr:1,sid:0,size:0},c=new jd(l,dn,{});return c._headers=s,c._subject=r,c}function Ps(i){if(i.data.length!==0)return null;const t=i.headers;return t?yb(t.code,t.description):null}var Nn;(function(i){i.MaxBatchExceeded="exceeded maxrequestbatch of",i.MaxExpiresExceeded="exceeded maxrequestexpires of",i.MaxBytesExceeded="exceeded maxrequestmaxbytes of",i.MaxMessageSizeExceeded="message size exceeds maxbytes",i.PushConsumer="consumer is push based",i.MaxWaitingExceeded="exceeded maxwaiting",i.IdleHeartbeatMissed="idle heartbeats missed",i.ConsumerDeleted="consumer deleted"})(Nn||(Nn={}));function aS(i){return i.code!==le.JetStream409?!1:[Nn.MaxBatchExceeded,Nn.MaxExpiresExceeded,Nn.MaxBytesExceeded,Nn.MaxMessageSizeExceeded,Nn.PushConsumer,Nn.IdleHeartbeatMissed,Nn.ConsumerDeleted].find(r=>i.message.indexOf(r)!==-1)!==void 0}function yb(i,t=""){if(i<300)return null;switch(t=t.toLowerCase(),i){case 404:return new me(t,le.JetStream404NoMessages);case 408:return new me(t,le.JetStream408RequestTimeout);case 409:{const r=t.startsWith(Nn.IdleHeartbeatMissed)?le.JetStreamIdleHeartBeat:le.JetStream409;return new me(t,r)}case 503:return me.errorForCode(le.JetStreamNotEnabled,new Error(t));default:return t===""&&(t=le.Unknown),new me(t,`${i}`)}}class Tt{constructor(){A(this,"inflight");A(this,"processed");A(this,"received");A(this,"noIterator");A(this,"iterClosed");A(this,"done");A(this,"signal");A(this,"yields");A(this,"filtered");A(this,"pendingFiltered");A(this,"ingestionFilterFn");A(this,"protocolFilterFn");A(this,"dispatchedFn");A(this,"ctx");A(this,"_data");A(this,"err");A(this,"time");A(this,"yielding");this.inflight=0,this.filtered=0,this.pendingFiltered=0,this.processed=0,this.received=0,this.noIterator=!1,this.done=!1,this.signal=st(),this.yields=[],this.iterClosed=st(),this.time=0,this.yielding=!1}[Symbol.asyncIterator](){return this.iterate()}push(t){if(this.done)return;if(typeof t=="function"){this.yields.push(t),this.signal.resolve();return}const{ingest:r,protocol:s}=this.ingestionFilterFn?this.ingestionFilterFn(t,this.ctx||this):{ingest:!0,protocol:!1};r&&(s&&(this.filtered++,this.pendingFiltered++),this.yields.push(t),this.signal.resolve())}async*iterate(){if(this.noIterator)throw new me("unsupported iterator",le.ApiError);if(this.yielding)throw new me("already yielding",le.ApiError);this.yielding=!0;try{for(;;){if(this.yields.length===0&&await this.signal,this.err)throw this.err;const t=this.yields;this.inflight=t.length,this.yields=[];for(let r=0;r<t.length;r++){if(typeof t[r]=="function"){const l=t[r];try{l()}catch(c){throw c}if(this.err)throw this.err;continue}if(this.protocolFilterFn?this.protocolFilterFn(t[r]):!0){this.processed++;const l=Date.now();yield t[r],this.time=Date.now()-l,this.dispatchedFn&&t[r]&&this.dispatchedFn(t[r])}else this.pendingFiltered--;this.inflight--}if(this.done)break;this.yields.length===0&&(t.length=0,this.yields=t,this.signal=st())}}finally{this.stop()}}stop(t){this.done||(this.err=t,this.done=!0,this.signal.resolve(),this.iterClosed.resolve(t))}getProcessed(){return this.noIterator?this.received:this.processed}getPending(){return this.yields.length+this.inflight-this.pendingFiltered}getReceived(){return this.received-this.filtered}}class Td{constructor(t,r,s={maxOut:2}){A(this,"interval");A(this,"maxOut");A(this,"cancelAfter");A(this,"timer");A(this,"autoCancelTimer");A(this,"last");A(this,"missed");A(this,"count");A(this,"callback");this.interval=t,this.maxOut=(s==null?void 0:s.maxOut)||2,this.cancelAfter=(s==null?void 0:s.cancelAfter)||0,this.last=Date.now(),this.missed=0,this.count=0,this.callback=r,this._schedule()}cancel(){this.autoCancelTimer&&clearTimeout(this.autoCancelTimer),this.timer&&clearInterval(this.timer),this.timer=0,this.autoCancelTimer=0,this.missed=0}work(){this.last=Date.now(),this.missed=0}_change(t,r=0,s=2){this.interval=t,this.maxOut=s,this.cancelAfter=r,this.restart()}restart(){this.cancel(),this._schedule()}_schedule(){this.cancelAfter>0&&(this.autoCancelTimer=setTimeout(()=>{this.cancel()},this.cancelAfter)),this.timer=setInterval(()=>{if(this.count++,Date.now()-this.last>this.interval&&this.missed++,this.missed>=this.maxOut)try{this.callback(this.missed)===!0&&this.cancel()}catch(t){console.log(t)}},this.interval)}}var td;(function(i){i.Limits="limits",i.Interest="interest",i.Workqueue="workqueue"})(td||(td={}));var uo;(function(i){i.Old="old",i.New="new"})(uo||(uo={}));var nd;(function(i){i.File="file",i.Memory="memory"})(nd||(nd={}));var mt;(function(i){i.All="all",i.Last="last",i.New="new",i.StartSequence="by_start_sequence",i.StartTime="by_start_time",i.LastPerSubject="last_per_subject"})(mt||(mt={}));var At;(function(i){i.None="none",i.All="all",i.Explicit="explicit",i.NotSet=""})(At||(At={}));var Fs;(function(i){i.Instant="instant",i.Original="original"})(Fs||(Fs={}));var hi;(function(i){i.None="none",i.S2="s2"})(hi||(hi={}));var Qc;(function(i){i.CreateOrUpdate="",i.Update="update",i.Create="create"})(Qc||(Qc={}));function oS(i,t={}){return Object.assign({name:i,deliver_policy:mt.All,ack_policy:At.Explicit,ack_wait:it(30*1e3),replay_policy:Fs.Instant},t)}var ry;(function(i){i.API="api_audit",i.StreamAction="stream_action",i.ConsumerAction="consumer_action",i.SnapshotCreate="snapshot_create",i.SnapshotComplete="snapshot_complete",i.RestoreCreate="restore_create",i.RestoreComplete="restore_complete",i.MaxDeliver="max_deliver",i.Terminated="terminated",i.Ack="consumer_ack",i.StreamLeaderElected="stream_leader_elected",i.StreamQuorumLost="stream_quorum_lost",i.ConsumerLeaderElected="consumer_leader_elected",i.ConsumerQuorumLost="consumer_quorum_lost"})(ry||(ry={}));var $t;(function(i){i.StreamSourceHdr="Nats-Stream-Source",i.LastConsumerSeqHdr="Nats-Last-Consumer",i.LastStreamSeqHdr="Nats-Last-Stream",i.ConsumerStalledHdr="Nats-Consumer-Stalled",i.MessageSizeHdr="Nats-Msg-Size",i.RollupHdr="Nats-Rollup",i.RollupValueSubject="sub",i.RollupValueAll="all",i.PendingMessagesHdr="Nats-Pending-Messages",i.PendingBytesHdr="Nats-Pending-Bytes"})($t||($t={}));var Un;(function(i){i.LastValue="",i.AllHistory="history",i.UpdatesOnly="updates"})(Un||(Un={}));var Bs;(function(i){i.Stream="Nats-Stream",i.Sequence="Nats-Sequence",i.TimeStamp="Nats-Time-Stamp",i.Subject="Nats-Subject"})(Bs||(Bs={}));var iy;(function(i){i.Stream="Nats-Stream",i.Subject="Nats-Subject",i.Sequence="Nats-Sequence",i.LastSequence="Nats-Last-Sequence",i.Size="Nats-Msg-Size"})(iy||(iy={}));const un="KV_";class lS{constructor(t){A(this,"config");A(this,"ordered");A(this,"mack");A(this,"stream");A(this,"callbackFn");A(this,"max");A(this,"qname");A(this,"isBind");A(this,"filters");this.stream="",this.mack=!1,this.ordered=!1,this.config=oS("",t||{})}getOpts(){var r;const t={};if(t.config=Object.assign({},this.config),t.config.filter_subject&&(this.filterSubject(t.config.filter_subject),t.config.filter_subject=void 0),t.config.filter_subjects&&((r=t.config.filter_subjects)==null||r.forEach(s=>{this.filterSubject(s)}),t.config.filter_subjects=void 0),t.mack=this.mack,t.stream=this.stream,t.callbackFn=this.callbackFn,t.max=this.max,t.queue=this.qname,t.ordered=this.ordered,t.config.ack_policy=t.ordered?At.None:t.config.ack_policy,t.isBind=t.isBind||!1,this.filters)switch(this.filters.length){case 0:break;case 1:t.config.filter_subject=this.filters[0];break;default:t.config.filter_subjects=this.filters}return t}description(t){return this.config.description=t,this}deliverTo(t){return this.config.deliver_subject=t,this}durable(t){return Us(t),this.config.durable_name=t,this}startSequence(t){if(t<=0)throw new Error("sequence must be greater than 0");return this.config.deliver_policy=mt.StartSequence,this.config.opt_start_seq=t,this}startTime(t){return this.config.deliver_policy=mt.StartTime,this.config.opt_start_time=t.toISOString(),this}deliverAll(){return this.config.deliver_policy=mt.All,this}deliverLastPerSubject(){return this.config.deliver_policy=mt.LastPerSubject,this}deliverLast(){return this.config.deliver_policy=mt.Last,this}deliverNew(){return this.config.deliver_policy=mt.New,this}startAtTimeDelta(t){return this.startTime(new Date(Date.now()-t)),this}headersOnly(){return this.config.headers_only=!0,this}ackNone(){return this.config.ack_policy=At.None,this}ackAll(){return this.config.ack_policy=At.All,this}ackExplicit(){return this.config.ack_policy=At.Explicit,this}ackWait(t){return this.config.ack_wait=it(t),this}maxDeliver(t){return this.config.max_deliver=t,this}filterSubject(t){return this.filters=this.filters||[],this.filters.push(t),this}replayInstantly(){return this.config.replay_policy=Fs.Instant,this}replayOriginal(){return this.config.replay_policy=Fs.Original,this}sample(t){if(t=Math.trunc(t),t<0||t>100)throw new Error("value must be between 0-100");return this.config.sample_freq=`${t}%`,this}limit(t){return this.config.rate_limit_bps=t,this}maxWaiting(t){return this.config.max_waiting=t,this}maxAckPending(t){return this.config.max_ack_pending=t,this}idleHeartbeat(t){return this.config.idle_heartbeat=it(t),this}flowControl(){return this.config.flow_control=!0,this}deliverGroup(t){return this.queue(t),this}manualAck(){return this.mack=!0,this}maxMessages(t){return this.max=t,this}callback(t){return this.callbackFn=t,this}queue(t){return this.qname=t,this.config.deliver_group=t,this}orderedConsumer(){return this.ordered=!0,this}bind(t,r){return this.stream=t,this.config.durable_name=r,this.isBind=!0,this}bindStream(t){return this.stream=t,this}inactiveEphemeralThreshold(t){return this.config.inactive_threshold=it(t),this}maxPullBatch(t){return this.config.max_batch=t,this}maxPullRequestExpires(t){return this.config.max_expires=it(t),this}memory(){return this.config.mem_storage=!0,this}numReplicas(t){return this.config.num_replicas=t,this}consumerName(t){return this.config.name=t,this}}function li(i){return new lS(i)}function sy(i){return typeof i.getOpts=="function"}class cS{static encode(t){if(typeof t=="string")return btoa(t);const r=Array.from(t);return btoa(String.fromCharCode(...r))}static decode(t,r=!1){const s=atob(t);return r?Uint8Array.from(s,l=>l.charCodeAt(0)):s}}class Is{static encode(t){return Is.toB64URLEncoding(cS.encode(t))}static decode(t,r=!1){return Is.decode(Is.fromB64URLEncoding(t),r)}static toB64URLEncoding(t){return t.replace(/\+/g,"-").replace(/\//g,"_")}static fromB64URLEncoding(t){return t.replace(/_/g,"/").replace(/-/g,"+")}}class Vs{constructor(){A(this,"buffers");A(this,"byteLength");this.buffers=[],this.byteLength=0}static concat(...t){let r=0;for(let c=0;c<t.length;c++)r+=t[c].length;const s=new Uint8Array(r);let l=0;for(let c=0;c<t.length;c++)s.set(t[c],l),l+=t[c].length;return s}static fromAscii(t){return t||(t=""),Hi.encode(t)}static toAscii(t){return fn.decode(t)}reset(){this.buffers.length=0,this.byteLength=0}pack(){if(this.buffers.length>1){const t=new Uint8Array(this.byteLength);let r=0;for(let s=0;s<this.buffers.length;s++)t.set(this.buffers[s],r),r+=this.buffers[s].length;this.buffers.length=0,this.buffers.push(t)}}shift(){if(this.buffers.length){const t=this.buffers.shift();if(t)return this.byteLength-=t.length,t}return new Uint8Array(0)}drain(t){if(this.buffers.length){this.pack();const r=this.buffers.pop();if(r){const s=this.byteLength;(t===void 0||t>s)&&(t=s);const l=r.subarray(0,t);return s>t&&this.buffers.push(r.subarray(t)),this.byteLength=s-t,l}}return new Uint8Array(0)}fill(t,...r){t&&(this.buffers.push(t),this.byteLength+=t.length);for(let s=0;s<r.length;s++)r[s]&&r[s].length&&(this.buffers.push(r[s]),this.byteLength+=r[s].length)}peek(){return this.buffers.length?(this.pack(),this.buffers[0]):new Uint8Array(0)}size(){return this.byteLength}length(){return this.buffers.length}}function uS(i,t){return t.forEach(function(r){r&&typeof r!="string"&&!Array.isArray(r)&&Object.keys(r).forEach(function(s){if(s!=="default"&&!(s in i)){var l=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(i,s,l.get?l:{enumerable:!0,get:function(){return r[s]}})}})}),Object.freeze(i)}var fS=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},Fa=fS.performance||{};Fa.now||Fa.mozNow||Fa.msNow||Fa.oNow||Fa.webkitNow;var ay={versions:{}},hS=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function dS(i){if(i.__esModule)return i;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(i).forEach(function(r){var s=Object.getOwnPropertyDescriptor(i,r);Object.defineProperty(t,r,s.get?s:{enumerable:!0,get:function(){return i[r]}})}),t}var Dh,fu={exports:{}},oy={},ly=dS(uS({__proto__:null,default:oy},[oy]));Dh=fu,(function(){var i="input is invalid type",t=typeof window=="object",r=t?window:{};r.JS_SHA256_NO_WINDOW&&(t=!1);var s=!t&&typeof self=="object",l=!r.JS_SHA256_NO_NODE_JS&&ay.versions&&ay.versions.node;l?r=hS:s&&(r=self);var c=!r.JS_SHA256_NO_COMMON_JS&&Dh.exports,d=!r.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",p="0123456789abcdef".split(""),g=[-2147483648,8388608,32768,128],f=[24,16,8,0],m=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],b=["hex","array","digest","arrayBuffer"],v=[];!r.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(C){return Object.prototype.toString.call(C)==="[object Array]"}),!d||!r.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(C){return typeof C=="object"&&C.buffer&&C.buffer.constructor===ArrayBuffer});var _=function(C,z){return function(re){return new U(z,!0).update(re)[C]()}},w=function(C){var z=_("hex",C);l&&(z=S(z,C)),z.create=function(){return new U(C)},z.update=function(L){return z.create().update(L)};for(var re=0;re<b.length;++re){var X=b[re];z[X]=_(X,C)}return z},S=function(C,z){var re,X=ly,L=ly.Buffer,G=z?"sha224":"sha256";return re=L.from&&!r.JS_SHA256_NO_BUFFER_FROM?L.from:function(W){return new L(W)},function(W){if(typeof W=="string")return X.createHash(G).update(W,"utf8").digest("hex");if(W==null)throw new Error(i);return W.constructor===ArrayBuffer&&(W=new Uint8Array(W)),Array.isArray(W)||ArrayBuffer.isView(W)||W.constructor===L?X.createHash(G).update(re(W)).digest("hex"):C(W)}},M=function(C,z){return function(re,X){return new ie(re,z,!0).update(X)[C]()}},B=function(C){var z=M("hex",C);z.create=function(L){return new ie(L,C)},z.update=function(L,G){return z.create(L).update(G)};for(var re=0;re<b.length;++re){var X=b[re];z[X]=M(X,C)}return z};function U(C,z){z?(v[0]=v[16]=v[1]=v[2]=v[3]=v[4]=v[5]=v[6]=v[7]=v[8]=v[9]=v[10]=v[11]=v[12]=v[13]=v[14]=v[15]=0,this.blocks=v):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],C?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=C}function ie(C,z,re){var X,L=typeof C;if(L==="string"){var G,W=[],Q=C.length,he=0;for(X=0;X<Q;++X)(G=C.charCodeAt(X))<128?W[he++]=G:G<2048?(W[he++]=192|G>>>6,W[he++]=128|63&G):G<55296||G>=57344?(W[he++]=224|G>>>12,W[he++]=128|G>>>6&63,W[he++]=128|63&G):(G=65536+((1023&G)<<10|1023&C.charCodeAt(++X)),W[he++]=240|G>>>18,W[he++]=128|G>>>12&63,W[he++]=128|G>>>6&63,W[he++]=128|63&G);C=W}else{if(L!=="object")throw new Error(i);if(C===null)throw new Error(i);if(d&&C.constructor===ArrayBuffer)C=new Uint8Array(C);else if(!(Array.isArray(C)||d&&ArrayBuffer.isView(C)))throw new Error(i)}C.length>64&&(C=new U(z,!0).update(C).array());var _e=[],Te=[];for(X=0;X<64;++X){var Y=C[X]||0;_e[X]=92^Y,Te[X]=54^Y}U.call(this,z,re),this.update(Te),this.oKeyPad=_e,this.inner=!0,this.sharedMemory=re}U.prototype.update=function(C){if(!this.finalized){var z,re=typeof C;if(re!=="string"){if(re!=="object")throw new Error(i);if(C===null)throw new Error(i);if(d&&C.constructor===ArrayBuffer)C=new Uint8Array(C);else if(!(Array.isArray(C)||d&&ArrayBuffer.isView(C)))throw new Error(i);z=!0}for(var X,L,G=0,W=C.length,Q=this.blocks;G<W;){if(this.hashed&&(this.hashed=!1,Q[0]=this.block,this.block=Q[16]=Q[1]=Q[2]=Q[3]=Q[4]=Q[5]=Q[6]=Q[7]=Q[8]=Q[9]=Q[10]=Q[11]=Q[12]=Q[13]=Q[14]=Q[15]=0),z)for(L=this.start;G<W&&L<64;++G)Q[L>>>2]|=C[G]<<f[3&L++];else for(L=this.start;G<W&&L<64;++G)(X=C.charCodeAt(G))<128?Q[L>>>2]|=X<<f[3&L++]:X<2048?(Q[L>>>2]|=(192|X>>>6)<<f[3&L++],Q[L>>>2]|=(128|63&X)<<f[3&L++]):X<55296||X>=57344?(Q[L>>>2]|=(224|X>>>12)<<f[3&L++],Q[L>>>2]|=(128|X>>>6&63)<<f[3&L++],Q[L>>>2]|=(128|63&X)<<f[3&L++]):(X=65536+((1023&X)<<10|1023&C.charCodeAt(++G)),Q[L>>>2]|=(240|X>>>18)<<f[3&L++],Q[L>>>2]|=(128|X>>>12&63)<<f[3&L++],Q[L>>>2]|=(128|X>>>6&63)<<f[3&L++],Q[L>>>2]|=(128|63&X)<<f[3&L++]);this.lastByteIndex=L,this.bytes+=L-this.start,L>=64?(this.block=Q[16],this.start=L-64,this.hash(),this.hashed=!0):this.start=L}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},U.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var C=this.blocks,z=this.lastByteIndex;C[16]=this.block,C[z>>>2]|=g[3&z],this.block=C[16],z>=56&&(this.hashed||this.hash(),C[0]=this.block,C[16]=C[1]=C[2]=C[3]=C[4]=C[5]=C[6]=C[7]=C[8]=C[9]=C[10]=C[11]=C[12]=C[13]=C[14]=C[15]=0),C[14]=this.hBytes<<3|this.bytes>>>29,C[15]=this.bytes<<3,this.hash()}},U.prototype.hash=function(){var C,z,re,X,L,G,W,Q,he,_e=this.h0,Te=this.h1,Y=this.h2,ae=this.h3,de=this.h4,Oe=this.h5,oe=this.h6,je=this.h7,Se=this.blocks;for(C=16;C<64;++C)z=((L=Se[C-15])>>>7|L<<25)^(L>>>18|L<<14)^L>>>3,re=((L=Se[C-2])>>>17|L<<15)^(L>>>19|L<<13)^L>>>10,Se[C]=Se[C-16]+z+Se[C-7]+re|0;for(he=Te&Y,C=0;C<64;C+=4)this.first?(this.is224?(G=300032,je=(L=Se[0]-1413257819)-150054599|0,ae=L+24177077|0):(G=704751109,je=(L=Se[0]-210244248)-1521486534|0,ae=L+143694565|0),this.first=!1):(z=(_e>>>2|_e<<30)^(_e>>>13|_e<<19)^(_e>>>22|_e<<10),X=(G=_e&Te)^_e&Y^he,je=ae+(L=je+(re=(de>>>6|de<<26)^(de>>>11|de<<21)^(de>>>25|de<<7))+(de&Oe^~de&oe)+m[C]+Se[C])|0,ae=L+(z+X)|0),z=(ae>>>2|ae<<30)^(ae>>>13|ae<<19)^(ae>>>22|ae<<10),X=(W=ae&_e)^ae&Te^G,oe=Y+(L=oe+(re=(je>>>6|je<<26)^(je>>>11|je<<21)^(je>>>25|je<<7))+(je&de^~je&Oe)+m[C+1]+Se[C+1])|0,z=((Y=L+(z+X)|0)>>>2|Y<<30)^(Y>>>13|Y<<19)^(Y>>>22|Y<<10),X=(Q=Y&ae)^Y&_e^W,Oe=Te+(L=Oe+(re=(oe>>>6|oe<<26)^(oe>>>11|oe<<21)^(oe>>>25|oe<<7))+(oe&je^~oe&de)+m[C+2]+Se[C+2])|0,z=((Te=L+(z+X)|0)>>>2|Te<<30)^(Te>>>13|Te<<19)^(Te>>>22|Te<<10),X=(he=Te&Y)^Te&ae^Q,de=_e+(L=de+(re=(Oe>>>6|Oe<<26)^(Oe>>>11|Oe<<21)^(Oe>>>25|Oe<<7))+(Oe&oe^~Oe&je)+m[C+3]+Se[C+3])|0,_e=L+(z+X)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+_e|0,this.h1=this.h1+Te|0,this.h2=this.h2+Y|0,this.h3=this.h3+ae|0,this.h4=this.h4+de|0,this.h5=this.h5+Oe|0,this.h6=this.h6+oe|0,this.h7=this.h7+je|0},U.prototype.hex=function(){this.finalize();var C=this.h0,z=this.h1,re=this.h2,X=this.h3,L=this.h4,G=this.h5,W=this.h6,Q=this.h7,he=p[C>>>28&15]+p[C>>>24&15]+p[C>>>20&15]+p[C>>>16&15]+p[C>>>12&15]+p[C>>>8&15]+p[C>>>4&15]+p[15&C]+p[z>>>28&15]+p[z>>>24&15]+p[z>>>20&15]+p[z>>>16&15]+p[z>>>12&15]+p[z>>>8&15]+p[z>>>4&15]+p[15&z]+p[re>>>28&15]+p[re>>>24&15]+p[re>>>20&15]+p[re>>>16&15]+p[re>>>12&15]+p[re>>>8&15]+p[re>>>4&15]+p[15&re]+p[X>>>28&15]+p[X>>>24&15]+p[X>>>20&15]+p[X>>>16&15]+p[X>>>12&15]+p[X>>>8&15]+p[X>>>4&15]+p[15&X]+p[L>>>28&15]+p[L>>>24&15]+p[L>>>20&15]+p[L>>>16&15]+p[L>>>12&15]+p[L>>>8&15]+p[L>>>4&15]+p[15&L]+p[G>>>28&15]+p[G>>>24&15]+p[G>>>20&15]+p[G>>>16&15]+p[G>>>12&15]+p[G>>>8&15]+p[G>>>4&15]+p[15&G]+p[W>>>28&15]+p[W>>>24&15]+p[W>>>20&15]+p[W>>>16&15]+p[W>>>12&15]+p[W>>>8&15]+p[W>>>4&15]+p[15&W];return this.is224||(he+=p[Q>>>28&15]+p[Q>>>24&15]+p[Q>>>20&15]+p[Q>>>16&15]+p[Q>>>12&15]+p[Q>>>8&15]+p[Q>>>4&15]+p[15&Q]),he},U.prototype.toString=U.prototype.hex,U.prototype.digest=function(){this.finalize();var C=this.h0,z=this.h1,re=this.h2,X=this.h3,L=this.h4,G=this.h5,W=this.h6,Q=this.h7,he=[C>>>24&255,C>>>16&255,C>>>8&255,255&C,z>>>24&255,z>>>16&255,z>>>8&255,255&z,re>>>24&255,re>>>16&255,re>>>8&255,255&re,X>>>24&255,X>>>16&255,X>>>8&255,255&X,L>>>24&255,L>>>16&255,L>>>8&255,255&L,G>>>24&255,G>>>16&255,G>>>8&255,255&G,W>>>24&255,W>>>16&255,W>>>8&255,255&W];return this.is224||he.push(Q>>>24&255,Q>>>16&255,Q>>>8&255,255&Q),he},U.prototype.array=U.prototype.digest,U.prototype.arrayBuffer=function(){this.finalize();var C=new ArrayBuffer(this.is224?28:32),z=new DataView(C);return z.setUint32(0,this.h0),z.setUint32(4,this.h1),z.setUint32(8,this.h2),z.setUint32(12,this.h3),z.setUint32(16,this.h4),z.setUint32(20,this.h5),z.setUint32(24,this.h6),this.is224||z.setUint32(28,this.h7),C},ie.prototype=new U,ie.prototype.finalize=function(){if(U.prototype.finalize.call(this),this.inner){this.inner=!1;var C=this.array();U.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(C),U.prototype.finalize.call(this)}};var ce=w();ce.sha256=ce,ce.sha224=w(!0),ce.sha256.hmac=B(),ce.sha224.hmac=B(!0),c?Dh.exports=ce:(r.sha256=ce.sha256,r.sha224=ce.sha224)})();fu.exports;fu.exports.sha224;var cy=fu.exports.sha256;function rd(i){return vS(i)}function mS(i){if(!/^[0-9A-Fa-f]+$/.test(i))return!1;const r=/^[0-9A-F]+$/.test(i),s=/^[0-9a-f]+$/.test(i);return r||s?i.length%2===0:!1}function pS(i){return/^[A-Za-z0-9\-_]*(={0,2})?$/.test(i)||/^[A-Za-z0-9+/]*(={0,2})?$/.test(i)}function gS(i){return mS(i)?"hex":pS(i)?"b64":""}function yS(i){if(i.length%2!==0)throw new Error("hex string must have an even length");const t=new Uint8Array(i.length/2);for(let r=0;r<i.length;r+=2)t[r/2]=parseInt(i.substring(r,r+2),16);return t}function bS(i){i=i.replace(/-/g,"+"),i=i.replace(/_/g,"/");const t=atob(i);return Uint8Array.from(t,r=>r.charCodeAt(0))}function vS(i){switch(gS(i)){case"hex":return yS(i);case"b64":return bS(i)}return null}function xS(i,t){const r=typeof i=="string"?rd(i):i,s=typeof t=="string"?rd(t):t;if(r===null||s===null||r.length!==s.length)return!1;for(let l=0;l<r.length;l++)if(r[l]!==s[l])return!1;return!0}class bb{constructor(t,r,s=!0){A(this,"token");A(this,"received");A(this,"ctx");A(this,"requestSubject");A(this,"mux");this.mux=t,this.requestSubject=r,this.received=0,this.token=fi.next(),s&&(this.ctx=new Error)}}class _S extends bb{constructor(r,s,l={maxWait:1e3}){super(r,s);A(this,"callback");A(this,"done");A(this,"timer");A(this,"max");A(this,"opts");if(this.opts=l,typeof this.opts.callback!="function")throw new Error("callback is required");this.callback=this.opts.callback,this.max=typeof l.maxMessages=="number"&&l.maxMessages>0?l.maxMessages:-1,this.done=st(),this.done.then(()=>{this.callback(null,null)}),this.timer=setTimeout(()=>{this.cancel()},l.maxWait)}cancel(r){r&&this.callback(r,null),clearTimeout(this.timer),this.mux.cancel(this),this.done.resolve()}resolver(r,s){r?(this.ctx&&(r.stack+=`
32
+ `:s="\\n";break;case"\r":s="\\r";break;case" ":s="\\t";break}throw Error(`invalid ${i} name - ${i} name cannot contain '${s}'`)}}),""}function no(i,t=""){if(t==="")throw Error(`${i} name required`);const r=aS(t);if(r.length)throw new Error(`invalid ${i} name - ${i} name ${r}`)}function aS(i=""){if(i==="")throw Error("name required");const t=/^[-\w]+$/g;if(i.match(t)===null){for(const s of i.split(""))if(s.match(t)===null)return`cannot contain '${s}'`}return""}function ed(i){if(i.data.length>0)return!1;const t=i.headers;return t?t.code>=100&&t.code<200:!1}function td(i){var t;return ed(i)&&((t=i.headers)==null?void 0:t.description)==="Idle Heartbeat"}function oS(i,t,r){const s=Er(i,t),l={hdr:1,sid:0,size:0},c=new Td(l,mn,{});return c._headers=s,c._subject=r,c}function Ps(i){if(i.data.length!==0)return null;const t=i.headers;return t?vb(t.code,t.description):null}var kn;(function(i){i.MaxBatchExceeded="exceeded maxrequestbatch of",i.MaxExpiresExceeded="exceeded maxrequestexpires of",i.MaxBytesExceeded="exceeded maxrequestmaxbytes of",i.MaxMessageSizeExceeded="message size exceeds maxbytes",i.PushConsumer="consumer is push based",i.MaxWaitingExceeded="exceeded maxwaiting",i.IdleHeartbeatMissed="idle heartbeats missed",i.ConsumerDeleted="consumer deleted"})(kn||(kn={}));function lS(i){return i.code!==le.JetStream409?!1:[kn.MaxBatchExceeded,kn.MaxExpiresExceeded,kn.MaxBytesExceeded,kn.MaxMessageSizeExceeded,kn.PushConsumer,kn.IdleHeartbeatMissed,kn.ConsumerDeleted].find(r=>i.message.indexOf(r)!==-1)!==void 0}function vb(i,t=""){if(i<300)return null;switch(t=t.toLowerCase(),i){case 404:return new me(t,le.JetStream404NoMessages);case 408:return new me(t,le.JetStream408RequestTimeout);case 409:{const r=t.startsWith(kn.IdleHeartbeatMissed)?le.JetStreamIdleHeartBeat:le.JetStream409;return new me(t,r)}case 503:return me.errorForCode(le.JetStreamNotEnabled,new Error(t));default:return t===""&&(t=le.Unknown),new me(t,`${i}`)}}class Tt{constructor(){A(this,"inflight");A(this,"processed");A(this,"received");A(this,"noIterator");A(this,"iterClosed");A(this,"done");A(this,"signal");A(this,"yields");A(this,"filtered");A(this,"pendingFiltered");A(this,"ingestionFilterFn");A(this,"protocolFilterFn");A(this,"dispatchedFn");A(this,"ctx");A(this,"_data");A(this,"err");A(this,"time");A(this,"yielding");this.inflight=0,this.filtered=0,this.pendingFiltered=0,this.processed=0,this.received=0,this.noIterator=!1,this.done=!1,this.signal=st(),this.yields=[],this.iterClosed=st(),this.time=0,this.yielding=!1}[Symbol.asyncIterator](){return this.iterate()}push(t){if(this.done)return;if(typeof t=="function"){this.yields.push(t),this.signal.resolve();return}const{ingest:r,protocol:s}=this.ingestionFilterFn?this.ingestionFilterFn(t,this.ctx||this):{ingest:!0,protocol:!1};r&&(s&&(this.filtered++,this.pendingFiltered++),this.yields.push(t),this.signal.resolve())}async*iterate(){if(this.noIterator)throw new me("unsupported iterator",le.ApiError);if(this.yielding)throw new me("already yielding",le.ApiError);this.yielding=!0;try{for(;;){if(this.yields.length===0&&await this.signal,this.err)throw this.err;const t=this.yields;this.inflight=t.length,this.yields=[];for(let r=0;r<t.length;r++){if(typeof t[r]=="function"){const l=t[r];try{l()}catch(c){throw c}if(this.err)throw this.err;continue}if(this.protocolFilterFn?this.protocolFilterFn(t[r]):!0){this.processed++;const l=Date.now();yield t[r],this.time=Date.now()-l,this.dispatchedFn&&t[r]&&this.dispatchedFn(t[r])}else this.pendingFiltered--;this.inflight--}if(this.done)break;this.yields.length===0&&(t.length=0,this.yields=t,this.signal=st())}}finally{this.stop()}}stop(t){this.done||(this.err=t,this.done=!0,this.signal.resolve(),this.iterClosed.resolve(t))}getProcessed(){return this.noIterator?this.received:this.processed}getPending(){return this.yields.length+this.inflight-this.pendingFiltered}getReceived(){return this.received-this.filtered}}class Nd{constructor(t,r,s={maxOut:2}){A(this,"interval");A(this,"maxOut");A(this,"cancelAfter");A(this,"timer");A(this,"autoCancelTimer");A(this,"last");A(this,"missed");A(this,"count");A(this,"callback");this.interval=t,this.maxOut=(s==null?void 0:s.maxOut)||2,this.cancelAfter=(s==null?void 0:s.cancelAfter)||0,this.last=Date.now(),this.missed=0,this.count=0,this.callback=r,this._schedule()}cancel(){this.autoCancelTimer&&clearTimeout(this.autoCancelTimer),this.timer&&clearInterval(this.timer),this.timer=0,this.autoCancelTimer=0,this.missed=0}work(){this.last=Date.now(),this.missed=0}_change(t,r=0,s=2){this.interval=t,this.maxOut=s,this.cancelAfter=r,this.restart()}restart(){this.cancel(),this._schedule()}_schedule(){this.cancelAfter>0&&(this.autoCancelTimer=setTimeout(()=>{this.cancel()},this.cancelAfter)),this.timer=setInterval(()=>{if(this.count++,Date.now()-this.last>this.interval&&this.missed++,this.missed>=this.maxOut)try{this.callback(this.missed)===!0&&this.cancel()}catch(t){console.log(t)}},this.interval)}}var nd;(function(i){i.Limits="limits",i.Interest="interest",i.Workqueue="workqueue"})(nd||(nd={}));var uo;(function(i){i.Old="old",i.New="new"})(uo||(uo={}));var rd;(function(i){i.File="file",i.Memory="memory"})(rd||(rd={}));var gt;(function(i){i.All="all",i.Last="last",i.New="new",i.StartSequence="by_start_sequence",i.StartTime="by_start_time",i.LastPerSubject="last_per_subject"})(gt||(gt={}));var At;(function(i){i.None="none",i.All="all",i.Explicit="explicit",i.NotSet=""})(At||(At={}));var Fs;(function(i){i.Instant="instant",i.Original="original"})(Fs||(Fs={}));var hi;(function(i){i.None="none",i.S2="s2"})(hi||(hi={}));var Qc;(function(i){i.CreateOrUpdate="",i.Update="update",i.Create="create"})(Qc||(Qc={}));function cS(i,t={}){return Object.assign({name:i,deliver_policy:gt.All,ack_policy:At.Explicit,ack_wait:it(30*1e3),replay_policy:Fs.Instant},t)}var ry;(function(i){i.API="api_audit",i.StreamAction="stream_action",i.ConsumerAction="consumer_action",i.SnapshotCreate="snapshot_create",i.SnapshotComplete="snapshot_complete",i.RestoreCreate="restore_create",i.RestoreComplete="restore_complete",i.MaxDeliver="max_deliver",i.Terminated="terminated",i.Ack="consumer_ack",i.StreamLeaderElected="stream_leader_elected",i.StreamQuorumLost="stream_quorum_lost",i.ConsumerLeaderElected="consumer_leader_elected",i.ConsumerQuorumLost="consumer_quorum_lost"})(ry||(ry={}));var $t;(function(i){i.StreamSourceHdr="Nats-Stream-Source",i.LastConsumerSeqHdr="Nats-Last-Consumer",i.LastStreamSeqHdr="Nats-Last-Stream",i.ConsumerStalledHdr="Nats-Consumer-Stalled",i.MessageSizeHdr="Nats-Msg-Size",i.RollupHdr="Nats-Rollup",i.RollupValueSubject="sub",i.RollupValueAll="all",i.PendingMessagesHdr="Nats-Pending-Messages",i.PendingBytesHdr="Nats-Pending-Bytes"})($t||($t={}));var Un;(function(i){i.LastValue="",i.AllHistory="history",i.UpdatesOnly="updates"})(Un||(Un={}));var Bs;(function(i){i.Stream="Nats-Stream",i.Sequence="Nats-Sequence",i.TimeStamp="Nats-Time-Stamp",i.Subject="Nats-Subject"})(Bs||(Bs={}));var iy;(function(i){i.Stream="Nats-Stream",i.Subject="Nats-Subject",i.Sequence="Nats-Sequence",i.LastSequence="Nats-Last-Sequence",i.Size="Nats-Msg-Size"})(iy||(iy={}));const un="KV_";class uS{constructor(t){A(this,"config");A(this,"ordered");A(this,"mack");A(this,"stream");A(this,"callbackFn");A(this,"max");A(this,"qname");A(this,"isBind");A(this,"filters");this.stream="",this.mack=!1,this.ordered=!1,this.config=cS("",t||{})}getOpts(){var r;const t={};if(t.config=Object.assign({},this.config),t.config.filter_subject&&(this.filterSubject(t.config.filter_subject),t.config.filter_subject=void 0),t.config.filter_subjects&&((r=t.config.filter_subjects)==null||r.forEach(s=>{this.filterSubject(s)}),t.config.filter_subjects=void 0),t.mack=this.mack,t.stream=this.stream,t.callbackFn=this.callbackFn,t.max=this.max,t.queue=this.qname,t.ordered=this.ordered,t.config.ack_policy=t.ordered?At.None:t.config.ack_policy,t.isBind=t.isBind||!1,this.filters)switch(this.filters.length){case 0:break;case 1:t.config.filter_subject=this.filters[0];break;default:t.config.filter_subjects=this.filters}return t}description(t){return this.config.description=t,this}deliverTo(t){return this.config.deliver_subject=t,this}durable(t){return Us(t),this.config.durable_name=t,this}startSequence(t){if(t<=0)throw new Error("sequence must be greater than 0");return this.config.deliver_policy=gt.StartSequence,this.config.opt_start_seq=t,this}startTime(t){return this.config.deliver_policy=gt.StartTime,this.config.opt_start_time=t.toISOString(),this}deliverAll(){return this.config.deliver_policy=gt.All,this}deliverLastPerSubject(){return this.config.deliver_policy=gt.LastPerSubject,this}deliverLast(){return this.config.deliver_policy=gt.Last,this}deliverNew(){return this.config.deliver_policy=gt.New,this}startAtTimeDelta(t){return this.startTime(new Date(Date.now()-t)),this}headersOnly(){return this.config.headers_only=!0,this}ackNone(){return this.config.ack_policy=At.None,this}ackAll(){return this.config.ack_policy=At.All,this}ackExplicit(){return this.config.ack_policy=At.Explicit,this}ackWait(t){return this.config.ack_wait=it(t),this}maxDeliver(t){return this.config.max_deliver=t,this}filterSubject(t){return this.filters=this.filters||[],this.filters.push(t),this}replayInstantly(){return this.config.replay_policy=Fs.Instant,this}replayOriginal(){return this.config.replay_policy=Fs.Original,this}sample(t){if(t=Math.trunc(t),t<0||t>100)throw new Error("value must be between 0-100");return this.config.sample_freq=`${t}%`,this}limit(t){return this.config.rate_limit_bps=t,this}maxWaiting(t){return this.config.max_waiting=t,this}maxAckPending(t){return this.config.max_ack_pending=t,this}idleHeartbeat(t){return this.config.idle_heartbeat=it(t),this}flowControl(){return this.config.flow_control=!0,this}deliverGroup(t){return this.queue(t),this}manualAck(){return this.mack=!0,this}maxMessages(t){return this.max=t,this}callback(t){return this.callbackFn=t,this}queue(t){return this.qname=t,this.config.deliver_group=t,this}orderedConsumer(){return this.ordered=!0,this}bind(t,r){return this.stream=t,this.config.durable_name=r,this.isBind=!0,this}bindStream(t){return this.stream=t,this}inactiveEphemeralThreshold(t){return this.config.inactive_threshold=it(t),this}maxPullBatch(t){return this.config.max_batch=t,this}maxPullRequestExpires(t){return this.config.max_expires=it(t),this}memory(){return this.config.mem_storage=!0,this}numReplicas(t){return this.config.num_replicas=t,this}consumerName(t){return this.config.name=t,this}}function li(i){return new uS(i)}function sy(i){return typeof i.getOpts=="function"}class fS{static encode(t){if(typeof t=="string")return btoa(t);const r=Array.from(t);return btoa(String.fromCharCode(...r))}static decode(t,r=!1){const s=atob(t);return r?Uint8Array.from(s,l=>l.charCodeAt(0)):s}}class Is{static encode(t){return Is.toB64URLEncoding(fS.encode(t))}static decode(t,r=!1){return Is.decode(Is.fromB64URLEncoding(t),r)}static toB64URLEncoding(t){return t.replace(/\+/g,"-").replace(/\//g,"_")}static fromB64URLEncoding(t){return t.replace(/_/g,"/").replace(/-/g,"+")}}class Vs{constructor(){A(this,"buffers");A(this,"byteLength");this.buffers=[],this.byteLength=0}static concat(...t){let r=0;for(let c=0;c<t.length;c++)r+=t[c].length;const s=new Uint8Array(r);let l=0;for(let c=0;c<t.length;c++)s.set(t[c],l),l+=t[c].length;return s}static fromAscii(t){return t||(t=""),Hi.encode(t)}static toAscii(t){return fn.decode(t)}reset(){this.buffers.length=0,this.byteLength=0}pack(){if(this.buffers.length>1){const t=new Uint8Array(this.byteLength);let r=0;for(let s=0;s<this.buffers.length;s++)t.set(this.buffers[s],r),r+=this.buffers[s].length;this.buffers.length=0,this.buffers.push(t)}}shift(){if(this.buffers.length){const t=this.buffers.shift();if(t)return this.byteLength-=t.length,t}return new Uint8Array(0)}drain(t){if(this.buffers.length){this.pack();const r=this.buffers.pop();if(r){const s=this.byteLength;(t===void 0||t>s)&&(t=s);const l=r.subarray(0,t);return s>t&&this.buffers.push(r.subarray(t)),this.byteLength=s-t,l}}return new Uint8Array(0)}fill(t,...r){t&&(this.buffers.push(t),this.byteLength+=t.length);for(let s=0;s<r.length;s++)r[s]&&r[s].length&&(this.buffers.push(r[s]),this.byteLength+=r[s].length)}peek(){return this.buffers.length?(this.pack(),this.buffers[0]):new Uint8Array(0)}size(){return this.byteLength}length(){return this.buffers.length}}function hS(i,t){return t.forEach(function(r){r&&typeof r!="string"&&!Array.isArray(r)&&Object.keys(r).forEach(function(s){if(s!=="default"&&!(s in i)){var l=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(i,s,l.get?l:{enumerable:!0,get:function(){return r[s]}})}})}),Object.freeze(i)}var dS=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},Fa=dS.performance||{};Fa.now||Fa.mozNow||Fa.msNow||Fa.oNow||Fa.webkitNow;var ay={versions:{}},mS=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function pS(i){if(i.__esModule)return i;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(i).forEach(function(r){var s=Object.getOwnPropertyDescriptor(i,r);Object.defineProperty(t,r,s.get?s:{enumerable:!0,get:function(){return i[r]}})}),t}var qh,fu={exports:{}},oy={},ly=pS(hS({__proto__:null,default:oy},[oy]));qh=fu,(function(){var i="input is invalid type",t=typeof window=="object",r=t?window:{};r.JS_SHA256_NO_WINDOW&&(t=!1);var s=!t&&typeof self=="object",l=!r.JS_SHA256_NO_NODE_JS&&ay.versions&&ay.versions.node;l?r=mS:s&&(r=self);var c=!r.JS_SHA256_NO_COMMON_JS&&qh.exports,d=!r.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",p="0123456789abcdef".split(""),y=[-2147483648,8388608,32768,128],f=[24,16,8,0],m=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],b=["hex","array","digest","arrayBuffer"],v=[];!r.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(C){return Object.prototype.toString.call(C)==="[object Array]"}),!d||!r.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(C){return typeof C=="object"&&C.buffer&&C.buffer.constructor===ArrayBuffer});var _=function(C,z){return function(re){return new U(z,!0).update(re)[C]()}},w=function(C){var z=_("hex",C);l&&(z=S(z,C)),z.create=function(){return new U(C)},z.update=function(L){return z.create().update(L)};for(var re=0;re<b.length;++re){var X=b[re];z[X]=_(X,C)}return z},S=function(C,z){var re,X=ly,L=ly.Buffer,G=z?"sha224":"sha256";return re=L.from&&!r.JS_SHA256_NO_BUFFER_FROM?L.from:function(W){return new L(W)},function(W){if(typeof W=="string")return X.createHash(G).update(W,"utf8").digest("hex");if(W==null)throw new Error(i);return W.constructor===ArrayBuffer&&(W=new Uint8Array(W)),Array.isArray(W)||ArrayBuffer.isView(W)||W.constructor===L?X.createHash(G).update(re(W)).digest("hex"):C(W)}},M=function(C,z){return function(re,X){return new ie(re,z,!0).update(X)[C]()}},B=function(C){var z=M("hex",C);z.create=function(L){return new ie(L,C)},z.update=function(L,G){return z.create(L).update(G)};for(var re=0;re<b.length;++re){var X=b[re];z[X]=M(X,C)}return z};function U(C,z){z?(v[0]=v[16]=v[1]=v[2]=v[3]=v[4]=v[5]=v[6]=v[7]=v[8]=v[9]=v[10]=v[11]=v[12]=v[13]=v[14]=v[15]=0,this.blocks=v):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],C?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=C}function ie(C,z,re){var X,L=typeof C;if(L==="string"){var G,W=[],Q=C.length,he=0;for(X=0;X<Q;++X)(G=C.charCodeAt(X))<128?W[he++]=G:G<2048?(W[he++]=192|G>>>6,W[he++]=128|63&G):G<55296||G>=57344?(W[he++]=224|G>>>12,W[he++]=128|G>>>6&63,W[he++]=128|63&G):(G=65536+((1023&G)<<10|1023&C.charCodeAt(++X)),W[he++]=240|G>>>18,W[he++]=128|G>>>12&63,W[he++]=128|G>>>6&63,W[he++]=128|63&G);C=W}else{if(L!=="object")throw new Error(i);if(C===null)throw new Error(i);if(d&&C.constructor===ArrayBuffer)C=new Uint8Array(C);else if(!(Array.isArray(C)||d&&ArrayBuffer.isView(C)))throw new Error(i)}C.length>64&&(C=new U(z,!0).update(C).array());var _e=[],Te=[];for(X=0;X<64;++X){var Y=C[X]||0;_e[X]=92^Y,Te[X]=54^Y}U.call(this,z,re),this.update(Te),this.oKeyPad=_e,this.inner=!0,this.sharedMemory=re}U.prototype.update=function(C){if(!this.finalized){var z,re=typeof C;if(re!=="string"){if(re!=="object")throw new Error(i);if(C===null)throw new Error(i);if(d&&C.constructor===ArrayBuffer)C=new Uint8Array(C);else if(!(Array.isArray(C)||d&&ArrayBuffer.isView(C)))throw new Error(i);z=!0}for(var X,L,G=0,W=C.length,Q=this.blocks;G<W;){if(this.hashed&&(this.hashed=!1,Q[0]=this.block,this.block=Q[16]=Q[1]=Q[2]=Q[3]=Q[4]=Q[5]=Q[6]=Q[7]=Q[8]=Q[9]=Q[10]=Q[11]=Q[12]=Q[13]=Q[14]=Q[15]=0),z)for(L=this.start;G<W&&L<64;++G)Q[L>>>2]|=C[G]<<f[3&L++];else for(L=this.start;G<W&&L<64;++G)(X=C.charCodeAt(G))<128?Q[L>>>2]|=X<<f[3&L++]:X<2048?(Q[L>>>2]|=(192|X>>>6)<<f[3&L++],Q[L>>>2]|=(128|63&X)<<f[3&L++]):X<55296||X>=57344?(Q[L>>>2]|=(224|X>>>12)<<f[3&L++],Q[L>>>2]|=(128|X>>>6&63)<<f[3&L++],Q[L>>>2]|=(128|63&X)<<f[3&L++]):(X=65536+((1023&X)<<10|1023&C.charCodeAt(++G)),Q[L>>>2]|=(240|X>>>18)<<f[3&L++],Q[L>>>2]|=(128|X>>>12&63)<<f[3&L++],Q[L>>>2]|=(128|X>>>6&63)<<f[3&L++],Q[L>>>2]|=(128|63&X)<<f[3&L++]);this.lastByteIndex=L,this.bytes+=L-this.start,L>=64?(this.block=Q[16],this.start=L-64,this.hash(),this.hashed=!0):this.start=L}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},U.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var C=this.blocks,z=this.lastByteIndex;C[16]=this.block,C[z>>>2]|=y[3&z],this.block=C[16],z>=56&&(this.hashed||this.hash(),C[0]=this.block,C[16]=C[1]=C[2]=C[3]=C[4]=C[5]=C[6]=C[7]=C[8]=C[9]=C[10]=C[11]=C[12]=C[13]=C[14]=C[15]=0),C[14]=this.hBytes<<3|this.bytes>>>29,C[15]=this.bytes<<3,this.hash()}},U.prototype.hash=function(){var C,z,re,X,L,G,W,Q,he,_e=this.h0,Te=this.h1,Y=this.h2,ae=this.h3,de=this.h4,Ae=this.h5,oe=this.h6,je=this.h7,Se=this.blocks;for(C=16;C<64;++C)z=((L=Se[C-15])>>>7|L<<25)^(L>>>18|L<<14)^L>>>3,re=((L=Se[C-2])>>>17|L<<15)^(L>>>19|L<<13)^L>>>10,Se[C]=Se[C-16]+z+Se[C-7]+re|0;for(he=Te&Y,C=0;C<64;C+=4)this.first?(this.is224?(G=300032,je=(L=Se[0]-1413257819)-150054599|0,ae=L+24177077|0):(G=704751109,je=(L=Se[0]-210244248)-1521486534|0,ae=L+143694565|0),this.first=!1):(z=(_e>>>2|_e<<30)^(_e>>>13|_e<<19)^(_e>>>22|_e<<10),X=(G=_e&Te)^_e&Y^he,je=ae+(L=je+(re=(de>>>6|de<<26)^(de>>>11|de<<21)^(de>>>25|de<<7))+(de&Ae^~de&oe)+m[C]+Se[C])|0,ae=L+(z+X)|0),z=(ae>>>2|ae<<30)^(ae>>>13|ae<<19)^(ae>>>22|ae<<10),X=(W=ae&_e)^ae&Te^G,oe=Y+(L=oe+(re=(je>>>6|je<<26)^(je>>>11|je<<21)^(je>>>25|je<<7))+(je&de^~je&Ae)+m[C+1]+Se[C+1])|0,z=((Y=L+(z+X)|0)>>>2|Y<<30)^(Y>>>13|Y<<19)^(Y>>>22|Y<<10),X=(Q=Y&ae)^Y&_e^W,Ae=Te+(L=Ae+(re=(oe>>>6|oe<<26)^(oe>>>11|oe<<21)^(oe>>>25|oe<<7))+(oe&je^~oe&de)+m[C+2]+Se[C+2])|0,z=((Te=L+(z+X)|0)>>>2|Te<<30)^(Te>>>13|Te<<19)^(Te>>>22|Te<<10),X=(he=Te&Y)^Te&ae^Q,de=_e+(L=de+(re=(Ae>>>6|Ae<<26)^(Ae>>>11|Ae<<21)^(Ae>>>25|Ae<<7))+(Ae&oe^~Ae&je)+m[C+3]+Se[C+3])|0,_e=L+(z+X)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+_e|0,this.h1=this.h1+Te|0,this.h2=this.h2+Y|0,this.h3=this.h3+ae|0,this.h4=this.h4+de|0,this.h5=this.h5+Ae|0,this.h6=this.h6+oe|0,this.h7=this.h7+je|0},U.prototype.hex=function(){this.finalize();var C=this.h0,z=this.h1,re=this.h2,X=this.h3,L=this.h4,G=this.h5,W=this.h6,Q=this.h7,he=p[C>>>28&15]+p[C>>>24&15]+p[C>>>20&15]+p[C>>>16&15]+p[C>>>12&15]+p[C>>>8&15]+p[C>>>4&15]+p[15&C]+p[z>>>28&15]+p[z>>>24&15]+p[z>>>20&15]+p[z>>>16&15]+p[z>>>12&15]+p[z>>>8&15]+p[z>>>4&15]+p[15&z]+p[re>>>28&15]+p[re>>>24&15]+p[re>>>20&15]+p[re>>>16&15]+p[re>>>12&15]+p[re>>>8&15]+p[re>>>4&15]+p[15&re]+p[X>>>28&15]+p[X>>>24&15]+p[X>>>20&15]+p[X>>>16&15]+p[X>>>12&15]+p[X>>>8&15]+p[X>>>4&15]+p[15&X]+p[L>>>28&15]+p[L>>>24&15]+p[L>>>20&15]+p[L>>>16&15]+p[L>>>12&15]+p[L>>>8&15]+p[L>>>4&15]+p[15&L]+p[G>>>28&15]+p[G>>>24&15]+p[G>>>20&15]+p[G>>>16&15]+p[G>>>12&15]+p[G>>>8&15]+p[G>>>4&15]+p[15&G]+p[W>>>28&15]+p[W>>>24&15]+p[W>>>20&15]+p[W>>>16&15]+p[W>>>12&15]+p[W>>>8&15]+p[W>>>4&15]+p[15&W];return this.is224||(he+=p[Q>>>28&15]+p[Q>>>24&15]+p[Q>>>20&15]+p[Q>>>16&15]+p[Q>>>12&15]+p[Q>>>8&15]+p[Q>>>4&15]+p[15&Q]),he},U.prototype.toString=U.prototype.hex,U.prototype.digest=function(){this.finalize();var C=this.h0,z=this.h1,re=this.h2,X=this.h3,L=this.h4,G=this.h5,W=this.h6,Q=this.h7,he=[C>>>24&255,C>>>16&255,C>>>8&255,255&C,z>>>24&255,z>>>16&255,z>>>8&255,255&z,re>>>24&255,re>>>16&255,re>>>8&255,255&re,X>>>24&255,X>>>16&255,X>>>8&255,255&X,L>>>24&255,L>>>16&255,L>>>8&255,255&L,G>>>24&255,G>>>16&255,G>>>8&255,255&G,W>>>24&255,W>>>16&255,W>>>8&255,255&W];return this.is224||he.push(Q>>>24&255,Q>>>16&255,Q>>>8&255,255&Q),he},U.prototype.array=U.prototype.digest,U.prototype.arrayBuffer=function(){this.finalize();var C=new ArrayBuffer(this.is224?28:32),z=new DataView(C);return z.setUint32(0,this.h0),z.setUint32(4,this.h1),z.setUint32(8,this.h2),z.setUint32(12,this.h3),z.setUint32(16,this.h4),z.setUint32(20,this.h5),z.setUint32(24,this.h6),this.is224||z.setUint32(28,this.h7),C},ie.prototype=new U,ie.prototype.finalize=function(){if(U.prototype.finalize.call(this),this.inner){this.inner=!1;var C=this.array();U.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(C),U.prototype.finalize.call(this)}};var ce=w();ce.sha256=ce,ce.sha224=w(!0),ce.sha256.hmac=B(),ce.sha224.hmac=B(!0),c?qh.exports=ce:(r.sha256=ce.sha256,r.sha224=ce.sha224)})();fu.exports;fu.exports.sha224;var cy=fu.exports.sha256;function id(i){return _S(i)}function gS(i){if(!/^[0-9A-Fa-f]+$/.test(i))return!1;const r=/^[0-9A-F]+$/.test(i),s=/^[0-9a-f]+$/.test(i);return r||s?i.length%2===0:!1}function yS(i){return/^[A-Za-z0-9\-_]*(={0,2})?$/.test(i)||/^[A-Za-z0-9+/]*(={0,2})?$/.test(i)}function bS(i){return gS(i)?"hex":yS(i)?"b64":""}function vS(i){if(i.length%2!==0)throw new Error("hex string must have an even length");const t=new Uint8Array(i.length/2);for(let r=0;r<i.length;r+=2)t[r/2]=parseInt(i.substring(r,r+2),16);return t}function xS(i){i=i.replace(/-/g,"+"),i=i.replace(/_/g,"/");const t=atob(i);return Uint8Array.from(t,r=>r.charCodeAt(0))}function _S(i){switch(bS(i)){case"hex":return vS(i);case"b64":return xS(i)}return null}function wS(i,t){const r=typeof i=="string"?id(i):i,s=typeof t=="string"?id(t):t;if(r===null||s===null||r.length!==s.length)return!1;for(let l=0;l<r.length;l++)if(r[l]!==s[l])return!1;return!0}class xb{constructor(t,r,s=!0){A(this,"token");A(this,"received");A(this,"ctx");A(this,"requestSubject");A(this,"mux");this.mux=t,this.requestSubject=r,this.received=0,this.token=fi.next(),s&&(this.ctx=new Error)}}class SS extends xb{constructor(r,s,l={maxWait:1e3}){super(r,s);A(this,"callback");A(this,"done");A(this,"timer");A(this,"max");A(this,"opts");if(this.opts=l,typeof this.opts.callback!="function")throw new Error("callback is required");this.callback=this.opts.callback,this.max=typeof l.maxMessages=="number"&&l.maxMessages>0?l.maxMessages:-1,this.done=st(),this.done.then(()=>{this.callback(null,null)}),this.timer=setTimeout(()=>{this.cancel()},l.maxWait)}cancel(r){r&&this.callback(r,null),clearTimeout(this.timer),this.mux.cancel(this),this.done.resolve()}resolver(r,s){r?(this.ctx&&(r.stack+=`
33
33
 
34
- ${this.ctx.stack}`),this.cancel(r)):(this.callback(null,s),this.opts.strategy===$n.Count&&(this.max--,this.max===0&&this.cancel()),this.opts.strategy===$n.JitterTimer&&(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.cancel()},this.opts.jitter||300)),this.opts.strategy===$n.SentinelMsg&&s&&s.data.length===0&&this.cancel())}}class vb extends bb{constructor(r,s,l={timeout:1e3},c=!0){super(r,s,c);A(this,"deferred");A(this,"timer");this.deferred=st(),this.timer=Gs(l.timeout,c)}resolver(r,s){this.timer&&this.timer.cancel(),r?(this.ctx&&(r.stack+=`
34
+ ${this.ctx.stack}`),this.cancel(r)):(this.callback(null,s),this.opts.strategy===$n.Count&&(this.max--,this.max===0&&this.cancel()),this.opts.strategy===$n.JitterTimer&&(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.cancel()},this.opts.jitter||300)),this.opts.strategy===$n.SentinelMsg&&s&&s.data.length===0&&this.cancel())}}class _b extends xb{constructor(r,s,l={timeout:1e3},c=!0){super(r,s,c);A(this,"deferred");A(this,"timer");this.deferred=st(),this.timer=Gs(l.timeout,c)}resolver(r,s){this.timer&&this.timer.cancel(),r?(this.ctx&&(r.stack+=`
35
35
 
36
- ${this.ctx.stack}`),this.deferred.reject(r)):this.deferred.resolve(s),this.cancel()}cancel(r){this.timer&&this.timer.cancel(),this.mux.cancel(this),this.deferred.reject(r||me.errorForCode(le.Cancelled))}}const wS="$JS.API";function SS(i){return i=i||{},i.domain&&(i.apiPrefix=`$JS.${i.domain}.API`,delete i.domain),cu({apiPrefix:wS,timeout:5e3},i)}class yo{constructor(t,r){A(this,"nc");A(this,"opts");A(this,"prefix");A(this,"timeout");A(this,"jc");this.nc=t,this.opts=SS(r),this._parseOpts(),this.prefix=this.opts.apiPrefix,this.timeout=this.opts.timeout,this.jc=Hn()}getOptions(){return Object.assign({},this.opts)}_parseOpts(){let t=this.opts.apiPrefix;if(!t||t.length===0)throw new Error("invalid empty prefix");t[t.length-1]==="."&&(t=t.substr(0,t.length-1)),this.opts.apiPrefix=t}async _request(t,r=null,s){s=s||{},s.timeout=this.timeout;let l=dn;r&&(l=this.jc.encode(r));let{retries:c}=s;c=c||1,c=c===-1?Number.MAX_SAFE_INTEGER:c;const d=Od();for(let p=0;p<c;p++)try{const g=await this.nc.request(t,l,s);return this.parseJsResponse(g)}catch(g){const f=g;if((f.code==="503"||f.code===le.Timeout)&&p+1<c)await Ys(d.backoff(p));else throw g}}async findStream(t){const r={subject:t},l=await this._request(`${this.prefix}.STREAM.NAMES`,r);if(!l.streams||l.streams.length!==1)throw new Error("no stream matches subject");return l.streams[0]}getConnection(){return this.nc}parseJsResponse(t){const r=this.jc.decode(t.data),s=r;if(s.error){const l=yb(s.error.code,s.error.description);if(l!==null)throw l.api_error=s.error,l}return r}}class ro{constructor(t,r,s,l){A(this,"err");A(this,"offset");A(this,"pageInfo");A(this,"subject");A(this,"jsm");A(this,"filter");A(this,"payload");if(!t)throw new Error("subject is required");this.subject=t,this.jsm=s,this.offset=0,this.pageInfo={},this.filter=r,this.payload=l||{}}async next(){if(this.err)return[];if(this.pageInfo&&this.offset>=this.pageInfo.total)return[];const t={offset:this.offset};this.payload&&Object.assign(t,this.payload);try{const r=await this.jsm._request(this.subject,t,{timeout:this.jsm.timeout});this.pageInfo=r;const s=this.countResponse(r);return s===0?[]:(this.offset+=s,this.filter(r))}catch(r){throw this.err=r,r}}countResponse(t){var r,s,l;switch(t==null?void 0:t.type){case"io.nats.jetstream.api.v1.stream_names_response":case"io.nats.jetstream.api.v1.stream_list_response":return((r=t.streams)==null?void 0:r.length)||0;case"io.nats.jetstream.api.v1.consumer_list_response":return((s=t.consumers)==null?void 0:s.length)||0;default:return console.error(`jslister.ts: unknown API response for paged output: ${t==null?void 0:t.type}`),((l=t.streams)==null?void 0:l.length)||0}return 0}async*[Symbol.asyncIterator](){let t=await this.next();for(;t.length>0;){for(const r of t)yield r;t=await this.next()}}}function $i(i=""){const t=i.match(/(\d+).(\d+).(\d+)/);if(t)return{major:parseInt(t[1]),minor:parseInt(t[2]),micro:parseInt(t[3])};throw new Error(`'${i}' is not a semver value`)}function id(i,t){return i.major<t.major?-1:i.major>t.major?1:i.minor<t.minor?-1:i.minor>t.minor?1:i.micro<t.micro?-1:i.micro>t.micro?1:0}var Ie;(function(i){i.JS_KV="js_kv",i.JS_OBJECTSTORE="js_objectstore",i.JS_PULL_MAX_BYTES="js_pull_max_bytes",i.JS_NEW_CONSUMER_CREATE_API="js_new_consumer_create",i.JS_ALLOW_DIRECT="js_allow_direct",i.JS_MULTIPLE_CONSUMER_FILTER="js_multiple_consumer_filter",i.JS_SIMPLIFICATION="js_simplification",i.JS_STREAM_CONSUMER_METADATA="js_stream_consumer_metadata",i.JS_CONSUMER_FILTER_SUBJECTS="js_consumer_filter_subjects",i.JS_STREAM_FIRST_SEQ="js_stream_first_seq",i.JS_STREAM_SUBJECT_TRANSFORM="js_stream_subject_transform",i.JS_STREAM_SOURCE_SUBJECT_TRANSFORM="js_stream_source_subject_transform",i.JS_STREAM_COMPRESSION="js_stream_compression",i.JS_DEFAULT_CONSUMER_LIMITS="js_default_consumer_limits",i.JS_BATCH_DIRECT_GET="js_batch_direct_get"})(Ie||(Ie={}));class ES{constructor(t){A(this,"server");A(this,"features");A(this,"disabled");this.features=new Map,this.disabled=[],this.update(t)}resetDisabled(){this.disabled.length=0,this.update(this.server)}disable(t){this.disabled.push(t),this.update(this.server)}isDisabled(t){return this.disabled.indexOf(t)!==-1}update(t){typeof t=="string"&&(t=$i(t)),this.server=t,this.set(Ie.JS_KV,"2.6.2"),this.set(Ie.JS_OBJECTSTORE,"2.6.3"),this.set(Ie.JS_PULL_MAX_BYTES,"2.8.3"),this.set(Ie.JS_NEW_CONSUMER_CREATE_API,"2.9.0"),this.set(Ie.JS_ALLOW_DIRECT,"2.9.0"),this.set(Ie.JS_MULTIPLE_CONSUMER_FILTER,"2.10.0"),this.set(Ie.JS_SIMPLIFICATION,"2.9.4"),this.set(Ie.JS_STREAM_CONSUMER_METADATA,"2.10.0"),this.set(Ie.JS_CONSUMER_FILTER_SUBJECTS,"2.10.0"),this.set(Ie.JS_STREAM_FIRST_SEQ,"2.10.0"),this.set(Ie.JS_STREAM_SUBJECT_TRANSFORM,"2.10.0"),this.set(Ie.JS_STREAM_SOURCE_SUBJECT_TRANSFORM,"2.10.0"),this.set(Ie.JS_STREAM_COMPRESSION,"2.10.0"),this.set(Ie.JS_DEFAULT_CONSUMER_LIMITS,"2.10.0"),this.set(Ie.JS_BATCH_DIRECT_GET,"2.11.0"),this.disabled.forEach(r=>{this.features.delete(r)})}set(t,r){this.features.set(t,{min:r,ok:id(this.server,$i(r))>=0})}get(t){return this.features.get(t)||{min:"unknown",ok:!1}}supports(t){var r;return((r=this.get(t))==null?void 0:r.ok)||!1}require(t){return typeof t=="string"&&(t=$i(t)),id(this.server,t)>=0}}class Zc extends yo{constructor(t,r){super(t,r)}async add(t,r,s=Qc.Create){if(Pt(t),r.deliver_group&&r.flow_control)throw new Error("jetstream flow control is not supported with queue groups");if(r.deliver_group&&r.idle_heartbeat)throw new Error("jetstream idle heartbeat is not supported with queue groups");const l={};l.config=r,l.stream_name=t,l.action=s,l.config.durable_name&&Us(l.config.durable_name);const c=this.nc;let{min:d,ok:p}=c.features.get(Ie.JS_NEW_CONSUMER_CREATE_API);const g=r.name===""?void 0:r.name;if(g&&!p)throw new Error(`consumer 'name' requires server ${d}`);if(g)try{uu("name",g)}catch(v){const _=v.message,w=_.indexOf("cannot contain");throw w!==-1?new Error(`consumer 'name' ${_.substring(w)}`):v}let f,m="";if(Array.isArray(r.filter_subjects)){const{min:v,ok:_}=c.features.get(Ie.JS_MULTIPLE_CONSUMER_FILTER);if(!_)throw new Error(`consumer 'filter_subjects' requires server ${v}`);p=!1}if(r.metadata){const{min:v,ok:_}=c.features.get(Ie.JS_STREAM_CONSUMER_METADATA);if(!_)throw new Error(`consumer 'metadata' requires server ${v}`)}if(p&&(m=r.name??r.durable_name??""),m!==""){let v=r.filter_subject??void 0;v===">"&&(v=void 0),f=v!==void 0?`${this.prefix}.CONSUMER.CREATE.${t}.${m}.${v}`:`${this.prefix}.CONSUMER.CREATE.${t}.${m}`}else f=r.durable_name?`${this.prefix}.CONSUMER.DURABLE.CREATE.${t}.${r.durable_name}`:`${this.prefix}.CONSUMER.CREATE.${t}`;return await this._request(f,l)}async update(t,r,s){const l=await this.info(t,r),c=s;return this.add(t,Object.assign(l.config,c),Qc.Update)}async info(t,r){return Pt(t),Us(r),await this._request(`${this.prefix}.CONSUMER.INFO.${t}.${r}`)}async delete(t,r){return Pt(t),Us(r),(await this._request(`${this.prefix}.CONSUMER.DELETE.${t}.${r}`)).success}list(t){Pt(t);const r=l=>l.consumers,s=`${this.prefix}.CONSUMER.LIST.${t}`;return new ro(s,r,this)}pause(t,r,s){const l=`${this.prefix}.CONSUMER.PAUSE.${t}.${r}`,c={pause_until:s.toISOString()};return this._request(l,c)}resume(t,r){return this.pause(t,r,new Date(0))}}function ks(i,t,r=!1){if(r===!0&&!i)throw me.errorForCode(le.ApiError,new Error(`${t} is not a function`));if(i&&typeof i!="function")throw me.errorForCode(le.ApiError,new Error(`${t} is not a function`))}class OS extends Tt{constructor(r,s,l){super();A(this,"sub");A(this,"adapter");A(this,"subIterDone");ks(l.adapter,"adapter",!0),this.adapter=l.adapter,l.callback&&ks(l.callback,"callback"),this.noIterator=typeof l.callback=="function",l.ingestionFilterFn&&(ks(l.ingestionFilterFn,"ingestionFilterFn"),this.ingestionFilterFn=l.ingestionFilterFn),l.protocolFilterFn&&(ks(l.protocolFilterFn,"protocolFilterFn"),this.protocolFilterFn=l.protocolFilterFn),l.dispatchedFn&&(ks(l.dispatchedFn,"dispatchedFn"),this.dispatchedFn=l.dispatchedFn),l.cleanupFn&&ks(l.cleanupFn,"cleanupFn");let c=(m,b)=>{this.callback(m,b)};if(l.callback){const m=l.callback;c=(b,v)=>{const[_,w]=this.adapter(b,v);if(_){m(_,null);return}const{ingest:S}=this.ingestionFilterFn?this.ingestionFilterFn(w,this):{ingest:!0};S&&(!this.protocolFilterFn||this.protocolFilterFn(w))&&(m(_,w),this.dispatchedFn&&w&&this.dispatchedFn(w))}}const{max:d,queue:p,timeout:g}=l,f={queue:p,timeout:g,callback:c};d&&d>0&&(f.max=d),this.sub=r.subscribe(s,f),l.cleanupFn&&(this.sub.cleanupFn=l.cleanupFn),this.noIterator||this.iterClosed.then(()=>{this.unsubscribe()}),this.subIterDone=st(),Promise.all([this.sub.closed,this.iterClosed]).then(()=>{this.subIterDone.resolve()}).catch(()=>{this.subIterDone.resolve()}),(async m=>{await m.closed,this.stop()})(this.sub).then().catch()}unsubscribe(r){this.sub.unsubscribe(r)}drain(){return this.sub.drain()}isDraining(){return this.sub.isDraining()}isClosed(){return this.sub.isClosed()}callback(r,s){this.sub.cancelTimeout();const[l,c]=this.adapter(r,s);l&&this.stop(l),c&&this.push(c)}getSubject(){return this.sub.getSubject()}getReceived(){return this.sub.getReceived()}getProcessed(){return this.sub.getProcessed()}getPending(){return this.sub.getPending()}getID(){return this.sub.getID()}getMax(){return this.sub.getMax()}get closed(){return this.sub.closed}}let hn;function AS(i){hn=i}function xb(){return hn!==void 0&&hn.defaultPort!==void 0?hn.defaultPort:4222}function qh(){return hn!==void 0&&hn.urlParseFn?hn.urlParseFn:void 0}function jS(){if(!hn||typeof hn.factory!="function")throw new Error("transport fn is not set");return hn.factory()}function sd(){return hn!==void 0&&hn.dnsResolveFn?hn.dnsResolveFn:void 0}const Ic=`\r
37
- `,Wc=Vs.fromAscii(Ic),TS=new Uint8Array(Wc)[0],NS=new Uint8Array(Wc)[1];function kS(i){for(let t=0;t<i.length;t++){const r=t+1;if(i.byteLength>r&&i[t]===TS&&i[r]===NS)return r+1}return 0}function CS(i){const t=kS(i);if(t>0){const s=new Uint8Array(i).slice(0,t);return fn.decode(s)}return""}const MS=4,_b=48,RS=65,DS=97;function qS(i,t,r,s){const l=new Uint8Array(16);return[0,0,0,0,0,0,0,0,0,0,255,255].forEach((d,p)=>{l[p]=d}),l[12]=i,l[13]=t,l[14]=r,l[15]=s,l}function ad(i){return BS(i)!==void 0}function BS(i){for(let t=0;t<i.length;t++)switch(i[t]){case".":return wb(i);case":":return LS(i)}}function wb(i){const t=new Uint8Array(4);for(let r=0;r<4;r++){if(i.length===0)return;if(r>0){if(i[0]!==".")return;i=i.substring(1)}const{n:s,c:l,ok:c}=zS(i);if(!c||s>255)return;i=i.substring(l),t[r]=s}return qS(t[0],t[1],t[2],t[3])}function LS(i){const t=new Uint8Array(16);let r=-1;if(i.length>=2&&i[0]===":"&&i[1]===":"&&(r=0,i=i.substring(2),i.length===0))return t;let s=0;for(;s<16;){const{n:l,c,ok:d}=US(i);if(!d||l>65535)return;if(c<i.length&&i[c]==="."){if(r<0&&s!=12||s+4>16)return;const p=wb(i);if(p===void 0)return;t[s]=p[12],t[s+1]=p[13],t[s+2]=p[14],t[s+3]=p[15],i="",s+=MS;break}if(t[s]=l>>8,t[s+1]=l,s+=2,i=i.substring(c),i.length===0)break;if(i[0]!==":"||i.length==1)return;if(i=i.substring(1),i[0]===":"){if(r>=0)return;if(r=s,i=i.substring(1),i.length===0)break}}if(i.length===0){if(s<16){if(r<0)return;const l=16-s;for(let c=s-1;c>=r;c--)t[c+l]=t[c];for(let c=r+l-1;c>=r;c--)t[c]=0}else if(r>=0)return;return t}}function zS(i){let t=0,r=0;for(t=0;t<i.length&&48<=i.charCodeAt(t)&&i.charCodeAt(t)<=57;t++)if(r=r*10+(i.charCodeAt(t)-_b),r>=16777215)return{n:16777215,c:t,ok:!1};return t===0?{n:0,c:0,ok:!1}:{n:r,c:t,ok:!0}}function US(i){let t=0,r=0;for(r=0;r<i.length;r++){if(48<=i.charCodeAt(r)&&i.charCodeAt(r)<=57)t*=16,t+=i.charCodeAt(r)-_b;else if(97<=i.charCodeAt(r)&&i.charCodeAt(r)<=102)t*=16,t+=i.charCodeAt(r)-DS+10;else if(65<=i.charCodeAt(r)&&i.charCodeAt(r)<=70)t*=16,t+=i.charCodeAt(r)-RS+10;else break;if(t>=16777215)return{n:0,c:r,ok:!1}}return r===0?{n:0,c:r,ok:!1}:{n:t,c:r,ok:!0}}function PS(i){return i.indexOf("[")!==-1||i.indexOf("::")!==-1?!1:i.indexOf(".")!==-1||i.split(":").length<=2}function od(i){return!PS(i)}function IS(i){const t="::FFFF:",r=i.toUpperCase().indexOf(t);if(r!==-1&&i.indexOf(".")!==-1){let s=i.substring(r+t.length);return s=s.replace("[",""),s.replace("]","")}return i}function $S(i){i=i.trim(),i.match(/^(.*:\/\/)(.*)/m)&&(i=i.replace(/^(.*:\/\/)(.*)/gm,"$2")),i=IS(i),od(i)&&i.indexOf("[")===-1&&(i=`[${i}]`);const t=od(i)?i.match(/(]:)(\d+)/):i.match(/(:)(\d+)/),r=t&&t.length===3&&t[1]&&t[2]?parseInt(t[2]):4222,s=r===80?"https":"http",l=new URL(`${s}://${i}`);l.port=`${r}`;let c=l.hostname;return c.charAt(0)==="["&&(c=c.substring(1,c.length-1)),{listen:l.host,hostname:c,port:r}}class oo{constructor(t,r=!1){A(this,"src");A(this,"listen");A(this,"hostname");A(this,"port");A(this,"didConnect");A(this,"reconnects");A(this,"lastConnect");A(this,"gossiped");A(this,"tlsName");A(this,"resolves");this.src=t,this.tlsName="";const s=$S(t);this.listen=s.listen,this.hostname=s.hostname,this.port=s.port,this.didConnect=!1,this.reconnects=0,this.lastConnect=0,this.gossiped=r}toString(){return this.listen}async resolve(t){if(!t.fn||t.resolve===!1)return[this];const r=[];if(ad(this.hostname))return[this];{const s=await t.fn(this.hostname);t.debug&&console.log(`resolve ${this.hostname} = ${s.join(",")}`);for(const l of s){const c=this.port===80?"https":"http",d=new URL(`${c}://${od(l)?"["+l+"]":l}`);d.port=`${this.port}`;const p=new oo(d.host,!1);p.tlsName=this.hostname,r.push(p)}}return t.randomize&&pb(r),this.resolves=r,r}}class HS{constructor(t=[],r={}){A(this,"firstSelect");A(this,"servers");A(this,"currentServer");A(this,"tlsName");A(this,"randomize");this.firstSelect=!0,this.servers=[],this.tlsName="",this.randomize=r.randomize||!1;const s=qh();t&&(t.forEach(l=>{l=s?s(l):l,this.servers.push(new oo(l))}),this.randomize&&(this.servers=pb(this.servers))),this.servers.length===0&&this.addServer(`${Qh}:${xb()}`,!1),this.currentServer=this.servers[0]}clear(){this.servers.length=0}updateTLSName(){const t=this.getCurrentServer();ad(t.hostname)||(this.tlsName=t.hostname,this.servers.forEach(r=>{r.gossiped&&(r.tlsName=this.tlsName)}))}getCurrentServer(){return this.currentServer}addServer(t,r=!1){const s=qh();t=s?s(t):t;const l=new oo(t,r);ad(l.hostname)&&(l.tlsName=this.tlsName),this.servers.push(l)}selectServer(){if(this.firstSelect)return this.firstSelect=!1,this.currentServer;const t=this.servers.shift();return t&&(this.servers.push(t),this.currentServer=t),t}removeCurrentServer(){this.removeServer(this.currentServer)}removeServer(t){if(t){const r=this.servers.indexOf(t);this.servers.splice(r,1)}}length(){return this.servers.length}next(){return this.servers.length?this.servers[0]:void 0}getServers(){return this.servers}update(t,r){const s=[];let l=[];const c=qh(),d=new Map;t.connect_urls&&t.connect_urls.length>0&&t.connect_urls.forEach(g=>{g=c?c(g,r):g;const f=new oo(g,!0);d.set(g,f)});const p=[];return this.servers.forEach((g,f)=>{const m=g.listen;g.gossiped&&this.currentServer.listen!==m&&d.get(m)===void 0&&p.push(f),d.delete(m)}),p.reverse(),p.forEach(g=>{const f=this.servers.splice(g,1);l=l.concat(f[0].listen)}),d.forEach((g,f)=>{this.servers.push(g),s.push(f)}),{added:s,deleted:l}}}class GS{constructor(){A(this,"baseInbox");A(this,"reqs");this.reqs=new Map}size(){return this.reqs.size}init(t){return this.baseInbox=`${Sr(t)}.`,this.baseInbox}add(t){isNaN(t.received)||(t.received=0),this.reqs.set(t.token,t)}get(t){return this.reqs.get(t)}cancel(t){this.reqs.delete(t.token)}getToken(t){const r=t.subject||"";return r.indexOf(this.baseInbox)===0?r.substring(this.baseInbox.length):null}all(){return Array.from(this.reqs.values())}handleError(t,r){if(r&&r.permissionContext){if(t)return this.all().forEach(l=>{l.resolver(r,{})}),!0;const s=r.permissionContext;if(s.operation==="publish"){const l=this.all().find(c=>c.requestSubject===s.subject);if(l)return l.resolver(r,{}),!0}}return!1}dispatcher(){return(t,r)=>{const s=this.getToken(r);if(s){const l=this.get(s);l&&(t===null&&r.headers&&(t=gb(r)),l.resolver(t,r))}}}close(){const t=me.errorForCode(le.Timeout);this.reqs.forEach(r=>{r.resolver(t,{})})}}class FS{constructor(t,r,s){A(this,"ph");A(this,"interval");A(this,"maxOut");A(this,"timer");A(this,"pendings");this.ph=t,this.interval=r,this.maxOut=s,this.pendings=[]}start(){this.cancel(),this._schedule()}cancel(t){this.timer&&(clearTimeout(this.timer),this.timer=void 0),this._reset(),t&&this.ph.disconnect()}_schedule(){this.timer=setTimeout(()=>{if(this.ph.dispatchStatus({type:zs.PingTimer,data:`${this.pendings.length+1}`}),this.pendings.length===this.maxOut){this.cancel(!0);return}const t=st();this.ph.flush(t).then(()=>{this._reset()}).catch(()=>{this.cancel()}),this.pendings.push(t),this._schedule()},this.interval)}_reset(){this.pendings=this.pendings.filter(t=>(t.resolve(),!1))}}class VS extends Error{constructor(t){super(t),this.name="AssertionError"}}function YS(i,t="Assertion failed."){if(!i)throw new VS(t)}const uy=32*1024,Bh=2**32-2;function Vl(i,t,r=0){const s=t.byteLength-r;return i.byteLength>s&&(i=i.subarray(0,s)),t.set(i,r),i.byteLength}class Lh{constructor(t){A(this,"_buf");A(this,"_off");if(this._off=0,t==null){this._buf=new Uint8Array(0);return}this._buf=new Uint8Array(t)}bytes(t={copy:!0}){return t.copy===!1?this._buf.subarray(this._off):this._buf.slice(this._off)}empty(){return this._buf.byteLength<=this._off}get length(){return this._buf.byteLength-this._off}get capacity(){return this._buf.buffer.byteLength}truncate(t){if(t===0){this.reset();return}if(t<0||t>this.length)throw Error("bytes.Buffer: truncation out of range");this._reslice(this._off+t)}reset(){this._reslice(0),this._off=0}_tryGrowByReslice(t){const r=this._buf.byteLength;return t<=this.capacity-r?(this._reslice(r+t),r):-1}_reslice(t){YS(t<=this._buf.buffer.byteLength),this._buf=new Uint8Array(this._buf.buffer,0,t)}readByte(){const t=new Uint8Array(1);return this.read(t)?t[0]:null}read(t){if(this.empty())return this.reset(),t.byteLength===0?0:null;const r=Vl(this._buf.subarray(this._off),t);return this._off+=r,r}writeByte(t){return this.write(Uint8Array.of(t))}writeString(t){return this.write(Hi.encode(t))}write(t){const r=this._grow(t.byteLength);return Vl(t,this._buf,r)}_grow(t){const r=this.length;r===0&&this._off!==0&&this.reset();const s=this._tryGrowByReslice(t);if(s>=0)return s;const l=this.capacity;if(t<=Math.floor(l/2)-r)Vl(this._buf.subarray(this._off),this._buf);else{if(l+t>Bh)throw new Error("The buffer cannot be grown beyond the maximum size.");{const c=new Uint8Array(Math.min(2*l+t,Bh));Vl(this._buf.subarray(this._off),c),this._buf=c}}return this._off=0,this._reslice(Math.min(r+t,Bh)),r}grow(t){if(t<0)throw Error("Buffer._grow: negative count");const r=this._grow(t);this._reslice(r)}readFrom(t){let r=0;const s=new Uint8Array(uy);for(;;){const l=this.capacity-this.length<uy,c=l?s:new Uint8Array(this._buf.buffer,this.length),d=t.read(c);if(d===null)return r;l?this.write(c.subarray(0,d)):this._reslice(this.length+d),r+=d}}}var It;(function(i){i[i.OK=0]="OK",i[i.ERR=1]="ERR",i[i.MSG=2]="MSG",i[i.INFO=3]="INFO",i[i.PING=4]="PING",i[i.PONG=5]="PONG"})(It||(It={}));function fy(){const i={};return i.sid=-1,i.hdr=-1,i.size=-1,i}const KS=48;class hy{constructor(t){A(this,"dispatcher");A(this,"state");A(this,"as");A(this,"drop");A(this,"hdr");A(this,"ma");A(this,"argBuf");A(this,"msgBuf");this.dispatcher=t,this.state=ue.OP_START,this.as=0,this.drop=0,this.hdr=0}parse(t){let r;for(r=0;r<t.length;r++){const s=t[r];switch(this.state){case ue.OP_START:switch(s){case fe.M:case fe.m:this.state=ue.OP_M,this.hdr=-1,this.ma=fy();break;case fe.H:case fe.h:this.state=ue.OP_H,this.hdr=0,this.ma=fy();break;case fe.P:case fe.p:this.state=ue.OP_P;break;case fe.PLUS:this.state=ue.OP_PLUS;break;case fe.MINUS:this.state=ue.OP_MINUS;break;case fe.I:case fe.i:this.state=ue.OP_I;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_H:switch(s){case fe.M:case fe.m:this.state=ue.OP_M;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_M:switch(s){case fe.S:case fe.s:this.state=ue.OP_MS;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_MS:switch(s){case fe.G:case fe.g:this.state=ue.OP_MSG;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_MSG:switch(s){case fe.SPACE:case fe.TAB:this.state=ue.OP_MSG_SPC;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_MSG_SPC:switch(s){case fe.SPACE:case fe.TAB:continue;default:this.state=ue.MSG_ARG,this.as=r}break;case ue.MSG_ARG:switch(s){case fe.CR:this.drop=1;break;case fe.NL:{const l=this.argBuf?this.argBuf.bytes():t.subarray(this.as,r-this.drop);this.processMsgArgs(l),this.drop=0,this.as=r+1,this.state=ue.MSG_PAYLOAD,r=this.as+this.ma.size-1;break}default:this.argBuf&&this.argBuf.writeByte(s)}break;case ue.MSG_PAYLOAD:if(this.msgBuf)if(this.msgBuf.length>=this.ma.size){const l=this.msgBuf.bytes({copy:!1});this.dispatcher.push({kind:It.MSG,msg:this.ma,data:l}),this.argBuf=void 0,this.msgBuf=void 0,this.state=ue.MSG_END}else{let l=this.ma.size-this.msgBuf.length;const c=t.length-r;c<l&&(l=c),l>0?(this.msgBuf.write(t.subarray(r,r+l)),r=r+l-1):this.msgBuf.writeByte(s)}else r-this.as>=this.ma.size&&(this.dispatcher.push({kind:It.MSG,msg:this.ma,data:t.subarray(this.as,r)}),this.argBuf=void 0,this.msgBuf=void 0,this.state=ue.MSG_END);break;case ue.MSG_END:switch(s){case fe.NL:this.drop=0,this.as=r+1,this.state=ue.OP_START;break;default:continue}break;case ue.OP_PLUS:switch(s){case fe.O:case fe.o:this.state=ue.OP_PLUS_O;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_PLUS_O:switch(s){case fe.K:case fe.k:this.state=ue.OP_PLUS_OK;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_PLUS_OK:switch(s){case fe.NL:this.dispatcher.push({kind:It.OK}),this.drop=0,this.state=ue.OP_START;break}break;case ue.OP_MINUS:switch(s){case fe.E:case fe.e:this.state=ue.OP_MINUS_E;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_MINUS_E:switch(s){case fe.R:case fe.r:this.state=ue.OP_MINUS_ER;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_MINUS_ER:switch(s){case fe.R:case fe.r:this.state=ue.OP_MINUS_ERR;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_MINUS_ERR:switch(s){case fe.SPACE:case fe.TAB:this.state=ue.OP_MINUS_ERR_SPC;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_MINUS_ERR_SPC:switch(s){case fe.SPACE:case fe.TAB:continue;default:this.state=ue.MINUS_ERR_ARG,this.as=r}break;case ue.MINUS_ERR_ARG:switch(s){case fe.CR:this.drop=1;break;case fe.NL:{let l;this.argBuf?(l=this.argBuf.bytes(),this.argBuf=void 0):l=t.subarray(this.as,r-this.drop),this.dispatcher.push({kind:It.ERR,data:l}),this.drop=0,this.as=r+1,this.state=ue.OP_START;break}default:this.argBuf&&this.argBuf.write(Uint8Array.of(s))}break;case ue.OP_P:switch(s){case fe.I:case fe.i:this.state=ue.OP_PI;break;case fe.O:case fe.o:this.state=ue.OP_PO;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_PO:switch(s){case fe.N:case fe.n:this.state=ue.OP_PON;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_PON:switch(s){case fe.G:case fe.g:this.state=ue.OP_PONG;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_PONG:switch(s){case fe.NL:this.dispatcher.push({kind:It.PONG}),this.drop=0,this.state=ue.OP_START;break}break;case ue.OP_PI:switch(s){case fe.N:case fe.n:this.state=ue.OP_PIN;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_PIN:switch(s){case fe.G:case fe.g:this.state=ue.OP_PING;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_PING:switch(s){case fe.NL:this.dispatcher.push({kind:It.PING}),this.drop=0,this.state=ue.OP_START;break}break;case ue.OP_I:switch(s){case fe.N:case fe.n:this.state=ue.OP_IN;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_IN:switch(s){case fe.F:case fe.f:this.state=ue.OP_INF;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_INF:switch(s){case fe.O:case fe.o:this.state=ue.OP_INFO;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_INFO:switch(s){case fe.SPACE:case fe.TAB:this.state=ue.OP_INFO_SPC;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_INFO_SPC:switch(s){case fe.SPACE:case fe.TAB:continue;default:this.state=ue.INFO_ARG,this.as=r}break;case ue.INFO_ARG:switch(s){case fe.CR:this.drop=1;break;case fe.NL:{let l;this.argBuf?(l=this.argBuf.bytes(),this.argBuf=void 0):l=t.subarray(this.as,r-this.drop),this.dispatcher.push({kind:It.INFO,data:l}),this.drop=0,this.as=r+1,this.state=ue.OP_START;break}default:this.argBuf&&this.argBuf.writeByte(s)}break;default:throw this.fail(t.subarray(r))}}(this.state===ue.MSG_ARG||this.state===ue.MINUS_ERR_ARG||this.state===ue.INFO_ARG)&&!this.argBuf&&(this.argBuf=new Lh(t.subarray(this.as,r-this.drop))),this.state===ue.MSG_PAYLOAD&&!this.msgBuf&&(this.argBuf||this.cloneMsgArg(),this.msgBuf=new Lh(t.subarray(this.as)))}cloneMsgArg(){const t=this.ma.subject.length,r=this.ma.reply?this.ma.reply.length:0,s=new Uint8Array(t+r);s.set(this.ma.subject),this.ma.reply&&s.set(this.ma.reply,t),this.argBuf=new Lh(s),this.ma.subject=s.subarray(0,t),this.ma.reply&&(this.ma.reply=s.subarray(t))}processMsgArgs(t){if(this.hdr>=0)return this.processHeaderMsgArgs(t);const r=[];let s=-1;for(let l=0;l<t.length;l++)switch(t[l]){case fe.SPACE:case fe.TAB:case fe.CR:case fe.NL:s>=0&&(r.push(t.subarray(s,l)),s=-1);break;default:s<0&&(s=l)}switch(s>=0&&r.push(t.subarray(s)),r.length){case 3:this.ma.subject=r[0],this.ma.sid=this.protoParseInt(r[1]),this.ma.reply=void 0,this.ma.size=this.protoParseInt(r[2]);break;case 4:this.ma.subject=r[0],this.ma.sid=this.protoParseInt(r[1]),this.ma.reply=r[2],this.ma.size=this.protoParseInt(r[3]);break;default:throw this.fail(t,"processMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(t,"processMsgArgs Bad or Missing Sid Error");if(this.ma.size<0)throw this.fail(t,"processMsgArgs Bad or Missing Size Error")}fail(t,r=""){return r?r=`${r} [${this.state}]`:r=`parse error [${this.state}]`,new Error(`${r}: ${fn.decode(t)}`)}processHeaderMsgArgs(t){const r=[];let s=-1;for(let l=0;l<t.length;l++)switch(t[l]){case fe.SPACE:case fe.TAB:case fe.CR:case fe.NL:s>=0&&(r.push(t.subarray(s,l)),s=-1);break;default:s<0&&(s=l)}switch(s>=0&&r.push(t.subarray(s)),r.length){case 4:this.ma.subject=r[0],this.ma.sid=this.protoParseInt(r[1]),this.ma.reply=void 0,this.ma.hdr=this.protoParseInt(r[2]),this.ma.size=this.protoParseInt(r[3]);break;case 5:this.ma.subject=r[0],this.ma.sid=this.protoParseInt(r[1]),this.ma.reply=r[2],this.ma.hdr=this.protoParseInt(r[3]),this.ma.size=this.protoParseInt(r[4]);break;default:throw this.fail(t,"processHeaderMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(t,"processHeaderMsgArgs Bad or Missing Sid Error");if(this.ma.hdr<0||this.ma.hdr>this.ma.size)throw this.fail(t,"processHeaderMsgArgs Bad or Missing Header Size Error");if(this.ma.size<0)throw this.fail(t,"processHeaderMsgArgs Bad or Missing Size Error")}protoParseInt(t){if(t.length===0)return-1;let r=0;for(let s=0;s<t.length;s++){if(t[s]<48||t[s]>57)return-1;r=r*10+(t[s]-KS)}return r}}var ue;(function(i){i[i.OP_START=0]="OP_START",i[i.OP_PLUS=1]="OP_PLUS",i[i.OP_PLUS_O=2]="OP_PLUS_O",i[i.OP_PLUS_OK=3]="OP_PLUS_OK",i[i.OP_MINUS=4]="OP_MINUS",i[i.OP_MINUS_E=5]="OP_MINUS_E",i[i.OP_MINUS_ER=6]="OP_MINUS_ER",i[i.OP_MINUS_ERR=7]="OP_MINUS_ERR",i[i.OP_MINUS_ERR_SPC=8]="OP_MINUS_ERR_SPC",i[i.MINUS_ERR_ARG=9]="MINUS_ERR_ARG",i[i.OP_M=10]="OP_M",i[i.OP_MS=11]="OP_MS",i[i.OP_MSG=12]="OP_MSG",i[i.OP_MSG_SPC=13]="OP_MSG_SPC",i[i.MSG_ARG=14]="MSG_ARG",i[i.MSG_PAYLOAD=15]="MSG_PAYLOAD",i[i.MSG_END=16]="MSG_END",i[i.OP_H=17]="OP_H",i[i.OP_P=18]="OP_P",i[i.OP_PI=19]="OP_PI",i[i.OP_PIN=20]="OP_PIN",i[i.OP_PING=21]="OP_PING",i[i.OP_PO=22]="OP_PO",i[i.OP_PON=23]="OP_PON",i[i.OP_PONG=24]="OP_PONG",i[i.OP_I=25]="OP_I",i[i.OP_IN=26]="OP_IN",i[i.OP_INF=27]="OP_INF",i[i.OP_INFO=28]="OP_INFO",i[i.OP_INFO_SPC=29]="OP_INFO_SPC",i[i.INFO_ARG=30]="INFO_ARG"})(ue||(ue={}));var fe;(function(i){i[i.CR=13]="CR",i[i.E=69]="E",i[i.e=101]="e",i[i.F=70]="F",i[i.f=102]="f",i[i.G=71]="G",i[i.g=103]="g",i[i.H=72]="H",i[i.h=104]="h",i[i.I=73]="I",i[i.i=105]="i",i[i.K=75]="K",i[i.k=107]="k",i[i.M=77]="M",i[i.m=109]="m",i[i.MINUS=45]="MINUS",i[i.N=78]="N",i[i.n=110]="n",i[i.NL=10]="NL",i[i.O=79]="O",i[i.o=111]="o",i[i.P=80]="P",i[i.p=112]="p",i[i.PLUS=43]="PLUS",i[i.R=82]="R",i[i.r=114]="r",i[i.S=83]="S",i[i.s=115]="s",i[i.SPACE=32]="SPACE",i[i.TAB=9]="TAB"})(fe||(fe={}));(function(i){var t=function(O,N){this.hi=O|0,this.lo=N|0},r=function(O){var N,T=new Float64Array(16);if(O)for(N=0;N<O.length;N++)T[N]=O[N];return T},s=function(){throw new Error("no PRNG")},l=new Uint8Array(16),c=new Uint8Array(32);c[0]=9;var d=r(),p=r([1]),g=r([56129,1]),f=r([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),m=r([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),b=r([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),v=r([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),_=r([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function w(O,N){return O<<N|O>>>32-N}function S(O,N){var T=O[N+3]&255;return T=T<<8|O[N+2]&255,T=T<<8|O[N+1]&255,T<<8|O[N+0]&255}function M(O,N){var T=O[N]<<24|O[N+1]<<16|O[N+2]<<8|O[N+3],k=O[N+4]<<24|O[N+5]<<16|O[N+6]<<8|O[N+7];return new t(T,k)}function B(O,N,T){var k;for(k=0;k<4;k++)O[N+k]=T&255,T>>>=8}function U(O,N,T){O[N]=T.hi>>24&255,O[N+1]=T.hi>>16&255,O[N+2]=T.hi>>8&255,O[N+3]=T.hi&255,O[N+4]=T.lo>>24&255,O[N+5]=T.lo>>16&255,O[N+6]=T.lo>>8&255,O[N+7]=T.lo&255}function ie(O,N,T,k,D){var I,te=0;for(I=0;I<D;I++)te|=O[N+I]^T[k+I];return(1&te-1>>>8)-1}function ce(O,N,T,k){return ie(O,N,T,k,16)}function C(O,N,T,k){return ie(O,N,T,k,32)}function z(O,N,T,k,D){var I=new Uint32Array(16),te=new Uint32Array(16),se=new Uint32Array(16),V=new Uint32Array(4),ee,pe,Re;for(ee=0;ee<4;ee++)te[5*ee]=S(k,4*ee),te[1+ee]=S(T,4*ee),te[6+ee]=S(N,4*ee),te[11+ee]=S(T,16+4*ee);for(ee=0;ee<16;ee++)se[ee]=te[ee];for(ee=0;ee<20;ee++){for(pe=0;pe<4;pe++){for(Re=0;Re<4;Re++)V[Re]=te[(5*pe+4*Re)%16];for(V[1]^=w(V[0]+V[3]|0,7),V[2]^=w(V[1]+V[0]|0,9),V[3]^=w(V[2]+V[1]|0,13),V[0]^=w(V[3]+V[2]|0,18),Re=0;Re<4;Re++)I[4*pe+(pe+Re)%4]=V[Re]}for(Re=0;Re<16;Re++)te[Re]=I[Re]}if(D){for(ee=0;ee<16;ee++)te[ee]=te[ee]+se[ee]|0;for(ee=0;ee<4;ee++)te[5*ee]=te[5*ee]-S(k,4*ee)|0,te[6+ee]=te[6+ee]-S(N,4*ee)|0;for(ee=0;ee<4;ee++)B(O,4*ee,te[5*ee]),B(O,16+4*ee,te[6+ee])}else for(ee=0;ee<16;ee++)B(O,4*ee,te[ee]+se[ee]|0)}function re(O,N,T,k){return z(O,N,T,k,!1),0}function X(O,N,T,k){return z(O,N,T,k,!0),0}var L=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function G(O,N,T,k,D,I,te){var se=new Uint8Array(16),V=new Uint8Array(64),ee,pe;if(!D)return 0;for(pe=0;pe<16;pe++)se[pe]=0;for(pe=0;pe<8;pe++)se[pe]=I[pe];for(;D>=64;){for(re(V,se,te,L),pe=0;pe<64;pe++)O[N+pe]=(T?T[k+pe]:0)^V[pe];for(ee=1,pe=8;pe<16;pe++)ee=ee+(se[pe]&255)|0,se[pe]=ee&255,ee>>>=8;D-=64,N+=64,T&&(k+=64)}if(D>0)for(re(V,se,te,L),pe=0;pe<D;pe++)O[N+pe]=(T?T[k+pe]:0)^V[pe];return 0}function W(O,N,T,k,D){return G(O,N,null,0,T,k,D)}function Q(O,N,T,k,D){var I=new Uint8Array(32);return X(I,k,D,L),W(O,N,T,k.subarray(16),I)}function he(O,N,T,k,D,I,te){var se=new Uint8Array(32);return X(se,I,te,L),G(O,N,T,k,D,I.subarray(16),se)}function _e(O,N){var T,k=0;for(T=0;T<17;T++)k=k+(O[T]+N[T]|0)|0,O[T]=k&255,k>>>=8}var Te=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]);function Y(O,N,T,k,D,I){var te,se,V,ee,pe=new Uint32Array(17),Re=new Uint32Array(17),We=new Uint32Array(17),Lt=new Uint32Array(17),Dn=new Uint32Array(17);for(V=0;V<17;V++)Re[V]=We[V]=0;for(V=0;V<16;V++)Re[V]=I[V];for(Re[3]&=15,Re[4]&=252,Re[7]&=15,Re[8]&=252,Re[11]&=15,Re[12]&=252,Re[15]&=15;D>0;){for(V=0;V<17;V++)Lt[V]=0;for(V=0;V<16&&V<D;++V)Lt[V]=T[k+V];for(Lt[V]=1,k+=V,D-=V,_e(We,Lt),se=0;se<17;se++)for(pe[se]=0,V=0;V<17;V++)pe[se]=pe[se]+We[V]*(V<=se?Re[se-V]:320*Re[se+17-V]|0)|0|0;for(se=0;se<17;se++)We[se]=pe[se];for(ee=0,V=0;V<16;V++)ee=ee+We[V]|0,We[V]=ee&255,ee>>>=8;for(ee=ee+We[16]|0,We[16]=ee&3,ee=5*(ee>>>2)|0,V=0;V<16;V++)ee=ee+We[V]|0,We[V]=ee&255,ee>>>=8;ee=ee+We[16]|0,We[16]=ee}for(V=0;V<17;V++)Dn[V]=We[V];for(_e(We,Te),te=-(We[16]>>>7)|0,V=0;V<17;V++)We[V]^=te&(Dn[V]^We[V]);for(V=0;V<16;V++)Lt[V]=I[V+16];for(Lt[16]=0,_e(We,Lt),V=0;V<16;V++)O[N+V]=We[V];return 0}function ae(O,N,T,k,D,I){var te=new Uint8Array(16);return Y(te,0,T,k,D,I),ce(O,N,te,0)}function de(O,N,T,k,D){var I;if(T<32)return-1;for(he(O,0,N,0,T,k,D),Y(O,16,O,32,T-32,O),I=0;I<16;I++)O[I]=0;return 0}function Oe(O,N,T,k,D){var I,te=new Uint8Array(32);if(T<32||(Q(te,0,32,k,D),ae(N,16,N,32,T-32,te)!==0))return-1;for(he(O,0,N,0,T,k,D),I=0;I<32;I++)O[I]=0;return 0}function oe(O,N){var T;for(T=0;T<16;T++)O[T]=N[T]|0}function je(O){var N,T;for(T=0;T<16;T++)O[T]+=65536,N=Math.floor(O[T]/65536),O[(T+1)*(T<15?1:0)]+=N-1+37*(N-1)*(T===15?1:0),O[T]-=N*65536}function Se(O,N,T){for(var k,D=~(T-1),I=0;I<16;I++)k=D&(O[I]^N[I]),O[I]^=k,N[I]^=k}function Ne(O,N){var T,k,D,I=r(),te=r();for(T=0;T<16;T++)te[T]=N[T];for(je(te),je(te),je(te),k=0;k<2;k++){for(I[0]=te[0]-65517,T=1;T<15;T++)I[T]=te[T]-65535-(I[T-1]>>16&1),I[T-1]&=65535;I[15]=te[15]-32767-(I[14]>>16&1),D=I[15]>>16&1,I[14]&=65535,Se(te,I,1-D)}for(T=0;T<16;T++)O[2*T]=te[T]&255,O[2*T+1]=te[T]>>8}function be(O,N){var T=new Uint8Array(32),k=new Uint8Array(32);return Ne(T,O),Ne(k,N),C(T,0,k,0)}function at(O){var N=new Uint8Array(32);return Ne(N,O),N[0]&1}function Ht(O,N){var T;for(T=0;T<16;T++)O[T]=N[2*T]+(N[2*T+1]<<8);O[15]&=32767}function Rt(O,N,T){var k;for(k=0;k<16;k++)O[k]=N[k]+T[k]|0}function Dt(O,N,T){var k;for(k=0;k<16;k++)O[k]=N[k]-T[k]|0}function ke(O,N,T){var k,D,I=new Float64Array(31);for(k=0;k<31;k++)I[k]=0;for(k=0;k<16;k++)for(D=0;D<16;D++)I[k+D]+=N[k]*T[D];for(k=0;k<15;k++)I[k]+=38*I[k+16];for(k=0;k<16;k++)O[k]=I[k];je(O),je(O)}function qt(O,N){ke(O,N,N)}function di(O,N){var T=r(),k;for(k=0;k<16;k++)T[k]=N[k];for(k=253;k>=0;k--)qt(T,T),k!==2&&k!==4&&ke(T,T,N);for(k=0;k<16;k++)O[k]=T[k]}function Gi(O,N){var T=r(),k;for(k=0;k<16;k++)T[k]=N[k];for(k=250;k>=0;k--)qt(T,T),k!==1&&ke(T,T,N);for(k=0;k<16;k++)O[k]=T[k]}function mi(O,N,T){var k=new Uint8Array(32),D=new Float64Array(80),I,te,se=r(),V=r(),ee=r(),pe=r(),Re=r(),We=r();for(te=0;te<31;te++)k[te]=N[te];for(k[31]=N[31]&127|64,k[0]&=248,Ht(D,T),te=0;te<16;te++)V[te]=D[te],pe[te]=se[te]=ee[te]=0;for(se[0]=pe[0]=1,te=254;te>=0;--te)I=k[te>>>3]>>>(te&7)&1,Se(se,V,I),Se(ee,pe,I),Rt(Re,se,ee),Dt(se,se,ee),Rt(ee,V,pe),Dt(V,V,pe),qt(pe,Re),qt(We,se),ke(se,ee,se),ke(ee,V,Re),Rt(Re,se,ee),Dt(se,se,ee),qt(V,se),Dt(ee,pe,We),ke(se,ee,g),Rt(se,se,pe),ke(ee,ee,se),ke(se,pe,We),ke(pe,V,D),qt(V,Re),Se(se,V,I),Se(ee,pe,I);for(te=0;te<16;te++)D[te+16]=se[te],D[te+32]=ee[te],D[te+48]=V[te],D[te+64]=pe[te];var Lt=D.subarray(32),Dn=D.subarray(16);return di(Lt,Lt),ke(Dn,Dn,Lt),Ne(O,Dn),0}function yn(O,N){return mi(O,N,c)}function Fi(O,N){return s(N,32),yn(O,N)}function Ar(O,N,T){var k=new Uint8Array(32);return mi(k,T,N),X(O,l,k,L)}var Eo=de,Oo=Oe;function Js(O,N,T,k,D,I){var te=new Uint8Array(32);return Ar(te,D,I),Eo(O,N,T,k,te)}function Qs(O,N,T,k,D,I){var te=new Uint8Array(32);return Ar(te,D,I),Oo(O,N,T,k,te)}function er(){var O=0,N=0,T=0,k=0,D=65535,I,te,se;for(se=0;se<arguments.length;se++)I=arguments[se].lo,te=arguments[se].hi,O+=I&D,N+=I>>>16,T+=te&D,k+=te>>>16;return N+=O>>>16,T+=N>>>16,k+=T>>>16,new t(T&D|k<<16,O&D|N<<16)}function Ao(O,N){return new t(O.hi>>>N,O.lo>>>N|O.hi<<32-N)}function Vi(){var O=0,N=0,T;for(T=0;T<arguments.length;T++)O^=arguments[T].lo,N^=arguments[T].hi;return new t(N,O)}function nt(O,N){var T,k,D=32-N;return N<32?(T=O.hi>>>N|O.lo<<D,k=O.lo>>>N|O.hi<<D):N<64&&(T=O.lo>>>N|O.hi<<D,k=O.hi>>>N|O.lo<<D),new t(T,k)}function bu(O,N,T){var k=O.hi&N.hi^~O.hi&T.hi,D=O.lo&N.lo^~O.lo&T.lo;return new t(k,D)}function jo(O,N,T){var k=O.hi&N.hi^O.hi&T.hi^N.hi&T.hi,D=O.lo&N.lo^O.lo&T.lo^N.lo&T.lo;return new t(k,D)}function To(O){return Vi(nt(O,28),nt(O,34),nt(O,39))}function Yi(O){return Vi(nt(O,14),nt(O,18),nt(O,41))}function vu(O){return Vi(nt(O,1),nt(O,8),Ao(O,7))}function No(O){return Vi(nt(O,19),nt(O,61),Ao(O,6))}var xu=[new t(1116352408,3609767458),new t(1899447441,602891725),new t(3049323471,3964484399),new t(3921009573,2173295548),new t(961987163,4081628472),new t(1508970993,3053834265),new t(2453635748,2937671579),new t(2870763221,3664609560),new t(3624381080,2734883394),new t(310598401,1164996542),new t(607225278,1323610764),new t(1426881987,3590304994),new t(1925078388,4068182383),new t(2162078206,991336113),new t(2614888103,633803317),new t(3248222580,3479774868),new t(3835390401,2666613458),new t(4022224774,944711139),new t(264347078,2341262773),new t(604807628,2007800933),new t(770255983,1495990901),new t(1249150122,1856431235),new t(1555081692,3175218132),new t(1996064986,2198950837),new t(2554220882,3999719339),new t(2821834349,766784016),new t(2952996808,2566594879),new t(3210313671,3203337956),new t(3336571891,1034457026),new t(3584528711,2466948901),new t(113926993,3758326383),new t(338241895,168717936),new t(666307205,1188179964),new t(773529912,1546045734),new t(1294757372,1522805485),new t(1396182291,2643833823),new t(1695183700,2343527390),new t(1986661051,1014477480),new t(2177026350,1206759142),new t(2456956037,344077627),new t(2730485921,1290863460),new t(2820302411,3158454273),new t(3259730800,3505952657),new t(3345764771,106217008),new t(3516065817,3606008344),new t(3600352804,1432725776),new t(4094571909,1467031594),new t(275423344,851169720),new t(430227734,3100823752),new t(506948616,1363258195),new t(659060556,3750685593),new t(883997877,3785050280),new t(958139571,3318307427),new t(1322822218,3812723403),new t(1537002063,2003034995),new t(1747873779,3602036899),new t(1955562222,1575990012),new t(2024104815,1125592928),new t(2227730452,2716904306),new t(2361852424,442776044),new t(2428436474,593698344),new t(2756734187,3733110249),new t(3204031479,2999351573),new t(3329325298,3815920427),new t(3391569614,3928383900),new t(3515267271,566280711),new t(3940187606,3454069534),new t(4118630271,4000239992),new t(116418474,1914138554),new t(174292421,2731055270),new t(289380356,3203993006),new t(460393269,320620315),new t(685471733,587496836),new t(852142971,1086792851),new t(1017036298,365543100),new t(1126000580,2618297676),new t(1288033470,3409855158),new t(1501505948,4234509866),new t(1607167915,987167468),new t(1816402316,1246189591)];function ko(O,N,T){var k=[],D=[],I=[],te=[],se,V,ee;for(V=0;V<8;V++)k[V]=I[V]=M(O,8*V);for(var pe=0;T>=128;){for(V=0;V<16;V++)te[V]=M(N,8*V+pe);for(V=0;V<80;V++){for(ee=0;ee<8;ee++)D[ee]=I[ee];for(se=er(I[7],Yi(I[4]),bu(I[4],I[5],I[6]),xu[V],te[V%16]),D[7]=er(se,To(I[0]),jo(I[0],I[1],I[2])),D[3]=er(D[3],se),ee=0;ee<8;ee++)I[(ee+1)%8]=D[ee];if(V%16===15)for(ee=0;ee<16;ee++)te[ee]=er(te[ee],te[(ee+9)%16],vu(te[(ee+1)%16]),No(te[(ee+14)%16]))}for(V=0;V<8;V++)I[V]=er(I[V],k[V]),k[V]=I[V];pe+=128,T-=128}for(V=0;V<8;V++)U(O,8*V,k[V]);return T}var pi=new Uint8Array([106,9,230,103,243,188,201,8,187,103,174,133,132,202,167,59,60,110,243,114,254,148,248,43,165,79,245,58,95,29,54,241,81,14,82,127,173,230,130,209,155,5,104,140,43,62,108,31,31,131,217,171,251,65,189,107,91,224,205,25,19,126,33,121]);function ft(O,N,T){var k=new Uint8Array(64),D=new Uint8Array(256),I,te=T;for(I=0;I<64;I++)k[I]=pi[I];for(ko(k,N,T),T%=128,I=0;I<256;I++)D[I]=0;for(I=0;I<T;I++)D[I]=N[te-T+I];for(D[T]=128,T=256-128*(T<112?1:0),D[T-9]=0,U(D,T-8,new t(te/536870912|0,te<<3)),ko(k,D,T),I=0;I<64;I++)O[I]=k[I];return 0}function Qt(O,N){var T=r(),k=r(),D=r(),I=r(),te=r(),se=r(),V=r(),ee=r(),pe=r();Dt(T,O[1],O[0]),Dt(pe,N[1],N[0]),ke(T,T,pe),Rt(k,O[0],O[1]),Rt(pe,N[0],N[1]),ke(k,k,pe),ke(D,O[3],N[3]),ke(D,D,m),ke(I,O[2],N[2]),Rt(I,I,I),Dt(te,k,T),Dt(se,I,D),Rt(V,I,D),Rt(ee,k,T),ke(O[0],te,se),ke(O[1],ee,V),ke(O[2],V,se),ke(O[3],te,ee)}function Bt(O,N,T){var k;for(k=0;k<4;k++)Se(O[k],N[k],T)}function Zs(O,N){var T=r(),k=r(),D=r();di(D,N[2]),ke(T,N[0],D),ke(k,N[1],D),Ne(O,k),O[31]^=at(T)<<7}function Ws(O,N,T){var k,D;for(oe(O[0],d),oe(O[1],p),oe(O[2],p),oe(O[3],d),D=255;D>=0;--D)k=T[D/8|0]>>(D&7)&1,Bt(O,N,k),Qt(N,O),Qt(O,O),Bt(O,N,k)}function Ki(O,N){var T=[r(),r(),r(),r()];oe(T[0],b),oe(T[1],v),oe(T[2],p),ke(T[3],b,v),Ws(O,T,N)}function jr(O,N,T){var k=new Uint8Array(64),D=[r(),r(),r(),r()],I;for(T||s(N,32),ft(k,N,32),k[0]&=248,k[31]&=127,k[31]|=64,Ki(D,k),Zs(O,D),I=0;I<32;I++)N[I+32]=O[I];return 0}var tr=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Tr(O,N){var T,k,D,I;for(k=63;k>=32;--k){for(T=0,D=k-32,I=k-12;D<I;++D)N[D]+=T-16*N[k]*tr[D-(k-32)],T=Math.floor((N[D]+128)/256),N[D]-=T*256;N[D]+=T,N[k]=0}for(T=0,D=0;D<32;D++)N[D]+=T-(N[31]>>4)*tr[D],T=N[D]>>8,N[D]&=255;for(D=0;D<32;D++)N[D]-=T*tr[D];for(k=0;k<32;k++)N[k+1]+=N[k]>>8,O[k]=N[k]&255}function Mn(O){var N=new Float64Array(64),T;for(T=0;T<64;T++)N[T]=O[T];for(T=0;T<64;T++)O[T]=0;Tr(O,N)}function gi(O,N,T,k){var D=new Uint8Array(64),I=new Uint8Array(64),te=new Uint8Array(64),se,V,ee=new Float64Array(64),pe=[r(),r(),r(),r()];ft(D,k,32),D[0]&=248,D[31]&=127,D[31]|=64;var Re=T+64;for(se=0;se<T;se++)O[64+se]=N[se];for(se=0;se<32;se++)O[32+se]=D[32+se];for(ft(te,O.subarray(32),T+32),Mn(te),Ki(pe,te),Zs(O,pe),se=32;se<64;se++)O[se]=k[se];for(ft(I,O,T+64),Mn(I),se=0;se<64;se++)ee[se]=0;for(se=0;se<32;se++)ee[se]=te[se];for(se=0;se<32;se++)for(V=0;V<32;V++)ee[se+V]+=I[se]*D[V];return Tr(O.subarray(32),ee),Re}function yi(O,N){var T=r(),k=r(),D=r(),I=r(),te=r(),se=r(),V=r();return oe(O[2],p),Ht(O[1],N),qt(D,O[1]),ke(I,D,f),Dt(D,D,O[2]),Rt(I,O[2],I),qt(te,I),qt(se,te),ke(V,se,te),ke(T,V,D),ke(T,T,I),Gi(T,T),ke(T,T,D),ke(T,T,I),ke(T,T,I),ke(O[0],T,I),qt(k,O[0]),ke(k,k,I),be(k,D)&&ke(O[0],O[0],_),qt(k,O[0]),ke(k,k,I),be(k,D)?-1:(at(O[0])===N[31]>>7&&Dt(O[0],d,O[0]),ke(O[3],O[0],O[1]),0)}function ea(O,N,T,k){var D,I=new Uint8Array(32),te=new Uint8Array(64),se=[r(),r(),r(),r()],V=[r(),r(),r(),r()];if(T<64||yi(V,k))return-1;for(D=0;D<T;D++)O[D]=N[D];for(D=0;D<32;D++)O[D+32]=k[D];if(ft(te,O,T),Mn(te),Ws(se,V,te),Ki(V,N.subarray(32)),Qt(se,V),Zs(I,se),T-=64,C(N,0,I,0)){for(D=0;D<T;D++)O[D]=0;return-1}for(D=0;D<T;D++)O[D]=N[D+64];return T}var Xi=32,Nr=24,Rn=32,kr=16,Cr=32,bi=32,Mr=32,nr=32,vi=32,ta=Nr,Co=Rn,Gn=kr,Qe=64,ot=32,Zt=64,xi=32,na=64;i.lowlevel={crypto_core_hsalsa20:X,crypto_stream_xor:he,crypto_stream:Q,crypto_stream_salsa20_xor:G,crypto_stream_salsa20:W,crypto_onetimeauth:Y,crypto_onetimeauth_verify:ae,crypto_verify_16:ce,crypto_verify_32:C,crypto_secretbox:de,crypto_secretbox_open:Oe,crypto_scalarmult:mi,crypto_scalarmult_base:yn,crypto_box_beforenm:Ar,crypto_box_afternm:Eo,crypto_box:Js,crypto_box_open:Qs,crypto_box_keypair:Fi,crypto_hash:ft,crypto_sign:gi,crypto_sign_keypair:jr,crypto_sign_open:ea,crypto_secretbox_KEYBYTES:Xi,crypto_secretbox_NONCEBYTES:Nr,crypto_secretbox_ZEROBYTES:Rn,crypto_secretbox_BOXZEROBYTES:kr,crypto_scalarmult_BYTES:Cr,crypto_scalarmult_SCALARBYTES:bi,crypto_box_PUBLICKEYBYTES:Mr,crypto_box_SECRETKEYBYTES:nr,crypto_box_BEFORENMBYTES:vi,crypto_box_NONCEBYTES:ta,crypto_box_ZEROBYTES:Co,crypto_box_BOXZEROBYTES:Gn,crypto_sign_BYTES:Qe,crypto_sign_PUBLICKEYBYTES:ot,crypto_sign_SECRETKEYBYTES:Zt,crypto_sign_SEEDBYTES:xi,crypto_hash_BYTES:na,gf:r,D:f,L:tr,pack25519:Ne,unpack25519:Ht,M:ke,A:Rt,S:qt,Z:Dt,pow2523:Gi,add:Qt,set25519:oe,modL:Tr,scalarmult:Ws,scalarbase:Ki};function Mo(O,N){if(O.length!==Xi)throw new Error("bad key size");if(N.length!==Nr)throw new Error("bad nonce size")}function Ro(O,N){if(O.length!==Mr)throw new Error("bad public key size");if(N.length!==nr)throw new Error("bad secret key size")}function wt(){for(var O=0;O<arguments.length;O++)if(!(arguments[O]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function Ji(O){for(var N=0;N<O.length;N++)O[N]=0}i.randomBytes=function(O){var N=new Uint8Array(O);return s(N,O),N},i.secretbox=function(O,N,T){wt(O,N,T),Mo(T,N);for(var k=new Uint8Array(Rn+O.length),D=new Uint8Array(k.length),I=0;I<O.length;I++)k[I+Rn]=O[I];return de(D,k,k.length,N,T),D.subarray(kr)},i.secretbox.open=function(O,N,T){wt(O,N,T),Mo(T,N);for(var k=new Uint8Array(kr+O.length),D=new Uint8Array(k.length),I=0;I<O.length;I++)k[I+kr]=O[I];return k.length<32||Oe(D,k,k.length,N,T)!==0?null:D.subarray(Rn)},i.secretbox.keyLength=Xi,i.secretbox.nonceLength=Nr,i.secretbox.overheadLength=kr,i.scalarMult=function(O,N){if(wt(O,N),O.length!==bi)throw new Error("bad n size");if(N.length!==Cr)throw new Error("bad p size");var T=new Uint8Array(Cr);return mi(T,O,N),T},i.scalarMult.base=function(O){if(wt(O),O.length!==bi)throw new Error("bad n size");var N=new Uint8Array(Cr);return yn(N,O),N},i.scalarMult.scalarLength=bi,i.scalarMult.groupElementLength=Cr,i.box=function(O,N,T,k){var D=i.box.before(T,k);return i.secretbox(O,N,D)},i.box.before=function(O,N){wt(O,N),Ro(O,N);var T=new Uint8Array(vi);return Ar(T,O,N),T},i.box.after=i.secretbox,i.box.open=function(O,N,T,k){var D=i.box.before(T,k);return i.secretbox.open(O,N,D)},i.box.open.after=i.secretbox.open,i.box.keyPair=function(){var O=new Uint8Array(Mr),N=new Uint8Array(nr);return Fi(O,N),{publicKey:O,secretKey:N}},i.box.keyPair.fromSecretKey=function(O){if(wt(O),O.length!==nr)throw new Error("bad secret key size");var N=new Uint8Array(Mr);return yn(N,O),{publicKey:N,secretKey:new Uint8Array(O)}},i.box.publicKeyLength=Mr,i.box.secretKeyLength=nr,i.box.sharedKeyLength=vi,i.box.nonceLength=ta,i.box.overheadLength=i.secretbox.overheadLength,i.sign=function(O,N){if(wt(O,N),N.length!==Zt)throw new Error("bad secret key size");var T=new Uint8Array(Qe+O.length);return gi(T,O,O.length,N),T},i.sign.open=function(O,N){if(wt(O,N),N.length!==ot)throw new Error("bad public key size");var T=new Uint8Array(O.length),k=ea(T,O,O.length,N);if(k<0)return null;for(var D=new Uint8Array(k),I=0;I<D.length;I++)D[I]=T[I];return D},i.sign.detached=function(O,N){for(var T=i.sign(O,N),k=new Uint8Array(Qe),D=0;D<k.length;D++)k[D]=T[D];return k},i.sign.detached.verify=function(O,N,T){if(wt(O,N,T),N.length!==Qe)throw new Error("bad signature size");if(T.length!==ot)throw new Error("bad public key size");var k=new Uint8Array(Qe+O.length),D=new Uint8Array(Qe+O.length),I;for(I=0;I<Qe;I++)k[I]=N[I];for(I=0;I<O.length;I++)k[I+Qe]=O[I];return ea(D,k,k.length,T)>=0},i.sign.keyPair=function(){var O=new Uint8Array(ot),N=new Uint8Array(Zt);return jr(O,N),{publicKey:O,secretKey:N}},i.sign.keyPair.fromSecretKey=function(O){if(wt(O),O.length!==Zt)throw new Error("bad secret key size");for(var N=new Uint8Array(ot),T=0;T<N.length;T++)N[T]=O[32+T];return{publicKey:N,secretKey:new Uint8Array(O)}},i.sign.keyPair.fromSeed=function(O){if(wt(O),O.length!==xi)throw new Error("bad seed size");for(var N=new Uint8Array(ot),T=new Uint8Array(Zt),k=0;k<32;k++)T[k]=O[k];return jr(N,T,!0),{publicKey:N,secretKey:T}},i.sign.publicKeyLength=ot,i.sign.secretKeyLength=Zt,i.sign.seedLength=xi,i.sign.signatureLength=Qe,i.hash=function(O){wt(O);var N=new Uint8Array(na);return ft(N,O,O.length),N},i.hash.hashLength=na,i.verify=function(O,N){return wt(O,N),O.length===0||N.length===0||O.length!==N.length?!1:ie(O,0,N,0,O.length)===0},i.setPRNG=function(O){s=O},(function(){var O=typeof globalThis<"u"?globalThis.crypto||globalThis.msCrypto:null;if(O&&O.getRandomValues){var N=65536;i.setPRNG(function(T,k){var D,I=new Uint8Array(k);for(D=0;D<k;D+=N)O.getRandomValues(I.subarray(D,D+Math.min(k-D,N)));for(D=0;D<k;D++)T[D]=I[D];Ji(I)})}else typeof require<"u"&&(O=require("crypto"),O&&O.randomBytes&&i.setPRNG(function(T,k){var D,I=O.randomBytes(k);for(D=0;D<k;D++)T[D]=I[D];Ji(I)}))})()})(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const Yl=typeof module<"u"&&module.exports?module.exports:globalThis.nacl;Yl.sign.keyPair.fromSeed,Yl.sign.detached,Yl.sign.detached.verify,Yl.randomBytes;var dy;(function(i){i.InvalidPrefixByte="nkeys: invalid prefix byte",i.InvalidKey="nkeys: invalid key",i.InvalidPublicKey="nkeys: invalid public key",i.InvalidSeedLen="nkeys: invalid seed length",i.InvalidSeed="nkeys: invalid seed",i.InvalidEncoding="nkeys: invalid encoded key",i.InvalidSignature="nkeys: signature verification failed",i.CannotSign="nkeys: cannot sign, no private key available",i.PublicKeyOnly="nkeys: no seed or private key available",i.InvalidChecksum="nkeys: invalid checksum",i.SerializationError="nkeys: serialization error",i.ApiError="nkeys: api error",i.ClearedPair="nkeys: pair is cleared"})(dy||(dy={}));var my;(function(i){i[i.Seed=144]="Seed",i[i.Private=120]="Private",i[i.Operator=112]="Operator",i[i.Server=104]="Server",i[i.Cluster=16]="Cluster",i[i.Account=0]="Account",i[i.User=160]="User"})(my||(my={}));function XS(i){return t=>{let r={};return i.forEach(s=>{const l=s(t)||{};r=Object.assign(r,l)}),r}}function JS(){return()=>{}}function QS(i,t){return()=>{const r=typeof i=="function"?i():i,s=typeof t=="function"?t():t;return{user:r,pass:s}}}function ZS(i){return()=>({auth_token:typeof i=="function"?i():i})}const Sb=120*1e3,WS=2,Eb=2*1e3;function eE(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:Sb,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:1e3,reconnectTimeWait:Eb,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function tE(i){const t=[];return typeof i.authenticator=="function"&&t.push(i.authenticator),Array.isArray(i.authenticator)&&t.push(...i.authenticator),i.token&&t.push(ZS(i.token)),i.user&&t.push(QS(i.user,i.pass)),t.length===0?JS():XS(t)}function nE(i){const t=`${Qh}:${xb()}`;if(i=i||{servers:[t]},i.servers=i.servers||[],typeof i.servers=="string"&&(i.servers=[i.servers]),i.servers.length>0&&i.port)throw new me("port and servers options are mutually exclusive",le.InvalidOption);i.servers.length===0&&i.port&&(i.servers=[`${Qh}:${i.port}`]),i.servers&&i.servers.length===0&&(i.servers=[t]);const r=cu(eE(),i);if(r.authenticator=tE(r),["reconnectDelayHandler","authenticator"].forEach(s=>{if(r[s]&&typeof r[s]!="function")throw new me(`${s} option should be a function`,le.NotFunction)}),r.reconnectDelayHandler||(r.reconnectDelayHandler=()=>{let s=r.tls?r.reconnectJitterTLS:r.reconnectJitter;return s&&(s++,s=Math.floor(Math.random()*s)),r.reconnectTimeWait+s}),r.inboxPrefix)try{Sr(r.inboxPrefix)}catch(s){throw new me(s.message,le.ApiError)}if(r.resolve===void 0&&(r.resolve=typeof sd()=="function"),r.resolve&&typeof sd()!="function")throw new me("'resolve' is not supported on this client",le.InvalidOption);return r}function rE(i,t){const{proto:r,tls_required:s,tls_available:l}=i;if((r===void 0||r<1)&&t.noEcho)throw new me("noEcho",le.ServerOptionNotAvailable);const c=s||l||!1;if(t.tls&&!c)throw new me("tls",le.ServerOptionNotAvailable)}const iE=1024*32,sE=/^INFO\s+([^\r\n]+)\r\n/i,aE=so(`PONG\r
36
+ ${this.ctx.stack}`),this.deferred.reject(r)):this.deferred.resolve(s),this.cancel()}cancel(r){this.timer&&this.timer.cancel(),this.mux.cancel(this),this.deferred.reject(r||me.errorForCode(le.Cancelled))}}const ES="$JS.API";function OS(i){return i=i||{},i.domain&&(i.apiPrefix=`$JS.${i.domain}.API`,delete i.domain),cu({apiPrefix:ES,timeout:5e3},i)}class yo{constructor(t,r){A(this,"nc");A(this,"opts");A(this,"prefix");A(this,"timeout");A(this,"jc");this.nc=t,this.opts=OS(r),this._parseOpts(),this.prefix=this.opts.apiPrefix,this.timeout=this.opts.timeout,this.jc=Hn()}getOptions(){return Object.assign({},this.opts)}_parseOpts(){let t=this.opts.apiPrefix;if(!t||t.length===0)throw new Error("invalid empty prefix");t[t.length-1]==="."&&(t=t.substr(0,t.length-1)),this.opts.apiPrefix=t}async _request(t,r=null,s){s=s||{},s.timeout=this.timeout;let l=mn;r&&(l=this.jc.encode(r));let{retries:c}=s;c=c||1,c=c===-1?Number.MAX_SAFE_INTEGER:c;const d=Ad();for(let p=0;p<c;p++)try{const y=await this.nc.request(t,l,s);return this.parseJsResponse(y)}catch(y){const f=y;if((f.code==="503"||f.code===le.Timeout)&&p+1<c)await Ys(d.backoff(p));else throw y}}async findStream(t){const r={subject:t},l=await this._request(`${this.prefix}.STREAM.NAMES`,r);if(!l.streams||l.streams.length!==1)throw new Error("no stream matches subject");return l.streams[0]}getConnection(){return this.nc}parseJsResponse(t){const r=this.jc.decode(t.data),s=r;if(s.error){const l=vb(s.error.code,s.error.description);if(l!==null)throw l.api_error=s.error,l}return r}}class ro{constructor(t,r,s,l){A(this,"err");A(this,"offset");A(this,"pageInfo");A(this,"subject");A(this,"jsm");A(this,"filter");A(this,"payload");if(!t)throw new Error("subject is required");this.subject=t,this.jsm=s,this.offset=0,this.pageInfo={},this.filter=r,this.payload=l||{}}async next(){if(this.err)return[];if(this.pageInfo&&this.offset>=this.pageInfo.total)return[];const t={offset:this.offset};this.payload&&Object.assign(t,this.payload);try{const r=await this.jsm._request(this.subject,t,{timeout:this.jsm.timeout});this.pageInfo=r;const s=this.countResponse(r);return s===0?[]:(this.offset+=s,this.filter(r))}catch(r){throw this.err=r,r}}countResponse(t){var r,s,l;switch(t==null?void 0:t.type){case"io.nats.jetstream.api.v1.stream_names_response":case"io.nats.jetstream.api.v1.stream_list_response":return((r=t.streams)==null?void 0:r.length)||0;case"io.nats.jetstream.api.v1.consumer_list_response":return((s=t.consumers)==null?void 0:s.length)||0;default:return console.error(`jslister.ts: unknown API response for paged output: ${t==null?void 0:t.type}`),((l=t.streams)==null?void 0:l.length)||0}return 0}async*[Symbol.asyncIterator](){let t=await this.next();for(;t.length>0;){for(const r of t)yield r;t=await this.next()}}}function $i(i=""){const t=i.match(/(\d+).(\d+).(\d+)/);if(t)return{major:parseInt(t[1]),minor:parseInt(t[2]),micro:parseInt(t[3])};throw new Error(`'${i}' is not a semver value`)}function sd(i,t){return i.major<t.major?-1:i.major>t.major?1:i.minor<t.minor?-1:i.minor>t.minor?1:i.micro<t.micro?-1:i.micro>t.micro?1:0}var Ie;(function(i){i.JS_KV="js_kv",i.JS_OBJECTSTORE="js_objectstore",i.JS_PULL_MAX_BYTES="js_pull_max_bytes",i.JS_NEW_CONSUMER_CREATE_API="js_new_consumer_create",i.JS_ALLOW_DIRECT="js_allow_direct",i.JS_MULTIPLE_CONSUMER_FILTER="js_multiple_consumer_filter",i.JS_SIMPLIFICATION="js_simplification",i.JS_STREAM_CONSUMER_METADATA="js_stream_consumer_metadata",i.JS_CONSUMER_FILTER_SUBJECTS="js_consumer_filter_subjects",i.JS_STREAM_FIRST_SEQ="js_stream_first_seq",i.JS_STREAM_SUBJECT_TRANSFORM="js_stream_subject_transform",i.JS_STREAM_SOURCE_SUBJECT_TRANSFORM="js_stream_source_subject_transform",i.JS_STREAM_COMPRESSION="js_stream_compression",i.JS_DEFAULT_CONSUMER_LIMITS="js_default_consumer_limits",i.JS_BATCH_DIRECT_GET="js_batch_direct_get"})(Ie||(Ie={}));class AS{constructor(t){A(this,"server");A(this,"features");A(this,"disabled");this.features=new Map,this.disabled=[],this.update(t)}resetDisabled(){this.disabled.length=0,this.update(this.server)}disable(t){this.disabled.push(t),this.update(this.server)}isDisabled(t){return this.disabled.indexOf(t)!==-1}update(t){typeof t=="string"&&(t=$i(t)),this.server=t,this.set(Ie.JS_KV,"2.6.2"),this.set(Ie.JS_OBJECTSTORE,"2.6.3"),this.set(Ie.JS_PULL_MAX_BYTES,"2.8.3"),this.set(Ie.JS_NEW_CONSUMER_CREATE_API,"2.9.0"),this.set(Ie.JS_ALLOW_DIRECT,"2.9.0"),this.set(Ie.JS_MULTIPLE_CONSUMER_FILTER,"2.10.0"),this.set(Ie.JS_SIMPLIFICATION,"2.9.4"),this.set(Ie.JS_STREAM_CONSUMER_METADATA,"2.10.0"),this.set(Ie.JS_CONSUMER_FILTER_SUBJECTS,"2.10.0"),this.set(Ie.JS_STREAM_FIRST_SEQ,"2.10.0"),this.set(Ie.JS_STREAM_SUBJECT_TRANSFORM,"2.10.0"),this.set(Ie.JS_STREAM_SOURCE_SUBJECT_TRANSFORM,"2.10.0"),this.set(Ie.JS_STREAM_COMPRESSION,"2.10.0"),this.set(Ie.JS_DEFAULT_CONSUMER_LIMITS,"2.10.0"),this.set(Ie.JS_BATCH_DIRECT_GET,"2.11.0"),this.disabled.forEach(r=>{this.features.delete(r)})}set(t,r){this.features.set(t,{min:r,ok:sd(this.server,$i(r))>=0})}get(t){return this.features.get(t)||{min:"unknown",ok:!1}}supports(t){var r;return((r=this.get(t))==null?void 0:r.ok)||!1}require(t){return typeof t=="string"&&(t=$i(t)),sd(this.server,t)>=0}}class Zc extends yo{constructor(t,r){super(t,r)}async add(t,r,s=Qc.Create){if(Pt(t),r.deliver_group&&r.flow_control)throw new Error("jetstream flow control is not supported with queue groups");if(r.deliver_group&&r.idle_heartbeat)throw new Error("jetstream idle heartbeat is not supported with queue groups");const l={};l.config=r,l.stream_name=t,l.action=s,l.config.durable_name&&Us(l.config.durable_name);const c=this.nc;let{min:d,ok:p}=c.features.get(Ie.JS_NEW_CONSUMER_CREATE_API);const y=r.name===""?void 0:r.name;if(y&&!p)throw new Error(`consumer 'name' requires server ${d}`);if(y)try{uu("name",y)}catch(v){const _=v.message,w=_.indexOf("cannot contain");throw w!==-1?new Error(`consumer 'name' ${_.substring(w)}`):v}let f,m="";if(Array.isArray(r.filter_subjects)){const{min:v,ok:_}=c.features.get(Ie.JS_MULTIPLE_CONSUMER_FILTER);if(!_)throw new Error(`consumer 'filter_subjects' requires server ${v}`);p=!1}if(r.metadata){const{min:v,ok:_}=c.features.get(Ie.JS_STREAM_CONSUMER_METADATA);if(!_)throw new Error(`consumer 'metadata' requires server ${v}`)}if(p&&(m=r.name??r.durable_name??""),m!==""){let v=r.filter_subject??void 0;v===">"&&(v=void 0),f=v!==void 0?`${this.prefix}.CONSUMER.CREATE.${t}.${m}.${v}`:`${this.prefix}.CONSUMER.CREATE.${t}.${m}`}else f=r.durable_name?`${this.prefix}.CONSUMER.DURABLE.CREATE.${t}.${r.durable_name}`:`${this.prefix}.CONSUMER.CREATE.${t}`;return await this._request(f,l)}async update(t,r,s){const l=await this.info(t,r),c=s;return this.add(t,Object.assign(l.config,c),Qc.Update)}async info(t,r){return Pt(t),Us(r),await this._request(`${this.prefix}.CONSUMER.INFO.${t}.${r}`)}async delete(t,r){return Pt(t),Us(r),(await this._request(`${this.prefix}.CONSUMER.DELETE.${t}.${r}`)).success}list(t){Pt(t);const r=l=>l.consumers,s=`${this.prefix}.CONSUMER.LIST.${t}`;return new ro(s,r,this)}pause(t,r,s){const l=`${this.prefix}.CONSUMER.PAUSE.${t}.${r}`,c={pause_until:s.toISOString()};return this._request(l,c)}resume(t,r){return this.pause(t,r,new Date(0))}}function ks(i,t,r=!1){if(r===!0&&!i)throw me.errorForCode(le.ApiError,new Error(`${t} is not a function`));if(i&&typeof i!="function")throw me.errorForCode(le.ApiError,new Error(`${t} is not a function`))}class jS extends Tt{constructor(r,s,l){super();A(this,"sub");A(this,"adapter");A(this,"subIterDone");ks(l.adapter,"adapter",!0),this.adapter=l.adapter,l.callback&&ks(l.callback,"callback"),this.noIterator=typeof l.callback=="function",l.ingestionFilterFn&&(ks(l.ingestionFilterFn,"ingestionFilterFn"),this.ingestionFilterFn=l.ingestionFilterFn),l.protocolFilterFn&&(ks(l.protocolFilterFn,"protocolFilterFn"),this.protocolFilterFn=l.protocolFilterFn),l.dispatchedFn&&(ks(l.dispatchedFn,"dispatchedFn"),this.dispatchedFn=l.dispatchedFn),l.cleanupFn&&ks(l.cleanupFn,"cleanupFn");let c=(m,b)=>{this.callback(m,b)};if(l.callback){const m=l.callback;c=(b,v)=>{const[_,w]=this.adapter(b,v);if(_){m(_,null);return}const{ingest:S}=this.ingestionFilterFn?this.ingestionFilterFn(w,this):{ingest:!0};S&&(!this.protocolFilterFn||this.protocolFilterFn(w))&&(m(_,w),this.dispatchedFn&&w&&this.dispatchedFn(w))}}const{max:d,queue:p,timeout:y}=l,f={queue:p,timeout:y,callback:c};d&&d>0&&(f.max=d),this.sub=r.subscribe(s,f),l.cleanupFn&&(this.sub.cleanupFn=l.cleanupFn),this.noIterator||this.iterClosed.then(()=>{this.unsubscribe()}),this.subIterDone=st(),Promise.all([this.sub.closed,this.iterClosed]).then(()=>{this.subIterDone.resolve()}).catch(()=>{this.subIterDone.resolve()}),(async m=>{await m.closed,this.stop()})(this.sub).then().catch()}unsubscribe(r){this.sub.unsubscribe(r)}drain(){return this.sub.drain()}isDraining(){return this.sub.isDraining()}isClosed(){return this.sub.isClosed()}callback(r,s){this.sub.cancelTimeout();const[l,c]=this.adapter(r,s);l&&this.stop(l),c&&this.push(c)}getSubject(){return this.sub.getSubject()}getReceived(){return this.sub.getReceived()}getProcessed(){return this.sub.getProcessed()}getPending(){return this.sub.getPending()}getID(){return this.sub.getID()}getMax(){return this.sub.getMax()}get closed(){return this.sub.closed}}let hn;function TS(i){hn=i}function wb(){return hn!==void 0&&hn.defaultPort!==void 0?hn.defaultPort:4222}function Bh(){return hn!==void 0&&hn.urlParseFn?hn.urlParseFn:void 0}function NS(){if(!hn||typeof hn.factory!="function")throw new Error("transport fn is not set");return hn.factory()}function ad(){return hn!==void 0&&hn.dnsResolveFn?hn.dnsResolveFn:void 0}const Ic=`\r
37
+ `,Wc=Vs.fromAscii(Ic),kS=new Uint8Array(Wc)[0],CS=new Uint8Array(Wc)[1];function MS(i){for(let t=0;t<i.length;t++){const r=t+1;if(i.byteLength>r&&i[t]===kS&&i[r]===CS)return r+1}return 0}function RS(i){const t=MS(i);if(t>0){const s=new Uint8Array(i).slice(0,t);return fn.decode(s)}return""}const DS=4,Sb=48,qS=65,BS=97;function LS(i,t,r,s){const l=new Uint8Array(16);return[0,0,0,0,0,0,0,0,0,0,255,255].forEach((d,p)=>{l[p]=d}),l[12]=i,l[13]=t,l[14]=r,l[15]=s,l}function od(i){return zS(i)!==void 0}function zS(i){for(let t=0;t<i.length;t++)switch(i[t]){case".":return Eb(i);case":":return US(i)}}function Eb(i){const t=new Uint8Array(4);for(let r=0;r<4;r++){if(i.length===0)return;if(r>0){if(i[0]!==".")return;i=i.substring(1)}const{n:s,c:l,ok:c}=PS(i);if(!c||s>255)return;i=i.substring(l),t[r]=s}return LS(t[0],t[1],t[2],t[3])}function US(i){const t=new Uint8Array(16);let r=-1;if(i.length>=2&&i[0]===":"&&i[1]===":"&&(r=0,i=i.substring(2),i.length===0))return t;let s=0;for(;s<16;){const{n:l,c,ok:d}=IS(i);if(!d||l>65535)return;if(c<i.length&&i[c]==="."){if(r<0&&s!=12||s+4>16)return;const p=Eb(i);if(p===void 0)return;t[s]=p[12],t[s+1]=p[13],t[s+2]=p[14],t[s+3]=p[15],i="",s+=DS;break}if(t[s]=l>>8,t[s+1]=l,s+=2,i=i.substring(c),i.length===0)break;if(i[0]!==":"||i.length==1)return;if(i=i.substring(1),i[0]===":"){if(r>=0)return;if(r=s,i=i.substring(1),i.length===0)break}}if(i.length===0){if(s<16){if(r<0)return;const l=16-s;for(let c=s-1;c>=r;c--)t[c+l]=t[c];for(let c=r+l-1;c>=r;c--)t[c]=0}else if(r>=0)return;return t}}function PS(i){let t=0,r=0;for(t=0;t<i.length&&48<=i.charCodeAt(t)&&i.charCodeAt(t)<=57;t++)if(r=r*10+(i.charCodeAt(t)-Sb),r>=16777215)return{n:16777215,c:t,ok:!1};return t===0?{n:0,c:0,ok:!1}:{n:r,c:t,ok:!0}}function IS(i){let t=0,r=0;for(r=0;r<i.length;r++){if(48<=i.charCodeAt(r)&&i.charCodeAt(r)<=57)t*=16,t+=i.charCodeAt(r)-Sb;else if(97<=i.charCodeAt(r)&&i.charCodeAt(r)<=102)t*=16,t+=i.charCodeAt(r)-BS+10;else if(65<=i.charCodeAt(r)&&i.charCodeAt(r)<=70)t*=16,t+=i.charCodeAt(r)-qS+10;else break;if(t>=16777215)return{n:0,c:r,ok:!1}}return r===0?{n:0,c:r,ok:!1}:{n:t,c:r,ok:!0}}function $S(i){return i.indexOf("[")!==-1||i.indexOf("::")!==-1?!1:i.indexOf(".")!==-1||i.split(":").length<=2}function ld(i){return!$S(i)}function HS(i){const t="::FFFF:",r=i.toUpperCase().indexOf(t);if(r!==-1&&i.indexOf(".")!==-1){let s=i.substring(r+t.length);return s=s.replace("[",""),s.replace("]","")}return i}function GS(i){i=i.trim(),i.match(/^(.*:\/\/)(.*)/m)&&(i=i.replace(/^(.*:\/\/)(.*)/gm,"$2")),i=HS(i),ld(i)&&i.indexOf("[")===-1&&(i=`[${i}]`);const t=ld(i)?i.match(/(]:)(\d+)/):i.match(/(:)(\d+)/),r=t&&t.length===3&&t[1]&&t[2]?parseInt(t[2]):4222,s=r===80?"https":"http",l=new URL(`${s}://${i}`);l.port=`${r}`;let c=l.hostname;return c.charAt(0)==="["&&(c=c.substring(1,c.length-1)),{listen:l.host,hostname:c,port:r}}class oo{constructor(t,r=!1){A(this,"src");A(this,"listen");A(this,"hostname");A(this,"port");A(this,"didConnect");A(this,"reconnects");A(this,"lastConnect");A(this,"gossiped");A(this,"tlsName");A(this,"resolves");this.src=t,this.tlsName="";const s=GS(t);this.listen=s.listen,this.hostname=s.hostname,this.port=s.port,this.didConnect=!1,this.reconnects=0,this.lastConnect=0,this.gossiped=r}toString(){return this.listen}async resolve(t){if(!t.fn||t.resolve===!1)return[this];const r=[];if(od(this.hostname))return[this];{const s=await t.fn(this.hostname);t.debug&&console.log(`resolve ${this.hostname} = ${s.join(",")}`);for(const l of s){const c=this.port===80?"https":"http",d=new URL(`${c}://${ld(l)?"["+l+"]":l}`);d.port=`${this.port}`;const p=new oo(d.host,!1);p.tlsName=this.hostname,r.push(p)}}return t.randomize&&yb(r),this.resolves=r,r}}class FS{constructor(t=[],r={}){A(this,"firstSelect");A(this,"servers");A(this,"currentServer");A(this,"tlsName");A(this,"randomize");this.firstSelect=!0,this.servers=[],this.tlsName="",this.randomize=r.randomize||!1;const s=Bh();t&&(t.forEach(l=>{l=s?s(l):l,this.servers.push(new oo(l))}),this.randomize&&(this.servers=yb(this.servers))),this.servers.length===0&&this.addServer(`${Zh}:${wb()}`,!1),this.currentServer=this.servers[0]}clear(){this.servers.length=0}updateTLSName(){const t=this.getCurrentServer();od(t.hostname)||(this.tlsName=t.hostname,this.servers.forEach(r=>{r.gossiped&&(r.tlsName=this.tlsName)}))}getCurrentServer(){return this.currentServer}addServer(t,r=!1){const s=Bh();t=s?s(t):t;const l=new oo(t,r);od(l.hostname)&&(l.tlsName=this.tlsName),this.servers.push(l)}selectServer(){if(this.firstSelect)return this.firstSelect=!1,this.currentServer;const t=this.servers.shift();return t&&(this.servers.push(t),this.currentServer=t),t}removeCurrentServer(){this.removeServer(this.currentServer)}removeServer(t){if(t){const r=this.servers.indexOf(t);this.servers.splice(r,1)}}length(){return this.servers.length}next(){return this.servers.length?this.servers[0]:void 0}getServers(){return this.servers}update(t,r){const s=[];let l=[];const c=Bh(),d=new Map;t.connect_urls&&t.connect_urls.length>0&&t.connect_urls.forEach(y=>{y=c?c(y,r):y;const f=new oo(y,!0);d.set(y,f)});const p=[];return this.servers.forEach((y,f)=>{const m=y.listen;y.gossiped&&this.currentServer.listen!==m&&d.get(m)===void 0&&p.push(f),d.delete(m)}),p.reverse(),p.forEach(y=>{const f=this.servers.splice(y,1);l=l.concat(f[0].listen)}),d.forEach((y,f)=>{this.servers.push(y),s.push(f)}),{added:s,deleted:l}}}class VS{constructor(){A(this,"baseInbox");A(this,"reqs");this.reqs=new Map}size(){return this.reqs.size}init(t){return this.baseInbox=`${Sr(t)}.`,this.baseInbox}add(t){isNaN(t.received)||(t.received=0),this.reqs.set(t.token,t)}get(t){return this.reqs.get(t)}cancel(t){this.reqs.delete(t.token)}getToken(t){const r=t.subject||"";return r.indexOf(this.baseInbox)===0?r.substring(this.baseInbox.length):null}all(){return Array.from(this.reqs.values())}handleError(t,r){if(r&&r.permissionContext){if(t)return this.all().forEach(l=>{l.resolver(r,{})}),!0;const s=r.permissionContext;if(s.operation==="publish"){const l=this.all().find(c=>c.requestSubject===s.subject);if(l)return l.resolver(r,{}),!0}}return!1}dispatcher(){return(t,r)=>{const s=this.getToken(r);if(s){const l=this.get(s);l&&(t===null&&r.headers&&(t=bb(r)),l.resolver(t,r))}}}close(){const t=me.errorForCode(le.Timeout);this.reqs.forEach(r=>{r.resolver(t,{})})}}class YS{constructor(t,r,s){A(this,"ph");A(this,"interval");A(this,"maxOut");A(this,"timer");A(this,"pendings");this.ph=t,this.interval=r,this.maxOut=s,this.pendings=[]}start(){this.cancel(),this._schedule()}cancel(t){this.timer&&(clearTimeout(this.timer),this.timer=void 0),this._reset(),t&&this.ph.disconnect()}_schedule(){this.timer=setTimeout(()=>{if(this.ph.dispatchStatus({type:zs.PingTimer,data:`${this.pendings.length+1}`}),this.pendings.length===this.maxOut){this.cancel(!0);return}const t=st();this.ph.flush(t).then(()=>{this._reset()}).catch(()=>{this.cancel()}),this.pendings.push(t),this._schedule()},this.interval)}_reset(){this.pendings=this.pendings.filter(t=>(t.resolve(),!1))}}class KS extends Error{constructor(t){super(t),this.name="AssertionError"}}function XS(i,t="Assertion failed."){if(!i)throw new KS(t)}const uy=32*1024,Lh=2**32-2;function Vl(i,t,r=0){const s=t.byteLength-r;return i.byteLength>s&&(i=i.subarray(0,s)),t.set(i,r),i.byteLength}class zh{constructor(t){A(this,"_buf");A(this,"_off");if(this._off=0,t==null){this._buf=new Uint8Array(0);return}this._buf=new Uint8Array(t)}bytes(t={copy:!0}){return t.copy===!1?this._buf.subarray(this._off):this._buf.slice(this._off)}empty(){return this._buf.byteLength<=this._off}get length(){return this._buf.byteLength-this._off}get capacity(){return this._buf.buffer.byteLength}truncate(t){if(t===0){this.reset();return}if(t<0||t>this.length)throw Error("bytes.Buffer: truncation out of range");this._reslice(this._off+t)}reset(){this._reslice(0),this._off=0}_tryGrowByReslice(t){const r=this._buf.byteLength;return t<=this.capacity-r?(this._reslice(r+t),r):-1}_reslice(t){XS(t<=this._buf.buffer.byteLength),this._buf=new Uint8Array(this._buf.buffer,0,t)}readByte(){const t=new Uint8Array(1);return this.read(t)?t[0]:null}read(t){if(this.empty())return this.reset(),t.byteLength===0?0:null;const r=Vl(this._buf.subarray(this._off),t);return this._off+=r,r}writeByte(t){return this.write(Uint8Array.of(t))}writeString(t){return this.write(Hi.encode(t))}write(t){const r=this._grow(t.byteLength);return Vl(t,this._buf,r)}_grow(t){const r=this.length;r===0&&this._off!==0&&this.reset();const s=this._tryGrowByReslice(t);if(s>=0)return s;const l=this.capacity;if(t<=Math.floor(l/2)-r)Vl(this._buf.subarray(this._off),this._buf);else{if(l+t>Lh)throw new Error("The buffer cannot be grown beyond the maximum size.");{const c=new Uint8Array(Math.min(2*l+t,Lh));Vl(this._buf.subarray(this._off),c),this._buf=c}}return this._off=0,this._reslice(Math.min(r+t,Lh)),r}grow(t){if(t<0)throw Error("Buffer._grow: negative count");const r=this._grow(t);this._reslice(r)}readFrom(t){let r=0;const s=new Uint8Array(uy);for(;;){const l=this.capacity-this.length<uy,c=l?s:new Uint8Array(this._buf.buffer,this.length),d=t.read(c);if(d===null)return r;l?this.write(c.subarray(0,d)):this._reslice(this.length+d),r+=d}}}var It;(function(i){i[i.OK=0]="OK",i[i.ERR=1]="ERR",i[i.MSG=2]="MSG",i[i.INFO=3]="INFO",i[i.PING=4]="PING",i[i.PONG=5]="PONG"})(It||(It={}));function fy(){const i={};return i.sid=-1,i.hdr=-1,i.size=-1,i}const JS=48;class hy{constructor(t){A(this,"dispatcher");A(this,"state");A(this,"as");A(this,"drop");A(this,"hdr");A(this,"ma");A(this,"argBuf");A(this,"msgBuf");this.dispatcher=t,this.state=ue.OP_START,this.as=0,this.drop=0,this.hdr=0}parse(t){let r;for(r=0;r<t.length;r++){const s=t[r];switch(this.state){case ue.OP_START:switch(s){case fe.M:case fe.m:this.state=ue.OP_M,this.hdr=-1,this.ma=fy();break;case fe.H:case fe.h:this.state=ue.OP_H,this.hdr=0,this.ma=fy();break;case fe.P:case fe.p:this.state=ue.OP_P;break;case fe.PLUS:this.state=ue.OP_PLUS;break;case fe.MINUS:this.state=ue.OP_MINUS;break;case fe.I:case fe.i:this.state=ue.OP_I;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_H:switch(s){case fe.M:case fe.m:this.state=ue.OP_M;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_M:switch(s){case fe.S:case fe.s:this.state=ue.OP_MS;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_MS:switch(s){case fe.G:case fe.g:this.state=ue.OP_MSG;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_MSG:switch(s){case fe.SPACE:case fe.TAB:this.state=ue.OP_MSG_SPC;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_MSG_SPC:switch(s){case fe.SPACE:case fe.TAB:continue;default:this.state=ue.MSG_ARG,this.as=r}break;case ue.MSG_ARG:switch(s){case fe.CR:this.drop=1;break;case fe.NL:{const l=this.argBuf?this.argBuf.bytes():t.subarray(this.as,r-this.drop);this.processMsgArgs(l),this.drop=0,this.as=r+1,this.state=ue.MSG_PAYLOAD,r=this.as+this.ma.size-1;break}default:this.argBuf&&this.argBuf.writeByte(s)}break;case ue.MSG_PAYLOAD:if(this.msgBuf)if(this.msgBuf.length>=this.ma.size){const l=this.msgBuf.bytes({copy:!1});this.dispatcher.push({kind:It.MSG,msg:this.ma,data:l}),this.argBuf=void 0,this.msgBuf=void 0,this.state=ue.MSG_END}else{let l=this.ma.size-this.msgBuf.length;const c=t.length-r;c<l&&(l=c),l>0?(this.msgBuf.write(t.subarray(r,r+l)),r=r+l-1):this.msgBuf.writeByte(s)}else r-this.as>=this.ma.size&&(this.dispatcher.push({kind:It.MSG,msg:this.ma,data:t.subarray(this.as,r)}),this.argBuf=void 0,this.msgBuf=void 0,this.state=ue.MSG_END);break;case ue.MSG_END:switch(s){case fe.NL:this.drop=0,this.as=r+1,this.state=ue.OP_START;break;default:continue}break;case ue.OP_PLUS:switch(s){case fe.O:case fe.o:this.state=ue.OP_PLUS_O;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_PLUS_O:switch(s){case fe.K:case fe.k:this.state=ue.OP_PLUS_OK;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_PLUS_OK:switch(s){case fe.NL:this.dispatcher.push({kind:It.OK}),this.drop=0,this.state=ue.OP_START;break}break;case ue.OP_MINUS:switch(s){case fe.E:case fe.e:this.state=ue.OP_MINUS_E;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_MINUS_E:switch(s){case fe.R:case fe.r:this.state=ue.OP_MINUS_ER;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_MINUS_ER:switch(s){case fe.R:case fe.r:this.state=ue.OP_MINUS_ERR;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_MINUS_ERR:switch(s){case fe.SPACE:case fe.TAB:this.state=ue.OP_MINUS_ERR_SPC;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_MINUS_ERR_SPC:switch(s){case fe.SPACE:case fe.TAB:continue;default:this.state=ue.MINUS_ERR_ARG,this.as=r}break;case ue.MINUS_ERR_ARG:switch(s){case fe.CR:this.drop=1;break;case fe.NL:{let l;this.argBuf?(l=this.argBuf.bytes(),this.argBuf=void 0):l=t.subarray(this.as,r-this.drop),this.dispatcher.push({kind:It.ERR,data:l}),this.drop=0,this.as=r+1,this.state=ue.OP_START;break}default:this.argBuf&&this.argBuf.write(Uint8Array.of(s))}break;case ue.OP_P:switch(s){case fe.I:case fe.i:this.state=ue.OP_PI;break;case fe.O:case fe.o:this.state=ue.OP_PO;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_PO:switch(s){case fe.N:case fe.n:this.state=ue.OP_PON;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_PON:switch(s){case fe.G:case fe.g:this.state=ue.OP_PONG;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_PONG:switch(s){case fe.NL:this.dispatcher.push({kind:It.PONG}),this.drop=0,this.state=ue.OP_START;break}break;case ue.OP_PI:switch(s){case fe.N:case fe.n:this.state=ue.OP_PIN;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_PIN:switch(s){case fe.G:case fe.g:this.state=ue.OP_PING;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_PING:switch(s){case fe.NL:this.dispatcher.push({kind:It.PING}),this.drop=0,this.state=ue.OP_START;break}break;case ue.OP_I:switch(s){case fe.N:case fe.n:this.state=ue.OP_IN;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_IN:switch(s){case fe.F:case fe.f:this.state=ue.OP_INF;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_INF:switch(s){case fe.O:case fe.o:this.state=ue.OP_INFO;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_INFO:switch(s){case fe.SPACE:case fe.TAB:this.state=ue.OP_INFO_SPC;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_INFO_SPC:switch(s){case fe.SPACE:case fe.TAB:continue;default:this.state=ue.INFO_ARG,this.as=r}break;case ue.INFO_ARG:switch(s){case fe.CR:this.drop=1;break;case fe.NL:{let l;this.argBuf?(l=this.argBuf.bytes(),this.argBuf=void 0):l=t.subarray(this.as,r-this.drop),this.dispatcher.push({kind:It.INFO,data:l}),this.drop=0,this.as=r+1,this.state=ue.OP_START;break}default:this.argBuf&&this.argBuf.writeByte(s)}break;default:throw this.fail(t.subarray(r))}}(this.state===ue.MSG_ARG||this.state===ue.MINUS_ERR_ARG||this.state===ue.INFO_ARG)&&!this.argBuf&&(this.argBuf=new zh(t.subarray(this.as,r-this.drop))),this.state===ue.MSG_PAYLOAD&&!this.msgBuf&&(this.argBuf||this.cloneMsgArg(),this.msgBuf=new zh(t.subarray(this.as)))}cloneMsgArg(){const t=this.ma.subject.length,r=this.ma.reply?this.ma.reply.length:0,s=new Uint8Array(t+r);s.set(this.ma.subject),this.ma.reply&&s.set(this.ma.reply,t),this.argBuf=new zh(s),this.ma.subject=s.subarray(0,t),this.ma.reply&&(this.ma.reply=s.subarray(t))}processMsgArgs(t){if(this.hdr>=0)return this.processHeaderMsgArgs(t);const r=[];let s=-1;for(let l=0;l<t.length;l++)switch(t[l]){case fe.SPACE:case fe.TAB:case fe.CR:case fe.NL:s>=0&&(r.push(t.subarray(s,l)),s=-1);break;default:s<0&&(s=l)}switch(s>=0&&r.push(t.subarray(s)),r.length){case 3:this.ma.subject=r[0],this.ma.sid=this.protoParseInt(r[1]),this.ma.reply=void 0,this.ma.size=this.protoParseInt(r[2]);break;case 4:this.ma.subject=r[0],this.ma.sid=this.protoParseInt(r[1]),this.ma.reply=r[2],this.ma.size=this.protoParseInt(r[3]);break;default:throw this.fail(t,"processMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(t,"processMsgArgs Bad or Missing Sid Error");if(this.ma.size<0)throw this.fail(t,"processMsgArgs Bad or Missing Size Error")}fail(t,r=""){return r?r=`${r} [${this.state}]`:r=`parse error [${this.state}]`,new Error(`${r}: ${fn.decode(t)}`)}processHeaderMsgArgs(t){const r=[];let s=-1;for(let l=0;l<t.length;l++)switch(t[l]){case fe.SPACE:case fe.TAB:case fe.CR:case fe.NL:s>=0&&(r.push(t.subarray(s,l)),s=-1);break;default:s<0&&(s=l)}switch(s>=0&&r.push(t.subarray(s)),r.length){case 4:this.ma.subject=r[0],this.ma.sid=this.protoParseInt(r[1]),this.ma.reply=void 0,this.ma.hdr=this.protoParseInt(r[2]),this.ma.size=this.protoParseInt(r[3]);break;case 5:this.ma.subject=r[0],this.ma.sid=this.protoParseInt(r[1]),this.ma.reply=r[2],this.ma.hdr=this.protoParseInt(r[3]),this.ma.size=this.protoParseInt(r[4]);break;default:throw this.fail(t,"processHeaderMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(t,"processHeaderMsgArgs Bad or Missing Sid Error");if(this.ma.hdr<0||this.ma.hdr>this.ma.size)throw this.fail(t,"processHeaderMsgArgs Bad or Missing Header Size Error");if(this.ma.size<0)throw this.fail(t,"processHeaderMsgArgs Bad or Missing Size Error")}protoParseInt(t){if(t.length===0)return-1;let r=0;for(let s=0;s<t.length;s++){if(t[s]<48||t[s]>57)return-1;r=r*10+(t[s]-JS)}return r}}var ue;(function(i){i[i.OP_START=0]="OP_START",i[i.OP_PLUS=1]="OP_PLUS",i[i.OP_PLUS_O=2]="OP_PLUS_O",i[i.OP_PLUS_OK=3]="OP_PLUS_OK",i[i.OP_MINUS=4]="OP_MINUS",i[i.OP_MINUS_E=5]="OP_MINUS_E",i[i.OP_MINUS_ER=6]="OP_MINUS_ER",i[i.OP_MINUS_ERR=7]="OP_MINUS_ERR",i[i.OP_MINUS_ERR_SPC=8]="OP_MINUS_ERR_SPC",i[i.MINUS_ERR_ARG=9]="MINUS_ERR_ARG",i[i.OP_M=10]="OP_M",i[i.OP_MS=11]="OP_MS",i[i.OP_MSG=12]="OP_MSG",i[i.OP_MSG_SPC=13]="OP_MSG_SPC",i[i.MSG_ARG=14]="MSG_ARG",i[i.MSG_PAYLOAD=15]="MSG_PAYLOAD",i[i.MSG_END=16]="MSG_END",i[i.OP_H=17]="OP_H",i[i.OP_P=18]="OP_P",i[i.OP_PI=19]="OP_PI",i[i.OP_PIN=20]="OP_PIN",i[i.OP_PING=21]="OP_PING",i[i.OP_PO=22]="OP_PO",i[i.OP_PON=23]="OP_PON",i[i.OP_PONG=24]="OP_PONG",i[i.OP_I=25]="OP_I",i[i.OP_IN=26]="OP_IN",i[i.OP_INF=27]="OP_INF",i[i.OP_INFO=28]="OP_INFO",i[i.OP_INFO_SPC=29]="OP_INFO_SPC",i[i.INFO_ARG=30]="INFO_ARG"})(ue||(ue={}));var fe;(function(i){i[i.CR=13]="CR",i[i.E=69]="E",i[i.e=101]="e",i[i.F=70]="F",i[i.f=102]="f",i[i.G=71]="G",i[i.g=103]="g",i[i.H=72]="H",i[i.h=104]="h",i[i.I=73]="I",i[i.i=105]="i",i[i.K=75]="K",i[i.k=107]="k",i[i.M=77]="M",i[i.m=109]="m",i[i.MINUS=45]="MINUS",i[i.N=78]="N",i[i.n=110]="n",i[i.NL=10]="NL",i[i.O=79]="O",i[i.o=111]="o",i[i.P=80]="P",i[i.p=112]="p",i[i.PLUS=43]="PLUS",i[i.R=82]="R",i[i.r=114]="r",i[i.S=83]="S",i[i.s=115]="s",i[i.SPACE=32]="SPACE",i[i.TAB=9]="TAB"})(fe||(fe={}));(function(i){var t=function(O,N){this.hi=O|0,this.lo=N|0},r=function(O){var N,T=new Float64Array(16);if(O)for(N=0;N<O.length;N++)T[N]=O[N];return T},s=function(){throw new Error("no PRNG")},l=new Uint8Array(16),c=new Uint8Array(32);c[0]=9;var d=r(),p=r([1]),y=r([56129,1]),f=r([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),m=r([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),b=r([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),v=r([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),_=r([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function w(O,N){return O<<N|O>>>32-N}function S(O,N){var T=O[N+3]&255;return T=T<<8|O[N+2]&255,T=T<<8|O[N+1]&255,T<<8|O[N+0]&255}function M(O,N){var T=O[N]<<24|O[N+1]<<16|O[N+2]<<8|O[N+3],k=O[N+4]<<24|O[N+5]<<16|O[N+6]<<8|O[N+7];return new t(T,k)}function B(O,N,T){var k;for(k=0;k<4;k++)O[N+k]=T&255,T>>>=8}function U(O,N,T){O[N]=T.hi>>24&255,O[N+1]=T.hi>>16&255,O[N+2]=T.hi>>8&255,O[N+3]=T.hi&255,O[N+4]=T.lo>>24&255,O[N+5]=T.lo>>16&255,O[N+6]=T.lo>>8&255,O[N+7]=T.lo&255}function ie(O,N,T,k,D){var I,te=0;for(I=0;I<D;I++)te|=O[N+I]^T[k+I];return(1&te-1>>>8)-1}function ce(O,N,T,k){return ie(O,N,T,k,16)}function C(O,N,T,k){return ie(O,N,T,k,32)}function z(O,N,T,k,D){var I=new Uint32Array(16),te=new Uint32Array(16),se=new Uint32Array(16),V=new Uint32Array(4),ee,pe,Re;for(ee=0;ee<4;ee++)te[5*ee]=S(k,4*ee),te[1+ee]=S(T,4*ee),te[6+ee]=S(N,4*ee),te[11+ee]=S(T,16+4*ee);for(ee=0;ee<16;ee++)se[ee]=te[ee];for(ee=0;ee<20;ee++){for(pe=0;pe<4;pe++){for(Re=0;Re<4;Re++)V[Re]=te[(5*pe+4*Re)%16];for(V[1]^=w(V[0]+V[3]|0,7),V[2]^=w(V[1]+V[0]|0,9),V[3]^=w(V[2]+V[1]|0,13),V[0]^=w(V[3]+V[2]|0,18),Re=0;Re<4;Re++)I[4*pe+(pe+Re)%4]=V[Re]}for(Re=0;Re<16;Re++)te[Re]=I[Re]}if(D){for(ee=0;ee<16;ee++)te[ee]=te[ee]+se[ee]|0;for(ee=0;ee<4;ee++)te[5*ee]=te[5*ee]-S(k,4*ee)|0,te[6+ee]=te[6+ee]-S(N,4*ee)|0;for(ee=0;ee<4;ee++)B(O,4*ee,te[5*ee]),B(O,16+4*ee,te[6+ee])}else for(ee=0;ee<16;ee++)B(O,4*ee,te[ee]+se[ee]|0)}function re(O,N,T,k){return z(O,N,T,k,!1),0}function X(O,N,T,k){return z(O,N,T,k,!0),0}var L=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function G(O,N,T,k,D,I,te){var se=new Uint8Array(16),V=new Uint8Array(64),ee,pe;if(!D)return 0;for(pe=0;pe<16;pe++)se[pe]=0;for(pe=0;pe<8;pe++)se[pe]=I[pe];for(;D>=64;){for(re(V,se,te,L),pe=0;pe<64;pe++)O[N+pe]=(T?T[k+pe]:0)^V[pe];for(ee=1,pe=8;pe<16;pe++)ee=ee+(se[pe]&255)|0,se[pe]=ee&255,ee>>>=8;D-=64,N+=64,T&&(k+=64)}if(D>0)for(re(V,se,te,L),pe=0;pe<D;pe++)O[N+pe]=(T?T[k+pe]:0)^V[pe];return 0}function W(O,N,T,k,D){return G(O,N,null,0,T,k,D)}function Q(O,N,T,k,D){var I=new Uint8Array(32);return X(I,k,D,L),W(O,N,T,k.subarray(16),I)}function he(O,N,T,k,D,I,te){var se=new Uint8Array(32);return X(se,I,te,L),G(O,N,T,k,D,I.subarray(16),se)}function _e(O,N){var T,k=0;for(T=0;T<17;T++)k=k+(O[T]+N[T]|0)|0,O[T]=k&255,k>>>=8}var Te=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]);function Y(O,N,T,k,D,I){var te,se,V,ee,pe=new Uint32Array(17),Re=new Uint32Array(17),We=new Uint32Array(17),Lt=new Uint32Array(17),Dn=new Uint32Array(17);for(V=0;V<17;V++)Re[V]=We[V]=0;for(V=0;V<16;V++)Re[V]=I[V];for(Re[3]&=15,Re[4]&=252,Re[7]&=15,Re[8]&=252,Re[11]&=15,Re[12]&=252,Re[15]&=15;D>0;){for(V=0;V<17;V++)Lt[V]=0;for(V=0;V<16&&V<D;++V)Lt[V]=T[k+V];for(Lt[V]=1,k+=V,D-=V,_e(We,Lt),se=0;se<17;se++)for(pe[se]=0,V=0;V<17;V++)pe[se]=pe[se]+We[V]*(V<=se?Re[se-V]:320*Re[se+17-V]|0)|0|0;for(se=0;se<17;se++)We[se]=pe[se];for(ee=0,V=0;V<16;V++)ee=ee+We[V]|0,We[V]=ee&255,ee>>>=8;for(ee=ee+We[16]|0,We[16]=ee&3,ee=5*(ee>>>2)|0,V=0;V<16;V++)ee=ee+We[V]|0,We[V]=ee&255,ee>>>=8;ee=ee+We[16]|0,We[16]=ee}for(V=0;V<17;V++)Dn[V]=We[V];for(_e(We,Te),te=-(We[16]>>>7)|0,V=0;V<17;V++)We[V]^=te&(Dn[V]^We[V]);for(V=0;V<16;V++)Lt[V]=I[V+16];for(Lt[16]=0,_e(We,Lt),V=0;V<16;V++)O[N+V]=We[V];return 0}function ae(O,N,T,k,D,I){var te=new Uint8Array(16);return Y(te,0,T,k,D,I),ce(O,N,te,0)}function de(O,N,T,k,D){var I;if(T<32)return-1;for(he(O,0,N,0,T,k,D),Y(O,16,O,32,T-32,O),I=0;I<16;I++)O[I]=0;return 0}function Ae(O,N,T,k,D){var I,te=new Uint8Array(32);if(T<32||(Q(te,0,32,k,D),ae(N,16,N,32,T-32,te)!==0))return-1;for(he(O,0,N,0,T,k,D),I=0;I<32;I++)O[I]=0;return 0}function oe(O,N){var T;for(T=0;T<16;T++)O[T]=N[T]|0}function je(O){var N,T;for(T=0;T<16;T++)O[T]+=65536,N=Math.floor(O[T]/65536),O[(T+1)*(T<15?1:0)]+=N-1+37*(N-1)*(T===15?1:0),O[T]-=N*65536}function Se(O,N,T){for(var k,D=~(T-1),I=0;I<16;I++)k=D&(O[I]^N[I]),O[I]^=k,N[I]^=k}function Ne(O,N){var T,k,D,I=r(),te=r();for(T=0;T<16;T++)te[T]=N[T];for(je(te),je(te),je(te),k=0;k<2;k++){for(I[0]=te[0]-65517,T=1;T<15;T++)I[T]=te[T]-65535-(I[T-1]>>16&1),I[T-1]&=65535;I[15]=te[15]-32767-(I[14]>>16&1),D=I[15]>>16&1,I[14]&=65535,Se(te,I,1-D)}for(T=0;T<16;T++)O[2*T]=te[T]&255,O[2*T+1]=te[T]>>8}function be(O,N){var T=new Uint8Array(32),k=new Uint8Array(32);return Ne(T,O),Ne(k,N),C(T,0,k,0)}function at(O){var N=new Uint8Array(32);return Ne(N,O),N[0]&1}function Gt(O,N){var T;for(T=0;T<16;T++)O[T]=N[2*T]+(N[2*T+1]<<8);O[15]&=32767}function Rt(O,N,T){var k;for(k=0;k<16;k++)O[k]=N[k]+T[k]|0}function Dt(O,N,T){var k;for(k=0;k<16;k++)O[k]=N[k]-T[k]|0}function ke(O,N,T){var k,D,I=new Float64Array(31);for(k=0;k<31;k++)I[k]=0;for(k=0;k<16;k++)for(D=0;D<16;D++)I[k+D]+=N[k]*T[D];for(k=0;k<15;k++)I[k]+=38*I[k+16];for(k=0;k<16;k++)O[k]=I[k];je(O),je(O)}function qt(O,N){ke(O,N,N)}function di(O,N){var T=r(),k;for(k=0;k<16;k++)T[k]=N[k];for(k=253;k>=0;k--)qt(T,T),k!==2&&k!==4&&ke(T,T,N);for(k=0;k<16;k++)O[k]=T[k]}function Gi(O,N){var T=r(),k;for(k=0;k<16;k++)T[k]=N[k];for(k=250;k>=0;k--)qt(T,T),k!==1&&ke(T,T,N);for(k=0;k<16;k++)O[k]=T[k]}function mi(O,N,T){var k=new Uint8Array(32),D=new Float64Array(80),I,te,se=r(),V=r(),ee=r(),pe=r(),Re=r(),We=r();for(te=0;te<31;te++)k[te]=N[te];for(k[31]=N[31]&127|64,k[0]&=248,Gt(D,T),te=0;te<16;te++)V[te]=D[te],pe[te]=se[te]=ee[te]=0;for(se[0]=pe[0]=1,te=254;te>=0;--te)I=k[te>>>3]>>>(te&7)&1,Se(se,V,I),Se(ee,pe,I),Rt(Re,se,ee),Dt(se,se,ee),Rt(ee,V,pe),Dt(V,V,pe),qt(pe,Re),qt(We,se),ke(se,ee,se),ke(ee,V,Re),Rt(Re,se,ee),Dt(se,se,ee),qt(V,se),Dt(ee,pe,We),ke(se,ee,y),Rt(se,se,pe),ke(ee,ee,se),ke(se,pe,We),ke(pe,V,D),qt(V,Re),Se(se,V,I),Se(ee,pe,I);for(te=0;te<16;te++)D[te+16]=se[te],D[te+32]=ee[te],D[te+48]=V[te],D[te+64]=pe[te];var Lt=D.subarray(32),Dn=D.subarray(16);return di(Lt,Lt),ke(Dn,Dn,Lt),Ne(O,Dn),0}function bn(O,N){return mi(O,N,c)}function Fi(O,N){return s(N,32),bn(O,N)}function Ar(O,N,T){var k=new Uint8Array(32);return mi(k,T,N),X(O,l,k,L)}var Eo=de,Oo=Ae;function Js(O,N,T,k,D,I){var te=new Uint8Array(32);return Ar(te,D,I),Eo(O,N,T,k,te)}function Qs(O,N,T,k,D,I){var te=new Uint8Array(32);return Ar(te,D,I),Oo(O,N,T,k,te)}function er(){var O=0,N=0,T=0,k=0,D=65535,I,te,se;for(se=0;se<arguments.length;se++)I=arguments[se].lo,te=arguments[se].hi,O+=I&D,N+=I>>>16,T+=te&D,k+=te>>>16;return N+=O>>>16,T+=N>>>16,k+=T>>>16,new t(T&D|k<<16,O&D|N<<16)}function Ao(O,N){return new t(O.hi>>>N,O.lo>>>N|O.hi<<32-N)}function Vi(){var O=0,N=0,T;for(T=0;T<arguments.length;T++)O^=arguments[T].lo,N^=arguments[T].hi;return new t(N,O)}function nt(O,N){var T,k,D=32-N;return N<32?(T=O.hi>>>N|O.lo<<D,k=O.lo>>>N|O.hi<<D):N<64&&(T=O.lo>>>N|O.hi<<D,k=O.hi>>>N|O.lo<<D),new t(T,k)}function vu(O,N,T){var k=O.hi&N.hi^~O.hi&T.hi,D=O.lo&N.lo^~O.lo&T.lo;return new t(k,D)}function jo(O,N,T){var k=O.hi&N.hi^O.hi&T.hi^N.hi&T.hi,D=O.lo&N.lo^O.lo&T.lo^N.lo&T.lo;return new t(k,D)}function To(O){return Vi(nt(O,28),nt(O,34),nt(O,39))}function Yi(O){return Vi(nt(O,14),nt(O,18),nt(O,41))}function xu(O){return Vi(nt(O,1),nt(O,8),Ao(O,7))}function No(O){return Vi(nt(O,19),nt(O,61),Ao(O,6))}var _u=[new t(1116352408,3609767458),new t(1899447441,602891725),new t(3049323471,3964484399),new t(3921009573,2173295548),new t(961987163,4081628472),new t(1508970993,3053834265),new t(2453635748,2937671579),new t(2870763221,3664609560),new t(3624381080,2734883394),new t(310598401,1164996542),new t(607225278,1323610764),new t(1426881987,3590304994),new t(1925078388,4068182383),new t(2162078206,991336113),new t(2614888103,633803317),new t(3248222580,3479774868),new t(3835390401,2666613458),new t(4022224774,944711139),new t(264347078,2341262773),new t(604807628,2007800933),new t(770255983,1495990901),new t(1249150122,1856431235),new t(1555081692,3175218132),new t(1996064986,2198950837),new t(2554220882,3999719339),new t(2821834349,766784016),new t(2952996808,2566594879),new t(3210313671,3203337956),new t(3336571891,1034457026),new t(3584528711,2466948901),new t(113926993,3758326383),new t(338241895,168717936),new t(666307205,1188179964),new t(773529912,1546045734),new t(1294757372,1522805485),new t(1396182291,2643833823),new t(1695183700,2343527390),new t(1986661051,1014477480),new t(2177026350,1206759142),new t(2456956037,344077627),new t(2730485921,1290863460),new t(2820302411,3158454273),new t(3259730800,3505952657),new t(3345764771,106217008),new t(3516065817,3606008344),new t(3600352804,1432725776),new t(4094571909,1467031594),new t(275423344,851169720),new t(430227734,3100823752),new t(506948616,1363258195),new t(659060556,3750685593),new t(883997877,3785050280),new t(958139571,3318307427),new t(1322822218,3812723403),new t(1537002063,2003034995),new t(1747873779,3602036899),new t(1955562222,1575990012),new t(2024104815,1125592928),new t(2227730452,2716904306),new t(2361852424,442776044),new t(2428436474,593698344),new t(2756734187,3733110249),new t(3204031479,2999351573),new t(3329325298,3815920427),new t(3391569614,3928383900),new t(3515267271,566280711),new t(3940187606,3454069534),new t(4118630271,4000239992),new t(116418474,1914138554),new t(174292421,2731055270),new t(289380356,3203993006),new t(460393269,320620315),new t(685471733,587496836),new t(852142971,1086792851),new t(1017036298,365543100),new t(1126000580,2618297676),new t(1288033470,3409855158),new t(1501505948,4234509866),new t(1607167915,987167468),new t(1816402316,1246189591)];function ko(O,N,T){var k=[],D=[],I=[],te=[],se,V,ee;for(V=0;V<8;V++)k[V]=I[V]=M(O,8*V);for(var pe=0;T>=128;){for(V=0;V<16;V++)te[V]=M(N,8*V+pe);for(V=0;V<80;V++){for(ee=0;ee<8;ee++)D[ee]=I[ee];for(se=er(I[7],Yi(I[4]),vu(I[4],I[5],I[6]),_u[V],te[V%16]),D[7]=er(se,To(I[0]),jo(I[0],I[1],I[2])),D[3]=er(D[3],se),ee=0;ee<8;ee++)I[(ee+1)%8]=D[ee];if(V%16===15)for(ee=0;ee<16;ee++)te[ee]=er(te[ee],te[(ee+9)%16],xu(te[(ee+1)%16]),No(te[(ee+14)%16]))}for(V=0;V<8;V++)I[V]=er(I[V],k[V]),k[V]=I[V];pe+=128,T-=128}for(V=0;V<8;V++)U(O,8*V,k[V]);return T}var pi=new Uint8Array([106,9,230,103,243,188,201,8,187,103,174,133,132,202,167,59,60,110,243,114,254,148,248,43,165,79,245,58,95,29,54,241,81,14,82,127,173,230,130,209,155,5,104,140,43,62,108,31,31,131,217,171,251,65,189,107,91,224,205,25,19,126,33,121]);function dt(O,N,T){var k=new Uint8Array(64),D=new Uint8Array(256),I,te=T;for(I=0;I<64;I++)k[I]=pi[I];for(ko(k,N,T),T%=128,I=0;I<256;I++)D[I]=0;for(I=0;I<T;I++)D[I]=N[te-T+I];for(D[T]=128,T=256-128*(T<112?1:0),D[T-9]=0,U(D,T-8,new t(te/536870912|0,te<<3)),ko(k,D,T),I=0;I<64;I++)O[I]=k[I];return 0}function Qt(O,N){var T=r(),k=r(),D=r(),I=r(),te=r(),se=r(),V=r(),ee=r(),pe=r();Dt(T,O[1],O[0]),Dt(pe,N[1],N[0]),ke(T,T,pe),Rt(k,O[0],O[1]),Rt(pe,N[0],N[1]),ke(k,k,pe),ke(D,O[3],N[3]),ke(D,D,m),ke(I,O[2],N[2]),Rt(I,I,I),Dt(te,k,T),Dt(se,I,D),Rt(V,I,D),Rt(ee,k,T),ke(O[0],te,se),ke(O[1],ee,V),ke(O[2],V,se),ke(O[3],te,ee)}function Bt(O,N,T){var k;for(k=0;k<4;k++)Se(O[k],N[k],T)}function Zs(O,N){var T=r(),k=r(),D=r();di(D,N[2]),ke(T,N[0],D),ke(k,N[1],D),Ne(O,k),O[31]^=at(T)<<7}function Ws(O,N,T){var k,D;for(oe(O[0],d),oe(O[1],p),oe(O[2],p),oe(O[3],d),D=255;D>=0;--D)k=T[D/8|0]>>(D&7)&1,Bt(O,N,k),Qt(N,O),Qt(O,O),Bt(O,N,k)}function Ki(O,N){var T=[r(),r(),r(),r()];oe(T[0],b),oe(T[1],v),oe(T[2],p),ke(T[3],b,v),Ws(O,T,N)}function jr(O,N,T){var k=new Uint8Array(64),D=[r(),r(),r(),r()],I;for(T||s(N,32),dt(k,N,32),k[0]&=248,k[31]&=127,k[31]|=64,Ki(D,k),Zs(O,D),I=0;I<32;I++)N[I+32]=O[I];return 0}var tr=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Tr(O,N){var T,k,D,I;for(k=63;k>=32;--k){for(T=0,D=k-32,I=k-12;D<I;++D)N[D]+=T-16*N[k]*tr[D-(k-32)],T=Math.floor((N[D]+128)/256),N[D]-=T*256;N[D]+=T,N[k]=0}for(T=0,D=0;D<32;D++)N[D]+=T-(N[31]>>4)*tr[D],T=N[D]>>8,N[D]&=255;for(D=0;D<32;D++)N[D]-=T*tr[D];for(k=0;k<32;k++)N[k+1]+=N[k]>>8,O[k]=N[k]&255}function Mn(O){var N=new Float64Array(64),T;for(T=0;T<64;T++)N[T]=O[T];for(T=0;T<64;T++)O[T]=0;Tr(O,N)}function gi(O,N,T,k){var D=new Uint8Array(64),I=new Uint8Array(64),te=new Uint8Array(64),se,V,ee=new Float64Array(64),pe=[r(),r(),r(),r()];dt(D,k,32),D[0]&=248,D[31]&=127,D[31]|=64;var Re=T+64;for(se=0;se<T;se++)O[64+se]=N[se];for(se=0;se<32;se++)O[32+se]=D[32+se];for(dt(te,O.subarray(32),T+32),Mn(te),Ki(pe,te),Zs(O,pe),se=32;se<64;se++)O[se]=k[se];for(dt(I,O,T+64),Mn(I),se=0;se<64;se++)ee[se]=0;for(se=0;se<32;se++)ee[se]=te[se];for(se=0;se<32;se++)for(V=0;V<32;V++)ee[se+V]+=I[se]*D[V];return Tr(O.subarray(32),ee),Re}function yi(O,N){var T=r(),k=r(),D=r(),I=r(),te=r(),se=r(),V=r();return oe(O[2],p),Gt(O[1],N),qt(D,O[1]),ke(I,D,f),Dt(D,D,O[2]),Rt(I,O[2],I),qt(te,I),qt(se,te),ke(V,se,te),ke(T,V,D),ke(T,T,I),Gi(T,T),ke(T,T,D),ke(T,T,I),ke(T,T,I),ke(O[0],T,I),qt(k,O[0]),ke(k,k,I),be(k,D)&&ke(O[0],O[0],_),qt(k,O[0]),ke(k,k,I),be(k,D)?-1:(at(O[0])===N[31]>>7&&Dt(O[0],d,O[0]),ke(O[3],O[0],O[1]),0)}function ea(O,N,T,k){var D,I=new Uint8Array(32),te=new Uint8Array(64),se=[r(),r(),r(),r()],V=[r(),r(),r(),r()];if(T<64||yi(V,k))return-1;for(D=0;D<T;D++)O[D]=N[D];for(D=0;D<32;D++)O[D+32]=k[D];if(dt(te,O,T),Mn(te),Ws(se,V,te),Ki(V,N.subarray(32)),Qt(se,V),Zs(I,se),T-=64,C(N,0,I,0)){for(D=0;D<T;D++)O[D]=0;return-1}for(D=0;D<T;D++)O[D]=N[D+64];return T}var Xi=32,Nr=24,Rn=32,kr=16,Cr=32,bi=32,Mr=32,nr=32,vi=32,ta=Nr,Co=Rn,Gn=kr,Qe=64,ot=32,Zt=64,xi=32,na=64;i.lowlevel={crypto_core_hsalsa20:X,crypto_stream_xor:he,crypto_stream:Q,crypto_stream_salsa20_xor:G,crypto_stream_salsa20:W,crypto_onetimeauth:Y,crypto_onetimeauth_verify:ae,crypto_verify_16:ce,crypto_verify_32:C,crypto_secretbox:de,crypto_secretbox_open:Ae,crypto_scalarmult:mi,crypto_scalarmult_base:bn,crypto_box_beforenm:Ar,crypto_box_afternm:Eo,crypto_box:Js,crypto_box_open:Qs,crypto_box_keypair:Fi,crypto_hash:dt,crypto_sign:gi,crypto_sign_keypair:jr,crypto_sign_open:ea,crypto_secretbox_KEYBYTES:Xi,crypto_secretbox_NONCEBYTES:Nr,crypto_secretbox_ZEROBYTES:Rn,crypto_secretbox_BOXZEROBYTES:kr,crypto_scalarmult_BYTES:Cr,crypto_scalarmult_SCALARBYTES:bi,crypto_box_PUBLICKEYBYTES:Mr,crypto_box_SECRETKEYBYTES:nr,crypto_box_BEFORENMBYTES:vi,crypto_box_NONCEBYTES:ta,crypto_box_ZEROBYTES:Co,crypto_box_BOXZEROBYTES:Gn,crypto_sign_BYTES:Qe,crypto_sign_PUBLICKEYBYTES:ot,crypto_sign_SECRETKEYBYTES:Zt,crypto_sign_SEEDBYTES:xi,crypto_hash_BYTES:na,gf:r,D:f,L:tr,pack25519:Ne,unpack25519:Gt,M:ke,A:Rt,S:qt,Z:Dt,pow2523:Gi,add:Qt,set25519:oe,modL:Tr,scalarmult:Ws,scalarbase:Ki};function Mo(O,N){if(O.length!==Xi)throw new Error("bad key size");if(N.length!==Nr)throw new Error("bad nonce size")}function Ro(O,N){if(O.length!==Mr)throw new Error("bad public key size");if(N.length!==nr)throw new Error("bad secret key size")}function wt(){for(var O=0;O<arguments.length;O++)if(!(arguments[O]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function Ji(O){for(var N=0;N<O.length;N++)O[N]=0}i.randomBytes=function(O){var N=new Uint8Array(O);return s(N,O),N},i.secretbox=function(O,N,T){wt(O,N,T),Mo(T,N);for(var k=new Uint8Array(Rn+O.length),D=new Uint8Array(k.length),I=0;I<O.length;I++)k[I+Rn]=O[I];return de(D,k,k.length,N,T),D.subarray(kr)},i.secretbox.open=function(O,N,T){wt(O,N,T),Mo(T,N);for(var k=new Uint8Array(kr+O.length),D=new Uint8Array(k.length),I=0;I<O.length;I++)k[I+kr]=O[I];return k.length<32||Ae(D,k,k.length,N,T)!==0?null:D.subarray(Rn)},i.secretbox.keyLength=Xi,i.secretbox.nonceLength=Nr,i.secretbox.overheadLength=kr,i.scalarMult=function(O,N){if(wt(O,N),O.length!==bi)throw new Error("bad n size");if(N.length!==Cr)throw new Error("bad p size");var T=new Uint8Array(Cr);return mi(T,O,N),T},i.scalarMult.base=function(O){if(wt(O),O.length!==bi)throw new Error("bad n size");var N=new Uint8Array(Cr);return bn(N,O),N},i.scalarMult.scalarLength=bi,i.scalarMult.groupElementLength=Cr,i.box=function(O,N,T,k){var D=i.box.before(T,k);return i.secretbox(O,N,D)},i.box.before=function(O,N){wt(O,N),Ro(O,N);var T=new Uint8Array(vi);return Ar(T,O,N),T},i.box.after=i.secretbox,i.box.open=function(O,N,T,k){var D=i.box.before(T,k);return i.secretbox.open(O,N,D)},i.box.open.after=i.secretbox.open,i.box.keyPair=function(){var O=new Uint8Array(Mr),N=new Uint8Array(nr);return Fi(O,N),{publicKey:O,secretKey:N}},i.box.keyPair.fromSecretKey=function(O){if(wt(O),O.length!==nr)throw new Error("bad secret key size");var N=new Uint8Array(Mr);return bn(N,O),{publicKey:N,secretKey:new Uint8Array(O)}},i.box.publicKeyLength=Mr,i.box.secretKeyLength=nr,i.box.sharedKeyLength=vi,i.box.nonceLength=ta,i.box.overheadLength=i.secretbox.overheadLength,i.sign=function(O,N){if(wt(O,N),N.length!==Zt)throw new Error("bad secret key size");var T=new Uint8Array(Qe+O.length);return gi(T,O,O.length,N),T},i.sign.open=function(O,N){if(wt(O,N),N.length!==ot)throw new Error("bad public key size");var T=new Uint8Array(O.length),k=ea(T,O,O.length,N);if(k<0)return null;for(var D=new Uint8Array(k),I=0;I<D.length;I++)D[I]=T[I];return D},i.sign.detached=function(O,N){for(var T=i.sign(O,N),k=new Uint8Array(Qe),D=0;D<k.length;D++)k[D]=T[D];return k},i.sign.detached.verify=function(O,N,T){if(wt(O,N,T),N.length!==Qe)throw new Error("bad signature size");if(T.length!==ot)throw new Error("bad public key size");var k=new Uint8Array(Qe+O.length),D=new Uint8Array(Qe+O.length),I;for(I=0;I<Qe;I++)k[I]=N[I];for(I=0;I<O.length;I++)k[I+Qe]=O[I];return ea(D,k,k.length,T)>=0},i.sign.keyPair=function(){var O=new Uint8Array(ot),N=new Uint8Array(Zt);return jr(O,N),{publicKey:O,secretKey:N}},i.sign.keyPair.fromSecretKey=function(O){if(wt(O),O.length!==Zt)throw new Error("bad secret key size");for(var N=new Uint8Array(ot),T=0;T<N.length;T++)N[T]=O[32+T];return{publicKey:N,secretKey:new Uint8Array(O)}},i.sign.keyPair.fromSeed=function(O){if(wt(O),O.length!==xi)throw new Error("bad seed size");for(var N=new Uint8Array(ot),T=new Uint8Array(Zt),k=0;k<32;k++)T[k]=O[k];return jr(N,T,!0),{publicKey:N,secretKey:T}},i.sign.publicKeyLength=ot,i.sign.secretKeyLength=Zt,i.sign.seedLength=xi,i.sign.signatureLength=Qe,i.hash=function(O){wt(O);var N=new Uint8Array(na);return dt(N,O,O.length),N},i.hash.hashLength=na,i.verify=function(O,N){return wt(O,N),O.length===0||N.length===0||O.length!==N.length?!1:ie(O,0,N,0,O.length)===0},i.setPRNG=function(O){s=O},(function(){var O=typeof globalThis<"u"?globalThis.crypto||globalThis.msCrypto:null;if(O&&O.getRandomValues){var N=65536;i.setPRNG(function(T,k){var D,I=new Uint8Array(k);for(D=0;D<k;D+=N)O.getRandomValues(I.subarray(D,D+Math.min(k-D,N)));for(D=0;D<k;D++)T[D]=I[D];Ji(I)})}else typeof require<"u"&&(O=require("crypto"),O&&O.randomBytes&&i.setPRNG(function(T,k){var D,I=O.randomBytes(k);for(D=0;D<k;D++)T[D]=I[D];Ji(I)}))})()})(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const Yl=typeof module<"u"&&module.exports?module.exports:globalThis.nacl;Yl.sign.keyPair.fromSeed,Yl.sign.detached,Yl.sign.detached.verify,Yl.randomBytes;var dy;(function(i){i.InvalidPrefixByte="nkeys: invalid prefix byte",i.InvalidKey="nkeys: invalid key",i.InvalidPublicKey="nkeys: invalid public key",i.InvalidSeedLen="nkeys: invalid seed length",i.InvalidSeed="nkeys: invalid seed",i.InvalidEncoding="nkeys: invalid encoded key",i.InvalidSignature="nkeys: signature verification failed",i.CannotSign="nkeys: cannot sign, no private key available",i.PublicKeyOnly="nkeys: no seed or private key available",i.InvalidChecksum="nkeys: invalid checksum",i.SerializationError="nkeys: serialization error",i.ApiError="nkeys: api error",i.ClearedPair="nkeys: pair is cleared"})(dy||(dy={}));var my;(function(i){i[i.Seed=144]="Seed",i[i.Private=120]="Private",i[i.Operator=112]="Operator",i[i.Server=104]="Server",i[i.Cluster=16]="Cluster",i[i.Account=0]="Account",i[i.User=160]="User"})(my||(my={}));function QS(i){return t=>{let r={};return i.forEach(s=>{const l=s(t)||{};r=Object.assign(r,l)}),r}}function ZS(){return()=>{}}function WS(i,t){return()=>{const r=typeof i=="function"?i():i,s=typeof t=="function"?t():t;return{user:r,pass:s}}}function eE(i){return()=>({auth_token:typeof i=="function"?i():i})}const Ob=120*1e3,tE=2,Ab=2*1e3;function nE(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:Ob,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:1e3,reconnectTimeWait:Ab,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function rE(i){const t=[];return typeof i.authenticator=="function"&&t.push(i.authenticator),Array.isArray(i.authenticator)&&t.push(...i.authenticator),i.token&&t.push(eE(i.token)),i.user&&t.push(WS(i.user,i.pass)),t.length===0?ZS():QS(t)}function iE(i){const t=`${Zh}:${wb()}`;if(i=i||{servers:[t]},i.servers=i.servers||[],typeof i.servers=="string"&&(i.servers=[i.servers]),i.servers.length>0&&i.port)throw new me("port and servers options are mutually exclusive",le.InvalidOption);i.servers.length===0&&i.port&&(i.servers=[`${Zh}:${i.port}`]),i.servers&&i.servers.length===0&&(i.servers=[t]);const r=cu(nE(),i);if(r.authenticator=rE(r),["reconnectDelayHandler","authenticator"].forEach(s=>{if(r[s]&&typeof r[s]!="function")throw new me(`${s} option should be a function`,le.NotFunction)}),r.reconnectDelayHandler||(r.reconnectDelayHandler=()=>{let s=r.tls?r.reconnectJitterTLS:r.reconnectJitter;return s&&(s++,s=Math.floor(Math.random()*s)),r.reconnectTimeWait+s}),r.inboxPrefix)try{Sr(r.inboxPrefix)}catch(s){throw new me(s.message,le.ApiError)}if(r.resolve===void 0&&(r.resolve=typeof ad()=="function"),r.resolve&&typeof ad()!="function")throw new me("'resolve' is not supported on this client",le.InvalidOption);return r}function sE(i,t){const{proto:r,tls_required:s,tls_available:l}=i;if((r===void 0||r<1)&&t.noEcho)throw new me("noEcho",le.ServerOptionNotAvailable);const c=s||l||!1;if(t.tls&&!c)throw new me("tls",le.ServerOptionNotAvailable)}const aE=1024*32,oE=/^INFO\s+([^\r\n]+)\r\n/i,lE=so(`PONG\r
38
38
  `),py=so(`PING\r
39
- `);class oE{constructor(t,r,s){A(this,"echo");A(this,"no_responders");A(this,"protocol");A(this,"verbose");A(this,"pedantic");A(this,"jwt");A(this,"nkey");A(this,"sig");A(this,"user");A(this,"pass");A(this,"auth_token");A(this,"tls_required");A(this,"name");A(this,"lang");A(this,"version");A(this,"headers");this.protocol=1,this.version=t.version,this.lang=t.lang,this.echo=r.noEcho?!1:void 0,this.verbose=r.verbose,this.pedantic=r.pedantic,this.tls_required=r.tls?!0:void 0,this.name=r.name;const l=(r&&typeof r.authenticator=="function"?r.authenticator(s):{})||{};cu(this,l)}}class Ob extends Tt{constructor(r,s,l={}){var d;super();A(this,"sid");A(this,"queue");A(this,"draining");A(this,"max");A(this,"subject");A(this,"drained");A(this,"protocol");A(this,"timer");A(this,"info");A(this,"cleanupFn");A(this,"closed");A(this,"requestSubject");cu(this,l),this.protocol=r,this.subject=s,this.draining=!1,this.noIterator=typeof l.callback=="function",this.closed=st();const c=!((d=r.options)!=null&&d.noAsyncTraces);l.timeout&&(this.timer=Gs(l.timeout,c),this.timer.then(()=>{this.timer=void 0}).catch(p=>{this.stop(p),this.noIterator&&this.callback(p,{})})),this.noIterator||this.iterClosed.then(()=>{this.closed.resolve(),this.unsubscribe()})}setPrePostHandlers(r){if(this.noIterator){const s=this.callback,l=r.ingestionFilterFn?r.ingestionFilterFn:()=>({ingest:!0,protocol:!1}),c=r.protocolFilterFn?r.protocolFilterFn:()=>!0,d=r.dispatchedFn?r.dispatchedFn:()=>{};this.callback=(p,g)=>{const{ingest:f}=l(g);f&&c(g)&&(s(p,g),d(g))}}else this.protocolFilterFn=r.protocolFilterFn,this.dispatchedFn=r.dispatchedFn}callback(r,s){this.cancelTimeout(),r?this.stop(r):this.push(s)}close(){if(!this.isClosed()){this.cancelTimeout();const r=()=>{if(this.stop(),this.cleanupFn)try{this.cleanupFn(this,this.info)}catch{}this.closed.resolve()};this.noIterator?r():this.push(r)}}unsubscribe(r){this.protocol.unsubscribe(this,r)}cancelTimeout(){this.timer&&(this.timer.cancel(),this.timer=void 0)}drain(){return this.protocol.isClosed()?Promise.reject(me.errorForCode(le.ConnectionClosed)):this.isClosed()?Promise.reject(me.errorForCode(le.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 lE{constructor(){A(this,"mux");A(this,"subs");A(this,"sidCounter");this.sidCounter=0,this.mux=null,this.subs=new Map}size(){return this.subs.size}add(t){return this.sidCounter++,t.sid=this.sidCounter,this.subs.set(t.sid,t),t}setMux(t){return this.mux=t,t}getMux(){return this.mux}get(t){return this.subs.get(t)}resub(t){return this.sidCounter++,this.subs.delete(t.sid),t.sid=this.sidCounter,this.subs.set(t.sid,t),t}all(){return Array.from(this.subs.values())}cancel(t){t&&(t.close(),this.subs.delete(t.sid))}handleError(t){if(t&&t.permissionContext){const r=t.permissionContext,s=this.all();let l;if(r.operation==="subscription"&&(l=s.find(c=>c.subject===r.subject&&c.queue===r.queue)),r.operation==="publish"&&(l=s.find(c=>c.requestSubject===r.subject)),l)return l.callback(t,{}),l.close(),this.subs.delete(l.sid),l!==this.mux}return!1}close(){this.subs.forEach(t=>{t.close()})}}class eu{constructor(t,r){A(this,"connected");A(this,"connectedOnce");A(this,"infoReceived");A(this,"info");A(this,"muxSubscriptions");A(this,"options");A(this,"outbound");A(this,"pongs");A(this,"subscriptions");A(this,"transport");A(this,"noMorePublishing");A(this,"connectError");A(this,"publisher");A(this,"_closed");A(this,"closed");A(this,"listeners");A(this,"heartbeats");A(this,"parser");A(this,"outMsgs");A(this,"inMsgs");A(this,"outBytes");A(this,"inBytes");A(this,"pendingLimit");A(this,"lastError");A(this,"abortReconnect");A(this,"whyClosed");A(this,"servers");A(this,"server");A(this,"features");A(this,"connectPromise");this._closed=!1,this.connected=!1,this.connectedOnce=!1,this.infoReceived=!1,this.noMorePublishing=!1,this.abortReconnect=!1,this.listeners=[],this.pendingLimit=iE,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=t,this.publisher=r,this.subscriptions=new lE,this.muxSubscriptions=new GS,this.outbound=new Vs,this.pongs=[],this.whyClosed="",this.pendingLimit=t.pendingLimit||this.pendingLimit,this.features=new ES({major:0,minor:0,micro:0}),this.connectPromise=null;const s=typeof t.servers=="string"?[t.servers]:t.servers;this.servers=new HS(s,{randomize:!t.noRandomize}),this.closed=st(),this.parser=new hy(this),this.heartbeats=new FS(this,this.options.pingInterval||Sb,this.options.maxPingOut||WS)}resetOutbound(){this.outbound.reset();const t=this.pongs;this.pongs=[];const r=me.errorForCode(le.Disconnect);r.stack="",t.forEach(s=>{s.reject(r)}),this.parser=new hy(this),this.infoReceived=!1}dispatchStatus(t){this.listeners.forEach(r=>{r.push(t)})}status(){const t=new Tt;return this.listeners.push(t),t}prepare(){this.transport&&this.transport.discard(),this.info=void 0,this.resetOutbound();const t=st();return t.catch(()=>{}),this.pongs.unshift(t),this.connectError=r=>{t.reject(r)},this.transport=jS(),this.transport.closed().then(async r=>{if(this.connected=!1,!this.isClosed()){await this.disconnected(this.transport.closeError||this.lastError);return}}),t}disconnect(){this.dispatchStatus({type:zs.StaleConnection,data:""}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:zs.ClientInitiatedReconnect,data:""}),this.transport.disconnect()),Promise.resolve()}async disconnected(t){this.dispatchStatus({type:wr.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{var r;this.dispatchStatus({type:wr.Reconnect,data:this.servers.getCurrentServer().toString()}),((r=this.lastError)==null?void 0:r.code)===le.AuthenticationExpired&&(this.lastError=void 0)}).catch(r=>{this._close(r)}):await this._close(t)}async dial(t){const r=this.prepare();let s;try{s=Gs(this.options.timeout||2e4);const l=this.transport.connect(t,this.options);await Promise.race([l,s]),(async()=>{try{for await(const c of this.transport)this.parser.parse(c)}catch(c){console.log("reader closed",c)}})().then()}catch(l){r.reject(l)}try{await Promise.race([s,r]),s&&s.cancel(),this.connected=!0,this.connectError=void 0,this.sendSubscriptions(),this.connectedOnce=!0,this.server.didConnect=!0,this.server.reconnects=0,this.flushPending(),this.heartbeats.start()}catch(l){throw s&&s.cancel(),await this.transport.close(l),l}}async _doDial(t){const{resolve:r}=this.options,s=await t.resolve({fn:sd(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:r});let l=null;for(const c of s)try{l=null,this.dispatchStatus({type:zs.Reconnecting,data:c.toString()}),await this.dial(c);return}catch(d){l=d}throw l}dialLoop(){return this.connectPromise===null&&(this.connectPromise=this.dodialLoop(),this.connectPromise.then(()=>{}).catch(()=>{}).finally(()=>{this.connectPromise=null})),this.connectPromise}async dodialLoop(){let t;for(;;){this._closed&&this.servers.clear();const r=this.options.reconnectDelayHandler?this.options.reconnectDelayHandler():Eb;let s=r;const l=this.selectServer();if(!l||this.abortReconnect)throw t||(this.lastError?this.lastError:me.errorForCode(le.ConnectionRefused));const c=Date.now();if(l.lastConnect===0||l.lastConnect+r<=c){l.lastConnect=Date.now();try{await this._doDial(l);break}catch(d){if(t=d,!this.connectedOnce){if(this.options.waitOnFirstConnect)continue;this.servers.removeCurrentServer()}l.reconnects++;const p=this.options.maxReconnectAttempts||0;p!==-1&&l.reconnects>=p&&this.servers.removeCurrentServer()}}else s=Math.min(s,l.lastConnect+r-c),await Ys(s)}}static async connect(t,r){const s=new eu(t,r);return await s.dialLoop(),s}static toError(t){const r=t?t.toLowerCase():"";if(r.indexOf("permissions violation")!==-1){const s=new me(t,le.PermissionsViolation),l=t.match(/(Publish|Subscription) to "(\S+)"/);if(l){s.permissionContext={operation:l[1].toLowerCase(),subject:l[2],queue:void 0};const c=t.match(/using queue "(\S+)"/);c&&(s.permissionContext.queue=c[1])}return s}else return r.indexOf("authorization violation")!==-1?new me(t,le.AuthorizationViolation):r.indexOf("user authentication expired")!==-1?new me(t,le.AuthenticationExpired):r.indexOf("account authentication expired")!=-1?new me(t,le.AccountExpired):r.indexOf("authentication timeout")!==-1?new me(t,le.AuthenticationTimeout):new me(t,le.ProtocolError)}processMsg(t,r){if(this.inMsgs++,this.inBytes+=r.length,!this.subscriptions.sidCounter)return;const s=this.subscriptions.get(t.sid);s&&(s.received+=1,s.callback&&s.callback(null,new jd(t,r,this)),s.max!==void 0&&s.received>=s.max&&s.unsubscribe())}processError(t){const r=Qg(t),s=eu.toError(r),l={type:wr.Error,data:s.code};if(s.isPermissionError()){let c=!1;if(s.permissionContext){l.permissionContext=s.permissionContext;const d=this.subscriptions.getMux();c=(d==null?void 0:d.subject)===s.permissionContext.subject}this.subscriptions.handleError(s),this.muxSubscriptions.handleError(c,s),c&&this.subscriptions.setMux(null)}this.dispatchStatus(l),this.handleError(s)}handleError(t){t.isAuthError()?this.handleAuthError(t):t.isProtocolError()?this.lastError=t:t.isAuthTimeout()&&(this.lastError=t),t.isPermissionError()||(this.lastError=t)}handleAuthError(t){this.lastError&&t.code===this.lastError.code&&this.options.ignoreAuthErrorAbort===!1&&(this.abortReconnect=!0),this.connectError?this.connectError(t):this.disconnect()}processPing(){this.transport.send(aE)}processPong(){const t=this.pongs.shift();t&&t.resolve()}processInfo(t){const r=JSON.parse(Qg(t));this.info=r;const s=this.options&&this.options.ignoreClusterUpdates?void 0:this.servers.update(r,this.transport.isEncrypted());if(!this.infoReceived){this.features.update($i(r.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();const{version:c,lang:d}=this.transport;try{const p=new oE({version:c,lang:d},this.options,r.nonce);r.headers&&(p.headers=!0,p.no_responders=!0);const g=JSON.stringify(p);this.transport.send(so(`CONNECT ${g}${Ic}`)),this.transport.send(py)}catch(p){this._close(p)}}s&&this.dispatchStatus({type:wr.Update,data:s}),(r.ldm!==void 0?r.ldm:!1)&&this.dispatchStatus({type:wr.LDM,data:this.servers.getCurrentServer().toString()})}push(t){switch(t.kind){case It.MSG:{const{msg:r,data:s}=t;this.processMsg(r,s);break}case It.OK:break;case It.ERR:this.processError(t.data);break;case It.PING:this.processPing();break;case It.PONG:this.processPong();break;case It.INFO:this.processInfo(t.data);break}}sendCommand(t,...r){const s=this.outbound.length();let l;typeof t=="string"?l=so(t):l=t,this.outbound.fill(l,...r),s===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(t,r=dn,s){let l;if(r instanceof Uint8Array)l=r;else if(typeof r=="string")l=Hi.encode(r);else throw me.errorForCode(le.BadPayload);let c=l.length;s=s||{},s.reply=s.reply||"";let d=dn,p=0;if(s.headers){if(this.info&&!this.info.headers)throw new me("headers",le.ServerOptionNotAvailable);d=s.headers.encode(),p=d.length,c=l.length+p}if(this.info&&c>this.info.max_payload)throw me.errorForCode(le.MaxPayloadExceeded);this.outBytes+=c,this.outMsgs++;let g;s.headers?(s.reply?g=`HPUB ${t} ${s.reply} ${p} ${c}\r
40
- `:g=`HPUB ${t} ${p} ${c}\r
41
- `,this.sendCommand(g,d,l,Wc)):(s.reply?g=`PUB ${t} ${s.reply} ${c}\r
42
- `:g=`PUB ${t} ${c}\r
43
- `,this.sendCommand(g,l,Wc))}request(t){return this.initMux(),this.muxSubscriptions.add(t),t}subscribe(t){return this.subscriptions.add(t),this._subunsub(t),t}_sub(t){t.queue?this.sendCommand(`SUB ${t.subject} ${t.queue} ${t.sid}\r
39
+ `);class cE{constructor(t,r,s){A(this,"echo");A(this,"no_responders");A(this,"protocol");A(this,"verbose");A(this,"pedantic");A(this,"jwt");A(this,"nkey");A(this,"sig");A(this,"user");A(this,"pass");A(this,"auth_token");A(this,"tls_required");A(this,"name");A(this,"lang");A(this,"version");A(this,"headers");this.protocol=1,this.version=t.version,this.lang=t.lang,this.echo=r.noEcho?!1:void 0,this.verbose=r.verbose,this.pedantic=r.pedantic,this.tls_required=r.tls?!0:void 0,this.name=r.name;const l=(r&&typeof r.authenticator=="function"?r.authenticator(s):{})||{};cu(this,l)}}class jb extends Tt{constructor(r,s,l={}){var d;super();A(this,"sid");A(this,"queue");A(this,"draining");A(this,"max");A(this,"subject");A(this,"drained");A(this,"protocol");A(this,"timer");A(this,"info");A(this,"cleanupFn");A(this,"closed");A(this,"requestSubject");cu(this,l),this.protocol=r,this.subject=s,this.draining=!1,this.noIterator=typeof l.callback=="function",this.closed=st();const c=!((d=r.options)!=null&&d.noAsyncTraces);l.timeout&&(this.timer=Gs(l.timeout,c),this.timer.then(()=>{this.timer=void 0}).catch(p=>{this.stop(p),this.noIterator&&this.callback(p,{})})),this.noIterator||this.iterClosed.then(()=>{this.closed.resolve(),this.unsubscribe()})}setPrePostHandlers(r){if(this.noIterator){const s=this.callback,l=r.ingestionFilterFn?r.ingestionFilterFn:()=>({ingest:!0,protocol:!1}),c=r.protocolFilterFn?r.protocolFilterFn:()=>!0,d=r.dispatchedFn?r.dispatchedFn:()=>{};this.callback=(p,y)=>{const{ingest:f}=l(y);f&&c(y)&&(s(p,y),d(y))}}else this.protocolFilterFn=r.protocolFilterFn,this.dispatchedFn=r.dispatchedFn}callback(r,s){this.cancelTimeout(),r?this.stop(r):this.push(s)}close(){if(!this.isClosed()){this.cancelTimeout();const r=()=>{if(this.stop(),this.cleanupFn)try{this.cleanupFn(this,this.info)}catch{}this.closed.resolve()};this.noIterator?r():this.push(r)}}unsubscribe(r){this.protocol.unsubscribe(this,r)}cancelTimeout(){this.timer&&(this.timer.cancel(),this.timer=void 0)}drain(){return this.protocol.isClosed()?Promise.reject(me.errorForCode(le.ConnectionClosed)):this.isClosed()?Promise.reject(me.errorForCode(le.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 uE{constructor(){A(this,"mux");A(this,"subs");A(this,"sidCounter");this.sidCounter=0,this.mux=null,this.subs=new Map}size(){return this.subs.size}add(t){return this.sidCounter++,t.sid=this.sidCounter,this.subs.set(t.sid,t),t}setMux(t){return this.mux=t,t}getMux(){return this.mux}get(t){return this.subs.get(t)}resub(t){return this.sidCounter++,this.subs.delete(t.sid),t.sid=this.sidCounter,this.subs.set(t.sid,t),t}all(){return Array.from(this.subs.values())}cancel(t){t&&(t.close(),this.subs.delete(t.sid))}handleError(t){if(t&&t.permissionContext){const r=t.permissionContext,s=this.all();let l;if(r.operation==="subscription"&&(l=s.find(c=>c.subject===r.subject&&c.queue===r.queue)),r.operation==="publish"&&(l=s.find(c=>c.requestSubject===r.subject)),l)return l.callback(t,{}),l.close(),this.subs.delete(l.sid),l!==this.mux}return!1}close(){this.subs.forEach(t=>{t.close()})}}class eu{constructor(t,r){A(this,"connected");A(this,"connectedOnce");A(this,"infoReceived");A(this,"info");A(this,"muxSubscriptions");A(this,"options");A(this,"outbound");A(this,"pongs");A(this,"subscriptions");A(this,"transport");A(this,"noMorePublishing");A(this,"connectError");A(this,"publisher");A(this,"_closed");A(this,"closed");A(this,"listeners");A(this,"heartbeats");A(this,"parser");A(this,"outMsgs");A(this,"inMsgs");A(this,"outBytes");A(this,"inBytes");A(this,"pendingLimit");A(this,"lastError");A(this,"abortReconnect");A(this,"whyClosed");A(this,"servers");A(this,"server");A(this,"features");A(this,"connectPromise");this._closed=!1,this.connected=!1,this.connectedOnce=!1,this.infoReceived=!1,this.noMorePublishing=!1,this.abortReconnect=!1,this.listeners=[],this.pendingLimit=aE,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=t,this.publisher=r,this.subscriptions=new uE,this.muxSubscriptions=new VS,this.outbound=new Vs,this.pongs=[],this.whyClosed="",this.pendingLimit=t.pendingLimit||this.pendingLimit,this.features=new AS({major:0,minor:0,micro:0}),this.connectPromise=null;const s=typeof t.servers=="string"?[t.servers]:t.servers;this.servers=new FS(s,{randomize:!t.noRandomize}),this.closed=st(),this.parser=new hy(this),this.heartbeats=new YS(this,this.options.pingInterval||Ob,this.options.maxPingOut||tE)}resetOutbound(){this.outbound.reset();const t=this.pongs;this.pongs=[];const r=me.errorForCode(le.Disconnect);r.stack="",t.forEach(s=>{s.reject(r)}),this.parser=new hy(this),this.infoReceived=!1}dispatchStatus(t){this.listeners.forEach(r=>{r.push(t)})}status(){const t=new Tt;return this.listeners.push(t),t}prepare(){this.transport&&this.transport.discard(),this.info=void 0,this.resetOutbound();const t=st();return t.catch(()=>{}),this.pongs.unshift(t),this.connectError=r=>{t.reject(r)},this.transport=NS(),this.transport.closed().then(async r=>{if(this.connected=!1,!this.isClosed()){await this.disconnected(this.transport.closeError||this.lastError);return}}),t}disconnect(){this.dispatchStatus({type:zs.StaleConnection,data:""}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:zs.ClientInitiatedReconnect,data:""}),this.transport.disconnect()),Promise.resolve()}async disconnected(t){this.dispatchStatus({type:wr.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{var r;this.dispatchStatus({type:wr.Reconnect,data:this.servers.getCurrentServer().toString()}),((r=this.lastError)==null?void 0:r.code)===le.AuthenticationExpired&&(this.lastError=void 0)}).catch(r=>{this._close(r)}):await this._close(t)}async dial(t){const r=this.prepare();let s;try{s=Gs(this.options.timeout||2e4);const l=this.transport.connect(t,this.options);await Promise.race([l,s]),(async()=>{try{for await(const c of this.transport)this.parser.parse(c)}catch(c){console.log("reader closed",c)}})().then()}catch(l){r.reject(l)}try{await Promise.race([s,r]),s&&s.cancel(),this.connected=!0,this.connectError=void 0,this.sendSubscriptions(),this.connectedOnce=!0,this.server.didConnect=!0,this.server.reconnects=0,this.flushPending(),this.heartbeats.start()}catch(l){throw s&&s.cancel(),await this.transport.close(l),l}}async _doDial(t){const{resolve:r}=this.options,s=await t.resolve({fn:ad(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:r});let l=null;for(const c of s)try{l=null,this.dispatchStatus({type:zs.Reconnecting,data:c.toString()}),await this.dial(c);return}catch(d){l=d}throw l}dialLoop(){return this.connectPromise===null&&(this.connectPromise=this.dodialLoop(),this.connectPromise.then(()=>{}).catch(()=>{}).finally(()=>{this.connectPromise=null})),this.connectPromise}async dodialLoop(){let t;for(;;){this._closed&&this.servers.clear();const r=this.options.reconnectDelayHandler?this.options.reconnectDelayHandler():Ab;let s=r;const l=this.selectServer();if(!l||this.abortReconnect)throw t||(this.lastError?this.lastError:me.errorForCode(le.ConnectionRefused));const c=Date.now();if(l.lastConnect===0||l.lastConnect+r<=c){l.lastConnect=Date.now();try{await this._doDial(l);break}catch(d){if(t=d,!this.connectedOnce){if(this.options.waitOnFirstConnect)continue;this.servers.removeCurrentServer()}l.reconnects++;const p=this.options.maxReconnectAttempts||0;p!==-1&&l.reconnects>=p&&this.servers.removeCurrentServer()}}else s=Math.min(s,l.lastConnect+r-c),await Ys(s)}}static async connect(t,r){const s=new eu(t,r);return await s.dialLoop(),s}static toError(t){const r=t?t.toLowerCase():"";if(r.indexOf("permissions violation")!==-1){const s=new me(t,le.PermissionsViolation),l=t.match(/(Publish|Subscription) to "(\S+)"/);if(l){s.permissionContext={operation:l[1].toLowerCase(),subject:l[2],queue:void 0};const c=t.match(/using queue "(\S+)"/);c&&(s.permissionContext.queue=c[1])}return s}else return r.indexOf("authorization violation")!==-1?new me(t,le.AuthorizationViolation):r.indexOf("user authentication expired")!==-1?new me(t,le.AuthenticationExpired):r.indexOf("account authentication expired")!=-1?new me(t,le.AccountExpired):r.indexOf("authentication timeout")!==-1?new me(t,le.AuthenticationTimeout):new me(t,le.ProtocolError)}processMsg(t,r){if(this.inMsgs++,this.inBytes+=r.length,!this.subscriptions.sidCounter)return;const s=this.subscriptions.get(t.sid);s&&(s.received+=1,s.callback&&s.callback(null,new Td(t,r,this)),s.max!==void 0&&s.received>=s.max&&s.unsubscribe())}processError(t){const r=Qg(t),s=eu.toError(r),l={type:wr.Error,data:s.code};if(s.isPermissionError()){let c=!1;if(s.permissionContext){l.permissionContext=s.permissionContext;const d=this.subscriptions.getMux();c=(d==null?void 0:d.subject)===s.permissionContext.subject}this.subscriptions.handleError(s),this.muxSubscriptions.handleError(c,s),c&&this.subscriptions.setMux(null)}this.dispatchStatus(l),this.handleError(s)}handleError(t){t.isAuthError()?this.handleAuthError(t):t.isProtocolError()?this.lastError=t:t.isAuthTimeout()&&(this.lastError=t),t.isPermissionError()||(this.lastError=t)}handleAuthError(t){this.lastError&&t.code===this.lastError.code&&this.options.ignoreAuthErrorAbort===!1&&(this.abortReconnect=!0),this.connectError?this.connectError(t):this.disconnect()}processPing(){this.transport.send(lE)}processPong(){const t=this.pongs.shift();t&&t.resolve()}processInfo(t){const r=JSON.parse(Qg(t));this.info=r;const s=this.options&&this.options.ignoreClusterUpdates?void 0:this.servers.update(r,this.transport.isEncrypted());if(!this.infoReceived){this.features.update($i(r.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();const{version:c,lang:d}=this.transport;try{const p=new cE({version:c,lang:d},this.options,r.nonce);r.headers&&(p.headers=!0,p.no_responders=!0);const y=JSON.stringify(p);this.transport.send(so(`CONNECT ${y}${Ic}`)),this.transport.send(py)}catch(p){this._close(p)}}s&&this.dispatchStatus({type:wr.Update,data:s}),(r.ldm!==void 0?r.ldm:!1)&&this.dispatchStatus({type:wr.LDM,data:this.servers.getCurrentServer().toString()})}push(t){switch(t.kind){case It.MSG:{const{msg:r,data:s}=t;this.processMsg(r,s);break}case It.OK:break;case It.ERR:this.processError(t.data);break;case It.PING:this.processPing();break;case It.PONG:this.processPong();break;case It.INFO:this.processInfo(t.data);break}}sendCommand(t,...r){const s=this.outbound.length();let l;typeof t=="string"?l=so(t):l=t,this.outbound.fill(l,...r),s===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(t,r=mn,s){let l;if(r instanceof Uint8Array)l=r;else if(typeof r=="string")l=Hi.encode(r);else throw me.errorForCode(le.BadPayload);let c=l.length;s=s||{},s.reply=s.reply||"";let d=mn,p=0;if(s.headers){if(this.info&&!this.info.headers)throw new me("headers",le.ServerOptionNotAvailable);d=s.headers.encode(),p=d.length,c=l.length+p}if(this.info&&c>this.info.max_payload)throw me.errorForCode(le.MaxPayloadExceeded);this.outBytes+=c,this.outMsgs++;let y;s.headers?(s.reply?y=`HPUB ${t} ${s.reply} ${p} ${c}\r
40
+ `:y=`HPUB ${t} ${p} ${c}\r
41
+ `,this.sendCommand(y,d,l,Wc)):(s.reply?y=`PUB ${t} ${s.reply} ${c}\r
42
+ `:y=`PUB ${t} ${c}\r
43
+ `,this.sendCommand(y,l,Wc))}request(t){return this.initMux(),this.muxSubscriptions.add(t),t}subscribe(t){return this.subscriptions.add(t),this._subunsub(t),t}_sub(t){t.queue?this.sendCommand(`SUB ${t.subject} ${t.queue} ${t.sid}\r
44
44
  `):this.sendCommand(`SUB ${t.subject} ${t.sid}\r
45
45
  `)}_subunsub(t){return this._sub(t),t.max&&this.unsubscribe(t,t.max),t}unsubscribe(t,r){this.unsub(t,r),(t.max===void 0||t.received>=t.max)&&this.subscriptions.cancel(t)}unsub(t,r){!t||this.isClosed()||(r?this.sendCommand(`UNSUB ${t.sid} ${r}\r
46
46
  `):this.sendCommand(`UNSUB ${t.sid}\r
47
- `),t.max=r)}resub(t,r){!t||this.isClosed()||(this.unsub(t),t.subject=r,this.subscriptions.resub(t),this._sub(t))}flush(t){return t||(t=st()),this.pongs.push(t),this.outbound.fill(py),this.flushPending(),t}sendSubscriptions(){const t=[];this.subscriptions.all().forEach(r=>{const s=r;s.queue?t.push(`SUB ${s.subject} ${s.queue} ${s.sid}${Ic}`):t.push(`SUB ${s.subject} ${s.sid}${Ic}`)}),t.length&&this.transport.send(so(t.join("")))}async _close(t){this._closed||(this.whyClosed=new Error("close trace").stack||"",this.heartbeats.cancel(),this.connectError&&(this.connectError(t),this.connectError=void 0),this.muxSubscriptions.close(),this.subscriptions.close(),this.listeners.forEach(r=>{r.stop()}),this._closed=!0,await this.transport.close(t),await this.closed.resolve(t))}close(){return this._close()}isClosed(){return this._closed}drain(){const t=this.subscriptions.all(),r=[];return t.forEach(s=>{r.push(s.drain())}),Promise.all(r).then(async()=>(this.noMorePublishing=!0,await this.flush(),this.close())).catch(()=>{})}flushPending(){if(!(!this.infoReceived||!this.connected)&&this.outbound.size()){const t=this.outbound.drain();this.transport.send(t)}}initMux(){if(!this.subscriptions.getMux()){const r=this.muxSubscriptions.init(this.options.inboxPrefix),s=new Ob(this,`${r}*`);s.callback=this.muxSubscriptions.dispatcher(),this.subscriptions.setMux(s),this.subscribe(s)}}selectServer(){const t=this.servers.selectServer();if(t!==void 0)return this.server=t,this.server}getServer(){return this.server}}const cE="$SRV";class gy{constructor(t){A(this,"msg");this.msg=t}get data(){return this.msg.data}get sid(){return this.msg.sid}get subject(){return this.msg.subject}get reply(){return this.msg.reply||""}get headers(){return this.msg.headers}respond(t,r){return this.msg.respond(t,r)}respondError(t,r,s,l){var c,d;return l=l||{},l.headers=l.headers||Er(),(c=l.headers)==null||c.set(Xc,`${t}`),(d=l.headers)==null||d.set(Kc,r),this.msg.respond(s,l)}json(t){return this.msg.json(t)}string(){return this.msg.string()}}class fo{constructor(t,r="",s=""){A(this,"subject");A(this,"queue");A(this,"srv");r!==""&&fE("service group",r);let l="";if(t instanceof bo)this.srv=t,l="";else if(t instanceof fo){const c=t;this.srv=c.srv,s===""&&c.queue!==""&&(s=c.queue),l=c.subject}else throw new Error("unknown ServiceGroup type");this.subject=this.calcSubject(l,r),this.queue=s}calcSubject(t,r=""){return r===""?t:t!==""?`${t}.${r}`:r}addEndpoint(t="",r){r=r||{subject:t};const s=typeof r=="function"?{handler:r,subject:t}:r;no("endpoint",t);let{subject:l,handler:c,metadata:d,queue:p}=s;l=l||t,p=p||this.queue,uE("endpoint subject",l),l=this.calcSubject(this.subject,l);const g={name:t,subject:l,queue:p,handler:c,metadata:d};return this.srv._addEndpoint(g)}addGroup(t="",r=""){return new fo(this,t,r)}}function uE(i,t){if(t==="")throw new Error(`${i} cannot be empty`);if(t.indexOf(" ")!==-1)throw new Error(`${i} cannot contain spaces: '${t}'`);const r=t.split(".");r.forEach((s,l)=>{if(s===">"&&l!==r.length-1)throw new Error(`${i} cannot have internal '>': '${t}'`)})}function fE(i,t){if(t.indexOf(" ")!==-1)throw new Error(`${i} cannot contain spaces: '${t}'`);t.split(".").forEach(s=>{if(s===">")throw new Error(`${i} name cannot contain internal '>': '${t}'`)})}class bo{constructor(t,r={name:"",version:""}){A(this,"nc");A(this,"_id");A(this,"config");A(this,"handlers");A(this,"internal");A(this,"_stopped");A(this,"_done");A(this,"started");this.nc=t,this.config=Object.assign({},r),this.config.queue||(this.config.queue="q"),no("name",this.config.name),no("queue",this.config.queue),$i(this.config.version),this._id=fi.next(),this.internal=[],this._done=st(),this._stopped=!1,this.handlers=[],this.started=new Date().toISOString(),this.reset(),this.nc.closed().then(()=>{this.close().catch()}).catch(s=>{this.close(s).catch()})}static controlSubject(t,r="",s="",l){const c=l??cE;return r===""&&s===""?`${c}.${t}`:(no("control subject name",r),s!==""?(no("control subject id",s),`${c}.${t}.${r}.${s}`):`${c}.${t}.${r}`)}get subjects(){return this.handlers.filter(t=>t.internal===!1).map(t=>t.subject)}get id(){return this._id}get name(){return this.config.name}get description(){return this.config.description??""}get version(){return this.config.version}get metadata(){return this.config.metadata}errorToHeader(t){const r=Er();if(t instanceof Jc){const s=t;r.set(Kc,s.message),r.set(Xc,`${s.code}`)}else r.set(Kc,t.message),r.set(Xc,"500");return r}setupHandler(t,r=!1){const s=r?"":t.queue?t.queue:this.config.queue,{name:l,subject:c,handler:d}=t,p=t;p.internal=r,r&&this.internal.push(p),p.stats=new hE(l,c,s),p.queue=s;const g=d?(f,m)=>{if(f){this.close(f);return}const b=Date.now();try{d(f,new gy(m))}catch(v){p.stats.countError(v),m==null||m.respond(dn,{headers:this.errorToHeader(v)})}finally{p.stats.countLatency(b)}}:void 0;return p.sub=this.nc.subscribe(c,{callback:g,queue:s}),p.sub.closed.then(()=>{this._stopped||this.close(new Error(`required subscription ${t.subject} stopped`)).catch()}).catch(f=>{if(!this._stopped){const m=new Error(`required subscription ${t.subject} errored: ${f.message}`);m.stack=f.stack,this.close(m).catch()}}),p}info(){return{type:ao.INFO,name:this.name,id:this.id,version:this.version,description:this.description,metadata:this.metadata,endpoints:this.endpoints()}}endpoints(){return this.handlers.map(t=>{const{subject:r,metadata:s,name:l,queue:c}=t;return{subject:r,metadata:s,name:l,queue_group:c}})}async stats(){const t=[];for(const r of this.handlers){if(typeof this.config.statsHandler=="function")try{r.stats.data=await this.config.statsHandler(r)}catch(s){r.stats.countError(s)}t.push(r.stats.stats(r.qi))}return{type:ao.STATS,name:this.name,id:this.id,version:this.version,started:this.started,metadata:this.metadata,endpoints:t}}addInternalHandler(t,r){const s=`${t}`.toUpperCase();this._doAddInternalHandler(`${s}-all`,t,r),this._doAddInternalHandler(`${s}-kind`,t,r,this.name),this._doAddInternalHandler(`${s}`,t,r,this.name,this.id)}_doAddInternalHandler(t,r,s,l="",c=""){const d={};d.name=t,d.subject=bo.controlSubject(r,l,c),d.handler=s,this.setupHandler(d,!0)}start(){const t=Hn(),r=(d,p)=>d?(this.close(d),Promise.reject(d)):this.stats().then(g=>(p==null||p.respond(t.encode(g)),Promise.resolve())),s=(d,p)=>d?(this.close(d),Promise.reject(d)):(p==null||p.respond(t.encode(this.info())),Promise.resolve()),l=t.encode(this.ping()),c=(d,p)=>d?(this.close(d).then().catch(),Promise.reject(d)):(p.respond(l),Promise.resolve());return this.addInternalHandler(ai.PING,c),this.addInternalHandler(ai.STATS,r),this.addInternalHandler(ai.INFO,s),this.handlers.forEach(d=>{const{subject:p}=d;typeof p=="string"&&d.handler!==null&&this.setupHandler(d)}),Promise.resolve(this)}close(t){if(this._stopped)return this._done;this._stopped=!0;let r=[];return this.nc.isClosed()||(r=this.handlers.concat(this.internal).map(s=>s.sub.drain())),Promise.allSettled(r).then(()=>{this._done.resolve(t||null)}),this._done}get stopped(){return this._done}get isStopped(){return this._stopped}stop(t){return this.close(t)}ping(){return{type:ao.PING,name:this.name,id:this.id,version:this.version,metadata:this.metadata}}reset(){if(this.started=new Date().toISOString(),this.handlers)for(const t of this.handlers)t.stats.reset(t.qi)}addGroup(t,r){return new fo(this,t,r)}addEndpoint(t,r){return new fo(this).addEndpoint(t,r)}_addEndpoint(t){const r=new Tt;r.noIterator=typeof t.handler=="function",r.noIterator||(t.handler=(l,c)=>{l?this.stop(l).catch():r.push(new gy(c))},r.iterClosed.then(()=>{this.close().catch()}));const s=this.setupHandler(t,!1);return s.qi=r,this.handlers.push(s),r}}class hE{constructor(t,r,s=""){A(this,"name");A(this,"subject");A(this,"average_processing_time");A(this,"num_requests");A(this,"processing_time");A(this,"num_errors");A(this,"last_error");A(this,"data");A(this,"metadata");A(this,"queue");this.name=t,this.subject=r,this.average_processing_time=0,this.num_errors=0,this.num_requests=0,this.processing_time=0,this.queue=s}reset(t){this.num_requests=0,this.processing_time=0,this.average_processing_time=0,this.num_errors=0,this.last_error=void 0,this.data=void 0;const r=t;r&&(r.time=0,r.processed=0)}countLatency(t){this.num_requests++,this.processing_time+=it(Date.now()-t),this.average_processing_time=Math.round(this.processing_time/this.num_requests)}countError(t){this.num_errors++,this.last_error=t.message}_stats(){const{name:t,subject:r,average_processing_time:s,num_errors:l,num_requests:c,processing_time:d,last_error:p,data:g,queue:f}=this;return{name:t,subject:r,average_processing_time:s,num_errors:l,num_requests:c,processing_time:d,last_error:p,data:g,queue_group:f}}stats(t){const r=t;return(r==null?void 0:r.noIterator)===!1&&(this.processing_time=it(r.time),this.num_requests=r.processed,this.average_processing_time=this.processing_time>0&&this.num_requests>0?this.processing_time/this.num_requests:0),this._stats()}}class dE{constructor(t,r={strategy:$n.JitterTimer,maxWait:2e3},s){A(this,"nc");A(this,"prefix");A(this,"opts");this.nc=t,this.prefix=s,this.opts=r}ping(t="",r=""){return this.q(ai.PING,t,r)}stats(t="",r=""){return this.q(ai.STATS,t,r)}info(t="",r=""){return this.q(ai.INFO,t,r)}async q(t,r="",s=""){const l=new Tt,c=Hn(),d=bo.controlSubject(t,r,s,this.prefix),p=await this.nc.requestMany(d,dn,this.opts);return(async()=>{for await(const g of p)try{const f=c.decode(g.data);l.push(f)}catch(f){l.push(()=>{l.stop(f)})}l.push(()=>{l.stop()})})().catch(g=>{l.stop(g)}),l}}function Ab(){return{key:{encode(i){return i},decode(i){return i}},value:{encode(i){return i},decode(i){return i}}}}function mE(){return{replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:Ab(),storage:nd.File}}const tu="KV-Operation",yy="$KV",pE=/^[-/=.\w]+$/,gE=/^[-/=.>*\w]+$/,yE=/^[-\w]+$/;function bE(i){if(i.startsWith(".")||i.endsWith(".")||!pE.test(i))throw new Error(`invalid key: ${i}`)}function vE(i){if(i.startsWith(".")||i.endsWith(".")||!gE.test(i))throw new Error(`invalid key: ${i}`)}function xE(i){if(i.startsWith(".")||i.endsWith("."))throw new Error(`invalid key: ${i}`);const t=i.split(".");let r=!1;for(let s=0;s<t.length;s++)switch(t[s]){case"*":r=!0;break;case">":if(s!==t.length-1)throw new Error(`invalid key: ${i}`);r=!0;break}return r}function $c(i){if(!yE.test(i))throw new Error(`invalid bucket name: ${i}`)}var Xn;(function(i){i.MsgIdHdr="Nats-Msg-Id",i.ExpectedStreamHdr="Nats-Expected-Stream",i.ExpectedLastSeqHdr="Nats-Expected-Last-Sequence",i.ExpectedLastMsgIdHdr="Nats-Expected-Last-Msg-Id",i.ExpectedLastSubjectSequenceHdr="Nats-Expected-Last-Subject-Sequence"})(Xn||(Xn={}));class ho{constructor(t,r,s){A(this,"js");A(this,"jsm");A(this,"stream");A(this,"bucket");A(this,"direct");A(this,"codec");A(this,"prefix");A(this,"editPrefix");A(this,"useJsPrefix");A(this,"_prefixLen");A(this,"validateKey",bE);A(this,"validateSearchKey",vE);A(this,"hasWildcards",xE);$c(t),this.js=r,this.jsm=s,this.bucket=t,this.prefix=yy,this.editPrefix="",this.useJsPrefix=!1,this._prefixLen=0}static async create(t,r,s={}){$c(r);const l=await t.jetstreamManager(),c=new ho(r,t,l);return await c.init(s),c}static async bind(t,r,s={}){const l=await t.jetstreamManager(),c={config:{allow_direct:s.allow_direct}};$c(r);const d=new ho(r,t,l);return c.config.name=s.streamName??d.bucketName(),Object.assign(d,c),d.stream=c.config.name,d.codec=s.codec||Ab(),d.direct=c.config.allow_direct??!1,d.initializePrefixes(c),d}async init(t={}){const r=Object.assign(mE(),t);this.codec=r.codec;const s={};this.stream=s.name=t.streamName??this.bucketName(),s.retention=td.Limits,s.max_msgs_per_subject=r.history,r.maxBucketSize&&(r.max_bytes=r.maxBucketSize),r.max_bytes&&(s.max_bytes=r.max_bytes),s.max_msg_size=r.maxValueSize,s.storage=r.storage;const l=t.placementCluster??"";if(l&&(t.placement={},t.placement.cluster=l,t.placement.tags=[]),t.placement&&(s.placement=t.placement),t.republish&&(s.republish=t.republish),t.description&&(s.description=t.description),t.mirror){const b=Object.assign({},t.mirror);b.name.startsWith(un)||(b.name=`${un}${b.name}`),s.mirror=b,s.mirror_direct=!0}else if(t.sources){const b=t.sources.map(v=>{const _=Object.assign({},v),w=_.name.startsWith(un)?_.name.substring(un.length):_.name;return _.name.startsWith(un)||(_.name=`${un}${_.name}`),!v.external&&w!==this.bucket&&(_.subject_transforms=[{src:`$KV.${w}.>`,dest:`$KV.${this.bucket}.>`}]),_});s.sources=b,s.subjects=[this.subjectForBucket()]}else s.subjects=[this.subjectForBucket()];t.metadata&&(s.metadata=t.metadata),typeof t.compression=="boolean"&&(s.compression=t.compression?hi.S2:hi.None);const c=this.js.nc,d=c.getServerVersion(),p=d?id(d,$i("2.7.2"))>=0:!1;s.discard=p?uo.New:uo.Old;const{ok:g,min:f}=c.features.get(Ie.JS_ALLOW_DIRECT);if(!g&&t.allow_direct===!0){const b=d?`${d.major}.${d.minor}.${d.micro}`:"unknown";return Promise.reject(new Error(`allow_direct is not available on server version ${b} - requires ${f}`))}t.allow_direct=typeof t.allow_direct=="boolean"?t.allow_direct:g,s.allow_direct=t.allow_direct,this.direct=s.allow_direct,s.num_replicas=r.replicas,r.ttl&&(s.max_age=it(r.ttl)),s.allow_rollup_hdrs=!0;let m;try{m=await this.jsm.streams.info(s.name),!m.config.allow_direct&&this.direct===!0&&(this.direct=!1)}catch(b){if(b.message==="stream not found")m=await this.jsm.streams.add(s);else throw b}this.initializePrefixes(m)}initializePrefixes(t){this._prefixLen=0,this.prefix=`$KV.${this.bucket}`,this.useJsPrefix=this.js.apiPrefix!=="$JS.API";const{mirror:r}=t.config;if(r){let s=r.name;if(s.startsWith(un)&&(s=s.substring(un.length)),r.external&&r.external.api!==""){const l=r.name.substring(un.length);this.useJsPrefix=!1,this.prefix=`$KV.${l}`,this.editPrefix=`${r.external.api}.$KV.${s}`}else this.editPrefix=this.prefix}}bucketName(){return this.stream??`${un}${this.bucket}`}subjectForBucket(){return`${this.prefix}.${this.bucket}.>`}subjectForKey(t,r=!1){const s=[];return r?(this.useJsPrefix&&s.push(this.js.apiPrefix),this.editPrefix!==""?s.push(this.editPrefix):s.push(this.prefix)):this.prefix&&s.push(this.prefix),s.push(t),s.join(".")}fullKeyName(t){return this.prefix!==""?`${this.prefix}.${t}`:`${yy}.${this.bucket}.${t}`}get prefixLen(){return this._prefixLen===0&&(this._prefixLen=this.prefix.length+1),this._prefixLen}encodeKey(t){const r=[];for(const s of t.split("."))switch(s){case">":case"*":r.push(s);break;default:r.push(this.codec.key.encode(s));break}return r.join(".")}decodeKey(t){const r=[];for(const s of t.split("."))switch(s){case">":case"*":r.push(s);break;default:r.push(this.codec.key.decode(s));break}return r.join(".")}close(){return Promise.resolve()}dataLen(t,r){const s=r&&r.get($t.MessageSizeHdr)||"";return s!==""?parseInt(s,10):t.length}smToEntry(t){return new qE(this.bucket,this.prefixLen,t)}jmToEntry(t){const r=this.decodeKey(t.subject.substring(this.prefixLen));return new BE(this.bucket,r,t)}async create(t,r){var c;let s;try{const d=await this.put(t,r,{previousSeq:0});return Promise.resolve(d)}catch(d){if(s=d,((c=d==null?void 0:d.api_error)==null?void 0:c.err_code)!==10071)return Promise.reject(d)}let l=0;try{const d=await this.get(t);return(d==null?void 0:d.operation)==="DEL"||(d==null?void 0:d.operation)==="PURGE"?(l=d!==null?d.revision:0,this.update(t,r,l)):Promise.reject(s)}catch(d){return Promise.reject(d)}}update(t,r,s){if(s<=0)throw new Error("version must be greater than 0");return this.put(t,r,{previousSeq:s})}async put(t,r,s={}){var d,p;const l=this.encodeKey(t);this.validateKey(l);const c={};if(s.previousSeq!==void 0){const g=Er();c.headers=g,g.set(Xn.ExpectedLastSubjectSequenceHdr,`${s.previousSeq}`)}try{return(await this.js.publish(this.subjectForKey(l,!0),r,c)).seq}catch(g){const f=g;return f.isJetStreamError()?(f.message=(d=f.api_error)==null?void 0:d.description,f.code=`${(p=f.api_error)==null?void 0:p.code}`,Promise.reject(f)):Promise.reject(g)}}async get(t,r){const s=this.encodeKey(t);this.validateKey(s);let l={last_by_subj:this.subjectForKey(s)};r&&r.revision>0&&(l={seq:r.revision});let c;try{this.direct?c=await this.jsm.direct.getMessage(this.bucketName(),l):c=await this.jsm.streams.getMessage(this.bucketName(),l);const d=this.smToEntry(c);return d.key!==s?null:d}catch(d){if(d.code===le.JetStream404NoMessages)return null;throw d}}purge(t,r){return this._deleteOrPurge(t,"PURGE",r)}delete(t,r){return this._deleteOrPurge(t,"DEL",r)}async purgeDeletes(t=1800*1e3){const r=st(),s=[],l=await this.watch({key:">",initializedFn:()=>{r.resolve()}});(async()=>{for await(const g of l)(g.operation==="DEL"||g.operation==="PURGE")&&s.push(g)})().then(),await r,l.stop();const c=Date.now()-t,d=s.map(g=>{const f=this.subjectForKey(g.key);return g.created.getTime()>=c?this.jsm.streams.purge(this.stream,{filter:f,keep:1}):this.jsm.streams.purge(this.stream,{filter:f,keep:0})}),p=await Promise.all(d);return p.unshift({success:!0,purged:0}),p.reduce((g,f)=>(g.purged+=f.purged,g))}async _deleteOrPurge(t,r,s){if(!this.hasWildcards(t))return this._doDeleteOrPurge(t,r,s);const l=await this.keys(t),c=[];for await(const d of l)c.push(this._doDeleteOrPurge(d,r)),c.length===100&&(await Promise.all(c),c.length=0);c.length>0&&await Promise.all(c)}async _doDeleteOrPurge(t,r,s){const l=this.encodeKey(t);this.validateKey(l);const c=Er();c.set(tu,r),r==="PURGE"&&c.set($t.RollupHdr,$t.RollupValueSubject),s!=null&&s.previousSeq&&c.set(Xn.ExpectedLastSubjectSequenceHdr,`${s.previousSeq}`),await this.js.publish(this.subjectForKey(l,!0),dn,{headers:c})}_buildCC(t,r,s={}){let c=(Array.isArray(t)?t:[t]).map(g=>{const f=this.encodeKey(g);return this.validateSearchKey(g),this.fullKeyName(f)}),d=mt.LastPerSubject;r===Un.AllHistory&&(d=mt.All),r===Un.UpdatesOnly&&(d=mt.New);let p;return c.length===1&&(p=c[0],c=void 0),Object.assign({deliver_policy:d,ack_policy:At.None,filter_subjects:c,filter_subject:p,flow_control:!0,idle_heartbeat:it(5*1e3)},s)}remove(t){return this.purge(t)}async history(t={}){const r=t.key??">",s=new Tt,l={};l.headers_only=t.headers_only||!1;let c;c=()=>{s.stop()};let d=0;const p=this._buildCC(r,Un.AllHistory,l),g=p.filter_subject,f=li(p);f.bindStream(this.stream),f.orderedConsumer(),f.callback((b,v)=>{if(b){s.stop(b);return}if(v){const _=this.jmToEntry(v);s.push(_),s.received++,(c&&d>0&&s.received>=d||v.info.pending===0)&&(s.push(c),c=void 0)}});const m=await this.js.subscribe(g,f);if(c){const{info:{last:b}}=m,v=b.num_pending+b.delivered.consumer_seq;if(v===0||s.received>=v)try{c()}catch(_){s.stop(_)}finally{c=void 0}else d=v}return s._data=m,s.iterClosed.then(()=>{m.unsubscribe()}),m.closed.then(()=>{s.stop()}).catch(b=>{s.stop(b)}),s}canSetWatcherName(){const r=this.js.nc,{ok:s}=r.features.get(Ie.JS_NEW_CONSUMER_CREATE_API);return s}async watch(t={}){const r=t.key??">",s=new Tt,l={};l.headers_only=t.headers_only||!1;let c=Un.LastValue;t.include===Un.AllHistory?c=Un.AllHistory:t.include===Un.UpdatesOnly&&(c=Un.UpdatesOnly);const d=t.ignoreDeletes===!0;let p=t.initializedFn,g=0;const f=this._buildCC(r,c,l),m=f.filter_subject,b=li(f);this.canSetWatcherName()&&b.consumerName(fi.next()),b.bindStream(this.stream),t.resumeFromRevision&&t.resumeFromRevision>0&&b.startSequence(t.resumeFromRevision),b.orderedConsumer(),b.callback((_,w)=>{if(_){s.stop(_);return}if(w){const S=this.jmToEntry(w);if(d&&S.operation==="DEL")return;s.push(S),s.received++,p&&(g>0&&s.received>=g||w.info.pending===0)&&(s.push(p),p=void 0)}});const v=await this.js.subscribe(m,b);if(p){const{info:{last:_}}=v,w=_.num_pending+_.delivered.consumer_seq;if(w===0||s.received>=w)try{p()}catch(S){s.stop(S)}finally{p=void 0}else g=w}return s._data=v,s.iterClosed.then(()=>{v.unsubscribe()}),v.closed.then(()=>{s.stop()}).catch(_=>{s.stop(_)}),s}async keys(t=">"){const r=new Tt,s=this._buildCC(t,Un.LastValue,{headers_only:!0}),l=Array.isArray(t)?">":s.filter_subject,c=li(s);c.bindStream(this.stream),c.orderedConsumer();const d=await this.js.subscribe(l,c);return(async()=>{var g;for await(const f of d){const m=(g=f.headers)==null?void 0:g.get(tu);if(m!=="DEL"&&m!=="PURGE"){const b=this.decodeKey(f.subject.substring(this.prefixLen));r.push(b)}f.info.pending===0&&d.unsubscribe()}})().then(()=>{r.stop()}).catch(g=>{r.stop(g)}),d.info.last.num_pending===0&&d.unsubscribe(),r}purgeBucket(t){return this.jsm.streams.purge(this.bucketName(),t)}destroy(){return this.jsm.streams.delete(this.bucketName())}async status(){var c;const r=((c=this.js.nc.info)==null?void 0:c.cluster)??"",s=this.bucketName(),l=await this.jsm.streams.info(s);return new jb(l,r)}}class jb{constructor(t,r=""){A(this,"si");A(this,"cluster");this.si=t,this.cluster=r}get bucket(){return this.si.config.name.startsWith(un)?this.si.config.name.substring(un.length):this.si.config.name}get values(){return this.si.state.messages}get history(){return this.si.config.max_msgs_per_subject}get ttl(){return Ad(this.si.config.max_age)}get bucket_location(){return this.cluster}get backingStore(){return this.si.config.storage}get storage(){return this.si.config.storage}get replicas(){return this.si.config.num_replicas}get description(){return this.si.config.description??""}get maxBucketSize(){return this.si.config.max_bytes}get maxValueSize(){return this.si.config.max_msg_size}get max_bytes(){return this.si.config.max_bytes}get placement(){return this.si.config.placement||{cluster:"",tags:[]}}get placementCluster(){var t;return((t=this.si.config.placement)==null?void 0:t.cluster)??""}get republish(){return this.si.config.republish??{src:"",dest:""}}get streamInfo(){return this.si}get size(){return this.si.state.bytes}get metadata(){return this.si.config.metadata??{}}get compression(){return this.si.config.compression?this.si.config.compression!==hi.None:!1}}const Nd="OBJ_",by="SHA-256=";function _E(i){return $c(i),`${Nd}${i}`}function wE(i){return i.startsWith(Nd)?i.substring(4):i}class ld{constructor(t){A(this,"si");A(this,"backingStore");this.si=t,this.backingStore="JetStream"}get bucket(){return wE(this.si.config.name)}get description(){return this.si.config.description??""}get ttl(){return this.si.config.max_age}get storage(){return this.si.config.storage}get replicas(){return this.si.config.num_replicas}get sealed(){return this.si.config.sealed}get size(){return this.si.state.bytes}get streamInfo(){return this.si}get metadata(){return this.si.config.metadata}get compression(){return this.si.config.compression?this.si.config.compression!==hi.None:!1}}function Kl(i){if(i===void 0)return;const{domain:t}=i;if(t===void 0)return i;const r=Object.assign({},i);if(delete r.domain,t==="")return r;if(r.external)throw new Error("domain and external are both set");return r.external={api:`$JS.${t}.API`},r}var Tn;(function(i){i[i.Unset=-1]="Unset",i[i.Consume=0]="Consume",i[i.Fetch=1]="Fetch"})(Tn||(Tn={}));var Jn;(function(i){i.HeartbeatsMissed="heartbeats_missed",i.ConsumerNotFound="consumer_not_found",i.StreamNotFound="stream_not_found",i.ConsumerDeleted="consumer_deleted",i.OrderedConsumerRecreated="ordered_consumer_recreated",i.NoResponders="no_responders"})(Jn||(Jn={}));var $s;(function(i){i.DebugEvent="debug",i.Discard="discard",i.Reset="reset",i.Next="next"})($s||($s={}));const vy=Uint8Array.of(43,65,67,75),SE=Uint8Array.of(45,78,65,75),Va=Uint8Array.of(43,87,80,73),EE=Uint8Array.of(43,78,88,84),OE=Uint8Array.of(43,84,69,82,77),AE=Uint8Array.of(32);function mo(i,t=5e3){return new HE(i,t)}class zh extends Tt{constructor(r,s,l=!1){super();A(this,"consumer");A(this,"opts");A(this,"sub");A(this,"monitor");A(this,"pending");A(this,"inbox");A(this,"refilling");A(this,"pong");A(this,"callback");A(this,"timeout");A(this,"cleanupHandler");A(this,"listeners");A(this,"statusIterator");A(this,"forOrderedConsumer");A(this,"resetHandler");A(this,"abortOnMissingResource");A(this,"bind");A(this,"inBackOff");this.consumer=r;const c=s;this.opts=this.parseOptions(s,l),this.callback=c.callback||null,this.noIterator=typeof this.callback=="function",this.monitor=null,this.pong=null,this.pending={msgs:0,bytes:0,requests:0},this.refilling=l,this.timeout=null,this.inbox=Sr(r.api.nc.options.inboxPrefix),this.listeners=[],this.forOrderedConsumer=!1,this.abortOnMissingResource=c.abort_on_missing_resource===!0,this.bind=c.bind===!0,this.inBackOff=!1,this.start()}start(){const{max_messages:r,max_bytes:s,idle_heartbeat:l,threshold_bytes:c,threshold_messages:d}=this.opts;this.closed().then(g=>{if(this.cleanupHandler)try{this.cleanupHandler(g)}catch{}});const{sub:p}=this;p&&p.unsubscribe(),this.sub=this.consumer.api.nc.subscribe(this.inbox,{callback:(g,f)=>{var b,v,_,w;if(g){this.stop(g);return}if((b=this.monitor)==null||b.work(),f.subject===this.inbox){if(ed(f))return;const S=(v=f.headers)==null?void 0:v.code,M=((w=(_=f.headers)==null?void 0:_.description)==null?void 0:w.toLowerCase())||"unknown",{msgsLeft:B,bytesLeft:U}=this.parseDiscard(f.headers);if(B>0||U>0)this.pending.msgs-=B,this.pending.bytes-=U,this.pending.requests--,this.notify($s.Discard,{msgsLeft:B,bytesLeft:U});else if(S===400){this.stop(new me(M,`${S}`));return}else if(S===409&&M==="consumer deleted"){if(this.notify(Jn.ConsumerDeleted,`${S} ${M}`),!this.refilling||this.abortOnMissingResource){const ie=new me(M,`${S}`);this.stop(ie);return}}else if(S===503){if(this.notify(Jn.NoResponders,`${S} No Responders`),!this.refilling||this.abortOnMissingResource){const ie=new me("no responders",`${S}`);this.stop(ie);return}}else this.notify($s.DebugEvent,`${S} ${M}`)}else this._push(mo(f,this.consumer.api.timeout)),this.received++,this.pending.msgs&&this.pending.msgs--,this.pending.bytes&&(this.pending.bytes-=f.size());if(this.pending.msgs===0&&this.pending.bytes===0&&(this.pending.requests=0),this.refilling){if(r&&this.pending.msgs<=d||s&&this.pending.bytes<=c){const S=this.pullOptions();this.pull(S)}}else this.pending.requests===0&&this._push(()=>{this.stop()})}}),this.sub.closed.then(()=>{this.sub.draining&&this._push(()=>{this.stop()})}),l&&(this.monitor=new Td(l,g=>(this.notify(Jn.HeartbeatsMissed,g),this.resetPending().then(()=>{}).catch(()=>{}),!1),{maxOut:2})),(async()=>{var f;const g=this.consumer.api.nc.status();this.statusIterator=g;for await(const m of g)switch(m.type){case wr.Disconnect:(f=this.monitor)==null||f.cancel();break;case wr.Reconnect:this.resetPending().then(b=>{var v;b&&((v=this.monitor)==null||v.restart())}).catch(()=>{});break}})(),this.pull(this.pullOptions())}_push(r){if(!this.callback)super.push(r);else{const s=typeof r=="function"?r:null;try{s?s():this.callback(r)}catch(l){this.stop(l)}}}notify(r,s){this.listeners.length>0&&this.listeners.forEach(l=>{l.done||l.push({type:r,data:s})})}resetPending(){return this.bind?this.resetPendingNoInfo():this.resetPendingWithInfo()}resetPendingNoInfo(){return this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),Promise.resolve(!0)}async resetPendingWithInfo(){if(this.inBackOff)return!1;let r=0,s=0;const l=Od([this.opts.expires]);let c=0;for(;;){if(this.done)return!1;if(this.consumer.api.nc.isClosed())return console.error("aborting resetPending - connection is closed"),!1;try{return await this.consumer.info(),this.inBackOff=!1,r=0,this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),!0}catch(d){if(d.message==="stream not found"){if(s++,this.notify(Jn.StreamNotFound,s),!this.refilling||this.abortOnMissingResource)return this.stop(d),!1}else if(d.message==="consumer not found"){if(r++,this.notify(Jn.ConsumerNotFound,r),this.resetHandler)try{this.resetHandler()}catch{}if(!this.refilling||this.abortOnMissingResource)return this.stop(d),!1;if(this.forOrderedConsumer)return!1}else r=0,s=0;this.inBackOff=!0;const p=l.backoff(c),g=Ys(p);await Promise.race([g,this.consumer.api.nc.closed()]),g.cancel(),c++}}}pull(r){this.pending.bytes+=r.max_bytes??0,this.pending.msgs+=r.batch??0,this.pending.requests++;const s=this.consumer.api.nc;this._push(()=>{s.publish(`${this.consumer.api.prefix}.CONSUMER.MSG.NEXT.${this.consumer.stream}.${this.consumer.name}`,this.consumer.api.jc.encode(r),{reply:this.inbox}),this.notify($s.Next,r)})}pullOptions(){const r=this.opts.max_messages-this.pending.msgs,s=this.opts.max_bytes-this.pending.bytes,l=it(this.opts.idle_heartbeat),c=it(this.opts.expires);return{batch:r,max_bytes:s,idle_heartbeat:l,expires:c}}parseDiscard(r){const s={msgsLeft:0,bytesLeft:0},l=r==null?void 0:r.get($t.PendingMessagesHdr);l&&(s.msgsLeft=parseInt(l));const c=r==null?void 0:r.get($t.PendingBytesHdr);return c&&(s.bytesLeft=parseInt(c)),s}trackTimeout(r){this.timeout=r}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}clearTimers(){var r,s;(r=this.monitor)==null||r.cancel(),this.monitor=null,(s=this.timeout)==null||s.cancel(),this.timeout=null}setCleanupHandler(r){this.cleanupHandler=r}stop(r){var s,l;this.done||((s=this.sub)==null||s.unsubscribe(),this.clearTimers(),(l=this.statusIterator)==null||l.stop(),this._push(()=>{super.stop(r),this.listeners.forEach(c=>{c.stop()})}))}parseOptions(r,s=!1){const l=r||{};if(l.max_messages=l.max_messages||0,l.max_bytes=l.max_bytes||0,l.max_messages!==0&&l.max_bytes!==0)throw new Error("only specify one of max_messages or max_bytes");if(l.max_messages===0&&(l.max_messages=100),l.expires=l.expires||3e4,l.expires<1e3)throw new Error("expires should be at least 1000ms");if(l.idle_heartbeat=l.idle_heartbeat||l.expires/2,l.idle_heartbeat=l.idle_heartbeat>3e4?3e4:l.idle_heartbeat,s){const c=Math.round(l.max_messages*.75)||1;l.threshold_messages=l.threshold_messages||c;const d=Math.round(l.max_bytes*.75)||1;l.threshold_bytes=l.threshold_bytes||d}return l}status(){const r=new Tt;return this.listeners.push(r),Promise.resolve(r)}}class jE extends Tt{constructor(){super();A(this,"src");A(this,"listeners");this.listeners=[]}setSource(r){this.src&&(this.src.resetHandler=void 0,this.src.setCleanupHandler(),this.src.stop()),this.src=r,this.src.setCleanupHandler(s=>{this.stop(s||void 0)}),(async()=>{const s=await this.src.status();for await(const l of s)this.notify(l.type,l.data)})().catch(()=>{})}notify(r,s){this.listeners.length>0&&this.listeners.forEach(l=>{l.done||l.push({type:r,data:s})})}stop(r){var s;this.done||((s=this.src)==null||s.stop(r),super.stop(r),this.listeners.forEach(l=>{l.stop()}))}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}status(){const r=new Tt;return this.listeners.push(r),Promise.resolve(r)}}class cd{constructor(t,r){A(this,"api");A(this,"_info");A(this,"stream");A(this,"name");this.api=t,this._info=r,this.stream=r.stream_name,this.name=r.name}consume(t={max_messages:100,expires:3e4}){return Promise.resolve(new zh(this,t,!0))}fetch(t={max_messages:100,expires:3e4}){const r=new zh(this,t,!1),s=Math.round(r.opts.expires*1.05),l=Gs(s);return r.closed().catch(()=>{}).finally(()=>{l.cancel()}),l.catch(()=>{r.close().catch()}),r.trackTimeout(l),Promise.resolve(r)}next(t={expires:3e4}){const r=st(),s=t;s.max_messages=1;const l=new zh(this,s,!1),c=Math.round(l.opts.expires*1.05);c>=6e4&&(async()=>{for await(const p of await l.status())if(p.type===Jn.HeartbeatsMissed&&p.data>=2){r.reject(new Error("consumer missed heartbeats"));break}})().catch(),(async()=>{for await(const p of l){r.resolve(p);break}})().catch(()=>{});const d=Gs(c);return l.closed().then(p=>{p?r.reject(p):r.resolve(null)}).catch(p=>{r.reject(p)}).finally(()=>{d.cancel()}),d.catch(p=>{r.resolve(null),l.close().catch()}),l.trackTimeout(d),r}delete(){const{stream_name:t,name:r}=this._info;return this.api.delete(t,r)}info(t=!1){if(t)return Promise.resolve(this._info);const{stream_name:r,name:s}=this._info;return this.api.info(r,s).then(l=>(this._info=l,this._info))}}class TE{constructor(t,r,s={}){A(this,"api");A(this,"consumerOpts");A(this,"consumer");A(this,"opts");A(this,"cursor");A(this,"stream");A(this,"namePrefix");A(this,"serial");A(this,"currentConsumer");A(this,"userCallback");A(this,"iter");A(this,"type");A(this,"startSeq");A(this,"maxInitialReset");this.api=t,this.stream=r,this.cursor={stream_seq:1,deliver_seq:0},this.namePrefix=fi.next(),typeof s.name_prefix=="string"&&(uu("name_prefix",s.name_prefix),this.namePrefix=s.name_prefix+this.namePrefix),this.serial=0,this.currentConsumer=null,this.userCallback=null,this.iter=null,this.type=Tn.Unset,this.consumerOpts=s,this.maxInitialReset=30,this.startSeq=this.consumerOpts.opt_start_seq||0,this.cursor.stream_seq=this.startSeq>0?this.startSeq-1:0}getConsumerOpts(t){this.serial++;const r=`${this.namePrefix}_${this.serial}`;t=t===0?1:t;const s={name:r,deliver_policy:mt.StartSequence,opt_start_seq:t,ack_policy:At.None,inactive_threshold:it(300*1e3),num_replicas:1};return this.consumerOpts.headers_only===!0&&(s.headers_only=!0),Array.isArray(this.consumerOpts.filterSubjects)&&(s.filter_subjects=this.consumerOpts.filterSubjects),typeof this.consumerOpts.filterSubjects=="string"&&(s.filter_subject=this.consumerOpts.filterSubjects),this.consumerOpts.replay_policy&&(s.replay_policy=this.consumerOpts.replay_policy),t===this.startSeq+1&&(s.deliver_policy=this.consumerOpts.deliver_policy||mt.StartSequence,(this.consumerOpts.deliver_policy===mt.LastPerSubject||this.consumerOpts.deliver_policy===mt.New||this.consumerOpts.deliver_policy===mt.Last)&&(delete s.opt_start_seq,s.deliver_policy=this.consumerOpts.deliver_policy),s.deliver_policy===mt.LastPerSubject&&typeof s.filter_subjects>"u"&&typeof s.filter_subject>"u"&&(s.filter_subject=">"),this.consumerOpts.opt_start_time&&(delete s.opt_start_seq,s.deliver_policy=mt.StartTime,s.opt_start_time=this.consumerOpts.opt_start_time),this.consumerOpts.inactive_threshold&&(s.inactive_threshold=it(this.consumerOpts.inactive_threshold))),s}async resetConsumer(t=0){var d,p,g,f,m;fi.next();const r=this.serial===0;(d=this.consumer)==null||d.delete().catch(()=>{}),t=t===0?1:t,this.cursor.deliver_seq=0;const s=this.getConsumerOpts(t);s.max_deliver=1,s.mem_storage=!0;const l=Od([((p=this.opts)==null?void 0:p.expires)||3e4]);let c;for(let b=0;;b++)try{c=await this.api.add(this.stream,s),(g=this.iter)==null||g.notify(Jn.OrderedConsumerRecreated,c.name);break}catch(v){if(v.message==="stream not found"&&((f=this.iter)==null||f.notify(Jn.StreamNotFound,b),this.type===Tn.Fetch||this.opts.abort_on_missing_resource===!0))return(m=this.iter)==null||m.stop(v),Promise.reject(v);if(r&&b>=this.maxInitialReset)throw v;await Ys(l.backoff(b+1))}return c}internalHandler(t){return r=>{var l;if(this.serial!==t)return;const s=r.info.deliverySequence;if(s!==this.cursor.deliver_seq+1){this.notifyOrderedResetAndReset();return}this.cursor.deliver_seq=s,this.cursor.stream_seq=r.info.streamSequence,this.userCallback?this.userCallback(r):(l=this.iter)==null||l.push(r)}}async reset(t={max_messages:100,expires:3e4},r){var g,f;r=r||{};const s=r.fromFetch||!1,l=r.orderedReset||!1;if(this.type===Tn.Fetch&&l){(g=this.iter)==null||g.src.stop(),await((f=this.iter)==null?void 0:f.closed()),this.currentConsumer=null;return}(this.currentConsumer===null||l)&&(this.currentConsumer=await this.resetConsumer(this.cursor.stream_seq+1)),(this.iter===null||s)&&(this.iter=new jE),this.consumer=new cd(this.api,this.currentConsumer);const c=t;c.callback=this.internalHandler(this.serial);let d=null;this.type===Tn.Fetch&&s?d=await this.consumer.fetch(t):this.type===Tn.Consume&&(d=await this.consumer.consume(t));const p=d;p.forOrderedConsumer=!0,p.resetHandler=()=>{this.notifyOrderedResetAndReset()},this.iter.setSource(p)}notifyOrderedResetAndReset(){var t;(t=this.iter)==null||t.notify($s.Reset,""),this.reset(this.opts,{orderedReset:!0})}async consume(t={max_messages:100,expires:3e4}){if(t.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===Tn.Fetch)return Promise.reject(new Error("ordered consumer initialized as fetch"));if(this.type===Tn.Consume)return Promise.reject(new Error("ordered consumer doesn't support concurrent consume"));const{callback:s}=t;return s&&(this.userCallback=s),this.type=Tn.Consume,this.opts=t,await this.reset(t),this.iter}async fetch(t={max_messages:100,expires:3e4}){var l;if(t.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===Tn.Consume)return Promise.reject(new Error("ordered consumer already initialized as consume"));if(((l=this.iter)==null?void 0:l.done)===!1)return Promise.reject(new Error("ordered consumer doesn't support concurrent fetch"));const{callback:s}=t;return s&&(this.userCallback=s),this.type=Tn.Fetch,this.opts=t,await this.reset(t,{fromFetch:!0}),this.iter}async next(t={expires:3e4}){const r=t;if(r.bind)return Promise.reject(new Error("bind is not supported"));r.max_messages=1;const s=st();return r.callback=c=>{this.userCallback=null,s.resolve(c)},(await this.fetch(r)).iterClosed.then(c=>{c&&s.reject(c),s.resolve(null)}).catch(c=>{s.reject(c)}),s}delete(){return this.currentConsumer?this.api.delete(this.stream,this.currentConsumer.name).then(t=>Promise.resolve(t)).catch(t=>Promise.reject(t)).finally(()=>{this.currentConsumer=null}):Promise.resolve(!1)}async info(t){return this.currentConsumer==null?(this.currentConsumer=await this.resetConsumer(this.startSeq),Promise.resolve(this.currentConsumer)):t&&this.currentConsumer?Promise.resolve(this.currentConsumer):this.api.info(this.stream,this.currentConsumer.name)}}class ud{constructor(t){A(this,"api");A(this,"notified");this.api=t,this.notified=!1}checkVersion(){const t=this.api.nc.features.get(Ie.JS_SIMPLIFICATION);return t.ok?Promise.resolve():Promise.reject(new Error(`consumers framework is only supported on servers ${t.min} or better`))}getPullConsumerFor(t){if(t.config.deliver_subject!==void 0)throw new Error("push consumer not supported");return new cd(this.api,t)}async get(t,r={}){return typeof r=="object"?this.ordered(t,r):(await this.checkVersion(),this.api.info(t,r).then(s=>s.config.deliver_subject!==void 0?Promise.reject(new Error("push consumer not supported")):new cd(this.api,s)).catch(s=>Promise.reject(s)))}async ordered(t,r){await this.checkVersion();const s=this.api;return new kd(s.nc,s.opts).info(t).then(c=>Promise.resolve(new TE(this.api,t,r))).catch(c=>Promise.reject(c))}}class hu{constructor(t,r){A(this,"api");A(this,"_info");this.api=t,this._info=r}get name(){return this._info.config.name}alternates(){return this.info().then(t=>t.alternates?t.alternates:[])}async best(){if(await this.info(),this._info.alternates){const t=await this.api.info(this._info.alternates[0].name);return new hu(this.api,t)}else return this}info(t=!1,r){return t?Promise.resolve(this._info):this.api.info(this.name,r).then(s=>(this._info=s,this._info))}getConsumerFromInfo(t){return new ud(new Zc(this.api.nc,this.api.opts)).getPullConsumerFor(t)}getConsumer(t){return new ud(new Zc(this.api.nc,this.api.opts)).get(this.name,t)}getMessage(t){return this.api.getMessage(this.name,t)}deleteMessage(t,r){return this.api.deleteMessage(this.name,t,r)}}class kd extends yo{constructor(t,r){super(t,r)}checkStreamConfigVersions(t){const r=this.nc;if(t.metadata){const{min:l,ok:c}=r.features.get(Ie.JS_STREAM_CONSUMER_METADATA);if(!c)throw new Error(`stream 'metadata' requires server ${l}`)}if(t.first_seq){const{min:l,ok:c}=r.features.get(Ie.JS_STREAM_FIRST_SEQ);if(!c)throw new Error(`stream 'first_seq' requires server ${l}`)}if(t.subject_transform){const{min:l,ok:c}=r.features.get(Ie.JS_STREAM_SUBJECT_TRANSFORM);if(!c)throw new Error(`stream 'subject_transform' requires server ${l}`)}if(t.compression){const{min:l,ok:c}=r.features.get(Ie.JS_STREAM_COMPRESSION);if(!c)throw new Error(`stream 'compression' requires server ${l}`)}if(t.consumer_limits){const{min:l,ok:c}=r.features.get(Ie.JS_DEFAULT_CONSUMER_LIMITS);if(!c)throw new Error(`stream 'consumer_limits' requires server ${l}`)}function s(l,c){var p;if((((p=c==null?void 0:c.subject_transforms)==null?void 0:p.length)||0)>0){const{min:g,ok:f}=r.features.get(Ie.JS_STREAM_SOURCE_SUBJECT_TRANSFORM);if(!f)throw new Error(`${l} 'subject_transforms' requires server ${g}`)}}t.sources&&t.sources.forEach(l=>{s("stream sources",l)}),t.mirror&&s("stream mirror",t.mirror)}async add(t={}){var l;this.checkStreamConfigVersions(t),Pt(t.name),t.mirror=Kl(t.mirror),t.sources=(l=t.sources)==null?void 0:l.map(Kl);const s=await this._request(`${this.prefix}.STREAM.CREATE.${t.name}`,t);return this._fixInfo(s),s}async delete(t){return Pt(t),(await this._request(`${this.prefix}.STREAM.DELETE.${t}`)).success}async update(t,r={}){var p;if(typeof t=="object"){const g=t;t=g.name,r=g,console.trace("\x1B[33m >> streams.update(config: StreamConfig) api changed to streams.update(name: string, config: StreamUpdateConfig) - this shim will be removed - update your code. \x1B[0m")}this.checkStreamConfigVersions(r),Pt(t);const s=await this.info(t),l=Object.assign(s.config,r);l.mirror=Kl(l.mirror),l.sources=(p=l.sources)==null?void 0:p.map(Kl);const d=await this._request(`${this.prefix}.STREAM.UPDATE.${t}`,l);return this._fixInfo(d),d}async info(t,r){Pt(t);const s=`${this.prefix}.STREAM.INFO.${t}`;let c=await this._request(s,r),{total:d,limit:p}=c,g=c.state.subjects?Object.getOwnPropertyNames(c.state.subjects).length:1;if(d&&d>g){const f=[c],m=r||{};let b=0;for(;d>g;){b++,m.offset=p*b;const _=await this._request(s,m);d=_.total,f.push(_);const w=Object.getOwnPropertyNames(_.state.subjects).length;if(g+=w,w<p)break}let v={};for(let _=0;_<f.length;_++)c=f[_],c.state.subjects&&(v=Object.assign(v,c.state.subjects));c.offset=0,c.total=0,c.limit=0,c.state.subjects=v}return this._fixInfo(c),c}list(t=""){const r=t!=null&&t.length?{subject:t}:{},s=c=>{const d=c;return d.streams.forEach(p=>{this._fixInfo(p)}),d.streams},l=`${this.prefix}.STREAM.LIST`;return new ro(l,s,this,r)}_fixInfo(t){t.config.sealed=t.config.sealed||!1,t.config.deny_delete=t.config.deny_delete||!1,t.config.deny_purge=t.config.deny_purge||!1,t.config.allow_rollup_hdrs=t.config.allow_rollup_hdrs||!1}async purge(t,r){if(r){const{keep:l,seq:c}=r;if(typeof l=="number"&&typeof c=="number")throw new Error("can specify one of keep or seq")}return Pt(t),await this._request(`${this.prefix}.STREAM.PURGE.${t}`,r)}async deleteMessage(t,r,s=!0){Pt(t);const l={seq:r};return s||(l.no_erase=!0),(await this._request(`${this.prefix}.STREAM.MSG.DELETE.${t}`,l)).success}async getMessage(t,r){Pt(t);const l=await this._request(`${this.prefix}.STREAM.MSG.GET.${t}`,r);return new Tb(l)}find(t){return this.findStream(t)}listKvs(){const t=s=>{var g;const c=s.streams.filter(f=>f.config.name.startsWith(un));c.forEach(f=>{this._fixInfo(f)});let d="";return c.length&&(d=((g=this.nc.info)==null?void 0:g.cluster)??""),c.map(f=>new jb(f,d))},r=`${this.prefix}.STREAM.LIST`;return new ro(r,t,this)}listObjectStores(){const t=s=>{const c=s.streams.filter(p=>p.config.name.startsWith(Nd));return c.forEach(p=>{this._fixInfo(p)}),c.map(p=>new ld(p))},r=`${this.prefix}.STREAM.LIST`;return new ro(r,t,this)}names(t=""){const r=t!=null&&t.length?{subject:t}:{},s=c=>c.streams,l=`${this.prefix}.STREAM.NAMES`;return new ro(l,s,this,r)}async get(t){const r=await this.info(t);return Promise.resolve(new hu(this,r))}}class NE extends yo{constructor(t,r){super(t,r)}async getMessage(t,r){Pt(t);let s=r;const{last_by_subj:l}=s;l&&(s=null);const c=s?this.jc.encode(s):dn,d=this.opts.apiPrefix||"$JS.API",p=l?`${d}.DIRECT.GET.${t}.${l}`:`${d}.DIRECT.GET.${t}`,g=await this.nc.request(p,c,{timeout:this.timeout}),f=Ps(g);if(f)return Promise.reject(f);const m=new fd(g);return Promise.resolve(m)}async getBatch(t,r){Pt(t);const l=`${this.opts.apiPrefix||"$JS.API"}.DIRECT.GET.${t}`;if(!Array.isArray(r.multi_last)||r.multi_last.length===0)return Promise.reject("multi_last is required");const c=JSON.stringify(r,(g,f)=>g==="up_to_time"&&f instanceof Date?f.toISOString():f),d=new Tt,p=await this.nc.requestMany(l,c,{strategy:$n.SentinelMsg});return(async()=>{var b,v,_;let g=!1,f=!1,m;for await(const w of p){if(!g){g=!0;const S=((b=w.headers)==null?void 0:b.code)||0;if(S!==0&&S<200||S>299){m=(v=w.headers)==null?void 0:v.description.toLowerCase();break}if(((_=w.headers)==null?void 0:_.get("Nats-Num-Pending"))===""){f=!0;break}}if(w.data.length===0)break;d.push(new fd(w))}d.push(()=>{if(f)throw new Error("batch direct get not supported by the server");if(m)throw new Error(`bad request: ${m}`);d.stop()})})(),Promise.resolve(d)}}class fd{constructor(t){A(this,"data");A(this,"header");if(!t.headers)throw new Error("headers expected");this.data=t.data,this.header=t.headers}get subject(){return this.header.last(Bs.Subject)}get seq(){const t=this.header.last(Bs.Sequence);return typeof t=="string"?parseInt(t):0}get time(){return new Date(Date.parse(this.timestamp))}get timestamp(){return this.header.last(Bs.TimeStamp)}get stream(){return this.header.last(Bs.Stream)}json(t){return Hn(t).decode(this.data)}string(){return fn.decode(this.data)}}A(fd,"jc");class kE extends yo{constructor(r,s){super(r,s);A(this,"streams");A(this,"consumers");A(this,"direct");this.streams=new kd(r,s),this.consumers=new Zc(r,s),this.direct=new NE(r,s)}async getAccountInfo(){return await this._request(`${this.prefix}.INFO`)}jetstream(){return this.nc.jetstream(this.getOptions())}advisories(){const r=new Tt;return this.nc.subscribe("$JS.EVENT.ADVISORY.>",{callback:(s,l)=>{if(s)throw s;try{const c=this.parseJsResponse(l),d=c.type.split("."),p=d[d.length-1];r.push({kind:p,data:c})}catch(c){r.stop(c)}}}),r}}class Tb{constructor(t){A(this,"_header");A(this,"smr");this.smr=t}get subject(){return this.smr.message.subject}get seq(){return this.smr.message.seq}get timestamp(){return this.smr.message.time}get time(){return new Date(Date.parse(this.timestamp))}get data(){return this.smr.message.data?this._parse(this.smr.message.data):dn}get header(){if(!this._header)if(this.smr.message.hdrs){const t=this._parse(this.smr.message.hdrs);this._header=oi.decode(t)}else this._header=Er();return this._header}_parse(t){const r=atob(t),s=r.length,l=new Uint8Array(s);for(let c=0;c<s;c++)l[c]=r.charCodeAt(c);return l}json(t){return Hn(t).decode(this.data)}string(){return fn.decode(this.data)}}A(Tb,"jc");class CE{constructor(t){A(this,"api");this.api=t}get(t){return this.api.info(t).then(r=>new hu(this.api,r))}}class Uh{constructor(t){A(this,"info");A(this,"hdrs");this.info=t}get name(){return this.info.name}get description(){return this.info.description??""}get headers(){return this.hdrs||(this.hdrs=oi.fromRecord(this.info.headers||{})),this.hdrs}get options(){return this.info.options}get bucket(){return this.info.bucket}get chunks(){return this.info.chunks}get deleted(){return this.info.deleted??!1}get digest(){return this.info.digest}get mtime(){return this.info.mtime}get nuid(){return this.info.nuid}get size(){return this.info.size}get revision(){return this.info.revision}get metadata(){return this.info.metadata||{}}isLink(){var t,r;return((t=this.info.options)==null?void 0:t.link)!==void 0&&((r=this.info.options)==null?void 0:r.link)!==null}}function xy(i){const t={name:i.name,description:i.description??"",options:i.options,metadata:i.metadata};if(i.headers){const r=i.headers;t.headers=r.toRecord()}return t}function ME(){return new ReadableStream({pull(i){i.enqueue(new Uint8Array(0)),i.close()}})}class lo{constructor(t,r,s){A(this,"jsm");A(this,"js");A(this,"stream");A(this,"name");this.name=t,this.jsm=r,this.js=s}_checkNotEmpty(t){return!t||t.length===0?{name:t,error:new Error("name cannot be empty")}:{name:t}}async info(t){const r=await this.rawInfo(t);return r?new Uh(r):null}async list(){const t=[],r=await this.watch({ignoreDeletes:!0,includeHistory:!0});for await(const s of r){if(s===null)break;t.push(s)}return Promise.resolve(t)}async rawInfo(t){const{name:r,error:s}=this._checkNotEmpty(t);if(s)return Promise.reject(s);const l=this._metaSubject(r);try{const c=await this.jsm.streams.getMessage(this.stream,{last_by_subj:l}),p=Hn().decode(c.data);return p.revision=c.seq,p}catch(c){return c.code==="404"?null:Promise.reject(c)}}async _si(t){try{return await this.jsm.streams.info(this.stream,t)}catch(r){return r.code==="404"?null:Promise.reject(r)}}async seal(){let t=await this._si();return t===null?Promise.reject(new Error("object store not found")):(t.config.sealed=!0,t=await this.jsm.streams.update(this.stream,t.config),Promise.resolve(new ld(t)))}async status(t){const r=await this._si(t);return r===null?Promise.reject(new Error("object store not found")):Promise.resolve(new ld(r))}destroy(){return this.jsm.streams.delete(this.stream)}async _put(t,r,s){var ce;const l=this.js.getOptions();s=s||{timeout:l.timeout},s.timeout=s.timeout||l.timeout,s.previousRevision=s.previousRevision??void 0;const{timeout:c,previousRevision:d}=s,p=this.js.nc.info,g=(p==null?void 0:p.max_payload)||1024;t=t||{},t.options=t.options||{};let f=((ce=t.options)==null?void 0:ce.max_chunk_size)||128*1024;f=f>g?g:f,t.options.max_chunk_size=f;const m=await this.info(t.name),{name:b,error:v}=this._checkNotEmpty(t.name);if(v)return Promise.reject(v);const _=fi.next(),w=this._chunkSubject(_),S=this._metaSubject(b),M=Object.assign({bucket:this.name,nuid:_,size:0,chunks:0},xy(t)),B=st(),U=[],ie=new Vs;try{const C=r?r.getReader():null,z=cy.create();for(;;){const{done:re,value:X}=C?await C.read():{done:!0,value:void 0};if(re){if(ie.size()>0){const Q=ie.drain();z.update(Q),M.chunks++,M.size+=Q.length,U.push(this.js.publish(w,Q,{timeout:c}))}await Promise.all(U),U.length=0,M.mtime=new Date().toISOString();const L=Is.encode(z.digest());M.digest=`${by}${L}`,M.deleted=!1;const G=Er();typeof d=="number"&&G.set(Xn.ExpectedLastSubjectSequenceHdr,`${d}`),G.set($t.RollupHdr,$t.RollupValueSubject);const W=await this.js.publish(S,Hn().encode(M),{headers:G,timeout:c});if(M.revision=W.seq,m)try{await this.jsm.streams.purge(this.stream,{filter:`$O.${this.name}.C.${m.nuid}`})}catch{}B.resolve(new Uh(M));break}if(X)for(ie.fill(X);ie.size()>f;){M.chunks++,M.size+=f;const L=ie.drain(t.options.max_chunk_size);z.update(L),U.push(this.js.publish(w,L,{timeout:c}))}}}catch(C){await this.jsm.streams.purge(this.stream,{filter:w}),B.reject(C)}return B}putBlob(t,r,s){function l(c){return new ReadableStream({pull(d){d.enqueue(c),d.close()}})}return r===null&&(r=new Uint8Array(0)),this.put(t,l(r),s)}put(t,r,s){var l;return(l=t==null?void 0:t.options)!=null&&l.link?Promise.reject(new Error("link cannot be set when putting the object in bucket")):this._put(t,r,s)}async getBlob(t){async function r(c){const d=new Vs,p=c.getReader();for(;;){const{done:g,value:f}=await p.read();if(g)return d.drain();f&&f.length&&d.fill(f)}}const s=await this.get(t);if(s===null)return Promise.resolve(null);const l=await Promise.all([s.error,r(s.data)]);return l[0]?Promise.reject(l[0]):Promise.resolve(l[1])}async get(t){const r=await this.rawInfo(t);if(r===null||r.deleted)return Promise.resolve(null);if(r.options&&r.options.link){const b=r.options.link.name||"";if(b==="")throw new Error("link is a bucket");return(r.options.link.bucket!==this.name?await lo.create(this.js,r.options.link.bucket):this).get(b)}if(!r.digest.startsWith(by))return Promise.reject(new Error(`unknown digest type: ${r.digest}`));const s=rd(r.digest.substring(8));if(s===null)return Promise.reject(new Error(`unable to parse digest: ${r.digest}`));const l=st(),c={info:new Uh(r),error:l};if(r.size===0)return c.data=ME(),l.resolve(null),Promise.resolve(c);let d;const p=li();p.orderedConsumer();const g=cy.create(),f=`$O.${this.name}.C.${r.nuid}`,m=await this.js.subscribe(f,p);return(async()=>{for await(const b of m)b.data.length>0&&(g.update(b.data),d.enqueue(b.data)),b.info.pending===0&&(xS(s,g.digest())?d.close():d.error(new Error(`received a corrupt object, digests do not match received: ${r.digest} calculated ${s}`)),m.unsubscribe())})().then(()=>{l.resolve()}).catch(b=>{d.error(b),l.reject(b)}),c.data=new ReadableStream({start(b){d=b},cancel(){m.unsubscribe()}}),c}linkStore(t,r){if(!(r instanceof lo))return Promise.reject("bucket required");const s=r,{name:l,error:c}=this._checkNotEmpty(t);if(c)return Promise.reject(c);const d={name:l,options:{link:{bucket:s.name}}};return this._put(d,null)}async link(t,r){const{name:s,error:l}=this._checkNotEmpty(t);if(l)return Promise.reject(l);if(r.deleted)return Promise.reject(new Error("src object is deleted"));if(r.isLink())return Promise.reject(new Error("src object is a link"));const c=await this.rawInfo(t);if(c!==null&&!c.deleted)return Promise.reject(new Error("an object already exists with that name"));const d={bucket:r.bucket,name:r.name},p={name:s,bucket:r.bucket,options:{link:d}};await this.js.publish(this._metaSubject(t),JSON.stringify(p));const g=await this.info(t);return Promise.resolve(g)}async delete(t){const r=await this.rawInfo(t);if(r===null)return Promise.resolve({purged:0,success:!1});r.deleted=!0,r.size=0,r.chunks=0,r.digest="";const s=Hn(),l=Er();return l.set($t.RollupHdr,$t.RollupValueSubject),await this.js.publish(this._metaSubject(r.name),s.encode(r),{headers:l}),this.jsm.streams.purge(this.stream,{filter:this._chunkSubject(r.nuid)})}async update(t,r={}){const s=await this.rawInfo(t);if(s===null)return Promise.reject(new Error("object not found"));if(s.deleted)return Promise.reject(new Error("cannot update meta for a deleted object"));r.name=r.name??s.name;const{name:l,error:c}=this._checkNotEmpty(r.name);if(c)return Promise.reject(c);if(t!==r.name){const g=await this.info(r.name);if(g&&!g.deleted)return Promise.reject(new Error("an object already exists with that name"))}r.name=l;const d=Object.assign({},s,xy(r)),p=await this.js.publish(this._metaSubject(d.name),JSON.stringify(d));return t!==r.name&&await this.jsm.streams.purge(this.stream,{filter:this._metaSubject(t)}),Promise.resolve(p)}async watch(t={}){t.includeHistory=t.includeHistory??!1,t.ignoreDeletes=t.ignoreDeletes??!1;let r=!1;const s=new Tt,l=this._metaSubjectAll();try{await this.jsm.streams.getMessage(this.stream,{last_by_subj:l})}catch(g){g.code==="404"?(s.push(null),r=!0):s.stop(g)}const c=Hn(),d=li();d.orderedConsumer(),t.includeHistory?d.deliverLastPerSubject():(r=!0,d.deliverNew()),d.callback((g,f)=>{var m;if(g){s.stop(g);return}if(f!==null){const b=c.decode(f.data);b.deleted&&t.ignoreDeletes===!0||s.push(b),((m=f.info)==null?void 0:m.pending)===0&&!r&&(r=!0,s.push(null))}});const p=await this.js.subscribe(l,d);return s._data=p,s.iterClosed.then(()=>{p.unsubscribe()}),p.closed.then(()=>{s.stop()}).catch(g=>{s.stop(g)}),s}_chunkSubject(t){return`$O.${this.name}.C.${t}`}_metaSubject(t){return`$O.${this.name}.M.${Is.encode(t)}`}_metaSubjectAll(){return`$O.${this.name}.M.>`}async init(t={}){try{this.stream=_E(this.name)}catch(l){return Promise.reject(l)}const r=(t==null?void 0:t.ttl)||0;delete t.ttl;const s=Object.assign({max_age:r},t);s.name=this.stream,s.num_replicas=t.replicas??1,s.allow_direct=!0,s.allow_rollup_hdrs=!0,s.discard=uo.New,s.subjects=[`$O.${this.name}.C.>`,`$O.${this.name}.M.>`],t.placement&&(s.placement=t.placement),t.metadata&&(s.metadata=t.metadata),typeof t.compression=="boolean"&&(s.compression=t.compression?hi.S2:hi.None);try{await this.jsm.streams.info(s.name)}catch(l){l.message==="stream not found"&&await this.jsm.streams.add(s)}}static async create(t,r,s={}){const l=await t.jetstreamManager(),c=new lo(r,l,t);return await c.init(s),Promise.resolve(c)}}class RE{constructor(t){A(this,"js");this.js=t}kv(t,r={}){const s=this.js,{ok:l,min:c}=s.nc.features.get(Ie.JS_KV);return l?r.bindOnly?ho.bind(this.js,t,r):ho.create(this.js,t,r):Promise.reject(new Error(`kv is only supported on servers ${c} or better`))}os(t,r={}){var d;if(typeof((d=crypto==null?void 0:crypto.subtle)==null?void 0:d.digest)!="function")return Promise.reject(new Error("objectstore: unable to calculate hashes - crypto.subtle.digest with sha256 support is required"));const s=this.js,{ok:l,min:c}=s.nc.features.get(Ie.JS_OBJECTSTORE);return l?lo.create(this.js,t,r):Promise.reject(new Error(`objectstore is only supported on servers ${c} or better`))}}class Cd extends yo{constructor(r,s){super(r,s);A(this,"consumers");A(this,"streams");A(this,"consumerAPI");A(this,"streamAPI");this.consumerAPI=new Zc(r,s),this.streamAPI=new kd(r,s),this.consumers=new ud(this.consumerAPI),this.streams=new CE(this.streamAPI)}jetstreamManager(r){r===void 0&&(r=this.opts.checkAPI);const s=Object.assign({},this.opts,{checkAPI:r});return this.nc.jetstreamManager(s)}get apiPrefix(){return this.prefix}get views(){return new RE(this)}async publish(r,s=dn,l){l=l||{},l.expect=l.expect||{};const c=(l==null?void 0:l.headers)||Er();l&&(l.msgID&&c.set(Xn.MsgIdHdr,l.msgID),l.expect.lastMsgID&&c.set(Xn.ExpectedLastMsgIdHdr,l.expect.lastMsgID),l.expect.streamName&&c.set(Xn.ExpectedStreamHdr,l.expect.streamName),typeof l.expect.lastSequence=="number"&&c.set(Xn.ExpectedLastSeqHdr,`${l.expect.lastSequence}`),typeof l.expect.lastSubjectSequence=="number"&&c.set(Xn.ExpectedLastSubjectSequenceHdr,`${l.expect.lastSubjectSequence}`));const d=l.timeout||this.timeout,p={};d&&(p.timeout=d),l&&(p.headers=c);let{retries:g,retry_delay:f}=l;g=g||1,f=f||250;let m;for(let v=0;v<g;v++)try{m=await this.nc.request(r,s,p);break}catch(_){if(_.code==="503"&&v+1<g)await Ys(f);else throw _}const b=this.parseJsResponse(m);if(b.stream==="")throw me.errorForCode(le.JetStreamInvalidAck);return b.duplicate=b.duplicate?b.duplicate:!1,b}async pull(r,s,l=0){Pt(r),Us(s);let c=this.timeout;l>c&&(c=l),l=l<0?0:it(l);const d={batch:1,no_wait:l===0,expires:l},p=await this.nc.request(`${this.prefix}.CONSUMER.MSG.NEXT.${r}.${s}`,this.jc.encode(d),{noMux:!0,timeout:c}),g=Ps(p);if(g)throw g;return mo(p,this.timeout)}fetch(r,s,l={}){Pt(r),Us(s);let c=null;const d=(l.max_bytes??0)>0;let p=0;const g=d?l.max_bytes:0;let f=null;const m={};if(m.batch=l.batch||1,g){const U=this.nc.features.get(Ie.JS_PULL_MAX_BYTES);if(!U.ok)throw new Error(`max_bytes is only supported on servers ${U.min} or better`);m.max_bytes=g}m.no_wait=l.no_wait||!1,m.no_wait&&m.expires&&(m.expires=0);const b=l.expires||0;if(b&&(m.expires=it(b)),b===0&&m.no_wait===!1)throw new Error("expires or no_wait is required");const v=l.idle_heartbeat||0;v&&(m.idle_heartbeat=it(v),l.delay_heartbeat===!0&&(m.idle_heartbeat=it(v*4)));const _=new Tt,w=m.batch;let S=0;_.protocolFilterFn=(U,ie=!1)=>ed(U.msg)?(f==null||f.work(),!1):!0,_.dispatchedFn=U=>{if(U){if(d&&(p+=U.data.length),S++,c&&U.info.pending===0)return;(_.getPending()===1&&U.info.pending===0||w===S||g>0&&p>=g)&&_.stop()}};const M=Sr(this.nc.options.inboxPrefix),B=this.nc.subscribe(M,{max:l.batch,callback:(U,ie)=>{U===null&&(U=Ps(ie)),U!==null?(c&&(c.cancel(),c=null),tS(U)?_.stop(kb(U)===null?void 0:U):_.stop(U)):(f==null||f.work(),_.received++,_.push(mo(ie,this.timeout)))}});return b&&(c=Gs(b),c.catch(()=>{B.isClosed()||(B.drain().catch(()=>{}),c=null),f&&f.cancel()})),(async()=>{try{v&&(f=new Td(v,U=>(_.push(()=>{_.err=new me(`${Nn.IdleHeartbeatMissed}: ${U}`,le.JetStreamIdleHeartBeat)}),!0)))}catch{}await B.closed,c!==null&&(c.cancel(),c=null),f&&f.cancel(),_.stop()})().catch(),this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${r}.${s}`,this.jc.encode(m),{reply:M}),_}async pullSubscribe(r,s=li()){const l=await this._processOptions(r,s);if(l.ordered)throw new Error("pull subscribers cannot be be ordered");if(l.config.deliver_subject)throw new Error("consumer info specifies deliver_subject - pull consumers cannot have deliver_subject set");const c=l.config.ack_policy;if(c===At.None||c===At.All)throw new Error("ack policy for pull consumers must be explicit");const d=this._buildTypedSubscriptionOpts(l),p=new LE(this,l.deliver,d);p.info=l;try{await this._maybeCreateConsumer(l)}catch(g){throw p.unsubscribe(),g}return p}async subscribe(r,s=li()){const l=await this._processOptions(r,s);if(!l.isBind&&!l.config.deliver_subject)throw new Error("push consumer requires deliver_subject");const c=this._buildTypedSubscriptionOpts(l),d=new Nb(this,l.deliver,c);d.info=l;try{await this._maybeCreateConsumer(l)}catch(p){throw d.unsubscribe(),p}return d._maybeSetupHbMonitoring(),d}async _processOptions(r,s=li()){const l=sy(s)?s.getOpts():s;if(l.isBind=sy(s)?s.isBind:!1,l.flow_control={heartbeat_count:0,fc_count:0,consumer_restarts:0},l.ordered){if(l.ordered_consumer_sequence={stream_seq:0,delivery_seq:0},l.config.ack_policy!==At.NotSet&&l.config.ack_policy!==At.None)throw new me("ordered consumer: ack_policy can only be set to 'none'",le.ApiError);if(l.config.durable_name&&l.config.durable_name.length>0)throw new me("ordered consumer: durable_name cannot be set",le.ApiError);if(l.config.deliver_subject&&l.config.deliver_subject.length>0)throw new me("ordered consumer: deliver_subject cannot be set",le.ApiError);if(l.config.max_deliver!==void 0&&l.config.max_deliver>1)throw new me("ordered consumer: max_deliver cannot be set",le.ApiError);if(l.config.deliver_group&&l.config.deliver_group.length>0)throw new me("ordered consumer: deliver_group cannot be set",le.ApiError);l.config.deliver_subject=Sr(this.nc.options.inboxPrefix),l.config.ack_policy=At.None,l.config.max_deliver=1,l.config.flow_control=!0,l.config.idle_heartbeat=l.config.idle_heartbeat||it(5e3),l.config.ack_wait=it(1320*60*1e3),l.config.mem_storage=!0,l.config.num_replicas=1}if(l.config.ack_policy===At.NotSet&&(l.config.ack_policy=At.All),l.api=this,l.config=l.config||{},l.stream=l.stream?l.stream:await this.findStream(r),l.attached=!1,l.config.durable_name)try{const c=await this.consumerAPI.info(l.stream,l.config.durable_name);if(c){if(c.config.filter_subject&&c.config.filter_subject!==r)throw new Error("subject does not match consumer");const d=l.config.deliver_group??"";if(d===""&&c.push_bound===!0)throw new Error("duplicate subscription");const p=c.config.deliver_group??"";if(d!==p)throw p===""?new Error("durable requires no queue group"):new Error(`durable requires queue group '${p}'`);l.last=c,l.config=c.config,l.attached=!0,l.config.durable_name||(l.name=c.name)}}catch(c){if(c.code!=="404")throw c}return!l.attached&&l.config.filter_subject===void 0&&l.config.filter_subjects===void 0&&(l.config.filter_subject=r),l.deliver=l.config.deliver_subject||Sr(this.nc.options.inboxPrefix),l}_buildTypedSubscriptionOpts(r){const s={};return s.adapter=zE(r.callbackFn===void 0,this.timeout),s.ingestionFilterFn=Cd.ingestionFn(r.ordered),s.protocolFilterFn=(l,c=!1)=>{const d=l;return Wh(d.msg)?(c||d.msg.respond(),!1):!0},!r.mack&&r.config.ack_policy!==At.None&&(s.dispatchedFn=IE),r.callbackFn&&(s.callback=r.callbackFn),s.max=r.max||0,s.queue=r.queue,s}async _maybeCreateConsumer(r){if(r.attached)return;if(r.isBind)throw new Error(`unable to bind - durable consumer ${r.config.durable_name} doesn't exist in ${r.stream}`);r.config=Object.assign({deliver_policy:mt.All,ack_policy:At.Explicit,ack_wait:it(30*1e3),replay_policy:Fs.Instant},r.config);const s=await this.consumerAPI.add(r.stream,r.config);if(Array.isArray(r.config.filter_subjects&&!Array.isArray(s.config.filter_subjects)))throw new Error("jetstream server doesn't support consumers with multiple filter subjects");r.name=s.name,r.config=s.config,r.last=s}static ingestionFn(r){return(s,l)=>{var g;const c=l;if(!s)return{ingest:!1,protocol:!1};const d=s;if(Ps(d.msg)||(g=c.monitor)==null||g.work(),ed(d.msg)){const f=r?c._checkHbOrderConsumer(d.msg):!0;return r||c.info.flow_control.heartbeat_count++,{ingest:f,protocol:!0}}else if(Wh(d.msg))return c.info.flow_control.fc_count++,{ingest:!0,protocol:!0};return{ingest:r?c._checkOrderedConsumer(s):!0,protocol:!1}}}}class Md{constructor(t){A(this,"options");A(this,"protocol");A(this,"draining");A(this,"listeners");A(this,"_services");this.draining=!1,this.options=nE(t),this.listeners=[]}static connect(t={}){return new Promise((r,s)=>{const l=new Md(t);eu.connect(l.options,l).then(c=>{l.protocol=c,(async function(){for await(const d of c.status())l.listeners.forEach(p=>{p.push(d)})})(),r(l)}).catch(c=>{s(c)})})}closed(){return this.protocol.closed}async close(){await this.protocol.close()}_check(t,r,s){if(this.isClosed())throw me.errorForCode(le.ConnectionClosed);if(r&&this.isDraining()||s&&this.protocol.noMorePublishing)throw me.errorForCode(le.ConnectionDraining);if(t=t||"",t.length===0)throw me.errorForCode(le.BadSubject)}publish(t,r,s){this._check(t,!1,!0),this.protocol.publish(t,r,s)}publishMessage(t){return this.publish(t.subject,t.data,{reply:t.reply,headers:t.headers})}respondMessage(t){return t.reply?(this.publish(t.reply,t.data,{reply:t.reply,headers:t.headers}),!0):!1}subscribe(t,r={}){this._check(t,!0,!1);const s=new Ob(this.protocol,t,r);return this.protocol.subscribe(s),s}_resub(t,r,s){this._check(r,!0,!1);const l=t;l.max=s,s&&(l.max=s+l.received),this.protocol.resub(l,r)}requestMany(t,r=dn,s={maxWait:1e3,maxMessages:-1}){const l=!this.protocol.options.noAsyncTraces;try{this._check(t,!0,!0)}catch(g){return Promise.reject(g)}if(s.strategy=s.strategy||$n.Timer,s.maxWait=s.maxWait||1e3,s.maxWait<1)return Promise.reject(new me("timeout",le.InvalidOption));const c=new Tt;function d(g){c.push(()=>{c.stop(g)})}function p(g,f){g||f===null?d(g===null?void 0:g):c.push(f)}if(s.noMux){const g=l?new Error().stack:null;let f=typeof s.maxMessages=="number"&&s.maxMessages>0?s.maxMessages:-1;const m=this.subscribe(Sr(this.options.inboxPrefix),{callback:(w,S)=>{var M,B;if(((M=S==null?void 0:S.data)==null?void 0:M.length)===0&&((B=S==null?void 0:S.headers)==null?void 0:B.status)===le.NoResponders&&(w=me.errorForCode(le.NoResponders)),w){g&&(w.stack+=`
47
+ `),t.max=r)}resub(t,r){!t||this.isClosed()||(this.unsub(t),t.subject=r,this.subscriptions.resub(t),this._sub(t))}flush(t){return t||(t=st()),this.pongs.push(t),this.outbound.fill(py),this.flushPending(),t}sendSubscriptions(){const t=[];this.subscriptions.all().forEach(r=>{const s=r;s.queue?t.push(`SUB ${s.subject} ${s.queue} ${s.sid}${Ic}`):t.push(`SUB ${s.subject} ${s.sid}${Ic}`)}),t.length&&this.transport.send(so(t.join("")))}async _close(t){this._closed||(this.whyClosed=new Error("close trace").stack||"",this.heartbeats.cancel(),this.connectError&&(this.connectError(t),this.connectError=void 0),this.muxSubscriptions.close(),this.subscriptions.close(),this.listeners.forEach(r=>{r.stop()}),this._closed=!0,await this.transport.close(t),await this.closed.resolve(t))}close(){return this._close()}isClosed(){return this._closed}drain(){const t=this.subscriptions.all(),r=[];return t.forEach(s=>{r.push(s.drain())}),Promise.all(r).then(async()=>(this.noMorePublishing=!0,await this.flush(),this.close())).catch(()=>{})}flushPending(){if(!(!this.infoReceived||!this.connected)&&this.outbound.size()){const t=this.outbound.drain();this.transport.send(t)}}initMux(){if(!this.subscriptions.getMux()){const r=this.muxSubscriptions.init(this.options.inboxPrefix),s=new jb(this,`${r}*`);s.callback=this.muxSubscriptions.dispatcher(),this.subscriptions.setMux(s),this.subscribe(s)}}selectServer(){const t=this.servers.selectServer();if(t!==void 0)return this.server=t,this.server}getServer(){return this.server}}const fE="$SRV";class gy{constructor(t){A(this,"msg");this.msg=t}get data(){return this.msg.data}get sid(){return this.msg.sid}get subject(){return this.msg.subject}get reply(){return this.msg.reply||""}get headers(){return this.msg.headers}respond(t,r){return this.msg.respond(t,r)}respondError(t,r,s,l){var c,d;return l=l||{},l.headers=l.headers||Er(),(c=l.headers)==null||c.set(Xc,`${t}`),(d=l.headers)==null||d.set(Kc,r),this.msg.respond(s,l)}json(t){return this.msg.json(t)}string(){return this.msg.string()}}class fo{constructor(t,r="",s=""){A(this,"subject");A(this,"queue");A(this,"srv");r!==""&&dE("service group",r);let l="";if(t instanceof bo)this.srv=t,l="";else if(t instanceof fo){const c=t;this.srv=c.srv,s===""&&c.queue!==""&&(s=c.queue),l=c.subject}else throw new Error("unknown ServiceGroup type");this.subject=this.calcSubject(l,r),this.queue=s}calcSubject(t,r=""){return r===""?t:t!==""?`${t}.${r}`:r}addEndpoint(t="",r){r=r||{subject:t};const s=typeof r=="function"?{handler:r,subject:t}:r;no("endpoint",t);let{subject:l,handler:c,metadata:d,queue:p}=s;l=l||t,p=p||this.queue,hE("endpoint subject",l),l=this.calcSubject(this.subject,l);const y={name:t,subject:l,queue:p,handler:c,metadata:d};return this.srv._addEndpoint(y)}addGroup(t="",r=""){return new fo(this,t,r)}}function hE(i,t){if(t==="")throw new Error(`${i} cannot be empty`);if(t.indexOf(" ")!==-1)throw new Error(`${i} cannot contain spaces: '${t}'`);const r=t.split(".");r.forEach((s,l)=>{if(s===">"&&l!==r.length-1)throw new Error(`${i} cannot have internal '>': '${t}'`)})}function dE(i,t){if(t.indexOf(" ")!==-1)throw new Error(`${i} cannot contain spaces: '${t}'`);t.split(".").forEach(s=>{if(s===">")throw new Error(`${i} name cannot contain internal '>': '${t}'`)})}class bo{constructor(t,r={name:"",version:""}){A(this,"nc");A(this,"_id");A(this,"config");A(this,"handlers");A(this,"internal");A(this,"_stopped");A(this,"_done");A(this,"started");this.nc=t,this.config=Object.assign({},r),this.config.queue||(this.config.queue="q"),no("name",this.config.name),no("queue",this.config.queue),$i(this.config.version),this._id=fi.next(),this.internal=[],this._done=st(),this._stopped=!1,this.handlers=[],this.started=new Date().toISOString(),this.reset(),this.nc.closed().then(()=>{this.close().catch()}).catch(s=>{this.close(s).catch()})}static controlSubject(t,r="",s="",l){const c=l??fE;return r===""&&s===""?`${c}.${t}`:(no("control subject name",r),s!==""?(no("control subject id",s),`${c}.${t}.${r}.${s}`):`${c}.${t}.${r}`)}get subjects(){return this.handlers.filter(t=>t.internal===!1).map(t=>t.subject)}get id(){return this._id}get name(){return this.config.name}get description(){return this.config.description??""}get version(){return this.config.version}get metadata(){return this.config.metadata}errorToHeader(t){const r=Er();if(t instanceof Jc){const s=t;r.set(Kc,s.message),r.set(Xc,`${s.code}`)}else r.set(Kc,t.message),r.set(Xc,"500");return r}setupHandler(t,r=!1){const s=r?"":t.queue?t.queue:this.config.queue,{name:l,subject:c,handler:d}=t,p=t;p.internal=r,r&&this.internal.push(p),p.stats=new mE(l,c,s),p.queue=s;const y=d?(f,m)=>{if(f){this.close(f);return}const b=Date.now();try{d(f,new gy(m))}catch(v){p.stats.countError(v),m==null||m.respond(mn,{headers:this.errorToHeader(v)})}finally{p.stats.countLatency(b)}}:void 0;return p.sub=this.nc.subscribe(c,{callback:y,queue:s}),p.sub.closed.then(()=>{this._stopped||this.close(new Error(`required subscription ${t.subject} stopped`)).catch()}).catch(f=>{if(!this._stopped){const m=new Error(`required subscription ${t.subject} errored: ${f.message}`);m.stack=f.stack,this.close(m).catch()}}),p}info(){return{type:ao.INFO,name:this.name,id:this.id,version:this.version,description:this.description,metadata:this.metadata,endpoints:this.endpoints()}}endpoints(){return this.handlers.map(t=>{const{subject:r,metadata:s,name:l,queue:c}=t;return{subject:r,metadata:s,name:l,queue_group:c}})}async stats(){const t=[];for(const r of this.handlers){if(typeof this.config.statsHandler=="function")try{r.stats.data=await this.config.statsHandler(r)}catch(s){r.stats.countError(s)}t.push(r.stats.stats(r.qi))}return{type:ao.STATS,name:this.name,id:this.id,version:this.version,started:this.started,metadata:this.metadata,endpoints:t}}addInternalHandler(t,r){const s=`${t}`.toUpperCase();this._doAddInternalHandler(`${s}-all`,t,r),this._doAddInternalHandler(`${s}-kind`,t,r,this.name),this._doAddInternalHandler(`${s}`,t,r,this.name,this.id)}_doAddInternalHandler(t,r,s,l="",c=""){const d={};d.name=t,d.subject=bo.controlSubject(r,l,c),d.handler=s,this.setupHandler(d,!0)}start(){const t=Hn(),r=(d,p)=>d?(this.close(d),Promise.reject(d)):this.stats().then(y=>(p==null||p.respond(t.encode(y)),Promise.resolve())),s=(d,p)=>d?(this.close(d),Promise.reject(d)):(p==null||p.respond(t.encode(this.info())),Promise.resolve()),l=t.encode(this.ping()),c=(d,p)=>d?(this.close(d).then().catch(),Promise.reject(d)):(p.respond(l),Promise.resolve());return this.addInternalHandler(ai.PING,c),this.addInternalHandler(ai.STATS,r),this.addInternalHandler(ai.INFO,s),this.handlers.forEach(d=>{const{subject:p}=d;typeof p=="string"&&d.handler!==null&&this.setupHandler(d)}),Promise.resolve(this)}close(t){if(this._stopped)return this._done;this._stopped=!0;let r=[];return this.nc.isClosed()||(r=this.handlers.concat(this.internal).map(s=>s.sub.drain())),Promise.allSettled(r).then(()=>{this._done.resolve(t||null)}),this._done}get stopped(){return this._done}get isStopped(){return this._stopped}stop(t){return this.close(t)}ping(){return{type:ao.PING,name:this.name,id:this.id,version:this.version,metadata:this.metadata}}reset(){if(this.started=new Date().toISOString(),this.handlers)for(const t of this.handlers)t.stats.reset(t.qi)}addGroup(t,r){return new fo(this,t,r)}addEndpoint(t,r){return new fo(this).addEndpoint(t,r)}_addEndpoint(t){const r=new Tt;r.noIterator=typeof t.handler=="function",r.noIterator||(t.handler=(l,c)=>{l?this.stop(l).catch():r.push(new gy(c))},r.iterClosed.then(()=>{this.close().catch()}));const s=this.setupHandler(t,!1);return s.qi=r,this.handlers.push(s),r}}class mE{constructor(t,r,s=""){A(this,"name");A(this,"subject");A(this,"average_processing_time");A(this,"num_requests");A(this,"processing_time");A(this,"num_errors");A(this,"last_error");A(this,"data");A(this,"metadata");A(this,"queue");this.name=t,this.subject=r,this.average_processing_time=0,this.num_errors=0,this.num_requests=0,this.processing_time=0,this.queue=s}reset(t){this.num_requests=0,this.processing_time=0,this.average_processing_time=0,this.num_errors=0,this.last_error=void 0,this.data=void 0;const r=t;r&&(r.time=0,r.processed=0)}countLatency(t){this.num_requests++,this.processing_time+=it(Date.now()-t),this.average_processing_time=Math.round(this.processing_time/this.num_requests)}countError(t){this.num_errors++,this.last_error=t.message}_stats(){const{name:t,subject:r,average_processing_time:s,num_errors:l,num_requests:c,processing_time:d,last_error:p,data:y,queue:f}=this;return{name:t,subject:r,average_processing_time:s,num_errors:l,num_requests:c,processing_time:d,last_error:p,data:y,queue_group:f}}stats(t){const r=t;return(r==null?void 0:r.noIterator)===!1&&(this.processing_time=it(r.time),this.num_requests=r.processed,this.average_processing_time=this.processing_time>0&&this.num_requests>0?this.processing_time/this.num_requests:0),this._stats()}}class pE{constructor(t,r={strategy:$n.JitterTimer,maxWait:2e3},s){A(this,"nc");A(this,"prefix");A(this,"opts");this.nc=t,this.prefix=s,this.opts=r}ping(t="",r=""){return this.q(ai.PING,t,r)}stats(t="",r=""){return this.q(ai.STATS,t,r)}info(t="",r=""){return this.q(ai.INFO,t,r)}async q(t,r="",s=""){const l=new Tt,c=Hn(),d=bo.controlSubject(t,r,s,this.prefix),p=await this.nc.requestMany(d,mn,this.opts);return(async()=>{for await(const y of p)try{const f=c.decode(y.data);l.push(f)}catch(f){l.push(()=>{l.stop(f)})}l.push(()=>{l.stop()})})().catch(y=>{l.stop(y)}),l}}function Tb(){return{key:{encode(i){return i},decode(i){return i}},value:{encode(i){return i},decode(i){return i}}}}function gE(){return{replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:Tb(),storage:rd.File}}const tu="KV-Operation",yy="$KV",yE=/^[-/=.\w]+$/,bE=/^[-/=.>*\w]+$/,vE=/^[-\w]+$/;function xE(i){if(i.startsWith(".")||i.endsWith(".")||!yE.test(i))throw new Error(`invalid key: ${i}`)}function _E(i){if(i.startsWith(".")||i.endsWith(".")||!bE.test(i))throw new Error(`invalid key: ${i}`)}function wE(i){if(i.startsWith(".")||i.endsWith("."))throw new Error(`invalid key: ${i}`);const t=i.split(".");let r=!1;for(let s=0;s<t.length;s++)switch(t[s]){case"*":r=!0;break;case">":if(s!==t.length-1)throw new Error(`invalid key: ${i}`);r=!0;break}return r}function $c(i){if(!vE.test(i))throw new Error(`invalid bucket name: ${i}`)}var Xn;(function(i){i.MsgIdHdr="Nats-Msg-Id",i.ExpectedStreamHdr="Nats-Expected-Stream",i.ExpectedLastSeqHdr="Nats-Expected-Last-Sequence",i.ExpectedLastMsgIdHdr="Nats-Expected-Last-Msg-Id",i.ExpectedLastSubjectSequenceHdr="Nats-Expected-Last-Subject-Sequence"})(Xn||(Xn={}));class ho{constructor(t,r,s){A(this,"js");A(this,"jsm");A(this,"stream");A(this,"bucket");A(this,"direct");A(this,"codec");A(this,"prefix");A(this,"editPrefix");A(this,"useJsPrefix");A(this,"_prefixLen");A(this,"validateKey",xE);A(this,"validateSearchKey",_E);A(this,"hasWildcards",wE);$c(t),this.js=r,this.jsm=s,this.bucket=t,this.prefix=yy,this.editPrefix="",this.useJsPrefix=!1,this._prefixLen=0}static async create(t,r,s={}){$c(r);const l=await t.jetstreamManager(),c=new ho(r,t,l);return await c.init(s),c}static async bind(t,r,s={}){const l=await t.jetstreamManager(),c={config:{allow_direct:s.allow_direct}};$c(r);const d=new ho(r,t,l);return c.config.name=s.streamName??d.bucketName(),Object.assign(d,c),d.stream=c.config.name,d.codec=s.codec||Tb(),d.direct=c.config.allow_direct??!1,d.initializePrefixes(c),d}async init(t={}){const r=Object.assign(gE(),t);this.codec=r.codec;const s={};this.stream=s.name=t.streamName??this.bucketName(),s.retention=nd.Limits,s.max_msgs_per_subject=r.history,r.maxBucketSize&&(r.max_bytes=r.maxBucketSize),r.max_bytes&&(s.max_bytes=r.max_bytes),s.max_msg_size=r.maxValueSize,s.storage=r.storage;const l=t.placementCluster??"";if(l&&(t.placement={},t.placement.cluster=l,t.placement.tags=[]),t.placement&&(s.placement=t.placement),t.republish&&(s.republish=t.republish),t.description&&(s.description=t.description),t.mirror){const b=Object.assign({},t.mirror);b.name.startsWith(un)||(b.name=`${un}${b.name}`),s.mirror=b,s.mirror_direct=!0}else if(t.sources){const b=t.sources.map(v=>{const _=Object.assign({},v),w=_.name.startsWith(un)?_.name.substring(un.length):_.name;return _.name.startsWith(un)||(_.name=`${un}${_.name}`),!v.external&&w!==this.bucket&&(_.subject_transforms=[{src:`$KV.${w}.>`,dest:`$KV.${this.bucket}.>`}]),_});s.sources=b,s.subjects=[this.subjectForBucket()]}else s.subjects=[this.subjectForBucket()];t.metadata&&(s.metadata=t.metadata),typeof t.compression=="boolean"&&(s.compression=t.compression?hi.S2:hi.None);const c=this.js.nc,d=c.getServerVersion(),p=d?sd(d,$i("2.7.2"))>=0:!1;s.discard=p?uo.New:uo.Old;const{ok:y,min:f}=c.features.get(Ie.JS_ALLOW_DIRECT);if(!y&&t.allow_direct===!0){const b=d?`${d.major}.${d.minor}.${d.micro}`:"unknown";return Promise.reject(new Error(`allow_direct is not available on server version ${b} - requires ${f}`))}t.allow_direct=typeof t.allow_direct=="boolean"?t.allow_direct:y,s.allow_direct=t.allow_direct,this.direct=s.allow_direct,s.num_replicas=r.replicas,r.ttl&&(s.max_age=it(r.ttl)),s.allow_rollup_hdrs=!0;let m;try{m=await this.jsm.streams.info(s.name),!m.config.allow_direct&&this.direct===!0&&(this.direct=!1)}catch(b){if(b.message==="stream not found")m=await this.jsm.streams.add(s);else throw b}this.initializePrefixes(m)}initializePrefixes(t){this._prefixLen=0,this.prefix=`$KV.${this.bucket}`,this.useJsPrefix=this.js.apiPrefix!=="$JS.API";const{mirror:r}=t.config;if(r){let s=r.name;if(s.startsWith(un)&&(s=s.substring(un.length)),r.external&&r.external.api!==""){const l=r.name.substring(un.length);this.useJsPrefix=!1,this.prefix=`$KV.${l}`,this.editPrefix=`${r.external.api}.$KV.${s}`}else this.editPrefix=this.prefix}}bucketName(){return this.stream??`${un}${this.bucket}`}subjectForBucket(){return`${this.prefix}.${this.bucket}.>`}subjectForKey(t,r=!1){const s=[];return r?(this.useJsPrefix&&s.push(this.js.apiPrefix),this.editPrefix!==""?s.push(this.editPrefix):s.push(this.prefix)):this.prefix&&s.push(this.prefix),s.push(t),s.join(".")}fullKeyName(t){return this.prefix!==""?`${this.prefix}.${t}`:`${yy}.${this.bucket}.${t}`}get prefixLen(){return this._prefixLen===0&&(this._prefixLen=this.prefix.length+1),this._prefixLen}encodeKey(t){const r=[];for(const s of t.split("."))switch(s){case">":case"*":r.push(s);break;default:r.push(this.codec.key.encode(s));break}return r.join(".")}decodeKey(t){const r=[];for(const s of t.split("."))switch(s){case">":case"*":r.push(s);break;default:r.push(this.codec.key.decode(s));break}return r.join(".")}close(){return Promise.resolve()}dataLen(t,r){const s=r&&r.get($t.MessageSizeHdr)||"";return s!==""?parseInt(s,10):t.length}smToEntry(t){return new LE(this.bucket,this.prefixLen,t)}jmToEntry(t){const r=this.decodeKey(t.subject.substring(this.prefixLen));return new zE(this.bucket,r,t)}async create(t,r){var c;let s;try{const d=await this.put(t,r,{previousSeq:0});return Promise.resolve(d)}catch(d){if(s=d,((c=d==null?void 0:d.api_error)==null?void 0:c.err_code)!==10071)return Promise.reject(d)}let l=0;try{const d=await this.get(t);return(d==null?void 0:d.operation)==="DEL"||(d==null?void 0:d.operation)==="PURGE"?(l=d!==null?d.revision:0,this.update(t,r,l)):Promise.reject(s)}catch(d){return Promise.reject(d)}}update(t,r,s){if(s<=0)throw new Error("version must be greater than 0");return this.put(t,r,{previousSeq:s})}async put(t,r,s={}){var d,p;const l=this.encodeKey(t);this.validateKey(l);const c={};if(s.previousSeq!==void 0){const y=Er();c.headers=y,y.set(Xn.ExpectedLastSubjectSequenceHdr,`${s.previousSeq}`)}try{return(await this.js.publish(this.subjectForKey(l,!0),r,c)).seq}catch(y){const f=y;return f.isJetStreamError()?(f.message=(d=f.api_error)==null?void 0:d.description,f.code=`${(p=f.api_error)==null?void 0:p.code}`,Promise.reject(f)):Promise.reject(y)}}async get(t,r){const s=this.encodeKey(t);this.validateKey(s);let l={last_by_subj:this.subjectForKey(s)};r&&r.revision>0&&(l={seq:r.revision});let c;try{this.direct?c=await this.jsm.direct.getMessage(this.bucketName(),l):c=await this.jsm.streams.getMessage(this.bucketName(),l);const d=this.smToEntry(c);return d.key!==s?null:d}catch(d){if(d.code===le.JetStream404NoMessages)return null;throw d}}purge(t,r){return this._deleteOrPurge(t,"PURGE",r)}delete(t,r){return this._deleteOrPurge(t,"DEL",r)}async purgeDeletes(t=1800*1e3){const r=st(),s=[],l=await this.watch({key:">",initializedFn:()=>{r.resolve()}});(async()=>{for await(const y of l)(y.operation==="DEL"||y.operation==="PURGE")&&s.push(y)})().then(),await r,l.stop();const c=Date.now()-t,d=s.map(y=>{const f=this.subjectForKey(y.key);return y.created.getTime()>=c?this.jsm.streams.purge(this.stream,{filter:f,keep:1}):this.jsm.streams.purge(this.stream,{filter:f,keep:0})}),p=await Promise.all(d);return p.unshift({success:!0,purged:0}),p.reduce((y,f)=>(y.purged+=f.purged,y))}async _deleteOrPurge(t,r,s){if(!this.hasWildcards(t))return this._doDeleteOrPurge(t,r,s);const l=await this.keys(t),c=[];for await(const d of l)c.push(this._doDeleteOrPurge(d,r)),c.length===100&&(await Promise.all(c),c.length=0);c.length>0&&await Promise.all(c)}async _doDeleteOrPurge(t,r,s){const l=this.encodeKey(t);this.validateKey(l);const c=Er();c.set(tu,r),r==="PURGE"&&c.set($t.RollupHdr,$t.RollupValueSubject),s!=null&&s.previousSeq&&c.set(Xn.ExpectedLastSubjectSequenceHdr,`${s.previousSeq}`),await this.js.publish(this.subjectForKey(l,!0),mn,{headers:c})}_buildCC(t,r,s={}){let c=(Array.isArray(t)?t:[t]).map(y=>{const f=this.encodeKey(y);return this.validateSearchKey(y),this.fullKeyName(f)}),d=gt.LastPerSubject;r===Un.AllHistory&&(d=gt.All),r===Un.UpdatesOnly&&(d=gt.New);let p;return c.length===1&&(p=c[0],c=void 0),Object.assign({deliver_policy:d,ack_policy:At.None,filter_subjects:c,filter_subject:p,flow_control:!0,idle_heartbeat:it(5*1e3)},s)}remove(t){return this.purge(t)}async history(t={}){const r=t.key??">",s=new Tt,l={};l.headers_only=t.headers_only||!1;let c;c=()=>{s.stop()};let d=0;const p=this._buildCC(r,Un.AllHistory,l),y=p.filter_subject,f=li(p);f.bindStream(this.stream),f.orderedConsumer(),f.callback((b,v)=>{if(b){s.stop(b);return}if(v){const _=this.jmToEntry(v);s.push(_),s.received++,(c&&d>0&&s.received>=d||v.info.pending===0)&&(s.push(c),c=void 0)}});const m=await this.js.subscribe(y,f);if(c){const{info:{last:b}}=m,v=b.num_pending+b.delivered.consumer_seq;if(v===0||s.received>=v)try{c()}catch(_){s.stop(_)}finally{c=void 0}else d=v}return s._data=m,s.iterClosed.then(()=>{m.unsubscribe()}),m.closed.then(()=>{s.stop()}).catch(b=>{s.stop(b)}),s}canSetWatcherName(){const r=this.js.nc,{ok:s}=r.features.get(Ie.JS_NEW_CONSUMER_CREATE_API);return s}async watch(t={}){const r=t.key??">",s=new Tt,l={};l.headers_only=t.headers_only||!1;let c=Un.LastValue;t.include===Un.AllHistory?c=Un.AllHistory:t.include===Un.UpdatesOnly&&(c=Un.UpdatesOnly);const d=t.ignoreDeletes===!0;let p=t.initializedFn,y=0;const f=this._buildCC(r,c,l),m=f.filter_subject,b=li(f);this.canSetWatcherName()&&b.consumerName(fi.next()),b.bindStream(this.stream),t.resumeFromRevision&&t.resumeFromRevision>0&&b.startSequence(t.resumeFromRevision),b.orderedConsumer(),b.callback((_,w)=>{if(_){s.stop(_);return}if(w){const S=this.jmToEntry(w);if(d&&S.operation==="DEL")return;s.push(S),s.received++,p&&(y>0&&s.received>=y||w.info.pending===0)&&(s.push(p),p=void 0)}});const v=await this.js.subscribe(m,b);if(p){const{info:{last:_}}=v,w=_.num_pending+_.delivered.consumer_seq;if(w===0||s.received>=w)try{p()}catch(S){s.stop(S)}finally{p=void 0}else y=w}return s._data=v,s.iterClosed.then(()=>{v.unsubscribe()}),v.closed.then(()=>{s.stop()}).catch(_=>{s.stop(_)}),s}async keys(t=">"){const r=new Tt,s=this._buildCC(t,Un.LastValue,{headers_only:!0}),l=Array.isArray(t)?">":s.filter_subject,c=li(s);c.bindStream(this.stream),c.orderedConsumer();const d=await this.js.subscribe(l,c);return(async()=>{var y;for await(const f of d){const m=(y=f.headers)==null?void 0:y.get(tu);if(m!=="DEL"&&m!=="PURGE"){const b=this.decodeKey(f.subject.substring(this.prefixLen));r.push(b)}f.info.pending===0&&d.unsubscribe()}})().then(()=>{r.stop()}).catch(y=>{r.stop(y)}),d.info.last.num_pending===0&&d.unsubscribe(),r}purgeBucket(t){return this.jsm.streams.purge(this.bucketName(),t)}destroy(){return this.jsm.streams.delete(this.bucketName())}async status(){var c;const r=((c=this.js.nc.info)==null?void 0:c.cluster)??"",s=this.bucketName(),l=await this.jsm.streams.info(s);return new Nb(l,r)}}class Nb{constructor(t,r=""){A(this,"si");A(this,"cluster");this.si=t,this.cluster=r}get bucket(){return this.si.config.name.startsWith(un)?this.si.config.name.substring(un.length):this.si.config.name}get values(){return this.si.state.messages}get history(){return this.si.config.max_msgs_per_subject}get ttl(){return jd(this.si.config.max_age)}get bucket_location(){return this.cluster}get backingStore(){return this.si.config.storage}get storage(){return this.si.config.storage}get replicas(){return this.si.config.num_replicas}get description(){return this.si.config.description??""}get maxBucketSize(){return this.si.config.max_bytes}get maxValueSize(){return this.si.config.max_msg_size}get max_bytes(){return this.si.config.max_bytes}get placement(){return this.si.config.placement||{cluster:"",tags:[]}}get placementCluster(){var t;return((t=this.si.config.placement)==null?void 0:t.cluster)??""}get republish(){return this.si.config.republish??{src:"",dest:""}}get streamInfo(){return this.si}get size(){return this.si.state.bytes}get metadata(){return this.si.config.metadata??{}}get compression(){return this.si.config.compression?this.si.config.compression!==hi.None:!1}}const kd="OBJ_",by="SHA-256=";function SE(i){return $c(i),`${kd}${i}`}function EE(i){return i.startsWith(kd)?i.substring(4):i}class cd{constructor(t){A(this,"si");A(this,"backingStore");this.si=t,this.backingStore="JetStream"}get bucket(){return EE(this.si.config.name)}get description(){return this.si.config.description??""}get ttl(){return this.si.config.max_age}get storage(){return this.si.config.storage}get replicas(){return this.si.config.num_replicas}get sealed(){return this.si.config.sealed}get size(){return this.si.state.bytes}get streamInfo(){return this.si}get metadata(){return this.si.config.metadata}get compression(){return this.si.config.compression?this.si.config.compression!==hi.None:!1}}function Kl(i){if(i===void 0)return;const{domain:t}=i;if(t===void 0)return i;const r=Object.assign({},i);if(delete r.domain,t==="")return r;if(r.external)throw new Error("domain and external are both set");return r.external={api:`$JS.${t}.API`},r}var Nn;(function(i){i[i.Unset=-1]="Unset",i[i.Consume=0]="Consume",i[i.Fetch=1]="Fetch"})(Nn||(Nn={}));var Jn;(function(i){i.HeartbeatsMissed="heartbeats_missed",i.ConsumerNotFound="consumer_not_found",i.StreamNotFound="stream_not_found",i.ConsumerDeleted="consumer_deleted",i.OrderedConsumerRecreated="ordered_consumer_recreated",i.NoResponders="no_responders"})(Jn||(Jn={}));var $s;(function(i){i.DebugEvent="debug",i.Discard="discard",i.Reset="reset",i.Next="next"})($s||($s={}));const vy=Uint8Array.of(43,65,67,75),OE=Uint8Array.of(45,78,65,75),Va=Uint8Array.of(43,87,80,73),AE=Uint8Array.of(43,78,88,84),jE=Uint8Array.of(43,84,69,82,77),TE=Uint8Array.of(32);function mo(i,t=5e3){return new FE(i,t)}class Uh extends Tt{constructor(r,s,l=!1){super();A(this,"consumer");A(this,"opts");A(this,"sub");A(this,"monitor");A(this,"pending");A(this,"inbox");A(this,"refilling");A(this,"pong");A(this,"callback");A(this,"timeout");A(this,"cleanupHandler");A(this,"listeners");A(this,"statusIterator");A(this,"forOrderedConsumer");A(this,"resetHandler");A(this,"abortOnMissingResource");A(this,"bind");A(this,"inBackOff");this.consumer=r;const c=s;this.opts=this.parseOptions(s,l),this.callback=c.callback||null,this.noIterator=typeof this.callback=="function",this.monitor=null,this.pong=null,this.pending={msgs:0,bytes:0,requests:0},this.refilling=l,this.timeout=null,this.inbox=Sr(r.api.nc.options.inboxPrefix),this.listeners=[],this.forOrderedConsumer=!1,this.abortOnMissingResource=c.abort_on_missing_resource===!0,this.bind=c.bind===!0,this.inBackOff=!1,this.start()}start(){const{max_messages:r,max_bytes:s,idle_heartbeat:l,threshold_bytes:c,threshold_messages:d}=this.opts;this.closed().then(y=>{if(this.cleanupHandler)try{this.cleanupHandler(y)}catch{}});const{sub:p}=this;p&&p.unsubscribe(),this.sub=this.consumer.api.nc.subscribe(this.inbox,{callback:(y,f)=>{var b,v,_,w;if(y){this.stop(y);return}if((b=this.monitor)==null||b.work(),f.subject===this.inbox){if(td(f))return;const S=(v=f.headers)==null?void 0:v.code,M=((w=(_=f.headers)==null?void 0:_.description)==null?void 0:w.toLowerCase())||"unknown",{msgsLeft:B,bytesLeft:U}=this.parseDiscard(f.headers);if(B>0||U>0)this.pending.msgs-=B,this.pending.bytes-=U,this.pending.requests--,this.notify($s.Discard,{msgsLeft:B,bytesLeft:U});else if(S===400){this.stop(new me(M,`${S}`));return}else if(S===409&&M==="consumer deleted"){if(this.notify(Jn.ConsumerDeleted,`${S} ${M}`),!this.refilling||this.abortOnMissingResource){const ie=new me(M,`${S}`);this.stop(ie);return}}else if(S===503){if(this.notify(Jn.NoResponders,`${S} No Responders`),!this.refilling||this.abortOnMissingResource){const ie=new me("no responders",`${S}`);this.stop(ie);return}}else this.notify($s.DebugEvent,`${S} ${M}`)}else this._push(mo(f,this.consumer.api.timeout)),this.received++,this.pending.msgs&&this.pending.msgs--,this.pending.bytes&&(this.pending.bytes-=f.size());if(this.pending.msgs===0&&this.pending.bytes===0&&(this.pending.requests=0),this.refilling){if(r&&this.pending.msgs<=d||s&&this.pending.bytes<=c){const S=this.pullOptions();this.pull(S)}}else this.pending.requests===0&&this._push(()=>{this.stop()})}}),this.sub.closed.then(()=>{this.sub.draining&&this._push(()=>{this.stop()})}),l&&(this.monitor=new Nd(l,y=>(this.notify(Jn.HeartbeatsMissed,y),this.resetPending().then(()=>{}).catch(()=>{}),!1),{maxOut:2})),(async()=>{var f;const y=this.consumer.api.nc.status();this.statusIterator=y;for await(const m of y)switch(m.type){case wr.Disconnect:(f=this.monitor)==null||f.cancel();break;case wr.Reconnect:this.resetPending().then(b=>{var v;b&&((v=this.monitor)==null||v.restart())}).catch(()=>{});break}})(),this.pull(this.pullOptions())}_push(r){if(!this.callback)super.push(r);else{const s=typeof r=="function"?r:null;try{s?s():this.callback(r)}catch(l){this.stop(l)}}}notify(r,s){this.listeners.length>0&&this.listeners.forEach(l=>{l.done||l.push({type:r,data:s})})}resetPending(){return this.bind?this.resetPendingNoInfo():this.resetPendingWithInfo()}resetPendingNoInfo(){return this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),Promise.resolve(!0)}async resetPendingWithInfo(){if(this.inBackOff)return!1;let r=0,s=0;const l=Ad([this.opts.expires]);let c=0;for(;;){if(this.done)return!1;if(this.consumer.api.nc.isClosed())return console.error("aborting resetPending - connection is closed"),!1;try{return await this.consumer.info(),this.inBackOff=!1,r=0,this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),!0}catch(d){if(d.message==="stream not found"){if(s++,this.notify(Jn.StreamNotFound,s),!this.refilling||this.abortOnMissingResource)return this.stop(d),!1}else if(d.message==="consumer not found"){if(r++,this.notify(Jn.ConsumerNotFound,r),this.resetHandler)try{this.resetHandler()}catch{}if(!this.refilling||this.abortOnMissingResource)return this.stop(d),!1;if(this.forOrderedConsumer)return!1}else r=0,s=0;this.inBackOff=!0;const p=l.backoff(c),y=Ys(p);await Promise.race([y,this.consumer.api.nc.closed()]),y.cancel(),c++}}}pull(r){this.pending.bytes+=r.max_bytes??0,this.pending.msgs+=r.batch??0,this.pending.requests++;const s=this.consumer.api.nc;this._push(()=>{s.publish(`${this.consumer.api.prefix}.CONSUMER.MSG.NEXT.${this.consumer.stream}.${this.consumer.name}`,this.consumer.api.jc.encode(r),{reply:this.inbox}),this.notify($s.Next,r)})}pullOptions(){const r=this.opts.max_messages-this.pending.msgs,s=this.opts.max_bytes-this.pending.bytes,l=it(this.opts.idle_heartbeat),c=it(this.opts.expires);return{batch:r,max_bytes:s,idle_heartbeat:l,expires:c}}parseDiscard(r){const s={msgsLeft:0,bytesLeft:0},l=r==null?void 0:r.get($t.PendingMessagesHdr);l&&(s.msgsLeft=parseInt(l));const c=r==null?void 0:r.get($t.PendingBytesHdr);return c&&(s.bytesLeft=parseInt(c)),s}trackTimeout(r){this.timeout=r}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}clearTimers(){var r,s;(r=this.monitor)==null||r.cancel(),this.monitor=null,(s=this.timeout)==null||s.cancel(),this.timeout=null}setCleanupHandler(r){this.cleanupHandler=r}stop(r){var s,l;this.done||((s=this.sub)==null||s.unsubscribe(),this.clearTimers(),(l=this.statusIterator)==null||l.stop(),this._push(()=>{super.stop(r),this.listeners.forEach(c=>{c.stop()})}))}parseOptions(r,s=!1){const l=r||{};if(l.max_messages=l.max_messages||0,l.max_bytes=l.max_bytes||0,l.max_messages!==0&&l.max_bytes!==0)throw new Error("only specify one of max_messages or max_bytes");if(l.max_messages===0&&(l.max_messages=100),l.expires=l.expires||3e4,l.expires<1e3)throw new Error("expires should be at least 1000ms");if(l.idle_heartbeat=l.idle_heartbeat||l.expires/2,l.idle_heartbeat=l.idle_heartbeat>3e4?3e4:l.idle_heartbeat,s){const c=Math.round(l.max_messages*.75)||1;l.threshold_messages=l.threshold_messages||c;const d=Math.round(l.max_bytes*.75)||1;l.threshold_bytes=l.threshold_bytes||d}return l}status(){const r=new Tt;return this.listeners.push(r),Promise.resolve(r)}}class NE extends Tt{constructor(){super();A(this,"src");A(this,"listeners");this.listeners=[]}setSource(r){this.src&&(this.src.resetHandler=void 0,this.src.setCleanupHandler(),this.src.stop()),this.src=r,this.src.setCleanupHandler(s=>{this.stop(s||void 0)}),(async()=>{const s=await this.src.status();for await(const l of s)this.notify(l.type,l.data)})().catch(()=>{})}notify(r,s){this.listeners.length>0&&this.listeners.forEach(l=>{l.done||l.push({type:r,data:s})})}stop(r){var s;this.done||((s=this.src)==null||s.stop(r),super.stop(r),this.listeners.forEach(l=>{l.stop()}))}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}status(){const r=new Tt;return this.listeners.push(r),Promise.resolve(r)}}class ud{constructor(t,r){A(this,"api");A(this,"_info");A(this,"stream");A(this,"name");this.api=t,this._info=r,this.stream=r.stream_name,this.name=r.name}consume(t={max_messages:100,expires:3e4}){return Promise.resolve(new Uh(this,t,!0))}fetch(t={max_messages:100,expires:3e4}){const r=new Uh(this,t,!1),s=Math.round(r.opts.expires*1.05),l=Gs(s);return r.closed().catch(()=>{}).finally(()=>{l.cancel()}),l.catch(()=>{r.close().catch()}),r.trackTimeout(l),Promise.resolve(r)}next(t={expires:3e4}){const r=st(),s=t;s.max_messages=1;const l=new Uh(this,s,!1),c=Math.round(l.opts.expires*1.05);c>=6e4&&(async()=>{for await(const p of await l.status())if(p.type===Jn.HeartbeatsMissed&&p.data>=2){r.reject(new Error("consumer missed heartbeats"));break}})().catch(),(async()=>{for await(const p of l){r.resolve(p);break}})().catch(()=>{});const d=Gs(c);return l.closed().then(p=>{p?r.reject(p):r.resolve(null)}).catch(p=>{r.reject(p)}).finally(()=>{d.cancel()}),d.catch(p=>{r.resolve(null),l.close().catch()}),l.trackTimeout(d),r}delete(){const{stream_name:t,name:r}=this._info;return this.api.delete(t,r)}info(t=!1){if(t)return Promise.resolve(this._info);const{stream_name:r,name:s}=this._info;return this.api.info(r,s).then(l=>(this._info=l,this._info))}}class kE{constructor(t,r,s={}){A(this,"api");A(this,"consumerOpts");A(this,"consumer");A(this,"opts");A(this,"cursor");A(this,"stream");A(this,"namePrefix");A(this,"serial");A(this,"currentConsumer");A(this,"userCallback");A(this,"iter");A(this,"type");A(this,"startSeq");A(this,"maxInitialReset");this.api=t,this.stream=r,this.cursor={stream_seq:1,deliver_seq:0},this.namePrefix=fi.next(),typeof s.name_prefix=="string"&&(uu("name_prefix",s.name_prefix),this.namePrefix=s.name_prefix+this.namePrefix),this.serial=0,this.currentConsumer=null,this.userCallback=null,this.iter=null,this.type=Nn.Unset,this.consumerOpts=s,this.maxInitialReset=30,this.startSeq=this.consumerOpts.opt_start_seq||0,this.cursor.stream_seq=this.startSeq>0?this.startSeq-1:0}getConsumerOpts(t){this.serial++;const r=`${this.namePrefix}_${this.serial}`;t=t===0?1:t;const s={name:r,deliver_policy:gt.StartSequence,opt_start_seq:t,ack_policy:At.None,inactive_threshold:it(300*1e3),num_replicas:1};return this.consumerOpts.headers_only===!0&&(s.headers_only=!0),Array.isArray(this.consumerOpts.filterSubjects)&&(s.filter_subjects=this.consumerOpts.filterSubjects),typeof this.consumerOpts.filterSubjects=="string"&&(s.filter_subject=this.consumerOpts.filterSubjects),this.consumerOpts.replay_policy&&(s.replay_policy=this.consumerOpts.replay_policy),t===this.startSeq+1&&(s.deliver_policy=this.consumerOpts.deliver_policy||gt.StartSequence,(this.consumerOpts.deliver_policy===gt.LastPerSubject||this.consumerOpts.deliver_policy===gt.New||this.consumerOpts.deliver_policy===gt.Last)&&(delete s.opt_start_seq,s.deliver_policy=this.consumerOpts.deliver_policy),s.deliver_policy===gt.LastPerSubject&&typeof s.filter_subjects>"u"&&typeof s.filter_subject>"u"&&(s.filter_subject=">"),this.consumerOpts.opt_start_time&&(delete s.opt_start_seq,s.deliver_policy=gt.StartTime,s.opt_start_time=this.consumerOpts.opt_start_time),this.consumerOpts.inactive_threshold&&(s.inactive_threshold=it(this.consumerOpts.inactive_threshold))),s}async resetConsumer(t=0){var d,p,y,f,m;fi.next();const r=this.serial===0;(d=this.consumer)==null||d.delete().catch(()=>{}),t=t===0?1:t,this.cursor.deliver_seq=0;const s=this.getConsumerOpts(t);s.max_deliver=1,s.mem_storage=!0;const l=Ad([((p=this.opts)==null?void 0:p.expires)||3e4]);let c;for(let b=0;;b++)try{c=await this.api.add(this.stream,s),(y=this.iter)==null||y.notify(Jn.OrderedConsumerRecreated,c.name);break}catch(v){if(v.message==="stream not found"&&((f=this.iter)==null||f.notify(Jn.StreamNotFound,b),this.type===Nn.Fetch||this.opts.abort_on_missing_resource===!0))return(m=this.iter)==null||m.stop(v),Promise.reject(v);if(r&&b>=this.maxInitialReset)throw v;await Ys(l.backoff(b+1))}return c}internalHandler(t){return r=>{var l;if(this.serial!==t)return;const s=r.info.deliverySequence;if(s!==this.cursor.deliver_seq+1){this.notifyOrderedResetAndReset();return}this.cursor.deliver_seq=s,this.cursor.stream_seq=r.info.streamSequence,this.userCallback?this.userCallback(r):(l=this.iter)==null||l.push(r)}}async reset(t={max_messages:100,expires:3e4},r){var y,f;r=r||{};const s=r.fromFetch||!1,l=r.orderedReset||!1;if(this.type===Nn.Fetch&&l){(y=this.iter)==null||y.src.stop(),await((f=this.iter)==null?void 0:f.closed()),this.currentConsumer=null;return}(this.currentConsumer===null||l)&&(this.currentConsumer=await this.resetConsumer(this.cursor.stream_seq+1)),(this.iter===null||s)&&(this.iter=new NE),this.consumer=new ud(this.api,this.currentConsumer);const c=t;c.callback=this.internalHandler(this.serial);let d=null;this.type===Nn.Fetch&&s?d=await this.consumer.fetch(t):this.type===Nn.Consume&&(d=await this.consumer.consume(t));const p=d;p.forOrderedConsumer=!0,p.resetHandler=()=>{this.notifyOrderedResetAndReset()},this.iter.setSource(p)}notifyOrderedResetAndReset(){var t;(t=this.iter)==null||t.notify($s.Reset,""),this.reset(this.opts,{orderedReset:!0})}async consume(t={max_messages:100,expires:3e4}){if(t.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===Nn.Fetch)return Promise.reject(new Error("ordered consumer initialized as fetch"));if(this.type===Nn.Consume)return Promise.reject(new Error("ordered consumer doesn't support concurrent consume"));const{callback:s}=t;return s&&(this.userCallback=s),this.type=Nn.Consume,this.opts=t,await this.reset(t),this.iter}async fetch(t={max_messages:100,expires:3e4}){var l;if(t.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===Nn.Consume)return Promise.reject(new Error("ordered consumer already initialized as consume"));if(((l=this.iter)==null?void 0:l.done)===!1)return Promise.reject(new Error("ordered consumer doesn't support concurrent fetch"));const{callback:s}=t;return s&&(this.userCallback=s),this.type=Nn.Fetch,this.opts=t,await this.reset(t,{fromFetch:!0}),this.iter}async next(t={expires:3e4}){const r=t;if(r.bind)return Promise.reject(new Error("bind is not supported"));r.max_messages=1;const s=st();return r.callback=c=>{this.userCallback=null,s.resolve(c)},(await this.fetch(r)).iterClosed.then(c=>{c&&s.reject(c),s.resolve(null)}).catch(c=>{s.reject(c)}),s}delete(){return this.currentConsumer?this.api.delete(this.stream,this.currentConsumer.name).then(t=>Promise.resolve(t)).catch(t=>Promise.reject(t)).finally(()=>{this.currentConsumer=null}):Promise.resolve(!1)}async info(t){return this.currentConsumer==null?(this.currentConsumer=await this.resetConsumer(this.startSeq),Promise.resolve(this.currentConsumer)):t&&this.currentConsumer?Promise.resolve(this.currentConsumer):this.api.info(this.stream,this.currentConsumer.name)}}class fd{constructor(t){A(this,"api");A(this,"notified");this.api=t,this.notified=!1}checkVersion(){const t=this.api.nc.features.get(Ie.JS_SIMPLIFICATION);return t.ok?Promise.resolve():Promise.reject(new Error(`consumers framework is only supported on servers ${t.min} or better`))}getPullConsumerFor(t){if(t.config.deliver_subject!==void 0)throw new Error("push consumer not supported");return new ud(this.api,t)}async get(t,r={}){return typeof r=="object"?this.ordered(t,r):(await this.checkVersion(),this.api.info(t,r).then(s=>s.config.deliver_subject!==void 0?Promise.reject(new Error("push consumer not supported")):new ud(this.api,s)).catch(s=>Promise.reject(s)))}async ordered(t,r){await this.checkVersion();const s=this.api;return new Cd(s.nc,s.opts).info(t).then(c=>Promise.resolve(new kE(this.api,t,r))).catch(c=>Promise.reject(c))}}class hu{constructor(t,r){A(this,"api");A(this,"_info");this.api=t,this._info=r}get name(){return this._info.config.name}alternates(){return this.info().then(t=>t.alternates?t.alternates:[])}async best(){if(await this.info(),this._info.alternates){const t=await this.api.info(this._info.alternates[0].name);return new hu(this.api,t)}else return this}info(t=!1,r){return t?Promise.resolve(this._info):this.api.info(this.name,r).then(s=>(this._info=s,this._info))}getConsumerFromInfo(t){return new fd(new Zc(this.api.nc,this.api.opts)).getPullConsumerFor(t)}getConsumer(t){return new fd(new Zc(this.api.nc,this.api.opts)).get(this.name,t)}getMessage(t){return this.api.getMessage(this.name,t)}deleteMessage(t,r){return this.api.deleteMessage(this.name,t,r)}}class Cd extends yo{constructor(t,r){super(t,r)}checkStreamConfigVersions(t){const r=this.nc;if(t.metadata){const{min:l,ok:c}=r.features.get(Ie.JS_STREAM_CONSUMER_METADATA);if(!c)throw new Error(`stream 'metadata' requires server ${l}`)}if(t.first_seq){const{min:l,ok:c}=r.features.get(Ie.JS_STREAM_FIRST_SEQ);if(!c)throw new Error(`stream 'first_seq' requires server ${l}`)}if(t.subject_transform){const{min:l,ok:c}=r.features.get(Ie.JS_STREAM_SUBJECT_TRANSFORM);if(!c)throw new Error(`stream 'subject_transform' requires server ${l}`)}if(t.compression){const{min:l,ok:c}=r.features.get(Ie.JS_STREAM_COMPRESSION);if(!c)throw new Error(`stream 'compression' requires server ${l}`)}if(t.consumer_limits){const{min:l,ok:c}=r.features.get(Ie.JS_DEFAULT_CONSUMER_LIMITS);if(!c)throw new Error(`stream 'consumer_limits' requires server ${l}`)}function s(l,c){var p;if((((p=c==null?void 0:c.subject_transforms)==null?void 0:p.length)||0)>0){const{min:y,ok:f}=r.features.get(Ie.JS_STREAM_SOURCE_SUBJECT_TRANSFORM);if(!f)throw new Error(`${l} 'subject_transforms' requires server ${y}`)}}t.sources&&t.sources.forEach(l=>{s("stream sources",l)}),t.mirror&&s("stream mirror",t.mirror)}async add(t={}){var l;this.checkStreamConfigVersions(t),Pt(t.name),t.mirror=Kl(t.mirror),t.sources=(l=t.sources)==null?void 0:l.map(Kl);const s=await this._request(`${this.prefix}.STREAM.CREATE.${t.name}`,t);return this._fixInfo(s),s}async delete(t){return Pt(t),(await this._request(`${this.prefix}.STREAM.DELETE.${t}`)).success}async update(t,r={}){var p;if(typeof t=="object"){const y=t;t=y.name,r=y,console.trace("\x1B[33m >> streams.update(config: StreamConfig) api changed to streams.update(name: string, config: StreamUpdateConfig) - this shim will be removed - update your code. \x1B[0m")}this.checkStreamConfigVersions(r),Pt(t);const s=await this.info(t),l=Object.assign(s.config,r);l.mirror=Kl(l.mirror),l.sources=(p=l.sources)==null?void 0:p.map(Kl);const d=await this._request(`${this.prefix}.STREAM.UPDATE.${t}`,l);return this._fixInfo(d),d}async info(t,r){Pt(t);const s=`${this.prefix}.STREAM.INFO.${t}`;let c=await this._request(s,r),{total:d,limit:p}=c,y=c.state.subjects?Object.getOwnPropertyNames(c.state.subjects).length:1;if(d&&d>y){const f=[c],m=r||{};let b=0;for(;d>y;){b++,m.offset=p*b;const _=await this._request(s,m);d=_.total,f.push(_);const w=Object.getOwnPropertyNames(_.state.subjects).length;if(y+=w,w<p)break}let v={};for(let _=0;_<f.length;_++)c=f[_],c.state.subjects&&(v=Object.assign(v,c.state.subjects));c.offset=0,c.total=0,c.limit=0,c.state.subjects=v}return this._fixInfo(c),c}list(t=""){const r=t!=null&&t.length?{subject:t}:{},s=c=>{const d=c;return d.streams.forEach(p=>{this._fixInfo(p)}),d.streams},l=`${this.prefix}.STREAM.LIST`;return new ro(l,s,this,r)}_fixInfo(t){t.config.sealed=t.config.sealed||!1,t.config.deny_delete=t.config.deny_delete||!1,t.config.deny_purge=t.config.deny_purge||!1,t.config.allow_rollup_hdrs=t.config.allow_rollup_hdrs||!1}async purge(t,r){if(r){const{keep:l,seq:c}=r;if(typeof l=="number"&&typeof c=="number")throw new Error("can specify one of keep or seq")}return Pt(t),await this._request(`${this.prefix}.STREAM.PURGE.${t}`,r)}async deleteMessage(t,r,s=!0){Pt(t);const l={seq:r};return s||(l.no_erase=!0),(await this._request(`${this.prefix}.STREAM.MSG.DELETE.${t}`,l)).success}async getMessage(t,r){Pt(t);const l=await this._request(`${this.prefix}.STREAM.MSG.GET.${t}`,r);return new kb(l)}find(t){return this.findStream(t)}listKvs(){const t=s=>{var y;const c=s.streams.filter(f=>f.config.name.startsWith(un));c.forEach(f=>{this._fixInfo(f)});let d="";return c.length&&(d=((y=this.nc.info)==null?void 0:y.cluster)??""),c.map(f=>new Nb(f,d))},r=`${this.prefix}.STREAM.LIST`;return new ro(r,t,this)}listObjectStores(){const t=s=>{const c=s.streams.filter(p=>p.config.name.startsWith(kd));return c.forEach(p=>{this._fixInfo(p)}),c.map(p=>new cd(p))},r=`${this.prefix}.STREAM.LIST`;return new ro(r,t,this)}names(t=""){const r=t!=null&&t.length?{subject:t}:{},s=c=>c.streams,l=`${this.prefix}.STREAM.NAMES`;return new ro(l,s,this,r)}async get(t){const r=await this.info(t);return Promise.resolve(new hu(this,r))}}class CE extends yo{constructor(t,r){super(t,r)}async getMessage(t,r){Pt(t);let s=r;const{last_by_subj:l}=s;l&&(s=null);const c=s?this.jc.encode(s):mn,d=this.opts.apiPrefix||"$JS.API",p=l?`${d}.DIRECT.GET.${t}.${l}`:`${d}.DIRECT.GET.${t}`,y=await this.nc.request(p,c,{timeout:this.timeout}),f=Ps(y);if(f)return Promise.reject(f);const m=new hd(y);return Promise.resolve(m)}async getBatch(t,r){Pt(t);const l=`${this.opts.apiPrefix||"$JS.API"}.DIRECT.GET.${t}`;if(!Array.isArray(r.multi_last)||r.multi_last.length===0)return Promise.reject("multi_last is required");const c=JSON.stringify(r,(y,f)=>y==="up_to_time"&&f instanceof Date?f.toISOString():f),d=new Tt,p=await this.nc.requestMany(l,c,{strategy:$n.SentinelMsg});return(async()=>{var b,v,_;let y=!1,f=!1,m;for await(const w of p){if(!y){y=!0;const S=((b=w.headers)==null?void 0:b.code)||0;if(S!==0&&S<200||S>299){m=(v=w.headers)==null?void 0:v.description.toLowerCase();break}if(((_=w.headers)==null?void 0:_.get("Nats-Num-Pending"))===""){f=!0;break}}if(w.data.length===0)break;d.push(new hd(w))}d.push(()=>{if(f)throw new Error("batch direct get not supported by the server");if(m)throw new Error(`bad request: ${m}`);d.stop()})})(),Promise.resolve(d)}}class hd{constructor(t){A(this,"data");A(this,"header");if(!t.headers)throw new Error("headers expected");this.data=t.data,this.header=t.headers}get subject(){return this.header.last(Bs.Subject)}get seq(){const t=this.header.last(Bs.Sequence);return typeof t=="string"?parseInt(t):0}get time(){return new Date(Date.parse(this.timestamp))}get timestamp(){return this.header.last(Bs.TimeStamp)}get stream(){return this.header.last(Bs.Stream)}json(t){return Hn(t).decode(this.data)}string(){return fn.decode(this.data)}}A(hd,"jc");class ME extends yo{constructor(r,s){super(r,s);A(this,"streams");A(this,"consumers");A(this,"direct");this.streams=new Cd(r,s),this.consumers=new Zc(r,s),this.direct=new CE(r,s)}async getAccountInfo(){return await this._request(`${this.prefix}.INFO`)}jetstream(){return this.nc.jetstream(this.getOptions())}advisories(){const r=new Tt;return this.nc.subscribe("$JS.EVENT.ADVISORY.>",{callback:(s,l)=>{if(s)throw s;try{const c=this.parseJsResponse(l),d=c.type.split("."),p=d[d.length-1];r.push({kind:p,data:c})}catch(c){r.stop(c)}}}),r}}class kb{constructor(t){A(this,"_header");A(this,"smr");this.smr=t}get subject(){return this.smr.message.subject}get seq(){return this.smr.message.seq}get timestamp(){return this.smr.message.time}get time(){return new Date(Date.parse(this.timestamp))}get data(){return this.smr.message.data?this._parse(this.smr.message.data):mn}get header(){if(!this._header)if(this.smr.message.hdrs){const t=this._parse(this.smr.message.hdrs);this._header=oi.decode(t)}else this._header=Er();return this._header}_parse(t){const r=atob(t),s=r.length,l=new Uint8Array(s);for(let c=0;c<s;c++)l[c]=r.charCodeAt(c);return l}json(t){return Hn(t).decode(this.data)}string(){return fn.decode(this.data)}}A(kb,"jc");class RE{constructor(t){A(this,"api");this.api=t}get(t){return this.api.info(t).then(r=>new hu(this.api,r))}}class Ph{constructor(t){A(this,"info");A(this,"hdrs");this.info=t}get name(){return this.info.name}get description(){return this.info.description??""}get headers(){return this.hdrs||(this.hdrs=oi.fromRecord(this.info.headers||{})),this.hdrs}get options(){return this.info.options}get bucket(){return this.info.bucket}get chunks(){return this.info.chunks}get deleted(){return this.info.deleted??!1}get digest(){return this.info.digest}get mtime(){return this.info.mtime}get nuid(){return this.info.nuid}get size(){return this.info.size}get revision(){return this.info.revision}get metadata(){return this.info.metadata||{}}isLink(){var t,r;return((t=this.info.options)==null?void 0:t.link)!==void 0&&((r=this.info.options)==null?void 0:r.link)!==null}}function xy(i){const t={name:i.name,description:i.description??"",options:i.options,metadata:i.metadata};if(i.headers){const r=i.headers;t.headers=r.toRecord()}return t}function DE(){return new ReadableStream({pull(i){i.enqueue(new Uint8Array(0)),i.close()}})}class lo{constructor(t,r,s){A(this,"jsm");A(this,"js");A(this,"stream");A(this,"name");this.name=t,this.jsm=r,this.js=s}_checkNotEmpty(t){return!t||t.length===0?{name:t,error:new Error("name cannot be empty")}:{name:t}}async info(t){const r=await this.rawInfo(t);return r?new Ph(r):null}async list(){const t=[],r=await this.watch({ignoreDeletes:!0,includeHistory:!0});for await(const s of r){if(s===null)break;t.push(s)}return Promise.resolve(t)}async rawInfo(t){const{name:r,error:s}=this._checkNotEmpty(t);if(s)return Promise.reject(s);const l=this._metaSubject(r);try{const c=await this.jsm.streams.getMessage(this.stream,{last_by_subj:l}),p=Hn().decode(c.data);return p.revision=c.seq,p}catch(c){return c.code==="404"?null:Promise.reject(c)}}async _si(t){try{return await this.jsm.streams.info(this.stream,t)}catch(r){return r.code==="404"?null:Promise.reject(r)}}async seal(){let t=await this._si();return t===null?Promise.reject(new Error("object store not found")):(t.config.sealed=!0,t=await this.jsm.streams.update(this.stream,t.config),Promise.resolve(new cd(t)))}async status(t){const r=await this._si(t);return r===null?Promise.reject(new Error("object store not found")):Promise.resolve(new cd(r))}destroy(){return this.jsm.streams.delete(this.stream)}async _put(t,r,s){var ce;const l=this.js.getOptions();s=s||{timeout:l.timeout},s.timeout=s.timeout||l.timeout,s.previousRevision=s.previousRevision??void 0;const{timeout:c,previousRevision:d}=s,p=this.js.nc.info,y=(p==null?void 0:p.max_payload)||1024;t=t||{},t.options=t.options||{};let f=((ce=t.options)==null?void 0:ce.max_chunk_size)||128*1024;f=f>y?y:f,t.options.max_chunk_size=f;const m=await this.info(t.name),{name:b,error:v}=this._checkNotEmpty(t.name);if(v)return Promise.reject(v);const _=fi.next(),w=this._chunkSubject(_),S=this._metaSubject(b),M=Object.assign({bucket:this.name,nuid:_,size:0,chunks:0},xy(t)),B=st(),U=[],ie=new Vs;try{const C=r?r.getReader():null,z=cy.create();for(;;){const{done:re,value:X}=C?await C.read():{done:!0,value:void 0};if(re){if(ie.size()>0){const Q=ie.drain();z.update(Q),M.chunks++,M.size+=Q.length,U.push(this.js.publish(w,Q,{timeout:c}))}await Promise.all(U),U.length=0,M.mtime=new Date().toISOString();const L=Is.encode(z.digest());M.digest=`${by}${L}`,M.deleted=!1;const G=Er();typeof d=="number"&&G.set(Xn.ExpectedLastSubjectSequenceHdr,`${d}`),G.set($t.RollupHdr,$t.RollupValueSubject);const W=await this.js.publish(S,Hn().encode(M),{headers:G,timeout:c});if(M.revision=W.seq,m)try{await this.jsm.streams.purge(this.stream,{filter:`$O.${this.name}.C.${m.nuid}`})}catch{}B.resolve(new Ph(M));break}if(X)for(ie.fill(X);ie.size()>f;){M.chunks++,M.size+=f;const L=ie.drain(t.options.max_chunk_size);z.update(L),U.push(this.js.publish(w,L,{timeout:c}))}}}catch(C){await this.jsm.streams.purge(this.stream,{filter:w}),B.reject(C)}return B}putBlob(t,r,s){function l(c){return new ReadableStream({pull(d){d.enqueue(c),d.close()}})}return r===null&&(r=new Uint8Array(0)),this.put(t,l(r),s)}put(t,r,s){var l;return(l=t==null?void 0:t.options)!=null&&l.link?Promise.reject(new Error("link cannot be set when putting the object in bucket")):this._put(t,r,s)}async getBlob(t){async function r(c){const d=new Vs,p=c.getReader();for(;;){const{done:y,value:f}=await p.read();if(y)return d.drain();f&&f.length&&d.fill(f)}}const s=await this.get(t);if(s===null)return Promise.resolve(null);const l=await Promise.all([s.error,r(s.data)]);return l[0]?Promise.reject(l[0]):Promise.resolve(l[1])}async get(t){const r=await this.rawInfo(t);if(r===null||r.deleted)return Promise.resolve(null);if(r.options&&r.options.link){const b=r.options.link.name||"";if(b==="")throw new Error("link is a bucket");return(r.options.link.bucket!==this.name?await lo.create(this.js,r.options.link.bucket):this).get(b)}if(!r.digest.startsWith(by))return Promise.reject(new Error(`unknown digest type: ${r.digest}`));const s=id(r.digest.substring(8));if(s===null)return Promise.reject(new Error(`unable to parse digest: ${r.digest}`));const l=st(),c={info:new Ph(r),error:l};if(r.size===0)return c.data=DE(),l.resolve(null),Promise.resolve(c);let d;const p=li();p.orderedConsumer();const y=cy.create(),f=`$O.${this.name}.C.${r.nuid}`,m=await this.js.subscribe(f,p);return(async()=>{for await(const b of m)b.data.length>0&&(y.update(b.data),d.enqueue(b.data)),b.info.pending===0&&(wS(s,y.digest())?d.close():d.error(new Error(`received a corrupt object, digests do not match received: ${r.digest} calculated ${s}`)),m.unsubscribe())})().then(()=>{l.resolve()}).catch(b=>{d.error(b),l.reject(b)}),c.data=new ReadableStream({start(b){d=b},cancel(){m.unsubscribe()}}),c}linkStore(t,r){if(!(r instanceof lo))return Promise.reject("bucket required");const s=r,{name:l,error:c}=this._checkNotEmpty(t);if(c)return Promise.reject(c);const d={name:l,options:{link:{bucket:s.name}}};return this._put(d,null)}async link(t,r){const{name:s,error:l}=this._checkNotEmpty(t);if(l)return Promise.reject(l);if(r.deleted)return Promise.reject(new Error("src object is deleted"));if(r.isLink())return Promise.reject(new Error("src object is a link"));const c=await this.rawInfo(t);if(c!==null&&!c.deleted)return Promise.reject(new Error("an object already exists with that name"));const d={bucket:r.bucket,name:r.name},p={name:s,bucket:r.bucket,options:{link:d}};await this.js.publish(this._metaSubject(t),JSON.stringify(p));const y=await this.info(t);return Promise.resolve(y)}async delete(t){const r=await this.rawInfo(t);if(r===null)return Promise.resolve({purged:0,success:!1});r.deleted=!0,r.size=0,r.chunks=0,r.digest="";const s=Hn(),l=Er();return l.set($t.RollupHdr,$t.RollupValueSubject),await this.js.publish(this._metaSubject(r.name),s.encode(r),{headers:l}),this.jsm.streams.purge(this.stream,{filter:this._chunkSubject(r.nuid)})}async update(t,r={}){const s=await this.rawInfo(t);if(s===null)return Promise.reject(new Error("object not found"));if(s.deleted)return Promise.reject(new Error("cannot update meta for a deleted object"));r.name=r.name??s.name;const{name:l,error:c}=this._checkNotEmpty(r.name);if(c)return Promise.reject(c);if(t!==r.name){const y=await this.info(r.name);if(y&&!y.deleted)return Promise.reject(new Error("an object already exists with that name"))}r.name=l;const d=Object.assign({},s,xy(r)),p=await this.js.publish(this._metaSubject(d.name),JSON.stringify(d));return t!==r.name&&await this.jsm.streams.purge(this.stream,{filter:this._metaSubject(t)}),Promise.resolve(p)}async watch(t={}){t.includeHistory=t.includeHistory??!1,t.ignoreDeletes=t.ignoreDeletes??!1;let r=!1;const s=new Tt,l=this._metaSubjectAll();try{await this.jsm.streams.getMessage(this.stream,{last_by_subj:l})}catch(y){y.code==="404"?(s.push(null),r=!0):s.stop(y)}const c=Hn(),d=li();d.orderedConsumer(),t.includeHistory?d.deliverLastPerSubject():(r=!0,d.deliverNew()),d.callback((y,f)=>{var m;if(y){s.stop(y);return}if(f!==null){const b=c.decode(f.data);b.deleted&&t.ignoreDeletes===!0||s.push(b),((m=f.info)==null?void 0:m.pending)===0&&!r&&(r=!0,s.push(null))}});const p=await this.js.subscribe(l,d);return s._data=p,s.iterClosed.then(()=>{p.unsubscribe()}),p.closed.then(()=>{s.stop()}).catch(y=>{s.stop(y)}),s}_chunkSubject(t){return`$O.${this.name}.C.${t}`}_metaSubject(t){return`$O.${this.name}.M.${Is.encode(t)}`}_metaSubjectAll(){return`$O.${this.name}.M.>`}async init(t={}){try{this.stream=SE(this.name)}catch(l){return Promise.reject(l)}const r=(t==null?void 0:t.ttl)||0;delete t.ttl;const s=Object.assign({max_age:r},t);s.name=this.stream,s.num_replicas=t.replicas??1,s.allow_direct=!0,s.allow_rollup_hdrs=!0,s.discard=uo.New,s.subjects=[`$O.${this.name}.C.>`,`$O.${this.name}.M.>`],t.placement&&(s.placement=t.placement),t.metadata&&(s.metadata=t.metadata),typeof t.compression=="boolean"&&(s.compression=t.compression?hi.S2:hi.None);try{await this.jsm.streams.info(s.name)}catch(l){l.message==="stream not found"&&await this.jsm.streams.add(s)}}static async create(t,r,s={}){const l=await t.jetstreamManager(),c=new lo(r,l,t);return await c.init(s),Promise.resolve(c)}}class qE{constructor(t){A(this,"js");this.js=t}kv(t,r={}){const s=this.js,{ok:l,min:c}=s.nc.features.get(Ie.JS_KV);return l?r.bindOnly?ho.bind(this.js,t,r):ho.create(this.js,t,r):Promise.reject(new Error(`kv is only supported on servers ${c} or better`))}os(t,r={}){var d;if(typeof((d=crypto==null?void 0:crypto.subtle)==null?void 0:d.digest)!="function")return Promise.reject(new Error("objectstore: unable to calculate hashes - crypto.subtle.digest with sha256 support is required"));const s=this.js,{ok:l,min:c}=s.nc.features.get(Ie.JS_OBJECTSTORE);return l?lo.create(this.js,t,r):Promise.reject(new Error(`objectstore is only supported on servers ${c} or better`))}}class Md extends yo{constructor(r,s){super(r,s);A(this,"consumers");A(this,"streams");A(this,"consumerAPI");A(this,"streamAPI");this.consumerAPI=new Zc(r,s),this.streamAPI=new Cd(r,s),this.consumers=new fd(this.consumerAPI),this.streams=new RE(this.streamAPI)}jetstreamManager(r){r===void 0&&(r=this.opts.checkAPI);const s=Object.assign({},this.opts,{checkAPI:r});return this.nc.jetstreamManager(s)}get apiPrefix(){return this.prefix}get views(){return new qE(this)}async publish(r,s=mn,l){l=l||{},l.expect=l.expect||{};const c=(l==null?void 0:l.headers)||Er();l&&(l.msgID&&c.set(Xn.MsgIdHdr,l.msgID),l.expect.lastMsgID&&c.set(Xn.ExpectedLastMsgIdHdr,l.expect.lastMsgID),l.expect.streamName&&c.set(Xn.ExpectedStreamHdr,l.expect.streamName),typeof l.expect.lastSequence=="number"&&c.set(Xn.ExpectedLastSeqHdr,`${l.expect.lastSequence}`),typeof l.expect.lastSubjectSequence=="number"&&c.set(Xn.ExpectedLastSubjectSequenceHdr,`${l.expect.lastSubjectSequence}`));const d=l.timeout||this.timeout,p={};d&&(p.timeout=d),l&&(p.headers=c);let{retries:y,retry_delay:f}=l;y=y||1,f=f||250;let m;for(let v=0;v<y;v++)try{m=await this.nc.request(r,s,p);break}catch(_){if(_.code==="503"&&v+1<y)await Ys(f);else throw _}const b=this.parseJsResponse(m);if(b.stream==="")throw me.errorForCode(le.JetStreamInvalidAck);return b.duplicate=b.duplicate?b.duplicate:!1,b}async pull(r,s,l=0){Pt(r),Us(s);let c=this.timeout;l>c&&(c=l),l=l<0?0:it(l);const d={batch:1,no_wait:l===0,expires:l},p=await this.nc.request(`${this.prefix}.CONSUMER.MSG.NEXT.${r}.${s}`,this.jc.encode(d),{noMux:!0,timeout:c}),y=Ps(p);if(y)throw y;return mo(p,this.timeout)}fetch(r,s,l={}){Pt(r),Us(s);let c=null;const d=(l.max_bytes??0)>0;let p=0;const y=d?l.max_bytes:0;let f=null;const m={};if(m.batch=l.batch||1,y){const U=this.nc.features.get(Ie.JS_PULL_MAX_BYTES);if(!U.ok)throw new Error(`max_bytes is only supported on servers ${U.min} or better`);m.max_bytes=y}m.no_wait=l.no_wait||!1,m.no_wait&&m.expires&&(m.expires=0);const b=l.expires||0;if(b&&(m.expires=it(b)),b===0&&m.no_wait===!1)throw new Error("expires or no_wait is required");const v=l.idle_heartbeat||0;v&&(m.idle_heartbeat=it(v),l.delay_heartbeat===!0&&(m.idle_heartbeat=it(v*4)));const _=new Tt,w=m.batch;let S=0;_.protocolFilterFn=(U,ie=!1)=>td(U.msg)?(f==null||f.work(),!1):!0,_.dispatchedFn=U=>{if(U){if(d&&(p+=U.data.length),S++,c&&U.info.pending===0)return;(_.getPending()===1&&U.info.pending===0||w===S||y>0&&p>=y)&&_.stop()}};const M=Sr(this.nc.options.inboxPrefix),B=this.nc.subscribe(M,{max:l.batch,callback:(U,ie)=>{U===null&&(U=Ps(ie)),U!==null?(c&&(c.cancel(),c=null),rS(U)?_.stop(Mb(U)===null?void 0:U):_.stop(U)):(f==null||f.work(),_.received++,_.push(mo(ie,this.timeout)))}});return b&&(c=Gs(b),c.catch(()=>{B.isClosed()||(B.drain().catch(()=>{}),c=null),f&&f.cancel()})),(async()=>{try{v&&(f=new Nd(v,U=>(_.push(()=>{_.err=new me(`${kn.IdleHeartbeatMissed}: ${U}`,le.JetStreamIdleHeartBeat)}),!0)))}catch{}await B.closed,c!==null&&(c.cancel(),c=null),f&&f.cancel(),_.stop()})().catch(),this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${r}.${s}`,this.jc.encode(m),{reply:M}),_}async pullSubscribe(r,s=li()){const l=await this._processOptions(r,s);if(l.ordered)throw new Error("pull subscribers cannot be be ordered");if(l.config.deliver_subject)throw new Error("consumer info specifies deliver_subject - pull consumers cannot have deliver_subject set");const c=l.config.ack_policy;if(c===At.None||c===At.All)throw new Error("ack policy for pull consumers must be explicit");const d=this._buildTypedSubscriptionOpts(l),p=new UE(this,l.deliver,d);p.info=l;try{await this._maybeCreateConsumer(l)}catch(y){throw p.unsubscribe(),y}return p}async subscribe(r,s=li()){const l=await this._processOptions(r,s);if(!l.isBind&&!l.config.deliver_subject)throw new Error("push consumer requires deliver_subject");const c=this._buildTypedSubscriptionOpts(l),d=new Cb(this,l.deliver,c);d.info=l;try{await this._maybeCreateConsumer(l)}catch(p){throw d.unsubscribe(),p}return d._maybeSetupHbMonitoring(),d}async _processOptions(r,s=li()){const l=sy(s)?s.getOpts():s;if(l.isBind=sy(s)?s.isBind:!1,l.flow_control={heartbeat_count:0,fc_count:0,consumer_restarts:0},l.ordered){if(l.ordered_consumer_sequence={stream_seq:0,delivery_seq:0},l.config.ack_policy!==At.NotSet&&l.config.ack_policy!==At.None)throw new me("ordered consumer: ack_policy can only be set to 'none'",le.ApiError);if(l.config.durable_name&&l.config.durable_name.length>0)throw new me("ordered consumer: durable_name cannot be set",le.ApiError);if(l.config.deliver_subject&&l.config.deliver_subject.length>0)throw new me("ordered consumer: deliver_subject cannot be set",le.ApiError);if(l.config.max_deliver!==void 0&&l.config.max_deliver>1)throw new me("ordered consumer: max_deliver cannot be set",le.ApiError);if(l.config.deliver_group&&l.config.deliver_group.length>0)throw new me("ordered consumer: deliver_group cannot be set",le.ApiError);l.config.deliver_subject=Sr(this.nc.options.inboxPrefix),l.config.ack_policy=At.None,l.config.max_deliver=1,l.config.flow_control=!0,l.config.idle_heartbeat=l.config.idle_heartbeat||it(5e3),l.config.ack_wait=it(1320*60*1e3),l.config.mem_storage=!0,l.config.num_replicas=1}if(l.config.ack_policy===At.NotSet&&(l.config.ack_policy=At.All),l.api=this,l.config=l.config||{},l.stream=l.stream?l.stream:await this.findStream(r),l.attached=!1,l.config.durable_name)try{const c=await this.consumerAPI.info(l.stream,l.config.durable_name);if(c){if(c.config.filter_subject&&c.config.filter_subject!==r)throw new Error("subject does not match consumer");const d=l.config.deliver_group??"";if(d===""&&c.push_bound===!0)throw new Error("duplicate subscription");const p=c.config.deliver_group??"";if(d!==p)throw p===""?new Error("durable requires no queue group"):new Error(`durable requires queue group '${p}'`);l.last=c,l.config=c.config,l.attached=!0,l.config.durable_name||(l.name=c.name)}}catch(c){if(c.code!=="404")throw c}return!l.attached&&l.config.filter_subject===void 0&&l.config.filter_subjects===void 0&&(l.config.filter_subject=r),l.deliver=l.config.deliver_subject||Sr(this.nc.options.inboxPrefix),l}_buildTypedSubscriptionOpts(r){const s={};return s.adapter=PE(r.callbackFn===void 0,this.timeout),s.ingestionFilterFn=Md.ingestionFn(r.ordered),s.protocolFilterFn=(l,c=!1)=>{const d=l;return ed(d.msg)?(c||d.msg.respond(),!1):!0},!r.mack&&r.config.ack_policy!==At.None&&(s.dispatchedFn=HE),r.callbackFn&&(s.callback=r.callbackFn),s.max=r.max||0,s.queue=r.queue,s}async _maybeCreateConsumer(r){if(r.attached)return;if(r.isBind)throw new Error(`unable to bind - durable consumer ${r.config.durable_name} doesn't exist in ${r.stream}`);r.config=Object.assign({deliver_policy:gt.All,ack_policy:At.Explicit,ack_wait:it(30*1e3),replay_policy:Fs.Instant},r.config);const s=await this.consumerAPI.add(r.stream,r.config);if(Array.isArray(r.config.filter_subjects&&!Array.isArray(s.config.filter_subjects)))throw new Error("jetstream server doesn't support consumers with multiple filter subjects");r.name=s.name,r.config=s.config,r.last=s}static ingestionFn(r){return(s,l)=>{var y;const c=l;if(!s)return{ingest:!1,protocol:!1};const d=s;if(Ps(d.msg)||(y=c.monitor)==null||y.work(),td(d.msg)){const f=r?c._checkHbOrderConsumer(d.msg):!0;return r||c.info.flow_control.heartbeat_count++,{ingest:f,protocol:!0}}else if(ed(d.msg))return c.info.flow_control.fc_count++,{ingest:!0,protocol:!0};return{ingest:r?c._checkOrderedConsumer(s):!0,protocol:!1}}}}class Rd{constructor(t){A(this,"options");A(this,"protocol");A(this,"draining");A(this,"listeners");A(this,"_services");this.draining=!1,this.options=iE(t),this.listeners=[]}static connect(t={}){return new Promise((r,s)=>{const l=new Rd(t);eu.connect(l.options,l).then(c=>{l.protocol=c,(async function(){for await(const d of c.status())l.listeners.forEach(p=>{p.push(d)})})(),r(l)}).catch(c=>{s(c)})})}closed(){return this.protocol.closed}async close(){await this.protocol.close()}_check(t,r,s){if(this.isClosed())throw me.errorForCode(le.ConnectionClosed);if(r&&this.isDraining()||s&&this.protocol.noMorePublishing)throw me.errorForCode(le.ConnectionDraining);if(t=t||"",t.length===0)throw me.errorForCode(le.BadSubject)}publish(t,r,s){this._check(t,!1,!0),this.protocol.publish(t,r,s)}publishMessage(t){return this.publish(t.subject,t.data,{reply:t.reply,headers:t.headers})}respondMessage(t){return t.reply?(this.publish(t.reply,t.data,{reply:t.reply,headers:t.headers}),!0):!1}subscribe(t,r={}){this._check(t,!0,!1);const s=new jb(this.protocol,t,r);return this.protocol.subscribe(s),s}_resub(t,r,s){this._check(r,!0,!1);const l=t;l.max=s,s&&(l.max=s+l.received),this.protocol.resub(l,r)}requestMany(t,r=mn,s={maxWait:1e3,maxMessages:-1}){const l=!this.protocol.options.noAsyncTraces;try{this._check(t,!0,!0)}catch(y){return Promise.reject(y)}if(s.strategy=s.strategy||$n.Timer,s.maxWait=s.maxWait||1e3,s.maxWait<1)return Promise.reject(new me("timeout",le.InvalidOption));const c=new Tt;function d(y){c.push(()=>{c.stop(y)})}function p(y,f){y||f===null?d(y===null?void 0:y):c.push(f)}if(s.noMux){const y=l?new Error().stack:null;let f=typeof s.maxMessages=="number"&&s.maxMessages>0?s.maxMessages:-1;const m=this.subscribe(Sr(this.options.inboxPrefix),{callback:(w,S)=>{var M,B;if(((M=S==null?void 0:S.data)==null?void 0:M.length)===0&&((B=S==null?void 0:S.headers)==null?void 0:B.status)===le.NoResponders&&(w=me.errorForCode(le.NoResponders)),w){y&&(w.stack+=`
48
48
 
49
- ${g}`),b(w);return}p(null,S),s.strategy===$n.Count&&(f--,f===0&&b()),s.strategy===$n.JitterTimer&&(_(),v=setTimeout(()=>{b()},300)),s.strategy===$n.SentinelMsg&&S&&S.data.length===0&&b()}});m.requestSubject=t,m.closed.then(()=>{d()}).catch(w=>{c.stop(w)});const b=w=>{w&&c.push(()=>{throw w}),_(),m.drain().then(()=>{d()}).catch(S=>{d()})};c.iterClosed.then(()=>{_(),m==null||m.unsubscribe()}).catch(w=>{_(),m==null||m.unsubscribe()});try{this.publish(t,r,{reply:m.getSubject()})}catch(w){b(w)}let v=setTimeout(()=>{b()},s.maxWait);const _=()=>{v&&clearTimeout(v)}}else{const g=s;g.callback=p,c.iterClosed.then(()=>{f.cancel()}).catch(m=>{f.cancel(m)});const f=new _S(this.protocol.muxSubscriptions,t,g);this.protocol.request(f);try{this.publish(t,r,{reply:`${this.protocol.muxSubscriptions.baseInbox}${f.token}`,headers:s.headers})}catch(m){f.cancel(m)}}return Promise.resolve(c)}request(t,r,s={timeout:1e3,noMux:!1}){try{this._check(t,!0,!0)}catch(c){return Promise.reject(c)}const l=!this.protocol.options.noAsyncTraces;if(s.timeout=s.timeout||1e3,s.timeout<1)return Promise.reject(new me("timeout",le.InvalidOption));if(!s.noMux&&s.reply)return Promise.reject(new me("reply can only be used with noMux",le.InvalidOption));if(s.noMux){const c=s.reply?s.reply:Sr(this.options.inboxPrefix),d=st(),p=l?new Error:null,g=this.subscribe(c,{max:1,timeout:s.timeout,callback:(f,m)=>{f?(p&&f.code!==le.Timeout&&(f.stack+=`
49
+ ${y}`),b(w);return}p(null,S),s.strategy===$n.Count&&(f--,f===0&&b()),s.strategy===$n.JitterTimer&&(_(),v=setTimeout(()=>{b()},300)),s.strategy===$n.SentinelMsg&&S&&S.data.length===0&&b()}});m.requestSubject=t,m.closed.then(()=>{d()}).catch(w=>{c.stop(w)});const b=w=>{w&&c.push(()=>{throw w}),_(),m.drain().then(()=>{d()}).catch(S=>{d()})};c.iterClosed.then(()=>{_(),m==null||m.unsubscribe()}).catch(w=>{_(),m==null||m.unsubscribe()});try{this.publish(t,r,{reply:m.getSubject()})}catch(w){b(w)}let v=setTimeout(()=>{b()},s.maxWait);const _=()=>{v&&clearTimeout(v)}}else{const y=s;y.callback=p,c.iterClosed.then(()=>{f.cancel()}).catch(m=>{f.cancel(m)});const f=new SS(this.protocol.muxSubscriptions,t,y);this.protocol.request(f);try{this.publish(t,r,{reply:`${this.protocol.muxSubscriptions.baseInbox}${f.token}`,headers:s.headers})}catch(m){f.cancel(m)}}return Promise.resolve(c)}request(t,r,s={timeout:1e3,noMux:!1}){try{this._check(t,!0,!0)}catch(c){return Promise.reject(c)}const l=!this.protocol.options.noAsyncTraces;if(s.timeout=s.timeout||1e3,s.timeout<1)return Promise.reject(new me("timeout",le.InvalidOption));if(!s.noMux&&s.reply)return Promise.reject(new me("reply can only be used with noMux",le.InvalidOption));if(s.noMux){const c=s.reply?s.reply:Sr(this.options.inboxPrefix),d=st(),p=l?new Error:null,y=this.subscribe(c,{max:1,timeout:s.timeout,callback:(f,m)=>{f?(p&&f.code!==le.Timeout&&(f.stack+=`
50
50
 
51
- ${p.stack}`),g.unsubscribe(),d.reject(f)):(f=gb(m),f?(p&&(f.stack+=`
51
+ ${p.stack}`),y.unsubscribe(),d.reject(f)):(f=bb(m),f?(p&&(f.stack+=`
52
52
 
53
- ${p.stack}`),d.reject(f)):d.resolve(m))}});return g.requestSubject=t,this.protocol.publish(t,r,{reply:c,headers:s.headers}),d}else{const c=new vb(this.protocol.muxSubscriptions,t,s,l);this.protocol.request(c);try{this.publish(t,r,{reply:`${this.protocol.muxSubscriptions.baseInbox}${c.token}`,headers:s.headers})}catch(p){c.cancel(p)}const d=Promise.race([c.timer,c.deferred]);return d.catch(()=>{c.cancel()}),d}}flush(){return this.isClosed()?Promise.reject(me.errorForCode(le.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(me.errorForCode(le.ConnectionClosed)):this.isDraining()?Promise.reject(me.errorForCode(le.ConnectionDraining)):(this.draining=!0,this.protocol.drain())}isClosed(){return this.protocol.isClosed()}isDraining(){return this.draining}getServer(){const t=this.protocol.getServer();return t?t.listen:""}status(){const t=new Tt;return t.iterClosed.then(()=>{const r=this.listeners.indexOf(t);this.listeners.splice(r,1)}),this.listeners.push(t),t}get info(){return this.protocol.isClosed()?void 0:this.protocol.info}async context(){return(await this.request("$SYS.REQ.USER.INFO")).json((r,s)=>r==="time"?new Date(Date.parse(s)):s)}stats(){return{inBytes:this.protocol.inBytes,outBytes:this.protocol.outBytes,inMsgs:this.protocol.inMsgs,outMsgs:this.protocol.outMsgs}}async jetstreamManager(t={}){const r=new kE(this,t);if(t.checkAPI!==!1)try{await r.getAccountInfo()}catch(s){const l=s;throw l.code===le.NoResponders&&(l.code=le.JetStreamNotEnabled),l}return r}jetstream(t={}){return new Cd(this,t)}getServerVersion(){const t=this.info;return t?$i(t.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw me.errorForCode(le.Disconnect);const t=Date.now();return await this.flush(),Date.now()-t}get features(){return this.protocol.features}get services(){return this._services||(this._services=new DE(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(me.errorForCode(le.ConnectionClosed)):this.isDraining()?Promise.reject(me.errorForCode(le.ConnectionDraining)):this.protocol.reconnect()}}class DE{constructor(t){A(this,"nc");this.nc=t}add(t){try{return new bo(this.nc,t).start()}catch(r){return Promise.reject(r)}}client(t,r){return new dE(this.nc,t,r)}}class qE{constructor(t,r,s){A(this,"bucket");A(this,"sm");A(this,"prefixLen");this.bucket=t,this.prefixLen=r,this.sm=s}get key(){return this.sm.subject.substring(this.prefixLen)}get value(){return this.sm.data}get delta(){return 0}get created(){return this.sm.time}get revision(){return this.sm.seq}get operation(){return this.sm.header.get(tu)||"PUT"}get length(){const t=this.sm.header.get($t.MessageSizeHdr)||"";return t!==""?parseInt(t,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class BE{constructor(t,r,s){A(this,"bucket");A(this,"key");A(this,"sm");this.bucket=t,this.key=r,this.sm=s}get value(){return this.sm.data}get created(){return new Date(Ad(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){var t;return((t=this.sm.headers)==null?void 0:t.get(tu))||"PUT"}get delta(){return this.sm.info.pending}get length(){var r;const t=((r=this.sm.headers)==null?void 0:r.get($t.MessageSizeHdr))||"";return t!==""?parseInt(t,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class Nb extends OS{constructor(r,s,l){super(r.nc,s,l);A(this,"js");A(this,"monitor");this.js=r,this.monitor=null,this.sub.closed.then(()=>{this.monitor&&this.monitor.cancel()})}set info(r){this.sub.info=r}get info(){return this.sub.info}_resetOrderedConsumer(r){if(this.info===null||this.sub.isClosed())return;const s=Sr(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,s);const c=this.info;c.config.name=fi.next(),c.ordered_consumer_sequence.delivery_seq=0,c.flow_control.heartbeat_count=0,c.flow_control.fc_count=0,c.flow_control.consumer_restarts++,c.deliver=s,c.config.deliver_subject=s,c.config.deliver_policy=mt.StartSequence,c.config.opt_start_seq=r;const d={};d.stream_name=this.info.stream,d.config=c.config;const p=`${c.api.prefix}.CONSUMER.CREATE.${c.stream}`;this.js._request(p,d,{retries:-1}).then(g=>{const f=g,m=this.sub.info;m.last=f,this.info.config=f.config,this.info.name=f.name}).catch(g=>{const f=new me(`unable to recreate ordered consumer ${c.stream} at seq ${r}`,le.RequestError,g);this.sub.callback(f,{})})}_maybeSetupHbMonitoring(){var s,l;const r=((l=(s=this.info)==null?void 0:s.config)==null?void 0:l.idle_heartbeat)||0;r&&this._setupHbMonitoring(Ad(r))}_setupHbMonitoring(r,s=0){const l={cancelAfter:0,maxOut:2};s&&(l.cancelAfter=s);const c=this.sub,d=p=>{var m,b,v,_;const g=sS(409,`${Nn.IdleHeartbeatMissed}: ${p}`,this.sub.subject);if(!((m=this.info)==null?void 0:m.ordered))this.sub.callback(null,g);else{if(!this.js.nc.protocol.connected)return!1;const w=((v=(b=this.info)==null?void 0:b.ordered_consumer_sequence)==null?void 0:v.stream_seq)||0;return this._resetOrderedConsumer(w+1),(_=this.monitor)==null||_.restart(),!1}return!c.noIterator};this.monitor=new Td(r,d,l)}_checkHbOrderConsumer(r){const s=r.headers.get($t.ConsumerStalledHdr);s!==""&&this.js.nc.publish(s);const l=parseInt(r.headers.get($t.LastConsumerSeqHdr),10),c=this.info.ordered_consumer_sequence;return this.info.flow_control.heartbeat_count++,l!==c.delivery_seq&&this._resetOrderedConsumer(c.stream_seq+1),!1}_checkOrderedConsumer(r){const s=this.info.ordered_consumer_sequence,l=r.info.streamSequence,c=r.info.deliverySequence;return c!=s.delivery_seq+1?(this._resetOrderedConsumer(s.stream_seq+1),!1):(s.delivery_seq=c,s.stream_seq=l,!0)}async destroy(){this.isClosed()||await this.drain();const r=this.sub.info,s=r.config.durable_name||r.name,l=`${r.api.prefix}.CONSUMER.DELETE.${r.stream}.${s}`;await r.api._request(l)}async consumerInfo(){const r=this.sub.info,s=r.config.durable_name||r.name,l=`${r.api.prefix}.CONSUMER.INFO.${r.stream}.${s}`,c=await r.api._request(l);return r.last=c,c}}class LE extends Nb{constructor(t,r,s){super(t,r,s)}pull(t={batch:1}){const{stream:r,config:s,name:l}=this.sub.info,c=s.durable_name??l,d={};if(d.batch=t.batch||1,d.no_wait=t.no_wait||!1,(t.max_bytes??0)>0){const f=this.js.nc.features.get(Ie.JS_PULL_MAX_BYTES);if(!f.ok)throw new Error(`max_bytes is only supported on servers ${f.min} or better`);d.max_bytes=t.max_bytes}let p=0;t.expires&&t.expires>0&&(p=t.expires,d.expires=it(p));let g=0;if(t.idle_heartbeat&&t.idle_heartbeat>0&&(g=t.idle_heartbeat,d.idle_heartbeat=it(g)),g&&p===0)throw new Error("idle_heartbeat requires expires");if(g>p)throw new Error("expires must be greater than idle_heartbeat");if(this.info){this.monitor&&this.monitor.cancel(),p&&g&&(this.monitor?this.monitor._change(g,p):this._setupHbMonitoring(g,p));const f=this.info.api,m=`${f.prefix}.CONSUMER.MSG.NEXT.${r}.${c}`,b=this.sub.subject;f.nc.publish(m,f.jc.encode(d),{reply:b})}}}function zE(i,t){return i?PE(t):UE(t)}function UE(i){return(t,r)=>t?[t,null]:(t=Ps(r),t?[t,null]:[null,mo(r,i)])}function PE(i){return(t,r)=>{if(t)return[t,null];const s=Ps(r);return s!==null?[kb(s),null]:[null,mo(r,i)]}}function kb(i){if(i!==null)switch(i.code){case le.JetStream404NoMessages:case le.JetStream408RequestTimeout:return null;case le.JetStream409:return aS(i)?i:null;default:return i}return null}function IE(i){i&&i.ack()}function $E(i){const t=i.split(".");if(t.length===9&&t.splice(2,0,"_",""),t.length<11||t[0]!=="$JS"||t[1]!=="ACK")throw new Error("not js message");const r={};return r.domain=t[2]==="_"?"":t[2],r.account_hash=t[3],r.stream=t[4],r.consumer=t[5],r.deliveryCount=parseInt(t[6],10),r.redeliveryCount=r.deliveryCount,r.redelivered=r.deliveryCount>1,r.streamSequence=parseInt(t[7],10),r.deliverySequence=parseInt(t[8],10),r.timestampNanos=parseInt(t[9],10),r.pending=parseInt(t[10],10),r}class HE{constructor(t,r){A(this,"msg");A(this,"di");A(this,"didAck");A(this,"timeout");this.msg=t,this.didAck=!1,this.timeout=r}get subject(){return this.msg.subject}get sid(){return this.msg.sid}get data(){return this.msg.data}get headers(){return this.msg.headers}get info(){return this.di||(this.di=$E(this.reply)),this.di}get redelivered(){return this.info.deliveryCount>1}get reply(){return this.msg.reply||""}get seq(){return this.info.streamSequence}doAck(t){this.didAck||(this.didAck=!this.isWIP(t),this.msg.respond(t))}isWIP(t){return t.length===4&&t[0]===Va[0]&&t[1]===Va[1]&&t[2]===Va[2]&&t[3]===Va[3]}async ackAck(t){var s;t=t||{},t.timeout=t.timeout||this.timeout;const r=st();if(this.didAck)r.resolve(!1);else if(this.didAck=!0,this.msg.reply){const c=this.msg.publisher,d=!((s=c.options)!=null&&s.noAsyncTraces),p=new vb(c.muxSubscriptions,this.msg.reply,{timeout:t.timeout},d);c.request(p);try{c.publish(this.msg.reply,vy,{reply:`${c.muxSubscriptions.baseInbox}${p.token}`})}catch(g){p.cancel(g)}try{await Promise.race([p.timer,p.deferred]),r.resolve(!0)}catch(g){p.cancel(g),r.reject(g)}}else r.resolve(!1);return r}ack(){this.doAck(vy)}nak(t){let r=SE;t&&(r=Zh().encode(`-NAK ${JSON.stringify({delay:it(t)})}`)),this.doAck(r)}working(){this.doAck(Va)}next(t,r={batch:1}){const s={};s.batch=r.batch||1,s.no_wait=r.no_wait||!1,r.expires&&r.expires>0&&(s.expires=it(r.expires));const l=Hn().encode(s),c=Vs.concat(EE,AE,l),d=t?{reply:t}:void 0;this.msg.respond(c,d)}term(t=""){let r=OE;(t==null?void 0:t.length)>0&&(r=Zh().encode(`+TERM ${t}`)),this.doAck(r)}json(){return this.msg.json()}string(){return this.msg.string()}}const GE="1.30.3",FE="nats.ws";class VE{constructor(){A(this,"version");A(this,"lang");A(this,"closeError");A(this,"connected");A(this,"done");A(this,"socket");A(this,"options");A(this,"socketClosed");A(this,"encrypted");A(this,"peeked");A(this,"yields");A(this,"signal");A(this,"closedNotification");this.version=GE,this.lang=FE,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=st(),this.closedNotification=st()}async connect(t,r){const s=st();if(r.tls)return s.reject(new me("tls",le.InvalidOption)),s;this.options=r;const l=t.src;if(r.wsFactory){const{socket:c,encrypted:d}=await r.wsFactory(t.src,r);this.socket=c,this.encrypted=d}else this.encrypted=l.indexOf("wss://")===0,this.socket=new WebSocket(l);return this.socket.binaryType="arraybuffer",this.socket.onopen=()=>{this.isDiscarded()},this.socket.onmessage=c=>{if(this.isDiscarded())return;if(this.yields.push(new Uint8Array(c.data)),this.peeked){this.signal.resolve();return}const d=Vs.concat(...this.yields),p=CS(d);if(p!==""){const g=sE.exec(p);if(!g){r.debug&&console.error("!!!",Fl(d)),s.reject(new Error("unexpected response from server"));return}try{const f=JSON.parse(g[1]);rE(f,this.options),this.peeked=!0,this.connected=!0,this.signal.resolve(),s.resolve()}catch(f){s.reject(f);return}}},this.socket.onclose=c=>{if(this.isDiscarded())return;this.socketClosed=!0;let d;this.done||(c.wasClean||(d=new Error(c.reason)),this._closed(d))},this.socket.onerror=c=>{if(this.isDiscarded())return;const d=c,p=new me(d.message,le.Unknown,new Error(d.error));s.reject(p)},s}disconnect(){this._closed(void 0,!0)}async _closed(t,r=!0){if(!this.isDiscarded()&&this.connected&&!this.done){if(this.closeError=t,!t)for(;!this.socketClosed&&this.socket.bufferedAmount>0;)await Ys(100);this.done=!0;try{this.socket.close(t?1002:1e3,t?t.message:void 0)}catch{}r&&this.closedNotification.resolve(t)}}get isClosed(){return this.done}[Symbol.asyncIterator](){return this.iterate()}async*iterate(){for(;;){if(this.isDiscarded())return;this.yields.length===0&&await this.signal;const t=this.yields;this.yields=[];for(let r=0;r<t.length;r++)this.options.debug&&console.info(`> ${Fl(t[r])}`),yield t[r];if(this.done)break;this.yields.length===0&&(t.length=0,this.yields=t,this.signal=st())}}isEncrypted(){return this.connected&&this.encrypted}send(t){if(!this.isDiscarded())try{this.socket.send(t.buffer),this.options.debug&&console.info(`< ${Fl(t)}`);return}catch(r){this.options.debug&&console.error(`!!! ${Fl(t)}: ${r}`)}}close(t){return this._closed(t,!1)}closed(){return this.closedNotification}isDiscarded(){return this.done?(this.discard(),!0):!1}discard(){var t;this.done=!0;try{(t=this.socket)==null||t.close()}catch{}}}function YE(i,t){/^(.*:\/\/)(.*)/.test(i)||(typeof t=="boolean"?i=`${t===!0?"https":"http"}://${i}`:i=`https://${i}`);let s=new URL(i);const l=s.protocol.toLowerCase();l==="ws:"&&(t=!1),l==="wss:"&&(t=!0),l!=="https:"&&l!=="http"&&(i=i.replace(/^(.*:\/\/)(.*)/gm,"$2"),s=new URL(`http://${i}`));let c,d;const p=s.hostname,g=s.pathname,f=s.search||"";switch(l){case"http:":case"ws:":case"nats:":d=s.port||"80",c="ws:";break;case"https:":case"wss:":case"tls:":d=s.port||"443",c="wss:";break;default:d=s.port||t===!0?"443":"80",c=t===!0?"wss:":"ws:";break}return`${c}//${p}:${d}${g}${f}`}function KE(i={}){return AS({defaultPort:443,urlParseFn:YE,factory:()=>new VE}),Md.connect(i)}const XE=null,JE=null,QE="lt.events";function Cb(i,t){const r=i.split("."),s=t.split(".");for(let l=0;l<s.length;l++){const c=s[l];if(c===">")return!0;if(l>=r.length||c!=="*"&&c!==r[l])return!1}return r.length===s.length}const Ks=j.createContext({connected:!1,subscribe:()=>()=>{}});function ZE(){const{connected:i}=j.useContext(Ks);return{connected:i}}function u3(i,t){const{subscribe:r}=j.useContext(Ks),s=j.useRef(t);s.current=t,j.useEffect(()=>r(i,c=>s.current(c)),[r,i])}function Rd(i,t){const{subscribe:r}=j.useContext(Ks),s=j.useRef(t);s.current=t;const l=i.join(","),c=j.useMemo(()=>l.split(",").filter(Boolean),[l]);j.useEffect(()=>{const d=g=>s.current(g),p=c.map(g=>r(g,d));return()=>p.forEach(g=>g())},[r,c])}const WE=j.createContext({connected:!1,subscribe:()=>()=>{}}),e2=Zh();function t2({children:i,url:t,token:r}){const s=j.useRef(null),[l,c]=j.useState(!1),d=j.useRef(null),p=j.useRef(new Map),g=j.useRef(new Map),f=j.useCallback((_,w)=>{(async()=>{for await(const S of w)try{if(!Cb(S.subject,_))continue;const M=JSON.parse(e2.decode(S.data)),B=p.current.get(_);if(!B)continue;for(const U of B)try{U(M)}catch{}}catch{}})()},[]),m=j.useCallback(_=>{var S;const w=s.current;if(!(!w||(S=w.isClosed)!=null&&S.call(w)||g.current.has(_)))try{const M=w.subscribe(_);g.current.set(_,M),f(_,M)}catch{}},[f]),b=j.useCallback((_,w)=>{const S=p.current;return S.has(_)||S.set(_,new Set),S.get(_).add(w),m(_),()=>{const M=S.get(_);if(M&&(M.delete(w),M.size===0)){S.delete(_);const B=g.current.get(_);if(B){g.current.delete(_);try{B.unsubscribe()}catch{}}}}},[m]),v=j.useCallback(async()=>{try{if(s.current)return;const _=t||XE;if(!_){console.error("[lt-nats] no NATS WebSocket URL configured — set NATS_WS_URL on the server");return}const w=await KE({servers:_,token:r||JE||void 0,reconnect:!0,maxReconnectAttempts:-1,reconnectTimeWait:2e3});s.current=w,c(!0);for(const S of p.current.keys())m(S);(async()=>{for await(const S of w.status())S.type==="disconnect"||S.type==="error"?c(!1):S.type==="reconnect"&&c(!0)})()}catch{c(!1),d.current=setTimeout(v,3e3)}},[m]);return j.useEffect(()=>(v(),()=>{d.current&&clearTimeout(d.current);for(const _ of g.current.values())try{_.unsubscribe()}catch{}g.current.clear(),s.current&&(s.current.close().catch(()=>{}),s.current=null),c(!1)}),[v]),y.jsx(WE.Provider,{value:{connected:l,subscribe:b},children:y.jsx(Ks.Provider,{value:{connected:l,subscribe:b},children:i})})}const Zn=Object.create(null);Zn.open="0";Zn.close="1";Zn.ping="2";Zn.pong="3";Zn.message="4";Zn.upgrade="5";Zn.noop="6";const Hc=Object.create(null);Object.keys(Zn).forEach(i=>{Hc[Zn[i]]=i});const hd={type:"error",data:"parser error"},Mb=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Rb=typeof ArrayBuffer=="function",Db=i=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(i):i&&i.buffer instanceof ArrayBuffer,Dd=({type:i,data:t},r,s)=>Mb&&t instanceof Blob?r?s(t):_y(t,s):Rb&&(t instanceof ArrayBuffer||Db(t))?r?s(t):_y(new Blob([t]),s):s(Zn[i]+(t||"")),_y=(i,t)=>{const r=new FileReader;return r.onload=function(){const s=r.result.split(",")[1];t("b"+(s||""))},r.readAsDataURL(i)};function wy(i){return i instanceof Uint8Array?i:i instanceof ArrayBuffer?new Uint8Array(i):new Uint8Array(i.buffer,i.byteOffset,i.byteLength)}let Ph;function n2(i,t){if(Mb&&i.data instanceof Blob)return i.data.arrayBuffer().then(wy).then(t);if(Rb&&(i.data instanceof ArrayBuffer||Db(i.data)))return t(wy(i.data));Dd(i,!1,r=>{Ph||(Ph=new TextEncoder),t(Ph.encode(r))})}const Sy="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",io=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let i=0;i<Sy.length;i++)io[Sy.charCodeAt(i)]=i;const r2=i=>{let t=i.length*.75,r=i.length,s,l=0,c,d,p,g;i[i.length-1]==="="&&(t--,i[i.length-2]==="="&&t--);const f=new ArrayBuffer(t),m=new Uint8Array(f);for(s=0;s<r;s+=4)c=io[i.charCodeAt(s)],d=io[i.charCodeAt(s+1)],p=io[i.charCodeAt(s+2)],g=io[i.charCodeAt(s+3)],m[l++]=c<<2|d>>4,m[l++]=(d&15)<<4|p>>2,m[l++]=(p&3)<<6|g&63;return f},i2=typeof ArrayBuffer=="function",qd=(i,t)=>{if(typeof i!="string")return{type:"message",data:qb(i,t)};const r=i.charAt(0);return r==="b"?{type:"message",data:s2(i.substring(1),t)}:Hc[r]?i.length>1?{type:Hc[r],data:i.substring(1)}:{type:Hc[r]}:hd},s2=(i,t)=>{if(i2){const r=r2(i);return qb(r,t)}else return{base64:!0,data:i}},qb=(i,t)=>{switch(t){case"blob":return i instanceof Blob?i:new Blob([i]);case"arraybuffer":default:return i instanceof ArrayBuffer?i:i.buffer}},Bb="",a2=(i,t)=>{const r=i.length,s=new Array(r);let l=0;i.forEach((c,d)=>{Dd(c,!1,p=>{s[d]=p,++l===r&&t(s.join(Bb))})})},o2=(i,t)=>{const r=i.split(Bb),s=[];for(let l=0;l<r.length;l++){const c=qd(r[l],t);if(s.push(c),c.type==="error")break}return s};function l2(){return new TransformStream({transform(i,t){n2(i,r=>{const s=r.length;let l;if(s<126)l=new Uint8Array(1),new DataView(l.buffer).setUint8(0,s);else if(s<65536){l=new Uint8Array(3);const c=new DataView(l.buffer);c.setUint8(0,126),c.setUint16(1,s)}else{l=new Uint8Array(9);const c=new DataView(l.buffer);c.setUint8(0,127),c.setBigUint64(1,BigInt(s))}i.data&&typeof i.data!="string"&&(l[0]|=128),t.enqueue(l),t.enqueue(r)})}})}let Ih;function Xl(i){return i.reduce((t,r)=>t+r.length,0)}function Jl(i,t){if(i[0].length===t)return i.shift();const r=new Uint8Array(t);let s=0;for(let l=0;l<t;l++)r[l]=i[0][s++],s===i[0].length&&(i.shift(),s=0);return i.length&&s<i[0].length&&(i[0]=i[0].slice(s)),r}function c2(i,t){Ih||(Ih=new TextDecoder);const r=[];let s=0,l=-1,c=!1;return new TransformStream({transform(d,p){for(r.push(d);;){if(s===0){if(Xl(r)<1)break;const g=Jl(r,1);c=(g[0]&128)===128,l=g[0]&127,l<126?s=3:l===126?s=1:s=2}else if(s===1){if(Xl(r)<2)break;const g=Jl(r,2);l=new DataView(g.buffer,g.byteOffset,g.length).getUint16(0),s=3}else if(s===2){if(Xl(r)<8)break;const g=Jl(r,8),f=new DataView(g.buffer,g.byteOffset,g.length),m=f.getUint32(0);if(m>Math.pow(2,21)-1){p.enqueue(hd);break}l=m*Math.pow(2,32)+f.getUint32(4),s=3}else{if(Xl(r)<l)break;const g=Jl(r,l);p.enqueue(qd(c?g:Ih.decode(g),t)),s=0}if(l===0||l>i){p.enqueue(hd);break}}}})}const Lb=4;function _t(i){if(i)return u2(i)}function u2(i){for(var t in _t.prototype)i[t]=_t.prototype[t];return i}_t.prototype.on=_t.prototype.addEventListener=function(i,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+i]=this._callbacks["$"+i]||[]).push(t),this};_t.prototype.once=function(i,t){function r(){this.off(i,r),t.apply(this,arguments)}return r.fn=t,this.on(i,r),this};_t.prototype.off=_t.prototype.removeListener=_t.prototype.removeAllListeners=_t.prototype.removeEventListener=function(i,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var r=this._callbacks["$"+i];if(!r)return this;if(arguments.length==1)return delete this._callbacks["$"+i],this;for(var s,l=0;l<r.length;l++)if(s=r[l],s===t||s.fn===t){r.splice(l,1);break}return r.length===0&&delete this._callbacks["$"+i],this};_t.prototype.emit=function(i){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),r=this._callbacks["$"+i],s=1;s<arguments.length;s++)t[s-1]=arguments[s];if(r){r=r.slice(0);for(var s=0,l=r.length;s<l;++s)r[s].apply(this,t)}return this};_t.prototype.emitReserved=_t.prototype.emit;_t.prototype.listeners=function(i){return this._callbacks=this._callbacks||{},this._callbacks["$"+i]||[]};_t.prototype.hasListeners=function(i){return!!this.listeners(i).length};const du=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,r)=>r(t,0),kn=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),f2="arraybuffer";function zb(i,...t){return t.reduce((r,s)=>(i.hasOwnProperty(s)&&(r[s]=i[s]),r),{})}const h2=kn.setTimeout,d2=kn.clearTimeout;function mu(i,t){t.useNativeTimers?(i.setTimeoutFn=h2.bind(kn),i.clearTimeoutFn=d2.bind(kn)):(i.setTimeoutFn=kn.setTimeout.bind(kn),i.clearTimeoutFn=kn.clearTimeout.bind(kn))}const m2=1.33;function p2(i){return typeof i=="string"?g2(i):Math.ceil((i.byteLength||i.size)*m2)}function g2(i){let t=0,r=0;for(let s=0,l=i.length;s<l;s++)t=i.charCodeAt(s),t<128?r+=1:t<2048?r+=2:t<55296||t>=57344?r+=3:(s++,r+=4);return r}function Ub(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function y2(i){let t="";for(let r in i)i.hasOwnProperty(r)&&(t.length&&(t+="&"),t+=encodeURIComponent(r)+"="+encodeURIComponent(i[r]));return t}function b2(i){let t={},r=i.split("&");for(let s=0,l=r.length;s<l;s++){let c=r[s].split("=");t[decodeURIComponent(c[0])]=decodeURIComponent(c[1])}return t}class v2 extends Error{constructor(t,r,s){super(t),this.description=r,this.context=s,this.type="TransportError"}}class Bd extends _t{constructor(t){super(),this.writable=!1,mu(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,r,s){return super.emitReserved("error",new v2(t,r,s)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const r=qd(t,this.socket.binaryType);this.onPacket(r)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,r={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(r)}_hostname(){const t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){const r=y2(t);return r.length?"?"+r:""}}class x2 extends Bd{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";const r=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let s=0;this._polling&&(s++,this.once("pollComplete",function(){--s||r()})),this.writable||(s++,this.once("drain",function(){--s||r()}))}else r()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const r=s=>{if(this.readyState==="opening"&&s.type==="open"&&this.onOpen(),s.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(s)};o2(t,this.socket.binaryType).forEach(r),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,a2(t,r=>{this.doWrite(r,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",r=this.query||{};return this.opts.timestampRequests!==!1&&(r[this.opts.timestampParam]=Ub()),!this.supportsBinary&&!r.sid&&(r.b64=1),this.createUri(t,r)}}let Pb=!1;try{Pb=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const _2=Pb;function w2(){}class S2 extends x2{constructor(t){if(super(t),typeof location<"u"){const r=location.protocol==="https:";let s=location.port;s||(s=r?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||s!==t.port}}doWrite(t,r){const s=this.request({method:"POST",data:t});s.on("success",r),s.on("error",(l,c)=>{this.onError("xhr post error",l,c)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(r,s)=>{this.onError("xhr poll error",r,s)}),this.pollXhr=t}}class Qn extends _t{constructor(t,r,s){super(),this.createRequest=t,mu(this,s),this._opts=s,this._method=s.method||"GET",this._uri=r,this._data=s.data!==void 0?s.data:null,this._create()}_create(){var t;const r=zb(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");r.xdomain=!!this._opts.xd;const s=this._xhr=this.createRequest(r);try{s.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){s.setDisableHeaderCheck&&s.setDisableHeaderCheck(!0);for(let l in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(l)&&s.setRequestHeader(l,this._opts.extraHeaders[l])}}catch{}if(this._method==="POST")try{s.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{s.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(s),"withCredentials"in s&&(s.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(s.timeout=this._opts.requestTimeout),s.onreadystatechange=()=>{var l;s.readyState===3&&((l=this._opts.cookieJar)===null||l===void 0||l.parseCookies(s.getResponseHeader("set-cookie"))),s.readyState===4&&(s.status===200||s.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof s.status=="number"?s.status:0)},0))},s.send(this._data)}catch(l){this.setTimeoutFn(()=>{this._onError(l)},0);return}typeof document<"u"&&(this._index=Qn.requestsCount++,Qn.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=w2,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Qn.requests[this._index],this._xhr=null}}_onLoad(){const t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}Qn.requestsCount=0;Qn.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Ey);else if(typeof addEventListener=="function"){const i="onpagehide"in kn?"pagehide":"unload";addEventListener(i,Ey,!1)}}function Ey(){for(let i in Qn.requests)Qn.requests.hasOwnProperty(i)&&Qn.requests[i].abort()}const E2=(function(){const i=Ib({xdomain:!1});return i&&i.responseType!==null})();class O2 extends S2{constructor(t){super(t);const r=t&&t.forceBase64;this.supportsBinary=E2&&!r}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new Qn(Ib,this.uri(),t)}}function Ib(i){const t=i.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||_2))return new XMLHttpRequest}catch{}if(!t)try{return new kn[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const $b=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class A2 extends Bd{get name(){return"websocket"}doOpen(){const t=this.uri(),r=this.opts.protocols,s=$b?{}:zb(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(s.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,r,s)}catch(l){return this.emitReserved("error",l)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let r=0;r<t.length;r++){const s=t[r],l=r===t.length-1;Dd(s,this.supportsBinary,c=>{try{this.doWrite(s,c)}catch{}l&&du(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",r=this.query||{};return this.opts.timestampRequests&&(r[this.opts.timestampParam]=Ub()),this.supportsBinary||(r.b64=1),this.createUri(t,r)}}const $h=kn.WebSocket||kn.MozWebSocket;class j2 extends A2{createSocket(t,r,s){return $b?new $h(t,r,s):r?new $h(t,r):new $h(t)}doWrite(t,r){this.ws.send(r)}}class T2 extends Bd{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{const r=c2(Number.MAX_SAFE_INTEGER,this.socket.binaryType),s=t.readable.pipeThrough(r).getReader(),l=l2();l.readable.pipeTo(t.writable),this._writer=l.writable.getWriter();const c=()=>{s.read().then(({done:p,value:g})=>{p||(this.onPacket(g),c())}).catch(p=>{})};c();const d={type:"open"};this.query.sid&&(d.data=`{"sid":"${this.query.sid}"}`),this._writer.write(d).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let r=0;r<t.length;r++){const s=t[r],l=r===t.length-1;this._writer.write(s).then(()=>{l&&du(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const N2={websocket:j2,webtransport:T2,polling:O2},k2=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,C2=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function dd(i){if(i.length>8e3)throw"URI too long";const t=i,r=i.indexOf("["),s=i.indexOf("]");r!=-1&&s!=-1&&(i=i.substring(0,r)+i.substring(r,s).replace(/:/g,";")+i.substring(s,i.length));let l=k2.exec(i||""),c={},d=14;for(;d--;)c[C2[d]]=l[d]||"";return r!=-1&&s!=-1&&(c.source=t,c.host=c.host.substring(1,c.host.length-1).replace(/;/g,":"),c.authority=c.authority.replace("[","").replace("]","").replace(/;/g,":"),c.ipv6uri=!0),c.pathNames=M2(c,c.path),c.queryKey=R2(c,c.query),c}function M2(i,t){const r=/\/{2,9}/g,s=t.replace(r,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&s.splice(0,1),t.slice(-1)=="/"&&s.splice(s.length-1,1),s}function R2(i,t){const r={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(s,l,c){l&&(r[l]=c)}),r}const md=typeof addEventListener=="function"&&typeof removeEventListener=="function",Gc=[];md&&addEventListener("offline",()=>{Gc.forEach(i=>i())},!1);class ci extends _t{constructor(t,r){if(super(),this.binaryType=f2,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(r=t,t=null),t){const s=dd(t);r.hostname=s.host,r.secure=s.protocol==="https"||s.protocol==="wss",r.port=s.port,s.query&&(r.query=s.query)}else r.host&&(r.hostname=dd(r.host).host);mu(this,r),this.secure=r.secure!=null?r.secure:typeof location<"u"&&location.protocol==="https:",r.hostname&&!r.port&&(r.port=this.secure?"443":"80"),this.hostname=r.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=r.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},r.transports.forEach(s=>{const l=s.prototype.name;this.transports.push(l),this._transportsByName[l]=s}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},r),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=b2(this.opts.query)),md&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Gc.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const r=Object.assign({},this.opts.query);r.EIO=Lb,r.transport=t,this.id&&(r.sid=this.id);const s=Object.assign({},this.opts,{query:r,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](s)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&ci.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const r=this.createTransport(t);r.open(),this.setTransport(r)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",r=>this._onClose("transport close",r))}onOpen(){this.readyState="open",ci.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const r=new Error("server error");r.code=t.data,this._onError(r);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let r=1;for(let s=0;s<this.writeBuffer.length;s++){const l=this.writeBuffer[s].data;if(l&&(r+=p2(l)),s>0&&r>this._maxPayload)return this.writeBuffer.slice(0,s);r+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,du(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,r,s){return this._sendPacket("message",t,r,s),this}send(t,r,s){return this._sendPacket("message",t,r,s),this}_sendPacket(t,r,s,l){if(typeof r=="function"&&(l=r,r=void 0),typeof s=="function"&&(l=s,s=null),this.readyState==="closing"||this.readyState==="closed")return;s=s||{},s.compress=s.compress!==!1;const c={type:t,data:r,options:s};this.emitReserved("packetCreate",c),this.writeBuffer.push(c),l&&this.once("flush",l),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},r=()=>{this.off("upgrade",r),this.off("upgradeError",r),t()},s=()=>{this.once("upgrade",r),this.once("upgradeError",r)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?s():t()}):this.upgrading?s():t()),this}_onError(t){if(ci.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,r){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),md&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const s=Gc.indexOf(this._offlineEventListener);s!==-1&&Gc.splice(s,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,r),this.writeBuffer=[],this._prevBufferLen=0}}}ci.protocol=Lb;class D2 extends ci{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let r=this.createTransport(t),s=!1;ci.priorWebsocketSuccess=!1;const l=()=>{s||(r.send([{type:"ping",data:"probe"}]),r.once("packet",b=>{if(!s)if(b.type==="pong"&&b.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",r),!r)return;ci.priorWebsocketSuccess=r.name==="websocket",this.transport.pause(()=>{s||this.readyState!=="closed"&&(m(),this.setTransport(r),r.send([{type:"upgrade"}]),this.emitReserved("upgrade",r),r=null,this.upgrading=!1,this.flush())})}else{const v=new Error("probe error");v.transport=r.name,this.emitReserved("upgradeError",v)}}))};function c(){s||(s=!0,m(),r.close(),r=null)}const d=b=>{const v=new Error("probe error: "+b);v.transport=r.name,c(),this.emitReserved("upgradeError",v)};function p(){d("transport closed")}function g(){d("socket closed")}function f(b){r&&b.name!==r.name&&c()}const m=()=>{r.removeListener("open",l),r.removeListener("error",d),r.removeListener("close",p),this.off("close",g),this.off("upgrading",f)};r.once("open",l),r.once("error",d),r.once("close",p),this.once("close",g),this.once("upgrading",f),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{s||r.open()},200):r.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const r=[];for(let s=0;s<t.length;s++)~this.transports.indexOf(t[s])&&r.push(t[s]);return r}}let q2=class extends D2{constructor(t,r={}){const s=typeof t=="object"?t:r;(!s.transports||s.transports&&typeof s.transports[0]=="string")&&(s.transports=(s.transports||["polling","websocket","webtransport"]).map(l=>N2[l]).filter(l=>!!l)),super(t,s)}};function B2(i,t="",r){let s=i;r=r||typeof location<"u"&&location,i==null&&(i=r.protocol+"//"+r.host),typeof i=="string"&&(i.charAt(0)==="/"&&(i.charAt(1)==="/"?i=r.protocol+i:i=r.host+i),/^(https?|wss?):\/\//.test(i)||(typeof r<"u"?i=r.protocol+"//"+i:i="https://"+i),s=dd(i)),s.port||(/^(http|ws)$/.test(s.protocol)?s.port="80":/^(http|ws)s$/.test(s.protocol)&&(s.port="443")),s.path=s.path||"/";const c=s.host.indexOf(":")!==-1?"["+s.host+"]":s.host;return s.id=s.protocol+"://"+c+":"+s.port+t,s.href=s.protocol+"://"+c+(r&&r.port===s.port?"":":"+s.port),s}const L2=typeof ArrayBuffer=="function",z2=i=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(i):i.buffer instanceof ArrayBuffer,Hb=Object.prototype.toString,U2=typeof Blob=="function"||typeof Blob<"u"&&Hb.call(Blob)==="[object BlobConstructor]",P2=typeof File=="function"||typeof File<"u"&&Hb.call(File)==="[object FileConstructor]";function Ld(i){return L2&&(i instanceof ArrayBuffer||z2(i))||U2&&i instanceof Blob||P2&&i instanceof File}function Fc(i,t){if(!i||typeof i!="object")return!1;if(Array.isArray(i)){for(let r=0,s=i.length;r<s;r++)if(Fc(i[r]))return!0;return!1}if(Ld(i))return!0;if(i.toJSON&&typeof i.toJSON=="function"&&arguments.length===1)return Fc(i.toJSON(),!0);for(const r in i)if(Object.prototype.hasOwnProperty.call(i,r)&&Fc(i[r]))return!0;return!1}function I2(i){const t=[],r=i.data,s=i;return s.data=pd(r,t),s.attachments=t.length,{packet:s,buffers:t}}function pd(i,t){if(!i)return i;if(Ld(i)){const r={_placeholder:!0,num:t.length};return t.push(i),r}else if(Array.isArray(i)){const r=new Array(i.length);for(let s=0;s<i.length;s++)r[s]=pd(i[s],t);return r}else if(typeof i=="object"&&!(i instanceof Date)){const r={};for(const s in i)Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=pd(i[s],t));return r}return i}function $2(i,t){return i.data=gd(i.data,t),delete i.attachments,i}function gd(i,t){if(!i)return i;if(i&&i._placeholder===!0){if(typeof i.num=="number"&&i.num>=0&&i.num<t.length)return t[i.num];throw new Error("illegal attachments")}else if(Array.isArray(i))for(let r=0;r<i.length;r++)i[r]=gd(i[r],t);else if(typeof i=="object")for(const r in i)Object.prototype.hasOwnProperty.call(i,r)&&(i[r]=gd(i[r],t));return i}const H2=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var Ue;(function(i){i[i.CONNECT=0]="CONNECT",i[i.DISCONNECT=1]="DISCONNECT",i[i.EVENT=2]="EVENT",i[i.ACK=3]="ACK",i[i.CONNECT_ERROR=4]="CONNECT_ERROR",i[i.BINARY_EVENT=5]="BINARY_EVENT",i[i.BINARY_ACK=6]="BINARY_ACK"})(Ue||(Ue={}));class G2{constructor(t){this.replacer=t}encode(t){return(t.type===Ue.EVENT||t.type===Ue.ACK)&&Fc(t)?this.encodeAsBinary({type:t.type===Ue.EVENT?Ue.BINARY_EVENT:Ue.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let r=""+t.type;return(t.type===Ue.BINARY_EVENT||t.type===Ue.BINARY_ACK)&&(r+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(r+=t.nsp+","),t.id!=null&&(r+=t.id),t.data!=null&&(r+=JSON.stringify(t.data,this.replacer)),r}encodeAsBinary(t){const r=I2(t),s=this.encodeAsString(r.packet),l=r.buffers;return l.unshift(s),l}}class zd extends _t{constructor(t){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof t=="function"?{reviver:t}:t)}add(t){let r;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");r=this.decodeString(t);const s=r.type===Ue.BINARY_EVENT;s||r.type===Ue.BINARY_ACK?(r.type=s?Ue.EVENT:Ue.ACK,this.reconstructor=new F2(r),r.attachments===0&&super.emitReserved("decoded",r)):super.emitReserved("decoded",r)}else if(Ld(t)||t.base64)if(this.reconstructor)r=this.reconstructor.takeBinaryData(t),r&&(this.reconstructor=null,super.emitReserved("decoded",r));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let r=0;const s={type:Number(t.charAt(0))};if(Ue[s.type]===void 0)throw new Error("unknown packet type "+s.type);if(s.type===Ue.BINARY_EVENT||s.type===Ue.BINARY_ACK){const c=r+1;for(;t.charAt(++r)!=="-"&&r!=t.length;);const d=t.substring(c,r);if(d!=Number(d)||t.charAt(r)!=="-")throw new Error("Illegal attachments");const p=Number(d);if(!V2(p)||p<0)throw new Error("Illegal attachments");if(p>this.opts.maxAttachments)throw new Error("too many attachments");s.attachments=p}if(t.charAt(r+1)==="/"){const c=r+1;for(;++r&&!(t.charAt(r)===","||r===t.length););s.nsp=t.substring(c,r)}else s.nsp="/";const l=t.charAt(r+1);if(l!==""&&Number(l)==l){const c=r+1;for(;++r;){const d=t.charAt(r);if(d==null||Number(d)!=d){--r;break}if(r===t.length)break}s.id=Number(t.substring(c,r+1))}if(t.charAt(++r)){const c=this.tryParse(t.substr(r));if(zd.isPayloadValid(s.type,c))s.data=c;else throw new Error("invalid payload")}return s}tryParse(t){try{return JSON.parse(t,this.opts.reviver)}catch{return!1}}static isPayloadValid(t,r){switch(t){case Ue.CONNECT:return Oy(r);case Ue.DISCONNECT:return r===void 0;case Ue.CONNECT_ERROR:return typeof r=="string"||Oy(r);case Ue.EVENT:case Ue.BINARY_EVENT:return Array.isArray(r)&&(typeof r[0]=="number"||typeof r[0]=="string"&&H2.indexOf(r[0])===-1);case Ue.ACK:case Ue.BINARY_ACK:return Array.isArray(r)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class F2{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const r=$2(this.reconPack,this.buffers);return this.finishedReconstruction(),r}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const V2=Number.isInteger||function(i){return typeof i=="number"&&isFinite(i)&&Math.floor(i)===i};function Oy(i){return Object.prototype.toString.call(i)==="[object Object]"}const Y2=Object.freeze(Object.defineProperty({__proto__:null,Decoder:zd,Encoder:G2,get PacketType(){return Ue}},Symbol.toStringTag,{value:"Module"}));function Pn(i,t,r){return i.on(t,r),function(){i.off(t,r)}}const K2=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Gb extends _t{constructor(t,r,s){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=r,s&&s.auth&&(this.auth=s.auth),this._opts=Object.assign({},s),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[Pn(t,"open",this.onopen.bind(this)),Pn(t,"packet",this.onpacket.bind(this)),Pn(t,"error",this.onerror.bind(this)),Pn(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...r){var s,l,c;if(K2.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(r.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(r),this;const d={type:Ue.EVENT,data:r};if(d.options={},d.options.compress=this.flags.compress!==!1,typeof r[r.length-1]=="function"){const m=this.ids++,b=r.pop();this._registerAckCallback(m,b),d.id=m}const p=(l=(s=this.io.engine)===null||s===void 0?void 0:s.transport)===null||l===void 0?void 0:l.writable,g=this.connected&&!(!((c=this.io.engine)===null||c===void 0)&&c._hasPingExpired());return this.flags.volatile&&!p||(g?(this.notifyOutgoingListeners(d),this.packet(d)):this.sendBuffer.push(d)),this.flags={},this}_registerAckCallback(t,r){var s;const l=(s=this.flags.timeout)!==null&&s!==void 0?s:this._opts.ackTimeout;if(l===void 0){this.acks[t]=r;return}const c=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let p=0;p<this.sendBuffer.length;p++)this.sendBuffer[p].id===t&&this.sendBuffer.splice(p,1);r.call(this,new Error("operation has timed out"))},l),d=(...p)=>{this.io.clearTimeoutFn(c),r.apply(this,p)};d.withError=!0,this.acks[t]=d}emitWithAck(t,...r){return new Promise((s,l)=>{const c=(d,p)=>d?l(d):s(p);c.withError=!0,r.push(c),this.emit(t,...r)})}_addToQueue(t){let r;typeof t[t.length-1]=="function"&&(r=t.pop());const s={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((l,...c)=>(this._queue[0],l!==null?s.tryCount>this._opts.retries&&(this._queue.shift(),r&&r(l)):(this._queue.shift(),r&&r(null,...c)),s.pending=!1,this._drainQueue())),this._queue.push(s),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const r=this._queue[0];r.pending&&!t||(r.pending=!0,r.tryCount++,this.flags=r.flags,this.emit.apply(this,r.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:Ue.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,r){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,r),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(s=>String(s.id)===t)){const s=this.acks[t];delete this.acks[t],s.withError&&s.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case Ue.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Ue.EVENT:case Ue.BINARY_EVENT:this.onevent(t);break;case Ue.ACK:case Ue.BINARY_ACK:this.onack(t);break;case Ue.DISCONNECT:this.ondisconnect();break;case Ue.CONNECT_ERROR:this.destroy();const s=new Error(t.data.message);s.data=t.data.data,this.emitReserved("connect_error",s);break}}onevent(t){const r=t.data||[];t.id!=null&&r.push(this.ack(t.id)),this.connected?this.emitEvent(r):this.receiveBuffer.push(Object.freeze(r))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const r=this._anyListeners.slice();for(const s of r)s.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const r=this;let s=!1;return function(...l){s||(s=!0,r.packet({type:Ue.ACK,id:t,data:l}))}}onack(t){const r=this.acks[t.id];typeof r=="function"&&(delete this.acks[t.id],r.withError&&t.data.unshift(null),r.apply(this,t.data))}onconnect(t,r){this.id=t,this.recovered=r&&this._pid===r,this._pid=r,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Ue.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const r=this._anyListeners;for(let s=0;s<r.length;s++)if(t===r[s])return r.splice(s,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const r=this._anyOutgoingListeners;for(let s=0;s<r.length;s++)if(t===r[s])return r.splice(s,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const r=this._anyOutgoingListeners.slice();for(const s of r)s.apply(this,t.data)}}}function Xs(i){i=i||{},this.ms=i.min||100,this.max=i.max||1e4,this.factor=i.factor||2,this.jitter=i.jitter>0&&i.jitter<=1?i.jitter:0,this.attempts=0}Xs.prototype.duration=function(){var i=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),r=Math.floor(t*this.jitter*i);i=(Math.floor(t*10)&1)==0?i-r:i+r}return Math.min(i,this.max)|0};Xs.prototype.reset=function(){this.attempts=0};Xs.prototype.setMin=function(i){this.ms=i};Xs.prototype.setMax=function(i){this.max=i};Xs.prototype.setJitter=function(i){this.jitter=i};class yd extends _t{constructor(t,r){var s;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(r=t,t=void 0),r=r||{},r.path=r.path||"/socket.io",this.opts=r,mu(this,r),this.reconnection(r.reconnection!==!1),this.reconnectionAttempts(r.reconnectionAttempts||1/0),this.reconnectionDelay(r.reconnectionDelay||1e3),this.reconnectionDelayMax(r.reconnectionDelayMax||5e3),this.randomizationFactor((s=r.randomizationFactor)!==null&&s!==void 0?s:.5),this.backoff=new Xs({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(r.timeout==null?2e4:r.timeout),this._readyState="closed",this.uri=t;const l=r.parser||Y2;this.encoder=new l.Encoder,this.decoder=new l.Decoder,this._autoConnect=r.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var r;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(r=this.backoff)===null||r===void 0||r.setMin(t),this)}randomizationFactor(t){var r;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(r=this.backoff)===null||r===void 0||r.setJitter(t),this)}reconnectionDelayMax(t){var r;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(r=this.backoff)===null||r===void 0||r.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new q2(this.uri,this.opts);const r=this.engine,s=this;this._readyState="opening",this.skipReconnect=!1;const l=Pn(r,"open",function(){s.onopen(),t&&t()}),c=p=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",p),t?t(p):this.maybeReconnectOnOpen()},d=Pn(r,"error",c);if(this._timeout!==!1){const p=this._timeout,g=this.setTimeoutFn(()=>{l(),c(new Error("timeout")),r.close()},p);this.opts.autoUnref&&g.unref(),this.subs.push(()=>{this.clearTimeoutFn(g)})}return this.subs.push(l),this.subs.push(d),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Pn(t,"ping",this.onping.bind(this)),Pn(t,"data",this.ondata.bind(this)),Pn(t,"error",this.onerror.bind(this)),Pn(t,"close",this.onclose.bind(this)),Pn(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(r){this.onclose("parse error",r)}}ondecoded(t){du(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,r){let s=this.nsps[t];return s?this._autoConnect&&!s.active&&s.connect():(s=new Gb(this,t,r),this.nsps[t]=s),s}_destroy(t){const r=Object.keys(this.nsps);for(const s of r)if(this.nsps[s].active)return;this._close()}_packet(t){const r=this.encoder.encode(t);for(let s=0;s<r.length;s++)this.engine.write(r[s],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,r){var s;this.cleanup(),(s=this.engine)===null||s===void 0||s.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,r),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const r=this.backoff.duration();this._reconnecting=!0;const s=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(l=>{l?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",l)):t.onreconnect()}))},r);this.opts.autoUnref&&s.unref(),this.subs.push(()=>{this.clearTimeoutFn(s)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const Ya={};function Vc(i,t){typeof i=="object"&&(t=i,i=void 0),t=t||{};const r=B2(i,t.path||"/socket.io"),s=r.source,l=r.id,c=r.path,d=Ya[l]&&c in Ya[l].nsps,p=t.forceNew||t["force new connection"]||t.multiplex===!1||d;let g;return p?g=new yd(s,t):(Ya[l]||(Ya[l]=new yd(s,t)),g=Ya[l]),r.query&&!t.query&&(t.query=r.queryKey),g.socket(r.path,t)}Object.assign(Vc,{Manager:yd,Socket:Gb,io:Vc,connect:Vc});const X2=j.createContext({connected:!1,subscribe:()=>()=>{}});function J2({children:i}){const t=j.useRef(null),[r,s]=j.useState(!1),l=j.useRef(new Map),c=j.useCallback((p,g)=>{var m;const f=l.current;return f.has(p)||(f.set(p,new Set),(m=t.current)==null||m.emit("lt.subscribe",p)),f.get(p).add(g),()=>{var v;const b=f.get(p);b&&(b.delete(g),b.size===0&&(f.delete(p),(v=t.current)==null||v.emit("lt.unsubscribe",p)))}},[]),d=j.useCallback((p,g)=>{for(const[f,m]of l.current)if(Cb(p,f))for(const b of m)try{b(g)}catch{}},[]);return j.useEffect(()=>{const p=hb(),g=Vc({path:`${jt}/socket.io`,transports:["polling","websocket"],upgrade:!0,reconnection:!0,reconnectionAttempts:1/0,reconnectionDelay:2e3,...p?{auth:{token:p}}:{}});return t.current=g,console.log("[lt-socketio] connecting..."),g.on("connect",()=>{console.log("[lt-socketio] connected, id:",g.id),s(!0);for(const f of l.current.keys())g.emit("lt.subscribe",f)}),g.on("disconnect",f=>{console.log("[lt-socketio] disconnected:",f),s(!1)}),g.on("connect_error",f=>{console.warn("[lt-socketio] connect error:",f.message),s(!1)}),g.onAny((f,m)=>{if(f.startsWith("lt."))try{const b=typeof m=="string"?JSON.parse(m):m;d(f,b)}catch{}}),()=>{g.removeAllListeners(),g.disconnect(),t.current=null,s(!1)}},[d]),y.jsx(X2.Provider,{value:{connected:r,subscribe:c},children:y.jsx(Ks.Provider,{value:{connected:r,subscribe:c},children:i})})}function Q2({children:i}){const[t,r]=j.useState(null),[s,l]=j.useState({url:null,token:null});return j.useEffect(()=>{let c=!1;async function d(){var p;try{console.log("[lt-transport] detecting event transport...");const g=await fetch(`${jt}/api/settings`);if(!g.ok){console.warn("[lt-transport] settings fetch failed, falling back to socketio"),c||r("socketio");return}const f=await g.json(),m=(p=f==null?void 0:f.events)==null?void 0:p.transport;if(console.log("[lt-transport] server reports:",m),!c){if(m==="nats"){let b=f.events.natsWsUrl??null,v=null;const _=hb();if(_)try{const w=await fetch(`${jt}/api/nats-credentials`,{headers:{Authorization:`Bearer ${_}`}});if(w.ok){const S=await w.json();b=S.natsWsUrl??b,v=S.natsToken??null}}catch{console.warn("[lt-transport] failed to fetch NATS credentials")}l({url:b,token:v})}r(m==="nats"?"nats":"socketio")}}catch(g){console.warn("[lt-transport] settings fetch error, falling back to socketio",g),c||r("socketio")}}return d(),()=>{c=!0}},[]),t==="nats"?y.jsx(t2,{url:s.url,token:s.token,children:i}):t==="socketio"?y.jsx(J2,{children:i}):y.jsx(y.Fragment,{children:i})}const Ud="lt_view_as",Pd="lt_ai_override",bd="lt_graph_enabled",Id="lt_scan_override";function Fb(){try{const i=localStorage.getItem(Pd);if(i==="true")return!0;if(i==="false")return!1}catch{}return null}function Z2(i){try{localStorage.setItem(Pd,String(i))}catch{}}function W2(){try{localStorage.removeItem(Pd)}catch{}}function $d(){try{const i=localStorage.getItem(Ud);if(i==="admin"||i==="engineer"||i==="operator")return i}catch{}return null}function eO(i){try{localStorage.setItem(Ud,i)}catch{}window.location.reload()}function vd(){try{localStorage.removeItem(Ud)}catch{}window.location.reload()}function Vb(){try{return localStorage.getItem(bd)==="true"}catch{return!1}}function tO(i){try{i?localStorage.setItem(bd,"true"):localStorage.removeItem(bd)}catch{}}function Yb(){try{const i=localStorage.getItem(Id);if(i==="true")return!0;if(i==="false")return!1}catch{}return null}function nO(i){try{localStorage.setItem(Id,String(i))}catch{}}function rO(){try{localStorage.removeItem(Id)}catch{}}function Kb(){const{isSuperAdmin:i,hasRoleType:t,hasRole:r}=Jt(),s=$d(),l=i||r("engineer"),c=t("admin"),d=i||t("admin");return{isBuilder:s?!1:l,isOps:s?s==="admin"||s==="engineer":c,canBulk:s?s==="admin":d,viewAs:s,realIsBuilder:l}}function Xb(){var f;const{isSuperAdmin:i,hasRoleType:t,hasRole:r}=Jt(),{data:s}=Wn(),l=((f=s==null?void 0:s.features)==null?void 0:f.publicPaceBoard)!==!1,c=i?"superadmin":t("admin")?"admin":r("engineer")?"engineer":"operator",d=$d(),p=d==="admin"||d==="engineer"||d==="operator"?d:null,g=p??c;return{tier:g,realTier:c,viewAs:p,canSeePaceBoard:l||g==="superadmin"||g==="admin",canSeeWorkflows:g==="superadmin"||g==="engineer",showTaskQueueCards:g==="operator"&&!l}}function Jb(i){return(i??"").replace(/[^A-Za-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"")||"none"}function xd(i={}){const t=i.role?Jb(i.role):"*",r=i.id??"*",s=i.verb??">";return`${QE}.system.escalation.${t}.${r}.${s}`}function Ay(i){return i.verbs.map(t=>xd({role:i.role,verb:t}))}function Hd(i){const{user:t,isSuperAdmin:r,hasRoleType:s}=Jt(),l=r||s("admin"),c=((t==null?void 0:t.roles)??[]).map(p=>p.role).sort().join(","),d=(i??[]).join(",");return j.useMemo(()=>{const p=d?d.split(","):null;return l||!c?p?Ay({verbs:p}):[xd({})]:c.split(",").flatMap(g=>p?Ay({role:g,verbs:p}):[xd({role:g})])},[l,c,d])}const _d="/escalations/detail/";function iO(i){return i.startsWith(_d)&&i.slice(_d.length).split("/")[0]||void 0}function sO(){const{user:i}=Jt(),t=go(),r=pn(),s=j.useRef(r.pathname);s.current=r.pathname;const l=j.useRef(i==null?void 0:i.userId);l.current=i==null?void 0:i.userId;const c=j.useCallback(d=>{var b,v,_;if((d==null?void 0:d.assignedAtCreation)!==!0)return;const p=(d==null?void 0:d.escalationId)??((b=d==null?void 0:d.data)==null?void 0:b.id),g=(v=d==null?void 0:d.data)==null?void 0:v.assigned_to,f=(_=d==null?void 0:d.data)==null?void 0:_.parent_id;if(!p||g!==l.current||!f||f!==iO(s.current))return;const m=`${_d}${p}`;s.current!==m&&t(m)},[t]);Rd(Hd(["claimed"]),c)}function h3(){return pt({queryKey:["roles"],queryFn:()=>Ae("/roles")})}function Qb(i){return pt({queryKey:["roles","details"],queryFn:()=>Ae("/roles/details"),enabled:(i==null?void 0:i.enabled)??!0})}function d3(i,t,r=!0){return pt({queryKey:["roles",i,"schema",t??"latest"],queryFn:()=>Ae(`/roles/${encodeURIComponent(i)}/schema${t!=null?`?version=${t}`:""}`),enabled:r&&!!i})}function m3(i){return pt({queryKey:["roles",i,"schema-versions"],queryFn:()=>Ae(`/roles/${encodeURIComponent(i)}/schema/versions`),enabled:!!i})}function p3(i,t,r=!0){return pt({queryKey:["roles",i,"list-schema",t??"latest"],queryFn:()=>Ae(`/roles/${encodeURIComponent(i)}/list-schema${t!=null?`?version=${t}`:""}`),enabled:r&&!!i})}function g3(i){return pt({queryKey:["roles",i,"list-schema-versions"],queryFn:()=>Ae(`/roles/${encodeURIComponent(i)}/list-schema/versions`),enabled:!!i})}function y3(){const i=gt();return Et({mutationFn:t=>Ae("/roles",{method:"POST",body:JSON.stringify({role:t})}),onSuccess:()=>{i.invalidateQueries({queryKey:["roles"]})}})}function b3(){const i=gt();return Et({mutationFn:({role:t,...r})=>Ae(`/roles/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify(r)}),onMutate:async({role:t,...r})=>{await i.cancelQueries({queryKey:["roles","details"]});const s=i.getQueryData(["roles","details"]);return s&&i.setQueryData(["roles","details"],{roles:s.roles.map(l=>l.role===t?{...l,...r}:l)}),{previous:s}},onError:(t,r,s)=>{s!=null&&s.previous&&i.setQueryData(["roles","details"],s.previous)},onSuccess:()=>{i.invalidateQueries({queryKey:["roles"]})}})}function v3(){const i=gt();return Et({mutationFn:t=>Ae(`/roles/${encodeURIComponent(t)}`,{method:"DELETE"}),onSuccess:()=>{i.invalidateQueries({queryKey:["roles"]})}})}function aO(){const{user:i}=Jt(),{data:t}=Qb();return j.useMemo(()=>{var c,d;const r=(i==null?void 0:i.roles)??[],s=r.length===1?r[0]:null;if(!s||s.type!=="member")return{kiosk:!1,role:null,homePath:null};const l=(c=t==null?void 0:t.roles)==null?void 0:c.find(p=>p.role===s.role);return((d=l==null?void 0:l.properties)==null?void 0:d.kiosk)!==!0?{kiosk:!1,role:null,homePath:null}:{kiosk:!0,role:s.role,homePath:`/escalations/available?role=${encodeURIComponent(s.role)}&status=available`}},[i,t])}const oO=["/escalations","/scan","/login"];function lO(i){return oO.some(t=>i===t||i.startsWith(`${t}/`)||i.startsWith(`${t}?`))}const Gd=j.createContext(null),Hh="lt_sidebar_collapsed",Zb="(max-width: 1023px)";function cO(){try{return window.matchMedia(Zb).matches}catch{return!1}}function uO({children:i}){const[t,r]=j.useState(()=>{if(cO())return!0;try{return localStorage.getItem(Hh)==="true"}catch{return!1}});j.useEffect(()=>{let l;try{l=window.matchMedia(Zb)}catch{return}const c=d=>{if(d.matches)r(!0);else try{r(localStorage.getItem(Hh)==="true")}catch{r(!1)}};return l.addEventListener("change",c),()=>l.removeEventListener("change",c)},[]);const s=j.useCallback(()=>{r(l=>{const c=!l;try{localStorage.setItem(Hh,String(c))}catch{}return c})},[]);return y.jsx(Gd.Provider,{value:{collapsed:t,toggle:s},children:i})}function fO({children:i}){return y.jsx(Gd.Provider,{value:{collapsed:!1,toggle:()=>{}},children:i})}function Fd(){const i=j.useContext(Gd);if(!i)throw new Error("useSidebar must be used within SidebarProvider");return i}const jy=380,Vd=j.createContext(null);function hO({children:i}){const[t,r]=j.useState({node:null,width:jy,open:!1,ownerKey:null}),s=pn(),l=j.useRef(s.pathname),c=j.useCallback((p,g)=>{r({node:p,width:(g==null?void 0:g.width)??jy,open:!0,ownerKey:(g==null?void 0:g.key)??null})},[]),d=j.useCallback(p=>{r(g=>typeof p=="string"&&g.ownerKey!==p?g:{...g,open:!1})},[]);return j.useEffect(()=>{s.pathname!==l.current&&(l.current=s.pathname,r(p=>p.open||p.node?{...p,node:null,open:!1,ownerKey:null}:p))},[s.pathname]),y.jsx(Vd.Provider,{value:{...t,setPanel:c,closePanel:d},children:i})}function Yd(){const i=j.useContext(Vd);if(!i)throw new Error("useShellPanel must be used within ShellPanelProvider");return i}function x3(){return j.useContext(Vd)}function dO({open:i,width:t=380,children:r,className:s=""}){const[l,c]=j.useState(i);return j.useEffect(()=>{i&&c(!0)},[i]),y.jsx("div",{className:`shrink-0 overflow-hidden transition-[width] duration-300 ease-out ${s}`,style:{width:i?t:0,maxWidth:"50%"},onTransitionEnd:d=>{!i&&d.propertyName==="width"&&c(!1)},children:y.jsx("div",{style:{width:t},className:"h-full",children:l?r:null})})}function _3({label:i,children:t}){return y.jsxs("div",{children:[y.jsx("dt",{className:"text-2xs font-medium text-text-secondary uppercase tracking-wide",children:i}),y.jsx("dd",{className:"text-xs text-text-primary mt-0.5",children:t})]})}function w3({views:i,activeId:t,onViewChange:r,onClose:s,headerActions:l,stickyClassName:c,labelInline:d}){const p=i.find(g=>g.id===t)??i[0];return p?y.jsx("div",{className:"h-full bg-surface-hover",children:y.jsxs("div",{className:`flex flex-col ${c??"sticky top-0 z-10 max-h-[calc(100vh-3.5rem)]"}`,children:[y.jsxs("div",{className:`flex items-center justify-between pl-4 pr-3 shrink-0 ${d?"pt-10 pb-2":"pt-3"}`,children:[y.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[y.jsx("div",{className:"flex items-center gap-1 shrink-0",role:"radiogroup","aria-label":"Panel view",children:i.map(g=>{const f=g.icon,m=g.id===p.id;return y.jsx("button",{role:"radio","aria-checked":m,onClick:()=>r(g.id),title:g.label,className:`p-1.5 rounded-md transition-colors ${m?"bg-accent/10 text-accent":"text-accent/60 hover:text-accent hover:bg-surface-hover"}`,children:y.jsx(f,{className:"w-3.5 h-3.5"})},g.id)})}),d&&y.jsx("span",{className:"text-2xs font-semibold uppercase tracking-widest text-text-secondary truncate",children:p.label})]}),y.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[l,s&&y.jsx("button",{onClick:s,title:"Close panel",className:"p-1 rounded text-accent/60 hover:text-accent hover:bg-surface-hover transition-colors",children:y.jsx(Cn,{className:"w-3.5 h-3.5"})})]})]}),!d&&y.jsx("p",{className:"px-5 pt-2 pb-1 text-2xs font-semibold uppercase tracking-widest text-text-secondary shrink-0",children:p.label}),y.jsx("div",{className:`flex-1 overflow-y-auto px-5 ${d?"pt-4 pb-8":"pb-5 pt-1"}`,children:p.content})]})}):null}function Wb(i,t){var r,s,l,c,d;t.facets&&Object.keys(t.facets).length&&i.set("facets",JSON.stringify(t.facets)),(r=t.block)!=null&&r.length&&i.set("block",JSON.stringify(t.block)),(s=t.range)!=null&&s.length&&i.set("range",JSON.stringify(t.range)),(l=t.exists)!=null&&l.length&&i.set("exists",JSON.stringify(t.exists)),(c=t.roles)!=null&&c.length&&i.set("roles",JSON.stringify(t.roles)),(d=t.orderBy)!=null&&d.length&&i.set("orderBy",JSON.stringify(t.orderBy)),t.available!==void 0&&i.set("available",String(t.available)),t.jeopardy===!0&&i.set("jeopardy","1")}function S3(i,t){const r=i??"24h";return pt({queryKey:["stationMetrics",r],queryFn:()=>Ae(`/escalations/station-metrics?period=${r}`),staleTime:5e3,enabled:(t==null?void 0:t.enabled)??!0})}function E3(i){const t=i?`?period=${i}`:"";return pt({queryKey:["escalationStats",i],queryFn:()=>Ae(`/escalations/stats${t}`)})}function O3(){return pt({queryKey:["escalationTypes"],queryFn:()=>Ae("/escalations/types")})}function A3(i=!0){return pt({queryKey:["escalationFacetKeys"],queryFn:()=>Ae("/escalations/facet-keys"),enabled:i,staleTime:6e4})}function ev(i){const{enabled:t=!0,staleTime:r,...s}=i,l=new URLSearchParams;return s.status&&l.set("status",s.status),s.role&&l.set("role",s.role),s.type&&l.set("type",s.type),s.subtype&&l.set("subtype",s.subtype),s.assigned_to&&l.set("assigned_to",s.assigned_to),s.parent_id&&l.set("parent_id",s.parent_id),s.claimed&&l.set("claimed","true"),s.priority&&l.set("priority",String(s.priority)),s.limit&&l.set("limit",String(s.limit)),s.offset!==void 0&&l.set("offset",String(s.offset)),s.sort_by&&l.set("sort_by",s.sort_by),s.order&&l.set("order",s.order),s.search&&l.set("search",s.search),Wb(l,s),pt({queryKey:["escalations",s],queryFn:()=>Ae(`/escalations?${l}`),enabled:t,...r!==void 0?{staleTime:r}:{}})}function tv(i){const{enabled:t=!0,staleTime:r,...s}=i,l=new URLSearchParams;return s.role&&l.set("role",s.role),s.type&&l.set("type",s.type),s.subtype&&l.set("subtype",s.subtype),s.priority&&l.set("priority",String(s.priority)),s.limit&&l.set("limit",String(s.limit)),s.offset!==void 0&&l.set("offset",String(s.offset)),s.sort_by&&l.set("sort_by",s.sort_by),s.order&&l.set("order",s.order),s.search&&l.set("search",s.search),Wb(l,s),pt({queryKey:["escalations","available",s],queryFn:()=>Ae(`/escalations/available?${l}`),enabled:t,...r!==void 0?{staleTime:r}:{}})}function j3(i){return pt({queryKey:["escalations","by-workflow",i],queryFn:()=>Ae(`/escalations/by-workflow/${i}`),enabled:!!i})}function T3(i){return pt({queryKey:["escalations",i],queryFn:()=>Ae(`/escalations/${i}`),enabled:!!i})}function N3(){const i=gt();return Et({mutationFn:({id:t,durationMinutes:r})=>Ae(`/escalations/${t}/claim`,{method:"POST",body:JSON.stringify({durationMinutes:r})}),onSuccess:()=>{i.resetQueries({queryKey:["escalations"]}),i.resetQueries({queryKey:["escalationStats"]})}})}function k3(){const i=gt();return Et({mutationFn:t=>Ae(`/escalations/${t}/release`,{method:"POST"}),onSuccess:()=>{i.resetQueries({queryKey:["escalations"]}),i.resetQueries({queryKey:["escalationStats"]})}})}function C3(){const i=gt();return Et({mutationFn:({id:t,resolverPayload:r})=>Ae(`/escalations/${t}/resolve`,{method:"POST",body:JSON.stringify({resolverPayload:r})}),onSuccess:()=>{i.resetQueries({queryKey:["escalations"]}),i.resetQueries({queryKey:["escalationStats"]}),i.resetQueries({queryKey:["tasks"]}),i.resetQueries({queryKey:["jobs"]})}})}function M3(){const i=gt();return Et({mutationFn:({id:t,targetRole:r})=>Ae(`/escalations/${t}/escalate`,{method:"PATCH",body:JSON.stringify({targetRole:r})}),onSuccess:()=>{i.resetQueries({queryKey:["escalations"]}),i.resetQueries({queryKey:["escalationStats"]})}})}function R3(){const i=gt();return Et({mutationFn:({ids:t,priority:r})=>Ae("/escalations/priority",{method:"PATCH",body:JSON.stringify({ids:t,priority:r})}),onSuccess:()=>{i.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),i.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function D3(){const i=gt();return Et({mutationFn:({ids:t,durationMinutes:r})=>Ae("/escalations/bulk-claim",{method:"POST",body:JSON.stringify({ids:t,durationMinutes:r})}),onSuccess:()=>{i.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),i.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function q3(){const i=gt();return Et({mutationFn:({ids:t,targetUserId:r,durationMinutes:s})=>Ae("/escalations/bulk-assign",{method:"POST",body:JSON.stringify({ids:t,targetUserId:r,durationMinutes:s})}),onSuccess:()=>{i.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),i.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function B3(){const i=gt();return Et({mutationFn:({ids:t,hint:r})=>Ae("/escalations/bulk-triage",{method:"POST",body:JSON.stringify({ids:t,...r?{hint:r}:{}})}),onSuccess:()=>{i.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),i.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function L3(){const i=gt();return Et({mutationFn:t=>Ae(`/escalations/${t}/cancel`,{method:"POST"}),onSuccess:()=>{i.resetQueries({queryKey:["escalations"]}),i.resetQueries({queryKey:["escalationStats"]})}})}function z3(){const i=gt();return Et({mutationFn:({ids:t})=>Ae("/escalations/bulk-cancel",{method:"POST",body:JSON.stringify({ids:t})}),onSuccess:()=>{i.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),i.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function mO(){const{user:i}=Jt(),t=i==null?void 0:i.userId,r=gt(),s=j.useRef(null),l=j.useCallback(()=>{s.current||(s.current=setTimeout(()=>{s.current=null,r.invalidateQueries({queryKey:["escalations"]})},15e3))},[r]);Rd(Hd(),l);const{data:c}=tv({limit:1}),{data:d}=ev({assigned_to:t,status:"pending",limit:1});return{available:(c==null?void 0:c.total)??0,mine:(d==null?void 0:d.total)??0}}function nu({size:i="sm",hideLabel:t=!1,className:r="",appName:s="LongTail",variant:l="full"}){const c=i==="lg";if(l==="comet")return y.jsx("div",{className:`relative overflow-visible ${r}`,style:{width:"2.5rem",height:"2.5rem",flexShrink:0},children:y.jsx("span",{role:"img","aria-label":s,className:"logo-mark absolute pointer-events-none select-none",style:{"--logo-url":`url(${jt}/logo512.png)`,width:"82px",height:"82px",top:"-12px",left:"-80px",transform:"rotate(232deg)",zIndex:-1,opacity:.55}})});if(l==="mark")return y.jsx("div",{className:`flex items-center ${r}`,children:y.jsx("span",{role:"img","aria-label":s,className:"logo-mark shrink-0 w-7 h-7",style:{"--logo-url":`url(${jt}/logo512.png)`}})});const d=c?"w-[16rem] h-[16rem] -rotate-[120deg] opacity-55 -ml-10":"w-[12.5rem] h-[12.5rem] -rotate-[120deg] opacity-55 -ml-8",p=c?"text-[44px] font-normal text-text-primary tracking-[0.15em] -ml-[12.5rem]":"text-[36px] font-normal text-text-primary tracking-[0.15em] -ml-[9.75rem]";return y.jsxs("div",{className:`flex items-center ${r}`,style:{height:"50px"},children:[y.jsx("span",{role:"img","aria-label":s,className:`logo-mark shrink-0 z-0 ${d}`,style:{"--logo-url":`url(${jt}/logo512.png)`}}),y.jsx("span",{className:`z-[1] transition-opacity duration-300 ${p} ${t?"opacity-0":""}`,children:s})]})}const pO=[{id:null,label:"Your view",description:"Full access based on your account role",minTier:"operator"},{id:"admin",label:"Admin",description:"Pace Board + identity management",minTier:"superadmin"},{id:"engineer",label:"Engineer",description:"Work queue + identity management",minTier:"admin"},{id:"operator",label:"Operator",description:"Escalation queue only",minTier:"engineer"}],gO=["operator","engineer","admin","superadmin"];function Ty(i){return gO.indexOf(i)}function yO(i,t){return Ty(i)>=Ty(t)}function bO({onClose:i}){var ae,de,Oe,oe,je,Se,Ne;const{isSuperAdmin:t,hasRoleType:r,hasRole:s}=Jt(),{data:l}=Wn(),c=$d(),d=!!((ae=l==null?void 0:l.ai)!=null&&ae.enabled),p=Fb(),g=p!==null?p:d,[f,m]=j.useState(g),b=(de=l==null?void 0:l.features)==null?void 0:de.graphWorkflows,v=b==null,[_,w]=j.useState(b===!0||v&&Vb()),S=!!((Oe=l==null?void 0:l.features)!=null&&Oe.scanCodes),M=Yb(),[B,U]=j.useState(M!==null?M:S),ie=t?"superadmin":r("admin")?"admin":s("engineer")?"engineer":"operator",ce=((oe=l==null?void 0:l.branding)==null?void 0:oe.appName)??"LongTail",C=(je=l==null?void 0:l.environment)==null?void 0:je.longTailVersion,z=(Se=l==null?void 0:l.environment)==null?void 0:Se.hotmeshVersion,re=(Ne=l==null?void 0:l.environment)==null?void 0:Ne.nodeEnv;j.useEffect(()=>{const be=at=>{at.key==="Escape"&&i()};return document.addEventListener("keydown",be),()=>document.removeEventListener("keydown",be)},[i]);const X=pO.filter(be=>yO(ie,be.minTier)),L=X.length>1,G=[...L?[{id:"viewas",label:"View As",icon:iw}]:[],{id:"features",label:"Features",icon:sw}],[W,Q]=j.useState(G[0].id),he=be=>{be===null?vd():eO(be)},_e=()=>{const be=!f;m(be),be===d?W2():Z2(be),window.location.reload()},Te=()=>{const be=!_;w(be),tO(be),window.location.reload()},Y=()=>{const be=!B;U(be),be===S?rO():nO(be),window.location.reload()};return y.jsx("div",{className:"fixed inset-0 z-[100] bg-surface-sunken/75 backdrop-blur-sm flex items-center justify-center",onClick:i,children:y.jsxs("div",{className:"relative w-[440px] max-h-[85vh] overflow-y-auto bg-surface-raised px-12 py-10",onClick:be=>be.stopPropagation(),children:[y.jsx("button",{onClick:i,className:"absolute top-4 right-4 text-text-quaternary hover:text-text-secondary transition-colors p-1","aria-label":"Close",children:y.jsx(Cn,{className:"w-4 h-4",strokeWidth:1.5})}),y.jsxs("div",{className:"flex flex-col items-center gap-3 pb-8",children:[y.jsx("span",{className:"logo-mark block w-20 h-20 opacity-50",style:{"--logo-url":`url(${jt}/logo512.png)`}}),y.jsxs("div",{className:"text-center",children:[y.jsx("p",{className:"text-2xl font-light text-text-primary tracking-[0.12em]",children:ce}),C&&y.jsxs("p",{className:"mt-1 text-2xs text-text-tertiary",children:["v",C,z&&y.jsxs(y.Fragment,{children:[" · HotMesh v",z]}),re&&re!=="production"&&y.jsx("span",{className:"ml-1 text-status-warning",children:re})]})]})]}),y.jsx("hr",{className:"border-surface-border/50 mb-6"}),G.length>1&&y.jsx("div",{className:"flex items-center justify-center gap-2 mb-8",role:"tablist",children:G.map(be=>{const at=W===be.id;return y.jsxs("button",{role:"tab","aria-selected":at,onClick:()=>Q(be.id),title:be.label,className:`flex flex-col items-center gap-1.5 px-5 py-2.5 rounded-lg transition-colors ${at?"bg-accent/10 text-accent":"text-text-tertiary hover:text-text-secondary hover:bg-surface-hover"}`,children:[y.jsx(be.icon,{className:"w-5 h-5",strokeWidth:1.5,...at?{fill:"currentColor",fillOpacity:.15}:{}}),y.jsx("span",{className:"text-2xs font-medium",children:be.label})]},be.id)})}),W==="viewas"&&L&&y.jsxs("div",{className:"space-y-1",children:[y.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-4",children:"View As"}),X.map(be=>{const at=c===be.id,Ht=be.id===null?`Your view · ${ie}`:be.label;return y.jsxs("button",{onClick:()=>he(be.id),className:"w-full text-left flex items-start gap-3 py-2.5 px-1 group",children:[y.jsx("span",{className:`mt-0.5 w-4 h-4 rounded-full border shrink-0 flex items-center justify-center transition-colors ${at?"border-accent bg-accent":"border-surface-border group-hover:border-accent/60"}`,children:at&&y.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-text-inverse"})}),y.jsxs("span",{children:[y.jsx("span",{className:`block text-sm font-medium transition-colors ${at?"text-accent":"text-text-primary group-hover:text-accent"}`,children:Ht}),y.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:be.description})]})]},String(be.id))})]}),W==="features"&&y.jsxs("div",{children:[y.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-4",children:"Features"}),y.jsxs("button",{onClick:_e,className:"w-full text-left flex items-center justify-between py-2.5 px-1 group",children:[y.jsxs("span",{children:[y.jsx("span",{className:"block text-sm font-medium text-text-primary group-hover:text-accent transition-colors",children:"AI features"}),y.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:f?"Enabled — AI assist, agent labels, bulk AI actions":"Hidden — automation labels, no AI surfaces"})]}),y.jsx("span",{className:`shrink-0 ml-4 w-9 h-5 rounded-full transition-colors flex items-center px-0.5 ${f?"bg-accent":"bg-surface-border"}`,children:y.jsx("span",{className:`w-4 h-4 rounded-full bg-text-inverse shadow-sm transition-transform ${f?"translate-x-4":"translate-x-0"}`})})]}),v&&y.jsxs("button",{onClick:Te,className:"w-full text-left flex items-center justify-between py-2.5 px-1 group",children:[y.jsxs("span",{children:[y.jsx("span",{className:"block text-sm font-medium text-text-primary group-hover:text-accent transition-colors",children:"Graph workflows"}),y.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:_?"Visible — Graph section shown in Orchestrate sidebar":"Hidden — use Procedural workflows instead"})]}),y.jsx("span",{className:`shrink-0 ml-4 w-9 h-5 rounded-full transition-colors flex items-center px-0.5 ${_?"bg-accent":"bg-surface-border"}`,children:y.jsx("span",{className:`w-4 h-4 rounded-full bg-text-inverse shadow-sm transition-transform ${_?"translate-x-4":"translate-x-0"}`})})]}),y.jsxs("button",{onClick:Y,className:"w-full text-left flex items-center justify-between py-2.5 px-1 group",children:[y.jsxs("span",{children:[y.jsx("span",{className:"block text-sm font-medium text-text-primary group-hover:text-accent transition-colors",children:"Scan input"}),y.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:B?"Enabled — header scan affordance, panel, and keyboard-wedge capture":"Hidden — the deployment opts in with features.scanCodes"})]}),y.jsx("span",{className:`shrink-0 ml-4 w-9 h-5 rounded-full transition-colors flex items-center px-0.5 ${B?"bg-accent":"bg-surface-border"}`,children:y.jsx("span",{className:`w-4 h-4 rounded-full bg-text-inverse shadow-sm transition-transform ${B?"translate-x-4":"translate-x-0"}`})})]})]}),y.jsx("hr",{className:"border-surface-border/50 mt-8"}),y.jsx("p",{className:"mt-4 text-2xs text-text-quaternary text-center",children:"Esc or click outside to close"})]})})}const nv=[{id:"violet",label:"Violet",swatch:"#7B3BE0"},{id:"red",label:"Brick",swatch:"#DC382D"},{id:"green",label:"Emerald",swatch:"#059669"},{id:"blue",label:"Electric",swatch:"#2563EB"},{id:"rose",label:"Raspberry",swatch:"#D6246E"},{id:"orange",label:"Harvest",swatch:"#E85D04"}],Ny="blue",rv="lt.theme";let iv=[];function vO(i){const t=new Set(nv.map(s=>s.id)),r=new Set;iv=i.filter(s=>!(s!=null&&s.id)||t.has(s.id)||r.has(s.id)?!1:(r.add(s.id),!0))}function xO(){return[...nv,...iv]}function sv(){try{return localStorage.getItem(rv)||Ny}catch{return Ny}}function av(i){document.documentElement.dataset.theme=i}function _O(i){try{localStorage.setItem(rv,i)}catch{}av(i)}const ov=j.createContext(null);function wO(){const i=j.useContext(ov);if(!i)throw new Error("useActingIdentity must be used within ActingIdentityProvider");return i}function SO({children:i}){const[t,r]=j.useState(null),s=j.useRef(t);s.current=t,j.useEffect(()=>{if(!(t!=null&&t.expiresAt))return;const g=new Date(t.expiresAt).getTime()-Date.now();if(g<=0){r(null);return}const f=setTimeout(()=>r(null),g);return()=>clearTimeout(f)},[t]);const l=j.useCallback(g=>{var m;if(!g.actingToken||!g.actor)return null;const f=((m=s.current)==null?void 0:m.actingToken)??null;return r({actingToken:g.actingToken,actorId:g.actor.id,displayName:g.actor.displayName,expiresAt:g.expiresAt??null}),f},[]),c=j.useCallback(()=>r(null),[]);j.useEffect(()=>(Kg(()=>{var g;return((g=s.current)==null?void 0:g.actingToken)??null}),Xg(c),()=>{Kg(null),Xg(null)}),[c]);const d=j.useCallback(()=>{var f;const g=(f=s.current)==null?void 0:f.expiresAt;return g?Math.max(0,Math.floor((new Date(g).getTime()-Date.now())/1e3)):0},[]),p=j.useMemo(()=>({identity:t,prime:l,clear:c,remainingSeconds:d}),[t,l,c,d]);return y.jsx(ov.Provider,{value:p,children:i})}const Yc={maxKeyGapMs:500,terminators:["Enter","Tab"],minLength:6,autoFireQuietMs:300,autoFireMaxAvgKeyMs:50},lv="lt_scan_wedge_config";function cv(){try{const i=localStorage.getItem(lv);return i?{...Yc,...JSON.parse(i)}:Yc}catch{return Yc}}function EO(i){const t={...cv(),...i};return localStorage.setItem(lv,JSON.stringify(t)),t}const OO=[/[1-9][0-9]:[0-9]:[a-zA-Z0-9._-]+$/,/[1-9][0-9]{7,}$/];function ky(i){let t=null;for(const r of OO){const s=i.match(r);s&&(!t||s[0].length>t.length)&&(t=s[0])}return t}const AO=new Set(["Shift","CapsLock"]),Ql={suppress:!1,emit:null};function jO(i=Yc){let t={buffer:"",times:[],lastKeyMs:0};function r(){t={buffer:"",times:[],lastKeyMs:0}}function s(d){const{key:p,timeMs:g,hasModifier:f,isRepeat:m}=d;if(AO.has(p))return Ql;if(i.terminators.includes(p)){const S=ky(t.buffer);return r(),S&&S.length>=i.minLength?{suppress:!0,emit:S,consumedLength:S.length}:Ql}if(f||m||p.length!==1)return r(),Ql;const b=g-t.lastKeyMs,v=t.lastKeyMs>0&&b<=i.maxKeyGapMs,_=(v?t.buffer+p:p).slice(-128),w=(v?[...t.times,g]:[g]).slice(-128);return t={buffer:_,times:w,lastKeyMs:g},Ql}function l(){return{buffer:t.buffer}}function c(){const d=ky(t.buffer);if(!d||d.length<i.minLength)return null;const p=t.times.slice(-d.length);return p.length<2||(p[p.length-1]-p[0])/(p.length-1)>i.autoFireMaxAvgKeyMs?null:{code:d,consumedLength:d.length}}return{step:s,reset:r,snapshot:l,pendingAutoFire:c}}function TO(){const i=document.activeElement;return i instanceof HTMLInputElement?["text","search","tel","url","email","password","number"].includes(i.type)?i:null:i instanceof HTMLTextAreaElement?i:null}function NO(i,t,r){var c;const s=i instanceof HTMLInputElement?HTMLInputElement.prototype:HTMLTextAreaElement.prototype,l=(c=Object.getOwnPropertyDescriptor(s,"value"))==null?void 0:c.set;l?l.call(i,t):i.value=t;try{i.setSelectionRange(r,r)}catch{}i.dispatchEvent(new Event("input",{bubbles:!0}))}function Cy(i){if(i<=0)return;const t=TO();if(!t)return;const r=t.selectionStart??t.value.length,s=Math.max(0,r-i);NO(t,t.value.slice(0,s)+t.value.slice(r),s)}function kO({active:i,wedgeConfig:t,diagnosticsOn:r,onScan:s,onDiag:l}){const c=j.useRef({diagnosticsOn:r,onScan:s,onDiag:l});c.current={diagnosticsOn:r,onScan:s,onDiag:l};const d=j.useRef(0),p=j.useRef(0);j.useEffect(()=>{if(!i)return;const g=jO(t);let f=null;const m=()=>{f&&(clearTimeout(f),f=null)},b=(w,S,M)=>{S&&Cy(S),c.current.diagnosticsOn&&(console.debug("[scan]",M),c.current.onDiag({seq:++d.current,key:"(quiet)",code:"",deltaMs:0,buffer:"",note:M})),c.current.onScan(w)},v=()=>{m(),g.pendingAutoFire()&&(f=setTimeout(()=>{f=null;const w=g.pendingAutoFire();w&&(g.reset(),b(w.code,w.consumedLength,`capture → ${w.code} (quiet period — no suffix)`))},t.autoFireQuietMs))},_=w=>{const S=g.snapshot().buffer,{suppress:M,emit:B,consumedLength:U}=g.step({key:w.key,timeMs:w.timeStamp,hasModifier:w.ctrlKey||w.metaKey||w.altKey,isRepeat:w.repeat});if(M&&(w.preventDefault(),w.stopPropagation()),c.current.diagnosticsOn){const ie=g.snapshot().buffer,ce=t.terminators.includes(w.key),C=B?`capture → ${B}`:ce?`terminator — no code tail in "${S.slice(-24)}"`:ie===S?S?"neutral (chord key)":"ignored":ie===""?"reset (edit/chord/non-printable)":ie.length<=1&&S.length>1?"gap — new episode":"accumulate",z=p.current?Math.round(w.timeStamp-p.current):0,re={seq:++d.current,key:w.key,code:w.code!==w.key?w.code:"",deltaMs:z,buffer:ie.slice(-24),note:C};console.debug("[scan]",re.key,re.code,`${re.deltaMs}ms`,re.note),c.current.onDiag(re)}p.current=w.timeStamp,B?(m(),U&&Cy(U),c.current.onScan(B)):v()};return window.addEventListener("keydown",_,{capture:!0}),()=>{m(),window.removeEventListener("keydown",_,{capture:!0})}},[i,t])}const Pe={EXECUTED:"executed",MATCHED_LIST:"matched_list",CONFIRM_REQUIRED:"confirm_required",NO_MATCH_FALLBACK:"no_match_fallback",UNCONFIGURED:"unconfigured",INVALID_CODE:"invalid_code",FORBIDDEN:"forbidden",CONFLICT:"conflict",IDENTITY_PRIMED:"identity_primed",IDENTITY_UNKNOWN:"identity_unknown",NOT_PRIMED:"not_primed",CHOICES:"choices"},Zl={SHOW_DETAIL:"show-detail",SHOW_LIST:"show-list",CLAIM:"claim",CLAIM_SHOW_DETAIL:"claim-show-detail",RELEASE:"release",RESOLVE:"resolve",ESCALATE:"escalate",CANCEL:"cancel",PRESENT:"present"},U3={ACTION:"action",IDENTITY:"identity"};function CO(i,t){return Ae("/scan-codes/execute",{method:"POST",body:JSON.stringify({code:i,...t!=null&&t.actingToken?{actingToken:t.actingToken}:{},...t!=null&&t.previousActingToken?{previousActingToken:t.previousActingToken}:{}})})}function P3(i){return Ae("/scan-codes/execute-choice",{method:"POST",body:JSON.stringify(i)})}function I3(){return pt({queryKey:["scan-schemes"],queryFn:()=>Ae("/scan-codes/schemes")})}function $3(i){return pt({queryKey:["scan-schemes",i],queryFn:()=>Ae(`/scan-codes/schemes/${i}`),enabled:i!=null})}function H3(){const i=gt();return Et({mutationFn:t=>Ae(`/scan-codes/schemes/${t.version}`,{method:"PUT",body:JSON.stringify(t)}),onSuccess:()=>i.invalidateQueries({queryKey:["scan-schemes"]})})}function G3(){const i=gt();return Et({mutationFn:t=>Ae(`/scan-codes/schemes/${t}`,{method:"DELETE"}),onSuccess:()=>i.invalidateQueries({queryKey:["scan-schemes"]})})}function F3(){const i=gt();return Et({mutationFn:t=>Ae(`/scan-codes/schemes/${t.scheme_version}/actions/${t.category}`,{method:"PUT",body:JSON.stringify(t)}),onSuccess:(t,r)=>i.invalidateQueries({queryKey:["scan-schemes",r.scheme_version]})})}function V3(){const i=gt();return Et({mutationFn:t=>Ae(`/scan-codes/schemes/${t.scheme_version}/actions/${t.category}`,{method:"DELETE"}),onSuccess:(t,r)=>i.invalidateQueries({queryKey:["scan-schemes",r.scheme_version]})})}const My={KEYBOARD_WEDGE:"keyboard-wedge",MANUAL:"manual"},Cs=i=>{if(i)try{return JSON.parse(i)}catch{return}},Ui=i=>i==null||Array.isArray(i)&&i.length===0||typeof i=="object"&&!Array.isArray(i)&&Object.keys(i).length===0;function MO(i){const t={},r=Cs(i.get("facets"));Ui(r)||(t.facets=r);const s=Cs(i.get("block"));Ui(s)||(t.block=s);const l=Cs(i.get("range"));Ui(l)||(t.range=l);const c=Cs(i.get("exists"));Ui(c)||(t.exists=c);const d=Cs(i.get("roles"));Ui(d)||(t.roles=d);const p=Cs(i.get("orderBy"));Ui(p)||(t.orderBy=p),i.get("available")!=null&&(t.available=i.get("available")==="true");const g=i.get("jeopardy");return(g==="1"||g==="true")&&(t.jeopardy=!0),t}function Y3(i,t){const r=(s,l)=>Ui(l)?i.delete(s):i.set(s,JSON.stringify(l));r("facets",t.facets),r("block",t.block),r("range",t.range),r("exists",t.exists),r("roles",t.roles),r("orderBy",t.orderBy),t.available==null?i.delete("available"):i.set("available",String(t.available)),t.jeopardy===!0?i.set("jeopardy","1"):i.delete("jeopardy")}const Ry=`&status=all&view=table&orderBy=${encodeURIComponent(JSON.stringify([{field:"created_at",direction:"desc"}]))}`;function uv(i,t){const r={};for(const[l,c]of Object.entries(i))r[l]=typeof c=="object"&&c!==null?JSON.stringify(c):c;const s=encodeURIComponent(JSON.stringify(r));return t?`/escalations/available?role=${encodeURIComponent(t)}&facets=${s}${Ry}`:`/escalations/available?facets=${s}${Ry}`}function K3(i,t,r){return uv({[i]:t},r)}function X3(i){var t,r,s;return Object.keys(i.facets??{}).length+(((t=i.block)==null?void 0:t.length)??0)+(((r=i.range)==null?void 0:r.length)??0)+(((s=i.exists)==null?void 0:s.length)??0)+(i.available!=null?1:0)+(i.jeopardy===!0?1:0)}function fv(){var r;const{data:i}=Wn(),t=Yb();return t!==null?t:!!((r=i==null?void 0:i.features)!=null&&r.scanCodes)}const hv=j.createContext(null);function dv(){const i=j.useContext(hv);if(!i)throw new Error("useScanInput must be used within ScanInputProvider");return i}const RO="scanPendingAction",DO="scanChoices",qO="/scan/station";function BO({children:i}){const{user:t}=Jt(),r=fv(),s=go(),{identity:l,prime:c}=wO(),[d,p]=j.useState(null),[g,f]=j.useState(!1),[m,b]=j.useState(()=>cv()),[v,_]=j.useState([]),[w,S]=j.useState(!1),M=j.useCallback(L=>{var W;const{outcome:G}=L;if(G===Pe.CONFIRM_REQUIRED&&L.pendingAction)return s(`/escalations/detail/${L.pendingAction.escalationId}`,{state:{[RO]:L.pendingAction}}),!0;if(G===Pe.EXECUTED&&L.escalation){const Q=[Zl.SHOW_DETAIL,Zl.CLAIM_SHOW_DETAIL,Zl.CLAIM,Zl.ESCALATE];return L.verb&&Q.includes(L.verb)?(s(`/escalations/detail/${L.escalation.id}`),!0):!1}if(G===Pe.MATCHED_LIST&&L.listQuery){const{targetFacet:Q,target:he,roles:_e}=L.listQuery;return s(uv({[Q]:he},(_e==null?void 0:_e[0])??null)),!0}return G===Pe.CHOICES&&L.choices?(s(qO,{state:{[DO]:L}}),!0):G===Pe.NO_MATCH_FALLBACK&&((W=L.fallback)!=null&&W.route)?(s(L.fallback.route),!0):!1},[s]),B=j.useRef(null);B.current=(l==null?void 0:l.actingToken)??null;const U=j.useRef(null),ie=j.useRef(null),ce=j.useCallback(L=>{ie.current=L},[]),C=j.useCallback(async(L,G=My.MANUAL)=>{var Q;if((Q=ie.current)!=null&&Q.call(ie,L))return;f(!0);const W=Date.now();try{const he=await CO(L,{actingToken:B.current??void 0,previousActingToken:U.current??void 0});he.outcome===Pe.IDENTITY_PRIMED&&(U.current=c(he));const _e=M(he);p({code:L,source:G,at:W,response:he,error:null,navigated:_e})}catch(he){p({code:L,source:G,at:W,response:null,error:he.message,navigated:!1})}finally{f(!1)}},[M,c]),z=j.useRef(C);z.current=C,kO({active:!!t&&r,wedgeConfig:m,diagnosticsOn:w,onScan:L=>void z.current(L,My.KEYBOARD_WEDGE),onDiag:L=>_(G=>[...G.slice(-29),L])});const re=j.useCallback(L=>{b(EO(L))},[]),X=j.useMemo(()=>({submitCode:C,setCodeInterceptor:ce,lastResult:d,busy:g,wedgeConfig:m,updateWedgeConfig:re,diagnostics:v,diagnosticsOn:w,setDiagnosticsOn:S}),[C,ce,d,g,m,re,v,w]);return y.jsx(hv.Provider,{value:X,children:i})}var Wl={},Ka={},ec={},Dy;function gn(){if(Dy)return ec;Dy=1,Object.defineProperty(ec,"__esModule",{value:!0});function i(r,s){if(!(r instanceof s))throw new TypeError("Cannot call a class as a function")}var t=function r(s,l){i(this,r),this.data=s,this.text=l.text||s,this.options=l};return ec.default=t,ec}var qy;function LO(){if(qy)return Ka;qy=1,Object.defineProperty(Ka,"__esModule",{value:!0}),Ka.CODE39=void 0;var i=(function(){function S(M,B){for(var U=0;U<B.length;U++){var ie=B[U];ie.enumerable=ie.enumerable||!1,ie.configurable=!0,"value"in ie&&(ie.writable=!0),Object.defineProperty(M,ie.key,ie)}}return function(M,B,U){return B&&S(M.prototype,B),U&&S(M,U),M}})(),t=gn(),r=s(t);function s(S){return S&&S.__esModule?S:{default:S}}function l(S,M){if(!(S instanceof M))throw new TypeError("Cannot call a class as a function")}function c(S,M){if(!S)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return M&&(typeof M=="object"||typeof M=="function")?M:S}function d(S,M){if(typeof M!="function"&&M!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof M);S.prototype=Object.create(M&&M.prototype,{constructor:{value:S,enumerable:!1,writable:!0,configurable:!0}}),M&&(Object.setPrototypeOf?Object.setPrototypeOf(S,M):S.__proto__=M)}var p=(function(S){d(M,S);function M(B,U){return l(this,M),B=B.toUpperCase(),U.mod43&&(B+=v(w(B))),c(this,(M.__proto__||Object.getPrototypeOf(M)).call(this,B,U))}return i(M,[{key:"encode",value:function(){for(var U=m("*"),ie=0;ie<this.data.length;ie++)U+=m(this.data[ie])+"0";return U+=m("*"),{data:U,text:this.text}}},{key:"valid",value:function(){return this.data.search(/^[0-9A-Z\-\.\ \$\/\+\%]+$/)!==-1}}]),M})(r.default),g=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","-","."," ","$","/","+","%","*"],f=[20957,29783,23639,30485,20951,29813,23669,20855,29789,23645,29975,23831,30533,22295,30149,24005,21623,29981,23837,22301,30023,23879,30545,22343,30161,24017,21959,30065,23921,22385,29015,18263,29141,17879,29045,18293,17783,29021,18269,17477,17489,17681,20753,35770];function m(S){return b(_(S))}function b(S){return f[S].toString(2)}function v(S){return g[S]}function _(S){return g.indexOf(S)}function w(S){for(var M=0,B=0;B<S.length;B++)M+=_(S[B]);return M=M%43,M}return Ka.CODE39=p,Ka}var zn={},tc={},nc={},ut={},By;function vo(){if(By)return ut;By=1,Object.defineProperty(ut,"__esModule",{value:!0});var i;function t(g,f,m){return f in g?Object.defineProperty(g,f,{value:m,enumerable:!0,configurable:!0,writable:!0}):g[f]=m,g}var r=ut.SET_A=0,s=ut.SET_B=1,l=ut.SET_C=2;ut.SHIFT=98;var c=ut.START_A=103,d=ut.START_B=104,p=ut.START_C=105;return ut.MODULO=103,ut.STOP=106,ut.FNC1=207,ut.SET_BY_CODE=(i={},t(i,c,r),t(i,d,s),t(i,p,l),i),ut.SWAP={101:r,100:s,99:l},ut.A_START_CHAR="Ð",ut.B_START_CHAR="Ñ",ut.C_START_CHAR="Ò",ut.A_CHARS="[\0-_È-Ï]",ut.B_CHARS="[ -È-Ï]",ut.C_CHARS="(Ï*[0-9]{2}Ï*)",ut.BARS=[11011001100,11001101100,11001100110,10010011e3,10010001100,10001001100,10011001e3,10011000100,10001100100,11001001e3,11001000100,11000100100,10110011100,10011011100,10011001110,10111001100,10011101100,10011100110,11001110010,11001011100,11001001110,11011100100,11001110100,11101101110,11101001100,11100101100,11100100110,11101100100,11100110100,11100110010,11011011e3,11011000110,11000110110,10100011e3,10001011e3,10001000110,10110001e3,10001101e3,10001100010,11010001e3,11000101e3,11000100010,10110111e3,10110001110,10001101110,10111011e3,10111000110,10001110110,11101110110,11010001110,11000101110,11011101e3,11011100010,11011101110,11101011e3,11101000110,11100010110,11101101e3,11101100010,11100011010,11101111010,11001000010,11110001010,1010011e4,10100001100,1001011e4,10010000110,10000101100,10000100110,1011001e4,10110000100,1001101e4,10011000010,10000110100,10000110010,11000010010,1100101e4,11110111010,11000010100,10001111010,10100111100,10010111100,10010011110,10111100100,10011110100,10011110010,11110100100,11110010100,11110010010,11011011110,11011110110,11110110110,10101111e3,10100011110,10001011110,10111101e3,10111100010,11110101e3,11110100010,10111011110,10111101110,11101011110,11110101110,11010000100,1101001e4,11010011100,1100011101011],ut}var Ly;function pu(){if(Ly)return nc;Ly=1,Object.defineProperty(nc,"__esModule",{value:!0});var i=(function(){function f(m,b){for(var v=0;v<b.length;v++){var _=b[v];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(m,_.key,_)}}return function(m,b,v){return b&&f(m.prototype,b),v&&f(m,v),m}})(),t=gn(),r=l(t),s=vo();function l(f){return f&&f.__esModule?f:{default:f}}function c(f,m){if(!(f instanceof m))throw new TypeError("Cannot call a class as a function")}function d(f,m){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:f}function p(f,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);f.prototype=Object.create(m&&m.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(f,m):f.__proto__=m)}var g=(function(f){p(m,f);function m(b,v){c(this,m);var _=d(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,b.substring(1),v));return _.bytes=b.split("").map(function(w){return w.charCodeAt(0)}),_}return i(m,[{key:"valid",value:function(){return/^[\x00-\x7F\xC8-\xD3]+$/.test(this.data)}},{key:"encode",value:function(){var v=this.bytes,_=v.shift()-105,w=s.SET_BY_CODE[_];if(w===void 0)throw new RangeError("The encoding does not start with a start character.");this.shouldEncodeAsEan128()===!0&&v.unshift(s.FNC1);var S=m.next(v,1,w);return{text:this.text===this.data?this.text.replace(/[^\x20-\x7E]/g,""):this.text,data:m.getBar(_)+S.result+m.getBar((S.checksum+_)%s.MODULO)+m.getBar(s.STOP)}}},{key:"shouldEncodeAsEan128",value:function(){var v=this.options.ean128||!1;return typeof v=="string"&&(v=v.toLowerCase()==="true"),v}}],[{key:"getBar",value:function(v){return s.BARS[v]?s.BARS[v].toString():""}},{key:"correctIndex",value:function(v,_){if(_===s.SET_A){var w=v.shift();return w<32?w+64:w-32}else return _===s.SET_B?v.shift()-32:(v.shift()-48)*10+v.shift()-48}},{key:"next",value:function(v,_,w){if(!v.length)return{result:"",checksum:0};var S=void 0,M=void 0;if(v[0]>=200){M=v.shift()-105;var B=s.SWAP[M];B!==void 0?S=m.next(v,_+1,B):((w===s.SET_A||w===s.SET_B)&&M===s.SHIFT&&(v[0]=w===s.SET_A?v[0]>95?v[0]-96:v[0]:v[0]<32?v[0]+96:v[0]),S=m.next(v,_+1,w))}else M=m.correctIndex(v,w),S=m.next(v,_+1,w);var U=m.getBar(M),ie=M*_;return{result:U+S.result,checksum:ie+S.checksum}}}]),m})(r.default);return nc.default=g,nc}var rc={},zy;function zO(){if(zy)return rc;zy=1,Object.defineProperty(rc,"__esModule",{value:!0});var i=vo(),t=function(p){return p.match(new RegExp("^"+i.A_CHARS+"*"))[0].length},r=function(p){return p.match(new RegExp("^"+i.B_CHARS+"*"))[0].length},s=function(p){return p.match(new RegExp("^"+i.C_CHARS+"*"))[0]};function l(d,p){var g=p?i.A_CHARS:i.B_CHARS,f=d.match(new RegExp("^("+g+"+?)(([0-9]{2}){2,})([^0-9]|$)"));if(f)return f[1]+"Ì"+c(d.substring(f[1].length));var m=d.match(new RegExp("^"+g+"+"))[0];return m.length===d.length?d:m+String.fromCharCode(p?205:206)+l(d.substring(m.length),!p)}function c(d){var p=s(d),g=p.length;if(g===d.length)return d;d=d.substring(g);var f=t(d)>=r(d);return p+String.fromCharCode(f?206:205)+l(d,f)}return rc.default=function(d){var p=void 0,g=s(d).length;if(g>=2)p=i.C_START_CHAR+c(d);else{var f=t(d)>r(d);p=(f?i.A_START_CHAR:i.B_START_CHAR)+l(d,f)}return p.replace(/[\xCD\xCE]([^])[\xCD\xCE]/,function(m,b){return"Ë"+b})},rc}var Uy;function UO(){if(Uy)return tc;Uy=1,Object.defineProperty(tc,"__esModule",{value:!0});var i=pu(),t=l(i),r=zO(),s=l(r);function l(f){return f&&f.__esModule?f:{default:f}}function c(f,m){if(!(f instanceof m))throw new TypeError("Cannot call a class as a function")}function d(f,m){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:f}function p(f,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);f.prototype=Object.create(m&&m.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(f,m):f.__proto__=m)}var g=(function(f){p(m,f);function m(b,v){if(c(this,m),/^[\x00-\x7F\xC8-\xD3]+$/.test(b))var _=d(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,(0,s.default)(b),v));else var _=d(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,b,v));return d(_)}return m})(t.default);return tc.default=g,tc}var ic={},Py;function PO(){if(Py)return ic;Py=1,Object.defineProperty(ic,"__esModule",{value:!0});var i=(function(){function f(m,b){for(var v=0;v<b.length;v++){var _=b[v];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(m,_.key,_)}}return function(m,b,v){return b&&f(m.prototype,b),v&&f(m,v),m}})(),t=pu(),r=l(t),s=vo();function l(f){return f&&f.__esModule?f:{default:f}}function c(f,m){if(!(f instanceof m))throw new TypeError("Cannot call a class as a function")}function d(f,m){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:f}function p(f,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);f.prototype=Object.create(m&&m.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(f,m):f.__proto__=m)}var g=(function(f){p(m,f);function m(b,v){return c(this,m),d(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,s.A_START_CHAR+b,v))}return i(m,[{key:"valid",value:function(){return new RegExp("^"+s.A_CHARS+"+$").test(this.data)}}]),m})(r.default);return ic.default=g,ic}var sc={},Iy;function IO(){if(Iy)return sc;Iy=1,Object.defineProperty(sc,"__esModule",{value:!0});var i=(function(){function f(m,b){for(var v=0;v<b.length;v++){var _=b[v];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(m,_.key,_)}}return function(m,b,v){return b&&f(m.prototype,b),v&&f(m,v),m}})(),t=pu(),r=l(t),s=vo();function l(f){return f&&f.__esModule?f:{default:f}}function c(f,m){if(!(f instanceof m))throw new TypeError("Cannot call a class as a function")}function d(f,m){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:f}function p(f,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);f.prototype=Object.create(m&&m.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(f,m):f.__proto__=m)}var g=(function(f){p(m,f);function m(b,v){return c(this,m),d(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,s.B_START_CHAR+b,v))}return i(m,[{key:"valid",value:function(){return new RegExp("^"+s.B_CHARS+"+$").test(this.data)}}]),m})(r.default);return sc.default=g,sc}var ac={},$y;function $O(){if($y)return ac;$y=1,Object.defineProperty(ac,"__esModule",{value:!0});var i=(function(){function f(m,b){for(var v=0;v<b.length;v++){var _=b[v];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(m,_.key,_)}}return function(m,b,v){return b&&f(m.prototype,b),v&&f(m,v),m}})(),t=pu(),r=l(t),s=vo();function l(f){return f&&f.__esModule?f:{default:f}}function c(f,m){if(!(f instanceof m))throw new TypeError("Cannot call a class as a function")}function d(f,m){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:f}function p(f,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);f.prototype=Object.create(m&&m.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(f,m):f.__proto__=m)}var g=(function(f){p(m,f);function m(b,v){return c(this,m),d(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,s.C_START_CHAR+b,v))}return i(m,[{key:"valid",value:function(){return new RegExp("^"+s.C_CHARS+"+$").test(this.data)}}]),m})(r.default);return ac.default=g,ac}var Hy;function HO(){if(Hy)return zn;Hy=1,Object.defineProperty(zn,"__esModule",{value:!0}),zn.CODE128C=zn.CODE128B=zn.CODE128A=zn.CODE128=void 0;var i=UO(),t=g(i),r=PO(),s=g(r),l=IO(),c=g(l),d=$O(),p=g(d);function g(f){return f&&f.__esModule?f:{default:f}}return zn.CODE128=t.default,zn.CODE128A=s.default,zn.CODE128B=c.default,zn.CODE128C=p.default,zn}var Ut={},oc={},_r={},Gy;function xo(){return Gy||(Gy=1,Object.defineProperty(_r,"__esModule",{value:!0}),_r.SIDE_BIN="101",_r.MIDDLE_BIN="01010",_r.BINARIES={L:["0001101","0011001","0010011","0111101","0100011","0110001","0101111","0111011","0110111","0001011"],G:["0100111","0110011","0011011","0100001","0011101","0111001","0000101","0010001","0001001","0010111"],R:["1110010","1100110","1101100","1000010","1011100","1001110","1010000","1000100","1001000","1110100"],O:["0001101","0011001","0010011","0111101","0100011","0110001","0101111","0111011","0110111","0001011"],E:["0100111","0110011","0011011","0100001","0011101","0111001","0000101","0010001","0001001","0010111"]},_r.EAN2_STRUCTURE=["LL","LG","GL","GG"],_r.EAN5_STRUCTURE=["GGLLL","GLGLL","GLLGL","GLLLG","LGGLL","LLGGL","LLLGG","LGLGL","LGLLG","LLGLG"],_r.EAN13_STRUCTURE=["LLLLLL","LLGLGG","LLGGLG","LLGGGL","LGLLGG","LGGLLG","LGGGLL","LGLGLG","LGLGGL","LGGLGL"]),_r}var lc={},cc={},Fy;function _o(){if(Fy)return cc;Fy=1,Object.defineProperty(cc,"__esModule",{value:!0});var i=xo(),t=function(s,l,c){var d=s.split("").map(function(g,f){return i.BINARIES[l[f]]}).map(function(g,f){return g?g[s[f]]:""});if(c){var p=s.length-1;d=d.map(function(g,f){return f<p?g+c:g})}return d.join("")};return cc.default=t,cc}var Vy;function mv(){if(Vy)return lc;Vy=1,Object.defineProperty(lc,"__esModule",{value:!0});var i=(function(){function b(v,_){for(var w=0;w<_.length;w++){var S=_[w];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(v,S.key,S)}}return function(v,_,w){return _&&b(v.prototype,_),w&&b(v,w),v}})(),t=xo(),r=_o(),s=d(r),l=gn(),c=d(l);function d(b){return b&&b.__esModule?b:{default:b}}function p(b,v){if(!(b instanceof v))throw new TypeError("Cannot call a class as a function")}function g(b,v){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return v&&(typeof v=="object"||typeof v=="function")?v:b}function f(b,v){if(typeof v!="function"&&v!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof v);b.prototype=Object.create(v&&v.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),v&&(Object.setPrototypeOf?Object.setPrototypeOf(b,v):b.__proto__=v)}var m=(function(b){f(v,b);function v(_,w){p(this,v);var S=g(this,(v.__proto__||Object.getPrototypeOf(v)).call(this,_,w));return S.fontSize=!w.flat&&w.fontSize>w.width*10?w.width*10:w.fontSize,S.guardHeight=w.height+S.fontSize/2+w.textMargin,S}return i(v,[{key:"encode",value:function(){return this.options.flat?this.encodeFlat():this.encodeGuarded()}},{key:"leftText",value:function(w,S){return this.text.substr(w,S)}},{key:"leftEncode",value:function(w,S){return(0,s.default)(w,S)}},{key:"rightText",value:function(w,S){return this.text.substr(w,S)}},{key:"rightEncode",value:function(w,S){return(0,s.default)(w,S)}},{key:"encodeGuarded",value:function(){var w={fontSize:this.fontSize},S={height:this.guardHeight};return[{data:t.SIDE_BIN,options:S},{data:this.leftEncode(),text:this.leftText(),options:w},{data:t.MIDDLE_BIN,options:S},{data:this.rightEncode(),text:this.rightText(),options:w},{data:t.SIDE_BIN,options:S}]}},{key:"encodeFlat",value:function(){var w=[t.SIDE_BIN,this.leftEncode(),t.MIDDLE_BIN,this.rightEncode(),t.SIDE_BIN];return{data:w.join(""),text:this.text}}}]),v})(c.default);return lc.default=m,lc}var Yy;function GO(){if(Yy)return oc;Yy=1,Object.defineProperty(oc,"__esModule",{value:!0});var i=(function(){function b(v,_){for(var w=0;w<_.length;w++){var S=_[w];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(v,S.key,S)}}return function(v,_,w){return _&&b(v.prototype,_),w&&b(v,w),v}})(),t=function b(v,_,w){v===null&&(v=Function.prototype);var S=Object.getOwnPropertyDescriptor(v,_);if(S===void 0){var M=Object.getPrototypeOf(v);return M===null?void 0:b(M,_,w)}else{if("value"in S)return S.value;var B=S.get;return B===void 0?void 0:B.call(w)}},r=xo(),s=mv(),l=c(s);function c(b){return b&&b.__esModule?b:{default:b}}function d(b,v){if(!(b instanceof v))throw new TypeError("Cannot call a class as a function")}function p(b,v){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return v&&(typeof v=="object"||typeof v=="function")?v:b}function g(b,v){if(typeof v!="function"&&v!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof v);b.prototype=Object.create(v&&v.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),v&&(Object.setPrototypeOf?Object.setPrototypeOf(b,v):b.__proto__=v)}var f=function(v){var _=v.substr(0,12).split("").map(function(w){return+w}).reduce(function(w,S,M){return M%2?w+S*3:w+S},0);return(10-_%10)%10},m=(function(b){g(v,b);function v(_,w){d(this,v),_.search(/^[0-9]{12}$/)!==-1&&(_+=f(_));var S=p(this,(v.__proto__||Object.getPrototypeOf(v)).call(this,_,w));return S.lastChar=w.lastChar,S}return i(v,[{key:"valid",value:function(){return this.data.search(/^[0-9]{13}$/)!==-1&&+this.data[12]===f(this.data)}},{key:"leftText",value:function(){return t(v.prototype.__proto__||Object.getPrototypeOf(v.prototype),"leftText",this).call(this,1,6)}},{key:"leftEncode",value:function(){var w=this.data.substr(1,6),S=r.EAN13_STRUCTURE[this.data[0]];return t(v.prototype.__proto__||Object.getPrototypeOf(v.prototype),"leftEncode",this).call(this,w,S)}},{key:"rightText",value:function(){return t(v.prototype.__proto__||Object.getPrototypeOf(v.prototype),"rightText",this).call(this,7,6)}},{key:"rightEncode",value:function(){var w=this.data.substr(7,6);return t(v.prototype.__proto__||Object.getPrototypeOf(v.prototype),"rightEncode",this).call(this,w,"RRRRRR")}},{key:"encodeGuarded",value:function(){var w=t(v.prototype.__proto__||Object.getPrototypeOf(v.prototype),"encodeGuarded",this).call(this);return this.options.displayValue&&(w.unshift({data:"000000000000",text:this.text.substr(0,1),options:{textAlign:"left",fontSize:this.fontSize}}),this.options.lastChar&&(w.push({data:"00"}),w.push({data:"00000",text:this.options.lastChar,options:{fontSize:this.fontSize}}))),w}}]),v})(l.default);return oc.default=m,oc}var uc={},Ky;function FO(){if(Ky)return uc;Ky=1,Object.defineProperty(uc,"__esModule",{value:!0});var i=(function(){function m(b,v){for(var _=0;_<v.length;_++){var w=v[_];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(b,w.key,w)}}return function(b,v,_){return v&&m(b.prototype,v),_&&m(b,_),b}})(),t=function m(b,v,_){b===null&&(b=Function.prototype);var w=Object.getOwnPropertyDescriptor(b,v);if(w===void 0){var S=Object.getPrototypeOf(b);return S===null?void 0:m(S,v,_)}else{if("value"in w)return w.value;var M=w.get;return M===void 0?void 0:M.call(_)}},r=mv(),s=l(r);function l(m){return m&&m.__esModule?m:{default:m}}function c(m,b){if(!(m instanceof b))throw new TypeError("Cannot call a class as a function")}function d(m,b){if(!m)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return b&&(typeof b=="object"||typeof b=="function")?b:m}function p(m,b){if(typeof b!="function"&&b!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof b);m.prototype=Object.create(b&&b.prototype,{constructor:{value:m,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(m,b):m.__proto__=b)}var g=function(b){var v=b.substr(0,7).split("").map(function(_){return+_}).reduce(function(_,w,S){return S%2?_+w:_+w*3},0);return(10-v%10)%10},f=(function(m){p(b,m);function b(v,_){return c(this,b),v.search(/^[0-9]{7}$/)!==-1&&(v+=g(v)),d(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,v,_))}return i(b,[{key:"valid",value:function(){return this.data.search(/^[0-9]{8}$/)!==-1&&+this.data[7]===g(this.data)}},{key:"leftText",value:function(){return t(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"leftText",this).call(this,0,4)}},{key:"leftEncode",value:function(){var _=this.data.substr(0,4);return t(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"leftEncode",this).call(this,_,"LLLL")}},{key:"rightText",value:function(){return t(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"rightText",this).call(this,4,4)}},{key:"rightEncode",value:function(){var _=this.data.substr(4,4);return t(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"rightEncode",this).call(this,_,"RRRR")}}]),b})(s.default);return uc.default=f,uc}var fc={},Xy;function VO(){if(Xy)return fc;Xy=1,Object.defineProperty(fc,"__esModule",{value:!0});var i=(function(){function v(_,w){for(var S=0;S<w.length;S++){var M=w[S];M.enumerable=M.enumerable||!1,M.configurable=!0,"value"in M&&(M.writable=!0),Object.defineProperty(_,M.key,M)}}return function(_,w,S){return w&&v(_.prototype,w),S&&v(_,S),_}})(),t=xo(),r=_o(),s=d(r),l=gn(),c=d(l);function d(v){return v&&v.__esModule?v:{default:v}}function p(v,_){if(!(v instanceof _))throw new TypeError("Cannot call a class as a function")}function g(v,_){if(!v)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return _&&(typeof _=="object"||typeof _=="function")?_:v}function f(v,_){if(typeof _!="function"&&_!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof _);v.prototype=Object.create(_&&_.prototype,{constructor:{value:v,enumerable:!1,writable:!0,configurable:!0}}),_&&(Object.setPrototypeOf?Object.setPrototypeOf(v,_):v.__proto__=_)}var m=function(_){var w=_.split("").map(function(S){return+S}).reduce(function(S,M,B){return B%2?S+M*9:S+M*3},0);return w%10},b=(function(v){f(_,v);function _(w,S){return p(this,_),g(this,(_.__proto__||Object.getPrototypeOf(_)).call(this,w,S))}return i(_,[{key:"valid",value:function(){return this.data.search(/^[0-9]{5}$/)!==-1}},{key:"encode",value:function(){var S=t.EAN5_STRUCTURE[m(this.data)];return{data:"1011"+(0,s.default)(this.data,S,"01"),text:this.text}}}]),_})(c.default);return fc.default=b,fc}var hc={},Jy;function YO(){if(Jy)return hc;Jy=1,Object.defineProperty(hc,"__esModule",{value:!0});var i=(function(){function b(v,_){for(var w=0;w<_.length;w++){var S=_[w];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(v,S.key,S)}}return function(v,_,w){return _&&b(v.prototype,_),w&&b(v,w),v}})(),t=xo(),r=_o(),s=d(r),l=gn(),c=d(l);function d(b){return b&&b.__esModule?b:{default:b}}function p(b,v){if(!(b instanceof v))throw new TypeError("Cannot call a class as a function")}function g(b,v){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return v&&(typeof v=="object"||typeof v=="function")?v:b}function f(b,v){if(typeof v!="function"&&v!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof v);b.prototype=Object.create(v&&v.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),v&&(Object.setPrototypeOf?Object.setPrototypeOf(b,v):b.__proto__=v)}var m=(function(b){f(v,b);function v(_,w){return p(this,v),g(this,(v.__proto__||Object.getPrototypeOf(v)).call(this,_,w))}return i(v,[{key:"valid",value:function(){return this.data.search(/^[0-9]{2}$/)!==-1}},{key:"encode",value:function(){var w=t.EAN2_STRUCTURE[parseInt(this.data)%4];return{data:"1011"+(0,s.default)(this.data,w,"01"),text:this.text}}}]),v})(c.default);return hc.default=m,hc}var Xa={},Qy;function pv(){if(Qy)return Xa;Qy=1,Object.defineProperty(Xa,"__esModule",{value:!0});var i=(function(){function b(v,_){for(var w=0;w<_.length;w++){var S=_[w];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(v,S.key,S)}}return function(v,_,w){return _&&b(v.prototype,_),w&&b(v,w),v}})();Xa.checksum=m;var t=_o(),r=c(t),s=gn(),l=c(s);function c(b){return b&&b.__esModule?b:{default:b}}function d(b,v){if(!(b instanceof v))throw new TypeError("Cannot call a class as a function")}function p(b,v){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return v&&(typeof v=="object"||typeof v=="function")?v:b}function g(b,v){if(typeof v!="function"&&v!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof v);b.prototype=Object.create(v&&v.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),v&&(Object.setPrototypeOf?Object.setPrototypeOf(b,v):b.__proto__=v)}var f=(function(b){g(v,b);function v(_,w){d(this,v),_.search(/^[0-9]{11}$/)!==-1&&(_+=m(_));var S=p(this,(v.__proto__||Object.getPrototypeOf(v)).call(this,_,w));return S.displayValue=w.displayValue,w.fontSize>w.width*10?S.fontSize=w.width*10:S.fontSize=w.fontSize,S.guardHeight=w.height+S.fontSize/2+w.textMargin,S}return i(v,[{key:"valid",value:function(){return this.data.search(/^[0-9]{12}$/)!==-1&&this.data[11]==m(this.data)}},{key:"encode",value:function(){return this.options.flat?this.flatEncoding():this.guardedEncoding()}},{key:"flatEncoding",value:function(){var w="";return w+="101",w+=(0,r.default)(this.data.substr(0,6),"LLLLLL"),w+="01010",w+=(0,r.default)(this.data.substr(6,6),"RRRRRR"),w+="101",{data:w,text:this.text}}},{key:"guardedEncoding",value:function(){var w=[];return this.displayValue&&w.push({data:"00000000",text:this.text.substr(0,1),options:{textAlign:"left",fontSize:this.fontSize}}),w.push({data:"101"+(0,r.default)(this.data[0],"L"),options:{height:this.guardHeight}}),w.push({data:(0,r.default)(this.data.substr(1,5),"LLLLL"),text:this.text.substr(1,5),options:{fontSize:this.fontSize}}),w.push({data:"01010",options:{height:this.guardHeight}}),w.push({data:(0,r.default)(this.data.substr(6,5),"RRRRR"),text:this.text.substr(6,5),options:{fontSize:this.fontSize}}),w.push({data:(0,r.default)(this.data[11],"R")+"101",options:{height:this.guardHeight}}),this.displayValue&&w.push({data:"00000000",text:this.text.substr(11,1),options:{textAlign:"right",fontSize:this.fontSize}}),w}}]),v})(l.default);function m(b){var v=0,_;for(_=1;_<11;_+=2)v+=parseInt(b[_]);for(_=0;_<11;_+=2)v+=parseInt(b[_])*3;return(10-v%10)%10}return Xa.default=f,Xa}var dc={},Zy;function KO(){if(Zy)return dc;Zy=1,Object.defineProperty(dc,"__esModule",{value:!0});var i=(function(){function w(S,M){for(var B=0;B<M.length;B++){var U=M[B];U.enumerable=U.enumerable||!1,U.configurable=!0,"value"in U&&(U.writable=!0),Object.defineProperty(S,U.key,U)}}return function(S,M,B){return M&&w(S.prototype,M),B&&w(S,B),S}})(),t=_o(),r=d(t),s=gn(),l=d(s),c=pv();function d(w){return w&&w.__esModule?w:{default:w}}function p(w,S){if(!(w instanceof S))throw new TypeError("Cannot call a class as a function")}function g(w,S){if(!w)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return S&&(typeof S=="object"||typeof S=="function")?S:w}function f(w,S){if(typeof S!="function"&&S!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof S);w.prototype=Object.create(S&&S.prototype,{constructor:{value:w,enumerable:!1,writable:!0,configurable:!0}}),S&&(Object.setPrototypeOf?Object.setPrototypeOf(w,S):w.__proto__=S)}var m=["XX00000XXX","XX10000XXX","XX20000XXX","XXX00000XX","XXXX00000X","XXXXX00005","XXXXX00006","XXXXX00007","XXXXX00008","XXXXX00009"],b=[["EEEOOO","OOOEEE"],["EEOEOO","OOEOEE"],["EEOOEO","OOEEOE"],["EEOOOE","OOEEEO"],["EOEEOO","OEOOEE"],["EOOEEO","OEEOOE"],["EOOOEE","OEEEOO"],["EOEOEO","OEOEOE"],["EOEOOE","OEOEEO"],["EOOEOE","OEEOEO"]],v=(function(w){f(S,w);function S(M,B){p(this,S);var U=g(this,(S.__proto__||Object.getPrototypeOf(S)).call(this,M,B));if(U.isValid=!1,M.search(/^[0-9]{6}$/)!==-1)U.middleDigits=M,U.upcA=_(M,"0"),U.text=B.text||""+U.upcA[0]+M+U.upcA[U.upcA.length-1],U.isValid=!0;else if(M.search(/^[01][0-9]{7}$/)!==-1)if(U.middleDigits=M.substring(1,M.length-1),U.upcA=_(U.middleDigits,M[0]),U.upcA[U.upcA.length-1]===M[M.length-1])U.isValid=!0;else return g(U);else return g(U);return U.displayValue=B.displayValue,B.fontSize>B.width*10?U.fontSize=B.width*10:U.fontSize=B.fontSize,U.guardHeight=B.height+U.fontSize/2+B.textMargin,U}return i(S,[{key:"valid",value:function(){return this.isValid}},{key:"encode",value:function(){return this.options.flat?this.flatEncoding():this.guardedEncoding()}},{key:"flatEncoding",value:function(){var B="";return B+="101",B+=this.encodeMiddleDigits(),B+="010101",{data:B,text:this.text}}},{key:"guardedEncoding",value:function(){var B=[];return this.displayValue&&B.push({data:"00000000",text:this.text[0],options:{textAlign:"left",fontSize:this.fontSize}}),B.push({data:"101",options:{height:this.guardHeight}}),B.push({data:this.encodeMiddleDigits(),text:this.text.substring(1,7),options:{fontSize:this.fontSize}}),B.push({data:"010101",options:{height:this.guardHeight}}),this.displayValue&&B.push({data:"00000000",text:this.text[7],options:{textAlign:"right",fontSize:this.fontSize}}),B}},{key:"encodeMiddleDigits",value:function(){var B=this.upcA[0],U=this.upcA[this.upcA.length-1],ie=b[parseInt(U)][parseInt(B)];return(0,r.default)(this.middleDigits,ie)}}]),S})(l.default);function _(w,S){for(var M=parseInt(w[w.length-1]),B=m[M],U="",ie=0,ce=0;ce<B.length;ce++){var C=B[ce];C==="X"?U+=w[ie++]:U+=C}return U=""+S+U,""+U+(0,c.checksum)(U)}return dc.default=v,dc}var Wy;function XO(){if(Wy)return Ut;Wy=1,Object.defineProperty(Ut,"__esModule",{value:!0}),Ut.UPCE=Ut.UPC=Ut.EAN2=Ut.EAN5=Ut.EAN8=Ut.EAN13=void 0;var i=GO(),t=v(i),r=FO(),s=v(r),l=VO(),c=v(l),d=YO(),p=v(d),g=pv(),f=v(g),m=KO(),b=v(m);function v(_){return _&&_.__esModule?_:{default:_}}return Ut.EAN13=t.default,Ut.EAN8=s.default,Ut.EAN5=c.default,Ut.EAN2=p.default,Ut.UPC=f.default,Ut.UPCE=b.default,Ut}var Li={},mc={},Ms={},e1;function JO(){return e1||(e1=1,Object.defineProperty(Ms,"__esModule",{value:!0}),Ms.START_BIN="1010",Ms.END_BIN="11101",Ms.BINARIES=["00110","10001","01001","11000","00101","10100","01100","00011","10010","01010"]),Ms}var t1;function gv(){if(t1)return mc;t1=1,Object.defineProperty(mc,"__esModule",{value:!0});var i=(function(){function f(m,b){for(var v=0;v<b.length;v++){var _=b[v];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(m,_.key,_)}}return function(m,b,v){return b&&f(m.prototype,b),v&&f(m,v),m}})(),t=JO(),r=gn(),s=l(r);function l(f){return f&&f.__esModule?f:{default:f}}function c(f,m){if(!(f instanceof m))throw new TypeError("Cannot call a class as a function")}function d(f,m){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:f}function p(f,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);f.prototype=Object.create(m&&m.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(f,m):f.__proto__=m)}var g=(function(f){p(m,f);function m(){return c(this,m),d(this,(m.__proto__||Object.getPrototypeOf(m)).apply(this,arguments))}return i(m,[{key:"valid",value:function(){return this.data.search(/^([0-9]{2})+$/)!==-1}},{key:"encode",value:function(){var v=this,_=this.data.match(/.{2}/g).map(function(w){return v.encodePair(w)}).join("");return{data:t.START_BIN+_+t.END_BIN,text:this.text}}},{key:"encodePair",value:function(v){var _=t.BINARIES[v[1]];return t.BINARIES[v[0]].split("").map(function(w,S){return(w==="1"?"111":"1")+(_[S]==="1"?"000":"0")}).join("")}}]),m})(s.default);return mc.default=g,mc}var pc={},n1;function QO(){if(n1)return pc;n1=1,Object.defineProperty(pc,"__esModule",{value:!0});var i=(function(){function f(m,b){for(var v=0;v<b.length;v++){var _=b[v];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(m,_.key,_)}}return function(m,b,v){return b&&f(m.prototype,b),v&&f(m,v),m}})(),t=gv(),r=s(t);function s(f){return f&&f.__esModule?f:{default:f}}function l(f,m){if(!(f instanceof m))throw new TypeError("Cannot call a class as a function")}function c(f,m){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:f}function d(f,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);f.prototype=Object.create(m&&m.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(f,m):f.__proto__=m)}var p=function(m){var b=m.substr(0,13).split("").map(function(v){return parseInt(v,10)}).reduce(function(v,_,w){return v+_*(3-w%2*2)},0);return Math.ceil(b/10)*10-b},g=(function(f){d(m,f);function m(b,v){return l(this,m),b.search(/^[0-9]{13}$/)!==-1&&(b+=p(b)),c(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,b,v))}return i(m,[{key:"valid",value:function(){return this.data.search(/^[0-9]{14}$/)!==-1&&+this.data[13]===p(this.data)}}]),m})(r.default);return pc.default=g,pc}var r1;function ZO(){if(r1)return Li;r1=1,Object.defineProperty(Li,"__esModule",{value:!0}),Li.ITF14=Li.ITF=void 0;var i=gv(),t=l(i),r=QO(),s=l(r);function l(c){return c&&c.__esModule?c:{default:c}}return Li.ITF=t.default,Li.ITF14=s.default,Li}var on={},gc={},i1;function wo(){if(i1)return gc;i1=1,Object.defineProperty(gc,"__esModule",{value:!0});var i=(function(){function f(m,b){for(var v=0;v<b.length;v++){var _=b[v];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(m,_.key,_)}}return function(m,b,v){return b&&f(m.prototype,b),v&&f(m,v),m}})(),t=gn(),r=s(t);function s(f){return f&&f.__esModule?f:{default:f}}function l(f,m){if(!(f instanceof m))throw new TypeError("Cannot call a class as a function")}function c(f,m){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:f}function d(f,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);f.prototype=Object.create(m&&m.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(f,m):f.__proto__=m)}var p=(function(f){d(m,f);function m(b,v){return l(this,m),c(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,b,v))}return i(m,[{key:"encode",value:function(){for(var v="110",_=0;_<this.data.length;_++){var w=parseInt(this.data[_]),S=w.toString(2);S=g(S,4-S.length);for(var M=0;M<S.length;M++)v+=S[M]=="0"?"100":"110"}return v+="1001",{data:v,text:this.text}}},{key:"valid",value:function(){return this.data.search(/^[0-9]+$/)!==-1}}]),m})(r.default);function g(f,m){for(var b=0;b<m;b++)f="0"+f;return f}return gc.default=p,gc}var yc={},Ja={},s1;function gu(){if(s1)return Ja;s1=1,Object.defineProperty(Ja,"__esModule",{value:!0}),Ja.mod10=i,Ja.mod11=t;function i(r){for(var s=0,l=0;l<r.length;l++){var c=parseInt(r[l]);(l+r.length)%2===0?s+=c:s+=c*2%10+Math.floor(c*2/10)}return(10-s%10)%10}function t(r){for(var s=0,l=[2,3,4,5,6,7],c=0;c<r.length;c++){var d=parseInt(r[r.length-1-c]);s+=l[c%l.length]*d}return(11-s%11)%11}return Ja}var a1;function WO(){if(a1)return yc;a1=1,Object.defineProperty(yc,"__esModule",{value:!0});var i=wo(),t=s(i),r=gu();function s(g){return g&&g.__esModule?g:{default:g}}function l(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}function c(g,f){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:g}function d(g,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);g.prototype=Object.create(f&&f.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(g,f):g.__proto__=f)}var p=(function(g){d(f,g);function f(m,b){return l(this,f),c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,m+(0,r.mod10)(m),b))}return f})(t.default);return yc.default=p,yc}var bc={},o1;function eA(){if(o1)return bc;o1=1,Object.defineProperty(bc,"__esModule",{value:!0});var i=wo(),t=s(i),r=gu();function s(g){return g&&g.__esModule?g:{default:g}}function l(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}function c(g,f){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:g}function d(g,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);g.prototype=Object.create(f&&f.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(g,f):g.__proto__=f)}var p=(function(g){d(f,g);function f(m,b){return l(this,f),c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,m+(0,r.mod11)(m),b))}return f})(t.default);return bc.default=p,bc}var vc={},l1;function tA(){if(l1)return vc;l1=1,Object.defineProperty(vc,"__esModule",{value:!0});var i=wo(),t=s(i),r=gu();function s(g){return g&&g.__esModule?g:{default:g}}function l(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}function c(g,f){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:g}function d(g,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);g.prototype=Object.create(f&&f.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(g,f):g.__proto__=f)}var p=(function(g){d(f,g);function f(m,b){return l(this,f),m+=(0,r.mod10)(m),m+=(0,r.mod10)(m),c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,m,b))}return f})(t.default);return vc.default=p,vc}var xc={},c1;function nA(){if(c1)return xc;c1=1,Object.defineProperty(xc,"__esModule",{value:!0});var i=wo(),t=s(i),r=gu();function s(g){return g&&g.__esModule?g:{default:g}}function l(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}function c(g,f){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:g}function d(g,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);g.prototype=Object.create(f&&f.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(g,f):g.__proto__=f)}var p=(function(g){d(f,g);function f(m,b){return l(this,f),m+=(0,r.mod11)(m),m+=(0,r.mod10)(m),c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,m,b))}return f})(t.default);return xc.default=p,xc}var u1;function rA(){if(u1)return on;u1=1,Object.defineProperty(on,"__esModule",{value:!0}),on.MSI1110=on.MSI1010=on.MSI11=on.MSI10=on.MSI=void 0;var i=wo(),t=m(i),r=WO(),s=m(r),l=eA(),c=m(l),d=tA(),p=m(d),g=nA(),f=m(g);function m(b){return b&&b.__esModule?b:{default:b}}return on.MSI=t.default,on.MSI10=s.default,on.MSI11=c.default,on.MSI1010=p.default,on.MSI1110=f.default,on}var Qa={},f1;function iA(){if(f1)return Qa;f1=1,Object.defineProperty(Qa,"__esModule",{value:!0}),Qa.pharmacode=void 0;var i=(function(){function g(f,m){for(var b=0;b<m.length;b++){var v=m[b];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(f,v.key,v)}}return function(f,m,b){return m&&g(f.prototype,m),b&&g(f,b),f}})(),t=gn(),r=s(t);function s(g){return g&&g.__esModule?g:{default:g}}function l(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}function c(g,f){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:g}function d(g,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);g.prototype=Object.create(f&&f.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(g,f):g.__proto__=f)}var p=(function(g){d(f,g);function f(m,b){l(this,f);var v=c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,m,b));return v.number=parseInt(m,10),v}return i(f,[{key:"encode",value:function(){for(var b=this.number,v="";!isNaN(b)&&b!=0;)b%2===0?(v="11100"+v,b=(b-2)/2):(v="100"+v,b=(b-1)/2);return v=v.slice(0,-2),{data:v,text:this.text}}},{key:"valid",value:function(){return this.number>=3&&this.number<=131070}}]),f})(r.default);return Qa.pharmacode=p,Qa}var Za={},h1;function sA(){if(h1)return Za;h1=1,Object.defineProperty(Za,"__esModule",{value:!0}),Za.codabar=void 0;var i=(function(){function g(f,m){for(var b=0;b<m.length;b++){var v=m[b];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(f,v.key,v)}}return function(f,m,b){return m&&g(f.prototype,m),b&&g(f,b),f}})(),t=gn(),r=s(t);function s(g){return g&&g.__esModule?g:{default:g}}function l(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}function c(g,f){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:g}function d(g,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);g.prototype=Object.create(f&&f.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(g,f):g.__proto__=f)}var p=(function(g){d(f,g);function f(m,b){l(this,f),m.search(/^[0-9\-\$\:\.\+\/]+$/)===0&&(m="A"+m+"A");var v=c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,m.toUpperCase(),b));return v.text=v.options.text||v.text.replace(/[A-D]/g,""),v}return i(f,[{key:"valid",value:function(){return this.data.search(/^[A-D][0-9\-\$\:\.\+\/]+[A-D]$/)!==-1}},{key:"encode",value:function(){for(var b=[],v=this.getEncodings(),_=0;_<this.data.length;_++)b.push(v[this.data.charAt(_)]),_!==this.data.length-1&&b.push("0");return{text:this.text,data:b.join("")}}},{key:"getEncodings",value:function(){return{0:"101010011",1:"101011001",2:"101001011",3:"110010101",4:"101101001",5:"110101001",6:"100101011",7:"100101101",8:"100110101",9:"110100101","-":"101001101",$:"101100101",":":"1101011011","/":"1101101011",".":"1101101101","+":"1011011011",A:"1011001001",B:"1001001011",C:"1010010011",D:"1010011001"}}}]),f})(r.default);return Za.codabar=p,Za}var zi={},_c={},Rs={},d1;function aA(){return d1||(d1=1,Object.defineProperty(Rs,"__esModule",{value:!0}),Rs.SYMBOLS=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","-","."," ","$","/","+","%","($)","(%)","(/)","(+)","ÿ"],Rs.BINARIES=["100010100","101001000","101000100","101000010","100101000","100100100","100100010","101010000","100010010","100001010","110101000","110100100","110100010","110010100","110010010","110001010","101101000","101100100","101100010","100110100","100011010","101011000","101001100","101000110","100101100","100010110","110110100","110110010","110101100","110100110","110010110","110011010","101101100","101100110","100110110","100111010","100101110","111010100","111010010","111001010","101101110","101110110","110101110","100100110","111011010","111010110","100110010","101011110"],Rs.MULTI_SYMBOLS={"\0":["(%)","U"],"":["($)","A"],"":["($)","B"],"":["($)","C"],"":["($)","D"],"":["($)","E"],"":["($)","F"],"\x07":["($)","G"],"\b":["($)","H"]," ":["($)","I"],"\n":["($)","J"],"\v":["($)","K"],"\f":["($)","L"],"\r":["($)","M"],"":["($)","N"],"":["($)","O"],"":["($)","P"],"":["($)","Q"],"":["($)","R"],"":["($)","S"],"":["($)","T"],"":["($)","U"],"":["($)","V"],"":["($)","W"],"":["($)","X"],"":["($)","Y"],"":["($)","Z"],"\x1B":["(%)","A"],"":["(%)","B"],"":["(%)","C"],"":["(%)","D"],"":["(%)","E"],"!":["(/)","A"],'"':["(/)","B"],"#":["(/)","C"],"&":["(/)","F"],"'":["(/)","G"],"(":["(/)","H"],")":["(/)","I"],"*":["(/)","J"],",":["(/)","L"],":":["(/)","Z"],";":["(%)","F"],"<":["(%)","G"],"=":["(%)","H"],">":["(%)","I"],"?":["(%)","J"],"@":["(%)","V"],"[":["(%)","K"],"\\":["(%)","L"],"]":["(%)","M"],"^":["(%)","N"],_:["(%)","O"],"`":["(%)","W"],a:["(+)","A"],b:["(+)","B"],c:["(+)","C"],d:["(+)","D"],e:["(+)","E"],f:["(+)","F"],g:["(+)","G"],h:["(+)","H"],i:["(+)","I"],j:["(+)","J"],k:["(+)","K"],l:["(+)","L"],m:["(+)","M"],n:["(+)","N"],o:["(+)","O"],p:["(+)","P"],q:["(+)","Q"],r:["(+)","R"],s:["(+)","S"],t:["(+)","T"],u:["(+)","U"],v:["(+)","V"],w:["(+)","W"],x:["(+)","X"],y:["(+)","Y"],z:["(+)","Z"],"{":["(%)","P"],"|":["(%)","Q"],"}":["(%)","R"],"~":["(%)","S"],"":["(%)","T"]}),Rs}var m1;function yv(){if(m1)return _c;m1=1,Object.defineProperty(_c,"__esModule",{value:!0});var i=(function(){function f(m,b){for(var v=0;v<b.length;v++){var _=b[v];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(m,_.key,_)}}return function(m,b,v){return b&&f(m.prototype,b),v&&f(m,v),m}})(),t=aA(),r=gn(),s=l(r);function l(f){return f&&f.__esModule?f:{default:f}}function c(f,m){if(!(f instanceof m))throw new TypeError("Cannot call a class as a function")}function d(f,m){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:f}function p(f,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);f.prototype=Object.create(m&&m.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(f,m):f.__proto__=m)}var g=(function(f){p(m,f);function m(b,v){return c(this,m),d(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,b,v))}return i(m,[{key:"valid",value:function(){return/^[0-9A-Z\-. $/+%]+$/.test(this.data)}},{key:"encode",value:function(){var v=this.data.split("").flatMap(function(M){return t.MULTI_SYMBOLS[M]||M}),_=v.map(function(M){return m.getEncoding(M)}).join(""),w=m.checksum(v,20),S=m.checksum(v.concat(w),15);return{text:this.text,data:m.getEncoding("ÿ")+_+m.getEncoding(w)+m.getEncoding(S)+m.getEncoding("ÿ")+"1"}}}],[{key:"getEncoding",value:function(v){return t.BINARIES[m.symbolValue(v)]}},{key:"getSymbol",value:function(v){return t.SYMBOLS[v]}},{key:"symbolValue",value:function(v){return t.SYMBOLS.indexOf(v)}},{key:"checksum",value:function(v,_){var w=v.slice().reverse().reduce(function(S,M,B){var U=B%_+1;return S+m.symbolValue(M)*U},0);return m.getSymbol(w%47)}}]),m})(s.default);return _c.default=g,_c}var wc={},p1;function oA(){if(p1)return wc;p1=1,Object.defineProperty(wc,"__esModule",{value:!0});var i=(function(){function g(f,m){for(var b=0;b<m.length;b++){var v=m[b];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(f,v.key,v)}}return function(f,m,b){return m&&g(f.prototype,m),b&&g(f,b),f}})(),t=yv(),r=s(t);function s(g){return g&&g.__esModule?g:{default:g}}function l(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}function c(g,f){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:g}function d(g,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);g.prototype=Object.create(f&&f.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(g,f):g.__proto__=f)}var p=(function(g){d(f,g);function f(m,b){return l(this,f),c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,m,b))}return i(f,[{key:"valid",value:function(){return/^[\x00-\x7f]+$/.test(this.data)}}]),f})(r.default);return wc.default=p,wc}var g1;function lA(){if(g1)return zi;g1=1,Object.defineProperty(zi,"__esModule",{value:!0}),zi.CODE93FullASCII=zi.CODE93=void 0;var i=yv(),t=l(i),r=oA(),s=l(r);function l(c){return c&&c.__esModule?c:{default:c}}return zi.CODE93=t.default,zi.CODE93FullASCII=s.default,zi}var Wa={},y1;function cA(){if(y1)return Wa;y1=1,Object.defineProperty(Wa,"__esModule",{value:!0}),Wa.GenericBarcode=void 0;var i=(function(){function g(f,m){for(var b=0;b<m.length;b++){var v=m[b];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(f,v.key,v)}}return function(f,m,b){return m&&g(f.prototype,m),b&&g(f,b),f}})(),t=gn(),r=s(t);function s(g){return g&&g.__esModule?g:{default:g}}function l(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}function c(g,f){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:g}function d(g,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);g.prototype=Object.create(f&&f.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(g,f):g.__proto__=f)}var p=(function(g){d(f,g);function f(m,b){return l(this,f),c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,m,b))}return i(f,[{key:"encode",value:function(){return{data:"10101010101010101010101010101010101010101",text:this.text}}},{key:"valid",value:function(){return!0}}]),f})(r.default);return Wa.GenericBarcode=p,Wa}var b1;function uA(){if(b1)return Wl;b1=1,Object.defineProperty(Wl,"__esModule",{value:!0});var i=LO(),t=HO(),r=XO(),s=ZO(),l=rA(),c=iA(),d=sA(),p=lA(),g=cA();return Wl.default={CODE39:i.CODE39,CODE128:t.CODE128,CODE128A:t.CODE128A,CODE128B:t.CODE128B,CODE128C:t.CODE128C,EAN13:r.EAN13,EAN8:r.EAN8,EAN5:r.EAN5,EAN2:r.EAN2,UPC:r.UPC,UPCE:r.UPCE,ITF14:s.ITF14,ITF:s.ITF,MSI:l.MSI,MSI10:l.MSI10,MSI11:l.MSI11,MSI1010:l.MSI1010,MSI1110:l.MSI1110,pharmacode:c.pharmacode,codabar:d.codabar,CODE93:p.CODE93,CODE93FullASCII:p.CODE93FullASCII,GenericBarcode:g.GenericBarcode},Wl}var Sc={},v1;function yu(){if(v1)return Sc;v1=1,Object.defineProperty(Sc,"__esModule",{value:!0});var i=Object.assign||function(t){for(var r=1;r<arguments.length;r++){var s=arguments[r];for(var l in s)Object.prototype.hasOwnProperty.call(s,l)&&(t[l]=s[l])}return t};return Sc.default=function(t,r){return i({},t,r)},Sc}var Ec={},x1;function fA(){if(x1)return Ec;x1=1,Object.defineProperty(Ec,"__esModule",{value:!0}),Ec.default=i;function i(t){var r=[];function s(l){if(Array.isArray(l))for(var c=0;c<l.length;c++)s(l[c]);else l.text=l.text||"",l.data=l.data||"",r.push(l)}return s(t),r}return Ec}var Oc={},_1;function hA(){if(_1)return Oc;_1=1,Object.defineProperty(Oc,"__esModule",{value:!0}),Oc.default=i;function i(t){return t.marginTop=t.marginTop||t.margin,t.marginBottom=t.marginBottom||t.margin,t.marginRight=t.marginRight||t.margin,t.marginLeft=t.marginLeft||t.margin,t}return Oc}var Ac={},jc={},Tc={},w1;function bv(){if(w1)return Tc;w1=1,Object.defineProperty(Tc,"__esModule",{value:!0}),Tc.default=i;function i(t){var r=["width","height","textMargin","fontSize","margin","marginTop","marginBottom","marginLeft","marginRight"];for(var s in r)r.hasOwnProperty(s)&&(s=r[s],typeof t[s]=="string"&&(t[s]=parseInt(t[s],10)));return typeof t.displayValue=="string"&&(t.displayValue=t.displayValue!="false"),t}return Tc}var Nc={},S1;function vv(){if(S1)return Nc;S1=1,Object.defineProperty(Nc,"__esModule",{value:!0});var i={width:2,height:100,format:"auto",displayValue:!0,fontOptions:"",font:"monospace",text:void 0,textAlign:"center",textPosition:"bottom",textMargin:2,fontSize:20,background:"#ffffff",lineColor:"#000000",margin:10,marginTop:void 0,marginBottom:void 0,marginLeft:void 0,marginRight:void 0,valid:function(){}};return Nc.default=i,Nc}var E1;function dA(){if(E1)return jc;E1=1,Object.defineProperty(jc,"__esModule",{value:!0});var i=bv(),t=l(i),r=vv(),s=l(r);function l(d){return d&&d.__esModule?d:{default:d}}function c(d){var p={};for(var g in s.default)s.default.hasOwnProperty(g)&&(d.hasAttribute("jsbarcode-"+g.toLowerCase())&&(p[g]=d.getAttribute("jsbarcode-"+g.toLowerCase())),d.hasAttribute("data-"+g.toLowerCase())&&(p[g]=d.getAttribute("data-"+g.toLowerCase())));return p.value=d.getAttribute("jsbarcode-value")||d.getAttribute("data-value"),p=(0,t.default)(p),p}return jc.default=c,jc}var kc={},Cc={},ln={},O1;function xv(){if(O1)return ln;O1=1,Object.defineProperty(ln,"__esModule",{value:!0}),ln.getTotalWidthOfEncodings=ln.calculateEncodingAttributes=ln.getBarcodePadding=ln.getEncodingHeight=ln.getMaximumHeightOfEncodings=void 0;var i=yu(),t=r(i);function r(f){return f&&f.__esModule?f:{default:f}}function s(f,m){return m.height+(m.displayValue&&f.text.length>0?m.fontSize+m.textMargin:0)+m.marginTop+m.marginBottom}function l(f,m,b){if(b.displayValue&&m<f){if(b.textAlign=="center")return Math.floor((f-m)/2);if(b.textAlign=="left")return 0;if(b.textAlign=="right")return Math.floor(f-m)}return 0}function c(f,m,b){for(var v=0;v<f.length;v++){var _=f[v],w=(0,t.default)(m,_.options),S;w.displayValue?S=g(_.text,w,b):S=0;var M=_.data.length*w.width;_.width=Math.ceil(Math.max(S,M)),_.height=s(_,w),_.barcodePadding=l(S,M,w)}}function d(f){for(var m=0,b=0;b<f.length;b++)m+=f[b].width;return m}function p(f){for(var m=0,b=0;b<f.length;b++)f[b].height>m&&(m=f[b].height);return m}function g(f,m,b){var v;if(b)v=b;else if(typeof document<"u")v=document.createElement("canvas").getContext("2d");else return 0;v.font=m.fontOptions+" "+m.fontSize+"px "+m.font;var _=v.measureText(f);if(!_)return 0;var w=_.width;return w}return ln.getMaximumHeightOfEncodings=p,ln.getEncodingHeight=s,ln.getBarcodePadding=l,ln.calculateEncodingAttributes=c,ln.getTotalWidthOfEncodings=d,ln}var A1;function mA(){if(A1)return Cc;A1=1,Object.defineProperty(Cc,"__esModule",{value:!0});var i=(function(){function p(g,f){for(var m=0;m<f.length;m++){var b=f[m];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(g,b.key,b)}}return function(g,f,m){return f&&p(g.prototype,f),m&&p(g,m),g}})(),t=yu(),r=l(t),s=xv();function l(p){return p&&p.__esModule?p:{default:p}}function c(p,g){if(!(p instanceof g))throw new TypeError("Cannot call a class as a function")}var d=(function(){function p(g,f,m){c(this,p),this.canvas=g,this.encodings=f,this.options=m}return i(p,[{key:"render",value:function(){if(!this.canvas.getContext)throw new Error("The browser does not support canvas.");this.prepareCanvas();for(var f=0;f<this.encodings.length;f++){var m=(0,r.default)(this.options,this.encodings[f].options);this.drawCanvasBarcode(m,this.encodings[f]),this.drawCanvasText(m,this.encodings[f]),this.moveCanvasDrawing(this.encodings[f])}this.restoreCanvas()}},{key:"prepareCanvas",value:function(){var f=this.canvas.getContext("2d");f.save(),(0,s.calculateEncodingAttributes)(this.encodings,this.options,f);var m=(0,s.getTotalWidthOfEncodings)(this.encodings),b=(0,s.getMaximumHeightOfEncodings)(this.encodings);this.canvas.width=m+this.options.marginLeft+this.options.marginRight,this.canvas.height=b,f.clearRect(0,0,this.canvas.width,this.canvas.height),this.options.background&&(f.fillStyle=this.options.background,f.fillRect(0,0,this.canvas.width,this.canvas.height)),f.translate(this.options.marginLeft,0)}},{key:"drawCanvasBarcode",value:function(f,m){var b=this.canvas.getContext("2d"),v=m.data,_;f.textPosition=="top"?_=f.marginTop+f.fontSize+f.textMargin:_=f.marginTop,b.fillStyle=f.lineColor;for(var w=0;w<v.length;w++){var S=w*f.width+m.barcodePadding;v[w]==="1"?b.fillRect(S,_,f.width,f.height):v[w]&&b.fillRect(S,_,f.width,f.height*v[w])}}},{key:"drawCanvasText",value:function(f,m){var b=this.canvas.getContext("2d"),v=f.fontOptions+" "+f.fontSize+"px "+f.font;if(f.displayValue){var _,w;f.textPosition=="top"?w=f.marginTop+f.fontSize-f.textMargin:w=f.height+f.textMargin+f.marginTop+f.fontSize,b.font=v,f.textAlign=="left"||m.barcodePadding>0?(_=0,b.textAlign="left"):f.textAlign=="right"?(_=m.width-1,b.textAlign="right"):(_=m.width/2,b.textAlign="center"),b.fillText(m.text,_,w)}}},{key:"moveCanvasDrawing",value:function(f){var m=this.canvas.getContext("2d");m.translate(f.width,0)}},{key:"restoreCanvas",value:function(){var f=this.canvas.getContext("2d");f.restore()}}]),p})();return Cc.default=d,Cc}var Mc={},j1;function pA(){if(j1)return Mc;j1=1,Object.defineProperty(Mc,"__esModule",{value:!0});var i=(function(){function g(f,m){for(var b=0;b<m.length;b++){var v=m[b];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(f,v.key,v)}}return function(f,m,b){return m&&g(f.prototype,m),b&&g(f,b),f}})(),t=yu(),r=l(t),s=xv();function l(g){return g&&g.__esModule?g:{default:g}}function c(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}var d="http://www.w3.org/2000/svg",p=(function(){function g(f,m,b){c(this,g),this.svg=f,this.encodings=m,this.options=b,this.document=b.xmlDocument||document}return i(g,[{key:"render",value:function(){var m=this.options.marginLeft;this.prepareSVG();for(var b=0;b<this.encodings.length;b++){var v=this.encodings[b],_=(0,r.default)(this.options,v.options),w=this.createGroup(m,_.marginTop,this.svg);this.setGroupOptions(w,_),this.drawSvgBarcode(w,_,v),this.drawSVGText(w,_,v),m+=v.width}}},{key:"prepareSVG",value:function(){for(;this.svg.firstChild;)this.svg.removeChild(this.svg.firstChild);(0,s.calculateEncodingAttributes)(this.encodings,this.options);var m=(0,s.getTotalWidthOfEncodings)(this.encodings),b=(0,s.getMaximumHeightOfEncodings)(this.encodings),v=m+this.options.marginLeft+this.options.marginRight;this.setSvgAttributes(v,b),this.options.background&&this.drawRect(0,0,v,b,this.svg).setAttribute("fill",this.options.background)}},{key:"drawSvgBarcode",value:function(m,b,v){var _=v.data,w;b.textPosition=="top"?w=b.fontSize+b.textMargin:w=0;for(var S=0,M=0,B=0;B<_.length;B++)M=B*b.width+v.barcodePadding,_[B]==="1"?S++:S>0&&(this.drawRect(M-b.width*S,w,b.width*S,b.height,m),S=0);S>0&&this.drawRect(M-b.width*(S-1),w,b.width*S,b.height,m)}},{key:"drawSVGText",value:function(m,b,v){var _=this.document.createElementNS(d,"text");if(b.displayValue){var w,S;_.setAttribute("font-family",b.font),_.setAttribute("font-size",b.fontSize),b.fontOptions.includes("bold")&&_.setAttribute("font-weight","bold"),b.fontOptions.includes("italic")&&_.setAttribute("font-style","italic"),b.textPosition=="top"?S=b.fontSize-b.textMargin:S=b.height+b.textMargin+b.fontSize,b.textAlign=="left"||v.barcodePadding>0?(w=0,_.setAttribute("text-anchor","start")):b.textAlign=="right"?(w=v.width-1,_.setAttribute("text-anchor","end")):(w=v.width/2,_.setAttribute("text-anchor","middle")),_.setAttribute("x",w),_.setAttribute("y",S),_.appendChild(this.document.createTextNode(v.text)),m.appendChild(_)}}},{key:"setSvgAttributes",value:function(m,b){var v=this.svg;v.setAttribute("width",m+"px"),v.setAttribute("height",b+"px"),v.setAttribute("x","0px"),v.setAttribute("y","0px"),v.setAttribute("viewBox","0 0 "+m+" "+b),v.setAttribute("xmlns",d),v.setAttribute("version","1.1")}},{key:"createGroup",value:function(m,b,v){var _=this.document.createElementNS(d,"g");return _.setAttribute("transform","translate("+m+", "+b+")"),v.appendChild(_),_}},{key:"setGroupOptions",value:function(m,b){m.setAttribute("fill",b.lineColor)}},{key:"drawRect",value:function(m,b,v,_,w){var S=this.document.createElementNS(d,"rect");return S.setAttribute("x",m),S.setAttribute("y",b),S.setAttribute("width",v),S.setAttribute("height",_),w.appendChild(S),S}}]),g})();return Mc.default=p,Mc}var Rc={},T1;function gA(){if(T1)return Rc;T1=1,Object.defineProperty(Rc,"__esModule",{value:!0});var i=(function(){function s(l,c){for(var d=0;d<c.length;d++){var p=c[d];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(l,p.key,p)}}return function(l,c,d){return c&&s(l.prototype,c),d&&s(l,d),l}})();function t(s,l){if(!(s instanceof l))throw new TypeError("Cannot call a class as a function")}var r=(function(){function s(l,c,d){t(this,s),this.object=l,this.encodings=c,this.options=d}return i(s,[{key:"render",value:function(){this.object.encodings=this.encodings}}]),s})();return Rc.default=r,Rc}var N1;function yA(){if(N1)return kc;N1=1,Object.defineProperty(kc,"__esModule",{value:!0});var i=mA(),t=d(i),r=pA(),s=d(r),l=gA(),c=d(l);function d(p){return p&&p.__esModule?p:{default:p}}return kc.default={CanvasRenderer:t.default,SVGRenderer:s.default,ObjectRenderer:c.default},kc}var Ds={},k1;function _v(){if(k1)return Ds;k1=1,Object.defineProperty(Ds,"__esModule",{value:!0});function i(d,p){if(!(d instanceof p))throw new TypeError("Cannot call a class as a function")}function t(d,p){if(!d)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p&&(typeof p=="object"||typeof p=="function")?p:d}function r(d,p){if(typeof p!="function"&&p!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof p);d.prototype=Object.create(p&&p.prototype,{constructor:{value:d,enumerable:!1,writable:!0,configurable:!0}}),p&&(Object.setPrototypeOf?Object.setPrototypeOf(d,p):d.__proto__=p)}var s=(function(d){r(p,d);function p(g,f){i(this,p);var m=t(this,(p.__proto__||Object.getPrototypeOf(p)).call(this));return m.name="InvalidInputException",m.symbology=g,m.input=f,m.message='"'+m.input+'" is not a valid input for '+m.symbology,m}return p})(Error),l=(function(d){r(p,d);function p(){i(this,p);var g=t(this,(p.__proto__||Object.getPrototypeOf(p)).call(this));return g.name="InvalidElementException",g.message="Not supported type to render on",g}return p})(Error),c=(function(d){r(p,d);function p(){i(this,p);var g=t(this,(p.__proto__||Object.getPrototypeOf(p)).call(this));return g.name="NoElementException",g.message="No element to render on.",g}return p})(Error);return Ds.InvalidInputException=s,Ds.InvalidElementException=l,Ds.NoElementException=c,Ds}var C1;function bA(){if(C1)return Ac;C1=1,Object.defineProperty(Ac,"__esModule",{value:!0});var i=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(m){return typeof m}:function(m){return m&&typeof Symbol=="function"&&m.constructor===Symbol&&m!==Symbol.prototype?"symbol":typeof m},t=dA(),r=d(t),s=yA(),l=d(s),c=_v();function d(m){return m&&m.__esModule?m:{default:m}}function p(m){if(typeof m=="string")return g(m);if(Array.isArray(m)){for(var b=[],v=0;v<m.length;v++)b.push(p(m[v]));return b}else{if(typeof HTMLCanvasElement<"u"&&m instanceof HTMLImageElement)return f(m);if(m&&m.nodeName&&m.nodeName.toLowerCase()==="svg"||typeof SVGElement<"u"&&m instanceof SVGElement)return{element:m,options:(0,r.default)(m),renderer:l.default.SVGRenderer};if(typeof HTMLCanvasElement<"u"&&m instanceof HTMLCanvasElement)return{element:m,options:(0,r.default)(m),renderer:l.default.CanvasRenderer};if(m&&m.getContext)return{element:m,renderer:l.default.CanvasRenderer};if(m&&(typeof m>"u"?"undefined":i(m))==="object"&&!m.nodeName)return{element:m,renderer:l.default.ObjectRenderer};throw new c.InvalidElementException}}function g(m){var b=document.querySelectorAll(m);if(b.length!==0){for(var v=[],_=0;_<b.length;_++)v.push(p(b[_]));return v}}function f(m){var b=document.createElement("canvas");return{element:b,options:(0,r.default)(m),renderer:l.default.CanvasRenderer,afterRender:function(){m.setAttribute("src",b.toDataURL())}}}return Ac.default=p,Ac}var Dc={},M1;function vA(){if(M1)return Dc;M1=1,Object.defineProperty(Dc,"__esModule",{value:!0});var i=(function(){function s(l,c){for(var d=0;d<c.length;d++){var p=c[d];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(l,p.key,p)}}return function(l,c,d){return c&&s(l.prototype,c),d&&s(l,d),l}})();function t(s,l){if(!(s instanceof l))throw new TypeError("Cannot call a class as a function")}var r=(function(){function s(l){t(this,s),this.api=l}return i(s,[{key:"handleCatch",value:function(c){if(c.name==="InvalidInputException")if(this.api._options.valid!==this.api._defaults.valid)this.api._options.valid(!1);else throw c.message;else throw c;this.api.render=function(){}}},{key:"wrapBarcodeCall",value:function(c){try{var d=c.apply(void 0,arguments);return this.api._options.valid(!0),d}catch(p){return this.handleCatch(p),this.api}}}]),s})();return Dc.default=r,Dc}var Gh,R1;function xA(){if(R1)return Gh;R1=1;var i=uA(),t=B(i),r=yu(),s=B(r),l=fA(),c=B(l),d=hA(),p=B(d),g=bA(),f=B(g),m=bv(),b=B(m),v=vA(),_=B(v),w=_v(),S=vv(),M=B(S);function B(L){return L&&L.__esModule?L:{default:L}}var U=function(){},ie=function(G,W,Q){var he=new U;if(typeof G>"u")throw Error("No element to render on was provided.");return he._renderProperties=(0,f.default)(G),he._encodings=[],he._options=M.default,he._errorHandler=new _.default(he),typeof W<"u"&&(Q=Q||{},Q.format||(Q.format=re()),he.options(Q)[Q.format](W,Q).render()),he};ie.getModule=function(L){return t.default[L]};for(var ce in t.default)t.default.hasOwnProperty(ce)&&C(t.default,ce);function C(L,G){U.prototype[G]=U.prototype[G.toUpperCase()]=U.prototype[G.toLowerCase()]=function(W,Q){var he=this;return he._errorHandler.wrapBarcodeCall(function(){Q.text=typeof Q.text>"u"?void 0:""+Q.text;var _e=(0,s.default)(he._options,Q);_e=(0,b.default)(_e);var Te=L[G],Y=z(W,Te,_e);return he._encodings.push(Y),he})}}function z(L,G,W){L=""+L;var Q=new G(L,W);if(!Q.valid())throw new w.InvalidInputException(Q.constructor.name,L);var he=Q.encode();he=(0,c.default)(he);for(var _e=0;_e<he.length;_e++)he[_e].options=(0,s.default)(W,he[_e].options);return he}function re(){return t.default.CODE128?"CODE128":Object.keys(t.default)[0]}U.prototype.options=function(L){return this._options=(0,s.default)(this._options,L),this},U.prototype.blank=function(L){var G=new Array(L+1).join("0");return this._encodings.push({data:G}),this},U.prototype.init=function(){if(this._renderProperties){Array.isArray(this._renderProperties)||(this._renderProperties=[this._renderProperties]);var L;for(var G in this._renderProperties){L=this._renderProperties[G];var W=(0,s.default)(this._options,L.options);W.format=="auto"&&(W.format=re()),this._errorHandler.wrapBarcodeCall(function(){var Q=W.value,he=t.default[W.format.toUpperCase()],_e=z(Q,he,W);X(L,_e,W)})}}},U.prototype.render=function(){if(!this._renderProperties)throw new w.NoElementException;if(Array.isArray(this._renderProperties))for(var L=0;L<this._renderProperties.length;L++)X(this._renderProperties[L],this._encodings,this._options);else X(this._renderProperties,this._encodings,this._options);return this},U.prototype._defaults=M.default;function X(L,G,W){G=(0,c.default)(G);for(var Q=0;Q<G.length;Q++)G[Q].options=(0,s.default)(W,G[Q].options),(0,p.default)(G[Q].options);(0,p.default)(W);var he=L.renderer,_e=new he(L.element,G,W);_e.render(),L.afterRender&&L.afterRender()}return typeof window<"u"&&(window.JsBarcode=ie),typeof jQuery<"u"&&(jQuery.fn.JsBarcode=function(L,G){var W=[];return jQuery(this).each(function(){W.push(this)}),ie(W,L,G)}),Gh=ie,Gh}var _A=xA();const wA=Z_(_A),SA={[Pe.EXECUTED]:"Executed",[Pe.MATCHED_LIST]:"Matched list",[Pe.CONFIRM_REQUIRED]:"Awaiting confirmation",[Pe.NO_MATCH_FALLBACK]:"No match",[Pe.UNCONFIGURED]:"Not configured",[Pe.INVALID_CODE]:"Invalid code",[Pe.FORBIDDEN]:"Not permitted",[Pe.CONFLICT]:"Conflict",[Pe.IDENTITY_PRIMED]:"Identity primed",[Pe.IDENTITY_UNKNOWN]:"Badge not recognized",[Pe.NOT_PRIMED]:"Badge required",[Pe.CHOICES]:"Choices presented"},wv={[Pe.EXECUTED]:"text-status-success",[Pe.MATCHED_LIST]:"text-status-success",[Pe.CONFIRM_REQUIRED]:"text-status-warning",[Pe.NO_MATCH_FALLBACK]:"text-text-secondary",[Pe.UNCONFIGURED]:"text-status-warning",[Pe.INVALID_CODE]:"text-status-error",[Pe.FORBIDDEN]:"text-status-error",[Pe.CONFLICT]:"text-status-warning",[Pe.IDENTITY_PRIMED]:"text-status-success",[Pe.IDENTITY_UNKNOWN]:"text-status-warning",[Pe.NOT_PRIMED]:"text-status-warning",[Pe.CHOICES]:"text-status-success"};function Sv(i){return i.outcome===Pe.IDENTITY_PRIMED&&i.actor?`Hi ${i.actor.displayName}`:`${SA[i.outcome]}${i.rule?` — ${i.rule.name}`:""}`}function ru(i){var t,r,s;return i.outcome===Pe.NO_MATCH_FALLBACK?((t=i.fallback)==null?void 0:t.markdown)??null:i.outcome===Pe.IDENTITY_UNKNOWN?((r=i.fallback)==null?void 0:r.markdown)??null:i.outcome===Pe.NOT_PRIMED?((s=i.notPrimed)==null?void 0:s.markdown)??null:null}function ri(i){return i.replace(/`([^`]+)`/g,'<code class="px-1 py-0.5 bg-surface-sunken rounded text-xs font-mono">$1</code>').replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>").replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" class="text-accent-primary hover:underline" target="_blank" rel="noopener noreferrer">$1</a>')}function Ev({content:i,compact:t}){const r=[],s=/^```(\w*)\n([\s\S]*?)^```$/gm;let l=0,c;for(;(c=s.exec(i))!==null;)c.index>l&&r.push({type:"text",text:i.slice(l,c.index)}),r.push({type:"code",lang:c[1],code:c[2].replace(/\n$/,"")}),l=c.index+c[0].length;l<i.length&&r.push({type:"text",text:i.slice(l)});const d=t?{text:"text-xs",heading:"text-xs",list:"text-xs",code:"text-2xs"}:{text:"text-sm",heading:"text-sm",list:"text-sm",code:"text-xs"},p=[];for(const g of r){if(g.type==="code"){const f=g.code.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");p.push(`<pre class="my-2 p-2.5 bg-surface-sunken rounded-md overflow-x-auto"><code class="${d.code} font-mono text-text-secondary leading-relaxed">${f}</code></pre>`);continue}p.push(...EA(g.text,d))}return y.jsx("div",{className:"prose-sm",dangerouslySetInnerHTML:{__html:p.join(`
54
- `)}})}function EA(i,t){const r=i.split(`
55
- `),s=[];let l=!1,c=!1,d=[];for(const p of r){const g=p.trim();if(g.startsWith("|")&&g.endsWith("|")){const f=g.slice(1,-1).split("|").map(m=>m.trim());if(f.every(m=>/^[-:]+$/.test(m)))continue;c||(c=!0,d=[]),d.push(f);continue}if(c){c=!1;const[f,...m]=d;s.push('<div class="overflow-x-auto my-2"><table class="text-xs w-full"><thead><tr>');for(const b of f)s.push(`<th class="text-left py-1 px-2 border-b border-border text-text-secondary font-medium">${ri(b)}</th>`);s.push("</tr></thead><tbody>");for(const b of m){s.push("<tr>");for(const v of b)s.push(`<td class="py-1 px-2 border-b border-border/50">${ri(v)}</td>`);s.push("</tr>")}s.push("</tbody></table></div>"),d=[]}if(!g){l&&(s.push("</ul>"),l=!1);continue}if(g.startsWith("### ")){l&&(s.push("</ul>"),l=!1),s.push(`<h4 class="${t.heading} font-semibold text-text-primary mt-3 mb-1">${ri(g.slice(4))}</h4>`);continue}if(g.startsWith("## ")){l&&(s.push("</ul>"),l=!1),s.push(`<h3 class="${t.heading} font-semibold text-text-primary mt-3 mb-1">${ri(g.slice(3))}</h3>`);continue}if(/^[-*_]{3,}$/.test(g)){l&&(s.push("</ul>"),l=!1),s.push('<hr class="border-border my-3" />');continue}if(/^[-*] /.test(g)){l||(s.push('<ul class="space-y-1 my-1">'),l=!0),s.push(`<li class="${t.list} text-text-secondary flex gap-2"><span class="text-text-tertiary shrink-0">-</span><span>${ri(g.slice(2))}</span></li>`);continue}l&&(s.push("</ul>"),l=!1),s.push(`<p class="${t.text} text-text-secondary my-1">${ri(g)}</p>`)}if(c&&d.length){const[p,...g]=d;s.push('<div class="overflow-x-auto my-2"><table class="text-xs w-full"><thead><tr>');for(const f of p)s.push(`<th class="text-left py-1 px-2 border-b border-border text-text-secondary font-medium">${ri(f)}</th>`);s.push("</tr></thead><tbody>");for(const f of g){s.push("<tr>");for(const m of f)s.push(`<td class="py-1 px-2 border-b border-border/50">${ri(m)}</td>`);s.push("</tr>")}s.push("</tbody></table></div>")}return l&&s.push("</ul>"),s}function OA(i){return i.replace(/[\u2010-\u2015\u2212]/g,"-").replace(/[\u2018\u2019]/g,"'").replace(/[\u201C\u201D]/g,'"').replace(/\u00A0/g," ").replace(/[\u200B-\u200D\uFEFF]/g,"").replace(/[\x00-\x1F\x7F]/g,"").trim()}function AA(i){const t=new Set;for(const r of i){const s=r.codePointAt(0);(s>127||s<32)&&t.add(`"${s<32?"\\x"+s.toString(16).padStart(2,"0"):r}" U+${s.toString(16).toUpperCase().padStart(4,"0")}`)}return[...t]}function jA({value:i}){const t=j.useRef(null),[r,s]=j.useState(!1);return j.useEffect(()=>{if(!(!t.current||!i))try{wA(t.current,i,{format:"CODE128",width:2,height:88,margin:12,displayValue:!0,fontSize:13,background:"#ffffff",lineColor:"#000000"}),s(!1)}catch{s(!0)}},[i]),i?y.jsxs("div",{children:[y.jsx("span",{className:"block text-xs uppercase tracking-wide text-text-tertiary mb-1",children:"Barcode"}),r?y.jsxs("p",{className:"text-xs text-status-error",children:["This value has characters Code 128 cannot carry:"," ",y.jsx("span",{className:"font-mono",children:AA(i).join(", ")||"unknown"})]}):y.jsx("div",{className:"bg-white rounded p-1 inline-block max-w-full overflow-hidden",children:y.jsx("svg",{ref:t,className:"max-w-full"})})]}):null}function TA({onClose:i}){const{submitCode:t,lastResult:r,busy:s,wedgeConfig:l,updateWedgeConfig:c,diagnostics:d,diagnosticsOn:p,setDiagnosticsOn:g}=dv(),[f,m]=j.useState(""),[b,v]=j.useState(!1),_=S=>{S.preventDefault();const M=f.trim();M&&(m(""),t(M))},w=(r==null?void 0:r.response)??null;return y.jsxs("div",{className:"flex flex-col h-full",children:[y.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border",children:[y.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-text-primary",children:[y.jsx(ou,{className:"w-4 h-4"}),"Scan"]}),y.jsx("button",{type:"button",onClick:i,className:"text-text-tertiary hover:text-text-primary",title:"Close",children:y.jsx(Cn,{className:"w-4 h-4"})})]}),y.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-4 space-y-6",children:[y.jsxs("form",{onSubmit:_,className:"space-y-2",children:[y.jsx("label",{className:"block text-xs uppercase tracking-wide text-text-tertiary",children:"Enter a code"}),y.jsxs("div",{className:"flex gap-2",children:[y.jsx("input",{value:f,onChange:S=>m(OA(S.target.value)),placeholder:"10:1:SN-12345",className:"flex-1 px-2 py-1.5 text-sm bg-surface-raised border border-surface-border rounded text-text-primary","data-scan-manual-entry":!0}),y.jsx("button",{type:"submit",disabled:s||!f.trim(),className:"px-3 py-1.5 text-sm rounded bg-accent text-text-inverse disabled:opacity-50",children:"Go"})]}),y.jsx("p",{className:"text-xs text-text-tertiary",children:"Scanning with a connected scanner works from any page — this entry exists for testing and for codes you can read but not scan. Typing here also draws the code below; point the scanner at the screen to fire it for real."})]}),y.jsx(jA,{value:f.trim()}),r&&y.jsxs("div",{className:"space-y-2",children:[y.jsx("div",{className:"text-xs uppercase tracking-wide text-text-tertiary",children:"Last scan"}),y.jsx("div",{className:"text-sm font-mono text-text-primary",children:r.code}),w?y.jsxs(y.Fragment,{children:[y.jsx("div",{className:`text-sm font-medium ${wv[w.outcome]}`,children:Sv(w)}),w.error&&y.jsx("div",{className:"text-xs text-text-tertiary",children:w.error}),ru(w)&&y.jsx("div",{className:"text-sm border-t border-surface-border pt-2",children:y.jsx(Ev,{content:ru(w),compact:!0})})]}):y.jsx("div",{className:"text-sm text-status-error",children:r.error})]}),y.jsxs("div",{className:"space-y-2",children:[y.jsxs("button",{type:"button",onClick:()=>v(S=>!S),className:"text-xs uppercase tracking-wide text-text-tertiary hover:text-text-primary",children:["Capture settings ",b?"▾":"▸"]}),b&&y.jsxs("div",{className:"space-y-3",children:[y.jsxs("label",{className:"block text-sm text-text-primary",children:[y.jsx("span",{className:"block text-xs text-text-tertiary mb-1",children:"Key gap limit (ms) — a longer pause between keys starts a new capture; raise it for scanners that pace slowly"}),y.jsx("input",{type:"number",min:100,max:2e3,step:50,value:l.maxKeyGapMs,onChange:S=>c({maxKeyGapMs:Number(S.target.value)}),className:"w-24 px-2 py-1 text-sm bg-surface-raised border border-surface-border rounded"})]}),y.jsxs("label",{className:"flex items-center gap-2 text-sm text-text-primary",children:[y.jsx("input",{type:"checkbox",checked:p,onChange:S=>g(S.target.checked)}),y.jsx("span",{children:"Diagnostics — trace every keydown the capture sees (also logged to the console)"})]}),p&&y.jsxs("div",{className:"border border-surface-border rounded",children:[y.jsx("div",{className:"px-2 py-1.5 text-2xs uppercase tracking-wide text-text-tertiary border-b border-surface-border",children:"Keydown trace — scan now, newest last"}),y.jsxs("div",{className:"max-h-64 overflow-y-auto font-mono text-2xs leading-5 px-2 py-1",children:[d.length===0&&y.jsx("div",{className:"text-text-tertiary",children:"Waiting for keys…"}),d.map(S=>y.jsxs("div",{className:"whitespace-nowrap overflow-hidden text-ellipsis",title:`buffer: ${S.buffer}`,children:[y.jsxs("span",{className:"text-text-tertiary",children:[String(S.deltaMs).padStart(4),"ms "]}),y.jsx("span",{className:"text",children:JSON.stringify(S.key)}),S.code&&y.jsxs("span",{className:"text-text-tertiary",children:[" (",S.code,")"]}),y.jsxs("span",{className:"text-text-tertiary",children:[" — ",S.note]})]},S.seq))]}),y.jsxs("div",{className:"px-2 py-1.5 text-2xs text-text-tertiary border-t border-surface-border",children:["Read it like this: a scan should end with an"," ",y.jsx("span",{className:"font-mono",children:'"Enter"'})," row saying"," ",y.jsx("span",{className:"font-mono",children:"capture → …"}),'. An Enter row saying "no code tail" means the buffer split (raise the gap limit, or a key arrived as something other than one character). No Enter row at all means the scanner sends no suffix — program its Enter/CR suffix. Keys named'," ",y.jsx("span",{className:"font-mono",children:'"Unidentified"'})," mean the decode arrives outside the keydown path."]})]})]})]})]})]})}const Ov="lt:bookmarks",qc="scan";function NA(){try{const i=localStorage.getItem(Ov);if(!i)return[];const t=JSON.parse(i);return Array.isArray(t)?t:[]}catch{return[]}}function D1(i){try{localStorage.setItem(Ov,JSON.stringify(i))}catch{}}function kA({onToggleEventFeed:i,onToggleDocs:t,onToggleNav:r}){var de,Oe;const s=go(),{user:l,logout:c}=Jt(),{viewAs:d,realIsBuilder:p}=Kb(),{available:g,mine:f}=mO();Xb();const{connected:m}=ZE(),{data:b}=Wn(),{setPanel:v,closePanel:_,open:w,ownerKey:S}=Yd(),M=fv(),B=pn(),U=()=>{w&&S===qc?_(qc):v(y.jsx(TA,{onClose:()=>_(qc)}),{width:360,key:qc})},[ie,ce]=j.useState(!1),[C,z]=j.useState(!1),[re,X]=j.useState(sv),[L,G]=j.useState(NA),W=j.useRef(null),Q=(de=b==null?void 0:b.branding)==null?void 0:de.appName,he=(Oe=b==null?void 0:b.branding)==null?void 0:Oe.themes,_e=j.useMemo(()=>(vO(he??[]),xO()),[he]),Te=oe=>{_O(oe),X(oe)},Y=()=>{const oe=window.prompt("Bookmark label:");if(!(oe!=null&&oe.trim()))return;const je=B.pathname+B.search,Se=[...L,{label:oe.trim(),url:je}].sort((Ne,be)=>Ne.label.localeCompare(be.label));G(Se),D1(Se),ce(!1)},ae=oe=>{const je=L.filter(Se=>!(Se.label===oe.label&&Se.url===oe.url));G(je),D1(je)};return j.useEffect(()=>{if(!ie)return;const oe=je=>{W.current&&!W.current.contains(je.target)&&ce(!1)};return document.addEventListener("mousedown",oe),()=>document.removeEventListener("mousedown",oe)},[ie]),y.jsxs(y.Fragment,{children:[y.jsxs("header",{className:`h-14 shrink-0 border-b border-surface-border bg-surface-raised flex items-center justify-between pl-2 pr-5 relative ${ie?"z-[100]":"z-30"}`,children:[y.jsxs("div",{className:"flex items-center gap-1 min-w-0",children:[r&&y.jsx("button",{onClick:r,className:"lg:hidden p-2 text-text-secondary hover:text-text-primary transition-colors","aria-label":"Open navigation",children:y.jsx(aw,{className:"w-5 h-5",strokeWidth:1.5})}),y.jsxs(Ii,{to:"/","aria-label":"Home",className:"shrink-0",onClick:oe=>{(oe.ctrlKey||oe.metaKey)&&(oe.preventDefault(),z(!0))},children:[y.jsx(nu,{appName:Q,className:"hidden lg:flex"}),y.jsx(nu,{appName:Q,variant:"comet",className:"flex lg:hidden"})]}),y.jsx("div",{className:"hidden lg:block w-px h-4 bg-surface-border mx-1"}),y.jsx("button",{onClick:()=>s(-1),className:"p-2 text-accent/60 hover:text-accent transition-colors","aria-label":"Go back",children:y.jsx(sb,{className:"w-5 h-5",strokeWidth:2})}),y.jsx("button",{onClick:()=>s(1),className:"p-2 text-accent/60 hover:text-accent transition-colors","aria-label":"Go forward",children:y.jsx(Kh,{className:"w-5 h-5",strokeWidth:2})})]}),y.jsxs("div",{className:"flex items-center gap-5",children:[y.jsxs(Ii,{to:"/escalations/available",className:`flex items-center gap-1.5 text-xs transition-colors ${g>0?"text-status-queued":"text-text-quaternary hover:text-text-secondary"}`,title:"All escalations",children:[y.jsx(Xh,{className:"w-4 h-4",strokeWidth:1.5}),y.jsx("span",{className:"hidden lg:inline",children:"all"}),g>0&&y.jsx("sup",{className:"tabular-nums font-medium text-[0.5em]",children:g})]}),y.jsxs(Ii,{to:"/escalations/queue",className:`flex items-center gap-1.5 text-xs transition-colors ${f>0?"text-status-claimed":"text-text-quaternary hover:text-text-secondary"}`,title:"My escalation queue",children:[y.jsx(Xh,{className:"w-4 h-4",strokeWidth:1.5}),y.jsx("span",{className:"hidden lg:inline",children:"mine"}),f>0&&y.jsx("sup",{className:"tabular-nums font-medium text-[0.5em]",children:f})]}),y.jsx("div",{className:"hidden lg:block w-px h-4 bg-surface-border"}),M&&y.jsxs("button",{type:"button",onClick:U,className:"flex items-center gap-1.5 text-xs text-text-quaternary hover:text-text-secondary transition-colors",title:"Scan a code",children:[y.jsx(ou,{className:"w-4 h-4",strokeWidth:1.5}),y.jsx("span",{className:"hidden lg:inline",children:"scan"})]}),y.jsxs("button",{type:"button",onClick:()=>{m?i==null||i():window.location.reload()},className:`hidden lg:flex items-center gap-1.5 text-xs transition-colors ${m?"text-status-success hover:text-status-success/80":"text-text-quaternary hover:text-text-secondary"}`,title:m?"Live events — click to toggle feed":"Events disconnected — click to reconnect",children:[y.jsx(ab,{className:"w-4 h-4",strokeWidth:1.5}),"events"]}),p&&y.jsx(y.Fragment,{children:y.jsxs("button",{onClick:t,className:"hidden lg:flex items-center gap-1.5 text-xs text-text-quaternary hover:text-text-secondary transition-colors",title:"Documentation",children:[y.jsx(ob,{className:"w-4 h-4",strokeWidth:1.5}),"docs"]})}),d&&y.jsx(y.Fragment,{children:y.jsxs("span",{className:"hidden lg:flex items-center gap-1 pl-2 pr-1 py-0.5 rounded-full bg-accent/10 border border-accent/25 text-2xs text-accent select-none",children:[y.jsxs("span",{className:"capitalize font-medium tracking-wide",children:[d," View"]}),y.jsx("button",{onClick:vd,title:"Restore your real view",className:"ml-0.5 rounded-full p-0.5 hover:bg-accent/20 transition-colors",children:y.jsx(Cn,{className:"w-2.5 h-2.5"})})]})}),y.jsx("div",{className:"hidden lg:block w-px h-4 bg-surface-border"}),l&&y.jsxs("div",{className:"relative",ref:W,children:[y.jsxs("button",{onClick:()=>ce(oe=>!oe),className:"btn-ghost flex items-center gap-1",children:[y.jsxs("span",{className:"relative",children:[y.jsx(ow,{className:"w-4 h-4 text-accent/75",strokeWidth:1.5}),d&&y.jsx("span",{className:"lg:hidden absolute -top-0.5 -right-0.5 w-2 h-2 rounded-full bg-accent"})]}),y.jsx("span",{className:"hidden lg:inline whitespace-nowrap",children:l.displayName||l.username||l.userId}),y.jsx("svg",{className:"hidden lg:block w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),ie&&y.jsxs("div",{className:"absolute right-0 top-full mt-1 w-52 bg-surface-raised border border-surface-border rounded-md shadow-lg py-1 z-[100]",children:[y.jsx(Ii,{to:"/credentials",onClick:()=>ce(!1),className:"block px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Credentials"}),y.jsx("button",{onClick:()=>{ce(!1),m?i==null||i():window.location.reload()},className:"lg:hidden block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:m?"Events":"Reconnect events"}),p&&y.jsx("button",{onClick:()=>{ce(!1),t==null||t()},className:"lg:hidden block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Docs"}),d&&y.jsxs("button",{onClick:()=>{ce(!1),vd()},className:"lg:hidden block w-full text-left px-3 py-2 text-xs text-accent hover:bg-surface-hover capitalize",children:["Exit ",d," view"]}),y.jsxs("div",{className:"px-3 py-2 border-t border-surface-border/60",children:[y.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-1.5",children:"Theme"}),y.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:_e.map(oe=>y.jsx("button",{type:"button",onClick:()=>Te(oe.id),title:oe.label,"aria-label":`${oe.label} theme`,className:`w-4 h-4 rounded-full transition-transform hover:scale-110 ${re===oe.id?"ring-2 ring-offset-1 ring-surface-border":""}`,style:{backgroundColor:oe.swatch}},oe.id))})]}),y.jsx("button",{onClick:()=>{ce(!1),c()},className:"block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Sign Out"}),y.jsxs("div",{className:"border-t border-surface-border/60 pt-1",children:[L.map(oe=>y.jsxs("div",{className:"flex items-center group px-3 py-1.5 hover:bg-surface-hover",children:[y.jsx(Ii,{to:oe.url,onClick:()=>ce(!1),title:oe.url,className:"flex-1 min-w-0 text-xs text-text-secondary hover:text-text-primary truncate",children:oe.label}),y.jsx("button",{type:"button",onClick:()=>ae(oe),title:`Remove "${oe.label}"`,className:"opacity-0 group-hover:opacity-100 transition-opacity ml-1 p-0.5 shrink-0 text-text-quaternary hover:text-status-error",children:y.jsx(Cn,{className:"w-3 h-3"})})]},`${oe.label}::${oe.url}`)),y.jsx("hr",{className:"border-surface-border/60 mx-3 my-0.5"}),y.jsxs("button",{type:"button",onClick:Y,className:"flex items-center gap-1.5 w-full px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:[y.jsx(lw,{className:"w-3.5 h-3.5 shrink-0",strokeWidth:1.5}),"Add Bookmark"]})]})]})]})]})]}),C&&y.jsx(bO,{onClose:()=>z(!1)})]})}function Kd({open:i,children:t}){const[r,s]=j.useState(i);return j.useEffect(()=>{i&&s(!0)},[i]),y.jsx("div",{className:`grid transition-[grid-template-rows] duration-300 ease-out ${i?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,onTransitionEnd:()=>{i||s(!1)},children:y.jsx("div",{className:"overflow-hidden",children:r?t:null})})}function wd(i){return({isActive:t})=>{const r="flex items-center rounded-md transition-colors duration-150",s="bg-surface-hover text-text-primary font-medium",l="text-text-secondary hover:text-text-primary hover:bg-surface-hover";return i?`${r} justify-center w-10 h-10 mx-auto ${t?s:l}`:`${r} gap-3 px-4 py-2 text-sm ${t?s:l}`}}function CA(){return({isActive:i})=>`flex items-center gap-3 pl-11 pr-4 py-1.5 text-xs rounded-md transition-colors duration-150 ${i?"text-text-primary font-medium":"text-text-secondary hover:text-text-primary"}`}function MA({group:i,collapsed:t}){const{pathname:r}=pn(),s=i.matchPaths.some(p=>r.startsWith(p)),[l,c]=j.useState(s),d=l||s;return t?y.jsx(y.Fragment,{children:i.items.map(p=>y.jsx(Hs,{to:p.to,className:wd(!0),title:p.label,children:p.icon&&y.jsx(p.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})},p.to))}):y.jsxs("div",{children:[y.jsxs("button",{onClick:()=>c(p=>!p),className:"w-full flex items-center justify-between px-4 py-2 text-sm rounded-md transition-colors duration-150 text-text-secondary hover:text-text-primary hover:bg-surface-hover",children:[y.jsxs("span",{className:"flex items-center gap-3",children:[i.icon&&y.jsx(i.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),y.jsx("span",{children:i.label})]}),y.jsx("svg",{className:`w-3.5 h-3.5 text-text-tertiary transition-transform duration-150 ${d?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),y.jsx(Kd,{open:d,children:i.items.map(p=>y.jsxs(Hs,{to:p.to,end:p.end,className:CA(),children:[p.icon&&y.jsx(p.icon,{className:"w-4 h-4 shrink-0 text-accent/75",strokeWidth:1.5}),y.jsx("span",{children:p.label})]},p.to))})]})}function RA(i){return i.kind==="group"}function DA({entry:i,collapsed:t}){const{pathname:r,search:s}=pn(),l=i.to.includes("?"),c=i.icon&&y.jsx(i.icon,{className:`w-5 h-5 shrink-0 text-accent/75 ${i.iconClassName??""}`,strokeWidth:1.5,...i.solid?{fill:"currentColor"}:{}});if(l){const[d,p]=i.to.split("?"),g=r===d&&s===`?${p}`,f=wd(t)({isActive:g});return y.jsxs(Hs,{to:i.to,className:f,title:t?i.label:void 0,children:[c,!t&&y.jsx("span",{children:i.label})]})}return y.jsxs(Hs,{to:i.to,end:i.end,className:wd(t),title:t?i.label:void 0,children:[c,!t&&y.jsx("span",{children:i.label})]})}function ui({heading:i,entries:t}){const{collapsed:r}=Fd();return y.jsxs("div",{className:"space-y-1",children:[r?y.jsx("div",{className:"h-px bg-surface-border mx-3 my-2",title:i}):y.jsx("p",{className:"px-4 pt-5 pb-2 text-xs font-semibold uppercase tracking-wider text-text-tertiary",children:i}),t.map(s=>RA(s)?y.jsx(MA,{group:s,collapsed:r},s.label):y.jsx(DA,{entry:s,collapsed:r},s.to))]})}function qA({aiEnabled:i=!1,isBuilder:t=!1,isOps:r=!1,viewAs:s=null,canSeePaceBoard:l=!1}){const c={to:"/operations",label:"Pace Board",icon:cw};if(!t&&(!r||s==="engineer"||s==="operator"))return l?y.jsx(ui,{heading:"Monitor",entries:[c]}):null;if(!t)return y.jsx(ui,{heading:"Monitor",entries:l?[c]:[]});const d=[...l?[c]:[],{to:"/topics",label:"Event Topics",icon:ab},{to:"/agents",label:i?"Agents":"Automations",icon:uw},{to:"/capabilities",label:"Capabilities",icon:fw}];return y.jsx(ui,{heading:"Monitor",entries:d})}function BA(){return pt({queryKey:["me","preferences"],queryFn:()=>Ae("/me/preferences"),staleTime:6e4})}function LA(){const i=gt();return Et({mutationFn:t=>Ae("/me/preferences",{method:"PATCH",body:JSON.stringify(t)}),onSuccess:t=>{i.setQueryData(["me","preferences"],t)}})}function zA(i){return i.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").split(/[-_\s]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function UA(i){var t;return((t=i.title)==null?void 0:t.trim())||zA(i.role)}function PA(i,t){const r=(i==null?void 0:i.pinnedViews)??[],s=new Set((i==null?void 0:i.hiddenRolePins)??[]),l=new Set(r.map(p=>p.label)),c=[...r],d=new Set;for(const{role:p,pins:g}of t)for(const f of g)l.has(f.label)||s.has(f.label)||d.has(f.label)||(d.add(f.label),c.push({...f,id:`role:${p}:${f.label}`,fromRole:p}));return c}function IA(i){let t;try{t=new URL(i,"http://local")}catch{return null}if(t.pathname!=="/escalations/available"&&t.pathname!=="/escalations")return null;const r=t.searchParams,s=MO(r),l=r.get("status")||void 0,c=t.pathname==="/escalations/available"&&(l===void 0||l==="available");return{available:c,params:{...s,role:r.get("role")||void 0,type:r.get("type")||void 0,priority:r.get("priority")?parseInt(r.get("priority"),10):void 0,status:c||l==="all"?void 0:l,search:r.get("search")||void 0}}}function $A(){return`pin-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function HA(){var C;const{collapsed:i}=Fd(),{user:t}=Jt(),r=BA(),s=LA(),l=j.useMemo(()=>new Set(((t==null?void 0:t.roles)??[]).map(z=>z.role)),[t]),{data:c}=Qb({enabled:l.size>0}),d=gt();Rd(Hd(),()=>{d.invalidateQueries({queryKey:["escalations"]})});const p=(C=r.data)==null?void 0:C.preferences,g=j.useMemo(()=>((c==null?void 0:c.roles)??[]).filter(z=>l.has(z.role)&&Array.isArray(z.default_pins)&&z.default_pins.length>0).map(z=>({role:z.role,pins:z.default_pins})),[c,l]),f=j.useMemo(()=>PA(p,g),[p,g]),m=j.useMemo(()=>new Map(((c==null?void 0:c.roles)??[]).map(z=>[z.role,UA(z)])),[c]),b=j.useMemo(()=>f.filter(z=>!z.fromRole),[f]),v=j.useMemo(()=>g.map(({role:z})=>({role:z,title:m.get(z)??z,pins:f.filter(re=>re.fromRole===z)})).filter(z=>z.pins.length>0),[g,m,f]),_=(p==null?void 0:p.pinnedViews)??[],w=j.useRef(null),S=z=>s.mutate({pinnedViews:z}),M=z=>S(_.filter(re=>re.id!==z)),B=z=>S([..._,{id:$A(),label:z.label,url:z.url,badge:z.badge}]),U=z=>s.mutate({hiddenRolePins:[...(p==null?void 0:p.hiddenRolePins)??[],z]}),ie=(z,re)=>{if(z===re)return;const X=[..._],[L]=X.splice(z,1);X.splice(re,0,L),S(X)};if(f.length===0)return null;const ce="px-4 pt-5 pb-2 text-xs font-semibold uppercase tracking-wider text-text-tertiary truncate";return y.jsxs("div",{className:"space-y-1",children:[i&&y.jsx("div",{className:"h-px bg-surface-border mx-3 my-2",title:"Pinned"}),!i&&b.length>0&&y.jsx("p",{className:ce,children:"Pinned"}),b.map(z=>{const re=_.findIndex(X=>X.id===z.id);return y.jsx(q1,{pin:z,collapsed:i,draggable:re!==-1,onDragStart:()=>{w.current=re},onDropOn:()=>{w.current!==null&&re!==-1&&ie(w.current,re),w.current=null},onRemove:()=>M(z.id)},z.id)}),v.map(z=>y.jsxs("div",{children:[!i&&y.jsx("p",{className:ce,title:`${z.title} — pins from the ${z.role} role`,"data-testid":"pin-group-label",children:z.title}),z.pins.map(re=>y.jsx(q1,{pin:re,collapsed:i,draggable:!1,onDragStart:()=>{},onDropOn:()=>{},onPromote:()=>B(re),onHide:()=>U(re.label)},re.id))]},z.role))]})}function q1({pin:i,collapsed:t,draggable:r,onDragStart:s,onDropOn:l,onRemove:c,onPromote:d,onHide:p}){const{pathname:g,search:f}=pn(),[m,b=""]=i.url.split("?"),v=g===m&&f===(b?`?${b}`:""),_="group flex items-center rounded-md transition-colors duration-150",w=v?"bg-surface-hover text-text-primary font-medium":"text-text-secondary hover:text-text-primary hover:bg-surface-hover";return t?y.jsx(Hs,{to:i.url,className:`${_} ${w} justify-center w-10 h-10 mx-auto`,title:i.label,children:y.jsx(zg,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})}):y.jsxs("div",{className:`${_} ${w} relative`,draggable:r,onDragStart:s,onDragOver:S=>S.preventDefault(),onDrop:l,children:[y.jsxs(Hs,{to:i.url,title:i.label,className:"flex items-center gap-2.5 pl-4 pr-3 py-1.5 text-[0.7875rem] flex-1 min-w-0",children:[y.jsx(zg,{className:"w-4 h-4 shrink-0 text-accent/75",strokeWidth:1.5,...i.fromRole?{}:{fill:"currentColor",fillOpacity:.15}}),y.jsx("span",{className:"truncate flex-1 min-w-0",children:i.label}),i.badge&&y.jsx(GA,{url:i.url})]}),y.jsxs("span",{className:"absolute right-1 top-1/2 -translate-y-1/2 flex items-center gap-0.5 rounded px-0.5 bg-surface-hover opacity-0 pointer-events-none group-hover:opacity-100 group-hover:pointer-events-auto transition-opacity",children:[d&&y.jsx("button",{onClick:d,title:"Make mine — copy into my pins",className:"p-1 text-text-quaternary hover:text-accent transition-colors",children:y.jsx(lb,{className:"w-3 h-3"})}),p&&y.jsx("button",{onClick:p,title:"Hide this role pin",className:"p-1 text-text-quaternary hover:text-status-error transition-colors",children:y.jsx(hw,{className:"w-3 h-3"})}),c&&y.jsx("button",{onClick:c,title:`Remove "${i.label}"`,className:"p-1 text-text-quaternary hover:text-status-error transition-colors",children:y.jsx(Cn,{className:"w-3 h-3"})})]})]})}function GA({url:i}){var d;const t=j.useMemo(()=>IA(i),[i]),r={limit:1,staleTime:15e3},s=tv({...(t==null?void 0:t.params)??{},...r,enabled:!!t&&t.available}),l=ev({...(t==null?void 0:t.params)??{},...r,enabled:!!t&&!t.available});if(!t)return null;const c=t.available?s:l;return c.isError||((d=c.data)==null?void 0:d.total)===void 0?null:y.jsx("span",{className:"shrink-0 text-right text-2xs leading-none tabular-nums text-accent/80 relative -top-[0.35em]",title:`${c.data.total} matching now`,children:c.data.total})}function FA(){var c;const{data:i}=Wn(),t=(c=i==null?void 0:i.features)==null?void 0:c.graphWorkflows,r=t===!0||t!==!1&&Vb(),s=[{to:"/workflows/registry",label:"Registry",icon:Ug},{to:"/workflows/durable/invoke",label:"Invoke",icon:Pg},{to:"/workflows/executions",label:"Executions",icon:Ig}],l=r?[{kind:"group",label:"Procedural",icon:dw,matchPaths:["/workflows/registry","/workflows/durable/invoke","/workflows/executions","/workflows/durable/executions","/workflows/start","/workflows/workers","/workflows/tasks"],items:s},{kind:"group",label:"Graph",icon:Sd,matchPaths:["/mcp/workflows","/mcp/executions"],items:[{to:"/mcp/workflows",label:"Configure",icon:Ug,end:!0},{to:"/mcp/workflows/invoke",label:"Invoke",icon:Pg},{to:"/mcp/executions",label:"Executions",icon:Ig}]}]:s;return y.jsx(ui,{heading:"Orchestrate",entries:l})}const VA=[{to:"/mcp/queries",label:"Designer",icon:mw},{to:"/mcp/servers",label:"Servers & Tools",icon:pw}];function YA(){return y.jsx(ui,{heading:"Design",entries:VA})}const KA=[{to:"/files",label:"Files",icon:gw},{to:"/knowledge",label:"Knowledge",icon:yw}];function XA(){return y.jsx(ui,{heading:"Storage",entries:KA})}function JA({isBuilder:i=!1,isOps:t=!1}){var d;const{data:r}=Wn(),s=((d=r==null?void 0:r.features)==null?void 0:d.dbMaintenance)!==!1,l=[{to:"/admin/users",label:"Accounts",icon:bw},...i||t?[{to:"/admin/roles",label:"Roles",icon:Xh},{to:"/admin/personas",label:"Personas",icon:vw},{to:"/admin/scan-codes",label:"Scan Codes",icon:ou}]:[]],c=[{to:"/admin/controlplane",label:"Routers",icon:xw},{to:"/admin/streams",label:"Messages",icon:_w},...s?[{to:"/admin/maintenance",label:"DB Maintenance",icon:ww}]:[]];return y.jsxs(y.Fragment,{children:[y.jsx(ui,{heading:"Identity & Access",entries:l}),i&&y.jsx(ui,{heading:"Infrastructure",entries:c})]})}function Av({aiEnabled:i,isBuilder:t,isOps:r,viewAs:s,canSeePaceBoard:l}){return y.jsxs(y.Fragment,{children:[y.jsx(qA,{aiEnabled:i,isBuilder:t,isOps:r,viewAs:s,canSeePaceBoard:l}),y.jsx(HA,{}),t&&y.jsx(FA,{}),t&&i&&y.jsx(YA,{}),t&&y.jsx(XA,{}),(t||r)&&y.jsx(JA,{isBuilder:t,isOps:r})]})}function QA({open:i,onClose:t,...r}){const s=pn();return j.useEffect(()=>{t()},[s.pathname]),y.jsxs("div",{className:`lg:hidden fixed inset-y-0 left-0 z-40 flex ${i?"":"pointer-events-none"}`,children:[y.jsx("div",{className:`fixed inset-0 bg-black/20 transition-opacity duration-200 ${i?"opacity-100":"opacity-0"}`,onClick:t,"aria-hidden":!0}),y.jsxs("div",{className:`relative w-72 max-w-[85vw] h-full bg-surface-raised border-r border-surface-border shadow-xl flex flex-col transition-transform duration-200 ease-out ${i?"translate-x-0":"-translate-x-full"}`,children:[y.jsx("div",{className:"flex items-center justify-end px-3 pt-3 shrink-0",children:y.jsx("button",{onClick:t,className:"p-1.5 rounded text-text-tertiary hover:text-text-primary hover:bg-surface-hover transition-colors","aria-label":"Close navigation",children:y.jsx(Cn,{className:"w-4 h-4"})})}),y.jsx("nav",{className:"flex-1 px-3 pb-4 space-y-2 overflow-y-auto overflow-x-hidden",children:y.jsx(fO,{children:y.jsx(Av,{...r})})})]})]})}const jv="lt_event_feed_patterns";function ZA(i,t){if(i.startsWith("/topics/")){const d=decodeURIComponent(i.replace("/topics/",""));if(d&&!d.includes("/"))return`lt.events.${d}`}const r=i.match(/^\/escalations\/detail\/(.+)/);if(r)return`lt.events.system.escalation.*.${r[1]}.>`;if(i.startsWith("/escalations")){const d=new URLSearchParams(t).get("role");return d?`lt.events.system.escalation.${Jb(d)}.>`:"lt.events.system.escalation.>"}const s=i.match(/^\/workflows\/(?:durable\/)?executions\/(.+)/);if(s)return`lt.events.system.workflow.${s[1]}.>`;if(i.startsWith("/workflows"))return"lt.events.system.workflow.>";const l=i.match(/^\/agents\/([^/]+)$/);if(l&&l[1]!=="new")return`lt.events.system.agent.${l[1]}.>`;if(i.startsWith("/agents"))return"lt.events.system.agent.>";if(i.startsWith("/knowledge"))return"lt.events.system.knowledge.>";if(i.startsWith("/files"))return"lt.events.system.file.>";if(i==="/")return"lt.events.system.>";const c=i.match(/^\/mcp\/executions\/(.+)/);return c?`lt.events.system.*.${c[1]}.>`:(i.startsWith("/mcp"),"lt.events.system.>")}function WA(){try{const i=localStorage.getItem(jv);return i?JSON.parse(i):[]}catch{return[]}}function Fh(i){try{localStorage.setItem(jv,JSON.stringify(i))}catch{}}function ej(){const{pathname:i,search:t}=pn(),[r,s]=j.useState(WA),l=j.useMemo(()=>ZA(i,t),[i,t]),c=j.useMemo(()=>{const f=new Set([l,...r]);return Array.from(f)},[l,r]),d=j.useCallback(f=>{const m=f.startsWith("lt.events.")?f:`lt.events.${f}`;s(b=>{if(b.includes(m))return b;const v=[...b,m];return Fh(v),v})},[]),p=j.useCallback(f=>{s(m=>{const b=m.filter(v=>v!==f);return Fh(b),b})},[]),g=j.useCallback(()=>{s([]),Fh([])},[]);return{patterns:c,pagePattern:l,userPatterns:r,addPattern:d,removePattern:p,clearUserPatterns:g}}function tj({children:i,className:t=""}){return y.jsx("p",{className:`text-2xs font-semibold uppercase tracking-widest text-text-tertiary ${t}`,children:i})}const Vh=280,B1="cubic-bezier(0.4, 0, 0.2, 1)",Bc=40;function nj(i){if(!i)return"scale(0.92)";const t=window.innerWidth,r=window.innerHeight,s=t-Bc*2,l=r-Bc*2,c=i.width/s,d=i.height/l,p=i.left+i.width/2-(Bc+s/2),g=i.top+i.height/2-(Bc+l/2);return`translate(${p}px, ${g}px) scale(${c}, ${d})`}function Tv({open:i,onClose:t,sourceRef:r,children:s}){const[l,c]=j.useState(null),d=j.useRef(null),p=j.useRef(!1);j.useEffect(()=>{var v,_;i&&!p.current?(d.current=((v=r==null?void 0:r.current)==null?void 0:v.getBoundingClientRect())??null,c("entering")):!i&&p.current&&l==="open"&&(d.current=((_=r==null?void 0:r.current)==null?void 0:_.getBoundingClientRect())??null,c("exiting")),p.current=i},[i,r,l]),j.useEffect(()=>{if(l!=="entering")return;const v=requestAnimationFrame(()=>{requestAnimationFrame(()=>c("open"))});return()=>cancelAnimationFrame(v)},[l]),j.useEffect(()=>{if(l)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[l]),j.useEffect(()=>{if(!l)return;const v=_=>{_.key==="Escape"&&t()};return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[l,t]);const g=j.useCallback(v=>{v.propertyName==="transform"&&l==="exiting"&&c(null)},[l]);if(j.useEffect(()=>{if(l!=="exiting")return;const v=setTimeout(()=>c(null),Vh+50);return()=>clearTimeout(v)},[l]),!l)return null;const f=l==="entering"||l==="exiting",m=f?nj(d.current):"none",b=f?0:1;return ib.createPortal(y.jsx("div",{className:"fixed inset-0 z-50 overflow-auto p-10",style:{transformOrigin:"center center",transition:`transform ${Vh}ms ${B1}, opacity ${Vh}ms ${B1}`,transform:m,opacity:b,backgroundColor:"rgb(var(--lt-surface))"},onTransitionEnd:g,children:s}),document.body)}function rj({className:i}){return y.jsx("svg",{className:i,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M4 12h8M4 18h12"})})}function ij({className:i}){return y.jsx("svg",{className:i,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 7l-5 5 5 5M16 7l5 5-5 5"})})}function sj({className:i}){return y.jsx("svg",{className:i,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 5H6a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2v-1M8 5a2 2 0 002 2h2a2 2 0 002-2M8 5a2 2 0 012-2h2a2 2 0 012 2m0 0h2a2 2 0 012 2v3"})})}function aj({className:i}){return y.jsx("svg",{className:i,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}function oj({className:i}){return y.jsx("svg",{className:i,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 9V4.5M9 9H4.5M9 9L3.5 3.5M9 15v4.5M9 15H4.5M9 15l-5.5 5.5M15 9h4.5M15 9V4.5M15 9l5.5-5.5M15 15h4.5M15 15v4.5m0-4.5l5.5 5.5"})})}function lj({className:i}){return y.jsx("svg",{className:i,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5v-4m0 4h-4m4 0l-5-5"})})}function cj(i){const t=i.trim().split(`
56
- `);if(t.length<2)return i;const r=p=>p.split("|").map(g=>g.trim()).filter(Boolean),s=r(t[0]),l=t.slice(2),c=s.map(p=>`<th class="px-3 py-1.5 text-left text-2xs font-semibold uppercase tracking-wider text-text-tertiary">${p}</th>`).join(""),d=l.map(p=>`<tr class="border-t border-surface-border">${r(p).map(m=>`<td class="px-3 py-1.5 text-xs text-text-secondary">${m}</td>`).join("")}</tr>`).join("");return`<table class="w-full my-3 text-xs"><thead><tr class="border-b border-surface-border">${c}</tr></thead><tbody>${d}</tbody></table>`}function Lc(i){return i.toLowerCase().replace(/<[^>]+>/g,"").replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").trim()}function uj(i){const t=[];let r=i.replace(/```(\w*)\n([\s\S]*?)```/g,(g,f,m)=>{const b=t.length;return t.push(`<pre class="bg-surface-sunken rounded p-3 my-2 overflow-x-auto text-2xs leading-relaxed"><code>${m}</code></pre>`),`\0CODE${b}\0`});const s=/^(\|.+\|)\n(\|[-| :]+\|)\n((?:\|.+\|\n?)+)/gm;r=r.replace(s,(g,f,m,b)=>cj(`${f}
53
+ ${p.stack}`),d.reject(f)):d.resolve(m))}});return y.requestSubject=t,this.protocol.publish(t,r,{reply:c,headers:s.headers}),d}else{const c=new _b(this.protocol.muxSubscriptions,t,s,l);this.protocol.request(c);try{this.publish(t,r,{reply:`${this.protocol.muxSubscriptions.baseInbox}${c.token}`,headers:s.headers})}catch(p){c.cancel(p)}const d=Promise.race([c.timer,c.deferred]);return d.catch(()=>{c.cancel()}),d}}flush(){return this.isClosed()?Promise.reject(me.errorForCode(le.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(me.errorForCode(le.ConnectionClosed)):this.isDraining()?Promise.reject(me.errorForCode(le.ConnectionDraining)):(this.draining=!0,this.protocol.drain())}isClosed(){return this.protocol.isClosed()}isDraining(){return this.draining}getServer(){const t=this.protocol.getServer();return t?t.listen:""}status(){const t=new Tt;return t.iterClosed.then(()=>{const r=this.listeners.indexOf(t);this.listeners.splice(r,1)}),this.listeners.push(t),t}get info(){return this.protocol.isClosed()?void 0:this.protocol.info}async context(){return(await this.request("$SYS.REQ.USER.INFO")).json((r,s)=>r==="time"?new Date(Date.parse(s)):s)}stats(){return{inBytes:this.protocol.inBytes,outBytes:this.protocol.outBytes,inMsgs:this.protocol.inMsgs,outMsgs:this.protocol.outMsgs}}async jetstreamManager(t={}){const r=new ME(this,t);if(t.checkAPI!==!1)try{await r.getAccountInfo()}catch(s){const l=s;throw l.code===le.NoResponders&&(l.code=le.JetStreamNotEnabled),l}return r}jetstream(t={}){return new Md(this,t)}getServerVersion(){const t=this.info;return t?$i(t.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw me.errorForCode(le.Disconnect);const t=Date.now();return await this.flush(),Date.now()-t}get features(){return this.protocol.features}get services(){return this._services||(this._services=new BE(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(me.errorForCode(le.ConnectionClosed)):this.isDraining()?Promise.reject(me.errorForCode(le.ConnectionDraining)):this.protocol.reconnect()}}class BE{constructor(t){A(this,"nc");this.nc=t}add(t){try{return new bo(this.nc,t).start()}catch(r){return Promise.reject(r)}}client(t,r){return new pE(this.nc,t,r)}}class LE{constructor(t,r,s){A(this,"bucket");A(this,"sm");A(this,"prefixLen");this.bucket=t,this.prefixLen=r,this.sm=s}get key(){return this.sm.subject.substring(this.prefixLen)}get value(){return this.sm.data}get delta(){return 0}get created(){return this.sm.time}get revision(){return this.sm.seq}get operation(){return this.sm.header.get(tu)||"PUT"}get length(){const t=this.sm.header.get($t.MessageSizeHdr)||"";return t!==""?parseInt(t,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class zE{constructor(t,r,s){A(this,"bucket");A(this,"key");A(this,"sm");this.bucket=t,this.key=r,this.sm=s}get value(){return this.sm.data}get created(){return new Date(jd(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){var t;return((t=this.sm.headers)==null?void 0:t.get(tu))||"PUT"}get delta(){return this.sm.info.pending}get length(){var r;const t=((r=this.sm.headers)==null?void 0:r.get($t.MessageSizeHdr))||"";return t!==""?parseInt(t,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class Cb extends jS{constructor(r,s,l){super(r.nc,s,l);A(this,"js");A(this,"monitor");this.js=r,this.monitor=null,this.sub.closed.then(()=>{this.monitor&&this.monitor.cancel()})}set info(r){this.sub.info=r}get info(){return this.sub.info}_resetOrderedConsumer(r){if(this.info===null||this.sub.isClosed())return;const s=Sr(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,s);const c=this.info;c.config.name=fi.next(),c.ordered_consumer_sequence.delivery_seq=0,c.flow_control.heartbeat_count=0,c.flow_control.fc_count=0,c.flow_control.consumer_restarts++,c.deliver=s,c.config.deliver_subject=s,c.config.deliver_policy=gt.StartSequence,c.config.opt_start_seq=r;const d={};d.stream_name=this.info.stream,d.config=c.config;const p=`${c.api.prefix}.CONSUMER.CREATE.${c.stream}`;this.js._request(p,d,{retries:-1}).then(y=>{const f=y,m=this.sub.info;m.last=f,this.info.config=f.config,this.info.name=f.name}).catch(y=>{const f=new me(`unable to recreate ordered consumer ${c.stream} at seq ${r}`,le.RequestError,y);this.sub.callback(f,{})})}_maybeSetupHbMonitoring(){var s,l;const r=((l=(s=this.info)==null?void 0:s.config)==null?void 0:l.idle_heartbeat)||0;r&&this._setupHbMonitoring(jd(r))}_setupHbMonitoring(r,s=0){const l={cancelAfter:0,maxOut:2};s&&(l.cancelAfter=s);const c=this.sub,d=p=>{var m,b,v,_;const y=oS(409,`${kn.IdleHeartbeatMissed}: ${p}`,this.sub.subject);if(!((m=this.info)==null?void 0:m.ordered))this.sub.callback(null,y);else{if(!this.js.nc.protocol.connected)return!1;const w=((v=(b=this.info)==null?void 0:b.ordered_consumer_sequence)==null?void 0:v.stream_seq)||0;return this._resetOrderedConsumer(w+1),(_=this.monitor)==null||_.restart(),!1}return!c.noIterator};this.monitor=new Nd(r,d,l)}_checkHbOrderConsumer(r){const s=r.headers.get($t.ConsumerStalledHdr);s!==""&&this.js.nc.publish(s);const l=parseInt(r.headers.get($t.LastConsumerSeqHdr),10),c=this.info.ordered_consumer_sequence;return this.info.flow_control.heartbeat_count++,l!==c.delivery_seq&&this._resetOrderedConsumer(c.stream_seq+1),!1}_checkOrderedConsumer(r){const s=this.info.ordered_consumer_sequence,l=r.info.streamSequence,c=r.info.deliverySequence;return c!=s.delivery_seq+1?(this._resetOrderedConsumer(s.stream_seq+1),!1):(s.delivery_seq=c,s.stream_seq=l,!0)}async destroy(){this.isClosed()||await this.drain();const r=this.sub.info,s=r.config.durable_name||r.name,l=`${r.api.prefix}.CONSUMER.DELETE.${r.stream}.${s}`;await r.api._request(l)}async consumerInfo(){const r=this.sub.info,s=r.config.durable_name||r.name,l=`${r.api.prefix}.CONSUMER.INFO.${r.stream}.${s}`,c=await r.api._request(l);return r.last=c,c}}class UE extends Cb{constructor(t,r,s){super(t,r,s)}pull(t={batch:1}){const{stream:r,config:s,name:l}=this.sub.info,c=s.durable_name??l,d={};if(d.batch=t.batch||1,d.no_wait=t.no_wait||!1,(t.max_bytes??0)>0){const f=this.js.nc.features.get(Ie.JS_PULL_MAX_BYTES);if(!f.ok)throw new Error(`max_bytes is only supported on servers ${f.min} or better`);d.max_bytes=t.max_bytes}let p=0;t.expires&&t.expires>0&&(p=t.expires,d.expires=it(p));let y=0;if(t.idle_heartbeat&&t.idle_heartbeat>0&&(y=t.idle_heartbeat,d.idle_heartbeat=it(y)),y&&p===0)throw new Error("idle_heartbeat requires expires");if(y>p)throw new Error("expires must be greater than idle_heartbeat");if(this.info){this.monitor&&this.monitor.cancel(),p&&y&&(this.monitor?this.monitor._change(y,p):this._setupHbMonitoring(y,p));const f=this.info.api,m=`${f.prefix}.CONSUMER.MSG.NEXT.${r}.${c}`,b=this.sub.subject;f.nc.publish(m,f.jc.encode(d),{reply:b})}}}function PE(i,t){return i?$E(t):IE(t)}function IE(i){return(t,r)=>t?[t,null]:(t=Ps(r),t?[t,null]:[null,mo(r,i)])}function $E(i){return(t,r)=>{if(t)return[t,null];const s=Ps(r);return s!==null?[Mb(s),null]:[null,mo(r,i)]}}function Mb(i){if(i!==null)switch(i.code){case le.JetStream404NoMessages:case le.JetStream408RequestTimeout:return null;case le.JetStream409:return lS(i)?i:null;default:return i}return null}function HE(i){i&&i.ack()}function GE(i){const t=i.split(".");if(t.length===9&&t.splice(2,0,"_",""),t.length<11||t[0]!=="$JS"||t[1]!=="ACK")throw new Error("not js message");const r={};return r.domain=t[2]==="_"?"":t[2],r.account_hash=t[3],r.stream=t[4],r.consumer=t[5],r.deliveryCount=parseInt(t[6],10),r.redeliveryCount=r.deliveryCount,r.redelivered=r.deliveryCount>1,r.streamSequence=parseInt(t[7],10),r.deliverySequence=parseInt(t[8],10),r.timestampNanos=parseInt(t[9],10),r.pending=parseInt(t[10],10),r}class FE{constructor(t,r){A(this,"msg");A(this,"di");A(this,"didAck");A(this,"timeout");this.msg=t,this.didAck=!1,this.timeout=r}get subject(){return this.msg.subject}get sid(){return this.msg.sid}get data(){return this.msg.data}get headers(){return this.msg.headers}get info(){return this.di||(this.di=GE(this.reply)),this.di}get redelivered(){return this.info.deliveryCount>1}get reply(){return this.msg.reply||""}get seq(){return this.info.streamSequence}doAck(t){this.didAck||(this.didAck=!this.isWIP(t),this.msg.respond(t))}isWIP(t){return t.length===4&&t[0]===Va[0]&&t[1]===Va[1]&&t[2]===Va[2]&&t[3]===Va[3]}async ackAck(t){var s;t=t||{},t.timeout=t.timeout||this.timeout;const r=st();if(this.didAck)r.resolve(!1);else if(this.didAck=!0,this.msg.reply){const c=this.msg.publisher,d=!((s=c.options)!=null&&s.noAsyncTraces),p=new _b(c.muxSubscriptions,this.msg.reply,{timeout:t.timeout},d);c.request(p);try{c.publish(this.msg.reply,vy,{reply:`${c.muxSubscriptions.baseInbox}${p.token}`})}catch(y){p.cancel(y)}try{await Promise.race([p.timer,p.deferred]),r.resolve(!0)}catch(y){p.cancel(y),r.reject(y)}}else r.resolve(!1);return r}ack(){this.doAck(vy)}nak(t){let r=OE;t&&(r=Wh().encode(`-NAK ${JSON.stringify({delay:it(t)})}`)),this.doAck(r)}working(){this.doAck(Va)}next(t,r={batch:1}){const s={};s.batch=r.batch||1,s.no_wait=r.no_wait||!1,r.expires&&r.expires>0&&(s.expires=it(r.expires));const l=Hn().encode(s),c=Vs.concat(AE,TE,l),d=t?{reply:t}:void 0;this.msg.respond(c,d)}term(t=""){let r=jE;(t==null?void 0:t.length)>0&&(r=Wh().encode(`+TERM ${t}`)),this.doAck(r)}json(){return this.msg.json()}string(){return this.msg.string()}}const VE="1.30.3",YE="nats.ws";class KE{constructor(){A(this,"version");A(this,"lang");A(this,"closeError");A(this,"connected");A(this,"done");A(this,"socket");A(this,"options");A(this,"socketClosed");A(this,"encrypted");A(this,"peeked");A(this,"yields");A(this,"signal");A(this,"closedNotification");this.version=VE,this.lang=YE,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=st(),this.closedNotification=st()}async connect(t,r){const s=st();if(r.tls)return s.reject(new me("tls",le.InvalidOption)),s;this.options=r;const l=t.src;if(r.wsFactory){const{socket:c,encrypted:d}=await r.wsFactory(t.src,r);this.socket=c,this.encrypted=d}else this.encrypted=l.indexOf("wss://")===0,this.socket=new WebSocket(l);return this.socket.binaryType="arraybuffer",this.socket.onopen=()=>{this.isDiscarded()},this.socket.onmessage=c=>{if(this.isDiscarded())return;if(this.yields.push(new Uint8Array(c.data)),this.peeked){this.signal.resolve();return}const d=Vs.concat(...this.yields),p=RS(d);if(p!==""){const y=oE.exec(p);if(!y){r.debug&&console.error("!!!",Fl(d)),s.reject(new Error("unexpected response from server"));return}try{const f=JSON.parse(y[1]);sE(f,this.options),this.peeked=!0,this.connected=!0,this.signal.resolve(),s.resolve()}catch(f){s.reject(f);return}}},this.socket.onclose=c=>{if(this.isDiscarded())return;this.socketClosed=!0;let d;this.done||(c.wasClean||(d=new Error(c.reason)),this._closed(d))},this.socket.onerror=c=>{if(this.isDiscarded())return;const d=c,p=new me(d.message,le.Unknown,new Error(d.error));s.reject(p)},s}disconnect(){this._closed(void 0,!0)}async _closed(t,r=!0){if(!this.isDiscarded()&&this.connected&&!this.done){if(this.closeError=t,!t)for(;!this.socketClosed&&this.socket.bufferedAmount>0;)await Ys(100);this.done=!0;try{this.socket.close(t?1002:1e3,t?t.message:void 0)}catch{}r&&this.closedNotification.resolve(t)}}get isClosed(){return this.done}[Symbol.asyncIterator](){return this.iterate()}async*iterate(){for(;;){if(this.isDiscarded())return;this.yields.length===0&&await this.signal;const t=this.yields;this.yields=[];for(let r=0;r<t.length;r++)this.options.debug&&console.info(`> ${Fl(t[r])}`),yield t[r];if(this.done)break;this.yields.length===0&&(t.length=0,this.yields=t,this.signal=st())}}isEncrypted(){return this.connected&&this.encrypted}send(t){if(!this.isDiscarded())try{this.socket.send(t.buffer),this.options.debug&&console.info(`< ${Fl(t)}`);return}catch(r){this.options.debug&&console.error(`!!! ${Fl(t)}: ${r}`)}}close(t){return this._closed(t,!1)}closed(){return this.closedNotification}isDiscarded(){return this.done?(this.discard(),!0):!1}discard(){var t;this.done=!0;try{(t=this.socket)==null||t.close()}catch{}}}function XE(i,t){/^(.*:\/\/)(.*)/.test(i)||(typeof t=="boolean"?i=`${t===!0?"https":"http"}://${i}`:i=`https://${i}`);let s=new URL(i);const l=s.protocol.toLowerCase();l==="ws:"&&(t=!1),l==="wss:"&&(t=!0),l!=="https:"&&l!=="http"&&(i=i.replace(/^(.*:\/\/)(.*)/gm,"$2"),s=new URL(`http://${i}`));let c,d;const p=s.hostname,y=s.pathname,f=s.search||"";switch(l){case"http:":case"ws:":case"nats:":d=s.port||"80",c="ws:";break;case"https:":case"wss:":case"tls:":d=s.port||"443",c="wss:";break;default:d=s.port||t===!0?"443":"80",c=t===!0?"wss:":"ws:";break}return`${c}//${p}:${d}${y}${f}`}function JE(i={}){return TS({defaultPort:443,urlParseFn:XE,factory:()=>new KE}),Rd.connect(i)}const QE=null,ZE=null,Rb="lt.events";function Db(i,t){const r=i.split("."),s=t.split(".");for(let l=0;l<s.length;l++){const c=s[l];if(c===">")return!0;if(l>=r.length||c!=="*"&&c!==r[l])return!1}return r.length===s.length}const Ks=j.createContext({connected:!1,subscribe:()=>()=>{}});function WE(){const{connected:i}=j.useContext(Ks);return{connected:i}}function e2(i,t){const{subscribe:r}=j.useContext(Ks),s=j.useRef(t);s.current=t,j.useEffect(()=>r(i,c=>s.current(c)),[r,i])}function Dd(i,t){const{subscribe:r}=j.useContext(Ks),s=j.useRef(t);s.current=t;const l=i.join(","),c=j.useMemo(()=>l.split(",").filter(Boolean),[l]);j.useEffect(()=>{const d=y=>s.current(y),p=c.map(y=>r(y,d));return()=>p.forEach(y=>y())},[r,c])}const t2=j.createContext({connected:!1,subscribe:()=>()=>{}}),n2=Wh();function r2({children:i,url:t,token:r}){const s=j.useRef(null),[l,c]=j.useState(!1),d=j.useRef(null),p=j.useRef(new Map),y=j.useRef(new Map),f=j.useCallback((_,w)=>{(async()=>{for await(const S of w)try{if(!Db(S.subject,_))continue;const M=JSON.parse(n2.decode(S.data)),B=p.current.get(_);if(!B)continue;for(const U of B)try{U(M)}catch{}}catch{}})()},[]),m=j.useCallback(_=>{var S;const w=s.current;if(!(!w||(S=w.isClosed)!=null&&S.call(w)||y.current.has(_)))try{const M=w.subscribe(_);y.current.set(_,M),f(_,M)}catch{}},[f]),b=j.useCallback((_,w)=>{const S=p.current;return S.has(_)||S.set(_,new Set),S.get(_).add(w),m(_),()=>{const M=S.get(_);if(M&&(M.delete(w),M.size===0)){S.delete(_);const B=y.current.get(_);if(B){y.current.delete(_);try{B.unsubscribe()}catch{}}}}},[m]),v=j.useCallback(async()=>{try{if(s.current)return;const _=t||QE;if(!_){console.error("[lt-nats] no NATS WebSocket URL configured — set NATS_WS_URL on the server");return}const w=await JE({servers:_,token:r||ZE||void 0,reconnect:!0,maxReconnectAttempts:-1,reconnectTimeWait:2e3});s.current=w,c(!0);for(const S of p.current.keys())m(S);(async()=>{for await(const S of w.status())S.type==="disconnect"||S.type==="error"?c(!1):S.type==="reconnect"&&c(!0)})()}catch{c(!1),d.current=setTimeout(v,3e3)}},[m]);return j.useEffect(()=>(v(),()=>{d.current&&clearTimeout(d.current);for(const _ of y.current.values())try{_.unsubscribe()}catch{}y.current.clear(),s.current&&(s.current.close().catch(()=>{}),s.current=null),c(!1)}),[v]),g.jsx(t2.Provider,{value:{connected:l,subscribe:b},children:g.jsx(Ks.Provider,{value:{connected:l,subscribe:b},children:i})})}const Zn=Object.create(null);Zn.open="0";Zn.close="1";Zn.ping="2";Zn.pong="3";Zn.message="4";Zn.upgrade="5";Zn.noop="6";const Hc=Object.create(null);Object.keys(Zn).forEach(i=>{Hc[Zn[i]]=i});const dd={type:"error",data:"parser error"},qb=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Bb=typeof ArrayBuffer=="function",Lb=i=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(i):i&&i.buffer instanceof ArrayBuffer,qd=({type:i,data:t},r,s)=>qb&&t instanceof Blob?r?s(t):_y(t,s):Bb&&(t instanceof ArrayBuffer||Lb(t))?r?s(t):_y(new Blob([t]),s):s(Zn[i]+(t||"")),_y=(i,t)=>{const r=new FileReader;return r.onload=function(){const s=r.result.split(",")[1];t("b"+(s||""))},r.readAsDataURL(i)};function wy(i){return i instanceof Uint8Array?i:i instanceof ArrayBuffer?new Uint8Array(i):new Uint8Array(i.buffer,i.byteOffset,i.byteLength)}let Ih;function i2(i,t){if(qb&&i.data instanceof Blob)return i.data.arrayBuffer().then(wy).then(t);if(Bb&&(i.data instanceof ArrayBuffer||Lb(i.data)))return t(wy(i.data));qd(i,!1,r=>{Ih||(Ih=new TextEncoder),t(Ih.encode(r))})}const Sy="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",io=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let i=0;i<Sy.length;i++)io[Sy.charCodeAt(i)]=i;const s2=i=>{let t=i.length*.75,r=i.length,s,l=0,c,d,p,y;i[i.length-1]==="="&&(t--,i[i.length-2]==="="&&t--);const f=new ArrayBuffer(t),m=new Uint8Array(f);for(s=0;s<r;s+=4)c=io[i.charCodeAt(s)],d=io[i.charCodeAt(s+1)],p=io[i.charCodeAt(s+2)],y=io[i.charCodeAt(s+3)],m[l++]=c<<2|d>>4,m[l++]=(d&15)<<4|p>>2,m[l++]=(p&3)<<6|y&63;return f},a2=typeof ArrayBuffer=="function",Bd=(i,t)=>{if(typeof i!="string")return{type:"message",data:zb(i,t)};const r=i.charAt(0);return r==="b"?{type:"message",data:o2(i.substring(1),t)}:Hc[r]?i.length>1?{type:Hc[r],data:i.substring(1)}:{type:Hc[r]}:dd},o2=(i,t)=>{if(a2){const r=s2(i);return zb(r,t)}else return{base64:!0,data:i}},zb=(i,t)=>{switch(t){case"blob":return i instanceof Blob?i:new Blob([i]);case"arraybuffer":default:return i instanceof ArrayBuffer?i:i.buffer}},Ub="",l2=(i,t)=>{const r=i.length,s=new Array(r);let l=0;i.forEach((c,d)=>{qd(c,!1,p=>{s[d]=p,++l===r&&t(s.join(Ub))})})},c2=(i,t)=>{const r=i.split(Ub),s=[];for(let l=0;l<r.length;l++){const c=Bd(r[l],t);if(s.push(c),c.type==="error")break}return s};function u2(){return new TransformStream({transform(i,t){i2(i,r=>{const s=r.length;let l;if(s<126)l=new Uint8Array(1),new DataView(l.buffer).setUint8(0,s);else if(s<65536){l=new Uint8Array(3);const c=new DataView(l.buffer);c.setUint8(0,126),c.setUint16(1,s)}else{l=new Uint8Array(9);const c=new DataView(l.buffer);c.setUint8(0,127),c.setBigUint64(1,BigInt(s))}i.data&&typeof i.data!="string"&&(l[0]|=128),t.enqueue(l),t.enqueue(r)})}})}let $h;function Xl(i){return i.reduce((t,r)=>t+r.length,0)}function Jl(i,t){if(i[0].length===t)return i.shift();const r=new Uint8Array(t);let s=0;for(let l=0;l<t;l++)r[l]=i[0][s++],s===i[0].length&&(i.shift(),s=0);return i.length&&s<i[0].length&&(i[0]=i[0].slice(s)),r}function f2(i,t){$h||($h=new TextDecoder);const r=[];let s=0,l=-1,c=!1;return new TransformStream({transform(d,p){for(r.push(d);;){if(s===0){if(Xl(r)<1)break;const y=Jl(r,1);c=(y[0]&128)===128,l=y[0]&127,l<126?s=3:l===126?s=1:s=2}else if(s===1){if(Xl(r)<2)break;const y=Jl(r,2);l=new DataView(y.buffer,y.byteOffset,y.length).getUint16(0),s=3}else if(s===2){if(Xl(r)<8)break;const y=Jl(r,8),f=new DataView(y.buffer,y.byteOffset,y.length),m=f.getUint32(0);if(m>Math.pow(2,21)-1){p.enqueue(dd);break}l=m*Math.pow(2,32)+f.getUint32(4),s=3}else{if(Xl(r)<l)break;const y=Jl(r,l);p.enqueue(Bd(c?y:$h.decode(y),t)),s=0}if(l===0||l>i){p.enqueue(dd);break}}}})}const Pb=4;function _t(i){if(i)return h2(i)}function h2(i){for(var t in _t.prototype)i[t]=_t.prototype[t];return i}_t.prototype.on=_t.prototype.addEventListener=function(i,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+i]=this._callbacks["$"+i]||[]).push(t),this};_t.prototype.once=function(i,t){function r(){this.off(i,r),t.apply(this,arguments)}return r.fn=t,this.on(i,r),this};_t.prototype.off=_t.prototype.removeListener=_t.prototype.removeAllListeners=_t.prototype.removeEventListener=function(i,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var r=this._callbacks["$"+i];if(!r)return this;if(arguments.length==1)return delete this._callbacks["$"+i],this;for(var s,l=0;l<r.length;l++)if(s=r[l],s===t||s.fn===t){r.splice(l,1);break}return r.length===0&&delete this._callbacks["$"+i],this};_t.prototype.emit=function(i){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),r=this._callbacks["$"+i],s=1;s<arguments.length;s++)t[s-1]=arguments[s];if(r){r=r.slice(0);for(var s=0,l=r.length;s<l;++s)r[s].apply(this,t)}return this};_t.prototype.emitReserved=_t.prototype.emit;_t.prototype.listeners=function(i){return this._callbacks=this._callbacks||{},this._callbacks["$"+i]||[]};_t.prototype.hasListeners=function(i){return!!this.listeners(i).length};const du=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,r)=>r(t,0),Cn=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),d2="arraybuffer";function Ib(i,...t){return t.reduce((r,s)=>(i.hasOwnProperty(s)&&(r[s]=i[s]),r),{})}const m2=Cn.setTimeout,p2=Cn.clearTimeout;function mu(i,t){t.useNativeTimers?(i.setTimeoutFn=m2.bind(Cn),i.clearTimeoutFn=p2.bind(Cn)):(i.setTimeoutFn=Cn.setTimeout.bind(Cn),i.clearTimeoutFn=Cn.clearTimeout.bind(Cn))}const g2=1.33;function y2(i){return typeof i=="string"?b2(i):Math.ceil((i.byteLength||i.size)*g2)}function b2(i){let t=0,r=0;for(let s=0,l=i.length;s<l;s++)t=i.charCodeAt(s),t<128?r+=1:t<2048?r+=2:t<55296||t>=57344?r+=3:(s++,r+=4);return r}function $b(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function v2(i){let t="";for(let r in i)i.hasOwnProperty(r)&&(t.length&&(t+="&"),t+=encodeURIComponent(r)+"="+encodeURIComponent(i[r]));return t}function x2(i){let t={},r=i.split("&");for(let s=0,l=r.length;s<l;s++){let c=r[s].split("=");t[decodeURIComponent(c[0])]=decodeURIComponent(c[1])}return t}class _2 extends Error{constructor(t,r,s){super(t),this.description=r,this.context=s,this.type="TransportError"}}class Ld extends _t{constructor(t){super(),this.writable=!1,mu(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,r,s){return super.emitReserved("error",new _2(t,r,s)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const r=Bd(t,this.socket.binaryType);this.onPacket(r)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,r={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(r)}_hostname(){const t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){const r=v2(t);return r.length?"?"+r:""}}class w2 extends Ld{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";const r=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let s=0;this._polling&&(s++,this.once("pollComplete",function(){--s||r()})),this.writable||(s++,this.once("drain",function(){--s||r()}))}else r()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const r=s=>{if(this.readyState==="opening"&&s.type==="open"&&this.onOpen(),s.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(s)};c2(t,this.socket.binaryType).forEach(r),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,l2(t,r=>{this.doWrite(r,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",r=this.query||{};return this.opts.timestampRequests!==!1&&(r[this.opts.timestampParam]=$b()),!this.supportsBinary&&!r.sid&&(r.b64=1),this.createUri(t,r)}}let Hb=!1;try{Hb=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const S2=Hb;function E2(){}class O2 extends w2{constructor(t){if(super(t),typeof location<"u"){const r=location.protocol==="https:";let s=location.port;s||(s=r?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||s!==t.port}}doWrite(t,r){const s=this.request({method:"POST",data:t});s.on("success",r),s.on("error",(l,c)=>{this.onError("xhr post error",l,c)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(r,s)=>{this.onError("xhr poll error",r,s)}),this.pollXhr=t}}class Qn extends _t{constructor(t,r,s){super(),this.createRequest=t,mu(this,s),this._opts=s,this._method=s.method||"GET",this._uri=r,this._data=s.data!==void 0?s.data:null,this._create()}_create(){var t;const r=Ib(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");r.xdomain=!!this._opts.xd;const s=this._xhr=this.createRequest(r);try{s.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){s.setDisableHeaderCheck&&s.setDisableHeaderCheck(!0);for(let l in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(l)&&s.setRequestHeader(l,this._opts.extraHeaders[l])}}catch{}if(this._method==="POST")try{s.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{s.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(s),"withCredentials"in s&&(s.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(s.timeout=this._opts.requestTimeout),s.onreadystatechange=()=>{var l;s.readyState===3&&((l=this._opts.cookieJar)===null||l===void 0||l.parseCookies(s.getResponseHeader("set-cookie"))),s.readyState===4&&(s.status===200||s.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof s.status=="number"?s.status:0)},0))},s.send(this._data)}catch(l){this.setTimeoutFn(()=>{this._onError(l)},0);return}typeof document<"u"&&(this._index=Qn.requestsCount++,Qn.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=E2,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Qn.requests[this._index],this._xhr=null}}_onLoad(){const t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}Qn.requestsCount=0;Qn.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Ey);else if(typeof addEventListener=="function"){const i="onpagehide"in Cn?"pagehide":"unload";addEventListener(i,Ey,!1)}}function Ey(){for(let i in Qn.requests)Qn.requests.hasOwnProperty(i)&&Qn.requests[i].abort()}const A2=(function(){const i=Gb({xdomain:!1});return i&&i.responseType!==null})();class j2 extends O2{constructor(t){super(t);const r=t&&t.forceBase64;this.supportsBinary=A2&&!r}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new Qn(Gb,this.uri(),t)}}function Gb(i){const t=i.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||S2))return new XMLHttpRequest}catch{}if(!t)try{return new Cn[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Fb=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class T2 extends Ld{get name(){return"websocket"}doOpen(){const t=this.uri(),r=this.opts.protocols,s=Fb?{}:Ib(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(s.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,r,s)}catch(l){return this.emitReserved("error",l)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let r=0;r<t.length;r++){const s=t[r],l=r===t.length-1;qd(s,this.supportsBinary,c=>{try{this.doWrite(s,c)}catch{}l&&du(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",r=this.query||{};return this.opts.timestampRequests&&(r[this.opts.timestampParam]=$b()),this.supportsBinary||(r.b64=1),this.createUri(t,r)}}const Hh=Cn.WebSocket||Cn.MozWebSocket;class N2 extends T2{createSocket(t,r,s){return Fb?new Hh(t,r,s):r?new Hh(t,r):new Hh(t)}doWrite(t,r){this.ws.send(r)}}class k2 extends Ld{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{const r=f2(Number.MAX_SAFE_INTEGER,this.socket.binaryType),s=t.readable.pipeThrough(r).getReader(),l=u2();l.readable.pipeTo(t.writable),this._writer=l.writable.getWriter();const c=()=>{s.read().then(({done:p,value:y})=>{p||(this.onPacket(y),c())}).catch(p=>{})};c();const d={type:"open"};this.query.sid&&(d.data=`{"sid":"${this.query.sid}"}`),this._writer.write(d).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let r=0;r<t.length;r++){const s=t[r],l=r===t.length-1;this._writer.write(s).then(()=>{l&&du(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const C2={websocket:N2,webtransport:k2,polling:j2},M2=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,R2=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function md(i){if(i.length>8e3)throw"URI too long";const t=i,r=i.indexOf("["),s=i.indexOf("]");r!=-1&&s!=-1&&(i=i.substring(0,r)+i.substring(r,s).replace(/:/g,";")+i.substring(s,i.length));let l=M2.exec(i||""),c={},d=14;for(;d--;)c[R2[d]]=l[d]||"";return r!=-1&&s!=-1&&(c.source=t,c.host=c.host.substring(1,c.host.length-1).replace(/;/g,":"),c.authority=c.authority.replace("[","").replace("]","").replace(/;/g,":"),c.ipv6uri=!0),c.pathNames=D2(c,c.path),c.queryKey=q2(c,c.query),c}function D2(i,t){const r=/\/{2,9}/g,s=t.replace(r,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&s.splice(0,1),t.slice(-1)=="/"&&s.splice(s.length-1,1),s}function q2(i,t){const r={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(s,l,c){l&&(r[l]=c)}),r}const pd=typeof addEventListener=="function"&&typeof removeEventListener=="function",Gc=[];pd&&addEventListener("offline",()=>{Gc.forEach(i=>i())},!1);class ci extends _t{constructor(t,r){if(super(),this.binaryType=d2,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(r=t,t=null),t){const s=md(t);r.hostname=s.host,r.secure=s.protocol==="https"||s.protocol==="wss",r.port=s.port,s.query&&(r.query=s.query)}else r.host&&(r.hostname=md(r.host).host);mu(this,r),this.secure=r.secure!=null?r.secure:typeof location<"u"&&location.protocol==="https:",r.hostname&&!r.port&&(r.port=this.secure?"443":"80"),this.hostname=r.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=r.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},r.transports.forEach(s=>{const l=s.prototype.name;this.transports.push(l),this._transportsByName[l]=s}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},r),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=x2(this.opts.query)),pd&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Gc.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const r=Object.assign({},this.opts.query);r.EIO=Pb,r.transport=t,this.id&&(r.sid=this.id);const s=Object.assign({},this.opts,{query:r,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](s)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&ci.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const r=this.createTransport(t);r.open(),this.setTransport(r)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",r=>this._onClose("transport close",r))}onOpen(){this.readyState="open",ci.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const r=new Error("server error");r.code=t.data,this._onError(r);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let r=1;for(let s=0;s<this.writeBuffer.length;s++){const l=this.writeBuffer[s].data;if(l&&(r+=y2(l)),s>0&&r>this._maxPayload)return this.writeBuffer.slice(0,s);r+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,du(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,r,s){return this._sendPacket("message",t,r,s),this}send(t,r,s){return this._sendPacket("message",t,r,s),this}_sendPacket(t,r,s,l){if(typeof r=="function"&&(l=r,r=void 0),typeof s=="function"&&(l=s,s=null),this.readyState==="closing"||this.readyState==="closed")return;s=s||{},s.compress=s.compress!==!1;const c={type:t,data:r,options:s};this.emitReserved("packetCreate",c),this.writeBuffer.push(c),l&&this.once("flush",l),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},r=()=>{this.off("upgrade",r),this.off("upgradeError",r),t()},s=()=>{this.once("upgrade",r),this.once("upgradeError",r)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?s():t()}):this.upgrading?s():t()),this}_onError(t){if(ci.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,r){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),pd&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const s=Gc.indexOf(this._offlineEventListener);s!==-1&&Gc.splice(s,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,r),this.writeBuffer=[],this._prevBufferLen=0}}}ci.protocol=Pb;class B2 extends ci{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let r=this.createTransport(t),s=!1;ci.priorWebsocketSuccess=!1;const l=()=>{s||(r.send([{type:"ping",data:"probe"}]),r.once("packet",b=>{if(!s)if(b.type==="pong"&&b.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",r),!r)return;ci.priorWebsocketSuccess=r.name==="websocket",this.transport.pause(()=>{s||this.readyState!=="closed"&&(m(),this.setTransport(r),r.send([{type:"upgrade"}]),this.emitReserved("upgrade",r),r=null,this.upgrading=!1,this.flush())})}else{const v=new Error("probe error");v.transport=r.name,this.emitReserved("upgradeError",v)}}))};function c(){s||(s=!0,m(),r.close(),r=null)}const d=b=>{const v=new Error("probe error: "+b);v.transport=r.name,c(),this.emitReserved("upgradeError",v)};function p(){d("transport closed")}function y(){d("socket closed")}function f(b){r&&b.name!==r.name&&c()}const m=()=>{r.removeListener("open",l),r.removeListener("error",d),r.removeListener("close",p),this.off("close",y),this.off("upgrading",f)};r.once("open",l),r.once("error",d),r.once("close",p),this.once("close",y),this.once("upgrading",f),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{s||r.open()},200):r.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const r=[];for(let s=0;s<t.length;s++)~this.transports.indexOf(t[s])&&r.push(t[s]);return r}}let L2=class extends B2{constructor(t,r={}){const s=typeof t=="object"?t:r;(!s.transports||s.transports&&typeof s.transports[0]=="string")&&(s.transports=(s.transports||["polling","websocket","webtransport"]).map(l=>C2[l]).filter(l=>!!l)),super(t,s)}};function z2(i,t="",r){let s=i;r=r||typeof location<"u"&&location,i==null&&(i=r.protocol+"//"+r.host),typeof i=="string"&&(i.charAt(0)==="/"&&(i.charAt(1)==="/"?i=r.protocol+i:i=r.host+i),/^(https?|wss?):\/\//.test(i)||(typeof r<"u"?i=r.protocol+"//"+i:i="https://"+i),s=md(i)),s.port||(/^(http|ws)$/.test(s.protocol)?s.port="80":/^(http|ws)s$/.test(s.protocol)&&(s.port="443")),s.path=s.path||"/";const c=s.host.indexOf(":")!==-1?"["+s.host+"]":s.host;return s.id=s.protocol+"://"+c+":"+s.port+t,s.href=s.protocol+"://"+c+(r&&r.port===s.port?"":":"+s.port),s}const U2=typeof ArrayBuffer=="function",P2=i=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(i):i.buffer instanceof ArrayBuffer,Vb=Object.prototype.toString,I2=typeof Blob=="function"||typeof Blob<"u"&&Vb.call(Blob)==="[object BlobConstructor]",$2=typeof File=="function"||typeof File<"u"&&Vb.call(File)==="[object FileConstructor]";function zd(i){return U2&&(i instanceof ArrayBuffer||P2(i))||I2&&i instanceof Blob||$2&&i instanceof File}function Fc(i,t){if(!i||typeof i!="object")return!1;if(Array.isArray(i)){for(let r=0,s=i.length;r<s;r++)if(Fc(i[r]))return!0;return!1}if(zd(i))return!0;if(i.toJSON&&typeof i.toJSON=="function"&&arguments.length===1)return Fc(i.toJSON(),!0);for(const r in i)if(Object.prototype.hasOwnProperty.call(i,r)&&Fc(i[r]))return!0;return!1}function H2(i){const t=[],r=i.data,s=i;return s.data=gd(r,t),s.attachments=t.length,{packet:s,buffers:t}}function gd(i,t){if(!i)return i;if(zd(i)){const r={_placeholder:!0,num:t.length};return t.push(i),r}else if(Array.isArray(i)){const r=new Array(i.length);for(let s=0;s<i.length;s++)r[s]=gd(i[s],t);return r}else if(typeof i=="object"&&!(i instanceof Date)){const r={};for(const s in i)Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=gd(i[s],t));return r}return i}function G2(i,t){return i.data=yd(i.data,t),delete i.attachments,i}function yd(i,t){if(!i)return i;if(i&&i._placeholder===!0){if(typeof i.num=="number"&&i.num>=0&&i.num<t.length)return t[i.num];throw new Error("illegal attachments")}else if(Array.isArray(i))for(let r=0;r<i.length;r++)i[r]=yd(i[r],t);else if(typeof i=="object")for(const r in i)Object.prototype.hasOwnProperty.call(i,r)&&(i[r]=yd(i[r],t));return i}const F2=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var Ue;(function(i){i[i.CONNECT=0]="CONNECT",i[i.DISCONNECT=1]="DISCONNECT",i[i.EVENT=2]="EVENT",i[i.ACK=3]="ACK",i[i.CONNECT_ERROR=4]="CONNECT_ERROR",i[i.BINARY_EVENT=5]="BINARY_EVENT",i[i.BINARY_ACK=6]="BINARY_ACK"})(Ue||(Ue={}));class V2{constructor(t){this.replacer=t}encode(t){return(t.type===Ue.EVENT||t.type===Ue.ACK)&&Fc(t)?this.encodeAsBinary({type:t.type===Ue.EVENT?Ue.BINARY_EVENT:Ue.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let r=""+t.type;return(t.type===Ue.BINARY_EVENT||t.type===Ue.BINARY_ACK)&&(r+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(r+=t.nsp+","),t.id!=null&&(r+=t.id),t.data!=null&&(r+=JSON.stringify(t.data,this.replacer)),r}encodeAsBinary(t){const r=H2(t),s=this.encodeAsString(r.packet),l=r.buffers;return l.unshift(s),l}}class Ud extends _t{constructor(t){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof t=="function"?{reviver:t}:t)}add(t){let r;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");r=this.decodeString(t);const s=r.type===Ue.BINARY_EVENT;s||r.type===Ue.BINARY_ACK?(r.type=s?Ue.EVENT:Ue.ACK,this.reconstructor=new Y2(r),r.attachments===0&&super.emitReserved("decoded",r)):super.emitReserved("decoded",r)}else if(zd(t)||t.base64)if(this.reconstructor)r=this.reconstructor.takeBinaryData(t),r&&(this.reconstructor=null,super.emitReserved("decoded",r));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let r=0;const s={type:Number(t.charAt(0))};if(Ue[s.type]===void 0)throw new Error("unknown packet type "+s.type);if(s.type===Ue.BINARY_EVENT||s.type===Ue.BINARY_ACK){const c=r+1;for(;t.charAt(++r)!=="-"&&r!=t.length;);const d=t.substring(c,r);if(d!=Number(d)||t.charAt(r)!=="-")throw new Error("Illegal attachments");const p=Number(d);if(!K2(p)||p<0)throw new Error("Illegal attachments");if(p>this.opts.maxAttachments)throw new Error("too many attachments");s.attachments=p}if(t.charAt(r+1)==="/"){const c=r+1;for(;++r&&!(t.charAt(r)===","||r===t.length););s.nsp=t.substring(c,r)}else s.nsp="/";const l=t.charAt(r+1);if(l!==""&&Number(l)==l){const c=r+1;for(;++r;){const d=t.charAt(r);if(d==null||Number(d)!=d){--r;break}if(r===t.length)break}s.id=Number(t.substring(c,r+1))}if(t.charAt(++r)){const c=this.tryParse(t.substr(r));if(Ud.isPayloadValid(s.type,c))s.data=c;else throw new Error("invalid payload")}return s}tryParse(t){try{return JSON.parse(t,this.opts.reviver)}catch{return!1}}static isPayloadValid(t,r){switch(t){case Ue.CONNECT:return Oy(r);case Ue.DISCONNECT:return r===void 0;case Ue.CONNECT_ERROR:return typeof r=="string"||Oy(r);case Ue.EVENT:case Ue.BINARY_EVENT:return Array.isArray(r)&&(typeof r[0]=="number"||typeof r[0]=="string"&&F2.indexOf(r[0])===-1);case Ue.ACK:case Ue.BINARY_ACK:return Array.isArray(r)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Y2{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const r=G2(this.reconPack,this.buffers);return this.finishedReconstruction(),r}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const K2=Number.isInteger||function(i){return typeof i=="number"&&isFinite(i)&&Math.floor(i)===i};function Oy(i){return Object.prototype.toString.call(i)==="[object Object]"}const X2=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Ud,Encoder:V2,get PacketType(){return Ue}},Symbol.toStringTag,{value:"Module"}));function Pn(i,t,r){return i.on(t,r),function(){i.off(t,r)}}const J2=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Yb extends _t{constructor(t,r,s){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=r,s&&s.auth&&(this.auth=s.auth),this._opts=Object.assign({},s),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[Pn(t,"open",this.onopen.bind(this)),Pn(t,"packet",this.onpacket.bind(this)),Pn(t,"error",this.onerror.bind(this)),Pn(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...r){var s,l,c;if(J2.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(r.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(r),this;const d={type:Ue.EVENT,data:r};if(d.options={},d.options.compress=this.flags.compress!==!1,typeof r[r.length-1]=="function"){const m=this.ids++,b=r.pop();this._registerAckCallback(m,b),d.id=m}const p=(l=(s=this.io.engine)===null||s===void 0?void 0:s.transport)===null||l===void 0?void 0:l.writable,y=this.connected&&!(!((c=this.io.engine)===null||c===void 0)&&c._hasPingExpired());return this.flags.volatile&&!p||(y?(this.notifyOutgoingListeners(d),this.packet(d)):this.sendBuffer.push(d)),this.flags={},this}_registerAckCallback(t,r){var s;const l=(s=this.flags.timeout)!==null&&s!==void 0?s:this._opts.ackTimeout;if(l===void 0){this.acks[t]=r;return}const c=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let p=0;p<this.sendBuffer.length;p++)this.sendBuffer[p].id===t&&this.sendBuffer.splice(p,1);r.call(this,new Error("operation has timed out"))},l),d=(...p)=>{this.io.clearTimeoutFn(c),r.apply(this,p)};d.withError=!0,this.acks[t]=d}emitWithAck(t,...r){return new Promise((s,l)=>{const c=(d,p)=>d?l(d):s(p);c.withError=!0,r.push(c),this.emit(t,...r)})}_addToQueue(t){let r;typeof t[t.length-1]=="function"&&(r=t.pop());const s={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((l,...c)=>(this._queue[0],l!==null?s.tryCount>this._opts.retries&&(this._queue.shift(),r&&r(l)):(this._queue.shift(),r&&r(null,...c)),s.pending=!1,this._drainQueue())),this._queue.push(s),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const r=this._queue[0];r.pending&&!t||(r.pending=!0,r.tryCount++,this.flags=r.flags,this.emit.apply(this,r.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:Ue.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,r){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,r),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(s=>String(s.id)===t)){const s=this.acks[t];delete this.acks[t],s.withError&&s.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case Ue.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Ue.EVENT:case Ue.BINARY_EVENT:this.onevent(t);break;case Ue.ACK:case Ue.BINARY_ACK:this.onack(t);break;case Ue.DISCONNECT:this.ondisconnect();break;case Ue.CONNECT_ERROR:this.destroy();const s=new Error(t.data.message);s.data=t.data.data,this.emitReserved("connect_error",s);break}}onevent(t){const r=t.data||[];t.id!=null&&r.push(this.ack(t.id)),this.connected?this.emitEvent(r):this.receiveBuffer.push(Object.freeze(r))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const r=this._anyListeners.slice();for(const s of r)s.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const r=this;let s=!1;return function(...l){s||(s=!0,r.packet({type:Ue.ACK,id:t,data:l}))}}onack(t){const r=this.acks[t.id];typeof r=="function"&&(delete this.acks[t.id],r.withError&&t.data.unshift(null),r.apply(this,t.data))}onconnect(t,r){this.id=t,this.recovered=r&&this._pid===r,this._pid=r,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Ue.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const r=this._anyListeners;for(let s=0;s<r.length;s++)if(t===r[s])return r.splice(s,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const r=this._anyOutgoingListeners;for(let s=0;s<r.length;s++)if(t===r[s])return r.splice(s,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const r=this._anyOutgoingListeners.slice();for(const s of r)s.apply(this,t.data)}}}function Xs(i){i=i||{},this.ms=i.min||100,this.max=i.max||1e4,this.factor=i.factor||2,this.jitter=i.jitter>0&&i.jitter<=1?i.jitter:0,this.attempts=0}Xs.prototype.duration=function(){var i=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),r=Math.floor(t*this.jitter*i);i=(Math.floor(t*10)&1)==0?i-r:i+r}return Math.min(i,this.max)|0};Xs.prototype.reset=function(){this.attempts=0};Xs.prototype.setMin=function(i){this.ms=i};Xs.prototype.setMax=function(i){this.max=i};Xs.prototype.setJitter=function(i){this.jitter=i};class bd extends _t{constructor(t,r){var s;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(r=t,t=void 0),r=r||{},r.path=r.path||"/socket.io",this.opts=r,mu(this,r),this.reconnection(r.reconnection!==!1),this.reconnectionAttempts(r.reconnectionAttempts||1/0),this.reconnectionDelay(r.reconnectionDelay||1e3),this.reconnectionDelayMax(r.reconnectionDelayMax||5e3),this.randomizationFactor((s=r.randomizationFactor)!==null&&s!==void 0?s:.5),this.backoff=new Xs({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(r.timeout==null?2e4:r.timeout),this._readyState="closed",this.uri=t;const l=r.parser||X2;this.encoder=new l.Encoder,this.decoder=new l.Decoder,this._autoConnect=r.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var r;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(r=this.backoff)===null||r===void 0||r.setMin(t),this)}randomizationFactor(t){var r;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(r=this.backoff)===null||r===void 0||r.setJitter(t),this)}reconnectionDelayMax(t){var r;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(r=this.backoff)===null||r===void 0||r.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new L2(this.uri,this.opts);const r=this.engine,s=this;this._readyState="opening",this.skipReconnect=!1;const l=Pn(r,"open",function(){s.onopen(),t&&t()}),c=p=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",p),t?t(p):this.maybeReconnectOnOpen()},d=Pn(r,"error",c);if(this._timeout!==!1){const p=this._timeout,y=this.setTimeoutFn(()=>{l(),c(new Error("timeout")),r.close()},p);this.opts.autoUnref&&y.unref(),this.subs.push(()=>{this.clearTimeoutFn(y)})}return this.subs.push(l),this.subs.push(d),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Pn(t,"ping",this.onping.bind(this)),Pn(t,"data",this.ondata.bind(this)),Pn(t,"error",this.onerror.bind(this)),Pn(t,"close",this.onclose.bind(this)),Pn(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(r){this.onclose("parse error",r)}}ondecoded(t){du(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,r){let s=this.nsps[t];return s?this._autoConnect&&!s.active&&s.connect():(s=new Yb(this,t,r),this.nsps[t]=s),s}_destroy(t){const r=Object.keys(this.nsps);for(const s of r)if(this.nsps[s].active)return;this._close()}_packet(t){const r=this.encoder.encode(t);for(let s=0;s<r.length;s++)this.engine.write(r[s],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,r){var s;this.cleanup(),(s=this.engine)===null||s===void 0||s.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,r),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const r=this.backoff.duration();this._reconnecting=!0;const s=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(l=>{l?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",l)):t.onreconnect()}))},r);this.opts.autoUnref&&s.unref(),this.subs.push(()=>{this.clearTimeoutFn(s)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const Ya={};function Vc(i,t){typeof i=="object"&&(t=i,i=void 0),t=t||{};const r=z2(i,t.path||"/socket.io"),s=r.source,l=r.id,c=r.path,d=Ya[l]&&c in Ya[l].nsps,p=t.forceNew||t["force new connection"]||t.multiplex===!1||d;let y;return p?y=new bd(s,t):(Ya[l]||(Ya[l]=new bd(s,t)),y=Ya[l]),r.query&&!t.query&&(t.query=r.queryKey),y.socket(r.path,t)}Object.assign(Vc,{Manager:bd,Socket:Yb,io:Vc,connect:Vc});const Q2=j.createContext({connected:!1,subscribe:()=>()=>{}});function Z2({children:i}){const t=j.useRef(null),[r,s]=j.useState(!1),l=j.useRef(new Map),c=j.useCallback((p,y)=>{var m;const f=l.current;return f.has(p)||(f.set(p,new Set),(m=t.current)==null||m.emit("lt.subscribe",p)),f.get(p).add(y),()=>{var v;const b=f.get(p);b&&(b.delete(y),b.size===0&&(f.delete(p),(v=t.current)==null||v.emit("lt.unsubscribe",p)))}},[]),d=j.useCallback((p,y)=>{for(const[f,m]of l.current)if(Db(p,f))for(const b of m)try{b(y)}catch{}},[]);return j.useEffect(()=>{const p=mb(),y=Vc({path:`${jt}/socket.io`,transports:["polling","websocket"],upgrade:!0,reconnection:!0,reconnectionAttempts:1/0,reconnectionDelay:2e3,...p?{auth:{token:p}}:{}});return t.current=y,console.log("[lt-socketio] connecting..."),y.on("connect",()=>{console.log("[lt-socketio] connected, id:",y.id),s(!0);for(const f of l.current.keys())y.emit("lt.subscribe",f)}),y.on("disconnect",f=>{console.log("[lt-socketio] disconnected:",f),s(!1)}),y.on("connect_error",f=>{console.warn("[lt-socketio] connect error:",f.message),s(!1)}),y.onAny((f,m)=>{if(f.startsWith("lt."))try{const b=typeof m=="string"?JSON.parse(m):m;d(f,b)}catch{}}),()=>{y.removeAllListeners(),y.disconnect(),t.current=null,s(!1)}},[d]),g.jsx(Q2.Provider,{value:{connected:r,subscribe:c},children:g.jsx(Ks.Provider,{value:{connected:r,subscribe:c},children:i})})}function W2({children:i}){const[t,r]=j.useState(null),[s,l]=j.useState({url:null,token:null});return j.useEffect(()=>{let c=!1;async function d(){var p;try{console.log("[lt-transport] detecting event transport...");const y=await fetch(`${jt}/api/settings`);if(!y.ok){console.warn("[lt-transport] settings fetch failed, falling back to socketio"),c||r("socketio");return}const f=await y.json(),m=(p=f==null?void 0:f.events)==null?void 0:p.transport;if(console.log("[lt-transport] server reports:",m),!c){if(m==="nats"){let b=f.events.natsWsUrl??null,v=null;const _=mb();if(_)try{const w=await fetch(`${jt}/api/nats-credentials`,{headers:{Authorization:`Bearer ${_}`}});if(w.ok){const S=await w.json();b=S.natsWsUrl??b,v=S.natsToken??null}}catch{console.warn("[lt-transport] failed to fetch NATS credentials")}l({url:b,token:v})}r(m==="nats"?"nats":"socketio")}}catch(y){console.warn("[lt-transport] settings fetch error, falling back to socketio",y),c||r("socketio")}}return d(),()=>{c=!0}},[]),t==="nats"?g.jsx(r2,{url:s.url,token:s.token,children:i}):t==="socketio"?g.jsx(Z2,{children:i}):g.jsx(g.Fragment,{children:i})}const Pd="lt_view_as",Id="lt_ai_override",vd="lt_graph_enabled",$d="lt_scan_override";function Kb(){try{const i=localStorage.getItem(Id);if(i==="true")return!0;if(i==="false")return!1}catch{}return null}function eO(i){try{localStorage.setItem(Id,String(i))}catch{}}function tO(){try{localStorage.removeItem(Id)}catch{}}function Hd(){try{const i=localStorage.getItem(Pd);if(i==="admin"||i==="engineer"||i==="operator")return i}catch{}return null}function nO(i){try{localStorage.setItem(Pd,i)}catch{}window.location.reload()}function xd(){try{localStorage.removeItem(Pd)}catch{}window.location.reload()}function Xb(){try{return localStorage.getItem(vd)==="true"}catch{return!1}}function rO(i){try{i?localStorage.setItem(vd,"true"):localStorage.removeItem(vd)}catch{}}function Jb(){try{const i=localStorage.getItem($d);if(i==="true")return!0;if(i==="false")return!1}catch{}return null}function iO(i){try{localStorage.setItem($d,String(i))}catch{}}function sO(){try{localStorage.removeItem($d)}catch{}}function Qb(){const{isSuperAdmin:i,hasRoleType:t,hasRole:r}=Ht(),s=Hd(),l=i||r("engineer"),c=t("admin"),d=i||t("admin");return{isBuilder:s?!1:l,isOps:s?s==="admin"||s==="engineer":c,canBulk:s?s==="admin":d,viewAs:s,realIsBuilder:l}}function Zb(){var f;const{isSuperAdmin:i,hasRoleType:t,hasRole:r}=Ht(),{data:s}=Wn(),l=((f=s==null?void 0:s.features)==null?void 0:f.publicPaceBoard)!==!1,c=i?"superadmin":t("admin")?"admin":r("engineer")?"engineer":"operator",d=Hd(),p=d==="admin"||d==="engineer"||d==="operator"?d:null,y=p??c;return{tier:y,realTier:c,viewAs:p,canSeePaceBoard:l||y==="superadmin"||y==="admin",canSeeWorkflows:y==="superadmin"||y==="engineer",showTaskQueueCards:y==="operator"&&!l}}function Wb(i){return(i??"").replace(/[^A-Za-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"")||"none"}function _d(i={}){const t=i.role?Wb(i.role):"*",r=i.id??"*",s=i.verb??">";return`${Rb}.system.escalation.${t}.${r}.${s}`}function Ay(i){return i.verbs.map(t=>_d({role:i.role,verb:t}))}function Gd(i){const{user:t,isSuperAdmin:r,hasRoleType:s}=Ht(),l=r||s("admin"),c=((t==null?void 0:t.roles)??[]).map(p=>p.role).sort().join(","),d=(i??[]).join(",");return j.useMemo(()=>{const p=d?d.split(","):null;return l||!c?p?Ay({verbs:p}):[_d({})]:c.split(",").flatMap(y=>p?Ay({role:y,verbs:p}):[_d({role:y})])},[l,c,d])}const wd="/escalations/detail/";function aO(i){return i.startsWith(wd)&&i.slice(wd.length).split("/")[0]||void 0}function oO(){const{user:i}=Ht(),t=go(),r=gn(),s=j.useRef(r.pathname);s.current=r.pathname;const l=j.useRef(i==null?void 0:i.userId);l.current=i==null?void 0:i.userId;const c=j.useCallback(d=>{var b,v,_;if((d==null?void 0:d.assignedAtCreation)!==!0)return;const p=(d==null?void 0:d.escalationId)??((b=d==null?void 0:d.data)==null?void 0:b.id),y=(v=d==null?void 0:d.data)==null?void 0:v.assigned_to,f=(_=d==null?void 0:d.data)==null?void 0:_.parent_id;if(!p||y!==l.current||!f||f!==aO(s.current))return;const m=`${wd}${p}`;s.current!==m&&t(m)},[t]);Dd(Gd(["claimed"]),c)}function v3(){return ft({queryKey:["roles"],queryFn:()=>Oe("/roles")})}function ev(i){return ft({queryKey:["roles","details"],queryFn:()=>Oe("/roles/details"),enabled:(i==null?void 0:i.enabled)??!0})}function x3(i,t,r=!0){return ft({queryKey:["roles",i,"schema",t??"latest"],queryFn:()=>Oe(`/roles/${encodeURIComponent(i)}/schema${t!=null?`?version=${t}`:""}`),enabled:r&&!!i})}function _3(i){return ft({queryKey:["roles",i,"schema-versions"],queryFn:()=>Oe(`/roles/${encodeURIComponent(i)}/schema/versions`),enabled:!!i})}function w3(i,t,r=!0){return ft({queryKey:["roles",i,"list-schema",t??"latest"],queryFn:()=>Oe(`/roles/${encodeURIComponent(i)}/list-schema${t!=null?`?version=${t}`:""}`),enabled:r&&!!i})}function S3(i){return ft({queryKey:["roles",i,"list-schema-versions"],queryFn:()=>Oe(`/roles/${encodeURIComponent(i)}/list-schema/versions`),enabled:!!i})}function E3(){const i=ht();return Et({mutationFn:t=>Oe("/roles",{method:"POST",body:JSON.stringify({role:t})}),onSuccess:()=>{i.invalidateQueries({queryKey:["roles"]})}})}function O3(){const i=ht();return Et({mutationFn:({role:t,...r})=>Oe(`/roles/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify(r)}),onMutate:async({role:t,...r})=>{await i.cancelQueries({queryKey:["roles","details"]});const s=i.getQueryData(["roles","details"]);return s&&i.setQueryData(["roles","details"],{roles:s.roles.map(l=>l.role===t?{...l,...r}:l)}),{previous:s}},onError:(t,r,s)=>{s!=null&&s.previous&&i.setQueryData(["roles","details"],s.previous)},onSuccess:()=>{i.invalidateQueries({queryKey:["roles"]})}})}function A3(){const i=ht();return Et({mutationFn:t=>Oe(`/roles/${encodeURIComponent(t)}`,{method:"DELETE"}),onSuccess:()=>{i.invalidateQueries({queryKey:["roles"]})}})}function lO(){const{user:i}=Ht(),{data:t}=ev();return j.useMemo(()=>{var c,d;const r=(i==null?void 0:i.roles)??[],s=r.length===1?r[0]:null;if(!s||s.type!=="member")return{kiosk:!1,role:null,homePath:null};const l=(c=t==null?void 0:t.roles)==null?void 0:c.find(p=>p.role===s.role);return((d=l==null?void 0:l.properties)==null?void 0:d.kiosk)!==!0?{kiosk:!1,role:null,homePath:null}:{kiosk:!0,role:s.role,homePath:`/escalations/available?role=${encodeURIComponent(s.role)}&status=available`}},[i,t])}const cO=["/escalations","/scan","/login"];function uO(i){return cO.some(t=>i===t||i.startsWith(`${t}/`)||i.startsWith(`${t}?`))}const Fd=j.createContext(null),Gh="lt_sidebar_collapsed",tv="(max-width: 1023px)";function fO(){try{return window.matchMedia(tv).matches}catch{return!1}}function hO({children:i}){const[t,r]=j.useState(()=>{if(fO())return!0;try{return localStorage.getItem(Gh)==="true"}catch{return!1}});j.useEffect(()=>{let l;try{l=window.matchMedia(tv)}catch{return}const c=d=>{if(d.matches)r(!0);else try{r(localStorage.getItem(Gh)==="true")}catch{r(!1)}};return l.addEventListener("change",c),()=>l.removeEventListener("change",c)},[]);const s=j.useCallback(()=>{r(l=>{const c=!l;try{localStorage.setItem(Gh,String(c))}catch{}return c})},[]);return g.jsx(Fd.Provider,{value:{collapsed:t,toggle:s},children:i})}function dO({children:i}){return g.jsx(Fd.Provider,{value:{collapsed:!1,toggle:()=>{}},children:i})}function Vd(){const i=j.useContext(Fd);if(!i)throw new Error("useSidebar must be used within SidebarProvider");return i}const jy=380,Yd=j.createContext(null);function mO({children:i}){const[t,r]=j.useState({node:null,width:jy,open:!1,ownerKey:null}),s=gn(),l=j.useRef(s.pathname),c=j.useCallback((p,y)=>{r({node:p,width:(y==null?void 0:y.width)??jy,open:!0,ownerKey:(y==null?void 0:y.key)??null})},[]),d=j.useCallback(p=>{r(y=>typeof p=="string"&&y.ownerKey!==p?y:{...y,open:!1})},[]);return j.useEffect(()=>{s.pathname!==l.current&&(l.current=s.pathname,r(p=>p.open||p.node?{...p,node:null,open:!1,ownerKey:null}:p))},[s.pathname]),g.jsx(Yd.Provider,{value:{...t,setPanel:c,closePanel:d},children:i})}function Kd(){const i=j.useContext(Yd);if(!i)throw new Error("useShellPanel must be used within ShellPanelProvider");return i}function j3(){return j.useContext(Yd)}function pO({open:i,width:t=380,children:r,className:s=""}){const[l,c]=j.useState(i);return j.useEffect(()=>{i&&c(!0)},[i]),g.jsx("div",{className:`shrink-0 overflow-hidden transition-[width] duration-300 ease-out ${s}`,style:{width:i?t:0,maxWidth:"50%"},onTransitionEnd:d=>{!i&&d.propertyName==="width"&&c(!1)},children:g.jsx("div",{style:{width:t},className:"h-full",children:l?r:null})})}function T3({label:i,children:t}){return g.jsxs("div",{children:[g.jsx("dt",{className:"text-2xs font-medium text-text-secondary uppercase tracking-wide",children:i}),g.jsx("dd",{className:"text-xs text-text-primary mt-0.5",children:t})]})}function N3({views:i,activeId:t,onViewChange:r,onClose:s,headerActions:l,stickyClassName:c,labelInline:d}){const p=i.find(y=>y.id===t)??i[0];return p?g.jsx("div",{className:"h-full bg-surface-hover",children:g.jsxs("div",{className:`flex flex-col ${c??"sticky top-0 z-10 max-h-[calc(100vh-3.5rem)]"}`,children:[g.jsxs("div",{className:`flex items-center justify-between pl-4 pr-3 shrink-0 ${d?"pt-10 pb-2":"pt-3"}`,children:[g.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[g.jsx("div",{className:"flex items-center gap-1 shrink-0",role:"radiogroup","aria-label":"Panel view",children:i.map(y=>{const f=y.icon,m=y.id===p.id;return g.jsx("button",{role:"radio","aria-checked":m,onClick:()=>r(y.id),title:y.label,className:`p-1.5 rounded-md transition-colors ${m?"bg-accent/10 text-accent":"text-accent/60 hover:text-accent hover:bg-surface-hover"}`,children:g.jsx(f,{className:"w-3.5 h-3.5"})},y.id)})}),d&&g.jsx("span",{className:"text-2xs font-semibold uppercase tracking-widest text-text-secondary truncate",children:p.label})]}),g.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[l,s&&g.jsx("button",{onClick:s,title:"Close panel",className:"p-1 rounded text-accent/60 hover:text-accent hover:bg-surface-hover transition-colors",children:g.jsx(dn,{className:"w-3.5 h-3.5"})})]})]}),!d&&g.jsx("p",{className:"px-5 pt-2 pb-1 text-2xs font-semibold uppercase tracking-widest text-text-secondary shrink-0",children:p.label}),g.jsx("div",{className:`flex-1 overflow-y-auto px-5 ${d?"pt-4 pb-8":"pb-5 pt-1"}`,children:p.content})]})}):null}function nv(i,t){var r,s,l,c,d;t.facets&&Object.keys(t.facets).length&&i.set("facets",JSON.stringify(t.facets)),(r=t.block)!=null&&r.length&&i.set("block",JSON.stringify(t.block)),(s=t.range)!=null&&s.length&&i.set("range",JSON.stringify(t.range)),(l=t.exists)!=null&&l.length&&i.set("exists",JSON.stringify(t.exists)),(c=t.roles)!=null&&c.length&&i.set("roles",JSON.stringify(t.roles)),(d=t.orderBy)!=null&&d.length&&i.set("orderBy",JSON.stringify(t.orderBy)),t.available!==void 0&&i.set("available",String(t.available)),t.jeopardy===!0&&i.set("jeopardy","1"),t.include&&i.set("include",t.include)}function k3(i,t){const r=i??"24h";return ft({queryKey:["stationMetrics",r],queryFn:()=>Oe(`/escalations/station-metrics?period=${r}`),staleTime:5e3,enabled:(t==null?void 0:t.enabled)??!0})}function C3(i){const t=i?`?period=${i}`:"";return ft({queryKey:["escalationStats",i],queryFn:()=>Oe(`/escalations/stats${t}`)})}function M3(){return ft({queryKey:["escalationTypes"],queryFn:()=>Oe("/escalations/types")})}function R3(i=!0){return ft({queryKey:["escalationFacetKeys"],queryFn:()=>Oe("/escalations/facet-keys"),enabled:i,staleTime:6e4})}function rv(i){const{enabled:t=!0,staleTime:r,...s}=i,l=new URLSearchParams;return s.status&&l.set("status",s.status),s.role&&l.set("role",s.role),s.type&&l.set("type",s.type),s.subtype&&l.set("subtype",s.subtype),s.assigned_to&&l.set("assigned_to",s.assigned_to),s.parent_id&&l.set("parent_id",s.parent_id),s.claimed&&l.set("claimed","true"),s.priority&&l.set("priority",String(s.priority)),s.limit&&l.set("limit",String(s.limit)),s.offset!==void 0&&l.set("offset",String(s.offset)),s.sort_by&&l.set("sort_by",s.sort_by),s.order&&l.set("order",s.order),s.search&&l.set("search",s.search),nv(l,s),ft({queryKey:["escalations",s],queryFn:()=>Oe(`/escalations?${l}`),enabled:t,...r!==void 0?{staleTime:r}:{}})}function iv(i){const{enabled:t=!0,staleTime:r,...s}=i,l=new URLSearchParams;return s.role&&l.set("role",s.role),s.type&&l.set("type",s.type),s.subtype&&l.set("subtype",s.subtype),s.priority&&l.set("priority",String(s.priority)),s.limit&&l.set("limit",String(s.limit)),s.offset!==void 0&&l.set("offset",String(s.offset)),s.sort_by&&l.set("sort_by",s.sort_by),s.order&&l.set("order",s.order),s.search&&l.set("search",s.search),nv(l,s),ft({queryKey:["escalations","available",s],queryFn:()=>Oe(`/escalations/available?${l}`),enabled:t,...r!==void 0?{staleTime:r}:{}})}function D3(i){return ft({queryKey:["escalations","by-workflow",i],queryFn:()=>Oe(`/escalations/by-workflow/${i}`),enabled:!!i})}function q3(i){return ft({queryKey:["escalations",i],queryFn:()=>Oe(`/escalations/${i}`),enabled:!!i})}function B3(){const i=ht();return Et({mutationFn:({id:t,durationMinutes:r})=>Oe(`/escalations/${t}/claim`,{method:"POST",body:JSON.stringify({durationMinutes:r})}),onSuccess:()=>{i.resetQueries({queryKey:["escalations"]}),i.resetQueries({queryKey:["escalationStats"]})}})}function L3(){const i=ht();return Et({mutationFn:t=>Oe(`/escalations/${t}/release`,{method:"POST"}),onSuccess:()=>{i.resetQueries({queryKey:["escalations"]}),i.resetQueries({queryKey:["escalationStats"]})}})}function z3(){const i=ht();return Et({mutationFn:({id:t,resolverPayload:r})=>Oe(`/escalations/${t}/resolve`,{method:"POST",body:JSON.stringify({resolverPayload:r})}),onSuccess:()=>{i.resetQueries({queryKey:["escalations"]}),i.resetQueries({queryKey:["escalationStats"]}),i.resetQueries({queryKey:["tasks"]}),i.resetQueries({queryKey:["jobs"]})}})}function U3(){const i=ht();return Et({mutationFn:({id:t,targetRole:r})=>Oe(`/escalations/${t}/escalate`,{method:"PATCH",body:JSON.stringify({targetRole:r})}),onSuccess:()=>{i.resetQueries({queryKey:["escalations"]}),i.resetQueries({queryKey:["escalationStats"]})}})}function P3(){const i=ht();return Et({mutationFn:({ids:t,priority:r})=>Oe("/escalations/priority",{method:"PATCH",body:JSON.stringify({ids:t,priority:r})}),onSuccess:()=>{i.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),i.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function I3(){const i=ht();return Et({mutationFn:({ids:t,durationMinutes:r})=>Oe("/escalations/bulk-claim",{method:"POST",body:JSON.stringify({ids:t,durationMinutes:r})}),onSuccess:()=>{i.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),i.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function $3(){const i=ht();return Et({mutationFn:({ids:t,targetUserId:r,durationMinutes:s})=>Oe("/escalations/bulk-assign",{method:"POST",body:JSON.stringify({ids:t,targetUserId:r,durationMinutes:s})}),onSuccess:()=>{i.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),i.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function H3(){const i=ht();return Et({mutationFn:({ids:t,hint:r})=>Oe("/escalations/bulk-triage",{method:"POST",body:JSON.stringify({ids:t,...r?{hint:r}:{}})}),onSuccess:()=>{i.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),i.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function G3(){const i=ht();return Et({mutationFn:t=>Oe(`/escalations/${t}/cancel`,{method:"POST"}),onSuccess:()=>{i.resetQueries({queryKey:["escalations"]}),i.resetQueries({queryKey:["escalationStats"]})}})}function F3(){const i=ht();return Et({mutationFn:({ids:t})=>Oe("/escalations/bulk-cancel",{method:"POST",body:JSON.stringify({ids:t})}),onSuccess:()=>{i.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),i.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function gO(){const{user:i}=Ht(),t=i==null?void 0:i.userId,r=ht(),s=j.useRef(null),l=j.useCallback(()=>{s.current||(s.current=setTimeout(()=>{s.current=null,r.invalidateQueries({queryKey:["escalations"]})},15e3))},[r]);Dd(Gd(),l);const{data:c}=iv({limit:1}),{data:d}=rv({assigned_to:t,status:"pending",limit:1});return{available:(c==null?void 0:c.total)??0,mine:(d==null?void 0:d.total)??0}}function nu({size:i="sm",hideLabel:t=!1,className:r="",appName:s="LongTail",variant:l="full"}){const c=i==="lg";if(l==="comet")return g.jsx("div",{className:`relative overflow-visible ${r}`,style:{width:"2.5rem",height:"2.5rem",flexShrink:0},children:g.jsx("span",{role:"img","aria-label":s,className:"logo-mark absolute pointer-events-none select-none",style:{"--logo-url":`url(${jt}/logo512.png)`,width:"82px",height:"82px",top:"-12px",left:"-80px",transform:"rotate(232deg)",zIndex:-1,opacity:.55}})});if(l==="mark")return g.jsx("div",{className:`flex items-center ${r}`,children:g.jsx("span",{role:"img","aria-label":s,className:"logo-mark shrink-0 w-7 h-7",style:{"--logo-url":`url(${jt}/logo512.png)`}})});const d=c?"w-[16rem] h-[16rem] -rotate-[120deg] opacity-55 -ml-10":"w-[12.5rem] h-[12.5rem] -rotate-[120deg] opacity-55 -ml-8",p=c?"text-[44px] font-normal text-text-primary tracking-[0.15em] -ml-[12.5rem]":"text-[36px] font-normal text-text-primary tracking-[0.15em] -ml-[9.75rem]";return g.jsxs("div",{className:`flex items-center ${r}`,style:{height:"50px"},children:[g.jsx("span",{role:"img","aria-label":s,className:`logo-mark shrink-0 z-0 ${d}`,style:{"--logo-url":`url(${jt}/logo512.png)`}}),g.jsx("span",{className:`z-[1] transition-opacity duration-300 ${p} ${t?"opacity-0":""}`,children:s})]})}const yO=[{id:null,label:"Your view",description:"Full access based on your account role",minTier:"operator"},{id:"admin",label:"Admin",description:"Pace Board + identity management",minTier:"superadmin"},{id:"engineer",label:"Engineer",description:"Work queue + identity management",minTier:"admin"},{id:"operator",label:"Operator",description:"Escalation queue only",minTier:"engineer"}],bO=["operator","engineer","admin","superadmin"];function Ty(i){return bO.indexOf(i)}function vO(i,t){return Ty(i)>=Ty(t)}function xO({onClose:i}){var ae,de,Ae,oe,je,Se,Ne;const{isSuperAdmin:t,hasRoleType:r,hasRole:s}=Ht(),{data:l}=Wn(),c=Hd(),d=!!((ae=l==null?void 0:l.ai)!=null&&ae.enabled),p=Kb(),y=p!==null?p:d,[f,m]=j.useState(y),b=(de=l==null?void 0:l.features)==null?void 0:de.graphWorkflows,v=b==null,[_,w]=j.useState(b===!0||v&&Xb()),S=!!((Ae=l==null?void 0:l.features)!=null&&Ae.scanCodes),M=Jb(),[B,U]=j.useState(M!==null?M:S),ie=t?"superadmin":r("admin")?"admin":s("engineer")?"engineer":"operator",ce=((oe=l==null?void 0:l.branding)==null?void 0:oe.appName)??"LongTail",C=(je=l==null?void 0:l.environment)==null?void 0:je.longTailVersion,z=(Se=l==null?void 0:l.environment)==null?void 0:Se.hotmeshVersion,re=(Ne=l==null?void 0:l.environment)==null?void 0:Ne.nodeEnv;j.useEffect(()=>{const be=at=>{at.key==="Escape"&&i()};return document.addEventListener("keydown",be),()=>document.removeEventListener("keydown",be)},[i]);const X=yO.filter(be=>vO(ie,be.minTier)),L=X.length>1,G=[...L?[{id:"viewas",label:"View As",icon:lw}]:[],{id:"features",label:"Features",icon:cw}],[W,Q]=j.useState(G[0].id),he=be=>{be===null?xd():nO(be)},_e=()=>{const be=!f;m(be),be===d?tO():eO(be),window.location.reload()},Te=()=>{const be=!_;w(be),rO(be),window.location.reload()},Y=()=>{const be=!B;U(be),be===S?sO():iO(be),window.location.reload()};return g.jsx("div",{className:"fixed inset-0 z-[100] bg-surface-sunken/75 backdrop-blur-sm flex items-center justify-center",onClick:i,children:g.jsxs("div",{className:"relative w-[440px] max-h-[85vh] overflow-y-auto bg-surface-raised px-12 py-10",onClick:be=>be.stopPropagation(),children:[g.jsx("button",{onClick:i,className:"absolute top-4 right-4 text-text-quaternary hover:text-text-secondary transition-colors p-1","aria-label":"Close",children:g.jsx(dn,{className:"w-4 h-4",strokeWidth:1.5})}),g.jsxs("div",{className:"flex flex-col items-center gap-3 pb-8",children:[g.jsx("span",{className:"logo-mark block w-20 h-20 opacity-50",style:{"--logo-url":`url(${jt}/logo512.png)`}}),g.jsxs("div",{className:"text-center",children:[g.jsx("p",{className:"text-2xl font-light text-text-primary tracking-[0.12em]",children:ce}),C&&g.jsxs("p",{className:"mt-1 text-2xs text-text-tertiary",children:["v",C,z&&g.jsxs(g.Fragment,{children:[" · HotMesh v",z]}),re&&re!=="production"&&g.jsx("span",{className:"ml-1 text-status-warning",children:re})]})]})]}),g.jsx("hr",{className:"border-surface-border/50 mb-6"}),G.length>1&&g.jsx("div",{className:"flex items-center justify-center gap-2 mb-8",role:"tablist",children:G.map(be=>{const at=W===be.id;return g.jsxs("button",{role:"tab","aria-selected":at,onClick:()=>Q(be.id),title:be.label,className:`flex flex-col items-center gap-1.5 px-5 py-2.5 rounded-lg transition-colors ${at?"bg-accent/10 text-accent":"text-text-tertiary hover:text-text-secondary hover:bg-surface-hover"}`,children:[g.jsx(be.icon,{className:"w-5 h-5",strokeWidth:1.5,...at?{fill:"currentColor",fillOpacity:.15}:{}}),g.jsx("span",{className:"text-2xs font-medium",children:be.label})]},be.id)})}),W==="viewas"&&L&&g.jsxs("div",{className:"space-y-1",children:[g.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-4",children:"View As"}),X.map(be=>{const at=c===be.id,Gt=be.id===null?`Your view · ${ie}`:be.label;return g.jsxs("button",{onClick:()=>he(be.id),className:"w-full text-left flex items-start gap-3 py-2.5 px-1 group",children:[g.jsx("span",{className:`mt-0.5 w-4 h-4 rounded-full border shrink-0 flex items-center justify-center transition-colors ${at?"border-accent bg-accent":"border-surface-border group-hover:border-accent/60"}`,children:at&&g.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-text-inverse"})}),g.jsxs("span",{children:[g.jsx("span",{className:`block text-sm font-medium transition-colors ${at?"text-accent":"text-text-primary group-hover:text-accent"}`,children:Gt}),g.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:be.description})]})]},String(be.id))})]}),W==="features"&&g.jsxs("div",{children:[g.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-4",children:"Features"}),g.jsxs("button",{onClick:_e,className:"w-full text-left flex items-center justify-between py-2.5 px-1 group",children:[g.jsxs("span",{children:[g.jsx("span",{className:"block text-sm font-medium text-text-primary group-hover:text-accent transition-colors",children:"AI features"}),g.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:f?"Enabled — AI assist, agent labels, bulk AI actions":"Hidden — automation labels, no AI surfaces"})]}),g.jsx("span",{className:`shrink-0 ml-4 w-9 h-5 rounded-full transition-colors flex items-center px-0.5 ${f?"bg-accent":"bg-surface-border"}`,children:g.jsx("span",{className:`w-4 h-4 rounded-full bg-text-inverse shadow-sm transition-transform ${f?"translate-x-4":"translate-x-0"}`})})]}),v&&g.jsxs("button",{onClick:Te,className:"w-full text-left flex items-center justify-between py-2.5 px-1 group",children:[g.jsxs("span",{children:[g.jsx("span",{className:"block text-sm font-medium text-text-primary group-hover:text-accent transition-colors",children:"Graph workflows"}),g.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:_?"Visible — Graph section shown in Orchestrate sidebar":"Hidden — use Procedural workflows instead"})]}),g.jsx("span",{className:`shrink-0 ml-4 w-9 h-5 rounded-full transition-colors flex items-center px-0.5 ${_?"bg-accent":"bg-surface-border"}`,children:g.jsx("span",{className:`w-4 h-4 rounded-full bg-text-inverse shadow-sm transition-transform ${_?"translate-x-4":"translate-x-0"}`})})]}),g.jsxs("button",{onClick:Y,className:"w-full text-left flex items-center justify-between py-2.5 px-1 group",children:[g.jsxs("span",{children:[g.jsx("span",{className:"block text-sm font-medium text-text-primary group-hover:text-accent transition-colors",children:"Scan input"}),g.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:B?"Enabled — header scan affordance, panel, and keyboard-wedge capture":"Hidden — the deployment opts in with features.scanCodes"})]}),g.jsx("span",{className:`shrink-0 ml-4 w-9 h-5 rounded-full transition-colors flex items-center px-0.5 ${B?"bg-accent":"bg-surface-border"}`,children:g.jsx("span",{className:`w-4 h-4 rounded-full bg-text-inverse shadow-sm transition-transform ${B?"translate-x-4":"translate-x-0"}`})})]})]}),g.jsx("hr",{className:"border-surface-border/50 mt-8"}),g.jsx("p",{className:"mt-4 text-2xs text-text-quaternary text-center",children:"Esc or click outside to close"})]})})}const sv=[{id:"violet",label:"Violet",swatch:"#7B3BE0"},{id:"red",label:"Brick",swatch:"#DC382D"},{id:"green",label:"Emerald",swatch:"#059669"},{id:"blue",label:"Electric",swatch:"#2563EB"},{id:"rose",label:"Raspberry",swatch:"#D6246E"},{id:"orange",label:"Harvest",swatch:"#E85D04"}],Ny="blue",av="lt.theme";let ov=[];function _O(i){const t=new Set(sv.map(s=>s.id)),r=new Set;ov=i.filter(s=>!(s!=null&&s.id)||t.has(s.id)||r.has(s.id)?!1:(r.add(s.id),!0))}function wO(){return[...sv,...ov]}function lv(){try{return localStorage.getItem(av)||Ny}catch{return Ny}}function cv(i){document.documentElement.dataset.theme=i}function SO(i){try{localStorage.setItem(av,i)}catch{}cv(i)}const uv=j.createContext(null);function EO(){const i=j.useContext(uv);if(!i)throw new Error("useActingIdentity must be used within ActingIdentityProvider");return i}function OO({children:i}){const[t,r]=j.useState(null),s=j.useRef(t);s.current=t,j.useEffect(()=>{if(!(t!=null&&t.expiresAt))return;const y=new Date(t.expiresAt).getTime()-Date.now();if(y<=0){r(null);return}const f=setTimeout(()=>r(null),y);return()=>clearTimeout(f)},[t]);const l=j.useCallback(y=>{var m;if(!y.actingToken||!y.actor)return null;const f=((m=s.current)==null?void 0:m.actingToken)??null;return r({actingToken:y.actingToken,actorId:y.actor.id,displayName:y.actor.displayName,expiresAt:y.expiresAt??null}),f},[]),c=j.useCallback(()=>r(null),[]);j.useEffect(()=>(Kg(()=>{var y;return((y=s.current)==null?void 0:y.actingToken)??null}),Xg(c),()=>{Kg(null),Xg(null)}),[c]);const d=j.useCallback(()=>{var f;const y=(f=s.current)==null?void 0:f.expiresAt;return y?Math.max(0,Math.floor((new Date(y).getTime()-Date.now())/1e3)):0},[]),p=j.useMemo(()=>({identity:t,prime:l,clear:c,remainingSeconds:d}),[t,l,c,d]);return g.jsx(uv.Provider,{value:p,children:i})}const Yc={maxKeyGapMs:500,terminators:["Enter","Tab"],minLength:6,autoFireQuietMs:300,autoFireMaxAvgKeyMs:50},fv="lt_scan_wedge_config";function hv(){try{const i=localStorage.getItem(fv);return i?{...Yc,...JSON.parse(i)}:Yc}catch{return Yc}}function AO(i){const t={...hv(),...i};return localStorage.setItem(fv,JSON.stringify(t)),t}const jO=[/[1-9][0-9]:[0-9]:[a-zA-Z0-9._-]+$/,/[1-9][0-9]{7,}$/];function ky(i){let t=null;for(const r of jO){const s=i.match(r);s&&(!t||s[0].length>t.length)&&(t=s[0])}return t}const TO=new Set(["Shift","CapsLock"]),Ql={suppress:!1,emit:null};function NO(i=Yc){let t={buffer:"",times:[],lastKeyMs:0};function r(){t={buffer:"",times:[],lastKeyMs:0}}function s(d){const{key:p,timeMs:y,hasModifier:f,isRepeat:m}=d;if(TO.has(p))return Ql;if(i.terminators.includes(p)){const S=ky(t.buffer);return r(),S&&S.length>=i.minLength?{suppress:!0,emit:S,consumedLength:S.length}:Ql}if(f||m||p.length!==1)return r(),Ql;const b=y-t.lastKeyMs,v=t.lastKeyMs>0&&b<=i.maxKeyGapMs,_=(v?t.buffer+p:p).slice(-128),w=(v?[...t.times,y]:[y]).slice(-128);return t={buffer:_,times:w,lastKeyMs:y},Ql}function l(){return{buffer:t.buffer}}function c(){const d=ky(t.buffer);if(!d||d.length<i.minLength)return null;const p=t.times.slice(-d.length);return p.length<2||(p[p.length-1]-p[0])/(p.length-1)>i.autoFireMaxAvgKeyMs?null:{code:d,consumedLength:d.length}}return{step:s,reset:r,snapshot:l,pendingAutoFire:c}}function kO(){const i=document.activeElement;return i instanceof HTMLInputElement?["text","search","tel","url","email","password","number"].includes(i.type)?i:null:i instanceof HTMLTextAreaElement?i:null}function CO(i,t,r){var c;const s=i instanceof HTMLInputElement?HTMLInputElement.prototype:HTMLTextAreaElement.prototype,l=(c=Object.getOwnPropertyDescriptor(s,"value"))==null?void 0:c.set;l?l.call(i,t):i.value=t;try{i.setSelectionRange(r,r)}catch{}i.dispatchEvent(new Event("input",{bubbles:!0}))}function Cy(i){if(i<=0)return;const t=kO();if(!t)return;const r=t.selectionStart??t.value.length,s=Math.max(0,r-i);CO(t,t.value.slice(0,s)+t.value.slice(r),s)}function MO({active:i,wedgeConfig:t,diagnosticsOn:r,onScan:s,onDiag:l}){const c=j.useRef({diagnosticsOn:r,onScan:s,onDiag:l});c.current={diagnosticsOn:r,onScan:s,onDiag:l};const d=j.useRef(0),p=j.useRef(0);j.useEffect(()=>{if(!i)return;const y=NO(t);let f=null;const m=()=>{f&&(clearTimeout(f),f=null)},b=(w,S,M)=>{S&&Cy(S),c.current.diagnosticsOn&&(console.debug("[scan]",M),c.current.onDiag({seq:++d.current,key:"(quiet)",code:"",deltaMs:0,buffer:"",note:M})),c.current.onScan(w)},v=()=>{m(),y.pendingAutoFire()&&(f=setTimeout(()=>{f=null;const w=y.pendingAutoFire();w&&(y.reset(),b(w.code,w.consumedLength,`capture → ${w.code} (quiet period — no suffix)`))},t.autoFireQuietMs))},_=w=>{const S=y.snapshot().buffer,{suppress:M,emit:B,consumedLength:U}=y.step({key:w.key,timeMs:w.timeStamp,hasModifier:w.ctrlKey||w.metaKey||w.altKey,isRepeat:w.repeat});if(M&&(w.preventDefault(),w.stopPropagation()),c.current.diagnosticsOn){const ie=y.snapshot().buffer,ce=t.terminators.includes(w.key),C=B?`capture → ${B}`:ce?`terminator — no code tail in "${S.slice(-24)}"`:ie===S?S?"neutral (chord key)":"ignored":ie===""?"reset (edit/chord/non-printable)":ie.length<=1&&S.length>1?"gap — new episode":"accumulate",z=p.current?Math.round(w.timeStamp-p.current):0,re={seq:++d.current,key:w.key,code:w.code!==w.key?w.code:"",deltaMs:z,buffer:ie.slice(-24),note:C};console.debug("[scan]",re.key,re.code,`${re.deltaMs}ms`,re.note),c.current.onDiag(re)}p.current=w.timeStamp,B?(m(),U&&Cy(U),c.current.onScan(B)):v()};return window.addEventListener("keydown",_,{capture:!0}),()=>{m(),window.removeEventListener("keydown",_,{capture:!0})}},[i,t])}const Pe={EXECUTED:"executed",MATCHED_LIST:"matched_list",CONFIRM_REQUIRED:"confirm_required",NO_MATCH_FALLBACK:"no_match_fallback",UNCONFIGURED:"unconfigured",INVALID_CODE:"invalid_code",FORBIDDEN:"forbidden",CONFLICT:"conflict",IDENTITY_PRIMED:"identity_primed",IDENTITY_UNKNOWN:"identity_unknown",NOT_PRIMED:"not_primed",CHOICES:"choices"},Zl={SHOW_DETAIL:"show-detail",SHOW_LIST:"show-list",CLAIM:"claim",CLAIM_SHOW_DETAIL:"claim-show-detail",RELEASE:"release",RESOLVE:"resolve",ESCALATE:"escalate",CANCEL:"cancel",PRESENT:"present"},V3={ACTION:"action",IDENTITY:"identity"};function RO(i,t){return Oe("/scan-codes/execute",{method:"POST",body:JSON.stringify({code:i,...t!=null&&t.actingToken?{actingToken:t.actingToken}:{},...t!=null&&t.previousActingToken?{previousActingToken:t.previousActingToken}:{}})})}function Y3(i){return Oe("/scan-codes/execute-choice",{method:"POST",body:JSON.stringify(i)})}function K3(){return ft({queryKey:["scan-schemes"],queryFn:()=>Oe("/scan-codes/schemes")})}function X3(i){return ft({queryKey:["scan-schemes",i],queryFn:()=>Oe(`/scan-codes/schemes/${i}`),enabled:i!=null})}function J3(){const i=ht();return Et({mutationFn:t=>Oe(`/scan-codes/schemes/${t.version}`,{method:"PUT",body:JSON.stringify(t)}),onSuccess:()=>i.invalidateQueries({queryKey:["scan-schemes"]})})}function Q3(){const i=ht();return Et({mutationFn:t=>Oe(`/scan-codes/schemes/${t}`,{method:"DELETE"}),onSuccess:()=>i.invalidateQueries({queryKey:["scan-schemes"]})})}function Z3(){const i=ht();return Et({mutationFn:t=>Oe(`/scan-codes/schemes/${t.scheme_version}/actions/${t.category}`,{method:"PUT",body:JSON.stringify(t)}),onSuccess:(t,r)=>i.invalidateQueries({queryKey:["scan-schemes",r.scheme_version]})})}function W3(){const i=ht();return Et({mutationFn:t=>Oe(`/scan-codes/schemes/${t.scheme_version}/actions/${t.category}`,{method:"DELETE"}),onSuccess:(t,r)=>i.invalidateQueries({queryKey:["scan-schemes",r.scheme_version]})})}const My={KEYBOARD_WEDGE:"keyboard-wedge",MANUAL:"manual"},Cs=i=>{if(i)try{return JSON.parse(i)}catch{return}},Ui=i=>i==null||Array.isArray(i)&&i.length===0||typeof i=="object"&&!Array.isArray(i)&&Object.keys(i).length===0;function DO(i){const t={},r=Cs(i.get("facets"));Ui(r)||(t.facets=r);const s=Cs(i.get("block"));Ui(s)||(t.block=s);const l=Cs(i.get("range"));Ui(l)||(t.range=l);const c=Cs(i.get("exists"));Ui(c)||(t.exists=c);const d=Cs(i.get("roles"));Ui(d)||(t.roles=d);const p=Cs(i.get("orderBy"));Ui(p)||(t.orderBy=p),i.get("available")!=null&&(t.available=i.get("available")==="true");const y=i.get("jeopardy");return(y==="1"||y==="true")&&(t.jeopardy=!0),t}function ek(i,t){const r=(s,l)=>Ui(l)?i.delete(s):i.set(s,JSON.stringify(l));r("facets",t.facets),r("block",t.block),r("range",t.range),r("exists",t.exists),r("roles",t.roles),r("orderBy",t.orderBy),t.available==null?i.delete("available"):i.set("available",String(t.available)),t.jeopardy===!0?i.set("jeopardy","1"):i.delete("jeopardy")}const Ry=`&status=all&view=table&orderBy=${encodeURIComponent(JSON.stringify([{field:"created_at",direction:"desc"}]))}`;function dv(i,t){const r={};for(const[l,c]of Object.entries(i))r[l]=typeof c=="object"&&c!==null?JSON.stringify(c):c;const s=encodeURIComponent(JSON.stringify(r));return t?`/escalations/available?role=${encodeURIComponent(t)}&facets=${s}${Ry}`:`/escalations/available?facets=${s}${Ry}`}function tk(i,t,r){return dv({[i]:t},r)}function nk(i){var t,r,s;return Object.keys(i.facets??{}).length+(((t=i.block)==null?void 0:t.length)??0)+(((r=i.range)==null?void 0:r.length)??0)+(((s=i.exists)==null?void 0:s.length)??0)+(i.available!=null?1:0)+(i.jeopardy===!0?1:0)}function mv(){var r;const{data:i}=Wn(),t=Jb();return t!==null?t:!!((r=i==null?void 0:i.features)!=null&&r.scanCodes)}const pv=j.createContext(null);function gv(){const i=j.useContext(pv);if(!i)throw new Error("useScanInput must be used within ScanInputProvider");return i}const qO="scanPendingAction",BO="scanChoices",LO="/scan/station";function zO({children:i}){const{user:t}=Ht(),r=mv(),s=go(),{identity:l,prime:c}=EO(),[d,p]=j.useState(null),[y,f]=j.useState(!1),[m,b]=j.useState(()=>hv()),[v,_]=j.useState([]),[w,S]=j.useState(!1),M=j.useCallback(L=>{var W;const{outcome:G}=L;if(G===Pe.CONFIRM_REQUIRED&&L.pendingAction)return s(`/escalations/detail/${L.pendingAction.escalationId}`,{state:{[qO]:L.pendingAction}}),!0;if(G===Pe.EXECUTED&&L.escalation){const Q=[Zl.SHOW_DETAIL,Zl.CLAIM_SHOW_DETAIL,Zl.CLAIM,Zl.ESCALATE];return L.verb&&Q.includes(L.verb)?(s(`/escalations/detail/${L.escalation.id}`),!0):!1}if(G===Pe.MATCHED_LIST&&L.listQuery){const{targetFacet:Q,target:he,roles:_e}=L.listQuery;return s(dv({[Q]:he},(_e==null?void 0:_e[0])??null)),!0}return G===Pe.CHOICES&&L.choices?(s(LO,{state:{[BO]:L}}),!0):G===Pe.NO_MATCH_FALLBACK&&((W=L.fallback)!=null&&W.route)?(s(L.fallback.route),!0):!1},[s]),B=j.useRef(null);B.current=(l==null?void 0:l.actingToken)??null;const U=j.useRef(null),ie=j.useRef(null),ce=j.useCallback(L=>{ie.current=L},[]),C=j.useCallback(async(L,G=My.MANUAL)=>{var Q;if((Q=ie.current)!=null&&Q.call(ie,L))return;f(!0);const W=Date.now();try{const he=await RO(L,{actingToken:B.current??void 0,previousActingToken:U.current??void 0});he.outcome===Pe.IDENTITY_PRIMED&&(U.current=c(he));const _e=M(he);p({code:L,source:G,at:W,response:he,error:null,navigated:_e})}catch(he){p({code:L,source:G,at:W,response:null,error:he.message,navigated:!1})}finally{f(!1)}},[M,c]),z=j.useRef(C);z.current=C,MO({active:!!t&&r,wedgeConfig:m,diagnosticsOn:w,onScan:L=>void z.current(L,My.KEYBOARD_WEDGE),onDiag:L=>_(G=>[...G.slice(-29),L])});const re=j.useCallback(L=>{b(AO(L))},[]),X=j.useMemo(()=>({submitCode:C,setCodeInterceptor:ce,lastResult:d,busy:y,wedgeConfig:m,updateWedgeConfig:re,diagnostics:v,diagnosticsOn:w,setDiagnosticsOn:S}),[C,ce,d,y,m,re,v,w]);return g.jsx(pv.Provider,{value:X,children:i})}var Wl={},Ka={},ec={},Dy;function yn(){if(Dy)return ec;Dy=1,Object.defineProperty(ec,"__esModule",{value:!0});function i(r,s){if(!(r instanceof s))throw new TypeError("Cannot call a class as a function")}var t=function r(s,l){i(this,r),this.data=s,this.text=l.text||s,this.options=l};return ec.default=t,ec}var qy;function UO(){if(qy)return Ka;qy=1,Object.defineProperty(Ka,"__esModule",{value:!0}),Ka.CODE39=void 0;var i=(function(){function S(M,B){for(var U=0;U<B.length;U++){var ie=B[U];ie.enumerable=ie.enumerable||!1,ie.configurable=!0,"value"in ie&&(ie.writable=!0),Object.defineProperty(M,ie.key,ie)}}return function(M,B,U){return B&&S(M.prototype,B),U&&S(M,U),M}})(),t=yn(),r=s(t);function s(S){return S&&S.__esModule?S:{default:S}}function l(S,M){if(!(S instanceof M))throw new TypeError("Cannot call a class as a function")}function c(S,M){if(!S)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return M&&(typeof M=="object"||typeof M=="function")?M:S}function d(S,M){if(typeof M!="function"&&M!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof M);S.prototype=Object.create(M&&M.prototype,{constructor:{value:S,enumerable:!1,writable:!0,configurable:!0}}),M&&(Object.setPrototypeOf?Object.setPrototypeOf(S,M):S.__proto__=M)}var p=(function(S){d(M,S);function M(B,U){return l(this,M),B=B.toUpperCase(),U.mod43&&(B+=v(w(B))),c(this,(M.__proto__||Object.getPrototypeOf(M)).call(this,B,U))}return i(M,[{key:"encode",value:function(){for(var U=m("*"),ie=0;ie<this.data.length;ie++)U+=m(this.data[ie])+"0";return U+=m("*"),{data:U,text:this.text}}},{key:"valid",value:function(){return this.data.search(/^[0-9A-Z\-\.\ \$\/\+\%]+$/)!==-1}}]),M})(r.default),y=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","-","."," ","$","/","+","%","*"],f=[20957,29783,23639,30485,20951,29813,23669,20855,29789,23645,29975,23831,30533,22295,30149,24005,21623,29981,23837,22301,30023,23879,30545,22343,30161,24017,21959,30065,23921,22385,29015,18263,29141,17879,29045,18293,17783,29021,18269,17477,17489,17681,20753,35770];function m(S){return b(_(S))}function b(S){return f[S].toString(2)}function v(S){return y[S]}function _(S){return y.indexOf(S)}function w(S){for(var M=0,B=0;B<S.length;B++)M+=_(S[B]);return M=M%43,M}return Ka.CODE39=p,Ka}var zn={},tc={},nc={},ut={},By;function vo(){if(By)return ut;By=1,Object.defineProperty(ut,"__esModule",{value:!0});var i;function t(y,f,m){return f in y?Object.defineProperty(y,f,{value:m,enumerable:!0,configurable:!0,writable:!0}):y[f]=m,y}var r=ut.SET_A=0,s=ut.SET_B=1,l=ut.SET_C=2;ut.SHIFT=98;var c=ut.START_A=103,d=ut.START_B=104,p=ut.START_C=105;return ut.MODULO=103,ut.STOP=106,ut.FNC1=207,ut.SET_BY_CODE=(i={},t(i,c,r),t(i,d,s),t(i,p,l),i),ut.SWAP={101:r,100:s,99:l},ut.A_START_CHAR="Ð",ut.B_START_CHAR="Ñ",ut.C_START_CHAR="Ò",ut.A_CHARS="[\0-_È-Ï]",ut.B_CHARS="[ -È-Ï]",ut.C_CHARS="(Ï*[0-9]{2}Ï*)",ut.BARS=[11011001100,11001101100,11001100110,10010011e3,10010001100,10001001100,10011001e3,10011000100,10001100100,11001001e3,11001000100,11000100100,10110011100,10011011100,10011001110,10111001100,10011101100,10011100110,11001110010,11001011100,11001001110,11011100100,11001110100,11101101110,11101001100,11100101100,11100100110,11101100100,11100110100,11100110010,11011011e3,11011000110,11000110110,10100011e3,10001011e3,10001000110,10110001e3,10001101e3,10001100010,11010001e3,11000101e3,11000100010,10110111e3,10110001110,10001101110,10111011e3,10111000110,10001110110,11101110110,11010001110,11000101110,11011101e3,11011100010,11011101110,11101011e3,11101000110,11100010110,11101101e3,11101100010,11100011010,11101111010,11001000010,11110001010,1010011e4,10100001100,1001011e4,10010000110,10000101100,10000100110,1011001e4,10110000100,1001101e4,10011000010,10000110100,10000110010,11000010010,1100101e4,11110111010,11000010100,10001111010,10100111100,10010111100,10010011110,10111100100,10011110100,10011110010,11110100100,11110010100,11110010010,11011011110,11011110110,11110110110,10101111e3,10100011110,10001011110,10111101e3,10111100010,11110101e3,11110100010,10111011110,10111101110,11101011110,11110101110,11010000100,1101001e4,11010011100,1100011101011],ut}var Ly;function pu(){if(Ly)return nc;Ly=1,Object.defineProperty(nc,"__esModule",{value:!0});var i=(function(){function f(m,b){for(var v=0;v<b.length;v++){var _=b[v];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(m,_.key,_)}}return function(m,b,v){return b&&f(m.prototype,b),v&&f(m,v),m}})(),t=yn(),r=l(t),s=vo();function l(f){return f&&f.__esModule?f:{default:f}}function c(f,m){if(!(f instanceof m))throw new TypeError("Cannot call a class as a function")}function d(f,m){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:f}function p(f,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);f.prototype=Object.create(m&&m.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(f,m):f.__proto__=m)}var y=(function(f){p(m,f);function m(b,v){c(this,m);var _=d(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,b.substring(1),v));return _.bytes=b.split("").map(function(w){return w.charCodeAt(0)}),_}return i(m,[{key:"valid",value:function(){return/^[\x00-\x7F\xC8-\xD3]+$/.test(this.data)}},{key:"encode",value:function(){var v=this.bytes,_=v.shift()-105,w=s.SET_BY_CODE[_];if(w===void 0)throw new RangeError("The encoding does not start with a start character.");this.shouldEncodeAsEan128()===!0&&v.unshift(s.FNC1);var S=m.next(v,1,w);return{text:this.text===this.data?this.text.replace(/[^\x20-\x7E]/g,""):this.text,data:m.getBar(_)+S.result+m.getBar((S.checksum+_)%s.MODULO)+m.getBar(s.STOP)}}},{key:"shouldEncodeAsEan128",value:function(){var v=this.options.ean128||!1;return typeof v=="string"&&(v=v.toLowerCase()==="true"),v}}],[{key:"getBar",value:function(v){return s.BARS[v]?s.BARS[v].toString():""}},{key:"correctIndex",value:function(v,_){if(_===s.SET_A){var w=v.shift();return w<32?w+64:w-32}else return _===s.SET_B?v.shift()-32:(v.shift()-48)*10+v.shift()-48}},{key:"next",value:function(v,_,w){if(!v.length)return{result:"",checksum:0};var S=void 0,M=void 0;if(v[0]>=200){M=v.shift()-105;var B=s.SWAP[M];B!==void 0?S=m.next(v,_+1,B):((w===s.SET_A||w===s.SET_B)&&M===s.SHIFT&&(v[0]=w===s.SET_A?v[0]>95?v[0]-96:v[0]:v[0]<32?v[0]+96:v[0]),S=m.next(v,_+1,w))}else M=m.correctIndex(v,w),S=m.next(v,_+1,w);var U=m.getBar(M),ie=M*_;return{result:U+S.result,checksum:ie+S.checksum}}}]),m})(r.default);return nc.default=y,nc}var rc={},zy;function PO(){if(zy)return rc;zy=1,Object.defineProperty(rc,"__esModule",{value:!0});var i=vo(),t=function(p){return p.match(new RegExp("^"+i.A_CHARS+"*"))[0].length},r=function(p){return p.match(new RegExp("^"+i.B_CHARS+"*"))[0].length},s=function(p){return p.match(new RegExp("^"+i.C_CHARS+"*"))[0]};function l(d,p){var y=p?i.A_CHARS:i.B_CHARS,f=d.match(new RegExp("^("+y+"+?)(([0-9]{2}){2,})([^0-9]|$)"));if(f)return f[1]+"Ì"+c(d.substring(f[1].length));var m=d.match(new RegExp("^"+y+"+"))[0];return m.length===d.length?d:m+String.fromCharCode(p?205:206)+l(d.substring(m.length),!p)}function c(d){var p=s(d),y=p.length;if(y===d.length)return d;d=d.substring(y);var f=t(d)>=r(d);return p+String.fromCharCode(f?206:205)+l(d,f)}return rc.default=function(d){var p=void 0,y=s(d).length;if(y>=2)p=i.C_START_CHAR+c(d);else{var f=t(d)>r(d);p=(f?i.A_START_CHAR:i.B_START_CHAR)+l(d,f)}return p.replace(/[\xCD\xCE]([^])[\xCD\xCE]/,function(m,b){return"Ë"+b})},rc}var Uy;function IO(){if(Uy)return tc;Uy=1,Object.defineProperty(tc,"__esModule",{value:!0});var i=pu(),t=l(i),r=PO(),s=l(r);function l(f){return f&&f.__esModule?f:{default:f}}function c(f,m){if(!(f instanceof m))throw new TypeError("Cannot call a class as a function")}function d(f,m){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:f}function p(f,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);f.prototype=Object.create(m&&m.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(f,m):f.__proto__=m)}var y=(function(f){p(m,f);function m(b,v){if(c(this,m),/^[\x00-\x7F\xC8-\xD3]+$/.test(b))var _=d(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,(0,s.default)(b),v));else var _=d(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,b,v));return d(_)}return m})(t.default);return tc.default=y,tc}var ic={},Py;function $O(){if(Py)return ic;Py=1,Object.defineProperty(ic,"__esModule",{value:!0});var i=(function(){function f(m,b){for(var v=0;v<b.length;v++){var _=b[v];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(m,_.key,_)}}return function(m,b,v){return b&&f(m.prototype,b),v&&f(m,v),m}})(),t=pu(),r=l(t),s=vo();function l(f){return f&&f.__esModule?f:{default:f}}function c(f,m){if(!(f instanceof m))throw new TypeError("Cannot call a class as a function")}function d(f,m){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:f}function p(f,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);f.prototype=Object.create(m&&m.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(f,m):f.__proto__=m)}var y=(function(f){p(m,f);function m(b,v){return c(this,m),d(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,s.A_START_CHAR+b,v))}return i(m,[{key:"valid",value:function(){return new RegExp("^"+s.A_CHARS+"+$").test(this.data)}}]),m})(r.default);return ic.default=y,ic}var sc={},Iy;function HO(){if(Iy)return sc;Iy=1,Object.defineProperty(sc,"__esModule",{value:!0});var i=(function(){function f(m,b){for(var v=0;v<b.length;v++){var _=b[v];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(m,_.key,_)}}return function(m,b,v){return b&&f(m.prototype,b),v&&f(m,v),m}})(),t=pu(),r=l(t),s=vo();function l(f){return f&&f.__esModule?f:{default:f}}function c(f,m){if(!(f instanceof m))throw new TypeError("Cannot call a class as a function")}function d(f,m){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:f}function p(f,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);f.prototype=Object.create(m&&m.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(f,m):f.__proto__=m)}var y=(function(f){p(m,f);function m(b,v){return c(this,m),d(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,s.B_START_CHAR+b,v))}return i(m,[{key:"valid",value:function(){return new RegExp("^"+s.B_CHARS+"+$").test(this.data)}}]),m})(r.default);return sc.default=y,sc}var ac={},$y;function GO(){if($y)return ac;$y=1,Object.defineProperty(ac,"__esModule",{value:!0});var i=(function(){function f(m,b){for(var v=0;v<b.length;v++){var _=b[v];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(m,_.key,_)}}return function(m,b,v){return b&&f(m.prototype,b),v&&f(m,v),m}})(),t=pu(),r=l(t),s=vo();function l(f){return f&&f.__esModule?f:{default:f}}function c(f,m){if(!(f instanceof m))throw new TypeError("Cannot call a class as a function")}function d(f,m){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:f}function p(f,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);f.prototype=Object.create(m&&m.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(f,m):f.__proto__=m)}var y=(function(f){p(m,f);function m(b,v){return c(this,m),d(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,s.C_START_CHAR+b,v))}return i(m,[{key:"valid",value:function(){return new RegExp("^"+s.C_CHARS+"+$").test(this.data)}}]),m})(r.default);return ac.default=y,ac}var Hy;function FO(){if(Hy)return zn;Hy=1,Object.defineProperty(zn,"__esModule",{value:!0}),zn.CODE128C=zn.CODE128B=zn.CODE128A=zn.CODE128=void 0;var i=IO(),t=y(i),r=$O(),s=y(r),l=HO(),c=y(l),d=GO(),p=y(d);function y(f){return f&&f.__esModule?f:{default:f}}return zn.CODE128=t.default,zn.CODE128A=s.default,zn.CODE128B=c.default,zn.CODE128C=p.default,zn}var Ut={},oc={},_r={},Gy;function xo(){return Gy||(Gy=1,Object.defineProperty(_r,"__esModule",{value:!0}),_r.SIDE_BIN="101",_r.MIDDLE_BIN="01010",_r.BINARIES={L:["0001101","0011001","0010011","0111101","0100011","0110001","0101111","0111011","0110111","0001011"],G:["0100111","0110011","0011011","0100001","0011101","0111001","0000101","0010001","0001001","0010111"],R:["1110010","1100110","1101100","1000010","1011100","1001110","1010000","1000100","1001000","1110100"],O:["0001101","0011001","0010011","0111101","0100011","0110001","0101111","0111011","0110111","0001011"],E:["0100111","0110011","0011011","0100001","0011101","0111001","0000101","0010001","0001001","0010111"]},_r.EAN2_STRUCTURE=["LL","LG","GL","GG"],_r.EAN5_STRUCTURE=["GGLLL","GLGLL","GLLGL","GLLLG","LGGLL","LLGGL","LLLGG","LGLGL","LGLLG","LLGLG"],_r.EAN13_STRUCTURE=["LLLLLL","LLGLGG","LLGGLG","LLGGGL","LGLLGG","LGGLLG","LGGGLL","LGLGLG","LGLGGL","LGGLGL"]),_r}var lc={},cc={},Fy;function _o(){if(Fy)return cc;Fy=1,Object.defineProperty(cc,"__esModule",{value:!0});var i=xo(),t=function(s,l,c){var d=s.split("").map(function(y,f){return i.BINARIES[l[f]]}).map(function(y,f){return y?y[s[f]]:""});if(c){var p=s.length-1;d=d.map(function(y,f){return f<p?y+c:y})}return d.join("")};return cc.default=t,cc}var Vy;function yv(){if(Vy)return lc;Vy=1,Object.defineProperty(lc,"__esModule",{value:!0});var i=(function(){function b(v,_){for(var w=0;w<_.length;w++){var S=_[w];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(v,S.key,S)}}return function(v,_,w){return _&&b(v.prototype,_),w&&b(v,w),v}})(),t=xo(),r=_o(),s=d(r),l=yn(),c=d(l);function d(b){return b&&b.__esModule?b:{default:b}}function p(b,v){if(!(b instanceof v))throw new TypeError("Cannot call a class as a function")}function y(b,v){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return v&&(typeof v=="object"||typeof v=="function")?v:b}function f(b,v){if(typeof v!="function"&&v!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof v);b.prototype=Object.create(v&&v.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),v&&(Object.setPrototypeOf?Object.setPrototypeOf(b,v):b.__proto__=v)}var m=(function(b){f(v,b);function v(_,w){p(this,v);var S=y(this,(v.__proto__||Object.getPrototypeOf(v)).call(this,_,w));return S.fontSize=!w.flat&&w.fontSize>w.width*10?w.width*10:w.fontSize,S.guardHeight=w.height+S.fontSize/2+w.textMargin,S}return i(v,[{key:"encode",value:function(){return this.options.flat?this.encodeFlat():this.encodeGuarded()}},{key:"leftText",value:function(w,S){return this.text.substr(w,S)}},{key:"leftEncode",value:function(w,S){return(0,s.default)(w,S)}},{key:"rightText",value:function(w,S){return this.text.substr(w,S)}},{key:"rightEncode",value:function(w,S){return(0,s.default)(w,S)}},{key:"encodeGuarded",value:function(){var w={fontSize:this.fontSize},S={height:this.guardHeight};return[{data:t.SIDE_BIN,options:S},{data:this.leftEncode(),text:this.leftText(),options:w},{data:t.MIDDLE_BIN,options:S},{data:this.rightEncode(),text:this.rightText(),options:w},{data:t.SIDE_BIN,options:S}]}},{key:"encodeFlat",value:function(){var w=[t.SIDE_BIN,this.leftEncode(),t.MIDDLE_BIN,this.rightEncode(),t.SIDE_BIN];return{data:w.join(""),text:this.text}}}]),v})(c.default);return lc.default=m,lc}var Yy;function VO(){if(Yy)return oc;Yy=1,Object.defineProperty(oc,"__esModule",{value:!0});var i=(function(){function b(v,_){for(var w=0;w<_.length;w++){var S=_[w];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(v,S.key,S)}}return function(v,_,w){return _&&b(v.prototype,_),w&&b(v,w),v}})(),t=function b(v,_,w){v===null&&(v=Function.prototype);var S=Object.getOwnPropertyDescriptor(v,_);if(S===void 0){var M=Object.getPrototypeOf(v);return M===null?void 0:b(M,_,w)}else{if("value"in S)return S.value;var B=S.get;return B===void 0?void 0:B.call(w)}},r=xo(),s=yv(),l=c(s);function c(b){return b&&b.__esModule?b:{default:b}}function d(b,v){if(!(b instanceof v))throw new TypeError("Cannot call a class as a function")}function p(b,v){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return v&&(typeof v=="object"||typeof v=="function")?v:b}function y(b,v){if(typeof v!="function"&&v!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof v);b.prototype=Object.create(v&&v.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),v&&(Object.setPrototypeOf?Object.setPrototypeOf(b,v):b.__proto__=v)}var f=function(v){var _=v.substr(0,12).split("").map(function(w){return+w}).reduce(function(w,S,M){return M%2?w+S*3:w+S},0);return(10-_%10)%10},m=(function(b){y(v,b);function v(_,w){d(this,v),_.search(/^[0-9]{12}$/)!==-1&&(_+=f(_));var S=p(this,(v.__proto__||Object.getPrototypeOf(v)).call(this,_,w));return S.lastChar=w.lastChar,S}return i(v,[{key:"valid",value:function(){return this.data.search(/^[0-9]{13}$/)!==-1&&+this.data[12]===f(this.data)}},{key:"leftText",value:function(){return t(v.prototype.__proto__||Object.getPrototypeOf(v.prototype),"leftText",this).call(this,1,6)}},{key:"leftEncode",value:function(){var w=this.data.substr(1,6),S=r.EAN13_STRUCTURE[this.data[0]];return t(v.prototype.__proto__||Object.getPrototypeOf(v.prototype),"leftEncode",this).call(this,w,S)}},{key:"rightText",value:function(){return t(v.prototype.__proto__||Object.getPrototypeOf(v.prototype),"rightText",this).call(this,7,6)}},{key:"rightEncode",value:function(){var w=this.data.substr(7,6);return t(v.prototype.__proto__||Object.getPrototypeOf(v.prototype),"rightEncode",this).call(this,w,"RRRRRR")}},{key:"encodeGuarded",value:function(){var w=t(v.prototype.__proto__||Object.getPrototypeOf(v.prototype),"encodeGuarded",this).call(this);return this.options.displayValue&&(w.unshift({data:"000000000000",text:this.text.substr(0,1),options:{textAlign:"left",fontSize:this.fontSize}}),this.options.lastChar&&(w.push({data:"00"}),w.push({data:"00000",text:this.options.lastChar,options:{fontSize:this.fontSize}}))),w}}]),v})(l.default);return oc.default=m,oc}var uc={},Ky;function YO(){if(Ky)return uc;Ky=1,Object.defineProperty(uc,"__esModule",{value:!0});var i=(function(){function m(b,v){for(var _=0;_<v.length;_++){var w=v[_];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(b,w.key,w)}}return function(b,v,_){return v&&m(b.prototype,v),_&&m(b,_),b}})(),t=function m(b,v,_){b===null&&(b=Function.prototype);var w=Object.getOwnPropertyDescriptor(b,v);if(w===void 0){var S=Object.getPrototypeOf(b);return S===null?void 0:m(S,v,_)}else{if("value"in w)return w.value;var M=w.get;return M===void 0?void 0:M.call(_)}},r=yv(),s=l(r);function l(m){return m&&m.__esModule?m:{default:m}}function c(m,b){if(!(m instanceof b))throw new TypeError("Cannot call a class as a function")}function d(m,b){if(!m)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return b&&(typeof b=="object"||typeof b=="function")?b:m}function p(m,b){if(typeof b!="function"&&b!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof b);m.prototype=Object.create(b&&b.prototype,{constructor:{value:m,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(m,b):m.__proto__=b)}var y=function(b){var v=b.substr(0,7).split("").map(function(_){return+_}).reduce(function(_,w,S){return S%2?_+w:_+w*3},0);return(10-v%10)%10},f=(function(m){p(b,m);function b(v,_){return c(this,b),v.search(/^[0-9]{7}$/)!==-1&&(v+=y(v)),d(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,v,_))}return i(b,[{key:"valid",value:function(){return this.data.search(/^[0-9]{8}$/)!==-1&&+this.data[7]===y(this.data)}},{key:"leftText",value:function(){return t(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"leftText",this).call(this,0,4)}},{key:"leftEncode",value:function(){var _=this.data.substr(0,4);return t(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"leftEncode",this).call(this,_,"LLLL")}},{key:"rightText",value:function(){return t(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"rightText",this).call(this,4,4)}},{key:"rightEncode",value:function(){var _=this.data.substr(4,4);return t(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"rightEncode",this).call(this,_,"RRRR")}}]),b})(s.default);return uc.default=f,uc}var fc={},Xy;function KO(){if(Xy)return fc;Xy=1,Object.defineProperty(fc,"__esModule",{value:!0});var i=(function(){function v(_,w){for(var S=0;S<w.length;S++){var M=w[S];M.enumerable=M.enumerable||!1,M.configurable=!0,"value"in M&&(M.writable=!0),Object.defineProperty(_,M.key,M)}}return function(_,w,S){return w&&v(_.prototype,w),S&&v(_,S),_}})(),t=xo(),r=_o(),s=d(r),l=yn(),c=d(l);function d(v){return v&&v.__esModule?v:{default:v}}function p(v,_){if(!(v instanceof _))throw new TypeError("Cannot call a class as a function")}function y(v,_){if(!v)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return _&&(typeof _=="object"||typeof _=="function")?_:v}function f(v,_){if(typeof _!="function"&&_!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof _);v.prototype=Object.create(_&&_.prototype,{constructor:{value:v,enumerable:!1,writable:!0,configurable:!0}}),_&&(Object.setPrototypeOf?Object.setPrototypeOf(v,_):v.__proto__=_)}var m=function(_){var w=_.split("").map(function(S){return+S}).reduce(function(S,M,B){return B%2?S+M*9:S+M*3},0);return w%10},b=(function(v){f(_,v);function _(w,S){return p(this,_),y(this,(_.__proto__||Object.getPrototypeOf(_)).call(this,w,S))}return i(_,[{key:"valid",value:function(){return this.data.search(/^[0-9]{5}$/)!==-1}},{key:"encode",value:function(){var S=t.EAN5_STRUCTURE[m(this.data)];return{data:"1011"+(0,s.default)(this.data,S,"01"),text:this.text}}}]),_})(c.default);return fc.default=b,fc}var hc={},Jy;function XO(){if(Jy)return hc;Jy=1,Object.defineProperty(hc,"__esModule",{value:!0});var i=(function(){function b(v,_){for(var w=0;w<_.length;w++){var S=_[w];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(v,S.key,S)}}return function(v,_,w){return _&&b(v.prototype,_),w&&b(v,w),v}})(),t=xo(),r=_o(),s=d(r),l=yn(),c=d(l);function d(b){return b&&b.__esModule?b:{default:b}}function p(b,v){if(!(b instanceof v))throw new TypeError("Cannot call a class as a function")}function y(b,v){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return v&&(typeof v=="object"||typeof v=="function")?v:b}function f(b,v){if(typeof v!="function"&&v!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof v);b.prototype=Object.create(v&&v.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),v&&(Object.setPrototypeOf?Object.setPrototypeOf(b,v):b.__proto__=v)}var m=(function(b){f(v,b);function v(_,w){return p(this,v),y(this,(v.__proto__||Object.getPrototypeOf(v)).call(this,_,w))}return i(v,[{key:"valid",value:function(){return this.data.search(/^[0-9]{2}$/)!==-1}},{key:"encode",value:function(){var w=t.EAN2_STRUCTURE[parseInt(this.data)%4];return{data:"1011"+(0,s.default)(this.data,w,"01"),text:this.text}}}]),v})(c.default);return hc.default=m,hc}var Xa={},Qy;function bv(){if(Qy)return Xa;Qy=1,Object.defineProperty(Xa,"__esModule",{value:!0});var i=(function(){function b(v,_){for(var w=0;w<_.length;w++){var S=_[w];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(v,S.key,S)}}return function(v,_,w){return _&&b(v.prototype,_),w&&b(v,w),v}})();Xa.checksum=m;var t=_o(),r=c(t),s=yn(),l=c(s);function c(b){return b&&b.__esModule?b:{default:b}}function d(b,v){if(!(b instanceof v))throw new TypeError("Cannot call a class as a function")}function p(b,v){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return v&&(typeof v=="object"||typeof v=="function")?v:b}function y(b,v){if(typeof v!="function"&&v!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof v);b.prototype=Object.create(v&&v.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),v&&(Object.setPrototypeOf?Object.setPrototypeOf(b,v):b.__proto__=v)}var f=(function(b){y(v,b);function v(_,w){d(this,v),_.search(/^[0-9]{11}$/)!==-1&&(_+=m(_));var S=p(this,(v.__proto__||Object.getPrototypeOf(v)).call(this,_,w));return S.displayValue=w.displayValue,w.fontSize>w.width*10?S.fontSize=w.width*10:S.fontSize=w.fontSize,S.guardHeight=w.height+S.fontSize/2+w.textMargin,S}return i(v,[{key:"valid",value:function(){return this.data.search(/^[0-9]{12}$/)!==-1&&this.data[11]==m(this.data)}},{key:"encode",value:function(){return this.options.flat?this.flatEncoding():this.guardedEncoding()}},{key:"flatEncoding",value:function(){var w="";return w+="101",w+=(0,r.default)(this.data.substr(0,6),"LLLLLL"),w+="01010",w+=(0,r.default)(this.data.substr(6,6),"RRRRRR"),w+="101",{data:w,text:this.text}}},{key:"guardedEncoding",value:function(){var w=[];return this.displayValue&&w.push({data:"00000000",text:this.text.substr(0,1),options:{textAlign:"left",fontSize:this.fontSize}}),w.push({data:"101"+(0,r.default)(this.data[0],"L"),options:{height:this.guardHeight}}),w.push({data:(0,r.default)(this.data.substr(1,5),"LLLLL"),text:this.text.substr(1,5),options:{fontSize:this.fontSize}}),w.push({data:"01010",options:{height:this.guardHeight}}),w.push({data:(0,r.default)(this.data.substr(6,5),"RRRRR"),text:this.text.substr(6,5),options:{fontSize:this.fontSize}}),w.push({data:(0,r.default)(this.data[11],"R")+"101",options:{height:this.guardHeight}}),this.displayValue&&w.push({data:"00000000",text:this.text.substr(11,1),options:{textAlign:"right",fontSize:this.fontSize}}),w}}]),v})(l.default);function m(b){var v=0,_;for(_=1;_<11;_+=2)v+=parseInt(b[_]);for(_=0;_<11;_+=2)v+=parseInt(b[_])*3;return(10-v%10)%10}return Xa.default=f,Xa}var dc={},Zy;function JO(){if(Zy)return dc;Zy=1,Object.defineProperty(dc,"__esModule",{value:!0});var i=(function(){function w(S,M){for(var B=0;B<M.length;B++){var U=M[B];U.enumerable=U.enumerable||!1,U.configurable=!0,"value"in U&&(U.writable=!0),Object.defineProperty(S,U.key,U)}}return function(S,M,B){return M&&w(S.prototype,M),B&&w(S,B),S}})(),t=_o(),r=d(t),s=yn(),l=d(s),c=bv();function d(w){return w&&w.__esModule?w:{default:w}}function p(w,S){if(!(w instanceof S))throw new TypeError("Cannot call a class as a function")}function y(w,S){if(!w)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return S&&(typeof S=="object"||typeof S=="function")?S:w}function f(w,S){if(typeof S!="function"&&S!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof S);w.prototype=Object.create(S&&S.prototype,{constructor:{value:w,enumerable:!1,writable:!0,configurable:!0}}),S&&(Object.setPrototypeOf?Object.setPrototypeOf(w,S):w.__proto__=S)}var m=["XX00000XXX","XX10000XXX","XX20000XXX","XXX00000XX","XXXX00000X","XXXXX00005","XXXXX00006","XXXXX00007","XXXXX00008","XXXXX00009"],b=[["EEEOOO","OOOEEE"],["EEOEOO","OOEOEE"],["EEOOEO","OOEEOE"],["EEOOOE","OOEEEO"],["EOEEOO","OEOOEE"],["EOOEEO","OEEOOE"],["EOOOEE","OEEEOO"],["EOEOEO","OEOEOE"],["EOEOOE","OEOEEO"],["EOOEOE","OEEOEO"]],v=(function(w){f(S,w);function S(M,B){p(this,S);var U=y(this,(S.__proto__||Object.getPrototypeOf(S)).call(this,M,B));if(U.isValid=!1,M.search(/^[0-9]{6}$/)!==-1)U.middleDigits=M,U.upcA=_(M,"0"),U.text=B.text||""+U.upcA[0]+M+U.upcA[U.upcA.length-1],U.isValid=!0;else if(M.search(/^[01][0-9]{7}$/)!==-1)if(U.middleDigits=M.substring(1,M.length-1),U.upcA=_(U.middleDigits,M[0]),U.upcA[U.upcA.length-1]===M[M.length-1])U.isValid=!0;else return y(U);else return y(U);return U.displayValue=B.displayValue,B.fontSize>B.width*10?U.fontSize=B.width*10:U.fontSize=B.fontSize,U.guardHeight=B.height+U.fontSize/2+B.textMargin,U}return i(S,[{key:"valid",value:function(){return this.isValid}},{key:"encode",value:function(){return this.options.flat?this.flatEncoding():this.guardedEncoding()}},{key:"flatEncoding",value:function(){var B="";return B+="101",B+=this.encodeMiddleDigits(),B+="010101",{data:B,text:this.text}}},{key:"guardedEncoding",value:function(){var B=[];return this.displayValue&&B.push({data:"00000000",text:this.text[0],options:{textAlign:"left",fontSize:this.fontSize}}),B.push({data:"101",options:{height:this.guardHeight}}),B.push({data:this.encodeMiddleDigits(),text:this.text.substring(1,7),options:{fontSize:this.fontSize}}),B.push({data:"010101",options:{height:this.guardHeight}}),this.displayValue&&B.push({data:"00000000",text:this.text[7],options:{textAlign:"right",fontSize:this.fontSize}}),B}},{key:"encodeMiddleDigits",value:function(){var B=this.upcA[0],U=this.upcA[this.upcA.length-1],ie=b[parseInt(U)][parseInt(B)];return(0,r.default)(this.middleDigits,ie)}}]),S})(l.default);function _(w,S){for(var M=parseInt(w[w.length-1]),B=m[M],U="",ie=0,ce=0;ce<B.length;ce++){var C=B[ce];C==="X"?U+=w[ie++]:U+=C}return U=""+S+U,""+U+(0,c.checksum)(U)}return dc.default=v,dc}var Wy;function QO(){if(Wy)return Ut;Wy=1,Object.defineProperty(Ut,"__esModule",{value:!0}),Ut.UPCE=Ut.UPC=Ut.EAN2=Ut.EAN5=Ut.EAN8=Ut.EAN13=void 0;var i=VO(),t=v(i),r=YO(),s=v(r),l=KO(),c=v(l),d=XO(),p=v(d),y=bv(),f=v(y),m=JO(),b=v(m);function v(_){return _&&_.__esModule?_:{default:_}}return Ut.EAN13=t.default,Ut.EAN8=s.default,Ut.EAN5=c.default,Ut.EAN2=p.default,Ut.UPC=f.default,Ut.UPCE=b.default,Ut}var Li={},mc={},Ms={},e1;function ZO(){return e1||(e1=1,Object.defineProperty(Ms,"__esModule",{value:!0}),Ms.START_BIN="1010",Ms.END_BIN="11101",Ms.BINARIES=["00110","10001","01001","11000","00101","10100","01100","00011","10010","01010"]),Ms}var t1;function vv(){if(t1)return mc;t1=1,Object.defineProperty(mc,"__esModule",{value:!0});var i=(function(){function f(m,b){for(var v=0;v<b.length;v++){var _=b[v];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(m,_.key,_)}}return function(m,b,v){return b&&f(m.prototype,b),v&&f(m,v),m}})(),t=ZO(),r=yn(),s=l(r);function l(f){return f&&f.__esModule?f:{default:f}}function c(f,m){if(!(f instanceof m))throw new TypeError("Cannot call a class as a function")}function d(f,m){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:f}function p(f,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);f.prototype=Object.create(m&&m.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(f,m):f.__proto__=m)}var y=(function(f){p(m,f);function m(){return c(this,m),d(this,(m.__proto__||Object.getPrototypeOf(m)).apply(this,arguments))}return i(m,[{key:"valid",value:function(){return this.data.search(/^([0-9]{2})+$/)!==-1}},{key:"encode",value:function(){var v=this,_=this.data.match(/.{2}/g).map(function(w){return v.encodePair(w)}).join("");return{data:t.START_BIN+_+t.END_BIN,text:this.text}}},{key:"encodePair",value:function(v){var _=t.BINARIES[v[1]];return t.BINARIES[v[0]].split("").map(function(w,S){return(w==="1"?"111":"1")+(_[S]==="1"?"000":"0")}).join("")}}]),m})(s.default);return mc.default=y,mc}var pc={},n1;function WO(){if(n1)return pc;n1=1,Object.defineProperty(pc,"__esModule",{value:!0});var i=(function(){function f(m,b){for(var v=0;v<b.length;v++){var _=b[v];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(m,_.key,_)}}return function(m,b,v){return b&&f(m.prototype,b),v&&f(m,v),m}})(),t=vv(),r=s(t);function s(f){return f&&f.__esModule?f:{default:f}}function l(f,m){if(!(f instanceof m))throw new TypeError("Cannot call a class as a function")}function c(f,m){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:f}function d(f,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);f.prototype=Object.create(m&&m.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(f,m):f.__proto__=m)}var p=function(m){var b=m.substr(0,13).split("").map(function(v){return parseInt(v,10)}).reduce(function(v,_,w){return v+_*(3-w%2*2)},0);return Math.ceil(b/10)*10-b},y=(function(f){d(m,f);function m(b,v){return l(this,m),b.search(/^[0-9]{13}$/)!==-1&&(b+=p(b)),c(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,b,v))}return i(m,[{key:"valid",value:function(){return this.data.search(/^[0-9]{14}$/)!==-1&&+this.data[13]===p(this.data)}}]),m})(r.default);return pc.default=y,pc}var r1;function eA(){if(r1)return Li;r1=1,Object.defineProperty(Li,"__esModule",{value:!0}),Li.ITF14=Li.ITF=void 0;var i=vv(),t=l(i),r=WO(),s=l(r);function l(c){return c&&c.__esModule?c:{default:c}}return Li.ITF=t.default,Li.ITF14=s.default,Li}var on={},gc={},i1;function wo(){if(i1)return gc;i1=1,Object.defineProperty(gc,"__esModule",{value:!0});var i=(function(){function f(m,b){for(var v=0;v<b.length;v++){var _=b[v];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(m,_.key,_)}}return function(m,b,v){return b&&f(m.prototype,b),v&&f(m,v),m}})(),t=yn(),r=s(t);function s(f){return f&&f.__esModule?f:{default:f}}function l(f,m){if(!(f instanceof m))throw new TypeError("Cannot call a class as a function")}function c(f,m){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:f}function d(f,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);f.prototype=Object.create(m&&m.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(f,m):f.__proto__=m)}var p=(function(f){d(m,f);function m(b,v){return l(this,m),c(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,b,v))}return i(m,[{key:"encode",value:function(){for(var v="110",_=0;_<this.data.length;_++){var w=parseInt(this.data[_]),S=w.toString(2);S=y(S,4-S.length);for(var M=0;M<S.length;M++)v+=S[M]=="0"?"100":"110"}return v+="1001",{data:v,text:this.text}}},{key:"valid",value:function(){return this.data.search(/^[0-9]+$/)!==-1}}]),m})(r.default);function y(f,m){for(var b=0;b<m;b++)f="0"+f;return f}return gc.default=p,gc}var yc={},Ja={},s1;function gu(){if(s1)return Ja;s1=1,Object.defineProperty(Ja,"__esModule",{value:!0}),Ja.mod10=i,Ja.mod11=t;function i(r){for(var s=0,l=0;l<r.length;l++){var c=parseInt(r[l]);(l+r.length)%2===0?s+=c:s+=c*2%10+Math.floor(c*2/10)}return(10-s%10)%10}function t(r){for(var s=0,l=[2,3,4,5,6,7],c=0;c<r.length;c++){var d=parseInt(r[r.length-1-c]);s+=l[c%l.length]*d}return(11-s%11)%11}return Ja}var a1;function tA(){if(a1)return yc;a1=1,Object.defineProperty(yc,"__esModule",{value:!0});var i=wo(),t=s(i),r=gu();function s(y){return y&&y.__esModule?y:{default:y}}function l(y,f){if(!(y instanceof f))throw new TypeError("Cannot call a class as a function")}function c(y,f){if(!y)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:y}function d(y,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);y.prototype=Object.create(f&&f.prototype,{constructor:{value:y,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(y,f):y.__proto__=f)}var p=(function(y){d(f,y);function f(m,b){return l(this,f),c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,m+(0,r.mod10)(m),b))}return f})(t.default);return yc.default=p,yc}var bc={},o1;function nA(){if(o1)return bc;o1=1,Object.defineProperty(bc,"__esModule",{value:!0});var i=wo(),t=s(i),r=gu();function s(y){return y&&y.__esModule?y:{default:y}}function l(y,f){if(!(y instanceof f))throw new TypeError("Cannot call a class as a function")}function c(y,f){if(!y)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:y}function d(y,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);y.prototype=Object.create(f&&f.prototype,{constructor:{value:y,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(y,f):y.__proto__=f)}var p=(function(y){d(f,y);function f(m,b){return l(this,f),c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,m+(0,r.mod11)(m),b))}return f})(t.default);return bc.default=p,bc}var vc={},l1;function rA(){if(l1)return vc;l1=1,Object.defineProperty(vc,"__esModule",{value:!0});var i=wo(),t=s(i),r=gu();function s(y){return y&&y.__esModule?y:{default:y}}function l(y,f){if(!(y instanceof f))throw new TypeError("Cannot call a class as a function")}function c(y,f){if(!y)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:y}function d(y,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);y.prototype=Object.create(f&&f.prototype,{constructor:{value:y,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(y,f):y.__proto__=f)}var p=(function(y){d(f,y);function f(m,b){return l(this,f),m+=(0,r.mod10)(m),m+=(0,r.mod10)(m),c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,m,b))}return f})(t.default);return vc.default=p,vc}var xc={},c1;function iA(){if(c1)return xc;c1=1,Object.defineProperty(xc,"__esModule",{value:!0});var i=wo(),t=s(i),r=gu();function s(y){return y&&y.__esModule?y:{default:y}}function l(y,f){if(!(y instanceof f))throw new TypeError("Cannot call a class as a function")}function c(y,f){if(!y)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:y}function d(y,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);y.prototype=Object.create(f&&f.prototype,{constructor:{value:y,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(y,f):y.__proto__=f)}var p=(function(y){d(f,y);function f(m,b){return l(this,f),m+=(0,r.mod11)(m),m+=(0,r.mod10)(m),c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,m,b))}return f})(t.default);return xc.default=p,xc}var u1;function sA(){if(u1)return on;u1=1,Object.defineProperty(on,"__esModule",{value:!0}),on.MSI1110=on.MSI1010=on.MSI11=on.MSI10=on.MSI=void 0;var i=wo(),t=m(i),r=tA(),s=m(r),l=nA(),c=m(l),d=rA(),p=m(d),y=iA(),f=m(y);function m(b){return b&&b.__esModule?b:{default:b}}return on.MSI=t.default,on.MSI10=s.default,on.MSI11=c.default,on.MSI1010=p.default,on.MSI1110=f.default,on}var Qa={},f1;function aA(){if(f1)return Qa;f1=1,Object.defineProperty(Qa,"__esModule",{value:!0}),Qa.pharmacode=void 0;var i=(function(){function y(f,m){for(var b=0;b<m.length;b++){var v=m[b];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(f,v.key,v)}}return function(f,m,b){return m&&y(f.prototype,m),b&&y(f,b),f}})(),t=yn(),r=s(t);function s(y){return y&&y.__esModule?y:{default:y}}function l(y,f){if(!(y instanceof f))throw new TypeError("Cannot call a class as a function")}function c(y,f){if(!y)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:y}function d(y,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);y.prototype=Object.create(f&&f.prototype,{constructor:{value:y,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(y,f):y.__proto__=f)}var p=(function(y){d(f,y);function f(m,b){l(this,f);var v=c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,m,b));return v.number=parseInt(m,10),v}return i(f,[{key:"encode",value:function(){for(var b=this.number,v="";!isNaN(b)&&b!=0;)b%2===0?(v="11100"+v,b=(b-2)/2):(v="100"+v,b=(b-1)/2);return v=v.slice(0,-2),{data:v,text:this.text}}},{key:"valid",value:function(){return this.number>=3&&this.number<=131070}}]),f})(r.default);return Qa.pharmacode=p,Qa}var Za={},h1;function oA(){if(h1)return Za;h1=1,Object.defineProperty(Za,"__esModule",{value:!0}),Za.codabar=void 0;var i=(function(){function y(f,m){for(var b=0;b<m.length;b++){var v=m[b];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(f,v.key,v)}}return function(f,m,b){return m&&y(f.prototype,m),b&&y(f,b),f}})(),t=yn(),r=s(t);function s(y){return y&&y.__esModule?y:{default:y}}function l(y,f){if(!(y instanceof f))throw new TypeError("Cannot call a class as a function")}function c(y,f){if(!y)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:y}function d(y,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);y.prototype=Object.create(f&&f.prototype,{constructor:{value:y,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(y,f):y.__proto__=f)}var p=(function(y){d(f,y);function f(m,b){l(this,f),m.search(/^[0-9\-\$\:\.\+\/]+$/)===0&&(m="A"+m+"A");var v=c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,m.toUpperCase(),b));return v.text=v.options.text||v.text.replace(/[A-D]/g,""),v}return i(f,[{key:"valid",value:function(){return this.data.search(/^[A-D][0-9\-\$\:\.\+\/]+[A-D]$/)!==-1}},{key:"encode",value:function(){for(var b=[],v=this.getEncodings(),_=0;_<this.data.length;_++)b.push(v[this.data.charAt(_)]),_!==this.data.length-1&&b.push("0");return{text:this.text,data:b.join("")}}},{key:"getEncodings",value:function(){return{0:"101010011",1:"101011001",2:"101001011",3:"110010101",4:"101101001",5:"110101001",6:"100101011",7:"100101101",8:"100110101",9:"110100101","-":"101001101",$:"101100101",":":"1101011011","/":"1101101011",".":"1101101101","+":"1011011011",A:"1011001001",B:"1001001011",C:"1010010011",D:"1010011001"}}}]),f})(r.default);return Za.codabar=p,Za}var zi={},_c={},Rs={},d1;function lA(){return d1||(d1=1,Object.defineProperty(Rs,"__esModule",{value:!0}),Rs.SYMBOLS=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","-","."," ","$","/","+","%","($)","(%)","(/)","(+)","ÿ"],Rs.BINARIES=["100010100","101001000","101000100","101000010","100101000","100100100","100100010","101010000","100010010","100001010","110101000","110100100","110100010","110010100","110010010","110001010","101101000","101100100","101100010","100110100","100011010","101011000","101001100","101000110","100101100","100010110","110110100","110110010","110101100","110100110","110010110","110011010","101101100","101100110","100110110","100111010","100101110","111010100","111010010","111001010","101101110","101110110","110101110","100100110","111011010","111010110","100110010","101011110"],Rs.MULTI_SYMBOLS={"\0":["(%)","U"],"":["($)","A"],"":["($)","B"],"":["($)","C"],"":["($)","D"],"":["($)","E"],"":["($)","F"],"\x07":["($)","G"],"\b":["($)","H"]," ":["($)","I"],"\n":["($)","J"],"\v":["($)","K"],"\f":["($)","L"],"\r":["($)","M"],"":["($)","N"],"":["($)","O"],"":["($)","P"],"":["($)","Q"],"":["($)","R"],"":["($)","S"],"":["($)","T"],"":["($)","U"],"":["($)","V"],"":["($)","W"],"":["($)","X"],"":["($)","Y"],"":["($)","Z"],"\x1B":["(%)","A"],"":["(%)","B"],"":["(%)","C"],"":["(%)","D"],"":["(%)","E"],"!":["(/)","A"],'"':["(/)","B"],"#":["(/)","C"],"&":["(/)","F"],"'":["(/)","G"],"(":["(/)","H"],")":["(/)","I"],"*":["(/)","J"],",":["(/)","L"],":":["(/)","Z"],";":["(%)","F"],"<":["(%)","G"],"=":["(%)","H"],">":["(%)","I"],"?":["(%)","J"],"@":["(%)","V"],"[":["(%)","K"],"\\":["(%)","L"],"]":["(%)","M"],"^":["(%)","N"],_:["(%)","O"],"`":["(%)","W"],a:["(+)","A"],b:["(+)","B"],c:["(+)","C"],d:["(+)","D"],e:["(+)","E"],f:["(+)","F"],g:["(+)","G"],h:["(+)","H"],i:["(+)","I"],j:["(+)","J"],k:["(+)","K"],l:["(+)","L"],m:["(+)","M"],n:["(+)","N"],o:["(+)","O"],p:["(+)","P"],q:["(+)","Q"],r:["(+)","R"],s:["(+)","S"],t:["(+)","T"],u:["(+)","U"],v:["(+)","V"],w:["(+)","W"],x:["(+)","X"],y:["(+)","Y"],z:["(+)","Z"],"{":["(%)","P"],"|":["(%)","Q"],"}":["(%)","R"],"~":["(%)","S"],"":["(%)","T"]}),Rs}var m1;function xv(){if(m1)return _c;m1=1,Object.defineProperty(_c,"__esModule",{value:!0});var i=(function(){function f(m,b){for(var v=0;v<b.length;v++){var _=b[v];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(m,_.key,_)}}return function(m,b,v){return b&&f(m.prototype,b),v&&f(m,v),m}})(),t=lA(),r=yn(),s=l(r);function l(f){return f&&f.__esModule?f:{default:f}}function c(f,m){if(!(f instanceof m))throw new TypeError("Cannot call a class as a function")}function d(f,m){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:f}function p(f,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);f.prototype=Object.create(m&&m.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(f,m):f.__proto__=m)}var y=(function(f){p(m,f);function m(b,v){return c(this,m),d(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,b,v))}return i(m,[{key:"valid",value:function(){return/^[0-9A-Z\-. $/+%]+$/.test(this.data)}},{key:"encode",value:function(){var v=this.data.split("").flatMap(function(M){return t.MULTI_SYMBOLS[M]||M}),_=v.map(function(M){return m.getEncoding(M)}).join(""),w=m.checksum(v,20),S=m.checksum(v.concat(w),15);return{text:this.text,data:m.getEncoding("ÿ")+_+m.getEncoding(w)+m.getEncoding(S)+m.getEncoding("ÿ")+"1"}}}],[{key:"getEncoding",value:function(v){return t.BINARIES[m.symbolValue(v)]}},{key:"getSymbol",value:function(v){return t.SYMBOLS[v]}},{key:"symbolValue",value:function(v){return t.SYMBOLS.indexOf(v)}},{key:"checksum",value:function(v,_){var w=v.slice().reverse().reduce(function(S,M,B){var U=B%_+1;return S+m.symbolValue(M)*U},0);return m.getSymbol(w%47)}}]),m})(s.default);return _c.default=y,_c}var wc={},p1;function cA(){if(p1)return wc;p1=1,Object.defineProperty(wc,"__esModule",{value:!0});var i=(function(){function y(f,m){for(var b=0;b<m.length;b++){var v=m[b];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(f,v.key,v)}}return function(f,m,b){return m&&y(f.prototype,m),b&&y(f,b),f}})(),t=xv(),r=s(t);function s(y){return y&&y.__esModule?y:{default:y}}function l(y,f){if(!(y instanceof f))throw new TypeError("Cannot call a class as a function")}function c(y,f){if(!y)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:y}function d(y,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);y.prototype=Object.create(f&&f.prototype,{constructor:{value:y,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(y,f):y.__proto__=f)}var p=(function(y){d(f,y);function f(m,b){return l(this,f),c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,m,b))}return i(f,[{key:"valid",value:function(){return/^[\x00-\x7f]+$/.test(this.data)}}]),f})(r.default);return wc.default=p,wc}var g1;function uA(){if(g1)return zi;g1=1,Object.defineProperty(zi,"__esModule",{value:!0}),zi.CODE93FullASCII=zi.CODE93=void 0;var i=xv(),t=l(i),r=cA(),s=l(r);function l(c){return c&&c.__esModule?c:{default:c}}return zi.CODE93=t.default,zi.CODE93FullASCII=s.default,zi}var Wa={},y1;function fA(){if(y1)return Wa;y1=1,Object.defineProperty(Wa,"__esModule",{value:!0}),Wa.GenericBarcode=void 0;var i=(function(){function y(f,m){for(var b=0;b<m.length;b++){var v=m[b];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(f,v.key,v)}}return function(f,m,b){return m&&y(f.prototype,m),b&&y(f,b),f}})(),t=yn(),r=s(t);function s(y){return y&&y.__esModule?y:{default:y}}function l(y,f){if(!(y instanceof f))throw new TypeError("Cannot call a class as a function")}function c(y,f){if(!y)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:y}function d(y,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);y.prototype=Object.create(f&&f.prototype,{constructor:{value:y,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(y,f):y.__proto__=f)}var p=(function(y){d(f,y);function f(m,b){return l(this,f),c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,m,b))}return i(f,[{key:"encode",value:function(){return{data:"10101010101010101010101010101010101010101",text:this.text}}},{key:"valid",value:function(){return!0}}]),f})(r.default);return Wa.GenericBarcode=p,Wa}var b1;function hA(){if(b1)return Wl;b1=1,Object.defineProperty(Wl,"__esModule",{value:!0});var i=UO(),t=FO(),r=QO(),s=eA(),l=sA(),c=aA(),d=oA(),p=uA(),y=fA();return Wl.default={CODE39:i.CODE39,CODE128:t.CODE128,CODE128A:t.CODE128A,CODE128B:t.CODE128B,CODE128C:t.CODE128C,EAN13:r.EAN13,EAN8:r.EAN8,EAN5:r.EAN5,EAN2:r.EAN2,UPC:r.UPC,UPCE:r.UPCE,ITF14:s.ITF14,ITF:s.ITF,MSI:l.MSI,MSI10:l.MSI10,MSI11:l.MSI11,MSI1010:l.MSI1010,MSI1110:l.MSI1110,pharmacode:c.pharmacode,codabar:d.codabar,CODE93:p.CODE93,CODE93FullASCII:p.CODE93FullASCII,GenericBarcode:y.GenericBarcode},Wl}var Sc={},v1;function yu(){if(v1)return Sc;v1=1,Object.defineProperty(Sc,"__esModule",{value:!0});var i=Object.assign||function(t){for(var r=1;r<arguments.length;r++){var s=arguments[r];for(var l in s)Object.prototype.hasOwnProperty.call(s,l)&&(t[l]=s[l])}return t};return Sc.default=function(t,r){return i({},t,r)},Sc}var Ec={},x1;function dA(){if(x1)return Ec;x1=1,Object.defineProperty(Ec,"__esModule",{value:!0}),Ec.default=i;function i(t){var r=[];function s(l){if(Array.isArray(l))for(var c=0;c<l.length;c++)s(l[c]);else l.text=l.text||"",l.data=l.data||"",r.push(l)}return s(t),r}return Ec}var Oc={},_1;function mA(){if(_1)return Oc;_1=1,Object.defineProperty(Oc,"__esModule",{value:!0}),Oc.default=i;function i(t){return t.marginTop=t.marginTop||t.margin,t.marginBottom=t.marginBottom||t.margin,t.marginRight=t.marginRight||t.margin,t.marginLeft=t.marginLeft||t.margin,t}return Oc}var Ac={},jc={},Tc={},w1;function _v(){if(w1)return Tc;w1=1,Object.defineProperty(Tc,"__esModule",{value:!0}),Tc.default=i;function i(t){var r=["width","height","textMargin","fontSize","margin","marginTop","marginBottom","marginLeft","marginRight"];for(var s in r)r.hasOwnProperty(s)&&(s=r[s],typeof t[s]=="string"&&(t[s]=parseInt(t[s],10)));return typeof t.displayValue=="string"&&(t.displayValue=t.displayValue!="false"),t}return Tc}var Nc={},S1;function wv(){if(S1)return Nc;S1=1,Object.defineProperty(Nc,"__esModule",{value:!0});var i={width:2,height:100,format:"auto",displayValue:!0,fontOptions:"",font:"monospace",text:void 0,textAlign:"center",textPosition:"bottom",textMargin:2,fontSize:20,background:"#ffffff",lineColor:"#000000",margin:10,marginTop:void 0,marginBottom:void 0,marginLeft:void 0,marginRight:void 0,valid:function(){}};return Nc.default=i,Nc}var E1;function pA(){if(E1)return jc;E1=1,Object.defineProperty(jc,"__esModule",{value:!0});var i=_v(),t=l(i),r=wv(),s=l(r);function l(d){return d&&d.__esModule?d:{default:d}}function c(d){var p={};for(var y in s.default)s.default.hasOwnProperty(y)&&(d.hasAttribute("jsbarcode-"+y.toLowerCase())&&(p[y]=d.getAttribute("jsbarcode-"+y.toLowerCase())),d.hasAttribute("data-"+y.toLowerCase())&&(p[y]=d.getAttribute("data-"+y.toLowerCase())));return p.value=d.getAttribute("jsbarcode-value")||d.getAttribute("data-value"),p=(0,t.default)(p),p}return jc.default=c,jc}var kc={},Cc={},ln={},O1;function Sv(){if(O1)return ln;O1=1,Object.defineProperty(ln,"__esModule",{value:!0}),ln.getTotalWidthOfEncodings=ln.calculateEncodingAttributes=ln.getBarcodePadding=ln.getEncodingHeight=ln.getMaximumHeightOfEncodings=void 0;var i=yu(),t=r(i);function r(f){return f&&f.__esModule?f:{default:f}}function s(f,m){return m.height+(m.displayValue&&f.text.length>0?m.fontSize+m.textMargin:0)+m.marginTop+m.marginBottom}function l(f,m,b){if(b.displayValue&&m<f){if(b.textAlign=="center")return Math.floor((f-m)/2);if(b.textAlign=="left")return 0;if(b.textAlign=="right")return Math.floor(f-m)}return 0}function c(f,m,b){for(var v=0;v<f.length;v++){var _=f[v],w=(0,t.default)(m,_.options),S;w.displayValue?S=y(_.text,w,b):S=0;var M=_.data.length*w.width;_.width=Math.ceil(Math.max(S,M)),_.height=s(_,w),_.barcodePadding=l(S,M,w)}}function d(f){for(var m=0,b=0;b<f.length;b++)m+=f[b].width;return m}function p(f){for(var m=0,b=0;b<f.length;b++)f[b].height>m&&(m=f[b].height);return m}function y(f,m,b){var v;if(b)v=b;else if(typeof document<"u")v=document.createElement("canvas").getContext("2d");else return 0;v.font=m.fontOptions+" "+m.fontSize+"px "+m.font;var _=v.measureText(f);if(!_)return 0;var w=_.width;return w}return ln.getMaximumHeightOfEncodings=p,ln.getEncodingHeight=s,ln.getBarcodePadding=l,ln.calculateEncodingAttributes=c,ln.getTotalWidthOfEncodings=d,ln}var A1;function gA(){if(A1)return Cc;A1=1,Object.defineProperty(Cc,"__esModule",{value:!0});var i=(function(){function p(y,f){for(var m=0;m<f.length;m++){var b=f[m];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(y,b.key,b)}}return function(y,f,m){return f&&p(y.prototype,f),m&&p(y,m),y}})(),t=yu(),r=l(t),s=Sv();function l(p){return p&&p.__esModule?p:{default:p}}function c(p,y){if(!(p instanceof y))throw new TypeError("Cannot call a class as a function")}var d=(function(){function p(y,f,m){c(this,p),this.canvas=y,this.encodings=f,this.options=m}return i(p,[{key:"render",value:function(){if(!this.canvas.getContext)throw new Error("The browser does not support canvas.");this.prepareCanvas();for(var f=0;f<this.encodings.length;f++){var m=(0,r.default)(this.options,this.encodings[f].options);this.drawCanvasBarcode(m,this.encodings[f]),this.drawCanvasText(m,this.encodings[f]),this.moveCanvasDrawing(this.encodings[f])}this.restoreCanvas()}},{key:"prepareCanvas",value:function(){var f=this.canvas.getContext("2d");f.save(),(0,s.calculateEncodingAttributes)(this.encodings,this.options,f);var m=(0,s.getTotalWidthOfEncodings)(this.encodings),b=(0,s.getMaximumHeightOfEncodings)(this.encodings);this.canvas.width=m+this.options.marginLeft+this.options.marginRight,this.canvas.height=b,f.clearRect(0,0,this.canvas.width,this.canvas.height),this.options.background&&(f.fillStyle=this.options.background,f.fillRect(0,0,this.canvas.width,this.canvas.height)),f.translate(this.options.marginLeft,0)}},{key:"drawCanvasBarcode",value:function(f,m){var b=this.canvas.getContext("2d"),v=m.data,_;f.textPosition=="top"?_=f.marginTop+f.fontSize+f.textMargin:_=f.marginTop,b.fillStyle=f.lineColor;for(var w=0;w<v.length;w++){var S=w*f.width+m.barcodePadding;v[w]==="1"?b.fillRect(S,_,f.width,f.height):v[w]&&b.fillRect(S,_,f.width,f.height*v[w])}}},{key:"drawCanvasText",value:function(f,m){var b=this.canvas.getContext("2d"),v=f.fontOptions+" "+f.fontSize+"px "+f.font;if(f.displayValue){var _,w;f.textPosition=="top"?w=f.marginTop+f.fontSize-f.textMargin:w=f.height+f.textMargin+f.marginTop+f.fontSize,b.font=v,f.textAlign=="left"||m.barcodePadding>0?(_=0,b.textAlign="left"):f.textAlign=="right"?(_=m.width-1,b.textAlign="right"):(_=m.width/2,b.textAlign="center"),b.fillText(m.text,_,w)}}},{key:"moveCanvasDrawing",value:function(f){var m=this.canvas.getContext("2d");m.translate(f.width,0)}},{key:"restoreCanvas",value:function(){var f=this.canvas.getContext("2d");f.restore()}}]),p})();return Cc.default=d,Cc}var Mc={},j1;function yA(){if(j1)return Mc;j1=1,Object.defineProperty(Mc,"__esModule",{value:!0});var i=(function(){function y(f,m){for(var b=0;b<m.length;b++){var v=m[b];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(f,v.key,v)}}return function(f,m,b){return m&&y(f.prototype,m),b&&y(f,b),f}})(),t=yu(),r=l(t),s=Sv();function l(y){return y&&y.__esModule?y:{default:y}}function c(y,f){if(!(y instanceof f))throw new TypeError("Cannot call a class as a function")}var d="http://www.w3.org/2000/svg",p=(function(){function y(f,m,b){c(this,y),this.svg=f,this.encodings=m,this.options=b,this.document=b.xmlDocument||document}return i(y,[{key:"render",value:function(){var m=this.options.marginLeft;this.prepareSVG();for(var b=0;b<this.encodings.length;b++){var v=this.encodings[b],_=(0,r.default)(this.options,v.options),w=this.createGroup(m,_.marginTop,this.svg);this.setGroupOptions(w,_),this.drawSvgBarcode(w,_,v),this.drawSVGText(w,_,v),m+=v.width}}},{key:"prepareSVG",value:function(){for(;this.svg.firstChild;)this.svg.removeChild(this.svg.firstChild);(0,s.calculateEncodingAttributes)(this.encodings,this.options);var m=(0,s.getTotalWidthOfEncodings)(this.encodings),b=(0,s.getMaximumHeightOfEncodings)(this.encodings),v=m+this.options.marginLeft+this.options.marginRight;this.setSvgAttributes(v,b),this.options.background&&this.drawRect(0,0,v,b,this.svg).setAttribute("fill",this.options.background)}},{key:"drawSvgBarcode",value:function(m,b,v){var _=v.data,w;b.textPosition=="top"?w=b.fontSize+b.textMargin:w=0;for(var S=0,M=0,B=0;B<_.length;B++)M=B*b.width+v.barcodePadding,_[B]==="1"?S++:S>0&&(this.drawRect(M-b.width*S,w,b.width*S,b.height,m),S=0);S>0&&this.drawRect(M-b.width*(S-1),w,b.width*S,b.height,m)}},{key:"drawSVGText",value:function(m,b,v){var _=this.document.createElementNS(d,"text");if(b.displayValue){var w,S;_.setAttribute("font-family",b.font),_.setAttribute("font-size",b.fontSize),b.fontOptions.includes("bold")&&_.setAttribute("font-weight","bold"),b.fontOptions.includes("italic")&&_.setAttribute("font-style","italic"),b.textPosition=="top"?S=b.fontSize-b.textMargin:S=b.height+b.textMargin+b.fontSize,b.textAlign=="left"||v.barcodePadding>0?(w=0,_.setAttribute("text-anchor","start")):b.textAlign=="right"?(w=v.width-1,_.setAttribute("text-anchor","end")):(w=v.width/2,_.setAttribute("text-anchor","middle")),_.setAttribute("x",w),_.setAttribute("y",S),_.appendChild(this.document.createTextNode(v.text)),m.appendChild(_)}}},{key:"setSvgAttributes",value:function(m,b){var v=this.svg;v.setAttribute("width",m+"px"),v.setAttribute("height",b+"px"),v.setAttribute("x","0px"),v.setAttribute("y","0px"),v.setAttribute("viewBox","0 0 "+m+" "+b),v.setAttribute("xmlns",d),v.setAttribute("version","1.1")}},{key:"createGroup",value:function(m,b,v){var _=this.document.createElementNS(d,"g");return _.setAttribute("transform","translate("+m+", "+b+")"),v.appendChild(_),_}},{key:"setGroupOptions",value:function(m,b){m.setAttribute("fill",b.lineColor)}},{key:"drawRect",value:function(m,b,v,_,w){var S=this.document.createElementNS(d,"rect");return S.setAttribute("x",m),S.setAttribute("y",b),S.setAttribute("width",v),S.setAttribute("height",_),w.appendChild(S),S}}]),y})();return Mc.default=p,Mc}var Rc={},T1;function bA(){if(T1)return Rc;T1=1,Object.defineProperty(Rc,"__esModule",{value:!0});var i=(function(){function s(l,c){for(var d=0;d<c.length;d++){var p=c[d];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(l,p.key,p)}}return function(l,c,d){return c&&s(l.prototype,c),d&&s(l,d),l}})();function t(s,l){if(!(s instanceof l))throw new TypeError("Cannot call a class as a function")}var r=(function(){function s(l,c,d){t(this,s),this.object=l,this.encodings=c,this.options=d}return i(s,[{key:"render",value:function(){this.object.encodings=this.encodings}}]),s})();return Rc.default=r,Rc}var N1;function vA(){if(N1)return kc;N1=1,Object.defineProperty(kc,"__esModule",{value:!0});var i=gA(),t=d(i),r=yA(),s=d(r),l=bA(),c=d(l);function d(p){return p&&p.__esModule?p:{default:p}}return kc.default={CanvasRenderer:t.default,SVGRenderer:s.default,ObjectRenderer:c.default},kc}var Ds={},k1;function Ev(){if(k1)return Ds;k1=1,Object.defineProperty(Ds,"__esModule",{value:!0});function i(d,p){if(!(d instanceof p))throw new TypeError("Cannot call a class as a function")}function t(d,p){if(!d)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p&&(typeof p=="object"||typeof p=="function")?p:d}function r(d,p){if(typeof p!="function"&&p!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof p);d.prototype=Object.create(p&&p.prototype,{constructor:{value:d,enumerable:!1,writable:!0,configurable:!0}}),p&&(Object.setPrototypeOf?Object.setPrototypeOf(d,p):d.__proto__=p)}var s=(function(d){r(p,d);function p(y,f){i(this,p);var m=t(this,(p.__proto__||Object.getPrototypeOf(p)).call(this));return m.name="InvalidInputException",m.symbology=y,m.input=f,m.message='"'+m.input+'" is not a valid input for '+m.symbology,m}return p})(Error),l=(function(d){r(p,d);function p(){i(this,p);var y=t(this,(p.__proto__||Object.getPrototypeOf(p)).call(this));return y.name="InvalidElementException",y.message="Not supported type to render on",y}return p})(Error),c=(function(d){r(p,d);function p(){i(this,p);var y=t(this,(p.__proto__||Object.getPrototypeOf(p)).call(this));return y.name="NoElementException",y.message="No element to render on.",y}return p})(Error);return Ds.InvalidInputException=s,Ds.InvalidElementException=l,Ds.NoElementException=c,Ds}var C1;function xA(){if(C1)return Ac;C1=1,Object.defineProperty(Ac,"__esModule",{value:!0});var i=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(m){return typeof m}:function(m){return m&&typeof Symbol=="function"&&m.constructor===Symbol&&m!==Symbol.prototype?"symbol":typeof m},t=pA(),r=d(t),s=vA(),l=d(s),c=Ev();function d(m){return m&&m.__esModule?m:{default:m}}function p(m){if(typeof m=="string")return y(m);if(Array.isArray(m)){for(var b=[],v=0;v<m.length;v++)b.push(p(m[v]));return b}else{if(typeof HTMLCanvasElement<"u"&&m instanceof HTMLImageElement)return f(m);if(m&&m.nodeName&&m.nodeName.toLowerCase()==="svg"||typeof SVGElement<"u"&&m instanceof SVGElement)return{element:m,options:(0,r.default)(m),renderer:l.default.SVGRenderer};if(typeof HTMLCanvasElement<"u"&&m instanceof HTMLCanvasElement)return{element:m,options:(0,r.default)(m),renderer:l.default.CanvasRenderer};if(m&&m.getContext)return{element:m,renderer:l.default.CanvasRenderer};if(m&&(typeof m>"u"?"undefined":i(m))==="object"&&!m.nodeName)return{element:m,renderer:l.default.ObjectRenderer};throw new c.InvalidElementException}}function y(m){var b=document.querySelectorAll(m);if(b.length!==0){for(var v=[],_=0;_<b.length;_++)v.push(p(b[_]));return v}}function f(m){var b=document.createElement("canvas");return{element:b,options:(0,r.default)(m),renderer:l.default.CanvasRenderer,afterRender:function(){m.setAttribute("src",b.toDataURL())}}}return Ac.default=p,Ac}var Dc={},M1;function _A(){if(M1)return Dc;M1=1,Object.defineProperty(Dc,"__esModule",{value:!0});var i=(function(){function s(l,c){for(var d=0;d<c.length;d++){var p=c[d];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(l,p.key,p)}}return function(l,c,d){return c&&s(l.prototype,c),d&&s(l,d),l}})();function t(s,l){if(!(s instanceof l))throw new TypeError("Cannot call a class as a function")}var r=(function(){function s(l){t(this,s),this.api=l}return i(s,[{key:"handleCatch",value:function(c){if(c.name==="InvalidInputException")if(this.api._options.valid!==this.api._defaults.valid)this.api._options.valid(!1);else throw c.message;else throw c;this.api.render=function(){}}},{key:"wrapBarcodeCall",value:function(c){try{var d=c.apply(void 0,arguments);return this.api._options.valid(!0),d}catch(p){return this.handleCatch(p),this.api}}}]),s})();return Dc.default=r,Dc}var Fh,R1;function wA(){if(R1)return Fh;R1=1;var i=hA(),t=B(i),r=yu(),s=B(r),l=dA(),c=B(l),d=mA(),p=B(d),y=xA(),f=B(y),m=_v(),b=B(m),v=_A(),_=B(v),w=Ev(),S=wv(),M=B(S);function B(L){return L&&L.__esModule?L:{default:L}}var U=function(){},ie=function(G,W,Q){var he=new U;if(typeof G>"u")throw Error("No element to render on was provided.");return he._renderProperties=(0,f.default)(G),he._encodings=[],he._options=M.default,he._errorHandler=new _.default(he),typeof W<"u"&&(Q=Q||{},Q.format||(Q.format=re()),he.options(Q)[Q.format](W,Q).render()),he};ie.getModule=function(L){return t.default[L]};for(var ce in t.default)t.default.hasOwnProperty(ce)&&C(t.default,ce);function C(L,G){U.prototype[G]=U.prototype[G.toUpperCase()]=U.prototype[G.toLowerCase()]=function(W,Q){var he=this;return he._errorHandler.wrapBarcodeCall(function(){Q.text=typeof Q.text>"u"?void 0:""+Q.text;var _e=(0,s.default)(he._options,Q);_e=(0,b.default)(_e);var Te=L[G],Y=z(W,Te,_e);return he._encodings.push(Y),he})}}function z(L,G,W){L=""+L;var Q=new G(L,W);if(!Q.valid())throw new w.InvalidInputException(Q.constructor.name,L);var he=Q.encode();he=(0,c.default)(he);for(var _e=0;_e<he.length;_e++)he[_e].options=(0,s.default)(W,he[_e].options);return he}function re(){return t.default.CODE128?"CODE128":Object.keys(t.default)[0]}U.prototype.options=function(L){return this._options=(0,s.default)(this._options,L),this},U.prototype.blank=function(L){var G=new Array(L+1).join("0");return this._encodings.push({data:G}),this},U.prototype.init=function(){if(this._renderProperties){Array.isArray(this._renderProperties)||(this._renderProperties=[this._renderProperties]);var L;for(var G in this._renderProperties){L=this._renderProperties[G];var W=(0,s.default)(this._options,L.options);W.format=="auto"&&(W.format=re()),this._errorHandler.wrapBarcodeCall(function(){var Q=W.value,he=t.default[W.format.toUpperCase()],_e=z(Q,he,W);X(L,_e,W)})}}},U.prototype.render=function(){if(!this._renderProperties)throw new w.NoElementException;if(Array.isArray(this._renderProperties))for(var L=0;L<this._renderProperties.length;L++)X(this._renderProperties[L],this._encodings,this._options);else X(this._renderProperties,this._encodings,this._options);return this},U.prototype._defaults=M.default;function X(L,G,W){G=(0,c.default)(G);for(var Q=0;Q<G.length;Q++)G[Q].options=(0,s.default)(W,G[Q].options),(0,p.default)(G[Q].options);(0,p.default)(W);var he=L.renderer,_e=new he(L.element,G,W);_e.render(),L.afterRender&&L.afterRender()}return typeof window<"u"&&(window.JsBarcode=ie),typeof jQuery<"u"&&(jQuery.fn.JsBarcode=function(L,G){var W=[];return jQuery(this).each(function(){W.push(this)}),ie(W,L,G)}),Fh=ie,Fh}var SA=wA();const EA=nw(SA),OA={[Pe.EXECUTED]:"Executed",[Pe.MATCHED_LIST]:"Matched list",[Pe.CONFIRM_REQUIRED]:"Awaiting confirmation",[Pe.NO_MATCH_FALLBACK]:"No match",[Pe.UNCONFIGURED]:"Not configured",[Pe.INVALID_CODE]:"Invalid code",[Pe.FORBIDDEN]:"Not permitted",[Pe.CONFLICT]:"Conflict",[Pe.IDENTITY_PRIMED]:"Identity primed",[Pe.IDENTITY_UNKNOWN]:"Badge not recognized",[Pe.NOT_PRIMED]:"Badge required",[Pe.CHOICES]:"Choices presented"},Ov={[Pe.EXECUTED]:"text-status-success",[Pe.MATCHED_LIST]:"text-status-success",[Pe.CONFIRM_REQUIRED]:"text-status-warning",[Pe.NO_MATCH_FALLBACK]:"text-text-secondary",[Pe.UNCONFIGURED]:"text-status-warning",[Pe.INVALID_CODE]:"text-status-error",[Pe.FORBIDDEN]:"text-status-error",[Pe.CONFLICT]:"text-status-warning",[Pe.IDENTITY_PRIMED]:"text-status-success",[Pe.IDENTITY_UNKNOWN]:"text-status-warning",[Pe.NOT_PRIMED]:"text-status-warning",[Pe.CHOICES]:"text-status-success"};function Av(i){return i.outcome===Pe.IDENTITY_PRIMED&&i.actor?`Hi ${i.actor.displayName}`:`${OA[i.outcome]}${i.rule?` — ${i.rule.name}`:""}`}function ru(i){var t,r,s;return i.outcome===Pe.NO_MATCH_FALLBACK?((t=i.fallback)==null?void 0:t.markdown)??null:i.outcome===Pe.IDENTITY_UNKNOWN?((r=i.fallback)==null?void 0:r.markdown)??null:i.outcome===Pe.NOT_PRIMED?((s=i.notPrimed)==null?void 0:s.markdown)??null:null}function ri(i){return i.replace(/`([^`]+)`/g,'<code class="px-1 py-0.5 bg-surface-sunken rounded text-xs font-mono">$1</code>').replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>").replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" class="text-accent-primary hover:underline" target="_blank" rel="noopener noreferrer">$1</a>')}function jv({content:i,compact:t}){const r=[],s=/^```(\w*)\n([\s\S]*?)^```$/gm;let l=0,c;for(;(c=s.exec(i))!==null;)c.index>l&&r.push({type:"text",text:i.slice(l,c.index)}),r.push({type:"code",lang:c[1],code:c[2].replace(/\n$/,"")}),l=c.index+c[0].length;l<i.length&&r.push({type:"text",text:i.slice(l)});const d=t?{text:"text-xs",heading:"text-xs",list:"text-xs",code:"text-2xs"}:{text:"text-sm",heading:"text-sm",list:"text-sm",code:"text-xs"},p=[];for(const y of r){if(y.type==="code"){const f=y.code.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");p.push(`<pre class="my-2 p-2.5 bg-surface-sunken rounded-md overflow-x-auto"><code class="${d.code} font-mono text-text-secondary leading-relaxed">${f}</code></pre>`);continue}p.push(...AA(y.text,d))}return g.jsx("div",{className:"prose-sm",dangerouslySetInnerHTML:{__html:p.join(`
54
+ `)}})}function AA(i,t){const r=i.split(`
55
+ `),s=[];let l=!1,c=!1,d=[];for(const p of r){const y=p.trim();if(y.startsWith("|")&&y.endsWith("|")){const f=y.slice(1,-1).split("|").map(m=>m.trim());if(f.every(m=>/^[-:]+$/.test(m)))continue;c||(c=!0,d=[]),d.push(f);continue}if(c){c=!1;const[f,...m]=d;s.push('<div class="overflow-x-auto my-2"><table class="text-xs w-full"><thead><tr>');for(const b of f)s.push(`<th class="text-left py-1 px-2 border-b border-border text-text-secondary font-medium">${ri(b)}</th>`);s.push("</tr></thead><tbody>");for(const b of m){s.push("<tr>");for(const v of b)s.push(`<td class="py-1 px-2 border-b border-border/50">${ri(v)}</td>`);s.push("</tr>")}s.push("</tbody></table></div>"),d=[]}if(!y){l&&(s.push("</ul>"),l=!1);continue}if(y.startsWith("### ")){l&&(s.push("</ul>"),l=!1),s.push(`<h4 class="${t.heading} font-semibold text-text-primary mt-3 mb-1">${ri(y.slice(4))}</h4>`);continue}if(y.startsWith("## ")){l&&(s.push("</ul>"),l=!1),s.push(`<h3 class="${t.heading} font-semibold text-text-primary mt-3 mb-1">${ri(y.slice(3))}</h3>`);continue}if(/^[-*_]{3,}$/.test(y)){l&&(s.push("</ul>"),l=!1),s.push('<hr class="border-border my-3" />');continue}if(/^[-*] /.test(y)){l||(s.push('<ul class="space-y-1 my-1">'),l=!0),s.push(`<li class="${t.list} text-text-secondary flex gap-2"><span class="text-text-tertiary shrink-0">-</span><span>${ri(y.slice(2))}</span></li>`);continue}l&&(s.push("</ul>"),l=!1),s.push(`<p class="${t.text} text-text-secondary my-1">${ri(y)}</p>`)}if(c&&d.length){const[p,...y]=d;s.push('<div class="overflow-x-auto my-2"><table class="text-xs w-full"><thead><tr>');for(const f of p)s.push(`<th class="text-left py-1 px-2 border-b border-border text-text-secondary font-medium">${ri(f)}</th>`);s.push("</tr></thead><tbody>");for(const f of y){s.push("<tr>");for(const m of f)s.push(`<td class="py-1 px-2 border-b border-border/50">${ri(m)}</td>`);s.push("</tr>")}s.push("</tbody></table></div>")}return l&&s.push("</ul>"),s}function jA(i){return i.replace(/[\u2010-\u2015\u2212]/g,"-").replace(/[\u2018\u2019]/g,"'").replace(/[\u201C\u201D]/g,'"').replace(/\u00A0/g," ").replace(/[\u200B-\u200D\uFEFF]/g,"").replace(/[\x00-\x1F\x7F]/g,"").trim()}function TA(i){const t=new Set;for(const r of i){const s=r.codePointAt(0);(s>127||s<32)&&t.add(`"${s<32?"\\x"+s.toString(16).padStart(2,"0"):r}" U+${s.toString(16).toUpperCase().padStart(4,"0")}`)}return[...t]}function NA({value:i}){const t=j.useRef(null),[r,s]=j.useState(!1);return j.useEffect(()=>{if(!(!t.current||!i))try{EA(t.current,i,{format:"CODE128",width:2,height:88,margin:12,displayValue:!0,fontSize:13,background:"#ffffff",lineColor:"#000000"}),s(!1)}catch{s(!0)}},[i]),i?g.jsxs("div",{children:[g.jsx("span",{className:"block text-xs uppercase tracking-wide text-text-tertiary mb-1",children:"Barcode"}),r?g.jsxs("p",{className:"text-xs text-status-error",children:["This value has characters Code 128 cannot carry:"," ",g.jsx("span",{className:"font-mono",children:TA(i).join(", ")||"unknown"})]}):g.jsx("div",{className:"bg-white rounded p-1 inline-block max-w-full overflow-hidden",children:g.jsx("svg",{ref:t,className:"max-w-full"})})]}):null}function kA({onClose:i}){const{submitCode:t,lastResult:r,busy:s,wedgeConfig:l,updateWedgeConfig:c,diagnostics:d,diagnosticsOn:p,setDiagnosticsOn:y}=gv(),[f,m]=j.useState(""),[b,v]=j.useState(!1),_=S=>{S.preventDefault();const M=f.trim();M&&(m(""),t(M))},w=(r==null?void 0:r.response)??null;return g.jsxs("div",{className:"flex flex-col h-full",children:[g.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border",children:[g.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-text-primary",children:[g.jsx(ou,{className:"w-4 h-4"}),"Scan"]}),g.jsx("button",{type:"button",onClick:i,className:"text-text-tertiary hover:text-text-primary",title:"Close",children:g.jsx(dn,{className:"w-4 h-4"})})]}),g.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-4 space-y-6",children:[g.jsxs("form",{onSubmit:_,className:"space-y-2",children:[g.jsx("label",{className:"block text-xs uppercase tracking-wide text-text-tertiary",children:"Enter a code"}),g.jsxs("div",{className:"flex gap-2",children:[g.jsx("input",{value:f,onChange:S=>m(jA(S.target.value)),placeholder:"10:1:SN-12345",className:"flex-1 px-2 py-1.5 text-sm bg-surface-raised border border-surface-border rounded text-text-primary","data-scan-manual-entry":!0}),g.jsx("button",{type:"submit",disabled:s||!f.trim(),className:"px-3 py-1.5 text-sm rounded bg-accent text-text-inverse disabled:opacity-50",children:"Go"})]}),g.jsx("p",{className:"text-xs text-text-tertiary",children:"Scanning with a connected scanner works from any page — this entry exists for testing and for codes you can read but not scan. Typing here also draws the code below; point the scanner at the screen to fire it for real."})]}),g.jsx(NA,{value:f.trim()}),r&&g.jsxs("div",{className:"space-y-2",children:[g.jsx("div",{className:"text-xs uppercase tracking-wide text-text-tertiary",children:"Last scan"}),g.jsx("div",{className:"text-sm font-mono text-text-primary",children:r.code}),w?g.jsxs(g.Fragment,{children:[g.jsx("div",{className:`text-sm font-medium ${Ov[w.outcome]}`,children:Av(w)}),w.error&&g.jsx("div",{className:"text-xs text-text-tertiary",children:w.error}),ru(w)&&g.jsx("div",{className:"text-sm border-t border-surface-border pt-2",children:g.jsx(jv,{content:ru(w),compact:!0})})]}):g.jsx("div",{className:"text-sm text-status-error",children:r.error})]}),g.jsxs("div",{className:"space-y-2",children:[g.jsxs("button",{type:"button",onClick:()=>v(S=>!S),className:"text-xs uppercase tracking-wide text-text-tertiary hover:text-text-primary",children:["Capture settings ",b?"▾":"▸"]}),b&&g.jsxs("div",{className:"space-y-3",children:[g.jsxs("label",{className:"block text-sm text-text-primary",children:[g.jsx("span",{className:"block text-xs text-text-tertiary mb-1",children:"Key gap limit (ms) — a longer pause between keys starts a new capture; raise it for scanners that pace slowly"}),g.jsx("input",{type:"number",min:100,max:2e3,step:50,value:l.maxKeyGapMs,onChange:S=>c({maxKeyGapMs:Number(S.target.value)}),className:"w-24 px-2 py-1 text-sm bg-surface-raised border border-surface-border rounded"})]}),g.jsxs("label",{className:"flex items-center gap-2 text-sm text-text-primary",children:[g.jsx("input",{type:"checkbox",checked:p,onChange:S=>y(S.target.checked)}),g.jsx("span",{children:"Diagnostics — trace every keydown the capture sees (also logged to the console)"})]}),p&&g.jsxs("div",{className:"border border-surface-border rounded",children:[g.jsx("div",{className:"px-2 py-1.5 text-2xs uppercase tracking-wide text-text-tertiary border-b border-surface-border",children:"Keydown trace — scan now, newest last"}),g.jsxs("div",{className:"max-h-64 overflow-y-auto font-mono text-2xs leading-5 px-2 py-1",children:[d.length===0&&g.jsx("div",{className:"text-text-tertiary",children:"Waiting for keys…"}),d.map(S=>g.jsxs("div",{className:"whitespace-nowrap overflow-hidden text-ellipsis",title:`buffer: ${S.buffer}`,children:[g.jsxs("span",{className:"text-text-tertiary",children:[String(S.deltaMs).padStart(4),"ms "]}),g.jsx("span",{className:"text",children:JSON.stringify(S.key)}),S.code&&g.jsxs("span",{className:"text-text-tertiary",children:[" (",S.code,")"]}),g.jsxs("span",{className:"text-text-tertiary",children:[" — ",S.note]})]},S.seq))]}),g.jsxs("div",{className:"px-2 py-1.5 text-2xs text-text-tertiary border-t border-surface-border",children:["Read it like this: a scan should end with an"," ",g.jsx("span",{className:"font-mono",children:'"Enter"'})," row saying"," ",g.jsx("span",{className:"font-mono",children:"capture → …"}),'. An Enter row saying "no code tail" means the buffer split (raise the gap limit, or a key arrived as something other than one character). No Enter row at all means the scanner sends no suffix — program its Enter/CR suffix. Keys named'," ",g.jsx("span",{className:"font-mono",children:'"Unidentified"'})," mean the decode arrives outside the keydown path."]})]})]})]})]})]})}const Tv="lt:bookmarks",qc="scan";function CA(){try{const i=localStorage.getItem(Tv);if(!i)return[];const t=JSON.parse(i);return Array.isArray(t)?t:[]}catch{return[]}}function D1(i){try{localStorage.setItem(Tv,JSON.stringify(i))}catch{}}function MA({onToggleEventFeed:i,onToggleDocs:t,onToggleNav:r}){var de,Ae;const s=go(),{user:l,logout:c}=Ht(),{viewAs:d,realIsBuilder:p}=Qb(),{available:y,mine:f}=gO();Zb();const{connected:m}=WE(),{data:b}=Wn(),{setPanel:v,closePanel:_,open:w,ownerKey:S}=Kd(),M=mv(),B=gn(),U=()=>{w&&S===qc?_(qc):v(g.jsx(kA,{onClose:()=>_(qc)}),{width:360,key:qc})},[ie,ce]=j.useState(!1),[C,z]=j.useState(!1),[re,X]=j.useState(lv),[L,G]=j.useState(CA),W=j.useRef(null),Q=(de=b==null?void 0:b.branding)==null?void 0:de.appName,he=(Ae=b==null?void 0:b.branding)==null?void 0:Ae.themes,_e=j.useMemo(()=>(_O(he??[]),wO()),[he]),Te=oe=>{SO(oe),X(oe)},Y=()=>{const oe=window.prompt("Bookmark label:");if(!(oe!=null&&oe.trim()))return;const je=B.pathname+B.search,Se=[...L,{label:oe.trim(),url:je}].sort((Ne,be)=>Ne.label.localeCompare(be.label));G(Se),D1(Se),ce(!1)},ae=oe=>{const je=L.filter(Se=>!(Se.label===oe.label&&Se.url===oe.url));G(je),D1(je)};return j.useEffect(()=>{if(!ie)return;const oe=je=>{W.current&&!W.current.contains(je.target)&&ce(!1)};return document.addEventListener("mousedown",oe),()=>document.removeEventListener("mousedown",oe)},[ie]),g.jsxs(g.Fragment,{children:[g.jsxs("header",{className:`h-14 shrink-0 border-b border-surface-border bg-surface-raised flex items-center justify-between pl-2 pr-5 relative ${ie?"z-[100]":"z-30"}`,children:[g.jsxs("div",{className:"flex items-center gap-1 min-w-0",children:[r&&g.jsx("button",{onClick:r,className:"lg:hidden p-2 text-text-secondary hover:text-text-primary transition-colors","aria-label":"Open navigation",children:g.jsx(uw,{className:"w-5 h-5",strokeWidth:1.5})}),g.jsxs(Ii,{to:"/","aria-label":"Home",className:"shrink-0",onClick:oe=>{(oe.ctrlKey||oe.metaKey)&&(oe.preventDefault(),z(!0))},children:[g.jsx(nu,{appName:Q,className:"hidden lg:flex"}),g.jsx(nu,{appName:Q,variant:"comet",className:"flex lg:hidden"})]}),g.jsx("div",{className:"hidden lg:block w-px h-4 bg-surface-border mx-1"}),g.jsx("button",{onClick:()=>s(-1),className:"p-2 text-accent/60 hover:text-accent transition-colors","aria-label":"Go back",children:g.jsx(sb,{className:"w-5 h-5",strokeWidth:2})}),g.jsx("button",{onClick:()=>s(1),className:"p-2 text-accent/60 hover:text-accent transition-colors","aria-label":"Go forward",children:g.jsx(Xh,{className:"w-5 h-5",strokeWidth:2})})]}),g.jsxs("div",{className:"flex items-center gap-5",children:[g.jsxs(Ii,{to:"/escalations/available",className:`flex items-center gap-1.5 text-xs transition-colors ${y>0?"text-status-queued":"text-text-quaternary hover:text-text-secondary"}`,title:"All escalations",children:[g.jsx(Jh,{className:"w-4 h-4",strokeWidth:1.5}),g.jsx("span",{className:"hidden lg:inline",children:"all"}),y>0&&g.jsx("sup",{className:"tabular-nums font-medium text-[0.5em]",children:y})]}),g.jsxs(Ii,{to:"/escalations/queue",className:`flex items-center gap-1.5 text-xs transition-colors ${f>0?"text-status-claimed":"text-text-quaternary hover:text-text-secondary"}`,title:"My escalation queue",children:[g.jsx(Jh,{className:"w-4 h-4",strokeWidth:1.5}),g.jsx("span",{className:"hidden lg:inline",children:"mine"}),f>0&&g.jsx("sup",{className:"tabular-nums font-medium text-[0.5em]",children:f})]}),g.jsx("div",{className:"hidden lg:block w-px h-4 bg-surface-border"}),M&&g.jsxs("button",{type:"button",onClick:U,className:"flex items-center gap-1.5 text-xs text-text-quaternary hover:text-text-secondary transition-colors",title:"Scan a code",children:[g.jsx(ou,{className:"w-4 h-4",strokeWidth:1.5}),g.jsx("span",{className:"hidden lg:inline",children:"scan"})]}),g.jsxs("button",{type:"button",onClick:()=>{m?i==null||i():window.location.reload()},className:`hidden lg:flex items-center gap-1.5 text-xs transition-colors ${m?"text-status-success hover:text-status-success/80":"text-text-quaternary hover:text-text-secondary"}`,title:m?"Live events — click to toggle feed":"Events disconnected — click to reconnect",children:[g.jsx(ab,{className:"w-4 h-4",strokeWidth:1.5}),"events"]}),p&&g.jsx(g.Fragment,{children:g.jsxs("button",{onClick:t,className:"hidden lg:flex items-center gap-1.5 text-xs text-text-quaternary hover:text-text-secondary transition-colors",title:"Documentation",children:[g.jsx(ob,{className:"w-4 h-4",strokeWidth:1.5}),"docs"]})}),d&&g.jsx(g.Fragment,{children:g.jsxs("span",{className:"hidden lg:flex items-center gap-1 pl-2 pr-1 py-0.5 rounded-full bg-accent/10 border border-accent/25 text-2xs text-accent select-none",children:[g.jsxs("span",{className:"capitalize font-medium tracking-wide",children:[d," View"]}),g.jsx("button",{onClick:xd,title:"Restore your real view",className:"ml-0.5 rounded-full p-0.5 hover:bg-accent/20 transition-colors",children:g.jsx(dn,{className:"w-2.5 h-2.5"})})]})}),g.jsx("div",{className:"hidden lg:block w-px h-4 bg-surface-border"}),l&&g.jsxs("div",{className:"relative",ref:W,children:[g.jsxs("button",{onClick:()=>ce(oe=>!oe),className:"btn-ghost flex items-center gap-1",children:[g.jsxs("span",{className:"relative",children:[g.jsx(fw,{className:"w-4 h-4 text-accent/75",strokeWidth:1.5}),d&&g.jsx("span",{className:"lg:hidden absolute -top-0.5 -right-0.5 w-2 h-2 rounded-full bg-accent"})]}),g.jsx("span",{className:"hidden lg:inline whitespace-nowrap",children:l.displayName||l.username||l.userId}),g.jsx("svg",{className:"hidden lg:block w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),ie&&g.jsxs("div",{className:"absolute right-0 top-full mt-1 w-52 bg-surface-raised border border-surface-border rounded-md shadow-lg py-1 z-[100]",children:[g.jsx(Ii,{to:"/credentials",onClick:()=>ce(!1),className:"block px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Credentials"}),g.jsx("button",{onClick:()=>{ce(!1),m?i==null||i():window.location.reload()},className:"lg:hidden block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:m?"Events":"Reconnect events"}),p&&g.jsx("button",{onClick:()=>{ce(!1),t==null||t()},className:"lg:hidden block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Docs"}),d&&g.jsxs("button",{onClick:()=>{ce(!1),xd()},className:"lg:hidden block w-full text-left px-3 py-2 text-xs text-accent hover:bg-surface-hover capitalize",children:["Exit ",d," view"]}),g.jsxs("div",{className:"px-3 py-2 border-t border-surface-border/60",children:[g.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-1.5",children:"Theme"}),g.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:_e.map(oe=>g.jsx("button",{type:"button",onClick:()=>Te(oe.id),title:oe.label,"aria-label":`${oe.label} theme`,className:`w-4 h-4 rounded-full transition-transform hover:scale-110 ${re===oe.id?"ring-2 ring-offset-1 ring-surface-border":""}`,style:{backgroundColor:oe.swatch}},oe.id))})]}),g.jsx("button",{onClick:()=>{ce(!1),c()},className:"block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Sign Out"}),g.jsxs("div",{className:"border-t border-surface-border/60 pt-1",children:[L.map(oe=>g.jsxs("div",{className:"flex items-center group px-3 py-1.5 hover:bg-surface-hover",children:[g.jsx(Ii,{to:oe.url,onClick:()=>ce(!1),title:oe.url,className:"flex-1 min-w-0 text-xs text-text-secondary hover:text-text-primary truncate",children:oe.label}),g.jsx("button",{type:"button",onClick:()=>ae(oe),title:`Remove "${oe.label}"`,className:"opacity-0 group-hover:opacity-100 transition-opacity ml-1 p-0.5 shrink-0 text-text-quaternary hover:text-status-error",children:g.jsx(dn,{className:"w-3 h-3"})})]},`${oe.label}::${oe.url}`)),g.jsx("hr",{className:"border-surface-border/60 mx-3 my-0.5"}),g.jsxs("button",{type:"button",onClick:Y,className:"flex items-center gap-1.5 w-full px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:[g.jsx(hw,{className:"w-3.5 h-3.5 shrink-0",strokeWidth:1.5}),"Add Bookmark"]})]})]})]})]})]}),C&&g.jsx(xO,{onClose:()=>z(!1)})]})}function Xd({open:i,children:t}){const[r,s]=j.useState(i);return j.useEffect(()=>{i&&s(!0)},[i]),g.jsx("div",{className:`grid transition-[grid-template-rows] duration-300 ease-out ${i?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,onTransitionEnd:()=>{i||s(!1)},children:g.jsx("div",{className:"overflow-hidden",children:r?t:null})})}function Sd(i){return({isActive:t})=>{const r="flex items-center rounded-md transition-colors duration-150",s="bg-surface-hover text-text-primary font-medium",l="text-text-secondary hover:text-text-primary hover:bg-surface-hover";return i?`${r} justify-center w-10 h-10 mx-auto ${t?s:l}`:`${r} gap-3 px-4 py-2 text-sm ${t?s:l}`}}function RA(){return({isActive:i})=>`flex items-center gap-3 pl-11 pr-4 py-1.5 text-xs rounded-md transition-colors duration-150 ${i?"text-text-primary font-medium":"text-text-secondary hover:text-text-primary"}`}function DA({group:i,collapsed:t}){const{pathname:r}=gn(),s=i.matchPaths.some(p=>r.startsWith(p)),[l,c]=j.useState(s),d=l||s;return t?g.jsx(g.Fragment,{children:i.items.map(p=>g.jsx(Hs,{to:p.to,className:Sd(!0),title:p.label,children:p.icon&&g.jsx(p.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})},p.to))}):g.jsxs("div",{children:[g.jsxs("button",{onClick:()=>c(p=>!p),className:"w-full flex items-center justify-between px-4 py-2 text-sm rounded-md transition-colors duration-150 text-text-secondary hover:text-text-primary hover:bg-surface-hover",children:[g.jsxs("span",{className:"flex items-center gap-3",children:[i.icon&&g.jsx(i.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),g.jsx("span",{children:i.label})]}),g.jsx("svg",{className:`w-3.5 h-3.5 text-text-tertiary transition-transform duration-150 ${d?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),g.jsx(Xd,{open:d,children:i.items.map(p=>g.jsxs(Hs,{to:p.to,end:p.end,className:RA(),children:[p.icon&&g.jsx(p.icon,{className:"w-4 h-4 shrink-0 text-accent/75",strokeWidth:1.5}),g.jsx("span",{children:p.label})]},p.to))})]})}function qA(i){return i.kind==="group"}function BA({entry:i,collapsed:t}){const{pathname:r,search:s}=gn(),l=i.to.includes("?"),c=i.icon&&g.jsx(i.icon,{className:`w-5 h-5 shrink-0 text-accent/75 ${i.iconClassName??""}`,strokeWidth:1.5,...i.solid?{fill:"currentColor"}:{}});if(l){const[d,p]=i.to.split("?"),y=r===d&&s===`?${p}`,f=Sd(t)({isActive:y});return g.jsxs(Hs,{to:i.to,className:f,title:t?i.label:void 0,children:[c,!t&&g.jsx("span",{children:i.label})]})}return g.jsxs(Hs,{to:i.to,end:i.end,className:Sd(t),title:t?i.label:void 0,children:[c,!t&&g.jsx("span",{children:i.label})]})}function ui({heading:i,entries:t}){const{collapsed:r}=Vd();return g.jsxs("div",{className:"space-y-1",children:[r?g.jsx("div",{className:"h-px bg-surface-border mx-3 my-2",title:i}):g.jsx("p",{className:"px-4 pt-5 pb-2 text-xs font-semibold uppercase tracking-wider text-text-tertiary",children:i}),t.map(s=>qA(s)?g.jsx(DA,{group:s,collapsed:r},s.label):g.jsx(BA,{entry:s,collapsed:r},s.to))]})}function LA({aiEnabled:i=!1,isBuilder:t=!1,isOps:r=!1,viewAs:s=null,canSeePaceBoard:l=!1}){const c={to:"/operations",label:"Pace Board",icon:dw};if(!t&&(!r||s==="engineer"||s==="operator"))return l?g.jsx(ui,{heading:"Monitor",entries:[c]}):null;if(!t)return g.jsx(ui,{heading:"Monitor",entries:l?[c]:[]});const d=[...l?[c]:[],{to:"/topics",label:"Event Topics",icon:ab},{to:"/agents",label:i?"Agents":"Automations",icon:mw},{to:"/capabilities",label:"Capabilities",icon:pw}];return g.jsx(ui,{heading:"Monitor",entries:d})}function zA(){return ft({queryKey:["me","preferences"],queryFn:()=>Oe("/me/preferences"),staleTime:6e4})}function UA(){const i=ht();return Et({mutationFn:t=>Oe("/me/preferences",{method:"PATCH",body:JSON.stringify(t)}),onSuccess:t=>{i.setQueryData(["me","preferences"],t)}})}function PA(i){return i.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").split(/[-_\s]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function IA(i){var t;return((t=i.title)==null?void 0:t.trim())||PA(i.role)}function $A(i,t){const r=(i==null?void 0:i.pinnedViews)??[],s=new Set((i==null?void 0:i.hiddenRolePins)??[]),l=new Set(r.map(p=>p.label)),c=[...r],d=new Set;for(const{role:p,pins:y}of t)for(const f of y)l.has(f.label)||s.has(f.label)||d.has(f.label)||(d.add(f.label),c.push({...f,id:`role:${p}:${f.label}`,fromRole:p}));return c}function HA(i){let t;try{t=new URL(i,"http://local")}catch{return null}if(t.pathname!=="/escalations/available"&&t.pathname!=="/escalations")return null;const r=t.searchParams,s=DO(r),l=r.get("status")||void 0,c=t.pathname==="/escalations/available"&&(l===void 0||l==="available");return{available:c,params:{...s,role:r.get("role")||void 0,type:r.get("type")||void 0,priority:r.get("priority")?parseInt(r.get("priority"),10):void 0,status:c||l==="all"?void 0:l,search:r.get("search")||void 0}}}function GA(){return`pin-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function FA(){var C;const{collapsed:i}=Vd(),{user:t}=Ht(),r=zA(),s=UA(),l=j.useMemo(()=>new Set(((t==null?void 0:t.roles)??[]).map(z=>z.role)),[t]),{data:c}=ev({enabled:l.size>0}),d=ht();Dd(Gd(),()=>{d.invalidateQueries({queryKey:["escalations"]})});const p=(C=r.data)==null?void 0:C.preferences,y=j.useMemo(()=>((c==null?void 0:c.roles)??[]).filter(z=>l.has(z.role)&&Array.isArray(z.default_pins)&&z.default_pins.length>0).map(z=>({role:z.role,pins:z.default_pins})),[c,l]),f=j.useMemo(()=>$A(p,y),[p,y]),m=j.useMemo(()=>new Map(((c==null?void 0:c.roles)??[]).map(z=>[z.role,IA(z)])),[c]),b=j.useMemo(()=>f.filter(z=>!z.fromRole),[f]),v=j.useMemo(()=>y.map(({role:z})=>({role:z,title:m.get(z)??z,pins:f.filter(re=>re.fromRole===z)})).filter(z=>z.pins.length>0),[y,m,f]),_=(p==null?void 0:p.pinnedViews)??[],w=j.useRef(null),S=z=>s.mutate({pinnedViews:z}),M=z=>S(_.filter(re=>re.id!==z)),B=z=>S([..._,{id:GA(),label:z.label,url:z.url,badge:z.badge}]),U=z=>s.mutate({hiddenRolePins:[...(p==null?void 0:p.hiddenRolePins)??[],z]}),ie=(z,re)=>{if(z===re)return;const X=[..._],[L]=X.splice(z,1);X.splice(re,0,L),S(X)};if(f.length===0)return null;const ce="px-4 pt-5 pb-2 text-xs font-semibold uppercase tracking-wider text-text-tertiary truncate";return g.jsxs("div",{className:"space-y-1",children:[i&&g.jsx("div",{className:"h-px bg-surface-border mx-3 my-2",title:"Pinned"}),!i&&b.length>0&&g.jsx("p",{className:ce,children:"Pinned"}),b.map(z=>{const re=_.findIndex(X=>X.id===z.id);return g.jsx(q1,{pin:z,collapsed:i,draggable:re!==-1,onDragStart:()=>{w.current=re},onDropOn:()=>{w.current!==null&&re!==-1&&ie(w.current,re),w.current=null},onRemove:()=>M(z.id)},z.id)}),v.map(z=>g.jsxs("div",{children:[!i&&g.jsx("p",{className:ce,title:`${z.title} — pins from the ${z.role} role`,"data-testid":"pin-group-label",children:z.title}),z.pins.map(re=>g.jsx(q1,{pin:re,collapsed:i,draggable:!1,onDragStart:()=>{},onDropOn:()=>{},onPromote:()=>B(re),onHide:()=>U(re.label)},re.id))]},z.role))]})}function q1({pin:i,collapsed:t,draggable:r,onDragStart:s,onDropOn:l,onRemove:c,onPromote:d,onHide:p}){const{pathname:y,search:f}=gn(),[m,b=""]=i.url.split("?"),v=y===m&&f===(b?`?${b}`:""),_="group flex items-center rounded-md transition-colors duration-150",w=v?"bg-surface-hover text-text-primary font-medium":"text-text-secondary hover:text-text-primary hover:bg-surface-hover";return t?g.jsx(Hs,{to:i.url,className:`${_} ${w} justify-center w-10 h-10 mx-auto`,title:i.label,children:g.jsx(zg,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})}):g.jsxs("div",{className:`${_} ${w} relative`,draggable:r,onDragStart:s,onDragOver:S=>S.preventDefault(),onDrop:l,children:[g.jsxs(Hs,{to:i.url,title:i.label,className:"flex items-center gap-2.5 pl-4 pr-3 py-1.5 text-[0.7875rem] flex-1 min-w-0",children:[g.jsx(zg,{className:"w-4 h-4 shrink-0 text-accent/75",strokeWidth:1.5,...i.fromRole?{}:{fill:"currentColor",fillOpacity:.15}}),g.jsx("span",{className:"truncate flex-1 min-w-0",children:i.label}),i.badge&&g.jsx(VA,{url:i.url})]}),g.jsxs("span",{className:"absolute right-1 top-1/2 -translate-y-1/2 flex items-center gap-0.5 rounded px-0.5 bg-surface-hover opacity-0 pointer-events-none group-hover:opacity-100 group-hover:pointer-events-auto transition-opacity",children:[d&&g.jsx("button",{onClick:d,title:"Make mine — copy into my pins",className:"p-1 text-text-quaternary hover:text-accent transition-colors",children:g.jsx(lb,{className:"w-3 h-3"})}),p&&g.jsx("button",{onClick:p,title:"Hide this role pin",className:"p-1 text-text-quaternary hover:text-status-error transition-colors",children:g.jsx(gw,{className:"w-3 h-3"})}),c&&g.jsx("button",{onClick:c,title:`Remove "${i.label}"`,className:"p-1 text-text-quaternary hover:text-status-error transition-colors",children:g.jsx(dn,{className:"w-3 h-3"})})]})]})}function VA({url:i}){var d;const t=j.useMemo(()=>HA(i),[i]),r={limit:1,staleTime:15e3},s=iv({...(t==null?void 0:t.params)??{},...r,enabled:!!t&&t.available}),l=rv({...(t==null?void 0:t.params)??{},...r,enabled:!!t&&!t.available});if(!t)return null;const c=t.available?s:l;return c.isError||((d=c.data)==null?void 0:d.total)===void 0?null:g.jsx("span",{className:"shrink-0 text-right text-2xs leading-none tabular-nums text-accent/80 relative -top-[0.35em]",title:`${c.data.total} matching now`,children:c.data.total})}function YA(){var c;const{data:i}=Wn(),t=(c=i==null?void 0:i.features)==null?void 0:c.graphWorkflows,r=t===!0||t!==!1&&Xb(),s=[{to:"/workflows/registry",label:"Registry",icon:Ug},{to:"/workflows/durable/invoke",label:"Invoke",icon:Pg},{to:"/workflows/executions",label:"Executions",icon:Ig}],l=r?[{kind:"group",label:"Procedural",icon:yw,matchPaths:["/workflows/registry","/workflows/durable/invoke","/workflows/executions","/workflows/durable/executions","/workflows/start","/workflows/workers","/workflows/tasks"],items:s},{kind:"group",label:"Graph",icon:Ed,matchPaths:["/mcp/workflows","/mcp/executions"],items:[{to:"/mcp/workflows",label:"Configure",icon:Ug,end:!0},{to:"/mcp/workflows/invoke",label:"Invoke",icon:Pg},{to:"/mcp/executions",label:"Executions",icon:Ig}]}]:s;return g.jsx(ui,{heading:"Orchestrate",entries:l})}const KA=[{to:"/mcp/queries",label:"Designer",icon:bw},{to:"/mcp/servers",label:"Servers & Tools",icon:vw}];function XA(){return g.jsx(ui,{heading:"Design",entries:KA})}const JA=[{to:"/files",label:"Files",icon:xw},{to:"/knowledge",label:"Knowledge",icon:_w}];function QA(){return g.jsx(ui,{heading:"Storage",entries:JA})}function ZA({isBuilder:i=!1,isOps:t=!1}){var d;const{data:r}=Wn(),s=((d=r==null?void 0:r.features)==null?void 0:d.dbMaintenance)!==!1,l=[{to:"/admin/users",label:"Accounts",icon:ww},...i||t?[{to:"/admin/roles",label:"Roles",icon:Jh},{to:"/admin/personas",label:"Personas",icon:Sw},{to:"/admin/scan-codes",label:"Scan Codes",icon:ou}]:[]],c=[{to:"/admin/controlplane",label:"Routers",icon:Ew},{to:"/admin/streams",label:"Messages",icon:Ow},...s?[{to:"/admin/maintenance",label:"DB Maintenance",icon:Aw}]:[]];return g.jsxs(g.Fragment,{children:[g.jsx(ui,{heading:"Identity & Access",entries:l}),i&&g.jsx(ui,{heading:"Infrastructure",entries:c})]})}function Nv({aiEnabled:i,isBuilder:t,isOps:r,viewAs:s,canSeePaceBoard:l}){return g.jsxs(g.Fragment,{children:[g.jsx(LA,{aiEnabled:i,isBuilder:t,isOps:r,viewAs:s,canSeePaceBoard:l}),g.jsx(FA,{}),t&&g.jsx(YA,{}),t&&i&&g.jsx(XA,{}),t&&g.jsx(QA,{}),(t||r)&&g.jsx(ZA,{isBuilder:t,isOps:r})]})}function WA({open:i,onClose:t,...r}){const s=gn();return j.useEffect(()=>{t()},[s.pathname]),g.jsxs("div",{className:`lg:hidden fixed inset-y-0 left-0 z-40 flex ${i?"":"pointer-events-none"}`,children:[g.jsx("div",{className:`fixed inset-0 bg-black/20 transition-opacity duration-200 ${i?"opacity-100":"opacity-0"}`,onClick:t,"aria-hidden":!0}),g.jsxs("div",{className:`relative w-72 max-w-[85vw] h-full bg-surface-raised border-r border-surface-border shadow-xl flex flex-col transition-transform duration-200 ease-out ${i?"translate-x-0":"-translate-x-full"}`,children:[g.jsx("div",{className:"flex items-center justify-end px-3 pt-3 shrink-0",children:g.jsx("button",{onClick:t,className:"p-1.5 rounded text-text-tertiary hover:text-text-primary hover:bg-surface-hover transition-colors","aria-label":"Close navigation",children:g.jsx(dn,{className:"w-4 h-4"})})}),g.jsx("nav",{className:"flex-1 px-3 pb-4 space-y-2 overflow-y-auto overflow-x-hidden",children:g.jsx(dO,{children:g.jsx(Nv,{...r})})})]})]})}const kv="lt_event_feed_patterns";function ej(i,t){if(i.startsWith("/topics/")){const d=decodeURIComponent(i.replace("/topics/",""));if(d&&!d.includes("/"))return`lt.events.${d}`}const r=i.match(/^\/escalations\/detail\/(.+)/);if(r)return`lt.events.system.escalation.*.${r[1]}.>`;if(i.startsWith("/escalations")){const d=new URLSearchParams(t).get("role");return d?`lt.events.system.escalation.${Wb(d)}.>`:"lt.events.system.escalation.>"}const s=i.match(/^\/workflows\/(?:durable\/)?executions\/(.+)/);if(s)return`lt.events.system.workflow.${s[1]}.>`;if(i.startsWith("/workflows"))return"lt.events.system.workflow.>";const l=i.match(/^\/agents\/([^/]+)$/);if(l&&l[1]!=="new")return`lt.events.system.agent.${l[1]}.>`;if(i.startsWith("/agents"))return"lt.events.system.agent.>";if(i.startsWith("/knowledge"))return"lt.events.system.knowledge.>";if(i.startsWith("/files"))return"lt.events.system.file.>";if(i==="/")return"lt.events.system.>";const c=i.match(/^\/mcp\/executions\/(.+)/);return c?`lt.events.system.*.${c[1]}.>`:(i.startsWith("/mcp"),"lt.events.system.>")}function tj(){try{const i=localStorage.getItem(kv);return i?JSON.parse(i):[]}catch{return[]}}function Vh(i){try{localStorage.setItem(kv,JSON.stringify(i))}catch{}}function nj(){const{pathname:i,search:t}=gn(),[r,s]=j.useState(tj),l=j.useMemo(()=>ej(i,t),[i,t]),c=j.useMemo(()=>{const f=new Set([l,...r]);return Array.from(f)},[l,r]),d=j.useCallback(f=>{const m=f.startsWith("lt.events.")?f:`lt.events.${f}`;s(b=>{if(b.includes(m))return b;const v=[...b,m];return Vh(v),v})},[]),p=j.useCallback(f=>{s(m=>{const b=m.filter(v=>v!==f);return Vh(b),b})},[]),y=j.useCallback(()=>{s([]),Vh([])},[]);return{patterns:c,pagePattern:l,userPatterns:r,addPattern:d,removePattern:p,clearUserPatterns:y}}function rj({children:i,className:t=""}){return g.jsx("p",{className:`text-2xs font-semibold uppercase tracking-widest text-text-tertiary ${t}`,children:i})}const Yh=280,B1="cubic-bezier(0.4, 0, 0.2, 1)",Bc=40;function ij(i){if(!i)return"scale(0.92)";const t=window.innerWidth,r=window.innerHeight,s=t-Bc*2,l=r-Bc*2,c=i.width/s,d=i.height/l,p=i.left+i.width/2-(Bc+s/2),y=i.top+i.height/2-(Bc+l/2);return`translate(${p}px, ${y}px) scale(${c}, ${d})`}function Cv({open:i,onClose:t,sourceRef:r,children:s}){const[l,c]=j.useState(null),d=j.useRef(null),p=j.useRef(!1);j.useEffect(()=>{var v,_;i&&!p.current?(d.current=((v=r==null?void 0:r.current)==null?void 0:v.getBoundingClientRect())??null,c("entering")):!i&&p.current&&l==="open"&&(d.current=((_=r==null?void 0:r.current)==null?void 0:_.getBoundingClientRect())??null,c("exiting")),p.current=i},[i,r,l]),j.useEffect(()=>{if(l!=="entering")return;const v=requestAnimationFrame(()=>{requestAnimationFrame(()=>c("open"))});return()=>cancelAnimationFrame(v)},[l]),j.useEffect(()=>{if(l)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[l]),j.useEffect(()=>{if(!l)return;const v=_=>{_.key==="Escape"&&t()};return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[l,t]);const y=j.useCallback(v=>{v.propertyName==="transform"&&l==="exiting"&&c(null)},[l]);if(j.useEffect(()=>{if(l!=="exiting")return;const v=setTimeout(()=>c(null),Yh+50);return()=>clearTimeout(v)},[l]),!l)return null;const f=l==="entering"||l==="exiting",m=f?ij(d.current):"none",b=f?0:1;return ib.createPortal(g.jsx("div",{className:"fixed inset-0 z-50 overflow-auto p-10",style:{transformOrigin:"center center",transition:`transform ${Yh}ms ${B1}, opacity ${Yh}ms ${B1}`,transform:m,opacity:b,backgroundColor:"rgb(var(--lt-surface))"},onTransitionEnd:y,children:s}),document.body)}function sj({className:i}){return g.jsx("svg",{className:i,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M4 12h8M4 18h12"})})}function aj({className:i}){return g.jsx("svg",{className:i,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 7l-5 5 5 5M16 7l5 5-5 5"})})}function oj({className:i}){return g.jsx("svg",{className:i,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 5H6a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2v-1M8 5a2 2 0 002 2h2a2 2 0 002-2M8 5a2 2 0 012-2h2a2 2 0 012 2m0 0h2a2 2 0 012 2v3"})})}function lj({className:i}){return g.jsx("svg",{className:i,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}function cj({className:i}){return g.jsx("svg",{className:i,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 9V4.5M9 9H4.5M9 9L3.5 3.5M9 15v4.5M9 15H4.5M9 15l-5.5 5.5M15 9h4.5M15 9V4.5M15 9l5.5-5.5M15 15h4.5M15 15v4.5m0-4.5l5.5 5.5"})})}function uj({className:i}){return g.jsx("svg",{className:i,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5v-4m0 4h-4m4 0l-5-5"})})}function fj(i){const t=i.trim().split(`
56
+ `);if(t.length<2)return i;const r=p=>p.split("|").map(y=>y.trim()).filter(Boolean),s=r(t[0]),l=t.slice(2),c=s.map(p=>`<th class="px-3 py-1.5 text-left text-2xs font-semibold uppercase tracking-wider text-text-tertiary">${p}</th>`).join(""),d=l.map(p=>`<tr class="border-t border-surface-border">${r(p).map(m=>`<td class="px-3 py-1.5 text-xs text-text-secondary">${m}</td>`).join("")}</tr>`).join("");return`<table class="w-full my-3 text-xs"><thead><tr class="border-b border-surface-border">${c}</tr></thead><tbody>${d}</tbody></table>`}function Lc(i){return i.toLowerCase().replace(/<[^>]+>/g,"").replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").trim()}function hj(i){const t=[];let r=i.replace(/```(\w*)\n([\s\S]*?)```/g,(y,f,m)=>{const b=t.length;return t.push(`<pre class="bg-surface-sunken rounded p-3 my-2 overflow-x-auto text-2xs leading-relaxed"><code>${m}</code></pre>`),`\0CODE${b}\0`});const s=/^(\|.+\|)\n(\|[-| :]+\|)\n((?:\|.+\|\n?)+)/gm;r=r.replace(s,(y,f,m,b)=>fj(`${f}
57
57
  ${m}
58
- ${b.trimEnd()}`)),r=r.replace(/`([^`]+)`/g,'<code class="bg-surface-sunken px-1 py-0.5 rounded text-2xs">$1</code>'),r=r.replace(/^#### (.+)$/gm,(g,f)=>`<h4 id="${Lc(f)}" class="text-xs font-semibold text-text-primary mt-4 mb-1">${f}</h4>`).replace(/^### (.+)$/gm,(g,f)=>`<h3 id="${Lc(f)}" class="text-sm font-semibold text-text-primary mt-5 mb-1.5">${f}</h3>`).replace(/^## (.+)$/gm,(g,f)=>`<h2 id="${Lc(f)}" class="text-base font-semibold text-text-primary mt-6 mb-2 pb-1 border-b border-surface-border">${f}</h2>`).replace(/^# (.+)$/gm,(g,f)=>`<h1 id="${Lc(f)}" class="text-lg font-bold text-text-primary mb-3">${f}</h1>`),r=r.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/\[([^\]]+)\]\(#([^)]+)\)/g,'<a data-anchor="$2" class="text-accent hover:underline cursor-pointer">$1</a>').replace(/\[([^\]]+)\]\(([^)]*\.md(?:#[^)]*)?)\)/g,'<a data-doc-link="$2" class="text-accent hover:underline cursor-pointer">$1</a>').replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" class="text-accent hover:underline">$1</a>').replace(/^ - (.+)$/gm,'<li class="ml-8 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^ - (.+)$/gm,'<li class="ml-8 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^- (.+)$/gm,'<li class="ml-4 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^\d+\. (.+)$/gm,'<li class="ml-4 list-decimal text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^---+$/gm,'<hr class="border-surface-border my-4" />').replace(/(?:^> (.+)$\n?)+/gm,g=>{const f=g.replace(/^> /gm,"").trim(),m=/⚠️|warning|caution/i.test(f),b=/note:|ℹ️|info/i.test(f);return`<div class="${m?"bg-status-warning/5":b?"bg-accent/5":"bg-surface-sunken/50"} ${m?"border-status-warning":b?"border-accent":"border-text-tertiary"} border-l-2 rounded-r-md px-3 py-2 my-3 text-xs text-text-secondary leading-relaxed">${f}</div>`}).replace(/\n\n/g,"\0PARA\0").replace(/\n/g,"<br/>");const l=g=>g.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),c=g=>new RegExp(`(${l(g)}[\\s\\S]*?<\\/li>(?:<br\\/>)?)+`,"g");r=r.replace(c('<li class="ml-8 list-disc'),g=>`<ul class="mb-3">${g}</ul>`),r=r.replace(c('<li class="ml-4 list-disc'),g=>`<ul class="mb-3">${g}</ul>`),r=r.replace(c('<li class="ml-4 list-decimal'),g=>`<ol class="list-decimal mb-3">${g}</ol>`),r=r.replace(/\x00CODE(\d+)\x00/g,(g,f)=>t[parseInt(f,10)]);const d="text-xs leading-relaxed text-text-secondary mb-2",p=/<\/(h[1-4]|pre|table|ul|ol|hr|div)>/;return r=r.split("\0PARA\0").map(g=>{const f=g.trim();if(!f)return"";const m=[];let b=f,v;for(;(v=p.exec(b))!==null;){const _=v.index+v[0].length;m.push(b.slice(0,_)),b=b.slice(_).replace(/^<br\/>/,"").trim(),p.lastIndex=0}return b&&m.push(b),m.map(_=>{const w=_.trim();return w?/^\s*<(h[1-4]|pre|table|ul|ol|hr|div)/.test(w)?w:`<p class="${d}">${w}</p>`:""}).join("")}).join(""),r}const fj=/(\*\*|^#{1,4}\s|^- |^\d+\.\s|```|^\|.*\|$|\[.+\]\(.+\))/m;function hj(i){return fj.test(i)}function Xd({content:i,className:t,onClick:r}){const s=j.useMemo(()=>uj(i),[i]);return y.jsx("div",{className:t,onClick:r,dangerouslySetInnerHTML:{__html:s}})}function iu({data:i,depth:t=0,generation:r}){const l=r!==void 0&&r>0&&r%2===1?!1:t>0,[c,d]=j.useState(l),[p,g]=j.useState(r);if(r!==void 0&&r!==p&&(g(r),d(r%2===0&&t>0)),i==null)return y.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof i=="string")return y.jsxs("span",{className:"text-text-primary",children:['"',i,'"']});if(typeof i=="number"||typeof i=="boolean")return y.jsx("span",{className:"text-text-primary font-medium",children:String(i)});if(Array.isArray(i))return i.length===0?y.jsx("span",{className:"text-text-tertiary",children:"[]"}):c?y.jsxs("button",{onClick:()=>d(!1),className:"text-text-secondary hover:text-text-primary",children:["[",i.length," items]"]}):y.jsxs("span",{children:[y.jsx("button",{onClick:()=>d(!0),className:"text-text-tertiary hover:text-text-primary",children:"["}),y.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:i.map((f,m)=>y.jsxs("div",{children:[y.jsx(iu,{data:f,depth:t+1,generation:r}),m<i.length-1&&y.jsx("span",{className:"text-text-tertiary",children:","})]},m))}),y.jsx("span",{className:"text-text-tertiary",children:"]"})]});if(typeof i=="object"){const f=Object.entries(i);return f.length===0?y.jsx("span",{className:"text-text-tertiary",children:"{}"}):c?y.jsxs("button",{onClick:()=>d(!1),className:"text-text-secondary hover:text-text-primary",children:["{","...","}"]}):y.jsxs("span",{children:[y.jsx("button",{onClick:()=>d(!0),className:"text-text-tertiary hover:text-text-primary",children:"{"}),y.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:f.map(([m,b],v)=>y.jsxs("div",{children:[y.jsx("span",{className:"text-text-secondary",children:m}),y.jsx("span",{className:"text-text-tertiary",children:": "}),y.jsx(iu,{data:b,depth:t+1,generation:r}),v<f.length-1&&y.jsx("span",{className:"text-text-tertiary",children:","})]},m))}),y.jsx("span",{className:"text-text-tertiary",children:"}"})]})}return y.jsx("span",{children:String(i)})}function co({data:i,depth:t=0}){if(i==null)return y.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof i=="string")return i.length>40&&hj(i)?y.jsx(Xd,{content:i}):y.jsx("span",{className:"text-text-primary",children:i});if(typeof i=="number"||typeof i=="boolean")return y.jsx("span",{className:"text-text-primary font-medium",children:String(i)});if(Array.isArray(i))return i.length===0?y.jsx("span",{className:"text-text-tertiary italic",children:"empty list"}):y.jsx("div",{className:"space-y-2",children:i.map((r,s)=>y.jsxs("div",{className:"flex items-baseline gap-2",children:[y.jsxs("span",{className:"text-text-tertiary text-2xs shrink-0",children:[s+1,"."]}),y.jsx("div",{className:"flex-1",children:y.jsx(co,{data:r,depth:t+1})})]},s))});if(typeof i=="object"){const r=Object.entries(i);return r.length===0?y.jsx("span",{className:"text-text-tertiary italic",children:"empty"}):y.jsx("div",{className:t>0?"pl-4 border-l border-surface-border space-y-3":"space-y-3",children:r.map(([s,l])=>{const c=l===null||typeof l!="object";return y.jsxs("div",{children:[y.jsx("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-0.5",children:s.replace(/[_-]/g," ")}),c?y.jsx("p",{className:"text-sm text-text-primary",children:y.jsx(co,{data:l,depth:t+1})}):y.jsx(co,{data:l,depth:t+1})]},s)})})}return y.jsx("span",{children:String(i)})}function L1({mode:i,setMode:t,isCollapsed:r,onToggleCollapse:s,onCopy:l,copied:c,onFullscreen:d,onClose:p,large:g}){const f=g?"w-5 h-5":"w-3.5 h-3.5",m=`${g?"p-2":"p-1.5"} rounded text-accent/60 hover:text-accent hover:bg-surface-raised transition-colors duration-150`;return y.jsxs("div",{className:"flex items-center gap-0.5 bg-surface-sunken/80 rounded-md backdrop-blur-sm",children:[i==="json"&&y.jsx("button",{onClick:s,className:m,title:r?"Expand all":"Collapse all",children:r?y.jsx(lj,{className:f}):y.jsx(oj,{className:f})}),y.jsx("button",{onClick:()=>t(i==="json"?"tree":"json"),className:m,title:i==="json"?"Outline view":"JSON view",children:i==="json"?y.jsx(rj,{className:f}):y.jsx(ij,{className:f})}),y.jsx("button",{onClick:l,className:m,title:"Copy to clipboard",children:c?y.jsx(aj,{className:`${f} text-status-success`}):y.jsx(sj,{className:f})}),d&&y.jsx("button",{onClick:d,className:m,title:"Fullscreen",children:y.jsx(cb,{className:f})}),p&&y.jsx("button",{onClick:p,className:m,title:"Close (Esc)",children:y.jsx(ub,{className:f})})]})}function dj({data:i,label:t,variant:r,defaultCollapsed:s=!1,defaultMode:l}){const c=j.useRef(null),[d,p]=j.useState(l??"json"),[g,f]=j.useState(!1),[m,b]=j.useState(!1),[v,_]=j.useState(s?0:1),[w,S]=j.useState(1),M=v%2===0,B=w%2===0,U=j.useCallback(()=>_(G=>G+1),[]),ie=j.useCallback(()=>S(G=>G+1),[]);let ce=i;if(typeof i=="string")try{ce=JSON.parse(i)}catch{}const C=async()=>{const G=typeof i=="string"?i:JSON.stringify(ce,null,2);await navigator.clipboard.writeText(G),f(!0),setTimeout(()=>f(!1),2e3)},z=j.useCallback(()=>{S(1),b(!0)},[]),re=r==="panel",X=re?"border border-accent-muted/40 rounded-lg p-3 bg-surface-hover/30":"",L=re?"font-mono text-xs leading-relaxed bg-surface-raised rounded-md p-4 overflow-x-auto break-all":"font-mono text-xs leading-relaxed bg-surface-sunken border border-surface-border rounded-md p-4 overflow-x-auto break-all";return y.jsxs("div",{className:X,children:[t&&y.jsx(tj,{children:t}),y.jsxs("div",{ref:c,className:"relative",children:[y.jsx("div",{className:"absolute top-2 right-2 z-[5]",children:y.jsx(L1,{mode:d,setMode:p,isCollapsed:M,onToggleCollapse:U,onCopy:C,copied:g,onFullscreen:z})}),y.jsx("div",{className:L,children:d==="json"?y.jsx(iu,{data:ce,generation:v}):y.jsx(co,{data:ce})})]}),y.jsxs(Tv,{open:m,onClose:()=>b(!1),sourceRef:c,children:[y.jsx("div",{className:"sticky top-0 float-right z-10",children:y.jsx(L1,{mode:d,setMode:p,isCollapsed:B,onToggleCollapse:ie,onCopy:C,copied:g,onClose:()=>b(!1),large:!0})}),y.jsx("div",{className:"font-mono text-sm leading-relaxed",children:d==="json"?y.jsx(iu,{data:ce,generation:w}):y.jsx(co,{data:ce})})]})]})}const mj=100,z1=500;let pj=0;const Nv={"escalation.created":"text-status-active","escalation.claimed":"text-status-warning","escalation.released":"text-text-tertiary","escalation.resolved":"text-status-success","task.created":"text-accent","task.completed":"text-status-success","task.failed":"text-status-error","task.escalated":"text-status-warning","workflow.started":"text-accent","workflow.completed":"text-status-success","workflow.failed":"text-status-error","activity.started":"text-status-active","activity.completed":"text-status-success","activity.failed":"text-status-error","knowledge.stored":"text-accent","knowledge.deleted":"text-text-tertiary","agent.started":"text-accent","agent.completed":"text-status-success","agent.failed":"text-status-error","agent.status_changed":"text-status-active",milestone:"text-accent"};function kv(i){const t=i.split(".");return t[0]==="system"&&t.length>=3?`${t[1]}.${t[t.length-1]}`:i}function U1({event:i,forceExpanded:t=!1}){var v,_;const[r,s]=j.useState(t),l=Nv[kv(i.type)]||"text-text-tertiary";j.useEffect(()=>{s(t)},[t]);const c=t,d=c?"text-xs":"text-2xs",p=c?"text-xs":"text-2xs",g=c?"text-xs":"text-2xs",f=c?"w-3.5 h-3.5":"w-2.5 h-2.5",m=c?"py-2 px-4":"py-1 px-3",b=c?"pb-4 px-4":"pb-2 px-3";return y.jsxs("div",{className:"border-b border-surface-border/30 last:border-b-0",children:[y.jsxs("button",{onClick:()=>s(!r),className:`flex items-center gap-2 ${m} w-full text-left hover:bg-surface-hover/50 transition-colors`,children:[y.jsx("span",{className:`${d} font-mono text-text-tertiary whitespace-nowrap tabular-nums shrink-0`,children:new Date(i.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}),y.jsx("span",{className:`${p} font-medium px-1 py-0.5 rounded ${l} bg-surface-sunken whitespace-nowrap shrink-0`,children:i.type}),y.jsxs("span",{className:`${g} text-text-tertiary font-mono flex-1 min-w-0 truncate`,children:[(v=i.data)!=null&&v.workflowId?String(i.data.workflowId):"",(_=i.data)!=null&&_.escalationId?` esc:${String(i.data.escalationId).slice(0,12)}`:""]}),y.jsx("svg",{className:`${f} text-text-tertiary shrink-0 transition-transform duration-150 ${r?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),y.jsx(Kd,{open:r,children:y.jsx("div",{className:b,children:y.jsx(dj,{data:i.data})})})]})}function gj({open:i,onToggle:t,configOpen:r,onToggleConfig:s}){const[l,c]=j.useState([]),[d,p]=j.useState(!1),[g,f]=j.useState(""),m=j.useRef(null),b=j.useRef(new Map),{subscribe:v}=j.useContext(Ks),{patterns:_,pagePattern:w,userPatterns:S,addPattern:M,removePattern:B}=ej(),U=j.useCallback(C=>{const z=String(C.type||"unknown");if(z.startsWith("mesh."))return;const re=`${z}:${C.timestamp||""}:${C.escalationId||C.workflowId||C.taskId||""}`,X=Date.now(),L=b.current.get(re);if(!(L&&X-L<z1)){if(b.current.set(re,X),b.current.size>200)for(const[G,W]of b.current)X-W>z1*2&&b.current.delete(G);c(G=>[{id:++pj,type:z,timestamp:C.timestamp||new Date().toISOString(),data:C},...G].slice(0,mj))}},[]),ie=j.useRef(U);ie.current=U;const ce=i||d||r;return j.useEffect(()=>{if(!ce)return;const C=_.map(z=>v(z,re=>ie.current(re)));return()=>C.forEach(z=>z())},[v,_.join(","),ce]),j.useEffect(()=>{i&&m.current&&(m.current.scrollTop=0)},[l.length,i]),y.jsxs("div",{className:"shrink-0 border-t border-surface-border bg-surface-raised",children:[y.jsxs("button",{onClick:t,className:"flex items-center gap-2 w-full px-4 py-1.5 text-left hover:bg-surface-hover transition-colors",children:[i?y.jsx(Sw,{className:"w-3 h-3 text-text-tertiary"}):y.jsx(Ew,{className:"w-3 h-3 text-text-tertiary"}),y.jsx("span",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary",children:"Event Stream"}),l.length>0&&y.jsxs("span",{className:"text-2xs text-text-tertiary",children:[l.length," events"]}),l.length>0&&!i&&y.jsx("span",{className:`text-2xs font-medium px-1 py-0.5 rounded ${Nv[kv(l[0].type)]||"text-text-tertiary"} bg-surface-sunken`,children:l[0].type}),y.jsxs("span",{className:"ml-auto flex items-center gap-1",children:[y.jsx("span",{className:`p-0.5 cursor-pointer ${r?"text-accent":"text-text-tertiary hover:text-text-primary"}`,title:"Subscription config",onClick:C=>{C.stopPropagation(),s()},children:y.jsx(Ow,{className:"w-3 h-3"})}),l.length>0&&y.jsxs(y.Fragment,{children:[y.jsx("span",{className:"text-text-tertiary hover:text-text-primary p-0.5 cursor-pointer",title:"Fullscreen",onClick:C=>{C.stopPropagation(),p(!0)},children:y.jsx(cb,{className:"w-3 h-3"})}),y.jsx("span",{className:"text-text-tertiary hover:text-text-primary p-0.5 cursor-pointer",title:"Clear events",onClick:C=>{C.stopPropagation(),c([])},children:y.jsx(Aw,{className:"w-3 h-3"})})]})]})]}),r&&y.jsxs("div",{className:"px-4 py-2 border-t border-surface-border/50 bg-surface-sunken/30",children:[y.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 mb-1.5",children:[y.jsx("span",{className:"text-2xs text-text-quaternary uppercase tracking-wider shrink-0",children:"Subscribed:"}),y.jsx("span",{className:"text-2xs font-mono text-accent px-1.5 py-0.5 bg-accent/10 rounded",children:w.replace("lt.events.","")}),S.map(C=>y.jsxs("span",{className:"inline-flex items-center gap-1 text-2xs font-mono text-text-secondary px-1.5 py-0.5 bg-surface-sunken rounded",children:[C.replace("lt.events.",""),y.jsx("button",{onClick:()=>B(C),className:"text-text-quaternary hover:text-status-error",children:y.jsx(Cn,{className:"w-2 h-2"})})]},C))]}),y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("input",{type:"text",value:g,onChange:C=>f(C.target.value),onKeyDown:C=>{C.key==="Enter"&&g.trim()&&(M(g.trim()),f(""))},placeholder:"task.> or file.stored",className:"input text-2xs font-mono flex-1 py-1"}),y.jsxs("button",{onClick:()=>{g.trim()&&(M(g.trim()),f(""))},className:"text-2xs text-accent hover:text-accent-hover flex items-center gap-0.5",children:[y.jsx(lb,{className:"w-2.5 h-2.5"})," Add"]})]})]}),y.jsx(Kd,{open:i,children:y.jsx("div",{ref:m,className:"h-48 overflow-y-auto",children:l.length===0?y.jsx("p",{className:"text-2xs text-text-tertiary py-4 text-center",children:"Waiting for events..."}):l.map(C=>y.jsx(U1,{event:C},C.id))})}),y.jsxs(Tv,{open:d,onClose:()=>p(!1),sourceRef:m,children:[y.jsx("div",{className:"sticky top-0 float-right z-10",children:y.jsx("button",{onClick:()=>p(!1),className:"p-2 rounded text-text-tertiary hover:text-text-primary hover:bg-surface-raised transition-colors duration-150 bg-surface-sunken/80 backdrop-blur-sm",title:"Close (Esc)",children:y.jsx(ub,{className:"w-5 h-5"})})}),l.length===0?y.jsx("p",{className:"text-sm text-text-tertiary py-8",children:"No events captured"}):l.map(C=>y.jsx(U1,{event:C,forceExpanded:!0},C.id))]})]})}function yj(){return pt({queryKey:["docs"],queryFn:()=>Ae("/docs"),staleTime:5*6e4})}function bj(i){return pt({queryKey:["docs",i],queryFn:()=>Ae(`/docs/read?path=${encodeURIComponent(i)}`),enabled:!!i,staleTime:5*6e4})}function vj(){const[i,t]=j.useState([]),[r,s]=j.useState([]),[l,c]=j.useState(null),d=j.useRef(l),p=j.useRef(i),g=j.useRef(r);d.current=l,p.current=i,g.current=r;const f=j.useCallback((w,S)=>{var B;const M=d.current;if(M){const U=((B=S==null?void 0:S.current)==null?void 0:B.scrollTop)??0;t([...p.current,{...M,scrollTop:U}])}s([]),c({path:w,scrollTop:0})},[]),m=j.useCallback(w=>{var U;const S=p.current;if(S.length===0)return;const M=S[S.length-1],B=d.current;if(B){const ie=((U=w==null?void 0:w.current)==null?void 0:U.scrollTop)??0;s([...g.current,{...B,scrollTop:ie}])}t(S.slice(0,-1)),c(M),requestAnimationFrame(()=>{w!=null&&w.current&&(w.current.scrollTop=M.scrollTop)})},[]),b=j.useCallback(w=>{var U;const S=g.current;if(S.length===0)return;const M=S[S.length-1],B=d.current;if(B){const ie=((U=w==null?void 0:w.current)==null?void 0:U.scrollTop)??0;t([...p.current,{...B,scrollTop:ie}])}s(S.slice(0,-1)),c(M),requestAnimationFrame(()=>{w!=null&&w.current&&(w.current.scrollTop=M.scrollTop)})},[]),v=j.useCallback(w=>{var B,U;const S=d.current;if(!S)return;const M=((B=w==null?void 0:w.current)==null?void 0:B.scrollTop)??0;t([...p.current,{...S,scrollTop:M}]),s([]),c({...S,scrollTop:((U=w==null?void 0:w.current)==null?void 0:U.scrollTop)??0})},[]),_=j.useCallback(()=>{t([]),s([]),c(null)},[]);return{current:l,backStack:i,forwardStack:r,navigate:f,goBack:m,goForward:b,pushScrollPosition:v,reset:_}}function xj(i,t){const[r,s]=i.split("#");let l=r;if(l.startsWith("./")||l.startsWith("../")){const d=((t?t.replace(/[^/]+$/,""):"")+l).split("/"),p=[];for(const g of d)g===".."?p.pop():g&&g!=="."&&p.push(g);l=p.join("/")}return{path:l,anchor:s}}function _j(i){if(!i.startsWith("#docs"))return null;const t=i.slice(1).split(":"),r=t[1]||"README.md",s=t[2]||void 0;return{path:r,anchor:s}}function wj(i){return!i||i==="README.md"?"#docs":`#docs:${i}`}function Sj({content:i,currentPath:t,onNavigate:r,onAnchorClick:s}){const l=c=>{var f;const d=c.target,p=d.closest("[data-anchor]");if(p){c.preventDefault(),s();const m=p.dataset.anchor,b=(f=p.closest(".docs-content"))==null?void 0:f.querySelector(`#${CSS.escape(m)}`);b==null||b.scrollIntoView({behavior:"smooth",block:"start"});return}const g=d.closest("[data-doc-link]");if(g){c.preventDefault();const{path:m,anchor:b}=xj(g.dataset.docLink,t);r(m,b);return}};return y.jsx(Xd,{content:i,className:"docs-content",onClick:l})}function Ej(i){const t=[],r=new Map;for(const s of i){const l=s.path.split("/");if(l.length===1){t.push(s);continue}let c=r;for(let d=0;d<l.length-1;d++){const p=l[d];c.has(p)||c.set(p,{label:p,children:[],subdirs:new Map});const g=c.get(p);d===l.length-2?g.children.push(s):c=g.subdirs}}return{topLevel:t,dirs:r}}function Oj({docs:i,selected:t,onSelect:r}){const{topLevel:s,dirs:l}=Ej(i),c=p=>`block w-full text-left px-3 py-1 text-xs rounded truncate transition-colors ${t===p?"bg-accent/10 text-accent":"text-text-secondary hover:bg-surface-hover"}`;function d(p,g){return y.jsxs("details",{open:!0,children:[y.jsxs("summary",{className:"flex items-center gap-1.5 px-3 py-1 text-2xs font-semibold uppercase tracking-widest text-text-tertiary cursor-pointer",children:[y.jsx(jw,{className:"w-3 h-3",strokeWidth:1.5}),p.label]}),y.jsxs("div",{className:"pl-2 space-y-0.5",children:[[...p.subdirs.values()].map(f=>d(f)),p.children.map(f=>y.jsx("button",{className:c(f.path),onClick:()=>r(f.path),children:f.title},f.path))]})]},p.label)}return y.jsxs("div",{className:"space-y-0.5",children:[s.map(p=>y.jsx("button",{className:c(p.path),onClick:()=>r(p.path),children:p.title},p.path)),[...l.values()].map(p=>d(p))]})}function Aj({open:i,onClose:t}){var re,X,L;const[r,s]=j.useState(!1),{data:l}=yj(),c=vj(),{data:d,isLoading:p}=bj(((re=c.current)==null?void 0:re.path)??null),g=j.useRef(null),[f,m]=j.useState(null);j.useEffect(()=>{f&&(d!=null&&d.content)&&g.current&&requestAnimationFrame(()=>{var W;const G=(W=g.current)==null?void 0:W.querySelector(`#${CSS.escape(f)}`);G==null||G.scrollIntoView({behavior:"smooth",block:"start"}),m(null)})},[f,d]);const b=j.useCallback(()=>{var Q;const G=_j(window.location.hash),W=(G==null?void 0:G.path)??"README.md";((Q=c.current)==null?void 0:Q.path)!==W&&c.navigate(W,g),G!=null&&G.anchor&&m(G.anchor)},[c]),v=j.useRef(!0);j.useEffect(()=>{if(!i||!c.current)return;if(v.current){v.current=!1;return}const G=wj(c.current.path);window.location.hash!==G&&window.history.replaceState(null,"",window.location.pathname+window.location.search+G)},[i,(X=c.current)==null?void 0:X.path]),j.useEffect(()=>{if(!i)return;const G=()=>{window.location.hash.startsWith("#docs")&&b()};return window.addEventListener("hashchange",G),()=>window.removeEventListener("hashchange",G)},[i,b]);const _=j.useCallback((G,W)=>{W&&m(W),c.navigate(G,g)},[c]),w=j.useCallback(G=>{c.navigate(G,g)},[c]),S=j.useCallback(()=>{c.goBack(g)},[c]),M=j.useCallback(()=>{c.goForward(g)},[c]),B=j.useCallback(()=>{c.pushScrollPosition(g)},[c]);if(j.useEffect(()=>{if(i){v.current=!0,b();const G=requestAnimationFrame(()=>s(!0));return()=>cancelAnimationFrame(G)}},[i]),!(i||r))return null;const ie=()=>{s(!1),setTimeout(()=>{t(),c.reset()},200)},ce=((L=c.current)==null?void 0:L.path)??null,C=c.backStack.length>0,z=c.forwardStack.length>0;return y.jsxs("div",{className:"fixed inset-y-0 right-0 z-50 flex",children:[y.jsx("div",{className:`fixed inset-0 bg-black/20 transition-opacity duration-200 ${r&&i?"opacity-100":"opacity-0"}`,onClick:ie}),y.jsxs("div",{className:`relative ml-auto w-[40vw] min-w-[800px] max-w-[90vw] h-full bg-surface-raised border-l border-surface-border flex flex-col shadow-xl transition-transform duration-200 ease-out ${r&&i?"translate-x-0":"translate-x-full"}`,children:[y.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border shrink-0",children:[y.jsxs("div",{className:"flex items-center gap-1",children:[y.jsx("button",{onClick:S,disabled:!C,className:`p-0.5 transition-colors ${C?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Back",children:y.jsx(sb,{className:"w-4 h-4"})}),y.jsx("button",{onClick:M,disabled:!z,className:`p-0.5 transition-colors ${z?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Forward",children:y.jsx(Kh,{className:"w-4 h-4"})}),y.jsx(ob,{className:"w-4 h-4 text-accent ml-1",strokeWidth:1.5}),y.jsx("span",{className:"text-sm font-medium text-text-primary",children:"Documentation"})]}),y.jsx("button",{onClick:ie,className:"p-1 text-text-tertiary hover:text-text-primary",children:y.jsx(Cn,{className:"w-4 h-4"})})]}),y.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[y.jsx("div",{className:"w-48 shrink-0 border-r border-surface-border overflow-y-auto py-2",children:l!=null&&l.docs?y.jsx(Oj,{docs:l.docs,selected:ce,onSelect:w}):y.jsx("div",{className:"px-3 py-2 text-xs text-text-tertiary",children:"Loading..."})}),y.jsx("div",{ref:g,className:"flex-1 overflow-y-auto px-6 py-4",children:ce?p?y.jsxs("div",{className:"animate-pulse space-y-2",children:[y.jsx("div",{className:"h-6 bg-surface-sunken rounded w-48"}),y.jsx("div",{className:"h-4 bg-surface-sunken rounded w-full"}),y.jsx("div",{className:"h-4 bg-surface-sunken rounded w-3/4"})]}):d!=null&&d.content?y.jsx(Sj,{content:d.content,currentPath:ce,onNavigate:_,onAnchorClick:B}):y.jsx("p",{className:"text-xs text-text-tertiary",children:"Document not found."}):y.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-text-tertiary",children:[y.jsx(Kh,{className:"w-5 h-5 mb-2"}),y.jsx("p",{className:"text-xs",children:"Select a document"})]})})]})]})]})}function jj(i){if(i.includes("/escalations"))return["escalation","human-queue"]}const P1=2e3;function Tj(i){const r=i.filter(l=>!l.pending).slice(-8);return r.length===0?"":`[Prior conversation]
58
+ ${b.trimEnd()}`)),r=r.replace(/`([^`]+)`/g,'<code class="bg-surface-sunken px-1 py-0.5 rounded text-2xs">$1</code>'),r=r.replace(/^#### (.+)$/gm,(y,f)=>`<h4 id="${Lc(f)}" class="text-xs font-semibold text-text-primary mt-4 mb-1">${f}</h4>`).replace(/^### (.+)$/gm,(y,f)=>`<h3 id="${Lc(f)}" class="text-sm font-semibold text-text-primary mt-5 mb-1.5">${f}</h3>`).replace(/^## (.+)$/gm,(y,f)=>`<h2 id="${Lc(f)}" class="text-base font-semibold text-text-primary mt-6 mb-2 pb-1 border-b border-surface-border">${f}</h2>`).replace(/^# (.+)$/gm,(y,f)=>`<h1 id="${Lc(f)}" class="text-lg font-bold text-text-primary mb-3">${f}</h1>`),r=r.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/\[([^\]]+)\]\(#([^)]+)\)/g,'<a data-anchor="$2" class="text-accent hover:underline cursor-pointer">$1</a>').replace(/\[([^\]]+)\]\(([^)]*\.md(?:#[^)]*)?)\)/g,'<a data-doc-link="$2" class="text-accent hover:underline cursor-pointer">$1</a>').replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" class="text-accent hover:underline">$1</a>').replace(/^ - (.+)$/gm,'<li class="ml-8 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^ - (.+)$/gm,'<li class="ml-8 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^- (.+)$/gm,'<li class="ml-4 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^\d+\. (.+)$/gm,'<li class="ml-4 list-decimal text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^---+$/gm,'<hr class="border-surface-border my-4" />').replace(/(?:^> (.+)$\n?)+/gm,y=>{const f=y.replace(/^> /gm,"").trim(),m=/⚠️|warning|caution/i.test(f),b=/note:|ℹ️|info/i.test(f);return`<div class="${m?"bg-status-warning/5":b?"bg-accent/5":"bg-surface-sunken/50"} ${m?"border-status-warning":b?"border-accent":"border-text-tertiary"} border-l-2 rounded-r-md px-3 py-2 my-3 text-xs text-text-secondary leading-relaxed">${f}</div>`}).replace(/\n\n/g,"\0PARA\0").replace(/\n/g,"<br/>");const l=y=>y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),c=y=>new RegExp(`(${l(y)}[\\s\\S]*?<\\/li>(?:<br\\/>)?)+`,"g");r=r.replace(c('<li class="ml-8 list-disc'),y=>`<ul class="mb-3">${y}</ul>`),r=r.replace(c('<li class="ml-4 list-disc'),y=>`<ul class="mb-3">${y}</ul>`),r=r.replace(c('<li class="ml-4 list-decimal'),y=>`<ol class="list-decimal mb-3">${y}</ol>`),r=r.replace(/\x00CODE(\d+)\x00/g,(y,f)=>t[parseInt(f,10)]);const d="text-xs leading-relaxed text-text-secondary mb-2",p=/<\/(h[1-4]|pre|table|ul|ol|hr|div)>/;return r=r.split("\0PARA\0").map(y=>{const f=y.trim();if(!f)return"";const m=[];let b=f,v;for(;(v=p.exec(b))!==null;){const _=v.index+v[0].length;m.push(b.slice(0,_)),b=b.slice(_).replace(/^<br\/>/,"").trim(),p.lastIndex=0}return b&&m.push(b),m.map(_=>{const w=_.trim();return w?/^\s*<(h[1-4]|pre|table|ul|ol|hr|div)/.test(w)?w:`<p class="${d}">${w}</p>`:""}).join("")}).join(""),r}const dj=/(\*\*|^#{1,4}\s|^- |^\d+\.\s|```|^\|.*\|$|\[.+\]\(.+\))/m;function mj(i){return dj.test(i)}function bu({content:i,className:t,onClick:r}){const s=j.useMemo(()=>hj(i),[i]);return g.jsx("div",{className:t,onClick:r,dangerouslySetInnerHTML:{__html:s}})}function iu({data:i,depth:t=0,generation:r}){const l=r!==void 0&&r>0&&r%2===1?!1:t>0,[c,d]=j.useState(l),[p,y]=j.useState(r);if(r!==void 0&&r!==p&&(y(r),d(r%2===0&&t>0)),i==null)return g.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof i=="string")return g.jsxs("span",{className:"text-text-primary",children:['"',i,'"']});if(typeof i=="number"||typeof i=="boolean")return g.jsx("span",{className:"text-text-primary font-medium",children:String(i)});if(Array.isArray(i))return i.length===0?g.jsx("span",{className:"text-text-tertiary",children:"[]"}):c?g.jsxs("button",{onClick:()=>d(!1),className:"text-text-secondary hover:text-text-primary",children:["[",i.length," items]"]}):g.jsxs("span",{children:[g.jsx("button",{onClick:()=>d(!0),className:"text-text-tertiary hover:text-text-primary",children:"["}),g.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:i.map((f,m)=>g.jsxs("div",{children:[g.jsx(iu,{data:f,depth:t+1,generation:r}),m<i.length-1&&g.jsx("span",{className:"text-text-tertiary",children:","})]},m))}),g.jsx("span",{className:"text-text-tertiary",children:"]"})]});if(typeof i=="object"){const f=Object.entries(i);return f.length===0?g.jsx("span",{className:"text-text-tertiary",children:"{}"}):c?g.jsxs("button",{onClick:()=>d(!1),className:"text-text-secondary hover:text-text-primary",children:["{","...","}"]}):g.jsxs("span",{children:[g.jsx("button",{onClick:()=>d(!0),className:"text-text-tertiary hover:text-text-primary",children:"{"}),g.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:f.map(([m,b],v)=>g.jsxs("div",{children:[g.jsx("span",{className:"text-text-secondary",children:m}),g.jsx("span",{className:"text-text-tertiary",children:": "}),g.jsx(iu,{data:b,depth:t+1,generation:r}),v<f.length-1&&g.jsx("span",{className:"text-text-tertiary",children:","})]},m))}),g.jsx("span",{className:"text-text-tertiary",children:"}"})]})}return g.jsx("span",{children:String(i)})}function co({data:i,depth:t=0}){if(i==null)return g.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof i=="string")return i.length>40&&mj(i)?g.jsx(bu,{content:i}):g.jsx("span",{className:"text-text-primary",children:i});if(typeof i=="number"||typeof i=="boolean")return g.jsx("span",{className:"text-text-primary font-medium",children:String(i)});if(Array.isArray(i))return i.length===0?g.jsx("span",{className:"text-text-tertiary italic",children:"empty list"}):g.jsx("div",{className:"space-y-2",children:i.map((r,s)=>g.jsxs("div",{className:"flex items-baseline gap-2",children:[g.jsxs("span",{className:"text-text-tertiary text-2xs shrink-0",children:[s+1,"."]}),g.jsx("div",{className:"flex-1",children:g.jsx(co,{data:r,depth:t+1})})]},s))});if(typeof i=="object"){const r=Object.entries(i);return r.length===0?g.jsx("span",{className:"text-text-tertiary italic",children:"empty"}):g.jsx("div",{className:t>0?"pl-4 border-l border-surface-border space-y-3":"space-y-3",children:r.map(([s,l])=>{const c=l===null||typeof l!="object";return g.jsxs("div",{children:[g.jsx("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-0.5",children:s.replace(/[_-]/g," ")}),c?g.jsx("p",{className:"text-sm text-text-primary",children:g.jsx(co,{data:l,depth:t+1})}):g.jsx(co,{data:l,depth:t+1})]},s)})})}return g.jsx("span",{children:String(i)})}function L1({mode:i,setMode:t,isCollapsed:r,onToggleCollapse:s,onCopy:l,copied:c,onFullscreen:d,onClose:p,large:y}){const f=y?"w-5 h-5":"w-3.5 h-3.5",m=`${y?"p-2":"p-1.5"} rounded text-accent/60 hover:text-accent hover:bg-surface-raised transition-colors duration-150`;return g.jsxs("div",{className:"flex items-center gap-0.5 bg-surface-sunken/80 rounded-md backdrop-blur-sm",children:[i==="json"&&g.jsx("button",{onClick:s,className:m,title:r?"Expand all":"Collapse all",children:r?g.jsx(uj,{className:f}):g.jsx(cj,{className:f})}),g.jsx("button",{onClick:()=>t(i==="json"?"tree":"json"),className:m,title:i==="json"?"Outline view":"JSON view",children:i==="json"?g.jsx(sj,{className:f}):g.jsx(aj,{className:f})}),g.jsx("button",{onClick:l,className:m,title:"Copy to clipboard",children:c?g.jsx(lj,{className:`${f} text-status-success`}):g.jsx(oj,{className:f})}),d&&g.jsx("button",{onClick:d,className:m,title:"Fullscreen",children:g.jsx(cb,{className:f})}),p&&g.jsx("button",{onClick:p,className:m,title:"Close (Esc)",children:g.jsx(ub,{className:f})})]})}function pj({data:i,label:t,variant:r,defaultCollapsed:s=!1,defaultMode:l}){const c=j.useRef(null),[d,p]=j.useState(l??"json"),[y,f]=j.useState(!1),[m,b]=j.useState(!1),[v,_]=j.useState(s?0:1),[w,S]=j.useState(1),M=v%2===0,B=w%2===0,U=j.useCallback(()=>_(G=>G+1),[]),ie=j.useCallback(()=>S(G=>G+1),[]);let ce=i;if(typeof i=="string")try{ce=JSON.parse(i)}catch{}const C=async()=>{const G=typeof i=="string"?i:JSON.stringify(ce,null,2);await navigator.clipboard.writeText(G),f(!0),setTimeout(()=>f(!1),2e3)},z=j.useCallback(()=>{S(1),b(!0)},[]),re=r==="panel",X=re?"border border-accent-muted/40 rounded-lg p-3 bg-surface-hover/30":"",L=re?"font-mono text-xs leading-relaxed bg-surface-raised rounded-md p-4 overflow-x-auto break-all":"font-mono text-xs leading-relaxed bg-surface-sunken border border-surface-border rounded-md p-4 overflow-x-auto break-all";return g.jsxs("div",{className:X,children:[t&&g.jsx(rj,{children:t}),g.jsxs("div",{ref:c,className:"relative",children:[g.jsx("div",{className:"absolute top-2 right-2 z-[5]",children:g.jsx(L1,{mode:d,setMode:p,isCollapsed:M,onToggleCollapse:U,onCopy:C,copied:y,onFullscreen:z})}),g.jsx("div",{className:L,children:d==="json"?g.jsx(iu,{data:ce,generation:v}):g.jsx(co,{data:ce})})]}),g.jsxs(Cv,{open:m,onClose:()=>b(!1),sourceRef:c,children:[g.jsx("div",{className:"sticky top-0 float-right z-10",children:g.jsx(L1,{mode:d,setMode:p,isCollapsed:B,onToggleCollapse:ie,onCopy:C,copied:y,onClose:()=>b(!1),large:!0})}),g.jsx("div",{className:"font-mono text-sm leading-relaxed",children:d==="json"?g.jsx(iu,{data:ce,generation:w}):g.jsx(co,{data:ce})})]})]})}const gj=100,z1=500;let yj=0;const Mv={"escalation.created":"text-status-active","escalation.claimed":"text-status-warning","escalation.released":"text-text-tertiary","escalation.resolved":"text-status-success","task.created":"text-accent","task.completed":"text-status-success","task.failed":"text-status-error","task.escalated":"text-status-warning","workflow.started":"text-accent","workflow.completed":"text-status-success","workflow.failed":"text-status-error","activity.started":"text-status-active","activity.completed":"text-status-success","activity.failed":"text-status-error","knowledge.stored":"text-accent","knowledge.deleted":"text-text-tertiary","agent.started":"text-accent","agent.completed":"text-status-success","agent.failed":"text-status-error","agent.status_changed":"text-status-active",milestone:"text-accent"};function Rv(i){const t=i.split(".");return t[0]==="system"&&t.length>=3?`${t[1]}.${t[t.length-1]}`:i}function U1({event:i,forceExpanded:t=!1}){var v,_;const[r,s]=j.useState(t),l=Mv[Rv(i.type)]||"text-text-tertiary";j.useEffect(()=>{s(t)},[t]);const c=t,d=c?"text-xs":"text-2xs",p=c?"text-xs":"text-2xs",y=c?"text-xs":"text-2xs",f=c?"w-3.5 h-3.5":"w-2.5 h-2.5",m=c?"py-2 px-4":"py-1 px-3",b=c?"pb-4 px-4":"pb-2 px-3";return g.jsxs("div",{className:"border-b border-surface-border/30 last:border-b-0",children:[g.jsxs("button",{onClick:()=>s(!r),className:`flex items-center gap-2 ${m} w-full text-left hover:bg-surface-hover/50 transition-colors`,children:[g.jsx("span",{className:`${d} font-mono text-text-tertiary whitespace-nowrap tabular-nums shrink-0`,children:new Date(i.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}),g.jsx("span",{className:`${p} font-medium px-1 py-0.5 rounded ${l} bg-surface-sunken whitespace-nowrap shrink-0`,children:i.type}),g.jsxs("span",{className:`${y} text-text-tertiary font-mono flex-1 min-w-0 truncate`,children:[(v=i.data)!=null&&v.workflowId?String(i.data.workflowId):"",(_=i.data)!=null&&_.escalationId?` esc:${String(i.data.escalationId).slice(0,12)}`:""]}),g.jsx("svg",{className:`${f} text-text-tertiary shrink-0 transition-transform duration-150 ${r?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),g.jsx(Xd,{open:r,children:g.jsx("div",{className:b,children:g.jsx(pj,{data:i.data})})})]})}function bj({open:i,onToggle:t,configOpen:r,onToggleConfig:s}){const[l,c]=j.useState([]),[d,p]=j.useState(!1),[y,f]=j.useState(""),m=j.useRef(null),b=j.useRef(new Map),{subscribe:v}=j.useContext(Ks),{patterns:_,pagePattern:w,userPatterns:S,addPattern:M,removePattern:B}=nj(),U=j.useCallback(C=>{const z=String(C.type||"unknown");if(z.startsWith("mesh."))return;const re=`${z}:${C.timestamp||""}:${C.escalationId||C.workflowId||C.taskId||""}`,X=Date.now(),L=b.current.get(re);if(!(L&&X-L<z1)){if(b.current.set(re,X),b.current.size>200)for(const[G,W]of b.current)X-W>z1*2&&b.current.delete(G);c(G=>[{id:++yj,type:z,timestamp:C.timestamp||new Date().toISOString(),data:C},...G].slice(0,gj))}},[]),ie=j.useRef(U);ie.current=U;const ce=i||d||r;return j.useEffect(()=>{if(!ce)return;const C=_.map(z=>v(z,re=>ie.current(re)));return()=>C.forEach(z=>z())},[v,_.join(","),ce]),j.useEffect(()=>{i&&m.current&&(m.current.scrollTop=0)},[l.length,i]),g.jsxs("div",{className:"shrink-0 border-t border-surface-border bg-surface-raised",children:[g.jsxs("button",{onClick:t,className:"flex items-center gap-2 w-full px-4 py-1.5 text-left hover:bg-surface-hover transition-colors",children:[i?g.jsx(fb,{className:"w-3 h-3 text-text-tertiary"}):g.jsx(hb,{className:"w-3 h-3 text-text-tertiary"}),g.jsx("span",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary",children:"Event Stream"}),l.length>0&&g.jsxs("span",{className:"text-2xs text-text-tertiary",children:[l.length," events"]}),l.length>0&&!i&&g.jsx("span",{className:`text-2xs font-medium px-1 py-0.5 rounded ${Mv[Rv(l[0].type)]||"text-text-tertiary"} bg-surface-sunken`,children:l[0].type}),g.jsxs("span",{className:"ml-auto flex items-center gap-1",children:[g.jsx("span",{className:`p-0.5 cursor-pointer ${r?"text-accent":"text-text-tertiary hover:text-text-primary"}`,title:"Subscription config",onClick:C=>{C.stopPropagation(),s()},children:g.jsx(jw,{className:"w-3 h-3"})}),l.length>0&&g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"text-text-tertiary hover:text-text-primary p-0.5 cursor-pointer",title:"Fullscreen",onClick:C=>{C.stopPropagation(),p(!0)},children:g.jsx(cb,{className:"w-3 h-3"})}),g.jsx("span",{className:"text-text-tertiary hover:text-text-primary p-0.5 cursor-pointer",title:"Clear events",onClick:C=>{C.stopPropagation(),c([])},children:g.jsx(Tw,{className:"w-3 h-3"})})]})]})]}),r&&g.jsxs("div",{className:"px-4 py-2 border-t border-surface-border/50 bg-surface-sunken/30",children:[g.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 mb-1.5",children:[g.jsx("span",{className:"text-2xs text-text-quaternary uppercase tracking-wider shrink-0",children:"Subscribed:"}),g.jsx("span",{className:"text-2xs font-mono text-accent px-1.5 py-0.5 bg-accent/10 rounded",children:w.replace("lt.events.","")}),S.map(C=>g.jsxs("span",{className:"inline-flex items-center gap-1 text-2xs font-mono text-text-secondary px-1.5 py-0.5 bg-surface-sunken rounded",children:[C.replace("lt.events.",""),g.jsx("button",{onClick:()=>B(C),className:"text-text-quaternary hover:text-status-error",children:g.jsx(dn,{className:"w-2 h-2"})})]},C))]}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("input",{type:"text",value:y,onChange:C=>f(C.target.value),onKeyDown:C=>{C.key==="Enter"&&y.trim()&&(M(y.trim()),f(""))},placeholder:"task.> or file.stored",className:"input text-2xs font-mono flex-1 py-1"}),g.jsxs("button",{onClick:()=>{y.trim()&&(M(y.trim()),f(""))},className:"text-2xs text-accent hover:text-accent-hover flex items-center gap-0.5",children:[g.jsx(lb,{className:"w-2.5 h-2.5"})," Add"]})]})]}),g.jsx(Xd,{open:i,children:g.jsx("div",{ref:m,className:"h-48 overflow-y-auto",children:l.length===0?g.jsx("p",{className:"text-2xs text-text-tertiary py-4 text-center",children:"Waiting for events..."}):l.map(C=>g.jsx(U1,{event:C},C.id))})}),g.jsxs(Cv,{open:d,onClose:()=>p(!1),sourceRef:m,children:[g.jsx("div",{className:"sticky top-0 float-right z-10",children:g.jsx("button",{onClick:()=>p(!1),className:"p-2 rounded text-text-tertiary hover:text-text-primary hover:bg-surface-raised transition-colors duration-150 bg-surface-sunken/80 backdrop-blur-sm",title:"Close (Esc)",children:g.jsx(ub,{className:"w-5 h-5"})})}),l.length===0?g.jsx("p",{className:"text-sm text-text-tertiary py-8",children:"No events captured"}):l.map(C=>g.jsx(U1,{event:C,forceExpanded:!0},C.id))]})]})}function vj(){return ft({queryKey:["docs"],queryFn:()=>Oe("/docs"),staleTime:5*6e4})}function xj(i){return ft({queryKey:["docs",i],queryFn:()=>Oe(`/docs/read?path=${encodeURIComponent(i)}`),enabled:!!i,staleTime:5*6e4})}function _j(){const[i,t]=j.useState([]),[r,s]=j.useState([]),[l,c]=j.useState(null),d=j.useRef(l),p=j.useRef(i),y=j.useRef(r);d.current=l,p.current=i,y.current=r;const f=j.useCallback((w,S)=>{var B;const M=d.current;if(M){const U=((B=S==null?void 0:S.current)==null?void 0:B.scrollTop)??0;t([...p.current,{...M,scrollTop:U}])}s([]),c({path:w,scrollTop:0})},[]),m=j.useCallback(w=>{var U;const S=p.current;if(S.length===0)return;const M=S[S.length-1],B=d.current;if(B){const ie=((U=w==null?void 0:w.current)==null?void 0:U.scrollTop)??0;s([...y.current,{...B,scrollTop:ie}])}t(S.slice(0,-1)),c(M),requestAnimationFrame(()=>{w!=null&&w.current&&(w.current.scrollTop=M.scrollTop)})},[]),b=j.useCallback(w=>{var U;const S=y.current;if(S.length===0)return;const M=S[S.length-1],B=d.current;if(B){const ie=((U=w==null?void 0:w.current)==null?void 0:U.scrollTop)??0;t([...p.current,{...B,scrollTop:ie}])}s(S.slice(0,-1)),c(M),requestAnimationFrame(()=>{w!=null&&w.current&&(w.current.scrollTop=M.scrollTop)})},[]),v=j.useCallback(w=>{var B,U;const S=d.current;if(!S)return;const M=((B=w==null?void 0:w.current)==null?void 0:B.scrollTop)??0;t([...p.current,{...S,scrollTop:M}]),s([]),c({...S,scrollTop:((U=w==null?void 0:w.current)==null?void 0:U.scrollTop)??0})},[]),_=j.useCallback(()=>{t([]),s([]),c(null)},[]);return{current:l,backStack:i,forwardStack:r,navigate:f,goBack:m,goForward:b,pushScrollPosition:v,reset:_}}function wj(i,t){const[r,s]=i.split("#");let l=r;if(l.startsWith("./")||l.startsWith("../")){const d=((t?t.replace(/[^/]+$/,""):"")+l).split("/"),p=[];for(const y of d)y===".."?p.pop():y&&y!=="."&&p.push(y);l=p.join("/")}return{path:l,anchor:s}}function Sj(i){if(!i.startsWith("#docs"))return null;const t=i.slice(1).split(":"),r=t[1]||"README.md",s=t[2]||void 0;return{path:r,anchor:s}}function Ej(i){return!i||i==="README.md"?"#docs":`#docs:${i}`}function Oj({content:i,currentPath:t,onNavigate:r,onAnchorClick:s}){const l=c=>{var f;const d=c.target,p=d.closest("[data-anchor]");if(p){c.preventDefault(),s();const m=p.dataset.anchor,b=(f=p.closest(".docs-content"))==null?void 0:f.querySelector(`#${CSS.escape(m)}`);b==null||b.scrollIntoView({behavior:"smooth",block:"start"});return}const y=d.closest("[data-doc-link]");if(y){c.preventDefault();const{path:m,anchor:b}=wj(y.dataset.docLink,t);r(m,b);return}};return g.jsx(bu,{content:i,className:"docs-content",onClick:l})}function Aj(i){const t=[],r=new Map;for(const s of i){const l=s.path.split("/");if(l.length===1){t.push(s);continue}let c=r;for(let d=0;d<l.length-1;d++){const p=l[d];c.has(p)||c.set(p,{label:p,children:[],subdirs:new Map});const y=c.get(p);d===l.length-2?y.children.push(s):c=y.subdirs}}return{topLevel:t,dirs:r}}function jj({docs:i,selected:t,onSelect:r}){const{topLevel:s,dirs:l}=Aj(i),c=p=>`block w-full text-left px-3 py-1 text-xs rounded truncate transition-colors ${t===p?"bg-accent/10 text-accent":"text-text-secondary hover:bg-surface-hover"}`;function d(p,y){return g.jsxs("details",{open:!0,children:[g.jsxs("summary",{className:"flex items-center gap-1.5 px-3 py-1 text-2xs font-semibold uppercase tracking-widest text-text-tertiary cursor-pointer",children:[g.jsx(Nw,{className:"w-3 h-3",strokeWidth:1.5}),p.label]}),g.jsxs("div",{className:"pl-2 space-y-0.5",children:[[...p.subdirs.values()].map(f=>d(f)),p.children.map(f=>g.jsx("button",{className:c(f.path),onClick:()=>r(f.path),children:f.title},f.path))]})]},p.label)}return g.jsxs("div",{className:"space-y-0.5",children:[s.map(p=>g.jsx("button",{className:c(p.path),onClick:()=>r(p.path),children:p.title},p.path)),[...l.values()].map(p=>d(p))]})}function Tj({open:i,onClose:t}){var re,X,L;const[r,s]=j.useState(!1),{data:l}=vj(),c=_j(),{data:d,isLoading:p}=xj(((re=c.current)==null?void 0:re.path)??null),y=j.useRef(null),[f,m]=j.useState(null);j.useEffect(()=>{f&&(d!=null&&d.content)&&y.current&&requestAnimationFrame(()=>{var W;const G=(W=y.current)==null?void 0:W.querySelector(`#${CSS.escape(f)}`);G==null||G.scrollIntoView({behavior:"smooth",block:"start"}),m(null)})},[f,d]);const b=j.useCallback(()=>{var Q;const G=Sj(window.location.hash),W=(G==null?void 0:G.path)??"README.md";((Q=c.current)==null?void 0:Q.path)!==W&&c.navigate(W,y),G!=null&&G.anchor&&m(G.anchor)},[c]),v=j.useRef(!0);j.useEffect(()=>{if(!i||!c.current)return;if(v.current){v.current=!1;return}const G=Ej(c.current.path);window.location.hash!==G&&window.history.replaceState(null,"",window.location.pathname+window.location.search+G)},[i,(X=c.current)==null?void 0:X.path]),j.useEffect(()=>{if(!i)return;const G=()=>{window.location.hash.startsWith("#docs")&&b()};return window.addEventListener("hashchange",G),()=>window.removeEventListener("hashchange",G)},[i,b]);const _=j.useCallback((G,W)=>{W&&m(W),c.navigate(G,y)},[c]),w=j.useCallback(G=>{c.navigate(G,y)},[c]),S=j.useCallback(()=>{c.goBack(y)},[c]),M=j.useCallback(()=>{c.goForward(y)},[c]),B=j.useCallback(()=>{c.pushScrollPosition(y)},[c]);if(j.useEffect(()=>{if(i){v.current=!0,b();const G=requestAnimationFrame(()=>s(!0));return()=>cancelAnimationFrame(G)}},[i]),!(i||r))return null;const ie=()=>{s(!1),setTimeout(()=>{t(),c.reset()},200)},ce=((L=c.current)==null?void 0:L.path)??null,C=c.backStack.length>0,z=c.forwardStack.length>0;return g.jsxs("div",{className:"fixed inset-y-0 right-0 z-50 flex",children:[g.jsx("div",{className:`fixed inset-0 bg-black/20 transition-opacity duration-200 ${r&&i?"opacity-100":"opacity-0"}`,onClick:ie}),g.jsxs("div",{className:`relative ml-auto w-[40vw] min-w-[800px] max-w-[90vw] h-full bg-surface-raised border-l border-surface-border flex flex-col shadow-xl transition-transform duration-200 ease-out ${r&&i?"translate-x-0":"translate-x-full"}`,children:[g.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border shrink-0",children:[g.jsxs("div",{className:"flex items-center gap-1",children:[g.jsx("button",{onClick:S,disabled:!C,className:`p-0.5 transition-colors ${C?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Back",children:g.jsx(sb,{className:"w-4 h-4"})}),g.jsx("button",{onClick:M,disabled:!z,className:`p-0.5 transition-colors ${z?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Forward",children:g.jsx(Xh,{className:"w-4 h-4"})}),g.jsx(ob,{className:"w-4 h-4 text-accent ml-1",strokeWidth:1.5}),g.jsx("span",{className:"text-sm font-medium text-text-primary",children:"Documentation"})]}),g.jsx("button",{onClick:ie,className:"p-1 text-text-tertiary hover:text-text-primary",children:g.jsx(dn,{className:"w-4 h-4"})})]}),g.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[g.jsx("div",{className:"w-48 shrink-0 border-r border-surface-border overflow-y-auto py-2",children:l!=null&&l.docs?g.jsx(jj,{docs:l.docs,selected:ce,onSelect:w}):g.jsx("div",{className:"px-3 py-2 text-xs text-text-tertiary",children:"Loading..."})}),g.jsx("div",{ref:y,className:"flex-1 overflow-y-auto px-6 py-4",children:ce?p?g.jsxs("div",{className:"animate-pulse space-y-2",children:[g.jsx("div",{className:"h-6 bg-surface-sunken rounded w-48"}),g.jsx("div",{className:"h-4 bg-surface-sunken rounded w-full"}),g.jsx("div",{className:"h-4 bg-surface-sunken rounded w-3/4"})]}):d!=null&&d.content?g.jsx(Oj,{content:d.content,currentPath:ce,onNavigate:_,onAnchorClick:B}):g.jsx("p",{className:"text-xs text-text-tertiary",children:"Document not found."}):g.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-text-tertiary",children:[g.jsx(Xh,{className:"w-5 h-5 mb-2"}),g.jsx("p",{className:"text-xs",children:"Select a document"})]})})]})]})]})}function Nj(i){if(i.includes("/escalations"))return["escalation","human-queue"]}const P1=2e3;function kj(i){const r=i.filter(l=>!l.pending).slice(-8);return r.length===0?"":`[Prior conversation]
59
59
  ${r.map(l=>`${l.role==="user"?"User":"Assistant"}: ${l.content}`).join(`
60
60
  `)}
61
61
  [End prior conversation]
62
62
 
63
- `}function Nj(i){const t=i.summary,r=i.title;if(t){const s=t.search(/\n\s*\{[\s\S]*"title"\s*:/);return s>0?t.slice(0,s).trim():t}return r||(typeof i=="string"?i:"Query completed.")}const Cv=j.createContext(null);function kj({children:i}){const t=pn(),[r,s]=j.useState(!1),[l,c]=j.useState([]),[d,p]=j.useState(null),[g,f]=j.useState({}),m=j.useRef(null),b={page:t.pathname.split("/").filter(Boolean).join("-")||"home",route:t.pathname,params:{},...g,suggestedTags:g.suggestedTags??jj(t.pathname)};j.useEffect(()=>()=>{m.current&&clearInterval(m.current)},[]);const v=j.useCallback(()=>s(B=>!B),[]),_=j.useCallback(B=>{f(B)},[]),w=j.useCallback(()=>{c([]),p(null)},[]),S=j.useCallback(async B=>{var X;const U=new Date().toISOString(),ie={id:`user-${Date.now()}`,role:"user",content:B,timestamp:U},ce={id:`pending-${Date.now()}`,role:"assistant",content:"",timestamp:U,pending:!0};c(L=>[...L,ie,ce]);const C={...b};(X=C.entities)!=null&&X.yamlContent&&C.entities.yamlContent.length>P1&&(C.entities={...C.entities,yamlContent:C.entities.yamlContent.slice(0,P1)+`
64
- ... (truncated)`});const re=`${Tj(l.concat(ie))}${B}`;try{const G=(await Ae("/insight/mcp-query",{method:"POST",body:JSON.stringify({prompt:re,tags:C.suggestedTags,context:C,wait:!1,direct:!0})})).workflow_id;p(G),c(W=>W.map(Q=>Q.id===ce.id?{...Q,workflowId:G}:Q)),m.current&&clearInterval(m.current),m.current=setInterval(async()=>{var W;try{const Q=await Ae(`/workflows/${G}/result`),he=(W=Q==null?void 0:Q.result)==null?void 0:W.data;if(he){m.current&&clearInterval(m.current),m.current=null,p(null);const _e=Nj(he);let Te;try{Te=(await Ae(`/workflow-states/${G}/execution`)).duration_ms}catch{}c(Y=>Y.map(ae=>ae.id===ce.id?{...ae,content:_e,timestamp:new Date().toISOString(),pending:!1,durationMs:Te}:ae))}}catch{}},3e3)}catch{c(L=>L.map(G=>G.id===ce.id?{...G,content:"Failed to submit query. Please try again.",pending:!1}:G))}},[l,b]),M=j.useCallback(async B=>{const U=l.find(C=>C.id===B);if(!(U!=null&&U.workflowId)||U.compilationStatus==="compiling"||U.compilationStatus==="done")return;const ie=l.indexOf(U),ce=l.slice(0,ie).reverse().find(C=>C.role==="user");if(ce){c(C=>C.map(z=>z.id===B?{...z,compilationStatus:"compiling"}:z));try{const C=await Ae("/insight/mcp-query/describe",{method:"POST",body:JSON.stringify({prompt:ce.content,summary:U.content})}),z=await Ae("/yaml-workflows",{method:"POST",body:JSON.stringify({workflow_id:U.workflowId,task_queue:"long-tail-system",workflow_name:"mcpQuery",name:C.tool_name,description:C.description,tags:C.tags,app_id:""})});await Ae(`/yaml-workflows/${z.id}/deploy`,{method:"POST"}),c(re=>re.map(X=>X.id===B?{...X,compilationStatus:"done"}:X))}catch(C){const z=C instanceof Error?C.message:"Compilation failed";c(re=>re.map(X=>X.id===B?{...X,compilationStatus:"error",compilationError:z}:X))}}},[l]);return y.jsx(Cv.Provider,{value:{helpOpen:r,setHelpOpen:s,toggleHelp:v,messages:l,sendMessage:S,pageContext:b,setPageContext:_,activeWorkflowId:d,clearMessages:w,compileMessage:M},children:i})}function Mv(){const i=j.useContext(Cv);if(!i)throw new Error("useHelpAssistant must be used within HelpAssistantProvider");return i}function Cj(){const{helpOpen:i,toggleHelp:t}=Mv();return y.jsx("button",{onClick:t,className:"fixed right-3 z-[45] flex items-center justify-center w-10 h-10 rounded-full bg-surface-raised shadow-lg hover:scale-110 transition-transform duration-150 border border-accent/30",style:{bottom:"44px"},"aria-label":i?"Close help":"Ask for help",children:i?y.jsx(Cn,{className:"w-5 h-5 text-text-tertiary",strokeWidth:1.5}):y.jsx("span",{role:"img","aria-label":"Help",className:"logo-mark w-8 h-8 -rotate-[120deg]",style:{"--logo-url":`url(${jt}/logo512.png)`}})})}const Rv=6048e5,Mj=864e5,I1=6e4,$1=525600,H1=43200,G1=1440,F1=Symbol.for("constructDateFrom");function Or(i,t){return typeof i=="function"?i(t):i&&typeof i=="object"&&F1 in i?i[F1](t):i instanceof Date?new i.constructor(t):new Date(t)}function mn(i,t){return Or(t||i,i)}let Rj={};function So(){return Rj}function po(i,t){var p,g,f,m;const r=So(),s=(t==null?void 0:t.weekStartsOn)??((g=(p=t==null?void 0:t.locale)==null?void 0:p.options)==null?void 0:g.weekStartsOn)??r.weekStartsOn??((m=(f=r.locale)==null?void 0:f.options)==null?void 0:m.weekStartsOn)??0,l=mn(i,t==null?void 0:t.in),c=l.getDay(),d=(c<s?7:0)+c-s;return l.setDate(l.getDate()-d),l.setHours(0,0,0,0),l}function su(i,t){return po(i,{...t,weekStartsOn:1})}function Dv(i,t){const r=mn(i,t==null?void 0:t.in),s=r.getFullYear(),l=Or(r,0);l.setFullYear(s+1,0,4),l.setHours(0,0,0,0);const c=su(l),d=Or(r,0);d.setFullYear(s,0,4),d.setHours(0,0,0,0);const p=su(d);return r.getTime()>=c.getTime()?s+1:r.getTime()>=p.getTime()?s:s-1}function au(i){const t=mn(i),r=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return r.setUTCFullYear(t.getFullYear()),+i-+r}function qv(i,...t){const r=Or.bind(null,i||t.find(s=>typeof s=="object"));return t.map(r)}function V1(i,t){const r=mn(i,t==null?void 0:t.in);return r.setHours(0,0,0,0),r}function Dj(i,t,r){const[s,l]=qv(r==null?void 0:r.in,i,t),c=V1(s),d=V1(l),p=+c-au(c),g=+d-au(d);return Math.round((p-g)/Mj)}function qj(i,t){const r=Dv(i,t),s=Or(i,0);return s.setFullYear(r,0,4),s.setHours(0,0,0,0),su(s)}function Bj(i,t){const r=+mn(i)-+mn(t);return r<0?-1:r>0?1:r}function Lj(i){return Or(i,Date.now())}function zj(i){return i instanceof Date||typeof i=="object"&&Object.prototype.toString.call(i)==="[object Date]"}function Uj(i){return!(!zj(i)&&typeof i!="number"||isNaN(+mn(i)))}function Pj(i){return t=>{const s=(i?Math[i]:Math.trunc)(t);return s===0?0:s}}function Ij(i,t){const r=mn(i,t==null?void 0:t.in);return r.setFullYear(r.getFullYear(),0,1),r.setHours(0,0,0,0),r}const $j={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"}},Hj=(i,t,r)=>{let s;const l=$j[i];return typeof l=="string"?s=l:t===1?s=l.one:s=l.other.replace("{{count}}",t.toString()),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"in "+s:s+" ago":s};function Yh(i){return(t={})=>{const r=t.width?String(t.width):i.defaultWidth;return i.formats[r]||i.formats[i.defaultWidth]}}const Gj={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Fj={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Vj={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Yj={date:Yh({formats:Gj,defaultWidth:"full"}),time:Yh({formats:Fj,defaultWidth:"full"}),dateTime:Yh({formats:Vj,defaultWidth:"full"})},Kj={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Xj=(i,t,r,s)=>Kj[i];function eo(i){return(t,r)=>{const s=r!=null&&r.context?String(r.context):"standalone";let l;if(s==="formatting"&&i.formattingValues){const d=i.defaultFormattingWidth||i.defaultWidth,p=r!=null&&r.width?String(r.width):d;l=i.formattingValues[p]||i.formattingValues[d]}else{const d=i.defaultWidth,p=r!=null&&r.width?String(r.width):i.defaultWidth;l=i.values[p]||i.values[d]}const c=i.argumentCallback?i.argumentCallback(t):t;return l[c]}}const Jj={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Qj={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Zj={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"]},Wj={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"]},eT={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"}},tT={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"}},nT=(i,t)=>{const r=Number(i),s=r%100;if(s>20||s<10)switch(s%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},rT={ordinalNumber:nT,era:eo({values:Jj,defaultWidth:"wide"}),quarter:eo({values:Qj,defaultWidth:"wide",argumentCallback:i=>i-1}),month:eo({values:Zj,defaultWidth:"wide"}),day:eo({values:Wj,defaultWidth:"wide"}),dayPeriod:eo({values:eT,defaultWidth:"wide",formattingValues:tT,defaultFormattingWidth:"wide"})};function to(i){return(t,r={})=>{const s=r.width,l=s&&i.matchPatterns[s]||i.matchPatterns[i.defaultMatchWidth],c=t.match(l);if(!c)return null;const d=c[0],p=s&&i.parsePatterns[s]||i.parsePatterns[i.defaultParseWidth],g=Array.isArray(p)?sT(p,b=>b.test(d)):iT(p,b=>b.test(d));let f;f=i.valueCallback?i.valueCallback(g):g,f=r.valueCallback?r.valueCallback(f):f;const m=t.slice(d.length);return{value:f,rest:m}}}function iT(i,t){for(const r in i)if(Object.prototype.hasOwnProperty.call(i,r)&&t(i[r]))return r}function sT(i,t){for(let r=0;r<i.length;r++)if(t(i[r]))return r}function aT(i){return(t,r={})=>{const s=t.match(i.matchPattern);if(!s)return null;const l=s[0],c=t.match(i.parsePattern);if(!c)return null;let d=i.valueCallback?i.valueCallback(c[0]):c[0];d=r.valueCallback?r.valueCallback(d):d;const p=t.slice(l.length);return{value:d,rest:p}}}const oT=/^(\d+)(th|st|nd|rd)?/i,lT=/\d+/i,cT={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},uT={any:[/^b/i,/^(a|c)/i]},fT={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},hT={any:[/1/i,/2/i,/3/i,/4/i]},dT={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},mT={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]},pT={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},gT={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]},yT={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},bT={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}},vT={ordinalNumber:aT({matchPattern:oT,parsePattern:lT,valueCallback:i=>parseInt(i,10)}),era:to({matchPatterns:cT,defaultMatchWidth:"wide",parsePatterns:uT,defaultParseWidth:"any"}),quarter:to({matchPatterns:fT,defaultMatchWidth:"wide",parsePatterns:hT,defaultParseWidth:"any",valueCallback:i=>i+1}),month:to({matchPatterns:dT,defaultMatchWidth:"wide",parsePatterns:mT,defaultParseWidth:"any"}),day:to({matchPatterns:pT,defaultMatchWidth:"wide",parsePatterns:gT,defaultParseWidth:"any"}),dayPeriod:to({matchPatterns:yT,defaultMatchWidth:"any",parsePatterns:bT,defaultParseWidth:"any"})},Bv={code:"en-US",formatDistance:Hj,formatLong:Yj,formatRelative:Xj,localize:rT,match:vT,options:{weekStartsOn:0,firstWeekContainsDate:1}};function xT(i,t){const r=mn(i,t==null?void 0:t.in);return Dj(r,Ij(r))+1}function _T(i,t){const r=mn(i,t==null?void 0:t.in),s=+su(r)-+qj(r);return Math.round(s/Rv)+1}function Lv(i,t){var m,b,v,_;const r=mn(i,t==null?void 0:t.in),s=r.getFullYear(),l=So(),c=(t==null?void 0:t.firstWeekContainsDate)??((b=(m=t==null?void 0:t.locale)==null?void 0:m.options)==null?void 0:b.firstWeekContainsDate)??l.firstWeekContainsDate??((_=(v=l.locale)==null?void 0:v.options)==null?void 0:_.firstWeekContainsDate)??1,d=Or((t==null?void 0:t.in)||i,0);d.setFullYear(s+1,0,c),d.setHours(0,0,0,0);const p=po(d,t),g=Or((t==null?void 0:t.in)||i,0);g.setFullYear(s,0,c),g.setHours(0,0,0,0);const f=po(g,t);return+r>=+p?s+1:+r>=+f?s:s-1}function wT(i,t){var p,g,f,m;const r=So(),s=(t==null?void 0:t.firstWeekContainsDate)??((g=(p=t==null?void 0:t.locale)==null?void 0:p.options)==null?void 0:g.firstWeekContainsDate)??r.firstWeekContainsDate??((m=(f=r.locale)==null?void 0:f.options)==null?void 0:m.firstWeekContainsDate)??1,l=Lv(i,t),c=Or((t==null?void 0:t.in)||i,0);return c.setFullYear(l,0,s),c.setHours(0,0,0,0),po(c,t)}function ST(i,t){const r=mn(i,t==null?void 0:t.in),s=+po(r,t)-+wT(r,t);return Math.round(s/Rv)+1}function Ye(i,t){const r=i<0?"-":"",s=Math.abs(i).toString().padStart(t,"0");return r+s}const ii={y(i,t){const r=i.getFullYear(),s=r>0?r:1-r;return Ye(t==="yy"?s%100:s,t.length)},M(i,t){const r=i.getMonth();return t==="M"?String(r+1):Ye(r+1,2)},d(i,t){return Ye(i.getDate(),t.length)},a(i,t){const r=i.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];case"aaaa":default:return r==="am"?"a.m.":"p.m."}},h(i,t){return Ye(i.getHours()%12||12,t.length)},H(i,t){return Ye(i.getHours(),t.length)},m(i,t){return Ye(i.getMinutes(),t.length)},s(i,t){return Ye(i.getSeconds(),t.length)},S(i,t){const r=t.length,s=i.getMilliseconds(),l=Math.trunc(s*Math.pow(10,r-3));return Ye(l,t.length)}},qs={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Y1={G:function(i,t,r){const s=i.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return r.era(s,{width:"abbreviated"});case"GGGGG":return r.era(s,{width:"narrow"});case"GGGG":default:return r.era(s,{width:"wide"})}},y:function(i,t,r){if(t==="yo"){const s=i.getFullYear(),l=s>0?s:1-s;return r.ordinalNumber(l,{unit:"year"})}return ii.y(i,t)},Y:function(i,t,r,s){const l=Lv(i,s),c=l>0?l:1-l;if(t==="YY"){const d=c%100;return Ye(d,2)}return t==="Yo"?r.ordinalNumber(c,{unit:"year"}):Ye(c,t.length)},R:function(i,t){const r=Dv(i);return Ye(r,t.length)},u:function(i,t){const r=i.getFullYear();return Ye(r,t.length)},Q:function(i,t,r){const s=Math.ceil((i.getMonth()+1)/3);switch(t){case"Q":return String(s);case"QQ":return Ye(s,2);case"Qo":return r.ordinalNumber(s,{unit:"quarter"});case"QQQ":return r.quarter(s,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(s,{width:"narrow",context:"formatting"});case"QQQQ":default:return r.quarter(s,{width:"wide",context:"formatting"})}},q:function(i,t,r){const s=Math.ceil((i.getMonth()+1)/3);switch(t){case"q":return String(s);case"qq":return Ye(s,2);case"qo":return r.ordinalNumber(s,{unit:"quarter"});case"qqq":return r.quarter(s,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(s,{width:"narrow",context:"standalone"});case"qqqq":default:return r.quarter(s,{width:"wide",context:"standalone"})}},M:function(i,t,r){const s=i.getMonth();switch(t){case"M":case"MM":return ii.M(i,t);case"Mo":return r.ordinalNumber(s+1,{unit:"month"});case"MMM":return r.month(s,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(s,{width:"narrow",context:"formatting"});case"MMMM":default:return r.month(s,{width:"wide",context:"formatting"})}},L:function(i,t,r){const s=i.getMonth();switch(t){case"L":return String(s+1);case"LL":return Ye(s+1,2);case"Lo":return r.ordinalNumber(s+1,{unit:"month"});case"LLL":return r.month(s,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(s,{width:"narrow",context:"standalone"});case"LLLL":default:return r.month(s,{width:"wide",context:"standalone"})}},w:function(i,t,r,s){const l=ST(i,s);return t==="wo"?r.ordinalNumber(l,{unit:"week"}):Ye(l,t.length)},I:function(i,t,r){const s=_T(i);return t==="Io"?r.ordinalNumber(s,{unit:"week"}):Ye(s,t.length)},d:function(i,t,r){return t==="do"?r.ordinalNumber(i.getDate(),{unit:"date"}):ii.d(i,t)},D:function(i,t,r){const s=xT(i);return t==="Do"?r.ordinalNumber(s,{unit:"dayOfYear"}):Ye(s,t.length)},E:function(i,t,r){const s=i.getDay();switch(t){case"E":case"EE":case"EEE":return r.day(s,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(s,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(s,{width:"short",context:"formatting"});case"EEEE":default:return r.day(s,{width:"wide",context:"formatting"})}},e:function(i,t,r,s){const l=i.getDay(),c=(l-s.weekStartsOn+8)%7||7;switch(t){case"e":return String(c);case"ee":return Ye(c,2);case"eo":return r.ordinalNumber(c,{unit:"day"});case"eee":return r.day(l,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(l,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(l,{width:"short",context:"formatting"});case"eeee":default:return r.day(l,{width:"wide",context:"formatting"})}},c:function(i,t,r,s){const l=i.getDay(),c=(l-s.weekStartsOn+8)%7||7;switch(t){case"c":return String(c);case"cc":return Ye(c,t.length);case"co":return r.ordinalNumber(c,{unit:"day"});case"ccc":return r.day(l,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(l,{width:"narrow",context:"standalone"});case"cccccc":return r.day(l,{width:"short",context:"standalone"});case"cccc":default:return r.day(l,{width:"wide",context:"standalone"})}},i:function(i,t,r){const s=i.getDay(),l=s===0?7:s;switch(t){case"i":return String(l);case"ii":return Ye(l,t.length);case"io":return r.ordinalNumber(l,{unit:"day"});case"iii":return r.day(s,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(s,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(s,{width:"short",context:"formatting"});case"iiii":default:return r.day(s,{width:"wide",context:"formatting"})}},a:function(i,t,r){const l=i.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.dayPeriod(l,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(l,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(l,{width:"narrow",context:"formatting"});case"aaaa":default:return r.dayPeriod(l,{width:"wide",context:"formatting"})}},b:function(i,t,r){const s=i.getHours();let l;switch(s===12?l=qs.noon:s===0?l=qs.midnight:l=s/12>=1?"pm":"am",t){case"b":case"bb":return r.dayPeriod(l,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(l,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(l,{width:"narrow",context:"formatting"});case"bbbb":default:return r.dayPeriod(l,{width:"wide",context:"formatting"})}},B:function(i,t,r){const s=i.getHours();let l;switch(s>=17?l=qs.evening:s>=12?l=qs.afternoon:s>=4?l=qs.morning:l=qs.night,t){case"B":case"BB":case"BBB":return r.dayPeriod(l,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(l,{width:"narrow",context:"formatting"});case"BBBB":default:return r.dayPeriod(l,{width:"wide",context:"formatting"})}},h:function(i,t,r){if(t==="ho"){let s=i.getHours()%12;return s===0&&(s=12),r.ordinalNumber(s,{unit:"hour"})}return ii.h(i,t)},H:function(i,t,r){return t==="Ho"?r.ordinalNumber(i.getHours(),{unit:"hour"}):ii.H(i,t)},K:function(i,t,r){const s=i.getHours()%12;return t==="Ko"?r.ordinalNumber(s,{unit:"hour"}):Ye(s,t.length)},k:function(i,t,r){let s=i.getHours();return s===0&&(s=24),t==="ko"?r.ordinalNumber(s,{unit:"hour"}):Ye(s,t.length)},m:function(i,t,r){return t==="mo"?r.ordinalNumber(i.getMinutes(),{unit:"minute"}):ii.m(i,t)},s:function(i,t,r){return t==="so"?r.ordinalNumber(i.getSeconds(),{unit:"second"}):ii.s(i,t)},S:function(i,t){return ii.S(i,t)},X:function(i,t,r){const s=i.getTimezoneOffset();if(s===0)return"Z";switch(t){case"X":return X1(s);case"XXXX":case"XX":return Pi(s);case"XXXXX":case"XXX":default:return Pi(s,":")}},x:function(i,t,r){const s=i.getTimezoneOffset();switch(t){case"x":return X1(s);case"xxxx":case"xx":return Pi(s);case"xxxxx":case"xxx":default:return Pi(s,":")}},O:function(i,t,r){const s=i.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+K1(s,":");case"OOOO":default:return"GMT"+Pi(s,":")}},z:function(i,t,r){const s=i.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+K1(s,":");case"zzzz":default:return"GMT"+Pi(s,":")}},t:function(i,t,r){const s=Math.trunc(+i/1e3);return Ye(s,t.length)},T:function(i,t,r){return Ye(+i,t.length)}};function K1(i,t=""){const r=i>0?"-":"+",s=Math.abs(i),l=Math.trunc(s/60),c=s%60;return c===0?r+String(l):r+String(l)+t+Ye(c,2)}function X1(i,t){return i%60===0?(i>0?"-":"+")+Ye(Math.abs(i)/60,2):Pi(i,t)}function Pi(i,t=""){const r=i>0?"-":"+",s=Math.abs(i),l=Ye(Math.trunc(s/60),2),c=Ye(s%60,2);return r+l+t+c}const J1=(i,t)=>{switch(i){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},zv=(i,t)=>{switch(i){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},ET=(i,t)=>{const r=i.match(/(P+)(p+)?/)||[],s=r[1],l=r[2];if(!l)return J1(i,t);let c;switch(s){case"P":c=t.dateTime({width:"short"});break;case"PP":c=t.dateTime({width:"medium"});break;case"PPP":c=t.dateTime({width:"long"});break;case"PPPP":default:c=t.dateTime({width:"full"});break}return c.replace("{{date}}",J1(s,t)).replace("{{time}}",zv(l,t))},OT={p:zv,P:ET},AT=/^D+$/,jT=/^Y+$/,TT=["D","DD","YY","YYYY"];function NT(i){return AT.test(i)}function kT(i){return jT.test(i)}function CT(i,t,r){const s=MT(i,t,r);if(console.warn(s),TT.includes(i))throw new RangeError(s)}function MT(i,t,r){const s=i[0]==="Y"?"years":"days of the month";return`Use \`${i.toLowerCase()}\` instead of \`${i}\` (in \`${t}\`) for formatting ${s} to the input \`${r}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const RT=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,DT=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,qT=/^'([^]*?)'?$/,BT=/''/g,LT=/[a-zA-Z]/;function Jd(i,t,r){var m,b,v,_;const s=So(),l=s.locale??Bv,c=s.firstWeekContainsDate??((b=(m=s.locale)==null?void 0:m.options)==null?void 0:b.firstWeekContainsDate)??1,d=s.weekStartsOn??((_=(v=s.locale)==null?void 0:v.options)==null?void 0:_.weekStartsOn)??0,p=mn(i,r==null?void 0:r.in);if(!Uj(p))throw new RangeError("Invalid time value");let g=t.match(DT).map(w=>{const S=w[0];if(S==="p"||S==="P"){const M=OT[S];return M(w,l.formatLong)}return w}).join("").match(RT).map(w=>{if(w==="''")return{isToken:!1,value:"'"};const S=w[0];if(S==="'")return{isToken:!1,value:zT(w)};if(Y1[S])return{isToken:!0,value:w};if(S.match(LT))throw new RangeError("Format string contains an unescaped latin alphabet character `"+S+"`");return{isToken:!1,value:w}});l.localize.preprocessor&&(g=l.localize.preprocessor(p,g));const f={firstWeekContainsDate:c,weekStartsOn:d,locale:l};return g.map(w=>{if(!w.isToken)return w.value;const S=w.value;(kT(S)||NT(S))&&CT(S,t,String(i));const M=Y1[S[0]];return M(p,S,l.localize,f)}).join("")}function zT(i){const t=i.match(qT);return t?t[1].replace(BT,"'"):i}function UT(i,t,r){const s=So(),l=(r==null?void 0:r.locale)??s.locale??Bv,c=Bj(i,t);if(isNaN(c))throw new RangeError("Invalid time value");const d=Object.assign({},r,{addSuffix:r==null?void 0:r.addSuffix,comparison:c}),[p,g]=qv(r==null?void 0:r.in,...c>0?[t,i]:[i,t]),f=Pj((r==null?void 0:r.roundingMethod)??"round"),m=g.getTime()-p.getTime(),b=m/I1,v=au(g)-au(p),_=(m-v)/I1,w=r==null?void 0:r.unit;let S;if(w?S=w:b<1?S="second":b<60?S="minute":b<G1?S="hour":_<H1?S="day":_<$1?S="month":S="year",S==="second"){const M=f(m/1e3);return l.formatDistance("xSeconds",M,d)}else if(S==="minute"){const M=f(b);return l.formatDistance("xMinutes",M,d)}else if(S==="hour"){const M=f(b/60);return l.formatDistance("xHours",M,d)}else if(S==="day"){const M=f(_/G1);return l.formatDistance("xDays",M,d)}else if(S==="month"){const M=f(_/H1);return M===12&&w!=="month"?l.formatDistance("xYears",1,d):l.formatDistance("xMonths",M,d)}else{const M=f(_/$1);return l.formatDistance("xYears",M,d)}}function PT(i,t){return UT(i,Lj(i),t)}function J3(i){return i.toLocaleString()}function Q3(i){return i>=1e9?`${(i/1e9).toFixed(1).replace(/\.0$/,"")}B`:i>=1e6?`${(i/1e6).toFixed(1).replace(/\.0$/,"")}M`:i>=1e4?`${(i/1e3).toFixed(1).replace(/\.0$/,"")}K`:i.toLocaleString()}function IT(i){const t=new Date(i);return t.getTime()>Date.now()?"just now":PT(t,{addSuffix:!0})}function Z3(i){const t=Date.now()-new Date(i).getTime();if(t<0)return"now";const r=Math.floor(t/1e3);if(r<60)return`${r}s`;const s=Math.floor(r/60);if(s<60)return`${s}m`;const l=Math.floor(s/60);if(l<24)return`${l}h`;const c=Math.floor(l/24);return c<7?`${c}d`:c<30?`${Math.floor(c/7)}w`:c<365?`${Math.floor(c/30)}mo`:`${Math.floor(c/365)}y`}function W3(i){return i<=0?"Expired":Qd(i)}function $T(i){return i==null?"--":Qd(i)}function ek(i){return i?Jd(new Date(i),"MMM d, yyyy h:mm a"):"--"}function Qd(i){if(i<1e3)return`${Math.round(i)}ms`;if(i<6e4){const d=i/1e3;return Number.isInteger(d)?`${d}s`:`${d.toFixed(1)}s`}const t=Math.floor(i/1e3),r=Math.floor(t/86400),s=Math.floor(t%86400/3600),l=Math.floor(t%3600/60),c=t%60;return r>0?s>0?`${r}d ${s}h`:`${r}d`:s>0?l>0?`${s}h ${l}m`:`${s}h`:c>0?`${l}m ${c}s`:`${l}m`}function tk(i,t){const r=new Date(i).getTime(),s=t?new Date(t).getTime():Date.now();return Qd(s-r)}function Uv({options:i,children:t,className:r=""}){const[s,l]=j.useState(!1),[c,d]=j.useState(null),[p,g]=j.useState(null),f=j.useRef(null),m=j.useRef(void 0),b=j.useRef(void 0),v=220,_=j.useCallback(()=>{if(!f.current)return;const B=f.current.getBoundingClientRect(),U=window.innerWidth-v-8,ie=Math.max(8,Math.min(B.left,U));g({top:B.bottom+4,left:ie})},[]),w=j.useCallback(async(B,U)=>{try{await navigator.clipboard.writeText(B),d(U),clearTimeout(m.current),m.current=setTimeout(()=>d(null),1200)}catch{}},[]),S=j.useCallback(()=>{clearTimeout(b.current),_(),l(!0)},[_]),M=j.useCallback(()=>{b.current=setTimeout(()=>l(!1),150)},[]);return j.useEffect(()=>()=>{clearTimeout(m.current),clearTimeout(b.current)},[]),y.jsxs("span",{ref:f,className:`inline-flex items-center cursor-default ${r}`,onMouseEnter:S,onMouseLeave:M,children:[t,s&&p&&ib.createPortal(y.jsx("span",{className:"fixed z-[9999] bg-surface-raised border border-surface-border rounded shadow-lg py-1 min-w-[180px]",style:{top:p.top,left:p.left},onMouseEnter:S,onMouseLeave:M,children:i.map(B=>y.jsxs("button",{onClick:U=>{U.stopPropagation(),w(B.value,B.label)},className:"flex items-center justify-between w-full px-2.5 py-1 text-left hover:bg-surface-hover transition-colors",children:[y.jsx("span",{className:"text-2xs font-medium uppercase tracking-wider text-text-tertiary w-10 shrink-0",children:B.label}),y.jsx("span",{className:"text-2xs font-mono text-text-secondary truncate ml-2",children:c===B.label?"✓":B.value})]},B.label))}),document.body)]})}function HT(i,t){const r=new Date(i);switch(t){case"relative":return IT(i);case"datetime":return Jd(r,"MMM d, yyyy h:mm a");case"time":return r.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}}function GT(i){const t=new Date(i);return[{label:"ms",value:String(t.getTime())},{label:"utc",value:t.toISOString()},{label:"local",value:Jd(t,"MMM d, yyyy h:mm:ss a")}]}function FT({date:i,format:t="relative",className:r=""}){const[,s]=j.useState(0);j.useEffect(()=>{if(t!=="relative")return;const c=setInterval(()=>s(d=>d+1),3e4);return()=>clearInterval(c)},[t]);const l=j.useMemo(()=>GT(i),[i]);return y.jsx(Uv,{options:l,children:y.jsx("time",{dateTime:i,className:`text-xs text-text-tertiary ${r}`,children:HT(i,t)})})}function VT({ms:i,className:t=""}){const r=$T(i),s=j.useMemo(()=>i==null?[]:[{label:"ms",value:String(i)},{label:"sec",value:`${(i/1e3).toFixed(3)}s`},{label:"text",value:r}],[i,r]);return i==null?y.jsx("span",{className:`text-xs text-text-tertiary ${t}`,children:"--"}):y.jsx(Uv,{options:s,children:y.jsx("span",{className:`text-xs text-text-tertiary ${t}`,children:r})})}const YT=["sm","md","lg","full"],Q1={sm:"w-[28rem] max-h-[40vh]",md:"w-[36rem] max-h-[60vh]",lg:"w-[48rem] max-h-[80vh]",full:"inset-4 w-auto max-h-none"},Z1={sm:"Small",md:"Medium",lg:"Large",full:"Fullscreen"};function KT({which:i}){const t="stroke-current";switch(i){case"sm":return y.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:y.jsx("rect",{x:"5",y:"5",width:"7",height:"7",rx:"1.5",className:t,strokeWidth:"1.5"})});case"md":return y.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:y.jsx("rect",{x:"3",y:"3",width:"9",height:"9",rx:"1.5",className:t,strokeWidth:"1.5"})});case"lg":return y.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:y.jsx("rect",{x:"1.5",y:"1.5",width:"11",height:"11",rx:"1.5",className:t,strokeWidth:"1.5"})});case"full":return y.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:y.jsx("rect",{x:"0.75",y:"0.75",width:"12.5",height:"12.5",rx:"1.5",className:t,strokeWidth:"1.5"})})}}function XT({msg:i}){const[t,r]=j.useState(0);j.useEffect(()=>{const d=new Date(i.timestamp).getTime(),p=()=>r(Math.floor((Date.now()-d)/1e3));p();const g=setInterval(p,1e3);return()=>clearInterval(g)},[i.timestamp]);const s=Math.floor(t/60),l=t%60,c=s>0?`${s}m ${l}s`:`${l}s`;return y.jsxs("span",{className:"inline-flex flex-col gap-1.5",children:[y.jsxs("span",{className:"inline-flex items-center gap-1",children:[y.jsx("span",{className:"text-text-tertiary",children:"Thinking"}),y.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse"}),y.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse [animation-delay:150ms]"}),y.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse [animation-delay:300ms]"}),y.jsx("span",{className:"text-text-muted ml-1 tabular-nums",children:c})]}),i.workflowId&&y.jsxs(Ii,{to:`/workflows/executions/${i.workflowId}`,className:"inline-flex items-center gap-1 text-2xs text-accent/70 hover:text-accent transition-colors",children:[y.jsx(Sd,{className:"w-2.5 h-2.5",strokeWidth:1.5}),"watch execution"]})]})}function JT({msg:i,compileMessage:t}){const r=i.role==="assistant";return y.jsxs("div",{className:`flex items-center gap-1.5 ${r?"justify-start":"justify-end"}`,children:[y.jsx(FT,{date:i.timestamp,format:"time",className:"!text-2xs text-text-muted/50"}),i.durationMs!=null&&y.jsxs(y.Fragment,{children:[y.jsx("span",{className:"text-text-muted/30 text-2xs",children:"·"}),y.jsx(VT,{ms:i.durationMs,className:"!text-2xs text-text-muted/50"})]}),i.workflowId&&y.jsx(Ii,{to:`/workflows/executions/${i.workflowId}`,className:"text-text-muted/40 hover:text-accent transition-colors",title:"View workflow execution",children:y.jsx(Sd,{className:"w-2.5 h-2.5",strokeWidth:1.5})}),r&&i.workflowId&&!i.pending&&y.jsx("button",{onClick:()=>t(i.id),disabled:i.compilationStatus==="compiling"||i.compilationStatus==="done",className:"transition-colors",title:i.compilationStatus==="done"?"Compiled — future queries will match this pipeline":i.compilationStatus==="error"?i.compilationError??"Compilation failed":i.compilationStatus==="compiling"?"Compiling...":"Compile to fast pipeline",children:y.jsx(Tw,{className:`w-2.5 h-2.5 ${i.compilationStatus==="done"?"text-status-success":i.compilationStatus==="error"?"text-status-error":i.compilationStatus==="compiling"?"text-accent/40 animate-pulse":"text-text-muted/40 hover:text-accent"}`,strokeWidth:1.5})})]})}function QT(){const{helpOpen:i,setHelpOpen:t,messages:r,sendMessage:s,pageContext:l,activeWorkflowId:c,clearMessages:d,compileMessage:p}=Mv(),[g,f]=j.useState(""),[m,b]=j.useState("md"),[v,_]=j.useState(!0),w=j.useRef(null),S=j.useRef(null);if(j.useEffect(()=>{w.current&&(w.current.scrollTop=w.current.scrollHeight)},[r]),j.useEffect(()=>{i&&S.current&&S.current.focus()},[i]),j.useEffect(()=>{if(!i)return;const C=z=>{z.key==="Escape"&&(m==="full"?b("lg"):m==="lg"?b("md"):m==="md"?b("sm"):t(!1))};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[i,m,t]),!i)return null;const M=()=>{const C=g.trim();!C||c||(s(C),f(""),S.current&&(S.current.style.height="auto"))},B=C=>{C.key==="Enter"&&!C.shiftKey&&(C.preventDefault(),M())},U=m==="full",ie=l.page.replace(/-/g," "),ce=U?{}:{bottom:"108px"};return y.jsxs("div",{className:`fixed z-[45] flex flex-col border border-surface-border rounded-lg overflow-hidden transition-all duration-300 ${U?Q1.full:`right-6 ${Q1[m]}`} ${v?"bg-surface-raised shadow-xl":"bg-surface-raised/[0.03] shadow-lg shadow-black/5"}`,style:ce,onMouseEnter:()=>_(!0),onMouseLeave:()=>_(!1),children:[y.jsxs("div",{className:`flex items-center justify-between px-4 py-2.5 border-b border-surface-border shrink-0 transition-all duration-300 ${v?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[y.jsxs("div",{className:"min-w-0 flex-1",children:[y.jsx("p",{className:"text-xs font-medium text-text-primary truncate",children:"Help Assistant"}),y.jsx("p",{className:"text-2xs text-text-tertiary truncate",children:ie})]}),y.jsxs("div",{className:"flex items-center gap-1 ml-2",children:[y.jsx("div",{className:"flex items-center gap-0.5 border border-surface-border rounded p-0.5",role:"radiogroup","aria-label":"Panel size",children:YT.map(C=>y.jsx("button",{onClick:()=>b(C),className:`p-1 rounded transition-colors ${C===m?"bg-accent/15 text-accent":"text-text-muted hover:text-text-secondary hover:bg-surface-hover"}`,role:"radio","aria-checked":C===m,"aria-label":Z1[C],title:Z1[C],children:y.jsx(KT,{which:C})},C))}),r.length>0&&y.jsx("button",{onClick:d,className:"p-1 text-text-tertiary hover:text-text-secondary transition-colors","aria-label":"Clear conversation",title:"Clear conversation",children:y.jsx(Nw,{className:"w-3.5 h-3.5",strokeWidth:1.5})}),y.jsx("button",{onClick:()=>t(!1),className:"p-1 text-text-tertiary hover:text-text-primary transition-colors","aria-label":"Close",title:"Close",children:y.jsx(Cn,{className:"w-3.5 h-3.5",strokeWidth:1.5})})]})]}),y.jsxs("div",{ref:w,className:`flex-1 overflow-y-auto px-4 py-3 space-y-3 min-h-[120px] transition-all duration-300 ${v?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[r.length===0&&y.jsx("p",{className:"text-xs text-text-tertiary text-center py-6",children:"Ask anything about what you're viewing."}),r.map(C=>y.jsxs("div",{className:`text-xs leading-relaxed ${C.role==="user"?"text-right":"text-left"}`,children:[y.jsx("div",{className:`inline-block max-w-[85%] px-3 py-2 rounded-md whitespace-pre-wrap ${C.role==="user"?"bg-accent/10 text-text-primary":"bg-surface-sunken text-text-secondary"}`,children:C.pending?y.jsx(XT,{msg:C}):C.role==="assistant"?y.jsx(Xd,{content:C.content}):C.content}),!C.pending&&y.jsx("div",{className:"mt-0.5",children:y.jsx(JT,{msg:C,compileMessage:p})})]},C.id))]}),y.jsxs("div",{className:`border-t border-surface-border px-3 py-2.5 flex gap-2 shrink-0 transition-all duration-300 ${v?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[y.jsx("textarea",{ref:S,value:g,onChange:C=>{f(C.target.value);const z=C.target;z.style.height="auto",z.style.height=`${Math.min(z.scrollHeight,120)}px`},onKeyDown:B,placeholder:"Ask a question...",rows:2,className:"flex-1 resize-none bg-surface text-xs text-text-primary placeholder:text-text-tertiary rounded px-2.5 py-1.5 border border-surface-border focus:outline-none focus:border-accent",style:{minHeight:"2.5rem"},disabled:!!c}),y.jsx("button",{onClick:M,disabled:!g.trim()||!!c,className:"px-2.5 py-1.5 text-accent hover:text-accent-hover disabled:text-text-muted transition-colors self-end","aria-label":"Send",children:y.jsx(kw,{className:"w-4 h-4",strokeWidth:1.5})})]})]})}const ZT=6e3,WT="scan";function eN(){const{lastResult:i}=dv(),{open:t,ownerKey:r}=Yd(),[s,l]=j.useState(null);if(j.useEffect(()=>{if(!i)return;const d=setTimeout(()=>l(i.at),ZT);return()=>clearTimeout(d)},[i]),!i||i.navigated||s===i.at||t&&r===WT)return null;const{response:c}=i;return y.jsx("div",{role:"status",className:"fixed bottom-14 right-4 z-[60] w-80 max-w-[calc(100vw-2rem)] bg-surface-raised border border-surface-border shadow-lg rounded-md animate-page-in",children:y.jsxs("div",{className:"flex items-start gap-2.5 px-3.5 py-3",children:[y.jsx(ou,{className:"w-4 h-4 mt-0.5 text-accent-muted shrink-0",strokeWidth:1.5}),y.jsxs("div",{className:"flex-1 min-w-0",children:[y.jsx("div",{className:"text-sm font-mono text-text-secondary truncate",children:i.code}),c?y.jsxs(y.Fragment,{children:[y.jsx("div",{className:`text-sm font-medium ${wv[c.outcome]}`,children:Sv(c)}),c.error&&y.jsx("div",{className:"text-xs text-text-tertiary mt-0.5",children:c.error}),ru(c)&&y.jsx("div",{className:"text-xs text-text-secondary mt-1.5",children:y.jsx(Ev,{content:ru(c),compact:!0})})]}):y.jsx("div",{className:"text-sm text-status-error",children:i.error})]}),y.jsx("button",{type:"button",onClick:()=>l(i.at),className:"text-text-tertiary hover:text-text-primary shrink-0",title:"Dismiss",children:y.jsx(Cn,{className:"w-3.5 h-3.5"})})]})})}function tN(){var C;const{isBuilder:i,isOps:t,viewAs:r}=Kb(),{canSeePaceBoard:s}=Xb();sO();const{data:l}=Wn(),c=Fb(),d=c!==null?c:!!((C=l==null?void 0:l.ai)!=null&&C.enabled),{collapsed:p,toggle:g}=Fd(),[f,m]=j.useState(!1),[b,v]=j.useState(!1),[_,w]=j.useState(!1),[S,M]=j.useState(()=>window.location.hash.startsWith("#docs")),B=pn(),U=j.useRef(null),{kiosk:ie,homePath:ce}=aO();return j.useEffect(()=>{const z=U.current;z&&(z.classList.remove("animate-page-in"),z.offsetWidth,z.classList.add("animate-page-in"))},[B.pathname]),j.useEffect(()=>{const z=()=>{window.location.hash.startsWith("#docs")&&M(!0)};return window.addEventListener("hashchange",z),()=>window.removeEventListener("hashchange",z)},[]),ie&&ce&&!lO(B.pathname)?y.jsx(In,{to:ce,replace:!0}):y.jsxs("div",{className:"h-screen bg-surface flex flex-col",children:[y.jsx(kA,{onToggleEventFeed:()=>m(z=>!z),onToggleDocs:()=>M(z=>!z),onToggleNav:ie?void 0:()=>v(z=>!z)}),y.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[!ie&&y.jsxs("aside",{className:`${p?"w-16":"w-60"} shrink-0 bg-surface-raised border-r border-surface-border hidden lg:flex flex-col transition-[width] duration-200 ease-out overflow-hidden relative z-20`,children:[y.jsx("nav",{className:"flex-1 px-3 pt-[36px] pb-4 space-y-2 overflow-y-auto overflow-x-hidden",children:y.jsx(Av,{aiEnabled:d,isBuilder:i,isOps:t,viewAs:r,canSeePaceBoard:s})}),y.jsx("button",{onClick:g,className:`shrink-0 py-3 text-text-tertiary hover:text-text-secondary transition-colors duration-150 ${p?"flex justify-center":"flex items-center px-7"}`,"aria-label":p?"Expand sidebar":"Collapse sidebar",children:p?y.jsx(Cw,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5}):y.jsx(Mw,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5})}),!p&&(l==null?void 0:l.environment)&&y.jsxs("div",{className:"shrink-0 px-5 pb-3 text-2xs leading-tight text-text-tertiary whitespace-nowrap overflow-hidden text-ellipsis",title:`long-tail v${l.environment.longTailVersion} · HotMesh v${l.environment.hotmeshVersion} · Node ${l.environment.nodeVersion} · ${l.environment.nodeEnv}`,children:["long-tail v",l.environment.longTailVersion,y.jsx("span",{className:"mx-1 text-surface-border",children:"·"}),"HotMesh v",l.environment.hotmeshVersion]})]}),y.jsx("main",{className:"flex-1 min-w-0 overflow-y-auto",children:y.jsx("div",{ref:U,className:"w-full px-page-x py-8 pb-16 animate-page-in h-full flex flex-col @container",children:y.jsx(Ls,{})})}),y.jsx(nN,{})]}),!ie&&y.jsx(QA,{open:b,onClose:()=>v(!1),aiEnabled:d,isBuilder:i,isOps:t,viewAs:r,canSeePaceBoard:s}),y.jsx(gj,{open:f,onToggle:()=>m(z=>!z),configOpen:_,onToggleConfig:()=>w(z=>!z)}),y.jsx(Aj,{open:S,onClose:()=>{M(!1),history.replaceState(null,"",window.location.pathname+window.location.search)}}),d&&y.jsx(Cj,{}),d&&y.jsx(QT,{}),y.jsx(eN,{})]})}function nN(){const{node:i,width:t,open:r}=Yd();return y.jsx(dO,{open:r,width:t,className:"border-l border-surface-border bg-surface-raised",children:i})}function rN(){const{isAuthenticated:i}=Jt(),t=pn();return i?y.jsx(uO,{children:y.jsx(hO,{children:y.jsx(kj,{children:y.jsx(SO,{children:y.jsx(BO,{children:y.jsx(tN,{})})})})})}):y.jsx(In,{to:"/login",state:{from:t.pathname},replace:!0})}function Pv({provider:i,className:t="w-5 h-5"}){switch(i){case"google":return y.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor",children:[y.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z",fill:"#4285F4"}),y.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z",fill:"#34A853"}),y.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z",fill:"#FBBC05"}),y.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z",fill:"#EA4335"})]});case"github":return y.jsx("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor",children:y.jsx("path",{d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0 1 12 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0 0 22 12.017C22 6.484 17.522 2 12 2z"})});case"microsoft":return y.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor",children:[y.jsx("path",{d:"M3 3h8.5v8.5H3z",fill:"#F25022"}),y.jsx("path",{d:"M12.5 3H21v8.5h-8.5z",fill:"#7FBA00"}),y.jsx("path",{d:"M3 12.5h8.5V21H3z",fill:"#00A4EF"}),y.jsx("path",{d:"M12.5 12.5H21V21h-8.5z",fill:"#FFB900"})]});case"anthropic":return y.jsx("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor",children:y.jsx("path",{d:"M13.827 3.52h3.603L24 20.48h-3.603l-6.57-16.96zm-7.258 0h3.767L16.906 20.48h-3.674l-1.343-3.461H6.396l-1.34 3.461H1.5l5.07-16.96zm2.327 5.14l-2.065 5.326h4.108l-2.043-5.326z"})});default:return y.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[y.jsx("circle",{cx:"12",cy:"12",r:"10"}),y.jsx("path",{d:"M12 8v4l3 3"})]})}}async function iN(){return Ae("/auth/oauth/providers")}async function sN(i,t){const r=t?`?label=${encodeURIComponent(t)}`:"";return Ae(`/auth/oauth/connections/${i}${r}`,{method:"DELETE"})}function nk(){return pt({queryKey:["oauth-connections"],queryFn:()=>Ae("/auth/oauth/connections")})}function rk(){const i=gt();return Et({mutationFn:({provider:t,label:r})=>sN(t,r),onSuccess:()=>{i.invalidateQueries({queryKey:["oauth-connections"]})}})}function aN(){var re;const{login:i,isAuthenticated:t}=Jt(),r=go(),s=pn(),l=new URLSearchParams(s.search),c=l.get("token"),d=l.get("error"),p=((re=s.state)==null?void 0:re.from)??l.get("returnTo")??"/",g=j.useRef(!1);c&&!g.current&&(g.current=!0,i(c,void 0,{displayName:l.get("displayName"),username:l.get("username")}));const[f,m]=j.useState(""),[b,v]=j.useState(""),[_,w]=j.useState(d||""),[S,M]=j.useState(!1),[B,U]=j.useState(!!c),[ie,ce]=j.useState([]),C=j.useRef(!1);if(j.useEffect(()=>{c||C.current||(C.current=!0,(async()=>{var X,L,G,W;try{const Q=await fetch(`${jt}/api/settings`);if(!Q.ok)return;const he=await Q.json();if(!((X=he.auth)!=null&&X.sso))return;const _e=await fetch(`${jt}/api/auth/sso`,{method:"POST"});if(!_e.ok){w("Host authentication required — please log in to your organization first");return}const Te=await _e.json();Te.token&&((L=he.auth)!=null&&L.ssoLogoutUrl&&sessionStorage.setItem("lt_sso_logout_url",he.auth.ssoLogoutUrl),U(!0),i(Te.token,void 0,{displayName:(G=Te.user)==null?void 0:G.display_name,username:(W=Te.user)==null?void 0:W.external_id}))}catch{}})())},[]),j.useEffect(()=>{c||iN().then(ce).catch(()=>{})},[]),j.useEffect(()=>{if(!B)return;const X=setTimeout(()=>r(p,{replace:!0}),1500);return()=>clearTimeout(X)},[B]),t&&!B)return y.jsx(In,{to:p,replace:!0});const z=async X=>{var L,G;if(X.preventDefault(),w(""),!f.trim()||!b){w("Username and password are required");return}M(!0);try{const W=await fetch(`${jt}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:f.trim(),password:b})}),Q=await W.json();if(!W.ok){w(Q.error||"Login failed");return}U(!0),i(Q.token,{username:f.trim(),password:b},{displayName:(L=Q.user)==null?void 0:L.display_name,username:(G=Q.user)==null?void 0:G.external_id})}catch{w("Unable to connect to server")}finally{M(!1)}};return y.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center overflow-hidden",children:y.jsxs("div",{className:"w-full max-w-md p-10",children:[y.jsx("div",{className:`mb-10 transition-all duration-[1500ms] ease-in ${B?"translate-x-[120vw] -translate-y-[60vh] scale-[3] opacity-0":""}`,children:y.jsx(nu,{size:"lg",hideLabel:B})}),y.jsxs("form",{onSubmit:z,className:`space-y-5 transition-opacity duration-300 ${B?"opacity-0":""}`,children:[y.jsxs("div",{children:[y.jsx("label",{htmlFor:"username",className:"block text-sm font-medium text-text-secondary mb-2",children:"Username"}),y.jsx("input",{id:"username",type:"text",value:f,onChange:X=>m(X.target.value),className:"input",placeholder:"Enter your username",autoFocus:!B,autoComplete:"username"})]}),y.jsxs("div",{children:[y.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-text-secondary mb-2",children:"Password"}),y.jsx("input",{id:"password",type:"password",value:b,onChange:X=>v(X.target.value),className:"input",placeholder:"Enter your password",autoComplete:"current-password"})]}),_&&y.jsx("p",{className:"text-sm text-status-error",children:_}),y.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:S||B,children:S?"Signing in...":"Sign In"}),ie.length>0&&y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"flex items-center gap-3 mt-6",children:[y.jsx("div",{className:"flex-1 h-px bg-border"}),y.jsx("span",{className:"text-xs text-text-tertiary",children:"or continue with"}),y.jsx("div",{className:"flex-1 h-px bg-border"})]}),y.jsx("div",{className:"space-y-2",children:ie.filter(X=>X.provider!=="anthropic").map(X=>y.jsxs("a",{href:`${jt}/api/auth/oauth/${X.provider}?returnTo=${encodeURIComponent(p)}`,className:"btn-secondary w-full flex items-center justify-center gap-2",children:[y.jsx(Pv,{provider:X.provider}),"Sign in with ",X.name]},X.provider))})]})]})]})})}function W1(){const{isAuthenticated:i}=Jt(),t=go(),r=pn(),s=new URLSearchParams(r.search),l=s.get("state")||"";j.useEffect(()=>{i||t(`/login?returnTo=${encodeURIComponent(r.pathname+r.search)}`)},[i]);const[c,d]=j.useState(""),[p,g]=j.useState(s.get("label")||"default"),[f,m]=j.useState(""),[b,v]=j.useState(!1),_=c.trim().startsWith("sk-ant-oat"),w=c.trim().startsWith("sk-ant-api"),S=M=>{M.preventDefault();const B=c.trim();if(!B){m("A token or API key is required");return}if(!B.startsWith("sk-ant-")){m('Invalid format. Must start with "sk-ant-oat" (OAuth token) or "sk-ant-api" (API key)');return}v(!0),m("");const U=`${jt}/api/auth/oauth/anthropic/callback?code=${encodeURIComponent(B)}&state=${encodeURIComponent(l)}`;window.location.href=U};return y.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center",children:y.jsxs("div",{className:"w-full max-w-md p-10",children:[y.jsx("div",{className:"mb-10",children:y.jsx(nu,{size:"lg"})}),y.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[y.jsx(Pv,{provider:"anthropic",className:"w-6 h-6"}),y.jsx("h2",{className:"heading-3",children:"Connect Anthropic"})]}),y.jsx("p",{className:"text-sm text-text-secondary mb-4",children:"Connect your Anthropic account so Claude Code tasks run under your credentials. Your token is encrypted at rest."}),y.jsxs("form",{onSubmit:S,className:"space-y-5",children:[y.jsxs("div",{children:[y.jsx("label",{htmlFor:"token",className:"block text-sm font-medium text-text-secondary mb-2",children:"OAuth Token or API Key"}),y.jsx("input",{id:"token",type:"password",value:c,onChange:M=>d(M.target.value),className:"input",placeholder:"sk-ant-oat01-... or sk-ant-api03-...",autoFocus:!0,autoComplete:"off"}),_&&y.jsx("p",{className:"text-xs text-status-success mt-1",children:"OAuth token detected — uses your Claude subscription (flat rate)"}),w&&y.jsx("p",{className:"text-xs text-status-warning mt-1",children:"API key detected — billed per-token from your Anthropic API account"})]}),y.jsxs("div",{children:[y.jsx("label",{htmlFor:"label",className:"block text-sm font-medium text-text-secondary mb-2",children:"Label"}),y.jsx("input",{id:"label",type:"text",value:p,onChange:M=>g(M.target.value.replace(/\s+/g,"-").toLowerCase()),className:"input",placeholder:"default",autoComplete:"off"}),y.jsx("p",{className:"text-xs text-text-tertiary mt-1",children:'A name for this credential. Use different labels to store multiple credentials (e.g., "subscription", "api-batch").'})]}),f&&y.jsx("p",{className:"text-sm text-status-error",children:f}),y.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:b,children:b?"Validating...":"Connect"}),y.jsx("a",{href:"/",className:"block text-center text-sm text-text-tertiary hover:text-text-secondary",children:"Cancel"})]}),y.jsxs("div",{className:"mt-6 space-y-3 text-xs text-text-tertiary",children:[y.jsxs("div",{children:[y.jsx("span",{className:"font-medium text-text-secondary",children:"Recommended:"})," ","Run"," ",y.jsx("code",{className:"px-1 py-0.5 bg-surface-sunken rounded text-2xs",children:"claude setup-token"})," ","in your terminal to generate an OAuth token that uses your subscription."]}),y.jsxs("div",{children:[y.jsx("span",{className:"font-medium text-text-secondary",children:"Alternative:"})," ","Use an API key from"," ",y.jsx("a",{href:"https://console.anthropic.com/settings/keys",target:"_blank",rel:"noopener noreferrer",className:"text-accent-secondary hover:underline",children:"console.anthropic.com"})," ","(billed per-token)."]})]})]})})}function zc({roleTypes:i,roleNames:t,redirectTo:r="/"}){const{isSuperAdmin:s,hasRole:l,hasRoleType:c}=Jt();return s?y.jsx(Ls,{}):i&&i.some(d=>c(d))?y.jsx(Ls,{}):t&&t.some(d=>l(d))?y.jsx(Ls,{}):y.jsx(In,{to:r,replace:!0})}function oN({redirectTo:i="/"}){var s;const{data:t,isLoading:r}=Wn();return r||!t?null:(s=t.ai)!=null&&s.enabled?y.jsx(Ls,{}):y.jsx(In,{to:i,replace:!0})}function lN({flag:i,redirectTo:t="/"}){var l;const{data:r,isLoading:s}=Wn();return s||!r?null:((l=r.features)==null?void 0:l[i])===!1?y.jsx(In,{to:t,replace:!0}):y.jsx(Ls,{})}const cN=j.lazy(()=>we(()=>import("./ProcessesListPage-CnAXzaVv.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]),import.meta.url).then(i=>({default:i.ProcessesListPage}))),uN=j.lazy(()=>we(()=>import("./ProcessDetailPage-CfAUU6q2.js"),__vite__mapDeps([18,1,2,4,19,14,20,17,11,6,21,22,23]),import.meta.url).then(i=>({default:i.ProcessDetailPage}))),fN=j.lazy(()=>we(()=>import("./McpOverview-DstPch5M.js"),__vite__mapDeps([24,1,25,26,27,28,15,14,29,6]),import.meta.url).then(i=>({default:i.McpOverview}))),hN=j.lazy(()=>we(()=>import("./McpRunsPage-BZCR043j.js"),__vite__mapDeps([30,1,26,27,5,6,31,28,8,9,10,17,14,32,15,13,12,16,33]),import.meta.url).then(i=>({default:i.McpRunsPage}))),dN=j.lazy(()=>we(()=>import("./McpRunDetailPage-CcJOlp_B.js"),__vite__mapDeps([34,1,26,15,14,35,36,13,37,20,6,38,16,39]),import.meta.url).then(i=>({default:i.McpRunDetailPage}))),mN=j.lazy(()=>we(()=>import("./McpQueryPage-DxmqCkly.js"),__vite__mapDeps([40,1,15,14,9,10,13,12,16,8,11,32,17,33,5,6,4,41]),import.meta.url).then(i=>({default:i.McpQueryPage}))),pN=j.lazy(()=>we(()=>import("./McpQueryDetailPage-Csv0PKE0.js"),__vite__mapDeps([42,1,15,14,20,41,6,27,4,43,44,26,3,2,45,46,47,48,49,50,39,51,37,38]),import.meta.url).then(i=>({default:i.McpQueryDetailPage}))),gN=j.lazy(()=>we(()=>import("./EscalationsOverview-FL-xteVc.js"),__vite__mapDeps([52,1,4,15,14,29,6]),import.meta.url).then(i=>({default:i.EscalationsOverview}))),yN=j.lazy(()=>we(()=>import("./AvailableEscalationsPage-DvWaiafI.js"),__vite__mapDeps([53,1,54,4,14,55,56,6,57,58,59,13,60,21,17,61,9,10,20,12,5,7,8,23,33,16]),import.meta.url).then(i=>({default:i.AvailableEscalationsPage}))),bN=j.lazy(()=>we(()=>import("./OperatorDashboard-DSloftQ5.js"),__vite__mapDeps([62,1,4,5,6,7,8,54,9,10,12,33,58,14,59,13,60,21,17,61,20,56,16]),import.meta.url).then(i=>({default:i.OperatorDashboard}))),vN=j.lazy(()=>we(()=>import("./index-DsgjFRvA.js"),__vite__mapDeps([63,1,55,56,6,57,15,14,16,61,9,10,20,12,3,4,21,39,22,23]),import.meta.url).then(i=>({default:i.EscalationDetailPage}))),xN=j.lazy(()=>we(()=>import("./WorkflowsOverview-ucXPLTtm.js"),__vite__mapDeps([64,1,3,4,15,14,29,6]),import.meta.url).then(i=>({default:i.WorkflowsOverview}))),_N=j.lazy(()=>we(()=>import("./index-CDkg6iOE.js"),__vite__mapDeps([65,1,3,15,14,13,17,66,48,49,6]),import.meta.url).then(i=>({default:i.StartWorkflowPage}))),wN=j.lazy(()=>we(()=>import("./index-CDkg6iOE.js"),__vite__mapDeps([65,1,3,15,14,13,17,66,48,49,6]),import.meta.url).then(i=>({default:i.DurableInvokePage}))),SN=j.lazy(()=>we(()=>import("./WorkflowsDashboard-YTHDZZOD.js"),__vite__mapDeps([67,1,32,3,31,28,6,4,5,8,9,10,17,14,15,13,12,16,33]),import.meta.url).then(i=>({default:()=>i.WorkflowsDashboard({tier:"durable"})}))),EN=j.lazy(()=>we(()=>import("./WorkflowsDashboard-YTHDZZOD.js"),__vite__mapDeps([67,1,32,3,31,28,6,4,5,8,9,10,17,14,15,13,12,16,33]),import.meta.url).then(i=>({default:()=>i.WorkflowsDashboard({tier:"all"})}))),ON=j.lazy(()=>we(()=>import("./YamlWorkflowsPage-Usid3w2W.js"),__vite__mapDeps([68,1,27,5,6,15,14,13,10,50,66,20]),import.meta.url).then(i=>({default:i.YamlWorkflowsPage}))),AN=j.lazy(()=>we(()=>import("./GraphInvokePage-DfVeiN-8.js"),__vite__mapDeps([69,1,27,15,14,45,47,48,49,46,6,50,66]),import.meta.url).then(i=>({default:i.GraphInvokePage}))),jN=j.lazy(()=>we(()=>import("./YamlWorkflowDetailPage-C_RTZKqZ.js"),__vite__mapDeps([70,1,27,20,66,14,6]),import.meta.url).then(i=>({default:i.YamlWorkflowDetailPage}))),TN=j.lazy(()=>we(()=>import("./TasksListPage-iGriKiO2.js"),__vite__mapDeps([71,1,2,3,5,6,9,10,20,60,51,12,13,14,15,17]),import.meta.url).then(i=>({default:i.TasksListPage}))),NN=j.lazy(()=>we(()=>import("./TaskDetailPage-_XWLJzt-.js"),__vite__mapDeps([72,1,2,20,60,15,14,6]),import.meta.url).then(i=>({default:i.TaskDetailPage}))),eb=j.lazy(()=>we(()=>import("./WorkflowExecutionPage-1sKoEFNC.js"),__vite__mapDeps([73,1,3,4,36,13,14,37,20,6,38,2,15,35,16,39]),import.meta.url).then(i=>({default:i.WorkflowExecutionPage}))),kN=j.lazy(()=>we(()=>import("./AdminDashboard-D2unnS2b.js"),__vite__mapDeps([74,1,2,4,25,19,14,6]),import.meta.url).then(i=>({default:i.AdminDashboard}))),CN=j.lazy(()=>we(()=>import("./index-De8iV1y2.js"),__vite__mapDeps([75,1,3,9,10,13,14,33,5,6,15,76,17]),import.meta.url).then(i=>({default:i.WorkersPage}))),MN=j.lazy(()=>we(()=>import("./index-CgIBjZta.js"),__vite__mapDeps([77,1,3,13,14,78,56,6,21,17,15,48,49,66]),import.meta.url).then(i=>({default:i.WorkflowConfigsPage}))),tb=j.lazy(()=>we(()=>import("./index-CgIBjZta.js"),__vite__mapDeps([77,1,3,13,14,78,56,6,21,17,15,48,49,66]),import.meta.url).then(i=>({default:i.WorkflowConfigDetailPage}))),RN=j.lazy(()=>we(()=>import("./index-BhapT-Vl.js"),__vite__mapDeps([79,1,25,10,78,56,6,15,14,13,12,5,80,47,48,49,50,46,33,20]),import.meta.url).then(i=>({default:i.McpServersPage}))),nb=j.lazy(()=>we(()=>import("./index-C0hSttF5.js"),__vite__mapDeps([81,1,25,15,14,43,6]),import.meta.url).then(i=>({default:i.McpServerDetailPage}))),DN=j.lazy(()=>we(()=>import("./index-Bqm4zu46.js"),__vite__mapDeps([82,1,23,5,6,9,10,12,13,14,78,56,33,15,21,49,51,83,84,35]),import.meta.url).then(i=>({default:i.UsersPage}))),qN=j.lazy(()=>we(()=>import("./RolesPage-DeRVQux8.js"),__vite__mapDeps([85,1,13,14,15,21,56,6]),import.meta.url).then(i=>({default:i.RolesPage}))),BN=j.lazy(()=>we(()=>import("./RoleDetailPage-Dg1p6Qz_.js"),__vite__mapDeps([86,1,23,87,78,56,6,14]),import.meta.url).then(i=>({default:i.RoleDetailPage}))),LN=j.lazy(()=>we(()=>import("./PersonasPage-DnDDwXoy.js"),__vite__mapDeps([88,1,83,13,14,15,21,56,6,23,7]),import.meta.url).then(i=>({default:i.PersonasPage}))),zN=j.lazy(()=>we(()=>import("./PersonaDetailPage-jDVRCLbU.js"),__vite__mapDeps([89,1,83,21,14,84,87,78,56,6]),import.meta.url).then(i=>({default:i.PersonaDetailPage}))),UN=j.lazy(()=>we(()=>import("./EscalationSchemaPage-BsjS2axz.js"),__vite__mapDeps([90,1,14,6]),import.meta.url).then(i=>({default:i.EscalationSchemaPage}))),PN=j.lazy(()=>we(()=>import("./EscalationListSchemaPage-CdFtqEEX.js"),__vite__mapDeps([91,1,14,6]),import.meta.url).then(i=>({default:i.EscalationListSchemaPage}))),IN=j.lazy(()=>we(()=>import("./ScanCodesPage-D0GOdk5m.js"),__vite__mapDeps([92,1,15,14,6]),import.meta.url).then(i=>({default:i.ScanCodesPage}))),$N=j.lazy(()=>we(()=>import("./ScanSchemeDetailPage-vFqoe_P4.js"),__vite__mapDeps([93,1,78,56,6,15,14]),import.meta.url).then(i=>({default:i.ScanSchemeDetailPage}))),HN=j.lazy(()=>we(()=>import("./ScanStationPage-DH1ynTX9.js"),__vite__mapDeps([94,1,14,56,6]),import.meta.url).then(i=>({default:i.ScanStationPage}))),GN=j.lazy(()=>we(()=>import("./index-kes8V4Xw.js"),__vite__mapDeps([95,1,15,14,56,6,57]),import.meta.url).then(i=>({default:i.MaintenancePage}))),FN=j.lazy(()=>we(()=>import("./OperationsPage-DMsPXITh.js").then(i=>i.O),__vite__mapDeps([96,1,4,59,14,6,15]),import.meta.url).then(i=>({default:i.OperationsPage}))),VN=j.lazy(()=>we(()=>import("./index-B2hz0pUh.js"),__vite__mapDeps([97,1,19,14,13,5,6,31,28,56,44,76,9,10,33]),import.meta.url).then(i=>({default:i.ControlPlanePage}))),YN=j.lazy(()=>we(()=>import("./index-CVBBkW8V.js"),__vite__mapDeps([98,1,38,14,5,6,31,28,8,9,10,12,13,15,16]),import.meta.url).then(i=>({default:i.StreamMessagesPage}))),KN=j.lazy(()=>we(()=>import("./CredentialsPage-2TvvRwGJ.js"),__vite__mapDeps([99,1,15,14,51,78,56,6]),import.meta.url).then(i=>({default:i.CredentialsPage}))),XN=j.lazy(()=>we(()=>import("./index-nwLh3CK2.js"),__vite__mapDeps([100,1,6,15,14,13,16,8,10,101,51]),import.meta.url).then(i=>({default:i.FilesPage}))),JN=j.lazy(()=>we(()=>import("./index-B9m7fA3M.js"),__vite__mapDeps([102,1,15,14,13,16,12,10,101,51,103,43,6]),import.meta.url).then(i=>({default:i.KnowledgePage}))),QN=j.lazy(()=>we(()=>import("./HomePage-C2IhF9WB.js"),__vite__mapDeps([104,1,3,26,28,4,21,14,17,16,96,59,6,15,54]),import.meta.url).then(i=>({default:i.HomePage}))),ZN=j.lazy(()=>we(()=>import("./AgentsPage-qP9fWMyT.js"),__vite__mapDeps([105,1,106,4,5,6,8,9,10,12,13,14,15,16]),import.meta.url).then(i=>({default:i.AgentsPage}))),WN=j.lazy(()=>we(()=>import("./AgentDetailPage-CAIU3yzo.js"),__vite__mapDeps([107,1,106,108,14,4,17,6]),import.meta.url).then(i=>({default:i.AgentDetailPage}))),rb=j.lazy(()=>we(()=>import("./AgentConfigPage-CBkf403g.js"),__vite__mapDeps([109,1,106,108,14,15,103,47,48,49,3,27,110,111,17,6]),import.meta.url).then(i=>({default:i.AgentConfigPage}))),e3=j.lazy(()=>we(()=>import("./CapabilitiesPage-CJfmWokN.js"),__vite__mapDeps([112,1,110,80,25,47,48,49,14,50,6,46,15,13]),import.meta.url).then(i=>({default:i.CapabilitiesPage}))),t3=j.lazy(()=>we(()=>import("./TopicsPage-DEyvm669.js"),__vite__mapDeps([113,1,111,15,14,13,6]),import.meta.url).then(i=>({default:i.TopicsPage}))),n3=j.lazy(()=>we(()=>import("./TopicDetailPage-BaK8H0o1.js"),__vite__mapDeps([114,1,111,16,14,6]),import.meta.url).then(i=>({default:i.TopicDetailPage})));function r3(){return y.jsxs("div",{className:"animate-pulse space-y-4",children:[y.jsx("div",{className:"h-8 bg-surface-sunken rounded w-48"}),y.jsx("div",{className:"h-40 bg-surface-sunken rounded"})]})}function ve({children:i}){return y.jsx(j.Suspense,{fallback:y.jsx(r3,{}),children:y.jsx("div",{className:"animate-page-enter flex flex-col flex-1 min-h-0",children:i})})}const Iv=new W_({defaultOptions:{queries:{staleTime:1e4,retry:(i,t)=>t instanceof Error&&t.message==="Session expired"?!1:i<1}}});window.addEventListener("auth:unauthorized",()=>{Iv.clear(),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info");const i=window.__LT_BASE__||"",t=`${i}/login`;if(window.location.pathname!==t){const r=window.location.pathname+window.location.search,s=i&&r.startsWith(i)?r.slice(i.length)||"/":r;window.location.href=`${t}?returnTo=${encodeURIComponent(s)}`}});const i3=nw([{path:"/login",element:y.jsx(aN,{})},{path:"/connect/anthropic",element:y.jsx(W1,{})},{path:"/connect/:provider",element:y.jsx(W1,{})},{path:"/",element:y.jsx(rN,{}),children:[{index:!0,element:y.jsx(ve,{children:y.jsx(QN,{})})},{path:"processes/all",element:y.jsx(ve,{children:y.jsx(cN,{})})},{path:"processes/detail/:originId",element:y.jsx(ve,{children:y.jsx(uN,{})})},{path:"credentials",element:y.jsx(ve,{children:y.jsx(KN,{})})},{path:"connections",element:y.jsx(In,{to:"/credentials",replace:!0})},{path:"escalations",element:y.jsx(ve,{children:y.jsx(gN,{})})},{path:"escalations/available",element:y.jsx(ve,{children:y.jsx(yN,{})})},{path:"escalations/queue",element:y.jsx(ve,{children:y.jsx(bN,{})})},{path:"escalations/detail/:id",element:y.jsx(ve,{children:y.jsx(vN,{})})},{path:"scan/station",element:y.jsx(ve,{children:y.jsx(HN,{})})},{path:"capabilities",element:y.jsx(ve,{children:y.jsx(e3,{})})},{path:"agents",element:y.jsx(ve,{children:y.jsx(ZN,{})})},{path:"agents/new",element:y.jsx(ve,{children:y.jsx(rb,{})})},{path:"agents/:id",element:y.jsx(ve,{children:y.jsx(WN,{})})},{path:"agents/:id/edit",element:y.jsx(ve,{children:y.jsx(rb,{})})},{path:"topics",element:y.jsx(ve,{children:y.jsx(t3,{})})},{path:"topics/:topic",element:y.jsx(ve,{children:y.jsx(n3,{})})},{element:y.jsx(zc,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"workflows",element:y.jsx(ve,{children:y.jsx(xN,{})})},{path:"workflows/executions",element:y.jsx(ve,{children:y.jsx(EN,{})})},{path:"workflows/durable/executions",element:y.jsx(ve,{children:y.jsx(SN,{})})},{path:"workflows/durable/executions/:workflowId",element:y.jsx(ve,{children:y.jsx(eb,{})})},{path:"workflows/tasks",element:y.jsx(ve,{children:y.jsx(TN,{})})},{path:"workflows/tasks/detail/:id",element:y.jsx(ve,{children:y.jsx(NN,{})})},{path:"workflows/executions/:workflowId",element:y.jsx(ve,{children:y.jsx(eb,{})})},{path:"workflows/start",element:y.jsx(ve,{children:y.jsx(_N,{})})},{path:"workflows/durable/invoke",element:y.jsx(ve,{children:y.jsx(wN,{})})},{path:"workflows/cron",element:y.jsx(In,{to:"/workflows/start?mode=schedule",replace:!0})},{path:"workflows/workers",element:y.jsx(ve,{children:y.jsx(CN,{})})},{path:"workflows/registry",element:y.jsx(ve,{children:y.jsx(MN,{})})},{path:"workflows/registry/new",element:y.jsx(ve,{children:y.jsx(tb,{})})},{path:"workflows/registry/:workflowType",element:y.jsx(ve,{children:y.jsx(tb,{})})}]},{element:y.jsx(zc,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"mcp/workflows",element:y.jsx(ve,{children:y.jsx(ON,{})})},{path:"mcp/workflows/invoke",element:y.jsx(ve,{children:y.jsx(AN,{})})},{path:"mcp/workflows/:id",element:y.jsx(ve,{children:y.jsx(jN,{})})},{path:"mcp/executions",element:y.jsx(ve,{children:y.jsx(hN,{})})},{path:"mcp/executions/:jobId",element:y.jsx(ve,{children:y.jsx(dN,{})})},{path:"files",element:y.jsx(ve,{children:y.jsx(XN,{})})},{path:"knowledge",element:y.jsx(ve,{children:y.jsx(JN,{})})},{element:y.jsx(oN,{}),children:[{path:"mcp",element:y.jsx(ve,{children:y.jsx(fN,{})})},{path:"mcp/queries",element:y.jsx(ve,{children:y.jsx(mN,{})})},{path:"mcp/queries/:workflowId",element:y.jsx(ve,{children:y.jsx(pN,{})})},{path:"mcp/tools",element:y.jsx(In,{to:"/mcp/servers",replace:!0})},{path:"mcp/servers",element:y.jsx(ve,{children:y.jsx(RN,{})})},{path:"mcp/servers/new",element:y.jsx(ve,{children:y.jsx(nb,{})})},{path:"mcp/servers/:serverId",element:y.jsx(ve,{children:y.jsx(nb,{})})}]}]},{path:"operations",element:y.jsx(ve,{children:y.jsx(FN,{})})},{element:y.jsx(zc,{roleTypes:["admin","superadmin"],roleNames:["engineer"]}),children:[{path:"admin",element:y.jsx(ve,{children:y.jsx(kN,{})})},{path:"admin/users",element:y.jsx(ve,{children:y.jsx(DN,{})})},{path:"admin/escalation-chains",element:y.jsx(In,{to:"/admin/roles",replace:!0})},{path:"admin/roles",element:y.jsx(ve,{children:y.jsx(qN,{})})},{path:"admin/roles/:role",element:y.jsx(ve,{children:y.jsx(BN,{})})},{path:"admin/roles/:role/schema",element:y.jsx(ve,{children:y.jsx(UN,{})})},{path:"admin/roles/:role/list-schema",element:y.jsx(ve,{children:y.jsx(PN,{})})},{path:"admin/scan-codes",element:y.jsx(ve,{children:y.jsx(IN,{})})},{path:"admin/scan-codes/:version",element:y.jsx(ve,{children:y.jsx($N,{})})},{path:"admin/personas",element:y.jsx(ve,{children:y.jsx(LN,{})})},{path:"admin/personas/:key",element:y.jsx(ve,{children:y.jsx(zN,{})})}]},{element:y.jsx(zc,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"admin/bots",element:y.jsx(In,{to:"/admin/users?tab=service-accounts",replace:!0})},{element:y.jsx(lN,{flag:"dbMaintenance"}),children:[{path:"admin/maintenance",element:y.jsx(ve,{children:y.jsx(GN,{})})}]},{path:"admin/controlplane",element:y.jsx(ve,{children:y.jsx(VN,{})})},{path:"admin/streams",element:y.jsx(ve,{children:y.jsx(YN,{})})}]}]}],{basename:window.__LT_BASE__||"/"});function s3(){return y.jsx(ew,{client:Iv,children:y.jsx(Yw,{children:y.jsx(Q2,{children:y.jsx(rw,{router:i3})})})})}av(sv());const Zd=document.createElement("link");Zd.rel="stylesheet";Zd.href=`${jt}/api/settings/custom.css`;document.head.appendChild(Zd);Lw.createRoot(document.getElementById("root")).render(y.jsx(j.StrictMode,{children:y.jsx(s3,{})}));export{T3 as $,D3 as A,q3 as B,Kd as C,VT as D,B3 as E,Tv as F,z3 as G,h3 as H,Qb as I,dj as J,O3 as K,UA as L,tv as M,QE as N,ev as O,_3 as P,p3 as Q,Qd as R,tj as S,k3 as T,zA as U,Z3 as V,x3 as W,RO as X,Zl as Y,Xd as Z,Ev as _,tk as a,wO as a0,fv as a1,M3 as a2,L3 as a3,Yg as a4,uv as a5,Jd as a6,Uv as a7,W3 as a8,y3 as a9,rk as aA,Pv as aB,Hd as aC,Xb as aD,Q3 as aE,v3 as aa,b3 as ab,m3 as ac,d3 as ad,xd as ae,Ay as af,Rd as ag,J3 as ah,jt as ai,hb as aj,ek as ak,g3 as al,I3 as am,U3 as an,H3 as ao,F3 as ap,V3 as aq,$3 as ar,G3 as as,dv as at,IT as au,DO as av,P3 as aw,Pe as ax,S3 as ay,nk as az,FT as b,dO as c,w3 as d,u3 as e,$T as f,Ae as g,j3 as h,N3 as i,C3 as j,E3 as k,Fb as l,Jt as m,K3 as n,A3 as o,MO as p,X3 as q,Yd as r,BA as s,LA as t,Wn as u,$A as v,Y3 as w,Kb as x,aO as y,R3 as z};
65
- //# sourceMappingURL=index-DBXm49S6.js.map
63
+ `}function Cj(i){const t=i.summary,r=i.title;if(t){const s=t.search(/\n\s*\{[\s\S]*"title"\s*:/);return s>0?t.slice(0,s).trim():t}return r||(typeof i=="string"?i:"Query completed.")}const Dv=j.createContext(null);function Mj({children:i}){const t=gn(),[r,s]=j.useState(!1),[l,c]=j.useState([]),[d,p]=j.useState(null),[y,f]=j.useState({}),m=j.useRef(null),b={page:t.pathname.split("/").filter(Boolean).join("-")||"home",route:t.pathname,params:{},...y,suggestedTags:y.suggestedTags??Nj(t.pathname)};j.useEffect(()=>()=>{m.current&&clearInterval(m.current)},[]);const v=j.useCallback(()=>s(B=>!B),[]),_=j.useCallback(B=>{f(B)},[]),w=j.useCallback(()=>{c([]),p(null)},[]),S=j.useCallback(async B=>{var X;const U=new Date().toISOString(),ie={id:`user-${Date.now()}`,role:"user",content:B,timestamp:U},ce={id:`pending-${Date.now()}`,role:"assistant",content:"",timestamp:U,pending:!0};c(L=>[...L,ie,ce]);const C={...b};(X=C.entities)!=null&&X.yamlContent&&C.entities.yamlContent.length>P1&&(C.entities={...C.entities,yamlContent:C.entities.yamlContent.slice(0,P1)+`
64
+ ... (truncated)`});const re=`${kj(l.concat(ie))}${B}`;try{const G=(await Oe("/insight/mcp-query",{method:"POST",body:JSON.stringify({prompt:re,tags:C.suggestedTags,context:C,wait:!1,direct:!0})})).workflow_id;p(G),c(W=>W.map(Q=>Q.id===ce.id?{...Q,workflowId:G}:Q)),m.current&&clearInterval(m.current),m.current=setInterval(async()=>{var W;try{const Q=await Oe(`/workflows/${G}/result`),he=(W=Q==null?void 0:Q.result)==null?void 0:W.data;if(he){m.current&&clearInterval(m.current),m.current=null,p(null);const _e=Cj(he);let Te;try{Te=(await Oe(`/workflow-states/${G}/execution`)).duration_ms}catch{}c(Y=>Y.map(ae=>ae.id===ce.id?{...ae,content:_e,timestamp:new Date().toISOString(),pending:!1,durationMs:Te}:ae))}}catch{}},3e3)}catch{c(L=>L.map(G=>G.id===ce.id?{...G,content:"Failed to submit query. Please try again.",pending:!1}:G))}},[l,b]),M=j.useCallback(async B=>{const U=l.find(C=>C.id===B);if(!(U!=null&&U.workflowId)||U.compilationStatus==="compiling"||U.compilationStatus==="done")return;const ie=l.indexOf(U),ce=l.slice(0,ie).reverse().find(C=>C.role==="user");if(ce){c(C=>C.map(z=>z.id===B?{...z,compilationStatus:"compiling"}:z));try{const C=await Oe("/insight/mcp-query/describe",{method:"POST",body:JSON.stringify({prompt:ce.content,summary:U.content})}),z=await Oe("/yaml-workflows",{method:"POST",body:JSON.stringify({workflow_id:U.workflowId,task_queue:"long-tail-system",workflow_name:"mcpQuery",name:C.tool_name,description:C.description,tags:C.tags,app_id:""})});await Oe(`/yaml-workflows/${z.id}/deploy`,{method:"POST"}),c(re=>re.map(X=>X.id===B?{...X,compilationStatus:"done"}:X))}catch(C){const z=C instanceof Error?C.message:"Compilation failed";c(re=>re.map(X=>X.id===B?{...X,compilationStatus:"error",compilationError:z}:X))}}},[l]);return g.jsx(Dv.Provider,{value:{helpOpen:r,setHelpOpen:s,toggleHelp:v,messages:l,sendMessage:S,pageContext:b,setPageContext:_,activeWorkflowId:d,clearMessages:w,compileMessage:M},children:i})}function qv(){const i=j.useContext(Dv);if(!i)throw new Error("useHelpAssistant must be used within HelpAssistantProvider");return i}function Rj(){const{helpOpen:i,toggleHelp:t}=qv();return g.jsx("button",{onClick:t,className:"fixed right-3 z-[45] flex items-center justify-center w-10 h-10 rounded-full bg-surface-raised shadow-lg hover:scale-110 transition-transform duration-150 border border-accent/30",style:{bottom:"44px"},"aria-label":i?"Close help":"Ask for help",children:i?g.jsx(dn,{className:"w-5 h-5 text-text-tertiary",strokeWidth:1.5}):g.jsx("span",{role:"img","aria-label":"Help",className:"logo-mark w-8 h-8 -rotate-[120deg]",style:{"--logo-url":`url(${jt}/logo512.png)`}})})}const Bv=6048e5,Dj=864e5,I1=6e4,$1=525600,H1=43200,G1=1440,F1=Symbol.for("constructDateFrom");function Or(i,t){return typeof i=="function"?i(t):i&&typeof i=="object"&&F1 in i?i[F1](t):i instanceof Date?new i.constructor(t):new Date(t)}function pn(i,t){return Or(t||i,i)}let qj={};function So(){return qj}function po(i,t){var p,y,f,m;const r=So(),s=(t==null?void 0:t.weekStartsOn)??((y=(p=t==null?void 0:t.locale)==null?void 0:p.options)==null?void 0:y.weekStartsOn)??r.weekStartsOn??((m=(f=r.locale)==null?void 0:f.options)==null?void 0:m.weekStartsOn)??0,l=pn(i,t==null?void 0:t.in),c=l.getDay(),d=(c<s?7:0)+c-s;return l.setDate(l.getDate()-d),l.setHours(0,0,0,0),l}function su(i,t){return po(i,{...t,weekStartsOn:1})}function Lv(i,t){const r=pn(i,t==null?void 0:t.in),s=r.getFullYear(),l=Or(r,0);l.setFullYear(s+1,0,4),l.setHours(0,0,0,0);const c=su(l),d=Or(r,0);d.setFullYear(s,0,4),d.setHours(0,0,0,0);const p=su(d);return r.getTime()>=c.getTime()?s+1:r.getTime()>=p.getTime()?s:s-1}function au(i){const t=pn(i),r=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return r.setUTCFullYear(t.getFullYear()),+i-+r}function zv(i,...t){const r=Or.bind(null,i||t.find(s=>typeof s=="object"));return t.map(r)}function V1(i,t){const r=pn(i,t==null?void 0:t.in);return r.setHours(0,0,0,0),r}function Bj(i,t,r){const[s,l]=zv(r==null?void 0:r.in,i,t),c=V1(s),d=V1(l),p=+c-au(c),y=+d-au(d);return Math.round((p-y)/Dj)}function Lj(i,t){const r=Lv(i,t),s=Or(i,0);return s.setFullYear(r,0,4),s.setHours(0,0,0,0),su(s)}function zj(i,t){const r=+pn(i)-+pn(t);return r<0?-1:r>0?1:r}function Uj(i){return Or(i,Date.now())}function Pj(i){return i instanceof Date||typeof i=="object"&&Object.prototype.toString.call(i)==="[object Date]"}function Ij(i){return!(!Pj(i)&&typeof i!="number"||isNaN(+pn(i)))}function $j(i){return t=>{const s=(i?Math[i]:Math.trunc)(t);return s===0?0:s}}function Hj(i,t){const r=pn(i,t==null?void 0:t.in);return r.setFullYear(r.getFullYear(),0,1),r.setHours(0,0,0,0),r}const Gj={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"}},Fj=(i,t,r)=>{let s;const l=Gj[i];return typeof l=="string"?s=l:t===1?s=l.one:s=l.other.replace("{{count}}",t.toString()),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"in "+s:s+" ago":s};function Kh(i){return(t={})=>{const r=t.width?String(t.width):i.defaultWidth;return i.formats[r]||i.formats[i.defaultWidth]}}const Vj={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Yj={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Kj={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Xj={date:Kh({formats:Vj,defaultWidth:"full"}),time:Kh({formats:Yj,defaultWidth:"full"}),dateTime:Kh({formats:Kj,defaultWidth:"full"})},Jj={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Qj=(i,t,r,s)=>Jj[i];function eo(i){return(t,r)=>{const s=r!=null&&r.context?String(r.context):"standalone";let l;if(s==="formatting"&&i.formattingValues){const d=i.defaultFormattingWidth||i.defaultWidth,p=r!=null&&r.width?String(r.width):d;l=i.formattingValues[p]||i.formattingValues[d]}else{const d=i.defaultWidth,p=r!=null&&r.width?String(r.width):i.defaultWidth;l=i.values[p]||i.values[d]}const c=i.argumentCallback?i.argumentCallback(t):t;return l[c]}}const Zj={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Wj={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},eT={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"]},tT={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"]},nT={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"}},rT={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"}},iT=(i,t)=>{const r=Number(i),s=r%100;if(s>20||s<10)switch(s%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},sT={ordinalNumber:iT,era:eo({values:Zj,defaultWidth:"wide"}),quarter:eo({values:Wj,defaultWidth:"wide",argumentCallback:i=>i-1}),month:eo({values:eT,defaultWidth:"wide"}),day:eo({values:tT,defaultWidth:"wide"}),dayPeriod:eo({values:nT,defaultWidth:"wide",formattingValues:rT,defaultFormattingWidth:"wide"})};function to(i){return(t,r={})=>{const s=r.width,l=s&&i.matchPatterns[s]||i.matchPatterns[i.defaultMatchWidth],c=t.match(l);if(!c)return null;const d=c[0],p=s&&i.parsePatterns[s]||i.parsePatterns[i.defaultParseWidth],y=Array.isArray(p)?oT(p,b=>b.test(d)):aT(p,b=>b.test(d));let f;f=i.valueCallback?i.valueCallback(y):y,f=r.valueCallback?r.valueCallback(f):f;const m=t.slice(d.length);return{value:f,rest:m}}}function aT(i,t){for(const r in i)if(Object.prototype.hasOwnProperty.call(i,r)&&t(i[r]))return r}function oT(i,t){for(let r=0;r<i.length;r++)if(t(i[r]))return r}function lT(i){return(t,r={})=>{const s=t.match(i.matchPattern);if(!s)return null;const l=s[0],c=t.match(i.parsePattern);if(!c)return null;let d=i.valueCallback?i.valueCallback(c[0]):c[0];d=r.valueCallback?r.valueCallback(d):d;const p=t.slice(l.length);return{value:d,rest:p}}}const cT=/^(\d+)(th|st|nd|rd)?/i,uT=/\d+/i,fT={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},hT={any:[/^b/i,/^(a|c)/i]},dT={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},mT={any:[/1/i,/2/i,/3/i,/4/i]},pT={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},gT={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]},yT={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},bT={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]},vT={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},xT={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}},_T={ordinalNumber:lT({matchPattern:cT,parsePattern:uT,valueCallback:i=>parseInt(i,10)}),era:to({matchPatterns:fT,defaultMatchWidth:"wide",parsePatterns:hT,defaultParseWidth:"any"}),quarter:to({matchPatterns:dT,defaultMatchWidth:"wide",parsePatterns:mT,defaultParseWidth:"any",valueCallback:i=>i+1}),month:to({matchPatterns:pT,defaultMatchWidth:"wide",parsePatterns:gT,defaultParseWidth:"any"}),day:to({matchPatterns:yT,defaultMatchWidth:"wide",parsePatterns:bT,defaultParseWidth:"any"}),dayPeriod:to({matchPatterns:vT,defaultMatchWidth:"any",parsePatterns:xT,defaultParseWidth:"any"})},Uv={code:"en-US",formatDistance:Fj,formatLong:Xj,formatRelative:Qj,localize:sT,match:_T,options:{weekStartsOn:0,firstWeekContainsDate:1}};function wT(i,t){const r=pn(i,t==null?void 0:t.in);return Bj(r,Hj(r))+1}function ST(i,t){const r=pn(i,t==null?void 0:t.in),s=+su(r)-+Lj(r);return Math.round(s/Bv)+1}function Pv(i,t){var m,b,v,_;const r=pn(i,t==null?void 0:t.in),s=r.getFullYear(),l=So(),c=(t==null?void 0:t.firstWeekContainsDate)??((b=(m=t==null?void 0:t.locale)==null?void 0:m.options)==null?void 0:b.firstWeekContainsDate)??l.firstWeekContainsDate??((_=(v=l.locale)==null?void 0:v.options)==null?void 0:_.firstWeekContainsDate)??1,d=Or((t==null?void 0:t.in)||i,0);d.setFullYear(s+1,0,c),d.setHours(0,0,0,0);const p=po(d,t),y=Or((t==null?void 0:t.in)||i,0);y.setFullYear(s,0,c),y.setHours(0,0,0,0);const f=po(y,t);return+r>=+p?s+1:+r>=+f?s:s-1}function ET(i,t){var p,y,f,m;const r=So(),s=(t==null?void 0:t.firstWeekContainsDate)??((y=(p=t==null?void 0:t.locale)==null?void 0:p.options)==null?void 0:y.firstWeekContainsDate)??r.firstWeekContainsDate??((m=(f=r.locale)==null?void 0:f.options)==null?void 0:m.firstWeekContainsDate)??1,l=Pv(i,t),c=Or((t==null?void 0:t.in)||i,0);return c.setFullYear(l,0,s),c.setHours(0,0,0,0),po(c,t)}function OT(i,t){const r=pn(i,t==null?void 0:t.in),s=+po(r,t)-+ET(r,t);return Math.round(s/Bv)+1}function Ye(i,t){const r=i<0?"-":"",s=Math.abs(i).toString().padStart(t,"0");return r+s}const ii={y(i,t){const r=i.getFullYear(),s=r>0?r:1-r;return Ye(t==="yy"?s%100:s,t.length)},M(i,t){const r=i.getMonth();return t==="M"?String(r+1):Ye(r+1,2)},d(i,t){return Ye(i.getDate(),t.length)},a(i,t){const r=i.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];case"aaaa":default:return r==="am"?"a.m.":"p.m."}},h(i,t){return Ye(i.getHours()%12||12,t.length)},H(i,t){return Ye(i.getHours(),t.length)},m(i,t){return Ye(i.getMinutes(),t.length)},s(i,t){return Ye(i.getSeconds(),t.length)},S(i,t){const r=t.length,s=i.getMilliseconds(),l=Math.trunc(s*Math.pow(10,r-3));return Ye(l,t.length)}},qs={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Y1={G:function(i,t,r){const s=i.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return r.era(s,{width:"abbreviated"});case"GGGGG":return r.era(s,{width:"narrow"});case"GGGG":default:return r.era(s,{width:"wide"})}},y:function(i,t,r){if(t==="yo"){const s=i.getFullYear(),l=s>0?s:1-s;return r.ordinalNumber(l,{unit:"year"})}return ii.y(i,t)},Y:function(i,t,r,s){const l=Pv(i,s),c=l>0?l:1-l;if(t==="YY"){const d=c%100;return Ye(d,2)}return t==="Yo"?r.ordinalNumber(c,{unit:"year"}):Ye(c,t.length)},R:function(i,t){const r=Lv(i);return Ye(r,t.length)},u:function(i,t){const r=i.getFullYear();return Ye(r,t.length)},Q:function(i,t,r){const s=Math.ceil((i.getMonth()+1)/3);switch(t){case"Q":return String(s);case"QQ":return Ye(s,2);case"Qo":return r.ordinalNumber(s,{unit:"quarter"});case"QQQ":return r.quarter(s,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(s,{width:"narrow",context:"formatting"});case"QQQQ":default:return r.quarter(s,{width:"wide",context:"formatting"})}},q:function(i,t,r){const s=Math.ceil((i.getMonth()+1)/3);switch(t){case"q":return String(s);case"qq":return Ye(s,2);case"qo":return r.ordinalNumber(s,{unit:"quarter"});case"qqq":return r.quarter(s,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(s,{width:"narrow",context:"standalone"});case"qqqq":default:return r.quarter(s,{width:"wide",context:"standalone"})}},M:function(i,t,r){const s=i.getMonth();switch(t){case"M":case"MM":return ii.M(i,t);case"Mo":return r.ordinalNumber(s+1,{unit:"month"});case"MMM":return r.month(s,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(s,{width:"narrow",context:"formatting"});case"MMMM":default:return r.month(s,{width:"wide",context:"formatting"})}},L:function(i,t,r){const s=i.getMonth();switch(t){case"L":return String(s+1);case"LL":return Ye(s+1,2);case"Lo":return r.ordinalNumber(s+1,{unit:"month"});case"LLL":return r.month(s,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(s,{width:"narrow",context:"standalone"});case"LLLL":default:return r.month(s,{width:"wide",context:"standalone"})}},w:function(i,t,r,s){const l=OT(i,s);return t==="wo"?r.ordinalNumber(l,{unit:"week"}):Ye(l,t.length)},I:function(i,t,r){const s=ST(i);return t==="Io"?r.ordinalNumber(s,{unit:"week"}):Ye(s,t.length)},d:function(i,t,r){return t==="do"?r.ordinalNumber(i.getDate(),{unit:"date"}):ii.d(i,t)},D:function(i,t,r){const s=wT(i);return t==="Do"?r.ordinalNumber(s,{unit:"dayOfYear"}):Ye(s,t.length)},E:function(i,t,r){const s=i.getDay();switch(t){case"E":case"EE":case"EEE":return r.day(s,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(s,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(s,{width:"short",context:"formatting"});case"EEEE":default:return r.day(s,{width:"wide",context:"formatting"})}},e:function(i,t,r,s){const l=i.getDay(),c=(l-s.weekStartsOn+8)%7||7;switch(t){case"e":return String(c);case"ee":return Ye(c,2);case"eo":return r.ordinalNumber(c,{unit:"day"});case"eee":return r.day(l,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(l,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(l,{width:"short",context:"formatting"});case"eeee":default:return r.day(l,{width:"wide",context:"formatting"})}},c:function(i,t,r,s){const l=i.getDay(),c=(l-s.weekStartsOn+8)%7||7;switch(t){case"c":return String(c);case"cc":return Ye(c,t.length);case"co":return r.ordinalNumber(c,{unit:"day"});case"ccc":return r.day(l,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(l,{width:"narrow",context:"standalone"});case"cccccc":return r.day(l,{width:"short",context:"standalone"});case"cccc":default:return r.day(l,{width:"wide",context:"standalone"})}},i:function(i,t,r){const s=i.getDay(),l=s===0?7:s;switch(t){case"i":return String(l);case"ii":return Ye(l,t.length);case"io":return r.ordinalNumber(l,{unit:"day"});case"iii":return r.day(s,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(s,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(s,{width:"short",context:"formatting"});case"iiii":default:return r.day(s,{width:"wide",context:"formatting"})}},a:function(i,t,r){const l=i.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.dayPeriod(l,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(l,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(l,{width:"narrow",context:"formatting"});case"aaaa":default:return r.dayPeriod(l,{width:"wide",context:"formatting"})}},b:function(i,t,r){const s=i.getHours();let l;switch(s===12?l=qs.noon:s===0?l=qs.midnight:l=s/12>=1?"pm":"am",t){case"b":case"bb":return r.dayPeriod(l,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(l,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(l,{width:"narrow",context:"formatting"});case"bbbb":default:return r.dayPeriod(l,{width:"wide",context:"formatting"})}},B:function(i,t,r){const s=i.getHours();let l;switch(s>=17?l=qs.evening:s>=12?l=qs.afternoon:s>=4?l=qs.morning:l=qs.night,t){case"B":case"BB":case"BBB":return r.dayPeriod(l,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(l,{width:"narrow",context:"formatting"});case"BBBB":default:return r.dayPeriod(l,{width:"wide",context:"formatting"})}},h:function(i,t,r){if(t==="ho"){let s=i.getHours()%12;return s===0&&(s=12),r.ordinalNumber(s,{unit:"hour"})}return ii.h(i,t)},H:function(i,t,r){return t==="Ho"?r.ordinalNumber(i.getHours(),{unit:"hour"}):ii.H(i,t)},K:function(i,t,r){const s=i.getHours()%12;return t==="Ko"?r.ordinalNumber(s,{unit:"hour"}):Ye(s,t.length)},k:function(i,t,r){let s=i.getHours();return s===0&&(s=24),t==="ko"?r.ordinalNumber(s,{unit:"hour"}):Ye(s,t.length)},m:function(i,t,r){return t==="mo"?r.ordinalNumber(i.getMinutes(),{unit:"minute"}):ii.m(i,t)},s:function(i,t,r){return t==="so"?r.ordinalNumber(i.getSeconds(),{unit:"second"}):ii.s(i,t)},S:function(i,t){return ii.S(i,t)},X:function(i,t,r){const s=i.getTimezoneOffset();if(s===0)return"Z";switch(t){case"X":return X1(s);case"XXXX":case"XX":return Pi(s);case"XXXXX":case"XXX":default:return Pi(s,":")}},x:function(i,t,r){const s=i.getTimezoneOffset();switch(t){case"x":return X1(s);case"xxxx":case"xx":return Pi(s);case"xxxxx":case"xxx":default:return Pi(s,":")}},O:function(i,t,r){const s=i.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+K1(s,":");case"OOOO":default:return"GMT"+Pi(s,":")}},z:function(i,t,r){const s=i.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+K1(s,":");case"zzzz":default:return"GMT"+Pi(s,":")}},t:function(i,t,r){const s=Math.trunc(+i/1e3);return Ye(s,t.length)},T:function(i,t,r){return Ye(+i,t.length)}};function K1(i,t=""){const r=i>0?"-":"+",s=Math.abs(i),l=Math.trunc(s/60),c=s%60;return c===0?r+String(l):r+String(l)+t+Ye(c,2)}function X1(i,t){return i%60===0?(i>0?"-":"+")+Ye(Math.abs(i)/60,2):Pi(i,t)}function Pi(i,t=""){const r=i>0?"-":"+",s=Math.abs(i),l=Ye(Math.trunc(s/60),2),c=Ye(s%60,2);return r+l+t+c}const J1=(i,t)=>{switch(i){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},Iv=(i,t)=>{switch(i){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},AT=(i,t)=>{const r=i.match(/(P+)(p+)?/)||[],s=r[1],l=r[2];if(!l)return J1(i,t);let c;switch(s){case"P":c=t.dateTime({width:"short"});break;case"PP":c=t.dateTime({width:"medium"});break;case"PPP":c=t.dateTime({width:"long"});break;case"PPPP":default:c=t.dateTime({width:"full"});break}return c.replace("{{date}}",J1(s,t)).replace("{{time}}",Iv(l,t))},jT={p:Iv,P:AT},TT=/^D+$/,NT=/^Y+$/,kT=["D","DD","YY","YYYY"];function CT(i){return TT.test(i)}function MT(i){return NT.test(i)}function RT(i,t,r){const s=DT(i,t,r);if(console.warn(s),kT.includes(i))throw new RangeError(s)}function DT(i,t,r){const s=i[0]==="Y"?"years":"days of the month";return`Use \`${i.toLowerCase()}\` instead of \`${i}\` (in \`${t}\`) for formatting ${s} to the input \`${r}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const qT=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,BT=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,LT=/^'([^]*?)'?$/,zT=/''/g,UT=/[a-zA-Z]/;function Jd(i,t,r){var m,b,v,_;const s=So(),l=s.locale??Uv,c=s.firstWeekContainsDate??((b=(m=s.locale)==null?void 0:m.options)==null?void 0:b.firstWeekContainsDate)??1,d=s.weekStartsOn??((_=(v=s.locale)==null?void 0:v.options)==null?void 0:_.weekStartsOn)??0,p=pn(i,r==null?void 0:r.in);if(!Ij(p))throw new RangeError("Invalid time value");let y=t.match(BT).map(w=>{const S=w[0];if(S==="p"||S==="P"){const M=jT[S];return M(w,l.formatLong)}return w}).join("").match(qT).map(w=>{if(w==="''")return{isToken:!1,value:"'"};const S=w[0];if(S==="'")return{isToken:!1,value:PT(w)};if(Y1[S])return{isToken:!0,value:w};if(S.match(UT))throw new RangeError("Format string contains an unescaped latin alphabet character `"+S+"`");return{isToken:!1,value:w}});l.localize.preprocessor&&(y=l.localize.preprocessor(p,y));const f={firstWeekContainsDate:c,weekStartsOn:d,locale:l};return y.map(w=>{if(!w.isToken)return w.value;const S=w.value;(MT(S)||CT(S))&&RT(S,t,String(i));const M=Y1[S[0]];return M(p,S,l.localize,f)}).join("")}function PT(i){const t=i.match(LT);return t?t[1].replace(zT,"'"):i}function IT(i,t,r){const s=So(),l=(r==null?void 0:r.locale)??s.locale??Uv,c=zj(i,t);if(isNaN(c))throw new RangeError("Invalid time value");const d=Object.assign({},r,{addSuffix:r==null?void 0:r.addSuffix,comparison:c}),[p,y]=zv(r==null?void 0:r.in,...c>0?[t,i]:[i,t]),f=$j((r==null?void 0:r.roundingMethod)??"round"),m=y.getTime()-p.getTime(),b=m/I1,v=au(y)-au(p),_=(m-v)/I1,w=r==null?void 0:r.unit;let S;if(w?S=w:b<1?S="second":b<60?S="minute":b<G1?S="hour":_<H1?S="day":_<$1?S="month":S="year",S==="second"){const M=f(m/1e3);return l.formatDistance("xSeconds",M,d)}else if(S==="minute"){const M=f(b);return l.formatDistance("xMinutes",M,d)}else if(S==="hour"){const M=f(b/60);return l.formatDistance("xHours",M,d)}else if(S==="day"){const M=f(_/G1);return l.formatDistance("xDays",M,d)}else if(S==="month"){const M=f(_/H1);return M===12&&w!=="month"?l.formatDistance("xYears",1,d):l.formatDistance("xMonths",M,d)}else{const M=f(_/$1);return l.formatDistance("xYears",M,d)}}function $T(i,t){return IT(i,Uj(i),t)}function rk(i){return i.toLocaleString()}function ik(i){return i>=1e9?`${(i/1e9).toFixed(1).replace(/\.0$/,"")}B`:i>=1e6?`${(i/1e6).toFixed(1).replace(/\.0$/,"")}M`:i>=1e4?`${(i/1e3).toFixed(1).replace(/\.0$/,"")}K`:i.toLocaleString()}function HT(i){const t=new Date(i);return t.getTime()>Date.now()?"just now":$T(t,{addSuffix:!0})}function sk(i){const t=Date.now()-new Date(i).getTime();if(t<0)return"now";const r=Math.floor(t/1e3);if(r<60)return`${r}s`;const s=Math.floor(r/60);if(s<60)return`${s}m`;const l=Math.floor(s/60);if(l<24)return`${l}h`;const c=Math.floor(l/24);return c<7?`${c}d`:c<30?`${Math.floor(c/7)}w`:c<365?`${Math.floor(c/30)}mo`:`${Math.floor(c/365)}y`}function ak(i){return i<=0?"Expired":Qd(i)}function GT(i){return i==null?"--":Qd(i)}function ok(i){return i?Jd(new Date(i),"MMM d, yyyy h:mm a"):"--"}function Qd(i){if(i<1e3)return`${Math.round(i)}ms`;if(i<6e4){const d=i/1e3;return Number.isInteger(d)?`${d}s`:`${d.toFixed(1)}s`}const t=Math.floor(i/1e3),r=Math.floor(t/86400),s=Math.floor(t%86400/3600),l=Math.floor(t%3600/60),c=t%60;return r>0?s>0?`${r}d ${s}h`:`${r}d`:s>0?l>0?`${s}h ${l}m`:`${s}h`:c>0?`${l}m ${c}s`:`${l}m`}function lk(i,t){const r=new Date(i).getTime(),s=t?new Date(t).getTime():Date.now();return Qd(s-r)}function $v({options:i,children:t,className:r=""}){const[s,l]=j.useState(!1),[c,d]=j.useState(null),[p,y]=j.useState(null),f=j.useRef(null),m=j.useRef(void 0),b=j.useRef(void 0),v=220,_=j.useCallback(()=>{if(!f.current)return;const B=f.current.getBoundingClientRect(),U=window.innerWidth-v-8,ie=Math.max(8,Math.min(B.left,U));y({top:B.bottom+4,left:ie})},[]),w=j.useCallback(async(B,U)=>{try{await navigator.clipboard.writeText(B),d(U),clearTimeout(m.current),m.current=setTimeout(()=>d(null),1200)}catch{}},[]),S=j.useCallback(()=>{clearTimeout(b.current),_(),l(!0)},[_]),M=j.useCallback(()=>{b.current=setTimeout(()=>l(!1),150)},[]);return j.useEffect(()=>()=>{clearTimeout(m.current),clearTimeout(b.current)},[]),g.jsxs("span",{ref:f,className:`inline-flex items-center cursor-default ${r}`,onMouseEnter:S,onMouseLeave:M,children:[t,s&&p&&ib.createPortal(g.jsx("span",{className:"fixed z-[9999] bg-surface-raised border border-surface-border rounded shadow-lg py-1 min-w-[180px]",style:{top:p.top,left:p.left},onMouseEnter:S,onMouseLeave:M,children:i.map(B=>g.jsxs("button",{onClick:U=>{U.stopPropagation(),w(B.value,B.label)},className:"flex items-center justify-between w-full px-2.5 py-1 text-left hover:bg-surface-hover transition-colors",children:[g.jsx("span",{className:"text-2xs font-medium uppercase tracking-wider text-text-tertiary w-10 shrink-0",children:B.label}),g.jsx("span",{className:"text-2xs font-mono text-text-secondary truncate ml-2",children:c===B.label?"✓":B.value})]},B.label))}),document.body)]})}function FT(i,t){const r=new Date(i);switch(t){case"relative":return HT(i);case"datetime":return Jd(r,"MMM d, yyyy h:mm a");case"time":return r.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}}function VT(i){const t=new Date(i);return[{label:"ms",value:String(t.getTime())},{label:"utc",value:t.toISOString()},{label:"local",value:Jd(t,"MMM d, yyyy h:mm:ss a")}]}function YT({date:i,format:t="relative",className:r=""}){const[,s]=j.useState(0);j.useEffect(()=>{if(t!=="relative")return;const c=setInterval(()=>s(d=>d+1),3e4);return()=>clearInterval(c)},[t]);const l=j.useMemo(()=>VT(i),[i]);return g.jsx($v,{options:l,children:g.jsx("time",{dateTime:i,className:`text-xs text-text-tertiary ${r}`,children:FT(i,t)})})}function KT({ms:i,className:t=""}){const r=GT(i),s=j.useMemo(()=>i==null?[]:[{label:"ms",value:String(i)},{label:"sec",value:`${(i/1e3).toFixed(3)}s`},{label:"text",value:r}],[i,r]);return i==null?g.jsx("span",{className:`text-xs text-text-tertiary ${t}`,children:"--"}):g.jsx($v,{options:s,children:g.jsx("span",{className:`text-xs text-text-tertiary ${t}`,children:r})})}const XT=["sm","md","lg","full"],Q1={sm:"w-[28rem] max-h-[40vh]",md:"w-[36rem] max-h-[60vh]",lg:"w-[48rem] max-h-[80vh]",full:"inset-4 w-auto max-h-none"},Z1={sm:"Small",md:"Medium",lg:"Large",full:"Fullscreen"};function JT({which:i}){const t="stroke-current";switch(i){case"sm":return g.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:g.jsx("rect",{x:"5",y:"5",width:"7",height:"7",rx:"1.5",className:t,strokeWidth:"1.5"})});case"md":return g.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:g.jsx("rect",{x:"3",y:"3",width:"9",height:"9",rx:"1.5",className:t,strokeWidth:"1.5"})});case"lg":return g.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:g.jsx("rect",{x:"1.5",y:"1.5",width:"11",height:"11",rx:"1.5",className:t,strokeWidth:"1.5"})});case"full":return g.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:g.jsx("rect",{x:"0.75",y:"0.75",width:"12.5",height:"12.5",rx:"1.5",className:t,strokeWidth:"1.5"})})}}function QT({msg:i}){const[t,r]=j.useState(0);j.useEffect(()=>{const d=new Date(i.timestamp).getTime(),p=()=>r(Math.floor((Date.now()-d)/1e3));p();const y=setInterval(p,1e3);return()=>clearInterval(y)},[i.timestamp]);const s=Math.floor(t/60),l=t%60,c=s>0?`${s}m ${l}s`:`${l}s`;return g.jsxs("span",{className:"inline-flex flex-col gap-1.5",children:[g.jsxs("span",{className:"inline-flex items-center gap-1",children:[g.jsx("span",{className:"text-text-tertiary",children:"Thinking"}),g.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse"}),g.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse [animation-delay:150ms]"}),g.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse [animation-delay:300ms]"}),g.jsx("span",{className:"text-text-muted ml-1 tabular-nums",children:c})]}),i.workflowId&&g.jsxs(Ii,{to:`/workflows/executions/${i.workflowId}`,className:"inline-flex items-center gap-1 text-2xs text-accent/70 hover:text-accent transition-colors",children:[g.jsx(Ed,{className:"w-2.5 h-2.5",strokeWidth:1.5}),"watch execution"]})]})}function ZT({msg:i,compileMessage:t}){const r=i.role==="assistant";return g.jsxs("div",{className:`flex items-center gap-1.5 ${r?"justify-start":"justify-end"}`,children:[g.jsx(YT,{date:i.timestamp,format:"time",className:"!text-2xs text-text-muted/50"}),i.durationMs!=null&&g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"text-text-muted/30 text-2xs",children:"·"}),g.jsx(KT,{ms:i.durationMs,className:"!text-2xs text-text-muted/50"})]}),i.workflowId&&g.jsx(Ii,{to:`/workflows/executions/${i.workflowId}`,className:"text-text-muted/40 hover:text-accent transition-colors",title:"View workflow execution",children:g.jsx(Ed,{className:"w-2.5 h-2.5",strokeWidth:1.5})}),r&&i.workflowId&&!i.pending&&g.jsx("button",{onClick:()=>t(i.id),disabled:i.compilationStatus==="compiling"||i.compilationStatus==="done",className:"transition-colors",title:i.compilationStatus==="done"?"Compiled — future queries will match this pipeline":i.compilationStatus==="error"?i.compilationError??"Compilation failed":i.compilationStatus==="compiling"?"Compiling...":"Compile to fast pipeline",children:g.jsx(kw,{className:`w-2.5 h-2.5 ${i.compilationStatus==="done"?"text-status-success":i.compilationStatus==="error"?"text-status-error":i.compilationStatus==="compiling"?"text-accent/40 animate-pulse":"text-text-muted/40 hover:text-accent"}`,strokeWidth:1.5})})]})}function WT(){const{helpOpen:i,setHelpOpen:t,messages:r,sendMessage:s,pageContext:l,activeWorkflowId:c,clearMessages:d,compileMessage:p}=qv(),[y,f]=j.useState(""),[m,b]=j.useState("md"),[v,_]=j.useState(!0),w=j.useRef(null),S=j.useRef(null);if(j.useEffect(()=>{w.current&&(w.current.scrollTop=w.current.scrollHeight)},[r]),j.useEffect(()=>{i&&S.current&&S.current.focus()},[i]),j.useEffect(()=>{if(!i)return;const C=z=>{z.key==="Escape"&&(m==="full"?b("lg"):m==="lg"?b("md"):m==="md"?b("sm"):t(!1))};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[i,m,t]),!i)return null;const M=()=>{const C=y.trim();!C||c||(s(C),f(""),S.current&&(S.current.style.height="auto"))},B=C=>{C.key==="Enter"&&!C.shiftKey&&(C.preventDefault(),M())},U=m==="full",ie=l.page.replace(/-/g," "),ce=U?{}:{bottom:"108px"};return g.jsxs("div",{className:`fixed z-[45] flex flex-col border border-surface-border rounded-lg overflow-hidden transition-all duration-300 ${U?Q1.full:`right-6 ${Q1[m]}`} ${v?"bg-surface-raised shadow-xl":"bg-surface-raised/[0.03] shadow-lg shadow-black/5"}`,style:ce,onMouseEnter:()=>_(!0),onMouseLeave:()=>_(!1),children:[g.jsxs("div",{className:`flex items-center justify-between px-4 py-2.5 border-b border-surface-border shrink-0 transition-all duration-300 ${v?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[g.jsxs("div",{className:"min-w-0 flex-1",children:[g.jsx("p",{className:"text-xs font-medium text-text-primary truncate",children:"Help Assistant"}),g.jsx("p",{className:"text-2xs text-text-tertiary truncate",children:ie})]}),g.jsxs("div",{className:"flex items-center gap-1 ml-2",children:[g.jsx("div",{className:"flex items-center gap-0.5 border border-surface-border rounded p-0.5",role:"radiogroup","aria-label":"Panel size",children:XT.map(C=>g.jsx("button",{onClick:()=>b(C),className:`p-1 rounded transition-colors ${C===m?"bg-accent/15 text-accent":"text-text-muted hover:text-text-secondary hover:bg-surface-hover"}`,role:"radio","aria-checked":C===m,"aria-label":Z1[C],title:Z1[C],children:g.jsx(JT,{which:C})},C))}),r.length>0&&g.jsx("button",{onClick:d,className:"p-1 text-text-tertiary hover:text-text-secondary transition-colors","aria-label":"Clear conversation",title:"Clear conversation",children:g.jsx(Cw,{className:"w-3.5 h-3.5",strokeWidth:1.5})}),g.jsx("button",{onClick:()=>t(!1),className:"p-1 text-text-tertiary hover:text-text-primary transition-colors","aria-label":"Close",title:"Close",children:g.jsx(dn,{className:"w-3.5 h-3.5",strokeWidth:1.5})})]})]}),g.jsxs("div",{ref:w,className:`flex-1 overflow-y-auto px-4 py-3 space-y-3 min-h-[120px] transition-all duration-300 ${v?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[r.length===0&&g.jsx("p",{className:"text-xs text-text-tertiary text-center py-6",children:"Ask anything about what you're viewing."}),r.map(C=>g.jsxs("div",{className:`text-xs leading-relaxed ${C.role==="user"?"text-right":"text-left"}`,children:[g.jsx("div",{className:`inline-block max-w-[85%] px-3 py-2 rounded-md whitespace-pre-wrap ${C.role==="user"?"bg-accent/10 text-text-primary":"bg-surface-sunken text-text-secondary"}`,children:C.pending?g.jsx(QT,{msg:C}):C.role==="assistant"?g.jsx(bu,{content:C.content}):C.content}),!C.pending&&g.jsx("div",{className:"mt-0.5",children:g.jsx(ZT,{msg:C,compileMessage:p})})]},C.id))]}),g.jsxs("div",{className:`border-t border-surface-border px-3 py-2.5 flex gap-2 shrink-0 transition-all duration-300 ${v?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[g.jsx("textarea",{ref:S,value:y,onChange:C=>{f(C.target.value);const z=C.target;z.style.height="auto",z.style.height=`${Math.min(z.scrollHeight,120)}px`},onKeyDown:B,placeholder:"Ask a question...",rows:2,className:"flex-1 resize-none bg-surface text-xs text-text-primary placeholder:text-text-tertiary rounded px-2.5 py-1.5 border border-surface-border focus:outline-none focus:border-accent",style:{minHeight:"2.5rem"},disabled:!!c}),g.jsx("button",{onClick:M,disabled:!y.trim()||!!c,className:"px-2.5 py-1.5 text-accent hover:text-accent-hover disabled:text-text-muted transition-colors self-end","aria-label":"Send",children:g.jsx(Mw,{className:"w-4 h-4",strokeWidth:1.5})})]})]})}const eN=6e3,tN="scan";function nN(){const{lastResult:i}=gv(),{open:t,ownerKey:r}=Kd(),[s,l]=j.useState(null);if(j.useEffect(()=>{if(!i)return;const d=setTimeout(()=>l(i.at),eN);return()=>clearTimeout(d)},[i]),!i||i.navigated||s===i.at||t&&r===tN)return null;const{response:c}=i;return g.jsx("div",{role:"status",className:"fixed bottom-14 right-4 z-[60] w-80 max-w-[calc(100vw-2rem)] bg-surface-raised border border-surface-border shadow-lg rounded-md animate-page-in",children:g.jsxs("div",{className:"flex items-start gap-2.5 px-3.5 py-3",children:[g.jsx(ou,{className:"w-4 h-4 mt-0.5 text-accent-muted shrink-0",strokeWidth:1.5}),g.jsxs("div",{className:"flex-1 min-w-0",children:[g.jsx("div",{className:"text-sm font-mono text-text-secondary truncate",children:i.code}),c?g.jsxs(g.Fragment,{children:[g.jsx("div",{className:`text-sm font-medium ${Ov[c.outcome]}`,children:Av(c)}),c.error&&g.jsx("div",{className:"text-xs text-text-tertiary mt-0.5",children:c.error}),ru(c)&&g.jsx("div",{className:"text-xs text-text-secondary mt-1.5",children:g.jsx(jv,{content:ru(c),compact:!0})})]}):g.jsx("div",{className:"text-sm text-status-error",children:i.error})]}),g.jsx("button",{type:"button",onClick:()=>l(i.at),className:"text-text-tertiary hover:text-text-primary shrink-0",title:"Dismiss",children:g.jsx(dn,{className:"w-3.5 h-3.5"})})]})})}const rN="system.surfaces.dashboard",iN=`${Rb}.${rN}`;function sN(i=!0){return ft({queryKey:["announcements"],queryFn:()=>Oe("/announcements"),enabled:i,staleTime:3e4})}const Hv="lt-announcement-dismissed:";function aN(i){return i.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function oN(i){try{return localStorage.getItem(`${Hv}${i}`)==="1"}catch{return!1}}function lN(){const{isAuthenticated:i,userRoleNames:t}=Ht(),{data:r}=sN(i),s=ht(),[l,c]=j.useState(null),[d,p]=j.useState(0);e2(iN,()=>{s.invalidateQueries({queryKey:["announcements"]})});const y=Date.now(),f=((r==null?void 0:r.announcements)??[]).filter(b=>!oN(b.id)&&new Date(b.expires_at).getTime()>y&&(b.roles.length===0||b.roles.some(v=>t.includes(v))));if(j.useEffect(()=>{const b=((r==null?void 0:r.announcements)??[]).map(_=>new Date(_.expires_at).getTime()-Date.now()).filter(_=>_>0);if(b.length===0)return;const v=setTimeout(()=>p(_=>_+1),Math.min(...b)+250);return()=>clearTimeout(v)},[r,d]),f.length===0)return null;const m=b=>{try{localStorage.setItem(`${Hv}${b}`,"1")}catch{}p(v=>v+1)};return g.jsx("div",{"data-testid":"announcement-banner",className:"relative z-40",children:f.map(b=>{const v=l===b.id,_=b.title??b.body.split(`
65
+ `)[0];return g.jsxs("div",{className:"border-b border-accent/25 bg-accent/10",children:[g.jsxs("div",{className:"flex items-center gap-2 px-4 py-1.5",children:[g.jsx("span",{className:"text-2xs font-semibold uppercase tracking-widest text-accent",children:"Notice"}),g.jsxs("button",{type:"button",onClick:()=>c(v?null:b.id),className:"flex items-center gap-1.5 text-xs text-text-primary hover:text-accent transition-colors min-w-0",children:[g.jsx("span",{className:"truncate",children:_}),v?g.jsx(hb,{className:"w-3 h-3 shrink-0",strokeWidth:1.5}):g.jsx(fb,{className:"w-3 h-3 shrink-0",strokeWidth:1.5})]}),g.jsx("div",{className:"flex-1"}),g.jsx("button",{type:"button",onClick:()=>m(b.id),className:"icon-link",title:"Dismiss","aria-label":`Dismiss ${_}`,children:g.jsx(dn,{className:"w-3.5 h-3.5",strokeWidth:1.5})})]}),v&&g.jsx("div",{className:"px-4 pb-3 text-sm text-text-secondary max-w-measure",children:g.jsx(bu,{content:aN(b.body)})})]},b.id)})})}function cN(){var C;const{isBuilder:i,isOps:t,viewAs:r}=Qb(),{canSeePaceBoard:s}=Zb();oO();const{data:l}=Wn(),c=Kb(),d=c!==null?c:!!((C=l==null?void 0:l.ai)!=null&&C.enabled),{collapsed:p,toggle:y}=Vd(),[f,m]=j.useState(!1),[b,v]=j.useState(!1),[_,w]=j.useState(!1),[S,M]=j.useState(()=>window.location.hash.startsWith("#docs")),B=gn(),U=j.useRef(null),{kiosk:ie,homePath:ce}=lO();return j.useEffect(()=>{const z=U.current;z&&(z.classList.remove("animate-page-in"),z.offsetWidth,z.classList.add("animate-page-in"))},[B.pathname]),j.useEffect(()=>{const z=()=>{window.location.hash.startsWith("#docs")&&M(!0)};return window.addEventListener("hashchange",z),()=>window.removeEventListener("hashchange",z)},[]),ie&&ce&&!uO(B.pathname)?g.jsx(In,{to:ce,replace:!0}):g.jsxs("div",{className:"h-screen bg-surface flex flex-col",children:[g.jsx(MA,{onToggleEventFeed:()=>m(z=>!z),onToggleDocs:()=>M(z=>!z),onToggleNav:ie?void 0:()=>v(z=>!z)}),g.jsx(lN,{}),g.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[!ie&&g.jsxs("aside",{className:`${p?"w-16":"w-60"} shrink-0 bg-surface-raised border-r border-surface-border hidden lg:flex flex-col transition-[width] duration-200 ease-out overflow-hidden relative z-20`,children:[g.jsx("nav",{className:"flex-1 px-3 pt-[36px] pb-4 space-y-2 overflow-y-auto overflow-x-hidden",children:g.jsx(Nv,{aiEnabled:d,isBuilder:i,isOps:t,viewAs:r,canSeePaceBoard:s})}),g.jsx("button",{onClick:y,className:`shrink-0 py-3 text-text-tertiary hover:text-text-secondary transition-colors duration-150 ${p?"flex justify-center":"flex items-center px-7"}`,"aria-label":p?"Expand sidebar":"Collapse sidebar",children:p?g.jsx(Rw,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5}):g.jsx(Dw,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5})}),!p&&(l==null?void 0:l.environment)&&g.jsxs("div",{className:"shrink-0 px-5 pb-3 text-2xs leading-tight text-text-tertiary whitespace-nowrap overflow-hidden text-ellipsis",title:`long-tail v${l.environment.longTailVersion} · HotMesh v${l.environment.hotmeshVersion} · Node ${l.environment.nodeVersion} · ${l.environment.nodeEnv}`,children:["long-tail v",l.environment.longTailVersion,g.jsx("span",{className:"mx-1 text-surface-border",children:"·"}),"HotMesh v",l.environment.hotmeshVersion]})]}),g.jsx("main",{className:"flex-1 min-w-0 overflow-y-auto",children:g.jsx("div",{ref:U,className:"w-full px-page-x py-8 pb-16 animate-page-in h-full flex flex-col @container",children:g.jsx(Ls,{})})}),g.jsx(uN,{})]}),!ie&&g.jsx(WA,{open:b,onClose:()=>v(!1),aiEnabled:d,isBuilder:i,isOps:t,viewAs:r,canSeePaceBoard:s}),g.jsx(bj,{open:f,onToggle:()=>m(z=>!z),configOpen:_,onToggleConfig:()=>w(z=>!z)}),g.jsx(Tj,{open:S,onClose:()=>{M(!1),history.replaceState(null,"",window.location.pathname+window.location.search)}}),d&&g.jsx(Rj,{}),d&&g.jsx(WT,{}),g.jsx(nN,{})]})}function uN(){const{node:i,width:t,open:r}=Kd();return g.jsx(pO,{open:r,width:t,className:"border-l border-surface-border bg-surface-raised",children:i})}function fN(){const{isAuthenticated:i}=Ht(),t=gn();return i?g.jsx(hO,{children:g.jsx(mO,{children:g.jsx(Mj,{children:g.jsx(OO,{children:g.jsx(zO,{children:g.jsx(cN,{})})})})})}):g.jsx(In,{to:"/login",state:{from:t.pathname},replace:!0})}function Gv({provider:i,className:t="w-5 h-5"}){switch(i){case"google":return g.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor",children:[g.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z",fill:"#4285F4"}),g.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z",fill:"#34A853"}),g.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z",fill:"#FBBC05"}),g.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z",fill:"#EA4335"})]});case"github":return g.jsx("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor",children:g.jsx("path",{d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0 1 12 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0 0 22 12.017C22 6.484 17.522 2 12 2z"})});case"microsoft":return g.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor",children:[g.jsx("path",{d:"M3 3h8.5v8.5H3z",fill:"#F25022"}),g.jsx("path",{d:"M12.5 3H21v8.5h-8.5z",fill:"#7FBA00"}),g.jsx("path",{d:"M3 12.5h8.5V21H3z",fill:"#00A4EF"}),g.jsx("path",{d:"M12.5 12.5H21V21h-8.5z",fill:"#FFB900"})]});case"anthropic":return g.jsx("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor",children:g.jsx("path",{d:"M13.827 3.52h3.603L24 20.48h-3.603l-6.57-16.96zm-7.258 0h3.767L16.906 20.48h-3.674l-1.343-3.461H6.396l-1.34 3.461H1.5l5.07-16.96zm2.327 5.14l-2.065 5.326h4.108l-2.043-5.326z"})});default:return g.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[g.jsx("circle",{cx:"12",cy:"12",r:"10"}),g.jsx("path",{d:"M12 8v4l3 3"})]})}}async function hN(){return Oe("/auth/oauth/providers")}async function dN(i,t){const r=t?`?label=${encodeURIComponent(t)}`:"";return Oe(`/auth/oauth/connections/${i}${r}`,{method:"DELETE"})}function ck(){return ft({queryKey:["oauth-connections"],queryFn:()=>Oe("/auth/oauth/connections")})}function uk(){const i=ht();return Et({mutationFn:({provider:t,label:r})=>dN(t,r),onSuccess:()=>{i.invalidateQueries({queryKey:["oauth-connections"]})}})}function mN(){var re;const{login:i,isAuthenticated:t}=Ht(),r=go(),s=gn(),l=new URLSearchParams(s.search),c=l.get("token"),d=l.get("error"),p=((re=s.state)==null?void 0:re.from)??l.get("returnTo")??"/",y=j.useRef(!1);c&&!y.current&&(y.current=!0,i(c,void 0,{displayName:l.get("displayName"),username:l.get("username")}));const[f,m]=j.useState(""),[b,v]=j.useState(""),[_,w]=j.useState(d||""),[S,M]=j.useState(!1),[B,U]=j.useState(!!c),[ie,ce]=j.useState([]),C=j.useRef(!1);if(j.useEffect(()=>{c||C.current||(C.current=!0,(async()=>{var X,L,G,W;try{const Q=await fetch(`${jt}/api/settings`);if(!Q.ok)return;const he=await Q.json();if(!((X=he.auth)!=null&&X.sso))return;const _e=await fetch(`${jt}/api/auth/sso`,{method:"POST"});if(!_e.ok){w("Host authentication required — please log in to your organization first");return}const Te=await _e.json();Te.token&&((L=he.auth)!=null&&L.ssoLogoutUrl&&sessionStorage.setItem("lt_sso_logout_url",he.auth.ssoLogoutUrl),U(!0),i(Te.token,void 0,{displayName:(G=Te.user)==null?void 0:G.display_name,username:(W=Te.user)==null?void 0:W.external_id}))}catch{}})())},[]),j.useEffect(()=>{c||hN().then(ce).catch(()=>{})},[]),j.useEffect(()=>{if(!B)return;const X=setTimeout(()=>r(p,{replace:!0}),1500);return()=>clearTimeout(X)},[B]),t&&!B)return g.jsx(In,{to:p,replace:!0});const z=async X=>{var L,G;if(X.preventDefault(),w(""),!f.trim()||!b){w("Username and password are required");return}M(!0);try{const W=await fetch(`${jt}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:f.trim(),password:b})}),Q=await W.json();if(!W.ok){w(Q.error||"Login failed");return}U(!0),i(Q.token,{username:f.trim(),password:b},{displayName:(L=Q.user)==null?void 0:L.display_name,username:(G=Q.user)==null?void 0:G.external_id})}catch{w("Unable to connect to server")}finally{M(!1)}};return g.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center overflow-hidden",children:g.jsxs("div",{className:"w-full max-w-md p-10",children:[g.jsx("div",{className:`mb-10 transition-all duration-[1500ms] ease-in ${B?"translate-x-[120vw] -translate-y-[60vh] scale-[3] opacity-0":""}`,children:g.jsx(nu,{size:"lg",hideLabel:B})}),g.jsxs("form",{onSubmit:z,className:`space-y-5 transition-opacity duration-300 ${B?"opacity-0":""}`,children:[g.jsxs("div",{children:[g.jsx("label",{htmlFor:"username",className:"block text-sm font-medium text-text-secondary mb-2",children:"Username"}),g.jsx("input",{id:"username",type:"text",value:f,onChange:X=>m(X.target.value),className:"input",placeholder:"Enter your username",autoFocus:!B,autoComplete:"username"})]}),g.jsxs("div",{children:[g.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-text-secondary mb-2",children:"Password"}),g.jsx("input",{id:"password",type:"password",value:b,onChange:X=>v(X.target.value),className:"input",placeholder:"Enter your password",autoComplete:"current-password"})]}),_&&g.jsx("p",{className:"text-sm text-status-error",children:_}),g.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:S||B,children:S?"Signing in...":"Sign In"}),ie.length>0&&g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"flex items-center gap-3 mt-6",children:[g.jsx("div",{className:"flex-1 h-px bg-border"}),g.jsx("span",{className:"text-xs text-text-tertiary",children:"or continue with"}),g.jsx("div",{className:"flex-1 h-px bg-border"})]}),g.jsx("div",{className:"space-y-2",children:ie.filter(X=>X.provider!=="anthropic").map(X=>g.jsxs("a",{href:`${jt}/api/auth/oauth/${X.provider}?returnTo=${encodeURIComponent(p)}`,className:"btn-secondary w-full flex items-center justify-center gap-2",children:[g.jsx(Gv,{provider:X.provider}),"Sign in with ",X.name]},X.provider))})]})]})]})})}function W1(){const{isAuthenticated:i}=Ht(),t=go(),r=gn(),s=new URLSearchParams(r.search),l=s.get("state")||"";j.useEffect(()=>{i||t(`/login?returnTo=${encodeURIComponent(r.pathname+r.search)}`)},[i]);const[c,d]=j.useState(""),[p,y]=j.useState(s.get("label")||"default"),[f,m]=j.useState(""),[b,v]=j.useState(!1),_=c.trim().startsWith("sk-ant-oat"),w=c.trim().startsWith("sk-ant-api"),S=M=>{M.preventDefault();const B=c.trim();if(!B){m("A token or API key is required");return}if(!B.startsWith("sk-ant-")){m('Invalid format. Must start with "sk-ant-oat" (OAuth token) or "sk-ant-api" (API key)');return}v(!0),m("");const U=`${jt}/api/auth/oauth/anthropic/callback?code=${encodeURIComponent(B)}&state=${encodeURIComponent(l)}`;window.location.href=U};return g.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center",children:g.jsxs("div",{className:"w-full max-w-md p-10",children:[g.jsx("div",{className:"mb-10",children:g.jsx(nu,{size:"lg"})}),g.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[g.jsx(Gv,{provider:"anthropic",className:"w-6 h-6"}),g.jsx("h2",{className:"heading-3",children:"Connect Anthropic"})]}),g.jsx("p",{className:"text-sm text-text-secondary mb-4",children:"Connect your Anthropic account so Claude Code tasks run under your credentials. Your token is encrypted at rest."}),g.jsxs("form",{onSubmit:S,className:"space-y-5",children:[g.jsxs("div",{children:[g.jsx("label",{htmlFor:"token",className:"block text-sm font-medium text-text-secondary mb-2",children:"OAuth Token or API Key"}),g.jsx("input",{id:"token",type:"password",value:c,onChange:M=>d(M.target.value),className:"input",placeholder:"sk-ant-oat01-... or sk-ant-api03-...",autoFocus:!0,autoComplete:"off"}),_&&g.jsx("p",{className:"text-xs text-status-success mt-1",children:"OAuth token detected — uses your Claude subscription (flat rate)"}),w&&g.jsx("p",{className:"text-xs text-status-warning mt-1",children:"API key detected — billed per-token from your Anthropic API account"})]}),g.jsxs("div",{children:[g.jsx("label",{htmlFor:"label",className:"block text-sm font-medium text-text-secondary mb-2",children:"Label"}),g.jsx("input",{id:"label",type:"text",value:p,onChange:M=>y(M.target.value.replace(/\s+/g,"-").toLowerCase()),className:"input",placeholder:"default",autoComplete:"off"}),g.jsx("p",{className:"text-xs text-text-tertiary mt-1",children:'A name for this credential. Use different labels to store multiple credentials (e.g., "subscription", "api-batch").'})]}),f&&g.jsx("p",{className:"text-sm text-status-error",children:f}),g.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:b,children:b?"Validating...":"Connect"}),g.jsx("a",{href:"/",className:"block text-center text-sm text-text-tertiary hover:text-text-secondary",children:"Cancel"})]}),g.jsxs("div",{className:"mt-6 space-y-3 text-xs text-text-tertiary",children:[g.jsxs("div",{children:[g.jsx("span",{className:"font-medium text-text-secondary",children:"Recommended:"})," ","Run"," ",g.jsx("code",{className:"px-1 py-0.5 bg-surface-sunken rounded text-2xs",children:"claude setup-token"})," ","in your terminal to generate an OAuth token that uses your subscription."]}),g.jsxs("div",{children:[g.jsx("span",{className:"font-medium text-text-secondary",children:"Alternative:"})," ","Use an API key from"," ",g.jsx("a",{href:"https://console.anthropic.com/settings/keys",target:"_blank",rel:"noopener noreferrer",className:"text-accent-secondary hover:underline",children:"console.anthropic.com"})," ","(billed per-token)."]})]})]})})}function zc({roleTypes:i,roleNames:t,redirectTo:r="/"}){const{isSuperAdmin:s,hasRole:l,hasRoleType:c}=Ht();return s?g.jsx(Ls,{}):i&&i.some(d=>c(d))?g.jsx(Ls,{}):t&&t.some(d=>l(d))?g.jsx(Ls,{}):g.jsx(In,{to:r,replace:!0})}function pN({redirectTo:i="/"}){var s;const{data:t,isLoading:r}=Wn();return r||!t?null:(s=t.ai)!=null&&s.enabled?g.jsx(Ls,{}):g.jsx(In,{to:i,replace:!0})}function gN({flag:i,redirectTo:t="/"}){var l;const{data:r,isLoading:s}=Wn();return s||!r?null:((l=r.features)==null?void 0:l[i])===!1?g.jsx(In,{to:t,replace:!0}):g.jsx(Ls,{})}const yN=j.lazy(()=>we(()=>import("./ProcessesListPage-DnfmK6jf.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]),import.meta.url).then(i=>({default:i.ProcessesListPage}))),bN=j.lazy(()=>we(()=>import("./ProcessDetailPage-zwd0HCJl.js"),__vite__mapDeps([18,1,2,4,19,14,20,17,11,6,21,22,23]),import.meta.url).then(i=>({default:i.ProcessDetailPage}))),vN=j.lazy(()=>we(()=>import("./McpOverview-BUI9sVTk.js"),__vite__mapDeps([24,1,25,26,27,28,15,14,29,6]),import.meta.url).then(i=>({default:i.McpOverview}))),xN=j.lazy(()=>we(()=>import("./McpRunsPage-BWLwjVd0.js"),__vite__mapDeps([30,1,26,27,5,6,31,28,8,9,10,17,14,32,15,13,12,16,33]),import.meta.url).then(i=>({default:i.McpRunsPage}))),_N=j.lazy(()=>we(()=>import("./McpRunDetailPage-CTb1AxR3.js"),__vite__mapDeps([34,1,26,15,14,35,36,13,37,20,6,38,16,39]),import.meta.url).then(i=>({default:i.McpRunDetailPage}))),wN=j.lazy(()=>we(()=>import("./McpQueryPage-DRTKSPDR.js"),__vite__mapDeps([40,1,15,14,9,10,13,12,16,8,11,32,17,33,5,6,4,41]),import.meta.url).then(i=>({default:i.McpQueryPage}))),SN=j.lazy(()=>we(()=>import("./McpQueryDetailPage-CVN_UAB3.js"),__vite__mapDeps([42,1,15,14,20,41,6,27,4,43,44,26,3,2,45,46,47,48,49,50,39,51,37,38]),import.meta.url).then(i=>({default:i.McpQueryDetailPage}))),EN=j.lazy(()=>we(()=>import("./EscalationsOverview-DfbKtXVZ.js"),__vite__mapDeps([52,1,4,15,14,29,6]),import.meta.url).then(i=>({default:i.EscalationsOverview}))),ON=j.lazy(()=>we(()=>import("./AvailableEscalationsPage-DDsmXjpi.js"),__vite__mapDeps([53,1,54,4,14,55,56,6,57,58,59,13,60,21,17,61,9,10,20,12,5,7,8,23,33,16]),import.meta.url).then(i=>({default:i.AvailableEscalationsPage}))),AN=j.lazy(()=>we(()=>import("./OperatorDashboard-DGs9kPOZ.js"),__vite__mapDeps([62,1,4,5,6,7,8,54,9,10,12,33,58,14,59,13,60,21,17,61,20,56,16]),import.meta.url).then(i=>({default:i.OperatorDashboard}))),jN=j.lazy(()=>we(()=>import("./index-LF1gEc6w.js"),__vite__mapDeps([63,1,55,56,6,57,15,14,16,61,9,10,20,12,3,4,21,39,22,23]),import.meta.url).then(i=>({default:i.EscalationDetailPage}))),TN=j.lazy(()=>we(()=>import("./WorkflowsOverview-BkcRU4Ej.js"),__vite__mapDeps([64,1,3,4,15,14,29,6]),import.meta.url).then(i=>({default:i.WorkflowsOverview}))),NN=j.lazy(()=>we(()=>import("./index-DuyzcDuV.js"),__vite__mapDeps([65,1,3,15,14,13,17,66,48,49,6]),import.meta.url).then(i=>({default:i.StartWorkflowPage}))),kN=j.lazy(()=>we(()=>import("./index-DuyzcDuV.js"),__vite__mapDeps([65,1,3,15,14,13,17,66,48,49,6]),import.meta.url).then(i=>({default:i.DurableInvokePage}))),CN=j.lazy(()=>we(()=>import("./WorkflowsDashboard-Bzvz6tTY.js"),__vite__mapDeps([67,1,32,3,31,28,6,4,5,8,9,10,17,14,15,13,12,16,33]),import.meta.url).then(i=>({default:()=>i.WorkflowsDashboard({tier:"durable"})}))),MN=j.lazy(()=>we(()=>import("./WorkflowsDashboard-Bzvz6tTY.js"),__vite__mapDeps([67,1,32,3,31,28,6,4,5,8,9,10,17,14,15,13,12,16,33]),import.meta.url).then(i=>({default:()=>i.WorkflowsDashboard({tier:"all"})}))),RN=j.lazy(()=>we(()=>import("./YamlWorkflowsPage-Dp6vG1au.js"),__vite__mapDeps([68,1,27,5,6,15,14,13,10,50,66,20]),import.meta.url).then(i=>({default:i.YamlWorkflowsPage}))),DN=j.lazy(()=>we(()=>import("./GraphInvokePage-DY9u42vt.js"),__vite__mapDeps([69,1,27,15,14,45,47,48,49,46,6,50,66]),import.meta.url).then(i=>({default:i.GraphInvokePage}))),qN=j.lazy(()=>we(()=>import("./YamlWorkflowDetailPage-CmM78sYi.js"),__vite__mapDeps([70,1,27,20,66,14,6]),import.meta.url).then(i=>({default:i.YamlWorkflowDetailPage}))),BN=j.lazy(()=>we(()=>import("./TasksListPage-C9AN7IBb.js"),__vite__mapDeps([71,1,2,3,5,6,9,10,20,60,51,12,13,14,15,17]),import.meta.url).then(i=>({default:i.TasksListPage}))),LN=j.lazy(()=>we(()=>import("./TaskDetailPage-5sbMHi5U.js"),__vite__mapDeps([72,1,2,20,60,15,14,6]),import.meta.url).then(i=>({default:i.TaskDetailPage}))),eb=j.lazy(()=>we(()=>import("./WorkflowExecutionPage-B28OxTS_.js"),__vite__mapDeps([73,1,3,4,36,13,14,37,20,6,38,2,15,35,16,39]),import.meta.url).then(i=>({default:i.WorkflowExecutionPage}))),zN=j.lazy(()=>we(()=>import("./AdminDashboard-DeZsR4pA.js"),__vite__mapDeps([74,1,2,4,25,19,14,6]),import.meta.url).then(i=>({default:i.AdminDashboard}))),UN=j.lazy(()=>we(()=>import("./index-3QEnMBNG.js"),__vite__mapDeps([75,1,3,9,10,13,14,33,5,6,15,76,17]),import.meta.url).then(i=>({default:i.WorkersPage}))),PN=j.lazy(()=>we(()=>import("./index-k5vcLICm.js"),__vite__mapDeps([77,1,3,13,14,78,56,6,21,17,15,48,49,66]),import.meta.url).then(i=>({default:i.WorkflowConfigsPage}))),tb=j.lazy(()=>we(()=>import("./index-k5vcLICm.js"),__vite__mapDeps([77,1,3,13,14,78,56,6,21,17,15,48,49,66]),import.meta.url).then(i=>({default:i.WorkflowConfigDetailPage}))),IN=j.lazy(()=>we(()=>import("./index-Ch-OS1pk.js"),__vite__mapDeps([79,1,25,10,78,56,6,15,14,13,12,5,80,47,48,49,50,46,33,20]),import.meta.url).then(i=>({default:i.McpServersPage}))),nb=j.lazy(()=>we(()=>import("./index-D6kXz3H8.js"),__vite__mapDeps([81,1,25,15,14,43,6]),import.meta.url).then(i=>({default:i.McpServerDetailPage}))),$N=j.lazy(()=>we(()=>import("./index-B3FzpDEG.js"),__vite__mapDeps([82,1,23,5,6,9,10,12,13,14,78,56,33,15,21,49,51,83,84,35]),import.meta.url).then(i=>({default:i.UsersPage}))),HN=j.lazy(()=>we(()=>import("./RolesPage-DN6yqH7-.js"),__vite__mapDeps([85,1,13,14,15,21,56,6]),import.meta.url).then(i=>({default:i.RolesPage}))),GN=j.lazy(()=>we(()=>import("./RoleDetailPage-axZtFPC_.js"),__vite__mapDeps([86,1,23,87,78,56,6,14]),import.meta.url).then(i=>({default:i.RoleDetailPage}))),FN=j.lazy(()=>we(()=>import("./PersonasPage-BbLOHq5X.js"),__vite__mapDeps([88,1,83,13,14,15,21,56,6,23,7]),import.meta.url).then(i=>({default:i.PersonasPage}))),VN=j.lazy(()=>we(()=>import("./PersonaDetailPage-C33MgXUY.js"),__vite__mapDeps([89,1,83,21,14,84,87,78,56,6]),import.meta.url).then(i=>({default:i.PersonaDetailPage}))),YN=j.lazy(()=>we(()=>import("./EscalationSchemaPage-DFgDn4R3.js"),__vite__mapDeps([90,1,14,6]),import.meta.url).then(i=>({default:i.EscalationSchemaPage}))),KN=j.lazy(()=>we(()=>import("./EscalationListSchemaPage-DQNQ7o_4.js"),__vite__mapDeps([91,1,14,6]),import.meta.url).then(i=>({default:i.EscalationListSchemaPage}))),XN=j.lazy(()=>we(()=>import("./ScanCodesPage-BmQjEyWZ.js"),__vite__mapDeps([92,1,15,14,6]),import.meta.url).then(i=>({default:i.ScanCodesPage}))),JN=j.lazy(()=>we(()=>import("./ScanSchemeDetailPage-VODehqGs.js"),__vite__mapDeps([93,1,78,56,6,15,14]),import.meta.url).then(i=>({default:i.ScanSchemeDetailPage}))),QN=j.lazy(()=>we(()=>import("./ScanStationPage-Y-9Gs7t5.js"),__vite__mapDeps([94,1,14,56,6]),import.meta.url).then(i=>({default:i.ScanStationPage}))),ZN=j.lazy(()=>we(()=>import("./index-CGCD5hTX.js"),__vite__mapDeps([95,1,15,14,56,6,57]),import.meta.url).then(i=>({default:i.MaintenancePage}))),WN=j.lazy(()=>we(()=>import("./OperationsPage-BSl_oUAJ.js").then(i=>i.O),__vite__mapDeps([96,1,4,59,14,6,15]),import.meta.url).then(i=>({default:i.OperationsPage}))),e3=j.lazy(()=>we(()=>import("./index-D3iDAWK2.js"),__vite__mapDeps([97,1,19,14,13,5,6,31,28,56,44,76,9,10,33]),import.meta.url).then(i=>({default:i.ControlPlanePage}))),t3=j.lazy(()=>we(()=>import("./index-Dsgqxdyh.js"),__vite__mapDeps([98,1,38,14,5,6,31,28,8,9,10,12,13,15,16]),import.meta.url).then(i=>({default:i.StreamMessagesPage}))),n3=j.lazy(()=>we(()=>import("./CredentialsPage-CGyCCzGh.js"),__vite__mapDeps([99,1,15,14,51,78,56,6]),import.meta.url).then(i=>({default:i.CredentialsPage}))),r3=j.lazy(()=>we(()=>import("./index-DuhqzYwC.js"),__vite__mapDeps([100,1,6,15,14,13,16,8,10,101,51]),import.meta.url).then(i=>({default:i.FilesPage}))),i3=j.lazy(()=>we(()=>import("./index-CkkOh8y9.js"),__vite__mapDeps([102,1,15,14,13,16,12,10,101,51,103,43,6]),import.meta.url).then(i=>({default:i.KnowledgePage}))),s3=j.lazy(()=>we(()=>import("./HomePage-p_CYlGnh.js"),__vite__mapDeps([104,1,3,26,28,4,21,14,17,16,96,59,6,15,54]),import.meta.url).then(i=>({default:i.HomePage}))),a3=j.lazy(()=>we(()=>import("./AgentsPage-CRFZ6KDu.js"),__vite__mapDeps([105,1,106,4,5,6,8,9,10,12,13,14,15,16]),import.meta.url).then(i=>({default:i.AgentsPage}))),o3=j.lazy(()=>we(()=>import("./AgentDetailPage-CIbKor5E.js"),__vite__mapDeps([107,1,106,108,14,4,17,6]),import.meta.url).then(i=>({default:i.AgentDetailPage}))),rb=j.lazy(()=>we(()=>import("./AgentConfigPage-Bi5ZAsjf.js"),__vite__mapDeps([109,1,106,108,14,15,103,47,48,49,3,27,110,111,17,6]),import.meta.url).then(i=>({default:i.AgentConfigPage}))),l3=j.lazy(()=>we(()=>import("./CapabilitiesPage-Ca2jEln-.js"),__vite__mapDeps([112,1,110,80,25,47,48,49,14,50,6,46,15,13]),import.meta.url).then(i=>({default:i.CapabilitiesPage}))),c3=j.lazy(()=>we(()=>import("./TopicsPage-BoVkp7DM.js"),__vite__mapDeps([113,1,111,15,14,13,6]),import.meta.url).then(i=>({default:i.TopicsPage}))),u3=j.lazy(()=>we(()=>import("./TopicDetailPage-fOnTfDso.js"),__vite__mapDeps([114,1,111,16,14,6]),import.meta.url).then(i=>({default:i.TopicDetailPage})));function f3(){return g.jsxs("div",{className:"animate-pulse space-y-4",children:[g.jsx("div",{className:"h-8 bg-surface-sunken rounded w-48"}),g.jsx("div",{className:"h-40 bg-surface-sunken rounded"})]})}function ve({children:i}){return g.jsx(j.Suspense,{fallback:g.jsx(f3,{}),children:g.jsx("div",{className:"animate-page-enter flex flex-col flex-1 min-h-0",children:i})})}const Fv=new rw({defaultOptions:{queries:{staleTime:1e4,retry:(i,t)=>t instanceof Error&&t.message==="Session expired"?!1:i<1}}});window.addEventListener("auth:unauthorized",()=>{Fv.clear(),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info");const i=window.__LT_BASE__||"",t=`${i}/login`;if(window.location.pathname!==t){const r=window.location.pathname+window.location.search,s=i&&r.startsWith(i)?r.slice(i.length)||"/":r;window.location.href=`${t}?returnTo=${encodeURIComponent(s)}`}});const h3=aw([{path:"/login",element:g.jsx(mN,{})},{path:"/connect/anthropic",element:g.jsx(W1,{})},{path:"/connect/:provider",element:g.jsx(W1,{})},{path:"/",element:g.jsx(fN,{}),children:[{index:!0,element:g.jsx(ve,{children:g.jsx(s3,{})})},{path:"processes/all",element:g.jsx(ve,{children:g.jsx(yN,{})})},{path:"processes/detail/:originId",element:g.jsx(ve,{children:g.jsx(bN,{})})},{path:"credentials",element:g.jsx(ve,{children:g.jsx(n3,{})})},{path:"connections",element:g.jsx(In,{to:"/credentials",replace:!0})},{path:"escalations",element:g.jsx(ve,{children:g.jsx(EN,{})})},{path:"escalations/available",element:g.jsx(ve,{children:g.jsx(ON,{})})},{path:"escalations/queue",element:g.jsx(ve,{children:g.jsx(AN,{})})},{path:"escalations/detail/:id",element:g.jsx(ve,{children:g.jsx(jN,{})})},{path:"scan/station",element:g.jsx(ve,{children:g.jsx(QN,{})})},{path:"capabilities",element:g.jsx(ve,{children:g.jsx(l3,{})})},{path:"agents",element:g.jsx(ve,{children:g.jsx(a3,{})})},{path:"agents/new",element:g.jsx(ve,{children:g.jsx(rb,{})})},{path:"agents/:id",element:g.jsx(ve,{children:g.jsx(o3,{})})},{path:"agents/:id/edit",element:g.jsx(ve,{children:g.jsx(rb,{})})},{path:"topics",element:g.jsx(ve,{children:g.jsx(c3,{})})},{path:"topics/:topic",element:g.jsx(ve,{children:g.jsx(u3,{})})},{element:g.jsx(zc,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"workflows",element:g.jsx(ve,{children:g.jsx(TN,{})})},{path:"workflows/executions",element:g.jsx(ve,{children:g.jsx(MN,{})})},{path:"workflows/durable/executions",element:g.jsx(ve,{children:g.jsx(CN,{})})},{path:"workflows/durable/executions/:workflowId",element:g.jsx(ve,{children:g.jsx(eb,{})})},{path:"workflows/tasks",element:g.jsx(ve,{children:g.jsx(BN,{})})},{path:"workflows/tasks/detail/:id",element:g.jsx(ve,{children:g.jsx(LN,{})})},{path:"workflows/executions/:workflowId",element:g.jsx(ve,{children:g.jsx(eb,{})})},{path:"workflows/start",element:g.jsx(ve,{children:g.jsx(NN,{})})},{path:"workflows/durable/invoke",element:g.jsx(ve,{children:g.jsx(kN,{})})},{path:"workflows/cron",element:g.jsx(In,{to:"/workflows/start?mode=schedule",replace:!0})},{path:"workflows/workers",element:g.jsx(ve,{children:g.jsx(UN,{})})},{path:"workflows/registry",element:g.jsx(ve,{children:g.jsx(PN,{})})},{path:"workflows/registry/new",element:g.jsx(ve,{children:g.jsx(tb,{})})},{path:"workflows/registry/:workflowType",element:g.jsx(ve,{children:g.jsx(tb,{})})}]},{element:g.jsx(zc,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"mcp/workflows",element:g.jsx(ve,{children:g.jsx(RN,{})})},{path:"mcp/workflows/invoke",element:g.jsx(ve,{children:g.jsx(DN,{})})},{path:"mcp/workflows/:id",element:g.jsx(ve,{children:g.jsx(qN,{})})},{path:"mcp/executions",element:g.jsx(ve,{children:g.jsx(xN,{})})},{path:"mcp/executions/:jobId",element:g.jsx(ve,{children:g.jsx(_N,{})})},{path:"files",element:g.jsx(ve,{children:g.jsx(r3,{})})},{path:"knowledge",element:g.jsx(ve,{children:g.jsx(i3,{})})},{element:g.jsx(pN,{}),children:[{path:"mcp",element:g.jsx(ve,{children:g.jsx(vN,{})})},{path:"mcp/queries",element:g.jsx(ve,{children:g.jsx(wN,{})})},{path:"mcp/queries/:workflowId",element:g.jsx(ve,{children:g.jsx(SN,{})})},{path:"mcp/tools",element:g.jsx(In,{to:"/mcp/servers",replace:!0})},{path:"mcp/servers",element:g.jsx(ve,{children:g.jsx(IN,{})})},{path:"mcp/servers/new",element:g.jsx(ve,{children:g.jsx(nb,{})})},{path:"mcp/servers/:serverId",element:g.jsx(ve,{children:g.jsx(nb,{})})}]}]},{path:"operations",element:g.jsx(ve,{children:g.jsx(WN,{})})},{element:g.jsx(zc,{roleTypes:["admin","superadmin"],roleNames:["engineer"]}),children:[{path:"admin",element:g.jsx(ve,{children:g.jsx(zN,{})})},{path:"admin/users",element:g.jsx(ve,{children:g.jsx($N,{})})},{path:"admin/escalation-chains",element:g.jsx(In,{to:"/admin/roles",replace:!0})},{path:"admin/roles",element:g.jsx(ve,{children:g.jsx(HN,{})})},{path:"admin/roles/:role",element:g.jsx(ve,{children:g.jsx(GN,{})})},{path:"admin/roles/:role/schema",element:g.jsx(ve,{children:g.jsx(YN,{})})},{path:"admin/roles/:role/list-schema",element:g.jsx(ve,{children:g.jsx(KN,{})})},{path:"admin/scan-codes",element:g.jsx(ve,{children:g.jsx(XN,{})})},{path:"admin/scan-codes/:version",element:g.jsx(ve,{children:g.jsx(JN,{})})},{path:"admin/personas",element:g.jsx(ve,{children:g.jsx(FN,{})})},{path:"admin/personas/:key",element:g.jsx(ve,{children:g.jsx(VN,{})})}]},{element:g.jsx(zc,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"admin/bots",element:g.jsx(In,{to:"/admin/users?tab=service-accounts",replace:!0})},{element:g.jsx(gN,{flag:"dbMaintenance"}),children:[{path:"admin/maintenance",element:g.jsx(ve,{children:g.jsx(ZN,{})})}]},{path:"admin/controlplane",element:g.jsx(ve,{children:g.jsx(e3,{})})},{path:"admin/streams",element:g.jsx(ve,{children:g.jsx(t3,{})})}]}]}],{basename:window.__LT_BASE__||"/"});function d3(){return g.jsx(iw,{client:Fv,children:g.jsx(Xw,{children:g.jsx(W2,{children:g.jsx(ow,{router:h3})})})})}cv(lv());const Zd=document.createElement("link");Zd.rel="stylesheet";Zd.href=`${jt}/api/settings/custom.css`;document.head.appendChild(Zd);Uw.createRoot(document.getElementById("root")).render(g.jsx(j.StrictMode,{children:g.jsx(d3,{})}));export{q3 as $,I3 as A,$3 as B,Xd as C,KT as D,H3 as E,Cv as F,F3 as G,v3 as H,ev as I,pj as J,M3 as K,IA as L,w3 as M,Rb as N,iv as O,T3 as P,rv as Q,Qd as R,rj as S,L3 as T,PA as U,sk as V,j3 as W,qO as X,Zl as Y,bu as Z,jv as _,lk as a,EO as a0,mv as a1,U3 as a2,G3 as a3,Yg as a4,dv as a5,Jd as a6,$v as a7,ak as a8,E3 as a9,uk as aA,Gv as aB,Gd as aC,Zb as aD,ik as aE,A3 as aa,O3 as ab,_3 as ac,x3 as ad,_d as ae,Ay as af,Dd as ag,rk as ah,jt as ai,mb as aj,ok as ak,S3 as al,K3 as am,V3 as an,J3 as ao,Z3 as ap,W3 as aq,X3 as ar,Q3 as as,gv as at,HT as au,BO as av,Y3 as aw,Pe as ax,k3 as ay,ck as az,YT as b,pO as c,N3 as d,e2 as e,GT as f,Oe as g,D3 as h,B3 as i,z3 as j,C3 as k,Kb as l,Ht as m,tk as n,R3 as o,DO as p,nk as q,Kd as r,zA as s,UA as t,Wn as u,GA as v,ek as w,Qb as x,lO as y,P3 as z};
66
+ //# sourceMappingURL=index-BU4oujVO.js.map