9router 0.2.71 → 0.2.72

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/app/.next/BUILD_ID +1 -1
  2. package/app/.next/app-path-routes-manifest.json +40 -40
  3. package/app/.next/build-manifest.json +2 -2
  4. package/app/.next/prerender-manifest.json +3 -3
  5. package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
  6. package/app/.next/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
  7. package/app/.next/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
  8. package/app/.next/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
  9. package/app/.next/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
  10. package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
  11. package/app/.next/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
  12. package/app/.next/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
  13. package/app/.next/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
  14. package/app/.next/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
  15. package/app/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  16. package/app/.next/server/app/_global-error.html +2 -2
  17. package/app/.next/server/app/_global-error.rsc +1 -1
  18. package/app/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  19. package/app/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  20. package/app/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  21. package/app/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  22. package/app/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  23. package/app/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  24. package/app/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  25. package/app/.next/server/app/_not-found.html +1 -1
  26. package/app/.next/server/app/_not-found.rsc +2 -2
  27. package/app/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  28. package/app/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  29. package/app/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  30. package/app/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  31. package/app/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  32. package/app/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  33. package/app/.next/server/app/api/auth/login/route_client-reference-manifest.js +1 -1
  34. package/app/.next/server/app/api/auth/logout/route_client-reference-manifest.js +1 -1
  35. package/app/.next/server/app/api/cli-tools/antigravity-mitm/alias/route.js +2 -2
  36. package/app/.next/server/app/api/cli-tools/antigravity-mitm/alias/route_client-reference-manifest.js +1 -1
  37. package/app/.next/server/app/api/cli-tools/antigravity-mitm/route.js +4 -5
  38. package/app/.next/server/app/api/cli-tools/antigravity-mitm/route_client-reference-manifest.js +1 -1
  39. package/app/.next/server/app/api/cli-tools/claude-settings/route.js +2 -2
  40. package/app/.next/server/app/api/cli-tools/claude-settings/route_client-reference-manifest.js +1 -1
  41. package/app/.next/server/app/api/cli-tools/codex-settings/route.js +2 -2
  42. package/app/.next/server/app/api/cli-tools/codex-settings/route_client-reference-manifest.js +1 -1
  43. package/app/.next/server/app/api/cli-tools/droid-settings/route.js +2 -2
  44. package/app/.next/server/app/api/cli-tools/droid-settings/route_client-reference-manifest.js +1 -1
  45. package/app/.next/server/app/api/cli-tools/openclaw-settings/route.js +2 -2
  46. package/app/.next/server/app/api/cli-tools/openclaw-settings/route_client-reference-manifest.js +1 -1
  47. package/app/.next/server/app/api/cloud/auth/route_client-reference-manifest.js +1 -1
  48. package/app/.next/server/app/api/cloud/credentials/update/route_client-reference-manifest.js +1 -1
  49. package/app/.next/server/app/api/cloud/model/resolve/route_client-reference-manifest.js +1 -1
  50. package/app/.next/server/app/api/cloud/models/alias/route_client-reference-manifest.js +1 -1
  51. package/app/.next/server/app/api/combos/[id]/route_client-reference-manifest.js +1 -1
  52. package/app/.next/server/app/api/combos/route_client-reference-manifest.js +1 -1
  53. package/app/.next/server/app/api/init/route_client-reference-manifest.js +1 -1
  54. package/app/.next/server/app/api/keys/[id]/route_client-reference-manifest.js +1 -1
  55. package/app/.next/server/app/api/keys/route_client-reference-manifest.js +1 -1
  56. package/app/.next/server/app/api/models/alias/route_client-reference-manifest.js +1 -1
  57. package/app/.next/server/app/api/models/route_client-reference-manifest.js +1 -1
  58. package/app/.next/server/app/api/oauth/[provider]/[action]/route_client-reference-manifest.js +1 -1
  59. package/app/.next/server/app/api/oauth/cursor/auto-import/route_client-reference-manifest.js +1 -1
  60. package/app/.next/server/app/api/oauth/cursor/import/route_client-reference-manifest.js +1 -1
  61. package/app/.next/server/app/api/oauth/kiro/auto-import/route_client-reference-manifest.js +1 -1
  62. package/app/.next/server/app/api/oauth/kiro/import/route_client-reference-manifest.js +1 -1
  63. package/app/.next/server/app/api/oauth/kiro/social-authorize/route_client-reference-manifest.js +1 -1
  64. package/app/.next/server/app/api/oauth/kiro/social-exchange/route_client-reference-manifest.js +1 -1
  65. package/app/.next/server/app/api/pricing/route_client-reference-manifest.js +1 -1
  66. package/app/.next/server/app/api/provider-nodes/[id]/route_client-reference-manifest.js +1 -1
  67. package/app/.next/server/app/api/provider-nodes/route_client-reference-manifest.js +1 -1
  68. package/app/.next/server/app/api/provider-nodes/validate/route_client-reference-manifest.js +1 -1
  69. package/app/.next/server/app/api/providers/[id]/models/route_client-reference-manifest.js +1 -1
  70. package/app/.next/server/app/api/providers/[id]/route_client-reference-manifest.js +1 -1
  71. package/app/.next/server/app/api/providers/[id]/test/route_client-reference-manifest.js +1 -1
  72. package/app/.next/server/app/api/providers/client/route_client-reference-manifest.js +1 -1
  73. package/app/.next/server/app/api/providers/route_client-reference-manifest.js +1 -1
  74. package/app/.next/server/app/api/providers/validate/route_client-reference-manifest.js +1 -1
  75. package/app/.next/server/app/api/settings/require-login/route_client-reference-manifest.js +1 -1
  76. package/app/.next/server/app/api/settings/route_client-reference-manifest.js +1 -1
  77. package/app/.next/server/app/api/shutdown/route_client-reference-manifest.js +1 -1
  78. package/app/.next/server/app/api/sync/cloud/route_client-reference-manifest.js +1 -1
  79. package/app/.next/server/app/api/sync/initialize/route_client-reference-manifest.js +1 -1
  80. package/app/.next/server/app/api/tags/route_client-reference-manifest.js +1 -1
  81. package/app/.next/server/app/api/translator/load/route_client-reference-manifest.js +1 -1
  82. package/app/.next/server/app/api/translator/save/route_client-reference-manifest.js +1 -1
  83. package/app/.next/server/app/api/translator/send/route_client-reference-manifest.js +1 -1
  84. package/app/.next/server/app/api/translator/translate/route_client-reference-manifest.js +1 -1
  85. package/app/.next/server/app/api/usage/[connectionId]/route_client-reference-manifest.js +1 -1
  86. package/app/.next/server/app/api/usage/history/route_client-reference-manifest.js +1 -1
  87. package/app/.next/server/app/api/usage/request-logs/route_client-reference-manifest.js +1 -1
  88. package/app/.next/server/app/api/v1/api/chat/route_client-reference-manifest.js +1 -1
  89. package/app/.next/server/app/api/v1/chat/completions/route_client-reference-manifest.js +1 -1
  90. package/app/.next/server/app/api/v1/messages/count_tokens/route_client-reference-manifest.js +1 -1
  91. package/app/.next/server/app/api/v1/messages/route_client-reference-manifest.js +1 -1
  92. package/app/.next/server/app/api/v1/models/route_client-reference-manifest.js +1 -1
  93. package/app/.next/server/app/api/v1/responses/route_client-reference-manifest.js +1 -1
  94. package/app/.next/server/app/api/v1/route_client-reference-manifest.js +1 -1
  95. package/app/.next/server/app/api/v1beta/models/[...path]/route_client-reference-manifest.js +1 -1
  96. package/app/.next/server/app/api/v1beta/models/route_client-reference-manifest.js +1 -1
  97. package/app/.next/server/app/callback/page_client-reference-manifest.js +1 -1
  98. package/app/.next/server/app/callback.html +1 -1
  99. package/app/.next/server/app/callback.rsc +2 -2
  100. package/app/.next/server/app/callback.segments/_full.segment.rsc +2 -2
  101. package/app/.next/server/app/callback.segments/_head.segment.rsc +1 -1
  102. package/app/.next/server/app/callback.segments/_index.segment.rsc +2 -2
  103. package/app/.next/server/app/callback.segments/_tree.segment.rsc +1 -1
  104. package/app/.next/server/app/callback.segments/callback/__PAGE__.segment.rsc +1 -1
  105. package/app/.next/server/app/callback.segments/callback.segment.rsc +1 -1
  106. package/app/.next/server/app/dashboard/cli-tools.html +1 -1
  107. package/app/.next/server/app/dashboard/cli-tools.rsc +4 -4
  108. package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +2 -2
  109. package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools.segment.rsc +1 -1
  110. package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  111. package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  112. package/app/.next/server/app/dashboard/cli-tools.segments/_full.segment.rsc +4 -4
  113. package/app/.next/server/app/dashboard/cli-tools.segments/_head.segment.rsc +1 -1
  114. package/app/.next/server/app/dashboard/cli-tools.segments/_index.segment.rsc +2 -2
  115. package/app/.next/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +1 -1
  116. package/app/.next/server/app/dashboard/combos.html +1 -1
  117. package/app/.next/server/app/dashboard/combos.rsc +4 -4
  118. package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +2 -2
  119. package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos.segment.rsc +1 -1
  120. package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  121. package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  122. package/app/.next/server/app/dashboard/combos.segments/_full.segment.rsc +4 -4
  123. package/app/.next/server/app/dashboard/combos.segments/_head.segment.rsc +1 -1
  124. package/app/.next/server/app/dashboard/combos.segments/_index.segment.rsc +2 -2
  125. package/app/.next/server/app/dashboard/combos.segments/_tree.segment.rsc +1 -1
  126. package/app/.next/server/app/dashboard/endpoint.html +1 -1
  127. package/app/.next/server/app/dashboard/endpoint.rsc +4 -4
  128. package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +2 -2
  129. package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint.segment.rsc +1 -1
  130. package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  131. package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  132. package/app/.next/server/app/dashboard/endpoint.segments/_full.segment.rsc +4 -4
  133. package/app/.next/server/app/dashboard/endpoint.segments/_head.segment.rsc +1 -1
  134. package/app/.next/server/app/dashboard/endpoint.segments/_index.segment.rsc +2 -2
  135. package/app/.next/server/app/dashboard/endpoint.segments/_tree.segment.rsc +1 -1
  136. package/app/.next/server/app/dashboard/profile.html +1 -1
  137. package/app/.next/server/app/dashboard/profile.rsc +4 -4
  138. package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +2 -2
  139. package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile.segment.rsc +1 -1
  140. package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  141. package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  142. package/app/.next/server/app/dashboard/profile.segments/_full.segment.rsc +4 -4
  143. package/app/.next/server/app/dashboard/profile.segments/_head.segment.rsc +1 -1
  144. package/app/.next/server/app/dashboard/profile.segments/_index.segment.rsc +2 -2
  145. package/app/.next/server/app/dashboard/profile.segments/_tree.segment.rsc +1 -1
  146. package/app/.next/server/app/dashboard/providers/new.html +1 -1
  147. package/app/.next/server/app/dashboard/providers/new.rsc +4 -4
  148. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +2 -2
  149. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new.segment.rsc +1 -1
  150. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
  151. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  152. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  153. package/app/.next/server/app/dashboard/providers/new.segments/_full.segment.rsc +4 -4
  154. package/app/.next/server/app/dashboard/providers/new.segments/_head.segment.rsc +1 -1
  155. package/app/.next/server/app/dashboard/providers/new.segments/_index.segment.rsc +2 -2
  156. package/app/.next/server/app/dashboard/providers/new.segments/_tree.segment.rsc +1 -1
  157. package/app/.next/server/app/dashboard/providers.html +1 -1
  158. package/app/.next/server/app/dashboard/providers.rsc +4 -4
  159. package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +2 -2
  160. package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
  161. package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  162. package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  163. package/app/.next/server/app/dashboard/providers.segments/_full.segment.rsc +4 -4
  164. package/app/.next/server/app/dashboard/providers.segments/_head.segment.rsc +1 -1
  165. package/app/.next/server/app/dashboard/providers.segments/_index.segment.rsc +2 -2
  166. package/app/.next/server/app/dashboard/providers.segments/_tree.segment.rsc +1 -1
  167. package/app/.next/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
  168. package/app/.next/server/app/dashboard/settings/pricing.html +1 -1
  169. package/app/.next/server/app/dashboard/settings/pricing.rsc +2 -2
  170. package/app/.next/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +2 -2
  171. package/app/.next/server/app/dashboard/settings/pricing.segments/_head.segment.rsc +1 -1
  172. package/app/.next/server/app/dashboard/settings/pricing.segments/_index.segment.rsc +2 -2
  173. package/app/.next/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +1 -1
  174. package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +1 -1
  175. package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing.segment.rsc +1 -1
  176. package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings.segment.rsc +1 -1
  177. package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard.segment.rsc +1 -1
  178. package/app/.next/server/app/dashboard/translator.html +1 -1
  179. package/app/.next/server/app/dashboard/translator.rsc +4 -4
  180. package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +2 -2
  181. package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator.segment.rsc +1 -1
  182. package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  183. package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  184. package/app/.next/server/app/dashboard/translator.segments/_full.segment.rsc +4 -4
  185. package/app/.next/server/app/dashboard/translator.segments/_head.segment.rsc +1 -1
  186. package/app/.next/server/app/dashboard/translator.segments/_index.segment.rsc +2 -2
  187. package/app/.next/server/app/dashboard/translator.segments/_tree.segment.rsc +1 -1
  188. package/app/.next/server/app/dashboard/usage.html +1 -1
  189. package/app/.next/server/app/dashboard/usage.rsc +4 -4
  190. package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +2 -2
  191. package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage.segment.rsc +1 -1
  192. package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  193. package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  194. package/app/.next/server/app/dashboard/usage.segments/_full.segment.rsc +4 -4
  195. package/app/.next/server/app/dashboard/usage.segments/_head.segment.rsc +1 -1
  196. package/app/.next/server/app/dashboard/usage.segments/_index.segment.rsc +2 -2
  197. package/app/.next/server/app/dashboard/usage.segments/_tree.segment.rsc +1 -1
  198. package/app/.next/server/app/dashboard.html +1 -1
  199. package/app/.next/server/app/dashboard.rsc +4 -4
  200. package/app/.next/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +2 -2
  201. package/app/.next/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  202. package/app/.next/server/app/dashboard.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  203. package/app/.next/server/app/dashboard.segments/_full.segment.rsc +4 -4
  204. package/app/.next/server/app/dashboard.segments/_head.segment.rsc +1 -1
  205. package/app/.next/server/app/dashboard.segments/_index.segment.rsc +2 -2
  206. package/app/.next/server/app/dashboard.segments/_tree.segment.rsc +1 -1
  207. package/app/.next/server/app/index.html +1 -1
  208. package/app/.next/server/app/index.rsc +2 -2
  209. package/app/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  210. package/app/.next/server/app/index.segments/_full.segment.rsc +2 -2
  211. package/app/.next/server/app/index.segments/_head.segment.rsc +1 -1
  212. package/app/.next/server/app/index.segments/_index.segment.rsc +2 -2
  213. package/app/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  214. package/app/.next/server/app/landing/page_client-reference-manifest.js +1 -1
  215. package/app/.next/server/app/landing.html +1 -1
  216. package/app/.next/server/app/landing.rsc +2 -2
  217. package/app/.next/server/app/landing.segments/_full.segment.rsc +2 -2
  218. package/app/.next/server/app/landing.segments/_head.segment.rsc +1 -1
  219. package/app/.next/server/app/landing.segments/_index.segment.rsc +2 -2
  220. package/app/.next/server/app/landing.segments/_tree.segment.rsc +1 -1
  221. package/app/.next/server/app/landing.segments/landing/__PAGE__.segment.rsc +1 -1
  222. package/app/.next/server/app/landing.segments/landing.segment.rsc +1 -1
  223. package/app/.next/server/app/login/page_client-reference-manifest.js +1 -1
  224. package/app/.next/server/app/login.html +1 -1
  225. package/app/.next/server/app/login.rsc +3 -3
  226. package/app/.next/server/app/login.segments/_full.segment.rsc +3 -3
  227. package/app/.next/server/app/login.segments/_head.segment.rsc +1 -1
  228. package/app/.next/server/app/login.segments/_index.segment.rsc +2 -2
  229. package/app/.next/server/app/login.segments/_tree.segment.rsc +1 -1
  230. package/app/.next/server/app/login.segments/login/__PAGE__.segment.rsc +2 -2
  231. package/app/.next/server/app/login.segments/login.segment.rsc +1 -1
  232. package/app/.next/server/app/page_client-reference-manifest.js +1 -1
  233. package/app/.next/server/app-paths-manifest.json +40 -40
  234. package/app/.next/server/chunks/3110.js +2 -2
  235. package/app/.next/server/chunks/8954.js +1 -1
  236. package/app/.next/server/pages/404.html +1 -1
  237. package/app/.next/server/pages/500.html +2 -2
  238. package/app/.next/server/server-reference-manifest.js +1 -1
  239. package/app/.next/server/server-reference-manifest.json +1 -1
  240. package/app/.next/static/chunks/{1393-3fdad0258c0b525c.js → 1393-e96aa4a79d3e1568.js} +1 -1
  241. package/app/.next/static/chunks/{3624-b4d607564b40b24d.js → 3624-e096f4cf594e2fc8.js} +1 -1
  242. package/app/.next/static/chunks/{8729-9d273189141eb6fb.js → 8729-d228d83251fca5a4.js} +1 -1
  243. package/app/.next/static/chunks/app/(dashboard)/dashboard/endpoint/page-ebe23b0367ddebdc.js +1 -0
  244. package/app/.next/static/chunks/app/(dashboard)/dashboard/page-4940a5acf1d029cb.js +1 -0
  245. package/app/package.json +1 -1
  246. package/app/src/mitm/cert/generate.js +44 -0
  247. package/app/src/mitm/cert/install.js +136 -0
  248. package/app/src/mitm/dns/dnsConfig.js +130 -0
  249. package/app/src/mitm/manager.js +227 -0
  250. package/cli.js +110 -144
  251. package/package.json +1 -1
  252. package/src/cli/utils/input.js +7 -1
  253. package/src/cli/utils/menuHelper.js +2 -1
  254. package/app/.next/static/chunks/app/(dashboard)/dashboard/endpoint/page-000eaf8021eb5f32.js +0 -1
  255. package/app/.next/static/chunks/app/(dashboard)/dashboard/page-acb031d56db92fdf.js +0 -1
  256. /package/app/.next/static/{FcGNHUA9390qBi1g02a_v → VRVsJDwKk6UAo3wjmb_Mu}/_buildManifest.js +0 -0
  257. /package/app/.next/static/{FcGNHUA9390qBi1g02a_v → VRVsJDwKk6UAo3wjmb_Mu}/_ssgManifest.js +0 -0
@@ -1,6 +1,5 @@
1
- (()=>{var a={};a.id=8573,a.ids=[8573],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},9631:(a,b,c)=>{"use strict";let d=c(29021),e=c(55511),{exec:f}=c(79646),{execWithPassword:g}=c(66936),h="win32"===process.platform;function i(a){let b=d.readFileSync(a,"utf-8"),c=Buffer.from(b.replace(/-----[^-]+-----/g,"").replace(/\s/g,""),"base64");return e.createHash("sha1").update(c).digest("hex").toUpperCase().match(/.{2}/g).join(":")}async function j(a){var b;return h?new Promise(a=>{f("certutil -store Root daily-cloudcode-pa.googleapis.com",b=>{a(!b)})}):(b=a,new Promise(a=>{try{let c=i(b);f(`security find-certificate -a -Z /Library/Keychains/System.keychain | grep -i "${c}"`,b=>{a(!b)})}catch{a(!1)}}))}async function k(a,b){let c=`sudo -S security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain "${b}"`;try{await g(c,a),console.log(`✅ Installed certificate to system keychain: ${b}`)}catch(a){throw Error(a.message?.includes("canceled")?"User canceled authorization":"Certificate install failed")}}async function l(a){let b=`Start-Process certutil -ArgumentList '-addstore','Root','${a.replace(/'/g,"''")}' -Verb RunAs -Wait`;return new Promise((a,c)=>{f(`powershell -Command "${b}"`,b=>{b?c(Error(`Failed to install certificate: ${b.message}`)):(console.log(`✅ Installed certificate to Windows Root store`),a())})})}async function m(a,b){let c=i(b).replace(/:/g,""),d=`sudo -S security delete-certificate -Z "${c}" /Library/Keychains/System.keychain`;try{await g(d,a),console.log("✅ Uninstalled certificate from system keychain")}catch(a){throw Error("Failed to uninstall certificate")}}async function n(){return new Promise((a,b)=>{f("powershell -Command \"Start-Process certutil -ArgumentList '-delstore','Root','daily-cloudcode-pa.googleapis.com' -Verb RunAs -Wait\"",c=>{c?b(Error(`Failed to uninstall certificate: ${c.message}`)):(console.log("✅ Uninstalled certificate from Windows Root store"),a())})})}a.exports={installCert:async function(a,b){if(!d.existsSync(b))throw Error(`Certificate file not found: ${b}`);await j(b)?console.log("✅ Certificate already installed"):h?await l(b):await k(a,b)},uninstallCert:async function(a,b){await j(b)?h?await n():await m(a,b):console.log("Certificate not found in system store")},checkCertInstalled:j}},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},12044:(a,b,c)=>{let{X509CertificateGenerator:d,X509Certificate:e,cryptoProvider:f,X509ChainBuilder:g,BasicConstraintsExtension:h,KeyUsagesExtension:i,KeyUsageFlags:j,ExtendedKeyUsageExtension:k,ExtendedKeyUsage:l,SubjectAlternativeNameExtension:m,GeneralName:n}=c(94999),o=c(55511),p=o.webcrypto;function q(a){var b=parseInt(a[0],16);return b<8?a:(b-=8).toString()+a.substring(1)}function r(a){switch(a){case"sha256":return"SHA-256";case"sha384":return"SHA-384";case"sha512":return"SHA-512";default:return"SHA-1"}}function s(a,b){let c=r(a);return"ec"===b?{name:"ECDSA",hash:c}:{name:"RSASSA-PKCS1-v1_5",hash:c}}function t(a){let b=a.keyType||"rsa",c=r(a.algorithm||"sha1");return"ec"===b?{name:"ECDSA",namedCurve:a.curve||"P-256"}:{name:"RSASSA-PKCS1-v1_5",modulusLength:a.keySize||2048,publicExponent:new Uint8Array([1,0,1]),hash:c}}function u(a){let b={commonName:"CN",countryName:"C",ST:"ST",localityName:"L",organizationName:"O",OU:"OU"};return a.map(a=>{let c=a.name||a.shortName,d=b[c]||c;return`${d}=${a.value}`}).join(", ")}async function v(a,b,c){let d,e=o.createPrivateKey(a),f=e.asymmetricKeyType,g=e.export({type:"pkcs8",format:"pem"}).replace(/-----BEGIN PRIVATE KEY-----/,"").replace(/-----END PRIVATE KEY-----/,"").replace(/\s/g,""),h=Buffer.from(g,"base64");return d="ec"===(c||f)?{name:"ECDSA",namedCurve:function(a){let b=a.asymmetricKeyDetails;if(b&&b.namedCurve){var c;return({prime256v1:"P-256",secp384r1:"P-384",secp521r1:"P-521","P-256":"P-256","P-384":"P-384","P-521":"P-521"})[c=b.namedCurve]||c}return"P-256"}(e)}:{name:"RSASSA-PKCS1-v1_5",hash:r(b)},await p.subtle.importKey("pkcs8",h,d,!0,["sign"])}async function w(a,b,c,d){let e,f=a.replace(/-----BEGIN PUBLIC KEY-----/,"").replace(/-----END PUBLIC KEY-----/,"").replace(/\s/g,""),g=Buffer.from(f,"base64");return e="ec"===c?{name:"ECDSA",namedCurve:d||"P-256"}:{name:"RSASSA-PKCS1-v1_5",hash:r(b)},await p.subtle.importKey("spki",g,e,!0,["verify"])}async function x(a,b,c,f){let n,r,{privateKey:w,publicKey:x}=a,y=p.getRandomValues(new Uint8Array(9)),z=q(Buffer.from(y).toString("hex")),A=c.notBeforeDate||new Date;c.notAfterDate?n=c.notAfterDate:(n=new Date(A)).setDate(n.getDate()+365);let B=u(b=b||[{name:"commonName",value:"example.org"},{name:"countryName",value:"US"},{shortName:"ST",value:"Virginia"},{name:"localityName",value:"Blacksburg"},{name:"organizationName",value:"Test"},{shortName:"OU",value:"Test"}]),C=c.keyType||"rsa",D=s(c.algorithm,C),E=b.find(a=>"commonName"===a.name||"CN"===a.shortName),F=E?E.value:"localhost",G=function(a,b){if(!a||0===a.length)return[new h(!1,void 0,!0),new i(j.digitalSignature|j.keyEncipherment,!0),new k([l.serverAuth,l.clientAuth],!1),new m([{type:"dns",value:b},..."localhost"===b?[{type:"ip",value:"127.0.0.1"}]:[]],!1)];let c=[];for(let b of a){let a=b.critical||!1;switch(b.name){case"basicConstraints":c.push(new h(b.cA||!1,b.pathLenConstraint,a));break;case"keyUsage":let d=0;b.digitalSignature&&(d|=j.digitalSignature),(b.nonRepudiation||b.contentCommitment)&&(d|=j.nonRepudiation),b.keyEncipherment&&(d|=j.keyEncipherment),b.dataEncipherment&&(d|=j.dataEncipherment),b.keyAgreement&&(d|=j.keyAgreement),b.keyCertSign&&(d|=j.keyCertSign),b.cRLSign&&(d|=j.cRLSign),b.encipherOnly&&(d|=j.encipherOnly),b.decipherOnly&&(d|=j.decipherOnly),c.push(new i(d,a));break;case"extKeyUsage":let e=[];b.serverAuth&&e.push(l.serverAuth),b.clientAuth&&e.push(l.clientAuth),b.codeSigning&&e.push(l.codeSigning),b.emailProtection&&e.push(l.emailProtection),b.timeStamping&&e.push(l.timeStamping),c.push(new k(e,a));break;case"subjectAltName":let f=(b.altNames||[]).map(a=>{switch(a.type){case 1:return{type:"email",value:a.value};case 2:return{type:"dns",value:a.value};case 6:return{type:"url",value:a.value};case 7:return{type:"ip",value:a.ip||a.value};default:if(a.ip)return{type:"ip",value:a.ip};if(a.dns)return{type:"dns",value:a.dns};if(a.email)return{type:"email",value:a.email};if(a.uri||a.url)return{type:"url",value:a.uri||a.url};return{type:"dns",value:a.value}}});c.push(new m(f,a));break;default:console.warn(`Unknown extension "${b.name}" ignored`)}}return c}(c.extensions,F);if(f){let a=new e(f.cert),b=await v(f.key,c.algorithm||"sha256",C);r=await d.create({serialNumber:z,subject:B,issuer:a.subject,notBefore:A,notAfter:n,signingAlgorithm:D,publicKey:x,signingKey:b,extensions:G})}else r=await d.createSelfSigned({serialNumber:z,name:B,notBefore:A,notAfter:n,signingAlgorithm:D,keys:{privateKey:w,publicKey:x},extensions:G});let H=r.rawData,I=await p.subtle.digest("SHA-1",H),J=Buffer.from(I).toString("hex").match(/.{2}/g).join(":"),K=await p.subtle.exportKey("pkcs8",w),L=await p.subtle.exportKey("spki",x),M={private:c.passphrase?o.createPrivateKey({key:Buffer.from(K),format:"der",type:"pkcs8"}).export({type:"pkcs8",format:"pem",cipher:"aes-256-cbc",passphrase:c.passphrase}):"-----BEGIN PRIVATE KEY-----\n"+Buffer.from(K).toString("base64").match(/.{1,64}/g).join("\n")+"\n-----END PRIVATE KEY-----\n",public:"-----BEGIN PUBLIC KEY-----\n"+Buffer.from(L).toString("base64").match(/.{1,64}/g).join("\n")+"\n-----END PUBLIC KEY-----\n",cert:r.toString("pem"),fingerprint:J};if(c&&c.clientCertificate){let a,e="object"==typeof c.clientCertificate?c.clientCertificate:{},f=e.keySize||c.clientCertificateKeySize||2048,g=e.algorithm||c.algorithm||"sha1",h=e.cn||c.clientCertificateCN||"John Doe jdoe123",i=t({keyType:e.keyType||C,keySize:f,algorithm:g,curve:e.curve||c.curve||"P-256"}),j=await p.subtle.generateKey(i,!0,["sign","verify"]),k=p.getRandomValues(new Uint8Array(9)),l=q(Buffer.from(k).toString("hex")),m=e.notBeforeDate||new Date;e.notAfterDate?a=e.notAfterDate:(a=new Date(m)).setFullYear(m.getFullYear()+1);let n=JSON.parse(JSON.stringify(b));for(let a=0;a<n.length;a++)"commonName"===n[a].name&&(n[a]={name:"commonName",value:h});let o=u(n),r=u(b),v=s(g,C),x=await d.create({serialNumber:l,subject:o,issuer:r,notBefore:m,notAfter:a,signingAlgorithm:v,publicKey:j.publicKey,signingKey:w}),y=await p.subtle.exportKey("pkcs8",j.privateKey),z=await p.subtle.exportKey("spki",j.publicKey);M.clientprivate="-----BEGIN PRIVATE KEY-----\n"+Buffer.from(y).toString("base64").match(/.{1,64}/g).join("\n")+"\n-----END PRIVATE KEY-----\n",M.clientpublic="-----BEGIN PUBLIC KEY-----\n"+Buffer.from(z).toString("base64").match(/.{1,64}/g).join("\n")+"\n-----END PUBLIC KEY-----\n",M.clientcert=x.toString("pem")}let N=new e(r.rawData),O=[N];if(f){let a=new e(f.cert);O.push(a)}let P=new g({certificates:O});if(0===(await P.build(N)).length)throw Error("Certificate could not be verified.");return M}f.set(p),b.generate=async function(a,b){let c;a=a||void 0;let d=(b=b||{}).keyType||"rsa",e=b.curve||"P-256";if(b.keyPair)c={privateKey:await v(b.keyPair.privateKey,b.algorithm||"sha1",d),publicKey:await w(b.keyPair.publicKey,b.algorithm||"sha1",d,e)};else{let a=t(b);c=await p.subtle.generateKey(a,!0,["sign","verify"])}return await x(c,a,b,b.ca)}},21820:a=>{"use strict";a.exports=require("os")},24424:(a,b)=>{"use strict";function c(a){for(let b=0;b<a.length;b++){let c=a[b];if("function"!=typeof c)throw Object.defineProperty(Error(`A "use server" file can only export async functions, found ${typeof c}.
2
- Read more: https://nextjs.org/docs/messages/invalid-use-server-value`),"__NEXT_ERROR_CODE",{value:"E352",enumerable:!1,configurable:!0})}}Object.defineProperty(b,"D",{enumerable:!0,get:function(){return c}})},26033:(a,b,c)=>{"use strict";let d=c(33873),e=c(29021),f=c(21820),g="daily-cloudcode-pa.googleapis.com";a.exports={generateCert:async function(){let a=d.join(f.homedir(),".9router","mitm"),b=d.join(a,"server.key"),h=d.join(a,"server.crt");if(e.existsSync(b)&&e.existsSync(h))return console.log("✅ SSL certificate already exists"),{key:b,cert:h};e.existsSync(a)||e.mkdirSync(a,{recursive:!0});let i=c(12044),j=[{name:"commonName",value:g}],k=new Date;k.setFullYear(k.getFullYear()+1);let l=await i.generate(j,{keySize:2048,algorithm:"sha256",notAfterDate:k,extensions:[{name:"subjectAltName",altNames:[{type:2,value:g}]}]});return e.writeFileSync(b,l.private),e.writeFileSync(h,l.cert),console.log(`✅ Generated SSL certificate for ${g}`),{key:b,cert:h}}}},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{"use strict";a.exports=require("path")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},49796:(a,b,c)=>{"use strict";Object.defineProperty(b,"A",{enumerable:!0,get:function(){return d.registerServerReference}});let d=c(77943)},55511:a=>{"use strict";a.exports=require("crypto")},60488:(a,b,c)=>{"use strict";c.r(b),c.d(b,{handler:()=>A,patchFetch:()=>z,routeModule:()=>v,serverHooks:()=>y,workAsyncStorage:()=>w,workUnitAsyncStorage:()=>x});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527),u=c(86805);let v=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/cli-tools/antigravity-mitm/route",pathname:"/api/cli-tools/antigravity-mitm",filename:"route",bundlePath:"app/api/cli-tools/antigravity-mitm/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Users/Working/router4/app/src/app/api/cli-tools/antigravity-mitm/route.js",nextConfigOutput:"standalone",userland:u}),{workAsyncStorage:w,workUnitAsyncStorage:x,serverHooks:y}=v;function z(){return(0,f.patchFetch)({workAsyncStorage:w,workUnitAsyncStorage:x})}async function A(a,b,c){v.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/cli-tools/antigravity-mitm/route";"/index"===d&&(d="/");let f=await v.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:u,params:w,nextConfig:x,parsedUrl:y,isDraftMode:z,prerenderManifest:A,routerServerContext:B,isOnDemandRevalidate:C,revalidateOnlyGenerated:D,resolvedPathname:E,clientReferenceManifest:F,serverActionsManifest:G}=f,H=(0,j.normalizeAppPath)(d),I=!!(A.dynamicRoutes[H]||A.routes[E]),J=async()=>((null==B?void 0:B.render404)?await B.render404(a,b,y,!1):b.end("This page could not be found"),null);if(I&&!z){let a=!!A.routes[E],b=A.dynamicRoutes[H];if(b&&!1===b.fallback&&!a){if(x.experimental.adapterPath)return await J();throw new s.NoFallbackError}}let K=null;!I||v.isDev||z||(K="/index"===(K=E)?"/":K);let L=!0===v.isDev||!I,M=I&&!L;G&&F&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:F,serverActionsManifest:G});let N=a.method||"GET",O=(0,h.getTracer)(),P=O.getActiveScopeSpan(),Q={params:w,prerenderManifest:A,renderOpts:{experimental:{authInterrupts:!!x.experimental.authInterrupts},cacheComponents:!!x.cacheComponents,supportsDynamicResponse:L,incrementalCache:(0,g.getRequestMeta)(a,"incrementalCache"),cacheLifeProfiles:x.cacheLife,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>v.onRequestError(a,b,d,e,B)},sharedContext:{buildId:u}},R=new k.NodeNextRequest(a),S=new k.NodeNextResponse(b),T=l.NextRequestAdapter.fromNodeNextRequest(R,(0,l.signalFromNodeResponse)(b));try{let f=async a=>v.handle(T,Q).finally(()=>{if(!a)return;a.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let c=O.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route");if(e){let b=`${N} ${e}`;a.setAttributes({"next.route":e,"http.route":e,"next.span_name":b}),a.updateName(b)}else a.updateName(`${N} ${d}`)}),i=!!(0,g.getRequestMeta)(a,"minimalMode"),j=async g=>{var h,j;let k=async({previousCacheEntry:e})=>{try{if(!i&&C&&D&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await f(g);a.fetchMetrics=Q.renderOpts.fetchMetrics;let h=Q.renderOpts.pendingWaitUntil;h&&c.waitUntil&&(c.waitUntil(h),h=void 0);let j=Q.renderOpts.collectedTags;if(!I)return await (0,o.I)(R,S,d,Q.renderOpts.pendingWaitUntil),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);j&&(b[r.NEXT_CACHE_TAGS_HEADER]=j),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==Q.renderOpts.collectedRevalidate&&!(Q.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&Q.renderOpts.collectedRevalidate,e=void 0===Q.renderOpts.collectedExpire||Q.renderOpts.collectedExpire>=r.INFINITE_CACHE?void 0:Q.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await v.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.c)({isStaticGeneration:M,isOnDemandRevalidate:C})},!1,B),b}},l=await v.handleResponse({req:a,nextConfig:x,cacheKey:K,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:A,isRoutePPREnabled:!1,isOnDemandRevalidate:C,revalidateOnlyGenerated:D,responseGenerator:k,waitUntil:c.waitUntil,isMinimalMode:i});if(!I)return null;if((null==l||null==(h=l.value)?void 0:h.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==l||null==(j=l.value)?void 0:j.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});i||b.setHeader("x-nextjs-cache",C?"REVALIDATED":l.isMiss?"MISS":l.isStale?"STALE":"HIT"),z&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let m=(0,p.fromNodeOutgoingHttpHeaders)(l.value.headers);return i&&I||m.delete(r.NEXT_CACHE_TAGS_HEADER),!l.cacheControl||b.getHeader("Cache-Control")||m.get("Cache-Control")||m.set("Cache-Control",(0,q.getCacheControlHeader)(l.cacheControl)),await (0,o.I)(R,S,new Response(l.value.body,{headers:m,status:l.value.status||200})),null};P?await j(P):await O.withPropagatedContext(a.headers,()=>O.trace(m.BaseServerSpan.handleRequest,{spanName:`${N} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":N,"http.target":a.url}},j))}catch(b){if(b instanceof s.NoFallbackError||await v.onRequestError(a,b,{routerKind:"App Router",routePath:H,routeType:"route",revalidateReason:(0,n.c)({isStaticGeneration:M,isOnDemandRevalidate:C})},!1,B),I)throw b;return await (0,o.I)(R,S,new Response(null,{status:500})),null}}},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},66936:(a,b,c)=>{"use strict";let{exec:d}=c(79646),e=c(29021),f=c(33873),g="daily-cloudcode-pa.googleapis.com",h="win32"===process.platform,i=h?f.join(process.env.SystemRoot||"C:\\Windows","System32","drivers","etc","hosts"):"/etc/hosts";function j(a,b){return new Promise((c,e)=>{let f=d(a,(a,b,d)=>{a?e(Error(`Command failed: ${a.message}
3
- ${d}`)):c(b)});f.stdin.write(`${b}
4
- `),f.stdin.end()})}function k(){try{return e.readFileSync(i,"utf8").includes(g)}catch{return!1}}a.exports={addDNSEntry:async function(a){if(k())return void console.log(`DNS entry for ${g} already exists`);let b=`127.0.0.1 ${g}`;try{if(h){var c;await (c=`echo ${b} >> "${i}"`,new Promise((a,b)=>{let e=`Start-Process cmd -ArgumentList '/c','${c.replace(/'/g,"''")}' -Verb RunAs -Wait`;d(`powershell -Command "${e}"`,(c,d,e)=>{c?b(Error(`Elevated command failed: ${c.message}
5
- ${e}`)):a(d)})}))}else{let c=`echo "${b}" | sudo -S tee -a ${i} > /dev/null`;await j(c,a)}console.log(`✅ Added DNS entry: ${b}`)}catch(a){throw Error(`Failed to add DNS entry: ${a.message}`)}},removeDNSEntry:async function(a){if(!k())return void console.log(`DNS entry for ${g} does not exist`);try{if(h){let a=`(Get-Content '${i}') | Where-Object { $_ -notmatch '${g}' } | Set-Content '${i}'`,b=`Start-Process powershell -ArgumentList '-Command','${a.replace(/'/g,"''")}' -Verb RunAs -Wait`;await new Promise((a,c)=>{d(`powershell -Command "${b}"`,b=>{b?c(Error(`Failed to remove DNS entry: ${b.message}`)):a()})})}else{let b=`sudo -S sed -i '' '/${g}/d' ${i}`;await j(b,a)}console.log(`✅ Removed DNS entry for ${g}`)}catch(a){throw Error(`Failed to remove DNS entry: ${a.message}`)}},execWithPassword:j,checkDNSEntry:k}},77719:(a,b,c)=>{"use strict";c.r(b),c.d(b,{"00aa34c5bf3a751e6b691cef2a148c077880fe4ecd":()=>d.GET,"40b00b57e77b9cf0ccfcdd93636c5d2688122a3520":()=>d.DELETE,"40e91203fd199f95fb238abe373bb8e1f5b2d751ff":()=>d.POST});var d=c(86805)},77943:(a,b,c)=>{"use strict";a.exports=c(7553).vendored["react-rsc"].ReactServerDOMWebpackServer},78335:()=>{},79646:a=>{"use strict";a.exports=require("child_process")},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},86718:()=>{var a,b;b=a||(a={}),function(a){var c="object"==typeof globalThis?globalThis:"object"==typeof global?global:"object"==typeof self?self:"object"==typeof this?this:function(){try{return Function("return this;")()}catch(a){}}()||function(){try{return(0,eval)("(function() { return this; })()")}catch(a){}}(),d=e(b);function e(a,b){return function(c,d){Object.defineProperty(a,c,{configurable:!0,writable:!0,value:d}),b&&b(c,d)}}void 0!==c.Reflect&&(d=e(c.Reflect,d)),a(d,c),void 0===c.Reflect&&(c.Reflect=b)}(function(a,b){var c,d=Object.prototype.hasOwnProperty,e="function"==typeof Symbol,f=e&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",g=e&&void 0!==Symbol.iterator?Symbol.iterator:"@@iterator",h="function"==typeof Object.create,i=({__proto__:[]})instanceof Array,j=!h&&!i,k={create:h?function(){return L(Object.create(null))}:i?function(){return L({__proto__:null})}:function(){return L({})},has:j?function(a,b){return d.call(a,b)}:function(a,b){return b in a},get:j?function(a,b){return d.call(a,b)?a[b]:void 0}:function(a,b){return a[b]}},l=Object.getPrototypeOf(Function),m="function"==typeof Map&&"function"==typeof Map.prototype.entries?Map:function(){var a={},b=[],c=function(){function a(a,b,c){this._index=0,this._keys=a,this._values=b,this._selector=c}return a.prototype["@@iterator"]=function(){return this},a.prototype[g]=function(){return this},a.prototype.next=function(){var a=this._index;if(a>=0&&a<this._keys.length){var c=this._selector(this._keys[a],this._values[a]);return a+1>=this._keys.length?(this._index=-1,this._keys=b,this._values=b):this._index++,{value:c,done:!1}}return{value:void 0,done:!0}},a.prototype.throw=function(a){throw this._index>=0&&(this._index=-1,this._keys=b,this._values=b),a},a.prototype.return=function(a){return this._index>=0&&(this._index=-1,this._keys=b,this._values=b),{value:a,done:!0}},a}();function d(){this._keys=[],this._values=[],this._cacheKey=a,this._cacheIndex=-2}return Object.defineProperty(d.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),d.prototype.has=function(a){return this._find(a,!1)>=0},d.prototype.get=function(a){var b=this._find(a,!1);return b>=0?this._values[b]:void 0},d.prototype.set=function(a,b){var c=this._find(a,!0);return this._values[c]=b,this},d.prototype.delete=function(b){var c=this._find(b,!1);if(c>=0){for(var d=this._keys.length,e=c+1;e<d;e++)this._keys[e-1]=this._keys[e],this._values[e-1]=this._values[e];return this._keys.length--,this._values.length--,E(b,this._cacheKey)&&(this._cacheKey=a,this._cacheIndex=-2),!0}return!1},d.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=a,this._cacheIndex=-2},d.prototype.keys=function(){return new c(this._keys,this._values,e)},d.prototype.values=function(){return new c(this._keys,this._values,f)},d.prototype.entries=function(){return new c(this._keys,this._values,h)},d.prototype["@@iterator"]=function(){return this.entries()},d.prototype[g]=function(){return this.entries()},d.prototype._find=function(a,b){if(!E(this._cacheKey,a)){this._cacheIndex=-1;for(var c=0;c<this._keys.length;c++)if(E(this._keys[c],a)){this._cacheIndex=c;break}}return this._cacheIndex<0&&b&&(this._cacheIndex=this._keys.length,this._keys.push(a),this._values.push(void 0)),this._cacheIndex},d;function e(a,b){return a}function f(a,b){return b}function h(a,b){return[a,b]}}(),n="function"==typeof Set&&"function"==typeof Set.prototype.entries?Set:function(){function a(){this._map=new m}return Object.defineProperty(a.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),a.prototype.has=function(a){return this._map.has(a)},a.prototype.add=function(a){return this._map.set(a,a),this},a.prototype.delete=function(a){return this._map.delete(a)},a.prototype.clear=function(){this._map.clear()},a.prototype.keys=function(){return this._map.keys()},a.prototype.values=function(){return this._map.keys()},a.prototype.entries=function(){return this._map.entries()},a.prototype["@@iterator"]=function(){return this.keys()},a.prototype[g]=function(){return this.keys()},a}(),o="function"==typeof WeakMap?WeakMap:function(){var a=k.create(),b=e();function c(){this._key=e()}return c.prototype.has=function(a){var b=f(a,!1);return void 0!==b&&k.has(b,this._key)},c.prototype.get=function(a){var b=f(a,!1);return void 0!==b?k.get(b,this._key):void 0},c.prototype.set=function(a,b){return f(a,!0)[this._key]=b,this},c.prototype.delete=function(a){var b=f(a,!1);return void 0!==b&&delete b[this._key]},c.prototype.clear=function(){this._key=e()},c;function e(){var b;do b="@@WeakMap@@"+function(){var a=function(a){if("function"==typeof Uint8Array){var b=new Uint8Array(16);return"u">typeof crypto?crypto.getRandomValues(b):"u">typeof msCrypto?msCrypto.getRandomValues(b):g(b,16),b}return g(Array(16),16)}(0);a[6]=79&a[6]|64,a[8]=191&a[8]|128;for(var b="",c=0;c<16;++c){var d=a[c];(4===c||6===c||8===c)&&(b+="-"),d<16&&(b+="0"),b+=d.toString(16).toLowerCase()}return b}();while(k.has(a,b));return a[b]=!0,b}function f(a,c){if(!d.call(a,b)){if(!c)return;Object.defineProperty(a,b,{value:k.create()})}return a[b]}function g(a,b){for(var c=0;c<b;++c)a[c]=255*Math.random()|0;return a}}(),p=e?Symbol.for("@reflect-metadata:registry"):void 0,q=(!x(p)&&z(b.Reflect)&&Object.isExtensible(b.Reflect)&&(c=b.Reflect[p]),x(c)&&(c=function(){x(p)||void 0===b.Reflect||p in b.Reflect||"function"!=typeof b.Reflect.defineMetadata||(c=(a=b.Reflect).defineMetadata,d=a.hasOwnMetadata,e=a.getOwnMetadata,f=a.getOwnMetadataKeys,g=a.deleteMetadata,h=new o,i={isProviderFor:function(a,b){var c=h.get(a);return!!(!x(c)&&c.has(b))||!!f(a,b).length&&(x(c)&&(c=new n,h.set(a,c)),c.add(b),!0)},OrdinaryDefineOwnMetadata:c,OrdinaryHasOwnMetadata:d,OrdinaryGetOwnMetadata:e,OrdinaryOwnMetadataKeys:f,OrdinaryDeleteMetadata:g});var a,c,d,e,f,g,h,i,j,k,l,q=new o,r={registerProvider:function(a){if(!Object.isExtensible(r))throw Error("Cannot add provider to a frozen registry.");switch(!0){case i===a:break;case x(j):j=a;break;case j===a:break;case x(k):k=a;break;case k===a:break;default:void 0===l&&(l=new n),l.add(a)}},getProvider:s,setProvider:function(a,b,c){if(!function(a){if(x(a))throw TypeError();return j===a||k===a||!x(l)&&l.has(a)}(c))throw Error("Metadata provider not registered.");var d=s(a,b);if(d!==c){if(!x(d))return!1;var e=q.get(a);x(e)&&(e=new m,q.set(a,e)),e.set(b,c)}return!0}};return r;function s(a,b){var c,d=q.get(a);return x(d)||(c=d.get(b)),x(c)&&(c=function(a,b){if(!x(j)){if(j.isProviderFor(a,b))return j;if(!x(k)){if(k.isProviderFor(a,b))return j;if(!x(l))for(var c=G(l);;){var d=H(c);if(!d)return;var e=d.value;if(e.isProviderFor(a,b))return I(c),e}}}if(!x(i)&&i.isProviderFor(a,b))return i}(a,b),x(c)||(x(d)&&(d=new m,q.set(a,d)),d.set(b,c))),c}}()),!x(p)&&z(b.Reflect)&&Object.isExtensible(b.Reflect)&&Object.defineProperty(b.Reflect,p,{enumerable:!1,configurable:!1,writable:!1,value:c}),c),r=function(a){var b=new o,c={isProviderFor:function(a,c){var d=b.get(a);return!x(d)&&d.has(c)},OrdinaryDefineOwnMetadata:function(a,b,c,e){d(c,e,!0).set(a,b)},OrdinaryHasOwnMetadata:function(a,b,c){var e=d(b,c,!1);return!x(e)&&!!e.has(a)},OrdinaryGetOwnMetadata:function(a,b,c){var e=d(b,c,!1);if(!x(e))return e.get(a)},OrdinaryOwnMetadataKeys:function(a,b){var c=[],e=d(a,b,!1);if(x(e))return c;for(var f=G(e.keys()),g=0;;){var h=H(f);if(!h)return c.length=g,c;var i=h.value;try{c[g]=i}catch(a){try{I(f)}finally{throw a}}g++}},OrdinaryDeleteMetadata:function(a,c,e){var f=d(c,e,!1);if(x(f)||!f.delete(a))return!1;if(0===f.size){var g=b.get(c);x(g)||(g.delete(e),0===g.size&&b.delete(g))}return!0}};return q.registerProvider(c),c;function d(d,e,f){var g=b.get(d),h=!1;if(x(g)){if(!f)return;g=new m,b.set(d,g),h=!0}var i=g.get(e);if(x(i)){if(!f)return;if(i=new m,g.set(e,i),!a.setProvider(d,e,c))throw g.delete(e),h&&b.delete(d),Error("Wrong provider for target.")}return i}}(q);function s(a,b,c){var d=K(b,c,!1);return!x(d)&&!!d.OrdinaryHasOwnMetadata(a,b,c)}function t(a,b,c){var d=K(b,c,!1);if(!x(d))return d.OrdinaryGetOwnMetadata(a,b,c)}function u(a,b,c,d){K(c,d,!0).OrdinaryDefineOwnMetadata(a,b,c,d)}function v(a,b){var c=K(a,b,!1);return c?c.OrdinaryOwnMetadataKeys(a,b):[]}function w(a){if(null===a)return 1;switch(typeof a){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===a?1:6;default:return 6}}function x(a){return void 0===a}function y(a){return null===a}function z(a){return"object"==typeof a?null!==a:"function"==typeof a}a("decorate",function(a,b,c,d){if(x(c)){if(!B(a)||!D(b))throw TypeError();for(var e=a,f=b,g=e.length-1;g>=0;--g){var h=(0,e[g])(f);if(!x(h)&&!y(h)){if(!D(h))throw TypeError();f=h}}return f}if(!B(a)||!z(b)||!z(d)&&!x(d)&&!y(d))throw TypeError();return y(d)&&(d=void 0),function(a,b,c,d){for(var e=a.length-1;e>=0;--e){var f=(0,a[e])(b,c,d);if(!x(f)&&!y(f)){if(!z(f))throw TypeError();d=f}}return d}(a,b,c=A(c),d)}),a("metadata",function(a,b){return function(c,d){if(!z(c)||!x(d)&&!function(a){switch(w(a)){case 3:case 4:return!0;default:return!1}}(d))throw TypeError();u(a,b,c,d)}}),a("defineMetadata",function(a,b,c,d){if(!z(c))throw TypeError();return x(d)||(d=A(d)),u(a,b,c,d)}),a("hasMetadata",function(a,b,c){if(!z(b))throw TypeError();return x(c)||(c=A(c)),function a(b,c,d){if(s(b,c,d))return!0;var e=J(c);return!y(e)&&a(b,e,d)}(a,b,c)}),a("hasOwnMetadata",function(a,b,c){if(!z(b))throw TypeError();return x(c)||(c=A(c)),s(a,b,c)}),a("getMetadata",function(a,b,c){if(!z(b))throw TypeError();return x(c)||(c=A(c)),function a(b,c,d){if(s(b,c,d))return t(b,c,d);var e=J(c);if(!y(e))return a(b,e,d)}(a,b,c)}),a("getOwnMetadata",function(a,b,c){if(!z(b))throw TypeError();return x(c)||(c=A(c)),t(a,b,c)}),a("getMetadataKeys",function(a,b){if(!z(a))throw TypeError();return x(b)||(b=A(b)),function a(b,c){var d=v(b,c),e=J(b);if(null===e)return d;var f=a(e,c);if(f.length<=0)return d;if(d.length<=0)return f;for(var g=new n,h=[],i=0;i<d.length;i++){var j=d[i],k=g.has(j);k||(g.add(j),h.push(j))}for(var l=0;l<f.length;l++){var j=f[l],k=g.has(j);k||(g.add(j),h.push(j))}return h}(a,b)}),a("getOwnMetadataKeys",function(a,b){if(!z(a))throw TypeError();return x(b)||(b=A(b)),v(a,b)}),a("deleteMetadata",function(a,b,c){if(!z(b)||(x(c)||(c=A(c)),!z(b)))throw TypeError();x(c)||(c=A(c));var d=K(b,c,!1);return!x(d)&&d.OrdinaryDeleteMetadata(a,b,c)});function A(a){var b=function(a,b){switch(w(a)){case 0:case 1:case 2:case 3:case 4:case 5:return a}var c="string",d=F(a,f);if(void 0!==d){var e=d.call(a,c);if(z(e))throw TypeError();return e}return function(a,b){if("string"===b){var c=a.toString;if(C(c)){var d=c.call(a);if(!z(d))return d}var e=a.valueOf;if(C(e)){var d=e.call(a);if(!z(d))return d}}else{var e=a.valueOf;if(C(e)){var d=e.call(a);if(!z(d))return d}var f=a.toString;if(C(f)){var d=f.call(a);if(!z(d))return d}}throw TypeError()}(a,c)}(a,0);return"symbol"==typeof b?b:""+b}function B(a){return Array.isArray?Array.isArray(a):a instanceof Object?a instanceof Array:"[object Array]"===Object.prototype.toString.call(a)}function C(a){return"function"==typeof a}function D(a){return"function"==typeof a}function E(a,b){return a===b||a!=a&&b!=b}function F(a,b){var c=a[b];if(null!=c){if(!C(c))throw TypeError();return c}}function G(a){var b=F(a,g);if(!C(b))throw TypeError();var c=b.call(a);if(!z(c))throw TypeError();return c}function H(a){var b=a.next();return!b.done&&b}function I(a){var b=a.return;b&&b.call(a)}function J(a){var b=Object.getPrototypeOf(a);if("function"!=typeof a||a===l||b!==l)return b;var c=a.prototype,d=c&&Object.getPrototypeOf(c);if(null==d||d===Object.prototype)return b;var e=d.constructor;return"function"!=typeof e||e===a?b:e}function K(a,b,c){var d=q.getProvider(a,b);if(!x(d))return d;if(c){if(q.setProvider(a,b,r))return r;throw Error("Illegal state.")}}function L(a){return a.__=void 0,delete a.__,a}})},86805:(a,b,c)=>{"use strict";c.r(b),c.d(b,{DELETE:()=>i,GET:()=>g,POST:()=>h});var d=c(49796),e=c(45592),f=c(96182);async function g(){try{let a=await (0,f.getMitmStatus)();return e.NextResponse.json({running:a.running,pid:a.pid||null,dnsConfigured:a.dnsConfigured||!1,certExists:a.certExists||!1,hasCachedPassword:!!(0,f.getCachedPassword)()})}catch(a){return console.log("Error getting MITM status:",a.message),e.NextResponse.json({error:"Failed to get MITM status"},{status:500})}}async function h(a){try{let{apiKey:b,sudoPassword:c}=await a.json(),d="win32"===process.platform,g=c||(0,f.getCachedPassword)()||"";if(!b||!d&&!g)return e.NextResponse.json({error:d?"Missing apiKey":"Missing apiKey or sudoPassword"},{status:400});let h=await (0,f.startMitm)(b,g);return d||(0,f.setCachedPassword)(g),e.NextResponse.json({success:!0,running:h.running,pid:h.pid})}catch(a){return console.log("Error starting MITM:",a.message),e.NextResponse.json({error:a.message||"Failed to start MITM proxy"},{status:500})}}async function i(a){try{let{sudoPassword:b}=await a.json(),c="win32"===process.platform,d=b||(0,f.getCachedPassword)()||"";if(!c&&!d)return e.NextResponse.json({error:"Missing sudoPassword"},{status:400});return await (0,f.stopMitm)(d),!c&&b&&(0,f.setCachedPassword)(b),e.NextResponse.json({success:!0,running:!1})}catch(a){return console.log("Error stopping MITM:",a.message),e.NextResponse.json({error:a.message||"Failed to stop MITM proxy"},{status:500})}}(0,c(24424).D)([g,h,i]),(0,d.A)(g,"00aa34c5bf3a751e6b691cef2a148c077880fe4ecd",null),(0,d.A)(h,"40e91203fd199f95fb238abe373bb8e1f5b2d751ff",null),(0,d.A)(i,"40b00b57e77b9cf0ccfcdd93636c5d2688122a3520",null)},94999:(a,b,c)=>{"use strict";c.r(b),c.d(b,{AlgorithmProvider:()=>hy,AsnData:()=>h9,AsnDefaultSignatureFormatter:()=>i1,AsnEcSignatureFormatter:()=>i4,Attribute:()=>iY,AttributeFactory:()=>i_,AuthorityInfoAccessExtension:()=>iU,AuthorityKeyIdentifierExtension:()=>iL,BasicConstraintsExtension:()=>iM,CRLDistributionPointsExtension:()=>iT,CertificatePolicyExtension:()=>iS,ChallengePasswordAttribute:()=>iZ,CryptoProvider:()=>ib,DN:()=>ir,DNS:()=>iq,DefaultAlgorithmSerializer:()=>h6,EMAIL:()=>is,EcAlgorithm:()=>h2,EdAlgorithm:()=>i9,ExtendedKeyUsage:()=>av,ExtendedKeyUsageExtension:()=>iN,Extension:()=>ia,ExtensionFactory:()=>iR,ExtensionsAttribute:()=>i$,GUID:()=>iv,GeneralName:()=>iy,GeneralNames:()=>iz,IP:()=>it,IssuerAlternativeNameExtension:()=>iX,KeyUsageFlags:()=>aw,KeyUsagesExtension:()=>iO,Name:()=>ii,NameIdentifier:()=>ie,OidSerializer:()=>h7,PemConverter:()=>iI,PemData:()=>iJ,Pkcs10CertificateRequest:()=>ja,Pkcs10CertificateRequestGenerator:()=>jb,PublicKey:()=>iK,REGISTERED_ID:()=>ix,RsaAlgorithm:()=>i2,ShaAlgorithm:()=>i3,SubjectAlternativeNameExtension:()=>iQ,SubjectKeyIdentifierExtension:()=>iP,TextConverter:()=>h8,TextObject:()=>h5,UPN:()=>iw,URL:()=>iu,X509Certificate:()=>jc,X509CertificateGenerator:()=>jg,X509Certificates:()=>jd,X509ChainBuilder:()=>je,X509Crl:()=>ji,X509CrlEntry:()=>jh,X509CrlGenerator:()=>jj,X509CrlReason:()=>aX,cryptoProvider:()=>ic,diAlgorithm:()=>hx,diAlgorithmProvider:()=>hz,diAsnSignatureFormatter:()=>i0,idEd25519:()=>i7,idEd448:()=>i8,idX25519:()=>i5,idX448:()=>i6});var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,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,$,_,aa,ab,ac,ad,ae,af,ag,ah,ai,aj,ak,al,am,an,ao,ap,aq,ar,as,at,au,av,aw,ax,ay,az,aA,aB,aC,aD,aE,aF,aG,aH,aI,aJ,aK,aL,aM,aN,aO,aP,aQ,aR,aS,aT,aU,aV,aW,aX,aY,aZ,a$,a_,a0,a1,a2,a3={};c.r(a3),c.d(a3,{Any:()=>cr,BaseBlock:()=>bB,BaseStringBlock:()=>bC,BitString:()=>bR,BmpString:()=>b8,Boolean:()=>bN,CharacterString:()=>cj,Choice:()=>cs,Constructed:()=>bI,DATE:()=>cm,DateTime:()=>co,Duration:()=>cp,EndOfContent:()=>bK,Enumerated:()=>bV,GeneralString:()=>ci,GeneralizedTime:()=>cl,GraphicString:()=>cg,HexBlock:()=>bv,IA5String:()=>cf,Integer:()=>bU,Null:()=>bL,NumericString:()=>cb,ObjectIdentifier:()=>bY,OctetString:()=>bP,Primitive:()=>bE,PrintableString:()=>cc,RawData:()=>cu,RelativeObjectIdentifier:()=>b_,Repeated:()=>ct,Sequence:()=>b0,Set:()=>b1,TIME:()=>cq,TeletexString:()=>cd,TimeOfDay:()=>cn,UTCTime:()=>ck,UniversalString:()=>ca,Utf8String:()=>b6,ValueBlock:()=>bx,VideotexString:()=>ce,ViewWriter:()=>bl,VisibleString:()=>ch,compareSchema:()=>cv,fromBER:()=>bG,verifySchema:()=>cw}),c(86718);class a4{static isArrayBuffer(a){return"[object ArrayBuffer]"===Object.prototype.toString.call(a)}static toArrayBuffer(a){return this.isArrayBuffer(a)?a:a.byteLength===a.buffer.byteLength||0===a.byteOffset&&a.byteLength===a.buffer.byteLength?a.buffer:this.toUint8Array(a.buffer).slice(a.byteOffset,a.byteOffset+a.byteLength).buffer}static toUint8Array(a){return this.toView(a,Uint8Array)}static toView(a,b){if(a.constructor===b)return a;if(this.isArrayBuffer(a))return new b(a);if(this.isArrayBufferView(a))return new b(a.buffer,a.byteOffset,a.byteLength);throw TypeError("The provided value is not of type '(ArrayBuffer or ArrayBufferView)'")}static isBufferSource(a){return this.isArrayBufferView(a)||this.isArrayBuffer(a)}static isArrayBufferView(a){return ArrayBuffer.isView(a)||a&&this.isArrayBuffer(a.buffer)}static isEqual(a,b){let c=a4.toUint8Array(a),d=a4.toUint8Array(b);if(c.length!==d.byteLength)return!1;for(let a=0;a<c.length;a++)if(c[a]!==d[a])return!1;return!0}static concat(...a){let b;b=!Array.isArray(a[0])||a[1]instanceof Function?Array.isArray(a[0])&&a[1]instanceof Function?a[0]:a[a.length-1]instanceof Function?a.slice(0,a.length-1):a:a[0];let c=0;for(let a of b)c+=a.byteLength;let d=new Uint8Array(c),e=0;for(let a of b){let b=this.toUint8Array(a);d.set(b,e),e+=b.length}return a[a.length-1]instanceof Function?this.toView(d,a[a.length-1]):d.buffer}}let a5="string",a6=/^[0-9a-f\s]+$/i,a7=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,a8=/^[a-zA-Z0-9-_]+$/;class a9{static fromString(a){let b=unescape(encodeURIComponent(a)),c=new Uint8Array(b.length);for(let a=0;a<b.length;a++)c[a]=b.charCodeAt(a);return c.buffer}static toString(a){let b=a4.toUint8Array(a),c="";for(let a=0;a<b.length;a++)c+=String.fromCharCode(b[a]);return decodeURIComponent(escape(c))}}class ba{static toString(a,b=!1){let c=a4.toArrayBuffer(a),d=new DataView(c),e="";for(let a=0;a<c.byteLength;a+=2)e+=String.fromCharCode(d.getUint16(a,b));return e}static fromString(a,b=!1){let c=new ArrayBuffer(2*a.length),d=new DataView(c);for(let c=0;c<a.length;c++)d.setUint16(2*c,a.charCodeAt(c),b);return c}}class bb{static isHex(a){return typeof a===a5&&a6.test(a)}static isBase64(a){return typeof a===a5&&a7.test(a)}static isBase64Url(a){return typeof a===a5&&a8.test(a)}static ToString(a,b="utf8"){let c=a4.toUint8Array(a);switch(b.toLowerCase()){case"utf8":return this.ToUtf8String(c);case"binary":return this.ToBinary(c);case"hex":return this.ToHex(c);case"base64":return this.ToBase64(c);case"base64url":return this.ToBase64Url(c);case"utf16le":return ba.toString(c,!0);case"utf16":case"utf16be":return ba.toString(c);default:throw Error(`Unknown type of encoding '${b}'`)}}static FromString(a,b="utf8"){if(!a)return new ArrayBuffer(0);switch(b.toLowerCase()){case"utf8":return this.FromUtf8String(a);case"binary":return this.FromBinary(a);case"hex":return this.FromHex(a);case"base64":return this.FromBase64(a);case"base64url":return this.FromBase64Url(a);case"utf16le":return ba.fromString(a,!0);case"utf16":case"utf16be":return ba.fromString(a);default:throw Error(`Unknown type of encoding '${b}'`)}}static ToBase64(a){let b=a4.toUint8Array(a);return"u">typeof btoa?btoa(this.ToString(b,"binary")):Buffer.from(b).toString("base64")}static FromBase64(a){let b=this.formatString(a);if(!b)return new ArrayBuffer(0);if(!bb.isBase64(b))throw TypeError("Argument 'base64Text' is not Base64 encoded");return"u">typeof atob?this.FromBinary(atob(b)):new Uint8Array(Buffer.from(b,"base64")).buffer}static FromBase64Url(a){let b=this.formatString(a);if(!b)return new ArrayBuffer(0);if(!bb.isBase64Url(b))throw TypeError("Argument 'base64url' is not Base64Url encoded");return this.FromBase64(this.Base64Padding(b.replace(/\-/g,"+").replace(/\_/g,"/")))}static ToBase64Url(a){return this.ToBase64(a).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}static FromUtf8String(a,b=bb.DEFAULT_UTF8_ENCODING){switch(b){case"ascii":return this.FromBinary(a);case"utf8":return a9.fromString(a);case"utf16":case"utf16be":return ba.fromString(a);case"utf16le":case"usc2":return ba.fromString(a,!0);default:throw Error(`Unknown type of encoding '${b}'`)}}static ToUtf8String(a,b=bb.DEFAULT_UTF8_ENCODING){switch(b){case"ascii":return this.ToBinary(a);case"utf8":return a9.toString(a);case"utf16":case"utf16be":return ba.toString(a);case"utf16le":case"usc2":return ba.toString(a,!0);default:throw Error(`Unknown type of encoding '${b}'`)}}static FromBinary(a){let b=a.length,c=new Uint8Array(b);for(let d=0;d<b;d++)c[d]=a.charCodeAt(d);return c.buffer}static ToBinary(a){let b=a4.toUint8Array(a),c="";for(let a=0;a<b.length;a++)c+=String.fromCharCode(b[a]);return c}static ToHex(a){let b=a4.toUint8Array(a),c="",d=b.length;for(let a=0;a<d;a++){let d=b[a];d<16&&(c+="0"),c+=d.toString(16)}return c}static FromHex(a){let b=this.formatString(a);if(!b)return new ArrayBuffer(0);if(!bb.isHex(b))throw TypeError("Argument 'hexString' is not HEX encoded");b.length%2&&(b=`0${b}`);let c=new Uint8Array(b.length/2);for(let a=0;a<b.length;a+=2){let d=b.slice(a,a+2);c[a/2]=parseInt(d,16)}return c.buffer}static ToUtf16String(a,b=!1){return ba.toString(a,b)}static FromUtf16String(a,b=!1){return ba.fromString(a,b)}static Base64Padding(a){let b=4-a.length%4;if(b<4)for(let c=0;c<b;c++)a+="=";return a}static formatString(a){return(null==a?void 0:a.replace(/[\n\r\t ]/g,""))||""}}function bc(a,b){if(!(a&&b)||a.byteLength!==b.byteLength)return!1;let c=new Uint8Array(a),d=new Uint8Array(b);for(let b=0;b<a.byteLength;b++)if(c[b]!==d[b])return!1;return!0}function bd(a,b){let c=0;if(1===a.length)return a[0];for(let d=a.length-1;d>=0;d--)c+=a[a.length-1-d]*Math.pow(2,b*d);return c}function be(a,b,c=-1){let d=a,e=0,f=Math.pow(2,b);for(let g=1;g<8;g++){if(a<f){let a;if(c<0)a=new ArrayBuffer(g),e=g;else{if(c<g)return new ArrayBuffer(0);a=new ArrayBuffer(c),e=c}let f=new Uint8Array(a);for(let a=g-1;a>=0;a--){let c=Math.pow(2,a*b);f[e-a-1]=Math.floor(d/c),d-=f[e-a-1]*c}return a}f*=Math.pow(2,b)}return new ArrayBuffer(0)}function bf(...a){let b=0,c=0;for(let c of a)b+=c.length;let d=new Uint8Array(new ArrayBuffer(b));for(let b of a)d.set(b,c),c+=b.length;return d}function bg(){let a=new Uint8Array(this.valueHex);if(this.valueHex.byteLength>=2){let b=255===a[0]&&128&a[1],c=0===a[0]&&(128&a[1])==0;(b||c)&&this.warnings.push("Needlessly long format")}let b=new Uint8Array(new ArrayBuffer(this.valueHex.byteLength));for(let a=0;a<this.valueHex.byteLength;a++)b[a]=0;b[0]=128&a[0];let c=bd(b,8),d=new Uint8Array(new ArrayBuffer(this.valueHex.byteLength));for(let b=0;b<this.valueHex.byteLength;b++)d[b]=a[b];return d[0]&=127,bd(d,8)-c}function bh(a,b){let c=a.toString(10);if(b<c.length)return"";let d=b-c.length,e=Array(d);for(let a=0;a<d;a++)e[a]="0";return e.join("").concat(c)}function bi(){if("u"<typeof BigInt)throw Error("BigInt is not defined. Your environment doesn't implement BigInt.")}function bj(a){let b=0,c=0;for(let c=0;c<a.length;c++)b+=a[c].byteLength;let d=new Uint8Array(b);for(let b=0;b<a.length;b++){let e=a[b];d.set(new Uint8Array(e),c),c+=e.byteLength}return d.buffer}function bk(a,b,c,d){return b instanceof Uint8Array?b.byteLength?c<0?(a.error="Wrong parameter: inputOffset less than zero",!1):d<0?(a.error="Wrong parameter: inputLength less than zero",!1):!(b.byteLength-c-d<0)||(a.error="End of input reached before message was fully decoded (inconsistent offset and length values)",!1):(a.error="Wrong parameter: inputBuffer has zero length",!1):(a.error="Wrong parameter: inputBuffer must be 'Uint8Array'",!1)}bb.DEFAULT_UTF8_ENCODING="utf8";class bl{constructor(){this.items=[]}write(a){this.items.push(a)}final(){return bj(this.items)}}let bm=[new Uint8Array([1])],bn="0123456789",bo="name",bp="valueHexView",bq=new ArrayBuffer(0),br=new Uint8Array(0),bs="EndOfContent",bt="OCTET STRING",bu="BIT STRING";function bv(a){var b;return(b=class extends a{get valueHex(){return this.valueHexView.slice().buffer}set valueHex(a){this.valueHexView=new Uint8Array(a)}constructor(...a){var b;super(...a);const c=a[0]||{};this.isHexOnly=null!=(b=c.isHexOnly)&&b,this.valueHexView=c.valueHex?a4.toUint8Array(c.valueHex):br}fromBER(a,b,c){let d=a instanceof ArrayBuffer?new Uint8Array(a):a;if(!bk(this,d,b,c))return -1;let e=b+c;return(this.valueHexView=d.subarray(b,e),this.valueHexView.length)?(this.blockLength=c,e):(this.warnings.push("Zero buffer length"),b)}toBER(a=!1){return this.isHexOnly?a?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.byteLength===this.valueHexView.buffer.byteLength?this.valueHexView.buffer:this.valueHexView.slice().buffer:(this.error="Flag 'isHexOnly' is not set, abort",bq)}toJSON(){return{...super.toJSON(),isHexOnly:this.isHexOnly,valueHex:bb.ToHex(this.valueHexView)}}}).NAME="hexBlock",b}class bw{static blockName(){return this.NAME}get valueBeforeDecode(){return this.valueBeforeDecodeView.slice().buffer}set valueBeforeDecode(a){this.valueBeforeDecodeView=new Uint8Array(a)}constructor({blockLength:a=0,error:b="",warnings:c=[],valueBeforeDecode:d=br}={}){this.blockLength=a,this.error=b,this.warnings=c,this.valueBeforeDecodeView=a4.toUint8Array(d)}toJSON(){return{blockName:this.constructor.NAME,blockLength:this.blockLength,error:this.error,warnings:this.warnings,valueBeforeDecode:bb.ToHex(this.valueBeforeDecodeView)}}}bw.NAME="baseBlock";class bx extends bw{fromBER(a,b,c){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}toBER(a,b){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}}bx.NAME="valueBlock";class by extends bv(bw){constructor({idBlock:a={}}={}){var b,c,d,e;super(),a?(this.isHexOnly=null!=(b=a.isHexOnly)&&b,this.valueHexView=a.valueHex?a4.toUint8Array(a.valueHex):br,this.tagClass=null!=(c=a.tagClass)?c:-1,this.tagNumber=null!=(d=a.tagNumber)?d:-1,this.isConstructed=null!=(e=a.isConstructed)&&e):(this.tagClass=-1,this.tagNumber=-1,this.isConstructed=!1)}toBER(a=!1){let b=0;switch(this.tagClass){case 1:b|=0;break;case 2:b|=64;break;case 3:b|=128;break;case 4:b|=192;break;default:return this.error="Unknown tag class",bq}if(this.isConstructed&&(b|=32),this.tagNumber<31&&!this.isHexOnly){let c=new Uint8Array(1);if(!a){let a=this.tagNumber;a&=31,b|=a,c[0]=b}return c.buffer}if(!this.isHexOnly){let c=be(this.tagNumber,7),d=new Uint8Array(c),e=c.byteLength,f=new Uint8Array(e+1);if(f[0]=31|b,!a){for(let a=0;a<e-1;a++)f[a+1]=128|d[a];f[e]=d[e-1]}return f.buffer}let c=new Uint8Array(this.valueHexView.byteLength+1);if(c[0]=31|b,!a){let a=this.valueHexView;for(let b=0;b<a.length-1;b++)c[b+1]=128|a[b];c[this.valueHexView.byteLength]=a[a.length-1]}return c.buffer}fromBER(a,b,c){let d=a4.toUint8Array(a);if(!bk(this,d,b,c))return -1;let e=d.subarray(b,b+c);if(0===e.length)return this.error="Zero buffer length",-1;switch(192&e[0]){case 0:this.tagClass=1;break;case 64:this.tagClass=2;break;case 128:this.tagClass=3;break;case 192:this.tagClass=4;break;default:return this.error="Unknown tag class",-1}this.isConstructed=(32&e[0])==32,this.isHexOnly=!1;let f=31&e[0];if(31!==f)this.tagNumber=f,this.blockLength=1;else{let a=1,b=this.valueHexView=new Uint8Array(255),c=255;for(;128&e[a];){if(b[a-1]=127&e[a],++a>=e.length)return this.error="End of input reached before message was fully decoded",-1;if(a===c){let a=new Uint8Array(c+=255);for(let c=0;c<b.length;c++)a[c]=b[c];b=this.valueHexView=new Uint8Array(c)}}this.blockLength=a+1,b[a-1]=127&e[a];let d=new Uint8Array(a);for(let c=0;c<a;c++)d[c]=b[c];(b=this.valueHexView=new Uint8Array(a)).set(d),this.blockLength<=9?this.tagNumber=bd(b,7):(this.isHexOnly=!0,this.warnings.push("Tag too long, represented as hex-coded"))}if(1===this.tagClass&&this.isConstructed)switch(this.tagNumber){case 1:case 2:case 5:case 6:case 9:case 13:case 14:case 23:case 24:case 31:case 32:case 33:case 34:return this.error="Constructed encoding used for primitive type",-1}return b+this.blockLength}toJSON(){return{...super.toJSON(),tagClass:this.tagClass,tagNumber:this.tagNumber,isConstructed:this.isConstructed}}}by.NAME="identificationBlock";class bz extends bw{constructor({lenBlock:a={}}={}){var b,c,d;super(),this.isIndefiniteForm=null!=(b=a.isIndefiniteForm)&&b,this.longFormUsed=null!=(c=a.longFormUsed)&&c,this.length=null!=(d=a.length)?d:0}fromBER(a,b,c){let d=a4.toUint8Array(a);if(!bk(this,d,b,c))return -1;let e=d.subarray(b,b+c);if(0===e.length)return this.error="Zero buffer length",-1;if(255===e[0])return this.error="Length block 0xFF is reserved by standard",-1;if(this.isIndefiniteForm=128===e[0],this.isIndefiniteForm)return this.blockLength=1,b+this.blockLength;if(this.longFormUsed=!!(128&e[0]),!1===this.longFormUsed)return this.length=e[0],this.blockLength=1,b+this.blockLength;let f=127&e[0];if(f>8)return this.error="Too big integer",-1;if(f+1>e.length)return this.error="End of input reached before message was fully decoded",-1;let g=b+1,h=d.subarray(g,g+f);return 0===h[f-1]&&this.warnings.push("Needlessly long encoded length"),this.length=bd(h,8),this.longFormUsed&&this.length<=127&&this.warnings.push("Unnecessary usage of long length form"),this.blockLength=f+1,b+this.blockLength}toBER(a=!1){let b,c;if(this.length>127&&(this.longFormUsed=!0),this.isIndefiniteForm)return b=new ArrayBuffer(1),!1===a&&((c=new Uint8Array(b))[0]=128),b;if(this.longFormUsed){let d=be(this.length,8);if(d.byteLength>127)return this.error="Too big length",bq;if(b=new ArrayBuffer(d.byteLength+1),a)return b;let e=new Uint8Array(d);(c=new Uint8Array(b))[0]=128|d.byteLength;for(let a=0;a<d.byteLength;a++)c[a+1]=e[a];return b}return b=new ArrayBuffer(1),!1===a&&((c=new Uint8Array(b))[0]=this.length),b}toJSON(){return{...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,longFormUsed:this.longFormUsed,length:this.length}}}bz.NAME="lengthBlock";let bA={};class bB extends bw{constructor({name:a="",optional:b=!1,primitiveSchema:c,...d}={},e){super(d),this.name=a,this.optional=b,c&&(this.primitiveSchema=c),this.idBlock=new by(d),this.lenBlock=new bz(d),this.valueBlock=e?new e(d):new bx(d)}fromBER(a,b,c){let d=this.valueBlock.fromBER(a,b,this.lenBlock.isIndefiniteForm?c:this.lenBlock.length);return -1===d?this.error=this.valueBlock.error:(this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength)),d}toBER(a,b){let c=b||new bl;b||function a(b){var c;if(b instanceof bA.Constructed)for(let c of b.valueBlock.value)a(c)&&(b.lenBlock.isIndefiniteForm=!0);return!!(null==(c=b.lenBlock)?void 0:c.isIndefiniteForm)}(this);let d=this.idBlock.toBER(a);if(c.write(d),this.lenBlock.isIndefiniteForm)c.write(new Uint8Array([128]).buffer),this.valueBlock.toBER(a,c),c.write(new ArrayBuffer(2));else{let b=this.valueBlock.toBER(a);this.lenBlock.length=b.byteLength;let d=this.lenBlock.toBER(a);c.write(d),c.write(b)}return b?bq:c.final()}toJSON(){let a={...super.toJSON(),idBlock:this.idBlock.toJSON(),lenBlock:this.lenBlock.toJSON(),valueBlock:this.valueBlock.toJSON(),name:this.name,optional:this.optional};return this.primitiveSchema&&(a.primitiveSchema=this.primitiveSchema.toJSON()),a}toString(a="ascii"){return"ascii"===a?this.onAsciiEncoding():bb.ToHex(this.toBER())}onAsciiEncoding(){let a=this.constructor.NAME,b=bb.ToHex(this.valueBlock.valueBeforeDecodeView);return`${a} : ${b}`}isEqual(a){if(this===a)return!0;if(!(a instanceof this.constructor))return!1;let b=this.toBER(),c=a.toBER();if(b.byteLength!==c.byteLength)return!1;let d=new Uint8Array(b),e=new Uint8Array(c);for(let a=0;a<d.length;a++)if(d[a]!==e[a])return!1;return!0}}bB.NAME="BaseBlock";class bC extends bB{getValue(){return this.valueBlock.value}setValue(a){this.valueBlock.value=a}constructor({value:a="",...b}={},c){super(b,c),a&&this.fromString(a)}fromBER(a,b,c){let d=this.valueBlock.fromBER(a,b,this.lenBlock.isIndefiniteForm?c:this.lenBlock.length);return -1===d?this.error=this.valueBlock.error:(this.fromBuffer(this.valueBlock.valueHexView),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength)),d}onAsciiEncoding(){return`${this.constructor.NAME} : '${this.valueBlock.value}'`}}bC.NAME="BaseStringBlock";class bD extends bv(bx){constructor({isHexOnly:a=!0,...b}={}){super(b),this.isHexOnly=a}}bD.NAME="PrimitiveValueBlock";class bE extends bB{constructor(a={}){super(a,bD),this.idBlock.isConstructed=!1}}function bF(a,b=0,c=a.length){let d=b,e=new bB({},bx),f=new bw;if(!bk(f,a,b,c))return e.error=f.error,{offset:-1,result:e};if(!a.subarray(b,b+c).length)return e.error="Zero buffer length",{offset:-1,result:e};let g=e.idBlock.fromBER(a,b,c);if(e.idBlock.warnings.length&&e.warnings.concat(e.idBlock.warnings),-1===g)return e.error=e.idBlock.error,{offset:-1,result:e};if(b=g,c-=e.idBlock.blockLength,g=e.lenBlock.fromBER(a,b,c),e.lenBlock.warnings.length&&e.warnings.concat(e.lenBlock.warnings),-1===g)return e.error=e.lenBlock.error,{offset:-1,result:e};if(b=g,c-=e.lenBlock.blockLength,!e.idBlock.isConstructed&&e.lenBlock.isIndefiniteForm)return e.error="Indefinite length form used for primitive encoding form",{offset:-1,result:e};let h=bB;if(1===e.idBlock.tagClass){if(e.idBlock.tagNumber>=37&&!1===e.idBlock.isHexOnly)return e.error="UNIVERSAL 37 and upper tags are reserved by ASN.1 standard",{offset:-1,result:e};switch(e.idBlock.tagNumber){case 0:if(e.idBlock.isConstructed&&e.lenBlock.length>0)return e.error="Type [UNIVERSAL 0] is reserved",{offset:-1,result:e};h=bA.EndOfContent;break;case 1:h=bA.Boolean;break;case 2:h=bA.Integer;break;case 3:h=bA.BitString;break;case 4:h=bA.OctetString;break;case 5:h=bA.Null;break;case 6:h=bA.ObjectIdentifier;break;case 10:h=bA.Enumerated;break;case 12:h=bA.Utf8String;break;case 13:h=bA.RelativeObjectIdentifier;break;case 14:h=bA.TIME;break;case 15:return e.error="[UNIVERSAL 15] is reserved by ASN.1 standard",{offset:-1,result:e};case 16:h=bA.Sequence;break;case 17:h=bA.Set;break;case 18:h=bA.NumericString;break;case 19:h=bA.PrintableString;break;case 20:h=bA.TeletexString;break;case 21:h=bA.VideotexString;break;case 22:h=bA.IA5String;break;case 23:h=bA.UTCTime;break;case 24:h=bA.GeneralizedTime;break;case 25:h=bA.GraphicString;break;case 26:h=bA.VisibleString;break;case 27:h=bA.GeneralString;break;case 28:h=bA.UniversalString;break;case 29:h=bA.CharacterString;break;case 30:h=bA.BmpString;break;case 31:h=bA.DATE;break;case 32:h=bA.TimeOfDay;break;case 33:h=bA.DateTime;break;case 34:h=bA.Duration;break;default:{let a=e.idBlock.isConstructed?new bA.Constructed:new bA.Primitive;a.idBlock=e.idBlock,a.lenBlock=e.lenBlock,a.warnings=e.warnings,e=a}}}else h=e.idBlock.isConstructed?bA.Constructed:bA.Primitive;return g=(e=function(a,b){if(a instanceof b)return a;let c=new b;return c.idBlock=a.idBlock,c.lenBlock=a.lenBlock,c.warnings=a.warnings,c.valueBeforeDecodeView=a.valueBeforeDecodeView,c}(e,h)).fromBER(a,b,e.lenBlock.isIndefiniteForm?c:e.lenBlock.length),e.valueBeforeDecodeView=a.subarray(d,d+e.blockLength),{offset:g,result:e}}function bG(a){if(!a.byteLength){let a=new bB({},bx);return a.error="Input buffer has zero length",{offset:-1,result:a}}return bF(a4.toUint8Array(a).slice(),0,a.byteLength)}bA.Primitive=bE,bE.NAME="PRIMITIVE";class bH extends bx{constructor({value:a=[],isIndefiniteForm:b=!1,...c}={}){super(c),this.value=a,this.isIndefiniteForm=b}fromBER(a,b,c){var d,e;let f=a4.toUint8Array(a);if(!bk(this,f,b,c))return -1;if(this.valueBeforeDecodeView=f.subarray(b,b+c),0===this.valueBeforeDecodeView.length)return this.warnings.push("Zero buffer length"),b;let g=b;for(;d=this.isIndefiniteForm,e=c,(d?1:e)>0;){let a=bF(f,g,c);if(-1===a.offset)return this.error=a.result.error,this.warnings.concat(a.result.warnings),-1;if(g=a.offset,this.blockLength+=a.result.blockLength,c-=a.result.blockLength,this.value.push(a.result),this.isIndefiniteForm&&a.result.constructor.NAME===bs)break}return this.isIndefiniteForm&&(this.value[this.value.length-1].constructor.NAME===bs?this.value.pop():this.warnings.push("No EndOfContent block encoded")),g}toBER(a,b){let c=b||new bl;for(let b=0;b<this.value.length;b++)this.value[b].toBER(a,c);return b?bq:c.final()}toJSON(){let a={...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,value:[]};for(let b of this.value)a.value.push(b.toJSON());return a}}bH.NAME="ConstructedValueBlock";class bI extends bB{constructor(a={}){super(a,bH),this.idBlock.isConstructed=!0}fromBER(a,b,c){this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm;let d=this.valueBlock.fromBER(a,b,this.lenBlock.isIndefiniteForm?c:this.lenBlock.length);return -1===d?this.error=this.valueBlock.error:(this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength)),d}onAsciiEncoding(){let a=[];for(let b of this.valueBlock.value)a.push(b.toString("ascii").split("\n").map(a=>` ${a}`).join("\n"));let b=3===this.idBlock.tagClass?`[${this.idBlock.tagNumber}]`:this.constructor.NAME;return a.length?`${b} :
1
+ (()=>{var a={};a.id=8573,a.ids=[8573],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},9631:(a,b,c)=>{"use strict";let d=c(29021),e=c(55511),{exec:f}=c(79646),{execWithPassword:g}=c(66936),h="win32"===process.platform;function i(a){let b=d.readFileSync(a,"utf-8"),c=Buffer.from(b.replace(/-----[^-]+-----/g,"").replace(/\s/g,""),"base64");return e.createHash("sha1").update(c).digest("hex").toUpperCase().match(/.{2}/g).join(":")}async function j(a){var b;return h?new Promise(a=>{f("certutil -store Root daily-cloudcode-pa.googleapis.com",b=>{a(!b)})}):(b=a,new Promise(a=>{try{let c=i(b);f(`security find-certificate -a -Z /Library/Keychains/System.keychain | grep -i "${c}"`,b=>{a(!b)})}catch{a(!1)}}))}async function k(a,b){let c=`security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain "${b}"`;try{await g(c,a),console.log(`✅ Installed certificate to system keychain: ${b}`)}catch(a){throw Error(a.message?.includes("canceled")?"User canceled authorization":"Certificate install failed")}}async function l(a){let b=`Start-Process certutil -ArgumentList '-addstore','Root','${a.replace(/'/g,"''")}' -Verb RunAs -Wait`;return new Promise((a,c)=>{f(`powershell -Command "${b}"`,b=>{b?c(Error(`Failed to install certificate: ${b.message}`)):(console.log(`✅ Installed certificate to Windows Root store`),a())})})}async function m(a,b){let c=i(b).replace(/:/g,""),d=`security delete-certificate -Z "${c}" /Library/Keychains/System.keychain`;try{await g(d,a),console.log("✅ Uninstalled certificate from system keychain")}catch(a){throw Error("Failed to uninstall certificate")}}async function n(){return new Promise((a,b)=>{f("powershell -Command \"Start-Process certutil -ArgumentList '-delstore','Root','daily-cloudcode-pa.googleapis.com' -Verb RunAs -Wait\"",c=>{c?b(Error(`Failed to uninstall certificate: ${c.message}`)):(console.log("✅ Uninstalled certificate from Windows Root store"),a())})})}a.exports={installCert:async function(a,b){if(!d.existsSync(b))throw Error(`Certificate file not found: ${b}`);await j(b)?console.log("✅ Certificate already installed"):h?await l(b):await k(a,b)},uninstallCert:async function(a,b){await j(b)?h?await n():await m(a,b):console.log("Certificate not found in system store")},checkCertInstalled:j}},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},12044:(a,b,c)=>{let{X509CertificateGenerator:d,X509Certificate:e,cryptoProvider:f,X509ChainBuilder:g,BasicConstraintsExtension:h,KeyUsagesExtension:i,KeyUsageFlags:j,ExtendedKeyUsageExtension:k,ExtendedKeyUsage:l,SubjectAlternativeNameExtension:m,GeneralName:n}=c(94999),o=c(55511),p=o.webcrypto;function q(a){var b=parseInt(a[0],16);return b<8?a:(b-=8).toString()+a.substring(1)}function r(a){switch(a){case"sha256":return"SHA-256";case"sha384":return"SHA-384";case"sha512":return"SHA-512";default:return"SHA-1"}}function s(a,b){let c=r(a);return"ec"===b?{name:"ECDSA",hash:c}:{name:"RSASSA-PKCS1-v1_5",hash:c}}function t(a){let b=a.keyType||"rsa",c=r(a.algorithm||"sha1");return"ec"===b?{name:"ECDSA",namedCurve:a.curve||"P-256"}:{name:"RSASSA-PKCS1-v1_5",modulusLength:a.keySize||2048,publicExponent:new Uint8Array([1,0,1]),hash:c}}function u(a){let b={commonName:"CN",countryName:"C",ST:"ST",localityName:"L",organizationName:"O",OU:"OU"};return a.map(a=>{let c=a.name||a.shortName,d=b[c]||c;return`${d}=${a.value}`}).join(", ")}async function v(a,b,c){let d,e=o.createPrivateKey(a),f=e.asymmetricKeyType,g=e.export({type:"pkcs8",format:"pem"}).replace(/-----BEGIN PRIVATE KEY-----/,"").replace(/-----END PRIVATE KEY-----/,"").replace(/\s/g,""),h=Buffer.from(g,"base64");return d="ec"===(c||f)?{name:"ECDSA",namedCurve:function(a){let b=a.asymmetricKeyDetails;if(b&&b.namedCurve){var c;return({prime256v1:"P-256",secp384r1:"P-384",secp521r1:"P-521","P-256":"P-256","P-384":"P-384","P-521":"P-521"})[c=b.namedCurve]||c}return"P-256"}(e)}:{name:"RSASSA-PKCS1-v1_5",hash:r(b)},await p.subtle.importKey("pkcs8",h,d,!0,["sign"])}async function w(a,b,c,d){let e,f=a.replace(/-----BEGIN PUBLIC KEY-----/,"").replace(/-----END PUBLIC KEY-----/,"").replace(/\s/g,""),g=Buffer.from(f,"base64");return e="ec"===c?{name:"ECDSA",namedCurve:d||"P-256"}:{name:"RSASSA-PKCS1-v1_5",hash:r(b)},await p.subtle.importKey("spki",g,e,!0,["verify"])}async function x(a,b,c,f){let n,r,{privateKey:w,publicKey:x}=a,y=p.getRandomValues(new Uint8Array(9)),z=q(Buffer.from(y).toString("hex")),A=c.notBeforeDate||new Date;c.notAfterDate?n=c.notAfterDate:(n=new Date(A)).setDate(n.getDate()+365);let B=u(b=b||[{name:"commonName",value:"example.org"},{name:"countryName",value:"US"},{shortName:"ST",value:"Virginia"},{name:"localityName",value:"Blacksburg"},{name:"organizationName",value:"Test"},{shortName:"OU",value:"Test"}]),C=c.keyType||"rsa",D=s(c.algorithm,C),E=b.find(a=>"commonName"===a.name||"CN"===a.shortName),F=E?E.value:"localhost",G=function(a,b){if(!a||0===a.length)return[new h(!1,void 0,!0),new i(j.digitalSignature|j.keyEncipherment,!0),new k([l.serverAuth,l.clientAuth],!1),new m([{type:"dns",value:b},..."localhost"===b?[{type:"ip",value:"127.0.0.1"}]:[]],!1)];let c=[];for(let b of a){let a=b.critical||!1;switch(b.name){case"basicConstraints":c.push(new h(b.cA||!1,b.pathLenConstraint,a));break;case"keyUsage":let d=0;b.digitalSignature&&(d|=j.digitalSignature),(b.nonRepudiation||b.contentCommitment)&&(d|=j.nonRepudiation),b.keyEncipherment&&(d|=j.keyEncipherment),b.dataEncipherment&&(d|=j.dataEncipherment),b.keyAgreement&&(d|=j.keyAgreement),b.keyCertSign&&(d|=j.keyCertSign),b.cRLSign&&(d|=j.cRLSign),b.encipherOnly&&(d|=j.encipherOnly),b.decipherOnly&&(d|=j.decipherOnly),c.push(new i(d,a));break;case"extKeyUsage":let e=[];b.serverAuth&&e.push(l.serverAuth),b.clientAuth&&e.push(l.clientAuth),b.codeSigning&&e.push(l.codeSigning),b.emailProtection&&e.push(l.emailProtection),b.timeStamping&&e.push(l.timeStamping),c.push(new k(e,a));break;case"subjectAltName":let f=(b.altNames||[]).map(a=>{switch(a.type){case 1:return{type:"email",value:a.value};case 2:return{type:"dns",value:a.value};case 6:return{type:"url",value:a.value};case 7:return{type:"ip",value:a.ip||a.value};default:if(a.ip)return{type:"ip",value:a.ip};if(a.dns)return{type:"dns",value:a.dns};if(a.email)return{type:"email",value:a.email};if(a.uri||a.url)return{type:"url",value:a.uri||a.url};return{type:"dns",value:a.value}}});c.push(new m(f,a));break;default:console.warn(`Unknown extension "${b.name}" ignored`)}}return c}(c.extensions,F);if(f){let a=new e(f.cert),b=await v(f.key,c.algorithm||"sha256",C);r=await d.create({serialNumber:z,subject:B,issuer:a.subject,notBefore:A,notAfter:n,signingAlgorithm:D,publicKey:x,signingKey:b,extensions:G})}else r=await d.createSelfSigned({serialNumber:z,name:B,notBefore:A,notAfter:n,signingAlgorithm:D,keys:{privateKey:w,publicKey:x},extensions:G});let H=r.rawData,I=await p.subtle.digest("SHA-1",H),J=Buffer.from(I).toString("hex").match(/.{2}/g).join(":"),K=await p.subtle.exportKey("pkcs8",w),L=await p.subtle.exportKey("spki",x),M={private:c.passphrase?o.createPrivateKey({key:Buffer.from(K),format:"der",type:"pkcs8"}).export({type:"pkcs8",format:"pem",cipher:"aes-256-cbc",passphrase:c.passphrase}):"-----BEGIN PRIVATE KEY-----\n"+Buffer.from(K).toString("base64").match(/.{1,64}/g).join("\n")+"\n-----END PRIVATE KEY-----\n",public:"-----BEGIN PUBLIC KEY-----\n"+Buffer.from(L).toString("base64").match(/.{1,64}/g).join("\n")+"\n-----END PUBLIC KEY-----\n",cert:r.toString("pem"),fingerprint:J};if(c&&c.clientCertificate){let a,e="object"==typeof c.clientCertificate?c.clientCertificate:{},f=e.keySize||c.clientCertificateKeySize||2048,g=e.algorithm||c.algorithm||"sha1",h=e.cn||c.clientCertificateCN||"John Doe jdoe123",i=t({keyType:e.keyType||C,keySize:f,algorithm:g,curve:e.curve||c.curve||"P-256"}),j=await p.subtle.generateKey(i,!0,["sign","verify"]),k=p.getRandomValues(new Uint8Array(9)),l=q(Buffer.from(k).toString("hex")),m=e.notBeforeDate||new Date;e.notAfterDate?a=e.notAfterDate:(a=new Date(m)).setFullYear(m.getFullYear()+1);let n=JSON.parse(JSON.stringify(b));for(let a=0;a<n.length;a++)"commonName"===n[a].name&&(n[a]={name:"commonName",value:h});let o=u(n),r=u(b),v=s(g,C),x=await d.create({serialNumber:l,subject:o,issuer:r,notBefore:m,notAfter:a,signingAlgorithm:v,publicKey:j.publicKey,signingKey:w}),y=await p.subtle.exportKey("pkcs8",j.privateKey),z=await p.subtle.exportKey("spki",j.publicKey);M.clientprivate="-----BEGIN PRIVATE KEY-----\n"+Buffer.from(y).toString("base64").match(/.{1,64}/g).join("\n")+"\n-----END PRIVATE KEY-----\n",M.clientpublic="-----BEGIN PUBLIC KEY-----\n"+Buffer.from(z).toString("base64").match(/.{1,64}/g).join("\n")+"\n-----END PUBLIC KEY-----\n",M.clientcert=x.toString("pem")}let N=new e(r.rawData),O=[N];if(f){let a=new e(f.cert);O.push(a)}let P=new g({certificates:O});if(0===(await P.build(N)).length)throw Error("Certificate could not be verified.");return M}f.set(p),b.generate=async function(a,b){let c;a=a||void 0;let d=(b=b||{}).keyType||"rsa",e=b.curve||"P-256";if(b.keyPair)c={privateKey:await v(b.keyPair.privateKey,b.algorithm||"sha1",d),publicKey:await w(b.keyPair.publicKey,b.algorithm||"sha1",d,e)};else{let a=t(b);c=await p.subtle.generateKey(a,!0,["sign","verify"])}return await x(c,a,b,b.ca)}},21820:a=>{"use strict";a.exports=require("os")},24424:(a,b)=>{"use strict";function c(a){for(let b=0;b<a.length;b++){let c=a[b];if("function"!=typeof c)throw Object.defineProperty(Error(`A "use server" file can only export async functions, found ${typeof c}.
2
+ Read more: https://nextjs.org/docs/messages/invalid-use-server-value`),"__NEXT_ERROR_CODE",{value:"E352",enumerable:!1,configurable:!0})}}Object.defineProperty(b,"D",{enumerable:!0,get:function(){return c}})},26033:(a,b,c)=>{"use strict";let d=c(33873),e=c(29021),f=c(21820),g="daily-cloudcode-pa.googleapis.com";a.exports={generateCert:async function(){let a=d.join(f.homedir(),".9router","mitm"),b=d.join(a,"server.key"),h=d.join(a,"server.crt");if(e.existsSync(b)&&e.existsSync(h))return console.log("✅ SSL certificate already exists"),{key:b,cert:h};e.existsSync(a)||e.mkdirSync(a,{recursive:!0});let i=c(12044),j=[{name:"commonName",value:g}],k=new Date;k.setFullYear(k.getFullYear()+1);let l=await i.generate(j,{keySize:2048,algorithm:"sha256",notAfterDate:k,extensions:[{name:"subjectAltName",altNames:[{type:2,value:g}]}]});return e.writeFileSync(b,l.private),e.writeFileSync(h,l.cert),console.log(`✅ Generated SSL certificate for ${g}`),{key:b,cert:h}}}},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{"use strict";a.exports=require("path")},35805:(a,b,c)=>{"use strict";c.r(b),c.d(b,{"001c005b09de37b2cfc962f15ee2535dc18abfec9b":()=>d.GET,"40917a24e693561f7b86a67a3ee8789cb68b85111b":()=>d.POST,"4091af35cdf07bcd016e0abdaa2a971a1f355f2d0e":()=>d.DELETE});var d=c(86805)},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},49796:(a,b,c)=>{"use strict";Object.defineProperty(b,"A",{enumerable:!0,get:function(){return d.registerServerReference}});let d=c(77943)},55511:a=>{"use strict";a.exports=require("crypto")},60488:(a,b,c)=>{"use strict";c.r(b),c.d(b,{handler:()=>A,patchFetch:()=>z,routeModule:()=>v,serverHooks:()=>y,workAsyncStorage:()=>w,workUnitAsyncStorage:()=>x});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527),u=c(86805);let v=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/cli-tools/antigravity-mitm/route",pathname:"/api/cli-tools/antigravity-mitm",filename:"route",bundlePath:"app/api/cli-tools/antigravity-mitm/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Users/Working/router4/app/src/app/api/cli-tools/antigravity-mitm/route.js",nextConfigOutput:"standalone",userland:u}),{workAsyncStorage:w,workUnitAsyncStorage:x,serverHooks:y}=v;function z(){return(0,f.patchFetch)({workAsyncStorage:w,workUnitAsyncStorage:x})}async function A(a,b,c){v.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/cli-tools/antigravity-mitm/route";"/index"===d&&(d="/");let f=await v.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:u,params:w,nextConfig:x,parsedUrl:y,isDraftMode:z,prerenderManifest:A,routerServerContext:B,isOnDemandRevalidate:C,revalidateOnlyGenerated:D,resolvedPathname:E,clientReferenceManifest:F,serverActionsManifest:G}=f,H=(0,j.normalizeAppPath)(d),I=!!(A.dynamicRoutes[H]||A.routes[E]),J=async()=>((null==B?void 0:B.render404)?await B.render404(a,b,y,!1):b.end("This page could not be found"),null);if(I&&!z){let a=!!A.routes[E],b=A.dynamicRoutes[H];if(b&&!1===b.fallback&&!a){if(x.experimental.adapterPath)return await J();throw new s.NoFallbackError}}let K=null;!I||v.isDev||z||(K="/index"===(K=E)?"/":K);let L=!0===v.isDev||!I,M=I&&!L;G&&F&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:F,serverActionsManifest:G});let N=a.method||"GET",O=(0,h.getTracer)(),P=O.getActiveScopeSpan(),Q={params:w,prerenderManifest:A,renderOpts:{experimental:{authInterrupts:!!x.experimental.authInterrupts},cacheComponents:!!x.cacheComponents,supportsDynamicResponse:L,incrementalCache:(0,g.getRequestMeta)(a,"incrementalCache"),cacheLifeProfiles:x.cacheLife,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>v.onRequestError(a,b,d,e,B)},sharedContext:{buildId:u}},R=new k.NodeNextRequest(a),S=new k.NodeNextResponse(b),T=l.NextRequestAdapter.fromNodeNextRequest(R,(0,l.signalFromNodeResponse)(b));try{let f=async a=>v.handle(T,Q).finally(()=>{if(!a)return;a.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let c=O.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route");if(e){let b=`${N} ${e}`;a.setAttributes({"next.route":e,"http.route":e,"next.span_name":b}),a.updateName(b)}else a.updateName(`${N} ${d}`)}),i=!!(0,g.getRequestMeta)(a,"minimalMode"),j=async g=>{var h,j;let k=async({previousCacheEntry:e})=>{try{if(!i&&C&&D&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await f(g);a.fetchMetrics=Q.renderOpts.fetchMetrics;let h=Q.renderOpts.pendingWaitUntil;h&&c.waitUntil&&(c.waitUntil(h),h=void 0);let j=Q.renderOpts.collectedTags;if(!I)return await (0,o.I)(R,S,d,Q.renderOpts.pendingWaitUntil),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);j&&(b[r.NEXT_CACHE_TAGS_HEADER]=j),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==Q.renderOpts.collectedRevalidate&&!(Q.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&Q.renderOpts.collectedRevalidate,e=void 0===Q.renderOpts.collectedExpire||Q.renderOpts.collectedExpire>=r.INFINITE_CACHE?void 0:Q.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await v.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.c)({isStaticGeneration:M,isOnDemandRevalidate:C})},!1,B),b}},l=await v.handleResponse({req:a,nextConfig:x,cacheKey:K,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:A,isRoutePPREnabled:!1,isOnDemandRevalidate:C,revalidateOnlyGenerated:D,responseGenerator:k,waitUntil:c.waitUntil,isMinimalMode:i});if(!I)return null;if((null==l||null==(h=l.value)?void 0:h.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==l||null==(j=l.value)?void 0:j.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});i||b.setHeader("x-nextjs-cache",C?"REVALIDATED":l.isMiss?"MISS":l.isStale?"STALE":"HIT"),z&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let m=(0,p.fromNodeOutgoingHttpHeaders)(l.value.headers);return i&&I||m.delete(r.NEXT_CACHE_TAGS_HEADER),!l.cacheControl||b.getHeader("Cache-Control")||m.get("Cache-Control")||m.set("Cache-Control",(0,q.getCacheControlHeader)(l.cacheControl)),await (0,o.I)(R,S,new Response(l.value.body,{headers:m,status:l.value.status||200})),null};P?await j(P):await O.withPropagatedContext(a.headers,()=>O.trace(m.BaseServerSpan.handleRequest,{spanName:`${N} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":N,"http.target":a.url}},j))}catch(b){if(b instanceof s.NoFallbackError||await v.onRequestError(a,b,{routerKind:"App Router",routePath:H,routeType:"route",revalidateReason:(0,n.c)({isStaticGeneration:M,isOnDemandRevalidate:C})},!1,B),I)throw b;return await (0,o.I)(R,S,new Response(null,{status:500})),null}}},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},66936:(a,b,c)=>{"use strict";let{exec:d,spawn:e}=c(79646),f=c(29021),g=c(33873),h="daily-cloudcode-pa.googleapis.com",i="win32"===process.platform,j=i?g.join(process.env.SystemRoot||"C:\\Windows","System32","drivers","etc","hosts"):"/etc/hosts";function k(a,b){return new Promise((c,d)=>{let f=e("sudo",["-S","sh","-c",a],{stdio:["pipe","pipe","pipe"]}),g="",h="";f.stdout.on("data",a=>{g+=a}),f.stderr.on("data",a=>{h+=a}),f.on("close",a=>{0===a?c(g):d(Error(h||`Exit code ${a}`))}),f.stdin.write(`${b}
3
+ `),f.stdin.end()})}function l(a){return new Promise((b,c)=>{let e=`Start-Process cmd -ArgumentList '/c','${a.replace(/'/g,"''")}' -Verb RunAs -Wait`;d(`powershell -Command "${e}"`,(a,d,e)=>{a?c(Error(`Elevated command failed: ${a.message}
4
+ ${e}`)):b(d)})})}function m(){try{return f.readFileSync(j,"utf8").includes(h)}catch{return!1}}a.exports={addDNSEntry:async function(a){if(m())return void console.log(`DNS entry for ${h} already exists`);let b=`127.0.0.1 ${h}`;try{i?await l(`echo ${b} >> "${j}"`):await k(`echo "${b}" >> ${j}`,a),i?await l("ipconfig /flushdns"):await k("dscacheutil -flushcache && killall -HUP mDNSResponder",a),console.log(`✅ Added DNS entry: ${b}`)}catch(a){throw Error(a.message?.includes("incorrect password")?"Wrong sudo password":"Failed to add DNS entry")}},removeDNSEntry:async function(a){if(!m())return void console.log(`DNS entry for ${h} does not exist`);try{if(i){let a=`(Get-Content '${j}') | Where-Object { $_ -notmatch '${h}' } | Set-Content '${j}'`,b=`Start-Process powershell -ArgumentList '-Command','${a.replace(/'/g,"''")}' -Verb RunAs -Wait`;await new Promise((a,c)=>{d(`powershell -Command "${b}"`,b=>{b?c(Error(`Failed to remove DNS entry: ${b.message}`)):a()})})}else await k(`sed -i '' '/${h}/d' ${j}`,a);i?await l("ipconfig /flushdns"):await k("dscacheutil -flushcache && killall -HUP mDNSResponder",a),console.log(`✅ Removed DNS entry for ${h}`)}catch(a){throw Error(a.message?.includes("incorrect password")?"Wrong sudo password":"Failed to remove DNS entry")}},execWithPassword:k,checkDNSEntry:m}},77943:(a,b,c)=>{"use strict";a.exports=c(7553).vendored["react-rsc"].ReactServerDOMWebpackServer},78335:()=>{},79646:a=>{"use strict";a.exports=require("child_process")},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},86718:()=>{var a,b;b=a||(a={}),function(a){var c="object"==typeof globalThis?globalThis:"object"==typeof global?global:"object"==typeof self?self:"object"==typeof this?this:function(){try{return Function("return this;")()}catch(a){}}()||function(){try{return(0,eval)("(function() { return this; })()")}catch(a){}}(),d=e(b);function e(a,b){return function(c,d){Object.defineProperty(a,c,{configurable:!0,writable:!0,value:d}),b&&b(c,d)}}void 0!==c.Reflect&&(d=e(c.Reflect,d)),a(d,c),void 0===c.Reflect&&(c.Reflect=b)}(function(a,b){var c,d=Object.prototype.hasOwnProperty,e="function"==typeof Symbol,f=e&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",g=e&&void 0!==Symbol.iterator?Symbol.iterator:"@@iterator",h="function"==typeof Object.create,i=({__proto__:[]})instanceof Array,j=!h&&!i,k={create:h?function(){return L(Object.create(null))}:i?function(){return L({__proto__:null})}:function(){return L({})},has:j?function(a,b){return d.call(a,b)}:function(a,b){return b in a},get:j?function(a,b){return d.call(a,b)?a[b]:void 0}:function(a,b){return a[b]}},l=Object.getPrototypeOf(Function),m="function"==typeof Map&&"function"==typeof Map.prototype.entries?Map:function(){var a={},b=[],c=function(){function a(a,b,c){this._index=0,this._keys=a,this._values=b,this._selector=c}return a.prototype["@@iterator"]=function(){return this},a.prototype[g]=function(){return this},a.prototype.next=function(){var a=this._index;if(a>=0&&a<this._keys.length){var c=this._selector(this._keys[a],this._values[a]);return a+1>=this._keys.length?(this._index=-1,this._keys=b,this._values=b):this._index++,{value:c,done:!1}}return{value:void 0,done:!0}},a.prototype.throw=function(a){throw this._index>=0&&(this._index=-1,this._keys=b,this._values=b),a},a.prototype.return=function(a){return this._index>=0&&(this._index=-1,this._keys=b,this._values=b),{value:a,done:!0}},a}();function d(){this._keys=[],this._values=[],this._cacheKey=a,this._cacheIndex=-2}return Object.defineProperty(d.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),d.prototype.has=function(a){return this._find(a,!1)>=0},d.prototype.get=function(a){var b=this._find(a,!1);return b>=0?this._values[b]:void 0},d.prototype.set=function(a,b){var c=this._find(a,!0);return this._values[c]=b,this},d.prototype.delete=function(b){var c=this._find(b,!1);if(c>=0){for(var d=this._keys.length,e=c+1;e<d;e++)this._keys[e-1]=this._keys[e],this._values[e-1]=this._values[e];return this._keys.length--,this._values.length--,E(b,this._cacheKey)&&(this._cacheKey=a,this._cacheIndex=-2),!0}return!1},d.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=a,this._cacheIndex=-2},d.prototype.keys=function(){return new c(this._keys,this._values,e)},d.prototype.values=function(){return new c(this._keys,this._values,f)},d.prototype.entries=function(){return new c(this._keys,this._values,h)},d.prototype["@@iterator"]=function(){return this.entries()},d.prototype[g]=function(){return this.entries()},d.prototype._find=function(a,b){if(!E(this._cacheKey,a)){this._cacheIndex=-1;for(var c=0;c<this._keys.length;c++)if(E(this._keys[c],a)){this._cacheIndex=c;break}}return this._cacheIndex<0&&b&&(this._cacheIndex=this._keys.length,this._keys.push(a),this._values.push(void 0)),this._cacheIndex},d;function e(a,b){return a}function f(a,b){return b}function h(a,b){return[a,b]}}(),n="function"==typeof Set&&"function"==typeof Set.prototype.entries?Set:function(){function a(){this._map=new m}return Object.defineProperty(a.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),a.prototype.has=function(a){return this._map.has(a)},a.prototype.add=function(a){return this._map.set(a,a),this},a.prototype.delete=function(a){return this._map.delete(a)},a.prototype.clear=function(){this._map.clear()},a.prototype.keys=function(){return this._map.keys()},a.prototype.values=function(){return this._map.keys()},a.prototype.entries=function(){return this._map.entries()},a.prototype["@@iterator"]=function(){return this.keys()},a.prototype[g]=function(){return this.keys()},a}(),o="function"==typeof WeakMap?WeakMap:function(){var a=k.create(),b=e();function c(){this._key=e()}return c.prototype.has=function(a){var b=f(a,!1);return void 0!==b&&k.has(b,this._key)},c.prototype.get=function(a){var b=f(a,!1);return void 0!==b?k.get(b,this._key):void 0},c.prototype.set=function(a,b){return f(a,!0)[this._key]=b,this},c.prototype.delete=function(a){var b=f(a,!1);return void 0!==b&&delete b[this._key]},c.prototype.clear=function(){this._key=e()},c;function e(){var b;do b="@@WeakMap@@"+function(){var a=function(a){if("function"==typeof Uint8Array){var b=new Uint8Array(16);return"u">typeof crypto?crypto.getRandomValues(b):"u">typeof msCrypto?msCrypto.getRandomValues(b):g(b,16),b}return g(Array(16),16)}(0);a[6]=79&a[6]|64,a[8]=191&a[8]|128;for(var b="",c=0;c<16;++c){var d=a[c];(4===c||6===c||8===c)&&(b+="-"),d<16&&(b+="0"),b+=d.toString(16).toLowerCase()}return b}();while(k.has(a,b));return a[b]=!0,b}function f(a,c){if(!d.call(a,b)){if(!c)return;Object.defineProperty(a,b,{value:k.create()})}return a[b]}function g(a,b){for(var c=0;c<b;++c)a[c]=255*Math.random()|0;return a}}(),p=e?Symbol.for("@reflect-metadata:registry"):void 0,q=(!x(p)&&z(b.Reflect)&&Object.isExtensible(b.Reflect)&&(c=b.Reflect[p]),x(c)&&(c=function(){x(p)||void 0===b.Reflect||p in b.Reflect||"function"!=typeof b.Reflect.defineMetadata||(c=(a=b.Reflect).defineMetadata,d=a.hasOwnMetadata,e=a.getOwnMetadata,f=a.getOwnMetadataKeys,g=a.deleteMetadata,h=new o,i={isProviderFor:function(a,b){var c=h.get(a);return!!(!x(c)&&c.has(b))||!!f(a,b).length&&(x(c)&&(c=new n,h.set(a,c)),c.add(b),!0)},OrdinaryDefineOwnMetadata:c,OrdinaryHasOwnMetadata:d,OrdinaryGetOwnMetadata:e,OrdinaryOwnMetadataKeys:f,OrdinaryDeleteMetadata:g});var a,c,d,e,f,g,h,i,j,k,l,q=new o,r={registerProvider:function(a){if(!Object.isExtensible(r))throw Error("Cannot add provider to a frozen registry.");switch(!0){case i===a:break;case x(j):j=a;break;case j===a:break;case x(k):k=a;break;case k===a:break;default:void 0===l&&(l=new n),l.add(a)}},getProvider:s,setProvider:function(a,b,c){if(!function(a){if(x(a))throw TypeError();return j===a||k===a||!x(l)&&l.has(a)}(c))throw Error("Metadata provider not registered.");var d=s(a,b);if(d!==c){if(!x(d))return!1;var e=q.get(a);x(e)&&(e=new m,q.set(a,e)),e.set(b,c)}return!0}};return r;function s(a,b){var c,d=q.get(a);return x(d)||(c=d.get(b)),x(c)&&(c=function(a,b){if(!x(j)){if(j.isProviderFor(a,b))return j;if(!x(k)){if(k.isProviderFor(a,b))return j;if(!x(l))for(var c=G(l);;){var d=H(c);if(!d)return;var e=d.value;if(e.isProviderFor(a,b))return I(c),e}}}if(!x(i)&&i.isProviderFor(a,b))return i}(a,b),x(c)||(x(d)&&(d=new m,q.set(a,d)),d.set(b,c))),c}}()),!x(p)&&z(b.Reflect)&&Object.isExtensible(b.Reflect)&&Object.defineProperty(b.Reflect,p,{enumerable:!1,configurable:!1,writable:!1,value:c}),c),r=function(a){var b=new o,c={isProviderFor:function(a,c){var d=b.get(a);return!x(d)&&d.has(c)},OrdinaryDefineOwnMetadata:function(a,b,c,e){d(c,e,!0).set(a,b)},OrdinaryHasOwnMetadata:function(a,b,c){var e=d(b,c,!1);return!x(e)&&!!e.has(a)},OrdinaryGetOwnMetadata:function(a,b,c){var e=d(b,c,!1);if(!x(e))return e.get(a)},OrdinaryOwnMetadataKeys:function(a,b){var c=[],e=d(a,b,!1);if(x(e))return c;for(var f=G(e.keys()),g=0;;){var h=H(f);if(!h)return c.length=g,c;var i=h.value;try{c[g]=i}catch(a){try{I(f)}finally{throw a}}g++}},OrdinaryDeleteMetadata:function(a,c,e){var f=d(c,e,!1);if(x(f)||!f.delete(a))return!1;if(0===f.size){var g=b.get(c);x(g)||(g.delete(e),0===g.size&&b.delete(g))}return!0}};return q.registerProvider(c),c;function d(d,e,f){var g=b.get(d),h=!1;if(x(g)){if(!f)return;g=new m,b.set(d,g),h=!0}var i=g.get(e);if(x(i)){if(!f)return;if(i=new m,g.set(e,i),!a.setProvider(d,e,c))throw g.delete(e),h&&b.delete(d),Error("Wrong provider for target.")}return i}}(q);function s(a,b,c){var d=K(b,c,!1);return!x(d)&&!!d.OrdinaryHasOwnMetadata(a,b,c)}function t(a,b,c){var d=K(b,c,!1);if(!x(d))return d.OrdinaryGetOwnMetadata(a,b,c)}function u(a,b,c,d){K(c,d,!0).OrdinaryDefineOwnMetadata(a,b,c,d)}function v(a,b){var c=K(a,b,!1);return c?c.OrdinaryOwnMetadataKeys(a,b):[]}function w(a){if(null===a)return 1;switch(typeof a){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===a?1:6;default:return 6}}function x(a){return void 0===a}function y(a){return null===a}function z(a){return"object"==typeof a?null!==a:"function"==typeof a}a("decorate",function(a,b,c,d){if(x(c)){if(!B(a)||!D(b))throw TypeError();for(var e=a,f=b,g=e.length-1;g>=0;--g){var h=(0,e[g])(f);if(!x(h)&&!y(h)){if(!D(h))throw TypeError();f=h}}return f}if(!B(a)||!z(b)||!z(d)&&!x(d)&&!y(d))throw TypeError();return y(d)&&(d=void 0),function(a,b,c,d){for(var e=a.length-1;e>=0;--e){var f=(0,a[e])(b,c,d);if(!x(f)&&!y(f)){if(!z(f))throw TypeError();d=f}}return d}(a,b,c=A(c),d)}),a("metadata",function(a,b){return function(c,d){if(!z(c)||!x(d)&&!function(a){switch(w(a)){case 3:case 4:return!0;default:return!1}}(d))throw TypeError();u(a,b,c,d)}}),a("defineMetadata",function(a,b,c,d){if(!z(c))throw TypeError();return x(d)||(d=A(d)),u(a,b,c,d)}),a("hasMetadata",function(a,b,c){if(!z(b))throw TypeError();return x(c)||(c=A(c)),function a(b,c,d){if(s(b,c,d))return!0;var e=J(c);return!y(e)&&a(b,e,d)}(a,b,c)}),a("hasOwnMetadata",function(a,b,c){if(!z(b))throw TypeError();return x(c)||(c=A(c)),s(a,b,c)}),a("getMetadata",function(a,b,c){if(!z(b))throw TypeError();return x(c)||(c=A(c)),function a(b,c,d){if(s(b,c,d))return t(b,c,d);var e=J(c);if(!y(e))return a(b,e,d)}(a,b,c)}),a("getOwnMetadata",function(a,b,c){if(!z(b))throw TypeError();return x(c)||(c=A(c)),t(a,b,c)}),a("getMetadataKeys",function(a,b){if(!z(a))throw TypeError();return x(b)||(b=A(b)),function a(b,c){var d=v(b,c),e=J(b);if(null===e)return d;var f=a(e,c);if(f.length<=0)return d;if(d.length<=0)return f;for(var g=new n,h=[],i=0;i<d.length;i++){var j=d[i],k=g.has(j);k||(g.add(j),h.push(j))}for(var l=0;l<f.length;l++){var j=f[l],k=g.has(j);k||(g.add(j),h.push(j))}return h}(a,b)}),a("getOwnMetadataKeys",function(a,b){if(!z(a))throw TypeError();return x(b)||(b=A(b)),v(a,b)}),a("deleteMetadata",function(a,b,c){if(!z(b)||(x(c)||(c=A(c)),!z(b)))throw TypeError();x(c)||(c=A(c));var d=K(b,c,!1);return!x(d)&&d.OrdinaryDeleteMetadata(a,b,c)});function A(a){var b=function(a,b){switch(w(a)){case 0:case 1:case 2:case 3:case 4:case 5:return a}var c="string",d=F(a,f);if(void 0!==d){var e=d.call(a,c);if(z(e))throw TypeError();return e}return function(a,b){if("string"===b){var c=a.toString;if(C(c)){var d=c.call(a);if(!z(d))return d}var e=a.valueOf;if(C(e)){var d=e.call(a);if(!z(d))return d}}else{var e=a.valueOf;if(C(e)){var d=e.call(a);if(!z(d))return d}var f=a.toString;if(C(f)){var d=f.call(a);if(!z(d))return d}}throw TypeError()}(a,c)}(a,0);return"symbol"==typeof b?b:""+b}function B(a){return Array.isArray?Array.isArray(a):a instanceof Object?a instanceof Array:"[object Array]"===Object.prototype.toString.call(a)}function C(a){return"function"==typeof a}function D(a){return"function"==typeof a}function E(a,b){return a===b||a!=a&&b!=b}function F(a,b){var c=a[b];if(null!=c){if(!C(c))throw TypeError();return c}}function G(a){var b=F(a,g);if(!C(b))throw TypeError();var c=b.call(a);if(!z(c))throw TypeError();return c}function H(a){var b=a.next();return!b.done&&b}function I(a){var b=a.return;b&&b.call(a)}function J(a){var b=Object.getPrototypeOf(a);if("function"!=typeof a||a===l||b!==l)return b;var c=a.prototype,d=c&&Object.getPrototypeOf(c);if(null==d||d===Object.prototype)return b;var e=d.constructor;return"function"!=typeof e||e===a?b:e}function K(a,b,c){var d=q.getProvider(a,b);if(!x(d))return d;if(c){if(q.setProvider(a,b,r))return r;throw Error("Illegal state.")}}function L(a){return a.__=void 0,delete a.__,a}})},86805:(a,b,c)=>{"use strict";c.r(b),c.d(b,{DELETE:()=>i,GET:()=>g,POST:()=>h});var d=c(49796),e=c(45592),f=c(96182);async function g(){try{let a=await (0,f.getMitmStatus)();return e.NextResponse.json({running:a.running,pid:a.pid||null,dnsConfigured:a.dnsConfigured||!1,certExists:a.certExists||!1,hasCachedPassword:!!(0,f.getCachedPassword)()})}catch(a){return console.log("Error getting MITM status:",a.message),e.NextResponse.json({error:"Failed to get MITM status"},{status:500})}}async function h(a){try{let{apiKey:b,sudoPassword:c}=await a.json(),d="win32"===process.platform,g=c||(0,f.getCachedPassword)()||"";if(!b||!d&&!g)return e.NextResponse.json({error:d?"Missing apiKey":"Missing apiKey or sudoPassword"},{status:400});let h=await (0,f.startMitm)(b,g);return d||(0,f.setCachedPassword)(g),e.NextResponse.json({success:!0,running:h.running,pid:h.pid})}catch(a){return console.log("Error starting MITM:",a.message),e.NextResponse.json({error:a.message||"Failed to start MITM proxy"},{status:500})}}async function i(a){try{let{sudoPassword:b}=await a.json(),c="win32"===process.platform,d=b||(0,f.getCachedPassword)()||"";if(!c&&!d)return e.NextResponse.json({error:"Missing sudoPassword"},{status:400});return await (0,f.stopMitm)(d),!c&&b&&(0,f.setCachedPassword)(b),e.NextResponse.json({success:!0,running:!1})}catch(a){return console.log("Error stopping MITM:",a.message),e.NextResponse.json({error:a.message||"Failed to stop MITM proxy"},{status:500})}}(0,c(24424).D)([g,h,i]),(0,d.A)(g,"001c005b09de37b2cfc962f15ee2535dc18abfec9b",null),(0,d.A)(h,"40917a24e693561f7b86a67a3ee8789cb68b85111b",null),(0,d.A)(i,"4091af35cdf07bcd016e0abdaa2a971a1f355f2d0e",null)},94999:(a,b,c)=>{"use strict";c.r(b),c.d(b,{AlgorithmProvider:()=>hy,AsnData:()=>h9,AsnDefaultSignatureFormatter:()=>i1,AsnEcSignatureFormatter:()=>i4,Attribute:()=>iY,AttributeFactory:()=>i_,AuthorityInfoAccessExtension:()=>iU,AuthorityKeyIdentifierExtension:()=>iL,BasicConstraintsExtension:()=>iM,CRLDistributionPointsExtension:()=>iT,CertificatePolicyExtension:()=>iS,ChallengePasswordAttribute:()=>iZ,CryptoProvider:()=>ib,DN:()=>ir,DNS:()=>iq,DefaultAlgorithmSerializer:()=>h6,EMAIL:()=>is,EcAlgorithm:()=>h2,EdAlgorithm:()=>i9,ExtendedKeyUsage:()=>av,ExtendedKeyUsageExtension:()=>iN,Extension:()=>ia,ExtensionFactory:()=>iR,ExtensionsAttribute:()=>i$,GUID:()=>iv,GeneralName:()=>iy,GeneralNames:()=>iz,IP:()=>it,IssuerAlternativeNameExtension:()=>iX,KeyUsageFlags:()=>aw,KeyUsagesExtension:()=>iO,Name:()=>ii,NameIdentifier:()=>ie,OidSerializer:()=>h7,PemConverter:()=>iI,PemData:()=>iJ,Pkcs10CertificateRequest:()=>ja,Pkcs10CertificateRequestGenerator:()=>jb,PublicKey:()=>iK,REGISTERED_ID:()=>ix,RsaAlgorithm:()=>i2,ShaAlgorithm:()=>i3,SubjectAlternativeNameExtension:()=>iQ,SubjectKeyIdentifierExtension:()=>iP,TextConverter:()=>h8,TextObject:()=>h5,UPN:()=>iw,URL:()=>iu,X509Certificate:()=>jc,X509CertificateGenerator:()=>jg,X509Certificates:()=>jd,X509ChainBuilder:()=>je,X509Crl:()=>ji,X509CrlEntry:()=>jh,X509CrlGenerator:()=>jj,X509CrlReason:()=>aX,cryptoProvider:()=>ic,diAlgorithm:()=>hx,diAlgorithmProvider:()=>hz,diAsnSignatureFormatter:()=>i0,idEd25519:()=>i7,idEd448:()=>i8,idX25519:()=>i5,idX448:()=>i6});var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,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,$,_,aa,ab,ac,ad,ae,af,ag,ah,ai,aj,ak,al,am,an,ao,ap,aq,ar,as,at,au,av,aw,ax,ay,az,aA,aB,aC,aD,aE,aF,aG,aH,aI,aJ,aK,aL,aM,aN,aO,aP,aQ,aR,aS,aT,aU,aV,aW,aX,aY,aZ,a$,a_,a0,a1,a2,a3={};c.r(a3),c.d(a3,{Any:()=>cr,BaseBlock:()=>bB,BaseStringBlock:()=>bC,BitString:()=>bR,BmpString:()=>b8,Boolean:()=>bN,CharacterString:()=>cj,Choice:()=>cs,Constructed:()=>bI,DATE:()=>cm,DateTime:()=>co,Duration:()=>cp,EndOfContent:()=>bK,Enumerated:()=>bV,GeneralString:()=>ci,GeneralizedTime:()=>cl,GraphicString:()=>cg,HexBlock:()=>bv,IA5String:()=>cf,Integer:()=>bU,Null:()=>bL,NumericString:()=>cb,ObjectIdentifier:()=>bY,OctetString:()=>bP,Primitive:()=>bE,PrintableString:()=>cc,RawData:()=>cu,RelativeObjectIdentifier:()=>b_,Repeated:()=>ct,Sequence:()=>b0,Set:()=>b1,TIME:()=>cq,TeletexString:()=>cd,TimeOfDay:()=>cn,UTCTime:()=>ck,UniversalString:()=>ca,Utf8String:()=>b6,ValueBlock:()=>bx,VideotexString:()=>ce,ViewWriter:()=>bl,VisibleString:()=>ch,compareSchema:()=>cv,fromBER:()=>bG,verifySchema:()=>cw}),c(86718);class a4{static isArrayBuffer(a){return"[object ArrayBuffer]"===Object.prototype.toString.call(a)}static toArrayBuffer(a){return this.isArrayBuffer(a)?a:a.byteLength===a.buffer.byteLength||0===a.byteOffset&&a.byteLength===a.buffer.byteLength?a.buffer:this.toUint8Array(a.buffer).slice(a.byteOffset,a.byteOffset+a.byteLength).buffer}static toUint8Array(a){return this.toView(a,Uint8Array)}static toView(a,b){if(a.constructor===b)return a;if(this.isArrayBuffer(a))return new b(a);if(this.isArrayBufferView(a))return new b(a.buffer,a.byteOffset,a.byteLength);throw TypeError("The provided value is not of type '(ArrayBuffer or ArrayBufferView)'")}static isBufferSource(a){return this.isArrayBufferView(a)||this.isArrayBuffer(a)}static isArrayBufferView(a){return ArrayBuffer.isView(a)||a&&this.isArrayBuffer(a.buffer)}static isEqual(a,b){let c=a4.toUint8Array(a),d=a4.toUint8Array(b);if(c.length!==d.byteLength)return!1;for(let a=0;a<c.length;a++)if(c[a]!==d[a])return!1;return!0}static concat(...a){let b;b=!Array.isArray(a[0])||a[1]instanceof Function?Array.isArray(a[0])&&a[1]instanceof Function?a[0]:a[a.length-1]instanceof Function?a.slice(0,a.length-1):a:a[0];let c=0;for(let a of b)c+=a.byteLength;let d=new Uint8Array(c),e=0;for(let a of b){let b=this.toUint8Array(a);d.set(b,e),e+=b.length}return a[a.length-1]instanceof Function?this.toView(d,a[a.length-1]):d.buffer}}let a5="string",a6=/^[0-9a-f\s]+$/i,a7=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,a8=/^[a-zA-Z0-9-_]+$/;class a9{static fromString(a){let b=unescape(encodeURIComponent(a)),c=new Uint8Array(b.length);for(let a=0;a<b.length;a++)c[a]=b.charCodeAt(a);return c.buffer}static toString(a){let b=a4.toUint8Array(a),c="";for(let a=0;a<b.length;a++)c+=String.fromCharCode(b[a]);return decodeURIComponent(escape(c))}}class ba{static toString(a,b=!1){let c=a4.toArrayBuffer(a),d=new DataView(c),e="";for(let a=0;a<c.byteLength;a+=2)e+=String.fromCharCode(d.getUint16(a,b));return e}static fromString(a,b=!1){let c=new ArrayBuffer(2*a.length),d=new DataView(c);for(let c=0;c<a.length;c++)d.setUint16(2*c,a.charCodeAt(c),b);return c}}class bb{static isHex(a){return typeof a===a5&&a6.test(a)}static isBase64(a){return typeof a===a5&&a7.test(a)}static isBase64Url(a){return typeof a===a5&&a8.test(a)}static ToString(a,b="utf8"){let c=a4.toUint8Array(a);switch(b.toLowerCase()){case"utf8":return this.ToUtf8String(c);case"binary":return this.ToBinary(c);case"hex":return this.ToHex(c);case"base64":return this.ToBase64(c);case"base64url":return this.ToBase64Url(c);case"utf16le":return ba.toString(c,!0);case"utf16":case"utf16be":return ba.toString(c);default:throw Error(`Unknown type of encoding '${b}'`)}}static FromString(a,b="utf8"){if(!a)return new ArrayBuffer(0);switch(b.toLowerCase()){case"utf8":return this.FromUtf8String(a);case"binary":return this.FromBinary(a);case"hex":return this.FromHex(a);case"base64":return this.FromBase64(a);case"base64url":return this.FromBase64Url(a);case"utf16le":return ba.fromString(a,!0);case"utf16":case"utf16be":return ba.fromString(a);default:throw Error(`Unknown type of encoding '${b}'`)}}static ToBase64(a){let b=a4.toUint8Array(a);return"u">typeof btoa?btoa(this.ToString(b,"binary")):Buffer.from(b).toString("base64")}static FromBase64(a){let b=this.formatString(a);if(!b)return new ArrayBuffer(0);if(!bb.isBase64(b))throw TypeError("Argument 'base64Text' is not Base64 encoded");return"u">typeof atob?this.FromBinary(atob(b)):new Uint8Array(Buffer.from(b,"base64")).buffer}static FromBase64Url(a){let b=this.formatString(a);if(!b)return new ArrayBuffer(0);if(!bb.isBase64Url(b))throw TypeError("Argument 'base64url' is not Base64Url encoded");return this.FromBase64(this.Base64Padding(b.replace(/\-/g,"+").replace(/\_/g,"/")))}static ToBase64Url(a){return this.ToBase64(a).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}static FromUtf8String(a,b=bb.DEFAULT_UTF8_ENCODING){switch(b){case"ascii":return this.FromBinary(a);case"utf8":return a9.fromString(a);case"utf16":case"utf16be":return ba.fromString(a);case"utf16le":case"usc2":return ba.fromString(a,!0);default:throw Error(`Unknown type of encoding '${b}'`)}}static ToUtf8String(a,b=bb.DEFAULT_UTF8_ENCODING){switch(b){case"ascii":return this.ToBinary(a);case"utf8":return a9.toString(a);case"utf16":case"utf16be":return ba.toString(a);case"utf16le":case"usc2":return ba.toString(a,!0);default:throw Error(`Unknown type of encoding '${b}'`)}}static FromBinary(a){let b=a.length,c=new Uint8Array(b);for(let d=0;d<b;d++)c[d]=a.charCodeAt(d);return c.buffer}static ToBinary(a){let b=a4.toUint8Array(a),c="";for(let a=0;a<b.length;a++)c+=String.fromCharCode(b[a]);return c}static ToHex(a){let b=a4.toUint8Array(a),c="",d=b.length;for(let a=0;a<d;a++){let d=b[a];d<16&&(c+="0"),c+=d.toString(16)}return c}static FromHex(a){let b=this.formatString(a);if(!b)return new ArrayBuffer(0);if(!bb.isHex(b))throw TypeError("Argument 'hexString' is not HEX encoded");b.length%2&&(b=`0${b}`);let c=new Uint8Array(b.length/2);for(let a=0;a<b.length;a+=2){let d=b.slice(a,a+2);c[a/2]=parseInt(d,16)}return c.buffer}static ToUtf16String(a,b=!1){return ba.toString(a,b)}static FromUtf16String(a,b=!1){return ba.fromString(a,b)}static Base64Padding(a){let b=4-a.length%4;if(b<4)for(let c=0;c<b;c++)a+="=";return a}static formatString(a){return(null==a?void 0:a.replace(/[\n\r\t ]/g,""))||""}}function bc(a,b){if(!(a&&b)||a.byteLength!==b.byteLength)return!1;let c=new Uint8Array(a),d=new Uint8Array(b);for(let b=0;b<a.byteLength;b++)if(c[b]!==d[b])return!1;return!0}function bd(a,b){let c=0;if(1===a.length)return a[0];for(let d=a.length-1;d>=0;d--)c+=a[a.length-1-d]*Math.pow(2,b*d);return c}function be(a,b,c=-1){let d=a,e=0,f=Math.pow(2,b);for(let g=1;g<8;g++){if(a<f){let a;if(c<0)a=new ArrayBuffer(g),e=g;else{if(c<g)return new ArrayBuffer(0);a=new ArrayBuffer(c),e=c}let f=new Uint8Array(a);for(let a=g-1;a>=0;a--){let c=Math.pow(2,a*b);f[e-a-1]=Math.floor(d/c),d-=f[e-a-1]*c}return a}f*=Math.pow(2,b)}return new ArrayBuffer(0)}function bf(...a){let b=0,c=0;for(let c of a)b+=c.length;let d=new Uint8Array(new ArrayBuffer(b));for(let b of a)d.set(b,c),c+=b.length;return d}function bg(){let a=new Uint8Array(this.valueHex);if(this.valueHex.byteLength>=2){let b=255===a[0]&&128&a[1],c=0===a[0]&&(128&a[1])==0;(b||c)&&this.warnings.push("Needlessly long format")}let b=new Uint8Array(new ArrayBuffer(this.valueHex.byteLength));for(let a=0;a<this.valueHex.byteLength;a++)b[a]=0;b[0]=128&a[0];let c=bd(b,8),d=new Uint8Array(new ArrayBuffer(this.valueHex.byteLength));for(let b=0;b<this.valueHex.byteLength;b++)d[b]=a[b];return d[0]&=127,bd(d,8)-c}function bh(a,b){let c=a.toString(10);if(b<c.length)return"";let d=b-c.length,e=Array(d);for(let a=0;a<d;a++)e[a]="0";return e.join("").concat(c)}function bi(){if("u"<typeof BigInt)throw Error("BigInt is not defined. Your environment doesn't implement BigInt.")}function bj(a){let b=0,c=0;for(let c=0;c<a.length;c++)b+=a[c].byteLength;let d=new Uint8Array(b);for(let b=0;b<a.length;b++){let e=a[b];d.set(new Uint8Array(e),c),c+=e.byteLength}return d.buffer}function bk(a,b,c,d){return b instanceof Uint8Array?b.byteLength?c<0?(a.error="Wrong parameter: inputOffset less than zero",!1):d<0?(a.error="Wrong parameter: inputLength less than zero",!1):!(b.byteLength-c-d<0)||(a.error="End of input reached before message was fully decoded (inconsistent offset and length values)",!1):(a.error="Wrong parameter: inputBuffer has zero length",!1):(a.error="Wrong parameter: inputBuffer must be 'Uint8Array'",!1)}bb.DEFAULT_UTF8_ENCODING="utf8";class bl{constructor(){this.items=[]}write(a){this.items.push(a)}final(){return bj(this.items)}}let bm=[new Uint8Array([1])],bn="0123456789",bo="name",bp="valueHexView",bq=new ArrayBuffer(0),br=new Uint8Array(0),bs="EndOfContent",bt="OCTET STRING",bu="BIT STRING";function bv(a){var b;return(b=class extends a{get valueHex(){return this.valueHexView.slice().buffer}set valueHex(a){this.valueHexView=new Uint8Array(a)}constructor(...a){var b;super(...a);const c=a[0]||{};this.isHexOnly=null!=(b=c.isHexOnly)&&b,this.valueHexView=c.valueHex?a4.toUint8Array(c.valueHex):br}fromBER(a,b,c){let d=a instanceof ArrayBuffer?new Uint8Array(a):a;if(!bk(this,d,b,c))return -1;let e=b+c;return(this.valueHexView=d.subarray(b,e),this.valueHexView.length)?(this.blockLength=c,e):(this.warnings.push("Zero buffer length"),b)}toBER(a=!1){return this.isHexOnly?a?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.byteLength===this.valueHexView.buffer.byteLength?this.valueHexView.buffer:this.valueHexView.slice().buffer:(this.error="Flag 'isHexOnly' is not set, abort",bq)}toJSON(){return{...super.toJSON(),isHexOnly:this.isHexOnly,valueHex:bb.ToHex(this.valueHexView)}}}).NAME="hexBlock",b}class bw{static blockName(){return this.NAME}get valueBeforeDecode(){return this.valueBeforeDecodeView.slice().buffer}set valueBeforeDecode(a){this.valueBeforeDecodeView=new Uint8Array(a)}constructor({blockLength:a=0,error:b="",warnings:c=[],valueBeforeDecode:d=br}={}){this.blockLength=a,this.error=b,this.warnings=c,this.valueBeforeDecodeView=a4.toUint8Array(d)}toJSON(){return{blockName:this.constructor.NAME,blockLength:this.blockLength,error:this.error,warnings:this.warnings,valueBeforeDecode:bb.ToHex(this.valueBeforeDecodeView)}}}bw.NAME="baseBlock";class bx extends bw{fromBER(a,b,c){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}toBER(a,b){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}}bx.NAME="valueBlock";class by extends bv(bw){constructor({idBlock:a={}}={}){var b,c,d,e;super(),a?(this.isHexOnly=null!=(b=a.isHexOnly)&&b,this.valueHexView=a.valueHex?a4.toUint8Array(a.valueHex):br,this.tagClass=null!=(c=a.tagClass)?c:-1,this.tagNumber=null!=(d=a.tagNumber)?d:-1,this.isConstructed=null!=(e=a.isConstructed)&&e):(this.tagClass=-1,this.tagNumber=-1,this.isConstructed=!1)}toBER(a=!1){let b=0;switch(this.tagClass){case 1:b|=0;break;case 2:b|=64;break;case 3:b|=128;break;case 4:b|=192;break;default:return this.error="Unknown tag class",bq}if(this.isConstructed&&(b|=32),this.tagNumber<31&&!this.isHexOnly){let c=new Uint8Array(1);if(!a){let a=this.tagNumber;a&=31,b|=a,c[0]=b}return c.buffer}if(!this.isHexOnly){let c=be(this.tagNumber,7),d=new Uint8Array(c),e=c.byteLength,f=new Uint8Array(e+1);if(f[0]=31|b,!a){for(let a=0;a<e-1;a++)f[a+1]=128|d[a];f[e]=d[e-1]}return f.buffer}let c=new Uint8Array(this.valueHexView.byteLength+1);if(c[0]=31|b,!a){let a=this.valueHexView;for(let b=0;b<a.length-1;b++)c[b+1]=128|a[b];c[this.valueHexView.byteLength]=a[a.length-1]}return c.buffer}fromBER(a,b,c){let d=a4.toUint8Array(a);if(!bk(this,d,b,c))return -1;let e=d.subarray(b,b+c);if(0===e.length)return this.error="Zero buffer length",-1;switch(192&e[0]){case 0:this.tagClass=1;break;case 64:this.tagClass=2;break;case 128:this.tagClass=3;break;case 192:this.tagClass=4;break;default:return this.error="Unknown tag class",-1}this.isConstructed=(32&e[0])==32,this.isHexOnly=!1;let f=31&e[0];if(31!==f)this.tagNumber=f,this.blockLength=1;else{let a=1,b=this.valueHexView=new Uint8Array(255),c=255;for(;128&e[a];){if(b[a-1]=127&e[a],++a>=e.length)return this.error="End of input reached before message was fully decoded",-1;if(a===c){let a=new Uint8Array(c+=255);for(let c=0;c<b.length;c++)a[c]=b[c];b=this.valueHexView=new Uint8Array(c)}}this.blockLength=a+1,b[a-1]=127&e[a];let d=new Uint8Array(a);for(let c=0;c<a;c++)d[c]=b[c];(b=this.valueHexView=new Uint8Array(a)).set(d),this.blockLength<=9?this.tagNumber=bd(b,7):(this.isHexOnly=!0,this.warnings.push("Tag too long, represented as hex-coded"))}if(1===this.tagClass&&this.isConstructed)switch(this.tagNumber){case 1:case 2:case 5:case 6:case 9:case 13:case 14:case 23:case 24:case 31:case 32:case 33:case 34:return this.error="Constructed encoding used for primitive type",-1}return b+this.blockLength}toJSON(){return{...super.toJSON(),tagClass:this.tagClass,tagNumber:this.tagNumber,isConstructed:this.isConstructed}}}by.NAME="identificationBlock";class bz extends bw{constructor({lenBlock:a={}}={}){var b,c,d;super(),this.isIndefiniteForm=null!=(b=a.isIndefiniteForm)&&b,this.longFormUsed=null!=(c=a.longFormUsed)&&c,this.length=null!=(d=a.length)?d:0}fromBER(a,b,c){let d=a4.toUint8Array(a);if(!bk(this,d,b,c))return -1;let e=d.subarray(b,b+c);if(0===e.length)return this.error="Zero buffer length",-1;if(255===e[0])return this.error="Length block 0xFF is reserved by standard",-1;if(this.isIndefiniteForm=128===e[0],this.isIndefiniteForm)return this.blockLength=1,b+this.blockLength;if(this.longFormUsed=!!(128&e[0]),!1===this.longFormUsed)return this.length=e[0],this.blockLength=1,b+this.blockLength;let f=127&e[0];if(f>8)return this.error="Too big integer",-1;if(f+1>e.length)return this.error="End of input reached before message was fully decoded",-1;let g=b+1,h=d.subarray(g,g+f);return 0===h[f-1]&&this.warnings.push("Needlessly long encoded length"),this.length=bd(h,8),this.longFormUsed&&this.length<=127&&this.warnings.push("Unnecessary usage of long length form"),this.blockLength=f+1,b+this.blockLength}toBER(a=!1){let b,c;if(this.length>127&&(this.longFormUsed=!0),this.isIndefiniteForm)return b=new ArrayBuffer(1),!1===a&&((c=new Uint8Array(b))[0]=128),b;if(this.longFormUsed){let d=be(this.length,8);if(d.byteLength>127)return this.error="Too big length",bq;if(b=new ArrayBuffer(d.byteLength+1),a)return b;let e=new Uint8Array(d);(c=new Uint8Array(b))[0]=128|d.byteLength;for(let a=0;a<d.byteLength;a++)c[a+1]=e[a];return b}return b=new ArrayBuffer(1),!1===a&&((c=new Uint8Array(b))[0]=this.length),b}toJSON(){return{...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,longFormUsed:this.longFormUsed,length:this.length}}}bz.NAME="lengthBlock";let bA={};class bB extends bw{constructor({name:a="",optional:b=!1,primitiveSchema:c,...d}={},e){super(d),this.name=a,this.optional=b,c&&(this.primitiveSchema=c),this.idBlock=new by(d),this.lenBlock=new bz(d),this.valueBlock=e?new e(d):new bx(d)}fromBER(a,b,c){let d=this.valueBlock.fromBER(a,b,this.lenBlock.isIndefiniteForm?c:this.lenBlock.length);return -1===d?this.error=this.valueBlock.error:(this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength)),d}toBER(a,b){let c=b||new bl;b||function a(b){var c;if(b instanceof bA.Constructed)for(let c of b.valueBlock.value)a(c)&&(b.lenBlock.isIndefiniteForm=!0);return!!(null==(c=b.lenBlock)?void 0:c.isIndefiniteForm)}(this);let d=this.idBlock.toBER(a);if(c.write(d),this.lenBlock.isIndefiniteForm)c.write(new Uint8Array([128]).buffer),this.valueBlock.toBER(a,c),c.write(new ArrayBuffer(2));else{let b=this.valueBlock.toBER(a);this.lenBlock.length=b.byteLength;let d=this.lenBlock.toBER(a);c.write(d),c.write(b)}return b?bq:c.final()}toJSON(){let a={...super.toJSON(),idBlock:this.idBlock.toJSON(),lenBlock:this.lenBlock.toJSON(),valueBlock:this.valueBlock.toJSON(),name:this.name,optional:this.optional};return this.primitiveSchema&&(a.primitiveSchema=this.primitiveSchema.toJSON()),a}toString(a="ascii"){return"ascii"===a?this.onAsciiEncoding():bb.ToHex(this.toBER())}onAsciiEncoding(){let a=this.constructor.NAME,b=bb.ToHex(this.valueBlock.valueBeforeDecodeView);return`${a} : ${b}`}isEqual(a){if(this===a)return!0;if(!(a instanceof this.constructor))return!1;let b=this.toBER(),c=a.toBER();if(b.byteLength!==c.byteLength)return!1;let d=new Uint8Array(b),e=new Uint8Array(c);for(let a=0;a<d.length;a++)if(d[a]!==e[a])return!1;return!0}}bB.NAME="BaseBlock";class bC extends bB{getValue(){return this.valueBlock.value}setValue(a){this.valueBlock.value=a}constructor({value:a="",...b}={},c){super(b,c),a&&this.fromString(a)}fromBER(a,b,c){let d=this.valueBlock.fromBER(a,b,this.lenBlock.isIndefiniteForm?c:this.lenBlock.length);return -1===d?this.error=this.valueBlock.error:(this.fromBuffer(this.valueBlock.valueHexView),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength)),d}onAsciiEncoding(){return`${this.constructor.NAME} : '${this.valueBlock.value}'`}}bC.NAME="BaseStringBlock";class bD extends bv(bx){constructor({isHexOnly:a=!0,...b}={}){super(b),this.isHexOnly=a}}bD.NAME="PrimitiveValueBlock";class bE extends bB{constructor(a={}){super(a,bD),this.idBlock.isConstructed=!1}}function bF(a,b=0,c=a.length){let d=b,e=new bB({},bx),f=new bw;if(!bk(f,a,b,c))return e.error=f.error,{offset:-1,result:e};if(!a.subarray(b,b+c).length)return e.error="Zero buffer length",{offset:-1,result:e};let g=e.idBlock.fromBER(a,b,c);if(e.idBlock.warnings.length&&e.warnings.concat(e.idBlock.warnings),-1===g)return e.error=e.idBlock.error,{offset:-1,result:e};if(b=g,c-=e.idBlock.blockLength,g=e.lenBlock.fromBER(a,b,c),e.lenBlock.warnings.length&&e.warnings.concat(e.lenBlock.warnings),-1===g)return e.error=e.lenBlock.error,{offset:-1,result:e};if(b=g,c-=e.lenBlock.blockLength,!e.idBlock.isConstructed&&e.lenBlock.isIndefiniteForm)return e.error="Indefinite length form used for primitive encoding form",{offset:-1,result:e};let h=bB;if(1===e.idBlock.tagClass){if(e.idBlock.tagNumber>=37&&!1===e.idBlock.isHexOnly)return e.error="UNIVERSAL 37 and upper tags are reserved by ASN.1 standard",{offset:-1,result:e};switch(e.idBlock.tagNumber){case 0:if(e.idBlock.isConstructed&&e.lenBlock.length>0)return e.error="Type [UNIVERSAL 0] is reserved",{offset:-1,result:e};h=bA.EndOfContent;break;case 1:h=bA.Boolean;break;case 2:h=bA.Integer;break;case 3:h=bA.BitString;break;case 4:h=bA.OctetString;break;case 5:h=bA.Null;break;case 6:h=bA.ObjectIdentifier;break;case 10:h=bA.Enumerated;break;case 12:h=bA.Utf8String;break;case 13:h=bA.RelativeObjectIdentifier;break;case 14:h=bA.TIME;break;case 15:return e.error="[UNIVERSAL 15] is reserved by ASN.1 standard",{offset:-1,result:e};case 16:h=bA.Sequence;break;case 17:h=bA.Set;break;case 18:h=bA.NumericString;break;case 19:h=bA.PrintableString;break;case 20:h=bA.TeletexString;break;case 21:h=bA.VideotexString;break;case 22:h=bA.IA5String;break;case 23:h=bA.UTCTime;break;case 24:h=bA.GeneralizedTime;break;case 25:h=bA.GraphicString;break;case 26:h=bA.VisibleString;break;case 27:h=bA.GeneralString;break;case 28:h=bA.UniversalString;break;case 29:h=bA.CharacterString;break;case 30:h=bA.BmpString;break;case 31:h=bA.DATE;break;case 32:h=bA.TimeOfDay;break;case 33:h=bA.DateTime;break;case 34:h=bA.Duration;break;default:{let a=e.idBlock.isConstructed?new bA.Constructed:new bA.Primitive;a.idBlock=e.idBlock,a.lenBlock=e.lenBlock,a.warnings=e.warnings,e=a}}}else h=e.idBlock.isConstructed?bA.Constructed:bA.Primitive;return g=(e=function(a,b){if(a instanceof b)return a;let c=new b;return c.idBlock=a.idBlock,c.lenBlock=a.lenBlock,c.warnings=a.warnings,c.valueBeforeDecodeView=a.valueBeforeDecodeView,c}(e,h)).fromBER(a,b,e.lenBlock.isIndefiniteForm?c:e.lenBlock.length),e.valueBeforeDecodeView=a.subarray(d,d+e.blockLength),{offset:g,result:e}}function bG(a){if(!a.byteLength){let a=new bB({},bx);return a.error="Input buffer has zero length",{offset:-1,result:a}}return bF(a4.toUint8Array(a).slice(),0,a.byteLength)}bA.Primitive=bE,bE.NAME="PRIMITIVE";class bH extends bx{constructor({value:a=[],isIndefiniteForm:b=!1,...c}={}){super(c),this.value=a,this.isIndefiniteForm=b}fromBER(a,b,c){var d,e;let f=a4.toUint8Array(a);if(!bk(this,f,b,c))return -1;if(this.valueBeforeDecodeView=f.subarray(b,b+c),0===this.valueBeforeDecodeView.length)return this.warnings.push("Zero buffer length"),b;let g=b;for(;d=this.isIndefiniteForm,e=c,(d?1:e)>0;){let a=bF(f,g,c);if(-1===a.offset)return this.error=a.result.error,this.warnings.concat(a.result.warnings),-1;if(g=a.offset,this.blockLength+=a.result.blockLength,c-=a.result.blockLength,this.value.push(a.result),this.isIndefiniteForm&&a.result.constructor.NAME===bs)break}return this.isIndefiniteForm&&(this.value[this.value.length-1].constructor.NAME===bs?this.value.pop():this.warnings.push("No EndOfContent block encoded")),g}toBER(a,b){let c=b||new bl;for(let b=0;b<this.value.length;b++)this.value[b].toBER(a,c);return b?bq:c.final()}toJSON(){let a={...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,value:[]};for(let b of this.value)a.value.push(b.toJSON());return a}}bH.NAME="ConstructedValueBlock";class bI extends bB{constructor(a={}){super(a,bH),this.idBlock.isConstructed=!0}fromBER(a,b,c){this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm;let d=this.valueBlock.fromBER(a,b,this.lenBlock.isIndefiniteForm?c:this.lenBlock.length);return -1===d?this.error=this.valueBlock.error:(this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength)),d}onAsciiEncoding(){let a=[];for(let b of this.valueBlock.value)a.push(b.toString("ascii").split("\n").map(a=>` ${a}`).join("\n"));let b=3===this.idBlock.tagClass?`[${this.idBlock.tagNumber}]`:this.constructor.NAME;return a.length?`${b} :
6
5
  ${a.join("\n")}`:`${b} :`}}bA.Constructed=bI,bI.NAME="CONSTRUCTED";class bJ extends bx{fromBER(a,b,c){return b}toBER(a){return bq}}bJ.override="EndOfContentValueBlock";class bK extends bB{constructor(a={}){super(a,bJ),this.idBlock.tagClass=1,this.idBlock.tagNumber=0}}bA.EndOfContent=bK,bK.NAME=bs;class bL extends bB{constructor(a={}){super(a,bx),this.idBlock.tagClass=1,this.idBlock.tagNumber=5}fromBER(a,b,c){return(this.lenBlock.length>0&&this.warnings.push("Non-zero length of value block for Null type"),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.blockLength+=c,b+c>a.byteLength)?(this.error="End of input reached before message was fully decoded (inconsistent offset and length values)",-1):b+c}toBER(a,b){let c=new ArrayBuffer(2);if(!a){let a=new Uint8Array(c);a[0]=5,a[1]=0}return b&&b.write(c),c}onAsciiEncoding(){return`${this.constructor.NAME}`}}bA.Null=bL,bL.NAME="NULL";class bM extends bv(bx){get value(){for(let a of this.valueHexView)if(a>0)return!0;return!1}set value(a){this.valueHexView[0]=255*!!a}constructor({value:a,...b}={}){super(b),b.valueHex?this.valueHexView=a4.toUint8Array(b.valueHex):this.valueHexView=new Uint8Array(1),a&&(this.value=a)}fromBER(a,b,c){let d=a4.toUint8Array(a);return bk(this,d,b,c)?(this.valueHexView=d.subarray(b,b+c),c>1&&this.warnings.push("Boolean value encoded in more then 1 octet"),this.isHexOnly=!0,bg.call(this),this.blockLength=c,b+c):-1}toBER(){return this.valueHexView.slice()}toJSON(){return{...super.toJSON(),value:this.value}}}bM.NAME="BooleanValueBlock";class bN extends bB{getValue(){return this.valueBlock.value}setValue(a){this.valueBlock.value=a}constructor(a={}){super(a,bM),this.idBlock.tagClass=1,this.idBlock.tagNumber=1}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.getValue}`}}bA.Boolean=bN,bN.NAME="BOOLEAN";class bO extends bv(bH){constructor({isConstructed:a=!1,...b}={}){super(b),this.isConstructed=a}fromBER(a,b,c){let d=0;if(this.isConstructed){if(this.isHexOnly=!1,-1===(d=bH.prototype.fromBER.call(this,a,b,c)))return d;for(let a=0;a<this.value.length;a++){let b=this.value[a].constructor.NAME;if(b===bs)if(!this.isIndefiniteForm)return this.error="EndOfContent is unexpected, OCTET STRING may consists of OCTET STRINGs only",-1;else break;if(b!==bt)return this.error="OCTET STRING may consists of OCTET STRINGs only",-1}}else this.isHexOnly=!0,d=super.fromBER(a,b,c),this.blockLength=c;return d}toBER(a,b){return this.isConstructed?bH.prototype.toBER.call(this,a,b):a?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),isConstructed:this.isConstructed}}}bO.NAME="OctetStringValueBlock";class bP extends bB{constructor({idBlock:a={},lenBlock:b={},...c}={}){var d;null!=c.isConstructed||(c.isConstructed=!!(null==(d=c.value)?void 0:d.length)),super({idBlock:{isConstructed:c.isConstructed,...a},lenBlock:{...b,isIndefiniteForm:!!c.isIndefiniteForm},...c},bO),this.idBlock.tagClass=1,this.idBlock.tagNumber=4}fromBER(a,b,c){if(this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,0===c)return 0===this.idBlock.error.length&&(this.blockLength+=this.idBlock.blockLength),0===this.lenBlock.error.length&&(this.blockLength+=this.lenBlock.blockLength),b;if(!this.valueBlock.isConstructed){let d=(a instanceof ArrayBuffer?new Uint8Array(a):a).subarray(b,b+c);try{if(d.byteLength){let a=bF(d,0,d.byteLength);-1!==a.offset&&a.offset===c&&(this.valueBlock.value=[a.result])}}catch{}}return super.fromBER(a,b,c)}onAsciiEncoding(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length)return bI.prototype.onAsciiEncoding.call(this);let a=this.constructor.NAME,b=bb.ToHex(this.valueBlock.valueHexView);return`${a} : ${b}`}getValue(){if(!this.idBlock.isConstructed)return this.valueBlock.valueHexView.slice().buffer;let a=[];for(let b of this.valueBlock.value)b instanceof u&&a.push(b.valueBlock.valueHexView);return a4.concat(a)}}bA.OctetString=u=bP,bP.NAME=bt;class bQ extends bv(bH){constructor({unusedBits:a=0,isConstructed:b=!1,...c}={}){super(c),this.unusedBits=a,this.isConstructed=b,this.blockLength=this.valueHexView.byteLength}fromBER(a,b,c){if(!c)return b;let d=-1;if(this.isConstructed){if(-1===(d=bH.prototype.fromBER.call(this,a,b,c)))return d;for(let a of this.value){let b=a.constructor.NAME;if(b===bs)if(!this.isIndefiniteForm)return this.error="EndOfContent is unexpected, BIT STRING may consists of BIT STRINGs only",-1;else break;if(b!==bu)return this.error="BIT STRING may consists of BIT STRINGs only",-1;let c=a.valueBlock;if(this.unusedBits>0&&c.unusedBits>0)return this.error='Using of "unused bits" inside constructive BIT STRING allowed for least one only',-1;this.unusedBits=c.unusedBits}return d}let e=a4.toUint8Array(a);if(!bk(this,e,b,c))return -1;let f=e.subarray(b,b+c);if(this.unusedBits=f[0],this.unusedBits>7)return this.error="Unused bits for BitString must be in range 0-7",-1;if(!this.unusedBits){let a=f.subarray(1);try{if(a.byteLength){let b=bF(a,0,a.byteLength);-1!==b.offset&&b.offset===c-1&&(this.value=[b.result])}}catch{}}return this.valueHexView=f.subarray(1),this.blockLength=f.length,b+c}toBER(a,b){if(this.isConstructed)return bH.prototype.toBER.call(this,a,b);if(a)return new ArrayBuffer(this.valueHexView.byteLength+1);if(!this.valueHexView.byteLength){let a=new Uint8Array(1);return a[0]=0,a.buffer}let c=new Uint8Array(this.valueHexView.length+1);return c[0]=this.unusedBits,c.set(this.valueHexView,1),c.buffer}toJSON(){return{...super.toJSON(),unusedBits:this.unusedBits,isConstructed:this.isConstructed}}}bQ.NAME="BitStringValueBlock";class bR extends bB{constructor({idBlock:a={},lenBlock:b={},...c}={}){var d;null!=c.isConstructed||(c.isConstructed=!!(null==(d=c.value)?void 0:d.length)),super({idBlock:{isConstructed:c.isConstructed,...a},lenBlock:{...b,isIndefiniteForm:!!c.isIndefiniteForm},...c},bQ),this.idBlock.tagClass=1,this.idBlock.tagNumber=3}fromBER(a,b,c){return this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,super.fromBER(a,b,c)}onAsciiEncoding(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length)return bI.prototype.onAsciiEncoding.call(this);{let a=[];for(let b of this.valueBlock.valueHexView)a.push(b.toString(2).padStart(8,"0"));let b=a.join(""),c=this.constructor.NAME,d=b.substring(0,b.length-this.valueBlock.unusedBits);return`${c} : ${d}`}}}function bS(a){if(a>=bm.length)for(let b=bm.length;b<=a;b++){let a=new Uint8Array([0]),c=bm[b-1].slice(0);for(let b=c.length-1;b>=0;b--){let d=new Uint8Array([(c[b]<<1)+a[0]]);a[0]=d[0]/10,c[b]=d[0]%10}a[0]>0&&(c=bf(a,c)),bm.push(c)}return bm[a]}bA.BitString=bR,bR.NAME=bu;class bT extends bv(bx){setValueHex(){this.valueHexView.length>=4?(this.warnings.push("Too big Integer for decoding, hex only"),this.isHexOnly=!0,this._valueDec=0):(this.isHexOnly=!1,this.valueHexView.length>0&&(this._valueDec=bg.call(this)))}constructor({value:a,...b}={}){super(b),this._valueDec=0,b.valueHex&&this.setValueHex(),void 0!==a&&(this.valueDec=a)}set valueDec(a){this._valueDec=a,this.isHexOnly=!1,this.valueHexView=new Uint8Array(function(a){let b=a<0?-1*a:a,c=128;for(let d=1;d<8;d++){if(b<=c){if(a<0){let a=be(c-b,8,d),e=new Uint8Array(a);return e[0]|=128,a}let e=be(b,8,d),f=new Uint8Array(e);if(128&f[0]){let a=e.slice(0),b=new Uint8Array(a);f=new Uint8Array(e=new ArrayBuffer(e.byteLength+1));for(let c=0;c<a.byteLength;c++)f[c+1]=b[c];f[0]=0}return e}c*=256}return new ArrayBuffer(0)}(a))}get valueDec(){return this._valueDec}fromDER(a,b,c,d=0){let e=this.fromBER(a,b,c);if(-1===e)return e;let f=this.valueHexView;return 0===f[0]&&(128&f[1])!=0?this.valueHexView=f.subarray(1):0!==d&&f.length<d&&(d-f.length>1&&(d=f.length+1),this.valueHexView=f.subarray(d-f.length)),e}toDER(a=!1){let b=this.valueHexView;switch(!0){case(128&b[0])!=0:{let a=new Uint8Array(this.valueHexView.length+1);a[0]=0,a.set(b,1),this.valueHexView=a}break;case 0===b[0]&&(128&b[1])==0:this.valueHexView=this.valueHexView.subarray(1)}return this.toBER(a)}fromBER(a,b,c){let d=super.fromBER(a,b,c);return -1===d||this.setValueHex(),d}toBER(a){return a?new ArrayBuffer(this.valueHexView.length):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}toString(){let a,b=8*this.valueHexView.length-1,c=new Uint8Array(8*this.valueHexView.length/3),d=0,e=this.valueHexView,f="",g=!1;for(let g=e.byteLength-1;g>=0;g--){a=e[g];for(let e=0;e<8;e++)(1&a)==1&&(d===b?(c=function(a,b){let c,d=0,e=new Uint8Array(a),f=new Uint8Array(b),g=e.slice(0),h=g.length-1,i=f.slice(0),j=i.length-1,k=0;for(let a=j;a>=0;a--,k++)!0==(c=g[h-k]-i[j-k]-d)<0?(d=1,g[h-k]=c+10):(d=0,g[h-k]=c);if(d>0)for(let a=h-j+1;a>=0;a--,k++)if((c=g[h-k]-d)<0)d=1,g[h-k]=c+10;else{d=0,g[h-k]=c;break}return g.slice()}(bS(d),c),f="-"):c=function(a,b){let c=new Uint8Array([0]),d=new Uint8Array(a),e=new Uint8Array(b),f=d.slice(0),g=f.length-1,h=e.slice(0),i=h.length-1,j=0,k=i<g?g:i,l=0;for(let a=k;a>=0;a--,l++)j=!0==l<h.length?f[g-l]+h[i-l]+c[0]:f[g-l]+c[0],c[0]=j/10,!0==l>=f.length?f=bf(new Uint8Array([j%10]),f):f[g-l]=j%10;return c[0]>0&&(f=bf(c,f)),f}(c,bS(d))),d++,a>>=1}for(let a=0;a<c.length;a++)c[a]&&(g=!0),g&&(f+=bn.charAt(c[a]));return!1===g&&(f+=bn.charAt(0)),f}}bT.NAME="IntegerValueBlock",Object.defineProperty(bT.prototype,"valueHex",{set:function(a){this.valueHexView=new Uint8Array(a),this.setValueHex()},get:function(){return this.valueHexView.slice().buffer}});class bU extends bB{constructor(a={}){super(a,bT),this.idBlock.tagClass=1,this.idBlock.tagNumber=2}toBigInt(){return bi(),BigInt(this.valueBlock.toString())}static fromBigInt(a){bi();let b=BigInt(a),c=new bl,d=b.toString(16).replace(/^-/,""),e=new Uint8Array(bb.FromHex(d));if(b<0){let a=new Uint8Array(e.length+(128&e[0]?1:0));a[0]|=128;let d=BigInt(`0x${bb.ToHex(a)}`)+b,f=a4.toUint8Array(bb.FromHex(d.toString(16)));f[0]|=128,c.write(f)}else 128&e[0]&&c.write(new Uint8Array([0])),c.write(e);return new v({valueHex:c.final()})}convertToDER(){let a=new v({valueHex:this.valueBlock.valueHexView});return a.valueBlock.toDER(),a}convertFromDER(){return new v({valueHex:0===this.valueBlock.valueHexView[0]?this.valueBlock.valueHexView.subarray(1):this.valueBlock.valueHexView})}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()}`}}bA.Integer=v=bU,bU.NAME="INTEGER";class bV extends bU{constructor(a={}){super(a),this.idBlock.tagClass=1,this.idBlock.tagNumber=10}}bA.Enumerated=bV,bV.NAME="ENUMERATED";class bW extends bv(bx){constructor({valueDec:a=-1,isFirstSid:b=!1,...c}={}){super(c),this.valueDec=a,this.isFirstSid=b}fromBER(a,b,c){if(!c)return b;let d=a4.toUint8Array(a);if(!bk(this,d,b,c))return -1;let e=d.subarray(b,b+c);this.valueHexView=new Uint8Array(c);for(let a=0;a<c&&(this.valueHexView[a]=127&e[a],this.blockLength++,(128&e[a])!=0);a++);let f=new Uint8Array(this.blockLength);for(let a=0;a<this.blockLength;a++)f[a]=this.valueHexView[a];return(this.valueHexView=f,(128&e[this.blockLength-1])!=0)?(this.error="End of input reached before message was fully decoded",-1):(0===this.valueHexView[0]&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=bd(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),b+this.blockLength)}set valueBigInt(a){bi();let b=BigInt(a).toString(2);for(;b.length%7;)b="0"+b;let c=new Uint8Array(b.length/7);for(let a=0;a<c.length;a++)c[a]=parseInt(b.slice(7*a,7*a+7),2)+128*(a+1<c.length);this.fromBER(c.buffer,0,c.length)}toBER(a){if(this.isHexOnly){if(a)return new ArrayBuffer(this.valueHexView.byteLength);let b=this.valueHexView,c=new Uint8Array(this.blockLength);for(let a=0;a<this.blockLength-1;a++)c[a]=128|b[a];return c[this.blockLength-1]=b[this.blockLength-1],c.buffer}let b=be(this.valueDec,7);if(0===b.byteLength)return this.error="Error during encoding SID value",bq;let c=new Uint8Array(b.byteLength);if(!a){let a=new Uint8Array(b),d=b.byteLength-1;for(let b=0;b<d;b++)c[b]=128|a[b];c[d]=a[d]}return c}toString(){let a="";if(this.isHexOnly)a=bb.ToHex(this.valueHexView);else if(this.isFirstSid){let b=this.valueDec;this.valueDec<=39?a="0.":this.valueDec<=79?(a="1.",b-=40):(a="2.",b-=80),a+=b.toString()}else a=this.valueDec.toString();return a}toJSON(){return{...super.toJSON(),valueDec:this.valueDec,isFirstSid:this.isFirstSid}}}bW.NAME="sidBlock";class bX extends bx{constructor({value:a="",...b}={}){super(b),this.value=[],a&&this.fromString(a)}fromBER(a,b,c){let d=b;for(;c>0;){let b=new bW;if(-1===(d=b.fromBER(a,d,c))){this.blockLength=0,this.error=b.error;break}0===this.value.length&&(b.isFirstSid=!0),this.blockLength+=b.blockLength,c-=b.blockLength,this.value.push(b)}return d}toBER(a){let b=[];for(let c=0;c<this.value.length;c++){let d=this.value[c].toBER(a);if(0===d.byteLength)return this.error=this.value[c].error,bq;b.push(d)}return bj(b)}fromString(a){this.value=[];let b=0,c=0,d="",e=!1;do if(d=-1===(c=a.indexOf(".",b))?a.substring(b):a.substring(b,c),b=c+1,e){let a=this.value[0],b=0;switch(a.valueDec){case 0:break;case 1:b=40;break;case 2:b=80;break;default:this.value=[];return}let c=parseInt(d,10);if(isNaN(c))return;a.valueDec=c+b,e=!1}else{let a=new bW;if(d>Number.MAX_SAFE_INTEGER)bi(),a.valueBigInt=BigInt(d);else if(a.valueDec=parseInt(d,10),isNaN(a.valueDec))return;this.value.length||(a.isFirstSid=!0,e=!0),this.value.push(a)}while(-1!==c)}toString(){let a="",b=!1;for(let c=0;c<this.value.length;c++){b=this.value[c].isHexOnly;let d=this.value[c].toString();0!==c&&(a=`${a}.`),b?(d=`{${d}}`,this.value[c].isFirstSid?a=`2.{${d} - 80}`:a+=d):a+=d}return a}toJSON(){let a={...super.toJSON(),value:this.toString(),sidArray:[]};for(let b=0;b<this.value.length;b++)a.sidArray.push(this.value[b].toJSON());return a}}bX.NAME="ObjectIdentifierValueBlock";class bY extends bB{getValue(){return this.valueBlock.toString()}setValue(a){this.valueBlock.fromString(a)}constructor(a={}){super(a,bX),this.idBlock.tagClass=1,this.idBlock.tagNumber=6}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return{...super.toJSON(),value:this.getValue()}}}bA.ObjectIdentifier=bY,bY.NAME="OBJECT IDENTIFIER";class bZ extends bv(bw){constructor({valueDec:a=0,...b}={}){super(b),this.valueDec=a}fromBER(a,b,c){if(0===c)return b;let d=a4.toUint8Array(a);if(!bk(this,d,b,c))return -1;let e=d.subarray(b,b+c);this.valueHexView=new Uint8Array(c);for(let a=0;a<c&&(this.valueHexView[a]=127&e[a],this.blockLength++,(128&e[a])!=0);a++);let f=new Uint8Array(this.blockLength);for(let a=0;a<this.blockLength;a++)f[a]=this.valueHexView[a];return(this.valueHexView=f,(128&e[this.blockLength-1])!=0)?(this.error="End of input reached before message was fully decoded",-1):(0===this.valueHexView[0]&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=bd(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),b+this.blockLength)}toBER(a){if(this.isHexOnly){if(a)return new ArrayBuffer(this.valueHexView.byteLength);let b=this.valueHexView,c=new Uint8Array(this.blockLength);for(let a=0;a<this.blockLength-1;a++)c[a]=128|b[a];return c[this.blockLength-1]=b[this.blockLength-1],c.buffer}let b=be(this.valueDec,7);if(0===b.byteLength)return this.error="Error during encoding SID value",bq;let c=new Uint8Array(b.byteLength);if(!a){let a=new Uint8Array(b),d=b.byteLength-1;for(let b=0;b<d;b++)c[b]=128|a[b];c[d]=a[d]}return c.buffer}toString(){return this.isHexOnly?bb.ToHex(this.valueHexView):this.valueDec.toString()}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}}bZ.NAME="relativeSidBlock";class b$ extends bx{constructor({value:a="",...b}={}){super(b),this.value=[],a&&this.fromString(a)}fromBER(a,b,c){let d=b;for(;c>0;){let b=new bZ;if(-1===(d=b.fromBER(a,d,c))){this.blockLength=0,this.error=b.error;break}this.blockLength+=b.blockLength,c-=b.blockLength,this.value.push(b)}return d}toBER(a,b){let c=[];for(let b=0;b<this.value.length;b++){let d=this.value[b].toBER(a);if(0===d.byteLength)return this.error=this.value[b].error,bq;c.push(d)}return bj(c)}fromString(a){this.value=[];let b=0,c=0,d="";do{d=-1===(c=a.indexOf(".",b))?a.substring(b):a.substring(b,c),b=c+1;let e=new bZ;if(e.valueDec=parseInt(d,10),isNaN(e.valueDec))break;this.value.push(e)}while(-1!==c);return!0}toString(){let a="",b=!1;for(let c=0;c<this.value.length;c++){b=this.value[c].isHexOnly;let d=this.value[c].toString();0!==c&&(a=`${a}.`),b?a+=d=`{${d}}`:a+=d}return a}toJSON(){let a={...super.toJSON(),value:this.toString(),sidArray:[]};for(let b=0;b<this.value.length;b++)a.sidArray.push(this.value[b].toJSON());return a}}b$.NAME="RelativeObjectIdentifierValueBlock";class b_ extends bB{getValue(){return this.valueBlock.toString()}setValue(a){this.valueBlock.fromString(a)}constructor(a={}){super(a,b$),this.idBlock.tagClass=1,this.idBlock.tagNumber=13}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return{...super.toJSON(),value:this.getValue()}}}bA.RelativeObjectIdentifier=b_,b_.NAME="RelativeObjectIdentifier";class b0 extends bI{constructor(a={}){super(a),this.idBlock.tagClass=1,this.idBlock.tagNumber=16}}bA.Sequence=b0,b0.NAME="SEQUENCE";class b1 extends bI{constructor(a={}){super(a),this.idBlock.tagClass=1,this.idBlock.tagNumber=17}}bA.Set=b1,b1.NAME="SET";class b2 extends bv(bx){constructor({...a}={}){super(a),this.isHexOnly=!0,this.value=""}toJSON(){return{...super.toJSON(),value:this.value}}}b2.NAME="StringValueBlock";class b3 extends b2{}b3.NAME="SimpleStringValueBlock";class b4 extends bC{constructor({...a}={}){super(a,b3)}fromBuffer(a){this.valueBlock.value=String.fromCharCode.apply(null,a4.toUint8Array(a))}fromString(a){let b=a.length,c=this.valueBlock.valueHexView=new Uint8Array(b);for(let d=0;d<b;d++)c[d]=a.charCodeAt(d);this.valueBlock.value=a}}b4.NAME="SIMPLE STRING";class b5 extends b4{fromBuffer(a){this.valueBlock.valueHexView=a4.toUint8Array(a);try{this.valueBlock.value=bb.ToUtf8String(a)}catch(b){this.warnings.push(`Error during "decodeURIComponent": ${b}, using raw string`),this.valueBlock.value=bb.ToBinary(a)}}fromString(a){this.valueBlock.valueHexView=new Uint8Array(bb.FromUtf8String(a)),this.valueBlock.value=a}}b5.NAME="Utf8StringValueBlock";class b6 extends b5{constructor(a={}){super(a),this.idBlock.tagClass=1,this.idBlock.tagNumber=12}}bA.Utf8String=b6,b6.NAME="UTF8String";class b7 extends b4{fromBuffer(a){this.valueBlock.value=bb.ToUtf16String(a),this.valueBlock.valueHexView=a4.toUint8Array(a)}fromString(a){this.valueBlock.value=a,this.valueBlock.valueHexView=new Uint8Array(bb.FromUtf16String(a))}}b7.NAME="BmpStringValueBlock";class b8 extends b7{constructor({...a}={}){super(a),this.idBlock.tagClass=1,this.idBlock.tagNumber=30}}bA.BmpString=b8,b8.NAME="BMPString";class b9 extends b4{fromBuffer(a){let b=ArrayBuffer.isView(a)?a.slice().buffer:a.slice(0),c=new Uint8Array(b);for(let a=0;a<c.length;a+=4)c[a]=c[a+3],c[a+1]=c[a+2],c[a+2]=0,c[a+3]=0;this.valueBlock.value=String.fromCharCode.apply(null,new Uint32Array(b))}fromString(a){let b=a.length,c=this.valueBlock.valueHexView=new Uint8Array(4*b);for(let d=0;d<b;d++){let b=new Uint8Array(be(a.charCodeAt(d),8));if(b.length>4)continue;let e=4-b.length;for(let a=b.length-1;a>=0;a--)c[4*d+a+e]=b[a]}this.valueBlock.value=a}}b9.NAME="UniversalStringValueBlock";class ca extends b9{constructor({...a}={}){super(a),this.idBlock.tagClass=1,this.idBlock.tagNumber=28}}bA.UniversalString=ca,ca.NAME="UniversalString";class cb extends b4{constructor(a={}){super(a),this.idBlock.tagClass=1,this.idBlock.tagNumber=18}}bA.NumericString=cb,cb.NAME="NumericString";class cc extends b4{constructor(a={}){super(a),this.idBlock.tagClass=1,this.idBlock.tagNumber=19}}bA.PrintableString=cc,cc.NAME="PrintableString";class cd extends b4{constructor(a={}){super(a),this.idBlock.tagClass=1,this.idBlock.tagNumber=20}}bA.TeletexString=cd,cd.NAME="TeletexString";class ce extends b4{constructor(a={}){super(a),this.idBlock.tagClass=1,this.idBlock.tagNumber=21}}bA.VideotexString=ce,ce.NAME="VideotexString";class cf extends b4{constructor(a={}){super(a),this.idBlock.tagClass=1,this.idBlock.tagNumber=22}}bA.IA5String=cf,cf.NAME="IA5String";class cg extends b4{constructor(a={}){super(a),this.idBlock.tagClass=1,this.idBlock.tagNumber=25}}bA.GraphicString=cg,cg.NAME="GraphicString";class ch extends b4{constructor(a={}){super(a),this.idBlock.tagClass=1,this.idBlock.tagNumber=26}}bA.VisibleString=ch,ch.NAME="VisibleString";class ci extends b4{constructor(a={}){super(a),this.idBlock.tagClass=1,this.idBlock.tagNumber=27}}bA.GeneralString=ci,ci.NAME="GeneralString";class cj extends b4{constructor(a={}){super(a),this.idBlock.tagClass=1,this.idBlock.tagNumber=29}}bA.CharacterString=cj,cj.NAME="CharacterString";class ck extends ch{constructor({value:a,valueDate:b,...c}={}){if(super(c),this.year=0,this.month=0,this.day=0,this.hour=0,this.minute=0,this.second=0,a){this.fromString(a),this.valueBlock.valueHexView=new Uint8Array(a.length);for(let b=0;b<a.length;b++)this.valueBlock.valueHexView[b]=a.charCodeAt(b)}b&&(this.fromDate(b),this.valueBlock.valueHexView=new Uint8Array(this.toBuffer())),this.idBlock.tagClass=1,this.idBlock.tagNumber=23}fromBuffer(a){this.fromString(String.fromCharCode.apply(null,a4.toUint8Array(a)))}toBuffer(){let a=this.toString(),b=new ArrayBuffer(a.length),c=new Uint8Array(b);for(let b=0;b<a.length;b++)c[b]=a.charCodeAt(b);return b}fromDate(a){this.year=a.getUTCFullYear(),this.month=a.getUTCMonth()+1,this.day=a.getUTCDate(),this.hour=a.getUTCHours(),this.minute=a.getUTCMinutes(),this.second=a.getUTCSeconds()}toDate(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second))}fromString(a){let b=/(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})Z/ig.exec(a);if(null===b){this.error="Wrong input string for conversion";return}let c=parseInt(b[1],10);c>=50?this.year=1900+c:this.year=2e3+c,this.month=parseInt(b[2],10),this.day=parseInt(b[3],10),this.hour=parseInt(b[4],10),this.minute=parseInt(b[5],10),this.second=parseInt(b[6],10)}toString(a="iso"){if("iso"===a){let a=Array(7);return a[0]=bh(this.year<2e3?this.year-1900:this.year-2e3,2),a[1]=bh(this.month,2),a[2]=bh(this.day,2),a[3]=bh(this.hour,2),a[4]=bh(this.minute,2),a[5]=bh(this.second,2),a[6]="Z",a.join("")}return super.toString(a)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.toDate().toISOString()}`}toJSON(){return{...super.toJSON(),year:this.year,month:this.month,day:this.day,hour:this.hour,minute:this.minute,second:this.second}}}bA.UTCTime=ck,ck.NAME="UTCTime";class cl extends ck{constructor(a={}){super(a),null!=this.millisecond||(this.millisecond=0),this.idBlock.tagClass=1,this.idBlock.tagNumber=24}fromDate(a){super.fromDate(a),this.millisecond=a.getUTCMilliseconds()}toDate(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second,this.millisecond))}fromString(a){let b,c=!1,d="",e="",f=0,g=0,h=0;if("Z"===a[a.length-1])d=a.substring(0,a.length-1),c=!0;else{if(isNaN(new Number(a[a.length-1]).valueOf()))throw Error("Wrong input string for conversion");d=a}if(c){if(-1!==d.indexOf("+")||-1!==d.indexOf("-"))throw Error("Wrong input string for conversion")}else{let a=1,b=d.indexOf("+"),c="";if(-1===b&&(b=d.indexOf("-"),a=-1),-1!==b){if(c=d.substring(b+1),d=d.substring(0,b),2!==c.length&&4!==c.length)throw Error("Wrong input string for conversion");let e=parseInt(c.substring(0,2),10);if(isNaN(e.valueOf()))throw Error("Wrong input string for conversion");if(g=a*e,4===c.length){if(isNaN((e=parseInt(c.substring(2,4),10)).valueOf()))throw Error("Wrong input string for conversion");h=a*e}}}let i=d.indexOf(".");if(-1===i&&(i=d.indexOf(",")),-1!==i){let a=new Number(`0${d.substring(i)}`);if(isNaN(a.valueOf()))throw Error("Wrong input string for conversion");f=a.valueOf(),e=d.substring(0,i)}else e=d;switch(!0){case 8===e.length:if(b=/(\d{4})(\d{2})(\d{2})/ig,-1!==i)throw Error("Wrong input string for conversion");break;case 10===e.length:if(b=/(\d{4})(\d{2})(\d{2})(\d{2})/ig,-1!==i){let a=60*f;this.minute=Math.floor(a),a=60*(a-this.minute),this.second=Math.floor(a),a=1e3*(a-this.second),this.millisecond=Math.floor(a)}break;case 12===e.length:if(b=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})/ig,-1!==i){let a=60*f;this.second=Math.floor(a),a=1e3*(a-this.second),this.millisecond=Math.floor(a)}break;case 14===e.length:if(b=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/ig,-1!==i){let a=1e3*f;this.millisecond=Math.floor(a)}break;default:throw Error("Wrong input string for conversion")}let j=b.exec(e);if(null===j)throw Error("Wrong input string for conversion");for(let a=1;a<j.length;a++)switch(a){case 1:this.year=parseInt(j[a],10);break;case 2:this.month=parseInt(j[a],10);break;case 3:this.day=parseInt(j[a],10);break;case 4:this.hour=parseInt(j[a],10)+g;break;case 5:this.minute=parseInt(j[a],10)+h;break;case 6:this.second=parseInt(j[a],10);break;default:throw Error("Wrong input string for conversion")}if(!1===c){let a=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond);this.year=a.getUTCFullYear(),this.month=a.getUTCMonth(),this.day=a.getUTCDay(),this.hour=a.getUTCHours(),this.minute=a.getUTCMinutes(),this.second=a.getUTCSeconds(),this.millisecond=a.getUTCMilliseconds()}}toString(a="iso"){if("iso"===a){let a=[];return a.push(bh(this.year,4)),a.push(bh(this.month,2)),a.push(bh(this.day,2)),a.push(bh(this.hour,2)),a.push(bh(this.minute,2)),a.push(bh(this.second,2)),0!==this.millisecond&&(a.push("."),a.push(bh(this.millisecond,3))),a.push("Z"),a.join("")}return super.toString(a)}toJSON(){return{...super.toJSON(),millisecond:this.millisecond}}}bA.GeneralizedTime=cl,cl.NAME="GeneralizedTime";class cm extends b6{constructor(a={}){super(a),this.idBlock.tagClass=1,this.idBlock.tagNumber=31}}bA.DATE=cm,cm.NAME="DATE";class cn extends b6{constructor(a={}){super(a),this.idBlock.tagClass=1,this.idBlock.tagNumber=32}}bA.TimeOfDay=cn,cn.NAME="TimeOfDay";class co extends b6{constructor(a={}){super(a),this.idBlock.tagClass=1,this.idBlock.tagNumber=33}}bA.DateTime=co,co.NAME="DateTime";class cp extends b6{constructor(a={}){super(a),this.idBlock.tagClass=1,this.idBlock.tagNumber=34}}bA.Duration=cp,cp.NAME="Duration";class cq extends b6{constructor(a={}){super(a),this.idBlock.tagClass=1,this.idBlock.tagNumber=14}}bA.TIME=cq,cq.NAME="TIME";class cr{constructor({name:a="",optional:b=!1}={}){this.name=a,this.optional=b}}class cs extends cr{constructor({value:a=[],...b}={}){super(b),this.value=a}}class ct extends cr{constructor({value:a=new cr,local:b=!1,...c}={}){super(c),this.value=a,this.local=b}}class cu{get data(){return this.dataView.slice().buffer}set data(a){this.dataView=a4.toUint8Array(a)}constructor({data:a=br}={}){this.dataView=a4.toUint8Array(a)}fromBER(a,b,c){let d=b+c;return this.dataView=a4.toUint8Array(a).subarray(b,d),d}toBER(a){return this.dataView.slice().buffer}}function cv(a,b,c){if(c instanceof cs){for(let d of c.value)if(cv(a,b,d).verified)return{verified:!0,result:a};{let a={verified:!1,result:{error:"Wrong values for Choice type"}};return c.hasOwnProperty(bo)&&(a.name=c.name),a}}if(c instanceof cr)return c.hasOwnProperty(bo)&&(a[c.name]=b),{verified:!0,result:a};if(a instanceof Object==!1)return{verified:!1,result:{error:"Wrong root object"}};if(b instanceof Object==!1)return{verified:!1,result:{error:"Wrong ASN.1 data"}};if(c instanceof Object==!1||"idBlock"in c==!1||"fromBER"in c.idBlock==!1||"toBER"in c.idBlock==!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};let d=c.idBlock.toBER(!1);if(0===d.byteLength)return{verified:!1,result:{error:"Error encoding idBlock for ASN.1 schema"}};if(-1===c.idBlock.fromBER(d,0,d.byteLength))return{verified:!1,result:{error:"Error decoding idBlock for ASN.1 schema"}};if(!1===c.idBlock.hasOwnProperty("tagClass"))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(c.idBlock.tagClass!==b.idBlock.tagClass)return{verified:!1,result:a};if(!1===c.idBlock.hasOwnProperty("tagNumber"))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(c.idBlock.tagNumber!==b.idBlock.tagNumber)return{verified:!1,result:a};if(!1===c.idBlock.hasOwnProperty("isConstructed"))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(c.idBlock.isConstructed!==b.idBlock.isConstructed)return{verified:!1,result:a};if(!("isHexOnly"in c.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(c.idBlock.isHexOnly!==b.idBlock.isHexOnly)return{verified:!1,result:a};if(c.idBlock.isHexOnly){if(bp in c.idBlock==!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};let d=c.idBlock.valueHexView,e=b.idBlock.valueHexView;if(d.length!==e.length)return{verified:!1,result:a};for(let b=0;b<d.length;b++)if(d[b]!==e[1])return{verified:!1,result:a}}if(c.name&&(c.name=c.name.replace(/^\s+|\s+$/g,""),c.name&&(a[c.name]=b)),c instanceof bA.Constructed){let d=0,e={verified:!1,result:{error:"Unknown error"}},f=c.valueBlock.value.length;if(f>0&&c.valueBlock.value[0]instanceof ct&&(f=b.valueBlock.value.length),0===f)return{verified:!0,result:a};if(0===b.valueBlock.value.length&&0!==c.valueBlock.value.length){let b=!0;for(let a=0;a<c.valueBlock.value.length;a++)b=b&&(c.valueBlock.value[a].optional||!1);return b?{verified:!0,result:a}:(c.name&&(c.name=c.name.replace(/^\s+|\s+$/g,""),c.name&&delete a[c.name]),a.error="Inconsistent object length",{verified:!1,result:a})}for(let g=0;g<f;g++)if(g-d>=b.valueBlock.value.length){if(!1===c.valueBlock.value[g].optional){let b={verified:!1,result:a};return a.error="Inconsistent length between ASN.1 data and schema",c.name&&(c.name=c.name.replace(/^\s+|\s+$/g,""),c.name&&(delete a[c.name],b.name=c.name)),b}}else if(c.valueBlock.value[0]instanceof ct){if(!1===(e=cv(a,b.valueBlock.value[g],c.valueBlock.value[0].value)).verified)if(!c.valueBlock.value[0].optional)return c.name&&(c.name=c.name.replace(/^\s+|\s+$/g,""),c.name&&delete a[c.name]),e;else d++;if(bo in c.valueBlock.value[0]&&c.valueBlock.value[0].name.length>0){let d={};void 0===(d="local"in c.valueBlock.value[0]&&c.valueBlock.value[0].local?b:a)[c.valueBlock.value[0].name]&&(d[c.valueBlock.value[0].name]=[]),d[c.valueBlock.value[0].name].push(b.valueBlock.value[g])}}else if(!1===(e=cv(a,b.valueBlock.value[g-d],c.valueBlock.value[g])).verified)if(!c.valueBlock.value[g].optional)return c.name&&(c.name=c.name.replace(/^\s+|\s+$/g,""),c.name&&delete a[c.name]),e;else d++;if(!1===e.verified){let b={verified:!1,result:a};return c.name&&(c.name=c.name.replace(/^\s+|\s+$/g,""),c.name&&(delete a[c.name],b.name=c.name)),b}return{verified:!0,result:a}}if(c.primitiveSchema&&bp in b.valueBlock){let d=bF(b.valueBlock.valueHexView);if(-1===d.offset){let b={verified:!1,result:d.result};return c.name&&(c.name=c.name.replace(/^\s+|\s+$/g,""),c.name&&(delete a[c.name],b.name=c.name)),b}return cv(a,d.result,c.primitiveSchema)}return{verified:!0,result:a}}function cw(a,b){if(b instanceof Object==!1)return{verified:!1,result:{error:"Wrong ASN.1 schema type"}};let c=bF(a4.toUint8Array(a));return -1===c.offset?{verified:!1,result:c.result}:cv(c.result,c.result,b)}(d=w||(w={}))[d.Sequence=0]="Sequence",d[d.Set=1]="Set",d[d.Choice=2]="Choice",(e=x||(x={}))[e.Any=1]="Any",e[e.Boolean=2]="Boolean",e[e.OctetString=3]="OctetString",e[e.BitString=4]="BitString",e[e.Integer=5]="Integer",e[e.Enumerated=6]="Enumerated",e[e.ObjectIdentifier=7]="ObjectIdentifier",e[e.Utf8String=8]="Utf8String",e[e.BmpString=9]="BmpString",e[e.UniversalString=10]="UniversalString",e[e.NumericString=11]="NumericString",e[e.PrintableString=12]="PrintableString",e[e.TeletexString=13]="TeletexString",e[e.VideotexString=14]="VideotexString",e[e.IA5String=15]="IA5String",e[e.GraphicString=16]="GraphicString",e[e.VisibleString=17]="VisibleString",e[e.GeneralString=18]="GeneralString",e[e.CharacterString=19]="CharacterString",e[e.UTCTime=20]="UTCTime",e[e.GeneralizedTime=21]="GeneralizedTime",e[e.DATE=22]="DATE",e[e.TimeOfDay=23]="TimeOfDay",e[e.DateTime=24]="DateTime",e[e.Duration=25]="Duration",e[e.TIME=26]="TIME",e[e.Null=27]="Null";class cx{constructor(a,b=0){if(this.unusedBits=0,this.value=new ArrayBuffer(0),a)if("number"==typeof a)this.fromNumber(a);else if(a4.isBufferSource(a))this.unusedBits=b,this.value=a4.toArrayBuffer(a);else throw TypeError("Unsupported type of 'params' argument for BitString")}fromASN(a){if(!(a instanceof bR))throw TypeError("Argument 'asn' is not instance of ASN.1 BitString");return this.unusedBits=a.valueBlock.unusedBits,this.value=a.valueBlock.valueHex,this}toASN(){return new bR({unusedBits:this.unusedBits,valueHex:this.value})}toSchema(a){return new bR({name:a})}toNumber(){let a="";for(let b of new Uint8Array(this.value))a+=b.toString(2).padStart(8,"0");return a=a.split("").reverse().join(""),this.unusedBits&&(a=a.slice(this.unusedBits).padStart(this.unusedBits,"0")),parseInt(a,2)}fromNumber(a){let b=a.toString(2),c=b.length+7>>3;this.unusedBits=(c<<3)-b.length;let d=new Uint8Array(c);b=b.padStart(c<<3,"0").split("").reverse().join("");let e=0;for(;e<c;)d[e]=parseInt(b.slice(e<<3,(e<<3)+8),2),e++;this.value=d.buffer}}class cy{get byteLength(){return this.buffer.byteLength}get byteOffset(){return 0}constructor(a){"number"==typeof a?this.buffer=new ArrayBuffer(a):a4.isBufferSource(a)?this.buffer=a4.toArrayBuffer(a):Array.isArray(a)?this.buffer=new Uint8Array(a):this.buffer=new ArrayBuffer(0)}fromASN(a){if(!(a instanceof bP))throw TypeError("Argument 'asn' is not instance of ASN.1 OctetString");return this.buffer=a.valueBlock.valueHex,this}toASN(){return new bP({valueHex:this.buffer})}toSchema(a){return new bP({name:a})}}let cz={fromASN:a=>a instanceof bL?null:a.valueBeforeDecodeView,toASN:a=>{if(null===a)return new bL;let b=bG(a);if(b.result.error)throw Error(b.result.error);return b.result}},cA={fromASN:a=>a.valueBlock.valueHexView.byteLength>=4?a.valueBlock.toString():a.valueBlock.valueDec,toASN:a=>new bU({value:+a})},cB={fromASN:a=>a.valueBlock.valueDec,toASN:a=>new bV({value:a})},cC={fromASN:a=>a.valueBlock.valueHexView,toASN:a=>new bU({valueHex:a})},cD={fromASN:a=>a.valueBlock.valueHexView,toASN:a=>new bR({valueHex:a})},cE={fromASN:a=>a.valueBlock.toString(),toASN:a=>new bY({value:a})},cF={fromASN:a=>a.valueBlock.value,toASN:a=>new bN({value:a})},cG={fromASN:a=>a.valueBlock.valueHexView,toASN:a=>new bP({valueHex:a})};function cH(a){return{fromASN:a=>a.valueBlock.value,toASN:b=>new a({value:b})}}let cI=cH(b6),cJ=cH(b8),cK=cH(ca),cL=cH(cb),cM=cH(cc),cN=cH(cd),cO=cH(ce),cP=cH(cf),cQ=cH(cg),cR=cH(ch),cS=cH(ci),cT=cH(cj),cU={fromASN:a=>a.toDate(),toASN:a=>new ck({valueDate:a})},cV={fromASN:a=>a.toDate(),toASN:a=>new cl({valueDate:a})},cW={fromASN:()=>null,toASN:()=>new bL};function cX(a){switch(a){case x.Any:return cz;case x.BitString:return cD;case x.BmpString:return cJ;case x.Boolean:return cF;case x.CharacterString:return cT;case x.Enumerated:return cB;case x.GeneralString:return cS;case x.GeneralizedTime:return cV;case x.GraphicString:return cQ;case x.IA5String:return cP;case x.Integer:return cA;case x.Null:return cW;case x.NumericString:return cL;case x.ObjectIdentifier:return cE;case x.OctetString:return cG;case x.PrintableString:return cM;case x.TeletexString:return cN;case x.UTCTime:return cU;case x.UniversalString:return cK;case x.Utf8String:return cI;case x.VideotexString:return cO;case x.VisibleString:return cR;default:return null}}function cY(a){return"function"==typeof a&&a.prototype?!!a.prototype.toASN&&!!a.prototype.fromASN||cY(a.prototype):!!(a&&"object"==typeof a&&"toASN"in a&&"fromASN"in a)}class cZ{constructor(){this.items=new WeakMap}has(a){return this.items.has(a)}get(a,b=!1){let c=this.items.get(a);if(!c)throw Error(`Cannot get schema for '${a.prototype.constructor.name}' target`);if(b&&!c.schema)throw Error(`Schema '${a.prototype.constructor.name}' doesn't contain ASN.1 schema. Call 'AsnSchemaStorage.cache'.`);return c}cache(a){let b=this.get(a);b.schema||(b.schema=this.create(a,!0))}createDefault(a){let b={type:w.Sequence,items:{}},c=this.findParentSchema(a);return c&&(Object.assign(b,c),b.items=Object.assign({},b.items,c.items)),b}create(a,b){let c=this.items.get(a)||this.createDefault(a),d=[];for(let a in c.items){let e,f=c.items[a],g=b?a:"";if("number"==typeof f.type){let a=x[f.type],b=a3[a];if(!b)throw Error(`Cannot get ASN1 class by name '${a}'`);e=new b({name:g})}else cY(f.type)?e=new f.type().toSchema(g):f.optional?this.get(f.type).type===w.Choice?e=new cr({name:g}):(e=this.create(f.type,!1)).name=g:e=new cr({name:g});let h=!!f.optional||void 0!==f.defaultValue;if(f.repeated&&(e.name="",e=new("set"===f.repeated?b1:b0)({name:"",value:[new ct({name:g,value:e})]})),null!==f.context&&void 0!==f.context)if(f.implicit)if("number"==typeof f.type||cY(f.type)){let a=f.repeated?bI:bE;d.push(new a({name:g,optional:h,idBlock:{tagClass:3,tagNumber:f.context}}))}else{this.cache(f.type);let a=!!f.repeated,b=a?e:this.get(f.type,!0).schema;b="valueBlock"in b?b.valueBlock.value:b.value,d.push(new bI({name:a?"":g,optional:h,idBlock:{tagClass:3,tagNumber:f.context},value:b}))}else d.push(new bI({optional:h,idBlock:{tagClass:3,tagNumber:f.context},value:[e]}));else e.optional=h,d.push(e)}switch(c.type){case w.Sequence:return new b0({value:d,name:""});case w.Set:return new b1({value:d,name:""});case w.Choice:return new cs({value:d,name:""});default:throw Error("Unsupported ASN1 type in use")}}set(a,b){return this.items.set(a,b),this}findParentSchema(a){let b=Object.getPrototypeOf(a);return b?this.items.get(b)||this.findParentSchema(b):null}}let c$=new cZ,c_=a=>b=>{let c;c$.has(b)?c=c$.get(b):(c=c$.createDefault(b),c$.set(b,c)),Object.assign(c,a)},c0=a=>(b,c)=>{let d;c$.has(b.constructor)?d=c$.get(b.constructor):(d=c$.createDefault(b.constructor),c$.set(b.constructor,d));let e=Object.assign({},a);if("number"==typeof e.type&&!e.converter){let d=cX(a.type);if(!d)throw Error(`Cannot get default converter for property '${c}' of ${b.constructor.name}`);e.converter=d}e.raw=a.raw,d.items[c]=e};class c1 extends Error{constructor(){super(...arguments),this.schemas=[]}}class c2{static parse(a,b){let c=bG(a);if(c.result.error)throw Error(c.result.error);return this.fromASN(c.result,b)}static fromASN(a,b){try{if(cY(b))return new b().fromASN(a);let c=c$.get(b);c$.cache(b);let d=c.schema,e=this.handleChoiceTypes(a,c,b,d);if(null==e?void 0:e.result)return e.result;(null==e?void 0:e.targetSchema)&&(d=e.targetSchema);let f=this.handleSequenceTypes(a,c,b,d),g=new b;if(function a(b){var c;if(b){let d=Object.getPrototypeOf(b);return(null==(c=null==d?void 0:d.prototype)?void 0:c.constructor)===Array||a(d)}return!1}(b))return this.handleArrayTypes(a,c,b);return this.processSchemaItems(c,f,g),g}catch(a){throw a instanceof c1&&a.schemas.push(b.name),a}}static handleChoiceTypes(a,b,c,d){if(a.constructor===bI&&b.type===w.Choice&&3===a.idBlock.tagClass)for(let d in b.items){let e=b.items[d];if(e.context===a.idBlock.tagNumber&&e.implicit&&"function"==typeof e.type&&c$.has(e.type)){let b=c$.get(e.type);if(b&&b.type===w.Sequence){let b=new b0;if("value"in a.valueBlock&&Array.isArray(a.valueBlock.value)&&"value"in b.valueBlock){b.valueBlock.value=a.valueBlock.value;let f=this.fromASN(b,e.type),g=new c;return g[d]=f,{result:g}}}}}else if(a.constructor===bI&&b.type!==w.Choice){let c=new bI({idBlock:{tagClass:3,tagNumber:a.idBlock.tagNumber},value:b.schema.valueBlock.value});for(let c in b.items)delete a[c];return{targetSchema:c}}return null}static handleSequenceTypes(a,b,c,d){if(b.type===w.Sequence){let b=cv({},a,d);if(!b.verified)throw new c1(`Data does not match to ${c.name} ASN1 schema.${b.result.error?` ${b.result.error}`:""}`);return b}{let b=cv({},a,d);if(!b.verified)throw new c1(`Data does not match to ${c.name} ASN1 schema.${b.result.error?` ${b.result.error}`:""}`);return b}}static processRepeatedField(a,b,c){let d=a.slice(b);if(1===d.length&&"Sequence"===d[0].constructor.name){let a=d[0];a.valueBlock&&a.valueBlock.value&&Array.isArray(a.valueBlock.value)&&(d=a.valueBlock.value)}if("number"!=typeof c.type)return d.filter(a=>a&&a.valueBlock).map(a=>{try{return this.fromASN(a,c.type)}catch{return}}).filter(a=>void 0!==a);{let a=cX(c.type);if(!a)throw Error(`No converter for ASN.1 type ${c.type}`);return d.filter(a=>a&&a.valueBlock).map(b=>{try{return a.fromASN(b)}catch{return}}).filter(a=>void 0!==a)}}static processPrimitiveField(a,b){let c=cX(b.type);if(!c)throw Error(`No converter for ASN.1 type ${b.type}`);return c.fromASN(a)}static isOptionalChoiceField(a){return a.optional&&"function"==typeof a.type&&c$.has(a.type)&&c$.get(a.type).type===w.Choice}static processOptionalChoiceField(a,b){try{let c=this.fromASN(a,b.type);return{processed:!0,value:c}}catch(a){if(a instanceof c1&&/Wrong values for Choice type/.test(a.message))return{processed:!1};throw a}}static handleArrayTypes(a,b,c){if(!("value"in a.valueBlock&&Array.isArray(a.valueBlock.value)))throw Error("Cannot get items from the ASN.1 parsed value. ASN.1 object is not constructed.");let d=b.itemType;if("number"!=typeof d)return c.from(a.valueBlock.value,a=>this.fromASN(a,d));{let b=cX(d);if(!b)throw Error(`Cannot get default converter for array item of ${c.name} ASN1 schema`);return c.from(a.valueBlock.value,a=>b.fromASN(a))}}static processSchemaItems(a,b,c){for(let d in a.items){let e,f=b.result[d];if(!f)continue;let g=a.items[d],h=g.type;(e="number"==typeof h||cY(h)?this.processPrimitiveSchemaItem(f,g,h):this.processComplexSchemaItem(f,g,h))&&"object"==typeof e&&"value"in e&&"raw"in e?(c[d]=e.value,c[`${d}Raw`]=e.raw):c[d]=e}}static processPrimitiveSchemaItem(a,b,c){var d;let e=null!=(d=b.converter)?d:cY(c)?new c:null;if(!e)throw Error("Converter is empty");return b.repeated?this.processRepeatedPrimitiveItem(a,b,e):this.processSinglePrimitiveItem(a,b,c,e)}static processRepeatedPrimitiveItem(a,b,c){if(!b.implicit)return Array.from(a,a=>c.fromASN(a));{let d=new("sequence"===b.repeated?b0:b1);d.valueBlock=a.valueBlock;let e=bG(d.toBER(!1));if(-1===e.offset)throw Error(`Cannot parse the child item. ${e.result.error}`);if(!("value"in e.result.valueBlock&&Array.isArray(e.result.valueBlock.value)))throw Error("Cannot get items from the ASN.1 parsed value. ASN.1 object is not constructed.");return Array.from(e.result.valueBlock.value,a=>c.fromASN(a))}}static processSinglePrimitiveItem(a,b,c,d){let e=a;if(b.implicit){let a;if(cY(c))a=new c().toSchema("");else{let b=x[c],d=a3[b];if(!d)throw Error(`Cannot get '${b}' class from asn1js module`);a=new d}a.valueBlock=e.valueBlock,e=bG(a.toBER(!1)).result}return d.fromASN(e)}static processComplexSchemaItem(a,b,c){if(b.repeated){if(!Array.isArray(a))throw Error("Cannot get list of items from the ASN.1 parsed value. ASN.1 value should be iterable.");return Array.from(a,a=>this.fromASN(a,c))}{let d=this.handleImplicitTagging(a,b,c);if(this.isOptionalChoiceField(b))try{return this.fromASN(d,c)}catch(a){if(a instanceof c1&&/Wrong values for Choice type/.test(a.message))return;throw a}{let e=this.fromASN(d,c);return b.raw?{value:e,raw:a.valueBeforeDecodeView}:e}}}static handleImplicitTagging(a,b,c){if(b.implicit&&"number"==typeof b.context){let b=c$.get(c);if(b.type===w.Sequence){let b=new b0;if("value"in a.valueBlock&&Array.isArray(a.valueBlock.value)&&"value"in b.valueBlock)return b.valueBlock.value=a.valueBlock.value,b}else if(b.type===w.Set){let b=new b1;if("value"in a.valueBlock&&Array.isArray(a.valueBlock.value)&&"value"in b.valueBlock)return b.valueBlock.value=a.valueBlock.value,b}}return a}}class c3{static serialize(a){return a instanceof bB?a.toBER(!1):this.toASN(a).toBER(!1)}static toASN(a){let b;if(a&&"object"==typeof a&&cY(a))return a.toASN();if(!(a&&"object"==typeof a))throw TypeError("Parameter 1 should be type of Object.");let c=a.constructor,d=c$.get(c);c$.cache(c);let e=[];if(d.itemType){if(!Array.isArray(a))throw TypeError("Parameter 1 should be type of Array.");if("number"==typeof d.itemType){let b=cX(d.itemType);if(!b)throw Error(`Cannot get default converter for array item of ${c.name} ASN1 schema`);e=a.map(a=>b.toASN(a))}else e=a.map(a=>this.toAsnItem({type:d.itemType},"[]",c,a))}else for(let b in d.items){let f=d.items[b],g=a[b];if(void 0===g||f.defaultValue===g||"object"==typeof f.defaultValue&&"object"==typeof g&&function(a,b){if(!(a&&b)||a.byteLength!==b.byteLength)return!1;let c=new Uint8Array(a),d=new Uint8Array(b);for(let b=0;b<a.byteLength;b++)if(c[b]!==d[b])return!1;return!0}(this.serialize(f.defaultValue),this.serialize(g)))continue;let h=c3.toAsnItem(f,b,c,g);if("number"==typeof f.context)if(f.implicit)if(!f.repeated&&("number"==typeof f.type||cY(f.type))){let a={};a.valueHex=h instanceof bL?h.valueBeforeDecodeView:h.valueBlock.toBER(),e.push(new bE({optional:f.optional,idBlock:{tagClass:3,tagNumber:f.context},...a}))}else e.push(new bI({optional:f.optional,idBlock:{tagClass:3,tagNumber:f.context},value:h.valueBlock.value}));else e.push(new bI({optional:f.optional,idBlock:{tagClass:3,tagNumber:f.context},value:[h]}));else f.repeated?e=e.concat(h):e.push(h)}switch(d.type){case w.Sequence:b=new b0({value:e});break;case w.Set:b=new b1({value:e});break;case w.Choice:if(!e[0])throw Error(`Schema '${c.name}' has wrong data. Choice cannot be empty.`);b=e[0]}return b}static toAsnItem(a,b,c,d){let e;if("number"==typeof a.type){let f=a.converter;if(!f)throw Error(`Property '${b}' doesn't have converter for type ${x[a.type]} in schema '${c.name}'`);if(a.repeated){if(!Array.isArray(d))throw TypeError("Parameter 'objProp' should be type of Array.");let b=Array.from(d,a=>f.toASN(a));e=new("sequence"===a.repeated?b0:b1)({value:b})}else e=f.toASN(d)}else if(a.repeated){if(!Array.isArray(d))throw TypeError("Parameter 'objProp' should be type of Array.");let b=Array.from(d,a=>this.toASN(a));e=new("sequence"===a.repeated?b0:b1)({value:b})}else e=this.toASN(d);return e}}class c4 extends Array{constructor(a=[]){if("number"==typeof a)super(a);else for(const b of(super(),a))this.push(b)}}class c5{static serialize(a){return c3.serialize(a)}static parse(a,b){return c2.parse(a,b)}static toString(a){let b=bG(a4.isBufferSource(a)?a4.toArrayBuffer(a):c5.serialize(a));if(-1===b.offset)throw Error(`Cannot decode ASN.1 data. ${b.result.error}`);return b.result.toString()}}function c6(a,b,c,d){var e,f=arguments.length,g=f<3?b:null===d?d=Object.getOwnPropertyDescriptor(b,c):d;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)g=Reflect.decorate(a,b,c,d);else for(var h=a.length-1;h>=0;h--)(e=a[h])&&(g=(f<3?e(g):f>3?e(b,c,g):e(b,c))||g);return f>3&&g&&Object.defineProperty(b,c,g),g}function c7(a,b,c,d){if("a"===c&&!d)throw TypeError("Private accessor was defined without a getter");if("function"==typeof b?a!==b||!d:!b.has(a))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===c?d:"a"===c?d.call(a):d?d.value:b.get(a)}function c8(a,b,c,d,e){if("m"===d)throw TypeError("Private method is not writable");if("a"===d&&!e)throw TypeError("Private accessor was defined without a setter");if("function"==typeof b?a!==b||!e:!b.has(a))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===d?e.call(a,c):e?e.value=c:b.set(a,c),c}"function"==typeof SuppressedError&&SuppressedError;class c9{static isIPv4(a){return/^(\d{1,3}\.){3}\d{1,3}$/.test(a)}static parseIPv4(a){let b=a.split(".");if(4!==b.length)throw Error("Invalid IPv4 address");return b.map(a=>{let b=parseInt(a,10);if(isNaN(b)||b<0||b>255)throw Error("Invalid IPv4 address part");return b})}static parseIPv6(a){let b=this.expandIPv6(a).split(":");if(8!==b.length)throw Error("Invalid IPv6 address");return b.reduce((a,b)=>{let c=parseInt(b,16);if(isNaN(c)||c<0||c>65535)throw Error("Invalid IPv6 address part");return a.push(c>>8&255),a.push(255&c),a},[])}static expandIPv6(a){if(!a.includes("::"))return a;let b=a.split("::");if(b.length>2)throw Error("Invalid IPv6 address");let c=b[0]?b[0].split(":"):[],d=b[1]?b[1].split(":"):[],e=8-(c.length+d.length);if(e<0)throw Error("Invalid IPv6 address");return[...c,...Array(e).fill("0"),...d].join(":")}static formatIPv6(a){let b=[];for(let c=0;c<16;c+=2)b.push((a[c]<<8|a[c+1]).toString(16));return this.compressIPv6(b.join(":"))}static compressIPv6(a){let b=a.split(":"),c=-1,d=0,e=-1,f=0;for(let a=0;a<b.length;a++)"0"===b[a]?(-1===e&&(e=a),f++):(f>d&&(c=e,d=f),e=-1,f=0);if(f>d&&(c=e,d=f),d>1){let a=b.slice(0,c).join(":"),e=b.slice(c+d).join(":");return`${a}::${e}`}return a}static parseCIDR(a){let[b,c]=a.split("/"),d=parseInt(c,10);if(this.isIPv4(b)){if(d<0||d>32)throw Error("Invalid IPv4 prefix length");return[this.parseIPv4(b),d]}if(d<0||d>128)throw Error("Invalid IPv6 prefix length");return[this.parseIPv6(b),d]}static decodeIP(a){if(64===a.length&&0===parseInt(a,16))return"::/0";if(16!==a.length)return a;let b=parseInt(a.slice(8),16).toString(2).split("").reduce((a,b)=>a+ +b,0),c=a.slice(0,8).replace(/(.{2})/g,a=>`${parseInt(a,16)}.`);return c=c.slice(0,-1),`${c}/${b}`}static toString(a){let b=new Uint8Array(a);if(4===b.length)return Array.from(b).join(".");if(16===b.length)return this.formatIPv6(b);if(8===b.length||32===b.length){let a=b.length/2,c=b.slice(0,a),d=b.slice(a);if(b.every(a=>0===a))return 8===b.length?"0.0.0.0/0":"::/0";let e=d.reduce((a,b)=>a+(b.toString(2).match(/1/g)||[]).length,0);if(8===b.length){let a=Array.from(c).join(".");return`${a}/${e}`}{let a=this.formatIPv6(c);return`${a}/${e}`}}return this.decodeIP(bb.ToHex(a))}static fromString(a){if(a.includes("/")){let[b,c]=this.parseCIDR(a),d=new Uint8Array(b.length),e=c;for(let a=0;a<d.length;a++)e>=8?(d[a]=255,e-=8):e>0&&(d[a]=255<<8-e,e=0);let f=new Uint8Array(2*b.length);return f.set(b,0),f.set(d,b.length),f.buffer}return new Uint8Array(this.isIPv4(a)?this.parseIPv4(a):this.parseIPv6(a)).buffer}}let da=class{constructor(a={}){Object.assign(this,a)}toString(){return this.bmpString||this.printableString||this.teletexString||this.universalString||this.utf8String||""}};c6([c0({type:x.TeletexString})],da.prototype,"teletexString",void 0),c6([c0({type:x.PrintableString})],da.prototype,"printableString",void 0),c6([c0({type:x.UniversalString})],da.prototype,"universalString",void 0),c6([c0({type:x.Utf8String})],da.prototype,"utf8String",void 0),c6([c0({type:x.BmpString})],da.prototype,"bmpString",void 0),da=c6([c_({type:w.Choice})],da);let db=class extends da{constructor(a={}){super(a),Object.assign(this,a)}toString(){return this.ia5String||(this.anyValue?bb.ToHex(this.anyValue):super.toString())}};c6([c0({type:x.IA5String})],db.prototype,"ia5String",void 0),c6([c0({type:x.Any})],db.prototype,"anyValue",void 0),db=c6([c_({type:w.Choice})],db);class dc{constructor(a={}){this.type="",this.value=new db,Object.assign(this,a)}}c6([c0({type:x.ObjectIdentifier})],dc.prototype,"type",void 0),c6([c0({type:db})],dc.prototype,"value",void 0);let dd=y=class extends c4{constructor(a){super(a),Object.setPrototypeOf(this,y.prototype)}};dd=y=c6([c_({type:w.Set,itemType:dc})],dd);let de=z=class extends c4{constructor(a){super(a),Object.setPrototypeOf(this,z.prototype)}};de=z=c6([c_({type:w.Sequence,itemType:dd})],de);let df=A=class extends de{constructor(a){super(a),Object.setPrototypeOf(this,A.prototype)}};df=A=c6([c_({type:w.Sequence})],df);class dg{constructor(a={}){this.typeId="",this.value=new ArrayBuffer(0),Object.assign(this,a)}}c6([c0({type:x.ObjectIdentifier})],dg.prototype,"typeId",void 0),c6([c0({type:x.Any,context:0})],dg.prototype,"value",void 0);class dh{constructor(a={}){this.partyName=new da,Object.assign(this,a)}}c6([c0({type:da,optional:!0,context:0,implicit:!0})],dh.prototype,"nameAssigner",void 0),c6([c0({type:da,context:1,implicit:!0})],dh.prototype,"partyName",void 0);let di=class{constructor(a={}){Object.assign(this,a)}};c6([c0({type:dg,context:0,implicit:!0})],di.prototype,"otherName",void 0),c6([c0({type:x.IA5String,context:1,implicit:!0})],di.prototype,"rfc822Name",void 0),c6([c0({type:x.IA5String,context:2,implicit:!0})],di.prototype,"dNSName",void 0),c6([c0({type:x.Any,context:3,implicit:!0})],di.prototype,"x400Address",void 0),c6([c0({type:df,context:4,implicit:!1})],di.prototype,"directoryName",void 0),c6([c0({type:dh,context:5})],di.prototype,"ediPartyName",void 0),c6([c0({type:x.IA5String,context:6,implicit:!0})],di.prototype,"uniformResourceIdentifier",void 0),c6([c0({type:x.OctetString,context:7,implicit:!0,converter:{fromASN:a=>c9.toString(cG.fromASN(a)),toASN:a=>cG.toASN(c9.fromString(a))}})],di.prototype,"iPAddress",void 0),c6([c0({type:x.ObjectIdentifier,context:8,implicit:!0})],di.prototype,"registeredID",void 0),di=c6([c_({type:w.Choice})],di);let dj="1.3.6.1.5.5.7",dk=`${dj}.1`,dl=`${dj}.3`,dm=`${dj}.48`,dn=`${dm}.1`,dp=`${dm}.2`,dq=`${dm}.3`,dr=`${dm}.5`,ds="2.5.29",dt=`${dk}.1`;class du{constructor(a={}){this.accessMethod="",this.accessLocation=new di,Object.assign(this,a)}}c6([c0({type:x.ObjectIdentifier})],du.prototype,"accessMethod",void 0),c6([c0({type:di})],du.prototype,"accessLocation",void 0);let dv=B=class extends c4{constructor(a){super(a),Object.setPrototypeOf(this,B.prototype)}};dv=B=c6([c_({type:w.Sequence,itemType:du})],dv);let dw=`${ds}.35`;class dx extends cy{}class dy{constructor(a={}){a&&Object.assign(this,a)}}c6([c0({type:dx,context:0,optional:!0,implicit:!0})],dy.prototype,"keyIdentifier",void 0),c6([c0({type:di,context:1,optional:!0,implicit:!0,repeated:"sequence"})],dy.prototype,"authorityCertIssuer",void 0),c6([c0({type:x.Integer,context:2,optional:!0,implicit:!0,converter:cC})],dy.prototype,"authorityCertSerialNumber",void 0);let dz=`${ds}.19`;class dA{constructor(a={}){this.cA=!1,Object.assign(this,a)}}c6([c0({type:x.Boolean,defaultValue:!1})],dA.prototype,"cA",void 0),c6([c0({type:x.Integer,optional:!0})],dA.prototype,"pathLenConstraint",void 0);let dB=C=class extends c4{constructor(a){super(a),Object.setPrototypeOf(this,C.prototype)}};dB=C=c6([c_({type:w.Sequence,itemType:di})],dB);let dC=`${ds}.29`,dD=D=class extends dB{constructor(a){super(a),Object.setPrototypeOf(this,D.prototype)}};dD=D=c6([c_({type:w.Sequence})],dD);let dE=`${ds}.32`,dF=class{constructor(a={}){Object.assign(this,a)}toString(){return this.ia5String||this.visibleString||this.bmpString||this.utf8String||""}};c6([c0({type:x.IA5String})],dF.prototype,"ia5String",void 0),c6([c0({type:x.VisibleString})],dF.prototype,"visibleString",void 0),c6([c0({type:x.BmpString})],dF.prototype,"bmpString",void 0),c6([c0({type:x.Utf8String})],dF.prototype,"utf8String",void 0),dF=c6([c_({type:w.Choice})],dF);class dG{constructor(a={}){this.organization=new dF,this.noticeNumbers=[],Object.assign(this,a)}}c6([c0({type:dF})],dG.prototype,"organization",void 0),c6([c0({type:x.Integer,repeated:"sequence"})],dG.prototype,"noticeNumbers",void 0);class dH{constructor(a={}){Object.assign(this,a)}}c6([c0({type:dG,optional:!0})],dH.prototype,"noticeRef",void 0),c6([c0({type:dF,optional:!0})],dH.prototype,"explicitText",void 0);let dI=class{constructor(a={}){Object.assign(this,a)}};c6([c0({type:x.IA5String})],dI.prototype,"cPSuri",void 0),c6([c0({type:dH})],dI.prototype,"userNotice",void 0),dI=c6([c_({type:w.Choice})],dI);class dJ{constructor(a={}){this.policyQualifierId="",this.qualifier=new ArrayBuffer(0),Object.assign(this,a)}}c6([c0({type:x.ObjectIdentifier})],dJ.prototype,"policyQualifierId",void 0),c6([c0({type:x.Any})],dJ.prototype,"qualifier",void 0);class dK{constructor(a={}){this.policyIdentifier="",Object.assign(this,a)}}c6([c0({type:x.ObjectIdentifier})],dK.prototype,"policyIdentifier",void 0),c6([c0({type:dJ,repeated:"sequence",optional:!0})],dK.prototype,"policyQualifiers",void 0);let dL=E=class extends c4{constructor(a){super(a),Object.setPrototypeOf(this,E.prototype)}};dL=E=c6([c_({type:w.Sequence,itemType:dK})],dL);let dM=class{constructor(a=0){this.value=a}};c6([c0({type:x.Integer})],dM.prototype,"value",void 0),dM=c6([c_({type:w.Choice})],dM);let dN=class extends dM{};dN=c6([c_({type:w.Choice})],dN);let dO=`${ds}.31`;(f=G||(G={}))[f.unused=1]="unused",f[f.keyCompromise=2]="keyCompromise",f[f.cACompromise=4]="cACompromise",f[f.affiliationChanged=8]="affiliationChanged",f[f.superseded=16]="superseded",f[f.cessationOfOperation=32]="cessationOfOperation",f[f.certificateHold=64]="certificateHold",f[f.privilegeWithdrawn=128]="privilegeWithdrawn",f[f.aACompromise=256]="aACompromise";class dP extends cx{toJSON(){let a=[],b=this.toNumber();return b&G.aACompromise&&a.push("aACompromise"),b&G.affiliationChanged&&a.push("affiliationChanged"),b&G.cACompromise&&a.push("cACompromise"),b&G.certificateHold&&a.push("certificateHold"),b&G.cessationOfOperation&&a.push("cessationOfOperation"),b&G.keyCompromise&&a.push("keyCompromise"),b&G.privilegeWithdrawn&&a.push("privilegeWithdrawn"),b&G.superseded&&a.push("superseded"),b&G.unused&&a.push("unused"),a}toString(){return`[${this.toJSON().join(", ")}]`}}let dQ=class{constructor(a={}){Object.assign(this,a)}};c6([c0({type:di,context:0,repeated:"sequence",implicit:!0})],dQ.prototype,"fullName",void 0),c6([c0({type:dd,context:1,implicit:!0})],dQ.prototype,"nameRelativeToCRLIssuer",void 0),dQ=c6([c_({type:w.Choice})],dQ);class dR{constructor(a={}){Object.assign(this,a)}}c6([c0({type:dQ,context:0,optional:!0})],dR.prototype,"distributionPoint",void 0),c6([c0({type:dP,context:1,optional:!0,implicit:!0})],dR.prototype,"reasons",void 0),c6([c0({type:di,context:2,optional:!0,repeated:"sequence",implicit:!0})],dR.prototype,"cRLIssuer",void 0);let dS=F=class extends c4{constructor(a){super(a),Object.setPrototypeOf(this,F.prototype)}};dS=F=c6([c_({type:w.Sequence,itemType:dR})],dS);let dT=H=class extends dS{constructor(a){super(a),Object.setPrototypeOf(this,H.prototype)}};dT=H=c6([c_({type:w.Sequence,itemType:dR})],dT);class dU{constructor(a={}){this.onlyContainsUserCerts=dU.ONLY,this.onlyContainsCACerts=dU.ONLY,this.indirectCRL=dU.ONLY,this.onlyContainsAttributeCerts=dU.ONLY,Object.assign(this,a)}}dU.ONLY=!1,c6([c0({type:dQ,context:0,optional:!0})],dU.prototype,"distributionPoint",void 0),c6([c0({type:x.Boolean,context:1,defaultValue:dU.ONLY,implicit:!0})],dU.prototype,"onlyContainsUserCerts",void 0),c6([c0({type:x.Boolean,context:2,defaultValue:dU.ONLY,implicit:!0})],dU.prototype,"onlyContainsCACerts",void 0),c6([c0({type:dP,context:3,optional:!0,implicit:!0})],dU.prototype,"onlySomeReasons",void 0),c6([c0({type:x.Boolean,context:4,defaultValue:dU.ONLY,implicit:!0})],dU.prototype,"indirectCRL",void 0),c6([c0({type:x.Boolean,context:5,defaultValue:dU.ONLY,implicit:!0})],dU.prototype,"onlyContainsAttributeCerts",void 0);let dV=`${ds}.21`;(g=I||(I={}))[g.unspecified=0]="unspecified",g[g.keyCompromise=1]="keyCompromise",g[g.cACompromise=2]="cACompromise",g[g.affiliationChanged=3]="affiliationChanged",g[g.superseded=4]="superseded",g[g.cessationOfOperation=5]="cessationOfOperation",g[g.certificateHold=6]="certificateHold",g[g.removeFromCRL=8]="removeFromCRL",g[g.privilegeWithdrawn=9]="privilegeWithdrawn",g[g.aACompromise=10]="aACompromise";let dW=class{constructor(a=I.unspecified){this.reason=I.unspecified,this.reason=a}toJSON(){return I[this.reason]}toString(){return this.toJSON()}};c6([c0({type:x.Enumerated})],dW.prototype,"reason",void 0),dW=c6([c_({type:w.Choice})],dW);let dX=`${ds}.37`,dY=J=class extends c4{constructor(a){super(a),Object.setPrototypeOf(this,J.prototype)}};dY=J=c6([c_({type:w.Sequence,itemType:x.ObjectIdentifier})],dY);let dZ=`${dl}.1`,d$=`${dl}.2`,d_=`${dl}.3`,d0=`${dl}.4`,d1=`${dl}.8`,d2=`${dl}.9`,d3=class{constructor(a=new ArrayBuffer(0)){this.value=a}};c6([c0({type:x.Integer,converter:cC})],d3.prototype,"value",void 0),d3=c6([c_({type:w.Choice})],d3);let d4=`${ds}.24`,d5=class{constructor(a){this.value=new Date,a&&(this.value=a)}};c6([c0({type:x.GeneralizedTime})],d5.prototype,"value",void 0),d5=c6([c_({type:w.Choice})],d5);let d6=`${ds}.18`,d7=K=class extends dB{constructor(a){super(a),Object.setPrototypeOf(this,K.prototype)}};d7=K=c6([c_({type:w.Sequence})],d7);let d8=`${ds}.15`;(h=L||(L={}))[h.digitalSignature=1]="digitalSignature",h[h.nonRepudiation=2]="nonRepudiation",h[h.keyEncipherment=4]="keyEncipherment",h[h.dataEncipherment=8]="dataEncipherment",h[h.keyAgreement=16]="keyAgreement",h[h.keyCertSign=32]="keyCertSign",h[h.cRLSign=64]="cRLSign",h[h.encipherOnly=128]="encipherOnly",h[h.decipherOnly=256]="decipherOnly";class d9 extends cx{toJSON(){let a=this.toNumber(),b=[];return a&L.cRLSign&&b.push("crlSign"),a&L.dataEncipherment&&b.push("dataEncipherment"),a&L.decipherOnly&&b.push("decipherOnly"),a&L.digitalSignature&&b.push("digitalSignature"),a&L.encipherOnly&&b.push("encipherOnly"),a&L.keyAgreement&&b.push("keyAgreement"),a&L.keyCertSign&&b.push("keyCertSign"),a&L.keyEncipherment&&b.push("keyEncipherment"),a&L.nonRepudiation&&b.push("nonRepudiation"),b}toString(){return`[${this.toJSON().join(", ")}]`}}class ea{constructor(a={}){this.base=new di,this.minimum=0,Object.assign(this,a)}}c6([c0({type:di})],ea.prototype,"base",void 0),c6([c0({type:x.Integer,context:0,defaultValue:0,implicit:!0})],ea.prototype,"minimum",void 0),c6([c0({type:x.Integer,context:1,optional:!0,implicit:!0})],ea.prototype,"maximum",void 0);let eb=M=class extends c4{constructor(a){super(a),Object.setPrototypeOf(this,M.prototype)}};eb=M=c6([c_({type:w.Sequence,itemType:ea})],eb);class ec{constructor(a={}){Object.assign(this,a)}}c6([c0({type:eb,context:0,optional:!0,implicit:!0})],ec.prototype,"permittedSubtrees",void 0),c6([c0({type:eb,context:1,optional:!0,implicit:!0})],ec.prototype,"excludedSubtrees",void 0);class ed{constructor(a={}){Object.assign(this,a)}}c6([c0({type:x.Integer,context:0,implicit:!0,optional:!0,converter:cC})],ed.prototype,"requireExplicitPolicy",void 0),c6([c0({type:x.Integer,context:1,implicit:!0,optional:!0,converter:cC})],ed.prototype,"inhibitPolicyMapping",void 0);class ee{constructor(a={}){this.issuerDomainPolicy="",this.subjectDomainPolicy="",Object.assign(this,a)}}c6([c0({type:x.ObjectIdentifier})],ee.prototype,"issuerDomainPolicy",void 0),c6([c0({type:x.ObjectIdentifier})],ee.prototype,"subjectDomainPolicy",void 0);let ef=N=class extends c4{constructor(a){super(a),Object.setPrototypeOf(this,N.prototype)}};ef=N=c6([c_({type:w.Sequence,itemType:ee})],ef);let eg=`${ds}.17`,eh=O=class extends dB{constructor(a){super(a),Object.setPrototypeOf(this,O.prototype)}};eh=O=c6([c_({type:w.Sequence})],eh);class ei{constructor(a={}){this.type="",this.values=[],Object.assign(this,a)}}c6([c0({type:x.ObjectIdentifier})],ei.prototype,"type",void 0),c6([c0({type:x.Any,repeated:"set"})],ei.prototype,"values",void 0);let ej=P=class extends c4{constructor(a){super(a),Object.setPrototypeOf(this,P.prototype)}};ej=P=c6([c_({type:w.Sequence,itemType:ei})],ej);let ek=`${ds}.14`;class el extends dx{}class em{constructor(a={}){Object.assign(this,a)}}c6([c0({type:x.GeneralizedTime,context:0,implicit:!0,optional:!0})],em.prototype,"notBefore",void 0),c6([c0({type:x.GeneralizedTime,context:1,implicit:!0,optional:!0})],em.prototype,"notAfter",void 0),(i=Q||(Q={}))[i.keyUpdateAllowed=1]="keyUpdateAllowed",i[i.newExtensions=2]="newExtensions",i[i.pKIXCertificate=4]="pKIXCertificate";class en extends cx{toJSON(){let a=[],b=this.toNumber();return b&Q.pKIXCertificate&&a.push("pKIXCertificate"),b&Q.newExtensions&&a.push("newExtensions"),b&Q.keyUpdateAllowed&&a.push("keyUpdateAllowed"),a}toString(){return`[${this.toJSON().join(", ")}]`}}class eo{constructor(a={}){this.entrustVers="",this.entrustInfoFlags=new en,Object.assign(this,a)}}c6([c0({type:x.GeneralString})],eo.prototype,"entrustVers",void 0),c6([c0({type:en})],eo.prototype,"entrustInfoFlags",void 0);let ep=R=class extends c4{constructor(a){super(a),Object.setPrototypeOf(this,R.prototype)}};ep=R=c6([c_({type:w.Sequence,itemType:du})],ep);class eq{constructor(a={}){this.algorithm="",Object.assign(this,a)}isEqual(a){return a instanceof eq&&a.algorithm==this.algorithm&&(a.parameters&&this.parameters&&bc(a.parameters,this.parameters)||a.parameters===this.parameters)}}c6([c0({type:x.ObjectIdentifier})],eq.prototype,"algorithm",void 0),c6([c0({type:x.Any,optional:!0})],eq.prototype,"parameters",void 0);class er{constructor(a={}){this.algorithm=new eq,this.subjectPublicKey=new ArrayBuffer(0),Object.assign(this,a)}}c6([c0({type:eq})],er.prototype,"algorithm",void 0),c6([c0({type:x.BitString})],er.prototype,"subjectPublicKey",void 0);let es=class{constructor(a){if(a)if("string"==typeof a||"number"==typeof a||a instanceof Date){const b=new Date(a);b.getUTCFullYear()>2049?this.generalTime=b:this.utcTime=b}else Object.assign(this,a)}getTime(){let a=this.utcTime||this.generalTime;if(!a)throw Error("Cannot get time from CHOICE object");return a}};c6([c0({type:x.UTCTime})],es.prototype,"utcTime",void 0),c6([c0({type:x.GeneralizedTime})],es.prototype,"generalTime",void 0),es=c6([c_({type:w.Choice})],es);class et{constructor(a){this.notBefore=new es(new Date),this.notAfter=new es(new Date),a&&(this.notBefore=new es(a.notBefore),this.notAfter=new es(a.notAfter))}}c6([c0({type:es})],et.prototype,"notBefore",void 0),c6([c0({type:es})],et.prototype,"notAfter",void 0);class eu{constructor(a={}){this.extnID="",this.critical=eu.CRITICAL,this.extnValue=new cy,Object.assign(this,a)}}eu.CRITICAL=!1,c6([c0({type:x.ObjectIdentifier})],eu.prototype,"extnID",void 0),c6([c0({type:x.Boolean,defaultValue:eu.CRITICAL})],eu.prototype,"critical",void 0),c6([c0({type:cy})],eu.prototype,"extnValue",void 0);let ev=S=class extends c4{constructor(a){super(a),Object.setPrototypeOf(this,S.prototype)}};ev=S=c6([c_({type:w.Sequence,itemType:eu})],ev),(j=T||(T={}))[j.v1=0]="v1",j[j.v2=1]="v2",j[j.v3=2]="v3";class ew{constructor(a={}){this.version=T.v1,this.serialNumber=new ArrayBuffer(0),this.signature=new eq,this.issuer=new df,this.validity=new et,this.subject=new df,this.subjectPublicKeyInfo=new er,Object.assign(this,a)}}c6([c0({type:x.Integer,context:0,defaultValue:T.v1})],ew.prototype,"version",void 0),c6([c0({type:x.Integer,converter:cC})],ew.prototype,"serialNumber",void 0),c6([c0({type:eq})],ew.prototype,"signature",void 0),c6([c0({type:df})],ew.prototype,"issuer",void 0),c6([c0({type:et})],ew.prototype,"validity",void 0),c6([c0({type:df})],ew.prototype,"subject",void 0),c6([c0({type:er})],ew.prototype,"subjectPublicKeyInfo",void 0),c6([c0({type:x.BitString,context:1,implicit:!0,optional:!0})],ew.prototype,"issuerUniqueID",void 0),c6([c0({type:x.BitString,context:2,implicit:!0,optional:!0})],ew.prototype,"subjectUniqueID",void 0),c6([c0({type:ev,context:3,optional:!0})],ew.prototype,"extensions",void 0);class ex{constructor(a={}){this.tbsCertificate=new ew,this.signatureAlgorithm=new eq,this.signatureValue=new ArrayBuffer(0),Object.assign(this,a)}}c6([c0({type:ew,raw:!0})],ex.prototype,"tbsCertificate",void 0),c6([c0({type:eq})],ex.prototype,"signatureAlgorithm",void 0),c6([c0({type:x.BitString})],ex.prototype,"signatureValue",void 0);class ey{constructor(a={}){this.userCertificate=new ArrayBuffer(0),this.revocationDate=new es,Object.assign(this,a)}}c6([c0({type:x.Integer,converter:cC})],ey.prototype,"userCertificate",void 0),c6([c0({type:es})],ey.prototype,"revocationDate",void 0),c6([c0({type:eu,optional:!0,repeated:"sequence"})],ey.prototype,"crlEntryExtensions",void 0);class ez{constructor(a={}){this.signature=new eq,this.issuer=new df,this.thisUpdate=new es,Object.assign(this,a)}}c6([c0({type:x.Integer,optional:!0})],ez.prototype,"version",void 0),c6([c0({type:eq})],ez.prototype,"signature",void 0),c6([c0({type:df})],ez.prototype,"issuer",void 0),c6([c0({type:es})],ez.prototype,"thisUpdate",void 0),c6([c0({type:es,optional:!0})],ez.prototype,"nextUpdate",void 0),c6([c0({type:ey,repeated:"sequence",optional:!0})],ez.prototype,"revokedCertificates",void 0),c6([c0({type:eu,optional:!0,context:0,repeated:"sequence"})],ez.prototype,"crlExtensions",void 0);class eA{constructor(a={}){this.tbsCertList=new ez,this.signatureAlgorithm=new eq,this.signature=new ArrayBuffer(0),Object.assign(this,a)}}c6([c0({type:ez,raw:!0})],eA.prototype,"tbsCertList",void 0),c6([c0({type:eq})],eA.prototype,"signatureAlgorithm",void 0),c6([c0({type:x.BitString})],eA.prototype,"signature",void 0);class eB{constructor(a={}){this.issuer=new df,this.serialNumber=new ArrayBuffer(0),Object.assign(this,a)}}c6([c0({type:df})],eB.prototype,"issuer",void 0),c6([c0({type:x.Integer,converter:cC})],eB.prototype,"serialNumber",void 0);let eC=class{constructor(a={}){Object.assign(this,a)}};c6([c0({type:el,context:0,implicit:!0})],eC.prototype,"subjectKeyIdentifier",void 0),c6([c0({type:eB})],eC.prototype,"issuerAndSerialNumber",void 0),eC=c6([c_({type:w.Choice})],eC),(k=U||(U={}))[k.v0=0]="v0",k[k.v1=1]="v1",k[k.v2=2]="v2",k[k.v3=3]="v3",k[k.v4=4]="v4",k[k.v5=5]="v5";let eD=class extends eq{};eD=c6([c_({type:w.Sequence})],eD);let eE=class extends eq{};eE=c6([c_({type:w.Sequence})],eE);let eF=class extends eq{};eF=c6([c_({type:w.Sequence})],eF);let eG=class extends eq{};eG=c6([c_({type:w.Sequence})],eG);let eH=class extends eq{};eH=c6([c_({type:w.Sequence})],eH);let eI=class extends eq{};eI=c6([c_({type:w.Sequence})],eI);class eJ{constructor(a={}){this.attrType="",this.attrValues=[],Object.assign(this,a)}}c6([c0({type:x.ObjectIdentifier})],eJ.prototype,"attrType",void 0),c6([c0({type:x.Any,repeated:"set"})],eJ.prototype,"attrValues",void 0);class eK{constructor(a={}){this.version=U.v0,this.sid=new eC,this.digestAlgorithm=new eD,this.signatureAlgorithm=new eE,this.signature=new cy,Object.assign(this,a)}}c6([c0({type:x.Integer})],eK.prototype,"version",void 0),c6([c0({type:eC})],eK.prototype,"sid",void 0),c6([c0({type:eD})],eK.prototype,"digestAlgorithm",void 0),c6([c0({type:eJ,repeated:"set",context:0,implicit:!0,optional:!0,raw:!0})],eK.prototype,"signedAttrs",void 0),c6([c0({type:eE})],eK.prototype,"signatureAlgorithm",void 0),c6([c0({type:cy})],eK.prototype,"signature",void 0),c6([c0({type:eJ,repeated:"set",context:1,implicit:!0,optional:!0})],eK.prototype,"unsignedAttrs",void 0);let eL=V=class extends c4{constructor(a){super(a),Object.setPrototypeOf(this,V.prototype)}};eL=V=c6([c_({type:w.Set,itemType:eK})],eL);let eM=class extends eK{};eM=c6([c_({type:w.Sequence})],eM);let eN=class extends es{};eN=c6([c_({type:w.Choice})],eN);class eO{constructor(a={}){this.acIssuer=new di,this.acSerial=0,this.attrs=[],Object.assign(this,a)}}c6([c0({type:di})],eO.prototype,"acIssuer",void 0),c6([c0({type:x.Integer})],eO.prototype,"acSerial",void 0),c6([c0({type:ei,repeated:"sequence"})],eO.prototype,"attrs",void 0);let eP=W=class extends c4{constructor(a){super(a),Object.setPrototypeOf(this,W.prototype)}};eP=W=c6([c_({type:w.Sequence,itemType:x.ObjectIdentifier})],eP);class eQ{constructor(a={}){this.permitUnSpecified=!0,Object.assign(this,a)}}c6([c0({type:x.Integer,optional:!0})],eQ.prototype,"pathLenConstraint",void 0),c6([c0({type:eP,implicit:!0,context:0,optional:!0})],eQ.prototype,"permittedAttrs",void 0),c6([c0({type:eP,implicit:!0,context:1,optional:!0})],eQ.prototype,"excludedAttrs",void 0),c6([c0({type:x.Boolean,defaultValue:!0})],eQ.prototype,"permitUnSpecified",void 0);class eR{constructor(a={}){this.issuer=new dB,this.serial=new ArrayBuffer(0),this.issuerUID=new ArrayBuffer(0),Object.assign(this,a)}}c6([c0({type:dB})],eR.prototype,"issuer",void 0),c6([c0({type:x.Integer,converter:cC})],eR.prototype,"serial",void 0),c6([c0({type:x.BitString,optional:!0})],eR.prototype,"issuerUID",void 0),(l=X||(X={}))[l.publicKey=0]="publicKey",l[l.publicKeyCert=1]="publicKeyCert",l[l.otherObjectTypes=2]="otherObjectTypes";class eS{constructor(a={}){this.digestedObjectType=X.publicKey,this.digestAlgorithm=new eq,this.objectDigest=new ArrayBuffer(0),Object.assign(this,a)}}c6([c0({type:x.Enumerated})],eS.prototype,"digestedObjectType",void 0),c6([c0({type:x.ObjectIdentifier,optional:!0})],eS.prototype,"otherObjectTypeID",void 0),c6([c0({type:eq})],eS.prototype,"digestAlgorithm",void 0),c6([c0({type:x.BitString})],eS.prototype,"objectDigest",void 0);class eT{constructor(a={}){Object.assign(this,a)}}c6([c0({type:dB,optional:!0})],eT.prototype,"issuerName",void 0),c6([c0({type:eR,context:0,implicit:!0,optional:!0})],eT.prototype,"baseCertificateID",void 0),c6([c0({type:eS,context:1,implicit:!0,optional:!0})],eT.prototype,"objectDigestInfo",void 0);let eU=class{constructor(a={}){Object.assign(this,a)}};c6([c0({type:di,repeated:"sequence"})],eU.prototype,"v1Form",void 0),c6([c0({type:eT,context:0,implicit:!0})],eU.prototype,"v2Form",void 0),eU=c6([c_({type:w.Choice})],eU);class eV{constructor(a={}){this.notBeforeTime=new Date,this.notAfterTime=new Date,Object.assign(this,a)}}c6([c0({type:x.GeneralizedTime})],eV.prototype,"notBeforeTime",void 0),c6([c0({type:x.GeneralizedTime})],eV.prototype,"notAfterTime",void 0);class eW{constructor(a={}){Object.assign(this,a)}}c6([c0({type:eR,implicit:!0,context:0,optional:!0})],eW.prototype,"baseCertificateID",void 0),c6([c0({type:dB,implicit:!0,context:1,optional:!0})],eW.prototype,"entityName",void 0),c6([c0({type:eS,implicit:!0,context:2,optional:!0})],eW.prototype,"objectDigestInfo",void 0),(m=Y||(Y={}))[m.v2=1]="v2";class eX{constructor(a={}){this.version=Y.v2,this.holder=new eW,this.issuer=new eU,this.signature=new eq,this.serialNumber=new ArrayBuffer(0),this.attrCertValidityPeriod=new eV,this.attributes=[],Object.assign(this,a)}}c6([c0({type:x.Integer})],eX.prototype,"version",void 0),c6([c0({type:eW})],eX.prototype,"holder",void 0),c6([c0({type:eU})],eX.prototype,"issuer",void 0),c6([c0({type:eq})],eX.prototype,"signature",void 0),c6([c0({type:x.Integer,converter:cC})],eX.prototype,"serialNumber",void 0),c6([c0({type:eV})],eX.prototype,"attrCertValidityPeriod",void 0),c6([c0({type:ei,repeated:"sequence"})],eX.prototype,"attributes",void 0),c6([c0({type:x.BitString,optional:!0})],eX.prototype,"issuerUniqueID",void 0),c6([c0({type:ev,optional:!0})],eX.prototype,"extensions",void 0);class eY{constructor(a={}){this.acinfo=new eX,this.signatureAlgorithm=new eq,this.signatureValue=new ArrayBuffer(0),Object.assign(this,a)}}c6([c0({type:eX})],eY.prototype,"acinfo",void 0),c6([c0({type:eq})],eY.prototype,"signatureAlgorithm",void 0),c6([c0({type:x.BitString})],eY.prototype,"signatureValue",void 0),(n=Z||(Z={}))[n.unmarked=1]="unmarked",n[n.unclassified=2]="unclassified",n[n.restricted=4]="restricted",n[n.confidential=8]="confidential",n[n.secret=16]="secret",n[n.topSecret=32]="topSecret";class eZ extends cx{}class e${constructor(a={}){this.type="",this.value=new ArrayBuffer(0),Object.assign(this,a)}}c6([c0({type:x.ObjectIdentifier,implicit:!0,context:0})],e$.prototype,"type",void 0),c6([c0({type:x.Any,implicit:!0,context:1})],e$.prototype,"value",void 0);class e_{constructor(a={}){this.policyId="",this.classList=new eZ(Z.unclassified),Object.assign(this,a)}}c6([c0({type:x.ObjectIdentifier})],e_.prototype,"policyId",void 0),c6([c0({type:eZ,defaultValue:new eZ(Z.unclassified)})],e_.prototype,"classList",void 0),c6([c0({type:e$,repeated:"set"})],e_.prototype,"securityCategories",void 0);class e0{constructor(a={}){Object.assign(this,a)}}c6([c0({type:cy})],e0.prototype,"cotets",void 0),c6([c0({type:x.ObjectIdentifier})],e0.prototype,"oid",void 0),c6([c0({type:x.Utf8String})],e0.prototype,"string",void 0);class e1{constructor(a={}){this.values=[],Object.assign(this,a)}}c6([c0({type:dB,implicit:!0,context:0,optional:!0})],e1.prototype,"policyAuthority",void 0),c6([c0({type:e0,repeated:"sequence"})],e1.prototype,"values",void 0);class e2{constructor(a={}){this.targetCertificate=new eR,Object.assign(this,a)}}c6([c0({type:eR})],e2.prototype,"targetCertificate",void 0),c6([c0({type:di,optional:!0})],e2.prototype,"targetName",void 0),c6([c0({type:eS,optional:!0})],e2.prototype,"certDigestInfo",void 0);let e3=class{constructor(a={}){Object.assign(this,a)}};c6([c0({type:di,context:0,implicit:!0})],e3.prototype,"targetName",void 0),c6([c0({type:di,context:1,implicit:!0})],e3.prototype,"targetGroup",void 0),c6([c0({type:e2,context:2,implicit:!0})],e3.prototype,"targetCert",void 0),e3=c6([c_({type:w.Choice})],e3);let e4=$=class extends c4{constructor(a){super(a),Object.setPrototypeOf(this,$.prototype)}};e4=$=c6([c_({type:w.Sequence,itemType:e3})],e4);let e5=_=class extends c4{constructor(a){super(a),Object.setPrototypeOf(this,_.prototype)}};e5=_=c6([c_({type:w.Sequence,itemType:e4})],e5);class e6{constructor(a={}){Object.assign(this,a)}}c6([c0({type:dB,implicit:!0,context:0,optional:!0})],e6.prototype,"roleAuthority",void 0),c6([c0({type:di,implicit:!0,context:1})],e6.prototype,"roleName",void 0);class e7{constructor(a={}){this.service=new di,this.ident=new di,Object.assign(this,a)}}c6([c0({type:di})],e7.prototype,"service",void 0),c6([c0({type:di})],e7.prototype,"ident",void 0),c6([c0({type:cy,optional:!0})],e7.prototype,"authInfo",void 0);class e8{constructor(a={}){this.otherCertFormat="",this.otherCert=new ArrayBuffer(0),Object.assign(this,a)}}c6([c0({type:x.ObjectIdentifier})],e8.prototype,"otherCertFormat",void 0),c6([c0({type:x.Any})],e8.prototype,"otherCert",void 0);let e9=class{constructor(a={}){Object.assign(this,a)}};c6([c0({type:ex})],e9.prototype,"certificate",void 0),c6([c0({type:eY,context:2,implicit:!0})],e9.prototype,"v2AttrCert",void 0),c6([c0({type:e8,context:3,implicit:!0})],e9.prototype,"other",void 0),e9=c6([c_({type:w.Choice})],e9);let fa=aa=class extends c4{constructor(a){super(a),Object.setPrototypeOf(this,aa.prototype)}};fa=aa=c6([c_({type:w.Set,itemType:e9})],fa);class fb{constructor(a={}){this.contentType="",this.content=new ArrayBuffer(0),Object.assign(this,a)}}c6([c0({type:x.ObjectIdentifier})],fb.prototype,"contentType",void 0),c6([c0({type:x.Any,context:0})],fb.prototype,"content",void 0);let fc=class{constructor(a={}){Object.assign(this,a)}};c6([c0({type:cy})],fc.prototype,"single",void 0),c6([c0({type:x.Any})],fc.prototype,"any",void 0),fc=c6([c_({type:w.Choice})],fc);class fd{constructor(a={}){this.eContentType="",Object.assign(this,a)}}c6([c0({type:x.ObjectIdentifier})],fd.prototype,"eContentType",void 0),c6([c0({type:fc,context:0,optional:!0})],fd.prototype,"eContent",void 0);let fe=class{constructor(a={}){Object.assign(this,a)}};c6([c0({type:cy,context:0,implicit:!0,optional:!0})],fe.prototype,"value",void 0),c6([c0({type:cy,converter:{fromASN:a=>new cy(a.getValue()),toASN:a=>a.toASN()},context:0,implicit:!0,optional:!0,repeated:"sequence"})],fe.prototype,"constructedValue",void 0),fe=c6([c_({type:w.Choice})],fe);class ff{constructor(a={}){this.contentType="",this.contentEncryptionAlgorithm=new eG,Object.assign(this,a)}}c6([c0({type:x.ObjectIdentifier})],ff.prototype,"contentType",void 0),c6([c0({type:eG})],ff.prototype,"contentEncryptionAlgorithm",void 0),c6([c0({type:fe,optional:!0})],ff.prototype,"encryptedContent",void 0);class fg{constructor(a={}){this.keyAttrId="",Object.assign(this,a)}}c6([c0({type:x.ObjectIdentifier})],fg.prototype,"keyAttrId",void 0),c6([c0({type:x.Any,optional:!0})],fg.prototype,"keyAttr",void 0);class fh{constructor(a={}){this.subjectKeyIdentifier=new el,Object.assign(this,a)}}c6([c0({type:el})],fh.prototype,"subjectKeyIdentifier",void 0),c6([c0({type:x.GeneralizedTime,optional:!0})],fh.prototype,"date",void 0),c6([c0({type:fg,optional:!0})],fh.prototype,"other",void 0);let fi=class{constructor(a={}){Object.assign(this,a)}};c6([c0({type:fh,context:0,implicit:!0,optional:!0})],fi.prototype,"rKeyId",void 0),c6([c0({type:eB,optional:!0})],fi.prototype,"issuerAndSerialNumber",void 0),fi=c6([c_({type:w.Choice})],fi);class fj{constructor(a={}){this.rid=new fi,this.encryptedKey=new cy,Object.assign(this,a)}}c6([c0({type:fi})],fj.prototype,"rid",void 0),c6([c0({type:cy})],fj.prototype,"encryptedKey",void 0);let fk=ab=class extends c4{constructor(a){super(a),Object.setPrototypeOf(this,ab.prototype)}};fk=ab=c6([c_({type:w.Sequence,itemType:fj})],fk);class fl{constructor(a={}){this.algorithm=new eq,this.publicKey=new ArrayBuffer(0),Object.assign(this,a)}}c6([c0({type:eq})],fl.prototype,"algorithm",void 0),c6([c0({type:x.BitString})],fl.prototype,"publicKey",void 0);let fm=class{constructor(a={}){Object.assign(this,a)}};c6([c0({type:el,context:0,implicit:!0,optional:!0})],fm.prototype,"subjectKeyIdentifier",void 0),c6([c0({type:fl,context:1,implicit:!0,optional:!0})],fm.prototype,"originatorKey",void 0),c6([c0({type:eB,optional:!0})],fm.prototype,"issuerAndSerialNumber",void 0),fm=c6([c_({type:w.Choice})],fm);class fn{constructor(a={}){this.version=U.v3,this.originator=new fm,this.keyEncryptionAlgorithm=new eF,this.recipientEncryptedKeys=new fk,Object.assign(this,a)}}c6([c0({type:x.Integer})],fn.prototype,"version",void 0),c6([c0({type:fm,context:0})],fn.prototype,"originator",void 0),c6([c0({type:cy,context:1,optional:!0})],fn.prototype,"ukm",void 0),c6([c0({type:eF})],fn.prototype,"keyEncryptionAlgorithm",void 0),c6([c0({type:fk})],fn.prototype,"recipientEncryptedKeys",void 0);let fo=class{constructor(a={}){Object.assign(this,a)}};c6([c0({type:el,context:0,implicit:!0})],fo.prototype,"subjectKeyIdentifier",void 0),c6([c0({type:eB})],fo.prototype,"issuerAndSerialNumber",void 0),fo=c6([c_({type:w.Choice})],fo);class fp{constructor(a={}){this.version=U.v0,this.rid=new fo,this.keyEncryptionAlgorithm=new eF,this.encryptedKey=new cy,Object.assign(this,a)}}c6([c0({type:x.Integer})],fp.prototype,"version",void 0),c6([c0({type:fo})],fp.prototype,"rid",void 0),c6([c0({type:eF})],fp.prototype,"keyEncryptionAlgorithm",void 0),c6([c0({type:cy})],fp.prototype,"encryptedKey",void 0);class fq{constructor(a={}){this.keyIdentifier=new cy,Object.assign(this,a)}}c6([c0({type:cy})],fq.prototype,"keyIdentifier",void 0),c6([c0({type:x.GeneralizedTime,optional:!0})],fq.prototype,"date",void 0),c6([c0({type:fg,optional:!0})],fq.prototype,"other",void 0);class fr{constructor(a={}){this.version=U.v4,this.kekid=new fq,this.keyEncryptionAlgorithm=new eF,this.encryptedKey=new cy,Object.assign(this,a)}}c6([c0({type:x.Integer})],fr.prototype,"version",void 0),c6([c0({type:fq})],fr.prototype,"kekid",void 0),c6([c0({type:eF})],fr.prototype,"keyEncryptionAlgorithm",void 0),c6([c0({type:cy})],fr.prototype,"encryptedKey",void 0);class fs{constructor(a={}){this.version=U.v0,this.keyEncryptionAlgorithm=new eF,this.encryptedKey=new cy,Object.assign(this,a)}}c6([c0({type:x.Integer})],fs.prototype,"version",void 0),c6([c0({type:eI,context:0,optional:!0})],fs.prototype,"keyDerivationAlgorithm",void 0),c6([c0({type:eF})],fs.prototype,"keyEncryptionAlgorithm",void 0),c6([c0({type:cy})],fs.prototype,"encryptedKey",void 0);class ft{constructor(a={}){this.oriType="",this.oriValue=new ArrayBuffer(0),Object.assign(this,a)}}c6([c0({type:x.ObjectIdentifier})],ft.prototype,"oriType",void 0),c6([c0({type:x.Any})],ft.prototype,"oriValue",void 0);let fu=class{constructor(a={}){Object.assign(this,a)}};c6([c0({type:fp,optional:!0})],fu.prototype,"ktri",void 0),c6([c0({type:fn,context:1,implicit:!0,optional:!0})],fu.prototype,"kari",void 0),c6([c0({type:fr,context:2,implicit:!0,optional:!0})],fu.prototype,"kekri",void 0),c6([c0({type:fs,context:3,implicit:!0,optional:!0})],fu.prototype,"pwri",void 0),c6([c0({type:ft,context:4,implicit:!0,optional:!0})],fu.prototype,"ori",void 0),fu=c6([c_({type:w.Choice})],fu);let fv=ac=class extends c4{constructor(a){super(a),Object.setPrototypeOf(this,ac.prototype)}};fv=ac=c6([c_({type:w.Set,itemType:fu})],fv);class fw{constructor(a={}){this.otherRevInfoFormat="",this.otherRevInfo=new ArrayBuffer(0),Object.assign(this,a)}}c6([c0({type:x.ObjectIdentifier})],fw.prototype,"otherRevInfoFormat",void 0),c6([c0({type:x.Any})],fw.prototype,"otherRevInfo",void 0);let fx=class{constructor(a={}){this.other=new fw,Object.assign(this,a)}};c6([c0({type:fw,context:1,implicit:!0})],fx.prototype,"other",void 0),fx=c6([c_({type:w.Choice})],fx);let fy=ad=class extends c4{constructor(a){super(a),Object.setPrototypeOf(this,ad.prototype)}};fy=ad=c6([c_({type:w.Set,itemType:fx})],fy);class fz{constructor(a={}){Object.assign(this,a)}}c6([c0({type:fa,context:0,implicit:!0,optional:!0})],fz.prototype,"certs",void 0),c6([c0({type:fy,context:1,implicit:!0,optional:!0})],fz.prototype,"crls",void 0);let fA=ae=class extends c4{constructor(a){super(a),Object.setPrototypeOf(this,ae.prototype)}};fA=ae=c6([c_({type:w.Set,itemType:eJ})],fA);class fB{constructor(a={}){this.version=U.v0,this.recipientInfos=new fv,this.encryptedContentInfo=new ff,Object.assign(this,a)}}c6([c0({type:x.Integer})],fB.prototype,"version",void 0),c6([c0({type:fz,context:0,implicit:!0,optional:!0})],fB.prototype,"originatorInfo",void 0),c6([c0({type:fv})],fB.prototype,"recipientInfos",void 0),c6([c0({type:ff})],fB.prototype,"encryptedContentInfo",void 0),c6([c0({type:fA,context:1,implicit:!0,optional:!0})],fB.prototype,"unprotectedAttrs",void 0);let fC="1.2.840.113549.1.7.2",fD=af=class extends c4{constructor(a){super(a),Object.setPrototypeOf(this,af.prototype)}};fD=af=c6([c_({type:w.Set,itemType:eD})],fD);class fE{constructor(a={}){this.version=U.v0,this.digestAlgorithms=new fD,this.encapContentInfo=new fd,this.signerInfos=new eL,Object.assign(this,a)}}c6([c0({type:x.Integer})],fE.prototype,"version",void 0),c6([c0({type:fD})],fE.prototype,"digestAlgorithms",void 0),c6([c0({type:fd})],fE.prototype,"encapContentInfo",void 0),c6([c0({type:fa,context:0,implicit:!0,optional:!0})],fE.prototype,"certificates",void 0),c6([c0({type:fy,context:1,implicit:!0,optional:!0})],fE.prototype,"crls",void 0),c6([c0({type:eL})],fE.prototype,"signerInfos",void 0);let fF="1.2.840.10045.2.1",fG="1.2.840.10045.4.1",fH="1.2.840.10045.4.3.1",fI="1.2.840.10045.4.3.2",fJ="1.2.840.10045.4.3.3",fK="1.2.840.10045.4.3.4",fL="1.2.840.10045.3.1.7",fM="1.3.132.0.34",fN="1.3.132.0.35";function fO(a){return new eq({algorithm:a})}let fP=fO(fG);fO(fH);let fQ=fO(fI),fR=fO(fJ),fS=fO(fK),fT=class{constructor(a={}){Object.assign(this,a)}};c6([c0({type:x.ObjectIdentifier})],fT.prototype,"fieldType",void 0),c6([c0({type:x.Any})],fT.prototype,"parameters",void 0),fT=c6([c_({type:w.Sequence})],fT);class fU extends cy{}let fV=class{constructor(a={}){Object.assign(this,a)}};c6([c0({type:x.OctetString})],fV.prototype,"a",void 0),c6([c0({type:x.OctetString})],fV.prototype,"b",void 0),c6([c0({type:x.BitString,optional:!0})],fV.prototype,"seed",void 0),fV=c6([c_({type:w.Sequence})],fV),(o=ag||(ag={}))[o.ecpVer1=1]="ecpVer1";let fW=class{constructor(a={}){this.version=ag.ecpVer1,Object.assign(this,a)}};c6([c0({type:x.Integer})],fW.prototype,"version",void 0),c6([c0({type:fT})],fW.prototype,"fieldID",void 0),c6([c0({type:fV})],fW.prototype,"curve",void 0),c6([c0({type:fU})],fW.prototype,"base",void 0),c6([c0({type:x.Integer,converter:cC})],fW.prototype,"order",void 0),c6([c0({type:x.Integer,optional:!0})],fW.prototype,"cofactor",void 0),fW=c6([c_({type:w.Sequence})],fW);let fX=class{constructor(a={}){Object.assign(this,a)}};c6([c0({type:x.ObjectIdentifier})],fX.prototype,"namedCurve",void 0),c6([c0({type:x.Null})],fX.prototype,"implicitCurve",void 0),c6([c0({type:fW})],fX.prototype,"specifiedCurve",void 0),fX=c6([c_({type:w.Choice})],fX);class fY{constructor(a={}){this.version=1,this.privateKey=new cy,Object.assign(this,a)}}c6([c0({type:x.Integer})],fY.prototype,"version",void 0),c6([c0({type:cy})],fY.prototype,"privateKey",void 0),c6([c0({type:fX,context:0,optional:!0})],fY.prototype,"parameters",void 0),c6([c0({type:x.BitString,context:1,optional:!0})],fY.prototype,"publicKey",void 0);class fZ{constructor(a={}){this.r=new ArrayBuffer(0),this.s=new ArrayBuffer(0),Object.assign(this,a)}}c6([c0({type:x.Integer,converter:cC})],fZ.prototype,"r",void 0),c6([c0({type:x.Integer,converter:cC})],fZ.prototype,"s",void 0);let f$="1.2.840.113549.1.1",f_=`${f$}.1`,f0=`${f$}.7`,f1=`${f$}.9`,f2=`${f$}.10`,f3=`${f$}.2`,f4=`${f$}.4`,f5=`${f$}.5`,f6=`${f$}.14`,f7=`${f$}.11`,f8=`${f$}.12`,f9=`${f$}.13`,ga=`${f$}.15`,gb=`${f$}.16`,gc="1.3.14.3.2.26",gd="2.16.840.1.101.3.4.2.4",ge="2.16.840.1.101.3.4.2.1",gf="2.16.840.1.101.3.4.2.2",gg="2.16.840.1.101.3.4.2.3",gh=`${f$}.8`;function gi(a){return new eq({algorithm:a,parameters:null})}gi("1.2.840.113549.2.2"),gi("1.2.840.113549.2.5");let gj=gi(gc);gi(gd),gi(ge),gi(gf),gi(gg),gi("2.16.840.1.101.3.4.2.5"),gi("2.16.840.1.101.3.4.2.6");let gk=new eq({algorithm:gh,parameters:c5.serialize(gj)}),gl=new eq({algorithm:f1,parameters:c5.serialize(cG.toASN(new Uint8Array([218,57,163,238,94,107,75,13,50,85,191,239,149,96,24,144,175,216,7,9]).buffer))});gi(f_),gi(f3),gi(f4),gi(f5),gi(ga),gi(gb),gi(f8),gi(f9),gi(ga),gi(gb);class gm{constructor(a={}){this.hashAlgorithm=new eq(gj),this.maskGenAlgorithm=new eq({algorithm:gh,parameters:c5.serialize(gj)}),this.pSourceAlgorithm=new eq(gl),Object.assign(this,a)}}c6([c0({type:eq,context:0,defaultValue:gj})],gm.prototype,"hashAlgorithm",void 0),c6([c0({type:eq,context:1,defaultValue:gk})],gm.prototype,"maskGenAlgorithm",void 0),c6([c0({type:eq,context:2,defaultValue:gl})],gm.prototype,"pSourceAlgorithm",void 0),new eq({algorithm:f0,parameters:c5.serialize(new gm)});class gn{constructor(a={}){this.hashAlgorithm=new eq(gj),this.maskGenAlgorithm=new eq({algorithm:gh,parameters:c5.serialize(gj)}),this.saltLength=20,this.trailerField=1,Object.assign(this,a)}}c6([c0({type:eq,context:0,defaultValue:gj})],gn.prototype,"hashAlgorithm",void 0),c6([c0({type:eq,context:1,defaultValue:gk})],gn.prototype,"maskGenAlgorithm",void 0),c6([c0({type:x.Integer,context:2,defaultValue:20})],gn.prototype,"saltLength",void 0),c6([c0({type:x.Integer,context:3,defaultValue:1})],gn.prototype,"trailerField",void 0),new eq({algorithm:f2,parameters:c5.serialize(new gn)});class go{constructor(a={}){this.digestAlgorithm=new eq,this.digest=new cy,Object.assign(this,a)}}c6([c0({type:eq})],go.prototype,"digestAlgorithm",void 0),c6([c0({type:cy})],go.prototype,"digest",void 0);class gp{constructor(a={}){this.prime=new ArrayBuffer(0),this.exponent=new ArrayBuffer(0),this.coefficient=new ArrayBuffer(0),Object.assign(this,a)}}c6([c0({type:x.Integer,converter:cC})],gp.prototype,"prime",void 0),c6([c0({type:x.Integer,converter:cC})],gp.prototype,"exponent",void 0),c6([c0({type:x.Integer,converter:cC})],gp.prototype,"coefficient",void 0);let gq=ah=class extends c4{constructor(a){super(a),Object.setPrototypeOf(this,ah.prototype)}};gq=ah=c6([c_({type:w.Sequence,itemType:gp})],gq);class gr{constructor(a={}){this.version=0,this.modulus=new ArrayBuffer(0),this.publicExponent=new ArrayBuffer(0),this.privateExponent=new ArrayBuffer(0),this.prime1=new ArrayBuffer(0),this.prime2=new ArrayBuffer(0),this.exponent1=new ArrayBuffer(0),this.exponent2=new ArrayBuffer(0),this.coefficient=new ArrayBuffer(0),Object.assign(this,a)}}c6([c0({type:x.Integer})],gr.prototype,"version",void 0),c6([c0({type:x.Integer,converter:cC})],gr.prototype,"modulus",void 0),c6([c0({type:x.Integer,converter:cC})],gr.prototype,"publicExponent",void 0),c6([c0({type:x.Integer,converter:cC})],gr.prototype,"privateExponent",void 0),c6([c0({type:x.Integer,converter:cC})],gr.prototype,"prime1",void 0),c6([c0({type:x.Integer,converter:cC})],gr.prototype,"prime2",void 0),c6([c0({type:x.Integer,converter:cC})],gr.prototype,"exponent1",void 0),c6([c0({type:x.Integer,converter:cC})],gr.prototype,"exponent2",void 0),c6([c0({type:x.Integer,converter:cC})],gr.prototype,"coefficient",void 0),c6([c0({type:gq,optional:!0})],gr.prototype,"otherPrimeInfos",void 0);class gs{constructor(a={}){this.modulus=new ArrayBuffer(0),this.publicExponent=new ArrayBuffer(0),Object.assign(this,a)}}c6([c0({type:x.Integer,converter:cC})],gs.prototype,"modulus",void 0),c6([c0({type:x.Integer,converter:cC})],gs.prototype,"publicExponent",void 0),(p=ai||(ai={}))[p.Transient=0]="Transient",p[p.Singleton=1]="Singleton",p[p.ResolutionScoped=2]="ResolutionScoped",p[p.ContainerScoped=3]="ContainerScoped";let gt=ai;var gu=function(a,b){return(gu=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])})(a,b)};function gv(a,b){function c(){this.constructor=a}gu(a,b),a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)}function gw(a){var b="function"==typeof Symbol&&Symbol.iterator,c=b&&a[b],d=0;if(c)return c.call(a);if(a&&"number"==typeof a.length)return{next:function(){return a&&d>=a.length&&(a=void 0),{value:a&&a[d++],done:!a}}};throw TypeError(b?"Object is not iterable.":"Symbol.iterator is not defined.")}function gx(a,b){var c="function"==typeof Symbol&&a[Symbol.iterator];if(!c)return a;var d,e,f=c.call(a),g=[];try{for(;(void 0===b||b-- >0)&&!(d=f.next()).done;)g.push(d.value)}catch(a){e={error:a}}finally{try{d&&!d.done&&(c=f.return)&&c.call(f)}finally{if(e)throw e.error}}return g}function gy(){for(var a=[],b=0;b<arguments.length;b++)a=a.concat(gx(arguments[b]));return a}function gz(a){return!!a.useClass}function gA(a){return!!a.useFactory}var gB=function(){function a(a){this.wrap=a,this.reflectMethods=["get","getPrototypeOf","setPrototypeOf","getOwnPropertyDescriptor","defineProperty","has","set","deleteProperty","apply","construct","ownKeys"]}return a.prototype.createProxy=function(a){var b,c=this,d=!1;return new Proxy({},this.createHandler(function(){return d||(b=a(c.wrap()),d=!0),b}))},a.prototype.createHandler=function(a){var b={};return this.reflectMethods.forEach(function(c){b[c]=function(){for(var b=[],d=0;d<arguments.length;d++)b[d]=arguments[d];return b[0]=a(),Reflect[c].apply(void 0,gy(b))}}),b},a}();function gC(a){return"string"==typeof a||"symbol"==typeof a}function gD(a){return"object"==typeof a&&"token"in a&&"transform"in a}function gE(a){return!!a.useToken}function gF(a){return void 0!=a.useValue}var gG=function(){function a(){this._registryMap=new Map}return a.prototype.entries=function(){return this._registryMap.entries()},a.prototype.getAll=function(a){return this.ensure(a),this._registryMap.get(a)},a.prototype.get=function(a){this.ensure(a);var b=this._registryMap.get(a);return b[b.length-1]||null},a.prototype.set=function(a,b){this.ensure(a),this._registryMap.get(a).push(b)},a.prototype.setAll=function(a,b){this._registryMap.set(a,b)},a.prototype.has=function(a){return this.ensure(a),this._registryMap.get(a).length>0},a.prototype.clear=function(){this._registryMap.clear()},a.prototype.ensure=function(a){this._registryMap.has(a)||this._registryMap.set(a,[])},a}(),gH=function(a){function b(){return null!==a&&a.apply(this,arguments)||this}return gv(b,a),b}(gG);let gI=function(){this.scopedResolutions=new Map};var gJ=function(a){function b(){return null!==a&&a.apply(this,arguments)||this}return gv(b,a),b}(gG),gK=function(a){function b(){return null!==a&&a.apply(this,arguments)||this}return gv(b,a),b}(gG);let gL=function(){this.preResolution=new gJ,this.postResolution=new gK};var gM=new Map,gN=new(function(){function a(a){this.parent=a,this._registry=new gH,this.interceptors=new gL,this.disposed=!1,this.disposables=new Set}return a.prototype.register=function(a,b,c){if(void 0===c&&(c={lifecycle:gt.Transient}),this.ensureNotDisposed(),d=gz(b)||gF(b)||gE(b)||gA(b)?b:{useClass:b},gE(d))for(var d,e=[a],f=d;null!=f;){var g=f.useToken;if(e.includes(g))throw Error("Token registration cycle detected! "+gy(e,[g]).join(" -> "));e.push(g);var h=this._registry.get(g);f=h&&gE(h.provider)?h.provider:null}if((c.lifecycle===gt.Singleton||c.lifecycle==gt.ContainerScoped||c.lifecycle==gt.ResolutionScoped)&&(gF(d)||gA(d)))throw Error('Cannot use lifecycle "'+gt[c.lifecycle]+'" with ValueProviders or FactoryProviders');return this._registry.set(a,{provider:d,options:c}),this},a.prototype.registerType=function(a,b){return(this.ensureNotDisposed(),gC(b))?this.register(a,{useToken:b}):this.register(a,{useClass:b})},a.prototype.registerInstance=function(a,b){return this.ensureNotDisposed(),this.register(a,{useValue:b})},a.prototype.registerSingleton=function(a,b){if(this.ensureNotDisposed(),gC(a)){if(gC(b))return this.register(a,{useToken:b},{lifecycle:gt.Singleton});if(b)return this.register(a,{useClass:b},{lifecycle:gt.Singleton});throw Error('Cannot register a type name as a singleton without a "to" token')}var c=a;return b&&!gC(b)&&(c=b),this.register(a,{useClass:c},{lifecycle:gt.Singleton})},a.prototype.resolve=function(a,b,c){void 0===b&&(b=new gI),void 0===c&&(c=!1),this.ensureNotDisposed();var d=this.getRegistration(a);if(!d&&gC(a)){if(c)return;throw Error('Attempted to resolve unregistered dependency token: "'+a.toString()+'"')}if(this.executePreResolutionInterceptor(a,"Single"),d){var e=this.resolveRegistration(d,b);return this.executePostResolutionInterceptor(a,e,"Single"),e}if("function"==typeof a||a instanceof gB){var e=this.construct(a,b);return this.executePostResolutionInterceptor(a,e,"Single"),e}throw Error("Attempted to construct an undefined constructor. Could mean a circular dependency problem. Try using `delay` function.")},a.prototype.executePreResolutionInterceptor=function(a,b){var c,d;if(this.interceptors.preResolution.has(a)){var e=[];try{for(var f=gw(this.interceptors.preResolution.getAll(a)),g=f.next();!g.done;g=f.next()){var h=g.value;"Once"!=h.options.frequency&&e.push(h),h.callback(a,b)}}catch(a){c={error:a}}finally{try{g&&!g.done&&(d=f.return)&&d.call(f)}finally{if(c)throw c.error}}this.interceptors.preResolution.setAll(a,e)}},a.prototype.executePostResolutionInterceptor=function(a,b,c){var d,e;if(this.interceptors.postResolution.has(a)){var f=[];try{for(var g=gw(this.interceptors.postResolution.getAll(a)),h=g.next();!h.done;h=g.next()){var i=h.value;"Once"!=i.options.frequency&&f.push(i),i.callback(a,b,c)}}catch(a){d={error:a}}finally{try{h&&!h.done&&(e=g.return)&&e.call(g)}finally{if(d)throw d.error}}this.interceptors.postResolution.setAll(a,f)}},a.prototype.resolveRegistration=function(a,b){if(this.ensureNotDisposed(),a.options.lifecycle===gt.ResolutionScoped&&b.scopedResolutions.has(a))return b.scopedResolutions.get(a);var c,d=a.options.lifecycle===gt.Singleton,e=a.options.lifecycle===gt.ContainerScoped,f=d||e;return c=gF(a.provider)?a.provider.useValue:gE(a.provider)?f?a.instance||(a.instance=this.resolve(a.provider.useToken,b)):this.resolve(a.provider.useToken,b):gz(a.provider)?f?a.instance||(a.instance=this.construct(a.provider.useClass,b)):this.construct(a.provider.useClass,b):gA(a.provider)?a.provider.useFactory(this):this.construct(a.provider,b),a.options.lifecycle===gt.ResolutionScoped&&b.scopedResolutions.set(a,c),c},a.prototype.resolveAll=function(a,b,c){var d=this;void 0===b&&(b=new gI),void 0===c&&(c=!1),this.ensureNotDisposed();var e=this.getAllRegistrations(a);if(!e&&gC(a)){if(c)return[];throw Error('Attempted to resolve unregistered dependency token: "'+a.toString()+'"')}if(this.executePreResolutionInterceptor(a,"All"),e){var f=e.map(function(a){return d.resolveRegistration(a,b)});return this.executePostResolutionInterceptor(a,f,"All"),f}var g=[this.construct(a,b)];return this.executePostResolutionInterceptor(a,g,"All"),g},a.prototype.isRegistered=function(a,b){return void 0===b&&(b=!1),this.ensureNotDisposed(),this._registry.has(a)||b&&(this.parent||!1)&&this.parent.isRegistered(a,!0)},a.prototype.reset=function(){this.ensureNotDisposed(),this._registry.clear(),this.interceptors.preResolution.clear(),this.interceptors.postResolution.clear()},a.prototype.clearInstances=function(){var a,b;this.ensureNotDisposed();try{for(var c=gw(this._registry.entries()),d=c.next();!d.done;d=c.next()){var e=gx(d.value,2),f=e[0],g=e[1];this._registry.setAll(f,g.filter(function(a){return!gF(a.provider)}).map(function(a){return a.instance=void 0,a}))}}catch(b){a={error:b}}finally{try{d&&!d.done&&(b=c.return)&&b.call(c)}finally{if(a)throw a.error}}},a.prototype.createChildContainer=function(){this.ensureNotDisposed();var b,c,d=new a(this);try{for(var e=gw(this._registry.entries()),f=e.next();!f.done;f=e.next()){var g=gx(f.value,2),h=g[0],i=g[1];i.some(function(a){return a.options.lifecycle===gt.ContainerScoped})&&d._registry.setAll(h,i.map(function(a){return a.options.lifecycle===gt.ContainerScoped?{provider:a.provider,options:a.options}:a}))}}catch(a){b={error:a}}finally{try{f&&!f.done&&(c=e.return)&&c.call(e)}finally{if(b)throw b.error}}return d},a.prototype.beforeResolution=function(a,b,c){void 0===c&&(c={frequency:"Always"}),this.interceptors.preResolution.set(a,{callback:b,options:c})},a.prototype.afterResolution=function(a,b,c){void 0===c&&(c={frequency:"Always"}),this.interceptors.postResolution.set(a,{callback:b,options:c})},a.prototype.dispose=function(){var a,b,c,d;return a=this,b=void 0,c=void 0,d=function(){var a;return function(a,b){var c,d,e,f,g={label:0,sent:function(){if(1&e[0])throw e[1];return e[1]},trys:[],ops:[]};return f={next:h(0),throw:h(1),return:h(2)},"function"==typeof Symbol&&(f[Symbol.iterator]=function(){return this}),f;function h(f){return function(h){var i=[f,h];if(c)throw TypeError("Generator is already executing.");for(;g;)try{if(c=1,d&&(e=2&i[0]?d.return:i[0]?d.throw||((e=d.return)&&e.call(d),0):d.next)&&!(e=e.call(d,i[1])).done)return e;switch(d=0,e&&(i=[2&i[0],e.value]),i[0]){case 0:case 1:e=i;break;case 4:return g.label++,{value:i[1],done:!1};case 5:g.label++,d=i[1],i=[0];continue;case 7:i=g.ops.pop(),g.trys.pop();continue;default:if(!(e=(e=g.trys).length>0&&e[e.length-1])&&(6===i[0]||2===i[0])){g=0;continue}if(3===i[0]&&(!e||i[1]>e[0]&&i[1]<e[3])){g.label=i[1];break}if(6===i[0]&&g.label<e[1]){g.label=e[1],e=i;break}if(e&&g.label<e[2]){g.label=e[2],g.ops.push(i);break}e[2]&&g.ops.pop(),g.trys.pop();continue}i=b.call(a,g)}catch(a){i=[6,a],d=0}finally{c=e=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}}}(this,function(b){switch(b.label){case 0:return this.disposed=!0,a=[],this.disposables.forEach(function(b){var c=b.dispose();c&&a.push(c)}),[4,Promise.all(a)];case 1:return b.sent(),[2]}})},new(c||(c=Promise))(function(e,f){function g(a){try{i(d.next(a))}catch(a){f(a)}}function h(a){try{i(d.throw(a))}catch(a){f(a)}}function i(a){var b;a.done?e(a.value):((b=a.value)instanceof c?b:new c(function(a){a(b)})).then(g,h)}i((d=d.apply(a,b||[])).next())})},a.prototype.getRegistration=function(a){return this.isRegistered(a)?this._registry.get(a):this.parent?this.parent.getRegistration(a):null},a.prototype.getAllRegistrations=function(a){return this.isRegistered(a)?this._registry.getAll(a):this.parent?this.parent.getAllRegistrations(a):null},a.prototype.construct=function(a,b){var c=this;if(a instanceof gB)return a.createProxy(function(a){return c.resolve(a,b)});var d=function(){var d=gM.get(a);if(!d||0===d.length)if(0===a.length)return new a;else throw Error('TypeInfo not known for "'+a.name+'"');var e=d.map(c.resolveParams(b,a));return new(a.bind.apply(a,gy([void 0],e)))}();return"function"!=typeof d.dispose||d.dispose.length>0||this.disposables.add(d),d},a.prototype.resolveParams=function(a,b){var c=this;return function(d,e){var f,g,h,i,j,k,l;try{if("object"==typeof d&&"token"in d&&"multiple"in d)if(gD(d))return d.multiple?(f=c.resolve(d.transform)).transform.apply(f,gy([c.resolveAll(d.token,new gI,d.isOptional)],d.transformArgs)):(g=c.resolve(d.transform)).transform.apply(g,gy([c.resolve(d.token,a,d.isOptional)],d.transformArgs));else return d.multiple?c.resolveAll(d.token,new gI,d.isOptional):c.resolve(d.token,a,d.isOptional);if(gD(d))return(h=c.resolve(d.transform,a)).transform.apply(h,gy([c.resolve(d.token,a)],d.transformArgs));return c.resolve(d,a)}catch(a){throw Error((k="Cannot inject the dependency "+(j=void 0===(i=gx(b.toString().match(/constructor\(([\w, ]+)\)/)||[],2)[1])?null:i,null===j?"at position #"+e:'"'+j.split(",")[e].trim()+'" at position #'+e)+' of "'+b.name+'" constructor. Reason:',void 0===l&&(l=" "),gy([k],a.message.split("\n").map(function(a){return l+a})).join("\n")))}}},a.prototype.ensureNotDisposed=function(){if(this.disposed)throw Error("This container has been disposed, you cannot interact with a disposed container")},a}());let gO=function(a){return function(b){var c,d;gM.set(b,(c=Reflect.getMetadata("design:paramtypes",b)||[],Object.keys(d=Reflect.getOwnMetadata("injectionTokens",b)||{}).forEach(function(a){c[+a]=d[a]}),c)),a&&a.token&&(Array.isArray(a.token)?a.token.forEach(function(a){gN.register(a,b)}):gN.register(a.token,b))}};if("u"<typeof Reflect||!Reflect.getMetadata)throw Error("tsyringe requires a reflect polyfill. Please add 'import \"reflect-metadata\"' to the top of your entry point.");class gP{constructor(a={}){this.attrId="",this.attrValues=[],Object.assign(a)}}c6([c0({type:x.ObjectIdentifier})],gP.prototype,"attrId",void 0),c6([c0({type:x.Any,repeated:"set"})],gP.prototype,"attrValues",void 0);let gQ=aj=class extends c4{constructor(a){super(a),Object.setPrototypeOf(this,aj.prototype)}};gQ=aj=c6([c_({type:w.Sequence,itemType:gP})],gQ);let gR=ak=class extends c4{constructor(a){super(a),Object.setPrototypeOf(this,ak.prototype)}};gR=ak=c6([c_({type:w.Sequence,itemType:fb})],gR);class gS{constructor(a={}){this.certId="",this.certValue=new ArrayBuffer(0),Object.assign(this,a)}}c6([c0({type:x.ObjectIdentifier})],gS.prototype,"certId",void 0),c6([c0({type:x.Any,context:0})],gS.prototype,"certValue",void 0);class gT{constructor(a={}){this.crlId="",this.crltValue=new ArrayBuffer(0),Object.assign(this,a)}}c6([c0({type:x.ObjectIdentifier})],gT.prototype,"crlId",void 0),c6([c0({type:x.Any,context:0})],gT.prototype,"crltValue",void 0);class gU extends cy{}class gV{constructor(a={}){this.encryptionAlgorithm=new eq,this.encryptedData=new gU,Object.assign(this,a)}}c6([c0({type:eq})],gV.prototype,"encryptionAlgorithm",void 0),c6([c0({type:gU})],gV.prototype,"encryptedData",void 0),(q=am||(am={}))[q.v1=0]="v1";class gW extends cy{}let gX=al=class extends c4{constructor(a){super(a),Object.setPrototypeOf(this,al.prototype)}};gX=al=c6([c_({type:w.Sequence,itemType:ei})],gX);class gY{constructor(a={}){this.version=am.v1,this.privateKeyAlgorithm=new eq,this.privateKey=new gW,Object.assign(this,a)}}c6([c0({type:x.Integer})],gY.prototype,"version",void 0),c6([c0({type:eq})],gY.prototype,"privateKeyAlgorithm",void 0),c6([c0({type:gW})],gY.prototype,"privateKey",void 0),c6([c0({type:gX,implicit:!0,context:0,optional:!0})],gY.prototype,"attributes",void 0);let gZ=class extends gY{};gZ=c6([c_({type:w.Sequence})],gZ);let g$=class extends gV{};g$=c6([c_({type:w.Sequence})],g$);class g_{constructor(a={}){this.secretTypeId="",this.secretValue=new ArrayBuffer(0),Object.assign(this,a)}}c6([c0({type:x.ObjectIdentifier})],g_.prototype,"secretTypeId",void 0),c6([c0({type:x.Any,context:0})],g_.prototype,"secretValue",void 0);class g0{constructor(a={}){this.mac=new go,this.macSalt=new cy,this.iterations=1,Object.assign(this,a)}}c6([c0({type:go})],g0.prototype,"mac",void 0),c6([c0({type:cy})],g0.prototype,"macSalt",void 0),c6([c0({type:x.Integer,defaultValue:1})],g0.prototype,"iterations",void 0);class g1{constructor(a={}){this.version=3,this.authSafe=new fb,this.macData=new g0,Object.assign(this,a)}}c6([c0({type:x.Integer})],g1.prototype,"version",void 0),c6([c0({type:fb})],g1.prototype,"authSafe",void 0),c6([c0({type:g0,optional:!0})],g1.prototype,"macData",void 0);class g2{constructor(a={}){this.bagId="",this.bagValue=new ArrayBuffer(0),Object.assign(this,a)}}c6([c0({type:x.ObjectIdentifier})],g2.prototype,"bagId",void 0),c6([c0({type:x.Any,context:0})],g2.prototype,"bagValue",void 0),c6([c0({type:gP,repeated:"set",optional:!0})],g2.prototype,"bagAttributes",void 0);let g3=an=class extends c4{constructor(a){super(a),Object.setPrototypeOf(this,an.prototype)}};g3=an=c6([c_({type:w.Sequence,itemType:g2})],g3);let g4="1.2.840.113549.1.9",g5=`${g4}.7`,g6=`${g4}.14`,g7=class extends da{constructor(a={}){super(a)}toString(){return({}).toString(),this.ia5String||super.toString()}};c6([c0({type:x.IA5String})],g7.prototype,"ia5String",void 0),g7=c6([c_({type:w.Choice})],g7);let g8=class extends fb{};g8=c6([c_({type:w.Sequence})],g8);let g9=class extends g1{};g9=c6([c_({type:w.Sequence})],g9);let ha=class extends gV{};ha=c6([c_({type:w.Sequence})],ha);let hb=class{constructor(a=""){this.value=a}toString(){return this.value}};c6([c0({type:x.IA5String})],hb.prototype,"value",void 0),hb=c6([c_({type:w.Choice})],hb);let hc=class extends g7{};hc=c6([c_({type:w.Choice})],hc);let hd=class extends da{};hd=c6([c_({type:w.Choice})],hd);let he=class{constructor(a=new Date){this.value=a}};c6([c0({type:x.GeneralizedTime})],he.prototype,"value",void 0),he=c6([c_({type:w.Choice})],he);let hf=class extends da{};hf=c6([c_({type:w.Choice})],hf);let hg=class{constructor(a="M"){this.value=a}toString(){return this.value}};c6([c0({type:x.PrintableString})],hg.prototype,"value",void 0),hg=c6([c_({type:w.Choice})],hg);let hh=class{constructor(a=""){this.value=a}toString(){return this.value}};c6([c0({type:x.PrintableString})],hh.prototype,"value",void 0),hh=c6([c_({type:w.Choice})],hh);let hi=class extends hh{};hi=c6([c_({type:w.Choice})],hi);let hj=class extends da{};hj=c6([c_({type:w.Choice})],hj);let hk=class{constructor(a=""){this.value=a}toString(){return this.value}};c6([c0({type:x.ObjectIdentifier})],hk.prototype,"value",void 0),hk=c6([c_({type:w.Choice})],hk);let hl=class extends es{};hl=c6([c_({type:w.Choice})],hl);let hm=class{constructor(a=0){this.value=a}toString(){return this.value.toString()}};c6([c0({type:x.Integer})],hm.prototype,"value",void 0),hm=c6([c_({type:w.Choice})],hm);let hn=class extends eK{};hn=c6([c_({type:w.Sequence})],hn);let ho=class extends da{};ho=c6([c_({type:w.Choice})],ho);let hp=ao=class extends ev{constructor(a){super(a),Object.setPrototypeOf(this,ao.prototype)}};hp=ao=c6([c_({type:w.Sequence})],hp);let hq=ap=class extends c4{constructor(a){super(a),Object.setPrototypeOf(this,ap.prototype)}};hq=ap=c6([c_({type:w.Set,itemType:eJ})],hq);let hr=class{constructor(a=""){this.value=a}toString(){return this.value}};c6([c0({type:x.BmpString})],hr.prototype,"value",void 0),hr=c6([c_({type:w.Choice})],hr);let hs=class extends eq{};hs=c6([c_({type:w.Sequence})],hs);let ht=aq=class extends c4{constructor(a){super(a),Object.setPrototypeOf(this,aq.prototype)}};ht=aq=c6([c_({type:w.Sequence,itemType:hs})],ht);let hu=ar=class extends c4{constructor(a){super(a),Object.setPrototypeOf(this,ar.prototype)}};hu=ar=c6([c_({type:w.Sequence,itemType:ei})],hu);class hv{constructor(a={}){this.version=0,this.subject=new df,this.subjectPKInfo=new er,this.attributes=new hu,Object.assign(this,a)}}c6([c0({type:x.Integer})],hv.prototype,"version",void 0),c6([c0({type:df})],hv.prototype,"subject",void 0),c6([c0({type:er})],hv.prototype,"subjectPKInfo",void 0),c6([c0({type:hu,implicit:!0,context:0,optional:!0})],hv.prototype,"attributes",void 0);class hw{constructor(a={}){this.certificationRequestInfo=new hv,this.signatureAlgorithm=new eq,this.signature=new ArrayBuffer(0),Object.assign(this,a)}}c6([c0({type:hv,raw:!0})],hw.prototype,"certificationRequestInfo",void 0),c6([c0({type:eq})],hw.prototype,"signatureAlgorithm",void 0),c6([c0({type:x.BitString})],hw.prototype,"signature",void 0);let hx="crypto.algorithm";class hy{getAlgorithms(){return gN.resolveAll(hx)}toAsnAlgorithm(a){for(let b of({...a},this.getAlgorithms())){let c=b.toAsnAlgorithm(a);if(c)return c}if(/^[0-9.]+$/.test(a.name)){let b=new eq({algorithm:a.name});return"parameters"in a&&(b.parameters=a.parameters),b}throw Error("Cannot convert WebCrypto algorithm to ASN.1 algorithm")}toWebAlgorithm(a){for(let b of this.getAlgorithms()){let c=b.toWebAlgorithm(a);if(c)return c}return{name:a.algorithm,parameters:a.parameters}}}let hz="crypto.algorithmProvider";gN.registerSingleton(hz,hy);let hA="1.3.36.3.3.2.8.1.1",hB=`${hA}.1`,hC=`${hA}.2`,hD=`${hA}.3`,hE=`${hA}.4`,hF=`${hA}.5`,hG=`${hA}.6`,hH=`${hA}.7`,hI=`${hA}.8`,hJ=`${hA}.9`,hK=`${hA}.10`,hL=`${hA}.11`,hM=`${hA}.12`,hN=`${hA}.13`,hO=`${hA}.14`,hP="brainpoolP160r1",hQ="brainpoolP160t1",hR="brainpoolP192r1",hS="brainpoolP192t1",hT="brainpoolP224r1",hU="brainpoolP224t1",hV="brainpoolP256r1",hW="brainpoolP256t1",hX="brainpoolP320r1",hY="brainpoolP320t1",hZ="brainpoolP384r1",h$="brainpoolP384t1",h_="brainpoolP512r1",h0="brainpoolP512t1",h1="ECDSA",h2=as=class{toAsnAlgorithm(a){if(a.name.toLowerCase()===h1.toLowerCase()){if("hash"in a)switch(("string"==typeof a.hash?a.hash:a.hash.name).toLowerCase()){case"sha-1":return fP;case"sha-256":return fQ;case"sha-384":return fR;case"sha-512":return fS}else if("namedCurve"in a){let b="";switch(a.namedCurve){case"P-256":b=fL;break;case"K-256":b=as.SECP256K1;break;case"P-384":b=fM;break;case"P-521":b=fN;break;case hP:b=hB;break;case hQ:b=hC;break;case hR:b=hD;break;case hS:b=hE;break;case hT:b=hF;break;case hU:b=hG;break;case hV:b=hH;break;case hW:b=hI;break;case hX:b=hJ;break;case hY:b=hK;break;case hZ:b=hL;break;case h$:b=hM;break;case h_:b=hN;break;case h0:b=hO}if(b)return new eq({algorithm:fF,parameters:c5.serialize(new fX({namedCurve:b}))})}}return null}toWebAlgorithm(a){switch(a.algorithm){case fG:return{name:h1,hash:{name:"SHA-1"}};case fI:return{name:h1,hash:{name:"SHA-256"}};case fJ:return{name:h1,hash:{name:"SHA-384"}};case fK:return{name:h1,hash:{name:"SHA-512"}};case fF:if(!a.parameters)throw TypeError("Cannot get required parameters from EC algorithm");switch(c5.parse(a.parameters,fX).namedCurve){case fL:return{name:h1,namedCurve:"P-256"};case as.SECP256K1:return{name:h1,namedCurve:"K-256"};case fM:return{name:h1,namedCurve:"P-384"};case fN:return{name:h1,namedCurve:"P-521"};case hB:return{name:h1,namedCurve:hP};case hC:return{name:h1,namedCurve:hQ};case hD:return{name:h1,namedCurve:hR};case hE:return{name:h1,namedCurve:hS};case hF:return{name:h1,namedCurve:hT};case hG:return{name:h1,namedCurve:hU};case hH:return{name:h1,namedCurve:hV};case hI:return{name:h1,namedCurve:hW};case hJ:return{name:h1,namedCurve:hX};case hK:return{name:h1,namedCurve:hY};case hL:return{name:h1,namedCurve:hZ};case hM:return{name:h1,namedCurve:h$};case hN:return{name:h1,namedCurve:h_};case hO:return{name:h1,namedCurve:h0}}}return null}};h2.SECP256K1="1.3.132.0.10",h2=as=c6([gO()],h2),gN.registerSingleton(hx,h2);let h3=Symbol("name"),h4=Symbol("value");class h5{constructor(a,b={},c=""){for(const d in this[h3]=a,this[h4]=c,b)this[d]=b[d]}}h5.NAME=h3,h5.VALUE=h4;class h6{static toTextObject(a){let b=new h5("Algorithm Identifier",{},h7.toString(a.algorithm));if(a.parameters)if(a.algorithm===fF){let c=new h2().toWebAlgorithm(a);c&&"namedCurve"in c?b["Named Curve"]=c.namedCurve:b.Parameters=a.parameters}else b.Parameters=a.parameters;return b}}class h7{static toString(a){let b=this.items[a];return b||a}}h7.items={[gc]:"sha1",[gd]:"sha224",[ge]:"sha256",[gf]:"sha384",[gg]:"sha512",[f_]:"rsaEncryption",[f5]:"sha1WithRSAEncryption",[f6]:"sha224WithRSAEncryption",[f7]:"sha256WithRSAEncryption",[f8]:"sha384WithRSAEncryption",[f9]:"sha512WithRSAEncryption",[fF]:"ecPublicKey",[fG]:"ecdsaWithSHA1",[fH]:"ecdsaWithSHA224",[fI]:"ecdsaWithSHA256",[fJ]:"ecdsaWithSHA384",[fK]:"ecdsaWithSHA512",[dZ]:"TLS WWW server authentication",[d$]:"TLS WWW client authentication",[d_]:"Code Signing",[d0]:"E-mail Protection",[d1]:"Time Stamping",[d2]:"OCSP Signing",[fC]:"Signed Data"};class h8{static serialize(a){return this.serializeObj(a).join("\n")}static pad(a=0){return"".padStart(2*a," ")}static serializeObj(a,b=0){let c=[],d=this.pad(b++),e="",f=a[h5.VALUE];for(let g in f&&(e=` ${f}`),c.push(`${d}${a[h5.NAME]}:${e}`),d=this.pad(b),a){if("symbol"==typeof g)continue;let e=a[g],f=g?`${g}: `:"";if("string"==typeof e||"number"==typeof e||"boolean"==typeof e)c.push(`${d}${f}${e}`);else if(e instanceof Date)c.push(`${d}${f}${e.toUTCString()}`);else if(Array.isArray(e))for(let a of e)a[h5.NAME]=g,c.push(...this.serializeObj(a,b));else if(e instanceof h5)e[h5.NAME]=g,c.push(...this.serializeObj(e,b));else if(a4.isBufferSource(e))g?(c.push(`${d}${f}`),c.push(...this.serializeBufferSource(e,b+1))):c.push(...this.serializeBufferSource(e,b));else if("toTextObject"in e){let a=e.toTextObject();a[h5.NAME]=g,c.push(...this.serializeObj(a,b))}else throw TypeError("Cannot serialize data in text format. Unsupported type.")}return c}static serializeBufferSource(a,b=0){let c=this.pad(b),d=a4.toUint8Array(a),e=[];for(let a=0;a<d.length;){let b=[];for(let c=0;c<16&&a<d.length;c++){8===c&&b.push("");let e=d[a++].toString(16).padStart(2,"0");b.push(e)}e.push(`${c}${b.join(" ")}`)}return e}static serializeAlgorithm(a){return this.algorithmSerializer.toTextObject(a)}}h8.oidSerializer=h7,h8.algorithmSerializer=h6;class h9{get rawData(){return c7(this,at,"f")||c8(this,at,c5.serialize(this.asn),"f"),c7(this,at,"f")}constructor(...a){at.set(this,void 0),a4.isBufferSource(a[0])?(this.asn=c5.parse(a[0],a[1]),c8(this,at,a4.toArrayBuffer(a[0]),"f")):this.asn=a[0],this.onInit(this.asn)}equal(a){return a instanceof h9&&bc(a.rawData,this.rawData)}toString(a="text"){switch(a){case"asn":return c5.toString(this.rawData);case"text":return h8.serialize(this.toTextObject());case"hex":return bb.ToHex(this.rawData);case"base64":return bb.ToBase64(this.rawData);case"base64url":return bb.ToBase64Url(this.rawData);default:throw TypeError("Argument 'format' is unsupported value")}}getTextName(){return this.constructor.NAME}toTextObject(){let a=this.toTextObjectEmpty();return a[""]=this.rawData,a}toTextObjectEmpty(a){return new h5(this.getTextName(),{},a)}}at=new WeakMap,h9.NAME="ASN";class ia extends h9{constructor(...a){super(a4.isBufferSource(a[0])?a4.toArrayBuffer(a[0]):c5.serialize(new eu({extnID:a[0],critical:a[1],extnValue:new cy(a4.toArrayBuffer(a[2]))})),eu)}onInit(a){this.type=a.extnID,this.critical=a.critical,this.value=a.extnValue.buffer}toTextObject(){let a=this.toTextObjectWithoutValue();return a[""]=this.value,a}toTextObjectWithoutValue(){let a=this.toTextObjectEmpty(this.critical?"critical":void 0);return a[h5.NAME]===ia.NAME&&(a[h5.NAME]=h7.toString(this.type)),a}}class ib{static isCryptoKeyPair(a){return a&&a.privateKey&&a.publicKey}static isCryptoKey(a){return a&&a.usages&&a.type&&a.algorithm&&void 0!==a.extractable}constructor(){this.items=new Map,this[au]="CryptoProvider","u">typeof self&&"u">typeof crypto?this.set(ib.DEFAULT,crypto):"u">typeof global&&global.crypto&&global.crypto.subtle&&this.set(ib.DEFAULT,global.crypto)}clear(){this.items.clear()}delete(a){return this.items.delete(a)}forEach(a,b){return this.items.forEach(a,b)}has(a){return this.items.has(a)}get size(){return this.items.size}entries(){return this.items.entries()}keys(){return this.items.keys()}values(){return this.items.values()}[Symbol.iterator](){return this.items[Symbol.iterator]()}get(a=ib.DEFAULT){let b=this.items.get(a.toLowerCase());if(!b)throw Error(`Cannot get Crypto by name '${a}'`);return b}set(a,b){if("string"==typeof a){if(!b)throw TypeError("Argument 'value' is required");this.items.set(a.toLowerCase(),b)}else this.items.set(ib.DEFAULT,a);return this}}au=Symbol.toStringTag,ib.DEFAULT="default";let ic=new ib,id=/^[0-2](?:\.[1-9][0-9]*)+$/;class ie{constructor(a={}){for(const b in this.items={},a)this.register(b,a[b])}get(a){return this.items[a]||null}findId(a){return new RegExp(id).test(a)?a:this.get(a)}register(a,b){this.items[a]=b,this.items[b]=a}}let ig=new ie;function ih(a,b){return`\\${bb.ToHex(bb.FromUtf8String(b)).toUpperCase()}`}ig.register("CN","2.5.4.3"),ig.register("L","2.5.4.7"),ig.register("ST","2.5.4.8"),ig.register("O","2.5.4.10"),ig.register("OU","2.5.4.11"),ig.register("C","2.5.4.6"),ig.register("DC","0.9.2342.19200300.100.1.25"),ig.register("E","1.2.840.113549.1.9.1"),ig.register("G","2.5.4.42"),ig.register("I","2.5.4.43"),ig.register("SN","2.5.4.4"),ig.register("T","2.5.4.12");class ii{static isASCII(a){for(let b=0;b<a.length;b++)if(a.charCodeAt(b)>255)return!1;return!0}static isPrintableString(a){return/^[A-Za-z0-9 '()+,-./:=?]*$/g.test(a)}constructor(a,b={}){for(const a in this.extraNames=new ie,this.asn=new df,b)if(Object.prototype.hasOwnProperty.call(b,a)){const c=b[a];this.extraNames.register(a,c)}"string"==typeof a?this.asn=this.fromString(a):a instanceof df?this.asn=a:a4.isBufferSource(a)?this.asn=c5.parse(a,df):this.asn=this.fromJSON(a)}getField(a){let b=this.extraNames.findId(a)||ig.findId(a),c=[];for(let a of this.asn)for(let d of a)d.type===b&&c.push(d.value.toString());return c}getName(a){return this.extraNames.get(a)||ig.get(a)}toString(){return this.asn.map(a=>a.map(a=>{let b=this.getName(a.type)||a.type,c=a.value.anyValue?`#${bb.ToHex(a.value.anyValue)}`:a.value.toString().replace(/([,+"\\<>;])/g,"\\$1").replace(/^([ #])/,"\\$1").replace(/([ ]$)/,"\\$1").replace(/([\r\n\t])/,ih);return`${b}=${c}`}).join("+")).join(", ")}toJSON(){let a=[];for(let b of this.asn){let c={};for(let a of b){let b=this.getName(a.type)||a.type;null!=c[b]||(c[b]=[]),c[b].push(a.value.anyValue?`#${bb.ToHex(a.value.anyValue)}`:a.value.toString())}a.push(c)}return a}fromString(a){let b=new df,c=/(\d\.[\d.]*\d|[A-Za-z]+)=((?:"")|(?:".*?[^\\]")|(?:[^,+"\\](?=[,+]|$))|(?:[^,+].*?(?:[^\\][,+]))|(?:))([,+])?/g,d=null,e=",";for(;d=c.exec(`${a},`);){let[,a,c]=d,f=c[c.length-1];(","===f||"+"===f)&&(c=c.slice(0,c.length-1),d[3]=f);let g=d[3];a=this.getTypeOid(a);let h=this.createAttribute(a,c);"+"===e?b[b.length-1].push(h):b.push(new dd([h])),e=g}return b}fromJSON(a){let b=new df;for(let c of a){let a=new dd;for(let b in c){let d=this.getTypeOid(b);for(let e of c[b]){let b=this.createAttribute(d,e);a.push(b)}}b.push(a)}return b}getTypeOid(a){if(/[\d.]+/.test(a)||(a=this.getName(a)||""),!a)throw Error(`Cannot get OID for name type '${a}'`);return a}createAttribute(a,b){let c=new dc({type:a});if("object"==typeof b)for(let a in b)switch(a){case"ia5String":c.value.ia5String=b[a];break;case"utf8String":c.value.utf8String=b[a];break;case"universalString":c.value.universalString=b[a];break;case"bmpString":c.value.bmpString=b[a];break;case"printableString":c.value.printableString=b[a]}else if("#"===b[0])c.value.anyValue=bb.FromHex(b.slice(1));else{let d=this.processStringValue(b);a===this.getName("E")||a===this.getName("DC")?c.value.ia5String=d:ii.isPrintableString(d)?c.value.printableString=d:c.value.utf8String=d}return c}processStringValue(a){let b=/"(.*?[^\\])?"/.exec(a);return b&&(a=b[1]),a.replace(/\\0a/ig,"\n").replace(/\\0d/ig,"\r").replace(/\\0g/ig," ").replace(/\\(.)/g,"$1")}toArrayBuffer(){return c5.serialize(this.asn)}async getThumbprint(...a){var b;let c,d="SHA-1";return!(a.length>=1)||(null==(b=a[0])?void 0:b.subtle)?c=a[0]||ic.get():(d=a[0]||d,c=a[1]||ic.get()),await c.subtle.digest(d,this.toArrayBuffer())}}let ij="Cannot initialize GeneralName from ASN.1 data.",ik=`${ij} Unsupported string format in use.`,il=`${ij} Value doesn't match to GUID regular expression.`,im=/^([0-9a-f]{8})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{12})$/i,io="1.3.6.1.4.1.311.25.1",ip="1.3.6.1.4.1.311.20.2.3",iq="dns",ir="dn",is="email",it="ip",iu="url",iv="guid",iw="upn",ix="id";class iy extends h9{constructor(...a){let b;if(2===a.length)switch(a[0]){case ir:{const c=new ii(a[1]).toArrayBuffer(),d=c5.parse(c,df);b=new di({directoryName:d});break}case iq:b=new di({dNSName:a[1]});break;case is:b=new di({rfc822Name:a[1]});break;case iv:{const c=RegExp(im,"i").exec(a[1]);if(!c)throw Error("Cannot parse GUID value. Value doesn't match to regular expression");const d=c.slice(1).map((a,b)=>b<3?bb.ToHex(new Uint8Array(bb.FromHex(a)).reverse()):a).join("");b=new di({otherName:new dg({typeId:io,value:c5.serialize(new cy(bb.FromHex(d)))})});break}case it:b=new di({iPAddress:a[1]});break;case ix:b=new di({registeredID:a[1]});break;case iw:b=new di({otherName:new dg({typeId:ip,value:c5.serialize(cI.toASN(a[1]))})});break;case iu:b=new di({uniformResourceIdentifier:a[1]});break;default:throw Error("Cannot create GeneralName. Unsupported type of the name")}else b=a4.isBufferSource(a[0])?c5.parse(a[0],di):a[0];super(b)}onInit(a){if(void 0!=a.dNSName)this.type=iq,this.value=a.dNSName;else if(void 0!=a.rfc822Name)this.type=is,this.value=a.rfc822Name;else if(void 0!=a.iPAddress)this.type=it,this.value=a.iPAddress;else if(void 0!=a.uniformResourceIdentifier)this.type=iu,this.value=a.uniformResourceIdentifier;else if(void 0!=a.registeredID)this.type=ix,this.value=a.registeredID;else if(void 0!=a.directoryName)this.type=ir,this.value=new ii(a.directoryName).toString();else if(void 0!=a.otherName)if(a.otherName.typeId===io){this.type=iv;let b=c5.parse(a.otherName.value,cy),c=RegExp(im,"i").exec(bb.ToHex(b));if(!c)throw Error(il);this.value=c.slice(1).map((a,b)=>b<3?bb.ToHex(new Uint8Array(bb.FromHex(a)).reverse()):a).join("-")}else if(a.otherName.typeId===ip)this.type=iw,this.value=c5.parse(a.otherName.value,da).toString();else throw Error(ik);else throw Error(ik)}toJSON(){return{type:this.type,value:this.value}}toTextObject(){let a;switch(this.type){case ir:case iq:case iv:case it:case ix:case iw:case iu:a=this.type.toUpperCase();break;case is:a="Email";break;default:throw Error("Unsupported GeneralName type")}let b=this.value;return this.type===ix&&(b=h7.toString(b)),new h5(a,void 0,b)}}class iz extends h9{constructor(a){let b;if(a instanceof dB)b=a;else if(Array.isArray(a)){const c=[];for(const b of a)if(b instanceof di)c.push(b);else{const a=c5.parse(new iy(b.type,b.value).rawData,di);c.push(a)}b=new dB(c)}else if(a4.isBufferSource(a))b=c5.parse(a,dB);else throw Error("Cannot initialize GeneralNames. Incorrect incoming arguments");super(b)}onInit(a){let b=[];for(let c of a){let a=null;try{a=new iy(c)}catch{continue}b.push(a)}this.items=b}toJSON(){return this.items.map(a=>a.toJSON())}toTextObject(){let a=super.toTextObjectEmpty();for(let b of this.items){let c=b.toTextObject(),d=a[c[h5.NAME]];Array.isArray(d)||(d=[],a[c[h5.NAME]]=d),d.push(c)}return a}}iz.NAME="GeneralNames";let iA="-{5}",iB=`[^\\n]+`,iC=`${iA}BEGIN (${iB}(?=${iA}))${iA}`,iD=`${iA}END \\1${iA}`,iE=`[^:\\n]+`,iF=`(?:[^\\n]+\\n(?: +[^\\n]+\\n)*)`,iG=`(?:[a-zA-Z0-9=+/]+\\n)+`,iH=`${iC}\\n(?:((?:${iE}: ${iF})+))?\\n?(${iG})${iD}`;class iI{static isPem(a){return"string"==typeof a&&RegExp(iH,"g").test(a.replace(/\r/g,""))}static decodeWithHeaders(a){a=a.replace(/\r/g,"");let b=RegExp(iH,"g"),c=[],d=null;for(;d=b.exec(a);){let a=d[3].replace(RegExp(`[\\n]+`,"g"),""),b={type:d[1],headers:[],rawData:bb.FromBase64(a)},e=d[2];if(e){let a=e.split(RegExp("\\n","g")),c=null;for(let d of a){let[a,e]=d.split(/:(.*)/);if(void 0===e){if(!c)throw Error("Cannot parse PEM string. Incorrect header value");c.value+=a.trim()}else c&&b.headers.push(c),c={key:a,value:e.trim()}}c&&b.headers.push(c)}c.push(b)}return c}static decode(a){return this.decodeWithHeaders(a).map(a=>a.rawData)}static decodeFirst(a){let b=this.decode(a);if(!b.length)throw RangeError("PEM string doesn't contain any objects");return b[0]}static encode(a,b){if(Array.isArray(a)){let c=[];return b?a.forEach(a=>{if(!a4.isBufferSource(a))throw TypeError("Cannot encode array of BufferSource in PEM format. Not all items of the array are BufferSource");c.push(this.encodeStruct({type:b,rawData:a4.toArrayBuffer(a)}))}):a.forEach(a=>{if(!("type"in a))throw TypeError("Cannot encode array of PemStruct in PEM format. Not all items of the array are PemStrut");c.push(this.encodeStruct(a))}),c.join("\n")}if(!b)throw Error("Required argument 'tag' is missed");return this.encodeStruct({type:b,rawData:a4.toArrayBuffer(a)})}static encodeStruct(a){var b;let c,d=a.type.toLocaleUpperCase(),e=[];if(e.push(`-----BEGIN ${d}-----`),null==(b=a.headers)?void 0:b.length){for(let b of a.headers)e.push(`${b.key}: ${b.value}`);e.push("")}let f=bb.ToBase64(a.rawData),g=0,h=[];for(;g<f.length;)if(f.length-g<64?c=f.substring(g):(c=f.substring(g,g+64),g+=64),0!==c.length){if(h.push(c),c.length<64)break}else break;return e.push(...h),e.push(`-----END ${d}-----`),e.join("\n")}}iI.CertificateTag="CERTIFICATE",iI.CrlTag="CRL",iI.CertificateRequestTag="CERTIFICATE REQUEST",iI.PublicKeyTag="PUBLIC KEY",iI.PrivateKeyTag="PRIVATE KEY";class iJ extends h9{static isAsnEncoded(a){return a4.isBufferSource(a)||"string"==typeof a}static toArrayBuffer(a){if("string"==typeof a)if(iI.isPem(a))return iI.decode(a)[0];else if(bb.isHex(a))return bb.FromHex(a);else if(bb.isBase64(a))return bb.FromBase64(a);else if(bb.isBase64Url(a))return bb.FromBase64Url(a);else throw TypeError("Unsupported format of 'raw' argument. Must be one of DER, PEM, HEX, Base64, or Base4Url");{let b=a4.toUint8Array(a);if(b.length>0&&48===b[0])return a4.toArrayBuffer(a);let c=bb.ToBinary(a);if(iI.isPem(c))return iI.decode(c)[0];if(bb.isHex(c))return bb.FromHex(c);if(bb.isBase64(c))return bb.FromBase64(c);else if(bb.isBase64Url(c))return bb.FromBase64Url(c);throw TypeError("Unsupported format of 'raw' argument. Must be one of DER, PEM, HEX, Base64, or Base4Url")}}constructor(...a){iJ.isAsnEncoded(a[0])?super(iJ.toArrayBuffer(a[0]),a[1]):super(a[0])}toString(a="pem"){return"pem"===a?iI.encode(this.rawData,this.tag):super.toString(a)}}class iK extends iJ{static async create(a,b=ic.get()){if(a instanceof iK)return a;if(ib.isCryptoKey(a)){if("public"!==a.type)throw TypeError("Public key is required");return new iK(await b.subtle.exportKey("spki",a))}if(a.publicKey)return a.publicKey;if(a4.isBufferSource(a))return new iK(a);throw TypeError("Unsupported PublicKeyType")}constructor(a){iJ.isAsnEncoded(a)?super(a,er):super(a),this.tag=iI.PublicKeyTag}async export(...a){var b;let c,d=["verify"],e={hash:"SHA-256",...this.algorithm};a.length>1?(e=a[0]||e,d=a[1]||d,c=a[2]||ic.get()):c=a[0]||ic.get();let f=this.rawData,g=c5.parse(this.rawData,er);return g.algorithm.algorithm===f2&&(b=g,b.algorithm=new eq({algorithm:f_,parameters:null}),f=c5.serialize(b)),c.subtle.importKey("spki",f,e,!0,d)}onInit(a){let b=gN.resolve(hz),c=this.algorithm=b.toWebAlgorithm(a.algorithm);if(a.algorithm.algorithm===f_){let b=c5.parse(a.subjectPublicKey,gs),d=a4.toUint8Array(b.modulus);c.publicExponent=a4.toUint8Array(b.publicExponent),c.modulusLength=(!d[0]?d.slice(1):d).byteLength<<3}}async getThumbprint(...a){var b;let c,d="SHA-1";return!(a.length>=1)||(null==(b=a[0])?void 0:b.subtle)?c=a[0]||ic.get():(d=a[0]||d,c=a[1]||ic.get()),await c.subtle.digest(d,this.rawData)}async getKeyIdentifier(...a){let b,c="SHA-1";1===a.length?"string"==typeof a[0]?(c=a[0],b=ic.get()):b=a[0]:2===a.length?(c=a[0],b=a[1]):b=ic.get();let d=c5.parse(this.rawData,er);return await b.subtle.digest(c,d.subjectPublicKey)}toTextObject(){let a=this.toTextObjectEmpty(),b=c5.parse(this.rawData,er);return a.Algorithm=h8.serializeAlgorithm(b.algorithm),b.algorithm.algorithm===fF?a["EC Point"]=b.subjectPublicKey:a["Raw Data"]=b.subjectPublicKey,a}}class iL extends ia{static async create(a,b=!1,c=ic.get()){if("name"in a&&"serialNumber"in a)return new iL(a,b);let d=await iK.create(a,c),e=await d.getKeyIdentifier(c);return new iL(bb.ToHex(e),b)}constructor(...a){if(a4.isBufferSource(a[0]))super(a[0]);else if("string"==typeof a[0]){const b=new dy({keyIdentifier:new dx(bb.FromHex(a[0]))});super(dw,a[1],c5.serialize(b))}else{const b=a[0],c=new dy({authorityCertIssuer:b.name instanceof iz?c5.parse(b.name.rawData,dB):b.name,authorityCertSerialNumber:bb.FromHex(b.serialNumber)});super(dw,a[1],c5.serialize(c))}}onInit(a){super.onInit(a);let b=c5.parse(a.extnValue,dy);b.keyIdentifier&&(this.keyId=bb.ToHex(b.keyIdentifier)),(b.authorityCertIssuer||b.authorityCertSerialNumber)&&(this.certId={name:b.authorityCertIssuer||[],serialNumber:b.authorityCertSerialNumber?bb.ToHex(b.authorityCertSerialNumber):""})}toTextObject(){let a=this.toTextObjectWithoutValue(),b=c5.parse(this.value,dy);return b.authorityCertIssuer&&(a["Authority Issuer"]=new iz(b.authorityCertIssuer).toTextObject()),b.authorityCertSerialNumber&&(a["Authority Serial Number"]=b.authorityCertSerialNumber),b.keyIdentifier&&(a[""]=b.keyIdentifier),a}}iL.NAME="Authority Key Identifier";class iM extends ia{constructor(...a){if(a4.isBufferSource(a[0])){super(a[0]);const b=c5.parse(this.value,dA);this.ca=b.cA,this.pathLength=b.pathLenConstraint}else{const b=new dA({cA:a[0],pathLenConstraint:a[1]});super(dz,a[2],c5.serialize(b)),this.ca=a[0],this.pathLength=a[1]}}toTextObject(){let a=this.toTextObjectWithoutValue();return this.ca&&(a.CA=this.ca),void 0!==this.pathLength&&(a["Path Length"]=this.pathLength),a}}iM.NAME="Basic Constraints",(r=av||(av={})).serverAuth="1.3.6.1.5.5.7.3.1",r.clientAuth="1.3.6.1.5.5.7.3.2",r.codeSigning="1.3.6.1.5.5.7.3.3",r.emailProtection="1.3.6.1.5.5.7.3.4",r.timeStamping="1.3.6.1.5.5.7.3.8",r.ocspSigning="1.3.6.1.5.5.7.3.9";class iN extends ia{constructor(...a){if(a4.isBufferSource(a[0])){super(a[0]);const b=c5.parse(this.value,dY);this.usages=b.map(a=>a)}else{const b=new dY(a[0]);super(dX,a[1],c5.serialize(b)),this.usages=a[0]}}toTextObject(){let a=this.toTextObjectWithoutValue();return a[""]=this.usages.map(a=>h7.toString(a)).join(", "),a}}iN.NAME="Extended Key Usages",(s=aw||(aw={}))[s.digitalSignature=1]="digitalSignature",s[s.nonRepudiation=2]="nonRepudiation",s[s.keyEncipherment=4]="keyEncipherment",s[s.dataEncipherment=8]="dataEncipherment",s[s.keyAgreement=16]="keyAgreement",s[s.keyCertSign=32]="keyCertSign",s[s.cRLSign=64]="cRLSign",s[s.encipherOnly=128]="encipherOnly",s[s.decipherOnly=256]="decipherOnly";class iO extends ia{constructor(...a){if(a4.isBufferSource(a[0])){super(a[0]);const b=c5.parse(this.value,d9);this.usages=b.toNumber()}else{const b=new d9(a[0]);super(d8,a[1],c5.serialize(b)),this.usages=a[0]}}toTextObject(){let a=this.toTextObjectWithoutValue(),b=c5.parse(this.value,d9);return a[""]=b.toJSON().join(", "),a}}iO.NAME="Key Usages";class iP extends ia{static async create(a,b=!1,c=ic.get()){let d=await iK.create(a,c),e=await d.getKeyIdentifier(c);return new iP(bb.ToHex(e),b)}constructor(...a){if(a4.isBufferSource(a[0])){super(a[0]);const b=c5.parse(this.value,el);this.keyId=bb.ToHex(b)}else{const b="string"==typeof a[0]?bb.FromHex(a[0]):a[0],c=new el(b);super(ek,a[1],c5.serialize(c)),this.keyId=bb.ToHex(b)}}toTextObject(){let a=this.toTextObjectWithoutValue(),b=c5.parse(this.value,el);return a[""]=b,a}}iP.NAME="Subject Key Identifier";class iQ extends ia{constructor(...a){a4.isBufferSource(a[0])?super(a[0]):super(eg,a[1],new iz(a[0]||[]).rawData)}onInit(a){super.onInit(a);let b=c5.parse(a.extnValue,eh);this.names=new iz(b)}toTextObject(){let a=this.toTextObjectWithoutValue(),b=this.names.toTextObject();for(let c in b)a[c]=b[c];return a}}iQ.NAME="Subject Alternative Name";class iR{static register(a,b){this.items.set(a,b)}static create(a){let b=new ia(a),c=this.items.get(b.type);return c?new c(a):b}}iR.items=new Map;class iS extends ia{constructor(...a){var b;if(a4.isBufferSource(a[0])){super(a[0]);const b=c5.parse(this.value,dL);this.policies=b.map(a=>a.policyIdentifier)}else{const c=a[0],d=null!=(b=a[1])&&b,e=new dL(c.map(a=>new dK({policyIdentifier:a})));super(dE,d,c5.serialize(e)),this.policies=c}}toTextObject(){let a=this.toTextObjectWithoutValue();return a.Policy=this.policies.map(a=>new h5("",{},h7.toString(a))),a}}iS.NAME="Certificate Policies",iR.register(dE,iS);class iT extends ia{constructor(...a){if(a4.isBufferSource(a[0]))super(a[0]);else if(Array.isArray(a[0])&&"string"==typeof a[0][0]){const b=a[0].map(a=>new dR({distributionPoint:new dQ({fullName:[new di({uniformResourceIdentifier:a})]})})),c=new dS(b);super(dO,a[1],c5.serialize(c))}else{const b=new dS(a[0]);super(dO,a[1],c5.serialize(b))}null!=this.distributionPoints||(this.distributionPoints=[])}onInit(a){super.onInit(a);let b=c5.parse(a.extnValue,dS);this.distributionPoints=b}toTextObject(){let a=this.toTextObjectWithoutValue();return a["Distribution Point"]=this.distributionPoints.map(a=>{var b;let c={};return a.distributionPoint&&(c[""]=null==(b=a.distributionPoint.fullName)?void 0:b.map(a=>new iy(a).toString()).join(", ")),a.reasons&&(c.Reasons=a.reasons.toString()),a.cRLIssuer&&(c["CRL Issuer"]=a.cRLIssuer.map(a=>a.toString()).join(", ")),c}),a}}iT.NAME="CRL Distribution Points";class iU extends ia{constructor(...a){if(a4.isBufferSource(a[0]))super(a[0]);else if(a[0]instanceof dv){const b=new dv(a[0]);super(dt,a[1],c5.serialize(b))}else{const b=a[0],c=new dv;iW(c,b,dn,"ocsp"),iW(c,b,dp,"caIssuers"),iW(c,b,dq,"timeStamping"),iW(c,b,dr,"caRepository"),super(dt,a[1],c5.serialize(c))}null!=this.ocsp||(this.ocsp=[]),null!=this.caIssuers||(this.caIssuers=[]),null!=this.timeStamping||(this.timeStamping=[]),null!=this.caRepository||(this.caRepository=[])}onInit(a){super.onInit(a),this.ocsp=[],this.caIssuers=[],this.timeStamping=[],this.caRepository=[],c5.parse(a.extnValue,dv).forEach(a=>{switch(a.accessMethod){case dn:this.ocsp.push(new iy(a.accessLocation));break;case dp:this.caIssuers.push(new iy(a.accessLocation));break;case dq:this.timeStamping.push(new iy(a.accessLocation));break;case dr:this.caRepository.push(new iy(a.accessLocation))}})}toTextObject(){let a=this.toTextObjectWithoutValue();return this.ocsp.length&&iV(a,"OCSP",this.ocsp),this.caIssuers.length&&iV(a,"CA Issuers",this.caIssuers),this.timeStamping.length&&iV(a,"Time Stamping",this.timeStamping),this.caRepository.length&&iV(a,"CA Repository",this.caRepository),a}}function iV(a,b,c){if(1===c.length)a[b]=c[0].toTextObject();else{let d=new h5("");c.forEach((a,b)=>{let c=a.toTextObject(),e=`${c[h5.NAME]} ${b+1}`,f=d[e];Array.isArray(f)||(f=[],d[e]=f),f.push(c)}),a[b]=d}}function iW(a,b,c,d){let e=b[d];e&&(Array.isArray(e)?e:[e]).forEach(b=>{"string"==typeof b&&(b=new iy("url",b)),a.push(new du({accessMethod:c,accessLocation:c5.parse(b.rawData,di)}))})}iU.NAME="Authority Info Access";class iX extends ia{constructor(...a){a4.isBufferSource(a[0])?super(a[0]):super(d6,a[1],new iz(a[0]||[]).rawData)}onInit(a){super.onInit(a);let b=c5.parse(a.extnValue,dB);this.names=new iz(b)}toTextObject(){let a=this.toTextObjectWithoutValue(),b=this.names.toTextObject();for(let c in b)a[c]=b[c];return a}}iX.NAME="Issuer Alternative Name";class iY extends h9{constructor(...a){let b;if(a4.isBufferSource(a[0]))b=a4.toArrayBuffer(a[0]);else{const c=a[0],d=Array.isArray(a[1])?a[1].map(a=>a4.toArrayBuffer(a)):[];b=c5.serialize(new ei({type:c,values:d}))}super(b,ei)}onInit(a){this.type=a.type,this.values=a.values}toTextObject(){let a=this.toTextObjectWithoutValue();return a.Value=this.values.map(a=>new h5("",{"":a})),a}toTextObjectWithoutValue(){let a=this.toTextObjectEmpty();return a[h5.NAME]===iY.NAME&&(a[h5.NAME]=h7.toString(this.type)),a}}iY.NAME="Attribute";class iZ extends iY{constructor(...a){if(a4.isBufferSource(a[0]))super(a[0]);else{const b=new ho({printableString:a[0]});super(g5,[c5.serialize(b)])}null!=this.password||(this.password="")}onInit(a){if(super.onInit(a),this.values[0]){let a=c5.parse(this.values[0],ho);this.password=a.toString()}}toTextObject(){let a=this.toTextObjectWithoutValue();return a[h5.VALUE]=this.password,a}}iZ.NAME="Challenge Password";class i$ extends iY{constructor(...a){if(a4.isBufferSource(a[0]))super(a[0]);else{const b=a[0],c=new ev;for(const a of b)c.push(c5.parse(a.rawData,eu));super(g6,[c5.serialize(c)])}null!=this.items||(this.items=[])}onInit(a){if(super.onInit(a),this.values[0]){let a=c5.parse(this.values[0],ev);this.items=a.map(a=>iR.create(c5.serialize(a)))}}toTextObject(){let a=this.toTextObjectWithoutValue();for(let b of this.items.map(a=>a.toTextObject()))a[b[h5.NAME]]=b;return a}}i$.NAME="Extensions";class i_{static register(a,b){this.items.set(a,b)}static create(a){let b=new iY(a),c=this.items.get(b.type);return c?new c(a):b}}i_.items=new Map;let i0="crypto.signatureFormatter";class i1{toAsnSignature(a,b){return a4.toArrayBuffer(b)}toWebSignature(a,b){return a4.toArrayBuffer(b)}}let i2=ax=class{static createPssParams(a,b){let c=ax.getHashAlgorithm(a);return c?new gn({hashAlgorithm:c,maskGenAlgorithm:new eq({algorithm:gh,parameters:c5.serialize(c)}),saltLength:b}):null}static getHashAlgorithm(a){let b=gN.resolve(hz);return"string"==typeof a?b.toAsnAlgorithm({name:a}):"object"==typeof a&&a&&"name"in a?b.toAsnAlgorithm(a):null}toAsnAlgorithm(a){switch(a.name.toLowerCase()){case"rsassa-pkcs1-v1_5":if(!("hash"in a))return new eq({algorithm:f_,parameters:null});{let b;if("string"==typeof a.hash)b=a.hash;else if(a.hash&&"object"==typeof a.hash&&"name"in a.hash&&"string"==typeof a.hash.name)b=a.hash.name.toUpperCase();else throw Error("Cannot get hash algorithm name");switch(b.toLowerCase()){case"sha-1":return new eq({algorithm:f5,parameters:null});case"sha-256":return new eq({algorithm:f7,parameters:null});case"sha-384":return new eq({algorithm:f8,parameters:null});case"sha-512":return new eq({algorithm:f9,parameters:null})}}break;case"rsa-pss":if(!("hash"in a))return new eq({algorithm:f2,parameters:null});{if(!("saltLength"in a&&"number"==typeof a.saltLength))throw Error("Cannot get 'saltLength' from 'alg' argument");let b=ax.createPssParams(a.hash,a.saltLength);if(!b)throw Error("Cannot create PSS parameters");return new eq({algorithm:f2,parameters:c5.serialize(b)})}}return null}toWebAlgorithm(a){switch(a.algorithm){case f_:return{name:"RSASSA-PKCS1-v1_5"};case f5:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-1"}};case f7:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case f8:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-384"}};case f9:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-512"}};case f2:if(!a.parameters)return{name:"RSA-PSS"};{let b=c5.parse(a.parameters,gn);return{name:"RSA-PSS",hash:gN.resolve(hz).toWebAlgorithm(b.hashAlgorithm),saltLength:b.saltLength}}}return null}};i2=ax=c6([gO()],i2),gN.registerSingleton(hx,i2);let i3=class{toAsnAlgorithm(a){switch(a.name.toLowerCase()){case"sha-1":return new eq({algorithm:gc});case"sha-256":return new eq({algorithm:ge});case"sha-384":return new eq({algorithm:gf});case"sha-512":return new eq({algorithm:gg})}return null}toWebAlgorithm(a){switch(a.algorithm){case gc:return{name:"SHA-1"};case ge:return{name:"SHA-256"};case gf:return{name:"SHA-384"};case gg:return{name:"SHA-512"}}return null}};i3=c6([gO()],i3),gN.registerSingleton(hx,i3);class i4{addPadding(a,b){let c=a4.toUint8Array(b),d=new Uint8Array(a);return d.set(c,a-c.length),d.buffer}removePadding(a,b=!1){let c=a4.toUint8Array(a);for(let a=0;a<c.length;a++)if(c[a]){c=c.slice(a);break}if(b&&c[0]>127){let a=new Uint8Array(c.length+1);return a.set(c,1),a.buffer}return c.buffer}toAsnSignature(a,b){if("ECDSA"===a.name){let c=a.namedCurve,d=i4.namedCurveSize.get(c)||i4.defaultNamedCurveSize,e=new fZ,f=a4.toUint8Array(b);return e.r=this.removePadding(f.slice(0,d),!0),e.s=this.removePadding(f.slice(d,d+d),!0),c5.serialize(e)}return null}toWebSignature(a,b){if("ECDSA"===a.name){let c=c5.parse(b,fZ),d=a.namedCurve,e=i4.namedCurveSize.get(d)||i4.defaultNamedCurveSize;return function(...a){let b=new Uint8Array(a.map(a=>a.byteLength).reduce((a,b)=>a+b)),c=0;return a.map(a=>new Uint8Array(a)).forEach(a=>{for(let d of a)b[c++]=d}),b.buffer}(this.addPadding(e,this.removePadding(c.r)),this.addPadding(e,this.removePadding(c.s)))}return null}}i4.namedCurveSize=new Map,i4.defaultNamedCurveSize=32;let i5="1.3.101.110",i6="1.3.101.111",i7="1.3.101.112",i8="1.3.101.113",i9=class{toAsnAlgorithm(a){let b=null;switch(a.name.toLowerCase()){case"ed25519":b=i7;break;case"x25519":b=i5;break;case"eddsa":switch(a.namedCurve.toLowerCase()){case"ed25519":b=i7;break;case"ed448":b=i8}break;case"ecdh-es":switch(a.namedCurve.toLowerCase()){case"x25519":b=i5;break;case"x448":b=i6}}return b?new eq({algorithm:b}):null}toWebAlgorithm(a){switch(a.algorithm){case i7:return{name:"Ed25519"};case i8:return{name:"EdDSA",namedCurve:"Ed448"};case i5:return{name:"X25519"};case i6:return{name:"ECDH-ES",namedCurve:"X448"}}return null}};i9=c6([gO()],i9),gN.registerSingleton(hx,i9);class ja extends iJ{get subjectName(){return c7(this,az,"f")||c8(this,az,new ii(this.asn.certificationRequestInfo.subject),"f"),c7(this,az,"f")}get subject(){return c7(this,aA,"f")||c8(this,aA,this.subjectName.toString(),"f"),c7(this,aA,"f")}get signatureAlgorithm(){if(!c7(this,aB,"f")){let a=gN.resolve(hz);c8(this,aB,a.toWebAlgorithm(this.asn.signatureAlgorithm),"f")}return c7(this,aB,"f")}get signature(){return c7(this,aC,"f")||c8(this,aC,this.asn.signature,"f"),c7(this,aC,"f")}get publicKey(){return c7(this,aD,"f")||c8(this,aD,new iK(this.asn.certificationRequestInfo.subjectPKInfo),"f"),c7(this,aD,"f")}get attributes(){return c7(this,aE,"f")||c8(this,aE,this.asn.certificationRequestInfo.attributes.map(a=>i_.create(c5.serialize(a))),"f"),c7(this,aE,"f")}get extensions(){if(!c7(this,aF,"f")){c8(this,aF,[],"f");let a=this.getAttribute(g6);a instanceof i$&&c8(this,aF,a.items,"f")}return c7(this,aF,"f")}get tbs(){return c7(this,ay,"f")||c8(this,ay,this.asn.certificationRequestInfoRaw||c5.serialize(this.asn.certificationRequestInfo),"f"),c7(this,ay,"f")}constructor(a){const b=iJ.isAsnEncoded(a)?[a,hw]:[a];super(b[0],b[1]),ay.set(this,void 0),az.set(this,void 0),aA.set(this,void 0),aB.set(this,void 0),aC.set(this,void 0),aD.set(this,void 0),aE.set(this,void 0),aF.set(this,void 0),this.tag=iI.CertificateRequestTag}onInit(a){}getAttribute(a){for(let b of this.attributes)if(b.type===a)return b;return null}getAttributes(a){return this.attributes.filter(b=>b.type===a)}getExtension(a){for(let b of this.extensions)if(b.type===a)return b;return null}getExtensions(a){return this.extensions.filter(b=>b.type===a)}async verify(a=ic.get()){let b={...this.publicKey.algorithm,...this.signatureAlgorithm},c=await this.publicKey.export(b,["verify"],a),d=gN.resolveAll(i0).reverse(),e=null;for(let a of d)if(e=a.toWebSignature(b,this.signature))break;if(!e)throw Error("Cannot convert WebCrypto signature value to ASN.1 format");return await a.subtle.verify(this.signatureAlgorithm,c,e,this.tbs)}toTextObject(){let a=this.toTextObjectEmpty(),b=c5.parse(this.rawData,hw),c=b.certificationRequestInfo,d=new h5("",{Version:`${T[c.version]} (${c.version})`,Subject:this.subject,"Subject Public Key Info":this.publicKey});if(this.attributes.length){let a=new h5("");for(let b of this.attributes){let c=b.toTextObject();a[c[h5.NAME]]=c}d.Attributes=a}return a.Data=d,a.Signature=new h5("",{Algorithm:h8.serializeAlgorithm(b.signatureAlgorithm),"":b.signature}),a}}ay=new WeakMap,az=new WeakMap,aA=new WeakMap,aB=new WeakMap,aC=new WeakMap,aD=new WeakMap,aE=new WeakMap,aF=new WeakMap,ja.NAME="PKCS#10 Certificate Request";class jb{static async create(a,b=ic.get()){if(!a.keys.privateKey)throw Error("Bad field 'keys' in 'params' argument. 'privateKey' is empty");if(!a.keys.publicKey)throw Error("Bad field 'keys' in 'params' argument. 'publicKey' is empty");let c=await b.subtle.exportKey("spki",a.keys.publicKey),d=new hw({certificationRequestInfo:new hv({subjectPKInfo:c5.parse(c,er)})});if(a.name){let b=a.name instanceof ii?a.name:new ii(a.name);d.certificationRequestInfo.subject=c5.parse(b.toArrayBuffer(),df)}if(a.attributes)for(let b of a.attributes)d.certificationRequestInfo.attributes.push(c5.parse(b.rawData,ei));if(a.extensions&&a.extensions.length){let b=new ei({type:g6}),c=new ev;for(let b of a.extensions)c.push(c5.parse(b.rawData,eu));b.values.push(c5.serialize(c)),d.certificationRequestInfo.attributes.push(b)}let e={...a.signingAlgorithm,...a.keys.privateKey.algorithm};d.signatureAlgorithm=gN.resolve(hz).toAsnAlgorithm(e);let f=c5.serialize(d.certificationRequestInfo),g=await b.subtle.sign(e,a.keys.privateKey,f),h=gN.resolveAll(i0).reverse(),i=null;for(let a of h)if(i=a.toAsnSignature(e,g))break;if(!i)throw Error("Cannot convert WebCrypto signature value to ASN.1 format");return d.signature=i,new ja(c5.serialize(d))}}class jc extends iJ{get publicKey(){return c7(this,aR,"f")||c8(this,aR,new iK(this.asn.tbsCertificate.subjectPublicKeyInfo),"f"),c7(this,aR,"f")}get serialNumber(){if(!c7(this,aH,"f")){let a=new Uint8Array(this.asn.tbsCertificate.serialNumber);a.length>1&&0===a[0]&&a[1]>127&&(a=a.slice(1)),c8(this,aH,bb.ToHex(a),"f")}return c7(this,aH,"f")}get subjectName(){return c7(this,aI,"f")||c8(this,aI,new ii(this.asn.tbsCertificate.subject),"f"),c7(this,aI,"f")}get subject(){return c7(this,aJ,"f")||c8(this,aJ,this.subjectName.toString(),"f"),c7(this,aJ,"f")}get issuerName(){return c7(this,aK,"f")||c8(this,aK,new ii(this.asn.tbsCertificate.issuer),"f"),c7(this,aK,"f")}get issuer(){return c7(this,aL,"f")||c8(this,aL,this.issuerName.toString(),"f"),c7(this,aL,"f")}get notBefore(){if(!c7(this,aM,"f")){let a=this.asn.tbsCertificate.validity.notBefore.utcTime||this.asn.tbsCertificate.validity.notBefore.generalTime;if(!a)throw Error("Cannot get 'notBefore' value");c8(this,aM,a,"f")}return c7(this,aM,"f")}get notAfter(){if(!c7(this,aN,"f")){let a=this.asn.tbsCertificate.validity.notAfter.utcTime||this.asn.tbsCertificate.validity.notAfter.generalTime;if(!a)throw Error("Cannot get 'notAfter' value");c8(this,aN,a,"f")}return c7(this,aN,"f")}get signatureAlgorithm(){if(!c7(this,aO,"f")){let a=gN.resolve(hz);c8(this,aO,a.toWebAlgorithm(this.asn.signatureAlgorithm),"f")}return c7(this,aO,"f")}get signature(){return c7(this,aP,"f")||c8(this,aP,this.asn.signatureValue,"f"),c7(this,aP,"f")}get extensions(){return!c7(this,aQ,"f")&&(c8(this,aQ,[],"f"),this.asn.tbsCertificate.extensions&&c8(this,aQ,this.asn.tbsCertificate.extensions.map(a=>iR.create(c5.serialize(a))),"f")),c7(this,aQ,"f")}get tbs(){return c7(this,aG,"f")||c8(this,aG,this.asn.tbsCertificateRaw||c5.serialize(this.asn.tbsCertificate),"f"),c7(this,aG,"f")}constructor(a){const b=iJ.isAsnEncoded(a)?[a,ex]:[a];super(b[0],b[1]),aG.set(this,void 0),aH.set(this,void 0),aI.set(this,void 0),aJ.set(this,void 0),aK.set(this,void 0),aL.set(this,void 0),aM.set(this,void 0),aN.set(this,void 0),aO.set(this,void 0),aP.set(this,void 0),aQ.set(this,void 0),aR.set(this,void 0),this.tag=iI.CertificateTag}onInit(a){}getExtension(a){for(let b of this.extensions)if("string"==typeof a){if(b.type===a)return b}else if(b instanceof a)return b;return null}getExtensions(a){return this.extensions.filter(b=>"string"==typeof a?b.type===a:b instanceof a)}async verify(a={},b=ic.get()){let c,d,e=a.publicKey;try{if(e)if("publicKey"in e)c={...e.publicKey.algorithm,...this.signatureAlgorithm},d=await e.publicKey.export(c,["verify"],b);else if(e instanceof iK)c={...e.algorithm,...this.signatureAlgorithm},d=await e.export(c,["verify"],b);else if(a4.isBufferSource(e)){let a=new iK(e);c={...a.algorithm,...this.signatureAlgorithm},d=await a.export(c,["verify"],b)}else c={...e.algorithm,...this.signatureAlgorithm},d=e;else c={...this.publicKey.algorithm,...this.signatureAlgorithm},d=await this.publicKey.export(c,["verify"],b)}catch{return!1}let f=gN.resolveAll(i0).reverse(),g=null;for(let a of f)if(g=a.toWebSignature(c,this.signature))break;if(!g)throw Error("Cannot convert ASN.1 signature value to WebCrypto format");let h=await b.subtle.verify(this.signatureAlgorithm,d,g,this.tbs);if(a.signatureOnly)return h;{let b=(a.date||new Date).getTime();return h&&this.notBefore.getTime()<b&&b<this.notAfter.getTime()}}async getThumbprint(...a){let b,c="SHA-1";return a[0]&&(a[0].subtle?b=a[0]:(c=a[0]||c,b=a[1])),null!=b||(b=ic.get()),await b.subtle.digest(c,this.rawData)}async isSelfSigned(a=ic.get()){return this.subject===this.issuer&&await this.verify({signatureOnly:!0},a)}toTextObject(){let a=this.toTextObjectEmpty(),b=c5.parse(this.rawData,ex),c=b.tbsCertificate,d=new h5("",{Version:`${T[c.version]} (${c.version})`,"Serial Number":c.serialNumber,"Signature Algorithm":h8.serializeAlgorithm(c.signature),Issuer:this.issuer,Validity:new h5("",{"Not Before":c.validity.notBefore.getTime(),"Not After":c.validity.notAfter.getTime()}),Subject:this.subject,"Subject Public Key Info":this.publicKey});if(c.issuerUniqueID&&(d["Issuer Unique ID"]=c.issuerUniqueID),c.subjectUniqueID&&(d["Subject Unique ID"]=c.subjectUniqueID),this.extensions.length){let a=new h5("");for(let b of this.extensions){let c=b.toTextObject();a[c[h5.NAME]]=c}d.Extensions=a}return a.Data=d,a.Signature=new h5("",{Algorithm:h8.serializeAlgorithm(b.signatureAlgorithm),"":b.signatureValue}),a}}aG=new WeakMap,aH=new WeakMap,aI=new WeakMap,aJ=new WeakMap,aK=new WeakMap,aL=new WeakMap,aM=new WeakMap,aN=new WeakMap,aO=new WeakMap,aP=new WeakMap,aQ=new WeakMap,aR=new WeakMap,jc.NAME="Certificate";class jd extends Array{constructor(a){if(super(),iJ.isAsnEncoded(a))this.import(a);else if(a instanceof jc)this.push(a);else if(Array.isArray(a))for(const b of a)this.push(b)}export(a){let b=new fE;b.version=1,b.encapContentInfo.eContentType="1.2.840.113549.1.7.1",b.encapContentInfo.eContent=new fc({single:new cy}),b.certificates=new fa(this.map(a=>new e9({certificate:c5.parse(a.rawData,ex)})));let c=new fb({contentType:fC,content:c5.serialize(b)}),d=c5.serialize(c);return"raw"===a?d:this.toString(a)}import(a){let b=iJ.toArrayBuffer(a),c=c5.parse(b,fb);if(c.contentType!==fC)throw TypeError("Cannot parse CMS package. Incoming data is not a SignedData object.");let d=c5.parse(c.content,fE);for(let a of(this.clear(),d.certificates||[]))a.certificate&&this.push(new jc(a.certificate))}clear(){for(;this.pop(););}toString(a="pem"){let b=this.export("raw");switch(a){case"pem":return iI.encode(b,"CMS");case"pem-chain":return this.map(a=>a.toString("pem")).join("\n");case"asn":return c5.toString(b);case"hex":return bb.ToHex(b);case"base64":return bb.ToBase64(b);case"base64url":return bb.ToBase64Url(b);case"text":return h8.serialize(this.toTextObject());default:throw TypeError("Argument 'format' is unsupported value")}}toTextObject(){let a=c5.parse(this.export("raw"),fb),b=c5.parse(a.content,fE);return new h5("X509Certificates",{"Content Type":h7.toString(a.contentType),Content:new h5("",{Version:`${U[b.version]} (${b.version})`,Certificates:new h5("",{Certificate:this.map(a=>a.toTextObject())})})})}}class je{constructor(a={}){this.certificates=[],a.certificates&&(this.certificates=a.certificates)}async build(a,b=ic.get()){let c=new jd(a),d=a;for(;d=await this.findIssuer(d,b);){let a=await d.getThumbprint(b);for(let d of c)if(bc(a,await d.getThumbprint(b)))throw Error("Cannot build a certificate chain. Circular dependency.");c.push(d)}return c}async findIssuer(a,b=ic.get()){if(!await a.isSelfSigned(b)){let c=a.getExtension(dw);for(let d of this.certificates)if(d.subject===a.issuer){if(c){if(c.keyId){let a=d.getExtension(ek);if(a&&a.keyId!==c.keyId)continue}else if(c.certId){let a=d.getExtension(eg);if(a&&!(c.certId.serialNumber===d.serialNumber&&bc(c5.serialize(c.certId.name),c5.serialize(a))))continue}}try{let c={...d.publicKey.algorithm,...a.signatureAlgorithm},e=await d.publicKey.export(c,["verify"],b);if(!await a.verify({publicKey:e,signatureOnly:!0},b))continue}catch{continue}return d}}return null}}function jf(a,b=ic.get()){let c=a4.toUint8Array(bb.FromHex(a||"")),d=c&&c.length&&c.some(a=>a>0)?new Uint8Array(c):void 0;d||(d=b.getRandomValues(new Uint8Array(16)));let e=0;for(;e<d.length-1&&0===d[e];)e++;if((d=d.slice(e))[0]>127){let a=new Uint8Array(d.length+1);a[0]=0,a.set(d,1),d=a}return d.buffer}class jg{static async createSelfSigned(a,b=ic.get()){if(!a.keys.privateKey)throw Error("Bad field 'keys' in 'params' argument. 'privateKey' is empty");if(!a.keys.publicKey)throw Error("Bad field 'keys' in 'params' argument. 'publicKey' is empty");return this.create({serialNumber:a.serialNumber,subject:a.name,issuer:a.name,notBefore:a.notBefore,notAfter:a.notAfter,publicKey:a.keys.publicKey,signingKey:a.keys.privateKey,signingAlgorithm:a.signingAlgorithm,extensions:a.extensions},b)}static async create(a,b=ic.get()){var c;let d;d=a.publicKey instanceof iK?a.publicKey.rawData:"publicKey"in a.publicKey?a.publicKey.publicKey.rawData:a4.isBufferSource(a.publicKey)?a.publicKey:await b.subtle.exportKey("spki",a.publicKey);let e=jf(a.serialNumber,b),f=a.notBefore||new Date,g=a.notAfter||new Date(f.getTime()+31536e6),h=new ex({tbsCertificate:new ew({version:T.v3,serialNumber:e,validity:new et({notBefore:f,notAfter:g}),extensions:new ev((null==(c=a.extensions)?void 0:c.map(a=>c5.parse(a.rawData,eu)))||[]),subjectPublicKeyInfo:c5.parse(d,er)})});if(a.subject){let b=a.subject instanceof ii?a.subject:new ii(a.subject);h.tbsCertificate.subject=c5.parse(b.toArrayBuffer(),df)}if(a.issuer){let b=a.issuer instanceof ii?a.issuer:new ii(a.issuer);h.tbsCertificate.issuer=c5.parse(b.toArrayBuffer(),df)}let i={hash:"SHA-256"},j="signingKey"in a?{...i,...a.signingAlgorithm,...a.signingKey.algorithm}:{...i,...a.signingAlgorithm},k=gN.resolve(hz);h.tbsCertificate.signature=h.signatureAlgorithm=k.toAsnAlgorithm(j);let l=c5.serialize(h.tbsCertificate),m="signingKey"in a?await b.subtle.sign(j,a.signingKey,l):a.signature,n=gN.resolveAll(i0).reverse(),o=null;for(let a of n)if(o=a.toAsnSignature(j,m))break;if(!o)throw Error("Cannot convert ASN.1 signature value to WebCrypto format");return h.signatureValue=o,new jc(c5.serialize(h))}}(t=aX||(aX={}))[t.unspecified=0]="unspecified",t[t.keyCompromise=1]="keyCompromise",t[t.cACompromise=2]="cACompromise",t[t.affiliationChanged=3]="affiliationChanged",t[t.superseded=4]="superseded",t[t.cessationOfOperation=5]="cessationOfOperation",t[t.certificateHold=6]="certificateHold",t[t.removeFromCRL=8]="removeFromCRL",t[t.privilegeWithdrawn=9]="privilegeWithdrawn",t[t.aACompromise=10]="aACompromise";class jh extends h9{get serialNumber(){return c7(this,aS,"f")||c8(this,aS,bb.ToHex(this.asn.userCertificate),"f"),c7(this,aS,"f")}get revocationDate(){return c7(this,aT,"f")||c8(this,aT,this.asn.revocationDate.getTime(),"f"),c7(this,aT,"f")}get reason(){return void 0===c7(this,aU,"f")&&this.extensions,c7(this,aU,"f")}get invalidity(){return void 0===c7(this,aV,"f")&&this.extensions,c7(this,aV,"f")}get extensions(){return!c7(this,aW,"f")&&(c8(this,aW,[],"f"),this.asn.crlEntryExtensions&&c8(this,aW,this.asn.crlEntryExtensions.map(a=>{let b=iR.create(c5.serialize(a));switch(b.type){case dV:void 0===c7(this,aU,"f")&&c8(this,aU,c5.parse(b.value,dW).reason,"f");break;case d4:void 0===c7(this,aV,"f")&&c8(this,aV,c5.parse(b.value,d5).value,"f")}return b}),"f")),c7(this,aW,"f")}constructor(...a){let b;if(a4.isBufferSource(a[0])?b=a4.toArrayBuffer(a[0]):"string"==typeof a[0]?b=c5.serialize(new ey({userCertificate:jf(a[0]),revocationDate:new es(a[1]),crlEntryExtensions:a[2]})):a[0]instanceof ey&&(b=a[0]),!b)throw TypeError("Cannot create X509CrlEntry instance. Wrong constructor arguments.");super(b,ey),aS.set(this,void 0),aT.set(this,void 0),aU.set(this,void 0),aV.set(this,void 0),aW.set(this,void 0)}onInit(a){}}aS=new WeakMap,aT=new WeakMap,aU=new WeakMap,aV=new WeakMap,aW=new WeakMap;class ji extends iJ{get version(){return this.asn.tbsCertList.version}get signatureAlgorithm(){if(!c7(this,aZ,"f")){let a=gN.resolve(hz);c8(this,aZ,a.toWebAlgorithm(this.asn.signatureAlgorithm),"f")}return c7(this,aZ,"f")}get signature(){return this.asn.signature}get issuer(){return this.issuerName.toString()}get issuerName(){return c7(this,a$,"f")||c8(this,a$,new ii(this.asn.tbsCertList.issuer),"f"),c7(this,a$,"f")}get thisUpdate(){if(!c7(this,a_,"f")){let a=this.asn.tbsCertList.thisUpdate.getTime();if(!a)throw Error("Cannot get 'thisUpdate' value");c8(this,a_,a,"f")}return c7(this,a_,"f")}get nextUpdate(){var a;return void 0===c7(this,a0,"f")&&c8(this,a0,(null==(a=this.asn.tbsCertList.nextUpdate)?void 0:a.getTime())||void 0,"f"),c7(this,a0,"f")}get entries(){var a;return c7(this,a1,"f")||c8(this,a1,(null==(a=this.asn.tbsCertList.revokedCertificates)?void 0:a.map(a=>new jh(a)))||[],"f"),c7(this,a1,"f")}get extensions(){return!c7(this,a2,"f")&&(c8(this,a2,[],"f"),this.asn.tbsCertList.crlExtensions&&c8(this,a2,this.asn.tbsCertList.crlExtensions.map(a=>iR.create(c5.serialize(a))),"f")),c7(this,a2,"f")}get tbs(){return c7(this,aY,"f")||c8(this,aY,this.asn.tbsCertListRaw||c5.serialize(this.asn.tbsCertList),"f"),c7(this,aY,"f")}get tbsCertListSignatureAlgorithm(){return this.asn.tbsCertList.signature}get certListSignatureAlgorithm(){return this.asn.signatureAlgorithm}constructor(a){super(a,iJ.isAsnEncoded(a)?eA:void 0),this.tag=iI.CrlTag,aY.set(this,void 0),aZ.set(this,void 0),a$.set(this,void 0),a_.set(this,void 0),a0.set(this,void 0),a1.set(this,void 0),a2.set(this,void 0)}onInit(a){}getExtension(a){for(let b of this.extensions)if("string"==typeof a){if(b.type===a)return b}else if(b instanceof a)return b;return null}getExtensions(a){return this.extensions.filter(b=>"string"==typeof a?b.type===a:b instanceof a)}async verify(a,b=ic.get()){let c,d;if(!this.certListSignatureAlgorithm.isEqual(this.tbsCertListSignatureAlgorithm))throw Error("algorithm identifier in the sequence tbsCertList and CertificateList mismatch");let e=a.publicKey;try{e instanceof jc?(c={...e.publicKey.algorithm,...e.signatureAlgorithm},d=await e.publicKey.export(c,["verify"])):e instanceof iK?(c={...e.algorithm,...this.signatureAlgorithm},d=await e.export(c,["verify"])):(c={...e.algorithm,...this.signatureAlgorithm},d=e)}catch{return!1}let f=gN.resolveAll(i0).reverse(),g=null;for(let a of f)if(g=a.toWebSignature(c,this.signature))break;if(!g)throw Error("Cannot convert ASN.1 signature value to WebCrypto format");return await b.subtle.verify(this.signatureAlgorithm,d,g,this.tbs)}async getThumbprint(...a){let b,c="SHA-1";return a[0]&&(a[0].subtle?b=a[0]:(c=a[0]||c,b=a[1])),null!=b||(b=ic.get()),await b.subtle.digest(c,this.rawData)}findRevoked(a){let b=jf("string"==typeof a?a:a.serialNumber);for(let a of this.asn.tbsCertList.revokedCertificates||[])if(a4.isEqual(a.userCertificate,b))return new jh(c5.serialize(a));return null}}aY=new WeakMap,aZ=new WeakMap,a$=new WeakMap,a_=new WeakMap,a0=new WeakMap,a1=new WeakMap,a2=new WeakMap;class jj{static async create(a,b=ic.get()){var c;let d=a.issuer instanceof ii?a.issuer:new ii(a.issuer),e=new eA({tbsCertList:new ez({version:T.v2,issuer:c5.parse(d.toArrayBuffer(),df),thisUpdate:new es(a.thisUpdate||new Date)})});if(a.nextUpdate&&(e.tbsCertList.nextUpdate=new es(a.nextUpdate)),a.extensions&&a.extensions.length&&(e.tbsCertList.crlExtensions=new ev(a.extensions.map(a=>c5.parse(a.rawData,eu))||[])),a.entries&&a.entries.length)for(let b of(e.tbsCertList.revokedCertificates=[],a.entries)){let d=iJ.toArrayBuffer(b.serialNumber);if(e.tbsCertList.revokedCertificates.findIndex(a=>bc(a.userCertificate,d))>-1)throw Error(`Certificate serial number ${b.serialNumber} already exists in tbsCertList`);let f=new ey({userCertificate:d,revocationDate:new es(b.revocationDate||new Date)});if("extensions"in b&&(null==(c=b.extensions)?void 0:c.length)?f.crlEntryExtensions=b.extensions.map(a=>c5.parse(a.rawData,eu)):f.crlEntryExtensions=[],!(b instanceof jh)&&(b.reason&&f.crlEntryExtensions.push(new eu({extnID:dV,critical:!1,extnValue:new cy(c5.serialize(new dW(b.reason)))})),b.invalidity&&f.crlEntryExtensions.push(new eu({extnID:d4,critical:!1,extnValue:new cy(c5.serialize(new d5(b.invalidity)))})),b.issuer)){let b=a.issuer instanceof ii?a.issuer:new ii(a.issuer);f.crlEntryExtensions.push(new eu({extnID:dC,critical:!1,extnValue:new cy(c5.serialize(c5.parse(b.toArrayBuffer(),df)))}))}e.tbsCertList.revokedCertificates.push(f)}let f={...a.signingAlgorithm,...a.signingKey.algorithm},g=gN.resolve(hz);e.tbsCertList.signature=e.signatureAlgorithm=g.toAsnAlgorithm(f);let h=c5.serialize(e.tbsCertList),i=await b.subtle.sign(f,a.signingKey,h),j=gN.resolveAll(i0).reverse(),k=null;for(let a of j)if(k=a.toAsnSignature(f,i))break;if(!k)throw Error("Cannot convert ASN.1 signature value to WebCrypto format");return e.signature=k,new ji(c5.serialize(e))}}iR.register(dz,iM),iR.register(dX,iN),iR.register(d8,iO),iR.register(ek,iP),iR.register(dw,iL),iR.register(eg,iQ),iR.register(dO,iT),iR.register(dt,iU),iR.register(d6,iX),i_.register(g5,iZ),i_.register(g6,i$),gN.registerSingleton(i0,i1),gN.registerSingleton(i0,i4),i4.namedCurveSize.set("P-256",32),i4.namedCurveSize.set("K-256",32),i4.namedCurveSize.set("P-384",48),i4.namedCurveSize.set("P-521",66)},96182:(a,b,c)=>{"use strict";let{spawn:d}=c(79646),e=c(33873),f=c(29021),g=c(21820),{addDNSEntry:h,removeDNSEntry:i}=c(66936),{generateCert:j}=c(26033),{installCert:k}=c(9631),l=null,m=null,n=e.join(g.homedir(),".9router","mitm",".mitm.pid");function o(a){try{return process.kill(a,0),!0}catch{return!1}}a.exports={getMitmStatus:async function(){let a=null!==l&&!l.killed,b=m;if(!a)try{if(f.existsSync(n)){let c=parseInt(f.readFileSync(n,"utf-8").trim(),10);c&&o(c)?(a=!0,b=c):f.unlinkSync(n)}}catch{}let c=!1;try{c=f.readFileSync("/etc/hosts","utf-8").includes("daily-cloudcode-pa.googleapis.com")}catch{}let d=e.join(g.homedir(),".9router","mitm");return{running:a,pid:b,dnsConfigured:c,certExists:f.existsSync(e.join(d,"server.crt"))}},startMitm:async function(a,b){if(l&&!l.killed)throw Error("MITM proxy is already running");let c=e.join(g.homedir(),".9router","mitm","server.crt");if(f.existsSync(c)||(console.log("Generating SSL certificate..."),await j()),await k(b,c),console.log("Adding DNS entry..."),await h(b),console.log("Starting MITM server..."),m=(l=d("node",[e.join(process.cwd(),"src/mitm/server.js")],{env:{...process.env,ROUTER_API_KEY:a,NODE_ENV:"production"},detached:!1,stdio:["ignore","pipe","pipe"]})).pid,f.writeFileSync(n,String(m)),l.stdout.on("data",a=>{console.log(`[MITM Server] ${a.toString().trim()}`)}),l.stderr.on("data",a=>{console.error(`[MITM Server Error] ${a.toString().trim()}`)}),l.on("exit",a=>{console.log(`MITM server exited with code ${a}`),l=null,m=null;try{f.unlinkSync(n)}catch(a){}}),!await new Promise(a=>{let b=!1,c=setTimeout(()=>{b||(b=!0,a(!0))},2e3);l.on("exit",d=>{clearTimeout(c),b||(b=!0,a(!1))}),l.stderr.on("data",d=>{let e=d.toString().trim();e.includes("Port")&&e.includes("already in use")&&(clearTimeout(c),b||(b=!0,a(!1)))})}))throw Error("MITM server failed to start (port 443 may be in use)");return{running:!0,pid:m}},stopMitm:async function(a){let b=l;if(b&&!b.killed)console.log("Stopping MITM server..."),b.kill("SIGTERM"),await new Promise(a=>setTimeout(a,1e3)),b.killed||b.kill("SIGKILL"),l=null,m=null;else{try{if(f.existsSync(n)){let a=parseInt(f.readFileSync(n,"utf-8").trim(),10);a&&o(a)&&(console.log(`Killing MITM server (PID: ${a})...`),process.kill(a,"SIGTERM"),await new Promise(a=>setTimeout(a,1e3)),o(a)&&process.kill(a,"SIGKILL"))}}catch{}l=null,m=null}console.log("Removing DNS entry..."),await i(a);try{f.unlinkSync(n)}catch(a){}return{running:!1,pid:null}},getCachedPassword:function(){return globalThis.__mitmSudoPassword||null},setCachedPassword:function(a){globalThis.__mitmSudoPassword=a}}},96487:()=>{}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813],()=>b(b.s=60488));module.exports=c})();