node-red-contrib-tak-registration 0.14.1 → 0.15.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 (447) hide show
  1. package/README.md +1 -1
  2. package/node_modules/@types/geojson/README.md +1 -1
  3. package/node_modules/@types/geojson/index.d.ts +36 -2
  4. package/node_modules/@types/geojson/package.json +2 -2
  5. package/node_modules/@types/node/README.md +2 -2
  6. package/node_modules/@types/node/assert.d.ts +14 -0
  7. package/node_modules/@types/node/async_hooks.d.ts +64 -2
  8. package/node_modules/@types/node/buffer.buffer.d.ts +117 -39
  9. package/node_modules/@types/node/buffer.d.ts +6 -13
  10. package/node_modules/@types/node/cluster.d.ts +1 -1
  11. package/node_modules/@types/node/constants.d.ts +14 -12
  12. package/node_modules/@types/node/crypto.d.ts +44 -10
  13. package/node_modules/@types/node/dgram.d.ts +10 -7
  14. package/node_modules/@types/node/diagnostics_channel.d.ts +20 -1
  15. package/node_modules/@types/node/fs/promises.d.ts +23 -26
  16. package/node_modules/@types/node/fs.d.ts +166 -125
  17. package/node_modules/@types/node/globals.d.ts +141 -338
  18. package/node_modules/@types/node/http.d.ts +25 -3
  19. package/node_modules/@types/node/http2.d.ts +3 -4
  20. package/node_modules/@types/node/https.d.ts +3 -1
  21. package/node_modules/@types/node/inspector.d.ts +36 -0
  22. package/node_modules/@types/node/module.d.ts +599 -236
  23. package/node_modules/@types/node/net.d.ts +44 -13
  24. package/node_modules/@types/node/package.json +9 -4
  25. package/node_modules/@types/node/perf_hooks.d.ts +5 -0
  26. package/node_modules/@types/node/process.d.ts +69 -2
  27. package/node_modules/@types/node/querystring.d.ts +2 -3
  28. package/node_modules/@types/node/readline.d.ts +6 -1
  29. package/node_modules/@types/node/sea.d.ts +1 -1
  30. package/node_modules/@types/node/sqlite.d.ts +291 -17
  31. package/node_modules/@types/node/stream/consumers.d.ts +32 -6
  32. package/node_modules/@types/node/stream/web.d.ts +9 -4
  33. package/node_modules/@types/node/stream.d.ts +936 -1000
  34. package/node_modules/@types/node/test.d.ts +169 -137
  35. package/node_modules/@types/node/timers/promises.d.ts +24 -13
  36. package/node_modules/@types/node/timers.d.ts +159 -112
  37. package/node_modules/@types/node/tls.d.ts +34 -1
  38. package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +110 -35
  39. package/node_modules/@types/node/util.d.ts +323 -110
  40. package/node_modules/@types/node/v8.d.ts +81 -0
  41. package/node_modules/@types/node/vm.d.ts +21 -6
  42. package/node_modules/@types/node/worker_threads.d.ts +1 -0
  43. package/node_modules/@types/node/zlib.d.ts +167 -36
  44. package/node_modules/axios/CHANGELOG.md +124 -0
  45. package/node_modules/axios/README.md +38 -16
  46. package/node_modules/axios/dist/axios.js +44 -39
  47. package/node_modules/axios/dist/axios.js.map +1 -1
  48. package/node_modules/axios/dist/axios.min.js +2 -1
  49. package/node_modules/axios/dist/axios.min.js.map +1 -1
  50. package/node_modules/axios/dist/browser/axios.cjs +43 -39
  51. package/node_modules/axios/dist/browser/axios.cjs.map +1 -1
  52. package/node_modules/axios/dist/esm/axios.js +43 -39
  53. package/node_modules/axios/dist/esm/axios.js.map +1 -1
  54. package/node_modules/axios/dist/esm/axios.min.js +2 -1
  55. package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
  56. package/node_modules/axios/dist/node/axios.cjs +74 -43
  57. package/node_modules/axios/dist/node/axios.cjs.map +1 -1
  58. package/node_modules/axios/index.d.cts +3 -2
  59. package/node_modules/axios/index.d.ts +5 -2
  60. package/node_modules/axios/lib/adapters/fetch.js +1 -1
  61. package/node_modules/axios/lib/adapters/http.js +1 -1
  62. package/node_modules/axios/lib/core/Axios.js +11 -2
  63. package/node_modules/axios/lib/core/AxiosHeaders.js +15 -3
  64. package/node_modules/axios/lib/core/buildFullPath.js +3 -2
  65. package/node_modules/axios/lib/env/data.js +1 -1
  66. package/node_modules/axios/lib/helpers/formDataToStream.js +4 -3
  67. package/node_modules/axios/lib/helpers/resolveConfig.js +1 -1
  68. package/node_modules/axios/lib/platform/node/index.js +26 -0
  69. package/node_modules/axios/lib/utils.js +12 -28
  70. package/node_modules/axios/package.json +3 -3
  71. package/node_modules/bignumber.js/CHANGELOG.md +82 -1
  72. package/node_modules/bignumber.js/LICENCE.md +1 -1
  73. package/node_modules/bignumber.js/README.md +6 -4
  74. package/node_modules/bignumber.js/bignumber.d.mts +6 -0
  75. package/node_modules/bignumber.js/bignumber.d.ts +3 -1829
  76. package/node_modules/bignumber.js/bignumber.js +3 -3
  77. package/node_modules/bignumber.js/bignumber.mjs +3 -3
  78. package/node_modules/bignumber.js/package.json +17 -7
  79. package/node_modules/bignumber.js/types.d.ts +1821 -0
  80. package/node_modules/call-bind-apply-helpers/.eslintrc +17 -0
  81. package/node_modules/call-bind-apply-helpers/.github/FUNDING.yml +12 -0
  82. package/node_modules/call-bind-apply-helpers/.nycrc +9 -0
  83. package/node_modules/call-bind-apply-helpers/CHANGELOG.md +30 -0
  84. package/node_modules/call-bind-apply-helpers/LICENSE +21 -0
  85. package/node_modules/call-bind-apply-helpers/README.md +62 -0
  86. package/node_modules/call-bind-apply-helpers/actualApply.d.ts +1 -0
  87. package/node_modules/call-bind-apply-helpers/actualApply.js +10 -0
  88. package/node_modules/call-bind-apply-helpers/applyBind.d.ts +19 -0
  89. package/node_modules/call-bind-apply-helpers/applyBind.js +10 -0
  90. package/node_modules/call-bind-apply-helpers/functionApply.d.ts +1 -0
  91. package/node_modules/call-bind-apply-helpers/functionApply.js +4 -0
  92. package/node_modules/call-bind-apply-helpers/functionCall.d.ts +1 -0
  93. package/node_modules/call-bind-apply-helpers/functionCall.js +4 -0
  94. package/node_modules/call-bind-apply-helpers/index.d.ts +64 -0
  95. package/node_modules/call-bind-apply-helpers/index.js +15 -0
  96. package/node_modules/call-bind-apply-helpers/package.json +85 -0
  97. package/node_modules/call-bind-apply-helpers/reflectApply.d.ts +3 -0
  98. package/node_modules/call-bind-apply-helpers/reflectApply.js +4 -0
  99. package/node_modules/call-bind-apply-helpers/test/index.js +63 -0
  100. package/node_modules/call-bind-apply-helpers/tsconfig.json +9 -0
  101. package/node_modules/dunder-proto/.eslintrc +5 -0
  102. package/node_modules/dunder-proto/.github/FUNDING.yml +12 -0
  103. package/node_modules/dunder-proto/.nycrc +13 -0
  104. package/node_modules/dunder-proto/CHANGELOG.md +24 -0
  105. package/node_modules/dunder-proto/LICENSE +21 -0
  106. package/node_modules/dunder-proto/README.md +54 -0
  107. package/node_modules/dunder-proto/get.d.ts +5 -0
  108. package/node_modules/dunder-proto/get.js +30 -0
  109. package/node_modules/dunder-proto/package.json +76 -0
  110. package/node_modules/dunder-proto/set.d.ts +5 -0
  111. package/node_modules/dunder-proto/set.js +35 -0
  112. package/node_modules/dunder-proto/test/get.js +34 -0
  113. package/node_modules/dunder-proto/test/index.js +4 -0
  114. package/node_modules/dunder-proto/test/set.js +50 -0
  115. package/node_modules/dunder-proto/tsconfig.json +9 -0
  116. package/node_modules/es-define-property/.eslintrc +13 -0
  117. package/node_modules/es-define-property/.github/FUNDING.yml +12 -0
  118. package/node_modules/es-define-property/.nycrc +9 -0
  119. package/node_modules/es-define-property/CHANGELOG.md +29 -0
  120. package/node_modules/es-define-property/LICENSE +21 -0
  121. package/node_modules/es-define-property/README.md +49 -0
  122. package/node_modules/es-define-property/index.d.ts +3 -0
  123. package/node_modules/es-define-property/index.js +14 -0
  124. package/node_modules/es-define-property/package.json +81 -0
  125. package/node_modules/es-define-property/test/index.js +56 -0
  126. package/node_modules/es-define-property/tsconfig.json +10 -0
  127. package/node_modules/es-errors/.eslintrc +5 -0
  128. package/node_modules/es-errors/.github/FUNDING.yml +12 -0
  129. package/node_modules/es-errors/CHANGELOG.md +40 -0
  130. package/node_modules/es-errors/LICENSE +21 -0
  131. package/node_modules/es-errors/README.md +55 -0
  132. package/node_modules/es-errors/eval.d.ts +3 -0
  133. package/node_modules/es-errors/eval.js +4 -0
  134. package/node_modules/es-errors/index.d.ts +3 -0
  135. package/node_modules/es-errors/index.js +4 -0
  136. package/node_modules/es-errors/package.json +80 -0
  137. package/node_modules/es-errors/range.d.ts +3 -0
  138. package/node_modules/es-errors/range.js +4 -0
  139. package/node_modules/es-errors/ref.d.ts +3 -0
  140. package/node_modules/es-errors/ref.js +4 -0
  141. package/node_modules/es-errors/syntax.d.ts +3 -0
  142. package/node_modules/es-errors/syntax.js +4 -0
  143. package/node_modules/es-errors/test/index.js +19 -0
  144. package/node_modules/es-errors/tsconfig.json +49 -0
  145. package/node_modules/es-errors/type.d.ts +3 -0
  146. package/node_modules/es-errors/type.js +4 -0
  147. package/node_modules/es-errors/uri.d.ts +3 -0
  148. package/node_modules/es-errors/uri.js +4 -0
  149. package/node_modules/es-object-atoms/.eslintrc +16 -0
  150. package/node_modules/es-object-atoms/.github/FUNDING.yml +12 -0
  151. package/node_modules/es-object-atoms/CHANGELOG.md +37 -0
  152. package/node_modules/es-object-atoms/LICENSE +21 -0
  153. package/node_modules/es-object-atoms/README.md +63 -0
  154. package/node_modules/es-object-atoms/RequireObjectCoercible.d.ts +3 -0
  155. package/node_modules/es-object-atoms/RequireObjectCoercible.js +11 -0
  156. package/node_modules/es-object-atoms/ToObject.d.ts +7 -0
  157. package/node_modules/es-object-atoms/ToObject.js +10 -0
  158. package/node_modules/es-object-atoms/index.d.ts +3 -0
  159. package/node_modules/es-object-atoms/index.js +4 -0
  160. package/node_modules/es-object-atoms/isObject.d.ts +3 -0
  161. package/node_modules/es-object-atoms/isObject.js +6 -0
  162. package/node_modules/es-object-atoms/package.json +80 -0
  163. package/node_modules/es-object-atoms/test/index.js +38 -0
  164. package/node_modules/es-object-atoms/tsconfig.json +6 -0
  165. package/node_modules/es-set-tostringtag/.eslintrc +13 -0
  166. package/node_modules/es-set-tostringtag/.nycrc +9 -0
  167. package/node_modules/es-set-tostringtag/CHANGELOG.md +67 -0
  168. package/node_modules/es-set-tostringtag/LICENSE +21 -0
  169. package/node_modules/es-set-tostringtag/README.md +53 -0
  170. package/node_modules/es-set-tostringtag/index.d.ts +10 -0
  171. package/node_modules/es-set-tostringtag/index.js +35 -0
  172. package/node_modules/es-set-tostringtag/package.json +78 -0
  173. package/node_modules/es-set-tostringtag/test/index.js +85 -0
  174. package/node_modules/es-set-tostringtag/tsconfig.json +9 -0
  175. package/node_modules/fast-xml-parser/CHANGELOG.md +63 -0
  176. package/node_modules/fast-xml-parser/README.md +37 -51
  177. package/node_modules/fast-xml-parser/lib/fxbuilder.min.js +2 -0
  178. package/node_modules/fast-xml-parser/lib/fxbuilder.min.js.map +1 -0
  179. package/node_modules/fast-xml-parser/lib/fxp.cjs +1 -0
  180. package/node_modules/fast-xml-parser/lib/fxp.d.cts +458 -0
  181. package/node_modules/fast-xml-parser/lib/fxp.min.js +2 -0
  182. package/node_modules/fast-xml-parser/lib/fxp.min.js.map +1 -0
  183. package/node_modules/fast-xml-parser/lib/fxparser.min.js +2 -0
  184. package/node_modules/fast-xml-parser/lib/fxparser.min.js.map +1 -0
  185. package/node_modules/fast-xml-parser/lib/fxvalidator.min.js +2 -0
  186. package/node_modules/fast-xml-parser/lib/fxvalidator.min.js.map +1 -0
  187. package/node_modules/fast-xml-parser/package.json +36 -18
  188. package/node_modules/fast-xml-parser/src/cli/cli.js +12 -12
  189. package/node_modules/fast-xml-parser/src/cli/man.js +6 -1
  190. package/node_modules/fast-xml-parser/src/cli/read.js +30 -79
  191. package/node_modules/fast-xml-parser/src/fxp.d.ts +28 -1
  192. package/node_modules/fast-xml-parser/src/fxp.js +11 -8
  193. package/node_modules/fast-xml-parser/src/ignoreAttributes.js +2 -4
  194. package/node_modules/fast-xml-parser/src/util.js +14 -18
  195. package/node_modules/fast-xml-parser/src/{v5 → v6}/CharsSymbol.js +1 -1
  196. package/node_modules/fast-xml-parser/src/{v5 → v6}/EntitiesParser.js +3 -6
  197. package/node_modules/fast-xml-parser/src/{v5 → v6}/OptionsBuilder.js +3 -6
  198. package/node_modules/fast-xml-parser/src/{v5 → v6}/OutputBuilders/BaseOutputBuilder.js +1 -3
  199. package/node_modules/fast-xml-parser/src/{v5 → v6}/OutputBuilders/JsArrBuilder.js +3 -3
  200. package/node_modules/fast-xml-parser/src/{v5 → v6}/OutputBuilders/JsMinArrBuilder.js +3 -5
  201. package/node_modules/fast-xml-parser/src/{v5 → v6}/OutputBuilders/JsObjBuilder.js +3 -5
  202. package/node_modules/fast-xml-parser/src/{v5 → v6}/OutputBuilders/ParserOptionsBuilder.js +6 -11
  203. package/node_modules/fast-xml-parser/src/{v5 → v6}/TagPath.js +1 -1
  204. package/node_modules/fast-xml-parser/src/{v5 → v6}/TagPathMatcher.js +3 -5
  205. package/node_modules/fast-xml-parser/src/{v5 → v6}/XMLParser.js +3 -5
  206. package/node_modules/fast-xml-parser/src/{v5 → v6}/Xml2JsParser.js +8 -10
  207. package/node_modules/fast-xml-parser/src/{v5 → v6}/XmlPartReader.js +4 -10
  208. package/node_modules/fast-xml-parser/src/{v5 → v6}/XmlSpecialTagsReader.js +5 -12
  209. package/node_modules/fast-xml-parser/src/{v5 → v6}/inputSource/BufferSource.js +1 -3
  210. package/node_modules/fast-xml-parser/src/{v5 → v6}/inputSource/StringSource.js +1 -3
  211. package/node_modules/fast-xml-parser/src/{v5 → v6}/valueParsers/EntitiesParser.js +3 -5
  212. package/node_modules/fast-xml-parser/src/{v5 → v6}/valueParsers/booleanParser.js +1 -2
  213. package/node_modules/fast-xml-parser/src/{v5 → v6}/valueParsers/booleanParserExt.js +1 -2
  214. package/node_modules/fast-xml-parser/src/{v5 → v6}/valueParsers/currency.js +1 -3
  215. package/node_modules/fast-xml-parser/src/{v5 → v6}/valueParsers/join.js +1 -2
  216. package/node_modules/fast-xml-parser/src/{v5 → v6}/valueParsers/number.js +2 -4
  217. package/node_modules/fast-xml-parser/src/{v5 → v6}/valueParsers/trim.js +1 -3
  218. package/node_modules/fast-xml-parser/src/validator.js +5 -5
  219. package/node_modules/fast-xml-parser/src/xmlbuilder/json2xml.js +5 -4
  220. package/node_modules/fast-xml-parser/src/xmlbuilder/orderedJs2Xml.js +1 -2
  221. package/node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js +287 -71
  222. package/node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js +3 -5
  223. package/node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js +23 -23
  224. package/node_modules/fast-xml-parser/src/xmlparser/XMLParser.js +21 -8
  225. package/node_modules/fast-xml-parser/src/xmlparser/node2json.js +8 -2
  226. package/node_modules/fast-xml-parser/src/xmlparser/xmlNode.js +22 -7
  227. package/node_modules/form-data/lib/form_data.js +24 -22
  228. package/node_modules/form-data/package.json +17 -14
  229. package/node_modules/function-bind/.eslintrc +21 -0
  230. package/node_modules/function-bind/.github/FUNDING.yml +12 -0
  231. package/node_modules/function-bind/.github/SECURITY.md +3 -0
  232. package/node_modules/function-bind/.nycrc +13 -0
  233. package/node_modules/function-bind/CHANGELOG.md +136 -0
  234. package/node_modules/function-bind/LICENSE +20 -0
  235. package/node_modules/function-bind/README.md +46 -0
  236. package/node_modules/function-bind/implementation.js +84 -0
  237. package/node_modules/function-bind/index.js +5 -0
  238. package/node_modules/function-bind/package.json +87 -0
  239. package/node_modules/function-bind/test/.eslintrc +9 -0
  240. package/node_modules/function-bind/test/index.js +252 -0
  241. package/node_modules/get-intrinsic/.eslintrc +42 -0
  242. package/node_modules/get-intrinsic/.github/FUNDING.yml +12 -0
  243. package/node_modules/get-intrinsic/.nycrc +9 -0
  244. package/node_modules/get-intrinsic/CHANGELOG.md +186 -0
  245. package/node_modules/get-intrinsic/LICENSE +21 -0
  246. package/node_modules/get-intrinsic/README.md +71 -0
  247. package/node_modules/get-intrinsic/index.js +378 -0
  248. package/node_modules/get-intrinsic/package.json +97 -0
  249. package/node_modules/get-intrinsic/test/GetIntrinsic.js +274 -0
  250. package/node_modules/get-proto/.eslintrc +10 -0
  251. package/node_modules/get-proto/.github/FUNDING.yml +12 -0
  252. package/node_modules/get-proto/.nycrc +9 -0
  253. package/node_modules/get-proto/CHANGELOG.md +21 -0
  254. package/node_modules/get-proto/LICENSE +21 -0
  255. package/node_modules/get-proto/Object.getPrototypeOf.d.ts +5 -0
  256. package/node_modules/get-proto/Object.getPrototypeOf.js +6 -0
  257. package/node_modules/get-proto/README.md +50 -0
  258. package/node_modules/get-proto/Reflect.getPrototypeOf.d.ts +3 -0
  259. package/node_modules/get-proto/Reflect.getPrototypeOf.js +4 -0
  260. package/node_modules/get-proto/index.d.ts +5 -0
  261. package/node_modules/get-proto/index.js +27 -0
  262. package/node_modules/get-proto/package.json +81 -0
  263. package/node_modules/get-proto/test/index.js +68 -0
  264. package/node_modules/get-proto/tsconfig.json +9 -0
  265. package/node_modules/gopd/.eslintrc +16 -0
  266. package/node_modules/gopd/.github/FUNDING.yml +12 -0
  267. package/node_modules/gopd/CHANGELOG.md +45 -0
  268. package/node_modules/gopd/LICENSE +21 -0
  269. package/node_modules/gopd/README.md +40 -0
  270. package/node_modules/gopd/gOPD.d.ts +1 -0
  271. package/node_modules/gopd/gOPD.js +4 -0
  272. package/node_modules/gopd/index.d.ts +5 -0
  273. package/node_modules/gopd/index.js +15 -0
  274. package/node_modules/gopd/package.json +77 -0
  275. package/node_modules/gopd/test/index.js +36 -0
  276. package/node_modules/gopd/tsconfig.json +9 -0
  277. package/node_modules/has-symbols/.eslintrc +11 -0
  278. package/node_modules/has-symbols/.github/FUNDING.yml +12 -0
  279. package/node_modules/has-symbols/.nycrc +9 -0
  280. package/node_modules/has-symbols/CHANGELOG.md +91 -0
  281. package/node_modules/has-symbols/LICENSE +21 -0
  282. package/node_modules/has-symbols/README.md +46 -0
  283. package/node_modules/has-symbols/index.d.ts +3 -0
  284. package/node_modules/has-symbols/index.js +14 -0
  285. package/node_modules/has-symbols/package.json +111 -0
  286. package/node_modules/has-symbols/shams.d.ts +3 -0
  287. package/node_modules/has-symbols/shams.js +45 -0
  288. package/node_modules/has-symbols/test/index.js +22 -0
  289. package/node_modules/has-symbols/test/shams/core-js.js +29 -0
  290. package/node_modules/has-symbols/test/shams/get-own-property-symbols.js +29 -0
  291. package/node_modules/has-symbols/test/tests.js +58 -0
  292. package/node_modules/has-symbols/tsconfig.json +10 -0
  293. package/node_modules/has-tostringtag/.eslintrc +5 -0
  294. package/node_modules/has-tostringtag/.github/FUNDING.yml +12 -0
  295. package/node_modules/has-tostringtag/.nycrc +13 -0
  296. package/node_modules/has-tostringtag/CHANGELOG.md +42 -0
  297. package/node_modules/has-tostringtag/LICENSE +21 -0
  298. package/node_modules/has-tostringtag/README.md +46 -0
  299. package/node_modules/has-tostringtag/index.d.ts +3 -0
  300. package/node_modules/has-tostringtag/index.js +8 -0
  301. package/node_modules/has-tostringtag/package.json +108 -0
  302. package/node_modules/has-tostringtag/shams.d.ts +3 -0
  303. package/node_modules/has-tostringtag/shams.js +8 -0
  304. package/node_modules/has-tostringtag/test/index.js +21 -0
  305. package/node_modules/has-tostringtag/test/shams/core-js.js +31 -0
  306. package/node_modules/has-tostringtag/test/shams/get-own-property-symbols.js +30 -0
  307. package/node_modules/has-tostringtag/test/tests.js +15 -0
  308. package/node_modules/has-tostringtag/tsconfig.json +49 -0
  309. package/node_modules/hasown/.eslintrc +5 -0
  310. package/node_modules/hasown/.github/FUNDING.yml +12 -0
  311. package/node_modules/hasown/.nycrc +13 -0
  312. package/node_modules/hasown/CHANGELOG.md +40 -0
  313. package/node_modules/hasown/LICENSE +21 -0
  314. package/node_modules/hasown/README.md +40 -0
  315. package/node_modules/hasown/index.d.ts +3 -0
  316. package/node_modules/hasown/index.js +8 -0
  317. package/node_modules/hasown/package.json +92 -0
  318. package/node_modules/hasown/tsconfig.json +6 -0
  319. package/node_modules/long/README.md +93 -87
  320. package/node_modules/long/index.d.ts +2 -2
  321. package/node_modules/long/index.js +360 -246
  322. package/node_modules/long/package.json +12 -4
  323. package/node_modules/long/types.d.ts +474 -0
  324. package/node_modules/long/umd/index.d.ts +2 -456
  325. package/node_modules/long/umd/index.js +1585 -1395
  326. package/node_modules/long/umd/types.d.ts +474 -0
  327. package/node_modules/math-intrinsics/.eslintrc +16 -0
  328. package/node_modules/math-intrinsics/.github/FUNDING.yml +12 -0
  329. package/node_modules/math-intrinsics/CHANGELOG.md +24 -0
  330. package/node_modules/math-intrinsics/LICENSE +21 -0
  331. package/node_modules/math-intrinsics/README.md +50 -0
  332. package/node_modules/math-intrinsics/abs.d.ts +1 -0
  333. package/node_modules/math-intrinsics/abs.js +4 -0
  334. package/node_modules/math-intrinsics/constants/maxArrayLength.d.ts +3 -0
  335. package/node_modules/math-intrinsics/constants/maxArrayLength.js +4 -0
  336. package/node_modules/math-intrinsics/constants/maxSafeInteger.d.ts +3 -0
  337. package/node_modules/math-intrinsics/constants/maxSafeInteger.js +5 -0
  338. package/node_modules/math-intrinsics/constants/maxValue.d.ts +3 -0
  339. package/node_modules/math-intrinsics/constants/maxValue.js +5 -0
  340. package/node_modules/math-intrinsics/floor.d.ts +1 -0
  341. package/node_modules/math-intrinsics/floor.js +4 -0
  342. package/node_modules/math-intrinsics/isFinite.d.ts +3 -0
  343. package/node_modules/math-intrinsics/isFinite.js +12 -0
  344. package/node_modules/math-intrinsics/isInteger.d.ts +3 -0
  345. package/node_modules/math-intrinsics/isInteger.js +16 -0
  346. package/node_modules/math-intrinsics/isNaN.d.ts +1 -0
  347. package/node_modules/math-intrinsics/isNaN.js +6 -0
  348. package/node_modules/math-intrinsics/isNegativeZero.d.ts +3 -0
  349. package/node_modules/math-intrinsics/isNegativeZero.js +6 -0
  350. package/node_modules/math-intrinsics/max.d.ts +1 -0
  351. package/node_modules/math-intrinsics/max.js +4 -0
  352. package/node_modules/math-intrinsics/min.d.ts +1 -0
  353. package/node_modules/math-intrinsics/min.js +4 -0
  354. package/node_modules/math-intrinsics/mod.d.ts +3 -0
  355. package/node_modules/math-intrinsics/mod.js +9 -0
  356. package/node_modules/math-intrinsics/package.json +86 -0
  357. package/node_modules/math-intrinsics/pow.d.ts +1 -0
  358. package/node_modules/math-intrinsics/pow.js +4 -0
  359. package/node_modules/math-intrinsics/round.d.ts +1 -0
  360. package/node_modules/math-intrinsics/round.js +4 -0
  361. package/node_modules/math-intrinsics/sign.d.ts +3 -0
  362. package/node_modules/math-intrinsics/sign.js +11 -0
  363. package/node_modules/math-intrinsics/test/index.js +192 -0
  364. package/node_modules/math-intrinsics/tsconfig.json +3 -0
  365. package/node_modules/protobufjs/dist/light/protobuf.js +531 -80
  366. package/node_modules/protobufjs/dist/light/protobuf.js.map +1 -1
  367. package/node_modules/protobufjs/dist/light/protobuf.min.js +3 -3
  368. package/node_modules/protobufjs/dist/light/protobuf.min.js.map +1 -1
  369. package/node_modules/protobufjs/dist/minimal/protobuf.js +2 -2
  370. package/node_modules/protobufjs/dist/minimal/protobuf.min.js +2 -2
  371. package/node_modules/protobufjs/dist/protobuf.js +671 -144
  372. package/node_modules/protobufjs/dist/protobuf.js.map +1 -1
  373. package/node_modules/protobufjs/dist/protobuf.min.js +3 -3
  374. package/node_modules/protobufjs/dist/protobuf.min.js.map +1 -1
  375. package/node_modules/protobufjs/index.d.ts +71 -13
  376. package/node_modules/protobufjs/package.json +4 -2
  377. package/node_modules/protobufjs/src/decoder.js +8 -10
  378. package/node_modules/protobufjs/src/encoder.js +1 -1
  379. package/node_modules/protobufjs/src/enum.js +25 -0
  380. package/node_modules/protobufjs/src/field.js +104 -28
  381. package/node_modules/protobufjs/src/namespace.js +124 -13
  382. package/node_modules/protobufjs/src/object.js +139 -4
  383. package/node_modules/protobufjs/src/oneof.js +19 -0
  384. package/node_modules/protobufjs/src/parse.js +139 -63
  385. package/node_modules/protobufjs/src/root.js +52 -15
  386. package/node_modules/protobufjs/src/service.js +23 -1
  387. package/node_modules/protobufjs/src/type.js +29 -4
  388. package/node_modules/protobufjs/src/util.js +4 -1
  389. package/node_modules/strnum/.github/SECURITY.md +5 -0
  390. package/node_modules/strnum/CHANGELOG.md +33 -0
  391. package/node_modules/strnum/README.md +14 -3
  392. package/node_modules/strnum/algo.stflow +84 -0
  393. package/node_modules/strnum/package.json +9 -2
  394. package/node_modules/strnum/strnum.js +72 -67
  395. package/node_modules/strnum/strnum.test.js +29 -6
  396. package/node_modules/strnum/test.js +9 -0
  397. package/node_modules/undici-types/dispatcher.d.ts +1 -0
  398. package/node_modules/undici-types/package.json +1 -1
  399. package/node_modules/undici-types/readable.d.ts +5 -0
  400. package/node_modules/undici-types/webidl.d.ts +6 -0
  401. package/node_modules/uuid/README.md +12 -12
  402. package/node_modules/uuid/dist/cjs/types.d.ts +1 -1
  403. package/node_modules/uuid/dist/cjs/v1.d.ts +1 -1
  404. package/node_modules/uuid/dist/cjs/v1.js +1 -1
  405. package/node_modules/uuid/dist/cjs/v3.d.ts +1 -1
  406. package/node_modules/uuid/dist/cjs/v35.d.ts +1 -1
  407. package/node_modules/uuid/dist/cjs/v4.d.ts +1 -1
  408. package/node_modules/uuid/dist/cjs/v5.d.ts +1 -1
  409. package/node_modules/uuid/dist/cjs/v6.d.ts +1 -1
  410. package/node_modules/uuid/dist/cjs/v7.d.ts +1 -1
  411. package/node_modules/uuid/dist/cjs/v7.js +1 -1
  412. package/node_modules/uuid/dist/cjs-browser/types.d.ts +1 -1
  413. package/node_modules/uuid/dist/cjs-browser/v1.d.ts +1 -1
  414. package/node_modules/uuid/dist/cjs-browser/v1.js +1 -1
  415. package/node_modules/uuid/dist/cjs-browser/v3.d.ts +1 -1
  416. package/node_modules/uuid/dist/cjs-browser/v35.d.ts +1 -1
  417. package/node_modules/uuid/dist/cjs-browser/v4.d.ts +1 -1
  418. package/node_modules/uuid/dist/cjs-browser/v5.d.ts +1 -1
  419. package/node_modules/uuid/dist/cjs-browser/v6.d.ts +1 -1
  420. package/node_modules/uuid/dist/cjs-browser/v7.d.ts +1 -1
  421. package/node_modules/uuid/dist/cjs-browser/v7.js +1 -1
  422. package/node_modules/uuid/dist/esm/types.d.ts +1 -1
  423. package/node_modules/uuid/dist/esm/v1.d.ts +1 -1
  424. package/node_modules/uuid/dist/esm/v1.js +1 -1
  425. package/node_modules/uuid/dist/esm/v3.d.ts +1 -1
  426. package/node_modules/uuid/dist/esm/v35.d.ts +1 -1
  427. package/node_modules/uuid/dist/esm/v4.d.ts +1 -1
  428. package/node_modules/uuid/dist/esm/v5.d.ts +1 -1
  429. package/node_modules/uuid/dist/esm/v6.d.ts +1 -1
  430. package/node_modules/uuid/dist/esm/v7.d.ts +1 -1
  431. package/node_modules/uuid/dist/esm/v7.js +1 -1
  432. package/node_modules/uuid/dist/esm-browser/types.d.ts +1 -1
  433. package/node_modules/uuid/dist/esm-browser/v1.d.ts +1 -1
  434. package/node_modules/uuid/dist/esm-browser/v1.js +1 -1
  435. package/node_modules/uuid/dist/esm-browser/v3.d.ts +1 -1
  436. package/node_modules/uuid/dist/esm-browser/v35.d.ts +1 -1
  437. package/node_modules/uuid/dist/esm-browser/v4.d.ts +1 -1
  438. package/node_modules/uuid/dist/esm-browser/v5.d.ts +1 -1
  439. package/node_modules/uuid/dist/esm-browser/v6.d.ts +1 -1
  440. package/node_modules/uuid/dist/esm-browser/v7.d.ts +1 -1
  441. package/node_modules/uuid/dist/esm-browser/v7.js +1 -1
  442. package/node_modules/uuid/package.json +1 -1
  443. package/package.json +7 -7
  444. package/tak-registration.html +4 -4
  445. package/tak-registration.js +13 -6
  446. package/node_modules/axios/SECURITY.md +0 -6
  447. /package/node_modules/fast-xml-parser/src/{v5 → v6}/Report.js +0 -0
@@ -1,1432 +1,1622 @@
1
1
  // GENERATED FILE. DO NOT EDIT.
2
- var Long = (function(exports) {
3
- "use strict";
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
-
10
- /**
11
- * @license
12
- * Copyright 2009 The Closure Library Authors
13
- * Copyright 2020 Daniel Wirtz / The long.js Authors.
14
- *
15
- * Licensed under the Apache License, Version 2.0 (the "License");
16
- * you may not use this file except in compliance with the License.
17
- * You may obtain a copy of the License at
18
- *
19
- * http://www.apache.org/licenses/LICENSE-2.0
20
- *
21
- * Unless required by applicable law or agreed to in writing, software
22
- * distributed under the License is distributed on an "AS IS" BASIS,
23
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24
- * See the License for the specific language governing permissions and
25
- * limitations under the License.
26
- *
27
- * SPDX-License-Identifier: Apache-2.0
28
- */
29
- // WebAssembly optimizations to do native i64 multiplication and divide
30
- var wasm = null;
31
-
32
- try {
33
- wasm = new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 13, 2, 96, 0, 1, 127, 96, 4, 127, 127, 127, 127, 1, 127, 3, 7, 6, 0, 1, 1, 1, 1, 1, 6, 6, 1, 127, 1, 65, 0, 11, 7, 50, 6, 3, 109, 117, 108, 0, 1, 5, 100, 105, 118, 95, 115, 0, 2, 5, 100, 105, 118, 95, 117, 0, 3, 5, 114, 101, 109, 95, 115, 0, 4, 5, 114, 101, 109, 95, 117, 0, 5, 8, 103, 101, 116, 95, 104, 105, 103, 104, 0, 0, 10, 191, 1, 6, 4, 0, 35, 0, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 126, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 127, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 128, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 129, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 130, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11])), {}).exports;
34
- } catch (e) {// no wasm support :(
2
+ (function (global, factory) {
3
+ function preferDefault(exports) {
4
+ return exports.default || exports;
35
5
  }
36
- /**
37
- * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers.
38
- * See the from* functions below for more convenient ways of constructing Longs.
39
- * @exports Long
40
- * @class A Long class for representing a 64 bit two's-complement integer value.
41
- * @param {number} low The low (signed) 32 bits of the long
42
- * @param {number} high The high (signed) 32 bits of the long
43
- * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
44
- * @constructor
45
- */
46
-
47
-
48
- function Long(low, high, unsigned) {
49
- /**
50
- * The low 32 bits as a signed value.
51
- * @type {number}
6
+ if (typeof define === "function" && define.amd) {
7
+ define([], function () {
8
+ var exports = {};
9
+ factory(exports);
10
+ return preferDefault(exports);
11
+ });
12
+ } else if (typeof exports === "object") {
13
+ factory(exports);
14
+ if (typeof module === "object") module.exports = preferDefault(exports);
15
+ } else {
16
+ (function () {
17
+ var exports = {};
18
+ factory(exports);
19
+ global.Long = preferDefault(exports);
20
+ })();
21
+ }
22
+ })(
23
+ typeof globalThis !== "undefined"
24
+ ? globalThis
25
+ : typeof self !== "undefined"
26
+ ? self
27
+ : this,
28
+ function (_exports) {
29
+ "use strict";
30
+
31
+ Object.defineProperty(_exports, "__esModule", {
32
+ value: true,
33
+ });
34
+ _exports.default = void 0;
35
+ /**
36
+ * @license
37
+ * Copyright 2009 The Closure Library Authors
38
+ * Copyright 2020 Daniel Wirtz / The long.js Authors.
39
+ *
40
+ * Licensed under the Apache License, Version 2.0 (the "License");
41
+ * you may not use this file except in compliance with the License.
42
+ * You may obtain a copy of the License at
43
+ *
44
+ * http://www.apache.org/licenses/LICENSE-2.0
45
+ *
46
+ * Unless required by applicable law or agreed to in writing, software
47
+ * distributed under the License is distributed on an "AS IS" BASIS,
48
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
49
+ * See the License for the specific language governing permissions and
50
+ * limitations under the License.
51
+ *
52
+ * SPDX-License-Identifier: Apache-2.0
52
53
  */
53
- this.low = low | 0;
54
+
55
+ // WebAssembly optimizations to do native i64 multiplication and divide
56
+ var wasm = null;
57
+ try {
58
+ wasm = new WebAssembly.Instance(
59
+ new WebAssembly.Module(
60
+ new Uint8Array([
61
+ // \0asm
62
+ 0, 97, 115, 109,
63
+ // version 1
64
+ 1, 0, 0, 0,
65
+ // section "type"
66
+ 1, 13, 2,
67
+ // 0, () => i32
68
+ 96, 0, 1, 127,
69
+ // 1, (i32, i32, i32, i32) => i32
70
+ 96, 4, 127, 127, 127, 127, 1, 127,
71
+ // section "function"
72
+ 3, 7, 6,
73
+ // 0, type 0
74
+ 0,
75
+ // 1, type 1
76
+ 1,
77
+ // 2, type 1
78
+ 1,
79
+ // 3, type 1
80
+ 1,
81
+ // 4, type 1
82
+ 1,
83
+ // 5, type 1
84
+ 1,
85
+ // section "global"
86
+ 6, 6, 1,
87
+ // 0, "high", mutable i32
88
+ 127, 1, 65, 0, 11,
89
+ // section "export"
90
+ 7, 50, 6,
91
+ // 0, "mul"
92
+ 3, 109, 117, 108, 0, 1,
93
+ // 1, "div_s"
94
+ 5, 100, 105, 118, 95, 115, 0, 2,
95
+ // 2, "div_u"
96
+ 5, 100, 105, 118, 95, 117, 0, 3,
97
+ // 3, "rem_s"
98
+ 5, 114, 101, 109, 95, 115, 0, 4,
99
+ // 4, "rem_u"
100
+ 5, 114, 101, 109, 95, 117, 0, 5,
101
+ // 5, "get_high"
102
+ 8, 103, 101, 116, 95, 104, 105, 103, 104, 0, 0,
103
+ // section "code"
104
+ 10, 191, 1, 6,
105
+ // 0, "get_high"
106
+ 4, 0, 35, 0, 11,
107
+ // 1, "mul"
108
+ 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173,
109
+ 32, 3, 173, 66, 32, 134, 132, 126, 34, 4, 66, 32, 135, 167, 36, 0,
110
+ 32, 4, 167, 11,
111
+ // 2, "div_s"
112
+ 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173,
113
+ 32, 3, 173, 66, 32, 134, 132, 127, 34, 4, 66, 32, 135, 167, 36, 0,
114
+ 32, 4, 167, 11,
115
+ // 3, "div_u"
116
+ 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173,
117
+ 32, 3, 173, 66, 32, 134, 132, 128, 34, 4, 66, 32, 135, 167, 36, 0,
118
+ 32, 4, 167, 11,
119
+ // 4, "rem_s"
120
+ 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173,
121
+ 32, 3, 173, 66, 32, 134, 132, 129, 34, 4, 66, 32, 135, 167, 36, 0,
122
+ 32, 4, 167, 11,
123
+ // 5, "rem_u"
124
+ 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173,
125
+ 32, 3, 173, 66, 32, 134, 132, 130, 34, 4, 66, 32, 135, 167, 36, 0,
126
+ 32, 4, 167, 11,
127
+ ]),
128
+ ),
129
+ {},
130
+ ).exports;
131
+ } catch {
132
+ // no wasm support :(
133
+ }
134
+
54
135
  /**
55
- * The high 32 bits as a signed value.
56
- * @type {number}
136
+ * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers.
137
+ * See the from* functions below for more convenient ways of constructing Longs.
138
+ * @exports Long
139
+ * @class A Long class for representing a 64 bit two's-complement integer value.
140
+ * @param {number} low The low (signed) 32 bits of the long
141
+ * @param {number} high The high (signed) 32 bits of the long
142
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
143
+ * @constructor
57
144
  */
58
-
59
- this.high = high | 0;
145
+ function Long(low, high, unsigned) {
146
+ /**
147
+ * The low 32 bits as a signed value.
148
+ * @type {number}
149
+ */
150
+ this.low = low | 0;
151
+
152
+ /**
153
+ * The high 32 bits as a signed value.
154
+ * @type {number}
155
+ */
156
+ this.high = high | 0;
157
+
158
+ /**
159
+ * Whether unsigned or not.
160
+ * @type {boolean}
161
+ */
162
+ this.unsigned = !!unsigned;
163
+ }
164
+
165
+ // The internal representation of a long is the two given signed, 32-bit values.
166
+ // We use 32-bit pieces because these are the size of integers on which
167
+ // Javascript performs bit-operations. For operations like addition and
168
+ // multiplication, we split each number into 16 bit pieces, which can easily be
169
+ // multiplied within Javascript's floating-point representation without overflow
170
+ // or change in sign.
171
+ //
172
+ // In the algorithms below, we frequently reduce the negative case to the
173
+ // positive case by negating the input(s) and then post-processing the result.
174
+ // Note that we must ALWAYS check specially whether those values are MIN_VALUE
175
+ // (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as
176
+ // a positive number, it overflows back into a negative). Not handling this
177
+ // case would often result in infinite recursion.
178
+ //
179
+ // Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the from*
180
+ // methods on which they depend.
181
+
60
182
  /**
61
- * Whether unsigned or not.
183
+ * An indicator used to reliably determine if an object is a Long or not.
62
184
  * @type {boolean}
185
+ * @const
186
+ * @private
63
187
  */
64
-
65
- this.unsigned = !!unsigned;
66
- } // The internal representation of a long is the two given signed, 32-bit values.
67
- // We use 32-bit pieces because these are the size of integers on which
68
- // Javascript performs bit-operations. For operations like addition and
69
- // multiplication, we split each number into 16 bit pieces, which can easily be
70
- // multiplied within Javascript's floating-point representation without overflow
71
- // or change in sign.
72
- //
73
- // In the algorithms below, we frequently reduce the negative case to the
74
- // positive case by negating the input(s) and then post-processing the result.
75
- // Note that we must ALWAYS check specially whether those values are MIN_VALUE
76
- // (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as
77
- // a positive number, it overflows back into a negative). Not handling this
78
- // case would often result in infinite recursion.
79
- //
80
- // Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the from*
81
- // methods on which they depend.
82
-
83
- /**
84
- * An indicator used to reliably determine if an object is a Long or not.
85
- * @type {boolean}
86
- * @const
87
- * @private
88
- */
89
-
90
-
91
- Long.prototype.__isLong__;
92
- Object.defineProperty(Long.prototype, "__isLong__", {
93
- value: true
94
- });
95
- /**
96
- * @function
97
- * @param {*} obj Object
98
- * @returns {boolean}
99
- * @inner
100
- */
101
-
102
- function isLong(obj) {
103
- return (obj && obj["__isLong__"]) === true;
104
- }
105
- /**
106
- * @function
107
- * @param {*} value number
108
- * @returns {number}
109
- * @inner
110
- */
111
-
112
-
113
- function ctz32(value) {
114
- var c = Math.clz32(value & -value);
115
- return value ? 31 - c : c;
116
- }
117
- /**
118
- * Tests if the specified object is a Long.
119
- * @function
120
- * @param {*} obj Object
121
- * @returns {boolean}
122
- */
123
-
124
-
125
- Long.isLong = isLong;
126
- /**
127
- * A cache of the Long representations of small integer values.
128
- * @type {!Object}
129
- * @inner
130
- */
131
-
132
- var INT_CACHE = {};
133
- /**
134
- * A cache of the Long representations of small unsigned integer values.
135
- * @type {!Object}
136
- * @inner
137
- */
138
-
139
- var UINT_CACHE = {};
140
- /**
141
- * @param {number} value
142
- * @param {boolean=} unsigned
143
- * @returns {!Long}
144
- * @inner
145
- */
146
-
147
- function fromInt(value, unsigned) {
148
- var obj, cachedObj, cache;
149
-
150
- if (unsigned) {
151
- value >>>= 0;
152
-
153
- if (cache = 0 <= value && value < 256) {
154
- cachedObj = UINT_CACHE[value];
155
- if (cachedObj) return cachedObj;
156
- }
157
-
158
- obj = fromBits(value, 0, true);
159
- if (cache) UINT_CACHE[value] = obj;
160
- return obj;
161
- } else {
162
- value |= 0;
163
-
164
- if (cache = -128 <= value && value < 128) {
165
- cachedObj = INT_CACHE[value];
166
- if (cachedObj) return cachedObj;
188
+ Long.prototype.__isLong__;
189
+ Object.defineProperty(Long.prototype, "__isLong__", {
190
+ value: true,
191
+ });
192
+
193
+ /**
194
+ * @function
195
+ * @param {*} obj Object
196
+ * @returns {boolean}
197
+ * @inner
198
+ */
199
+ function isLong(obj) {
200
+ return (obj && obj["__isLong__"]) === true;
201
+ }
202
+
203
+ /**
204
+ * @function
205
+ * @param {*} value number
206
+ * @returns {number}
207
+ * @inner
208
+ */
209
+ function ctz32(value) {
210
+ var c = Math.clz32(value & -value);
211
+ return value ? 31 - c : c;
212
+ }
213
+
214
+ /**
215
+ * Tests if the specified object is a Long.
216
+ * @function
217
+ * @param {*} obj Object
218
+ * @returns {boolean}
219
+ */
220
+ Long.isLong = isLong;
221
+
222
+ /**
223
+ * A cache of the Long representations of small integer values.
224
+ * @type {!Object}
225
+ * @inner
226
+ */
227
+ var INT_CACHE = {};
228
+
229
+ /**
230
+ * A cache of the Long representations of small unsigned integer values.
231
+ * @type {!Object}
232
+ * @inner
233
+ */
234
+ var UINT_CACHE = {};
235
+
236
+ /**
237
+ * @param {number} value
238
+ * @param {boolean=} unsigned
239
+ * @returns {!Long}
240
+ * @inner
241
+ */
242
+ function fromInt(value, unsigned) {
243
+ var obj, cachedObj, cache;
244
+ if (unsigned) {
245
+ value >>>= 0;
246
+ if ((cache = 0 <= value && value < 256)) {
247
+ cachedObj = UINT_CACHE[value];
248
+ if (cachedObj) return cachedObj;
249
+ }
250
+ obj = fromBits(value, 0, true);
251
+ if (cache) UINT_CACHE[value] = obj;
252
+ return obj;
253
+ } else {
254
+ value |= 0;
255
+ if ((cache = -128 <= value && value < 128)) {
256
+ cachedObj = INT_CACHE[value];
257
+ if (cachedObj) return cachedObj;
258
+ }
259
+ obj = fromBits(value, value < 0 ? -1 : 0, false);
260
+ if (cache) INT_CACHE[value] = obj;
261
+ return obj;
167
262
  }
168
-
169
- obj = fromBits(value, value < 0 ? -1 : 0, false);
170
- if (cache) INT_CACHE[value] = obj;
171
- return obj;
172
263
  }
173
- }
174
- /**
175
- * Returns a Long representing the given 32 bit integer value.
176
- * @function
177
- * @param {number} value The 32 bit integer in question
178
- * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
179
- * @returns {!Long} The corresponding Long value
180
- */
181
-
182
-
183
- Long.fromInt = fromInt;
184
- /**
185
- * @param {number} value
186
- * @param {boolean=} unsigned
187
- * @returns {!Long}
188
- * @inner
189
- */
190
-
191
- function fromNumber(value, unsigned) {
192
- if (isNaN(value)) return unsigned ? UZERO : ZERO;
193
-
194
- if (unsigned) {
195
- if (value < 0) return UZERO;
196
- if (value >= TWO_PWR_64_DBL) return MAX_UNSIGNED_VALUE;
197
- } else {
198
- if (value <= -TWO_PWR_63_DBL) return MIN_VALUE;
199
- if (value + 1 >= TWO_PWR_63_DBL) return MAX_VALUE;
264
+
265
+ /**
266
+ * Returns a Long representing the given 32 bit integer value.
267
+ * @function
268
+ * @param {number} value The 32 bit integer in question
269
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
270
+ * @returns {!Long} The corresponding Long value
271
+ */
272
+ Long.fromInt = fromInt;
273
+
274
+ /**
275
+ * @param {number} value
276
+ * @param {boolean=} unsigned
277
+ * @returns {!Long}
278
+ * @inner
279
+ */
280
+ function fromNumber(value, unsigned) {
281
+ if (isNaN(value)) return unsigned ? UZERO : ZERO;
282
+ if (unsigned) {
283
+ if (value < 0) return UZERO;
284
+ if (value >= TWO_PWR_64_DBL) return MAX_UNSIGNED_VALUE;
285
+ } else {
286
+ if (value <= -TWO_PWR_63_DBL) return MIN_VALUE;
287
+ if (value + 1 >= TWO_PWR_63_DBL) return MAX_VALUE;
288
+ }
289
+ if (value < 0) return fromNumber(-value, unsigned).neg();
290
+ return fromBits(
291
+ value % TWO_PWR_32_DBL | 0,
292
+ (value / TWO_PWR_32_DBL) | 0,
293
+ unsigned,
294
+ );
200
295
  }
201
-
202
- if (value < 0) return fromNumber(-value, unsigned).neg();
203
- return fromBits(value % TWO_PWR_32_DBL | 0, value / TWO_PWR_32_DBL | 0, unsigned);
204
- }
205
- /**
206
- * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.
207
- * @function
208
- * @param {number} value The number in question
209
- * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
210
- * @returns {!Long} The corresponding Long value
211
- */
212
-
213
-
214
- Long.fromNumber = fromNumber;
215
- /**
216
- * @param {number} lowBits
217
- * @param {number} highBits
218
- * @param {boolean=} unsigned
219
- * @returns {!Long}
220
- * @inner
221
- */
222
-
223
- function fromBits(lowBits, highBits, unsigned) {
224
- return new Long(lowBits, highBits, unsigned);
225
- }
226
- /**
227
- * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is
228
- * assumed to use 32 bits.
229
- * @function
230
- * @param {number} lowBits The low 32 bits
231
- * @param {number} highBits The high 32 bits
232
- * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
233
- * @returns {!Long} The corresponding Long value
234
- */
235
-
236
-
237
- Long.fromBits = fromBits;
238
- /**
239
- * @function
240
- * @param {number} base
241
- * @param {number} exponent
242
- * @returns {number}
243
- * @inner
244
- */
245
-
246
- var pow_dbl = Math.pow; // Used 4 times (4*8 to 15+4)
247
-
248
- /**
249
- * @param {string} str
250
- * @param {(boolean|number)=} unsigned
251
- * @param {number=} radix
252
- * @returns {!Long}
253
- * @inner
254
- */
255
-
256
- function fromString(str, unsigned, radix) {
257
- if (str.length === 0) throw Error('empty string');
258
-
259
- if (typeof unsigned === 'number') {
260
- // For goog.math.long compatibility
261
- radix = unsigned;
262
- unsigned = false;
263
- } else {
264
- unsigned = !!unsigned;
296
+
297
+ /**
298
+ * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.
299
+ * @function
300
+ * @param {number} value The number in question
301
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
302
+ * @returns {!Long} The corresponding Long value
303
+ */
304
+ Long.fromNumber = fromNumber;
305
+
306
+ /**
307
+ * @param {number} lowBits
308
+ * @param {number} highBits
309
+ * @param {boolean=} unsigned
310
+ * @returns {!Long}
311
+ * @inner
312
+ */
313
+ function fromBits(lowBits, highBits, unsigned) {
314
+ return new Long(lowBits, highBits, unsigned);
265
315
  }
266
-
267
- if (str === "NaN" || str === "Infinity" || str === "+Infinity" || str === "-Infinity") return unsigned ? UZERO : ZERO;
268
- radix = radix || 10;
269
- if (radix < 2 || 36 < radix) throw RangeError('radix');
270
- var p;
271
- if ((p = str.indexOf('-')) > 0) throw Error('interior hyphen');else if (p === 0) {
272
- return fromString(str.substring(1), unsigned, radix).neg();
273
- } // Do several (8) digits each time through the loop, so as to
274
- // minimize the calls to the very expensive emulated div.
275
-
276
- var radixToPower = fromNumber(pow_dbl(radix, 8));
277
- var result = ZERO;
278
-
279
- for (var i = 0; i < str.length; i += 8) {
280
- var size = Math.min(8, str.length - i),
281
- value = parseInt(str.substring(i, i + size), radix);
282
-
283
- if (size < 8) {
284
- var power = fromNumber(pow_dbl(radix, size));
285
- result = result.mul(power).add(fromNumber(value));
316
+
317
+ /**
318
+ * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is
319
+ * assumed to use 32 bits.
320
+ * @function
321
+ * @param {number} lowBits The low 32 bits
322
+ * @param {number} highBits The high 32 bits
323
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
324
+ * @returns {!Long} The corresponding Long value
325
+ */
326
+ Long.fromBits = fromBits;
327
+
328
+ /**
329
+ * @function
330
+ * @param {number} base
331
+ * @param {number} exponent
332
+ * @returns {number}
333
+ * @inner
334
+ */
335
+ var pow_dbl = Math.pow; // Used 4 times (4*8 to 15+4)
336
+
337
+ /**
338
+ * @param {string} str
339
+ * @param {(boolean|number)=} unsigned
340
+ * @param {number=} radix
341
+ * @returns {!Long}
342
+ * @inner
343
+ */
344
+ function fromString(str, unsigned, radix) {
345
+ if (str.length === 0) throw Error("empty string");
346
+ if (typeof unsigned === "number") {
347
+ // For goog.math.long compatibility
348
+ radix = unsigned;
349
+ unsigned = false;
286
350
  } else {
287
- result = result.mul(radixToPower);
288
- result = result.add(fromNumber(value));
351
+ unsigned = !!unsigned;
352
+ }
353
+ if (
354
+ str === "NaN" ||
355
+ str === "Infinity" ||
356
+ str === "+Infinity" ||
357
+ str === "-Infinity"
358
+ )
359
+ return unsigned ? UZERO : ZERO;
360
+ radix = radix || 10;
361
+ if (radix < 2 || 36 < radix) throw RangeError("radix");
362
+ var p;
363
+ if ((p = str.indexOf("-")) > 0) throw Error("interior hyphen");
364
+ else if (p === 0) {
365
+ return fromString(str.substring(1), unsigned, radix).neg();
366
+ }
367
+
368
+ // Do several (8) digits each time through the loop, so as to
369
+ // minimize the calls to the very expensive emulated div.
370
+ var radixToPower = fromNumber(pow_dbl(radix, 8));
371
+ var result = ZERO;
372
+ for (var i = 0; i < str.length; i += 8) {
373
+ var size = Math.min(8, str.length - i),
374
+ value = parseInt(str.substring(i, i + size), radix);
375
+ if (size < 8) {
376
+ var power = fromNumber(pow_dbl(radix, size));
377
+ result = result.mul(power).add(fromNumber(value));
378
+ } else {
379
+ result = result.mul(radixToPower);
380
+ result = result.add(fromNumber(value));
381
+ }
289
382
  }
383
+ result.unsigned = unsigned;
384
+ return result;
290
385
  }
291
-
292
- result.unsigned = unsigned;
293
- return result;
294
- }
295
- /**
296
- * Returns a Long representation of the given string, written using the specified radix.
297
- * @function
298
- * @param {string} str The textual representation of the Long
299
- * @param {(boolean|number)=} unsigned Whether unsigned or not, defaults to signed
300
- * @param {number=} radix The radix in which the text is written (2-36), defaults to 10
301
- * @returns {!Long} The corresponding Long value
302
- */
303
-
304
-
305
- Long.fromString = fromString;
306
- /**
307
- * @function
308
- * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val
309
- * @param {boolean=} unsigned
310
- * @returns {!Long}
311
- * @inner
312
- */
313
-
314
- function fromValue(val, unsigned) {
315
- if (typeof val === 'number') return fromNumber(val, unsigned);
316
- if (typeof val === 'string') return fromString(val, unsigned); // Throws for non-objects, converts non-instanceof Long:
317
-
318
- return fromBits(val.low, val.high, typeof unsigned === 'boolean' ? unsigned : val.unsigned);
319
- }
320
- /**
321
- * Converts the specified value to a Long using the appropriate from* function for its type.
322
- * @function
323
- * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val Value
324
- * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
325
- * @returns {!Long}
326
- */
327
-
328
-
329
- Long.fromValue = fromValue; // NOTE: the compiler should inline these constant values below and then remove these variables, so there should be
330
- // no runtime penalty for these.
331
-
332
- /**
333
- * @type {number}
334
- * @const
335
- * @inner
336
- */
337
-
338
- var TWO_PWR_16_DBL = 1 << 16;
339
- /**
340
- * @type {number}
341
- * @const
342
- * @inner
343
- */
344
-
345
- var TWO_PWR_24_DBL = 1 << 24;
346
- /**
347
- * @type {number}
348
- * @const
349
- * @inner
350
- */
351
-
352
- var TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL;
353
- /**
354
- * @type {number}
355
- * @const
356
- * @inner
357
- */
358
-
359
- var TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL;
360
- /**
361
- * @type {number}
362
- * @const
363
- * @inner
364
- */
365
-
366
- var TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2;
367
- /**
368
- * @type {!Long}
369
- * @const
370
- * @inner
371
- */
372
-
373
- var TWO_PWR_24 = fromInt(TWO_PWR_24_DBL);
374
- /**
375
- * @type {!Long}
376
- * @inner
377
- */
378
-
379
- var ZERO = fromInt(0);
380
- /**
381
- * Signed zero.
382
- * @type {!Long}
383
- */
384
-
385
- Long.ZERO = ZERO;
386
- /**
387
- * @type {!Long}
388
- * @inner
389
- */
390
-
391
- var UZERO = fromInt(0, true);
392
- /**
393
- * Unsigned zero.
394
- * @type {!Long}
395
- */
396
-
397
- Long.UZERO = UZERO;
398
- /**
399
- * @type {!Long}
400
- * @inner
401
- */
402
-
403
- var ONE = fromInt(1);
404
- /**
405
- * Signed one.
406
- * @type {!Long}
407
- */
408
-
409
- Long.ONE = ONE;
410
- /**
411
- * @type {!Long}
412
- * @inner
413
- */
414
-
415
- var UONE = fromInt(1, true);
416
- /**
417
- * Unsigned one.
418
- * @type {!Long}
419
- */
420
-
421
- Long.UONE = UONE;
422
- /**
423
- * @type {!Long}
424
- * @inner
425
- */
426
-
427
- var NEG_ONE = fromInt(-1);
428
- /**
429
- * Signed negative one.
430
- * @type {!Long}
431
- */
432
-
433
- Long.NEG_ONE = NEG_ONE;
434
- /**
435
- * @type {!Long}
436
- * @inner
437
- */
438
-
439
- var MAX_VALUE = fromBits(0xFFFFFFFF | 0, 0x7FFFFFFF | 0, false);
440
- /**
441
- * Maximum signed value.
442
- * @type {!Long}
443
- */
444
-
445
- Long.MAX_VALUE = MAX_VALUE;
446
- /**
447
- * @type {!Long}
448
- * @inner
449
- */
450
-
451
- var MAX_UNSIGNED_VALUE = fromBits(0xFFFFFFFF | 0, 0xFFFFFFFF | 0, true);
452
- /**
453
- * Maximum unsigned value.
454
- * @type {!Long}
455
- */
456
-
457
- Long.MAX_UNSIGNED_VALUE = MAX_UNSIGNED_VALUE;
458
- /**
459
- * @type {!Long}
460
- * @inner
461
- */
462
-
463
- var MIN_VALUE = fromBits(0, 0x80000000 | 0, false);
464
- /**
465
- * Minimum signed value.
466
- * @type {!Long}
467
- */
468
-
469
- Long.MIN_VALUE = MIN_VALUE;
470
- /**
471
- * @alias Long.prototype
472
- * @inner
473
- */
474
-
475
- var LongPrototype = Long.prototype;
476
- /**
477
- * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.
478
- * @this {!Long}
479
- * @returns {number}
480
- */
481
-
482
- LongPrototype.toInt = function toInt() {
483
- return this.unsigned ? this.low >>> 0 : this.low;
484
- };
485
- /**
486
- * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).
487
- * @this {!Long}
488
- * @returns {number}
489
- */
490
-
491
-
492
- LongPrototype.toNumber = function toNumber() {
493
- if (this.unsigned) return (this.high >>> 0) * TWO_PWR_32_DBL + (this.low >>> 0);
494
- return this.high * TWO_PWR_32_DBL + (this.low >>> 0);
495
- };
496
- /**
497
- * Converts the Long to a string written in the specified radix.
498
- * @this {!Long}
499
- * @param {number=} radix Radix (2-36), defaults to 10
500
- * @returns {string}
501
- * @override
502
- * @throws {RangeError} If `radix` is out of range
503
- */
504
-
505
-
506
- LongPrototype.toString = function toString(radix) {
507
- radix = radix || 10;
508
- if (radix < 2 || 36 < radix) throw RangeError('radix');
509
- if (this.isZero()) return '0';
510
-
511
- if (this.isNegative()) {
512
- // Unsigned Longs are never negative
513
- if (this.eq(MIN_VALUE)) {
514
- // We need to change the Long value before it can be negated, so we remove
515
- // the bottom-most digit in this base and then recurse to do the rest.
516
- var radixLong = fromNumber(radix),
386
+
387
+ /**
388
+ * Returns a Long representation of the given string, written using the specified radix.
389
+ * @function
390
+ * @param {string} str The textual representation of the Long
391
+ * @param {(boolean|number)=} unsigned Whether unsigned or not, defaults to signed
392
+ * @param {number=} radix The radix in which the text is written (2-36), defaults to 10
393
+ * @returns {!Long} The corresponding Long value
394
+ */
395
+ Long.fromString = fromString;
396
+
397
+ /**
398
+ * @function
399
+ * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val
400
+ * @param {boolean=} unsigned
401
+ * @returns {!Long}
402
+ * @inner
403
+ */
404
+ function fromValue(val, unsigned) {
405
+ if (typeof val === "number") return fromNumber(val, unsigned);
406
+ if (typeof val === "string") return fromString(val, unsigned);
407
+ // Throws for non-objects, converts non-instanceof Long:
408
+ return fromBits(
409
+ val.low,
410
+ val.high,
411
+ typeof unsigned === "boolean" ? unsigned : val.unsigned,
412
+ );
413
+ }
414
+
415
+ /**
416
+ * Converts the specified value to a Long using the appropriate from* function for its type.
417
+ * @function
418
+ * @param {!Long|number|bigint|string|!{low: number, high: number, unsigned: boolean}} val Value
419
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
420
+ * @returns {!Long}
421
+ */
422
+ Long.fromValue = fromValue;
423
+
424
+ // NOTE: the compiler should inline these constant values below and then remove these variables, so there should be
425
+ // no runtime penalty for these.
426
+
427
+ /**
428
+ * @type {number}
429
+ * @const
430
+ * @inner
431
+ */
432
+ var TWO_PWR_16_DBL = 1 << 16;
433
+
434
+ /**
435
+ * @type {number}
436
+ * @const
437
+ * @inner
438
+ */
439
+ var TWO_PWR_24_DBL = 1 << 24;
440
+
441
+ /**
442
+ * @type {number}
443
+ * @const
444
+ * @inner
445
+ */
446
+ var TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL;
447
+
448
+ /**
449
+ * @type {number}
450
+ * @const
451
+ * @inner
452
+ */
453
+ var TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL;
454
+
455
+ /**
456
+ * @type {number}
457
+ * @const
458
+ * @inner
459
+ */
460
+ var TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2;
461
+
462
+ /**
463
+ * @type {!Long}
464
+ * @const
465
+ * @inner
466
+ */
467
+ var TWO_PWR_24 = fromInt(TWO_PWR_24_DBL);
468
+
469
+ /**
470
+ * @type {!Long}
471
+ * @inner
472
+ */
473
+ var ZERO = fromInt(0);
474
+
475
+ /**
476
+ * Signed zero.
477
+ * @type {!Long}
478
+ */
479
+ Long.ZERO = ZERO;
480
+
481
+ /**
482
+ * @type {!Long}
483
+ * @inner
484
+ */
485
+ var UZERO = fromInt(0, true);
486
+
487
+ /**
488
+ * Unsigned zero.
489
+ * @type {!Long}
490
+ */
491
+ Long.UZERO = UZERO;
492
+
493
+ /**
494
+ * @type {!Long}
495
+ * @inner
496
+ */
497
+ var ONE = fromInt(1);
498
+
499
+ /**
500
+ * Signed one.
501
+ * @type {!Long}
502
+ */
503
+ Long.ONE = ONE;
504
+
505
+ /**
506
+ * @type {!Long}
507
+ * @inner
508
+ */
509
+ var UONE = fromInt(1, true);
510
+
511
+ /**
512
+ * Unsigned one.
513
+ * @type {!Long}
514
+ */
515
+ Long.UONE = UONE;
516
+
517
+ /**
518
+ * @type {!Long}
519
+ * @inner
520
+ */
521
+ var NEG_ONE = fromInt(-1);
522
+
523
+ /**
524
+ * Signed negative one.
525
+ * @type {!Long}
526
+ */
527
+ Long.NEG_ONE = NEG_ONE;
528
+
529
+ /**
530
+ * @type {!Long}
531
+ * @inner
532
+ */
533
+ var MAX_VALUE = fromBits(0xffffffff | 0, 0x7fffffff | 0, false);
534
+
535
+ /**
536
+ * Maximum signed value.
537
+ * @type {!Long}
538
+ */
539
+ Long.MAX_VALUE = MAX_VALUE;
540
+
541
+ /**
542
+ * @type {!Long}
543
+ * @inner
544
+ */
545
+ var MAX_UNSIGNED_VALUE = fromBits(0xffffffff | 0, 0xffffffff | 0, true);
546
+
547
+ /**
548
+ * Maximum unsigned value.
549
+ * @type {!Long}
550
+ */
551
+ Long.MAX_UNSIGNED_VALUE = MAX_UNSIGNED_VALUE;
552
+
553
+ /**
554
+ * @type {!Long}
555
+ * @inner
556
+ */
557
+ var MIN_VALUE = fromBits(0, 0x80000000 | 0, false);
558
+
559
+ /**
560
+ * Minimum signed value.
561
+ * @type {!Long}
562
+ */
563
+ Long.MIN_VALUE = MIN_VALUE;
564
+
565
+ /**
566
+ * @alias Long.prototype
567
+ * @inner
568
+ */
569
+ var LongPrototype = Long.prototype;
570
+
571
+ /**
572
+ * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.
573
+ * @this {!Long}
574
+ * @returns {number}
575
+ */
576
+ LongPrototype.toInt = function toInt() {
577
+ return this.unsigned ? this.low >>> 0 : this.low;
578
+ };
579
+
580
+ /**
581
+ * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).
582
+ * @this {!Long}
583
+ * @returns {number}
584
+ */
585
+ LongPrototype.toNumber = function toNumber() {
586
+ if (this.unsigned)
587
+ return (this.high >>> 0) * TWO_PWR_32_DBL + (this.low >>> 0);
588
+ return this.high * TWO_PWR_32_DBL + (this.low >>> 0);
589
+ };
590
+
591
+ /**
592
+ * Converts the Long to a string written in the specified radix.
593
+ * @this {!Long}
594
+ * @param {number=} radix Radix (2-36), defaults to 10
595
+ * @returns {string}
596
+ * @override
597
+ * @throws {RangeError} If `radix` is out of range
598
+ */
599
+ LongPrototype.toString = function toString(radix) {
600
+ radix = radix || 10;
601
+ if (radix < 2 || 36 < radix) throw RangeError("radix");
602
+ if (this.isZero()) return "0";
603
+ if (this.isNegative()) {
604
+ // Unsigned Longs are never negative
605
+ if (this.eq(MIN_VALUE)) {
606
+ // We need to change the Long value before it can be negated, so we remove
607
+ // the bottom-most digit in this base and then recurse to do the rest.
608
+ var radixLong = fromNumber(radix),
517
609
  div = this.div(radixLong),
518
610
  rem1 = div.mul(radixLong).sub(this);
519
- return div.toString(radix) + rem1.toInt().toString(radix);
520
- } else return '-' + this.neg().toString(radix);
521
- } // Do several (6) digits each time through the loop, so as to
522
- // minimize the calls to the very expensive emulated div.
523
-
524
-
525
- var radixToPower = fromNumber(pow_dbl(radix, 6), this.unsigned),
611
+ return div.toString(radix) + rem1.toInt().toString(radix);
612
+ } else return "-" + this.neg().toString(radix);
613
+ }
614
+
615
+ // Do several (6) digits each time through the loop, so as to
616
+ // minimize the calls to the very expensive emulated div.
617
+ var radixToPower = fromNumber(pow_dbl(radix, 6), this.unsigned),
526
618
  rem = this;
527
- var result = '';
528
-
529
- while (true) {
530
- var remDiv = rem.div(radixToPower),
619
+ var result = "";
620
+ while (true) {
621
+ var remDiv = rem.div(radixToPower),
531
622
  intval = rem.sub(remDiv.mul(radixToPower)).toInt() >>> 0,
532
623
  digits = intval.toString(radix);
533
- rem = remDiv;
534
- if (rem.isZero()) return digits + result;else {
535
- while (digits.length < 6) digits = '0' + digits;
536
-
537
- result = '' + digits + result;
624
+ rem = remDiv;
625
+ if (rem.isZero()) return digits + result;
626
+ else {
627
+ while (digits.length < 6) digits = "0" + digits;
628
+ result = "" + digits + result;
629
+ }
538
630
  }
539
- }
540
- };
541
- /**
542
- * Gets the high 32 bits as a signed integer.
543
- * @this {!Long}
544
- * @returns {number} Signed high bits
545
- */
546
-
547
-
548
- LongPrototype.getHighBits = function getHighBits() {
549
- return this.high;
550
- };
551
- /**
552
- * Gets the high 32 bits as an unsigned integer.
553
- * @this {!Long}
554
- * @returns {number} Unsigned high bits
555
- */
556
-
557
-
558
- LongPrototype.getHighBitsUnsigned = function getHighBitsUnsigned() {
559
- return this.high >>> 0;
560
- };
561
- /**
562
- * Gets the low 32 bits as a signed integer.
563
- * @this {!Long}
564
- * @returns {number} Signed low bits
565
- */
566
-
567
-
568
- LongPrototype.getLowBits = function getLowBits() {
569
- return this.low;
570
- };
571
- /**
572
- * Gets the low 32 bits as an unsigned integer.
573
- * @this {!Long}
574
- * @returns {number} Unsigned low bits
575
- */
576
-
577
-
578
- LongPrototype.getLowBitsUnsigned = function getLowBitsUnsigned() {
579
- return this.low >>> 0;
580
- };
581
- /**
582
- * Gets the number of bits needed to represent the absolute value of this Long.
583
- * @this {!Long}
584
- * @returns {number}
585
- */
586
-
587
-
588
- LongPrototype.getNumBitsAbs = function getNumBitsAbs() {
589
- if (this.isNegative()) // Unsigned Longs are never negative
590
- return this.eq(MIN_VALUE) ? 64 : this.neg().getNumBitsAbs();
591
- var val = this.high != 0 ? this.high : this.low;
592
-
593
- for (var bit = 31; bit > 0; bit--) if ((val & 1 << bit) != 0) break;
594
-
595
- return this.high != 0 ? bit + 33 : bit + 1;
596
- };
597
- /**
598
- * Tests if this Long's value equals zero.
599
- * @this {!Long}
600
- * @returns {boolean}
601
- */
602
-
603
-
604
- LongPrototype.isZero = function isZero() {
605
- return this.high === 0 && this.low === 0;
606
- };
607
- /**
608
- * Tests if this Long's value equals zero. This is an alias of {@link Long#isZero}.
609
- * @returns {boolean}
610
- */
611
-
612
-
613
- LongPrototype.eqz = LongPrototype.isZero;
614
- /**
615
- * Tests if this Long's value is negative.
616
- * @this {!Long}
617
- * @returns {boolean}
618
- */
619
-
620
- LongPrototype.isNegative = function isNegative() {
621
- return !this.unsigned && this.high < 0;
622
- };
623
- /**
624
- * Tests if this Long's value is positive or zero.
625
- * @this {!Long}
626
- * @returns {boolean}
627
- */
628
-
629
-
630
- LongPrototype.isPositive = function isPositive() {
631
- return this.unsigned || this.high >= 0;
632
- };
633
- /**
634
- * Tests if this Long's value is odd.
635
- * @this {!Long}
636
- * @returns {boolean}
637
- */
638
-
639
-
640
- LongPrototype.isOdd = function isOdd() {
641
- return (this.low & 1) === 1;
642
- };
643
- /**
644
- * Tests if this Long's value is even.
645
- * @this {!Long}
646
- * @returns {boolean}
647
- */
648
-
649
-
650
- LongPrototype.isEven = function isEven() {
651
- return (this.low & 1) === 0;
652
- };
653
- /**
654
- * Tests if this Long's value equals the specified's.
655
- * @this {!Long}
656
- * @param {!Long|number|string} other Other value
657
- * @returns {boolean}
658
- */
659
-
660
-
661
- LongPrototype.equals = function equals(other) {
662
- if (!isLong(other)) other = fromValue(other);
663
- if (this.unsigned !== other.unsigned && this.high >>> 31 === 1 && other.high >>> 31 === 1) return false;
664
- return this.high === other.high && this.low === other.low;
665
- };
666
- /**
667
- * Tests if this Long's value equals the specified's. This is an alias of {@link Long#equals}.
668
- * @function
669
- * @param {!Long|number|string} other Other value
670
- * @returns {boolean}
671
- */
672
-
673
-
674
- LongPrototype.eq = LongPrototype.equals;
675
- /**
676
- * Tests if this Long's value differs from the specified's.
677
- * @this {!Long}
678
- * @param {!Long|number|string} other Other value
679
- * @returns {boolean}
680
- */
681
-
682
- LongPrototype.notEquals = function notEquals(other) {
683
- return !this.eq(
684
- /* validates */
685
- other);
686
- };
687
- /**
688
- * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.
689
- * @function
690
- * @param {!Long|number|string} other Other value
691
- * @returns {boolean}
692
- */
693
-
694
-
695
- LongPrototype.neq = LongPrototype.notEquals;
696
- /**
697
- * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.
698
- * @function
699
- * @param {!Long|number|string} other Other value
700
- * @returns {boolean}
701
- */
702
-
703
- LongPrototype.ne = LongPrototype.notEquals;
704
- /**
705
- * Tests if this Long's value is less than the specified's.
706
- * @this {!Long}
707
- * @param {!Long|number|string} other Other value
708
- * @returns {boolean}
709
- */
710
-
711
- LongPrototype.lessThan = function lessThan(other) {
712
- return this.comp(
713
- /* validates */
714
- other) < 0;
715
- };
716
- /**
717
- * Tests if this Long's value is less than the specified's. This is an alias of {@link Long#lessThan}.
718
- * @function
719
- * @param {!Long|number|string} other Other value
720
- * @returns {boolean}
721
- */
722
-
723
-
724
- LongPrototype.lt = LongPrototype.lessThan;
725
- /**
726
- * Tests if this Long's value is less than or equal the specified's.
727
- * @this {!Long}
728
- * @param {!Long|number|string} other Other value
729
- * @returns {boolean}
730
- */
731
-
732
- LongPrototype.lessThanOrEqual = function lessThanOrEqual(other) {
733
- return this.comp(
734
- /* validates */
735
- other) <= 0;
736
- };
737
- /**
738
- * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.
739
- * @function
740
- * @param {!Long|number|string} other Other value
741
- * @returns {boolean}
742
- */
743
-
744
-
745
- LongPrototype.lte = LongPrototype.lessThanOrEqual;
746
- /**
747
- * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.
748
- * @function
749
- * @param {!Long|number|string} other Other value
750
- * @returns {boolean}
751
- */
752
-
753
- LongPrototype.le = LongPrototype.lessThanOrEqual;
754
- /**
755
- * Tests if this Long's value is greater than the specified's.
756
- * @this {!Long}
757
- * @param {!Long|number|string} other Other value
758
- * @returns {boolean}
759
- */
760
-
761
- LongPrototype.greaterThan = function greaterThan(other) {
762
- return this.comp(
763
- /* validates */
764
- other) > 0;
765
- };
766
- /**
767
- * Tests if this Long's value is greater than the specified's. This is an alias of {@link Long#greaterThan}.
768
- * @function
769
- * @param {!Long|number|string} other Other value
770
- * @returns {boolean}
771
- */
772
-
773
-
774
- LongPrototype.gt = LongPrototype.greaterThan;
775
- /**
776
- * Tests if this Long's value is greater than or equal the specified's.
777
- * @this {!Long}
778
- * @param {!Long|number|string} other Other value
779
- * @returns {boolean}
780
- */
781
-
782
- LongPrototype.greaterThanOrEqual = function greaterThanOrEqual(other) {
783
- return this.comp(
784
- /* validates */
785
- other) >= 0;
786
- };
787
- /**
788
- * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.
789
- * @function
790
- * @param {!Long|number|string} other Other value
791
- * @returns {boolean}
792
- */
793
-
794
-
795
- LongPrototype.gte = LongPrototype.greaterThanOrEqual;
796
- /**
797
- * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.
798
- * @function
799
- * @param {!Long|number|string} other Other value
800
- * @returns {boolean}
801
- */
802
-
803
- LongPrototype.ge = LongPrototype.greaterThanOrEqual;
804
- /**
805
- * Compares this Long's value with the specified's.
806
- * @this {!Long}
807
- * @param {!Long|number|string} other Other value
808
- * @returns {number} 0 if they are the same, 1 if the this is greater and -1
809
- * if the given one is greater
810
- */
811
-
812
- LongPrototype.compare = function compare(other) {
813
- if (!isLong(other)) other = fromValue(other);
814
- if (this.eq(other)) return 0;
815
- var thisNeg = this.isNegative(),
631
+ };
632
+
633
+ /**
634
+ * Gets the high 32 bits as a signed integer.
635
+ * @this {!Long}
636
+ * @returns {number} Signed high bits
637
+ */
638
+ LongPrototype.getHighBits = function getHighBits() {
639
+ return this.high;
640
+ };
641
+
642
+ /**
643
+ * Gets the high 32 bits as an unsigned integer.
644
+ * @this {!Long}
645
+ * @returns {number} Unsigned high bits
646
+ */
647
+ LongPrototype.getHighBitsUnsigned = function getHighBitsUnsigned() {
648
+ return this.high >>> 0;
649
+ };
650
+
651
+ /**
652
+ * Gets the low 32 bits as a signed integer.
653
+ * @this {!Long}
654
+ * @returns {number} Signed low bits
655
+ */
656
+ LongPrototype.getLowBits = function getLowBits() {
657
+ return this.low;
658
+ };
659
+
660
+ /**
661
+ * Gets the low 32 bits as an unsigned integer.
662
+ * @this {!Long}
663
+ * @returns {number} Unsigned low bits
664
+ */
665
+ LongPrototype.getLowBitsUnsigned = function getLowBitsUnsigned() {
666
+ return this.low >>> 0;
667
+ };
668
+
669
+ /**
670
+ * Gets the number of bits needed to represent the absolute value of this Long.
671
+ * @this {!Long}
672
+ * @returns {number}
673
+ */
674
+ LongPrototype.getNumBitsAbs = function getNumBitsAbs() {
675
+ if (this.isNegative())
676
+ // Unsigned Longs are never negative
677
+ return this.eq(MIN_VALUE) ? 64 : this.neg().getNumBitsAbs();
678
+ var val = this.high != 0 ? this.high : this.low;
679
+ for (var bit = 31; bit > 0; bit--) if ((val & (1 << bit)) != 0) break;
680
+ return this.high != 0 ? bit + 33 : bit + 1;
681
+ };
682
+
683
+ /**
684
+ * Tests if this Long can be safely represented as a JavaScript number.
685
+ * @this {!Long}
686
+ * @returns {boolean}
687
+ */
688
+ LongPrototype.isSafeInteger = function isSafeInteger() {
689
+ // 2^53-1 is the maximum safe value
690
+ var top11Bits = this.high >> 21;
691
+ // [0, 2^53-1]
692
+ if (!top11Bits) return true;
693
+ // > 2^53-1
694
+ if (this.unsigned) return false;
695
+ // [-2^53, -1] except -2^53
696
+ return top11Bits === -1 && !(this.low === 0 && this.high === -0x200000);
697
+ };
698
+
699
+ /**
700
+ * Tests if this Long's value equals zero.
701
+ * @this {!Long}
702
+ * @returns {boolean}
703
+ */
704
+ LongPrototype.isZero = function isZero() {
705
+ return this.high === 0 && this.low === 0;
706
+ };
707
+
708
+ /**
709
+ * Tests if this Long's value equals zero. This is an alias of {@link Long#isZero}.
710
+ * @returns {boolean}
711
+ */
712
+ LongPrototype.eqz = LongPrototype.isZero;
713
+
714
+ /**
715
+ * Tests if this Long's value is negative.
716
+ * @this {!Long}
717
+ * @returns {boolean}
718
+ */
719
+ LongPrototype.isNegative = function isNegative() {
720
+ return !this.unsigned && this.high < 0;
721
+ };
722
+
723
+ /**
724
+ * Tests if this Long's value is positive or zero.
725
+ * @this {!Long}
726
+ * @returns {boolean}
727
+ */
728
+ LongPrototype.isPositive = function isPositive() {
729
+ return this.unsigned || this.high >= 0;
730
+ };
731
+
732
+ /**
733
+ * Tests if this Long's value is odd.
734
+ * @this {!Long}
735
+ * @returns {boolean}
736
+ */
737
+ LongPrototype.isOdd = function isOdd() {
738
+ return (this.low & 1) === 1;
739
+ };
740
+
741
+ /**
742
+ * Tests if this Long's value is even.
743
+ * @this {!Long}
744
+ * @returns {boolean}
745
+ */
746
+ LongPrototype.isEven = function isEven() {
747
+ return (this.low & 1) === 0;
748
+ };
749
+
750
+ /**
751
+ * Tests if this Long's value equals the specified's.
752
+ * @this {!Long}
753
+ * @param {!Long|number|bigint|string} other Other value
754
+ * @returns {boolean}
755
+ */
756
+ LongPrototype.equals = function equals(other) {
757
+ if (!isLong(other)) other = fromValue(other);
758
+ if (
759
+ this.unsigned !== other.unsigned &&
760
+ this.high >>> 31 === 1 &&
761
+ other.high >>> 31 === 1
762
+ )
763
+ return false;
764
+ return this.high === other.high && this.low === other.low;
765
+ };
766
+
767
+ /**
768
+ * Tests if this Long's value equals the specified's. This is an alias of {@link Long#equals}.
769
+ * @function
770
+ * @param {!Long|number|bigint|string} other Other value
771
+ * @returns {boolean}
772
+ */
773
+ LongPrototype.eq = LongPrototype.equals;
774
+
775
+ /**
776
+ * Tests if this Long's value differs from the specified's.
777
+ * @this {!Long}
778
+ * @param {!Long|number|bigint|string} other Other value
779
+ * @returns {boolean}
780
+ */
781
+ LongPrototype.notEquals = function notEquals(other) {
782
+ return !this.eq(/* validates */ other);
783
+ };
784
+
785
+ /**
786
+ * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.
787
+ * @function
788
+ * @param {!Long|number|bigint|string} other Other value
789
+ * @returns {boolean}
790
+ */
791
+ LongPrototype.neq = LongPrototype.notEquals;
792
+
793
+ /**
794
+ * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.
795
+ * @function
796
+ * @param {!Long|number|bigint|string} other Other value
797
+ * @returns {boolean}
798
+ */
799
+ LongPrototype.ne = LongPrototype.notEquals;
800
+
801
+ /**
802
+ * Tests if this Long's value is less than the specified's.
803
+ * @this {!Long}
804
+ * @param {!Long|number|bigint|string} other Other value
805
+ * @returns {boolean}
806
+ */
807
+ LongPrototype.lessThan = function lessThan(other) {
808
+ return this.comp(/* validates */ other) < 0;
809
+ };
810
+
811
+ /**
812
+ * Tests if this Long's value is less than the specified's. This is an alias of {@link Long#lessThan}.
813
+ * @function
814
+ * @param {!Long|number|bigint|string} other Other value
815
+ * @returns {boolean}
816
+ */
817
+ LongPrototype.lt = LongPrototype.lessThan;
818
+
819
+ /**
820
+ * Tests if this Long's value is less than or equal the specified's.
821
+ * @this {!Long}
822
+ * @param {!Long|number|bigint|string} other Other value
823
+ * @returns {boolean}
824
+ */
825
+ LongPrototype.lessThanOrEqual = function lessThanOrEqual(other) {
826
+ return this.comp(/* validates */ other) <= 0;
827
+ };
828
+
829
+ /**
830
+ * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.
831
+ * @function
832
+ * @param {!Long|number|bigint|string} other Other value
833
+ * @returns {boolean}
834
+ */
835
+ LongPrototype.lte = LongPrototype.lessThanOrEqual;
836
+
837
+ /**
838
+ * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.
839
+ * @function
840
+ * @param {!Long|number|bigint|string} other Other value
841
+ * @returns {boolean}
842
+ */
843
+ LongPrototype.le = LongPrototype.lessThanOrEqual;
844
+
845
+ /**
846
+ * Tests if this Long's value is greater than the specified's.
847
+ * @this {!Long}
848
+ * @param {!Long|number|bigint|string} other Other value
849
+ * @returns {boolean}
850
+ */
851
+ LongPrototype.greaterThan = function greaterThan(other) {
852
+ return this.comp(/* validates */ other) > 0;
853
+ };
854
+
855
+ /**
856
+ * Tests if this Long's value is greater than the specified's. This is an alias of {@link Long#greaterThan}.
857
+ * @function
858
+ * @param {!Long|number|bigint|string} other Other value
859
+ * @returns {boolean}
860
+ */
861
+ LongPrototype.gt = LongPrototype.greaterThan;
862
+
863
+ /**
864
+ * Tests if this Long's value is greater than or equal the specified's.
865
+ * @this {!Long}
866
+ * @param {!Long|number|bigint|string} other Other value
867
+ * @returns {boolean}
868
+ */
869
+ LongPrototype.greaterThanOrEqual = function greaterThanOrEqual(other) {
870
+ return this.comp(/* validates */ other) >= 0;
871
+ };
872
+
873
+ /**
874
+ * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.
875
+ * @function
876
+ * @param {!Long|number|bigint|string} other Other value
877
+ * @returns {boolean}
878
+ */
879
+ LongPrototype.gte = LongPrototype.greaterThanOrEqual;
880
+
881
+ /**
882
+ * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.
883
+ * @function
884
+ * @param {!Long|number|bigint|string} other Other value
885
+ * @returns {boolean}
886
+ */
887
+ LongPrototype.ge = LongPrototype.greaterThanOrEqual;
888
+
889
+ /**
890
+ * Compares this Long's value with the specified's.
891
+ * @this {!Long}
892
+ * @param {!Long|number|bigint|string} other Other value
893
+ * @returns {number} 0 if they are the same, 1 if the this is greater and -1
894
+ * if the given one is greater
895
+ */
896
+ LongPrototype.compare = function compare(other) {
897
+ if (!isLong(other)) other = fromValue(other);
898
+ if (this.eq(other)) return 0;
899
+ var thisNeg = this.isNegative(),
816
900
  otherNeg = other.isNegative();
817
- if (thisNeg && !otherNeg) return -1;
818
- if (!thisNeg && otherNeg) return 1; // At this point the sign bits are the same
819
-
820
- if (!this.unsigned) return this.sub(other).isNegative() ? -1 : 1; // Both are positive if at least one is unsigned
821
-
822
- return other.high >>> 0 > this.high >>> 0 || other.high === this.high && other.low >>> 0 > this.low >>> 0 ? -1 : 1;
823
- };
824
- /**
825
- * Compares this Long's value with the specified's. This is an alias of {@link Long#compare}.
826
- * @function
827
- * @param {!Long|number|string} other Other value
828
- * @returns {number} 0 if they are the same, 1 if the this is greater and -1
829
- * if the given one is greater
830
- */
831
-
832
-
833
- LongPrototype.comp = LongPrototype.compare;
834
- /**
835
- * Negates this Long's value.
836
- * @this {!Long}
837
- * @returns {!Long} Negated Long
838
- */
839
-
840
- LongPrototype.negate = function negate() {
841
- if (!this.unsigned && this.eq(MIN_VALUE)) return MIN_VALUE;
842
- return this.not().add(ONE);
843
- };
844
- /**
845
- * Negates this Long's value. This is an alias of {@link Long#negate}.
846
- * @function
847
- * @returns {!Long} Negated Long
848
- */
849
-
850
-
851
- LongPrototype.neg = LongPrototype.negate;
852
- /**
853
- * Returns the sum of this and the specified Long.
854
- * @this {!Long}
855
- * @param {!Long|number|string} addend Addend
856
- * @returns {!Long} Sum
857
- */
858
-
859
- LongPrototype.add = function add(addend) {
860
- if (!isLong(addend)) addend = fromValue(addend); // Divide each number into 4 chunks of 16 bits, and then sum the chunks.
861
-
862
- var a48 = this.high >>> 16;
863
- var a32 = this.high & 0xFFFF;
864
- var a16 = this.low >>> 16;
865
- var a00 = this.low & 0xFFFF;
866
- var b48 = addend.high >>> 16;
867
- var b32 = addend.high & 0xFFFF;
868
- var b16 = addend.low >>> 16;
869
- var b00 = addend.low & 0xFFFF;
870
- var c48 = 0,
901
+ if (thisNeg && !otherNeg) return -1;
902
+ if (!thisNeg && otherNeg) return 1;
903
+ // At this point the sign bits are the same
904
+ if (!this.unsigned) return this.sub(other).isNegative() ? -1 : 1;
905
+ // Both are positive if at least one is unsigned
906
+ return other.high >>> 0 > this.high >>> 0 ||
907
+ (other.high === this.high && other.low >>> 0 > this.low >>> 0)
908
+ ? -1
909
+ : 1;
910
+ };
911
+
912
+ /**
913
+ * Compares this Long's value with the specified's. This is an alias of {@link Long#compare}.
914
+ * @function
915
+ * @param {!Long|number|bigint|string} other Other value
916
+ * @returns {number} 0 if they are the same, 1 if the this is greater and -1
917
+ * if the given one is greater
918
+ */
919
+ LongPrototype.comp = LongPrototype.compare;
920
+
921
+ /**
922
+ * Negates this Long's value.
923
+ * @this {!Long}
924
+ * @returns {!Long} Negated Long
925
+ */
926
+ LongPrototype.negate = function negate() {
927
+ if (!this.unsigned && this.eq(MIN_VALUE)) return MIN_VALUE;
928
+ return this.not().add(ONE);
929
+ };
930
+
931
+ /**
932
+ * Negates this Long's value. This is an alias of {@link Long#negate}.
933
+ * @function
934
+ * @returns {!Long} Negated Long
935
+ */
936
+ LongPrototype.neg = LongPrototype.negate;
937
+
938
+ /**
939
+ * Returns the sum of this and the specified Long.
940
+ * @this {!Long}
941
+ * @param {!Long|number|bigint|string} addend Addend
942
+ * @returns {!Long} Sum
943
+ */
944
+ LongPrototype.add = function add(addend) {
945
+ if (!isLong(addend)) addend = fromValue(addend);
946
+
947
+ // Divide each number into 4 chunks of 16 bits, and then sum the chunks.
948
+
949
+ var a48 = this.high >>> 16;
950
+ var a32 = this.high & 0xffff;
951
+ var a16 = this.low >>> 16;
952
+ var a00 = this.low & 0xffff;
953
+ var b48 = addend.high >>> 16;
954
+ var b32 = addend.high & 0xffff;
955
+ var b16 = addend.low >>> 16;
956
+ var b00 = addend.low & 0xffff;
957
+ var c48 = 0,
871
958
  c32 = 0,
872
959
  c16 = 0,
873
960
  c00 = 0;
874
- c00 += a00 + b00;
875
- c16 += c00 >>> 16;
876
- c00 &= 0xFFFF;
877
- c16 += a16 + b16;
878
- c32 += c16 >>> 16;
879
- c16 &= 0xFFFF;
880
- c32 += a32 + b32;
881
- c48 += c32 >>> 16;
882
- c32 &= 0xFFFF;
883
- c48 += a48 + b48;
884
- c48 &= 0xFFFF;
885
- return fromBits(c16 << 16 | c00, c48 << 16 | c32, this.unsigned);
886
- };
887
- /**
888
- * Returns the difference of this and the specified Long.
889
- * @this {!Long}
890
- * @param {!Long|number|string} subtrahend Subtrahend
891
- * @returns {!Long} Difference
892
- */
893
-
894
-
895
- LongPrototype.subtract = function subtract(subtrahend) {
896
- if (!isLong(subtrahend)) subtrahend = fromValue(subtrahend);
897
- return this.add(subtrahend.neg());
898
- };
899
- /**
900
- * Returns the difference of this and the specified Long. This is an alias of {@link Long#subtract}.
901
- * @function
902
- * @param {!Long|number|string} subtrahend Subtrahend
903
- * @returns {!Long} Difference
904
- */
905
-
906
-
907
- LongPrototype.sub = LongPrototype.subtract;
908
- /**
909
- * Returns the product of this and the specified Long.
910
- * @this {!Long}
911
- * @param {!Long|number|string} multiplier Multiplier
912
- * @returns {!Long} Product
913
- */
914
-
915
- LongPrototype.multiply = function multiply(multiplier) {
916
- if (this.isZero()) return this;
917
- if (!isLong(multiplier)) multiplier = fromValue(multiplier); // use wasm support if present
918
-
919
- if (wasm) {
920
- var low = wasm["mul"](this.low, this.high, multiplier.low, multiplier.high);
921
- return fromBits(low, wasm["get_high"](), this.unsigned);
922
- }
923
-
924
- if (multiplier.isZero()) return this.unsigned ? UZERO : ZERO;
925
- if (this.eq(MIN_VALUE)) return multiplier.isOdd() ? MIN_VALUE : ZERO;
926
- if (multiplier.eq(MIN_VALUE)) return this.isOdd() ? MIN_VALUE : ZERO;
927
-
928
- if (this.isNegative()) {
929
- if (multiplier.isNegative()) return this.neg().mul(multiplier.neg());else return this.neg().mul(multiplier).neg();
930
- } else if (multiplier.isNegative()) return this.mul(multiplier.neg()).neg(); // If both longs are small, use float multiplication
931
-
932
-
933
- if (this.lt(TWO_PWR_24) && multiplier.lt(TWO_PWR_24)) return fromNumber(this.toNumber() * multiplier.toNumber(), this.unsigned); // Divide each long into 4 chunks of 16 bits, and then add up 4x4 products.
934
- // We can skip products that would overflow.
935
-
936
- var a48 = this.high >>> 16;
937
- var a32 = this.high & 0xFFFF;
938
- var a16 = this.low >>> 16;
939
- var a00 = this.low & 0xFFFF;
940
- var b48 = multiplier.high >>> 16;
941
- var b32 = multiplier.high & 0xFFFF;
942
- var b16 = multiplier.low >>> 16;
943
- var b00 = multiplier.low & 0xFFFF;
944
- var c48 = 0,
961
+ c00 += a00 + b00;
962
+ c16 += c00 >>> 16;
963
+ c00 &= 0xffff;
964
+ c16 += a16 + b16;
965
+ c32 += c16 >>> 16;
966
+ c16 &= 0xffff;
967
+ c32 += a32 + b32;
968
+ c48 += c32 >>> 16;
969
+ c32 &= 0xffff;
970
+ c48 += a48 + b48;
971
+ c48 &= 0xffff;
972
+ return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);
973
+ };
974
+
975
+ /**
976
+ * Returns the difference of this and the specified Long.
977
+ * @this {!Long}
978
+ * @param {!Long|number|bigint|string} subtrahend Subtrahend
979
+ * @returns {!Long} Difference
980
+ */
981
+ LongPrototype.subtract = function subtract(subtrahend) {
982
+ if (!isLong(subtrahend)) subtrahend = fromValue(subtrahend);
983
+ return this.add(subtrahend.neg());
984
+ };
985
+
986
+ /**
987
+ * Returns the difference of this and the specified Long. This is an alias of {@link Long#subtract}.
988
+ * @function
989
+ * @param {!Long|number|bigint|string} subtrahend Subtrahend
990
+ * @returns {!Long} Difference
991
+ */
992
+ LongPrototype.sub = LongPrototype.subtract;
993
+
994
+ /**
995
+ * Returns the product of this and the specified Long.
996
+ * @this {!Long}
997
+ * @param {!Long|number|bigint|string} multiplier Multiplier
998
+ * @returns {!Long} Product
999
+ */
1000
+ LongPrototype.multiply = function multiply(multiplier) {
1001
+ if (this.isZero()) return this;
1002
+ if (!isLong(multiplier)) multiplier = fromValue(multiplier);
1003
+
1004
+ // use wasm support if present
1005
+ if (wasm) {
1006
+ var low = wasm["mul"](
1007
+ this.low,
1008
+ this.high,
1009
+ multiplier.low,
1010
+ multiplier.high,
1011
+ );
1012
+ return fromBits(low, wasm["get_high"](), this.unsigned);
1013
+ }
1014
+ if (multiplier.isZero()) return this.unsigned ? UZERO : ZERO;
1015
+ if (this.eq(MIN_VALUE)) return multiplier.isOdd() ? MIN_VALUE : ZERO;
1016
+ if (multiplier.eq(MIN_VALUE)) return this.isOdd() ? MIN_VALUE : ZERO;
1017
+ if (this.isNegative()) {
1018
+ if (multiplier.isNegative()) return this.neg().mul(multiplier.neg());
1019
+ else return this.neg().mul(multiplier).neg();
1020
+ } else if (multiplier.isNegative())
1021
+ return this.mul(multiplier.neg()).neg();
1022
+
1023
+ // If both longs are small, use float multiplication
1024
+ if (this.lt(TWO_PWR_24) && multiplier.lt(TWO_PWR_24))
1025
+ return fromNumber(
1026
+ this.toNumber() * multiplier.toNumber(),
1027
+ this.unsigned,
1028
+ );
1029
+
1030
+ // Divide each long into 4 chunks of 16 bits, and then add up 4x4 products.
1031
+ // We can skip products that would overflow.
1032
+
1033
+ var a48 = this.high >>> 16;
1034
+ var a32 = this.high & 0xffff;
1035
+ var a16 = this.low >>> 16;
1036
+ var a00 = this.low & 0xffff;
1037
+ var b48 = multiplier.high >>> 16;
1038
+ var b32 = multiplier.high & 0xffff;
1039
+ var b16 = multiplier.low >>> 16;
1040
+ var b00 = multiplier.low & 0xffff;
1041
+ var c48 = 0,
945
1042
  c32 = 0,
946
1043
  c16 = 0,
947
1044
  c00 = 0;
948
- c00 += a00 * b00;
949
- c16 += c00 >>> 16;
950
- c00 &= 0xFFFF;
951
- c16 += a16 * b00;
952
- c32 += c16 >>> 16;
953
- c16 &= 0xFFFF;
954
- c16 += a00 * b16;
955
- c32 += c16 >>> 16;
956
- c16 &= 0xFFFF;
957
- c32 += a32 * b00;
958
- c48 += c32 >>> 16;
959
- c32 &= 0xFFFF;
960
- c32 += a16 * b16;
961
- c48 += c32 >>> 16;
962
- c32 &= 0xFFFF;
963
- c32 += a00 * b32;
964
- c48 += c32 >>> 16;
965
- c32 &= 0xFFFF;
966
- c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;
967
- c48 &= 0xFFFF;
968
- return fromBits(c16 << 16 | c00, c48 << 16 | c32, this.unsigned);
969
- };
970
- /**
971
- * Returns the product of this and the specified Long. This is an alias of {@link Long#multiply}.
972
- * @function
973
- * @param {!Long|number|string} multiplier Multiplier
974
- * @returns {!Long} Product
975
- */
976
-
977
-
978
- LongPrototype.mul = LongPrototype.multiply;
979
- /**
980
- * Returns this Long divided by the specified. The result is signed if this Long is signed or
981
- * unsigned if this Long is unsigned.
982
- * @this {!Long}
983
- * @param {!Long|number|string} divisor Divisor
984
- * @returns {!Long} Quotient
985
- */
986
-
987
- LongPrototype.divide = function divide(divisor) {
988
- if (!isLong(divisor)) divisor = fromValue(divisor);
989
- if (divisor.isZero()) throw Error('division by zero'); // use wasm support if present
990
-
991
- if (wasm) {
992
- // guard against signed division overflow: the largest
993
- // negative number / -1 would be 1 larger than the largest
994
- // positive number, due to two's complement.
995
- if (!this.unsigned && this.high === -0x80000000 && divisor.low === -1 && divisor.high === -1) {
996
- // be consistent with non-wasm code path
997
- return this;
1045
+ c00 += a00 * b00;
1046
+ c16 += c00 >>> 16;
1047
+ c00 &= 0xffff;
1048
+ c16 += a16 * b00;
1049
+ c32 += c16 >>> 16;
1050
+ c16 &= 0xffff;
1051
+ c16 += a00 * b16;
1052
+ c32 += c16 >>> 16;
1053
+ c16 &= 0xffff;
1054
+ c32 += a32 * b00;
1055
+ c48 += c32 >>> 16;
1056
+ c32 &= 0xffff;
1057
+ c32 += a16 * b16;
1058
+ c48 += c32 >>> 16;
1059
+ c32 &= 0xffff;
1060
+ c32 += a00 * b32;
1061
+ c48 += c32 >>> 16;
1062
+ c32 &= 0xffff;
1063
+ c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;
1064
+ c48 &= 0xffff;
1065
+ return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);
1066
+ };
1067
+
1068
+ /**
1069
+ * Returns the product of this and the specified Long. This is an alias of {@link Long#multiply}.
1070
+ * @function
1071
+ * @param {!Long|number|bigint|string} multiplier Multiplier
1072
+ * @returns {!Long} Product
1073
+ */
1074
+ LongPrototype.mul = LongPrototype.multiply;
1075
+
1076
+ /**
1077
+ * Returns this Long divided by the specified. The result is signed if this Long is signed or
1078
+ * unsigned if this Long is unsigned.
1079
+ * @this {!Long}
1080
+ * @param {!Long|number|bigint|string} divisor Divisor
1081
+ * @returns {!Long} Quotient
1082
+ */
1083
+ LongPrototype.divide = function divide(divisor) {
1084
+ if (!isLong(divisor)) divisor = fromValue(divisor);
1085
+ if (divisor.isZero()) throw Error("division by zero");
1086
+
1087
+ // use wasm support if present
1088
+ if (wasm) {
1089
+ // guard against signed division overflow: the largest
1090
+ // negative number / -1 would be 1 larger than the largest
1091
+ // positive number, due to two's complement.
1092
+ if (
1093
+ !this.unsigned &&
1094
+ this.high === -0x80000000 &&
1095
+ divisor.low === -1 &&
1096
+ divisor.high === -1
1097
+ ) {
1098
+ // be consistent with non-wasm code path
1099
+ return this;
1100
+ }
1101
+ var low = (this.unsigned ? wasm["div_u"] : wasm["div_s"])(
1102
+ this.low,
1103
+ this.high,
1104
+ divisor.low,
1105
+ divisor.high,
1106
+ );
1107
+ return fromBits(low, wasm["get_high"](), this.unsigned);
998
1108
  }
999
-
1000
- var low = (this.unsigned ? wasm["div_u"] : wasm["div_s"])(this.low, this.high, divisor.low, divisor.high);
1001
- return fromBits(low, wasm["get_high"](), this.unsigned);
1002
- }
1003
-
1004
- if (this.isZero()) return this.unsigned ? UZERO : ZERO;
1005
- var approx, rem, res;
1006
-
1007
- if (!this.unsigned) {
1008
- // This section is only relevant for signed longs and is derived from the
1009
- // closure library as a whole.
1010
- if (this.eq(MIN_VALUE)) {
1011
- if (divisor.eq(ONE) || divisor.eq(NEG_ONE)) return MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE
1012
- else if (divisor.eq(MIN_VALUE)) return ONE;else {
1013
- // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.
1014
- var halfThis = this.shr(1);
1015
- approx = halfThis.div(divisor).shl(1);
1016
-
1017
- if (approx.eq(ZERO)) {
1018
- return divisor.isNegative() ? ONE : NEG_ONE;
1019
- } else {
1020
- rem = this.sub(divisor.mul(approx));
1021
- res = approx.add(rem.div(divisor));
1022
- return res;
1109
+ if (this.isZero()) return this.unsigned ? UZERO : ZERO;
1110
+ var approx, rem, res;
1111
+ if (!this.unsigned) {
1112
+ // This section is only relevant for signed longs and is derived from the
1113
+ // closure library as a whole.
1114
+ if (this.eq(MIN_VALUE)) {
1115
+ if (divisor.eq(ONE) || divisor.eq(NEG_ONE))
1116
+ return MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE
1117
+ else if (divisor.eq(MIN_VALUE)) return ONE;
1118
+ else {
1119
+ // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.
1120
+ var halfThis = this.shr(1);
1121
+ approx = halfThis.div(divisor).shl(1);
1122
+ if (approx.eq(ZERO)) {
1123
+ return divisor.isNegative() ? ONE : NEG_ONE;
1124
+ } else {
1125
+ rem = this.sub(divisor.mul(approx));
1126
+ res = approx.add(rem.div(divisor));
1127
+ return res;
1128
+ }
1023
1129
  }
1024
- }
1025
- } else if (divisor.eq(MIN_VALUE)) return this.unsigned ? UZERO : ZERO;
1026
-
1027
- if (this.isNegative()) {
1028
- if (divisor.isNegative()) return this.neg().div(divisor.neg());
1029
- return this.neg().div(divisor).neg();
1030
- } else if (divisor.isNegative()) return this.div(divisor.neg()).neg();
1031
-
1032
- res = ZERO;
1033
- } else {
1034
- // The algorithm below has not been made for unsigned longs. It's therefore
1035
- // required to take special care of the MSB prior to running it.
1036
- if (!divisor.unsigned) divisor = divisor.toUnsigned();
1037
- if (divisor.gt(this)) return UZERO;
1038
- if (divisor.gt(this.shru(1))) // 15 >>> 1 = 7 ; with divisor = 8 ; true
1039
- return UONE;
1040
- res = UZERO;
1041
- } // Repeat the following until the remainder is less than other: find a
1042
- // floating-point that approximates remainder / other *from below*, add this
1043
- // into the result, and subtract it from the remainder. It is critical that
1044
- // the approximate value is less than or equal to the real value so that the
1045
- // remainder never becomes negative.
1046
-
1047
-
1048
- rem = this;
1049
-
1050
- while (rem.gte(divisor)) {
1051
- // Approximate the result of division. This may be a little greater or
1052
- // smaller than the actual value.
1053
- approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber())); // We will tweak the approximate result by changing it in the 48-th digit or
1054
- // the smallest non-fractional digit, whichever is larger.
1055
-
1056
- var log2 = Math.ceil(Math.log(approx) / Math.LN2),
1130
+ } else if (divisor.eq(MIN_VALUE)) return this.unsigned ? UZERO : ZERO;
1131
+ if (this.isNegative()) {
1132
+ if (divisor.isNegative()) return this.neg().div(divisor.neg());
1133
+ return this.neg().div(divisor).neg();
1134
+ } else if (divisor.isNegative()) return this.div(divisor.neg()).neg();
1135
+ res = ZERO;
1136
+ } else {
1137
+ // The algorithm below has not been made for unsigned longs. It's therefore
1138
+ // required to take special care of the MSB prior to running it.
1139
+ if (!divisor.unsigned) divisor = divisor.toUnsigned();
1140
+ if (divisor.gt(this)) return UZERO;
1141
+ if (divisor.gt(this.shru(1)))
1142
+ // 15 >>> 1 = 7 ; with divisor = 8 ; true
1143
+ return UONE;
1144
+ res = UZERO;
1145
+ }
1146
+
1147
+ // Repeat the following until the remainder is less than other: find a
1148
+ // floating-point that approximates remainder / other *from below*, add this
1149
+ // into the result, and subtract it from the remainder. It is critical that
1150
+ // the approximate value is less than or equal to the real value so that the
1151
+ // remainder never becomes negative.
1152
+ rem = this;
1153
+ while (rem.gte(divisor)) {
1154
+ // Approximate the result of division. This may be a little greater or
1155
+ // smaller than the actual value.
1156
+ approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber()));
1157
+
1158
+ // We will tweak the approximate result by changing it in the 48-th digit or
1159
+ // the smallest non-fractional digit, whichever is larger.
1160
+ var log2 = Math.ceil(Math.log(approx) / Math.LN2),
1057
1161
  delta = log2 <= 48 ? 1 : pow_dbl(2, log2 - 48),
1058
1162
  // Decrease the approximation until it is smaller than the remainder. Note
1059
- // that if it is too large, the product overflows and is negative.
1060
- approxRes = fromNumber(approx),
1163
+ // that if it is too large, the product overflows and is negative.
1164
+ approxRes = fromNumber(approx),
1061
1165
  approxRem = approxRes.mul(divisor);
1062
-
1063
- while (approxRem.isNegative() || approxRem.gt(rem)) {
1064
- approx -= delta;
1065
- approxRes = fromNumber(approx, this.unsigned);
1066
- approxRem = approxRes.mul(divisor);
1067
- } // We know the answer can't be zero... and actually, zero would cause
1068
- // infinite recursion since we would make no progress.
1069
-
1070
-
1071
- if (approxRes.isZero()) approxRes = ONE;
1072
- res = res.add(approxRes);
1073
- rem = rem.sub(approxRem);
1074
- }
1075
-
1076
- return res;
1077
- };
1078
- /**
1079
- * Returns this Long divided by the specified. This is an alias of {@link Long#divide}.
1080
- * @function
1081
- * @param {!Long|number|string} divisor Divisor
1082
- * @returns {!Long} Quotient
1083
- */
1084
-
1085
-
1086
- LongPrototype.div = LongPrototype.divide;
1087
- /**
1088
- * Returns this Long modulo the specified.
1089
- * @this {!Long}
1090
- * @param {!Long|number|string} divisor Divisor
1091
- * @returns {!Long} Remainder
1092
- */
1093
-
1094
- LongPrototype.modulo = function modulo(divisor) {
1095
- if (!isLong(divisor)) divisor = fromValue(divisor); // use wasm support if present
1096
-
1097
- if (wasm) {
1098
- var low = (this.unsigned ? wasm["rem_u"] : wasm["rem_s"])(this.low, this.high, divisor.low, divisor.high);
1099
- return fromBits(low, wasm["get_high"](), this.unsigned);
1100
- }
1101
-
1102
- return this.sub(this.div(divisor).mul(divisor));
1103
- };
1104
- /**
1105
- * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.
1106
- * @function
1107
- * @param {!Long|number|string} divisor Divisor
1108
- * @returns {!Long} Remainder
1109
- */
1110
-
1111
-
1112
- LongPrototype.mod = LongPrototype.modulo;
1113
- /**
1114
- * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.
1115
- * @function
1116
- * @param {!Long|number|string} divisor Divisor
1117
- * @returns {!Long} Remainder
1118
- */
1119
-
1120
- LongPrototype.rem = LongPrototype.modulo;
1121
- /**
1122
- * Returns the bitwise NOT of this Long.
1123
- * @this {!Long}
1124
- * @returns {!Long}
1125
- */
1126
-
1127
- LongPrototype.not = function not() {
1128
- return fromBits(~this.low, ~this.high, this.unsigned);
1129
- };
1130
- /**
1131
- * Returns count leading zeros of this Long.
1132
- * @this {!Long}
1133
- * @returns {!number}
1134
- */
1135
-
1136
-
1137
- LongPrototype.countLeadingZeros = function countLeadingZeros() {
1138
- return this.high ? Math.clz32(this.high) : Math.clz32(this.low) + 32;
1139
- };
1140
- /**
1141
- * Returns count leading zeros. This is an alias of {@link Long#countLeadingZeros}.
1142
- * @function
1143
- * @param {!Long}
1144
- * @returns {!number}
1145
- */
1146
-
1147
-
1148
- LongPrototype.clz = LongPrototype.countLeadingZeros;
1149
- /**
1150
- * Returns count trailing zeros of this Long.
1151
- * @this {!Long}
1152
- * @returns {!number}
1153
- */
1154
-
1155
- LongPrototype.countTrailingZeros = function countTrailingZeros() {
1156
- return this.low ? ctz32(this.low) : ctz32(this.high) + 32;
1157
- };
1158
- /**
1159
- * Returns count trailing zeros. This is an alias of {@link Long#countTrailingZeros}.
1160
- * @function
1161
- * @param {!Long}
1162
- * @returns {!number}
1163
- */
1164
-
1165
-
1166
- LongPrototype.ctz = LongPrototype.countTrailingZeros;
1167
- /**
1168
- * Returns the bitwise AND of this Long and the specified.
1169
- * @this {!Long}
1170
- * @param {!Long|number|string} other Other Long
1171
- * @returns {!Long}
1172
- */
1173
-
1174
- LongPrototype.and = function and(other) {
1175
- if (!isLong(other)) other = fromValue(other);
1176
- return fromBits(this.low & other.low, this.high & other.high, this.unsigned);
1177
- };
1178
- /**
1179
- * Returns the bitwise OR of this Long and the specified.
1180
- * @this {!Long}
1181
- * @param {!Long|number|string} other Other Long
1182
- * @returns {!Long}
1183
- */
1184
-
1185
-
1186
- LongPrototype.or = function or(other) {
1187
- if (!isLong(other)) other = fromValue(other);
1188
- return fromBits(this.low | other.low, this.high | other.high, this.unsigned);
1189
- };
1190
- /**
1191
- * Returns the bitwise XOR of this Long and the given one.
1192
- * @this {!Long}
1193
- * @param {!Long|number|string} other Other Long
1194
- * @returns {!Long}
1195
- */
1196
-
1197
-
1198
- LongPrototype.xor = function xor(other) {
1199
- if (!isLong(other)) other = fromValue(other);
1200
- return fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned);
1201
- };
1202
- /**
1203
- * Returns this Long with bits shifted to the left by the given amount.
1204
- * @this {!Long}
1205
- * @param {number|!Long} numBits Number of bits
1206
- * @returns {!Long} Shifted Long
1207
- */
1208
-
1209
-
1210
- LongPrototype.shiftLeft = function shiftLeft(numBits) {
1211
- if (isLong(numBits)) numBits = numBits.toInt();
1212
- if ((numBits &= 63) === 0) return this;else if (numBits < 32) return fromBits(this.low << numBits, this.high << numBits | this.low >>> 32 - numBits, this.unsigned);else return fromBits(0, this.low << numBits - 32, this.unsigned);
1213
- };
1214
- /**
1215
- * Returns this Long with bits shifted to the left by the given amount. This is an alias of {@link Long#shiftLeft}.
1216
- * @function
1217
- * @param {number|!Long} numBits Number of bits
1218
- * @returns {!Long} Shifted Long
1219
- */
1220
-
1221
-
1222
- LongPrototype.shl = LongPrototype.shiftLeft;
1223
- /**
1224
- * Returns this Long with bits arithmetically shifted to the right by the given amount.
1225
- * @this {!Long}
1226
- * @param {number|!Long} numBits Number of bits
1227
- * @returns {!Long} Shifted Long
1228
- */
1229
-
1230
- LongPrototype.shiftRight = function shiftRight(numBits) {
1231
- if (isLong(numBits)) numBits = numBits.toInt();
1232
- if ((numBits &= 63) === 0) return this;else if (numBits < 32) return fromBits(this.low >>> numBits | this.high << 32 - numBits, this.high >> numBits, this.unsigned);else return fromBits(this.high >> numBits - 32, this.high >= 0 ? 0 : -1, this.unsigned);
1233
- };
1234
- /**
1235
- * Returns this Long with bits arithmetically shifted to the right by the given amount. This is an alias of {@link Long#shiftRight}.
1236
- * @function
1237
- * @param {number|!Long} numBits Number of bits
1238
- * @returns {!Long} Shifted Long
1239
- */
1240
-
1241
-
1242
- LongPrototype.shr = LongPrototype.shiftRight;
1243
- /**
1244
- * Returns this Long with bits logically shifted to the right by the given amount.
1245
- * @this {!Long}
1246
- * @param {number|!Long} numBits Number of bits
1247
- * @returns {!Long} Shifted Long
1248
- */
1249
-
1250
- LongPrototype.shiftRightUnsigned = function shiftRightUnsigned(numBits) {
1251
- if (isLong(numBits)) numBits = numBits.toInt();
1252
- if ((numBits &= 63) === 0) return this;
1253
- if (numBits < 32) return fromBits(this.low >>> numBits | this.high << 32 - numBits, this.high >>> numBits, this.unsigned);
1254
- if (numBits === 32) return fromBits(this.high, 0, this.unsigned);
1255
- return fromBits(this.high >>> numBits - 32, 0, this.unsigned);
1256
- };
1257
- /**
1258
- * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.
1259
- * @function
1260
- * @param {number|!Long} numBits Number of bits
1261
- * @returns {!Long} Shifted Long
1262
- */
1263
-
1264
-
1265
- LongPrototype.shru = LongPrototype.shiftRightUnsigned;
1266
- /**
1267
- * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.
1268
- * @function
1269
- * @param {number|!Long} numBits Number of bits
1270
- * @returns {!Long} Shifted Long
1271
- */
1272
-
1273
- LongPrototype.shr_u = LongPrototype.shiftRightUnsigned;
1274
- /**
1275
- * Returns this Long with bits rotated to the left by the given amount.
1276
- * @this {!Long}
1277
- * @param {number|!Long} numBits Number of bits
1278
- * @returns {!Long} Rotated Long
1279
- */
1280
-
1281
- LongPrototype.rotateLeft = function rotateLeft(numBits) {
1282
- var b;
1283
- if (isLong(numBits)) numBits = numBits.toInt();
1284
- if ((numBits &= 63) === 0) return this;
1285
- if (numBits === 32) return fromBits(this.high, this.low, this.unsigned);
1286
-
1287
- if (numBits < 32) {
1166
+ while (approxRem.isNegative() || approxRem.gt(rem)) {
1167
+ approx -= delta;
1168
+ approxRes = fromNumber(approx, this.unsigned);
1169
+ approxRem = approxRes.mul(divisor);
1170
+ }
1171
+
1172
+ // We know the answer can't be zero... and actually, zero would cause
1173
+ // infinite recursion since we would make no progress.
1174
+ if (approxRes.isZero()) approxRes = ONE;
1175
+ res = res.add(approxRes);
1176
+ rem = rem.sub(approxRem);
1177
+ }
1178
+ return res;
1179
+ };
1180
+
1181
+ /**
1182
+ * Returns this Long divided by the specified. This is an alias of {@link Long#divide}.
1183
+ * @function
1184
+ * @param {!Long|number|bigint|string} divisor Divisor
1185
+ * @returns {!Long} Quotient
1186
+ */
1187
+ LongPrototype.div = LongPrototype.divide;
1188
+
1189
+ /**
1190
+ * Returns this Long modulo the specified.
1191
+ * @this {!Long}
1192
+ * @param {!Long|number|bigint|string} divisor Divisor
1193
+ * @returns {!Long} Remainder
1194
+ */
1195
+ LongPrototype.modulo = function modulo(divisor) {
1196
+ if (!isLong(divisor)) divisor = fromValue(divisor);
1197
+
1198
+ // use wasm support if present
1199
+ if (wasm) {
1200
+ var low = (this.unsigned ? wasm["rem_u"] : wasm["rem_s"])(
1201
+ this.low,
1202
+ this.high,
1203
+ divisor.low,
1204
+ divisor.high,
1205
+ );
1206
+ return fromBits(low, wasm["get_high"](), this.unsigned);
1207
+ }
1208
+ return this.sub(this.div(divisor).mul(divisor));
1209
+ };
1210
+
1211
+ /**
1212
+ * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.
1213
+ * @function
1214
+ * @param {!Long|number|bigint|string} divisor Divisor
1215
+ * @returns {!Long} Remainder
1216
+ */
1217
+ LongPrototype.mod = LongPrototype.modulo;
1218
+
1219
+ /**
1220
+ * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.
1221
+ * @function
1222
+ * @param {!Long|number|bigint|string} divisor Divisor
1223
+ * @returns {!Long} Remainder
1224
+ */
1225
+ LongPrototype.rem = LongPrototype.modulo;
1226
+
1227
+ /**
1228
+ * Returns the bitwise NOT of this Long.
1229
+ * @this {!Long}
1230
+ * @returns {!Long}
1231
+ */
1232
+ LongPrototype.not = function not() {
1233
+ return fromBits(~this.low, ~this.high, this.unsigned);
1234
+ };
1235
+
1236
+ /**
1237
+ * Returns count leading zeros of this Long.
1238
+ * @this {!Long}
1239
+ * @returns {!number}
1240
+ */
1241
+ LongPrototype.countLeadingZeros = function countLeadingZeros() {
1242
+ return this.high ? Math.clz32(this.high) : Math.clz32(this.low) + 32;
1243
+ };
1244
+
1245
+ /**
1246
+ * Returns count leading zeros. This is an alias of {@link Long#countLeadingZeros}.
1247
+ * @function
1248
+ * @param {!Long}
1249
+ * @returns {!number}
1250
+ */
1251
+ LongPrototype.clz = LongPrototype.countLeadingZeros;
1252
+
1253
+ /**
1254
+ * Returns count trailing zeros of this Long.
1255
+ * @this {!Long}
1256
+ * @returns {!number}
1257
+ */
1258
+ LongPrototype.countTrailingZeros = function countTrailingZeros() {
1259
+ return this.low ? ctz32(this.low) : ctz32(this.high) + 32;
1260
+ };
1261
+
1262
+ /**
1263
+ * Returns count trailing zeros. This is an alias of {@link Long#countTrailingZeros}.
1264
+ * @function
1265
+ * @param {!Long}
1266
+ * @returns {!number}
1267
+ */
1268
+ LongPrototype.ctz = LongPrototype.countTrailingZeros;
1269
+
1270
+ /**
1271
+ * Returns the bitwise AND of this Long and the specified.
1272
+ * @this {!Long}
1273
+ * @param {!Long|number|bigint|string} other Other Long
1274
+ * @returns {!Long}
1275
+ */
1276
+ LongPrototype.and = function and(other) {
1277
+ if (!isLong(other)) other = fromValue(other);
1278
+ return fromBits(
1279
+ this.low & other.low,
1280
+ this.high & other.high,
1281
+ this.unsigned,
1282
+ );
1283
+ };
1284
+
1285
+ /**
1286
+ * Returns the bitwise OR of this Long and the specified.
1287
+ * @this {!Long}
1288
+ * @param {!Long|number|bigint|string} other Other Long
1289
+ * @returns {!Long}
1290
+ */
1291
+ LongPrototype.or = function or(other) {
1292
+ if (!isLong(other)) other = fromValue(other);
1293
+ return fromBits(
1294
+ this.low | other.low,
1295
+ this.high | other.high,
1296
+ this.unsigned,
1297
+ );
1298
+ };
1299
+
1300
+ /**
1301
+ * Returns the bitwise XOR of this Long and the given one.
1302
+ * @this {!Long}
1303
+ * @param {!Long|number|bigint|string} other Other Long
1304
+ * @returns {!Long}
1305
+ */
1306
+ LongPrototype.xor = function xor(other) {
1307
+ if (!isLong(other)) other = fromValue(other);
1308
+ return fromBits(
1309
+ this.low ^ other.low,
1310
+ this.high ^ other.high,
1311
+ this.unsigned,
1312
+ );
1313
+ };
1314
+
1315
+ /**
1316
+ * Returns this Long with bits shifted to the left by the given amount.
1317
+ * @this {!Long}
1318
+ * @param {number|!Long} numBits Number of bits
1319
+ * @returns {!Long} Shifted Long
1320
+ */
1321
+ LongPrototype.shiftLeft = function shiftLeft(numBits) {
1322
+ if (isLong(numBits)) numBits = numBits.toInt();
1323
+ if ((numBits &= 63) === 0) return this;
1324
+ else if (numBits < 32)
1325
+ return fromBits(
1326
+ this.low << numBits,
1327
+ (this.high << numBits) | (this.low >>> (32 - numBits)),
1328
+ this.unsigned,
1329
+ );
1330
+ else return fromBits(0, this.low << (numBits - 32), this.unsigned);
1331
+ };
1332
+
1333
+ /**
1334
+ * Returns this Long with bits shifted to the left by the given amount. This is an alias of {@link Long#shiftLeft}.
1335
+ * @function
1336
+ * @param {number|!Long} numBits Number of bits
1337
+ * @returns {!Long} Shifted Long
1338
+ */
1339
+ LongPrototype.shl = LongPrototype.shiftLeft;
1340
+
1341
+ /**
1342
+ * Returns this Long with bits arithmetically shifted to the right by the given amount.
1343
+ * @this {!Long}
1344
+ * @param {number|!Long} numBits Number of bits
1345
+ * @returns {!Long} Shifted Long
1346
+ */
1347
+ LongPrototype.shiftRight = function shiftRight(numBits) {
1348
+ if (isLong(numBits)) numBits = numBits.toInt();
1349
+ if ((numBits &= 63) === 0) return this;
1350
+ else if (numBits < 32)
1351
+ return fromBits(
1352
+ (this.low >>> numBits) | (this.high << (32 - numBits)),
1353
+ this.high >> numBits,
1354
+ this.unsigned,
1355
+ );
1356
+ else
1357
+ return fromBits(
1358
+ this.high >> (numBits - 32),
1359
+ this.high >= 0 ? 0 : -1,
1360
+ this.unsigned,
1361
+ );
1362
+ };
1363
+
1364
+ /**
1365
+ * Returns this Long with bits arithmetically shifted to the right by the given amount. This is an alias of {@link Long#shiftRight}.
1366
+ * @function
1367
+ * @param {number|!Long} numBits Number of bits
1368
+ * @returns {!Long} Shifted Long
1369
+ */
1370
+ LongPrototype.shr = LongPrototype.shiftRight;
1371
+
1372
+ /**
1373
+ * Returns this Long with bits logically shifted to the right by the given amount.
1374
+ * @this {!Long}
1375
+ * @param {number|!Long} numBits Number of bits
1376
+ * @returns {!Long} Shifted Long
1377
+ */
1378
+ LongPrototype.shiftRightUnsigned = function shiftRightUnsigned(numBits) {
1379
+ if (isLong(numBits)) numBits = numBits.toInt();
1380
+ if ((numBits &= 63) === 0) return this;
1381
+ if (numBits < 32)
1382
+ return fromBits(
1383
+ (this.low >>> numBits) | (this.high << (32 - numBits)),
1384
+ this.high >>> numBits,
1385
+ this.unsigned,
1386
+ );
1387
+ if (numBits === 32) return fromBits(this.high, 0, this.unsigned);
1388
+ return fromBits(this.high >>> (numBits - 32), 0, this.unsigned);
1389
+ };
1390
+
1391
+ /**
1392
+ * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.
1393
+ * @function
1394
+ * @param {number|!Long} numBits Number of bits
1395
+ * @returns {!Long} Shifted Long
1396
+ */
1397
+ LongPrototype.shru = LongPrototype.shiftRightUnsigned;
1398
+
1399
+ /**
1400
+ * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.
1401
+ * @function
1402
+ * @param {number|!Long} numBits Number of bits
1403
+ * @returns {!Long} Shifted Long
1404
+ */
1405
+ LongPrototype.shr_u = LongPrototype.shiftRightUnsigned;
1406
+
1407
+ /**
1408
+ * Returns this Long with bits rotated to the left by the given amount.
1409
+ * @this {!Long}
1410
+ * @param {number|!Long} numBits Number of bits
1411
+ * @returns {!Long} Rotated Long
1412
+ */
1413
+ LongPrototype.rotateLeft = function rotateLeft(numBits) {
1414
+ var b;
1415
+ if (isLong(numBits)) numBits = numBits.toInt();
1416
+ if ((numBits &= 63) === 0) return this;
1417
+ if (numBits === 32) return fromBits(this.high, this.low, this.unsigned);
1418
+ if (numBits < 32) {
1419
+ b = 32 - numBits;
1420
+ return fromBits(
1421
+ (this.low << numBits) | (this.high >>> b),
1422
+ (this.high << numBits) | (this.low >>> b),
1423
+ this.unsigned,
1424
+ );
1425
+ }
1426
+ numBits -= 32;
1288
1427
  b = 32 - numBits;
1289
- return fromBits(this.low << numBits | this.high >>> b, this.high << numBits | this.low >>> b, this.unsigned);
1290
- }
1291
-
1292
- numBits -= 32;
1293
- b = 32 - numBits;
1294
- return fromBits(this.high << numBits | this.low >>> b, this.low << numBits | this.high >>> b, this.unsigned);
1295
- };
1296
- /**
1297
- * Returns this Long with bits rotated to the left by the given amount. This is an alias of {@link Long#rotateLeft}.
1298
- * @function
1299
- * @param {number|!Long} numBits Number of bits
1300
- * @returns {!Long} Rotated Long
1301
- */
1302
-
1303
-
1304
- LongPrototype.rotl = LongPrototype.rotateLeft;
1305
- /**
1306
- * Returns this Long with bits rotated to the right by the given amount.
1307
- * @this {!Long}
1308
- * @param {number|!Long} numBits Number of bits
1309
- * @returns {!Long} Rotated Long
1310
- */
1311
-
1312
- LongPrototype.rotateRight = function rotateRight(numBits) {
1313
- var b;
1314
- if (isLong(numBits)) numBits = numBits.toInt();
1315
- if ((numBits &= 63) === 0) return this;
1316
- if (numBits === 32) return fromBits(this.high, this.low, this.unsigned);
1317
-
1318
- if (numBits < 32) {
1428
+ return fromBits(
1429
+ (this.high << numBits) | (this.low >>> b),
1430
+ (this.low << numBits) | (this.high >>> b),
1431
+ this.unsigned,
1432
+ );
1433
+ };
1434
+ /**
1435
+ * Returns this Long with bits rotated to the left by the given amount. This is an alias of {@link Long#rotateLeft}.
1436
+ * @function
1437
+ * @param {number|!Long} numBits Number of bits
1438
+ * @returns {!Long} Rotated Long
1439
+ */
1440
+ LongPrototype.rotl = LongPrototype.rotateLeft;
1441
+
1442
+ /**
1443
+ * Returns this Long with bits rotated to the right by the given amount.
1444
+ * @this {!Long}
1445
+ * @param {number|!Long} numBits Number of bits
1446
+ * @returns {!Long} Rotated Long
1447
+ */
1448
+ LongPrototype.rotateRight = function rotateRight(numBits) {
1449
+ var b;
1450
+ if (isLong(numBits)) numBits = numBits.toInt();
1451
+ if ((numBits &= 63) === 0) return this;
1452
+ if (numBits === 32) return fromBits(this.high, this.low, this.unsigned);
1453
+ if (numBits < 32) {
1454
+ b = 32 - numBits;
1455
+ return fromBits(
1456
+ (this.high << b) | (this.low >>> numBits),
1457
+ (this.low << b) | (this.high >>> numBits),
1458
+ this.unsigned,
1459
+ );
1460
+ }
1461
+ numBits -= 32;
1319
1462
  b = 32 - numBits;
1320
- return fromBits(this.high << b | this.low >>> numBits, this.low << b | this.high >>> numBits, this.unsigned);
1321
- }
1322
-
1323
- numBits -= 32;
1324
- b = 32 - numBits;
1325
- return fromBits(this.low << b | this.high >>> numBits, this.high << b | this.low >>> numBits, this.unsigned);
1326
- };
1327
- /**
1328
- * Returns this Long with bits rotated to the right by the given amount. This is an alias of {@link Long#rotateRight}.
1329
- * @function
1330
- * @param {number|!Long} numBits Number of bits
1331
- * @returns {!Long} Rotated Long
1332
- */
1333
-
1334
-
1335
- LongPrototype.rotr = LongPrototype.rotateRight;
1336
- /**
1337
- * Converts this Long to signed.
1338
- * @this {!Long}
1339
- * @returns {!Long} Signed long
1340
- */
1341
-
1342
- LongPrototype.toSigned = function toSigned() {
1343
- if (!this.unsigned) return this;
1344
- return fromBits(this.low, this.high, false);
1345
- };
1346
- /**
1347
- * Converts this Long to unsigned.
1348
- * @this {!Long}
1349
- * @returns {!Long} Unsigned long
1350
- */
1351
-
1352
-
1353
- LongPrototype.toUnsigned = function toUnsigned() {
1354
- if (this.unsigned) return this;
1355
- return fromBits(this.low, this.high, true);
1356
- };
1357
- /**
1358
- * Converts this Long to its byte representation.
1359
- * @param {boolean=} le Whether little or big endian, defaults to big endian
1360
- * @this {!Long}
1361
- * @returns {!Array.<number>} Byte representation
1362
- */
1363
-
1364
-
1365
- LongPrototype.toBytes = function toBytes(le) {
1366
- return le ? this.toBytesLE() : this.toBytesBE();
1367
- };
1368
- /**
1369
- * Converts this Long to its little endian byte representation.
1370
- * @this {!Long}
1371
- * @returns {!Array.<number>} Little endian byte representation
1372
- */
1373
-
1374
-
1375
- LongPrototype.toBytesLE = function toBytesLE() {
1376
- var hi = this.high,
1463
+ return fromBits(
1464
+ (this.low << b) | (this.high >>> numBits),
1465
+ (this.high << b) | (this.low >>> numBits),
1466
+ this.unsigned,
1467
+ );
1468
+ };
1469
+ /**
1470
+ * Returns this Long with bits rotated to the right by the given amount. This is an alias of {@link Long#rotateRight}.
1471
+ * @function
1472
+ * @param {number|!Long} numBits Number of bits
1473
+ * @returns {!Long} Rotated Long
1474
+ */
1475
+ LongPrototype.rotr = LongPrototype.rotateRight;
1476
+
1477
+ /**
1478
+ * Converts this Long to signed.
1479
+ * @this {!Long}
1480
+ * @returns {!Long} Signed long
1481
+ */
1482
+ LongPrototype.toSigned = function toSigned() {
1483
+ if (!this.unsigned) return this;
1484
+ return fromBits(this.low, this.high, false);
1485
+ };
1486
+
1487
+ /**
1488
+ * Converts this Long to unsigned.
1489
+ * @this {!Long}
1490
+ * @returns {!Long} Unsigned long
1491
+ */
1492
+ LongPrototype.toUnsigned = function toUnsigned() {
1493
+ if (this.unsigned) return this;
1494
+ return fromBits(this.low, this.high, true);
1495
+ };
1496
+
1497
+ /**
1498
+ * Converts this Long to its byte representation.
1499
+ * @param {boolean=} le Whether little or big endian, defaults to big endian
1500
+ * @this {!Long}
1501
+ * @returns {!Array.<number>} Byte representation
1502
+ */
1503
+ LongPrototype.toBytes = function toBytes(le) {
1504
+ return le ? this.toBytesLE() : this.toBytesBE();
1505
+ };
1506
+
1507
+ /**
1508
+ * Converts this Long to its little endian byte representation.
1509
+ * @this {!Long}
1510
+ * @returns {!Array.<number>} Little endian byte representation
1511
+ */
1512
+ LongPrototype.toBytesLE = function toBytesLE() {
1513
+ var hi = this.high,
1377
1514
  lo = this.low;
1378
- return [lo & 0xff, lo >>> 8 & 0xff, lo >>> 16 & 0xff, lo >>> 24, hi & 0xff, hi >>> 8 & 0xff, hi >>> 16 & 0xff, hi >>> 24];
1379
- };
1380
- /**
1381
- * Converts this Long to its big endian byte representation.
1382
- * @this {!Long}
1383
- * @returns {!Array.<number>} Big endian byte representation
1384
- */
1385
-
1386
-
1387
- LongPrototype.toBytesBE = function toBytesBE() {
1388
- var hi = this.high,
1515
+ return [
1516
+ lo & 0xff,
1517
+ (lo >>> 8) & 0xff,
1518
+ (lo >>> 16) & 0xff,
1519
+ lo >>> 24,
1520
+ hi & 0xff,
1521
+ (hi >>> 8) & 0xff,
1522
+ (hi >>> 16) & 0xff,
1523
+ hi >>> 24,
1524
+ ];
1525
+ };
1526
+
1527
+ /**
1528
+ * Converts this Long to its big endian byte representation.
1529
+ * @this {!Long}
1530
+ * @returns {!Array.<number>} Big endian byte representation
1531
+ */
1532
+ LongPrototype.toBytesBE = function toBytesBE() {
1533
+ var hi = this.high,
1389
1534
  lo = this.low;
1390
- return [hi >>> 24, hi >>> 16 & 0xff, hi >>> 8 & 0xff, hi & 0xff, lo >>> 24, lo >>> 16 & 0xff, lo >>> 8 & 0xff, lo & 0xff];
1391
- };
1392
- /**
1393
- * Creates a Long from its byte representation.
1394
- * @param {!Array.<number>} bytes Byte representation
1395
- * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
1396
- * @param {boolean=} le Whether little or big endian, defaults to big endian
1397
- * @returns {Long} The corresponding Long value
1398
- */
1399
-
1400
-
1401
- Long.fromBytes = function fromBytes(bytes, unsigned, le) {
1402
- return le ? Long.fromBytesLE(bytes, unsigned) : Long.fromBytesBE(bytes, unsigned);
1403
- };
1404
- /**
1405
- * Creates a Long from its little endian byte representation.
1406
- * @param {!Array.<number>} bytes Little endian byte representation
1407
- * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
1408
- * @returns {Long} The corresponding Long value
1409
- */
1410
-
1411
-
1412
- Long.fromBytesLE = function fromBytesLE(bytes, unsigned) {
1413
- return new Long(bytes[0] | bytes[1] << 8 | bytes[2] << 16 | bytes[3] << 24, bytes[4] | bytes[5] << 8 | bytes[6] << 16 | bytes[7] << 24, unsigned);
1414
- };
1415
- /**
1416
- * Creates a Long from its big endian byte representation.
1417
- * @param {!Array.<number>} bytes Big endian byte representation
1418
- * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
1419
- * @returns {Long} The corresponding Long value
1420
- */
1421
-
1422
-
1423
- Long.fromBytesBE = function fromBytesBE(bytes, unsigned) {
1424
- return new Long(bytes[4] << 24 | bytes[5] << 16 | bytes[6] << 8 | bytes[7], bytes[0] << 24 | bytes[1] << 16 | bytes[2] << 8 | bytes[3], unsigned);
1425
- };
1426
-
1427
- var _default = Long;
1428
- exports.default = _default;
1429
- return "default" in exports ? exports.default : exports;
1430
- })({});
1431
- if (typeof define === 'function' && define.amd) define([], function() { return Long; });
1432
- else if (typeof module === 'object' && typeof exports === 'object') module.exports = Long;
1535
+ return [
1536
+ hi >>> 24,
1537
+ (hi >>> 16) & 0xff,
1538
+ (hi >>> 8) & 0xff,
1539
+ hi & 0xff,
1540
+ lo >>> 24,
1541
+ (lo >>> 16) & 0xff,
1542
+ (lo >>> 8) & 0xff,
1543
+ lo & 0xff,
1544
+ ];
1545
+ };
1546
+
1547
+ /**
1548
+ * Creates a Long from its byte representation.
1549
+ * @param {!Array.<number>} bytes Byte representation
1550
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
1551
+ * @param {boolean=} le Whether little or big endian, defaults to big endian
1552
+ * @returns {Long} The corresponding Long value
1553
+ */
1554
+ Long.fromBytes = function fromBytes(bytes, unsigned, le) {
1555
+ return le
1556
+ ? Long.fromBytesLE(bytes, unsigned)
1557
+ : Long.fromBytesBE(bytes, unsigned);
1558
+ };
1559
+
1560
+ /**
1561
+ * Creates a Long from its little endian byte representation.
1562
+ * @param {!Array.<number>} bytes Little endian byte representation
1563
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
1564
+ * @returns {Long} The corresponding Long value
1565
+ */
1566
+ Long.fromBytesLE = function fromBytesLE(bytes, unsigned) {
1567
+ return new Long(
1568
+ bytes[0] | (bytes[1] << 8) | (bytes[2] << 16) | (bytes[3] << 24),
1569
+ bytes[4] | (bytes[5] << 8) | (bytes[6] << 16) | (bytes[7] << 24),
1570
+ unsigned,
1571
+ );
1572
+ };
1573
+
1574
+ /**
1575
+ * Creates a Long from its big endian byte representation.
1576
+ * @param {!Array.<number>} bytes Big endian byte representation
1577
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
1578
+ * @returns {Long} The corresponding Long value
1579
+ */
1580
+ Long.fromBytesBE = function fromBytesBE(bytes, unsigned) {
1581
+ return new Long(
1582
+ (bytes[4] << 24) | (bytes[5] << 16) | (bytes[6] << 8) | bytes[7],
1583
+ (bytes[0] << 24) | (bytes[1] << 16) | (bytes[2] << 8) | bytes[3],
1584
+ unsigned,
1585
+ );
1586
+ };
1587
+
1588
+ // Support conversion to/from BigInt where available
1589
+ if (typeof BigInt === "function") {
1590
+ /**
1591
+ * Returns a Long representing the given big integer.
1592
+ * @function
1593
+ * @param {number} value The big integer value
1594
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
1595
+ * @returns {!Long} The corresponding Long value
1596
+ */
1597
+ Long.fromBigInt = function fromBigInt(value, unsigned) {
1598
+ var lowBits = Number(BigInt.asIntN(32, value));
1599
+ var highBits = Number(BigInt.asIntN(32, value >> BigInt(32)));
1600
+ return fromBits(lowBits, highBits, unsigned);
1601
+ };
1602
+
1603
+ // Override
1604
+ Long.fromValue = function fromValueWithBigInt(value, unsigned) {
1605
+ if (typeof value === "bigint") return Long.fromBigInt(value, unsigned);
1606
+ return fromValue(value, unsigned);
1607
+ };
1608
+
1609
+ /**
1610
+ * Converts the Long to its big integer representation.
1611
+ * @this {!Long}
1612
+ * @returns {bigint}
1613
+ */
1614
+ LongPrototype.toBigInt = function toBigInt() {
1615
+ var lowBigInt = BigInt(this.low >>> 0);
1616
+ var highBigInt = BigInt(this.unsigned ? this.high >>> 0 : this.high);
1617
+ return (highBigInt << BigInt(32)) | lowBigInt;
1618
+ };
1619
+ }
1620
+ var _default = (_exports.default = Long);
1621
+ },
1622
+ );