bantou 0.1.0 → 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 (515) hide show
  1. package/.output/nitro.json +13 -0
  2. package/.output/public/_nuxt/BmGsA4i2.js +1 -0
  3. package/.output/public/_nuxt/D_G6gzEa.js +1 -0
  4. package/.output/public/_nuxt/builds/latest.json +1 -0
  5. package/.output/public/_nuxt/builds/meta/1a8fc623-6671-445b-bdd3-c3d073520a3a.json +1 -0
  6. package/.output/public/_nuxt/entry.CZSvzYhH.css +1 -0
  7. package/.output/public/_nuxt/error-404.C3wqHTJz.css +1 -0
  8. package/.output/public/_nuxt/error-500.D6rBzoDj.css +1 -0
  9. package/.output/public/_nuxt/pdFQkwM_.js +4 -0
  10. package/.output/server/chunks/_/error-500.mjs +20 -0
  11. package/.output/server/chunks/_/error-500.mjs.map +1 -0
  12. package/.output/server/chunks/nitro/nitro.mjs +5870 -0
  13. package/.output/server/chunks/nitro/nitro.mjs.map +1 -0
  14. package/.output/server/chunks/routes/mcp.mjs +22 -0
  15. package/.output/server/chunks/routes/mcp.mjs.map +1 -0
  16. package/.output/server/chunks/routes/renderer.mjs +462 -0
  17. package/.output/server/chunks/routes/renderer.mjs.map +1 -0
  18. package/.output/server/chunks/virtual/_virtual_spa-template.mjs +4 -0
  19. package/.output/server/chunks/virtual/_virtual_spa-template.mjs.map +1 -0
  20. package/.output/server/chunks/virtual/precomputed.mjs +4 -0
  21. package/.output/server/chunks/virtual/precomputed.mjs.map +1 -0
  22. package/.output/server/index.mjs +18 -0
  23. package/.output/server/index.mjs.map +1 -0
  24. package/.output/server/node_modules/@babel/parser/lib/index.js +14657 -0
  25. package/.output/server/node_modules/@babel/parser/package.json +50 -0
  26. package/.output/server/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js +64 -0
  27. package/.output/server/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js +16 -0
  28. package/.output/server/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.js +32 -0
  29. package/.output/server/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js +246 -0
  30. package/.output/server/node_modules/@modelcontextprotocol/sdk/dist/esm/package.json +1 -0
  31. package/.output/server/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js +41 -0
  32. package/.output/server/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js +429 -0
  33. package/.output/server/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js +971 -0
  34. package/.output/server/node_modules/@modelcontextprotocol/sdk/dist/esm/server/requestBody.js +58 -0
  35. package/.output/server/node_modules/@modelcontextprotocol/sdk/dist/esm/server/sseKeepAlive.js +13 -0
  36. package/.output/server/node_modules/@modelcontextprotocol/sdk/dist/esm/server/webStandardStreamableHttp.js +961 -0
  37. package/.output/server/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js +228 -0
  38. package/.output/server/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js +51 -0
  39. package/.output/server/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/mediaType.js +57 -0
  40. package/.output/server/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js +1137 -0
  41. package/.output/server/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js +92 -0
  42. package/.output/server/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/uriTemplate.js +239 -0
  43. package/.output/server/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js +2065 -0
  44. package/.output/server/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js +87 -0
  45. package/.output/server/node_modules/@modelcontextprotocol/sdk/package.json +165 -0
  46. package/.output/server/node_modules/@parcel/watcher-wasm/index.mjs +349 -0
  47. package/.output/server/node_modules/@parcel/watcher-wasm/package.json +44 -0
  48. package/.output/server/node_modules/@parcel/watcher-wasm/watcher.wasm +0 -0
  49. package/.output/server/node_modules/@parcel/watcher-wasm/wrapper.js +88 -0
  50. package/.output/server/node_modules/@unagents/messenger-broker/dist/index.mjs +12 -0
  51. package/.output/server/node_modules/@unagents/messenger-broker/dist/shared/messenger-broker.B8W77sqB.mjs +1177 -0
  52. package/.output/server/node_modules/@unagents/messenger-broker/package.json +37 -0
  53. package/.output/server/node_modules/@unagents/messenger-client/dist/index.mjs +9 -0
  54. package/.output/server/node_modules/@unagents/messenger-client/dist/shared/messenger-client.CfQVmH_Z.mjs +975 -0
  55. package/.output/server/node_modules/@unagents/messenger-client/dist/shared/messenger-client.CoDKzubj.mjs +1000 -0
  56. package/.output/server/node_modules/@unagents/messenger-client/package.json +37 -0
  57. package/.output/server/node_modules/@unagents/messenger-protocol/dist/index.mjs +103 -0
  58. package/.output/server/node_modules/@unagents/messenger-protocol/package.json +29 -0
  59. package/.output/server/node_modules/@vue/compiler-core/dist/compiler-core.cjs.prod.js +6802 -0
  60. package/.output/server/node_modules/@vue/compiler-core/package.json +58 -0
  61. package/.output/server/node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.prod.js +729 -0
  62. package/.output/server/node_modules/@vue/compiler-dom/package.json +57 -0
  63. package/.output/server/node_modules/@vue/compiler-ssr/dist/compiler-ssr.cjs.js +1420 -0
  64. package/.output/server/node_modules/@vue/compiler-ssr/package.json +34 -0
  65. package/.output/server/node_modules/@vue/reactivity/dist/reactivity.cjs.prod.js +1933 -0
  66. package/.output/server/node_modules/@vue/reactivity/package.json +55 -0
  67. package/.output/server/node_modules/@vue/runtime-core/dist/runtime-core.cjs.prod.js +7085 -0
  68. package/.output/server/node_modules/@vue/runtime-core/package.json +52 -0
  69. package/.output/server/node_modules/@vue/runtime-dom/dist/runtime-dom.cjs.prod.js +1917 -0
  70. package/.output/server/node_modules/@vue/runtime-dom/package.json +60 -0
  71. package/.output/server/node_modules/@vue/server-renderer/dist/server-renderer.cjs.prod.js +951 -0
  72. package/.output/server/node_modules/@vue/server-renderer/package.json +53 -0
  73. package/.output/server/node_modules/@vue/shared/dist/shared.cjs.prod.js +655 -0
  74. package/.output/server/node_modules/@vue/shared/package.json +47 -0
  75. package/.output/server/node_modules/ajv/dist/ajv.js +50 -0
  76. package/.output/server/node_modules/ajv/dist/compile/codegen/code.js +156 -0
  77. package/.output/server/node_modules/ajv/dist/compile/codegen/index.js +697 -0
  78. package/.output/server/node_modules/ajv/dist/compile/codegen/scope.js +143 -0
  79. package/.output/server/node_modules/ajv/dist/compile/errors.js +123 -0
  80. package/.output/server/node_modules/ajv/dist/compile/index.js +242 -0
  81. package/.output/server/node_modules/ajv/dist/compile/names.js +28 -0
  82. package/.output/server/node_modules/ajv/dist/compile/ref_error.js +12 -0
  83. package/.output/server/node_modules/ajv/dist/compile/resolve.js +155 -0
  84. package/.output/server/node_modules/ajv/dist/compile/rules.js +26 -0
  85. package/.output/server/node_modules/ajv/dist/compile/util.js +178 -0
  86. package/.output/server/node_modules/ajv/dist/compile/validate/applicability.js +19 -0
  87. package/.output/server/node_modules/ajv/dist/compile/validate/boolSchema.js +50 -0
  88. package/.output/server/node_modules/ajv/dist/compile/validate/dataType.js +203 -0
  89. package/.output/server/node_modules/ajv/dist/compile/validate/defaults.js +35 -0
  90. package/.output/server/node_modules/ajv/dist/compile/validate/index.js +520 -0
  91. package/.output/server/node_modules/ajv/dist/compile/validate/keyword.js +124 -0
  92. package/.output/server/node_modules/ajv/dist/compile/validate/subschema.js +81 -0
  93. package/.output/server/node_modules/ajv/dist/core.js +618 -0
  94. package/.output/server/node_modules/ajv/dist/refs/data.json +13 -0
  95. package/.output/server/node_modules/ajv/dist/refs/json-schema-draft-07.json +151 -0
  96. package/.output/server/node_modules/ajv/dist/runtime/equal.js +7 -0
  97. package/.output/server/node_modules/ajv/dist/runtime/ucs2length.js +24 -0
  98. package/.output/server/node_modules/ajv/dist/runtime/uri.js +6 -0
  99. package/.output/server/node_modules/ajv/dist/runtime/validation_error.js +11 -0
  100. package/.output/server/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js +49 -0
  101. package/.output/server/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js +106 -0
  102. package/.output/server/node_modules/ajv/dist/vocabularies/applicator/allOf.js +23 -0
  103. package/.output/server/node_modules/ajv/dist/vocabularies/applicator/anyOf.js +12 -0
  104. package/.output/server/node_modules/ajv/dist/vocabularies/applicator/contains.js +95 -0
  105. package/.output/server/node_modules/ajv/dist/vocabularies/applicator/dependencies.js +85 -0
  106. package/.output/server/node_modules/ajv/dist/vocabularies/applicator/if.js +66 -0
  107. package/.output/server/node_modules/ajv/dist/vocabularies/applicator/index.js +44 -0
  108. package/.output/server/node_modules/ajv/dist/vocabularies/applicator/items.js +52 -0
  109. package/.output/server/node_modules/ajv/dist/vocabularies/applicator/items2020.js +30 -0
  110. package/.output/server/node_modules/ajv/dist/vocabularies/applicator/not.js +26 -0
  111. package/.output/server/node_modules/ajv/dist/vocabularies/applicator/oneOf.js +60 -0
  112. package/.output/server/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js +75 -0
  113. package/.output/server/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js +12 -0
  114. package/.output/server/node_modules/ajv/dist/vocabularies/applicator/properties.js +54 -0
  115. package/.output/server/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js +38 -0
  116. package/.output/server/node_modules/ajv/dist/vocabularies/applicator/thenElse.js +13 -0
  117. package/.output/server/node_modules/ajv/dist/vocabularies/code.js +131 -0
  118. package/.output/server/node_modules/ajv/dist/vocabularies/core/id.js +10 -0
  119. package/.output/server/node_modules/ajv/dist/vocabularies/core/index.js +16 -0
  120. package/.output/server/node_modules/ajv/dist/vocabularies/core/ref.js +122 -0
  121. package/.output/server/node_modules/ajv/dist/vocabularies/discriminator/index.js +104 -0
  122. package/.output/server/node_modules/ajv/dist/vocabularies/discriminator/types.js +9 -0
  123. package/.output/server/node_modules/ajv/dist/vocabularies/draft7.js +17 -0
  124. package/.output/server/node_modules/ajv/dist/vocabularies/format/format.js +92 -0
  125. package/.output/server/node_modules/ajv/dist/vocabularies/format/index.js +6 -0
  126. package/.output/server/node_modules/ajv/dist/vocabularies/metadata.js +18 -0
  127. package/.output/server/node_modules/ajv/dist/vocabularies/validation/const.js +25 -0
  128. package/.output/server/node_modules/ajv/dist/vocabularies/validation/enum.js +48 -0
  129. package/.output/server/node_modules/ajv/dist/vocabularies/validation/index.js +33 -0
  130. package/.output/server/node_modules/ajv/dist/vocabularies/validation/limitItems.js +24 -0
  131. package/.output/server/node_modules/ajv/dist/vocabularies/validation/limitLength.js +27 -0
  132. package/.output/server/node_modules/ajv/dist/vocabularies/validation/limitNumber.js +27 -0
  133. package/.output/server/node_modules/ajv/dist/vocabularies/validation/limitProperties.js +24 -0
  134. package/.output/server/node_modules/ajv/dist/vocabularies/validation/multipleOf.js +26 -0
  135. package/.output/server/node_modules/ajv/dist/vocabularies/validation/pattern.js +33 -0
  136. package/.output/server/node_modules/ajv/dist/vocabularies/validation/required.js +79 -0
  137. package/.output/server/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js +64 -0
  138. package/.output/server/node_modules/ajv/package.json +126 -0
  139. package/.output/server/node_modules/ajv-formats/dist/formats.js +208 -0
  140. package/.output/server/node_modules/ajv-formats/dist/index.js +37 -0
  141. package/.output/server/node_modules/ajv-formats/dist/limit.js +69 -0
  142. package/.output/server/node_modules/ajv-formats/package.json +74 -0
  143. package/.output/server/node_modules/consola/dist/chunks/prompt.mjs +280 -0
  144. package/.output/server/node_modules/consola/dist/core.mjs +512 -0
  145. package/.output/server/node_modules/consola/dist/index.mjs +651 -0
  146. package/.output/server/node_modules/consola/dist/shared/consola.DRwqZj3T.mjs +72 -0
  147. package/.output/server/node_modules/consola/dist/shared/consola.DXBYu-KD.mjs +288 -0
  148. package/.output/server/node_modules/consola/dist/utils.mjs +54 -0
  149. package/.output/server/node_modules/consola/package.json +136 -0
  150. package/.output/server/node_modules/content-type/index.js +225 -0
  151. package/.output/server/node_modules/content-type/package.json +42 -0
  152. package/.output/server/node_modules/cookie-es/dist/index.mjs +268 -0
  153. package/.output/server/node_modules/cookie-es/package.json +46 -0
  154. package/.output/server/node_modules/crossws/dist/_chunks/_request.mjs +83 -0
  155. package/.output/server/node_modules/crossws/dist/_chunks/adapter.mjs +234 -0
  156. package/.output/server/node_modules/crossws/dist/_chunks/error.mjs +7 -0
  157. package/.output/server/node_modules/crossws/dist/_chunks/libs/ws.mjs +6 -0
  158. package/.output/server/node_modules/crossws/dist/_chunks/node.mjs +220 -0
  159. package/.output/server/node_modules/crossws/dist/_chunks/peer.mjs +208 -0
  160. package/.output/server/node_modules/crossws/dist/adapters/node.mjs +1 -0
  161. package/.output/server/node_modules/crossws/package.json +115 -0
  162. package/.output/server/node_modules/defu/dist/defu.mjs +69 -0
  163. package/.output/server/node_modules/defu/package.json +48 -0
  164. package/.output/server/node_modules/destr/dist/index.mjs +72 -0
  165. package/.output/server/node_modules/destr/package.json +47 -0
  166. package/.output/server/node_modules/devalue/index.js +17 -0
  167. package/.output/server/node_modules/devalue/package.json +39 -0
  168. package/.output/server/node_modules/devalue/src/base64.js +60 -0
  169. package/.output/server/node_modules/devalue/src/constants.js +12 -0
  170. package/.output/server/node_modules/devalue/src/operations.js +221 -0
  171. package/.output/server/node_modules/devalue/src/parse.js +279 -0
  172. package/.output/server/node_modules/devalue/src/stringify.js +433 -0
  173. package/.output/server/node_modules/devalue/src/uneval.js +698 -0
  174. package/.output/server/node_modules/devalue/src/utils.js +190 -0
  175. package/.output/server/node_modules/entities/dist/commonjs/decode-codepoint.js +77 -0
  176. package/.output/server/node_modules/entities/dist/commonjs/decode.js +568 -0
  177. package/.output/server/node_modules/entities/dist/commonjs/generated/decode-data-html.js +7 -0
  178. package/.output/server/node_modules/entities/dist/commonjs/generated/decode-data-xml.js +7 -0
  179. package/.output/server/node_modules/entities/dist/commonjs/internal/bin-trie-flags.js +21 -0
  180. package/.output/server/node_modules/entities/dist/commonjs/internal/decode-shared.js +31 -0
  181. package/.output/server/node_modules/entities/dist/commonjs/package.json +3 -0
  182. package/.output/server/node_modules/entities/package.json +120 -0
  183. package/.output/server/node_modules/estree-walker/dist/umd/estree-walker.js +344 -0
  184. package/.output/server/node_modules/estree-walker/package.json +37 -0
  185. package/.output/server/node_modules/fast-deep-equal/index.js +46 -0
  186. package/.output/server/node_modules/fast-deep-equal/package.json +61 -0
  187. package/.output/server/node_modules/fast-uri/index.js +711 -0
  188. package/.output/server/node_modules/fast-uri/lib/schemes.js +272 -0
  189. package/.output/server/node_modules/fast-uri/lib/utils.js +799 -0
  190. package/.output/server/node_modules/fast-uri/package.json +68 -0
  191. package/.output/server/node_modules/get-port-please/dist/index.mjs +430 -0
  192. package/.output/server/node_modules/get-port-please/package.json +39 -0
  193. package/.output/server/node_modules/h3/dist/index.mjs +2498 -0
  194. package/.output/server/node_modules/h3/package.json +75 -0
  195. package/.output/server/node_modules/hookable/dist/index.mjs +257 -0
  196. package/.output/server/node_modules/hookable/package.json +54 -0
  197. package/.output/server/node_modules/http-shutdown/index.js +85 -0
  198. package/.output/server/node_modules/http-shutdown/package.json +32 -0
  199. package/.output/server/node_modules/iron-webcrypto/dist/index.js +298 -0
  200. package/.output/server/node_modules/iron-webcrypto/package.json +72 -0
  201. package/.output/server/node_modules/is-extglob/index.js +20 -0
  202. package/.output/server/node_modules/is-extglob/package.json +69 -0
  203. package/.output/server/node_modules/is-glob/index.js +150 -0
  204. package/.output/server/node_modules/is-glob/package.json +81 -0
  205. package/.output/server/node_modules/jiti/dist/jiti.cjs +1 -0
  206. package/.output/server/node_modules/jiti/lib/jiti.mjs +29 -0
  207. package/.output/server/node_modules/jiti/package.json +146 -0
  208. package/.output/server/node_modules/json-schema-traverse/index.js +93 -0
  209. package/.output/server/node_modules/json-schema-traverse/package.json +43 -0
  210. package/.output/server/node_modules/listhen/dist/chunks/xdg-open.mjs +1069 -0
  211. package/.output/server/node_modules/listhen/dist/index.mjs +19 -0
  212. package/.output/server/node_modules/listhen/dist/shared/listhen.tqe5I1Rl.mjs +1040 -0
  213. package/.output/server/node_modules/listhen/package.json +84 -0
  214. package/.output/server/node_modules/napi-wasm/index.mjs +1371 -0
  215. package/.output/server/node_modules/napi-wasm/package.json +33 -0
  216. package/.output/server/node_modules/node-forge/lib/aes.js +1091 -0
  217. package/.output/server/node_modules/node-forge/lib/aesCipherSuites.js +282 -0
  218. package/.output/server/node_modules/node-forge/lib/asn1-validator.js +91 -0
  219. package/.output/server/node_modules/node-forge/lib/asn1.js +1522 -0
  220. package/.output/server/node_modules/node-forge/lib/baseN.js +186 -0
  221. package/.output/server/node_modules/node-forge/lib/cipher.js +230 -0
  222. package/.output/server/node_modules/node-forge/lib/cipherModes.js +1027 -0
  223. package/.output/server/node_modules/node-forge/lib/des.js +496 -0
  224. package/.output/server/node_modules/node-forge/lib/ed25519.js +1091 -0
  225. package/.output/server/node_modules/node-forge/lib/forge.js +13 -0
  226. package/.output/server/node_modules/node-forge/lib/hmac.js +146 -0
  227. package/.output/server/node_modules/node-forge/lib/index.js +33 -0
  228. package/.output/server/node_modules/node-forge/lib/jsbn.js +1294 -0
  229. package/.output/server/node_modules/node-forge/lib/kem.js +168 -0
  230. package/.output/server/node_modules/node-forge/lib/log.js +319 -0
  231. package/.output/server/node_modules/node-forge/lib/md.all.js +13 -0
  232. package/.output/server/node_modules/node-forge/lib/md.js +11 -0
  233. package/.output/server/node_modules/node-forge/lib/md5.js +289 -0
  234. package/.output/server/node_modules/node-forge/lib/mgf.js +12 -0
  235. package/.output/server/node_modules/node-forge/lib/mgf1.js +57 -0
  236. package/.output/server/node_modules/node-forge/lib/oids.js +180 -0
  237. package/.output/server/node_modules/node-forge/lib/pbe.js +1029 -0
  238. package/.output/server/node_modules/node-forge/lib/pbkdf2.js +211 -0
  239. package/.output/server/node_modules/node-forge/lib/pem.js +413 -0
  240. package/.output/server/node_modules/node-forge/lib/pkcs1.js +276 -0
  241. package/.output/server/node_modules/node-forge/lib/pkcs12.js +1081 -0
  242. package/.output/server/node_modules/node-forge/lib/pkcs7.js +1260 -0
  243. package/.output/server/node_modules/node-forge/lib/pkcs7asn1.js +410 -0
  244. package/.output/server/node_modules/node-forge/lib/pki.js +102 -0
  245. package/.output/server/node_modules/node-forge/lib/prime.js +297 -0
  246. package/.output/server/node_modules/node-forge/lib/prng.js +419 -0
  247. package/.output/server/node_modules/node-forge/lib/pss.js +241 -0
  248. package/.output/server/node_modules/node-forge/lib/random.js +191 -0
  249. package/.output/server/node_modules/node-forge/lib/rc2.js +410 -0
  250. package/.output/server/node_modules/node-forge/lib/rsa.js +2014 -0
  251. package/.output/server/node_modules/node-forge/lib/sha1.js +319 -0
  252. package/.output/server/node_modules/node-forge/lib/sha256.js +327 -0
  253. package/.output/server/node_modules/node-forge/lib/sha512.js +561 -0
  254. package/.output/server/node_modules/node-forge/lib/ssh.js +236 -0
  255. package/.output/server/node_modules/node-forge/lib/tls.js +4334 -0
  256. package/.output/server/node_modules/node-forge/lib/util.js +2652 -0
  257. package/.output/server/node_modules/node-forge/lib/x509.js +3257 -0
  258. package/.output/server/node_modules/node-forge/package.json +123 -0
  259. package/.output/server/node_modules/node-mock-http/dist/_polyfill/buffer/node.mjs +1 -0
  260. package/.output/server/node_modules/node-mock-http/dist/_polyfill/events/node.mjs +1 -0
  261. package/.output/server/node_modules/node-mock-http/dist/index.mjs +1 -0
  262. package/.output/server/node_modules/node-mock-http/package.json +63 -0
  263. package/.output/server/node_modules/nostics/dist/formatters/ansi.mjs +19 -0
  264. package/.output/server/node_modules/nostics/dist/index.mjs +194 -0
  265. package/.output/server/node_modules/nostics/package.json +126 -0
  266. package/.output/server/node_modules/pathe/dist/index.mjs +19 -0
  267. package/.output/server/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs +249 -0
  268. package/.output/server/node_modules/pathe/package.json +61 -0
  269. package/.output/server/node_modules/picomatch/index.js +17 -0
  270. package/.output/server/node_modules/picomatch/lib/constants.js +184 -0
  271. package/.output/server/node_modules/picomatch/lib/parse.js +1425 -0
  272. package/.output/server/node_modules/picomatch/lib/picomatch.js +361 -0
  273. package/.output/server/node_modules/picomatch/lib/scan.js +403 -0
  274. package/.output/server/node_modules/picomatch/lib/utils.js +72 -0
  275. package/.output/server/node_modules/picomatch/package.json +83 -0
  276. package/.output/server/node_modules/radix3/dist/index.mjs +262 -0
  277. package/.output/server/node_modules/radix3/package.json +52 -0
  278. package/.output/server/node_modules/source-map-js/lib/array-set.js +121 -0
  279. package/.output/server/node_modules/source-map-js/lib/base64-vlq.js +140 -0
  280. package/.output/server/node_modules/source-map-js/lib/base64.js +67 -0
  281. package/.output/server/node_modules/source-map-js/lib/binary-search.js +111 -0
  282. package/.output/server/node_modules/source-map-js/lib/mapping-list.js +79 -0
  283. package/.output/server/node_modules/source-map-js/lib/quick-sort.js +141 -0
  284. package/.output/server/node_modules/source-map-js/lib/source-map-consumer.js +1236 -0
  285. package/.output/server/node_modules/source-map-js/lib/source-map-generator.js +446 -0
  286. package/.output/server/node_modules/source-map-js/lib/source-node.js +420 -0
  287. package/.output/server/node_modules/source-map-js/lib/util.js +594 -0
  288. package/.output/server/node_modules/source-map-js/package.json +71 -0
  289. package/.output/server/node_modules/source-map-js/source-map.js +8 -0
  290. package/.output/server/node_modules/std-env/dist/index.mjs +1 -0
  291. package/.output/server/node_modules/std-env/package.json +43 -0
  292. package/.output/server/node_modules/tinyclip/dist/index.js +143 -0
  293. package/.output/server/node_modules/tinyclip/package.json +48 -0
  294. package/.output/server/node_modules/ufo/dist/index.mjs +645 -0
  295. package/.output/server/node_modules/ufo/package.json +48 -0
  296. package/.output/server/node_modules/uncrypto/dist/crypto.node.mjs +16 -0
  297. package/.output/server/node_modules/uncrypto/package.json +60 -0
  298. package/.output/server/node_modules/unhead/dist/client.mjs +22 -0
  299. package/.output/server/node_modules/unhead/dist/legacy.mjs +33 -0
  300. package/.output/server/node_modules/unhead/dist/minify.mjs +183 -0
  301. package/.output/server/node_modules/unhead/dist/parser.mjs +518 -0
  302. package/.output/server/node_modules/unhead/dist/plugins.mjs +782 -0
  303. package/.output/server/node_modules/unhead/dist/server.mjs +99 -0
  304. package/.output/server/node_modules/unhead/dist/shared/unhead.BEmVMkeA.mjs +673 -0
  305. package/.output/server/node_modules/unhead/dist/shared/unhead.Bf_fPVYA.mjs +6 -0
  306. package/.output/server/node_modules/unhead/dist/shared/unhead.Bm4Y6XQI.mjs +17 -0
  307. package/.output/server/node_modules/unhead/dist/shared/unhead.C5Bksi2B.mjs +49 -0
  308. package/.output/server/node_modules/unhead/dist/shared/unhead.CGPOfp5O.mjs +32 -0
  309. package/.output/server/node_modules/unhead/dist/shared/unhead.CHEy9ana.mjs +7 -0
  310. package/.output/server/node_modules/unhead/dist/shared/unhead.C_7zwq8E.mjs +11 -0
  311. package/.output/server/node_modules/unhead/dist/shared/unhead.CaeaMM5q.mjs +19 -0
  312. package/.output/server/node_modules/unhead/dist/shared/unhead.D7HkBzZn.mjs +59 -0
  313. package/.output/server/node_modules/unhead/dist/shared/unhead.D9VfQWNo.mjs +240 -0
  314. package/.output/server/node_modules/unhead/dist/shared/unhead.DD4N5B4k.mjs +224 -0
  315. package/.output/server/node_modules/unhead/dist/shared/unhead.DGl9jcjg.mjs +196 -0
  316. package/.output/server/node_modules/unhead/dist/shared/unhead.DJuZwX9c.mjs +400 -0
  317. package/.output/server/node_modules/unhead/dist/shared/unhead.DkxnqlHC.mjs +264 -0
  318. package/.output/server/node_modules/unhead/dist/shared/unhead.DspMpm6y.mjs +48 -0
  319. package/.output/server/node_modules/unhead/dist/shared/unhead.o8j9utSy.mjs +208 -0
  320. package/.output/server/node_modules/unhead/dist/stream/client.mjs +33 -0
  321. package/.output/server/node_modules/unhead/dist/stream/iife.mjs +2 -0
  322. package/.output/server/node_modules/unhead/dist/stream/server.mjs +446 -0
  323. package/.output/server/node_modules/unhead/dist/utils.mjs +7 -0
  324. package/.output/server/node_modules/unhead/package.json +179 -0
  325. package/.output/server/node_modules/untun/dist/_chunks/cloudflared.mjs +179 -0
  326. package/.output/server/node_modules/untun/dist/_chunks/log.mjs +27 -0
  327. package/.output/server/node_modules/untun/dist/index.mjs +47 -0
  328. package/.output/server/node_modules/untun/package.json +44 -0
  329. package/.output/server/node_modules/uqr/dist/index.mjs +739 -0
  330. package/.output/server/node_modules/uqr/package.json +69 -0
  331. package/.output/server/node_modules/vue/dist/vue.cjs.js +80 -0
  332. package/.output/server/node_modules/vue/dist/vue.cjs.prod.js +66 -0
  333. package/.output/server/node_modules/vue/index.js +7 -0
  334. package/.output/server/node_modules/vue/index.mjs +1 -0
  335. package/.output/server/node_modules/vue/package.json +112 -0
  336. package/.output/server/node_modules/vue/server-renderer/index.mjs +1 -0
  337. package/.output/server/node_modules/vue-bundle-renderer/dist/runtime.mjs +687 -0
  338. package/.output/server/node_modules/vue-bundle-renderer/package.json +66 -0
  339. package/.output/server/node_modules/zod/index.js +7 -0
  340. package/.output/server/node_modules/zod/package.json +147 -0
  341. package/.output/server/node_modules/zod/v3/ZodError.js +143 -0
  342. package/.output/server/node_modules/zod/v3/errors.js +9 -0
  343. package/.output/server/node_modules/zod/v3/external.js +6 -0
  344. package/.output/server/node_modules/zod/v3/helpers/errorUtil.js +6 -0
  345. package/.output/server/node_modules/zod/v3/helpers/parseUtil.js +109 -0
  346. package/.output/server/node_modules/zod/v3/helpers/typeAliases.js +1 -0
  347. package/.output/server/node_modules/zod/v3/helpers/util.js +133 -0
  348. package/.output/server/node_modules/zod/v3/index.js +4 -0
  349. package/.output/server/node_modules/zod/v3/locales/en.js +109 -0
  350. package/.output/server/node_modules/zod/v3/package.json +7 -0
  351. package/.output/server/node_modules/zod/v3/types.js +3697 -0
  352. package/.output/server/node_modules/zod/v4/classic/checks.js +1 -0
  353. package/.output/server/node_modules/zod/v4/classic/coerce.js +17 -0
  354. package/.output/server/node_modules/zod/v4/classic/compat.js +31 -0
  355. package/.output/server/node_modules/zod/v4/classic/deep-partial.js +13 -0
  356. package/.output/server/node_modules/zod/v4/classic/errors.js +57 -0
  357. package/.output/server/node_modules/zod/v4/classic/external.js +17 -0
  358. package/.output/server/node_modules/zod/v4/classic/from-json-schema.js +881 -0
  359. package/.output/server/node_modules/zod/v4/classic/in-out.js +36 -0
  360. package/.output/server/node_modules/zod/v4/classic/index.js +4 -0
  361. package/.output/server/node_modules/zod/v4/classic/iso.js +15 -0
  362. package/.output/server/node_modules/zod/v4/classic/package.json +7 -0
  363. package/.output/server/node_modules/zod/v4/classic/parse.js +16 -0
  364. package/.output/server/node_modules/zod/v4/classic/schemas.js +1535 -0
  365. package/.output/server/node_modules/zod/v4/core/api.js +1107 -0
  366. package/.output/server/node_modules/zod/v4/core/checks.js +516 -0
  367. package/.output/server/node_modules/zod/v4/core/compile.js +1866 -0
  368. package/.output/server/node_modules/zod/v4/core/core.js +141 -0
  369. package/.output/server/node_modules/zod/v4/core/doc.js +38 -0
  370. package/.output/server/node_modules/zod/v4/core/errors.js +267 -0
  371. package/.output/server/node_modules/zod/v4/core/index.js +19 -0
  372. package/.output/server/node_modules/zod/v4/core/json-schema-generator.js +99 -0
  373. package/.output/server/node_modules/zod/v4/core/json-schema-processors.js +843 -0
  374. package/.output/server/node_modules/zod/v4/core/json-schema.js +1 -0
  375. package/.output/server/node_modules/zod/v4/core/memoizer.js +311 -0
  376. package/.output/server/node_modules/zod/v4/core/package.json +7 -0
  377. package/.output/server/node_modules/zod/v4/core/parse.js +175 -0
  378. package/.output/server/node_modules/zod/v4/core/regexes.js +156 -0
  379. package/.output/server/node_modules/zod/v4/core/registries.js +51 -0
  380. package/.output/server/node_modules/zod/v4/core/schemas.js +2636 -0
  381. package/.output/server/node_modules/zod/v4/core/to-json-schema.js +651 -0
  382. package/.output/server/node_modules/zod/v4/core/util.js +873 -0
  383. package/.output/server/node_modules/zod/v4/core/versions.js +5 -0
  384. package/.output/server/node_modules/zod/v4/core/visit.js +169 -0
  385. package/.output/server/node_modules/zod/v4/index.js +4 -0
  386. package/.output/server/node_modules/zod/v4/locales/ar.js +111 -0
  387. package/.output/server/node_modules/zod/v4/locales/az.js +110 -0
  388. package/.output/server/node_modules/zod/v4/locales/be.js +168 -0
  389. package/.output/server/node_modules/zod/v4/locales/bg.js +125 -0
  390. package/.output/server/node_modules/zod/v4/locales/bn.js +113 -0
  391. package/.output/server/node_modules/zod/v4/locales/ca.js +112 -0
  392. package/.output/server/node_modules/zod/v4/locales/ckb.js +133 -0
  393. package/.output/server/node_modules/zod/v4/locales/cs.js +116 -0
  394. package/.output/server/node_modules/zod/v4/locales/da.js +120 -0
  395. package/.output/server/node_modules/zod/v4/locales/de.js +113 -0
  396. package/.output/server/node_modules/zod/v4/locales/el.js +112 -0
  397. package/.output/server/node_modules/zod/v4/locales/en.js +125 -0
  398. package/.output/server/node_modules/zod/v4/locales/eo.js +114 -0
  399. package/.output/server/node_modules/zod/v4/locales/es.js +136 -0
  400. package/.output/server/node_modules/zod/v4/locales/fa.js +119 -0
  401. package/.output/server/node_modules/zod/v4/locales/fi.js +117 -0
  402. package/.output/server/node_modules/zod/v4/locales/fr-CA.js +112 -0
  403. package/.output/server/node_modules/zod/v4/locales/fr.js +129 -0
  404. package/.output/server/node_modules/zod/v4/locales/gu.js +113 -0
  405. package/.output/server/node_modules/zod/v4/locales/he.js +221 -0
  406. package/.output/server/node_modules/zod/v4/locales/hi.js +111 -0
  407. package/.output/server/node_modules/zod/v4/locales/hr.js +126 -0
  408. package/.output/server/node_modules/zod/v4/locales/hu.js +113 -0
  409. package/.output/server/node_modules/zod/v4/locales/hy.js +158 -0
  410. package/.output/server/node_modules/zod/v4/locales/id.js +111 -0
  411. package/.output/server/node_modules/zod/v4/locales/index.js +63 -0
  412. package/.output/server/node_modules/zod/v4/locales/is.js +114 -0
  413. package/.output/server/node_modules/zod/v4/locales/it.js +113 -0
  414. package/.output/server/node_modules/zod/v4/locales/ja.js +112 -0
  415. package/.output/server/node_modules/zod/v4/locales/ka.js +117 -0
  416. package/.output/server/node_modules/zod/v4/locales/kh.js +5 -0
  417. package/.output/server/node_modules/zod/v4/locales/km.js +115 -0
  418. package/.output/server/node_modules/zod/v4/locales/kn.js +116 -0
  419. package/.output/server/node_modules/zod/v4/locales/ko.js +116 -0
  420. package/.output/server/node_modules/zod/v4/locales/lt.js +207 -0
  421. package/.output/server/node_modules/zod/v4/locales/mk.js +114 -0
  422. package/.output/server/node_modules/zod/v4/locales/ms.js +112 -0
  423. package/.output/server/node_modules/zod/v4/locales/ne.js +111 -0
  424. package/.output/server/node_modules/zod/v4/locales/nl.js +115 -0
  425. package/.output/server/node_modules/zod/v4/locales/nn.js +113 -0
  426. package/.output/server/node_modules/zod/v4/locales/no.js +113 -0
  427. package/.output/server/node_modules/zod/v4/locales/ota.js +114 -0
  428. package/.output/server/node_modules/zod/v4/locales/package.json +7 -0
  429. package/.output/server/node_modules/zod/v4/locales/pl.js +114 -0
  430. package/.output/server/node_modules/zod/v4/locales/ps.js +119 -0
  431. package/.output/server/node_modules/zod/v4/locales/pt-BR.js +143 -0
  432. package/.output/server/node_modules/zod/v4/locales/pt.js +142 -0
  433. package/.output/server/node_modules/zod/v4/locales/ro.js +122 -0
  434. package/.output/server/node_modules/zod/v4/locales/ru.js +168 -0
  435. package/.output/server/node_modules/zod/v4/locales/sk.js +116 -0
  436. package/.output/server/node_modules/zod/v4/locales/sl.js +114 -0
  437. package/.output/server/node_modules/zod/v4/locales/sv.js +115 -0
  438. package/.output/server/node_modules/zod/v4/locales/ta.js +115 -0
  439. package/.output/server/node_modules/zod/v4/locales/tg.js +117 -0
  440. package/.output/server/node_modules/zod/v4/locales/th.js +115 -0
  441. package/.output/server/node_modules/zod/v4/locales/tk.js +107 -0
  442. package/.output/server/node_modules/zod/v4/locales/tr.js +110 -0
  443. package/.output/server/node_modules/zod/v4/locales/ua.js +5 -0
  444. package/.output/server/node_modules/zod/v4/locales/uk.js +113 -0
  445. package/.output/server/node_modules/zod/v4/locales/ur.js +115 -0
  446. package/.output/server/node_modules/zod/v4/locales/uz.js +113 -0
  447. package/.output/server/node_modules/zod/v4/locales/vi.js +113 -0
  448. package/.output/server/node_modules/zod/v4/locales/yo.js +112 -0
  449. package/.output/server/node_modules/zod/v4/locales/zh-CN.js +114 -0
  450. package/.output/server/node_modules/zod/v4/locales/zh-TW.js +112 -0
  451. package/.output/server/node_modules/zod/v4/mini/checks.js +1 -0
  452. package/.output/server/node_modules/zod/v4/mini/coerce.js +22 -0
  453. package/.output/server/node_modules/zod/v4/mini/deep-partial.js +13 -0
  454. package/.output/server/node_modules/zod/v4/mini/external.js +16 -0
  455. package/.output/server/node_modules/zod/v4/mini/in-out.js +36 -0
  456. package/.output/server/node_modules/zod/v4/mini/iso.js +34 -0
  457. package/.output/server/node_modules/zod/v4/mini/package.json +7 -0
  458. package/.output/server/node_modules/zod/v4/mini/parse.js +1 -0
  459. package/.output/server/node_modules/zod/v4/mini/schemas.js +1002 -0
  460. package/.output/server/node_modules/zod/v4/package.json +7 -0
  461. package/.output/server/node_modules/zod/v4-mini/index.js +3 -0
  462. package/.output/server/node_modules/zod/v4-mini/package.json +7 -0
  463. package/.output/server/node_modules/zod-to-json-schema/dist/esm/Options.js +46 -0
  464. package/.output/server/node_modules/zod-to-json-schema/dist/esm/Refs.js +22 -0
  465. package/.output/server/node_modules/zod-to-json-schema/dist/esm/errorMessages.js +14 -0
  466. package/.output/server/node_modules/zod-to-json-schema/dist/esm/getRelativePath.js +8 -0
  467. package/.output/server/node_modules/zod-to-json-schema/dist/esm/index.js +40 -0
  468. package/.output/server/node_modules/zod-to-json-schema/dist/esm/package.json +1 -0
  469. package/.output/server/node_modules/zod-to-json-schema/dist/esm/parseDef.js +62 -0
  470. package/.output/server/node_modules/zod-to-json-schema/dist/esm/parseTypes.js +1 -0
  471. package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/any.js +17 -0
  472. package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/array.js +26 -0
  473. package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js +49 -0
  474. package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js +5 -0
  475. package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/branded.js +4 -0
  476. package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/catch.js +4 -0
  477. package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/date.js +46 -0
  478. package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/default.js +7 -0
  479. package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/effects.js +7 -0
  480. package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/enum.js +6 -0
  481. package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js +52 -0
  482. package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/literal.js +21 -0
  483. package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/map.js +26 -0
  484. package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js +16 -0
  485. package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/never.js +11 -0
  486. package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/null.js +10 -0
  487. package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js +33 -0
  488. package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/number.js +52 -0
  489. package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/object.js +72 -0
  490. package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/optional.js +21 -0
  491. package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js +20 -0
  492. package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/promise.js +4 -0
  493. package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js +4 -0
  494. package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/record.js +61 -0
  495. package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/set.js +20 -0
  496. package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/string.js +352 -0
  497. package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js +32 -0
  498. package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js +6 -0
  499. package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/union.js +80 -0
  500. package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js +4 -0
  501. package/.output/server/node_modules/zod-to-json-schema/dist/esm/selectParser.js +105 -0
  502. package/.output/server/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js +87 -0
  503. package/.output/server/node_modules/zod-to-json-schema/package.json +85 -0
  504. package/.output/server/package.json +64 -0
  505. package/README.md +227 -24
  506. package/bin/bantou.mjs +33 -0
  507. package/package.json +18 -8
  508. package/protocol/PROTOCOL.md +26 -0
  509. package/protocol/protocol.json +92 -0
  510. package/dist/cap.js +0 -7
  511. package/dist/cli.js +0 -27
  512. package/dist/config.js +0 -23
  513. package/dist/daemon.js +0 -23
  514. package/dist/session.js +0 -7
  515. package/dist/workspace.js +0 -8
@@ -0,0 +1,1294 @@
1
+ // Copyright (c) 2005 Tom Wu
2
+ // All Rights Reserved.
3
+ // See "LICENSE" for details.
4
+
5
+ // Basic JavaScript BN library - subset useful for RSA encryption.
6
+
7
+ /*
8
+ Licensing (LICENSE)
9
+ -------------------
10
+
11
+ This software is covered under the following copyright:
12
+ */
13
+ /*
14
+ * Copyright (c) 2003-2005 Tom Wu
15
+ * All Rights Reserved.
16
+ *
17
+ * Permission is hereby granted, free of charge, to any person obtaining
18
+ * a copy of this software and associated documentation files (the
19
+ * "Software"), to deal in the Software without restriction, including
20
+ * without limitation the rights to use, copy, modify, merge, publish,
21
+ * distribute, sublicense, and/or sell copies of the Software, and to
22
+ * permit persons to whom the Software is furnished to do so, subject to
23
+ * the following conditions:
24
+ *
25
+ * The above copyright notice and this permission notice shall be
26
+ * included in all copies or substantial portions of the Software.
27
+ *
28
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
29
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
30
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
31
+ *
32
+ * IN NO EVENT SHALL TOM WU BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
33
+ * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER
34
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF
35
+ * THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT
36
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
37
+ *
38
+ * In addition, the following condition applies:
39
+ *
40
+ * All redistributions must retain an intact copy of this copyright notice
41
+ * and disclaimer.
42
+ */
43
+ /*
44
+ Address all questions regarding this license to:
45
+
46
+ Tom Wu
47
+ tjw@cs.Stanford.EDU
48
+ */
49
+ var forge = require('./forge');
50
+
51
+ module.exports = forge.jsbn = forge.jsbn || {};
52
+
53
+ // Bits per digit
54
+ var dbits;
55
+
56
+ // JavaScript engine analysis
57
+ var canary = 0xdeadbeefcafe;
58
+ var j_lm = ((canary&0xffffff)==0xefcafe);
59
+
60
+ // (public) Constructor
61
+ function BigInteger(a,b,c) {
62
+ this.data = [];
63
+ if(a != null)
64
+ if("number" == typeof a) this.fromNumber(a,b,c);
65
+ else if(b == null && "string" != typeof a) this.fromString(a,256);
66
+ else this.fromString(a,b);
67
+ }
68
+ forge.jsbn.BigInteger = BigInteger;
69
+
70
+ // return new, unset BigInteger
71
+ function nbi() { return new BigInteger(null); }
72
+
73
+ // am: Compute w_j += (x*this_i), propagate carries,
74
+ // c is initial carry, returns final carry.
75
+ // c < 3*dvalue, x < 2*dvalue, this_i < dvalue
76
+ // We need to select the fastest one that works in this environment.
77
+
78
+ // am1: use a single mult and divide to get the high bits,
79
+ // max digit bits should be 26 because
80
+ // max internal value = 2*dvalue^2-2*dvalue (< 2^53)
81
+ function am1(i,x,w,j,c,n) {
82
+ while(--n >= 0) {
83
+ var v = x*this.data[i++]+w.data[j]+c;
84
+ c = Math.floor(v/0x4000000);
85
+ w.data[j++] = v&0x3ffffff;
86
+ }
87
+ return c;
88
+ }
89
+ // am2 avoids a big mult-and-extract completely.
90
+ // Max digit bits should be <= 30 because we do bitwise ops
91
+ // on values up to 2*hdvalue^2-hdvalue-1 (< 2^31)
92
+ function am2(i,x,w,j,c,n) {
93
+ var xl = x&0x7fff, xh = x>>15;
94
+ while(--n >= 0) {
95
+ var l = this.data[i]&0x7fff;
96
+ var h = this.data[i++]>>15;
97
+ var m = xh*l+h*xl;
98
+ l = xl*l+((m&0x7fff)<<15)+w.data[j]+(c&0x3fffffff);
99
+ c = (l>>>30)+(m>>>15)+xh*h+(c>>>30);
100
+ w.data[j++] = l&0x3fffffff;
101
+ }
102
+ return c;
103
+ }
104
+ // Alternately, set max digit bits to 28 since some
105
+ // browsers slow down when dealing with 32-bit numbers.
106
+ function am3(i,x,w,j,c,n) {
107
+ var xl = x&0x3fff, xh = x>>14;
108
+ while(--n >= 0) {
109
+ var l = this.data[i]&0x3fff;
110
+ var h = this.data[i++]>>14;
111
+ var m = xh*l+h*xl;
112
+ l = xl*l+((m&0x3fff)<<14)+w.data[j]+c;
113
+ c = (l>>28)+(m>>14)+xh*h;
114
+ w.data[j++] = l&0xfffffff;
115
+ }
116
+ return c;
117
+ }
118
+
119
+ // node.js (no browser)
120
+ if(typeof(navigator) === 'undefined')
121
+ {
122
+ BigInteger.prototype.am = am3;
123
+ dbits = 28;
124
+ } else if(j_lm && (navigator.appName == "Microsoft Internet Explorer")) {
125
+ BigInteger.prototype.am = am2;
126
+ dbits = 30;
127
+ }
128
+ else if(j_lm && (navigator.appName != "Netscape")) {
129
+ BigInteger.prototype.am = am1;
130
+ dbits = 26;
131
+ }
132
+ else { // Mozilla/Netscape seems to prefer am3
133
+ BigInteger.prototype.am = am3;
134
+ dbits = 28;
135
+ }
136
+
137
+ BigInteger.prototype.DB = dbits;
138
+ BigInteger.prototype.DM = ((1<<dbits)-1);
139
+ BigInteger.prototype.DV = (1<<dbits);
140
+
141
+ var BI_FP = 52;
142
+ BigInteger.prototype.FV = Math.pow(2,BI_FP);
143
+ BigInteger.prototype.F1 = BI_FP-dbits;
144
+ BigInteger.prototype.F2 = 2*dbits-BI_FP;
145
+
146
+ // Digit conversions
147
+ var BI_RM = "0123456789abcdefghijklmnopqrstuvwxyz";
148
+ var BI_RC = new Array();
149
+ var rr,vv;
150
+ rr = "0".charCodeAt(0);
151
+ for(vv = 0; vv <= 9; ++vv) BI_RC[rr++] = vv;
152
+ rr = "a".charCodeAt(0);
153
+ for(vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv;
154
+ rr = "A".charCodeAt(0);
155
+ for(vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv;
156
+
157
+ function int2char(n) { return BI_RM.charAt(n); }
158
+ function intAt(s,i) {
159
+ var c = BI_RC[s.charCodeAt(i)];
160
+ return (c==null)?-1:c;
161
+ }
162
+
163
+ // (protected) copy this to r
164
+ function bnpCopyTo(r) {
165
+ for(var i = this.t-1; i >= 0; --i) r.data[i] = this.data[i];
166
+ r.t = this.t;
167
+ r.s = this.s;
168
+ }
169
+
170
+ // (protected) set from integer value x, -DV <= x < DV
171
+ function bnpFromInt(x) {
172
+ this.t = 1;
173
+ this.s = (x<0)?-1:0;
174
+ if(x > 0) this.data[0] = x;
175
+ else if(x < -1) this.data[0] = x+this.DV;
176
+ else this.t = 0;
177
+ }
178
+
179
+ // return bigint initialized to value
180
+ function nbv(i) { var r = nbi(); r.fromInt(i); return r; }
181
+
182
+ // (protected) set from string and radix
183
+ function bnpFromString(s,b) {
184
+ var k;
185
+ if(b == 16) k = 4;
186
+ else if(b == 8) k = 3;
187
+ else if(b == 256) k = 8; // byte array
188
+ else if(b == 2) k = 1;
189
+ else if(b == 32) k = 5;
190
+ else if(b == 4) k = 2;
191
+ else { this.fromRadix(s,b); return; }
192
+ this.t = 0;
193
+ this.s = 0;
194
+ var i = s.length, mi = false, sh = 0;
195
+ while(--i >= 0) {
196
+ var x = (k==8)?s[i]&0xff:intAt(s,i);
197
+ if(x < 0) {
198
+ if(s.charAt(i) == "-") mi = true;
199
+ continue;
200
+ }
201
+ mi = false;
202
+ if(sh == 0)
203
+ this.data[this.t++] = x;
204
+ else if(sh+k > this.DB) {
205
+ this.data[this.t-1] |= (x&((1<<(this.DB-sh))-1))<<sh;
206
+ this.data[this.t++] = (x>>(this.DB-sh));
207
+ }
208
+ else
209
+ this.data[this.t-1] |= x<<sh;
210
+ sh += k;
211
+ if(sh >= this.DB) sh -= this.DB;
212
+ }
213
+ if(k == 8 && (s[0]&0x80) != 0) {
214
+ this.s = -1;
215
+ if(sh > 0) this.data[this.t-1] |= ((1<<(this.DB-sh))-1)<<sh;
216
+ }
217
+ this.clamp();
218
+ if(mi) BigInteger.ZERO.subTo(this,this);
219
+ }
220
+
221
+ // (protected) clamp off excess high words
222
+ function bnpClamp() {
223
+ var c = this.s&this.DM;
224
+ while(this.t > 0 && this.data[this.t-1] == c) --this.t;
225
+ }
226
+
227
+ // (public) return string representation in given radix
228
+ function bnToString(b) {
229
+ if(this.s < 0) return "-"+this.negate().toString(b);
230
+ var k;
231
+ if(b == 16) k = 4;
232
+ else if(b == 8) k = 3;
233
+ else if(b == 2) k = 1;
234
+ else if(b == 32) k = 5;
235
+ else if(b == 4) k = 2;
236
+ else return this.toRadix(b);
237
+ var km = (1<<k)-1, d, m = false, r = "", i = this.t;
238
+ var p = this.DB-(i*this.DB)%k;
239
+ if(i-- > 0) {
240
+ if(p < this.DB && (d = this.data[i]>>p) > 0) { m = true; r = int2char(d); }
241
+ while(i >= 0) {
242
+ if(p < k) {
243
+ d = (this.data[i]&((1<<p)-1))<<(k-p);
244
+ d |= this.data[--i]>>(p+=this.DB-k);
245
+ }
246
+ else {
247
+ d = (this.data[i]>>(p-=k))&km;
248
+ if(p <= 0) { p += this.DB; --i; }
249
+ }
250
+ if(d > 0) m = true;
251
+ if(m) r += int2char(d);
252
+ }
253
+ }
254
+ return m?r:"0";
255
+ }
256
+
257
+ // (public) -this
258
+ function bnNegate() { var r = nbi(); BigInteger.ZERO.subTo(this,r); return r; }
259
+
260
+ // (public) |this|
261
+ function bnAbs() { return (this.s<0)?this.negate():this; }
262
+
263
+ // (public) return + if this > a, - if this < a, 0 if equal
264
+ function bnCompareTo(a) {
265
+ var r = this.s-a.s;
266
+ if(r != 0) return r;
267
+ var i = this.t;
268
+ r = i-a.t;
269
+ if(r != 0) return (this.s<0)?-r:r;
270
+ while(--i >= 0) if((r=this.data[i]-a.data[i]) != 0) return r;
271
+ return 0;
272
+ }
273
+
274
+ // returns bit length of the integer x
275
+ function nbits(x) {
276
+ var r = 1, t;
277
+ if((t=x>>>16) != 0) { x = t; r += 16; }
278
+ if((t=x>>8) != 0) { x = t; r += 8; }
279
+ if((t=x>>4) != 0) { x = t; r += 4; }
280
+ if((t=x>>2) != 0) { x = t; r += 2; }
281
+ if((t=x>>1) != 0) { x = t; r += 1; }
282
+ return r;
283
+ }
284
+
285
+ // (public) return the number of bits in "this"
286
+ function bnBitLength() {
287
+ if(this.t <= 0) return 0;
288
+ return this.DB*(this.t-1)+nbits(this.data[this.t-1]^(this.s&this.DM));
289
+ }
290
+
291
+ // (protected) r = this << n*DB
292
+ function bnpDLShiftTo(n,r) {
293
+ var i;
294
+ for(i = this.t-1; i >= 0; --i) r.data[i+n] = this.data[i];
295
+ for(i = n-1; i >= 0; --i) r.data[i] = 0;
296
+ r.t = this.t+n;
297
+ r.s = this.s;
298
+ }
299
+
300
+ // (protected) r = this >> n*DB
301
+ function bnpDRShiftTo(n,r) {
302
+ for(var i = n; i < this.t; ++i) r.data[i-n] = this.data[i];
303
+ r.t = Math.max(this.t-n,0);
304
+ r.s = this.s;
305
+ }
306
+
307
+ // (protected) r = this << n
308
+ function bnpLShiftTo(n,r) {
309
+ var bs = n%this.DB;
310
+ var cbs = this.DB-bs;
311
+ var bm = (1<<cbs)-1;
312
+ var ds = Math.floor(n/this.DB), c = (this.s<<bs)&this.DM, i;
313
+ for(i = this.t-1; i >= 0; --i) {
314
+ r.data[i+ds+1] = (this.data[i]>>cbs)|c;
315
+ c = (this.data[i]&bm)<<bs;
316
+ }
317
+ for(i = ds-1; i >= 0; --i) r.data[i] = 0;
318
+ r.data[ds] = c;
319
+ r.t = this.t+ds+1;
320
+ r.s = this.s;
321
+ r.clamp();
322
+ }
323
+
324
+ // (protected) r = this >> n
325
+ function bnpRShiftTo(n,r) {
326
+ r.s = this.s;
327
+ var ds = Math.floor(n/this.DB);
328
+ if(ds >= this.t) { r.t = 0; return; }
329
+ var bs = n%this.DB;
330
+ var cbs = this.DB-bs;
331
+ var bm = (1<<bs)-1;
332
+ r.data[0] = this.data[ds]>>bs;
333
+ for(var i = ds+1; i < this.t; ++i) {
334
+ r.data[i-ds-1] |= (this.data[i]&bm)<<cbs;
335
+ r.data[i-ds] = this.data[i]>>bs;
336
+ }
337
+ if(bs > 0) r.data[this.t-ds-1] |= (this.s&bm)<<cbs;
338
+ r.t = this.t-ds;
339
+ r.clamp();
340
+ }
341
+
342
+ // (protected) r = this - a
343
+ function bnpSubTo(a,r) {
344
+ var i = 0, c = 0, m = Math.min(a.t,this.t);
345
+ while(i < m) {
346
+ c += this.data[i]-a.data[i];
347
+ r.data[i++] = c&this.DM;
348
+ c >>= this.DB;
349
+ }
350
+ if(a.t < this.t) {
351
+ c -= a.s;
352
+ while(i < this.t) {
353
+ c += this.data[i];
354
+ r.data[i++] = c&this.DM;
355
+ c >>= this.DB;
356
+ }
357
+ c += this.s;
358
+ }
359
+ else {
360
+ c += this.s;
361
+ while(i < a.t) {
362
+ c -= a.data[i];
363
+ r.data[i++] = c&this.DM;
364
+ c >>= this.DB;
365
+ }
366
+ c -= a.s;
367
+ }
368
+ r.s = (c<0)?-1:0;
369
+ if(c < -1) r.data[i++] = this.DV+c;
370
+ else if(c > 0) r.data[i++] = c;
371
+ r.t = i;
372
+ r.clamp();
373
+ }
374
+
375
+ // (protected) r = this * a, r != this,a (HAC 14.12)
376
+ // "this" should be the larger one if appropriate.
377
+ function bnpMultiplyTo(a,r) {
378
+ var x = this.abs(), y = a.abs();
379
+ var i = x.t;
380
+ r.t = i+y.t;
381
+ while(--i >= 0) r.data[i] = 0;
382
+ for(i = 0; i < y.t; ++i) r.data[i+x.t] = x.am(0,y.data[i],r,i,0,x.t);
383
+ r.s = 0;
384
+ r.clamp();
385
+ if(this.s != a.s) BigInteger.ZERO.subTo(r,r);
386
+ }
387
+
388
+ // (protected) r = this^2, r != this (HAC 14.16)
389
+ function bnpSquareTo(r) {
390
+ var x = this.abs();
391
+ var i = r.t = 2*x.t;
392
+ while(--i >= 0) r.data[i] = 0;
393
+ for(i = 0; i < x.t-1; ++i) {
394
+ var c = x.am(i,x.data[i],r,2*i,0,1);
395
+ if((r.data[i+x.t]+=x.am(i+1,2*x.data[i],r,2*i+1,c,x.t-i-1)) >= x.DV) {
396
+ r.data[i+x.t] -= x.DV;
397
+ r.data[i+x.t+1] = 1;
398
+ }
399
+ }
400
+ if(r.t > 0) r.data[r.t-1] += x.am(i,x.data[i],r,2*i,0,1);
401
+ r.s = 0;
402
+ r.clamp();
403
+ }
404
+
405
+ // (protected) divide this by m, quotient and remainder to q, r (HAC 14.20)
406
+ // r != q, this != m. q or r may be null.
407
+ function bnpDivRemTo(m,q,r) {
408
+ var pm = m.abs();
409
+ if(pm.t <= 0) return;
410
+ var pt = this.abs();
411
+ if(pt.t < pm.t) {
412
+ if(q != null) q.fromInt(0);
413
+ if(r != null) this.copyTo(r);
414
+ return;
415
+ }
416
+ if(r == null) r = nbi();
417
+ var y = nbi(), ts = this.s, ms = m.s;
418
+ var nsh = this.DB-nbits(pm.data[pm.t-1]); // normalize modulus
419
+ if(nsh > 0) { pm.lShiftTo(nsh,y); pt.lShiftTo(nsh,r); }
420
+ else { pm.copyTo(y); pt.copyTo(r); }
421
+ var ys = y.t;
422
+ var y0 = y.data[ys-1];
423
+ if(y0 == 0) return;
424
+ var yt = y0*(1<<this.F1)+((ys>1)?y.data[ys-2]>>this.F2:0);
425
+ var d1 = this.FV/yt, d2 = (1<<this.F1)/yt, e = 1<<this.F2;
426
+ var i = r.t, j = i-ys, t = (q==null)?nbi():q;
427
+ y.dlShiftTo(j,t);
428
+ if(r.compareTo(t) >= 0) {
429
+ r.data[r.t++] = 1;
430
+ r.subTo(t,r);
431
+ }
432
+ BigInteger.ONE.dlShiftTo(ys,t);
433
+ t.subTo(y,y); // "negative" y so we can replace sub with am later
434
+ while(y.t < ys) y.data[y.t++] = 0;
435
+ while(--j >= 0) {
436
+ // Estimate quotient digit
437
+ var qd = (r.data[--i]==y0)?this.DM:Math.floor(r.data[i]*d1+(r.data[i-1]+e)*d2);
438
+ if((r.data[i]+=y.am(0,qd,r,j,0,ys)) < qd) { // Try it out
439
+ y.dlShiftTo(j,t);
440
+ r.subTo(t,r);
441
+ while(r.data[i] < --qd) r.subTo(t,r);
442
+ }
443
+ }
444
+ if(q != null) {
445
+ r.drShiftTo(ys,q);
446
+ if(ts != ms) BigInteger.ZERO.subTo(q,q);
447
+ }
448
+ r.t = ys;
449
+ r.clamp();
450
+ if(nsh > 0) r.rShiftTo(nsh,r); // Denormalize remainder
451
+ if(ts < 0) BigInteger.ZERO.subTo(r,r);
452
+ }
453
+
454
+ // (public) this mod a
455
+ function bnMod(a) {
456
+ var r = nbi();
457
+ this.abs().divRemTo(a,null,r);
458
+ if(this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) a.subTo(r,r);
459
+ return r;
460
+ }
461
+
462
+ // Modular reduction using "classic" algorithm
463
+ function Classic(m) { this.m = m; }
464
+ function cConvert(x) {
465
+ if(x.s < 0 || x.compareTo(this.m) >= 0) return x.mod(this.m);
466
+ else return x;
467
+ }
468
+ function cRevert(x) { return x; }
469
+ function cReduce(x) { x.divRemTo(this.m,null,x); }
470
+ function cMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); }
471
+ function cSqrTo(x,r) { x.squareTo(r); this.reduce(r); }
472
+
473
+ Classic.prototype.convert = cConvert;
474
+ Classic.prototype.revert = cRevert;
475
+ Classic.prototype.reduce = cReduce;
476
+ Classic.prototype.mulTo = cMulTo;
477
+ Classic.prototype.sqrTo = cSqrTo;
478
+
479
+ // (protected) return "-1/this % 2^DB"; useful for Mont. reduction
480
+ // justification:
481
+ // xy == 1 (mod m)
482
+ // xy = 1+km
483
+ // xy(2-xy) = (1+km)(1-km)
484
+ // x[y(2-xy)] = 1-k^2m^2
485
+ // x[y(2-xy)] == 1 (mod m^2)
486
+ // if y is 1/x mod m, then y(2-xy) is 1/x mod m^2
487
+ // should reduce x and y(2-xy) by m^2 at each step to keep size bounded.
488
+ // JS multiply "overflows" differently from C/C++, so care is needed here.
489
+ function bnpInvDigit() {
490
+ if(this.t < 1) return 0;
491
+ var x = this.data[0];
492
+ if((x&1) == 0) return 0;
493
+ var y = x&3; // y == 1/x mod 2^2
494
+ y = (y*(2-(x&0xf)*y))&0xf; // y == 1/x mod 2^4
495
+ y = (y*(2-(x&0xff)*y))&0xff; // y == 1/x mod 2^8
496
+ y = (y*(2-(((x&0xffff)*y)&0xffff)))&0xffff; // y == 1/x mod 2^16
497
+ // last step - calculate inverse mod DV directly;
498
+ // assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints
499
+ y = (y*(2-x*y%this.DV))%this.DV; // y == 1/x mod 2^dbits
500
+ // we really want the negative inverse, and -DV < y < DV
501
+ return (y>0)?this.DV-y:-y;
502
+ }
503
+
504
+ // Montgomery reduction
505
+ function Montgomery(m) {
506
+ this.m = m;
507
+ this.mp = m.invDigit();
508
+ this.mpl = this.mp&0x7fff;
509
+ this.mph = this.mp>>15;
510
+ this.um = (1<<(m.DB-15))-1;
511
+ this.mt2 = 2*m.t;
512
+ }
513
+
514
+ // xR mod m
515
+ function montConvert(x) {
516
+ var r = nbi();
517
+ x.abs().dlShiftTo(this.m.t,r);
518
+ r.divRemTo(this.m,null,r);
519
+ if(x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) this.m.subTo(r,r);
520
+ return r;
521
+ }
522
+
523
+ // x/R mod m
524
+ function montRevert(x) {
525
+ var r = nbi();
526
+ x.copyTo(r);
527
+ this.reduce(r);
528
+ return r;
529
+ }
530
+
531
+ // x = x/R mod m (HAC 14.32)
532
+ function montReduce(x) {
533
+ while(x.t <= this.mt2) // pad x so am has enough room later
534
+ x.data[x.t++] = 0;
535
+ for(var i = 0; i < this.m.t; ++i) {
536
+ // faster way of calculating u0 = x.data[i]*mp mod DV
537
+ var j = x.data[i]&0x7fff;
538
+ var u0 = (j*this.mpl+(((j*this.mph+(x.data[i]>>15)*this.mpl)&this.um)<<15))&x.DM;
539
+ // use am to combine the multiply-shift-add into one call
540
+ j = i+this.m.t;
541
+ x.data[j] += this.m.am(0,u0,x,i,0,this.m.t);
542
+ // propagate carry
543
+ while(x.data[j] >= x.DV) { x.data[j] -= x.DV; x.data[++j]++; }
544
+ }
545
+ x.clamp();
546
+ x.drShiftTo(this.m.t,x);
547
+ if(x.compareTo(this.m) >= 0) x.subTo(this.m,x);
548
+ }
549
+
550
+ // r = "x^2/R mod m"; x != r
551
+ function montSqrTo(x,r) { x.squareTo(r); this.reduce(r); }
552
+
553
+ // r = "xy/R mod m"; x,y != r
554
+ function montMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); }
555
+
556
+ Montgomery.prototype.convert = montConvert;
557
+ Montgomery.prototype.revert = montRevert;
558
+ Montgomery.prototype.reduce = montReduce;
559
+ Montgomery.prototype.mulTo = montMulTo;
560
+ Montgomery.prototype.sqrTo = montSqrTo;
561
+
562
+ // (protected) true iff this is even
563
+ function bnpIsEven() { return ((this.t>0)?(this.data[0]&1):this.s) == 0; }
564
+
565
+ // (protected) this^e, e < 2^32, doing sqr and mul with "r" (HAC 14.79)
566
+ function bnpExp(e,z) {
567
+ if(e > 0xffffffff || e < 1) return BigInteger.ONE;
568
+ var r = nbi(), r2 = nbi(), g = z.convert(this), i = nbits(e)-1;
569
+ g.copyTo(r);
570
+ while(--i >= 0) {
571
+ z.sqrTo(r,r2);
572
+ if((e&(1<<i)) > 0) z.mulTo(r2,g,r);
573
+ else { var t = r; r = r2; r2 = t; }
574
+ }
575
+ return z.revert(r);
576
+ }
577
+
578
+ // (public) this^e % m, 0 <= e < 2^32
579
+ function bnModPowInt(e,m) {
580
+ var z;
581
+ if(e < 256 || m.isEven()) z = new Classic(m); else z = new Montgomery(m);
582
+ return this.exp(e,z);
583
+ }
584
+
585
+ // protected
586
+ BigInteger.prototype.copyTo = bnpCopyTo;
587
+ BigInteger.prototype.fromInt = bnpFromInt;
588
+ BigInteger.prototype.fromString = bnpFromString;
589
+ BigInteger.prototype.clamp = bnpClamp;
590
+ BigInteger.prototype.dlShiftTo = bnpDLShiftTo;
591
+ BigInteger.prototype.drShiftTo = bnpDRShiftTo;
592
+ BigInteger.prototype.lShiftTo = bnpLShiftTo;
593
+ BigInteger.prototype.rShiftTo = bnpRShiftTo;
594
+ BigInteger.prototype.subTo = bnpSubTo;
595
+ BigInteger.prototype.multiplyTo = bnpMultiplyTo;
596
+ BigInteger.prototype.squareTo = bnpSquareTo;
597
+ BigInteger.prototype.divRemTo = bnpDivRemTo;
598
+ BigInteger.prototype.invDigit = bnpInvDigit;
599
+ BigInteger.prototype.isEven = bnpIsEven;
600
+ BigInteger.prototype.exp = bnpExp;
601
+
602
+ // public
603
+ BigInteger.prototype.toString = bnToString;
604
+ BigInteger.prototype.negate = bnNegate;
605
+ BigInteger.prototype.abs = bnAbs;
606
+ BigInteger.prototype.compareTo = bnCompareTo;
607
+ BigInteger.prototype.bitLength = bnBitLength;
608
+ BigInteger.prototype.mod = bnMod;
609
+ BigInteger.prototype.modPowInt = bnModPowInt;
610
+
611
+ // "constants"
612
+ BigInteger.ZERO = nbv(0);
613
+ BigInteger.ONE = nbv(1);
614
+
615
+ // jsbn2 lib
616
+
617
+ // Copyright (c) 2005-2009 Tom Wu
618
+ // All Rights Reserved.
619
+ // See "LICENSE" for details (See jsbn.js for LICENSE).
620
+
621
+ // Extended JavaScript BN functions, required for RSA private ops.
622
+
623
+ // Version 1.1: new BigInteger("0", 10) returns "proper" zero
624
+ // Version 1.2: square() API, isProbablePrime fix
625
+
626
+ // (public)
627
+ function bnClone() { var r = nbi(); this.copyTo(r); return r; }
628
+
629
+ // (public) return value as integer
630
+ function bnIntValue() {
631
+ if(this.s < 0) {
632
+ if(this.t == 1) return this.data[0]-this.DV;
633
+ else if(this.t == 0) return -1;
634
+ }
635
+ else if(this.t == 1) return this.data[0];
636
+ else if(this.t == 0) return 0;
637
+ // assumes 16 < DB < 32
638
+ return ((this.data[1]&((1<<(32-this.DB))-1))<<this.DB)|this.data[0];
639
+ }
640
+
641
+ // (public) return value as byte
642
+ function bnByteValue() { return (this.t==0)?this.s:(this.data[0]<<24)>>24; }
643
+
644
+ // (public) return value as short (assumes DB>=16)
645
+ function bnShortValue() { return (this.t==0)?this.s:(this.data[0]<<16)>>16; }
646
+
647
+ // (protected) return x s.t. r^x < DV
648
+ function bnpChunkSize(r) { return Math.floor(Math.LN2*this.DB/Math.log(r)); }
649
+
650
+ // (public) 0 if this == 0, 1 if this > 0
651
+ function bnSigNum() {
652
+ if(this.s < 0) return -1;
653
+ else if(this.t <= 0 || (this.t == 1 && this.data[0] <= 0)) return 0;
654
+ else return 1;
655
+ }
656
+
657
+ // (protected) convert to radix string
658
+ function bnpToRadix(b) {
659
+ if(b == null) b = 10;
660
+ if(this.signum() == 0 || b < 2 || b > 36) return "0";
661
+ var cs = this.chunkSize(b);
662
+ var a = Math.pow(b,cs);
663
+ var d = nbv(a), y = nbi(), z = nbi(), r = "";
664
+ this.divRemTo(d,y,z);
665
+ while(y.signum() > 0) {
666
+ r = (a+z.intValue()).toString(b).substr(1) + r;
667
+ y.divRemTo(d,y,z);
668
+ }
669
+ return z.intValue().toString(b) + r;
670
+ }
671
+
672
+ // (protected) convert from radix string
673
+ function bnpFromRadix(s,b) {
674
+ this.fromInt(0);
675
+ if(b == null) b = 10;
676
+ var cs = this.chunkSize(b);
677
+ var d = Math.pow(b,cs), mi = false, j = 0, w = 0;
678
+ for(var i = 0; i < s.length; ++i) {
679
+ var x = intAt(s,i);
680
+ if(x < 0) {
681
+ if(s.charAt(i) == "-" && this.signum() == 0) mi = true;
682
+ continue;
683
+ }
684
+ w = b*w+x;
685
+ if(++j >= cs) {
686
+ this.dMultiply(d);
687
+ this.dAddOffset(w,0);
688
+ j = 0;
689
+ w = 0;
690
+ }
691
+ }
692
+ if(j > 0) {
693
+ this.dMultiply(Math.pow(b,j));
694
+ this.dAddOffset(w,0);
695
+ }
696
+ if(mi) BigInteger.ZERO.subTo(this,this);
697
+ }
698
+
699
+ // (protected) alternate constructor
700
+ function bnpFromNumber(a,b,c) {
701
+ if("number" == typeof b) {
702
+ // new BigInteger(int,int,RNG)
703
+ if(a < 2) this.fromInt(1);
704
+ else {
705
+ this.fromNumber(a,c);
706
+ if(!this.testBit(a-1)) // force MSB set
707
+ this.bitwiseTo(BigInteger.ONE.shiftLeft(a-1),op_or,this);
708
+ if(this.isEven()) this.dAddOffset(1,0); // force odd
709
+ while(!this.isProbablePrime(b)) {
710
+ this.dAddOffset(2,0);
711
+ if(this.bitLength() > a) this.subTo(BigInteger.ONE.shiftLeft(a-1),this);
712
+ }
713
+ }
714
+ }
715
+ else {
716
+ // new BigInteger(int,RNG)
717
+ var x = new Array(), t = a&7;
718
+ x.length = (a>>3)+1;
719
+ b.nextBytes(x);
720
+ if(t > 0) x[0] &= ((1<<t)-1); else x[0] = 0;
721
+ this.fromString(x,256);
722
+ }
723
+ }
724
+
725
+ // (public) convert to bigendian byte array
726
+ function bnToByteArray() {
727
+ var i = this.t, r = new Array();
728
+ r[0] = this.s;
729
+ var p = this.DB-(i*this.DB)%8, d, k = 0;
730
+ if(i-- > 0) {
731
+ if(p < this.DB && (d = this.data[i]>>p) != (this.s&this.DM)>>p)
732
+ r[k++] = d|(this.s<<(this.DB-p));
733
+ while(i >= 0) {
734
+ if(p < 8) {
735
+ d = (this.data[i]&((1<<p)-1))<<(8-p);
736
+ d |= this.data[--i]>>(p+=this.DB-8);
737
+ }
738
+ else {
739
+ d = (this.data[i]>>(p-=8))&0xff;
740
+ if(p <= 0) { p += this.DB; --i; }
741
+ }
742
+ if((d&0x80) != 0) d |= -256;
743
+ if(k == 0 && (this.s&0x80) != (d&0x80)) ++k;
744
+ if(k > 0 || d != this.s) r[k++] = d;
745
+ }
746
+ }
747
+ return r;
748
+ }
749
+
750
+ function bnEquals(a) { return(this.compareTo(a)==0); }
751
+ function bnMin(a) { return(this.compareTo(a)<0)?this:a; }
752
+ function bnMax(a) { return(this.compareTo(a)>0)?this:a; }
753
+
754
+ // (protected) r = this op a (bitwise)
755
+ function bnpBitwiseTo(a,op,r) {
756
+ var i, f, m = Math.min(a.t,this.t);
757
+ for(i = 0; i < m; ++i) r.data[i] = op(this.data[i],a.data[i]);
758
+ if(a.t < this.t) {
759
+ f = a.s&this.DM;
760
+ for(i = m; i < this.t; ++i) r.data[i] = op(this.data[i],f);
761
+ r.t = this.t;
762
+ }
763
+ else {
764
+ f = this.s&this.DM;
765
+ for(i = m; i < a.t; ++i) r.data[i] = op(f,a.data[i]);
766
+ r.t = a.t;
767
+ }
768
+ r.s = op(this.s,a.s);
769
+ r.clamp();
770
+ }
771
+
772
+ // (public) this & a
773
+ function op_and(x,y) { return x&y; }
774
+ function bnAnd(a) { var r = nbi(); this.bitwiseTo(a,op_and,r); return r; }
775
+
776
+ // (public) this | a
777
+ function op_or(x,y) { return x|y; }
778
+ function bnOr(a) { var r = nbi(); this.bitwiseTo(a,op_or,r); return r; }
779
+
780
+ // (public) this ^ a
781
+ function op_xor(x,y) { return x^y; }
782
+ function bnXor(a) { var r = nbi(); this.bitwiseTo(a,op_xor,r); return r; }
783
+
784
+ // (public) this & ~a
785
+ function op_andnot(x,y) { return x&~y; }
786
+ function bnAndNot(a) { var r = nbi(); this.bitwiseTo(a,op_andnot,r); return r; }
787
+
788
+ // (public) ~this
789
+ function bnNot() {
790
+ var r = nbi();
791
+ for(var i = 0; i < this.t; ++i) r.data[i] = this.DM&~this.data[i];
792
+ r.t = this.t;
793
+ r.s = ~this.s;
794
+ return r;
795
+ }
796
+
797
+ // (public) this << n
798
+ function bnShiftLeft(n) {
799
+ var r = nbi();
800
+ if(n < 0) this.rShiftTo(-n,r); else this.lShiftTo(n,r);
801
+ return r;
802
+ }
803
+
804
+ // (public) this >> n
805
+ function bnShiftRight(n) {
806
+ var r = nbi();
807
+ if(n < 0) this.lShiftTo(-n,r); else this.rShiftTo(n,r);
808
+ return r;
809
+ }
810
+
811
+ // return index of lowest 1-bit in x, x < 2^31
812
+ function lbit(x) {
813
+ if(x == 0) return -1;
814
+ var r = 0;
815
+ if((x&0xffff) == 0) { x >>= 16; r += 16; }
816
+ if((x&0xff) == 0) { x >>= 8; r += 8; }
817
+ if((x&0xf) == 0) { x >>= 4; r += 4; }
818
+ if((x&3) == 0) { x >>= 2; r += 2; }
819
+ if((x&1) == 0) ++r;
820
+ return r;
821
+ }
822
+
823
+ // (public) returns index of lowest 1-bit (or -1 if none)
824
+ function bnGetLowestSetBit() {
825
+ for(var i = 0; i < this.t; ++i)
826
+ if(this.data[i] != 0) return i*this.DB+lbit(this.data[i]);
827
+ if(this.s < 0) return this.t*this.DB;
828
+ return -1;
829
+ }
830
+
831
+ // return number of 1 bits in x
832
+ function cbit(x) {
833
+ var r = 0;
834
+ while(x != 0) { x &= x-1; ++r; }
835
+ return r;
836
+ }
837
+
838
+ // (public) return number of set bits
839
+ function bnBitCount() {
840
+ var r = 0, x = this.s&this.DM;
841
+ for(var i = 0; i < this.t; ++i) r += cbit(this.data[i]^x);
842
+ return r;
843
+ }
844
+
845
+ // (public) true iff nth bit is set
846
+ function bnTestBit(n) {
847
+ var j = Math.floor(n/this.DB);
848
+ if(j >= this.t) return(this.s!=0);
849
+ return((this.data[j]&(1<<(n%this.DB)))!=0);
850
+ }
851
+
852
+ // (protected) this op (1<<n)
853
+ function bnpChangeBit(n,op) {
854
+ var r = BigInteger.ONE.shiftLeft(n);
855
+ this.bitwiseTo(r,op,r);
856
+ return r;
857
+ }
858
+
859
+ // (public) this | (1<<n)
860
+ function bnSetBit(n) { return this.changeBit(n,op_or); }
861
+
862
+ // (public) this & ~(1<<n)
863
+ function bnClearBit(n) { return this.changeBit(n,op_andnot); }
864
+
865
+ // (public) this ^ (1<<n)
866
+ function bnFlipBit(n) { return this.changeBit(n,op_xor); }
867
+
868
+ // (protected) r = this + a
869
+ function bnpAddTo(a,r) {
870
+ var i = 0, c = 0, m = Math.min(a.t,this.t);
871
+ while(i < m) {
872
+ c += this.data[i]+a.data[i];
873
+ r.data[i++] = c&this.DM;
874
+ c >>= this.DB;
875
+ }
876
+ if(a.t < this.t) {
877
+ c += a.s;
878
+ while(i < this.t) {
879
+ c += this.data[i];
880
+ r.data[i++] = c&this.DM;
881
+ c >>= this.DB;
882
+ }
883
+ c += this.s;
884
+ }
885
+ else {
886
+ c += this.s;
887
+ while(i < a.t) {
888
+ c += a.data[i];
889
+ r.data[i++] = c&this.DM;
890
+ c >>= this.DB;
891
+ }
892
+ c += a.s;
893
+ }
894
+ r.s = (c<0)?-1:0;
895
+ if(c > 0) r.data[i++] = c;
896
+ else if(c < -1) r.data[i++] = this.DV+c;
897
+ r.t = i;
898
+ r.clamp();
899
+ }
900
+
901
+ // (public) this + a
902
+ function bnAdd(a) { var r = nbi(); this.addTo(a,r); return r; }
903
+
904
+ // (public) this - a
905
+ function bnSubtract(a) { var r = nbi(); this.subTo(a,r); return r; }
906
+
907
+ // (public) this * a
908
+ function bnMultiply(a) { var r = nbi(); this.multiplyTo(a,r); return r; }
909
+
910
+ // (public) this^2
911
+ function bnSquare() { var r = nbi(); this.squareTo(r); return r; }
912
+
913
+ // (public) this / a
914
+ function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; }
915
+
916
+ // (public) this % a
917
+ function bnRemainder(a) { var r = nbi(); this.divRemTo(a,null,r); return r; }
918
+
919
+ // (public) [this/a,this%a]
920
+ function bnDivideAndRemainder(a) {
921
+ var q = nbi(), r = nbi();
922
+ this.divRemTo(a,q,r);
923
+ return new Array(q,r);
924
+ }
925
+
926
+ // (protected) this *= n, this >= 0, 1 < n < DV
927
+ function bnpDMultiply(n) {
928
+ this.data[this.t] = this.am(0,n-1,this,0,0,this.t);
929
+ ++this.t;
930
+ this.clamp();
931
+ }
932
+
933
+ // (protected) this += n << w words, this >= 0
934
+ function bnpDAddOffset(n,w) {
935
+ if(n == 0) return;
936
+ while(this.t <= w) this.data[this.t++] = 0;
937
+ this.data[w] += n;
938
+ while(this.data[w] >= this.DV) {
939
+ this.data[w] -= this.DV;
940
+ if(++w >= this.t) this.data[this.t++] = 0;
941
+ ++this.data[w];
942
+ }
943
+ }
944
+
945
+ // A "null" reducer
946
+ function NullExp() {}
947
+ function nNop(x) { return x; }
948
+ function nMulTo(x,y,r) { x.multiplyTo(y,r); }
949
+ function nSqrTo(x,r) { x.squareTo(r); }
950
+
951
+ NullExp.prototype.convert = nNop;
952
+ NullExp.prototype.revert = nNop;
953
+ NullExp.prototype.mulTo = nMulTo;
954
+ NullExp.prototype.sqrTo = nSqrTo;
955
+
956
+ // (public) this^e
957
+ function bnPow(e) { return this.exp(e,new NullExp()); }
958
+
959
+ // (protected) r = lower n words of "this * a", a.t <= n
960
+ // "this" should be the larger one if appropriate.
961
+ function bnpMultiplyLowerTo(a,n,r) {
962
+ var i = Math.min(this.t+a.t,n);
963
+ r.s = 0; // assumes a,this >= 0
964
+ r.t = i;
965
+ while(i > 0) r.data[--i] = 0;
966
+ var j;
967
+ for(j = r.t-this.t; i < j; ++i) r.data[i+this.t] = this.am(0,a.data[i],r,i,0,this.t);
968
+ for(j = Math.min(a.t,n); i < j; ++i) this.am(0,a.data[i],r,i,0,n-i);
969
+ r.clamp();
970
+ }
971
+
972
+ // (protected) r = "this * a" without lower n words, n > 0
973
+ // "this" should be the larger one if appropriate.
974
+ function bnpMultiplyUpperTo(a,n,r) {
975
+ --n;
976
+ var i = r.t = this.t+a.t-n;
977
+ r.s = 0; // assumes a,this >= 0
978
+ while(--i >= 0) r.data[i] = 0;
979
+ for(i = Math.max(n-this.t,0); i < a.t; ++i)
980
+ r.data[this.t+i-n] = this.am(n-i,a.data[i],r,0,0,this.t+i-n);
981
+ r.clamp();
982
+ r.drShiftTo(1,r);
983
+ }
984
+
985
+ // Barrett modular reduction
986
+ function Barrett(m) {
987
+ // setup Barrett
988
+ this.r2 = nbi();
989
+ this.q3 = nbi();
990
+ BigInteger.ONE.dlShiftTo(2*m.t,this.r2);
991
+ this.mu = this.r2.divide(m);
992
+ this.m = m;
993
+ }
994
+
995
+ function barrettConvert(x) {
996
+ if(x.s < 0 || x.t > 2*this.m.t) return x.mod(this.m);
997
+ else if(x.compareTo(this.m) < 0) return x;
998
+ else { var r = nbi(); x.copyTo(r); this.reduce(r); return r; }
999
+ }
1000
+
1001
+ function barrettRevert(x) { return x; }
1002
+
1003
+ // x = x mod m (HAC 14.42)
1004
+ function barrettReduce(x) {
1005
+ x.drShiftTo(this.m.t-1,this.r2);
1006
+ if(x.t > this.m.t+1) { x.t = this.m.t+1; x.clamp(); }
1007
+ this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3);
1008
+ this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);
1009
+ while(x.compareTo(this.r2) < 0) x.dAddOffset(1,this.m.t+1);
1010
+ x.subTo(this.r2,x);
1011
+ while(x.compareTo(this.m) >= 0) x.subTo(this.m,x);
1012
+ }
1013
+
1014
+ // r = x^2 mod m; x != r
1015
+ function barrettSqrTo(x,r) { x.squareTo(r); this.reduce(r); }
1016
+
1017
+ // r = x*y mod m; x,y != r
1018
+ function barrettMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); }
1019
+
1020
+ Barrett.prototype.convert = barrettConvert;
1021
+ Barrett.prototype.revert = barrettRevert;
1022
+ Barrett.prototype.reduce = barrettReduce;
1023
+ Barrett.prototype.mulTo = barrettMulTo;
1024
+ Barrett.prototype.sqrTo = barrettSqrTo;
1025
+
1026
+ // (public) this^e % m (HAC 14.85)
1027
+ function bnModPow(e,m) {
1028
+ var i = e.bitLength(), k, r = nbv(1), z;
1029
+ if(i <= 0) return r;
1030
+ else if(i < 18) k = 1;
1031
+ else if(i < 48) k = 3;
1032
+ else if(i < 144) k = 4;
1033
+ else if(i < 768) k = 5;
1034
+ else k = 6;
1035
+ if(i < 8)
1036
+ z = new Classic(m);
1037
+ else if(m.isEven())
1038
+ z = new Barrett(m);
1039
+ else
1040
+ z = new Montgomery(m);
1041
+
1042
+ // precomputation
1043
+ var g = new Array(), n = 3, k1 = k-1, km = (1<<k)-1;
1044
+ g[1] = z.convert(this);
1045
+ if(k > 1) {
1046
+ var g2 = nbi();
1047
+ z.sqrTo(g[1],g2);
1048
+ while(n <= km) {
1049
+ g[n] = nbi();
1050
+ z.mulTo(g2,g[n-2],g[n]);
1051
+ n += 2;
1052
+ }
1053
+ }
1054
+
1055
+ var j = e.t-1, w, is1 = true, r2 = nbi(), t;
1056
+ i = nbits(e.data[j])-1;
1057
+ while(j >= 0) {
1058
+ if(i >= k1) w = (e.data[j]>>(i-k1))&km;
1059
+ else {
1060
+ w = (e.data[j]&((1<<(i+1))-1))<<(k1-i);
1061
+ if(j > 0) w |= e.data[j-1]>>(this.DB+i-k1);
1062
+ }
1063
+
1064
+ n = k;
1065
+ while((w&1) == 0) { w >>= 1; --n; }
1066
+ if((i -= n) < 0) { i += this.DB; --j; }
1067
+ if(is1) { // ret == 1, don't bother squaring or multiplying it
1068
+ g[w].copyTo(r);
1069
+ is1 = false;
1070
+ }
1071
+ else {
1072
+ while(n > 1) { z.sqrTo(r,r2); z.sqrTo(r2,r); n -= 2; }
1073
+ if(n > 0) z.sqrTo(r,r2); else { t = r; r = r2; r2 = t; }
1074
+ z.mulTo(r2,g[w],r);
1075
+ }
1076
+
1077
+ while(j >= 0 && (e.data[j]&(1<<i)) == 0) {
1078
+ z.sqrTo(r,r2); t = r; r = r2; r2 = t;
1079
+ if(--i < 0) { i = this.DB-1; --j; }
1080
+ }
1081
+ }
1082
+ return z.revert(r);
1083
+ }
1084
+
1085
+ // (public) gcd(this,a) (HAC 14.54)
1086
+ function bnGCD(a) {
1087
+ var x = (this.s<0)?this.negate():this.clone();
1088
+ var y = (a.s<0)?a.negate():a.clone();
1089
+ if(x.compareTo(y) < 0) { var t = x; x = y; y = t; }
1090
+ var i = x.getLowestSetBit(), g = y.getLowestSetBit();
1091
+ if(g < 0) return x;
1092
+ if(i < g) g = i;
1093
+ if(g > 0) {
1094
+ x.rShiftTo(g,x);
1095
+ y.rShiftTo(g,y);
1096
+ }
1097
+ while(x.signum() > 0) {
1098
+ if((i = x.getLowestSetBit()) > 0) x.rShiftTo(i,x);
1099
+ if((i = y.getLowestSetBit()) > 0) y.rShiftTo(i,y);
1100
+ if(x.compareTo(y) >= 0) {
1101
+ x.subTo(y,x);
1102
+ x.rShiftTo(1,x);
1103
+ }
1104
+ else {
1105
+ y.subTo(x,y);
1106
+ y.rShiftTo(1,y);
1107
+ }
1108
+ }
1109
+ if(g > 0) y.lShiftTo(g,y);
1110
+ return y;
1111
+ }
1112
+
1113
+ // (protected) this % n, n < 2^26
1114
+ function bnpModInt(n) {
1115
+ if(n <= 0) return 0;
1116
+ var d = this.DV%n, r = (this.s<0)?n-1:0;
1117
+ if(this.t > 0)
1118
+ if(d == 0) r = this.data[0]%n;
1119
+ else for(var i = this.t-1; i >= 0; --i) r = (d*r+this.data[i])%n;
1120
+ return r;
1121
+ }
1122
+
1123
+ // (public) 1/this % m (HAC 14.61)
1124
+ function bnModInverse(m) {
1125
+ // FORGE: jsbn fix
1126
+ // avoid infinite loop with zero or negative inputs
1127
+ if(this.signum() <= 0 || m.signum() <= 0) {
1128
+ // returning zero to align with similar behavior when no multiplicative
1129
+ // inverse module m is found.
1130
+ return BigInteger.ZERO;
1131
+ }
1132
+ var ac = m.isEven();
1133
+ if((this.isEven() && ac) || m.signum() == 0) return BigInteger.ZERO;
1134
+ var u = m.clone(), v = this.clone();
1135
+ var a = nbv(1), b = nbv(0), c = nbv(0), d = nbv(1);
1136
+ while(u.signum() != 0) {
1137
+ while(u.isEven()) {
1138
+ u.rShiftTo(1,u);
1139
+ if(ac) {
1140
+ if(!a.isEven() || !b.isEven()) { a.addTo(this,a); b.subTo(m,b); }
1141
+ a.rShiftTo(1,a);
1142
+ }
1143
+ else if(!b.isEven()) b.subTo(m,b);
1144
+ b.rShiftTo(1,b);
1145
+ }
1146
+ while(v.isEven()) {
1147
+ v.rShiftTo(1,v);
1148
+ if(ac) {
1149
+ if(!c.isEven() || !d.isEven()) { c.addTo(this,c); d.subTo(m,d); }
1150
+ c.rShiftTo(1,c);
1151
+ }
1152
+ else if(!d.isEven()) d.subTo(m,d);
1153
+ d.rShiftTo(1,d);
1154
+ }
1155
+ if(u.compareTo(v) >= 0) {
1156
+ u.subTo(v,u);
1157
+ if(ac) a.subTo(c,a);
1158
+ b.subTo(d,b);
1159
+ }
1160
+ else {
1161
+ v.subTo(u,v);
1162
+ if(ac) c.subTo(a,c);
1163
+ d.subTo(b,d);
1164
+ }
1165
+ }
1166
+ if(v.compareTo(BigInteger.ONE) != 0) return BigInteger.ZERO;
1167
+ if(d.compareTo(m) >= 0) return d.subtract(m);
1168
+ if(d.signum() < 0) d.addTo(m,d); else return d;
1169
+ if(d.signum() < 0) return d.add(m); else return d;
1170
+ }
1171
+
1172
+ var lowprimes = [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];
1173
+ var lplim = (1<<26)/lowprimes[lowprimes.length-1];
1174
+
1175
+ // (public) test primality with certainty >= 1-.5^t
1176
+ function bnIsProbablePrime(t) {
1177
+ var i, x = this.abs();
1178
+ if(x.t == 1 && x.data[0] <= lowprimes[lowprimes.length-1]) {
1179
+ for(i = 0; i < lowprimes.length; ++i)
1180
+ if(x.data[0] == lowprimes[i]) return true;
1181
+ return false;
1182
+ }
1183
+ if(x.isEven()) return false;
1184
+ i = 1;
1185
+ while(i < lowprimes.length) {
1186
+ var m = lowprimes[i], j = i+1;
1187
+ while(j < lowprimes.length && m < lplim) m *= lowprimes[j++];
1188
+ m = x.modInt(m);
1189
+ while(i < j) if(m%lowprimes[i++] == 0) return false;
1190
+ }
1191
+ return x.millerRabin(t);
1192
+ }
1193
+
1194
+ // (protected) true if probably prime (HAC 4.24, Miller-Rabin)
1195
+ function bnpMillerRabin(t) {
1196
+ var n1 = this.subtract(BigInteger.ONE);
1197
+ var k = n1.getLowestSetBit();
1198
+ if(k <= 0) return false;
1199
+ var r = n1.shiftRight(k);
1200
+ var prng = bnGetPrng();
1201
+ var a;
1202
+ for(var i = 0; i < t; ++i) {
1203
+ // select witness 'a' at random from between 1 and n1
1204
+ do {
1205
+ a = new BigInteger(this.bitLength(), prng);
1206
+ }
1207
+ while(a.compareTo(BigInteger.ONE) <= 0 || a.compareTo(n1) >= 0);
1208
+ var y = a.modPow(r,this);
1209
+ if(y.compareTo(BigInteger.ONE) != 0 && y.compareTo(n1) != 0) {
1210
+ var j = 1;
1211
+ while(j++ < k && y.compareTo(n1) != 0) {
1212
+ y = y.modPowInt(2,this);
1213
+ if(y.compareTo(BigInteger.ONE) == 0) return false;
1214
+ }
1215
+ if(y.compareTo(n1) != 0) return false;
1216
+ }
1217
+ }
1218
+ return true;
1219
+ }
1220
+
1221
+ // get pseudo random number generator
1222
+ function bnGetPrng() {
1223
+ // create prng with api that matches BigInteger secure random
1224
+ return {
1225
+ // x is an array to fill with bytes
1226
+ nextBytes: function(x) {
1227
+ for(var i = 0; i < x.length; ++i) {
1228
+ x[i] = Math.floor(Math.random() * 0x0100);
1229
+ }
1230
+ }
1231
+ };
1232
+ }
1233
+
1234
+ // protected
1235
+ BigInteger.prototype.chunkSize = bnpChunkSize;
1236
+ BigInteger.prototype.toRadix = bnpToRadix;
1237
+ BigInteger.prototype.fromRadix = bnpFromRadix;
1238
+ BigInteger.prototype.fromNumber = bnpFromNumber;
1239
+ BigInteger.prototype.bitwiseTo = bnpBitwiseTo;
1240
+ BigInteger.prototype.changeBit = bnpChangeBit;
1241
+ BigInteger.prototype.addTo = bnpAddTo;
1242
+ BigInteger.prototype.dMultiply = bnpDMultiply;
1243
+ BigInteger.prototype.dAddOffset = bnpDAddOffset;
1244
+ BigInteger.prototype.multiplyLowerTo = bnpMultiplyLowerTo;
1245
+ BigInteger.prototype.multiplyUpperTo = bnpMultiplyUpperTo;
1246
+ BigInteger.prototype.modInt = bnpModInt;
1247
+ BigInteger.prototype.millerRabin = bnpMillerRabin;
1248
+
1249
+ // public
1250
+ BigInteger.prototype.clone = bnClone;
1251
+ BigInteger.prototype.intValue = bnIntValue;
1252
+ BigInteger.prototype.byteValue = bnByteValue;
1253
+ BigInteger.prototype.shortValue = bnShortValue;
1254
+ BigInteger.prototype.signum = bnSigNum;
1255
+ BigInteger.prototype.toByteArray = bnToByteArray;
1256
+ BigInteger.prototype.equals = bnEquals;
1257
+ BigInteger.prototype.min = bnMin;
1258
+ BigInteger.prototype.max = bnMax;
1259
+ BigInteger.prototype.and = bnAnd;
1260
+ BigInteger.prototype.or = bnOr;
1261
+ BigInteger.prototype.xor = bnXor;
1262
+ BigInteger.prototype.andNot = bnAndNot;
1263
+ BigInteger.prototype.not = bnNot;
1264
+ BigInteger.prototype.shiftLeft = bnShiftLeft;
1265
+ BigInteger.prototype.shiftRight = bnShiftRight;
1266
+ BigInteger.prototype.getLowestSetBit = bnGetLowestSetBit;
1267
+ BigInteger.prototype.bitCount = bnBitCount;
1268
+ BigInteger.prototype.testBit = bnTestBit;
1269
+ BigInteger.prototype.setBit = bnSetBit;
1270
+ BigInteger.prototype.clearBit = bnClearBit;
1271
+ BigInteger.prototype.flipBit = bnFlipBit;
1272
+ BigInteger.prototype.add = bnAdd;
1273
+ BigInteger.prototype.subtract = bnSubtract;
1274
+ BigInteger.prototype.multiply = bnMultiply;
1275
+ BigInteger.prototype.divide = bnDivide;
1276
+ BigInteger.prototype.remainder = bnRemainder;
1277
+ BigInteger.prototype.divideAndRemainder = bnDivideAndRemainder;
1278
+ BigInteger.prototype.modPow = bnModPow;
1279
+ BigInteger.prototype.modInverse = bnModInverse;
1280
+ BigInteger.prototype.pow = bnPow;
1281
+ BigInteger.prototype.gcd = bnGCD;
1282
+ BigInteger.prototype.isProbablePrime = bnIsProbablePrime;
1283
+
1284
+ // JSBN-specific extension
1285
+ BigInteger.prototype.square = bnSquare;
1286
+
1287
+ // BigInteger interfaces not implemented in jsbn:
1288
+
1289
+ // BigInteger(int signum, byte[] magnitude)
1290
+ // double doubleValue()
1291
+ // float floatValue()
1292
+ // int hashCode()
1293
+ // long longValue()
1294
+ // static BigInteger valueOf(long val)