@hotmeshio/long-tail 0.12.0 → 0.13.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 (257) hide show
  1. package/README.md +1 -0
  2. package/build/api/escalations/helpers.js +4 -2
  3. package/build/api/settings.js +3 -0
  4. package/build/services/agent/index.d.ts +11 -0
  5. package/build/services/agent/index.js +32 -0
  6. package/build/services/agent/sql.d.ts +7 -0
  7. package/build/services/agent/sql.js +32 -1
  8. package/build/services/agent/subscription-sql.d.ts +6 -0
  9. package/build/services/agent/subscription-sql.js +32 -1
  10. package/build/services/agent/subscriptions.d.ts +6 -0
  11. package/build/services/agent/subscriptions.js +23 -0
  12. package/build/services/config/index.d.ts +1 -1
  13. package/build/services/config/index.js +2 -1
  14. package/build/services/config/write.d.ts +10 -0
  15. package/build/services/config/write.js +49 -2
  16. package/build/services/domain/seed.d.ts +12 -5
  17. package/build/services/domain/seed.js +25 -6
  18. package/build/services/mcp/db.d.ts +16 -0
  19. package/build/services/mcp/db.js +24 -0
  20. package/build/services/mcp/sql.d.ts +8 -0
  21. package/build/services/mcp/sql.js +24 -1
  22. package/build/services/role/seed.d.ts +21 -0
  23. package/build/services/role/seed.js +113 -0
  24. package/build/services/role/sql.d.ts +8 -0
  25. package/build/services/role/sql.js +24 -1
  26. package/build/services/role/types.d.ts +7 -3
  27. package/build/services/role/types.js +7 -3
  28. package/build/services/topics/index.d.ts +2 -0
  29. package/build/services/topics/index.js +7 -0
  30. package/build/services/topics/sql.d.ts +2 -0
  31. package/build/services/topics/sql.js +5 -1
  32. package/build/services/topics/system-topics.d.ts +3 -2
  33. package/build/services/topics/system-topics.js +4 -3
  34. package/build/services/user/index.d.ts +1 -1
  35. package/build/services/user/index.js +2 -1
  36. package/build/services/user/roles.d.ts +8 -0
  37. package/build/services/user/roles.js +29 -0
  38. package/build/services/user/sql.d.ts +6 -0
  39. package/build/services/user/sql.js +9 -1
  40. package/build/services/user/sso-provision.js +14 -3
  41. package/build/start/apply-report.d.ts +26 -0
  42. package/build/start/apply-report.js +65 -0
  43. package/build/start/config.js +8 -1
  44. package/build/start/workers.js +170 -33
  45. package/build/tsconfig.tsbuildinfo +1 -1
  46. package/build/types/auth.d.ts +27 -1
  47. package/build/types/index.d.ts +1 -1
  48. package/build/types/startup.d.ts +108 -4
  49. package/dashboard/dist/assets/{AdminDashboard-CahUELrr.js → AdminDashboard-D2unnS2b.js} +2 -2
  50. package/dashboard/dist/assets/{AdminDashboard-CahUELrr.js.map → AdminDashboard-D2unnS2b.js.map} +1 -1
  51. package/dashboard/dist/assets/{AgentConfigPage-CkMv-cTV.js → AgentConfigPage-CBkf403g.js} +2 -2
  52. package/dashboard/dist/assets/{AgentConfigPage-CkMv-cTV.js.map → AgentConfigPage-CBkf403g.js.map} +1 -1
  53. package/dashboard/dist/assets/{AgentDetailPage-ZGea3Z4A.js → AgentDetailPage-CAIU3yzo.js} +2 -2
  54. package/dashboard/dist/assets/{AgentDetailPage-ZGea3Z4A.js.map → AgentDetailPage-CAIU3yzo.js.map} +1 -1
  55. package/dashboard/dist/assets/{AgentsPage-BMWSUJGi.js → AgentsPage-qP9fWMyT.js} +2 -2
  56. package/dashboard/dist/assets/{AgentsPage-BMWSUJGi.js.map → AgentsPage-qP9fWMyT.js.map} +1 -1
  57. package/dashboard/dist/assets/AvailableEscalationsPage-DvWaiafI.js +2 -0
  58. package/dashboard/dist/assets/AvailableEscalationsPage-DvWaiafI.js.map +1 -0
  59. package/dashboard/dist/assets/{BotPicker-DN8tq7pz.js → BotPicker-BN-MKITV.js} +2 -2
  60. package/dashboard/dist/assets/{BotPicker-DN8tq7pz.js.map → BotPicker-BN-MKITV.js.map} +1 -1
  61. package/dashboard/dist/assets/{CapabilitiesPage-EAO3Ae0S.js → CapabilitiesPage-CJfmWokN.js} +2 -2
  62. package/dashboard/dist/assets/{CapabilitiesPage-EAO3Ae0S.js.map → CapabilitiesPage-CJfmWokN.js.map} +1 -1
  63. package/dashboard/dist/assets/{CollapsibleSection-J-RejbjG.js → CollapsibleSection-BvMHlHyt.js} +2 -2
  64. package/dashboard/dist/assets/{CollapsibleSection-J-RejbjG.js.map → CollapsibleSection-BvMHlHyt.js.map} +1 -1
  65. package/dashboard/dist/assets/{CountdownTimer-Dw8N9tmQ.js → CountdownTimer-By4rbMDN.js} +2 -2
  66. package/dashboard/dist/assets/{CountdownTimer-Dw8N9tmQ.js.map → CountdownTimer-By4rbMDN.js.map} +1 -1
  67. package/dashboard/dist/assets/{CredentialsPage-CTurxwRn.js → CredentialsPage-2TvvRwGJ.js} +2 -2
  68. package/dashboard/dist/assets/{CredentialsPage-CTurxwRn.js.map → CredentialsPage-2TvvRwGJ.js.map} +1 -1
  69. package/dashboard/dist/assets/{CronLabel-DZ5TmIQG.js → CronLabel-HxmsDSnV.js} +2 -2
  70. package/dashboard/dist/assets/{CronLabel-DZ5TmIQG.js.map → CronLabel-HxmsDSnV.js.map} +1 -1
  71. package/dashboard/dist/assets/{CustomDurationPicker-BES_FTrm.js → CustomDurationPicker-8Ao-1pKA.js} +2 -2
  72. package/dashboard/dist/assets/{CustomDurationPicker-BES_FTrm.js.map → CustomDurationPicker-8Ao-1pKA.js.map} +1 -1
  73. package/dashboard/dist/assets/{DropZone-BWD9aGOz.js → DropZone-DovkhN2p.js} +2 -2
  74. package/dashboard/dist/assets/{DropZone-BWD9aGOz.js.map → DropZone-DovkhN2p.js.map} +1 -1
  75. package/dashboard/dist/assets/{ElapsedCell-CIGRporU.js → ElapsedCell-BkRu9Xpd.js} +2 -2
  76. package/dashboard/dist/assets/{ElapsedCell-CIGRporU.js.map → ElapsedCell-BkRu9Xpd.js.map} +1 -1
  77. package/dashboard/dist/assets/EntityTimelinePanel--E6hLMCM.js +2 -0
  78. package/dashboard/dist/assets/{EntityTimelinePanel-CKIFsDOB.js.map → EntityTimelinePanel--E6hLMCM.js.map} +1 -1
  79. package/dashboard/dist/assets/{EscalationListSchemaPage-DOrv-quD.js → EscalationListSchemaPage-CdFtqEEX.js} +3 -3
  80. package/dashboard/dist/assets/{EscalationListSchemaPage-DOrv-quD.js.map → EscalationListSchemaPage-CdFtqEEX.js.map} +1 -1
  81. package/dashboard/dist/assets/{EscalationSchemaPage-DAOVAxAM.js → EscalationSchemaPage-BsjS2axz.js} +2 -2
  82. package/dashboard/dist/assets/{EscalationSchemaPage-DAOVAxAM.js.map → EscalationSchemaPage-BsjS2axz.js.map} +1 -1
  83. package/dashboard/dist/assets/{EscalationsOverview-B27sDn5O.js → EscalationsOverview-FL-xteVc.js} +2 -2
  84. package/dashboard/dist/assets/{EscalationsOverview-B27sDn5O.js.map → EscalationsOverview-FL-xteVc.js.map} +1 -1
  85. package/dashboard/dist/assets/{EventTable-Co1d40Qq.js → EventTable-BOcgZ78i.js} +2 -2
  86. package/dashboard/dist/assets/{EventTable-Co1d40Qq.js.map → EventTable-BOcgZ78i.js.map} +1 -1
  87. package/dashboard/dist/assets/{FilterBar-2ZfU21EA.js → FilterBar-DfCiCmm-.js} +2 -2
  88. package/dashboard/dist/assets/{FilterBar-2ZfU21EA.js.map → FilterBar-DfCiCmm-.js.map} +1 -1
  89. package/dashboard/dist/assets/{GraphInvokePage-pdvc9VSv.js → GraphInvokePage-DfVeiN-8.js} +2 -2
  90. package/dashboard/dist/assets/{GraphInvokePage-pdvc9VSv.js.map → GraphInvokePage-DfVeiN-8.js.map} +1 -1
  91. package/dashboard/dist/assets/{HomePage-CLlDsBnw.js → HomePage-C2IhF9WB.js} +2 -2
  92. package/dashboard/dist/assets/{HomePage-CLlDsBnw.js.map → HomePage-C2IhF9WB.js.map} +1 -1
  93. package/dashboard/dist/assets/{ListToolbar-DMremj2e.js → ListToolbar-DA0PTOl5.js} +2 -2
  94. package/dashboard/dist/assets/{ListToolbar-DMremj2e.js.map → ListToolbar-DA0PTOl5.js.map} +1 -1
  95. package/dashboard/dist/assets/{McpOverview-BhztmhoL.js → McpOverview-DstPch5M.js} +2 -2
  96. package/dashboard/dist/assets/{McpOverview-BhztmhoL.js.map → McpOverview-DstPch5M.js.map} +1 -1
  97. package/dashboard/dist/assets/{McpQueryDetailPage-BseZfrhc.js → McpQueryDetailPage-Csv0PKE0.js} +2 -2
  98. package/dashboard/dist/assets/{McpQueryDetailPage-BseZfrhc.js.map → McpQueryDetailPage-Csv0PKE0.js.map} +1 -1
  99. package/dashboard/dist/assets/{McpQueryPage-DMzkble7.js → McpQueryPage-DxmqCkly.js} +2 -2
  100. package/dashboard/dist/assets/{McpQueryPage-DMzkble7.js.map → McpQueryPage-DxmqCkly.js.map} +1 -1
  101. package/dashboard/dist/assets/{McpRunDetailPage-DqaBQAnn.js → McpRunDetailPage-CcJOlp_B.js} +2 -2
  102. package/dashboard/dist/assets/{McpRunDetailPage-DqaBQAnn.js.map → McpRunDetailPage-CcJOlp_B.js.map} +1 -1
  103. package/dashboard/dist/assets/{McpRunsPage-Du8GnHFv.js → McpRunsPage-BZCR043j.js} +2 -2
  104. package/dashboard/dist/assets/{McpRunsPage-Du8GnHFv.js.map → McpRunsPage-BZCR043j.js.map} +1 -1
  105. package/dashboard/dist/assets/{NamespacePill-C09QuOEz.js → NamespacePill-BeifzjUm.js} +2 -2
  106. package/dashboard/dist/assets/{NamespacePill-C09QuOEz.js.map → NamespacePill-BeifzjUm.js.map} +1 -1
  107. package/dashboard/dist/assets/{OperationsPage-CL2feqwS.js → OperationsPage-DMsPXITh.js} +3 -3
  108. package/dashboard/dist/assets/{OperationsPage-CL2feqwS.js.map → OperationsPage-DMsPXITh.js.map} +1 -1
  109. package/dashboard/dist/assets/{OperatorDashboard-BHiGQZN_.js → OperatorDashboard-DSloftQ5.js} +2 -2
  110. package/dashboard/dist/assets/{OperatorDashboard-BHiGQZN_.js.map → OperatorDashboard-DSloftQ5.js.map} +1 -1
  111. package/dashboard/dist/assets/{PageHeader-B7YJxa4o.js → PageHeader-BpeBHqyc.js} +2 -2
  112. package/dashboard/dist/assets/{PageHeader-B7YJxa4o.js.map → PageHeader-BpeBHqyc.js.map} +1 -1
  113. package/dashboard/dist/assets/{PageHeaderWithStats-gT-5ovJh.js → PageHeaderWithStats-JXeUFa_g.js} +2 -2
  114. package/dashboard/dist/assets/{PageHeaderWithStats-gT-5ovJh.js.map → PageHeaderWithStats-JXeUFa_g.js.map} +1 -1
  115. package/dashboard/dist/assets/{PersonaDetailPage-D6GGZgUS.js → PersonaDetailPage-jDVRCLbU.js} +2 -2
  116. package/dashboard/dist/assets/{PersonaDetailPage-D6GGZgUS.js.map → PersonaDetailPage-jDVRCLbU.js.map} +1 -1
  117. package/dashboard/dist/assets/{PersonasPage-BQYCdmAs.js → PersonasPage-DnDDwXoy.js} +2 -2
  118. package/dashboard/dist/assets/{PersonasPage-BQYCdmAs.js.map → PersonasPage-DnDDwXoy.js.map} +1 -1
  119. package/dashboard/dist/assets/{ProcessDetailPage-P45jOLim.js → ProcessDetailPage-CfAUU6q2.js} +2 -2
  120. package/dashboard/dist/assets/{ProcessDetailPage-P45jOLim.js.map → ProcessDetailPage-CfAUU6q2.js.map} +1 -1
  121. package/dashboard/dist/assets/{ProcessesListPage-CgdzgCY6.js → ProcessesListPage-CnAXzaVv.js} +2 -2
  122. package/dashboard/dist/assets/{ProcessesListPage-CgdzgCY6.js.map → ProcessesListPage-CnAXzaVv.js.map} +1 -1
  123. package/dashboard/dist/assets/RoleDetailPage-Dg1p6Qz_.js +8 -0
  124. package/dashboard/dist/assets/RoleDetailPage-Dg1p6Qz_.js.map +1 -0
  125. package/dashboard/dist/assets/{RolePill-CtYI1_k1.js → RolePill-EocCXZh0.js} +2 -2
  126. package/dashboard/dist/assets/{RolePill-CtYI1_k1.js.map → RolePill-EocCXZh0.js.map} +1 -1
  127. package/dashboard/dist/assets/{RolesPage-Ci7_PbPt.js → RolesPage-DeRVQux8.js} +2 -2
  128. package/dashboard/dist/assets/{RolesPage-Ci7_PbPt.js.map → RolesPage-DeRVQux8.js.map} +1 -1
  129. package/dashboard/dist/assets/{RunAsSelector-CB0pV097.js → RunAsSelector-BFNqQGuG.js} +2 -2
  130. package/dashboard/dist/assets/{RunAsSelector-CB0pV097.js.map → RunAsSelector-BFNqQGuG.js.map} +1 -1
  131. package/dashboard/dist/assets/{ScanCodesPage-DpbPhAj1.js → ScanCodesPage-D0GOdk5m.js} +2 -2
  132. package/dashboard/dist/assets/{ScanCodesPage-DpbPhAj1.js.map → ScanCodesPage-D0GOdk5m.js.map} +1 -1
  133. package/dashboard/dist/assets/{ScanSchemeDetailPage-CGnMGlt0.js → ScanSchemeDetailPage-vFqoe_P4.js} +2 -2
  134. package/dashboard/dist/assets/{ScanSchemeDetailPage-CGnMGlt0.js.map → ScanSchemeDetailPage-vFqoe_P4.js.map} +1 -1
  135. package/dashboard/dist/assets/ScanStationPage-DH1ynTX9.js +2 -0
  136. package/dashboard/dist/assets/{ScanStationPage-BTeV7TGy.js.map → ScanStationPage-DH1ynTX9.js.map} +1 -1
  137. package/dashboard/dist/assets/{ScopeBadge-B76rOtA0.js → ScopeBadge-H5dEqeHi.js} +2 -2
  138. package/dashboard/dist/assets/{ScopeBadge-B76rOtA0.js.map → ScopeBadge-H5dEqeHi.js.map} +1 -1
  139. package/dashboard/dist/assets/{StickyPagination-DH-0JEyx.js → StickyPagination-B99hVu95.js} +2 -2
  140. package/dashboard/dist/assets/{StickyPagination-DH-0JEyx.js.map → StickyPagination-B99hVu95.js.map} +1 -1
  141. package/dashboard/dist/assets/{StreamMessageDetail-u-pDrHfS.js → StreamMessageDetail-DcDGISrv.js} +2 -2
  142. package/dashboard/dist/assets/{StreamMessageDetail-u-pDrHfS.js.map → StreamMessageDetail-DcDGISrv.js.map} +1 -1
  143. package/dashboard/dist/assets/{SwimlaneTimeline-vN1N8BGy.js → SwimlaneTimeline-BP3mSQAg.js} +2 -2
  144. package/dashboard/dist/assets/{SwimlaneTimeline-vN1N8BGy.js.map → SwimlaneTimeline-BP3mSQAg.js.map} +1 -1
  145. package/dashboard/dist/assets/{TagInput-BQAPOp17.js → TagInput-Ch5u6iPH.js} +2 -2
  146. package/dashboard/dist/assets/{TagInput-BQAPOp17.js.map → TagInput-Ch5u6iPH.js.map} +1 -1
  147. package/dashboard/dist/assets/{TaskDetailPage-CAQm6avs.js → TaskDetailPage-_XWLJzt-.js} +2 -2
  148. package/dashboard/dist/assets/{TaskDetailPage-CAQm6avs.js.map → TaskDetailPage-_XWLJzt-.js.map} +1 -1
  149. package/dashboard/dist/assets/{TaskQueuePill-C2NImrwl.js → TaskQueuePill-Bz146p-P.js} +2 -2
  150. package/dashboard/dist/assets/{TaskQueuePill-C2NImrwl.js.map → TaskQueuePill-Bz146p-P.js.map} +1 -1
  151. package/dashboard/dist/assets/{TasksListPage-C1bT3DT9.js → TasksListPage-iGriKiO2.js} +2 -2
  152. package/dashboard/dist/assets/{TasksListPage-C1bT3DT9.js.map → TasksListPage-iGriKiO2.js.map} +1 -1
  153. package/dashboard/dist/assets/{TimeAgo-qZxkJ8Am.js → TimeAgo-BO33VeFl.js} +2 -2
  154. package/dashboard/dist/assets/{TimeAgo-qZxkJ8Am.js.map → TimeAgo-BO33VeFl.js.map} +1 -1
  155. package/dashboard/dist/assets/{TimestampCell-CC3dz6FG.js → TimestampCell-KAjX7w35.js} +2 -2
  156. package/dashboard/dist/assets/{TimestampCell-CC3dz6FG.js.map → TimestampCell-KAjX7w35.js.map} +1 -1
  157. package/dashboard/dist/assets/{ToolPill-FOZm67TS.js → ToolPill-sj8OkBB0.js} +2 -2
  158. package/dashboard/dist/assets/{ToolPill-FOZm67TS.js.map → ToolPill-sj8OkBB0.js.map} +1 -1
  159. package/dashboard/dist/assets/{ToolTestPanel-C3sSQUvw.js → ToolTestPanel-BchG2yC6.js} +2 -2
  160. package/dashboard/dist/assets/{ToolTestPanel-C3sSQUvw.js.map → ToolTestPanel-BchG2yC6.js.map} +1 -1
  161. package/dashboard/dist/assets/{TopicDetailPage-ClI0I8Mu.js → TopicDetailPage-BaK8H0o1.js} +2 -2
  162. package/dashboard/dist/assets/{TopicDetailPage-ClI0I8Mu.js.map → TopicDetailPage-BaK8H0o1.js.map} +1 -1
  163. package/dashboard/dist/assets/{TopicsPage-CNf2VZud.js → TopicsPage-DEyvm669.js} +2 -2
  164. package/dashboard/dist/assets/{TopicsPage-CNf2VZud.js.map → TopicsPage-DEyvm669.js.map} +1 -1
  165. package/dashboard/dist/assets/{UserName-BdMHmyL3.js → UserName-BV6SKI9P.js} +2 -2
  166. package/dashboard/dist/assets/{UserName-BdMHmyL3.js.map → UserName-BV6SKI9P.js.map} +1 -1
  167. package/dashboard/dist/assets/{WorkflowExecutionPage-Ba4mYFoW.js → WorkflowExecutionPage-1sKoEFNC.js} +2 -2
  168. package/dashboard/dist/assets/{WorkflowExecutionPage-Ba4mYFoW.js.map → WorkflowExecutionPage-1sKoEFNC.js.map} +1 -1
  169. package/dashboard/dist/assets/{WorkflowPill-C5TEWlfO.js → WorkflowPill-BcA7S3gI.js} +2 -2
  170. package/dashboard/dist/assets/{WorkflowPill-C5TEWlfO.js.map → WorkflowPill-BcA7S3gI.js.map} +1 -1
  171. package/dashboard/dist/assets/{WorkflowsDashboard-ImEm16tX.js → WorkflowsDashboard-YTHDZZOD.js} +2 -2
  172. package/dashboard/dist/assets/{WorkflowsDashboard-ImEm16tX.js.map → WorkflowsDashboard-YTHDZZOD.js.map} +1 -1
  173. package/dashboard/dist/assets/{WorkflowsOverview-BpWyV_tj.js → WorkflowsOverview-ucXPLTtm.js} +2 -2
  174. package/dashboard/dist/assets/{WorkflowsOverview-BpWyV_tj.js.map → WorkflowsOverview-ucXPLTtm.js.map} +1 -1
  175. package/dashboard/dist/assets/{YamlWorkflowDetailPage-BFBlw1YY.js → YamlWorkflowDetailPage-C_RTZKqZ.js} +2 -2
  176. package/dashboard/dist/assets/{YamlWorkflowDetailPage-BFBlw1YY.js.map → YamlWorkflowDetailPage-C_RTZKqZ.js.map} +1 -1
  177. package/dashboard/dist/assets/{YamlWorkflowsPage-C9gxapRg.js → YamlWorkflowsPage-Usid3w2W.js} +2 -2
  178. package/dashboard/dist/assets/{YamlWorkflowsPage-C9gxapRg.js.map → YamlWorkflowsPage-Usid3w2W.js.map} +1 -1
  179. package/dashboard/dist/assets/{agents-BJQtJTiz.js → agents-BTDsRK8e.js} +2 -2
  180. package/dashboard/dist/assets/{agents-BJQtJTiz.js.map → agents-BTDsRK8e.js.map} +1 -1
  181. package/dashboard/dist/assets/{bots-DDlU1gMy.js → bots-DxLrfdfr.js} +2 -2
  182. package/dashboard/dist/assets/{bots-DDlU1gMy.js.map → bots-DxLrfdfr.js.map} +1 -1
  183. package/dashboard/dist/assets/{capabilities-qYrUpdid.js → capabilities-DbTmeW-S.js} +2 -2
  184. package/dashboard/dist/assets/{capabilities-qYrUpdid.js.map → capabilities-DbTmeW-S.js.map} +1 -1
  185. package/dashboard/dist/assets/{controlplane-DnJ1VDTs.js → controlplane-CEBntAL4.js} +2 -2
  186. package/dashboard/dist/assets/{controlplane-DnJ1VDTs.js.map → controlplane-CEBntAL4.js.map} +1 -1
  187. package/dashboard/dist/assets/escalation-columns-Carqdwoh.js +2 -0
  188. package/dashboard/dist/assets/escalation-columns-Carqdwoh.js.map +1 -0
  189. package/dashboard/dist/assets/{index-KotwPxGB.js → index-B2hz0pUh.js} +2 -2
  190. package/dashboard/dist/assets/{index-KotwPxGB.js.map → index-B2hz0pUh.js.map} +1 -1
  191. package/dashboard/dist/assets/{index-04QQsxMp.js → index-B9m7fA3M.js} +2 -2
  192. package/dashboard/dist/assets/{index-04QQsxMp.js.map → index-B9m7fA3M.js.map} +1 -1
  193. package/dashboard/dist/assets/{index-B5q8ksfv.js → index-BhapT-Vl.js} +2 -2
  194. package/dashboard/dist/assets/{index-B5q8ksfv.js.map → index-BhapT-Vl.js.map} +1 -1
  195. package/dashboard/dist/assets/{index-CtAPxA03.js → index-Bqm4zu46.js} +2 -2
  196. package/dashboard/dist/assets/{index-CtAPxA03.js.map → index-Bqm4zu46.js.map} +1 -1
  197. package/dashboard/dist/assets/{index-LiLVAQzB.js → index-C0hSttF5.js} +2 -2
  198. package/dashboard/dist/assets/{index-LiLVAQzB.js.map → index-C0hSttF5.js.map} +1 -1
  199. package/dashboard/dist/assets/{index-DhRdWzz0.js → index-CDkg6iOE.js} +4 -4
  200. package/dashboard/dist/assets/{index-DhRdWzz0.js.map → index-CDkg6iOE.js.map} +1 -1
  201. package/dashboard/dist/assets/{index-D-5F3Bw-.js → index-CVBBkW8V.js} +2 -2
  202. package/dashboard/dist/assets/{index-D-5F3Bw-.js.map → index-CVBBkW8V.js.map} +1 -1
  203. package/dashboard/dist/assets/{index-BUpB9ezn.js → index-CgIBjZta.js} +2 -2
  204. package/dashboard/dist/assets/{index-BUpB9ezn.js.map → index-CgIBjZta.js.map} +1 -1
  205. package/dashboard/dist/assets/{index-C991QfUN.js → index-DBXm49S6.js} +27 -27
  206. package/dashboard/dist/assets/index-DBXm49S6.js.map +1 -0
  207. package/dashboard/dist/assets/{index-BAqQSgxn.js → index-De8iV1y2.js} +2 -2
  208. package/dashboard/dist/assets/{index-BAqQSgxn.js.map → index-De8iV1y2.js.map} +1 -1
  209. package/dashboard/dist/assets/{index-BHbO4F8Z.js → index-DsgjFRvA.js} +2 -2
  210. package/dashboard/dist/assets/{index-BHbO4F8Z.js.map → index-DsgjFRvA.js.map} +1 -1
  211. package/dashboard/dist/assets/{index-CFlmubaP.js → index-kes8V4Xw.js} +2 -2
  212. package/dashboard/dist/assets/{index-CFlmubaP.js.map → index-kes8V4Xw.js.map} +1 -1
  213. package/dashboard/dist/assets/{index-CroJTX8g.js → index-nwLh3CK2.js} +2 -2
  214. package/dashboard/dist/assets/{index-CroJTX8g.js.map → index-nwLh3CK2.js.map} +1 -1
  215. package/dashboard/dist/assets/{knowledge-CnMeg8Rw.js → knowledge-oFYAanUp.js} +2 -2
  216. package/dashboard/dist/assets/{knowledge-CnMeg8Rw.js.map → knowledge-oFYAanUp.js.map} +1 -1
  217. package/dashboard/dist/assets/{mcp-CHPSFv7m.js → mcp-C9Kw4Ow8.js} +2 -2
  218. package/dashboard/dist/assets/{mcp-CHPSFv7m.js.map → mcp-C9Kw4Ow8.js.map} +1 -1
  219. package/dashboard/dist/assets/{mcp-query-C19EGwdN.js → mcp-query-BwzpZ91Z.js} +2 -2
  220. package/dashboard/dist/assets/{mcp-query-C19EGwdN.js.map → mcp-query-BwzpZ91Z.js.map} +1 -1
  221. package/dashboard/dist/assets/{personas-Br1Vo2S3.js → personas-D5ehmtRb.js} +2 -2
  222. package/dashboard/dist/assets/{personas-Br1Vo2S3.js.map → personas-D5ehmtRb.js.map} +1 -1
  223. package/dashboard/dist/assets/{pipelines-QMrFoJZX.js → pipelines-xgPKGEdD.js} +2 -2
  224. package/dashboard/dist/assets/{pipelines-QMrFoJZX.js.map → pipelines-xgPKGEdD.js.map} +1 -1
  225. package/dashboard/dist/assets/{tasks-Doy_7cGX.js → tasks-CLyrl-MU.js} +2 -2
  226. package/dashboard/dist/assets/{tasks-Doy_7cGX.js.map → tasks-CLyrl-MU.js.map} +1 -1
  227. package/dashboard/dist/assets/{topics-BcJS4G09.js → topics-B_gO7CQ0.js} +2 -2
  228. package/dashboard/dist/assets/{topics-BcJS4G09.js.map → topics-B_gO7CQ0.js.map} +1 -1
  229. package/dashboard/dist/assets/{useEventHooks-ldE5o0ok.js → useEventHooks-BdWYm63U.js} +2 -2
  230. package/dashboard/dist/assets/{useEventHooks-ldE5o0ok.js.map → useEventHooks-BdWYm63U.js.map} +1 -1
  231. package/dashboard/dist/assets/{useNamespace-CCu8fZc6.js → useNamespace-C238M4Qn.js} +2 -2
  232. package/dashboard/dist/assets/{useNamespace-CCu8fZc6.js.map → useNamespace-C238M4Qn.js.map} +1 -1
  233. package/dashboard/dist/assets/{useYamlActivityEvents-DDrXwFXX.js → useYamlActivityEvents-B2ryEK4S.js} +2 -2
  234. package/dashboard/dist/assets/{useYamlActivityEvents-DDrXwFXX.js.map → useYamlActivityEvents-B2ryEK4S.js.map} +1 -1
  235. package/dashboard/dist/assets/{users-BvKhSq1i.js → users-BFaTe6Mt.js} +2 -2
  236. package/dashboard/dist/assets/{users-BvKhSq1i.js.map → users-BFaTe6Mt.js.map} +1 -1
  237. package/dashboard/dist/assets/{vendor-icons-Aw7bzBxa.js → vendor-icons-BPsNpK3Y.js} +142 -137
  238. package/dashboard/dist/assets/vendor-icons-BPsNpK3Y.js.map +1 -0
  239. package/dashboard/dist/assets/{workflows-D09ysQF1.js → workflows-DXz7tZxp.js} +2 -2
  240. package/dashboard/dist/assets/{workflows-D09ysQF1.js.map → workflows-DXz7tZxp.js.map} +1 -1
  241. package/dashboard/dist/assets/{yaml-workflows-BFHrxEl4.js → yaml-workflows-u3xuRAnS.js} +2 -2
  242. package/dashboard/dist/assets/{yaml-workflows-BFHrxEl4.js.map → yaml-workflows-u3xuRAnS.js.map} +1 -1
  243. package/dashboard/dist/index.html +2 -2
  244. package/docs/code-owned-configuration.md +131 -0
  245. package/docs/hitl/x-lt-transition.md +13 -0
  246. package/docs/scan-codes.md +24 -0
  247. package/package.json +1 -1
  248. package/dashboard/dist/assets/AvailableEscalationsPage-BjsbfsWW.js +0 -2
  249. package/dashboard/dist/assets/AvailableEscalationsPage-BjsbfsWW.js.map +0 -1
  250. package/dashboard/dist/assets/EntityTimelinePanel-CKIFsDOB.js +0 -2
  251. package/dashboard/dist/assets/RoleDetailPage-Dme2pa9z.js +0 -8
  252. package/dashboard/dist/assets/RoleDetailPage-Dme2pa9z.js.map +0 -1
  253. package/dashboard/dist/assets/ScanStationPage-BTeV7TGy.js +0 -2
  254. package/dashboard/dist/assets/escalation-columns-BCnVWr_n.js +0 -2
  255. package/dashboard/dist/assets/escalation-columns-BCnVWr_n.js.map +0 -1
  256. package/dashboard/dist/assets/index-C991QfUN.js.map +0 -1
  257. package/dashboard/dist/assets/vendor-icons-Aw7bzBxa.js.map +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ProcessesListPage-CgdzgCY6.js","./vendor-query-RUZdMvN6.js","./tasks-Doy_7cGX.js","./workflows-D09ysQF1.js","./useEventHooks-ldE5o0ok.js","./useFilterParams-crmlBw_l.js","./vendor-react-CdqEC2zv.js","./useDebouncedValue-C4P2jQuh.js","./api-path-u2Jf9QXS.js","./DataTable-Bir0Xs1p.js","./EmptyState-lpUFYfun.js","./TimestampCell-CC3dz6FG.js","./StickyPagination-DH-0JEyx.js","./FilterBar-2ZfU21EA.js","./vendor-icons-Aw7bzBxa.js","./PageHeader-B7YJxa4o.js","./ListToolbar-DMremj2e.js","./WorkflowPill-C5TEWlfO.js","./ProcessDetailPage-P45jOLim.js","./PageHeaderWithStats-gT-5ovJh.js","./StatusBadge-DkgllZHv.js","./RolePill-CtYI1_k1.js","./UserName-BdMHmyL3.js","./users-BvKhSq1i.js","./McpOverview-BhztmhoL.js","./mcp-CHPSFv7m.js","./pipelines-QMrFoJZX.js","./yaml-workflows-BFHrxEl4.js","./controlplane-DnJ1VDTs.js","./StatCard-BXQ8dD9Y.js","./McpRunsPage-Du8GnHFv.js","./useNamespace-CCu8fZc6.js","./ElapsedCell-CIGRporU.js","./RowActions-eYrzgQSj.js","./McpRunDetailPage-DqaBQAnn.js","./SegmentedTabs-DXNzY05q.js","./EventTable-Co1d40Qq.js","./SwimlaneTimeline-vN1N8BGy.js","./StreamMessageDetail-u-pDrHfS.js","./CopyableId-4Lqlc5cU.js","./McpQueryPage-DMzkble7.js","./mcp-query-C19EGwdN.js","./McpQueryDetailPage-BseZfrhc.js","./TagInput-BQAPOp17.js","./CollapsibleSection-J-RejbjG.js","./useYamlActivityEvents-DDrXwFXX.js","./helpers-DzO-OGPe.js","./RunAsSelector-CB0pV097.js","./BotPicker-DN8tq7pz.js","./bots-DDlU1gMy.js","./ToolPill-FOZm67TS.js","./TimeAgo-qZxkJ8Am.js","./EscalationsOverview-B27sDn5O.js","./AvailableEscalationsPage-BjsbfsWW.js","./task-queues-7-sHKPsN.js","./CustomDurationPicker-BES_FTrm.js","./Modal-BU7No9NH.js","./constants-BHkpVaqx.js","./escalation-columns-BCnVWr_n.js","./EntityTimelinePanel-CKIFsDOB.js","./PriorityBadge-BETdj4M-.js","./CountdownTimer-Dw8N9tmQ.js","./OperatorDashboard-BHiGQZN_.js","./index-BHbO4F8Z.js","./WorkflowsOverview-BpWyV_tj.js","./index-DhRdWzz0.js","./NamespacePill-C09QuOEz.js","./WorkflowsDashboard-ImEm16tX.js","./YamlWorkflowsPage-C9gxapRg.js","./GraphInvokePage-pdvc9VSv.js","./YamlWorkflowDetailPage-BFBlw1YY.js","./TasksListPage-C1bT3DT9.js","./TaskDetailPage-CAQm6avs.js","./WorkflowExecutionPage-Ba4mYFoW.js","./AdminDashboard-CahUELrr.js","./index-BAqQSgxn.js","./TaskQueuePill-C2NImrwl.js","./index-BUpB9ezn.js","./ConfirmDeleteModal-CQsJUzEa.js","./index-B5q8ksfv.js","./ToolTestPanel-C3sSQUvw.js","./index-LiLVAQzB.js","./index-CtAPxA03.js","./personas-Br1Vo2S3.js","./ScopeBadge-B76rOtA0.js","./RolesPage-Ci7_PbPt.js","./RoleDetailPage-Dme2pa9z.js","./AutoGrowTextarea-DgEQeRQw.js","./PersonasPage-BQYCdmAs.js","./PersonaDetailPage-D6GGZgUS.js","./EscalationSchemaPage-DAOVAxAM.js","./EscalationListSchemaPage-DOrv-quD.js","./ScanCodesPage-DpbPhAj1.js","./ScanSchemeDetailPage-CGnMGlt0.js","./ScanStationPage-BTeV7TGy.js","./index-CFlmubaP.js","./OperationsPage-CL2feqwS.js","./index-KotwPxGB.js","./index-D-5F3Bw-.js","./CredentialsPage-CTurxwRn.js","./index-CroJTX8g.js","./DropZone-BWD9aGOz.js","./index-04QQsxMp.js","./knowledge-CnMeg8Rw.js","./HomePage-CLlDsBnw.js","./AgentsPage-BMWSUJGi.js","./agents-BJQtJTiz.js","./AgentDetailPage-ZGea3Z4A.js","./CronLabel-DZ5TmIQG.js","./AgentConfigPage-CkMv-cTV.js","./capabilities-qYrUpdid.js","./topics-BcJS4G09.js","./CapabilitiesPage-EAO3Ae0S.js","./TopicsPage-CNf2VZud.js","./TopicDetailPage-ClI0I8Mu.js"])))=>i.map(i=>d[i]);
2
- var X_=Object.defineProperty;var K_=(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)=>K_(i,typeof t!="symbol"?t+"":t,r);import{r as J_,a as j,j as y,u as pt,b as gt,c as Et,g as Q_,Q as Z_,d as W_}from"./vendor-query-RUZdMvN6.js";import{r as ew,u as go,a as mn,L as Ii,N as Hs,b as ib,c as Xn,O as Ls,d as tw,R as nw}from"./vendor-react-CdqEC2zv.js";import{X as Cn,E as rw,S as iw,a as ou,M as sw,C as sb,b as Yh,I as Xh,R as ab,B as ob,U as aw,c as ow,L as lw,d as cw,Z as uw,P as zg,e as lb,f as fw,g as Ug,h as Pg,i as Ig,j as hw,W as wd,k as dw,l as mw,F as pw,m as gw,n as yw,D as bw,N as vw,o as xw,p as _w,q as cb,r as ub,s as ww,t as Sw,u as Ew,v as Ow,w as Aw,G as jw,T as Tw,x as Nw,y as kw,z as Cw}from"./vendor-icons-Aw7bzBxa.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))s(l);new MutationObserver(l=>{for(const c of l)if(c.type==="childList")for(const m of c.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&s(m)}).observe(document,{childList:!0,subtree:!0});function r(l){const c={};return l.integrity&&(c.integrity=l.integrity),l.referrerPolicy&&(c.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?c.credentials="include":l.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function s(l){if(l.ep)return;l.ep=!0;const c=r(l);fetch(l.href,c)}})();var Th={exports:{}},Ga={},Nh={exports:{}},kh={};/**
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={};/**
3
3
  * @license React
4
4
  * scheduler.production.js
5
5
  *
@@ -7,7 +7,7 @@ var X_=Object.defineProperty;var K_=(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 Mw(){return $g||($g=1,(function(i){function t(Y,oe){var de=Y.length;Y.push(oe);e:for(;0<de;){var Oe=de-1>>>1,le=Y[Oe];if(0<l(le,oe))Y[Oe]=oe,Y[de]=le,de=Oe;else break e}}function r(Y){return Y.length===0?null:Y[0]}function s(Y){if(Y.length===0)return null;var oe=Y[0],de=Y.pop();if(de!==oe){Y[0]=de;e:for(var Oe=0,le=Y.length,je=le>>>1;Oe<je;){var Se=2*(Oe+1)-1,Ne=Y[Se],be=Se+1,at=Y[be];if(0>l(Ne,de))be<le&&0>l(at,Ne)?(Y[Oe]=at,Y[be]=de,Oe=be):(Y[Oe]=Ne,Y[Se]=de,Oe=Se);else if(be<le&&0>l(at,de))Y[Oe]=at,Y[be]=de,Oe=be;else break e}}return oe}function l(Y,oe){var de=Y.sortIndex-oe.sortIndex;return de!==0?de:Y.id-oe.id}if(i.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;i.unstable_now=function(){return c.now()}}else{var m=Date,p=m.now();i.unstable_now=function(){return m.now()-p}}var g=[],f=[],d=1,b=null,v=3,_=!1,w=!1,S=!1,M=!1,L=typeof setTimeout=="function"?setTimeout:null,z=typeof clearTimeout=="function"?clearTimeout:null,ie=typeof setImmediate<"u"?setImmediate:null;function ae(Y){for(var oe=r(f);oe!==null;){if(oe.callback===null)s(f);else if(oe.startTime<=Y)s(f),oe.sortIndex=oe.expirationTime,t(g,oe);else break;oe=r(f)}}function C(Y){if(S=!1,ae(Y),!w)if(r(g)!==null)w=!0,I||(I=!0,Q());else{var oe=r(f);oe!==null&&Te(C,oe.startTime-Y)}}var I=!1,re=-1,K=5,B=-1;function G(){return M?!0:!(i.unstable_now()-B<K)}function W(){if(M=!1,I){var Y=i.unstable_now();B=Y;var oe=!0;try{e:{w=!1,S&&(S=!1,z(re),re=-1),_=!0;var de=v;try{t:{for(ae(Y),b=r(g);b!==null&&!(b.expirationTime>Y&&G());){var Oe=b.callback;if(typeof Oe=="function"){b.callback=null,v=b.priorityLevel;var le=Oe(b.expirationTime<=Y);if(Y=i.unstable_now(),typeof le=="function"){b.callback=le,ae(Y),oe=!0;break t}b===r(g)&&s(g),ae(Y)}else s(g);b=r(g)}if(b!==null)oe=!0;else{var je=r(f);je!==null&&Te(C,je.startTime-Y),oe=!1}}break e}finally{b=null,v=de,_=!1}oe=void 0}}finally{oe?Q():I=!1}}}var Q;if(typeof ie=="function")Q=function(){ie(W)};else if(typeof MessageChannel<"u"){var he=new MessageChannel,_e=he.port2;he.port1.onmessage=W,Q=function(){_e.postMessage(null)}}else Q=function(){L(W,0)};function Te(Y,oe){re=L(function(){Y(i.unstable_now())},oe)}i.unstable_IdlePriority=5,i.unstable_ImmediatePriority=1,i.unstable_LowPriority=4,i.unstable_NormalPriority=3,i.unstable_Profiling=null,i.unstable_UserBlockingPriority=2,i.unstable_cancelCallback=function(Y){Y.callback=null},i.unstable_forceFrameRate=function(Y){0>Y||125<Y?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):K=0<Y?Math.floor(1e3/Y):5},i.unstable_getCurrentPriorityLevel=function(){return v},i.unstable_next=function(Y){switch(v){case 1:case 2:case 3:var oe=3;break;default:oe=v}var de=v;v=oe;try{return Y()}finally{v=de}},i.unstable_requestPaint=function(){M=!0},i.unstable_runWithPriority=function(Y,oe){switch(Y){case 1:case 2:case 3:case 4:case 5:break;default:Y=3}var de=v;v=Y;try{return oe()}finally{v=de}},i.unstable_scheduleCallback=function(Y,oe,de){var Oe=i.unstable_now();switch(typeof de=="object"&&de!==null?(de=de.delay,de=typeof de=="number"&&0<de?Oe+de:Oe):de=Oe,Y){case 1:var le=-1;break;case 2:le=250;break;case 5:le=1073741823;break;case 4:le=1e4;break;default:le=5e3}return le=de+le,Y={id:d++,callback:oe,priorityLevel:Y,startTime:de,expirationTime:le,sortIndex:-1},de>Oe?(Y.sortIndex=de,t(f,Y),r(g)===null&&Y===r(f)&&(S?(z(re),re=-1):S=!0,Te(C,de-Oe))):(Y.sortIndex=le,t(g,Y),w||_||(w=!0,I||(I=!0,Q()))),Y},i.unstable_shouldYield=G,i.unstable_wrapCallback=function(Y){var oe=v;return function(){var de=v;v=oe;try{return Y.apply(this,arguments)}finally{v=de}}}})(kh)),kh}var Hg;function Rw(){return Hg||(Hg=1,Nh.exports=Mw()),Nh.exports}/**
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}/**
11
11
  * @license React
12
12
  * react-dom-client.production.js
13
13
  *
@@ -15,51 +15,51 @@ var X_=Object.defineProperty;var K_=(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 Dw(){if(Gg)return Ga;Gg=1;var i=Rw(),t=J_(),r=ew();function s(e){var n="https://react.dev/errors/"+e;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)n+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+e+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function c(e){var n=e,a=e;if(e.alternate)for(;n.return;)n=n.return;else{e=n;do n=e,(n.flags&4098)!==0&&(a=n.return),e=n.return;while(e)}return n.tag===3?a:null}function m(e){if(e.tag===13){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function p(e){if(e.tag===31){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function g(e){if(c(e)!==e)throw Error(s(188))}function f(e){var n=e.alternate;if(!n){if(n=c(e),n===null)throw Error(s(188));return n!==e?null:e}for(var a=e,o=n;;){var u=a.return;if(u===null)break;var h=u.alternate;if(h===null){if(o=u.return,o!==null){a=o;continue}break}if(u.child===h.child){for(h=u.child;h;){if(h===a)return g(u),e;if(h===o)return g(u),n;h=h.sibling}throw Error(s(188))}if(a.return!==o.return)a=u,o=h;else{for(var x=!1,E=u.child;E;){if(E===a){x=!0,a=u,o=h;break}if(E===o){x=!0,o=u,a=h;break}E=E.sibling}if(!x){for(E=h.child;E;){if(E===a){x=!0,a=h,o=u;break}if(E===o){x=!0,o=h,a=u;break}E=E.sibling}if(!x)throw Error(s(189))}}if(a.alternate!==o)throw Error(s(190))}if(a.tag!==3)throw Error(s(188));return a.stateNode.current===a?e:n}function d(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e;for(e=e.child;e!==null;){if(n=d(e),n!==null)return n;e=e.sibling}return null}var b=Object.assign,v=Symbol.for("react.element"),_=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),M=Symbol.for("react.strict_mode"),L=Symbol.for("react.profiler"),z=Symbol.for("react.consumer"),ie=Symbol.for("react.context"),ae=Symbol.for("react.forward_ref"),C=Symbol.for("react.suspense"),I=Symbol.for("react.suspense_list"),re=Symbol.for("react.memo"),K=Symbol.for("react.lazy"),B=Symbol.for("react.activity"),G=Symbol.for("react.memo_cache_sentinel"),W=Symbol.iterator;function Q(e){return e===null||typeof e!="object"?null:(e=W&&e[W]||e["@@iterator"],typeof e=="function"?e:null)}var he=Symbol.for("react.client.reference");function _e(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===he?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case S:return"Fragment";case L:return"Profiler";case M:return"StrictMode";case C:return"Suspense";case I:return"SuspenseList";case B:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case w:return"Portal";case ie:return e.displayName||"Context";case z:return(e._context.displayName||"Context")+".Consumer";case ae:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case re:return n=e.displayName||null,n!==null?n:_e(e.type)||"Memo";case K:n=e._payload,e=e._init;try{return _e(e(n))}catch{}}return null}var Te=Array.isArray,Y=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,oe=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,de={pending:!1,data:null,method:null,action:null},Oe=[],le=-1;function je(e){return{current:e}}function Se(e){0>le||(e.current=Oe[le],Oe[le]=null,le--)}function Ne(e,n){le++,Oe[le]=e.current,e.current=n}var be=je(null),at=je(null),Ht=je(null),Rt=je(null);function Dt(e,n){switch(Ne(Ht,n),Ne(at,e),Ne(be,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?og(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=og(n),e=lg(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Se(be),Ne(be,e)}function ke(){Se(be),Se(at),Se(Ht)}function qt(e){e.memoizedState!==null&&Ne(Rt,e);var n=be.current,a=lg(n,e.type);n!==a&&(Ne(at,e),Ne(be,a))}function di(e){at.current===e&&(Se(be),Se(at)),Rt.current===e&&(Se(Rt),Pa._currentValue=de)}var Gi,mi;function yn(e){if(Gi===void 0)try{throw Error()}catch(a){var n=a.stack.trim().match(/\n( *(at )?)/);Gi=n&&n[1]||"",mi=-1<a.stack.indexOf(`
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(`
19
19
  at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
20
- `+Gi+e+mi}var Fi=!1;function Ar(e,n){if(!e||Fi)return"";Fi=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var o={DetermineComponentFrameRoot:function(){try{if(n){var ne=function(){throw Error()};if(Object.defineProperty(ne.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ne,[])}catch(X){var F=X}Reflect.construct(e,[],ne)}else{try{ne.call()}catch(X){F=X}e.call(ne.prototype)}}else{try{throw Error()}catch(X){F=X}(ne=e())&&typeof ne.catch=="function"&&ne.catch(function(){})}}catch(X){if(X&&F&&typeof X.stack=="string")return[X.stack,F.stack]}return[null,null]}};o.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var u=Object.getOwnPropertyDescriptor(o.DetermineComponentFrameRoot,"name");u&&u.configurable&&Object.defineProperty(o.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var h=o.DetermineComponentFrameRoot(),x=h[0],E=h[1];if(x&&E){var R=x.split(`
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
23
  `+R[o].replace(" at new "," at ");return e.displayName&&J.includes("<anonymous>")&&(J=J.replace("<anonymous>",e.displayName)),J}while(1<=o&&0<=u);break}}}finally{Fi=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?yn(a):""}function Eo(e,n){switch(e.tag){case 26:case 27:case 5:return yn(e.type);case 16:return yn("Lazy");case 13:return e.child!==n&&n!==null?yn("Suspense Fallback"):yn("Suspense");case 19:return yn("SuspenseList");case 0:case 15:return Ar(e.type,!1);case 11:return Ar(e.type.render,!1);case 1:return Ar(e.type,!0);case 31:return yn("Activity");default:return""}}function Oo(e){try{var n="",a=null;do n+=Eo(e,a),a=e,e=e.return;while(e);return n}catch(o){return`
24
24
  Error generating stack: `+o.message+`
25
- `+o.stack}}var Js=Object.prototype.hasOwnProperty,Qs=i.unstable_scheduleCallback,Wn=i.unstable_cancelCallback,Ao=i.unstable_shouldYield,Vi=i.unstable_requestPaint,nt=i.unstable_now,yu=i.unstable_getCurrentPriorityLevel,jo=i.unstable_ImmediatePriority,To=i.unstable_UserBlockingPriority,Yi=i.unstable_NormalPriority,bu=i.unstable_LowPriority,No=i.unstable_IdlePriority,vu=i.log,ko=i.unstable_setDisableYieldValue,pi=null,ft=null;function Jt(e){if(typeof vu=="function"&&ko(e),ft&&typeof ft.setStrictMode=="function")try{ft.setStrictMode(pi,e)}catch{}}var Bt=Math.clz32?Math.clz32:Xi,Zs=Math.log,Ws=Math.LN2;function Xi(e){return e>>>=0,e===0?32:31-(Zs(e)/Ws|0)|0}var jr=256,er=262144,Tr=4194304;function Mn(e){var n=e&42;if(n!==0)return n;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function gi(e,n,a){var o=e.pendingLanes;if(o===0)return 0;var u=0,h=e.suspendedLanes,x=e.pingedLanes;e=e.warmLanes;var E=o&134217727;return E!==0?(o=E&~h,o!==0?u=Mn(o):(x&=E,x!==0?u=Mn(x):a||(a=E&~e,a!==0&&(u=Mn(a))))):(E=o&~h,E!==0?u=Mn(E):x!==0?u=Mn(x):a||(a=o&~e,a!==0&&(u=Mn(a)))),u===0?0:n!==0&&n!==u&&(n&h)===0&&(h=u&-u,a=n&-n,h>=a||h===32&&(a&4194048)!==0)?n:u}function yi(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)===0}function ea(e,n){switch(e){case 1:case 2:case 4:case 8:case 64:return n+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ki(){var e=Tr;return Tr<<=1,(Tr&62914560)===0&&(Tr=4194304),e}function Nr(e){for(var n=[],a=0;31>a;a++)n.push(e);return n}function Rn(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function kr(e,n,a,o,u,h){var x=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var E=e.entanglements,R=e.expirationTimes,H=e.hiddenUpdates;for(a=x&~a;0<a;){var J=31-Bt(a),ne=1<<J;E[J]=0,R[J]=-1;var F=H[J];if(F!==null)for(H[J]=null,J=0;J<F.length;J++){var X=F[J];X!==null&&(X.lane&=-536870913)}a&=~ne}o!==0&&Cr(e,o,0),h!==0&&u===0&&e.tag!==0&&(e.suspendedLanes|=h&~(x&~n))}function Cr(e,n,a){e.pendingLanes|=n,e.suspendedLanes&=~n;var o=31-Bt(n);e.entangledLanes|=n,e.entanglements[o]=e.entanglements[o]|1073741824|a&261930}function bi(e,n){var a=e.entangledLanes|=n;for(e=e.entanglements;a;){var o=31-Bt(a),u=1<<o;u&n|e[o]&n&&(e[o]|=n),a&=~u}}function Mr(e,n){var a=n&-n;return a=(a&42)!==0?1:tr(a),(a&(e.suspendedLanes|n))!==0?0:a}function tr(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function vi(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function ta(){var e=oe.p;return e!==0?e:(e=window.event,e===void 0?32:Cg(e.type))}function Co(e,n){var a=oe.p;try{return oe.p=e,n()}finally{oe.p=a}}var Hn=Math.random().toString(36).slice(2),Qe="__reactFiber$"+Hn,ot="__reactProps$"+Hn,Qt="__reactContainer$"+Hn,xi="__reactEvents$"+Hn,na="__reactListeners$"+Hn,Mo="__reactHandles$"+Hn,Ro="__reactResources$"+Hn,wt="__reactMarker$"+Hn;function Ji(e){delete e[Qe],delete e[ot],delete e[xi],delete e[na],delete e[Mo]}function O(e){var n=e[Qe];if(n)return n;for(var a=e.parentNode;a;){if(n=a[Qt]||a[Qe]){if(a=n.alternate,n.child!==null||a!==null&&a.child!==null)for(e=pg(e);e!==null;){if(a=e[Qe])return a;e=pg(e)}return n}e=a,a=e.parentNode}return null}function N(e){if(e=e[Qe]||e[Qt]){var n=e.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return e}return null}function T(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e.stateNode;throw Error(s(33))}function k(e){var n=e[Ro];return n||(n=e[Ro]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function D(e){e[wt]=!0}var P=new Set,te={};function se(e,n){V(e,n),V(e+"Capture",n)}function V(e,n){for(te[e]=n,e=0;e<n.length;e++)P.add(n[e])}var ee=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),pe={},Re={};function We(e){return Js.call(Re,e)?!0:Js.call(pe,e)?!1:ee.test(e)?Re[e]=!0:(pe[e]=!0,!1)}function Lt(e,n,a){if(We(n))if(a===null)e.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":e.removeAttribute(n);return;case"boolean":var o=n.toLowerCase().slice(0,5);if(o!=="data-"&&o!=="aria-"){e.removeAttribute(n);return}}e.setAttribute(n,""+a)}}function Dn(e,n,a){if(a===null)e.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttribute(n,""+a)}}function nr(e,n,a,o){if(o===null)e.removeAttribute(a);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttributeNS(n,a,""+o)}}function bn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Wd(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function Iv(e,n,a){var o=Object.getOwnPropertyDescriptor(e.constructor.prototype,n);if(!e.hasOwnProperty(n)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var u=o.get,h=o.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return u.call(this)},set:function(x){a=""+x,h.call(this,x)}}),Object.defineProperty(e,n,{enumerable:o.enumerable}),{getValue:function(){return a},setValue:function(x){a=""+x},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function xu(e){if(!e._valueTracker){var n=Wd(e)?"checked":"value";e._valueTracker=Iv(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 $v=/[\n"\\]/g;function vn(e){return e.replace($v,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function _u(e,n,a,o,u,h,x,E){e.name="",x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"?e.type=x:e.removeAttribute("type"),n!=null?x==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+bn(n)):e.value!==""+bn(n)&&(e.value=""+bn(n)):x!=="submit"&&x!=="reset"||e.removeAttribute("value"),n!=null?wu(e,x,bn(n)):a!=null?wu(e,x,bn(a)):o!=null&&e.removeAttribute("value"),u==null&&h!=null&&(e.defaultChecked=!!h),u!=null&&(e.checked=u&&typeof u!="function"&&typeof u!="symbol"),E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"?e.name=""+bn(E):e.removeAttribute("name")}function tm(e,n,a,o,u,h,x,E){if(h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"&&(e.type=h),n!=null||a!=null){if(!(h!=="submit"&&h!=="reset"||n!=null)){xu(e);return}a=a!=null?""+bn(a):"",n=n!=null?""+bn(n):a,E||n===e.value||(e.value=n),e.defaultValue=n}o=o??u,o=typeof o!="function"&&typeof o!="symbol"&&!!o,e.checked=E?e.checked:!!o,e.defaultChecked=!!o,x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(e.name=x),xu(e)}function wu(e,n,a){n==="number"&&Do(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function Qi(e,n,a,o){if(e=e.options,n){n={};for(var u=0;u<a.length;u++)n["$"+a[u]]=!0;for(a=0;a<e.length;a++)u=n.hasOwnProperty("$"+e[a].value),e[a].selected!==u&&(e[a].selected=u),u&&o&&(e[a].defaultSelected=!0)}else{for(a=""+bn(a),n=null,u=0;u<e.length;u++){if(e[u].value===a){e[u].selected=!0,o&&(e[u].defaultSelected=!0);return}n!==null||e[u].disabled||(n=e[u])}n!==null&&(n.selected=!0)}}function nm(e,n,a){if(n!=null&&(n=""+bn(n),n!==e.value&&(e.value=n),a==null)){e.defaultValue!==n&&(e.defaultValue=n);return}e.defaultValue=a!=null?""+bn(a):""}function rm(e,n,a,o){if(n==null){if(o!=null){if(a!=null)throw Error(s(92));if(Te(o)){if(1<o.length)throw Error(s(93));o=o[0]}a=o}a==null&&(a=""),n=a}a=bn(n),e.defaultValue=a,o=e.textContent,o===a&&o!==""&&o!==null&&(e.value=o),xu(e)}function Zi(e,n){if(n){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=n;return}}e.textContent=n}var Hv=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||Hv.has(n)?n==="float"?e.cssFloat=a:e[n]=(""+a).trim():e[n]=a+"px"}function sm(e,n,a){if(n!=null&&typeof n!="object")throw Error(s(62));if(e=e.style,a!=null){for(var o in a)!a.hasOwnProperty(o)||n!=null&&n.hasOwnProperty(o)||(o.indexOf("--")===0?e.setProperty(o,""):o==="float"?e.cssFloat="":e[o]="");for(var u in n)o=n[u],n.hasOwnProperty(u)&&a[u]!==o&&im(e,u,o)}else for(var h in n)n.hasOwnProperty(h)&&im(e,h,n[h])}function Su(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Gv=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"]]),Fv=/^[\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 Fv.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function rr(){}var Eu=null;function Ou(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Wi=null,es=null;function am(e){var n=N(e);if(n&&(e=n.stateNode)){var a=e[ot]||null;e:switch(e=n.stateNode,n.type){case"input":if(_u(e,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),n=a.name,a.type==="radio"&&n!=null){for(a=e;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+vn(""+n)+'"][type="radio"]'),n=0;n<a.length;n++){var o=a[n];if(o!==e&&o.form===e.form){var u=o[ot]||null;if(!u)throw Error(s(90));_u(o,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name)}}for(n=0;n<a.length;n++)o=a[n],o.form===e.form&&em(o)}break e;case"textarea":nm(e,a.value,a.defaultValue);break e;case"select":n=a.value,n!=null&&Qi(e,!!a.multiple,n,!1)}}}var Au=!1;function om(e,n,a){if(Au)return e(n,a);Au=!0;try{var o=e(n);return o}finally{if(Au=!1,(Wi!==null||es!==null)&&(wl(),Wi&&(n=Wi,e=es,es=Wi=null,am(n),e)))for(n=0;n<e.length;n++)am(e[n])}}function ra(e,n){var a=e.stateNode;if(a===null)return null;var o=a[ot]||null;if(o===null)return null;a=o[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(o=!o.disabled)||(e=e.type,o=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!o;break e;default:e=!1}if(e)return null;if(a&&typeof a!="function")throw Error(s(231,n,typeof a));return a}var ir=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ju=!1;if(ir)try{var ia={};Object.defineProperty(ia,"passive",{get:function(){ju=!0}}),window.addEventListener("test",ia,ia),window.removeEventListener("test",ia,ia)}catch{ju=!1}var Rr=null,Tu=null,Bo=null;function lm(){if(Bo)return Bo;var e,n=Tu,a=n.length,o,u="value"in Rr?Rr.value:Rr.textContent,h=u.length;for(e=0;e<a&&n[e]===u[e];e++);var x=a-e;for(o=1;o<=x&&n[a-o]===u[h-o];o++);return Bo=u.slice(e,1<o?1-o:void 0)}function Lo(e){var n=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&n===13&&(e=13)):e=n,e===10&&(e=13),32<=e||e===13?e:0}function zo(){return!0}function cm(){return!1}function Gt(e){function n(a,o,u,h,x){this._reactName=a,this._targetInst=u,this.type=o,this.nativeEvent=h,this.target=x,this.currentTarget=null;for(var E in e)e.hasOwnProperty(E)&&(a=e[E],this[E]=a?a(h):h[E]);return this.isDefaultPrevented=(h.defaultPrevented!=null?h.defaultPrevented:h.returnValue===!1)?zo:cm,this.isPropagationStopped=cm,this}return b(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=zo)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=zo)},persist:function(){},isPersistent:zo}),n}var _i={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Uo=Gt(_i),sa=b({},_i,{view:0,detail:0}),Vv=Gt(sa),Nu,ku,aa,Po=b({},sa,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Mu,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==aa&&(aa&&e.type==="mousemove"?(Nu=e.screenX-aa.screenX,ku=e.screenY-aa.screenY):ku=Nu=0,aa=e),Nu)},movementY:function(e){return"movementY"in e?e.movementY:ku}}),um=Gt(Po),Yv=b({},Po,{dataTransfer:0}),Xv=Gt(Yv),Kv=b({},sa,{relatedTarget:0}),Cu=Gt(Kv),Jv=b({},_i,{animationName:0,elapsedTime:0,pseudoElement:0}),Qv=Gt(Jv),Zv=b({},_i,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Wv=Gt(Zv),ex=b({},_i,{data:0}),fm=Gt(ex),tx={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},nx={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"},rx={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function ix(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=rx[e])?!!n[e]:!1}function Mu(){return ix}var sx=b({},sa,{key:function(e){if(e.key){var n=tx[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"?nx[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Mu,charCode:function(e){return e.type==="keypress"?Lo(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Lo(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),ax=Gt(sx),ox=b({},Po,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),hm=Gt(ox),lx=b({},sa,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Mu}),cx=Gt(lx),ux=b({},_i,{propertyName:0,elapsedTime:0,pseudoElement:0}),fx=Gt(ux),hx=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}),dx=Gt(hx),mx=b({},_i,{newState:0,oldState:0}),px=Gt(mx),gx=[9,13,27,32],Ru=ir&&"CompositionEvent"in window,oa=null;ir&&"documentMode"in document&&(oa=document.documentMode);var yx=ir&&"TextEvent"in window&&!oa,dm=ir&&(!Ru||oa&&8<oa&&11>=oa),mm=" ",pm=!1;function gm(e,n){switch(e){case"keyup":return gx.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 bx(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 vx(e,n){if(ts)return e==="compositionend"||!Ru&&gm(e,n)?(e=lm(),Bo=Tu=Rr=null,ts=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return dm&&n.locale!=="ko"?null:n.data;default:return null}}var xx={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"?!!xx[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 _x(e){tg(e,0)}function Io(e){var n=T(e);if(em(n))return e}function xm(e,n){if(e==="change")return n}var _m=!1;if(ir){var Du;if(ir){var qu="oninput"in document;if(!qu){var wm=document.createElement("div");wm.setAttribute("oninput","return;"),qu=typeof wm.oninput=="function"}Du=qu}else Du=!1;_m=Du&&(!document.documentMode||9<document.documentMode)}function Sm(){la&&(la.detachEvent("onpropertychange",Em),ca=la=null)}function Em(e){if(e.propertyName==="value"&&Io(ca)){var n=[];vm(n,ca,e,Ou(e)),om(_x,n)}}function wx(e,n,a){e==="focusin"?(Sm(),la=n,ca=a,la.attachEvent("onpropertychange",Em)):e==="focusout"&&Sm()}function Sx(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Io(ca)}function Ex(e,n){if(e==="click")return Io(n)}function Ox(e,n){if(e==="input"||e==="change")return Io(n)}function Ax(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var Zt=typeof Object.is=="function"?Object.is:Ax;function ua(e,n){if(Zt(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;var a=Object.keys(e),o=Object.keys(n);if(a.length!==o.length)return!1;for(o=0;o<a.length;o++){var u=a[o];if(!Js.call(n,u)||!Zt(e[u],n[u]))return!1}return!0}function Om(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Am(e,n){var a=Om(e);e=0;for(var o;a;){if(a.nodeType===3){if(o=e+a.textContent.length,e<=n&&o>=n)return{node:a,offset:n-e};e=o}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Om(a)}}function jm(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?jm(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function Tm(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=Do(e.document);n instanceof e.HTMLIFrameElement;){try{var a=typeof n.contentWindow.location.href=="string"}catch{a=!1}if(a)e=n.contentWindow;else break;n=Do(e.document)}return n}function Bu(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}var jx=ir&&"documentMode"in document&&11>=document.documentMode,ns=null,Lu=null,fa=null,zu=!1;function Nm(e,n,a){var o=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;zu||ns==null||ns!==Do(o)||(o=ns,"selectionStart"in o&&Bu(o)?o={start:o.selectionStart,end:o.selectionEnd}:(o=(o.ownerDocument&&o.ownerDocument.defaultView||window).getSelection(),o={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}),fa&&ua(fa,o)||(fa=o,o=Nl(Lu,"onSelect"),0<o.length&&(n=new Uo("onSelect","select",null,n,a),e.push({event:n,listeners:o}),n.target=ns)))}function wi(e,n){var a={};return a[e.toLowerCase()]=n.toLowerCase(),a["Webkit"+e]="webkit"+n,a["Moz"+e]="moz"+n,a}var rs={animationend:wi("Animation","AnimationEnd"),animationiteration:wi("Animation","AnimationIteration"),animationstart:wi("Animation","AnimationStart"),transitionrun:wi("Transition","TransitionRun"),transitionstart:wi("Transition","TransitionStart"),transitioncancel:wi("Transition","TransitionCancel"),transitionend:wi("Transition","TransitionEnd")},Uu={},km={};ir&&(km=document.createElement("div").style,"AnimationEvent"in window||(delete rs.animationend.animation,delete rs.animationiteration.animation,delete rs.animationstart.animation),"TransitionEvent"in window||delete rs.transitionend.transition);function Si(e){if(Uu[e])return Uu[e];if(!rs[e])return e;var n=rs[e],a;for(a in n)if(n.hasOwnProperty(a)&&a in km)return Uu[e]=n[a];return e}var Cm=Si("animationend"),Mm=Si("animationiteration"),Rm=Si("animationstart"),Tx=Si("transitionrun"),Nx=Si("transitionstart"),kx=Si("transitioncancel"),Dm=Si("transitionend"),qm=new Map,Pu="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Pu.push("scrollEnd");function qn(e,n){qm.set(e,n),se(n,[e])}var $o=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},xn=[],is=0,Iu=0;function Ho(){for(var e=is,n=Iu=is=0;n<e;){var a=xn[n];xn[n++]=null;var o=xn[n];xn[n++]=null;var u=xn[n];xn[n++]=null;var h=xn[n];if(xn[n++]=null,o!==null&&u!==null){var x=o.pending;x===null?u.next=u:(u.next=x.next,x.next=u),o.pending=u}h!==0&&Bm(a,u,h)}}function Go(e,n,a,o){xn[is++]=e,xn[is++]=n,xn[is++]=a,xn[is++]=o,Iu|=o,e.lanes|=o,e=e.alternate,e!==null&&(e.lanes|=o)}function $u(e,n,a,o){return Go(e,n,a,o),Fo(e)}function Ei(e,n){return Go(e,null,null,n),Fo(e)}function Bm(e,n,a){e.lanes|=a;var o=e.alternate;o!==null&&(o.lanes|=a);for(var u=!1,h=e.return;h!==null;)h.childLanes|=a,o=h.alternate,o!==null&&(o.childLanes|=a),h.tag===22&&(e=h.stateNode,e===null||e._visibility&1||(u=!0)),e=h,h=h.return;return e.tag===3?(h=e.stateNode,u&&n!==null&&(u=31-Bt(a),e=h.hiddenUpdates,o=e[u],o===null?e[u]=[n]:o.push(n),n.lane=a|536870912),h):null}function Fo(e){if(50<Ra)throw Ra=0,Zf=null,Error(s(185));for(var n=e.return;n!==null;)e=n,n=e.return;return e.tag===3?e.stateNode:null}var ss={};function Cx(e,n,a,o){this.tag=e,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=o,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Wt(e,n,a,o){return new Cx(e,n,a,o)}function Hu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function sr(e,n){var a=e.alternate;return a===null?(a=Wt(e.tag,n,e.key,e.mode),a.elementType=e.elementType,a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=n,a.type=e.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=e.flags&65011712,a.childLanes=e.childLanes,a.lanes=e.lanes,a.child=e.child,a.memoizedProps=e.memoizedProps,a.memoizedState=e.memoizedState,a.updateQueue=e.updateQueue,n=e.dependencies,a.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a.refCleanup=e.refCleanup,a}function Lm(e,n){e.flags&=65011714;var a=e.alternate;return a===null?(e.childLanes=0,e.lanes=n,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=a.childLanes,e.lanes=a.lanes,e.child=a.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=a.memoizedProps,e.memoizedState=a.memoizedState,e.updateQueue=a.updateQueue,e.type=a.type,n=a.dependencies,e.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),e}function Vo(e,n,a,o,u,h){var x=0;if(o=e,typeof e=="function")Hu(e)&&(x=1);else if(typeof e=="string")x=B_(e,a,be.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case B:return e=Wt(31,a,n,u),e.elementType=B,e.lanes=h,e;case S:return Oi(a.children,u,h,n);case M:x=8,u|=24;break;case L:return e=Wt(12,a,n,u|2),e.elementType=L,e.lanes=h,e;case C:return e=Wt(13,a,n,u),e.elementType=C,e.lanes=h,e;case I:return e=Wt(19,a,n,u),e.elementType=I,e.lanes=h,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case ie:x=10;break e;case z:x=9;break e;case ae:x=11;break e;case re:x=14;break e;case K:x=16,o=null;break e}x=29,a=Error(s(130,e===null?"null":typeof e,"")),o=null}return n=Wt(x,a,n,u),n.elementType=e,n.type=o,n.lanes=h,n}function Oi(e,n,a,o){return e=Wt(7,e,o,n),e.lanes=a,e}function Gu(e,n,a){return e=Wt(6,e,null,n),e.lanes=a,e}function zm(e){var n=Wt(18,null,null,0);return n.stateNode=e,n}function Fu(e,n,a){return n=Wt(4,e.children!==null?e.children:[],e.key,n),n.lanes=a,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}var Um=new WeakMap;function _n(e,n){if(typeof e=="object"&&e!==null){var a=Um.get(e);return a!==void 0?a:(n={value:e,source:n,stack:Oo(n)},Um.set(e,n),n)}return{value:e,source:n,stack:Oo(n)}}var as=[],os=0,Yo=null,ha=0,wn=[],Sn=0,Dr=null,Gn=1,Fn="";function ar(e,n){as[os++]=ha,as[os++]=Yo,Yo=e,ha=n}function Pm(e,n,a){wn[Sn++]=Gn,wn[Sn++]=Fn,wn[Sn++]=Dr,Dr=e;var o=Gn;e=Fn;var u=32-Bt(o)-1;o&=~(1<<u),a+=1;var h=32-Bt(n)+u;if(30<h){var x=u-u%5;h=(o&(1<<x)-1).toString(32),o>>=x,u-=x,Gn=1<<32-Bt(n)+u|a<<u|o,Fn=h+e}else Gn=1<<h|a<<u|o,Fn=e}function Vu(e){e.return!==null&&(ar(e,1),Pm(e,1,0))}function Yu(e){for(;e===Yo;)Yo=as[--os],as[os]=null,ha=as[--os],as[os]=null;for(;e===Dr;)Dr=wn[--Sn],wn[Sn]=null,Fn=wn[--Sn],wn[Sn]=null,Gn=wn[--Sn],wn[Sn]=null}function Im(e,n){wn[Sn++]=Gn,wn[Sn++]=Fn,wn[Sn++]=Dr,Gn=n.id,Fn=n.overflow,Dr=e}var Tt=null,et=null,ze=!1,qr=null,En=!1,Xu=Error(s(519));function Br(e){var n=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw da(_n(n,e)),Xu}function $m(e){var n=e.stateNode,a=e.type,o=e.memoizedProps;switch(n[Qe]=e,n[ot]=o,a){case"dialog":qe("cancel",n),qe("close",n);break;case"iframe":case"object":case"embed":qe("load",n);break;case"video":case"audio":for(a=0;a<qa.length;a++)qe(qa[a],n);break;case"source":qe("error",n);break;case"img":case"image":case"link":qe("error",n),qe("load",n);break;case"details":qe("toggle",n);break;case"input":qe("invalid",n),tm(n,o.value,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name,!0);break;case"select":qe("invalid",n);break;case"textarea":qe("invalid",n),rm(n,o.value,o.defaultValue,o.children)}a=o.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||n.textContent===""+a||o.suppressHydrationWarning===!0||sg(n.textContent,a)?(o.popover!=null&&(qe("beforetoggle",n),qe("toggle",n)),o.onScroll!=null&&qe("scroll",n),o.onScrollEnd!=null&&qe("scrollend",n),o.onClick!=null&&(n.onclick=rr),n=!0):n=!1,n||Br(e,!0)}function Hm(e){for(Tt=e.return;Tt;)switch(Tt.tag){case 5:case 31:case 13:En=!1;return;case 27:case 3:En=!0;return;default:Tt=Tt.return}}function ls(e){if(e!==Tt)return!1;if(!ze)return Hm(e),ze=!0,!1;var n=e.tag,a;if((a=n!==3&&n!==27)&&((a=n===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||dh(e.type,e.memoizedProps)),a=!a),a&&et&&Br(e),Hm(e),n===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(s(317));et=mg(e)}else if(n===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(s(317));et=mg(e)}else n===27?(n=et,Jr(e.type)?(e=bh,bh=null,et=e):et=n):et=Tt?An(e.stateNode.nextSibling):null;return!0}function Ai(){et=Tt=null,ze=!1}function Ku(){var e=qr;return e!==null&&(Xt===null?Xt=e:Xt.push.apply(Xt,e),qr=null),e}function da(e){qr===null?qr=[e]:qr.push(e)}var Ju=je(null),ji=null,or=null;function Lr(e,n,a){Ne(Ju,n._currentValue),n._currentValue=a}function lr(e){e._currentValue=Ju.current,Se(Ju)}function Qu(e,n,a){for(;e!==null;){var o=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,o!==null&&(o.childLanes|=n)):o!==null&&(o.childLanes&n)!==n&&(o.childLanes|=n),e===a)break;e=e.return}}function Zu(e,n,a,o){var u=e.child;for(u!==null&&(u.return=e);u!==null;){var h=u.dependencies;if(h!==null){var x=u.child;h=h.firstContext;e:for(;h!==null;){var E=h;h=u;for(var R=0;R<n.length;R++)if(E.context===n[R]){h.lanes|=a,E=h.alternate,E!==null&&(E.lanes|=a),Qu(h.return,a,e),o||(x=null);break e}h=E.next}}else if(u.tag===18){if(x=u.return,x===null)throw Error(s(341));x.lanes|=a,h=x.alternate,h!==null&&(h.lanes|=a),Qu(x,a,e),x=null}else x=u.child;if(x!==null)x.return=u;else for(x=u;x!==null;){if(x===e){x=null;break}if(u=x.sibling,u!==null){u.return=x.return,x=u;break}x=x.return}u=x}}function cs(e,n,a,o){e=null;for(var u=n,h=!1;u!==null;){if(!h){if((u.flags&524288)!==0)h=!0;else if((u.flags&262144)!==0)break}if(u.tag===10){var x=u.alternate;if(x===null)throw Error(s(387));if(x=x.memoizedProps,x!==null){var E=u.type;Zt(u.pendingProps.value,x.value)||(e!==null?e.push(E):e=[E])}}else if(u===Rt.current){if(x=u.alternate,x===null)throw Error(s(387));x.memoizedState.memoizedState!==u.memoizedState.memoizedState&&(e!==null?e.push(Pa):e=[Pa])}u=u.return}e!==null&&Zu(n,e,a,o),n.flags|=262144}function Xo(e){for(e=e.firstContext;e!==null;){if(!Zt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Ti(e){ji=e,or=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Nt(e){return Gm(ji,e)}function Ko(e,n){return ji===null&&Ti(e),Gm(e,n)}function Gm(e,n){var a=n._currentValue;if(n={context:n,memoizedValue:a,next:null},or===null){if(e===null)throw Error(s(308));or=n,e.dependencies={lanes:0,firstContext:n},e.flags|=524288}else or=or.next=n;return a}var Mx=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()})}},Rx=i.unstable_scheduleCallback,Dx=i.unstable_NormalPriority,yt={$$typeof:ie,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Wu(){return{controller:new Mx,data:new Map,refCount:0}}function ma(e){e.refCount--,e.refCount===0&&Rx(Dx,function(){e.controller.abort()})}var pa=null,ef=0,us=0,fs=null;function qx(e,n){if(pa===null){var a=pa=[];ef=0,us=ih(),fs={status:"pending",value:void 0,then:function(o){a.push(o)}}}return ef++,n.then(Fm,Fm),n}function Fm(){if(--ef===0&&pa!==null){fs!==null&&(fs.status="fulfilled");var e=pa;pa=null,us=0,fs=null;for(var n=0;n<e.length;n++)(0,e[n])()}}function Bx(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"&&qx(e,n),Vm!==null&&Vm(e,n)};var Ni=je(null);function tf(){var e=Ni.current;return e!==null?e:Ze.pooledCache}function Jo(e,n){n===null?Ne(Ni,Ni.current):Ne(Ni,n.pool)}function Ym(){var e=tf();return e===null?null:{parent:yt._currentValue,pool:e}}var hs=Error(s(460)),nf=Error(s(474)),Qo=Error(s(542)),Zo={then:function(){}};function Xm(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Km(e,n,a){switch(a=e[a],a===void 0?e.push(n):a!==n&&(n.then(rr,rr),n=a),n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,Qm(e),e;default:if(typeof n.status=="string")n.then(rr,rr);else{if(e=Ze,e!==null&&100<e.shellSuspendCounter)throw Error(s(482));e=n,e.status="pending",e.then(function(o){if(n.status==="pending"){var u=n;u.status="fulfilled",u.value=o}},function(o){if(n.status==="pending"){var u=n;u.status="rejected",u.reason=o}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,Qm(e),e}throw Ci=n,hs}}function ki(e){try{var n=e._init;return n(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(Ci=a,hs):a}}var Ci=null;function Jm(){if(Ci===null)throw Error(s(459));var e=Ci;return Ci=null,e}function Qm(e){if(e===hs||e===Qo)throw Error(s(483))}var ds=null,ga=0;function Wo(e){var n=ga;return ga+=1,ds===null&&(ds=[]),Km(ds,e,n)}function ya(e,n){n=n.props.ref,e.ref=n!==void 0?n:null}function el(e,n){throw n.$$typeof===v?Error(s(525)):(e=Object.prototype.toString.call(n),Error(s(31,e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e)))}function Zm(e){function n(U,q){if(e){var $=U.deletions;$===null?(U.deletions=[q],U.flags|=16):$.push(q)}}function a(U,q){if(!e)return null;for(;q!==null;)n(U,q),q=q.sibling;return null}function o(U){for(var q=new Map;U!==null;)U.key!==null?q.set(U.key,U):q.set(U.index,U),U=U.sibling;return q}function u(U,q){return U=sr(U,q),U.index=0,U.sibling=null,U}function h(U,q,$){return U.index=$,e?($=U.alternate,$!==null?($=$.index,$<q?(U.flags|=67108866,q):$):(U.flags|=67108866,q)):(U.flags|=1048576,q)}function x(U){return e&&U.alternate===null&&(U.flags|=67108866),U}function E(U,q,$,Z){return q===null||q.tag!==6?(q=Gu($,U.mode,Z),q.return=U,q):(q=u(q,$),q.return=U,q)}function R(U,q,$,Z){var xe=$.type;return xe===S?J(U,q,$.props.children,Z,$.key):q!==null&&(q.elementType===xe||typeof xe=="object"&&xe!==null&&xe.$$typeof===K&&ki(xe)===q.type)?(q=u(q,$.props),ya(q,$),q.return=U,q):(q=Vo($.type,$.key,$.props,null,U.mode,Z),ya(q,$),q.return=U,q)}function H(U,q,$,Z){return q===null||q.tag!==4||q.stateNode.containerInfo!==$.containerInfo||q.stateNode.implementation!==$.implementation?(q=Fu($,U.mode,Z),q.return=U,q):(q=u(q,$.children||[]),q.return=U,q)}function J(U,q,$,Z,xe){return q===null||q.tag!==7?(q=Oi($,U.mode,Z,xe),q.return=U,q):(q=u(q,$),q.return=U,q)}function ne(U,q,$){if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return q=Gu(""+q,U.mode,$),q.return=U,q;if(typeof q=="object"&&q!==null){switch(q.$$typeof){case _:return $=Vo(q.type,q.key,q.props,null,U.mode,$),ya($,q),$.return=U,$;case w:return q=Fu(q,U.mode,$),q.return=U,q;case K:return q=ki(q),ne(U,q,$)}if(Te(q)||Q(q))return q=Oi(q,U.mode,$,null),q.return=U,q;if(typeof q.then=="function")return ne(U,Wo(q),$);if(q.$$typeof===ie)return ne(U,Ko(U,q),$);el(U,q)}return null}function F(U,q,$,Z){var xe=q!==null?q.key:null;if(typeof $=="string"&&$!==""||typeof $=="number"||typeof $=="bigint")return xe!==null?null:E(U,q,""+$,Z);if(typeof $=="object"&&$!==null){switch($.$$typeof){case _:return $.key===xe?R(U,q,$,Z):null;case w:return $.key===xe?H(U,q,$,Z):null;case K:return $=ki($),F(U,q,$,Z)}if(Te($)||Q($))return xe!==null?null:J(U,q,$,Z,null);if(typeof $.then=="function")return F(U,q,Wo($),Z);if($.$$typeof===ie)return F(U,q,Ko(U,$),Z);el(U,$)}return null}function X(U,q,$,Z,xe){if(typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint")return U=U.get($)||null,E(q,U,""+Z,xe);if(typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case _:return U=U.get(Z.key===null?$:Z.key)||null,R(q,U,Z,xe);case w:return U=U.get(Z.key===null?$:Z.key)||null,H(q,U,Z,xe);case K:return Z=ki(Z),X(U,q,$,Z,xe)}if(Te(Z)||Q(Z))return U=U.get($)||null,J(q,U,Z,xe,null);if(typeof Z.then=="function")return X(U,q,$,Wo(Z),xe);if(Z.$$typeof===ie)return X(U,q,$,Ko(q,Z),xe);el(q,Z)}return null}function ge(U,q,$,Z){for(var xe=null,$e=null,ye=q,Me=q=0,Le=null;ye!==null&&Me<$.length;Me++){ye.index>Me?(Le=ye,ye=null):Le=ye.sibling;var He=F(U,ye,$[Me],Z);if(He===null){ye===null&&(ye=Le);break}e&&ye&&He.alternate===null&&n(U,ye),q=h(He,q,Me),$e===null?xe=He:$e.sibling=He,$e=He,ye=Le}if(Me===$.length)return a(U,ye),ze&&ar(U,Me),xe;if(ye===null){for(;Me<$.length;Me++)ye=ne(U,$[Me],Z),ye!==null&&(q=h(ye,q,Me),$e===null?xe=ye:$e.sibling=ye,$e=ye);return ze&&ar(U,Me),xe}for(ye=o(ye);Me<$.length;Me++)Le=X(ye,U,Me,$[Me],Z),Le!==null&&(e&&Le.alternate!==null&&ye.delete(Le.key===null?Me:Le.key),q=h(Le,q,Me),$e===null?xe=Le:$e.sibling=Le,$e=Le);return e&&ye.forEach(function(ti){return n(U,ti)}),ze&&ar(U,Me),xe}function Ee(U,q,$,Z){if($==null)throw Error(s(151));for(var xe=null,$e=null,ye=q,Me=q=0,Le=null,He=$.next();ye!==null&&!He.done;Me++,He=$.next()){ye.index>Me?(Le=ye,ye=null):Le=ye.sibling;var ti=F(U,ye,He.value,Z);if(ti===null){ye===null&&(ye=Le);break}e&&ye&&ti.alternate===null&&n(U,ye),q=h(ti,q,Me),$e===null?xe=ti:$e.sibling=ti,$e=ti,ye=Le}if(He.done)return a(U,ye),ze&&ar(U,Me),xe;if(ye===null){for(;!He.done;Me++,He=$.next())He=ne(U,He.value,Z),He!==null&&(q=h(He,q,Me),$e===null?xe=He:$e.sibling=He,$e=He);return ze&&ar(U,Me),xe}for(ye=o(ye);!He.done;Me++,He=$.next())He=X(ye,U,Me,He.value,Z),He!==null&&(e&&He.alternate!==null&&ye.delete(He.key===null?Me:He.key),q=h(He,q,Me),$e===null?xe=He:$e.sibling=He,$e=He);return e&&ye.forEach(function(Y_){return n(U,Y_)}),ze&&ar(U,Me),xe}function Je(U,q,$,Z){if(typeof $=="object"&&$!==null&&$.type===S&&$.key===null&&($=$.props.children),typeof $=="object"&&$!==null){switch($.$$typeof){case _:e:{for(var xe=$.key;q!==null;){if(q.key===xe){if(xe=$.type,xe===S){if(q.tag===7){a(U,q.sibling),Z=u(q,$.props.children),Z.return=U,U=Z;break e}}else if(q.elementType===xe||typeof xe=="object"&&xe!==null&&xe.$$typeof===K&&ki(xe)===q.type){a(U,q.sibling),Z=u(q,$.props),ya(Z,$),Z.return=U,U=Z;break e}a(U,q);break}else n(U,q);q=q.sibling}$.type===S?(Z=Oi($.props.children,U.mode,Z,$.key),Z.return=U,U=Z):(Z=Vo($.type,$.key,$.props,null,U.mode,Z),ya(Z,$),Z.return=U,U=Z)}return x(U);case w:e:{for(xe=$.key;q!==null;){if(q.key===xe)if(q.tag===4&&q.stateNode.containerInfo===$.containerInfo&&q.stateNode.implementation===$.implementation){a(U,q.sibling),Z=u(q,$.children||[]),Z.return=U,U=Z;break e}else{a(U,q);break}else n(U,q);q=q.sibling}Z=Fu($,U.mode,Z),Z.return=U,U=Z}return x(U);case K:return $=ki($),Je(U,q,$,Z)}if(Te($))return ge(U,q,$,Z);if(Q($)){if(xe=Q($),typeof xe!="function")throw Error(s(150));return $=xe.call($),Ee(U,q,$,Z)}if(typeof $.then=="function")return Je(U,q,Wo($),Z);if($.$$typeof===ie)return Je(U,q,Ko(U,$),Z);el(U,$)}return typeof $=="string"&&$!==""||typeof $=="number"||typeof $=="bigint"?($=""+$,q!==null&&q.tag===6?(a(U,q.sibling),Z=u(q,$),Z.return=U,U=Z):(a(U,q),Z=Gu($,U.mode,Z),Z.return=U,U=Z),x(U)):a(U,q)}return function(U,q,$,Z){try{ga=0;var xe=Je(U,q,$,Z);return ds=null,xe}catch(ye){if(ye===hs||ye===Qo)throw ye;var $e=Wt(29,ye,null,U.mode);return $e.lanes=Z,$e.return=U,$e}finally{}}}var Mi=Zm(!0),Wm=Zm(!1),zr=!1;function rf(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function sf(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ur(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Pr(e,n,a){var o=e.updateQueue;if(o===null)return null;if(o=o.shared,(Ge&2)!==0){var u=o.pending;return u===null?n.next=n:(n.next=u.next,u.next=n),o.pending=n,n=Fo(e),Bm(e,null,a),n}return Go(e,o,n,a),Fo(e)}function ba(e,n,a){if(n=n.updateQueue,n!==null&&(n=n.shared,(a&4194048)!==0)){var o=n.lanes;o&=e.pendingLanes,a|=o,n.lanes=a,bi(e,a)}}function af(e,n){var a=e.updateQueue,o=e.alternate;if(o!==null&&(o=o.updateQueue,a===o)){var u=null,h=null;if(a=a.firstBaseUpdate,a!==null){do{var x={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};h===null?u=h=x:h=h.next=x,a=a.next}while(a!==null);h===null?u=h=n:h=h.next=n}else u=h=n;a={baseState:o.baseState,firstBaseUpdate:u,lastBaseUpdate:h,shared:o.shared,callbacks:o.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=n:e.next=n,a.lastBaseUpdate=n}var of=!1;function va(){if(of){var e=fs;if(e!==null)throw e}}function xa(e,n,a,o){of=!1;var u=e.updateQueue;zr=!1;var h=u.firstBaseUpdate,x=u.lastBaseUpdate,E=u.shared.pending;if(E!==null){u.shared.pending=null;var R=E,H=R.next;R.next=null,x===null?h=H:x.next=H,x=R;var J=e.alternate;J!==null&&(J=J.updateQueue,E=J.lastBaseUpdate,E!==x&&(E===null?J.firstBaseUpdate=H:E.next=H,J.lastBaseUpdate=R))}if(h!==null){var ne=u.baseState;x=0,J=H=R=null,E=h;do{var F=E.lane&-536870913,X=F!==E.lane;if(X?(Be&F)===F:(o&F)===F){F!==0&&F===us&&(of=!0),J!==null&&(J=J.next={lane:0,tag:E.tag,payload:E.payload,callback:null,next:null});e:{var ge=e,Ee=E;F=n;var Je=a;switch(Ee.tag){case 1:if(ge=Ee.payload,typeof ge=="function"){ne=ge.call(Je,ne,F);break e}ne=ge;break e;case 3:ge.flags=ge.flags&-65537|128;case 0:if(ge=Ee.payload,F=typeof ge=="function"?ge.call(Je,ne,F):ge,F==null)break e;ne=b({},ne,F);break e;case 2:zr=!0}}F=E.callback,F!==null&&(e.flags|=64,X&&(e.flags|=8192),X=u.callbacks,X===null?u.callbacks=[F]:X.push(F))}else X={lane:F,tag:E.tag,payload:E.payload,callback:E.callback,next:null},J===null?(H=J=X,R=ne):J=J.next=X,x|=F;if(E=E.next,E===null){if(E=u.shared.pending,E===null)break;X=E,E=X.next,X.next=null,u.lastBaseUpdate=X,u.shared.pending=null}}while(!0);J===null&&(R=ne),u.baseState=R,u.firstBaseUpdate=H,u.lastBaseUpdate=J,h===null&&(u.shared.lanes=0),Fr|=x,e.lanes=x,e.memoizedState=ne}}function e0(e,n){if(typeof e!="function")throw Error(s(191,e));e.call(n)}function t0(e,n){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)e0(a[e],n)}var ms=je(null),tl=je(0);function n0(e,n){e=yr,Ne(tl,e),Ne(ms,n),yr=e|n.baseLanes}function lf(){Ne(tl,yr),Ne(ms,ms.current)}function cf(){yr=tl.current,Se(ms),Se(tl)}var en=je(null),On=null;function Ir(e){var n=e.alternate;Ne(ht,ht.current&1),Ne(en,e),On===null&&(n===null||ms.current!==null||n.memoizedState!==null)&&(On=e)}function uf(e){Ne(ht,ht.current),Ne(en,e),On===null&&(On=e)}function r0(e){e.tag===22?(Ne(ht,ht.current),Ne(en,e),On===null&&(On=e)):$r()}function $r(){Ne(ht,ht.current),Ne(en,en.current)}function tn(e){Se(en),On===e&&(On=null),Se(ht)}var ht=je(0);function nl(e){for(var n=e;n!==null;){if(n.tag===13){var a=n.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||gh(a)||yh(a)))return n}else if(n.tag===19&&(n.memoizedProps.revealOrder==="forwards"||n.memoizedProps.revealOrder==="backwards"||n.memoizedProps.revealOrder==="unstable_legacy-backwards"||n.memoizedProps.revealOrder==="together")){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var cr=0,Ce=null,Xe=null,bt=null,rl=!1,ps=!1,Ri=!1,il=0,_a=0,gs=null,Lx=0;function lt(){throw Error(s(321))}function ff(e,n){if(n===null)return!1;for(var a=0;a<n.length&&a<e.length;a++)if(!Zt(e[a],n[a]))return!1;return!0}function hf(e,n,a,o,u,h){return cr=h,Ce=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,Y.H=e===null||e.memoizedState===null?P0:jf,Ri=!1,h=a(o,u),Ri=!1,ps&&(h=s0(n,a,o,u)),i0(e),h}function i0(e){Y.H=Ea;var n=Xe!==null&&Xe.next!==null;if(cr=0,bt=Xe=Ce=null,rl=!1,_a=0,gs=null,n)throw Error(s(300));e===null||vt||(e=e.dependencies,e!==null&&Xo(e)&&(vt=!0))}function s0(e,n,a,o){Ce=e;var u=0;do{if(ps&&(gs=null),_a=0,ps=!1,25<=u)throw Error(s(301));if(u+=1,bt=Xe=null,e.updateQueue!=null){var h=e.updateQueue;h.lastEffect=null,h.events=null,h.stores=null,h.memoCache!=null&&(h.memoCache.index=0)}Y.H=I0,h=n(a,o)}while(ps);return h}function zx(){var e=Y.H,n=e.useState()[0];return n=typeof n.then=="function"?wa(n):n,e=e.useState()[0],(Xe!==null?Xe.memoizedState:null)!==e&&(Ce.flags|=1024),n}function df(){var e=il!==0;return il=0,e}function mf(e,n,a){n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~a}function pf(e){if(rl){for(e=e.memoizedState;e!==null;){var n=e.queue;n!==null&&(n.pending=null),e=e.next}rl=!1}cr=0,bt=Xe=Ce=null,ps=!1,_a=il=0,gs=null}function zt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return bt===null?Ce.memoizedState=bt=e:bt=bt.next=e,bt}function dt(){if(Xe===null){var e=Ce.alternate;e=e!==null?e.memoizedState:null}else e=Xe.next;var n=bt===null?Ce.memoizedState:bt.next;if(n!==null)bt=n,Xe=e;else{if(e===null)throw Ce.alternate===null?Error(s(467)):Error(s(310));Xe=e,e={memoizedState:Xe.memoizedState,baseState:Xe.baseState,baseQueue:Xe.baseQueue,queue:Xe.queue,next:null},bt===null?Ce.memoizedState=bt=e:bt=bt.next=e}return bt}function sl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function wa(e){var n=_a;return _a+=1,gs===null&&(gs=[]),e=Km(gs,e,n),n=Ce,(bt===null?n.memoizedState:bt.next)===null&&(n=n.alternate,Y.H=n===null||n.memoizedState===null?P0:jf),e}function al(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return wa(e);if(e.$$typeof===ie)return Nt(e)}throw Error(s(438,String(e)))}function gf(e){var n=null,a=Ce.updateQueue;if(a!==null&&(n=a.memoCache),n==null){var o=Ce.alternate;o!==null&&(o=o.updateQueue,o!==null&&(o=o.memoCache,o!=null&&(n={data:o.data.map(function(u){return u.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),a===null&&(a=sl(),Ce.updateQueue=a),a.memoCache=n,a=n.data[n.index],a===void 0)for(a=n.data[n.index]=Array(e),o=0;o<e;o++)a[o]=G;return n.index++,a}function ur(e,n){return typeof n=="function"?n(e):n}function ol(e){var n=dt();return yf(n,Xe,e)}function yf(e,n,a){var o=e.queue;if(o===null)throw Error(s(311));o.lastRenderedReducer=a;var u=e.baseQueue,h=o.pending;if(h!==null){if(u!==null){var x=u.next;u.next=h.next,h.next=x}n.baseQueue=u=h,o.pending=null}if(h=e.baseState,u===null)e.memoizedState=h;else{n=u.next;var E=x=null,R=null,H=n,J=!1;do{var ne=H.lane&-536870913;if(ne!==H.lane?(Be&ne)===ne:(cr&ne)===ne){var F=H.revertLane;if(F===0)R!==null&&(R=R.next={lane:0,revertLane:0,gesture:null,action:H.action,hasEagerState:H.hasEagerState,eagerState:H.eagerState,next:null}),ne===us&&(J=!0);else if((cr&F)===F){H=H.next,F===us&&(J=!0);continue}else ne={lane:0,revertLane:H.revertLane,gesture:null,action:H.action,hasEagerState:H.hasEagerState,eagerState:H.eagerState,next:null},R===null?(E=R=ne,x=h):R=R.next=ne,Ce.lanes|=F,Fr|=F;ne=H.action,Ri&&a(h,ne),h=H.hasEagerState?H.eagerState:a(h,ne)}else F={lane:ne,revertLane:H.revertLane,gesture:H.gesture,action:H.action,hasEagerState:H.hasEagerState,eagerState:H.eagerState,next:null},R===null?(E=R=F,x=h):R=R.next=F,Ce.lanes|=ne,Fr|=ne;H=H.next}while(H!==null&&H!==n);if(R===null?x=h:R.next=E,!Zt(h,e.memoizedState)&&(vt=!0,J&&(a=fs,a!==null)))throw a;e.memoizedState=h,e.baseState=x,e.baseQueue=R,o.lastRenderedState=h}return u===null&&(o.lanes=0),[e.memoizedState,o.dispatch]}function bf(e){var n=dt(),a=n.queue;if(a===null)throw Error(s(311));a.lastRenderedReducer=e;var o=a.dispatch,u=a.pending,h=n.memoizedState;if(u!==null){a.pending=null;var x=u=u.next;do h=e(h,x.action),x=x.next;while(x!==u);Zt(h,n.memoizedState)||(vt=!0),n.memoizedState=h,n.baseQueue===null&&(n.baseState=h),a.lastRenderedState=h}return[h,o]}function a0(e,n,a){var o=Ce,u=dt(),h=ze;if(h){if(a===void 0)throw Error(s(407));a=a()}else a=n();var x=!Zt((Xe||u).memoizedState,a);if(x&&(u.memoizedState=a,vt=!0),u=u.queue,_f(c0.bind(null,o,u,e),[e]),u.getSnapshot!==n||x||bt!==null&&bt.memoizedState.tag&1){if(o.flags|=2048,ys(9,{destroy:void 0},l0.bind(null,o,u,a,n),null),Ze===null)throw Error(s(349));h||(cr&127)!==0||o0(o,n,a)}return a}function o0(e,n,a){e.flags|=16384,e={getSnapshot:n,value:a},n=Ce.updateQueue,n===null?(n=sl(),Ce.updateQueue=n,n.stores=[e]):(a=n.stores,a===null?n.stores=[e]:a.push(e))}function l0(e,n,a,o){n.value=a,n.getSnapshot=o,u0(n)&&f0(e)}function c0(e,n,a){return a(function(){u0(n)&&f0(e)})}function u0(e){var n=e.getSnapshot;e=e.value;try{var a=n();return!Zt(e,a)}catch{return!0}}function f0(e){var n=Ei(e,2);n!==null&&Kt(n,e,2)}function vf(e){var n=zt();if(typeof e=="function"){var a=e;if(e=a(),Ri){Jt(!0);try{a()}finally{Jt(!1)}}}return n.memoizedState=n.baseState=e,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ur,lastRenderedState:e},n}function h0(e,n,a,o){return e.baseState=a,yf(e,Xe,typeof o=="function"?o:ur)}function Ux(e,n,a,o,u){if(ul(e))throw Error(s(485));if(e=n.action,e!==null){var h={payload:u,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(x){h.listeners.push(x)}};Y.T!==null?a(!0):h.isTransition=!1,o(h),a=n.pending,a===null?(h.next=n.pending=h,d0(n,h)):(h.next=a.next,n.pending=a.next=h)}}function d0(e,n){var a=n.action,o=n.payload,u=e.state;if(n.isTransition){var h=Y.T,x={};Y.T=x;try{var E=a(u,o),R=Y.S;R!==null&&R(x,E),m0(e,n,E)}catch(H){xf(e,n,H)}finally{h!==null&&x.types!==null&&(h.types=x.types),Y.T=h}}else try{h=a(u,o),m0(e,n,h)}catch(H){xf(e,n,H)}}function m0(e,n,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(o){p0(e,n,o)},function(o){return xf(e,n,o)}):p0(e,n,a)}function p0(e,n,a){n.status="fulfilled",n.value=a,g0(n),e.state=a,n=e.pending,n!==null&&(a=n.next,a===n?e.pending=null:(a=a.next,n.next=a,d0(e,a)))}function xf(e,n,a){var o=e.pending;if(e.pending=null,o!==null){o=o.next;do n.status="rejected",n.reason=a,g0(n),n=n.next;while(n!==o)}e.action=null}function g0(e){e=e.listeners;for(var n=0;n<e.length;n++)(0,e[n])()}function y0(e,n){return n}function b0(e,n){if(ze){var a=Ze.formState;if(a!==null){e:{var o=Ce;if(ze){if(et){t:{for(var u=et,h=En;u.nodeType!==8;){if(!h){u=null;break t}if(u=An(u.nextSibling),u===null){u=null;break t}}h=u.data,u=h==="F!"||h==="F"?u:null}if(u){et=An(u.nextSibling),o=u.data==="F!";break e}}Br(o)}o=!1}o&&(n=a[0])}}return a=zt(),a.memoizedState=a.baseState=n,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:y0,lastRenderedState:n},a.queue=o,a=L0.bind(null,Ce,o),o.dispatch=a,o=vf(!1),h=Af.bind(null,Ce,!1,o.queue),o=zt(),u={state:n,dispatch:null,action:e,pending:null},o.queue=u,a=Ux.bind(null,Ce,u,h,a),u.dispatch=a,o.memoizedState=e,[n,a,!1]}function v0(e){var n=dt();return x0(n,Xe,e)}function x0(e,n,a){if(n=yf(e,n,y0)[0],e=ol(ur)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var o=wa(n)}catch(x){throw x===hs?Qo:x}else o=n;n=dt();var u=n.queue,h=u.dispatch;return a!==n.memoizedState&&(Ce.flags|=2048,ys(9,{destroy:void 0},Px.bind(null,u,a),null)),[o,h,e]}function Px(e,n){e.action=n}function _0(e){var n=dt(),a=Xe;if(a!==null)return x0(n,a,e);dt(),n=n.memoizedState,a=dt();var o=a.queue.dispatch;return a.memoizedState=e,[n,o,!1]}function ys(e,n,a,o){return e={tag:e,create:a,deps:o,inst:n,next:null},n=Ce.updateQueue,n===null&&(n=sl(),Ce.updateQueue=n),a=n.lastEffect,a===null?n.lastEffect=e.next=e:(o=a.next,a.next=e,e.next=o,n.lastEffect=e),e}function w0(){return dt().memoizedState}function ll(e,n,a,o){var u=zt();Ce.flags|=e,u.memoizedState=ys(1|n,{destroy:void 0},a,o===void 0?null:o)}function cl(e,n,a,o){var u=dt();o=o===void 0?null:o;var h=u.memoizedState.inst;Xe!==null&&o!==null&&ff(o,Xe.memoizedState.deps)?u.memoizedState=ys(n,h,a,o):(Ce.flags|=e,u.memoizedState=ys(1|n,h,a,o))}function S0(e,n){ll(8390656,8,e,n)}function _f(e,n){cl(2048,8,e,n)}function Ix(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 Ix({ref:n,nextImpl:e}),function(){if((Ge&2)!==0)throw Error(s(440));return n.impl.apply(void 0,arguments)}}function O0(e,n){return cl(4,2,e,n)}function A0(e,n){return cl(4,4,e,n)}function j0(e,n){if(typeof n=="function"){e=e();var a=n(e);return function(){typeof a=="function"?a():n(null)}}if(n!=null)return e=e(),n.current=e,function(){n.current=null}}function T0(e,n,a){a=a!=null?a.concat([e]):null,cl(4,4,j0.bind(null,n,e),a)}function wf(){}function N0(e,n){var a=dt();n=n===void 0?null:n;var o=a.memoizedState;return n!==null&&ff(n,o[1])?o[0]:(a.memoizedState=[e,n],e)}function k0(e,n){var a=dt();n=n===void 0?null:n;var o=a.memoizedState;if(n!==null&&ff(n,o[1]))return o[0];if(o=e(),Ri){Jt(!0);try{e()}finally{Jt(!1)}}return a.memoizedState=[o,n],o}function Sf(e,n,a){return a===void 0||(cr&1073741824)!==0&&(Be&261930)===0?e.memoizedState=n:(e.memoizedState=a,e=Cp(),Ce.lanes|=e,Fr|=e,a)}function C0(e,n,a,o){return Zt(a,n)?a:ms.current!==null?(e=Sf(e,a,o),Zt(e,n)||(vt=!0),e):(cr&42)===0||(cr&1073741824)!==0&&(Be&261930)===0?(vt=!0,e.memoizedState=a):(e=Cp(),Ce.lanes|=e,Fr|=e,n)}function M0(e,n,a,o,u){var h=oe.p;oe.p=h!==0&&8>h?h:8;var x=Y.T,E={};Y.T=E,Af(e,!1,n,a);try{var R=u(),H=Y.S;if(H!==null&&H(E,R),R!==null&&typeof R=="object"&&typeof R.then=="function"){var J=Bx(R,o);Sa(e,n,J,sn(e))}else Sa(e,n,o,sn(e))}catch(ne){Sa(e,n,{then:function(){},status:"rejected",reason:ne},sn())}finally{oe.p=h,x!==null&&E.types!==null&&(x.types=E.types),Y.T=x}}function $x(){}function Ef(e,n,a,o){if(e.tag!==5)throw Error(s(476));var u=R0(e).queue;M0(e,u,n,de,a===null?$x:function(){return D0(e),a(o)})}function R0(e){var n=e.memoizedState;if(n!==null)return n;n={memoizedState:de,baseState:de,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ur,lastRenderedState:de},next:null};var a={};return n.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ur,lastRenderedState:a},next:null},e.memoizedState=n,e=e.alternate,e!==null&&(e.memoizedState=n),n}function D0(e){var n=R0(e);n.next===null&&(n=e.alternate.memoizedState),Sa(e,n.next.queue,{},sn())}function Of(){return Nt(Pa)}function q0(){return dt().memoizedState}function B0(){return dt().memoizedState}function Hx(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var a=sn();e=Ur(a);var o=Pr(n,e,a);o!==null&&(Kt(o,n,a),ba(o,n,a)),n={cache:Wu()},e.payload=n;return}n=n.return}}function Gx(e,n,a){var o=sn();a={lane:o,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},ul(e)?z0(n,a):(a=$u(e,n,a,o),a!==null&&(Kt(a,e,o),U0(a,n,o)))}function L0(e,n,a){var o=sn();Sa(e,n,a,o)}function Sa(e,n,a,o){var u={lane:o,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(ul(e))z0(n,u);else{var h=e.alternate;if(e.lanes===0&&(h===null||h.lanes===0)&&(h=n.lastRenderedReducer,h!==null))try{var x=n.lastRenderedState,E=h(x,a);if(u.hasEagerState=!0,u.eagerState=E,Zt(E,x))return Go(e,n,u,0),Ze===null&&Ho(),!1}catch{}finally{}if(a=$u(e,n,u,o),a!==null)return Kt(a,e,o),U0(a,n,o),!0}return!1}function Af(e,n,a,o){if(o={lane:2,revertLane:ih(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},ul(e)){if(n)throw Error(s(479))}else n=$u(e,a,o,2),n!==null&&Kt(n,e,2)}function ul(e){var n=e.alternate;return e===Ce||n!==null&&n===Ce}function z0(e,n){ps=rl=!0;var a=e.pending;a===null?n.next=n:(n.next=a.next,a.next=n),e.pending=n}function U0(e,n,a){if((a&4194048)!==0){var o=n.lanes;o&=e.pendingLanes,a|=o,n.lanes=a,bi(e,a)}}var Ea={readContext:Nt,use:al,useCallback:lt,useContext:lt,useEffect:lt,useImperativeHandle:lt,useLayoutEffect:lt,useInsertionEffect:lt,useMemo:lt,useReducer:lt,useRef:lt,useState:lt,useDebugValue:lt,useDeferredValue:lt,useTransition:lt,useSyncExternalStore:lt,useId:lt,useHostTransitionStatus:lt,useFormState:lt,useActionState:lt,useOptimistic:lt,useMemoCache:lt,useCacheRefresh:lt};Ea.useEffectEvent=lt;var P0={readContext:Nt,use:al,useCallback:function(e,n){return zt().memoizedState=[e,n===void 0?null:n],e},useContext:Nt,useEffect:S0,useImperativeHandle:function(e,n,a){a=a!=null?a.concat([e]):null,ll(4194308,4,j0.bind(null,n,e),a)},useLayoutEffect:function(e,n){return ll(4194308,4,e,n)},useInsertionEffect:function(e,n){ll(4,2,e,n)},useMemo:function(e,n){var a=zt();n=n===void 0?null:n;var o=e();if(Ri){Jt(!0);try{e()}finally{Jt(!1)}}return a.memoizedState=[o,n],o},useReducer:function(e,n,a){var o=zt();if(a!==void 0){var u=a(n);if(Ri){Jt(!0);try{a(n)}finally{Jt(!1)}}}else u=n;return o.memoizedState=o.baseState=u,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:u},o.queue=e,e=e.dispatch=Gx.bind(null,Ce,e),[o.memoizedState,e]},useRef:function(e){var n=zt();return e={current:e},n.memoizedState=e},useState:function(e){e=vf(e);var n=e.queue,a=L0.bind(null,Ce,n);return n.dispatch=a,[e.memoizedState,a]},useDebugValue:wf,useDeferredValue:function(e,n){var a=zt();return Sf(a,e,n)},useTransition:function(){var e=vf(!1);return e=M0.bind(null,Ce,e.queue,!0,!1),zt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,a){var o=Ce,u=zt();if(ze){if(a===void 0)throw Error(s(407));a=a()}else{if(a=n(),Ze===null)throw Error(s(349));(Be&127)!==0||o0(o,n,a)}u.memoizedState=a;var h={value:a,getSnapshot:n};return u.queue=h,S0(c0.bind(null,o,h,e),[e]),o.flags|=2048,ys(9,{destroy:void 0},l0.bind(null,o,h,a,n),null),a},useId:function(){var e=zt(),n=Ze.identifierPrefix;if(ze){var a=Fn,o=Gn;a=(o&~(1<<32-Bt(o)-1)).toString(32)+a,n="_"+n+"R_"+a,a=il++,0<a&&(n+="H"+a.toString(32)),n+="_"}else a=Lx++,n="_"+n+"r_"+a.toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:Of,useFormState:b0,useActionState:b0,useOptimistic:function(e){var n=zt();n.memoizedState=n.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=a,n=Af.bind(null,Ce,!0,a),a.dispatch=n,[e,n]},useMemoCache:gf,useCacheRefresh:function(){return zt().memoizedState=Hx.bind(null,Ce)},useEffectEvent:function(e){var n=zt(),a={impl:e};return n.memoizedState=a,function(){if((Ge&2)!==0)throw Error(s(440));return a.impl.apply(void 0,arguments)}}},jf={readContext:Nt,use:al,useCallback:N0,useContext:Nt,useEffect:_f,useImperativeHandle:T0,useInsertionEffect:O0,useLayoutEffect:A0,useMemo:k0,useReducer:ol,useRef:w0,useState:function(){return ol(ur)},useDebugValue:wf,useDeferredValue:function(e,n){var a=dt();return C0(a,Xe.memoizedState,e,n)},useTransition:function(){var e=ol(ur)[0],n=dt().memoizedState;return[typeof e=="boolean"?e:wa(e),n]},useSyncExternalStore:a0,useId:q0,useHostTransitionStatus:Of,useFormState:v0,useActionState:v0,useOptimistic:function(e,n){var a=dt();return h0(a,Xe,e,n)},useMemoCache:gf,useCacheRefresh:B0};jf.useEffectEvent=E0;var I0={readContext:Nt,use:al,useCallback:N0,useContext:Nt,useEffect:_f,useImperativeHandle:T0,useInsertionEffect:O0,useLayoutEffect:A0,useMemo:k0,useReducer:bf,useRef:w0,useState:function(){return bf(ur)},useDebugValue:wf,useDeferredValue:function(e,n){var a=dt();return Xe===null?Sf(a,e,n):C0(a,Xe.memoizedState,e,n)},useTransition:function(){var e=bf(ur)[0],n=dt().memoizedState;return[typeof e=="boolean"?e:wa(e),n]},useSyncExternalStore:a0,useId:q0,useHostTransitionStatus:Of,useFormState:_0,useActionState:_0,useOptimistic:function(e,n){var a=dt();return Xe!==null?h0(a,Xe,e,n):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:gf,useCacheRefresh:B0};I0.useEffectEvent=E0;function Tf(e,n,a,o){n=e.memoizedState,a=a(o,n),a=a==null?n:b({},n,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var Nf={enqueueSetState:function(e,n,a){e=e._reactInternals;var o=sn(),u=Ur(o);u.payload=n,a!=null&&(u.callback=a),n=Pr(e,u,o),n!==null&&(Kt(n,e,o),ba(n,e,o))},enqueueReplaceState:function(e,n,a){e=e._reactInternals;var o=sn(),u=Ur(o);u.tag=1,u.payload=n,a!=null&&(u.callback=a),n=Pr(e,u,o),n!==null&&(Kt(n,e,o),ba(n,e,o))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var a=sn(),o=Ur(a);o.tag=2,n!=null&&(o.callback=n),n=Pr(e,o,a),n!==null&&(Kt(n,e,a),ba(n,e,a))}};function $0(e,n,a,o,u,h,x){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(o,h,x):n.prototype&&n.prototype.isPureReactComponent?!ua(a,o)||!ua(u,h):!0}function H0(e,n,a,o){e=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(a,o),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(a,o),n.state!==e&&Nf.enqueueReplaceState(n,n.state,null)}function Di(e,n){var a=n;if("ref"in n){a={};for(var o in n)o!=="ref"&&(a[o]=n[o])}if(e=e.defaultProps){a===n&&(a=b({},a));for(var u in e)a[u]===void 0&&(a[u]=e[u])}return a}function G0(e){$o(e)}function F0(e){console.error(e)}function V0(e){$o(e)}function fl(e,n){try{var a=e.onUncaughtError;a(n.value,{componentStack:n.stack})}catch(o){setTimeout(function(){throw o})}}function Y0(e,n,a){try{var o=e.onCaughtError;o(a.value,{componentStack:a.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(u){setTimeout(function(){throw u})}}function kf(e,n,a){return a=Ur(a),a.tag=3,a.payload={element:null},a.callback=function(){fl(e,n)},a}function X0(e){return e=Ur(e),e.tag=3,e}function K0(e,n,a,o){var u=a.type.getDerivedStateFromError;if(typeof u=="function"){var h=o.value;e.payload=function(){return u(h)},e.callback=function(){Y0(n,a,o)}}var x=a.stateNode;x!==null&&typeof x.componentDidCatch=="function"&&(e.callback=function(){Y0(n,a,o),typeof u!="function"&&(Vr===null?Vr=new Set([this]):Vr.add(this));var E=o.stack;this.componentDidCatch(o.value,{componentStack:E!==null?E:""})})}function Fx(e,n,a,o,u){if(a.flags|=32768,o!==null&&typeof o=="object"&&typeof o.then=="function"){if(n=a.alternate,n!==null&&cs(n,a,u,!0),a=en.current,a!==null){switch(a.tag){case 31:case 13:return On===null?Sl():a.alternate===null&&ct===0&&(ct=3),a.flags&=-257,a.flags|=65536,a.lanes=u,o===Zo?a.flags|=16384:(n=a.updateQueue,n===null?a.updateQueue=new Set([o]):n.add(o),th(e,o,u)),!1;case 22:return a.flags|=65536,o===Zo?a.flags|=16384:(n=a.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([o])},a.updateQueue=n):(a=n.retryQueue,a===null?n.retryQueue=new Set([o]):a.add(o)),th(e,o,u)),!1}throw Error(s(435,a.tag))}return th(e,o,u),Sl(),!1}if(ze)return n=en.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=u,o!==Xu&&(e=Error(s(422),{cause:o}),da(_n(e,a)))):(o!==Xu&&(n=Error(s(423),{cause:o}),da(_n(n,a))),e=e.current.alternate,e.flags|=65536,u&=-u,e.lanes|=u,o=_n(o,a),u=kf(e.stateNode,o,u),af(e,u),ct!==4&&(ct=2)),!1;var h=Error(s(520),{cause:o});if(h=_n(h,a),Ma===null?Ma=[h]:Ma.push(h),ct!==4&&(ct=2),n===null)return!0;o=_n(o,a),a=n;do{switch(a.tag){case 3:return a.flags|=65536,e=u&-u,a.lanes|=e,e=kf(a.stateNode,o,e),af(a,e),!1;case 1:if(n=a.type,h=a.stateNode,(a.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||h!==null&&typeof h.componentDidCatch=="function"&&(Vr===null||!Vr.has(h))))return a.flags|=65536,u&=-u,a.lanes|=u,u=X0(u),K0(u,e,a,o),af(a,u),!1}a=a.return}while(a!==null);return!1}var Cf=Error(s(461)),vt=!1;function kt(e,n,a,o){n.child=e===null?Wm(n,null,a,o):Mi(n,e.child,a,o)}function J0(e,n,a,o,u){a=a.render;var h=n.ref;if("ref"in o){var x={};for(var E in o)E!=="ref"&&(x[E]=o[E])}else x=o;return Ti(n),o=hf(e,n,a,x,h,u),E=df(),e!==null&&!vt?(mf(e,n,u),fr(e,n,u)):(ze&&E&&Vu(n),n.flags|=1,kt(e,n,o,u),n.child)}function Q0(e,n,a,o,u){if(e===null){var h=a.type;return typeof h=="function"&&!Hu(h)&&h.defaultProps===void 0&&a.compare===null?(n.tag=15,n.type=h,Z0(e,n,h,o,u)):(e=Vo(a.type,null,o,n,n.mode,u),e.ref=n.ref,e.return=n,n.child=e)}if(h=e.child,!Uf(e,u)){var x=h.memoizedProps;if(a=a.compare,a=a!==null?a:ua,a(x,o)&&e.ref===n.ref)return fr(e,n,u)}return n.flags|=1,e=sr(h,o),e.ref=n.ref,e.return=n,n.child=e}function Z0(e,n,a,o,u){if(e!==null){var h=e.memoizedProps;if(ua(h,o)&&e.ref===n.ref)if(vt=!1,n.pendingProps=o=h,Uf(e,u))(e.flags&131072)!==0&&(vt=!0);else return n.lanes=e.lanes,fr(e,n,u)}return Mf(e,n,a,o,u)}function W0(e,n,a,o){var u=o.children,h=e!==null?e.memoizedState:null;if(e===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),o.mode==="hidden"){if((n.flags&128)!==0){if(h=h!==null?h.baseLanes|a:a,e!==null){for(o=n.child=e.child,u=0;o!==null;)u=u|o.lanes|o.childLanes,o=o.sibling;o=u&~h}else o=0,n.child=null;return ep(e,n,h,a,o)}if((a&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},e!==null&&Jo(n,h!==null?h.cachePool:null),h!==null?n0(n,h):lf(),r0(n);else return o=n.lanes=536870912,ep(e,n,h!==null?h.baseLanes|a:a,a,o)}else h!==null?(Jo(n,h.cachePool),n0(n,h),$r(),n.memoizedState=null):(e!==null&&Jo(n,null),lf(),$r());return kt(e,n,u,a),n.child}function Oa(e,n){return e!==null&&e.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function ep(e,n,a,o,u){var h=tf();return h=h===null?null:{parent:yt._currentValue,pool:h},n.memoizedState={baseLanes:a,cachePool:h},e!==null&&Jo(n,null),lf(),r0(n),e!==null&&cs(e,n,o,!0),n.childLanes=u,null}function hl(e,n){return n=ml({mode:n.mode,children:n.children},e.mode),n.ref=e.ref,e.child=n,n.return=e,n}function tp(e,n,a){return Mi(n,e.child,null,a),e=hl(n,n.pendingProps),e.flags|=2,tn(n),n.memoizedState=null,e}function Vx(e,n,a){var o=n.pendingProps,u=(n.flags&128)!==0;if(n.flags&=-129,e===null){if(ze){if(o.mode==="hidden")return e=hl(n,o),n.lanes=536870912,Oa(null,e);if(uf(n),(e=et)?(e=dg(e,En),e=e!==null&&e.data==="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:Dr!==null?{id:Gn,overflow:Fn}:null,retryLane:536870912,hydrationErrors:null},a=zm(e),a.return=n,n.child=a,Tt=n,et=null)):e=null,e===null)throw Br(n);return n.lanes=536870912,null}return hl(n,o)}var h=e.memoizedState;if(h!==null){var x=h.dehydrated;if(uf(n),u)if(n.flags&256)n.flags&=-257,n=tp(e,n,a);else if(n.memoizedState!==null)n.child=e.child,n.flags|=128,n=null;else throw Error(s(558));else if(vt||cs(e,n,a,!1),u=(a&e.childLanes)!==0,vt||u){if(o=Ze,o!==null&&(x=Mr(o,a),x!==0&&x!==h.retryLane))throw h.retryLane=x,Ei(e,x),Kt(o,e,x),Cf;Sl(),n=tp(e,n,a)}else e=h.treeContext,et=An(x.nextSibling),Tt=n,ze=!0,qr=null,En=!1,e!==null&&Im(n,e),n=hl(n,o),n.flags|=4096;return n}return e=sr(e.child,{mode:o.mode,children:o.children}),e.ref=n.ref,n.child=e,e.return=n,e}function dl(e,n){var a=n.ref;if(a===null)e!==null&&e.ref!==null&&(n.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(s(284));(e===null||e.ref!==a)&&(n.flags|=4194816)}}function Mf(e,n,a,o,u){return Ti(n),a=hf(e,n,a,o,void 0,u),o=df(),e!==null&&!vt?(mf(e,n,u),fr(e,n,u)):(ze&&o&&Vu(n),n.flags|=1,kt(e,n,a,u),n.child)}function np(e,n,a,o,u,h){return Ti(n),n.updateQueue=null,a=s0(n,o,a,u),i0(e),o=df(),e!==null&&!vt?(mf(e,n,h),fr(e,n,h)):(ze&&o&&Vu(n),n.flags|=1,kt(e,n,a,h),n.child)}function rp(e,n,a,o,u){if(Ti(n),n.stateNode===null){var h=ss,x=a.contextType;typeof x=="object"&&x!==null&&(h=Nt(x)),h=new a(o,h),n.memoizedState=h.state!==null&&h.state!==void 0?h.state:null,h.updater=Nf,n.stateNode=h,h._reactInternals=n,h=n.stateNode,h.props=o,h.state=n.memoizedState,h.refs={},rf(n),x=a.contextType,h.context=typeof x=="object"&&x!==null?Nt(x):ss,h.state=n.memoizedState,x=a.getDerivedStateFromProps,typeof x=="function"&&(Tf(n,a,x,o),h.state=n.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof h.getSnapshotBeforeUpdate=="function"||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(x=h.state,typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount(),x!==h.state&&Nf.enqueueReplaceState(h,h.state,null),xa(n,o,h,u),va(),h.state=n.memoizedState),typeof h.componentDidMount=="function"&&(n.flags|=4194308),o=!0}else if(e===null){h=n.stateNode;var E=n.memoizedProps,R=Di(a,E);h.props=R;var H=h.context,J=a.contextType;x=ss,typeof J=="object"&&J!==null&&(x=Nt(J));var ne=a.getDerivedStateFromProps;J=typeof ne=="function"||typeof h.getSnapshotBeforeUpdate=="function",E=n.pendingProps!==E,J||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(E||H!==x)&&H0(n,h,o,x),zr=!1;var F=n.memoizedState;h.state=F,xa(n,o,h,u),va(),H=n.memoizedState,E||F!==H||zr?(typeof ne=="function"&&(Tf(n,a,ne,o),H=n.memoizedState),(R=zr||$0(n,a,R,o,F,H,x))?(J||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount()),typeof h.componentDidMount=="function"&&(n.flags|=4194308)):(typeof h.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=o,n.memoizedState=H),h.props=o,h.state=H,h.context=x,o=R):(typeof h.componentDidMount=="function"&&(n.flags|=4194308),o=!1)}else{h=n.stateNode,sf(e,n),x=n.memoizedProps,J=Di(a,x),h.props=J,ne=n.pendingProps,F=h.context,H=a.contextType,R=ss,typeof H=="object"&&H!==null&&(R=Nt(H)),E=a.getDerivedStateFromProps,(H=typeof E=="function"||typeof h.getSnapshotBeforeUpdate=="function")||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(x!==ne||F!==R)&&H0(n,h,o,R),zr=!1,F=n.memoizedState,h.state=F,xa(n,o,h,u),va();var X=n.memoizedState;x!==ne||F!==X||zr||e!==null&&e.dependencies!==null&&Xo(e.dependencies)?(typeof E=="function"&&(Tf(n,a,E,o),X=n.memoizedState),(J=zr||$0(n,a,J,o,F,X,R)||e!==null&&e.dependencies!==null&&Xo(e.dependencies))?(H||typeof h.UNSAFE_componentWillUpdate!="function"&&typeof h.componentWillUpdate!="function"||(typeof h.componentWillUpdate=="function"&&h.componentWillUpdate(o,X,R),typeof h.UNSAFE_componentWillUpdate=="function"&&h.UNSAFE_componentWillUpdate(o,X,R)),typeof h.componentDidUpdate=="function"&&(n.flags|=4),typeof h.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof h.componentDidUpdate!="function"||x===e.memoizedProps&&F===e.memoizedState||(n.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||x===e.memoizedProps&&F===e.memoizedState||(n.flags|=1024),n.memoizedProps=o,n.memoizedState=X),h.props=o,h.state=X,h.context=R,o=J):(typeof h.componentDidUpdate!="function"||x===e.memoizedProps&&F===e.memoizedState||(n.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||x===e.memoizedProps&&F===e.memoizedState||(n.flags|=1024),o=!1)}return h=o,dl(e,n),o=(n.flags&128)!==0,h||o?(h=n.stateNode,a=o&&typeof a.getDerivedStateFromError!="function"?null:h.render(),n.flags|=1,e!==null&&o?(n.child=Mi(n,e.child,null,u),n.child=Mi(n,null,a,u)):kt(e,n,a,u),n.memoizedState=h.state,e=n.child):e=fr(e,n,u),e}function ip(e,n,a,o){return Ai(),n.flags|=256,kt(e,n,a,o),n.child}var Rf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Df(e){return{baseLanes:e,cachePool:Ym()}}function qf(e,n,a){return e=e!==null?e.childLanes&~a:0,n&&(e|=rn),e}function sp(e,n,a){var o=n.pendingProps,u=!1,h=(n.flags&128)!==0,x;if((x=h)||(x=e!==null&&e.memoizedState===null?!1:(ht.current&2)!==0),x&&(u=!0,n.flags&=-129),x=(n.flags&32)!==0,n.flags&=-33,e===null){if(ze){if(u?Ir(n):$r(),(e=et)?(e=dg(e,En),e=e!==null&&e.data!=="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:Dr!==null?{id:Gn,overflow:Fn}:null,retryLane:536870912,hydrationErrors:null},a=zm(e),a.return=n,n.child=a,Tt=n,et=null)):e=null,e===null)throw Br(n);return yh(e)?n.lanes=32:n.lanes=536870912,null}var E=o.children;return o=o.fallback,u?($r(),u=n.mode,E=ml({mode:"hidden",children:E},u),o=Oi(o,u,a,null),E.return=n,o.return=n,E.sibling=o,n.child=E,o=n.child,o.memoizedState=Df(a),o.childLanes=qf(e,x,a),n.memoizedState=Rf,Oa(null,o)):(Ir(n),Bf(n,E))}var R=e.memoizedState;if(R!==null&&(E=R.dehydrated,E!==null)){if(h)n.flags&256?(Ir(n),n.flags&=-257,n=Lf(e,n,a)):n.memoizedState!==null?($r(),n.child=e.child,n.flags|=128,n=null):($r(),E=o.fallback,u=n.mode,o=ml({mode:"visible",children:o.children},u),E=Oi(E,u,a,null),E.flags|=2,o.return=n,E.return=n,o.sibling=E,n.child=o,Mi(n,e.child,null,a),o=n.child,o.memoizedState=Df(a),o.childLanes=qf(e,x,a),n.memoizedState=Rf,n=Oa(null,o));else if(Ir(n),yh(E)){if(x=E.nextSibling&&E.nextSibling.dataset,x)var H=x.dgst;x=H,o=Error(s(419)),o.stack="",o.digest=x,da({value:o,source:null,stack:null}),n=Lf(e,n,a)}else if(vt||cs(e,n,a,!1),x=(a&e.childLanes)!==0,vt||x){if(x=Ze,x!==null&&(o=Mr(x,a),o!==0&&o!==R.retryLane))throw R.retryLane=o,Ei(e,o),Kt(x,e,o),Cf;gh(E)||Sl(),n=Lf(e,n,a)}else gh(E)?(n.flags|=192,n.child=e.child,n=null):(e=R.treeContext,et=An(E.nextSibling),Tt=n,ze=!0,qr=null,En=!1,e!==null&&Im(n,e),n=Bf(n,o.children),n.flags|=4096);return n}return u?($r(),E=o.fallback,u=n.mode,R=e.child,H=R.sibling,o=sr(R,{mode:"hidden",children:o.children}),o.subtreeFlags=R.subtreeFlags&65011712,H!==null?E=sr(H,E):(E=Oi(E,u,a,null),E.flags|=2),E.return=n,o.return=n,o.sibling=E,n.child=o,Oa(null,o),o=n.child,E=e.child.memoizedState,E===null?E=Df(a):(u=E.cachePool,u!==null?(R=yt._currentValue,u=u.parent!==R?{parent:R,pool:R}:u):u=Ym(),E={baseLanes:E.baseLanes|a,cachePool:u}),o.memoizedState=E,o.childLanes=qf(e,x,a),n.memoizedState=Rf,Oa(e.child,o)):(Ir(n),a=e.child,e=a.sibling,a=sr(a,{mode:"visible",children:o.children}),a.return=n,a.sibling=null,e!==null&&(x=n.deletions,x===null?(n.deletions=[e],n.flags|=16):x.push(e)),n.child=a,n.memoizedState=null,a)}function Bf(e,n){return n=ml({mode:"visible",children:n},e.mode),n.return=e,e.child=n}function ml(e,n){return e=Wt(22,e,null,n),e.lanes=0,e}function Lf(e,n,a){return Mi(n,e.child,null,a),e=Bf(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function ap(e,n,a){e.lanes|=n;var o=e.alternate;o!==null&&(o.lanes|=n),Qu(e.return,n,a)}function zf(e,n,a,o,u,h){var x=e.memoizedState;x===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:o,tail:a,tailMode:u,treeForkCount:h}:(x.isBackwards=n,x.rendering=null,x.renderingStartTime=0,x.last=o,x.tail=a,x.tailMode=u,x.treeForkCount=h)}function op(e,n,a){var o=n.pendingProps,u=o.revealOrder,h=o.tail;o=o.children;var x=ht.current,E=(x&2)!==0;if(E?(x=x&1|2,n.flags|=128):x&=1,Ne(ht,x),kt(e,n,o,a),o=ze?ha:0,!E&&e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&ap(e,a,n);else if(e.tag===19)ap(e,a,n);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break e;for(;e.sibling===null;){if(e.return===null||e.return===n)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(u){case"forwards":for(a=n.child,u=null;a!==null;)e=a.alternate,e!==null&&nl(e)===null&&(u=a),a=a.sibling;a=u,a===null?(u=n.child,n.child=null):(u=a.sibling,a.sibling=null),zf(n,!1,u,a,h,o);break;case"backwards":case"unstable_legacy-backwards":for(a=null,u=n.child,n.child=null;u!==null;){if(e=u.alternate,e!==null&&nl(e)===null){n.child=u;break}e=u.sibling,u.sibling=a,a=u,u=e}zf(n,!0,a,null,h,o);break;case"together":zf(n,!1,null,null,void 0,o);break;default:n.memoizedState=null}return n.child}function fr(e,n,a){if(e!==null&&(n.dependencies=e.dependencies),Fr|=n.lanes,(a&n.childLanes)===0)if(e!==null){if(cs(e,n,a,!1),(a&n.childLanes)===0)return null}else return null;if(e!==null&&n.child!==e.child)throw Error(s(153));if(n.child!==null){for(e=n.child,a=sr(e,e.pendingProps),n.child=a,a.return=n;e.sibling!==null;)e=e.sibling,a=a.sibling=sr(e,e.pendingProps),a.return=n;a.sibling=null}return n.child}function Uf(e,n){return(e.lanes&n)!==0?!0:(e=e.dependencies,!!(e!==null&&Xo(e)))}function Yx(e,n,a){switch(n.tag){case 3:Dt(n,n.stateNode.containerInfo),Lr(n,yt,e.memoizedState.cache),Ai();break;case 27:case 5:qt(n);break;case 4:Dt(n,n.stateNode.containerInfo);break;case 10:Lr(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,uf(n),null;break;case 13:var o=n.memoizedState;if(o!==null)return o.dehydrated!==null?(Ir(n),n.flags|=128,null):(a&n.child.childLanes)!==0?sp(e,n,a):(Ir(n),e=fr(e,n,a),e!==null?e.sibling:null);Ir(n);break;case 19:var u=(e.flags&128)!==0;if(o=(a&n.childLanes)!==0,o||(cs(e,n,a,!1),o=(a&n.childLanes)!==0),u){if(o)return op(e,n,a);n.flags|=128}if(u=n.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),Ne(ht,ht.current),o)break;return null;case 22:return n.lanes=0,W0(e,n,a,n.pendingProps);case 24:Lr(n,yt,e.memoizedState.cache)}return fr(e,n,a)}function lp(e,n,a){if(e!==null)if(e.memoizedProps!==n.pendingProps)vt=!0;else{if(!Uf(e,a)&&(n.flags&128)===0)return vt=!1,Yx(e,n,a);vt=(e.flags&131072)!==0}else vt=!1,ze&&(n.flags&1048576)!==0&&Pm(n,ha,n.index);switch(n.lanes=0,n.tag){case 16:e:{var o=n.pendingProps;if(e=ki(n.elementType),n.type=e,typeof e=="function")Hu(e)?(o=Di(e,o),n.tag=1,n=rp(null,n,e,o,a)):(n.tag=0,n=Mf(null,n,e,o,a));else{if(e!=null){var u=e.$$typeof;if(u===ae){n.tag=11,n=J0(null,n,e,o,a);break e}else if(u===re){n.tag=14,n=Q0(null,n,e,o,a);break e}}throw n=_e(e)||e,Error(s(306,n,""))}}return n;case 0:return Mf(e,n,n.type,n.pendingProps,a);case 1:return o=n.type,u=Di(o,n.pendingProps),rp(e,n,o,u,a);case 3:e:{if(Dt(n,n.stateNode.containerInfo),e===null)throw Error(s(387));o=n.pendingProps;var h=n.memoizedState;u=h.element,sf(e,n),xa(n,o,null,a);var x=n.memoizedState;if(o=x.cache,Lr(n,yt,o),o!==h.cache&&Zu(n,[yt],a,!0),va(),o=x.element,h.isDehydrated)if(h={element:o,isDehydrated:!1,cache:x.cache},n.updateQueue.baseState=h,n.memoizedState=h,n.flags&256){n=ip(e,n,o,a);break e}else if(o!==u){u=_n(Error(s(424)),n),da(u),n=ip(e,n,o,a);break e}else{switch(e=n.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(et=An(e.firstChild),Tt=n,ze=!0,qr=null,En=!0,a=Wm(n,null,o,a),n.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(Ai(),o===u){n=fr(e,n,a);break e}kt(e,n,o,a)}n=n.child}return n;case 26:return dl(e,n),e===null?(a=vg(n.type,null,n.pendingProps,null))?n.memoizedState=a:ze||(a=n.type,e=n.pendingProps,o=kl(Ht.current).createElement(a),o[Qe]=n,o[ot]=e,Ct(o,a,e),D(o),n.stateNode=o):n.memoizedState=vg(n.type,e.memoizedProps,n.pendingProps,e.memoizedState),null;case 27:return qt(n),e===null&&ze&&(o=n.stateNode=gg(n.type,n.pendingProps,Ht.current),Tt=n,En=!0,u=et,Jr(n.type)?(bh=u,et=An(o.firstChild)):et=u),kt(e,n,n.pendingProps.children,a),dl(e,n),e===null&&(n.flags|=4194304),n.child;case 5:return e===null&&ze&&((u=o=et)&&(o=S_(o,n.type,n.pendingProps,En),o!==null?(n.stateNode=o,Tt=n,et=An(o.firstChild),En=!1,u=!0):u=!1),u||Br(n)),qt(n),u=n.type,h=n.pendingProps,x=e!==null?e.memoizedProps:null,o=h.children,dh(u,h)?o=null:x!==null&&dh(u,x)&&(n.flags|=32),n.memoizedState!==null&&(u=hf(e,n,zx,null,null,a),Pa._currentValue=u),dl(e,n),kt(e,n,o,a),n.child;case 6:return e===null&&ze&&((e=a=et)&&(a=E_(a,n.pendingProps,En),a!==null?(n.stateNode=a,Tt=n,et=null,e=!0):e=!1),e||Br(n)),null;case 13:return sp(e,n,a);case 4:return Dt(n,n.stateNode.containerInfo),o=n.pendingProps,e===null?n.child=Mi(n,null,o,a):kt(e,n,o,a),n.child;case 11:return J0(e,n,n.type,n.pendingProps,a);case 7:return kt(e,n,n.pendingProps,a),n.child;case 8:return kt(e,n,n.pendingProps.children,a),n.child;case 12:return kt(e,n,n.pendingProps.children,a),n.child;case 10:return o=n.pendingProps,Lr(n,n.type,o.value),kt(e,n,o.children,a),n.child;case 9:return u=n.type._context,o=n.pendingProps.children,Ti(n),u=Nt(u),o=o(u),n.flags|=1,kt(e,n,o,a),n.child;case 14:return Q0(e,n,n.type,n.pendingProps,a);case 15:return Z0(e,n,n.type,n.pendingProps,a);case 19:return op(e,n,a);case 31:return Vx(e,n,a);case 22:return W0(e,n,a,n.pendingProps);case 24:return Ti(n),o=Nt(yt),e===null?(u=tf(),u===null&&(u=Ze,h=Wu(),u.pooledCache=h,h.refCount++,h!==null&&(u.pooledCacheLanes|=a),u=h),n.memoizedState={parent:o,cache:u},rf(n),Lr(n,yt,u)):((e.lanes&a)!==0&&(sf(e,n),xa(n,null,null,a),va()),u=e.memoizedState,h=n.memoizedState,u.parent!==o?(u={parent:o,cache:o},n.memoizedState=u,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=u),Lr(n,yt,o)):(o=h.cache,Lr(n,yt,o),o!==u.cache&&Zu(n,[yt],a,!0))),kt(e,n,n.pendingProps.children,a),n.child;case 29:throw n.pendingProps}throw Error(s(156,n.tag))}function hr(e){e.flags|=4}function Pf(e,n,a,o,u){if((n=(e.mode&32)!==0)&&(n=!1),n){if(e.flags|=16777216,(u&335544128)===u)if(e.stateNode.complete)e.flags|=8192;else if(qp())e.flags|=8192;else throw Ci=Zo,nf}else e.flags&=-16777217}function cp(e,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Eg(n))if(qp())e.flags|=8192;else throw Ci=Zo,nf}function pl(e,n){n!==null&&(e.flags|=4),e.flags&16384&&(n=e.tag!==22?Ki():536870912,e.lanes|=n,_s|=n)}function Aa(e,n){if(!ze)switch(e.tailMode){case"hidden":n=e.tail;for(var a=null;n!==null;)n.alternate!==null&&(a=n),n=n.sibling;a===null?e.tail=null:a.sibling=null;break;case"collapsed":a=e.tail;for(var o=null;a!==null;)a.alternate!==null&&(o=a),a=a.sibling;o===null?n||e.tail===null?e.tail=null:e.tail.sibling=null:o.sibling=null}}function tt(e){var n=e.alternate!==null&&e.alternate.child===e.child,a=0,o=0;if(n)for(var u=e.child;u!==null;)a|=u.lanes|u.childLanes,o|=u.subtreeFlags&65011712,o|=u.flags&65011712,u.return=e,u=u.sibling;else for(u=e.child;u!==null;)a|=u.lanes|u.childLanes,o|=u.subtreeFlags,o|=u.flags,u.return=e,u=u.sibling;return e.subtreeFlags|=o,e.childLanes=a,n}function Xx(e,n,a){var o=n.pendingProps;switch(Yu(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return tt(n),null;case 1:return tt(n),null;case 3:return a=n.stateNode,o=null,e!==null&&(o=e.memoizedState.cache),n.memoizedState.cache!==o&&(n.flags|=2048),lr(yt),ke(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(ls(n)?hr(n):e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,Ku())),tt(n),null;case 26:var u=n.type,h=n.memoizedState;return e===null?(hr(n),h!==null?(tt(n),cp(n,h)):(tt(n),Pf(n,u,null,o,a))):h?h!==e.memoizedState?(hr(n),tt(n),cp(n,h)):(tt(n),n.flags&=-16777217):(e=e.memoizedProps,e!==o&&hr(n),tt(n),Pf(n,u,e,o,a)),null;case 27:if(di(n),a=Ht.current,u=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==o&&hr(n);else{if(!o){if(n.stateNode===null)throw Error(s(166));return tt(n),null}e=be.current,ls(n)?$m(n):(e=gg(u,o,a),n.stateNode=e,hr(n))}return tt(n),null;case 5:if(di(n),u=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==o&&hr(n);else{if(!o){if(n.stateNode===null)throw Error(s(166));return tt(n),null}if(h=be.current,ls(n))$m(n);else{var x=kl(Ht.current);switch(h){case 1:h=x.createElementNS("http://www.w3.org/2000/svg",u);break;case 2:h=x.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;default:switch(u){case"svg":h=x.createElementNS("http://www.w3.org/2000/svg",u);break;case"math":h=x.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;case"script":h=x.createElement("div"),h.innerHTML="<script><\/script>",h=h.removeChild(h.firstChild);break;case"select":h=typeof o.is=="string"?x.createElement("select",{is:o.is}):x.createElement("select"),o.multiple?h.multiple=!0:o.size&&(h.size=o.size);break;default:h=typeof o.is=="string"?x.createElement(u,{is:o.is}):x.createElement(u)}}h[Qe]=n,h[ot]=o;e:for(x=n.child;x!==null;){if(x.tag===5||x.tag===6)h.appendChild(x.stateNode);else if(x.tag!==4&&x.tag!==27&&x.child!==null){x.child.return=x,x=x.child;continue}if(x===n)break e;for(;x.sibling===null;){if(x.return===null||x.return===n)break e;x=x.return}x.sibling.return=x.return,x=x.sibling}n.stateNode=h;e:switch(Ct(h,u,o),u){case"button":case"input":case"select":case"textarea":o=!!o.autoFocus;break e;case"img":o=!0;break e;default:o=!1}o&&hr(n)}}return tt(n),Pf(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,a),null;case 6:if(e&&n.stateNode!=null)e.memoizedProps!==o&&hr(n);else{if(typeof o!="string"&&n.stateNode===null)throw Error(s(166));if(e=Ht.current,ls(n)){if(e=n.stateNode,a=n.memoizedProps,o=null,u=Tt,u!==null)switch(u.tag){case 27:case 5:o=u.memoizedProps}e[Qe]=n,e=!!(e.nodeValue===a||o!==null&&o.suppressHydrationWarning===!0||sg(e.nodeValue,a)),e||Br(n,!0)}else e=kl(e).createTextNode(o),e[Qe]=n,n.stateNode=e}return tt(n),null;case 31:if(a=n.memoizedState,e===null||e.memoizedState!==null){if(o=ls(n),a!==null){if(e===null){if(!o)throw Error(s(318));if(e=n.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(s(557));e[Qe]=n}else Ai(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;tt(n),e=!1}else a=Ku(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return n.flags&256?(tn(n),n):(tn(n),null);if((n.flags&128)!==0)throw Error(s(558))}return tt(n),null;case 13:if(o=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(u=ls(n),o!==null&&o.dehydrated!==null){if(e===null){if(!u)throw Error(s(318));if(u=n.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(s(317));u[Qe]=n}else Ai(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;tt(n),u=!1}else u=Ku(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=u),u=!0;if(!u)return n.flags&256?(tn(n),n):(tn(n),null)}return tn(n),(n.flags&128)!==0?(n.lanes=a,n):(a=o!==null,e=e!==null&&e.memoizedState!==null,a&&(o=n.child,u=null,o.alternate!==null&&o.alternate.memoizedState!==null&&o.alternate.memoizedState.cachePool!==null&&(u=o.alternate.memoizedState.cachePool.pool),h=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(h=o.memoizedState.cachePool.pool),h!==u&&(o.flags|=2048)),a!==e&&a&&(n.child.flags|=8192),pl(n,n.updateQueue),tt(n),null);case 4:return ke(),e===null&&lh(n.stateNode.containerInfo),tt(n),null;case 10:return lr(n.type),tt(n),null;case 19:if(Se(ht),o=n.memoizedState,o===null)return tt(n),null;if(u=(n.flags&128)!==0,h=o.rendering,h===null)if(u)Aa(o,!1);else{if(ct!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(h=nl(e),h!==null){for(n.flags|=128,Aa(o,!1),e=h.updateQueue,n.updateQueue=e,pl(n,e),n.subtreeFlags=0,e=a,a=n.child;a!==null;)Lm(a,e),a=a.sibling;return Ne(ht,ht.current&1|2),ze&&ar(n,o.treeForkCount),n.child}e=e.sibling}o.tail!==null&&nt()>xl&&(n.flags|=128,u=!0,Aa(o,!1),n.lanes=4194304)}else{if(!u)if(e=nl(h),e!==null){if(n.flags|=128,u=!0,e=e.updateQueue,n.updateQueue=e,pl(n,e),Aa(o,!0),o.tail===null&&o.tailMode==="hidden"&&!h.alternate&&!ze)return tt(n),null}else 2*nt()-o.renderingStartTime>xl&&a!==536870912&&(n.flags|=128,u=!0,Aa(o,!1),n.lanes=4194304);o.isBackwards?(h.sibling=n.child,n.child=h):(e=o.last,e!==null?e.sibling=h:n.child=h,o.last=h)}return o.tail!==null?(e=o.tail,o.rendering=e,o.tail=e.sibling,o.renderingStartTime=nt(),e.sibling=null,a=ht.current,Ne(ht,u?a&1|2:a&1),ze&&ar(n,o.treeForkCount),e):(tt(n),null);case 22:case 23:return tn(n),cf(),o=n.memoizedState!==null,e!==null?e.memoizedState!==null!==o&&(n.flags|=8192):o&&(n.flags|=8192),o?(a&536870912)!==0&&(n.flags&128)===0&&(tt(n),n.subtreeFlags&6&&(n.flags|=8192)):tt(n),a=n.updateQueue,a!==null&&pl(n,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),o=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(o=n.memoizedState.cachePool.pool),o!==a&&(n.flags|=2048),e!==null&&Se(Ni),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),n.memoizedState.cache!==a&&(n.flags|=2048),lr(yt),tt(n),null;case 25:return null;case 30:return null}throw Error(s(156,n.tag))}function Kx(e,n){switch(Yu(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return lr(yt),ke(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 26:case 27:case 5:return di(n),null;case 31:if(n.memoizedState!==null){if(tn(n),n.alternate===null)throw Error(s(340));Ai()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 13:if(tn(n),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(s(340));Ai()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return Se(ht),null;case 4:return ke(),null;case 10:return lr(n.type),null;case 22:case 23:return tn(n),cf(),e!==null&&Se(Ni),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return lr(yt),null;case 25:return null;default:return null}}function up(e,n){switch(Yu(n),n.tag){case 3:lr(yt),ke();break;case 26:case 27:case 5:di(n);break;case 4:ke();break;case 31:n.memoizedState!==null&&tn(n);break;case 13:tn(n);break;case 19:Se(ht);break;case 10:lr(n.type);break;case 22:case 23:tn(n),cf(),e!==null&&Se(Ni);break;case 24:lr(yt)}}function ja(e,n){try{var a=n.updateQueue,o=a!==null?a.lastEffect:null;if(o!==null){var u=o.next;a=u;do{if((a.tag&e)===e){o=void 0;var h=a.create,x=a.inst;o=h(),x.destroy=o}a=a.next}while(a!==u)}}catch(E){Ve(n,n.return,E)}}function Hr(e,n,a){try{var o=n.updateQueue,u=o!==null?o.lastEffect:null;if(u!==null){var h=u.next;o=h;do{if((o.tag&e)===e){var x=o.inst,E=x.destroy;if(E!==void 0){x.destroy=void 0,u=n;var R=a,H=E;try{H()}catch(J){Ve(u,R,J)}}}o=o.next}while(o!==h)}}catch(J){Ve(n,n.return,J)}}function fp(e){var n=e.updateQueue;if(n!==null){var a=e.stateNode;try{t0(n,a)}catch(o){Ve(e,e.return,o)}}}function hp(e,n,a){a.props=Di(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(o){Ve(e,n,o)}}function Ta(e,n){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var o=e.stateNode;break;case 30:o=e.stateNode;break;default:o=e.stateNode}typeof a=="function"?e.refCleanup=a(o):a.current=o}}catch(u){Ve(e,n,u)}}function Vn(e,n){var a=e.ref,o=e.refCleanup;if(a!==null)if(typeof o=="function")try{o()}catch(u){Ve(e,n,u)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(u){Ve(e,n,u)}else a.current=null}function dp(e){var n=e.type,a=e.memoizedProps,o=e.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":a.autoFocus&&o.focus();break e;case"img":a.src?o.src=a.src:a.srcSet&&(o.srcset=a.srcSet)}}catch(u){Ve(e,e.return,u)}}function If(e,n,a){try{var o=e.stateNode;y_(o,e.type,a,n),o[ot]=n}catch(u){Ve(e,e.return,u)}}function mp(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Jr(e.type)||e.tag===4}function $f(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||mp(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Jr(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Hf(e,n,a){var o=e.tag;if(o===5||o===6)e=e.stateNode,n?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,n):(n=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,n.appendChild(e),a=a._reactRootContainer,a!=null||n.onclick!==null||(n.onclick=rr));else if(o!==4&&(o===27&&Jr(e.type)&&(a=e.stateNode,n=null),e=e.child,e!==null))for(Hf(e,n,a),e=e.sibling;e!==null;)Hf(e,n,a),e=e.sibling}function gl(e,n,a){var o=e.tag;if(o===5||o===6)e=e.stateNode,n?a.insertBefore(e,n):a.appendChild(e);else if(o!==4&&(o===27&&Jr(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(gl(e,n,a),e=e.sibling;e!==null;)gl(e,n,a),e=e.sibling}function pp(e){var n=e.stateNode,a=e.memoizedProps;try{for(var o=e.type,u=n.attributes;u.length;)n.removeAttributeNode(u[0]);Ct(n,o,a),n[Qe]=e,n[ot]=a}catch(h){Ve(e,e.return,h)}}var dr=!1,xt=!1,Gf=!1,gp=typeof WeakSet=="function"?WeakSet:Set,Ot=null;function Jx(e,n){if(e=e.containerInfo,fh=Ll,e=Tm(e),Bu(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var o=a.getSelection&&a.getSelection();if(o&&o.rangeCount!==0){a=o.anchorNode;var u=o.anchorOffset,h=o.focusNode;o=o.focusOffset;try{a.nodeType,h.nodeType}catch{a=null;break e}var x=0,E=-1,R=-1,H=0,J=0,ne=e,F=null;t:for(;;){for(var X;ne!==a||u!==0&&ne.nodeType!==3||(E=x+u),ne!==h||o!==0&&ne.nodeType!==3||(R=x+o),ne.nodeType===3&&(x+=ne.nodeValue.length),(X=ne.firstChild)!==null;)F=ne,ne=X;for(;;){if(ne===e)break t;if(F===a&&++H===u&&(E=x),F===h&&++J===o&&(R=x),(X=ne.nextSibling)!==null)break;ne=F,F=ne.parentNode}ne=X}a=E===-1||R===-1?null:{start:E,end:R}}else a=null}a=a||{start:0,end:0}}else a=null;for(hh={focusedElem:e,selectionRange:a},Ll=!1,Ot=n;Ot!==null;)if(n=Ot,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,Ot=e;else for(;Ot!==null;){switch(n=Ot,h=n.alternate,e=n.flags,n.tag){case 0:if((e&4)!==0&&(e=n.updateQueue,e=e!==null?e.events:null,e!==null))for(a=0;a<e.length;a++)u=e[a],u.ref.impl=u.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&h!==null){e=void 0,a=n,u=h.memoizedProps,h=h.memoizedState,o=a.stateNode;try{var ge=Di(a.type,u);e=o.getSnapshotBeforeUpdate(ge,h),o.__reactInternalSnapshotBeforeUpdate=e}catch(Ee){Ve(a,a.return,Ee)}}break;case 3:if((e&1024)!==0){if(e=n.stateNode.containerInfo,a=e.nodeType,a===9)ph(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":ph(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(s(163))}if(e=n.sibling,e!==null){e.return=n.return,Ot=e;break}Ot=n.return}}function yp(e,n,a){var o=a.flags;switch(a.tag){case 0:case 11:case 15:pr(e,a),o&4&&ja(5,a);break;case 1:if(pr(e,a),o&4)if(e=a.stateNode,n===null)try{e.componentDidMount()}catch(x){Ve(a,a.return,x)}else{var u=Di(a.type,n.memoizedProps);n=n.memoizedState;try{e.componentDidUpdate(u,n,e.__reactInternalSnapshotBeforeUpdate)}catch(x){Ve(a,a.return,x)}}o&64&&fp(a),o&512&&Ta(a,a.return);break;case 3:if(pr(e,a),o&64&&(e=a.updateQueue,e!==null)){if(n=null,a.child!==null)switch(a.child.tag){case 27:case 5:n=a.child.stateNode;break;case 1:n=a.child.stateNode}try{t0(e,n)}catch(x){Ve(a,a.return,x)}}break;case 27:n===null&&o&4&&pp(a);case 26:case 5:pr(e,a),n===null&&o&4&&dp(a),o&512&&Ta(a,a.return);break;case 12:pr(e,a);break;case 31:pr(e,a),o&4&&xp(e,a);break;case 13:pr(e,a),o&4&&_p(e,a),o&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=s_.bind(null,a),O_(e,a))));break;case 22:if(o=a.memoizedState!==null||dr,!o){n=n!==null&&n.memoizedState!==null||xt,u=dr;var h=xt;dr=o,(xt=n)&&!h?gr(e,a,(a.subtreeFlags&8772)!==0):pr(e,a),dr=u,xt=h}break;case 30:break;default:pr(e,a)}}function bp(e){var n=e.alternate;n!==null&&(e.alternate=null,bp(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&Ji(n)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var rt=null,Ft=!1;function mr(e,n,a){for(a=a.child;a!==null;)vp(e,n,a),a=a.sibling}function vp(e,n,a){if(ft&&typeof ft.onCommitFiberUnmount=="function")try{ft.onCommitFiberUnmount(pi,a)}catch{}switch(a.tag){case 26:xt||Vn(a,n),mr(e,n,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:xt||Vn(a,n);var o=rt,u=Ft;Jr(a.type)&&(rt=a.stateNode,Ft=!1),mr(e,n,a),La(a.stateNode),rt=o,Ft=u;break;case 5:xt||Vn(a,n);case 6:if(o=rt,u=Ft,rt=null,mr(e,n,a),rt=o,Ft=u,rt!==null)if(Ft)try{(rt.nodeType===9?rt.body:rt.nodeName==="HTML"?rt.ownerDocument.body:rt).removeChild(a.stateNode)}catch(h){Ve(a,n,h)}else try{rt.removeChild(a.stateNode)}catch(h){Ve(a,n,h)}break;case 18:rt!==null&&(Ft?(e=rt,fg(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),Ns(e)):fg(rt,a.stateNode));break;case 4:o=rt,u=Ft,rt=a.stateNode.containerInfo,Ft=!0,mr(e,n,a),rt=o,Ft=u;break;case 0:case 11:case 14:case 15:Hr(2,a,n),xt||Hr(4,a,n),mr(e,n,a);break;case 1:xt||(Vn(a,n),o=a.stateNode,typeof o.componentWillUnmount=="function"&&hp(a,n,o)),mr(e,n,a);break;case 21:mr(e,n,a);break;case 22:xt=(o=xt)||a.memoizedState!==null,mr(e,n,a),xt=o;break;default:mr(e,n,a)}}function xp(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Ns(e)}catch(a){Ve(n,n.return,a)}}}function _p(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Ns(e)}catch(a){Ve(n,n.return,a)}}function Qx(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=Qx(e);n.forEach(function(o){if(!a.has(o)){a.add(o);var u=a_.bind(null,e,o);o.then(u,u)}})}function Vt(e,n){var a=n.deletions;if(a!==null)for(var o=0;o<a.length;o++){var u=a[o],h=e,x=n,E=x;e:for(;E!==null;){switch(E.tag){case 27:if(Jr(E.type)){rt=E.stateNode,Ft=!1;break e}break;case 5:rt=E.stateNode,Ft=!1;break e;case 3:case 4:rt=E.stateNode.containerInfo,Ft=!0;break e}E=E.return}if(rt===null)throw Error(s(160));vp(h,x,u),rt=null,Ft=!1,h=u.alternate,h!==null&&(h.return=null),u.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)wp(n,e),n=n.sibling}var Bn=null;function wp(e,n){var a=e.alternate,o=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Vt(n,e),Yt(e),o&4&&(Hr(3,e,e.return),ja(3,e),Hr(5,e,e.return));break;case 1:Vt(n,e),Yt(e),o&512&&(xt||a===null||Vn(a,a.return)),o&64&&dr&&(e=e.updateQueue,e!==null&&(o=e.callbacks,o!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?o:a.concat(o))));break;case 26:var u=Bn;if(Vt(n,e),Yt(e),o&512&&(xt||a===null||Vn(a,a.return)),o&4){var h=a!==null?a.memoizedState:null;if(o=e.memoizedState,a===null)if(o===null)if(e.stateNode===null){e:{o=e.type,a=e.memoizedProps,u=u.ownerDocument||u;t:switch(o){case"title":h=u.getElementsByTagName("title")[0],(!h||h[wt]||h[Qe]||h.namespaceURI==="http://www.w3.org/2000/svg"||h.hasAttribute("itemprop"))&&(h=u.createElement(o),u.head.insertBefore(h,u.querySelector("head > title"))),Ct(h,o,a),h[Qe]=e,D(h),o=h;break e;case"link":var x=wg("link","href",u).get(o+(a.href||""));if(x){for(var E=0;E<x.length;E++)if(h=x[E],h.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&h.getAttribute("rel")===(a.rel==null?null:a.rel)&&h.getAttribute("title")===(a.title==null?null:a.title)&&h.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){x.splice(E,1);break t}}h=u.createElement(o),Ct(h,o,a),u.head.appendChild(h);break;case"meta":if(x=wg("meta","content",u).get(o+(a.content||""))){for(E=0;E<x.length;E++)if(h=x[E],h.getAttribute("content")===(a.content==null?null:""+a.content)&&h.getAttribute("name")===(a.name==null?null:a.name)&&h.getAttribute("property")===(a.property==null?null:a.property)&&h.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&h.getAttribute("charset")===(a.charSet==null?null:a.charSet)){x.splice(E,1);break t}}h=u.createElement(o),Ct(h,o,a),u.head.appendChild(h);break;default:throw Error(s(468,o))}h[Qe]=e,D(h),o=h}e.stateNode=o}else Sg(u,e.type,e.stateNode);else e.stateNode=_g(u,o,e.memoizedProps);else h!==o?(h===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):h.count--,o===null?Sg(u,e.type,e.stateNode):_g(u,o,e.memoizedProps)):o===null&&e.stateNode!==null&&If(e,e.memoizedProps,a.memoizedProps)}break;case 27:Vt(n,e),Yt(e),o&512&&(xt||a===null||Vn(a,a.return)),a!==null&&o&4&&If(e,e.memoizedProps,a.memoizedProps);break;case 5:if(Vt(n,e),Yt(e),o&512&&(xt||a===null||Vn(a,a.return)),e.flags&32){u=e.stateNode;try{Zi(u,"")}catch(ge){Ve(e,e.return,ge)}}o&4&&e.stateNode!=null&&(u=e.memoizedProps,If(e,u,a!==null?a.memoizedProps:u)),o&1024&&(Gf=!0);break;case 6:if(Vt(n,e),Yt(e),o&4){if(e.stateNode===null)throw Error(s(162));o=e.memoizedProps,a=e.stateNode;try{a.nodeValue=o}catch(ge){Ve(e,e.return,ge)}}break;case 3:if(Rl=null,u=Bn,Bn=Cl(n.containerInfo),Vt(n,e),Bn=u,Yt(e),o&4&&a!==null&&a.memoizedState.isDehydrated)try{Ns(n.containerInfo)}catch(ge){Ve(e,e.return,ge)}Gf&&(Gf=!1,Sp(e));break;case 4:o=Bn,Bn=Cl(e.stateNode.containerInfo),Vt(n,e),Yt(e),Bn=o;break;case 12:Vt(n,e),Yt(e);break;case 31:Vt(n,e),Yt(e),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,yl(e,o)));break;case 13:Vt(n,e),Yt(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(vl=nt()),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,yl(e,o)));break;case 22:u=e.memoizedState!==null;var R=a!==null&&a.memoizedState!==null,H=dr,J=xt;if(dr=H||u,xt=J||R,Vt(n,e),xt=J,dr=H,Yt(e),o&8192)e:for(n=e.stateNode,n._visibility=u?n._visibility&-2:n._visibility|1,u&&(a===null||R||dr||xt||qi(e)),a=null,n=e;;){if(n.tag===5||n.tag===26){if(a===null){R=a=n;try{if(h=R.stateNode,u)x=h.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none";else{E=R.stateNode;var ne=R.memoizedProps.style,F=ne!=null&&ne.hasOwnProperty("display")?ne.display:null;E.style.display=F==null||typeof F=="boolean"?"":(""+F).trim()}}catch(ge){Ve(R,R.return,ge)}}}else if(n.tag===6){if(a===null){R=n;try{R.stateNode.nodeValue=u?"":R.memoizedProps}catch(ge){Ve(R,R.return,ge)}}}else if(n.tag===18){if(a===null){R=n;try{var X=R.stateNode;u?hg(X,!0):hg(R.stateNode,!1)}catch(ge){Ve(R,R.return,ge)}}}else if((n.tag!==22&&n.tag!==23||n.memoizedState===null||n===e)&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break e;for(;n.sibling===null;){if(n.return===null||n.return===e)break e;a===n&&(a=null),n=n.return}a===n&&(a=null),n.sibling.return=n.return,n=n.sibling}o&4&&(o=e.updateQueue,o!==null&&(a=o.retryQueue,a!==null&&(o.retryQueue=null,yl(e,a))));break;case 19:Vt(n,e),Yt(e),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,yl(e,o)));break;case 30:break;case 21:break;default:Vt(n,e),Yt(e)}}function Yt(e){var n=e.flags;if(n&2){try{for(var a,o=e.return;o!==null;){if(mp(o)){a=o;break}o=o.return}if(a==null)throw Error(s(160));switch(a.tag){case 27:var u=a.stateNode,h=$f(e);gl(e,h,u);break;case 5:var x=a.stateNode;a.flags&32&&(Zi(x,""),a.flags&=-33);var E=$f(e);gl(e,E,x);break;case 3:case 4:var R=a.stateNode.containerInfo,H=$f(e);Hf(e,H,R);break;default:throw Error(s(161))}}catch(J){Ve(e,e.return,J)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function Sp(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var n=e;Sp(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),e=e.sibling}}function pr(e,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)yp(e,n.alternate,n),n=n.sibling}function qi(e){for(e=e.child;e!==null;){var n=e;switch(n.tag){case 0:case 11:case 14:case 15:Hr(4,n,n.return),qi(n);break;case 1:Vn(n,n.return);var a=n.stateNode;typeof a.componentWillUnmount=="function"&&hp(n,n.return,a),qi(n);break;case 27:La(n.stateNode);case 26:case 5:Vn(n,n.return),qi(n);break;case 22:n.memoizedState===null&&qi(n);break;case 30:qi(n);break;default:qi(n)}e=e.sibling}}function gr(e,n,a){for(a=a&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var o=n.alternate,u=e,h=n,x=h.flags;switch(h.tag){case 0:case 11:case 15:gr(u,h,a),ja(4,h);break;case 1:if(gr(u,h,a),o=h,u=o.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(H){Ve(o,o.return,H)}if(o=h,u=o.updateQueue,u!==null){var E=o.stateNode;try{var R=u.shared.hiddenCallbacks;if(R!==null)for(u.shared.hiddenCallbacks=null,u=0;u<R.length;u++)e0(R[u],E)}catch(H){Ve(o,o.return,H)}}a&&x&64&&fp(h),Ta(h,h.return);break;case 27:pp(h);case 26:case 5:gr(u,h,a),a&&o===null&&x&4&&dp(h),Ta(h,h.return);break;case 12:gr(u,h,a);break;case 31:gr(u,h,a),a&&x&4&&xp(u,h);break;case 13:gr(u,h,a),a&&x&4&&_p(u,h);break;case 22:h.memoizedState===null&&gr(u,h,a),Ta(h,h.return);break;case 30:break;default:gr(u,h,a)}n=n.sibling}}function Ff(e,n){var a=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),e=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(e=n.memoizedState.cachePool.pool),e!==a&&(e!=null&&e.refCount++,a!=null&&ma(a))}function Vf(e,n){e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&ma(e))}function Ln(e,n,a,o){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Ep(e,n,a,o),n=n.sibling}function Ep(e,n,a,o){var u=n.flags;switch(n.tag){case 0:case 11:case 15:Ln(e,n,a,o),u&2048&&ja(9,n);break;case 1:Ln(e,n,a,o);break;case 3:Ln(e,n,a,o),u&2048&&(e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&ma(e)));break;case 12:if(u&2048){Ln(e,n,a,o),e=n.stateNode;try{var h=n.memoizedProps,x=h.id,E=h.onPostCommit;typeof E=="function"&&E(x,n.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(R){Ve(n,n.return,R)}}else Ln(e,n,a,o);break;case 31:Ln(e,n,a,o);break;case 13:Ln(e,n,a,o);break;case 23:break;case 22:h=n.stateNode,x=n.alternate,n.memoizedState!==null?h._visibility&2?Ln(e,n,a,o):Na(e,n):h._visibility&2?Ln(e,n,a,o):(h._visibility|=2,bs(e,n,a,o,(n.subtreeFlags&10256)!==0||!1)),u&2048&&Ff(x,n);break;case 24:Ln(e,n,a,o),u&2048&&Vf(n.alternate,n);break;default:Ln(e,n,a,o)}}function bs(e,n,a,o,u){for(u=u&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var h=e,x=n,E=a,R=o,H=x.flags;switch(x.tag){case 0:case 11:case 15:bs(h,x,E,R,u),ja(8,x);break;case 23:break;case 22:var J=x.stateNode;x.memoizedState!==null?J._visibility&2?bs(h,x,E,R,u):Na(h,x):(J._visibility|=2,bs(h,x,E,R,u)),u&&H&2048&&Ff(x.alternate,x);break;case 24:bs(h,x,E,R,u),u&&H&2048&&Vf(x.alternate,x);break;default:bs(h,x,E,R,u)}n=n.sibling}}function Na(e,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var a=e,o=n,u=o.flags;switch(o.tag){case 22:Na(a,o),u&2048&&Ff(o.alternate,o);break;case 24:Na(a,o),u&2048&&Vf(o.alternate,o);break;default:Na(a,o)}n=n.sibling}}var ka=8192;function vs(e,n,a){if(e.subtreeFlags&ka)for(e=e.child;e!==null;)Op(e,n,a),e=e.sibling}function Op(e,n,a){switch(e.tag){case 26:vs(e,n,a),e.flags&ka&&e.memoizedState!==null&&L_(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 Zx={getCacheForType:function(e){var n=Nt(yt),a=n.data.get(e);return a===void 0&&(a=e(),n.data.set(e,a)),a},cacheSignal:function(){return Nt(yt).controller.signal}},Wx=typeof WeakMap=="function"?WeakMap:Map,Ge=0,Ze=null,De=null,Be=0,Fe=0,nn=null,Gr=!1,xs=!1,Yf=!1,yr=0,ct=0,Fr=0,Bi=0,Xf=0,rn=0,_s=0,Ma=null,Xt=null,Kf=!1,vl=0,Np=0,xl=1/0,_l=null,Vr=null,St=0,Yr=null,ws=null,br=0,Jf=0,Qf=null,kp=null,Ra=0,Zf=null;function sn(){return(Ge&2)!==0&&Be!==0?Be&-Be:Y.T!==null?ih():ta()}function Cp(){if(rn===0)if((Be&536870912)===0||ze){var e=er;er<<=1,(er&3932160)===0&&(er=262144),rn=e}else rn=536870912;return e=en.current,e!==null&&(e.flags|=32),rn}function Kt(e,n,a){(e===Ze&&(Fe===2||Fe===9)||e.cancelPendingCommit!==null)&&(Ss(e,0),Xr(e,Be,rn,!1)),Rn(e,a),((Ge&2)===0||e!==Ze)&&(e===Ze&&((Ge&2)===0&&(Bi|=a),ct===4&&Xr(e,Be,rn,!1)),Yn(e))}function Mp(e,n,a){if((Ge&6)!==0)throw Error(s(327));var o=!a&&(n&127)===0&&(n&e.expiredLanes)===0||yi(e,n),u=o?n_(e,n):eh(e,n,!0),h=o;do{if(u===0){xs&&!o&&Xr(e,n,0,!1);break}else{if(a=e.current.alternate,h&&!e_(a)){u=eh(e,n,!1),h=!1;continue}if(u===2){if(h=n,e.errorRecoveryDisabledLanes&h)var x=0;else x=e.pendingLanes&-536870913,x=x!==0?x:x&536870912?536870912:0;if(x!==0){n=x;e:{var E=e;u=Ma;var R=E.current.memoizedState.isDehydrated;if(R&&(Ss(E,x).flags|=256),x=eh(E,x,!1),x!==2){if(Yf&&!R){E.errorRecoveryDisabledLanes|=h,Bi|=h,u=4;break e}h=Xt,Xt=u,h!==null&&(Xt===null?Xt=h:Xt.push.apply(Xt,h))}u=x}if(h=!1,u!==2)continue}}if(u===1){Ss(e,0),Xr(e,n,0,!0);break}e:{switch(o=e,h=u,h){case 0:case 1:throw Error(s(345));case 4:if((n&4194048)!==n)break;case 6:Xr(o,n,rn,!Gr);break e;case 2:Xt=null;break;case 3:case 5:break;default:throw Error(s(329))}if((n&62914560)===n&&(u=vl+300-nt(),10<u)){if(Xr(o,n,rn,!Gr),gi(o,0,!0)!==0)break e;br=n,o.timeoutHandle=cg(Rp.bind(null,o,a,Xt,_l,Kf,n,rn,Bi,_s,Gr,h,"Throttled",-0,0),u);break e}Rp(o,a,Xt,_l,Kf,n,rn,Bi,_s,Gr,h,null,-0,0)}}break}while(!0);Yn(e)}function Rp(e,n,a,o,u,h,x,E,R,H,J,ne,F,X){if(e.timeoutHandle=-1,ne=n.subtreeFlags,ne&8192||(ne&16785408)===16785408){ne={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:rr},Op(n,h,ne);var ge=(h&62914560)===h?vl-nt():(h&4194048)===h?Np-nt():0;if(ge=z_(ne,ge),ge!==null){br=h,e.cancelPendingCommit=ge(Ip.bind(null,e,n,h,a,o,u,x,E,R,J,ne,null,F,X)),Xr(e,h,x,!H);return}}Ip(e,n,h,a,o,u,x,E,R)}function e_(e){for(var n=e;;){var a=n.tag;if((a===0||a===11||a===15)&&n.flags&16384&&(a=n.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var o=0;o<a.length;o++){var u=a[o],h=u.getSnapshot;u=u.value;try{if(!Zt(h(),u))return!1}catch{return!1}}if(a=n.child,n.subtreeFlags&16384&&a!==null)a.return=n,n=a;else{if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function Xr(e,n,a,o){n&=~Xf,n&=~Bi,e.suspendedLanes|=n,e.pingedLanes&=~n,o&&(e.warmLanes|=n),o=e.expirationTimes;for(var u=n;0<u;){var h=31-Bt(u),x=1<<h;o[h]=-1,u&=~x}a!==0&&Cr(e,a,n)}function wl(){return(Ge&6)===0?(Da(0),!1):!0}function Wf(){if(De!==null){if(Fe===0)var e=De.return;else e=De,or=ji=null,pf(e),ds=null,ga=0,e=De;for(;e!==null;)up(e.alternate,e),e=e.return;De=null}}function Ss(e,n){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,x_(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),br=0,Wf(),Ze=e,De=a=sr(e.current,null),Be=n,Fe=0,nn=null,Gr=!1,xs=yi(e,n),Yf=!1,_s=rn=Xf=Bi=Fr=ct=0,Xt=Ma=null,Kf=!1,(n&8)!==0&&(n|=n&32);var o=e.entangledLanes;if(o!==0)for(e=e.entanglements,o&=n;0<o;){var u=31-Bt(o),h=1<<u;n|=e[u],o&=~h}return yr=n,Ho(),a}function Dp(e,n){Ce=null,Y.H=Ea,n===hs||n===Qo?(n=Jm(),Fe=3):n===nf?(n=Jm(),Fe=4):Fe=n===Cf?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,nn=n,De===null&&(ct=1,fl(e,_n(n,e.current)))}function qp(){var e=en.current;return e===null?!0:(Be&4194048)===Be?On===null:(Be&62914560)===Be||(Be&536870912)!==0?e===On:!1}function Bp(){var e=Y.H;return Y.H=Ea,e===null?Ea:e}function Lp(){var e=Y.A;return Y.A=Zx,e}function Sl(){ct=4,Gr||(Be&4194048)!==Be&&en.current!==null||(xs=!0),(Fr&134217727)===0&&(Bi&134217727)===0||Ze===null||Xr(Ze,Be,rn,!1)}function eh(e,n,a){var o=Ge;Ge|=2;var u=Bp(),h=Lp();(Ze!==e||Be!==n)&&(_l=null,Ss(e,n)),n=!1;var x=ct;e:do try{if(Fe!==0&&De!==null){var E=De,R=nn;switch(Fe){case 8:Wf(),x=6;break e;case 3:case 2:case 9:case 6:en.current===null&&(n=!0);var H=Fe;if(Fe=0,nn=null,Es(e,E,R,H),a&&xs){x=0;break e}break;default:H=Fe,Fe=0,nn=null,Es(e,E,R,H)}}t_(),x=ct;break}catch(J){Dp(e,J)}while(!0);return n&&e.shellSuspendCounter++,or=ji=null,Ge=o,Y.H=u,Y.A=h,De===null&&(Ze=null,Be=0,Ho()),x}function t_(){for(;De!==null;)zp(De)}function n_(e,n){var a=Ge;Ge|=2;var o=Bp(),u=Lp();Ze!==e||Be!==n?(_l=null,xl=nt()+500,Ss(e,n)):xs=yi(e,n);e:do try{if(Fe!==0&&De!==null){n=De;var h=nn;t:switch(Fe){case 1:Fe=0,nn=null,Es(e,n,h,1);break;case 2:case 9:if(Xm(h)){Fe=0,nn=null,Up(n);break}n=function(){Fe!==2&&Fe!==9||Ze!==e||(Fe=7),Yn(e)},h.then(n,n);break e;case 3:Fe=7;break e;case 4:Fe=5;break e;case 7:Xm(h)?(Fe=0,nn=null,Up(n)):(Fe=0,nn=null,Es(e,n,h,7));break;case 5:var x=null;switch(De.tag){case 26:x=De.memoizedState;case 5:case 27:var E=De;if(x?Eg(x):E.stateNode.complete){Fe=0,nn=null;var R=E.sibling;if(R!==null)De=R;else{var H=E.return;H!==null?(De=H,El(H)):De=null}break t}}Fe=0,nn=null,Es(e,n,h,5);break;case 6:Fe=0,nn=null,Es(e,n,h,6);break;case 8:Wf(),ct=6;break e;default:throw Error(s(462))}}r_();break}catch(J){Dp(e,J)}while(!0);return or=ji=null,Y.H=o,Y.A=u,Ge=a,De!==null?0:(Ze=null,Be=0,Ho(),ct)}function r_(){for(;De!==null&&!Ao();)zp(De)}function zp(e){var n=lp(e.alternate,e,yr);e.memoizedProps=e.pendingProps,n===null?El(e):De=n}function Up(e){var n=e,a=n.alternate;switch(n.tag){case 15:case 0:n=np(a,n,n.pendingProps,n.type,void 0,Be);break;case 11:n=np(a,n,n.pendingProps,n.type.render,n.ref,Be);break;case 5:pf(n);default:up(a,n),n=De=Lm(n,yr),n=lp(a,n,yr)}e.memoizedProps=e.pendingProps,n===null?El(e):De=n}function Es(e,n,a,o){or=ji=null,pf(n),ds=null,ga=0;var u=n.return;try{if(Fx(e,u,n,a,Be)){ct=1,fl(e,_n(a,e.current)),De=null;return}}catch(h){if(u!==null)throw De=u,h;ct=1,fl(e,_n(a,e.current)),De=null;return}n.flags&32768?(ze||o===1?e=!0:xs||(Be&536870912)!==0?e=!1:(Gr=e=!0,(o===2||o===9||o===3||o===6)&&(o=en.current,o!==null&&o.tag===13&&(o.flags|=16384))),Pp(n,e)):El(n)}function El(e){var n=e;do{if((n.flags&32768)!==0){Pp(n,Gr);return}e=n.return;var a=Xx(n.alternate,n,yr);if(a!==null){De=a;return}if(n=n.sibling,n!==null){De=n;return}De=n=e}while(n!==null);ct===0&&(ct=5)}function Pp(e,n){do{var a=Kx(e.alternate,e);if(a!==null){a.flags&=32767,De=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!n&&(e=e.sibling,e!==null)){De=e;return}De=e=a}while(e!==null);ct=6,De=null}function Ip(e,n,a,o,u,h,x,E,R){e.cancelPendingCommit=null;do Ol();while(St!==0);if((Ge&6)!==0)throw Error(s(327));if(n!==null){if(n===e.current)throw Error(s(177));if(h=n.lanes|n.childLanes,h|=Iu,kr(e,a,h,x,E,R),e===Ze&&(De=Ze=null,Be=0),ws=n,Yr=e,br=a,Jf=h,Qf=u,kp=o,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,o_(Yi,function(){return Vp(),null})):(e.callbackNode=null,e.callbackPriority=0),o=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||o){o=Y.T,Y.T=null,u=oe.p,oe.p=2,x=Ge,Ge|=4;try{Jx(e,n,a)}finally{Ge=x,oe.p=u,Y.T=o}}St=1,$p(),Hp(),Gp()}}function $p(){if(St===1){St=0;var e=Yr,n=ws,a=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||a){a=Y.T,Y.T=null;var o=oe.p;oe.p=2;var u=Ge;Ge|=4;try{wp(n,e);var h=hh,x=Tm(e.containerInfo),E=h.focusedElem,R=h.selectionRange;if(x!==E&&E&&E.ownerDocument&&jm(E.ownerDocument.documentElement,E)){if(R!==null&&Bu(E)){var H=R.start,J=R.end;if(J===void 0&&(J=H),"selectionStart"in E)E.selectionStart=H,E.selectionEnd=Math.min(J,E.value.length);else{var ne=E.ownerDocument||document,F=ne&&ne.defaultView||window;if(F.getSelection){var X=F.getSelection(),ge=E.textContent.length,Ee=Math.min(R.start,ge),Je=R.end===void 0?Ee:Math.min(R.end,ge);!X.extend&&Ee>Je&&(x=Je,Je=Ee,Ee=x);var U=Am(E,Ee),q=Am(E,Je);if(U&&q&&(X.rangeCount!==1||X.anchorNode!==U.node||X.anchorOffset!==U.offset||X.focusNode!==q.node||X.focusOffset!==q.offset)){var $=ne.createRange();$.setStart(U.node,U.offset),X.removeAllRanges(),Ee>Je?(X.addRange($),X.extend(q.node,q.offset)):($.setEnd(q.node,q.offset),X.addRange($))}}}}for(ne=[],X=E;X=X.parentNode;)X.nodeType===1&&ne.push({element:X,left:X.scrollLeft,top:X.scrollTop});for(typeof E.focus=="function"&&E.focus(),E=0;E<ne.length;E++){var Z=ne[E];Z.element.scrollLeft=Z.left,Z.element.scrollTop=Z.top}}Ll=!!fh,hh=fh=null}finally{Ge=u,oe.p=o,Y.T=a}}e.current=n,St=2}}function Hp(){if(St===2){St=0;var e=Yr,n=ws,a=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||a){a=Y.T,Y.T=null;var o=oe.p;oe.p=2;var u=Ge;Ge|=4;try{yp(e,n.alternate,n)}finally{Ge=u,oe.p=o,Y.T=a}}St=3}}function Gp(){if(St===4||St===3){St=0,Vi();var e=Yr,n=ws,a=br,o=kp;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?St=5:(St=0,ws=Yr=null,Fp(e,e.pendingLanes));var u=e.pendingLanes;if(u===0&&(Vr=null),vi(a),n=n.stateNode,ft&&typeof ft.onCommitFiberRoot=="function")try{ft.onCommitFiberRoot(pi,n,void 0,(n.current.flags&128)===128)}catch{}if(o!==null){n=Y.T,u=oe.p,oe.p=2,Y.T=null;try{for(var h=e.onRecoverableError,x=0;x<o.length;x++){var E=o[x];h(E.value,{componentStack:E.stack})}}finally{Y.T=n,oe.p=u}}(br&3)!==0&&Ol(),Yn(e),u=e.pendingLanes,(a&261930)!==0&&(u&42)!==0?e===Zf?Ra++:(Ra=0,Zf=e):Ra=0,Da(0)}}function Fp(e,n){(e.pooledCacheLanes&=n)===0&&(n=e.pooledCache,n!=null&&(e.pooledCache=null,ma(n)))}function Ol(){return $p(),Hp(),Gp(),Vp()}function Vp(){if(St!==5)return!1;var e=Yr,n=Jf;Jf=0;var a=vi(br),o=Y.T,u=oe.p;try{oe.p=32>a?32:a,Y.T=null,a=Qf,Qf=null;var h=Yr,x=br;if(St=0,ws=Yr=null,br=0,(Ge&6)!==0)throw Error(s(331));var E=Ge;if(Ge|=4,jp(h.current),Ep(h,h.current,x,a),Ge=E,Da(0,!1),ft&&typeof ft.onPostCommitFiberRoot=="function")try{ft.onPostCommitFiberRoot(pi,h)}catch{}return!0}finally{oe.p=u,Y.T=o,Fp(e,n)}}function Yp(e,n,a){n=_n(a,n),n=kf(e.stateNode,n,2),e=Pr(e,n,2),e!==null&&(Rn(e,2),Yn(e))}function Ve(e,n,a){if(e.tag===3)Yp(e,e,a);else for(;n!==null;){if(n.tag===3){Yp(n,e,a);break}else if(n.tag===1){var o=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(Vr===null||!Vr.has(o))){e=_n(a,e),a=X0(2),o=Pr(n,a,2),o!==null&&(K0(a,o,n,e),Rn(o,2),Yn(o));break}}n=n.return}}function th(e,n,a){var o=e.pingCache;if(o===null){o=e.pingCache=new Wx;var u=new Set;o.set(n,u)}else u=o.get(n),u===void 0&&(u=new Set,o.set(n,u));u.has(a)||(Yf=!0,u.add(a),e=i_.bind(null,e,n,a),n.then(e,e))}function i_(e,n,a){var o=e.pingCache;o!==null&&o.delete(n),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,Ze===e&&(Be&a)===a&&(ct===4||ct===3&&(Be&62914560)===Be&&300>nt()-vl?(Ge&2)===0&&Ss(e,0):Xf|=a,_s===Be&&(_s=0)),Yn(e)}function Xp(e,n){n===0&&(n=Ki()),e=Ei(e,n),e!==null&&(Rn(e,n),Yn(e))}function s_(e){var n=e.memoizedState,a=0;n!==null&&(a=n.retryLane),Xp(e,a)}function a_(e,n){var a=0;switch(e.tag){case 31:case 13:var o=e.stateNode,u=e.memoizedState;u!==null&&(a=u.retryLane);break;case 19:o=e.stateNode;break;case 22:o=e.stateNode._retryCache;break;default:throw Error(s(314))}o!==null&&o.delete(n),Xp(e,a)}function o_(e,n){return Qs(e,n)}var Al=null,Os=null,nh=!1,jl=!1,rh=!1,Kr=0;function Yn(e){e!==Os&&e.next===null&&(Os===null?Al=Os=e:Os=Os.next=e),jl=!0,nh||(nh=!0,c_())}function Da(e,n){if(!rh&&jl){rh=!0;do for(var a=!1,o=Al;o!==null;){if(e!==0){var u=o.pendingLanes;if(u===0)var h=0;else{var x=o.suspendedLanes,E=o.pingedLanes;h=(1<<31-Bt(42|e)+1)-1,h&=u&~(x&~E),h=h&201326741?h&201326741|1:h?h|2:0}h!==0&&(a=!0,Zp(o,h))}else h=Be,h=gi(o,o===Ze?h:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(h&3)===0||yi(o,h)||(a=!0,Zp(o,h));o=o.next}while(a);rh=!1}}function l_(){Kp()}function Kp(){jl=nh=!1;var e=0;Kr!==0&&v_()&&(e=Kr);for(var n=nt(),a=null,o=Al;o!==null;){var u=o.next,h=Jp(o,n);h===0?(o.next=null,a===null?Al=u:a.next=u,u===null&&(Os=a)):(a=o,(e!==0||(h&3)!==0)&&(jl=!0)),o=u}St!==0&&St!==5||Da(e),Kr!==0&&(Kr=0)}function Jp(e,n){for(var a=e.suspendedLanes,o=e.pingedLanes,u=e.expirationTimes,h=e.pendingLanes&-62914561;0<h;){var x=31-Bt(h),E=1<<x,R=u[x];R===-1?((E&a)===0||(E&o)!==0)&&(u[x]=ea(E,n)):R<=n&&(e.expiredLanes|=E),h&=~E}if(n=Ze,a=Be,a=gi(e,e===n?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),o=e.callbackNode,a===0||e===n&&(Fe===2||Fe===9)||e.cancelPendingCommit!==null)return o!==null&&o!==null&&Wn(o),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||yi(e,a)){if(n=a&-a,n===e.callbackPriority)return n;switch(o!==null&&Wn(o),vi(a)){case 2:case 8:a=To;break;case 32:a=Yi;break;case 268435456:a=No;break;default:a=Yi}return o=Qp.bind(null,e),a=Qs(a,o),e.callbackPriority=n,e.callbackNode=a,n}return o!==null&&o!==null&&Wn(o),e.callbackPriority=2,e.callbackNode=null,2}function Qp(e,n){if(St!==0&&St!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(Ol()&&e.callbackNode!==a)return null;var o=Be;return o=gi(e,e===Ze?o:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),o===0?null:(Mp(e,o,n),Jp(e,nt()),e.callbackNode!=null&&e.callbackNode===a?Qp.bind(null,e):null)}function Zp(e,n){if(Ol())return null;Mp(e,n,!0)}function c_(){__(function(){(Ge&6)!==0?Qs(jo,l_):Kp()})}function ih(){if(Kr===0){var e=us;e===0&&(e=jr,jr<<=1,(jr&261888)===0&&(jr=256)),Kr=e}return Kr}function Wp(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:qo(""+e)}function eg(e,n){var a=n.ownerDocument.createElement("input");return a.name=n.name,a.value=n.value,e.id&&a.setAttribute("form",e.id),n.parentNode.insertBefore(a,n),e=new FormData(e),a.parentNode.removeChild(a),e}function u_(e,n,a,o,u){if(n==="submit"&&a&&a.stateNode===u){var h=Wp((u[ot]||null).action),x=o.submitter;x&&(n=(n=x[ot]||null)?Wp(n.formAction):x.getAttribute("formAction"),n!==null&&(h=n,x=null));var E=new Uo("action","action",null,o,u);e.push({event:E,listeners:[{instance:null,listener:function(){if(o.defaultPrevented){if(Kr!==0){var R=x?eg(u,x):new FormData(u);Ef(a,{pending:!0,data:R,method:u.method,action:h},null,R)}}else typeof h=="function"&&(E.preventDefault(),R=x?eg(u,x):new FormData(u),Ef(a,{pending:!0,data:R,method:u.method,action:h},h,R))},currentTarget:u}]})}}for(var sh=0;sh<Pu.length;sh++){var ah=Pu[sh],f_=ah.toLowerCase(),h_=ah[0].toUpperCase()+ah.slice(1);qn(f_,"on"+h_)}qn(Cm,"onAnimationEnd"),qn(Mm,"onAnimationIteration"),qn(Rm,"onAnimationStart"),qn("dblclick","onDoubleClick"),qn("focusin","onFocus"),qn("focusout","onBlur"),qn(Tx,"onTransitionRun"),qn(Nx,"onTransitionStart"),qn(kx,"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(" "),d_=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(qa));function tg(e,n){n=(n&4)!==0;for(var a=0;a<e.length;a++){var o=e[a],u=o.event;o=o.listeners;e:{var h=void 0;if(n)for(var x=o.length-1;0<=x;x--){var E=o[x],R=E.instance,H=E.currentTarget;if(E=E.listener,R!==h&&u.isPropagationStopped())break e;h=E,u.currentTarget=H;try{h(u)}catch(J){$o(J)}u.currentTarget=null,h=R}else for(x=0;x<o.length;x++){if(E=o[x],R=E.instance,H=E.currentTarget,E=E.listener,R!==h&&u.isPropagationStopped())break e;h=E,u.currentTarget=H;try{h(u)}catch(J){$o(J)}u.currentTarget=null,h=R}}}}function qe(e,n){var a=n[xi];a===void 0&&(a=n[xi]=new Set);var o=e+"__bubble";a.has(o)||(ng(n,e,2,!1),a.add(o))}function oh(e,n,a){var o=0;n&&(o|=4),ng(a,e,o,n)}var Tl="_reactListening"+Math.random().toString(36).slice(2);function lh(e){if(!e[Tl]){e[Tl]=!0,P.forEach(function(a){a!=="selectionchange"&&(d_.has(a)||oh(a,!1,e),oh(a,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[Tl]||(n[Tl]=!0,oh("selectionchange",!1,n))}}function ng(e,n,a,o){switch(Cg(n)){case 2:var u=I_;break;case 8:u=$_;break;default:u=Sh}a=u.bind(null,n,a,e),u=void 0,!ju||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(u=!0),o?u!==void 0?e.addEventListener(n,a,{capture:!0,passive:u}):e.addEventListener(n,a,!0):u!==void 0?e.addEventListener(n,a,{passive:u}):e.addEventListener(n,a,!1)}function ch(e,n,a,o,u){var h=o;if((n&1)===0&&(n&2)===0&&o!==null)e:for(;;){if(o===null)return;var x=o.tag;if(x===3||x===4){var E=o.stateNode.containerInfo;if(E===u)break;if(x===4)for(x=o.return;x!==null;){var R=x.tag;if((R===3||R===4)&&x.stateNode.containerInfo===u)return;x=x.return}for(;E!==null;){if(x=O(E),x===null)return;if(R=x.tag,R===5||R===6||R===26||R===27){o=h=x;continue e}E=E.parentNode}}o=o.return}om(function(){var H=h,J=Ou(a),ne=[];e:{var F=qm.get(e);if(F!==void 0){var X=Uo,ge=e;switch(e){case"keypress":if(Lo(a)===0)break e;case"keydown":case"keyup":X=ax;break;case"focusin":ge="focus",X=Cu;break;case"focusout":ge="blur",X=Cu;break;case"beforeblur":case"afterblur":X=Cu;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":X=um;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":X=Xv;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":X=cx;break;case Cm:case Mm:case Rm:X=Qv;break;case Dm:X=fx;break;case"scroll":case"scrollend":X=Vv;break;case"wheel":X=dx;break;case"copy":case"cut":case"paste":X=Wv;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":X=hm;break;case"toggle":case"beforetoggle":X=px}var Ee=(n&4)!==0,Je=!Ee&&(e==="scroll"||e==="scrollend"),U=Ee?F!==null?F+"Capture":null:F;Ee=[];for(var q=H,$;q!==null;){var Z=q;if($=Z.stateNode,Z=Z.tag,Z!==5&&Z!==26&&Z!==27||$===null||U===null||(Z=ra(q,U),Z!=null&&Ee.push(Ba(q,Z,$))),Je)break;q=q.return}0<Ee.length&&(F=new X(F,ge,null,a,J),ne.push({event:F,listeners:Ee}))}}if((n&7)===0){e:{if(F=e==="mouseover"||e==="pointerover",X=e==="mouseout"||e==="pointerout",F&&a!==Eu&&(ge=a.relatedTarget||a.fromElement)&&(O(ge)||ge[Qt]))break e;if((X||F)&&(F=J.window===J?J:(F=J.ownerDocument)?F.defaultView||F.parentWindow:window,X?(ge=a.relatedTarget||a.toElement,X=H,ge=ge?O(ge):null,ge!==null&&(Je=c(ge),Ee=ge.tag,ge!==Je||Ee!==5&&Ee!==27&&Ee!==6)&&(ge=null)):(X=null,ge=H),X!==ge)){if(Ee=um,Z="onMouseLeave",U="onMouseEnter",q="mouse",(e==="pointerout"||e==="pointerover")&&(Ee=hm,Z="onPointerLeave",U="onPointerEnter",q="pointer"),Je=X==null?F:T(X),$=ge==null?F:T(ge),F=new Ee(Z,q+"leave",X,a,J),F.target=Je,F.relatedTarget=$,Z=null,O(J)===H&&(Ee=new Ee(U,q+"enter",ge,a,J),Ee.target=$,Ee.relatedTarget=Je,Z=Ee),Je=Z,X&&ge)t:{for(Ee=m_,U=X,q=ge,$=0,Z=U;Z;Z=Ee(Z))$++;Z=0;for(var xe=q;xe;xe=Ee(xe))Z++;for(;0<$-Z;)U=Ee(U),$--;for(;0<Z-$;)q=Ee(q),Z--;for(;$--;){if(U===q||q!==null&&U===q.alternate){Ee=U;break t}U=Ee(U),q=Ee(q)}Ee=null}else Ee=null;X!==null&&rg(ne,F,X,Ee,!1),ge!==null&&Je!==null&&rg(ne,Je,ge,Ee,!0)}}e:{if(F=H?T(H):window,X=F.nodeName&&F.nodeName.toLowerCase(),X==="select"||X==="input"&&F.type==="file")var $e=xm;else if(bm(F))if(_m)$e=Ox;else{$e=Sx;var ye=wx}else X=F.nodeName,!X||X.toLowerCase()!=="input"||F.type!=="checkbox"&&F.type!=="radio"?H&&Su(H.elementType)&&($e=xm):$e=Ex;if($e&&($e=$e(e,H))){vm(ne,$e,a,J);break e}ye&&ye(e,F,H),e==="focusout"&&H&&F.type==="number"&&H.memoizedProps.value!=null&&wu(F,"number",F.value)}switch(ye=H?T(H):window,e){case"focusin":(bm(ye)||ye.contentEditable==="true")&&(ns=ye,Lu=H,fa=null);break;case"focusout":fa=Lu=ns=null;break;case"mousedown":zu=!0;break;case"contextmenu":case"mouseup":case"dragend":zu=!1,Nm(ne,a,J);break;case"selectionchange":if(jx)break;case"keydown":case"keyup":Nm(ne,a,J)}var Me;if(Ru)e:{switch(e){case"compositionstart":var Le="onCompositionStart";break e;case"compositionend":Le="onCompositionEnd";break e;case"compositionupdate":Le="onCompositionUpdate";break e}Le=void 0}else ts?gm(e,a)&&(Le="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(Le="onCompositionStart");Le&&(dm&&a.locale!=="ko"&&(ts||Le!=="onCompositionStart"?Le==="onCompositionEnd"&&ts&&(Me=lm()):(Rr=J,Tu="value"in Rr?Rr.value:Rr.textContent,ts=!0)),ye=Nl(H,Le),0<ye.length&&(Le=new fm(Le,e,null,a,J),ne.push({event:Le,listeners:ye}),Me?Le.data=Me:(Me=ym(a),Me!==null&&(Le.data=Me)))),(Me=yx?bx(e,a):vx(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)),u_(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 m_(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 p_=/\r\n?/g,g_=/\u0000|\uFFFD/g;function ig(e){return(typeof e=="string"?e:""+e).replace(p_,`
26
- `).replace(g_,"")}function sg(e,n){return n=ig(n),ig(e)===n}function Ke(e,n,a,o,u,h){switch(a){case"children":typeof o=="string"?n==="body"||n==="textarea"&&o===""||Zi(e,o):(typeof o=="number"||typeof o=="bigint")&&n!=="body"&&Zi(e,""+o);break;case"className":Dn(e,"class",o);break;case"tabIndex":Dn(e,"tabindex",o);break;case"dir":case"role":case"viewBox":case"width":case"height":Dn(e,a,o);break;case"style":sm(e,o,h);break;case"data":if(n!=="object"){Dn(e,"data",o);break}case"src":case"href":if(o===""&&(n!=="a"||a!=="href")){e.removeAttribute(a);break}if(o==null||typeof o=="function"||typeof o=="symbol"||typeof o=="boolean"){e.removeAttribute(a);break}o=qo(""+o),e.setAttribute(a,o);break;case"action":case"formAction":if(typeof o=="function"){e.setAttribute(a,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof h=="function"&&(a==="formAction"?(n!=="input"&&Ke(e,n,"name",u.name,u,null),Ke(e,n,"formEncType",u.formEncType,u,null),Ke(e,n,"formMethod",u.formMethod,u,null),Ke(e,n,"formTarget",u.formTarget,u,null)):(Ke(e,n,"encType",u.encType,u,null),Ke(e,n,"method",u.method,u,null),Ke(e,n,"target",u.target,u,null)));if(o==null||typeof o=="symbol"||typeof o=="boolean"){e.removeAttribute(a);break}o=qo(""+o),e.setAttribute(a,o);break;case"onClick":o!=null&&(e.onclick=rr);break;case"onScroll":o!=null&&qe("scroll",e);break;case"onScrollEnd":o!=null&&qe("scrollend",e);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(s(61));if(a=o.__html,a!=null){if(u.children!=null)throw Error(s(60));e.innerHTML=a}}break;case"multiple":e.multiple=o&&typeof o!="function"&&typeof o!="symbol";break;case"muted":e.muted=o&&typeof o!="function"&&typeof o!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(o==null||typeof o=="function"||typeof o=="boolean"||typeof o=="symbol"){e.removeAttribute("xlink:href");break}a=qo(""+o),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":o!=null&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(a,""+o):e.removeAttribute(a);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":o&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(a,""):e.removeAttribute(a);break;case"capture":case"download":o===!0?e.setAttribute(a,""):o!==!1&&o!=null&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(a,o):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":o!=null&&typeof o!="function"&&typeof o!="symbol"&&!isNaN(o)&&1<=o?e.setAttribute(a,o):e.removeAttribute(a);break;case"rowSpan":case"start":o==null||typeof o=="function"||typeof o=="symbol"||isNaN(o)?e.removeAttribute(a):e.setAttribute(a,o);break;case"popover":qe("beforetoggle",e),qe("toggle",e),Lt(e,"popover",o);break;case"xlinkActuate":nr(e,"http://www.w3.org/1999/xlink","xlink:actuate",o);break;case"xlinkArcrole":nr(e,"http://www.w3.org/1999/xlink","xlink:arcrole",o);break;case"xlinkRole":nr(e,"http://www.w3.org/1999/xlink","xlink:role",o);break;case"xlinkShow":nr(e,"http://www.w3.org/1999/xlink","xlink:show",o);break;case"xlinkTitle":nr(e,"http://www.w3.org/1999/xlink","xlink:title",o);break;case"xlinkType":nr(e,"http://www.w3.org/1999/xlink","xlink:type",o);break;case"xmlBase":nr(e,"http://www.w3.org/XML/1998/namespace","xml:base",o);break;case"xmlLang":nr(e,"http://www.w3.org/XML/1998/namespace","xml:lang",o);break;case"xmlSpace":nr(e,"http://www.w3.org/XML/1998/namespace","xml:space",o);break;case"is":Lt(e,"is",o);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=Gv.get(a)||a,Lt(e,a,o))}}function uh(e,n,a,o,u,h){switch(a){case"style":sm(e,o,h);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(s(61));if(a=o.__html,a!=null){if(u.children!=null)throw Error(s(60));e.innerHTML=a}}break;case"children":typeof o=="string"?Zi(e,o):(typeof o=="number"||typeof o=="bigint")&&Zi(e,""+o);break;case"onScroll":o!=null&&qe("scroll",e);break;case"onScrollEnd":o!=null&&qe("scrollend",e);break;case"onClick":o!=null&&(e.onclick=rr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!te.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(u=a.endsWith("Capture"),n=a.slice(2,u?a.length-7:void 0),h=e[ot]||null,h=h!=null?h[a]:null,typeof h=="function"&&e.removeEventListener(n,h,u),typeof o=="function")){typeof h!="function"&&h!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(n,o,u);break e}a in e?e[a]=o:o===!0?e.setAttribute(a,""):Lt(e,a,o)}}}function Ct(e,n,a){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":qe("error",e),qe("load",e);var o=!1,u=!1,h;for(h in a)if(a.hasOwnProperty(h)){var x=a[h];if(x!=null)switch(h){case"src":o=!0;break;case"srcSet":u=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,n));default:Ke(e,n,h,x,a,null)}}u&&Ke(e,n,"srcSet",a.srcSet,a,null),o&&Ke(e,n,"src",a.src,a,null);return;case"input":qe("invalid",e);var E=h=x=u=null,R=null,H=null;for(o in a)if(a.hasOwnProperty(o)){var J=a[o];if(J!=null)switch(o){case"name":u=J;break;case"type":x=J;break;case"checked":R=J;break;case"defaultChecked":H=J;break;case"value":h=J;break;case"defaultValue":E=J;break;case"children":case"dangerouslySetInnerHTML":if(J!=null)throw Error(s(137,n));break;default:Ke(e,n,o,J,a,null)}}tm(e,h,E,R,H,x,u,!1);return;case"select":qe("invalid",e),o=x=h=null;for(u in a)if(a.hasOwnProperty(u)&&(E=a[u],E!=null))switch(u){case"value":h=E;break;case"defaultValue":x=E;break;case"multiple":o=E;default:Ke(e,n,u,E,a,null)}n=h,a=x,e.multiple=!!o,n!=null?Qi(e,!!o,n,!1):a!=null&&Qi(e,!!o,a,!0);return;case"textarea":qe("invalid",e),h=u=o=null;for(x in a)if(a.hasOwnProperty(x)&&(E=a[x],E!=null))switch(x){case"value":o=E;break;case"defaultValue":u=E;break;case"children":h=E;break;case"dangerouslySetInnerHTML":if(E!=null)throw Error(s(91));break;default:Ke(e,n,x,E,a,null)}rm(e,o,u,h);return;case"option":for(R in a)if(a.hasOwnProperty(R)&&(o=a[R],o!=null))switch(R){case"selected":e.selected=o&&typeof o!="function"&&typeof o!="symbol";break;default:Ke(e,n,R,o,a,null)}return;case"dialog":qe("beforetoggle",e),qe("toggle",e),qe("cancel",e),qe("close",e);break;case"iframe":case"object":qe("load",e);break;case"video":case"audio":for(o=0;o<qa.length;o++)qe(qa[o],e);break;case"image":qe("error",e),qe("load",e);break;case"details":qe("toggle",e);break;case"embed":case"source":case"link":qe("error",e),qe("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(H in a)if(a.hasOwnProperty(H)&&(o=a[H],o!=null))switch(H){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,n));default:Ke(e,n,H,o,a,null)}return;default:if(Su(n)){for(J in a)a.hasOwnProperty(J)&&(o=a[J],o!==void 0&&uh(e,n,J,o,a,void 0));return}}for(E in a)a.hasOwnProperty(E)&&(o=a[E],o!=null&&Ke(e,n,E,o,a,null))}function y_(e,n,a,o){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var u=null,h=null,x=null,E=null,R=null,H=null,J=null;for(X in a){var ne=a[X];if(a.hasOwnProperty(X)&&ne!=null)switch(X){case"checked":break;case"value":break;case"defaultValue":R=ne;default:o.hasOwnProperty(X)||Ke(e,n,X,null,o,ne)}}for(var F in o){var X=o[F];if(ne=a[F],o.hasOwnProperty(F)&&(X!=null||ne!=null))switch(F){case"type":h=X;break;case"name":u=X;break;case"checked":H=X;break;case"defaultChecked":J=X;break;case"value":x=X;break;case"defaultValue":E=X;break;case"children":case"dangerouslySetInnerHTML":if(X!=null)throw Error(s(137,n));break;default:X!==ne&&Ke(e,n,F,X,o,ne)}}_u(e,x,E,R,H,J,h,u);return;case"select":X=x=E=F=null;for(h in a)if(R=a[h],a.hasOwnProperty(h)&&R!=null)switch(h){case"value":break;case"multiple":X=R;default:o.hasOwnProperty(h)||Ke(e,n,h,null,o,R)}for(u in o)if(h=o[u],R=a[u],o.hasOwnProperty(u)&&(h!=null||R!=null))switch(u){case"value":F=h;break;case"defaultValue":E=h;break;case"multiple":x=h;default:h!==R&&Ke(e,n,u,h,o,R)}n=E,a=x,o=X,F!=null?Qi(e,!!a,F,!1):!!o!=!!a&&(n!=null?Qi(e,!!a,n,!0):Qi(e,!!a,a?[]:"",!1));return;case"textarea":X=F=null;for(E in a)if(u=a[E],a.hasOwnProperty(E)&&u!=null&&!o.hasOwnProperty(E))switch(E){case"value":break;case"children":break;default:Ke(e,n,E,null,o,u)}for(x in o)if(u=o[x],h=a[x],o.hasOwnProperty(x)&&(u!=null||h!=null))switch(x){case"value":F=u;break;case"defaultValue":X=u;break;case"children":break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(s(91));break;default:u!==h&&Ke(e,n,x,u,o,h)}nm(e,F,X);return;case"option":for(var ge in a)if(F=a[ge],a.hasOwnProperty(ge)&&F!=null&&!o.hasOwnProperty(ge))switch(ge){case"selected":e.selected=!1;break;default:Ke(e,n,ge,null,o,F)}for(R in o)if(F=o[R],X=a[R],o.hasOwnProperty(R)&&F!==X&&(F!=null||X!=null))switch(R){case"selected":e.selected=F&&typeof F!="function"&&typeof F!="symbol";break;default:Ke(e,n,R,F,o,X)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ee in a)F=a[Ee],a.hasOwnProperty(Ee)&&F!=null&&!o.hasOwnProperty(Ee)&&Ke(e,n,Ee,null,o,F);for(H in o)if(F=o[H],X=a[H],o.hasOwnProperty(H)&&F!==X&&(F!=null||X!=null))switch(H){case"children":case"dangerouslySetInnerHTML":if(F!=null)throw Error(s(137,n));break;default:Ke(e,n,H,F,o,X)}return;default:if(Su(n)){for(var Je in a)F=a[Je],a.hasOwnProperty(Je)&&F!==void 0&&!o.hasOwnProperty(Je)&&uh(e,n,Je,void 0,o,F);for(J in o)F=o[J],X=a[J],!o.hasOwnProperty(J)||F===X||F===void 0&&X===void 0||uh(e,n,J,F,o,X);return}}for(var U in a)F=a[U],a.hasOwnProperty(U)&&F!=null&&!o.hasOwnProperty(U)&&Ke(e,n,U,null,o,F);for(ne in o)F=o[ne],X=a[ne],!o.hasOwnProperty(ne)||F===X||F==null&&X==null||Ke(e,n,ne,F,o,X)}function ag(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function b_(){if(typeof performance.getEntriesByType=="function"){for(var e=0,n=0,a=performance.getEntriesByType("resource"),o=0;o<a.length;o++){var u=a[o],h=u.transferSize,x=u.initiatorType,E=u.duration;if(h&&E&&ag(x)){for(x=0,E=u.responseEnd,o+=1;o<a.length;o++){var R=a[o],H=R.startTime;if(H>E)break;var J=R.transferSize,ne=R.initiatorType;J&&ag(ne)&&(R=R.responseEnd,x+=J*(R<E?1:(E-H)/(R-H)))}if(--o,n+=8*(h+x)/(u.duration/1e3),e++,10<e)break}}if(0<e)return n/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var fh=null,hh=null;function kl(e){return e.nodeType===9?e:e.ownerDocument}function og(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function lg(e,n){if(e===0)switch(n){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&n==="foreignObject"?0:e}function dh(e,n){return e==="textarea"||e==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.children=="bigint"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var mh=null;function v_(){var e=window.event;return e&&e.type==="popstate"?e===mh?!1:(mh=e,!0):(mh=null,!1)}var cg=typeof setTimeout=="function"?setTimeout:void 0,x_=typeof clearTimeout=="function"?clearTimeout:void 0,ug=typeof Promise=="function"?Promise:void 0,__=typeof queueMicrotask=="function"?queueMicrotask:typeof ug<"u"?function(e){return ug.resolve(null).then(e).catch(w_)}:cg;function w_(e){setTimeout(function(){throw e})}function Jr(e){return e==="head"}function fg(e,n){var a=n,o=0;do{var u=a.nextSibling;if(e.removeChild(a),u&&u.nodeType===8)if(a=u.data,a==="/$"||a==="/&"){if(o===0){e.removeChild(u),Ns(n);return}o--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")o++;else if(a==="html")La(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,La(a);for(var h=a.firstChild;h;){var x=h.nextSibling,E=h.nodeName;h[wt]||E==="SCRIPT"||E==="STYLE"||E==="LINK"&&h.rel.toLowerCase()==="stylesheet"||a.removeChild(h),h=x}}else a==="body"&&La(e.ownerDocument.body);a=u}while(a);Ns(n)}function hg(e,n){var a=e;e=0;do{var o=a.nextSibling;if(a.nodeType===1?n?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(n?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),o&&o.nodeType===8)if(a=o.data,a==="/$"){if(e===0)break;e--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||e++;a=o}while(a)}function ph(e){var n=e.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var a=n;switch(n=n.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":ph(a),Ji(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function S_(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 E_(e,n,a){if(n==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=An(e.nextSibling),e===null))return null;return e}function dg(e,n){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=An(e.nextSibling),e===null))return null;return e}function gh(e){return e.data==="$?"||e.data==="$~"}function yh(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function O_(e,n){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=n;else if(e.data!=="$?"||a.readyState!=="loading")n();else{var o=function(){n(),a.removeEventListener("DOMContentLoaded",o)};a.addEventListener("DOMContentLoaded",o),e._reactRetry=o}}function An(e){for(;e!=null;e=e.nextSibling){var n=e.nodeType;if(n===1||n===3)break;if(n===8){if(n=e.data,n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"||n==="F!"||n==="F")break;if(n==="/$"||n==="/&")return null}}return e}var bh=null;function mg(e){e=e.nextSibling;for(var n=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(n===0)return An(e.nextSibling);n--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||n++}e=e.nextSibling}return null}function pg(e){e=e.previousSibling;for(var n=0;e;){if(e.nodeType===8){var a=e.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(n===0)return e;n--}else a!=="/$"&&a!=="/&"||n++}e=e.previousSibling}return null}function gg(e,n,a){switch(n=kl(a),e){case"html":if(e=n.documentElement,!e)throw Error(s(452));return e;case"head":if(e=n.head,!e)throw Error(s(453));return e;case"body":if(e=n.body,!e)throw Error(s(454));return e;default:throw Error(s(451))}}function La(e){for(var n=e.attributes;n.length;)e.removeAttributeNode(n[0]);Ji(e)}var jn=new Map,yg=new Set;function Cl(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var vr=oe.d;oe.d={f:A_,r:j_,D:T_,C:N_,L:k_,m:C_,X:R_,S:M_,M:D_};function A_(){var e=vr.f(),n=wl();return e||n}function j_(e){var n=N(e);n!==null&&n.tag===5&&n.type==="form"?D0(n):vr.r(e)}var As=typeof document>"u"?null:document;function bg(e,n,a){var o=As;if(o&&typeof n=="string"&&n){var u=vn(n);u='link[rel="'+e+'"][href="'+u+'"]',typeof a=="string"&&(u+='[crossorigin="'+a+'"]'),yg.has(u)||(yg.add(u),e={rel:e,crossOrigin:a,href:n},o.querySelector(u)===null&&(n=o.createElement("link"),Ct(n,"link",e),D(n),o.head.appendChild(n)))}}function T_(e){vr.D(e),bg("dns-prefetch",e,null)}function N_(e,n){vr.C(e,n),bg("preconnect",e,n)}function k_(e,n,a){vr.L(e,n,a);var o=As;if(o&&e&&n){var u='link[rel="preload"][as="'+vn(n)+'"]';n==="image"&&a&&a.imageSrcSet?(u+='[imagesrcset="'+vn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(u+='[imagesizes="'+vn(a.imageSizes)+'"]')):u+='[href="'+vn(e)+'"]';var h=u;switch(n){case"style":h=js(e);break;case"script":h=Ts(e)}jn.has(h)||(e=b({rel:"preload",href:n==="image"&&a&&a.imageSrcSet?void 0:e,as:n},a),jn.set(h,e),o.querySelector(u)!==null||n==="style"&&o.querySelector(za(h))||n==="script"&&o.querySelector(Ua(h))||(n=o.createElement("link"),Ct(n,"link",e),D(n),o.head.appendChild(n)))}}function C_(e,n){vr.m(e,n);var a=As;if(a&&e){var o=n&&typeof n.as=="string"?n.as:"script",u='link[rel="modulepreload"][as="'+vn(o)+'"][href="'+vn(e)+'"]',h=u;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":h=Ts(e)}if(!jn.has(h)&&(e=b({rel:"modulepreload",href:e},n),jn.set(h,e),a.querySelector(u)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Ua(h)))return}o=a.createElement("link"),Ct(o,"link",e),D(o),a.head.appendChild(o)}}}function M_(e,n,a){vr.S(e,n,a);var o=As;if(o&&e){var u=k(o).hoistableStyles,h=js(e);n=n||"default";var x=u.get(h);if(!x){var E={loading:0,preload:null};if(x=o.querySelector(za(h)))E.loading=5;else{e=b({rel:"stylesheet",href:e,"data-precedence":n},a),(a=jn.get(h))&&vh(e,a);var R=x=o.createElement("link");D(R),Ct(R,"link",e),R._p=new Promise(function(H,J){R.onload=H,R.onerror=J}),R.addEventListener("load",function(){E.loading|=1}),R.addEventListener("error",function(){E.loading|=2}),E.loading|=4,Ml(x,n,o)}x={type:"stylesheet",instance:x,count:1,state:E},u.set(h,x)}}}function R_(e,n){vr.X(e,n);var a=As;if(a&&e){var o=k(a).hoistableScripts,u=Ts(e),h=o.get(u);h||(h=a.querySelector(Ua(u)),h||(e=b({src:e,async:!0},n),(n=jn.get(u))&&xh(e,n),h=a.createElement("script"),D(h),Ct(h,"link",e),a.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},o.set(u,h))}}function D_(e,n){vr.M(e,n);var a=As;if(a&&e){var o=k(a).hoistableScripts,u=Ts(e),h=o.get(u);h||(h=a.querySelector(Ua(u)),h||(e=b({src:e,async:!0,type:"module"},n),(n=jn.get(u))&&xh(e,n),h=a.createElement("script"),D(h),Ct(h,"link",e),a.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},o.set(u,h))}}function vg(e,n,a,o){var u=(u=Ht.current)?Cl(u):null;if(!u)throw Error(s(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(n=js(a.href),a=k(u).hoistableStyles,o=a.get(n),o||(o={type:"style",instance:null,count:0,state:null},a.set(n,o)),o):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=js(a.href);var h=k(u).hoistableStyles,x=h.get(e);if(x||(u=u.ownerDocument||u,x={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},h.set(e,x),(h=u.querySelector(za(e)))&&!h._p&&(x.instance=h,x.state.loading=5),jn.has(e)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},jn.set(e,a),h||q_(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 q_(e,n,a,o){e.querySelector('link[rel="preload"][as="style"]['+n+"]")?o.loading=1:(n=e.createElement("link"),o.preload=n,n.addEventListener("load",function(){return o.loading|=1}),n.addEventListener("error",function(){return o.loading|=2}),Ct(n,"link",a),D(n),e.head.appendChild(n))}function Ts(e){return'[src="'+vn(e)+'"]'}function Ua(e){return"script[async]"+e}function _g(e,n,a){if(n.count++,n.instance===null)switch(n.type){case"style":var o=e.querySelector('style[data-href~="'+vn(a.href)+'"]');if(o)return n.instance=o,D(o),o;var u=b({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return o=(e.ownerDocument||e).createElement("style"),D(o),Ct(o,"style",u),Ml(o,a.precedence,e),n.instance=o;case"stylesheet":u=js(a.href);var h=e.querySelector(za(u));if(h)return n.state.loading|=4,n.instance=h,D(h),h;o=xg(a),(u=jn.get(u))&&vh(o,u),h=(e.ownerDocument||e).createElement("link"),D(h);var x=h;return x._p=new Promise(function(E,R){x.onload=E,x.onerror=R}),Ct(h,"link",o),n.state.loading|=4,Ml(h,a.precedence,e),n.instance=h;case"script":return h=Ts(a.src),(u=e.querySelector(Ua(h)))?(n.instance=u,D(u),u):(o=a,(u=jn.get(h))&&(o=b({},a),xh(o,u)),e=e.ownerDocument||e,u=e.createElement("script"),D(u),Ct(u,"link",o),e.head.appendChild(u),n.instance=u);case"void":return null;default:throw Error(s(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(o=n.instance,n.state.loading|=4,Ml(o,a.precedence,e));return n.instance}function Ml(e,n,a){for(var o=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=o.length?o[o.length-1]:null,h=u,x=0;x<o.length;x++){var E=o[x];if(E.dataset.precedence===n)h=E;else if(h!==u)break}h?h.parentNode.insertBefore(e,h.nextSibling):(n=a.nodeType===9?a.head:a,n.insertBefore(e,n.firstChild))}function vh(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.title==null&&(e.title=n.title)}function xh(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.integrity==null&&(e.integrity=n.integrity)}var Rl=null;function wg(e,n,a){if(Rl===null){var o=new Map,u=Rl=new Map;u.set(a,o)}else u=Rl,o=u.get(a),o||(o=new Map,u.set(a,o));if(o.has(e))return o;for(o.set(e,null),a=a.getElementsByTagName(e),u=0;u<a.length;u++){var h=a[u];if(!(h[wt]||h[Qe]||e==="link"&&h.getAttribute("rel")==="stylesheet")&&h.namespaceURI!=="http://www.w3.org/2000/svg"){var x=h.getAttribute(n)||"";x=e+x;var E=o.get(x);E?E.push(h):o.set(x,[h])}}return o}function Sg(e,n,a){e=e.ownerDocument||e,e.head.insertBefore(a,n==="title"?e.querySelector("head > title"):null)}function B_(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 L_(e,n,a,o){if(a.type==="stylesheet"&&(typeof o.media!="string"||matchMedia(o.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var u=js(o.href),h=n.querySelector(za(u));if(h){n=h._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=Dl.bind(e),n.then(e,e)),a.state.loading|=4,a.instance=h,D(h);return}h=n.ownerDocument||n,o=xg(o),(u=jn.get(u))&&vh(o,u),h=h.createElement("link"),D(h);var x=h;x._p=new Promise(function(E,R){x.onload=E,x.onerror=R}),Ct(h,"link",o),a.instance=h}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,n),(n=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=Dl.bind(e),n.addEventListener("load",a),n.addEventListener("error",a))}}var _h=0;function z_(e,n){return e.stylesheets&&e.count===0&&Bl(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var o=setTimeout(function(){if(e.stylesheets&&Bl(e,e.stylesheets),e.unsuspend){var h=e.unsuspend;e.unsuspend=null,h()}},6e4+n);0<e.imgBytes&&_h===0&&(_h=62500*b_());var u=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Bl(e,e.stylesheets),e.unsuspend)){var h=e.unsuspend;e.unsuspend=null,h()}},(e.imgBytes>_h?50:800)+n);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(o),clearTimeout(u)}}:null}function Dl(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Bl(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var ql=null;function Bl(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ql=new Map,n.forEach(U_,e),ql=null,Dl.call(e))}function U_(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 P_(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 P_(e,n,a,x,R,H,J,ne,E),n=1,h===!0&&(n|=24),h=Wt(3,null,null,n),e.current=h,h.stateNode=e,n=Wu(),n.refCount++,e.pooledCache=n,n.refCount++,h.memoizedState={element:o,isDehydrated:a,cache:n},rf(h),e}function Ag(e){return e?(e=ss,e):ss}function jg(e,n,a,o,u,h){u=Ag(u),o.context===null?o.context=u:o.pendingContext=u,o=Ur(n),o.payload={element:a},h=h===void 0?null:h,h!==null&&(o.callback=h),a=Pr(e,o,n),a!==null&&(Kt(a,e,n),ba(a,e,n))}function Tg(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<n?a:n}}function wh(e,n){Tg(e,n),(e=e.alternate)&&Tg(e,n)}function Ng(e){if(e.tag===13||e.tag===31){var n=Ei(e,67108864);n!==null&&Kt(n,e,67108864),wh(e,67108864)}}function kg(e){if(e.tag===13||e.tag===31){var n=sn();n=tr(n);var a=Ei(e,n);a!==null&&Kt(a,e,n),wh(e,n)}}var Ll=!0;function I_(e,n,a,o){var u=Y.T;Y.T=null;var h=oe.p;try{oe.p=2,Sh(e,n,a,o)}finally{oe.p=h,Y.T=u}}function $_(e,n,a,o){var u=Y.T;Y.T=null;var h=oe.p;try{oe.p=8,Sh(e,n,a,o)}finally{oe.p=h,Y.T=u}}function Sh(e,n,a,o){if(Ll){var u=Eh(o);if(u===null)ch(e,n,o,zl,a),Mg(e,o);else if(G_(u,e,n,a,o))o.stopPropagation();else if(Mg(e,o),n&4&&-1<H_.indexOf(e)){for(;u!==null;){var h=N(u);if(h!==null)switch(h.tag){case 3:if(h=h.stateNode,h.current.memoizedState.isDehydrated){var x=Mn(h.pendingLanes);if(x!==0){var E=h;for(E.pendingLanes|=2,E.entangledLanes|=2;x;){var R=1<<31-Bt(x);E.entanglements[1]|=R,x&=~R}Yn(h),(Ge&6)===0&&(xl=nt()+500,Da(0))}}break;case 31:case 13:E=Ei(h,2),E!==null&&Kt(E,h,2),wl(),wh(h,2)}if(h=Eh(o),h===null&&ch(e,n,o,zl,a),h===u)break;u=h}u!==null&&o.stopPropagation()}else ch(e,n,o,null,a)}}function Eh(e){return e=Ou(e),Oh(e)}var zl=null;function Oh(e){if(zl=null,e=O(e),e!==null){var n=c(e);if(n===null)e=null;else{var a=n.tag;if(a===13){if(e=m(n),e!==null)return e;e=null}else if(a===31){if(e=p(n),e!==null)return e;e=null}else if(a===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;e=null}else n!==e&&(e=null)}}return zl=e,null}function Cg(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(yu()){case jo:return 2;case To:return 8;case Yi:case bu:return 32;case No:return 268435456;default:return 32}default:return 32}}var Ah=!1,Qr=null,Zr=null,Wr=null,Ia=new Map,$a=new Map,ei=[],H_="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 G_(e,n,a,o,u){switch(n){case"focusin":return Qr=Ha(Qr,e,n,a,o,u),!0;case"dragenter":return Zr=Ha(Zr,e,n,a,o,u),!0;case"mouseover":return Wr=Ha(Wr,e,n,a,o,u),!0;case"pointerover":var h=u.pointerId;return Ia.set(h,Ha(Ia.get(h)||null,e,n,a,o,u)),!0;case"gotpointercapture":return h=u.pointerId,$a.set(h,Ha($a.get(h)||null,e,n,a,o,u)),!0}return!1}function Rg(e){var n=O(e.target);if(n!==null){var a=c(n);if(a!==null){if(n=a.tag,n===13){if(n=m(a),n!==null){e.blockedOn=n,Co(e.priority,function(){kg(a)});return}}else if(n===31){if(n=p(a),n!==null){e.blockedOn=n,Co(e.priority,function(){kg(a)});return}}else if(n===3&&a.stateNode.current.memoizedState.isDehydrated){e.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Ul(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var a=Eh(e.nativeEvent);if(a===null){a=e.nativeEvent;var o=new a.constructor(a.type,a);Eu=o,a.target.dispatchEvent(o),Eu=null}else return n=N(a),n!==null&&Ng(n),e.blockedOn=a,!1;n.shift()}return!0}function Dg(e,n,a){Ul(e)&&a.delete(n)}function F_(){Ah=!1,Qr!==null&&Ul(Qr)&&(Qr=null),Zr!==null&&Ul(Zr)&&(Zr=null),Wr!==null&&Ul(Wr)&&(Wr=null),Ia.forEach(Dg),$a.forEach(Dg)}function Pl(e,n){e.blockedOn===n&&(e.blockedOn=null,Ah||(Ah=!0,i.unstable_scheduleCallback(i.unstable_NormalPriority,F_)))}var Il=null;function qg(e){Il!==e&&(Il=e,i.unstable_scheduleCallback(i.unstable_NormalPriority,function(){Il===e&&(Il=null);for(var n=0;n<e.length;n+=3){var a=e[n],o=e[n+1],u=e[n+2];if(typeof o!="function"){if(Oh(o||a)===null)continue;break}var h=N(a);h!==null&&(e.splice(n,3),n-=3,Ef(h,{pending:!0,data:u,method:a.method,action:o},o,u))}}))}function Ns(e){function n(R){return Pl(R,e)}Qr!==null&&Pl(Qr,e),Zr!==null&&Pl(Zr,e),Wr!==null&&Pl(Wr,e),Ia.forEach(n),$a.forEach(n);for(var a=0;a<ei.length;a++){var o=ei[a];o.blockedOn===e&&(o.blockedOn=null)}for(;0<ei.length&&(a=ei[0],a.blockedOn===null);)Rg(a),a.blockedOn===null&&ei.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(o=0;o<a.length;o+=3){var u=a[o],h=a[o+1],x=u[ot]||null;if(typeof h=="function")x||qg(a);else if(x){var E=null;if(h&&h.hasAttribute("formAction")){if(u=h,x=h[ot]||null)E=x.formAction;else if(Oh(u)!==null)continue}else E=x.action;typeof E=="function"?a[o+1]=E:(a.splice(o,3),o-=3),qg(a)}}}function Bg(){function e(h){h.canIntercept&&h.info==="react-transition"&&h.intercept({handler:function(){return new Promise(function(x){return u=x})},focusReset:"manual",scroll:"manual"})}function n(){u!==null&&(u(),u=null),o||setTimeout(a,20)}function a(){if(!o&&!navigation.transition){var h=navigation.currentEntry;h&&h.url!=null&&navigation.navigate(h.url,{state:h.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var o=!1,u=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(a,100),function(){o=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),u!==null&&(u(),u=null)}}}function jh(e){this._internalRoot=e}$l.prototype.render=jh.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(s(409));var a=n.current,o=sn();jg(a,o,e,n,null,null)},$l.prototype.unmount=jh.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;jg(e.current,2,null,e,null,null),wl(),n[Qt]=null}};function $l(e){this._internalRoot=e}$l.prototype.unstable_scheduleHydration=function(e){if(e){var n=ta();e={blockedOn:null,target:e,priority:n};for(var a=0;a<ei.length&&n!==0&&n<ei[a].priority;a++);ei.splice(a,0,e),a===0&&Rg(e)}};var Lg=t.version;if(Lg!=="19.2.4")throw Error(s(527,Lg,"19.2.4"));oe.findDOMNode=function(e){var n=e._reactInternals;if(n===void 0)throw typeof e.render=="function"?Error(s(188)):(e=Object.keys(e).join(","),Error(s(268,e)));return e=f(n),e=e!==null?d(e):null,e=e===null?null:e.stateNode,e};var V_={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(V_),ft=Hl}catch{}}return Ga.createRoot=function(e,n){if(!l(e))throw Error(s(299));var a=!1,o="",u=G0,h=F0,x=V0;return n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onUncaughtError!==void 0&&(u=n.onUncaughtError),n.onCaughtError!==void 0&&(h=n.onCaughtError),n.onRecoverableError!==void 0&&(x=n.onRecoverableError)),n=Og(e,1,!1,null,null,a,o,null,u,h,x,Bg),e[Qt]=n.current,lh(e),new jh(n)},Ga.hydrateRoot=function(e,n,a){if(!l(e))throw Error(s(299));var o=!1,u="",h=G0,x=F0,E=V0,R=null;return a!=null&&(a.unstable_strictMode===!0&&(o=!0),a.identifierPrefix!==void 0&&(u=a.identifierPrefix),a.onUncaughtError!==void 0&&(h=a.onUncaughtError),a.onCaughtError!==void 0&&(x=a.onCaughtError),a.onRecoverableError!==void 0&&(E=a.onRecoverableError),a.formState!==void 0&&(R=a.formState)),n=Og(e,1,!0,n,a??null,o,u,R,h,x,E,Bg),n.context=Ag(null),a=n.current,o=sn(),o=tr(o),u=Ur(o),u.callback=null,Pr(a,u,o),a=o,n.current.lanes=a,Rn(n,a),Yn(n),e[Qt]=n.current,lh(e),new $l(n)},Ga.version="19.2.4",Ga}var Fg;function qw(){if(Fg)return Th.exports;Fg=1;function i(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(t){console.error(t)}}return i(),Th.exports=Dw(),Th.exports}var Bw=qw();const Lw="modulepreload",zw=function(i,t){return new URL(i,t).href},Vg={},we=function(t,r,s){let l=Promise.resolve();if(r&&r.length>0){let m=function(d){return Promise.all(d.map(b=>Promise.resolve(b).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};const p=document.getElementsByTagName("link"),g=document.querySelector("meta[property=csp-nonce]"),f=(g==null?void 0:g.nonce)||(g==null?void 0:g.getAttribute("nonce"));l=m(r.map(d=>{if(d=zw(d,s),d in Vg)return;Vg[d]=!0;const b=d.endsWith(".css"),v=b?'[rel="stylesheet"]':"";if(!!s)for(let S=p.length-1;S>=0;S--){const M=p[S];if(M.href===d&&(!b||M.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${d}"]${v}`))return;const w=document.createElement("link");if(w.rel=b?"stylesheet":Lw,b||(w.as="script"),w.crossOrigin="",w.href=d,f&&w.setAttribute("nonce",f),document.head.appendChild(w),b)return new Promise((S,M)=>{w.addEventListener("load",S),w.addEventListener("error",()=>M(new Error(`Unable to preload CSS for ${d}`)))})}))}function c(m){const p=new Event("vite:preloadError",{cancelable:!0});if(p.payload=m,window.dispatchEvent(p),!p.defaultPrevented)throw m}return l.then(m=>{for(const p of m||[])p.status==="rejected"&&c(p.reason);return t().catch(c)})};function Sd(i){try{const t=i.split(".");if(t.length!==3)return null;const r=atob(t[1].replace(/-/g,"+").replace(/_/g,"/"));return JSON.parse(r)}catch{return null}}function fb(i){const t=Sd(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 Mt=window.__LT_BASE__??"",Kh=`${Mt}/api`;class Yg extends Error{constructor(t,r,s){super(t),this.status=r,this.body=s,this.name="ApiError"}}let si=null;function Gl(i){si=i}function hb(){return si}const Uw="X-LT-Acting-Token";let Uc=null,Pc=null;function Xg(i){Uc=i}function Kg(i){Pc=i}function Pw(i){const t=i==null?void 0:i.error;return typeof t=="string"&&/acting[- ]identity/i.test(t)}async function Jg(){const i=sessionStorage.getItem("lt_credentials");if(!i)return null;try{const{username:t,password:r}=JSON.parse(i),s=await fetch(`${Kh}/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:t,password:r})});if(!s.ok)return null;const l=await s.json();return l.token&&l.user&&sessionStorage.setItem("lt_user_info",JSON.stringify({displayName:l.user.display_name,username:l.user.external_id})),l.token??null}catch{return null}}let ni=null;async function Ae(i,t={}){const r={"Content-Type":"application/json",...t.headers};if(si){if(Ed(si)){ni||(ni=Jg().finally(()=>{ni=null}));const c=await ni;if(c)si=c,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:c}}));else throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}r.Authorization=`Bearer ${si}`}const s=(Uc==null?void 0:Uc())??null;s&&(r[Uw]=s);let l=await fetch(`${Kh}${i}`,{...t,headers:r});if(l.status===401&&s){const c=await l.clone().json().catch(()=>null);if(Pw(c))throw Pc==null||Pc(),new Yg(c.error,401,c)}if(l.status===401&&si){ni||(ni=Jg().finally(()=>{ni=null}));const c=await ni;if(c&&(si=c,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:c}})),r.Authorization=`Bearer ${c}`,l=await fetch(`${Kh}${i}`,{...t,headers:r})),l.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}else if(l.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired");if(!l.ok){const c=await l.json().catch(()=>({error:l.statusText}));throw new Yg(c.message||c.error||l.statusText,l.status,c)}return l.json()}const db=j.createContext(null),Iw=300;function Ch(i,t){if(Ed(i))return null;const r=Sd(i);if(!r)return null;const s=t??(()=>{try{const l=sessionStorage.getItem("lt_user_info");return l?JSON.parse(l):null}catch{return null}})();return{userId:r.userId,displayName:(s==null?void 0:s.displayName)??null,username:(s==null?void 0:s.username)??null,roles:r.roles??[]}}function $w({children:i}){const[t,r]=j.useState(()=>{const b=sessionStorage.getItem("lt_token");return b?Ed(b)?(sessionStorage.removeItem("lt_token"),null):(Gl(b),Ch(b)):null}),s=j.useRef(void 0),l=j.useCallback(b=>{clearTimeout(s.current);const v=fb(b);if(!v)return;const _=(v-Iw)*1e3-Date.now();_<=0||(s.current=setTimeout(async()=>{try{const w=Sd(b);if(w!=null&&w.sso){const ae=await fetch(`${Mt}/api/auth/sso`,{method:"POST"});if(!ae.ok)return;const C=await ae.json();C.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:C.token}}));return}const S=sessionStorage.getItem("lt_credentials");if(!S)return;const{username:M,password:L}=JSON.parse(S),z=await fetch(`${Mt}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:M,password:L})});if(!z.ok)return;const ie=await z.json();ie.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:ie.token}}))}catch{}},_))},[]),c=j.useCallback((b,v,_)=>{const w={displayName:(_==null?void 0:_.displayName)??null,username:(_==null?void 0:_.username)??(v==null?void 0:v.username)??null},S=Ch(b,w);S&&(Gl(b),sessionStorage.setItem("lt_token",b),sessionStorage.setItem("lt_user_info",JSON.stringify(w)),v&&sessionStorage.setItem("lt_credentials",JSON.stringify(v)),r(S),l(b))},[l]),m=j.useCallback(()=>{clearTimeout(s.current);const b=sessionStorage.getItem("lt_sso_logout_url");Gl(null),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info"),sessionStorage.removeItem("lt_sso_logout_url"),r(null),b&&(window.location.href=b)},[]);j.useEffect(()=>{const b=()=>m(),v=_=>{var M;const w=(M=_.detail)==null?void 0:M.token;if(!w)return;const S=Ch(w);S&&(Gl(w),sessionStorage.setItem("lt_token",w),r(S),l(w))};return window.addEventListener("auth:unauthorized",b),window.addEventListener("auth:refreshed",v),()=>{window.removeEventListener("auth:unauthorized",b),window.removeEventListener("auth:refreshed",v)}},[m,l]),j.useEffect(()=>{const b=sessionStorage.getItem("lt_token");return b&&t&&l(b),()=>clearTimeout(s.current)},[]);const p=(t==null?void 0:t.roles.some(b=>b.type==="superadmin"))??!1,g=j.useCallback(b=>(t==null?void 0:t.roles.some(v=>v.role===b))??!1,[t]),f=j.useCallback(b=>(t==null?void 0:t.roles.some(v=>v.type===b))??!1,[t]),d=(t==null?void 0:t.roles.map(b=>b.role))??[];return y.jsx(db.Provider,{value:{user:t,isAuthenticated:!!t,isSuperAdmin:p,login:c,logout:m,hasRole:g,hasRoleType:f,userRoleNames:d},children:i})}function pn(){const i=j.useContext(db);if(!i)throw new Error("useAuth must be used within AuthProvider");return i}const hn=new Uint8Array(0),Hi=new TextEncoder,un=new TextDecoder;function Hw(...i){let t=0;for(let l=0;l<i.length;l++)t+=i[l].length;const r=new Uint8Array(t);let s=0;for(let l=0;l<i.length;l++)r.set(i[l],s),s+=i[l].length;return r}function so(...i){const t=[];for(let r=0;r<i.length;r++)t.push(Hi.encode(i[r]));return t.length===0?hn:t.length===1?t[0]:Hw(...t)}function Qg(i){return!i||i.length===0?"":un.decode(i)}const Zg="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",Wg=36,Gw=0xcfd41b9100000,ey=33,Fw=333,ty=22;function Vw(i){for(let t=0;t<i.length;t++)i[t]=Math.floor(Math.random()*255)}function Yw(i){var t;(t=globalThis==null?void 0:globalThis.crypto)!=null&&t.getRandomValues?globalThis.crypto.getRandomValues(i):Vw(i)}class Xw{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()*Gw),this.inc=Math.floor(Math.random()*(Fw-ey)+ey)}setPre(){const t=new Uint8Array(12);Yw(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 Xw;var _r;(function(i){i.Disconnect="disconnect",i.Reconnect="reconnect",i.Update="update",i.LDM="ldm",i.Error="error"})(_r||(_r={}));var zs;(function(i){i.Reconnecting="reconnecting",i.PingTimer="pingTimer",i.StaleConnection="staleConnection",i.ClientInitiatedReconnect="client initiated reconnect"})(zs||(zs={}));var ce;(function(i){i.ApiError="BAD API",i.BadAuthentication="BAD_AUTHENTICATION",i.BadCreds="BAD_CREDS",i.BadHeader="BAD_HEADER",i.BadJson="BAD_JSON",i.BadPayload="BAD_PAYLOAD",i.BadSubject="BAD_SUBJECT",i.Cancelled="CANCELLED",i.ConnectionClosed="CONNECTION_CLOSED",i.ConnectionDraining="CONNECTION_DRAINING",i.ConnectionRefused="CONNECTION_REFUSED",i.ConnectionTimeout="CONNECTION_TIMEOUT",i.Disconnect="DISCONNECT",i.InvalidOption="INVALID_OPTION",i.InvalidPayload="INVALID_PAYLOAD",i.MaxPayloadExceeded="MAX_PAYLOAD_EXCEEDED",i.NoResponders="503",i.NotFunction="NOT_FUNC",i.RequestError="REQUEST_ERROR",i.ServerOptionNotAvailable="SERVER_OPT_NA",i.SubClosed="SUB_CLOSED",i.SubDraining="SUB_DRAINING",i.Timeout="TIMEOUT",i.Tls="TLS",i.Unknown="UNKNOWN_ERROR",i.WssRequired="WSS_REQUIRED",i.JetStreamInvalidAck="JESTREAM_INVALID_ACK",i.JetStream404NoMessages="404",i.JetStream408RequestTimeout="408",i.JetStream409MaxAckPendingExceeded="409",i.JetStream409="409",i.JetStreamNotEnabled="503",i.JetStreamIdleHeartBeat="IDLE_HEARTBEAT",i.AuthorizationViolation="AUTHORIZATION_VIOLATION",i.AuthenticationExpired="AUTHENTICATION_EXPIRED",i.ProtocolError="NATS_PROTOCOL_ERR",i.PermissionsViolation="PERMISSIONS_VIOLATION",i.AuthenticationTimeout="AUTHENTICATION_TIMEOUT",i.AccountExpired="ACCOUNT_EXPIRED"})(ce||(ce={}));function Kw(i){return typeof i.code=="string"}class mb{constructor(){A(this,"messages");this.messages=new Map,this.messages.set(ce.InvalidPayload,"Invalid payload type - payloads can be 'binary', 'string', or 'json'"),this.messages.set(ce.BadJson,"Bad JSON"),this.messages.set(ce.WssRequired,"TLS is required, therefore a secure websocket connection is also required")}static getMessage(t){return Jw.getMessage(t)}getMessage(t){return this.messages.get(t)||t}}const Jw=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===ce.AuthenticationExpired||this.code===ce.AuthorizationViolation||this.code===ce.AccountExpired}isAuthTimeout(){return this.code===ce.AuthenticationTimeout}isPermissionError(){return this.code===ce.PermissionsViolation}isProtocolError(){return this.code===ce.ProtocolError}isJetStreamError(){return this.api_error!==void 0}jsError(){return this.api_error?this.api_error:null}}var ln;(function(i){i[i.Exact=0]="Exact",i[i.CanonicalMIME=1]="CanonicalMIME",i[i.IgnoreCase=2]="IgnoreCase"})(ln||(ln={}));var In;(function(i){i.Timer="timer",i.Count="count",i.JitterTimer="jitterTimer",i.SentinelMsg="sentinelMsg"})(In||(In={}));var ao;(function(i){i.STATS="io.nats.micro.v1.stats_response",i.INFO="io.nats.micro.v1.info_response",i.PING="io.nats.micro.v1.ping_response"})(ao||(ao={}));const Xc="Nats-Service-Error",Kc="Nats-Service-Error-Code";class Jc extends Error{constructor(r,s){super(s);A(this,"code");this.code=r}static isServiceError(r){return Jc.toServiceError(r)!==null}static toServiceError(r){var l,c;const s=((l=r==null?void 0:r.headers)==null?void 0:l.get(Kc))||"";if(s!==""){const m=parseInt(s)||400,p=((c=r==null?void 0:r.headers)==null?void 0:c.get(Xc))||"";return new Jc(m,p.length?p:s)}return null}}function wr(i=""){if(i=i||"_INBOX",typeof i!="string")throw new Error("prefix must be a string");return i.split(".").forEach(t=>{if(t==="*"||t===">")throw new Error(`inbox prefixes cannot have wildcards '${i}'`)}),`${i}.${fi.next()}`}const Jh="127.0.0.1";var ai;(function(i){i.PING="PING",i.STATS="STATS",i.INFO="INFO"})(ai||(ai={}));function lu(i,...t){for(let r=0;r<t.length;r++){const s=t[r];Object.keys(s).forEach(function(l){i[l]=s[l]})}return i}function Fl(i){return un.decode(i).replace(/\n/g,"␊").replace(/\r/g,"␍")}function Gs(i,t=!0){const r=t?me.errorForCode(ce.Timeout):null;let s,l;const c=new Promise((m,p)=>{s={cancel:()=>{l&&clearTimeout(l)}},l=setTimeout(()=>{p(r===null?me.errorForCode(ce.Timeout):r)},i)});return Object.assign(c,s)}function Ys(i=0){let t;const r=new Promise(s=>{const l=setTimeout(()=>{s()},i);t={cancel:()=>{l&&clearTimeout(l)}}});return Object.assign(r,t)}function st(){let i={};const t=new Promise((r,s)=>{i={resolve:r,reject:s}});return Object.assign(t,i)}function 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 Qw(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 Qw(r>t?i[t]:i[r])}}}function it(i){return i*1e6}function Ad(i){return Math.floor(i/1e6)}function ny(i){let s=!0;const l=new Array(i.length);for(let c=0;c<i.length;c++){let m=i.charCodeAt(c);if(m===58||m<33||m>126)throw new me(`'${i[c]}' is not a valid character for a header key`,ce.BadHeader);s&&97<=m&&m<=122?m-=32:!s&&65<=m&&m<=90&&(m+=32),l[c]=m,s=m==45}return String.fromCharCode(...l)}function Sr(i=0,t=""){if(i===0&&t!==""||i>0&&t==="")throw new Error("setting status requires both code and description");return new oi(i,t)}const Mh="NATS/1.0";class oi{constructor(t=0,r=""){A(this,"_code");A(this,"headers");A(this,"_description");this._code=t,this._description=r,this.headers=new Map}[Symbol.iterator](){return this.headers.entries()}size(){return this.headers.size}equals(t){if(t&&this.headers.size===t.headers.size&&this._code===t._code){for(const[r,s]of this.headers){const l=t.values(r);if(s.length!==l.length)return!1;const c=[...s].sort(),m=[...l].sort();for(let p=0;p<c.length;p++)if(c[p]!==m[p])return!1}return!0}return!1}static decode(t){const r=new oi,l=un.decode(t).split(`\r
27
- `),c=l[0];if(c!==Mh){let m=c.replace(Mh,"").trim();if(m.length>0){r._code=parseInt(m,10),isNaN(r._code)&&(r._code=0);const p=r._code.toString();m=m.replace(p,""),r._description=m.trim()}}return l.length>=1&&l.slice(1).map(m=>{if(m){const p=m.indexOf(":");if(p>-1){const g=m.slice(0,p),f=m.slice(p+1).trim();r.append(g,f)}}}),r}toString(){if(this.headers.size===0&&this._code===0)return"";let t=Mh;this._code>0&&this._description!==""&&(t+=` ${this._code} ${this._description}`);for(const[r,s]of this.headers)for(let l=0;l<s.length;l++)t=`${t}\r
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
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.",ce.BadHeader);return t.trim()}keys(){const t=[];for(const r of this.headers.keys())t.push(r);return t}findKeys(t,r=ln.Exact){const s=this.keys();switch(r){case ln.Exact:return s.filter(l=>l===t);case ln.CanonicalMIME:return t=ny(t),s.filter(l=>l===t);default:{const l=t.toLowerCase();return s.filter(c=>l===c.toLowerCase())}}}get(t,r=ln.Exact){const s=this.findKeys(t,r);if(s.length){const l=this.headers.get(s[0]);if(l)return Array.isArray(l)?l[0]:l}return""}last(t,r=ln.Exact){const s=this.findKeys(t,r);if(s.length){const l=this.headers.get(s[0]);if(l)return Array.isArray(l)?l[l.length-1]:l}return""}has(t,r=ln.Exact){return this.findKeys(t,r).length>0}set(t,r,s=ln.Exact){this.delete(t,s),this.append(t,r,s)}append(t,r,s=ln.Exact){const l=ny(t);s===ln.CanonicalMIME&&(t=l);const c=this.findKeys(t,s);t=c.length>0?c[0]:t;const m=oi.validHeaderValue(r);let p=this.headers.get(t);p||(p=[],this.headers.set(t,p)),p.push(m)}values(t,r=ln.Exact){const s=[];return this.findKeys(t,r).forEach(c=>{const m=this.headers.get(c);m&&s.push(...m)}),s}delete(t,r=ln.Exact){this.findKeys(t,r).forEach(l=>{this.headers.delete(l)})}get hasError(){return this._code>=300}get status(){return`${this._code} ${this._description}`.trim()}toRecord(){const t={};return this.keys().forEach(r=>{t[r]=this.values(r)}),t}get code(){return this._code}get description(){return this._description}static fromRecord(t){const r=new oi;for(const s in t)r.headers.set(s,t[s]);return r}}function Qh(){return{encode(i){return Hi.encode(i)},decode(i){return un.decode(i)}}}function $n(i){return{encode(t){try{return t===void 0&&(t=null),Hi.encode(JSON.stringify(t))}catch(r){throw me.errorForCode(ce.BadJson,r)}},decode(t){try{return JSON.parse(un.decode(t),i)}catch(r){throw me.errorForCode(ce.BadJson,r)}}}}function gb(i){var t;return i&&i.data.length===0&&((t=i.headers)==null?void 0:t.code)===503?me.errorForCode(ce.NoResponders):null}class jd{constructor(t,r,s){A(this,"_headers");A(this,"_msg");A(this,"_rdata");A(this,"_reply");A(this,"_subject");A(this,"publisher");this._msg=t,this._rdata=r,this.publisher=s}get subject(){return this._subject?this._subject:(this._subject=un.decode(this._msg.subject),this._subject)}get reply(){return this._reply?this._reply:(this._reply=un.decode(this._msg.reply),this._reply)}get sid(){return this._msg.sid}get headers(){if(this._msg.hdr>-1&&!this._headers){const t=this._rdata.subarray(0,this._msg.hdr);this._headers=oi.decode(t)}return this._headers}get data(){return this._rdata?this._msg.hdr>-1?this._rdata.subarray(this._msg.hdr):this._rdata:new Uint8Array(0)}respond(t=hn,r){return this.reply?(this.publisher.publish(this.reply,t,r),!0):!1}size(){var l;const t=this._msg.subject.length,r=((l=this._msg.reply)==null?void 0:l.length)||0,s=this._msg.size===-1?0:this._msg.size;return t+r+s}json(t){return $n(t).decode(this.data)}string(){return un.decode(this.data)}requestInfo(){var r;const t=(r=this.headers)==null?void 0:r.get("Nats-Request-Info");return t?JSON.parse(t,function(s,l){return(s==="start"||s==="stop")&&l!==""?new Date(Date.parse(l)):l}):null}}A(jd,"jc");function Us(i){return cu("durable",i)}function Pt(i){return cu("stream",i)}function cu(i,t=""){if(t==="")throw Error(`${i} name required`);return[".","*",">","/","\\"," "," ",`
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[".","*",">","/","\\"," "," ",`
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=Zw(t);if(r.length)throw new Error(`invalid ${i} name - ${i} name ${r}`)}function Zw(i=""){if(i==="")throw Error("name required");const t=/^[-\w]+$/g;if(i.match(t)===null){for(const s of i.split(""))if(s.match(t)===null)return`cannot contain '${s}'`}return""}function Zh(i){if(i.data.length>0)return!1;const t=i.headers;return t?t.code>=100&&t.code<200:!1}function Wh(i){var t;return Zh(i)&&((t=i.headers)==null?void 0:t.description)==="Idle Heartbeat"}function Ww(i,t,r){const s=Sr(i,t),l={hdr:1,sid:0,size:0},c=new jd(l,hn,{});return c._headers=s,c._subject=r,c}function Ps(i){if(i.data.length!==0)return null;const t=i.headers;return t?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 eS(i){return i.code!==ce.JetStream409?!1:[Nn.MaxBatchExceeded,Nn.MaxExpiresExceeded,Nn.MaxBytesExceeded,Nn.MaxMessageSizeExceeded,Nn.PushConsumer,Nn.IdleHeartbeatMissed,Nn.ConsumerDeleted].find(r=>i.message.indexOf(r)!==-1)!==void 0}function yb(i,t=""){if(i<300)return null;switch(t=t.toLowerCase(),i){case 404:return new me(t,ce.JetStream404NoMessages);case 408:return new me(t,ce.JetStream408RequestTimeout);case 409:{const r=t.startsWith(Nn.IdleHeartbeatMissed)?ce.JetStreamIdleHeartBeat:ce.JetStream409;return new me(t,r)}case 503:return me.errorForCode(ce.JetStreamNotEnabled,new Error(t));default:return t===""&&(t=ce.Unknown),new me(t,`${i}`)}}class jt{constructor(){A(this,"inflight");A(this,"processed");A(this,"received");A(this,"noIterator");A(this,"iterClosed");A(this,"done");A(this,"signal");A(this,"yields");A(this,"filtered");A(this,"pendingFiltered");A(this,"ingestionFilterFn");A(this,"protocolFilterFn");A(this,"dispatchedFn");A(this,"ctx");A(this,"_data");A(this,"err");A(this,"time");A(this,"yielding");this.inflight=0,this.filtered=0,this.pendingFiltered=0,this.processed=0,this.received=0,this.noIterator=!1,this.done=!1,this.signal=st(),this.yields=[],this.iterClosed=st(),this.time=0,this.yielding=!1}[Symbol.asyncIterator](){return this.iterate()}push(t){if(this.done)return;if(typeof t=="function"){this.yields.push(t),this.signal.resolve();return}const{ingest:r,protocol:s}=this.ingestionFilterFn?this.ingestionFilterFn(t,this.ctx||this):{ingest:!0,protocol:!1};r&&(s&&(this.filtered++,this.pendingFiltered++),this.yields.push(t),this.signal.resolve())}async*iterate(){if(this.noIterator)throw new me("unsupported iterator",ce.ApiError);if(this.yielding)throw new me("already yielding",ce.ApiError);this.yielding=!0;try{for(;;){if(this.yields.length===0&&await this.signal,this.err)throw this.err;const t=this.yields;this.inflight=t.length,this.yields=[];for(let r=0;r<t.length;r++){if(typeof t[r]=="function"){const l=t[r];try{l()}catch(c){throw c}if(this.err)throw this.err;continue}if(this.protocolFilterFn?this.protocolFilterFn(t[r]):!0){this.processed++;const l=Date.now();yield t[r],this.time=Date.now()-l,this.dispatchedFn&&t[r]&&this.dispatchedFn(t[r])}else this.pendingFiltered--;this.inflight--}if(this.done)break;this.yields.length===0&&(t.length=0,this.yields=t,this.signal=st())}}finally{this.stop()}}stop(t){this.done||(this.err=t,this.done=!0,this.signal.resolve(),this.iterClosed.resolve(t))}getProcessed(){return this.noIterator?this.received:this.processed}getPending(){return this.yields.length+this.inflight-this.pendingFiltered}getReceived(){return this.received-this.filtered}}class Td{constructor(t,r,s={maxOut:2}){A(this,"interval");A(this,"maxOut");A(this,"cancelAfter");A(this,"timer");A(this,"autoCancelTimer");A(this,"last");A(this,"missed");A(this,"count");A(this,"callback");this.interval=t,this.maxOut=(s==null?void 0:s.maxOut)||2,this.cancelAfter=(s==null?void 0:s.cancelAfter)||0,this.last=Date.now(),this.missed=0,this.count=0,this.callback=r,this._schedule()}cancel(){this.autoCancelTimer&&clearTimeout(this.autoCancelTimer),this.timer&&clearInterval(this.timer),this.timer=0,this.autoCancelTimer=0,this.missed=0}work(){this.last=Date.now(),this.missed=0}_change(t,r=0,s=2){this.interval=t,this.maxOut=s,this.cancelAfter=r,this.restart()}restart(){this.cancel(),this._schedule()}_schedule(){this.cancelAfter>0&&(this.autoCancelTimer=setTimeout(()=>{this.cancel()},this.cancelAfter)),this.timer=setInterval(()=>{if(this.count++,Date.now()-this.last>this.interval&&this.missed++,this.missed>=this.maxOut)try{this.callback(this.missed)===!0&&this.cancel()}catch(t){console.log(t)}},this.interval)}}var ed;(function(i){i.Limits="limits",i.Interest="interest",i.Workqueue="workqueue"})(ed||(ed={}));var uo;(function(i){i.Old="old",i.New="new"})(uo||(uo={}));var td;(function(i){i.File="file",i.Memory="memory"})(td||(td={}));var mt;(function(i){i.All="all",i.Last="last",i.New="new",i.StartSequence="by_start_sequence",i.StartTime="by_start_time",i.LastPerSubject="last_per_subject"})(mt||(mt={}));var At;(function(i){i.None="none",i.All="all",i.Explicit="explicit",i.NotSet=""})(At||(At={}));var Fs;(function(i){i.Instant="instant",i.Original="original"})(Fs||(Fs={}));var hi;(function(i){i.None="none",i.S2="s2"})(hi||(hi={}));var Qc;(function(i){i.CreateOrUpdate="",i.Update="update",i.Create="create"})(Qc||(Qc={}));function tS(i,t={}){return Object.assign({name:i,deliver_policy:mt.All,ack_policy:At.Explicit,ack_wait:it(30*1e3),replay_policy:Fs.Instant},t)}var ry;(function(i){i.API="api_audit",i.StreamAction="stream_action",i.ConsumerAction="consumer_action",i.SnapshotCreate="snapshot_create",i.SnapshotComplete="snapshot_complete",i.RestoreCreate="restore_create",i.RestoreComplete="restore_complete",i.MaxDeliver="max_deliver",i.Terminated="terminated",i.Ack="consumer_ack",i.StreamLeaderElected="stream_leader_elected",i.StreamQuorumLost="stream_quorum_lost",i.ConsumerLeaderElected="consumer_leader_elected",i.ConsumerQuorumLost="consumer_quorum_lost"})(ry||(ry={}));var $t;(function(i){i.StreamSourceHdr="Nats-Stream-Source",i.LastConsumerSeqHdr="Nats-Last-Consumer",i.LastStreamSeqHdr="Nats-Last-Stream",i.ConsumerStalledHdr="Nats-Consumer-Stalled",i.MessageSizeHdr="Nats-Msg-Size",i.RollupHdr="Nats-Rollup",i.RollupValueSubject="sub",i.RollupValueAll="all",i.PendingMessagesHdr="Nats-Pending-Messages",i.PendingBytesHdr="Nats-Pending-Bytes"})($t||($t={}));var Un;(function(i){i.LastValue="",i.AllHistory="history",i.UpdatesOnly="updates"})(Un||(Un={}));var Bs;(function(i){i.Stream="Nats-Stream",i.Sequence="Nats-Sequence",i.TimeStamp="Nats-Time-Stamp",i.Subject="Nats-Subject"})(Bs||(Bs={}));var iy;(function(i){i.Stream="Nats-Stream",i.Subject="Nats-Subject",i.Sequence="Nats-Sequence",i.LastSequence="Nats-Last-Sequence",i.Size="Nats-Msg-Size"})(iy||(iy={}));const cn="KV_";class nS{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=tS("",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 nS(i)}function sy(i){return typeof i.getOpts=="function"}class rS{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(rS.encode(t))}static decode(t,r=!1){return Is.decode(Is.fromB64URLEncoding(t),r)}static toB64URLEncoding(t){return t.replace(/\+/g,"-").replace(/\//g,"_")}static fromB64URLEncoding(t){return t.replace(/_/g,"/").replace(/-/g,"+")}}class Vs{constructor(){A(this,"buffers");A(this,"byteLength");this.buffers=[],this.byteLength=0}static concat(...t){let r=0;for(let c=0;c<t.length;c++)r+=t[c].length;const s=new Uint8Array(r);let l=0;for(let c=0;c<t.length;c++)s.set(t[c],l),l+=t[c].length;return s}static fromAscii(t){return t||(t=""),Hi.encode(t)}static toAscii(t){return un.decode(t)}reset(){this.buffers.length=0,this.byteLength=0}pack(){if(this.buffers.length>1){const t=new Uint8Array(this.byteLength);let r=0;for(let s=0;s<this.buffers.length;s++)t.set(this.buffers[s],r),r+=this.buffers[s].length;this.buffers.length=0,this.buffers.push(t)}}shift(){if(this.buffers.length){const t=this.buffers.shift();if(t)return this.byteLength-=t.length,t}return new Uint8Array(0)}drain(t){if(this.buffers.length){this.pack();const r=this.buffers.pop();if(r){const s=this.byteLength;(t===void 0||t>s)&&(t=s);const l=r.subarray(0,t);return s>t&&this.buffers.push(r.subarray(t)),this.byteLength=s-t,l}}return new Uint8Array(0)}fill(t,...r){t&&(this.buffers.push(t),this.byteLength+=t.length);for(let s=0;s<r.length;s++)r[s]&&r[s].length&&(this.buffers.push(r[s]),this.byteLength+=r[s].length)}peek(){return this.buffers.length?(this.pack(),this.buffers[0]):new Uint8Array(0)}size(){return this.byteLength}length(){return this.buffers.length}}function iS(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 sS=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},Fa=sS.performance||{};Fa.now||Fa.mozNow||Fa.msNow||Fa.oNow||Fa.webkitNow;var ay={versions:{}},aS=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function oS(i){if(i.__esModule)return i;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(i).forEach(function(r){var s=Object.getOwnPropertyDescriptor(i,r);Object.defineProperty(t,r,s.get?s:{enumerable:!0,get:function(){return i[r]}})}),t}var Rh,uu={exports:{}},oy={},ly=oS(iS({__proto__:null,default:oy},[oy]));Rh=uu,(function(){var i="input is invalid type",t=typeof window=="object",r=t?window:{};r.JS_SHA256_NO_WINDOW&&(t=!1);var s=!t&&typeof self=="object",l=!r.JS_SHA256_NO_NODE_JS&&ay.versions&&ay.versions.node;l?r=aS:s&&(r=self);var c=!r.JS_SHA256_NO_COMMON_JS&&Rh.exports,m=!r.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",p="0123456789abcdef".split(""),g=[-2147483648,8388608,32768,128],f=[24,16,8,0],d=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],b=["hex","array","digest","arrayBuffer"],v=[];!r.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(C){return Object.prototype.toString.call(C)==="[object Array]"}),!m||!r.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(C){return typeof C=="object"&&C.buffer&&C.buffer.constructor===ArrayBuffer});var _=function(C,I){return function(re){return new z(I,!0).update(re)[C]()}},w=function(C){var I=_("hex",C);l&&(I=S(I,C)),I.create=function(){return new z(C)},I.update=function(B){return I.create().update(B)};for(var re=0;re<b.length;++re){var K=b[re];I[K]=_(K,C)}return I},S=function(C,I){var re,K=ly,B=ly.Buffer,G=I?"sha224":"sha256";return re=B.from&&!r.JS_SHA256_NO_BUFFER_FROM?B.from:function(W){return new B(W)},function(W){if(typeof W=="string")return K.createHash(G).update(W,"utf8").digest("hex");if(W==null)throw new Error(i);return W.constructor===ArrayBuffer&&(W=new Uint8Array(W)),Array.isArray(W)||ArrayBuffer.isView(W)||W.constructor===B?K.createHash(G).update(re(W)).digest("hex"):C(W)}},M=function(C,I){return function(re,K){return new ie(re,I,!0).update(K)[C]()}},L=function(C){var I=M("hex",C);I.create=function(B){return new ie(B,C)},I.update=function(B,G){return I.create(B).update(G)};for(var re=0;re<b.length;++re){var K=b[re];I[K]=M(K,C)}return I};function z(C,I){I?(v[0]=v[16]=v[1]=v[2]=v[3]=v[4]=v[5]=v[6]=v[7]=v[8]=v[9]=v[10]=v[11]=v[12]=v[13]=v[14]=v[15]=0,this.blocks=v):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],C?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=C}function ie(C,I,re){var K,B=typeof C;if(B==="string"){var G,W=[],Q=C.length,he=0;for(K=0;K<Q;++K)(G=C.charCodeAt(K))<128?W[he++]=G:G<2048?(W[he++]=192|G>>>6,W[he++]=128|63&G):G<55296||G>=57344?(W[he++]=224|G>>>12,W[he++]=128|G>>>6&63,W[he++]=128|63&G):(G=65536+((1023&G)<<10|1023&C.charCodeAt(++K)),W[he++]=240|G>>>18,W[he++]=128|G>>>12&63,W[he++]=128|G>>>6&63,W[he++]=128|63&G);C=W}else{if(B!=="object")throw new Error(i);if(C===null)throw new Error(i);if(m&&C.constructor===ArrayBuffer)C=new Uint8Array(C);else if(!(Array.isArray(C)||m&&ArrayBuffer.isView(C)))throw new Error(i)}C.length>64&&(C=new z(I,!0).update(C).array());var _e=[],Te=[];for(K=0;K<64;++K){var Y=C[K]||0;_e[K]=92^Y,Te[K]=54^Y}z.call(this,I,re),this.update(Te),this.oKeyPad=_e,this.inner=!0,this.sharedMemory=re}z.prototype.update=function(C){if(!this.finalized){var I,re=typeof C;if(re!=="string"){if(re!=="object")throw new Error(i);if(C===null)throw new Error(i);if(m&&C.constructor===ArrayBuffer)C=new Uint8Array(C);else if(!(Array.isArray(C)||m&&ArrayBuffer.isView(C)))throw new Error(i);I=!0}for(var K,B,G=0,W=C.length,Q=this.blocks;G<W;){if(this.hashed&&(this.hashed=!1,Q[0]=this.block,this.block=Q[16]=Q[1]=Q[2]=Q[3]=Q[4]=Q[5]=Q[6]=Q[7]=Q[8]=Q[9]=Q[10]=Q[11]=Q[12]=Q[13]=Q[14]=Q[15]=0),I)for(B=this.start;G<W&&B<64;++G)Q[B>>>2]|=C[G]<<f[3&B++];else for(B=this.start;G<W&&B<64;++G)(K=C.charCodeAt(G))<128?Q[B>>>2]|=K<<f[3&B++]:K<2048?(Q[B>>>2]|=(192|K>>>6)<<f[3&B++],Q[B>>>2]|=(128|63&K)<<f[3&B++]):K<55296||K>=57344?(Q[B>>>2]|=(224|K>>>12)<<f[3&B++],Q[B>>>2]|=(128|K>>>6&63)<<f[3&B++],Q[B>>>2]|=(128|63&K)<<f[3&B++]):(K=65536+((1023&K)<<10|1023&C.charCodeAt(++G)),Q[B>>>2]|=(240|K>>>18)<<f[3&B++],Q[B>>>2]|=(128|K>>>12&63)<<f[3&B++],Q[B>>>2]|=(128|K>>>6&63)<<f[3&B++],Q[B>>>2]|=(128|63&K)<<f[3&B++]);this.lastByteIndex=B,this.bytes+=B-this.start,B>=64?(this.block=Q[16],this.start=B-64,this.hash(),this.hashed=!0):this.start=B}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},z.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var C=this.blocks,I=this.lastByteIndex;C[16]=this.block,C[I>>>2]|=g[3&I],this.block=C[16],I>=56&&(this.hashed||this.hash(),C[0]=this.block,C[16]=C[1]=C[2]=C[3]=C[4]=C[5]=C[6]=C[7]=C[8]=C[9]=C[10]=C[11]=C[12]=C[13]=C[14]=C[15]=0),C[14]=this.hBytes<<3|this.bytes>>>29,C[15]=this.bytes<<3,this.hash()}},z.prototype.hash=function(){var C,I,re,K,B,G,W,Q,he,_e=this.h0,Te=this.h1,Y=this.h2,oe=this.h3,de=this.h4,Oe=this.h5,le=this.h6,je=this.h7,Se=this.blocks;for(C=16;C<64;++C)I=((B=Se[C-15])>>>7|B<<25)^(B>>>18|B<<14)^B>>>3,re=((B=Se[C-2])>>>17|B<<15)^(B>>>19|B<<13)^B>>>10,Se[C]=Se[C-16]+I+Se[C-7]+re|0;for(he=Te&Y,C=0;C<64;C+=4)this.first?(this.is224?(G=300032,je=(B=Se[0]-1413257819)-150054599|0,oe=B+24177077|0):(G=704751109,je=(B=Se[0]-210244248)-1521486534|0,oe=B+143694565|0),this.first=!1):(I=(_e>>>2|_e<<30)^(_e>>>13|_e<<19)^(_e>>>22|_e<<10),K=(G=_e&Te)^_e&Y^he,je=oe+(B=je+(re=(de>>>6|de<<26)^(de>>>11|de<<21)^(de>>>25|de<<7))+(de&Oe^~de&le)+d[C]+Se[C])|0,oe=B+(I+K)|0),I=(oe>>>2|oe<<30)^(oe>>>13|oe<<19)^(oe>>>22|oe<<10),K=(W=oe&_e)^oe&Te^G,le=Y+(B=le+(re=(je>>>6|je<<26)^(je>>>11|je<<21)^(je>>>25|je<<7))+(je&de^~je&Oe)+d[C+1]+Se[C+1])|0,I=((Y=B+(I+K)|0)>>>2|Y<<30)^(Y>>>13|Y<<19)^(Y>>>22|Y<<10),K=(Q=Y&oe)^Y&_e^W,Oe=Te+(B=Oe+(re=(le>>>6|le<<26)^(le>>>11|le<<21)^(le>>>25|le<<7))+(le&je^~le&de)+d[C+2]+Se[C+2])|0,I=((Te=B+(I+K)|0)>>>2|Te<<30)^(Te>>>13|Te<<19)^(Te>>>22|Te<<10),K=(he=Te&Y)^Te&oe^Q,de=_e+(B=de+(re=(Oe>>>6|Oe<<26)^(Oe>>>11|Oe<<21)^(Oe>>>25|Oe<<7))+(Oe&le^~Oe&je)+d[C+3]+Se[C+3])|0,_e=B+(I+K)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+_e|0,this.h1=this.h1+Te|0,this.h2=this.h2+Y|0,this.h3=this.h3+oe|0,this.h4=this.h4+de|0,this.h5=this.h5+Oe|0,this.h6=this.h6+le|0,this.h7=this.h7+je|0},z.prototype.hex=function(){this.finalize();var C=this.h0,I=this.h1,re=this.h2,K=this.h3,B=this.h4,G=this.h5,W=this.h6,Q=this.h7,he=p[C>>>28&15]+p[C>>>24&15]+p[C>>>20&15]+p[C>>>16&15]+p[C>>>12&15]+p[C>>>8&15]+p[C>>>4&15]+p[15&C]+p[I>>>28&15]+p[I>>>24&15]+p[I>>>20&15]+p[I>>>16&15]+p[I>>>12&15]+p[I>>>8&15]+p[I>>>4&15]+p[15&I]+p[re>>>28&15]+p[re>>>24&15]+p[re>>>20&15]+p[re>>>16&15]+p[re>>>12&15]+p[re>>>8&15]+p[re>>>4&15]+p[15&re]+p[K>>>28&15]+p[K>>>24&15]+p[K>>>20&15]+p[K>>>16&15]+p[K>>>12&15]+p[K>>>8&15]+p[K>>>4&15]+p[15&K]+p[B>>>28&15]+p[B>>>24&15]+p[B>>>20&15]+p[B>>>16&15]+p[B>>>12&15]+p[B>>>8&15]+p[B>>>4&15]+p[15&B]+p[G>>>28&15]+p[G>>>24&15]+p[G>>>20&15]+p[G>>>16&15]+p[G>>>12&15]+p[G>>>8&15]+p[G>>>4&15]+p[15&G]+p[W>>>28&15]+p[W>>>24&15]+p[W>>>20&15]+p[W>>>16&15]+p[W>>>12&15]+p[W>>>8&15]+p[W>>>4&15]+p[15&W];return this.is224||(he+=p[Q>>>28&15]+p[Q>>>24&15]+p[Q>>>20&15]+p[Q>>>16&15]+p[Q>>>12&15]+p[Q>>>8&15]+p[Q>>>4&15]+p[15&Q]),he},z.prototype.toString=z.prototype.hex,z.prototype.digest=function(){this.finalize();var C=this.h0,I=this.h1,re=this.h2,K=this.h3,B=this.h4,G=this.h5,W=this.h6,Q=this.h7,he=[C>>>24&255,C>>>16&255,C>>>8&255,255&C,I>>>24&255,I>>>16&255,I>>>8&255,255&I,re>>>24&255,re>>>16&255,re>>>8&255,255&re,K>>>24&255,K>>>16&255,K>>>8&255,255&K,B>>>24&255,B>>>16&255,B>>>8&255,255&B,G>>>24&255,G>>>16&255,G>>>8&255,255&G,W>>>24&255,W>>>16&255,W>>>8&255,255&W];return this.is224||he.push(Q>>>24&255,Q>>>16&255,Q>>>8&255,255&Q),he},z.prototype.array=z.prototype.digest,z.prototype.arrayBuffer=function(){this.finalize();var C=new ArrayBuffer(this.is224?28:32),I=new DataView(C);return I.setUint32(0,this.h0),I.setUint32(4,this.h1),I.setUint32(8,this.h2),I.setUint32(12,this.h3),I.setUint32(16,this.h4),I.setUint32(20,this.h5),I.setUint32(24,this.h6),this.is224||I.setUint32(28,this.h7),C},ie.prototype=new z,ie.prototype.finalize=function(){if(z.prototype.finalize.call(this),this.inner){this.inner=!1;var C=this.array();z.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(C),z.prototype.finalize.call(this)}};var ae=w();ae.sha256=ae,ae.sha224=w(!0),ae.sha256.hmac=L(),ae.sha224.hmac=L(!0),c?Rh.exports=ae:(r.sha256=ae.sha256,r.sha224=ae.sha224)})();uu.exports;uu.exports.sha224;var cy=uu.exports.sha256;function nd(i){return dS(i)}function lS(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 cS(i){return/^[A-Za-z0-9\-_]*(={0,2})?$/.test(i)||/^[A-Za-z0-9+/]*(={0,2})?$/.test(i)}function uS(i){return lS(i)?"hex":cS(i)?"b64":""}function fS(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 hS(i){i=i.replace(/-/g,"+"),i=i.replace(/_/g,"/");const t=atob(i);return Uint8Array.from(t,r=>r.charCodeAt(0))}function dS(i){switch(uS(i)){case"hex":return fS(i);case"b64":return hS(i)}return null}function mS(i,t){const r=typeof i=="string"?nd(i):i,s=typeof t=="string"?nd(t):t;if(r===null||s===null||r.length!==s.length)return!1;for(let l=0;l<r.length;l++)if(r[l]!==s[l])return!1;return!0}class 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 pS 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=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+=`
33
33
 
34
- ${this.ctx.stack}`),this.cancel(r)):(this.callback(null,s),this.opts.strategy===In.Count&&(this.max--,this.max===0&&this.cancel()),this.opts.strategy===In.JitterTimer&&(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.cancel()},this.opts.jitter||300)),this.opts.strategy===In.SentinelMsg&&s&&s.data.length===0&&this.cancel())}}class 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 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+=`
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(ce.Cancelled))}}const gS="$JS.API";function yS(i){return i=i||{},i.domain&&(i.apiPrefix=`$JS.${i.domain}.API`,delete i.domain),lu({apiPrefix:gS,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=yS(r),this._parseOpts(),this.prefix=this.opts.apiPrefix,this.timeout=this.opts.timeout,this.jc=$n()}getOptions(){return Object.assign({},this.opts)}_parseOpts(){let t=this.opts.apiPrefix;if(!t||t.length===0)throw new Error("invalid empty prefix");t[t.length-1]==="."&&(t=t.substr(0,t.length-1)),this.opts.apiPrefix=t}async _request(t,r=null,s){s=s||{},s.timeout=this.timeout;let l=hn;r&&(l=this.jc.encode(r));let{retries:c}=s;c=c||1,c=c===-1?Number.MAX_SAFE_INTEGER:c;const m=Od();for(let p=0;p<c;p++)try{const g=await this.nc.request(t,l,s);return this.parseJsResponse(g)}catch(g){const f=g;if((f.code==="503"||f.code===ce.Timeout)&&p+1<c)await Ys(m.backoff(p));else throw g}}async findStream(t){const r={subject:t},l=await this._request(`${this.prefix}.STREAM.NAMES`,r);if(!l.streams||l.streams.length!==1)throw new Error("no stream matches subject");return l.streams[0]}getConnection(){return this.nc}parseJsResponse(t){const r=this.jc.decode(t.data),s=r;if(s.error){const l=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 rd(i,t){return i.major<t.major?-1:i.major>t.major?1:i.minor<t.minor?-1:i.minor>t.minor?1:i.micro<t.micro?-1:i.micro>t.micro?1:0}var Ie;(function(i){i.JS_KV="js_kv",i.JS_OBJECTSTORE="js_objectstore",i.JS_PULL_MAX_BYTES="js_pull_max_bytes",i.JS_NEW_CONSUMER_CREATE_API="js_new_consumer_create",i.JS_ALLOW_DIRECT="js_allow_direct",i.JS_MULTIPLE_CONSUMER_FILTER="js_multiple_consumer_filter",i.JS_SIMPLIFICATION="js_simplification",i.JS_STREAM_CONSUMER_METADATA="js_stream_consumer_metadata",i.JS_CONSUMER_FILTER_SUBJECTS="js_consumer_filter_subjects",i.JS_STREAM_FIRST_SEQ="js_stream_first_seq",i.JS_STREAM_SUBJECT_TRANSFORM="js_stream_subject_transform",i.JS_STREAM_SOURCE_SUBJECT_TRANSFORM="js_stream_source_subject_transform",i.JS_STREAM_COMPRESSION="js_stream_compression",i.JS_DEFAULT_CONSUMER_LIMITS="js_default_consumer_limits",i.JS_BATCH_DIRECT_GET="js_batch_direct_get"})(Ie||(Ie={}));class bS{constructor(t){A(this,"server");A(this,"features");A(this,"disabled");this.features=new Map,this.disabled=[],this.update(t)}resetDisabled(){this.disabled.length=0,this.update(this.server)}disable(t){this.disabled.push(t),this.update(this.server)}isDisabled(t){return this.disabled.indexOf(t)!==-1}update(t){typeof t=="string"&&(t=$i(t)),this.server=t,this.set(Ie.JS_KV,"2.6.2"),this.set(Ie.JS_OBJECTSTORE,"2.6.3"),this.set(Ie.JS_PULL_MAX_BYTES,"2.8.3"),this.set(Ie.JS_NEW_CONSUMER_CREATE_API,"2.9.0"),this.set(Ie.JS_ALLOW_DIRECT,"2.9.0"),this.set(Ie.JS_MULTIPLE_CONSUMER_FILTER,"2.10.0"),this.set(Ie.JS_SIMPLIFICATION,"2.9.4"),this.set(Ie.JS_STREAM_CONSUMER_METADATA,"2.10.0"),this.set(Ie.JS_CONSUMER_FILTER_SUBJECTS,"2.10.0"),this.set(Ie.JS_STREAM_FIRST_SEQ,"2.10.0"),this.set(Ie.JS_STREAM_SUBJECT_TRANSFORM,"2.10.0"),this.set(Ie.JS_STREAM_SOURCE_SUBJECT_TRANSFORM,"2.10.0"),this.set(Ie.JS_STREAM_COMPRESSION,"2.10.0"),this.set(Ie.JS_DEFAULT_CONSUMER_LIMITS,"2.10.0"),this.set(Ie.JS_BATCH_DIRECT_GET,"2.11.0"),this.disabled.forEach(r=>{this.features.delete(r)})}set(t,r){this.features.set(t,{min:r,ok:rd(this.server,$i(r))>=0})}get(t){return this.features.get(t)||{min:"unknown",ok:!1}}supports(t){var r;return((r=this.get(t))==null?void 0:r.ok)||!1}require(t){return typeof t=="string"&&(t=$i(t)),rd(this.server,t)>=0}}class Zc extends yo{constructor(t,r){super(t,r)}async add(t,r,s=Qc.Create){if(Pt(t),r.deliver_group&&r.flow_control)throw new Error("jetstream flow control is not supported with queue groups");if(r.deliver_group&&r.idle_heartbeat)throw new Error("jetstream idle heartbeat is not supported with queue groups");const l={};l.config=r,l.stream_name=t,l.action=s,l.config.durable_name&&Us(l.config.durable_name);const c=this.nc;let{min:m,ok:p}=c.features.get(Ie.JS_NEW_CONSUMER_CREATE_API);const g=r.name===""?void 0:r.name;if(g&&!p)throw new Error(`consumer 'name' requires server ${m}`);if(g)try{cu("name",g)}catch(v){const _=v.message,w=_.indexOf("cannot contain");throw w!==-1?new Error(`consumer 'name' ${_.substring(w)}`):v}let f,d="";if(Array.isArray(r.filter_subjects)){const{min:v,ok:_}=c.features.get(Ie.JS_MULTIPLE_CONSUMER_FILTER);if(!_)throw new Error(`consumer 'filter_subjects' requires server ${v}`);p=!1}if(r.metadata){const{min:v,ok:_}=c.features.get(Ie.JS_STREAM_CONSUMER_METADATA);if(!_)throw new Error(`consumer 'metadata' requires server ${v}`)}if(p&&(d=r.name??r.durable_name??""),d!==""){let v=r.filter_subject??void 0;v===">"&&(v=void 0),f=v!==void 0?`${this.prefix}.CONSUMER.CREATE.${t}.${d}.${v}`:`${this.prefix}.CONSUMER.CREATE.${t}.${d}`}else f=r.durable_name?`${this.prefix}.CONSUMER.DURABLE.CREATE.${t}.${r.durable_name}`:`${this.prefix}.CONSUMER.CREATE.${t}`;return await this._request(f,l)}async update(t,r,s){const l=await this.info(t,r),c=s;return this.add(t,Object.assign(l.config,c),Qc.Update)}async info(t,r){return Pt(t),Us(r),await this._request(`${this.prefix}.CONSUMER.INFO.${t}.${r}`)}async delete(t,r){return Pt(t),Us(r),(await this._request(`${this.prefix}.CONSUMER.DELETE.${t}.${r}`)).success}list(t){Pt(t);const r=l=>l.consumers,s=`${this.prefix}.CONSUMER.LIST.${t}`;return new ro(s,r,this)}pause(t,r,s){const l=`${this.prefix}.CONSUMER.PAUSE.${t}.${r}`,c={pause_until:s.toISOString()};return this._request(l,c)}resume(t,r){return this.pause(t,r,new Date(0))}}function ks(i,t,r=!1){if(r===!0&&!i)throw me.errorForCode(ce.ApiError,new Error(`${t} is not a function`));if(i&&typeof i!="function")throw me.errorForCode(ce.ApiError,new Error(`${t} is not a function`))}class vS extends jt{constructor(r,s,l){super();A(this,"sub");A(this,"adapter");A(this,"subIterDone");ks(l.adapter,"adapter",!0),this.adapter=l.adapter,l.callback&&ks(l.callback,"callback"),this.noIterator=typeof l.callback=="function",l.ingestionFilterFn&&(ks(l.ingestionFilterFn,"ingestionFilterFn"),this.ingestionFilterFn=l.ingestionFilterFn),l.protocolFilterFn&&(ks(l.protocolFilterFn,"protocolFilterFn"),this.protocolFilterFn=l.protocolFilterFn),l.dispatchedFn&&(ks(l.dispatchedFn,"dispatchedFn"),this.dispatchedFn=l.dispatchedFn),l.cleanupFn&&ks(l.cleanupFn,"cleanupFn");let c=(d,b)=>{this.callback(d,b)};if(l.callback){const d=l.callback;c=(b,v)=>{const[_,w]=this.adapter(b,v);if(_){d(_,null);return}const{ingest:S}=this.ingestionFilterFn?this.ingestionFilterFn(w,this):{ingest:!0};S&&(!this.protocolFilterFn||this.protocolFilterFn(w))&&(d(_,w),this.dispatchedFn&&w&&this.dispatchedFn(w))}}const{max:m,queue:p,timeout:g}=l,f={queue:p,timeout:g,callback:c};m&&m>0&&(f.max=m),this.sub=r.subscribe(s,f),l.cleanupFn&&(this.sub.cleanupFn=l.cleanupFn),this.noIterator||this.iterClosed.then(()=>{this.unsubscribe()}),this.subIterDone=st(),Promise.all([this.sub.closed,this.iterClosed]).then(()=>{this.subIterDone.resolve()}).catch(()=>{this.subIterDone.resolve()}),(async d=>{await d.closed,this.stop()})(this.sub).then().catch()}unsubscribe(r){this.sub.unsubscribe(r)}drain(){return this.sub.drain()}isDraining(){return this.sub.isDraining()}isClosed(){return this.sub.isClosed()}callback(r,s){this.sub.cancelTimeout();const[l,c]=this.adapter(r,s);l&&this.stop(l),c&&this.push(c)}getSubject(){return this.sub.getSubject()}getReceived(){return this.sub.getReceived()}getProcessed(){return this.sub.getProcessed()}getPending(){return this.sub.getPending()}getID(){return this.sub.getID()}getMax(){return this.sub.getMax()}get closed(){return this.sub.closed}}let fn;function xS(i){fn=i}function xb(){return fn!==void 0&&fn.defaultPort!==void 0?fn.defaultPort:4222}function Dh(){return fn!==void 0&&fn.urlParseFn?fn.urlParseFn:void 0}function _S(){if(!fn||typeof fn.factory!="function")throw new Error("transport fn is not set");return fn.factory()}function id(){return fn!==void 0&&fn.dnsResolveFn?fn.dnsResolveFn:void 0}const Ic=`\r
37
- `,Wc=Vs.fromAscii(Ic),wS=new Uint8Array(Wc)[0],SS=new Uint8Array(Wc)[1];function ES(i){for(let t=0;t<i.length;t++){const r=t+1;if(i.byteLength>r&&i[t]===wS&&i[r]===SS)return r+1}return 0}function OS(i){const t=ES(i);if(t>0){const s=new Uint8Array(i).slice(0,t);return un.decode(s)}return""}const AS=4,_b=48,jS=65,TS=97;function NS(i,t,r,s){const l=new Uint8Array(16);return[0,0,0,0,0,0,0,0,0,0,255,255].forEach((m,p)=>{l[p]=m}),l[12]=i,l[13]=t,l[14]=r,l[15]=s,l}function sd(i){return kS(i)!==void 0}function kS(i){for(let t=0;t<i.length;t++)switch(i[t]){case".":return wb(i);case":":return CS(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}=MS(i);if(!c||s>255)return;i=i.substring(l),t[r]=s}return NS(t[0],t[1],t[2],t[3])}function CS(i){const t=new Uint8Array(16);let r=-1;if(i.length>=2&&i[0]===":"&&i[1]===":"&&(r=0,i=i.substring(2),i.length===0))return t;let s=0;for(;s<16;){const{n:l,c,ok:m}=RS(i);if(!m||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+=AS;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 MS(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 RS(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)-TS+10;else if(65<=i.charCodeAt(r)&&i.charCodeAt(r)<=70)t*=16,t+=i.charCodeAt(r)-jS+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 DS(i){return i.indexOf("[")!==-1||i.indexOf("::")!==-1?!1:i.indexOf(".")!==-1||i.split(":").length<=2}function ad(i){return!DS(i)}function qS(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 BS(i){i=i.trim(),i.match(/^(.*:\/\/)(.*)/m)&&(i=i.replace(/^(.*:\/\/)(.*)/gm,"$2")),i=qS(i),ad(i)&&i.indexOf("[")===-1&&(i=`[${i}]`);const t=ad(i)?i.match(/(]:)(\d+)/):i.match(/(:)(\d+)/),r=t&&t.length===3&&t[1]&&t[2]?parseInt(t[2]):4222,s=r===80?"https":"http",l=new URL(`${s}://${i}`);l.port=`${r}`;let c=l.hostname;return c.charAt(0)==="["&&(c=c.substring(1,c.length-1)),{listen:l.host,hostname:c,port:r}}class oo{constructor(t,r=!1){A(this,"src");A(this,"listen");A(this,"hostname");A(this,"port");A(this,"didConnect");A(this,"reconnects");A(this,"lastConnect");A(this,"gossiped");A(this,"tlsName");A(this,"resolves");this.src=t,this.tlsName="";const s=BS(t);this.listen=s.listen,this.hostname=s.hostname,this.port=s.port,this.didConnect=!1,this.reconnects=0,this.lastConnect=0,this.gossiped=r}toString(){return this.listen}async resolve(t){if(!t.fn||t.resolve===!1)return[this];const r=[];if(sd(this.hostname))return[this];{const s=await t.fn(this.hostname);t.debug&&console.log(`resolve ${this.hostname} = ${s.join(",")}`);for(const l of s){const c=this.port===80?"https":"http",m=new URL(`${c}://${ad(l)?"["+l+"]":l}`);m.port=`${this.port}`;const p=new oo(m.host,!1);p.tlsName=this.hostname,r.push(p)}}return t.randomize&&pb(r),this.resolves=r,r}}class LS{constructor(t=[],r={}){A(this,"firstSelect");A(this,"servers");A(this,"currentServer");A(this,"tlsName");A(this,"randomize");this.firstSelect=!0,this.servers=[],this.tlsName="",this.randomize=r.randomize||!1;const s=Dh();t&&(t.forEach(l=>{l=s?s(l):l,this.servers.push(new oo(l))}),this.randomize&&(this.servers=pb(this.servers))),this.servers.length===0&&this.addServer(`${Jh}:${xb()}`,!1),this.currentServer=this.servers[0]}clear(){this.servers.length=0}updateTLSName(){const t=this.getCurrentServer();sd(t.hostname)||(this.tlsName=t.hostname,this.servers.forEach(r=>{r.gossiped&&(r.tlsName=this.tlsName)}))}getCurrentServer(){return this.currentServer}addServer(t,r=!1){const s=Dh();t=s?s(t):t;const l=new oo(t,r);sd(l.hostname)&&(l.tlsName=this.tlsName),this.servers.push(l)}selectServer(){if(this.firstSelect)return this.firstSelect=!1,this.currentServer;const t=this.servers.shift();return t&&(this.servers.push(t),this.currentServer=t),t}removeCurrentServer(){this.removeServer(this.currentServer)}removeServer(t){if(t){const r=this.servers.indexOf(t);this.servers.splice(r,1)}}length(){return this.servers.length}next(){return this.servers.length?this.servers[0]:void 0}getServers(){return this.servers}update(t,r){const s=[];let l=[];const c=Dh(),m=new Map;t.connect_urls&&t.connect_urls.length>0&&t.connect_urls.forEach(g=>{g=c?c(g,r):g;const f=new oo(g,!0);m.set(g,f)});const p=[];return this.servers.forEach((g,f)=>{const d=g.listen;g.gossiped&&this.currentServer.listen!==d&&m.get(d)===void 0&&p.push(f),m.delete(d)}),p.reverse(),p.forEach(g=>{const f=this.servers.splice(g,1);l=l.concat(f[0].listen)}),m.forEach((g,f)=>{this.servers.push(g),s.push(f)}),{added:s,deleted:l}}}class zS{constructor(){A(this,"baseInbox");A(this,"reqs");this.reqs=new Map}size(){return this.reqs.size}init(t){return this.baseInbox=`${wr(t)}.`,this.baseInbox}add(t){isNaN(t.received)||(t.received=0),this.reqs.set(t.token,t)}get(t){return this.reqs.get(t)}cancel(t){this.reqs.delete(t.token)}getToken(t){const r=t.subject||"";return r.indexOf(this.baseInbox)===0?r.substring(this.baseInbox.length):null}all(){return Array.from(this.reqs.values())}handleError(t,r){if(r&&r.permissionContext){if(t)return this.all().forEach(l=>{l.resolver(r,{})}),!0;const s=r.permissionContext;if(s.operation==="publish"){const l=this.all().find(c=>c.requestSubject===s.subject);if(l)return l.resolver(r,{}),!0}}return!1}dispatcher(){return(t,r)=>{const s=this.getToken(r);if(s){const l=this.get(s);l&&(t===null&&r.headers&&(t=gb(r)),l.resolver(t,r))}}}close(){const t=me.errorForCode(ce.Timeout);this.reqs.forEach(r=>{r.resolver(t,{})})}}class US{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 PS extends Error{constructor(t){super(t),this.name="AssertionError"}}function IS(i,t="Assertion failed."){if(!i)throw new PS(t)}const uy=32*1024,qh=2**32-2;function Vl(i,t,r=0){const s=t.byteLength-r;return i.byteLength>s&&(i=i.subarray(0,s)),t.set(i,r),i.byteLength}class Bh{constructor(t){A(this,"_buf");A(this,"_off");if(this._off=0,t==null){this._buf=new Uint8Array(0);return}this._buf=new Uint8Array(t)}bytes(t={copy:!0}){return t.copy===!1?this._buf.subarray(this._off):this._buf.slice(this._off)}empty(){return this._buf.byteLength<=this._off}get length(){return this._buf.byteLength-this._off}get capacity(){return this._buf.buffer.byteLength}truncate(t){if(t===0){this.reset();return}if(t<0||t>this.length)throw Error("bytes.Buffer: truncation out of range");this._reslice(this._off+t)}reset(){this._reslice(0),this._off=0}_tryGrowByReslice(t){const r=this._buf.byteLength;return t<=this.capacity-r?(this._reslice(r+t),r):-1}_reslice(t){IS(t<=this._buf.buffer.byteLength),this._buf=new Uint8Array(this._buf.buffer,0,t)}readByte(){const t=new Uint8Array(1);return this.read(t)?t[0]:null}read(t){if(this.empty())return this.reset(),t.byteLength===0?0:null;const r=Vl(this._buf.subarray(this._off),t);return this._off+=r,r}writeByte(t){return this.write(Uint8Array.of(t))}writeString(t){return this.write(Hi.encode(t))}write(t){const r=this._grow(t.byteLength);return Vl(t,this._buf,r)}_grow(t){const r=this.length;r===0&&this._off!==0&&this.reset();const s=this._tryGrowByReslice(t);if(s>=0)return s;const l=this.capacity;if(t<=Math.floor(l/2)-r)Vl(this._buf.subarray(this._off),this._buf);else{if(l+t>qh)throw new Error("The buffer cannot be grown beyond the maximum size.");{const c=new Uint8Array(Math.min(2*l+t,qh));Vl(this._buf.subarray(this._off),c),this._buf=c}}return this._off=0,this._reslice(Math.min(r+t,qh)),r}grow(t){if(t<0)throw Error("Buffer._grow: negative count");const r=this._grow(t);this._reslice(r)}readFrom(t){let r=0;const s=new Uint8Array(uy);for(;;){const l=this.capacity-this.length<uy,c=l?s:new Uint8Array(this._buf.buffer,this.length),m=t.read(c);if(m===null)return r;l?this.write(c.subarray(0,m)):this._reslice(this.length+m),r+=m}}}var It;(function(i){i[i.OK=0]="OK",i[i.ERR=1]="ERR",i[i.MSG=2]="MSG",i[i.INFO=3]="INFO",i[i.PING=4]="PING",i[i.PONG=5]="PONG"})(It||(It={}));function fy(){const i={};return i.sid=-1,i.hdr=-1,i.size=-1,i}const $S=48;class hy{constructor(t){A(this,"dispatcher");A(this,"state");A(this,"as");A(this,"drop");A(this,"hdr");A(this,"ma");A(this,"argBuf");A(this,"msgBuf");this.dispatcher=t,this.state=ue.OP_START,this.as=0,this.drop=0,this.hdr=0}parse(t){let r;for(r=0;r<t.length;r++){const s=t[r];switch(this.state){case ue.OP_START:switch(s){case fe.M:case fe.m:this.state=ue.OP_M,this.hdr=-1,this.ma=fy();break;case fe.H:case fe.h:this.state=ue.OP_H,this.hdr=0,this.ma=fy();break;case fe.P:case fe.p:this.state=ue.OP_P;break;case fe.PLUS:this.state=ue.OP_PLUS;break;case fe.MINUS:this.state=ue.OP_MINUS;break;case fe.I:case fe.i:this.state=ue.OP_I;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_H:switch(s){case fe.M:case fe.m:this.state=ue.OP_M;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_M:switch(s){case fe.S:case fe.s:this.state=ue.OP_MS;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_MS:switch(s){case fe.G:case fe.g:this.state=ue.OP_MSG;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_MSG:switch(s){case fe.SPACE:case fe.TAB:this.state=ue.OP_MSG_SPC;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_MSG_SPC:switch(s){case fe.SPACE:case fe.TAB:continue;default:this.state=ue.MSG_ARG,this.as=r}break;case ue.MSG_ARG:switch(s){case fe.CR:this.drop=1;break;case fe.NL:{const l=this.argBuf?this.argBuf.bytes():t.subarray(this.as,r-this.drop);this.processMsgArgs(l),this.drop=0,this.as=r+1,this.state=ue.MSG_PAYLOAD,r=this.as+this.ma.size-1;break}default:this.argBuf&&this.argBuf.writeByte(s)}break;case ue.MSG_PAYLOAD:if(this.msgBuf)if(this.msgBuf.length>=this.ma.size){const l=this.msgBuf.bytes({copy:!1});this.dispatcher.push({kind:It.MSG,msg:this.ma,data:l}),this.argBuf=void 0,this.msgBuf=void 0,this.state=ue.MSG_END}else{let l=this.ma.size-this.msgBuf.length;const c=t.length-r;c<l&&(l=c),l>0?(this.msgBuf.write(t.subarray(r,r+l)),r=r+l-1):this.msgBuf.writeByte(s)}else r-this.as>=this.ma.size&&(this.dispatcher.push({kind:It.MSG,msg:this.ma,data:t.subarray(this.as,r)}),this.argBuf=void 0,this.msgBuf=void 0,this.state=ue.MSG_END);break;case ue.MSG_END:switch(s){case fe.NL:this.drop=0,this.as=r+1,this.state=ue.OP_START;break;default:continue}break;case ue.OP_PLUS:switch(s){case fe.O:case fe.o:this.state=ue.OP_PLUS_O;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_PLUS_O:switch(s){case fe.K:case fe.k:this.state=ue.OP_PLUS_OK;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_PLUS_OK:switch(s){case fe.NL:this.dispatcher.push({kind:It.OK}),this.drop=0,this.state=ue.OP_START;break}break;case ue.OP_MINUS:switch(s){case fe.E:case fe.e:this.state=ue.OP_MINUS_E;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_MINUS_E:switch(s){case fe.R:case fe.r:this.state=ue.OP_MINUS_ER;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_MINUS_ER:switch(s){case fe.R:case fe.r:this.state=ue.OP_MINUS_ERR;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_MINUS_ERR:switch(s){case fe.SPACE:case fe.TAB:this.state=ue.OP_MINUS_ERR_SPC;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_MINUS_ERR_SPC:switch(s){case fe.SPACE:case fe.TAB:continue;default:this.state=ue.MINUS_ERR_ARG,this.as=r}break;case ue.MINUS_ERR_ARG:switch(s){case fe.CR:this.drop=1;break;case fe.NL:{let l;this.argBuf?(l=this.argBuf.bytes(),this.argBuf=void 0):l=t.subarray(this.as,r-this.drop),this.dispatcher.push({kind:It.ERR,data:l}),this.drop=0,this.as=r+1,this.state=ue.OP_START;break}default:this.argBuf&&this.argBuf.write(Uint8Array.of(s))}break;case ue.OP_P:switch(s){case fe.I:case fe.i:this.state=ue.OP_PI;break;case fe.O:case fe.o:this.state=ue.OP_PO;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_PO:switch(s){case fe.N:case fe.n:this.state=ue.OP_PON;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_PON:switch(s){case fe.G:case fe.g:this.state=ue.OP_PONG;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_PONG:switch(s){case fe.NL:this.dispatcher.push({kind:It.PONG}),this.drop=0,this.state=ue.OP_START;break}break;case ue.OP_PI:switch(s){case fe.N:case fe.n:this.state=ue.OP_PIN;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_PIN:switch(s){case fe.G:case fe.g:this.state=ue.OP_PING;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_PING:switch(s){case fe.NL:this.dispatcher.push({kind:It.PING}),this.drop=0,this.state=ue.OP_START;break}break;case ue.OP_I:switch(s){case fe.N:case fe.n:this.state=ue.OP_IN;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_IN:switch(s){case fe.F:case fe.f:this.state=ue.OP_INF;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_INF:switch(s){case fe.O:case fe.o:this.state=ue.OP_INFO;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_INFO:switch(s){case fe.SPACE:case fe.TAB:this.state=ue.OP_INFO_SPC;break;default:throw this.fail(t.subarray(r))}break;case ue.OP_INFO_SPC:switch(s){case fe.SPACE:case fe.TAB:continue;default:this.state=ue.INFO_ARG,this.as=r}break;case ue.INFO_ARG:switch(s){case fe.CR:this.drop=1;break;case fe.NL:{let l;this.argBuf?(l=this.argBuf.bytes(),this.argBuf=void 0):l=t.subarray(this.as,r-this.drop),this.dispatcher.push({kind:It.INFO,data:l}),this.drop=0,this.as=r+1,this.state=ue.OP_START;break}default:this.argBuf&&this.argBuf.writeByte(s)}break;default:throw this.fail(t.subarray(r))}}(this.state===ue.MSG_ARG||this.state===ue.MINUS_ERR_ARG||this.state===ue.INFO_ARG)&&!this.argBuf&&(this.argBuf=new Bh(t.subarray(this.as,r-this.drop))),this.state===ue.MSG_PAYLOAD&&!this.msgBuf&&(this.argBuf||this.cloneMsgArg(),this.msgBuf=new Bh(t.subarray(this.as)))}cloneMsgArg(){const t=this.ma.subject.length,r=this.ma.reply?this.ma.reply.length:0,s=new Uint8Array(t+r);s.set(this.ma.subject),this.ma.reply&&s.set(this.ma.reply,t),this.argBuf=new Bh(s),this.ma.subject=s.subarray(0,t),this.ma.reply&&(this.ma.reply=s.subarray(t))}processMsgArgs(t){if(this.hdr>=0)return this.processHeaderMsgArgs(t);const r=[];let s=-1;for(let l=0;l<t.length;l++)switch(t[l]){case fe.SPACE:case fe.TAB:case fe.CR:case fe.NL:s>=0&&(r.push(t.subarray(s,l)),s=-1);break;default:s<0&&(s=l)}switch(s>=0&&r.push(t.subarray(s)),r.length){case 3:this.ma.subject=r[0],this.ma.sid=this.protoParseInt(r[1]),this.ma.reply=void 0,this.ma.size=this.protoParseInt(r[2]);break;case 4:this.ma.subject=r[0],this.ma.sid=this.protoParseInt(r[1]),this.ma.reply=r[2],this.ma.size=this.protoParseInt(r[3]);break;default:throw this.fail(t,"processMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(t,"processMsgArgs Bad or Missing Sid Error");if(this.ma.size<0)throw this.fail(t,"processMsgArgs Bad or Missing Size Error")}fail(t,r=""){return r?r=`${r} [${this.state}]`:r=`parse error [${this.state}]`,new Error(`${r}: ${un.decode(t)}`)}processHeaderMsgArgs(t){const r=[];let s=-1;for(let l=0;l<t.length;l++)switch(t[l]){case fe.SPACE:case fe.TAB:case fe.CR:case fe.NL:s>=0&&(r.push(t.subarray(s,l)),s=-1);break;default:s<0&&(s=l)}switch(s>=0&&r.push(t.subarray(s)),r.length){case 4:this.ma.subject=r[0],this.ma.sid=this.protoParseInt(r[1]),this.ma.reply=void 0,this.ma.hdr=this.protoParseInt(r[2]),this.ma.size=this.protoParseInt(r[3]);break;case 5:this.ma.subject=r[0],this.ma.sid=this.protoParseInt(r[1]),this.ma.reply=r[2],this.ma.hdr=this.protoParseInt(r[3]),this.ma.size=this.protoParseInt(r[4]);break;default:throw this.fail(t,"processHeaderMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(t,"processHeaderMsgArgs Bad or Missing Sid Error");if(this.ma.hdr<0||this.ma.hdr>this.ma.size)throw this.fail(t,"processHeaderMsgArgs Bad or Missing Header Size Error");if(this.ma.size<0)throw this.fail(t,"processHeaderMsgArgs Bad or Missing Size Error")}protoParseInt(t){if(t.length===0)return-1;let r=0;for(let s=0;s<t.length;s++){if(t[s]<48||t[s]>57)return-1;r=r*10+(t[s]-$S)}return r}}var ue;(function(i){i[i.OP_START=0]="OP_START",i[i.OP_PLUS=1]="OP_PLUS",i[i.OP_PLUS_O=2]="OP_PLUS_O",i[i.OP_PLUS_OK=3]="OP_PLUS_OK",i[i.OP_MINUS=4]="OP_MINUS",i[i.OP_MINUS_E=5]="OP_MINUS_E",i[i.OP_MINUS_ER=6]="OP_MINUS_ER",i[i.OP_MINUS_ERR=7]="OP_MINUS_ERR",i[i.OP_MINUS_ERR_SPC=8]="OP_MINUS_ERR_SPC",i[i.MINUS_ERR_ARG=9]="MINUS_ERR_ARG",i[i.OP_M=10]="OP_M",i[i.OP_MS=11]="OP_MS",i[i.OP_MSG=12]="OP_MSG",i[i.OP_MSG_SPC=13]="OP_MSG_SPC",i[i.MSG_ARG=14]="MSG_ARG",i[i.MSG_PAYLOAD=15]="MSG_PAYLOAD",i[i.MSG_END=16]="MSG_END",i[i.OP_H=17]="OP_H",i[i.OP_P=18]="OP_P",i[i.OP_PI=19]="OP_PI",i[i.OP_PIN=20]="OP_PIN",i[i.OP_PING=21]="OP_PING",i[i.OP_PO=22]="OP_PO",i[i.OP_PON=23]="OP_PON",i[i.OP_PONG=24]="OP_PONG",i[i.OP_I=25]="OP_I",i[i.OP_IN=26]="OP_IN",i[i.OP_INF=27]="OP_INF",i[i.OP_INFO=28]="OP_INFO",i[i.OP_INFO_SPC=29]="OP_INFO_SPC",i[i.INFO_ARG=30]="INFO_ARG"})(ue||(ue={}));var fe;(function(i){i[i.CR=13]="CR",i[i.E=69]="E",i[i.e=101]="e",i[i.F=70]="F",i[i.f=102]="f",i[i.G=71]="G",i[i.g=103]="g",i[i.H=72]="H",i[i.h=104]="h",i[i.I=73]="I",i[i.i=105]="i",i[i.K=75]="K",i[i.k=107]="k",i[i.M=77]="M",i[i.m=109]="m",i[i.MINUS=45]="MINUS",i[i.N=78]="N",i[i.n=110]="n",i[i.NL=10]="NL",i[i.O=79]="O",i[i.o=111]="o",i[i.P=80]="P",i[i.p=112]="p",i[i.PLUS=43]="PLUS",i[i.R=82]="R",i[i.r=114]="r",i[i.S=83]="S",i[i.s=115]="s",i[i.SPACE=32]="SPACE",i[i.TAB=9]="TAB"})(fe||(fe={}));(function(i){var t=function(O,N){this.hi=O|0,this.lo=N|0},r=function(O){var N,T=new Float64Array(16);if(O)for(N=0;N<O.length;N++)T[N]=O[N];return T},s=function(){throw new Error("no PRNG")},l=new Uint8Array(16),c=new Uint8Array(32);c[0]=9;var m=r(),p=r([1]),g=r([56129,1]),f=r([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),d=r([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),b=r([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),v=r([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),_=r([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function w(O,N){return O<<N|O>>>32-N}function S(O,N){var T=O[N+3]&255;return T=T<<8|O[N+2]&255,T=T<<8|O[N+1]&255,T<<8|O[N+0]&255}function M(O,N){var T=O[N]<<24|O[N+1]<<16|O[N+2]<<8|O[N+3],k=O[N+4]<<24|O[N+5]<<16|O[N+6]<<8|O[N+7];return new t(T,k)}function L(O,N,T){var k;for(k=0;k<4;k++)O[N+k]=T&255,T>>>=8}function z(O,N,T){O[N]=T.hi>>24&255,O[N+1]=T.hi>>16&255,O[N+2]=T.hi>>8&255,O[N+3]=T.hi&255,O[N+4]=T.lo>>24&255,O[N+5]=T.lo>>16&255,O[N+6]=T.lo>>8&255,O[N+7]=T.lo&255}function ie(O,N,T,k,D){var P,te=0;for(P=0;P<D;P++)te|=O[N+P]^T[k+P];return(1&te-1>>>8)-1}function ae(O,N,T,k){return ie(O,N,T,k,16)}function C(O,N,T,k){return ie(O,N,T,k,32)}function I(O,N,T,k,D){var P=new Uint32Array(16),te=new Uint32Array(16),se=new Uint32Array(16),V=new Uint32Array(4),ee,pe,Re;for(ee=0;ee<4;ee++)te[5*ee]=S(k,4*ee),te[1+ee]=S(T,4*ee),te[6+ee]=S(N,4*ee),te[11+ee]=S(T,16+4*ee);for(ee=0;ee<16;ee++)se[ee]=te[ee];for(ee=0;ee<20;ee++){for(pe=0;pe<4;pe++){for(Re=0;Re<4;Re++)V[Re]=te[(5*pe+4*Re)%16];for(V[1]^=w(V[0]+V[3]|0,7),V[2]^=w(V[1]+V[0]|0,9),V[3]^=w(V[2]+V[1]|0,13),V[0]^=w(V[3]+V[2]|0,18),Re=0;Re<4;Re++)P[4*pe+(pe+Re)%4]=V[Re]}for(Re=0;Re<16;Re++)te[Re]=P[Re]}if(D){for(ee=0;ee<16;ee++)te[ee]=te[ee]+se[ee]|0;for(ee=0;ee<4;ee++)te[5*ee]=te[5*ee]-S(k,4*ee)|0,te[6+ee]=te[6+ee]-S(N,4*ee)|0;for(ee=0;ee<4;ee++)L(O,4*ee,te[5*ee]),L(O,16+4*ee,te[6+ee])}else for(ee=0;ee<16;ee++)L(O,4*ee,te[ee]+se[ee]|0)}function re(O,N,T,k){return I(O,N,T,k,!1),0}function K(O,N,T,k){return I(O,N,T,k,!0),0}var B=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function G(O,N,T,k,D,P,te){var se=new Uint8Array(16),V=new Uint8Array(64),ee,pe;if(!D)return 0;for(pe=0;pe<16;pe++)se[pe]=0;for(pe=0;pe<8;pe++)se[pe]=P[pe];for(;D>=64;){for(re(V,se,te,B),pe=0;pe<64;pe++)O[N+pe]=(T?T[k+pe]:0)^V[pe];for(ee=1,pe=8;pe<16;pe++)ee=ee+(se[pe]&255)|0,se[pe]=ee&255,ee>>>=8;D-=64,N+=64,T&&(k+=64)}if(D>0)for(re(V,se,te,B),pe=0;pe<D;pe++)O[N+pe]=(T?T[k+pe]:0)^V[pe];return 0}function W(O,N,T,k,D){return G(O,N,null,0,T,k,D)}function Q(O,N,T,k,D){var P=new Uint8Array(32);return K(P,k,D,B),W(O,N,T,k.subarray(16),P)}function he(O,N,T,k,D,P,te){var se=new Uint8Array(32);return K(se,P,te,B),G(O,N,T,k,D,P.subarray(16),se)}function _e(O,N){var T,k=0;for(T=0;T<17;T++)k=k+(O[T]+N[T]|0)|0,O[T]=k&255,k>>>=8}var Te=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]);function Y(O,N,T,k,D,P){var te,se,V,ee,pe=new Uint32Array(17),Re=new Uint32Array(17),We=new Uint32Array(17),Lt=new Uint32Array(17),Dn=new Uint32Array(17);for(V=0;V<17;V++)Re[V]=We[V]=0;for(V=0;V<16;V++)Re[V]=P[V];for(Re[3]&=15,Re[4]&=252,Re[7]&=15,Re[8]&=252,Re[11]&=15,Re[12]&=252,Re[15]&=15;D>0;){for(V=0;V<17;V++)Lt[V]=0;for(V=0;V<16&&V<D;++V)Lt[V]=T[k+V];for(Lt[V]=1,k+=V,D-=V,_e(We,Lt),se=0;se<17;se++)for(pe[se]=0,V=0;V<17;V++)pe[se]=pe[se]+We[V]*(V<=se?Re[se-V]:320*Re[se+17-V]|0)|0|0;for(se=0;se<17;se++)We[se]=pe[se];for(ee=0,V=0;V<16;V++)ee=ee+We[V]|0,We[V]=ee&255,ee>>>=8;for(ee=ee+We[16]|0,We[16]=ee&3,ee=5*(ee>>>2)|0,V=0;V<16;V++)ee=ee+We[V]|0,We[V]=ee&255,ee>>>=8;ee=ee+We[16]|0,We[16]=ee}for(V=0;V<17;V++)Dn[V]=We[V];for(_e(We,Te),te=-(We[16]>>>7)|0,V=0;V<17;V++)We[V]^=te&(Dn[V]^We[V]);for(V=0;V<16;V++)Lt[V]=P[V+16];for(Lt[16]=0,_e(We,Lt),V=0;V<16;V++)O[N+V]=We[V];return 0}function oe(O,N,T,k,D,P){var te=new Uint8Array(16);return Y(te,0,T,k,D,P),ae(O,N,te,0)}function de(O,N,T,k,D){var P;if(T<32)return-1;for(he(O,0,N,0,T,k,D),Y(O,16,O,32,T-32,O),P=0;P<16;P++)O[P]=0;return 0}function Oe(O,N,T,k,D){var P,te=new Uint8Array(32);if(T<32||(Q(te,0,32,k,D),oe(N,16,N,32,T-32,te)!==0))return-1;for(he(O,0,N,0,T,k,D),P=0;P<32;P++)O[P]=0;return 0}function le(O,N){var T;for(T=0;T<16;T++)O[T]=N[T]|0}function je(O){var N,T;for(T=0;T<16;T++)O[T]+=65536,N=Math.floor(O[T]/65536),O[(T+1)*(T<15?1:0)]+=N-1+37*(N-1)*(T===15?1:0),O[T]-=N*65536}function Se(O,N,T){for(var k,D=~(T-1),P=0;P<16;P++)k=D&(O[P]^N[P]),O[P]^=k,N[P]^=k}function Ne(O,N){var T,k,D,P=r(),te=r();for(T=0;T<16;T++)te[T]=N[T];for(je(te),je(te),je(te),k=0;k<2;k++){for(P[0]=te[0]-65517,T=1;T<15;T++)P[T]=te[T]-65535-(P[T-1]>>16&1),P[T-1]&=65535;P[15]=te[15]-32767-(P[14]>>16&1),D=P[15]>>16&1,P[14]&=65535,Se(te,P,1-D)}for(T=0;T<16;T++)O[2*T]=te[T]&255,O[2*T+1]=te[T]>>8}function be(O,N){var T=new Uint8Array(32),k=new Uint8Array(32);return Ne(T,O),Ne(k,N),C(T,0,k,0)}function at(O){var N=new Uint8Array(32);return Ne(N,O),N[0]&1}function Ht(O,N){var T;for(T=0;T<16;T++)O[T]=N[2*T]+(N[2*T+1]<<8);O[15]&=32767}function Rt(O,N,T){var k;for(k=0;k<16;k++)O[k]=N[k]+T[k]|0}function Dt(O,N,T){var k;for(k=0;k<16;k++)O[k]=N[k]-T[k]|0}function ke(O,N,T){var k,D,P=new Float64Array(31);for(k=0;k<31;k++)P[k]=0;for(k=0;k<16;k++)for(D=0;D<16;D++)P[k+D]+=N[k]*T[D];for(k=0;k<15;k++)P[k]+=38*P[k+16];for(k=0;k<16;k++)O[k]=P[k];je(O),je(O)}function qt(O,N){ke(O,N,N)}function di(O,N){var T=r(),k;for(k=0;k<16;k++)T[k]=N[k];for(k=253;k>=0;k--)qt(T,T),k!==2&&k!==4&&ke(T,T,N);for(k=0;k<16;k++)O[k]=T[k]}function Gi(O,N){var T=r(),k;for(k=0;k<16;k++)T[k]=N[k];for(k=250;k>=0;k--)qt(T,T),k!==1&&ke(T,T,N);for(k=0;k<16;k++)O[k]=T[k]}function mi(O,N,T){var k=new Uint8Array(32),D=new Float64Array(80),P,te,se=r(),V=r(),ee=r(),pe=r(),Re=r(),We=r();for(te=0;te<31;te++)k[te]=N[te];for(k[31]=N[31]&127|64,k[0]&=248,Ht(D,T),te=0;te<16;te++)V[te]=D[te],pe[te]=se[te]=ee[te]=0;for(se[0]=pe[0]=1,te=254;te>=0;--te)P=k[te>>>3]>>>(te&7)&1,Se(se,V,P),Se(ee,pe,P),Rt(Re,se,ee),Dt(se,se,ee),Rt(ee,V,pe),Dt(V,V,pe),qt(pe,Re),qt(We,se),ke(se,ee,se),ke(ee,V,Re),Rt(Re,se,ee),Dt(se,se,ee),qt(V,se),Dt(ee,pe,We),ke(se,ee,g),Rt(se,se,pe),ke(ee,ee,se),ke(se,pe,We),ke(pe,V,D),qt(V,Re),Se(se,V,P),Se(ee,pe,P);for(te=0;te<16;te++)D[te+16]=se[te],D[te+32]=ee[te],D[te+48]=V[te],D[te+64]=pe[te];var Lt=D.subarray(32),Dn=D.subarray(16);return di(Lt,Lt),ke(Dn,Dn,Lt),Ne(O,Dn),0}function yn(O,N){return mi(O,N,c)}function Fi(O,N){return s(N,32),yn(O,N)}function Ar(O,N,T){var k=new Uint8Array(32);return mi(k,T,N),K(O,l,k,B)}var Eo=de,Oo=Oe;function Js(O,N,T,k,D,P){var te=new Uint8Array(32);return Ar(te,D,P),Eo(O,N,T,k,te)}function Qs(O,N,T,k,D,P){var te=new Uint8Array(32);return Ar(te,D,P),Oo(O,N,T,k,te)}function Wn(){var O=0,N=0,T=0,k=0,D=65535,P,te,se;for(se=0;se<arguments.length;se++)P=arguments[se].lo,te=arguments[se].hi,O+=P&D,N+=P>>>16,T+=te&D,k+=te>>>16;return N+=O>>>16,T+=N>>>16,k+=T>>>16,new t(T&D|k<<16,O&D|N<<16)}function Ao(O,N){return new t(O.hi>>>N,O.lo>>>N|O.hi<<32-N)}function Vi(){var O=0,N=0,T;for(T=0;T<arguments.length;T++)O^=arguments[T].lo,N^=arguments[T].hi;return new t(N,O)}function nt(O,N){var T,k,D=32-N;return N<32?(T=O.hi>>>N|O.lo<<D,k=O.lo>>>N|O.hi<<D):N<64&&(T=O.lo>>>N|O.hi<<D,k=O.hi>>>N|O.lo<<D),new t(T,k)}function yu(O,N,T){var k=O.hi&N.hi^~O.hi&T.hi,D=O.lo&N.lo^~O.lo&T.lo;return new t(k,D)}function jo(O,N,T){var k=O.hi&N.hi^O.hi&T.hi^N.hi&T.hi,D=O.lo&N.lo^O.lo&T.lo^N.lo&T.lo;return new t(k,D)}function To(O){return Vi(nt(O,28),nt(O,34),nt(O,39))}function Yi(O){return Vi(nt(O,14),nt(O,18),nt(O,41))}function bu(O){return Vi(nt(O,1),nt(O,8),Ao(O,7))}function No(O){return Vi(nt(O,19),nt(O,61),Ao(O,6))}var vu=[new t(1116352408,3609767458),new t(1899447441,602891725),new t(3049323471,3964484399),new t(3921009573,2173295548),new t(961987163,4081628472),new t(1508970993,3053834265),new t(2453635748,2937671579),new t(2870763221,3664609560),new t(3624381080,2734883394),new t(310598401,1164996542),new t(607225278,1323610764),new t(1426881987,3590304994),new t(1925078388,4068182383),new t(2162078206,991336113),new t(2614888103,633803317),new t(3248222580,3479774868),new t(3835390401,2666613458),new t(4022224774,944711139),new t(264347078,2341262773),new t(604807628,2007800933),new t(770255983,1495990901),new t(1249150122,1856431235),new t(1555081692,3175218132),new t(1996064986,2198950837),new t(2554220882,3999719339),new t(2821834349,766784016),new t(2952996808,2566594879),new t(3210313671,3203337956),new t(3336571891,1034457026),new t(3584528711,2466948901),new t(113926993,3758326383),new t(338241895,168717936),new t(666307205,1188179964),new t(773529912,1546045734),new t(1294757372,1522805485),new t(1396182291,2643833823),new t(1695183700,2343527390),new t(1986661051,1014477480),new t(2177026350,1206759142),new t(2456956037,344077627),new t(2730485921,1290863460),new t(2820302411,3158454273),new t(3259730800,3505952657),new t(3345764771,106217008),new t(3516065817,3606008344),new t(3600352804,1432725776),new t(4094571909,1467031594),new t(275423344,851169720),new t(430227734,3100823752),new t(506948616,1363258195),new t(659060556,3750685593),new t(883997877,3785050280),new t(958139571,3318307427),new t(1322822218,3812723403),new t(1537002063,2003034995),new t(1747873779,3602036899),new t(1955562222,1575990012),new t(2024104815,1125592928),new t(2227730452,2716904306),new t(2361852424,442776044),new t(2428436474,593698344),new t(2756734187,3733110249),new t(3204031479,2999351573),new t(3329325298,3815920427),new t(3391569614,3928383900),new t(3515267271,566280711),new t(3940187606,3454069534),new t(4118630271,4000239992),new t(116418474,1914138554),new t(174292421,2731055270),new t(289380356,3203993006),new t(460393269,320620315),new t(685471733,587496836),new t(852142971,1086792851),new t(1017036298,365543100),new t(1126000580,2618297676),new t(1288033470,3409855158),new t(1501505948,4234509866),new t(1607167915,987167468),new t(1816402316,1246189591)];function ko(O,N,T){var k=[],D=[],P=[],te=[],se,V,ee;for(V=0;V<8;V++)k[V]=P[V]=M(O,8*V);for(var pe=0;T>=128;){for(V=0;V<16;V++)te[V]=M(N,8*V+pe);for(V=0;V<80;V++){for(ee=0;ee<8;ee++)D[ee]=P[ee];for(se=Wn(P[7],Yi(P[4]),yu(P[4],P[5],P[6]),vu[V],te[V%16]),D[7]=Wn(se,To(P[0]),jo(P[0],P[1],P[2])),D[3]=Wn(D[3],se),ee=0;ee<8;ee++)P[(ee+1)%8]=D[ee];if(V%16===15)for(ee=0;ee<16;ee++)te[ee]=Wn(te[ee],te[(ee+9)%16],bu(te[(ee+1)%16]),No(te[(ee+14)%16]))}for(V=0;V<8;V++)P[V]=Wn(P[V],k[V]),k[V]=P[V];pe+=128,T-=128}for(V=0;V<8;V++)z(O,8*V,k[V]);return T}var pi=new Uint8Array([106,9,230,103,243,188,201,8,187,103,174,133,132,202,167,59,60,110,243,114,254,148,248,43,165,79,245,58,95,29,54,241,81,14,82,127,173,230,130,209,155,5,104,140,43,62,108,31,31,131,217,171,251,65,189,107,91,224,205,25,19,126,33,121]);function ft(O,N,T){var k=new Uint8Array(64),D=new Uint8Array(256),P,te=T;for(P=0;P<64;P++)k[P]=pi[P];for(ko(k,N,T),T%=128,P=0;P<256;P++)D[P]=0;for(P=0;P<T;P++)D[P]=N[te-T+P];for(D[T]=128,T=256-128*(T<112?1:0),D[T-9]=0,z(D,T-8,new t(te/536870912|0,te<<3)),ko(k,D,T),P=0;P<64;P++)O[P]=k[P];return 0}function Jt(O,N){var T=r(),k=r(),D=r(),P=r(),te=r(),se=r(),V=r(),ee=r(),pe=r();Dt(T,O[1],O[0]),Dt(pe,N[1],N[0]),ke(T,T,pe),Rt(k,O[0],O[1]),Rt(pe,N[0],N[1]),ke(k,k,pe),ke(D,O[3],N[3]),ke(D,D,d),ke(P,O[2],N[2]),Rt(P,P,P),Dt(te,k,T),Dt(se,P,D),Rt(V,P,D),Rt(ee,k,T),ke(O[0],te,se),ke(O[1],ee,V),ke(O[2],V,se),ke(O[3],te,ee)}function Bt(O,N,T){var k;for(k=0;k<4;k++)Se(O[k],N[k],T)}function Zs(O,N){var T=r(),k=r(),D=r();di(D,N[2]),ke(T,N[0],D),ke(k,N[1],D),Ne(O,k),O[31]^=at(T)<<7}function Ws(O,N,T){var k,D;for(le(O[0],m),le(O[1],p),le(O[2],p),le(O[3],m),D=255;D>=0;--D)k=T[D/8|0]>>(D&7)&1,Bt(O,N,k),Jt(N,O),Jt(O,O),Bt(O,N,k)}function Xi(O,N){var T=[r(),r(),r(),r()];le(T[0],b),le(T[1],v),le(T[2],p),ke(T[3],b,v),Ws(O,T,N)}function jr(O,N,T){var k=new Uint8Array(64),D=[r(),r(),r(),r()],P;for(T||s(N,32),ft(k,N,32),k[0]&=248,k[31]&=127,k[31]|=64,Xi(D,k),Zs(O,D),P=0;P<32;P++)N[P+32]=O[P];return 0}var er=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Tr(O,N){var T,k,D,P;for(k=63;k>=32;--k){for(T=0,D=k-32,P=k-12;D<P;++D)N[D]+=T-16*N[k]*er[D-(k-32)],T=Math.floor((N[D]+128)/256),N[D]-=T*256;N[D]+=T,N[k]=0}for(T=0,D=0;D<32;D++)N[D]+=T-(N[31]>>4)*er[D],T=N[D]>>8,N[D]&=255;for(D=0;D<32;D++)N[D]-=T*er[D];for(k=0;k<32;k++)N[k+1]+=N[k]>>8,O[k]=N[k]&255}function Mn(O){var N=new Float64Array(64),T;for(T=0;T<64;T++)N[T]=O[T];for(T=0;T<64;T++)O[T]=0;Tr(O,N)}function gi(O,N,T,k){var D=new Uint8Array(64),P=new Uint8Array(64),te=new Uint8Array(64),se,V,ee=new Float64Array(64),pe=[r(),r(),r(),r()];ft(D,k,32),D[0]&=248,D[31]&=127,D[31]|=64;var Re=T+64;for(se=0;se<T;se++)O[64+se]=N[se];for(se=0;se<32;se++)O[32+se]=D[32+se];for(ft(te,O.subarray(32),T+32),Mn(te),Xi(pe,te),Zs(O,pe),se=32;se<64;se++)O[se]=k[se];for(ft(P,O,T+64),Mn(P),se=0;se<64;se++)ee[se]=0;for(se=0;se<32;se++)ee[se]=te[se];for(se=0;se<32;se++)for(V=0;V<32;V++)ee[se+V]+=P[se]*D[V];return Tr(O.subarray(32),ee),Re}function yi(O,N){var T=r(),k=r(),D=r(),P=r(),te=r(),se=r(),V=r();return le(O[2],p),Ht(O[1],N),qt(D,O[1]),ke(P,D,f),Dt(D,D,O[2]),Rt(P,O[2],P),qt(te,P),qt(se,te),ke(V,se,te),ke(T,V,D),ke(T,T,P),Gi(T,T),ke(T,T,D),ke(T,T,P),ke(T,T,P),ke(O[0],T,P),qt(k,O[0]),ke(k,k,P),be(k,D)&&ke(O[0],O[0],_),qt(k,O[0]),ke(k,k,P),be(k,D)?-1:(at(O[0])===N[31]>>7&&Dt(O[0],m,O[0]),ke(O[3],O[0],O[1]),0)}function ea(O,N,T,k){var D,P=new Uint8Array(32),te=new Uint8Array(64),se=[r(),r(),r(),r()],V=[r(),r(),r(),r()];if(T<64||yi(V,k))return-1;for(D=0;D<T;D++)O[D]=N[D];for(D=0;D<32;D++)O[D+32]=k[D];if(ft(te,O,T),Mn(te),Ws(se,V,te),Xi(V,N.subarray(32)),Jt(se,V),Zs(P,se),T-=64,C(N,0,P,0)){for(D=0;D<T;D++)O[D]=0;return-1}for(D=0;D<T;D++)O[D]=N[D+64];return T}var Ki=32,Nr=24,Rn=32,kr=16,Cr=32,bi=32,Mr=32,tr=32,vi=32,ta=Nr,Co=Rn,Hn=kr,Qe=64,ot=32,Qt=64,xi=32,na=64;i.lowlevel={crypto_core_hsalsa20:K,crypto_stream_xor:he,crypto_stream:Q,crypto_stream_salsa20_xor:G,crypto_stream_salsa20:W,crypto_onetimeauth:Y,crypto_onetimeauth_verify:oe,crypto_verify_16:ae,crypto_verify_32:C,crypto_secretbox:de,crypto_secretbox_open:Oe,crypto_scalarmult:mi,crypto_scalarmult_base:yn,crypto_box_beforenm:Ar,crypto_box_afternm:Eo,crypto_box:Js,crypto_box_open:Qs,crypto_box_keypair:Fi,crypto_hash:ft,crypto_sign:gi,crypto_sign_keypair:jr,crypto_sign_open:ea,crypto_secretbox_KEYBYTES:Ki,crypto_secretbox_NONCEBYTES:Nr,crypto_secretbox_ZEROBYTES:Rn,crypto_secretbox_BOXZEROBYTES:kr,crypto_scalarmult_BYTES:Cr,crypto_scalarmult_SCALARBYTES:bi,crypto_box_PUBLICKEYBYTES:Mr,crypto_box_SECRETKEYBYTES:tr,crypto_box_BEFORENMBYTES:vi,crypto_box_NONCEBYTES:ta,crypto_box_ZEROBYTES:Co,crypto_box_BOXZEROBYTES:Hn,crypto_sign_BYTES:Qe,crypto_sign_PUBLICKEYBYTES:ot,crypto_sign_SECRETKEYBYTES:Qt,crypto_sign_SEEDBYTES:xi,crypto_hash_BYTES:na,gf:r,D:f,L:er,pack25519:Ne,unpack25519:Ht,M:ke,A:Rt,S:qt,Z:Dt,pow2523:Gi,add:Jt,set25519:le,modL:Tr,scalarmult:Ws,scalarbase:Xi};function Mo(O,N){if(O.length!==Ki)throw new Error("bad key size");if(N.length!==Nr)throw new Error("bad nonce size")}function Ro(O,N){if(O.length!==Mr)throw new Error("bad public key size");if(N.length!==tr)throw new Error("bad secret key size")}function wt(){for(var O=0;O<arguments.length;O++)if(!(arguments[O]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function Ji(O){for(var N=0;N<O.length;N++)O[N]=0}i.randomBytes=function(O){var N=new Uint8Array(O);return s(N,O),N},i.secretbox=function(O,N,T){wt(O,N,T),Mo(T,N);for(var k=new Uint8Array(Rn+O.length),D=new Uint8Array(k.length),P=0;P<O.length;P++)k[P+Rn]=O[P];return de(D,k,k.length,N,T),D.subarray(kr)},i.secretbox.open=function(O,N,T){wt(O,N,T),Mo(T,N);for(var k=new Uint8Array(kr+O.length),D=new Uint8Array(k.length),P=0;P<O.length;P++)k[P+kr]=O[P];return k.length<32||Oe(D,k,k.length,N,T)!==0?null:D.subarray(Rn)},i.secretbox.keyLength=Ki,i.secretbox.nonceLength=Nr,i.secretbox.overheadLength=kr,i.scalarMult=function(O,N){if(wt(O,N),O.length!==bi)throw new Error("bad n size");if(N.length!==Cr)throw new Error("bad p size");var T=new Uint8Array(Cr);return mi(T,O,N),T},i.scalarMult.base=function(O){if(wt(O),O.length!==bi)throw new Error("bad n size");var N=new Uint8Array(Cr);return yn(N,O),N},i.scalarMult.scalarLength=bi,i.scalarMult.groupElementLength=Cr,i.box=function(O,N,T,k){var D=i.box.before(T,k);return i.secretbox(O,N,D)},i.box.before=function(O,N){wt(O,N),Ro(O,N);var T=new Uint8Array(vi);return Ar(T,O,N),T},i.box.after=i.secretbox,i.box.open=function(O,N,T,k){var D=i.box.before(T,k);return i.secretbox.open(O,N,D)},i.box.open.after=i.secretbox.open,i.box.keyPair=function(){var O=new Uint8Array(Mr),N=new Uint8Array(tr);return Fi(O,N),{publicKey:O,secretKey:N}},i.box.keyPair.fromSecretKey=function(O){if(wt(O),O.length!==tr)throw new Error("bad secret key size");var N=new Uint8Array(Mr);return yn(N,O),{publicKey:N,secretKey:new Uint8Array(O)}},i.box.publicKeyLength=Mr,i.box.secretKeyLength=tr,i.box.sharedKeyLength=vi,i.box.nonceLength=ta,i.box.overheadLength=i.secretbox.overheadLength,i.sign=function(O,N){if(wt(O,N),N.length!==Qt)throw new Error("bad secret key size");var T=new Uint8Array(Qe+O.length);return gi(T,O,O.length,N),T},i.sign.open=function(O,N){if(wt(O,N),N.length!==ot)throw new Error("bad public key size");var T=new Uint8Array(O.length),k=ea(T,O,O.length,N);if(k<0)return null;for(var D=new Uint8Array(k),P=0;P<D.length;P++)D[P]=T[P];return D},i.sign.detached=function(O,N){for(var T=i.sign(O,N),k=new Uint8Array(Qe),D=0;D<k.length;D++)k[D]=T[D];return k},i.sign.detached.verify=function(O,N,T){if(wt(O,N,T),N.length!==Qe)throw new Error("bad signature size");if(T.length!==ot)throw new Error("bad public key size");var k=new Uint8Array(Qe+O.length),D=new Uint8Array(Qe+O.length),P;for(P=0;P<Qe;P++)k[P]=N[P];for(P=0;P<O.length;P++)k[P+Qe]=O[P];return ea(D,k,k.length,T)>=0},i.sign.keyPair=function(){var O=new Uint8Array(ot),N=new Uint8Array(Qt);return jr(O,N),{publicKey:O,secretKey:N}},i.sign.keyPair.fromSecretKey=function(O){if(wt(O),O.length!==Qt)throw new Error("bad secret key size");for(var N=new Uint8Array(ot),T=0;T<N.length;T++)N[T]=O[32+T];return{publicKey:N,secretKey:new Uint8Array(O)}},i.sign.keyPair.fromSeed=function(O){if(wt(O),O.length!==xi)throw new Error("bad seed size");for(var N=new Uint8Array(ot),T=new Uint8Array(Qt),k=0;k<32;k++)T[k]=O[k];return jr(N,T,!0),{publicKey:N,secretKey:T}},i.sign.publicKeyLength=ot,i.sign.secretKeyLength=Qt,i.sign.seedLength=xi,i.sign.signatureLength=Qe,i.hash=function(O){wt(O);var N=new Uint8Array(na);return ft(N,O,O.length),N},i.hash.hashLength=na,i.verify=function(O,N){return wt(O,N),O.length===0||N.length===0||O.length!==N.length?!1:ie(O,0,N,0,O.length)===0},i.setPRNG=function(O){s=O},(function(){var O=typeof globalThis<"u"?globalThis.crypto||globalThis.msCrypto:null;if(O&&O.getRandomValues){var N=65536;i.setPRNG(function(T,k){var D,P=new Uint8Array(k);for(D=0;D<k;D+=N)O.getRandomValues(P.subarray(D,D+Math.min(k-D,N)));for(D=0;D<k;D++)T[D]=P[D];Ji(P)})}else typeof require<"u"&&(O=require("crypto"),O&&O.randomBytes&&i.setPRNG(function(T,k){var D,P=O.randomBytes(k);for(D=0;D<k;D++)T[D]=P[D];Ji(P)}))})()})(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const Yl=typeof module<"u"&&module.exports?module.exports:globalThis.nacl;Yl.sign.keyPair.fromSeed,Yl.sign.detached,Yl.sign.detached.verify,Yl.randomBytes;var dy;(function(i){i.InvalidPrefixByte="nkeys: invalid prefix byte",i.InvalidKey="nkeys: invalid key",i.InvalidPublicKey="nkeys: invalid public key",i.InvalidSeedLen="nkeys: invalid seed length",i.InvalidSeed="nkeys: invalid seed",i.InvalidEncoding="nkeys: invalid encoded key",i.InvalidSignature="nkeys: signature verification failed",i.CannotSign="nkeys: cannot sign, no private key available",i.PublicKeyOnly="nkeys: no seed or private key available",i.InvalidChecksum="nkeys: invalid checksum",i.SerializationError="nkeys: serialization error",i.ApiError="nkeys: api error",i.ClearedPair="nkeys: pair is cleared"})(dy||(dy={}));var my;(function(i){i[i.Seed=144]="Seed",i[i.Private=120]="Private",i[i.Operator=112]="Operator",i[i.Server=104]="Server",i[i.Cluster=16]="Cluster",i[i.Account=0]="Account",i[i.User=160]="User"})(my||(my={}));function HS(i){return t=>{let r={};return i.forEach(s=>{const l=s(t)||{};r=Object.assign(r,l)}),r}}function GS(){return()=>{}}function FS(i,t){return()=>{const r=typeof i=="function"?i():i,s=typeof t=="function"?t():t;return{user:r,pass:s}}}function VS(i){return()=>({auth_token:typeof i=="function"?i():i})}const Sb=120*1e3,YS=2,Eb=2*1e3;function XS(){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 KS(i){const t=[];return typeof i.authenticator=="function"&&t.push(i.authenticator),Array.isArray(i.authenticator)&&t.push(...i.authenticator),i.token&&t.push(VS(i.token)),i.user&&t.push(FS(i.user,i.pass)),t.length===0?GS():HS(t)}function JS(i){const t=`${Jh}:${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",ce.InvalidOption);i.servers.length===0&&i.port&&(i.servers=[`${Jh}:${i.port}`]),i.servers&&i.servers.length===0&&(i.servers=[t]);const r=lu(XS(),i);if(r.authenticator=KS(r),["reconnectDelayHandler","authenticator"].forEach(s=>{if(r[s]&&typeof r[s]!="function")throw new me(`${s} option should be a function`,ce.NotFunction)}),r.reconnectDelayHandler||(r.reconnectDelayHandler=()=>{let s=r.tls?r.reconnectJitterTLS:r.reconnectJitter;return s&&(s++,s=Math.floor(Math.random()*s)),r.reconnectTimeWait+s}),r.inboxPrefix)try{wr(r.inboxPrefix)}catch(s){throw new me(s.message,ce.ApiError)}if(r.resolve===void 0&&(r.resolve=typeof id()=="function"),r.resolve&&typeof id()!="function")throw new me("'resolve' is not supported on this client",ce.InvalidOption);return r}function QS(i,t){const{proto:r,tls_required:s,tls_available:l}=i;if((r===void 0||r<1)&&t.noEcho)throw new me("noEcho",ce.ServerOptionNotAvailable);const c=s||l||!1;if(t.tls&&!c)throw new me("tls",ce.ServerOptionNotAvailable)}const ZS=1024*32,WS=/^INFO\s+([^\r\n]+)\r\n/i,eE=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 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
38
38
  `),py=so(`PING\r
39
- `);class tE{constructor(t,r,s){A(this,"echo");A(this,"no_responders");A(this,"protocol");A(this,"verbose");A(this,"pedantic");A(this,"jwt");A(this,"nkey");A(this,"sig");A(this,"user");A(this,"pass");A(this,"auth_token");A(this,"tls_required");A(this,"name");A(this,"lang");A(this,"version");A(this,"headers");this.protocol=1,this.version=t.version,this.lang=t.lang,this.echo=r.noEcho?!1:void 0,this.verbose=r.verbose,this.pedantic=r.pedantic,this.tls_required=r.tls?!0:void 0,this.name=r.name;const l=(r&&typeof r.authenticator=="function"?r.authenticator(s):{})||{};lu(this,l)}}class Ob extends jt{constructor(r,s,l={}){var m;super();A(this,"sid");A(this,"queue");A(this,"draining");A(this,"max");A(this,"subject");A(this,"drained");A(this,"protocol");A(this,"timer");A(this,"info");A(this,"cleanupFn");A(this,"closed");A(this,"requestSubject");lu(this,l),this.protocol=r,this.subject=s,this.draining=!1,this.noIterator=typeof l.callback=="function",this.closed=st();const c=!((m=r.options)!=null&&m.noAsyncTraces);l.timeout&&(this.timer=Gs(l.timeout,c),this.timer.then(()=>{this.timer=void 0}).catch(p=>{this.stop(p),this.noIterator&&this.callback(p,{})})),this.noIterator||this.iterClosed.then(()=>{this.closed.resolve(),this.unsubscribe()})}setPrePostHandlers(r){if(this.noIterator){const s=this.callback,l=r.ingestionFilterFn?r.ingestionFilterFn:()=>({ingest:!0,protocol:!1}),c=r.protocolFilterFn?r.protocolFilterFn:()=>!0,m=r.dispatchedFn?r.dispatchedFn:()=>{};this.callback=(p,g)=>{const{ingest:f}=l(g);f&&c(g)&&(s(p,g),m(g))}}else this.protocolFilterFn=r.protocolFilterFn,this.dispatchedFn=r.dispatchedFn}callback(r,s){this.cancelTimeout(),r?this.stop(r):this.push(s)}close(){if(!this.isClosed()){this.cancelTimeout();const r=()=>{if(this.stop(),this.cleanupFn)try{this.cleanupFn(this,this.info)}catch{}this.closed.resolve()};this.noIterator?r():this.push(r)}}unsubscribe(r){this.protocol.unsubscribe(this,r)}cancelTimeout(){this.timer&&(this.timer.cancel(),this.timer=void 0)}drain(){return this.protocol.isClosed()?Promise.reject(me.errorForCode(ce.ConnectionClosed)):this.isClosed()?Promise.reject(me.errorForCode(ce.SubClosed)):(this.drained||(this.draining=!0,this.protocol.unsub(this),this.drained=this.protocol.flush(st()).then(()=>{this.protocol.subscriptions.cancel(this)}).catch(()=>{this.protocol.subscriptions.cancel(this)})),this.drained)}isDraining(){return this.draining}isClosed(){return this.done}getSubject(){return this.subject}getMax(){return this.max}getID(){return this.sid}}class nE{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=ZS,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=t,this.publisher=r,this.subscriptions=new nE,this.muxSubscriptions=new zS,this.outbound=new Vs,this.pongs=[],this.whyClosed="",this.pendingLimit=t.pendingLimit||this.pendingLimit,this.features=new bS({major:0,minor:0,micro:0}),this.connectPromise=null;const s=typeof t.servers=="string"?[t.servers]:t.servers;this.servers=new LS(s,{randomize:!t.noRandomize}),this.closed=st(),this.parser=new hy(this),this.heartbeats=new US(this,this.options.pingInterval||Sb,this.options.maxPingOut||YS)}resetOutbound(){this.outbound.reset();const t=this.pongs;this.pongs=[];const r=me.errorForCode(ce.Disconnect);r.stack="",t.forEach(s=>{s.reject(r)}),this.parser=new hy(this),this.infoReceived=!1}dispatchStatus(t){this.listeners.forEach(r=>{r.push(t)})}status(){const t=new jt;return this.listeners.push(t),t}prepare(){this.transport&&this.transport.discard(),this.info=void 0,this.resetOutbound();const t=st();return t.catch(()=>{}),this.pongs.unshift(t),this.connectError=r=>{t.reject(r)},this.transport=_S(),this.transport.closed().then(async r=>{if(this.connected=!1,!this.isClosed()){await this.disconnected(this.transport.closeError||this.lastError);return}}),t}disconnect(){this.dispatchStatus({type:zs.StaleConnection,data:""}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:zs.ClientInitiatedReconnect,data:""}),this.transport.disconnect()),Promise.resolve()}async disconnected(t){this.dispatchStatus({type:_r.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{var r;this.dispatchStatus({type:_r.Reconnect,data:this.servers.getCurrentServer().toString()}),((r=this.lastError)==null?void 0:r.code)===ce.AuthenticationExpired&&(this.lastError=void 0)}).catch(r=>{this._close(r)}):await this._close(t)}async dial(t){const r=this.prepare();let s;try{s=Gs(this.options.timeout||2e4);const l=this.transport.connect(t,this.options);await Promise.race([l,s]),(async()=>{try{for await(const c of this.transport)this.parser.parse(c)}catch(c){console.log("reader closed",c)}})().then()}catch(l){r.reject(l)}try{await Promise.race([s,r]),s&&s.cancel(),this.connected=!0,this.connectError=void 0,this.sendSubscriptions(),this.connectedOnce=!0,this.server.didConnect=!0,this.server.reconnects=0,this.flushPending(),this.heartbeats.start()}catch(l){throw s&&s.cancel(),await this.transport.close(l),l}}async _doDial(t){const{resolve:r}=this.options,s=await t.resolve({fn:id(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:r});let l=null;for(const c of s)try{l=null,this.dispatchStatus({type:zs.Reconnecting,data:c.toString()}),await this.dial(c);return}catch(m){l=m}throw l}dialLoop(){return this.connectPromise===null&&(this.connectPromise=this.dodialLoop(),this.connectPromise.then(()=>{}).catch(()=>{}).finally(()=>{this.connectPromise=null})),this.connectPromise}async dodialLoop(){let t;for(;;){this._closed&&this.servers.clear();const r=this.options.reconnectDelayHandler?this.options.reconnectDelayHandler():Eb;let s=r;const l=this.selectServer();if(!l||this.abortReconnect)throw t||(this.lastError?this.lastError:me.errorForCode(ce.ConnectionRefused));const c=Date.now();if(l.lastConnect===0||l.lastConnect+r<=c){l.lastConnect=Date.now();try{await this._doDial(l);break}catch(m){if(t=m,!this.connectedOnce){if(this.options.waitOnFirstConnect)continue;this.servers.removeCurrentServer()}l.reconnects++;const p=this.options.maxReconnectAttempts||0;p!==-1&&l.reconnects>=p&&this.servers.removeCurrentServer()}}else s=Math.min(s,l.lastConnect+r-c),await Ys(s)}}static async connect(t,r){const s=new eu(t,r);return await s.dialLoop(),s}static toError(t){const r=t?t.toLowerCase():"";if(r.indexOf("permissions violation")!==-1){const s=new me(t,ce.PermissionsViolation),l=t.match(/(Publish|Subscription) to "(\S+)"/);if(l){s.permissionContext={operation:l[1].toLowerCase(),subject:l[2],queue:void 0};const c=t.match(/using queue "(\S+)"/);c&&(s.permissionContext.queue=c[1])}return s}else return r.indexOf("authorization violation")!==-1?new me(t,ce.AuthorizationViolation):r.indexOf("user authentication expired")!==-1?new me(t,ce.AuthenticationExpired):r.indexOf("account authentication expired")!=-1?new me(t,ce.AccountExpired):r.indexOf("authentication timeout")!==-1?new me(t,ce.AuthenticationTimeout):new me(t,ce.ProtocolError)}processMsg(t,r){if(this.inMsgs++,this.inBytes+=r.length,!this.subscriptions.sidCounter)return;const s=this.subscriptions.get(t.sid);s&&(s.received+=1,s.callback&&s.callback(null,new jd(t,r,this)),s.max!==void 0&&s.received>=s.max&&s.unsubscribe())}processError(t){const r=Qg(t),s=eu.toError(r),l={type:_r.Error,data:s.code};if(s.isPermissionError()){let c=!1;if(s.permissionContext){l.permissionContext=s.permissionContext;const m=this.subscriptions.getMux();c=(m==null?void 0:m.subject)===s.permissionContext.subject}this.subscriptions.handleError(s),this.muxSubscriptions.handleError(c,s),c&&this.subscriptions.setMux(null)}this.dispatchStatus(l),this.handleError(s)}handleError(t){t.isAuthError()?this.handleAuthError(t):t.isProtocolError()?this.lastError=t:t.isAuthTimeout()&&(this.lastError=t),t.isPermissionError()||(this.lastError=t)}handleAuthError(t){this.lastError&&t.code===this.lastError.code&&this.options.ignoreAuthErrorAbort===!1&&(this.abortReconnect=!0),this.connectError?this.connectError(t):this.disconnect()}processPing(){this.transport.send(eE)}processPong(){const t=this.pongs.shift();t&&t.resolve()}processInfo(t){const r=JSON.parse(Qg(t));this.info=r;const s=this.options&&this.options.ignoreClusterUpdates?void 0:this.servers.update(r,this.transport.isEncrypted());if(!this.infoReceived){this.features.update($i(r.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();const{version:c,lang:m}=this.transport;try{const p=new tE({version:c,lang:m},this.options,r.nonce);r.headers&&(p.headers=!0,p.no_responders=!0);const g=JSON.stringify(p);this.transport.send(so(`CONNECT ${g}${Ic}`)),this.transport.send(py)}catch(p){this._close(p)}}s&&this.dispatchStatus({type:_r.Update,data:s}),(r.ldm!==void 0?r.ldm:!1)&&this.dispatchStatus({type:_r.LDM,data:this.servers.getCurrentServer().toString()})}push(t){switch(t.kind){case It.MSG:{const{msg:r,data:s}=t;this.processMsg(r,s);break}case It.OK:break;case It.ERR:this.processError(t.data);break;case It.PING:this.processPing();break;case It.PONG:this.processPong();break;case It.INFO:this.processInfo(t.data);break}}sendCommand(t,...r){const s=this.outbound.length();let l;typeof t=="string"?l=so(t):l=t,this.outbound.fill(l,...r),s===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(t,r=hn,s){let l;if(r instanceof Uint8Array)l=r;else if(typeof r=="string")l=Hi.encode(r);else throw me.errorForCode(ce.BadPayload);let c=l.length;s=s||{},s.reply=s.reply||"";let m=hn,p=0;if(s.headers){if(this.info&&!this.info.headers)throw new me("headers",ce.ServerOptionNotAvailable);m=s.headers.encode(),p=m.length,c=l.length+p}if(this.info&&c>this.info.max_payload)throw me.errorForCode(ce.MaxPayloadExceeded);this.outBytes+=c,this.outMsgs++;let g;s.headers?(s.reply?g=`HPUB ${t} ${s.reply} ${p} ${c}\r
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
40
  `:g=`HPUB ${t} ${p} ${c}\r
41
- `,this.sendCommand(g,m,l,Wc)):(s.reply?g=`PUB ${t} ${s.reply} ${c}\r
41
+ `,this.sendCommand(g,d,l,Wc)):(s.reply?g=`PUB ${t} ${s.reply} ${c}\r
42
42
  `:g=`PUB ${t} ${c}\r
43
43
  `,this.sendCommand(g,l,Wc))}request(t){return this.initMux(),this.muxSubscriptions.add(t),t}subscribe(t){return this.subscriptions.add(t),this._subunsub(t),t}_sub(t){t.queue?this.sendCommand(`SUB ${t.subject} ${t.queue} ${t.sid}\r
44
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 rE="$SRV";class gy{constructor(t){A(this,"msg");this.msg=t}get data(){return this.msg.data}get sid(){return this.msg.sid}get subject(){return this.msg.subject}get reply(){return this.msg.reply||""}get headers(){return this.msg.headers}respond(t,r){return this.msg.respond(t,r)}respondError(t,r,s,l){var c,m;return l=l||{},l.headers=l.headers||Sr(),(c=l.headers)==null||c.set(Kc,`${t}`),(m=l.headers)==null||m.set(Xc,r),this.msg.respond(s,l)}json(t){return this.msg.json(t)}string(){return this.msg.string()}}class fo{constructor(t,r="",s=""){A(this,"subject");A(this,"queue");A(this,"srv");r!==""&&sE("service group",r);let l="";if(t instanceof bo)this.srv=t,l="";else if(t instanceof fo){const c=t;this.srv=c.srv,s===""&&c.queue!==""&&(s=c.queue),l=c.subject}else throw new Error("unknown ServiceGroup type");this.subject=this.calcSubject(l,r),this.queue=s}calcSubject(t,r=""){return r===""?t:t!==""?`${t}.${r}`:r}addEndpoint(t="",r){r=r||{subject:t};const s=typeof r=="function"?{handler:r,subject:t}:r;no("endpoint",t);let{subject:l,handler:c,metadata:m,queue:p}=s;l=l||t,p=p||this.queue,iE("endpoint subject",l),l=this.calcSubject(this.subject,l);const g={name:t,subject:l,queue:p,handler:c,metadata:m};return this.srv._addEndpoint(g)}addGroup(t="",r=""){return new fo(this,t,r)}}function iE(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 sE(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??rE;return r===""&&s===""?`${c}.${t}`:(no("control subject name",r),s!==""?(no("control subject id",s),`${c}.${t}.${r}.${s}`):`${c}.${t}.${r}`)}get subjects(){return this.handlers.filter(t=>t.internal===!1).map(t=>t.subject)}get id(){return this._id}get name(){return this.config.name}get description(){return this.config.description??""}get version(){return this.config.version}get metadata(){return this.config.metadata}errorToHeader(t){const r=Sr();if(t instanceof Jc){const s=t;r.set(Xc,s.message),r.set(Kc,`${s.code}`)}else r.set(Xc,t.message),r.set(Kc,"500");return r}setupHandler(t,r=!1){const s=r?"":t.queue?t.queue:this.config.queue,{name:l,subject:c,handler:m}=t,p=t;p.internal=r,r&&this.internal.push(p),p.stats=new aE(l,c,s),p.queue=s;const g=m?(f,d)=>{if(f){this.close(f);return}const b=Date.now();try{m(f,new gy(d))}catch(v){p.stats.countError(v),d==null||d.respond(hn,{headers:this.errorToHeader(v)})}finally{p.stats.countLatency(b)}}:void 0;return p.sub=this.nc.subscribe(c,{callback:g,queue:s}),p.sub.closed.then(()=>{this._stopped||this.close(new Error(`required subscription ${t.subject} stopped`)).catch()}).catch(f=>{if(!this._stopped){const d=new Error(`required subscription ${t.subject} errored: ${f.message}`);d.stack=f.stack,this.close(d).catch()}}),p}info(){return{type:ao.INFO,name:this.name,id:this.id,version:this.version,description:this.description,metadata:this.metadata,endpoints:this.endpoints()}}endpoints(){return this.handlers.map(t=>{const{subject:r,metadata:s,name:l,queue:c}=t;return{subject:r,metadata:s,name:l,queue_group:c}})}async stats(){const t=[];for(const r of this.handlers){if(typeof this.config.statsHandler=="function")try{r.stats.data=await this.config.statsHandler(r)}catch(s){r.stats.countError(s)}t.push(r.stats.stats(r.qi))}return{type:ao.STATS,name:this.name,id:this.id,version:this.version,started:this.started,metadata:this.metadata,endpoints:t}}addInternalHandler(t,r){const s=`${t}`.toUpperCase();this._doAddInternalHandler(`${s}-all`,t,r),this._doAddInternalHandler(`${s}-kind`,t,r,this.name),this._doAddInternalHandler(`${s}`,t,r,this.name,this.id)}_doAddInternalHandler(t,r,s,l="",c=""){const m={};m.name=t,m.subject=bo.controlSubject(r,l,c),m.handler=s,this.setupHandler(m,!0)}start(){const t=$n(),r=(m,p)=>m?(this.close(m),Promise.reject(m)):this.stats().then(g=>(p==null||p.respond(t.encode(g)),Promise.resolve())),s=(m,p)=>m?(this.close(m),Promise.reject(m)):(p==null||p.respond(t.encode(this.info())),Promise.resolve()),l=t.encode(this.ping()),c=(m,p)=>m?(this.close(m).then().catch(),Promise.reject(m)):(p.respond(l),Promise.resolve());return this.addInternalHandler(ai.PING,c),this.addInternalHandler(ai.STATS,r),this.addInternalHandler(ai.INFO,s),this.handlers.forEach(m=>{const{subject:p}=m;typeof p=="string"&&m.handler!==null&&this.setupHandler(m)}),Promise.resolve(this)}close(t){if(this._stopped)return this._done;this._stopped=!0;let r=[];return this.nc.isClosed()||(r=this.handlers.concat(this.internal).map(s=>s.sub.drain())),Promise.allSettled(r).then(()=>{this._done.resolve(t||null)}),this._done}get stopped(){return this._done}get isStopped(){return this._stopped}stop(t){return this.close(t)}ping(){return{type:ao.PING,name:this.name,id:this.id,version:this.version,metadata:this.metadata}}reset(){if(this.started=new Date().toISOString(),this.handlers)for(const t of this.handlers)t.stats.reset(t.qi)}addGroup(t,r){return new fo(this,t,r)}addEndpoint(t,r){return new fo(this).addEndpoint(t,r)}_addEndpoint(t){const r=new jt;r.noIterator=typeof t.handler=="function",r.noIterator||(t.handler=(l,c)=>{l?this.stop(l).catch():r.push(new gy(c))},r.iterClosed.then(()=>{this.close().catch()}));const s=this.setupHandler(t,!1);return s.qi=r,this.handlers.push(s),r}}class aE{constructor(t,r,s=""){A(this,"name");A(this,"subject");A(this,"average_processing_time");A(this,"num_requests");A(this,"processing_time");A(this,"num_errors");A(this,"last_error");A(this,"data");A(this,"metadata");A(this,"queue");this.name=t,this.subject=r,this.average_processing_time=0,this.num_errors=0,this.num_requests=0,this.processing_time=0,this.queue=s}reset(t){this.num_requests=0,this.processing_time=0,this.average_processing_time=0,this.num_errors=0,this.last_error=void 0,this.data=void 0;const r=t;r&&(r.time=0,r.processed=0)}countLatency(t){this.num_requests++,this.processing_time+=it(Date.now()-t),this.average_processing_time=Math.round(this.processing_time/this.num_requests)}countError(t){this.num_errors++,this.last_error=t.message}_stats(){const{name:t,subject:r,average_processing_time:s,num_errors:l,num_requests:c,processing_time:m,last_error:p,data:g,queue:f}=this;return{name:t,subject:r,average_processing_time:s,num_errors:l,num_requests:c,processing_time:m,last_error:p,data:g,queue_group:f}}stats(t){const r=t;return(r==null?void 0:r.noIterator)===!1&&(this.processing_time=it(r.time),this.num_requests=r.processed,this.average_processing_time=this.processing_time>0&&this.num_requests>0?this.processing_time/this.num_requests:0),this._stats()}}class oE{constructor(t,r={strategy:In.JitterTimer,maxWait:2e3},s){A(this,"nc");A(this,"prefix");A(this,"opts");this.nc=t,this.prefix=s,this.opts=r}ping(t="",r=""){return this.q(ai.PING,t,r)}stats(t="",r=""){return this.q(ai.STATS,t,r)}info(t="",r=""){return this.q(ai.INFO,t,r)}async q(t,r="",s=""){const l=new jt,c=$n(),m=bo.controlSubject(t,r,s,this.prefix),p=await this.nc.requestMany(m,hn,this.opts);return(async()=>{for await(const g of p)try{const f=c.decode(g.data);l.push(f)}catch(f){l.push(()=>{l.stop(f)})}l.push(()=>{l.stop()})})().catch(g=>{l.stop(g)}),l}}function Ab(){return{key:{encode(i){return i},decode(i){return i}},value:{encode(i){return i},decode(i){return i}}}}function lE(){return{replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:Ab(),storage:td.File}}const tu="KV-Operation",yy="$KV",cE=/^[-/=.\w]+$/,uE=/^[-/=.>*\w]+$/,fE=/^[-\w]+$/;function hE(i){if(i.startsWith(".")||i.endsWith(".")||!cE.test(i))throw new Error(`invalid key: ${i}`)}function dE(i){if(i.startsWith(".")||i.endsWith(".")||!uE.test(i))throw new Error(`invalid key: ${i}`)}function mE(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(!fE.test(i))throw new Error(`invalid bucket name: ${i}`)}var Kn;(function(i){i.MsgIdHdr="Nats-Msg-Id",i.ExpectedStreamHdr="Nats-Expected-Stream",i.ExpectedLastSeqHdr="Nats-Expected-Last-Sequence",i.ExpectedLastMsgIdHdr="Nats-Expected-Last-Msg-Id",i.ExpectedLastSubjectSequenceHdr="Nats-Expected-Last-Subject-Sequence"})(Kn||(Kn={}));class ho{constructor(t,r,s){A(this,"js");A(this,"jsm");A(this,"stream");A(this,"bucket");A(this,"direct");A(this,"codec");A(this,"prefix");A(this,"editPrefix");A(this,"useJsPrefix");A(this,"_prefixLen");A(this,"validateKey",hE);A(this,"validateSearchKey",dE);A(this,"hasWildcards",mE);$c(t),this.js=r,this.jsm=s,this.bucket=t,this.prefix=yy,this.editPrefix="",this.useJsPrefix=!1,this._prefixLen=0}static async create(t,r,s={}){$c(r);const l=await t.jetstreamManager(),c=new ho(r,t,l);return await c.init(s),c}static async bind(t,r,s={}){const l=await t.jetstreamManager(),c={config:{allow_direct:s.allow_direct}};$c(r);const m=new ho(r,t,l);return c.config.name=s.streamName??m.bucketName(),Object.assign(m,c),m.stream=c.config.name,m.codec=s.codec||Ab(),m.direct=c.config.allow_direct??!1,m.initializePrefixes(c),m}async init(t={}){const r=Object.assign(lE(),t);this.codec=r.codec;const s={};this.stream=s.name=t.streamName??this.bucketName(),s.retention=ed.Limits,s.max_msgs_per_subject=r.history,r.maxBucketSize&&(r.max_bytes=r.maxBucketSize),r.max_bytes&&(s.max_bytes=r.max_bytes),s.max_msg_size=r.maxValueSize,s.storage=r.storage;const l=t.placementCluster??"";if(l&&(t.placement={},t.placement.cluster=l,t.placement.tags=[]),t.placement&&(s.placement=t.placement),t.republish&&(s.republish=t.republish),t.description&&(s.description=t.description),t.mirror){const b=Object.assign({},t.mirror);b.name.startsWith(cn)||(b.name=`${cn}${b.name}`),s.mirror=b,s.mirror_direct=!0}else if(t.sources){const b=t.sources.map(v=>{const _=Object.assign({},v),w=_.name.startsWith(cn)?_.name.substring(cn.length):_.name;return _.name.startsWith(cn)||(_.name=`${cn}${_.name}`),!v.external&&w!==this.bucket&&(_.subject_transforms=[{src:`$KV.${w}.>`,dest:`$KV.${this.bucket}.>`}]),_});s.sources=b,s.subjects=[this.subjectForBucket()]}else s.subjects=[this.subjectForBucket()];t.metadata&&(s.metadata=t.metadata),typeof t.compression=="boolean"&&(s.compression=t.compression?hi.S2:hi.None);const c=this.js.nc,m=c.getServerVersion(),p=m?rd(m,$i("2.7.2"))>=0:!1;s.discard=p?uo.New:uo.Old;const{ok:g,min:f}=c.features.get(Ie.JS_ALLOW_DIRECT);if(!g&&t.allow_direct===!0){const b=m?`${m.major}.${m.minor}.${m.micro}`:"unknown";return Promise.reject(new Error(`allow_direct is not available on server version ${b} - requires ${f}`))}t.allow_direct=typeof t.allow_direct=="boolean"?t.allow_direct:g,s.allow_direct=t.allow_direct,this.direct=s.allow_direct,s.num_replicas=r.replicas,r.ttl&&(s.max_age=it(r.ttl)),s.allow_rollup_hdrs=!0;let d;try{d=await this.jsm.streams.info(s.name),!d.config.allow_direct&&this.direct===!0&&(this.direct=!1)}catch(b){if(b.message==="stream not found")d=await this.jsm.streams.add(s);else throw b}this.initializePrefixes(d)}initializePrefixes(t){this._prefixLen=0,this.prefix=`$KV.${this.bucket}`,this.useJsPrefix=this.js.apiPrefix!=="$JS.API";const{mirror:r}=t.config;if(r){let s=r.name;if(s.startsWith(cn)&&(s=s.substring(cn.length)),r.external&&r.external.api!==""){const l=r.name.substring(cn.length);this.useJsPrefix=!1,this.prefix=`$KV.${l}`,this.editPrefix=`${r.external.api}.$KV.${s}`}else this.editPrefix=this.prefix}}bucketName(){return this.stream??`${cn}${this.bucket}`}subjectForBucket(){return`${this.prefix}.${this.bucket}.>`}subjectForKey(t,r=!1){const s=[];return r?(this.useJsPrefix&&s.push(this.js.apiPrefix),this.editPrefix!==""?s.push(this.editPrefix):s.push(this.prefix)):this.prefix&&s.push(this.prefix),s.push(t),s.join(".")}fullKeyName(t){return this.prefix!==""?`${this.prefix}.${t}`:`${yy}.${this.bucket}.${t}`}get prefixLen(){return this._prefixLen===0&&(this._prefixLen=this.prefix.length+1),this._prefixLen}encodeKey(t){const r=[];for(const s of t.split("."))switch(s){case">":case"*":r.push(s);break;default:r.push(this.codec.key.encode(s));break}return r.join(".")}decodeKey(t){const r=[];for(const s of t.split("."))switch(s){case">":case"*":r.push(s);break;default:r.push(this.codec.key.decode(s));break}return r.join(".")}close(){return Promise.resolve()}dataLen(t,r){const s=r&&r.get($t.MessageSizeHdr)||"";return s!==""?parseInt(s,10):t.length}smToEntry(t){return new NE(this.bucket,this.prefixLen,t)}jmToEntry(t){const r=this.decodeKey(t.subject.substring(this.prefixLen));return new kE(this.bucket,r,t)}async create(t,r){var c;let s;try{const m=await this.put(t,r,{previousSeq:0});return Promise.resolve(m)}catch(m){if(s=m,((c=m==null?void 0:m.api_error)==null?void 0:c.err_code)!==10071)return Promise.reject(m)}let l=0;try{const m=await this.get(t);return(m==null?void 0:m.operation)==="DEL"||(m==null?void 0:m.operation)==="PURGE"?(l=m!==null?m.revision:0,this.update(t,r,l)):Promise.reject(s)}catch(m){return Promise.reject(m)}}update(t,r,s){if(s<=0)throw new Error("version must be greater than 0");return this.put(t,r,{previousSeq:s})}async put(t,r,s={}){var m,p;const l=this.encodeKey(t);this.validateKey(l);const c={};if(s.previousSeq!==void 0){const g=Sr();c.headers=g,g.set(Kn.ExpectedLastSubjectSequenceHdr,`${s.previousSeq}`)}try{return(await this.js.publish(this.subjectForKey(l,!0),r,c)).seq}catch(g){const f=g;return f.isJetStreamError()?(f.message=(m=f.api_error)==null?void 0:m.description,f.code=`${(p=f.api_error)==null?void 0:p.code}`,Promise.reject(f)):Promise.reject(g)}}async get(t,r){const s=this.encodeKey(t);this.validateKey(s);let l={last_by_subj:this.subjectForKey(s)};r&&r.revision>0&&(l={seq:r.revision});let c;try{this.direct?c=await this.jsm.direct.getMessage(this.bucketName(),l):c=await this.jsm.streams.getMessage(this.bucketName(),l);const m=this.smToEntry(c);return m.key!==s?null:m}catch(m){if(m.code===ce.JetStream404NoMessages)return null;throw m}}purge(t,r){return this._deleteOrPurge(t,"PURGE",r)}delete(t,r){return this._deleteOrPurge(t,"DEL",r)}async purgeDeletes(t=1800*1e3){const r=st(),s=[],l=await this.watch({key:">",initializedFn:()=>{r.resolve()}});(async()=>{for await(const g of l)(g.operation==="DEL"||g.operation==="PURGE")&&s.push(g)})().then(),await r,l.stop();const c=Date.now()-t,m=s.map(g=>{const f=this.subjectForKey(g.key);return g.created.getTime()>=c?this.jsm.streams.purge(this.stream,{filter:f,keep:1}):this.jsm.streams.purge(this.stream,{filter:f,keep:0})}),p=await Promise.all(m);return p.unshift({success:!0,purged:0}),p.reduce((g,f)=>(g.purged+=f.purged,g))}async _deleteOrPurge(t,r,s){if(!this.hasWildcards(t))return this._doDeleteOrPurge(t,r,s);const l=await this.keys(t),c=[];for await(const m of l)c.push(this._doDeleteOrPurge(m,r)),c.length===100&&(await Promise.all(c),c.length=0);c.length>0&&await Promise.all(c)}async _doDeleteOrPurge(t,r,s){const l=this.encodeKey(t);this.validateKey(l);const c=Sr();c.set(tu,r),r==="PURGE"&&c.set($t.RollupHdr,$t.RollupValueSubject),s!=null&&s.previousSeq&&c.set(Kn.ExpectedLastSubjectSequenceHdr,`${s.previousSeq}`),await this.js.publish(this.subjectForKey(l,!0),hn,{headers:c})}_buildCC(t,r,s={}){let c=(Array.isArray(t)?t:[t]).map(g=>{const f=this.encodeKey(g);return this.validateSearchKey(g),this.fullKeyName(f)}),m=mt.LastPerSubject;r===Un.AllHistory&&(m=mt.All),r===Un.UpdatesOnly&&(m=mt.New);let p;return c.length===1&&(p=c[0],c=void 0),Object.assign({deliver_policy:m,ack_policy:At.None,filter_subjects:c,filter_subject:p,flow_control:!0,idle_heartbeat:it(5*1e3)},s)}remove(t){return this.purge(t)}async history(t={}){const r=t.key??">",s=new jt,l={};l.headers_only=t.headers_only||!1;let c;c=()=>{s.stop()};let m=0;const p=this._buildCC(r,Un.AllHistory,l),g=p.filter_subject,f=li(p);f.bindStream(this.stream),f.orderedConsumer(),f.callback((b,v)=>{if(b){s.stop(b);return}if(v){const _=this.jmToEntry(v);s.push(_),s.received++,(c&&m>0&&s.received>=m||v.info.pending===0)&&(s.push(c),c=void 0)}});const d=await this.js.subscribe(g,f);if(c){const{info:{last:b}}=d,v=b.num_pending+b.delivered.consumer_seq;if(v===0||s.received>=v)try{c()}catch(_){s.stop(_)}finally{c=void 0}else m=v}return s._data=d,s.iterClosed.then(()=>{d.unsubscribe()}),d.closed.then(()=>{s.stop()}).catch(b=>{s.stop(b)}),s}canSetWatcherName(){const r=this.js.nc,{ok:s}=r.features.get(Ie.JS_NEW_CONSUMER_CREATE_API);return s}async watch(t={}){const r=t.key??">",s=new jt,l={};l.headers_only=t.headers_only||!1;let c=Un.LastValue;t.include===Un.AllHistory?c=Un.AllHistory:t.include===Un.UpdatesOnly&&(c=Un.UpdatesOnly);const m=t.ignoreDeletes===!0;let p=t.initializedFn,g=0;const f=this._buildCC(r,c,l),d=f.filter_subject,b=li(f);this.canSetWatcherName()&&b.consumerName(fi.next()),b.bindStream(this.stream),t.resumeFromRevision&&t.resumeFromRevision>0&&b.startSequence(t.resumeFromRevision),b.orderedConsumer(),b.callback((_,w)=>{if(_){s.stop(_);return}if(w){const S=this.jmToEntry(w);if(m&&S.operation==="DEL")return;s.push(S),s.received++,p&&(g>0&&s.received>=g||w.info.pending===0)&&(s.push(p),p=void 0)}});const v=await this.js.subscribe(d,b);if(p){const{info:{last:_}}=v,w=_.num_pending+_.delivered.consumer_seq;if(w===0||s.received>=w)try{p()}catch(S){s.stop(S)}finally{p=void 0}else g=w}return s._data=v,s.iterClosed.then(()=>{v.unsubscribe()}),v.closed.then(()=>{s.stop()}).catch(_=>{s.stop(_)}),s}async keys(t=">"){const r=new jt,s=this._buildCC(t,Un.LastValue,{headers_only:!0}),l=Array.isArray(t)?">":s.filter_subject,c=li(s);c.bindStream(this.stream),c.orderedConsumer();const m=await this.js.subscribe(l,c);return(async()=>{var g;for await(const f of m){const d=(g=f.headers)==null?void 0:g.get(tu);if(d!=="DEL"&&d!=="PURGE"){const b=this.decodeKey(f.subject.substring(this.prefixLen));r.push(b)}f.info.pending===0&&m.unsubscribe()}})().then(()=>{r.stop()}).catch(g=>{r.stop(g)}),m.info.last.num_pending===0&&m.unsubscribe(),r}purgeBucket(t){return this.jsm.streams.purge(this.bucketName(),t)}destroy(){return this.jsm.streams.delete(this.bucketName())}async status(){var c;const r=((c=this.js.nc.info)==null?void 0:c.cluster)??"",s=this.bucketName(),l=await this.jsm.streams.info(s);return new 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(cn)?this.si.config.name.substring(cn.length):this.si.config.name}get values(){return this.si.state.messages}get history(){return this.si.config.max_msgs_per_subject}get ttl(){return Ad(this.si.config.max_age)}get bucket_location(){return this.cluster}get backingStore(){return this.si.config.storage}get storage(){return this.si.config.storage}get replicas(){return this.si.config.num_replicas}get description(){return this.si.config.description??""}get maxBucketSize(){return this.si.config.max_bytes}get maxValueSize(){return this.si.config.max_msg_size}get max_bytes(){return this.si.config.max_bytes}get placement(){return this.si.config.placement||{cluster:"",tags:[]}}get placementCluster(){var t;return((t=this.si.config.placement)==null?void 0:t.cluster)??""}get republish(){return this.si.config.republish??{src:"",dest:""}}get streamInfo(){return this.si}get size(){return this.si.state.bytes}get metadata(){return this.si.config.metadata??{}}get compression(){return this.si.config.compression?this.si.config.compression!==hi.None:!1}}const Nd="OBJ_",by="SHA-256=";function pE(i){return $c(i),`${Nd}${i}`}function gE(i){return i.startsWith(Nd)?i.substring(4):i}class od{constructor(t){A(this,"si");A(this,"backingStore");this.si=t,this.backingStore="JetStream"}get bucket(){return gE(this.si.config.name)}get description(){return this.si.config.description??""}get ttl(){return this.si.config.max_age}get storage(){return this.si.config.storage}get replicas(){return this.si.config.num_replicas}get sealed(){return this.si.config.sealed}get size(){return this.si.state.bytes}get streamInfo(){return this.si}get metadata(){return this.si.config.metadata}get compression(){return this.si.config.compression?this.si.config.compression!==hi.None:!1}}function Xl(i){if(i===void 0)return;const{domain:t}=i;if(t===void 0)return i;const r=Object.assign({},i);if(delete r.domain,t==="")return r;if(r.external)throw new Error("domain and external are both set");return r.external={api:`$JS.${t}.API`},r}var Tn;(function(i){i[i.Unset=-1]="Unset",i[i.Consume=0]="Consume",i[i.Fetch=1]="Fetch"})(Tn||(Tn={}));var Jn;(function(i){i.HeartbeatsMissed="heartbeats_missed",i.ConsumerNotFound="consumer_not_found",i.StreamNotFound="stream_not_found",i.ConsumerDeleted="consumer_deleted",i.OrderedConsumerRecreated="ordered_consumer_recreated",i.NoResponders="no_responders"})(Jn||(Jn={}));var $s;(function(i){i.DebugEvent="debug",i.Discard="discard",i.Reset="reset",i.Next="next"})($s||($s={}));const vy=Uint8Array.of(43,65,67,75),yE=Uint8Array.of(45,78,65,75),Va=Uint8Array.of(43,87,80,73),bE=Uint8Array.of(43,78,88,84),vE=Uint8Array.of(43,84,69,82,77),xE=Uint8Array.of(32);function mo(i,t=5e3){return new LE(i,t)}class Lh extends jt{constructor(r,s,l=!1){super();A(this,"consumer");A(this,"opts");A(this,"sub");A(this,"monitor");A(this,"pending");A(this,"inbox");A(this,"refilling");A(this,"pong");A(this,"callback");A(this,"timeout");A(this,"cleanupHandler");A(this,"listeners");A(this,"statusIterator");A(this,"forOrderedConsumer");A(this,"resetHandler");A(this,"abortOnMissingResource");A(this,"bind");A(this,"inBackOff");this.consumer=r;const c=s;this.opts=this.parseOptions(s,l),this.callback=c.callback||null,this.noIterator=typeof this.callback=="function",this.monitor=null,this.pong=null,this.pending={msgs:0,bytes:0,requests:0},this.refilling=l,this.timeout=null,this.inbox=wr(r.api.nc.options.inboxPrefix),this.listeners=[],this.forOrderedConsumer=!1,this.abortOnMissingResource=c.abort_on_missing_resource===!0,this.bind=c.bind===!0,this.inBackOff=!1,this.start()}start(){const{max_messages:r,max_bytes:s,idle_heartbeat:l,threshold_bytes:c,threshold_messages:m}=this.opts;this.closed().then(g=>{if(this.cleanupHandler)try{this.cleanupHandler(g)}catch{}});const{sub:p}=this;p&&p.unsubscribe(),this.sub=this.consumer.api.nc.subscribe(this.inbox,{callback:(g,f)=>{var b,v,_,w;if(g){this.stop(g);return}if((b=this.monitor)==null||b.work(),f.subject===this.inbox){if(Wh(f))return;const S=(v=f.headers)==null?void 0:v.code,M=((w=(_=f.headers)==null?void 0:_.description)==null?void 0:w.toLowerCase())||"unknown",{msgsLeft:L,bytesLeft:z}=this.parseDiscard(f.headers);if(L>0||z>0)this.pending.msgs-=L,this.pending.bytes-=z,this.pending.requests--,this.notify($s.Discard,{msgsLeft:L,bytesLeft:z});else if(S===400){this.stop(new me(M,`${S}`));return}else if(S===409&&M==="consumer deleted"){if(this.notify(Jn.ConsumerDeleted,`${S} ${M}`),!this.refilling||this.abortOnMissingResource){const ie=new me(M,`${S}`);this.stop(ie);return}}else if(S===503){if(this.notify(Jn.NoResponders,`${S} No Responders`),!this.refilling||this.abortOnMissingResource){const ie=new me("no responders",`${S}`);this.stop(ie);return}}else this.notify($s.DebugEvent,`${S} ${M}`)}else this._push(mo(f,this.consumer.api.timeout)),this.received++,this.pending.msgs&&this.pending.msgs--,this.pending.bytes&&(this.pending.bytes-=f.size());if(this.pending.msgs===0&&this.pending.bytes===0&&(this.pending.requests=0),this.refilling){if(r&&this.pending.msgs<=m||s&&this.pending.bytes<=c){const S=this.pullOptions();this.pull(S)}}else this.pending.requests===0&&this._push(()=>{this.stop()})}}),this.sub.closed.then(()=>{this.sub.draining&&this._push(()=>{this.stop()})}),l&&(this.monitor=new Td(l,g=>(this.notify(Jn.HeartbeatsMissed,g),this.resetPending().then(()=>{}).catch(()=>{}),!1),{maxOut:2})),(async()=>{var f;const g=this.consumer.api.nc.status();this.statusIterator=g;for await(const d of g)switch(d.type){case _r.Disconnect:(f=this.monitor)==null||f.cancel();break;case _r.Reconnect:this.resetPending().then(b=>{var v;b&&((v=this.monitor)==null||v.restart())}).catch(()=>{});break}})(),this.pull(this.pullOptions())}_push(r){if(!this.callback)super.push(r);else{const s=typeof r=="function"?r:null;try{s?s():this.callback(r)}catch(l){this.stop(l)}}}notify(r,s){this.listeners.length>0&&this.listeners.forEach(l=>{l.done||l.push({type:r,data:s})})}resetPending(){return this.bind?this.resetPendingNoInfo():this.resetPendingWithInfo()}resetPendingNoInfo(){return this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),Promise.resolve(!0)}async resetPendingWithInfo(){if(this.inBackOff)return!1;let r=0,s=0;const l=Od([this.opts.expires]);let c=0;for(;;){if(this.done)return!1;if(this.consumer.api.nc.isClosed())return console.error("aborting resetPending - connection is closed"),!1;try{return await this.consumer.info(),this.inBackOff=!1,r=0,this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),!0}catch(m){if(m.message==="stream not found"){if(s++,this.notify(Jn.StreamNotFound,s),!this.refilling||this.abortOnMissingResource)return this.stop(m),!1}else if(m.message==="consumer not found"){if(r++,this.notify(Jn.ConsumerNotFound,r),this.resetHandler)try{this.resetHandler()}catch{}if(!this.refilling||this.abortOnMissingResource)return this.stop(m),!1;if(this.forOrderedConsumer)return!1}else r=0,s=0;this.inBackOff=!0;const p=l.backoff(c),g=Ys(p);await Promise.race([g,this.consumer.api.nc.closed()]),g.cancel(),c++}}}pull(r){this.pending.bytes+=r.max_bytes??0,this.pending.msgs+=r.batch??0,this.pending.requests++;const s=this.consumer.api.nc;this._push(()=>{s.publish(`${this.consumer.api.prefix}.CONSUMER.MSG.NEXT.${this.consumer.stream}.${this.consumer.name}`,this.consumer.api.jc.encode(r),{reply:this.inbox}),this.notify($s.Next,r)})}pullOptions(){const r=this.opts.max_messages-this.pending.msgs,s=this.opts.max_bytes-this.pending.bytes,l=it(this.opts.idle_heartbeat),c=it(this.opts.expires);return{batch:r,max_bytes:s,idle_heartbeat:l,expires:c}}parseDiscard(r){const s={msgsLeft:0,bytesLeft:0},l=r==null?void 0:r.get($t.PendingMessagesHdr);l&&(s.msgsLeft=parseInt(l));const c=r==null?void 0:r.get($t.PendingBytesHdr);return c&&(s.bytesLeft=parseInt(c)),s}trackTimeout(r){this.timeout=r}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}clearTimers(){var r,s;(r=this.monitor)==null||r.cancel(),this.monitor=null,(s=this.timeout)==null||s.cancel(),this.timeout=null}setCleanupHandler(r){this.cleanupHandler=r}stop(r){var s,l;this.done||((s=this.sub)==null||s.unsubscribe(),this.clearTimers(),(l=this.statusIterator)==null||l.stop(),this._push(()=>{super.stop(r),this.listeners.forEach(c=>{c.stop()})}))}parseOptions(r,s=!1){const l=r||{};if(l.max_messages=l.max_messages||0,l.max_bytes=l.max_bytes||0,l.max_messages!==0&&l.max_bytes!==0)throw new Error("only specify one of max_messages or max_bytes");if(l.max_messages===0&&(l.max_messages=100),l.expires=l.expires||3e4,l.expires<1e3)throw new Error("expires should be at least 1000ms");if(l.idle_heartbeat=l.idle_heartbeat||l.expires/2,l.idle_heartbeat=l.idle_heartbeat>3e4?3e4:l.idle_heartbeat,s){const c=Math.round(l.max_messages*.75)||1;l.threshold_messages=l.threshold_messages||c;const m=Math.round(l.max_bytes*.75)||1;l.threshold_bytes=l.threshold_bytes||m}return l}status(){const r=new jt;return this.listeners.push(r),Promise.resolve(r)}}class _E extends jt{constructor(){super();A(this,"src");A(this,"listeners");this.listeners=[]}setSource(r){this.src&&(this.src.resetHandler=void 0,this.src.setCleanupHandler(),this.src.stop()),this.src=r,this.src.setCleanupHandler(s=>{this.stop(s||void 0)}),(async()=>{const s=await this.src.status();for await(const l of s)this.notify(l.type,l.data)})().catch(()=>{})}notify(r,s){this.listeners.length>0&&this.listeners.forEach(l=>{l.done||l.push({type:r,data:s})})}stop(r){var s;this.done||((s=this.src)==null||s.stop(r),super.stop(r),this.listeners.forEach(l=>{l.stop()}))}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}status(){const r=new jt;return this.listeners.push(r),Promise.resolve(r)}}class ld{constructor(t,r){A(this,"api");A(this,"_info");A(this,"stream");A(this,"name");this.api=t,this._info=r,this.stream=r.stream_name,this.name=r.name}consume(t={max_messages:100,expires:3e4}){return Promise.resolve(new Lh(this,t,!0))}fetch(t={max_messages:100,expires:3e4}){const r=new Lh(this,t,!1),s=Math.round(r.opts.expires*1.05),l=Gs(s);return r.closed().catch(()=>{}).finally(()=>{l.cancel()}),l.catch(()=>{r.close().catch()}),r.trackTimeout(l),Promise.resolve(r)}next(t={expires:3e4}){const r=st(),s=t;s.max_messages=1;const l=new Lh(this,s,!1),c=Math.round(l.opts.expires*1.05);c>=6e4&&(async()=>{for await(const p of await l.status())if(p.type===Jn.HeartbeatsMissed&&p.data>=2){r.reject(new Error("consumer missed heartbeats"));break}})().catch(),(async()=>{for await(const p of l){r.resolve(p);break}})().catch(()=>{});const m=Gs(c);return l.closed().then(p=>{p?r.reject(p):r.resolve(null)}).catch(p=>{r.reject(p)}).finally(()=>{m.cancel()}),m.catch(p=>{r.resolve(null),l.close().catch()}),l.trackTimeout(m),r}delete(){const{stream_name:t,name:r}=this._info;return this.api.delete(t,r)}info(t=!1){if(t)return Promise.resolve(this._info);const{stream_name:r,name:s}=this._info;return this.api.info(r,s).then(l=>(this._info=l,this._info))}}class wE{constructor(t,r,s={}){A(this,"api");A(this,"consumerOpts");A(this,"consumer");A(this,"opts");A(this,"cursor");A(this,"stream");A(this,"namePrefix");A(this,"serial");A(this,"currentConsumer");A(this,"userCallback");A(this,"iter");A(this,"type");A(this,"startSeq");A(this,"maxInitialReset");this.api=t,this.stream=r,this.cursor={stream_seq:1,deliver_seq:0},this.namePrefix=fi.next(),typeof s.name_prefix=="string"&&(cu("name_prefix",s.name_prefix),this.namePrefix=s.name_prefix+this.namePrefix),this.serial=0,this.currentConsumer=null,this.userCallback=null,this.iter=null,this.type=Tn.Unset,this.consumerOpts=s,this.maxInitialReset=30,this.startSeq=this.consumerOpts.opt_start_seq||0,this.cursor.stream_seq=this.startSeq>0?this.startSeq-1:0}getConsumerOpts(t){this.serial++;const r=`${this.namePrefix}_${this.serial}`;t=t===0?1:t;const s={name:r,deliver_policy:mt.StartSequence,opt_start_seq:t,ack_policy:At.None,inactive_threshold:it(300*1e3),num_replicas:1};return this.consumerOpts.headers_only===!0&&(s.headers_only=!0),Array.isArray(this.consumerOpts.filterSubjects)&&(s.filter_subjects=this.consumerOpts.filterSubjects),typeof this.consumerOpts.filterSubjects=="string"&&(s.filter_subject=this.consumerOpts.filterSubjects),this.consumerOpts.replay_policy&&(s.replay_policy=this.consumerOpts.replay_policy),t===this.startSeq+1&&(s.deliver_policy=this.consumerOpts.deliver_policy||mt.StartSequence,(this.consumerOpts.deliver_policy===mt.LastPerSubject||this.consumerOpts.deliver_policy===mt.New||this.consumerOpts.deliver_policy===mt.Last)&&(delete s.opt_start_seq,s.deliver_policy=this.consumerOpts.deliver_policy),s.deliver_policy===mt.LastPerSubject&&typeof s.filter_subjects>"u"&&typeof s.filter_subject>"u"&&(s.filter_subject=">"),this.consumerOpts.opt_start_time&&(delete s.opt_start_seq,s.deliver_policy=mt.StartTime,s.opt_start_time=this.consumerOpts.opt_start_time),this.consumerOpts.inactive_threshold&&(s.inactive_threshold=it(this.consumerOpts.inactive_threshold))),s}async resetConsumer(t=0){var m,p,g,f,d;fi.next();const r=this.serial===0;(m=this.consumer)==null||m.delete().catch(()=>{}),t=t===0?1:t,this.cursor.deliver_seq=0;const s=this.getConsumerOpts(t);s.max_deliver=1,s.mem_storage=!0;const l=Od([((p=this.opts)==null?void 0:p.expires)||3e4]);let c;for(let b=0;;b++)try{c=await this.api.add(this.stream,s),(g=this.iter)==null||g.notify(Jn.OrderedConsumerRecreated,c.name);break}catch(v){if(v.message==="stream not found"&&((f=this.iter)==null||f.notify(Jn.StreamNotFound,b),this.type===Tn.Fetch||this.opts.abort_on_missing_resource===!0))return(d=this.iter)==null||d.stop(v),Promise.reject(v);if(r&&b>=this.maxInitialReset)throw v;await Ys(l.backoff(b+1))}return c}internalHandler(t){return r=>{var l;if(this.serial!==t)return;const s=r.info.deliverySequence;if(s!==this.cursor.deliver_seq+1){this.notifyOrderedResetAndReset();return}this.cursor.deliver_seq=s,this.cursor.stream_seq=r.info.streamSequence,this.userCallback?this.userCallback(r):(l=this.iter)==null||l.push(r)}}async reset(t={max_messages:100,expires:3e4},r){var g,f;r=r||{};const s=r.fromFetch||!1,l=r.orderedReset||!1;if(this.type===Tn.Fetch&&l){(g=this.iter)==null||g.src.stop(),await((f=this.iter)==null?void 0:f.closed()),this.currentConsumer=null;return}(this.currentConsumer===null||l)&&(this.currentConsumer=await this.resetConsumer(this.cursor.stream_seq+1)),(this.iter===null||s)&&(this.iter=new _E),this.consumer=new ld(this.api,this.currentConsumer);const c=t;c.callback=this.internalHandler(this.serial);let m=null;this.type===Tn.Fetch&&s?m=await this.consumer.fetch(t):this.type===Tn.Consume&&(m=await this.consumer.consume(t));const p=m;p.forOrderedConsumer=!0,p.resetHandler=()=>{this.notifyOrderedResetAndReset()},this.iter.setSource(p)}notifyOrderedResetAndReset(){var t;(t=this.iter)==null||t.notify($s.Reset,""),this.reset(this.opts,{orderedReset:!0})}async consume(t={max_messages:100,expires:3e4}){if(t.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===Tn.Fetch)return Promise.reject(new Error("ordered consumer initialized as fetch"));if(this.type===Tn.Consume)return Promise.reject(new Error("ordered consumer doesn't support concurrent consume"));const{callback:s}=t;return s&&(this.userCallback=s),this.type=Tn.Consume,this.opts=t,await this.reset(t),this.iter}async fetch(t={max_messages:100,expires:3e4}){var l;if(t.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===Tn.Consume)return Promise.reject(new Error("ordered consumer already initialized as consume"));if(((l=this.iter)==null?void 0:l.done)===!1)return Promise.reject(new Error("ordered consumer doesn't support concurrent fetch"));const{callback:s}=t;return s&&(this.userCallback=s),this.type=Tn.Fetch,this.opts=t,await this.reset(t,{fromFetch:!0}),this.iter}async next(t={expires:3e4}){const r=t;if(r.bind)return Promise.reject(new Error("bind is not supported"));r.max_messages=1;const s=st();return r.callback=c=>{this.userCallback=null,s.resolve(c)},(await this.fetch(r)).iterClosed.then(c=>{c&&s.reject(c),s.resolve(null)}).catch(c=>{s.reject(c)}),s}delete(){return this.currentConsumer?this.api.delete(this.stream,this.currentConsumer.name).then(t=>Promise.resolve(t)).catch(t=>Promise.reject(t)).finally(()=>{this.currentConsumer=null}):Promise.resolve(!1)}async info(t){return this.currentConsumer==null?(this.currentConsumer=await this.resetConsumer(this.startSeq),Promise.resolve(this.currentConsumer)):t&&this.currentConsumer?Promise.resolve(this.currentConsumer):this.api.info(this.stream,this.currentConsumer.name)}}class cd{constructor(t){A(this,"api");A(this,"notified");this.api=t,this.notified=!1}checkVersion(){const t=this.api.nc.features.get(Ie.JS_SIMPLIFICATION);return t.ok?Promise.resolve():Promise.reject(new Error(`consumers framework is only supported on servers ${t.min} or better`))}getPullConsumerFor(t){if(t.config.deliver_subject!==void 0)throw new Error("push consumer not supported");return new ld(this.api,t)}async get(t,r={}){return typeof r=="object"?this.ordered(t,r):(await this.checkVersion(),this.api.info(t,r).then(s=>s.config.deliver_subject!==void 0?Promise.reject(new Error("push consumer not supported")):new ld(this.api,s)).catch(s=>Promise.reject(s)))}async ordered(t,r){await this.checkVersion();const s=this.api;return new kd(s.nc,s.opts).info(t).then(c=>Promise.resolve(new wE(this.api,t,r))).catch(c=>Promise.reject(c))}}class fu{constructor(t,r){A(this,"api");A(this,"_info");this.api=t,this._info=r}get name(){return this._info.config.name}alternates(){return this.info().then(t=>t.alternates?t.alternates:[])}async best(){if(await this.info(),this._info.alternates){const t=await this.api.info(this._info.alternates[0].name);return new fu(this.api,t)}else return this}info(t=!1,r){return t?Promise.resolve(this._info):this.api.info(this.name,r).then(s=>(this._info=s,this._info))}getConsumerFromInfo(t){return new cd(new Zc(this.api.nc,this.api.opts)).getPullConsumerFor(t)}getConsumer(t){return new cd(new Zc(this.api.nc,this.api.opts)).get(this.name,t)}getMessage(t){return this.api.getMessage(this.name,t)}deleteMessage(t,r){return this.api.deleteMessage(this.name,t,r)}}class kd extends yo{constructor(t,r){super(t,r)}checkStreamConfigVersions(t){const r=this.nc;if(t.metadata){const{min:l,ok:c}=r.features.get(Ie.JS_STREAM_CONSUMER_METADATA);if(!c)throw new Error(`stream 'metadata' requires server ${l}`)}if(t.first_seq){const{min:l,ok:c}=r.features.get(Ie.JS_STREAM_FIRST_SEQ);if(!c)throw new Error(`stream 'first_seq' requires server ${l}`)}if(t.subject_transform){const{min:l,ok:c}=r.features.get(Ie.JS_STREAM_SUBJECT_TRANSFORM);if(!c)throw new Error(`stream 'subject_transform' requires server ${l}`)}if(t.compression){const{min:l,ok:c}=r.features.get(Ie.JS_STREAM_COMPRESSION);if(!c)throw new Error(`stream 'compression' requires server ${l}`)}if(t.consumer_limits){const{min:l,ok:c}=r.features.get(Ie.JS_DEFAULT_CONSUMER_LIMITS);if(!c)throw new Error(`stream 'consumer_limits' requires server ${l}`)}function s(l,c){var p;if((((p=c==null?void 0:c.subject_transforms)==null?void 0:p.length)||0)>0){const{min:g,ok:f}=r.features.get(Ie.JS_STREAM_SOURCE_SUBJECT_TRANSFORM);if(!f)throw new Error(`${l} 'subject_transforms' requires server ${g}`)}}t.sources&&t.sources.forEach(l=>{s("stream sources",l)}),t.mirror&&s("stream mirror",t.mirror)}async add(t={}){var l;this.checkStreamConfigVersions(t),Pt(t.name),t.mirror=Xl(t.mirror),t.sources=(l=t.sources)==null?void 0:l.map(Xl);const s=await this._request(`${this.prefix}.STREAM.CREATE.${t.name}`,t);return this._fixInfo(s),s}async delete(t){return Pt(t),(await this._request(`${this.prefix}.STREAM.DELETE.${t}`)).success}async update(t,r={}){var p;if(typeof t=="object"){const g=t;t=g.name,r=g,console.trace("\x1B[33m >> streams.update(config: StreamConfig) api changed to streams.update(name: string, config: StreamUpdateConfig) - this shim will be removed - update your code. \x1B[0m")}this.checkStreamConfigVersions(r),Pt(t);const s=await this.info(t),l=Object.assign(s.config,r);l.mirror=Xl(l.mirror),l.sources=(p=l.sources)==null?void 0:p.map(Xl);const m=await this._request(`${this.prefix}.STREAM.UPDATE.${t}`,l);return this._fixInfo(m),m}async info(t,r){Pt(t);const s=`${this.prefix}.STREAM.INFO.${t}`;let c=await this._request(s,r),{total:m,limit:p}=c,g=c.state.subjects?Object.getOwnPropertyNames(c.state.subjects).length:1;if(m&&m>g){const f=[c],d=r||{};let b=0;for(;m>g;){b++,d.offset=p*b;const _=await this._request(s,d);m=_.total,f.push(_);const w=Object.getOwnPropertyNames(_.state.subjects).length;if(g+=w,w<p)break}let v={};for(let _=0;_<f.length;_++)c=f[_],c.state.subjects&&(v=Object.assign(v,c.state.subjects));c.offset=0,c.total=0,c.limit=0,c.state.subjects=v}return this._fixInfo(c),c}list(t=""){const r=t!=null&&t.length?{subject:t}:{},s=c=>{const m=c;return m.streams.forEach(p=>{this._fixInfo(p)}),m.streams},l=`${this.prefix}.STREAM.LIST`;return new ro(l,s,this,r)}_fixInfo(t){t.config.sealed=t.config.sealed||!1,t.config.deny_delete=t.config.deny_delete||!1,t.config.deny_purge=t.config.deny_purge||!1,t.config.allow_rollup_hdrs=t.config.allow_rollup_hdrs||!1}async purge(t,r){if(r){const{keep:l,seq:c}=r;if(typeof l=="number"&&typeof c=="number")throw new Error("can specify one of keep or seq")}return Pt(t),await this._request(`${this.prefix}.STREAM.PURGE.${t}`,r)}async deleteMessage(t,r,s=!0){Pt(t);const l={seq:r};return s||(l.no_erase=!0),(await this._request(`${this.prefix}.STREAM.MSG.DELETE.${t}`,l)).success}async getMessage(t,r){Pt(t);const l=await this._request(`${this.prefix}.STREAM.MSG.GET.${t}`,r);return new Tb(l)}find(t){return this.findStream(t)}listKvs(){const t=s=>{var g;const c=s.streams.filter(f=>f.config.name.startsWith(cn));c.forEach(f=>{this._fixInfo(f)});let m="";return c.length&&(m=((g=this.nc.info)==null?void 0:g.cluster)??""),c.map(f=>new jb(f,m))},r=`${this.prefix}.STREAM.LIST`;return new ro(r,t,this)}listObjectStores(){const t=s=>{const c=s.streams.filter(p=>p.config.name.startsWith(Nd));return c.forEach(p=>{this._fixInfo(p)}),c.map(p=>new od(p))},r=`${this.prefix}.STREAM.LIST`;return new ro(r,t,this)}names(t=""){const r=t!=null&&t.length?{subject:t}:{},s=c=>c.streams,l=`${this.prefix}.STREAM.NAMES`;return new ro(l,s,this,r)}async get(t){const r=await this.info(t);return Promise.resolve(new fu(this,r))}}class SE extends yo{constructor(t,r){super(t,r)}async getMessage(t,r){Pt(t);let s=r;const{last_by_subj:l}=s;l&&(s=null);const c=s?this.jc.encode(s):hn,m=this.opts.apiPrefix||"$JS.API",p=l?`${m}.DIRECT.GET.${t}.${l}`:`${m}.DIRECT.GET.${t}`,g=await this.nc.request(p,c,{timeout:this.timeout}),f=Ps(g);if(f)return Promise.reject(f);const d=new ud(g);return Promise.resolve(d)}async getBatch(t,r){Pt(t);const l=`${this.opts.apiPrefix||"$JS.API"}.DIRECT.GET.${t}`;if(!Array.isArray(r.multi_last)||r.multi_last.length===0)return Promise.reject("multi_last is required");const c=JSON.stringify(r,(g,f)=>g==="up_to_time"&&f instanceof Date?f.toISOString():f),m=new jt,p=await this.nc.requestMany(l,c,{strategy:In.SentinelMsg});return(async()=>{var b,v,_;let g=!1,f=!1,d;for await(const w of p){if(!g){g=!0;const S=((b=w.headers)==null?void 0:b.code)||0;if(S!==0&&S<200||S>299){d=(v=w.headers)==null?void 0:v.description.toLowerCase();break}if(((_=w.headers)==null?void 0:_.get("Nats-Num-Pending"))===""){f=!0;break}}if(w.data.length===0)break;m.push(new ud(w))}m.push(()=>{if(f)throw new Error("batch direct get not supported by the server");if(d)throw new Error(`bad request: ${d}`);m.stop()})})(),Promise.resolve(m)}}class ud{constructor(t){A(this,"data");A(this,"header");if(!t.headers)throw new Error("headers expected");this.data=t.data,this.header=t.headers}get subject(){return this.header.last(Bs.Subject)}get seq(){const t=this.header.last(Bs.Sequence);return typeof t=="string"?parseInt(t):0}get time(){return new Date(Date.parse(this.timestamp))}get timestamp(){return this.header.last(Bs.TimeStamp)}get stream(){return this.header.last(Bs.Stream)}json(t){return $n(t).decode(this.data)}string(){return un.decode(this.data)}}A(ud,"jc");class EE 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 SE(r,s)}async getAccountInfo(){return await this._request(`${this.prefix}.INFO`)}jetstream(){return this.nc.jetstream(this.getOptions())}advisories(){const r=new jt;return this.nc.subscribe("$JS.EVENT.ADVISORY.>",{callback:(s,l)=>{if(s)throw s;try{const c=this.parseJsResponse(l),m=c.type.split("."),p=m[m.length-1];r.push({kind:p,data:c})}catch(c){r.stop(c)}}}),r}}class 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):hn}get header(){if(!this._header)if(this.smr.message.hdrs){const t=this._parse(this.smr.message.hdrs);this._header=oi.decode(t)}else this._header=Sr();return this._header}_parse(t){const r=atob(t),s=r.length,l=new Uint8Array(s);for(let c=0;c<s;c++)l[c]=r.charCodeAt(c);return l}json(t){return $n(t).decode(this.data)}string(){return un.decode(this.data)}}A(Tb,"jc");class OE{constructor(t){A(this,"api");this.api=t}get(t){return this.api.info(t).then(r=>new fu(this.api,r))}}class zh{constructor(t){A(this,"info");A(this,"hdrs");this.info=t}get name(){return this.info.name}get description(){return this.info.description??""}get headers(){return this.hdrs||(this.hdrs=oi.fromRecord(this.info.headers||{})),this.hdrs}get options(){return this.info.options}get bucket(){return this.info.bucket}get chunks(){return this.info.chunks}get deleted(){return this.info.deleted??!1}get digest(){return this.info.digest}get mtime(){return this.info.mtime}get nuid(){return this.info.nuid}get size(){return this.info.size}get revision(){return this.info.revision}get metadata(){return this.info.metadata||{}}isLink(){var t,r;return((t=this.info.options)==null?void 0:t.link)!==void 0&&((r=this.info.options)==null?void 0:r.link)!==null}}function xy(i){const t={name:i.name,description:i.description??"",options:i.options,metadata:i.metadata};if(i.headers){const r=i.headers;t.headers=r.toRecord()}return t}function AE(){return new ReadableStream({pull(i){i.enqueue(new Uint8Array(0)),i.close()}})}class lo{constructor(t,r,s){A(this,"jsm");A(this,"js");A(this,"stream");A(this,"name");this.name=t,this.jsm=r,this.js=s}_checkNotEmpty(t){return!t||t.length===0?{name:t,error:new Error("name cannot be empty")}:{name:t}}async info(t){const r=await this.rawInfo(t);return r?new zh(r):null}async list(){const t=[],r=await this.watch({ignoreDeletes:!0,includeHistory:!0});for await(const s of r){if(s===null)break;t.push(s)}return Promise.resolve(t)}async rawInfo(t){const{name:r,error:s}=this._checkNotEmpty(t);if(s)return Promise.reject(s);const l=this._metaSubject(r);try{const c=await this.jsm.streams.getMessage(this.stream,{last_by_subj:l}),p=$n().decode(c.data);return p.revision=c.seq,p}catch(c){return c.code==="404"?null:Promise.reject(c)}}async _si(t){try{return await this.jsm.streams.info(this.stream,t)}catch(r){return r.code==="404"?null:Promise.reject(r)}}async seal(){let t=await this._si();return t===null?Promise.reject(new Error("object store not found")):(t.config.sealed=!0,t=await this.jsm.streams.update(this.stream,t.config),Promise.resolve(new od(t)))}async status(t){const r=await this._si(t);return r===null?Promise.reject(new Error("object store not found")):Promise.resolve(new od(r))}destroy(){return this.jsm.streams.delete(this.stream)}async _put(t,r,s){var ae;const l=this.js.getOptions();s=s||{timeout:l.timeout},s.timeout=s.timeout||l.timeout,s.previousRevision=s.previousRevision??void 0;const{timeout:c,previousRevision:m}=s,p=this.js.nc.info,g=(p==null?void 0:p.max_payload)||1024;t=t||{},t.options=t.options||{};let f=((ae=t.options)==null?void 0:ae.max_chunk_size)||128*1024;f=f>g?g:f,t.options.max_chunk_size=f;const d=await this.info(t.name),{name:b,error:v}=this._checkNotEmpty(t.name);if(v)return Promise.reject(v);const _=fi.next(),w=this._chunkSubject(_),S=this._metaSubject(b),M=Object.assign({bucket:this.name,nuid:_,size:0,chunks:0},xy(t)),L=st(),z=[],ie=new Vs;try{const C=r?r.getReader():null,I=cy.create();for(;;){const{done:re,value:K}=C?await C.read():{done:!0,value:void 0};if(re){if(ie.size()>0){const Q=ie.drain();I.update(Q),M.chunks++,M.size+=Q.length,z.push(this.js.publish(w,Q,{timeout:c}))}await Promise.all(z),z.length=0,M.mtime=new Date().toISOString();const B=Is.encode(I.digest());M.digest=`${by}${B}`,M.deleted=!1;const G=Sr();typeof m=="number"&&G.set(Kn.ExpectedLastSubjectSequenceHdr,`${m}`),G.set($t.RollupHdr,$t.RollupValueSubject);const W=await this.js.publish(S,$n().encode(M),{headers:G,timeout:c});if(M.revision=W.seq,d)try{await this.jsm.streams.purge(this.stream,{filter:`$O.${this.name}.C.${d.nuid}`})}catch{}L.resolve(new zh(M));break}if(K)for(ie.fill(K);ie.size()>f;){M.chunks++,M.size+=f;const B=ie.drain(t.options.max_chunk_size);I.update(B),z.push(this.js.publish(w,B,{timeout:c}))}}}catch(C){await this.jsm.streams.purge(this.stream,{filter:w}),L.reject(C)}return L}putBlob(t,r,s){function l(c){return new ReadableStream({pull(m){m.enqueue(c),m.close()}})}return r===null&&(r=new Uint8Array(0)),this.put(t,l(r),s)}put(t,r,s){var l;return(l=t==null?void 0:t.options)!=null&&l.link?Promise.reject(new Error("link cannot be set when putting the object in bucket")):this._put(t,r,s)}async getBlob(t){async function r(c){const m=new Vs,p=c.getReader();for(;;){const{done:g,value:f}=await p.read();if(g)return m.drain();f&&f.length&&m.fill(f)}}const s=await this.get(t);if(s===null)return Promise.resolve(null);const l=await Promise.all([s.error,r(s.data)]);return l[0]?Promise.reject(l[0]):Promise.resolve(l[1])}async get(t){const r=await this.rawInfo(t);if(r===null||r.deleted)return Promise.resolve(null);if(r.options&&r.options.link){const b=r.options.link.name||"";if(b==="")throw new Error("link is a bucket");return(r.options.link.bucket!==this.name?await lo.create(this.js,r.options.link.bucket):this).get(b)}if(!r.digest.startsWith(by))return Promise.reject(new Error(`unknown digest type: ${r.digest}`));const s=nd(r.digest.substring(8));if(s===null)return Promise.reject(new Error(`unable to parse digest: ${r.digest}`));const l=st(),c={info:new zh(r),error:l};if(r.size===0)return c.data=AE(),l.resolve(null),Promise.resolve(c);let m;const p=li();p.orderedConsumer();const g=cy.create(),f=`$O.${this.name}.C.${r.nuid}`,d=await this.js.subscribe(f,p);return(async()=>{for await(const b of d)b.data.length>0&&(g.update(b.data),m.enqueue(b.data)),b.info.pending===0&&(mS(s,g.digest())?m.close():m.error(new Error(`received a corrupt object, digests do not match received: ${r.digest} calculated ${s}`)),d.unsubscribe())})().then(()=>{l.resolve()}).catch(b=>{m.error(b),l.reject(b)}),c.data=new ReadableStream({start(b){m=b},cancel(){d.unsubscribe()}}),c}linkStore(t,r){if(!(r instanceof lo))return Promise.reject("bucket required");const s=r,{name:l,error:c}=this._checkNotEmpty(t);if(c)return Promise.reject(c);const m={name:l,options:{link:{bucket:s.name}}};return this._put(m,null)}async link(t,r){const{name:s,error:l}=this._checkNotEmpty(t);if(l)return Promise.reject(l);if(r.deleted)return Promise.reject(new Error("src object is deleted"));if(r.isLink())return Promise.reject(new Error("src object is a link"));const c=await this.rawInfo(t);if(c!==null&&!c.deleted)return Promise.reject(new Error("an object already exists with that name"));const m={bucket:r.bucket,name:r.name},p={name:s,bucket:r.bucket,options:{link:m}};await this.js.publish(this._metaSubject(t),JSON.stringify(p));const g=await this.info(t);return Promise.resolve(g)}async delete(t){const r=await this.rawInfo(t);if(r===null)return Promise.resolve({purged:0,success:!1});r.deleted=!0,r.size=0,r.chunks=0,r.digest="";const s=$n(),l=Sr();return l.set($t.RollupHdr,$t.RollupValueSubject),await this.js.publish(this._metaSubject(r.name),s.encode(r),{headers:l}),this.jsm.streams.purge(this.stream,{filter:this._chunkSubject(r.nuid)})}async update(t,r={}){const s=await this.rawInfo(t);if(s===null)return Promise.reject(new Error("object not found"));if(s.deleted)return Promise.reject(new Error("cannot update meta for a deleted object"));r.name=r.name??s.name;const{name:l,error:c}=this._checkNotEmpty(r.name);if(c)return Promise.reject(c);if(t!==r.name){const g=await this.info(r.name);if(g&&!g.deleted)return Promise.reject(new Error("an object already exists with that name"))}r.name=l;const m=Object.assign({},s,xy(r)),p=await this.js.publish(this._metaSubject(m.name),JSON.stringify(m));return t!==r.name&&await this.jsm.streams.purge(this.stream,{filter:this._metaSubject(t)}),Promise.resolve(p)}async watch(t={}){t.includeHistory=t.includeHistory??!1,t.ignoreDeletes=t.ignoreDeletes??!1;let r=!1;const s=new jt,l=this._metaSubjectAll();try{await this.jsm.streams.getMessage(this.stream,{last_by_subj:l})}catch(g){g.code==="404"?(s.push(null),r=!0):s.stop(g)}const c=$n(),m=li();m.orderedConsumer(),t.includeHistory?m.deliverLastPerSubject():(r=!0,m.deliverNew()),m.callback((g,f)=>{var d;if(g){s.stop(g);return}if(f!==null){const b=c.decode(f.data);b.deleted&&t.ignoreDeletes===!0||s.push(b),((d=f.info)==null?void 0:d.pending)===0&&!r&&(r=!0,s.push(null))}});const p=await this.js.subscribe(l,m);return s._data=p,s.iterClosed.then(()=>{p.unsubscribe()}),p.closed.then(()=>{s.stop()}).catch(g=>{s.stop(g)}),s}_chunkSubject(t){return`$O.${this.name}.C.${t}`}_metaSubject(t){return`$O.${this.name}.M.${Is.encode(t)}`}_metaSubjectAll(){return`$O.${this.name}.M.>`}async init(t={}){try{this.stream=pE(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 jE{constructor(t){A(this,"js");this.js=t}kv(t,r={}){const s=this.js,{ok:l,min:c}=s.nc.features.get(Ie.JS_KV);return l?r.bindOnly?ho.bind(this.js,t,r):ho.create(this.js,t,r):Promise.reject(new Error(`kv is only supported on servers ${c} or better`))}os(t,r={}){var m;if(typeof((m=crypto==null?void 0:crypto.subtle)==null?void 0:m.digest)!="function")return Promise.reject(new Error("objectstore: unable to calculate hashes - crypto.subtle.digest with sha256 support is required"));const s=this.js,{ok:l,min:c}=s.nc.features.get(Ie.JS_OBJECTSTORE);return l?lo.create(this.js,t,r):Promise.reject(new Error(`objectstore is only supported on servers ${c} or better`))}}class Cd extends yo{constructor(r,s){super(r,s);A(this,"consumers");A(this,"streams");A(this,"consumerAPI");A(this,"streamAPI");this.consumerAPI=new Zc(r,s),this.streamAPI=new kd(r,s),this.consumers=new cd(this.consumerAPI),this.streams=new OE(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 jE(this)}async publish(r,s=hn,l){l=l||{},l.expect=l.expect||{};const c=(l==null?void 0:l.headers)||Sr();l&&(l.msgID&&c.set(Kn.MsgIdHdr,l.msgID),l.expect.lastMsgID&&c.set(Kn.ExpectedLastMsgIdHdr,l.expect.lastMsgID),l.expect.streamName&&c.set(Kn.ExpectedStreamHdr,l.expect.streamName),typeof l.expect.lastSequence=="number"&&c.set(Kn.ExpectedLastSeqHdr,`${l.expect.lastSequence}`),typeof l.expect.lastSubjectSequence=="number"&&c.set(Kn.ExpectedLastSubjectSequenceHdr,`${l.expect.lastSubjectSequence}`));const m=l.timeout||this.timeout,p={};m&&(p.timeout=m),l&&(p.headers=c);let{retries:g,retry_delay:f}=l;g=g||1,f=f||250;let d;for(let v=0;v<g;v++)try{d=await this.nc.request(r,s,p);break}catch(_){if(_.code==="503"&&v+1<g)await Ys(f);else throw _}const b=this.parseJsResponse(d);if(b.stream==="")throw me.errorForCode(ce.JetStreamInvalidAck);return b.duplicate=b.duplicate?b.duplicate:!1,b}async pull(r,s,l=0){Pt(r),Us(s);let c=this.timeout;l>c&&(c=l),l=l<0?0:it(l);const m={batch:1,no_wait:l===0,expires:l},p=await this.nc.request(`${this.prefix}.CONSUMER.MSG.NEXT.${r}.${s}`,this.jc.encode(m),{noMux:!0,timeout:c}),g=Ps(p);if(g)throw g;return mo(p,this.timeout)}fetch(r,s,l={}){Pt(r),Us(s);let c=null;const m=(l.max_bytes??0)>0;let p=0;const g=m?l.max_bytes:0;let f=null;const d={};if(d.batch=l.batch||1,g){const z=this.nc.features.get(Ie.JS_PULL_MAX_BYTES);if(!z.ok)throw new Error(`max_bytes is only supported on servers ${z.min} or better`);d.max_bytes=g}d.no_wait=l.no_wait||!1,d.no_wait&&d.expires&&(d.expires=0);const b=l.expires||0;if(b&&(d.expires=it(b)),b===0&&d.no_wait===!1)throw new Error("expires or no_wait is required");const v=l.idle_heartbeat||0;v&&(d.idle_heartbeat=it(v),l.delay_heartbeat===!0&&(d.idle_heartbeat=it(v*4)));const _=new jt,w=d.batch;let S=0;_.protocolFilterFn=(z,ie=!1)=>Wh(z.msg)?(f==null||f.work(),!1):!0,_.dispatchedFn=z=>{if(z){if(m&&(p+=z.data.length),S++,c&&z.info.pending===0)return;(_.getPending()===1&&z.info.pending===0||w===S||g>0&&p>=g)&&_.stop()}};const M=wr(this.nc.options.inboxPrefix),L=this.nc.subscribe(M,{max:l.batch,callback:(z,ie)=>{z===null&&(z=Ps(ie)),z!==null?(c&&(c.cancel(),c=null),Kw(z)?_.stop(kb(z)===null?void 0:z):_.stop(z)):(f==null||f.work(),_.received++,_.push(mo(ie,this.timeout)))}});return b&&(c=Gs(b),c.catch(()=>{L.isClosed()||(L.drain().catch(()=>{}),c=null),f&&f.cancel()})),(async()=>{try{v&&(f=new Td(v,z=>(_.push(()=>{_.err=new me(`${Nn.IdleHeartbeatMissed}: ${z}`,ce.JetStreamIdleHeartBeat)}),!0)))}catch{}await L.closed,c!==null&&(c.cancel(),c=null),f&&f.cancel(),_.stop()})().catch(),this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${r}.${s}`,this.jc.encode(d),{reply:M}),_}async pullSubscribe(r,s=li()){const l=await this._processOptions(r,s);if(l.ordered)throw new Error("pull subscribers cannot be be ordered");if(l.config.deliver_subject)throw new Error("consumer info specifies deliver_subject - pull consumers cannot have deliver_subject set");const c=l.config.ack_policy;if(c===At.None||c===At.All)throw new Error("ack policy for pull consumers must be explicit");const m=this._buildTypedSubscriptionOpts(l),p=new CE(this,l.deliver,m);p.info=l;try{await this._maybeCreateConsumer(l)}catch(g){throw p.unsubscribe(),g}return p}async subscribe(r,s=li()){const l=await this._processOptions(r,s);if(!l.isBind&&!l.config.deliver_subject)throw new Error("push consumer requires deliver_subject");const c=this._buildTypedSubscriptionOpts(l),m=new Nb(this,l.deliver,c);m.info=l;try{await this._maybeCreateConsumer(l)}catch(p){throw m.unsubscribe(),p}return m._maybeSetupHbMonitoring(),m}async _processOptions(r,s=li()){const l=sy(s)?s.getOpts():s;if(l.isBind=sy(s)?s.isBind:!1,l.flow_control={heartbeat_count:0,fc_count:0,consumer_restarts:0},l.ordered){if(l.ordered_consumer_sequence={stream_seq:0,delivery_seq:0},l.config.ack_policy!==At.NotSet&&l.config.ack_policy!==At.None)throw new me("ordered consumer: ack_policy can only be set to 'none'",ce.ApiError);if(l.config.durable_name&&l.config.durable_name.length>0)throw new me("ordered consumer: durable_name cannot be set",ce.ApiError);if(l.config.deliver_subject&&l.config.deliver_subject.length>0)throw new me("ordered consumer: deliver_subject cannot be set",ce.ApiError);if(l.config.max_deliver!==void 0&&l.config.max_deliver>1)throw new me("ordered consumer: max_deliver cannot be set",ce.ApiError);if(l.config.deliver_group&&l.config.deliver_group.length>0)throw new me("ordered consumer: deliver_group cannot be set",ce.ApiError);l.config.deliver_subject=wr(this.nc.options.inboxPrefix),l.config.ack_policy=At.None,l.config.max_deliver=1,l.config.flow_control=!0,l.config.idle_heartbeat=l.config.idle_heartbeat||it(5e3),l.config.ack_wait=it(1320*60*1e3),l.config.mem_storage=!0,l.config.num_replicas=1}if(l.config.ack_policy===At.NotSet&&(l.config.ack_policy=At.All),l.api=this,l.config=l.config||{},l.stream=l.stream?l.stream:await this.findStream(r),l.attached=!1,l.config.durable_name)try{const c=await this.consumerAPI.info(l.stream,l.config.durable_name);if(c){if(c.config.filter_subject&&c.config.filter_subject!==r)throw new Error("subject does not match consumer");const m=l.config.deliver_group??"";if(m===""&&c.push_bound===!0)throw new Error("duplicate subscription");const p=c.config.deliver_group??"";if(m!==p)throw p===""?new Error("durable requires no queue group"):new Error(`durable requires queue group '${p}'`);l.last=c,l.config=c.config,l.attached=!0,l.config.durable_name||(l.name=c.name)}}catch(c){if(c.code!=="404")throw c}return!l.attached&&l.config.filter_subject===void 0&&l.config.filter_subjects===void 0&&(l.config.filter_subject=r),l.deliver=l.config.deliver_subject||wr(this.nc.options.inboxPrefix),l}_buildTypedSubscriptionOpts(r){const s={};return s.adapter=ME(r.callbackFn===void 0,this.timeout),s.ingestionFilterFn=Cd.ingestionFn(r.ordered),s.protocolFilterFn=(l,c=!1)=>{const m=l;return Zh(m.msg)?(c||m.msg.respond(),!1):!0},!r.mack&&r.config.ack_policy!==At.None&&(s.dispatchedFn=qE),r.callbackFn&&(s.callback=r.callbackFn),s.max=r.max||0,s.queue=r.queue,s}async _maybeCreateConsumer(r){if(r.attached)return;if(r.isBind)throw new Error(`unable to bind - durable consumer ${r.config.durable_name} doesn't exist in ${r.stream}`);r.config=Object.assign({deliver_policy:mt.All,ack_policy:At.Explicit,ack_wait:it(30*1e3),replay_policy:Fs.Instant},r.config);const s=await this.consumerAPI.add(r.stream,r.config);if(Array.isArray(r.config.filter_subjects&&!Array.isArray(s.config.filter_subjects)))throw new Error("jetstream server doesn't support consumers with multiple filter subjects");r.name=s.name,r.config=s.config,r.last=s}static ingestionFn(r){return(s,l)=>{var g;const c=l;if(!s)return{ingest:!1,protocol:!1};const m=s;if(Ps(m.msg)||(g=c.monitor)==null||g.work(),Wh(m.msg)){const f=r?c._checkHbOrderConsumer(m.msg):!0;return r||c.info.flow_control.heartbeat_count++,{ingest:f,protocol:!0}}else if(Zh(m.msg))return c.info.flow_control.fc_count++,{ingest:!0,protocol:!0};return{ingest:r?c._checkOrderedConsumer(s):!0,protocol:!1}}}}class Md{constructor(t){A(this,"options");A(this,"protocol");A(this,"draining");A(this,"listeners");A(this,"_services");this.draining=!1,this.options=JS(t),this.listeners=[]}static connect(t={}){return new Promise((r,s)=>{const l=new Md(t);eu.connect(l.options,l).then(c=>{l.protocol=c,(async function(){for await(const m of c.status())l.listeners.forEach(p=>{p.push(m)})})(),r(l)}).catch(c=>{s(c)})})}closed(){return this.protocol.closed}async close(){await this.protocol.close()}_check(t,r,s){if(this.isClosed())throw me.errorForCode(ce.ConnectionClosed);if(r&&this.isDraining()||s&&this.protocol.noMorePublishing)throw me.errorForCode(ce.ConnectionDraining);if(t=t||"",t.length===0)throw me.errorForCode(ce.BadSubject)}publish(t,r,s){this._check(t,!1,!0),this.protocol.publish(t,r,s)}publishMessage(t){return this.publish(t.subject,t.data,{reply:t.reply,headers:t.headers})}respondMessage(t){return t.reply?(this.publish(t.reply,t.data,{reply:t.reply,headers:t.headers}),!0):!1}subscribe(t,r={}){this._check(t,!0,!1);const s=new 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=hn,s={maxWait:1e3,maxMessages:-1}){const l=!this.protocol.options.noAsyncTraces;try{this._check(t,!0,!0)}catch(g){return Promise.reject(g)}if(s.strategy=s.strategy||In.Timer,s.maxWait=s.maxWait||1e3,s.maxWait<1)return Promise.reject(new me("timeout",ce.InvalidOption));const c=new jt;function m(g){c.push(()=>{c.stop(g)})}function p(g,f){g||f===null?m(g===null?void 0:g):c.push(f)}if(s.noMux){const g=l?new Error().stack:null;let f=typeof s.maxMessages=="number"&&s.maxMessages>0?s.maxMessages:-1;const d=this.subscribe(wr(this.options.inboxPrefix),{callback:(w,S)=>{var M,L;if(((M=S==null?void 0:S.data)==null?void 0:M.length)===0&&((L=S==null?void 0:S.headers)==null?void 0:L.status)===ce.NoResponders&&(w=me.errorForCode(ce.NoResponders)),w){g&&(w.stack+=`
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+=`
48
48
 
49
- ${g}`),b(w);return}p(null,S),s.strategy===In.Count&&(f--,f===0&&b()),s.strategy===In.JitterTimer&&(_(),v=setTimeout(()=>{b()},300)),s.strategy===In.SentinelMsg&&S&&S.data.length===0&&b()}});d.requestSubject=t,d.closed.then(()=>{m()}).catch(w=>{c.stop(w)});const b=w=>{w&&c.push(()=>{throw w}),_(),d.drain().then(()=>{m()}).catch(S=>{m()})};c.iterClosed.then(()=>{_(),d==null||d.unsubscribe()}).catch(w=>{_(),d==null||d.unsubscribe()});try{this.publish(t,r,{reply:d.getSubject()})}catch(w){b(w)}let v=setTimeout(()=>{b()},s.maxWait);const _=()=>{v&&clearTimeout(v)}}else{const g=s;g.callback=p,c.iterClosed.then(()=>{f.cancel()}).catch(d=>{f.cancel(d)});const f=new pS(this.protocol.muxSubscriptions,t,g);this.protocol.request(f);try{this.publish(t,r,{reply:`${this.protocol.muxSubscriptions.baseInbox}${f.token}`,headers:s.headers})}catch(d){f.cancel(d)}}return Promise.resolve(c)}request(t,r,s={timeout:1e3,noMux:!1}){try{this._check(t,!0,!0)}catch(c){return Promise.reject(c)}const l=!this.protocol.options.noAsyncTraces;if(s.timeout=s.timeout||1e3,s.timeout<1)return Promise.reject(new me("timeout",ce.InvalidOption));if(!s.noMux&&s.reply)return Promise.reject(new me("reply can only be used with noMux",ce.InvalidOption));if(s.noMux){const c=s.reply?s.reply:wr(this.options.inboxPrefix),m=st(),p=l?new Error:null,g=this.subscribe(c,{max:1,timeout:s.timeout,callback:(f,d)=>{f?(p&&f.code!==ce.Timeout&&(f.stack+=`
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+=`
50
50
 
51
- ${p.stack}`),g.unsubscribe(),m.reject(f)):(f=gb(d),f?(p&&(f.stack+=`
51
+ ${p.stack}`),g.unsubscribe(),d.reject(f)):(f=gb(m),f?(p&&(f.stack+=`
52
52
 
53
- ${p.stack}`),m.reject(f)):m.resolve(d))}});return g.requestSubject=t,this.protocol.publish(t,r,{reply:c,headers:s.headers}),m}else{const c=new 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 m=Promise.race([c.timer,c.deferred]);return m.catch(()=>{c.cancel()}),m}}flush(){return this.isClosed()?Promise.reject(me.errorForCode(ce.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(me.errorForCode(ce.ConnectionClosed)):this.isDraining()?Promise.reject(me.errorForCode(ce.ConnectionDraining)):(this.draining=!0,this.protocol.drain())}isClosed(){return this.protocol.isClosed()}isDraining(){return this.draining}getServer(){const t=this.protocol.getServer();return t?t.listen:""}status(){const t=new jt;return t.iterClosed.then(()=>{const r=this.listeners.indexOf(t);this.listeners.splice(r,1)}),this.listeners.push(t),t}get info(){return this.protocol.isClosed()?void 0:this.protocol.info}async context(){return(await this.request("$SYS.REQ.USER.INFO")).json((r,s)=>r==="time"?new Date(Date.parse(s)):s)}stats(){return{inBytes:this.protocol.inBytes,outBytes:this.protocol.outBytes,inMsgs:this.protocol.inMsgs,outMsgs:this.protocol.outMsgs}}async jetstreamManager(t={}){const r=new EE(this,t);if(t.checkAPI!==!1)try{await r.getAccountInfo()}catch(s){const l=s;throw l.code===ce.NoResponders&&(l.code=ce.JetStreamNotEnabled),l}return r}jetstream(t={}){return new Cd(this,t)}getServerVersion(){const t=this.info;return t?$i(t.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw me.errorForCode(ce.Disconnect);const t=Date.now();return await this.flush(),Date.now()-t}get features(){return this.protocol.features}get services(){return this._services||(this._services=new TE(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(me.errorForCode(ce.ConnectionClosed)):this.isDraining()?Promise.reject(me.errorForCode(ce.ConnectionDraining)):this.protocol.reconnect()}}class TE{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 oE(this.nc,t,r)}}class NE{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 kE{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 vS{constructor(r,s,l){super(r.nc,s,l);A(this,"js");A(this,"monitor");this.js=r,this.monitor=null,this.sub.closed.then(()=>{this.monitor&&this.monitor.cancel()})}set info(r){this.sub.info=r}get info(){return this.sub.info}_resetOrderedConsumer(r){if(this.info===null||this.sub.isClosed())return;const s=wr(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,s);const c=this.info;c.config.name=fi.next(),c.ordered_consumer_sequence.delivery_seq=0,c.flow_control.heartbeat_count=0,c.flow_control.fc_count=0,c.flow_control.consumer_restarts++,c.deliver=s,c.config.deliver_subject=s,c.config.deliver_policy=mt.StartSequence,c.config.opt_start_seq=r;const m={};m.stream_name=this.info.stream,m.config=c.config;const p=`${c.api.prefix}.CONSUMER.CREATE.${c.stream}`;this.js._request(p,m,{retries:-1}).then(g=>{const f=g,d=this.sub.info;d.last=f,this.info.config=f.config,this.info.name=f.name}).catch(g=>{const f=new me(`unable to recreate ordered consumer ${c.stream} at seq ${r}`,ce.RequestError,g);this.sub.callback(f,{})})}_maybeSetupHbMonitoring(){var s,l;const r=((l=(s=this.info)==null?void 0:s.config)==null?void 0:l.idle_heartbeat)||0;r&&this._setupHbMonitoring(Ad(r))}_setupHbMonitoring(r,s=0){const l={cancelAfter:0,maxOut:2};s&&(l.cancelAfter=s);const c=this.sub,m=p=>{var d,b,v,_;const g=Ww(409,`${Nn.IdleHeartbeatMissed}: ${p}`,this.sub.subject);if(!((d=this.info)==null?void 0:d.ordered))this.sub.callback(null,g);else{if(!this.js.nc.protocol.connected)return!1;const w=((v=(b=this.info)==null?void 0:b.ordered_consumer_sequence)==null?void 0:v.stream_seq)||0;return this._resetOrderedConsumer(w+1),(_=this.monitor)==null||_.restart(),!1}return!c.noIterator};this.monitor=new Td(r,m,l)}_checkHbOrderConsumer(r){const s=r.headers.get($t.ConsumerStalledHdr);s!==""&&this.js.nc.publish(s);const l=parseInt(r.headers.get($t.LastConsumerSeqHdr),10),c=this.info.ordered_consumer_sequence;return this.info.flow_control.heartbeat_count++,l!==c.delivery_seq&&this._resetOrderedConsumer(c.stream_seq+1),!1}_checkOrderedConsumer(r){const s=this.info.ordered_consumer_sequence,l=r.info.streamSequence,c=r.info.deliverySequence;return c!=s.delivery_seq+1?(this._resetOrderedConsumer(s.stream_seq+1),!1):(s.delivery_seq=c,s.stream_seq=l,!0)}async destroy(){this.isClosed()||await this.drain();const r=this.sub.info,s=r.config.durable_name||r.name,l=`${r.api.prefix}.CONSUMER.DELETE.${r.stream}.${s}`;await r.api._request(l)}async consumerInfo(){const r=this.sub.info,s=r.config.durable_name||r.name,l=`${r.api.prefix}.CONSUMER.INFO.${r.stream}.${s}`,c=await r.api._request(l);return r.last=c,c}}class CE 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,m={};if(m.batch=t.batch||1,m.no_wait=t.no_wait||!1,(t.max_bytes??0)>0){const f=this.js.nc.features.get(Ie.JS_PULL_MAX_BYTES);if(!f.ok)throw new Error(`max_bytes is only supported on servers ${f.min} or better`);m.max_bytes=t.max_bytes}let p=0;t.expires&&t.expires>0&&(p=t.expires,m.expires=it(p));let g=0;if(t.idle_heartbeat&&t.idle_heartbeat>0&&(g=t.idle_heartbeat,m.idle_heartbeat=it(g)),g&&p===0)throw new Error("idle_heartbeat requires expires");if(g>p)throw new Error("expires must be greater than idle_heartbeat");if(this.info){this.monitor&&this.monitor.cancel(),p&&g&&(this.monitor?this.monitor._change(g,p):this._setupHbMonitoring(g,p));const f=this.info.api,d=`${f.prefix}.CONSUMER.MSG.NEXT.${r}.${c}`,b=this.sub.subject;f.nc.publish(d,f.jc.encode(m),{reply:b})}}}function ME(i,t){return i?DE(t):RE(t)}function RE(i){return(t,r)=>t?[t,null]:(t=Ps(r),t?[t,null]:[null,mo(r,i)])}function DE(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 ce.JetStream404NoMessages:case ce.JetStream408RequestTimeout:return null;case ce.JetStream409:return eS(i)?i:null;default:return i}return null}function qE(i){i&&i.ack()}function BE(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 LE{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=BE(this.reply)),this.di}get redelivered(){return this.info.deliveryCount>1}get reply(){return this.msg.reply||""}get seq(){return this.info.streamSequence}doAck(t){this.didAck||(this.didAck=!this.isWIP(t),this.msg.respond(t))}isWIP(t){return t.length===4&&t[0]===Va[0]&&t[1]===Va[1]&&t[2]===Va[2]&&t[3]===Va[3]}async ackAck(t){var s;t=t||{},t.timeout=t.timeout||this.timeout;const r=st();if(this.didAck)r.resolve(!1);else if(this.didAck=!0,this.msg.reply){const c=this.msg.publisher,m=!((s=c.options)!=null&&s.noAsyncTraces),p=new vb(c.muxSubscriptions,this.msg.reply,{timeout:t.timeout},m);c.request(p);try{c.publish(this.msg.reply,vy,{reply:`${c.muxSubscriptions.baseInbox}${p.token}`})}catch(g){p.cancel(g)}try{await Promise.race([p.timer,p.deferred]),r.resolve(!0)}catch(g){p.cancel(g),r.reject(g)}}else r.resolve(!1);return r}ack(){this.doAck(vy)}nak(t){let r=yE;t&&(r=Qh().encode(`-NAK ${JSON.stringify({delay:it(t)})}`)),this.doAck(r)}working(){this.doAck(Va)}next(t,r={batch:1}){const s={};s.batch=r.batch||1,s.no_wait=r.no_wait||!1,r.expires&&r.expires>0&&(s.expires=it(r.expires));const l=$n().encode(s),c=Vs.concat(bE,xE,l),m=t?{reply:t}:void 0;this.msg.respond(c,m)}term(t=""){let r=vE;(t==null?void 0:t.length)>0&&(r=Qh().encode(`+TERM ${t}`)),this.doAck(r)}json(){return this.msg.json()}string(){return this.msg.string()}}const zE="1.30.3",UE="nats.ws";class PE{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=zE,this.lang=UE,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=st(),this.closedNotification=st()}async connect(t,r){const s=st();if(r.tls)return s.reject(new me("tls",ce.InvalidOption)),s;this.options=r;const l=t.src;if(r.wsFactory){const{socket:c,encrypted:m}=await r.wsFactory(t.src,r);this.socket=c,this.encrypted=m}else this.encrypted=l.indexOf("wss://")===0,this.socket=new WebSocket(l);return this.socket.binaryType="arraybuffer",this.socket.onopen=()=>{this.isDiscarded()},this.socket.onmessage=c=>{if(this.isDiscarded())return;if(this.yields.push(new Uint8Array(c.data)),this.peeked){this.signal.resolve();return}const m=Vs.concat(...this.yields),p=OS(m);if(p!==""){const g=WS.exec(p);if(!g){r.debug&&console.error("!!!",Fl(m)),s.reject(new Error("unexpected response from server"));return}try{const f=JSON.parse(g[1]);QS(f,this.options),this.peeked=!0,this.connected=!0,this.signal.resolve(),s.resolve()}catch(f){s.reject(f);return}}},this.socket.onclose=c=>{if(this.isDiscarded())return;this.socketClosed=!0;let m;this.done||(c.wasClean||(m=new Error(c.reason)),this._closed(m))},this.socket.onerror=c=>{if(this.isDiscarded())return;const m=c,p=new me(m.message,ce.Unknown,new Error(m.error));s.reject(p)},s}disconnect(){this._closed(void 0,!0)}async _closed(t,r=!0){if(!this.isDiscarded()&&this.connected&&!this.done){if(this.closeError=t,!t)for(;!this.socketClosed&&this.socket.bufferedAmount>0;)await Ys(100);this.done=!0;try{this.socket.close(t?1002:1e3,t?t.message:void 0)}catch{}r&&this.closedNotification.resolve(t)}}get isClosed(){return this.done}[Symbol.asyncIterator](){return this.iterate()}async*iterate(){for(;;){if(this.isDiscarded())return;this.yields.length===0&&await this.signal;const t=this.yields;this.yields=[];for(let r=0;r<t.length;r++)this.options.debug&&console.info(`> ${Fl(t[r])}`),yield t[r];if(this.done)break;this.yields.length===0&&(t.length=0,this.yields=t,this.signal=st())}}isEncrypted(){return this.connected&&this.encrypted}send(t){if(!this.isDiscarded())try{this.socket.send(t.buffer),this.options.debug&&console.info(`< ${Fl(t)}`);return}catch(r){this.options.debug&&console.error(`!!! ${Fl(t)}: ${r}`)}}close(t){return this._closed(t,!1)}closed(){return this.closedNotification}isDiscarded(){return this.done?(this.discard(),!0):!1}discard(){var t;this.done=!0;try{(t=this.socket)==null||t.close()}catch{}}}function IE(i,t){/^(.*:\/\/)(.*)/.test(i)||(typeof t=="boolean"?i=`${t===!0?"https":"http"}://${i}`:i=`https://${i}`);let s=new URL(i);const l=s.protocol.toLowerCase();l==="ws:"&&(t=!1),l==="wss:"&&(t=!0),l!=="https:"&&l!=="http"&&(i=i.replace(/^(.*:\/\/)(.*)/gm,"$2"),s=new URL(`http://${i}`));let c,m;const p=s.hostname,g=s.pathname,f=s.search||"";switch(l){case"http:":case"ws:":case"nats:":m=s.port||"80",c="ws:";break;case"https:":case"wss:":case"tls:":m=s.port||"443",c="wss:";break;default:m=s.port||t===!0?"443":"80",c=t===!0?"wss:":"ws:";break}return`${c}//${p}:${m}${g}${f}`}function $E(i={}){return xS({defaultPort:443,urlParseFn:IE,factory:()=>new PE}),Md.connect(i)}const HE=null,GE=null,FE="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 Xs=j.createContext({connected:!1,subscribe:()=>()=>{}});function VE(){const{connected:i}=j.useContext(Xs);return{connected:i}}function s3(i,t){const{subscribe:r}=j.useContext(Xs),s=j.useRef(t);s.current=t,j.useEffect(()=>r(i,c=>s.current(c)),[r,i])}function Rd(i,t){const{subscribe:r}=j.useContext(Xs),s=j.useRef(t);s.current=t;const l=i.join(","),c=j.useMemo(()=>l.split(",").filter(Boolean),[l]);j.useEffect(()=>{const m=g=>s.current(g),p=c.map(g=>r(g,m));return()=>p.forEach(g=>g())},[r,c])}const YE=j.createContext({connected:!1,subscribe:()=>()=>{}}),XE=Qh();function KE({children:i,url:t,token:r}){const s=j.useRef(null),[l,c]=j.useState(!1),m=j.useRef(null),p=j.useRef(new Map),g=j.useRef(new Map),f=j.useCallback((_,w)=>{(async()=>{for await(const S of w)try{if(!Cb(S.subject,_))continue;const M=JSON.parse(XE.decode(S.data)),L=p.current.get(_);if(!L)continue;for(const z of L)try{z(M)}catch{}}catch{}})()},[]),d=j.useCallback(_=>{var S;const w=s.current;if(!(!w||(S=w.isClosed)!=null&&S.call(w)||g.current.has(_)))try{const M=w.subscribe(_);g.current.set(_,M),f(_,M)}catch{}},[f]),b=j.useCallback((_,w)=>{const S=p.current;return S.has(_)||S.set(_,new Set),S.get(_).add(w),d(_),()=>{const M=S.get(_);if(M&&(M.delete(w),M.size===0)){S.delete(_);const L=g.current.get(_);if(L){g.current.delete(_);try{L.unsubscribe()}catch{}}}}},[d]),v=j.useCallback(async()=>{try{if(s.current)return;const _=t||HE;if(!_){console.error("[lt-nats] no NATS WebSocket URL configured — set NATS_WS_URL on the server");return}const w=await $E({servers:_,token:r||GE||void 0,reconnect:!0,maxReconnectAttempts:-1,reconnectTimeWait:2e3});s.current=w,c(!0);for(const S of p.current.keys())d(S);(async()=>{for await(const S of w.status())S.type==="disconnect"||S.type==="error"?c(!1):S.type==="reconnect"&&c(!0)})()}catch{c(!1),m.current=setTimeout(v,3e3)}},[d]);return j.useEffect(()=>(v(),()=>{m.current&&clearTimeout(m.current);for(const _ of g.current.values())try{_.unsubscribe()}catch{}g.current.clear(),s.current&&(s.current.close().catch(()=>{}),s.current=null),c(!1)}),[v]),y.jsx(YE.Provider,{value:{connected:l,subscribe:b},children:y.jsx(Xs.Provider,{value:{connected:l,subscribe:b},children:i})})}const Zn=Object.create(null);Zn.open="0";Zn.close="1";Zn.ping="2";Zn.pong="3";Zn.message="4";Zn.upgrade="5";Zn.noop="6";const Hc=Object.create(null);Object.keys(Zn).forEach(i=>{Hc[Zn[i]]=i});const fd={type:"error",data:"parser error"},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 Uh;function JE(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=>{Uh||(Uh=new TextEncoder),t(Uh.encode(r))})}const Sy="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",io=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let i=0;i<Sy.length;i++)io[Sy.charCodeAt(i)]=i;const QE=i=>{let t=i.length*.75,r=i.length,s,l=0,c,m,p,g;i[i.length-1]==="="&&(t--,i[i.length-2]==="="&&t--);const f=new ArrayBuffer(t),d=new Uint8Array(f);for(s=0;s<r;s+=4)c=io[i.charCodeAt(s)],m=io[i.charCodeAt(s+1)],p=io[i.charCodeAt(s+2)],g=io[i.charCodeAt(s+3)],d[l++]=c<<2|m>>4,d[l++]=(m&15)<<4|p>>2,d[l++]=(p&3)<<6|g&63;return f},ZE=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:WE(i.substring(1),t)}:Hc[r]?i.length>1?{type:Hc[r],data:i.substring(1)}:{type:Hc[r]}:fd},WE=(i,t)=>{if(ZE){const r=QE(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="",e2=(i,t)=>{const r=i.length,s=new Array(r);let l=0;i.forEach((c,m)=>{Dd(c,!1,p=>{s[m]=p,++l===r&&t(s.join(Bb))})})},t2=(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 n2(){return new TransformStream({transform(i,t){JE(i,r=>{const s=r.length;let l;if(s<126)l=new Uint8Array(1),new DataView(l.buffer).setUint8(0,s);else if(s<65536){l=new Uint8Array(3);const c=new DataView(l.buffer);c.setUint8(0,126),c.setUint16(1,s)}else{l=new Uint8Array(9);const c=new DataView(l.buffer);c.setUint8(0,127),c.setBigUint64(1,BigInt(s))}i.data&&typeof i.data!="string"&&(l[0]|=128),t.enqueue(l),t.enqueue(r)})}})}let Ph;function Kl(i){return i.reduce((t,r)=>t+r.length,0)}function Jl(i,t){if(i[0].length===t)return i.shift();const r=new Uint8Array(t);let s=0;for(let l=0;l<t;l++)r[l]=i[0][s++],s===i[0].length&&(i.shift(),s=0);return i.length&&s<i[0].length&&(i[0]=i[0].slice(s)),r}function r2(i,t){Ph||(Ph=new TextDecoder);const r=[];let s=0,l=-1,c=!1;return new TransformStream({transform(m,p){for(r.push(m);;){if(s===0){if(Kl(r)<1)break;const g=Jl(r,1);c=(g[0]&128)===128,l=g[0]&127,l<126?s=3:l===126?s=1:s=2}else if(s===1){if(Kl(r)<2)break;const g=Jl(r,2);l=new DataView(g.buffer,g.byteOffset,g.length).getUint16(0),s=3}else if(s===2){if(Kl(r)<8)break;const g=Jl(r,8),f=new DataView(g.buffer,g.byteOffset,g.length),d=f.getUint32(0);if(d>Math.pow(2,21)-1){p.enqueue(fd);break}l=d*Math.pow(2,32)+f.getUint32(4),s=3}else{if(Kl(r)<l)break;const g=Jl(r,l);p.enqueue(qd(c?g:Ph.decode(g),t)),s=0}if(l===0||l>i){p.enqueue(fd);break}}}})}const Lb=4;function _t(i){if(i)return i2(i)}function i2(i){for(var t in _t.prototype)i[t]=_t.prototype[t];return i}_t.prototype.on=_t.prototype.addEventListener=function(i,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+i]=this._callbacks["$"+i]||[]).push(t),this};_t.prototype.once=function(i,t){function r(){this.off(i,r),t.apply(this,arguments)}return r.fn=t,this.on(i,r),this};_t.prototype.off=_t.prototype.removeListener=_t.prototype.removeAllListeners=_t.prototype.removeEventListener=function(i,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var r=this._callbacks["$"+i];if(!r)return this;if(arguments.length==1)return delete this._callbacks["$"+i],this;for(var s,l=0;l<r.length;l++)if(s=r[l],s===t||s.fn===t){r.splice(l,1);break}return r.length===0&&delete this._callbacks["$"+i],this};_t.prototype.emit=function(i){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),r=this._callbacks["$"+i],s=1;s<arguments.length;s++)t[s-1]=arguments[s];if(r){r=r.slice(0);for(var s=0,l=r.length;s<l;++s)r[s].apply(this,t)}return this};_t.prototype.emitReserved=_t.prototype.emit;_t.prototype.listeners=function(i){return this._callbacks=this._callbacks||{},this._callbacks["$"+i]||[]};_t.prototype.hasListeners=function(i){return!!this.listeners(i).length};const hu=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,r)=>r(t,0),kn=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),s2="arraybuffer";function zb(i,...t){return t.reduce((r,s)=>(i.hasOwnProperty(s)&&(r[s]=i[s]),r),{})}const a2=kn.setTimeout,o2=kn.clearTimeout;function du(i,t){t.useNativeTimers?(i.setTimeoutFn=a2.bind(kn),i.clearTimeoutFn=o2.bind(kn)):(i.setTimeoutFn=kn.setTimeout.bind(kn),i.clearTimeoutFn=kn.clearTimeout.bind(kn))}const l2=1.33;function c2(i){return typeof i=="string"?u2(i):Math.ceil((i.byteLength||i.size)*l2)}function u2(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 f2(i){let t="";for(let r in i)i.hasOwnProperty(r)&&(t.length&&(t+="&"),t+=encodeURIComponent(r)+"="+encodeURIComponent(i[r]));return t}function h2(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 d2 extends Error{constructor(t,r,s){super(t),this.description=r,this.context=s,this.type="TransportError"}}class Bd extends _t{constructor(t){super(),this.writable=!1,du(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,r,s){return super.emitReserved("error",new d2(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=f2(t);return r.length?"?"+r:""}}class m2 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)};t2(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,e2(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 p2=Pb;function g2(){}class y2 extends m2{constructor(t){if(super(t),typeof location<"u"){const r=location.protocol==="https:";let s=location.port;s||(s=r?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||s!==t.port}}doWrite(t,r){const s=this.request({method:"POST",data:t});s.on("success",r),s.on("error",(l,c)=>{this.onError("xhr post error",l,c)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(r,s)=>{this.onError("xhr poll error",r,s)}),this.pollXhr=t}}class Qn extends _t{constructor(t,r,s){super(),this.createRequest=t,du(this,s),this._opts=s,this._method=s.method||"GET",this._uri=r,this._data=s.data!==void 0?s.data:null,this._create()}_create(){var t;const r=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=g2,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 b2=(function(){const i=Ib({xdomain:!1});return i&&i.responseType!==null})();class v2 extends y2{constructor(t){super(t);const r=t&&t.forceBase64;this.supportsBinary=b2&&!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||p2))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 x2 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&&hu(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",r=this.query||{};return this.opts.timestampRequests&&(r[this.opts.timestampParam]=Ub()),this.supportsBinary||(r.b64=1),this.createUri(t,r)}}const Ih=kn.WebSocket||kn.MozWebSocket;class _2 extends x2{createSocket(t,r,s){return $b?new Ih(t,r,s):r?new Ih(t,r):new Ih(t)}doWrite(t,r){this.ws.send(r)}}class w2 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=r2(Number.MAX_SAFE_INTEGER,this.socket.binaryType),s=t.readable.pipeThrough(r).getReader(),l=n2();l.readable.pipeTo(t.writable),this._writer=l.writable.getWriter();const c=()=>{s.read().then(({done:p,value:g})=>{p||(this.onPacket(g),c())}).catch(p=>{})};c();const m={type:"open"};this.query.sid&&(m.data=`{"sid":"${this.query.sid}"}`),this._writer.write(m).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let r=0;r<t.length;r++){const s=t[r],l=r===t.length-1;this._writer.write(s).then(()=>{l&&hu(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const S2={websocket:_2,webtransport:w2,polling:v2},E2=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,O2=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function hd(i){if(i.length>8e3)throw"URI too long";const t=i,r=i.indexOf("["),s=i.indexOf("]");r!=-1&&s!=-1&&(i=i.substring(0,r)+i.substring(r,s).replace(/:/g,";")+i.substring(s,i.length));let l=E2.exec(i||""),c={},m=14;for(;m--;)c[O2[m]]=l[m]||"";return r!=-1&&s!=-1&&(c.source=t,c.host=c.host.substring(1,c.host.length-1).replace(/;/g,":"),c.authority=c.authority.replace("[","").replace("]","").replace(/;/g,":"),c.ipv6uri=!0),c.pathNames=A2(c,c.path),c.queryKey=j2(c,c.query),c}function A2(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 j2(i,t){const r={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(s,l,c){l&&(r[l]=c)}),r}const dd=typeof addEventListener=="function"&&typeof removeEventListener=="function",Gc=[];dd&&addEventListener("offline",()=>{Gc.forEach(i=>i())},!1);class ci extends _t{constructor(t,r){if(super(),this.binaryType=s2,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(r=t,t=null),t){const s=hd(t);r.hostname=s.host,r.secure=s.protocol==="https"||s.protocol==="wss",r.port=s.port,s.query&&(r.query=s.query)}else r.host&&(r.hostname=hd(r.host).host);du(this,r),this.secure=r.secure!=null?r.secure:typeof location<"u"&&location.protocol==="https:",r.hostname&&!r.port&&(r.port=this.secure?"443":"80"),this.hostname=r.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=r.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},r.transports.forEach(s=>{const l=s.prototype.name;this.transports.push(l),this._transportsByName[l]=s}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},r),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=h2(this.opts.query)),dd&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Gc.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const r=Object.assign({},this.opts.query);r.EIO=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+=c2(l)),s>0&&r>this._maxPayload)return this.writeBuffer.slice(0,s);r+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,hu(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,r,s){return this._sendPacket("message",t,r,s),this}send(t,r,s){return this._sendPacket("message",t,r,s),this}_sendPacket(t,r,s,l){if(typeof r=="function"&&(l=r,r=void 0),typeof s=="function"&&(l=s,s=null),this.readyState==="closing"||this.readyState==="closed")return;s=s||{},s.compress=s.compress!==!1;const c={type:t,data:r,options:s};this.emitReserved("packetCreate",c),this.writeBuffer.push(c),l&&this.once("flush",l),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},r=()=>{this.off("upgrade",r),this.off("upgradeError",r),t()},s=()=>{this.once("upgrade",r),this.once("upgradeError",r)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?s():t()}):this.upgrading?s():t()),this}_onError(t){if(ci.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,r){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),dd&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const s=Gc.indexOf(this._offlineEventListener);s!==-1&&Gc.splice(s,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,r),this.writeBuffer=[],this._prevBufferLen=0}}}ci.protocol=Lb;class T2 extends ci{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let r=this.createTransport(t),s=!1;ci.priorWebsocketSuccess=!1;const l=()=>{s||(r.send([{type:"ping",data:"probe"}]),r.once("packet",b=>{if(!s)if(b.type==="pong"&&b.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",r),!r)return;ci.priorWebsocketSuccess=r.name==="websocket",this.transport.pause(()=>{s||this.readyState!=="closed"&&(d(),this.setTransport(r),r.send([{type:"upgrade"}]),this.emitReserved("upgrade",r),r=null,this.upgrading=!1,this.flush())})}else{const v=new Error("probe error");v.transport=r.name,this.emitReserved("upgradeError",v)}}))};function c(){s||(s=!0,d(),r.close(),r=null)}const m=b=>{const v=new Error("probe error: "+b);v.transport=r.name,c(),this.emitReserved("upgradeError",v)};function p(){m("transport closed")}function g(){m("socket closed")}function f(b){r&&b.name!==r.name&&c()}const d=()=>{r.removeListener("open",l),r.removeListener("error",m),r.removeListener("close",p),this.off("close",g),this.off("upgrading",f)};r.once("open",l),r.once("error",m),r.once("close",p),this.once("close",g),this.once("upgrading",f),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{s||r.open()},200):r.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const r=[];for(let s=0;s<t.length;s++)~this.transports.indexOf(t[s])&&r.push(t[s]);return r}}let N2=class extends T2{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=>S2[l]).filter(l=>!!l)),super(t,s)}};function k2(i,t="",r){let s=i;r=r||typeof location<"u"&&location,i==null&&(i=r.protocol+"//"+r.host),typeof i=="string"&&(i.charAt(0)==="/"&&(i.charAt(1)==="/"?i=r.protocol+i:i=r.host+i),/^(https?|wss?):\/\//.test(i)||(typeof r<"u"?i=r.protocol+"//"+i:i="https://"+i),s=hd(i)),s.port||(/^(http|ws)$/.test(s.protocol)?s.port="80":/^(http|ws)s$/.test(s.protocol)&&(s.port="443")),s.path=s.path||"/";const c=s.host.indexOf(":")!==-1?"["+s.host+"]":s.host;return s.id=s.protocol+"://"+c+":"+s.port+t,s.href=s.protocol+"://"+c+(r&&r.port===s.port?"":":"+s.port),s}const C2=typeof ArrayBuffer=="function",M2=i=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(i):i.buffer instanceof ArrayBuffer,Hb=Object.prototype.toString,R2=typeof Blob=="function"||typeof Blob<"u"&&Hb.call(Blob)==="[object BlobConstructor]",D2=typeof File=="function"||typeof File<"u"&&Hb.call(File)==="[object FileConstructor]";function Ld(i){return C2&&(i instanceof ArrayBuffer||M2(i))||R2&&i instanceof Blob||D2&&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 q2(i){const t=[],r=i.data,s=i;return s.data=md(r,t),s.attachments=t.length,{packet:s,buffers:t}}function md(i,t){if(!i)return i;if(Ld(i)){const r={_placeholder:!0,num:t.length};return t.push(i),r}else if(Array.isArray(i)){const r=new Array(i.length);for(let s=0;s<i.length;s++)r[s]=md(i[s],t);return r}else if(typeof i=="object"&&!(i instanceof Date)){const r={};for(const s in i)Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=md(i[s],t));return r}return i}function B2(i,t){return i.data=pd(i.data,t),delete i.attachments,i}function pd(i,t){if(!i)return i;if(i&&i._placeholder===!0){if(typeof i.num=="number"&&i.num>=0&&i.num<t.length)return t[i.num];throw new Error("illegal attachments")}else if(Array.isArray(i))for(let r=0;r<i.length;r++)i[r]=pd(i[r],t);else if(typeof i=="object")for(const r in i)Object.prototype.hasOwnProperty.call(i,r)&&(i[r]=pd(i[r],t));return i}const L2=["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 z2{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=q2(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 U2(r),r.attachments===0&&super.emitReserved("decoded",r)):super.emitReserved("decoded",r)}else if(Ld(t)||t.base64)if(this.reconstructor)r=this.reconstructor.takeBinaryData(t),r&&(this.reconstructor=null,super.emitReserved("decoded",r));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let r=0;const s={type:Number(t.charAt(0))};if(Ue[s.type]===void 0)throw new Error("unknown packet type "+s.type);if(s.type===Ue.BINARY_EVENT||s.type===Ue.BINARY_ACK){const c=r+1;for(;t.charAt(++r)!=="-"&&r!=t.length;);const m=t.substring(c,r);if(m!=Number(m)||t.charAt(r)!=="-")throw new Error("Illegal attachments");const p=Number(m);if(!P2(p)||p<0)throw new Error("Illegal attachments");if(p>this.opts.maxAttachments)throw new Error("too many attachments");s.attachments=p}if(t.charAt(r+1)==="/"){const c=r+1;for(;++r&&!(t.charAt(r)===","||r===t.length););s.nsp=t.substring(c,r)}else s.nsp="/";const l=t.charAt(r+1);if(l!==""&&Number(l)==l){const c=r+1;for(;++r;){const m=t.charAt(r);if(m==null||Number(m)!=m){--r;break}if(r===t.length)break}s.id=Number(t.substring(c,r+1))}if(t.charAt(++r)){const c=this.tryParse(t.substr(r));if(zd.isPayloadValid(s.type,c))s.data=c;else throw new Error("invalid payload")}return s}tryParse(t){try{return JSON.parse(t,this.opts.reviver)}catch{return!1}}static isPayloadValid(t,r){switch(t){case Ue.CONNECT:return Oy(r);case Ue.DISCONNECT:return r===void 0;case Ue.CONNECT_ERROR:return typeof r=="string"||Oy(r);case Ue.EVENT:case Ue.BINARY_EVENT:return Array.isArray(r)&&(typeof r[0]=="number"||typeof r[0]=="string"&&L2.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 U2{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=B2(this.reconPack,this.buffers);return this.finishedReconstruction(),r}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const P2=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 I2=Object.freeze(Object.defineProperty({__proto__:null,Decoder:zd,Encoder:z2,get PacketType(){return Ue}},Symbol.toStringTag,{value:"Module"}));function Pn(i,t,r){return i.on(t,r),function(){i.off(t,r)}}const $2=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($2.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(r.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(r),this;const m={type:Ue.EVENT,data:r};if(m.options={},m.options.compress=this.flags.compress!==!1,typeof r[r.length-1]=="function"){const d=this.ids++,b=r.pop();this._registerAckCallback(d,b),m.id=d}const p=(l=(s=this.io.engine)===null||s===void 0?void 0:s.transport)===null||l===void 0?void 0:l.writable,g=this.connected&&!(!((c=this.io.engine)===null||c===void 0)&&c._hasPingExpired());return this.flags.volatile&&!p||(g?(this.notifyOutgoingListeners(m),this.packet(m)):this.sendBuffer.push(m)),this.flags={},this}_registerAckCallback(t,r){var s;const l=(s=this.flags.timeout)!==null&&s!==void 0?s:this._opts.ackTimeout;if(l===void 0){this.acks[t]=r;return}const c=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let p=0;p<this.sendBuffer.length;p++)this.sendBuffer[p].id===t&&this.sendBuffer.splice(p,1);r.call(this,new Error("operation has timed out"))},l),m=(...p)=>{this.io.clearTimeoutFn(c),r.apply(this,p)};m.withError=!0,this.acks[t]=m}emitWithAck(t,...r){return new Promise((s,l)=>{const c=(m,p)=>m?l(m):s(p);c.withError=!0,r.push(c),this.emit(t,...r)})}_addToQueue(t){let r;typeof t[t.length-1]=="function"&&(r=t.pop());const s={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((l,...c)=>(this._queue[0],l!==null?s.tryCount>this._opts.retries&&(this._queue.shift(),r&&r(l)):(this._queue.shift(),r&&r(null,...c)),s.pending=!1,this._drainQueue())),this._queue.push(s),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const r=this._queue[0];r.pending&&!t||(r.pending=!0,r.tryCount++,this.flags=r.flags,this.emit.apply(this,r.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:Ue.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,r){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,r),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(s=>String(s.id)===t)){const s=this.acks[t];delete this.acks[t],s.withError&&s.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case Ue.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Ue.EVENT:case Ue.BINARY_EVENT:this.onevent(t);break;case Ue.ACK:case Ue.BINARY_ACK:this.onack(t);break;case Ue.DISCONNECT:this.ondisconnect();break;case Ue.CONNECT_ERROR:this.destroy();const s=new Error(t.data.message);s.data=t.data.data,this.emitReserved("connect_error",s);break}}onevent(t){const r=t.data||[];t.id!=null&&r.push(this.ack(t.id)),this.connected?this.emitEvent(r):this.receiveBuffer.push(Object.freeze(r))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const r=this._anyListeners.slice();for(const s of r)s.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const r=this;let s=!1;return function(...l){s||(s=!0,r.packet({type:Ue.ACK,id:t,data:l}))}}onack(t){const r=this.acks[t.id];typeof r=="function"&&(delete this.acks[t.id],r.withError&&t.data.unshift(null),r.apply(this,t.data))}onconnect(t,r){this.id=t,this.recovered=r&&this._pid===r,this._pid=r,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Ue.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const r=this._anyListeners;for(let s=0;s<r.length;s++)if(t===r[s])return r.splice(s,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const r=this._anyOutgoingListeners;for(let s=0;s<r.length;s++)if(t===r[s])return r.splice(s,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const r=this._anyOutgoingListeners.slice();for(const s of r)s.apply(this,t.data)}}}function Ks(i){i=i||{},this.ms=i.min||100,this.max=i.max||1e4,this.factor=i.factor||2,this.jitter=i.jitter>0&&i.jitter<=1?i.jitter:0,this.attempts=0}Ks.prototype.duration=function(){var i=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),r=Math.floor(t*this.jitter*i);i=(Math.floor(t*10)&1)==0?i-r:i+r}return Math.min(i,this.max)|0};Ks.prototype.reset=function(){this.attempts=0};Ks.prototype.setMin=function(i){this.ms=i};Ks.prototype.setMax=function(i){this.max=i};Ks.prototype.setJitter=function(i){this.jitter=i};class gd extends _t{constructor(t,r){var s;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(r=t,t=void 0),r=r||{},r.path=r.path||"/socket.io",this.opts=r,du(this,r),this.reconnection(r.reconnection!==!1),this.reconnectionAttempts(r.reconnectionAttempts||1/0),this.reconnectionDelay(r.reconnectionDelay||1e3),this.reconnectionDelayMax(r.reconnectionDelayMax||5e3),this.randomizationFactor((s=r.randomizationFactor)!==null&&s!==void 0?s:.5),this.backoff=new Ks({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(r.timeout==null?2e4:r.timeout),this._readyState="closed",this.uri=t;const l=r.parser||I2;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 N2(this.uri,this.opts);const r=this.engine,s=this;this._readyState="opening",this.skipReconnect=!1;const l=Pn(r,"open",function(){s.onopen(),t&&t()}),c=p=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",p),t?t(p):this.maybeReconnectOnOpen()},m=Pn(r,"error",c);if(this._timeout!==!1){const p=this._timeout,g=this.setTimeoutFn(()=>{l(),c(new Error("timeout")),r.close()},p);this.opts.autoUnref&&g.unref(),this.subs.push(()=>{this.clearTimeoutFn(g)})}return this.subs.push(l),this.subs.push(m),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Pn(t,"ping",this.onping.bind(this)),Pn(t,"data",this.ondata.bind(this)),Pn(t,"error",this.onerror.bind(this)),Pn(t,"close",this.onclose.bind(this)),Pn(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(r){this.onclose("parse error",r)}}ondecoded(t){hu(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,r){let s=this.nsps[t];return s?this._autoConnect&&!s.active&&s.connect():(s=new 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=k2(i,t.path||"/socket.io"),s=r.source,l=r.id,c=r.path,m=Ya[l]&&c in Ya[l].nsps,p=t.forceNew||t["force new connection"]||t.multiplex===!1||m;let g;return p?g=new gd(s,t):(Ya[l]||(Ya[l]=new gd(s,t)),g=Ya[l]),r.query&&!t.query&&(t.query=r.queryKey),g.socket(r.path,t)}Object.assign(Vc,{Manager:gd,Socket:Gb,io:Vc,connect:Vc});const H2=j.createContext({connected:!1,subscribe:()=>()=>{}});function G2({children:i}){const t=j.useRef(null),[r,s]=j.useState(!1),l=j.useRef(new Map),c=j.useCallback((p,g)=>{var d;const f=l.current;return f.has(p)||(f.set(p,new Set),(d=t.current)==null||d.emit("lt.subscribe",p)),f.get(p).add(g),()=>{var v;const b=f.get(p);b&&(b.delete(g),b.size===0&&(f.delete(p),(v=t.current)==null||v.emit("lt.unsubscribe",p)))}},[]),m=j.useCallback((p,g)=>{for(const[f,d]of l.current)if(Cb(p,f))for(const b of d)try{b(g)}catch{}},[]);return j.useEffect(()=>{const p=hb(),g=Vc({path:`${Mt}/socket.io`,transports:["polling","websocket"],upgrade:!0,reconnection:!0,reconnectionAttempts:1/0,reconnectionDelay:2e3,...p?{auth:{token:p}}:{}});return t.current=g,console.log("[lt-socketio] connecting..."),g.on("connect",()=>{console.log("[lt-socketio] connected, id:",g.id),s(!0);for(const f of l.current.keys())g.emit("lt.subscribe",f)}),g.on("disconnect",f=>{console.log("[lt-socketio] disconnected:",f),s(!1)}),g.on("connect_error",f=>{console.warn("[lt-socketio] connect error:",f.message),s(!1)}),g.onAny((f,d)=>{if(f.startsWith("lt."))try{const b=typeof d=="string"?JSON.parse(d):d;m(f,b)}catch{}}),()=>{g.removeAllListeners(),g.disconnect(),t.current=null,s(!1)}},[m]),y.jsx(H2.Provider,{value:{connected:r,subscribe:c},children:y.jsx(Xs.Provider,{value:{connected:r,subscribe:c},children:i})})}function F2({children:i}){const[t,r]=j.useState(null),[s,l]=j.useState({url:null,token:null});return j.useEffect(()=>{let c=!1;async function m(){var p;try{console.log("[lt-transport] detecting event transport...");const g=await fetch(`${Mt}/api/settings`);if(!g.ok){console.warn("[lt-transport] settings fetch failed, falling back to socketio"),c||r("socketio");return}const f=await g.json(),d=(p=f==null?void 0:f.events)==null?void 0:p.transport;if(console.log("[lt-transport] server reports:",d),!c){if(d==="nats"){let b=f.events.natsWsUrl??null,v=null;const _=hb();if(_)try{const w=await fetch(`${Mt}/api/nats-credentials`,{headers:{Authorization:`Bearer ${_}`}});if(w.ok){const S=await w.json();b=S.natsWsUrl??b,v=S.natsToken??null}}catch{console.warn("[lt-transport] failed to fetch NATS credentials")}l({url:b,token:v})}r(d==="nats"?"nats":"socketio")}}catch(g){console.warn("[lt-transport] settings fetch error, falling back to socketio",g),c||r("socketio")}}return m(),()=>{c=!0}},[]),t==="nats"?y.jsx(KE,{url:s.url,token:s.token,children:i}):t==="socketio"?y.jsx(G2,{children:i}):y.jsx(y.Fragment,{children:i})}const Ud="lt_view_as",Pd="lt_ai_override",yd="lt_graph_enabled",Id="lt_scan_override";function Fb(){try{const i=localStorage.getItem(Pd);if(i==="true")return!0;if(i==="false")return!1}catch{}return null}function V2(i){try{localStorage.setItem(Pd,String(i))}catch{}}function Y2(){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 X2(i){try{localStorage.setItem(Ud,i)}catch{}window.location.reload()}function bd(){try{localStorage.removeItem(Ud)}catch{}window.location.reload()}function Vb(){try{return localStorage.getItem(yd)==="true"}catch{return!1}}function K2(i){try{i?localStorage.setItem(yd,"true"):localStorage.removeItem(yd)}catch{}}function Yb(){try{const i=localStorage.getItem(Id);if(i==="true")return!0;if(i==="false")return!1}catch{}return null}function J2(i){try{localStorage.setItem(Id,String(i))}catch{}}function Q2(){try{localStorage.removeItem(Id)}catch{}}function Xb(){const{isSuperAdmin:i,hasRoleType:t,hasRole:r}=pn(),s=$d(),l=i||r("engineer"),c=t("admin"),m=i||t("admin");return{isBuilder:s?!1:l,isOps:s?s==="admin"||s==="engineer":c,canBulk:s?s==="admin":m,viewAs:s,realIsBuilder:l}}const Z2="lt_ai_override";function W2(){return Ae("/settings")}function eO(){try{if(localStorage.getItem(Z2)==="off")return!1}catch{}return null}function Or(){var r;const i=pt({queryKey:["settings"],queryFn:W2,staleTime:1/0}),t=eO();return i.data&&t===!1&&((r=i.data.ai)!=null&&r.enabled)?{...i,data:{...i.data,ai:{enabled:!1}}}:i}function Kb(){var f;const{isSuperAdmin:i,hasRoleType:t,hasRole:r}=pn(),{data:s}=Or(),l=((f=s==null?void 0:s.features)==null?void 0:f.publicPaceBoard)!==!1,c=i?"superadmin":t("admin")?"admin":r("engineer")?"engineer":"operator",m=$d(),p=m==="admin"||m==="engineer"||m==="operator"?m:null,g=p??c;return{tier:g,realTier:c,viewAs:p,canSeePaceBoard:l||g==="superadmin"||g==="admin",canSeeWorkflows:g==="superadmin"||g==="engineer",showTaskQueueCards:g==="operator"&&!l}}function Jb(i){return(i??"").replace(/[^A-Za-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"")||"none"}function vd(i={}){const t=i.role?Jb(i.role):"*",r=i.id??"*",s=i.verb??">";return`${FE}.system.escalation.${t}.${r}.${s}`}function Ay(i){return i.verbs.map(t=>vd({role:i.role,verb:t}))}function Hd(i){const{user:t,isSuperAdmin:r,hasRoleType:s}=pn(),l=r||s("admin"),c=((t==null?void 0:t.roles)??[]).map(p=>p.role).sort().join(","),m=(i??[]).join(",");return j.useMemo(()=>{const p=m?m.split(","):null;return l||!c?p?Ay({verbs:p}):[vd({})]:c.split(",").flatMap(g=>p?Ay({role:g,verbs:p}):[vd({role:g})])},[l,c,m])}const xd="/escalations/detail/";function tO(i){return i.startsWith(xd)&&i.slice(xd.length).split("/")[0]||void 0}function nO(){const{user:i}=pn(),t=go(),r=mn(),s=j.useRef(r.pathname);s.current=r.pathname;const l=j.useRef(i==null?void 0:i.userId);l.current=i==null?void 0:i.userId;const c=j.useCallback(m=>{var b,v,_;if((m==null?void 0:m.assignedAtCreation)!==!0)return;const p=(m==null?void 0:m.escalationId)??((b=m==null?void 0:m.data)==null?void 0:b.id),g=(v=m==null?void 0:m.data)==null?void 0:v.assigned_to,f=(_=m==null?void 0:m.data)==null?void 0:_.parent_id;if(!p||g!==l.current||!f||f!==tO(s.current))return;const d=`${xd}${p}`;s.current!==d&&t(d)},[t]);Rd(Hd(["claimed"]),c)}const Gd=j.createContext(null),$h="lt_sidebar_collapsed",Qb="(max-width: 1023px)";function rO(){try{return window.matchMedia(Qb).matches}catch{return!1}}function iO({children:i}){const[t,r]=j.useState(()=>{if(rO())return!0;try{return localStorage.getItem($h)==="true"}catch{return!1}});j.useEffect(()=>{let l;try{l=window.matchMedia(Qb)}catch{return}const c=m=>{if(m.matches)r(!0);else try{r(localStorage.getItem($h)==="true")}catch{r(!1)}};return l.addEventListener("change",c),()=>l.removeEventListener("change",c)},[]);const s=j.useCallback(()=>{r(l=>{const c=!l;try{localStorage.setItem($h,String(c))}catch{}return c})},[]);return y.jsx(Gd.Provider,{value:{collapsed:t,toggle:s},children:i})}function sO({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 aO({children:i}){const[t,r]=j.useState({node:null,width:jy,open:!1,ownerKey:null}),s=mn(),l=j.useRef(s.pathname),c=j.useCallback((p,g)=>{r({node:p,width:(g==null?void 0:g.width)??jy,open:!0,ownerKey:(g==null?void 0:g.key)??null})},[]),m=j.useCallback(p=>{r(g=>typeof p=="string"&&g.ownerKey!==p?g:{...g,open:!1})},[]);return j.useEffect(()=>{s.pathname!==l.current&&(l.current=s.pathname,r(p=>p.open||p.node?{...p,node:null,open:!1,ownerKey:null}:p))},[s.pathname]),y.jsx(Vd.Provider,{value:{...t,setPanel:c,closePanel:m},children:i})}function Yd(){const i=j.useContext(Vd);if(!i)throw new Error("useShellPanel must be used within ShellPanelProvider");return i}function o3(){return j.useContext(Vd)}function oO({open:i,width:t=380,children:r,className:s=""}){const[l,c]=j.useState(i);return j.useEffect(()=>{i&&c(!0)},[i]),y.jsx("div",{className:`shrink-0 overflow-hidden transition-[width] duration-300 ease-out ${s}`,style:{width:i?t:0,maxWidth:"50%"},onTransitionEnd:m=>{!i&&m.propertyName==="width"&&c(!1)},children:y.jsx("div",{style:{width:t},className:"h-full",children:l?r:null})})}function l3({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 c3({views:i,activeId:t,onViewChange:r,onClose:s,headerActions:l,stickyClassName:c,labelInline:m}){const p=i.find(g=>g.id===t)??i[0];return p?y.jsx("div",{className:"h-full bg-surface-hover",children:y.jsxs("div",{className:`flex flex-col ${c??"sticky top-0 z-10 max-h-[calc(100vh-3.5rem)]"}`,children:[y.jsxs("div",{className:`flex items-center justify-between pl-4 pr-3 shrink-0 ${m?"pt-10 pb-2":"pt-3"}`,children:[y.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[y.jsx("div",{className:"flex items-center gap-1 shrink-0",role:"radiogroup","aria-label":"Panel view",children:i.map(g=>{const f=g.icon,d=g.id===p.id;return y.jsx("button",{role:"radio","aria-checked":d,onClick:()=>r(g.id),title:g.label,className:`p-1.5 rounded-md transition-colors ${d?"bg-accent/10 text-accent":"text-accent/60 hover:text-accent hover:bg-surface-hover"}`,children:y.jsx(f,{className:"w-3.5 h-3.5"})},g.id)})}),m&&y.jsx("span",{className:"text-2xs font-semibold uppercase tracking-widest text-text-secondary truncate",children:p.label})]}),y.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[l,s&&y.jsx("button",{onClick:s,title:"Close panel",className:"p-1 rounded text-accent/60 hover:text-accent hover:bg-surface-hover transition-colors",children:y.jsx(Cn,{className:"w-3.5 h-3.5"})})]})]}),!m&&y.jsx("p",{className:"px-5 pt-2 pb-1 text-2xs font-semibold uppercase tracking-widest text-text-secondary shrink-0",children:p.label}),y.jsx("div",{className:`flex-1 overflow-y-auto px-5 ${m?"pt-4 pb-8":"pb-5 pt-1"}`,children:p.content})]})}):null}function Zb(i,t){var r,s,l,c,m;t.facets&&Object.keys(t.facets).length&&i.set("facets",JSON.stringify(t.facets)),(r=t.block)!=null&&r.length&&i.set("block",JSON.stringify(t.block)),(s=t.range)!=null&&s.length&&i.set("range",JSON.stringify(t.range)),(l=t.exists)!=null&&l.length&&i.set("exists",JSON.stringify(t.exists)),(c=t.roles)!=null&&c.length&&i.set("roles",JSON.stringify(t.roles)),(m=t.orderBy)!=null&&m.length&&i.set("orderBy",JSON.stringify(t.orderBy)),t.available!==void 0&&i.set("available",String(t.available)),t.jeopardy===!0&&i.set("jeopardy","1")}function u3(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 f3(i){const t=i?`?period=${i}`:"";return pt({queryKey:["escalationStats",i],queryFn:()=>Ae(`/escalations/stats${t}`)})}function h3(){return pt({queryKey:["escalationTypes"],queryFn:()=>Ae("/escalations/types")})}function d3(i=!0){return pt({queryKey:["escalationFacetKeys"],queryFn:()=>Ae("/escalations/facet-keys"),enabled:i,staleTime:6e4})}function Wb(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),Zb(l,s),pt({queryKey:["escalations",s],queryFn:()=>Ae(`/escalations?${l}`),enabled:t,...r!==void 0?{staleTime:r}:{}})}function ev(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),Zb(l,s),pt({queryKey:["escalations","available",s],queryFn:()=>Ae(`/escalations/available?${l}`),enabled:t,...r!==void 0?{staleTime:r}:{}})}function m3(i){return pt({queryKey:["escalations","by-workflow",i],queryFn:()=>Ae(`/escalations/by-workflow/${i}`),enabled:!!i})}function p3(i){return pt({queryKey:["escalations",i],queryFn:()=>Ae(`/escalations/${i}`),enabled:!!i})}function g3(){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 y3(){const i=gt();return Et({mutationFn:t=>Ae(`/escalations/${t}/release`,{method:"POST"}),onSuccess:()=>{i.resetQueries({queryKey:["escalations"]}),i.resetQueries({queryKey:["escalationStats"]})}})}function b3(){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 v3(){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 x3(){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 _3(){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 w3(){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 S3(){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 E3(){const i=gt();return Et({mutationFn:t=>Ae(`/escalations/${t}/cancel`,{method:"POST"}),onSuccess:()=>{i.resetQueries({queryKey:["escalations"]}),i.resetQueries({queryKey:["escalationStats"]})}})}function O3(){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 lO(){const{user:i}=pn(),t=i==null?void 0:i.userId,r=gt(),s=j.useRef(null),l=j.useCallback(()=>{s.current||(s.current=setTimeout(()=>{s.current=null,r.invalidateQueries({queryKey:["escalations"]})},15e3))},[r]);Rd(Hd(),l);const{data:c}=ev({limit:1}),{data:m}=Wb({assigned_to:t,status:"pending",limit:1});return{available:(c==null?void 0:c.total)??0,mine:(m==null?void 0:m.total)??0}}function nu({size:i="sm",hideLabel:t=!1,className:r="",appName:s="LongTail",variant:l="full"}){const c=i==="lg";if(l==="comet")return y.jsx("div",{className:`relative overflow-visible ${r}`,style:{width:"2.5rem",height:"2.5rem",flexShrink:0},children:y.jsx("span",{role:"img","aria-label":s,className:"logo-mark absolute pointer-events-none select-none",style:{"--logo-url":`url(${Mt}/logo512.png)`,width:"82px",height:"82px",top:"-12px",left:"-80px",transform:"rotate(232deg)",zIndex:-1,opacity:.55}})});if(l==="mark")return y.jsx("div",{className:`flex items-center ${r}`,children:y.jsx("span",{role:"img","aria-label":s,className:"logo-mark shrink-0 w-7 h-7",style:{"--logo-url":`url(${Mt}/logo512.png)`}})});const m=c?"w-[16rem] h-[16rem] -rotate-[120deg] opacity-55 -ml-10":"w-[12.5rem] h-[12.5rem] -rotate-[120deg] opacity-55 -ml-8",p=c?"text-[44px] font-normal text-text-primary tracking-[0.15em] -ml-[12.5rem]":"text-[36px] font-normal text-text-primary tracking-[0.15em] -ml-[9.75rem]";return y.jsxs("div",{className:`flex items-center ${r}`,style:{height:"50px"},children:[y.jsx("span",{role:"img","aria-label":s,className:`logo-mark shrink-0 z-0 ${m}`,style:{"--logo-url":`url(${Mt}/logo512.png)`}}),y.jsx("span",{className:`z-[1] transition-opacity duration-300 ${p} ${t?"opacity-0":""}`,children:s})]})}const cO=[{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"}],uO=["operator","engineer","admin","superadmin"];function Ty(i){return uO.indexOf(i)}function fO(i,t){return Ty(i)>=Ty(t)}function hO({onClose:i}){var oe,de,Oe,le,je,Se,Ne;const{isSuperAdmin:t,hasRoleType:r,hasRole:s}=pn(),{data:l}=Or(),c=$d(),m=!!((oe=l==null?void 0:l.ai)!=null&&oe.enabled),p=Fb(),g=p!==null?p:m,[f,d]=j.useState(g),b=(de=l==null?void 0:l.features)==null?void 0:de.graphWorkflows,v=b==null,[_,w]=j.useState(b===!0||v&&Vb()),S=!!((Oe=l==null?void 0:l.features)!=null&&Oe.scanCodes),M=Yb(),[L,z]=j.useState(M!==null?M:S),ie=t?"superadmin":r("admin")?"admin":s("engineer")?"engineer":"operator",ae=((le=l==null?void 0:l.branding)==null?void 0:le.appName)??"LongTail",C=(je=l==null?void 0:l.environment)==null?void 0:je.longTailVersion,I=(Se=l==null?void 0:l.environment)==null?void 0:Se.hotmeshVersion,re=(Ne=l==null?void 0:l.environment)==null?void 0:Ne.nodeEnv;j.useEffect(()=>{const be=at=>{at.key==="Escape"&&i()};return document.addEventListener("keydown",be),()=>document.removeEventListener("keydown",be)},[i]);const K=cO.filter(be=>fO(ie,be.minTier)),B=K.length>1,G=[...B?[{id:"viewas",label:"View As",icon:rw}]:[],{id:"features",label:"Features",icon:iw}],[W,Q]=j.useState(G[0].id),he=be=>{be===null?bd():X2(be)},_e=()=>{const be=!f;d(be),be===m?Y2():V2(be),window.location.reload()},Te=()=>{const be=!_;w(be),K2(be),window.location.reload()},Y=()=>{const be=!L;z(be),be===S?Q2():J2(be),window.location.reload()};return y.jsx("div",{className:"fixed inset-0 z-[100] bg-surface-sunken/75 backdrop-blur-sm flex items-center justify-center",onClick:i,children:y.jsxs("div",{className:"relative w-[440px] max-h-[85vh] overflow-y-auto bg-surface-raised px-12 py-10",onClick:be=>be.stopPropagation(),children:[y.jsx("button",{onClick:i,className:"absolute top-4 right-4 text-text-quaternary hover:text-text-secondary transition-colors p-1","aria-label":"Close",children:y.jsx(Cn,{className:"w-4 h-4",strokeWidth:1.5})}),y.jsxs("div",{className:"flex flex-col items-center gap-3 pb-8",children:[y.jsx("span",{className:"logo-mark block w-20 h-20 opacity-50",style:{"--logo-url":`url(${Mt}/logo512.png)`}}),y.jsxs("div",{className:"text-center",children:[y.jsx("p",{className:"text-2xl font-light text-text-primary tracking-[0.12em]",children:ae}),C&&y.jsxs("p",{className:"mt-1 text-2xs text-text-tertiary",children:["v",C,I&&y.jsxs(y.Fragment,{children:[" · HotMesh v",I]}),re&&re!=="production"&&y.jsx("span",{className:"ml-1 text-status-warning",children:re})]})]})]}),y.jsx("hr",{className:"border-surface-border/50 mb-6"}),G.length>1&&y.jsx("div",{className:"flex items-center justify-center gap-2 mb-8",role:"tablist",children:G.map(be=>{const at=W===be.id;return y.jsxs("button",{role:"tab","aria-selected":at,onClick:()=>Q(be.id),title:be.label,className:`flex flex-col items-center gap-1.5 px-5 py-2.5 rounded-lg transition-colors ${at?"bg-accent/10 text-accent":"text-text-tertiary hover:text-text-secondary hover:bg-surface-hover"}`,children:[y.jsx(be.icon,{className:"w-5 h-5",strokeWidth:1.5,...at?{fill:"currentColor",fillOpacity:.15}:{}}),y.jsx("span",{className:"text-2xs font-medium",children:be.label})]},be.id)})}),W==="viewas"&&B&&y.jsxs("div",{className:"space-y-1",children:[y.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-4",children:"View As"}),K.map(be=>{const at=c===be.id,Ht=be.id===null?`Your view · ${ie}`:be.label;return y.jsxs("button",{onClick:()=>he(be.id),className:"w-full text-left flex items-start gap-3 py-2.5 px-1 group",children:[y.jsx("span",{className:`mt-0.5 w-4 h-4 rounded-full border shrink-0 flex items-center justify-center transition-colors ${at?"border-accent bg-accent":"border-surface-border group-hover:border-accent/60"}`,children:at&&y.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-text-inverse"})}),y.jsxs("span",{children:[y.jsx("span",{className:`block text-sm font-medium transition-colors ${at?"text-accent":"text-text-primary group-hover:text-accent"}`,children:Ht}),y.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:be.description})]})]},String(be.id))})]}),W==="features"&&y.jsxs("div",{children:[y.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-4",children:"Features"}),y.jsxs("button",{onClick:_e,className:"w-full text-left flex items-center justify-between py-2.5 px-1 group",children:[y.jsxs("span",{children:[y.jsx("span",{className:"block text-sm font-medium text-text-primary group-hover:text-accent transition-colors",children:"AI features"}),y.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:f?"Enabled — AI assist, agent labels, bulk AI actions":"Hidden — automation labels, no AI surfaces"})]}),y.jsx("span",{className:`shrink-0 ml-4 w-9 h-5 rounded-full transition-colors flex items-center px-0.5 ${f?"bg-accent":"bg-surface-border"}`,children:y.jsx("span",{className:`w-4 h-4 rounded-full bg-text-inverse shadow-sm transition-transform ${f?"translate-x-4":"translate-x-0"}`})})]}),v&&y.jsxs("button",{onClick:Te,className:"w-full text-left flex items-center justify-between py-2.5 px-1 group",children:[y.jsxs("span",{children:[y.jsx("span",{className:"block text-sm font-medium text-text-primary group-hover:text-accent transition-colors",children:"Graph workflows"}),y.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:_?"Visible — Graph section shown in Orchestrate sidebar":"Hidden — use Procedural workflows instead"})]}),y.jsx("span",{className:`shrink-0 ml-4 w-9 h-5 rounded-full transition-colors flex items-center px-0.5 ${_?"bg-accent":"bg-surface-border"}`,children:y.jsx("span",{className:`w-4 h-4 rounded-full bg-text-inverse shadow-sm transition-transform ${_?"translate-x-4":"translate-x-0"}`})})]}),y.jsxs("button",{onClick:Y,className:"w-full text-left flex items-center justify-between py-2.5 px-1 group",children:[y.jsxs("span",{children:[y.jsx("span",{className:"block text-sm font-medium text-text-primary group-hover:text-accent transition-colors",children:"Scan input"}),y.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:L?"Enabled — header scan affordance, panel, and keyboard-wedge capture":"Hidden — the deployment opts in with features.scanCodes"})]}),y.jsx("span",{className:`shrink-0 ml-4 w-9 h-5 rounded-full transition-colors flex items-center px-0.5 ${L?"bg-accent":"bg-surface-border"}`,children:y.jsx("span",{className:`w-4 h-4 rounded-full bg-text-inverse shadow-sm transition-transform ${L?"translate-x-4":"translate-x-0"}`})})]})]}),y.jsx("hr",{className:"border-surface-border/50 mt-8"}),y.jsx("p",{className:"mt-4 text-2xs text-text-quaternary text-center",children:"Esc or click outside to close"})]})})}const tv=[{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",nv="lt.theme";let rv=[];function dO(i){const t=new Set(tv.map(s=>s.id)),r=new Set;rv=i.filter(s=>!(s!=null&&s.id)||t.has(s.id)||r.has(s.id)?!1:(r.add(s.id),!0))}function mO(){return[...tv,...rv]}function iv(){try{return localStorage.getItem(nv)||Ny}catch{return Ny}}function sv(i){document.documentElement.dataset.theme=i}function pO(i){try{localStorage.setItem(nv,i)}catch{}sv(i)}const av=j.createContext(null);function gO(){const i=j.useContext(av);if(!i)throw new Error("useActingIdentity must be used within ActingIdentityProvider");return i}function yO({children:i}){const[t,r]=j.useState(null),s=j.useRef(t);s.current=t,j.useEffect(()=>{if(!(t!=null&&t.expiresAt))return;const g=new Date(t.expiresAt).getTime()-Date.now();if(g<=0){r(null);return}const f=setTimeout(()=>r(null),g);return()=>clearTimeout(f)},[t]);const l=j.useCallback(g=>{var d;if(!g.actingToken||!g.actor)return null;const f=((d=s.current)==null?void 0:d.actingToken)??null;return r({actingToken:g.actingToken,actorId:g.actor.id,displayName:g.actor.displayName,expiresAt:g.expiresAt??null}),f},[]),c=j.useCallback(()=>r(null),[]);j.useEffect(()=>(Xg(()=>{var g;return((g=s.current)==null?void 0:g.actingToken)??null}),Kg(c),()=>{Xg(null),Kg(null)}),[c]);const m=j.useCallback(()=>{var f;const g=(f=s.current)==null?void 0:f.expiresAt;return g?Math.max(0,Math.floor((new Date(g).getTime()-Date.now())/1e3)):0},[]),p=j.useMemo(()=>({identity:t,prime:l,clear:c,remainingSeconds:m}),[t,l,c,m]);return y.jsx(av.Provider,{value:p,children:i})}const Yc={maxKeyGapMs:500,terminators:["Enter","Tab"],minLength:6,autoFireQuietMs:300,autoFireMaxAvgKeyMs:50},ov="lt_scan_wedge_config";function lv(){try{const i=localStorage.getItem(ov);return i?{...Yc,...JSON.parse(i)}:Yc}catch{return Yc}}function bO(i){const t={...lv(),...i};return localStorage.setItem(ov,JSON.stringify(t)),t}const vO=[/[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 vO){const s=i.match(r);s&&(!t||s[0].length>t.length)&&(t=s[0])}return t}const xO=new Set(["Shift","CapsLock"]),Ql={suppress:!1,emit:null};function _O(i=Yc){let t={buffer:"",times:[],lastKeyMs:0};function r(){t={buffer:"",times:[],lastKeyMs:0}}function s(m){const{key:p,timeMs:g,hasModifier:f,isRepeat:d}=m;if(xO.has(p))return Ql;if(i.terminators.includes(p)){const S=ky(t.buffer);return r(),S&&S.length>=i.minLength?{suppress:!0,emit:S,consumedLength:S.length}:Ql}if(f||d||p.length!==1)return r(),Ql;const b=g-t.lastKeyMs,v=t.lastKeyMs>0&&b<=i.maxKeyGapMs,_=(v?t.buffer+p:p).slice(-128),w=(v?[...t.times,g]:[g]).slice(-128);return t={buffer:_,times:w,lastKeyMs:g},Ql}function l(){return{buffer:t.buffer}}function c(){const m=ky(t.buffer);if(!m||m.length<i.minLength)return null;const p=t.times.slice(-m.length);return p.length<2||(p[p.length-1]-p[0])/(p.length-1)>i.autoFireMaxAvgKeyMs?null:{code:m,consumedLength:m.length}}return{step:s,reset:r,snapshot:l,pendingAutoFire:c}}function wO(){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 SO(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=wO();if(!t)return;const r=t.selectionStart??t.value.length,s=Math.max(0,r-i);SO(t,t.value.slice(0,s)+t.value.slice(r),s)}function EO({active:i,wedgeConfig:t,diagnosticsOn:r,onScan:s,onDiag:l}){const c=j.useRef({diagnosticsOn:r,onScan:s,onDiag:l});c.current={diagnosticsOn:r,onScan:s,onDiag:l};const m=j.useRef(0),p=j.useRef(0);j.useEffect(()=>{if(!i)return;const g=_O(t);let f=null;const d=()=>{f&&(clearTimeout(f),f=null)},b=(w,S,M)=>{S&&Cy(S),c.current.diagnosticsOn&&(console.debug("[scan]",M),c.current.onDiag({seq:++m.current,key:"(quiet)",code:"",deltaMs:0,buffer:"",note:M})),c.current.onScan(w)},v=()=>{d(),g.pendingAutoFire()&&(f=setTimeout(()=>{f=null;const w=g.pendingAutoFire();w&&(g.reset(),b(w.code,w.consumedLength,`capture → ${w.code} (quiet period — no suffix)`))},t.autoFireQuietMs))},_=w=>{const S=g.snapshot().buffer,{suppress:M,emit:L,consumedLength:z}=g.step({key:w.key,timeMs:w.timeStamp,hasModifier:w.ctrlKey||w.metaKey||w.altKey,isRepeat:w.repeat});if(M&&(w.preventDefault(),w.stopPropagation()),c.current.diagnosticsOn){const ie=g.snapshot().buffer,ae=t.terminators.includes(w.key),C=L?`capture → ${L}`:ae?`terminator — no code tail in "${S.slice(-24)}"`:ie===S?S?"neutral (chord key)":"ignored":ie===""?"reset (edit/chord/non-printable)":ie.length<=1&&S.length>1?"gap — new episode":"accumulate",I=p.current?Math.round(w.timeStamp-p.current):0,re={seq:++m.current,key:w.key,code:w.code!==w.key?w.code:"",deltaMs:I,buffer:ie.slice(-24),note:C};console.debug("[scan]",re.key,re.code,`${re.deltaMs}ms`,re.note),c.current.onDiag(re)}p.current=w.timeStamp,L?(d(),z&&Cy(z),c.current.onScan(L)):v()};return window.addEventListener("keydown",_,{capture:!0}),()=>{d(),window.removeEventListener("keydown",_,{capture:!0})}},[i,t])}const Pe={EXECUTED:"executed",MATCHED_LIST:"matched_list",CONFIRM_REQUIRED:"confirm_required",NO_MATCH_FALLBACK:"no_match_fallback",UNCONFIGURED:"unconfigured",INVALID_CODE:"invalid_code",FORBIDDEN:"forbidden",CONFLICT:"conflict",IDENTITY_PRIMED:"identity_primed",IDENTITY_UNKNOWN:"identity_unknown",NOT_PRIMED:"not_primed",CHOICES:"choices"},Zl={SHOW_DETAIL:"show-detail",SHOW_LIST:"show-list",CLAIM:"claim",CLAIM_SHOW_DETAIL:"claim-show-detail",RELEASE:"release",RESOLVE:"resolve",ESCALATE:"escalate",CANCEL:"cancel",PRESENT:"present"},A3={ACTION:"action",IDENTITY:"identity"};function OO(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 j3(i){return Ae("/scan-codes/execute-choice",{method:"POST",body:JSON.stringify(i)})}function T3(){return pt({queryKey:["scan-schemes"],queryFn:()=>Ae("/scan-codes/schemes")})}function N3(i){return pt({queryKey:["scan-schemes",i],queryFn:()=>Ae(`/scan-codes/schemes/${i}`),enabled:i!=null})}function k3(){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 C3(){const i=gt();return Et({mutationFn:t=>Ae(`/scan-codes/schemes/${t}`,{method:"DELETE"}),onSuccess:()=>i.invalidateQueries({queryKey:["scan-schemes"]})})}function M3(){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 R3(){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 AO(i){const t={},r=Cs(i.get("facets"));Ui(r)||(t.facets=r);const s=Cs(i.get("block"));Ui(s)||(t.block=s);const l=Cs(i.get("range"));Ui(l)||(t.range=l);const c=Cs(i.get("exists"));Ui(c)||(t.exists=c);const m=Cs(i.get("roles"));Ui(m)||(t.roles=m);const p=Cs(i.get("orderBy"));Ui(p)||(t.orderBy=p),i.get("available")!=null&&(t.available=i.get("available")==="true");const g=i.get("jeopardy");return(g==="1"||g==="true")&&(t.jeopardy=!0),t}function D3(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 cv(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 q3(i,t,r){return cv({[i]:t},r)}function B3(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 uv(){var r;const{data:i}=Or(),t=Yb();return t!==null?t:!!((r=i==null?void 0:i.features)!=null&&r.scanCodes)}const fv=j.createContext(null);function hv(){const i=j.useContext(fv);if(!i)throw new Error("useScanInput must be used within ScanInputProvider");return i}const jO="scanPendingAction",TO="scanChoices",NO="/scan/station";function kO({children:i}){const{user:t}=pn(),r=uv(),s=go(),{identity:l,prime:c}=gO(),[m,p]=j.useState(null),[g,f]=j.useState(!1),[d,b]=j.useState(()=>lv()),[v,_]=j.useState([]),[w,S]=j.useState(!1),M=j.useCallback(B=>{var W;const{outcome:G}=B;if(G===Pe.CONFIRM_REQUIRED&&B.pendingAction)return s(`/escalations/detail/${B.pendingAction.escalationId}`,{state:{[jO]:B.pendingAction}}),!0;if(G===Pe.EXECUTED&&B.escalation){const Q=[Zl.SHOW_DETAIL,Zl.CLAIM_SHOW_DETAIL,Zl.CLAIM,Zl.ESCALATE];return B.verb&&Q.includes(B.verb)?(s(`/escalations/detail/${B.escalation.id}`),!0):!1}if(G===Pe.MATCHED_LIST&&B.listQuery){const{targetFacet:Q,target:he,roles:_e}=B.listQuery;return s(cv({[Q]:he},(_e==null?void 0:_e[0])??null)),!0}return G===Pe.CHOICES&&B.choices?(s(NO,{state:{[TO]:B}}),!0):G===Pe.NO_MATCH_FALLBACK&&((W=B.fallback)!=null&&W.route)?(s(B.fallback.route),!0):!1},[s]),L=j.useRef(null);L.current=(l==null?void 0:l.actingToken)??null;const z=j.useRef(null),ie=j.useRef(null),ae=j.useCallback(B=>{ie.current=B},[]),C=j.useCallback(async(B,G=My.MANUAL)=>{var Q;if((Q=ie.current)!=null&&Q.call(ie,B))return;f(!0);const W=Date.now();try{const he=await OO(B,{actingToken:L.current??void 0,previousActingToken:z.current??void 0});he.outcome===Pe.IDENTITY_PRIMED&&(z.current=c(he));const _e=M(he);p({code:B,source:G,at:W,response:he,error:null,navigated:_e})}catch(he){p({code:B,source:G,at:W,response:null,error:he.message,navigated:!1})}finally{f(!1)}},[M,c]),I=j.useRef(C);I.current=C,EO({active:!!t&&r,wedgeConfig:d,diagnosticsOn:w,onScan:B=>void I.current(B,My.KEYBOARD_WEDGE),onDiag:B=>_(G=>[...G.slice(-29),B])});const re=j.useCallback(B=>{b(bO(B))},[]),K=j.useMemo(()=>({submitCode:C,setCodeInterceptor:ae,lastResult:m,busy:g,wedgeConfig:d,updateWedgeConfig:re,diagnostics:v,diagnosticsOn:w,setDiagnosticsOn:S}),[C,ae,m,g,d,re,v,w]);return y.jsx(fv.Provider,{value:K,children:i})}var Wl={},Xa={},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 CO(){if(qy)return Xa;qy=1,Object.defineProperty(Xa,"__esModule",{value:!0}),Xa.CODE39=void 0;var i=(function(){function S(M,L){for(var z=0;z<L.length;z++){var ie=L[z];ie.enumerable=ie.enumerable||!1,ie.configurable=!0,"value"in ie&&(ie.writable=!0),Object.defineProperty(M,ie.key,ie)}}return function(M,L,z){return L&&S(M.prototype,L),z&&S(M,z),M}})(),t=gn(),r=s(t);function s(S){return S&&S.__esModule?S:{default:S}}function l(S,M){if(!(S instanceof M))throw new TypeError("Cannot call a class as a function")}function c(S,M){if(!S)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return M&&(typeof M=="object"||typeof M=="function")?M:S}function m(S,M){if(typeof M!="function"&&M!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof M);S.prototype=Object.create(M&&M.prototype,{constructor:{value:S,enumerable:!1,writable:!0,configurable:!0}}),M&&(Object.setPrototypeOf?Object.setPrototypeOf(S,M):S.__proto__=M)}var p=(function(S){m(M,S);function M(L,z){return l(this,M),L=L.toUpperCase(),z.mod43&&(L+=v(w(L))),c(this,(M.__proto__||Object.getPrototypeOf(M)).call(this,L,z))}return i(M,[{key:"encode",value:function(){for(var z=d("*"),ie=0;ie<this.data.length;ie++)z+=d(this.data[ie])+"0";return z+=d("*"),{data:z,text:this.text}}},{key:"valid",value:function(){return this.data.search(/^[0-9A-Z\-\.\ \$\/\+\%]+$/)!==-1}}]),M})(r.default),g=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","-","."," ","$","/","+","%","*"],f=[20957,29783,23639,30485,20951,29813,23669,20855,29789,23645,29975,23831,30533,22295,30149,24005,21623,29981,23837,22301,30023,23879,30545,22343,30161,24017,21959,30065,23921,22385,29015,18263,29141,17879,29045,18293,17783,29021,18269,17477,17489,17681,20753,35770];function d(S){return b(_(S))}function b(S){return f[S].toString(2)}function v(S){return g[S]}function _(S){return g.indexOf(S)}function w(S){for(var M=0,L=0;L<S.length;L++)M+=_(S[L]);return M=M%43,M}return Xa.CODE39=p,Xa}var zn={},tc={},nc={},ut={},By;function vo(){if(By)return ut;By=1,Object.defineProperty(ut,"__esModule",{value:!0});var i;function t(g,f,d){return f in g?Object.defineProperty(g,f,{value:d,enumerable:!0,configurable:!0,writable:!0}):g[f]=d,g}var r=ut.SET_A=0,s=ut.SET_B=1,l=ut.SET_C=2;ut.SHIFT=98;var c=ut.START_A=103,m=ut.START_B=104,p=ut.START_C=105;return ut.MODULO=103,ut.STOP=106,ut.FNC1=207,ut.SET_BY_CODE=(i={},t(i,c,r),t(i,m,s),t(i,p,l),i),ut.SWAP={101:r,100:s,99:l},ut.A_START_CHAR="Ð",ut.B_START_CHAR="Ñ",ut.C_START_CHAR="Ò",ut.A_CHARS="[\0-_È-Ï]",ut.B_CHARS="[ -È-Ï]",ut.C_CHARS="(Ï*[0-9]{2}Ï*)",ut.BARS=[11011001100,11001101100,11001100110,10010011e3,10010001100,10001001100,10011001e3,10011000100,10001100100,11001001e3,11001000100,11000100100,10110011100,10011011100,10011001110,10111001100,10011101100,10011100110,11001110010,11001011100,11001001110,11011100100,11001110100,11101101110,11101001100,11100101100,11100100110,11101100100,11100110100,11100110010,11011011e3,11011000110,11000110110,10100011e3,10001011e3,10001000110,10110001e3,10001101e3,10001100010,11010001e3,11000101e3,11000100010,10110111e3,10110001110,10001101110,10111011e3,10111000110,10001110110,11101110110,11010001110,11000101110,11011101e3,11011100010,11011101110,11101011e3,11101000110,11100010110,11101101e3,11101100010,11100011010,11101111010,11001000010,11110001010,1010011e4,10100001100,1001011e4,10010000110,10000101100,10000100110,1011001e4,10110000100,1001101e4,10011000010,10000110100,10000110010,11000010010,1100101e4,11110111010,11000010100,10001111010,10100111100,10010111100,10010011110,10111100100,10011110100,10011110010,11110100100,11110010100,11110010010,11011011110,11011110110,11110110110,10101111e3,10100011110,10001011110,10111101e3,10111100010,11110101e3,11110100010,10111011110,10111101110,11101011110,11110101110,11010000100,1101001e4,11010011100,1100011101011],ut}var Ly;function mu(){if(Ly)return nc;Ly=1,Object.defineProperty(nc,"__esModule",{value:!0});var i=(function(){function f(d,b){for(var v=0;v<b.length;v++){var _=b[v];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(d,_.key,_)}}return function(d,b,v){return b&&f(d.prototype,b),v&&f(d,v),d}})(),t=gn(),r=l(t),s=vo();function l(f){return f&&f.__esModule?f:{default:f}}function c(f,d){if(!(f instanceof d))throw new TypeError("Cannot call a class as a function")}function m(f,d){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:f}function p(f,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);f.prototype=Object.create(d&&d.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(f,d):f.__proto__=d)}var g=(function(f){p(d,f);function d(b,v){c(this,d);var _=m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b.substring(1),v));return _.bytes=b.split("").map(function(w){return w.charCodeAt(0)}),_}return i(d,[{key:"valid",value:function(){return/^[\x00-\x7F\xC8-\xD3]+$/.test(this.data)}},{key:"encode",value:function(){var v=this.bytes,_=v.shift()-105,w=s.SET_BY_CODE[_];if(w===void 0)throw new RangeError("The encoding does not start with a start character.");this.shouldEncodeAsEan128()===!0&&v.unshift(s.FNC1);var S=d.next(v,1,w);return{text:this.text===this.data?this.text.replace(/[^\x20-\x7E]/g,""):this.text,data:d.getBar(_)+S.result+d.getBar((S.checksum+_)%s.MODULO)+d.getBar(s.STOP)}}},{key:"shouldEncodeAsEan128",value:function(){var v=this.options.ean128||!1;return typeof v=="string"&&(v=v.toLowerCase()==="true"),v}}],[{key:"getBar",value:function(v){return s.BARS[v]?s.BARS[v].toString():""}},{key:"correctIndex",value:function(v,_){if(_===s.SET_A){var w=v.shift();return w<32?w+64:w-32}else return _===s.SET_B?v.shift()-32:(v.shift()-48)*10+v.shift()-48}},{key:"next",value:function(v,_,w){if(!v.length)return{result:"",checksum:0};var S=void 0,M=void 0;if(v[0]>=200){M=v.shift()-105;var L=s.SWAP[M];L!==void 0?S=d.next(v,_+1,L):((w===s.SET_A||w===s.SET_B)&&M===s.SHIFT&&(v[0]=w===s.SET_A?v[0]>95?v[0]-96:v[0]:v[0]<32?v[0]+96:v[0]),S=d.next(v,_+1,w))}else M=d.correctIndex(v,w),S=d.next(v,_+1,w);var z=d.getBar(M),ie=M*_;return{result:z+S.result,checksum:ie+S.checksum}}}]),d})(r.default);return nc.default=g,nc}var rc={},zy;function MO(){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(m,p){var g=p?i.A_CHARS:i.B_CHARS,f=m.match(new RegExp("^("+g+"+?)(([0-9]{2}){2,})([^0-9]|$)"));if(f)return f[1]+"Ì"+c(m.substring(f[1].length));var d=m.match(new RegExp("^"+g+"+"))[0];return d.length===m.length?m:d+String.fromCharCode(p?205:206)+l(m.substring(d.length),!p)}function c(m){var p=s(m),g=p.length;if(g===m.length)return m;m=m.substring(g);var f=t(m)>=r(m);return p+String.fromCharCode(f?206:205)+l(m,f)}return rc.default=function(m){var p=void 0,g=s(m).length;if(g>=2)p=i.C_START_CHAR+c(m);else{var f=t(m)>r(m);p=(f?i.A_START_CHAR:i.B_START_CHAR)+l(m,f)}return p.replace(/[\xCD\xCE]([^])[\xCD\xCE]/,function(d,b){return"Ë"+b})},rc}var Uy;function RO(){if(Uy)return tc;Uy=1,Object.defineProperty(tc,"__esModule",{value:!0});var i=mu(),t=l(i),r=MO(),s=l(r);function l(f){return f&&f.__esModule?f:{default:f}}function c(f,d){if(!(f instanceof d))throw new TypeError("Cannot call a class as a function")}function m(f,d){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:f}function p(f,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);f.prototype=Object.create(d&&d.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(f,d):f.__proto__=d)}var g=(function(f){p(d,f);function d(b,v){if(c(this,d),/^[\x00-\x7F\xC8-\xD3]+$/.test(b))var _=m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,(0,s.default)(b),v));else var _=m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b,v));return m(_)}return d})(t.default);return tc.default=g,tc}var ic={},Py;function DO(){if(Py)return ic;Py=1,Object.defineProperty(ic,"__esModule",{value:!0});var i=(function(){function f(d,b){for(var v=0;v<b.length;v++){var _=b[v];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(d,_.key,_)}}return function(d,b,v){return b&&f(d.prototype,b),v&&f(d,v),d}})(),t=mu(),r=l(t),s=vo();function l(f){return f&&f.__esModule?f:{default:f}}function c(f,d){if(!(f instanceof d))throw new TypeError("Cannot call a class as a function")}function m(f,d){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:f}function p(f,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);f.prototype=Object.create(d&&d.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(f,d):f.__proto__=d)}var g=(function(f){p(d,f);function d(b,v){return c(this,d),m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,s.A_START_CHAR+b,v))}return i(d,[{key:"valid",value:function(){return new RegExp("^"+s.A_CHARS+"+$").test(this.data)}}]),d})(r.default);return ic.default=g,ic}var sc={},Iy;function qO(){if(Iy)return sc;Iy=1,Object.defineProperty(sc,"__esModule",{value:!0});var i=(function(){function f(d,b){for(var v=0;v<b.length;v++){var _=b[v];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(d,_.key,_)}}return function(d,b,v){return b&&f(d.prototype,b),v&&f(d,v),d}})(),t=mu(),r=l(t),s=vo();function l(f){return f&&f.__esModule?f:{default:f}}function c(f,d){if(!(f instanceof d))throw new TypeError("Cannot call a class as a function")}function m(f,d){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:f}function p(f,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);f.prototype=Object.create(d&&d.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(f,d):f.__proto__=d)}var g=(function(f){p(d,f);function d(b,v){return c(this,d),m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,s.B_START_CHAR+b,v))}return i(d,[{key:"valid",value:function(){return new RegExp("^"+s.B_CHARS+"+$").test(this.data)}}]),d})(r.default);return sc.default=g,sc}var ac={},$y;function BO(){if($y)return ac;$y=1,Object.defineProperty(ac,"__esModule",{value:!0});var i=(function(){function f(d,b){for(var v=0;v<b.length;v++){var _=b[v];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(d,_.key,_)}}return function(d,b,v){return b&&f(d.prototype,b),v&&f(d,v),d}})(),t=mu(),r=l(t),s=vo();function l(f){return f&&f.__esModule?f:{default:f}}function c(f,d){if(!(f instanceof d))throw new TypeError("Cannot call a class as a function")}function m(f,d){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:f}function p(f,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);f.prototype=Object.create(d&&d.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(f,d):f.__proto__=d)}var g=(function(f){p(d,f);function d(b,v){return c(this,d),m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,s.C_START_CHAR+b,v))}return i(d,[{key:"valid",value:function(){return new RegExp("^"+s.C_CHARS+"+$").test(this.data)}}]),d})(r.default);return ac.default=g,ac}var Hy;function LO(){if(Hy)return zn;Hy=1,Object.defineProperty(zn,"__esModule",{value:!0}),zn.CODE128C=zn.CODE128B=zn.CODE128A=zn.CODE128=void 0;var i=RO(),t=g(i),r=DO(),s=g(r),l=qO(),c=g(l),m=BO(),p=g(m);function g(f){return f&&f.__esModule?f:{default:f}}return zn.CODE128=t.default,zn.CODE128A=s.default,zn.CODE128B=c.default,zn.CODE128C=p.default,zn}var Ut={},oc={},xr={},Gy;function xo(){return Gy||(Gy=1,Object.defineProperty(xr,"__esModule",{value:!0}),xr.SIDE_BIN="101",xr.MIDDLE_BIN="01010",xr.BINARIES={L:["0001101","0011001","0010011","0111101","0100011","0110001","0101111","0111011","0110111","0001011"],G:["0100111","0110011","0011011","0100001","0011101","0111001","0000101","0010001","0001001","0010111"],R:["1110010","1100110","1101100","1000010","1011100","1001110","1010000","1000100","1001000","1110100"],O:["0001101","0011001","0010011","0111101","0100011","0110001","0101111","0111011","0110111","0001011"],E:["0100111","0110011","0011011","0100001","0011101","0111001","0000101","0010001","0001001","0010111"]},xr.EAN2_STRUCTURE=["LL","LG","GL","GG"],xr.EAN5_STRUCTURE=["GGLLL","GLGLL","GLLGL","GLLLG","LGGLL","LLGGL","LLLGG","LGLGL","LGLLG","LLGLG"],xr.EAN13_STRUCTURE=["LLLLLL","LLGLGG","LLGGLG","LLGGGL","LGLLGG","LGGLLG","LGGGLL","LGLGLG","LGLGGL","LGGLGL"]),xr}var lc={},cc={},Fy;function _o(){if(Fy)return cc;Fy=1,Object.defineProperty(cc,"__esModule",{value:!0});var i=xo(),t=function(s,l,c){var m=s.split("").map(function(g,f){return i.BINARIES[l[f]]}).map(function(g,f){return g?g[s[f]]:""});if(c){var p=s.length-1;m=m.map(function(g,f){return f<p?g+c:g})}return m.join("")};return cc.default=t,cc}var Vy;function dv(){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=m(r),l=gn(),c=m(l);function m(b){return b&&b.__esModule?b:{default:b}}function p(b,v){if(!(b instanceof v))throw new TypeError("Cannot call a class as a function")}function g(b,v){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return v&&(typeof v=="object"||typeof v=="function")?v:b}function f(b,v){if(typeof v!="function"&&v!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof v);b.prototype=Object.create(v&&v.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),v&&(Object.setPrototypeOf?Object.setPrototypeOf(b,v):b.__proto__=v)}var d=(function(b){f(v,b);function v(_,w){p(this,v);var S=g(this,(v.__proto__||Object.getPrototypeOf(v)).call(this,_,w));return S.fontSize=!w.flat&&w.fontSize>w.width*10?w.width*10:w.fontSize,S.guardHeight=w.height+S.fontSize/2+w.textMargin,S}return i(v,[{key:"encode",value:function(){return this.options.flat?this.encodeFlat():this.encodeGuarded()}},{key:"leftText",value:function(w,S){return this.text.substr(w,S)}},{key:"leftEncode",value:function(w,S){return(0,s.default)(w,S)}},{key:"rightText",value:function(w,S){return this.text.substr(w,S)}},{key:"rightEncode",value:function(w,S){return(0,s.default)(w,S)}},{key:"encodeGuarded",value:function(){var w={fontSize:this.fontSize},S={height:this.guardHeight};return[{data:t.SIDE_BIN,options:S},{data:this.leftEncode(),text:this.leftText(),options:w},{data:t.MIDDLE_BIN,options:S},{data:this.rightEncode(),text:this.rightText(),options:w},{data:t.SIDE_BIN,options:S}]}},{key:"encodeFlat",value:function(){var w=[t.SIDE_BIN,this.leftEncode(),t.MIDDLE_BIN,this.rightEncode(),t.SIDE_BIN];return{data:w.join(""),text:this.text}}}]),v})(c.default);return lc.default=d,lc}var Yy;function zO(){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 L=S.get;return L===void 0?void 0:L.call(w)}},r=xo(),s=dv(),l=c(s);function c(b){return b&&b.__esModule?b:{default:b}}function m(b,v){if(!(b instanceof v))throw new TypeError("Cannot call a class as a function")}function p(b,v){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return v&&(typeof v=="object"||typeof v=="function")?v:b}function g(b,v){if(typeof v!="function"&&v!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof v);b.prototype=Object.create(v&&v.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),v&&(Object.setPrototypeOf?Object.setPrototypeOf(b,v):b.__proto__=v)}var f=function(v){var _=v.substr(0,12).split("").map(function(w){return+w}).reduce(function(w,S,M){return M%2?w+S*3:w+S},0);return(10-_%10)%10},d=(function(b){g(v,b);function v(_,w){m(this,v),_.search(/^[0-9]{12}$/)!==-1&&(_+=f(_));var S=p(this,(v.__proto__||Object.getPrototypeOf(v)).call(this,_,w));return S.lastChar=w.lastChar,S}return i(v,[{key:"valid",value:function(){return this.data.search(/^[0-9]{13}$/)!==-1&&+this.data[12]===f(this.data)}},{key:"leftText",value:function(){return t(v.prototype.__proto__||Object.getPrototypeOf(v.prototype),"leftText",this).call(this,1,6)}},{key:"leftEncode",value:function(){var w=this.data.substr(1,6),S=r.EAN13_STRUCTURE[this.data[0]];return t(v.prototype.__proto__||Object.getPrototypeOf(v.prototype),"leftEncode",this).call(this,w,S)}},{key:"rightText",value:function(){return t(v.prototype.__proto__||Object.getPrototypeOf(v.prototype),"rightText",this).call(this,7,6)}},{key:"rightEncode",value:function(){var w=this.data.substr(7,6);return t(v.prototype.__proto__||Object.getPrototypeOf(v.prototype),"rightEncode",this).call(this,w,"RRRRRR")}},{key:"encodeGuarded",value:function(){var w=t(v.prototype.__proto__||Object.getPrototypeOf(v.prototype),"encodeGuarded",this).call(this);return this.options.displayValue&&(w.unshift({data:"000000000000",text:this.text.substr(0,1),options:{textAlign:"left",fontSize:this.fontSize}}),this.options.lastChar&&(w.push({data:"00"}),w.push({data:"00000",text:this.options.lastChar,options:{fontSize:this.fontSize}}))),w}}]),v})(l.default);return oc.default=d,oc}var uc={},Xy;function UO(){if(Xy)return uc;Xy=1,Object.defineProperty(uc,"__esModule",{value:!0});var i=(function(){function d(b,v){for(var _=0;_<v.length;_++){var w=v[_];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(b,w.key,w)}}return function(b,v,_){return v&&d(b.prototype,v),_&&d(b,_),b}})(),t=function d(b,v,_){b===null&&(b=Function.prototype);var w=Object.getOwnPropertyDescriptor(b,v);if(w===void 0){var S=Object.getPrototypeOf(b);return S===null?void 0:d(S,v,_)}else{if("value"in w)return w.value;var M=w.get;return M===void 0?void 0:M.call(_)}},r=dv(),s=l(r);function l(d){return d&&d.__esModule?d:{default:d}}function c(d,b){if(!(d instanceof b))throw new TypeError("Cannot call a class as a function")}function m(d,b){if(!d)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return b&&(typeof b=="object"||typeof b=="function")?b:d}function p(d,b){if(typeof b!="function"&&b!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof b);d.prototype=Object.create(b&&b.prototype,{constructor:{value:d,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(d,b):d.__proto__=b)}var g=function(b){var v=b.substr(0,7).split("").map(function(_){return+_}).reduce(function(_,w,S){return S%2?_+w:_+w*3},0);return(10-v%10)%10},f=(function(d){p(b,d);function b(v,_){return c(this,b),v.search(/^[0-9]{7}$/)!==-1&&(v+=g(v)),m(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,v,_))}return i(b,[{key:"valid",value:function(){return this.data.search(/^[0-9]{8}$/)!==-1&&+this.data[7]===g(this.data)}},{key:"leftText",value:function(){return t(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"leftText",this).call(this,0,4)}},{key:"leftEncode",value:function(){var _=this.data.substr(0,4);return t(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"leftEncode",this).call(this,_,"LLLL")}},{key:"rightText",value:function(){return t(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"rightText",this).call(this,4,4)}},{key:"rightEncode",value:function(){var _=this.data.substr(4,4);return t(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"rightEncode",this).call(this,_,"RRRR")}}]),b})(s.default);return uc.default=f,uc}var fc={},Ky;function PO(){if(Ky)return fc;Ky=1,Object.defineProperty(fc,"__esModule",{value:!0});var i=(function(){function v(_,w){for(var S=0;S<w.length;S++){var M=w[S];M.enumerable=M.enumerable||!1,M.configurable=!0,"value"in M&&(M.writable=!0),Object.defineProperty(_,M.key,M)}}return function(_,w,S){return w&&v(_.prototype,w),S&&v(_,S),_}})(),t=xo(),r=_o(),s=m(r),l=gn(),c=m(l);function m(v){return v&&v.__esModule?v:{default:v}}function p(v,_){if(!(v instanceof _))throw new TypeError("Cannot call a class as a function")}function g(v,_){if(!v)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return _&&(typeof _=="object"||typeof _=="function")?_:v}function f(v,_){if(typeof _!="function"&&_!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof _);v.prototype=Object.create(_&&_.prototype,{constructor:{value:v,enumerable:!1,writable:!0,configurable:!0}}),_&&(Object.setPrototypeOf?Object.setPrototypeOf(v,_):v.__proto__=_)}var d=function(_){var w=_.split("").map(function(S){return+S}).reduce(function(S,M,L){return L%2?S+M*9:S+M*3},0);return w%10},b=(function(v){f(_,v);function _(w,S){return p(this,_),g(this,(_.__proto__||Object.getPrototypeOf(_)).call(this,w,S))}return i(_,[{key:"valid",value:function(){return this.data.search(/^[0-9]{5}$/)!==-1}},{key:"encode",value:function(){var S=t.EAN5_STRUCTURE[d(this.data)];return{data:"1011"+(0,s.default)(this.data,S,"01"),text:this.text}}}]),_})(c.default);return fc.default=b,fc}var hc={},Jy;function IO(){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=m(r),l=gn(),c=m(l);function m(b){return b&&b.__esModule?b:{default:b}}function p(b,v){if(!(b instanceof v))throw new TypeError("Cannot call a class as a function")}function g(b,v){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return v&&(typeof v=="object"||typeof v=="function")?v:b}function f(b,v){if(typeof v!="function"&&v!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof v);b.prototype=Object.create(v&&v.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),v&&(Object.setPrototypeOf?Object.setPrototypeOf(b,v):b.__proto__=v)}var d=(function(b){f(v,b);function v(_,w){return p(this,v),g(this,(v.__proto__||Object.getPrototypeOf(v)).call(this,_,w))}return i(v,[{key:"valid",value:function(){return this.data.search(/^[0-9]{2}$/)!==-1}},{key:"encode",value:function(){var w=t.EAN2_STRUCTURE[parseInt(this.data)%4];return{data:"1011"+(0,s.default)(this.data,w,"01"),text:this.text}}}]),v})(c.default);return hc.default=d,hc}var Ka={},Qy;function mv(){if(Qy)return Ka;Qy=1,Object.defineProperty(Ka,"__esModule",{value:!0});var i=(function(){function b(v,_){for(var w=0;w<_.length;w++){var S=_[w];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(v,S.key,S)}}return function(v,_,w){return _&&b(v.prototype,_),w&&b(v,w),v}})();Ka.checksum=d;var t=_o(),r=c(t),s=gn(),l=c(s);function c(b){return b&&b.__esModule?b:{default:b}}function m(b,v){if(!(b instanceof v))throw new TypeError("Cannot call a class as a function")}function p(b,v){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return v&&(typeof v=="object"||typeof v=="function")?v:b}function g(b,v){if(typeof v!="function"&&v!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof v);b.prototype=Object.create(v&&v.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),v&&(Object.setPrototypeOf?Object.setPrototypeOf(b,v):b.__proto__=v)}var f=(function(b){g(v,b);function v(_,w){m(this,v),_.search(/^[0-9]{11}$/)!==-1&&(_+=d(_));var S=p(this,(v.__proto__||Object.getPrototypeOf(v)).call(this,_,w));return S.displayValue=w.displayValue,w.fontSize>w.width*10?S.fontSize=w.width*10:S.fontSize=w.fontSize,S.guardHeight=w.height+S.fontSize/2+w.textMargin,S}return i(v,[{key:"valid",value:function(){return this.data.search(/^[0-9]{12}$/)!==-1&&this.data[11]==d(this.data)}},{key:"encode",value:function(){return this.options.flat?this.flatEncoding():this.guardedEncoding()}},{key:"flatEncoding",value:function(){var w="";return w+="101",w+=(0,r.default)(this.data.substr(0,6),"LLLLLL"),w+="01010",w+=(0,r.default)(this.data.substr(6,6),"RRRRRR"),w+="101",{data:w,text:this.text}}},{key:"guardedEncoding",value:function(){var w=[];return this.displayValue&&w.push({data:"00000000",text:this.text.substr(0,1),options:{textAlign:"left",fontSize:this.fontSize}}),w.push({data:"101"+(0,r.default)(this.data[0],"L"),options:{height:this.guardHeight}}),w.push({data:(0,r.default)(this.data.substr(1,5),"LLLLL"),text:this.text.substr(1,5),options:{fontSize:this.fontSize}}),w.push({data:"01010",options:{height:this.guardHeight}}),w.push({data:(0,r.default)(this.data.substr(6,5),"RRRRR"),text:this.text.substr(6,5),options:{fontSize:this.fontSize}}),w.push({data:(0,r.default)(this.data[11],"R")+"101",options:{height:this.guardHeight}}),this.displayValue&&w.push({data:"00000000",text:this.text.substr(11,1),options:{textAlign:"right",fontSize:this.fontSize}}),w}}]),v})(l.default);function d(b){var v=0,_;for(_=1;_<11;_+=2)v+=parseInt(b[_]);for(_=0;_<11;_+=2)v+=parseInt(b[_])*3;return(10-v%10)%10}return Ka.default=f,Ka}var dc={},Zy;function $O(){if(Zy)return dc;Zy=1,Object.defineProperty(dc,"__esModule",{value:!0});var i=(function(){function w(S,M){for(var L=0;L<M.length;L++){var z=M[L];z.enumerable=z.enumerable||!1,z.configurable=!0,"value"in z&&(z.writable=!0),Object.defineProperty(S,z.key,z)}}return function(S,M,L){return M&&w(S.prototype,M),L&&w(S,L),S}})(),t=_o(),r=m(t),s=gn(),l=m(s),c=mv();function m(w){return w&&w.__esModule?w:{default:w}}function p(w,S){if(!(w instanceof S))throw new TypeError("Cannot call a class as a function")}function g(w,S){if(!w)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return S&&(typeof S=="object"||typeof S=="function")?S:w}function f(w,S){if(typeof S!="function"&&S!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof S);w.prototype=Object.create(S&&S.prototype,{constructor:{value:w,enumerable:!1,writable:!0,configurable:!0}}),S&&(Object.setPrototypeOf?Object.setPrototypeOf(w,S):w.__proto__=S)}var d=["XX00000XXX","XX10000XXX","XX20000XXX","XXX00000XX","XXXX00000X","XXXXX00005","XXXXX00006","XXXXX00007","XXXXX00008","XXXXX00009"],b=[["EEEOOO","OOOEEE"],["EEOEOO","OOEOEE"],["EEOOEO","OOEEOE"],["EEOOOE","OOEEEO"],["EOEEOO","OEOOEE"],["EOOEEO","OEEOOE"],["EOOOEE","OEEEOO"],["EOEOEO","OEOEOE"],["EOEOOE","OEOEEO"],["EOOEOE","OEEOEO"]],v=(function(w){f(S,w);function S(M,L){p(this,S);var z=g(this,(S.__proto__||Object.getPrototypeOf(S)).call(this,M,L));if(z.isValid=!1,M.search(/^[0-9]{6}$/)!==-1)z.middleDigits=M,z.upcA=_(M,"0"),z.text=L.text||""+z.upcA[0]+M+z.upcA[z.upcA.length-1],z.isValid=!0;else if(M.search(/^[01][0-9]{7}$/)!==-1)if(z.middleDigits=M.substring(1,M.length-1),z.upcA=_(z.middleDigits,M[0]),z.upcA[z.upcA.length-1]===M[M.length-1])z.isValid=!0;else return g(z);else return g(z);return z.displayValue=L.displayValue,L.fontSize>L.width*10?z.fontSize=L.width*10:z.fontSize=L.fontSize,z.guardHeight=L.height+z.fontSize/2+L.textMargin,z}return i(S,[{key:"valid",value:function(){return this.isValid}},{key:"encode",value:function(){return this.options.flat?this.flatEncoding():this.guardedEncoding()}},{key:"flatEncoding",value:function(){var L="";return L+="101",L+=this.encodeMiddleDigits(),L+="010101",{data:L,text:this.text}}},{key:"guardedEncoding",value:function(){var L=[];return this.displayValue&&L.push({data:"00000000",text:this.text[0],options:{textAlign:"left",fontSize:this.fontSize}}),L.push({data:"101",options:{height:this.guardHeight}}),L.push({data:this.encodeMiddleDigits(),text:this.text.substring(1,7),options:{fontSize:this.fontSize}}),L.push({data:"010101",options:{height:this.guardHeight}}),this.displayValue&&L.push({data:"00000000",text:this.text[7],options:{textAlign:"right",fontSize:this.fontSize}}),L}},{key:"encodeMiddleDigits",value:function(){var L=this.upcA[0],z=this.upcA[this.upcA.length-1],ie=b[parseInt(z)][parseInt(L)];return(0,r.default)(this.middleDigits,ie)}}]),S})(l.default);function _(w,S){for(var M=parseInt(w[w.length-1]),L=d[M],z="",ie=0,ae=0;ae<L.length;ae++){var C=L[ae];C==="X"?z+=w[ie++]:z+=C}return z=""+S+z,""+z+(0,c.checksum)(z)}return dc.default=v,dc}var Wy;function HO(){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=zO(),t=v(i),r=UO(),s=v(r),l=PO(),c=v(l),m=IO(),p=v(m),g=mv(),f=v(g),d=$O(),b=v(d);function v(_){return _&&_.__esModule?_:{default:_}}return Ut.EAN13=t.default,Ut.EAN8=s.default,Ut.EAN5=c.default,Ut.EAN2=p.default,Ut.UPC=f.default,Ut.UPCE=b.default,Ut}var Li={},mc={},Ms={},e1;function GO(){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 pv(){if(t1)return mc;t1=1,Object.defineProperty(mc,"__esModule",{value:!0});var i=(function(){function f(d,b){for(var v=0;v<b.length;v++){var _=b[v];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(d,_.key,_)}}return function(d,b,v){return b&&f(d.prototype,b),v&&f(d,v),d}})(),t=GO(),r=gn(),s=l(r);function l(f){return f&&f.__esModule?f:{default:f}}function c(f,d){if(!(f instanceof d))throw new TypeError("Cannot call a class as a function")}function m(f,d){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:f}function p(f,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);f.prototype=Object.create(d&&d.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(f,d):f.__proto__=d)}var g=(function(f){p(d,f);function d(){return c(this,d),m(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments))}return i(d,[{key:"valid",value:function(){return this.data.search(/^([0-9]{2})+$/)!==-1}},{key:"encode",value:function(){var v=this,_=this.data.match(/.{2}/g).map(function(w){return v.encodePair(w)}).join("");return{data:t.START_BIN+_+t.END_BIN,text:this.text}}},{key:"encodePair",value:function(v){var _=t.BINARIES[v[1]];return t.BINARIES[v[0]].split("").map(function(w,S){return(w==="1"?"111":"1")+(_[S]==="1"?"000":"0")}).join("")}}]),d})(s.default);return mc.default=g,mc}var pc={},n1;function FO(){if(n1)return pc;n1=1,Object.defineProperty(pc,"__esModule",{value:!0});var i=(function(){function f(d,b){for(var v=0;v<b.length;v++){var _=b[v];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(d,_.key,_)}}return function(d,b,v){return b&&f(d.prototype,b),v&&f(d,v),d}})(),t=pv(),r=s(t);function s(f){return f&&f.__esModule?f:{default:f}}function l(f,d){if(!(f instanceof d))throw new TypeError("Cannot call a class as a function")}function c(f,d){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:f}function m(f,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);f.prototype=Object.create(d&&d.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(f,d):f.__proto__=d)}var p=function(d){var b=d.substr(0,13).split("").map(function(v){return parseInt(v,10)}).reduce(function(v,_,w){return v+_*(3-w%2*2)},0);return Math.ceil(b/10)*10-b},g=(function(f){m(d,f);function d(b,v){return l(this,d),b.search(/^[0-9]{13}$/)!==-1&&(b+=p(b)),c(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b,v))}return i(d,[{key:"valid",value:function(){return this.data.search(/^[0-9]{14}$/)!==-1&&+this.data[13]===p(this.data)}}]),d})(r.default);return pc.default=g,pc}var r1;function VO(){if(r1)return Li;r1=1,Object.defineProperty(Li,"__esModule",{value:!0}),Li.ITF14=Li.ITF=void 0;var i=pv(),t=l(i),r=FO(),s=l(r);function l(c){return c&&c.__esModule?c:{default:c}}return Li.ITF=t.default,Li.ITF14=s.default,Li}var an={},gc={},i1;function wo(){if(i1)return gc;i1=1,Object.defineProperty(gc,"__esModule",{value:!0});var i=(function(){function f(d,b){for(var v=0;v<b.length;v++){var _=b[v];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(d,_.key,_)}}return function(d,b,v){return b&&f(d.prototype,b),v&&f(d,v),d}})(),t=gn(),r=s(t);function s(f){return f&&f.__esModule?f:{default:f}}function l(f,d){if(!(f instanceof d))throw new TypeError("Cannot call a class as a function")}function c(f,d){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:f}function m(f,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);f.prototype=Object.create(d&&d.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(f,d):f.__proto__=d)}var p=(function(f){m(d,f);function d(b,v){return l(this,d),c(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b,v))}return i(d,[{key:"encode",value:function(){for(var v="110",_=0;_<this.data.length;_++){var w=parseInt(this.data[_]),S=w.toString(2);S=g(S,4-S.length);for(var M=0;M<S.length;M++)v+=S[M]=="0"?"100":"110"}return v+="1001",{data:v,text:this.text}}},{key:"valid",value:function(){return this.data.search(/^[0-9]+$/)!==-1}}]),d})(r.default);function g(f,d){for(var b=0;b<d;b++)f="0"+f;return f}return gc.default=p,gc}var yc={},Ja={},s1;function pu(){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 m=parseInt(r[r.length-1-c]);s+=l[c%l.length]*m}return(11-s%11)%11}return Ja}var a1;function YO(){if(a1)return yc;a1=1,Object.defineProperty(yc,"__esModule",{value:!0});var i=wo(),t=s(i),r=pu();function s(g){return g&&g.__esModule?g:{default:g}}function l(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}function c(g,f){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:g}function m(g,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);g.prototype=Object.create(f&&f.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(g,f):g.__proto__=f)}var p=(function(g){m(f,g);function f(d,b){return l(this,f),c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,d+(0,r.mod10)(d),b))}return f})(t.default);return yc.default=p,yc}var bc={},o1;function XO(){if(o1)return bc;o1=1,Object.defineProperty(bc,"__esModule",{value:!0});var i=wo(),t=s(i),r=pu();function s(g){return g&&g.__esModule?g:{default:g}}function l(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}function c(g,f){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:g}function m(g,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);g.prototype=Object.create(f&&f.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(g,f):g.__proto__=f)}var p=(function(g){m(f,g);function f(d,b){return l(this,f),c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,d+(0,r.mod11)(d),b))}return f})(t.default);return bc.default=p,bc}var vc={},l1;function KO(){if(l1)return vc;l1=1,Object.defineProperty(vc,"__esModule",{value:!0});var i=wo(),t=s(i),r=pu();function s(g){return g&&g.__esModule?g:{default:g}}function l(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}function c(g,f){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:g}function m(g,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);g.prototype=Object.create(f&&f.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(g,f):g.__proto__=f)}var p=(function(g){m(f,g);function f(d,b){return l(this,f),d+=(0,r.mod10)(d),d+=(0,r.mod10)(d),c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,d,b))}return f})(t.default);return vc.default=p,vc}var xc={},c1;function JO(){if(c1)return xc;c1=1,Object.defineProperty(xc,"__esModule",{value:!0});var i=wo(),t=s(i),r=pu();function s(g){return g&&g.__esModule?g:{default:g}}function l(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}function c(g,f){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:g}function m(g,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);g.prototype=Object.create(f&&f.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(g,f):g.__proto__=f)}var p=(function(g){m(f,g);function f(d,b){return l(this,f),d+=(0,r.mod11)(d),d+=(0,r.mod10)(d),c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,d,b))}return f})(t.default);return xc.default=p,xc}var u1;function QO(){if(u1)return an;u1=1,Object.defineProperty(an,"__esModule",{value:!0}),an.MSI1110=an.MSI1010=an.MSI11=an.MSI10=an.MSI=void 0;var i=wo(),t=d(i),r=YO(),s=d(r),l=XO(),c=d(l),m=KO(),p=d(m),g=JO(),f=d(g);function d(b){return b&&b.__esModule?b:{default:b}}return an.MSI=t.default,an.MSI10=s.default,an.MSI11=c.default,an.MSI1010=p.default,an.MSI1110=f.default,an}var Qa={},f1;function ZO(){if(f1)return Qa;f1=1,Object.defineProperty(Qa,"__esModule",{value:!0}),Qa.pharmacode=void 0;var i=(function(){function g(f,d){for(var b=0;b<d.length;b++){var v=d[b];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(f,v.key,v)}}return function(f,d,b){return d&&g(f.prototype,d),b&&g(f,b),f}})(),t=gn(),r=s(t);function s(g){return g&&g.__esModule?g:{default:g}}function l(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}function c(g,f){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:g}function m(g,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);g.prototype=Object.create(f&&f.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(g,f):g.__proto__=f)}var p=(function(g){m(f,g);function f(d,b){l(this,f);var v=c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,d,b));return v.number=parseInt(d,10),v}return i(f,[{key:"encode",value:function(){for(var b=this.number,v="";!isNaN(b)&&b!=0;)b%2===0?(v="11100"+v,b=(b-2)/2):(v="100"+v,b=(b-1)/2);return v=v.slice(0,-2),{data:v,text:this.text}}},{key:"valid",value:function(){return this.number>=3&&this.number<=131070}}]),f})(r.default);return Qa.pharmacode=p,Qa}var Za={},h1;function WO(){if(h1)return Za;h1=1,Object.defineProperty(Za,"__esModule",{value:!0}),Za.codabar=void 0;var i=(function(){function g(f,d){for(var b=0;b<d.length;b++){var v=d[b];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(f,v.key,v)}}return function(f,d,b){return d&&g(f.prototype,d),b&&g(f,b),f}})(),t=gn(),r=s(t);function s(g){return g&&g.__esModule?g:{default:g}}function l(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}function c(g,f){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:g}function m(g,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);g.prototype=Object.create(f&&f.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(g,f):g.__proto__=f)}var p=(function(g){m(f,g);function f(d,b){l(this,f),d.search(/^[0-9\-\$\:\.\+\/]+$/)===0&&(d="A"+d+"A");var v=c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,d.toUpperCase(),b));return v.text=v.options.text||v.text.replace(/[A-D]/g,""),v}return i(f,[{key:"valid",value:function(){return this.data.search(/^[A-D][0-9\-\$\:\.\+\/]+[A-D]$/)!==-1}},{key:"encode",value:function(){for(var b=[],v=this.getEncodings(),_=0;_<this.data.length;_++)b.push(v[this.data.charAt(_)]),_!==this.data.length-1&&b.push("0");return{text:this.text,data:b.join("")}}},{key:"getEncodings",value:function(){return{0:"101010011",1:"101011001",2:"101001011",3:"110010101",4:"101101001",5:"110101001",6:"100101011",7:"100101101",8:"100110101",9:"110100101","-":"101001101",$:"101100101",":":"1101011011","/":"1101101011",".":"1101101101","+":"1011011011",A:"1011001001",B:"1001001011",C:"1010010011",D:"1010011001"}}}]),f})(r.default);return Za.codabar=p,Za}var zi={},_c={},Rs={},d1;function eA(){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 gv(){if(m1)return _c;m1=1,Object.defineProperty(_c,"__esModule",{value:!0});var i=(function(){function f(d,b){for(var v=0;v<b.length;v++){var _=b[v];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(d,_.key,_)}}return function(d,b,v){return b&&f(d.prototype,b),v&&f(d,v),d}})(),t=eA(),r=gn(),s=l(r);function l(f){return f&&f.__esModule?f:{default:f}}function c(f,d){if(!(f instanceof d))throw new TypeError("Cannot call a class as a function")}function m(f,d){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:f}function p(f,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);f.prototype=Object.create(d&&d.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(f,d):f.__proto__=d)}var g=(function(f){p(d,f);function d(b,v){return c(this,d),m(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b,v))}return i(d,[{key:"valid",value:function(){return/^[0-9A-Z\-. $/+%]+$/.test(this.data)}},{key:"encode",value:function(){var v=this.data.split("").flatMap(function(M){return t.MULTI_SYMBOLS[M]||M}),_=v.map(function(M){return d.getEncoding(M)}).join(""),w=d.checksum(v,20),S=d.checksum(v.concat(w),15);return{text:this.text,data:d.getEncoding("ÿ")+_+d.getEncoding(w)+d.getEncoding(S)+d.getEncoding("ÿ")+"1"}}}],[{key:"getEncoding",value:function(v){return t.BINARIES[d.symbolValue(v)]}},{key:"getSymbol",value:function(v){return t.SYMBOLS[v]}},{key:"symbolValue",value:function(v){return t.SYMBOLS.indexOf(v)}},{key:"checksum",value:function(v,_){var w=v.slice().reverse().reduce(function(S,M,L){var z=L%_+1;return S+d.symbolValue(M)*z},0);return d.getSymbol(w%47)}}]),d})(s.default);return _c.default=g,_c}var wc={},p1;function tA(){if(p1)return wc;p1=1,Object.defineProperty(wc,"__esModule",{value:!0});var i=(function(){function g(f,d){for(var b=0;b<d.length;b++){var v=d[b];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(f,v.key,v)}}return function(f,d,b){return d&&g(f.prototype,d),b&&g(f,b),f}})(),t=gv(),r=s(t);function s(g){return g&&g.__esModule?g:{default:g}}function l(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}function c(g,f){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:g}function m(g,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);g.prototype=Object.create(f&&f.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(g,f):g.__proto__=f)}var p=(function(g){m(f,g);function f(d,b){return l(this,f),c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,d,b))}return i(f,[{key:"valid",value:function(){return/^[\x00-\x7f]+$/.test(this.data)}}]),f})(r.default);return wc.default=p,wc}var g1;function nA(){if(g1)return zi;g1=1,Object.defineProperty(zi,"__esModule",{value:!0}),zi.CODE93FullASCII=zi.CODE93=void 0;var i=gv(),t=l(i),r=tA(),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 rA(){if(y1)return Wa;y1=1,Object.defineProperty(Wa,"__esModule",{value:!0}),Wa.GenericBarcode=void 0;var i=(function(){function g(f,d){for(var b=0;b<d.length;b++){var v=d[b];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(f,v.key,v)}}return function(f,d,b){return d&&g(f.prototype,d),b&&g(f,b),f}})(),t=gn(),r=s(t);function s(g){return g&&g.__esModule?g:{default:g}}function l(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}function c(g,f){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:g}function m(g,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);g.prototype=Object.create(f&&f.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(g,f):g.__proto__=f)}var p=(function(g){m(f,g);function f(d,b){return l(this,f),c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,d,b))}return i(f,[{key:"encode",value:function(){return{data:"10101010101010101010101010101010101010101",text:this.text}}},{key:"valid",value:function(){return!0}}]),f})(r.default);return Wa.GenericBarcode=p,Wa}var b1;function iA(){if(b1)return Wl;b1=1,Object.defineProperty(Wl,"__esModule",{value:!0});var i=CO(),t=LO(),r=HO(),s=VO(),l=QO(),c=ZO(),m=WO(),p=nA(),g=rA();return Wl.default={CODE39:i.CODE39,CODE128:t.CODE128,CODE128A:t.CODE128A,CODE128B:t.CODE128B,CODE128C:t.CODE128C,EAN13:r.EAN13,EAN8:r.EAN8,EAN5:r.EAN5,EAN2:r.EAN2,UPC:r.UPC,UPCE:r.UPCE,ITF14:s.ITF14,ITF:s.ITF,MSI:l.MSI,MSI10:l.MSI10,MSI11:l.MSI11,MSI1010:l.MSI1010,MSI1110:l.MSI1110,pharmacode:c.pharmacode,codabar:m.codabar,CODE93:p.CODE93,CODE93FullASCII:p.CODE93FullASCII,GenericBarcode:g.GenericBarcode},Wl}var Sc={},v1;function gu(){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 sA(){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 aA(){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 yv(){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 bv(){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 oA(){if(E1)return jc;E1=1,Object.defineProperty(jc,"__esModule",{value:!0});var i=yv(),t=l(i),r=bv(),s=l(r);function l(m){return m&&m.__esModule?m:{default:m}}function c(m){var p={};for(var g in s.default)s.default.hasOwnProperty(g)&&(m.hasAttribute("jsbarcode-"+g.toLowerCase())&&(p[g]=m.getAttribute("jsbarcode-"+g.toLowerCase())),m.hasAttribute("data-"+g.toLowerCase())&&(p[g]=m.getAttribute("data-"+g.toLowerCase())));return p.value=m.getAttribute("jsbarcode-value")||m.getAttribute("data-value"),p=(0,t.default)(p),p}return jc.default=c,jc}var kc={},Cc={},on={},O1;function vv(){if(O1)return on;O1=1,Object.defineProperty(on,"__esModule",{value:!0}),on.getTotalWidthOfEncodings=on.calculateEncodingAttributes=on.getBarcodePadding=on.getEncodingHeight=on.getMaximumHeightOfEncodings=void 0;var i=gu(),t=r(i);function r(f){return f&&f.__esModule?f:{default:f}}function s(f,d){return d.height+(d.displayValue&&f.text.length>0?d.fontSize+d.textMargin:0)+d.marginTop+d.marginBottom}function l(f,d,b){if(b.displayValue&&d<f){if(b.textAlign=="center")return Math.floor((f-d)/2);if(b.textAlign=="left")return 0;if(b.textAlign=="right")return Math.floor(f-d)}return 0}function c(f,d,b){for(var v=0;v<f.length;v++){var _=f[v],w=(0,t.default)(d,_.options),S;w.displayValue?S=g(_.text,w,b):S=0;var M=_.data.length*w.width;_.width=Math.ceil(Math.max(S,M)),_.height=s(_,w),_.barcodePadding=l(S,M,w)}}function m(f){for(var d=0,b=0;b<f.length;b++)d+=f[b].width;return d}function p(f){for(var d=0,b=0;b<f.length;b++)f[b].height>d&&(d=f[b].height);return d}function g(f,d,b){var v;if(b)v=b;else if(typeof document<"u")v=document.createElement("canvas").getContext("2d");else return 0;v.font=d.fontOptions+" "+d.fontSize+"px "+d.font;var _=v.measureText(f);if(!_)return 0;var w=_.width;return w}return on.getMaximumHeightOfEncodings=p,on.getEncodingHeight=s,on.getBarcodePadding=l,on.calculateEncodingAttributes=c,on.getTotalWidthOfEncodings=m,on}var A1;function lA(){if(A1)return Cc;A1=1,Object.defineProperty(Cc,"__esModule",{value:!0});var i=(function(){function p(g,f){for(var d=0;d<f.length;d++){var b=f[d];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(g,b.key,b)}}return function(g,f,d){return f&&p(g.prototype,f),d&&p(g,d),g}})(),t=gu(),r=l(t),s=vv();function l(p){return p&&p.__esModule?p:{default:p}}function c(p,g){if(!(p instanceof g))throw new TypeError("Cannot call a class as a function")}var m=(function(){function p(g,f,d){c(this,p),this.canvas=g,this.encodings=f,this.options=d}return i(p,[{key:"render",value:function(){if(!this.canvas.getContext)throw new Error("The browser does not support canvas.");this.prepareCanvas();for(var f=0;f<this.encodings.length;f++){var d=(0,r.default)(this.options,this.encodings[f].options);this.drawCanvasBarcode(d,this.encodings[f]),this.drawCanvasText(d,this.encodings[f]),this.moveCanvasDrawing(this.encodings[f])}this.restoreCanvas()}},{key:"prepareCanvas",value:function(){var f=this.canvas.getContext("2d");f.save(),(0,s.calculateEncodingAttributes)(this.encodings,this.options,f);var d=(0,s.getTotalWidthOfEncodings)(this.encodings),b=(0,s.getMaximumHeightOfEncodings)(this.encodings);this.canvas.width=d+this.options.marginLeft+this.options.marginRight,this.canvas.height=b,f.clearRect(0,0,this.canvas.width,this.canvas.height),this.options.background&&(f.fillStyle=this.options.background,f.fillRect(0,0,this.canvas.width,this.canvas.height)),f.translate(this.options.marginLeft,0)}},{key:"drawCanvasBarcode",value:function(f,d){var b=this.canvas.getContext("2d"),v=d.data,_;f.textPosition=="top"?_=f.marginTop+f.fontSize+f.textMargin:_=f.marginTop,b.fillStyle=f.lineColor;for(var w=0;w<v.length;w++){var S=w*f.width+d.barcodePadding;v[w]==="1"?b.fillRect(S,_,f.width,f.height):v[w]&&b.fillRect(S,_,f.width,f.height*v[w])}}},{key:"drawCanvasText",value:function(f,d){var b=this.canvas.getContext("2d"),v=f.fontOptions+" "+f.fontSize+"px "+f.font;if(f.displayValue){var _,w;f.textPosition=="top"?w=f.marginTop+f.fontSize-f.textMargin:w=f.height+f.textMargin+f.marginTop+f.fontSize,b.font=v,f.textAlign=="left"||d.barcodePadding>0?(_=0,b.textAlign="left"):f.textAlign=="right"?(_=d.width-1,b.textAlign="right"):(_=d.width/2,b.textAlign="center"),b.fillText(d.text,_,w)}}},{key:"moveCanvasDrawing",value:function(f){var d=this.canvas.getContext("2d");d.translate(f.width,0)}},{key:"restoreCanvas",value:function(){var f=this.canvas.getContext("2d");f.restore()}}]),p})();return Cc.default=m,Cc}var Mc={},j1;function cA(){if(j1)return Mc;j1=1,Object.defineProperty(Mc,"__esModule",{value:!0});var i=(function(){function g(f,d){for(var b=0;b<d.length;b++){var v=d[b];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(f,v.key,v)}}return function(f,d,b){return d&&g(f.prototype,d),b&&g(f,b),f}})(),t=gu(),r=l(t),s=vv();function l(g){return g&&g.__esModule?g:{default:g}}function c(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}var m="http://www.w3.org/2000/svg",p=(function(){function g(f,d,b){c(this,g),this.svg=f,this.encodings=d,this.options=b,this.document=b.xmlDocument||document}return i(g,[{key:"render",value:function(){var d=this.options.marginLeft;this.prepareSVG();for(var b=0;b<this.encodings.length;b++){var v=this.encodings[b],_=(0,r.default)(this.options,v.options),w=this.createGroup(d,_.marginTop,this.svg);this.setGroupOptions(w,_),this.drawSvgBarcode(w,_,v),this.drawSVGText(w,_,v),d+=v.width}}},{key:"prepareSVG",value:function(){for(;this.svg.firstChild;)this.svg.removeChild(this.svg.firstChild);(0,s.calculateEncodingAttributes)(this.encodings,this.options);var d=(0,s.getTotalWidthOfEncodings)(this.encodings),b=(0,s.getMaximumHeightOfEncodings)(this.encodings),v=d+this.options.marginLeft+this.options.marginRight;this.setSvgAttributes(v,b),this.options.background&&this.drawRect(0,0,v,b,this.svg).setAttribute("fill",this.options.background)}},{key:"drawSvgBarcode",value:function(d,b,v){var _=v.data,w;b.textPosition=="top"?w=b.fontSize+b.textMargin:w=0;for(var S=0,M=0,L=0;L<_.length;L++)M=L*b.width+v.barcodePadding,_[L]==="1"?S++:S>0&&(this.drawRect(M-b.width*S,w,b.width*S,b.height,d),S=0);S>0&&this.drawRect(M-b.width*(S-1),w,b.width*S,b.height,d)}},{key:"drawSVGText",value:function(d,b,v){var _=this.document.createElementNS(m,"text");if(b.displayValue){var w,S;_.setAttribute("font-family",b.font),_.setAttribute("font-size",b.fontSize),b.fontOptions.includes("bold")&&_.setAttribute("font-weight","bold"),b.fontOptions.includes("italic")&&_.setAttribute("font-style","italic"),b.textPosition=="top"?S=b.fontSize-b.textMargin:S=b.height+b.textMargin+b.fontSize,b.textAlign=="left"||v.barcodePadding>0?(w=0,_.setAttribute("text-anchor","start")):b.textAlign=="right"?(w=v.width-1,_.setAttribute("text-anchor","end")):(w=v.width/2,_.setAttribute("text-anchor","middle")),_.setAttribute("x",w),_.setAttribute("y",S),_.appendChild(this.document.createTextNode(v.text)),d.appendChild(_)}}},{key:"setSvgAttributes",value:function(d,b){var v=this.svg;v.setAttribute("width",d+"px"),v.setAttribute("height",b+"px"),v.setAttribute("x","0px"),v.setAttribute("y","0px"),v.setAttribute("viewBox","0 0 "+d+" "+b),v.setAttribute("xmlns",m),v.setAttribute("version","1.1")}},{key:"createGroup",value:function(d,b,v){var _=this.document.createElementNS(m,"g");return _.setAttribute("transform","translate("+d+", "+b+")"),v.appendChild(_),_}},{key:"setGroupOptions",value:function(d,b){d.setAttribute("fill",b.lineColor)}},{key:"drawRect",value:function(d,b,v,_,w){var S=this.document.createElementNS(m,"rect");return S.setAttribute("x",d),S.setAttribute("y",b),S.setAttribute("width",v),S.setAttribute("height",_),w.appendChild(S),S}}]),g})();return Mc.default=p,Mc}var Rc={},T1;function uA(){if(T1)return Rc;T1=1,Object.defineProperty(Rc,"__esModule",{value:!0});var i=(function(){function s(l,c){for(var m=0;m<c.length;m++){var p=c[m];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(l,p.key,p)}}return function(l,c,m){return c&&s(l.prototype,c),m&&s(l,m),l}})();function t(s,l){if(!(s instanceof l))throw new TypeError("Cannot call a class as a function")}var r=(function(){function s(l,c,m){t(this,s),this.object=l,this.encodings=c,this.options=m}return i(s,[{key:"render",value:function(){this.object.encodings=this.encodings}}]),s})();return Rc.default=r,Rc}var N1;function fA(){if(N1)return kc;N1=1,Object.defineProperty(kc,"__esModule",{value:!0});var i=lA(),t=m(i),r=cA(),s=m(r),l=uA(),c=m(l);function m(p){return p&&p.__esModule?p:{default:p}}return kc.default={CanvasRenderer:t.default,SVGRenderer:s.default,ObjectRenderer:c.default},kc}var Ds={},k1;function xv(){if(k1)return Ds;k1=1,Object.defineProperty(Ds,"__esModule",{value:!0});function i(m,p){if(!(m instanceof p))throw new TypeError("Cannot call a class as a function")}function t(m,p){if(!m)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p&&(typeof p=="object"||typeof p=="function")?p:m}function r(m,p){if(typeof p!="function"&&p!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof p);m.prototype=Object.create(p&&p.prototype,{constructor:{value:m,enumerable:!1,writable:!0,configurable:!0}}),p&&(Object.setPrototypeOf?Object.setPrototypeOf(m,p):m.__proto__=p)}var s=(function(m){r(p,m);function p(g,f){i(this,p);var d=t(this,(p.__proto__||Object.getPrototypeOf(p)).call(this));return d.name="InvalidInputException",d.symbology=g,d.input=f,d.message='"'+d.input+'" is not a valid input for '+d.symbology,d}return p})(Error),l=(function(m){r(p,m);function p(){i(this,p);var g=t(this,(p.__proto__||Object.getPrototypeOf(p)).call(this));return g.name="InvalidElementException",g.message="Not supported type to render on",g}return p})(Error),c=(function(m){r(p,m);function p(){i(this,p);var g=t(this,(p.__proto__||Object.getPrototypeOf(p)).call(this));return g.name="NoElementException",g.message="No element to render on.",g}return p})(Error);return Ds.InvalidInputException=s,Ds.InvalidElementException=l,Ds.NoElementException=c,Ds}var C1;function hA(){if(C1)return Ac;C1=1,Object.defineProperty(Ac,"__esModule",{value:!0});var i=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(d){return typeof d}:function(d){return d&&typeof Symbol=="function"&&d.constructor===Symbol&&d!==Symbol.prototype?"symbol":typeof d},t=oA(),r=m(t),s=fA(),l=m(s),c=xv();function m(d){return d&&d.__esModule?d:{default:d}}function p(d){if(typeof d=="string")return g(d);if(Array.isArray(d)){for(var b=[],v=0;v<d.length;v++)b.push(p(d[v]));return b}else{if(typeof HTMLCanvasElement<"u"&&d instanceof HTMLImageElement)return f(d);if(d&&d.nodeName&&d.nodeName.toLowerCase()==="svg"||typeof SVGElement<"u"&&d instanceof SVGElement)return{element:d,options:(0,r.default)(d),renderer:l.default.SVGRenderer};if(typeof HTMLCanvasElement<"u"&&d instanceof HTMLCanvasElement)return{element:d,options:(0,r.default)(d),renderer:l.default.CanvasRenderer};if(d&&d.getContext)return{element:d,renderer:l.default.CanvasRenderer};if(d&&(typeof d>"u"?"undefined":i(d))==="object"&&!d.nodeName)return{element:d,renderer:l.default.ObjectRenderer};throw new c.InvalidElementException}}function g(d){var b=document.querySelectorAll(d);if(b.length!==0){for(var v=[],_=0;_<b.length;_++)v.push(p(b[_]));return v}}function f(d){var b=document.createElement("canvas");return{element:b,options:(0,r.default)(d),renderer:l.default.CanvasRenderer,afterRender:function(){d.setAttribute("src",b.toDataURL())}}}return Ac.default=p,Ac}var Dc={},M1;function dA(){if(M1)return Dc;M1=1,Object.defineProperty(Dc,"__esModule",{value:!0});var i=(function(){function s(l,c){for(var m=0;m<c.length;m++){var p=c[m];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(l,p.key,p)}}return function(l,c,m){return c&&s(l.prototype,c),m&&s(l,m),l}})();function t(s,l){if(!(s instanceof l))throw new TypeError("Cannot call a class as a function")}var r=(function(){function s(l){t(this,s),this.api=l}return i(s,[{key:"handleCatch",value:function(c){if(c.name==="InvalidInputException")if(this.api._options.valid!==this.api._defaults.valid)this.api._options.valid(!1);else throw c.message;else throw c;this.api.render=function(){}}},{key:"wrapBarcodeCall",value:function(c){try{var m=c.apply(void 0,arguments);return this.api._options.valid(!0),m}catch(p){return this.handleCatch(p),this.api}}}]),s})();return Dc.default=r,Dc}var Hh,R1;function mA(){if(R1)return Hh;R1=1;var i=iA(),t=L(i),r=gu(),s=L(r),l=sA(),c=L(l),m=aA(),p=L(m),g=hA(),f=L(g),d=yv(),b=L(d),v=dA(),_=L(v),w=xv(),S=bv(),M=L(S);function L(B){return B&&B.__esModule?B:{default:B}}var z=function(){},ie=function(G,W,Q){var he=new z;if(typeof G>"u")throw Error("No element to render on was provided.");return he._renderProperties=(0,f.default)(G),he._encodings=[],he._options=M.default,he._errorHandler=new _.default(he),typeof W<"u"&&(Q=Q||{},Q.format||(Q.format=re()),he.options(Q)[Q.format](W,Q).render()),he};ie.getModule=function(B){return t.default[B]};for(var ae in t.default)t.default.hasOwnProperty(ae)&&C(t.default,ae);function C(B,G){z.prototype[G]=z.prototype[G.toUpperCase()]=z.prototype[G.toLowerCase()]=function(W,Q){var he=this;return he._errorHandler.wrapBarcodeCall(function(){Q.text=typeof Q.text>"u"?void 0:""+Q.text;var _e=(0,s.default)(he._options,Q);_e=(0,b.default)(_e);var Te=B[G],Y=I(W,Te,_e);return he._encodings.push(Y),he})}}function I(B,G,W){B=""+B;var Q=new G(B,W);if(!Q.valid())throw new w.InvalidInputException(Q.constructor.name,B);var he=Q.encode();he=(0,c.default)(he);for(var _e=0;_e<he.length;_e++)he[_e].options=(0,s.default)(W,he[_e].options);return he}function re(){return t.default.CODE128?"CODE128":Object.keys(t.default)[0]}z.prototype.options=function(B){return this._options=(0,s.default)(this._options,B),this},z.prototype.blank=function(B){var G=new Array(B+1).join("0");return this._encodings.push({data:G}),this},z.prototype.init=function(){if(this._renderProperties){Array.isArray(this._renderProperties)||(this._renderProperties=[this._renderProperties]);var B;for(var G in this._renderProperties){B=this._renderProperties[G];var W=(0,s.default)(this._options,B.options);W.format=="auto"&&(W.format=re()),this._errorHandler.wrapBarcodeCall(function(){var Q=W.value,he=t.default[W.format.toUpperCase()],_e=I(Q,he,W);K(B,_e,W)})}}},z.prototype.render=function(){if(!this._renderProperties)throw new w.NoElementException;if(Array.isArray(this._renderProperties))for(var B=0;B<this._renderProperties.length;B++)K(this._renderProperties[B],this._encodings,this._options);else K(this._renderProperties,this._encodings,this._options);return this},z.prototype._defaults=M.default;function K(B,G,W){G=(0,c.default)(G);for(var Q=0;Q<G.length;Q++)G[Q].options=(0,s.default)(W,G[Q].options),(0,p.default)(G[Q].options);(0,p.default)(W);var he=B.renderer,_e=new he(B.element,G,W);_e.render(),B.afterRender&&B.afterRender()}return typeof window<"u"&&(window.JsBarcode=ie),typeof jQuery<"u"&&(jQuery.fn.JsBarcode=function(B,G){var W=[];return jQuery(this).each(function(){W.push(this)}),ie(W,B,G)}),Hh=ie,Hh}var pA=mA();const gA=Q_(pA),yA={[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"},_v={[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 wv(i){return i.outcome===Pe.IDENTITY_PRIMED&&i.actor?`Hi ${i.actor.displayName}`:`${yA[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 Sv({content:i,compact:t}){const r=[],s=/^```(\w*)\n([\s\S]*?)^```$/gm;let l=0,c;for(;(c=s.exec(i))!==null;)c.index>l&&r.push({type:"text",text:i.slice(l,c.index)}),r.push({type:"code",lang:c[1],code:c[2].replace(/\n$/,"")}),l=c.index+c[0].length;l<i.length&&r.push({type:"text",text:i.slice(l)});const m=t?{text:"text-xs",heading:"text-xs",list:"text-xs",code:"text-2xs"}:{text:"text-sm",heading:"text-sm",list:"text-sm",code:"text-xs"},p=[];for(const g of r){if(g.type==="code"){const f=g.code.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");p.push(`<pre class="my-2 p-2.5 bg-surface-sunken rounded-md overflow-x-auto"><code class="${m.code} font-mono text-text-secondary leading-relaxed">${f}</code></pre>`);continue}p.push(...bA(g.text,m))}return y.jsx("div",{className:"prose-sm",dangerouslySetInnerHTML:{__html:p.join(`
54
- `)}})}function bA(i,t){const r=i.split(`
55
- `),s=[];let l=!1,c=!1,m=[];for(const p of r){const g=p.trim();if(g.startsWith("|")&&g.endsWith("|")){const f=g.slice(1,-1).split("|").map(d=>d.trim());if(f.every(d=>/^[-:]+$/.test(d)))continue;c||(c=!0,m=[]),m.push(f);continue}if(c){c=!1;const[f,...d]=m;s.push('<div class="overflow-x-auto my-2"><table class="text-xs w-full"><thead><tr>');for(const b of f)s.push(`<th class="text-left py-1 px-2 border-b border-border text-text-secondary font-medium">${ri(b)}</th>`);s.push("</tr></thead><tbody>");for(const b of d){s.push("<tr>");for(const v of b)s.push(`<td class="py-1 px-2 border-b border-border/50">${ri(v)}</td>`);s.push("</tr>")}s.push("</tbody></table></div>"),m=[]}if(!g){l&&(s.push("</ul>"),l=!1);continue}if(g.startsWith("### ")){l&&(s.push("</ul>"),l=!1),s.push(`<h4 class="${t.heading} font-semibold text-text-primary mt-3 mb-1">${ri(g.slice(4))}</h4>`);continue}if(g.startsWith("## ")){l&&(s.push("</ul>"),l=!1),s.push(`<h3 class="${t.heading} font-semibold text-text-primary mt-3 mb-1">${ri(g.slice(3))}</h3>`);continue}if(/^[-*_]{3,}$/.test(g)){l&&(s.push("</ul>"),l=!1),s.push('<hr class="border-border my-3" />');continue}if(/^[-*] /.test(g)){l||(s.push('<ul class="space-y-1 my-1">'),l=!0),s.push(`<li class="${t.list} text-text-secondary flex gap-2"><span class="text-text-tertiary shrink-0">-</span><span>${ri(g.slice(2))}</span></li>`);continue}l&&(s.push("</ul>"),l=!1),s.push(`<p class="${t.text} text-text-secondary my-1">${ri(g)}</p>`)}if(c&&m.length){const[p,...g]=m;s.push('<div class="overflow-x-auto my-2"><table class="text-xs w-full"><thead><tr>');for(const f of p)s.push(`<th class="text-left py-1 px-2 border-b border-border text-text-secondary font-medium">${ri(f)}</th>`);s.push("</tr></thead><tbody>");for(const f of g){s.push("<tr>");for(const d of f)s.push(`<td class="py-1 px-2 border-b border-border/50">${ri(d)}</td>`);s.push("</tr>")}s.push("</tbody></table></div>")}return l&&s.push("</ul>"),s}function vA(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 xA(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 _A({value:i}){const t=j.useRef(null),[r,s]=j.useState(!1);return j.useEffect(()=>{if(!(!t.current||!i))try{gA(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:xA(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 wA({onClose:i}){const{submitCode:t,lastResult:r,busy:s,wedgeConfig:l,updateWedgeConfig:c,diagnostics:m,diagnosticsOn:p,setDiagnosticsOn:g}=hv(),[f,d]=j.useState(""),[b,v]=j.useState(!1),_=S=>{S.preventDefault();const M=f.trim();M&&(d(""),t(M))},w=(r==null?void 0:r.response)??null;return y.jsxs("div",{className:"flex flex-col h-full",children:[y.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border",children:[y.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-text-primary",children:[y.jsx(ou,{className:"w-4 h-4"}),"Scan"]}),y.jsx("button",{type:"button",onClick:i,className:"text-text-tertiary hover:text-text-primary",title:"Close",children:y.jsx(Cn,{className:"w-4 h-4"})})]}),y.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-4 space-y-6",children:[y.jsxs("form",{onSubmit:_,className:"space-y-2",children:[y.jsx("label",{className:"block text-xs uppercase tracking-wide text-text-tertiary",children:"Enter a code"}),y.jsxs("div",{className:"flex gap-2",children:[y.jsx("input",{value:f,onChange:S=>d(vA(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(_A,{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 ${_v[w.outcome]}`,children:wv(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(Sv,{content:ru(w),compact:!0})})]}):y.jsx("div",{className:"text-sm text-status-error",children:r.error})]}),y.jsxs("div",{className:"space-y-2",children:[y.jsxs("button",{type:"button",onClick:()=>v(S=>!S),className:"text-xs uppercase tracking-wide text-text-tertiary hover:text-text-primary",children:["Capture settings ",b?"▾":"▸"]}),b&&y.jsxs("div",{className:"space-y-3",children:[y.jsxs("label",{className:"block text-sm text-text-primary",children:[y.jsx("span",{className:"block text-xs text-text-tertiary mb-1",children:"Key gap limit (ms) — a longer pause between keys starts a new capture; raise it for scanners that pace slowly"}),y.jsx("input",{type:"number",min:100,max:2e3,step:50,value:l.maxKeyGapMs,onChange:S=>c({maxKeyGapMs:Number(S.target.value)}),className:"w-24 px-2 py-1 text-sm bg-surface-raised border border-surface-border rounded"})]}),y.jsxs("label",{className:"flex items-center gap-2 text-sm text-text-primary",children:[y.jsx("input",{type:"checkbox",checked:p,onChange:S=>g(S.target.checked)}),y.jsx("span",{children:"Diagnostics — trace every keydown the capture sees (also logged to the console)"})]}),p&&y.jsxs("div",{className:"border border-surface-border rounded",children:[y.jsx("div",{className:"px-2 py-1.5 text-2xs uppercase tracking-wide text-text-tertiary border-b border-surface-border",children:"Keydown trace — scan now, newest last"}),y.jsxs("div",{className:"max-h-64 overflow-y-auto font-mono text-2xs leading-5 px-2 py-1",children:[m.length===0&&y.jsx("div",{className:"text-text-tertiary",children:"Waiting for keys…"}),m.map(S=>y.jsxs("div",{className:"whitespace-nowrap overflow-hidden text-ellipsis",title:`buffer: ${S.buffer}`,children:[y.jsxs("span",{className:"text-text-tertiary",children:[String(S.deltaMs).padStart(4),"ms "]}),y.jsx("span",{className:"text",children:JSON.stringify(S.key)}),S.code&&y.jsxs("span",{className:"text-text-tertiary",children:[" (",S.code,")"]}),y.jsxs("span",{className:"text-text-tertiary",children:[" — ",S.note]})]},S.seq))]}),y.jsxs("div",{className:"px-2 py-1.5 text-2xs text-text-tertiary border-t border-surface-border",children:["Read it like this: a scan should end with an"," ",y.jsx("span",{className:"font-mono",children:'"Enter"'})," row saying"," ",y.jsx("span",{className:"font-mono",children:"capture → …"}),'. An Enter row saying "no code tail" means the buffer split (raise the gap limit, or a key arrived as something other than one character). No Enter row at all means the scanner sends no suffix — program its Enter/CR suffix. Keys named'," ",y.jsx("span",{className:"font-mono",children:'"Unidentified"'})," mean the decode arrives outside the keydown path."]})]})]})]})]})]})}const Ev="lt:bookmarks",qc="scan";function SA(){try{const i=localStorage.getItem(Ev);if(!i)return[];const t=JSON.parse(i);return Array.isArray(t)?t:[]}catch{return[]}}function D1(i){try{localStorage.setItem(Ev,JSON.stringify(i))}catch{}}function EA({onToggleEventFeed:i,onToggleDocs:t,onToggleNav:r}){var de,Oe;const s=go(),{user:l,logout:c}=pn(),{viewAs:m,realIsBuilder:p}=Xb(),{available:g,mine:f}=lO();Kb();const{connected:d}=VE(),{data:b}=Or(),{setPanel:v,closePanel:_,open:w,ownerKey:S}=Yd(),M=uv(),L=mn(),z=()=>{w&&S===qc?_(qc):v(y.jsx(wA,{onClose:()=>_(qc)}),{width:360,key:qc})},[ie,ae]=j.useState(!1),[C,I]=j.useState(!1),[re,K]=j.useState(iv),[B,G]=j.useState(SA),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(()=>(dO(he??[]),mO()),[he]),Te=le=>{pO(le),K(le)},Y=()=>{const le=window.prompt("Bookmark label:");if(!(le!=null&&le.trim()))return;const je=L.pathname+L.search,Se=[...B,{label:le.trim(),url:je}].sort((Ne,be)=>Ne.label.localeCompare(be.label));G(Se),D1(Se),ae(!1)},oe=le=>{const je=B.filter(Se=>!(Se.label===le.label&&Se.url===le.url));G(je),D1(je)};return j.useEffect(()=>{if(!ie)return;const le=je=>{W.current&&!W.current.contains(je.target)&&ae(!1)};return document.addEventListener("mousedown",le),()=>document.removeEventListener("mousedown",le)},[ie]),y.jsxs(y.Fragment,{children:[y.jsxs("header",{className:`h-14 shrink-0 border-b border-surface-border bg-surface-raised flex items-center justify-between pl-2 pr-5 relative ${ie?"z-[100]":"z-30"}`,children:[y.jsxs("div",{className:"flex items-center gap-1 min-w-0",children:[r&&y.jsx("button",{onClick:r,className:"lg:hidden p-2 text-text-secondary hover:text-text-primary transition-colors","aria-label":"Open navigation",children:y.jsx(sw,{className:"w-5 h-5",strokeWidth:1.5})}),y.jsxs(Ii,{to:"/","aria-label":"Home",className:"shrink-0",onClick:le=>{(le.ctrlKey||le.metaKey)&&(le.preventDefault(),I(!0))},children:[y.jsx(nu,{appName:Q,className:"hidden lg:flex"}),y.jsx(nu,{appName:Q,variant:"comet",className:"flex lg:hidden"})]}),y.jsx("div",{className:"hidden lg:block w-px h-4 bg-surface-border mx-1"}),y.jsx("button",{onClick:()=>s(-1),className:"p-2 text-accent/60 hover:text-accent transition-colors","aria-label":"Go back",children:y.jsx(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(Yh,{className:"w-5 h-5",strokeWidth:2})})]}),y.jsxs("div",{className:"flex items-center gap-5",children:[y.jsxs(Ii,{to:"/escalations/available",className:`flex items-center gap-1.5 text-xs transition-colors ${g>0?"text-status-queued":"text-text-quaternary hover:text-text-secondary"}`,title:"All escalations",children:[y.jsx(Xh,{className:"w-4 h-4",strokeWidth:1.5}),y.jsx("span",{className:"hidden lg:inline",children:"all"}),g>0&&y.jsx("sup",{className:"tabular-nums font-medium text-[0.5em]",children:g})]}),y.jsxs(Ii,{to:"/escalations/queue",className:`flex items-center gap-1.5 text-xs transition-colors ${f>0?"text-status-claimed":"text-text-quaternary hover:text-text-secondary"}`,title:"My escalation queue",children:[y.jsx(Xh,{className:"w-4 h-4",strokeWidth:1.5}),y.jsx("span",{className:"hidden lg:inline",children:"mine"}),f>0&&y.jsx("sup",{className:"tabular-nums font-medium text-[0.5em]",children:f})]}),y.jsx("div",{className:"hidden lg:block w-px h-4 bg-surface-border"}),M&&y.jsxs("button",{type:"button",onClick:z,className:"flex items-center gap-1.5 text-xs text-text-quaternary hover:text-text-secondary transition-colors",title:"Scan a code",children:[y.jsx(ou,{className:"w-4 h-4",strokeWidth:1.5}),y.jsx("span",{className:"hidden lg:inline",children:"scan"})]}),y.jsxs("button",{type:"button",onClick:()=>{d?i==null||i():window.location.reload()},className:`hidden lg:flex items-center gap-1.5 text-xs transition-colors ${d?"text-status-success hover:text-status-success/80":"text-text-quaternary hover:text-text-secondary"}`,title:d?"Live events — click to toggle feed":"Events disconnected — click to reconnect",children:[y.jsx(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"]})}),m&&y.jsx(y.Fragment,{children:y.jsxs("span",{className:"hidden lg:flex items-center gap-1 pl-2 pr-1 py-0.5 rounded-full bg-accent/10 border border-accent/25 text-2xs text-accent select-none",children:[y.jsxs("span",{className:"capitalize font-medium tracking-wide",children:[m," View"]}),y.jsx("button",{onClick:bd,title:"Restore your real view",className:"ml-0.5 rounded-full p-0.5 hover:bg-accent/20 transition-colors",children:y.jsx(Cn,{className:"w-2.5 h-2.5"})})]})}),y.jsx("div",{className:"hidden lg:block w-px h-4 bg-surface-border"}),l&&y.jsxs("div",{className:"relative",ref:W,children:[y.jsxs("button",{onClick:()=>ae(le=>!le),className:"btn-ghost flex items-center gap-1",children:[y.jsxs("span",{className:"relative",children:[y.jsx(aw,{className:"w-4 h-4 text-accent/75",strokeWidth:1.5}),m&&y.jsx("span",{className:"lg:hidden absolute -top-0.5 -right-0.5 w-2 h-2 rounded-full bg-accent"})]}),y.jsx("span",{className:"hidden lg:inline whitespace-nowrap",children:l.displayName||l.username||l.userId}),y.jsx("svg",{className:"hidden lg:block w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),ie&&y.jsxs("div",{className:"absolute right-0 top-full mt-1 w-52 bg-surface-raised border border-surface-border rounded-md shadow-lg py-1 z-[100]",children:[y.jsx(Ii,{to:"/credentials",onClick:()=>ae(!1),className:"block px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Credentials"}),y.jsx("button",{onClick:()=>{ae(!1),d?i==null||i():window.location.reload()},className:"lg:hidden block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:d?"Events":"Reconnect events"}),p&&y.jsx("button",{onClick:()=>{ae(!1),t==null||t()},className:"lg:hidden block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Docs"}),m&&y.jsxs("button",{onClick:()=>{ae(!1),bd()},className:"lg:hidden block w-full text-left px-3 py-2 text-xs text-accent hover:bg-surface-hover capitalize",children:["Exit ",m," view"]}),y.jsxs("div",{className:"px-3 py-2 border-t border-surface-border/60",children:[y.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-1.5",children:"Theme"}),y.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:_e.map(le=>y.jsx("button",{type:"button",onClick:()=>Te(le.id),title:le.label,"aria-label":`${le.label} theme`,className:`w-4 h-4 rounded-full transition-transform hover:scale-110 ${re===le.id?"ring-2 ring-offset-1 ring-surface-border":""}`,style:{backgroundColor:le.swatch}},le.id))})]}),y.jsx("button",{onClick:()=>{ae(!1),c()},className:"block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Sign Out"}),y.jsxs("div",{className:"border-t border-surface-border/60 pt-1",children:[B.map(le=>y.jsxs("div",{className:"flex items-center group px-3 py-1.5 hover:bg-surface-hover",children:[y.jsx(Ii,{to:le.url,onClick:()=>ae(!1),title:le.url,className:"flex-1 min-w-0 text-xs text-text-secondary hover:text-text-primary truncate",children:le.label}),y.jsx("button",{type:"button",onClick:()=>oe(le),title:`Remove "${le.label}"`,className:"opacity-0 group-hover:opacity-100 transition-opacity ml-1 p-0.5 shrink-0 text-text-quaternary hover:text-status-error",children:y.jsx(Cn,{className:"w-3 h-3"})})]},`${le.label}::${le.url}`)),y.jsx("hr",{className:"border-surface-border/60 mx-3 my-0.5"}),y.jsxs("button",{type:"button",onClick:Y,className:"flex items-center gap-1.5 w-full px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:[y.jsx(ow,{className:"w-3.5 h-3.5 shrink-0",strokeWidth:1.5}),"Add Bookmark"]})]})]})]})]})]}),C&&y.jsx(hO,{onClose:()=>I(!1)})]})}function Xd({open:i,children:t}){const[r,s]=j.useState(i);return j.useEffect(()=>{i&&s(!0)},[i]),y.jsx("div",{className:`grid transition-[grid-template-rows] duration-300 ease-out ${i?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,onTransitionEnd:()=>{i||s(!1)},children:y.jsx("div",{className:"overflow-hidden",children:r?t:null})})}function _d(i){return({isActive:t})=>{const r="flex items-center rounded-md transition-colors duration-150",s="bg-surface-hover text-text-primary font-medium",l="text-text-secondary hover:text-text-primary hover:bg-surface-hover";return i?`${r} justify-center w-10 h-10 mx-auto ${t?s:l}`:`${r} gap-3 px-4 py-2 text-sm ${t?s:l}`}}function OA(){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 AA({group:i,collapsed:t}){const{pathname:r}=mn(),s=i.matchPaths.some(p=>r.startsWith(p)),[l,c]=j.useState(s),m=l||s;return t?y.jsx(y.Fragment,{children:i.items.map(p=>y.jsx(Hs,{to:p.to,className:_d(!0),title:p.label,children:p.icon&&y.jsx(p.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})},p.to))}):y.jsxs("div",{children:[y.jsxs("button",{onClick:()=>c(p=>!p),className:"w-full flex items-center justify-between px-4 py-2 text-sm rounded-md transition-colors duration-150 text-text-secondary hover:text-text-primary hover:bg-surface-hover",children:[y.jsxs("span",{className:"flex items-center gap-3",children:[i.icon&&y.jsx(i.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),y.jsx("span",{children:i.label})]}),y.jsx("svg",{className:`w-3.5 h-3.5 text-text-tertiary transition-transform duration-150 ${m?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),y.jsx(Xd,{open:m,children:i.items.map(p=>y.jsxs(Hs,{to:p.to,end:p.end,className:OA(),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 jA(i){return i.kind==="group"}function TA({entry:i,collapsed:t}){const{pathname:r,search:s}=mn(),l=i.to.includes("?"),c=i.icon&&y.jsx(i.icon,{className:`w-5 h-5 shrink-0 text-accent/75 ${i.iconClassName??""}`,strokeWidth:1.5,...i.solid?{fill:"currentColor"}:{}});if(l){const[m,p]=i.to.split("?"),g=r===m&&s===`?${p}`,f=_d(t)({isActive:g});return y.jsxs(Hs,{to:i.to,className:f,title:t?i.label:void 0,children:[c,!t&&y.jsx("span",{children:i.label})]})}return y.jsxs(Hs,{to:i.to,end:i.end,className:_d(t),title:t?i.label:void 0,children:[c,!t&&y.jsx("span",{children:i.label})]})}function ui({heading:i,entries:t}){const{collapsed:r}=Fd();return y.jsxs("div",{className:"space-y-1",children:[r?y.jsx("div",{className:"h-px bg-surface-border mx-3 my-2",title:i}):y.jsx("p",{className:"px-4 pt-5 pb-2 text-xs font-semibold uppercase tracking-wider text-text-tertiary",children:i}),t.map(s=>jA(s)?y.jsx(AA,{group:s,collapsed:r},s.label):y.jsx(TA,{entry:s,collapsed:r},s.to))]})}function NA({aiEnabled:i=!1,isBuilder:t=!1,isOps:r=!1,viewAs:s=null,canSeePaceBoard:l=!1}){const c={to:"/operations",label:"Pace Board",icon:lw};if(!t&&(!r||s==="engineer"||s==="operator"))return l?y.jsx(ui,{heading:"Monitor",entries:[c]}):null;if(!t)return y.jsx(ui,{heading:"Monitor",entries:l?[c]:[]});const m=[...l?[c]:[],{to:"/topics",label:"Event Topics",icon:ab},{to:"/agents",label:i?"Agents":"Automations",icon:cw},{to:"/capabilities",label:"Capabilities",icon:uw}];return y.jsx(ui,{heading:"Monitor",entries:m})}function L3(){return pt({queryKey:["roles"],queryFn:()=>Ae("/roles")})}function kA(i){return pt({queryKey:["roles","details"],queryFn:()=>Ae("/roles/details"),enabled:(i==null?void 0:i.enabled)??!0})}function z3(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 U3(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 I3(i){return pt({queryKey:["roles",i,"list-schema-versions"],queryFn:()=>Ae(`/roles/${encodeURIComponent(i)}/list-schema/versions`),enabled:!!i})}function $3(){const i=gt();return Et({mutationFn:t=>Ae("/roles",{method:"POST",body:JSON.stringify({role:t})}),onSuccess:()=>{i.invalidateQueries({queryKey:["roles"]})}})}function H3(){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 G3(){const i=gt();return Et({mutationFn:t=>Ae(`/roles/${encodeURIComponent(t)}`,{method:"DELETE"}),onSuccess:()=>{i.invalidateQueries({queryKey:["roles"]})}})}function CA(){return pt({queryKey:["me","preferences"],queryFn:()=>Ae("/me/preferences"),staleTime:6e4})}function MA(){const i=gt();return Et({mutationFn:t=>Ae("/me/preferences",{method:"PATCH",body:JSON.stringify(t)}),onSuccess:t=>{i.setQueryData(["me","preferences"],t)}})}function RA(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 DA(i){var t;return((t=i.title)==null?void 0:t.trim())||RA(i.role)}function qA(i,t){const r=(i==null?void 0:i.pinnedViews)??[],s=new Set((i==null?void 0:i.hiddenRolePins)??[]),l=new Set(r.map(p=>p.label)),c=[...r],m=new Set;for(const{role:p,pins:g}of t)for(const f of g)l.has(f.label)||s.has(f.label)||m.has(f.label)||(m.add(f.label),c.push({...f,id:`role:${p}:${f.label}`,fromRole:p}));return c}function BA(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=AO(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 LA(){return`pin-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function zA(){var C;const{collapsed:i}=Fd(),{user:t}=pn(),r=CA(),s=MA(),l=j.useMemo(()=>new Set(((t==null?void 0:t.roles)??[]).map(I=>I.role)),[t]),{data:c}=kA({enabled:l.size>0}),m=gt();Rd(Hd(),()=>{m.invalidateQueries({queryKey:["escalations"]})});const p=(C=r.data)==null?void 0:C.preferences,g=j.useMemo(()=>((c==null?void 0:c.roles)??[]).filter(I=>l.has(I.role)&&Array.isArray(I.default_pins)&&I.default_pins.length>0).map(I=>({role:I.role,pins:I.default_pins})),[c,l]),f=j.useMemo(()=>qA(p,g),[p,g]),d=j.useMemo(()=>new Map(((c==null?void 0:c.roles)??[]).map(I=>[I.role,DA(I)])),[c]),b=j.useMemo(()=>f.filter(I=>!I.fromRole),[f]),v=j.useMemo(()=>g.map(({role:I})=>({role:I,title:d.get(I)??I,pins:f.filter(re=>re.fromRole===I)})).filter(I=>I.pins.length>0),[g,d,f]),_=(p==null?void 0:p.pinnedViews)??[],w=j.useRef(null),S=I=>s.mutate({pinnedViews:I}),M=I=>S(_.filter(re=>re.id!==I)),L=I=>S([..._,{id:LA(),label:I.label,url:I.url,badge:I.badge}]),z=I=>s.mutate({hiddenRolePins:[...(p==null?void 0:p.hiddenRolePins)??[],I]}),ie=(I,re)=>{if(I===re)return;const K=[..._],[B]=K.splice(I,1);K.splice(re,0,B),S(K)};if(f.length===0)return null;const ae="px-4 pt-5 pb-2 text-xs font-semibold uppercase tracking-wider text-text-tertiary truncate";return y.jsxs("div",{className:"space-y-1",children:[i&&y.jsx("div",{className:"h-px bg-surface-border mx-3 my-2",title:"Pinned"}),!i&&b.length>0&&y.jsx("p",{className:ae,children:"Pinned"}),b.map(I=>{const re=_.findIndex(K=>K.id===I.id);return y.jsx(q1,{pin:I,collapsed:i,draggable:re!==-1,onDragStart:()=>{w.current=re},onDropOn:()=>{w.current!==null&&re!==-1&&ie(w.current,re),w.current=null},onRemove:()=>M(I.id)},I.id)}),v.map(I=>y.jsxs("div",{children:[!i&&y.jsx("p",{className:ae,title:`${I.title} — pins from the ${I.role} role`,"data-testid":"pin-group-label",children:I.title}),I.pins.map(re=>y.jsx(q1,{pin:re,collapsed:i,draggable:!1,onDragStart:()=>{},onDropOn:()=>{},onPromote:()=>L(re),onHide:()=>z(re.label)},re.id))]},I.role))]})}function q1({pin:i,collapsed:t,draggable:r,onDragStart:s,onDropOn:l,onRemove:c,onPromote:m,onHide:p}){const{pathname:g,search:f}=mn(),[d,b=""]=i.url.split("?"),v=g===d&&f===(b?`?${b}`:""),_="group flex items-center rounded-md transition-colors duration-150",w=v?"bg-surface-hover text-text-primary font-medium":"text-text-secondary hover:text-text-primary hover:bg-surface-hover";return t?y.jsx(Hs,{to:i.url,className:`${_} ${w} justify-center w-10 h-10 mx-auto`,title:i.label,children:y.jsx(zg,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})}):y.jsxs("div",{className:`${_} ${w} relative`,draggable:r,onDragStart:s,onDragOver:S=>S.preventDefault(),onDrop:l,children:[y.jsxs(Hs,{to:i.url,title:i.label,className:"flex items-center gap-2.5 pl-4 pr-3 py-1.5 text-[0.7875rem] flex-1 min-w-0",children:[y.jsx(zg,{className:"w-4 h-4 shrink-0 text-accent/75",strokeWidth:1.5,...i.fromRole?{}:{fill:"currentColor",fillOpacity:.15}}),y.jsx("span",{className:"truncate flex-1 min-w-0",children:i.label}),i.badge&&y.jsx(UA,{url:i.url})]}),y.jsxs("span",{className:"absolute right-1 top-1/2 -translate-y-1/2 flex items-center gap-0.5 rounded px-0.5 bg-surface-hover opacity-0 pointer-events-none group-hover:opacity-100 group-hover:pointer-events-auto transition-opacity",children:[m&&y.jsx("button",{onClick:m,title:"Make mine — copy into my pins",className:"p-1 text-text-quaternary hover:text-accent transition-colors",children:y.jsx(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(fw,{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 UA({url:i}){var m;const t=j.useMemo(()=>BA(i),[i]),r={limit:1,staleTime:15e3},s=ev({...(t==null?void 0:t.params)??{},...r,enabled:!!t&&t.available}),l=Wb({...(t==null?void 0:t.params)??{},...r,enabled:!!t&&!t.available});if(!t)return null;const c=t.available?s:l;return c.isError||((m=c.data)==null?void 0:m.total)===void 0?null:y.jsx("span",{className:"shrink-0 text-right text-2xs leading-none tabular-nums text-accent/80 relative -top-[0.35em]",title:`${c.data.total} matching now`,children:c.data.total})}function PA(){var c;const{data:i}=Or(),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:hw,matchPaths:["/workflows/registry","/workflows/durable/invoke","/workflows/executions","/workflows/durable/executions","/workflows/start","/workflows/workers","/workflows/tasks"],items:s},{kind:"group",label:"Graph",icon:wd,matchPaths:["/mcp/workflows","/mcp/executions"],items:[{to:"/mcp/workflows",label:"Configure",icon:Ug,end:!0},{to:"/mcp/workflows/invoke",label:"Invoke",icon:Pg},{to:"/mcp/executions",label:"Executions",icon:Ig}]}]:s;return y.jsx(ui,{heading:"Orchestrate",entries:l})}const IA=[{to:"/mcp/queries",label:"Designer",icon:dw},{to:"/mcp/servers",label:"Servers & Tools",icon:mw}];function $A(){return y.jsx(ui,{heading:"Design",entries:IA})}const HA=[{to:"/files",label:"Files",icon:pw},{to:"/knowledge",label:"Knowledge",icon:gw}];function GA(){return y.jsx(ui,{heading:"Storage",entries:HA})}function FA({isBuilder:i=!1,isOps:t=!1}){var m;const{data:r}=Or(),s=((m=r==null?void 0:r.features)==null?void 0:m.dbMaintenance)!==!1,l=[{to:"/admin/users",label:"Accounts",icon:yw},...i||t?[{to:"/admin/roles",label:"Roles",icon:Xh},{to:"/admin/personas",label:"Personas",icon:bw},{to:"/admin/scan-codes",label:"Scan Codes",icon:ou}]:[]],c=[{to:"/admin/controlplane",label:"Routers",icon:vw},{to:"/admin/streams",label:"Messages",icon:xw},...s?[{to:"/admin/maintenance",label:"DB Maintenance",icon:_w}]:[]];return y.jsxs(y.Fragment,{children:[y.jsx(ui,{heading:"Identity & Access",entries:l}),i&&y.jsx(ui,{heading:"Infrastructure",entries:c})]})}function Ov({aiEnabled:i,isBuilder:t,isOps:r,viewAs:s,canSeePaceBoard:l}){return y.jsxs(y.Fragment,{children:[y.jsx(NA,{aiEnabled:i,isBuilder:t,isOps:r,viewAs:s,canSeePaceBoard:l}),y.jsx(zA,{}),t&&y.jsx(PA,{}),t&&i&&y.jsx($A,{}),t&&y.jsx(GA,{}),(t||r)&&y.jsx(FA,{isBuilder:t,isOps:r})]})}function VA({open:i,onClose:t,...r}){const s=mn();return j.useEffect(()=>{t()},[s.pathname]),y.jsxs("div",{className:`lg:hidden fixed inset-y-0 left-0 z-40 flex ${i?"":"pointer-events-none"}`,children:[y.jsx("div",{className:`fixed inset-0 bg-black/20 transition-opacity duration-200 ${i?"opacity-100":"opacity-0"}`,onClick:t,"aria-hidden":!0}),y.jsxs("div",{className:`relative w-72 max-w-[85vw] h-full bg-surface-raised border-r border-surface-border shadow-xl flex flex-col transition-transform duration-200 ease-out ${i?"translate-x-0":"-translate-x-full"}`,children:[y.jsx("div",{className:"flex items-center justify-end px-3 pt-3 shrink-0",children:y.jsx("button",{onClick:t,className:"p-1.5 rounded text-text-tertiary hover:text-text-primary hover:bg-surface-hover transition-colors","aria-label":"Close navigation",children:y.jsx(Cn,{className:"w-4 h-4"})})}),y.jsx("nav",{className:"flex-1 px-3 pb-4 space-y-2 overflow-y-auto overflow-x-hidden",children:y.jsx(sO,{children:y.jsx(Ov,{...r})})})]})]})}const Av="lt_event_feed_patterns";function YA(i,t){if(i.startsWith("/topics/")){const m=decodeURIComponent(i.replace("/topics/",""));if(m&&!m.includes("/"))return`lt.events.${m}`}const r=i.match(/^\/escalations\/detail\/(.+)/);if(r)return`lt.events.system.escalation.*.${r[1]}.>`;if(i.startsWith("/escalations")){const m=new URLSearchParams(t).get("role");return m?`lt.events.system.escalation.${Jb(m)}.>`:"lt.events.system.escalation.>"}const s=i.match(/^\/workflows\/(?:durable\/)?executions\/(.+)/);if(s)return`lt.events.system.workflow.${s[1]}.>`;if(i.startsWith("/workflows"))return"lt.events.system.workflow.>";const l=i.match(/^\/agents\/([^/]+)$/);if(l&&l[1]!=="new")return`lt.events.system.agent.${l[1]}.>`;if(i.startsWith("/agents"))return"lt.events.system.agent.>";if(i.startsWith("/knowledge"))return"lt.events.system.knowledge.>";if(i.startsWith("/files"))return"lt.events.system.file.>";if(i==="/")return"lt.events.system.>";const c=i.match(/^\/mcp\/executions\/(.+)/);return c?`lt.events.system.*.${c[1]}.>`:(i.startsWith("/mcp"),"lt.events.system.>")}function XA(){try{const i=localStorage.getItem(Av);return i?JSON.parse(i):[]}catch{return[]}}function Gh(i){try{localStorage.setItem(Av,JSON.stringify(i))}catch{}}function KA(){const{pathname:i,search:t}=mn(),[r,s]=j.useState(XA),l=j.useMemo(()=>YA(i,t),[i,t]),c=j.useMemo(()=>{const f=new Set([l,...r]);return Array.from(f)},[l,r]),m=j.useCallback(f=>{const d=f.startsWith("lt.events.")?f:`lt.events.${f}`;s(b=>{if(b.includes(d))return b;const v=[...b,d];return Gh(v),v})},[]),p=j.useCallback(f=>{s(d=>{const b=d.filter(v=>v!==f);return Gh(b),b})},[]),g=j.useCallback(()=>{s([]),Gh([])},[]);return{patterns:c,pagePattern:l,userPatterns:r,addPattern:m,removePattern:p,clearUserPatterns:g}}function JA({children:i,className:t=""}){return y.jsx("p",{className:`text-2xs font-semibold uppercase tracking-widest text-text-tertiary ${t}`,children:i})}const Fh=280,B1="cubic-bezier(0.4, 0, 0.2, 1)",Bc=40;function QA(i){if(!i)return"scale(0.92)";const t=window.innerWidth,r=window.innerHeight,s=t-Bc*2,l=r-Bc*2,c=i.width/s,m=i.height/l,p=i.left+i.width/2-(Bc+s/2),g=i.top+i.height/2-(Bc+l/2);return`translate(${p}px, ${g}px) scale(${c}, ${m})`}function jv({open:i,onClose:t,sourceRef:r,children:s}){const[l,c]=j.useState(null),m=j.useRef(null),p=j.useRef(!1);j.useEffect(()=>{var v,_;i&&!p.current?(m.current=((v=r==null?void 0:r.current)==null?void 0:v.getBoundingClientRect())??null,c("entering")):!i&&p.current&&l==="open"&&(m.current=((_=r==null?void 0:r.current)==null?void 0:_.getBoundingClientRect())??null,c("exiting")),p.current=i},[i,r,l]),j.useEffect(()=>{if(l!=="entering")return;const v=requestAnimationFrame(()=>{requestAnimationFrame(()=>c("open"))});return()=>cancelAnimationFrame(v)},[l]),j.useEffect(()=>{if(l)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[l]),j.useEffect(()=>{if(!l)return;const v=_=>{_.key==="Escape"&&t()};return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[l,t]);const g=j.useCallback(v=>{v.propertyName==="transform"&&l==="exiting"&&c(null)},[l]);if(j.useEffect(()=>{if(l!=="exiting")return;const v=setTimeout(()=>c(null),Fh+50);return()=>clearTimeout(v)},[l]),!l)return null;const f=l==="entering"||l==="exiting",d=f?QA(m.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 ${Fh}ms ${B1}, opacity ${Fh}ms ${B1}`,transform:d,opacity:b,backgroundColor:"rgb(var(--lt-surface))"},onTransitionEnd:g,children:s}),document.body)}function ZA({className:i}){return y.jsx("svg",{className:i,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M4 12h8M4 18h12"})})}function WA({className:i}){return y.jsx("svg",{className:i,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 7l-5 5 5 5M16 7l5 5-5 5"})})}function ej({className:i}){return y.jsx("svg",{className:i,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"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 tj({className:i}){return y.jsx("svg",{className:i,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}function nj({className:i}){return y.jsx("svg",{className:i,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"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 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 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5v-4m0 4h-4m4 0l-5-5"})})}function ij(i){const t=i.trim().split(`
56
- `);if(t.length<2)return i;const r=p=>p.split("|").map(g=>g.trim()).filter(Boolean),s=r(t[0]),l=t.slice(2),c=s.map(p=>`<th class="px-3 py-1.5 text-left text-2xs font-semibold uppercase tracking-wider text-text-tertiary">${p}</th>`).join(""),m=l.map(p=>`<tr class="border-t border-surface-border">${r(p).map(d=>`<td class="px-3 py-1.5 text-xs text-text-secondary">${d}</td>`).join("")}</tr>`).join("");return`<table class="w-full my-3 text-xs"><thead><tr class="border-b border-surface-border">${c}</tr></thead><tbody>${m}</tbody></table>`}function Lc(i){return i.toLowerCase().replace(/<[^>]+>/g,"").replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").trim()}function sj(i){const t=[];let r=i.replace(/```(\w*)\n([\s\S]*?)```/g,(g,f,d)=>{const b=t.length;return t.push(`<pre class="bg-surface-sunken rounded p-3 my-2 overflow-x-auto text-2xs leading-relaxed"><code>${d}</code></pre>`),`\0CODE${b}\0`});const s=/^(\|.+\|)\n(\|[-| :]+\|)\n((?:\|.+\|\n?)+)/gm;r=r.replace(s,(g,f,d,b)=>ij(`${f}
57
- ${d}
58
- ${b.trimEnd()}`)),r=r.replace(/`([^`]+)`/g,'<code class="bg-surface-sunken px-1 py-0.5 rounded text-2xs">$1</code>'),r=r.replace(/^#### (.+)$/gm,(g,f)=>`<h4 id="${Lc(f)}" class="text-xs font-semibold text-text-primary mt-4 mb-1">${f}</h4>`).replace(/^### (.+)$/gm,(g,f)=>`<h3 id="${Lc(f)}" class="text-sm font-semibold text-text-primary mt-5 mb-1.5">${f}</h3>`).replace(/^## (.+)$/gm,(g,f)=>`<h2 id="${Lc(f)}" class="text-base font-semibold text-text-primary mt-6 mb-2 pb-1 border-b border-surface-border">${f}</h2>`).replace(/^# (.+)$/gm,(g,f)=>`<h1 id="${Lc(f)}" class="text-lg font-bold text-text-primary mb-3">${f}</h1>`),r=r.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/\[([^\]]+)\]\(#([^)]+)\)/g,'<a data-anchor="$2" class="text-accent hover:underline cursor-pointer">$1</a>').replace(/\[([^\]]+)\]\(([^)]*\.md(?:#[^)]*)?)\)/g,'<a data-doc-link="$2" class="text-accent hover:underline cursor-pointer">$1</a>').replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" class="text-accent hover:underline">$1</a>').replace(/^ - (.+)$/gm,'<li class="ml-8 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^ - (.+)$/gm,'<li class="ml-8 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^- (.+)$/gm,'<li class="ml-4 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^\d+\. (.+)$/gm,'<li class="ml-4 list-decimal text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^---+$/gm,'<hr class="border-surface-border my-4" />').replace(/(?:^> (.+)$\n?)+/gm,g=>{const f=g.replace(/^> /gm,"").trim(),d=/⚠️|warning|caution/i.test(f),b=/note:|ℹ️|info/i.test(f);return`<div class="${d?"bg-status-warning/5":b?"bg-accent/5":"bg-surface-sunken/50"} ${d?"border-status-warning":b?"border-accent":"border-text-tertiary"} border-l-2 rounded-r-md px-3 py-2 my-3 text-xs text-text-secondary leading-relaxed">${f}</div>`}).replace(/\n\n/g,"\0PARA\0").replace(/\n/g,"<br/>");const l=g=>g.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),c=g=>new RegExp(`(${l(g)}[\\s\\S]*?<\\/li>(?:<br\\/>)?)+`,"g");r=r.replace(c('<li class="ml-8 list-disc'),g=>`<ul class="mb-3">${g}</ul>`),r=r.replace(c('<li class="ml-4 list-disc'),g=>`<ul class="mb-3">${g}</ul>`),r=r.replace(c('<li class="ml-4 list-decimal'),g=>`<ol class="list-decimal mb-3">${g}</ol>`),r=r.replace(/\x00CODE(\d+)\x00/g,(g,f)=>t[parseInt(f,10)]);const m="text-xs leading-relaxed text-text-secondary mb-2",p=/<\/(h[1-4]|pre|table|ul|ol|hr|div)>/;return r=r.split("\0PARA\0").map(g=>{const f=g.trim();if(!f)return"";const d=[];let b=f,v;for(;(v=p.exec(b))!==null;){const _=v.index+v[0].length;d.push(b.slice(0,_)),b=b.slice(_).replace(/^<br\/>/,"").trim(),p.lastIndex=0}return b&&d.push(b),d.map(_=>{const w=_.trim();return w?/^\s*<(h[1-4]|pre|table|ul|ol|hr|div)/.test(w)?w:`<p class="${m}">${w}</p>`:""}).join("")}).join(""),r}const aj=/(\*\*|^#{1,4}\s|^- |^\d+\.\s|```|^\|.*\|$|\[.+\]\(.+\))/m;function oj(i){return aj.test(i)}function Kd({content:i,className:t,onClick:r}){const s=j.useMemo(()=>sj(i),[i]);return y.jsx("div",{className:t,onClick:r,dangerouslySetInnerHTML:{__html:s}})}function iu({data:i,depth:t=0,generation:r}){const l=r!==void 0&&r>0&&r%2===1?!1:t>0,[c,m]=j.useState(l),[p,g]=j.useState(r);if(r!==void 0&&r!==p&&(g(r),m(r%2===0&&t>0)),i==null)return y.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof i=="string")return y.jsxs("span",{className:"text-text-primary",children:['"',i,'"']});if(typeof i=="number"||typeof i=="boolean")return y.jsx("span",{className:"text-text-primary font-medium",children:String(i)});if(Array.isArray(i))return i.length===0?y.jsx("span",{className:"text-text-tertiary",children:"[]"}):c?y.jsxs("button",{onClick:()=>m(!1),className:"text-text-secondary hover:text-text-primary",children:["[",i.length," items]"]}):y.jsxs("span",{children:[y.jsx("button",{onClick:()=>m(!0),className:"text-text-tertiary hover:text-text-primary",children:"["}),y.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:i.map((f,d)=>y.jsxs("div",{children:[y.jsx(iu,{data:f,depth:t+1,generation:r}),d<i.length-1&&y.jsx("span",{className:"text-text-tertiary",children:","})]},d))}),y.jsx("span",{className:"text-text-tertiary",children:"]"})]});if(typeof i=="object"){const f=Object.entries(i);return f.length===0?y.jsx("span",{className:"text-text-tertiary",children:"{}"}):c?y.jsxs("button",{onClick:()=>m(!1),className:"text-text-secondary hover:text-text-primary",children:["{","...","}"]}):y.jsxs("span",{children:[y.jsx("button",{onClick:()=>m(!0),className:"text-text-tertiary hover:text-text-primary",children:"{"}),y.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:f.map(([d,b],v)=>y.jsxs("div",{children:[y.jsx("span",{className:"text-text-secondary",children:d}),y.jsx("span",{className:"text-text-tertiary",children:": "}),y.jsx(iu,{data:b,depth:t+1,generation:r}),v<f.length-1&&y.jsx("span",{className:"text-text-tertiary",children:","})]},d))}),y.jsx("span",{className:"text-text-tertiary",children:"}"})]})}return y.jsx("span",{children:String(i)})}function co({data:i,depth:t=0}){if(i==null)return y.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof i=="string")return i.length>40&&oj(i)?y.jsx(Kd,{content:i}):y.jsx("span",{className:"text-text-primary",children:i});if(typeof i=="number"||typeof i=="boolean")return y.jsx("span",{className:"text-text-primary font-medium",children:String(i)});if(Array.isArray(i))return i.length===0?y.jsx("span",{className:"text-text-tertiary italic",children:"empty list"}):y.jsx("div",{className:"space-y-2",children:i.map((r,s)=>y.jsxs("div",{className:"flex items-baseline gap-2",children:[y.jsxs("span",{className:"text-text-tertiary text-2xs shrink-0",children:[s+1,"."]}),y.jsx("div",{className:"flex-1",children:y.jsx(co,{data:r,depth:t+1})})]},s))});if(typeof i=="object"){const r=Object.entries(i);return r.length===0?y.jsx("span",{className:"text-text-tertiary italic",children:"empty"}):y.jsx("div",{className:t>0?"pl-4 border-l border-surface-border space-y-3":"space-y-3",children:r.map(([s,l])=>{const c=l===null||typeof l!="object";return y.jsxs("div",{children:[y.jsx("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-0.5",children:s.replace(/[_-]/g," ")}),c?y.jsx("p",{className:"text-sm text-text-primary",children:y.jsx(co,{data:l,depth:t+1})}):y.jsx(co,{data:l,depth:t+1})]},s)})})}return y.jsx("span",{children:String(i)})}function L1({mode:i,setMode:t,isCollapsed:r,onToggleCollapse:s,onCopy:l,copied:c,onFullscreen:m,onClose:p,large:g}){const f=g?"w-5 h-5":"w-3.5 h-3.5",d=`${g?"p-2":"p-1.5"} rounded text-accent/60 hover:text-accent hover:bg-surface-raised transition-colors duration-150`;return y.jsxs("div",{className:"flex items-center gap-0.5 bg-surface-sunken/80 rounded-md backdrop-blur-sm",children:[i==="json"&&y.jsx("button",{onClick:s,className:d,title:r?"Expand all":"Collapse all",children:r?y.jsx(rj,{className:f}):y.jsx(nj,{className:f})}),y.jsx("button",{onClick:()=>t(i==="json"?"tree":"json"),className:d,title:i==="json"?"Outline view":"JSON view",children:i==="json"?y.jsx(ZA,{className:f}):y.jsx(WA,{className:f})}),y.jsx("button",{onClick:l,className:d,title:"Copy to clipboard",children:c?y.jsx(tj,{className:`${f} text-status-success`}):y.jsx(ej,{className:f})}),m&&y.jsx("button",{onClick:m,className:d,title:"Fullscreen",children:y.jsx(cb,{className:f})}),p&&y.jsx("button",{onClick:p,className:d,title:"Close (Esc)",children:y.jsx(ub,{className:f})})]})}function lj({data:i,label:t,variant:r,defaultCollapsed:s=!1,defaultMode:l}){const c=j.useRef(null),[m,p]=j.useState(l??"json"),[g,f]=j.useState(!1),[d,b]=j.useState(!1),[v,_]=j.useState(s?0:1),[w,S]=j.useState(1),M=v%2===0,L=w%2===0,z=j.useCallback(()=>_(G=>G+1),[]),ie=j.useCallback(()=>S(G=>G+1),[]);let ae=i;if(typeof i=="string")try{ae=JSON.parse(i)}catch{}const C=async()=>{const G=typeof i=="string"?i:JSON.stringify(ae,null,2);await navigator.clipboard.writeText(G),f(!0),setTimeout(()=>f(!1),2e3)},I=j.useCallback(()=>{S(1),b(!0)},[]),re=r==="panel",K=re?"border border-accent-muted/40 rounded-lg p-3 bg-surface-hover/30":"",B=re?"font-mono text-xs leading-relaxed bg-surface-raised rounded-md p-4 overflow-x-auto break-all":"font-mono text-xs leading-relaxed bg-surface-sunken border border-surface-border rounded-md p-4 overflow-x-auto break-all";return y.jsxs("div",{className:K,children:[t&&y.jsx(JA,{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:m,setMode:p,isCollapsed:M,onToggleCollapse:z,onCopy:C,copied:g,onFullscreen:I})}),y.jsx("div",{className:B,children:m==="json"?y.jsx(iu,{data:ae,generation:v}):y.jsx(co,{data:ae})})]}),y.jsxs(jv,{open:d,onClose:()=>b(!1),sourceRef:c,children:[y.jsx("div",{className:"sticky top-0 float-right z-10",children:y.jsx(L1,{mode:m,setMode:p,isCollapsed:L,onToggleCollapse:ie,onCopy:C,copied:g,onClose:()=>b(!1),large:!0})}),y.jsx("div",{className:"font-mono text-sm leading-relaxed",children:m==="json"?y.jsx(iu,{data:ae,generation:w}):y.jsx(co,{data:ae})})]})]})}const cj=100,z1=500;let uj=0;const Tv={"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 Nv(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=Tv[Nv(i.type)]||"text-text-tertiary";j.useEffect(()=>{s(t)},[t]);const c=t,m=c?"text-xs":"text-2xs",p=c?"text-xs":"text-2xs",g=c?"text-xs":"text-2xs",f=c?"w-3.5 h-3.5":"w-2.5 h-2.5",d=c?"py-2 px-4":"py-1 px-3",b=c?"pb-4 px-4":"pb-2 px-3";return y.jsxs("div",{className:"border-b border-surface-border/30 last:border-b-0",children:[y.jsxs("button",{onClick:()=>s(!r),className:`flex items-center gap-2 ${d} w-full text-left hover:bg-surface-hover/50 transition-colors`,children:[y.jsx("span",{className:`${m} font-mono text-text-tertiary whitespace-nowrap tabular-nums shrink-0`,children:new Date(i.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}),y.jsx("span",{className:`${p} font-medium px-1 py-0.5 rounded ${l} bg-surface-sunken whitespace-nowrap shrink-0`,children:i.type}),y.jsxs("span",{className:`${g} text-text-tertiary font-mono flex-1 min-w-0 truncate`,children:[(v=i.data)!=null&&v.workflowId?String(i.data.workflowId):"",(_=i.data)!=null&&_.escalationId?` esc:${String(i.data.escalationId).slice(0,12)}`:""]}),y.jsx("svg",{className:`${f} text-text-tertiary shrink-0 transition-transform duration-150 ${r?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),y.jsx(Xd,{open:r,children:y.jsx("div",{className:b,children:y.jsx(lj,{data:i.data})})})]})}function fj({open:i,onToggle:t,configOpen:r,onToggleConfig:s}){const[l,c]=j.useState([]),[m,p]=j.useState(!1),[g,f]=j.useState(""),d=j.useRef(null),b=j.useRef(new Map),{subscribe:v}=j.useContext(Xs),{patterns:_,pagePattern:w,userPatterns:S,addPattern:M,removePattern:L}=KA(),z=j.useCallback(C=>{const I=String(C.type||"unknown");if(I.startsWith("mesh."))return;const re=`${I}:${C.timestamp||""}:${C.escalationId||C.workflowId||C.taskId||""}`,K=Date.now(),B=b.current.get(re);if(!(B&&K-B<z1)){if(b.current.set(re,K),b.current.size>200)for(const[G,W]of b.current)K-W>z1*2&&b.current.delete(G);c(G=>[{id:++uj,type:I,timestamp:C.timestamp||new Date().toISOString(),data:C},...G].slice(0,cj))}},[]),ie=j.useRef(z);ie.current=z;const ae=i||m||r;return j.useEffect(()=>{if(!ae)return;const C=_.map(I=>v(I,re=>ie.current(re)));return()=>C.forEach(I=>I())},[v,_.join(","),ae]),j.useEffect(()=>{i&&d.current&&(d.current.scrollTop=0)},[l.length,i]),y.jsxs("div",{className:"shrink-0 border-t border-surface-border bg-surface-raised",children:[y.jsxs("button",{onClick:t,className:"flex items-center gap-2 w-full px-4 py-1.5 text-left hover:bg-surface-hover transition-colors",children:[i?y.jsx(ww,{className:"w-3 h-3 text-text-tertiary"}):y.jsx(Sw,{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 ${Tv[Nv(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(Ew,{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(Ow,{className:"w-3 h-3"})})]})]})]}),r&&y.jsxs("div",{className:"px-4 py-2 border-t border-surface-border/50 bg-surface-sunken/30",children:[y.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 mb-1.5",children:[y.jsx("span",{className:"text-2xs text-text-quaternary uppercase tracking-wider shrink-0",children:"Subscribed:"}),y.jsx("span",{className:"text-2xs font-mono text-accent px-1.5 py-0.5 bg-accent/10 rounded",children:w.replace("lt.events.","")}),S.map(C=>y.jsxs("span",{className:"inline-flex items-center gap-1 text-2xs font-mono text-text-secondary px-1.5 py-0.5 bg-surface-sunken rounded",children:[C.replace("lt.events.",""),y.jsx("button",{onClick:()=>L(C),className:"text-text-quaternary hover:text-status-error",children:y.jsx(Cn,{className:"w-2 h-2"})})]},C))]}),y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("input",{type:"text",value:g,onChange:C=>f(C.target.value),onKeyDown:C=>{C.key==="Enter"&&g.trim()&&(M(g.trim()),f(""))},placeholder:"task.> or file.stored",className:"input text-2xs font-mono flex-1 py-1"}),y.jsxs("button",{onClick:()=>{g.trim()&&(M(g.trim()),f(""))},className:"text-2xs text-accent hover:text-accent-hover flex items-center gap-0.5",children:[y.jsx(lb,{className:"w-2.5 h-2.5"})," Add"]})]})]}),y.jsx(Xd,{open:i,children:y.jsx("div",{ref:d,className:"h-48 overflow-y-auto",children:l.length===0?y.jsx("p",{className:"text-2xs text-text-tertiary py-4 text-center",children:"Waiting for events..."}):l.map(C=>y.jsx(U1,{event:C},C.id))})}),y.jsxs(jv,{open:m,onClose:()=>p(!1),sourceRef:d,children:[y.jsx("div",{className:"sticky top-0 float-right z-10",children:y.jsx("button",{onClick:()=>p(!1),className:"p-2 rounded text-text-tertiary hover:text-text-primary hover:bg-surface-raised transition-colors duration-150 bg-surface-sunken/80 backdrop-blur-sm",title:"Close (Esc)",children:y.jsx(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 hj(){return pt({queryKey:["docs"],queryFn:()=>Ae("/docs"),staleTime:5*6e4})}function dj(i){return pt({queryKey:["docs",i],queryFn:()=>Ae(`/docs/read?path=${encodeURIComponent(i)}`),enabled:!!i,staleTime:5*6e4})}function mj(){const[i,t]=j.useState([]),[r,s]=j.useState([]),[l,c]=j.useState(null),m=j.useRef(l),p=j.useRef(i),g=j.useRef(r);m.current=l,p.current=i,g.current=r;const f=j.useCallback((w,S)=>{var L;const M=m.current;if(M){const z=((L=S==null?void 0:S.current)==null?void 0:L.scrollTop)??0;t([...p.current,{...M,scrollTop:z}])}s([]),c({path:w,scrollTop:0})},[]),d=j.useCallback(w=>{var z;const S=p.current;if(S.length===0)return;const M=S[S.length-1],L=m.current;if(L){const ie=((z=w==null?void 0:w.current)==null?void 0:z.scrollTop)??0;s([...g.current,{...L,scrollTop:ie}])}t(S.slice(0,-1)),c(M),requestAnimationFrame(()=>{w!=null&&w.current&&(w.current.scrollTop=M.scrollTop)})},[]),b=j.useCallback(w=>{var z;const S=g.current;if(S.length===0)return;const M=S[S.length-1],L=m.current;if(L){const ie=((z=w==null?void 0:w.current)==null?void 0:z.scrollTop)??0;t([...p.current,{...L,scrollTop:ie}])}s(S.slice(0,-1)),c(M),requestAnimationFrame(()=>{w!=null&&w.current&&(w.current.scrollTop=M.scrollTop)})},[]),v=j.useCallback(w=>{var L,z;const S=m.current;if(!S)return;const M=((L=w==null?void 0:w.current)==null?void 0:L.scrollTop)??0;t([...p.current,{...S,scrollTop:M}]),s([]),c({...S,scrollTop:((z=w==null?void 0:w.current)==null?void 0:z.scrollTop)??0})},[]),_=j.useCallback(()=>{t([]),s([]),c(null)},[]);return{current:l,backStack:i,forwardStack:r,navigate:f,goBack:d,goForward:b,pushScrollPosition:v,reset:_}}function pj(i,t){const[r,s]=i.split("#");let l=r;if(l.startsWith("./")||l.startsWith("../")){const m=((t?t.replace(/[^/]+$/,""):"")+l).split("/"),p=[];for(const g of m)g===".."?p.pop():g&&g!=="."&&p.push(g);l=p.join("/")}return{path:l,anchor:s}}function gj(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 yj(i){return!i||i==="README.md"?"#docs":`#docs:${i}`}function bj({content:i,currentPath:t,onNavigate:r,onAnchorClick:s}){const l=c=>{var f;const m=c.target,p=m.closest("[data-anchor]");if(p){c.preventDefault(),s();const d=p.dataset.anchor,b=(f=p.closest(".docs-content"))==null?void 0:f.querySelector(`#${CSS.escape(d)}`);b==null||b.scrollIntoView({behavior:"smooth",block:"start"});return}const g=m.closest("[data-doc-link]");if(g){c.preventDefault();const{path:d,anchor:b}=pj(g.dataset.docLink,t);r(d,b);return}};return y.jsx(Kd,{content:i,className:"docs-content",onClick:l})}function vj(i){const t=[],r=new Map;for(const s of i){const l=s.path.split("/");if(l.length===1){t.push(s);continue}let c=r;for(let m=0;m<l.length-1;m++){const p=l[m];c.has(p)||c.set(p,{label:p,children:[],subdirs:new Map});const g=c.get(p);m===l.length-2?g.children.push(s):c=g.subdirs}}return{topLevel:t,dirs:r}}function xj({docs:i,selected:t,onSelect:r}){const{topLevel:s,dirs:l}=vj(i),c=p=>`block w-full text-left px-3 py-1 text-xs rounded truncate transition-colors ${t===p?"bg-accent/10 text-accent":"text-text-secondary hover:bg-surface-hover"}`;function m(p,g){return y.jsxs("details",{open:!0,children:[y.jsxs("summary",{className:"flex items-center gap-1.5 px-3 py-1 text-2xs font-semibold uppercase tracking-widest text-text-tertiary cursor-pointer",children:[y.jsx(Aw,{className:"w-3 h-3",strokeWidth:1.5}),p.label]}),y.jsxs("div",{className:"pl-2 space-y-0.5",children:[[...p.subdirs.values()].map(f=>m(f)),p.children.map(f=>y.jsx("button",{className:c(f.path),onClick:()=>r(f.path),children:f.title},f.path))]})]},p.label)}return y.jsxs("div",{className:"space-y-0.5",children:[s.map(p=>y.jsx("button",{className:c(p.path),onClick:()=>r(p.path),children:p.title},p.path)),[...l.values()].map(p=>m(p))]})}function _j({open:i,onClose:t}){var re,K,B;const[r,s]=j.useState(!1),{data:l}=hj(),c=mj(),{data:m,isLoading:p}=dj(((re=c.current)==null?void 0:re.path)??null),g=j.useRef(null),[f,d]=j.useState(null);j.useEffect(()=>{f&&(m!=null&&m.content)&&g.current&&requestAnimationFrame(()=>{var W;const G=(W=g.current)==null?void 0:W.querySelector(`#${CSS.escape(f)}`);G==null||G.scrollIntoView({behavior:"smooth",block:"start"}),d(null)})},[f,m]);const b=j.useCallback(()=>{var Q;const G=gj(window.location.hash),W=(G==null?void 0:G.path)??"README.md";((Q=c.current)==null?void 0:Q.path)!==W&&c.navigate(W,g),G!=null&&G.anchor&&d(G.anchor)},[c]),v=j.useRef(!0);j.useEffect(()=>{if(!i||!c.current)return;if(v.current){v.current=!1;return}const G=yj(c.current.path);window.location.hash!==G&&window.history.replaceState(null,"",window.location.pathname+window.location.search+G)},[i,(K=c.current)==null?void 0:K.path]),j.useEffect(()=>{if(!i)return;const G=()=>{window.location.hash.startsWith("#docs")&&b()};return window.addEventListener("hashchange",G),()=>window.removeEventListener("hashchange",G)},[i,b]);const _=j.useCallback((G,W)=>{W&&d(W),c.navigate(G,g)},[c]),w=j.useCallback(G=>{c.navigate(G,g)},[c]),S=j.useCallback(()=>{c.goBack(g)},[c]),M=j.useCallback(()=>{c.goForward(g)},[c]),L=j.useCallback(()=>{c.pushScrollPosition(g)},[c]);if(j.useEffect(()=>{if(i){v.current=!0,b();const G=requestAnimationFrame(()=>s(!0));return()=>cancelAnimationFrame(G)}},[i]),!(i||r))return null;const ie=()=>{s(!1),setTimeout(()=>{t(),c.reset()},200)},ae=((B=c.current)==null?void 0:B.path)??null,C=c.backStack.length>0,I=c.forwardStack.length>0;return y.jsxs("div",{className:"fixed inset-y-0 right-0 z-50 flex",children:[y.jsx("div",{className:`fixed inset-0 bg-black/20 transition-opacity duration-200 ${r&&i?"opacity-100":"opacity-0"}`,onClick:ie}),y.jsxs("div",{className:`relative ml-auto w-[40vw] min-w-[800px] max-w-[90vw] h-full bg-surface-raised border-l border-surface-border flex flex-col shadow-xl transition-transform duration-200 ease-out ${r&&i?"translate-x-0":"translate-x-full"}`,children:[y.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border shrink-0",children:[y.jsxs("div",{className:"flex items-center gap-1",children:[y.jsx("button",{onClick:S,disabled:!C,className:`p-0.5 transition-colors ${C?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Back",children:y.jsx(sb,{className:"w-4 h-4"})}),y.jsx("button",{onClick:M,disabled:!I,className:`p-0.5 transition-colors ${I?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Forward",children:y.jsx(Yh,{className:"w-4 h-4"})}),y.jsx(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(xj,{docs:l.docs,selected:ae,onSelect:w}):y.jsx("div",{className:"px-3 py-2 text-xs text-text-tertiary",children:"Loading..."})}),y.jsx("div",{ref:g,className:"flex-1 overflow-y-auto px-6 py-4",children:ae?p?y.jsxs("div",{className:"animate-pulse space-y-2",children:[y.jsx("div",{className:"h-6 bg-surface-sunken rounded w-48"}),y.jsx("div",{className:"h-4 bg-surface-sunken rounded w-full"}),y.jsx("div",{className:"h-4 bg-surface-sunken rounded w-3/4"})]}):m!=null&&m.content?y.jsx(bj,{content:m.content,currentPath:ae,onNavigate:_,onAnchorClick:L}):y.jsx("p",{className:"text-xs text-text-tertiary",children:"Document not found."}):y.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-text-tertiary",children:[y.jsx(Yh,{className:"w-5 h-5 mb-2"}),y.jsx("p",{className:"text-xs",children:"Select a document"})]})})]})]})]})}function wj(i){if(i.includes("/escalations"))return["escalation","human-queue"]}const P1=2e3;function Sj(i){const r=i.filter(l=>!l.pending).slice(-8);return r.length===0?"":`[Prior conversation]
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}
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]
59
59
  ${r.map(l=>`${l.role==="user"?"User":"Assistant"}: ${l.content}`).join(`
60
60
  `)}
61
61
  [End prior conversation]
62
62
 
63
- `}function Ej(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 kv=j.createContext(null);function Oj({children:i}){const t=mn(),[r,s]=j.useState(!1),[l,c]=j.useState([]),[m,p]=j.useState(null),[g,f]=j.useState({}),d=j.useRef(null),b={page:t.pathname.split("/").filter(Boolean).join("-")||"home",route:t.pathname,params:{},...g,suggestedTags:g.suggestedTags??wj(t.pathname)};j.useEffect(()=>()=>{d.current&&clearInterval(d.current)},[]);const v=j.useCallback(()=>s(L=>!L),[]),_=j.useCallback(L=>{f(L)},[]),w=j.useCallback(()=>{c([]),p(null)},[]),S=j.useCallback(async L=>{var K;const z=new Date().toISOString(),ie={id:`user-${Date.now()}`,role:"user",content:L,timestamp:z},ae={id:`pending-${Date.now()}`,role:"assistant",content:"",timestamp:z,pending:!0};c(B=>[...B,ie,ae]);const C={...b};(K=C.entities)!=null&&K.yamlContent&&C.entities.yamlContent.length>P1&&(C.entities={...C.entities,yamlContent:C.entities.yamlContent.slice(0,P1)+`
64
- ... (truncated)`});const re=`${Sj(l.concat(ie))}${L}`;try{const G=(await Ae("/insight/mcp-query",{method:"POST",body:JSON.stringify({prompt:re,tags:C.suggestedTags,context:C,wait:!1,direct:!0})})).workflow_id;p(G),c(W=>W.map(Q=>Q.id===ae.id?{...Q,workflowId:G}:Q)),d.current&&clearInterval(d.current),d.current=setInterval(async()=>{var W;try{const Q=await Ae(`/workflows/${G}/result`),he=(W=Q==null?void 0:Q.result)==null?void 0:W.data;if(he){d.current&&clearInterval(d.current),d.current=null,p(null);const _e=Ej(he);let Te;try{Te=(await Ae(`/workflow-states/${G}/execution`)).duration_ms}catch{}c(Y=>Y.map(oe=>oe.id===ae.id?{...oe,content:_e,timestamp:new Date().toISOString(),pending:!1,durationMs:Te}:oe))}}catch{}},3e3)}catch{c(B=>B.map(G=>G.id===ae.id?{...G,content:"Failed to submit query. Please try again.",pending:!1}:G))}},[l,b]),M=j.useCallback(async L=>{const z=l.find(C=>C.id===L);if(!(z!=null&&z.workflowId)||z.compilationStatus==="compiling"||z.compilationStatus==="done")return;const ie=l.indexOf(z),ae=l.slice(0,ie).reverse().find(C=>C.role==="user");if(ae){c(C=>C.map(I=>I.id===L?{...I,compilationStatus:"compiling"}:I));try{const C=await Ae("/insight/mcp-query/describe",{method:"POST",body:JSON.stringify({prompt:ae.content,summary:z.content})}),I=await Ae("/yaml-workflows",{method:"POST",body:JSON.stringify({workflow_id:z.workflowId,task_queue:"long-tail-system",workflow_name:"mcpQuery",name:C.tool_name,description:C.description,tags:C.tags,app_id:""})});await Ae(`/yaml-workflows/${I.id}/deploy`,{method:"POST"}),c(re=>re.map(K=>K.id===L?{...K,compilationStatus:"done"}:K))}catch(C){const I=C instanceof Error?C.message:"Compilation failed";c(re=>re.map(K=>K.id===L?{...K,compilationStatus:"error",compilationError:I}:K))}}},[l]);return y.jsx(kv.Provider,{value:{helpOpen:r,setHelpOpen:s,toggleHelp:v,messages:l,sendMessage:S,pageContext:b,setPageContext:_,activeWorkflowId:m,clearMessages:w,compileMessage:M},children:i})}function Cv(){const i=j.useContext(kv);if(!i)throw new Error("useHelpAssistant must be used within HelpAssistantProvider");return i}function Aj(){const{helpOpen:i,toggleHelp:t}=Cv();return y.jsx("button",{onClick:t,className:"fixed right-3 z-[45] flex items-center justify-center w-10 h-10 rounded-full bg-surface-raised shadow-lg hover:scale-110 transition-transform duration-150 border border-accent/30",style:{bottom:"44px"},"aria-label":i?"Close help":"Ask for help",children:i?y.jsx(Cn,{className:"w-5 h-5 text-text-tertiary",strokeWidth:1.5}):y.jsx("span",{role:"img","aria-label":"Help",className:"logo-mark w-8 h-8 -rotate-[120deg]",style:{"--logo-url":`url(${Mt}/logo512.png)`}})})}const Mv=6048e5,jj=864e5,I1=6e4,$1=525600,H1=43200,G1=1440,F1=Symbol.for("constructDateFrom");function Er(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 dn(i,t){return Er(t||i,i)}let Tj={};function So(){return Tj}function po(i,t){var p,g,f,d;const r=So(),s=(t==null?void 0:t.weekStartsOn)??((g=(p=t==null?void 0:t.locale)==null?void 0:p.options)==null?void 0:g.weekStartsOn)??r.weekStartsOn??((d=(f=r.locale)==null?void 0:f.options)==null?void 0:d.weekStartsOn)??0,l=dn(i,t==null?void 0:t.in),c=l.getDay(),m=(c<s?7:0)+c-s;return l.setDate(l.getDate()-m),l.setHours(0,0,0,0),l}function su(i,t){return po(i,{...t,weekStartsOn:1})}function Rv(i,t){const r=dn(i,t==null?void 0:t.in),s=r.getFullYear(),l=Er(r,0);l.setFullYear(s+1,0,4),l.setHours(0,0,0,0);const c=su(l),m=Er(r,0);m.setFullYear(s,0,4),m.setHours(0,0,0,0);const p=su(m);return r.getTime()>=c.getTime()?s+1:r.getTime()>=p.getTime()?s:s-1}function au(i){const t=dn(i),r=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return r.setUTCFullYear(t.getFullYear()),+i-+r}function Dv(i,...t){const r=Er.bind(null,i||t.find(s=>typeof s=="object"));return t.map(r)}function V1(i,t){const r=dn(i,t==null?void 0:t.in);return r.setHours(0,0,0,0),r}function Nj(i,t,r){const[s,l]=Dv(r==null?void 0:r.in,i,t),c=V1(s),m=V1(l),p=+c-au(c),g=+m-au(m);return Math.round((p-g)/jj)}function kj(i,t){const r=Rv(i,t),s=Er(i,0);return s.setFullYear(r,0,4),s.setHours(0,0,0,0),su(s)}function Cj(i,t){const r=+dn(i)-+dn(t);return r<0?-1:r>0?1:r}function Mj(i){return Er(i,Date.now())}function Rj(i){return i instanceof Date||typeof i=="object"&&Object.prototype.toString.call(i)==="[object Date]"}function Dj(i){return!(!Rj(i)&&typeof i!="number"||isNaN(+dn(i)))}function qj(i){return t=>{const s=(i?Math[i]:Math.trunc)(t);return s===0?0:s}}function Bj(i,t){const r=dn(i,t==null?void 0:t.in);return r.setFullYear(r.getFullYear(),0,1),r.setHours(0,0,0,0),r}const Lj={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"}},zj=(i,t,r)=>{let s;const l=Lj[i];return typeof l=="string"?s=l:t===1?s=l.one:s=l.other.replace("{{count}}",t.toString()),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"in "+s:s+" ago":s};function Vh(i){return(t={})=>{const r=t.width?String(t.width):i.defaultWidth;return i.formats[r]||i.formats[i.defaultWidth]}}const Uj={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Pj={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Ij={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},$j={date:Vh({formats:Uj,defaultWidth:"full"}),time:Vh({formats:Pj,defaultWidth:"full"}),dateTime:Vh({formats:Ij,defaultWidth:"full"})},Hj={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Gj=(i,t,r,s)=>Hj[i];function eo(i){return(t,r)=>{const s=r!=null&&r.context?String(r.context):"standalone";let l;if(s==="formatting"&&i.formattingValues){const m=i.defaultFormattingWidth||i.defaultWidth,p=r!=null&&r.width?String(r.width):m;l=i.formattingValues[p]||i.formattingValues[m]}else{const m=i.defaultWidth,p=r!=null&&r.width?String(r.width):i.defaultWidth;l=i.values[p]||i.values[m]}const c=i.argumentCallback?i.argumentCallback(t):t;return l[c]}}const Fj={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Vj={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Yj={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"]},Xj={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"]},Kj={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"}},Jj={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"}},Qj=(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"},Zj={ordinalNumber:Qj,era:eo({values:Fj,defaultWidth:"wide"}),quarter:eo({values:Vj,defaultWidth:"wide",argumentCallback:i=>i-1}),month:eo({values:Yj,defaultWidth:"wide"}),day:eo({values:Xj,defaultWidth:"wide"}),dayPeriod:eo({values:Kj,defaultWidth:"wide",formattingValues:Jj,defaultFormattingWidth:"wide"})};function to(i){return(t,r={})=>{const s=r.width,l=s&&i.matchPatterns[s]||i.matchPatterns[i.defaultMatchWidth],c=t.match(l);if(!c)return null;const m=c[0],p=s&&i.parsePatterns[s]||i.parsePatterns[i.defaultParseWidth],g=Array.isArray(p)?eT(p,b=>b.test(m)):Wj(p,b=>b.test(m));let f;f=i.valueCallback?i.valueCallback(g):g,f=r.valueCallback?r.valueCallback(f):f;const d=t.slice(m.length);return{value:f,rest:d}}}function Wj(i,t){for(const r in i)if(Object.prototype.hasOwnProperty.call(i,r)&&t(i[r]))return r}function eT(i,t){for(let r=0;r<i.length;r++)if(t(i[r]))return r}function tT(i){return(t,r={})=>{const s=t.match(i.matchPattern);if(!s)return null;const l=s[0],c=t.match(i.parsePattern);if(!c)return null;let m=i.valueCallback?i.valueCallback(c[0]):c[0];m=r.valueCallback?r.valueCallback(m):m;const p=t.slice(l.length);return{value:m,rest:p}}}const nT=/^(\d+)(th|st|nd|rd)?/i,rT=/\d+/i,iT={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},sT={any:[/^b/i,/^(a|c)/i]},aT={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},oT={any:[/1/i,/2/i,/3/i,/4/i]},lT={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},cT={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]},uT={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},fT={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]},hT={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},dT={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}},mT={ordinalNumber:tT({matchPattern:nT,parsePattern:rT,valueCallback:i=>parseInt(i,10)}),era:to({matchPatterns:iT,defaultMatchWidth:"wide",parsePatterns:sT,defaultParseWidth:"any"}),quarter:to({matchPatterns:aT,defaultMatchWidth:"wide",parsePatterns:oT,defaultParseWidth:"any",valueCallback:i=>i+1}),month:to({matchPatterns:lT,defaultMatchWidth:"wide",parsePatterns:cT,defaultParseWidth:"any"}),day:to({matchPatterns:uT,defaultMatchWidth:"wide",parsePatterns:fT,defaultParseWidth:"any"}),dayPeriod:to({matchPatterns:hT,defaultMatchWidth:"any",parsePatterns:dT,defaultParseWidth:"any"})},qv={code:"en-US",formatDistance:zj,formatLong:$j,formatRelative:Gj,localize:Zj,match:mT,options:{weekStartsOn:0,firstWeekContainsDate:1}};function pT(i,t){const r=dn(i,t==null?void 0:t.in);return Nj(r,Bj(r))+1}function gT(i,t){const r=dn(i,t==null?void 0:t.in),s=+su(r)-+kj(r);return Math.round(s/Mv)+1}function Bv(i,t){var d,b,v,_;const r=dn(i,t==null?void 0:t.in),s=r.getFullYear(),l=So(),c=(t==null?void 0:t.firstWeekContainsDate)??((b=(d=t==null?void 0:t.locale)==null?void 0:d.options)==null?void 0:b.firstWeekContainsDate)??l.firstWeekContainsDate??((_=(v=l.locale)==null?void 0:v.options)==null?void 0:_.firstWeekContainsDate)??1,m=Er((t==null?void 0:t.in)||i,0);m.setFullYear(s+1,0,c),m.setHours(0,0,0,0);const p=po(m,t),g=Er((t==null?void 0:t.in)||i,0);g.setFullYear(s,0,c),g.setHours(0,0,0,0);const f=po(g,t);return+r>=+p?s+1:+r>=+f?s:s-1}function yT(i,t){var p,g,f,d;const r=So(),s=(t==null?void 0:t.firstWeekContainsDate)??((g=(p=t==null?void 0:t.locale)==null?void 0:p.options)==null?void 0:g.firstWeekContainsDate)??r.firstWeekContainsDate??((d=(f=r.locale)==null?void 0:f.options)==null?void 0:d.firstWeekContainsDate)??1,l=Bv(i,t),c=Er((t==null?void 0:t.in)||i,0);return c.setFullYear(l,0,s),c.setHours(0,0,0,0),po(c,t)}function bT(i,t){const r=dn(i,t==null?void 0:t.in),s=+po(r,t)-+yT(r,t);return Math.round(s/Mv)+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=Bv(i,s),c=l>0?l:1-l;if(t==="YY"){const m=c%100;return Ye(m,2)}return t==="Yo"?r.ordinalNumber(c,{unit:"year"}):Ye(c,t.length)},R:function(i,t){const r=Rv(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=bT(i,s);return t==="wo"?r.ordinalNumber(l,{unit:"week"}):Ye(l,t.length)},I:function(i,t,r){const s=gT(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=pT(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 K1(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 K1(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"+X1(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"+X1(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 X1(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 K1(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"})}},Lv=(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"})}},vT=(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}}",Lv(l,t))},xT={p:Lv,P:vT},_T=/^D+$/,wT=/^Y+$/,ST=["D","DD","YY","YYYY"];function ET(i){return _T.test(i)}function OT(i){return wT.test(i)}function AT(i,t,r){const s=jT(i,t,r);if(console.warn(s),ST.includes(i))throw new RangeError(s)}function jT(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 TT=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,NT=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,kT=/^'([^]*?)'?$/,CT=/''/g,MT=/[a-zA-Z]/;function Jd(i,t,r){var d,b,v,_;const s=So(),l=s.locale??qv,c=s.firstWeekContainsDate??((b=(d=s.locale)==null?void 0:d.options)==null?void 0:b.firstWeekContainsDate)??1,m=s.weekStartsOn??((_=(v=s.locale)==null?void 0:v.options)==null?void 0:_.weekStartsOn)??0,p=dn(i,r==null?void 0:r.in);if(!Dj(p))throw new RangeError("Invalid time value");let g=t.match(NT).map(w=>{const S=w[0];if(S==="p"||S==="P"){const M=xT[S];return M(w,l.formatLong)}return w}).join("").match(TT).map(w=>{if(w==="''")return{isToken:!1,value:"'"};const S=w[0];if(S==="'")return{isToken:!1,value:RT(w)};if(Y1[S])return{isToken:!0,value:w};if(S.match(MT))throw new RangeError("Format string contains an unescaped latin alphabet character `"+S+"`");return{isToken:!1,value:w}});l.localize.preprocessor&&(g=l.localize.preprocessor(p,g));const f={firstWeekContainsDate:c,weekStartsOn:m,locale:l};return g.map(w=>{if(!w.isToken)return w.value;const S=w.value;(OT(S)||ET(S))&&AT(S,t,String(i));const M=Y1[S[0]];return M(p,S,l.localize,f)}).join("")}function RT(i){const t=i.match(kT);return t?t[1].replace(CT,"'"):i}function DT(i,t,r){const s=So(),l=(r==null?void 0:r.locale)??s.locale??qv,c=Cj(i,t);if(isNaN(c))throw new RangeError("Invalid time value");const m=Object.assign({},r,{addSuffix:r==null?void 0:r.addSuffix,comparison:c}),[p,g]=Dv(r==null?void 0:r.in,...c>0?[t,i]:[i,t]),f=qj((r==null?void 0:r.roundingMethod)??"round"),d=g.getTime()-p.getTime(),b=d/I1,v=au(g)-au(p),_=(d-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(d/1e3);return l.formatDistance("xSeconds",M,m)}else if(S==="minute"){const M=f(b);return l.formatDistance("xMinutes",M,m)}else if(S==="hour"){const M=f(b/60);return l.formatDistance("xHours",M,m)}else if(S==="day"){const M=f(_/G1);return l.formatDistance("xDays",M,m)}else if(S==="month"){const M=f(_/H1);return M===12&&w!=="month"?l.formatDistance("xYears",1,m):l.formatDistance("xMonths",M,m)}else{const M=f(_/$1);return l.formatDistance("xYears",M,m)}}function qT(i,t){return DT(i,Mj(i),t)}function F3(i){return i.toLocaleString()}function V3(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 BT(i){const t=new Date(i);return t.getTime()>Date.now()?"just now":qT(t,{addSuffix:!0})}function Y3(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 X3(i){return i<=0?"Expired":Qd(i)}function LT(i){return i==null?"--":Qd(i)}function K3(i){return i?Jd(new Date(i),"MMM d, yyyy h:mm a"):"--"}function Qd(i){if(i<1e3)return`${Math.round(i)}ms`;if(i<6e4){const m=i/1e3;return Number.isInteger(m)?`${m}s`:`${m.toFixed(1)}s`}const t=Math.floor(i/1e3),r=Math.floor(t/86400),s=Math.floor(t%86400/3600),l=Math.floor(t%3600/60),c=t%60;return r>0?s>0?`${r}d ${s}h`:`${r}d`:s>0?l>0?`${s}h ${l}m`:`${s}h`:c>0?`${l}m ${c}s`:`${l}m`}function J3(i,t){const r=new Date(i).getTime(),s=t?new Date(t).getTime():Date.now();return Qd(s-r)}function zv({options:i,children:t,className:r=""}){const[s,l]=j.useState(!1),[c,m]=j.useState(null),[p,g]=j.useState(null),f=j.useRef(null),d=j.useRef(void 0),b=j.useRef(void 0),v=220,_=j.useCallback(()=>{if(!f.current)return;const L=f.current.getBoundingClientRect(),z=window.innerWidth-v-8,ie=Math.max(8,Math.min(L.left,z));g({top:L.bottom+4,left:ie})},[]),w=j.useCallback(async(L,z)=>{try{await navigator.clipboard.writeText(L),m(z),clearTimeout(d.current),d.current=setTimeout(()=>m(null),1200)}catch{}},[]),S=j.useCallback(()=>{clearTimeout(b.current),_(),l(!0)},[_]),M=j.useCallback(()=>{b.current=setTimeout(()=>l(!1),150)},[]);return j.useEffect(()=>()=>{clearTimeout(d.current),clearTimeout(b.current)},[]),y.jsxs("span",{ref:f,className:`inline-flex items-center cursor-default ${r}`,onMouseEnter:S,onMouseLeave:M,children:[t,s&&p&&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(L=>y.jsxs("button",{onClick:z=>{z.stopPropagation(),w(L.value,L.label)},className:"flex items-center justify-between w-full px-2.5 py-1 text-left hover:bg-surface-hover transition-colors",children:[y.jsx("span",{className:"text-2xs font-medium uppercase tracking-wider text-text-tertiary w-10 shrink-0",children:L.label}),y.jsx("span",{className:"text-2xs font-mono text-text-secondary truncate ml-2",children:c===L.label?"✓":L.value})]},L.label))}),document.body)]})}function zT(i,t){const r=new Date(i);switch(t){case"relative":return BT(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 UT(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 PT({date:i,format:t="relative",className:r=""}){const[,s]=j.useState(0);j.useEffect(()=>{if(t!=="relative")return;const c=setInterval(()=>s(m=>m+1),3e4);return()=>clearInterval(c)},[t]);const l=j.useMemo(()=>UT(i),[i]);return y.jsx(zv,{options:l,children:y.jsx("time",{dateTime:i,className:`text-xs text-text-tertiary ${r}`,children:zT(i,t)})})}function IT({ms:i,className:t=""}){const r=LT(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(zv,{options:s,children:y.jsx("span",{className:`text-xs text-text-tertiary ${t}`,children:r})})}const $T=["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 HT({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 GT({msg:i}){const[t,r]=j.useState(0);j.useEffect(()=>{const m=new Date(i.timestamp).getTime(),p=()=>r(Math.floor((Date.now()-m)/1e3));p();const g=setInterval(p,1e3);return()=>clearInterval(g)},[i.timestamp]);const s=Math.floor(t/60),l=t%60,c=s>0?`${s}m ${l}s`:`${l}s`;return y.jsxs("span",{className:"inline-flex flex-col gap-1.5",children:[y.jsxs("span",{className:"inline-flex items-center gap-1",children:[y.jsx("span",{className:"text-text-tertiary",children:"Thinking"}),y.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse"}),y.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse [animation-delay:150ms]"}),y.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse [animation-delay:300ms]"}),y.jsx("span",{className:"text-text-muted ml-1 tabular-nums",children:c})]}),i.workflowId&&y.jsxs(Ii,{to:`/workflows/executions/${i.workflowId}`,className:"inline-flex items-center gap-1 text-2xs text-accent/70 hover:text-accent transition-colors",children:[y.jsx(wd,{className:"w-2.5 h-2.5",strokeWidth:1.5}),"watch execution"]})]})}function FT({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(PT,{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(IT,{ms:i.durationMs,className:"!text-2xs text-text-muted/50"})]}),i.workflowId&&y.jsx(Ii,{to:`/workflows/executions/${i.workflowId}`,className:"text-text-muted/40 hover:text-accent transition-colors",title:"View workflow execution",children:y.jsx(wd,{className:"w-2.5 h-2.5",strokeWidth:1.5})}),r&&i.workflowId&&!i.pending&&y.jsx("button",{onClick:()=>t(i.id),disabled:i.compilationStatus==="compiling"||i.compilationStatus==="done",className:"transition-colors",title:i.compilationStatus==="done"?"Compiled — future queries will match this pipeline":i.compilationStatus==="error"?i.compilationError??"Compilation failed":i.compilationStatus==="compiling"?"Compiling...":"Compile to fast pipeline",children:y.jsx(jw,{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 VT(){const{helpOpen:i,setHelpOpen:t,messages:r,sendMessage:s,pageContext:l,activeWorkflowId:c,clearMessages:m,compileMessage:p}=Cv(),[g,f]=j.useState(""),[d,b]=j.useState("md"),[v,_]=j.useState(!0),w=j.useRef(null),S=j.useRef(null);if(j.useEffect(()=>{w.current&&(w.current.scrollTop=w.current.scrollHeight)},[r]),j.useEffect(()=>{i&&S.current&&S.current.focus()},[i]),j.useEffect(()=>{if(!i)return;const C=I=>{I.key==="Escape"&&(d==="full"?b("lg"):d==="lg"?b("md"):d==="md"?b("sm"):t(!1))};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[i,d,t]),!i)return null;const M=()=>{const C=g.trim();!C||c||(s(C),f(""),S.current&&(S.current.style.height="auto"))},L=C=>{C.key==="Enter"&&!C.shiftKey&&(C.preventDefault(),M())},z=d==="full",ie=l.page.replace(/-/g," "),ae=z?{}:{bottom:"108px"};return y.jsxs("div",{className:`fixed z-[45] flex flex-col border border-surface-border rounded-lg overflow-hidden transition-all duration-300 ${z?Q1.full:`right-6 ${Q1[d]}`} ${v?"bg-surface-raised shadow-xl":"bg-surface-raised/[0.03] shadow-lg shadow-black/5"}`,style:ae,onMouseEnter:()=>_(!0),onMouseLeave:()=>_(!1),children:[y.jsxs("div",{className:`flex items-center justify-between px-4 py-2.5 border-b border-surface-border shrink-0 transition-all duration-300 ${v?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[y.jsxs("div",{className:"min-w-0 flex-1",children:[y.jsx("p",{className:"text-xs font-medium text-text-primary truncate",children:"Help Assistant"}),y.jsx("p",{className:"text-2xs text-text-tertiary truncate",children:ie})]}),y.jsxs("div",{className:"flex items-center gap-1 ml-2",children:[y.jsx("div",{className:"flex items-center gap-0.5 border border-surface-border rounded p-0.5",role:"radiogroup","aria-label":"Panel size",children:$T.map(C=>y.jsx("button",{onClick:()=>b(C),className:`p-1 rounded transition-colors ${C===d?"bg-accent/15 text-accent":"text-text-muted hover:text-text-secondary hover:bg-surface-hover"}`,role:"radio","aria-checked":C===d,"aria-label":Z1[C],title:Z1[C],children:y.jsx(HT,{which:C})},C))}),r.length>0&&y.jsx("button",{onClick:m,className:"p-1 text-text-tertiary hover:text-text-secondary transition-colors","aria-label":"Clear conversation",title:"Clear conversation",children:y.jsx(Tw,{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(GT,{msg:C}):C.role==="assistant"?y.jsx(Kd,{content:C.content}):C.content}),!C.pending&&y.jsx("div",{className:"mt-0.5",children:y.jsx(FT,{msg:C,compileMessage:p})})]},C.id))]}),y.jsxs("div",{className:`border-t border-surface-border px-3 py-2.5 flex gap-2 shrink-0 transition-all duration-300 ${v?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[y.jsx("textarea",{ref:S,value:g,onChange:C=>{f(C.target.value);const I=C.target;I.style.height="auto",I.style.height=`${Math.min(I.scrollHeight,120)}px`},onKeyDown:L,placeholder:"Ask a question...",rows:2,className:"flex-1 resize-none bg-surface text-xs text-text-primary placeholder:text-text-tertiary rounded px-2.5 py-1.5 border border-surface-border focus:outline-none focus:border-accent",style:{minHeight:"2.5rem"},disabled:!!c}),y.jsx("button",{onClick:M,disabled:!g.trim()||!!c,className:"px-2.5 py-1.5 text-accent hover:text-accent-hover disabled:text-text-muted transition-colors self-end","aria-label":"Send",children:y.jsx(Nw,{className:"w-4 h-4",strokeWidth:1.5})})]})]})}const YT=6e3,XT="scan";function KT(){const{lastResult:i}=hv(),{open:t,ownerKey:r}=Yd(),[s,l]=j.useState(null);if(j.useEffect(()=>{if(!i)return;const m=setTimeout(()=>l(i.at),YT);return()=>clearTimeout(m)},[i]),!i||i.navigated||s===i.at||t&&r===XT)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 ${_v[c.outcome]}`,children:wv(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(Sv,{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 JT(){var ie;const{isBuilder:i,isOps:t,viewAs:r}=Xb(),{canSeePaceBoard:s}=Kb();nO();const{data:l}=Or(),c=Fb(),m=c!==null?c:!!((ie=l==null?void 0:l.ai)!=null&&ie.enabled),{collapsed:p,toggle:g}=Fd(),[f,d]=j.useState(!1),[b,v]=j.useState(!1),[_,w]=j.useState(!1),[S,M]=j.useState(()=>window.location.hash.startsWith("#docs")),L=mn(),z=j.useRef(null);return j.useEffect(()=>{const ae=z.current;ae&&(ae.classList.remove("animate-page-in"),ae.offsetWidth,ae.classList.add("animate-page-in"))},[L.pathname]),j.useEffect(()=>{const ae=()=>{window.location.hash.startsWith("#docs")&&M(!0)};return window.addEventListener("hashchange",ae),()=>window.removeEventListener("hashchange",ae)},[]),y.jsxs("div",{className:"h-screen bg-surface flex flex-col",children:[y.jsx(EA,{onToggleEventFeed:()=>d(ae=>!ae),onToggleDocs:()=>M(ae=>!ae),onToggleNav:()=>v(ae=>!ae)}),y.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[y.jsxs("aside",{className:`${p?"w-16":"w-60"} shrink-0 bg-surface-raised border-r border-surface-border hidden lg:flex flex-col transition-[width] duration-200 ease-out overflow-hidden relative z-20`,children:[y.jsx("nav",{className:"flex-1 px-3 pt-[36px] pb-4 space-y-2 overflow-y-auto overflow-x-hidden",children:y.jsx(Ov,{aiEnabled:m,isBuilder:i,isOps:t,viewAs:r,canSeePaceBoard:s})}),y.jsx("button",{onClick:g,className:`shrink-0 py-3 text-text-tertiary hover:text-text-secondary transition-colors duration-150 ${p?"flex justify-center":"flex items-center px-7"}`,"aria-label":p?"Expand sidebar":"Collapse sidebar",children:p?y.jsx(kw,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5}):y.jsx(Cw,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5})}),!p&&(l==null?void 0:l.environment)&&y.jsxs("div",{className:"shrink-0 px-5 pb-3 text-2xs leading-tight text-text-tertiary whitespace-nowrap overflow-hidden text-ellipsis",title:`long-tail v${l.environment.longTailVersion} · HotMesh v${l.environment.hotmeshVersion} · Node ${l.environment.nodeVersion} · ${l.environment.nodeEnv}`,children:["long-tail v",l.environment.longTailVersion,y.jsx("span",{className:"mx-1 text-surface-border",children:"·"}),"HotMesh v",l.environment.hotmeshVersion]})]}),y.jsx("main",{className:"flex-1 min-w-0 overflow-y-auto",children:y.jsx("div",{ref:z,className:"w-full px-page-x py-8 pb-16 animate-page-in h-full flex flex-col @container",children:y.jsx(Ls,{})})}),y.jsx(QT,{})]}),y.jsx(VA,{open:b,onClose:()=>v(!1),aiEnabled:m,isBuilder:i,isOps:t,viewAs:r,canSeePaceBoard:s}),y.jsx(fj,{open:f,onToggle:()=>d(ae=>!ae),configOpen:_,onToggleConfig:()=>w(ae=>!ae)}),y.jsx(_j,{open:S,onClose:()=>{M(!1),history.replaceState(null,"",window.location.pathname+window.location.search)}}),m&&y.jsx(Aj,{}),m&&y.jsx(VT,{}),y.jsx(KT,{})]})}function QT(){const{node:i,width:t,open:r}=Yd();return y.jsx(oO,{open:r,width:t,className:"border-l border-surface-border bg-surface-raised",children:i})}function ZT(){const{isAuthenticated:i}=pn(),t=mn();return i?y.jsx(iO,{children:y.jsx(aO,{children:y.jsx(Oj,{children:y.jsx(yO,{children:y.jsx(kO,{children:y.jsx(JT,{})})})})})}):y.jsx(Xn,{to:"/login",state:{from:t.pathname},replace:!0})}function Uv({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 WT(){return Ae("/auth/oauth/providers")}async function eN(i,t){const r=t?`?label=${encodeURIComponent(t)}`:"";return Ae(`/auth/oauth/connections/${i}${r}`,{method:"DELETE"})}function Q3(){return pt({queryKey:["oauth-connections"],queryFn:()=>Ae("/auth/oauth/connections")})}function Z3(){const i=gt();return Et({mutationFn:({provider:t,label:r})=>eN(t,r),onSuccess:()=>{i.invalidateQueries({queryKey:["oauth-connections"]})}})}function tN(){var re;const{login:i,isAuthenticated:t}=pn(),r=go(),s=mn(),l=new URLSearchParams(s.search),c=l.get("token"),m=l.get("error"),p=((re=s.state)==null?void 0:re.from)??l.get("returnTo")??"/",g=j.useRef(!1);c&&!g.current&&(g.current=!0,i(c,void 0,{displayName:l.get("displayName"),username:l.get("username")}));const[f,d]=j.useState(""),[b,v]=j.useState(""),[_,w]=j.useState(m||""),[S,M]=j.useState(!1),[L,z]=j.useState(!!c),[ie,ae]=j.useState([]),C=j.useRef(!1);if(j.useEffect(()=>{c||C.current||(C.current=!0,(async()=>{var K,B,G,W;try{const Q=await fetch(`${Mt}/api/settings`);if(!Q.ok)return;const he=await Q.json();if(!((K=he.auth)!=null&&K.sso))return;const _e=await fetch(`${Mt}/api/auth/sso`,{method:"POST"});if(!_e.ok){w("Host authentication required — please log in to your organization first");return}const Te=await _e.json();Te.token&&((B=he.auth)!=null&&B.ssoLogoutUrl&&sessionStorage.setItem("lt_sso_logout_url",he.auth.ssoLogoutUrl),z(!0),i(Te.token,void 0,{displayName:(G=Te.user)==null?void 0:G.display_name,username:(W=Te.user)==null?void 0:W.external_id}))}catch{}})())},[]),j.useEffect(()=>{c||WT().then(ae).catch(()=>{})},[]),j.useEffect(()=>{if(!L)return;const K=setTimeout(()=>r(p,{replace:!0}),1500);return()=>clearTimeout(K)},[L]),t&&!L)return y.jsx(Xn,{to:p,replace:!0});const I=async K=>{var B,G;if(K.preventDefault(),w(""),!f.trim()||!b){w("Username and password are required");return}M(!0);try{const W=await fetch(`${Mt}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:f.trim(),password:b})}),Q=await W.json();if(!W.ok){w(Q.error||"Login failed");return}z(!0),i(Q.token,{username:f.trim(),password:b},{displayName:(B=Q.user)==null?void 0:B.display_name,username:(G=Q.user)==null?void 0:G.external_id})}catch{w("Unable to connect to server")}finally{M(!1)}};return y.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center overflow-hidden",children:y.jsxs("div",{className:"w-full max-w-md p-10",children:[y.jsx("div",{className:`mb-10 transition-all duration-[1500ms] ease-in ${L?"translate-x-[120vw] -translate-y-[60vh] scale-[3] opacity-0":""}`,children:y.jsx(nu,{size:"lg",hideLabel:L})}),y.jsxs("form",{onSubmit:I,className:`space-y-5 transition-opacity duration-300 ${L?"opacity-0":""}`,children:[y.jsxs("div",{children:[y.jsx("label",{htmlFor:"username",className:"block text-sm font-medium text-text-secondary mb-2",children:"Username"}),y.jsx("input",{id:"username",type:"text",value:f,onChange:K=>d(K.target.value),className:"input",placeholder:"Enter your username",autoFocus:!L,autoComplete:"username"})]}),y.jsxs("div",{children:[y.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-text-secondary mb-2",children:"Password"}),y.jsx("input",{id:"password",type:"password",value:b,onChange:K=>v(K.target.value),className:"input",placeholder:"Enter your password",autoComplete:"current-password"})]}),_&&y.jsx("p",{className:"text-sm text-status-error",children:_}),y.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:S||L,children:S?"Signing in...":"Sign In"}),ie.length>0&&y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"flex items-center gap-3 mt-6",children:[y.jsx("div",{className:"flex-1 h-px bg-border"}),y.jsx("span",{className:"text-xs text-text-tertiary",children:"or continue with"}),y.jsx("div",{className:"flex-1 h-px bg-border"})]}),y.jsx("div",{className:"space-y-2",children:ie.filter(K=>K.provider!=="anthropic").map(K=>y.jsxs("a",{href:`${Mt}/api/auth/oauth/${K.provider}?returnTo=${encodeURIComponent(p)}`,className:"btn-secondary w-full flex items-center justify-center gap-2",children:[y.jsx(Uv,{provider:K.provider}),"Sign in with ",K.name]},K.provider))})]})]})]})})}function W1(){const{isAuthenticated:i}=pn(),t=go(),r=mn(),s=new URLSearchParams(r.search),l=s.get("state")||"";j.useEffect(()=>{i||t(`/login?returnTo=${encodeURIComponent(r.pathname+r.search)}`)},[i]);const[c,m]=j.useState(""),[p,g]=j.useState(s.get("label")||"default"),[f,d]=j.useState(""),[b,v]=j.useState(!1),_=c.trim().startsWith("sk-ant-oat"),w=c.trim().startsWith("sk-ant-api"),S=M=>{M.preventDefault();const L=c.trim();if(!L){d("A token or API key is required");return}if(!L.startsWith("sk-ant-")){d('Invalid format. Must start with "sk-ant-oat" (OAuth token) or "sk-ant-api" (API key)');return}v(!0),d("");const z=`${Mt}/api/auth/oauth/anthropic/callback?code=${encodeURIComponent(L)}&state=${encodeURIComponent(l)}`;window.location.href=z};return y.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center",children:y.jsxs("div",{className:"w-full max-w-md p-10",children:[y.jsx("div",{className:"mb-10",children:y.jsx(nu,{size:"lg"})}),y.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[y.jsx(Uv,{provider:"anthropic",className:"w-6 h-6"}),y.jsx("h2",{className:"heading-3",children:"Connect Anthropic"})]}),y.jsx("p",{className:"text-sm text-text-secondary mb-4",children:"Connect your Anthropic account so Claude Code tasks run under your credentials. Your token is encrypted at rest."}),y.jsxs("form",{onSubmit:S,className:"space-y-5",children:[y.jsxs("div",{children:[y.jsx("label",{htmlFor:"token",className:"block text-sm font-medium text-text-secondary mb-2",children:"OAuth Token or API Key"}),y.jsx("input",{id:"token",type:"password",value:c,onChange:M=>m(M.target.value),className:"input",placeholder:"sk-ant-oat01-... or sk-ant-api03-...",autoFocus:!0,autoComplete:"off"}),_&&y.jsx("p",{className:"text-xs text-status-success mt-1",children:"OAuth token detected — uses your Claude subscription (flat rate)"}),w&&y.jsx("p",{className:"text-xs text-status-warning mt-1",children:"API key detected — billed per-token from your Anthropic API account"})]}),y.jsxs("div",{children:[y.jsx("label",{htmlFor:"label",className:"block text-sm font-medium text-text-secondary mb-2",children:"Label"}),y.jsx("input",{id:"label",type:"text",value:p,onChange:M=>g(M.target.value.replace(/\s+/g,"-").toLowerCase()),className:"input",placeholder:"default",autoComplete:"off"}),y.jsx("p",{className:"text-xs text-text-tertiary mt-1",children:'A name for this credential. Use different labels to store multiple credentials (e.g., "subscription", "api-batch").'})]}),f&&y.jsx("p",{className:"text-sm text-status-error",children:f}),y.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:b,children:b?"Validating...":"Connect"}),y.jsx("a",{href:"/",className:"block text-center text-sm text-text-tertiary hover:text-text-secondary",children:"Cancel"})]}),y.jsxs("div",{className:"mt-6 space-y-3 text-xs text-text-tertiary",children:[y.jsxs("div",{children:[y.jsx("span",{className:"font-medium text-text-secondary",children:"Recommended:"})," ","Run"," ",y.jsx("code",{className:"px-1 py-0.5 bg-surface-sunken rounded text-2xs",children:"claude setup-token"})," ","in your terminal to generate an OAuth token that uses your subscription."]}),y.jsxs("div",{children:[y.jsx("span",{className:"font-medium text-text-secondary",children:"Alternative:"})," ","Use an API key from"," ",y.jsx("a",{href:"https://console.anthropic.com/settings/keys",target:"_blank",rel:"noopener noreferrer",className:"text-accent-secondary hover:underline",children:"console.anthropic.com"})," ","(billed per-token)."]})]})]})})}function zc({roleTypes:i,roleNames:t,redirectTo:r="/"}){const{isSuperAdmin:s,hasRole:l,hasRoleType:c}=pn();return s?y.jsx(Ls,{}):i&&i.some(m=>c(m))?y.jsx(Ls,{}):t&&t.some(m=>l(m))?y.jsx(Ls,{}):y.jsx(Xn,{to:r,replace:!0})}function nN({redirectTo:i="/"}){var s;const{data:t,isLoading:r}=Or();return r||!t?null:(s=t.ai)!=null&&s.enabled?y.jsx(Ls,{}):y.jsx(Xn,{to:i,replace:!0})}function rN({flag:i,redirectTo:t="/"}){var l;const{data:r,isLoading:s}=Or();return s||!r?null:((l=r.features)==null?void 0:l[i])===!1?y.jsx(Xn,{to:t,replace:!0}):y.jsx(Ls,{})}const iN=j.lazy(()=>we(()=>import("./ProcessesListPage-CgdzgCY6.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}))),sN=j.lazy(()=>we(()=>import("./ProcessDetailPage-P45jOLim.js"),__vite__mapDeps([18,1,2,4,19,14,20,17,11,6,21,22,23]),import.meta.url).then(i=>({default:i.ProcessDetailPage}))),aN=j.lazy(()=>we(()=>import("./McpOverview-BhztmhoL.js"),__vite__mapDeps([24,1,25,26,27,28,15,14,29,6]),import.meta.url).then(i=>({default:i.McpOverview}))),oN=j.lazy(()=>we(()=>import("./McpRunsPage-Du8GnHFv.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}))),lN=j.lazy(()=>we(()=>import("./McpRunDetailPage-DqaBQAnn.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}))),cN=j.lazy(()=>we(()=>import("./McpQueryPage-DMzkble7.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}))),uN=j.lazy(()=>we(()=>import("./McpQueryDetailPage-BseZfrhc.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}))),fN=j.lazy(()=>we(()=>import("./EscalationsOverview-B27sDn5O.js"),__vite__mapDeps([52,1,4,15,14,29,6]),import.meta.url).then(i=>({default:i.EscalationsOverview}))),hN=j.lazy(()=>we(()=>import("./AvailableEscalationsPage-BjsbfsWW.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}))),dN=j.lazy(()=>we(()=>import("./OperatorDashboard-BHiGQZN_.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}))),mN=j.lazy(()=>we(()=>import("./index-BHbO4F8Z.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}))),pN=j.lazy(()=>we(()=>import("./WorkflowsOverview-BpWyV_tj.js"),__vite__mapDeps([64,1,3,4,15,14,29,6]),import.meta.url).then(i=>({default:i.WorkflowsOverview}))),gN=j.lazy(()=>we(()=>import("./index-DhRdWzz0.js"),__vite__mapDeps([65,1,3,15,14,13,17,66,48,49,6]),import.meta.url).then(i=>({default:i.StartWorkflowPage}))),yN=j.lazy(()=>we(()=>import("./index-DhRdWzz0.js"),__vite__mapDeps([65,1,3,15,14,13,17,66,48,49,6]),import.meta.url).then(i=>({default:i.DurableInvokePage}))),bN=j.lazy(()=>we(()=>import("./WorkflowsDashboard-ImEm16tX.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"})}))),vN=j.lazy(()=>we(()=>import("./WorkflowsDashboard-ImEm16tX.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"})}))),xN=j.lazy(()=>we(()=>import("./YamlWorkflowsPage-C9gxapRg.js"),__vite__mapDeps([68,1,27,5,6,15,14,13,10,50,66,20]),import.meta.url).then(i=>({default:i.YamlWorkflowsPage}))),_N=j.lazy(()=>we(()=>import("./GraphInvokePage-pdvc9VSv.js"),__vite__mapDeps([69,1,27,15,14,45,47,48,49,46,6,50,66]),import.meta.url).then(i=>({default:i.GraphInvokePage}))),wN=j.lazy(()=>we(()=>import("./YamlWorkflowDetailPage-BFBlw1YY.js"),__vite__mapDeps([70,1,27,20,66,14,6]),import.meta.url).then(i=>({default:i.YamlWorkflowDetailPage}))),SN=j.lazy(()=>we(()=>import("./TasksListPage-C1bT3DT9.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}))),EN=j.lazy(()=>we(()=>import("./TaskDetailPage-CAQm6avs.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-Ba4mYFoW.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}))),ON=j.lazy(()=>we(()=>import("./AdminDashboard-CahUELrr.js"),__vite__mapDeps([74,1,2,4,25,19,14,6]),import.meta.url).then(i=>({default:i.AdminDashboard}))),AN=j.lazy(()=>we(()=>import("./index-BAqQSgxn.js"),__vite__mapDeps([75,1,3,9,10,13,14,33,5,6,15,76,17]),import.meta.url).then(i=>({default:i.WorkersPage}))),jN=j.lazy(()=>we(()=>import("./index-BUpB9ezn.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-BUpB9ezn.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}))),TN=j.lazy(()=>we(()=>import("./index-B5q8ksfv.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-LiLVAQzB.js"),__vite__mapDeps([81,1,25,15,14,43,6]),import.meta.url).then(i=>({default:i.McpServerDetailPage}))),NN=j.lazy(()=>we(()=>import("./index-CtAPxA03.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}))),kN=j.lazy(()=>we(()=>import("./RolesPage-Ci7_PbPt.js"),__vite__mapDeps([85,1,13,14,15,21,56,6]),import.meta.url).then(i=>({default:i.RolesPage}))),CN=j.lazy(()=>we(()=>import("./RoleDetailPage-Dme2pa9z.js"),__vite__mapDeps([86,1,23,87,78,56,6,14]),import.meta.url).then(i=>({default:i.RoleDetailPage}))),MN=j.lazy(()=>we(()=>import("./PersonasPage-BQYCdmAs.js"),__vite__mapDeps([88,1,83,13,14,15,21,56,6,23,7]),import.meta.url).then(i=>({default:i.PersonasPage}))),RN=j.lazy(()=>we(()=>import("./PersonaDetailPage-D6GGZgUS.js"),__vite__mapDeps([89,1,83,21,14,84,87,78,56,6]),import.meta.url).then(i=>({default:i.PersonaDetailPage}))),DN=j.lazy(()=>we(()=>import("./EscalationSchemaPage-DAOVAxAM.js"),__vite__mapDeps([90,1,14,6]),import.meta.url).then(i=>({default:i.EscalationSchemaPage}))),qN=j.lazy(()=>we(()=>import("./EscalationListSchemaPage-DOrv-quD.js"),__vite__mapDeps([91,1,14,6]),import.meta.url).then(i=>({default:i.EscalationListSchemaPage}))),BN=j.lazy(()=>we(()=>import("./ScanCodesPage-DpbPhAj1.js"),__vite__mapDeps([92,1,15,14,6]),import.meta.url).then(i=>({default:i.ScanCodesPage}))),LN=j.lazy(()=>we(()=>import("./ScanSchemeDetailPage-CGnMGlt0.js"),__vite__mapDeps([93,1,78,56,6,15,14]),import.meta.url).then(i=>({default:i.ScanSchemeDetailPage}))),zN=j.lazy(()=>we(()=>import("./ScanStationPage-BTeV7TGy.js"),__vite__mapDeps([94,1,14,56,6]),import.meta.url).then(i=>({default:i.ScanStationPage}))),UN=j.lazy(()=>we(()=>import("./index-CFlmubaP.js"),__vite__mapDeps([95,1,15,14,56,6,57]),import.meta.url).then(i=>({default:i.MaintenancePage}))),PN=j.lazy(()=>we(()=>import("./OperationsPage-CL2feqwS.js").then(i=>i.O),__vite__mapDeps([96,1,4,59,14,6,15]),import.meta.url).then(i=>({default:i.OperationsPage}))),IN=j.lazy(()=>we(()=>import("./index-KotwPxGB.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}))),$N=j.lazy(()=>we(()=>import("./index-D-5F3Bw-.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}))),HN=j.lazy(()=>we(()=>import("./CredentialsPage-CTurxwRn.js"),__vite__mapDeps([99,1,15,14,51,78,56,6]),import.meta.url).then(i=>({default:i.CredentialsPage}))),GN=j.lazy(()=>we(()=>import("./index-CroJTX8g.js"),__vite__mapDeps([100,1,6,15,14,13,16,8,10,101,51]),import.meta.url).then(i=>({default:i.FilesPage}))),FN=j.lazy(()=>we(()=>import("./index-04QQsxMp.js"),__vite__mapDeps([102,1,15,14,13,16,12,10,101,51,103,43,6]),import.meta.url).then(i=>({default:i.KnowledgePage}))),VN=j.lazy(()=>we(()=>import("./HomePage-CLlDsBnw.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}))),YN=j.lazy(()=>we(()=>import("./AgentsPage-BMWSUJGi.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}))),XN=j.lazy(()=>we(()=>import("./AgentDetailPage-ZGea3Z4A.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-CkMv-cTV.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}))),KN=j.lazy(()=>we(()=>import("./CapabilitiesPage-EAO3Ae0S.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}))),JN=j.lazy(()=>we(()=>import("./TopicsPage-CNf2VZud.js"),__vite__mapDeps([113,1,111,15,14,13,6]),import.meta.url).then(i=>({default:i.TopicsPage}))),QN=j.lazy(()=>we(()=>import("./TopicDetailPage-ClI0I8Mu.js"),__vite__mapDeps([114,1,111,16,14,6]),import.meta.url).then(i=>({default:i.TopicDetailPage})));function ZN(){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(ZN,{}),children:y.jsx("div",{className:"animate-page-enter flex flex-col flex-1 min-h-0",children:i})})}const Pv=new Z_({defaultOptions:{queries:{staleTime:1e4,retry:(i,t)=>t instanceof Error&&t.message==="Session expired"?!1:i<1}}});window.addEventListener("auth:unauthorized",()=>{Pv.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 WN=tw([{path:"/login",element:y.jsx(tN,{})},{path:"/connect/anthropic",element:y.jsx(W1,{})},{path:"/connect/:provider",element:y.jsx(W1,{})},{path:"/",element:y.jsx(ZT,{}),children:[{index:!0,element:y.jsx(ve,{children:y.jsx(VN,{})})},{path:"processes/all",element:y.jsx(ve,{children:y.jsx(iN,{})})},{path:"processes/detail/:originId",element:y.jsx(ve,{children:y.jsx(sN,{})})},{path:"credentials",element:y.jsx(ve,{children:y.jsx(HN,{})})},{path:"connections",element:y.jsx(Xn,{to:"/credentials",replace:!0})},{path:"escalations",element:y.jsx(ve,{children:y.jsx(fN,{})})},{path:"escalations/available",element:y.jsx(ve,{children:y.jsx(hN,{})})},{path:"escalations/queue",element:y.jsx(ve,{children:y.jsx(dN,{})})},{path:"escalations/detail/:id",element:y.jsx(ve,{children:y.jsx(mN,{})})},{path:"scan/station",element:y.jsx(ve,{children:y.jsx(zN,{})})},{path:"capabilities",element:y.jsx(ve,{children:y.jsx(KN,{})})},{path:"agents",element:y.jsx(ve,{children:y.jsx(YN,{})})},{path:"agents/new",element:y.jsx(ve,{children:y.jsx(rb,{})})},{path:"agents/:id",element:y.jsx(ve,{children:y.jsx(XN,{})})},{path:"agents/:id/edit",element:y.jsx(ve,{children:y.jsx(rb,{})})},{path:"topics",element:y.jsx(ve,{children:y.jsx(JN,{})})},{path:"topics/:topic",element:y.jsx(ve,{children:y.jsx(QN,{})})},{element:y.jsx(zc,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"workflows",element:y.jsx(ve,{children:y.jsx(pN,{})})},{path:"workflows/executions",element:y.jsx(ve,{children:y.jsx(vN,{})})},{path:"workflows/durable/executions",element:y.jsx(ve,{children:y.jsx(bN,{})})},{path:"workflows/durable/executions/:workflowId",element:y.jsx(ve,{children:y.jsx(eb,{})})},{path:"workflows/tasks",element:y.jsx(ve,{children:y.jsx(SN,{})})},{path:"workflows/tasks/detail/:id",element:y.jsx(ve,{children:y.jsx(EN,{})})},{path:"workflows/executions/:workflowId",element:y.jsx(ve,{children:y.jsx(eb,{})})},{path:"workflows/start",element:y.jsx(ve,{children:y.jsx(gN,{})})},{path:"workflows/durable/invoke",element:y.jsx(ve,{children:y.jsx(yN,{})})},{path:"workflows/cron",element:y.jsx(Xn,{to:"/workflows/start?mode=schedule",replace:!0})},{path:"workflows/workers",element:y.jsx(ve,{children:y.jsx(AN,{})})},{path:"workflows/registry",element:y.jsx(ve,{children:y.jsx(jN,{})})},{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(xN,{})})},{path:"mcp/workflows/invoke",element:y.jsx(ve,{children:y.jsx(_N,{})})},{path:"mcp/workflows/:id",element:y.jsx(ve,{children:y.jsx(wN,{})})},{path:"mcp/executions",element:y.jsx(ve,{children:y.jsx(oN,{})})},{path:"mcp/executions/:jobId",element:y.jsx(ve,{children:y.jsx(lN,{})})},{path:"files",element:y.jsx(ve,{children:y.jsx(GN,{})})},{path:"knowledge",element:y.jsx(ve,{children:y.jsx(FN,{})})},{element:y.jsx(nN,{}),children:[{path:"mcp",element:y.jsx(ve,{children:y.jsx(aN,{})})},{path:"mcp/queries",element:y.jsx(ve,{children:y.jsx(cN,{})})},{path:"mcp/queries/:workflowId",element:y.jsx(ve,{children:y.jsx(uN,{})})},{path:"mcp/tools",element:y.jsx(Xn,{to:"/mcp/servers",replace:!0})},{path:"mcp/servers",element:y.jsx(ve,{children:y.jsx(TN,{})})},{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(PN,{})})},{element:y.jsx(zc,{roleTypes:["admin","superadmin"],roleNames:["engineer"]}),children:[{path:"admin",element:y.jsx(ve,{children:y.jsx(ON,{})})},{path:"admin/users",element:y.jsx(ve,{children:y.jsx(NN,{})})},{path:"admin/escalation-chains",element:y.jsx(Xn,{to:"/admin/roles",replace:!0})},{path:"admin/roles",element:y.jsx(ve,{children:y.jsx(kN,{})})},{path:"admin/roles/:role",element:y.jsx(ve,{children:y.jsx(CN,{})})},{path:"admin/roles/:role/schema",element:y.jsx(ve,{children:y.jsx(DN,{})})},{path:"admin/roles/:role/list-schema",element:y.jsx(ve,{children:y.jsx(qN,{})})},{path:"admin/scan-codes",element:y.jsx(ve,{children:y.jsx(BN,{})})},{path:"admin/scan-codes/:version",element:y.jsx(ve,{children:y.jsx(LN,{})})},{path:"admin/personas",element:y.jsx(ve,{children:y.jsx(MN,{})})},{path:"admin/personas/:key",element:y.jsx(ve,{children:y.jsx(RN,{})})}]},{element:y.jsx(zc,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"admin/bots",element:y.jsx(Xn,{to:"/admin/users?tab=service-accounts",replace:!0})},{element:y.jsx(rN,{flag:"dbMaintenance"}),children:[{path:"admin/maintenance",element:y.jsx(ve,{children:y.jsx(UN,{})})}]},{path:"admin/controlplane",element:y.jsx(ve,{children:y.jsx(IN,{})})},{path:"admin/streams",element:y.jsx(ve,{children:y.jsx($N,{})})}]}]}],{basename:window.__LT_BASE__||"/"});function e3(){return y.jsx(W_,{client:Pv,children:y.jsx($w,{children:y.jsx(F2,{children:y.jsx(nw,{router:WN})})})})}sv(iv());const Zd=document.createElement("link");Zd.rel="stylesheet";Zd.href=`${Mt}/api/settings/custom.css`;document.head.appendChild(Zd);Bw.createRoot(document.getElementById("root")).render(y.jsx(j.StrictMode,{children:y.jsx(e3,{})}));export{gO as $,w3 as A,S3 as B,Xd as C,IT as D,O3 as E,jv as F,L3 as G,kA as H,h3 as I,lj as J,DA as K,ev as L,Wb as M,FE as N,P3 as O,l3 as P,Qd as Q,y3 as R,JA as S,RA as T,Y3 as U,o3 as V,jO as W,Zl as X,Kd as Y,Sv as Z,p3 as _,J3 as a,uv as a0,v3 as a1,E3 as a2,Yg as a3,cv as a4,Jd as a5,zv as a6,X3 as a7,$3 as a8,G3 as a9,Uv as aA,Hd as aB,Kb as aC,V3 as aD,H3 as aa,U3 as ab,z3 as ac,vd as ad,Ay as ae,Rd as af,F3 as ag,Mt as ah,hb as ai,K3 as aj,I3 as ak,T3 as al,A3 as am,k3 as an,M3 as ao,R3 as ap,N3 as aq,C3 as ar,hv as as,BT as at,TO as au,j3 as av,Pe as aw,u3 as ax,Q3 as ay,Z3 as az,PT as b,oO as c,c3 as d,s3 as e,LT as f,Ae as g,m3 as h,g3 as i,b3 as j,f3 as k,Fb as l,pn as m,q3 as n,d3 as o,AO as p,B3 as q,Yd as r,CA as s,MA as t,Or as u,LA as v,D3 as w,Xb as x,x3 as y,_3 as z};
65
- //# sourceMappingURL=index-C991QfUN.js.map
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