k2-im 0.1.57 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (471) hide show
  1. package/README.md +3 -1
  2. package/dist/browser.d.ts +1 -1
  3. package/dist/browser.js +1 -1
  4. package/dist/chat-kit-pinia.d.ts +227 -170
  5. package/dist/chat-kit-pinia.js +1 -1
  6. package/dist/chat-kit-vue.d.ts +64 -44
  7. package/dist/chat-kit-vue.js +1 -1
  8. package/dist/chat-kit.d.ts +244 -173
  9. package/dist/chat-kit.js +1 -1
  10. package/dist/crypto.worker.js +17 -25
  11. package/dist/i18n.d.ts +61 -41
  12. package/dist/i18n.js +1 -1
  13. package/dist/index.d.ts +259 -188
  14. package/dist/index.js +1 -1
  15. package/dist/modules/api-protocol-client/src/bi-feedback.js +1 -0
  16. package/dist/modules/api-protocol-client/src/browser.js +1 -0
  17. package/dist/modules/api-protocol-client/src/client.js +1 -0
  18. package/dist/modules/api-protocol-client/src/config.js +1 -0
  19. package/dist/modules/api-protocol-client/src/constants.js +1 -0
  20. package/dist/modules/api-protocol-client/src/json.js +1 -0
  21. package/dist/modules/api-protocol-client/src/nonce.js +1 -0
  22. package/dist/modules/api-protocol-client/src/transports/axios.js +1 -0
  23. package/dist/modules/api-protocol-client/src/utils.js +1 -0
  24. package/dist/modules/crypto/browser.js +1 -0
  25. package/dist/modules/crypto/driver.js +1 -0
  26. package/dist/modules/crypto/vendor/crypto/index_bg.js +1 -0
  27. package/dist/modules/im-browser/src/crypto/channel-key-service.js +1 -0
  28. package/dist/modules/im-browser/src/crypto/collect-tea.js +1 -0
  29. package/dist/modules/im-browser/src/crypto/crypto-task-executor.js +1 -0
  30. package/dist/modules/im-browser/src/crypto/crypto-worker-factory.js +1 -0
  31. package/dist/modules/im-browser/src/crypto/crypto-worker-protocol.js +1 -0
  32. package/dist/modules/im-browser/src/crypto/encrypt-key-service.js +1 -0
  33. package/dist/modules/im-browser/src/crypto/group-key-service.js +1 -0
  34. package/dist/modules/im-browser/src/crypto/peer-public-key-service.js +1 -0
  35. package/dist/modules/im-browser/src/crypto/rsa-private-key.js +1 -0
  36. package/dist/modules/im-browser/src/crypto/rsa-tea-crypto-adapter.js +1 -0
  37. package/dist/modules/im-browser/src/crypto/stale-key-refresh.js +1 -0
  38. package/dist/modules/im-browser/src/crypto/tea.js +1 -0
  39. package/dist/modules/im-browser/src/crypto/wait-for-key-signal.js +1 -0
  40. package/dist/modules/im-browser/src/http/application-http-adapters.js +1 -0
  41. package/dist/modules/im-browser/src/http/channel-http-adapter.js +1 -0
  42. package/dist/modules/im-browser/src/http/channel-join-application-http-adapter.js +1 -0
  43. package/dist/modules/im-browser/src/http/channel-member-http-adapter.js +1 -0
  44. package/dist/modules/im-browser/src/http/channel-mention-member-http-adapter.js +1 -0
  45. package/dist/modules/im-browser/src/http/cm-http-adapter.js +1 -0
  46. package/dist/modules/im-browser/src/http/directory-http-adapter.js +1 -0
  47. package/dist/modules/im-browser/src/http/expression-http-adapter.js +1 -0
  48. package/dist/modules/im-browser/src/http/lazy-api-protocol-client.js +1 -0
  49. package/dist/modules/im-browser/src/http/profile-http-adapter.js +1 -0
  50. package/dist/modules/im-browser/src/http/requests/applications.js +1 -0
  51. package/dist/modules/im-browser/src/http/requests/bind-robot-conversation.js +1 -0
  52. package/dist/modules/im-browser/src/http/requests/board-pinned-message-validation.js +1 -0
  53. package/dist/modules/im-browser/src/http/requests/channel-join-applications.js +1 -0
  54. package/dist/modules/im-browser/src/http/requests/channel-management.js +1 -0
  55. package/dist/modules/im-browser/src/http/requests/channel-members.js +1 -0
  56. package/dist/modules/im-browser/src/http/requests/channel-mention-members.js +1 -0
  57. package/dist/modules/im-browser/src/http/requests/channel-message-context.js +1 -0
  58. package/dist/modules/im-browser/src/http/requests/channel-mini-program-rel.js +1 -0
  59. package/dist/modules/im-browser/src/http/requests/channel-profile.js +1 -0
  60. package/dist/modules/im-browser/src/http/requests/channel-read-index.js +1 -0
  61. package/dist/modules/im-browser/src/http/requests/contact-blocklist.js +1 -0
  62. package/dist/modules/im-browser/src/http/requests/contact-friendship.js +1 -0
  63. package/dist/modules/im-browser/src/http/requests/contact-report.js +1 -0
  64. package/dist/modules/im-browser/src/http/requests/core-json-request.js +1 -0
  65. package/dist/modules/im-browser/src/http/requests/create-channel.js +1 -0
  66. package/dist/modules/im-browser/src/http/requests/create-face-to-face-group.js +1 -0
  67. package/dist/modules/im-browser/src/http/requests/create-group.js +1 -0
  68. package/dist/modules/im-browser/src/http/requests/customer-service-profile.js +1 -0
  69. package/dist/modules/im-browser/src/http/requests/get-board-pinned-message.js +1 -0
  70. package/dist/modules/im-browser/src/http/requests/get-channel-board-pinned-message.js +1 -0
  71. package/dist/modules/im-browser/src/http/requests/get-channel-secret-key.js +1 -0
  72. package/dist/modules/im-browser/src/http/requests/get-conversation-background-presets.js +1 -0
  73. package/dist/modules/im-browser/src/http/requests/get-group-encrypt-info.js +1 -0
  74. package/dist/modules/im-browser/src/http/requests/get-group-info.js +1 -0
  75. package/dist/modules/im-browser/src/http/requests/get-group-member-list.js +1 -0
  76. package/dist/modules/im-browser/src/http/requests/get-user-encrypt-info.js +1 -0
  77. package/dist/modules/im-browser/src/http/requests/get-user-info-friend.js +1 -0
  78. package/dist/modules/im-browser/src/http/requests/get-user-info-other.js +1 -0
  79. package/dist/modules/im-browser/src/http/requests/group-management.js +1 -0
  80. package/dist/modules/im-browser/src/http/requests/mark-group-read-all.js +1 -0
  81. package/dist/modules/im-browser/src/http/requests/membership-join.js +1 -0
  82. package/dist/modules/im-browser/src/http/requests/pin-board-message.js +1 -0
  83. package/dist/modules/im-browser/src/http/requests/pin-channel-board-message.js +1 -0
  84. package/dist/modules/im-browser/src/http/requests/pull-messages-by-id.js +1 -0
  85. package/dist/modules/im-browser/src/http/requests/pull-offline-channel.js +1 -0
  86. package/dist/modules/im-browser/src/http/requests/pull-offline-chat.js +1 -0
  87. package/dist/modules/im-browser/src/http/requests/pull-offline-group.js +1 -0
  88. package/dist/modules/im-browser/src/http/requests/pull-offline-signal.js +1 -0
  89. package/dist/modules/im-browser/src/http/requests/robot-menu-reply.js +1 -0
  90. package/dist/modules/im-browser/src/http/requests/robot-profile.js +1 -0
  91. package/dist/modules/im-browser/src/http/requests/search-robots.js +1 -0
  92. package/dist/modules/im-browser/src/http/requests/set-conversation-undisturb.js +1 -0
  93. package/dist/modules/im-browser/src/http/requests/set-friend-remark.js +1 -0
  94. package/dist/modules/im-browser/src/http/requests/set-group-nickname.js +1 -0
  95. package/dist/modules/im-browser/src/http/requests/unpin-board-message.js +1 -0
  96. package/dist/modules/im-browser/src/http/requests/unpin-channel-board-message.js +1 -0
  97. package/dist/modules/im-browser/src/http/requests/update-group-info.js +1 -0
  98. package/dist/modules/im-browser/src/http/session-favorite-http-adapter.js +1 -0
  99. package/dist/modules/im-browser/src/media/file-md5.js +1 -0
  100. package/dist/modules/im-browser/src/media/image-clipboard.js +1 -0
  101. package/dist/modules/im-browser/src/media/image-header-dimensions.js +1 -0
  102. package/dist/modules/im-browser/src/media/media-downloader.js +1 -0
  103. package/dist/modules/im-browser/src/media/media-preview-adapter.js +1 -0
  104. package/dist/modules/im-browser/src/media/media-preview-preparation-executor.js +1 -0
  105. package/dist/modules/im-browser/src/media/media-request-limiter.js +1 -0
  106. package/dist/modules/im-browser/src/media/media-transfer-adapter.js +1 -0
  107. package/dist/modules/im-browser/src/media/media-transfer-errors.js +1 -0
  108. package/dist/modules/im-browser/src/media/media-transfer-policy.js +1 -0
  109. package/dist/modules/im-browser/src/media/media-upload-credentials.js +1 -0
  110. package/dist/modules/im-browser/src/media/media-upload-recovery-codec.js +1 -0
  111. package/dist/modules/im-browser/src/media/media-upload-recovery-store.js +1 -0
  112. package/dist/modules/im-browser/src/media/media-upload-source-fingerprint.js +1 -0
  113. package/dist/modules/im-browser/src/media/s3-multipart-uploader.js +1 -0
  114. package/dist/modules/im-browser/src/media/xhr-upload-idle-timeout.js +1 -0
  115. package/dist/modules/im-browser/src/network/browser-connection-ownership.js +1 -0
  116. package/dist/modules/im-browser/src/network/network-monitor.js +1 -0
  117. package/dist/modules/im-browser/src/scheduling/yield-to-browser.js +1 -0
  118. package/dist/modules/im-browser/src/storage/indexed-db-storage-adapter.js +1 -0
  119. package/dist/modules/im-browser/src/transport/ws-transport.js +1 -0
  120. package/dist/modules/im-browser/src/voice/voice-amplitude.js +1 -0
  121. package/dist/modules/im-browser/src/voice/voice-capabilities.js +1 -0
  122. package/dist/modules/im-browser/src/voice/voice-codec.js +1 -0
  123. package/dist/modules/im-browser/src/voice/voice-errors.js +1 -0
  124. package/dist/modules/im-browser/src/voice/voice-playback.js +1 -0
  125. package/dist/modules/im-browser/src/voice/voice-player.js +1 -0
  126. package/dist/modules/im-browser/src/voice/voice-recorder.js +1 -0
  127. package/dist/modules/im-chat-kit/src/i18n/use-im-text.js +1 -0
  128. package/dist/modules/im-chat-kit/src/pinia/applications.store.js +1 -0
  129. package/dist/modules/im-chat-kit/src/pinia/capabilities.store.js +1 -0
  130. package/dist/modules/im-chat-kit/src/pinia/composer.store.js +1 -0
  131. package/dist/modules/im-chat-kit/src/pinia/context.js +1 -0
  132. package/dist/modules/im-chat-kit/src/pinia/conversation-activation.js +1 -0
  133. package/dist/modules/im-chat-kit/src/pinia/conversation-deletion.js +1 -0
  134. package/dist/modules/im-chat-kit/src/pinia/conversation-list.store.js +1 -0
  135. package/dist/modules/im-chat-kit/src/pinia/expression.store.js +1 -0
  136. package/dist/modules/im-chat-kit/src/pinia/history-return-after-send.js +1 -0
  137. package/dist/modules/im-chat-kit/src/pinia/media-transfer-estimate.js +1 -0
  138. package/dist/modules/im-chat-kit/src/pinia/media.store.js +1 -0
  139. package/dist/modules/im-chat-kit/src/pinia/message-operations.store.js +1 -0
  140. package/dist/modules/im-chat-kit/src/pinia/profile-directory.store.js +1 -0
  141. package/dist/modules/im-chat-kit/src/pinia/quoted-message.store.js +1 -0
  142. package/dist/modules/im-chat-kit/src/pinia/reaction.store.js +1 -0
  143. package/dist/modules/im-chat-kit/src/pinia/search-senders.js +1 -0
  144. package/dist/modules/im-chat-kit/src/pinia/search.store.js +1 -0
  145. package/dist/modules/im-chat-kit/src/pinia/session-favorites.store.js +1 -0
  146. package/dist/modules/im-chat-kit/src/pinia/session.store.js +1 -0
  147. package/dist/modules/im-chat-kit/src/pinia/thread-paging.store.js +1 -0
  148. package/dist/modules/im-chat-kit/src/pinia/thread-return-to-latest.js +1 -0
  149. package/dist/modules/im-chat-kit/src/pinia/thread.store.js +1 -0
  150. package/dist/modules/im-chat-kit/src/presentation/channel-mini-program-open.js +1 -0
  151. package/dist/modules/im-chat-kit/src/presentation/channel-mini-program-rels.js +1 -0
  152. package/dist/modules/im-chat-kit/src/presentation/conversation-list.js +1 -0
  153. package/dist/modules/im-chat-kit/src/presentation/conversation-unread.js +1 -0
  154. package/dist/modules/im-chat-kit/src/presentation/delayed-loading-indicator.js +1 -0
  155. package/dist/modules/im-chat-kit/src/presentation/media-source-priority.js +1 -0
  156. package/dist/modules/im-chat-kit/src/presentation/message-notification.js +1 -0
  157. package/dist/modules/im-chat-kit/src/presentation/message-search.js +1 -0
  158. package/dist/modules/im-chat-kit/src/presentation/mini-program-game-preview.js +1 -0
  159. package/dist/modules/im-chat-kit/src/presentation/mini-program-open-url.js +1 -0
  160. package/dist/modules/im-chat-kit/src/runtime/chat-runtime.js +1 -0
  161. package/dist/modules/im-chat-kit/src/runtime/conversation-prefetch-controller.js +1 -0
  162. package/dist/modules/im-chat-kit/src/runtime/media-object-url-registry.js +1 -0
  163. package/dist/modules/im-chat-kit/src/runtime/runtime-operation.js +1 -0
  164. package/dist/modules/im-chat-kit/src/services/capabilities.js +1 -0
  165. package/dist/modules/im-chat-kit/src/services/channel-member-management.service.js +1 -0
  166. package/dist/modules/im-chat-kit/src/services/channel-profile-management.service.js +1 -0
  167. package/dist/modules/im-chat-kit/src/services/channel-send-restriction.js +1 -0
  168. package/dist/modules/im-chat-kit/src/services/direct-contact-management.service.js +1 -0
  169. package/dist/modules/im-chat-kit/src/services/forward.service.js +1 -0
  170. package/dist/modules/im-chat-kit/src/services/group-member-management.service.js +1 -0
  171. package/dist/modules/im-chat-kit/src/services/group-profile-management.service.js +1 -0
  172. package/dist/modules/im-chat-kit/src/services/image-copy.service.js +1 -0
  173. package/dist/modules/im-chat-kit/src/services/media-file-classification.js +1 -0
  174. package/dist/modules/im-chat-kit/src/services/media.service.js +1 -0
  175. package/dist/modules/im-chat-kit/src/services/message.service.js +1 -0
  176. package/dist/modules/im-chat-kit/src/services/pinned-message-rules.js +1 -0
  177. package/dist/modules/im-chat-kit/src/services/pinned-message.service.js +1 -0
  178. package/dist/modules/im-chat-kit/src/services/profile-access.service.js +1 -0
  179. package/dist/modules/im-chat-kit/src/services/profile-directory.service.js +1 -0
  180. package/dist/modules/im-chat-kit/src/services/profile-display.js +1 -0
  181. package/dist/modules/im-chat-kit/src/services/profile.service.js +1 -0
  182. package/dist/modules/im-chat-kit/src/services/read.service.js +1 -0
  183. package/dist/modules/im-chat-kit/src/services/robot-sender-profile.js +1 -0
  184. package/dist/modules/im-chat-kit/src/services/search.service.js +1 -0
  185. package/dist/modules/im-chat-kit/src/services/send.service.js +1 -0
  186. package/dist/modules/im-chat-kit/src/thread/active-date.js +1 -0
  187. package/dist/modules/im-chat-kit/src/thread/create-thread-items.js +1 -0
  188. package/dist/modules/im-chat-kit/src/thread/message-locate-result.js +1 -0
  189. package/dist/modules/im-chat-kit/src/thread/new-message-badge.js +1 -0
  190. package/dist/modules/im-chat-kit/src/thread/resolve-message-body-kind.js +1 -0
  191. package/dist/modules/im-chat-kit/src/thread/resolve-quoted-message-presentation.js +1 -0
  192. package/dist/modules/im-chat-kit/src/thread/viewport-rules.js +1 -0
  193. package/dist/modules/im-chat-kit/src/utils/emoji/emoji-legacy-catalog.json.js +1 -0
  194. package/dist/modules/im-chat-kit/src/utils/emoji/index.js +1 -0
  195. package/dist/modules/im-chat-kit/src/utils/emoji/recent.js +1 -0
  196. package/dist/modules/im-chat-kit/src/utils/emoji/unicode-emoji-catalog.json.js +1 -0
  197. package/dist/modules/im-chat-kit/src/utils/emoji/unicode.js +1 -0
  198. package/dist/modules/im-chat-kit/src/utils/highlight.js +1 -0
  199. package/dist/modules/im-chat-kit/src/utils/link.js +1 -0
  200. package/dist/modules/im-chat-kit/src/utils/media-batch.js +1 -0
  201. package/dist/modules/im-chat-kit/src/utils/media-dimensions.js +1 -0
  202. package/dist/modules/im-chat-kit/src/utils/media-format.js +1 -0
  203. package/dist/modules/im-chat-kit/src/utils/media-transfer-presentation.js +1 -0
  204. package/dist/modules/im-chat-kit/src/utils/time-display.js +1 -0
  205. package/dist/modules/im-chat-kit/src/utils/waveform.js +1 -0
  206. package/dist/modules/im-chat-kit/src/vue/thread/ImThreadBodySwitch.js +1 -0
  207. package/dist/modules/im-chat-kit/src/vue/thread/ImThreadItems.js +1 -0
  208. package/dist/modules/im-chat-kit/src/vue/thread/ImThreadSurface.js +1 -0
  209. package/dist/modules/im-chat-kit/src/vue/thread/ImThreadViewport.js +1 -0
  210. package/dist/modules/im-chat-kit/src/vue/thread/message-renderer-registry.js +1 -0
  211. package/dist/modules/im-chat-kit/src/vue/thread/thread-idle-task.js +1 -0
  212. package/dist/modules/im-chat-kit/src/vue/thread/thread-layout-measurements.js +1 -0
  213. package/dist/modules/im-chat-kit/src/vue/thread/thread-read-actions-context.js +1 -0
  214. package/dist/modules/im-chat-kit/src/vue/thread/thread-surface-context.js +1 -0
  215. package/dist/modules/im-chat-kit/src/vue/thread/thread-viewport-context.js +1 -0
  216. package/dist/modules/im-chat-kit/src/vue/thread/thread-visibility-target-group.js +1 -0
  217. package/dist/modules/im-chat-kit/src/vue/thread/thread-visibility-targets.js +1 -0
  218. package/dist/modules/im-chat-kit/src/vue/thread/use-im-thread-layout-measurement.js +1 -0
  219. package/dist/modules/im-core/src/abort.js +1 -0
  220. package/dist/modules/im-core/src/cache-namespace.js +1 -0
  221. package/dist/modules/im-core/src/connection/backoff.js +1 -0
  222. package/dist/modules/im-core/src/connection/connection-manager.js +1 -0
  223. package/dist/modules/im-core/src/connection/heartbeat-manager.js +1 -0
  224. package/dist/modules/im-core/src/conversation-identity.js +1 -0
  225. package/dist/modules/im-core/src/diagnostics.js +1 -0
  226. package/dist/modules/im-core/src/event-emitter.js +1 -0
  227. package/dist/modules/im-core/src/login/login-handler.js +1 -0
  228. package/dist/modules/im-core/src/mapping/bot-sender.js +1 -0
  229. package/dist/modules/im-core/src/mapping/call-record-body.js +1 -0
  230. package/dist/modules/im-core/src/mapping/channel-message-mapper.js +1 -0
  231. package/dist/modules/im-core/src/mapping/channel-notify-mapper.js +1 -0
  232. package/dist/modules/im-core/src/mapping/channel-offline-mapper.js +1 -0
  233. package/dist/modules/im-core/src/mapping/channel-pinned-message-mapper.js +1 -0
  234. package/dist/modules/im-core/src/mapping/channel-read-position.js +1 -0
  235. package/dist/modules/im-core/src/mapping/contact-body.js +1 -0
  236. package/dist/modules/im-core/src/mapping/content-body.js +1 -0
  237. package/dist/modules/im-core/src/mapping/conversation.js +1 -0
  238. package/dist/modules/im-core/src/mapping/crypto-batch-preparation.js +1 -0
  239. package/dist/modules/im-core/src/mapping/customer-service-body.js +1 -0
  240. package/dist/modules/im-core/src/mapping/customer-service-message-mapper.js +1 -0
  241. package/dist/modules/im-core/src/mapping/decrypt-recovery.js +1 -0
  242. package/dist/modules/im-core/src/mapping/file-body.js +1 -0
  243. package/dist/modules/im-core/src/mapping/files-album-body.js +1 -0
  244. package/dist/modules/im-core/src/mapping/game-body.js +1 -0
  245. package/dist/modules/im-core/src/mapping/gift-body.js +1 -0
  246. package/dist/modules/im-core/src/mapping/group-message-mapper.js +1 -0
  247. package/dist/modules/im-core/src/mapping/group-notify-mapper.js +1 -0
  248. package/dist/modules/im-core/src/mapping/group-offline-mapper.js +1 -0
  249. package/dist/modules/im-core/src/mapping/image-body.js +1 -0
  250. package/dist/modules/im-core/src/mapping/live-room-body.js +1 -0
  251. package/dist/modules/im-core/src/mapping/media-album-body.js +1 -0
  252. package/dist/modules/im-core/src/mapping/merge.js +1 -0
  253. package/dist/modules/im-core/src/mapping/mes-chat-mapper.js +1 -0
  254. package/dist/modules/im-core/src/mapping/message-id.js +1 -0
  255. package/dist/modules/im-core/src/mapping/message-mapper.js +1 -0
  256. package/dist/modules/im-core/src/mapping/messages-by-id.js +1 -0
  257. package/dist/modules/im-core/src/mapping/mini-program-body.js +1 -0
  258. package/dist/modules/im-core/src/mapping/offline-mapper.js +1 -0
  259. package/dist/modules/im-core/src/mapping/pinned-message-mapper.js +1 -0
  260. package/dist/modules/im-core/src/mapping/profile-mapper.js +1 -0
  261. package/dist/modules/im-core/src/mapping/reaction-mapper.js +1 -0
  262. package/dist/modules/im-core/src/mapping/recall-mapper.js +1 -0
  263. package/dist/modules/im-core/src/mapping/red-packet-body.js +1 -0
  264. package/dist/modules/im-core/src/mapping/robot-body.js +1 -0
  265. package/dist/modules/im-core/src/mapping/robot-message-mapper.js +1 -0
  266. package/dist/modules/im-core/src/mapping/search-text.js +1 -0
  267. package/dist/modules/im-core/src/mapping/session-mapper.js +1 -0
  268. package/dist/modules/im-core/src/mapping/signal-offline-mapper.js +1 -0
  269. package/dist/modules/im-core/src/mapping/sort.js +1 -0
  270. package/dist/modules/im-core/src/mapping/sticker-body.js +1 -0
  271. package/dist/modules/im-core/src/mapping/stored-message.js +1 -0
  272. package/dist/modules/im-core/src/mapping/system-event-timeline-policy.js +1 -0
  273. package/dist/modules/im-core/src/mapping/text-segments.js +1 -0
  274. package/dist/modules/im-core/src/mapping/transfer-body.js +1 -0
  275. package/dist/modules/im-core/src/mapping/transfer-status.js +1 -0
  276. package/dist/modules/im-core/src/mapping/unread-divider.js +1 -0
  277. package/dist/modules/im-core/src/mapping/video-body.js +1 -0
  278. package/dist/modules/im-core/src/mapping/voice-body.js +1 -0
  279. package/dist/modules/im-core/src/message-flow/call/direct-call-manager.js +1 -0
  280. package/dist/modules/im-core/src/message-flow/call/direct-call-record.js +1 -0
  281. package/dist/modules/im-core/src/message-flow/call/direct-p2p-call.js +1 -0
  282. package/dist/modules/im-core/src/message-flow/call/group-call-manager.js +1 -0
  283. package/dist/modules/im-core/src/message-flow/call/group-call-record.js +1 -0
  284. package/dist/modules/im-core/src/message-flow/conversation-support.js +1 -0
  285. package/dist/modules/im-core/src/message-flow/edit/edit-frame.js +1 -0
  286. package/dist/modules/im-core/src/message-flow/edit/edit-manager.js +1 -0
  287. package/dist/modules/im-core/src/message-flow/edit/edit-receive-handlers.js +1 -0
  288. package/dist/modules/im-core/src/message-flow/edit/edit-strategy.js +1 -0
  289. package/dist/modules/im-core/src/message-flow/expression/expression-message.js +1 -0
  290. package/dist/modules/im-core/src/message-flow/forward/can-transmit.js +1 -0
  291. package/dist/modules/im-core/src/message-flow/forward/forward-content-spec.js +1 -0
  292. package/dist/modules/im-core/src/message-flow/forward/forward-messages.js +1 -0
  293. package/dist/modules/im-core/src/message-flow/game/game-message.js +1 -0
  294. package/dist/modules/im-core/src/message-flow/gift/gift-message.js +1 -0
  295. package/dist/modules/im-core/src/message-flow/live-room/live-room-message.js +1 -0
  296. package/dist/modules/im-core/src/message-flow/media/media-sender.js +1 -0
  297. package/dist/modules/im-core/src/message-flow/mini-program/mini-program-message.js +1 -0
  298. package/dist/modules/im-core/src/message-flow/reaction/can-react.js +1 -0
  299. package/dist/modules/im-core/src/message-flow/reaction/reaction-manager.js +1 -0
  300. package/dist/modules/im-core/src/message-flow/reaction/reaction-receive-handlers.js +1 -0
  301. package/dist/modules/im-core/src/message-flow/read/channel-read-receive-handlers.js +1 -0
  302. package/dist/modules/im-core/src/message-flow/read/channel-read-strategy.js +1 -0
  303. package/dist/modules/im-core/src/message-flow/read/customer-service-read-strategy.js +1 -0
  304. package/dist/modules/im-core/src/message-flow/read/direct-read-sync.js +1 -0
  305. package/dist/modules/im-core/src/message-flow/read/group-read-strategy.js +1 -0
  306. package/dist/modules/im-core/src/message-flow/read/read-strategy.js +1 -0
  307. package/dist/modules/im-core/src/message-flow/read/robot-read-strategy.js +1 -0
  308. package/dist/modules/im-core/src/message-flow/recall/channel-message-deletion-manager.js +1 -0
  309. package/dist/modules/im-core/src/message-flow/recall/recall-frame.js +1 -0
  310. package/dist/modules/im-core/src/message-flow/recall/recall-manager.js +1 -0
  311. package/dist/modules/im-core/src/message-flow/recall/recall-receive-handlers.js +1 -0
  312. package/dist/modules/im-core/src/message-flow/recall/recall-strategy.js +1 -0
  313. package/dist/modules/im-core/src/message-flow/receive/channel-application-receive-handlers.js +1 -0
  314. package/dist/modules/im-core/src/message-flow/receive/channel-notify-receive-handlers.js +1 -0
  315. package/dist/modules/im-core/src/message-flow/receive/channel-receive-handlers.js +1 -0
  316. package/dist/modules/im-core/src/message-flow/receive/command-handler-registry.js +1 -0
  317. package/dist/modules/im-core/src/message-flow/receive/contact-application-answer-receive-handlers.js +1 -0
  318. package/dist/modules/im-core/src/message-flow/receive/contact-application-receive-handlers.js +1 -0
  319. package/dist/modules/im-core/src/message-flow/receive/direct-receive-handlers.js +1 -0
  320. package/dist/modules/im-core/src/message-flow/receive/friend-action-receive-handlers.js +1 -0
  321. package/dist/modules/im-core/src/message-flow/receive/group-event-receive-handlers.js +1 -0
  322. package/dist/modules/im-core/src/message-flow/receive/group-receive-handlers.js +1 -0
  323. package/dist/modules/im-core/src/message-flow/receive/mes-chat-receive-handlers.js +1 -0
  324. package/dist/modules/im-core/src/message-flow/receive/robot-receive-handlers.js +1 -0
  325. package/dist/modules/im-core/src/message-flow/receive/session-favorite-receive-handlers.js +1 -0
  326. package/dist/modules/im-core/src/message-flow/receive/wallet-notify-receive-handlers.js +1 -0
  327. package/dist/modules/im-core/src/message-flow/send/channel-outgoing-frame.js +1 -0
  328. package/dist/modules/im-core/src/message-flow/send/channel-send-strategy.js +1 -0
  329. package/dist/modules/im-core/src/message-flow/send/direct-outgoing-frame.js +1 -0
  330. package/dist/modules/im-core/src/message-flow/send/direct-send-strategy.js +1 -0
  331. package/dist/modules/im-core/src/message-flow/send/group-outgoing-frame.js +1 -0
  332. package/dist/modules/im-core/src/message-flow/send/group-send-strategy.js +1 -0
  333. package/dist/modules/im-core/src/message-flow/send/robot-outgoing-frame.js +1 -0
  334. package/dist/modules/im-core/src/message-flow/send/robot-send-strategy.js +1 -0
  335. package/dist/modules/im-core/src/message-flow/send/send-strategy-registry.js +1 -0
  336. package/dist/modules/im-core/src/message-flow/transfer/transfer-message.js +1 -0
  337. package/dist/modules/im-core/src/outbox/outbox-manager.js +1 -0
  338. package/dist/modules/im-core/src/packet-router.js +1 -0
  339. package/dist/modules/im-core/src/ports/crypto-port.js +1 -0
  340. package/dist/modules/im-core/src/ports/crypto-task-executor.js +1 -0
  341. package/dist/modules/im-core/src/ports/http-port.js +1 -0
  342. package/dist/modules/im-core/src/ports/media-asset-cache-port.js +1 -0
  343. package/dist/modules/im-core/src/push/push-registration.js +1 -0
  344. package/dist/modules/im-core/src/read/read-reporter.js +1 -0
  345. package/dist/modules/im-core/src/request-tracker.js +1 -0
  346. package/dist/modules/im-core/src/session-favorite-album.js +1 -0
  347. package/dist/modules/im-core/src/session-favorite-files.js +1 -0
  348. package/dist/modules/im-core/src/state/channel-permissions.js +1 -0
  349. package/dist/modules/im-core/src/state/channel-restriction-coordinator.js +1 -0
  350. package/dist/modules/im-core/src/state/domain-state.js +1 -0
  351. package/dist/modules/im-core/src/state/draft-store.js +1 -0
  352. package/dist/modules/im-core/src/state/group-restriction-coordinator.js +1 -0
  353. package/dist/modules/im-core/src/state/local-message-window-read-error.js +1 -0
  354. package/dist/modules/im-core/src/state/message-reactions.js +1 -0
  355. package/dist/modules/im-core/src/state/message-store.js +1 -0
  356. package/dist/modules/im-core/src/state/message-window-store.js +1 -0
  357. package/dist/modules/im-core/src/state/pinned-message-coordinator.js +1 -0
  358. package/dist/modules/im-core/src/state/pinned-message-store.js +1 -0
  359. package/dist/modules/im-core/src/state/read-store.js +1 -0
  360. package/dist/modules/im-core/src/state/session-sort.js +1 -0
  361. package/dist/modules/im-core/src/state/session-store.js +1 -0
  362. package/dist/modules/im-core/src/sync/channel-sync-checkpoint.js +1 -0
  363. package/dist/modules/im-core/src/sync/sync-manager.js +1 -0
  364. package/dist/modules/im-i18n/src/catalog/en-US.js +1 -0
  365. package/dist/modules/im-i18n/src/catalog/index.js +1 -0
  366. package/dist/modules/im-i18n/src/catalog/th-TH.js +1 -0
  367. package/dist/modules/im-i18n/src/catalog/vi-VN.js +1 -0
  368. package/dist/modules/im-i18n/src/catalog/zh-CN.js +1 -0
  369. package/dist/modules/im-i18n/src/catalog/zh-TW.js +1 -0
  370. package/dist/modules/im-i18n/src/create-im-i18n.js +1 -0
  371. package/dist/modules/im-i18n/src/format/failure.js +1 -0
  372. package/dist/modules/im-i18n/src/format/last-message.js +1 -0
  373. package/dist/modules/im-i18n/src/format/media.js +1 -0
  374. package/dist/modules/im-i18n/src/format/mention.js +1 -0
  375. package/dist/modules/im-i18n/src/format/service-text.js +1 -0
  376. package/dist/modules/im-i18n/src/format/system-message.js +1 -0
  377. package/dist/modules/im-i18n/src/internal/duration.js +1 -0
  378. package/dist/modules/im-i18n/src/internal/interpolate.js +1 -0
  379. package/dist/modules/im-i18n/src/locale.js +1 -0
  380. package/dist/modules/im-protocol/src/board-pinned-message.js +1 -0
  381. package/dist/modules/im-protocol/src/frame-codec.js +1 -0
  382. package/dist/modules/im-protocol/src/protobuf/gen/channel_pb.js +1 -0
  383. package/dist/modules/im-protocol/src/protobuf/gen/group_pb.js +1 -0
  384. package/dist/modules/im-protocol/src/protobuf/gen/im.app.msg_pb.js +1 -0
  385. package/dist/modules/im-protocol/src/protobuf/gen/im.channel_pb.js +1 -0
  386. package/dist/modules/im-protocol/src/protobuf/gen/im.group_pb.js +1 -0
  387. package/dist/modules/im-protocol/src/protobuf/gen/im.login_pb.js +1 -0
  388. package/dist/modules/im-protocol/src/protobuf/gen/im.msg_pb.js +1 -0
  389. package/dist/modules/im-protocol/src/protobuf/gen/im.pub_pb.js +1 -0
  390. package/dist/modules/im-protocol/src/protobuf/gen/im.robot_pb.js +1 -0
  391. package/dist/modules/im-protocol/src/protobuf/gen/im.sig_pb.js +1 -0
  392. package/dist/modules/im-protocol/src/protobuf/gen/msg_pb.js +1 -0
  393. package/dist/modules/im-protocol/src/protobuf/registry.js +1 -0
  394. package/dist/modules/im-sdk/src/cache-prefix-migration.js +1 -0
  395. package/dist/modules/im-sdk/src/create-im-client.js +1 -0
  396. package/dist/modules/im-sdk/src/domains/channel.js +1 -0
  397. package/dist/modules/im-sdk/src/domains/contact.js +1 -0
  398. package/dist/modules/im-sdk/src/domains/conversation.js +1 -0
  399. package/dist/modules/im-sdk/src/domains/group.js +1 -0
  400. package/dist/modules/im-sdk/src/domains/media-byte-computation.js +1 -0
  401. package/dist/modules/im-sdk/src/domains/media.js +1 -0
  402. package/dist/modules/im-sdk/src/domains/message.js +1 -0
  403. package/dist/modules/im-sdk/src/domains/pinned-message-source.js +1 -0
  404. package/dist/modules/im-sdk/src/domains/pinned-message.js +1 -0
  405. package/dist/modules/im-sdk/src/domains/session.js +1 -0
  406. package/dist/modules/im-sdk/src/product/applications.js +1 -0
  407. package/dist/modules/im-sdk/src/product/calls.js +1 -0
  408. package/dist/modules/im-sdk/src/product/capabilities.js +1 -0
  409. package/dist/modules/im-sdk/src/product/channel-mention-candidates.js +1 -0
  410. package/dist/modules/im-sdk/src/product/conversation-background.js +1 -0
  411. package/dist/modules/im-sdk/src/product/conversation-entry-unread.js +1 -0
  412. package/dist/modules/im-sdk/src/product/conversation-handle.js +1 -0
  413. package/dist/modules/im-sdk/src/product/conversations.js +1 -0
  414. package/dist/modules/im-sdk/src/product/customer-service.js +1 -0
  415. package/dist/modules/im-sdk/src/product/diagnostic-memory-buffer.js +1 -0
  416. package/dist/modules/im-sdk/src/product/diagnostics.js +1 -0
  417. package/dist/modules/im-sdk/src/product/directory.js +1 -0
  418. package/dist/modules/im-sdk/src/product/draft.js +1 -0
  419. package/dist/modules/im-sdk/src/product/emoji-catalog.js +1 -0
  420. package/dist/modules/im-sdk/src/product/emoji-catalog.json.js +1 -0
  421. package/dist/modules/im-sdk/src/product/events.js +1 -0
  422. package/dist/modules/im-sdk/src/product/expressions.js +1 -0
  423. package/dist/modules/im-sdk/src/product/face-to-face-group.js +1 -0
  424. package/dist/modules/im-sdk/src/product/group-calls.js +1 -0
  425. package/dist/modules/im-sdk/src/product/image-format.js +1 -0
  426. package/dist/modules/im-sdk/src/product/local-data.js +1 -0
  427. package/dist/modules/im-sdk/src/product/media.js +1 -0
  428. package/dist/modules/im-sdk/src/product/mention.js +1 -0
  429. package/dist/modules/im-sdk/src/product/message.js +1 -0
  430. package/dist/modules/im-sdk/src/product/messages-by-id.js +1 -0
  431. package/dist/modules/im-sdk/src/product/outbox.js +1 -0
  432. package/dist/modules/im-sdk/src/product/profiles.js +1 -0
  433. package/dist/modules/im-sdk/src/product/resource-uploader.js +1 -0
  434. package/dist/modules/im-sdk/src/product/robots.js +1 -0
  435. package/dist/modules/im-sdk/src/product/search.js +1 -0
  436. package/dist/modules/im-sdk/src/product/session-favorites.js +1 -0
  437. package/dist/modules/im-sdk/src/product/settings.js +1 -0
  438. package/dist/modules/im-sdk/src/runtime/advanced-message-diagnostics.js +1 -0
  439. package/dist/modules/im-sdk/src/runtime/channel-read-summary-refresh.js +1 -0
  440. package/dist/modules/im-sdk/src/runtime/customer-service-legacy-recovery.js +1 -0
  441. package/dist/modules/im-sdk/src/runtime/decrypt-diagnostics.js +1 -0
  442. package/dist/modules/im-sdk/src/runtime/foreground-work-coordinator.js +1 -0
  443. package/dist/modules/im-sdk/src/runtime/group-history-page-boundary.js +1 -0
  444. package/dist/modules/im-sdk/src/runtime/key-prefetch.js +1 -0
  445. package/dist/modules/im-sdk/src/runtime/local-media-preview.js +1 -0
  446. package/dist/modules/im-sdk/src/runtime/media-cache-maintenance.js +1 -0
  447. package/dist/modules/im-sdk/src/runtime/media-upload-recovery.js +1 -0
  448. package/dist/modules/im-sdk/src/runtime/protobuf-wire-shape.js +1 -0
  449. package/dist/modules/im-sdk/src/runtime/receiving-activity.js +1 -0
  450. package/dist/modules/im-sdk/src/runtime/recent-history-fetcher.js +1 -0
  451. package/dist/modules/im-sdk/src/runtime/recent-history-prefetch.js +1 -0
  452. package/dist/modules/im-sdk/src/runtime/session-http-clients.js +1 -0
  453. package/dist/modules/im-sdk/src/runtime/session-runtime.js +1 -0
  454. package/dist/modules/im-sdk/src/runtime/signal-offline-poller.js +1 -0
  455. package/dist/request-crypto.js +1 -1
  456. package/dist/sdk.d.ts +170 -111
  457. package/dist/sdk.js +1 -1
  458. package/package.json +2 -2
  459. package/dist/browser-2MUNHRDS.js +0 -1
  460. package/dist/browser-RTCHWSQ2.js +0 -2
  461. package/dist/chunk-2OCWQHFJ.js +0 -2
  462. package/dist/chunk-46ARFR7U.js +0 -8
  463. package/dist/chunk-HQDLYL3K.js +0 -2
  464. package/dist/chunk-IC6HI33O.js +0 -1
  465. package/dist/chunk-IDECJJXC.js +0 -0
  466. package/dist/chunk-J3TLOAQI.js +0 -2
  467. package/dist/chunk-Q2DEFN53.js +0 -1
  468. package/dist/chunk-SXY56EVC.js +0 -0
  469. package/dist/chunk-WL3NFQ7Y.js +0 -1
  470. package/dist/chunk-WOT6VMZA.js +0 -1
  471. package/dist/chunk-WS7BWP7C.js +0 -1
@@ -1,25 +1,17 @@
1
- var Bn=Object.defineProperty,bn=Object.defineProperties;var _n=Object.getOwnPropertyDescriptors;var ka=Object.getOwnPropertySymbols;var Nn=Object.prototype.hasOwnProperty,Rn=Object.prototype.propertyIsEnumerable;var Da=(at,ze,$e)=>ze in at?Bn(at,ze,{enumerable:!0,configurable:!0,writable:!0,value:$e}):at[ze]=$e,Ua=(at,ze)=>{for(var $e in ze||(ze={}))Nn.call(ze,$e)&&Da(at,$e,ze[$e]);if(ka)for(var $e of ka(ze))Rn.call(ze,$e)&&Da(at,$e,ze[$e]);return at},Pa=(at,ze)=>bn(at,_n(ze));(function(){"use strict";function Va(t){if(t===null||typeof t!="object")return!1;const e=t;return e.version===1&&Number.isSafeInteger(e.generation)&&e.generation>=0&&typeof e.operationId=="string"&&e.operationId.length<=256}function Oa(t){if(!Va(t))return!1;if(t.kind==="init")return t.operationId==="";if(t.operationId==="")return!1;if(t.kind==="cancel"||t.kind==="promote")return!0;if(t.kind==="decrypt-tea"||t.kind==="encrypt-tea"){const e=t.kind==="encrypt-tea"?t.plain:t.cipherData;return t.teaKey instanceof ArrayBuffer&&t.teaKey.byteLength===16&&e instanceof ArrayBuffer&&e.byteLength<=262144&&(t.priority==="foreground"||t.priority==="background")}if(t.kind==="decrypt-batch"){if(!((t.priority==="foreground"||t.priority==="background")&&Array.isArray(t.keys)&&t.keys.every(x=>typeof x=="string")&&Array.isArray(t.items)&&t.items.length>0&&t.items.length<=8&&t.keys.length<=t.items.length&&t.items.every(x=>x!==null&&typeof x=="object"&&Number.isSafeInteger(x.itemIndex)&&x.itemIndex>=0&&Number.isSafeInteger(x.keyIndex)&&x.keyIndex>=0&&x.keyIndex<t.keys.length&&x.secretKey instanceof ArrayBuffer&&x.cipherData instanceof ArrayBuffer)))return!1;const{keys:a,items:d}=t,A=a.reduce((x,l)=>x+l.length*2,0)+d.reduce((x,l)=>x+l.secretKey.byteLength+l.cipherData.byteLength,0);return new Set(a).size===a.length&&new Set(d.map(x=>x.itemIndex)).size===d.length&&new Set(d.map(x=>x.keyIndex)).size===a.length&&(d.length===1||A<=262144)}return t.kind==="decrypt-rsa"&&t.data instanceof ArrayBuffer&&typeof t.privateKey=="string"&&(t.priority==="foreground"||t.priority==="background")}var Ka=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function Fa(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if(typeof e=="function"){var a=function d(){var A=!1;try{A=this instanceof d}catch(x){}return A?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};a.prototype=e.prototype}else a={};return Object.defineProperty(a,"__esModule",{value:!0}),Object.keys(t).forEach(function(d){var A=Object.getOwnPropertyDescriptor(t,d);Object.defineProperty(a,d,A.get?A:{enumerable:!0,get:function(){return t[d]}})}),a}var Lt,Br;function ue(){return Br||(Br=1,Lt={options:{usePureJavaScript:!1}}),Lt}var kt={exports:{}},Dt,br;function Ma(){if(br)return Dt;br=1;var t={};Dt=t;var e={};t.encode=function(d,A,x){if(typeof A!="string")throw new TypeError('"alphabet" must be a string.');if(x!==void 0&&typeof x!="number")throw new TypeError('"maxline" must be a number.');var l="";if(!(d instanceof Uint8Array))l=a(d,A);else{var r=0,g=A.length,f=A.charAt(0),S=[0];for(r=0;r<d.length;++r){for(var R=0,E=d[r];R<S.length;++R)E+=S[R]<<8,S[R]=E%g,E=E/g|0;for(;E>0;)S.push(E%g),E=E/g|0}for(r=0;d[r]===0&&r<d.length-1;++r)l+=f;for(r=S.length-1;r>=0;--r)l+=A[S[r]]}if(x){var u=new RegExp(".{1,"+x+"}","g");l=l.match(u).join(`\r
2
- `)}return l},t.decode=function(d,A){if(typeof d!="string")throw new TypeError('"input" must be a string.');if(typeof A!="string")throw new TypeError('"alphabet" must be a string.');var x=e[A];if(!x){x=e[A]=[];for(var l=0;l<A.length;++l)x[A.charCodeAt(l)]=l}d=d.replace(/\s/g,"");for(var r=A.length,g=A.charAt(0),f=[0],l=0;l<d.length;l++){var S=x[d.charCodeAt(l)];if(S===void 0)return;for(var R=0,E=S;R<f.length;++R)E+=f[R]*r,f[R]=E&255,E>>=8;for(;E>0;)f.push(E&255),E>>=8}for(var u=0;d[u]===g&&u<d.length-1;++u)f.push(0);return typeof Buffer!="undefined"?Buffer.from(f.reverse()):new Uint8Array(f.reverse())};function a(d,A){var x=0,l=A.length,r=A.charAt(0),g=[0];for(x=0;x<d.length();++x){for(var f=0,S=d.at(x);f<g.length;++f)S+=g[f]<<8,g[f]=S%l,S=S/l|0;for(;S>0;)g.push(S%l),S=S/l|0}var R="";for(x=0;d.at(x)===0&&x<d.length()-1;++x)R+=r;for(x=g.length-1;x>=0;--x)R+=A[g[x]];return R}return Dt}var _r;function ce(){if(_r)return kt.exports;_r=1;var t=ue(),e=Ma(),a=kt.exports=t.util=t.util||{};(function(){if(typeof process!="undefined"&&process.nextTick&&!process.browser){a.nextTick=process.nextTick,typeof setImmediate=="function"?a.setImmediate=setImmediate:a.setImmediate=a.nextTick;return}if(typeof setImmediate=="function"){a.setImmediate=function(){return setImmediate.apply(void 0,arguments)},a.nextTick=function(s){return setImmediate(s)};return}if(a.setImmediate=function(s){setTimeout(s,0)},typeof window!="undefined"&&typeof window.postMessage=="function"){let s=function(n){if(n.source===window&&n.data===i){n.stopPropagation();var B=h.slice();h.length=0,B.forEach(function(D){D()})}};var i="forge.setImmediate",h=[];a.setImmediate=function(n){h.push(n),h.length===1&&window.postMessage(i,"*")},window.addEventListener("message",s,!0)}if(typeof MutationObserver!="undefined"){var p=Date.now(),I=!0,L=document.createElement("div"),h=[];new MutationObserver(function(){var n=h.slice();h.length=0,n.forEach(function(B){B()})}).observe(L,{attributes:!0});var c=a.setImmediate;a.setImmediate=function(n){Date.now()-p>15?(p=Date.now(),c(n)):(h.push(n),h.length===1&&L.setAttribute("a",I=!I))}}a.nextTick=a.setImmediate})(),a.isNodejs=typeof process!="undefined"&&process.versions&&process.versions.node,a.globalScope=(function(){return a.isNodejs?Ka:typeof self=="undefined"?window:self})(),a.isArray=Array.isArray||function(i){return Object.prototype.toString.call(i)==="[object Array]"},a.isArrayBuffer=function(i){return typeof ArrayBuffer!="undefined"&&i instanceof ArrayBuffer},a.isArrayBufferView=function(i){return i&&a.isArrayBuffer(i.buffer)&&i.byteLength!==void 0};function d(i){if(!(i===8||i===16||i===24||i===32))throw new Error("Only 8, 16, 24, or 32 bits supported: "+i)}a.ByteBuffer=A;function A(i){if(this.data="",this.read=0,typeof i=="string")this.data=i;else if(a.isArrayBuffer(i)||a.isArrayBufferView(i))if(typeof Buffer!="undefined"&&i instanceof Buffer)this.data=i.toString("binary");else{var h=new Uint8Array(i);try{this.data=String.fromCharCode.apply(null,h)}catch(I){for(var p=0;p<h.length;++p)this.putByte(h[p])}}else(i instanceof A||typeof i=="object"&&typeof i.data=="string"&&typeof i.read=="number")&&(this.data=i.data,this.read=i.read);this._constructedStringLength=0}a.ByteStringBuffer=A;var x=4096;a.ByteStringBuffer.prototype._optimizeConstructedString=function(i){this._constructedStringLength+=i,this._constructedStringLength>x&&(this.data.substr(0,1),this._constructedStringLength=0)},a.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},a.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},a.ByteStringBuffer.prototype.putByte=function(i){return this.putBytes(String.fromCharCode(i))},a.ByteStringBuffer.prototype.fillWithByte=function(i,h){i=String.fromCharCode(i);for(var p=this.data;h>0;)h&1&&(p+=i),h>>>=1,h>0&&(i+=i);return this.data=p,this._optimizeConstructedString(h),this},a.ByteStringBuffer.prototype.putBytes=function(i){return this.data+=i,this._optimizeConstructedString(i.length),this},a.ByteStringBuffer.prototype.putString=function(i){return this.putBytes(a.encodeUtf8(i))},a.ByteStringBuffer.prototype.putInt16=function(i){return this.putBytes(String.fromCharCode(i>>8&255)+String.fromCharCode(i&255))},a.ByteStringBuffer.prototype.putInt24=function(i){return this.putBytes(String.fromCharCode(i>>16&255)+String.fromCharCode(i>>8&255)+String.fromCharCode(i&255))},a.ByteStringBuffer.prototype.putInt32=function(i){return this.putBytes(String.fromCharCode(i>>24&255)+String.fromCharCode(i>>16&255)+String.fromCharCode(i>>8&255)+String.fromCharCode(i&255))},a.ByteStringBuffer.prototype.putInt16Le=function(i){return this.putBytes(String.fromCharCode(i&255)+String.fromCharCode(i>>8&255))},a.ByteStringBuffer.prototype.putInt24Le=function(i){return this.putBytes(String.fromCharCode(i&255)+String.fromCharCode(i>>8&255)+String.fromCharCode(i>>16&255))},a.ByteStringBuffer.prototype.putInt32Le=function(i){return this.putBytes(String.fromCharCode(i&255)+String.fromCharCode(i>>8&255)+String.fromCharCode(i>>16&255)+String.fromCharCode(i>>24&255))},a.ByteStringBuffer.prototype.putInt=function(i,h){d(h);var p="";do h-=8,p+=String.fromCharCode(i>>h&255);while(h>0);return this.putBytes(p)},a.ByteStringBuffer.prototype.putSignedInt=function(i,h){return i<0&&(i+=2<<h-1),this.putInt(i,h)},a.ByteStringBuffer.prototype.putBuffer=function(i){return this.putBytes(i.getBytes())},a.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)},a.ByteStringBuffer.prototype.getInt16=function(){var i=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,i},a.ByteStringBuffer.prototype.getInt24=function(){var i=this.data.charCodeAt(this.read)<<16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);return this.read+=3,i},a.ByteStringBuffer.prototype.getInt32=function(){var i=this.data.charCodeAt(this.read)<<24^this.data.charCodeAt(this.read+1)<<16^this.data.charCodeAt(this.read+2)<<8^this.data.charCodeAt(this.read+3);return this.read+=4,i},a.ByteStringBuffer.prototype.getInt16Le=function(){var i=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,i},a.ByteStringBuffer.prototype.getInt24Le=function(){var i=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;return this.read+=3,i},a.ByteStringBuffer.prototype.getInt32Le=function(){var i=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16^this.data.charCodeAt(this.read+3)<<24;return this.read+=4,i},a.ByteStringBuffer.prototype.getInt=function(i){d(i);var h=0;do h=(h<<8)+this.data.charCodeAt(this.read++),i-=8;while(i>0);return h},a.ByteStringBuffer.prototype.getSignedInt=function(i){var h=this.getInt(i),p=2<<i-2;return h>=p&&(h-=p<<1),h},a.ByteStringBuffer.prototype.getBytes=function(i){var h;return i?(i=Math.min(this.length(),i),h=this.data.slice(this.read,this.read+i),this.read+=i):i===0?h="":(h=this.read===0?this.data:this.data.slice(this.read),this.clear()),h},a.ByteStringBuffer.prototype.bytes=function(i){return typeof i=="undefined"?this.data.slice(this.read):this.data.slice(this.read,this.read+i)},a.ByteStringBuffer.prototype.at=function(i){return this.data.charCodeAt(this.read+i)},a.ByteStringBuffer.prototype.setAt=function(i,h){return this.data=this.data.substr(0,this.read+i)+String.fromCharCode(h)+this.data.substr(this.read+i+1),this},a.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},a.ByteStringBuffer.prototype.copy=function(){var i=a.createBuffer(this.data);return i.read=this.read,i},a.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},a.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},a.ByteStringBuffer.prototype.truncate=function(i){var h=Math.max(0,this.length()-i);return this.data=this.data.substr(this.read,h),this.read=0,this},a.ByteStringBuffer.prototype.toHex=function(){for(var i="",h=this.read;h<this.data.length;++h){var p=this.data.charCodeAt(h);p<16&&(i+="0"),i+=p.toString(16)}return i},a.ByteStringBuffer.prototype.toString=function(){return a.decodeUtf8(this.bytes())};function l(i,h){h=h||{},this.read=h.readOffset||0,this.growSize=h.growSize||1024;var p=a.isArrayBuffer(i),I=a.isArrayBufferView(i);if(p||I){p?this.data=new DataView(i):this.data=new DataView(i.buffer,i.byteOffset,i.byteLength),this.write="writeOffset"in h?h.writeOffset:this.data.byteLength;return}this.data=new DataView(new ArrayBuffer(0)),this.write=0,i!=null&&this.putBytes(i),"writeOffset"in h&&(this.write=h.writeOffset)}a.DataBuffer=l,a.DataBuffer.prototype.length=function(){return this.write-this.read},a.DataBuffer.prototype.isEmpty=function(){return this.length()<=0},a.DataBuffer.prototype.accommodate=function(i,h){if(this.length()>=i)return this;h=Math.max(h||this.growSize,i);var p=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),I=new Uint8Array(this.length()+h);return I.set(p),this.data=new DataView(I.buffer),this},a.DataBuffer.prototype.putByte=function(i){return this.accommodate(1),this.data.setUint8(this.write++,i),this},a.DataBuffer.prototype.fillWithByte=function(i,h){this.accommodate(h);for(var p=0;p<h;++p)this.data.setUint8(i);return this},a.DataBuffer.prototype.putBytes=function(i,h){if(a.isArrayBufferView(i)){var p=new Uint8Array(i.buffer,i.byteOffset,i.byteLength),I=p.byteLength-p.byteOffset;this.accommodate(I);var L=new Uint8Array(this.data.buffer,this.write);return L.set(p),this.write+=I,this}if(a.isArrayBuffer(i)){var p=new Uint8Array(i);this.accommodate(p.byteLength);var L=new Uint8Array(this.data.buffer);return L.set(p,this.write),this.write+=p.byteLength,this}if(i instanceof a.DataBuffer||typeof i=="object"&&typeof i.read=="number"&&typeof i.write=="number"&&a.isArrayBufferView(i.data)){var p=new Uint8Array(i.data.byteLength,i.read,i.length());this.accommodate(p.byteLength);var L=new Uint8Array(i.data.byteLength,this.write);return L.set(p),this.write+=p.byteLength,this}if(i instanceof a.ByteStringBuffer&&(i=i.data,h="binary"),h=h||"binary",typeof i=="string"){var c;if(h==="hex")return this.accommodate(Math.ceil(i.length/2)),c=new Uint8Array(this.data.buffer,this.write),this.write+=a.binary.hex.decode(i,c,this.write),this;if(h==="base64")return this.accommodate(Math.ceil(i.length/4)*3),c=new Uint8Array(this.data.buffer,this.write),this.write+=a.binary.base64.decode(i,c,this.write),this;if(h==="utf8"&&(i=a.encodeUtf8(i),h="binary"),h==="binary"||h==="raw")return this.accommodate(i.length),c=new Uint8Array(this.data.buffer,this.write),this.write+=a.binary.raw.decode(c),this;if(h==="utf16")return this.accommodate(i.length*2),c=new Uint16Array(this.data.buffer,this.write),this.write+=a.text.utf16.encode(c),this;throw new Error("Invalid encoding: "+h)}throw Error("Invalid parameter: "+i)},a.DataBuffer.prototype.putBuffer=function(i){return this.putBytes(i),i.clear(),this},a.DataBuffer.prototype.putString=function(i){return this.putBytes(i,"utf16")},a.DataBuffer.prototype.putInt16=function(i){return this.accommodate(2),this.data.setInt16(this.write,i),this.write+=2,this},a.DataBuffer.prototype.putInt24=function(i){return this.accommodate(3),this.data.setInt16(this.write,i>>8&65535),this.data.setInt8(this.write,i>>16&255),this.write+=3,this},a.DataBuffer.prototype.putInt32=function(i){return this.accommodate(4),this.data.setInt32(this.write,i),this.write+=4,this},a.DataBuffer.prototype.putInt16Le=function(i){return this.accommodate(2),this.data.setInt16(this.write,i,!0),this.write+=2,this},a.DataBuffer.prototype.putInt24Le=function(i){return this.accommodate(3),this.data.setInt8(this.write,i>>16&255),this.data.setInt16(this.write,i>>8&65535,!0),this.write+=3,this},a.DataBuffer.prototype.putInt32Le=function(i){return this.accommodate(4),this.data.setInt32(this.write,i,!0),this.write+=4,this},a.DataBuffer.prototype.putInt=function(i,h){d(h),this.accommodate(h/8);do h-=8,this.data.setInt8(this.write++,i>>h&255);while(h>0);return this},a.DataBuffer.prototype.putSignedInt=function(i,h){return d(h),this.accommodate(h/8),i<0&&(i+=2<<h-1),this.putInt(i,h)},a.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)},a.DataBuffer.prototype.getInt16=function(){var i=this.data.getInt16(this.read);return this.read+=2,i},a.DataBuffer.prototype.getInt24=function(){var i=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,i},a.DataBuffer.prototype.getInt32=function(){var i=this.data.getInt32(this.read);return this.read+=4,i},a.DataBuffer.prototype.getInt16Le=function(){var i=this.data.getInt16(this.read,!0);return this.read+=2,i},a.DataBuffer.prototype.getInt24Le=function(){var i=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,i},a.DataBuffer.prototype.getInt32Le=function(){var i=this.data.getInt32(this.read,!0);return this.read+=4,i},a.DataBuffer.prototype.getInt=function(i){d(i);var h=0;do h=(h<<8)+this.data.getInt8(this.read++),i-=8;while(i>0);return h},a.DataBuffer.prototype.getSignedInt=function(i){var h=this.getInt(i),p=2<<i-2;return h>=p&&(h-=p<<1),h},a.DataBuffer.prototype.getBytes=function(i){var h;return i?(i=Math.min(this.length(),i),h=this.data.slice(this.read,this.read+i),this.read+=i):i===0?h="":(h=this.read===0?this.data:this.data.slice(this.read),this.clear()),h},a.DataBuffer.prototype.bytes=function(i){return typeof i=="undefined"?this.data.slice(this.read):this.data.slice(this.read,this.read+i)},a.DataBuffer.prototype.at=function(i){return this.data.getUint8(this.read+i)},a.DataBuffer.prototype.setAt=function(i,h){return this.data.setUint8(i,h),this},a.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},a.DataBuffer.prototype.copy=function(){return new a.DataBuffer(this)},a.DataBuffer.prototype.compact=function(){if(this.read>0){var i=new Uint8Array(this.data.buffer,this.read),h=new Uint8Array(i.byteLength);h.set(i),this.data=new DataView(h),this.write-=this.read,this.read=0}return this},a.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},a.DataBuffer.prototype.truncate=function(i){return this.write=Math.max(0,this.length()-i),this.read=Math.min(this.read,this.write),this},a.DataBuffer.prototype.toHex=function(){for(var i="",h=this.read;h<this.data.byteLength;++h){var p=this.data.getUint8(h);p<16&&(i+="0"),i+=p.toString(16)}return i},a.DataBuffer.prototype.toString=function(i){var h=new Uint8Array(this.data,this.read,this.length());if(i=i||"utf8",i==="binary"||i==="raw")return a.binary.raw.encode(h);if(i==="hex")return a.binary.hex.encode(h);if(i==="base64")return a.binary.base64.encode(h);if(i==="utf8")return a.text.utf8.decode(h);if(i==="utf16")return a.text.utf16.decode(h);throw new Error("Invalid encoding: "+i)},a.createBuffer=function(i,h){return h=h||"raw",i!==void 0&&h==="utf8"&&(i=a.encodeUtf8(i)),new a.ByteBuffer(i)},a.fillString=function(i,h){for(var p="";h>0;)h&1&&(p+=i),h>>>=1,h>0&&(i+=i);return p},a.xorBytes=function(i,h,p){for(var I="",L="",c="",s=0,n=0;p>0;--p,++s)L=i.charCodeAt(s)^h.charCodeAt(s),n>=10&&(I+=c,c="",n=0),c+=String.fromCharCode(L),++n;return I+=c,I},a.hexToBytes=function(i){var h="",p=0;for(i.length&!0&&(p=1,h+=String.fromCharCode(parseInt(i[0],16)));p<i.length;p+=2)h+=String.fromCharCode(parseInt(i.substr(p,2),16));return h},a.bytesToHex=function(i){return a.createBuffer(i).toHex()},a.int32ToBytes=function(i){return String.fromCharCode(i>>24&255)+String.fromCharCode(i>>16&255)+String.fromCharCode(i>>8&255)+String.fromCharCode(i&255)};var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",g=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],f="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";a.encode64=function(i,h){for(var p="",I="",L,c,s,n=0;n<i.length;)L=i.charCodeAt(n++),c=i.charCodeAt(n++),s=i.charCodeAt(n++),p+=r.charAt(L>>2),p+=r.charAt((L&3)<<4|c>>4),isNaN(c)?p+="==":(p+=r.charAt((c&15)<<2|s>>6),p+=isNaN(s)?"=":r.charAt(s&63)),h&&p.length>h&&(I+=p.substr(0,h)+`\r
3
- `,p=p.substr(h));return I+=p,I},a.decode64=function(i){i=i.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var h="",p,I,L,c,s=0;s<i.length;)p=g[i.charCodeAt(s++)-43],I=g[i.charCodeAt(s++)-43],L=g[i.charCodeAt(s++)-43],c=g[i.charCodeAt(s++)-43],h+=String.fromCharCode(p<<2|I>>4),L!==64&&(h+=String.fromCharCode((I&15)<<4|L>>2),c!==64&&(h+=String.fromCharCode((L&3)<<6|c)));return h},a.encodeUtf8=function(i){return unescape(encodeURIComponent(i))},a.decodeUtf8=function(i){return decodeURIComponent(escape(i))},a.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:e.encode,decode:e.decode}},a.binary.raw.encode=function(i){return String.fromCharCode.apply(null,i)},a.binary.raw.decode=function(i,h,p){var I=h;I||(I=new Uint8Array(i.length)),p=p||0;for(var L=p,c=0;c<i.length;++c)I[L++]=i.charCodeAt(c);return h?L-p:I},a.binary.hex.encode=a.bytesToHex,a.binary.hex.decode=function(i,h,p){var I=h;I||(I=new Uint8Array(Math.ceil(i.length/2))),p=p||0;var L=0,c=p;for(i.length&1&&(L=1,I[c++]=parseInt(i[0],16));L<i.length;L+=2)I[c++]=parseInt(i.substr(L,2),16);return h?c-p:I},a.binary.base64.encode=function(i,h){for(var p="",I="",L,c,s,n=0;n<i.byteLength;)L=i[n++],c=i[n++],s=i[n++],p+=r.charAt(L>>2),p+=r.charAt((L&3)<<4|c>>4),isNaN(c)?p+="==":(p+=r.charAt((c&15)<<2|s>>6),p+=isNaN(s)?"=":r.charAt(s&63)),h&&p.length>h&&(I+=p.substr(0,h)+`\r
4
- `,p=p.substr(h));return I+=p,I},a.binary.base64.decode=function(i,h,p){var I=h;I||(I=new Uint8Array(Math.ceil(i.length/4)*3)),i=i.replace(/[^A-Za-z0-9\+\/\=]/g,""),p=p||0;for(var L,c,s,n,B=0,D=p;B<i.length;)L=g[i.charCodeAt(B++)-43],c=g[i.charCodeAt(B++)-43],s=g[i.charCodeAt(B++)-43],n=g[i.charCodeAt(B++)-43],I[D++]=L<<2|c>>4,s!==64&&(I[D++]=(c&15)<<4|s>>2,n!==64&&(I[D++]=(s&3)<<6|n));return h?D-p:I.subarray(0,D)},a.binary.base58.encode=function(i,h){return a.binary.baseN.encode(i,f,h)},a.binary.base58.decode=function(i,h){return a.binary.baseN.decode(i,f,h)},a.text={utf8:{},utf16:{}},a.text.utf8.encode=function(i,h,p){i=a.encodeUtf8(i);var I=h;I||(I=new Uint8Array(i.length)),p=p||0;for(var L=p,c=0;c<i.length;++c)I[L++]=i.charCodeAt(c);return h?L-p:I},a.text.utf8.decode=function(i){return a.decodeUtf8(String.fromCharCode.apply(null,i))},a.text.utf16.encode=function(i,h,p){var I=h;I||(I=new Uint8Array(i.length*2));var L=new Uint16Array(I.buffer);p=p||0;for(var c=p,s=p,n=0;n<i.length;++n)L[s++]=i.charCodeAt(n),c+=2;return h?c-p:I},a.text.utf16.decode=function(i){return String.fromCharCode.apply(null,new Uint16Array(i.buffer))},a.deflate=function(i,h,p){if(h=a.decode64(i.deflate(a.encode64(h)).rval),p){var I=2,L=h.charCodeAt(1);L&32&&(I=6),h=h.substring(I,h.length-4)}return h},a.inflate=function(i,h,p){var I=i.inflate(a.encode64(h)).rval;return I===null?null:a.decode64(I)};var S=function(i,h,p){if(!i)throw new Error("WebStorage not available.");var I;if(p===null?I=i.removeItem(h):(p=a.encode64(JSON.stringify(p)),I=i.setItem(h,p)),typeof I!="undefined"&&I.rval!==!0){var L=new Error(I.error.message);throw L.id=I.error.id,L.name=I.error.name,L}},R=function(i,h){if(!i)throw new Error("WebStorage not available.");var p=i.getItem(h);if(i.init)if(p.rval===null){if(p.error){var I=new Error(p.error.message);throw I.id=p.error.id,I.name=p.error.name,I}p=null}else p=p.rval;return p!==null&&(p=JSON.parse(a.decode64(p))),p},E=function(i,h,p,I){var L=R(i,h);L===null&&(L={}),L[p]=I,S(i,h,L)},u=function(i,h,p){var I=R(i,h);return I!==null&&(I=p in I?I[p]:null),I},v=function(i,h,p){var I=R(i,h);if(I!==null&&p in I){delete I[p];var L=!0;for(var c in I){L=!1;break}L&&(I=null),S(i,h,I)}},C=function(i,h){S(i,h,null)},y=function(i,h,p){var I=null;typeof p=="undefined"&&(p=["web","flash"]);var L,c=!1,s=null;for(var n in p){L=p[n];try{if(L==="flash"||L==="both"){if(h[0]===null)throw new Error("Flash local storage not available.");I=i.apply(this,h),c=L==="flash"}(L==="web"||L==="both")&&(h[0]=localStorage,I=i.apply(this,h),c=!0)}catch(B){s=B}if(c)break}if(!c)throw s;return I};return a.setItem=function(i,h,p,I,L){y(E,arguments,L)},a.getItem=function(i,h,p,I){return y(u,arguments,I)},a.removeItem=function(i,h,p,I){y(v,arguments,I)},a.clearItems=function(i,h,p){y(C,arguments,p)},a.isEmpty=function(i){for(var h in i)if(i.hasOwnProperty(h))return!1;return!0},a.format=function(i){for(var h=/%./g,p,I,L=0,c=[],s=0;p=h.exec(i);){I=i.substring(s,h.lastIndex-2),I.length>0&&c.push(I),s=h.lastIndex;var n=p[0][1];switch(n){case"s":case"o":L<arguments.length?c.push(arguments[L+++1]):c.push("<?>");break;case"%":c.push("%");break;default:c.push("<%"+n+"?>")}}return c.push(i.substring(s)),c.join("")},a.formatNumber=function(i,h,p,I){var L=i,c=isNaN(h=Math.abs(h))?2:h,s=p===void 0?",":p,n=I===void 0?".":I,B=L<0?"-":"",D=parseInt(L=Math.abs(+L||0).toFixed(c),10)+"",O=D.length>3?D.length%3:0;return B+(O?D.substr(0,O)+n:"")+D.substr(O).replace(/(\d{3})(?=\d)/g,"$1"+n)+(c?s+Math.abs(L-D).toFixed(c).slice(2):"")},a.formatSize=function(i){return i>=1073741824?i=a.formatNumber(i/1073741824,2,".","")+" GiB":i>=1048576?i=a.formatNumber(i/1048576,2,".","")+" MiB":i>=1024?i=a.formatNumber(i/1024,0)+" KiB":i=a.formatNumber(i,0)+" bytes",i},a.bytesFromIP=function(i){return i.indexOf(".")!==-1?a.bytesFromIPv4(i):i.indexOf(":")!==-1?a.bytesFromIPv6(i):null},a.bytesFromIPv4=function(i){if(i=i.split("."),i.length!==4)return null;for(var h=a.createBuffer(),p=0;p<i.length;++p){var I=parseInt(i[p],10);if(isNaN(I))return null;h.putByte(I)}return h.getBytes()},a.bytesFromIPv6=function(i){var h=0;i=i.split(":").filter(function(s){return s.length===0&&++h,!0});for(var p=(8-i.length+h)*2,I=a.createBuffer(),L=0;L<8;++L){if(!i[L]||i[L].length===0){I.fillWithByte(0,p),p=0;continue}var c=a.hexToBytes(i[L]);c.length<2&&I.putByte(0),I.putBytes(c)}return I.getBytes()},a.bytesToIP=function(i){return i.length===4?a.bytesToIPv4(i):i.length===16?a.bytesToIPv6(i):null},a.bytesToIPv4=function(i){if(i.length!==4)return null;for(var h=[],p=0;p<i.length;++p)h.push(i.charCodeAt(p));return h.join(".")},a.bytesToIPv6=function(i){if(i.length!==16)return null;for(var h=[],p=[],I=0,L=0;L<i.length;L+=2){for(var c=a.bytesToHex(i[L]+i[L+1]);c[0]==="0"&&c!=="0";)c=c.substr(1);if(c==="0"){var s=p[p.length-1],n=h.length;!s||n!==s.end+1?p.push({start:n,end:n}):(s.end=n,s.end-s.start>p[I].end-p[I].start&&(I=p.length-1))}h.push(c)}if(p.length>0){var B=p[I];B.end-B.start>0&&(h.splice(B.start,B.end-B.start+1,""),B.start===0&&h.unshift(""),B.end===7&&h.push(""))}return h.join(":")},a.estimateCores=function(i,h){if(typeof i=="function"&&(h=i,i={}),i=i||{},"cores"in a&&!i.update)return h(null,a.cores);if(typeof navigator!="undefined"&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return a.cores=navigator.hardwareConcurrency,h(null,a.cores);if(typeof Worker=="undefined")return a.cores=1,h(null,a.cores);if(typeof Blob=="undefined")return a.cores=2,h(null,a.cores);var p=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(s){var n=Date.now(),B=n+4;self.postMessage({st:n,et:B})})}.toString(),")()"],{type:"application/javascript"}));I([],5,16);function I(s,n,B){if(n===0){var D=Math.floor(s.reduce(function(O,P){return O+P},0)/s.length);return a.cores=Math.max(1,D),URL.revokeObjectURL(p),h(null,a.cores)}L(B,function(O,P){s.push(c(B,P)),I(s,n-1,B)})}function L(s,n){for(var B=[],D=[],O=0;O<s;++O){var P=new Worker(p);P.addEventListener("message",function(K){if(D.push(K.data),D.length===s){for(var q=0;q<s;++q)B[q].terminate();n(null,D)}}),B.push(P)}for(var O=0;O<s;++O)B[O].postMessage(O)}function c(s,n){for(var B=[],D=0;D<s;++D)for(var O=n[D],P=B[D]=[],K=0;K<s;++K)if(D!==K){var q=n[K];(O.st>q.st&&O.st<q.et||q.st>O.st&&q.st<O.et)&&P.push(K)}return B.reduce(function(M,G){return Math.max(M,G.length)},0)}},kt.exports}var Ut,Nr;function Pt(){if(Nr)return Ut;Nr=1;var t=ue();ce(),Ut=t.cipher=t.cipher||{},t.cipher.algorithms=t.cipher.algorithms||{},t.cipher.createCipher=function(a,d){var A=a;if(typeof A=="string"&&(A=t.cipher.getAlgorithm(A),A&&(A=A())),!A)throw new Error("Unsupported algorithm: "+a);return new t.cipher.BlockCipher({algorithm:A,key:d,decrypt:!1})},t.cipher.createDecipher=function(a,d){var A=a;if(typeof A=="string"&&(A=t.cipher.getAlgorithm(A),A&&(A=A())),!A)throw new Error("Unsupported algorithm: "+a);return new t.cipher.BlockCipher({algorithm:A,key:d,decrypt:!0})},t.cipher.registerAlgorithm=function(a,d){a=a.toUpperCase(),t.cipher.algorithms[a]=d},t.cipher.getAlgorithm=function(a){return a=a.toUpperCase(),a in t.cipher.algorithms?t.cipher.algorithms[a]:null};var e=t.cipher.BlockCipher=function(a){this.algorithm=a.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=a.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=a.decrypt,this.algorithm.initialize(a)};return e.prototype.start=function(a){a=a||{};var d={};for(var A in a)d[A]=a[A];d.decrypt=this._decrypt,this._finish=!1,this._input=t.util.createBuffer(),this.output=a.output||t.util.createBuffer(),this.mode.start(d)},e.prototype.update=function(a){for(a&&this._input.putBuffer(a);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},e.prototype.finish=function(a){a&&(this.mode.name==="ECB"||this.mode.name==="CBC")&&(this.mode.pad=function(A){return a(this.blockSize,A,!1)},this.mode.unpad=function(A){return a(this.blockSize,A,!0)});var d={};return d.decrypt=this._decrypt,d.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,d)||(this._finish=!0,this.update(),this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,d))||this.mode.afterFinish&&!this.mode.afterFinish(this.output,d))},Ut}var Vt={exports:{}},Rr;function wr(){if(Rr)return Vt.exports;Rr=1;var t=ue();ce(),t.cipher=t.cipher||{};var e=Vt.exports=t.cipher.modes=t.cipher.modes||{};e.ecb=function(x){x=x||{},this.name="ECB",this.cipher=x.cipher,this.blockSize=x.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},e.ecb.prototype.start=function(x){},e.ecb.prototype.encrypt=function(x,l,r){if(x.length()<this.blockSize&&!(r&&x.length()>0))return!0;for(var g=0;g<this._ints;++g)this._inBlock[g]=x.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var g=0;g<this._ints;++g)l.putInt32(this._outBlock[g])},e.ecb.prototype.decrypt=function(x,l,r){if(x.length()<this.blockSize&&!(r&&x.length()>0))return!0;for(var g=0;g<this._ints;++g)this._inBlock[g]=x.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var g=0;g<this._ints;++g)l.putInt32(this._outBlock[g])},e.ecb.prototype.pad=function(x,l){var r=x.length()===this.blockSize?this.blockSize:this.blockSize-x.length();return x.fillWithByte(r,r),!0},e.ecb.prototype.unpad=function(x,l){if(l.overflow>0)return!1;var r=x.length(),g=x.at(r-1);return g>this.blockSize<<2?!1:(x.truncate(g),!0)},e.cbc=function(x){x=x||{},this.name="CBC",this.cipher=x.cipher,this.blockSize=x.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},e.cbc.prototype.start=function(x){if(x.iv===null){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else if("iv"in x)this._iv=a(x.iv,this.blockSize),this._prev=this._iv.slice(0);else throw new Error("Invalid IV parameter.")},e.cbc.prototype.encrypt=function(x,l,r){if(x.length()<this.blockSize&&!(r&&x.length()>0))return!0;for(var g=0;g<this._ints;++g)this._inBlock[g]=this._prev[g]^x.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var g=0;g<this._ints;++g)l.putInt32(this._outBlock[g]);this._prev=this._outBlock},e.cbc.prototype.decrypt=function(x,l,r){if(x.length()<this.blockSize&&!(r&&x.length()>0))return!0;for(var g=0;g<this._ints;++g)this._inBlock[g]=x.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var g=0;g<this._ints;++g)l.putInt32(this._prev[g]^this._outBlock[g]);this._prev=this._inBlock.slice(0)},e.cbc.prototype.pad=function(x,l){var r=x.length()===this.blockSize?this.blockSize:this.blockSize-x.length();return x.fillWithByte(r,r),!0},e.cbc.prototype.unpad=function(x,l){if(l.overflow>0)return!1;var r=x.length(),g=x.at(r-1);return g>this.blockSize<<2?!1:(x.truncate(g),!0)},e.cfb=function(x){x=x||{},this.name="CFB",this.cipher=x.cipher,this.blockSize=x.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=t.util.createBuffer(),this._partialBytes=0},e.cfb.prototype.start=function(x){if(!("iv"in x))throw new Error("Invalid IV parameter.");this._iv=a(x.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},e.cfb.prototype.encrypt=function(x,l,r){var g=x.length();if(g===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&g>=this.blockSize){for(var f=0;f<this._ints;++f)this._inBlock[f]=x.getInt32()^this._outBlock[f],l.putInt32(this._inBlock[f]);return}var S=(this.blockSize-g)%this.blockSize;S>0&&(S=this.blockSize-S),this._partialOutput.clear();for(var f=0;f<this._ints;++f)this._partialBlock[f]=x.getInt32()^this._outBlock[f],this._partialOutput.putInt32(this._partialBlock[f]);if(S>0)x.read-=this.blockSize;else for(var f=0;f<this._ints;++f)this._inBlock[f]=this._partialBlock[f];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),S>0&&!r)return l.putBytes(this._partialOutput.getBytes(S-this._partialBytes)),this._partialBytes=S,!0;l.putBytes(this._partialOutput.getBytes(g-this._partialBytes)),this._partialBytes=0},e.cfb.prototype.decrypt=function(x,l,r){var g=x.length();if(g===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&g>=this.blockSize){for(var f=0;f<this._ints;++f)this._inBlock[f]=x.getInt32(),l.putInt32(this._inBlock[f]^this._outBlock[f]);return}var S=(this.blockSize-g)%this.blockSize;S>0&&(S=this.blockSize-S),this._partialOutput.clear();for(var f=0;f<this._ints;++f)this._partialBlock[f]=x.getInt32(),this._partialOutput.putInt32(this._partialBlock[f]^this._outBlock[f]);if(S>0)x.read-=this.blockSize;else for(var f=0;f<this._ints;++f)this._inBlock[f]=this._partialBlock[f];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),S>0&&!r)return l.putBytes(this._partialOutput.getBytes(S-this._partialBytes)),this._partialBytes=S,!0;l.putBytes(this._partialOutput.getBytes(g-this._partialBytes)),this._partialBytes=0},e.ofb=function(x){x=x||{},this.name="OFB",this.cipher=x.cipher,this.blockSize=x.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=t.util.createBuffer(),this._partialBytes=0},e.ofb.prototype.start=function(x){if(!("iv"in x))throw new Error("Invalid IV parameter.");this._iv=a(x.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},e.ofb.prototype.encrypt=function(x,l,r){var g=x.length();if(x.length()===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&g>=this.blockSize){for(var f=0;f<this._ints;++f)l.putInt32(x.getInt32()^this._outBlock[f]),this._inBlock[f]=this._outBlock[f];return}var S=(this.blockSize-g)%this.blockSize;S>0&&(S=this.blockSize-S),this._partialOutput.clear();for(var f=0;f<this._ints;++f)this._partialOutput.putInt32(x.getInt32()^this._outBlock[f]);if(S>0)x.read-=this.blockSize;else for(var f=0;f<this._ints;++f)this._inBlock[f]=this._outBlock[f];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),S>0&&!r)return l.putBytes(this._partialOutput.getBytes(S-this._partialBytes)),this._partialBytes=S,!0;l.putBytes(this._partialOutput.getBytes(g-this._partialBytes)),this._partialBytes=0},e.ofb.prototype.decrypt=e.ofb.prototype.encrypt,e.ctr=function(x){x=x||{},this.name="CTR",this.cipher=x.cipher,this.blockSize=x.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=t.util.createBuffer(),this._partialBytes=0},e.ctr.prototype.start=function(x){if(!("iv"in x))throw new Error("Invalid IV parameter.");this._iv=a(x.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},e.ctr.prototype.encrypt=function(x,l,r){var g=x.length();if(g===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&g>=this.blockSize)for(var f=0;f<this._ints;++f)l.putInt32(x.getInt32()^this._outBlock[f]);else{var S=(this.blockSize-g)%this.blockSize;S>0&&(S=this.blockSize-S),this._partialOutput.clear();for(var f=0;f<this._ints;++f)this._partialOutput.putInt32(x.getInt32()^this._outBlock[f]);if(S>0&&(x.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),S>0&&!r)return l.putBytes(this._partialOutput.getBytes(S-this._partialBytes)),this._partialBytes=S,!0;l.putBytes(this._partialOutput.getBytes(g-this._partialBytes)),this._partialBytes=0}d(this._inBlock)},e.ctr.prototype.decrypt=e.ctr.prototype.encrypt,e.gcm=function(x){x=x||{},this.name="GCM",this.cipher=x.cipher,this.blockSize=x.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=t.util.createBuffer(),this._partialBytes=0,this._R=3774873600},e.gcm.prototype.start=function(x){if(!("iv"in x))throw new Error("Invalid IV parameter.");var l=t.util.createBuffer(x.iv);this._cipherLength=0;var r;if("additionalData"in x?r=t.util.createBuffer(x.additionalData):r=t.util.createBuffer(),"tagLength"in x?this._tagLength=x.tagLength:this._tagLength=128,this._tag=null,x.decrypt&&(this._tag=t.util.createBuffer(x.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var g=l.length();if(g===12)this._j0=[l.getInt32(),l.getInt32(),l.getInt32(),1];else{for(this._j0=[0,0,0,0];l.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[l.getInt32(),l.getInt32(),l.getInt32(),l.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(A(g*8)))}this._inBlock=this._j0.slice(0),d(this._inBlock),this._partialBytes=0,r=t.util.createBuffer(r),this._aDataLength=A(r.length()*8);var f=r.length()%this.blockSize;for(f&&r.fillWithByte(0,this.blockSize-f),this._s=[0,0,0,0];r.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()])},e.gcm.prototype.encrypt=function(x,l,r){var g=x.length();if(g===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&g>=this.blockSize){for(var f=0;f<this._ints;++f)l.putInt32(this._outBlock[f]^=x.getInt32());this._cipherLength+=this.blockSize}else{var S=(this.blockSize-g)%this.blockSize;S>0&&(S=this.blockSize-S),this._partialOutput.clear();for(var f=0;f<this._ints;++f)this._partialOutput.putInt32(x.getInt32()^this._outBlock[f]);if(S<=0||r){if(r){var R=g%this.blockSize;this._cipherLength+=R,this._partialOutput.truncate(this.blockSize-R)}else this._cipherLength+=this.blockSize;for(var f=0;f<this._ints;++f)this._outBlock[f]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),S>0&&!r)return x.read-=this.blockSize,l.putBytes(this._partialOutput.getBytes(S-this._partialBytes)),this._partialBytes=S,!0;l.putBytes(this._partialOutput.getBytes(g-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),d(this._inBlock)},e.gcm.prototype.decrypt=function(x,l,r){var g=x.length();if(g<this.blockSize&&!(r&&g>0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),d(this._inBlock),this._hashBlock[0]=x.getInt32(),this._hashBlock[1]=x.getInt32(),this._hashBlock[2]=x.getInt32(),this._hashBlock[3]=x.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var f=0;f<this._ints;++f)l.putInt32(this._outBlock[f]^this._hashBlock[f]);g<this.blockSize?this._cipherLength+=g%this.blockSize:this._cipherLength+=this.blockSize},e.gcm.prototype.afterFinish=function(x,l){var r=!0;l.decrypt&&l.overflow&&x.truncate(this.blockSize-l.overflow),this.tag=t.util.createBuffer();var g=this._aDataLength.concat(A(this._cipherLength*8));this._s=this.ghash(this._hashSubkey,this._s,g);var f=[];this.cipher.encrypt(this._j0,f);for(var S=0;S<this._ints;++S)this.tag.putInt32(this._s[S]^f[S]);return this.tag.truncate(this.tag.length()%(this._tagLength/8)),l.decrypt&&this.tag.bytes()!==this._tag&&(r=!1),r},e.gcm.prototype.multiply=function(x,l){for(var r=[0,0,0,0],g=l.slice(0),f=0;f<128;++f){var S=x[f/32|0]&1<<31-f%32;S&&(r[0]^=g[0],r[1]^=g[1],r[2]^=g[2],r[3]^=g[3]),this.pow(g,g)}return r},e.gcm.prototype.pow=function(x,l){for(var r=x[3]&1,g=3;g>0;--g)l[g]=x[g]>>>1|(x[g-1]&1)<<31;l[0]=x[0]>>>1,r&&(l[0]^=this._R)},e.gcm.prototype.tableMultiply=function(x){for(var l=[0,0,0,0],r=0;r<32;++r){var g=r/8|0,f=x[g]>>>(7-r%8)*4&15,S=this._m[r][f];l[0]^=S[0],l[1]^=S[1],l[2]^=S[2],l[3]^=S[3]}return l},e.gcm.prototype.ghash=function(x,l,r){return l[0]^=r[0],l[1]^=r[1],l[2]^=r[2],l[3]^=r[3],this.tableMultiply(l)},e.gcm.prototype.generateHashTable=function(x,l){for(var r=8/l,g=4*r,f=16*r,S=new Array(f),R=0;R<f;++R){var E=[0,0,0,0],u=R/g|0,v=(g-1-R%g)*l;E[u]=1<<l-1<<v,S[R]=this.generateSubHashTable(this.multiply(E,x),l)}return S},e.gcm.prototype.generateSubHashTable=function(x,l){var r=1<<l,g=r>>>1,f=new Array(r);f[g]=x.slice(0);for(var S=g>>>1;S>0;)this.pow(f[2*S],f[S]=[]),S>>=1;for(S=2;S<g;){for(var R=1;R<S;++R){var E=f[S],u=f[R];f[S+R]=[E[0]^u[0],E[1]^u[1],E[2]^u[2],E[3]^u[3]]}S*=2}for(f[0]=[0,0,0,0],S=g+1;S<r;++S){var v=f[S^g];f[S]=[x[0]^v[0],x[1]^v[1],x[2]^v[2],x[3]^v[3]]}return f};function a(x,l){if(typeof x=="string"&&(x=t.util.createBuffer(x)),t.util.isArray(x)&&x.length>4){var r=x;x=t.util.createBuffer();for(var g=0;g<r.length;++g)x.putByte(r[g])}if(x.length()<l)throw new Error("Invalid IV length; got "+x.length()+" bytes and expected "+l+" bytes.");if(!t.util.isArray(x)){for(var f=[],S=l/4,g=0;g<S;++g)f.push(x.getInt32());x=f}return x}function d(x){x[x.length-1]=x[x.length-1]+1&4294967295}function A(x){return[x/4294967296|0,x&4294967295]}return Vt.exports}var Ot,Lr;function ct(){if(Lr)return Ot;Lr=1;var t=ue();Pt(),wr(),ce(),Ot=t.aes=t.aes||{},t.aes.startEncrypting=function(u,v,C,y){var i=E({key:u,output:C,decrypt:!1,mode:y});return i.start(v),i},t.aes.createEncryptionCipher=function(u,v){return E({key:u,output:null,decrypt:!1,mode:v})},t.aes.startDecrypting=function(u,v,C,y){var i=E({key:u,output:C,decrypt:!0,mode:y});return i.start(v),i},t.aes.createDecryptionCipher=function(u,v){return E({key:u,output:null,decrypt:!0,mode:v})},t.aes.Algorithm=function(u,v){a||f();var C=this;C.name=u,C.mode=new v({blockSize:16,cipher:{encrypt:function(y,i){return R(C._w,y,i,!1)},decrypt:function(y,i){return R(C._w,y,i,!0)}}}),C._init=!1},t.aes.Algorithm.prototype.initialize=function(u){if(!this._init){var v=u.key,C;if(typeof v=="string"&&(v.length===16||v.length===24||v.length===32))v=t.util.createBuffer(v);else if(t.util.isArray(v)&&(v.length===16||v.length===24||v.length===32)){C=v,v=t.util.createBuffer();for(var y=0;y<C.length;++y)v.putByte(C[y])}if(!t.util.isArray(v)){C=v,v=[];var i=C.length();if(i===16||i===24||i===32){i=i>>>2;for(var y=0;y<i;++y)v.push(C.getInt32())}}if(!t.util.isArray(v)||!(v.length===4||v.length===6||v.length===8))throw new Error("Invalid key parameter.");var h=this.mode.name,p=["CFB","OFB","CTR","GCM"].indexOf(h)!==-1;this._w=S(v,u.decrypt&&!p),this._init=!0}},t.aes._expandKey=function(u,v){return a||f(),S(u,v)},t.aes._updateBlock=R,e("AES-ECB",t.cipher.modes.ecb),e("AES-CBC",t.cipher.modes.cbc),e("AES-CFB",t.cipher.modes.cfb),e("AES-OFB",t.cipher.modes.ofb),e("AES-CTR",t.cipher.modes.ctr),e("AES-GCM",t.cipher.modes.gcm);function e(u,v){var C=function(){return new t.aes.Algorithm(u,v)};t.cipher.registerAlgorithm(u,C)}var a=!1,d=4,A,x,l,r,g;function f(){a=!0,l=[0,1,2,4,8,16,32,64,128,27,54];for(var u=new Array(256),v=0;v<128;++v)u[v]=v<<1,u[v+128]=v+128<<1^283;A=new Array(256),x=new Array(256),r=new Array(4),g=new Array(4);for(var v=0;v<4;++v)r[v]=new Array(256),g[v]=new Array(256);for(var C=0,y=0,i,h,p,I,L,c,s,v=0;v<256;++v){I=y^y<<1^y<<2^y<<3^y<<4,I=I>>8^I&255^99,A[C]=I,x[I]=C,L=u[I],i=u[C],h=u[i],p=u[h],c=L<<24^I<<16^I<<8^(I^L),s=(i^h^p)<<24^(C^p)<<16^(C^h^p)<<8^(C^i^p);for(var n=0;n<4;++n)r[n][C]=c,g[n][I]=s,c=c<<24|c>>>8,s=s<<24|s>>>8;C===0?C=y=1:(C=i^u[u[u[i^p]]],y^=u[u[y]])}}function S(u,v){for(var C=u.slice(0),y,i=1,h=C.length,p=h+6+1,I=d*p,L=h;L<I;++L)y=C[L-1],L%h===0?(y=A[y>>>16&255]<<24^A[y>>>8&255]<<16^A[y&255]<<8^A[y>>>24]^l[i]<<24,i++):h>6&&L%h===4&&(y=A[y>>>24]<<24^A[y>>>16&255]<<16^A[y>>>8&255]<<8^A[y&255]),C[L]=C[L-h]^y;if(v){var c,s=g[0],n=g[1],B=g[2],D=g[3],O=C.slice(0);I=C.length;for(var L=0,P=I-d;L<I;L+=d,P-=d)if(L===0||L===I-d)O[L]=C[P],O[L+1]=C[P+3],O[L+2]=C[P+2],O[L+3]=C[P+1];else for(var K=0;K<d;++K)c=C[P+K],O[L+(3&-K)]=s[A[c>>>24]]^n[A[c>>>16&255]]^B[A[c>>>8&255]]^D[A[c&255]];C=O}return C}function R(u,v,C,y){var i=u.length/4-1,h,p,I,L,c;y?(h=g[0],p=g[1],I=g[2],L=g[3],c=x):(h=r[0],p=r[1],I=r[2],L=r[3],c=A);var s,n,B,D,O,P,K;s=v[0]^u[0],n=v[y?3:1]^u[1],B=v[2]^u[2],D=v[y?1:3]^u[3];for(var q=3,M=1;M<i;++M)O=h[s>>>24]^p[n>>>16&255]^I[B>>>8&255]^L[D&255]^u[++q],P=h[n>>>24]^p[B>>>16&255]^I[D>>>8&255]^L[s&255]^u[++q],K=h[B>>>24]^p[D>>>16&255]^I[s>>>8&255]^L[n&255]^u[++q],D=h[D>>>24]^p[s>>>16&255]^I[n>>>8&255]^L[B&255]^u[++q],s=O,n=P,B=K;C[0]=c[s>>>24]<<24^c[n>>>16&255]<<16^c[B>>>8&255]<<8^c[D&255]^u[++q],C[y?3:1]=c[n>>>24]<<24^c[B>>>16&255]<<16^c[D>>>8&255]<<8^c[s&255]^u[++q],C[2]=c[B>>>24]<<24^c[D>>>16&255]<<16^c[s>>>8&255]<<8^c[n&255]^u[++q],C[y?1:3]=c[D>>>24]<<24^c[s>>>16&255]<<16^c[n>>>8&255]<<8^c[B&255]^u[++q]}function E(u){u=u||{};var v=(u.mode||"CBC").toUpperCase(),C="AES-"+v,y;u.decrypt?y=t.cipher.createDecipher(C,u.key):y=t.cipher.createCipher(C,u.key);var i=y.start;return y.start=function(h,p){var I=null;p instanceof t.util.ByteBuffer&&(I=p,p={}),p=p||{},p.output=I,p.iv=h,i.call(y,p)},y}return Ot}var Kt={exports:{}},Ft={exports:{}},Mt={exports:{}},kr;function ht(){if(kr)return Mt.exports;kr=1;var t=ue();t.pki=t.pki||{};var e=Mt.exports=t.pki.oids=t.oids=t.oids||{};function a(A,x){e[A]=x,e[x]=A}function d(A,x){e[A]=x}return a("1.2.840.113549.1.1.1","rsaEncryption"),a("1.2.840.113549.1.1.4","md5WithRSAEncryption"),a("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),a("1.2.840.113549.1.1.7","RSAES-OAEP"),a("1.2.840.113549.1.1.8","mgf1"),a("1.2.840.113549.1.1.9","pSpecified"),a("1.2.840.113549.1.1.10","RSASSA-PSS"),a("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),a("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),a("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),a("1.3.101.112","EdDSA25519"),a("1.2.840.10040.4.3","dsa-with-sha1"),a("1.3.14.3.2.7","desCBC"),a("1.3.14.3.2.26","sha1"),a("1.3.14.3.2.29","sha1WithRSASignature"),a("2.16.840.1.101.3.4.2.1","sha256"),a("2.16.840.1.101.3.4.2.2","sha384"),a("2.16.840.1.101.3.4.2.3","sha512"),a("2.16.840.1.101.3.4.2.4","sha224"),a("2.16.840.1.101.3.4.2.5","sha512-224"),a("2.16.840.1.101.3.4.2.6","sha512-256"),a("1.2.840.113549.2.2","md2"),a("1.2.840.113549.2.5","md5"),a("1.2.840.113549.1.7.1","data"),a("1.2.840.113549.1.7.2","signedData"),a("1.2.840.113549.1.7.3","envelopedData"),a("1.2.840.113549.1.7.4","signedAndEnvelopedData"),a("1.2.840.113549.1.7.5","digestedData"),a("1.2.840.113549.1.7.6","encryptedData"),a("1.2.840.113549.1.9.1","emailAddress"),a("1.2.840.113549.1.9.2","unstructuredName"),a("1.2.840.113549.1.9.3","contentType"),a("1.2.840.113549.1.9.4","messageDigest"),a("1.2.840.113549.1.9.5","signingTime"),a("1.2.840.113549.1.9.6","counterSignature"),a("1.2.840.113549.1.9.7","challengePassword"),a("1.2.840.113549.1.9.8","unstructuredAddress"),a("1.2.840.113549.1.9.14","extensionRequest"),a("1.2.840.113549.1.9.20","friendlyName"),a("1.2.840.113549.1.9.21","localKeyId"),a("1.2.840.113549.1.9.22.1","x509Certificate"),a("1.2.840.113549.1.12.10.1.1","keyBag"),a("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),a("1.2.840.113549.1.12.10.1.3","certBag"),a("1.2.840.113549.1.12.10.1.4","crlBag"),a("1.2.840.113549.1.12.10.1.5","secretBag"),a("1.2.840.113549.1.12.10.1.6","safeContentsBag"),a("1.2.840.113549.1.5.13","pkcs5PBES2"),a("1.2.840.113549.1.5.12","pkcs5PBKDF2"),a("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),a("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),a("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),a("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),a("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),a("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),a("1.2.840.113549.2.7","hmacWithSHA1"),a("1.2.840.113549.2.8","hmacWithSHA224"),a("1.2.840.113549.2.9","hmacWithSHA256"),a("1.2.840.113549.2.10","hmacWithSHA384"),a("1.2.840.113549.2.11","hmacWithSHA512"),a("1.2.840.113549.3.7","des-EDE3-CBC"),a("2.16.840.1.101.3.4.1.2","aes128-CBC"),a("2.16.840.1.101.3.4.1.22","aes192-CBC"),a("2.16.840.1.101.3.4.1.42","aes256-CBC"),a("2.5.4.3","commonName"),a("2.5.4.4","surname"),a("2.5.4.5","serialNumber"),a("2.5.4.6","countryName"),a("2.5.4.7","localityName"),a("2.5.4.8","stateOrProvinceName"),a("2.5.4.9","streetAddress"),a("2.5.4.10","organizationName"),a("2.5.4.11","organizationalUnitName"),a("2.5.4.12","title"),a("2.5.4.13","description"),a("2.5.4.15","businessCategory"),a("2.5.4.17","postalCode"),a("2.5.4.42","givenName"),a("2.5.4.65","pseudonym"),a("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName"),a("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName"),a("2.16.840.1.113730.1.1","nsCertType"),a("2.16.840.1.113730.1.13","nsComment"),d("2.5.29.1","authorityKeyIdentifier"),d("2.5.29.2","keyAttributes"),d("2.5.29.3","certificatePolicies"),d("2.5.29.4","keyUsageRestriction"),d("2.5.29.5","policyMapping"),d("2.5.29.6","subtreesConstraint"),d("2.5.29.7","subjectAltName"),d("2.5.29.8","issuerAltName"),d("2.5.29.9","subjectDirectoryAttributes"),d("2.5.29.10","basicConstraints"),d("2.5.29.11","nameConstraints"),d("2.5.29.12","policyConstraints"),d("2.5.29.13","basicConstraints"),a("2.5.29.14","subjectKeyIdentifier"),a("2.5.29.15","keyUsage"),d("2.5.29.16","privateKeyUsagePeriod"),a("2.5.29.17","subjectAltName"),a("2.5.29.18","issuerAltName"),a("2.5.29.19","basicConstraints"),d("2.5.29.20","cRLNumber"),d("2.5.29.21","cRLReason"),d("2.5.29.22","expirationDate"),d("2.5.29.23","instructionCode"),d("2.5.29.24","invalidityDate"),d("2.5.29.25","cRLDistributionPoints"),d("2.5.29.26","issuingDistributionPoint"),d("2.5.29.27","deltaCRLIndicator"),d("2.5.29.28","issuingDistributionPoint"),d("2.5.29.29","certificateIssuer"),d("2.5.29.30","nameConstraints"),a("2.5.29.31","cRLDistributionPoints"),a("2.5.29.32","certificatePolicies"),d("2.5.29.33","policyMappings"),d("2.5.29.34","policyConstraints"),a("2.5.29.35","authorityKeyIdentifier"),d("2.5.29.36","policyConstraints"),a("2.5.29.37","extKeyUsage"),d("2.5.29.46","freshestCRL"),d("2.5.29.54","inhibitAnyPolicy"),a("1.3.6.1.4.1.11129.2.4.2","timestampList"),a("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),a("1.3.6.1.5.5.7.3.1","serverAuth"),a("1.3.6.1.5.5.7.3.2","clientAuth"),a("1.3.6.1.5.5.7.3.3","codeSigning"),a("1.3.6.1.5.5.7.3.4","emailProtection"),a("1.3.6.1.5.5.7.3.8","timeStamping"),Mt.exports}var Dr;function nt(){if(Dr)return Ft.exports;Dr=1;var t=ue();ce(),ht();var e=Ft.exports=t.asn1=t.asn1||{};e.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},e.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},e.maxDepth=256,e.create=function(l,r,g,f,S){if(t.util.isArray(f)){for(var R=[],E=0;E<f.length;++E)f[E]!==void 0&&R.push(f[E]);f=R}var u={tagClass:l,type:r,constructed:g,composed:g||t.util.isArray(f),value:f};return S&&"bitStringContents"in S&&(u.bitStringContents=S.bitStringContents,u.original=e.copy(u)),u},e.copy=function(l,r){var g;if(t.util.isArray(l)){g=[];for(var f=0;f<l.length;++f)g.push(e.copy(l[f],r));return g}return typeof l=="string"?l:(g={tagClass:l.tagClass,type:l.type,constructed:l.constructed,composed:l.composed,value:e.copy(l.value,r)},r&&!r.excludeBitStringContents&&(g.bitStringContents=l.bitStringContents),g)},e.equals=function(l,r,g){if(t.util.isArray(l)){if(!t.util.isArray(r)||l.length!==r.length)return!1;for(var f=0;f<l.length;++f)if(!e.equals(l[f],r[f]))return!1;return!0}if(typeof l!=typeof r)return!1;if(typeof l=="string")return l===r;var S=l.tagClass===r.tagClass&&l.type===r.type&&l.constructed===r.constructed&&l.composed===r.composed&&e.equals(l.value,r.value);return g&&g.includeBitStringContents&&(S=S&&l.bitStringContents===r.bitStringContents),S},e.getBerValueLength=function(l){var r=l.getByte();if(r!==128){var g,f=r&128;return f?g=l.getInt((r&127)<<3):g=r,g}};function a(l,r,g){if(g>r){var f=new Error("Too few bytes to parse DER.");throw f.available=l.length(),f.remaining=r,f.requested=g,f}}var d=function(l,r){var g=l.getByte();if(r--,g!==128){var f,S=g&128;if(!S)f=g;else{var R=g&127;a(l,r,R),f=l.getInt(R<<3)}if(f<0)throw new Error("Negative length: "+f);return f}};e.fromDer=function(l,r){r===void 0&&(r={strict:!0,parseAllBytes:!0,decodeBitStrings:!0}),typeof r=="boolean"&&(r={strict:r,parseAllBytes:!0,decodeBitStrings:!0}),"strict"in r||(r.strict=!0),"parseAllBytes"in r||(r.parseAllBytes=!0),"decodeBitStrings"in r||(r.decodeBitStrings=!0),"maxDepth"in r||(r.maxDepth=e.maxDepth),typeof l=="string"&&(l=t.util.createBuffer(l));var g=l.length(),f=A(l,l.length(),0,r);if(r.parseAllBytes&&l.length()!==0){var S=new Error("Unparsed DER bytes remain after ASN.1 parsing.");throw S.byteCount=g,S.remaining=l.length(),S}return f};function A(l,r,g,f){if(g>=f.maxDepth)throw new Error("ASN.1 parsing error: Max depth exceeded.");var S;a(l,r,2);var R=l.getByte();r--;var E=R&192,u=R&31;S=l.length();var v=d(l,r);if(r-=S-l.length(),v!==void 0&&v>r){if(f.strict){var C=new Error("Too few bytes to read ASN.1 value.");throw C.available=l.length(),C.remaining=r,C.requested=v,C}v=r}var y,i,h=(R&32)===32;if(h)if(y=[],v===void 0)for(;;){if(a(l,r,2),l.bytes(2)==="\0\0"){l.getBytes(2),r-=2;break}S=l.length(),y.push(A(l,r,g+1,f)),r-=S-l.length()}else for(;v>0;)S=l.length(),y.push(A(l,v,g+1,f)),r-=S-l.length(),v-=S-l.length();if(y===void 0&&E===e.Class.UNIVERSAL&&u===e.Type.BITSTRING&&(i=l.bytes(v)),y===void 0&&f.decodeBitStrings&&E===e.Class.UNIVERSAL&&u===e.Type.BITSTRING&&v>1){var p=l.read,I=r,L=0;if(u===e.Type.BITSTRING&&(a(l,r,1),L=l.getByte(),r--),L===0)try{S=l.length();var c={strict:!0,decodeBitStrings:!0},s=A(l,r,g+1,c),n=S-l.length();r-=n,u==e.Type.BITSTRING&&n++;var B=s.tagClass;n===v&&(B===e.Class.UNIVERSAL||B===e.Class.CONTEXT_SPECIFIC)&&(y=[s])}catch(O){}y===void 0&&(l.read=p,r=I)}if(y===void 0){if(v===void 0){if(f.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");v=r}if(u===e.Type.BMPSTRING)for(y="";v>0;v-=2)a(l,r,2),y+=String.fromCharCode(l.getInt16()),r-=2;else y=l.getBytes(v),r-=v}var D=i===void 0?null:{bitStringContents:i};return e.create(E,u,h,y,D)}e.toDer=function(l){var r=t.util.createBuffer(),g=l.tagClass|l.type,f=t.util.createBuffer(),S=!1;if("bitStringContents"in l&&(S=!0,l.original&&(S=e.equals(l,l.original))),S)f.putBytes(l.bitStringContents);else if(l.composed){l.constructed?g|=32:f.putByte(0);for(var R=0;R<l.value.length;++R)l.value[R]!==void 0&&f.putBuffer(e.toDer(l.value[R]))}else if(l.type===e.Type.BMPSTRING)for(var R=0;R<l.value.length;++R)f.putInt16(l.value.charCodeAt(R));else l.type===e.Type.INTEGER&&l.value.length>1&&(l.value.charCodeAt(0)===0&&(l.value.charCodeAt(1)&128)===0||l.value.charCodeAt(0)===255&&(l.value.charCodeAt(1)&128)===128)?f.putBytes(l.value.substr(1)):f.putBytes(l.value);if(r.putByte(g),f.length()<=127)r.putByte(f.length()&127);else{var E=f.length(),u="";do u+=String.fromCharCode(E&255),E=E>>>8;while(E>0);r.putByte(u.length|128);for(var R=u.length-1;R>=0;--R)r.putByte(u.charCodeAt(R))}return r.putBuffer(f),r},e.oidToDer=function(l){var r=l.split("."),g=t.util.createBuffer();g.putByte(40*parseInt(r[0],10)+parseInt(r[1],10));for(var f,S,R,E,u=2;u<r.length;++u){if(f=!0,S=[],R=parseInt(r[u],10),R>4294967295)throw new Error("OID value too large; max is 32-bits.");do E=R&127,R=R>>>7,f||(E|=128),S.push(E),f=!1;while(R>0);for(var v=S.length-1;v>=0;--v)g.putByte(S[v])}return g},e.derToOid=function(l){var r;typeof l=="string"&&(l=t.util.createBuffer(l));var g=l.getByte();r=Math.floor(g/40)+"."+g%40;for(var f=0;l.length()>0;){if(f>70368744177663)throw new Error("OID value too large; max is 53-bits.");g=l.getByte(),f=f*128,g&128?f+=g&127:(r+="."+(f+g),f=0)}return r},e.utcTimeToDate=function(l){var r=new Date,g=parseInt(l.substr(0,2),10);g=g>=50?1900+g:2e3+g;var f=parseInt(l.substr(2,2),10)-1,S=parseInt(l.substr(4,2),10),R=parseInt(l.substr(6,2),10),E=parseInt(l.substr(8,2),10),u=0;if(l.length>11){var v=l.charAt(10),C=10;v!=="+"&&v!=="-"&&(u=parseInt(l.substr(10,2),10),C+=2)}if(r.setUTCFullYear(g,f,S),r.setUTCHours(R,E,u,0),C&&(v=l.charAt(C),v==="+"||v==="-")){var y=parseInt(l.substr(C+1,2),10),i=parseInt(l.substr(C+4,2),10),h=y*60+i;h*=6e4,v==="+"?r.setTime(+r-h):r.setTime(+r+h)}return r},e.generalizedTimeToDate=function(l){var r=new Date,g=parseInt(l.substr(0,4),10),f=parseInt(l.substr(4,2),10)-1,S=parseInt(l.substr(6,2),10),R=parseInt(l.substr(8,2),10),E=parseInt(l.substr(10,2),10),u=parseInt(l.substr(12,2),10),v=0,C=0,y=!1;l.charAt(l.length-1)==="Z"&&(y=!0);var i=l.length-5,h=l.charAt(i);if(h==="+"||h==="-"){var p=parseInt(l.substr(i+1,2),10),I=parseInt(l.substr(i+4,2),10);C=p*60+I,C*=6e4,h==="+"&&(C*=-1),y=!0}return l.charAt(14)==="."&&(v=parseFloat(l.substr(14),10)*1e3),y?(r.setUTCFullYear(g,f,S),r.setUTCHours(R,E,u,v),r.setTime(+r+C)):(r.setFullYear(g,f,S),r.setHours(R,E,u,v)),r},e.dateToUtcTime=function(l){if(typeof l=="string")return l;var r="",g=[];g.push((""+l.getUTCFullYear()).substr(2)),g.push(""+(l.getUTCMonth()+1)),g.push(""+l.getUTCDate()),g.push(""+l.getUTCHours()),g.push(""+l.getUTCMinutes()),g.push(""+l.getUTCSeconds());for(var f=0;f<g.length;++f)g[f].length<2&&(r+="0"),r+=g[f];return r+="Z",r},e.dateToGeneralizedTime=function(l){if(typeof l=="string")return l;var r="",g=[];g.push(""+l.getUTCFullYear()),g.push(""+(l.getUTCMonth()+1)),g.push(""+l.getUTCDate()),g.push(""+l.getUTCHours()),g.push(""+l.getUTCMinutes()),g.push(""+l.getUTCSeconds());for(var f=0;f<g.length;++f)g[f].length<2&&(r+="0"),r+=g[f];return r+="Z",r},e.integerToDer=function(l){var r=t.util.createBuffer();if(l>=-128&&l<128)return r.putSignedInt(l,8);if(l>=-32768&&l<32768)return r.putSignedInt(l,16);if(l>=-8388608&&l<8388608)return r.putSignedInt(l,24);if(l>=-2147483648&&l<2147483648)return r.putSignedInt(l,32);var g=new Error("Integer too large; max is 32-bits.");throw g.integer=l,g},e.derToInteger=function(l){typeof l=="string"&&(l=t.util.createBuffer(l));var r=l.length()*8;if(r>32)throw new Error("Integer too large; max is 32-bits.");return l.getSignedInt(r)},e.validate=function(l,r,g,f){var S=!1;if((l.tagClass===r.tagClass||typeof r.tagClass=="undefined")&&(l.type===r.type||typeof r.type=="undefined"))if(l.constructed===r.constructed||typeof r.constructed=="undefined"){if(S=!0,r.value&&t.util.isArray(r.value))for(var R=0,E=0;S&&E<r.value.length;++E){var u=r.value[E];S=!!u.optional;var v=l.value[R];if(!v){u.optional||(S=!1,f&&f.push("["+r.name+'] Missing required element. Expected tag class "'+u.tagClass+'", type "'+u.type+'"'));continue}var C=typeof u.tagClass!="undefined"&&typeof u.type!="undefined";if(C&&(v.tagClass!==u.tagClass||v.type!==u.type))if(u.optional){S=!0;continue}else{S=!1,f&&f.push("["+r.name+"] Tag mismatch. Expected ("+u.tagClass+","+u.type+"), got ("+v.tagClass+","+v.type+")");break}var y=e.validate(v,u,g,f);if(y)++R,S=!0;else if(u.optional)S=!0;else{S=!1;break}}if(S&&g&&(r.capture&&(g[r.capture]=l.value),r.captureAsn1&&(g[r.captureAsn1]=l),r.captureBitStringContents&&"bitStringContents"in l&&(g[r.captureBitStringContents]=l.bitStringContents),r.captureBitStringValue&&"bitStringContents"in l))if(l.bitStringContents.length<2)g[r.captureBitStringValue]="";else{var i=l.bitStringContents.charCodeAt(0);if(i!==0)throw new Error("captureBitStringValue only supported for zero unused bits");g[r.captureBitStringValue]=l.bitStringContents.slice(1)}}else f&&f.push("["+r.name+'] Expected constructed "'+r.constructed+'", got "'+l.constructed+'"');else f&&(l.tagClass!==r.tagClass&&f.push("["+r.name+'] Expected tag class "'+r.tagClass+'", got "'+l.tagClass+'"'),l.type!==r.type&&f.push("["+r.name+'] Expected type "'+r.type+'", got "'+l.type+'"'));return S};var x=/[^\\u0000-\\u00ff]/;return e.prettyPrint=function(l,r,g){var f="";r=r||0,g=g||2,r>0&&(f+=`
5
- `);for(var S="",R=0;R<r*g;++R)S+=" ";switch(f+=S+"Tag: ",l.tagClass){case e.Class.UNIVERSAL:f+="Universal:";break;case e.Class.APPLICATION:f+="Application:";break;case e.Class.CONTEXT_SPECIFIC:f+="Context-Specific:";break;case e.Class.PRIVATE:f+="Private:";break}if(l.tagClass===e.Class.UNIVERSAL)switch(f+=l.type,l.type){case e.Type.NONE:f+=" (None)";break;case e.Type.BOOLEAN:f+=" (Boolean)";break;case e.Type.INTEGER:f+=" (Integer)";break;case e.Type.BITSTRING:f+=" (Bit string)";break;case e.Type.OCTETSTRING:f+=" (Octet string)";break;case e.Type.NULL:f+=" (Null)";break;case e.Type.OID:f+=" (Object Identifier)";break;case e.Type.ODESC:f+=" (Object Descriptor)";break;case e.Type.EXTERNAL:f+=" (External or Instance of)";break;case e.Type.REAL:f+=" (Real)";break;case e.Type.ENUMERATED:f+=" (Enumerated)";break;case e.Type.EMBEDDED:f+=" (Embedded PDV)";break;case e.Type.UTF8:f+=" (UTF8)";break;case e.Type.ROID:f+=" (Relative Object Identifier)";break;case e.Type.SEQUENCE:f+=" (Sequence)";break;case e.Type.SET:f+=" (Set)";break;case e.Type.PRINTABLESTRING:f+=" (Printable String)";break;case e.Type.IA5String:f+=" (IA5String (ASCII))";break;case e.Type.UTCTIME:f+=" (UTC time)";break;case e.Type.GENERALIZEDTIME:f+=" (Generalized time)";break;case e.Type.BMPSTRING:f+=" (BMP String)";break}else f+=l.type;if(f+=`
6
- `,f+=S+"Constructed: "+l.constructed+`
7
- `,l.composed){for(var E=0,u="",R=0;R<l.value.length;++R)l.value[R]!==void 0&&(E+=1,u+=e.prettyPrint(l.value[R],r+1,g),R+1<l.value.length&&(u+=","));f+=S+"Sub values: "+E+u}else{if(f+=S+"Value: ",l.type===e.Type.OID){var v=e.derToOid(l.value);f+=v,t.pki&&t.pki.oids&&v in t.pki.oids&&(f+=" ("+t.pki.oids[v]+") ")}if(l.type===e.Type.INTEGER)try{f+=e.derToInteger(l.value)}catch(y){f+="0x"+t.util.bytesToHex(l.value)}else if(l.type===e.Type.BITSTRING){if(l.value.length>1?f+="0x"+t.util.bytesToHex(l.value.slice(1)):f+="(none)",l.value.length>0){var C=l.value.charCodeAt(0);C==1?f+=" (1 unused bit shown)":C>1&&(f+=" ("+C+" unused bits shown)")}}else if(l.type===e.Type.OCTETSTRING)x.test(l.value)||(f+="("+l.value+") "),f+="0x"+t.util.bytesToHex(l.value);else if(l.type===e.Type.UTF8)try{f+=t.util.decodeUtf8(l.value)}catch(y){if(y.message==="URI malformed")f+="0x"+t.util.bytesToHex(l.value)+" (malformed UTF8)";else throw y}else l.type===e.Type.PRINTABLESTRING||l.type===e.Type.IA5String?f+=l.value:x.test(l.value)?f+="0x"+t.util.bytesToHex(l.value):l.value.length===0?f+="[null]":f+=l.value}return f},Ft.exports}var qt={exports:{}},Ht,Ur;function st(){if(Ur)return Ht;Ur=1;var t=ue();return Ht=t.md=t.md||{},t.md.algorithms=t.md.algorithms||{},Ht}var Pr;function Ct(){if(Pr)return qt.exports;Pr=1;var t=ue();st(),ce();var e=qt.exports=t.hmac=t.hmac||{};return e.create=function(){var a=null,d=null,A=null,x=null,l={};return l.start=function(r,g){if(r!==null)if(typeof r=="string")if(r=r.toLowerCase(),r in t.md.algorithms)d=t.md.algorithms[r].create();else throw new Error('Unknown hash algorithm "'+r+'"');else d=r;if(g===null)g=a;else{if(typeof g=="string")g=t.util.createBuffer(g);else if(t.util.isArray(g)){var f=g;g=t.util.createBuffer();for(var S=0;S<f.length;++S)g.putByte(f[S])}var R=g.length();R>d.blockLength&&(d.start(),d.update(g.bytes()),g=d.digest()),A=t.util.createBuffer(),x=t.util.createBuffer(),R=g.length();for(var S=0;S<R;++S){var f=g.at(S);A.putByte(54^f),x.putByte(92^f)}if(R<d.blockLength)for(var f=d.blockLength-R,S=0;S<f;++S)A.putByte(54),x.putByte(92);a=g,A=A.bytes(),x=x.bytes()}d.start(),d.update(A)},l.update=function(r){d.update(r)},l.getMac=function(){var r=d.digest().bytes();return d.start(),d.update(x),d.update(r),d.digest()},l.digest=l.getMac,l},qt.exports}var Gt={exports:{}},Vr;function Qt(){if(Vr)return Gt.exports;Vr=1;var t=ue();st(),ce();var e=Gt.exports=t.md5=t.md5||{};t.md.md5=t.md.algorithms.md5=e,e.create=function(){l||r();var f=null,S=t.util.createBuffer(),R=new Array(16),E={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8};return E.start=function(){E.messageLength=0,E.fullMessageLength=E.messageLength64=[];for(var u=E.messageLengthSize/4,v=0;v<u;++v)E.fullMessageLength.push(0);return S=t.util.createBuffer(),f={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878},E},E.start(),E.update=function(u,v){v==="utf8"&&(u=t.util.encodeUtf8(u));var C=u.length;E.messageLength+=C,C=[C/4294967296>>>0,C>>>0];for(var y=E.fullMessageLength.length-1;y>=0;--y)E.fullMessageLength[y]+=C[1],C[1]=C[0]+(E.fullMessageLength[y]/4294967296>>>0),E.fullMessageLength[y]=E.fullMessageLength[y]>>>0,C[0]=C[1]/4294967296>>>0;return S.putBytes(u),g(f,R,S),(S.read>2048||S.length()===0)&&S.compact(),E},E.digest=function(){var u=t.util.createBuffer();u.putBytes(S.bytes());var v=E.fullMessageLength[E.fullMessageLength.length-1]+E.messageLengthSize,C=v&E.blockLength-1;u.putBytes(a.substr(0,E.blockLength-C));for(var y,i=0,h=E.fullMessageLength.length-1;h>=0;--h)y=E.fullMessageLength[h]*8+i,i=y/4294967296>>>0,u.putInt32Le(y>>>0);var p={h0:f.h0,h1:f.h1,h2:f.h2,h3:f.h3};g(p,R,u);var I=t.util.createBuffer();return I.putInt32Le(p.h0),I.putInt32Le(p.h1),I.putInt32Le(p.h2),I.putInt32Le(p.h3),I},E};var a=null,d=null,A=null,x=null,l=!1;function r(){a="€",a+=t.util.fillString("\0",64),d=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9],A=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],x=new Array(64);for(var f=0;f<64;++f)x[f]=Math.floor(Math.abs(Math.sin(f+1))*4294967296);l=!0}function g(f,S,R){for(var E,u,v,C,y,i,h,p,I=R.length();I>=64;){for(u=f.h0,v=f.h1,C=f.h2,y=f.h3,p=0;p<16;++p)S[p]=R.getInt32Le(),i=y^v&(C^y),E=u+i+x[p]+S[p],h=A[p],u=y,y=C,C=v,v+=E<<h|E>>>32-h;for(;p<32;++p)i=C^y&(v^C),E=u+i+x[p]+S[d[p]],h=A[p],u=y,y=C,C=v,v+=E<<h|E>>>32-h;for(;p<48;++p)i=v^C^y,E=u+i+x[p]+S[d[p]],h=A[p],u=y,y=C,C=v,v+=E<<h|E>>>32-h;for(;p<64;++p)i=C^(v|~y),E=u+i+x[p]+S[d[p]],h=A[p],u=y,y=C,C=v,v+=E<<h|E>>>32-h;f.h0=f.h0+u|0,f.h1=f.h1+v|0,f.h2=f.h2+C|0,f.h3=f.h3+y|0,I-=64}}return Gt.exports}var zt={exports:{}},Or;function pt(){if(Or)return zt.exports;Or=1;var t=ue();ce();var e=zt.exports=t.pem=t.pem||{};e.encode=function(A,x){x=x||{};var l="-----BEGIN "+A.type+`-----\r
8
- `,r;if(A.procType&&(r={name:"Proc-Type",values:[String(A.procType.version),A.procType.type]},l+=a(r)),A.contentDomain&&(r={name:"Content-Domain",values:[A.contentDomain]},l+=a(r)),A.dekInfo&&(r={name:"DEK-Info",values:[A.dekInfo.algorithm]},A.dekInfo.parameters&&r.values.push(A.dekInfo.parameters),l+=a(r)),A.headers)for(var g=0;g<A.headers.length;++g)l+=a(A.headers[g]);return A.procType&&(l+=`\r
9
- `),l+=t.util.encode64(A.body,x.maxline||64)+`\r
10
- `,l+="-----END "+A.type+`-----\r
11
- `,l},e.decode=function(A){for(var x=[],l=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,r=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,g=/\r?\n/,f;f=l.exec(A),!!f;){var S=f[1];S==="NEW CERTIFICATE REQUEST"&&(S="CERTIFICATE REQUEST");var R={type:S,procType:null,contentDomain:null,dekInfo:null,headers:[],body:t.util.decode64(f[3])};if(x.push(R),!!f[2]){for(var E=f[2].split(g),u=0;f&&u<E.length;){for(var v=E[u].replace(/\s+$/,""),C=u+1;C<E.length;++C){var y=E[C];if(!/\s/.test(y[0]))break;v+=y,u=C}if(f=v.match(r),f){for(var i={name:f[1],values:[]},h=f[2].split(","),p=0;p<h.length;++p)i.values.push(d(h[p]));if(R.procType)if(!R.contentDomain&&i.name==="Content-Domain")R.contentDomain=h[0]||"";else if(!R.dekInfo&&i.name==="DEK-Info"){if(i.values.length===0)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');R.dekInfo={algorithm:h[0],parameters:h[1]||null}}else R.headers.push(i);else{if(i.name!=="Proc-Type")throw new Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(i.values.length!==2)throw new Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');R.procType={version:h[0],type:h[1]}}}++u}if(R.procType==="ENCRYPTED"&&!R.dekInfo)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".')}}if(x.length===0)throw new Error("Invalid PEM formatted message.");return x};function a(A){for(var x=A.name+": ",l=[],r=function(E,u){return" "+u},g=0;g<A.values.length;++g)l.push(A.values[g].replace(/^(\S+\r\n)/,r));x+=l.join(",")+`\r
12
- `;for(var f=0,S=-1,g=0;g<x.length;++g,++f)if(f>65&&S!==-1){var R=x[S];R===","?(++S,x=x.substr(0,S)+`\r
13
- `+x.substr(S)):x=x.substr(0,S)+`\r
14
- `+R+x.substr(S+1),f=g-S-1,S=-1,++g}else(x[g]===" "||x[g]===" "||x[g]===",")&&(S=g);return x}function d(A){return A.replace(/^\s+/,"")}return zt.exports}var Yt={exports:{}},Xt,Kr;function St(){if(Kr)return Xt;Kr=1;var t=ue();Pt(),wr(),ce(),Xt=t.des=t.des||{},t.des.startEncrypting=function(u,v,C,y){var i=E({key:u,output:C,decrypt:!1,mode:y||(v===null?"ECB":"CBC")});return i.start(v),i},t.des.createEncryptionCipher=function(u,v){return E({key:u,output:null,decrypt:!1,mode:v})},t.des.startDecrypting=function(u,v,C,y){var i=E({key:u,output:C,decrypt:!0,mode:y||(v===null?"ECB":"CBC")});return i.start(v),i},t.des.createDecryptionCipher=function(u,v){return E({key:u,output:null,decrypt:!0,mode:v})},t.des.Algorithm=function(u,v){var C=this;C.name=u,C.mode=new v({blockSize:8,cipher:{encrypt:function(y,i){return R(C._keys,y,i,!1)},decrypt:function(y,i){return R(C._keys,y,i,!0)}}}),C._init=!1},t.des.Algorithm.prototype.initialize=function(u){if(!this._init){var v=t.util.createBuffer(u.key);if(this.name.indexOf("3DES")===0&&v.length()!==24)throw new Error("Invalid Triple-DES key size: "+v.length()*8);this._keys=S(v),this._init=!0}},e("DES-ECB",t.cipher.modes.ecb),e("DES-CBC",t.cipher.modes.cbc),e("DES-CFB",t.cipher.modes.cfb),e("DES-OFB",t.cipher.modes.ofb),e("DES-CTR",t.cipher.modes.ctr),e("3DES-ECB",t.cipher.modes.ecb),e("3DES-CBC",t.cipher.modes.cbc),e("3DES-CFB",t.cipher.modes.cfb),e("3DES-OFB",t.cipher.modes.ofb),e("3DES-CTR",t.cipher.modes.ctr);function e(u,v){var C=function(){return new t.des.Algorithm(u,v)};t.cipher.registerAlgorithm(u,C)}var a=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],d=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],A=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],x=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],l=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],r=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],g=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],f=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696];function S(u){for(var v=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],C=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],y=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],i=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],h=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],p=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],I=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],L=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],c=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],s=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],n=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],B=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],D=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],O=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],P=u.length()>8?3:1,K=[],q=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],M=0,G,Y=0;Y<P;Y++){var W=u.getInt32(),ee=u.getInt32();G=(W>>>4^ee)&252645135,ee^=G,W^=G<<4,G=(ee>>>-16^W)&65535,W^=G,ee^=G<<-16,G=(W>>>2^ee)&858993459,ee^=G,W^=G<<2,G=(ee>>>-16^W)&65535,W^=G,ee^=G<<-16,G=(W>>>1^ee)&1431655765,ee^=G,W^=G<<1,G=(ee>>>8^W)&16711935,W^=G,ee^=G<<8,G=(W>>>1^ee)&1431655765,ee^=G,W^=G<<1,G=W<<8|ee>>>20&240,W=ee<<24|ee<<8&16711680|ee>>>8&65280|ee>>>24&240,ee=G;for(var ne=0;ne<q.length;++ne){q[ne]?(W=W<<2|W>>>26,ee=ee<<2|ee>>>26):(W=W<<1|W>>>27,ee=ee<<1|ee>>>27),W&=-15,ee&=-15;var ie=v[W>>>28]|C[W>>>24&15]|y[W>>>20&15]|i[W>>>16&15]|h[W>>>12&15]|p[W>>>8&15]|I[W>>>4&15],he=L[ee>>>28]|c[ee>>>24&15]|s[ee>>>20&15]|n[ee>>>16&15]|B[ee>>>12&15]|D[ee>>>8&15]|O[ee>>>4&15];G=(he>>>16^ie)&65535,K[M++]=ie^G,K[M++]=he^G<<16}}return K}function R(u,v,C,y){var i=u.length===32?3:9,h;i===3?h=y?[30,-2,-2]:[0,32,2]:h=y?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var p,I=v[0],L=v[1];p=(I>>>4^L)&252645135,L^=p,I^=p<<4,p=(I>>>16^L)&65535,L^=p,I^=p<<16,p=(L>>>2^I)&858993459,I^=p,L^=p<<2,p=(L>>>8^I)&16711935,I^=p,L^=p<<8,p=(I>>>1^L)&1431655765,L^=p,I^=p<<1,I=I<<1|I>>>31,L=L<<1|L>>>31;for(var c=0;c<i;c+=3){for(var s=h[c+1],n=h[c+2],B=h[c];B!=s;B+=n){var D=L^u[B],O=(L>>>4|L<<28)^u[B+1];p=I,I=L,L=p^(d[D>>>24&63]|x[D>>>16&63]|r[D>>>8&63]|f[D&63]|a[O>>>24&63]|A[O>>>16&63]|l[O>>>8&63]|g[O&63])}p=I,I=L,L=p}I=I>>>1|I<<31,L=L>>>1|L<<31,p=(I>>>1^L)&1431655765,L^=p,I^=p<<1,p=(L>>>8^I)&16711935,I^=p,L^=p<<8,p=(L>>>2^I)&858993459,I^=p,L^=p<<2,p=(I>>>16^L)&65535,L^=p,I^=p<<16,p=(I>>>4^L)&252645135,L^=p,I^=p<<4,C[0]=I,C[1]=L}function E(u){u=u||{};var v=(u.mode||"CBC").toUpperCase(),C="DES-"+v,y;u.decrypt?y=t.cipher.createDecipher(C,u.key):y=t.cipher.createCipher(C,u.key);var i=y.start;return y.start=function(h,p){var I=null;p instanceof t.util.ByteBuffer&&(I=p,p={}),p=p||{},p.output=I,p.iv=h,i.call(y,p)},y}return Xt}const Wt=Fa(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var jt,Fr;function $t(){if(Fr)return jt;Fr=1;var t=ue();Ct(),st(),ce();var e=t.pkcs5=t.pkcs5||{},a;return t.util.isNodejs&&!t.options.usePureJavaScript&&(a=Wt),jt=t.pbkdf2=e.pbkdf2=function(d,A,x,l,r,g){if(typeof r=="function"&&(g=r,r=null),t.util.isNodejs&&!t.options.usePureJavaScript&&a.pbkdf2&&(r===null||typeof r!="object")&&(a.pbkdf2Sync.length>4||!r||r==="sha1"))return typeof r!="string"&&(r="sha1"),d=Buffer.from(d,"binary"),A=Buffer.from(A,"binary"),g?a.pbkdf2Sync.length===4?a.pbkdf2(d,A,x,l,function(c,s){if(c)return g(c);g(null,s.toString("binary"))}):a.pbkdf2(d,A,x,l,r,function(c,s){if(c)return g(c);g(null,s.toString("binary"))}):a.pbkdf2Sync.length===4?a.pbkdf2Sync(d,A,x,l).toString("binary"):a.pbkdf2Sync(d,A,x,l,r).toString("binary");if((typeof r=="undefined"||r===null)&&(r="sha1"),typeof r=="string"){if(!(r in t.md.algorithms))throw new Error("Unknown hash algorithm: "+r);r=t.md[r].create()}var f=r.digestLength;if(l>4294967295*f){var S=new Error("Derived key is too long.");if(g)return g(S);throw S}var R=Math.ceil(l/f),E=l-(R-1)*f,u=t.hmac.create();u.start(r,d);var v="",C,y,i;if(!g){for(var h=1;h<=R;++h){u.start(null,null),u.update(A),u.update(t.util.int32ToBytes(h)),C=i=u.digest().getBytes();for(var p=2;p<=x;++p)u.start(null,null),u.update(i),y=u.digest().getBytes(),C=t.util.xorBytes(C,y,f),i=y;v+=h<R?C:C.substr(0,E)}return v}var h=1,p;function I(){if(h>R)return g(null,v);u.start(null,null),u.update(A),u.update(t.util.int32ToBytes(h)),C=i=u.digest().getBytes(),p=2,L()}function L(){if(p<=x)return u.start(null,null),u.update(i),y=u.digest().getBytes(),C=t.util.xorBytes(C,y,f),i=y,++p,t.util.setImmediate(L);v+=h<R?C:C.substr(0,E),++h,I()}I()},jt}var Tt={exports:{}},Zt={exports:{}},Mr;function qr(){if(Mr)return Zt.exports;Mr=1;var t=ue();st(),ce();var e=Zt.exports=t.sha256=t.sha256||{};t.md.sha256=t.md.algorithms.sha256=e,e.create=function(){d||x();var r=null,g=t.util.createBuffer(),f=new Array(64),S={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8};return S.start=function(){S.messageLength=0,S.fullMessageLength=S.messageLength64=[];for(var R=S.messageLengthSize/4,E=0;E<R;++E)S.fullMessageLength.push(0);return g=t.util.createBuffer(),r={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225},S},S.start(),S.update=function(R,E){E==="utf8"&&(R=t.util.encodeUtf8(R));var u=R.length;S.messageLength+=u,u=[u/4294967296>>>0,u>>>0];for(var v=S.fullMessageLength.length-1;v>=0;--v)S.fullMessageLength[v]+=u[1],u[1]=u[0]+(S.fullMessageLength[v]/4294967296>>>0),S.fullMessageLength[v]=S.fullMessageLength[v]>>>0,u[0]=u[1]/4294967296>>>0;return g.putBytes(R),l(r,f,g),(g.read>2048||g.length()===0)&&g.compact(),S},S.digest=function(){var R=t.util.createBuffer();R.putBytes(g.bytes());var E=S.fullMessageLength[S.fullMessageLength.length-1]+S.messageLengthSize,u=E&S.blockLength-1;R.putBytes(a.substr(0,S.blockLength-u));for(var v,C,y=S.fullMessageLength[0]*8,i=0;i<S.fullMessageLength.length-1;++i)v=S.fullMessageLength[i+1]*8,C=v/4294967296>>>0,y+=C,R.putInt32(y>>>0),y=v>>>0;R.putInt32(y);var h={h0:r.h0,h1:r.h1,h2:r.h2,h3:r.h3,h4:r.h4,h5:r.h5,h6:r.h6,h7:r.h7};l(h,f,R);var p=t.util.createBuffer();return p.putInt32(h.h0),p.putInt32(h.h1),p.putInt32(h.h2),p.putInt32(h.h3),p.putInt32(h.h4),p.putInt32(h.h5),p.putInt32(h.h6),p.putInt32(h.h7),p},S};var a=null,d=!1,A=null;function x(){a="€",a+=t.util.fillString("\0",64),A=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],d=!0}function l(r,g,f){for(var S,R,E,u,v,C,y,i,h,p,I,L,c,s,n,B=f.length();B>=64;){for(y=0;y<16;++y)g[y]=f.getInt32();for(;y<64;++y)S=g[y-2],S=(S>>>17|S<<15)^(S>>>19|S<<13)^S>>>10,R=g[y-15],R=(R>>>7|R<<25)^(R>>>18|R<<14)^R>>>3,g[y]=S+g[y-7]+R+g[y-16]|0;for(i=r.h0,h=r.h1,p=r.h2,I=r.h3,L=r.h4,c=r.h5,s=r.h6,n=r.h7,y=0;y<64;++y)u=(L>>>6|L<<26)^(L>>>11|L<<21)^(L>>>25|L<<7),v=s^L&(c^s),E=(i>>>2|i<<30)^(i>>>13|i<<19)^(i>>>22|i<<10),C=i&h|p&(i^h),S=n+u+v+A[y]+g[y],R=E+C,n=s,s=c,c=L,L=I+S>>>0,I=p,p=h,h=i,i=S+R>>>0;r.h0=r.h0+i|0,r.h1=r.h1+h|0,r.h2=r.h2+p|0,r.h3=r.h3+I|0,r.h4=r.h4+L|0,r.h5=r.h5+c|0,r.h6=r.h6+s|0,r.h7=r.h7+n|0,B-=64}}return Zt.exports}var Jt={exports:{}},Hr;function Gr(){if(Hr)return Jt.exports;Hr=1;var t=ue();ce();var e=null;t.util.isNodejs&&!t.options.usePureJavaScript&&!process.versions["node-webkit"]&&(e=Wt);var a=Jt.exports=t.prng=t.prng||{};return a.create=function(d){for(var A={plugin:d,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},x=d.md,l=new Array(32),r=0;r<32;++r)l[r]=x.create();A.pools=l,A.pool=0,A.generate=function(E,u){if(!u)return A.generateSync(E);var v=A.plugin.cipher,C=A.plugin.increment,y=A.plugin.formatKey,i=A.plugin.formatSeed,h=t.util.createBuffer();A.key=null,p();function p(I){if(I)return u(I);if(h.length()>=E)return u(null,h.getBytes(E));if(A.generated>1048575&&(A.key=null),A.key===null)return t.util.nextTick(function(){g(p)});var L=v(A.key,A.seed);A.generated+=L.length,h.putBytes(L),A.key=y(v(A.key,C(A.seed))),A.seed=i(v(A.key,A.seed)),t.util.setImmediate(p)}},A.generateSync=function(E){var u=A.plugin.cipher,v=A.plugin.increment,C=A.plugin.formatKey,y=A.plugin.formatSeed;A.key=null;for(var i=t.util.createBuffer();i.length()<E;){A.generated>1048575&&(A.key=null),A.key===null&&f();var h=u(A.key,A.seed);A.generated+=h.length,i.putBytes(h),A.key=C(u(A.key,v(A.seed))),A.seed=y(u(A.key,A.seed))}return i.getBytes(E)};function g(E){if(A.pools[0].messageLength>=32)return S(),E();var u=32-A.pools[0].messageLength<<5;A.seedFile(u,function(v,C){if(v)return E(v);A.collect(C),S(),E()})}function f(){if(A.pools[0].messageLength>=32)return S();var E=32-A.pools[0].messageLength<<5;A.collect(A.seedFileSync(E)),S()}function S(){A.reseeds=A.reseeds===4294967295?0:A.reseeds+1;var E=A.plugin.md.create();E.update(A.keyBytes);for(var u=1,v=0;v<32;++v)A.reseeds%u===0&&(E.update(A.pools[v].digest().getBytes()),A.pools[v].start()),u=u<<1;A.keyBytes=E.digest().getBytes(),E.start(),E.update(A.keyBytes);var C=E.digest().getBytes();A.key=A.plugin.formatKey(A.keyBytes),A.seed=A.plugin.formatSeed(C),A.generated=0}function R(E){var u=null,v=t.util.globalScope,C=v.crypto||v.msCrypto;C&&C.getRandomValues&&(u=function(n){return C.getRandomValues(n)});var y=t.util.createBuffer();if(u)for(;y.length()<E;){var i=Math.max(1,Math.min(E-y.length(),65536)/4),h=new Uint32Array(Math.floor(i));try{u(h);for(var p=0;p<h.length;++p)y.putInt32(h[p])}catch(n){if(!(typeof QuotaExceededError!="undefined"&&n instanceof QuotaExceededError))throw n}}if(y.length()<E)for(var I,L,c,s=Math.floor(Math.random()*65536);y.length()<E;){L=16807*(s&65535),I=16807*(s>>16),L+=(I&32767)<<16,L+=I>>15,L=(L&2147483647)+(L>>31),s=L&4294967295;for(var p=0;p<3;++p)c=s>>>(p<<3),c^=Math.floor(Math.random()*256),y.putByte(c&255)}return y.getBytes(E)}return e?(A.seedFile=function(E,u){e.randomBytes(E,function(v,C){if(v)return u(v);u(null,C.toString())})},A.seedFileSync=function(E){return e.randomBytes(E).toString()}):(A.seedFile=function(E,u){try{u(null,R(E))}catch(v){u(v)}},A.seedFileSync=R),A.collect=function(E){for(var u=E.length,v=0;v<u;++v)A.pools[A.pool].update(E.substr(v,1)),A.pool=A.pool===31?0:A.pool+1},A.collectInt=function(E,u){for(var v="",C=0;C<u;C+=8)v+=String.fromCharCode(E>>C&255);A.collect(v)},A.registerWorker=function(E){if(E===self)A.seedFile=function(v,C){function y(i){var h=i.data;h.forge&&h.forge.prng&&(self.removeEventListener("message",y),C(h.forge.prng.err,h.forge.prng.bytes))}self.addEventListener("message",y),self.postMessage({forge:{prng:{needed:v}}})};else{var u=function(v){var C=v.data;C.forge&&C.forge.prng&&A.seedFile(C.forge.prng.needed,function(y,i){E.postMessage({forge:{prng:{err:y,bytes:i}}})})};E.addEventListener("message",u)}},A},Jt.exports}var Qr;function Ze(){if(Qr)return Tt.exports;Qr=1;var t=ue();return ct(),qr(),Gr(),ce(),(function(){if(t.random&&t.random.getBytes){Tt.exports=t.random;return}(function(e){var a={},d=new Array(4),A=t.util.createBuffer();a.formatKey=function(E){var u=t.util.createBuffer(E);return E=new Array(4),E[0]=u.getInt32(),E[1]=u.getInt32(),E[2]=u.getInt32(),E[3]=u.getInt32(),t.aes._expandKey(E,!1)},a.formatSeed=function(E){var u=t.util.createBuffer(E);return E=new Array(4),E[0]=u.getInt32(),E[1]=u.getInt32(),E[2]=u.getInt32(),E[3]=u.getInt32(),E},a.cipher=function(E,u){return t.aes._updateBlock(E,u,d,!1),A.putInt32(d[0]),A.putInt32(d[1]),A.putInt32(d[2]),A.putInt32(d[3]),A.getBytes()},a.increment=function(E){return++E[3],E},a.md=t.md.sha256;function x(){var E=t.prng.create(a);return E.getBytes=function(u,v){return E.generate(u,v)},E.getBytesSync=function(u){return E.generate(u)},E}var l=x(),r=null,g=t.util.globalScope,f=g.crypto||g.msCrypto;if(f&&f.getRandomValues&&(r=function(E){return f.getRandomValues(E)}),t.options.usePureJavaScript||!t.util.isNodejs&&!r){if(l.collectInt(+new Date,32),typeof navigator!="undefined"){var S="";for(var R in navigator)try{typeof navigator[R]=="string"&&(S+=navigator[R])}catch(E){}l.collect(S),S=null}e&&(e().mousemove(function(E){l.collectInt(E.clientX,16),l.collectInt(E.clientY,16)}),e().keypress(function(E){l.collectInt(E.charCode,8)}))}if(!t.random)t.random=l;else for(var R in l)t.random[R]=l[R];t.random.createInstance=x,Tt.exports=t.random})(typeof jQuery!="undefined"?jQuery:null)})(),Tt.exports}var er,zr;function Yr(){if(zr)return er;zr=1;var t=ue();ce();var e=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],a=[1,2,3,5],d=function(l,r){return l<<r&65535|(l&65535)>>16-r},A=function(l,r){return(l&65535)>>r|l<<16-r&65535};er=t.rc2=t.rc2||{},t.rc2.expandKey=function(l,r){typeof l=="string"&&(l=t.util.createBuffer(l)),r=r||128;var g=l,f=l.length(),S=r,R=Math.ceil(S/8),E=255>>(S&7),u;for(u=f;u<128;u++)g.putByte(e[g.at(u-1)+g.at(u-f)&255]);for(g.setAt(128-R,e[g.at(128-R)&E]),u=127-R;u>=0;u--)g.setAt(u,e[g.at(u+1)^g.at(u+R)]);return g};var x=function(l,r,g){var f=!1,S=null,R=null,E=null,u,v,C,y,i=[];for(l=t.rc2.expandKey(l,r),C=0;C<64;C++)i.push(l.getInt16Le());g?(u=function(I){for(C=0;C<4;C++)I[C]+=i[y]+(I[(C+3)%4]&I[(C+2)%4])+(~I[(C+3)%4]&I[(C+1)%4]),I[C]=d(I[C],a[C]),y++},v=function(I){for(C=0;C<4;C++)I[C]+=i[I[(C+3)%4]&63]}):(u=function(I){for(C=3;C>=0;C--)I[C]=A(I[C],a[C]),I[C]-=i[y]+(I[(C+3)%4]&I[(C+2)%4])+(~I[(C+3)%4]&I[(C+1)%4]),y--},v=function(I){for(C=3;C>=0;C--)I[C]-=i[I[(C+3)%4]&63]});var h=function(I){var L=[];for(C=0;C<4;C++){var c=S.getInt16Le();E!==null&&(g?c^=E.getInt16Le():E.putInt16Le(c)),L.push(c&65535)}y=g?0:63;for(var s=0;s<I.length;s++)for(var n=0;n<I[s][0];n++)I[s][1](L);for(C=0;C<4;C++)E!==null&&(g?E.putInt16Le(L[C]):L[C]^=E.getInt16Le()),R.putInt16Le(L[C])},p=null;return p={start:function(I,L){I&&typeof I=="string"&&(I=t.util.createBuffer(I)),f=!1,S=t.util.createBuffer(),R=L||new t.util.createBuffer,E=I,p.output=R},update:function(I){for(f||S.putBuffer(I);S.length()>=8;)h([[5,u],[1,v],[6,u],[1,v],[5,u]])},finish:function(I){var L=!0;if(g)if(I)L=I(8,S,!g);else{var c=S.length()===8?8:8-S.length();S.fillWithByte(c,c)}if(L&&(f=!0,p.update()),!g&&(L=S.length()===0,L))if(I)L=I(8,R,!g);else{var s=R.length(),n=R.at(s-1);n>s?L=!1:R.truncate(n)}return L}},p};return t.rc2.startEncrypting=function(l,r,g){var f=t.rc2.createEncryptionCipher(l,128);return f.start(r,g),f},t.rc2.createEncryptionCipher=function(l,r){return x(l,r,!0)},t.rc2.startDecrypting=function(l,r,g){var f=t.rc2.createDecryptionCipher(l,128);return f.start(r,g),f},t.rc2.createDecryptionCipher=function(l,r){return x(l,r,!1)},er}var tr,Xr;function It(){if(Xr)return tr;Xr=1;var t=ue();tr=t.jsbn=t.jsbn||{};var e;function a(T,b,U){this.data=[],T!=null&&(typeof T=="number"?this.fromNumber(T,b,U):b==null&&typeof T!="string"?this.fromString(T,256):this.fromString(T,b))}t.jsbn.BigInteger=a;function d(){return new a(null)}function A(T,b,U,F,z,X){for(;--X>=0;){var re=b*this.data[T++]+U.data[F]+z;z=Math.floor(re/67108864),U.data[F++]=re&67108863}return z}function x(T,b,U,F,z,X){for(var re=b&32767,J=b>>15;--X>=0;){var de=this.data[T]&32767,Fe=this.data[T++]>>15,je=J*de+Fe*re;de=re*de+((je&32767)<<15)+U.data[F]+(z&1073741823),z=(de>>>30)+(je>>>15)+J*Fe+(z>>>30),U.data[F++]=de&1073741823}return z}function l(T,b,U,F,z,X){for(var re=b&16383,J=b>>14;--X>=0;){var de=this.data[T]&16383,Fe=this.data[T++]>>14,je=J*de+Fe*re;de=re*de+((je&16383)<<14)+U.data[F]+z,z=(de>>28)+(je>>14)+J*Fe,U.data[F++]=de&268435455}return z}typeof navigator=="undefined"?(a.prototype.am=l,e=28):navigator.appName=="Microsoft Internet Explorer"?(a.prototype.am=x,e=30):navigator.appName!="Netscape"?(a.prototype.am=A,e=26):(a.prototype.am=l,e=28),a.prototype.DB=e,a.prototype.DM=(1<<e)-1,a.prototype.DV=1<<e;var r=52;a.prototype.FV=Math.pow(2,r),a.prototype.F1=r-e,a.prototype.F2=2*e-r;var g="0123456789abcdefghijklmnopqrstuvwxyz",f=new Array,S,R;for(S=48,R=0;R<=9;++R)f[S++]=R;for(S=97,R=10;R<36;++R)f[S++]=R;for(S=65,R=10;R<36;++R)f[S++]=R;function E(T){return g.charAt(T)}function u(T,b){var U=f[T.charCodeAt(b)];return U==null?-1:U}function v(T){for(var b=this.t-1;b>=0;--b)T.data[b]=this.data[b];T.t=this.t,T.s=this.s}function C(T){this.t=1,this.s=T<0?-1:0,T>0?this.data[0]=T:T<-1?this.data[0]=T+this.DV:this.t=0}function y(T){var b=d();return b.fromInt(T),b}function i(T,b){var U;if(b==16)U=4;else if(b==8)U=3;else if(b==256)U=8;else if(b==2)U=1;else if(b==32)U=5;else if(b==4)U=2;else{this.fromRadix(T,b);return}this.t=0,this.s=0;for(var F=T.length,z=!1,X=0;--F>=0;){var re=U==8?T[F]&255:u(T,F);if(re<0){T.charAt(F)=="-"&&(z=!0);continue}z=!1,X==0?this.data[this.t++]=re:X+U>this.DB?(this.data[this.t-1]|=(re&(1<<this.DB-X)-1)<<X,this.data[this.t++]=re>>this.DB-X):this.data[this.t-1]|=re<<X,X+=U,X>=this.DB&&(X-=this.DB)}U==8&&(T[0]&128)!=0&&(this.s=-1,X>0&&(this.data[this.t-1]|=(1<<this.DB-X)-1<<X)),this.clamp(),z&&a.ZERO.subTo(this,this)}function h(){for(var T=this.s&this.DM;this.t>0&&this.data[this.t-1]==T;)--this.t}function p(T){if(this.s<0)return"-"+this.negate().toString(T);var b;if(T==16)b=4;else if(T==8)b=3;else if(T==2)b=1;else if(T==32)b=5;else if(T==4)b=2;else return this.toRadix(T);var U=(1<<b)-1,F,z=!1,X="",re=this.t,J=this.DB-re*this.DB%b;if(re-- >0)for(J<this.DB&&(F=this.data[re]>>J)>0&&(z=!0,X=E(F));re>=0;)J<b?(F=(this.data[re]&(1<<J)-1)<<b-J,F|=this.data[--re]>>(J+=this.DB-b)):(F=this.data[re]>>(J-=b)&U,J<=0&&(J+=this.DB,--re)),F>0&&(z=!0),z&&(X+=E(F));return z?X:"0"}function I(){var T=d();return a.ZERO.subTo(this,T),T}function L(){return this.s<0?this.negate():this}function c(T){var b=this.s-T.s;if(b!=0)return b;var U=this.t;if(b=U-T.t,b!=0)return this.s<0?-b:b;for(;--U>=0;)if((b=this.data[U]-T.data[U])!=0)return b;return 0}function s(T){var b=1,U;return(U=T>>>16)!=0&&(T=U,b+=16),(U=T>>8)!=0&&(T=U,b+=8),(U=T>>4)!=0&&(T=U,b+=4),(U=T>>2)!=0&&(T=U,b+=2),(U=T>>1)!=0&&(T=U,b+=1),b}function n(){return this.t<=0?0:this.DB*(this.t-1)+s(this.data[this.t-1]^this.s&this.DM)}function B(T,b){var U;for(U=this.t-1;U>=0;--U)b.data[U+T]=this.data[U];for(U=T-1;U>=0;--U)b.data[U]=0;b.t=this.t+T,b.s=this.s}function D(T,b){for(var U=T;U<this.t;++U)b.data[U-T]=this.data[U];b.t=Math.max(this.t-T,0),b.s=this.s}function O(T,b){var U=T%this.DB,F=this.DB-U,z=(1<<F)-1,X=Math.floor(T/this.DB),re=this.s<<U&this.DM,J;for(J=this.t-1;J>=0;--J)b.data[J+X+1]=this.data[J]>>F|re,re=(this.data[J]&z)<<U;for(J=X-1;J>=0;--J)b.data[J]=0;b.data[X]=re,b.t=this.t+X+1,b.s=this.s,b.clamp()}function P(T,b){b.s=this.s;var U=Math.floor(T/this.DB);if(U>=this.t){b.t=0;return}var F=T%this.DB,z=this.DB-F,X=(1<<F)-1;b.data[0]=this.data[U]>>F;for(var re=U+1;re<this.t;++re)b.data[re-U-1]|=(this.data[re]&X)<<z,b.data[re-U]=this.data[re]>>F;F>0&&(b.data[this.t-U-1]|=(this.s&X)<<z),b.t=this.t-U,b.clamp()}function K(T,b){for(var U=0,F=0,z=Math.min(T.t,this.t);U<z;)F+=this.data[U]-T.data[U],b.data[U++]=F&this.DM,F>>=this.DB;if(T.t<this.t){for(F-=T.s;U<this.t;)F+=this.data[U],b.data[U++]=F&this.DM,F>>=this.DB;F+=this.s}else{for(F+=this.s;U<T.t;)F-=T.data[U],b.data[U++]=F&this.DM,F>>=this.DB;F-=T.s}b.s=F<0?-1:0,F<-1?b.data[U++]=this.DV+F:F>0&&(b.data[U++]=F),b.t=U,b.clamp()}function q(T,b){var U=this.abs(),F=T.abs(),z=U.t;for(b.t=z+F.t;--z>=0;)b.data[z]=0;for(z=0;z<F.t;++z)b.data[z+U.t]=U.am(0,F.data[z],b,z,0,U.t);b.s=0,b.clamp(),this.s!=T.s&&a.ZERO.subTo(b,b)}function M(T){for(var b=this.abs(),U=T.t=2*b.t;--U>=0;)T.data[U]=0;for(U=0;U<b.t-1;++U){var F=b.am(U,b.data[U],T,2*U,0,1);(T.data[U+b.t]+=b.am(U+1,2*b.data[U],T,2*U+1,F,b.t-U-1))>=b.DV&&(T.data[U+b.t]-=b.DV,T.data[U+b.t+1]=1)}T.t>0&&(T.data[T.t-1]+=b.am(U,b.data[U],T,2*U,0,1)),T.s=0,T.clamp()}function G(T,b,U){var F=T.abs();if(!(F.t<=0)){var z=this.abs();if(z.t<F.t){b!=null&&b.fromInt(0),U!=null&&this.copyTo(U);return}U==null&&(U=d());var X=d(),re=this.s,J=T.s,de=this.DB-s(F.data[F.t-1]);de>0?(F.lShiftTo(de,X),z.lShiftTo(de,U)):(F.copyTo(X),z.copyTo(U));var Fe=X.t,je=X.data[Fe-1];if(je!=0){var Xe=je*(1<<this.F1)+(Fe>1?X.data[Fe-2]>>this.F2:0),ut=this.FV/Xe,Rt=(1<<this.F1)/Xe,tt=1<<this.F2,rt=U.t,wt=rt-Fe,lt=b==null?d():b;for(X.dlShiftTo(wt,lt),U.compareTo(lt)>=0&&(U.data[U.t++]=1,U.subTo(lt,U)),a.ONE.dlShiftTo(Fe,lt),lt.subTo(X,X);X.t<Fe;)X.data[X.t++]=0;for(;--wt>=0;){var Ar=U.data[--rt]==je?this.DM:Math.floor(U.data[rt]*ut+(U.data[rt-1]+tt)*Rt);if((U.data[rt]+=X.am(0,Ar,U,wt,0,Fe))<Ar)for(X.dlShiftTo(wt,lt),U.subTo(lt,U);U.data[rt]<--Ar;)U.subTo(lt,U)}b!=null&&(U.drShiftTo(Fe,b),re!=J&&a.ZERO.subTo(b,b)),U.t=Fe,U.clamp(),de>0&&U.rShiftTo(de,U),re<0&&a.ZERO.subTo(U,U)}}}function Y(T){var b=d();return this.abs().divRemTo(T,null,b),this.s<0&&b.compareTo(a.ZERO)>0&&T.subTo(b,b),b}function W(T){this.m=T}function ee(T){return T.s<0||T.compareTo(this.m)>=0?T.mod(this.m):T}function ne(T){return T}function ie(T){T.divRemTo(this.m,null,T)}function he(T,b,U){T.multiplyTo(b,U),this.reduce(U)}function ve(T,b){T.squareTo(b),this.reduce(b)}W.prototype.convert=ee,W.prototype.revert=ne,W.prototype.reduce=ie,W.prototype.mulTo=he,W.prototype.sqrTo=ve;function fe(){if(this.t<1)return 0;var T=this.data[0];if((T&1)==0)return 0;var b=T&3;return b=b*(2-(T&15)*b)&15,b=b*(2-(T&255)*b)&255,b=b*(2-((T&65535)*b&65535))&65535,b=b*(2-T*b%this.DV)%this.DV,b>0?this.DV-b:-b}function j(T){this.m=T,this.mp=T.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<T.DB-15)-1,this.mt2=2*T.t}function $(T){var b=d();return T.abs().dlShiftTo(this.m.t,b),b.divRemTo(this.m,null,b),T.s<0&&b.compareTo(a.ZERO)>0&&this.m.subTo(b,b),b}function Ge(T){var b=d();return T.copyTo(b),this.reduce(b),b}function Me(T){for(;T.t<=this.mt2;)T.data[T.t++]=0;for(var b=0;b<this.m.t;++b){var U=T.data[b]&32767,F=U*this.mpl+((U*this.mph+(T.data[b]>>15)*this.mpl&this.um)<<15)&T.DM;for(U=b+this.m.t,T.data[U]+=this.m.am(0,F,T,b,0,this.m.t);T.data[U]>=T.DV;)T.data[U]-=T.DV,T.data[++U]++}T.clamp(),T.drShiftTo(this.m.t,T),T.compareTo(this.m)>=0&&T.subTo(this.m,T)}function m(T,b){T.squareTo(b),this.reduce(b)}function k(T,b,U){T.multiplyTo(b,U),this.reduce(U)}j.prototype.convert=$,j.prototype.revert=Ge,j.prototype.reduce=Me,j.prototype.mulTo=k,j.prototype.sqrTo=m;function w(){return(this.t>0?this.data[0]&1:this.s)==0}function N(T,b){if(T>4294967295||T<1)return a.ONE;var U=d(),F=d(),z=b.convert(this),X=s(T)-1;for(z.copyTo(U);--X>=0;)if(b.sqrTo(U,F),(T&1<<X)>0)b.mulTo(F,z,U);else{var re=U;U=F,F=re}return b.revert(U)}function o(T,b){var U;return T<256||b.isEven()?U=new W(b):U=new j(b),this.exp(T,U)}a.prototype.copyTo=v,a.prototype.fromInt=C,a.prototype.fromString=i,a.prototype.clamp=h,a.prototype.dlShiftTo=B,a.prototype.drShiftTo=D,a.prototype.lShiftTo=O,a.prototype.rShiftTo=P,a.prototype.subTo=K,a.prototype.multiplyTo=q,a.prototype.squareTo=M,a.prototype.divRemTo=G,a.prototype.invDigit=fe,a.prototype.isEven=w,a.prototype.exp=N,a.prototype.toString=p,a.prototype.negate=I,a.prototype.abs=L,a.prototype.compareTo=c,a.prototype.bitLength=n,a.prototype.mod=Y,a.prototype.modPowInt=o,a.ZERO=y(0),a.ONE=y(1);function _(){var T=d();return this.copyTo(T),T}function V(){if(this.s<0){if(this.t==1)return this.data[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this.data[0];if(this.t==0)return 0}return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]}function H(){return this.t==0?this.s:this.data[0]<<24>>24}function ae(){return this.t==0?this.s:this.data[0]<<16>>16}function te(T){return Math.floor(Math.LN2*this.DB/Math.log(T))}function Q(){return this.s<0?-1:this.t<=0||this.t==1&&this.data[0]<=0?0:1}function Z(T){if(T==null&&(T=10),this.signum()==0||T<2||T>36)return"0";var b=this.chunkSize(T),U=Math.pow(T,b),F=y(U),z=d(),X=d(),re="";for(this.divRemTo(F,z,X);z.signum()>0;)re=(U+X.intValue()).toString(T).substr(1)+re,z.divRemTo(F,z,X);return X.intValue().toString(T)+re}function se(T,b){this.fromInt(0),b==null&&(b=10);for(var U=this.chunkSize(b),F=Math.pow(b,U),z=!1,X=0,re=0,J=0;J<T.length;++J){var de=u(T,J);if(de<0){T.charAt(J)=="-"&&this.signum()==0&&(z=!0);continue}re=b*re+de,++X>=U&&(this.dMultiply(F),this.dAddOffset(re,0),X=0,re=0)}X>0&&(this.dMultiply(Math.pow(b,X)),this.dAddOffset(re,0)),z&&a.ZERO.subTo(this,this)}function le(T,b,U){if(typeof b=="number")if(T<2)this.fromInt(1);else for(this.fromNumber(T,U),this.testBit(T-1)||this.bitwiseTo(a.ONE.shiftLeft(T-1),pe,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(b);)this.dAddOffset(2,0),this.bitLength()>T&&this.subTo(a.ONE.shiftLeft(T-1),this);else{var F=new Array,z=T&7;F.length=(T>>3)+1,b.nextBytes(F),z>0?F[0]&=(1<<z)-1:F[0]=0,this.fromString(F,256)}}function oe(){var T=this.t,b=new Array;b[0]=this.s;var U=this.DB-T*this.DB%8,F,z=0;if(T-- >0)for(U<this.DB&&(F=this.data[T]>>U)!=(this.s&this.DM)>>U&&(b[z++]=F|this.s<<this.DB-U);T>=0;)U<8?(F=(this.data[T]&(1<<U)-1)<<8-U,F|=this.data[--T]>>(U+=this.DB-8)):(F=this.data[T]>>(U-=8)&255,U<=0&&(U+=this.DB,--T)),(F&128)!=0&&(F|=-256),z==0&&(this.s&128)!=(F&128)&&++z,(z>0||F!=this.s)&&(b[z++]=F);return b}function me(T){return this.compareTo(T)==0}function Se(T){return this.compareTo(T)<0?this:T}function xe(T){return this.compareTo(T)>0?this:T}function Ee(T,b,U){var F,z,X=Math.min(T.t,this.t);for(F=0;F<X;++F)U.data[F]=b(this.data[F],T.data[F]);if(T.t<this.t){for(z=T.s&this.DM,F=X;F<this.t;++F)U.data[F]=b(this.data[F],z);U.t=this.t}else{for(z=this.s&this.DM,F=X;F<T.t;++F)U.data[F]=b(z,T.data[F]);U.t=T.t}U.s=b(this.s,T.s),U.clamp()}function ge(T,b){return T&b}function ye(T){var b=d();return this.bitwiseTo(T,ge,b),b}function pe(T,b){return T|b}function Ie(T){var b=d();return this.bitwiseTo(T,pe,b),b}function Ae(T,b){return T^b}function qe(T){var b=d();return this.bitwiseTo(T,Ae,b),b}function He(T,b){return T&~b}function Qe(T){var b=d();return this.bitwiseTo(T,He,b),b}function Ye(){for(var T=d(),b=0;b<this.t;++b)T.data[b]=this.DM&~this.data[b];return T.t=this.t,T.s=~this.s,T}function We(T){var b=d();return T<0?this.rShiftTo(-T,b):this.lShiftTo(T,b),b}function Je(T){var b=d();return T<0?this.lShiftTo(-T,b):this.rShiftTo(T,b),b}function it(T){if(T==0)return-1;var b=0;return(T&65535)==0&&(T>>=16,b+=16),(T&255)==0&&(T>>=8,b+=8),(T&15)==0&&(T>>=4,b+=4),(T&3)==0&&(T>>=2,b+=2),(T&1)==0&&++b,b}function ot(){for(var T=0;T<this.t;++T)if(this.data[T]!=0)return T*this.DB+it(this.data[T]);return this.s<0?this.t*this.DB:-1}function ft(T){for(var b=0;T!=0;)T&=T-1,++b;return b}function dt(){for(var T=0,b=this.s&this.DM,U=0;U<this.t;++U)T+=ft(this.data[U]^b);return T}function yt(T){var b=Math.floor(T/this.DB);return b>=this.t?this.s!=0:(this.data[b]&1<<T%this.DB)!=0}function xt(T,b){var U=a.ONE.shiftLeft(T);return this.bitwiseTo(U,b,U),U}function Nt(T){return this.changeBit(T,pe)}function Be(T){return this.changeBit(T,He)}function be(T){return this.changeBit(T,Ae)}function _e(T,b){for(var U=0,F=0,z=Math.min(T.t,this.t);U<z;)F+=this.data[U]+T.data[U],b.data[U++]=F&this.DM,F>>=this.DB;if(T.t<this.t){for(F+=T.s;U<this.t;)F+=this.data[U],b.data[U++]=F&this.DM,F>>=this.DB;F+=this.s}else{for(F+=this.s;U<T.t;)F+=T.data[U],b.data[U++]=F&this.DM,F>>=this.DB;F+=T.s}b.s=F<0?-1:0,F>0?b.data[U++]=F:F<-1&&(b.data[U++]=this.DV+F),b.t=U,b.clamp()}function Ne(T){var b=d();return this.addTo(T,b),b}function Re(T){var b=d();return this.subTo(T,b),b}function we(T){var b=d();return this.multiplyTo(T,b),b}function Le(){var T=d();return this.squareTo(T),T}function ke(T){var b=d();return this.divRemTo(T,b,null),b}function De(T){var b=d();return this.divRemTo(T,null,b),b}function Ue(T){var b=d(),U=d();return this.divRemTo(T,b,U),new Array(b,U)}function Pe(T){this.data[this.t]=this.am(0,T-1,this,0,0,this.t),++this.t,this.clamp()}function Ve(T,b){if(T!=0){for(;this.t<=b;)this.data[this.t++]=0;for(this.data[b]+=T;this.data[b]>=this.DV;)this.data[b]-=this.DV,++b>=this.t&&(this.data[this.t++]=0),++this.data[b]}}function Ce(){}function Te(T){return T}function Oe(T,b,U){T.multiplyTo(b,U)}function Ke(T,b){T.squareTo(b)}Ce.prototype.convert=Te,Ce.prototype.revert=Te,Ce.prototype.mulTo=Oe,Ce.prototype.sqrTo=Ke;function ln(T){return this.exp(T,new Ce)}function cn(T,b,U){var F=Math.min(this.t+T.t,b);for(U.s=0,U.t=F;F>0;)U.data[--F]=0;var z;for(z=U.t-this.t;F<z;++F)U.data[F+this.t]=this.am(0,T.data[F],U,F,0,this.t);for(z=Math.min(T.t,b);F<z;++F)this.am(0,T.data[F],U,F,0,b-F);U.clamp()}function hn(T,b,U){--b;var F=U.t=this.t+T.t-b;for(U.s=0;--F>=0;)U.data[F]=0;for(F=Math.max(b-this.t,0);F<T.t;++F)U.data[this.t+F-b]=this.am(b-F,T.data[F],U,0,0,this.t+F-b);U.clamp(),U.drShiftTo(1,U)}function gt(T){this.r2=d(),this.q3=d(),a.ONE.dlShiftTo(2*T.t,this.r2),this.mu=this.r2.divide(T),this.m=T}function dn(T){if(T.s<0||T.t>2*this.m.t)return T.mod(this.m);if(T.compareTo(this.m)<0)return T;var b=d();return T.copyTo(b),this.reduce(b),b}function pn(T){return T}function vn(T){for(T.drShiftTo(this.m.t-1,this.r2),T.t>this.m.t+1&&(T.t=this.m.t+1,T.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);T.compareTo(this.r2)<0;)T.dAddOffset(1,this.m.t+1);for(T.subTo(this.r2,T);T.compareTo(this.m)>=0;)T.subTo(this.m,T)}function yn(T,b){T.squareTo(b),this.reduce(b)}function gn(T,b,U){T.multiplyTo(b,U),this.reduce(U)}gt.prototype.convert=dn,gt.prototype.revert=pn,gt.prototype.reduce=vn,gt.prototype.mulTo=gn,gt.prototype.sqrTo=yn;function Cn(T,b){var U=T.bitLength(),F,z=y(1),X;if(U<=0)return z;U<18?F=1:U<48?F=3:U<144?F=4:U<768?F=5:F=6,U<8?X=new W(b):b.isEven()?X=new gt(b):X=new j(b);var re=new Array,J=3,de=F-1,Fe=(1<<F)-1;if(re[1]=X.convert(this),F>1){var je=d();for(X.sqrTo(re[1],je);J<=Fe;)re[J]=d(),X.mulTo(je,re[J-2],re[J]),J+=2}var Xe=T.t-1,ut,Rt=!0,tt=d(),rt;for(U=s(T.data[Xe])-1;Xe>=0;){for(U>=de?ut=T.data[Xe]>>U-de&Fe:(ut=(T.data[Xe]&(1<<U+1)-1)<<de-U,Xe>0&&(ut|=T.data[Xe-1]>>this.DB+U-de)),J=F;(ut&1)==0;)ut>>=1,--J;if((U-=J)<0&&(U+=this.DB,--Xe),Rt)re[ut].copyTo(z),Rt=!1;else{for(;J>1;)X.sqrTo(z,tt),X.sqrTo(tt,z),J-=2;J>0?X.sqrTo(z,tt):(rt=z,z=tt,tt=rt),X.mulTo(tt,re[ut],z)}for(;Xe>=0&&(T.data[Xe]&1<<U)==0;)X.sqrTo(z,tt),rt=z,z=tt,tt=rt,--U<0&&(U=this.DB-1,--Xe)}return X.revert(z)}function mn(T){var b=this.s<0?this.negate():this.clone(),U=T.s<0?T.negate():T.clone();if(b.compareTo(U)<0){var F=b;b=U,U=F}var z=b.getLowestSetBit(),X=U.getLowestSetBit();if(X<0)return b;for(z<X&&(X=z),X>0&&(b.rShiftTo(X,b),U.rShiftTo(X,U));b.signum()>0;)(z=b.getLowestSetBit())>0&&b.rShiftTo(z,b),(z=U.getLowestSetBit())>0&&U.rShiftTo(z,U),b.compareTo(U)>=0?(b.subTo(U,b),b.rShiftTo(1,b)):(U.subTo(b,U),U.rShiftTo(1,U));return X>0&&U.lShiftTo(X,U),U}function En(T){if(T<=0)return 0;var b=this.DV%T,U=this.s<0?T-1:0;if(this.t>0)if(b==0)U=this.data[0]%T;else for(var F=this.t-1;F>=0;--F)U=(b*U+this.data[F])%T;return U}function xn(T){if(this.signum()==0)return a.ZERO;var b=T.isEven();if(this.isEven()&&b||T.signum()==0)return a.ZERO;for(var U=T.clone(),F=this.clone(),z=y(1),X=y(0),re=y(0),J=y(1);U.signum()!=0;){for(;U.isEven();)U.rShiftTo(1,U),b?((!z.isEven()||!X.isEven())&&(z.addTo(this,z),X.subTo(T,X)),z.rShiftTo(1,z)):X.isEven()||X.subTo(T,X),X.rShiftTo(1,X);for(;F.isEven();)F.rShiftTo(1,F),b?((!re.isEven()||!J.isEven())&&(re.addTo(this,re),J.subTo(T,J)),re.rShiftTo(1,re)):J.isEven()||J.subTo(T,J),J.rShiftTo(1,J);U.compareTo(F)>=0?(U.subTo(F,U),b&&z.subTo(re,z),X.subTo(J,X)):(F.subTo(U,F),b&&re.subTo(z,re),J.subTo(X,J))}if(F.compareTo(a.ONE)!=0)return a.ZERO;if(J.compareTo(T)>=0)return J.subtract(T);if(J.signum()<0)J.addTo(T,J);else return J;return J.signum()<0?J.add(T):J}var et=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],Sn=(1<<26)/et[et.length-1];function Tn(T){var b,U=this.abs();if(U.t==1&&U.data[0]<=et[et.length-1]){for(b=0;b<et.length;++b)if(U.data[0]==et[b])return!0;return!1}if(U.isEven())return!1;for(b=1;b<et.length;){for(var F=et[b],z=b+1;z<et.length&&F<Sn;)F*=et[z++];for(F=U.modInt(F);b<z;)if(F%et[b++]==0)return!1}return U.millerRabin(T)}function In(T){var b=this.subtract(a.ONE),U=b.getLowestSetBit();if(U<=0)return!1;for(var F=b.shiftRight(U),z=An(),X,re=0;re<T;++re){do X=new a(this.bitLength(),z);while(X.compareTo(a.ONE)<=0||X.compareTo(b)>=0);var J=X.modPow(F,this);if(J.compareTo(a.ONE)!=0&&J.compareTo(b)!=0){for(var de=1;de++<U&&J.compareTo(b)!=0;)if(J=J.modPowInt(2,this),J.compareTo(a.ONE)==0)return!1;if(J.compareTo(b)!=0)return!1}}return!0}function An(){return{nextBytes:function(T){for(var b=0;b<T.length;++b)T[b]=Math.floor(Math.random()*256)}}}return a.prototype.chunkSize=te,a.prototype.toRadix=Z,a.prototype.fromRadix=se,a.prototype.fromNumber=le,a.prototype.bitwiseTo=Ee,a.prototype.changeBit=xt,a.prototype.addTo=_e,a.prototype.dMultiply=Pe,a.prototype.dAddOffset=Ve,a.prototype.multiplyLowerTo=cn,a.prototype.multiplyUpperTo=hn,a.prototype.modInt=En,a.prototype.millerRabin=In,a.prototype.clone=_,a.prototype.intValue=V,a.prototype.byteValue=H,a.prototype.shortValue=ae,a.prototype.signum=Q,a.prototype.toByteArray=oe,a.prototype.equals=me,a.prototype.min=Se,a.prototype.max=xe,a.prototype.and=ye,a.prototype.or=Ie,a.prototype.xor=qe,a.prototype.andNot=Qe,a.prototype.not=Ye,a.prototype.shiftLeft=We,a.prototype.shiftRight=Je,a.prototype.getLowestSetBit=ot,a.prototype.bitCount=dt,a.prototype.testBit=yt,a.prototype.setBit=Nt,a.prototype.clearBit=Be,a.prototype.flipBit=be,a.prototype.add=Ne,a.prototype.subtract=Re,a.prototype.multiply=we,a.prototype.divide=ke,a.prototype.remainder=De,a.prototype.divideAndRemainder=Ue,a.prototype.modPow=Cn,a.prototype.modInverse=xn,a.prototype.pow=ln,a.prototype.gcd=mn,a.prototype.isProbablePrime=Tn,a.prototype.square=Le,tr}var rr={exports:{}},ar={exports:{}},Wr;function mt(){if(Wr)return ar.exports;Wr=1;var t=ue();st(),ce();var e=ar.exports=t.sha1=t.sha1||{};t.md.sha1=t.md.algorithms.sha1=e,e.create=function(){d||A();var l=null,r=t.util.createBuffer(),g=new Array(80),f={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8};return f.start=function(){f.messageLength=0,f.fullMessageLength=f.messageLength64=[];for(var S=f.messageLengthSize/4,R=0;R<S;++R)f.fullMessageLength.push(0);return r=t.util.createBuffer(),l={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},f},f.start(),f.update=function(S,R){R==="utf8"&&(S=t.util.encodeUtf8(S));var E=S.length;f.messageLength+=E,E=[E/4294967296>>>0,E>>>0];for(var u=f.fullMessageLength.length-1;u>=0;--u)f.fullMessageLength[u]+=E[1],E[1]=E[0]+(f.fullMessageLength[u]/4294967296>>>0),f.fullMessageLength[u]=f.fullMessageLength[u]>>>0,E[0]=E[1]/4294967296>>>0;return r.putBytes(S),x(l,g,r),(r.read>2048||r.length()===0)&&r.compact(),f},f.digest=function(){var S=t.util.createBuffer();S.putBytes(r.bytes());var R=f.fullMessageLength[f.fullMessageLength.length-1]+f.messageLengthSize,E=R&f.blockLength-1;S.putBytes(a.substr(0,f.blockLength-E));for(var u,v,C=f.fullMessageLength[0]*8,y=0;y<f.fullMessageLength.length-1;++y)u=f.fullMessageLength[y+1]*8,v=u/4294967296>>>0,C+=v,S.putInt32(C>>>0),C=u>>>0;S.putInt32(C);var i={h0:l.h0,h1:l.h1,h2:l.h2,h3:l.h3,h4:l.h4};x(i,g,S);var h=t.util.createBuffer();return h.putInt32(i.h0),h.putInt32(i.h1),h.putInt32(i.h2),h.putInt32(i.h3),h.putInt32(i.h4),h},f};var a=null,d=!1;function A(){a="€",a+=t.util.fillString("\0",64),d=!0}function x(l,r,g){for(var f,S,R,E,u,v,C,y,i=g.length();i>=64;){for(S=l.h0,R=l.h1,E=l.h2,u=l.h3,v=l.h4,y=0;y<16;++y)f=g.getInt32(),r[y]=f,C=u^R&(E^u),f=(S<<5|S>>>27)+C+v+1518500249+f,v=u,u=E,E=(R<<30|R>>>2)>>>0,R=S,S=f;for(;y<20;++y)f=r[y-3]^r[y-8]^r[y-14]^r[y-16],f=f<<1|f>>>31,r[y]=f,C=u^R&(E^u),f=(S<<5|S>>>27)+C+v+1518500249+f,v=u,u=E,E=(R<<30|R>>>2)>>>0,R=S,S=f;for(;y<32;++y)f=r[y-3]^r[y-8]^r[y-14]^r[y-16],f=f<<1|f>>>31,r[y]=f,C=R^E^u,f=(S<<5|S>>>27)+C+v+1859775393+f,v=u,u=E,E=(R<<30|R>>>2)>>>0,R=S,S=f;for(;y<40;++y)f=r[y-6]^r[y-16]^r[y-28]^r[y-32],f=f<<2|f>>>30,r[y]=f,C=R^E^u,f=(S<<5|S>>>27)+C+v+1859775393+f,v=u,u=E,E=(R<<30|R>>>2)>>>0,R=S,S=f;for(;y<60;++y)f=r[y-6]^r[y-16]^r[y-28]^r[y-32],f=f<<2|f>>>30,r[y]=f,C=R&E|u&(R^E),f=(S<<5|S>>>27)+C+v+2400959708+f,v=u,u=E,E=(R<<30|R>>>2)>>>0,R=S,S=f;for(;y<80;++y)f=r[y-6]^r[y-16]^r[y-28]^r[y-32],f=f<<2|f>>>30,r[y]=f,C=R^E^u,f=(S<<5|S>>>27)+C+v+3395469782+f,v=u,u=E,E=(R<<30|R>>>2)>>>0,R=S,S=f;l.h0=l.h0+S|0,l.h1=l.h1+R|0,l.h2=l.h2+E|0,l.h3=l.h3+u|0,l.h4=l.h4+v|0,i-=64}}return ar.exports}var jr;function $r(){if(jr)return rr.exports;jr=1;var t=ue();ce(),Ze(),mt();var e=rr.exports=t.pkcs1=t.pkcs1||{};e.encode_rsa_oaep=function(d,A,x){var l,r,g,f;typeof x=="string"?(l=x,r=arguments[3]||void 0,g=arguments[4]||void 0):x&&(l=x.label||void 0,r=x.seed||void 0,g=x.md||void 0,x.mgf1&&x.mgf1.md&&(f=x.mgf1.md)),g?g.start():g=t.md.sha1.create(),f||(f=g);var S=Math.ceil(d.n.bitLength()/8),R=S-2*g.digestLength-2;if(A.length>R){var E=new Error("RSAES-OAEP input message length is too long.");throw E.length=A.length,E.maxLength=R,E}l||(l=""),g.update(l,"raw");for(var u=g.digest(),v="",C=R-A.length,y=0;y<C;y++)v+="\0";var i=u.getBytes()+v+""+A;if(!r)r=t.random.getBytes(g.digestLength);else if(r.length!==g.digestLength){var E=new Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.");throw E.seedLength=r.length,E.digestLength=g.digestLength,E}var h=a(r,S-g.digestLength-1,f),p=t.util.xorBytes(i,h,i.length),I=a(p,g.digestLength,f),L=t.util.xorBytes(r,I,r.length);return"\0"+L+p},e.decode_rsa_oaep=function(d,A,x){var l,r,g;typeof x=="string"?(l=x,r=arguments[3]||void 0):x&&(l=x.label||void 0,r=x.md||void 0,x.mgf1&&x.mgf1.md&&(g=x.mgf1.md));var f=Math.ceil(d.n.bitLength()/8);if(A.length!==f){var p=new Error("RSAES-OAEP encoded message length is invalid.");throw p.length=A.length,p.expectedLength=f,p}if(r===void 0?r=t.md.sha1.create():r.start(),g||(g=r),f<2*r.digestLength+2)throw new Error("RSAES-OAEP key is too short for the hash function.");l||(l=""),r.update(l,"raw");for(var S=r.digest().getBytes(),R=A.charAt(0),E=A.substring(1,r.digestLength+1),u=A.substring(1+r.digestLength),v=a(u,r.digestLength,g),C=t.util.xorBytes(E,v,E.length),y=a(C,f-r.digestLength-1,g),i=t.util.xorBytes(u,y,u.length),h=i.substring(0,r.digestLength),p=R!=="\0",I=0;I<r.digestLength;++I)p|=S.charAt(I)!==h.charAt(I);for(var L=1,c=r.digestLength,s=r.digestLength;s<i.length;s++){var n=i.charCodeAt(s),B=n&1^1,D=L?65534:0;p|=n&D,L=L&B,c+=L}if(p||i.charCodeAt(c)!==1)throw new Error("Invalid RSAES-OAEP padding.");return i.substring(c+1)};function a(d,A,x){x||(x=t.md.sha1.create());for(var l="",r=Math.ceil(A/x.digestLength),g=0;g<r;++g){var f=String.fromCharCode(g>>24&255,g>>16&255,g>>8&255,g&255);x.start(),x.update(d+f),l+=x.digest().getBytes()}return l.substring(0,A)}return rr.exports}var At={exports:{}},Zr;function Jr(){if(Zr)return At.exports;Zr=1;var t=ue();return ce(),It(),Ze(),(function(){if(t.prime){At.exports=t.prime;return}var e=At.exports=t.prime=t.prime||{},a=t.jsbn.BigInteger,d=[6,4,2,4,2,4,6,2],A=new a(null);A.fromInt(30);var x=function(E,u){return E|u};e.generateProbablePrime=function(E,u,v){typeof u=="function"&&(v=u,u={}),u=u||{};var C=u.algorithm||"PRIMEINC";typeof C=="string"&&(C={name:C}),C.options=C.options||{};var y=u.prng||t.random,i={nextBytes:function(h){for(var p=y.getBytesSync(h.length),I=0;I<h.length;++I)h[I]=p.charCodeAt(I)}};if(C.name==="PRIMEINC")return l(E,i,C.options,v);throw new Error("Invalid prime generation algorithm: "+C.name)};function l(E,u,v,C){return"workers"in v?f(E,u,v,C):r(E,u,v,C)}function r(E,u,v,C){var y=S(E,u),i=0,h=R(y.bitLength());"millerRabinTests"in v&&(h=v.millerRabinTests);var p=10;"maxBlockTime"in v&&(p=v.maxBlockTime),g(y,E,u,i,h,p,C)}function g(E,u,v,C,y,i,h){var p=+new Date;do{if(E.bitLength()>u&&(E=S(u,v)),E.isProbablePrime(y))return h(null,E);E.dAddOffset(d[C++%8],0)}while(i<0||+new Date-p<i);t.util.setImmediate(function(){g(E,u,v,C,y,i,h)})}function f(E,u,v,C){if(typeof Worker=="undefined")return r(E,u,v,C);var y=S(E,u),i=v.workers,h=v.workLoad||100,p=h*30/8,I=v.workerScript||"forge/prime.worker.js";if(i===-1)return t.util.estimateCores(function(c,s){c&&(s=2),i=s-1,L()});L();function L(){i=Math.max(1,i);for(var c=[],s=0;s<i;++s)c[s]=new Worker(I);for(var s=0;s<i;++s)c[s].addEventListener("message",B);var n=!1;function B(D){if(!n){var O=D.data;if(O.found){for(var P=0;P<c.length;++P)c[P].terminate();return n=!0,C(null,new a(O.prime,16))}y.bitLength()>E&&(y=S(E,u));var K=y.toString(16);D.target.postMessage({hex:K,workLoad:h}),y.dAddOffset(p,0)}}}}function S(E,u){var v=new a(E,u),C=E-1;return v.testBit(C)||v.bitwiseTo(a.ONE.shiftLeft(C),x,v),v.dAddOffset(31-v.mod(A).byteValue(),0),v}function R(E){return E<=100?27:E<=150?18:E<=200?15:E<=250?12:E<=300?9:E<=350?8:E<=400?7:E<=500?6:E<=600?5:E<=800?4:E<=1250?3:2}})(),At.exports}var nr,ea;function Bt(){if(ea)return nr;ea=1;var t=ue();if(nt(),It(),ht(),$r(),Jr(),Ze(),ce(),typeof e=="undefined")var e=t.jsbn.BigInteger;var a=t.util.isNodejs?Wt:null,d=t.asn1,A=t.util;t.pki=t.pki||{},nr=t.pki.rsa=t.rsa=t.rsa||{};var x=t.pki,l=[6,4,2,4,2,4,6,2],r={name:"PrivateKeyInfo",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:d.Class.UNIVERSAL,type:d.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:d.Class.UNIVERSAL,type:d.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},g={name:"RSAPrivateKey",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},f={name:"RSAPublicKey",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},S=t.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:d.Class.UNIVERSAL,type:d.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:d.Class.UNIVERSAL,type:d.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},R={name:"DigestInfo",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm.algorithmIdentifier",tagClass:d.Class.UNIVERSAL,type:d.Type.OID,constructed:!1,capture:"algorithmIdentifier"},{name:"DigestInfo.DigestAlgorithm.parameters",tagClass:d.Class.UNIVERSAL,type:d.Type.NULL,capture:"parameters",optional:!0,constructed:!1}]},{name:"DigestInfo.digest",tagClass:d.Class.UNIVERSAL,type:d.Type.OCTETSTRING,constructed:!1,capture:"digest"}]},E=function(s){var n;if(s.algorithm in x.oids)n=x.oids[s.algorithm];else{var B=new Error("Unknown message digest algorithm.");throw B.algorithm=s.algorithm,B}var D=d.oidToDer(n).getBytes(),O=d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[]),P=d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[]);P.value.push(d.create(d.Class.UNIVERSAL,d.Type.OID,!1,D)),P.value.push(d.create(d.Class.UNIVERSAL,d.Type.NULL,!1,""));var K=d.create(d.Class.UNIVERSAL,d.Type.OCTETSTRING,!1,s.digest().getBytes());return O.value.push(P),O.value.push(K),d.toDer(O).getBytes()},u=function(s,n,B){if(B)return s.modPow(n.e,n.n);if(!n.p||!n.q)return s.modPow(n.d,n.n);n.dP||(n.dP=n.d.mod(n.p.subtract(e.ONE))),n.dQ||(n.dQ=n.d.mod(n.q.subtract(e.ONE))),n.qInv||(n.qInv=n.q.modInverse(n.p));var D;do D=new e(t.util.bytesToHex(t.random.getBytes(n.n.bitLength()/8)),16);while(D.compareTo(n.n)>=0||!D.gcd(n.n).equals(e.ONE));s=s.multiply(D.modPow(n.e,n.n)).mod(n.n);for(var O=s.mod(n.p).modPow(n.dP,n.p),P=s.mod(n.q).modPow(n.dQ,n.q);O.compareTo(P)<0;)O=O.add(n.p);var K=O.subtract(P).multiply(n.qInv).mod(n.p).multiply(n.q).add(P);return K=K.multiply(D.modInverse(n.n)).mod(n.n),K};x.rsa.encrypt=function(s,n,B){var D=B,O,P=Math.ceil(n.n.bitLength()/8);B!==!1&&B!==!0?(D=B===2,O=v(s,n,B)):(O=t.util.createBuffer(),O.putBytes(s));for(var K=new e(O.toHex(),16),q=u(K,n,D),M=q.toString(16),G=t.util.createBuffer(),Y=P-Math.ceil(M.length/2);Y>0;)G.putByte(0),--Y;return G.putBytes(t.util.hexToBytes(M)),G.getBytes()},x.rsa.decrypt=function(s,n,B,D){var O=Math.ceil(n.n.bitLength()/8);if(s.length!==O){var P=new Error("Encrypted message length is invalid.");throw P.length=s.length,P.expected=O,P}var K=new e(t.util.createBuffer(s).toHex(),16);if(K.compareTo(n.n)>=0)throw new Error("Encrypted message is invalid.");for(var q=u(K,n,B),M=q.toString(16),G=t.util.createBuffer(),Y=O-Math.ceil(M.length/2);Y>0;)G.putByte(0),--Y;return G.putBytes(t.util.hexToBytes(M)),D!==!1?C(G.getBytes(),n,B):G.getBytes()},x.rsa.createKeyPairGenerationState=function(s,n,B){typeof s=="string"&&(s=parseInt(s,10)),s=s||2048,B=B||{};var D=B.prng||t.random,O={nextBytes:function(q){for(var M=D.getBytesSync(q.length),G=0;G<q.length;++G)q[G]=M.charCodeAt(G)}},P=B.algorithm||"PRIMEINC",K;if(P==="PRIMEINC")K={algorithm:P,state:0,bits:s,rng:O,eInt:n||65537,e:new e(null),p:null,q:null,qBits:s>>1,pBits:s-(s>>1),pqState:0,num:null,keys:null},K.e.fromInt(K.eInt);else throw new Error("Invalid key generation algorithm: "+P);return K},x.rsa.stepKeyPairGenerationState=function(s,n){"algorithm"in s||(s.algorithm="PRIMEINC");var B=new e(null);B.fromInt(30);for(var D=0,O=function(W,ee){return W|ee},P=+new Date,K,q=0;s.keys===null&&(n<=0||q<n);){if(s.state===0){var M=s.p===null?s.pBits:s.qBits,G=M-1;s.pqState===0?(s.num=new e(M,s.rng),s.num.testBit(G)||s.num.bitwiseTo(e.ONE.shiftLeft(G),O,s.num),s.num.dAddOffset(31-s.num.mod(B).byteValue(),0),D=0,++s.pqState):s.pqState===1?s.num.bitLength()>M?s.pqState=0:s.num.isProbablePrime(h(s.num.bitLength()))?++s.pqState:s.num.dAddOffset(l[D++%8],0):s.pqState===2?s.pqState=s.num.subtract(e.ONE).gcd(s.e).compareTo(e.ONE)===0?3:0:s.pqState===3&&(s.pqState=0,s.p===null?s.p=s.num:s.q=s.num,s.p!==null&&s.q!==null&&++s.state,s.num=null)}else if(s.state===1)s.p.compareTo(s.q)<0&&(s.num=s.p,s.p=s.q,s.q=s.num),++s.state;else if(s.state===2)s.p1=s.p.subtract(e.ONE),s.q1=s.q.subtract(e.ONE),s.phi=s.p1.multiply(s.q1),++s.state;else if(s.state===3)s.phi.gcd(s.e).compareTo(e.ONE)===0?++s.state:(s.p=null,s.q=null,s.state=0);else if(s.state===4)s.n=s.p.multiply(s.q),s.n.bitLength()===s.bits?++s.state:(s.q=null,s.state=0);else if(s.state===5){var Y=s.e.modInverse(s.phi);s.keys={privateKey:x.rsa.setPrivateKey(s.n,s.e,Y,s.p,s.q,Y.mod(s.p1),Y.mod(s.q1),s.q.modInverse(s.p)),publicKey:x.rsa.setPublicKey(s.n,s.e)}}K=+new Date,q+=K-P,P=K}return s.keys!==null},x.rsa.generateKeyPair=function(s,n,B,D){if(arguments.length===1?typeof s=="object"?(B=s,s=void 0):typeof s=="function"&&(D=s,s=void 0):arguments.length===2?typeof s=="number"?typeof n=="function"?(D=n,n=void 0):typeof n!="number"&&(B=n,n=void 0):(B=s,D=n,s=void 0,n=void 0):arguments.length===3&&(typeof n=="number"?typeof B=="function"&&(D=B,B=void 0):(D=B,B=n,n=void 0)),B=B||{},s===void 0&&(s=B.bits||2048),n===void 0&&(n=B.e||65537),!t.options.usePureJavaScript&&!B.prng&&s>=256&&s<=16384&&(n===65537||n===3)){if(D){if(p("generateKeyPair"))return a.generateKeyPair("rsa",{modulusLength:s,publicExponent:n,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},function(q,M,G){if(q)return D(q);D(null,{privateKey:x.privateKeyFromPem(G),publicKey:x.publicKeyFromPem(M)})});if(I("generateKey")&&I("exportKey"))return A.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:s,publicExponent:c(n),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(q){return A.globalScope.crypto.subtle.exportKey("pkcs8",q.privateKey)}).then(void 0,function(q){D(q)}).then(function(q){if(q){var M=x.privateKeyFromAsn1(d.fromDer(t.util.createBuffer(q)));D(null,{privateKey:M,publicKey:x.setRsaPublicKey(M.n,M.e)})}});if(L("generateKey")&&L("exportKey")){var O=A.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:s,publicExponent:c(n),hash:{name:"SHA-256"}},!0,["sign","verify"]);O.oncomplete=function(q){var M=q.target.result,G=A.globalScope.msCrypto.subtle.exportKey("pkcs8",M.privateKey);G.oncomplete=function(Y){var W=Y.target.result,ee=x.privateKeyFromAsn1(d.fromDer(t.util.createBuffer(W)));D(null,{privateKey:ee,publicKey:x.setRsaPublicKey(ee.n,ee.e)})},G.onerror=function(Y){D(Y)}},O.onerror=function(q){D(q)};return}}else if(p("generateKeyPairSync")){var P=a.generateKeyPairSync("rsa",{modulusLength:s,publicExponent:n,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:x.privateKeyFromPem(P.privateKey),publicKey:x.publicKeyFromPem(P.publicKey)}}}var K=x.rsa.createKeyPairGenerationState(s,n,B);if(!D)return x.rsa.stepKeyPairGenerationState(K,0),K.keys;y(K,B,D)},x.setRsaPublicKey=x.rsa.setPublicKey=function(s,n){var B={n:s,e:n};return B.encrypt=function(D,O,P){if(typeof O=="string"?O=O.toUpperCase():O===void 0&&(O="RSAES-PKCS1-V1_5"),O==="RSAES-PKCS1-V1_5")O={encode:function(q,M,G){return v(q,M,2).getBytes()}};else if(O==="RSA-OAEP"||O==="RSAES-OAEP")O={encode:function(q,M){return t.pkcs1.encode_rsa_oaep(M,q,P)}};else if(["RAW","NONE","NULL",null].indexOf(O)!==-1)O={encode:function(q){return q}};else if(typeof O=="string")throw new Error('Unsupported encryption scheme: "'+O+'".');var K=O.encode(D,B,!0);return x.rsa.encrypt(K,B,!0)},B.verify=function(D,O,P,K){typeof P=="string"?P=P.toUpperCase():P===void 0&&(P="RSASSA-PKCS1-V1_5"),K===void 0&&(K={_parseAllDigestBytes:!0,_skipPaddingChecks:!1}),"_parseAllDigestBytes"in K||(K._parseAllDigestBytes=!0),"_skipPaddingChecks"in K||(K._skipPaddingChecks=!1),P==="RSASSA-PKCS1-V1_5"?P={verify:function(M,G){G=C(G,B,!0,void 0,K);var Y=d.fromDer(G,{parseAllBytes:K._parseAllDigestBytes}),W={},ee=[];if(!d.validate(Y,R,W,ee)||Y.value.length!==2){var ne=new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value.");throw ne.errors=ee,ne}var ie=d.derToOid(W.algorithmIdentifier);if(!(ie===t.oids.md2||ie===t.oids.md5||ie===t.oids.sha1||ie===t.oids.sha224||ie===t.oids.sha256||ie===t.oids.sha384||ie===t.oids.sha512||ie===t.oids["sha512-224"]||ie===t.oids["sha512-256"])){var ne=new Error("Unknown RSASSA-PKCS1-v1_5 DigestAlgorithm identifier.");throw ne.oid=ie,ne}if((ie===t.oids.md2||ie===t.oids.md5)&&!("parameters"in W))throw new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value. Missing algorithm identifier NULL parameters.");return M===W.digest}}:(P==="NONE"||P==="NULL"||P===null)&&(P={verify:function(M,G){return G=C(G,B,!0,void 0,K),M===G}});var q=x.rsa.decrypt(O,B,!0,!1);return P.verify(D,q,B.n.bitLength())},B},x.setRsaPrivateKey=x.rsa.setPrivateKey=function(s,n,B,D,O,P,K,q){var M={n:s,e:n,d:B,p:D,q:O,dP:P,dQ:K,qInv:q};return M.decrypt=function(G,Y,W){typeof Y=="string"?Y=Y.toUpperCase():Y===void 0&&(Y="RSAES-PKCS1-V1_5");var ee=x.rsa.decrypt(G,M,!1,!1);if(Y==="RSAES-PKCS1-V1_5")Y={decode:C};else if(Y==="RSA-OAEP"||Y==="RSAES-OAEP")Y={decode:function(ne,ie){return t.pkcs1.decode_rsa_oaep(ie,ne,W)}};else if(["RAW","NONE","NULL",null].indexOf(Y)!==-1)Y={decode:function(ne){return ne}};else throw new Error('Unsupported encryption scheme: "'+Y+'".');return Y.decode(ee,M,!1)},M.sign=function(G,Y){var W=!1;typeof Y=="string"&&(Y=Y.toUpperCase()),Y===void 0||Y==="RSASSA-PKCS1-V1_5"?(Y={encode:E},W=1):(Y==="NONE"||Y==="NULL"||Y===null)&&(Y={encode:function(){return G}},W=1);var ee=Y.encode(G,M.n.bitLength());return x.rsa.encrypt(ee,M,W)},M},x.wrapRsaPrivateKey=function(s){return d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,d.integerToDer(0).getBytes()),d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.OID,!1,d.oidToDer(x.oids.rsaEncryption).getBytes()),d.create(d.Class.UNIVERSAL,d.Type.NULL,!1,"")]),d.create(d.Class.UNIVERSAL,d.Type.OCTETSTRING,!1,d.toDer(s).getBytes())])},x.privateKeyFromAsn1=function(s){var n={},B=[];if(d.validate(s,r,n,B)&&(s=d.fromDer(t.util.createBuffer(n.privateKey))),n={},B=[],!d.validate(s,g,n,B)){var D=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw D.errors=B,D}var O,P,K,q,M,G,Y,W;return O=t.util.createBuffer(n.privateKeyModulus).toHex(),P=t.util.createBuffer(n.privateKeyPublicExponent).toHex(),K=t.util.createBuffer(n.privateKeyPrivateExponent).toHex(),q=t.util.createBuffer(n.privateKeyPrime1).toHex(),M=t.util.createBuffer(n.privateKeyPrime2).toHex(),G=t.util.createBuffer(n.privateKeyExponent1).toHex(),Y=t.util.createBuffer(n.privateKeyExponent2).toHex(),W=t.util.createBuffer(n.privateKeyCoefficient).toHex(),x.setRsaPrivateKey(new e(O,16),new e(P,16),new e(K,16),new e(q,16),new e(M,16),new e(G,16),new e(Y,16),new e(W,16))},x.privateKeyToAsn1=x.privateKeyToRSAPrivateKey=function(s){return d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,d.integerToDer(0).getBytes()),d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,i(s.n)),d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,i(s.e)),d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,i(s.d)),d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,i(s.p)),d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,i(s.q)),d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,i(s.dP)),d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,i(s.dQ)),d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,i(s.qInv))])},x.publicKeyFromAsn1=function(s){var n={},B=[];if(d.validate(s,S,n,B)){var D=d.derToOid(n.publicKeyOid);if(D!==x.oids.rsaEncryption){var O=new Error("Cannot read public key. Unknown OID.");throw O.oid=D,O}s=n.rsaPublicKey}if(B=[],!d.validate(s,f,n,B)){var O=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw O.errors=B,O}var P=t.util.createBuffer(n.publicKeyModulus).toHex(),K=t.util.createBuffer(n.publicKeyExponent).toHex();return x.setRsaPublicKey(new e(P,16),new e(K,16))},x.publicKeyToAsn1=x.publicKeyToSubjectPublicKeyInfo=function(s){return d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.OID,!1,d.oidToDer(x.oids.rsaEncryption).getBytes()),d.create(d.Class.UNIVERSAL,d.Type.NULL,!1,"")]),d.create(d.Class.UNIVERSAL,d.Type.BITSTRING,!1,[x.publicKeyToRSAPublicKey(s)])])},x.publicKeyToRSAPublicKey=function(s){return d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,i(s.n)),d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,i(s.e))])};function v(s,n,B){var D=t.util.createBuffer(),O=Math.ceil(n.n.bitLength()/8);if(s.length>O-11){var P=new Error("Message is too long for PKCS#1 v1.5 padding.");throw P.length=s.length,P.max=O-11,P}D.putByte(0),D.putByte(B);var K=O-3-s.length,q;if(B===0||B===1){q=B===0?0:255;for(var M=0;M<K;++M)D.putByte(q)}else for(;K>0;){for(var G=0,Y=t.random.getBytes(K),M=0;M<K;++M)q=Y.charCodeAt(M),q===0?++G:D.putByte(q);K=G}return D.putByte(0),D.putBytes(s),D}function C(s,n,B,D,O){var P=Math.ceil(n.n.bitLength()/8),K=t.util.createBuffer(s),q=K.getByte(),M=K.getByte();if(q!==0||B&&M!==0&&M!==1||!B&&M!==2||B&&M===0&&typeof D=="undefined")throw new Error("Encryption block is invalid.");var G=0;if(M===0){G=P-3-D;for(var Y=0;Y<G;++Y)if(K.getByte()!==0)throw new Error("Encryption block is invalid.")}else if(M===1){for(G=0;K.length()>1;){if(K.getByte()!==255){--K.read;break}++G}if(G<8&&!(O&&O._skipPaddingChecks))throw new Error("Encryption block is invalid.")}else if(M===2){for(G=0;K.length()>1;){if(K.getByte()===0){--K.read;break}++G}if(G<8&&!(O&&O._skipPaddingChecks))throw new Error("Encryption block is invalid.")}var W=K.getByte();if(W!==0||G!==P-3-K.length())throw new Error("Encryption block is invalid.");return K.getBytes()}function y(s,n,B){typeof n=="function"&&(B=n,n={}),n=n||{};var D={algorithm:{name:n.algorithm||"PRIMEINC",options:{workers:n.workers||2,workLoad:n.workLoad||100,workerScript:n.workerScript}}};"prng"in n&&(D.prng=n.prng),O();function O(){P(s.pBits,function(q,M){if(q)return B(q);if(s.p=M,s.q!==null)return K(q,s.q);P(s.qBits,K)})}function P(q,M){t.prime.generateProbablePrime(q,D,M)}function K(q,M){if(q)return B(q);if(s.q=M,s.p.compareTo(s.q)<0){var G=s.p;s.p=s.q,s.q=G}if(s.p.subtract(e.ONE).gcd(s.e).compareTo(e.ONE)!==0){s.p=null,O();return}if(s.q.subtract(e.ONE).gcd(s.e).compareTo(e.ONE)!==0){s.q=null,P(s.qBits,K);return}if(s.p1=s.p.subtract(e.ONE),s.q1=s.q.subtract(e.ONE),s.phi=s.p1.multiply(s.q1),s.phi.gcd(s.e).compareTo(e.ONE)!==0){s.p=s.q=null,O();return}if(s.n=s.p.multiply(s.q),s.n.bitLength()!==s.bits){s.q=null,P(s.qBits,K);return}var Y=s.e.modInverse(s.phi);s.keys={privateKey:x.rsa.setPrivateKey(s.n,s.e,Y,s.p,s.q,Y.mod(s.p1),Y.mod(s.q1),s.q.modInverse(s.p)),publicKey:x.rsa.setPublicKey(s.n,s.e)},B(null,s.keys)}}function i(s){var n=s.toString(16);n[0]>="8"&&(n="00"+n);var B=t.util.hexToBytes(n);return B.length>1&&(B.charCodeAt(0)===0&&(B.charCodeAt(1)&128)===0||B.charCodeAt(0)===255&&(B.charCodeAt(1)&128)===128)?B.substr(1):B}function h(s){return s<=100?27:s<=150?18:s<=200?15:s<=250?12:s<=300?9:s<=350?8:s<=400?7:s<=500?6:s<=600?5:s<=800?4:s<=1250?3:2}function p(s){return t.util.isNodejs&&typeof a[s]=="function"}function I(s){return typeof A.globalScope!="undefined"&&typeof A.globalScope.crypto=="object"&&typeof A.globalScope.crypto.subtle=="object"&&typeof A.globalScope.crypto.subtle[s]=="function"}function L(s){return typeof A.globalScope!="undefined"&&typeof A.globalScope.msCrypto=="object"&&typeof A.globalScope.msCrypto.subtle=="object"&&typeof A.globalScope.msCrypto.subtle[s]=="function"}function c(s){for(var n=t.util.hexToBytes(s.toString(16)),B=new Uint8Array(n.length),D=0;D<n.length;++D)B[D]=n.charCodeAt(D);return B}return nr}var ir,ta;function ra(){if(ta)return ir;ta=1;var t=ue();if(ct(),nt(),St(),st(),ht(),$t(),pt(),Ze(),Yr(),Bt(),ce(),typeof e=="undefined")var e=t.jsbn.BigInteger;var a=t.asn1,d=t.pki=t.pki||{};ir=d.pbe=t.pbe=t.pbe||{};var A=d.oids,x={name:"EncryptedPrivateKeyInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:a.Class.UNIVERSAL,type:a.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},l={name:"PBES2Algorithms",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:a.Class.UNIVERSAL,type:a.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:a.Class.UNIVERSAL,type:a.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},r={name:"pkcs-12PbeParams",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:a.Class.UNIVERSAL,type:a.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"iterations"}]};d.encryptPrivateKeyInfo=function(E,u,v){v=v||{},v.saltSize=v.saltSize||8,v.count=v.count||2048,v.algorithm=v.algorithm||"aes128",v.prfAlgorithm=v.prfAlgorithm||"sha1";var C=t.random.getBytesSync(v.saltSize),y=v.count,i=a.integerToDer(y),h,p,I;if(v.algorithm.indexOf("aes")===0||v.algorithm==="des"){var L,c,s;switch(v.algorithm){case"aes128":h=16,L=16,c=A["aes128-CBC"],s=t.aes.createEncryptionCipher;break;case"aes192":h=24,L=16,c=A["aes192-CBC"],s=t.aes.createEncryptionCipher;break;case"aes256":h=32,L=16,c=A["aes256-CBC"],s=t.aes.createEncryptionCipher;break;case"des":h=8,L=8,c=A.desCBC,s=t.des.createEncryptionCipher;break;default:var n=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw n.algorithm=v.algorithm,n}var B="hmacWith"+v.prfAlgorithm.toUpperCase(),D=S(B),O=t.pkcs5.pbkdf2(u,C,y,h,D),P=t.random.getBytesSync(L),K=s(O);K.start(P),K.update(a.toDer(E)),K.finish(),I=K.output.getBytes();var q=R(C,i,h,B);p=a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(A.pkcs5PBES2).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(A.pkcs5PBKDF2).getBytes()),q]),a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(c).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.OCTETSTRING,!1,P)])])])}else if(v.algorithm==="3des"){h=24;var M=new t.util.ByteBuffer(C),O=d.pbe.generatePkcs12Key(u,M,1,y,h),P=d.pbe.generatePkcs12Key(u,M,2,y,h),K=t.des.createEncryptionCipher(O);K.start(P),K.update(a.toDer(E)),K.finish(),I=K.output.getBytes(),p=a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(A["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OCTETSTRING,!1,C),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,i.getBytes())])])}else{var n=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw n.algorithm=v.algorithm,n}var G=a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[p,a.create(a.Class.UNIVERSAL,a.Type.OCTETSTRING,!1,I)]);return G},d.decryptPrivateKeyInfo=function(E,u){var v=null,C={},y=[];if(!a.validate(E,x,C,y)){var i=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw i.errors=y,i}var h=a.derToOid(C.encryptionOid),p=d.pbe.getCipher(h,C.encryptionParams,u),I=t.util.createBuffer(C.encryptedData);return p.update(I),p.finish()&&(v=a.fromDer(p.output)),v},d.encryptedPrivateKeyToPem=function(E,u){var v={type:"ENCRYPTED PRIVATE KEY",body:a.toDer(E).getBytes()};return t.pem.encode(v,{maxline:u})},d.encryptedPrivateKeyFromPem=function(E){var u=t.pem.decode(E)[0];if(u.type!=="ENCRYPTED PRIVATE KEY"){var v=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw v.headerType=u.type,v}if(u.procType&&u.procType.type==="ENCRYPTED")throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return a.fromDer(u.body)},d.encryptRsaPrivateKey=function(E,u,v){if(v=v||{},!v.legacy){var C=d.wrapRsaPrivateKey(d.privateKeyToAsn1(E));return C=d.encryptPrivateKeyInfo(C,u,v),d.encryptedPrivateKeyToPem(C)}var y,i,h,p;switch(v.algorithm){case"aes128":y="AES-128-CBC",h=16,i=t.random.getBytesSync(16),p=t.aes.createEncryptionCipher;break;case"aes192":y="AES-192-CBC",h=24,i=t.random.getBytesSync(16),p=t.aes.createEncryptionCipher;break;case"aes256":y="AES-256-CBC",h=32,i=t.random.getBytesSync(16),p=t.aes.createEncryptionCipher;break;case"3des":y="DES-EDE3-CBC",h=24,i=t.random.getBytesSync(8),p=t.des.createEncryptionCipher;break;case"des":y="DES-CBC",h=8,i=t.random.getBytesSync(8),p=t.des.createEncryptionCipher;break;default:var I=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+v.algorithm+'".');throw I.algorithm=v.algorithm,I}var L=t.pbe.opensslDeriveBytes(u,i.substr(0,8),h),c=p(L);c.start(i),c.update(a.toDer(d.privateKeyToAsn1(E))),c.finish();var s={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:y,parameters:t.util.bytesToHex(i).toUpperCase()},body:c.output.getBytes()};return t.pem.encode(s)},d.decryptRsaPrivateKey=function(E,u){var v=null,C=t.pem.decode(E)[0];if(C.type!=="ENCRYPTED PRIVATE KEY"&&C.type!=="PRIVATE KEY"&&C.type!=="RSA PRIVATE KEY"){var y=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".');throw y.headerType=y,y}if(C.procType&&C.procType.type==="ENCRYPTED"){var i,h;switch(C.dekInfo.algorithm){case"DES-CBC":i=8,h=t.des.createDecryptionCipher;break;case"DES-EDE3-CBC":i=24,h=t.des.createDecryptionCipher;break;case"AES-128-CBC":i=16,h=t.aes.createDecryptionCipher;break;case"AES-192-CBC":i=24,h=t.aes.createDecryptionCipher;break;case"AES-256-CBC":i=32,h=t.aes.createDecryptionCipher;break;case"RC2-40-CBC":i=5,h=function(s){return t.rc2.createDecryptionCipher(s,40)};break;case"RC2-64-CBC":i=8,h=function(s){return t.rc2.createDecryptionCipher(s,64)};break;case"RC2-128-CBC":i=16,h=function(s){return t.rc2.createDecryptionCipher(s,128)};break;default:var y=new Error('Could not decrypt private key; unsupported encryption algorithm "'+C.dekInfo.algorithm+'".');throw y.algorithm=C.dekInfo.algorithm,y}var p=t.util.hexToBytes(C.dekInfo.parameters),I=t.pbe.opensslDeriveBytes(u,p.substr(0,8),i),L=h(I);if(L.start(p),L.update(t.util.createBuffer(C.body)),L.finish())v=L.output.getBytes();else return v}else v=C.body;return C.type==="ENCRYPTED PRIVATE KEY"?v=d.decryptPrivateKeyInfo(a.fromDer(v),u):v=a.fromDer(v),v!==null&&(v=d.privateKeyFromAsn1(v)),v},d.pbe.generatePkcs12Key=function(E,u,v,C,y,i){var h,p;if(typeof i=="undefined"||i===null){if(!("sha1"in t.md))throw new Error('"sha1" hash algorithm unavailable.');i=t.md.sha1.create()}var I=i.digestLength,L=i.blockLength,c=new t.util.ByteBuffer,s=new t.util.ByteBuffer;if(E!=null){for(p=0;p<E.length;p++)s.putInt16(E.charCodeAt(p));s.putInt16(0)}var n=s.length(),B=u.length(),D=new t.util.ByteBuffer;D.fillWithByte(v,L);var O=L*Math.ceil(B/L),P=new t.util.ByteBuffer;for(p=0;p<O;p++)P.putByte(u.at(p%B));var K=L*Math.ceil(n/L),q=new t.util.ByteBuffer;for(p=0;p<K;p++)q.putByte(s.at(p%n));var M=P;M.putBuffer(q);for(var G=Math.ceil(y/I),Y=1;Y<=G;Y++){var W=new t.util.ByteBuffer;W.putBytes(D.bytes()),W.putBytes(M.bytes());for(var ee=0;ee<C;ee++)i.start(),i.update(W.getBytes()),W=i.digest();var ne=new t.util.ByteBuffer;for(p=0;p<L;p++)ne.putByte(W.at(p%I));var ie=Math.ceil(B/L)+Math.ceil(n/L),he=new t.util.ByteBuffer;for(h=0;h<ie;h++){var ve=new t.util.ByteBuffer(M.getBytes(L)),fe=511;for(p=ne.length()-1;p>=0;p--)fe=fe>>8,fe+=ne.at(p)+ve.at(p),ve.setAt(p,fe&255);he.putBuffer(ve)}M=he,c.putBuffer(W)}return c.truncate(c.length()-y),c},d.pbe.getCipher=function(E,u,v){switch(E){case d.oids.pkcs5PBES2:return d.pbe.getCipherForPBES2(E,u,v);case d.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case d.oids["pbewithSHAAnd40BitRC2-CBC"]:return d.pbe.getCipherForPKCS12PBE(E,u,v);default:var C=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw C.oid=E,C.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],C}},d.pbe.getCipherForPBES2=function(E,u,v){var C={},y=[];if(!a.validate(u,l,C,y)){var i=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw i.errors=y,i}if(E=a.derToOid(C.kdfOid),E!==d.oids.pkcs5PBKDF2){var i=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw i.oid=E,i.supportedOids=["pkcs5PBKDF2"],i}if(E=a.derToOid(C.encOid),E!==d.oids["aes128-CBC"]&&E!==d.oids["aes192-CBC"]&&E!==d.oids["aes256-CBC"]&&E!==d.oids["des-EDE3-CBC"]&&E!==d.oids.desCBC){var i=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw i.oid=E,i.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],i}var h=C.kdfSalt,p=t.util.createBuffer(C.kdfIterationCount);p=p.getInt(p.length()<<3);var I,L;switch(d.oids[E]){case"aes128-CBC":I=16,L=t.aes.createDecryptionCipher;break;case"aes192-CBC":I=24,L=t.aes.createDecryptionCipher;break;case"aes256-CBC":I=32,L=t.aes.createDecryptionCipher;break;case"des-EDE3-CBC":I=24,L=t.des.createDecryptionCipher;break;case"desCBC":I=8,L=t.des.createDecryptionCipher;break}var c=f(C.prfOid),s=t.pkcs5.pbkdf2(v,h,p,I,c),n=C.encIv,B=L(s);return B.start(n),B},d.pbe.getCipherForPKCS12PBE=function(E,u,v){var C={},y=[];if(!a.validate(u,r,C,y)){var i=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw i.errors=y,i}var h=t.util.createBuffer(C.salt),p=t.util.createBuffer(C.iterations);p=p.getInt(p.length()<<3);var I,L,c;switch(E){case d.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:I=24,L=8,c=t.des.startDecrypting;break;case d.oids["pbewithSHAAnd40BitRC2-CBC"]:I=5,L=8,c=function(O,P){var K=t.rc2.createDecryptionCipher(O,40);return K.start(P,null),K};break;default:var i=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw i.oid=E,i}var s=f(C.prfOid),n=d.pbe.generatePkcs12Key(v,h,1,p,I,s);s.start();var B=d.pbe.generatePkcs12Key(v,h,2,p,L,s);return c(n,B)},d.pbe.opensslDeriveBytes=function(E,u,v,C){if(typeof C=="undefined"||C===null){if(!("md5"in t.md))throw new Error('"md5" hash algorithm unavailable.');C=t.md.md5.create()}u===null&&(u="");for(var y=[g(C,E+u)],i=16,h=1;i<v;++h,i+=16)y.push(g(C,y[h-1]+E+u));return y.join("").substr(0,v)};function g(E,u){return E.start().update(u).digest().getBytes()}function f(E){var u;if(!E)u="hmacWithSHA1";else if(u=d.oids[a.derToOid(E)],!u){var v=new Error("Unsupported PRF OID.");throw v.oid=E,v.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],v}return S(u)}function S(E){var u=t.md;switch(E){case"hmacWithSHA224":u=t.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":E=E.substr(8).toLowerCase();break;default:var v=new Error("Unsupported PRF algorithm.");throw v.algorithm=E,v.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],v}if(!u||!(E in u))throw new Error("Unknown hash algorithm: "+E);return u[E].create()}function R(E,u,v,C){var y=a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OCTETSTRING,!1,E),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,u.getBytes())]);return C!=="hmacWithSHA1"&&y.value.push(a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,t.util.hexToBytes(v.toString(16))),a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(d.oids[C]).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.NULL,!1,"")])),y}return ir}var sr={exports:{}},or={exports:{}},aa;function na(){if(aa)return or.exports;aa=1;var t=ue();nt(),ce();var e=t.asn1,a=or.exports=t.pkcs7asn1=t.pkcs7asn1||{};t.pkcs7=t.pkcs7||{},t.pkcs7.asn1=a;var d={name:"ContentInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};a.contentInfoValidator=d;var A={name:"EncryptedContentInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:e.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};a.envelopedDataValidator={name:"EnvelopedData",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:e.Class.UNIVERSAL,type:e.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(A)},a.encryptedDataValidator={name:"EncryptedData",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"version"}].concat(A)};var x={name:"SignerInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:e.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:e.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};return a.signedDataValidator={name:"SignedData",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:e.Class.UNIVERSAL,type:e.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},d,{name:"SignedData.Certificates",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:e.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:e.Class.UNIVERSAL,type:e.Type.SET,capture:"signerInfos",optional:!0,value:[x]}]},a.recipientInfoValidator={name:"RecipientInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:e.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter",optional:!0}]},{name:"RecipientInfo.encryptedKey",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]},or.exports}var ur={exports:{}},fr={exports:{}},ia;function sa(){if(ia)return fr.exports;ia=1;var t=ue();ce(),t.mgf=t.mgf||{};var e=fr.exports=t.mgf.mgf1=t.mgf1=t.mgf1||{};return e.create=function(a){var d={generate:function(A,x){for(var l=new t.util.ByteBuffer,r=Math.ceil(x/a.digestLength),g=0;g<r;g++){var f=new t.util.ByteBuffer;f.putInt32(g),a.start(),a.update(A+f.getBytes()),l.putBuffer(a.digest())}return l.truncate(l.length()-x),l.getBytes()}};return d},fr.exports}var lr,oa;function qa(){if(oa)return lr;oa=1;var t=ue();return sa(),lr=t.mgf=t.mgf||{},t.mgf.mgf1=t.mgf1,lr}var cr={exports:{}},ua;function hr(){if(ua)return cr.exports;ua=1;var t=ue();Ze(),ce();var e=cr.exports=t.pss=t.pss||{};return e.create=function(a){arguments.length===3&&(a={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var d=a.md,A=a.mgf,x=d.digestLength,l=a.salt||null;typeof l=="string"&&(l=t.util.createBuffer(l));var r;if("saltLength"in a)r=a.saltLength;else if(l!==null)r=l.length();else throw new Error("Salt length not specified or specific salt not given.");if(l!==null&&l.length()!==r)throw new Error("Given salt length does not match length of given salt.");var g=a.prng||t.random,f={};return f.encode=function(S,R){var E,u=R-1,v=Math.ceil(u/8),C=S.digest().getBytes();if(v<x+r+2)throw new Error("Message is too long to encrypt.");var y;l===null?y=g.getBytesSync(r):y=l.bytes();var i=new t.util.ByteBuffer;i.fillWithByte(0,8),i.putBytes(C),i.putBytes(y),d.start(),d.update(i.getBytes());var h=d.digest().getBytes(),p=new t.util.ByteBuffer;p.fillWithByte(0,v-r-x-2),p.putByte(1),p.putBytes(y);var I=p.getBytes(),L=v-x-1,c=A.generate(h,L),s="";for(E=0;E<L;E++)s+=String.fromCharCode(I.charCodeAt(E)^c.charCodeAt(E));var n=65280>>8*v-u&255;return s=String.fromCharCode(s.charCodeAt(0)&~n)+s.substr(1),s+h+"¼"},f.verify=function(S,R,E){var u,v=E-1,C=Math.ceil(v/8);if(R=R.substr(-C),C<x+r+2)throw new Error("Inconsistent parameters to PSS signature verification.");if(R.charCodeAt(C-1)!==188)throw new Error("Encoded message does not end in 0xBC.");var y=C-x-1,i=R.substr(0,y),h=R.substr(y,x),p=65280>>8*C-v&255;if((i.charCodeAt(0)&p)!==0)throw new Error("Bits beyond keysize not zero as expected.");var I=A.generate(h,y),L="";for(u=0;u<y;u++)L+=String.fromCharCode(i.charCodeAt(u)^I.charCodeAt(u));L=String.fromCharCode(L.charCodeAt(0)&~p)+L.substr(1);var c=C-x-r-2;for(u=0;u<c;u++)if(L.charCodeAt(u)!==0)throw new Error("Leftmost octets not zero as expected");if(L.charCodeAt(c)!==1)throw new Error("Inconsistent PSS signature, 0x01 marker not found");var s=L.substr(-r),n=new t.util.ByteBuffer;n.fillWithByte(0,8),n.putBytes(S),n.putBytes(s),d.start(),d.update(n.getBytes());var B=d.digest().getBytes();return h===B},f},cr.exports}var fa;function dr(){if(fa)return ur.exports;fa=1;var t=ue();ct(),nt(),St(),st(),qa(),ht(),pt(),hr(),Bt(),ce();var e=t.asn1,a=ur.exports=t.pki=t.pki||{},d=a.oids,A={};A.CN=d.commonName,A.commonName="CN",A.C=d.countryName,A.countryName="C",A.L=d.localityName,A.localityName="L",A.ST=d.stateOrProvinceName,A.stateOrProvinceName="ST",A.O=d.organizationName,A.organizationName="O",A.OU=d.organizationalUnitName,A.organizationalUnitName="OU",A.E=d.emailAddress,A.emailAddress="E";var x=t.pki.rsa.publicKeyValidator,l={name:"Certificate",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:e.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:e.Class.UNIVERSAL,type:e.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:e.Class.UNIVERSAL,type:e.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:e.Class.UNIVERSAL,type:e.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:e.Class.UNIVERSAL,type:e.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},x,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:e.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:e.Class.UNIVERSAL,type:e.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:e.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:e.Class.UNIVERSAL,type:e.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:e.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:e.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:e.Class.UNIVERSAL,type:e.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},r={name:"rsapss",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:e.Class.UNIVERSAL,type:e.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:e.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:e.Class.UNIVERSAL,type:e.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:e.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:e.Class.UNIVERSAL,type:e.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:e.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",tagClass:e.Class.UNIVERSAL,type:e.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},g={name:"CertificationRequestInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},x,{name:"CertificationRequestInfo.attributes",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:e.Class.UNIVERSAL,type:e.Type.SET,constructed:!0}]}]}]},f={name:"CertificationRequest",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[g,{name:"CertificationRequest.signatureAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:e.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:e.Class.UNIVERSAL,type:e.Type.BITSTRING,constructed:!1,captureBitStringValue:"csrSignature"}]};a.RDNAttributesAsArray=function(c,s){for(var n=[],B,D,O,P=0;P<c.value.length;++P){B=c.value[P];for(var K=0;K<B.value.length;++K)O={},D=B.value[K],O.type=e.derToOid(D.value[0].value),O.value=D.value[1].value,O.valueTagClass=D.value[1].type,O.type in d&&(O.name=d[O.type],O.name in A&&(O.shortName=A[O.name])),s&&(s.update(O.type),s.update(O.value)),n.push(O)}return n},a.CRIAttributesAsArray=function(c){for(var s=[],n=0;n<c.length;++n)for(var B=c[n],D=e.derToOid(B.value[0].value),O=B.value[1].value,P=0;P<O.length;++P){var K={};if(K.type=D,K.value=O[P].value,K.valueTagClass=O[P].type,K.type in d&&(K.name=d[K.type],K.name in A&&(K.shortName=A[K.name])),K.type===d.extensionRequest){K.extensions=[];for(var q=0;q<K.value.length;++q)K.extensions.push(a.certificateExtensionFromAsn1(K.value[q]))}s.push(K)}return s};function S(c,s){typeof s=="string"&&(s={shortName:s});for(var n=null,B,D=0;n===null&&D<c.attributes.length;++D)B=c.attributes[D],(s.type&&s.type===B.type||s.name&&s.name===B.name||s.shortName&&s.shortName===B.shortName)&&(n=B);return n}var R=function(c,s,n){var B={};if(c!==d["RSASSA-PSS"])return B;n&&(B={hash:{algorithmOid:d.sha1},mgf:{algorithmOid:d.mgf1,hash:{algorithmOid:d.sha1}},saltLength:20});var D={},O=[];if(!e.validate(s,r,D,O)){var P=new Error("Cannot read RSASSA-PSS parameter block.");throw P.errors=O,P}return D.hashOid!==void 0&&(B.hash=B.hash||{},B.hash.algorithmOid=e.derToOid(D.hashOid)),D.maskGenOid!==void 0&&(B.mgf=B.mgf||{},B.mgf.algorithmOid=e.derToOid(D.maskGenOid),B.mgf.hash=B.mgf.hash||{},B.mgf.hash.algorithmOid=e.derToOid(D.maskGenHashOid)),D.saltLength!==void 0&&(B.saltLength=D.saltLength.charCodeAt(0)),B},E=function(c){switch(d[c.signatureOid]){case"sha1WithRSAEncryption":case"sha1WithRSASignature":return t.md.sha1.create();case"md5WithRSAEncryption":return t.md.md5.create();case"sha256WithRSAEncryption":return t.md.sha256.create();case"sha384WithRSAEncryption":return t.md.sha384.create();case"sha512WithRSAEncryption":return t.md.sha512.create();case"RSASSA-PSS":return t.md.sha256.create();default:var s=new Error("Could not compute "+c.type+" digest. Unknown signature OID.");throw s.signatureOid=c.signatureOid,s}},u=function(c){var s=c.certificate,n;switch(s.signatureOid){case d.sha1WithRSAEncryption:case d.sha1WithRSASignature:break;case d["RSASSA-PSS"]:var B,D;if(B=d[s.signatureParameters.mgf.hash.algorithmOid],B===void 0||t.md[B]===void 0){var O=new Error("Unsupported MGF hash function.");throw O.oid=s.signatureParameters.mgf.hash.algorithmOid,O.name=B,O}if(D=d[s.signatureParameters.mgf.algorithmOid],D===void 0||t.mgf[D]===void 0){var O=new Error("Unsupported MGF function.");throw O.oid=s.signatureParameters.mgf.algorithmOid,O.name=D,O}if(D=t.mgf[D].create(t.md[B].create()),B=d[s.signatureParameters.hash.algorithmOid],B===void 0||t.md[B]===void 0){var O=new Error("Unsupported RSASSA-PSS hash function.");throw O.oid=s.signatureParameters.hash.algorithmOid,O.name=B,O}n=t.pss.create(t.md[B].create(),D,s.signatureParameters.saltLength);break}return s.publicKey.verify(c.md.digest().getBytes(),c.signature,n)};a.certificateFromPem=function(c,s,n){var B=t.pem.decode(c)[0];if(B.type!=="CERTIFICATE"&&B.type!=="X509 CERTIFICATE"&&B.type!=="TRUSTED CERTIFICATE"){var D=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw D.headerType=B.type,D}if(B.procType&&B.procType.type==="ENCRYPTED")throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var O=e.fromDer(B.body,n);return a.certificateFromAsn1(O,s)},a.certificateToPem=function(c,s){var n={type:"CERTIFICATE",body:e.toDer(a.certificateToAsn1(c)).getBytes()};return t.pem.encode(n,{maxline:s})},a.publicKeyFromPem=function(c){var s=t.pem.decode(c)[0];if(s.type!=="PUBLIC KEY"&&s.type!=="RSA PUBLIC KEY"){var n=new Error('Could not convert public key from PEM; PEM header type is not "PUBLIC KEY" or "RSA PUBLIC KEY".');throw n.headerType=s.type,n}if(s.procType&&s.procType.type==="ENCRYPTED")throw new Error("Could not convert public key from PEM; PEM is encrypted.");var B=e.fromDer(s.body);return a.publicKeyFromAsn1(B)},a.publicKeyToPem=function(c,s){var n={type:"PUBLIC KEY",body:e.toDer(a.publicKeyToAsn1(c)).getBytes()};return t.pem.encode(n,{maxline:s})},a.publicKeyToRSAPublicKeyPem=function(c,s){var n={type:"RSA PUBLIC KEY",body:e.toDer(a.publicKeyToRSAPublicKey(c)).getBytes()};return t.pem.encode(n,{maxline:s})},a.getPublicKeyFingerprint=function(c,s){s=s||{};var n=s.md||t.md.sha1.create(),B=s.type||"RSAPublicKey",D;switch(B){case"RSAPublicKey":D=e.toDer(a.publicKeyToRSAPublicKey(c)).getBytes();break;case"SubjectPublicKeyInfo":D=e.toDer(a.publicKeyToAsn1(c)).getBytes();break;default:throw new Error('Unknown fingerprint type "'+s.type+'".')}n.start(),n.update(D);var O=n.digest();if(s.encoding==="hex"){var P=O.toHex();return s.delimiter?P.match(/.{2}/g).join(s.delimiter):P}else{if(s.encoding==="binary")return O.getBytes();if(s.encoding)throw new Error('Unknown encoding "'+s.encoding+'".')}return O},a.certificationRequestFromPem=function(c,s,n){var B=t.pem.decode(c)[0];if(B.type!=="CERTIFICATE REQUEST"){var D=new Error('Could not convert certification request from PEM; PEM header type is not "CERTIFICATE REQUEST".');throw D.headerType=B.type,D}if(B.procType&&B.procType.type==="ENCRYPTED")throw new Error("Could not convert certification request from PEM; PEM is encrypted.");var O=e.fromDer(B.body,n);return a.certificationRequestFromAsn1(O,s)},a.certificationRequestToPem=function(c,s){var n={type:"CERTIFICATE REQUEST",body:e.toDer(a.certificationRequestToAsn1(c)).getBytes()};return t.pem.encode(n,{maxline:s})},a.createCertificate=function(){var c={};return c.version=2,c.serialNumber="00",c.signatureOid=null,c.signature=null,c.siginfo={},c.siginfo.algorithmOid=null,c.validity={},c.validity.notBefore=new Date,c.validity.notAfter=new Date,c.issuer={},c.issuer.getField=function(s){return S(c.issuer,s)},c.issuer.addField=function(s){C([s]),c.issuer.attributes.push(s)},c.issuer.attributes=[],c.issuer.hash=null,c.subject={},c.subject.getField=function(s){return S(c.subject,s)},c.subject.addField=function(s){C([s]),c.subject.attributes.push(s)},c.subject.attributes=[],c.subject.hash=null,c.extensions=[],c.publicKey=null,c.md=null,c.setSubject=function(s,n){C(s),c.subject.attributes=s,delete c.subject.uniqueId,n&&(c.subject.uniqueId=n),c.subject.hash=null},c.setIssuer=function(s,n){C(s),c.issuer.attributes=s,delete c.issuer.uniqueId,n&&(c.issuer.uniqueId=n),c.issuer.hash=null},c.setExtensions=function(s){for(var n=0;n<s.length;++n)y(s[n],{cert:c});c.extensions=s},c.getExtension=function(s){typeof s=="string"&&(s={name:s});for(var n=null,B,D=0;n===null&&D<c.extensions.length;++D)B=c.extensions[D],(s.id&&B.id===s.id||s.name&&B.name===s.name)&&(n=B);return n},c.sign=function(s,n){c.md=n||t.md.sha1.create();var B=d[c.md.algorithm+"WithRSAEncryption"];if(!B){var D=new Error("Could not compute certificate digest. Unknown message digest algorithm OID.");throw D.algorithm=c.md.algorithm,D}c.signatureOid=c.siginfo.algorithmOid=B,c.tbsCertificate=a.getTBSCertificate(c);var O=e.toDer(c.tbsCertificate);c.md.update(O.getBytes()),c.signature=s.sign(c.md)},c.verify=function(s){var n=!1;if(!c.issued(s)){var B=s.issuer,D=c.subject,O=new Error("The parent certificate did not issue the given child certificate; the child certificate's issuer does not match the parent's subject.");throw O.expectedIssuer=D.attributes,O.actualIssuer=B.attributes,O}var P=s.md;if(P===null){P=E({signatureOid:s.signatureOid,type:"certificate"});var K=s.tbsCertificate||a.getTBSCertificate(s),q=e.toDer(K);P.update(q.getBytes())}return P!==null&&(n=u({certificate:c,md:P,signature:s.signature})),n},c.isIssuer=function(s){var n=!1,B=c.issuer,D=s.subject;if(B.hash&&D.hash)n=B.hash===D.hash;else if(B.attributes.length===D.attributes.length){n=!0;for(var O,P,K=0;n&&K<B.attributes.length;++K)O=B.attributes[K],P=D.attributes[K],(O.type!==P.type||O.value!==P.value)&&(n=!1)}return n},c.issued=function(s){return s.isIssuer(c)},c.generateSubjectKeyIdentifier=function(){return a.getPublicKeyFingerprint(c.publicKey,{type:"RSAPublicKey"})},c.verifySubjectKeyIdentifier=function(){for(var s=d.subjectKeyIdentifier,n=0;n<c.extensions.length;++n){var B=c.extensions[n];if(B.id===s){var D=c.generateSubjectKeyIdentifier().getBytes();return t.util.hexToBytes(B.subjectKeyIdentifier)===D}}return!1},c},a.certificateFromAsn1=function(c,s){var n={},B=[];if(!e.validate(c,l,n,B)){var D=new Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate.");throw D.errors=B,D}var O=e.derToOid(n.publicKeyOid);if(O!==a.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var P=a.createCertificate();P.version=n.certVersion?n.certVersion.charCodeAt(0):0;var K=t.util.createBuffer(n.certSerialNumber);P.serialNumber=K.toHex(),P.signatureOid=t.asn1.derToOid(n.certSignatureOid),P.signatureParameters=R(P.signatureOid,n.certSignatureParams,!0),P.siginfo.algorithmOid=t.asn1.derToOid(n.certinfoSignatureOid),P.siginfo.parameters=R(P.siginfo.algorithmOid,n.certinfoSignatureParams,!1),P.signature=n.certSignature;var q=[];if(n.certValidity1UTCTime!==void 0&&q.push(e.utcTimeToDate(n.certValidity1UTCTime)),n.certValidity2GeneralizedTime!==void 0&&q.push(e.generalizedTimeToDate(n.certValidity2GeneralizedTime)),n.certValidity3UTCTime!==void 0&&q.push(e.utcTimeToDate(n.certValidity3UTCTime)),n.certValidity4GeneralizedTime!==void 0&&q.push(e.generalizedTimeToDate(n.certValidity4GeneralizedTime)),q.length>2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(q.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(P.validity.notBefore=q[0],P.validity.notAfter=q[1],P.tbsCertificate=n.tbsCertificate,s){P.md=E({signatureOid:P.signatureOid,type:"certificate"});var M=e.toDer(P.tbsCertificate);P.md.update(M.getBytes())}var G=t.md.sha1.create(),Y=e.toDer(n.certIssuer);G.update(Y.getBytes()),P.issuer.getField=function(ne){return S(P.issuer,ne)},P.issuer.addField=function(ne){C([ne]),P.issuer.attributes.push(ne)},P.issuer.attributes=a.RDNAttributesAsArray(n.certIssuer),n.certIssuerUniqueId&&(P.issuer.uniqueId=n.certIssuerUniqueId),P.issuer.hash=G.digest().toHex();var W=t.md.sha1.create(),ee=e.toDer(n.certSubject);return W.update(ee.getBytes()),P.subject.getField=function(ne){return S(P.subject,ne)},P.subject.addField=function(ne){C([ne]),P.subject.attributes.push(ne)},P.subject.attributes=a.RDNAttributesAsArray(n.certSubject),n.certSubjectUniqueId&&(P.subject.uniqueId=n.certSubjectUniqueId),P.subject.hash=W.digest().toHex(),n.certExtensions?P.extensions=a.certificateExtensionsFromAsn1(n.certExtensions):P.extensions=[],P.publicKey=a.publicKeyFromAsn1(n.subjectPublicKeyInfo),P},a.certificateExtensionsFromAsn1=function(c){for(var s=[],n=0;n<c.value.length;++n)for(var B=c.value[n],D=0;D<B.value.length;++D)s.push(a.certificateExtensionFromAsn1(B.value[D]));return s},a.certificateExtensionFromAsn1=function(c){var s={};if(s.id=e.derToOid(c.value[0].value),s.critical=!1,c.value[1].type===e.Type.BOOLEAN?(s.critical=c.value[1].value.charCodeAt(0)!==0,s.value=c.value[2].value):s.value=c.value[1].value,s.id in d){if(s.name=d[s.id],s.name==="keyUsage"){var n=e.fromDer(s.value),B=0,D=0;n.value.length>1&&(B=n.value.charCodeAt(1),D=n.value.length>2?n.value.charCodeAt(2):0),s.digitalSignature=(B&128)===128,s.nonRepudiation=(B&64)===64,s.keyEncipherment=(B&32)===32,s.dataEncipherment=(B&16)===16,s.keyAgreement=(B&8)===8,s.keyCertSign=(B&4)===4,s.cRLSign=(B&2)===2,s.encipherOnly=(B&1)===1,s.decipherOnly=(D&128)===128}else if(s.name==="basicConstraints"){var n=e.fromDer(s.value);n.value.length>0&&n.value[0].type===e.Type.BOOLEAN?s.cA=n.value[0].value.charCodeAt(0)!==0:s.cA=!1;var O=null;n.value.length>0&&n.value[0].type===e.Type.INTEGER?O=n.value[0].value:n.value.length>1&&(O=n.value[1].value),O!==null&&(s.pathLenConstraint=e.derToInteger(O))}else if(s.name==="extKeyUsage")for(var n=e.fromDer(s.value),P=0;P<n.value.length;++P){var K=e.derToOid(n.value[P].value);K in d?s[d[K]]=!0:s[K]=!0}else if(s.name==="nsCertType"){var n=e.fromDer(s.value),B=0;n.value.length>1&&(B=n.value.charCodeAt(1)),s.client=(B&128)===128,s.server=(B&64)===64,s.email=(B&32)===32,s.objsign=(B&16)===16,s.reserved=(B&8)===8,s.sslCA=(B&4)===4,s.emailCA=(B&2)===2,s.objCA=(B&1)===1}else if(s.name==="subjectAltName"||s.name==="issuerAltName"){s.altNames=[];for(var q,n=e.fromDer(s.value),M=0;M<n.value.length;++M){q=n.value[M];var G={type:q.type,value:q.value};switch(s.altNames.push(G),q.type){case 1:case 2:case 6:break;case 7:G.ip=t.util.bytesToIP(q.value);break;case 8:G.oid=e.derToOid(q.value);break}}}else if(s.name==="subjectKeyIdentifier"){var n=e.fromDer(s.value);s.subjectKeyIdentifier=t.util.bytesToHex(n.value)}}return s},a.certificationRequestFromAsn1=function(c,s){var n={},B=[];if(!e.validate(c,f,n,B)){var D=new Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest.");throw D.errors=B,D}var O=e.derToOid(n.publicKeyOid);if(O!==a.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var P=a.createCertificationRequest();if(P.version=n.csrVersion?n.csrVersion.charCodeAt(0):0,P.signatureOid=t.asn1.derToOid(n.csrSignatureOid),P.signatureParameters=R(P.signatureOid,n.csrSignatureParams,!0),P.siginfo.algorithmOid=t.asn1.derToOid(n.csrSignatureOid),P.siginfo.parameters=R(P.siginfo.algorithmOid,n.csrSignatureParams,!1),P.signature=n.csrSignature,P.certificationRequestInfo=n.certificationRequestInfo,s){P.md=E({signatureOid:P.signatureOid,type:"certification request"});var K=e.toDer(P.certificationRequestInfo);P.md.update(K.getBytes())}var q=t.md.sha1.create();return P.subject.getField=function(M){return S(P.subject,M)},P.subject.addField=function(M){C([M]),P.subject.attributes.push(M)},P.subject.attributes=a.RDNAttributesAsArray(n.certificationRequestInfoSubject,q),P.subject.hash=q.digest().toHex(),P.publicKey=a.publicKeyFromAsn1(n.subjectPublicKeyInfo),P.getAttribute=function(M){return S(P,M)},P.addAttribute=function(M){C([M]),P.attributes.push(M)},P.attributes=a.CRIAttributesAsArray(n.certificationRequestInfoAttributes||[]),P},a.createCertificationRequest=function(){var c={};return c.version=0,c.signatureOid=null,c.signature=null,c.siginfo={},c.siginfo.algorithmOid=null,c.subject={},c.subject.getField=function(s){return S(c.subject,s)},c.subject.addField=function(s){C([s]),c.subject.attributes.push(s)},c.subject.attributes=[],c.subject.hash=null,c.publicKey=null,c.attributes=[],c.getAttribute=function(s){return S(c,s)},c.addAttribute=function(s){C([s]),c.attributes.push(s)},c.md=null,c.setSubject=function(s){C(s),c.subject.attributes=s,c.subject.hash=null},c.setAttributes=function(s){C(s),c.attributes=s},c.sign=function(s,n){c.md=n||t.md.sha1.create();var B=d[c.md.algorithm+"WithRSAEncryption"];if(!B){var D=new Error("Could not compute certification request digest. Unknown message digest algorithm OID.");throw D.algorithm=c.md.algorithm,D}c.signatureOid=c.siginfo.algorithmOid=B,c.certificationRequestInfo=a.getCertificationRequestInfo(c);var O=e.toDer(c.certificationRequestInfo);c.md.update(O.getBytes()),c.signature=s.sign(c.md)},c.verify=function(){var s=!1,n=c.md;if(n===null){n=E({signatureOid:c.signatureOid,type:"certification request"});var B=c.certificationRequestInfo||a.getCertificationRequestInfo(c),D=e.toDer(B);n.update(D.getBytes())}return n!==null&&(s=u({certificate:c,md:n,signature:c.signature})),s},c};function v(c){for(var s=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]),n,B,D=c.attributes,O=0;O<D.length;++O){n=D[O];var P=n.value,K=e.Type.PRINTABLESTRING;"valueTagClass"in n&&(K=n.valueTagClass,K===e.Type.UTF8&&(P=t.util.encodeUtf8(P))),B=e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(n.type).getBytes()),e.create(e.Class.UNIVERSAL,K,!1,P)])]),s.value.push(B)}return s}function C(c){for(var s,n=0;n<c.length;++n){if(s=c[n],typeof s.name=="undefined"&&(s.type&&s.type in a.oids?s.name=a.oids[s.type]:s.shortName&&s.shortName in A&&(s.name=a.oids[A[s.shortName]])),typeof s.type=="undefined")if(s.name&&s.name in a.oids)s.type=a.oids[s.name];else{var B=new Error("Attribute type not specified.");throw B.attribute=s,B}if(typeof s.shortName=="undefined"&&s.name&&s.name in A&&(s.shortName=A[s.name]),s.type===d.extensionRequest&&(s.valueConstructed=!0,s.valueTagClass=e.Type.SEQUENCE,!s.value&&s.extensions)){s.value=[];for(var D=0;D<s.extensions.length;++D)s.value.push(a.certificateExtensionToAsn1(y(s.extensions[D])))}if(typeof s.value=="undefined"){var B=new Error("Attribute value not specified.");throw B.attribute=s,B}}}function y(c,s){if(s=s||{},typeof c.name=="undefined"&&c.id&&c.id in a.oids&&(c.name=a.oids[c.id]),typeof c.id=="undefined")if(c.name&&c.name in a.oids)c.id=a.oids[c.name];else{var n=new Error("Extension ID not specified.");throw n.extension=c,n}if(typeof c.value!="undefined")return c;if(c.name==="keyUsage"){var B=0,D=0,O=0;c.digitalSignature&&(D|=128,B=7),c.nonRepudiation&&(D|=64,B=6),c.keyEncipherment&&(D|=32,B=5),c.dataEncipherment&&(D|=16,B=4),c.keyAgreement&&(D|=8,B=3),c.keyCertSign&&(D|=4,B=2),c.cRLSign&&(D|=2,B=1),c.encipherOnly&&(D|=1,B=0),c.decipherOnly&&(O|=128,B=7);var P=String.fromCharCode(B);O!==0?P+=String.fromCharCode(D)+String.fromCharCode(O):D!==0&&(P+=String.fromCharCode(D)),c.value=e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,P)}else if(c.name==="basicConstraints")c.value=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]),c.cA&&c.value.value.push(e.create(e.Class.UNIVERSAL,e.Type.BOOLEAN,!1,"ÿ")),"pathLenConstraint"in c&&c.value.value.push(e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(c.pathLenConstraint).getBytes()));else if(c.name==="extKeyUsage"){c.value=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);var K=c.value.value;for(var q in c)c[q]===!0&&(q in d?K.push(e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(d[q]).getBytes())):q.indexOf(".")!==-1&&K.push(e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(q).getBytes())))}else if(c.name==="nsCertType"){var B=0,D=0;c.client&&(D|=128,B=7),c.server&&(D|=64,B=6),c.email&&(D|=32,B=5),c.objsign&&(D|=16,B=4),c.reserved&&(D|=8,B=3),c.sslCA&&(D|=4,B=2),c.emailCA&&(D|=2,B=1),c.objCA&&(D|=1,B=0);var P=String.fromCharCode(B);D!==0&&(P+=String.fromCharCode(D)),c.value=e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,P)}else if(c.name==="subjectAltName"||c.name==="issuerAltName"){c.value=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);for(var M,G=0;G<c.altNames.length;++G){M=c.altNames[G];var P=M.value;if(M.type===7&&M.ip){if(P=t.util.bytesFromIP(M.ip),P===null){var n=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw n.extension=c,n}}else M.type===8&&(M.oid?P=e.oidToDer(e.oidToDer(M.oid)):P=e.oidToDer(P));c.value.value.push(e.create(e.Class.CONTEXT_SPECIFIC,M.type,!1,P))}}else if(c.name==="nsComment"&&s.cert){if(!/^[\x00-\x7F]*$/.test(c.comment)||c.comment.length<1||c.comment.length>128)throw new Error('Invalid "nsComment" content.');c.value=e.create(e.Class.UNIVERSAL,e.Type.IA5STRING,!1,c.comment)}else if(c.name==="subjectKeyIdentifier"&&s.cert){var Y=s.cert.generateSubjectKeyIdentifier();c.subjectKeyIdentifier=Y.toHex(),c.value=e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,Y.getBytes())}else if(c.name==="authorityKeyIdentifier"&&s.cert){c.value=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);var K=c.value.value;if(c.keyIdentifier){var W=c.keyIdentifier===!0?s.cert.generateSubjectKeyIdentifier().getBytes():c.keyIdentifier;K.push(e.create(e.Class.CONTEXT_SPECIFIC,0,!1,W))}if(c.authorityCertIssuer){var ee=[e.create(e.Class.CONTEXT_SPECIFIC,4,!0,[v(c.authorityCertIssuer===!0?s.cert.issuer:c.authorityCertIssuer)])];K.push(e.create(e.Class.CONTEXT_SPECIFIC,1,!0,ee))}if(c.serialNumber){var ne=t.util.hexToBytes(c.serialNumber===!0?s.cert.serialNumber:c.serialNumber);K.push(e.create(e.Class.CONTEXT_SPECIFIC,2,!1,ne))}}else if(c.name==="cRLDistributionPoints"){c.value=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);for(var K=c.value.value,ie=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]),he=e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[]),M,G=0;G<c.altNames.length;++G){M=c.altNames[G];var P=M.value;if(M.type===7&&M.ip){if(P=t.util.bytesFromIP(M.ip),P===null){var n=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw n.extension=c,n}}else M.type===8&&(M.oid?P=e.oidToDer(e.oidToDer(M.oid)):P=e.oidToDer(P));he.value.push(e.create(e.Class.CONTEXT_SPECIFIC,M.type,!1,P))}ie.value.push(e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[he])),K.push(ie)}if(typeof c.value=="undefined"){var n=new Error("Extension value not specified.");throw n.extension=c,n}return c}function i(c,s){if(c===d["RSASSA-PSS"]){var n=[];return s.hash.algorithmOid!==void 0&&n.push(e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(s.hash.algorithmOid).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")])])),s.mgf.algorithmOid!==void 0&&n.push(e.create(e.Class.CONTEXT_SPECIFIC,1,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(s.mgf.algorithmOid).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(s.mgf.hash.algorithmOid).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")])])])),s.saltLength!==void 0&&n.push(e.create(e.Class.CONTEXT_SPECIFIC,2,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(s.saltLength).getBytes())])),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,n)}else return e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")}function h(c){var s=e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[]);if(c.attributes.length===0)return s;for(var n=c.attributes,B=0;B<n.length;++B){var D=n[B],O=D.value,P=e.Type.UTF8;"valueTagClass"in D&&(P=D.valueTagClass),P===e.Type.UTF8&&(O=t.util.encodeUtf8(O));var K=!1;"valueConstructed"in D&&(K=D.valueConstructed);var q=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(D.type).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[e.create(e.Class.UNIVERSAL,P,K,O)])]);s.value.push(q)}return s}var p=new Date("1950-01-01T00:00:00Z"),I=new Date("2050-01-01T00:00:00Z");function L(c){return c>=p&&c<I?e.create(e.Class.UNIVERSAL,e.Type.UTCTIME,!1,e.dateToUtcTime(c)):e.create(e.Class.UNIVERSAL,e.Type.GENERALIZEDTIME,!1,e.dateToGeneralizedTime(c))}return a.getTBSCertificate=function(c){var s=L(c.validity.notBefore),n=L(c.validity.notAfter),B=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(c.version).getBytes())]),e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,t.util.hexToBytes(c.serialNumber)),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(c.siginfo.algorithmOid).getBytes()),i(c.siginfo.algorithmOid,c.siginfo.parameters)]),v(c.issuer),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[s,n]),v(c.subject),a.publicKeyToAsn1(c.publicKey)]);return c.issuer.uniqueId&&B.value.push(e.create(e.Class.CONTEXT_SPECIFIC,1,!0,[e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,"\0"+c.issuer.uniqueId)])),c.subject.uniqueId&&B.value.push(e.create(e.Class.CONTEXT_SPECIFIC,2,!0,[e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,"\0"+c.subject.uniqueId)])),c.extensions.length>0&&B.value.push(a.certificateExtensionsToAsn1(c.extensions)),B},a.getCertificationRequestInfo=function(c){var s=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(c.version).getBytes()),v(c.subject),a.publicKeyToAsn1(c.publicKey),h(c)]);return s},a.distinguishedNameToAsn1=function(c){return v(c)},a.certificateToAsn1=function(c){var s=c.tbsCertificate||a.getTBSCertificate(c);return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[s,e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(c.signatureOid).getBytes()),i(c.signatureOid,c.signatureParameters)]),e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,"\0"+c.signature)])},a.certificateExtensionsToAsn1=function(c){var s=e.create(e.Class.CONTEXT_SPECIFIC,3,!0,[]),n=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);s.value.push(n);for(var B=0;B<c.length;++B)n.value.push(a.certificateExtensionToAsn1(c[B]));return s},a.certificateExtensionToAsn1=function(c){var s=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);s.value.push(e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(c.id).getBytes())),c.critical&&s.value.push(e.create(e.Class.UNIVERSAL,e.Type.BOOLEAN,!1,"ÿ"));var n=c.value;return typeof c.value!="string"&&(n=e.toDer(n).getBytes()),s.value.push(e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,n)),s},a.certificationRequestToAsn1=function(c){var s=c.certificationRequestInfo||a.getCertificationRequestInfo(c);return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[s,e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(c.signatureOid).getBytes()),i(c.signatureOid,c.signatureParameters)]),e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,"\0"+c.signature)])},a.createCaStore=function(c){var s={certs:{}};s.getIssuer=function(P){var K=n(P.issuer);return K},s.addCertificate=function(P){if(typeof P=="string"&&(P=t.pki.certificateFromPem(P)),B(P.subject),!s.hasCertificate(P))if(P.subject.hash in s.certs){var K=s.certs[P.subject.hash];t.util.isArray(K)||(K=[K]),K.push(P),s.certs[P.subject.hash]=K}else s.certs[P.subject.hash]=P},s.hasCertificate=function(P){typeof P=="string"&&(P=t.pki.certificateFromPem(P));var K=n(P.subject);if(!K)return!1;t.util.isArray(K)||(K=[K]);for(var q=e.toDer(a.certificateToAsn1(P)).getBytes(),M=0;M<K.length;++M){var G=e.toDer(a.certificateToAsn1(K[M])).getBytes();if(q===G)return!0}return!1},s.listAllCertificates=function(){var P=[];for(var K in s.certs)if(s.certs.hasOwnProperty(K)){var q=s.certs[K];if(!t.util.isArray(q))P.push(q);else for(var M=0;M<q.length;++M)P.push(q[M])}return P},s.removeCertificate=function(P){var K;if(typeof P=="string"&&(P=t.pki.certificateFromPem(P)),B(P.subject),!s.hasCertificate(P))return null;var q=n(P.subject);if(!t.util.isArray(q))return K=s.certs[P.subject.hash],delete s.certs[P.subject.hash],K;for(var M=e.toDer(a.certificateToAsn1(P)).getBytes(),G=0;G<q.length;++G){var Y=e.toDer(a.certificateToAsn1(q[G])).getBytes();M===Y&&(K=q[G],q.splice(G,1))}return q.length===0&&delete s.certs[P.subject.hash],K};function n(P){return B(P),s.certs[P.hash]||null}function B(P){if(!P.hash){var K=t.md.sha1.create();P.attributes=a.RDNAttributesAsArray(v(P),K),P.hash=K.digest().toHex()}}if(c)for(var D=0;D<c.length;++D){var O=c[D];s.addCertificate(O)}return s},a.certificateError={bad_certificate:"forge.pki.BadCertificate",unsupported_certificate:"forge.pki.UnsupportedCertificate",certificate_revoked:"forge.pki.CertificateRevoked",certificate_expired:"forge.pki.CertificateExpired",certificate_unknown:"forge.pki.CertificateUnknown",unknown_ca:"forge.pki.UnknownCertificateAuthority"},a.verifyCertificateChain=function(c,s,n){typeof n=="function"&&(n={verify:n}),n=n||{},s=s.slice(0);var B=s.slice(0),D=n.validityCheckDate;typeof D=="undefined"&&(D=new Date);var O=!0,P=null,K=0;do{var q=s.shift(),M=null,G=!1;if(D&&(D<q.validity.notBefore||D>q.validity.notAfter)&&(P={message:"Certificate is not valid yet or has expired.",error:a.certificateError.certificate_expired,notBefore:q.validity.notBefore,notAfter:q.validity.notAfter,now:D}),P===null){if(M=s[0]||c.getIssuer(q),M===null&&q.isIssuer(q)&&(G=!0,M=q),M){var Y=M;t.util.isArray(Y)||(Y=[Y]);for(var W=!1;!W&&Y.length>0;){M=Y.shift();try{W=M.verify(q)}catch(Ge){}}W||(P={message:"Certificate signature is invalid.",error:a.certificateError.bad_certificate})}P===null&&(!M||G)&&!c.hasCertificate(q)&&(P={message:"Certificate is not trusted.",error:a.certificateError.unknown_ca})}if(P===null&&M&&!q.isIssuer(M)&&(P={message:"Certificate issuer is invalid.",error:a.certificateError.bad_certificate}),P===null)for(var ee={keyUsage:!0,basicConstraints:!0},ne=0;P===null&&ne<q.extensions.length;++ne){var ie=q.extensions[ne];ie.critical&&!(ie.name in ee)&&(P={message:"Certificate has an unsupported critical extension.",error:a.certificateError.unsupported_certificate})}if(P===null&&(!O||s.length===0&&(!M||G))){var he=q.getExtension("basicConstraints"),ve=q.getExtension("keyUsage");if(ve!==null&&(!ve.keyCertSign||he===null)&&(P={message:"Certificate keyUsage or basicConstraints conflict or indicate that the certificate is not a CA. If the certificate is the only one in the chain or isn't the first then the certificate must be a valid CA.",error:a.certificateError.bad_certificate}),P===null&&he===null&&(P={message:"Certificate is missing basicConstraints extension and cannot be used as a CA.",error:a.certificateError.bad_certificate}),P===null&&he!==null&&!he.cA&&(P={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:a.certificateError.bad_certificate}),P===null&&ve!==null&&"pathLenConstraint"in he){var fe=K-1;fe>he.pathLenConstraint&&(P={message:"Certificate basicConstraints pathLenConstraint violated.",error:a.certificateError.bad_certificate})}}var j=P===null?!0:P.error,$=n.verify?n.verify(j,K,B):j;if($===!0)P=null;else throw j===!0&&(P={message:"The application rejected the certificate.",error:a.certificateError.bad_certificate}),($||$===0)&&(typeof $=="object"&&!t.util.isArray($)?($.message&&(P.message=$.message),$.error&&(P.error=$.error)):typeof $=="string"&&(P.error=$)),P;O=!1,++K}while(s.length>0);return!0},ur.exports}var la;function ca(){if(la)return sr.exports;la=1;var t=ue();nt(),Ct(),ht(),na(),ra(),Ze(),Bt(),mt(),ce(),dr();var e=t.asn1,a=t.pki,d=sr.exports=t.pkcs12=t.pkcs12||{},A={name:"ContentInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.contentType",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:e.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"content"}]},x={name:"PFX",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"version"},A,{name:"PFX.macData",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"mac",value:[{name:"PFX.macData.mac",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"macAlgorithm"},{name:"PFX.macData.mac.digestAlgorithm.parameters",optional:!0,tagClass:e.Class.UNIVERSAL,captureAsn1:"macAlgorithmParameters"}]},{name:"PFX.macData.mac.digest",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"macDigest"}]},{name:"PFX.macData.macSalt",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"macSalt"},{name:"PFX.macData.iterations",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,optional:!0,capture:"macIterations"}]}]},l={name:"SafeBag",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"SafeBag.bagId",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"bagId"},{name:"SafeBag.bagValue",tagClass:e.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"bagValue"},{name:"SafeBag.bagAttributes",tagClass:e.Class.UNIVERSAL,type:e.Type.SET,constructed:!0,optional:!0,capture:"bagAttributes"}]},r={name:"Attribute",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"Attribute.attrId",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"oid"},{name:"Attribute.attrValues",tagClass:e.Class.UNIVERSAL,type:e.Type.SET,constructed:!0,capture:"values"}]},g={name:"CertBag",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"CertBag.certId",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"certId"},{name:"CertBag.certValue",tagClass:e.Class.CONTEXT_SPECIFIC,constructed:!0,value:[{name:"CertBag.certValue[0]",tagClass:e.Class.UNIVERSAL,type:e.Class.OCTETSTRING,constructed:!1,capture:"cert"}]}]};function f(C,y,i,h){for(var p=[],I=0;I<C.length;I++)for(var L=0;L<C[I].safeBags.length;L++){var c=C[I].safeBags[L];if(!(h!==void 0&&c.type!==h)){if(y===null){p.push(c);continue}c.attributes[y]!==void 0&&c.attributes[y].indexOf(i)>=0&&p.push(c)}}return p}d.pkcs12FromAsn1=function(C,y,i){typeof y=="string"?(i=y,y=!0):y===void 0&&(y=!0);var h={},p=[];if(!e.validate(C,x,h,p)){var I=new Error("Cannot read PKCS#12 PFX. ASN.1 object is not an PKCS#12 PFX.");throw I.errors=I,I}var L={version:h.version.charCodeAt(0),safeContents:[],getBags:function(M){var G={},Y;return"localKeyId"in M?Y=M.localKeyId:"localKeyIdHex"in M&&(Y=t.util.hexToBytes(M.localKeyIdHex)),Y===void 0&&!("friendlyName"in M)&&"bagType"in M&&(G[M.bagType]=f(L.safeContents,null,null,M.bagType)),Y!==void 0&&(G.localKeyId=f(L.safeContents,"localKeyId",Y,M.bagType)),"friendlyName"in M&&(G.friendlyName=f(L.safeContents,"friendlyName",M.friendlyName,M.bagType)),G},getBagsByFriendlyName:function(M,G){return f(L.safeContents,"friendlyName",M,G)},getBagsByLocalKeyId:function(M,G){return f(L.safeContents,"localKeyId",M,G)}};if(h.version.charCodeAt(0)!==3){var I=new Error("PKCS#12 PFX of version other than 3 not supported.");throw I.version=h.version.charCodeAt(0),I}if(e.derToOid(h.contentType)!==a.oids.data){var I=new Error("Only PKCS#12 PFX in password integrity mode supported.");throw I.oid=e.derToOid(h.contentType),I}var c=h.content.value[0];if(c.tagClass!==e.Class.UNIVERSAL||c.type!==e.Type.OCTETSTRING)throw new Error("PKCS#12 authSafe content data is not an OCTET STRING.");if(c=S(c),h.mac){var s=null,n=0,B=e.derToOid(h.macAlgorithm);switch(B){case a.oids.sha1:s=t.md.sha1.create(),n=20;break;case a.oids.sha256:s=t.md.sha256.create(),n=32;break;case a.oids.sha384:s=t.md.sha384.create(),n=48;break;case a.oids.sha512:s=t.md.sha512.create(),n=64;break;case a.oids.md5:s=t.md.md5.create(),n=16;break}if(s===null)throw new Error("PKCS#12 uses unsupported MAC algorithm: "+B);var D=new t.util.ByteBuffer(h.macSalt),O="macIterations"in h?parseInt(t.util.bytesToHex(h.macIterations),16):1,P=d.generateKey(i,D,3,O,n,s),K=t.hmac.create();K.start(s,P),K.update(c.value);var q=K.getMac();if(q.getBytes()!==h.macDigest)throw new Error("PKCS#12 MAC could not be verified. Invalid password?")}else if(Array.isArray(C.value)&&C.value.length>2)throw new Error("Invalid PKCS#12. macData field present but MAC was not validated.");return R(L,c.value,y,i),L};function S(C){if(C.composed||C.constructed){for(var y=t.util.createBuffer(),i=0;i<C.value.length;++i)y.putBytes(C.value[i].value);C.composed=C.constructed=!1,C.value=y.getBytes()}return C}function R(C,y,i,h){if(y=e.fromDer(y,i),y.tagClass!==e.Class.UNIVERSAL||y.type!==e.Type.SEQUENCE||y.constructed!==!0)throw new Error("PKCS#12 AuthenticatedSafe expected to be a SEQUENCE OF ContentInfo");for(var p=0;p<y.value.length;p++){var I=y.value[p],L={},c=[];if(!e.validate(I,A,L,c)){var s=new Error("Cannot read ContentInfo.");throw s.errors=c,s}var n={encrypted:!1},B=null,D=L.content.value[0];switch(e.derToOid(L.contentType)){case a.oids.data:if(D.tagClass!==e.Class.UNIVERSAL||D.type!==e.Type.OCTETSTRING)throw new Error("PKCS#12 SafeContents Data is not an OCTET STRING.");B=S(D).value;break;case a.oids.encryptedData:B=E(D,h),n.encrypted=!0;break;default:var s=new Error("Unsupported PKCS#12 contentType.");throw s.contentType=e.derToOid(L.contentType),s}n.safeBags=u(B,i,h),C.safeContents.push(n)}}function E(C,y){var i={},h=[];if(!e.validate(C,t.pkcs7.asn1.encryptedDataValidator,i,h)){var p=new Error("Cannot read EncryptedContentInfo.");throw p.errors=h,p}var I=e.derToOid(i.contentType);if(I!==a.oids.data){var p=new Error("PKCS#12 EncryptedContentInfo ContentType is not Data.");throw p.oid=I,p}I=e.derToOid(i.encAlgorithm);var L=a.pbe.getCipher(I,i.encParameter,y),c=S(i.encryptedContentAsn1),s=t.util.createBuffer(c.value);if(L.update(s),!L.finish())throw new Error("Failed to decrypt PKCS#12 SafeContents.");return L.output.getBytes()}function u(C,y,i){if(!y&&C.length===0)return[];if(C=e.fromDer(C,y),C.tagClass!==e.Class.UNIVERSAL||C.type!==e.Type.SEQUENCE||C.constructed!==!0)throw new Error("PKCS#12 SafeContents expected to be a SEQUENCE OF SafeBag.");for(var h=[],p=0;p<C.value.length;p++){var I=C.value[p],L={},c=[];if(!e.validate(I,l,L,c)){var s=new Error("Cannot read SafeBag.");throw s.errors=c,s}var n={type:e.derToOid(L.bagId),attributes:v(L.bagAttributes)};h.push(n);var B,D,O=L.bagValue.value[0];switch(n.type){case a.oids.pkcs8ShroudedKeyBag:if(O=a.decryptPrivateKeyInfo(O,i),O===null)throw new Error("Unable to decrypt PKCS#8 ShroudedKeyBag, wrong password?");case a.oids.keyBag:try{n.key=a.privateKeyFromAsn1(O)}catch(K){n.key=null,n.asn1=O}continue;case a.oids.certBag:B=g,D=function(){if(e.derToOid(L.certId)!==a.oids.x509Certificate){var K=new Error("Unsupported certificate type, only X.509 supported.");throw K.oid=e.derToOid(L.certId),K}var q=e.fromDer(L.cert,y);try{n.cert=a.certificateFromAsn1(q,!0)}catch(M){n.cert=null,n.asn1=q}};break;default:var s=new Error("Unsupported PKCS#12 SafeBag type.");throw s.oid=n.type,s}if(B!==void 0&&!e.validate(O,B,L,c)){var s=new Error("Cannot read PKCS#12 "+B.name);throw s.errors=c,s}D()}return h}function v(C){var y={};if(C!==void 0)for(var i=0;i<C.length;++i){var h={},p=[];if(!e.validate(C[i],r,h,p)){var I=new Error("Cannot read PKCS#12 BagAttribute.");throw I.errors=p,I}var L=e.derToOid(h.oid);if(a.oids[L]!==void 0){y[a.oids[L]]=[];for(var c=0;c<h.values.length;++c)y[a.oids[L]].push(h.values[c].value)}}return y}return d.toPkcs12Asn1=function(C,y,i,h){h=h||{},h.saltSize=h.saltSize||8,h.count=h.count||2048,h.algorithm=h.algorithm||h.encAlgorithm||"aes128","useMac"in h||(h.useMac=!0),"localKeyId"in h||(h.localKeyId=null),"generateLocalKeyId"in h||(h.generateLocalKeyId=!0);var p=h.localKeyId,I;if(p!==null)p=t.util.hexToBytes(p);else if(h.generateLocalKeyId)if(y){var L=t.util.isArray(y)?y[0]:y;typeof L=="string"&&(L=a.certificateFromPem(L));var c=t.md.sha1.create();c.update(e.toDer(a.certificateToAsn1(L)).getBytes()),p=c.digest().getBytes()}else p=t.random.getBytes(20);var s=[];p!==null&&s.push(e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(a.oids.localKeyId).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,p)])])),"friendlyName"in h&&s.push(e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(a.oids.friendlyName).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[e.create(e.Class.UNIVERSAL,e.Type.BMPSTRING,!1,h.friendlyName)])])),s.length>0&&(I=e.create(e.Class.UNIVERSAL,e.Type.SET,!0,s));var n=[],B=[];y!==null&&(t.util.isArray(y)?B=y:B=[y]);for(var D=[],O=0;O<B.length;++O){y=B[O],typeof y=="string"&&(y=a.certificateFromPem(y));var P=O===0?I:void 0,K=a.certificateToAsn1(y),q=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(a.oids.certBag).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(a.oids.x509Certificate).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,e.toDer(K).getBytes())])])]),P]);D.push(q)}if(D.length>0){var M=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,D),G=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(a.oids.data).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,e.toDer(M).getBytes())])]);n.push(G)}var Y=null;if(C!==null){var W=a.wrapRsaPrivateKey(a.privateKeyToAsn1(C));i===null?Y=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(a.oids.keyBag).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[W]),I]):Y=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(a.oids.pkcs8ShroudedKeyBag).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[a.encryptPrivateKeyInfo(W,i,h)]),I]);var ee=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[Y]),ne=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(a.oids.data).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,e.toDer(ee).getBytes())])]);n.push(ne)}var ie=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,n),he;if(h.useMac){var c=t.md.sha1.create(),ve=new t.util.ByteBuffer(t.random.getBytes(h.saltSize)),fe=h.count,C=d.generateKey(i,ve,3,fe,20),j=t.hmac.create();j.start(c,C),j.update(e.toDer(ie).getBytes());var $=j.getMac();he=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(a.oids.sha1).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")]),e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,$.getBytes())]),e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,ve.getBytes()),e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(fe).getBytes())])}return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(3).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(a.oids.data).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,e.toDer(ie).getBytes())])]),he])},d.generateKey=t.pbe.generatePkcs12Key,sr.exports}var ha;function da(){if(ha)return Yt.exports;ha=1;var t=ue();nt(),ht(),ra(),pt(),$t(),ca(),hr(),Bt(),ce(),dr();var e=t.asn1,a=Yt.exports=t.pki=t.pki||{};return a.pemToDer=function(d){var A=t.pem.decode(d)[0];if(A.procType&&A.procType.type==="ENCRYPTED")throw new Error("Could not convert PEM to DER; PEM is encrypted.");return t.util.createBuffer(A.body)},a.privateKeyFromPem=function(d){var A=t.pem.decode(d)[0];if(A.type!=="PRIVATE KEY"&&A.type!=="RSA PRIVATE KEY"){var x=new Error('Could not convert private key from PEM; PEM header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".');throw x.headerType=A.type,x}if(A.procType&&A.procType.type==="ENCRYPTED")throw new Error("Could not convert private key from PEM; PEM is encrypted.");var l=e.fromDer(A.body);return a.privateKeyFromAsn1(l)},a.privateKeyToPem=function(d,A){var x={type:"RSA PRIVATE KEY",body:e.toDer(a.privateKeyToAsn1(d)).getBytes()};return t.pem.encode(x,{maxline:A})},a.privateKeyInfoToPem=function(d,A){var x={type:"PRIVATE KEY",body:e.toDer(d).getBytes()};return t.pem.encode(x,{maxline:A})},Yt.exports}var pr,pa;function va(){if(pa)return pr;pa=1;var t=ue();nt(),Ct(),Qt(),pt(),da(),Ze(),mt(),ce();var e=function(m,k,w,N){var o=t.util.createBuffer(),_=m.length>>1,V=_+(m.length&1),H=m.substr(0,V),ae=m.substr(_,V),te=t.util.createBuffer(),Q=t.hmac.create();w=k+w;var Z=Math.ceil(N/16),se=Math.ceil(N/20);Q.start("MD5",H);var le=t.util.createBuffer();te.putBytes(w);for(var oe=0;oe<Z;++oe)Q.start(null,null),Q.update(te.getBytes()),te.putBuffer(Q.digest()),Q.start(null,null),Q.update(te.bytes()+w),le.putBuffer(Q.digest());Q.start("SHA1",ae);var me=t.util.createBuffer();te.clear(),te.putBytes(w);for(var oe=0;oe<se;++oe)Q.start(null,null),Q.update(te.getBytes()),te.putBuffer(Q.digest()),Q.start(null,null),Q.update(te.bytes()+w),me.putBuffer(Q.digest());return o.putBytes(t.util.xorBytes(le.getBytes(),me.getBytes(),N)),o},a=function(m,k,w){var N=t.hmac.create();N.start("SHA1",m);var o=t.util.createBuffer();return o.putInt32(k[0]),o.putInt32(k[1]),o.putByte(w.type),o.putByte(w.version.major),o.putByte(w.version.minor),o.putInt16(w.length),o.putBytes(w.fragment.bytes()),N.update(o.getBytes()),N.digest().getBytes()},d=function(m,k,w){var N=!1;try{var o=m.deflate(k.fragment.getBytes());k.fragment=t.util.createBuffer(o),k.length=o.length,N=!0}catch(_){}return N},A=function(m,k,w){var N=!1;try{var o=m.inflate(k.fragment.getBytes());k.fragment=t.util.createBuffer(o),k.length=o.length,N=!0}catch(_){}return N},x=function(m,k){var w=0;switch(k){case 1:w=m.getByte();break;case 2:w=m.getInt16();break;case 3:w=m.getInt24();break;case 4:w=m.getInt32();break}return t.util.createBuffer(m.getBytes(w))},l=function(m,k,w){m.putInt(w.length(),k<<3),m.putBuffer(w)},r={};r.Versions={TLS_1_0:{major:3,minor:1},TLS_1_1:{major:3,minor:2},TLS_1_2:{major:3,minor:3}},r.SupportedVersions=[r.Versions.TLS_1_1,r.Versions.TLS_1_0],r.Version=r.SupportedVersions[0],r.MaxFragment=15360,r.ConnectionEnd={server:0,client:1},r.PRFAlgorithm={tls_prf_sha256:0},r.BulkCipherAlgorithm={none:null,rc4:0,des3:1,aes:2},r.CipherType={stream:0,block:1,aead:2},r.MACAlgorithm={none:null,hmac_md5:0,hmac_sha1:1,hmac_sha256:2,hmac_sha384:3,hmac_sha512:4},r.CompressionMethod={none:0,deflate:1},r.ContentType={change_cipher_spec:20,alert:21,handshake:22,application_data:23,heartbeat:24},r.HandshakeType={hello_request:0,client_hello:1,server_hello:2,certificate:11,server_key_exchange:12,certificate_request:13,server_hello_done:14,certificate_verify:15,client_key_exchange:16,finished:20},r.Alert={},r.Alert.Level={warning:1,fatal:2},r.Alert.Description={close_notify:0,unexpected_message:10,bad_record_mac:20,decryption_failed:21,record_overflow:22,decompression_failure:30,handshake_failure:40,bad_certificate:42,unsupported_certificate:43,certificate_revoked:44,certificate_expired:45,certificate_unknown:46,illegal_parameter:47,unknown_ca:48,access_denied:49,decode_error:50,decrypt_error:51,export_restriction:60,protocol_version:70,insufficient_security:71,internal_error:80,user_canceled:90,no_renegotiation:100},r.HeartbeatMessageType={heartbeat_request:1,heartbeat_response:2},r.CipherSuites={},r.getCipherSuite=function(m){var k=null;for(var w in r.CipherSuites){var N=r.CipherSuites[w];if(N.id[0]===m.charCodeAt(0)&&N.id[1]===m.charCodeAt(1)){k=N;break}}return k},r.handleUnexpected=function(m,k){var w=!m.open&&m.entity===r.ConnectionEnd.client;w||m.error(m,{message:"Unexpected message. Received TLS record out of order.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.unexpected_message}})},r.handleHelloRequest=function(m,k,w){!m.handshaking&&m.handshakes>0&&(r.queue(m,r.createAlert(m,{level:r.Alert.Level.warning,description:r.Alert.Description.no_renegotiation})),r.flush(m)),m.process()},r.parseHelloMessage=function(m,k,w){var N=null,o=m.entity===r.ConnectionEnd.client;if(w<38)m.error(m,{message:o?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.illegal_parameter}});else{var _=k.fragment,V=_.length();if(N={version:{major:_.getByte(),minor:_.getByte()},random:t.util.createBuffer(_.getBytes(32)),session_id:x(_,1),extensions:[]},o?(N.cipher_suite=_.getBytes(2),N.compression_method=_.getByte()):(N.cipher_suites=x(_,2),N.compression_methods=x(_,1)),V=w-(V-_.length()),V>0){for(var H=x(_,2);H.length()>0;)N.extensions.push({type:[H.getByte(),H.getByte()],data:x(H,2)});if(!o)for(var ae=0;ae<N.extensions.length;++ae){var te=N.extensions[ae];if(te.type[0]===0&&te.type[1]===0)for(var Q=x(te.data,2);Q.length()>0;){var Z=Q.getByte();if(Z!==0)break;m.session.extensions.server_name.serverNameList.push(x(Q,2).getBytes())}}}if(m.session.version&&(N.version.major!==m.session.version.major||N.version.minor!==m.session.version.minor))return m.error(m,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.protocol_version}});if(o)m.session.cipherSuite=r.getCipherSuite(N.cipher_suite);else for(var se=t.util.createBuffer(N.cipher_suites.bytes());se.length()>0&&(m.session.cipherSuite=r.getCipherSuite(se.getBytes(2)),m.session.cipherSuite===null););if(m.session.cipherSuite===null)return m.error(m,{message:"No cipher suites in common.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.handshake_failure},cipherSuite:t.util.bytesToHex(N.cipher_suite)});o?m.session.compressionMethod=N.compression_method:m.session.compressionMethod=r.CompressionMethod.none}return N},r.createSecurityParameters=function(m,k){var w=m.entity===r.ConnectionEnd.client,N=k.random.bytes(),o=w?m.session.sp.client_random:N,_=w?N:r.createRandom().getBytes();m.session.sp={entity:m.entity,prf_algorithm:r.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:m.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:o,server_random:_}},r.handleServerHello=function(m,k,w){var N=r.parseHelloMessage(m,k,w);if(!m.fail){if(N.version.minor<=m.version.minor)m.version.minor=N.version.minor;else return m.error(m,{message:"Incompatible TLS version.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.protocol_version}});m.session.version=m.version;var o=N.session_id.bytes();o.length>0&&o===m.session.id?(m.expect=u,m.session.resuming=!0,m.session.sp.server_random=N.random.bytes()):(m.expect=f,m.session.resuming=!1,r.createSecurityParameters(m,N)),m.session.id=o,m.process()}},r.handleClientHello=function(m,k,w){var N=r.parseHelloMessage(m,k,w);if(!m.fail){var o=N.session_id.bytes(),_=null;if(m.sessionCache&&(_=m.sessionCache.getSession(o),_===null?o="":(_.version.major!==N.version.major||_.version.minor>N.version.minor)&&(_=null,o="")),o.length===0&&(o=t.random.getBytes(32)),m.session.id=o,m.session.clientHelloVersion=N.version,m.session.sp={},_)m.version=m.session.version=_.version,m.session.sp=_.sp;else{for(var V,H=1;H<r.SupportedVersions.length&&(V=r.SupportedVersions[H],!(V.minor<=N.version.minor));++H);m.version={major:V.major,minor:V.minor},m.session.version=m.version}_!==null?(m.expect=L,m.session.resuming=!0,m.session.sp.client_random=N.random.bytes()):(m.expect=m.verifyClient!==!1?h:p,m.session.resuming=!1,r.createSecurityParameters(m,N)),m.open=!0,r.queue(m,r.createRecord(m,{type:r.ContentType.handshake,data:r.createServerHello(m)})),m.session.resuming?(r.queue(m,r.createRecord(m,{type:r.ContentType.change_cipher_spec,data:r.createChangeCipherSpec()})),m.state.pending=r.createConnectionState(m),m.state.current.write=m.state.pending.write,r.queue(m,r.createRecord(m,{type:r.ContentType.handshake,data:r.createFinished(m)}))):(r.queue(m,r.createRecord(m,{type:r.ContentType.handshake,data:r.createCertificate(m)})),m.fail||(r.queue(m,r.createRecord(m,{type:r.ContentType.handshake,data:r.createServerKeyExchange(m)})),m.verifyClient!==!1&&r.queue(m,r.createRecord(m,{type:r.ContentType.handshake,data:r.createCertificateRequest(m)})),r.queue(m,r.createRecord(m,{type:r.ContentType.handshake,data:r.createServerHelloDone(m)})))),r.flush(m),m.process()}},r.handleCertificate=function(m,k,w){if(w<3)return m.error(m,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.illegal_parameter}});var N=k.fragment,o={certificate_list:x(N,3)},_,V,H=[];try{for(;o.certificate_list.length()>0;)_=x(o.certificate_list,3),V=t.asn1.fromDer(_),_=t.pki.certificateFromAsn1(V,!0),H.push(_)}catch(te){return m.error(m,{message:"Could not parse certificate list.",cause:te,send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.bad_certificate}})}var ae=m.entity===r.ConnectionEnd.client;(ae||m.verifyClient===!0)&&H.length===0?m.error(m,{message:ae?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.illegal_parameter}}):H.length===0?m.expect=ae?S:p:(ae?m.session.serverCertificate=H[0]:m.session.clientCertificate=H[0],r.verifyCertificateChain(m,H)&&(m.expect=ae?S:p)),m.process()},r.handleServerKeyExchange=function(m,k,w){if(w>0)return m.error(m,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.unsupported_certificate}});m.expect=R,m.process()},r.handleClientKeyExchange=function(m,k,w){if(w<48)return m.error(m,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.unsupported_certificate}});var N=k.fragment,o={enc_pre_master_secret:x(N,2).getBytes()},_=null;if(m.getPrivateKey)try{_=m.getPrivateKey(m,m.session.serverCertificate),_=t.pki.privateKeyFromPem(_)}catch(ae){m.error(m,{message:"Could not get private key.",cause:ae,send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.internal_error}})}if(_===null)return m.error(m,{message:"No private key set.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.internal_error}});try{var V=m.session.sp;V.pre_master_secret=_.decrypt(o.enc_pre_master_secret);var H=m.session.clientHelloVersion;if(H.major!==V.pre_master_secret.charCodeAt(0)||H.minor!==V.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch(ae){V.pre_master_secret=t.random.getBytes(48)}m.expect=L,m.session.clientCertificate!==null&&(m.expect=I),m.process()},r.handleCertificateRequest=function(m,k,w){if(w<3)return m.error(m,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.illegal_parameter}});var N=k.fragment,o={certificate_types:x(N,1),certificate_authorities:x(N,2)};m.session.certificateRequest=o,m.expect=E,m.process()},r.handleCertificateVerify=function(m,k,w){if(w<2)return m.error(m,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.illegal_parameter}});var N=k.fragment;N.read-=4;var o=N.bytes();N.read+=4;var _={signature:x(N,2).getBytes()},V=t.util.createBuffer();V.putBuffer(m.session.md5.digest()),V.putBuffer(m.session.sha1.digest()),V=V.getBytes();try{var H=m.session.clientCertificate;if(!H.publicKey.verify(V,_.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");m.session.md5.update(o),m.session.sha1.update(o)}catch(ae){return m.error(m,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.handshake_failure}})}m.expect=L,m.process()},r.handleServerHelloDone=function(m,k,w){if(w>0)return m.error(m,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.record_overflow}});if(m.serverCertificate===null){var N={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.insufficient_security}},o=0,_=m.verify(m,N.alert.description,o,[]);if(_!==!0)return(_||_===0)&&(typeof _=="object"&&!t.util.isArray(_)?(_.message&&(N.message=_.message),_.alert&&(N.alert.description=_.alert)):typeof _=="number"&&(N.alert.description=_)),m.error(m,N)}m.session.certificateRequest!==null&&(k=r.createRecord(m,{type:r.ContentType.handshake,data:r.createCertificate(m)}),r.queue(m,k)),k=r.createRecord(m,{type:r.ContentType.handshake,data:r.createClientKeyExchange(m)}),r.queue(m,k),m.expect=y;var V=function(H,ae){H.session.certificateRequest!==null&&H.session.clientCertificate!==null&&r.queue(H,r.createRecord(H,{type:r.ContentType.handshake,data:r.createCertificateVerify(H,ae)})),r.queue(H,r.createRecord(H,{type:r.ContentType.change_cipher_spec,data:r.createChangeCipherSpec()})),H.state.pending=r.createConnectionState(H),H.state.current.write=H.state.pending.write,r.queue(H,r.createRecord(H,{type:r.ContentType.handshake,data:r.createFinished(H)})),H.expect=u,r.flush(H),H.process()};if(m.session.certificateRequest===null||m.session.clientCertificate===null)return V(m,null);r.getClientSignature(m,V)},r.handleChangeCipherSpec=function(m,k){if(k.fragment.getByte()!==1)return m.error(m,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.illegal_parameter}});var w=m.entity===r.ConnectionEnd.client;(m.session.resuming&&w||!m.session.resuming&&!w)&&(m.state.pending=r.createConnectionState(m)),m.state.current.read=m.state.pending.read,(!m.session.resuming&&w||m.session.resuming&&!w)&&(m.state.pending=null),m.expect=w?v:c,m.process()},r.handleFinished=function(m,k,w){var N=k.fragment;N.read-=4;var o=N.bytes();N.read+=4;var _=k.fragment.getBytes();N=t.util.createBuffer(),N.putBuffer(m.session.md5.digest()),N.putBuffer(m.session.sha1.digest());var V=m.entity===r.ConnectionEnd.client,H=V?"server finished":"client finished",ae=m.session.sp,te=12,Q=e;if(N=Q(ae.master_secret,H,N.getBytes(),te),N.getBytes()!==_)return m.error(m,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.decrypt_error}});m.session.md5.update(o),m.session.sha1.update(o),(m.session.resuming&&V||!m.session.resuming&&!V)&&(r.queue(m,r.createRecord(m,{type:r.ContentType.change_cipher_spec,data:r.createChangeCipherSpec()})),m.state.current.write=m.state.pending.write,m.state.pending=null,r.queue(m,r.createRecord(m,{type:r.ContentType.handshake,data:r.createFinished(m)}))),m.expect=V?C:s,m.handshaking=!1,++m.handshakes,m.peerCertificate=V?m.session.serverCertificate:m.session.clientCertificate,r.flush(m),m.isConnected=!0,m.connected(m),m.process()},r.handleAlert=function(m,k){var w=k.fragment,N={level:w.getByte(),description:w.getByte()},o;switch(N.description){case r.Alert.Description.close_notify:o="Connection closed.";break;case r.Alert.Description.unexpected_message:o="Unexpected message.";break;case r.Alert.Description.bad_record_mac:o="Bad record MAC.";break;case r.Alert.Description.decryption_failed:o="Decryption failed.";break;case r.Alert.Description.record_overflow:o="Record overflow.";break;case r.Alert.Description.decompression_failure:o="Decompression failed.";break;case r.Alert.Description.handshake_failure:o="Handshake failure.";break;case r.Alert.Description.bad_certificate:o="Bad certificate.";break;case r.Alert.Description.unsupported_certificate:o="Unsupported certificate.";break;case r.Alert.Description.certificate_revoked:o="Certificate revoked.";break;case r.Alert.Description.certificate_expired:o="Certificate expired.";break;case r.Alert.Description.certificate_unknown:o="Certificate unknown.";break;case r.Alert.Description.illegal_parameter:o="Illegal parameter.";break;case r.Alert.Description.unknown_ca:o="Unknown certificate authority.";break;case r.Alert.Description.access_denied:o="Access denied.";break;case r.Alert.Description.decode_error:o="Decode error.";break;case r.Alert.Description.decrypt_error:o="Decrypt error.";break;case r.Alert.Description.export_restriction:o="Export restriction.";break;case r.Alert.Description.protocol_version:o="Unsupported protocol version.";break;case r.Alert.Description.insufficient_security:o="Insufficient security.";break;case r.Alert.Description.internal_error:o="Internal error.";break;case r.Alert.Description.user_canceled:o="User canceled.";break;case r.Alert.Description.no_renegotiation:o="Renegotiation not supported.";break;default:o="Unknown error.";break}if(N.description===r.Alert.Description.close_notify)return m.close();m.error(m,{message:o,send:!1,origin:m.entity===r.ConnectionEnd.client?"server":"client",alert:N}),m.process()},r.handleHandshake=function(m,k){var w=k.fragment,N=w.getByte(),o=w.getInt24();if(o>w.length())return m.fragmented=k,k.fragment=t.util.createBuffer(),w.read-=4,m.process();m.fragmented=null,w.read-=4;var _=w.bytes(o+4);w.read+=4,N in he[m.entity][m.expect]?(m.entity===r.ConnectionEnd.server&&!m.open&&!m.fail&&(m.handshaking=!0,m.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:t.md.md5.create(),sha1:t.md.sha1.create()}),N!==r.HandshakeType.hello_request&&N!==r.HandshakeType.certificate_verify&&N!==r.HandshakeType.finished&&(m.session.md5.update(_),m.session.sha1.update(_)),he[m.entity][m.expect][N](m,k,o)):r.handleUnexpected(m,k)},r.handleApplicationData=function(m,k){m.data.putBuffer(k.fragment),m.dataReady(m),m.process()},r.handleHeartbeat=function(m,k){var w=k.fragment,N=w.getByte(),o=w.getInt16(),_=w.getBytes(o);if(N===r.HeartbeatMessageType.heartbeat_request){if(m.handshaking||o>_.length)return m.process();r.queue(m,r.createRecord(m,{type:r.ContentType.heartbeat,data:r.createHeartbeat(r.HeartbeatMessageType.heartbeat_response,_)})),r.flush(m)}else if(N===r.HeartbeatMessageType.heartbeat_response){if(_!==m.expectedHeartbeatPayload)return m.process();m.heartbeatReceived&&m.heartbeatReceived(m,t.util.createBuffer(_))}m.process()};var g=0,f=1,S=2,R=3,E=4,u=5,v=6,C=7,y=8,i=0,h=1,p=2,I=3,L=4,c=5,s=6,n=r.handleUnexpected,B=r.handleChangeCipherSpec,D=r.handleAlert,O=r.handleHandshake,P=r.handleApplicationData,K=r.handleHeartbeat,q=[];q[r.ConnectionEnd.client]=[[n,D,O,n,K],[n,D,O,n,K],[n,D,O,n,K],[n,D,O,n,K],[n,D,O,n,K],[B,D,n,n,K],[n,D,O,n,K],[n,D,O,P,K],[n,D,O,n,K]],q[r.ConnectionEnd.server]=[[n,D,O,n,K],[n,D,O,n,K],[n,D,O,n,K],[n,D,O,n,K],[B,D,n,n,K],[n,D,O,n,K],[n,D,O,P,K],[n,D,O,n,K]];var M=r.handleHelloRequest,G=r.handleServerHello,Y=r.handleCertificate,W=r.handleServerKeyExchange,ee=r.handleCertificateRequest,ne=r.handleServerHelloDone,ie=r.handleFinished,he=[];he[r.ConnectionEnd.client]=[[n,n,G,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n],[M,n,n,n,n,n,n,n,n,n,n,Y,W,ee,ne,n,n,n,n,n,n],[M,n,n,n,n,n,n,n,n,n,n,n,W,ee,ne,n,n,n,n,n,n],[M,n,n,n,n,n,n,n,n,n,n,n,n,ee,ne,n,n,n,n,n,n],[M,n,n,n,n,n,n,n,n,n,n,n,n,n,ne,n,n,n,n,n,n],[M,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n],[M,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,ie],[M,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n],[M,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n]];var ve=r.handleClientHello,fe=r.handleClientKeyExchange,j=r.handleCertificateVerify;he[r.ConnectionEnd.server]=[[n,ve,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n],[n,n,n,n,n,n,n,n,n,n,n,Y,n,n,n,n,n,n,n,n,n],[n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,fe,n,n,n,n],[n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,j,n,n,n,n,n],[n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n],[n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,ie],[n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n],[n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n]],r.generateKeys=function(m,k){var w=e,N=k.client_random+k.server_random;m.session.resuming||(k.master_secret=w(k.pre_master_secret,"master secret",N,48).bytes(),k.pre_master_secret=null),N=k.server_random+k.client_random;var o=2*k.mac_key_length+2*k.enc_key_length,_=m.version.major===r.Versions.TLS_1_0.major&&m.version.minor===r.Versions.TLS_1_0.minor;_&&(o+=2*k.fixed_iv_length);var V=w(k.master_secret,"key expansion",N,o),H={client_write_MAC_key:V.getBytes(k.mac_key_length),server_write_MAC_key:V.getBytes(k.mac_key_length),client_write_key:V.getBytes(k.enc_key_length),server_write_key:V.getBytes(k.enc_key_length)};return _&&(H.client_write_IV=V.getBytes(k.fixed_iv_length),H.server_write_IV=V.getBytes(k.fixed_iv_length)),H},r.createConnectionState=function(m){var k=m.entity===r.ConnectionEnd.client,w=function(){var _={sequenceNumber:[0,0],macKey:null,macLength:0,macFunction:null,cipherState:null,cipherFunction:function(V){return!0},compressionState:null,compressFunction:function(V){return!0},updateSequenceNumber:function(){_.sequenceNumber[1]===4294967295?(_.sequenceNumber[1]=0,++_.sequenceNumber[0]):++_.sequenceNumber[1]}};return _},N={read:w(),write:w()};if(N.read.update=function(_,V){return N.read.cipherFunction(V,N.read)?N.read.compressFunction(_,V,N.read)||_.error(_,{message:"Could not decompress record.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.decompression_failure}}):_.error(_,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.bad_record_mac}}),!_.fail},N.write.update=function(_,V){return N.write.compressFunction(_,V,N.write)?N.write.cipherFunction(V,N.write)||_.error(_,{message:"Could not encrypt record.",send:!1,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.internal_error}}):_.error(_,{message:"Could not compress record.",send:!1,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.internal_error}}),!_.fail},m.session){var o=m.session.sp;switch(m.session.cipherSuite.initSecurityParameters(o),o.keys=r.generateKeys(m,o),N.read.macKey=k?o.keys.server_write_MAC_key:o.keys.client_write_MAC_key,N.write.macKey=k?o.keys.client_write_MAC_key:o.keys.server_write_MAC_key,m.session.cipherSuite.initConnectionState(N,m,o),o.compression_algorithm){case r.CompressionMethod.none:break;case r.CompressionMethod.deflate:N.read.compressFunction=A,N.write.compressFunction=d;break;default:throw new Error("Unsupported compression algorithm.")}}return N},r.createRandom=function(){var m=new Date,k=+m+m.getTimezoneOffset()*6e4,w=t.util.createBuffer();return w.putInt32(k),w.putBytes(t.random.getBytes(28)),w},r.createRecord=function(m,k){if(!k.data)return null;var w={type:k.type,version:{major:m.version.major,minor:m.version.minor},length:k.data.length(),fragment:k.data};return w},r.createAlert=function(m,k){var w=t.util.createBuffer();return w.putByte(k.level),w.putByte(k.description),r.createRecord(m,{type:r.ContentType.alert,data:w})},r.createClientHello=function(m){m.session.clientHelloVersion={major:m.version.major,minor:m.version.minor};for(var k=t.util.createBuffer(),w=0;w<m.cipherSuites.length;++w){var N=m.cipherSuites[w];k.putByte(N.id[0]),k.putByte(N.id[1])}var o=k.length(),_=t.util.createBuffer();_.putByte(r.CompressionMethod.none);var V=_.length(),H=t.util.createBuffer();if(m.virtualHost){var ae=t.util.createBuffer();ae.putByte(0),ae.putByte(0);var te=t.util.createBuffer();te.putByte(0),l(te,2,t.util.createBuffer(m.virtualHost));var Q=t.util.createBuffer();l(Q,2,te),l(ae,2,Q),H.putBuffer(ae)}var Z=H.length();Z>0&&(Z+=2);var se=m.session.id,le=se.length+1+2+4+28+2+o+1+V+Z,oe=t.util.createBuffer();return oe.putByte(r.HandshakeType.client_hello),oe.putInt24(le),oe.putByte(m.version.major),oe.putByte(m.version.minor),oe.putBytes(m.session.sp.client_random),l(oe,1,t.util.createBuffer(se)),l(oe,2,k),l(oe,1,_),Z>0&&l(oe,2,H),oe},r.createServerHello=function(m){var k=m.session.id,w=k.length+1+2+4+28+2+1,N=t.util.createBuffer();return N.putByte(r.HandshakeType.server_hello),N.putInt24(w),N.putByte(m.version.major),N.putByte(m.version.minor),N.putBytes(m.session.sp.server_random),l(N,1,t.util.createBuffer(k)),N.putByte(m.session.cipherSuite.id[0]),N.putByte(m.session.cipherSuite.id[1]),N.putByte(m.session.compressionMethod),N},r.createCertificate=function(m){var k=m.entity===r.ConnectionEnd.client,w=null;if(m.getCertificate){var N;k?N=m.session.certificateRequest:N=m.session.extensions.server_name.serverNameList,w=m.getCertificate(m,N)}var o=t.util.createBuffer();if(w!==null)try{t.util.isArray(w)||(w=[w]);for(var _=null,V=0;V<w.length;++V){var H=t.pem.decode(w[V])[0];if(H.type!=="CERTIFICATE"&&H.type!=="X509 CERTIFICATE"&&H.type!=="TRUSTED CERTIFICATE"){var ae=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw ae.headerType=H.type,ae}if(H.procType&&H.procType.type==="ENCRYPTED")throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var te=t.util.createBuffer(H.body);_===null&&(_=t.asn1.fromDer(te.bytes(),!1));var Q=t.util.createBuffer();l(Q,3,te),o.putBuffer(Q)}w=t.pki.certificateFromAsn1(_),k?m.session.clientCertificate=w:m.session.serverCertificate=w}catch(le){return m.error(m,{message:"Could not send certificate list.",cause:le,send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.bad_certificate}})}var Z=3+o.length(),se=t.util.createBuffer();return se.putByte(r.HandshakeType.certificate),se.putInt24(Z),l(se,3,o),se},r.createClientKeyExchange=function(m){var k=t.util.createBuffer();k.putByte(m.session.clientHelloVersion.major),k.putByte(m.session.clientHelloVersion.minor),k.putBytes(t.random.getBytes(46));var w=m.session.sp;w.pre_master_secret=k.getBytes();var N=m.session.serverCertificate.publicKey;k=N.encrypt(w.pre_master_secret);var o=k.length+2,_=t.util.createBuffer();return _.putByte(r.HandshakeType.client_key_exchange),_.putInt24(o),_.putInt16(k.length),_.putBytes(k),_},r.createServerKeyExchange=function(m){var k=t.util.createBuffer();return k},r.getClientSignature=function(m,k){var w=t.util.createBuffer();w.putBuffer(m.session.md5.digest()),w.putBuffer(m.session.sha1.digest()),w=w.getBytes(),m.getSignature=m.getSignature||function(N,o,_){var V=null;if(N.getPrivateKey)try{V=N.getPrivateKey(N,N.session.clientCertificate),V=t.pki.privateKeyFromPem(V)}catch(H){N.error(N,{message:"Could not get private key.",cause:H,send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.internal_error}})}V===null?N.error(N,{message:"No private key set.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.internal_error}}):o=V.sign(o,null),_(N,o)},m.getSignature(m,w,k)},r.createCertificateVerify=function(m,k){var w=k.length+2,N=t.util.createBuffer();return N.putByte(r.HandshakeType.certificate_verify),N.putInt24(w),N.putInt16(k.length),N.putBytes(k),N},r.createCertificateRequest=function(m){var k=t.util.createBuffer();k.putByte(1);var w=t.util.createBuffer();for(var N in m.caStore.certs){var o=m.caStore.certs[N],_=t.pki.distinguishedNameToAsn1(o.subject),V=t.asn1.toDer(_);w.putInt16(V.length()),w.putBuffer(V)}var H=1+k.length()+2+w.length(),ae=t.util.createBuffer();return ae.putByte(r.HandshakeType.certificate_request),ae.putInt24(H),l(ae,1,k),l(ae,2,w),ae},r.createServerHelloDone=function(m){var k=t.util.createBuffer();return k.putByte(r.HandshakeType.server_hello_done),k.putInt24(0),k},r.createChangeCipherSpec=function(){var m=t.util.createBuffer();return m.putByte(1),m},r.createFinished=function(m){var k=t.util.createBuffer();k.putBuffer(m.session.md5.digest()),k.putBuffer(m.session.sha1.digest());var w=m.entity===r.ConnectionEnd.client,N=m.session.sp,o=12,_=e,V=w?"client finished":"server finished";k=_(N.master_secret,V,k.getBytes(),o);var H=t.util.createBuffer();return H.putByte(r.HandshakeType.finished),H.putInt24(k.length()),H.putBuffer(k),H},r.createHeartbeat=function(m,k,w){typeof w=="undefined"&&(w=k.length);var N=t.util.createBuffer();N.putByte(m),N.putInt16(w),N.putBytes(k);var o=N.length(),_=Math.max(16,o-w-3);return N.putBytes(t.random.getBytes(_)),N},r.queue=function(m,k){if(k&&!(k.fragment.length()===0&&(k.type===r.ContentType.handshake||k.type===r.ContentType.alert||k.type===r.ContentType.change_cipher_spec))){if(k.type===r.ContentType.handshake){var w=k.fragment.bytes();m.session.md5.update(w),m.session.sha1.update(w),w=null}var N;if(k.fragment.length()<=r.MaxFragment)N=[k];else{N=[];for(var o=k.fragment.bytes();o.length>r.MaxFragment;)N.push(r.createRecord(m,{type:k.type,data:t.util.createBuffer(o.slice(0,r.MaxFragment))})),o=o.slice(r.MaxFragment);o.length>0&&N.push(r.createRecord(m,{type:k.type,data:t.util.createBuffer(o)}))}for(var _=0;_<N.length&&!m.fail;++_){var V=N[_],H=m.state.current.write;H.update(m,V)&&m.records.push(V)}}},r.flush=function(m){for(var k=0;k<m.records.length;++k){var w=m.records[k];m.tlsData.putByte(w.type),m.tlsData.putByte(w.version.major),m.tlsData.putByte(w.version.minor),m.tlsData.putInt16(w.fragment.length()),m.tlsData.putBuffer(m.records[k].fragment)}return m.records=[],m.tlsDataReady(m)};var $=function(m){switch(m){case!0:return!0;case t.pki.certificateError.bad_certificate:return r.Alert.Description.bad_certificate;case t.pki.certificateError.unsupported_certificate:return r.Alert.Description.unsupported_certificate;case t.pki.certificateError.certificate_revoked:return r.Alert.Description.certificate_revoked;case t.pki.certificateError.certificate_expired:return r.Alert.Description.certificate_expired;case t.pki.certificateError.certificate_unknown:return r.Alert.Description.certificate_unknown;case t.pki.certificateError.unknown_ca:return r.Alert.Description.unknown_ca;default:return r.Alert.Description.bad_certificate}},Ge=function(m){switch(m){case!0:return!0;case r.Alert.Description.bad_certificate:return t.pki.certificateError.bad_certificate;case r.Alert.Description.unsupported_certificate:return t.pki.certificateError.unsupported_certificate;case r.Alert.Description.certificate_revoked:return t.pki.certificateError.certificate_revoked;case r.Alert.Description.certificate_expired:return t.pki.certificateError.certificate_expired;case r.Alert.Description.certificate_unknown:return t.pki.certificateError.certificate_unknown;case r.Alert.Description.unknown_ca:return t.pki.certificateError.unknown_ca;default:return t.pki.certificateError.bad_certificate}};r.verifyCertificateChain=function(m,k){try{var w={};for(var N in m.verifyOptions)w[N]=m.verifyOptions[N];w.verify=function(_,V,H){var ae=$(_),te=m.verify(m,_,V,H);if(te!==!0){if(typeof te=="object"&&!t.util.isArray(te)){var Q=new Error("The application rejected the certificate.");throw Q.send=!0,Q.alert={level:r.Alert.Level.fatal,description:r.Alert.Description.bad_certificate},te.message&&(Q.message=te.message),te.alert&&(Q.alert.description=te.alert),Q}te!==_&&(te=Ge(te))}return te},t.pki.verifyCertificateChain(m.caStore,k,w)}catch(_){var o=_;(typeof o!="object"||t.util.isArray(o))&&(o={send:!0,alert:{level:r.Alert.Level.fatal,description:$(_)}}),"send"in o||(o.send=!0),"alert"in o||(o.alert={level:r.Alert.Level.fatal,description:$(o.error)}),m.error(m,o)}return!m.fail},r.createSessionCache=function(m,k){var w=null;if(m&&m.getSession&&m.setSession&&m.order)w=m;else{w={},w.cache=m||{},w.capacity=Math.max(k||100,1),w.order=[];for(var N in m)w.order.length<=k?w.order.push(N):delete m[N];w.getSession=function(o){var _=null,V=null;if(o?V=t.util.bytesToHex(o):w.order.length>0&&(V=w.order[0]),V!==null&&V in w.cache){_=w.cache[V],delete w.cache[V];for(var H in w.order)if(w.order[H]===V){w.order.splice(H,1);break}}return _},w.setSession=function(o,_){if(w.order.length===w.capacity){var V=w.order.shift();delete w.cache[V]}var V=t.util.bytesToHex(o);w.order.push(V),w.cache[V]=_}}return w},r.createConnection=function(m){var k=null;m.caStore?t.util.isArray(m.caStore)?k=t.pki.createCaStore(m.caStore):k=m.caStore:k=t.pki.createCaStore();var w=m.cipherSuites||null;if(w===null){w=[];for(var N in r.CipherSuites)w.push(r.CipherSuites[N])}var o=m.server?r.ConnectionEnd.server:r.ConnectionEnd.client,_=m.sessionCache?r.createSessionCache(m.sessionCache):null,V={version:{major:r.Version.major,minor:r.Version.minor},entity:o,sessionId:m.sessionId,caStore:k,sessionCache:_,cipherSuites:w,connected:m.connected,virtualHost:m.virtualHost||null,verifyClient:m.verifyClient||!1,verify:m.verify||function(Q,Z,se,le){return Z},verifyOptions:m.verifyOptions||{},getCertificate:m.getCertificate||null,getPrivateKey:m.getPrivateKey||null,getSignature:m.getSignature||null,input:t.util.createBuffer(),tlsData:t.util.createBuffer(),data:t.util.createBuffer(),tlsDataReady:m.tlsDataReady,dataReady:m.dataReady,heartbeatReceived:m.heartbeatReceived,closed:m.closed,error:function(Q,Z){Z.origin=Z.origin||(Q.entity===r.ConnectionEnd.client?"client":"server"),Z.send&&(r.queue(Q,r.createAlert(Q,Z.alert)),r.flush(Q));var se=Z.fatal!==!1;se&&(Q.fail=!0),m.error(Q,Z),se&&Q.close(!1)},deflate:m.deflate||null,inflate:m.inflate||null};V.reset=function(Q){V.version={major:r.Version.major,minor:r.Version.minor},V.record=null,V.session=null,V.peerCertificate=null,V.state={pending:null,current:null},V.expect=V.entity===r.ConnectionEnd.client?g:i,V.fragmented=null,V.records=[],V.open=!1,V.handshakes=0,V.handshaking=!1,V.isConnected=!1,V.fail=!(Q||typeof Q=="undefined"),V.input.clear(),V.tlsData.clear(),V.data.clear(),V.state.current=r.createConnectionState(V)},V.reset();var H=function(Q,Z){var se=Z.type-r.ContentType.change_cipher_spec,le=q[Q.entity][Q.expect];se in le?le[se](Q,Z):r.handleUnexpected(Q,Z)},ae=function(Q){var Z=0,se=Q.input,le=se.length();if(le<5)Z=5-le;else{Q.record={type:se.getByte(),version:{major:se.getByte(),minor:se.getByte()},length:se.getInt16(),fragment:t.util.createBuffer(),ready:!1};var oe=Q.record.version.major===Q.version.major;oe&&Q.session&&Q.session.version&&(oe=Q.record.version.minor===Q.version.minor),oe||Q.error(Q,{message:"Incompatible TLS version.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.protocol_version}})}return Z},te=function(Q){var Z=0,se=Q.input,le=se.length();if(le<Q.record.length)Z=Q.record.length-le;else{Q.record.fragment.putBytes(se.getBytes(Q.record.length)),se.compact();var oe=Q.state.current.read;oe.update(Q,Q.record)&&(Q.fragmented!==null&&(Q.fragmented.type===Q.record.type?(Q.fragmented.fragment.putBuffer(Q.record.fragment),Q.record=Q.fragmented):Q.error(Q,{message:"Invalid fragmented record.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.unexpected_message}})),Q.record.ready=!0)}return Z};return V.handshake=function(Q){if(V.entity!==r.ConnectionEnd.client)V.error(V,{message:"Cannot initiate handshake as a server.",fatal:!1});else if(V.handshaking)V.error(V,{message:"Handshake already in progress.",fatal:!1});else{V.fail&&!V.open&&V.handshakes===0&&(V.fail=!1),V.handshaking=!0,Q=Q||"";var Z=null;Q.length>0&&(V.sessionCache&&(Z=V.sessionCache.getSession(Q)),Z===null&&(Q="")),Q.length===0&&V.sessionCache&&(Z=V.sessionCache.getSession(),Z!==null&&(Q=Z.id)),V.session={id:Q,version:null,cipherSuite:null,compressionMethod:null,serverCertificate:null,certificateRequest:null,clientCertificate:null,sp:{},md5:t.md.md5.create(),sha1:t.md.sha1.create()},Z&&(V.version=Z.version,V.session.sp=Z.sp),V.session.sp.client_random=r.createRandom().getBytes(),V.open=!0,r.queue(V,r.createRecord(V,{type:r.ContentType.handshake,data:r.createClientHello(V)})),r.flush(V)}},V.process=function(Q){var Z=0;return Q&&V.input.putBytes(Q),V.fail||(V.record!==null&&V.record.ready&&V.record.fragment.isEmpty()&&(V.record=null),V.record===null&&(Z=ae(V)),!V.fail&&V.record!==null&&!V.record.ready&&(Z=te(V)),!V.fail&&V.record!==null&&V.record.ready&&H(V,V.record)),Z},V.prepare=function(Q){return r.queue(V,r.createRecord(V,{type:r.ContentType.application_data,data:t.util.createBuffer(Q)})),r.flush(V)},V.prepareHeartbeatRequest=function(Q,Z){return Q instanceof t.util.ByteBuffer&&(Q=Q.bytes()),typeof Z=="undefined"&&(Z=Q.length),V.expectedHeartbeatPayload=Q,r.queue(V,r.createRecord(V,{type:r.ContentType.heartbeat,data:r.createHeartbeat(r.HeartbeatMessageType.heartbeat_request,Q,Z)})),r.flush(V)},V.close=function(Q){if(!V.fail&&V.sessionCache&&V.session){var Z={id:V.session.id,version:V.session.version,sp:V.session.sp};Z.sp.keys=null,V.sessionCache.setSession(Z.id,Z)}V.open&&(V.open=!1,V.input.clear(),(V.isConnected||V.handshaking)&&(V.isConnected=V.handshaking=!1,r.queue(V,r.createAlert(V,{level:r.Alert.Level.warning,description:r.Alert.Description.close_notify})),r.flush(V)),V.closed(V)),V.reset(Q)},V},pr=t.tls=t.tls||{};for(var Me in r)typeof r[Me]!="function"&&(t.tls[Me]=r[Me]);return t.tls.prf_tls1=e,t.tls.hmac_sha1=a,t.tls.createSessionCache=r.createSessionCache,t.tls.createConnection=r.createConnection,pr}var ya;function Ha(){if(ya)return Kt.exports;ya=1;var t=ue();ct(),va();var e=Kt.exports=t.tls;e.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(g){g.bulk_cipher_algorithm=e.BulkCipherAlgorithm.aes,g.cipher_type=e.CipherType.block,g.enc_key_length=16,g.block_length=16,g.fixed_iv_length=16,g.record_iv_length=16,g.mac_algorithm=e.MACAlgorithm.hmac_sha1,g.mac_length=20,g.mac_key_length=20},initConnectionState:a},e.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(g){g.bulk_cipher_algorithm=e.BulkCipherAlgorithm.aes,g.cipher_type=e.CipherType.block,g.enc_key_length=32,g.block_length=16,g.fixed_iv_length=16,g.record_iv_length=16,g.mac_algorithm=e.MACAlgorithm.hmac_sha1,g.mac_length=20,g.mac_key_length=20},initConnectionState:a};function a(g,f,S){var R=f.entity===t.tls.ConnectionEnd.client;g.read.cipherState={init:!1,cipher:t.cipher.createDecipher("AES-CBC",R?S.keys.server_write_key:S.keys.client_write_key),iv:R?S.keys.server_write_IV:S.keys.client_write_IV},g.write.cipherState={init:!1,cipher:t.cipher.createCipher("AES-CBC",R?S.keys.client_write_key:S.keys.server_write_key),iv:R?S.keys.client_write_IV:S.keys.server_write_IV},g.read.cipherFunction=l,g.write.cipherFunction=d,g.read.macLength=g.write.macLength=S.mac_length,g.read.macFunction=g.write.macFunction=e.hmac_sha1}function d(g,f){var S=!1,R=f.macFunction(f.macKey,f.sequenceNumber,g);g.fragment.putBytes(R),f.updateSequenceNumber();var E;g.version.minor===e.Versions.TLS_1_0.minor?E=f.cipherState.init?null:f.cipherState.iv:E=t.random.getBytesSync(16),f.cipherState.init=!0;var u=f.cipherState.cipher;return u.start({iv:E}),g.version.minor>=e.Versions.TLS_1_1.minor&&u.output.putBytes(E),u.update(g.fragment),u.finish(A)&&(g.fragment=u.output,g.length=g.fragment.length(),S=!0),S}function A(g,f,S){if(!S){var R=g-f.length()%g;f.fillWithByte(R-1,R)}return!0}function x(g,f,S){var R=!0;if(S){for(var E=f.length(),u=f.last(),v=E-1-u;v<E-1;++v)R=R&&f.at(v)==u;R&&f.truncate(u+1)}return R}function l(g,f){var S=!1,R;g.version.minor===e.Versions.TLS_1_0.minor?R=f.cipherState.init?null:f.cipherState.iv:R=g.fragment.getBytes(16),f.cipherState.init=!0;var E=f.cipherState.cipher;E.start({iv:R}),E.update(g.fragment),S=E.finish(x);var u=f.macLength,v=t.random.getBytesSync(u),C=E.output.length();C>=u?(g.fragment=E.output.getBytes(C-u),v=E.output.getBytes(u)):g.fragment=E.output.getBytes(),g.fragment=t.util.createBuffer(g.fragment),g.length=g.fragment.length();var y=f.macFunction(f.macKey,f.sequenceNumber,g);return f.updateSequenceNumber(),S=r(f.macKey,v,y)&&S,S}function r(g,f,S){var R=t.hmac.create();return R.start("SHA1",g),R.update(f),f=R.digest().getBytes(),R.start(null,null),R.update(S),S=R.digest().getBytes(),f===S}return Kt.exports}var vr={exports:{}},ga;function Ca(){if(ga)return vr.exports;ga=1;var t=ue();st(),ce();var e=vr.exports=t.sha512=t.sha512||{};t.md.sha512=t.md.algorithms.sha512=e;var a=t.sha384=t.sha512.sha384=t.sha512.sha384||{};a.create=function(){return e.create("SHA-384")},t.md.sha384=t.md.algorithms.sha384=a,t.sha512.sha256=t.sha512.sha256||{create:function(){return e.create("SHA-512/256")}},t.md["sha512/256"]=t.md.algorithms["sha512/256"]=t.sha512.sha256,t.sha512.sha224=t.sha512.sha224||{create:function(){return e.create("SHA-512/224")}},t.md["sha512/224"]=t.md.algorithms["sha512/224"]=t.sha512.sha224,e.create=function(f){if(A||r(),typeof f=="undefined"&&(f="SHA-512"),!(f in l))throw new Error("Invalid SHA-512 algorithm: "+f);for(var S=l[f],R=null,E=t.util.createBuffer(),u=new Array(80),v=0;v<80;++v)u[v]=new Array(2);var C=64;switch(f){case"SHA-384":C=48;break;case"SHA-512/256":C=32;break;case"SHA-512/224":C=28;break}var y={algorithm:f.replace("-","").toLowerCase(),blockLength:128,digestLength:C,messageLength:0,fullMessageLength:null,messageLengthSize:16};return y.start=function(){y.messageLength=0,y.fullMessageLength=y.messageLength128=[];for(var i=y.messageLengthSize/4,h=0;h<i;++h)y.fullMessageLength.push(0);E=t.util.createBuffer(),R=new Array(S.length);for(var h=0;h<S.length;++h)R[h]=S[h].slice(0);return y},y.start(),y.update=function(i,h){h==="utf8"&&(i=t.util.encodeUtf8(i));var p=i.length;y.messageLength+=p,p=[p/4294967296>>>0,p>>>0];for(var I=y.fullMessageLength.length-1;I>=0;--I)y.fullMessageLength[I]+=p[1],p[1]=p[0]+(y.fullMessageLength[I]/4294967296>>>0),y.fullMessageLength[I]=y.fullMessageLength[I]>>>0,p[0]=p[1]/4294967296>>>0;return E.putBytes(i),g(R,u,E),(E.read>2048||E.length()===0)&&E.compact(),y},y.digest=function(){var i=t.util.createBuffer();i.putBytes(E.bytes());var h=y.fullMessageLength[y.fullMessageLength.length-1]+y.messageLengthSize,p=h&y.blockLength-1;i.putBytes(d.substr(0,y.blockLength-p));for(var I,L,c=y.fullMessageLength[0]*8,s=0;s<y.fullMessageLength.length-1;++s)I=y.fullMessageLength[s+1]*8,L=I/4294967296>>>0,c+=L,i.putInt32(c>>>0),c=I>>>0;i.putInt32(c);for(var n=new Array(R.length),s=0;s<R.length;++s)n[s]=R[s].slice(0);g(n,u,i);var B=t.util.createBuffer(),D;f==="SHA-512"?D=n.length:f==="SHA-384"?D=n.length-2:D=n.length-4;for(var s=0;s<D;++s)B.putInt32(n[s][0]),(s!==D-1||f!=="SHA-512/224")&&B.putInt32(n[s][1]);return B},y};var d=null,A=!1,x=null,l=null;function r(){d="€",d+=t.util.fillString("\0",128),x=[[1116352408,3609767458],[1899447441,602891725],[3049323471,3964484399],[3921009573,2173295548],[961987163,4081628472],[1508970993,3053834265],[2453635748,2937671579],[2870763221,3664609560],[3624381080,2734883394],[310598401,1164996542],[607225278,1323610764],[1426881987,3590304994],[1925078388,4068182383],[2162078206,991336113],[2614888103,633803317],[3248222580,3479774868],[3835390401,2666613458],[4022224774,944711139],[264347078,2341262773],[604807628,2007800933],[770255983,1495990901],[1249150122,1856431235],[1555081692,3175218132],[1996064986,2198950837],[2554220882,3999719339],[2821834349,766784016],[2952996808,2566594879],[3210313671,3203337956],[3336571891,1034457026],[3584528711,2466948901],[113926993,3758326383],[338241895,168717936],[666307205,1188179964],[773529912,1546045734],[1294757372,1522805485],[1396182291,2643833823],[1695183700,2343527390],[1986661051,1014477480],[2177026350,1206759142],[2456956037,344077627],[2730485921,1290863460],[2820302411,3158454273],[3259730800,3505952657],[3345764771,106217008],[3516065817,3606008344],[3600352804,1432725776],[4094571909,1467031594],[275423344,851169720],[430227734,3100823752],[506948616,1363258195],[659060556,3750685593],[883997877,3785050280],[958139571,3318307427],[1322822218,3812723403],[1537002063,2003034995],[1747873779,3602036899],[1955562222,1575990012],[2024104815,1125592928],[2227730452,2716904306],[2361852424,442776044],[2428436474,593698344],[2756734187,3733110249],[3204031479,2999351573],[3329325298,3815920427],[3391569614,3928383900],[3515267271,566280711],[3940187606,3454069534],[4118630271,4000239992],[116418474,1914138554],[174292421,2731055270],[289380356,3203993006],[460393269,320620315],[685471733,587496836],[852142971,1086792851],[1017036298,365543100],[1126000580,2618297676],[1288033470,3409855158],[1501505948,4234509866],[1607167915,987167468],[1816402316,1246189591]],l={},l["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],l["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],l["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],l["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],A=!0}function g(f,S,R){for(var E,u,v,C,y,i,h,p,I,L,c,s,n,B,D,O,P,K,q,M,G,Y,W,ee,ne,ie,he,ve,fe,j,$,Ge,Me,m,k,w=R.length();w>=128;){for(fe=0;fe<16;++fe)S[fe][0]=R.getInt32()>>>0,S[fe][1]=R.getInt32()>>>0;for(;fe<80;++fe)Ge=S[fe-2],j=Ge[0],$=Ge[1],E=((j>>>19|$<<13)^($>>>29|j<<3)^j>>>6)>>>0,u=((j<<13|$>>>19)^($<<3|j>>>29)^(j<<26|$>>>6))>>>0,m=S[fe-15],j=m[0],$=m[1],v=((j>>>1|$<<31)^(j>>>8|$<<24)^j>>>7)>>>0,C=((j<<31|$>>>1)^(j<<24|$>>>8)^(j<<25|$>>>7))>>>0,Me=S[fe-7],k=S[fe-16],$=u+Me[1]+C+k[1],S[fe][0]=E+Me[0]+v+k[0]+($/4294967296>>>0)>>>0,S[fe][1]=$>>>0;for(n=f[0][0],B=f[0][1],D=f[1][0],O=f[1][1],P=f[2][0],K=f[2][1],q=f[3][0],M=f[3][1],G=f[4][0],Y=f[4][1],W=f[5][0],ee=f[5][1],ne=f[6][0],ie=f[6][1],he=f[7][0],ve=f[7][1],fe=0;fe<80;++fe)h=((G>>>14|Y<<18)^(G>>>18|Y<<14)^(Y>>>9|G<<23))>>>0,p=((G<<18|Y>>>14)^(G<<14|Y>>>18)^(Y<<23|G>>>9))>>>0,I=(ne^G&(W^ne))>>>0,L=(ie^Y&(ee^ie))>>>0,y=((n>>>28|B<<4)^(B>>>2|n<<30)^(B>>>7|n<<25))>>>0,i=((n<<4|B>>>28)^(B<<30|n>>>2)^(B<<25|n>>>7))>>>0,c=(n&D|P&(n^D))>>>0,s=(B&O|K&(B^O))>>>0,$=ve+p+L+x[fe][1]+S[fe][1],E=he+h+I+x[fe][0]+S[fe][0]+($/4294967296>>>0)>>>0,u=$>>>0,$=i+s,v=y+c+($/4294967296>>>0)>>>0,C=$>>>0,he=ne,ve=ie,ne=W,ie=ee,W=G,ee=Y,$=M+u,G=q+E+($/4294967296>>>0)>>>0,Y=$>>>0,q=P,M=K,P=D,K=O,D=n,O=B,$=u+C,n=E+v+($/4294967296>>>0)>>>0,B=$>>>0;$=f[0][1]+B,f[0][0]=f[0][0]+n+($/4294967296>>>0)>>>0,f[0][1]=$>>>0,$=f[1][1]+O,f[1][0]=f[1][0]+D+($/4294967296>>>0)>>>0,f[1][1]=$>>>0,$=f[2][1]+K,f[2][0]=f[2][0]+P+($/4294967296>>>0)>>>0,f[2][1]=$>>>0,$=f[3][1]+M,f[3][0]=f[3][0]+q+($/4294967296>>>0)>>>0,f[3][1]=$>>>0,$=f[4][1]+Y,f[4][0]=f[4][0]+G+($/4294967296>>>0)>>>0,f[4][1]=$>>>0,$=f[5][1]+ee,f[5][0]=f[5][0]+W+($/4294967296>>>0)>>>0,f[5][1]=$>>>0,$=f[6][1]+ie,f[6][0]=f[6][0]+ne+($/4294967296>>>0)>>>0,f[6][1]=$>>>0,$=f[7][1]+ve,f[7][0]=f[7][0]+he+($/4294967296>>>0)>>>0,f[7][1]=$>>>0,w-=128}}return vr.exports}var bt={},ma;function Ga(){if(ma)return bt;ma=1;var t=ue();nt();var e=t.asn1;return bt.privateKeyValidator={name:"PrivateKeyInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},bt.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{tagClass:e.Class.UNIVERSAL,type:e.Type.BITSTRING,constructed:!1,composed:!0,captureBitStringValue:"ed25519PublicKey"}]},bt}var yr,Ea;function Qa(){if(Ea)return yr;Ea=1;var t=ue();It(),Ze(),Ca(),ce();var e=Ga(),a=e.publicKeyValidator,d=e.privateKeyValidator;if(typeof A=="undefined")var A=t.jsbn.BigInteger;var x=t.util.ByteBuffer,l=typeof Buffer=="undefined"?Uint8Array:Buffer;t.pki=t.pki||{},yr=t.pki.ed25519=t.ed25519=t.ed25519||{};var r=t.ed25519;r.constants={},r.constants.PUBLIC_KEY_BYTE_LENGTH=32,r.constants.PRIVATE_KEY_BYTE_LENGTH=64,r.constants.SEED_BYTE_LENGTH=32,r.constants.SIGN_BYTE_LENGTH=64,r.constants.HASH_BYTE_LENGTH=64,r.generateKeyPair=function(k){k=k||{};var w=k.seed;if(w===void 0)w=t.random.getBytesSync(r.constants.SEED_BYTE_LENGTH);else if(typeof w=="string"){if(w.length!==r.constants.SEED_BYTE_LENGTH)throw new TypeError('"seed" must be '+r.constants.SEED_BYTE_LENGTH+" bytes in length.")}else if(!(w instanceof Uint8Array))throw new TypeError('"seed" must be a node.js Buffer, Uint8Array, or a binary string.');w=g({message:w,encoding:"binary"});for(var N=new l(r.constants.PUBLIC_KEY_BYTE_LENGTH),o=new l(r.constants.PRIVATE_KEY_BYTE_LENGTH),_=0;_<32;++_)o[_]=w[_];return h(N,o),{publicKey:N,privateKey:o}},r.privateKeyFromAsn1=function(k){var w={},N=[],o=t.asn1.validate(k,d,w,N);if(!o){var _=new Error("Invalid Key.");throw _.errors=N,_}var V=t.asn1.derToOid(w.privateKeyOid),H=t.oids.EdDSA25519;if(V!==H)throw new Error('Invalid OID "'+V+'"; OID must be "'+H+'".');var ae=w.privateKey,te=g({message:t.asn1.fromDer(ae).value,encoding:"binary"});return{privateKeyBytes:te}},r.publicKeyFromAsn1=function(k){var w={},N=[],o=t.asn1.validate(k,a,w,N);if(!o){var _=new Error("Invalid Key.");throw _.errors=N,_}var V=t.asn1.derToOid(w.publicKeyOid),H=t.oids.EdDSA25519;if(V!==H)throw new Error('Invalid OID "'+V+'"; OID must be "'+H+'".');var ae=w.ed25519PublicKey;if(ae.length!==r.constants.PUBLIC_KEY_BYTE_LENGTH)throw new Error("Key length is invalid.");return g({message:ae,encoding:"binary"})},r.publicKeyFromPrivateKey=function(k){k=k||{};var w=g({message:k.privateKey,encoding:"binary"});if(w.length!==r.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+r.constants.PRIVATE_KEY_BYTE_LENGTH);for(var N=new l(r.constants.PUBLIC_KEY_BYTE_LENGTH),o=0;o<N.length;++o)N[o]=w[32+o];return N},r.sign=function(k){k=k||{};var w=g(k),N=g({message:k.privateKey,encoding:"binary"});if(N.length===r.constants.SEED_BYTE_LENGTH){var o=r.generateKeyPair({seed:N});N=o.privateKey}else if(N.length!==r.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+r.constants.SEED_BYTE_LENGTH+" or "+r.constants.PRIVATE_KEY_BYTE_LENGTH);var _=new l(r.constants.SIGN_BYTE_LENGTH+w.length);p(_,w,w.length,N);for(var V=new l(r.constants.SIGN_BYTE_LENGTH),H=0;H<V.length;++H)V[H]=_[H];return V},r.verify=function(k){k=k||{};var w=g(k);if(k.signature===void 0)throw new TypeError('"options.signature" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a binary string.');var N=g({message:k.signature,encoding:"binary"});if(N.length!==r.constants.SIGN_BYTE_LENGTH)throw new TypeError('"options.signature" must have a byte length of '+r.constants.SIGN_BYTE_LENGTH);var o=g({message:k.publicKey,encoding:"binary"});if(o.length!==r.constants.PUBLIC_KEY_BYTE_LENGTH)throw new TypeError('"options.publicKey" must have a byte length of '+r.constants.PUBLIC_KEY_BYTE_LENGTH);var _=new l(r.constants.SIGN_BYTE_LENGTH+w.length),V=new l(r.constants.SIGN_BYTE_LENGTH+w.length),H;for(H=0;H<r.constants.SIGN_BYTE_LENGTH;++H)_[H]=N[H];for(H=0;H<w.length;++H)_[H+r.constants.SIGN_BYTE_LENGTH]=w[H];return I(V,_,_.length,o)>=0};function g(k){var w=k.message;if(w instanceof Uint8Array||w instanceof l)return w;var N=k.encoding;if(w===void 0)if(k.md)w=k.md.digest().getBytes(),N="binary";else throw new TypeError('"options.message" or "options.md" not specified.');if(typeof w=="string"&&!N)throw new TypeError('"options.encoding" must be "binary" or "utf8".');if(typeof w=="string"){if(typeof Buffer!="undefined")return Buffer.from(w,N);w=new x(w,N)}else if(!(w instanceof x))throw new TypeError('"options.message" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a string with "options.encoding" specifying its encoding.');for(var o=new l(w.length()),_=0;_<o.length;++_)o[_]=w.at(_);return o}var f=j(),S=j([1]),R=j([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),E=j([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),u=j([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),v=j([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),C=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]),y=j([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function i(k,w){var N=t.md.sha512.create(),o=new x(k);N.update(o.getBytes(w),"binary");var _=N.digest().getBytes();if(typeof Buffer!="undefined")return Buffer.from(_,"binary");for(var V=new l(r.constants.HASH_BYTE_LENGTH),H=0;H<64;++H)V[H]=_.charCodeAt(H);return V}function h(k,w){var N=[j(),j(),j(),j()],o,_=i(w,32);for(_[0]&=248,_[31]&=127,_[31]|=64,ne(N,_),D(k,N),o=0;o<32;++o)w[o+32]=k[o];return 0}function p(k,w,N,o){var _,V,H=new Float64Array(64),ae=[j(),j(),j(),j()],te=i(o,32);te[0]&=248,te[31]&=127,te[31]|=64;var Q=N+64;for(_=0;_<N;++_)k[64+_]=w[_];for(_=0;_<32;++_)k[32+_]=te[32+_];var Z=i(k.subarray(32),N+32);for(s(Z),ne(ae,Z),D(k,ae),_=32;_<64;++_)k[_]=o[_];var se=i(k,N+64);for(s(se),_=32;_<64;++_)H[_]=0;for(_=0;_<32;++_)H[_]=Z[_];for(_=0;_<32;++_)for(V=0;V<32;V++)H[_+V]+=se[_]*te[V];return c(k.subarray(32),H),Q}function I(k,w,N,o){var _,V,H=new l(32),ae=[j(),j(),j(),j()],te=[j(),j(),j(),j()];if(V=-1,N<64||P(te,o)||!L(w,32))return-1;for(_=0;_<N;++_)k[_]=w[_];for(_=0;_<32;++_)k[_+32]=o[_];var Q=i(k,N);if(s(Q),ee(ae,te,Q),ne(te,w.subarray(32)),n(ae,te),D(H,ae),N-=64,G(w,0,H,0)){for(_=0;_<N;++_)k[_]=0;return-1}for(_=0;_<N;++_)k[_]=w[_+64];return V=N,V}function L(k,w){var N;for(N=31;N>=0;--N){if(k[w+N]<C[N])return!0;if(k[w+N]>C[N])return!1}return!1}function c(k,w){var N,o,_,V;for(o=63;o>=32;--o){for(N=0,_=o-32,V=o-12;_<V;++_)w[_]+=N-16*w[o]*C[_-(o-32)],N=w[_]+128>>8,w[_]-=N*256;w[_]+=N,w[o]=0}for(N=0,_=0;_<32;++_)w[_]+=N-(w[31]>>4)*C[_],N=w[_]>>8,w[_]&=255;for(_=0;_<32;++_)w[_]-=N*C[_];for(o=0;o<32;++o)w[o+1]+=w[o]>>8,k[o]=w[o]&255}function s(k){for(var w=new Float64Array(64),N=0;N<64;++N)w[N]=k[N],k[N]=0;c(k,w)}function n(k,w){var N=j(),o=j(),_=j(),V=j(),H=j(),ae=j(),te=j(),Q=j(),Z=j();Ge(N,k[1],k[0]),Ge(Z,w[1],w[0]),m(N,N,Z),$(o,k[0],k[1]),$(Z,w[0],w[1]),m(o,o,Z),m(_,k[3],w[3]),m(_,_,E),m(V,k[2],w[2]),$(V,V,V),Ge(H,o,N),Ge(ae,V,_),$(te,V,_),$(Q,o,N),m(k[0],H,ae),m(k[1],Q,te),m(k[2],te,ae),m(k[3],H,Q)}function B(k,w,N){for(var o=0;o<4;++o)fe(k[o],w[o],N)}function D(k,w){var N=j(),o=j(),_=j();he(_,w[2]),m(N,w[0],_),m(o,w[1],_),O(k,o),k[31]^=W(N)<<7}function O(k,w){var N,o,_,V=j(),H=j();for(N=0;N<16;++N)H[N]=w[N];for(ve(H),ve(H),ve(H),o=0;o<2;++o){for(V[0]=H[0]-65517,N=1;N<15;++N)V[N]=H[N]-65535-(V[N-1]>>16&1),V[N-1]&=65535;V[15]=H[15]-32767-(V[14]>>16&1),_=V[15]>>16&1,V[14]&=65535,fe(H,V,1-_)}for(N=0;N<16;N++)k[2*N]=H[N]&255,k[2*N+1]=H[N]>>8}function P(k,w){var N=j(),o=j(),_=j(),V=j(),H=j(),ae=j(),te=j();return ie(k[2],S),K(k[1],w),Me(_,k[1]),m(V,_,R),Ge(_,_,k[2]),$(V,k[2],V),Me(H,V),Me(ae,H),m(te,ae,H),m(N,te,_),m(N,N,V),q(N,N),m(N,N,_),m(N,N,V),m(N,N,V),m(k[0],N,V),Me(o,k[0]),m(o,o,V),M(o,_)&&m(k[0],k[0],y),Me(o,k[0]),m(o,o,V),M(o,_)?-1:(W(k[0])===w[31]>>7&&Ge(k[0],f,k[0]),m(k[3],k[0],k[1]),0)}function K(k,w){var N;for(N=0;N<16;++N)k[N]=w[2*N]+(w[2*N+1]<<8);k[15]&=32767}function q(k,w){var N=j(),o;for(o=0;o<16;++o)N[o]=w[o];for(o=250;o>=0;--o)Me(N,N),o!==1&&m(N,N,w);for(o=0;o<16;++o)k[o]=N[o]}function M(k,w){var N=new l(32),o=new l(32);return O(N,k),O(o,w),G(N,0,o,0)}function G(k,w,N,o){return Y(k,w,N,o,32)}function Y(k,w,N,o,_){var V,H=0;for(V=0;V<_;++V)H|=k[w+V]^N[o+V];return(1&H-1>>>8)-1}function W(k){var w=new l(32);return O(w,k),w[0]&1}function ee(k,w,N){var o,_;for(ie(k[0],f),ie(k[1],S),ie(k[2],S),ie(k[3],f),_=255;_>=0;--_)o=N[_/8|0]>>(_&7)&1,B(k,w,o),n(w,k),n(k,k),B(k,w,o)}function ne(k,w){var N=[j(),j(),j(),j()];ie(N[0],u),ie(N[1],v),ie(N[2],S),m(N[3],u,v),ee(k,N,w)}function ie(k,w){var N;for(N=0;N<16;N++)k[N]=w[N]|0}function he(k,w){var N=j(),o;for(o=0;o<16;++o)N[o]=w[o];for(o=253;o>=0;--o)Me(N,N),o!==2&&o!==4&&m(N,N,w);for(o=0;o<16;++o)k[o]=N[o]}function ve(k){var w,N,o=1;for(w=0;w<16;++w)N=k[w]+o+65535,o=Math.floor(N/65536),k[w]=N-o*65536;k[0]+=o-1+37*(o-1)}function fe(k,w,N){for(var o,_=~(N-1),V=0;V<16;++V)o=_&(k[V]^w[V]),k[V]^=o,w[V]^=o}function j(k){var w,N=new Float64Array(16);if(k)for(w=0;w<k.length;++w)N[w]=k[w];return N}function $(k,w,N){for(var o=0;o<16;++o)k[o]=w[o]+N[o]}function Ge(k,w,N){for(var o=0;o<16;++o)k[o]=w[o]-N[o]}function Me(k,w){m(k,w,w)}function m(k,w,N){var o,_,V=0,H=0,ae=0,te=0,Q=0,Z=0,se=0,le=0,oe=0,me=0,Se=0,xe=0,Ee=0,ge=0,ye=0,pe=0,Ie=0,Ae=0,qe=0,He=0,Qe=0,Ye=0,We=0,Je=0,it=0,ot=0,ft=0,dt=0,yt=0,xt=0,Nt=0,Be=N[0],be=N[1],_e=N[2],Ne=N[3],Re=N[4],we=N[5],Le=N[6],ke=N[7],De=N[8],Ue=N[9],Pe=N[10],Ve=N[11],Ce=N[12],Te=N[13],Oe=N[14],Ke=N[15];o=w[0],V+=o*Be,H+=o*be,ae+=o*_e,te+=o*Ne,Q+=o*Re,Z+=o*we,se+=o*Le,le+=o*ke,oe+=o*De,me+=o*Ue,Se+=o*Pe,xe+=o*Ve,Ee+=o*Ce,ge+=o*Te,ye+=o*Oe,pe+=o*Ke,o=w[1],H+=o*Be,ae+=o*be,te+=o*_e,Q+=o*Ne,Z+=o*Re,se+=o*we,le+=o*Le,oe+=o*ke,me+=o*De,Se+=o*Ue,xe+=o*Pe,Ee+=o*Ve,ge+=o*Ce,ye+=o*Te,pe+=o*Oe,Ie+=o*Ke,o=w[2],ae+=o*Be,te+=o*be,Q+=o*_e,Z+=o*Ne,se+=o*Re,le+=o*we,oe+=o*Le,me+=o*ke,Se+=o*De,xe+=o*Ue,Ee+=o*Pe,ge+=o*Ve,ye+=o*Ce,pe+=o*Te,Ie+=o*Oe,Ae+=o*Ke,o=w[3],te+=o*Be,Q+=o*be,Z+=o*_e,se+=o*Ne,le+=o*Re,oe+=o*we,me+=o*Le,Se+=o*ke,xe+=o*De,Ee+=o*Ue,ge+=o*Pe,ye+=o*Ve,pe+=o*Ce,Ie+=o*Te,Ae+=o*Oe,qe+=o*Ke,o=w[4],Q+=o*Be,Z+=o*be,se+=o*_e,le+=o*Ne,oe+=o*Re,me+=o*we,Se+=o*Le,xe+=o*ke,Ee+=o*De,ge+=o*Ue,ye+=o*Pe,pe+=o*Ve,Ie+=o*Ce,Ae+=o*Te,qe+=o*Oe,He+=o*Ke,o=w[5],Z+=o*Be,se+=o*be,le+=o*_e,oe+=o*Ne,me+=o*Re,Se+=o*we,xe+=o*Le,Ee+=o*ke,ge+=o*De,ye+=o*Ue,pe+=o*Pe,Ie+=o*Ve,Ae+=o*Ce,qe+=o*Te,He+=o*Oe,Qe+=o*Ke,o=w[6],se+=o*Be,le+=o*be,oe+=o*_e,me+=o*Ne,Se+=o*Re,xe+=o*we,Ee+=o*Le,ge+=o*ke,ye+=o*De,pe+=o*Ue,Ie+=o*Pe,Ae+=o*Ve,qe+=o*Ce,He+=o*Te,Qe+=o*Oe,Ye+=o*Ke,o=w[7],le+=o*Be,oe+=o*be,me+=o*_e,Se+=o*Ne,xe+=o*Re,Ee+=o*we,ge+=o*Le,ye+=o*ke,pe+=o*De,Ie+=o*Ue,Ae+=o*Pe,qe+=o*Ve,He+=o*Ce,Qe+=o*Te,Ye+=o*Oe,We+=o*Ke,o=w[8],oe+=o*Be,me+=o*be,Se+=o*_e,xe+=o*Ne,Ee+=o*Re,ge+=o*we,ye+=o*Le,pe+=o*ke,Ie+=o*De,Ae+=o*Ue,qe+=o*Pe,He+=o*Ve,Qe+=o*Ce,Ye+=o*Te,We+=o*Oe,Je+=o*Ke,o=w[9],me+=o*Be,Se+=o*be,xe+=o*_e,Ee+=o*Ne,ge+=o*Re,ye+=o*we,pe+=o*Le,Ie+=o*ke,Ae+=o*De,qe+=o*Ue,He+=o*Pe,Qe+=o*Ve,Ye+=o*Ce,We+=o*Te,Je+=o*Oe,it+=o*Ke,o=w[10],Se+=o*Be,xe+=o*be,Ee+=o*_e,ge+=o*Ne,ye+=o*Re,pe+=o*we,Ie+=o*Le,Ae+=o*ke,qe+=o*De,He+=o*Ue,Qe+=o*Pe,Ye+=o*Ve,We+=o*Ce,Je+=o*Te,it+=o*Oe,ot+=o*Ke,o=w[11],xe+=o*Be,Ee+=o*be,ge+=o*_e,ye+=o*Ne,pe+=o*Re,Ie+=o*we,Ae+=o*Le,qe+=o*ke,He+=o*De,Qe+=o*Ue,Ye+=o*Pe,We+=o*Ve,Je+=o*Ce,it+=o*Te,ot+=o*Oe,ft+=o*Ke,o=w[12],Ee+=o*Be,ge+=o*be,ye+=o*_e,pe+=o*Ne,Ie+=o*Re,Ae+=o*we,qe+=o*Le,He+=o*ke,Qe+=o*De,Ye+=o*Ue,We+=o*Pe,Je+=o*Ve,it+=o*Ce,ot+=o*Te,ft+=o*Oe,dt+=o*Ke,o=w[13],ge+=o*Be,ye+=o*be,pe+=o*_e,Ie+=o*Ne,Ae+=o*Re,qe+=o*we,He+=o*Le,Qe+=o*ke,Ye+=o*De,We+=o*Ue,Je+=o*Pe,it+=o*Ve,ot+=o*Ce,ft+=o*Te,dt+=o*Oe,yt+=o*Ke,o=w[14],ye+=o*Be,pe+=o*be,Ie+=o*_e,Ae+=o*Ne,qe+=o*Re,He+=o*we,Qe+=o*Le,Ye+=o*ke,We+=o*De,Je+=o*Ue,it+=o*Pe,ot+=o*Ve,ft+=o*Ce,dt+=o*Te,yt+=o*Oe,xt+=o*Ke,o=w[15],pe+=o*Be,Ie+=o*be,Ae+=o*_e,qe+=o*Ne,He+=o*Re,Qe+=o*we,Ye+=o*Le,We+=o*ke,Je+=o*De,it+=o*Ue,ot+=o*Pe,ft+=o*Ve,dt+=o*Ce,yt+=o*Te,xt+=o*Oe,Nt+=o*Ke,V+=38*Ie,H+=38*Ae,ae+=38*qe,te+=38*He,Q+=38*Qe,Z+=38*Ye,se+=38*We,le+=38*Je,oe+=38*it,me+=38*ot,Se+=38*ft,xe+=38*dt,Ee+=38*yt,ge+=38*xt,ye+=38*Nt,_=1,o=V+_+65535,_=Math.floor(o/65536),V=o-_*65536,o=H+_+65535,_=Math.floor(o/65536),H=o-_*65536,o=ae+_+65535,_=Math.floor(o/65536),ae=o-_*65536,o=te+_+65535,_=Math.floor(o/65536),te=o-_*65536,o=Q+_+65535,_=Math.floor(o/65536),Q=o-_*65536,o=Z+_+65535,_=Math.floor(o/65536),Z=o-_*65536,o=se+_+65535,_=Math.floor(o/65536),se=o-_*65536,o=le+_+65535,_=Math.floor(o/65536),le=o-_*65536,o=oe+_+65535,_=Math.floor(o/65536),oe=o-_*65536,o=me+_+65535,_=Math.floor(o/65536),me=o-_*65536,o=Se+_+65535,_=Math.floor(o/65536),Se=o-_*65536,o=xe+_+65535,_=Math.floor(o/65536),xe=o-_*65536,o=Ee+_+65535,_=Math.floor(o/65536),Ee=o-_*65536,o=ge+_+65535,_=Math.floor(o/65536),ge=o-_*65536,o=ye+_+65535,_=Math.floor(o/65536),ye=o-_*65536,o=pe+_+65535,_=Math.floor(o/65536),pe=o-_*65536,V+=_-1+37*(_-1),_=1,o=V+_+65535,_=Math.floor(o/65536),V=o-_*65536,o=H+_+65535,_=Math.floor(o/65536),H=o-_*65536,o=ae+_+65535,_=Math.floor(o/65536),ae=o-_*65536,o=te+_+65535,_=Math.floor(o/65536),te=o-_*65536,o=Q+_+65535,_=Math.floor(o/65536),Q=o-_*65536,o=Z+_+65535,_=Math.floor(o/65536),Z=o-_*65536,o=se+_+65535,_=Math.floor(o/65536),se=o-_*65536,o=le+_+65535,_=Math.floor(o/65536),le=o-_*65536,o=oe+_+65535,_=Math.floor(o/65536),oe=o-_*65536,o=me+_+65535,_=Math.floor(o/65536),me=o-_*65536,o=Se+_+65535,_=Math.floor(o/65536),Se=o-_*65536,o=xe+_+65535,_=Math.floor(o/65536),xe=o-_*65536,o=Ee+_+65535,_=Math.floor(o/65536),Ee=o-_*65536,o=ge+_+65535,_=Math.floor(o/65536),ge=o-_*65536,o=ye+_+65535,_=Math.floor(o/65536),ye=o-_*65536,o=pe+_+65535,_=Math.floor(o/65536),pe=o-_*65536,V+=_-1+37*(_-1),k[0]=V,k[1]=H,k[2]=ae,k[3]=te,k[4]=Q,k[5]=Z,k[6]=se,k[7]=le,k[8]=oe,k[9]=me,k[10]=Se,k[11]=xe,k[12]=Ee,k[13]=ge,k[14]=ye,k[15]=pe}return yr}var gr,xa;function za(){if(xa)return gr;xa=1;var t=ue();ce(),Ze(),It(),gr=t.kem=t.kem||{};var e=t.jsbn.BigInteger;t.kem.rsa={},t.kem.rsa.create=function(d,A){A=A||{};var x=A.prng||t.random,l={};return l.encrypt=function(r,g){var f=Math.ceil(r.n.bitLength()/8),S;do S=new e(t.util.bytesToHex(x.getBytesSync(f)),16).mod(r.n);while(S.compareTo(e.ONE)<=0);S=t.util.hexToBytes(S.toString(16));var R=f-S.length;R>0&&(S=t.util.fillString("\0",R)+S);var E=r.encrypt(S,"NONE"),u=d.generate(S,g);return{encapsulation:E,key:u}},l.decrypt=function(r,g,f){var S=r.decrypt(g,"NONE");return d.generate(S,f)},l},t.kem.kdf1=function(d,A){a(this,d,0,A||d.digestLength)},t.kem.kdf2=function(d,A){a(this,d,1,A||d.digestLength)};function a(d,A,x,l){d.generate=function(r,g){for(var f=new t.util.ByteBuffer,S=Math.ceil(g/l)+x,R=new t.util.ByteBuffer,E=x;E<S;++E){R.putInt32(E),A.start(),A.update(r+R.getBytes());var u=A.digest();f.putBytes(u.getBytes(l))}return f.truncate(f.length()-g),f.getBytes()}}return gr}var Cr,Sa;function Ya(){if(Sa)return Cr;Sa=1;var t=ue();ce(),Cr=t.log=t.log||{},t.log.levels=["none","error","warning","info","debug","verbose","max"];var e={},a=[],d=null;t.log.LEVEL_LOCKED=2,t.log.NO_LEVEL_CHECK=4,t.log.INTERPOLATE=8;for(var A=0;A<t.log.levels.length;++A){var x=t.log.levels[A];e[x]={index:A,name:x.toUpperCase()}}t.log.logMessage=function(E){for(var u=e[E.level].index,v=0;v<a.length;++v){var C=a[v];if(C.flags&t.log.NO_LEVEL_CHECK)C.f(E);else{var y=e[C.level].index;u<=y&&C.f(C,E)}}},t.log.prepareStandard=function(E){"standard"in E||(E.standard=e[E.level].name+" ["+E.category+"] "+E.message)},t.log.prepareFull=function(E){if(!("full"in E)){var u=[E.message];u=u.concat([]),E.full=t.util.format.apply(this,u)}},t.log.prepareStandardFull=function(E){"standardFull"in E||(t.log.prepareStandard(E),E.standardFull=E.standard)};for(var l=["error","warning","info","debug","verbose"],A=0;A<l.length;++A)(function(u){t.log[u]=function(v,C){var y=Array.prototype.slice.call(arguments).slice(2),i={timestamp:new Date,level:u,category:v,message:C,arguments:y};t.log.logMessage(i)}})(l[A]);if(t.log.makeLogger=function(E){var u={flags:0,f:E};return t.log.setLevel(u,"none"),u},t.log.setLevel=function(E,u){var v=!1;if(E&&!(E.flags&t.log.LEVEL_LOCKED))for(var C=0;C<t.log.levels.length;++C){var y=t.log.levels[C];if(u==y){E.level=u,v=!0;break}}return v},t.log.lock=function(E,u){typeof u=="undefined"||u?E.flags|=t.log.LEVEL_LOCKED:E.flags&=~t.log.LEVEL_LOCKED},t.log.addLogger=function(E){a.push(E)},typeof console!="undefined"&&"log"in console){var r;if(console.error&&console.warn&&console.info&&console.debug){var g={error:console.error,warning:console.warn,info:console.info,debug:console.debug,verbose:console.debug},f=function(E,u){t.log.prepareStandard(u);var v=g[u.level],C=[u.standard];C=C.concat(u.arguments.slice()),v.apply(console,C)};r=t.log.makeLogger(f)}else{var f=function(u,v){t.log.prepareStandardFull(v),console.log(v.standardFull)};r=t.log.makeLogger(f)}t.log.setLevel(r,"debug"),t.log.addLogger(r),d=r}else console={log:function(){}};if(d!==null&&typeof window!="undefined"&&window.location){var S=new URL(window.location.href).searchParams;if(S.has("console.level")&&t.log.setLevel(d,S.get("console.level").slice(-1)[0]),S.has("console.lock")){var R=S.get("console.lock").slice(-1)[0];R=="true"&&t.log.lock(d)}}return t.log.consoleLogger=d,Cr}var mr,Ta;function Xa(){return Ta||(Ta=1,mr=st(),Qt(),mt(),qr(),Ca()),mr}var Er={exports:{}},Ia;function Wa(){if(Ia)return Er.exports;Ia=1;var t=ue();ct(),nt(),St(),ht(),pt(),na(),Ze(),ce(),dr();var e=t.asn1,a=Er.exports=t.pkcs7=t.pkcs7||{};a.messageFromPem=function(u){var v=t.pem.decode(u)[0];if(v.type!=="PKCS7"){var C=new Error('Could not convert PKCS#7 message from PEM; PEM header type is not "PKCS#7".');throw C.headerType=v.type,C}if(v.procType&&v.procType.type==="ENCRYPTED")throw new Error("Could not convert PKCS#7 message from PEM; PEM is encrypted.");var y=e.fromDer(v.body);return a.messageFromAsn1(y)},a.messageToPem=function(u,v){var C={type:"PKCS7",body:e.toDer(u.toAsn1()).getBytes()};return t.pem.encode(C,{maxline:v})},a.messageFromAsn1=function(u){var v={},C=[];if(!e.validate(u,a.asn1.contentInfoValidator,v,C)){var y=new Error("Cannot read PKCS#7 message. ASN.1 object is not an PKCS#7 ContentInfo.");throw y.errors=C,y}var i=e.derToOid(v.contentType),h;switch(i){case t.pki.oids.envelopedData:h=a.createEnvelopedData();break;case t.pki.oids.encryptedData:h=a.createEncryptedData();break;case t.pki.oids.signedData:h=a.createSignedData();break;default:throw new Error("Cannot read PKCS#7 message. ContentType with OID "+i+" is not (yet) supported.")}return h.fromAsn1(v.content.value[0]),h},a.createSignedData=function(){var u=null;return u={type:t.pki.oids.signedData,version:1,certificates:[],crls:[],signers:[],digestAlgorithmIdentifiers:[],contentInfo:null,signerInfos:[],fromAsn1:function(y){if(R(u,y,a.asn1.signedDataValidator),u.certificates=[],u.crls=[],u.digestAlgorithmIdentifiers=[],u.contentInfo=null,u.signerInfos=[],u.rawCapture.certificates)for(var i=u.rawCapture.certificates.value,h=0;h<i.length;++h)u.certificates.push(t.pki.certificateFromAsn1(i[h]))},toAsn1:function(){u.contentInfo||u.sign();for(var y=[],i=0;i<u.certificates.length;++i)y.push(t.pki.certificateToAsn1(u.certificates[i]));var h=[],p=e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(u.version).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,u.digestAlgorithmIdentifiers),u.contentInfo])]);return y.length>0&&p.value[0].value.push(e.create(e.Class.CONTEXT_SPECIFIC,0,!0,y)),h.length>0&&p.value[0].value.push(e.create(e.Class.CONTEXT_SPECIFIC,1,!0,h)),p.value[0].value.push(e.create(e.Class.UNIVERSAL,e.Type.SET,!0,u.signerInfos)),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(u.type).getBytes()),p])},addSigner:function(y){var i=y.issuer,h=y.serialNumber;if(y.certificate){var p=y.certificate;typeof p=="string"&&(p=t.pki.certificateFromPem(p)),i=p.issuer.attributes,h=p.serialNumber}var I=y.key;if(!I)throw new Error("Could not add PKCS#7 signer; no private key specified.");typeof I=="string"&&(I=t.pki.privateKeyFromPem(I));var L=y.digestAlgorithm||t.pki.oids.sha1;switch(L){case t.pki.oids.sha1:case t.pki.oids.sha256:case t.pki.oids.sha384:case t.pki.oids.sha512:case t.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+L)}var c=y.authenticatedAttributes||[];if(c.length>0){for(var s=!1,n=!1,B=0;B<c.length;++B){var D=c[B];if(!s&&D.type===t.pki.oids.contentType){if(s=!0,n)break;continue}if(!n&&D.type===t.pki.oids.messageDigest){if(n=!0,s)break;continue}}if(!s||!n)throw new Error("Invalid signer.authenticatedAttributes. If signer.authenticatedAttributes is specified, then it must contain at least two attributes, PKCS #9 content-type and PKCS #9 message-digest.")}u.signers.push({key:I,version:1,issuer:i,serialNumber:h,digestAlgorithm:L,signatureAlgorithm:t.pki.oids.rsaEncryption,signature:null,authenticatedAttributes:c,unauthenticatedAttributes:[]})},sign:function(y){if(y=y||{},(typeof u.content!="object"||u.contentInfo===null)&&(u.contentInfo=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(t.pki.oids.data).getBytes())]),"content"in u)){var i;u.content instanceof t.util.ByteBuffer?i=u.content.bytes():typeof u.content=="string"&&(i=t.util.encodeUtf8(u.content)),y.detached?u.detachedContent=e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,i):u.contentInfo.value.push(e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,i)]))}if(u.signers.length!==0){var h=v();C(h)}},verify:function(){throw new Error("PKCS#7 signature verification not yet implemented.")},addCertificate:function(y){typeof y=="string"&&(y=t.pki.certificateFromPem(y)),u.certificates.push(y)},addCertificateRevokationList:function(y){throw new Error("PKCS#7 CRL support not yet implemented.")}},u;function v(){for(var y={},i=0;i<u.signers.length;++i){var h=u.signers[i],p=h.digestAlgorithm;p in y||(y[p]=t.md[t.pki.oids[p]].create()),h.authenticatedAttributes.length===0?h.md=y[p]:h.md=t.md[t.pki.oids[p]].create()}u.digestAlgorithmIdentifiers=[];for(var p in y)u.digestAlgorithmIdentifiers.push(e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(p).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")]));return y}function C(y){var i;if(u.detachedContent?i=u.detachedContent:(i=u.contentInfo.value[1],i=i.value[0]),!i)throw new Error("Could not sign PKCS#7 message; there is no content to sign.");var h=e.derToOid(u.contentInfo.value[0].value),p=e.toDer(i);p.getByte(),e.getBerValueLength(p),p=p.getBytes();for(var I in y)y[I].start().update(p);for(var L=new Date,c=0;c<u.signers.length;++c){var s=u.signers[c];if(s.authenticatedAttributes.length===0){if(h!==t.pki.oids.data)throw new Error("Invalid signer; authenticatedAttributes must be present when the ContentInfo content type is not PKCS#7 Data.")}else{s.authenticatedAttributesAsn1=e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[]);for(var n=e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[]),B=0;B<s.authenticatedAttributes.length;++B){var D=s.authenticatedAttributes[B];D.type===t.pki.oids.messageDigest?D.value=y[s.digestAlgorithm].digest():D.type===t.pki.oids.signingTime&&(D.value||(D.value=L)),n.value.push(f(D)),s.authenticatedAttributesAsn1.value.push(f(D))}p=e.toDer(n).getBytes(),s.md.start().update(p)}s.signature=s.key.sign(s.md,"RSASSA-PKCS1-V1_5")}u.signerInfos=g(u.signers)}},a.createEncryptedData=function(){var u=null;return u={type:t.pki.oids.encryptedData,version:0,encryptedContent:{algorithm:t.pki.oids["aes256-CBC"]},fromAsn1:function(v){R(u,v,a.asn1.encryptedDataValidator)},decrypt:function(v){v!==void 0&&(u.encryptedContent.key=v),E(u)}},u},a.createEnvelopedData=function(){var u=null;return u={type:t.pki.oids.envelopedData,version:0,recipients:[],encryptedContent:{algorithm:t.pki.oids["aes256-CBC"]},fromAsn1:function(v){var C=R(u,v,a.asn1.envelopedDataValidator);u.recipients=x(C.recipientInfos.value)},toAsn1:function(){return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(u.type).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(u.version).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,l(u.recipients)),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,S(u.encryptedContent))])])])},findRecipient:function(v){for(var C=v.issuer.attributes,y=0;y<u.recipients.length;++y){var i=u.recipients[y],h=i.issuer;if(i.serialNumber===v.serialNumber&&h.length===C.length){for(var p=!0,I=0;I<C.length;++I)if(h[I].type!==C[I].type||h[I].value!==C[I].value){p=!1;break}if(p)return i}}return null},decrypt:function(v,C){if(u.encryptedContent.key===void 0&&v!==void 0&&C!==void 0)switch(v.encryptedContent.algorithm){case t.pki.oids.rsaEncryption:case t.pki.oids.desCBC:var y=C.decrypt(v.encryptedContent.content);u.encryptedContent.key=t.util.createBuffer(y);break;default:throw new Error("Unsupported asymmetric cipher, OID "+v.encryptedContent.algorithm)}E(u)},addRecipient:function(v){u.recipients.push({version:0,issuer:v.issuer.attributes,serialNumber:v.serialNumber,encryptedContent:{algorithm:t.pki.oids.rsaEncryption,key:v.publicKey}})},encrypt:function(v,C){if(u.encryptedContent.content===void 0){C=C||u.encryptedContent.algorithm,v=v||u.encryptedContent.key;var y,i,h;switch(C){case t.pki.oids["aes128-CBC"]:y=16,i=16,h=t.aes.createEncryptionCipher;break;case t.pki.oids["aes192-CBC"]:y=24,i=16,h=t.aes.createEncryptionCipher;break;case t.pki.oids["aes256-CBC"]:y=32,i=16,h=t.aes.createEncryptionCipher;break;case t.pki.oids["des-EDE3-CBC"]:y=24,i=8,h=t.des.createEncryptionCipher;break;default:throw new Error("Unsupported symmetric cipher, OID "+C)}if(v===void 0)v=t.util.createBuffer(t.random.getBytes(y));else if(v.length()!=y)throw new Error("Symmetric key has wrong length; got "+v.length()+" bytes, expected "+y+".");u.encryptedContent.algorithm=C,u.encryptedContent.key=v,u.encryptedContent.parameter=t.util.createBuffer(t.random.getBytes(i));var p=h(v);if(p.start(u.encryptedContent.parameter.copy()),p.update(u.content),!p.finish())throw new Error("Symmetric encryption failed.");u.encryptedContent.content=p.output}for(var I=0;I<u.recipients.length;++I){var L=u.recipients[I];if(L.encryptedContent.content===void 0)if(L.encryptedContent.algorithm===t.pki.oids.rsaEncryption)L.encryptedContent.content=L.encryptedContent.key.encrypt(u.encryptedContent.key.data);else throw new Error("Unsupported asymmetric cipher, OID "+L.encryptedContent.algorithm)}}},u};function d(u){var v={},C=[];if(!e.validate(u,a.asn1.recipientInfoValidator,v,C)){var y=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw y.errors=C,y}return{version:v.version.charCodeAt(0),issuer:t.pki.RDNAttributesAsArray(v.issuer),serialNumber:t.util.createBuffer(v.serial).toHex(),encryptedContent:{algorithm:e.derToOid(v.encAlgorithm),parameter:v.encParameter?v.encParameter.value:void 0,content:v.encKey}}}function A(u){return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(u.version).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[t.pki.distinguishedNameToAsn1({attributes:u.issuer}),e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,t.util.hexToBytes(u.serialNumber))]),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(u.encryptedContent.algorithm).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")]),e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,u.encryptedContent.content)])}function x(u){for(var v=[],C=0;C<u.length;++C)v.push(d(u[C]));return v}function l(u){for(var v=[],C=0;C<u.length;++C)v.push(A(u[C]));return v}function r(u){var v=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(u.version).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[t.pki.distinguishedNameToAsn1({attributes:u.issuer}),e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,t.util.hexToBytes(u.serialNumber))]),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(u.digestAlgorithm).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")])]);if(u.authenticatedAttributesAsn1&&v.value.push(u.authenticatedAttributesAsn1),v.value.push(e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(u.signatureAlgorithm).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")])),v.value.push(e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,u.signature)),u.unauthenticatedAttributes.length>0){for(var C=e.create(e.Class.CONTEXT_SPECIFIC,1,!0,[]),y=0;y<u.unauthenticatedAttributes.length;++y){var i=u.unauthenticatedAttributes[y];C.values.push(f(i))}v.value.push(C)}return v}function g(u){for(var v=[],C=0;C<u.length;++C)v.push(r(u[C]));return v}function f(u){var v;if(u.type===t.pki.oids.contentType)v=e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(u.value).getBytes());else if(u.type===t.pki.oids.messageDigest)v=e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,u.value.bytes());else if(u.type===t.pki.oids.signingTime){var C=new Date("1950-01-01T00:00:00Z"),y=new Date("2050-01-01T00:00:00Z"),i=u.value;if(typeof i=="string"){var h=Date.parse(i);isNaN(h)?i.length===13?i=e.utcTimeToDate(i):i=e.generalizedTimeToDate(i):i=new Date(h)}i>=C&&i<y?v=e.create(e.Class.UNIVERSAL,e.Type.UTCTIME,!1,e.dateToUtcTime(i)):v=e.create(e.Class.UNIVERSAL,e.Type.GENERALIZEDTIME,!1,e.dateToGeneralizedTime(i))}return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(u.type).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[v])])}function S(u){return[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(t.pki.oids.data).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(u.algorithm).getBytes()),u.parameter?e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,u.parameter.getBytes()):void 0]),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,u.content.getBytes())])]}function R(u,v,C){var y={},i=[];if(!e.validate(v,C,y,i)){var h=new Error("Cannot read PKCS#7 message. ASN.1 object is not a supported PKCS#7 message.");throw h.errors=h,h}var p=e.derToOid(y.contentType);if(p!==t.pki.oids.data)throw new Error("Unsupported PKCS#7 message. Only wrapped ContentType Data supported.");if(y.encryptedContent){var I="";if(t.util.isArray(y.encryptedContent))for(var L=0;L<y.encryptedContent.length;++L){if(y.encryptedContent[L].type!==e.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting encrypted content constructed of only OCTET STRING objects.");I+=y.encryptedContent[L].value}else I=y.encryptedContent;u.encryptedContent={algorithm:e.derToOid(y.encAlgorithm),parameter:t.util.createBuffer(y.encParameter.value),content:t.util.createBuffer(I)}}if(y.content){var I="";if(t.util.isArray(y.content))for(var L=0;L<y.content.length;++L){if(y.content[L].type!==e.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting content constructed of only OCTET STRING objects.");I+=y.content[L].value}else I=y.content;u.content=t.util.createBuffer(I)}return u.version=y.version.charCodeAt(0),u.rawCapture=y,y}function E(u){if(u.encryptedContent.key===void 0)throw new Error("Symmetric key not available.");if(u.content===void 0){var v;switch(u.encryptedContent.algorithm){case t.pki.oids["aes128-CBC"]:case t.pki.oids["aes192-CBC"]:case t.pki.oids["aes256-CBC"]:v=t.aes.createDecryptionCipher(u.encryptedContent.key);break;case t.pki.oids.desCBC:case t.pki.oids["des-EDE3-CBC"]:v=t.des.createDecryptionCipher(u.encryptedContent.key);break;default:throw new Error("Unsupported symmetric cipher, OID "+u.encryptedContent.algorithm)}if(v.start(u.encryptedContent.parameter),v.update(u.encryptedContent.content),!v.finish())throw new Error("Symmetric decryption failed.");u.content=v.output}}return Er.exports}var xr={exports:{}},Aa;function ja(){if(Aa)return xr.exports;Aa=1;var t=ue();ct(),Ct(),Qt(),mt(),ce();var e=xr.exports=t.ssh=t.ssh||{};e.privateKeyToPutty=function(x,l,r){r=r||"",l=l||"";var g="ssh-rsa",f=l===""?"none":"aes256-cbc",S="PuTTY-User-Key-File-2: "+g+`\r
15
- `;S+="Encryption: "+f+`\r
16
- `,S+="Comment: "+r+`\r
17
- `;var R=t.util.createBuffer();d(R,g),a(R,x.e),a(R,x.n);var E=t.util.encode64(R.bytes(),64),u=Math.floor(E.length/66)+1;S+="Public-Lines: "+u+`\r
18
- `,S+=E;var v=t.util.createBuffer();a(v,x.d),a(v,x.p),a(v,x.q),a(v,x.qInv);var C;if(!l)C=t.util.encode64(v.bytes(),64);else{var y=v.length()+16-1;y-=y%16;var i=A(v.bytes());i.truncate(i.length()-y+v.length()),v.putBuffer(i);var h=t.util.createBuffer();h.putBuffer(A("\0\0\0\0",l)),h.putBuffer(A("\0\0\0",l));var p=t.aes.createEncryptionCipher(h.truncate(8),"CBC");p.start(t.util.createBuffer().fillWithByte(0,16)),p.update(v.copy()),p.finish();var I=p.output;I.truncate(16),C=t.util.encode64(I.bytes(),64)}u=Math.floor(C.length/66)+1,S+=`\r
19
- Private-Lines: `+u+`\r
20
- `,S+=C;var L=A("putty-private-key-file-mac-key",l),c=t.util.createBuffer();d(c,g),d(c,f),d(c,r),c.putInt32(R.length()),c.putBuffer(R),c.putInt32(v.length()),c.putBuffer(v);var s=t.hmac.create();return s.start("sha1",L),s.update(c.bytes()),S+=`\r
21
- Private-MAC: `+s.digest().toHex()+`\r
22
- `,S},e.publicKeyToOpenSSH=function(x,l){var r="ssh-rsa";l=l||"";var g=t.util.createBuffer();return d(g,r),a(g,x.e),a(g,x.n),r+" "+t.util.encode64(g.bytes())+" "+l},e.privateKeyToOpenSSH=function(x,l){return l?t.pki.encryptRsaPrivateKey(x,l,{legacy:!0,algorithm:"aes128"}):t.pki.privateKeyToPem(x)},e.getPublicKeyFingerprint=function(x,l){l=l||{};var r=l.md||t.md.md5.create(),g="ssh-rsa",f=t.util.createBuffer();d(f,g),a(f,x.e),a(f,x.n),r.start(),r.update(f.getBytes());var S=r.digest();if(l.encoding==="hex"){var R=S.toHex();return l.delimiter?R.match(/.{2}/g).join(l.delimiter):R}else{if(l.encoding==="binary")return S.getBytes();if(l.encoding)throw new Error('Unknown encoding "'+l.encoding+'".')}return S};function a(x,l){var r=l.toString(16);r[0]>="8"&&(r="00"+r);var g=t.util.hexToBytes(r);x.putInt32(g.length),x.putBytes(g)}function d(x,l){x.putInt32(l.length),x.putString(l)}function A(){for(var x=t.md.sha1.create(),l=arguments.length,r=0;r<l;++r)x.update(arguments[r]);return x.digest()}return xr.exports}var Sr,Ba;function $a(){return Ba||(Ba=1,Sr=ue(),ct(),Ha(),nt(),Pt(),St(),Qa(),Ct(),za(),Ya(),Xa(),sa(),$t(),pt(),$r(),ca(),Wa(),da(),Jr(),Gr(),hr(),Ze(),Yr(),ja(),va(),ce()),Sr}var Et=$a();function Za(t){let e="";for(const a of t)e+=String.fromCharCode(a);return e}function Ja(t){return Uint8Array.from(t,e=>e.charCodeAt(0)&255)}function en(t){return t.replace(/(.{64})/g,`$1
23
- `).trim()}function tn(t){const e=(t!=null?t:"").trim();if(e==="")throw new Error("RSA 私钥为空");if(e.includes("-----BEGIN"))return Et.pki.privateKeyFromPem(e);const a=e.replace(/\s+/g,""),d=[];try{return Et.pki.privateKeyFromAsn1(Et.asn1.fromDer(Et.util.decode64(a)))}catch(x){d.push(x)}const A=en(a);for(const x of["PRIVATE KEY","RSA PRIVATE KEY"])try{return Et.pki.privateKeyFromPem(`-----BEGIN ${x}-----
24
- ${A}
25
- -----END ${x}-----`)}catch(l){d.push(l)}throw new Error(`RSA 私钥解析失败(已试 PKCS1-DER / PKCS8-PEM / PKCS1-PEM):${d[0]instanceof Error?d[0].message:String(d[0])}`)}function*ba(t){const e=tn(t.privateKey),a=Math.ceil(e.n.bitLength()/8),{data:d}=t;if(d.length===0)throw new Error("RSA 解密:密文为空");const A=[];for(let g=0;g<d.length;g+=a){const f=Math.min(g+a,d.length);try{const S=e.decrypt(Za(d.subarray(g,f)),"RSAES-PKCS1-V1_5");A.push(Ja(S)),yield A.length}catch(S){const R=S instanceof Error?S.message:String(S);throw new Error(`RSA-PKCS1 解密失败(密文 ${d.length}B,块 ${g}..${f},keySize ${a}B,私钥 ${e.n.bitLength()}bit):${R}`)}}const x=A.reduce((g,f)=>g+f.length,0),l=new Uint8Array(x);let r=0;for(const g of A)l.set(g,r),r+=g.length;return l}function rn(t){const e=ba(t);let a=e.next();for(;!a.done;)a=e.next();return a.value}const Tr=2654435769,_a=16,vt=8,Ir=16;function an(t){if(t.length<Ir)throw new Error(`TEA key 长度不足:${t.length},需 ≥ ${Ir} 字节`);const e=new DataView(t.buffer,t.byteOffset,Ir);return[e.getUint32(0,!0),e.getUint32(4,!0),e.getUint32(8,!0),e.getUint32(12,!0)]}function Na(t,e,a,d,A=new Uint8Array(t.length)){const x=an(e),r=Math.floor(t.length/vt),g=new DataView(t.buffer,t.byteOffset,t.byteLength),f=new DataView(A.buffer,A.byteOffset,A.byteLength);if(a==="decrypt"){const[R,E,u,v]=x;for(let C=0;C<r*vt;C+=vt){let y=g.getUint32(C,!0),i=g.getUint32(C+4,!0),h=Math.imul(Tr,16)>>>0;for(let p=0;p<_a;p++)i=i-(Math.imul(y,16)+u^y+h^(y>>>5)+v)>>>0,y=y-(Math.imul(i,16)+R^i+h^(i>>>5)+E)>>>0,h=h-Tr>>>0;f.setUint32(C,y,!0),f.setUint32(C+4,i,!0)}}else{const[R,E,u,v]=x;for(let C=0;C<r*vt;C+=vt){let y=g.getUint32(C,!0),i=g.getUint32(C+4,!0),h=0;for(let p=0;p<_a;p++)h=h+Tr>>>0,y=y+(Math.imul(i,16)+R^i+h^(i>>>5)+E)>>>0,i=i+(Math.imul(y,16)+u^y+h^(y>>>5)+v)>>>0;f.setUint32(C,y,!0),f.setUint32(C+4,i,!0)}}const S=r*vt;return S<t.length&&A.set(t.subarray(S),S),A}function Ra(t,e){return Na(e,t,"decrypt")}function nn(t,e){return Na(e,t,"encrypt")}function*sn(t,e){const a=[];for(const d of e){let A;try{if(A=rn({data:new Uint8Array(d.secretKey),privateKey:t[d.keyIndex]}),A.length<16)throw new Error("RSA secret key is too short")}catch(x){a.push({itemIndex:d.itemIndex,result:{ok:!1,stage:"rsa"}}),yield a.length;continue}try{const x=Ra(A,new Uint8Array(d.cipherData));a.push({itemIndex:d.itemIndex,result:{ok:!0,plain:x.buffer}})}catch(x){a.push({itemIndex:d.itemIndex,result:{ok:!1,stage:"tea"}})}yield a.length}return a}function*on(t,e,a){return(t==="encrypt-tea"?nn:Ra)(new Uint8Array(e),new Uint8Array(a))}function un(t){const e=[];let a,d=!1,A,x=0;function l(R,E){t.postMessage(Pa(Ua({},R),{version:1,generation:a!=null?a:0}),E)}function r(){d=!0,A==null||A(),A=void 0;for(const R of e.splice(0))R.blocks.return(new Uint8Array)}function g(){r(),l({kind:"protocol-error",operationId:""})}function f(){var R,E;!d&&A===void 0&&e.length>0&&(A=(E=(R=t.scheduleTask)==null?void 0:R.call(t,S))!=null?E:(()=>{const u=setTimeout(S,0);return()=>clearTimeout(u)})())}function S(){if(A=void 0,d||e.length===0)return;const R=e.findIndex(y=>y.priority==="foreground"),E=e.findIndex(y=>y.priority==="background"),u=R>=0&&(x<4||E<0)?R:E,v=e.splice(u,1)[0];x=v.priority==="foreground"?x+1:0;let C;try{C=v.blocks.next()}catch(y){v.blocks.return(new Uint8Array),l({kind:"crypto-error",operationId:v.operationId}),f();return}if(C.done)if(v.kind!=="decrypt-batch"){const y=C.value.buffer;t.postMessage({version:1,generation:a,operationId:v.operationId,kind:"result",data:y},[y])}else{const y=C.value,i=y.flatMap(h=>h.result.ok?[h.result.plain]:[]);t.postMessage({version:1,generation:a,operationId:v.operationId,kind:"batch-result",items:y},i)}else e.push(v),t.postMessage({version:1,generation:a,operationId:v.operationId,kind:"progress",completed:C.value});f()}return{receive(R){if(d)return;if(!Oa(R))return g();if(R.kind==="init"){if(a!==void 0)return g();a=R.generation,l({kind:"ready",operationId:""});return}if(a===void 0||a!==R.generation)return g();const E=e.findIndex(u=>u.operationId===R.operationId);if(R.kind==="cancel")E>=0&&e.splice(E,1)[0].blocks.return(new Uint8Array),l({kind:"cancelled",operationId:R.operationId});else if(R.kind==="promote")E>=0&&(e[E].priority="foreground");else{if(E>=0||e.length>=16)return g();e.push({operationId:R.operationId,priority:R.priority,kind:R.kind,blocks:R.kind==="decrypt-rsa"?ba({data:new Uint8Array(R.data),privateKey:R.privateKey}):R.kind==="decrypt-tea"||R.kind==="encrypt-tea"?on(R.kind,R.teaKey,R.kind==="encrypt-tea"?R.plain:R.cipherData):sn(R.keys,R.items)}),f()}},dispose:r}}const wa=globalThis,La=new MessageChannel;let _t;La.port1.onmessage=()=>{const t=_t;_t=void 0,t==null||t()};const fn=un({postMessage:(t,e)=>wa.postMessage(t,e),scheduleTask(t){return _t=t,La.port2.postMessage(null),()=>{_t=void 0}}});wa.onmessage=t=>fn.receive(t.data)})();
1
+ var Ya=Object.defineProperty,$a=Object.defineProperties;var ja=Object.getOwnPropertyDescriptors;var ar=Object.getOwnPropertySymbols;var Za=Object.prototype.hasOwnProperty,Ja=Object.prototype.propertyIsEnumerable;var ir=(ue,J,ae)=>J in ue?Ya(ue,J,{enumerable:!0,configurable:!0,writable:!0,value:ae}):ue[J]=ae,nr=(ue,J)=>{for(var ae in J||(J={}))Za.call(J,ae)&&ir(ue,ae,J[ae]);if(ar)for(var ae of ar(J))Ja.call(J,ae)&&ir(ue,ae,J[ae]);return ue},sr=(ue,J)=>$a(ue,ja(J));(function(){"use strict";function or(i){if(i===null||typeof i!="object")return!1;const e=i;return e.version===1&&Number.isSafeInteger(e.generation)&&e.generation>=0&&typeof e.operationId=="string"&&e.operationId.length<=256}function ur(i){if(!or(i))return!1;if(i.kind==="init")return i.operationId==="";if(i.operationId==="")return!1;if(i.kind==="cancel"||i.kind==="promote")return!0;if(i.kind==="decrypt-tea"||i.kind==="encrypt-tea"){const e=i.kind==="encrypt-tea"?i.plain:i.cipherData;return i.teaKey instanceof ArrayBuffer&&i.teaKey.byteLength===16&&e instanceof ArrayBuffer&&e.byteLength<=262144&&(i.priority==="foreground"||i.priority==="background")}if(i.kind==="decrypt-batch"){if(!((i.priority==="foreground"||i.priority==="background")&&Array.isArray(i.keys)&&i.keys.every(g=>typeof g=="string")&&Array.isArray(i.items)&&i.items.length>0&&i.items.length<=8&&i.keys.length<=i.items.length&&i.items.every(g=>g!==null&&typeof g=="object"&&Number.isSafeInteger(g.itemIndex)&&g.itemIndex>=0&&Number.isSafeInteger(g.keyIndex)&&g.keyIndex>=0&&g.keyIndex<i.keys.length&&g.secretKey instanceof ArrayBuffer&&g.cipherData instanceof ArrayBuffer)))return!1;const{keys:t,items:u}=i,I=t.reduce((g,s)=>g+s.length*2,0)+u.reduce((g,s)=>g+s.secretKey.byteLength+s.cipherData.byteLength,0);return new Set(t).size===t.length&&new Set(u.map(g=>g.itemIndex)).size===u.length&&new Set(u.map(g=>g.keyIndex)).size===t.length&&(u.length===1||I<=262144)}return i.kind==="decrypt-rsa"&&i.data instanceof ArrayBuffer&&typeof i.privateKey=="string"&&(i.priority==="foreground"||i.priority==="background")}var fr=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function Ie(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}function lr(i){if(Object.prototype.hasOwnProperty.call(i,"__esModule"))return i;var e=i.default;if(typeof e=="function"){var t=function u(){var I=!1;try{I=this instanceof u}catch(g){}return I?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(i).forEach(function(u){var I=Object.getOwnPropertyDescriptor(i,u);Object.defineProperty(t,u,I.get?I:{enumerable:!0,get:function(){return i[u]}})}),t}var Ae={exports:{}},Be,ot;function H(){return ot||(ot=1,Be={options:{usePureJavaScript:!1}}),Be}var be={exports:{}},Ne,ut;function cr(){if(ut)return Ne;ut=1;var i={};Ne=i;var e={};i.encode=function(u,I,g){if(typeof I!="string")throw new TypeError('"alphabet" must be a string.');if(g!==void 0&&typeof g!="number")throw new TypeError('"maxline" must be a number.');var s="";if(!(u instanceof Uint8Array))s=t(u,I);else{var o=0,d=I.length,c=I.charAt(0),T=[0];for(o=0;o<u.length;++o){for(var R=0,x=u[o];R<T.length;++R)x+=T[R]<<8,T[R]=x%d,x=x/d|0;for(;x>0;)T.push(x%d),x=x/d|0}for(o=0;u[o]===0&&o<u.length-1;++o)s+=c;for(o=T.length-1;o>=0;--o)s+=I[T[o]]}if(g){var y=new RegExp(".{1,"+g+"}","g");s=s.match(y).join(`\r
2
+ `)}return s},i.decode=function(u,I){if(typeof u!="string")throw new TypeError('"input" must be a string.');if(typeof I!="string")throw new TypeError('"alphabet" must be a string.');var g=e[I];if(!g){g=e[I]=[];for(var s=0;s<I.length;++s)g[I.charCodeAt(s)]=s}u=u.replace(/\s/g,"");for(var o=I.length,d=I.charAt(0),c=[0],s=0;s<u.length;s++){var T=g[u.charCodeAt(s)];if(T===void 0)return;for(var R=0,x=T;R<c.length;++R)x+=c[R]*o,c[R]=x&255,x>>=8;for(;x>0;)c.push(x&255),x>>=8}for(var y=0;u[y]===d&&y<u.length-1;++y)c.push(0);return typeof Buffer!="undefined"?Buffer.from(c.reverse()):new Uint8Array(c.reverse())};function t(u,I){var g=0,s=I.length,o=I.charAt(0),d=[0];for(g=0;g<u.length();++g){for(var c=0,T=u.at(g);c<d.length;++c)T+=d[c]<<8,d[c]=T%s,T=T/s|0;for(;T>0;)d.push(T%s),T=T/s|0}var R="";for(g=0;u.at(g)===0&&g<u.length()-1;++g)R+=o;for(g=d.length-1;g>=0;--g)R+=I[d[g]];return R}return Ne}var ft;function X(){if(ft)return be.exports;ft=1;var i=H(),e=cr(),t=be.exports=i.util=i.util||{};(function(){if(typeof process!="undefined"&&process.nextTick&&!process.browser){t.nextTick=process.nextTick,typeof setImmediate=="function"?t.setImmediate=setImmediate:t.setImmediate=t.nextTick;return}if(typeof setImmediate=="function"){t.setImmediate=function(){return setImmediate.apply(void 0,arguments)},t.nextTick=function(r){return setImmediate(r)};return}if(t.setImmediate=function(r){setTimeout(r,0)},typeof window!="undefined"&&typeof window.postMessage=="function"){let r=function(f){if(f.source===window&&f.data===a){f.stopPropagation();var S=l.slice();l.length=0,S.forEach(function(w){w()})}};var a="forge.setImmediate",l=[];t.setImmediate=function(f){l.push(f),l.length===1&&window.postMessage(a,"*")},window.addEventListener("message",r,!0)}if(typeof MutationObserver!="undefined"){var h=Date.now(),A=!0,b=document.createElement("div"),l=[];new MutationObserver(function(){var f=l.slice();l.length=0,f.forEach(function(S){S()})}).observe(b,{attributes:!0});var n=t.setImmediate;t.setImmediate=function(f){Date.now()-h>15?(h=Date.now(),n(f)):(l.push(f),l.length===1&&b.setAttribute("a",A=!A))}}t.nextTick=t.setImmediate})(),t.isNodejs=typeof process!="undefined"&&process.versions&&process.versions.node,t.globalScope=(function(){return t.isNodejs?fr:typeof self=="undefined"?window:self})(),t.isArray=Array.isArray||function(a){return Object.prototype.toString.call(a)==="[object Array]"},t.isArrayBuffer=function(a){return typeof ArrayBuffer!="undefined"&&a instanceof ArrayBuffer},t.isArrayBufferView=function(a){return a&&t.isArrayBuffer(a.buffer)&&a.byteLength!==void 0};function u(a){if(!(a===8||a===16||a===24||a===32))throw new Error("Only 8, 16, 24, or 32 bits supported: "+a)}t.ByteBuffer=I;function I(a){if(this.data="",this.read=0,typeof a=="string")this.data=a;else if(t.isArrayBuffer(a)||t.isArrayBufferView(a))if(typeof Buffer!="undefined"&&a instanceof Buffer)this.data=a.toString("binary");else{var l=new Uint8Array(a);try{this.data=String.fromCharCode.apply(null,l)}catch(A){for(var h=0;h<l.length;++h)this.putByte(l[h])}}else(a instanceof I||typeof a=="object"&&typeof a.data=="string"&&typeof a.read=="number")&&(this.data=a.data,this.read=a.read);this._constructedStringLength=0}t.ByteStringBuffer=I;var g=4096;t.ByteStringBuffer.prototype._optimizeConstructedString=function(a){this._constructedStringLength+=a,this._constructedStringLength>g&&(this.data.substr(0,1),this._constructedStringLength=0)},t.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},t.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},t.ByteStringBuffer.prototype.putByte=function(a){return this.putBytes(String.fromCharCode(a))},t.ByteStringBuffer.prototype.fillWithByte=function(a,l){a=String.fromCharCode(a);for(var h=this.data;l>0;)l&1&&(h+=a),l>>>=1,l>0&&(a+=a);return this.data=h,this._optimizeConstructedString(l),this},t.ByteStringBuffer.prototype.putBytes=function(a){return this.data+=a,this._optimizeConstructedString(a.length),this},t.ByteStringBuffer.prototype.putString=function(a){return this.putBytes(t.encodeUtf8(a))},t.ByteStringBuffer.prototype.putInt16=function(a){return this.putBytes(String.fromCharCode(a>>8&255)+String.fromCharCode(a&255))},t.ByteStringBuffer.prototype.putInt24=function(a){return this.putBytes(String.fromCharCode(a>>16&255)+String.fromCharCode(a>>8&255)+String.fromCharCode(a&255))},t.ByteStringBuffer.prototype.putInt32=function(a){return this.putBytes(String.fromCharCode(a>>24&255)+String.fromCharCode(a>>16&255)+String.fromCharCode(a>>8&255)+String.fromCharCode(a&255))},t.ByteStringBuffer.prototype.putInt16Le=function(a){return this.putBytes(String.fromCharCode(a&255)+String.fromCharCode(a>>8&255))},t.ByteStringBuffer.prototype.putInt24Le=function(a){return this.putBytes(String.fromCharCode(a&255)+String.fromCharCode(a>>8&255)+String.fromCharCode(a>>16&255))},t.ByteStringBuffer.prototype.putInt32Le=function(a){return this.putBytes(String.fromCharCode(a&255)+String.fromCharCode(a>>8&255)+String.fromCharCode(a>>16&255)+String.fromCharCode(a>>24&255))},t.ByteStringBuffer.prototype.putInt=function(a,l){u(l);var h="";do l-=8,h+=String.fromCharCode(a>>l&255);while(l>0);return this.putBytes(h)},t.ByteStringBuffer.prototype.putSignedInt=function(a,l){return a<0&&(a+=2<<l-1),this.putInt(a,l)},t.ByteStringBuffer.prototype.putBuffer=function(a){return this.putBytes(a.getBytes())},t.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)},t.ByteStringBuffer.prototype.getInt16=function(){var a=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,a},t.ByteStringBuffer.prototype.getInt24=function(){var a=this.data.charCodeAt(this.read)<<16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);return this.read+=3,a},t.ByteStringBuffer.prototype.getInt32=function(){var a=this.data.charCodeAt(this.read)<<24^this.data.charCodeAt(this.read+1)<<16^this.data.charCodeAt(this.read+2)<<8^this.data.charCodeAt(this.read+3);return this.read+=4,a},t.ByteStringBuffer.prototype.getInt16Le=function(){var a=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,a},t.ByteStringBuffer.prototype.getInt24Le=function(){var a=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;return this.read+=3,a},t.ByteStringBuffer.prototype.getInt32Le=function(){var a=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16^this.data.charCodeAt(this.read+3)<<24;return this.read+=4,a},t.ByteStringBuffer.prototype.getInt=function(a){u(a);var l=0;do l=(l<<8)+this.data.charCodeAt(this.read++),a-=8;while(a>0);return l},t.ByteStringBuffer.prototype.getSignedInt=function(a){var l=this.getInt(a),h=2<<a-2;return l>=h&&(l-=h<<1),l},t.ByteStringBuffer.prototype.getBytes=function(a){var l;return a?(a=Math.min(this.length(),a),l=this.data.slice(this.read,this.read+a),this.read+=a):a===0?l="":(l=this.read===0?this.data:this.data.slice(this.read),this.clear()),l},t.ByteStringBuffer.prototype.bytes=function(a){return typeof a=="undefined"?this.data.slice(this.read):this.data.slice(this.read,this.read+a)},t.ByteStringBuffer.prototype.at=function(a){return this.data.charCodeAt(this.read+a)},t.ByteStringBuffer.prototype.setAt=function(a,l){return this.data=this.data.substr(0,this.read+a)+String.fromCharCode(l)+this.data.substr(this.read+a+1),this},t.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},t.ByteStringBuffer.prototype.copy=function(){var a=t.createBuffer(this.data);return a.read=this.read,a},t.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},t.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},t.ByteStringBuffer.prototype.truncate=function(a){var l=Math.max(0,this.length()-a);return this.data=this.data.substr(this.read,l),this.read=0,this},t.ByteStringBuffer.prototype.toHex=function(){for(var a="",l=this.read;l<this.data.length;++l){var h=this.data.charCodeAt(l);h<16&&(a+="0"),a+=h.toString(16)}return a},t.ByteStringBuffer.prototype.toString=function(){return t.decodeUtf8(this.bytes())};function s(a,l){l=l||{},this.read=l.readOffset||0,this.growSize=l.growSize||1024;var h=t.isArrayBuffer(a),A=t.isArrayBufferView(a);if(h||A){h?this.data=new DataView(a):this.data=new DataView(a.buffer,a.byteOffset,a.byteLength),this.write="writeOffset"in l?l.writeOffset:this.data.byteLength;return}this.data=new DataView(new ArrayBuffer(0)),this.write=0,a!=null&&this.putBytes(a),"writeOffset"in l&&(this.write=l.writeOffset)}t.DataBuffer=s,t.DataBuffer.prototype.length=function(){return this.write-this.read},t.DataBuffer.prototype.isEmpty=function(){return this.length()<=0},t.DataBuffer.prototype.accommodate=function(a,l){if(this.length()>=a)return this;l=Math.max(l||this.growSize,a);var h=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),A=new Uint8Array(this.length()+l);return A.set(h),this.data=new DataView(A.buffer),this},t.DataBuffer.prototype.putByte=function(a){return this.accommodate(1),this.data.setUint8(this.write++,a),this},t.DataBuffer.prototype.fillWithByte=function(a,l){this.accommodate(l);for(var h=0;h<l;++h)this.data.setUint8(a);return this},t.DataBuffer.prototype.putBytes=function(a,l){if(t.isArrayBufferView(a)){var h=new Uint8Array(a.buffer,a.byteOffset,a.byteLength),A=h.byteLength-h.byteOffset;this.accommodate(A);var b=new Uint8Array(this.data.buffer,this.write);return b.set(h),this.write+=A,this}if(t.isArrayBuffer(a)){var h=new Uint8Array(a);this.accommodate(h.byteLength);var b=new Uint8Array(this.data.buffer);return b.set(h,this.write),this.write+=h.byteLength,this}if(a instanceof t.DataBuffer||typeof a=="object"&&typeof a.read=="number"&&typeof a.write=="number"&&t.isArrayBufferView(a.data)){var h=new Uint8Array(a.data.byteLength,a.read,a.length());this.accommodate(h.byteLength);var b=new Uint8Array(a.data.byteLength,this.write);return b.set(h),this.write+=h.byteLength,this}if(a instanceof t.ByteStringBuffer&&(a=a.data,l="binary"),l=l||"binary",typeof a=="string"){var n;if(l==="hex")return this.accommodate(Math.ceil(a.length/2)),n=new Uint8Array(this.data.buffer,this.write),this.write+=t.binary.hex.decode(a,n,this.write),this;if(l==="base64")return this.accommodate(Math.ceil(a.length/4)*3),n=new Uint8Array(this.data.buffer,this.write),this.write+=t.binary.base64.decode(a,n,this.write),this;if(l==="utf8"&&(a=t.encodeUtf8(a),l="binary"),l==="binary"||l==="raw")return this.accommodate(a.length),n=new Uint8Array(this.data.buffer,this.write),this.write+=t.binary.raw.decode(n),this;if(l==="utf16")return this.accommodate(a.length*2),n=new Uint16Array(this.data.buffer,this.write),this.write+=t.text.utf16.encode(n),this;throw new Error("Invalid encoding: "+l)}throw Error("Invalid parameter: "+a)},t.DataBuffer.prototype.putBuffer=function(a){return this.putBytes(a),a.clear(),this},t.DataBuffer.prototype.putString=function(a){return this.putBytes(a,"utf16")},t.DataBuffer.prototype.putInt16=function(a){return this.accommodate(2),this.data.setInt16(this.write,a),this.write+=2,this},t.DataBuffer.prototype.putInt24=function(a){return this.accommodate(3),this.data.setInt16(this.write,a>>8&65535),this.data.setInt8(this.write,a>>16&255),this.write+=3,this},t.DataBuffer.prototype.putInt32=function(a){return this.accommodate(4),this.data.setInt32(this.write,a),this.write+=4,this},t.DataBuffer.prototype.putInt16Le=function(a){return this.accommodate(2),this.data.setInt16(this.write,a,!0),this.write+=2,this},t.DataBuffer.prototype.putInt24Le=function(a){return this.accommodate(3),this.data.setInt8(this.write,a>>16&255),this.data.setInt16(this.write,a>>8&65535,!0),this.write+=3,this},t.DataBuffer.prototype.putInt32Le=function(a){return this.accommodate(4),this.data.setInt32(this.write,a,!0),this.write+=4,this},t.DataBuffer.prototype.putInt=function(a,l){u(l),this.accommodate(l/8);do l-=8,this.data.setInt8(this.write++,a>>l&255);while(l>0);return this},t.DataBuffer.prototype.putSignedInt=function(a,l){return u(l),this.accommodate(l/8),a<0&&(a+=2<<l-1),this.putInt(a,l)},t.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)},t.DataBuffer.prototype.getInt16=function(){var a=this.data.getInt16(this.read);return this.read+=2,a},t.DataBuffer.prototype.getInt24=function(){var a=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,a},t.DataBuffer.prototype.getInt32=function(){var a=this.data.getInt32(this.read);return this.read+=4,a},t.DataBuffer.prototype.getInt16Le=function(){var a=this.data.getInt16(this.read,!0);return this.read+=2,a},t.DataBuffer.prototype.getInt24Le=function(){var a=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,a},t.DataBuffer.prototype.getInt32Le=function(){var a=this.data.getInt32(this.read,!0);return this.read+=4,a},t.DataBuffer.prototype.getInt=function(a){u(a);var l=0;do l=(l<<8)+this.data.getInt8(this.read++),a-=8;while(a>0);return l},t.DataBuffer.prototype.getSignedInt=function(a){var l=this.getInt(a),h=2<<a-2;return l>=h&&(l-=h<<1),l},t.DataBuffer.prototype.getBytes=function(a){var l;return a?(a=Math.min(this.length(),a),l=this.data.slice(this.read,this.read+a),this.read+=a):a===0?l="":(l=this.read===0?this.data:this.data.slice(this.read),this.clear()),l},t.DataBuffer.prototype.bytes=function(a){return typeof a=="undefined"?this.data.slice(this.read):this.data.slice(this.read,this.read+a)},t.DataBuffer.prototype.at=function(a){return this.data.getUint8(this.read+a)},t.DataBuffer.prototype.setAt=function(a,l){return this.data.setUint8(a,l),this},t.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},t.DataBuffer.prototype.copy=function(){return new t.DataBuffer(this)},t.DataBuffer.prototype.compact=function(){if(this.read>0){var a=new Uint8Array(this.data.buffer,this.read),l=new Uint8Array(a.byteLength);l.set(a),this.data=new DataView(l),this.write-=this.read,this.read=0}return this},t.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},t.DataBuffer.prototype.truncate=function(a){return this.write=Math.max(0,this.length()-a),this.read=Math.min(this.read,this.write),this},t.DataBuffer.prototype.toHex=function(){for(var a="",l=this.read;l<this.data.byteLength;++l){var h=this.data.getUint8(l);h<16&&(a+="0"),a+=h.toString(16)}return a},t.DataBuffer.prototype.toString=function(a){var l=new Uint8Array(this.data,this.read,this.length());if(a=a||"utf8",a==="binary"||a==="raw")return t.binary.raw.encode(l);if(a==="hex")return t.binary.hex.encode(l);if(a==="base64")return t.binary.base64.encode(l);if(a==="utf8")return t.text.utf8.decode(l);if(a==="utf16")return t.text.utf16.decode(l);throw new Error("Invalid encoding: "+a)},t.createBuffer=function(a,l){return l=l||"raw",a!==void 0&&l==="utf8"&&(a=t.encodeUtf8(a)),new t.ByteBuffer(a)},t.fillString=function(a,l){for(var h="";l>0;)l&1&&(h+=a),l>>>=1,l>0&&(a+=a);return h},t.xorBytes=function(a,l,h){for(var A="",b="",n="",r=0,f=0;h>0;--h,++r)b=a.charCodeAt(r)^l.charCodeAt(r),f>=10&&(A+=n,n="",f=0),n+=String.fromCharCode(b),++f;return A+=n,A},t.hexToBytes=function(a){var l="",h=0;for(a.length&!0&&(h=1,l+=String.fromCharCode(parseInt(a[0],16)));h<a.length;h+=2)l+=String.fromCharCode(parseInt(a.substr(h,2),16));return l},t.bytesToHex=function(a){return t.createBuffer(a).toHex()},t.int32ToBytes=function(a){return String.fromCharCode(a>>24&255)+String.fromCharCode(a>>16&255)+String.fromCharCode(a>>8&255)+String.fromCharCode(a&255)};var o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",d=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],c="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";t.encode64=function(a,l){for(var h="",A="",b,n,r,f=0;f<a.length;)b=a.charCodeAt(f++),n=a.charCodeAt(f++),r=a.charCodeAt(f++),h+=o.charAt(b>>2),h+=o.charAt((b&3)<<4|n>>4),isNaN(n)?h+="==":(h+=o.charAt((n&15)<<2|r>>6),h+=isNaN(r)?"=":o.charAt(r&63)),l&&h.length>l&&(A+=h.substr(0,l)+`\r
3
+ `,h=h.substr(l));return A+=h,A},t.decode64=function(a){a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var l="",h,A,b,n,r=0;r<a.length;)h=d[a.charCodeAt(r++)-43],A=d[a.charCodeAt(r++)-43],b=d[a.charCodeAt(r++)-43],n=d[a.charCodeAt(r++)-43],l+=String.fromCharCode(h<<2|A>>4),b!==64&&(l+=String.fromCharCode((A&15)<<4|b>>2),n!==64&&(l+=String.fromCharCode((b&3)<<6|n)));return l},t.encodeUtf8=function(a){return unescape(encodeURIComponent(a))},t.decodeUtf8=function(a){return decodeURIComponent(escape(a))},t.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:e.encode,decode:e.decode}},t.binary.raw.encode=function(a){return String.fromCharCode.apply(null,a)},t.binary.raw.decode=function(a,l,h){var A=l;A||(A=new Uint8Array(a.length)),h=h||0;for(var b=h,n=0;n<a.length;++n)A[b++]=a.charCodeAt(n);return l?b-h:A},t.binary.hex.encode=t.bytesToHex,t.binary.hex.decode=function(a,l,h){var A=l;A||(A=new Uint8Array(Math.ceil(a.length/2))),h=h||0;var b=0,n=h;for(a.length&1&&(b=1,A[n++]=parseInt(a[0],16));b<a.length;b+=2)A[n++]=parseInt(a.substr(b,2),16);return l?n-h:A},t.binary.base64.encode=function(a,l){for(var h="",A="",b,n,r,f=0;f<a.byteLength;)b=a[f++],n=a[f++],r=a[f++],h+=o.charAt(b>>2),h+=o.charAt((b&3)<<4|n>>4),isNaN(n)?h+="==":(h+=o.charAt((n&15)<<2|r>>6),h+=isNaN(r)?"=":o.charAt(r&63)),l&&h.length>l&&(A+=h.substr(0,l)+`\r
4
+ `,h=h.substr(l));return A+=h,A},t.binary.base64.decode=function(a,l,h){var A=l;A||(A=new Uint8Array(Math.ceil(a.length/4)*3)),a=a.replace(/[^A-Za-z0-9\+\/\=]/g,""),h=h||0;for(var b,n,r,f,S=0,w=h;S<a.length;)b=d[a.charCodeAt(S++)-43],n=d[a.charCodeAt(S++)-43],r=d[a.charCodeAt(S++)-43],f=d[a.charCodeAt(S++)-43],A[w++]=b<<2|n>>4,r!==64&&(A[w++]=(n&15)<<4|r>>2,f!==64&&(A[w++]=(r&3)<<6|f));return l?w-h:A.subarray(0,w)},t.binary.base58.encode=function(a,l){return t.binary.baseN.encode(a,c,l)},t.binary.base58.decode=function(a,l){return t.binary.baseN.decode(a,c,l)},t.text={utf8:{},utf16:{}},t.text.utf8.encode=function(a,l,h){a=t.encodeUtf8(a);var A=l;A||(A=new Uint8Array(a.length)),h=h||0;for(var b=h,n=0;n<a.length;++n)A[b++]=a.charCodeAt(n);return l?b-h:A},t.text.utf8.decode=function(a){return t.decodeUtf8(String.fromCharCode.apply(null,a))},t.text.utf16.encode=function(a,l,h){var A=l;A||(A=new Uint8Array(a.length*2));var b=new Uint16Array(A.buffer);h=h||0;for(var n=h,r=h,f=0;f<a.length;++f)b[r++]=a.charCodeAt(f),n+=2;return l?n-h:A},t.text.utf16.decode=function(a){return String.fromCharCode.apply(null,new Uint16Array(a.buffer))},t.deflate=function(a,l,h){if(l=t.decode64(a.deflate(t.encode64(l)).rval),h){var A=2,b=l.charCodeAt(1);b&32&&(A=6),l=l.substring(A,l.length-4)}return l},t.inflate=function(a,l,h){var A=a.inflate(t.encode64(l)).rval;return A===null?null:t.decode64(A)};var T=function(a,l,h){if(!a)throw new Error("WebStorage not available.");var A;if(h===null?A=a.removeItem(l):(h=t.encode64(JSON.stringify(h)),A=a.setItem(l,h)),typeof A!="undefined"&&A.rval!==!0){var b=new Error(A.error.message);throw b.id=A.error.id,b.name=A.error.name,b}},R=function(a,l){if(!a)throw new Error("WebStorage not available.");var h=a.getItem(l);if(a.init)if(h.rval===null){if(h.error){var A=new Error(h.error.message);throw A.id=h.error.id,A.name=h.error.name,A}h=null}else h=h.rval;return h!==null&&(h=JSON.parse(t.decode64(h))),h},x=function(a,l,h,A){var b=R(a,l);b===null&&(b={}),b[h]=A,T(a,l,b)},y=function(a,l,h){var A=R(a,l);return A!==null&&(A=h in A?A[h]:null),A},E=function(a,l,h){var A=R(a,l);if(A!==null&&h in A){delete A[h];var b=!0;for(var n in A){b=!1;break}b&&(A=null),T(a,l,A)}},v=function(a,l){T(a,l,null)},m=function(a,l,h){var A=null;typeof h=="undefined"&&(h=["web","flash"]);var b,n=!1,r=null;for(var f in h){b=h[f];try{if(b==="flash"||b==="both"){if(l[0]===null)throw new Error("Flash local storage not available.");A=a.apply(this,l),n=b==="flash"}(b==="web"||b==="both")&&(l[0]=localStorage,A=a.apply(this,l),n=!0)}catch(S){r=S}if(n)break}if(!n)throw r;return A};return t.setItem=function(a,l,h,A,b){m(x,arguments,b)},t.getItem=function(a,l,h,A){return m(y,arguments,A)},t.removeItem=function(a,l,h,A){m(E,arguments,A)},t.clearItems=function(a,l,h){m(v,arguments,h)},t.isEmpty=function(a){for(var l in a)if(a.hasOwnProperty(l))return!1;return!0},t.format=function(a){for(var l=/%./g,h,A,b=0,n=[],r=0;h=l.exec(a);){A=a.substring(r,l.lastIndex-2),A.length>0&&n.push(A),r=l.lastIndex;var f=h[0][1];switch(f){case"s":case"o":b<arguments.length?n.push(arguments[b+++1]):n.push("<?>");break;case"%":n.push("%");break;default:n.push("<%"+f+"?>")}}return n.push(a.substring(r)),n.join("")},t.formatNumber=function(a,l,h,A){var b=a,n=isNaN(l=Math.abs(l))?2:l,r=h===void 0?",":h,f=A===void 0?".":A,S=b<0?"-":"",w=parseInt(b=Math.abs(+b||0).toFixed(n),10)+"",U=w.length>3?w.length%3:0;return S+(U?w.substr(0,U)+f:"")+w.substr(U).replace(/(\d{3})(?=\d)/g,"$1"+f)+(n?r+Math.abs(b-w).toFixed(n).slice(2):"")},t.formatSize=function(a){return a>=1073741824?a=t.formatNumber(a/1073741824,2,".","")+" GiB":a>=1048576?a=t.formatNumber(a/1048576,2,".","")+" MiB":a>=1024?a=t.formatNumber(a/1024,0)+" KiB":a=t.formatNumber(a,0)+" bytes",a},t.bytesFromIP=function(a){return a.indexOf(".")!==-1?t.bytesFromIPv4(a):a.indexOf(":")!==-1?t.bytesFromIPv6(a):null},t.bytesFromIPv4=function(a){if(a=a.split("."),a.length!==4)return null;for(var l=t.createBuffer(),h=0;h<a.length;++h){var A=parseInt(a[h],10);if(isNaN(A))return null;l.putByte(A)}return l.getBytes()},t.bytesFromIPv6=function(a){var l=0;a=a.split(":").filter(function(r){return r.length===0&&++l,!0});for(var h=(8-a.length+l)*2,A=t.createBuffer(),b=0;b<8;++b){if(!a[b]||a[b].length===0){A.fillWithByte(0,h),h=0;continue}var n=t.hexToBytes(a[b]);n.length<2&&A.putByte(0),A.putBytes(n)}return A.getBytes()},t.bytesToIP=function(a){return a.length===4?t.bytesToIPv4(a):a.length===16?t.bytesToIPv6(a):null},t.bytesToIPv4=function(a){if(a.length!==4)return null;for(var l=[],h=0;h<a.length;++h)l.push(a.charCodeAt(h));return l.join(".")},t.bytesToIPv6=function(a){if(a.length!==16)return null;for(var l=[],h=[],A=0,b=0;b<a.length;b+=2){for(var n=t.bytesToHex(a[b]+a[b+1]);n[0]==="0"&&n!=="0";)n=n.substr(1);if(n==="0"){var r=h[h.length-1],f=l.length;!r||f!==r.end+1?h.push({start:f,end:f}):(r.end=f,r.end-r.start>h[A].end-h[A].start&&(A=h.length-1))}l.push(n)}if(h.length>0){var S=h[A];S.end-S.start>0&&(l.splice(S.start,S.end-S.start+1,""),S.start===0&&l.unshift(""),S.end===7&&l.push(""))}return l.join(":")},t.estimateCores=function(a,l){if(typeof a=="function"&&(l=a,a={}),a=a||{},"cores"in t&&!a.update)return l(null,t.cores);if(typeof navigator!="undefined"&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return t.cores=navigator.hardwareConcurrency,l(null,t.cores);if(typeof Worker=="undefined")return t.cores=1,l(null,t.cores);if(typeof Blob=="undefined")return t.cores=2,l(null,t.cores);var h=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(r){var f=Date.now(),S=f+4;self.postMessage({st:f,et:S})})}.toString(),")()"],{type:"application/javascript"}));A([],5,16);function A(r,f,S){if(f===0){var w=Math.floor(r.reduce(function(U,N){return U+N},0)/r.length);return t.cores=Math.max(1,w),URL.revokeObjectURL(h),l(null,t.cores)}b(S,function(U,N){r.push(n(S,N)),A(r,f-1,S)})}function b(r,f){for(var S=[],w=[],U=0;U<r;++U){var N=new Worker(h);N.addEventListener("message",function(L){if(w.push(L.data),w.length===r){for(var P=0;P<r;++P)S[P].terminate();f(null,w)}}),S.push(N)}for(var U=0;U<r;++U)S[U].postMessage(U)}function n(r,f){for(var S=[],w=0;w<r;++w)for(var U=f[w],N=S[w]=[],L=0;L<r;++L)if(w!==L){var P=f[L];(U.st>P.st&&U.st<P.et||P.st>U.st&&P.st<U.et)&&N.push(L)}return S.reduce(function(_,k){return Math.max(_,k.length)},0)}},be.exports}var Re={exports:{}},lt;function he(){if(lt)return Re.exports;lt=1;var i=H();i.pki=i.pki||{};var e=Re.exports=i.pki.oids=i.oids=i.oids||{};function t(I,g){e[I]=g,e[g]=I}function u(I,g){e[I]=g}return t("1.2.840.113549.1.1.1","rsaEncryption"),t("1.2.840.113549.1.1.4","md5WithRSAEncryption"),t("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),t("1.2.840.113549.1.1.7","RSAES-OAEP"),t("1.2.840.113549.1.1.8","mgf1"),t("1.2.840.113549.1.1.9","pSpecified"),t("1.2.840.113549.1.1.10","RSASSA-PSS"),t("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),t("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),t("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),t("1.3.101.112","EdDSA25519"),t("1.2.840.10040.4.3","dsa-with-sha1"),t("1.3.14.3.2.7","desCBC"),t("1.3.14.3.2.26","sha1"),t("1.3.14.3.2.29","sha1WithRSASignature"),t("2.16.840.1.101.3.4.2.1","sha256"),t("2.16.840.1.101.3.4.2.2","sha384"),t("2.16.840.1.101.3.4.2.3","sha512"),t("2.16.840.1.101.3.4.2.4","sha224"),t("2.16.840.1.101.3.4.2.5","sha512-224"),t("2.16.840.1.101.3.4.2.6","sha512-256"),t("1.2.840.113549.2.2","md2"),t("1.2.840.113549.2.5","md5"),t("1.2.840.113549.1.7.1","data"),t("1.2.840.113549.1.7.2","signedData"),t("1.2.840.113549.1.7.3","envelopedData"),t("1.2.840.113549.1.7.4","signedAndEnvelopedData"),t("1.2.840.113549.1.7.5","digestedData"),t("1.2.840.113549.1.7.6","encryptedData"),t("1.2.840.113549.1.9.1","emailAddress"),t("1.2.840.113549.1.9.2","unstructuredName"),t("1.2.840.113549.1.9.3","contentType"),t("1.2.840.113549.1.9.4","messageDigest"),t("1.2.840.113549.1.9.5","signingTime"),t("1.2.840.113549.1.9.6","counterSignature"),t("1.2.840.113549.1.9.7","challengePassword"),t("1.2.840.113549.1.9.8","unstructuredAddress"),t("1.2.840.113549.1.9.14","extensionRequest"),t("1.2.840.113549.1.9.20","friendlyName"),t("1.2.840.113549.1.9.21","localKeyId"),t("1.2.840.113549.1.9.22.1","x509Certificate"),t("1.2.840.113549.1.12.10.1.1","keyBag"),t("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),t("1.2.840.113549.1.12.10.1.3","certBag"),t("1.2.840.113549.1.12.10.1.4","crlBag"),t("1.2.840.113549.1.12.10.1.5","secretBag"),t("1.2.840.113549.1.12.10.1.6","safeContentsBag"),t("1.2.840.113549.1.5.13","pkcs5PBES2"),t("1.2.840.113549.1.5.12","pkcs5PBKDF2"),t("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),t("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),t("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),t("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),t("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),t("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),t("1.2.840.113549.2.7","hmacWithSHA1"),t("1.2.840.113549.2.8","hmacWithSHA224"),t("1.2.840.113549.2.9","hmacWithSHA256"),t("1.2.840.113549.2.10","hmacWithSHA384"),t("1.2.840.113549.2.11","hmacWithSHA512"),t("1.2.840.113549.3.7","des-EDE3-CBC"),t("2.16.840.1.101.3.4.1.2","aes128-CBC"),t("2.16.840.1.101.3.4.1.22","aes192-CBC"),t("2.16.840.1.101.3.4.1.42","aes256-CBC"),t("2.5.4.3","commonName"),t("2.5.4.4","surname"),t("2.5.4.5","serialNumber"),t("2.5.4.6","countryName"),t("2.5.4.7","localityName"),t("2.5.4.8","stateOrProvinceName"),t("2.5.4.9","streetAddress"),t("2.5.4.10","organizationName"),t("2.5.4.11","organizationalUnitName"),t("2.5.4.12","title"),t("2.5.4.13","description"),t("2.5.4.15","businessCategory"),t("2.5.4.17","postalCode"),t("2.5.4.42","givenName"),t("2.5.4.65","pseudonym"),t("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName"),t("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName"),t("2.16.840.1.113730.1.1","nsCertType"),t("2.16.840.1.113730.1.13","nsComment"),u("2.5.29.1","authorityKeyIdentifier"),u("2.5.29.2","keyAttributes"),u("2.5.29.3","certificatePolicies"),u("2.5.29.4","keyUsageRestriction"),u("2.5.29.5","policyMapping"),u("2.5.29.6","subtreesConstraint"),u("2.5.29.7","subjectAltName"),u("2.5.29.8","issuerAltName"),u("2.5.29.9","subjectDirectoryAttributes"),u("2.5.29.10","basicConstraints"),u("2.5.29.11","nameConstraints"),u("2.5.29.12","policyConstraints"),u("2.5.29.13","basicConstraints"),t("2.5.29.14","subjectKeyIdentifier"),t("2.5.29.15","keyUsage"),u("2.5.29.16","privateKeyUsagePeriod"),t("2.5.29.17","subjectAltName"),t("2.5.29.18","issuerAltName"),t("2.5.29.19","basicConstraints"),u("2.5.29.20","cRLNumber"),u("2.5.29.21","cRLReason"),u("2.5.29.22","expirationDate"),u("2.5.29.23","instructionCode"),u("2.5.29.24","invalidityDate"),u("2.5.29.25","cRLDistributionPoints"),u("2.5.29.26","issuingDistributionPoint"),u("2.5.29.27","deltaCRLIndicator"),u("2.5.29.28","issuingDistributionPoint"),u("2.5.29.29","certificateIssuer"),u("2.5.29.30","nameConstraints"),t("2.5.29.31","cRLDistributionPoints"),t("2.5.29.32","certificatePolicies"),u("2.5.29.33","policyMappings"),u("2.5.29.34","policyConstraints"),t("2.5.29.35","authorityKeyIdentifier"),u("2.5.29.36","policyConstraints"),t("2.5.29.37","extKeyUsage"),u("2.5.29.46","freshestCRL"),u("2.5.29.54","inhibitAnyPolicy"),t("1.3.6.1.4.1.11129.2.4.2","timestampList"),t("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),t("1.3.6.1.5.5.7.3.1","serverAuth"),t("1.3.6.1.5.5.7.3.2","clientAuth"),t("1.3.6.1.5.5.7.3.3","codeSigning"),t("1.3.6.1.5.5.7.3.4","emailProtection"),t("1.3.6.1.5.5.7.3.8","timeStamping"),Re.exports}var ct;function ce(){if(ct)return Ae.exports;ct=1;var i=H();X(),he();var e=Ae.exports=i.asn1=i.asn1||{};e.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},e.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},e.maxDepth=256,e.create=function(s,o,d,c,T){if(i.util.isArray(c)){for(var R=[],x=0;x<c.length;++x)c[x]!==void 0&&R.push(c[x]);c=R}var y={tagClass:s,type:o,constructed:d,composed:d||i.util.isArray(c),value:c};return T&&"bitStringContents"in T&&(y.bitStringContents=T.bitStringContents,y.original=e.copy(y)),y},e.copy=function(s,o){var d;if(i.util.isArray(s)){d=[];for(var c=0;c<s.length;++c)d.push(e.copy(s[c],o));return d}return typeof s=="string"?s:(d={tagClass:s.tagClass,type:s.type,constructed:s.constructed,composed:s.composed,value:e.copy(s.value,o)},o&&!o.excludeBitStringContents&&(d.bitStringContents=s.bitStringContents),d)},e.equals=function(s,o,d){if(i.util.isArray(s)){if(!i.util.isArray(o)||s.length!==o.length)return!1;for(var c=0;c<s.length;++c)if(!e.equals(s[c],o[c]))return!1;return!0}if(typeof s!=typeof o)return!1;if(typeof s=="string")return s===o;var T=s.tagClass===o.tagClass&&s.type===o.type&&s.constructed===o.constructed&&s.composed===o.composed&&e.equals(s.value,o.value);return d&&d.includeBitStringContents&&(T=T&&s.bitStringContents===o.bitStringContents),T},e.getBerValueLength=function(s){var o=s.getByte();if(o!==128){var d,c=o&128;return c?d=s.getInt((o&127)<<3):d=o,d}};function t(s,o,d){if(d>o){var c=new Error("Too few bytes to parse DER.");throw c.available=s.length(),c.remaining=o,c.requested=d,c}}var u=function(s,o){var d=s.getByte();if(o--,d!==128){var c,T=d&128;if(!T)c=d;else{var R=d&127;t(s,o,R),c=s.getInt(R<<3)}if(c<0)throw new Error("Negative length: "+c);return c}};e.fromDer=function(s,o){o===void 0&&(o={strict:!0,parseAllBytes:!0,decodeBitStrings:!0}),typeof o=="boolean"&&(o={strict:o,parseAllBytes:!0,decodeBitStrings:!0}),"strict"in o||(o.strict=!0),"parseAllBytes"in o||(o.parseAllBytes=!0),"decodeBitStrings"in o||(o.decodeBitStrings=!0),"maxDepth"in o||(o.maxDepth=e.maxDepth),typeof s=="string"&&(s=i.util.createBuffer(s));var d=s.length(),c=I(s,s.length(),0,o);if(o.parseAllBytes&&s.length()!==0){var T=new Error("Unparsed DER bytes remain after ASN.1 parsing.");throw T.byteCount=d,T.remaining=s.length(),T}return c};function I(s,o,d,c){if(d>=c.maxDepth)throw new Error("ASN.1 parsing error: Max depth exceeded.");var T;t(s,o,2);var R=s.getByte();o--;var x=R&192,y=R&31;T=s.length();var E=u(s,o);if(o-=T-s.length(),E!==void 0&&E>o){if(c.strict){var v=new Error("Too few bytes to read ASN.1 value.");throw v.available=s.length(),v.remaining=o,v.requested=E,v}E=o}var m,a,l=(R&32)===32;if(l)if(m=[],E===void 0)for(;;){if(t(s,o,2),s.bytes(2)==="\0\0"){s.getBytes(2),o-=2;break}T=s.length(),m.push(I(s,o,d+1,c)),o-=T-s.length()}else for(;E>0;)T=s.length(),m.push(I(s,E,d+1,c)),o-=T-s.length(),E-=T-s.length();if(m===void 0&&x===e.Class.UNIVERSAL&&y===e.Type.BITSTRING&&(a=s.bytes(E)),m===void 0&&c.decodeBitStrings&&x===e.Class.UNIVERSAL&&y===e.Type.BITSTRING&&E>1){var h=s.read,A=o,b=0;if(y===e.Type.BITSTRING&&(t(s,o,1),b=s.getByte(),o--),b===0)try{T=s.length();var n={strict:!0,decodeBitStrings:!0},r=I(s,o,d+1,n),f=T-s.length();o-=f,y==e.Type.BITSTRING&&f++;var S=r.tagClass;f===E&&(S===e.Class.UNIVERSAL||S===e.Class.CONTEXT_SPECIFIC)&&(m=[r])}catch(U){}m===void 0&&(s.read=h,o=A)}if(m===void 0){if(E===void 0){if(c.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");E=o}if(y===e.Type.BMPSTRING)for(m="";E>0;E-=2)t(s,o,2),m+=String.fromCharCode(s.getInt16()),o-=2;else m=s.getBytes(E),o-=E}var w=a===void 0?null:{bitStringContents:a};return e.create(x,y,l,m,w)}e.toDer=function(s){var o=i.util.createBuffer(),d=s.tagClass|s.type,c=i.util.createBuffer(),T=!1;if("bitStringContents"in s&&(T=!0,s.original&&(T=e.equals(s,s.original))),T)c.putBytes(s.bitStringContents);else if(s.composed){s.constructed?d|=32:c.putByte(0);for(var R=0;R<s.value.length;++R)s.value[R]!==void 0&&c.putBuffer(e.toDer(s.value[R]))}else if(s.type===e.Type.BMPSTRING)for(var R=0;R<s.value.length;++R)c.putInt16(s.value.charCodeAt(R));else s.type===e.Type.INTEGER&&s.value.length>1&&(s.value.charCodeAt(0)===0&&(s.value.charCodeAt(1)&128)===0||s.value.charCodeAt(0)===255&&(s.value.charCodeAt(1)&128)===128)?c.putBytes(s.value.substr(1)):c.putBytes(s.value);if(o.putByte(d),c.length()<=127)o.putByte(c.length()&127);else{var x=c.length(),y="";do y+=String.fromCharCode(x&255),x=x>>>8;while(x>0);o.putByte(y.length|128);for(var R=y.length-1;R>=0;--R)o.putByte(y.charCodeAt(R))}return o.putBuffer(c),o},e.oidToDer=function(s){var o=s.split("."),d=i.util.createBuffer();d.putByte(40*parseInt(o[0],10)+parseInt(o[1],10));for(var c,T,R,x,y=2;y<o.length;++y){if(c=!0,T=[],R=parseInt(o[y],10),R>4294967295)throw new Error("OID value too large; max is 32-bits.");do x=R&127,R=R>>>7,c||(x|=128),T.push(x),c=!1;while(R>0);for(var E=T.length-1;E>=0;--E)d.putByte(T[E])}return d},e.derToOid=function(s){var o;typeof s=="string"&&(s=i.util.createBuffer(s));var d=s.getByte();o=Math.floor(d/40)+"."+d%40;for(var c=0;s.length()>0;){if(c>70368744177663)throw new Error("OID value too large; max is 53-bits.");d=s.getByte(),c=c*128,d&128?c+=d&127:(o+="."+(c+d),c=0)}return o},e.utcTimeToDate=function(s){var o=new Date,d=parseInt(s.substr(0,2),10);d=d>=50?1900+d:2e3+d;var c=parseInt(s.substr(2,2),10)-1,T=parseInt(s.substr(4,2),10),R=parseInt(s.substr(6,2),10),x=parseInt(s.substr(8,2),10),y=0;if(s.length>11){var E=s.charAt(10),v=10;E!=="+"&&E!=="-"&&(y=parseInt(s.substr(10,2),10),v+=2)}if(o.setUTCFullYear(d,c,T),o.setUTCHours(R,x,y,0),v&&(E=s.charAt(v),E==="+"||E==="-")){var m=parseInt(s.substr(v+1,2),10),a=parseInt(s.substr(v+4,2),10),l=m*60+a;l*=6e4,E==="+"?o.setTime(+o-l):o.setTime(+o+l)}return o},e.generalizedTimeToDate=function(s){var o=new Date,d=parseInt(s.substr(0,4),10),c=parseInt(s.substr(4,2),10)-1,T=parseInt(s.substr(6,2),10),R=parseInt(s.substr(8,2),10),x=parseInt(s.substr(10,2),10),y=parseInt(s.substr(12,2),10),E=0,v=0,m=!1;s.charAt(s.length-1)==="Z"&&(m=!0);var a=s.length-5,l=s.charAt(a);if(l==="+"||l==="-"){var h=parseInt(s.substr(a+1,2),10),A=parseInt(s.substr(a+4,2),10);v=h*60+A,v*=6e4,l==="+"&&(v*=-1),m=!0}return s.charAt(14)==="."&&(E=parseFloat(s.substr(14),10)*1e3),m?(o.setUTCFullYear(d,c,T),o.setUTCHours(R,x,y,E),o.setTime(+o+v)):(o.setFullYear(d,c,T),o.setHours(R,x,y,E)),o},e.dateToUtcTime=function(s){if(typeof s=="string")return s;var o="",d=[];d.push((""+s.getUTCFullYear()).substr(2)),d.push(""+(s.getUTCMonth()+1)),d.push(""+s.getUTCDate()),d.push(""+s.getUTCHours()),d.push(""+s.getUTCMinutes()),d.push(""+s.getUTCSeconds());for(var c=0;c<d.length;++c)d[c].length<2&&(o+="0"),o+=d[c];return o+="Z",o},e.dateToGeneralizedTime=function(s){if(typeof s=="string")return s;var o="",d=[];d.push(""+s.getUTCFullYear()),d.push(""+(s.getUTCMonth()+1)),d.push(""+s.getUTCDate()),d.push(""+s.getUTCHours()),d.push(""+s.getUTCMinutes()),d.push(""+s.getUTCSeconds());for(var c=0;c<d.length;++c)d[c].length<2&&(o+="0"),o+=d[c];return o+="Z",o},e.integerToDer=function(s){var o=i.util.createBuffer();if(s>=-128&&s<128)return o.putSignedInt(s,8);if(s>=-32768&&s<32768)return o.putSignedInt(s,16);if(s>=-8388608&&s<8388608)return o.putSignedInt(s,24);if(s>=-2147483648&&s<2147483648)return o.putSignedInt(s,32);var d=new Error("Integer too large; max is 32-bits.");throw d.integer=s,d},e.derToInteger=function(s){typeof s=="string"&&(s=i.util.createBuffer(s));var o=s.length()*8;if(o>32)throw new Error("Integer too large; max is 32-bits.");return s.getSignedInt(o)},e.validate=function(s,o,d,c){var T=!1;if((s.tagClass===o.tagClass||typeof o.tagClass=="undefined")&&(s.type===o.type||typeof o.type=="undefined"))if(s.constructed===o.constructed||typeof o.constructed=="undefined"){if(T=!0,o.value&&i.util.isArray(o.value))for(var R=0,x=0;T&&x<o.value.length;++x){var y=o.value[x];T=!!y.optional;var E=s.value[R];if(!E){y.optional||(T=!1,c&&c.push("["+o.name+'] Missing required element. Expected tag class "'+y.tagClass+'", type "'+y.type+'"'));continue}var v=typeof y.tagClass!="undefined"&&typeof y.type!="undefined";if(v&&(E.tagClass!==y.tagClass||E.type!==y.type))if(y.optional){T=!0;continue}else{T=!1,c&&c.push("["+o.name+"] Tag mismatch. Expected ("+y.tagClass+","+y.type+"), got ("+E.tagClass+","+E.type+")");break}var m=e.validate(E,y,d,c);if(m)++R,T=!0;else if(y.optional)T=!0;else{T=!1;break}}if(T&&d&&(o.capture&&(d[o.capture]=s.value),o.captureAsn1&&(d[o.captureAsn1]=s),o.captureBitStringContents&&"bitStringContents"in s&&(d[o.captureBitStringContents]=s.bitStringContents),o.captureBitStringValue&&"bitStringContents"in s))if(s.bitStringContents.length<2)d[o.captureBitStringValue]="";else{var a=s.bitStringContents.charCodeAt(0);if(a!==0)throw new Error("captureBitStringValue only supported for zero unused bits");d[o.captureBitStringValue]=s.bitStringContents.slice(1)}}else c&&c.push("["+o.name+'] Expected constructed "'+o.constructed+'", got "'+s.constructed+'"');else c&&(s.tagClass!==o.tagClass&&c.push("["+o.name+'] Expected tag class "'+o.tagClass+'", got "'+s.tagClass+'"'),s.type!==o.type&&c.push("["+o.name+'] Expected type "'+o.type+'", got "'+s.type+'"'));return T};var g=/[^\\u0000-\\u00ff]/;return e.prettyPrint=function(s,o,d){var c="";o=o||0,d=d||2,o>0&&(c+=`
5
+ `);for(var T="",R=0;R<o*d;++R)T+=" ";switch(c+=T+"Tag: ",s.tagClass){case e.Class.UNIVERSAL:c+="Universal:";break;case e.Class.APPLICATION:c+="Application:";break;case e.Class.CONTEXT_SPECIFIC:c+="Context-Specific:";break;case e.Class.PRIVATE:c+="Private:";break}if(s.tagClass===e.Class.UNIVERSAL)switch(c+=s.type,s.type){case e.Type.NONE:c+=" (None)";break;case e.Type.BOOLEAN:c+=" (Boolean)";break;case e.Type.INTEGER:c+=" (Integer)";break;case e.Type.BITSTRING:c+=" (Bit string)";break;case e.Type.OCTETSTRING:c+=" (Octet string)";break;case e.Type.NULL:c+=" (Null)";break;case e.Type.OID:c+=" (Object Identifier)";break;case e.Type.ODESC:c+=" (Object Descriptor)";break;case e.Type.EXTERNAL:c+=" (External or Instance of)";break;case e.Type.REAL:c+=" (Real)";break;case e.Type.ENUMERATED:c+=" (Enumerated)";break;case e.Type.EMBEDDED:c+=" (Embedded PDV)";break;case e.Type.UTF8:c+=" (UTF8)";break;case e.Type.ROID:c+=" (Relative Object Identifier)";break;case e.Type.SEQUENCE:c+=" (Sequence)";break;case e.Type.SET:c+=" (Set)";break;case e.Type.PRINTABLESTRING:c+=" (Printable String)";break;case e.Type.IA5String:c+=" (IA5String (ASCII))";break;case e.Type.UTCTIME:c+=" (UTC time)";break;case e.Type.GENERALIZEDTIME:c+=" (Generalized time)";break;case e.Type.BMPSTRING:c+=" (BMP String)";break}else c+=s.type;if(c+=`
6
+ `,c+=T+"Constructed: "+s.constructed+`
7
+ `,s.composed){for(var x=0,y="",R=0;R<s.value.length;++R)s.value[R]!==void 0&&(x+=1,y+=e.prettyPrint(s.value[R],o+1,d),R+1<s.value.length&&(y+=","));c+=T+"Sub values: "+x+y}else{if(c+=T+"Value: ",s.type===e.Type.OID){var E=e.derToOid(s.value);c+=E,i.pki&&i.pki.oids&&E in i.pki.oids&&(c+=" ("+i.pki.oids[E]+") ")}if(s.type===e.Type.INTEGER)try{c+=e.derToInteger(s.value)}catch(m){c+="0x"+i.util.bytesToHex(s.value)}else if(s.type===e.Type.BITSTRING){if(s.value.length>1?c+="0x"+i.util.bytesToHex(s.value.slice(1)):c+="(none)",s.value.length>0){var v=s.value.charCodeAt(0);v==1?c+=" (1 unused bit shown)":v>1&&(c+=" ("+v+" unused bits shown)")}}else if(s.type===e.Type.OCTETSTRING)g.test(s.value)||(c+="("+s.value+") "),c+="0x"+i.util.bytesToHex(s.value);else if(s.type===e.Type.UTF8)try{c+=i.util.decodeUtf8(s.value)}catch(m){if(m.message==="URI malformed")c+="0x"+i.util.bytesToHex(s.value)+" (malformed UTF8)";else throw m}else s.type===e.Type.PRINTABLESTRING||s.type===e.Type.IA5String?c+=s.value:g.test(s.value)?c+="0x"+i.util.bytesToHex(s.value):s.value.length===0?c+="[null]":c+=s.value}return c},Ae.exports}var hr=ce();const pr=Ie(hr);var we={exports:{}},Ue,ht;function pt(){if(ht)return Ue;ht=1;var i=H();X(),Ue=i.cipher=i.cipher||{},i.cipher.algorithms=i.cipher.algorithms||{},i.cipher.createCipher=function(t,u){var I=t;if(typeof I=="string"&&(I=i.cipher.getAlgorithm(I),I&&(I=I())),!I)throw new Error("Unsupported algorithm: "+t);return new i.cipher.BlockCipher({algorithm:I,key:u,decrypt:!1})},i.cipher.createDecipher=function(t,u){var I=t;if(typeof I=="string"&&(I=i.cipher.getAlgorithm(I),I&&(I=I())),!I)throw new Error("Unsupported algorithm: "+t);return new i.cipher.BlockCipher({algorithm:I,key:u,decrypt:!0})},i.cipher.registerAlgorithm=function(t,u){t=t.toUpperCase(),i.cipher.algorithms[t]=u},i.cipher.getAlgorithm=function(t){return t=t.toUpperCase(),t in i.cipher.algorithms?i.cipher.algorithms[t]:null};var e=i.cipher.BlockCipher=function(t){this.algorithm=t.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=t.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=t.decrypt,this.algorithm.initialize(t)};return e.prototype.start=function(t){t=t||{};var u={};for(var I in t)u[I]=t[I];u.decrypt=this._decrypt,this._finish=!1,this._input=i.util.createBuffer(),this.output=t.output||i.util.createBuffer(),this.mode.start(u)},e.prototype.update=function(t){for(t&&this._input.putBuffer(t);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},e.prototype.finish=function(t){t&&(this.mode.name==="ECB"||this.mode.name==="CBC")&&(this.mode.pad=function(I){return t(this.blockSize,I,!1)},this.mode.unpad=function(I){return t(this.blockSize,I,!0)});var u={};return u.decrypt=this._decrypt,u.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,u)||(this._finish=!0,this.update(),this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,u))||this.mode.afterFinish&&!this.mode.afterFinish(this.output,u))},Ue}var Le={exports:{}},dt;function yt(){if(dt)return Le.exports;dt=1;var i=H();X(),i.cipher=i.cipher||{};var e=Le.exports=i.cipher.modes=i.cipher.modes||{};e.ecb=function(g){g=g||{},this.name="ECB",this.cipher=g.cipher,this.blockSize=g.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},e.ecb.prototype.start=function(g){},e.ecb.prototype.encrypt=function(g,s,o){if(g.length()<this.blockSize&&!(o&&g.length()>0))return!0;for(var d=0;d<this._ints;++d)this._inBlock[d]=g.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var d=0;d<this._ints;++d)s.putInt32(this._outBlock[d])},e.ecb.prototype.decrypt=function(g,s,o){if(g.length()<this.blockSize&&!(o&&g.length()>0))return!0;for(var d=0;d<this._ints;++d)this._inBlock[d]=g.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var d=0;d<this._ints;++d)s.putInt32(this._outBlock[d])},e.ecb.prototype.pad=function(g,s){var o=g.length()===this.blockSize?this.blockSize:this.blockSize-g.length();return g.fillWithByte(o,o),!0},e.ecb.prototype.unpad=function(g,s){if(s.overflow>0)return!1;var o=g.length(),d=g.at(o-1);return d>this.blockSize<<2?!1:(g.truncate(d),!0)},e.cbc=function(g){g=g||{},this.name="CBC",this.cipher=g.cipher,this.blockSize=g.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},e.cbc.prototype.start=function(g){if(g.iv===null){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else if("iv"in g)this._iv=t(g.iv,this.blockSize),this._prev=this._iv.slice(0);else throw new Error("Invalid IV parameter.")},e.cbc.prototype.encrypt=function(g,s,o){if(g.length()<this.blockSize&&!(o&&g.length()>0))return!0;for(var d=0;d<this._ints;++d)this._inBlock[d]=this._prev[d]^g.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var d=0;d<this._ints;++d)s.putInt32(this._outBlock[d]);this._prev=this._outBlock},e.cbc.prototype.decrypt=function(g,s,o){if(g.length()<this.blockSize&&!(o&&g.length()>0))return!0;for(var d=0;d<this._ints;++d)this._inBlock[d]=g.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var d=0;d<this._ints;++d)s.putInt32(this._prev[d]^this._outBlock[d]);this._prev=this._inBlock.slice(0)},e.cbc.prototype.pad=function(g,s){var o=g.length()===this.blockSize?this.blockSize:this.blockSize-g.length();return g.fillWithByte(o,o),!0},e.cbc.prototype.unpad=function(g,s){if(s.overflow>0)return!1;var o=g.length(),d=g.at(o-1);return d>this.blockSize<<2?!1:(g.truncate(d),!0)},e.cfb=function(g){g=g||{},this.name="CFB",this.cipher=g.cipher,this.blockSize=g.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=i.util.createBuffer(),this._partialBytes=0},e.cfb.prototype.start=function(g){if(!("iv"in g))throw new Error("Invalid IV parameter.");this._iv=t(g.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},e.cfb.prototype.encrypt=function(g,s,o){var d=g.length();if(d===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&d>=this.blockSize){for(var c=0;c<this._ints;++c)this._inBlock[c]=g.getInt32()^this._outBlock[c],s.putInt32(this._inBlock[c]);return}var T=(this.blockSize-d)%this.blockSize;T>0&&(T=this.blockSize-T),this._partialOutput.clear();for(var c=0;c<this._ints;++c)this._partialBlock[c]=g.getInt32()^this._outBlock[c],this._partialOutput.putInt32(this._partialBlock[c]);if(T>0)g.read-=this.blockSize;else for(var c=0;c<this._ints;++c)this._inBlock[c]=this._partialBlock[c];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),T>0&&!o)return s.putBytes(this._partialOutput.getBytes(T-this._partialBytes)),this._partialBytes=T,!0;s.putBytes(this._partialOutput.getBytes(d-this._partialBytes)),this._partialBytes=0},e.cfb.prototype.decrypt=function(g,s,o){var d=g.length();if(d===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&d>=this.blockSize){for(var c=0;c<this._ints;++c)this._inBlock[c]=g.getInt32(),s.putInt32(this._inBlock[c]^this._outBlock[c]);return}var T=(this.blockSize-d)%this.blockSize;T>0&&(T=this.blockSize-T),this._partialOutput.clear();for(var c=0;c<this._ints;++c)this._partialBlock[c]=g.getInt32(),this._partialOutput.putInt32(this._partialBlock[c]^this._outBlock[c]);if(T>0)g.read-=this.blockSize;else for(var c=0;c<this._ints;++c)this._inBlock[c]=this._partialBlock[c];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),T>0&&!o)return s.putBytes(this._partialOutput.getBytes(T-this._partialBytes)),this._partialBytes=T,!0;s.putBytes(this._partialOutput.getBytes(d-this._partialBytes)),this._partialBytes=0},e.ofb=function(g){g=g||{},this.name="OFB",this.cipher=g.cipher,this.blockSize=g.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=i.util.createBuffer(),this._partialBytes=0},e.ofb.prototype.start=function(g){if(!("iv"in g))throw new Error("Invalid IV parameter.");this._iv=t(g.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},e.ofb.prototype.encrypt=function(g,s,o){var d=g.length();if(g.length()===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&d>=this.blockSize){for(var c=0;c<this._ints;++c)s.putInt32(g.getInt32()^this._outBlock[c]),this._inBlock[c]=this._outBlock[c];return}var T=(this.blockSize-d)%this.blockSize;T>0&&(T=this.blockSize-T),this._partialOutput.clear();for(var c=0;c<this._ints;++c)this._partialOutput.putInt32(g.getInt32()^this._outBlock[c]);if(T>0)g.read-=this.blockSize;else for(var c=0;c<this._ints;++c)this._inBlock[c]=this._outBlock[c];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),T>0&&!o)return s.putBytes(this._partialOutput.getBytes(T-this._partialBytes)),this._partialBytes=T,!0;s.putBytes(this._partialOutput.getBytes(d-this._partialBytes)),this._partialBytes=0},e.ofb.prototype.decrypt=e.ofb.prototype.encrypt,e.ctr=function(g){g=g||{},this.name="CTR",this.cipher=g.cipher,this.blockSize=g.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=i.util.createBuffer(),this._partialBytes=0},e.ctr.prototype.start=function(g){if(!("iv"in g))throw new Error("Invalid IV parameter.");this._iv=t(g.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},e.ctr.prototype.encrypt=function(g,s,o){var d=g.length();if(d===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&d>=this.blockSize)for(var c=0;c<this._ints;++c)s.putInt32(g.getInt32()^this._outBlock[c]);else{var T=(this.blockSize-d)%this.blockSize;T>0&&(T=this.blockSize-T),this._partialOutput.clear();for(var c=0;c<this._ints;++c)this._partialOutput.putInt32(g.getInt32()^this._outBlock[c]);if(T>0&&(g.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),T>0&&!o)return s.putBytes(this._partialOutput.getBytes(T-this._partialBytes)),this._partialBytes=T,!0;s.putBytes(this._partialOutput.getBytes(d-this._partialBytes)),this._partialBytes=0}u(this._inBlock)},e.ctr.prototype.decrypt=e.ctr.prototype.encrypt,e.gcm=function(g){g=g||{},this.name="GCM",this.cipher=g.cipher,this.blockSize=g.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=i.util.createBuffer(),this._partialBytes=0,this._R=3774873600},e.gcm.prototype.start=function(g){if(!("iv"in g))throw new Error("Invalid IV parameter.");var s=i.util.createBuffer(g.iv);this._cipherLength=0;var o;if("additionalData"in g?o=i.util.createBuffer(g.additionalData):o=i.util.createBuffer(),"tagLength"in g?this._tagLength=g.tagLength:this._tagLength=128,this._tag=null,g.decrypt&&(this._tag=i.util.createBuffer(g.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var d=s.length();if(d===12)this._j0=[s.getInt32(),s.getInt32(),s.getInt32(),1];else{for(this._j0=[0,0,0,0];s.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[s.getInt32(),s.getInt32(),s.getInt32(),s.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(I(d*8)))}this._inBlock=this._j0.slice(0),u(this._inBlock),this._partialBytes=0,o=i.util.createBuffer(o),this._aDataLength=I(o.length()*8);var c=o.length()%this.blockSize;for(c&&o.fillWithByte(0,this.blockSize-c),this._s=[0,0,0,0];o.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[o.getInt32(),o.getInt32(),o.getInt32(),o.getInt32()])},e.gcm.prototype.encrypt=function(g,s,o){var d=g.length();if(d===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&d>=this.blockSize){for(var c=0;c<this._ints;++c)s.putInt32(this._outBlock[c]^=g.getInt32());this._cipherLength+=this.blockSize}else{var T=(this.blockSize-d)%this.blockSize;T>0&&(T=this.blockSize-T),this._partialOutput.clear();for(var c=0;c<this._ints;++c)this._partialOutput.putInt32(g.getInt32()^this._outBlock[c]);if(T<=0||o){if(o){var R=d%this.blockSize;this._cipherLength+=R,this._partialOutput.truncate(this.blockSize-R)}else this._cipherLength+=this.blockSize;for(var c=0;c<this._ints;++c)this._outBlock[c]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),T>0&&!o)return g.read-=this.blockSize,s.putBytes(this._partialOutput.getBytes(T-this._partialBytes)),this._partialBytes=T,!0;s.putBytes(this._partialOutput.getBytes(d-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),u(this._inBlock)},e.gcm.prototype.decrypt=function(g,s,o){var d=g.length();if(d<this.blockSize&&!(o&&d>0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),u(this._inBlock),this._hashBlock[0]=g.getInt32(),this._hashBlock[1]=g.getInt32(),this._hashBlock[2]=g.getInt32(),this._hashBlock[3]=g.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var c=0;c<this._ints;++c)s.putInt32(this._outBlock[c]^this._hashBlock[c]);d<this.blockSize?this._cipherLength+=d%this.blockSize:this._cipherLength+=this.blockSize},e.gcm.prototype.afterFinish=function(g,s){var o=!0;s.decrypt&&s.overflow&&g.truncate(this.blockSize-s.overflow),this.tag=i.util.createBuffer();var d=this._aDataLength.concat(I(this._cipherLength*8));this._s=this.ghash(this._hashSubkey,this._s,d);var c=[];this.cipher.encrypt(this._j0,c);for(var T=0;T<this._ints;++T)this.tag.putInt32(this._s[T]^c[T]);return this.tag.truncate(this.tag.length()%(this._tagLength/8)),s.decrypt&&this.tag.bytes()!==this._tag&&(o=!1),o},e.gcm.prototype.multiply=function(g,s){for(var o=[0,0,0,0],d=s.slice(0),c=0;c<128;++c){var T=g[c/32|0]&1<<31-c%32;T&&(o[0]^=d[0],o[1]^=d[1],o[2]^=d[2],o[3]^=d[3]),this.pow(d,d)}return o},e.gcm.prototype.pow=function(g,s){for(var o=g[3]&1,d=3;d>0;--d)s[d]=g[d]>>>1|(g[d-1]&1)<<31;s[0]=g[0]>>>1,o&&(s[0]^=this._R)},e.gcm.prototype.tableMultiply=function(g){for(var s=[0,0,0,0],o=0;o<32;++o){var d=o/8|0,c=g[d]>>>(7-o%8)*4&15,T=this._m[o][c];s[0]^=T[0],s[1]^=T[1],s[2]^=T[2],s[3]^=T[3]}return s},e.gcm.prototype.ghash=function(g,s,o){return s[0]^=o[0],s[1]^=o[1],s[2]^=o[2],s[3]^=o[3],this.tableMultiply(s)},e.gcm.prototype.generateHashTable=function(g,s){for(var o=8/s,d=4*o,c=16*o,T=new Array(c),R=0;R<c;++R){var x=[0,0,0,0],y=R/d|0,E=(d-1-R%d)*s;x[y]=1<<s-1<<E,T[R]=this.generateSubHashTable(this.multiply(x,g),s)}return T},e.gcm.prototype.generateSubHashTable=function(g,s){var o=1<<s,d=o>>>1,c=new Array(o);c[d]=g.slice(0);for(var T=d>>>1;T>0;)this.pow(c[2*T],c[T]=[]),T>>=1;for(T=2;T<d;){for(var R=1;R<T;++R){var x=c[T],y=c[R];c[T+R]=[x[0]^y[0],x[1]^y[1],x[2]^y[2],x[3]^y[3]]}T*=2}for(c[0]=[0,0,0,0],T=d+1;T<o;++T){var E=c[T^d];c[T]=[g[0]^E[0],g[1]^E[1],g[2]^E[2],g[3]^E[3]]}return c};function t(g,s){if(typeof g=="string"&&(g=i.util.createBuffer(g)),i.util.isArray(g)&&g.length>4){var o=g;g=i.util.createBuffer();for(var d=0;d<o.length;++d)g.putByte(o[d])}if(g.length()<s)throw new Error("Invalid IV length; got "+g.length()+" bytes and expected "+s+" bytes.");if(!i.util.isArray(g)){for(var c=[],T=s/4,d=0;d<T;++d)c.push(g.getInt32());g=c}return g}function u(g){g[g.length-1]=g[g.length-1]+1&4294967295}function I(g){return[g/4294967296|0,g&4294967295]}return Le.exports}var De,gt;function _e(){if(gt)return De;gt=1;var i=H();pt(),yt(),X(),De=i.aes=i.aes||{},i.aes.startEncrypting=function(y,E,v,m){var a=x({key:y,output:v,decrypt:!1,mode:m});return a.start(E),a},i.aes.createEncryptionCipher=function(y,E){return x({key:y,output:null,decrypt:!1,mode:E})},i.aes.startDecrypting=function(y,E,v,m){var a=x({key:y,output:v,decrypt:!0,mode:m});return a.start(E),a},i.aes.createDecryptionCipher=function(y,E){return x({key:y,output:null,decrypt:!0,mode:E})},i.aes.Algorithm=function(y,E){t||c();var v=this;v.name=y,v.mode=new E({blockSize:16,cipher:{encrypt:function(m,a){return R(v._w,m,a,!1)},decrypt:function(m,a){return R(v._w,m,a,!0)}}}),v._init=!1},i.aes.Algorithm.prototype.initialize=function(y){if(!this._init){var E=y.key,v;if(typeof E=="string"&&(E.length===16||E.length===24||E.length===32))E=i.util.createBuffer(E);else if(i.util.isArray(E)&&(E.length===16||E.length===24||E.length===32)){v=E,E=i.util.createBuffer();for(var m=0;m<v.length;++m)E.putByte(v[m])}if(!i.util.isArray(E)){v=E,E=[];var a=v.length();if(a===16||a===24||a===32){a=a>>>2;for(var m=0;m<a;++m)E.push(v.getInt32())}}if(!i.util.isArray(E)||!(E.length===4||E.length===6||E.length===8))throw new Error("Invalid key parameter.");var l=this.mode.name,h=["CFB","OFB","CTR","GCM"].indexOf(l)!==-1;this._w=T(E,y.decrypt&&!h),this._init=!0}},i.aes._expandKey=function(y,E){return t||c(),T(y,E)},i.aes._updateBlock=R,e("AES-ECB",i.cipher.modes.ecb),e("AES-CBC",i.cipher.modes.cbc),e("AES-CFB",i.cipher.modes.cfb),e("AES-OFB",i.cipher.modes.ofb),e("AES-CTR",i.cipher.modes.ctr),e("AES-GCM",i.cipher.modes.gcm);function e(y,E){var v=function(){return new i.aes.Algorithm(y,E)};i.cipher.registerAlgorithm(y,v)}var t=!1,u=4,I,g,s,o,d;function c(){t=!0,s=[0,1,2,4,8,16,32,64,128,27,54];for(var y=new Array(256),E=0;E<128;++E)y[E]=E<<1,y[E+128]=E+128<<1^283;I=new Array(256),g=new Array(256),o=new Array(4),d=new Array(4);for(var E=0;E<4;++E)o[E]=new Array(256),d[E]=new Array(256);for(var v=0,m=0,a,l,h,A,b,n,r,E=0;E<256;++E){A=m^m<<1^m<<2^m<<3^m<<4,A=A>>8^A&255^99,I[v]=A,g[A]=v,b=y[A],a=y[v],l=y[a],h=y[l],n=b<<24^A<<16^A<<8^(A^b),r=(a^l^h)<<24^(v^h)<<16^(v^l^h)<<8^(v^a^h);for(var f=0;f<4;++f)o[f][v]=n,d[f][A]=r,n=n<<24|n>>>8,r=r<<24|r>>>8;v===0?v=m=1:(v=a^y[y[y[a^h]]],m^=y[y[m]])}}function T(y,E){for(var v=y.slice(0),m,a=1,l=v.length,h=l+6+1,A=u*h,b=l;b<A;++b)m=v[b-1],b%l===0?(m=I[m>>>16&255]<<24^I[m>>>8&255]<<16^I[m&255]<<8^I[m>>>24]^s[a]<<24,a++):l>6&&b%l===4&&(m=I[m>>>24]<<24^I[m>>>16&255]<<16^I[m>>>8&255]<<8^I[m&255]),v[b]=v[b-l]^m;if(E){var n,r=d[0],f=d[1],S=d[2],w=d[3],U=v.slice(0);A=v.length;for(var b=0,N=A-u;b<A;b+=u,N-=u)if(b===0||b===A-u)U[b]=v[N],U[b+1]=v[N+3],U[b+2]=v[N+2],U[b+3]=v[N+1];else for(var L=0;L<u;++L)n=v[N+L],U[b+(3&-L)]=r[I[n>>>24]]^f[I[n>>>16&255]]^S[I[n>>>8&255]]^w[I[n&255]];v=U}return v}function R(y,E,v,m){var a=y.length/4-1,l,h,A,b,n;m?(l=d[0],h=d[1],A=d[2],b=d[3],n=g):(l=o[0],h=o[1],A=o[2],b=o[3],n=I);var r,f,S,w,U,N,L;r=E[0]^y[0],f=E[m?3:1]^y[1],S=E[2]^y[2],w=E[m?1:3]^y[3];for(var P=3,_=1;_<a;++_)U=l[r>>>24]^h[f>>>16&255]^A[S>>>8&255]^b[w&255]^y[++P],N=l[f>>>24]^h[S>>>16&255]^A[w>>>8&255]^b[r&255]^y[++P],L=l[S>>>24]^h[w>>>16&255]^A[r>>>8&255]^b[f&255]^y[++P],w=l[w>>>24]^h[r>>>16&255]^A[f>>>8&255]^b[S&255]^y[++P],r=U,f=N,S=L;v[0]=n[r>>>24]<<24^n[f>>>16&255]<<16^n[S>>>8&255]<<8^n[w&255]^y[++P],v[m?3:1]=n[f>>>24]<<24^n[S>>>16&255]<<16^n[w>>>8&255]<<8^n[r&255]^y[++P],v[2]=n[S>>>24]<<24^n[w>>>16&255]<<16^n[r>>>8&255]<<8^n[f&255]^y[++P],v[m?1:3]=n[w>>>24]<<24^n[r>>>16&255]<<16^n[f>>>8&255]<<8^n[S&255]^y[++P]}function x(y){y=y||{};var E=(y.mode||"CBC").toUpperCase(),v="AES-"+E,m;y.decrypt?m=i.cipher.createDecipher(v,y.key):m=i.cipher.createCipher(v,y.key);var a=m.start;return m.start=function(l,h){var A=null;h instanceof i.util.ByteBuffer&&(A=h,h={}),h=h||{},h.output=A,h.iv=l,a.call(m,h)},m}return De}var Pe,vt;function Ct(){if(vt)return Pe;vt=1;var i=H();pt(),yt(),X(),Pe=i.des=i.des||{},i.des.startEncrypting=function(y,E,v,m){var a=x({key:y,output:v,decrypt:!1,mode:m||(E===null?"ECB":"CBC")});return a.start(E),a},i.des.createEncryptionCipher=function(y,E){return x({key:y,output:null,decrypt:!1,mode:E})},i.des.startDecrypting=function(y,E,v,m){var a=x({key:y,output:v,decrypt:!0,mode:m||(E===null?"ECB":"CBC")});return a.start(E),a},i.des.createDecryptionCipher=function(y,E){return x({key:y,output:null,decrypt:!0,mode:E})},i.des.Algorithm=function(y,E){var v=this;v.name=y,v.mode=new E({blockSize:8,cipher:{encrypt:function(m,a){return R(v._keys,m,a,!1)},decrypt:function(m,a){return R(v._keys,m,a,!0)}}}),v._init=!1},i.des.Algorithm.prototype.initialize=function(y){if(!this._init){var E=i.util.createBuffer(y.key);if(this.name.indexOf("3DES")===0&&E.length()!==24)throw new Error("Invalid Triple-DES key size: "+E.length()*8);this._keys=T(E),this._init=!0}},e("DES-ECB",i.cipher.modes.ecb),e("DES-CBC",i.cipher.modes.cbc),e("DES-CFB",i.cipher.modes.cfb),e("DES-OFB",i.cipher.modes.ofb),e("DES-CTR",i.cipher.modes.ctr),e("3DES-ECB",i.cipher.modes.ecb),e("3DES-CBC",i.cipher.modes.cbc),e("3DES-CFB",i.cipher.modes.cfb),e("3DES-OFB",i.cipher.modes.ofb),e("3DES-CTR",i.cipher.modes.ctr);function e(y,E){var v=function(){return new i.des.Algorithm(y,E)};i.cipher.registerAlgorithm(y,v)}var t=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],u=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],I=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],g=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],s=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],o=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],d=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],c=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696];function T(y){for(var E=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],v=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],m=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],a=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],l=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],h=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],A=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],b=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],n=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],r=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],f=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],S=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],w=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],U=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],N=y.length()>8?3:1,L=[],P=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],_=0,k,F=0;F<N;F++){var K=y.getInt32(),G=y.getInt32();k=(K>>>4^G)&252645135,G^=k,K^=k<<4,k=(G>>>-16^K)&65535,K^=k,G^=k<<-16,k=(K>>>2^G)&858993459,G^=k,K^=k<<2,k=(G>>>-16^K)&65535,K^=k,G^=k<<-16,k=(K>>>1^G)&1431655765,G^=k,K^=k<<1,k=(G>>>8^K)&16711935,K^=k,G^=k<<8,k=(K>>>1^G)&1431655765,G^=k,K^=k<<1,k=K<<8|G>>>20&240,K=G<<24|G<<8&16711680|G>>>8&65280|G>>>24&240,G=k;for(var z=0;z<P.length;++z){P[z]?(K=K<<2|K>>>26,G=G<<2|G>>>26):(K=K<<1|K>>>27,G=G<<1|G>>>27),K&=-15,G&=-15;var Q=E[K>>>28]|v[K>>>24&15]|m[K>>>20&15]|a[K>>>16&15]|l[K>>>12&15]|h[K>>>8&15]|A[K>>>4&15],Y=b[G>>>28]|n[G>>>24&15]|r[G>>>20&15]|f[G>>>16&15]|S[G>>>12&15]|w[G>>>8&15]|U[G>>>4&15];k=(Y>>>16^Q)&65535,L[_++]=Q^k,L[_++]=Y^k<<16}}return L}function R(y,E,v,m){var a=y.length===32?3:9,l;a===3?l=m?[30,-2,-2]:[0,32,2]:l=m?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var h,A=E[0],b=E[1];h=(A>>>4^b)&252645135,b^=h,A^=h<<4,h=(A>>>16^b)&65535,b^=h,A^=h<<16,h=(b>>>2^A)&858993459,A^=h,b^=h<<2,h=(b>>>8^A)&16711935,A^=h,b^=h<<8,h=(A>>>1^b)&1431655765,b^=h,A^=h<<1,A=A<<1|A>>>31,b=b<<1|b>>>31;for(var n=0;n<a;n+=3){for(var r=l[n+1],f=l[n+2],S=l[n];S!=r;S+=f){var w=b^y[S],U=(b>>>4|b<<28)^y[S+1];h=A,A=b,b=h^(u[w>>>24&63]|g[w>>>16&63]|o[w>>>8&63]|c[w&63]|t[U>>>24&63]|I[U>>>16&63]|s[U>>>8&63]|d[U&63])}h=A,A=b,b=h}A=A>>>1|A<<31,b=b>>>1|b<<31,h=(A>>>1^b)&1431655765,b^=h,A^=h<<1,h=(b>>>8^A)&16711935,A^=h,b^=h<<8,h=(b>>>2^A)&858993459,A^=h,b^=h<<2,h=(A>>>16^b)&65535,b^=h,A^=h<<16,h=(A>>>4^b)&252645135,b^=h,A^=h<<4,v[0]=A,v[1]=b}function x(y){y=y||{};var E=(y.mode||"CBC").toUpperCase(),v="DES-"+E,m;y.decrypt?m=i.cipher.createDecipher(v,y.key):m=i.cipher.createCipher(v,y.key);var a=m.start;return m.start=function(l,h){var A=null;h instanceof i.util.ByteBuffer&&(A=h,h={}),h=h||{},h.output=A,h.iv=l,a.call(m,h)},m}return Pe}var ke,Et;function pe(){if(Et)return ke;Et=1;var i=H();return ke=i.md=i.md||{},i.md.algorithms=i.md.algorithms||{},ke}var Oe={exports:{}},mt;function xt(){if(mt)return Oe.exports;mt=1;var i=H();pe(),X();var e=Oe.exports=i.hmac=i.hmac||{};return e.create=function(){var t=null,u=null,I=null,g=null,s={};return s.start=function(o,d){if(o!==null)if(typeof o=="string")if(o=o.toLowerCase(),o in i.md.algorithms)u=i.md.algorithms[o].create();else throw new Error('Unknown hash algorithm "'+o+'"');else u=o;if(d===null)d=t;else{if(typeof d=="string")d=i.util.createBuffer(d);else if(i.util.isArray(d)){var c=d;d=i.util.createBuffer();for(var T=0;T<c.length;++T)d.putByte(c[T])}var R=d.length();R>u.blockLength&&(u.start(),u.update(d.bytes()),d=u.digest()),I=i.util.createBuffer(),g=i.util.createBuffer(),R=d.length();for(var T=0;T<R;++T){var c=d.at(T);I.putByte(54^c),g.putByte(92^c)}if(R<u.blockLength)for(var c=u.blockLength-R,T=0;T<c;++T)I.putByte(54),g.putByte(92);t=d,I=I.bytes(),g=g.bytes()}u.start(),u.update(I)},s.update=function(o){u.update(o)},s.getMac=function(){var o=u.digest().bytes();return u.start(),u.update(g),u.update(o),u.digest()},s.digest=s.getMac,s},Oe.exports}const Ve=lr(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var Fe,St;function Tt(){if(St)return Fe;St=1;var i=H();xt(),pe(),X();var e=i.pkcs5=i.pkcs5||{},t;return i.util.isNodejs&&!i.options.usePureJavaScript&&(t=Ve),Fe=i.pbkdf2=e.pbkdf2=function(u,I,g,s,o,d){if(typeof o=="function"&&(d=o,o=null),i.util.isNodejs&&!i.options.usePureJavaScript&&t.pbkdf2&&(o===null||typeof o!="object")&&(t.pbkdf2Sync.length>4||!o||o==="sha1"))return typeof o!="string"&&(o="sha1"),u=Buffer.from(u,"binary"),I=Buffer.from(I,"binary"),d?t.pbkdf2Sync.length===4?t.pbkdf2(u,I,g,s,function(n,r){if(n)return d(n);d(null,r.toString("binary"))}):t.pbkdf2(u,I,g,s,o,function(n,r){if(n)return d(n);d(null,r.toString("binary"))}):t.pbkdf2Sync.length===4?t.pbkdf2Sync(u,I,g,s).toString("binary"):t.pbkdf2Sync(u,I,g,s,o).toString("binary");if((typeof o=="undefined"||o===null)&&(o="sha1"),typeof o=="string"){if(!(o in i.md.algorithms))throw new Error("Unknown hash algorithm: "+o);o=i.md[o].create()}var c=o.digestLength;if(s>4294967295*c){var T=new Error("Derived key is too long.");if(d)return d(T);throw T}var R=Math.ceil(s/c),x=s-(R-1)*c,y=i.hmac.create();y.start(o,u);var E="",v,m,a;if(!d){for(var l=1;l<=R;++l){y.start(null,null),y.update(I),y.update(i.util.int32ToBytes(l)),v=a=y.digest().getBytes();for(var h=2;h<=g;++h)y.start(null,null),y.update(a),m=y.digest().getBytes(),v=i.util.xorBytes(v,m,c),a=m;E+=l<R?v:v.substr(0,x)}return E}var l=1,h;function A(){if(l>R)return d(null,E);y.start(null,null),y.update(I),y.update(i.util.int32ToBytes(l)),v=a=y.digest().getBytes(),h=2,b()}function b(){if(h<=g)return y.start(null,null),y.update(a),m=y.digest().getBytes(),v=i.util.xorBytes(v,m,c),a=m,++h,i.util.setImmediate(b);E+=l<R?v:v.substr(0,x),++l,A()}A()},Fe}var Ke={exports:{}},It;function Me(){if(It)return Ke.exports;It=1;var i=H();X();var e=Ke.exports=i.pem=i.pem||{};e.encode=function(I,g){g=g||{};var s="-----BEGIN "+I.type+`-----\r
8
+ `,o;if(I.procType&&(o={name:"Proc-Type",values:[String(I.procType.version),I.procType.type]},s+=t(o)),I.contentDomain&&(o={name:"Content-Domain",values:[I.contentDomain]},s+=t(o)),I.dekInfo&&(o={name:"DEK-Info",values:[I.dekInfo.algorithm]},I.dekInfo.parameters&&o.values.push(I.dekInfo.parameters),s+=t(o)),I.headers)for(var d=0;d<I.headers.length;++d)s+=t(I.headers[d]);return I.procType&&(s+=`\r
9
+ `),s+=i.util.encode64(I.body,g.maxline||64)+`\r
10
+ `,s+="-----END "+I.type+`-----\r
11
+ `,s},e.decode=function(I){for(var g=[],s=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,o=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,d=/\r?\n/,c;c=s.exec(I),!!c;){var T=c[1];T==="NEW CERTIFICATE REQUEST"&&(T="CERTIFICATE REQUEST");var R={type:T,procType:null,contentDomain:null,dekInfo:null,headers:[],body:i.util.decode64(c[3])};if(g.push(R),!!c[2]){for(var x=c[2].split(d),y=0;c&&y<x.length;){for(var E=x[y].replace(/\s+$/,""),v=y+1;v<x.length;++v){var m=x[v];if(!/\s/.test(m[0]))break;E+=m,y=v}if(c=E.match(o),c){for(var a={name:c[1],values:[]},l=c[2].split(","),h=0;h<l.length;++h)a.values.push(u(l[h]));if(R.procType)if(!R.contentDomain&&a.name==="Content-Domain")R.contentDomain=l[0]||"";else if(!R.dekInfo&&a.name==="DEK-Info"){if(a.values.length===0)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');R.dekInfo={algorithm:l[0],parameters:l[1]||null}}else R.headers.push(a);else{if(a.name!=="Proc-Type")throw new Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(a.values.length!==2)throw new Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');R.procType={version:l[0],type:l[1]}}}++y}if(R.procType==="ENCRYPTED"&&!R.dekInfo)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".')}}if(g.length===0)throw new Error("Invalid PEM formatted message.");return g};function t(I){for(var g=I.name+": ",s=[],o=function(x,y){return" "+y},d=0;d<I.values.length;++d)s.push(I.values[d].replace(/^(\S+\r\n)/,o));g+=s.join(",")+`\r
12
+ `;for(var c=0,T=-1,d=0;d<g.length;++d,++c)if(c>65&&T!==-1){var R=g[T];R===","?(++T,g=g.substr(0,T)+`\r
13
+ `+g.substr(T)):g=g.substr(0,T)+`\r
14
+ `+R+g.substr(T+1),c=d-T-1,T=-1,++d}else(g[d]===" "||g[d]===" "||g[d]===",")&&(T=d);return g}function u(I){return I.replace(/^\s+/,"")}return Ke.exports}var Ce={exports:{}},qe={exports:{}},At;function dr(){if(At)return qe.exports;At=1;var i=H();pe(),X();var e=qe.exports=i.sha256=i.sha256||{};i.md.sha256=i.md.algorithms.sha256=e,e.create=function(){u||g();var o=null,d=i.util.createBuffer(),c=new Array(64),T={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8};return T.start=function(){T.messageLength=0,T.fullMessageLength=T.messageLength64=[];for(var R=T.messageLengthSize/4,x=0;x<R;++x)T.fullMessageLength.push(0);return d=i.util.createBuffer(),o={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225},T},T.start(),T.update=function(R,x){x==="utf8"&&(R=i.util.encodeUtf8(R));var y=R.length;T.messageLength+=y,y=[y/4294967296>>>0,y>>>0];for(var E=T.fullMessageLength.length-1;E>=0;--E)T.fullMessageLength[E]+=y[1],y[1]=y[0]+(T.fullMessageLength[E]/4294967296>>>0),T.fullMessageLength[E]=T.fullMessageLength[E]>>>0,y[0]=y[1]/4294967296>>>0;return d.putBytes(R),s(o,c,d),(d.read>2048||d.length()===0)&&d.compact(),T},T.digest=function(){var R=i.util.createBuffer();R.putBytes(d.bytes());var x=T.fullMessageLength[T.fullMessageLength.length-1]+T.messageLengthSize,y=x&T.blockLength-1;R.putBytes(t.substr(0,T.blockLength-y));for(var E,v,m=T.fullMessageLength[0]*8,a=0;a<T.fullMessageLength.length-1;++a)E=T.fullMessageLength[a+1]*8,v=E/4294967296>>>0,m+=v,R.putInt32(m>>>0),m=E>>>0;R.putInt32(m);var l={h0:o.h0,h1:o.h1,h2:o.h2,h3:o.h3,h4:o.h4,h5:o.h5,h6:o.h6,h7:o.h7};s(l,c,R);var h=i.util.createBuffer();return h.putInt32(l.h0),h.putInt32(l.h1),h.putInt32(l.h2),h.putInt32(l.h3),h.putInt32(l.h4),h.putInt32(l.h5),h.putInt32(l.h6),h.putInt32(l.h7),h},T};var t=null,u=!1,I=null;function g(){t="€",t+=i.util.fillString("\0",64),I=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],u=!0}function s(o,d,c){for(var T,R,x,y,E,v,m,a,l,h,A,b,n,r,f,S=c.length();S>=64;){for(m=0;m<16;++m)d[m]=c.getInt32();for(;m<64;++m)T=d[m-2],T=(T>>>17|T<<15)^(T>>>19|T<<13)^T>>>10,R=d[m-15],R=(R>>>7|R<<25)^(R>>>18|R<<14)^R>>>3,d[m]=T+d[m-7]+R+d[m-16]|0;for(a=o.h0,l=o.h1,h=o.h2,A=o.h3,b=o.h4,n=o.h5,r=o.h6,f=o.h7,m=0;m<64;++m)y=(b>>>6|b<<26)^(b>>>11|b<<21)^(b>>>25|b<<7),E=r^b&(n^r),x=(a>>>2|a<<30)^(a>>>13|a<<19)^(a>>>22|a<<10),v=a&l|h&(a^l),T=f+y+E+I[m]+d[m],R=x+v,f=r,r=n,n=b,b=A+T>>>0,A=h,h=l,l=a,a=T+R>>>0;o.h0=o.h0+a|0,o.h1=o.h1+l|0,o.h2=o.h2+h|0,o.h3=o.h3+A|0,o.h4=o.h4+b|0,o.h5=o.h5+n|0,o.h6=o.h6+r|0,o.h7=o.h7+f|0,S-=64}}return qe.exports}var Ge={exports:{}},Bt;function yr(){if(Bt)return Ge.exports;Bt=1;var i=H();X();var e=null;i.util.isNodejs&&!i.options.usePureJavaScript&&!process.versions["node-webkit"]&&(e=Ve);var t=Ge.exports=i.prng=i.prng||{};return t.create=function(u){for(var I={plugin:u,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},g=u.md,s=new Array(32),o=0;o<32;++o)s[o]=g.create();I.pools=s,I.pool=0,I.generate=function(x,y){if(!y)return I.generateSync(x);var E=I.plugin.cipher,v=I.plugin.increment,m=I.plugin.formatKey,a=I.plugin.formatSeed,l=i.util.createBuffer();I.key=null,h();function h(A){if(A)return y(A);if(l.length()>=x)return y(null,l.getBytes(x));if(I.generated>1048575&&(I.key=null),I.key===null)return i.util.nextTick(function(){d(h)});var b=E(I.key,I.seed);I.generated+=b.length,l.putBytes(b),I.key=m(E(I.key,v(I.seed))),I.seed=a(E(I.key,I.seed)),i.util.setImmediate(h)}},I.generateSync=function(x){var y=I.plugin.cipher,E=I.plugin.increment,v=I.plugin.formatKey,m=I.plugin.formatSeed;I.key=null;for(var a=i.util.createBuffer();a.length()<x;){I.generated>1048575&&(I.key=null),I.key===null&&c();var l=y(I.key,I.seed);I.generated+=l.length,a.putBytes(l),I.key=v(y(I.key,E(I.seed))),I.seed=m(y(I.key,I.seed))}return a.getBytes(x)};function d(x){if(I.pools[0].messageLength>=32)return T(),x();var y=32-I.pools[0].messageLength<<5;I.seedFile(y,function(E,v){if(E)return x(E);I.collect(v),T(),x()})}function c(){if(I.pools[0].messageLength>=32)return T();var x=32-I.pools[0].messageLength<<5;I.collect(I.seedFileSync(x)),T()}function T(){I.reseeds=I.reseeds===4294967295?0:I.reseeds+1;var x=I.plugin.md.create();x.update(I.keyBytes);for(var y=1,E=0;E<32;++E)I.reseeds%y===0&&(x.update(I.pools[E].digest().getBytes()),I.pools[E].start()),y=y<<1;I.keyBytes=x.digest().getBytes(),x.start(),x.update(I.keyBytes);var v=x.digest().getBytes();I.key=I.plugin.formatKey(I.keyBytes),I.seed=I.plugin.formatSeed(v),I.generated=0}function R(x){var y=null,E=i.util.globalScope,v=E.crypto||E.msCrypto;v&&v.getRandomValues&&(y=function(f){return v.getRandomValues(f)});var m=i.util.createBuffer();if(y)for(;m.length()<x;){var a=Math.max(1,Math.min(x-m.length(),65536)/4),l=new Uint32Array(Math.floor(a));try{y(l);for(var h=0;h<l.length;++h)m.putInt32(l[h])}catch(f){if(!(typeof QuotaExceededError!="undefined"&&f instanceof QuotaExceededError))throw f}}if(m.length()<x)for(var A,b,n,r=Math.floor(Math.random()*65536);m.length()<x;){b=16807*(r&65535),A=16807*(r>>16),b+=(A&32767)<<16,b+=A>>15,b=(b&2147483647)+(b>>31),r=b&4294967295;for(var h=0;h<3;++h)n=r>>>(h<<3),n^=Math.floor(Math.random()*256),m.putByte(n&255)}return m.getBytes(x)}return e?(I.seedFile=function(x,y){e.randomBytes(x,function(E,v){if(E)return y(E);y(null,v.toString())})},I.seedFileSync=function(x){return e.randomBytes(x).toString()}):(I.seedFile=function(x,y){try{y(null,R(x))}catch(E){y(E)}},I.seedFileSync=R),I.collect=function(x){for(var y=x.length,E=0;E<y;++E)I.pools[I.pool].update(x.substr(E,1)),I.pool=I.pool===31?0:I.pool+1},I.collectInt=function(x,y){for(var E="",v=0;v<y;v+=8)E+=String.fromCharCode(x>>v&255);I.collect(E)},I.registerWorker=function(x){if(x===self)I.seedFile=function(E,v){function m(a){var l=a.data;l.forge&&l.forge.prng&&(self.removeEventListener("message",m),v(l.forge.prng.err,l.forge.prng.bytes))}self.addEventListener("message",m),self.postMessage({forge:{prng:{needed:E}}})};else{var y=function(E){var v=E.data;v.forge&&v.forge.prng&&I.seedFile(v.forge.prng.needed,function(m,a){x.postMessage({forge:{prng:{err:m,bytes:a}}})})};x.addEventListener("message",y)}},I},Ge.exports}var bt;function de(){if(bt)return Ce.exports;bt=1;var i=H();return _e(),dr(),yr(),X(),(function(){if(i.random&&i.random.getBytes){Ce.exports=i.random;return}(function(e){var t={},u=new Array(4),I=i.util.createBuffer();t.formatKey=function(x){var y=i.util.createBuffer(x);return x=new Array(4),x[0]=y.getInt32(),x[1]=y.getInt32(),x[2]=y.getInt32(),x[3]=y.getInt32(),i.aes._expandKey(x,!1)},t.formatSeed=function(x){var y=i.util.createBuffer(x);return x=new Array(4),x[0]=y.getInt32(),x[1]=y.getInt32(),x[2]=y.getInt32(),x[3]=y.getInt32(),x},t.cipher=function(x,y){return i.aes._updateBlock(x,y,u,!1),I.putInt32(u[0]),I.putInt32(u[1]),I.putInt32(u[2]),I.putInt32(u[3]),I.getBytes()},t.increment=function(x){return++x[3],x},t.md=i.md.sha256;function g(){var x=i.prng.create(t);return x.getBytes=function(y,E){return x.generate(y,E)},x.getBytesSync=function(y){return x.generate(y)},x}var s=g(),o=null,d=i.util.globalScope,c=d.crypto||d.msCrypto;if(c&&c.getRandomValues&&(o=function(x){return c.getRandomValues(x)}),i.options.usePureJavaScript||!i.util.isNodejs&&!o){if(s.collectInt(+new Date,32),typeof navigator!="undefined"){var T="";for(var R in navigator)try{typeof navigator[R]=="string"&&(T+=navigator[R])}catch(x){}s.collect(T),T=null}e&&(e().mousemove(function(x){s.collectInt(x.clientX,16),s.collectInt(x.clientY,16)}),e().keypress(function(x){s.collectInt(x.charCode,8)}))}if(!i.random)i.random=s;else for(var R in s)i.random[R]=s[R];i.random.createInstance=g,Ce.exports=i.random})(typeof jQuery!="undefined"?jQuery:null)})(),Ce.exports}var ze,Nt;function gr(){if(Nt)return ze;Nt=1;var i=H();X();var e=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],t=[1,2,3,5],u=function(s,o){return s<<o&65535|(s&65535)>>16-o},I=function(s,o){return(s&65535)>>o|s<<16-o&65535};ze=i.rc2=i.rc2||{},i.rc2.expandKey=function(s,o){typeof s=="string"&&(s=i.util.createBuffer(s)),o=o||128;var d=s,c=s.length(),T=o,R=Math.ceil(T/8),x=255>>(T&7),y;for(y=c;y<128;y++)d.putByte(e[d.at(y-1)+d.at(y-c)&255]);for(d.setAt(128-R,e[d.at(128-R)&x]),y=127-R;y>=0;y--)d.setAt(y,e[d.at(y+1)^d.at(y+R)]);return d};var g=function(s,o,d){var c=!1,T=null,R=null,x=null,y,E,v,m,a=[];for(s=i.rc2.expandKey(s,o),v=0;v<64;v++)a.push(s.getInt16Le());d?(y=function(A){for(v=0;v<4;v++)A[v]+=a[m]+(A[(v+3)%4]&A[(v+2)%4])+(~A[(v+3)%4]&A[(v+1)%4]),A[v]=u(A[v],t[v]),m++},E=function(A){for(v=0;v<4;v++)A[v]+=a[A[(v+3)%4]&63]}):(y=function(A){for(v=3;v>=0;v--)A[v]=I(A[v],t[v]),A[v]-=a[m]+(A[(v+3)%4]&A[(v+2)%4])+(~A[(v+3)%4]&A[(v+1)%4]),m--},E=function(A){for(v=3;v>=0;v--)A[v]-=a[A[(v+3)%4]&63]});var l=function(A){var b=[];for(v=0;v<4;v++){var n=T.getInt16Le();x!==null&&(d?n^=x.getInt16Le():x.putInt16Le(n)),b.push(n&65535)}m=d?0:63;for(var r=0;r<A.length;r++)for(var f=0;f<A[r][0];f++)A[r][1](b);for(v=0;v<4;v++)x!==null&&(d?x.putInt16Le(b[v]):b[v]^=x.getInt16Le()),R.putInt16Le(b[v])},h=null;return h={start:function(A,b){A&&typeof A=="string"&&(A=i.util.createBuffer(A)),c=!1,T=i.util.createBuffer(),R=b||new i.util.createBuffer,x=A,h.output=R},update:function(A){for(c||T.putBuffer(A);T.length()>=8;)l([[5,y],[1,E],[6,y],[1,E],[5,y]])},finish:function(A){var b=!0;if(d)if(A)b=A(8,T,!d);else{var n=T.length()===8?8:8-T.length();T.fillWithByte(n,n)}if(b&&(c=!0,h.update()),!d&&(b=T.length()===0,b))if(A)b=A(8,R,!d);else{var r=R.length(),f=R.at(r-1);f>r?b=!1:R.truncate(f)}return b}},h};return i.rc2.startEncrypting=function(s,o,d){var c=i.rc2.createEncryptionCipher(s,128);return c.start(o,d),c},i.rc2.createEncryptionCipher=function(s,o){return g(s,o,!0)},i.rc2.startDecrypting=function(s,o,d){var c=i.rc2.createDecryptionCipher(s,128);return c.start(o,d),c},i.rc2.createDecryptionCipher=function(s,o){return g(s,o,!1)},ze}var Qe,Rt;function wt(){if(Rt)return Qe;Rt=1;var i=H();Qe=i.jsbn=i.jsbn||{};var e;function t(p,C,B){this.data=[],p!=null&&(typeof p=="number"?this.fromNumber(p,C,B):C==null&&typeof p!="string"?this.fromString(p,256):this.fromString(p,C))}i.jsbn.BigInteger=t;function u(){return new t(null)}function I(p,C,B,D,O,V){for(;--V>=0;){var q=C*this.data[p++]+B.data[D]+O;O=Math.floor(q/67108864),B.data[D++]=q&67108863}return O}function g(p,C,B,D,O,V){for(var q=C&32767,M=C>>15;--V>=0;){var W=this.data[p]&32767,$=this.data[p++]>>15,re=M*W+$*q;W=q*W+((re&32767)<<15)+B.data[D]+(O&1073741823),O=(W>>>30)+(re>>>15)+M*$+(O>>>30),B.data[D++]=W&1073741823}return O}function s(p,C,B,D,O,V){for(var q=C&16383,M=C>>14;--V>=0;){var W=this.data[p]&16383,$=this.data[p++]>>14,re=M*W+$*q;W=q*W+((re&16383)<<14)+B.data[D]+O,O=(W>>28)+(re>>14)+M*$,B.data[D++]=W&268435455}return O}typeof navigator=="undefined"?(t.prototype.am=s,e=28):navigator.appName=="Microsoft Internet Explorer"?(t.prototype.am=g,e=30):navigator.appName!="Netscape"?(t.prototype.am=I,e=26):(t.prototype.am=s,e=28),t.prototype.DB=e,t.prototype.DM=(1<<e)-1,t.prototype.DV=1<<e;var o=52;t.prototype.FV=Math.pow(2,o),t.prototype.F1=o-e,t.prototype.F2=2*e-o;var d="0123456789abcdefghijklmnopqrstuvwxyz",c=new Array,T,R;for(T=48,R=0;R<=9;++R)c[T++]=R;for(T=97,R=10;R<36;++R)c[T++]=R;for(T=65,R=10;R<36;++R)c[T++]=R;function x(p){return d.charAt(p)}function y(p,C){var B=c[p.charCodeAt(C)];return B==null?-1:B}function E(p){for(var C=this.t-1;C>=0;--C)p.data[C]=this.data[C];p.t=this.t,p.s=this.s}function v(p){this.t=1,this.s=p<0?-1:0,p>0?this.data[0]=p:p<-1?this.data[0]=p+this.DV:this.t=0}function m(p){var C=u();return C.fromInt(p),C}function a(p,C){var B;if(C==16)B=4;else if(C==8)B=3;else if(C==256)B=8;else if(C==2)B=1;else if(C==32)B=5;else if(C==4)B=2;else{this.fromRadix(p,C);return}this.t=0,this.s=0;for(var D=p.length,O=!1,V=0;--D>=0;){var q=B==8?p[D]&255:y(p,D);if(q<0){p.charAt(D)=="-"&&(O=!0);continue}O=!1,V==0?this.data[this.t++]=q:V+B>this.DB?(this.data[this.t-1]|=(q&(1<<this.DB-V)-1)<<V,this.data[this.t++]=q>>this.DB-V):this.data[this.t-1]|=q<<V,V+=B,V>=this.DB&&(V-=this.DB)}B==8&&(p[0]&128)!=0&&(this.s=-1,V>0&&(this.data[this.t-1]|=(1<<this.DB-V)-1<<V)),this.clamp(),O&&t.ZERO.subTo(this,this)}function l(){for(var p=this.s&this.DM;this.t>0&&this.data[this.t-1]==p;)--this.t}function h(p){if(this.s<0)return"-"+this.negate().toString(p);var C;if(p==16)C=4;else if(p==8)C=3;else if(p==2)C=1;else if(p==32)C=5;else if(p==4)C=2;else return this.toRadix(p);var B=(1<<C)-1,D,O=!1,V="",q=this.t,M=this.DB-q*this.DB%C;if(q-- >0)for(M<this.DB&&(D=this.data[q]>>M)>0&&(O=!0,V=x(D));q>=0;)M<C?(D=(this.data[q]&(1<<M)-1)<<C-M,D|=this.data[--q]>>(M+=this.DB-C)):(D=this.data[q]>>(M-=C)&B,M<=0&&(M+=this.DB,--q)),D>0&&(O=!0),O&&(V+=x(D));return O?V:"0"}function A(){var p=u();return t.ZERO.subTo(this,p),p}function b(){return this.s<0?this.negate():this}function n(p){var C=this.s-p.s;if(C!=0)return C;var B=this.t;if(C=B-p.t,C!=0)return this.s<0?-C:C;for(;--B>=0;)if((C=this.data[B]-p.data[B])!=0)return C;return 0}function r(p){var C=1,B;return(B=p>>>16)!=0&&(p=B,C+=16),(B=p>>8)!=0&&(p=B,C+=8),(B=p>>4)!=0&&(p=B,C+=4),(B=p>>2)!=0&&(p=B,C+=2),(B=p>>1)!=0&&(p=B,C+=1),C}function f(){return this.t<=0?0:this.DB*(this.t-1)+r(this.data[this.t-1]^this.s&this.DM)}function S(p,C){var B;for(B=this.t-1;B>=0;--B)C.data[B+p]=this.data[B];for(B=p-1;B>=0;--B)C.data[B]=0;C.t=this.t+p,C.s=this.s}function w(p,C){for(var B=p;B<this.t;++B)C.data[B-p]=this.data[B];C.t=Math.max(this.t-p,0),C.s=this.s}function U(p,C){var B=p%this.DB,D=this.DB-B,O=(1<<D)-1,V=Math.floor(p/this.DB),q=this.s<<B&this.DM,M;for(M=this.t-1;M>=0;--M)C.data[M+V+1]=this.data[M]>>D|q,q=(this.data[M]&O)<<B;for(M=V-1;M>=0;--M)C.data[M]=0;C.data[V]=q,C.t=this.t+V+1,C.s=this.s,C.clamp()}function N(p,C){C.s=this.s;var B=Math.floor(p/this.DB);if(B>=this.t){C.t=0;return}var D=p%this.DB,O=this.DB-D,V=(1<<D)-1;C.data[0]=this.data[B]>>D;for(var q=B+1;q<this.t;++q)C.data[q-B-1]|=(this.data[q]&V)<<O,C.data[q-B]=this.data[q]>>D;D>0&&(C.data[this.t-B-1]|=(this.s&V)<<O),C.t=this.t-B,C.clamp()}function L(p,C){for(var B=0,D=0,O=Math.min(p.t,this.t);B<O;)D+=this.data[B]-p.data[B],C.data[B++]=D&this.DM,D>>=this.DB;if(p.t<this.t){for(D-=p.s;B<this.t;)D+=this.data[B],C.data[B++]=D&this.DM,D>>=this.DB;D+=this.s}else{for(D+=this.s;B<p.t;)D-=p.data[B],C.data[B++]=D&this.DM,D>>=this.DB;D-=p.s}C.s=D<0?-1:0,D<-1?C.data[B++]=this.DV+D:D>0&&(C.data[B++]=D),C.t=B,C.clamp()}function P(p,C){var B=this.abs(),D=p.abs(),O=B.t;for(C.t=O+D.t;--O>=0;)C.data[O]=0;for(O=0;O<D.t;++O)C.data[O+B.t]=B.am(0,D.data[O],C,O,0,B.t);C.s=0,C.clamp(),this.s!=p.s&&t.ZERO.subTo(C,C)}function _(p){for(var C=this.abs(),B=p.t=2*C.t;--B>=0;)p.data[B]=0;for(B=0;B<C.t-1;++B){var D=C.am(B,C.data[B],p,2*B,0,1);(p.data[B+C.t]+=C.am(B+1,2*C.data[B],p,2*B+1,D,C.t-B-1))>=C.DV&&(p.data[B+C.t]-=C.DV,p.data[B+C.t+1]=1)}p.t>0&&(p.data[p.t-1]+=C.am(B,C.data[B],p,2*B,0,1)),p.s=0,p.clamp()}function k(p,C,B){var D=p.abs();if(!(D.t<=0)){var O=this.abs();if(O.t<D.t){C!=null&&C.fromInt(0),B!=null&&this.copyTo(B);return}B==null&&(B=u());var V=u(),q=this.s,M=p.s,W=this.DB-r(D.data[D.t-1]);W>0?(D.lShiftTo(W,V),O.lShiftTo(W,B)):(D.copyTo(V),O.copyTo(B));var $=V.t,re=V.data[$-1];if(re!=0){var ee=re*(1<<this.F1)+($>1?V.data[$-2]>>this.F2:0),fe=this.FV/ee,Se=(1<<this.F1)/ee,se=1<<this.F2,oe=B.t,Te=oe-$,le=C==null?u():C;for(V.dlShiftTo(Te,le),B.compareTo(le)>=0&&(B.data[B.t++]=1,B.subTo(le,B)),t.ONE.dlShiftTo($,le),le.subTo(V,V);V.t<$;)V.data[V.t++]=0;for(;--Te>=0;){var st=B.data[--oe]==re?this.DM:Math.floor(B.data[oe]*fe+(B.data[oe-1]+se)*Se);if((B.data[oe]+=V.am(0,st,B,Te,0,$))<st)for(V.dlShiftTo(Te,le),B.subTo(le,B);B.data[oe]<--st;)B.subTo(le,B)}C!=null&&(B.drShiftTo($,C),q!=M&&t.ZERO.subTo(C,C)),B.t=$,B.clamp(),W>0&&B.rShiftTo(W,B),q<0&&t.ZERO.subTo(B,B)}}}function F(p){var C=u();return this.abs().divRemTo(p,null,C),this.s<0&&C.compareTo(t.ZERO)>0&&p.subTo(C,C),C}function K(p){this.m=p}function G(p){return p.s<0||p.compareTo(this.m)>=0?p.mod(this.m):p}function z(p){return p}function Q(p){p.divRemTo(this.m,null,p)}function Y(p,C,B){p.multiplyTo(C,B),this.reduce(B)}function te(p,C){p.squareTo(C),this.reduce(C)}K.prototype.convert=G,K.prototype.revert=z,K.prototype.reduce=Q,K.prototype.mulTo=Y,K.prototype.sqrTo=te;function ie(){if(this.t<1)return 0;var p=this.data[0];if((p&1)==0)return 0;var C=p&3;return C=C*(2-(p&15)*C)&15,C=C*(2-(p&255)*C)&255,C=C*(2-((p&65535)*C&65535))&65535,C=C*(2-p*C%this.DV)%this.DV,C>0?this.DV-C:-C}function j(p){this.m=p,this.mp=p.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<p.DB-15)-1,this.mt2=2*p.t}function Z(p){var C=u();return p.abs().dlShiftTo(this.m.t,C),C.divRemTo(this.m,null,C),p.s<0&&C.compareTo(t.ZERO)>0&&this.m.subTo(C,C),C}function Jt(p){var C=u();return p.copyTo(C),this.reduce(C),C}function Vr(p){for(;p.t<=this.mt2;)p.data[p.t++]=0;for(var C=0;C<this.m.t;++C){var B=p.data[C]&32767,D=B*this.mpl+((B*this.mph+(p.data[C]>>15)*this.mpl&this.um)<<15)&p.DM;for(B=C+this.m.t,p.data[B]+=this.m.am(0,D,p,C,0,this.m.t);p.data[B]>=p.DV;)p.data[B]-=p.DV,p.data[++B]++}p.clamp(),p.drShiftTo(this.m.t,p),p.compareTo(this.m)>=0&&p.subTo(this.m,p)}function Fr(p,C){p.squareTo(C),this.reduce(C)}function Kr(p,C,B){p.multiplyTo(C,B),this.reduce(B)}j.prototype.convert=Z,j.prototype.revert=Jt,j.prototype.reduce=Vr,j.prototype.mulTo=Kr,j.prototype.sqrTo=Fr;function Mr(){return(this.t>0?this.data[0]&1:this.s)==0}function qr(p,C){if(p>4294967295||p<1)return t.ONE;var B=u(),D=u(),O=C.convert(this),V=r(p)-1;for(O.copyTo(B);--V>=0;)if(C.sqrTo(B,D),(p&1<<V)>0)C.mulTo(D,O,B);else{var q=B;B=D,D=q}return C.revert(B)}function Gr(p,C){var B;return p<256||C.isEven()?B=new K(C):B=new j(C),this.exp(p,B)}t.prototype.copyTo=E,t.prototype.fromInt=v,t.prototype.fromString=a,t.prototype.clamp=l,t.prototype.dlShiftTo=S,t.prototype.drShiftTo=w,t.prototype.lShiftTo=U,t.prototype.rShiftTo=N,t.prototype.subTo=L,t.prototype.multiplyTo=P,t.prototype.squareTo=_,t.prototype.divRemTo=k,t.prototype.invDigit=ie,t.prototype.isEven=Mr,t.prototype.exp=qr,t.prototype.toString=h,t.prototype.negate=A,t.prototype.abs=b,t.prototype.compareTo=n,t.prototype.bitLength=f,t.prototype.mod=F,t.prototype.modPowInt=Gr,t.ZERO=m(0),t.ONE=m(1);function zr(){var p=u();return this.copyTo(p),p}function Qr(){if(this.s<0){if(this.t==1)return this.data[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this.data[0];if(this.t==0)return 0}return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]}function Hr(){return this.t==0?this.s:this.data[0]<<24>>24}function Wr(){return this.t==0?this.s:this.data[0]<<16>>16}function Xr(p){return Math.floor(Math.LN2*this.DB/Math.log(p))}function Yr(){return this.s<0?-1:this.t<=0||this.t==1&&this.data[0]<=0?0:1}function $r(p){if(p==null&&(p=10),this.signum()==0||p<2||p>36)return"0";var C=this.chunkSize(p),B=Math.pow(p,C),D=m(B),O=u(),V=u(),q="";for(this.divRemTo(D,O,V);O.signum()>0;)q=(B+V.intValue()).toString(p).substr(1)+q,O.divRemTo(D,O,V);return V.intValue().toString(p)+q}function jr(p,C){this.fromInt(0),C==null&&(C=10);for(var B=this.chunkSize(C),D=Math.pow(C,B),O=!1,V=0,q=0,M=0;M<p.length;++M){var W=y(p,M);if(W<0){p.charAt(M)=="-"&&this.signum()==0&&(O=!0);continue}q=C*q+W,++V>=B&&(this.dMultiply(D),this.dAddOffset(q,0),V=0,q=0)}V>0&&(this.dMultiply(Math.pow(C,V)),this.dAddOffset(q,0)),O&&t.ZERO.subTo(this,this)}function Zr(p,C,B){if(typeof C=="number")if(p<2)this.fromInt(1);else for(this.fromNumber(p,B),this.testBit(p-1)||this.bitwiseTo(t.ONE.shiftLeft(p-1),nt,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(C);)this.dAddOffset(2,0),this.bitLength()>p&&this.subTo(t.ONE.shiftLeft(p-1),this);else{var D=new Array,O=p&7;D.length=(p>>3)+1,C.nextBytes(D),O>0?D[0]&=(1<<O)-1:D[0]=0,this.fromString(D,256)}}function Jr(){var p=this.t,C=new Array;C[0]=this.s;var B=this.DB-p*this.DB%8,D,O=0;if(p-- >0)for(B<this.DB&&(D=this.data[p]>>B)!=(this.s&this.DM)>>B&&(C[O++]=D|this.s<<this.DB-B);p>=0;)B<8?(D=(this.data[p]&(1<<B)-1)<<8-B,D|=this.data[--p]>>(B+=this.DB-8)):(D=this.data[p]>>(B-=8)&255,B<=0&&(B+=this.DB,--p)),(D&128)!=0&&(D|=-256),O==0&&(this.s&128)!=(D&128)&&++O,(O>0||D!=this.s)&&(C[O++]=D);return C}function ea(p){return this.compareTo(p)==0}function ta(p){return this.compareTo(p)<0?this:p}function ra(p){return this.compareTo(p)>0?this:p}function aa(p,C,B){var D,O,V=Math.min(p.t,this.t);for(D=0;D<V;++D)B.data[D]=C(this.data[D],p.data[D]);if(p.t<this.t){for(O=p.s&this.DM,D=V;D<this.t;++D)B.data[D]=C(this.data[D],O);B.t=this.t}else{for(O=this.s&this.DM,D=V;D<p.t;++D)B.data[D]=C(O,p.data[D]);B.t=p.t}B.s=C(this.s,p.s),B.clamp()}function ia(p,C){return p&C}function na(p){var C=u();return this.bitwiseTo(p,ia,C),C}function nt(p,C){return p|C}function sa(p){var C=u();return this.bitwiseTo(p,nt,C),C}function er(p,C){return p^C}function oa(p){var C=u();return this.bitwiseTo(p,er,C),C}function tr(p,C){return p&~C}function ua(p){var C=u();return this.bitwiseTo(p,tr,C),C}function fa(){for(var p=u(),C=0;C<this.t;++C)p.data[C]=this.DM&~this.data[C];return p.t=this.t,p.s=~this.s,p}function la(p){var C=u();return p<0?this.rShiftTo(-p,C):this.lShiftTo(p,C),C}function ca(p){var C=u();return p<0?this.lShiftTo(-p,C):this.rShiftTo(p,C),C}function ha(p){if(p==0)return-1;var C=0;return(p&65535)==0&&(p>>=16,C+=16),(p&255)==0&&(p>>=8,C+=8),(p&15)==0&&(p>>=4,C+=4),(p&3)==0&&(p>>=2,C+=2),(p&1)==0&&++C,C}function pa(){for(var p=0;p<this.t;++p)if(this.data[p]!=0)return p*this.DB+ha(this.data[p]);return this.s<0?this.t*this.DB:-1}function da(p){for(var C=0;p!=0;)p&=p-1,++C;return C}function ya(){for(var p=0,C=this.s&this.DM,B=0;B<this.t;++B)p+=da(this.data[B]^C);return p}function ga(p){var C=Math.floor(p/this.DB);return C>=this.t?this.s!=0:(this.data[C]&1<<p%this.DB)!=0}function va(p,C){var B=t.ONE.shiftLeft(p);return this.bitwiseTo(B,C,B),B}function Ca(p){return this.changeBit(p,nt)}function Ea(p){return this.changeBit(p,tr)}function ma(p){return this.changeBit(p,er)}function xa(p,C){for(var B=0,D=0,O=Math.min(p.t,this.t);B<O;)D+=this.data[B]+p.data[B],C.data[B++]=D&this.DM,D>>=this.DB;if(p.t<this.t){for(D+=p.s;B<this.t;)D+=this.data[B],C.data[B++]=D&this.DM,D>>=this.DB;D+=this.s}else{for(D+=this.s;B<p.t;)D+=p.data[B],C.data[B++]=D&this.DM,D>>=this.DB;D+=p.s}C.s=D<0?-1:0,D>0?C.data[B++]=D:D<-1&&(C.data[B++]=this.DV+D),C.t=B,C.clamp()}function Sa(p){var C=u();return this.addTo(p,C),C}function Ta(p){var C=u();return this.subTo(p,C),C}function Ia(p){var C=u();return this.multiplyTo(p,C),C}function Aa(){var p=u();return this.squareTo(p),p}function Ba(p){var C=u();return this.divRemTo(p,C,null),C}function ba(p){var C=u();return this.divRemTo(p,null,C),C}function Na(p){var C=u(),B=u();return this.divRemTo(p,C,B),new Array(C,B)}function Ra(p){this.data[this.t]=this.am(0,p-1,this,0,0,this.t),++this.t,this.clamp()}function wa(p,C){if(p!=0){for(;this.t<=C;)this.data[this.t++]=0;for(this.data[C]+=p;this.data[C]>=this.DV;)this.data[C]-=this.DV,++C>=this.t&&(this.data[this.t++]=0),++this.data[C]}}function ve(){}function rr(p){return p}function Ua(p,C,B){p.multiplyTo(C,B)}function La(p,C){p.squareTo(C)}ve.prototype.convert=rr,ve.prototype.revert=rr,ve.prototype.mulTo=Ua,ve.prototype.sqrTo=La;function Da(p){return this.exp(p,new ve)}function _a(p,C,B){var D=Math.min(this.t+p.t,C);for(B.s=0,B.t=D;D>0;)B.data[--D]=0;var O;for(O=B.t-this.t;D<O;++D)B.data[D+this.t]=this.am(0,p.data[D],B,D,0,this.t);for(O=Math.min(p.t,C);D<O;++D)this.am(0,p.data[D],B,D,0,C-D);B.clamp()}function Pa(p,C,B){--C;var D=B.t=this.t+p.t-C;for(B.s=0;--D>=0;)B.data[D]=0;for(D=Math.max(C-this.t,0);D<p.t;++D)B.data[this.t+D-C]=this.am(C-D,p.data[D],B,0,0,this.t+D-C);B.clamp(),B.drShiftTo(1,B)}function ge(p){this.r2=u(),this.q3=u(),t.ONE.dlShiftTo(2*p.t,this.r2),this.mu=this.r2.divide(p),this.m=p}function ka(p){if(p.s<0||p.t>2*this.m.t)return p.mod(this.m);if(p.compareTo(this.m)<0)return p;var C=u();return p.copyTo(C),this.reduce(C),C}function Oa(p){return p}function Va(p){for(p.drShiftTo(this.m.t-1,this.r2),p.t>this.m.t+1&&(p.t=this.m.t+1,p.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);p.compareTo(this.r2)<0;)p.dAddOffset(1,this.m.t+1);for(p.subTo(this.r2,p);p.compareTo(this.m)>=0;)p.subTo(this.m,p)}function Fa(p,C){p.squareTo(C),this.reduce(C)}function Ka(p,C,B){p.multiplyTo(C,B),this.reduce(B)}ge.prototype.convert=ka,ge.prototype.revert=Oa,ge.prototype.reduce=Va,ge.prototype.mulTo=Ka,ge.prototype.sqrTo=Fa;function Ma(p,C){var B=p.bitLength(),D,O=m(1),V;if(B<=0)return O;B<18?D=1:B<48?D=3:B<144?D=4:B<768?D=5:D=6,B<8?V=new K(C):C.isEven()?V=new ge(C):V=new j(C);var q=new Array,M=3,W=D-1,$=(1<<D)-1;if(q[1]=V.convert(this),D>1){var re=u();for(V.sqrTo(q[1],re);M<=$;)q[M]=u(),V.mulTo(re,q[M-2],q[M]),M+=2}var ee=p.t-1,fe,Se=!0,se=u(),oe;for(B=r(p.data[ee])-1;ee>=0;){for(B>=W?fe=p.data[ee]>>B-W&$:(fe=(p.data[ee]&(1<<B+1)-1)<<W-B,ee>0&&(fe|=p.data[ee-1]>>this.DB+B-W)),M=D;(fe&1)==0;)fe>>=1,--M;if((B-=M)<0&&(B+=this.DB,--ee),Se)q[fe].copyTo(O),Se=!1;else{for(;M>1;)V.sqrTo(O,se),V.sqrTo(se,O),M-=2;M>0?V.sqrTo(O,se):(oe=O,O=se,se=oe),V.mulTo(se,q[fe],O)}for(;ee>=0&&(p.data[ee]&1<<B)==0;)V.sqrTo(O,se),oe=O,O=se,se=oe,--B<0&&(B=this.DB-1,--ee)}return V.revert(O)}function qa(p){var C=this.s<0?this.negate():this.clone(),B=p.s<0?p.negate():p.clone();if(C.compareTo(B)<0){var D=C;C=B,B=D}var O=C.getLowestSetBit(),V=B.getLowestSetBit();if(V<0)return C;for(O<V&&(V=O),V>0&&(C.rShiftTo(V,C),B.rShiftTo(V,B));C.signum()>0;)(O=C.getLowestSetBit())>0&&C.rShiftTo(O,C),(O=B.getLowestSetBit())>0&&B.rShiftTo(O,B),C.compareTo(B)>=0?(C.subTo(B,C),C.rShiftTo(1,C)):(B.subTo(C,B),B.rShiftTo(1,B));return V>0&&B.lShiftTo(V,B),B}function Ga(p){if(p<=0)return 0;var C=this.DV%p,B=this.s<0?p-1:0;if(this.t>0)if(C==0)B=this.data[0]%p;else for(var D=this.t-1;D>=0;--D)B=(C*B+this.data[D])%p;return B}function za(p){if(this.signum()==0)return t.ZERO;var C=p.isEven();if(this.isEven()&&C||p.signum()==0)return t.ZERO;for(var B=p.clone(),D=this.clone(),O=m(1),V=m(0),q=m(0),M=m(1);B.signum()!=0;){for(;B.isEven();)B.rShiftTo(1,B),C?((!O.isEven()||!V.isEven())&&(O.addTo(this,O),V.subTo(p,V)),O.rShiftTo(1,O)):V.isEven()||V.subTo(p,V),V.rShiftTo(1,V);for(;D.isEven();)D.rShiftTo(1,D),C?((!q.isEven()||!M.isEven())&&(q.addTo(this,q),M.subTo(p,M)),q.rShiftTo(1,q)):M.isEven()||M.subTo(p,M),M.rShiftTo(1,M);B.compareTo(D)>=0?(B.subTo(D,B),C&&O.subTo(q,O),V.subTo(M,V)):(D.subTo(B,D),C&&q.subTo(O,q),M.subTo(V,M))}if(D.compareTo(t.ONE)!=0)return t.ZERO;if(M.compareTo(p)>=0)return M.subtract(p);if(M.signum()<0)M.addTo(p,M);else return M;return M.signum()<0?M.add(p):M}var ne=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],Qa=(1<<26)/ne[ne.length-1];function Ha(p){var C,B=this.abs();if(B.t==1&&B.data[0]<=ne[ne.length-1]){for(C=0;C<ne.length;++C)if(B.data[0]==ne[C])return!0;return!1}if(B.isEven())return!1;for(C=1;C<ne.length;){for(var D=ne[C],O=C+1;O<ne.length&&D<Qa;)D*=ne[O++];for(D=B.modInt(D);C<O;)if(D%ne[C++]==0)return!1}return B.millerRabin(p)}function Wa(p){var C=this.subtract(t.ONE),B=C.getLowestSetBit();if(B<=0)return!1;for(var D=C.shiftRight(B),O=Xa(),V,q=0;q<p;++q){do V=new t(this.bitLength(),O);while(V.compareTo(t.ONE)<=0||V.compareTo(C)>=0);var M=V.modPow(D,this);if(M.compareTo(t.ONE)!=0&&M.compareTo(C)!=0){for(var W=1;W++<B&&M.compareTo(C)!=0;)if(M=M.modPowInt(2,this),M.compareTo(t.ONE)==0)return!1;if(M.compareTo(C)!=0)return!1}}return!0}function Xa(){return{nextBytes:function(p){for(var C=0;C<p.length;++C)p[C]=Math.floor(Math.random()*256)}}}return t.prototype.chunkSize=Xr,t.prototype.toRadix=$r,t.prototype.fromRadix=jr,t.prototype.fromNumber=Zr,t.prototype.bitwiseTo=aa,t.prototype.changeBit=va,t.prototype.addTo=xa,t.prototype.dMultiply=Ra,t.prototype.dAddOffset=wa,t.prototype.multiplyLowerTo=_a,t.prototype.multiplyUpperTo=Pa,t.prototype.modInt=Ga,t.prototype.millerRabin=Wa,t.prototype.clone=zr,t.prototype.intValue=Qr,t.prototype.byteValue=Hr,t.prototype.shortValue=Wr,t.prototype.signum=Yr,t.prototype.toByteArray=Jr,t.prototype.equals=ea,t.prototype.min=ta,t.prototype.max=ra,t.prototype.and=na,t.prototype.or=sa,t.prototype.xor=oa,t.prototype.andNot=ua,t.prototype.not=fa,t.prototype.shiftLeft=la,t.prototype.shiftRight=ca,t.prototype.getLowestSetBit=pa,t.prototype.bitCount=ya,t.prototype.testBit=ga,t.prototype.setBit=Ca,t.prototype.clearBit=Ea,t.prototype.flipBit=ma,t.prototype.add=Sa,t.prototype.subtract=Ta,t.prototype.multiply=Ia,t.prototype.divide=Ba,t.prototype.remainder=ba,t.prototype.divideAndRemainder=Na,t.prototype.modPow=Ma,t.prototype.modInverse=za,t.prototype.pow=Da,t.prototype.gcd=qa,t.prototype.isProbablePrime=Ha,t.prototype.square=Aa,Qe}var He={exports:{}},We={exports:{}},Ut;function Lt(){if(Ut)return We.exports;Ut=1;var i=H();pe(),X();var e=We.exports=i.sha1=i.sha1||{};i.md.sha1=i.md.algorithms.sha1=e,e.create=function(){u||I();var s=null,o=i.util.createBuffer(),d=new Array(80),c={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8};return c.start=function(){c.messageLength=0,c.fullMessageLength=c.messageLength64=[];for(var T=c.messageLengthSize/4,R=0;R<T;++R)c.fullMessageLength.push(0);return o=i.util.createBuffer(),s={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},c},c.start(),c.update=function(T,R){R==="utf8"&&(T=i.util.encodeUtf8(T));var x=T.length;c.messageLength+=x,x=[x/4294967296>>>0,x>>>0];for(var y=c.fullMessageLength.length-1;y>=0;--y)c.fullMessageLength[y]+=x[1],x[1]=x[0]+(c.fullMessageLength[y]/4294967296>>>0),c.fullMessageLength[y]=c.fullMessageLength[y]>>>0,x[0]=x[1]/4294967296>>>0;return o.putBytes(T),g(s,d,o),(o.read>2048||o.length()===0)&&o.compact(),c},c.digest=function(){var T=i.util.createBuffer();T.putBytes(o.bytes());var R=c.fullMessageLength[c.fullMessageLength.length-1]+c.messageLengthSize,x=R&c.blockLength-1;T.putBytes(t.substr(0,c.blockLength-x));for(var y,E,v=c.fullMessageLength[0]*8,m=0;m<c.fullMessageLength.length-1;++m)y=c.fullMessageLength[m+1]*8,E=y/4294967296>>>0,v+=E,T.putInt32(v>>>0),v=y>>>0;T.putInt32(v);var a={h0:s.h0,h1:s.h1,h2:s.h2,h3:s.h3,h4:s.h4};g(a,d,T);var l=i.util.createBuffer();return l.putInt32(a.h0),l.putInt32(a.h1),l.putInt32(a.h2),l.putInt32(a.h3),l.putInt32(a.h4),l},c};var t=null,u=!1;function I(){t="€",t+=i.util.fillString("\0",64),u=!0}function g(s,o,d){for(var c,T,R,x,y,E,v,m,a=d.length();a>=64;){for(T=s.h0,R=s.h1,x=s.h2,y=s.h3,E=s.h4,m=0;m<16;++m)c=d.getInt32(),o[m]=c,v=y^R&(x^y),c=(T<<5|T>>>27)+v+E+1518500249+c,E=y,y=x,x=(R<<30|R>>>2)>>>0,R=T,T=c;for(;m<20;++m)c=o[m-3]^o[m-8]^o[m-14]^o[m-16],c=c<<1|c>>>31,o[m]=c,v=y^R&(x^y),c=(T<<5|T>>>27)+v+E+1518500249+c,E=y,y=x,x=(R<<30|R>>>2)>>>0,R=T,T=c;for(;m<32;++m)c=o[m-3]^o[m-8]^o[m-14]^o[m-16],c=c<<1|c>>>31,o[m]=c,v=R^x^y,c=(T<<5|T>>>27)+v+E+1859775393+c,E=y,y=x,x=(R<<30|R>>>2)>>>0,R=T,T=c;for(;m<40;++m)c=o[m-6]^o[m-16]^o[m-28]^o[m-32],c=c<<2|c>>>30,o[m]=c,v=R^x^y,c=(T<<5|T>>>27)+v+E+1859775393+c,E=y,y=x,x=(R<<30|R>>>2)>>>0,R=T,T=c;for(;m<60;++m)c=o[m-6]^o[m-16]^o[m-28]^o[m-32],c=c<<2|c>>>30,o[m]=c,v=R&x|y&(R^x),c=(T<<5|T>>>27)+v+E+2400959708+c,E=y,y=x,x=(R<<30|R>>>2)>>>0,R=T,T=c;for(;m<80;++m)c=o[m-6]^o[m-16]^o[m-28]^o[m-32],c=c<<2|c>>>30,o[m]=c,v=R^x^y,c=(T<<5|T>>>27)+v+E+3395469782+c,E=y,y=x,x=(R<<30|R>>>2)>>>0,R=T,T=c;s.h0=s.h0+T|0,s.h1=s.h1+R|0,s.h2=s.h2+x|0,s.h3=s.h3+y|0,s.h4=s.h4+E|0,a-=64}}return We.exports}var Dt;function vr(){if(Dt)return He.exports;Dt=1;var i=H();X(),de(),Lt();var e=He.exports=i.pkcs1=i.pkcs1||{};e.encode_rsa_oaep=function(u,I,g){var s,o,d,c;typeof g=="string"?(s=g,o=arguments[3]||void 0,d=arguments[4]||void 0):g&&(s=g.label||void 0,o=g.seed||void 0,d=g.md||void 0,g.mgf1&&g.mgf1.md&&(c=g.mgf1.md)),d?d.start():d=i.md.sha1.create(),c||(c=d);var T=Math.ceil(u.n.bitLength()/8),R=T-2*d.digestLength-2;if(I.length>R){var x=new Error("RSAES-OAEP input message length is too long.");throw x.length=I.length,x.maxLength=R,x}s||(s=""),d.update(s,"raw");for(var y=d.digest(),E="",v=R-I.length,m=0;m<v;m++)E+="\0";var a=y.getBytes()+E+""+I;if(!o)o=i.random.getBytes(d.digestLength);else if(o.length!==d.digestLength){var x=new Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.");throw x.seedLength=o.length,x.digestLength=d.digestLength,x}var l=t(o,T-d.digestLength-1,c),h=i.util.xorBytes(a,l,a.length),A=t(h,d.digestLength,c),b=i.util.xorBytes(o,A,o.length);return"\0"+b+h},e.decode_rsa_oaep=function(u,I,g){var s,o,d;typeof g=="string"?(s=g,o=arguments[3]||void 0):g&&(s=g.label||void 0,o=g.md||void 0,g.mgf1&&g.mgf1.md&&(d=g.mgf1.md));var c=Math.ceil(u.n.bitLength()/8);if(I.length!==c){var h=new Error("RSAES-OAEP encoded message length is invalid.");throw h.length=I.length,h.expectedLength=c,h}if(o===void 0?o=i.md.sha1.create():o.start(),d||(d=o),c<2*o.digestLength+2)throw new Error("RSAES-OAEP key is too short for the hash function.");s||(s=""),o.update(s,"raw");for(var T=o.digest().getBytes(),R=I.charAt(0),x=I.substring(1,o.digestLength+1),y=I.substring(1+o.digestLength),E=t(y,o.digestLength,d),v=i.util.xorBytes(x,E,x.length),m=t(v,c-o.digestLength-1,d),a=i.util.xorBytes(y,m,y.length),l=a.substring(0,o.digestLength),h=R!=="\0",A=0;A<o.digestLength;++A)h|=T.charAt(A)!==l.charAt(A);for(var b=1,n=o.digestLength,r=o.digestLength;r<a.length;r++){var f=a.charCodeAt(r),S=f&1^1,w=b?65534:0;h|=f&w,b=b&S,n+=b}if(h||a.charCodeAt(n)!==1)throw new Error("Invalid RSAES-OAEP padding.");return a.substring(n+1)};function t(u,I,g){g||(g=i.md.sha1.create());for(var s="",o=Math.ceil(I/g.digestLength),d=0;d<o;++d){var c=String.fromCharCode(d>>24&255,d>>16&255,d>>8&255,d&255);g.start(),g.update(u+c),s+=g.digest().getBytes()}return s.substring(0,I)}return He.exports}var Ee={exports:{}},_t;function Cr(){if(_t)return Ee.exports;_t=1;var i=H();return X(),wt(),de(),(function(){if(i.prime){Ee.exports=i.prime;return}var e=Ee.exports=i.prime=i.prime||{},t=i.jsbn.BigInteger,u=[6,4,2,4,2,4,6,2],I=new t(null);I.fromInt(30);var g=function(x,y){return x|y};e.generateProbablePrime=function(x,y,E){typeof y=="function"&&(E=y,y={}),y=y||{};var v=y.algorithm||"PRIMEINC";typeof v=="string"&&(v={name:v}),v.options=v.options||{};var m=y.prng||i.random,a={nextBytes:function(l){for(var h=m.getBytesSync(l.length),A=0;A<l.length;++A)l[A]=h.charCodeAt(A)}};if(v.name==="PRIMEINC")return s(x,a,v.options,E);throw new Error("Invalid prime generation algorithm: "+v.name)};function s(x,y,E,v){return"workers"in E?c(x,y,E,v):o(x,y,E,v)}function o(x,y,E,v){var m=T(x,y),a=0,l=R(m.bitLength());"millerRabinTests"in E&&(l=E.millerRabinTests);var h=10;"maxBlockTime"in E&&(h=E.maxBlockTime),d(m,x,y,a,l,h,v)}function d(x,y,E,v,m,a,l){var h=+new Date;do{if(x.bitLength()>y&&(x=T(y,E)),x.isProbablePrime(m))return l(null,x);x.dAddOffset(u[v++%8],0)}while(a<0||+new Date-h<a);i.util.setImmediate(function(){d(x,y,E,v,m,a,l)})}function c(x,y,E,v){if(typeof Worker=="undefined")return o(x,y,E,v);var m=T(x,y),a=E.workers,l=E.workLoad||100,h=l*30/8,A=E.workerScript||"forge/prime.worker.js";if(a===-1)return i.util.estimateCores(function(n,r){n&&(r=2),a=r-1,b()});b();function b(){a=Math.max(1,a);for(var n=[],r=0;r<a;++r)n[r]=new Worker(A);for(var r=0;r<a;++r)n[r].addEventListener("message",S);var f=!1;function S(w){if(!f){var U=w.data;if(U.found){for(var N=0;N<n.length;++N)n[N].terminate();return f=!0,v(null,new t(U.prime,16))}m.bitLength()>x&&(m=T(x,y));var L=m.toString(16);w.target.postMessage({hex:L,workLoad:l}),m.dAddOffset(h,0)}}}}function T(x,y){var E=new t(x,y),v=x-1;return E.testBit(v)||E.bitwiseTo(t.ONE.shiftLeft(v),g,E),E.dAddOffset(31-E.mod(I).byteValue(),0),E}function R(x){return x<=100?27:x<=150?18:x<=200?15:x<=250?12:x<=300?9:x<=350?8:x<=400?7:x<=500?6:x<=600?5:x<=800?4:x<=1250?3:2}})(),Ee.exports}var Xe,Pt;function me(){if(Pt)return Xe;Pt=1;var i=H();if(ce(),wt(),he(),vr(),Cr(),de(),X(),typeof e=="undefined")var e=i.jsbn.BigInteger;var t=i.util.isNodejs?Ve:null,u=i.asn1,I=i.util;i.pki=i.pki||{},Xe=i.pki.rsa=i.rsa=i.rsa||{};var g=i.pki,s=[6,4,2,4,2,4,6,2],o={name:"PrivateKeyInfo",tagClass:u.Class.UNIVERSAL,type:u.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:u.Class.UNIVERSAL,type:u.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:u.Class.UNIVERSAL,type:u.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:u.Class.UNIVERSAL,type:u.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:u.Class.UNIVERSAL,type:u.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},d={name:"RSAPrivateKey",tagClass:u.Class.UNIVERSAL,type:u.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:u.Class.UNIVERSAL,type:u.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:u.Class.UNIVERSAL,type:u.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:u.Class.UNIVERSAL,type:u.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:u.Class.UNIVERSAL,type:u.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:u.Class.UNIVERSAL,type:u.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:u.Class.UNIVERSAL,type:u.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:u.Class.UNIVERSAL,type:u.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:u.Class.UNIVERSAL,type:u.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:u.Class.UNIVERSAL,type:u.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},c={name:"RSAPublicKey",tagClass:u.Class.UNIVERSAL,type:u.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:u.Class.UNIVERSAL,type:u.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:u.Class.UNIVERSAL,type:u.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},T=i.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:u.Class.UNIVERSAL,type:u.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:u.Class.UNIVERSAL,type:u.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:u.Class.UNIVERSAL,type:u.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:u.Class.UNIVERSAL,type:u.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:u.Class.UNIVERSAL,type:u.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},R={name:"DigestInfo",tagClass:u.Class.UNIVERSAL,type:u.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm",tagClass:u.Class.UNIVERSAL,type:u.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm.algorithmIdentifier",tagClass:u.Class.UNIVERSAL,type:u.Type.OID,constructed:!1,capture:"algorithmIdentifier"},{name:"DigestInfo.DigestAlgorithm.parameters",tagClass:u.Class.UNIVERSAL,type:u.Type.NULL,capture:"parameters",optional:!0,constructed:!1}]},{name:"DigestInfo.digest",tagClass:u.Class.UNIVERSAL,type:u.Type.OCTETSTRING,constructed:!1,capture:"digest"}]},x=function(r){var f;if(r.algorithm in g.oids)f=g.oids[r.algorithm];else{var S=new Error("Unknown message digest algorithm.");throw S.algorithm=r.algorithm,S}var w=u.oidToDer(f).getBytes(),U=u.create(u.Class.UNIVERSAL,u.Type.SEQUENCE,!0,[]),N=u.create(u.Class.UNIVERSAL,u.Type.SEQUENCE,!0,[]);N.value.push(u.create(u.Class.UNIVERSAL,u.Type.OID,!1,w)),N.value.push(u.create(u.Class.UNIVERSAL,u.Type.NULL,!1,""));var L=u.create(u.Class.UNIVERSAL,u.Type.OCTETSTRING,!1,r.digest().getBytes());return U.value.push(N),U.value.push(L),u.toDer(U).getBytes()},y=function(r,f,S){if(S)return r.modPow(f.e,f.n);if(!f.p||!f.q)return r.modPow(f.d,f.n);f.dP||(f.dP=f.d.mod(f.p.subtract(e.ONE))),f.dQ||(f.dQ=f.d.mod(f.q.subtract(e.ONE))),f.qInv||(f.qInv=f.q.modInverse(f.p));var w;do w=new e(i.util.bytesToHex(i.random.getBytes(f.n.bitLength()/8)),16);while(w.compareTo(f.n)>=0||!w.gcd(f.n).equals(e.ONE));r=r.multiply(w.modPow(f.e,f.n)).mod(f.n);for(var U=r.mod(f.p).modPow(f.dP,f.p),N=r.mod(f.q).modPow(f.dQ,f.q);U.compareTo(N)<0;)U=U.add(f.p);var L=U.subtract(N).multiply(f.qInv).mod(f.p).multiply(f.q).add(N);return L=L.multiply(w.modInverse(f.n)).mod(f.n),L};g.rsa.encrypt=function(r,f,S){var w=S,U,N=Math.ceil(f.n.bitLength()/8);S!==!1&&S!==!0?(w=S===2,U=E(r,f,S)):(U=i.util.createBuffer(),U.putBytes(r));for(var L=new e(U.toHex(),16),P=y(L,f,w),_=P.toString(16),k=i.util.createBuffer(),F=N-Math.ceil(_.length/2);F>0;)k.putByte(0),--F;return k.putBytes(i.util.hexToBytes(_)),k.getBytes()},g.rsa.decrypt=function(r,f,S,w){var U=Math.ceil(f.n.bitLength()/8);if(r.length!==U){var N=new Error("Encrypted message length is invalid.");throw N.length=r.length,N.expected=U,N}var L=new e(i.util.createBuffer(r).toHex(),16);if(L.compareTo(f.n)>=0)throw new Error("Encrypted message is invalid.");for(var P=y(L,f,S),_=P.toString(16),k=i.util.createBuffer(),F=U-Math.ceil(_.length/2);F>0;)k.putByte(0),--F;return k.putBytes(i.util.hexToBytes(_)),w!==!1?v(k.getBytes(),f,S):k.getBytes()},g.rsa.createKeyPairGenerationState=function(r,f,S){typeof r=="string"&&(r=parseInt(r,10)),r=r||2048,S=S||{};var w=S.prng||i.random,U={nextBytes:function(P){for(var _=w.getBytesSync(P.length),k=0;k<P.length;++k)P[k]=_.charCodeAt(k)}},N=S.algorithm||"PRIMEINC",L;if(N==="PRIMEINC")L={algorithm:N,state:0,bits:r,rng:U,eInt:f||65537,e:new e(null),p:null,q:null,qBits:r>>1,pBits:r-(r>>1),pqState:0,num:null,keys:null},L.e.fromInt(L.eInt);else throw new Error("Invalid key generation algorithm: "+N);return L},g.rsa.stepKeyPairGenerationState=function(r,f){"algorithm"in r||(r.algorithm="PRIMEINC");var S=new e(null);S.fromInt(30);for(var w=0,U=function(K,G){return K|G},N=+new Date,L,P=0;r.keys===null&&(f<=0||P<f);){if(r.state===0){var _=r.p===null?r.pBits:r.qBits,k=_-1;r.pqState===0?(r.num=new e(_,r.rng),r.num.testBit(k)||r.num.bitwiseTo(e.ONE.shiftLeft(k),U,r.num),r.num.dAddOffset(31-r.num.mod(S).byteValue(),0),w=0,++r.pqState):r.pqState===1?r.num.bitLength()>_?r.pqState=0:r.num.isProbablePrime(l(r.num.bitLength()))?++r.pqState:r.num.dAddOffset(s[w++%8],0):r.pqState===2?r.pqState=r.num.subtract(e.ONE).gcd(r.e).compareTo(e.ONE)===0?3:0:r.pqState===3&&(r.pqState=0,r.p===null?r.p=r.num:r.q=r.num,r.p!==null&&r.q!==null&&++r.state,r.num=null)}else if(r.state===1)r.p.compareTo(r.q)<0&&(r.num=r.p,r.p=r.q,r.q=r.num),++r.state;else if(r.state===2)r.p1=r.p.subtract(e.ONE),r.q1=r.q.subtract(e.ONE),r.phi=r.p1.multiply(r.q1),++r.state;else if(r.state===3)r.phi.gcd(r.e).compareTo(e.ONE)===0?++r.state:(r.p=null,r.q=null,r.state=0);else if(r.state===4)r.n=r.p.multiply(r.q),r.n.bitLength()===r.bits?++r.state:(r.q=null,r.state=0);else if(r.state===5){var F=r.e.modInverse(r.phi);r.keys={privateKey:g.rsa.setPrivateKey(r.n,r.e,F,r.p,r.q,F.mod(r.p1),F.mod(r.q1),r.q.modInverse(r.p)),publicKey:g.rsa.setPublicKey(r.n,r.e)}}L=+new Date,P+=L-N,N=L}return r.keys!==null},g.rsa.generateKeyPair=function(r,f,S,w){if(arguments.length===1?typeof r=="object"?(S=r,r=void 0):typeof r=="function"&&(w=r,r=void 0):arguments.length===2?typeof r=="number"?typeof f=="function"?(w=f,f=void 0):typeof f!="number"&&(S=f,f=void 0):(S=r,w=f,r=void 0,f=void 0):arguments.length===3&&(typeof f=="number"?typeof S=="function"&&(w=S,S=void 0):(w=S,S=f,f=void 0)),S=S||{},r===void 0&&(r=S.bits||2048),f===void 0&&(f=S.e||65537),!i.options.usePureJavaScript&&!S.prng&&r>=256&&r<=16384&&(f===65537||f===3)){if(w){if(h("generateKeyPair"))return t.generateKeyPair("rsa",{modulusLength:r,publicExponent:f,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},function(P,_,k){if(P)return w(P);w(null,{privateKey:g.privateKeyFromPem(k),publicKey:g.publicKeyFromPem(_)})});if(A("generateKey")&&A("exportKey"))return I.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:r,publicExponent:n(f),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(P){return I.globalScope.crypto.subtle.exportKey("pkcs8",P.privateKey)}).then(void 0,function(P){w(P)}).then(function(P){if(P){var _=g.privateKeyFromAsn1(u.fromDer(i.util.createBuffer(P)));w(null,{privateKey:_,publicKey:g.setRsaPublicKey(_.n,_.e)})}});if(b("generateKey")&&b("exportKey")){var U=I.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:r,publicExponent:n(f),hash:{name:"SHA-256"}},!0,["sign","verify"]);U.oncomplete=function(P){var _=P.target.result,k=I.globalScope.msCrypto.subtle.exportKey("pkcs8",_.privateKey);k.oncomplete=function(F){var K=F.target.result,G=g.privateKeyFromAsn1(u.fromDer(i.util.createBuffer(K)));w(null,{privateKey:G,publicKey:g.setRsaPublicKey(G.n,G.e)})},k.onerror=function(F){w(F)}},U.onerror=function(P){w(P)};return}}else if(h("generateKeyPairSync")){var N=t.generateKeyPairSync("rsa",{modulusLength:r,publicExponent:f,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:g.privateKeyFromPem(N.privateKey),publicKey:g.publicKeyFromPem(N.publicKey)}}}var L=g.rsa.createKeyPairGenerationState(r,f,S);if(!w)return g.rsa.stepKeyPairGenerationState(L,0),L.keys;m(L,S,w)},g.setRsaPublicKey=g.rsa.setPublicKey=function(r,f){var S={n:r,e:f};return S.encrypt=function(w,U,N){if(typeof U=="string"?U=U.toUpperCase():U===void 0&&(U="RSAES-PKCS1-V1_5"),U==="RSAES-PKCS1-V1_5")U={encode:function(P,_,k){return E(P,_,2).getBytes()}};else if(U==="RSA-OAEP"||U==="RSAES-OAEP")U={encode:function(P,_){return i.pkcs1.encode_rsa_oaep(_,P,N)}};else if(["RAW","NONE","NULL",null].indexOf(U)!==-1)U={encode:function(P){return P}};else if(typeof U=="string")throw new Error('Unsupported encryption scheme: "'+U+'".');var L=U.encode(w,S,!0);return g.rsa.encrypt(L,S,!0)},S.verify=function(w,U,N,L){typeof N=="string"?N=N.toUpperCase():N===void 0&&(N="RSASSA-PKCS1-V1_5"),L===void 0&&(L={_parseAllDigestBytes:!0,_skipPaddingChecks:!1}),"_parseAllDigestBytes"in L||(L._parseAllDigestBytes=!0),"_skipPaddingChecks"in L||(L._skipPaddingChecks=!1),N==="RSASSA-PKCS1-V1_5"?N={verify:function(_,k){k=v(k,S,!0,void 0,L);var F=u.fromDer(k,{parseAllBytes:L._parseAllDigestBytes}),K={},G=[];if(!u.validate(F,R,K,G)||F.value.length!==2){var z=new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value.");throw z.errors=G,z}var Q=u.derToOid(K.algorithmIdentifier);if(!(Q===i.oids.md2||Q===i.oids.md5||Q===i.oids.sha1||Q===i.oids.sha224||Q===i.oids.sha256||Q===i.oids.sha384||Q===i.oids.sha512||Q===i.oids["sha512-224"]||Q===i.oids["sha512-256"])){var z=new Error("Unknown RSASSA-PKCS1-v1_5 DigestAlgorithm identifier.");throw z.oid=Q,z}if((Q===i.oids.md2||Q===i.oids.md5)&&!("parameters"in K))throw new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value. Missing algorithm identifier NULL parameters.");return _===K.digest}}:(N==="NONE"||N==="NULL"||N===null)&&(N={verify:function(_,k){return k=v(k,S,!0,void 0,L),_===k}});var P=g.rsa.decrypt(U,S,!0,!1);return N.verify(w,P,S.n.bitLength())},S},g.setRsaPrivateKey=g.rsa.setPrivateKey=function(r,f,S,w,U,N,L,P){var _={n:r,e:f,d:S,p:w,q:U,dP:N,dQ:L,qInv:P};return _.decrypt=function(k,F,K){typeof F=="string"?F=F.toUpperCase():F===void 0&&(F="RSAES-PKCS1-V1_5");var G=g.rsa.decrypt(k,_,!1,!1);if(F==="RSAES-PKCS1-V1_5")F={decode:v};else if(F==="RSA-OAEP"||F==="RSAES-OAEP")F={decode:function(z,Q){return i.pkcs1.decode_rsa_oaep(Q,z,K)}};else if(["RAW","NONE","NULL",null].indexOf(F)!==-1)F={decode:function(z){return z}};else throw new Error('Unsupported encryption scheme: "'+F+'".');return F.decode(G,_,!1)},_.sign=function(k,F){var K=!1;typeof F=="string"&&(F=F.toUpperCase()),F===void 0||F==="RSASSA-PKCS1-V1_5"?(F={encode:x},K=1):(F==="NONE"||F==="NULL"||F===null)&&(F={encode:function(){return k}},K=1);var G=F.encode(k,_.n.bitLength());return g.rsa.encrypt(G,_,K)},_},g.wrapRsaPrivateKey=function(r){return u.create(u.Class.UNIVERSAL,u.Type.SEQUENCE,!0,[u.create(u.Class.UNIVERSAL,u.Type.INTEGER,!1,u.integerToDer(0).getBytes()),u.create(u.Class.UNIVERSAL,u.Type.SEQUENCE,!0,[u.create(u.Class.UNIVERSAL,u.Type.OID,!1,u.oidToDer(g.oids.rsaEncryption).getBytes()),u.create(u.Class.UNIVERSAL,u.Type.NULL,!1,"")]),u.create(u.Class.UNIVERSAL,u.Type.OCTETSTRING,!1,u.toDer(r).getBytes())])},g.privateKeyFromAsn1=function(r){var f={},S=[];if(u.validate(r,o,f,S)&&(r=u.fromDer(i.util.createBuffer(f.privateKey))),f={},S=[],!u.validate(r,d,f,S)){var w=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw w.errors=S,w}var U,N,L,P,_,k,F,K;return U=i.util.createBuffer(f.privateKeyModulus).toHex(),N=i.util.createBuffer(f.privateKeyPublicExponent).toHex(),L=i.util.createBuffer(f.privateKeyPrivateExponent).toHex(),P=i.util.createBuffer(f.privateKeyPrime1).toHex(),_=i.util.createBuffer(f.privateKeyPrime2).toHex(),k=i.util.createBuffer(f.privateKeyExponent1).toHex(),F=i.util.createBuffer(f.privateKeyExponent2).toHex(),K=i.util.createBuffer(f.privateKeyCoefficient).toHex(),g.setRsaPrivateKey(new e(U,16),new e(N,16),new e(L,16),new e(P,16),new e(_,16),new e(k,16),new e(F,16),new e(K,16))},g.privateKeyToAsn1=g.privateKeyToRSAPrivateKey=function(r){return u.create(u.Class.UNIVERSAL,u.Type.SEQUENCE,!0,[u.create(u.Class.UNIVERSAL,u.Type.INTEGER,!1,u.integerToDer(0).getBytes()),u.create(u.Class.UNIVERSAL,u.Type.INTEGER,!1,a(r.n)),u.create(u.Class.UNIVERSAL,u.Type.INTEGER,!1,a(r.e)),u.create(u.Class.UNIVERSAL,u.Type.INTEGER,!1,a(r.d)),u.create(u.Class.UNIVERSAL,u.Type.INTEGER,!1,a(r.p)),u.create(u.Class.UNIVERSAL,u.Type.INTEGER,!1,a(r.q)),u.create(u.Class.UNIVERSAL,u.Type.INTEGER,!1,a(r.dP)),u.create(u.Class.UNIVERSAL,u.Type.INTEGER,!1,a(r.dQ)),u.create(u.Class.UNIVERSAL,u.Type.INTEGER,!1,a(r.qInv))])},g.publicKeyFromAsn1=function(r){var f={},S=[];if(u.validate(r,T,f,S)){var w=u.derToOid(f.publicKeyOid);if(w!==g.oids.rsaEncryption){var U=new Error("Cannot read public key. Unknown OID.");throw U.oid=w,U}r=f.rsaPublicKey}if(S=[],!u.validate(r,c,f,S)){var U=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw U.errors=S,U}var N=i.util.createBuffer(f.publicKeyModulus).toHex(),L=i.util.createBuffer(f.publicKeyExponent).toHex();return g.setRsaPublicKey(new e(N,16),new e(L,16))},g.publicKeyToAsn1=g.publicKeyToSubjectPublicKeyInfo=function(r){return u.create(u.Class.UNIVERSAL,u.Type.SEQUENCE,!0,[u.create(u.Class.UNIVERSAL,u.Type.SEQUENCE,!0,[u.create(u.Class.UNIVERSAL,u.Type.OID,!1,u.oidToDer(g.oids.rsaEncryption).getBytes()),u.create(u.Class.UNIVERSAL,u.Type.NULL,!1,"")]),u.create(u.Class.UNIVERSAL,u.Type.BITSTRING,!1,[g.publicKeyToRSAPublicKey(r)])])},g.publicKeyToRSAPublicKey=function(r){return u.create(u.Class.UNIVERSAL,u.Type.SEQUENCE,!0,[u.create(u.Class.UNIVERSAL,u.Type.INTEGER,!1,a(r.n)),u.create(u.Class.UNIVERSAL,u.Type.INTEGER,!1,a(r.e))])};function E(r,f,S){var w=i.util.createBuffer(),U=Math.ceil(f.n.bitLength()/8);if(r.length>U-11){var N=new Error("Message is too long for PKCS#1 v1.5 padding.");throw N.length=r.length,N.max=U-11,N}w.putByte(0),w.putByte(S);var L=U-3-r.length,P;if(S===0||S===1){P=S===0?0:255;for(var _=0;_<L;++_)w.putByte(P)}else for(;L>0;){for(var k=0,F=i.random.getBytes(L),_=0;_<L;++_)P=F.charCodeAt(_),P===0?++k:w.putByte(P);L=k}return w.putByte(0),w.putBytes(r),w}function v(r,f,S,w,U){var N=Math.ceil(f.n.bitLength()/8),L=i.util.createBuffer(r),P=L.getByte(),_=L.getByte();if(P!==0||S&&_!==0&&_!==1||!S&&_!==2||S&&_===0&&typeof w=="undefined")throw new Error("Encryption block is invalid.");var k=0;if(_===0){k=N-3-w;for(var F=0;F<k;++F)if(L.getByte()!==0)throw new Error("Encryption block is invalid.")}else if(_===1){for(k=0;L.length()>1;){if(L.getByte()!==255){--L.read;break}++k}if(k<8&&!(U&&U._skipPaddingChecks))throw new Error("Encryption block is invalid.")}else if(_===2){for(k=0;L.length()>1;){if(L.getByte()===0){--L.read;break}++k}if(k<8&&!(U&&U._skipPaddingChecks))throw new Error("Encryption block is invalid.")}var K=L.getByte();if(K!==0||k!==N-3-L.length())throw new Error("Encryption block is invalid.");return L.getBytes()}function m(r,f,S){typeof f=="function"&&(S=f,f={}),f=f||{};var w={algorithm:{name:f.algorithm||"PRIMEINC",options:{workers:f.workers||2,workLoad:f.workLoad||100,workerScript:f.workerScript}}};"prng"in f&&(w.prng=f.prng),U();function U(){N(r.pBits,function(P,_){if(P)return S(P);if(r.p=_,r.q!==null)return L(P,r.q);N(r.qBits,L)})}function N(P,_){i.prime.generateProbablePrime(P,w,_)}function L(P,_){if(P)return S(P);if(r.q=_,r.p.compareTo(r.q)<0){var k=r.p;r.p=r.q,r.q=k}if(r.p.subtract(e.ONE).gcd(r.e).compareTo(e.ONE)!==0){r.p=null,U();return}if(r.q.subtract(e.ONE).gcd(r.e).compareTo(e.ONE)!==0){r.q=null,N(r.qBits,L);return}if(r.p1=r.p.subtract(e.ONE),r.q1=r.q.subtract(e.ONE),r.phi=r.p1.multiply(r.q1),r.phi.gcd(r.e).compareTo(e.ONE)!==0){r.p=r.q=null,U();return}if(r.n=r.p.multiply(r.q),r.n.bitLength()!==r.bits){r.q=null,N(r.qBits,L);return}var F=r.e.modInverse(r.phi);r.keys={privateKey:g.rsa.setPrivateKey(r.n,r.e,F,r.p,r.q,F.mod(r.p1),F.mod(r.q1),r.q.modInverse(r.p)),publicKey:g.rsa.setPublicKey(r.n,r.e)},S(null,r.keys)}}function a(r){var f=r.toString(16);f[0]>="8"&&(f="00"+f);var S=i.util.hexToBytes(f);return S.length>1&&(S.charCodeAt(0)===0&&(S.charCodeAt(1)&128)===0||S.charCodeAt(0)===255&&(S.charCodeAt(1)&128)===128)?S.substr(1):S}function l(r){return r<=100?27:r<=150?18:r<=200?15:r<=250?12:r<=300?9:r<=350?8:r<=400?7:r<=500?6:r<=600?5:r<=800?4:r<=1250?3:2}function h(r){return i.util.isNodejs&&typeof t[r]=="function"}function A(r){return typeof I.globalScope!="undefined"&&typeof I.globalScope.crypto=="object"&&typeof I.globalScope.crypto.subtle=="object"&&typeof I.globalScope.crypto.subtle[r]=="function"}function b(r){return typeof I.globalScope!="undefined"&&typeof I.globalScope.msCrypto=="object"&&typeof I.globalScope.msCrypto.subtle=="object"&&typeof I.globalScope.msCrypto.subtle[r]=="function"}function n(r){for(var f=i.util.hexToBytes(r.toString(16)),S=new Uint8Array(f.length),w=0;w<f.length;++w)S[w]=f.charCodeAt(w);return S}return Xe}var Ye,kt;function Ot(){if(kt)return Ye;kt=1;var i=H();if(_e(),ce(),Ct(),pe(),he(),Tt(),Me(),de(),gr(),me(),X(),typeof e=="undefined")var e=i.jsbn.BigInteger;var t=i.asn1,u=i.pki=i.pki||{};Ye=u.pbe=i.pbe=i.pbe||{};var I=u.oids,g={name:"EncryptedPrivateKeyInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:t.Class.UNIVERSAL,type:t.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},s={name:"PBES2Algorithms",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:t.Class.UNIVERSAL,type:t.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:t.Class.UNIVERSAL,type:t.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},o={name:"pkcs-12PbeParams",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:t.Class.UNIVERSAL,type:t.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"iterations"}]};u.encryptPrivateKeyInfo=function(x,y,E){E=E||{},E.saltSize=E.saltSize||8,E.count=E.count||2048,E.algorithm=E.algorithm||"aes128",E.prfAlgorithm=E.prfAlgorithm||"sha1";var v=i.random.getBytesSync(E.saltSize),m=E.count,a=t.integerToDer(m),l,h,A;if(E.algorithm.indexOf("aes")===0||E.algorithm==="des"){var b,n,r;switch(E.algorithm){case"aes128":l=16,b=16,n=I["aes128-CBC"],r=i.aes.createEncryptionCipher;break;case"aes192":l=24,b=16,n=I["aes192-CBC"],r=i.aes.createEncryptionCipher;break;case"aes256":l=32,b=16,n=I["aes256-CBC"],r=i.aes.createEncryptionCipher;break;case"des":l=8,b=8,n=I.desCBC,r=i.des.createEncryptionCipher;break;default:var f=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw f.algorithm=E.algorithm,f}var S="hmacWith"+E.prfAlgorithm.toUpperCase(),w=T(S),U=i.pkcs5.pbkdf2(y,v,m,l,w),N=i.random.getBytesSync(b),L=r(U);L.start(N),L.update(t.toDer(x)),L.finish(),A=L.output.getBytes();var P=R(v,a,l,S);h=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(I.pkcs5PBES2).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(I.pkcs5PBKDF2).getBytes()),P]),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(n).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,N)])])])}else if(E.algorithm==="3des"){l=24;var _=new i.util.ByteBuffer(v),U=u.pbe.generatePkcs12Key(y,_,1,m,l),N=u.pbe.generatePkcs12Key(y,_,2,m,l),L=i.des.createEncryptionCipher(U);L.start(N),L.update(t.toDer(x)),L.finish(),A=L.output.getBytes(),h=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(I["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,v),t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,a.getBytes())])])}else{var f=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw f.algorithm=E.algorithm,f}var k=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[h,t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,A)]);return k},u.decryptPrivateKeyInfo=function(x,y){var E=null,v={},m=[];if(!t.validate(x,g,v,m)){var a=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw a.errors=m,a}var l=t.derToOid(v.encryptionOid),h=u.pbe.getCipher(l,v.encryptionParams,y),A=i.util.createBuffer(v.encryptedData);return h.update(A),h.finish()&&(E=t.fromDer(h.output)),E},u.encryptedPrivateKeyToPem=function(x,y){var E={type:"ENCRYPTED PRIVATE KEY",body:t.toDer(x).getBytes()};return i.pem.encode(E,{maxline:y})},u.encryptedPrivateKeyFromPem=function(x){var y=i.pem.decode(x)[0];if(y.type!=="ENCRYPTED PRIVATE KEY"){var E=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw E.headerType=y.type,E}if(y.procType&&y.procType.type==="ENCRYPTED")throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return t.fromDer(y.body)},u.encryptRsaPrivateKey=function(x,y,E){if(E=E||{},!E.legacy){var v=u.wrapRsaPrivateKey(u.privateKeyToAsn1(x));return v=u.encryptPrivateKeyInfo(v,y,E),u.encryptedPrivateKeyToPem(v)}var m,a,l,h;switch(E.algorithm){case"aes128":m="AES-128-CBC",l=16,a=i.random.getBytesSync(16),h=i.aes.createEncryptionCipher;break;case"aes192":m="AES-192-CBC",l=24,a=i.random.getBytesSync(16),h=i.aes.createEncryptionCipher;break;case"aes256":m="AES-256-CBC",l=32,a=i.random.getBytesSync(16),h=i.aes.createEncryptionCipher;break;case"3des":m="DES-EDE3-CBC",l=24,a=i.random.getBytesSync(8),h=i.des.createEncryptionCipher;break;case"des":m="DES-CBC",l=8,a=i.random.getBytesSync(8),h=i.des.createEncryptionCipher;break;default:var A=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+E.algorithm+'".');throw A.algorithm=E.algorithm,A}var b=i.pbe.opensslDeriveBytes(y,a.substr(0,8),l),n=h(b);n.start(a),n.update(t.toDer(u.privateKeyToAsn1(x))),n.finish();var r={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:m,parameters:i.util.bytesToHex(a).toUpperCase()},body:n.output.getBytes()};return i.pem.encode(r)},u.decryptRsaPrivateKey=function(x,y){var E=null,v=i.pem.decode(x)[0];if(v.type!=="ENCRYPTED PRIVATE KEY"&&v.type!=="PRIVATE KEY"&&v.type!=="RSA PRIVATE KEY"){var m=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".');throw m.headerType=m,m}if(v.procType&&v.procType.type==="ENCRYPTED"){var a,l;switch(v.dekInfo.algorithm){case"DES-CBC":a=8,l=i.des.createDecryptionCipher;break;case"DES-EDE3-CBC":a=24,l=i.des.createDecryptionCipher;break;case"AES-128-CBC":a=16,l=i.aes.createDecryptionCipher;break;case"AES-192-CBC":a=24,l=i.aes.createDecryptionCipher;break;case"AES-256-CBC":a=32,l=i.aes.createDecryptionCipher;break;case"RC2-40-CBC":a=5,l=function(r){return i.rc2.createDecryptionCipher(r,40)};break;case"RC2-64-CBC":a=8,l=function(r){return i.rc2.createDecryptionCipher(r,64)};break;case"RC2-128-CBC":a=16,l=function(r){return i.rc2.createDecryptionCipher(r,128)};break;default:var m=new Error('Could not decrypt private key; unsupported encryption algorithm "'+v.dekInfo.algorithm+'".');throw m.algorithm=v.dekInfo.algorithm,m}var h=i.util.hexToBytes(v.dekInfo.parameters),A=i.pbe.opensslDeriveBytes(y,h.substr(0,8),a),b=l(A);if(b.start(h),b.update(i.util.createBuffer(v.body)),b.finish())E=b.output.getBytes();else return E}else E=v.body;return v.type==="ENCRYPTED PRIVATE KEY"?E=u.decryptPrivateKeyInfo(t.fromDer(E),y):E=t.fromDer(E),E!==null&&(E=u.privateKeyFromAsn1(E)),E},u.pbe.generatePkcs12Key=function(x,y,E,v,m,a){var l,h;if(typeof a=="undefined"||a===null){if(!("sha1"in i.md))throw new Error('"sha1" hash algorithm unavailable.');a=i.md.sha1.create()}var A=a.digestLength,b=a.blockLength,n=new i.util.ByteBuffer,r=new i.util.ByteBuffer;if(x!=null){for(h=0;h<x.length;h++)r.putInt16(x.charCodeAt(h));r.putInt16(0)}var f=r.length(),S=y.length(),w=new i.util.ByteBuffer;w.fillWithByte(E,b);var U=b*Math.ceil(S/b),N=new i.util.ByteBuffer;for(h=0;h<U;h++)N.putByte(y.at(h%S));var L=b*Math.ceil(f/b),P=new i.util.ByteBuffer;for(h=0;h<L;h++)P.putByte(r.at(h%f));var _=N;_.putBuffer(P);for(var k=Math.ceil(m/A),F=1;F<=k;F++){var K=new i.util.ByteBuffer;K.putBytes(w.bytes()),K.putBytes(_.bytes());for(var G=0;G<v;G++)a.start(),a.update(K.getBytes()),K=a.digest();var z=new i.util.ByteBuffer;for(h=0;h<b;h++)z.putByte(K.at(h%A));var Q=Math.ceil(S/b)+Math.ceil(f/b),Y=new i.util.ByteBuffer;for(l=0;l<Q;l++){var te=new i.util.ByteBuffer(_.getBytes(b)),ie=511;for(h=z.length()-1;h>=0;h--)ie=ie>>8,ie+=z.at(h)+te.at(h),te.setAt(h,ie&255);Y.putBuffer(te)}_=Y,n.putBuffer(K)}return n.truncate(n.length()-m),n},u.pbe.getCipher=function(x,y,E){switch(x){case u.oids.pkcs5PBES2:return u.pbe.getCipherForPBES2(x,y,E);case u.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case u.oids["pbewithSHAAnd40BitRC2-CBC"]:return u.pbe.getCipherForPKCS12PBE(x,y,E);default:var v=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw v.oid=x,v.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],v}},u.pbe.getCipherForPBES2=function(x,y,E){var v={},m=[];if(!t.validate(y,s,v,m)){var a=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw a.errors=m,a}if(x=t.derToOid(v.kdfOid),x!==u.oids.pkcs5PBKDF2){var a=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw a.oid=x,a.supportedOids=["pkcs5PBKDF2"],a}if(x=t.derToOid(v.encOid),x!==u.oids["aes128-CBC"]&&x!==u.oids["aes192-CBC"]&&x!==u.oids["aes256-CBC"]&&x!==u.oids["des-EDE3-CBC"]&&x!==u.oids.desCBC){var a=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw a.oid=x,a.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],a}var l=v.kdfSalt,h=i.util.createBuffer(v.kdfIterationCount);h=h.getInt(h.length()<<3);var A,b;switch(u.oids[x]){case"aes128-CBC":A=16,b=i.aes.createDecryptionCipher;break;case"aes192-CBC":A=24,b=i.aes.createDecryptionCipher;break;case"aes256-CBC":A=32,b=i.aes.createDecryptionCipher;break;case"des-EDE3-CBC":A=24,b=i.des.createDecryptionCipher;break;case"desCBC":A=8,b=i.des.createDecryptionCipher;break}var n=c(v.prfOid),r=i.pkcs5.pbkdf2(E,l,h,A,n),f=v.encIv,S=b(r);return S.start(f),S},u.pbe.getCipherForPKCS12PBE=function(x,y,E){var v={},m=[];if(!t.validate(y,o,v,m)){var a=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw a.errors=m,a}var l=i.util.createBuffer(v.salt),h=i.util.createBuffer(v.iterations);h=h.getInt(h.length()<<3);var A,b,n;switch(x){case u.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:A=24,b=8,n=i.des.startDecrypting;break;case u.oids["pbewithSHAAnd40BitRC2-CBC"]:A=5,b=8,n=function(U,N){var L=i.rc2.createDecryptionCipher(U,40);return L.start(N,null),L};break;default:var a=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw a.oid=x,a}var r=c(v.prfOid),f=u.pbe.generatePkcs12Key(E,l,1,h,A,r);r.start();var S=u.pbe.generatePkcs12Key(E,l,2,h,b,r);return n(f,S)},u.pbe.opensslDeriveBytes=function(x,y,E,v){if(typeof v=="undefined"||v===null){if(!("md5"in i.md))throw new Error('"md5" hash algorithm unavailable.');v=i.md.md5.create()}y===null&&(y="");for(var m=[d(v,x+y)],a=16,l=1;a<E;++l,a+=16)m.push(d(v,m[l-1]+x+y));return m.join("").substr(0,E)};function d(x,y){return x.start().update(y).digest().getBytes()}function c(x){var y;if(!x)y="hmacWithSHA1";else if(y=u.oids[t.derToOid(x)],!y){var E=new Error("Unsupported PRF OID.");throw E.oid=x,E.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],E}return T(y)}function T(x){var y=i.md;switch(x){case"hmacWithSHA224":y=i.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":x=x.substr(8).toLowerCase();break;default:var E=new Error("Unsupported PRF algorithm.");throw E.algorithm=x,E.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],E}if(!y||!(x in y))throw new Error("Unknown hash algorithm: "+x);return y[x].create()}function R(x,y,E,v){var m=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,x),t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,y.getBytes())]);return v!=="hmacWithSHA1"&&m.value.push(t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,i.util.hexToBytes(E.toString(16))),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(u.oids[v]).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")])),m}return Ye}var $e={exports:{}},je={exports:{}},Vt;function Er(){if(Vt)return je.exports;Vt=1;var i=H();ce(),X();var e=i.asn1,t=je.exports=i.pkcs7asn1=i.pkcs7asn1||{};i.pkcs7=i.pkcs7||{},i.pkcs7.asn1=t;var u={name:"ContentInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};t.contentInfoValidator=u;var I={name:"EncryptedContentInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:e.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};t.envelopedDataValidator={name:"EnvelopedData",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:e.Class.UNIVERSAL,type:e.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(I)},t.encryptedDataValidator={name:"EncryptedData",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"version"}].concat(I)};var g={name:"SignerInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:e.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:e.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};return t.signedDataValidator={name:"SignedData",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:e.Class.UNIVERSAL,type:e.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},u,{name:"SignedData.Certificates",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:e.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:e.Class.UNIVERSAL,type:e.Type.SET,capture:"signerInfos",optional:!0,value:[g]}]},t.recipientInfoValidator={name:"RecipientInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:e.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter",optional:!0}]},{name:"RecipientInfo.encryptedKey",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]},je.exports}var Ze={exports:{}},Je={exports:{}},Ft;function mr(){if(Ft)return Je.exports;Ft=1;var i=H();X(),i.mgf=i.mgf||{};var e=Je.exports=i.mgf.mgf1=i.mgf1=i.mgf1||{};return e.create=function(t){var u={generate:function(I,g){for(var s=new i.util.ByteBuffer,o=Math.ceil(g/t.digestLength),d=0;d<o;d++){var c=new i.util.ByteBuffer;c.putInt32(d),t.start(),t.update(I+c.getBytes()),s.putBuffer(t.digest())}return s.truncate(s.length()-g),s.getBytes()}};return u},Je.exports}var et,Kt;function xr(){if(Kt)return et;Kt=1;var i=H();return mr(),et=i.mgf=i.mgf||{},i.mgf.mgf1=i.mgf1,et}var tt={exports:{}},Mt;function qt(){if(Mt)return tt.exports;Mt=1;var i=H();de(),X();var e=tt.exports=i.pss=i.pss||{};return e.create=function(t){arguments.length===3&&(t={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var u=t.md,I=t.mgf,g=u.digestLength,s=t.salt||null;typeof s=="string"&&(s=i.util.createBuffer(s));var o;if("saltLength"in t)o=t.saltLength;else if(s!==null)o=s.length();else throw new Error("Salt length not specified or specific salt not given.");if(s!==null&&s.length()!==o)throw new Error("Given salt length does not match length of given salt.");var d=t.prng||i.random,c={};return c.encode=function(T,R){var x,y=R-1,E=Math.ceil(y/8),v=T.digest().getBytes();if(E<g+o+2)throw new Error("Message is too long to encrypt.");var m;s===null?m=d.getBytesSync(o):m=s.bytes();var a=new i.util.ByteBuffer;a.fillWithByte(0,8),a.putBytes(v),a.putBytes(m),u.start(),u.update(a.getBytes());var l=u.digest().getBytes(),h=new i.util.ByteBuffer;h.fillWithByte(0,E-o-g-2),h.putByte(1),h.putBytes(m);var A=h.getBytes(),b=E-g-1,n=I.generate(l,b),r="";for(x=0;x<b;x++)r+=String.fromCharCode(A.charCodeAt(x)^n.charCodeAt(x));var f=65280>>8*E-y&255;return r=String.fromCharCode(r.charCodeAt(0)&~f)+r.substr(1),r+l+"¼"},c.verify=function(T,R,x){var y,E=x-1,v=Math.ceil(E/8);if(R=R.substr(-v),v<g+o+2)throw new Error("Inconsistent parameters to PSS signature verification.");if(R.charCodeAt(v-1)!==188)throw new Error("Encoded message does not end in 0xBC.");var m=v-g-1,a=R.substr(0,m),l=R.substr(m,g),h=65280>>8*v-E&255;if((a.charCodeAt(0)&h)!==0)throw new Error("Bits beyond keysize not zero as expected.");var A=I.generate(l,m),b="";for(y=0;y<m;y++)b+=String.fromCharCode(a.charCodeAt(y)^A.charCodeAt(y));b=String.fromCharCode(b.charCodeAt(0)&~h)+b.substr(1);var n=v-g-o-2;for(y=0;y<n;y++)if(b.charCodeAt(y)!==0)throw new Error("Leftmost octets not zero as expected");if(b.charCodeAt(n)!==1)throw new Error("Inconsistent PSS signature, 0x01 marker not found");var r=b.substr(-o),f=new i.util.ByteBuffer;f.fillWithByte(0,8),f.putBytes(T),f.putBytes(r),u.start(),u.update(f.getBytes());var S=u.digest().getBytes();return l===S},c},tt.exports}var Gt;function zt(){if(Gt)return Ze.exports;Gt=1;var i=H();_e(),ce(),Ct(),pe(),xr(),he(),Me(),qt(),me(),X();var e=i.asn1,t=Ze.exports=i.pki=i.pki||{},u=t.oids,I={};I.CN=u.commonName,I.commonName="CN",I.C=u.countryName,I.countryName="C",I.L=u.localityName,I.localityName="L",I.ST=u.stateOrProvinceName,I.stateOrProvinceName="ST",I.O=u.organizationName,I.organizationName="O",I.OU=u.organizationalUnitName,I.organizationalUnitName="OU",I.E=u.emailAddress,I.emailAddress="E";var g=i.pki.rsa.publicKeyValidator,s={name:"Certificate",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:e.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:e.Class.UNIVERSAL,type:e.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:e.Class.UNIVERSAL,type:e.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:e.Class.UNIVERSAL,type:e.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:e.Class.UNIVERSAL,type:e.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},g,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:e.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:e.Class.UNIVERSAL,type:e.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:e.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:e.Class.UNIVERSAL,type:e.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:e.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:e.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:e.Class.UNIVERSAL,type:e.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},o={name:"rsapss",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:e.Class.UNIVERSAL,type:e.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:e.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:e.Class.UNIVERSAL,type:e.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:e.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:e.Class.UNIVERSAL,type:e.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:e.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",tagClass:e.Class.UNIVERSAL,type:e.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},d={name:"CertificationRequestInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},g,{name:"CertificationRequestInfo.attributes",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:e.Class.UNIVERSAL,type:e.Type.SET,constructed:!0}]}]}]},c={name:"CertificationRequest",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[d,{name:"CertificationRequest.signatureAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:e.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:e.Class.UNIVERSAL,type:e.Type.BITSTRING,constructed:!1,captureBitStringValue:"csrSignature"}]};t.RDNAttributesAsArray=function(n,r){for(var f=[],S,w,U,N=0;N<n.value.length;++N){S=n.value[N];for(var L=0;L<S.value.length;++L)U={},w=S.value[L],U.type=e.derToOid(w.value[0].value),U.value=w.value[1].value,U.valueTagClass=w.value[1].type,U.type in u&&(U.name=u[U.type],U.name in I&&(U.shortName=I[U.name])),r&&(r.update(U.type),r.update(U.value)),f.push(U)}return f},t.CRIAttributesAsArray=function(n){for(var r=[],f=0;f<n.length;++f)for(var S=n[f],w=e.derToOid(S.value[0].value),U=S.value[1].value,N=0;N<U.length;++N){var L={};if(L.type=w,L.value=U[N].value,L.valueTagClass=U[N].type,L.type in u&&(L.name=u[L.type],L.name in I&&(L.shortName=I[L.name])),L.type===u.extensionRequest){L.extensions=[];for(var P=0;P<L.value.length;++P)L.extensions.push(t.certificateExtensionFromAsn1(L.value[P]))}r.push(L)}return r};function T(n,r){typeof r=="string"&&(r={shortName:r});for(var f=null,S,w=0;f===null&&w<n.attributes.length;++w)S=n.attributes[w],(r.type&&r.type===S.type||r.name&&r.name===S.name||r.shortName&&r.shortName===S.shortName)&&(f=S);return f}var R=function(n,r,f){var S={};if(n!==u["RSASSA-PSS"])return S;f&&(S={hash:{algorithmOid:u.sha1},mgf:{algorithmOid:u.mgf1,hash:{algorithmOid:u.sha1}},saltLength:20});var w={},U=[];if(!e.validate(r,o,w,U)){var N=new Error("Cannot read RSASSA-PSS parameter block.");throw N.errors=U,N}return w.hashOid!==void 0&&(S.hash=S.hash||{},S.hash.algorithmOid=e.derToOid(w.hashOid)),w.maskGenOid!==void 0&&(S.mgf=S.mgf||{},S.mgf.algorithmOid=e.derToOid(w.maskGenOid),S.mgf.hash=S.mgf.hash||{},S.mgf.hash.algorithmOid=e.derToOid(w.maskGenHashOid)),w.saltLength!==void 0&&(S.saltLength=w.saltLength.charCodeAt(0)),S},x=function(n){switch(u[n.signatureOid]){case"sha1WithRSAEncryption":case"sha1WithRSASignature":return i.md.sha1.create();case"md5WithRSAEncryption":return i.md.md5.create();case"sha256WithRSAEncryption":return i.md.sha256.create();case"sha384WithRSAEncryption":return i.md.sha384.create();case"sha512WithRSAEncryption":return i.md.sha512.create();case"RSASSA-PSS":return i.md.sha256.create();default:var r=new Error("Could not compute "+n.type+" digest. Unknown signature OID.");throw r.signatureOid=n.signatureOid,r}},y=function(n){var r=n.certificate,f;switch(r.signatureOid){case u.sha1WithRSAEncryption:case u.sha1WithRSASignature:break;case u["RSASSA-PSS"]:var S,w;if(S=u[r.signatureParameters.mgf.hash.algorithmOid],S===void 0||i.md[S]===void 0){var U=new Error("Unsupported MGF hash function.");throw U.oid=r.signatureParameters.mgf.hash.algorithmOid,U.name=S,U}if(w=u[r.signatureParameters.mgf.algorithmOid],w===void 0||i.mgf[w]===void 0){var U=new Error("Unsupported MGF function.");throw U.oid=r.signatureParameters.mgf.algorithmOid,U.name=w,U}if(w=i.mgf[w].create(i.md[S].create()),S=u[r.signatureParameters.hash.algorithmOid],S===void 0||i.md[S]===void 0){var U=new Error("Unsupported RSASSA-PSS hash function.");throw U.oid=r.signatureParameters.hash.algorithmOid,U.name=S,U}f=i.pss.create(i.md[S].create(),w,r.signatureParameters.saltLength);break}return r.publicKey.verify(n.md.digest().getBytes(),n.signature,f)};t.certificateFromPem=function(n,r,f){var S=i.pem.decode(n)[0];if(S.type!=="CERTIFICATE"&&S.type!=="X509 CERTIFICATE"&&S.type!=="TRUSTED CERTIFICATE"){var w=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw w.headerType=S.type,w}if(S.procType&&S.procType.type==="ENCRYPTED")throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var U=e.fromDer(S.body,f);return t.certificateFromAsn1(U,r)},t.certificateToPem=function(n,r){var f={type:"CERTIFICATE",body:e.toDer(t.certificateToAsn1(n)).getBytes()};return i.pem.encode(f,{maxline:r})},t.publicKeyFromPem=function(n){var r=i.pem.decode(n)[0];if(r.type!=="PUBLIC KEY"&&r.type!=="RSA PUBLIC KEY"){var f=new Error('Could not convert public key from PEM; PEM header type is not "PUBLIC KEY" or "RSA PUBLIC KEY".');throw f.headerType=r.type,f}if(r.procType&&r.procType.type==="ENCRYPTED")throw new Error("Could not convert public key from PEM; PEM is encrypted.");var S=e.fromDer(r.body);return t.publicKeyFromAsn1(S)},t.publicKeyToPem=function(n,r){var f={type:"PUBLIC KEY",body:e.toDer(t.publicKeyToAsn1(n)).getBytes()};return i.pem.encode(f,{maxline:r})},t.publicKeyToRSAPublicKeyPem=function(n,r){var f={type:"RSA PUBLIC KEY",body:e.toDer(t.publicKeyToRSAPublicKey(n)).getBytes()};return i.pem.encode(f,{maxline:r})},t.getPublicKeyFingerprint=function(n,r){r=r||{};var f=r.md||i.md.sha1.create(),S=r.type||"RSAPublicKey",w;switch(S){case"RSAPublicKey":w=e.toDer(t.publicKeyToRSAPublicKey(n)).getBytes();break;case"SubjectPublicKeyInfo":w=e.toDer(t.publicKeyToAsn1(n)).getBytes();break;default:throw new Error('Unknown fingerprint type "'+r.type+'".')}f.start(),f.update(w);var U=f.digest();if(r.encoding==="hex"){var N=U.toHex();return r.delimiter?N.match(/.{2}/g).join(r.delimiter):N}else{if(r.encoding==="binary")return U.getBytes();if(r.encoding)throw new Error('Unknown encoding "'+r.encoding+'".')}return U},t.certificationRequestFromPem=function(n,r,f){var S=i.pem.decode(n)[0];if(S.type!=="CERTIFICATE REQUEST"){var w=new Error('Could not convert certification request from PEM; PEM header type is not "CERTIFICATE REQUEST".');throw w.headerType=S.type,w}if(S.procType&&S.procType.type==="ENCRYPTED")throw new Error("Could not convert certification request from PEM; PEM is encrypted.");var U=e.fromDer(S.body,f);return t.certificationRequestFromAsn1(U,r)},t.certificationRequestToPem=function(n,r){var f={type:"CERTIFICATE REQUEST",body:e.toDer(t.certificationRequestToAsn1(n)).getBytes()};return i.pem.encode(f,{maxline:r})},t.createCertificate=function(){var n={};return n.version=2,n.serialNumber="00",n.signatureOid=null,n.signature=null,n.siginfo={},n.siginfo.algorithmOid=null,n.validity={},n.validity.notBefore=new Date,n.validity.notAfter=new Date,n.issuer={},n.issuer.getField=function(r){return T(n.issuer,r)},n.issuer.addField=function(r){v([r]),n.issuer.attributes.push(r)},n.issuer.attributes=[],n.issuer.hash=null,n.subject={},n.subject.getField=function(r){return T(n.subject,r)},n.subject.addField=function(r){v([r]),n.subject.attributes.push(r)},n.subject.attributes=[],n.subject.hash=null,n.extensions=[],n.publicKey=null,n.md=null,n.setSubject=function(r,f){v(r),n.subject.attributes=r,delete n.subject.uniqueId,f&&(n.subject.uniqueId=f),n.subject.hash=null},n.setIssuer=function(r,f){v(r),n.issuer.attributes=r,delete n.issuer.uniqueId,f&&(n.issuer.uniqueId=f),n.issuer.hash=null},n.setExtensions=function(r){for(var f=0;f<r.length;++f)m(r[f],{cert:n});n.extensions=r},n.getExtension=function(r){typeof r=="string"&&(r={name:r});for(var f=null,S,w=0;f===null&&w<n.extensions.length;++w)S=n.extensions[w],(r.id&&S.id===r.id||r.name&&S.name===r.name)&&(f=S);return f},n.sign=function(r,f){n.md=f||i.md.sha1.create();var S=u[n.md.algorithm+"WithRSAEncryption"];if(!S){var w=new Error("Could not compute certificate digest. Unknown message digest algorithm OID.");throw w.algorithm=n.md.algorithm,w}n.signatureOid=n.siginfo.algorithmOid=S,n.tbsCertificate=t.getTBSCertificate(n);var U=e.toDer(n.tbsCertificate);n.md.update(U.getBytes()),n.signature=r.sign(n.md)},n.verify=function(r){var f=!1;if(!n.issued(r)){var S=r.issuer,w=n.subject,U=new Error("The parent certificate did not issue the given child certificate; the child certificate's issuer does not match the parent's subject.");throw U.expectedIssuer=w.attributes,U.actualIssuer=S.attributes,U}var N=r.md;if(N===null){N=x({signatureOid:r.signatureOid,type:"certificate"});var L=r.tbsCertificate||t.getTBSCertificate(r),P=e.toDer(L);N.update(P.getBytes())}return N!==null&&(f=y({certificate:n,md:N,signature:r.signature})),f},n.isIssuer=function(r){var f=!1,S=n.issuer,w=r.subject;if(S.hash&&w.hash)f=S.hash===w.hash;else if(S.attributes.length===w.attributes.length){f=!0;for(var U,N,L=0;f&&L<S.attributes.length;++L)U=S.attributes[L],N=w.attributes[L],(U.type!==N.type||U.value!==N.value)&&(f=!1)}return f},n.issued=function(r){return r.isIssuer(n)},n.generateSubjectKeyIdentifier=function(){return t.getPublicKeyFingerprint(n.publicKey,{type:"RSAPublicKey"})},n.verifySubjectKeyIdentifier=function(){for(var r=u.subjectKeyIdentifier,f=0;f<n.extensions.length;++f){var S=n.extensions[f];if(S.id===r){var w=n.generateSubjectKeyIdentifier().getBytes();return i.util.hexToBytes(S.subjectKeyIdentifier)===w}}return!1},n},t.certificateFromAsn1=function(n,r){var f={},S=[];if(!e.validate(n,s,f,S)){var w=new Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate.");throw w.errors=S,w}var U=e.derToOid(f.publicKeyOid);if(U!==t.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var N=t.createCertificate();N.version=f.certVersion?f.certVersion.charCodeAt(0):0;var L=i.util.createBuffer(f.certSerialNumber);N.serialNumber=L.toHex(),N.signatureOid=i.asn1.derToOid(f.certSignatureOid),N.signatureParameters=R(N.signatureOid,f.certSignatureParams,!0),N.siginfo.algorithmOid=i.asn1.derToOid(f.certinfoSignatureOid),N.siginfo.parameters=R(N.siginfo.algorithmOid,f.certinfoSignatureParams,!1),N.signature=f.certSignature;var P=[];if(f.certValidity1UTCTime!==void 0&&P.push(e.utcTimeToDate(f.certValidity1UTCTime)),f.certValidity2GeneralizedTime!==void 0&&P.push(e.generalizedTimeToDate(f.certValidity2GeneralizedTime)),f.certValidity3UTCTime!==void 0&&P.push(e.utcTimeToDate(f.certValidity3UTCTime)),f.certValidity4GeneralizedTime!==void 0&&P.push(e.generalizedTimeToDate(f.certValidity4GeneralizedTime)),P.length>2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(P.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(N.validity.notBefore=P[0],N.validity.notAfter=P[1],N.tbsCertificate=f.tbsCertificate,r){N.md=x({signatureOid:N.signatureOid,type:"certificate"});var _=e.toDer(N.tbsCertificate);N.md.update(_.getBytes())}var k=i.md.sha1.create(),F=e.toDer(f.certIssuer);k.update(F.getBytes()),N.issuer.getField=function(z){return T(N.issuer,z)},N.issuer.addField=function(z){v([z]),N.issuer.attributes.push(z)},N.issuer.attributes=t.RDNAttributesAsArray(f.certIssuer),f.certIssuerUniqueId&&(N.issuer.uniqueId=f.certIssuerUniqueId),N.issuer.hash=k.digest().toHex();var K=i.md.sha1.create(),G=e.toDer(f.certSubject);return K.update(G.getBytes()),N.subject.getField=function(z){return T(N.subject,z)},N.subject.addField=function(z){v([z]),N.subject.attributes.push(z)},N.subject.attributes=t.RDNAttributesAsArray(f.certSubject),f.certSubjectUniqueId&&(N.subject.uniqueId=f.certSubjectUniqueId),N.subject.hash=K.digest().toHex(),f.certExtensions?N.extensions=t.certificateExtensionsFromAsn1(f.certExtensions):N.extensions=[],N.publicKey=t.publicKeyFromAsn1(f.subjectPublicKeyInfo),N},t.certificateExtensionsFromAsn1=function(n){for(var r=[],f=0;f<n.value.length;++f)for(var S=n.value[f],w=0;w<S.value.length;++w)r.push(t.certificateExtensionFromAsn1(S.value[w]));return r},t.certificateExtensionFromAsn1=function(n){var r={};if(r.id=e.derToOid(n.value[0].value),r.critical=!1,n.value[1].type===e.Type.BOOLEAN?(r.critical=n.value[1].value.charCodeAt(0)!==0,r.value=n.value[2].value):r.value=n.value[1].value,r.id in u){if(r.name=u[r.id],r.name==="keyUsage"){var f=e.fromDer(r.value),S=0,w=0;f.value.length>1&&(S=f.value.charCodeAt(1),w=f.value.length>2?f.value.charCodeAt(2):0),r.digitalSignature=(S&128)===128,r.nonRepudiation=(S&64)===64,r.keyEncipherment=(S&32)===32,r.dataEncipherment=(S&16)===16,r.keyAgreement=(S&8)===8,r.keyCertSign=(S&4)===4,r.cRLSign=(S&2)===2,r.encipherOnly=(S&1)===1,r.decipherOnly=(w&128)===128}else if(r.name==="basicConstraints"){var f=e.fromDer(r.value);f.value.length>0&&f.value[0].type===e.Type.BOOLEAN?r.cA=f.value[0].value.charCodeAt(0)!==0:r.cA=!1;var U=null;f.value.length>0&&f.value[0].type===e.Type.INTEGER?U=f.value[0].value:f.value.length>1&&(U=f.value[1].value),U!==null&&(r.pathLenConstraint=e.derToInteger(U))}else if(r.name==="extKeyUsage")for(var f=e.fromDer(r.value),N=0;N<f.value.length;++N){var L=e.derToOid(f.value[N].value);L in u?r[u[L]]=!0:r[L]=!0}else if(r.name==="nsCertType"){var f=e.fromDer(r.value),S=0;f.value.length>1&&(S=f.value.charCodeAt(1)),r.client=(S&128)===128,r.server=(S&64)===64,r.email=(S&32)===32,r.objsign=(S&16)===16,r.reserved=(S&8)===8,r.sslCA=(S&4)===4,r.emailCA=(S&2)===2,r.objCA=(S&1)===1}else if(r.name==="subjectAltName"||r.name==="issuerAltName"){r.altNames=[];for(var P,f=e.fromDer(r.value),_=0;_<f.value.length;++_){P=f.value[_];var k={type:P.type,value:P.value};switch(r.altNames.push(k),P.type){case 1:case 2:case 6:break;case 7:k.ip=i.util.bytesToIP(P.value);break;case 8:k.oid=e.derToOid(P.value);break}}}else if(r.name==="subjectKeyIdentifier"){var f=e.fromDer(r.value);r.subjectKeyIdentifier=i.util.bytesToHex(f.value)}}return r},t.certificationRequestFromAsn1=function(n,r){var f={},S=[];if(!e.validate(n,c,f,S)){var w=new Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest.");throw w.errors=S,w}var U=e.derToOid(f.publicKeyOid);if(U!==t.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var N=t.createCertificationRequest();if(N.version=f.csrVersion?f.csrVersion.charCodeAt(0):0,N.signatureOid=i.asn1.derToOid(f.csrSignatureOid),N.signatureParameters=R(N.signatureOid,f.csrSignatureParams,!0),N.siginfo.algorithmOid=i.asn1.derToOid(f.csrSignatureOid),N.siginfo.parameters=R(N.siginfo.algorithmOid,f.csrSignatureParams,!1),N.signature=f.csrSignature,N.certificationRequestInfo=f.certificationRequestInfo,r){N.md=x({signatureOid:N.signatureOid,type:"certification request"});var L=e.toDer(N.certificationRequestInfo);N.md.update(L.getBytes())}var P=i.md.sha1.create();return N.subject.getField=function(_){return T(N.subject,_)},N.subject.addField=function(_){v([_]),N.subject.attributes.push(_)},N.subject.attributes=t.RDNAttributesAsArray(f.certificationRequestInfoSubject,P),N.subject.hash=P.digest().toHex(),N.publicKey=t.publicKeyFromAsn1(f.subjectPublicKeyInfo),N.getAttribute=function(_){return T(N,_)},N.addAttribute=function(_){v([_]),N.attributes.push(_)},N.attributes=t.CRIAttributesAsArray(f.certificationRequestInfoAttributes||[]),N},t.createCertificationRequest=function(){var n={};return n.version=0,n.signatureOid=null,n.signature=null,n.siginfo={},n.siginfo.algorithmOid=null,n.subject={},n.subject.getField=function(r){return T(n.subject,r)},n.subject.addField=function(r){v([r]),n.subject.attributes.push(r)},n.subject.attributes=[],n.subject.hash=null,n.publicKey=null,n.attributes=[],n.getAttribute=function(r){return T(n,r)},n.addAttribute=function(r){v([r]),n.attributes.push(r)},n.md=null,n.setSubject=function(r){v(r),n.subject.attributes=r,n.subject.hash=null},n.setAttributes=function(r){v(r),n.attributes=r},n.sign=function(r,f){n.md=f||i.md.sha1.create();var S=u[n.md.algorithm+"WithRSAEncryption"];if(!S){var w=new Error("Could not compute certification request digest. Unknown message digest algorithm OID.");throw w.algorithm=n.md.algorithm,w}n.signatureOid=n.siginfo.algorithmOid=S,n.certificationRequestInfo=t.getCertificationRequestInfo(n);var U=e.toDer(n.certificationRequestInfo);n.md.update(U.getBytes()),n.signature=r.sign(n.md)},n.verify=function(){var r=!1,f=n.md;if(f===null){f=x({signatureOid:n.signatureOid,type:"certification request"});var S=n.certificationRequestInfo||t.getCertificationRequestInfo(n),w=e.toDer(S);f.update(w.getBytes())}return f!==null&&(r=y({certificate:n,md:f,signature:n.signature})),r},n};function E(n){for(var r=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]),f,S,w=n.attributes,U=0;U<w.length;++U){f=w[U];var N=f.value,L=e.Type.PRINTABLESTRING;"valueTagClass"in f&&(L=f.valueTagClass,L===e.Type.UTF8&&(N=i.util.encodeUtf8(N))),S=e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(f.type).getBytes()),e.create(e.Class.UNIVERSAL,L,!1,N)])]),r.value.push(S)}return r}function v(n){for(var r,f=0;f<n.length;++f){if(r=n[f],typeof r.name=="undefined"&&(r.type&&r.type in t.oids?r.name=t.oids[r.type]:r.shortName&&r.shortName in I&&(r.name=t.oids[I[r.shortName]])),typeof r.type=="undefined")if(r.name&&r.name in t.oids)r.type=t.oids[r.name];else{var S=new Error("Attribute type not specified.");throw S.attribute=r,S}if(typeof r.shortName=="undefined"&&r.name&&r.name in I&&(r.shortName=I[r.name]),r.type===u.extensionRequest&&(r.valueConstructed=!0,r.valueTagClass=e.Type.SEQUENCE,!r.value&&r.extensions)){r.value=[];for(var w=0;w<r.extensions.length;++w)r.value.push(t.certificateExtensionToAsn1(m(r.extensions[w])))}if(typeof r.value=="undefined"){var S=new Error("Attribute value not specified.");throw S.attribute=r,S}}}function m(n,r){if(r=r||{},typeof n.name=="undefined"&&n.id&&n.id in t.oids&&(n.name=t.oids[n.id]),typeof n.id=="undefined")if(n.name&&n.name in t.oids)n.id=t.oids[n.name];else{var f=new Error("Extension ID not specified.");throw f.extension=n,f}if(typeof n.value!="undefined")return n;if(n.name==="keyUsage"){var S=0,w=0,U=0;n.digitalSignature&&(w|=128,S=7),n.nonRepudiation&&(w|=64,S=6),n.keyEncipherment&&(w|=32,S=5),n.dataEncipherment&&(w|=16,S=4),n.keyAgreement&&(w|=8,S=3),n.keyCertSign&&(w|=4,S=2),n.cRLSign&&(w|=2,S=1),n.encipherOnly&&(w|=1,S=0),n.decipherOnly&&(U|=128,S=7);var N=String.fromCharCode(S);U!==0?N+=String.fromCharCode(w)+String.fromCharCode(U):w!==0&&(N+=String.fromCharCode(w)),n.value=e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,N)}else if(n.name==="basicConstraints")n.value=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]),n.cA&&n.value.value.push(e.create(e.Class.UNIVERSAL,e.Type.BOOLEAN,!1,"ÿ")),"pathLenConstraint"in n&&n.value.value.push(e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(n.pathLenConstraint).getBytes()));else if(n.name==="extKeyUsage"){n.value=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);var L=n.value.value;for(var P in n)n[P]===!0&&(P in u?L.push(e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(u[P]).getBytes())):P.indexOf(".")!==-1&&L.push(e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(P).getBytes())))}else if(n.name==="nsCertType"){var S=0,w=0;n.client&&(w|=128,S=7),n.server&&(w|=64,S=6),n.email&&(w|=32,S=5),n.objsign&&(w|=16,S=4),n.reserved&&(w|=8,S=3),n.sslCA&&(w|=4,S=2),n.emailCA&&(w|=2,S=1),n.objCA&&(w|=1,S=0);var N=String.fromCharCode(S);w!==0&&(N+=String.fromCharCode(w)),n.value=e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,N)}else if(n.name==="subjectAltName"||n.name==="issuerAltName"){n.value=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);for(var _,k=0;k<n.altNames.length;++k){_=n.altNames[k];var N=_.value;if(_.type===7&&_.ip){if(N=i.util.bytesFromIP(_.ip),N===null){var f=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw f.extension=n,f}}else _.type===8&&(_.oid?N=e.oidToDer(e.oidToDer(_.oid)):N=e.oidToDer(N));n.value.value.push(e.create(e.Class.CONTEXT_SPECIFIC,_.type,!1,N))}}else if(n.name==="nsComment"&&r.cert){if(!/^[\x00-\x7F]*$/.test(n.comment)||n.comment.length<1||n.comment.length>128)throw new Error('Invalid "nsComment" content.');n.value=e.create(e.Class.UNIVERSAL,e.Type.IA5STRING,!1,n.comment)}else if(n.name==="subjectKeyIdentifier"&&r.cert){var F=r.cert.generateSubjectKeyIdentifier();n.subjectKeyIdentifier=F.toHex(),n.value=e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,F.getBytes())}else if(n.name==="authorityKeyIdentifier"&&r.cert){n.value=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);var L=n.value.value;if(n.keyIdentifier){var K=n.keyIdentifier===!0?r.cert.generateSubjectKeyIdentifier().getBytes():n.keyIdentifier;L.push(e.create(e.Class.CONTEXT_SPECIFIC,0,!1,K))}if(n.authorityCertIssuer){var G=[e.create(e.Class.CONTEXT_SPECIFIC,4,!0,[E(n.authorityCertIssuer===!0?r.cert.issuer:n.authorityCertIssuer)])];L.push(e.create(e.Class.CONTEXT_SPECIFIC,1,!0,G))}if(n.serialNumber){var z=i.util.hexToBytes(n.serialNumber===!0?r.cert.serialNumber:n.serialNumber);L.push(e.create(e.Class.CONTEXT_SPECIFIC,2,!1,z))}}else if(n.name==="cRLDistributionPoints"){n.value=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);for(var L=n.value.value,Q=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]),Y=e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[]),_,k=0;k<n.altNames.length;++k){_=n.altNames[k];var N=_.value;if(_.type===7&&_.ip){if(N=i.util.bytesFromIP(_.ip),N===null){var f=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw f.extension=n,f}}else _.type===8&&(_.oid?N=e.oidToDer(e.oidToDer(_.oid)):N=e.oidToDer(N));Y.value.push(e.create(e.Class.CONTEXT_SPECIFIC,_.type,!1,N))}Q.value.push(e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[Y])),L.push(Q)}if(typeof n.value=="undefined"){var f=new Error("Extension value not specified.");throw f.extension=n,f}return n}function a(n,r){if(n===u["RSASSA-PSS"]){var f=[];return r.hash.algorithmOid!==void 0&&f.push(e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(r.hash.algorithmOid).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")])])),r.mgf.algorithmOid!==void 0&&f.push(e.create(e.Class.CONTEXT_SPECIFIC,1,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(r.mgf.algorithmOid).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(r.mgf.hash.algorithmOid).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")])])])),r.saltLength!==void 0&&f.push(e.create(e.Class.CONTEXT_SPECIFIC,2,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(r.saltLength).getBytes())])),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,f)}else return e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")}function l(n){var r=e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[]);if(n.attributes.length===0)return r;for(var f=n.attributes,S=0;S<f.length;++S){var w=f[S],U=w.value,N=e.Type.UTF8;"valueTagClass"in w&&(N=w.valueTagClass),N===e.Type.UTF8&&(U=i.util.encodeUtf8(U));var L=!1;"valueConstructed"in w&&(L=w.valueConstructed);var P=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(w.type).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[e.create(e.Class.UNIVERSAL,N,L,U)])]);r.value.push(P)}return r}var h=new Date("1950-01-01T00:00:00Z"),A=new Date("2050-01-01T00:00:00Z");function b(n){return n>=h&&n<A?e.create(e.Class.UNIVERSAL,e.Type.UTCTIME,!1,e.dateToUtcTime(n)):e.create(e.Class.UNIVERSAL,e.Type.GENERALIZEDTIME,!1,e.dateToGeneralizedTime(n))}return t.getTBSCertificate=function(n){var r=b(n.validity.notBefore),f=b(n.validity.notAfter),S=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(n.version).getBytes())]),e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,i.util.hexToBytes(n.serialNumber)),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(n.siginfo.algorithmOid).getBytes()),a(n.siginfo.algorithmOid,n.siginfo.parameters)]),E(n.issuer),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[r,f]),E(n.subject),t.publicKeyToAsn1(n.publicKey)]);return n.issuer.uniqueId&&S.value.push(e.create(e.Class.CONTEXT_SPECIFIC,1,!0,[e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,"\0"+n.issuer.uniqueId)])),n.subject.uniqueId&&S.value.push(e.create(e.Class.CONTEXT_SPECIFIC,2,!0,[e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,"\0"+n.subject.uniqueId)])),n.extensions.length>0&&S.value.push(t.certificateExtensionsToAsn1(n.extensions)),S},t.getCertificationRequestInfo=function(n){var r=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(n.version).getBytes()),E(n.subject),t.publicKeyToAsn1(n.publicKey),l(n)]);return r},t.distinguishedNameToAsn1=function(n){return E(n)},t.certificateToAsn1=function(n){var r=n.tbsCertificate||t.getTBSCertificate(n);return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[r,e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(n.signatureOid).getBytes()),a(n.signatureOid,n.signatureParameters)]),e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,"\0"+n.signature)])},t.certificateExtensionsToAsn1=function(n){var r=e.create(e.Class.CONTEXT_SPECIFIC,3,!0,[]),f=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);r.value.push(f);for(var S=0;S<n.length;++S)f.value.push(t.certificateExtensionToAsn1(n[S]));return r},t.certificateExtensionToAsn1=function(n){var r=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);r.value.push(e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(n.id).getBytes())),n.critical&&r.value.push(e.create(e.Class.UNIVERSAL,e.Type.BOOLEAN,!1,"ÿ"));var f=n.value;return typeof n.value!="string"&&(f=e.toDer(f).getBytes()),r.value.push(e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,f)),r},t.certificationRequestToAsn1=function(n){var r=n.certificationRequestInfo||t.getCertificationRequestInfo(n);return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[r,e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(n.signatureOid).getBytes()),a(n.signatureOid,n.signatureParameters)]),e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,"\0"+n.signature)])},t.createCaStore=function(n){var r={certs:{}};r.getIssuer=function(N){var L=f(N.issuer);return L},r.addCertificate=function(N){if(typeof N=="string"&&(N=i.pki.certificateFromPem(N)),S(N.subject),!r.hasCertificate(N))if(N.subject.hash in r.certs){var L=r.certs[N.subject.hash];i.util.isArray(L)||(L=[L]),L.push(N),r.certs[N.subject.hash]=L}else r.certs[N.subject.hash]=N},r.hasCertificate=function(N){typeof N=="string"&&(N=i.pki.certificateFromPem(N));var L=f(N.subject);if(!L)return!1;i.util.isArray(L)||(L=[L]);for(var P=e.toDer(t.certificateToAsn1(N)).getBytes(),_=0;_<L.length;++_){var k=e.toDer(t.certificateToAsn1(L[_])).getBytes();if(P===k)return!0}return!1},r.listAllCertificates=function(){var N=[];for(var L in r.certs)if(r.certs.hasOwnProperty(L)){var P=r.certs[L];if(!i.util.isArray(P))N.push(P);else for(var _=0;_<P.length;++_)N.push(P[_])}return N},r.removeCertificate=function(N){var L;if(typeof N=="string"&&(N=i.pki.certificateFromPem(N)),S(N.subject),!r.hasCertificate(N))return null;var P=f(N.subject);if(!i.util.isArray(P))return L=r.certs[N.subject.hash],delete r.certs[N.subject.hash],L;for(var _=e.toDer(t.certificateToAsn1(N)).getBytes(),k=0;k<P.length;++k){var F=e.toDer(t.certificateToAsn1(P[k])).getBytes();_===F&&(L=P[k],P.splice(k,1))}return P.length===0&&delete r.certs[N.subject.hash],L};function f(N){return S(N),r.certs[N.hash]||null}function S(N){if(!N.hash){var L=i.md.sha1.create();N.attributes=t.RDNAttributesAsArray(E(N),L),N.hash=L.digest().toHex()}}if(n)for(var w=0;w<n.length;++w){var U=n[w];r.addCertificate(U)}return r},t.certificateError={bad_certificate:"forge.pki.BadCertificate",unsupported_certificate:"forge.pki.UnsupportedCertificate",certificate_revoked:"forge.pki.CertificateRevoked",certificate_expired:"forge.pki.CertificateExpired",certificate_unknown:"forge.pki.CertificateUnknown",unknown_ca:"forge.pki.UnknownCertificateAuthority"},t.verifyCertificateChain=function(n,r,f){typeof f=="function"&&(f={verify:f}),f=f||{},r=r.slice(0);var S=r.slice(0),w=f.validityCheckDate;typeof w=="undefined"&&(w=new Date);var U=!0,N=null,L=0;do{var P=r.shift(),_=null,k=!1;if(w&&(w<P.validity.notBefore||w>P.validity.notAfter)&&(N={message:"Certificate is not valid yet or has expired.",error:t.certificateError.certificate_expired,notBefore:P.validity.notBefore,notAfter:P.validity.notAfter,now:w}),N===null){if(_=r[0]||n.getIssuer(P),_===null&&P.isIssuer(P)&&(k=!0,_=P),_){var F=_;i.util.isArray(F)||(F=[F]);for(var K=!1;!K&&F.length>0;){_=F.shift();try{K=_.verify(P)}catch(Jt){}}K||(N={message:"Certificate signature is invalid.",error:t.certificateError.bad_certificate})}N===null&&(!_||k)&&!n.hasCertificate(P)&&(N={message:"Certificate is not trusted.",error:t.certificateError.unknown_ca})}if(N===null&&_&&!P.isIssuer(_)&&(N={message:"Certificate issuer is invalid.",error:t.certificateError.bad_certificate}),N===null)for(var G={keyUsage:!0,basicConstraints:!0},z=0;N===null&&z<P.extensions.length;++z){var Q=P.extensions[z];Q.critical&&!(Q.name in G)&&(N={message:"Certificate has an unsupported critical extension.",error:t.certificateError.unsupported_certificate})}if(N===null&&(!U||r.length===0&&(!_||k))){var Y=P.getExtension("basicConstraints"),te=P.getExtension("keyUsage");if(te!==null&&(!te.keyCertSign||Y===null)&&(N={message:"Certificate keyUsage or basicConstraints conflict or indicate that the certificate is not a CA. If the certificate is the only one in the chain or isn't the first then the certificate must be a valid CA.",error:t.certificateError.bad_certificate}),N===null&&Y===null&&(N={message:"Certificate is missing basicConstraints extension and cannot be used as a CA.",error:t.certificateError.bad_certificate}),N===null&&Y!==null&&!Y.cA&&(N={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:t.certificateError.bad_certificate}),N===null&&te!==null&&"pathLenConstraint"in Y){var ie=L-1;ie>Y.pathLenConstraint&&(N={message:"Certificate basicConstraints pathLenConstraint violated.",error:t.certificateError.bad_certificate})}}var j=N===null?!0:N.error,Z=f.verify?f.verify(j,L,S):j;if(Z===!0)N=null;else throw j===!0&&(N={message:"The application rejected the certificate.",error:t.certificateError.bad_certificate}),(Z||Z===0)&&(typeof Z=="object"&&!i.util.isArray(Z)?(Z.message&&(N.message=Z.message),Z.error&&(N.error=Z.error)):typeof Z=="string"&&(N.error=Z)),N;U=!1,++L}while(r.length>0);return!0},Ze.exports}var Qt;function Sr(){if(Qt)return $e.exports;Qt=1;var i=H();ce(),xt(),he(),Er(),Ot(),de(),me(),Lt(),X(),zt();var e=i.asn1,t=i.pki,u=$e.exports=i.pkcs12=i.pkcs12||{},I={name:"ContentInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.contentType",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:e.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"content"}]},g={name:"PFX",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"version"},I,{name:"PFX.macData",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"mac",value:[{name:"PFX.macData.mac",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"macAlgorithm"},{name:"PFX.macData.mac.digestAlgorithm.parameters",optional:!0,tagClass:e.Class.UNIVERSAL,captureAsn1:"macAlgorithmParameters"}]},{name:"PFX.macData.mac.digest",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"macDigest"}]},{name:"PFX.macData.macSalt",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"macSalt"},{name:"PFX.macData.iterations",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,optional:!0,capture:"macIterations"}]}]},s={name:"SafeBag",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"SafeBag.bagId",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"bagId"},{name:"SafeBag.bagValue",tagClass:e.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"bagValue"},{name:"SafeBag.bagAttributes",tagClass:e.Class.UNIVERSAL,type:e.Type.SET,constructed:!0,optional:!0,capture:"bagAttributes"}]},o={name:"Attribute",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"Attribute.attrId",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"oid"},{name:"Attribute.attrValues",tagClass:e.Class.UNIVERSAL,type:e.Type.SET,constructed:!0,capture:"values"}]},d={name:"CertBag",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"CertBag.certId",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"certId"},{name:"CertBag.certValue",tagClass:e.Class.CONTEXT_SPECIFIC,constructed:!0,value:[{name:"CertBag.certValue[0]",tagClass:e.Class.UNIVERSAL,type:e.Class.OCTETSTRING,constructed:!1,capture:"cert"}]}]};function c(v,m,a,l){for(var h=[],A=0;A<v.length;A++)for(var b=0;b<v[A].safeBags.length;b++){var n=v[A].safeBags[b];if(!(l!==void 0&&n.type!==l)){if(m===null){h.push(n);continue}n.attributes[m]!==void 0&&n.attributes[m].indexOf(a)>=0&&h.push(n)}}return h}u.pkcs12FromAsn1=function(v,m,a){typeof m=="string"?(a=m,m=!0):m===void 0&&(m=!0);var l={},h=[];if(!e.validate(v,g,l,h)){var A=new Error("Cannot read PKCS#12 PFX. ASN.1 object is not an PKCS#12 PFX.");throw A.errors=A,A}var b={version:l.version.charCodeAt(0),safeContents:[],getBags:function(_){var k={},F;return"localKeyId"in _?F=_.localKeyId:"localKeyIdHex"in _&&(F=i.util.hexToBytes(_.localKeyIdHex)),F===void 0&&!("friendlyName"in _)&&"bagType"in _&&(k[_.bagType]=c(b.safeContents,null,null,_.bagType)),F!==void 0&&(k.localKeyId=c(b.safeContents,"localKeyId",F,_.bagType)),"friendlyName"in _&&(k.friendlyName=c(b.safeContents,"friendlyName",_.friendlyName,_.bagType)),k},getBagsByFriendlyName:function(_,k){return c(b.safeContents,"friendlyName",_,k)},getBagsByLocalKeyId:function(_,k){return c(b.safeContents,"localKeyId",_,k)}};if(l.version.charCodeAt(0)!==3){var A=new Error("PKCS#12 PFX of version other than 3 not supported.");throw A.version=l.version.charCodeAt(0),A}if(e.derToOid(l.contentType)!==t.oids.data){var A=new Error("Only PKCS#12 PFX in password integrity mode supported.");throw A.oid=e.derToOid(l.contentType),A}var n=l.content.value[0];if(n.tagClass!==e.Class.UNIVERSAL||n.type!==e.Type.OCTETSTRING)throw new Error("PKCS#12 authSafe content data is not an OCTET STRING.");if(n=T(n),l.mac){var r=null,f=0,S=e.derToOid(l.macAlgorithm);switch(S){case t.oids.sha1:r=i.md.sha1.create(),f=20;break;case t.oids.sha256:r=i.md.sha256.create(),f=32;break;case t.oids.sha384:r=i.md.sha384.create(),f=48;break;case t.oids.sha512:r=i.md.sha512.create(),f=64;break;case t.oids.md5:r=i.md.md5.create(),f=16;break}if(r===null)throw new Error("PKCS#12 uses unsupported MAC algorithm: "+S);var w=new i.util.ByteBuffer(l.macSalt),U="macIterations"in l?parseInt(i.util.bytesToHex(l.macIterations),16):1,N=u.generateKey(a,w,3,U,f,r),L=i.hmac.create();L.start(r,N),L.update(n.value);var P=L.getMac();if(P.getBytes()!==l.macDigest)throw new Error("PKCS#12 MAC could not be verified. Invalid password?")}else if(Array.isArray(v.value)&&v.value.length>2)throw new Error("Invalid PKCS#12. macData field present but MAC was not validated.");return R(b,n.value,m,a),b};function T(v){if(v.composed||v.constructed){for(var m=i.util.createBuffer(),a=0;a<v.value.length;++a)m.putBytes(v.value[a].value);v.composed=v.constructed=!1,v.value=m.getBytes()}return v}function R(v,m,a,l){if(m=e.fromDer(m,a),m.tagClass!==e.Class.UNIVERSAL||m.type!==e.Type.SEQUENCE||m.constructed!==!0)throw new Error("PKCS#12 AuthenticatedSafe expected to be a SEQUENCE OF ContentInfo");for(var h=0;h<m.value.length;h++){var A=m.value[h],b={},n=[];if(!e.validate(A,I,b,n)){var r=new Error("Cannot read ContentInfo.");throw r.errors=n,r}var f={encrypted:!1},S=null,w=b.content.value[0];switch(e.derToOid(b.contentType)){case t.oids.data:if(w.tagClass!==e.Class.UNIVERSAL||w.type!==e.Type.OCTETSTRING)throw new Error("PKCS#12 SafeContents Data is not an OCTET STRING.");S=T(w).value;break;case t.oids.encryptedData:S=x(w,l),f.encrypted=!0;break;default:var r=new Error("Unsupported PKCS#12 contentType.");throw r.contentType=e.derToOid(b.contentType),r}f.safeBags=y(S,a,l),v.safeContents.push(f)}}function x(v,m){var a={},l=[];if(!e.validate(v,i.pkcs7.asn1.encryptedDataValidator,a,l)){var h=new Error("Cannot read EncryptedContentInfo.");throw h.errors=l,h}var A=e.derToOid(a.contentType);if(A!==t.oids.data){var h=new Error("PKCS#12 EncryptedContentInfo ContentType is not Data.");throw h.oid=A,h}A=e.derToOid(a.encAlgorithm);var b=t.pbe.getCipher(A,a.encParameter,m),n=T(a.encryptedContentAsn1),r=i.util.createBuffer(n.value);if(b.update(r),!b.finish())throw new Error("Failed to decrypt PKCS#12 SafeContents.");return b.output.getBytes()}function y(v,m,a){if(!m&&v.length===0)return[];if(v=e.fromDer(v,m),v.tagClass!==e.Class.UNIVERSAL||v.type!==e.Type.SEQUENCE||v.constructed!==!0)throw new Error("PKCS#12 SafeContents expected to be a SEQUENCE OF SafeBag.");for(var l=[],h=0;h<v.value.length;h++){var A=v.value[h],b={},n=[];if(!e.validate(A,s,b,n)){var r=new Error("Cannot read SafeBag.");throw r.errors=n,r}var f={type:e.derToOid(b.bagId),attributes:E(b.bagAttributes)};l.push(f);var S,w,U=b.bagValue.value[0];switch(f.type){case t.oids.pkcs8ShroudedKeyBag:if(U=t.decryptPrivateKeyInfo(U,a),U===null)throw new Error("Unable to decrypt PKCS#8 ShroudedKeyBag, wrong password?");case t.oids.keyBag:try{f.key=t.privateKeyFromAsn1(U)}catch(L){f.key=null,f.asn1=U}continue;case t.oids.certBag:S=d,w=function(){if(e.derToOid(b.certId)!==t.oids.x509Certificate){var L=new Error("Unsupported certificate type, only X.509 supported.");throw L.oid=e.derToOid(b.certId),L}var P=e.fromDer(b.cert,m);try{f.cert=t.certificateFromAsn1(P,!0)}catch(_){f.cert=null,f.asn1=P}};break;default:var r=new Error("Unsupported PKCS#12 SafeBag type.");throw r.oid=f.type,r}if(S!==void 0&&!e.validate(U,S,b,n)){var r=new Error("Cannot read PKCS#12 "+S.name);throw r.errors=n,r}w()}return l}function E(v){var m={};if(v!==void 0)for(var a=0;a<v.length;++a){var l={},h=[];if(!e.validate(v[a],o,l,h)){var A=new Error("Cannot read PKCS#12 BagAttribute.");throw A.errors=h,A}var b=e.derToOid(l.oid);if(t.oids[b]!==void 0){m[t.oids[b]]=[];for(var n=0;n<l.values.length;++n)m[t.oids[b]].push(l.values[n].value)}}return m}return u.toPkcs12Asn1=function(v,m,a,l){l=l||{},l.saltSize=l.saltSize||8,l.count=l.count||2048,l.algorithm=l.algorithm||l.encAlgorithm||"aes128","useMac"in l||(l.useMac=!0),"localKeyId"in l||(l.localKeyId=null),"generateLocalKeyId"in l||(l.generateLocalKeyId=!0);var h=l.localKeyId,A;if(h!==null)h=i.util.hexToBytes(h);else if(l.generateLocalKeyId)if(m){var b=i.util.isArray(m)?m[0]:m;typeof b=="string"&&(b=t.certificateFromPem(b));var n=i.md.sha1.create();n.update(e.toDer(t.certificateToAsn1(b)).getBytes()),h=n.digest().getBytes()}else h=i.random.getBytes(20);var r=[];h!==null&&r.push(e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(t.oids.localKeyId).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,h)])])),"friendlyName"in l&&r.push(e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(t.oids.friendlyName).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[e.create(e.Class.UNIVERSAL,e.Type.BMPSTRING,!1,l.friendlyName)])])),r.length>0&&(A=e.create(e.Class.UNIVERSAL,e.Type.SET,!0,r));var f=[],S=[];m!==null&&(i.util.isArray(m)?S=m:S=[m]);for(var w=[],U=0;U<S.length;++U){m=S[U],typeof m=="string"&&(m=t.certificateFromPem(m));var N=U===0?A:void 0,L=t.certificateToAsn1(m),P=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(t.oids.certBag).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(t.oids.x509Certificate).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,e.toDer(L).getBytes())])])]),N]);w.push(P)}if(w.length>0){var _=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,w),k=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(t.oids.data).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,e.toDer(_).getBytes())])]);f.push(k)}var F=null;if(v!==null){var K=t.wrapRsaPrivateKey(t.privateKeyToAsn1(v));a===null?F=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(t.oids.keyBag).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[K]),A]):F=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(t.oids.pkcs8ShroudedKeyBag).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[t.encryptPrivateKeyInfo(K,a,l)]),A]);var G=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[F]),z=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(t.oids.data).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,e.toDer(G).getBytes())])]);f.push(z)}var Q=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,f),Y;if(l.useMac){var n=i.md.sha1.create(),te=new i.util.ByteBuffer(i.random.getBytes(l.saltSize)),ie=l.count,v=u.generateKey(a,te,3,ie,20),j=i.hmac.create();j.start(n,v),j.update(e.toDer(Q).getBytes());var Z=j.getMac();Y=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(t.oids.sha1).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")]),e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,Z.getBytes())]),e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,te.getBytes()),e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(ie).getBytes())])}return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(3).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(t.oids.data).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,e.toDer(Q).getBytes())])]),Y])},u.generateKey=i.pbe.generatePkcs12Key,$e.exports}var Ht;function Tr(){if(Ht)return we.exports;Ht=1;var i=H();ce(),he(),Ot(),Me(),Tt(),Sr(),qt(),me(),X(),zt();var e=i.asn1,t=we.exports=i.pki=i.pki||{};return t.pemToDer=function(u){var I=i.pem.decode(u)[0];if(I.procType&&I.procType.type==="ENCRYPTED")throw new Error("Could not convert PEM to DER; PEM is encrypted.");return i.util.createBuffer(I.body)},t.privateKeyFromPem=function(u){var I=i.pem.decode(u)[0];if(I.type!=="PRIVATE KEY"&&I.type!=="RSA PRIVATE KEY"){var g=new Error('Could not convert private key from PEM; PEM header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".');throw g.headerType=I.type,g}if(I.procType&&I.procType.type==="ENCRYPTED")throw new Error("Could not convert private key from PEM; PEM is encrypted.");var s=e.fromDer(I.body);return t.privateKeyFromAsn1(s)},t.privateKeyToPem=function(u,I){var g={type:"RSA PRIVATE KEY",body:e.toDer(t.privateKeyToAsn1(u)).getBytes()};return i.pem.encode(g,{maxline:I})},t.privateKeyInfoToPem=function(u,I){var g={type:"PRIVATE KEY",body:e.toDer(u).getBytes()};return i.pem.encode(g,{maxline:I})},we.exports}var Ir=Tr();const rt=Ie(Ir);var Ar=X();const Br=Ie(Ar);function br(i){let e="";for(const t of i)e+=String.fromCharCode(t);return e}function Nr(i){return Uint8Array.from(i,e=>e.charCodeAt(0)&255)}function Rr(i){return i.replace(/(.{64})/g,`$1
15
+ `).trim()}function wr(i){const e=(i!=null?i:"").trim();if(e==="")throw new Error("RSA 私钥为空");if(e.includes("-----BEGIN"))return rt.privateKeyFromPem(e);const t=e.replace(/\s+/g,""),u=[];try{return rt.privateKeyFromAsn1(pr.fromDer(Br.decode64(t)))}catch(g){u.push(g)}const I=Rr(t);for(const g of["PRIVATE KEY","RSA PRIVATE KEY"])try{return rt.privateKeyFromPem(`-----BEGIN ${g}-----
16
+ ${I}
17
+ -----END ${g}-----`)}catch(s){u.push(s)}throw new Error(`RSA 私钥解析失败(已试 PKCS1-DER / PKCS8-PEM / PKCS1-PEM):${u[0]instanceof Error?u[0].message:String(u[0])}`)}function*Wt(i){const e=wr(i.privateKey),t=Math.ceil(e.n.bitLength()/8),{data:u}=i;if(u.length===0)throw new Error("RSA 解密:密文为空");const I=[];for(let d=0;d<u.length;d+=t){const c=Math.min(d+t,u.length);try{const T=e.decrypt(br(u.subarray(d,c)),"RSAES-PKCS1-V1_5");I.push(Nr(T)),yield I.length}catch(T){const R=T instanceof Error?T.message:String(T);throw new Error(`RSA-PKCS1 解密失败(密文 ${u.length}B,块 ${d}..${c},keySize ${t}B,私钥 ${e.n.bitLength()}bit):${R}`)}}const g=I.reduce((d,c)=>d+c.length,0),s=new Uint8Array(g);let o=0;for(const d of I)s.set(d,o),o+=d.length;return s}function Ur(i){const e=Wt(i);let t=e.next();for(;!t.done;)t=e.next();return t.value}const at=2654435769,Xt=16,ye=8,it=16;function Lr(i){if(i.length<it)throw new Error(`TEA key 长度不足:${i.length},需 ≥ ${it} 字节`);const e=new DataView(i.buffer,i.byteOffset,it);return[e.getUint32(0,!0),e.getUint32(4,!0),e.getUint32(8,!0),e.getUint32(12,!0)]}function Yt(i,e,t,u,I=new Uint8Array(i.length)){const g=Lr(e),o=Math.floor(i.length/ye),d=new DataView(i.buffer,i.byteOffset,i.byteLength),c=new DataView(I.buffer,I.byteOffset,I.byteLength);if(t==="decrypt"){const[R,x,y,E]=g;for(let v=0;v<o*ye;v+=ye){let m=d.getUint32(v,!0),a=d.getUint32(v+4,!0),l=Math.imul(at,16)>>>0;for(let h=0;h<Xt;h++)a=a-(Math.imul(m,16)+y^m+l^(m>>>5)+E)>>>0,m=m-(Math.imul(a,16)+R^a+l^(a>>>5)+x)>>>0,l=l-at>>>0;c.setUint32(v,m,!0),c.setUint32(v+4,a,!0)}}else{const[R,x,y,E]=g;for(let v=0;v<o*ye;v+=ye){let m=d.getUint32(v,!0),a=d.getUint32(v+4,!0),l=0;for(let h=0;h<Xt;h++)l=l+at>>>0,m=m+(Math.imul(a,16)+R^a+l^(a>>>5)+x)>>>0,a=a+(Math.imul(m,16)+y^m+l^(m>>>5)+E)>>>0;c.setUint32(v,m,!0),c.setUint32(v+4,a,!0)}}const T=o*ye;return T<i.length&&I.set(i.subarray(T),T),I}function $t(i,e){return Yt(e,i,"decrypt")}function Dr(i,e){return Yt(e,i,"encrypt")}function*_r(i,e){const t=[];for(const u of e){let I;try{if(I=Ur({data:new Uint8Array(u.secretKey),privateKey:i[u.keyIndex]}),I.length<16)throw new Error("RSA secret key is too short")}catch(g){t.push({itemIndex:u.itemIndex,result:{ok:!1,stage:"rsa"}}),yield t.length;continue}try{const g=$t(I,new Uint8Array(u.cipherData));t.push({itemIndex:u.itemIndex,result:{ok:!0,plain:g.buffer}})}catch(g){t.push({itemIndex:u.itemIndex,result:{ok:!1,stage:"tea"}})}yield t.length}return t}function*Pr(i,e,t){return(i==="encrypt-tea"?Dr:$t)(new Uint8Array(e),new Uint8Array(t))}function kr(i){const e=[];let t,u=!1,I,g=0;function s(R,x){i.postMessage(sr(nr({},R),{version:1,generation:t!=null?t:0}),x)}function o(){u=!0,I==null||I(),I=void 0;for(const R of e.splice(0))R.blocks.return(new Uint8Array)}function d(){o(),s({kind:"protocol-error",operationId:""})}function c(){var R,x;!u&&I===void 0&&e.length>0&&(I=(x=(R=i.scheduleTask)==null?void 0:R.call(i,T))!=null?x:(()=>{const y=setTimeout(T,0);return()=>clearTimeout(y)})())}function T(){if(I=void 0,u||e.length===0)return;const R=e.findIndex(m=>m.priority==="foreground"),x=e.findIndex(m=>m.priority==="background"),y=R>=0&&(g<4||x<0)?R:x,E=e.splice(y,1)[0];g=E.priority==="foreground"?g+1:0;let v;try{v=E.blocks.next()}catch(m){E.blocks.return(new Uint8Array),s({kind:"crypto-error",operationId:E.operationId}),c();return}if(v.done)if(E.kind!=="decrypt-batch"){const m=v.value.buffer;i.postMessage({version:1,generation:t,operationId:E.operationId,kind:"result",data:m},[m])}else{const m=v.value,a=m.flatMap(l=>l.result.ok?[l.result.plain]:[]);i.postMessage({version:1,generation:t,operationId:E.operationId,kind:"batch-result",items:m},a)}else e.push(E),i.postMessage({version:1,generation:t,operationId:E.operationId,kind:"progress",completed:v.value});c()}return{receive(R){if(u)return;if(!ur(R))return d();if(R.kind==="init"){if(t!==void 0)return d();t=R.generation,s({kind:"ready",operationId:""});return}if(t===void 0||t!==R.generation)return d();const x=e.findIndex(y=>y.operationId===R.operationId);if(R.kind==="cancel")x>=0&&e.splice(x,1)[0].blocks.return(new Uint8Array),s({kind:"cancelled",operationId:R.operationId});else if(R.kind==="promote")x>=0&&(e[x].priority="foreground");else{if(x>=0||e.length>=16)return d();e.push({operationId:R.operationId,priority:R.priority,kind:R.kind,blocks:R.kind==="decrypt-rsa"?Wt({data:new Uint8Array(R.data),privateKey:R.privateKey}):R.kind==="decrypt-tea"||R.kind==="encrypt-tea"?Pr(R.kind,R.teaKey,R.kind==="encrypt-tea"?R.plain:R.cipherData):_r(R.keys,R.items)}),c()}},dispose:o}}const jt=globalThis,Zt=new MessageChannel;let xe;Zt.port1.onmessage=()=>{const i=xe;xe=void 0,i==null||i()};const Or=kr({postMessage:(i,e)=>jt.postMessage(i,e),scheduleTask(i){return xe=i,Zt.port2.postMessage(null),()=>{xe=void 0}}});jt.onmessage=i=>Or.receive(i.data)})();