readability_js 0.0.1

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 (1607) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +18 -0
  3. data/.rspec +2 -0
  4. data/CHANGELOG.md +2 -0
  5. data/CODE_OF_CONDUCT.md +74 -0
  6. data/Gemfile +4 -0
  7. data/LICENSE +21 -0
  8. data/README.md +119 -0
  9. data/Rakefile +30 -0
  10. data/bin/console +14 -0
  11. data/bin/setup +8 -0
  12. data/cli/pry.rb +5 -0
  13. data/lib/custom_errors/error.rb +4 -0
  14. data/lib/readability_js/node/node_modules/.bin/tldts +1 -0
  15. data/lib/readability_js/node/node_modules/.yarn-integrity +67 -0
  16. data/lib/readability_js/node/node_modules/@asamuzakjp/css-color/LICENSE +21 -0
  17. data/lib/readability_js/node/node_modules/@asamuzakjp/css-color/README.md +316 -0
  18. data/lib/readability_js/node/node_modules/@asamuzakjp/css-color/dist/browser/css-color.min.js +220 -0
  19. data/lib/readability_js/node/node_modules/@asamuzakjp/css-color/dist/browser/css-color.min.js.map +1 -0
  20. data/lib/readability_js/node/node_modules/@asamuzakjp/css-color/dist/cjs/index.cjs +5666 -0
  21. data/lib/readability_js/node/node_modules/@asamuzakjp/css-color/dist/cjs/index.cjs.map +1 -0
  22. data/lib/readability_js/node/node_modules/@asamuzakjp/css-color/dist/cjs/index.d.cts +109 -0
  23. data/lib/readability_js/node/node_modules/@asamuzakjp/css-color/dist/esm/index.d.ts +17 -0
  24. data/lib/readability_js/node/node_modules/@asamuzakjp/css-color/dist/esm/index.js +27 -0
  25. data/lib/readability_js/node/node_modules/@asamuzakjp/css-color/dist/esm/index.js.map +1 -0
  26. data/lib/readability_js/node/node_modules/@asamuzakjp/css-color/dist/esm/js/cache.d.ts +44 -0
  27. data/lib/readability_js/node/node_modules/@asamuzakjp/css-color/dist/esm/js/cache.js +82 -0
  28. data/lib/readability_js/node/node_modules/@asamuzakjp/css-color/dist/esm/js/cache.js.map +1 -0
  29. data/lib/readability_js/node/node_modules/@asamuzakjp/css-color/dist/esm/js/color.d.ts +537 -0
  30. data/lib/readability_js/node/node_modules/@asamuzakjp/css-color/dist/esm/js/color.js +2833 -0
  31. data/lib/readability_js/node/node_modules/@asamuzakjp/css-color/dist/esm/js/color.js.map +1 -0
  32. data/lib/readability_js/node/node_modules/@asamuzakjp/css-color/dist/esm/js/common.d.ts +21 -0
  33. data/lib/readability_js/node/node_modules/@asamuzakjp/css-color/dist/esm/js/common.js +7 -0
  34. data/lib/readability_js/node/node_modules/@asamuzakjp/css-color/dist/esm/js/common.js.map +1 -0
  35. data/lib/readability_js/node/node_modules/@asamuzakjp/css-color/dist/esm/js/constant.d.ts +43 -0
  36. data/lib/readability_js/node/node_modules/@asamuzakjp/css-color/dist/esm/js/constant.js +101 -0
  37. data/lib/readability_js/node/node_modules/@asamuzakjp/css-color/dist/esm/js/constant.js.map +1 -0
  38. data/lib/readability_js/node/node_modules/@asamuzakjp/css-color/dist/esm/js/convert.d.ts +99 -0
  39. data/lib/readability_js/node/node_modules/@asamuzakjp/css-color/dist/esm/js/convert.js +361 -0
  40. data/lib/readability_js/node/node_modules/@asamuzakjp/css-color/dist/esm/js/convert.js.map +1 -0
  41. data/lib/readability_js/node/node_modules/@asamuzakjp/css-color/dist/esm/js/css-calc.d.ts +89 -0
  42. data/lib/readability_js/node/node_modules/@asamuzakjp/css-color/dist/esm/js/css-calc.js +860 -0
  43. data/lib/readability_js/node/node_modules/@asamuzakjp/css-color/dist/esm/js/css-calc.js.map +1 -0
  44. data/lib/readability_js/node/node_modules/@asamuzakjp/css-color/dist/esm/js/css-gradient.d.ts +79 -0
  45. data/lib/readability_js/node/node_modules/@asamuzakjp/css-color/dist/esm/js/css-gradient.js +261 -0
  46. data/lib/readability_js/node/node_modules/@asamuzakjp/css-color/dist/esm/js/css-gradient.js.map +1 -0
  47. data/lib/readability_js/node/node_modules/@asamuzakjp/css-color/dist/esm/js/css-var.d.ts +31 -0
  48. data/lib/readability_js/node/node_modules/@asamuzakjp/css-color/dist/esm/js/css-var.js +195 -0
  49. data/lib/readability_js/node/node_modules/@asamuzakjp/css-color/dist/esm/js/css-var.js.map +1 -0
  50. data/lib/readability_js/node/node_modules/@asamuzakjp/css-color/dist/esm/js/relative-color.d.ts +29 -0
  51. data/lib/readability_js/node/node_modules/@asamuzakjp/css-color/dist/esm/js/relative-color.js +507 -0
  52. data/lib/readability_js/node/node_modules/@asamuzakjp/css-color/dist/esm/js/relative-color.js.map +1 -0
  53. data/lib/readability_js/node/node_modules/@asamuzakjp/css-color/dist/esm/js/resolve.d.ts +52 -0
  54. data/lib/readability_js/node/node_modules/@asamuzakjp/css-color/dist/esm/js/resolve.js +350 -0
  55. data/lib/readability_js/node/node_modules/@asamuzakjp/css-color/dist/esm/js/resolve.js.map +1 -0
  56. data/lib/readability_js/node/node_modules/@asamuzakjp/css-color/dist/esm/js/typedef.d.ts +80 -0
  57. data/lib/readability_js/node/node_modules/@asamuzakjp/css-color/dist/esm/js/util.d.ts +45 -0
  58. data/lib/readability_js/node/node_modules/@asamuzakjp/css-color/dist/esm/js/util.js +279 -0
  59. data/lib/readability_js/node/node_modules/@asamuzakjp/css-color/dist/esm/js/util.js.map +1 -0
  60. data/lib/readability_js/node/node_modules/@asamuzakjp/css-color/package.json +82 -0
  61. data/lib/readability_js/node/node_modules/@asamuzakjp/css-color/src/index.ts +24 -0
  62. data/lib/readability_js/node/node_modules/@asamuzakjp/css-color/src/js/cache.ts +114 -0
  63. data/lib/readability_js/node/node_modules/@asamuzakjp/css-color/src/js/color.ts +3511 -0
  64. data/lib/readability_js/node/node_modules/@asamuzakjp/css-color/src/js/common.ts +31 -0
  65. data/lib/readability_js/node/node_modules/@asamuzakjp/css-color/src/js/constant.ts +68 -0
  66. data/lib/readability_js/node/node_modules/@asamuzakjp/css-color/src/js/convert.ts +469 -0
  67. data/lib/readability_js/node/node_modules/@asamuzakjp/css-color/src/js/css-calc.ts +965 -0
  68. data/lib/readability_js/node/node_modules/@asamuzakjp/css-color/src/js/css-gradient.ts +384 -0
  69. data/lib/readability_js/node/node_modules/@asamuzakjp/css-color/src/js/css-var.ts +250 -0
  70. data/lib/readability_js/node/node_modules/@asamuzakjp/css-color/src/js/relative-color.ts +603 -0
  71. data/lib/readability_js/node/node_modules/@asamuzakjp/css-color/src/js/resolve.ts +443 -0
  72. data/lib/readability_js/node/node_modules/@asamuzakjp/css-color/src/js/typedef.ts +88 -0
  73. data/lib/readability_js/node/node_modules/@asamuzakjp/css-color/src/js/util.ts +336 -0
  74. data/lib/readability_js/node/node_modules/@asamuzakjp/dom-selector/LICENSE +21 -0
  75. data/lib/readability_js/node/node_modules/@asamuzakjp/dom-selector/README.md +324 -0
  76. data/lib/readability_js/node/node_modules/@asamuzakjp/dom-selector/dist/cjs/index.cjs +4613 -0
  77. data/lib/readability_js/node/node_modules/@asamuzakjp/dom-selector/dist/cjs/index.cjs.map +1 -0
  78. data/lib/readability_js/node/node_modules/@asamuzakjp/dom-selector/dist/cjs/index.d.cts +16 -0
  79. data/lib/readability_js/node/node_modules/@asamuzakjp/dom-selector/package.json +83 -0
  80. data/lib/readability_js/node/node_modules/@asamuzakjp/dom-selector/src/index.js +353 -0
  81. data/lib/readability_js/node/node_modules/@asamuzakjp/dom-selector/src/js/constant.js +129 -0
  82. data/lib/readability_js/node/node_modules/@asamuzakjp/dom-selector/src/js/finder.js +3108 -0
  83. data/lib/readability_js/node/node_modules/@asamuzakjp/dom-selector/src/js/matcher.js +587 -0
  84. data/lib/readability_js/node/node_modules/@asamuzakjp/dom-selector/src/js/parser.js +431 -0
  85. data/lib/readability_js/node/node_modules/@asamuzakjp/dom-selector/src/js/utility.js +1107 -0
  86. data/lib/readability_js/node/node_modules/@asamuzakjp/dom-selector/types/index.d.ts +14 -0
  87. data/lib/readability_js/node/node_modules/@asamuzakjp/dom-selector/types/js/constant.d.ts +79 -0
  88. data/lib/readability_js/node/node_modules/@asamuzakjp/dom-selector/types/js/finder.d.ts +64 -0
  89. data/lib/readability_js/node/node_modules/@asamuzakjp/dom-selector/types/js/matcher.d.ts +16 -0
  90. data/lib/readability_js/node/node_modules/@asamuzakjp/dom-selector/types/js/parser.d.ts +14 -0
  91. data/lib/readability_js/node/node_modules/@asamuzakjp/dom-selector/types/js/utility.d.ts +30 -0
  92. data/lib/readability_js/node/node_modules/@asamuzakjp/nwsapi/LICENSE +22 -0
  93. data/lib/readability_js/node/node_modules/@asamuzakjp/nwsapi/README.md +132 -0
  94. data/lib/readability_js/node/node_modules/@asamuzakjp/nwsapi/package.json +43 -0
  95. data/lib/readability_js/node/node_modules/@asamuzakjp/nwsapi/src/nwsapi.js +1855 -0
  96. data/lib/readability_js/node/node_modules/@csstools/color-helpers/CHANGELOG.md +10 -0
  97. data/lib/readability_js/node/node_modules/@csstools/color-helpers/LICENSE.md +18 -0
  98. data/lib/readability_js/node/node_modules/@csstools/color-helpers/README.md +32 -0
  99. data/lib/readability_js/node/node_modules/@csstools/color-helpers/dist/index.cjs +263 -0
  100. data/lib/readability_js/node/node_modules/@csstools/color-helpers/dist/index.d.ts +429 -0
  101. data/lib/readability_js/node/node_modules/@csstools/color-helpers/dist/index.mjs +263 -0
  102. data/lib/readability_js/node/node_modules/@csstools/color-helpers/package.json +62 -0
  103. data/lib/readability_js/node/node_modules/@csstools/css-calc/CHANGELOG.md +10 -0
  104. data/lib/readability_js/node/node_modules/@csstools/css-calc/LICENSE.md +20 -0
  105. data/lib/readability_js/node/node_modules/@csstools/css-calc/README.md +132 -0
  106. data/lib/readability_js/node/node_modules/@csstools/css-calc/dist/index.cjs +1 -0
  107. data/lib/readability_js/node/node_modules/@csstools/css-calc/dist/index.d.ts +71 -0
  108. data/lib/readability_js/node/node_modules/@csstools/css-calc/dist/index.mjs +1 -0
  109. data/lib/readability_js/node/node_modules/@csstools/css-calc/package.json +66 -0
  110. data/lib/readability_js/node/node_modules/@csstools/css-color-parser/CHANGELOG.md +13 -0
  111. data/lib/readability_js/node/node_modules/@csstools/css-color-parser/LICENSE.md +20 -0
  112. data/lib/readability_js/node/node_modules/@csstools/css-color-parser/README.md +37 -0
  113. data/lib/readability_js/node/node_modules/@csstools/css-color-parser/dist/index.cjs +1 -0
  114. data/lib/readability_js/node/node_modules/@csstools/css-color-parser/dist/index.d.ts +168 -0
  115. data/lib/readability_js/node/node_modules/@csstools/css-color-parser/dist/index.mjs +1 -0
  116. data/lib/readability_js/node/node_modules/@csstools/css-color-parser/package.json +71 -0
  117. data/lib/readability_js/node/node_modules/@csstools/css-parser-algorithms/CHANGELOG.md +9 -0
  118. data/lib/readability_js/node/node_modules/@csstools/css-parser-algorithms/LICENSE.md +20 -0
  119. data/lib/readability_js/node/node_modules/@csstools/css-parser-algorithms/README.md +119 -0
  120. data/lib/readability_js/node/node_modules/@csstools/css-parser-algorithms/dist/index.cjs +1 -0
  121. data/lib/readability_js/node/node_modules/@csstools/css-parser-algorithms/dist/index.d.ts +604 -0
  122. data/lib/readability_js/node/node_modules/@csstools/css-parser-algorithms/dist/index.mjs +1 -0
  123. data/lib/readability_js/node/node_modules/@csstools/css-parser-algorithms/package.json +65 -0
  124. data/lib/readability_js/node/node_modules/@csstools/css-syntax-patches-for-csstree/CHANGELOG.md +9 -0
  125. data/lib/readability_js/node/node_modules/@csstools/css-syntax-patches-for-csstree/LICENSE.md +18 -0
  126. data/lib/readability_js/node/node_modules/@csstools/css-syntax-patches-for-csstree/README.md +43 -0
  127. data/lib/readability_js/node/node_modules/@csstools/css-syntax-patches-for-csstree/dist/index.d.ts +5 -0
  128. data/lib/readability_js/node/node_modules/@csstools/css-syntax-patches-for-csstree/dist/index.json +765 -0
  129. data/lib/readability_js/node/node_modules/@csstools/css-syntax-patches-for-csstree/package.json +54 -0
  130. data/lib/readability_js/node/node_modules/@csstools/css-tokenizer/CHANGELOG.md +9 -0
  131. data/lib/readability_js/node/node_modules/@csstools/css-tokenizer/LICENSE.md +20 -0
  132. data/lib/readability_js/node/node_modules/@csstools/css-tokenizer/README.md +111 -0
  133. data/lib/readability_js/node/node_modules/@csstools/css-tokenizer/dist/index.cjs +1 -0
  134. data/lib/readability_js/node/node_modules/@csstools/css-tokenizer/dist/index.d.ts +593 -0
  135. data/lib/readability_js/node/node_modules/@csstools/css-tokenizer/dist/index.mjs +1 -0
  136. data/lib/readability_js/node/node_modules/@csstools/css-tokenizer/package.json +62 -0
  137. data/lib/readability_js/node/node_modules/@mozilla/readability/.prettierrc.js +13 -0
  138. data/lib/readability_js/node/node_modules/@mozilla/readability/CHANGELOG.md +104 -0
  139. data/lib/readability_js/node/node_modules/@mozilla/readability/CODE_OF_CONDUCT.md +15 -0
  140. data/lib/readability_js/node/node_modules/@mozilla/readability/CONTRIBUTING.md +78 -0
  141. data/lib/readability_js/node/node_modules/@mozilla/readability/JSDOMParser.js +1278 -0
  142. data/lib/readability_js/node/node_modules/@mozilla/readability/LICENSE.md +13 -0
  143. data/lib/readability_js/node/node_modules/@mozilla/readability/README.md +129 -0
  144. data/lib/readability_js/node/node_modules/@mozilla/readability/Readability-readerable.js +122 -0
  145. data/lib/readability_js/node/node_modules/@mozilla/readability/Readability.js +2786 -0
  146. data/lib/readability_js/node/node_modules/@mozilla/readability/SECURITY.md +8 -0
  147. data/lib/readability_js/node/node_modules/@mozilla/readability/eslint.config.mjs +55 -0
  148. data/lib/readability_js/node/node_modules/@mozilla/readability/index.d.ts +64 -0
  149. data/lib/readability_js/node/node_modules/@mozilla/readability/index.js +8 -0
  150. data/lib/readability_js/node/node_modules/@mozilla/readability/package.json +41 -0
  151. data/lib/readability_js/node/node_modules/agent-base/LICENSE +22 -0
  152. data/lib/readability_js/node/node_modules/agent-base/README.md +69 -0
  153. data/lib/readability_js/node/node_modules/agent-base/dist/helpers.d.ts +15 -0
  154. data/lib/readability_js/node/node_modules/agent-base/dist/helpers.d.ts.map +1 -0
  155. data/lib/readability_js/node/node_modules/agent-base/dist/helpers.js +66 -0
  156. data/lib/readability_js/node/node_modules/agent-base/dist/helpers.js.map +1 -0
  157. data/lib/readability_js/node/node_modules/agent-base/dist/index.d.ts +41 -0
  158. data/lib/readability_js/node/node_modules/agent-base/dist/index.d.ts.map +1 -0
  159. data/lib/readability_js/node/node_modules/agent-base/dist/index.js +178 -0
  160. data/lib/readability_js/node/node_modules/agent-base/dist/index.js.map +1 -0
  161. data/lib/readability_js/node/node_modules/agent-base/package.json +46 -0
  162. data/lib/readability_js/node/node_modules/bidi-js/LICENSE.txt +22 -0
  163. data/lib/readability_js/node/node_modules/bidi-js/README.md +133 -0
  164. data/lib/readability_js/node/node_modules/bidi-js/dist/bidi.js +1010 -0
  165. data/lib/readability_js/node/node_modules/bidi-js/dist/bidi.min.js +1 -0
  166. data/lib/readability_js/node/node_modules/bidi-js/dist/bidi.min.mjs +1 -0
  167. data/lib/readability_js/node/node_modules/bidi-js/dist/bidi.mjs +1002 -0
  168. data/lib/readability_js/node/node_modules/bidi-js/package.json +39 -0
  169. data/lib/readability_js/node/node_modules/bidi-js/src/brackets.js +30 -0
  170. data/lib/readability_js/node/node_modules/bidi-js/src/charTypes.js +66 -0
  171. data/lib/readability_js/node/node_modules/bidi-js/src/data/bidiBrackets.data.js +5 -0
  172. data/lib/readability_js/node/node_modules/bidi-js/src/data/bidiCharTypes.data.js +25 -0
  173. data/lib/readability_js/node/node_modules/bidi-js/src/data/bidiMirroring.data.js +2 -0
  174. data/lib/readability_js/node/node_modules/bidi-js/src/embeddingLevels.js +690 -0
  175. data/lib/readability_js/node/node_modules/bidi-js/src/index.js +5 -0
  176. data/lib/readability_js/node/node_modules/bidi-js/src/mirroring.js +48 -0
  177. data/lib/readability_js/node/node_modules/bidi-js/src/reordering.js +99 -0
  178. data/lib/readability_js/node/node_modules/bidi-js/src/util/parseCharacterMap.js +30 -0
  179. data/lib/readability_js/node/node_modules/css-tree/LICENSE +19 -0
  180. data/lib/readability_js/node/node_modules/css-tree/README.md +192 -0
  181. data/lib/readability_js/node/node_modules/css-tree/cjs/convertor/create.cjs +32 -0
  182. data/lib/readability_js/node/node_modules/css-tree/cjs/convertor/index.cjs +8 -0
  183. data/lib/readability_js/node/node_modules/css-tree/cjs/data-patch.cjs +7 -0
  184. data/lib/readability_js/node/node_modules/css-tree/cjs/data.cjs +120 -0
  185. data/lib/readability_js/node/node_modules/css-tree/cjs/definition-syntax/SyntaxError.cjs +16 -0
  186. data/lib/readability_js/node/node_modules/css-tree/cjs/definition-syntax/generate.cjs +139 -0
  187. data/lib/readability_js/node/node_modules/css-tree/cjs/definition-syntax/index.cjs +13 -0
  188. data/lib/readability_js/node/node_modules/css-tree/cjs/definition-syntax/parse.cjs +556 -0
  189. data/lib/readability_js/node/node_modules/css-tree/cjs/definition-syntax/scanner.cjs +113 -0
  190. data/lib/readability_js/node/node_modules/css-tree/cjs/definition-syntax/tokenizer.cjs +59 -0
  191. data/lib/readability_js/node/node_modules/css-tree/cjs/definition-syntax/walk.cjs +57 -0
  192. data/lib/readability_js/node/node_modules/css-tree/cjs/generator/create.cjs +102 -0
  193. data/lib/readability_js/node/node_modules/css-tree/cjs/generator/index.cjs +8 -0
  194. data/lib/readability_js/node/node_modules/css-tree/cjs/generator/sourceMap.cjs +96 -0
  195. data/lib/readability_js/node/node_modules/css-tree/cjs/generator/token-before.cjs +170 -0
  196. data/lib/readability_js/node/node_modules/css-tree/cjs/index.cjs +65 -0
  197. data/lib/readability_js/node/node_modules/css-tree/cjs/lexer/Lexer.cjs +517 -0
  198. data/lib/readability_js/node/node_modules/css-tree/cjs/lexer/error.cjs +128 -0
  199. data/lib/readability_js/node/node_modules/css-tree/cjs/lexer/generic-an-plus-b.cjs +235 -0
  200. data/lib/readability_js/node/node_modules/css-tree/cjs/lexer/generic-const.cjs +12 -0
  201. data/lib/readability_js/node/node_modules/css-tree/cjs/lexer/generic-urange.cjs +149 -0
  202. data/lib/readability_js/node/node_modules/css-tree/cjs/lexer/generic.cjs +589 -0
  203. data/lib/readability_js/node/node_modules/css-tree/cjs/lexer/index.cjs +7 -0
  204. data/lib/readability_js/node/node_modules/css-tree/cjs/lexer/match-graph.cjs +530 -0
  205. data/lib/readability_js/node/node_modules/css-tree/cjs/lexer/match.cjs +632 -0
  206. data/lib/readability_js/node/node_modules/css-tree/cjs/lexer/prepare-tokens.cjs +54 -0
  207. data/lib/readability_js/node/node_modules/css-tree/cjs/lexer/search.cjs +65 -0
  208. data/lib/readability_js/node/node_modules/css-tree/cjs/lexer/structure.cjs +173 -0
  209. data/lib/readability_js/node/node_modules/css-tree/cjs/lexer/trace.cjs +73 -0
  210. data/lib/readability_js/node/node_modules/css-tree/cjs/lexer/units.cjs +38 -0
  211. data/lib/readability_js/node/node_modules/css-tree/cjs/parser/SyntaxError.cjs +74 -0
  212. data/lib/readability_js/node/node_modules/css-tree/cjs/parser/create.cjs +340 -0
  213. data/lib/readability_js/node/node_modules/css-tree/cjs/parser/index.cjs +8 -0
  214. data/lib/readability_js/node/node_modules/css-tree/cjs/parser/parse-selector.cjs +8 -0
  215. data/lib/readability_js/node/node_modules/css-tree/cjs/parser/sequence.cjs +47 -0
  216. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/atrule/container.cjs +32 -0
  217. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/atrule/font-face.cjs +12 -0
  218. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/atrule/import.cjs +101 -0
  219. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/atrule/index.cjs +27 -0
  220. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/atrule/layer.cjs +16 -0
  221. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/atrule/media.cjs +16 -0
  222. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/atrule/nest.cjs +16 -0
  223. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/atrule/page.cjs +16 -0
  224. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/atrule/scope.cjs +16 -0
  225. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/atrule/starting-style.cjs +12 -0
  226. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/atrule/supports.cjs +16 -0
  227. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/config/generator.cjs +9 -0
  228. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/config/lexer.cjs +14 -0
  229. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/config/mix.cjs +127 -0
  230. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/config/parser-selector.cjs +19 -0
  231. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/config/parser.cjs +49 -0
  232. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/config/walker.cjs +9 -0
  233. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/create.cjs +58 -0
  234. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/function/expression.cjs +11 -0
  235. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/function/var.cjs +43 -0
  236. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/index.cjs +14 -0
  237. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/AnPlusB.cjs +293 -0
  238. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/Atrule.cjs +103 -0
  239. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/AtrulePrelude.cjs +52 -0
  240. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/AttributeSelector.cjs +148 -0
  241. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/Block.cjs +96 -0
  242. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/Brackets.cjs +38 -0
  243. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/CDC.cjs +26 -0
  244. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/CDO.cjs +26 -0
  245. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/ClassSelector.cjs +31 -0
  246. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/Combinator.cjs +61 -0
  247. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/Comment.cjs +40 -0
  248. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/Condition.cjs +120 -0
  249. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/Declaration.cjs +166 -0
  250. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/DeclarationList.cjs +62 -0
  251. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/Dimension.cjs +30 -0
  252. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/Feature.cjs +101 -0
  253. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/FeatureFunction.cjs +67 -0
  254. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/FeatureRange.cjs +133 -0
  255. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/Function.cjs +45 -0
  256. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/GeneralEnclosed.cjs +68 -0
  257. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/Hash.cjs +30 -0
  258. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/IdSelector.cjs +33 -0
  259. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/Identifier.cjs +25 -0
  260. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/Layer.cjs +35 -0
  261. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/LayerList.cjs +43 -0
  262. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/LayerName.cjs +34 -0
  263. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/LayerNameList.cjs +42 -0
  264. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/MediaCondition.cjs +70 -0
  265. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/MediaFeature.cjs +76 -0
  266. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/MediaFeatureRange.cjs +11 -0
  267. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/MediaQuery.cjs +100 -0
  268. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/MediaQueryList.cjs +41 -0
  269. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/NestingSelector.cjs +29 -0
  270. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/Nth.cjs +54 -0
  271. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/Number.cjs +25 -0
  272. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/Operator.cjs +28 -0
  273. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/Parentheses.cjs +38 -0
  274. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/Percentage.cjs +25 -0
  275. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/PseudoClassSelector.cjs +67 -0
  276. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/PseudoElementSelector.cjs +69 -0
  277. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/Ratio.cjs +71 -0
  278. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/Raw.cjs +48 -0
  279. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/Rule.cjs +58 -0
  280. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/Scope.cjs +69 -0
  281. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/Selector.cjs +38 -0
  282. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/SelectorList.cjs +43 -0
  283. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/String.cjs +26 -0
  284. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/StyleSheet.cjs +83 -0
  285. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/SupportsDeclaration.cjs +38 -0
  286. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/SupportsFeature.cjs +69 -0
  287. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/TypeSelector.cjs +59 -0
  288. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/UnicodeRange.cjs +158 -0
  289. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/Url.cjs +54 -0
  290. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/Value.cjs +26 -0
  291. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/WhiteSpace.cjs +34 -0
  292. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/common/feature-range.cjs +112 -0
  293. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/common/feature.cjs +76 -0
  294. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/index-generate.cjs +103 -0
  295. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/index-parse-selector.cjs +39 -0
  296. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/index-parse.cjs +103 -0
  297. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/node/index.cjs +103 -0
  298. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/pseudo/index.cjs +60 -0
  299. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/pseudo/lang.cjs +37 -0
  300. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/scope/atrulePrelude.cjs +9 -0
  301. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/scope/default.cjs +76 -0
  302. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/scope/index.cjs +11 -0
  303. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/scope/selector.cjs +88 -0
  304. data/lib/readability_js/node/node_modules/css-tree/cjs/syntax/scope/value.cjs +29 -0
  305. data/lib/readability_js/node/node_modules/css-tree/cjs/tokenizer/OffsetToLocation.cjs +91 -0
  306. data/lib/readability_js/node/node_modules/css-tree/cjs/tokenizer/TokenStream.cjs +308 -0
  307. data/lib/readability_js/node/node_modules/css-tree/cjs/tokenizer/adopt-buffer.cjs +13 -0
  308. data/lib/readability_js/node/node_modules/css-tree/cjs/tokenizer/char-code-definitions.cjs +236 -0
  309. data/lib/readability_js/node/node_modules/css-tree/cjs/tokenizer/index.cjs +554 -0
  310. data/lib/readability_js/node/node_modules/css-tree/cjs/tokenizer/names.cjs +32 -0
  311. data/lib/readability_js/node/node_modules/css-tree/cjs/tokenizer/types.cjs +57 -0
  312. data/lib/readability_js/node/node_modules/css-tree/cjs/tokenizer/utils.cjs +261 -0
  313. data/lib/readability_js/node/node_modules/css-tree/cjs/utils/List.cjs +473 -0
  314. data/lib/readability_js/node/node_modules/css-tree/cjs/utils/clone.cjs +25 -0
  315. data/lib/readability_js/node/node_modules/css-tree/cjs/utils/create-custom-error.cjs +18 -0
  316. data/lib/readability_js/node/node_modules/css-tree/cjs/utils/ident.cjs +102 -0
  317. data/lib/readability_js/node/node_modules/css-tree/cjs/utils/index.cjs +20 -0
  318. data/lib/readability_js/node/node_modules/css-tree/cjs/utils/names.cjs +113 -0
  319. data/lib/readability_js/node/node_modules/css-tree/cjs/utils/string.cjs +99 -0
  320. data/lib/readability_js/node/node_modules/css-tree/cjs/utils/url.cjs +108 -0
  321. data/lib/readability_js/node/node_modules/css-tree/cjs/version.cjs +5 -0
  322. data/lib/readability_js/node/node_modules/css-tree/cjs/walker/create.cjs +291 -0
  323. data/lib/readability_js/node/node_modules/css-tree/cjs/walker/index.cjs +8 -0
  324. data/lib/readability_js/node/node_modules/css-tree/data/patch.json +982 -0
  325. data/lib/readability_js/node/node_modules/css-tree/dist/csstree.esm.js +12 -0
  326. data/lib/readability_js/node/node_modules/css-tree/dist/csstree.js +12 -0
  327. data/lib/readability_js/node/node_modules/css-tree/dist/data.cjs +1308 -0
  328. data/lib/readability_js/node/node_modules/css-tree/dist/data.js +1308 -0
  329. data/lib/readability_js/node/node_modules/css-tree/dist/version.cjs +1 -0
  330. data/lib/readability_js/node/node_modules/css-tree/dist/version.js +1 -0
  331. data/lib/readability_js/node/node_modules/css-tree/lib/convertor/create.js +28 -0
  332. data/lib/readability_js/node/node_modules/css-tree/lib/convertor/index.js +4 -0
  333. data/lib/readability_js/node/node_modules/css-tree/lib/data-patch.js +6 -0
  334. data/lib/readability_js/node/node_modules/css-tree/lib/data.js +118 -0
  335. data/lib/readability_js/node/node_modules/css-tree/lib/definition-syntax/SyntaxError.js +12 -0
  336. data/lib/readability_js/node/node_modules/css-tree/lib/definition-syntax/generate.js +135 -0
  337. data/lib/readability_js/node/node_modules/css-tree/lib/definition-syntax/index.js +4 -0
  338. data/lib/readability_js/node/node_modules/css-tree/lib/definition-syntax/parse.js +552 -0
  339. data/lib/readability_js/node/node_modules/css-tree/lib/definition-syntax/scanner.js +109 -0
  340. data/lib/readability_js/node/node_modules/css-tree/lib/definition-syntax/walk.js +53 -0
  341. data/lib/readability_js/node/node_modules/css-tree/lib/generator/create.js +97 -0
  342. data/lib/readability_js/node/node_modules/css-tree/lib/generator/index.js +4 -0
  343. data/lib/readability_js/node/node_modules/css-tree/lib/generator/sourceMap.js +92 -0
  344. data/lib/readability_js/node/node_modules/css-tree/lib/generator/token-before.js +182 -0
  345. data/lib/readability_js/node/node_modules/css-tree/lib/index.js +30 -0
  346. data/lib/readability_js/node/node_modules/css-tree/lib/lexer/Lexer.js +511 -0
  347. data/lib/readability_js/node/node_modules/css-tree/lib/lexer/error.js +123 -0
  348. data/lib/readability_js/node/node_modules/css-tree/lib/lexer/generic-an-plus-b.js +238 -0
  349. data/lib/readability_js/node/node_modules/css-tree/lib/lexer/generic-const.js +8 -0
  350. data/lib/readability_js/node/node_modules/css-tree/lib/lexer/generic-urange.js +151 -0
  351. data/lib/readability_js/node/node_modules/css-tree/lib/lexer/generic.js +622 -0
  352. data/lib/readability_js/node/node_modules/css-tree/lib/lexer/index.js +1 -0
  353. data/lib/readability_js/node/node_modules/css-tree/lib/lexer/match-graph.js +527 -0
  354. data/lib/readability_js/node/node_modules/css-tree/lib/lexer/match.js +630 -0
  355. data/lib/readability_js/node/node_modules/css-tree/lib/lexer/prepare-tokens.js +50 -0
  356. data/lib/readability_js/node/node_modules/css-tree/lib/lexer/search.js +61 -0
  357. data/lib/readability_js/node/node_modules/css-tree/lib/lexer/structure.js +169 -0
  358. data/lib/readability_js/node/node_modules/css-tree/lib/lexer/trace.js +66 -0
  359. data/lib/readability_js/node/node_modules/css-tree/lib/lexer/units.js +27 -0
  360. data/lib/readability_js/node/node_modules/css-tree/lib/parser/SyntaxError.js +70 -0
  361. data/lib/readability_js/node/node_modules/css-tree/lib/parser/create.js +350 -0
  362. data/lib/readability_js/node/node_modules/css-tree/lib/parser/index.js +4 -0
  363. data/lib/readability_js/node/node_modules/css-tree/lib/parser/parse-selector.js +4 -0
  364. data/lib/readability_js/node/node_modules/css-tree/lib/parser/sequence.js +43 -0
  365. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/atrule/container.js +28 -0
  366. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/atrule/font-face.js +8 -0
  367. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/atrule/import.js +104 -0
  368. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/atrule/index.js +23 -0
  369. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/atrule/layer.js +12 -0
  370. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/atrule/media.js +12 -0
  371. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/atrule/nest.js +12 -0
  372. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/atrule/page.js +12 -0
  373. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/atrule/scope.js +12 -0
  374. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/atrule/starting-style.js +8 -0
  375. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/atrule/supports.js +12 -0
  376. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/config/generator.js +5 -0
  377. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/config/lexer.js +10 -0
  378. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/config/mix.js +123 -0
  379. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/config/parser-selector.js +15 -0
  380. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/config/parser.js +45 -0
  381. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/config/walker.js +5 -0
  382. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/create.js +55 -0
  383. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/function/expression.js +7 -0
  384. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/function/var.js +39 -0
  385. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/index.js +10 -0
  386. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/node/AnPlusB.js +292 -0
  387. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/node/Atrule.js +100 -0
  388. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/node/AtrulePrelude.js +47 -0
  389. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/node/AttributeSelector.js +147 -0
  390. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/node/Block.js +95 -0
  391. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/node/Brackets.js +35 -0
  392. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/node/CDC.js +19 -0
  393. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/node/CDO.js +19 -0
  394. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/node/ClassSelector.js +24 -0
  395. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/node/Combinator.js +54 -0
  396. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/node/Comment.js +33 -0
  397. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/node/Condition.js +123 -0
  398. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/node/Declaration.js +165 -0
  399. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/node/DeclarationList.js +62 -0
  400. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/node/Dimension.js +23 -0
  401. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/node/Feature.js +103 -0
  402. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/node/FeatureFunction.js +63 -0
  403. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/node/FeatureRange.js +133 -0
  404. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/node/Function.js +41 -0
  405. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/node/GeneralEnclosed.js +66 -0
  406. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/node/Hash.js +23 -0
  407. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/node/IdSelector.js +26 -0
  408. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/node/Identifier.js +18 -0
  409. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/node/Layer.js +28 -0
  410. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/node/LayerList.js +36 -0
  411. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/node/MediaQuery.js +102 -0
  412. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/node/MediaQueryList.js +34 -0
  413. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/node/NestingSelector.js +22 -0
  414. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/node/Nth.js +47 -0
  415. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/node/Number.js +18 -0
  416. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/node/Operator.js +21 -0
  417. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/node/Parentheses.js +34 -0
  418. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/node/Percentage.js +18 -0
  419. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/node/PseudoClassSelector.js +65 -0
  420. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/node/PseudoElementSelector.js +66 -0
  421. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/node/Ratio.js +68 -0
  422. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/node/Raw.js +41 -0
  423. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/node/Rule.js +51 -0
  424. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/node/Scope.js +66 -0
  425. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/node/Selector.js +31 -0
  426. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/node/SelectorList.js +35 -0
  427. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/node/String.js +19 -0
  428. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/node/StyleSheet.js +82 -0
  429. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/node/SupportsDeclaration.js +34 -0
  430. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/node/TypeSelector.js +52 -0
  431. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/node/UnicodeRange.js +156 -0
  432. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/node/Url.js +52 -0
  433. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/node/Value.js +19 -0
  434. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/node/WhiteSpace.js +27 -0
  435. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/node/index-generate.js +49 -0
  436. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/node/index-parse-selector.js +17 -0
  437. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/node/index-parse.js +49 -0
  438. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/node/index.js +49 -0
  439. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/pseudo/index.js +56 -0
  440. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/pseudo/lang.js +33 -0
  441. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/scope/atrulePrelude.js +5 -0
  442. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/scope/default.js +85 -0
  443. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/scope/index.js +3 -0
  444. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/scope/selector.js +94 -0
  445. data/lib/readability_js/node/node_modules/css-tree/lib/syntax/scope/value.js +25 -0
  446. data/lib/readability_js/node/node_modules/css-tree/lib/tokenizer/OffsetToLocation.js +87 -0
  447. data/lib/readability_js/node/node_modules/css-tree/lib/tokenizer/TokenStream.js +316 -0
  448. data/lib/readability_js/node/node_modules/css-tree/lib/tokenizer/adopt-buffer.js +9 -0
  449. data/lib/readability_js/node/node_modules/css-tree/lib/tokenizer/char-code-definitions.js +212 -0
  450. data/lib/readability_js/node/node_modules/css-tree/lib/tokenizer/index.js +513 -0
  451. data/lib/readability_js/node/node_modules/css-tree/lib/tokenizer/names.js +28 -0
  452. data/lib/readability_js/node/node_modules/css-tree/lib/tokenizer/types.js +28 -0
  453. data/lib/readability_js/node/node_modules/css-tree/lib/tokenizer/utils.js +254 -0
  454. data/lib/readability_js/node/node_modules/css-tree/lib/utils/List.js +469 -0
  455. data/lib/readability_js/node/node_modules/css-tree/lib/utils/clone.js +21 -0
  456. data/lib/readability_js/node/node_modules/css-tree/lib/utils/create-custom-error.js +14 -0
  457. data/lib/readability_js/node/node_modules/css-tree/lib/utils/ident.js +101 -0
  458. data/lib/readability_js/node/node_modules/css-tree/lib/utils/index.js +6 -0
  459. data/lib/readability_js/node/node_modules/css-tree/lib/utils/names.js +106 -0
  460. data/lib/readability_js/node/node_modules/css-tree/lib/utils/string.js +99 -0
  461. data/lib/readability_js/node/node_modules/css-tree/lib/utils/url.js +108 -0
  462. data/lib/readability_js/node/node_modules/css-tree/lib/version.js +5 -0
  463. data/lib/readability_js/node/node_modules/css-tree/lib/walker/create.js +287 -0
  464. data/lib/readability_js/node/node_modules/css-tree/lib/walker/index.js +4 -0
  465. data/lib/readability_js/node/node_modules/css-tree/package.json +125 -0
  466. data/lib/readability_js/node/node_modules/cssstyle/LICENSE +20 -0
  467. data/lib/readability_js/node/node_modules/cssstyle/README.md +11 -0
  468. data/lib/readability_js/node/node_modules/cssstyle/lib/CSSStyleDeclaration.js +636 -0
  469. data/lib/readability_js/node/node_modules/cssstyle/lib/generated/allProperties.js +653 -0
  470. data/lib/readability_js/node/node_modules/cssstyle/lib/generated/implementedProperties.js +2222 -0
  471. data/lib/readability_js/node/node_modules/cssstyle/lib/generated/properties.js +6951 -0
  472. data/lib/readability_js/node/node_modules/cssstyle/lib/normalize.js +1417 -0
  473. data/lib/readability_js/node/node_modules/cssstyle/lib/parsers.js +535 -0
  474. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/background.js +396 -0
  475. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/backgroundAttachment.js +64 -0
  476. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/backgroundClip.js +64 -0
  477. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/backgroundColor.js +55 -0
  478. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/backgroundImage.js +78 -0
  479. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/backgroundOrigin.js +64 -0
  480. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/backgroundPosition.js +193 -0
  481. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/backgroundRepeat.js +89 -0
  482. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/backgroundSize.js +120 -0
  483. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/border.js +164 -0
  484. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/borderBottom.js +156 -0
  485. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/borderBottomColor.js +60 -0
  486. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/borderBottomStyle.js +59 -0
  487. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/borderBottomWidth.js +69 -0
  488. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/borderCollapse.js +50 -0
  489. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/borderColor.js +116 -0
  490. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/borderLeft.js +156 -0
  491. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/borderLeftColor.js +60 -0
  492. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/borderLeftStyle.js +59 -0
  493. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/borderLeftWidth.js +69 -0
  494. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/borderRight.js +156 -0
  495. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/borderRightColor.js +60 -0
  496. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/borderRightStyle.js +59 -0
  497. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/borderRightWidth.js +69 -0
  498. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/borderSpacing.js +62 -0
  499. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/borderStyle.js +116 -0
  500. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/borderTop.js +156 -0
  501. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/borderTopColor.js +60 -0
  502. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/borderTopStyle.js +59 -0
  503. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/borderTopWidth.js +69 -0
  504. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/borderWidth.js +129 -0
  505. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/bottom.js +58 -0
  506. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/clear.js +50 -0
  507. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/clip.js +68 -0
  508. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/color.js +51 -0
  509. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/display.js +207 -0
  510. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/flex.js +176 -0
  511. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/flexBasis.js +62 -0
  512. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/flexGrow.js +61 -0
  513. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/flexShrink.js +61 -0
  514. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/float.js +50 -0
  515. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/floodColor.js +51 -0
  516. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/font.js +289 -0
  517. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/fontFamily.js +94 -0
  518. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/fontSize.js +64 -0
  519. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/fontStyle.js +63 -0
  520. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/fontVariant.js +73 -0
  521. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/fontWeight.js +68 -0
  522. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/height.js +58 -0
  523. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/left.js +58 -0
  524. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/lightingColor.js +51 -0
  525. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/lineHeight.js +66 -0
  526. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/margin.js +95 -0
  527. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/marginBottom.js +64 -0
  528. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/marginLeft.js +64 -0
  529. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/marginRight.js +64 -0
  530. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/marginTop.js +64 -0
  531. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/opacity.js +59 -0
  532. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/outlineColor.js +51 -0
  533. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/padding.js +93 -0
  534. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/paddingBottom.js +65 -0
  535. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/paddingLeft.js +65 -0
  536. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/paddingRight.js +65 -0
  537. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/paddingTop.js +65 -0
  538. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/right.js +58 -0
  539. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/stopColor.js +51 -0
  540. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/top.js +58 -0
  541. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/webkitBorderAfterColor.js +51 -0
  542. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/webkitBorderBeforeColor.js +51 -0
  543. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/webkitBorderEndColor.js +51 -0
  544. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/webkitBorderStartColor.js +51 -0
  545. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/webkitColumnRuleColor.js +51 -0
  546. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/webkitTapHighlightColor.js +51 -0
  547. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/webkitTextEmphasisColor.js +51 -0
  548. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/webkitTextFillColor.js +51 -0
  549. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/webkitTextStrokeColor.js +51 -0
  550. data/lib/readability_js/node/node_modules/cssstyle/lib/properties/width.js +58 -0
  551. data/lib/readability_js/node/node_modules/cssstyle/lib/utils/allExtraProperties.js +155 -0
  552. data/lib/readability_js/node/node_modules/cssstyle/lib/utils/camelize.js +37 -0
  553. data/lib/readability_js/node/node_modules/cssstyle/lib/utils/propertyDescriptors.js +19 -0
  554. data/lib/readability_js/node/node_modules/cssstyle/lib/utils/strings.js +167 -0
  555. data/lib/readability_js/node/node_modules/cssstyle/package.json +74 -0
  556. data/lib/readability_js/node/node_modules/data-urls/LICENSE.txt +7 -0
  557. data/lib/readability_js/node/node_modules/data-urls/README.md +62 -0
  558. data/lib/readability_js/node/node_modules/data-urls/lib/parser.js +69 -0
  559. data/lib/readability_js/node/node_modules/data-urls/lib/utils.js +20 -0
  560. data/lib/readability_js/node/node_modules/data-urls/package.json +52 -0
  561. data/lib/readability_js/node/node_modules/debug/LICENSE +20 -0
  562. data/lib/readability_js/node/node_modules/debug/README.md +481 -0
  563. data/lib/readability_js/node/node_modules/debug/package.json +64 -0
  564. data/lib/readability_js/node/node_modules/debug/src/browser.js +272 -0
  565. data/lib/readability_js/node/node_modules/debug/src/common.js +292 -0
  566. data/lib/readability_js/node/node_modules/debug/src/index.js +10 -0
  567. data/lib/readability_js/node/node_modules/debug/src/node.js +263 -0
  568. data/lib/readability_js/node/node_modules/decimal.js/LICENCE.md +23 -0
  569. data/lib/readability_js/node/node_modules/decimal.js/README.md +246 -0
  570. data/lib/readability_js/node/node_modules/decimal.js/decimal.d.ts +301 -0
  571. data/lib/readability_js/node/node_modules/decimal.js/decimal.js +4951 -0
  572. data/lib/readability_js/node/node_modules/decimal.js/decimal.mjs +4914 -0
  573. data/lib/readability_js/node/node_modules/decimal.js/package.json +55 -0
  574. data/lib/readability_js/node/node_modules/entities/LICENSE +11 -0
  575. data/lib/readability_js/node/node_modules/entities/decode.d.ts +1 -0
  576. data/lib/readability_js/node/node_modules/entities/decode.js +3 -0
  577. data/lib/readability_js/node/node_modules/entities/dist/commonjs/decode-codepoint.d.ts +19 -0
  578. data/lib/readability_js/node/node_modules/entities/dist/commonjs/decode-codepoint.d.ts.map +1 -0
  579. data/lib/readability_js/node/node_modules/entities/dist/commonjs/decode-codepoint.js +77 -0
  580. data/lib/readability_js/node/node_modules/entities/dist/commonjs/decode-codepoint.js.map +1 -0
  581. data/lib/readability_js/node/node_modules/entities/dist/commonjs/decode.d.ts +209 -0
  582. data/lib/readability_js/node/node_modules/entities/dist/commonjs/decode.d.ts.map +1 -0
  583. data/lib/readability_js/node/node_modules/entities/dist/commonjs/decode.js +511 -0
  584. data/lib/readability_js/node/node_modules/entities/dist/commonjs/decode.js.map +1 -0
  585. data/lib/readability_js/node/node_modules/entities/dist/commonjs/encode.d.ts +22 -0
  586. data/lib/readability_js/node/node_modules/entities/dist/commonjs/encode.d.ts.map +1 -0
  587. data/lib/readability_js/node/node_modules/entities/dist/commonjs/encode.js +73 -0
  588. data/lib/readability_js/node/node_modules/entities/dist/commonjs/encode.js.map +1 -0
  589. data/lib/readability_js/node/node_modules/entities/dist/commonjs/escape.d.ts +43 -0
  590. data/lib/readability_js/node/node_modules/entities/dist/commonjs/escape.d.ts.map +1 -0
  591. data/lib/readability_js/node/node_modules/entities/dist/commonjs/escape.js +121 -0
  592. data/lib/readability_js/node/node_modules/entities/dist/commonjs/escape.js.map +1 -0
  593. data/lib/readability_js/node/node_modules/entities/dist/commonjs/generated/decode-data-html.d.ts +2 -0
  594. data/lib/readability_js/node/node_modules/entities/dist/commonjs/generated/decode-data-html.d.ts.map +1 -0
  595. data/lib/readability_js/node/node_modules/entities/dist/commonjs/generated/decode-data-html.js +10 -0
  596. data/lib/readability_js/node/node_modules/entities/dist/commonjs/generated/decode-data-html.js.map +1 -0
  597. data/lib/readability_js/node/node_modules/entities/dist/commonjs/generated/decode-data-xml.d.ts +2 -0
  598. data/lib/readability_js/node/node_modules/entities/dist/commonjs/generated/decode-data-xml.d.ts.map +1 -0
  599. data/lib/readability_js/node/node_modules/entities/dist/commonjs/generated/decode-data-xml.js +10 -0
  600. data/lib/readability_js/node/node_modules/entities/dist/commonjs/generated/decode-data-xml.js.map +1 -0
  601. data/lib/readability_js/node/node_modules/entities/dist/commonjs/generated/encode-html.d.ts +8 -0
  602. data/lib/readability_js/node/node_modules/entities/dist/commonjs/generated/encode-html.d.ts.map +1 -0
  603. data/lib/readability_js/node/node_modules/entities/dist/commonjs/generated/encode-html.js +13 -0
  604. data/lib/readability_js/node/node_modules/entities/dist/commonjs/generated/encode-html.js.map +1 -0
  605. data/lib/readability_js/node/node_modules/entities/dist/commonjs/index.d.ts +96 -0
  606. data/lib/readability_js/node/node_modules/entities/dist/commonjs/index.d.ts.map +1 -0
  607. data/lib/readability_js/node/node_modules/entities/dist/commonjs/index.js +131 -0
  608. data/lib/readability_js/node/node_modules/entities/dist/commonjs/index.js.map +1 -0
  609. data/lib/readability_js/node/node_modules/entities/dist/commonjs/package.json +3 -0
  610. data/lib/readability_js/node/node_modules/entities/dist/esm/decode-codepoint.d.ts +19 -0
  611. data/lib/readability_js/node/node_modules/entities/dist/esm/decode-codepoint.d.ts.map +1 -0
  612. data/lib/readability_js/node/node_modules/entities/dist/esm/decode-codepoint.js +72 -0
  613. data/lib/readability_js/node/node_modules/entities/dist/esm/decode-codepoint.js.map +1 -0
  614. data/lib/readability_js/node/node_modules/entities/dist/esm/decode.d.ts +209 -0
  615. data/lib/readability_js/node/node_modules/entities/dist/esm/decode.d.ts.map +1 -0
  616. data/lib/readability_js/node/node_modules/entities/dist/esm/decode.js +497 -0
  617. data/lib/readability_js/node/node_modules/entities/dist/esm/decode.js.map +1 -0
  618. data/lib/readability_js/node/node_modules/entities/dist/esm/encode.d.ts +22 -0
  619. data/lib/readability_js/node/node_modules/entities/dist/esm/encode.d.ts.map +1 -0
  620. data/lib/readability_js/node/node_modules/entities/dist/esm/encode.js +69 -0
  621. data/lib/readability_js/node/node_modules/entities/dist/esm/encode.js.map +1 -0
  622. data/lib/readability_js/node/node_modules/entities/dist/esm/escape.d.ts +43 -0
  623. data/lib/readability_js/node/node_modules/entities/dist/esm/escape.d.ts.map +1 -0
  624. data/lib/readability_js/node/node_modules/entities/dist/esm/escape.js +117 -0
  625. data/lib/readability_js/node/node_modules/entities/dist/esm/escape.js.map +1 -0
  626. data/lib/readability_js/node/node_modules/entities/dist/esm/generated/decode-data-html.d.ts +2 -0
  627. data/lib/readability_js/node/node_modules/entities/dist/esm/generated/decode-data-html.d.ts.map +1 -0
  628. data/lib/readability_js/node/node_modules/entities/dist/esm/generated/decode-data-html.js +7 -0
  629. data/lib/readability_js/node/node_modules/entities/dist/esm/generated/decode-data-html.js.map +1 -0
  630. data/lib/readability_js/node/node_modules/entities/dist/esm/generated/decode-data-xml.d.ts +2 -0
  631. data/lib/readability_js/node/node_modules/entities/dist/esm/generated/decode-data-xml.d.ts.map +1 -0
  632. data/lib/readability_js/node/node_modules/entities/dist/esm/generated/decode-data-xml.js +7 -0
  633. data/lib/readability_js/node/node_modules/entities/dist/esm/generated/decode-data-xml.js.map +1 -0
  634. data/lib/readability_js/node/node_modules/entities/dist/esm/generated/encode-html.d.ts +8 -0
  635. data/lib/readability_js/node/node_modules/entities/dist/esm/generated/encode-html.d.ts.map +1 -0
  636. data/lib/readability_js/node/node_modules/entities/dist/esm/generated/encode-html.js +10 -0
  637. data/lib/readability_js/node/node_modules/entities/dist/esm/generated/encode-html.js.map +1 -0
  638. data/lib/readability_js/node/node_modules/entities/dist/esm/index.d.ts +96 -0
  639. data/lib/readability_js/node/node_modules/entities/dist/esm/index.d.ts.map +1 -0
  640. data/lib/readability_js/node/node_modules/entities/dist/esm/index.js +107 -0
  641. data/lib/readability_js/node/node_modules/entities/dist/esm/index.js.map +1 -0
  642. data/lib/readability_js/node/node_modules/entities/dist/esm/package.json +3 -0
  643. data/lib/readability_js/node/node_modules/entities/escape.d.ts +1 -0
  644. data/lib/readability_js/node/node_modules/entities/escape.js +3 -0
  645. data/lib/readability_js/node/node_modules/entities/package.json +118 -0
  646. data/lib/readability_js/node/node_modules/entities/readme.md +122 -0
  647. data/lib/readability_js/node/node_modules/entities/src/decode-codepoint.ts +81 -0
  648. data/lib/readability_js/node/node_modules/entities/src/decode.spec.ts +320 -0
  649. data/lib/readability_js/node/node_modules/entities/src/decode.ts +620 -0
  650. data/lib/readability_js/node/node_modules/entities/src/encode.spec.ts +78 -0
  651. data/lib/readability_js/node/node_modules/entities/src/encode.ts +77 -0
  652. data/lib/readability_js/node/node_modules/entities/src/escape.spec.ts +14 -0
  653. data/lib/readability_js/node/node_modules/entities/src/escape.ts +148 -0
  654. data/lib/readability_js/node/node_modules/entities/src/generated/.eslintrc.json +10 -0
  655. data/lib/readability_js/node/node_modules/entities/src/generated/decode-data-html.ts +8 -0
  656. data/lib/readability_js/node/node_modules/entities/src/generated/decode-data-xml.ts +8 -0
  657. data/lib/readability_js/node/node_modules/entities/src/generated/encode-html.ts +17 -0
  658. data/lib/readability_js/node/node_modules/entities/src/index.spec.ts +125 -0
  659. data/lib/readability_js/node/node_modules/entities/src/index.ts +188 -0
  660. data/lib/readability_js/node/node_modules/html-encoding-sniffer/LICENSE.txt +7 -0
  661. data/lib/readability_js/node/node_modules/html-encoding-sniffer/README.md +40 -0
  662. data/lib/readability_js/node/node_modules/html-encoding-sniffer/lib/html-encoding-sniffer.js +295 -0
  663. data/lib/readability_js/node/node_modules/html-encoding-sniffer/package.json +30 -0
  664. data/lib/readability_js/node/node_modules/http-proxy-agent/LICENSE +22 -0
  665. data/lib/readability_js/node/node_modules/http-proxy-agent/README.md +44 -0
  666. data/lib/readability_js/node/node_modules/http-proxy-agent/dist/index.d.ts +44 -0
  667. data/lib/readability_js/node/node_modules/http-proxy-agent/dist/index.d.ts.map +1 -0
  668. data/lib/readability_js/node/node_modules/http-proxy-agent/dist/index.js +148 -0
  669. data/lib/readability_js/node/node_modules/http-proxy-agent/dist/index.js.map +1 -0
  670. data/lib/readability_js/node/node_modules/http-proxy-agent/package.json +47 -0
  671. data/lib/readability_js/node/node_modules/https-proxy-agent/LICENSE +22 -0
  672. data/lib/readability_js/node/node_modules/https-proxy-agent/README.md +70 -0
  673. data/lib/readability_js/node/node_modules/https-proxy-agent/dist/index.d.ts +47 -0
  674. data/lib/readability_js/node/node_modules/https-proxy-agent/dist/index.d.ts.map +1 -0
  675. data/lib/readability_js/node/node_modules/https-proxy-agent/dist/index.js +180 -0
  676. data/lib/readability_js/node/node_modules/https-proxy-agent/dist/index.js.map +1 -0
  677. data/lib/readability_js/node/node_modules/https-proxy-agent/dist/parse-proxy-response.d.ts +15 -0
  678. data/lib/readability_js/node/node_modules/https-proxy-agent/dist/parse-proxy-response.d.ts.map +1 -0
  679. data/lib/readability_js/node/node_modules/https-proxy-agent/dist/parse-proxy-response.js +101 -0
  680. data/lib/readability_js/node/node_modules/https-proxy-agent/dist/parse-proxy-response.js.map +1 -0
  681. data/lib/readability_js/node/node_modules/https-proxy-agent/package.json +50 -0
  682. data/lib/readability_js/node/node_modules/iconv-lite/.github/dependabot.yml +11 -0
  683. data/lib/readability_js/node/node_modules/iconv-lite/.idea/codeStyles/Project.xml +47 -0
  684. data/lib/readability_js/node/node_modules/iconv-lite/.idea/codeStyles/codeStyleConfig.xml +5 -0
  685. data/lib/readability_js/node/node_modules/iconv-lite/.idea/iconv-lite.iml +12 -0
  686. data/lib/readability_js/node/node_modules/iconv-lite/.idea/inspectionProfiles/Project_Default.xml +6 -0
  687. data/lib/readability_js/node/node_modules/iconv-lite/.idea/modules.xml +8 -0
  688. data/lib/readability_js/node/node_modules/iconv-lite/.idea/vcs.xml +6 -0
  689. data/lib/readability_js/node/node_modules/iconv-lite/Changelog.md +212 -0
  690. data/lib/readability_js/node/node_modules/iconv-lite/LICENSE +21 -0
  691. data/lib/readability_js/node/node_modules/iconv-lite/README.md +130 -0
  692. data/lib/readability_js/node/node_modules/iconv-lite/encodings/dbcs-codec.js +597 -0
  693. data/lib/readability_js/node/node_modules/iconv-lite/encodings/dbcs-data.js +188 -0
  694. data/lib/readability_js/node/node_modules/iconv-lite/encodings/index.js +23 -0
  695. data/lib/readability_js/node/node_modules/iconv-lite/encodings/internal.js +198 -0
  696. data/lib/readability_js/node/node_modules/iconv-lite/encodings/sbcs-codec.js +72 -0
  697. data/lib/readability_js/node/node_modules/iconv-lite/encodings/sbcs-data-generated.js +451 -0
  698. data/lib/readability_js/node/node_modules/iconv-lite/encodings/sbcs-data.js +179 -0
  699. data/lib/readability_js/node/node_modules/iconv-lite/encodings/tables/big5-added.json +122 -0
  700. data/lib/readability_js/node/node_modules/iconv-lite/encodings/tables/cp936.json +264 -0
  701. data/lib/readability_js/node/node_modules/iconv-lite/encodings/tables/cp949.json +273 -0
  702. data/lib/readability_js/node/node_modules/iconv-lite/encodings/tables/cp950.json +177 -0
  703. data/lib/readability_js/node/node_modules/iconv-lite/encodings/tables/eucjp.json +182 -0
  704. data/lib/readability_js/node/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json +1 -0
  705. data/lib/readability_js/node/node_modules/iconv-lite/encodings/tables/gbk-added.json +56 -0
  706. data/lib/readability_js/node/node_modules/iconv-lite/encodings/tables/shiftjis.json +125 -0
  707. data/lib/readability_js/node/node_modules/iconv-lite/encodings/utf16.js +197 -0
  708. data/lib/readability_js/node/node_modules/iconv-lite/encodings/utf32.js +319 -0
  709. data/lib/readability_js/node/node_modules/iconv-lite/encodings/utf7.js +290 -0
  710. data/lib/readability_js/node/node_modules/iconv-lite/lib/bom-handling.js +52 -0
  711. data/lib/readability_js/node/node_modules/iconv-lite/lib/index.d.ts +41 -0
  712. data/lib/readability_js/node/node_modules/iconv-lite/lib/index.js +180 -0
  713. data/lib/readability_js/node/node_modules/iconv-lite/lib/streams.js +109 -0
  714. data/lib/readability_js/node/node_modules/iconv-lite/package.json +44 -0
  715. data/lib/readability_js/node/node_modules/is-potential-custom-element-name/LICENSE-MIT.txt +20 -0
  716. data/lib/readability_js/node/node_modules/is-potential-custom-element-name/README.md +40 -0
  717. data/lib/readability_js/node/node_modules/is-potential-custom-element-name/index.js +9 -0
  718. data/lib/readability_js/node/node_modules/is-potential-custom-element-name/package.json +35 -0
  719. data/lib/readability_js/node/node_modules/jsdom/LICENSE.txt +22 -0
  720. data/lib/readability_js/node/node_modules/jsdom/README.md +551 -0
  721. data/lib/readability_js/node/node_modules/jsdom/lib/api.js +335 -0
  722. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/browser/Window.js +1022 -0
  723. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/browser/default-stylesheet.css +415 -0
  724. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/browser/js-globals.json +312 -0
  725. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/browser/not-implemented.js +20 -0
  726. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/browser/parser/html.js +208 -0
  727. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/browser/parser/index.js +37 -0
  728. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/browser/parser/xml.js +202 -0
  729. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/browser/resources/async-resource-queue.js +114 -0
  730. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/browser/resources/no-op-resource-loader.js +8 -0
  731. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/browser/resources/per-document-resource-loader.js +98 -0
  732. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/browser/resources/request-manager.js +33 -0
  733. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/browser/resources/resource-loader.js +142 -0
  734. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/browser/resources/resource-queue.js +142 -0
  735. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/level2/style.js +57 -0
  736. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/level3/xpath.js +1875 -0
  737. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/aborting/AbortController-impl.js +17 -0
  738. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/aborting/AbortSignal-impl.js +131 -0
  739. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/attributes/Attr-impl.js +60 -0
  740. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/attributes/NamedNodeMap-impl.js +78 -0
  741. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/attributes.js +312 -0
  742. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/constraint-validation/DefaultConstraintValidation-impl.js +75 -0
  743. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/constraint-validation/ValidityState-impl.js +66 -0
  744. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/crypto/Crypto-impl.js +68 -0
  745. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/cssom/StyleSheetList-impl.js +38 -0
  746. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/custom-elements/CustomElementRegistry-impl.js +279 -0
  747. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/custom-elements/ElementInternals-impl.js +56 -0
  748. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/deviceorientation/DeviceMotionEventAcceleration-impl.js +7 -0
  749. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/deviceorientation/DeviceMotionEventRotationRate-impl.js +7 -0
  750. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/documents.js +15 -0
  751. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/domparsing/DOMParser-impl.js +59 -0
  752. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/domparsing/InnerHTML-impl.js +30 -0
  753. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/domparsing/XMLSerializer-impl.js +18 -0
  754. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/domparsing/parse5-adapter-serialization.js +63 -0
  755. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/domparsing/serialization.js +36 -0
  756. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/events/BeforeUnloadEvent-impl.js +12 -0
  757. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/events/BlobEvent-impl.js +14 -0
  758. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/events/CloseEvent-impl.js +10 -0
  759. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/events/CompositionEvent-impl.js +20 -0
  760. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/events/CustomEvent-impl.js +21 -0
  761. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/events/DeviceMotionEvent-impl.js +49 -0
  762. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/events/DeviceOrientationEvent-impl.js +10 -0
  763. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/events/ErrorEvent-impl.js +14 -0
  764. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/events/Event-impl.js +195 -0
  765. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/events/EventModifierMixin-impl.js +24 -0
  766. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js +438 -0
  767. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/events/FocusEvent-impl.js +9 -0
  768. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/events/HashChangeEvent-impl.js +14 -0
  769. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/events/InputEvent-impl.js +11 -0
  770. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/events/KeyboardEvent-impl.js +29 -0
  771. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/events/MessageEvent-impl.js +25 -0
  772. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/events/MouseEvent-impl.js +72 -0
  773. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/events/PageTransitionEvent-impl.js +20 -0
  774. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/events/PointerEvent-impl.js +21 -0
  775. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/events/PopStateEvent-impl.js +9 -0
  776. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/events/ProgressEvent-impl.js +14 -0
  777. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/events/PromiseRejectionEvent-impl.js +14 -0
  778. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/events/StorageEvent-impl.js +26 -0
  779. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/events/SubmitEvent-impl.js +13 -0
  780. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/events/TouchEvent-impl.js +14 -0
  781. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/events/TransitionEvent-impl.js +10 -0
  782. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/events/UIEvent-impl.js +43 -0
  783. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/events/WheelEvent-impl.js +12 -0
  784. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/fetch/Headers-impl.js +172 -0
  785. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/fetch/header-list.js +65 -0
  786. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/fetch/header-types.js +103 -0
  787. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/file-api/Blob-impl.js +93 -0
  788. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/file-api/File-impl.js +12 -0
  789. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/file-api/FileList-impl.js +15 -0
  790. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/file-api/FileReader-impl.js +130 -0
  791. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/AbortController.js +143 -0
  792. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/AbortSignal.js +249 -0
  793. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/AbstractRange.js +171 -0
  794. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/AddEventListenerOptions.js +53 -0
  795. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/AssignedNodesOptions.js +28 -0
  796. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/Attr.js +217 -0
  797. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/BarProp.js +117 -0
  798. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/BeforeUnloadEvent.js +139 -0
  799. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/BinaryType.js +12 -0
  800. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/Blob.js +211 -0
  801. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/BlobCallback.js +30 -0
  802. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/BlobEvent.js +157 -0
  803. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/BlobEventInit.js +43 -0
  804. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/BlobPropertyBag.js +42 -0
  805. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/CDATASection.js +109 -0
  806. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/CanPlayTypeResult.js +12 -0
  807. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/CharacterData.js +453 -0
  808. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/CloseEvent.js +168 -0
  809. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/CloseEventInit.js +65 -0
  810. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/Comment.js +120 -0
  811. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/CompositionEvent.js +219 -0
  812. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/CompositionEventInit.js +32 -0
  813. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/Crypto.js +148 -0
  814. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/CustomElementConstructor.js +34 -0
  815. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/CustomElementRegistry.js +267 -0
  816. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/CustomEvent.js +206 -0
  817. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/CustomEventInit.js +32 -0
  818. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/DOMException.js +222 -0
  819. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/DOMImplementation.js +237 -0
  820. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/DOMParser.js +140 -0
  821. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/DOMRect.js +276 -0
  822. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/DOMRectInit.js +76 -0
  823. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/DOMRectReadOnly.js +285 -0
  824. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/DOMStringMap.js +297 -0
  825. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/DOMTokenList.js +537 -0
  826. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/DeviceMotionEvent.js +183 -0
  827. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/DeviceMotionEventAcceleration.js +145 -0
  828. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/DeviceMotionEventAccelerationInit.js +61 -0
  829. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/DeviceMotionEventInit.js +70 -0
  830. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/DeviceMotionEventRotationRate.js +145 -0
  831. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/DeviceMotionEventRotationRateInit.js +61 -0
  832. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/DeviceOrientationEvent.js +183 -0
  833. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/DeviceOrientationEventInit.js +80 -0
  834. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/Document.js +4509 -0
  835. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/DocumentFragment.js +334 -0
  836. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/DocumentReadyState.js +12 -0
  837. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/DocumentType.js +252 -0
  838. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/Element.js +3718 -0
  839. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/ElementCreationOptions.js +26 -0
  840. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/ElementDefinitionOptions.js +29 -0
  841. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/ElementInternals.js +2150 -0
  842. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/EndingType.js +12 -0
  843. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/ErrorEvent.js +192 -0
  844. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/ErrorEventInit.js +92 -0
  845. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/Event.js +430 -0
  846. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/EventHandlerNonNull.js +36 -0
  847. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/EventInit.js +58 -0
  848. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/EventListener.js +35 -0
  849. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/EventListenerOptions.js +28 -0
  850. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/EventModifierInit.js +221 -0
  851. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js +259 -0
  852. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/External.js +130 -0
  853. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/File.js +185 -0
  854. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/FileList.js +298 -0
  855. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/FilePropertyBag.js +33 -0
  856. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/FileReader.js +468 -0
  857. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/FocusEvent.js +144 -0
  858. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/FocusEventInit.js +36 -0
  859. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/FormData.js +468 -0
  860. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/Function.js +42 -0
  861. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/GetRootNodeOptions.js +31 -0
  862. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLAnchorElement.js +1023 -0
  863. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLAreaElement.js +822 -0
  864. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLAudioElement.js +110 -0
  865. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLBRElement.js +153 -0
  866. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLBaseElement.js +193 -0
  867. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLBodyElement.js +877 -0
  868. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLButtonElement.js +522 -0
  869. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLCanvasElement.js +304 -0
  870. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLCollection.js +352 -0
  871. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLDListElement.js +156 -0
  872. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLDataElement.js +153 -0
  873. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLDataListElement.js +125 -0
  874. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLDetailsElement.js +156 -0
  875. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLDialogElement.js +156 -0
  876. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLDirectoryElement.js +156 -0
  877. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLDivElement.js +153 -0
  878. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLElement.js +3489 -0
  879. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLEmbedElement.js +378 -0
  880. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLFieldSetElement.js +329 -0
  881. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLFontElement.js +236 -0
  882. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLFormControlsCollection.js +318 -0
  883. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLFormElement.js +658 -0
  884. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLFrameElement.js +510 -0
  885. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLFrameSetElement.js +708 -0
  886. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLHRElement.js +320 -0
  887. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLHeadElement.js +110 -0
  888. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLHeadingElement.js +153 -0
  889. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLHtmlElement.js +153 -0
  890. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLIFrameElement.js +686 -0
  891. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLImageElement.js +902 -0
  892. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLInputElement.js +1927 -0
  893. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLLIElement.js +201 -0
  894. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLLabelElement.js +179 -0
  895. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLLegendElement.js +166 -0
  896. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLLinkElement.js +552 -0
  897. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLMapElement.js +168 -0
  898. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLMarqueeElement.js +554 -0
  899. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLMediaElement.js +898 -0
  900. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLMenuElement.js +156 -0
  901. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLMetaElement.js +276 -0
  902. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLMeterElement.js +365 -0
  903. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLModElement.js +214 -0
  904. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLOListElement.js +281 -0
  905. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLObjectElement.js +941 -0
  906. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLOptGroupElement.js +197 -0
  907. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLOptionElement.js +376 -0
  908. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLOptionsCollection.js +511 -0
  909. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLOutputElement.js +392 -0
  910. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLParagraphElement.js +153 -0
  911. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLParamElement.js +276 -0
  912. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLPictureElement.js +110 -0
  913. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLPreElement.js +160 -0
  914. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLProgressElement.js +228 -0
  915. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLQuoteElement.js +173 -0
  916. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLScriptElement.js +469 -0
  917. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLSelectElement.js +989 -0
  918. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLSlotElement.js +192 -0
  919. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLSourceElement.js +337 -0
  920. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLSpanElement.js +110 -0
  921. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLStyleElement.js +207 -0
  922. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLTableCaptionElement.js +153 -0
  923. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLTableCellElement.js +729 -0
  924. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLTableColElement.js +372 -0
  925. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLTableElement.js +799 -0
  926. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLTableRowElement.js +414 -0
  927. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLTableSectionElement.js +346 -0
  928. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLTemplateElement.js +123 -0
  929. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLTextAreaElement.js +1206 -0
  930. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLTimeElement.js +153 -0
  931. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLTitleElement.js +152 -0
  932. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLTrackElement.js +363 -0
  933. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLUListElement.js +197 -0
  934. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLUnknownElement.js +109 -0
  935. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HTMLVideoElement.js +340 -0
  936. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HashChangeEvent.js +157 -0
  937. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/HashChangeEventInit.js +50 -0
  938. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/Headers.js +418 -0
  939. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/History.js +266 -0
  940. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/InputEvent.js +168 -0
  941. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/InputEventInit.js +68 -0
  942. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/KeyboardEvent.js +445 -0
  943. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/KeyboardEventInit.js +116 -0
  944. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/Location.js +404 -0
  945. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/MessageEvent.js +317 -0
  946. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/MessageEventInit.js +100 -0
  947. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/MimeType.js +156 -0
  948. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/MimeTypeArray.js +326 -0
  949. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/MouseEvent.js +595 -0
  950. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/MouseEventInit.js +189 -0
  951. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/MutationCallback.js +34 -0
  952. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/MutationObserver.js +178 -0
  953. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/MutationObserverInit.js +121 -0
  954. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/MutationRecord.js +229 -0
  955. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/NamedNodeMap.js +527 -0
  956. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/Navigator.js +326 -0
  957. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/Node.js +763 -0
  958. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/NodeFilter.js +75 -0
  959. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/NodeIterator.js +207 -0
  960. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/NodeList.js +302 -0
  961. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/OnBeforeUnloadEventHandlerNonNull.js +42 -0
  962. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/OnErrorEventHandlerNonNull.js +56 -0
  963. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/PageTransitionEvent.js +144 -0
  964. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/PageTransitionEventInit.js +35 -0
  965. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/Performance.js +142 -0
  966. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/Plugin.js +359 -0
  967. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/PluginArray.js +336 -0
  968. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/PointerEvent.js +324 -0
  969. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/PointerEventInit.js +241 -0
  970. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/PopStateEvent.js +144 -0
  971. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/PopStateEventInit.js +32 -0
  972. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/ProcessingInstruction.js +122 -0
  973. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/ProgressEvent.js +170 -0
  974. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/ProgressEventInit.js +65 -0
  975. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/PromiseRejectionEvent.js +157 -0
  976. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/PromiseRejectionEventInit.js +42 -0
  977. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/RadioNodeList.js +296 -0
  978. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/Range.js +641 -0
  979. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/SVGAnimatedPreserveAspectRatio.js +136 -0
  980. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/SVGAnimatedRect.js +136 -0
  981. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/SVGAnimatedString.js +149 -0
  982. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/SVGBoundingBoxOptions.js +64 -0
  983. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/SVGDefsElement.js +109 -0
  984. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/SVGDescElement.js +109 -0
  985. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/SVGElement.js +3155 -0
  986. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/SVGGElement.js +109 -0
  987. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/SVGGraphicsElement.js +139 -0
  988. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/SVGMetadataElement.js +109 -0
  989. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/SVGNumber.js +132 -0
  990. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/SVGPreserveAspectRatio.js +196 -0
  991. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/SVGRect.js +210 -0
  992. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/SVGSVGElement.js +786 -0
  993. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/SVGStringList.js +511 -0
  994. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/SVGSwitchElement.js +109 -0
  995. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/SVGSymbolElement.js +146 -0
  996. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/SVGTitleElement.js +109 -0
  997. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/Screen.js +180 -0
  998. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/ScrollBehavior.js +12 -0
  999. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/ScrollIntoViewOptions.js +45 -0
  1000. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/ScrollLogicalPosition.js +14 -0
  1001. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/ScrollOptions.js +30 -0
  1002. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/ScrollRestoration.js +12 -0
  1003. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/Selection.js +569 -0
  1004. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/SelectionMode.js +12 -0
  1005. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/ShadowRoot.js +187 -0
  1006. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/ShadowRootInit.js +30 -0
  1007. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/ShadowRootMode.js +12 -0
  1008. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/StaticRange.js +123 -0
  1009. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/StaticRangeInit.js +72 -0
  1010. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/Storage.js +397 -0
  1011. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/StorageEvent.js +318 -0
  1012. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/StorageEventInit.js +99 -0
  1013. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/StyleSheetList.js +300 -0
  1014. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/SubmitEvent.js +144 -0
  1015. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/SubmitEventInit.js +36 -0
  1016. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/SupportedType.js +18 -0
  1017. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/Text.js +170 -0
  1018. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/TextTrackKind.js +12 -0
  1019. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/TouchEvent.js +222 -0
  1020. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/TouchEventInit.js +89 -0
  1021. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/TransitionEvent.js +170 -0
  1022. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/TransitionEventInit.js +65 -0
  1023. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/TreeWalker.js +255 -0
  1024. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/UIEvent.js +235 -0
  1025. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/UIEventInit.js +62 -0
  1026. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/ValidityState.js +249 -0
  1027. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/VisibilityState.js +12 -0
  1028. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/VoidFunction.js +26 -0
  1029. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/WebSocket.js +480 -0
  1030. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/WheelEvent.js +191 -0
  1031. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/WheelEventInit.js +71 -0
  1032. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/XMLDocument.js +109 -0
  1033. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/XMLHttpRequest.js +663 -0
  1034. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/XMLHttpRequestEventTarget.js +334 -0
  1035. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/XMLHttpRequestResponseType.js +14 -0
  1036. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/XMLHttpRequestUpload.js +109 -0
  1037. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/XMLSerializer.js +132 -0
  1038. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/generated/utils.js +252 -0
  1039. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/geometry/DOMRect-impl.js +39 -0
  1040. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/geometry/DOMRectReadOnly-impl.js +72 -0
  1041. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/helpers/agent-factory.js +13 -0
  1042. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/helpers/binary-data.js +9 -0
  1043. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/helpers/colors.js +245 -0
  1044. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/helpers/create-element.js +329 -0
  1045. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/helpers/create-event-accessor.js +188 -0
  1046. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/helpers/custom-elements.js +272 -0
  1047. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/helpers/dates-and-times.js +270 -0
  1048. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/helpers/details.js +15 -0
  1049. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/helpers/events.js +24 -0
  1050. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/helpers/focusing.js +104 -0
  1051. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/helpers/form-controls.js +309 -0
  1052. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/helpers/html-constructor.js +78 -0
  1053. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/helpers/http-request.js +266 -0
  1054. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/helpers/internal-constants.js +12 -0
  1055. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/helpers/is-window.js +18 -0
  1056. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/helpers/iterable-weak-set.js +48 -0
  1057. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/helpers/json.js +12 -0
  1058. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/helpers/mutation-observers.js +198 -0
  1059. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/helpers/namespaces.js +16 -0
  1060. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/helpers/node.js +68 -0
  1061. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/helpers/number-and-date-inputs.js +195 -0
  1062. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/helpers/ordered-set.js +104 -0
  1063. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/helpers/page-transition-event.js +9 -0
  1064. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/helpers/runtime-script-errors.js +75 -0
  1065. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/helpers/shadow-dom.js +285 -0
  1066. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/helpers/strings.js +162 -0
  1067. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/helpers/style-rules.js +319 -0
  1068. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/helpers/stylesheets.js +129 -0
  1069. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/helpers/svg/basic-types.js +41 -0
  1070. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/helpers/svg/render.js +46 -0
  1071. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/helpers/system-colors.js +147 -0
  1072. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/helpers/text.js +19 -0
  1073. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/helpers/traversal.js +72 -0
  1074. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/helpers/validate-names.js +65 -0
  1075. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/hr-time/Performance-impl.js +22 -0
  1076. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/interfaces.js +249 -0
  1077. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/mutation-observer/MutationObserver-impl.js +95 -0
  1078. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/mutation-observer/MutationRecord-impl.js +37 -0
  1079. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/navigator/MimeType-impl.js +3 -0
  1080. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/navigator/MimeTypeArray-impl.js +21 -0
  1081. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/navigator/Navigator-impl.js +29 -0
  1082. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/navigator/NavigatorConcurrentHardware-impl.js +8 -0
  1083. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/navigator/NavigatorCookies-impl.js +7 -0
  1084. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/navigator/NavigatorID-impl.js +37 -0
  1085. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/navigator/NavigatorLanguage-impl.js +9 -0
  1086. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/navigator/NavigatorOnLine-impl.js +7 -0
  1087. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/navigator/NavigatorPlugins-impl.js +8 -0
  1088. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/navigator/Plugin-impl.js +3 -0
  1089. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/navigator/PluginArray-impl.js +23 -0
  1090. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/node-document-position.js +10 -0
  1091. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/node-type.js +16 -0
  1092. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/node.js +331 -0
  1093. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/CDATASection-impl.js +16 -0
  1094. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/CharacterData-impl.js +118 -0
  1095. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/ChildNode-impl.js +80 -0
  1096. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/Comment-impl.js +20 -0
  1097. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/DOMImplementation-impl.js +120 -0
  1098. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/DOMStringMap-impl.js +64 -0
  1099. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/DOMTokenList-impl.js +171 -0
  1100. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/Document-impl.js +1014 -0
  1101. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/DocumentFragment-impl.js +44 -0
  1102. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/DocumentOrShadowRoot-impl.js +28 -0
  1103. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/DocumentType-impl.js +24 -0
  1104. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/Element-impl.js +608 -0
  1105. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/ElementCSSInlineStyle-impl.js +22 -0
  1106. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/ElementContentEditable-impl.js +7 -0
  1107. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/GlobalEventHandlers-impl.js +157 -0
  1108. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLAnchorElement-impl.js +50 -0
  1109. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLAreaElement-impl.js +43 -0
  1110. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLAudioElement-impl.js +9 -0
  1111. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLBRElement-impl.js +9 -0
  1112. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLBaseElement-impl.js +44 -0
  1113. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLBodyElement-impl.js +17 -0
  1114. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLButtonElement-impl.js +79 -0
  1115. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLCanvasElement-impl.js +136 -0
  1116. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLCollection-impl.js +96 -0
  1117. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLDListElement-impl.js +9 -0
  1118. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLDataElement-impl.js +9 -0
  1119. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLDataListElement-impl.js +20 -0
  1120. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLDetailsElement-impl.js +35 -0
  1121. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLDialogElement-impl.js +9 -0
  1122. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLDirectoryElement-impl.js +9 -0
  1123. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLDivElement-impl.js +9 -0
  1124. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLElement-impl.js +211 -0
  1125. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLEmbedElement-impl.js +8 -0
  1126. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLFieldSetElement-impl.js +43 -0
  1127. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLFontElement-impl.js +9 -0
  1128. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLFormControlsCollection-impl.js +33 -0
  1129. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLFormElement-impl.js +248 -0
  1130. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLFrameElement-impl.js +266 -0
  1131. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLFrameSetElement-impl.js +17 -0
  1132. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLHRElement-impl.js +9 -0
  1133. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLHeadElement-impl.js +9 -0
  1134. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLHeadingElement-impl.js +9 -0
  1135. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLHtmlElement-impl.js +9 -0
  1136. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLHyperlinkElementUtils-impl.js +366 -0
  1137. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLIFrameElement-impl.js +9 -0
  1138. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLImageElement-impl.js +131 -0
  1139. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLInputElement-impl.js +1097 -0
  1140. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLLIElement-impl.js +9 -0
  1141. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLLabelElement-impl.js +94 -0
  1142. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLLegendElement-impl.js +18 -0
  1143. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLLinkElement-impl.js +107 -0
  1144. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLMapElement-impl.js +13 -0
  1145. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLMarqueeElement-impl.js +9 -0
  1146. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLMediaElement-impl.js +138 -0
  1147. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLMenuElement-impl.js +9 -0
  1148. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLMetaElement-impl.js +9 -0
  1149. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLMeterElement-impl.js +180 -0
  1150. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLModElement-impl.js +9 -0
  1151. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLOListElement-impl.js +22 -0
  1152. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLObjectElement-impl.js +26 -0
  1153. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLOptGroupElement-impl.js +9 -0
  1154. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLOptionElement-impl.js +146 -0
  1155. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLOptionsCollection-impl.js +110 -0
  1156. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLOrSVGElement-impl.js +88 -0
  1157. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLOutputElement-impl.js +88 -0
  1158. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLParagraphElement-impl.js +9 -0
  1159. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLParamElement-impl.js +9 -0
  1160. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLPictureElement-impl.js +9 -0
  1161. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLPreElement-impl.js +9 -0
  1162. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLProgressElement-impl.js +72 -0
  1163. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLQuoteElement-impl.js +9 -0
  1164. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLScriptElement-impl.js +261 -0
  1165. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLSelectElement-impl.js +283 -0
  1166. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLSlotElement-impl.js +59 -0
  1167. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLSourceElement-impl.js +8 -0
  1168. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLSpanElement-impl.js +9 -0
  1169. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLStyleElement-impl.js +73 -0
  1170. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLTableCaptionElement-impl.js +9 -0
  1171. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLTableCellElement-impl.js +73 -0
  1172. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLTableColElement-impl.js +9 -0
  1173. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLTableElement-impl.js +236 -0
  1174. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLTableRowElement-impl.js +88 -0
  1175. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLTableSectionElement-impl.js +61 -0
  1176. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLTemplateElement-impl.js +67 -0
  1177. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLTextAreaElement-impl.js +244 -0
  1178. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLTimeElement-impl.js +9 -0
  1179. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLTitleElement-impl.js +18 -0
  1180. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLTrackElement-impl.js +13 -0
  1181. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLUListElement-impl.js +9 -0
  1182. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLUnknownElement-impl.js +9 -0
  1183. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/HTMLVideoElement-impl.js +17 -0
  1184. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/LinkStyle-impl.js +2 -0
  1185. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/Node-impl.js +1160 -0
  1186. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/NodeList-impl.js +43 -0
  1187. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/NonDocumentTypeChildNode-impl.js +28 -0
  1188. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/NonElementParentNode-impl.js +11 -0
  1189. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/ParentNode-impl.js +90 -0
  1190. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/ProcessingInstruction-impl.js +22 -0
  1191. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/RadioNodeList-impl.js +49 -0
  1192. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/SVGDefsElement-impl.js +9 -0
  1193. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/SVGDescElement-impl.js +9 -0
  1194. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/SVGElement-impl.js +64 -0
  1195. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/SVGGElement-impl.js +9 -0
  1196. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/SVGGraphicsElement-impl.js +16 -0
  1197. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/SVGMetadataElement-impl.js +9 -0
  1198. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/SVGSVGElement-impl.js +47 -0
  1199. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/SVGSwitchElement-impl.js +9 -0
  1200. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/SVGSymbolElement-impl.js +9 -0
  1201. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/SVGTests-impl.js +42 -0
  1202. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/SVGTitleElement-impl.js +9 -0
  1203. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/ShadowRoot-impl.js +41 -0
  1204. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/Slotable-impl.js +48 -0
  1205. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/Text-impl.js +96 -0
  1206. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/WindowEventHandlers-impl.js +52 -0
  1207. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/nodes/XMLDocument-impl.js +4 -0
  1208. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/range/AbstractRange-impl.js +43 -0
  1209. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/range/Range-impl.js +897 -0
  1210. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/range/StaticRange-impl.js +39 -0
  1211. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/range/boundary-point.js +47 -0
  1212. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/selection/Selection-impl.js +358 -0
  1213. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/svg/SVGAnimatedPreserveAspectRatio-impl.js +24 -0
  1214. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/svg/SVGAnimatedRect-impl.js +122 -0
  1215. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/svg/SVGAnimatedString-impl.js +42 -0
  1216. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/svg/SVGListBase.js +195 -0
  1217. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/svg/SVGNumber-impl.js +48 -0
  1218. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/svg/SVGPreserveAspectRatio-impl.js +100 -0
  1219. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/svg/SVGRect-impl.js +143 -0
  1220. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/svg/SVGStringList-impl.js +16 -0
  1221. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/traversal/NodeIterator-impl.js +107 -0
  1222. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/traversal/TreeWalker-impl.js +217 -0
  1223. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/traversal/helpers.js +44 -0
  1224. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/webidl/DOMException-impl.js +46 -0
  1225. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/websockets/WebSocket-impl.js +328 -0
  1226. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/webstorage/Storage-impl.js +102 -0
  1227. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/window/BarProp-impl.js +10 -0
  1228. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/window/External-impl.js +9 -0
  1229. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/window/History-impl.js +148 -0
  1230. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/window/Location-impl.js +227 -0
  1231. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/window/Screen-impl.js +13 -0
  1232. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/window/SessionHistory.js +163 -0
  1233. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/window/navigation.js +85 -0
  1234. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/window-properties.js +241 -0
  1235. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/xhr/FormData-impl.js +191 -0
  1236. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/xhr/XMLHttpRequest-impl.js +1005 -0
  1237. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/xhr/XMLHttpRequestEventTarget-impl.js +17 -0
  1238. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/xhr/XMLHttpRequestUpload-impl.js +4 -0
  1239. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/xhr/multipart-form-data.js +105 -0
  1240. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/xhr/xhr-sync-worker.js +59 -0
  1241. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/living/xhr/xhr-utils.js +410 -0
  1242. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/utils.js +105 -0
  1243. data/lib/readability_js/node/node_modules/jsdom/lib/jsdom/virtual-console.js +46 -0
  1244. data/lib/readability_js/node/node_modules/jsdom/package.json +93 -0
  1245. data/lib/readability_js/node/node_modules/lru-cache/LICENSE +15 -0
  1246. data/lib/readability_js/node/node_modules/lru-cache/README.md +338 -0
  1247. data/lib/readability_js/node/node_modules/lru-cache/dist/commonjs/index.d.ts +1322 -0
  1248. data/lib/readability_js/node/node_modules/lru-cache/dist/commonjs/index.d.ts.map +1 -0
  1249. data/lib/readability_js/node/node_modules/lru-cache/dist/commonjs/index.js +1568 -0
  1250. data/lib/readability_js/node/node_modules/lru-cache/dist/commonjs/index.js.map +1 -0
  1251. data/lib/readability_js/node/node_modules/lru-cache/dist/commonjs/index.min.js +2 -0
  1252. data/lib/readability_js/node/node_modules/lru-cache/dist/commonjs/index.min.js.map +7 -0
  1253. data/lib/readability_js/node/node_modules/lru-cache/dist/commonjs/package.json +3 -0
  1254. data/lib/readability_js/node/node_modules/lru-cache/dist/esm/index.d.ts +1322 -0
  1255. data/lib/readability_js/node/node_modules/lru-cache/dist/esm/index.d.ts.map +1 -0
  1256. data/lib/readability_js/node/node_modules/lru-cache/dist/esm/index.js +1564 -0
  1257. data/lib/readability_js/node/node_modules/lru-cache/dist/esm/index.js.map +1 -0
  1258. data/lib/readability_js/node/node_modules/lru-cache/dist/esm/index.min.js +2 -0
  1259. data/lib/readability_js/node/node_modules/lru-cache/dist/esm/index.min.js.map +7 -0
  1260. data/lib/readability_js/node/node_modules/lru-cache/dist/esm/package.json +3 -0
  1261. data/lib/readability_js/node/node_modules/lru-cache/package.json +113 -0
  1262. data/lib/readability_js/node/node_modules/mdn-data/LICENSE +116 -0
  1263. data/lib/readability_js/node/node_modules/mdn-data/README.md +59 -0
  1264. data/lib/readability_js/node/node_modules/mdn-data/api/index.js +3 -0
  1265. data/lib/readability_js/node/node_modules/mdn-data/api/inheritance.json +2681 -0
  1266. data/lib/readability_js/node/node_modules/mdn-data/api/inheritance.schema.json +31 -0
  1267. data/lib/readability_js/node/node_modules/mdn-data/css/at-rules.json +504 -0
  1268. data/lib/readability_js/node/node_modules/mdn-data/css/at-rules.schema.json +131 -0
  1269. data/lib/readability_js/node/node_modules/mdn-data/css/definitions.json +80 -0
  1270. data/lib/readability_js/node/node_modules/mdn-data/css/functions.json +593 -0
  1271. data/lib/readability_js/node/node_modules/mdn-data/css/functions.schema.json +45 -0
  1272. data/lib/readability_js/node/node_modules/mdn-data/css/index.js +9 -0
  1273. data/lib/readability_js/node/node_modules/mdn-data/css/properties.json +10806 -0
  1274. data/lib/readability_js/node/node_modules/mdn-data/css/properties.schema.json +449 -0
  1275. data/lib/readability_js/node/node_modules/mdn-data/css/selectors.json +1071 -0
  1276. data/lib/readability_js/node/node_modules/mdn-data/css/selectors.schema.json +36 -0
  1277. data/lib/readability_js/node/node_modules/mdn-data/css/syntaxes.json +899 -0
  1278. data/lib/readability_js/node/node_modules/mdn-data/css/syntaxes.schema.json +15 -0
  1279. data/lib/readability_js/node/node_modules/mdn-data/css/types.json +287 -0
  1280. data/lib/readability_js/node/node_modules/mdn-data/css/types.schema.json +32 -0
  1281. data/lib/readability_js/node/node_modules/mdn-data/css/units.json +213 -0
  1282. data/lib/readability_js/node/node_modules/mdn-data/css/units.schema.json +28 -0
  1283. data/lib/readability_js/node/node_modules/mdn-data/index.js +5 -0
  1284. data/lib/readability_js/node/node_modules/mdn-data/l10n/css.json +1876 -0
  1285. data/lib/readability_js/node/node_modules/mdn-data/l10n/index.js +3 -0
  1286. data/lib/readability_js/node/node_modules/mdn-data/package.json +38 -0
  1287. data/lib/readability_js/node/node_modules/ms/index.js +162 -0
  1288. data/lib/readability_js/node/node_modules/ms/license.md +21 -0
  1289. data/lib/readability_js/node/node_modules/ms/package.json +38 -0
  1290. data/lib/readability_js/node/node_modules/ms/readme.md +59 -0
  1291. data/lib/readability_js/node/node_modules/parse5/LICENSE +19 -0
  1292. data/lib/readability_js/node/node_modules/parse5/README.md +38 -0
  1293. data/lib/readability_js/node/node_modules/parse5/dist/common/doctype.d.ts +4 -0
  1294. data/lib/readability_js/node/node_modules/parse5/dist/common/doctype.js +114 -0
  1295. data/lib/readability_js/node/node_modules/parse5/dist/common/error-codes.d.ts +67 -0
  1296. data/lib/readability_js/node/node_modules/parse5/dist/common/error-codes.js +63 -0
  1297. data/lib/readability_js/node/node_modules/parse5/dist/common/foreign-content.d.ts +9 -0
  1298. data/lib/readability_js/node/node_modules/parse5/dist/common/foreign-content.js +228 -0
  1299. data/lib/readability_js/node/node_modules/parse5/dist/common/html.d.ts +289 -0
  1300. data/lib/readability_js/node/node_modules/parse5/dist/common/html.js +523 -0
  1301. data/lib/readability_js/node/node_modules/parse5/dist/common/token.d.ts +84 -0
  1302. data/lib/readability_js/node/node_modules/parse5/dist/common/token.js +20 -0
  1303. data/lib/readability_js/node/node_modules/parse5/dist/common/unicode.d.ts +42 -0
  1304. data/lib/readability_js/node/node_modules/parse5/dist/common/unicode.js +62 -0
  1305. data/lib/readability_js/node/node_modules/parse5/dist/index.d.ts +71 -0
  1306. data/lib/readability_js/node/node_modules/parse5/dist/index.js +42 -0
  1307. data/lib/readability_js/node/node_modules/parse5/dist/parser/formatting-element-list.d.ts +36 -0
  1308. data/lib/readability_js/node/node_modules/parse5/dist/parser/formatting-element-list.js +110 -0
  1309. data/lib/readability_js/node/node_modules/parse5/dist/parser/index.d.ts +221 -0
  1310. data/lib/readability_js/node/node_modules/parse5/dist/parser/index.js +3245 -0
  1311. data/lib/readability_js/node/node_modules/parse5/dist/parser/open-element-stack.d.ts +53 -0
  1312. data/lib/readability_js/node/node_modules/parse5/dist/parser/open-element-stack.js +324 -0
  1313. data/lib/readability_js/node/node_modules/parse5/dist/serializer/index.d.ts +60 -0
  1314. data/lib/readability_js/node/node_modules/parse5/dist/serializer/index.js +168 -0
  1315. data/lib/readability_js/node/node_modules/parse5/dist/tokenizer/index.d.ts +247 -0
  1316. data/lib/readability_js/node/node_modules/parse5/dist/tokenizer/index.js +2710 -0
  1317. data/lib/readability_js/node/node_modules/parse5/dist/tokenizer/preprocessor.d.ts +36 -0
  1318. data/lib/readability_js/node/node_modules/parse5/dist/tokenizer/preprocessor.js +196 -0
  1319. data/lib/readability_js/node/node_modules/parse5/dist/tree-adapters/default.d.ts +84 -0
  1320. data/lib/readability_js/node/node_modules/parse5/dist/tree-adapters/default.js +173 -0
  1321. data/lib/readability_js/node/node_modules/parse5/dist/tree-adapters/interface.d.ts +255 -0
  1322. data/lib/readability_js/node/node_modules/parse5/dist/tree-adapters/interface.js +1 -0
  1323. data/lib/readability_js/node/node_modules/parse5/package.json +48 -0
  1324. data/lib/readability_js/node/node_modules/punycode/LICENSE-MIT.txt +20 -0
  1325. data/lib/readability_js/node/node_modules/punycode/README.md +148 -0
  1326. data/lib/readability_js/node/node_modules/punycode/package.json +58 -0
  1327. data/lib/readability_js/node/node_modules/punycode/punycode.es6.js +444 -0
  1328. data/lib/readability_js/node/node_modules/punycode/punycode.js +443 -0
  1329. data/lib/readability_js/node/node_modules/require-from-string/index.js +34 -0
  1330. data/lib/readability_js/node/node_modules/require-from-string/license +21 -0
  1331. data/lib/readability_js/node/node_modules/require-from-string/package.json +28 -0
  1332. data/lib/readability_js/node/node_modules/require-from-string/readme.md +56 -0
  1333. data/lib/readability_js/node/node_modules/rrweb-cssom/LICENSE.txt +20 -0
  1334. data/lib/readability_js/node/node_modules/rrweb-cssom/README.mdown +74 -0
  1335. data/lib/readability_js/node/node_modules/rrweb-cssom/build/CSSOM.js +1995 -0
  1336. data/lib/readability_js/node/node_modules/rrweb-cssom/lib/CSSConditionRule.js +25 -0
  1337. data/lib/readability_js/node/node_modules/rrweb-cssom/lib/CSSContainerRule.js +50 -0
  1338. data/lib/readability_js/node/node_modules/rrweb-cssom/lib/CSSDocumentRule.js +39 -0
  1339. data/lib/readability_js/node/node_modules/rrweb-cssom/lib/CSSFontFaceRule.js +36 -0
  1340. data/lib/readability_js/node/node_modules/rrweb-cssom/lib/CSSGroupingRule.js +69 -0
  1341. data/lib/readability_js/node/node_modules/rrweb-cssom/lib/CSSHostRule.js +37 -0
  1342. data/lib/readability_js/node/node_modules/rrweb-cssom/lib/CSSImportRule.js +132 -0
  1343. data/lib/readability_js/node/node_modules/rrweb-cssom/lib/CSSKeyframeRule.js +37 -0
  1344. data/lib/readability_js/node/node_modules/rrweb-cssom/lib/CSSKeyframesRule.js +39 -0
  1345. data/lib/readability_js/node/node_modules/rrweb-cssom/lib/CSSLayerBlockRule.js +48 -0
  1346. data/lib/readability_js/node/node_modules/rrweb-cssom/lib/CSSMediaRule.js +53 -0
  1347. data/lib/readability_js/node/node_modules/rrweb-cssom/lib/CSSOM.js +3 -0
  1348. data/lib/readability_js/node/node_modules/rrweb-cssom/lib/CSSRule.js +42 -0
  1349. data/lib/readability_js/node/node_modules/rrweb-cssom/lib/CSSStartingStyleRule.js +37 -0
  1350. data/lib/readability_js/node/node_modules/rrweb-cssom/lib/CSSStyleDeclaration.js +148 -0
  1351. data/lib/readability_js/node/node_modules/rrweb-cssom/lib/CSSStyleRule.js +190 -0
  1352. data/lib/readability_js/node/node_modules/rrweb-cssom/lib/CSSStyleSheet.js +88 -0
  1353. data/lib/readability_js/node/node_modules/rrweb-cssom/lib/CSSSupportsRule.js +36 -0
  1354. data/lib/readability_js/node/node_modules/rrweb-cssom/lib/CSSValue.js +43 -0
  1355. data/lib/readability_js/node/node_modules/rrweb-cssom/lib/CSSValueExpression.js +344 -0
  1356. data/lib/readability_js/node/node_modules/rrweb-cssom/lib/MatcherList.js +62 -0
  1357. data/lib/readability_js/node/node_modules/rrweb-cssom/lib/MediaList.js +61 -0
  1358. data/lib/readability_js/node/node_modules/rrweb-cssom/lib/StyleSheet.js +17 -0
  1359. data/lib/readability_js/node/node_modules/rrweb-cssom/lib/clone.js +80 -0
  1360. data/lib/readability_js/node/node_modules/rrweb-cssom/lib/index.js +26 -0
  1361. data/lib/readability_js/node/node_modules/rrweb-cssom/lib/parse.js +525 -0
  1362. data/lib/readability_js/node/node_modules/rrweb-cssom/package.json +27 -0
  1363. data/lib/readability_js/node/node_modules/safer-buffer/LICENSE +21 -0
  1364. data/lib/readability_js/node/node_modules/safer-buffer/Porting-Buffer.md +268 -0
  1365. data/lib/readability_js/node/node_modules/safer-buffer/Readme.md +156 -0
  1366. data/lib/readability_js/node/node_modules/safer-buffer/dangerous.js +58 -0
  1367. data/lib/readability_js/node/node_modules/safer-buffer/package.json +34 -0
  1368. data/lib/readability_js/node/node_modules/safer-buffer/safer.js +77 -0
  1369. data/lib/readability_js/node/node_modules/safer-buffer/tests.js +406 -0
  1370. data/lib/readability_js/node/node_modules/saxes/README.md +323 -0
  1371. data/lib/readability_js/node/node_modules/saxes/package.json +71 -0
  1372. data/lib/readability_js/node/node_modules/saxes/saxes.d.ts +635 -0
  1373. data/lib/readability_js/node/node_modules/saxes/saxes.js +2053 -0
  1374. data/lib/readability_js/node/node_modules/saxes/saxes.js.map +1 -0
  1375. data/lib/readability_js/node/node_modules/source-map-js/LICENSE +28 -0
  1376. data/lib/readability_js/node/node_modules/source-map-js/README.md +765 -0
  1377. data/lib/readability_js/node/node_modules/source-map-js/lib/array-set.js +121 -0
  1378. data/lib/readability_js/node/node_modules/source-map-js/lib/base64-vlq.js +140 -0
  1379. data/lib/readability_js/node/node_modules/source-map-js/lib/base64.js +67 -0
  1380. data/lib/readability_js/node/node_modules/source-map-js/lib/binary-search.js +111 -0
  1381. data/lib/readability_js/node/node_modules/source-map-js/lib/mapping-list.js +79 -0
  1382. data/lib/readability_js/node/node_modules/source-map-js/lib/quick-sort.js +132 -0
  1383. data/lib/readability_js/node/node_modules/source-map-js/lib/source-map-consumer.d.ts +1 -0
  1384. data/lib/readability_js/node/node_modules/source-map-js/lib/source-map-consumer.js +1188 -0
  1385. data/lib/readability_js/node/node_modules/source-map-js/lib/source-map-generator.d.ts +1 -0
  1386. data/lib/readability_js/node/node_modules/source-map-js/lib/source-map-generator.js +444 -0
  1387. data/lib/readability_js/node/node_modules/source-map-js/lib/source-node.d.ts +1 -0
  1388. data/lib/readability_js/node/node_modules/source-map-js/lib/source-node.js +413 -0
  1389. data/lib/readability_js/node/node_modules/source-map-js/lib/util.js +594 -0
  1390. data/lib/readability_js/node/node_modules/source-map-js/package.json +71 -0
  1391. data/lib/readability_js/node/node_modules/source-map-js/source-map.d.ts +104 -0
  1392. data/lib/readability_js/node/node_modules/source-map-js/source-map.js +8 -0
  1393. data/lib/readability_js/node/node_modules/symbol-tree/LICENSE +21 -0
  1394. data/lib/readability_js/node/node_modules/symbol-tree/README.md +545 -0
  1395. data/lib/readability_js/node/node_modules/symbol-tree/lib/SymbolTree.js +838 -0
  1396. data/lib/readability_js/node/node_modules/symbol-tree/lib/SymbolTreeNode.js +54 -0
  1397. data/lib/readability_js/node/node_modules/symbol-tree/lib/TreeIterator.js +69 -0
  1398. data/lib/readability_js/node/node_modules/symbol-tree/lib/TreePosition.js +11 -0
  1399. data/lib/readability_js/node/node_modules/symbol-tree/package.json +47 -0
  1400. data/lib/readability_js/node/node_modules/tldts/LICENSE +13 -0
  1401. data/lib/readability_js/node/node_modules/tldts/README.md +327 -0
  1402. data/lib/readability_js/node/node_modules/tldts/bin/cli.js +21 -0
  1403. data/lib/readability_js/node/node_modules/tldts/dist/cjs/index.js +669 -0
  1404. data/lib/readability_js/node/node_modules/tldts/dist/cjs/index.js.map +1 -0
  1405. data/lib/readability_js/node/node_modules/tldts/dist/cjs/src/data/trie.js +14 -0
  1406. data/lib/readability_js/node/node_modules/tldts/dist/cjs/src/data/trie.js.map +1 -0
  1407. data/lib/readability_js/node/node_modules/tldts/dist/cjs/src/suffix-trie.js +67 -0
  1408. data/lib/readability_js/node/node_modules/tldts/dist/cjs/src/suffix-trie.js.map +1 -0
  1409. data/lib/readability_js/node/node_modules/tldts/dist/cjs/tsconfig.tsbuildinfo +1 -0
  1410. data/lib/readability_js/node/node_modules/tldts/dist/es6/index.js +33 -0
  1411. data/lib/readability_js/node/node_modules/tldts/dist/es6/index.js.map +1 -0
  1412. data/lib/readability_js/node/node_modules/tldts/dist/es6/src/data/trie.js +11 -0
  1413. data/lib/readability_js/node/node_modules/tldts/dist/es6/src/data/trie.js.map +1 -0
  1414. data/lib/readability_js/node/node_modules/tldts/dist/es6/src/suffix-trie.js +64 -0
  1415. data/lib/readability_js/node/node_modules/tldts/dist/es6/src/suffix-trie.js.map +1 -0
  1416. data/lib/readability_js/node/node_modules/tldts/dist/es6/tsconfig.bundle.tsbuildinfo +1 -0
  1417. data/lib/readability_js/node/node_modules/tldts/dist/index.cjs.min.js +2 -0
  1418. data/lib/readability_js/node/node_modules/tldts/dist/index.cjs.min.js.map +1 -0
  1419. data/lib/readability_js/node/node_modules/tldts/dist/index.esm.min.js +2 -0
  1420. data/lib/readability_js/node/node_modules/tldts/dist/index.esm.min.js.map +1 -0
  1421. data/lib/readability_js/node/node_modules/tldts/dist/index.umd.min.js +2 -0
  1422. data/lib/readability_js/node/node_modules/tldts/dist/index.umd.min.js.map +1 -0
  1423. data/lib/readability_js/node/node_modules/tldts/dist/types/index.d.ts +7 -0
  1424. data/lib/readability_js/node/node_modules/tldts/dist/types/src/data/trie.d.ts +5 -0
  1425. data/lib/readability_js/node/node_modules/tldts/dist/types/src/suffix-trie.d.ts +5 -0
  1426. data/lib/readability_js/node/node_modules/tldts/index.ts +62 -0
  1427. data/lib/readability_js/node/node_modules/tldts/package.json +91 -0
  1428. data/lib/readability_js/node/node_modules/tldts/src/data/trie.ts +14 -0
  1429. data/lib/readability_js/node/node_modules/tldts/src/suffix-trie.ts +110 -0
  1430. data/lib/readability_js/node/node_modules/tldts-core/LICENSE +13 -0
  1431. data/lib/readability_js/node/node_modules/tldts-core/README.md +3 -0
  1432. data/lib/readability_js/node/node_modules/tldts-core/dist/cjs/index.js +564 -0
  1433. data/lib/readability_js/node/node_modules/tldts-core/dist/cjs/index.js.map +1 -0
  1434. data/lib/readability_js/node/node_modules/tldts-core/dist/cjs/src/domain-without-suffix.js +15 -0
  1435. data/lib/readability_js/node/node_modules/tldts-core/dist/cjs/src/domain-without-suffix.js.map +1 -0
  1436. data/lib/readability_js/node/node_modules/tldts-core/dist/cjs/src/domain.js +83 -0
  1437. data/lib/readability_js/node/node_modules/tldts-core/dist/cjs/src/domain.js.map +1 -0
  1438. data/lib/readability_js/node/node_modules/tldts-core/dist/cjs/src/extract-hostname.js +149 -0
  1439. data/lib/readability_js/node/node_modules/tldts-core/dist/cjs/src/extract-hostname.js.map +1 -0
  1440. data/lib/readability_js/node/node_modules/tldts-core/dist/cjs/src/factory.js +107 -0
  1441. data/lib/readability_js/node/node_modules/tldts-core/dist/cjs/src/factory.js.map +1 -0
  1442. data/lib/readability_js/node/node_modules/tldts-core/dist/cjs/src/is-ip.js +72 -0
  1443. data/lib/readability_js/node/node_modules/tldts-core/dist/cjs/src/is-ip.js.map +1 -0
  1444. data/lib/readability_js/node/node_modules/tldts-core/dist/cjs/src/is-valid.js +69 -0
  1445. data/lib/readability_js/node/node_modules/tldts-core/dist/cjs/src/is-valid.js.map +1 -0
  1446. data/lib/readability_js/node/node_modules/tldts-core/dist/cjs/src/lookup/fast-path.js +69 -0
  1447. data/lib/readability_js/node/node_modules/tldts-core/dist/cjs/src/lookup/fast-path.js.map +1 -0
  1448. data/lib/readability_js/node/node_modules/tldts-core/dist/cjs/src/lookup/interface.js +3 -0
  1449. data/lib/readability_js/node/node_modules/tldts-core/dist/cjs/src/lookup/interface.js.map +1 -0
  1450. data/lib/readability_js/node/node_modules/tldts-core/dist/cjs/src/options.js +22 -0
  1451. data/lib/readability_js/node/node_modules/tldts-core/dist/cjs/src/options.js.map +1 -0
  1452. data/lib/readability_js/node/node_modules/tldts-core/dist/cjs/src/subdomain.js +14 -0
  1453. data/lib/readability_js/node/node_modules/tldts-core/dist/cjs/src/subdomain.js.map +1 -0
  1454. data/lib/readability_js/node/node_modules/tldts-core/dist/cjs/tsconfig.tsbuildinfo +1 -0
  1455. data/lib/readability_js/node/node_modules/tldts-core/dist/es6/index.js +4 -0
  1456. data/lib/readability_js/node/node_modules/tldts-core/dist/es6/index.js.map +1 -0
  1457. data/lib/readability_js/node/node_modules/tldts-core/dist/es6/src/domain-without-suffix.js +12 -0
  1458. data/lib/readability_js/node/node_modules/tldts-core/dist/es6/src/domain-without-suffix.js.map +1 -0
  1459. data/lib/readability_js/node/node_modules/tldts-core/dist/es6/src/domain.js +80 -0
  1460. data/lib/readability_js/node/node_modules/tldts-core/dist/es6/src/domain.js.map +1 -0
  1461. data/lib/readability_js/node/node_modules/tldts-core/dist/es6/src/extract-hostname.js +146 -0
  1462. data/lib/readability_js/node/node_modules/tldts-core/dist/es6/src/extract-hostname.js.map +1 -0
  1463. data/lib/readability_js/node/node_modules/tldts-core/dist/es6/src/factory.js +102 -0
  1464. data/lib/readability_js/node/node_modules/tldts-core/dist/es6/src/factory.js.map +1 -0
  1465. data/lib/readability_js/node/node_modules/tldts-core/dist/es6/src/is-ip.js +69 -0
  1466. data/lib/readability_js/node/node_modules/tldts-core/dist/es6/src/is-ip.js.map +1 -0
  1467. data/lib/readability_js/node/node_modules/tldts-core/dist/es6/src/is-valid.js +66 -0
  1468. data/lib/readability_js/node/node_modules/tldts-core/dist/es6/src/is-valid.js.map +1 -0
  1469. data/lib/readability_js/node/node_modules/tldts-core/dist/es6/src/lookup/fast-path.js +66 -0
  1470. data/lib/readability_js/node/node_modules/tldts-core/dist/es6/src/lookup/fast-path.js.map +1 -0
  1471. data/lib/readability_js/node/node_modules/tldts-core/dist/es6/src/lookup/interface.js +2 -0
  1472. data/lib/readability_js/node/node_modules/tldts-core/dist/es6/src/lookup/interface.js.map +1 -0
  1473. data/lib/readability_js/node/node_modules/tldts-core/dist/es6/src/options.js +19 -0
  1474. data/lib/readability_js/node/node_modules/tldts-core/dist/es6/src/options.js.map +1 -0
  1475. data/lib/readability_js/node/node_modules/tldts-core/dist/es6/src/subdomain.js +11 -0
  1476. data/lib/readability_js/node/node_modules/tldts-core/dist/es6/src/subdomain.js.map +1 -0
  1477. data/lib/readability_js/node/node_modules/tldts-core/dist/es6/tsconfig.bundle.tsbuildinfo +1 -0
  1478. data/lib/readability_js/node/node_modules/tldts-core/dist/types/index.d.ts +4 -0
  1479. data/lib/readability_js/node/node_modules/tldts-core/dist/types/src/domain-without-suffix.d.ts +6 -0
  1480. data/lib/readability_js/node/node_modules/tldts-core/dist/types/src/domain.d.ts +5 -0
  1481. data/lib/readability_js/node/node_modules/tldts-core/dist/types/src/extract-hostname.d.ts +5 -0
  1482. data/lib/readability_js/node/node_modules/tldts-core/dist/types/src/factory.d.ts +28 -0
  1483. data/lib/readability_js/node/node_modules/tldts-core/dist/types/src/is-ip.d.ts +6 -0
  1484. data/lib/readability_js/node/node_modules/tldts-core/dist/types/src/is-valid.d.ts +15 -0
  1485. data/lib/readability_js/node/node_modules/tldts-core/dist/types/src/lookup/fast-path.d.ts +2 -0
  1486. data/lib/readability_js/node/node_modules/tldts-core/dist/types/src/lookup/interface.d.ts +9 -0
  1487. data/lib/readability_js/node/node_modules/tldts-core/dist/types/src/options.d.ts +10 -0
  1488. data/lib/readability_js/node/node_modules/tldts-core/dist/types/src/subdomain.d.ts +4 -0
  1489. data/lib/readability_js/node/node_modules/tldts-core/index.ts +10 -0
  1490. data/lib/readability_js/node/node_modules/tldts-core/package.json +68 -0
  1491. data/lib/readability_js/node/node_modules/tldts-core/src/domain-without-suffix.ts +14 -0
  1492. data/lib/readability_js/node/node_modules/tldts-core/src/domain.ts +100 -0
  1493. data/lib/readability_js/node/node_modules/tldts-core/src/extract-hostname.ts +170 -0
  1494. data/lib/readability_js/node/node_modules/tldts-core/src/factory.ts +163 -0
  1495. data/lib/readability_js/node/node_modules/tldts-core/src/is-ip.ts +87 -0
  1496. data/lib/readability_js/node/node_modules/tldts-core/src/is-valid.ts +79 -0
  1497. data/lib/readability_js/node/node_modules/tldts-core/src/lookup/fast-path.ts +80 -0
  1498. data/lib/readability_js/node/node_modules/tldts-core/src/lookup/interface.ts +10 -0
  1499. data/lib/readability_js/node/node_modules/tldts-core/src/options.ts +39 -0
  1500. data/lib/readability_js/node/node_modules/tldts-core/src/subdomain.ts +11 -0
  1501. data/lib/readability_js/node/node_modules/tough-cookie/LICENSE +12 -0
  1502. data/lib/readability_js/node/node_modules/tough-cookie/README.md +195 -0
  1503. data/lib/readability_js/node/node_modules/tough-cookie/dist/index.cjs +2313 -0
  1504. data/lib/readability_js/node/node_modules/tough-cookie/dist/index.cjs.map +1 -0
  1505. data/lib/readability_js/node/node_modules/tough-cookie/dist/index.d.cts +1879 -0
  1506. data/lib/readability_js/node/node_modules/tough-cookie/dist/index.d.ts +1879 -0
  1507. data/lib/readability_js/node/node_modules/tough-cookie/dist/index.js +2268 -0
  1508. data/lib/readability_js/node/node_modules/tough-cookie/dist/index.js.map +1 -0
  1509. data/lib/readability_js/node/node_modules/tough-cookie/node_modules/.bin/tldts +1 -0
  1510. data/lib/readability_js/node/node_modules/tough-cookie/package.json +149 -0
  1511. data/lib/readability_js/node/node_modules/tr46/LICENSE.md +21 -0
  1512. data/lib/readability_js/node/node_modules/tr46/README.md +76 -0
  1513. data/lib/readability_js/node/node_modules/tr46/index.js +344 -0
  1514. data/lib/readability_js/node/node_modules/tr46/lib/mappingTable.json +1 -0
  1515. data/lib/readability_js/node/node_modules/tr46/lib/regexes.js +29 -0
  1516. data/lib/readability_js/node/node_modules/tr46/lib/statusMapping.js +9 -0
  1517. data/lib/readability_js/node/node_modules/tr46/package.json +47 -0
  1518. data/lib/readability_js/node/node_modules/w3c-xmlserializer/LICENSE.md +25 -0
  1519. data/lib/readability_js/node/node_modules/w3c-xmlserializer/README.md +41 -0
  1520. data/lib/readability_js/node/node_modules/w3c-xmlserializer/lib/attributes.js +125 -0
  1521. data/lib/readability_js/node/node_modules/w3c-xmlserializer/lib/constants.js +44 -0
  1522. data/lib/readability_js/node/node_modules/w3c-xmlserializer/lib/serialize.js +365 -0
  1523. data/lib/readability_js/node/node_modules/w3c-xmlserializer/package.json +32 -0
  1524. data/lib/readability_js/node/node_modules/webidl-conversions/LICENSE.md +12 -0
  1525. data/lib/readability_js/node/node_modules/webidl-conversions/README.md +99 -0
  1526. data/lib/readability_js/node/node_modules/webidl-conversions/lib/index.js +462 -0
  1527. data/lib/readability_js/node/node_modules/webidl-conversions/package.json +34 -0
  1528. data/lib/readability_js/node/node_modules/whatwg-encoding/LICENSE.txt +7 -0
  1529. data/lib/readability_js/node/node_modules/whatwg-encoding/README.md +50 -0
  1530. data/lib/readability_js/node/node_modules/whatwg-encoding/lib/labels-to-names.json +217 -0
  1531. data/lib/readability_js/node/node_modules/whatwg-encoding/lib/supported-names.json +38 -0
  1532. data/lib/readability_js/node/node_modules/whatwg-encoding/lib/whatwg-encoding.js +60 -0
  1533. data/lib/readability_js/node/node_modules/whatwg-encoding/package.json +32 -0
  1534. data/lib/readability_js/node/node_modules/whatwg-mimetype/LICENSE.txt +7 -0
  1535. data/lib/readability_js/node/node_modules/whatwg-mimetype/README.md +101 -0
  1536. data/lib/readability_js/node/node_modules/whatwg-mimetype/lib/mime-type-parameters.js +70 -0
  1537. data/lib/readability_js/node/node_modules/whatwg-mimetype/lib/mime-type.js +127 -0
  1538. data/lib/readability_js/node/node_modules/whatwg-mimetype/lib/parser.js +105 -0
  1539. data/lib/readability_js/node/node_modules/whatwg-mimetype/lib/serializer.js +25 -0
  1540. data/lib/readability_js/node/node_modules/whatwg-mimetype/lib/utils.js +60 -0
  1541. data/lib/readability_js/node/node_modules/whatwg-mimetype/package.json +45 -0
  1542. data/lib/readability_js/node/node_modules/whatwg-url/LICENSE.txt +21 -0
  1543. data/lib/readability_js/node/node_modules/whatwg-url/README.md +106 -0
  1544. data/lib/readability_js/node/node_modules/whatwg-url/index.js +27 -0
  1545. data/lib/readability_js/node/node_modules/whatwg-url/lib/Function.js +42 -0
  1546. data/lib/readability_js/node/node_modules/whatwg-url/lib/URL-impl.js +233 -0
  1547. data/lib/readability_js/node/node_modules/whatwg-url/lib/URL.js +499 -0
  1548. data/lib/readability_js/node/node_modules/whatwg-url/lib/URLSearchParams-impl.js +135 -0
  1549. data/lib/readability_js/node/node_modules/whatwg-url/lib/URLSearchParams.js +505 -0
  1550. data/lib/readability_js/node/node_modules/whatwg-url/lib/VoidFunction.js +26 -0
  1551. data/lib/readability_js/node/node_modules/whatwg-url/lib/encoding.js +16 -0
  1552. data/lib/readability_js/node/node_modules/whatwg-url/lib/infra.js +26 -0
  1553. data/lib/readability_js/node/node_modules/whatwg-url/lib/percent-encoding.js +142 -0
  1554. data/lib/readability_js/node/node_modules/whatwg-url/lib/url-state-machine.js +1277 -0
  1555. data/lib/readability_js/node/node_modules/whatwg-url/lib/urlencoded.js +89 -0
  1556. data/lib/readability_js/node/node_modules/whatwg-url/lib/utils.js +240 -0
  1557. data/lib/readability_js/node/node_modules/whatwg-url/package.json +56 -0
  1558. data/lib/readability_js/node/node_modules/whatwg-url/webidl2js-wrapper.js +7 -0
  1559. data/lib/readability_js/node/node_modules/ws/LICENSE +20 -0
  1560. data/lib/readability_js/node/node_modules/ws/README.md +548 -0
  1561. data/lib/readability_js/node/node_modules/ws/browser.js +8 -0
  1562. data/lib/readability_js/node/node_modules/ws/index.js +13 -0
  1563. data/lib/readability_js/node/node_modules/ws/lib/buffer-util.js +131 -0
  1564. data/lib/readability_js/node/node_modules/ws/lib/constants.js +18 -0
  1565. data/lib/readability_js/node/node_modules/ws/lib/event-target.js +292 -0
  1566. data/lib/readability_js/node/node_modules/ws/lib/extension.js +203 -0
  1567. data/lib/readability_js/node/node_modules/ws/lib/limiter.js +55 -0
  1568. data/lib/readability_js/node/node_modules/ws/lib/permessage-deflate.js +528 -0
  1569. data/lib/readability_js/node/node_modules/ws/lib/receiver.js +706 -0
  1570. data/lib/readability_js/node/node_modules/ws/lib/sender.js +602 -0
  1571. data/lib/readability_js/node/node_modules/ws/lib/stream.js +161 -0
  1572. data/lib/readability_js/node/node_modules/ws/lib/subprotocol.js +62 -0
  1573. data/lib/readability_js/node/node_modules/ws/lib/validation.js +152 -0
  1574. data/lib/readability_js/node/node_modules/ws/lib/websocket-server.js +550 -0
  1575. data/lib/readability_js/node/node_modules/ws/lib/websocket.js +1388 -0
  1576. data/lib/readability_js/node/node_modules/ws/package.json +69 -0
  1577. data/lib/readability_js/node/node_modules/ws/wrapper.mjs +8 -0
  1578. data/lib/readability_js/node/node_modules/xml-name-validator/LICENSE.txt +176 -0
  1579. data/lib/readability_js/node/node_modules/xml-name-validator/README.md +35 -0
  1580. data/lib/readability_js/node/node_modules/xml-name-validator/lib/xml-name-validator.js +9 -0
  1581. data/lib/readability_js/node/node_modules/xml-name-validator/package.json +30 -0
  1582. data/lib/readability_js/node/node_modules/xmlchars/LICENSE +18 -0
  1583. data/lib/readability_js/node/node_modules/xmlchars/README.md +33 -0
  1584. data/lib/readability_js/node/node_modules/xmlchars/package.json +51 -0
  1585. data/lib/readability_js/node/node_modules/xmlchars/xml/1.0/ed4.d.ts +31 -0
  1586. data/lib/readability_js/node/node_modules/xmlchars/xml/1.0/ed4.js +44 -0
  1587. data/lib/readability_js/node/node_modules/xmlchars/xml/1.0/ed4.js.map +1 -0
  1588. data/lib/readability_js/node/node_modules/xmlchars/xml/1.0/ed5.d.ts +51 -0
  1589. data/lib/readability_js/node/node_modules/xmlchars/xml/1.0/ed5.js +105 -0
  1590. data/lib/readability_js/node/node_modules/xmlchars/xml/1.0/ed5.js.map +1 -0
  1591. data/lib/readability_js/node/node_modules/xmlchars/xml/1.1/ed2.d.ts +73 -0
  1592. data/lib/readability_js/node/node_modules/xmlchars/xml/1.1/ed2.js +145 -0
  1593. data/lib/readability_js/node/node_modules/xmlchars/xml/1.1/ed2.js.map +1 -0
  1594. data/lib/readability_js/node/node_modules/xmlchars/xmlchars.d.ts +170 -0
  1595. data/lib/readability_js/node/node_modules/xmlchars/xmlchars.js +191 -0
  1596. data/lib/readability_js/node/node_modules/xmlchars/xmlchars.js.map +1 -0
  1597. data/lib/readability_js/node/node_modules/xmlchars/xmlns/1.0/ed3.d.ts +28 -0
  1598. data/lib/readability_js/node/node_modules/xmlchars/xmlns/1.0/ed3.js +65 -0
  1599. data/lib/readability_js/node/node_modules/xmlchars/xmlns/1.0/ed3.js.map +1 -0
  1600. data/lib/readability_js/node/package.json +9 -0
  1601. data/lib/readability_js/node/readability-example.js +10 -0
  1602. data/lib/readability_js/node/yarn.lock +315 -0
  1603. data/lib/readability_js/nodo.rb +67 -0
  1604. data/lib/readability_js/version.rb +3 -0
  1605. data/lib/readability_js.rb +207 -0
  1606. data/readability_js.gemspec +47 -0
  1607. metadata +1775 -0
@@ -0,0 +1,4914 @@
1
+ /*!
2
+ * decimal.js v10.6.0
3
+ * An arbitrary-precision Decimal type for JavaScript.
4
+ * https://github.com/MikeMcl/decimal.js
5
+ * Copyright (c) 2025 Michael Mclaughlin <M8ch88l@gmail.com>
6
+ * MIT Licence
7
+ */
8
+
9
+
10
+ // ----------------------------------- EDITABLE DEFAULTS ------------------------------------ //
11
+
12
+
13
+ // The maximum exponent magnitude.
14
+ // The limit on the value of `toExpNeg`, `toExpPos`, `minE` and `maxE`.
15
+ var EXP_LIMIT = 9e15, // 0 to 9e15
16
+
17
+ // The limit on the value of `precision`, and on the value of the first argument to
18
+ // `toDecimalPlaces`, `toExponential`, `toFixed`, `toPrecision` and `toSignificantDigits`.
19
+ MAX_DIGITS = 1e9, // 0 to 1e9
20
+
21
+ // Base conversion alphabet.
22
+ NUMERALS = '0123456789abcdef',
23
+
24
+ // The natural logarithm of 10 (1025 digits).
25
+ LN10 = '2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058',
26
+
27
+ // Pi (1025 digits).
28
+ PI = '3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789',
29
+
30
+
31
+ // The initial configuration properties of the Decimal constructor.
32
+ DEFAULTS = {
33
+
34
+ // These values must be integers within the stated ranges (inclusive).
35
+ // Most of these values can be changed at run-time using the `Decimal.config` method.
36
+
37
+ // The maximum number of significant digits of the result of a calculation or base conversion.
38
+ // E.g. `Decimal.config({ precision: 20 });`
39
+ precision: 20, // 1 to MAX_DIGITS
40
+
41
+ // The rounding mode used when rounding to `precision`.
42
+ //
43
+ // ROUND_UP 0 Away from zero.
44
+ // ROUND_DOWN 1 Towards zero.
45
+ // ROUND_CEIL 2 Towards +Infinity.
46
+ // ROUND_FLOOR 3 Towards -Infinity.
47
+ // ROUND_HALF_UP 4 Towards nearest neighbour. If equidistant, up.
48
+ // ROUND_HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.
49
+ // ROUND_HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.
50
+ // ROUND_HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.
51
+ // ROUND_HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.
52
+ //
53
+ // E.g.
54
+ // `Decimal.rounding = 4;`
55
+ // `Decimal.rounding = Decimal.ROUND_HALF_UP;`
56
+ rounding: 4, // 0 to 8
57
+
58
+ // The modulo mode used when calculating the modulus: a mod n.
59
+ // The quotient (q = a / n) is calculated according to the corresponding rounding mode.
60
+ // The remainder (r) is calculated as: r = a - n * q.
61
+ //
62
+ // UP 0 The remainder is positive if the dividend is negative, else is negative.
63
+ // DOWN 1 The remainder has the same sign as the dividend (JavaScript %).
64
+ // FLOOR 3 The remainder has the same sign as the divisor (Python %).
65
+ // HALF_EVEN 6 The IEEE 754 remainder function.
66
+ // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)). Always positive.
67
+ //
68
+ // Truncated division (1), floored division (3), the IEEE 754 remainder (6), and Euclidian
69
+ // division (9) are commonly used for the modulus operation. The other rounding modes can also
70
+ // be used, but they may not give useful results.
71
+ modulo: 1, // 0 to 9
72
+
73
+ // The exponent value at and beneath which `toString` returns exponential notation.
74
+ // JavaScript numbers: -7
75
+ toExpNeg: -7, // 0 to -EXP_LIMIT
76
+
77
+ // The exponent value at and above which `toString` returns exponential notation.
78
+ // JavaScript numbers: 21
79
+ toExpPos: 21, // 0 to EXP_LIMIT
80
+
81
+ // The minimum exponent value, beneath which underflow to zero occurs.
82
+ // JavaScript numbers: -324 (5e-324)
83
+ minE: -EXP_LIMIT, // -1 to -EXP_LIMIT
84
+
85
+ // The maximum exponent value, above which overflow to Infinity occurs.
86
+ // JavaScript numbers: 308 (1.7976931348623157e+308)
87
+ maxE: EXP_LIMIT, // 1 to EXP_LIMIT
88
+
89
+ // Whether to use cryptographically-secure random number generation, if available.
90
+ crypto: false // true/false
91
+ },
92
+
93
+
94
+ // ----------------------------------- END OF EDITABLE DEFAULTS ------------------------------- //
95
+
96
+
97
+ inexact, quadrant,
98
+ external = true,
99
+
100
+ decimalError = '[DecimalError] ',
101
+ invalidArgument = decimalError + 'Invalid argument: ',
102
+ precisionLimitExceeded = decimalError + 'Precision limit exceeded',
103
+ cryptoUnavailable = decimalError + 'crypto unavailable',
104
+ tag = '[object Decimal]',
105
+
106
+ mathfloor = Math.floor,
107
+ mathpow = Math.pow,
108
+
109
+ isBinary = /^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,
110
+ isHex = /^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,
111
+ isOctal = /^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,
112
+ isDecimal = /^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,
113
+
114
+ BASE = 1e7,
115
+ LOG_BASE = 7,
116
+ MAX_SAFE_INTEGER = 9007199254740991,
117
+
118
+ LN10_PRECISION = LN10.length - 1,
119
+ PI_PRECISION = PI.length - 1,
120
+
121
+ // Decimal.prototype object
122
+ P = { toStringTag: tag };
123
+
124
+
125
+ // Decimal prototype methods
126
+
127
+
128
+ /*
129
+ * absoluteValue abs
130
+ * ceil
131
+ * clampedTo clamp
132
+ * comparedTo cmp
133
+ * cosine cos
134
+ * cubeRoot cbrt
135
+ * decimalPlaces dp
136
+ * dividedBy div
137
+ * dividedToIntegerBy divToInt
138
+ * equals eq
139
+ * floor
140
+ * greaterThan gt
141
+ * greaterThanOrEqualTo gte
142
+ * hyperbolicCosine cosh
143
+ * hyperbolicSine sinh
144
+ * hyperbolicTangent tanh
145
+ * inverseCosine acos
146
+ * inverseHyperbolicCosine acosh
147
+ * inverseHyperbolicSine asinh
148
+ * inverseHyperbolicTangent atanh
149
+ * inverseSine asin
150
+ * inverseTangent atan
151
+ * isFinite
152
+ * isInteger isInt
153
+ * isNaN
154
+ * isNegative isNeg
155
+ * isPositive isPos
156
+ * isZero
157
+ * lessThan lt
158
+ * lessThanOrEqualTo lte
159
+ * logarithm log
160
+ * [maximum] [max]
161
+ * [minimum] [min]
162
+ * minus sub
163
+ * modulo mod
164
+ * naturalExponential exp
165
+ * naturalLogarithm ln
166
+ * negated neg
167
+ * plus add
168
+ * precision sd
169
+ * round
170
+ * sine sin
171
+ * squareRoot sqrt
172
+ * tangent tan
173
+ * times mul
174
+ * toBinary
175
+ * toDecimalPlaces toDP
176
+ * toExponential
177
+ * toFixed
178
+ * toFraction
179
+ * toHexadecimal toHex
180
+ * toNearest
181
+ * toNumber
182
+ * toOctal
183
+ * toPower pow
184
+ * toPrecision
185
+ * toSignificantDigits toSD
186
+ * toString
187
+ * truncated trunc
188
+ * valueOf toJSON
189
+ */
190
+
191
+
192
+ /*
193
+ * Return a new Decimal whose value is the absolute value of this Decimal.
194
+ *
195
+ */
196
+ P.absoluteValue = P.abs = function () {
197
+ var x = new this.constructor(this);
198
+ if (x.s < 0) x.s = 1;
199
+ return finalise(x);
200
+ };
201
+
202
+
203
+ /*
204
+ * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the
205
+ * direction of positive Infinity.
206
+ *
207
+ */
208
+ P.ceil = function () {
209
+ return finalise(new this.constructor(this), this.e + 1, 2);
210
+ };
211
+
212
+
213
+ /*
214
+ * Return a new Decimal whose value is the value of this Decimal clamped to the range
215
+ * delineated by `min` and `max`.
216
+ *
217
+ * min {number|string|bigint|Decimal}
218
+ * max {number|string|bigint|Decimal}
219
+ *
220
+ */
221
+ P.clampedTo = P.clamp = function (min, max) {
222
+ var k,
223
+ x = this,
224
+ Ctor = x.constructor;
225
+ min = new Ctor(min);
226
+ max = new Ctor(max);
227
+ if (!min.s || !max.s) return new Ctor(NaN);
228
+ if (min.gt(max)) throw Error(invalidArgument + max);
229
+ k = x.cmp(min);
230
+ return k < 0 ? min : x.cmp(max) > 0 ? max : new Ctor(x);
231
+ };
232
+
233
+
234
+ /*
235
+ * Return
236
+ * 1 if the value of this Decimal is greater than the value of `y`,
237
+ * -1 if the value of this Decimal is less than the value of `y`,
238
+ * 0 if they have the same value,
239
+ * NaN if the value of either Decimal is NaN.
240
+ *
241
+ */
242
+ P.comparedTo = P.cmp = function (y) {
243
+ var i, j, xdL, ydL,
244
+ x = this,
245
+ xd = x.d,
246
+ yd = (y = new x.constructor(y)).d,
247
+ xs = x.s,
248
+ ys = y.s;
249
+
250
+ // Either NaN or ±Infinity?
251
+ if (!xd || !yd) {
252
+ return !xs || !ys ? NaN : xs !== ys ? xs : xd === yd ? 0 : !xd ^ xs < 0 ? 1 : -1;
253
+ }
254
+
255
+ // Either zero?
256
+ if (!xd[0] || !yd[0]) return xd[0] ? xs : yd[0] ? -ys : 0;
257
+
258
+ // Signs differ?
259
+ if (xs !== ys) return xs;
260
+
261
+ // Compare exponents.
262
+ if (x.e !== y.e) return x.e > y.e ^ xs < 0 ? 1 : -1;
263
+
264
+ xdL = xd.length;
265
+ ydL = yd.length;
266
+
267
+ // Compare digit by digit.
268
+ for (i = 0, j = xdL < ydL ? xdL : ydL; i < j; ++i) {
269
+ if (xd[i] !== yd[i]) return xd[i] > yd[i] ^ xs < 0 ? 1 : -1;
270
+ }
271
+
272
+ // Compare lengths.
273
+ return xdL === ydL ? 0 : xdL > ydL ^ xs < 0 ? 1 : -1;
274
+ };
275
+
276
+
277
+ /*
278
+ * Return a new Decimal whose value is the cosine of the value in radians of this Decimal.
279
+ *
280
+ * Domain: [-Infinity, Infinity]
281
+ * Range: [-1, 1]
282
+ *
283
+ * cos(0) = 1
284
+ * cos(-0) = 1
285
+ * cos(Infinity) = NaN
286
+ * cos(-Infinity) = NaN
287
+ * cos(NaN) = NaN
288
+ *
289
+ */
290
+ P.cosine = P.cos = function () {
291
+ var pr, rm,
292
+ x = this,
293
+ Ctor = x.constructor;
294
+
295
+ if (!x.d) return new Ctor(NaN);
296
+
297
+ // cos(0) = cos(-0) = 1
298
+ if (!x.d[0]) return new Ctor(1);
299
+
300
+ pr = Ctor.precision;
301
+ rm = Ctor.rounding;
302
+ Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE;
303
+ Ctor.rounding = 1;
304
+
305
+ x = cosine(Ctor, toLessThanHalfPi(Ctor, x));
306
+
307
+ Ctor.precision = pr;
308
+ Ctor.rounding = rm;
309
+
310
+ return finalise(quadrant == 2 || quadrant == 3 ? x.neg() : x, pr, rm, true);
311
+ };
312
+
313
+
314
+ /*
315
+ *
316
+ * Return a new Decimal whose value is the cube root of the value of this Decimal, rounded to
317
+ * `precision` significant digits using rounding mode `rounding`.
318
+ *
319
+ * cbrt(0) = 0
320
+ * cbrt(-0) = -0
321
+ * cbrt(1) = 1
322
+ * cbrt(-1) = -1
323
+ * cbrt(N) = N
324
+ * cbrt(-I) = -I
325
+ * cbrt(I) = I
326
+ *
327
+ * Math.cbrt(x) = (x < 0 ? -Math.pow(-x, 1/3) : Math.pow(x, 1/3))
328
+ *
329
+ */
330
+ P.cubeRoot = P.cbrt = function () {
331
+ var e, m, n, r, rep, s, sd, t, t3, t3plusx,
332
+ x = this,
333
+ Ctor = x.constructor;
334
+
335
+ if (!x.isFinite() || x.isZero()) return new Ctor(x);
336
+ external = false;
337
+
338
+ // Initial estimate.
339
+ s = x.s * mathpow(x.s * x, 1 / 3);
340
+
341
+ // Math.cbrt underflow/overflow?
342
+ // Pass x to Math.pow as integer, then adjust the exponent of the result.
343
+ if (!s || Math.abs(s) == 1 / 0) {
344
+ n = digitsToString(x.d);
345
+ e = x.e;
346
+
347
+ // Adjust n exponent so it is a multiple of 3 away from x exponent.
348
+ if (s = (e - n.length + 1) % 3) n += (s == 1 || s == -2 ? '0' : '00');
349
+ s = mathpow(n, 1 / 3);
350
+
351
+ // Rarely, e may be one less than the result exponent value.
352
+ e = mathfloor((e + 1) / 3) - (e % 3 == (e < 0 ? -1 : 2));
353
+
354
+ if (s == 1 / 0) {
355
+ n = '5e' + e;
356
+ } else {
357
+ n = s.toExponential();
358
+ n = n.slice(0, n.indexOf('e') + 1) + e;
359
+ }
360
+
361
+ r = new Ctor(n);
362
+ r.s = x.s;
363
+ } else {
364
+ r = new Ctor(s.toString());
365
+ }
366
+
367
+ sd = (e = Ctor.precision) + 3;
368
+
369
+ // Halley's method.
370
+ // TODO? Compare Newton's method.
371
+ for (;;) {
372
+ t = r;
373
+ t3 = t.times(t).times(t);
374
+ t3plusx = t3.plus(x);
375
+ r = divide(t3plusx.plus(x).times(t), t3plusx.plus(t3), sd + 2, 1);
376
+
377
+ // TODO? Replace with for-loop and checkRoundingDigits.
378
+ if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) {
379
+ n = n.slice(sd - 3, sd + 1);
380
+
381
+ // The 4th rounding digit may be in error by -1 so if the 4 rounding digits are 9999 or 4999
382
+ // , i.e. approaching a rounding boundary, continue the iteration.
383
+ if (n == '9999' || !rep && n == '4999') {
384
+
385
+ // On the first iteration only, check to see if rounding up gives the exact result as the
386
+ // nines may infinitely repeat.
387
+ if (!rep) {
388
+ finalise(t, e + 1, 0);
389
+
390
+ if (t.times(t).times(t).eq(x)) {
391
+ r = t;
392
+ break;
393
+ }
394
+ }
395
+
396
+ sd += 4;
397
+ rep = 1;
398
+ } else {
399
+
400
+ // If the rounding digits are null, 0{0,4} or 50{0,3}, check for an exact result.
401
+ // If not, then there are further digits and m will be truthy.
402
+ if (!+n || !+n.slice(1) && n.charAt(0) == '5') {
403
+
404
+ // Truncate to the first rounding digit.
405
+ finalise(r, e + 1, 1);
406
+ m = !r.times(r).times(r).eq(x);
407
+ }
408
+
409
+ break;
410
+ }
411
+ }
412
+ }
413
+
414
+ external = true;
415
+
416
+ return finalise(r, e, Ctor.rounding, m);
417
+ };
418
+
419
+
420
+ /*
421
+ * Return the number of decimal places of the value of this Decimal.
422
+ *
423
+ */
424
+ P.decimalPlaces = P.dp = function () {
425
+ var w,
426
+ d = this.d,
427
+ n = NaN;
428
+
429
+ if (d) {
430
+ w = d.length - 1;
431
+ n = (w - mathfloor(this.e / LOG_BASE)) * LOG_BASE;
432
+
433
+ // Subtract the number of trailing zeros of the last word.
434
+ w = d[w];
435
+ if (w) for (; w % 10 == 0; w /= 10) n--;
436
+ if (n < 0) n = 0;
437
+ }
438
+
439
+ return n;
440
+ };
441
+
442
+
443
+ /*
444
+ * n / 0 = I
445
+ * n / N = N
446
+ * n / I = 0
447
+ * 0 / n = 0
448
+ * 0 / 0 = N
449
+ * 0 / N = N
450
+ * 0 / I = 0
451
+ * N / n = N
452
+ * N / 0 = N
453
+ * N / N = N
454
+ * N / I = N
455
+ * I / n = I
456
+ * I / 0 = I
457
+ * I / N = N
458
+ * I / I = N
459
+ *
460
+ * Return a new Decimal whose value is the value of this Decimal divided by `y`, rounded to
461
+ * `precision` significant digits using rounding mode `rounding`.
462
+ *
463
+ */
464
+ P.dividedBy = P.div = function (y) {
465
+ return divide(this, new this.constructor(y));
466
+ };
467
+
468
+
469
+ /*
470
+ * Return a new Decimal whose value is the integer part of dividing the value of this Decimal
471
+ * by the value of `y`, rounded to `precision` significant digits using rounding mode `rounding`.
472
+ *
473
+ */
474
+ P.dividedToIntegerBy = P.divToInt = function (y) {
475
+ var x = this,
476
+ Ctor = x.constructor;
477
+ return finalise(divide(x, new Ctor(y), 0, 1, 1), Ctor.precision, Ctor.rounding);
478
+ };
479
+
480
+
481
+ /*
482
+ * Return true if the value of this Decimal is equal to the value of `y`, otherwise return false.
483
+ *
484
+ */
485
+ P.equals = P.eq = function (y) {
486
+ return this.cmp(y) === 0;
487
+ };
488
+
489
+
490
+ /*
491
+ * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the
492
+ * direction of negative Infinity.
493
+ *
494
+ */
495
+ P.floor = function () {
496
+ return finalise(new this.constructor(this), this.e + 1, 3);
497
+ };
498
+
499
+
500
+ /*
501
+ * Return true if the value of this Decimal is greater than the value of `y`, otherwise return
502
+ * false.
503
+ *
504
+ */
505
+ P.greaterThan = P.gt = function (y) {
506
+ return this.cmp(y) > 0;
507
+ };
508
+
509
+
510
+ /*
511
+ * Return true if the value of this Decimal is greater than or equal to the value of `y`,
512
+ * otherwise return false.
513
+ *
514
+ */
515
+ P.greaterThanOrEqualTo = P.gte = function (y) {
516
+ var k = this.cmp(y);
517
+ return k == 1 || k === 0;
518
+ };
519
+
520
+
521
+ /*
522
+ * Return a new Decimal whose value is the hyperbolic cosine of the value in radians of this
523
+ * Decimal.
524
+ *
525
+ * Domain: [-Infinity, Infinity]
526
+ * Range: [1, Infinity]
527
+ *
528
+ * cosh(x) = 1 + x^2/2! + x^4/4! + x^6/6! + ...
529
+ *
530
+ * cosh(0) = 1
531
+ * cosh(-0) = 1
532
+ * cosh(Infinity) = Infinity
533
+ * cosh(-Infinity) = Infinity
534
+ * cosh(NaN) = NaN
535
+ *
536
+ * x time taken (ms) result
537
+ * 1000 9 9.8503555700852349694e+433
538
+ * 10000 25 4.4034091128314607936e+4342
539
+ * 100000 171 1.4033316802130615897e+43429
540
+ * 1000000 3817 1.5166076984010437725e+434294
541
+ * 10000000 abandoned after 2 minute wait
542
+ *
543
+ * TODO? Compare performance of cosh(x) = 0.5 * (exp(x) + exp(-x))
544
+ *
545
+ */
546
+ P.hyperbolicCosine = P.cosh = function () {
547
+ var k, n, pr, rm, len,
548
+ x = this,
549
+ Ctor = x.constructor,
550
+ one = new Ctor(1);
551
+
552
+ if (!x.isFinite()) return new Ctor(x.s ? 1 / 0 : NaN);
553
+ if (x.isZero()) return one;
554
+
555
+ pr = Ctor.precision;
556
+ rm = Ctor.rounding;
557
+ Ctor.precision = pr + Math.max(x.e, x.sd()) + 4;
558
+ Ctor.rounding = 1;
559
+ len = x.d.length;
560
+
561
+ // Argument reduction: cos(4x) = 1 - 8cos^2(x) + 8cos^4(x) + 1
562
+ // i.e. cos(x) = 1 - cos^2(x/4)(8 - 8cos^2(x/4))
563
+
564
+ // Estimate the optimum number of times to use the argument reduction.
565
+ // TODO? Estimation reused from cosine() and may not be optimal here.
566
+ if (len < 32) {
567
+ k = Math.ceil(len / 3);
568
+ n = (1 / tinyPow(4, k)).toString();
569
+ } else {
570
+ k = 16;
571
+ n = '2.3283064365386962890625e-10';
572
+ }
573
+
574
+ x = taylorSeries(Ctor, 1, x.times(n), new Ctor(1), true);
575
+
576
+ // Reverse argument reduction
577
+ var cosh2_x,
578
+ i = k,
579
+ d8 = new Ctor(8);
580
+ for (; i--;) {
581
+ cosh2_x = x.times(x);
582
+ x = one.minus(cosh2_x.times(d8.minus(cosh2_x.times(d8))));
583
+ }
584
+
585
+ return finalise(x, Ctor.precision = pr, Ctor.rounding = rm, true);
586
+ };
587
+
588
+
589
+ /*
590
+ * Return a new Decimal whose value is the hyperbolic sine of the value in radians of this
591
+ * Decimal.
592
+ *
593
+ * Domain: [-Infinity, Infinity]
594
+ * Range: [-Infinity, Infinity]
595
+ *
596
+ * sinh(x) = x + x^3/3! + x^5/5! + x^7/7! + ...
597
+ *
598
+ * sinh(0) = 0
599
+ * sinh(-0) = -0
600
+ * sinh(Infinity) = Infinity
601
+ * sinh(-Infinity) = -Infinity
602
+ * sinh(NaN) = NaN
603
+ *
604
+ * x time taken (ms)
605
+ * 10 2 ms
606
+ * 100 5 ms
607
+ * 1000 14 ms
608
+ * 10000 82 ms
609
+ * 100000 886 ms 1.4033316802130615897e+43429
610
+ * 200000 2613 ms
611
+ * 300000 5407 ms
612
+ * 400000 8824 ms
613
+ * 500000 13026 ms 8.7080643612718084129e+217146
614
+ * 1000000 48543 ms
615
+ *
616
+ * TODO? Compare performance of sinh(x) = 0.5 * (exp(x) - exp(-x))
617
+ *
618
+ */
619
+ P.hyperbolicSine = P.sinh = function () {
620
+ var k, pr, rm, len,
621
+ x = this,
622
+ Ctor = x.constructor;
623
+
624
+ if (!x.isFinite() || x.isZero()) return new Ctor(x);
625
+
626
+ pr = Ctor.precision;
627
+ rm = Ctor.rounding;
628
+ Ctor.precision = pr + Math.max(x.e, x.sd()) + 4;
629
+ Ctor.rounding = 1;
630
+ len = x.d.length;
631
+
632
+ if (len < 3) {
633
+ x = taylorSeries(Ctor, 2, x, x, true);
634
+ } else {
635
+
636
+ // Alternative argument reduction: sinh(3x) = sinh(x)(3 + 4sinh^2(x))
637
+ // i.e. sinh(x) = sinh(x/3)(3 + 4sinh^2(x/3))
638
+ // 3 multiplications and 1 addition
639
+
640
+ // Argument reduction: sinh(5x) = sinh(x)(5 + sinh^2(x)(20 + 16sinh^2(x)))
641
+ // i.e. sinh(x) = sinh(x/5)(5 + sinh^2(x/5)(20 + 16sinh^2(x/5)))
642
+ // 4 multiplications and 2 additions
643
+
644
+ // Estimate the optimum number of times to use the argument reduction.
645
+ k = 1.4 * Math.sqrt(len);
646
+ k = k > 16 ? 16 : k | 0;
647
+
648
+ x = x.times(1 / tinyPow(5, k));
649
+ x = taylorSeries(Ctor, 2, x, x, true);
650
+
651
+ // Reverse argument reduction
652
+ var sinh2_x,
653
+ d5 = new Ctor(5),
654
+ d16 = new Ctor(16),
655
+ d20 = new Ctor(20);
656
+ for (; k--;) {
657
+ sinh2_x = x.times(x);
658
+ x = x.times(d5.plus(sinh2_x.times(d16.times(sinh2_x).plus(d20))));
659
+ }
660
+ }
661
+
662
+ Ctor.precision = pr;
663
+ Ctor.rounding = rm;
664
+
665
+ return finalise(x, pr, rm, true);
666
+ };
667
+
668
+
669
+ /*
670
+ * Return a new Decimal whose value is the hyperbolic tangent of the value in radians of this
671
+ * Decimal.
672
+ *
673
+ * Domain: [-Infinity, Infinity]
674
+ * Range: [-1, 1]
675
+ *
676
+ * tanh(x) = sinh(x) / cosh(x)
677
+ *
678
+ * tanh(0) = 0
679
+ * tanh(-0) = -0
680
+ * tanh(Infinity) = 1
681
+ * tanh(-Infinity) = -1
682
+ * tanh(NaN) = NaN
683
+ *
684
+ */
685
+ P.hyperbolicTangent = P.tanh = function () {
686
+ var pr, rm,
687
+ x = this,
688
+ Ctor = x.constructor;
689
+
690
+ if (!x.isFinite()) return new Ctor(x.s);
691
+ if (x.isZero()) return new Ctor(x);
692
+
693
+ pr = Ctor.precision;
694
+ rm = Ctor.rounding;
695
+ Ctor.precision = pr + 7;
696
+ Ctor.rounding = 1;
697
+
698
+ return divide(x.sinh(), x.cosh(), Ctor.precision = pr, Ctor.rounding = rm);
699
+ };
700
+
701
+
702
+ /*
703
+ * Return a new Decimal whose value is the arccosine (inverse cosine) in radians of the value of
704
+ * this Decimal.
705
+ *
706
+ * Domain: [-1, 1]
707
+ * Range: [0, pi]
708
+ *
709
+ * acos(x) = pi/2 - asin(x)
710
+ *
711
+ * acos(0) = pi/2
712
+ * acos(-0) = pi/2
713
+ * acos(1) = 0
714
+ * acos(-1) = pi
715
+ * acos(1/2) = pi/3
716
+ * acos(-1/2) = 2*pi/3
717
+ * acos(|x| > 1) = NaN
718
+ * acos(NaN) = NaN
719
+ *
720
+ */
721
+ P.inverseCosine = P.acos = function () {
722
+ var x = this,
723
+ Ctor = x.constructor,
724
+ k = x.abs().cmp(1),
725
+ pr = Ctor.precision,
726
+ rm = Ctor.rounding;
727
+
728
+ if (k !== -1) {
729
+ return k === 0
730
+ // |x| is 1
731
+ ? x.isNeg() ? getPi(Ctor, pr, rm) : new Ctor(0)
732
+ // |x| > 1 or x is NaN
733
+ : new Ctor(NaN);
734
+ }
735
+
736
+ if (x.isZero()) return getPi(Ctor, pr + 4, rm).times(0.5);
737
+
738
+ // TODO? Special case acos(0.5) = pi/3 and acos(-0.5) = 2*pi/3
739
+
740
+ Ctor.precision = pr + 6;
741
+ Ctor.rounding = 1;
742
+
743
+ // See https://github.com/MikeMcl/decimal.js/pull/217
744
+ x = new Ctor(1).minus(x).div(x.plus(1)).sqrt().atan();
745
+
746
+ Ctor.precision = pr;
747
+ Ctor.rounding = rm;
748
+
749
+ return x.times(2);
750
+ };
751
+
752
+
753
+ /*
754
+ * Return a new Decimal whose value is the inverse of the hyperbolic cosine in radians of the
755
+ * value of this Decimal.
756
+ *
757
+ * Domain: [1, Infinity]
758
+ * Range: [0, Infinity]
759
+ *
760
+ * acosh(x) = ln(x + sqrt(x^2 - 1))
761
+ *
762
+ * acosh(x < 1) = NaN
763
+ * acosh(NaN) = NaN
764
+ * acosh(Infinity) = Infinity
765
+ * acosh(-Infinity) = NaN
766
+ * acosh(0) = NaN
767
+ * acosh(-0) = NaN
768
+ * acosh(1) = 0
769
+ * acosh(-1) = NaN
770
+ *
771
+ */
772
+ P.inverseHyperbolicCosine = P.acosh = function () {
773
+ var pr, rm,
774
+ x = this,
775
+ Ctor = x.constructor;
776
+
777
+ if (x.lte(1)) return new Ctor(x.eq(1) ? 0 : NaN);
778
+ if (!x.isFinite()) return new Ctor(x);
779
+
780
+ pr = Ctor.precision;
781
+ rm = Ctor.rounding;
782
+ Ctor.precision = pr + Math.max(Math.abs(x.e), x.sd()) + 4;
783
+ Ctor.rounding = 1;
784
+ external = false;
785
+
786
+ x = x.times(x).minus(1).sqrt().plus(x);
787
+
788
+ external = true;
789
+ Ctor.precision = pr;
790
+ Ctor.rounding = rm;
791
+
792
+ return x.ln();
793
+ };
794
+
795
+
796
+ /*
797
+ * Return a new Decimal whose value is the inverse of the hyperbolic sine in radians of the value
798
+ * of this Decimal.
799
+ *
800
+ * Domain: [-Infinity, Infinity]
801
+ * Range: [-Infinity, Infinity]
802
+ *
803
+ * asinh(x) = ln(x + sqrt(x^2 + 1))
804
+ *
805
+ * asinh(NaN) = NaN
806
+ * asinh(Infinity) = Infinity
807
+ * asinh(-Infinity) = -Infinity
808
+ * asinh(0) = 0
809
+ * asinh(-0) = -0
810
+ *
811
+ */
812
+ P.inverseHyperbolicSine = P.asinh = function () {
813
+ var pr, rm,
814
+ x = this,
815
+ Ctor = x.constructor;
816
+
817
+ if (!x.isFinite() || x.isZero()) return new Ctor(x);
818
+
819
+ pr = Ctor.precision;
820
+ rm = Ctor.rounding;
821
+ Ctor.precision = pr + 2 * Math.max(Math.abs(x.e), x.sd()) + 6;
822
+ Ctor.rounding = 1;
823
+ external = false;
824
+
825
+ x = x.times(x).plus(1).sqrt().plus(x);
826
+
827
+ external = true;
828
+ Ctor.precision = pr;
829
+ Ctor.rounding = rm;
830
+
831
+ return x.ln();
832
+ };
833
+
834
+
835
+ /*
836
+ * Return a new Decimal whose value is the inverse of the hyperbolic tangent in radians of the
837
+ * value of this Decimal.
838
+ *
839
+ * Domain: [-1, 1]
840
+ * Range: [-Infinity, Infinity]
841
+ *
842
+ * atanh(x) = 0.5 * ln((1 + x) / (1 - x))
843
+ *
844
+ * atanh(|x| > 1) = NaN
845
+ * atanh(NaN) = NaN
846
+ * atanh(Infinity) = NaN
847
+ * atanh(-Infinity) = NaN
848
+ * atanh(0) = 0
849
+ * atanh(-0) = -0
850
+ * atanh(1) = Infinity
851
+ * atanh(-1) = -Infinity
852
+ *
853
+ */
854
+ P.inverseHyperbolicTangent = P.atanh = function () {
855
+ var pr, rm, wpr, xsd,
856
+ x = this,
857
+ Ctor = x.constructor;
858
+
859
+ if (!x.isFinite()) return new Ctor(NaN);
860
+ if (x.e >= 0) return new Ctor(x.abs().eq(1) ? x.s / 0 : x.isZero() ? x : NaN);
861
+
862
+ pr = Ctor.precision;
863
+ rm = Ctor.rounding;
864
+ xsd = x.sd();
865
+
866
+ if (Math.max(xsd, pr) < 2 * -x.e - 1) return finalise(new Ctor(x), pr, rm, true);
867
+
868
+ Ctor.precision = wpr = xsd - x.e;
869
+
870
+ x = divide(x.plus(1), new Ctor(1).minus(x), wpr + pr, 1);
871
+
872
+ Ctor.precision = pr + 4;
873
+ Ctor.rounding = 1;
874
+
875
+ x = x.ln();
876
+
877
+ Ctor.precision = pr;
878
+ Ctor.rounding = rm;
879
+
880
+ return x.times(0.5);
881
+ };
882
+
883
+
884
+ /*
885
+ * Return a new Decimal whose value is the arcsine (inverse sine) in radians of the value of this
886
+ * Decimal.
887
+ *
888
+ * Domain: [-Infinity, Infinity]
889
+ * Range: [-pi/2, pi/2]
890
+ *
891
+ * asin(x) = 2*atan(x/(1 + sqrt(1 - x^2)))
892
+ *
893
+ * asin(0) = 0
894
+ * asin(-0) = -0
895
+ * asin(1/2) = pi/6
896
+ * asin(-1/2) = -pi/6
897
+ * asin(1) = pi/2
898
+ * asin(-1) = -pi/2
899
+ * asin(|x| > 1) = NaN
900
+ * asin(NaN) = NaN
901
+ *
902
+ * TODO? Compare performance of Taylor series.
903
+ *
904
+ */
905
+ P.inverseSine = P.asin = function () {
906
+ var halfPi, k,
907
+ pr, rm,
908
+ x = this,
909
+ Ctor = x.constructor;
910
+
911
+ if (x.isZero()) return new Ctor(x);
912
+
913
+ k = x.abs().cmp(1);
914
+ pr = Ctor.precision;
915
+ rm = Ctor.rounding;
916
+
917
+ if (k !== -1) {
918
+
919
+ // |x| is 1
920
+ if (k === 0) {
921
+ halfPi = getPi(Ctor, pr + 4, rm).times(0.5);
922
+ halfPi.s = x.s;
923
+ return halfPi;
924
+ }
925
+
926
+ // |x| > 1 or x is NaN
927
+ return new Ctor(NaN);
928
+ }
929
+
930
+ // TODO? Special case asin(1/2) = pi/6 and asin(-1/2) = -pi/6
931
+
932
+ Ctor.precision = pr + 6;
933
+ Ctor.rounding = 1;
934
+
935
+ x = x.div(new Ctor(1).minus(x.times(x)).sqrt().plus(1)).atan();
936
+
937
+ Ctor.precision = pr;
938
+ Ctor.rounding = rm;
939
+
940
+ return x.times(2);
941
+ };
942
+
943
+
944
+ /*
945
+ * Return a new Decimal whose value is the arctangent (inverse tangent) in radians of the value
946
+ * of this Decimal.
947
+ *
948
+ * Domain: [-Infinity, Infinity]
949
+ * Range: [-pi/2, pi/2]
950
+ *
951
+ * atan(x) = x - x^3/3 + x^5/5 - x^7/7 + ...
952
+ *
953
+ * atan(0) = 0
954
+ * atan(-0) = -0
955
+ * atan(1) = pi/4
956
+ * atan(-1) = -pi/4
957
+ * atan(Infinity) = pi/2
958
+ * atan(-Infinity) = -pi/2
959
+ * atan(NaN) = NaN
960
+ *
961
+ */
962
+ P.inverseTangent = P.atan = function () {
963
+ var i, j, k, n, px, t, r, wpr, x2,
964
+ x = this,
965
+ Ctor = x.constructor,
966
+ pr = Ctor.precision,
967
+ rm = Ctor.rounding;
968
+
969
+ if (!x.isFinite()) {
970
+ if (!x.s) return new Ctor(NaN);
971
+ if (pr + 4 <= PI_PRECISION) {
972
+ r = getPi(Ctor, pr + 4, rm).times(0.5);
973
+ r.s = x.s;
974
+ return r;
975
+ }
976
+ } else if (x.isZero()) {
977
+ return new Ctor(x);
978
+ } else if (x.abs().eq(1) && pr + 4 <= PI_PRECISION) {
979
+ r = getPi(Ctor, pr + 4, rm).times(0.25);
980
+ r.s = x.s;
981
+ return r;
982
+ }
983
+
984
+ Ctor.precision = wpr = pr + 10;
985
+ Ctor.rounding = 1;
986
+
987
+ // TODO? if (x >= 1 && pr <= PI_PRECISION) atan(x) = halfPi * x.s - atan(1 / x);
988
+
989
+ // Argument reduction
990
+ // Ensure |x| < 0.42
991
+ // atan(x) = 2 * atan(x / (1 + sqrt(1 + x^2)))
992
+
993
+ k = Math.min(28, wpr / LOG_BASE + 2 | 0);
994
+
995
+ for (i = k; i; --i) x = x.div(x.times(x).plus(1).sqrt().plus(1));
996
+
997
+ external = false;
998
+
999
+ j = Math.ceil(wpr / LOG_BASE);
1000
+ n = 1;
1001
+ x2 = x.times(x);
1002
+ r = new Ctor(x);
1003
+ px = x;
1004
+
1005
+ // atan(x) = x - x^3/3 + x^5/5 - x^7/7 + ...
1006
+ for (; i !== -1;) {
1007
+ px = px.times(x2);
1008
+ t = r.minus(px.div(n += 2));
1009
+
1010
+ px = px.times(x2);
1011
+ r = t.plus(px.div(n += 2));
1012
+
1013
+ if (r.d[j] !== void 0) for (i = j; r.d[i] === t.d[i] && i--;);
1014
+ }
1015
+
1016
+ if (k) r = r.times(2 << (k - 1));
1017
+
1018
+ external = true;
1019
+
1020
+ return finalise(r, Ctor.precision = pr, Ctor.rounding = rm, true);
1021
+ };
1022
+
1023
+
1024
+ /*
1025
+ * Return true if the value of this Decimal is a finite number, otherwise return false.
1026
+ *
1027
+ */
1028
+ P.isFinite = function () {
1029
+ return !!this.d;
1030
+ };
1031
+
1032
+
1033
+ /*
1034
+ * Return true if the value of this Decimal is an integer, otherwise return false.
1035
+ *
1036
+ */
1037
+ P.isInteger = P.isInt = function () {
1038
+ return !!this.d && mathfloor(this.e / LOG_BASE) > this.d.length - 2;
1039
+ };
1040
+
1041
+
1042
+ /*
1043
+ * Return true if the value of this Decimal is NaN, otherwise return false.
1044
+ *
1045
+ */
1046
+ P.isNaN = function () {
1047
+ return !this.s;
1048
+ };
1049
+
1050
+
1051
+ /*
1052
+ * Return true if the value of this Decimal is negative, otherwise return false.
1053
+ *
1054
+ */
1055
+ P.isNegative = P.isNeg = function () {
1056
+ return this.s < 0;
1057
+ };
1058
+
1059
+
1060
+ /*
1061
+ * Return true if the value of this Decimal is positive, otherwise return false.
1062
+ *
1063
+ */
1064
+ P.isPositive = P.isPos = function () {
1065
+ return this.s > 0;
1066
+ };
1067
+
1068
+
1069
+ /*
1070
+ * Return true if the value of this Decimal is 0 or -0, otherwise return false.
1071
+ *
1072
+ */
1073
+ P.isZero = function () {
1074
+ return !!this.d && this.d[0] === 0;
1075
+ };
1076
+
1077
+
1078
+ /*
1079
+ * Return true if the value of this Decimal is less than `y`, otherwise return false.
1080
+ *
1081
+ */
1082
+ P.lessThan = P.lt = function (y) {
1083
+ return this.cmp(y) < 0;
1084
+ };
1085
+
1086
+
1087
+ /*
1088
+ * Return true if the value of this Decimal is less than or equal to `y`, otherwise return false.
1089
+ *
1090
+ */
1091
+ P.lessThanOrEqualTo = P.lte = function (y) {
1092
+ return this.cmp(y) < 1;
1093
+ };
1094
+
1095
+
1096
+ /*
1097
+ * Return the logarithm of the value of this Decimal to the specified base, rounded to `precision`
1098
+ * significant digits using rounding mode `rounding`.
1099
+ *
1100
+ * If no base is specified, return log[10](arg).
1101
+ *
1102
+ * log[base](arg) = ln(arg) / ln(base)
1103
+ *
1104
+ * The result will always be correctly rounded if the base of the log is 10, and 'almost always'
1105
+ * otherwise:
1106
+ *
1107
+ * Depending on the rounding mode, the result may be incorrectly rounded if the first fifteen
1108
+ * rounding digits are [49]99999999999999 or [50]00000000000000. In that case, the maximum error
1109
+ * between the result and the correctly rounded result will be one ulp (unit in the last place).
1110
+ *
1111
+ * log[-b](a) = NaN
1112
+ * log[0](a) = NaN
1113
+ * log[1](a) = NaN
1114
+ * log[NaN](a) = NaN
1115
+ * log[Infinity](a) = NaN
1116
+ * log[b](0) = -Infinity
1117
+ * log[b](-0) = -Infinity
1118
+ * log[b](-a) = NaN
1119
+ * log[b](1) = 0
1120
+ * log[b](Infinity) = Infinity
1121
+ * log[b](NaN) = NaN
1122
+ *
1123
+ * [base] {number|string|bigint|Decimal} The base of the logarithm.
1124
+ *
1125
+ */
1126
+ P.logarithm = P.log = function (base) {
1127
+ var isBase10, d, denominator, k, inf, num, sd, r,
1128
+ arg = this,
1129
+ Ctor = arg.constructor,
1130
+ pr = Ctor.precision,
1131
+ rm = Ctor.rounding,
1132
+ guard = 5;
1133
+
1134
+ // Default base is 10.
1135
+ if (base == null) {
1136
+ base = new Ctor(10);
1137
+ isBase10 = true;
1138
+ } else {
1139
+ base = new Ctor(base);
1140
+ d = base.d;
1141
+
1142
+ // Return NaN if base is negative, or non-finite, or is 0 or 1.
1143
+ if (base.s < 0 || !d || !d[0] || base.eq(1)) return new Ctor(NaN);
1144
+
1145
+ isBase10 = base.eq(10);
1146
+ }
1147
+
1148
+ d = arg.d;
1149
+
1150
+ // Is arg negative, non-finite, 0 or 1?
1151
+ if (arg.s < 0 || !d || !d[0] || arg.eq(1)) {
1152
+ return new Ctor(d && !d[0] ? -1 / 0 : arg.s != 1 ? NaN : d ? 0 : 1 / 0);
1153
+ }
1154
+
1155
+ // The result will have a non-terminating decimal expansion if base is 10 and arg is not an
1156
+ // integer power of 10.
1157
+ if (isBase10) {
1158
+ if (d.length > 1) {
1159
+ inf = true;
1160
+ } else {
1161
+ for (k = d[0]; k % 10 === 0;) k /= 10;
1162
+ inf = k !== 1;
1163
+ }
1164
+ }
1165
+
1166
+ external = false;
1167
+ sd = pr + guard;
1168
+ num = naturalLogarithm(arg, sd);
1169
+ denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd);
1170
+
1171
+ // The result will have 5 rounding digits.
1172
+ r = divide(num, denominator, sd, 1);
1173
+
1174
+ // If at a rounding boundary, i.e. the result's rounding digits are [49]9999 or [50]0000,
1175
+ // calculate 10 further digits.
1176
+ //
1177
+ // If the result is known to have an infinite decimal expansion, repeat this until it is clear
1178
+ // that the result is above or below the boundary. Otherwise, if after calculating the 10
1179
+ // further digits, the last 14 are nines, round up and assume the result is exact.
1180
+ // Also assume the result is exact if the last 14 are zero.
1181
+ //
1182
+ // Example of a result that will be incorrectly rounded:
1183
+ // log[1048576](4503599627370502) = 2.60000000000000009610279511444746...
1184
+ // The above result correctly rounded using ROUND_CEIL to 1 decimal place should be 2.7, but it
1185
+ // will be given as 2.6 as there are 15 zeros immediately after the requested decimal place, so
1186
+ // the exact result would be assumed to be 2.6, which rounded using ROUND_CEIL to 1 decimal
1187
+ // place is still 2.6.
1188
+ if (checkRoundingDigits(r.d, k = pr, rm)) {
1189
+
1190
+ do {
1191
+ sd += 10;
1192
+ num = naturalLogarithm(arg, sd);
1193
+ denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd);
1194
+ r = divide(num, denominator, sd, 1);
1195
+
1196
+ if (!inf) {
1197
+
1198
+ // Check for 14 nines from the 2nd rounding digit, as the first may be 4.
1199
+ if (+digitsToString(r.d).slice(k + 1, k + 15) + 1 == 1e14) {
1200
+ r = finalise(r, pr + 1, 0);
1201
+ }
1202
+
1203
+ break;
1204
+ }
1205
+ } while (checkRoundingDigits(r.d, k += 10, rm));
1206
+ }
1207
+
1208
+ external = true;
1209
+
1210
+ return finalise(r, pr, rm);
1211
+ };
1212
+
1213
+
1214
+ /*
1215
+ * Return a new Decimal whose value is the maximum of the arguments and the value of this Decimal.
1216
+ *
1217
+ * arguments {number|string|bigint|Decimal}
1218
+ *
1219
+ P.max = function () {
1220
+ Array.prototype.push.call(arguments, this);
1221
+ return maxOrMin(this.constructor, arguments, -1);
1222
+ };
1223
+ */
1224
+
1225
+
1226
+ /*
1227
+ * Return a new Decimal whose value is the minimum of the arguments and the value of this Decimal.
1228
+ *
1229
+ * arguments {number|string|bigint|Decimal}
1230
+ *
1231
+ P.min = function () {
1232
+ Array.prototype.push.call(arguments, this);
1233
+ return maxOrMin(this.constructor, arguments, 1);
1234
+ };
1235
+ */
1236
+
1237
+
1238
+ /*
1239
+ * n - 0 = n
1240
+ * n - N = N
1241
+ * n - I = -I
1242
+ * 0 - n = -n
1243
+ * 0 - 0 = 0
1244
+ * 0 - N = N
1245
+ * 0 - I = -I
1246
+ * N - n = N
1247
+ * N - 0 = N
1248
+ * N - N = N
1249
+ * N - I = N
1250
+ * I - n = I
1251
+ * I - 0 = I
1252
+ * I - N = N
1253
+ * I - I = N
1254
+ *
1255
+ * Return a new Decimal whose value is the value of this Decimal minus `y`, rounded to `precision`
1256
+ * significant digits using rounding mode `rounding`.
1257
+ *
1258
+ */
1259
+ P.minus = P.sub = function (y) {
1260
+ var d, e, i, j, k, len, pr, rm, xd, xe, xLTy, yd,
1261
+ x = this,
1262
+ Ctor = x.constructor;
1263
+
1264
+ y = new Ctor(y);
1265
+
1266
+ // If either is not finite...
1267
+ if (!x.d || !y.d) {
1268
+
1269
+ // Return NaN if either is NaN.
1270
+ if (!x.s || !y.s) y = new Ctor(NaN);
1271
+
1272
+ // Return y negated if x is finite and y is ±Infinity.
1273
+ else if (x.d) y.s = -y.s;
1274
+
1275
+ // Return x if y is finite and x is ±Infinity.
1276
+ // Return x if both are ±Infinity with different signs.
1277
+ // Return NaN if both are ±Infinity with the same sign.
1278
+ else y = new Ctor(y.d || x.s !== y.s ? x : NaN);
1279
+
1280
+ return y;
1281
+ }
1282
+
1283
+ // If signs differ...
1284
+ if (x.s != y.s) {
1285
+ y.s = -y.s;
1286
+ return x.plus(y);
1287
+ }
1288
+
1289
+ xd = x.d;
1290
+ yd = y.d;
1291
+ pr = Ctor.precision;
1292
+ rm = Ctor.rounding;
1293
+
1294
+ // If either is zero...
1295
+ if (!xd[0] || !yd[0]) {
1296
+
1297
+ // Return y negated if x is zero and y is non-zero.
1298
+ if (yd[0]) y.s = -y.s;
1299
+
1300
+ // Return x if y is zero and x is non-zero.
1301
+ else if (xd[0]) y = new Ctor(x);
1302
+
1303
+ // Return zero if both are zero.
1304
+ // From IEEE 754 (2008) 6.3: 0 - 0 = -0 - -0 = -0 when rounding to -Infinity.
1305
+ else return new Ctor(rm === 3 ? -0 : 0);
1306
+
1307
+ return external ? finalise(y, pr, rm) : y;
1308
+ }
1309
+
1310
+ // x and y are finite, non-zero numbers with the same sign.
1311
+
1312
+ // Calculate base 1e7 exponents.
1313
+ e = mathfloor(y.e / LOG_BASE);
1314
+ xe = mathfloor(x.e / LOG_BASE);
1315
+
1316
+ xd = xd.slice();
1317
+ k = xe - e;
1318
+
1319
+ // If base 1e7 exponents differ...
1320
+ if (k) {
1321
+ xLTy = k < 0;
1322
+
1323
+ if (xLTy) {
1324
+ d = xd;
1325
+ k = -k;
1326
+ len = yd.length;
1327
+ } else {
1328
+ d = yd;
1329
+ e = xe;
1330
+ len = xd.length;
1331
+ }
1332
+
1333
+ // Numbers with massively different exponents would result in a very high number of
1334
+ // zeros needing to be prepended, but this can be avoided while still ensuring correct
1335
+ // rounding by limiting the number of zeros to `Math.ceil(pr / LOG_BASE) + 2`.
1336
+ i = Math.max(Math.ceil(pr / LOG_BASE), len) + 2;
1337
+
1338
+ if (k > i) {
1339
+ k = i;
1340
+ d.length = 1;
1341
+ }
1342
+
1343
+ // Prepend zeros to equalise exponents.
1344
+ d.reverse();
1345
+ for (i = k; i--;) d.push(0);
1346
+ d.reverse();
1347
+
1348
+ // Base 1e7 exponents equal.
1349
+ } else {
1350
+
1351
+ // Check digits to determine which is the bigger number.
1352
+
1353
+ i = xd.length;
1354
+ len = yd.length;
1355
+ xLTy = i < len;
1356
+ if (xLTy) len = i;
1357
+
1358
+ for (i = 0; i < len; i++) {
1359
+ if (xd[i] != yd[i]) {
1360
+ xLTy = xd[i] < yd[i];
1361
+ break;
1362
+ }
1363
+ }
1364
+
1365
+ k = 0;
1366
+ }
1367
+
1368
+ if (xLTy) {
1369
+ d = xd;
1370
+ xd = yd;
1371
+ yd = d;
1372
+ y.s = -y.s;
1373
+ }
1374
+
1375
+ len = xd.length;
1376
+
1377
+ // Append zeros to `xd` if shorter.
1378
+ // Don't add zeros to `yd` if shorter as subtraction only needs to start at `yd` length.
1379
+ for (i = yd.length - len; i > 0; --i) xd[len++] = 0;
1380
+
1381
+ // Subtract yd from xd.
1382
+ for (i = yd.length; i > k;) {
1383
+
1384
+ if (xd[--i] < yd[i]) {
1385
+ for (j = i; j && xd[--j] === 0;) xd[j] = BASE - 1;
1386
+ --xd[j];
1387
+ xd[i] += BASE;
1388
+ }
1389
+
1390
+ xd[i] -= yd[i];
1391
+ }
1392
+
1393
+ // Remove trailing zeros.
1394
+ for (; xd[--len] === 0;) xd.pop();
1395
+
1396
+ // Remove leading zeros and adjust exponent accordingly.
1397
+ for (; xd[0] === 0; xd.shift()) --e;
1398
+
1399
+ // Zero?
1400
+ if (!xd[0]) return new Ctor(rm === 3 ? -0 : 0);
1401
+
1402
+ y.d = xd;
1403
+ y.e = getBase10Exponent(xd, e);
1404
+
1405
+ return external ? finalise(y, pr, rm) : y;
1406
+ };
1407
+
1408
+
1409
+ /*
1410
+ * n % 0 = N
1411
+ * n % N = N
1412
+ * n % I = n
1413
+ * 0 % n = 0
1414
+ * -0 % n = -0
1415
+ * 0 % 0 = N
1416
+ * 0 % N = N
1417
+ * 0 % I = 0
1418
+ * N % n = N
1419
+ * N % 0 = N
1420
+ * N % N = N
1421
+ * N % I = N
1422
+ * I % n = N
1423
+ * I % 0 = N
1424
+ * I % N = N
1425
+ * I % I = N
1426
+ *
1427
+ * Return a new Decimal whose value is the value of this Decimal modulo `y`, rounded to
1428
+ * `precision` significant digits using rounding mode `rounding`.
1429
+ *
1430
+ * The result depends on the modulo mode.
1431
+ *
1432
+ */
1433
+ P.modulo = P.mod = function (y) {
1434
+ var q,
1435
+ x = this,
1436
+ Ctor = x.constructor;
1437
+
1438
+ y = new Ctor(y);
1439
+
1440
+ // Return NaN if x is ±Infinity or NaN, or y is NaN or ±0.
1441
+ if (!x.d || !y.s || y.d && !y.d[0]) return new Ctor(NaN);
1442
+
1443
+ // Return x if y is ±Infinity or x is ±0.
1444
+ if (!y.d || x.d && !x.d[0]) {
1445
+ return finalise(new Ctor(x), Ctor.precision, Ctor.rounding);
1446
+ }
1447
+
1448
+ // Prevent rounding of intermediate calculations.
1449
+ external = false;
1450
+
1451
+ if (Ctor.modulo == 9) {
1452
+
1453
+ // Euclidian division: q = sign(y) * floor(x / abs(y))
1454
+ // result = x - q * y where 0 <= result < abs(y)
1455
+ q = divide(x, y.abs(), 0, 3, 1);
1456
+ q.s *= y.s;
1457
+ } else {
1458
+ q = divide(x, y, 0, Ctor.modulo, 1);
1459
+ }
1460
+
1461
+ q = q.times(y);
1462
+
1463
+ external = true;
1464
+
1465
+ return x.minus(q);
1466
+ };
1467
+
1468
+
1469
+ /*
1470
+ * Return a new Decimal whose value is the natural exponential of the value of this Decimal,
1471
+ * i.e. the base e raised to the power the value of this Decimal, rounded to `precision`
1472
+ * significant digits using rounding mode `rounding`.
1473
+ *
1474
+ */
1475
+ P.naturalExponential = P.exp = function () {
1476
+ return naturalExponential(this);
1477
+ };
1478
+
1479
+
1480
+ /*
1481
+ * Return a new Decimal whose value is the natural logarithm of the value of this Decimal,
1482
+ * rounded to `precision` significant digits using rounding mode `rounding`.
1483
+ *
1484
+ */
1485
+ P.naturalLogarithm = P.ln = function () {
1486
+ return naturalLogarithm(this);
1487
+ };
1488
+
1489
+
1490
+ /*
1491
+ * Return a new Decimal whose value is the value of this Decimal negated, i.e. as if multiplied by
1492
+ * -1.
1493
+ *
1494
+ */
1495
+ P.negated = P.neg = function () {
1496
+ var x = new this.constructor(this);
1497
+ x.s = -x.s;
1498
+ return finalise(x);
1499
+ };
1500
+
1501
+
1502
+ /*
1503
+ * n + 0 = n
1504
+ * n + N = N
1505
+ * n + I = I
1506
+ * 0 + n = n
1507
+ * 0 + 0 = 0
1508
+ * 0 + N = N
1509
+ * 0 + I = I
1510
+ * N + n = N
1511
+ * N + 0 = N
1512
+ * N + N = N
1513
+ * N + I = N
1514
+ * I + n = I
1515
+ * I + 0 = I
1516
+ * I + N = N
1517
+ * I + I = I
1518
+ *
1519
+ * Return a new Decimal whose value is the value of this Decimal plus `y`, rounded to `precision`
1520
+ * significant digits using rounding mode `rounding`.
1521
+ *
1522
+ */
1523
+ P.plus = P.add = function (y) {
1524
+ var carry, d, e, i, k, len, pr, rm, xd, yd,
1525
+ x = this,
1526
+ Ctor = x.constructor;
1527
+
1528
+ y = new Ctor(y);
1529
+
1530
+ // If either is not finite...
1531
+ if (!x.d || !y.d) {
1532
+
1533
+ // Return NaN if either is NaN.
1534
+ if (!x.s || !y.s) y = new Ctor(NaN);
1535
+
1536
+ // Return x if y is finite and x is ±Infinity.
1537
+ // Return x if both are ±Infinity with the same sign.
1538
+ // Return NaN if both are ±Infinity with different signs.
1539
+ // Return y if x is finite and y is ±Infinity.
1540
+ else if (!x.d) y = new Ctor(y.d || x.s === y.s ? x : NaN);
1541
+
1542
+ return y;
1543
+ }
1544
+
1545
+ // If signs differ...
1546
+ if (x.s != y.s) {
1547
+ y.s = -y.s;
1548
+ return x.minus(y);
1549
+ }
1550
+
1551
+ xd = x.d;
1552
+ yd = y.d;
1553
+ pr = Ctor.precision;
1554
+ rm = Ctor.rounding;
1555
+
1556
+ // If either is zero...
1557
+ if (!xd[0] || !yd[0]) {
1558
+
1559
+ // Return x if y is zero.
1560
+ // Return y if y is non-zero.
1561
+ if (!yd[0]) y = new Ctor(x);
1562
+
1563
+ return external ? finalise(y, pr, rm) : y;
1564
+ }
1565
+
1566
+ // x and y are finite, non-zero numbers with the same sign.
1567
+
1568
+ // Calculate base 1e7 exponents.
1569
+ k = mathfloor(x.e / LOG_BASE);
1570
+ e = mathfloor(y.e / LOG_BASE);
1571
+
1572
+ xd = xd.slice();
1573
+ i = k - e;
1574
+
1575
+ // If base 1e7 exponents differ...
1576
+ if (i) {
1577
+
1578
+ if (i < 0) {
1579
+ d = xd;
1580
+ i = -i;
1581
+ len = yd.length;
1582
+ } else {
1583
+ d = yd;
1584
+ e = k;
1585
+ len = xd.length;
1586
+ }
1587
+
1588
+ // Limit number of zeros prepended to max(ceil(pr / LOG_BASE), len) + 1.
1589
+ k = Math.ceil(pr / LOG_BASE);
1590
+ len = k > len ? k + 1 : len + 1;
1591
+
1592
+ if (i > len) {
1593
+ i = len;
1594
+ d.length = 1;
1595
+ }
1596
+
1597
+ // Prepend zeros to equalise exponents. Note: Faster to use reverse then do unshifts.
1598
+ d.reverse();
1599
+ for (; i--;) d.push(0);
1600
+ d.reverse();
1601
+ }
1602
+
1603
+ len = xd.length;
1604
+ i = yd.length;
1605
+
1606
+ // If yd is longer than xd, swap xd and yd so xd points to the longer array.
1607
+ if (len - i < 0) {
1608
+ i = len;
1609
+ d = yd;
1610
+ yd = xd;
1611
+ xd = d;
1612
+ }
1613
+
1614
+ // Only start adding at yd.length - 1 as the further digits of xd can be left as they are.
1615
+ for (carry = 0; i;) {
1616
+ carry = (xd[--i] = xd[i] + yd[i] + carry) / BASE | 0;
1617
+ xd[i] %= BASE;
1618
+ }
1619
+
1620
+ if (carry) {
1621
+ xd.unshift(carry);
1622
+ ++e;
1623
+ }
1624
+
1625
+ // Remove trailing zeros.
1626
+ // No need to check for zero, as +x + +y != 0 && -x + -y != 0
1627
+ for (len = xd.length; xd[--len] == 0;) xd.pop();
1628
+
1629
+ y.d = xd;
1630
+ y.e = getBase10Exponent(xd, e);
1631
+
1632
+ return external ? finalise(y, pr, rm) : y;
1633
+ };
1634
+
1635
+
1636
+ /*
1637
+ * Return the number of significant digits of the value of this Decimal.
1638
+ *
1639
+ * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.
1640
+ *
1641
+ */
1642
+ P.precision = P.sd = function (z) {
1643
+ var k,
1644
+ x = this;
1645
+
1646
+ if (z !== void 0 && z !== !!z && z !== 1 && z !== 0) throw Error(invalidArgument + z);
1647
+
1648
+ if (x.d) {
1649
+ k = getPrecision(x.d);
1650
+ if (z && x.e + 1 > k) k = x.e + 1;
1651
+ } else {
1652
+ k = NaN;
1653
+ }
1654
+
1655
+ return k;
1656
+ };
1657
+
1658
+
1659
+ /*
1660
+ * Return a new Decimal whose value is the value of this Decimal rounded to a whole number using
1661
+ * rounding mode `rounding`.
1662
+ *
1663
+ */
1664
+ P.round = function () {
1665
+ var x = this,
1666
+ Ctor = x.constructor;
1667
+
1668
+ return finalise(new Ctor(x), x.e + 1, Ctor.rounding);
1669
+ };
1670
+
1671
+
1672
+ /*
1673
+ * Return a new Decimal whose value is the sine of the value in radians of this Decimal.
1674
+ *
1675
+ * Domain: [-Infinity, Infinity]
1676
+ * Range: [-1, 1]
1677
+ *
1678
+ * sin(x) = x - x^3/3! + x^5/5! - ...
1679
+ *
1680
+ * sin(0) = 0
1681
+ * sin(-0) = -0
1682
+ * sin(Infinity) = NaN
1683
+ * sin(-Infinity) = NaN
1684
+ * sin(NaN) = NaN
1685
+ *
1686
+ */
1687
+ P.sine = P.sin = function () {
1688
+ var pr, rm,
1689
+ x = this,
1690
+ Ctor = x.constructor;
1691
+
1692
+ if (!x.isFinite()) return new Ctor(NaN);
1693
+ if (x.isZero()) return new Ctor(x);
1694
+
1695
+ pr = Ctor.precision;
1696
+ rm = Ctor.rounding;
1697
+ Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE;
1698
+ Ctor.rounding = 1;
1699
+
1700
+ x = sine(Ctor, toLessThanHalfPi(Ctor, x));
1701
+
1702
+ Ctor.precision = pr;
1703
+ Ctor.rounding = rm;
1704
+
1705
+ return finalise(quadrant > 2 ? x.neg() : x, pr, rm, true);
1706
+ };
1707
+
1708
+
1709
+ /*
1710
+ * Return a new Decimal whose value is the square root of this Decimal, rounded to `precision`
1711
+ * significant digits using rounding mode `rounding`.
1712
+ *
1713
+ * sqrt(-n) = N
1714
+ * sqrt(N) = N
1715
+ * sqrt(-I) = N
1716
+ * sqrt(I) = I
1717
+ * sqrt(0) = 0
1718
+ * sqrt(-0) = -0
1719
+ *
1720
+ */
1721
+ P.squareRoot = P.sqrt = function () {
1722
+ var m, n, sd, r, rep, t,
1723
+ x = this,
1724
+ d = x.d,
1725
+ e = x.e,
1726
+ s = x.s,
1727
+ Ctor = x.constructor;
1728
+
1729
+ // Negative/NaN/Infinity/zero?
1730
+ if (s !== 1 || !d || !d[0]) {
1731
+ return new Ctor(!s || s < 0 && (!d || d[0]) ? NaN : d ? x : 1 / 0);
1732
+ }
1733
+
1734
+ external = false;
1735
+
1736
+ // Initial estimate.
1737
+ s = Math.sqrt(+x);
1738
+
1739
+ // Math.sqrt underflow/overflow?
1740
+ // Pass x to Math.sqrt as integer, then adjust the exponent of the result.
1741
+ if (s == 0 || s == 1 / 0) {
1742
+ n = digitsToString(d);
1743
+
1744
+ if ((n.length + e) % 2 == 0) n += '0';
1745
+ s = Math.sqrt(n);
1746
+ e = mathfloor((e + 1) / 2) - (e < 0 || e % 2);
1747
+
1748
+ if (s == 1 / 0) {
1749
+ n = '5e' + e;
1750
+ } else {
1751
+ n = s.toExponential();
1752
+ n = n.slice(0, n.indexOf('e') + 1) + e;
1753
+ }
1754
+
1755
+ r = new Ctor(n);
1756
+ } else {
1757
+ r = new Ctor(s.toString());
1758
+ }
1759
+
1760
+ sd = (e = Ctor.precision) + 3;
1761
+
1762
+ // Newton-Raphson iteration.
1763
+ for (;;) {
1764
+ t = r;
1765
+ r = t.plus(divide(x, t, sd + 2, 1)).times(0.5);
1766
+
1767
+ // TODO? Replace with for-loop and checkRoundingDigits.
1768
+ if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) {
1769
+ n = n.slice(sd - 3, sd + 1);
1770
+
1771
+ // The 4th rounding digit may be in error by -1 so if the 4 rounding digits are 9999 or
1772
+ // 4999, i.e. approaching a rounding boundary, continue the iteration.
1773
+ if (n == '9999' || !rep && n == '4999') {
1774
+
1775
+ // On the first iteration only, check to see if rounding up gives the exact result as the
1776
+ // nines may infinitely repeat.
1777
+ if (!rep) {
1778
+ finalise(t, e + 1, 0);
1779
+
1780
+ if (t.times(t).eq(x)) {
1781
+ r = t;
1782
+ break;
1783
+ }
1784
+ }
1785
+
1786
+ sd += 4;
1787
+ rep = 1;
1788
+ } else {
1789
+
1790
+ // If the rounding digits are null, 0{0,4} or 50{0,3}, check for an exact result.
1791
+ // If not, then there are further digits and m will be truthy.
1792
+ if (!+n || !+n.slice(1) && n.charAt(0) == '5') {
1793
+
1794
+ // Truncate to the first rounding digit.
1795
+ finalise(r, e + 1, 1);
1796
+ m = !r.times(r).eq(x);
1797
+ }
1798
+
1799
+ break;
1800
+ }
1801
+ }
1802
+ }
1803
+
1804
+ external = true;
1805
+
1806
+ return finalise(r, e, Ctor.rounding, m);
1807
+ };
1808
+
1809
+
1810
+ /*
1811
+ * Return a new Decimal whose value is the tangent of the value in radians of this Decimal.
1812
+ *
1813
+ * Domain: [-Infinity, Infinity]
1814
+ * Range: [-Infinity, Infinity]
1815
+ *
1816
+ * tan(0) = 0
1817
+ * tan(-0) = -0
1818
+ * tan(Infinity) = NaN
1819
+ * tan(-Infinity) = NaN
1820
+ * tan(NaN) = NaN
1821
+ *
1822
+ */
1823
+ P.tangent = P.tan = function () {
1824
+ var pr, rm,
1825
+ x = this,
1826
+ Ctor = x.constructor;
1827
+
1828
+ if (!x.isFinite()) return new Ctor(NaN);
1829
+ if (x.isZero()) return new Ctor(x);
1830
+
1831
+ pr = Ctor.precision;
1832
+ rm = Ctor.rounding;
1833
+ Ctor.precision = pr + 10;
1834
+ Ctor.rounding = 1;
1835
+
1836
+ x = x.sin();
1837
+ x.s = 1;
1838
+ x = divide(x, new Ctor(1).minus(x.times(x)).sqrt(), pr + 10, 0);
1839
+
1840
+ Ctor.precision = pr;
1841
+ Ctor.rounding = rm;
1842
+
1843
+ return finalise(quadrant == 2 || quadrant == 4 ? x.neg() : x, pr, rm, true);
1844
+ };
1845
+
1846
+
1847
+ /*
1848
+ * n * 0 = 0
1849
+ * n * N = N
1850
+ * n * I = I
1851
+ * 0 * n = 0
1852
+ * 0 * 0 = 0
1853
+ * 0 * N = N
1854
+ * 0 * I = N
1855
+ * N * n = N
1856
+ * N * 0 = N
1857
+ * N * N = N
1858
+ * N * I = N
1859
+ * I * n = I
1860
+ * I * 0 = N
1861
+ * I * N = N
1862
+ * I * I = I
1863
+ *
1864
+ * Return a new Decimal whose value is this Decimal times `y`, rounded to `precision` significant
1865
+ * digits using rounding mode `rounding`.
1866
+ *
1867
+ */
1868
+ P.times = P.mul = function (y) {
1869
+ var carry, e, i, k, r, rL, t, xdL, ydL,
1870
+ x = this,
1871
+ Ctor = x.constructor,
1872
+ xd = x.d,
1873
+ yd = (y = new Ctor(y)).d;
1874
+
1875
+ y.s *= x.s;
1876
+
1877
+ // If either is NaN, ±Infinity or ±0...
1878
+ if (!xd || !xd[0] || !yd || !yd[0]) {
1879
+
1880
+ return new Ctor(!y.s || xd && !xd[0] && !yd || yd && !yd[0] && !xd
1881
+
1882
+ // Return NaN if either is NaN.
1883
+ // Return NaN if x is ±0 and y is ±Infinity, or y is ±0 and x is ±Infinity.
1884
+ ? NaN
1885
+
1886
+ // Return ±Infinity if either is ±Infinity.
1887
+ // Return ±0 if either is ±0.
1888
+ : !xd || !yd ? y.s / 0 : y.s * 0);
1889
+ }
1890
+
1891
+ e = mathfloor(x.e / LOG_BASE) + mathfloor(y.e / LOG_BASE);
1892
+ xdL = xd.length;
1893
+ ydL = yd.length;
1894
+
1895
+ // Ensure xd points to the longer array.
1896
+ if (xdL < ydL) {
1897
+ r = xd;
1898
+ xd = yd;
1899
+ yd = r;
1900
+ rL = xdL;
1901
+ xdL = ydL;
1902
+ ydL = rL;
1903
+ }
1904
+
1905
+ // Initialise the result array with zeros.
1906
+ r = [];
1907
+ rL = xdL + ydL;
1908
+ for (i = rL; i--;) r.push(0);
1909
+
1910
+ // Multiply!
1911
+ for (i = ydL; --i >= 0;) {
1912
+ carry = 0;
1913
+ for (k = xdL + i; k > i;) {
1914
+ t = r[k] + yd[i] * xd[k - i - 1] + carry;
1915
+ r[k--] = t % BASE | 0;
1916
+ carry = t / BASE | 0;
1917
+ }
1918
+
1919
+ r[k] = (r[k] + carry) % BASE | 0;
1920
+ }
1921
+
1922
+ // Remove trailing zeros.
1923
+ for (; !r[--rL];) r.pop();
1924
+
1925
+ if (carry) ++e;
1926
+ else r.shift();
1927
+
1928
+ y.d = r;
1929
+ y.e = getBase10Exponent(r, e);
1930
+
1931
+ return external ? finalise(y, Ctor.precision, Ctor.rounding) : y;
1932
+ };
1933
+
1934
+
1935
+ /*
1936
+ * Return a string representing the value of this Decimal in base 2, round to `sd` significant
1937
+ * digits using rounding mode `rm`.
1938
+ *
1939
+ * If the optional `sd` argument is present then return binary exponential notation.
1940
+ *
1941
+ * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
1942
+ * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
1943
+ *
1944
+ */
1945
+ P.toBinary = function (sd, rm) {
1946
+ return toStringBinary(this, 2, sd, rm);
1947
+ };
1948
+
1949
+
1950
+ /*
1951
+ * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `dp`
1952
+ * decimal places using rounding mode `rm` or `rounding` if `rm` is omitted.
1953
+ *
1954
+ * If `dp` is omitted, return a new Decimal whose value is the value of this Decimal.
1955
+ *
1956
+ * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
1957
+ * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
1958
+ *
1959
+ */
1960
+ P.toDecimalPlaces = P.toDP = function (dp, rm) {
1961
+ var x = this,
1962
+ Ctor = x.constructor;
1963
+
1964
+ x = new Ctor(x);
1965
+ if (dp === void 0) return x;
1966
+
1967
+ checkInt32(dp, 0, MAX_DIGITS);
1968
+
1969
+ if (rm === void 0) rm = Ctor.rounding;
1970
+ else checkInt32(rm, 0, 8);
1971
+
1972
+ return finalise(x, dp + x.e + 1, rm);
1973
+ };
1974
+
1975
+
1976
+ /*
1977
+ * Return a string representing the value of this Decimal in exponential notation rounded to
1978
+ * `dp` fixed decimal places using rounding mode `rounding`.
1979
+ *
1980
+ * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
1981
+ * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
1982
+ *
1983
+ */
1984
+ P.toExponential = function (dp, rm) {
1985
+ var str,
1986
+ x = this,
1987
+ Ctor = x.constructor;
1988
+
1989
+ if (dp === void 0) {
1990
+ str = finiteToString(x, true);
1991
+ } else {
1992
+ checkInt32(dp, 0, MAX_DIGITS);
1993
+
1994
+ if (rm === void 0) rm = Ctor.rounding;
1995
+ else checkInt32(rm, 0, 8);
1996
+
1997
+ x = finalise(new Ctor(x), dp + 1, rm);
1998
+ str = finiteToString(x, true, dp + 1);
1999
+ }
2000
+
2001
+ return x.isNeg() && !x.isZero() ? '-' + str : str;
2002
+ };
2003
+
2004
+
2005
+ /*
2006
+ * Return a string representing the value of this Decimal in normal (fixed-point) notation to
2007
+ * `dp` fixed decimal places and rounded using rounding mode `rm` or `rounding` if `rm` is
2008
+ * omitted.
2009
+ *
2010
+ * As with JavaScript numbers, (-0).toFixed(0) is '0', but e.g. (-0.00001).toFixed(0) is '-0'.
2011
+ *
2012
+ * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
2013
+ * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
2014
+ *
2015
+ * (-0).toFixed(0) is '0', but (-0.1).toFixed(0) is '-0'.
2016
+ * (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'.
2017
+ * (-0).toFixed(3) is '0.000'.
2018
+ * (-0.5).toFixed(0) is '-0'.
2019
+ *
2020
+ */
2021
+ P.toFixed = function (dp, rm) {
2022
+ var str, y,
2023
+ x = this,
2024
+ Ctor = x.constructor;
2025
+
2026
+ if (dp === void 0) {
2027
+ str = finiteToString(x);
2028
+ } else {
2029
+ checkInt32(dp, 0, MAX_DIGITS);
2030
+
2031
+ if (rm === void 0) rm = Ctor.rounding;
2032
+ else checkInt32(rm, 0, 8);
2033
+
2034
+ y = finalise(new Ctor(x), dp + x.e + 1, rm);
2035
+ str = finiteToString(y, false, dp + y.e + 1);
2036
+ }
2037
+
2038
+ // To determine whether to add the minus sign look at the value before it was rounded,
2039
+ // i.e. look at `x` rather than `y`.
2040
+ return x.isNeg() && !x.isZero() ? '-' + str : str;
2041
+ };
2042
+
2043
+
2044
+ /*
2045
+ * Return an array representing the value of this Decimal as a simple fraction with an integer
2046
+ * numerator and an integer denominator.
2047
+ *
2048
+ * The denominator will be a positive non-zero value less than or equal to the specified maximum
2049
+ * denominator. If a maximum denominator is not specified, the denominator will be the lowest
2050
+ * value necessary to represent the number exactly.
2051
+ *
2052
+ * [maxD] {number|string|bigint|Decimal} Maximum denominator. Integer >= 1 and < Infinity.
2053
+ *
2054
+ */
2055
+ P.toFraction = function (maxD) {
2056
+ var d, d0, d1, d2, e, k, n, n0, n1, pr, q, r,
2057
+ x = this,
2058
+ xd = x.d,
2059
+ Ctor = x.constructor;
2060
+
2061
+ if (!xd) return new Ctor(x);
2062
+
2063
+ n1 = d0 = new Ctor(1);
2064
+ d1 = n0 = new Ctor(0);
2065
+
2066
+ d = new Ctor(d1);
2067
+ e = d.e = getPrecision(xd) - x.e - 1;
2068
+ k = e % LOG_BASE;
2069
+ d.d[0] = mathpow(10, k < 0 ? LOG_BASE + k : k);
2070
+
2071
+ if (maxD == null) {
2072
+
2073
+ // d is 10**e, the minimum max-denominator needed.
2074
+ maxD = e > 0 ? d : n1;
2075
+ } else {
2076
+ n = new Ctor(maxD);
2077
+ if (!n.isInt() || n.lt(n1)) throw Error(invalidArgument + n);
2078
+ maxD = n.gt(d) ? (e > 0 ? d : n1) : n;
2079
+ }
2080
+
2081
+ external = false;
2082
+ n = new Ctor(digitsToString(xd));
2083
+ pr = Ctor.precision;
2084
+ Ctor.precision = e = xd.length * LOG_BASE * 2;
2085
+
2086
+ for (;;) {
2087
+ q = divide(n, d, 0, 1, 1);
2088
+ d2 = d0.plus(q.times(d1));
2089
+ if (d2.cmp(maxD) == 1) break;
2090
+ d0 = d1;
2091
+ d1 = d2;
2092
+ d2 = n1;
2093
+ n1 = n0.plus(q.times(d2));
2094
+ n0 = d2;
2095
+ d2 = d;
2096
+ d = n.minus(q.times(d2));
2097
+ n = d2;
2098
+ }
2099
+
2100
+ d2 = divide(maxD.minus(d0), d1, 0, 1, 1);
2101
+ n0 = n0.plus(d2.times(n1));
2102
+ d0 = d0.plus(d2.times(d1));
2103
+ n0.s = n1.s = x.s;
2104
+
2105
+ // Determine which fraction is closer to x, n0/d0 or n1/d1?
2106
+ r = divide(n1, d1, e, 1).minus(x).abs().cmp(divide(n0, d0, e, 1).minus(x).abs()) < 1
2107
+ ? [n1, d1] : [n0, d0];
2108
+
2109
+ Ctor.precision = pr;
2110
+ external = true;
2111
+
2112
+ return r;
2113
+ };
2114
+
2115
+
2116
+ /*
2117
+ * Return a string representing the value of this Decimal in base 16, round to `sd` significant
2118
+ * digits using rounding mode `rm`.
2119
+ *
2120
+ * If the optional `sd` argument is present then return binary exponential notation.
2121
+ *
2122
+ * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
2123
+ * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
2124
+ *
2125
+ */
2126
+ P.toHexadecimal = P.toHex = function (sd, rm) {
2127
+ return toStringBinary(this, 16, sd, rm);
2128
+ };
2129
+
2130
+
2131
+ /*
2132
+ * Returns a new Decimal whose value is the nearest multiple of `y` in the direction of rounding
2133
+ * mode `rm`, or `Decimal.rounding` if `rm` is omitted, to the value of this Decimal.
2134
+ *
2135
+ * The return value will always have the same sign as this Decimal, unless either this Decimal
2136
+ * or `y` is NaN, in which case the return value will be also be NaN.
2137
+ *
2138
+ * The return value is not affected by the value of `precision`.
2139
+ *
2140
+ * y {number|string|bigint|Decimal} The magnitude to round to a multiple of.
2141
+ * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
2142
+ *
2143
+ * 'toNearest() rounding mode not an integer: {rm}'
2144
+ * 'toNearest() rounding mode out of range: {rm}'
2145
+ *
2146
+ */
2147
+ P.toNearest = function (y, rm) {
2148
+ var x = this,
2149
+ Ctor = x.constructor;
2150
+
2151
+ x = new Ctor(x);
2152
+
2153
+ if (y == null) {
2154
+
2155
+ // If x is not finite, return x.
2156
+ if (!x.d) return x;
2157
+
2158
+ y = new Ctor(1);
2159
+ rm = Ctor.rounding;
2160
+ } else {
2161
+ y = new Ctor(y);
2162
+ if (rm === void 0) {
2163
+ rm = Ctor.rounding;
2164
+ } else {
2165
+ checkInt32(rm, 0, 8);
2166
+ }
2167
+
2168
+ // If x is not finite, return x if y is not NaN, else NaN.
2169
+ if (!x.d) return y.s ? x : y;
2170
+
2171
+ // If y is not finite, return Infinity with the sign of x if y is Infinity, else NaN.
2172
+ if (!y.d) {
2173
+ if (y.s) y.s = x.s;
2174
+ return y;
2175
+ }
2176
+ }
2177
+
2178
+ // If y is not zero, calculate the nearest multiple of y to x.
2179
+ if (y.d[0]) {
2180
+ external = false;
2181
+ x = divide(x, y, 0, rm, 1).times(y);
2182
+ external = true;
2183
+ finalise(x);
2184
+
2185
+ // If y is zero, return zero with the sign of x.
2186
+ } else {
2187
+ y.s = x.s;
2188
+ x = y;
2189
+ }
2190
+
2191
+ return x;
2192
+ };
2193
+
2194
+
2195
+ /*
2196
+ * Return the value of this Decimal converted to a number primitive.
2197
+ * Zero keeps its sign.
2198
+ *
2199
+ */
2200
+ P.toNumber = function () {
2201
+ return +this;
2202
+ };
2203
+
2204
+
2205
+ /*
2206
+ * Return a string representing the value of this Decimal in base 8, round to `sd` significant
2207
+ * digits using rounding mode `rm`.
2208
+ *
2209
+ * If the optional `sd` argument is present then return binary exponential notation.
2210
+ *
2211
+ * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
2212
+ * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
2213
+ *
2214
+ */
2215
+ P.toOctal = function (sd, rm) {
2216
+ return toStringBinary(this, 8, sd, rm);
2217
+ };
2218
+
2219
+
2220
+ /*
2221
+ * Return a new Decimal whose value is the value of this Decimal raised to the power `y`, rounded
2222
+ * to `precision` significant digits using rounding mode `rounding`.
2223
+ *
2224
+ * ECMAScript compliant.
2225
+ *
2226
+ * pow(x, NaN) = NaN
2227
+ * pow(x, ±0) = 1
2228
+
2229
+ * pow(NaN, non-zero) = NaN
2230
+ * pow(abs(x) > 1, +Infinity) = +Infinity
2231
+ * pow(abs(x) > 1, -Infinity) = +0
2232
+ * pow(abs(x) == 1, ±Infinity) = NaN
2233
+ * pow(abs(x) < 1, +Infinity) = +0
2234
+ * pow(abs(x) < 1, -Infinity) = +Infinity
2235
+ * pow(+Infinity, y > 0) = +Infinity
2236
+ * pow(+Infinity, y < 0) = +0
2237
+ * pow(-Infinity, odd integer > 0) = -Infinity
2238
+ * pow(-Infinity, even integer > 0) = +Infinity
2239
+ * pow(-Infinity, odd integer < 0) = -0
2240
+ * pow(-Infinity, even integer < 0) = +0
2241
+ * pow(+0, y > 0) = +0
2242
+ * pow(+0, y < 0) = +Infinity
2243
+ * pow(-0, odd integer > 0) = -0
2244
+ * pow(-0, even integer > 0) = +0
2245
+ * pow(-0, odd integer < 0) = -Infinity
2246
+ * pow(-0, even integer < 0) = +Infinity
2247
+ * pow(finite x < 0, finite non-integer) = NaN
2248
+ *
2249
+ * For non-integer or very large exponents pow(x, y) is calculated using
2250
+ *
2251
+ * x^y = exp(y*ln(x))
2252
+ *
2253
+ * Assuming the first 15 rounding digits are each equally likely to be any digit 0-9, the
2254
+ * probability of an incorrectly rounded result
2255
+ * P([49]9{14} | [50]0{14}) = 2 * 0.2 * 10^-14 = 4e-15 = 1/2.5e+14
2256
+ * i.e. 1 in 250,000,000,000,000
2257
+ *
2258
+ * If a result is incorrectly rounded the maximum error will be 1 ulp (unit in last place).
2259
+ *
2260
+ * y {number|string|bigint|Decimal} The power to which to raise this Decimal.
2261
+ *
2262
+ */
2263
+ P.toPower = P.pow = function (y) {
2264
+ var e, k, pr, r, rm, s,
2265
+ x = this,
2266
+ Ctor = x.constructor,
2267
+ yn = +(y = new Ctor(y));
2268
+
2269
+ // Either ±Infinity, NaN or ±0?
2270
+ if (!x.d || !y.d || !x.d[0] || !y.d[0]) return new Ctor(mathpow(+x, yn));
2271
+
2272
+ x = new Ctor(x);
2273
+
2274
+ if (x.eq(1)) return x;
2275
+
2276
+ pr = Ctor.precision;
2277
+ rm = Ctor.rounding;
2278
+
2279
+ if (y.eq(1)) return finalise(x, pr, rm);
2280
+
2281
+ // y exponent
2282
+ e = mathfloor(y.e / LOG_BASE);
2283
+
2284
+ // If y is a small integer use the 'exponentiation by squaring' algorithm.
2285
+ if (e >= y.d.length - 1 && (k = yn < 0 ? -yn : yn) <= MAX_SAFE_INTEGER) {
2286
+ r = intPow(Ctor, x, k, pr);
2287
+ return y.s < 0 ? new Ctor(1).div(r) : finalise(r, pr, rm);
2288
+ }
2289
+
2290
+ s = x.s;
2291
+
2292
+ // if x is negative
2293
+ if (s < 0) {
2294
+
2295
+ // if y is not an integer
2296
+ if (e < y.d.length - 1) return new Ctor(NaN);
2297
+
2298
+ // Result is positive if x is negative and the last digit of integer y is even.
2299
+ if ((y.d[e] & 1) == 0) s = 1;
2300
+
2301
+ // if x.eq(-1)
2302
+ if (x.e == 0 && x.d[0] == 1 && x.d.length == 1) {
2303
+ x.s = s;
2304
+ return x;
2305
+ }
2306
+ }
2307
+
2308
+ // Estimate result exponent.
2309
+ // x^y = 10^e, where e = y * log10(x)
2310
+ // log10(x) = log10(x_significand) + x_exponent
2311
+ // log10(x_significand) = ln(x_significand) / ln(10)
2312
+ k = mathpow(+x, yn);
2313
+ e = k == 0 || !isFinite(k)
2314
+ ? mathfloor(yn * (Math.log('0.' + digitsToString(x.d)) / Math.LN10 + x.e + 1))
2315
+ : new Ctor(k + '').e;
2316
+
2317
+ // Exponent estimate may be incorrect e.g. x: 0.999999999999999999, y: 2.29, e: 0, r.e: -1.
2318
+
2319
+ // Overflow/underflow?
2320
+ if (e > Ctor.maxE + 1 || e < Ctor.minE - 1) return new Ctor(e > 0 ? s / 0 : 0);
2321
+
2322
+ external = false;
2323
+ Ctor.rounding = x.s = 1;
2324
+
2325
+ // Estimate the extra guard digits needed to ensure five correct rounding digits from
2326
+ // naturalLogarithm(x). Example of failure without these extra digits (precision: 10):
2327
+ // new Decimal(2.32456).pow('2087987436534566.46411')
2328
+ // should be 1.162377823e+764914905173815, but is 1.162355823e+764914905173815
2329
+ k = Math.min(12, (e + '').length);
2330
+
2331
+ // r = x^y = exp(y*ln(x))
2332
+ r = naturalExponential(y.times(naturalLogarithm(x, pr + k)), pr);
2333
+
2334
+ // r may be Infinity, e.g. (0.9999999999999999).pow(-1e+40)
2335
+ if (r.d) {
2336
+
2337
+ // Truncate to the required precision plus five rounding digits.
2338
+ r = finalise(r, pr + 5, 1);
2339
+
2340
+ // If the rounding digits are [49]9999 or [50]0000 increase the precision by 10 and recalculate
2341
+ // the result.
2342
+ if (checkRoundingDigits(r.d, pr, rm)) {
2343
+ e = pr + 10;
2344
+
2345
+ // Truncate to the increased precision plus five rounding digits.
2346
+ r = finalise(naturalExponential(y.times(naturalLogarithm(x, e + k)), e), e + 5, 1);
2347
+
2348
+ // Check for 14 nines from the 2nd rounding digit (the first rounding digit may be 4 or 9).
2349
+ if (+digitsToString(r.d).slice(pr + 1, pr + 15) + 1 == 1e14) {
2350
+ r = finalise(r, pr + 1, 0);
2351
+ }
2352
+ }
2353
+ }
2354
+
2355
+ r.s = s;
2356
+ external = true;
2357
+ Ctor.rounding = rm;
2358
+
2359
+ return finalise(r, pr, rm);
2360
+ };
2361
+
2362
+
2363
+ /*
2364
+ * Return a string representing the value of this Decimal rounded to `sd` significant digits
2365
+ * using rounding mode `rounding`.
2366
+ *
2367
+ * Return exponential notation if `sd` is less than the number of digits necessary to represent
2368
+ * the integer part of the value in normal notation.
2369
+ *
2370
+ * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
2371
+ * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
2372
+ *
2373
+ */
2374
+ P.toPrecision = function (sd, rm) {
2375
+ var str,
2376
+ x = this,
2377
+ Ctor = x.constructor;
2378
+
2379
+ if (sd === void 0) {
2380
+ str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);
2381
+ } else {
2382
+ checkInt32(sd, 1, MAX_DIGITS);
2383
+
2384
+ if (rm === void 0) rm = Ctor.rounding;
2385
+ else checkInt32(rm, 0, 8);
2386
+
2387
+ x = finalise(new Ctor(x), sd, rm);
2388
+ str = finiteToString(x, sd <= x.e || x.e <= Ctor.toExpNeg, sd);
2389
+ }
2390
+
2391
+ return x.isNeg() && !x.isZero() ? '-' + str : str;
2392
+ };
2393
+
2394
+
2395
+ /*
2396
+ * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `sd`
2397
+ * significant digits using rounding mode `rm`, or to `precision` and `rounding` respectively if
2398
+ * omitted.
2399
+ *
2400
+ * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
2401
+ * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
2402
+ *
2403
+ * 'toSD() digits out of range: {sd}'
2404
+ * 'toSD() digits not an integer: {sd}'
2405
+ * 'toSD() rounding mode not an integer: {rm}'
2406
+ * 'toSD() rounding mode out of range: {rm}'
2407
+ *
2408
+ */
2409
+ P.toSignificantDigits = P.toSD = function (sd, rm) {
2410
+ var x = this,
2411
+ Ctor = x.constructor;
2412
+
2413
+ if (sd === void 0) {
2414
+ sd = Ctor.precision;
2415
+ rm = Ctor.rounding;
2416
+ } else {
2417
+ checkInt32(sd, 1, MAX_DIGITS);
2418
+
2419
+ if (rm === void 0) rm = Ctor.rounding;
2420
+ else checkInt32(rm, 0, 8);
2421
+ }
2422
+
2423
+ return finalise(new Ctor(x), sd, rm);
2424
+ };
2425
+
2426
+
2427
+ /*
2428
+ * Return a string representing the value of this Decimal.
2429
+ *
2430
+ * Return exponential notation if this Decimal has a positive exponent equal to or greater than
2431
+ * `toExpPos`, or a negative exponent equal to or less than `toExpNeg`.
2432
+ *
2433
+ */
2434
+ P.toString = function () {
2435
+ var x = this,
2436
+ Ctor = x.constructor,
2437
+ str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);
2438
+
2439
+ return x.isNeg() && !x.isZero() ? '-' + str : str;
2440
+ };
2441
+
2442
+
2443
+ /*
2444
+ * Return a new Decimal whose value is the value of this Decimal truncated to a whole number.
2445
+ *
2446
+ */
2447
+ P.truncated = P.trunc = function () {
2448
+ return finalise(new this.constructor(this), this.e + 1, 1);
2449
+ };
2450
+
2451
+
2452
+ /*
2453
+ * Return a string representing the value of this Decimal.
2454
+ * Unlike `toString`, negative zero will include the minus sign.
2455
+ *
2456
+ */
2457
+ P.valueOf = P.toJSON = function () {
2458
+ var x = this,
2459
+ Ctor = x.constructor,
2460
+ str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);
2461
+
2462
+ return x.isNeg() ? '-' + str : str;
2463
+ };
2464
+
2465
+
2466
+ // Helper functions for Decimal.prototype (P) and/or Decimal methods, and their callers.
2467
+
2468
+
2469
+ /*
2470
+ * digitsToString P.cubeRoot, P.logarithm, P.squareRoot, P.toFraction, P.toPower,
2471
+ * finiteToString, naturalExponential, naturalLogarithm
2472
+ * checkInt32 P.toDecimalPlaces, P.toExponential, P.toFixed, P.toNearest,
2473
+ * P.toPrecision, P.toSignificantDigits, toStringBinary, random
2474
+ * checkRoundingDigits P.logarithm, P.toPower, naturalExponential, naturalLogarithm
2475
+ * convertBase toStringBinary, parseOther
2476
+ * cos P.cos
2477
+ * divide P.atanh, P.cubeRoot, P.dividedBy, P.dividedToIntegerBy,
2478
+ * P.logarithm, P.modulo, P.squareRoot, P.tan, P.tanh, P.toFraction,
2479
+ * P.toNearest, toStringBinary, naturalExponential, naturalLogarithm,
2480
+ * taylorSeries, atan2, parseOther
2481
+ * finalise P.absoluteValue, P.atan, P.atanh, P.ceil, P.cos, P.cosh,
2482
+ * P.cubeRoot, P.dividedToIntegerBy, P.floor, P.logarithm, P.minus,
2483
+ * P.modulo, P.negated, P.plus, P.round, P.sin, P.sinh, P.squareRoot,
2484
+ * P.tan, P.times, P.toDecimalPlaces, P.toExponential, P.toFixed,
2485
+ * P.toNearest, P.toPower, P.toPrecision, P.toSignificantDigits,
2486
+ * P.truncated, divide, getLn10, getPi, naturalExponential,
2487
+ * naturalLogarithm, ceil, floor, round, trunc
2488
+ * finiteToString P.toExponential, P.toFixed, P.toPrecision, P.toString, P.valueOf,
2489
+ * toStringBinary
2490
+ * getBase10Exponent P.minus, P.plus, P.times, parseOther
2491
+ * getLn10 P.logarithm, naturalLogarithm
2492
+ * getPi P.acos, P.asin, P.atan, toLessThanHalfPi, atan2
2493
+ * getPrecision P.precision, P.toFraction
2494
+ * getZeroString digitsToString, finiteToString
2495
+ * intPow P.toPower, parseOther
2496
+ * isOdd toLessThanHalfPi
2497
+ * maxOrMin max, min
2498
+ * naturalExponential P.naturalExponential, P.toPower
2499
+ * naturalLogarithm P.acosh, P.asinh, P.atanh, P.logarithm, P.naturalLogarithm,
2500
+ * P.toPower, naturalExponential
2501
+ * nonFiniteToString finiteToString, toStringBinary
2502
+ * parseDecimal Decimal
2503
+ * parseOther Decimal
2504
+ * sin P.sin
2505
+ * taylorSeries P.cosh, P.sinh, cos, sin
2506
+ * toLessThanHalfPi P.cos, P.sin
2507
+ * toStringBinary P.toBinary, P.toHexadecimal, P.toOctal
2508
+ * truncate intPow
2509
+ *
2510
+ * Throws: P.logarithm, P.precision, P.toFraction, checkInt32, getLn10, getPi,
2511
+ * naturalLogarithm, config, parseOther, random, Decimal
2512
+ */
2513
+
2514
+
2515
+ function digitsToString(d) {
2516
+ var i, k, ws,
2517
+ indexOfLastWord = d.length - 1,
2518
+ str = '',
2519
+ w = d[0];
2520
+
2521
+ if (indexOfLastWord > 0) {
2522
+ str += w;
2523
+ for (i = 1; i < indexOfLastWord; i++) {
2524
+ ws = d[i] + '';
2525
+ k = LOG_BASE - ws.length;
2526
+ if (k) str += getZeroString(k);
2527
+ str += ws;
2528
+ }
2529
+
2530
+ w = d[i];
2531
+ ws = w + '';
2532
+ k = LOG_BASE - ws.length;
2533
+ if (k) str += getZeroString(k);
2534
+ } else if (w === 0) {
2535
+ return '0';
2536
+ }
2537
+
2538
+ // Remove trailing zeros of last w.
2539
+ for (; w % 10 === 0;) w /= 10;
2540
+
2541
+ return str + w;
2542
+ }
2543
+
2544
+
2545
+ function checkInt32(i, min, max) {
2546
+ if (i !== ~~i || i < min || i > max) {
2547
+ throw Error(invalidArgument + i);
2548
+ }
2549
+ }
2550
+
2551
+
2552
+ /*
2553
+ * Check 5 rounding digits if `repeating` is null, 4 otherwise.
2554
+ * `repeating == null` if caller is `log` or `pow`,
2555
+ * `repeating != null` if caller is `naturalLogarithm` or `naturalExponential`.
2556
+ */
2557
+ function checkRoundingDigits(d, i, rm, repeating) {
2558
+ var di, k, r, rd;
2559
+
2560
+ // Get the length of the first word of the array d.
2561
+ for (k = d[0]; k >= 10; k /= 10) --i;
2562
+
2563
+ // Is the rounding digit in the first word of d?
2564
+ if (--i < 0) {
2565
+ i += LOG_BASE;
2566
+ di = 0;
2567
+ } else {
2568
+ di = Math.ceil((i + 1) / LOG_BASE);
2569
+ i %= LOG_BASE;
2570
+ }
2571
+
2572
+ // i is the index (0 - 6) of the rounding digit.
2573
+ // E.g. if within the word 3487563 the first rounding digit is 5,
2574
+ // then i = 4, k = 1000, rd = 3487563 % 1000 = 563
2575
+ k = mathpow(10, LOG_BASE - i);
2576
+ rd = d[di] % k | 0;
2577
+
2578
+ if (repeating == null) {
2579
+ if (i < 3) {
2580
+ if (i == 0) rd = rd / 100 | 0;
2581
+ else if (i == 1) rd = rd / 10 | 0;
2582
+ r = rm < 4 && rd == 99999 || rm > 3 && rd == 49999 || rd == 50000 || rd == 0;
2583
+ } else {
2584
+ r = (rm < 4 && rd + 1 == k || rm > 3 && rd + 1 == k / 2) &&
2585
+ (d[di + 1] / k / 100 | 0) == mathpow(10, i - 2) - 1 ||
2586
+ (rd == k / 2 || rd == 0) && (d[di + 1] / k / 100 | 0) == 0;
2587
+ }
2588
+ } else {
2589
+ if (i < 4) {
2590
+ if (i == 0) rd = rd / 1000 | 0;
2591
+ else if (i == 1) rd = rd / 100 | 0;
2592
+ else if (i == 2) rd = rd / 10 | 0;
2593
+ r = (repeating || rm < 4) && rd == 9999 || !repeating && rm > 3 && rd == 4999;
2594
+ } else {
2595
+ r = ((repeating || rm < 4) && rd + 1 == k ||
2596
+ (!repeating && rm > 3) && rd + 1 == k / 2) &&
2597
+ (d[di + 1] / k / 1000 | 0) == mathpow(10, i - 3) - 1;
2598
+ }
2599
+ }
2600
+
2601
+ return r;
2602
+ }
2603
+
2604
+
2605
+ // Convert string of `baseIn` to an array of numbers of `baseOut`.
2606
+ // Eg. convertBase('255', 10, 16) returns [15, 15].
2607
+ // Eg. convertBase('ff', 16, 10) returns [2, 5, 5].
2608
+ function convertBase(str, baseIn, baseOut) {
2609
+ var j,
2610
+ arr = [0],
2611
+ arrL,
2612
+ i = 0,
2613
+ strL = str.length;
2614
+
2615
+ for (; i < strL;) {
2616
+ for (arrL = arr.length; arrL--;) arr[arrL] *= baseIn;
2617
+ arr[0] += NUMERALS.indexOf(str.charAt(i++));
2618
+ for (j = 0; j < arr.length; j++) {
2619
+ if (arr[j] > baseOut - 1) {
2620
+ if (arr[j + 1] === void 0) arr[j + 1] = 0;
2621
+ arr[j + 1] += arr[j] / baseOut | 0;
2622
+ arr[j] %= baseOut;
2623
+ }
2624
+ }
2625
+ }
2626
+
2627
+ return arr.reverse();
2628
+ }
2629
+
2630
+
2631
+ /*
2632
+ * cos(x) = 1 - x^2/2! + x^4/4! - ...
2633
+ * |x| < pi/2
2634
+ *
2635
+ */
2636
+ function cosine(Ctor, x) {
2637
+ var k, len, y;
2638
+
2639
+ if (x.isZero()) return x;
2640
+
2641
+ // Argument reduction: cos(4x) = 8*(cos^4(x) - cos^2(x)) + 1
2642
+ // i.e. cos(x) = 8*(cos^4(x/4) - cos^2(x/4)) + 1
2643
+
2644
+ // Estimate the optimum number of times to use the argument reduction.
2645
+ len = x.d.length;
2646
+ if (len < 32) {
2647
+ k = Math.ceil(len / 3);
2648
+ y = (1 / tinyPow(4, k)).toString();
2649
+ } else {
2650
+ k = 16;
2651
+ y = '2.3283064365386962890625e-10';
2652
+ }
2653
+
2654
+ Ctor.precision += k;
2655
+
2656
+ x = taylorSeries(Ctor, 1, x.times(y), new Ctor(1));
2657
+
2658
+ // Reverse argument reduction
2659
+ for (var i = k; i--;) {
2660
+ var cos2x = x.times(x);
2661
+ x = cos2x.times(cos2x).minus(cos2x).times(8).plus(1);
2662
+ }
2663
+
2664
+ Ctor.precision -= k;
2665
+
2666
+ return x;
2667
+ }
2668
+
2669
+
2670
+ /*
2671
+ * Perform division in the specified base.
2672
+ */
2673
+ var divide = (function () {
2674
+
2675
+ // Assumes non-zero x and k, and hence non-zero result.
2676
+ function multiplyInteger(x, k, base) {
2677
+ var temp,
2678
+ carry = 0,
2679
+ i = x.length;
2680
+
2681
+ for (x = x.slice(); i--;) {
2682
+ temp = x[i] * k + carry;
2683
+ x[i] = temp % base | 0;
2684
+ carry = temp / base | 0;
2685
+ }
2686
+
2687
+ if (carry) x.unshift(carry);
2688
+
2689
+ return x;
2690
+ }
2691
+
2692
+ function compare(a, b, aL, bL) {
2693
+ var i, r;
2694
+
2695
+ if (aL != bL) {
2696
+ r = aL > bL ? 1 : -1;
2697
+ } else {
2698
+ for (i = r = 0; i < aL; i++) {
2699
+ if (a[i] != b[i]) {
2700
+ r = a[i] > b[i] ? 1 : -1;
2701
+ break;
2702
+ }
2703
+ }
2704
+ }
2705
+
2706
+ return r;
2707
+ }
2708
+
2709
+ function subtract(a, b, aL, base) {
2710
+ var i = 0;
2711
+
2712
+ // Subtract b from a.
2713
+ for (; aL--;) {
2714
+ a[aL] -= i;
2715
+ i = a[aL] < b[aL] ? 1 : 0;
2716
+ a[aL] = i * base + a[aL] - b[aL];
2717
+ }
2718
+
2719
+ // Remove leading zeros.
2720
+ for (; !a[0] && a.length > 1;) a.shift();
2721
+ }
2722
+
2723
+ return function (x, y, pr, rm, dp, base) {
2724
+ var cmp, e, i, k, logBase, more, prod, prodL, q, qd, rem, remL, rem0, sd, t, xi, xL, yd0,
2725
+ yL, yz,
2726
+ Ctor = x.constructor,
2727
+ sign = x.s == y.s ? 1 : -1,
2728
+ xd = x.d,
2729
+ yd = y.d;
2730
+
2731
+ // Either NaN, Infinity or 0?
2732
+ if (!xd || !xd[0] || !yd || !yd[0]) {
2733
+
2734
+ return new Ctor(// Return NaN if either NaN, or both Infinity or 0.
2735
+ !x.s || !y.s || (xd ? yd && xd[0] == yd[0] : !yd) ? NaN :
2736
+
2737
+ // Return ±0 if x is 0 or y is ±Infinity, or return ±Infinity as y is 0.
2738
+ xd && xd[0] == 0 || !yd ? sign * 0 : sign / 0);
2739
+ }
2740
+
2741
+ if (base) {
2742
+ logBase = 1;
2743
+ e = x.e - y.e;
2744
+ } else {
2745
+ base = BASE;
2746
+ logBase = LOG_BASE;
2747
+ e = mathfloor(x.e / logBase) - mathfloor(y.e / logBase);
2748
+ }
2749
+
2750
+ yL = yd.length;
2751
+ xL = xd.length;
2752
+ q = new Ctor(sign);
2753
+ qd = q.d = [];
2754
+
2755
+ // Result exponent may be one less than e.
2756
+ // The digit array of a Decimal from toStringBinary may have trailing zeros.
2757
+ for (i = 0; yd[i] == (xd[i] || 0); i++);
2758
+
2759
+ if (yd[i] > (xd[i] || 0)) e--;
2760
+
2761
+ if (pr == null) {
2762
+ sd = pr = Ctor.precision;
2763
+ rm = Ctor.rounding;
2764
+ } else if (dp) {
2765
+ sd = pr + (x.e - y.e) + 1;
2766
+ } else {
2767
+ sd = pr;
2768
+ }
2769
+
2770
+ if (sd < 0) {
2771
+ qd.push(1);
2772
+ more = true;
2773
+ } else {
2774
+
2775
+ // Convert precision in number of base 10 digits to base 1e7 digits.
2776
+ sd = sd / logBase + 2 | 0;
2777
+ i = 0;
2778
+
2779
+ // divisor < 1e7
2780
+ if (yL == 1) {
2781
+ k = 0;
2782
+ yd = yd[0];
2783
+ sd++;
2784
+
2785
+ // k is the carry.
2786
+ for (; (i < xL || k) && sd--; i++) {
2787
+ t = k * base + (xd[i] || 0);
2788
+ qd[i] = t / yd | 0;
2789
+ k = t % yd | 0;
2790
+ }
2791
+
2792
+ more = k || i < xL;
2793
+
2794
+ // divisor >= 1e7
2795
+ } else {
2796
+
2797
+ // Normalise xd and yd so highest order digit of yd is >= base/2
2798
+ k = base / (yd[0] + 1) | 0;
2799
+
2800
+ if (k > 1) {
2801
+ yd = multiplyInteger(yd, k, base);
2802
+ xd = multiplyInteger(xd, k, base);
2803
+ yL = yd.length;
2804
+ xL = xd.length;
2805
+ }
2806
+
2807
+ xi = yL;
2808
+ rem = xd.slice(0, yL);
2809
+ remL = rem.length;
2810
+
2811
+ // Add zeros to make remainder as long as divisor.
2812
+ for (; remL < yL;) rem[remL++] = 0;
2813
+
2814
+ yz = yd.slice();
2815
+ yz.unshift(0);
2816
+ yd0 = yd[0];
2817
+
2818
+ if (yd[1] >= base / 2) ++yd0;
2819
+
2820
+ do {
2821
+ k = 0;
2822
+
2823
+ // Compare divisor and remainder.
2824
+ cmp = compare(yd, rem, yL, remL);
2825
+
2826
+ // If divisor < remainder.
2827
+ if (cmp < 0) {
2828
+
2829
+ // Calculate trial digit, k.
2830
+ rem0 = rem[0];
2831
+ if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);
2832
+
2833
+ // k will be how many times the divisor goes into the current remainder.
2834
+ k = rem0 / yd0 | 0;
2835
+
2836
+ // Algorithm:
2837
+ // 1. product = divisor * trial digit (k)
2838
+ // 2. if product > remainder: product -= divisor, k--
2839
+ // 3. remainder -= product
2840
+ // 4. if product was < remainder at 2:
2841
+ // 5. compare new remainder and divisor
2842
+ // 6. If remainder > divisor: remainder -= divisor, k++
2843
+
2844
+ if (k > 1) {
2845
+ if (k >= base) k = base - 1;
2846
+
2847
+ // product = divisor * trial digit.
2848
+ prod = multiplyInteger(yd, k, base);
2849
+ prodL = prod.length;
2850
+ remL = rem.length;
2851
+
2852
+ // Compare product and remainder.
2853
+ cmp = compare(prod, rem, prodL, remL);
2854
+
2855
+ // product > remainder.
2856
+ if (cmp == 1) {
2857
+ k--;
2858
+
2859
+ // Subtract divisor from product.
2860
+ subtract(prod, yL < prodL ? yz : yd, prodL, base);
2861
+ }
2862
+ } else {
2863
+
2864
+ // cmp is -1.
2865
+ // If k is 0, there is no need to compare yd and rem again below, so change cmp to 1
2866
+ // to avoid it. If k is 1 there is a need to compare yd and rem again below.
2867
+ if (k == 0) cmp = k = 1;
2868
+ prod = yd.slice();
2869
+ }
2870
+
2871
+ prodL = prod.length;
2872
+ if (prodL < remL) prod.unshift(0);
2873
+
2874
+ // Subtract product from remainder.
2875
+ subtract(rem, prod, remL, base);
2876
+
2877
+ // If product was < previous remainder.
2878
+ if (cmp == -1) {
2879
+ remL = rem.length;
2880
+
2881
+ // Compare divisor and new remainder.
2882
+ cmp = compare(yd, rem, yL, remL);
2883
+
2884
+ // If divisor < new remainder, subtract divisor from remainder.
2885
+ if (cmp < 1) {
2886
+ k++;
2887
+
2888
+ // Subtract divisor from remainder.
2889
+ subtract(rem, yL < remL ? yz : yd, remL, base);
2890
+ }
2891
+ }
2892
+
2893
+ remL = rem.length;
2894
+ } else if (cmp === 0) {
2895
+ k++;
2896
+ rem = [0];
2897
+ } // if cmp === 1, k will be 0
2898
+
2899
+ // Add the next digit, k, to the result array.
2900
+ qd[i++] = k;
2901
+
2902
+ // Update the remainder.
2903
+ if (cmp && rem[0]) {
2904
+ rem[remL++] = xd[xi] || 0;
2905
+ } else {
2906
+ rem = [xd[xi]];
2907
+ remL = 1;
2908
+ }
2909
+
2910
+ } while ((xi++ < xL || rem[0] !== void 0) && sd--);
2911
+
2912
+ more = rem[0] !== void 0;
2913
+ }
2914
+
2915
+ // Leading zero?
2916
+ if (!qd[0]) qd.shift();
2917
+ }
2918
+
2919
+ // logBase is 1 when divide is being used for base conversion.
2920
+ if (logBase == 1) {
2921
+ q.e = e;
2922
+ inexact = more;
2923
+ } else {
2924
+
2925
+ // To calculate q.e, first get the number of digits of qd[0].
2926
+ for (i = 1, k = qd[0]; k >= 10; k /= 10) i++;
2927
+ q.e = i + e * logBase - 1;
2928
+
2929
+ finalise(q, dp ? pr + q.e + 1 : pr, rm, more);
2930
+ }
2931
+
2932
+ return q;
2933
+ };
2934
+ })();
2935
+
2936
+
2937
+ /*
2938
+ * Round `x` to `sd` significant digits using rounding mode `rm`.
2939
+ * Check for over/under-flow.
2940
+ */
2941
+ function finalise(x, sd, rm, isTruncated) {
2942
+ var digits, i, j, k, rd, roundUp, w, xd, xdi,
2943
+ Ctor = x.constructor;
2944
+
2945
+ // Don't round if sd is null or undefined.
2946
+ out: if (sd != null) {
2947
+ xd = x.d;
2948
+
2949
+ // Infinity/NaN.
2950
+ if (!xd) return x;
2951
+
2952
+ // rd: the rounding digit, i.e. the digit after the digit that may be rounded up.
2953
+ // w: the word of xd containing rd, a base 1e7 number.
2954
+ // xdi: the index of w within xd.
2955
+ // digits: the number of digits of w.
2956
+ // i: what would be the index of rd within w if all the numbers were 7 digits long (i.e. if
2957
+ // they had leading zeros)
2958
+ // j: if > 0, the actual index of rd within w (if < 0, rd is a leading zero).
2959
+
2960
+ // Get the length of the first word of the digits array xd.
2961
+ for (digits = 1, k = xd[0]; k >= 10; k /= 10) digits++;
2962
+ i = sd - digits;
2963
+
2964
+ // Is the rounding digit in the first word of xd?
2965
+ if (i < 0) {
2966
+ i += LOG_BASE;
2967
+ j = sd;
2968
+ w = xd[xdi = 0];
2969
+
2970
+ // Get the rounding digit at index j of w.
2971
+ rd = w / mathpow(10, digits - j - 1) % 10 | 0;
2972
+ } else {
2973
+ xdi = Math.ceil((i + 1) / LOG_BASE);
2974
+ k = xd.length;
2975
+ if (xdi >= k) {
2976
+ if (isTruncated) {
2977
+
2978
+ // Needed by `naturalExponential`, `naturalLogarithm` and `squareRoot`.
2979
+ for (; k++ <= xdi;) xd.push(0);
2980
+ w = rd = 0;
2981
+ digits = 1;
2982
+ i %= LOG_BASE;
2983
+ j = i - LOG_BASE + 1;
2984
+ } else {
2985
+ break out;
2986
+ }
2987
+ } else {
2988
+ w = k = xd[xdi];
2989
+
2990
+ // Get the number of digits of w.
2991
+ for (digits = 1; k >= 10; k /= 10) digits++;
2992
+
2993
+ // Get the index of rd within w.
2994
+ i %= LOG_BASE;
2995
+
2996
+ // Get the index of rd within w, adjusted for leading zeros.
2997
+ // The number of leading zeros of w is given by LOG_BASE - digits.
2998
+ j = i - LOG_BASE + digits;
2999
+
3000
+ // Get the rounding digit at index j of w.
3001
+ rd = j < 0 ? 0 : w / mathpow(10, digits - j - 1) % 10 | 0;
3002
+ }
3003
+ }
3004
+
3005
+ // Are there any non-zero digits after the rounding digit?
3006
+ isTruncated = isTruncated || sd < 0 ||
3007
+ xd[xdi + 1] !== void 0 || (j < 0 ? w : w % mathpow(10, digits - j - 1));
3008
+
3009
+ // The expression `w % mathpow(10, digits - j - 1)` returns all the digits of w to the right
3010
+ // of the digit at (left-to-right) index j, e.g. if w is 908714 and j is 2, the expression
3011
+ // will give 714.
3012
+
3013
+ roundUp = rm < 4
3014
+ ? (rd || isTruncated) && (rm == 0 || rm == (x.s < 0 ? 3 : 2))
3015
+ : rd > 5 || rd == 5 && (rm == 4 || isTruncated || rm == 6 &&
3016
+
3017
+ // Check whether the digit to the left of the rounding digit is odd.
3018
+ ((i > 0 ? j > 0 ? w / mathpow(10, digits - j) : 0 : xd[xdi - 1]) % 10) & 1 ||
3019
+ rm == (x.s < 0 ? 8 : 7));
3020
+
3021
+ if (sd < 1 || !xd[0]) {
3022
+ xd.length = 0;
3023
+ if (roundUp) {
3024
+
3025
+ // Convert sd to decimal places.
3026
+ sd -= x.e + 1;
3027
+
3028
+ // 1, 0.1, 0.01, 0.001, 0.0001 etc.
3029
+ xd[0] = mathpow(10, (LOG_BASE - sd % LOG_BASE) % LOG_BASE);
3030
+ x.e = -sd || 0;
3031
+ } else {
3032
+
3033
+ // Zero.
3034
+ xd[0] = x.e = 0;
3035
+ }
3036
+
3037
+ return x;
3038
+ }
3039
+
3040
+ // Remove excess digits.
3041
+ if (i == 0) {
3042
+ xd.length = xdi;
3043
+ k = 1;
3044
+ xdi--;
3045
+ } else {
3046
+ xd.length = xdi + 1;
3047
+ k = mathpow(10, LOG_BASE - i);
3048
+
3049
+ // E.g. 56700 becomes 56000 if 7 is the rounding digit.
3050
+ // j > 0 means i > number of leading zeros of w.
3051
+ xd[xdi] = j > 0 ? (w / mathpow(10, digits - j) % mathpow(10, j) | 0) * k : 0;
3052
+ }
3053
+
3054
+ if (roundUp) {
3055
+ for (;;) {
3056
+
3057
+ // Is the digit to be rounded up in the first word of xd?
3058
+ if (xdi == 0) {
3059
+
3060
+ // i will be the length of xd[0] before k is added.
3061
+ for (i = 1, j = xd[0]; j >= 10; j /= 10) i++;
3062
+ j = xd[0] += k;
3063
+ for (k = 1; j >= 10; j /= 10) k++;
3064
+
3065
+ // if i != k the length has increased.
3066
+ if (i != k) {
3067
+ x.e++;
3068
+ if (xd[0] == BASE) xd[0] = 1;
3069
+ }
3070
+
3071
+ break;
3072
+ } else {
3073
+ xd[xdi] += k;
3074
+ if (xd[xdi] != BASE) break;
3075
+ xd[xdi--] = 0;
3076
+ k = 1;
3077
+ }
3078
+ }
3079
+ }
3080
+
3081
+ // Remove trailing zeros.
3082
+ for (i = xd.length; xd[--i] === 0;) xd.pop();
3083
+ }
3084
+
3085
+ if (external) {
3086
+
3087
+ // Overflow?
3088
+ if (x.e > Ctor.maxE) {
3089
+
3090
+ // Infinity.
3091
+ x.d = null;
3092
+ x.e = NaN;
3093
+
3094
+ // Underflow?
3095
+ } else if (x.e < Ctor.minE) {
3096
+
3097
+ // Zero.
3098
+ x.e = 0;
3099
+ x.d = [0];
3100
+ // Ctor.underflow = true;
3101
+ } // else Ctor.underflow = false;
3102
+ }
3103
+
3104
+ return x;
3105
+ }
3106
+
3107
+
3108
+ function finiteToString(x, isExp, sd) {
3109
+ if (!x.isFinite()) return nonFiniteToString(x);
3110
+ var k,
3111
+ e = x.e,
3112
+ str = digitsToString(x.d),
3113
+ len = str.length;
3114
+
3115
+ if (isExp) {
3116
+ if (sd && (k = sd - len) > 0) {
3117
+ str = str.charAt(0) + '.' + str.slice(1) + getZeroString(k);
3118
+ } else if (len > 1) {
3119
+ str = str.charAt(0) + '.' + str.slice(1);
3120
+ }
3121
+
3122
+ str = str + (x.e < 0 ? 'e' : 'e+') + x.e;
3123
+ } else if (e < 0) {
3124
+ str = '0.' + getZeroString(-e - 1) + str;
3125
+ if (sd && (k = sd - len) > 0) str += getZeroString(k);
3126
+ } else if (e >= len) {
3127
+ str += getZeroString(e + 1 - len);
3128
+ if (sd && (k = sd - e - 1) > 0) str = str + '.' + getZeroString(k);
3129
+ } else {
3130
+ if ((k = e + 1) < len) str = str.slice(0, k) + '.' + str.slice(k);
3131
+ if (sd && (k = sd - len) > 0) {
3132
+ if (e + 1 === len) str += '.';
3133
+ str += getZeroString(k);
3134
+ }
3135
+ }
3136
+
3137
+ return str;
3138
+ }
3139
+
3140
+
3141
+ // Calculate the base 10 exponent from the base 1e7 exponent.
3142
+ function getBase10Exponent(digits, e) {
3143
+ var w = digits[0];
3144
+
3145
+ // Add the number of digits of the first word of the digits array.
3146
+ for ( e *= LOG_BASE; w >= 10; w /= 10) e++;
3147
+ return e;
3148
+ }
3149
+
3150
+
3151
+ function getLn10(Ctor, sd, pr) {
3152
+ if (sd > LN10_PRECISION) {
3153
+
3154
+ // Reset global state in case the exception is caught.
3155
+ external = true;
3156
+ if (pr) Ctor.precision = pr;
3157
+ throw Error(precisionLimitExceeded);
3158
+ }
3159
+ return finalise(new Ctor(LN10), sd, 1, true);
3160
+ }
3161
+
3162
+
3163
+ function getPi(Ctor, sd, rm) {
3164
+ if (sd > PI_PRECISION) throw Error(precisionLimitExceeded);
3165
+ return finalise(new Ctor(PI), sd, rm, true);
3166
+ }
3167
+
3168
+
3169
+ function getPrecision(digits) {
3170
+ var w = digits.length - 1,
3171
+ len = w * LOG_BASE + 1;
3172
+
3173
+ w = digits[w];
3174
+
3175
+ // If non-zero...
3176
+ if (w) {
3177
+
3178
+ // Subtract the number of trailing zeros of the last word.
3179
+ for (; w % 10 == 0; w /= 10) len--;
3180
+
3181
+ // Add the number of digits of the first word.
3182
+ for (w = digits[0]; w >= 10; w /= 10) len++;
3183
+ }
3184
+
3185
+ return len;
3186
+ }
3187
+
3188
+
3189
+ function getZeroString(k) {
3190
+ var zs = '';
3191
+ for (; k--;) zs += '0';
3192
+ return zs;
3193
+ }
3194
+
3195
+
3196
+ /*
3197
+ * Return a new Decimal whose value is the value of Decimal `x` to the power `n`, where `n` is an
3198
+ * integer of type number.
3199
+ *
3200
+ * Implements 'exponentiation by squaring'. Called by `pow` and `parseOther`.
3201
+ *
3202
+ */
3203
+ function intPow(Ctor, x, n, pr) {
3204
+ var isTruncated,
3205
+ r = new Ctor(1),
3206
+
3207
+ // Max n of 9007199254740991 takes 53 loop iterations.
3208
+ // Maximum digits array length; leaves [28, 34] guard digits.
3209
+ k = Math.ceil(pr / LOG_BASE + 4);
3210
+
3211
+ external = false;
3212
+
3213
+ for (;;) {
3214
+ if (n % 2) {
3215
+ r = r.times(x);
3216
+ if (truncate(r.d, k)) isTruncated = true;
3217
+ }
3218
+
3219
+ n = mathfloor(n / 2);
3220
+ if (n === 0) {
3221
+
3222
+ // To ensure correct rounding when r.d is truncated, increment the last word if it is zero.
3223
+ n = r.d.length - 1;
3224
+ if (isTruncated && r.d[n] === 0) ++r.d[n];
3225
+ break;
3226
+ }
3227
+
3228
+ x = x.times(x);
3229
+ truncate(x.d, k);
3230
+ }
3231
+
3232
+ external = true;
3233
+
3234
+ return r;
3235
+ }
3236
+
3237
+
3238
+ function isOdd(n) {
3239
+ return n.d[n.d.length - 1] & 1;
3240
+ }
3241
+
3242
+
3243
+ /*
3244
+ * Handle `max` (`n` is -1) and `min` (`n` is 1).
3245
+ */
3246
+ function maxOrMin(Ctor, args, n) {
3247
+ var k, y,
3248
+ x = new Ctor(args[0]),
3249
+ i = 0;
3250
+
3251
+ for (; ++i < args.length;) {
3252
+ y = new Ctor(args[i]);
3253
+
3254
+ // NaN?
3255
+ if (!y.s) {
3256
+ x = y;
3257
+ break;
3258
+ }
3259
+
3260
+ k = x.cmp(y);
3261
+
3262
+ if (k === n || k === 0 && x.s === n) {
3263
+ x = y;
3264
+ }
3265
+ }
3266
+
3267
+ return x;
3268
+ }
3269
+
3270
+
3271
+ /*
3272
+ * Return a new Decimal whose value is the natural exponential of `x` rounded to `sd` significant
3273
+ * digits.
3274
+ *
3275
+ * Taylor/Maclaurin series.
3276
+ *
3277
+ * exp(x) = x^0/0! + x^1/1! + x^2/2! + x^3/3! + ...
3278
+ *
3279
+ * Argument reduction:
3280
+ * Repeat x = x / 32, k += 5, until |x| < 0.1
3281
+ * exp(x) = exp(x / 2^k)^(2^k)
3282
+ *
3283
+ * Previously, the argument was initially reduced by
3284
+ * exp(x) = exp(r) * 10^k where r = x - k * ln10, k = floor(x / ln10)
3285
+ * to first put r in the range [0, ln10], before dividing by 32 until |x| < 0.1, but this was
3286
+ * found to be slower than just dividing repeatedly by 32 as above.
3287
+ *
3288
+ * Max integer argument: exp('20723265836946413') = 6.3e+9000000000000000
3289
+ * Min integer argument: exp('-20723265836946411') = 1.2e-9000000000000000
3290
+ * (Math object integer min/max: Math.exp(709) = 8.2e+307, Math.exp(-745) = 5e-324)
3291
+ *
3292
+ * exp(Infinity) = Infinity
3293
+ * exp(-Infinity) = 0
3294
+ * exp(NaN) = NaN
3295
+ * exp(±0) = 1
3296
+ *
3297
+ * exp(x) is non-terminating for any finite, non-zero x.
3298
+ *
3299
+ * The result will always be correctly rounded.
3300
+ *
3301
+ */
3302
+ function naturalExponential(x, sd) {
3303
+ var denominator, guard, j, pow, sum, t, wpr,
3304
+ rep = 0,
3305
+ i = 0,
3306
+ k = 0,
3307
+ Ctor = x.constructor,
3308
+ rm = Ctor.rounding,
3309
+ pr = Ctor.precision;
3310
+
3311
+ // 0/NaN/Infinity?
3312
+ if (!x.d || !x.d[0] || x.e > 17) {
3313
+
3314
+ return new Ctor(x.d
3315
+ ? !x.d[0] ? 1 : x.s < 0 ? 0 : 1 / 0
3316
+ : x.s ? x.s < 0 ? 0 : x : 0 / 0);
3317
+ }
3318
+
3319
+ if (sd == null) {
3320
+ external = false;
3321
+ wpr = pr;
3322
+ } else {
3323
+ wpr = sd;
3324
+ }
3325
+
3326
+ t = new Ctor(0.03125);
3327
+
3328
+ // while abs(x) >= 0.1
3329
+ while (x.e > -2) {
3330
+
3331
+ // x = x / 2^5
3332
+ x = x.times(t);
3333
+ k += 5;
3334
+ }
3335
+
3336
+ // Use 2 * log10(2^k) + 5 (empirically derived) to estimate the increase in precision
3337
+ // necessary to ensure the first 4 rounding digits are correct.
3338
+ guard = Math.log(mathpow(2, k)) / Math.LN10 * 2 + 5 | 0;
3339
+ wpr += guard;
3340
+ denominator = pow = sum = new Ctor(1);
3341
+ Ctor.precision = wpr;
3342
+
3343
+ for (;;) {
3344
+ pow = finalise(pow.times(x), wpr, 1);
3345
+ denominator = denominator.times(++i);
3346
+ t = sum.plus(divide(pow, denominator, wpr, 1));
3347
+
3348
+ if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) {
3349
+ j = k;
3350
+ while (j--) sum = finalise(sum.times(sum), wpr, 1);
3351
+
3352
+ // Check to see if the first 4 rounding digits are [49]999.
3353
+ // If so, repeat the summation with a higher precision, otherwise
3354
+ // e.g. with precision: 18, rounding: 1
3355
+ // exp(18.404272462595034083567793919843761) = 98372560.1229999999 (should be 98372560.123)
3356
+ // `wpr - guard` is the index of first rounding digit.
3357
+ if (sd == null) {
3358
+
3359
+ if (rep < 3 && checkRoundingDigits(sum.d, wpr - guard, rm, rep)) {
3360
+ Ctor.precision = wpr += 10;
3361
+ denominator = pow = t = new Ctor(1);
3362
+ i = 0;
3363
+ rep++;
3364
+ } else {
3365
+ return finalise(sum, Ctor.precision = pr, rm, external = true);
3366
+ }
3367
+ } else {
3368
+ Ctor.precision = pr;
3369
+ return sum;
3370
+ }
3371
+ }
3372
+
3373
+ sum = t;
3374
+ }
3375
+ }
3376
+
3377
+
3378
+ /*
3379
+ * Return a new Decimal whose value is the natural logarithm of `x` rounded to `sd` significant
3380
+ * digits.
3381
+ *
3382
+ * ln(-n) = NaN
3383
+ * ln(0) = -Infinity
3384
+ * ln(-0) = -Infinity
3385
+ * ln(1) = 0
3386
+ * ln(Infinity) = Infinity
3387
+ * ln(-Infinity) = NaN
3388
+ * ln(NaN) = NaN
3389
+ *
3390
+ * ln(n) (n != 1) is non-terminating.
3391
+ *
3392
+ */
3393
+ function naturalLogarithm(y, sd) {
3394
+ var c, c0, denominator, e, numerator, rep, sum, t, wpr, x1, x2,
3395
+ n = 1,
3396
+ guard = 10,
3397
+ x = y,
3398
+ xd = x.d,
3399
+ Ctor = x.constructor,
3400
+ rm = Ctor.rounding,
3401
+ pr = Ctor.precision;
3402
+
3403
+ // Is x negative or Infinity, NaN, 0 or 1?
3404
+ if (x.s < 0 || !xd || !xd[0] || !x.e && xd[0] == 1 && xd.length == 1) {
3405
+ return new Ctor(xd && !xd[0] ? -1 / 0 : x.s != 1 ? NaN : xd ? 0 : x);
3406
+ }
3407
+
3408
+ if (sd == null) {
3409
+ external = false;
3410
+ wpr = pr;
3411
+ } else {
3412
+ wpr = sd;
3413
+ }
3414
+
3415
+ Ctor.precision = wpr += guard;
3416
+ c = digitsToString(xd);
3417
+ c0 = c.charAt(0);
3418
+
3419
+ if (Math.abs(e = x.e) < 1.5e15) {
3420
+
3421
+ // Argument reduction.
3422
+ // The series converges faster the closer the argument is to 1, so using
3423
+ // ln(a^b) = b * ln(a), ln(a) = ln(a^b) / b
3424
+ // multiply the argument by itself until the leading digits of the significand are 7, 8, 9,
3425
+ // 10, 11, 12 or 13, recording the number of multiplications so the sum of the series can
3426
+ // later be divided by this number, then separate out the power of 10 using
3427
+ // ln(a*10^b) = ln(a) + b*ln(10).
3428
+
3429
+ // max n is 21 (gives 0.9, 1.0 or 1.1) (9e15 / 21 = 4.2e14).
3430
+ //while (c0 < 9 && c0 != 1 || c0 == 1 && c.charAt(1) > 1) {
3431
+ // max n is 6 (gives 0.7 - 1.3)
3432
+ while (c0 < 7 && c0 != 1 || c0 == 1 && c.charAt(1) > 3) {
3433
+ x = x.times(y);
3434
+ c = digitsToString(x.d);
3435
+ c0 = c.charAt(0);
3436
+ n++;
3437
+ }
3438
+
3439
+ e = x.e;
3440
+
3441
+ if (c0 > 1) {
3442
+ x = new Ctor('0.' + c);
3443
+ e++;
3444
+ } else {
3445
+ x = new Ctor(c0 + '.' + c.slice(1));
3446
+ }
3447
+ } else {
3448
+
3449
+ // The argument reduction method above may result in overflow if the argument y is a massive
3450
+ // number with exponent >= 1500000000000000 (9e15 / 6 = 1.5e15), so instead recall this
3451
+ // function using ln(x*10^e) = ln(x) + e*ln(10).
3452
+ t = getLn10(Ctor, wpr + 2, pr).times(e + '');
3453
+ x = naturalLogarithm(new Ctor(c0 + '.' + c.slice(1)), wpr - guard).plus(t);
3454
+ Ctor.precision = pr;
3455
+
3456
+ return sd == null ? finalise(x, pr, rm, external = true) : x;
3457
+ }
3458
+
3459
+ // x1 is x reduced to a value near 1.
3460
+ x1 = x;
3461
+
3462
+ // Taylor series.
3463
+ // ln(y) = ln((1 + x)/(1 - x)) = 2(x + x^3/3 + x^5/5 + x^7/7 + ...)
3464
+ // where x = (y - 1)/(y + 1) (|x| < 1)
3465
+ sum = numerator = x = divide(x.minus(1), x.plus(1), wpr, 1);
3466
+ x2 = finalise(x.times(x), wpr, 1);
3467
+ denominator = 3;
3468
+
3469
+ for (;;) {
3470
+ numerator = finalise(numerator.times(x2), wpr, 1);
3471
+ t = sum.plus(divide(numerator, new Ctor(denominator), wpr, 1));
3472
+
3473
+ if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) {
3474
+ sum = sum.times(2);
3475
+
3476
+ // Reverse the argument reduction. Check that e is not 0 because, besides preventing an
3477
+ // unnecessary calculation, -0 + 0 = +0 and to ensure correct rounding -0 needs to stay -0.
3478
+ if (e !== 0) sum = sum.plus(getLn10(Ctor, wpr + 2, pr).times(e + ''));
3479
+ sum = divide(sum, new Ctor(n), wpr, 1);
3480
+
3481
+ // Is rm > 3 and the first 4 rounding digits 4999, or rm < 4 (or the summation has
3482
+ // been repeated previously) and the first 4 rounding digits 9999?
3483
+ // If so, restart the summation with a higher precision, otherwise
3484
+ // e.g. with precision: 12, rounding: 1
3485
+ // ln(135520028.6126091714265381533) = 18.7246299999 when it should be 18.72463.
3486
+ // `wpr - guard` is the index of first rounding digit.
3487
+ if (sd == null) {
3488
+ if (checkRoundingDigits(sum.d, wpr - guard, rm, rep)) {
3489
+ Ctor.precision = wpr += guard;
3490
+ t = numerator = x = divide(x1.minus(1), x1.plus(1), wpr, 1);
3491
+ x2 = finalise(x.times(x), wpr, 1);
3492
+ denominator = rep = 1;
3493
+ } else {
3494
+ return finalise(sum, Ctor.precision = pr, rm, external = true);
3495
+ }
3496
+ } else {
3497
+ Ctor.precision = pr;
3498
+ return sum;
3499
+ }
3500
+ }
3501
+
3502
+ sum = t;
3503
+ denominator += 2;
3504
+ }
3505
+ }
3506
+
3507
+
3508
+ // ±Infinity, NaN.
3509
+ function nonFiniteToString(x) {
3510
+ // Unsigned.
3511
+ return String(x.s * x.s / 0);
3512
+ }
3513
+
3514
+
3515
+ /*
3516
+ * Parse the value of a new Decimal `x` from string `str`.
3517
+ */
3518
+ function parseDecimal(x, str) {
3519
+ var e, i, len;
3520
+
3521
+ // TODO BigInt str: no need to check for decimal point, exponential form or leading zeros.
3522
+ // Decimal point?
3523
+ if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');
3524
+
3525
+ // Exponential form?
3526
+ if ((i = str.search(/e/i)) > 0) {
3527
+
3528
+ // Determine exponent.
3529
+ if (e < 0) e = i;
3530
+ e += +str.slice(i + 1);
3531
+ str = str.substring(0, i);
3532
+ } else if (e < 0) {
3533
+
3534
+ // Integer.
3535
+ e = str.length;
3536
+ }
3537
+
3538
+ // Determine leading zeros.
3539
+ for (i = 0; str.charCodeAt(i) === 48; i++);
3540
+
3541
+ // Determine trailing zeros.
3542
+ for (len = str.length; str.charCodeAt(len - 1) === 48; --len);
3543
+ str = str.slice(i, len);
3544
+
3545
+ if (str) {
3546
+ len -= i;
3547
+ x.e = e = e - i - 1;
3548
+ x.d = [];
3549
+
3550
+ // Transform base
3551
+
3552
+ // e is the base 10 exponent.
3553
+ // i is where to slice str to get the first word of the digits array.
3554
+ i = (e + 1) % LOG_BASE;
3555
+ if (e < 0) i += LOG_BASE;
3556
+
3557
+ if (i < len) {
3558
+ if (i) x.d.push(+str.slice(0, i));
3559
+ for (len -= LOG_BASE; i < len;) x.d.push(+str.slice(i, i += LOG_BASE));
3560
+ str = str.slice(i);
3561
+ i = LOG_BASE - str.length;
3562
+ } else {
3563
+ i -= len;
3564
+ }
3565
+
3566
+ for (; i--;) str += '0';
3567
+ x.d.push(+str);
3568
+
3569
+ if (external) {
3570
+
3571
+ // Overflow?
3572
+ if (x.e > x.constructor.maxE) {
3573
+
3574
+ // Infinity.
3575
+ x.d = null;
3576
+ x.e = NaN;
3577
+
3578
+ // Underflow?
3579
+ } else if (x.e < x.constructor.minE) {
3580
+
3581
+ // Zero.
3582
+ x.e = 0;
3583
+ x.d = [0];
3584
+ // x.constructor.underflow = true;
3585
+ } // else x.constructor.underflow = false;
3586
+ }
3587
+ } else {
3588
+
3589
+ // Zero.
3590
+ x.e = 0;
3591
+ x.d = [0];
3592
+ }
3593
+
3594
+ return x;
3595
+ }
3596
+
3597
+
3598
+ /*
3599
+ * Parse the value of a new Decimal `x` from a string `str`, which is not a decimal value.
3600
+ */
3601
+ function parseOther(x, str) {
3602
+ var base, Ctor, divisor, i, isFloat, len, p, xd, xe;
3603
+
3604
+ if (str.indexOf('_') > -1) {
3605
+ str = str.replace(/(\d)_(?=\d)/g, '$1');
3606
+ if (isDecimal.test(str)) return parseDecimal(x, str);
3607
+ } else if (str === 'Infinity' || str === 'NaN') {
3608
+ if (!+str) x.s = NaN;
3609
+ x.e = NaN;
3610
+ x.d = null;
3611
+ return x;
3612
+ }
3613
+
3614
+ if (isHex.test(str)) {
3615
+ base = 16;
3616
+ str = str.toLowerCase();
3617
+ } else if (isBinary.test(str)) {
3618
+ base = 2;
3619
+ } else if (isOctal.test(str)) {
3620
+ base = 8;
3621
+ } else {
3622
+ throw Error(invalidArgument + str);
3623
+ }
3624
+
3625
+ // Is there a binary exponent part?
3626
+ i = str.search(/p/i);
3627
+
3628
+ if (i > 0) {
3629
+ p = +str.slice(i + 1);
3630
+ str = str.substring(2, i);
3631
+ } else {
3632
+ str = str.slice(2);
3633
+ }
3634
+
3635
+ // Convert `str` as an integer then divide the result by `base` raised to a power such that the
3636
+ // fraction part will be restored.
3637
+ i = str.indexOf('.');
3638
+ isFloat = i >= 0;
3639
+ Ctor = x.constructor;
3640
+
3641
+ if (isFloat) {
3642
+ str = str.replace('.', '');
3643
+ len = str.length;
3644
+ i = len - i;
3645
+
3646
+ // log[10](16) = 1.2041... , log[10](88) = 1.9444....
3647
+ divisor = intPow(Ctor, new Ctor(base), i, i * 2);
3648
+ }
3649
+
3650
+ xd = convertBase(str, base, BASE);
3651
+ xe = xd.length - 1;
3652
+
3653
+ // Remove trailing zeros.
3654
+ for (i = xe; xd[i] === 0; --i) xd.pop();
3655
+ if (i < 0) return new Ctor(x.s * 0);
3656
+ x.e = getBase10Exponent(xd, xe);
3657
+ x.d = xd;
3658
+ external = false;
3659
+
3660
+ // At what precision to perform the division to ensure exact conversion?
3661
+ // maxDecimalIntegerPartDigitCount = ceil(log[10](b) * otherBaseIntegerPartDigitCount)
3662
+ // log[10](2) = 0.30103, log[10](8) = 0.90309, log[10](16) = 1.20412
3663
+ // E.g. ceil(1.2 * 3) = 4, so up to 4 decimal digits are needed to represent 3 hex int digits.
3664
+ // maxDecimalFractionPartDigitCount = {Hex:4|Oct:3|Bin:1} * otherBaseFractionPartDigitCount
3665
+ // Therefore using 4 * the number of digits of str will always be enough.
3666
+ if (isFloat) x = divide(x, divisor, len * 4);
3667
+
3668
+ // Multiply by the binary exponent part if present.
3669
+ if (p) x = x.times(Math.abs(p) < 54 ? mathpow(2, p) : Decimal.pow(2, p));
3670
+ external = true;
3671
+
3672
+ return x;
3673
+ }
3674
+
3675
+
3676
+ /*
3677
+ * sin(x) = x - x^3/3! + x^5/5! - ...
3678
+ * |x| < pi/2
3679
+ *
3680
+ */
3681
+ function sine(Ctor, x) {
3682
+ var k,
3683
+ len = x.d.length;
3684
+
3685
+ if (len < 3) {
3686
+ return x.isZero() ? x : taylorSeries(Ctor, 2, x, x);
3687
+ }
3688
+
3689
+ // Argument reduction: sin(5x) = 16*sin^5(x) - 20*sin^3(x) + 5*sin(x)
3690
+ // i.e. sin(x) = 16*sin^5(x/5) - 20*sin^3(x/5) + 5*sin(x/5)
3691
+ // and sin(x) = sin(x/5)(5 + sin^2(x/5)(16sin^2(x/5) - 20))
3692
+
3693
+ // Estimate the optimum number of times to use the argument reduction.
3694
+ k = 1.4 * Math.sqrt(len);
3695
+ k = k > 16 ? 16 : k | 0;
3696
+
3697
+ x = x.times(1 / tinyPow(5, k));
3698
+ x = taylorSeries(Ctor, 2, x, x);
3699
+
3700
+ // Reverse argument reduction
3701
+ var sin2_x,
3702
+ d5 = new Ctor(5),
3703
+ d16 = new Ctor(16),
3704
+ d20 = new Ctor(20);
3705
+ for (; k--;) {
3706
+ sin2_x = x.times(x);
3707
+ x = x.times(d5.plus(sin2_x.times(d16.times(sin2_x).minus(d20))));
3708
+ }
3709
+
3710
+ return x;
3711
+ }
3712
+
3713
+
3714
+ // Calculate Taylor series for `cos`, `cosh`, `sin` and `sinh`.
3715
+ function taylorSeries(Ctor, n, x, y, isHyperbolic) {
3716
+ var j, t, u, x2,
3717
+ i = 1,
3718
+ pr = Ctor.precision,
3719
+ k = Math.ceil(pr / LOG_BASE);
3720
+
3721
+ external = false;
3722
+ x2 = x.times(x);
3723
+ u = new Ctor(y);
3724
+
3725
+ for (;;) {
3726
+ t = divide(u.times(x2), new Ctor(n++ * n++), pr, 1);
3727
+ u = isHyperbolic ? y.plus(t) : y.minus(t);
3728
+ y = divide(t.times(x2), new Ctor(n++ * n++), pr, 1);
3729
+ t = u.plus(y);
3730
+
3731
+ if (t.d[k] !== void 0) {
3732
+ for (j = k; t.d[j] === u.d[j] && j--;);
3733
+ if (j == -1) break;
3734
+ }
3735
+
3736
+ j = u;
3737
+ u = y;
3738
+ y = t;
3739
+ t = j;
3740
+ i++;
3741
+ }
3742
+
3743
+ external = true;
3744
+ t.d.length = k + 1;
3745
+
3746
+ return t;
3747
+ }
3748
+
3749
+
3750
+ // Exponent e must be positive and non-zero.
3751
+ function tinyPow(b, e) {
3752
+ var n = b;
3753
+ while (--e) n *= b;
3754
+ return n;
3755
+ }
3756
+
3757
+
3758
+ // Return the absolute value of `x` reduced to less than or equal to half pi.
3759
+ function toLessThanHalfPi(Ctor, x) {
3760
+ var t,
3761
+ isNeg = x.s < 0,
3762
+ pi = getPi(Ctor, Ctor.precision, 1),
3763
+ halfPi = pi.times(0.5);
3764
+
3765
+ x = x.abs();
3766
+
3767
+ if (x.lte(halfPi)) {
3768
+ quadrant = isNeg ? 4 : 1;
3769
+ return x;
3770
+ }
3771
+
3772
+ t = x.divToInt(pi);
3773
+
3774
+ if (t.isZero()) {
3775
+ quadrant = isNeg ? 3 : 2;
3776
+ } else {
3777
+ x = x.minus(t.times(pi));
3778
+
3779
+ // 0 <= x < pi
3780
+ if (x.lte(halfPi)) {
3781
+ quadrant = isOdd(t) ? (isNeg ? 2 : 3) : (isNeg ? 4 : 1);
3782
+ return x;
3783
+ }
3784
+
3785
+ quadrant = isOdd(t) ? (isNeg ? 1 : 4) : (isNeg ? 3 : 2);
3786
+ }
3787
+
3788
+ return x.minus(pi).abs();
3789
+ }
3790
+
3791
+
3792
+ /*
3793
+ * Return the value of Decimal `x` as a string in base `baseOut`.
3794
+ *
3795
+ * If the optional `sd` argument is present include a binary exponent suffix.
3796
+ */
3797
+ function toStringBinary(x, baseOut, sd, rm) {
3798
+ var base, e, i, k, len, roundUp, str, xd, y,
3799
+ Ctor = x.constructor,
3800
+ isExp = sd !== void 0;
3801
+
3802
+ if (isExp) {
3803
+ checkInt32(sd, 1, MAX_DIGITS);
3804
+ if (rm === void 0) rm = Ctor.rounding;
3805
+ else checkInt32(rm, 0, 8);
3806
+ } else {
3807
+ sd = Ctor.precision;
3808
+ rm = Ctor.rounding;
3809
+ }
3810
+
3811
+ if (!x.isFinite()) {
3812
+ str = nonFiniteToString(x);
3813
+ } else {
3814
+ str = finiteToString(x);
3815
+ i = str.indexOf('.');
3816
+
3817
+ // Use exponential notation according to `toExpPos` and `toExpNeg`? No, but if required:
3818
+ // maxBinaryExponent = floor((decimalExponent + 1) * log[2](10))
3819
+ // minBinaryExponent = floor(decimalExponent * log[2](10))
3820
+ // log[2](10) = 3.321928094887362347870319429489390175864
3821
+
3822
+ if (isExp) {
3823
+ base = 2;
3824
+ if (baseOut == 16) {
3825
+ sd = sd * 4 - 3;
3826
+ } else if (baseOut == 8) {
3827
+ sd = sd * 3 - 2;
3828
+ }
3829
+ } else {
3830
+ base = baseOut;
3831
+ }
3832
+
3833
+ // Convert the number as an integer then divide the result by its base raised to a power such
3834
+ // that the fraction part will be restored.
3835
+
3836
+ // Non-integer.
3837
+ if (i >= 0) {
3838
+ str = str.replace('.', '');
3839
+ y = new Ctor(1);
3840
+ y.e = str.length - i;
3841
+ y.d = convertBase(finiteToString(y), 10, base);
3842
+ y.e = y.d.length;
3843
+ }
3844
+
3845
+ xd = convertBase(str, 10, base);
3846
+ e = len = xd.length;
3847
+
3848
+ // Remove trailing zeros.
3849
+ for (; xd[--len] == 0;) xd.pop();
3850
+
3851
+ if (!xd[0]) {
3852
+ str = isExp ? '0p+0' : '0';
3853
+ } else {
3854
+ if (i < 0) {
3855
+ e--;
3856
+ } else {
3857
+ x = new Ctor(x);
3858
+ x.d = xd;
3859
+ x.e = e;
3860
+ x = divide(x, y, sd, rm, 0, base);
3861
+ xd = x.d;
3862
+ e = x.e;
3863
+ roundUp = inexact;
3864
+ }
3865
+
3866
+ // The rounding digit, i.e. the digit after the digit that may be rounded up.
3867
+ i = xd[sd];
3868
+ k = base / 2;
3869
+ roundUp = roundUp || xd[sd + 1] !== void 0;
3870
+
3871
+ roundUp = rm < 4
3872
+ ? (i !== void 0 || roundUp) && (rm === 0 || rm === (x.s < 0 ? 3 : 2))
3873
+ : i > k || i === k && (rm === 4 || roundUp || rm === 6 && xd[sd - 1] & 1 ||
3874
+ rm === (x.s < 0 ? 8 : 7));
3875
+
3876
+ xd.length = sd;
3877
+
3878
+ if (roundUp) {
3879
+
3880
+ // Rounding up may mean the previous digit has to be rounded up and so on.
3881
+ for (; ++xd[--sd] > base - 1;) {
3882
+ xd[sd] = 0;
3883
+ if (!sd) {
3884
+ ++e;
3885
+ xd.unshift(1);
3886
+ }
3887
+ }
3888
+ }
3889
+
3890
+ // Determine trailing zeros.
3891
+ for (len = xd.length; !xd[len - 1]; --len);
3892
+
3893
+ // E.g. [4, 11, 15] becomes 4bf.
3894
+ for (i = 0, str = ''; i < len; i++) str += NUMERALS.charAt(xd[i]);
3895
+
3896
+ // Add binary exponent suffix?
3897
+ if (isExp) {
3898
+ if (len > 1) {
3899
+ if (baseOut == 16 || baseOut == 8) {
3900
+ i = baseOut == 16 ? 4 : 3;
3901
+ for (--len; len % i; len++) str += '0';
3902
+ xd = convertBase(str, base, baseOut);
3903
+ for (len = xd.length; !xd[len - 1]; --len);
3904
+
3905
+ // xd[0] will always be be 1
3906
+ for (i = 1, str = '1.'; i < len; i++) str += NUMERALS.charAt(xd[i]);
3907
+ } else {
3908
+ str = str.charAt(0) + '.' + str.slice(1);
3909
+ }
3910
+ }
3911
+
3912
+ str = str + (e < 0 ? 'p' : 'p+') + e;
3913
+ } else if (e < 0) {
3914
+ for (; ++e;) str = '0' + str;
3915
+ str = '0.' + str;
3916
+ } else {
3917
+ if (++e > len) for (e -= len; e-- ;) str += '0';
3918
+ else if (e < len) str = str.slice(0, e) + '.' + str.slice(e);
3919
+ }
3920
+ }
3921
+
3922
+ str = (baseOut == 16 ? '0x' : baseOut == 2 ? '0b' : baseOut == 8 ? '0o' : '') + str;
3923
+ }
3924
+
3925
+ return x.s < 0 ? '-' + str : str;
3926
+ }
3927
+
3928
+
3929
+ // Does not strip trailing zeros.
3930
+ function truncate(arr, len) {
3931
+ if (arr.length > len) {
3932
+ arr.length = len;
3933
+ return true;
3934
+ }
3935
+ }
3936
+
3937
+
3938
+ // Decimal methods
3939
+
3940
+
3941
+ /*
3942
+ * abs
3943
+ * acos
3944
+ * acosh
3945
+ * add
3946
+ * asin
3947
+ * asinh
3948
+ * atan
3949
+ * atanh
3950
+ * atan2
3951
+ * cbrt
3952
+ * ceil
3953
+ * clamp
3954
+ * clone
3955
+ * config
3956
+ * cos
3957
+ * cosh
3958
+ * div
3959
+ * exp
3960
+ * floor
3961
+ * hypot
3962
+ * ln
3963
+ * log
3964
+ * log2
3965
+ * log10
3966
+ * max
3967
+ * min
3968
+ * mod
3969
+ * mul
3970
+ * pow
3971
+ * random
3972
+ * round
3973
+ * set
3974
+ * sign
3975
+ * sin
3976
+ * sinh
3977
+ * sqrt
3978
+ * sub
3979
+ * sum
3980
+ * tan
3981
+ * tanh
3982
+ * trunc
3983
+ */
3984
+
3985
+
3986
+ /*
3987
+ * Return a new Decimal whose value is the absolute value of `x`.
3988
+ *
3989
+ * x {number|string|bigint|Decimal}
3990
+ *
3991
+ */
3992
+ function abs(x) {
3993
+ return new this(x).abs();
3994
+ }
3995
+
3996
+
3997
+ /*
3998
+ * Return a new Decimal whose value is the arccosine in radians of `x`.
3999
+ *
4000
+ * x {number|string|bigint|Decimal}
4001
+ *
4002
+ */
4003
+ function acos(x) {
4004
+ return new this(x).acos();
4005
+ }
4006
+
4007
+
4008
+ /*
4009
+ * Return a new Decimal whose value is the inverse of the hyperbolic cosine of `x`, rounded to
4010
+ * `precision` significant digits using rounding mode `rounding`.
4011
+ *
4012
+ * x {number|string|bigint|Decimal} A value in radians.
4013
+ *
4014
+ */
4015
+ function acosh(x) {
4016
+ return new this(x).acosh();
4017
+ }
4018
+
4019
+
4020
+ /*
4021
+ * Return a new Decimal whose value is the sum of `x` and `y`, rounded to `precision` significant
4022
+ * digits using rounding mode `rounding`.
4023
+ *
4024
+ * x {number|string|bigint|Decimal}
4025
+ * y {number|string|bigint|Decimal}
4026
+ *
4027
+ */
4028
+ function add(x, y) {
4029
+ return new this(x).plus(y);
4030
+ }
4031
+
4032
+
4033
+ /*
4034
+ * Return a new Decimal whose value is the arcsine in radians of `x`, rounded to `precision`
4035
+ * significant digits using rounding mode `rounding`.
4036
+ *
4037
+ * x {number|string|bigint|Decimal}
4038
+ *
4039
+ */
4040
+ function asin(x) {
4041
+ return new this(x).asin();
4042
+ }
4043
+
4044
+
4045
+ /*
4046
+ * Return a new Decimal whose value is the inverse of the hyperbolic sine of `x`, rounded to
4047
+ * `precision` significant digits using rounding mode `rounding`.
4048
+ *
4049
+ * x {number|string|bigint|Decimal} A value in radians.
4050
+ *
4051
+ */
4052
+ function asinh(x) {
4053
+ return new this(x).asinh();
4054
+ }
4055
+
4056
+
4057
+ /*
4058
+ * Return a new Decimal whose value is the arctangent in radians of `x`, rounded to `precision`
4059
+ * significant digits using rounding mode `rounding`.
4060
+ *
4061
+ * x {number|string|bigint|Decimal}
4062
+ *
4063
+ */
4064
+ function atan(x) {
4065
+ return new this(x).atan();
4066
+ }
4067
+
4068
+
4069
+ /*
4070
+ * Return a new Decimal whose value is the inverse of the hyperbolic tangent of `x`, rounded to
4071
+ * `precision` significant digits using rounding mode `rounding`.
4072
+ *
4073
+ * x {number|string|bigint|Decimal} A value in radians.
4074
+ *
4075
+ */
4076
+ function atanh(x) {
4077
+ return new this(x).atanh();
4078
+ }
4079
+
4080
+
4081
+ /*
4082
+ * Return a new Decimal whose value is the arctangent in radians of `y/x` in the range -pi to pi
4083
+ * (inclusive), rounded to `precision` significant digits using rounding mode `rounding`.
4084
+ *
4085
+ * Domain: [-Infinity, Infinity]
4086
+ * Range: [-pi, pi]
4087
+ *
4088
+ * y {number|string|bigint|Decimal} The y-coordinate.
4089
+ * x {number|string|bigint|Decimal} The x-coordinate.
4090
+ *
4091
+ * atan2(±0, -0) = ±pi
4092
+ * atan2(±0, +0) = ±0
4093
+ * atan2(±0, -x) = ±pi for x > 0
4094
+ * atan2(±0, x) = ±0 for x > 0
4095
+ * atan2(-y, ±0) = -pi/2 for y > 0
4096
+ * atan2(y, ±0) = pi/2 for y > 0
4097
+ * atan2(±y, -Infinity) = ±pi for finite y > 0
4098
+ * atan2(±y, +Infinity) = ±0 for finite y > 0
4099
+ * atan2(±Infinity, x) = ±pi/2 for finite x
4100
+ * atan2(±Infinity, -Infinity) = ±3*pi/4
4101
+ * atan2(±Infinity, +Infinity) = ±pi/4
4102
+ * atan2(NaN, x) = NaN
4103
+ * atan2(y, NaN) = NaN
4104
+ *
4105
+ */
4106
+ function atan2(y, x) {
4107
+ y = new this(y);
4108
+ x = new this(x);
4109
+ var r,
4110
+ pr = this.precision,
4111
+ rm = this.rounding,
4112
+ wpr = pr + 4;
4113
+
4114
+ // Either NaN
4115
+ if (!y.s || !x.s) {
4116
+ r = new this(NaN);
4117
+
4118
+ // Both ±Infinity
4119
+ } else if (!y.d && !x.d) {
4120
+ r = getPi(this, wpr, 1).times(x.s > 0 ? 0.25 : 0.75);
4121
+ r.s = y.s;
4122
+
4123
+ // x is ±Infinity or y is ±0
4124
+ } else if (!x.d || y.isZero()) {
4125
+ r = x.s < 0 ? getPi(this, pr, rm) : new this(0);
4126
+ r.s = y.s;
4127
+
4128
+ // y is ±Infinity or x is ±0
4129
+ } else if (!y.d || x.isZero()) {
4130
+ r = getPi(this, wpr, 1).times(0.5);
4131
+ r.s = y.s;
4132
+
4133
+ // Both non-zero and finite
4134
+ } else if (x.s < 0) {
4135
+ this.precision = wpr;
4136
+ this.rounding = 1;
4137
+ r = this.atan(divide(y, x, wpr, 1));
4138
+ x = getPi(this, wpr, 1);
4139
+ this.precision = pr;
4140
+ this.rounding = rm;
4141
+ r = y.s < 0 ? r.minus(x) : r.plus(x);
4142
+ } else {
4143
+ r = this.atan(divide(y, x, wpr, 1));
4144
+ }
4145
+
4146
+ return r;
4147
+ }
4148
+
4149
+
4150
+ /*
4151
+ * Return a new Decimal whose value is the cube root of `x`, rounded to `precision` significant
4152
+ * digits using rounding mode `rounding`.
4153
+ *
4154
+ * x {number|string|bigint|Decimal}
4155
+ *
4156
+ */
4157
+ function cbrt(x) {
4158
+ return new this(x).cbrt();
4159
+ }
4160
+
4161
+
4162
+ /*
4163
+ * Return a new Decimal whose value is `x` rounded to an integer using `ROUND_CEIL`.
4164
+ *
4165
+ * x {number|string|bigint|Decimal}
4166
+ *
4167
+ */
4168
+ function ceil(x) {
4169
+ return finalise(x = new this(x), x.e + 1, 2);
4170
+ }
4171
+
4172
+
4173
+ /*
4174
+ * Return a new Decimal whose value is `x` clamped to the range delineated by `min` and `max`.
4175
+ *
4176
+ * x {number|string|bigint|Decimal}
4177
+ * min {number|string|bigint|Decimal}
4178
+ * max {number|string|bigint|Decimal}
4179
+ *
4180
+ */
4181
+ function clamp(x, min, max) {
4182
+ return new this(x).clamp(min, max);
4183
+ }
4184
+
4185
+
4186
+ /*
4187
+ * Configure global settings for a Decimal constructor.
4188
+ *
4189
+ * `obj` is an object with one or more of the following properties,
4190
+ *
4191
+ * precision {number}
4192
+ * rounding {number}
4193
+ * toExpNeg {number}
4194
+ * toExpPos {number}
4195
+ * maxE {number}
4196
+ * minE {number}
4197
+ * modulo {number}
4198
+ * crypto {boolean|number}
4199
+ * defaults {true}
4200
+ *
4201
+ * E.g. Decimal.config({ precision: 20, rounding: 4 })
4202
+ *
4203
+ */
4204
+ function config(obj) {
4205
+ if (!obj || typeof obj !== 'object') throw Error(decimalError + 'Object expected');
4206
+ var i, p, v,
4207
+ useDefaults = obj.defaults === true,
4208
+ ps = [
4209
+ 'precision', 1, MAX_DIGITS,
4210
+ 'rounding', 0, 8,
4211
+ 'toExpNeg', -EXP_LIMIT, 0,
4212
+ 'toExpPos', 0, EXP_LIMIT,
4213
+ 'maxE', 0, EXP_LIMIT,
4214
+ 'minE', -EXP_LIMIT, 0,
4215
+ 'modulo', 0, 9
4216
+ ];
4217
+
4218
+ for (i = 0; i < ps.length; i += 3) {
4219
+ if (p = ps[i], useDefaults) this[p] = DEFAULTS[p];
4220
+ if ((v = obj[p]) !== void 0) {
4221
+ if (mathfloor(v) === v && v >= ps[i + 1] && v <= ps[i + 2]) this[p] = v;
4222
+ else throw Error(invalidArgument + p + ': ' + v);
4223
+ }
4224
+ }
4225
+
4226
+ if (p = 'crypto', useDefaults) this[p] = DEFAULTS[p];
4227
+ if ((v = obj[p]) !== void 0) {
4228
+ if (v === true || v === false || v === 0 || v === 1) {
4229
+ if (v) {
4230
+ if (typeof crypto != 'undefined' && crypto &&
4231
+ (crypto.getRandomValues || crypto.randomBytes)) {
4232
+ this[p] = true;
4233
+ } else {
4234
+ throw Error(cryptoUnavailable);
4235
+ }
4236
+ } else {
4237
+ this[p] = false;
4238
+ }
4239
+ } else {
4240
+ throw Error(invalidArgument + p + ': ' + v);
4241
+ }
4242
+ }
4243
+
4244
+ return this;
4245
+ }
4246
+
4247
+
4248
+ /*
4249
+ * Return a new Decimal whose value is the cosine of `x`, rounded to `precision` significant
4250
+ * digits using rounding mode `rounding`.
4251
+ *
4252
+ * x {number|string|bigint|Decimal} A value in radians.
4253
+ *
4254
+ */
4255
+ function cos(x) {
4256
+ return new this(x).cos();
4257
+ }
4258
+
4259
+
4260
+ /*
4261
+ * Return a new Decimal whose value is the hyperbolic cosine of `x`, rounded to precision
4262
+ * significant digits using rounding mode `rounding`.
4263
+ *
4264
+ * x {number|string|bigint|Decimal} A value in radians.
4265
+ *
4266
+ */
4267
+ function cosh(x) {
4268
+ return new this(x).cosh();
4269
+ }
4270
+
4271
+
4272
+ /*
4273
+ * Create and return a Decimal constructor with the same configuration properties as this Decimal
4274
+ * constructor.
4275
+ *
4276
+ */
4277
+ function clone(obj) {
4278
+ var i, p, ps;
4279
+
4280
+ /*
4281
+ * The Decimal constructor and exported function.
4282
+ * Return a new Decimal instance.
4283
+ *
4284
+ * v {number|string|bigint|Decimal} A numeric value.
4285
+ *
4286
+ */
4287
+ function Decimal(v) {
4288
+ var e, i, t,
4289
+ x = this;
4290
+
4291
+ // Decimal called without new.
4292
+ if (!(x instanceof Decimal)) return new Decimal(v);
4293
+
4294
+ // Retain a reference to this Decimal constructor, and shadow Decimal.prototype.constructor
4295
+ // which points to Object.
4296
+ x.constructor = Decimal;
4297
+
4298
+ if (isDecimalInstance(v)) {
4299
+ x.s = v.s;
4300
+
4301
+ if (external) {
4302
+ if (!v.d || v.e > Decimal.maxE) {
4303
+
4304
+ // Infinity.
4305
+ x.e = NaN;
4306
+ x.d = null;
4307
+ } else if (v.e < Decimal.minE) {
4308
+
4309
+ // Zero.
4310
+ x.e = 0;
4311
+ x.d = [0];
4312
+ } else {
4313
+ x.e = v.e;
4314
+ x.d = v.d.slice();
4315
+ }
4316
+ } else {
4317
+ x.e = v.e;
4318
+ x.d = v.d ? v.d.slice() : v.d;
4319
+ }
4320
+
4321
+ return;
4322
+ }
4323
+
4324
+ t = typeof v;
4325
+
4326
+ if (t === 'number') {
4327
+ if (v === 0) {
4328
+ x.s = 1 / v < 0 ? -1 : 1;
4329
+ x.e = 0;
4330
+ x.d = [0];
4331
+ return;
4332
+ }
4333
+
4334
+ if (v < 0) {
4335
+ v = -v;
4336
+ x.s = -1;
4337
+ } else {
4338
+ x.s = 1;
4339
+ }
4340
+
4341
+ // Fast path for small integers.
4342
+ if (v === ~~v && v < 1e7) {
4343
+ for (e = 0, i = v; i >= 10; i /= 10) e++;
4344
+
4345
+ if (external) {
4346
+ if (e > Decimal.maxE) {
4347
+ x.e = NaN;
4348
+ x.d = null;
4349
+ } else if (e < Decimal.minE) {
4350
+ x.e = 0;
4351
+ x.d = [0];
4352
+ } else {
4353
+ x.e = e;
4354
+ x.d = [v];
4355
+ }
4356
+ } else {
4357
+ x.e = e;
4358
+ x.d = [v];
4359
+ }
4360
+
4361
+ return;
4362
+ }
4363
+
4364
+ // Infinity or NaN?
4365
+ if (v * 0 !== 0) {
4366
+ if (!v) x.s = NaN;
4367
+ x.e = NaN;
4368
+ x.d = null;
4369
+ return;
4370
+ }
4371
+
4372
+ return parseDecimal(x, v.toString());
4373
+ }
4374
+
4375
+ if (t === 'string') {
4376
+ if ((i = v.charCodeAt(0)) === 45) { // minus sign
4377
+ v = v.slice(1);
4378
+ x.s = -1;
4379
+ } else {
4380
+ if (i === 43) v = v.slice(1); // plus sign
4381
+ x.s = 1;
4382
+ }
4383
+
4384
+ return isDecimal.test(v) ? parseDecimal(x, v) : parseOther(x, v);
4385
+ }
4386
+
4387
+ if (t === 'bigint') {
4388
+ if (v < 0) {
4389
+ v = -v;
4390
+ x.s = -1;
4391
+ } else {
4392
+ x.s = 1;
4393
+ }
4394
+
4395
+ return parseDecimal(x, v.toString());
4396
+ }
4397
+
4398
+ throw Error(invalidArgument + v);
4399
+ }
4400
+
4401
+ Decimal.prototype = P;
4402
+
4403
+ Decimal.ROUND_UP = 0;
4404
+ Decimal.ROUND_DOWN = 1;
4405
+ Decimal.ROUND_CEIL = 2;
4406
+ Decimal.ROUND_FLOOR = 3;
4407
+ Decimal.ROUND_HALF_UP = 4;
4408
+ Decimal.ROUND_HALF_DOWN = 5;
4409
+ Decimal.ROUND_HALF_EVEN = 6;
4410
+ Decimal.ROUND_HALF_CEIL = 7;
4411
+ Decimal.ROUND_HALF_FLOOR = 8;
4412
+ Decimal.EUCLID = 9;
4413
+
4414
+ Decimal.config = Decimal.set = config;
4415
+ Decimal.clone = clone;
4416
+ Decimal.isDecimal = isDecimalInstance;
4417
+
4418
+ Decimal.abs = abs;
4419
+ Decimal.acos = acos;
4420
+ Decimal.acosh = acosh; // ES6
4421
+ Decimal.add = add;
4422
+ Decimal.asin = asin;
4423
+ Decimal.asinh = asinh; // ES6
4424
+ Decimal.atan = atan;
4425
+ Decimal.atanh = atanh; // ES6
4426
+ Decimal.atan2 = atan2;
4427
+ Decimal.cbrt = cbrt; // ES6
4428
+ Decimal.ceil = ceil;
4429
+ Decimal.clamp = clamp;
4430
+ Decimal.cos = cos;
4431
+ Decimal.cosh = cosh; // ES6
4432
+ Decimal.div = div;
4433
+ Decimal.exp = exp;
4434
+ Decimal.floor = floor;
4435
+ Decimal.hypot = hypot; // ES6
4436
+ Decimal.ln = ln;
4437
+ Decimal.log = log;
4438
+ Decimal.log10 = log10; // ES6
4439
+ Decimal.log2 = log2; // ES6
4440
+ Decimal.max = max;
4441
+ Decimal.min = min;
4442
+ Decimal.mod = mod;
4443
+ Decimal.mul = mul;
4444
+ Decimal.pow = pow;
4445
+ Decimal.random = random;
4446
+ Decimal.round = round;
4447
+ Decimal.sign = sign; // ES6
4448
+ Decimal.sin = sin;
4449
+ Decimal.sinh = sinh; // ES6
4450
+ Decimal.sqrt = sqrt;
4451
+ Decimal.sub = sub;
4452
+ Decimal.sum = sum;
4453
+ Decimal.tan = tan;
4454
+ Decimal.tanh = tanh; // ES6
4455
+ Decimal.trunc = trunc; // ES6
4456
+
4457
+ if (obj === void 0) obj = {};
4458
+ if (obj) {
4459
+ if (obj.defaults !== true) {
4460
+ ps = ['precision', 'rounding', 'toExpNeg', 'toExpPos', 'maxE', 'minE', 'modulo', 'crypto'];
4461
+ for (i = 0; i < ps.length;) if (!obj.hasOwnProperty(p = ps[i++])) obj[p] = this[p];
4462
+ }
4463
+ }
4464
+
4465
+ Decimal.config(obj);
4466
+
4467
+ return Decimal;
4468
+ }
4469
+
4470
+
4471
+ /*
4472
+ * Return a new Decimal whose value is `x` divided by `y`, rounded to `precision` significant
4473
+ * digits using rounding mode `rounding`.
4474
+ *
4475
+ * x {number|string|bigint|Decimal}
4476
+ * y {number|string|bigint|Decimal}
4477
+ *
4478
+ */
4479
+ function div(x, y) {
4480
+ return new this(x).div(y);
4481
+ }
4482
+
4483
+
4484
+ /*
4485
+ * Return a new Decimal whose value is the natural exponential of `x`, rounded to `precision`
4486
+ * significant digits using rounding mode `rounding`.
4487
+ *
4488
+ * x {number|string|bigint|Decimal} The power to which to raise the base of the natural log.
4489
+ *
4490
+ */
4491
+ function exp(x) {
4492
+ return new this(x).exp();
4493
+ }
4494
+
4495
+
4496
+ /*
4497
+ * Return a new Decimal whose value is `x` round to an integer using `ROUND_FLOOR`.
4498
+ *
4499
+ * x {number|string|bigint|Decimal}
4500
+ *
4501
+ */
4502
+ function floor(x) {
4503
+ return finalise(x = new this(x), x.e + 1, 3);
4504
+ }
4505
+
4506
+
4507
+ /*
4508
+ * Return a new Decimal whose value is the square root of the sum of the squares of the arguments,
4509
+ * rounded to `precision` significant digits using rounding mode `rounding`.
4510
+ *
4511
+ * hypot(a, b, ...) = sqrt(a^2 + b^2 + ...)
4512
+ *
4513
+ * arguments {number|string|bigint|Decimal}
4514
+ *
4515
+ */
4516
+ function hypot() {
4517
+ var i, n,
4518
+ t = new this(0);
4519
+
4520
+ external = false;
4521
+
4522
+ for (i = 0; i < arguments.length;) {
4523
+ n = new this(arguments[i++]);
4524
+ if (!n.d) {
4525
+ if (n.s) {
4526
+ external = true;
4527
+ return new this(1 / 0);
4528
+ }
4529
+ t = n;
4530
+ } else if (t.d) {
4531
+ t = t.plus(n.times(n));
4532
+ }
4533
+ }
4534
+
4535
+ external = true;
4536
+
4537
+ return t.sqrt();
4538
+ }
4539
+
4540
+
4541
+ /*
4542
+ * Return true if object is a Decimal instance (where Decimal is any Decimal constructor),
4543
+ * otherwise return false.
4544
+ *
4545
+ */
4546
+ function isDecimalInstance(obj) {
4547
+ return obj instanceof Decimal || obj && obj.toStringTag === tag || false;
4548
+ }
4549
+
4550
+
4551
+ /*
4552
+ * Return a new Decimal whose value is the natural logarithm of `x`, rounded to `precision`
4553
+ * significant digits using rounding mode `rounding`.
4554
+ *
4555
+ * x {number|string|bigint|Decimal}
4556
+ *
4557
+ */
4558
+ function ln(x) {
4559
+ return new this(x).ln();
4560
+ }
4561
+
4562
+
4563
+ /*
4564
+ * Return a new Decimal whose value is the log of `x` to the base `y`, or to base 10 if no base
4565
+ * is specified, rounded to `precision` significant digits using rounding mode `rounding`.
4566
+ *
4567
+ * log[y](x)
4568
+ *
4569
+ * x {number|string|bigint|Decimal} The argument of the logarithm.
4570
+ * y {number|string|bigint|Decimal} The base of the logarithm.
4571
+ *
4572
+ */
4573
+ function log(x, y) {
4574
+ return new this(x).log(y);
4575
+ }
4576
+
4577
+
4578
+ /*
4579
+ * Return a new Decimal whose value is the base 2 logarithm of `x`, rounded to `precision`
4580
+ * significant digits using rounding mode `rounding`.
4581
+ *
4582
+ * x {number|string|bigint|Decimal}
4583
+ *
4584
+ */
4585
+ function log2(x) {
4586
+ return new this(x).log(2);
4587
+ }
4588
+
4589
+
4590
+ /*
4591
+ * Return a new Decimal whose value is the base 10 logarithm of `x`, rounded to `precision`
4592
+ * significant digits using rounding mode `rounding`.
4593
+ *
4594
+ * x {number|string|bigint|Decimal}
4595
+ *
4596
+ */
4597
+ function log10(x) {
4598
+ return new this(x).log(10);
4599
+ }
4600
+
4601
+
4602
+ /*
4603
+ * Return a new Decimal whose value is the maximum of the arguments.
4604
+ *
4605
+ * arguments {number|string|bigint|Decimal}
4606
+ *
4607
+ */
4608
+ function max() {
4609
+ return maxOrMin(this, arguments, -1);
4610
+ }
4611
+
4612
+
4613
+ /*
4614
+ * Return a new Decimal whose value is the minimum of the arguments.
4615
+ *
4616
+ * arguments {number|string|bigint|Decimal}
4617
+ *
4618
+ */
4619
+ function min() {
4620
+ return maxOrMin(this, arguments, 1);
4621
+ }
4622
+
4623
+
4624
+ /*
4625
+ * Return a new Decimal whose value is `x` modulo `y`, rounded to `precision` significant digits
4626
+ * using rounding mode `rounding`.
4627
+ *
4628
+ * x {number|string|bigint|Decimal}
4629
+ * y {number|string|bigint|Decimal}
4630
+ *
4631
+ */
4632
+ function mod(x, y) {
4633
+ return new this(x).mod(y);
4634
+ }
4635
+
4636
+
4637
+ /*
4638
+ * Return a new Decimal whose value is `x` multiplied by `y`, rounded to `precision` significant
4639
+ * digits using rounding mode `rounding`.
4640
+ *
4641
+ * x {number|string|bigint|Decimal}
4642
+ * y {number|string|bigint|Decimal}
4643
+ *
4644
+ */
4645
+ function mul(x, y) {
4646
+ return new this(x).mul(y);
4647
+ }
4648
+
4649
+
4650
+ /*
4651
+ * Return a new Decimal whose value is `x` raised to the power `y`, rounded to precision
4652
+ * significant digits using rounding mode `rounding`.
4653
+ *
4654
+ * x {number|string|bigint|Decimal} The base.
4655
+ * y {number|string|bigint|Decimal} The exponent.
4656
+ *
4657
+ */
4658
+ function pow(x, y) {
4659
+ return new this(x).pow(y);
4660
+ }
4661
+
4662
+
4663
+ /*
4664
+ * Returns a new Decimal with a random value equal to or greater than 0 and less than 1, and with
4665
+ * `sd`, or `Decimal.precision` if `sd` is omitted, significant digits (or less if trailing zeros
4666
+ * are produced).
4667
+ *
4668
+ * [sd] {number} Significant digits. Integer, 0 to MAX_DIGITS inclusive.
4669
+ *
4670
+ */
4671
+ function random(sd) {
4672
+ var d, e, k, n,
4673
+ i = 0,
4674
+ r = new this(1),
4675
+ rd = [];
4676
+
4677
+ if (sd === void 0) sd = this.precision;
4678
+ else checkInt32(sd, 1, MAX_DIGITS);
4679
+
4680
+ k = Math.ceil(sd / LOG_BASE);
4681
+
4682
+ if (!this.crypto) {
4683
+ for (; i < k;) rd[i++] = Math.random() * 1e7 | 0;
4684
+
4685
+ // Browsers supporting crypto.getRandomValues.
4686
+ } else if (crypto.getRandomValues) {
4687
+ d = crypto.getRandomValues(new Uint32Array(k));
4688
+
4689
+ for (; i < k;) {
4690
+ n = d[i];
4691
+
4692
+ // 0 <= n < 4294967296
4693
+ // Probability n >= 4.29e9, is 4967296 / 4294967296 = 0.00116 (1 in 865).
4694
+ if (n >= 4.29e9) {
4695
+ d[i] = crypto.getRandomValues(new Uint32Array(1))[0];
4696
+ } else {
4697
+
4698
+ // 0 <= n <= 4289999999
4699
+ // 0 <= (n % 1e7) <= 9999999
4700
+ rd[i++] = n % 1e7;
4701
+ }
4702
+ }
4703
+
4704
+ // Node.js supporting crypto.randomBytes.
4705
+ } else if (crypto.randomBytes) {
4706
+
4707
+ // buffer
4708
+ d = crypto.randomBytes(k *= 4);
4709
+
4710
+ for (; i < k;) {
4711
+
4712
+ // 0 <= n < 2147483648
4713
+ n = d[i] + (d[i + 1] << 8) + (d[i + 2] << 16) + ((d[i + 3] & 0x7f) << 24);
4714
+
4715
+ // Probability n >= 2.14e9, is 7483648 / 2147483648 = 0.0035 (1 in 286).
4716
+ if (n >= 2.14e9) {
4717
+ crypto.randomBytes(4).copy(d, i);
4718
+ } else {
4719
+
4720
+ // 0 <= n <= 2139999999
4721
+ // 0 <= (n % 1e7) <= 9999999
4722
+ rd.push(n % 1e7);
4723
+ i += 4;
4724
+ }
4725
+ }
4726
+
4727
+ i = k / 4;
4728
+ } else {
4729
+ throw Error(cryptoUnavailable);
4730
+ }
4731
+
4732
+ k = rd[--i];
4733
+ sd %= LOG_BASE;
4734
+
4735
+ // Convert trailing digits to zeros according to sd.
4736
+ if (k && sd) {
4737
+ n = mathpow(10, LOG_BASE - sd);
4738
+ rd[i] = (k / n | 0) * n;
4739
+ }
4740
+
4741
+ // Remove trailing words which are zero.
4742
+ for (; rd[i] === 0; i--) rd.pop();
4743
+
4744
+ // Zero?
4745
+ if (i < 0) {
4746
+ e = 0;
4747
+ rd = [0];
4748
+ } else {
4749
+ e = -1;
4750
+
4751
+ // Remove leading words which are zero and adjust exponent accordingly.
4752
+ for (; rd[0] === 0; e -= LOG_BASE) rd.shift();
4753
+
4754
+ // Count the digits of the first word of rd to determine leading zeros.
4755
+ for (k = 1, n = rd[0]; n >= 10; n /= 10) k++;
4756
+
4757
+ // Adjust the exponent for leading zeros of the first word of rd.
4758
+ if (k < LOG_BASE) e -= LOG_BASE - k;
4759
+ }
4760
+
4761
+ r.e = e;
4762
+ r.d = rd;
4763
+
4764
+ return r;
4765
+ }
4766
+
4767
+
4768
+ /*
4769
+ * Return a new Decimal whose value is `x` rounded to an integer using rounding mode `rounding`.
4770
+ *
4771
+ * To emulate `Math.round`, set rounding to 7 (ROUND_HALF_CEIL).
4772
+ *
4773
+ * x {number|string|bigint|Decimal}
4774
+ *
4775
+ */
4776
+ function round(x) {
4777
+ return finalise(x = new this(x), x.e + 1, this.rounding);
4778
+ }
4779
+
4780
+
4781
+ /*
4782
+ * Return
4783
+ * 1 if x > 0,
4784
+ * -1 if x < 0,
4785
+ * 0 if x is 0,
4786
+ * -0 if x is -0,
4787
+ * NaN otherwise
4788
+ *
4789
+ * x {number|string|bigint|Decimal}
4790
+ *
4791
+ */
4792
+ function sign(x) {
4793
+ x = new this(x);
4794
+ return x.d ? (x.d[0] ? x.s : 0 * x.s) : x.s || NaN;
4795
+ }
4796
+
4797
+
4798
+ /*
4799
+ * Return a new Decimal whose value is the sine of `x`, rounded to `precision` significant digits
4800
+ * using rounding mode `rounding`.
4801
+ *
4802
+ * x {number|string|bigint|Decimal} A value in radians.
4803
+ *
4804
+ */
4805
+ function sin(x) {
4806
+ return new this(x).sin();
4807
+ }
4808
+
4809
+
4810
+ /*
4811
+ * Return a new Decimal whose value is the hyperbolic sine of `x`, rounded to `precision`
4812
+ * significant digits using rounding mode `rounding`.
4813
+ *
4814
+ * x {number|string|bigint|Decimal} A value in radians.
4815
+ *
4816
+ */
4817
+ function sinh(x) {
4818
+ return new this(x).sinh();
4819
+ }
4820
+
4821
+
4822
+ /*
4823
+ * Return a new Decimal whose value is the square root of `x`, rounded to `precision` significant
4824
+ * digits using rounding mode `rounding`.
4825
+ *
4826
+ * x {number|string|bigint|Decimal}
4827
+ *
4828
+ */
4829
+ function sqrt(x) {
4830
+ return new this(x).sqrt();
4831
+ }
4832
+
4833
+
4834
+ /*
4835
+ * Return a new Decimal whose value is `x` minus `y`, rounded to `precision` significant digits
4836
+ * using rounding mode `rounding`.
4837
+ *
4838
+ * x {number|string|bigint|Decimal}
4839
+ * y {number|string|bigint|Decimal}
4840
+ *
4841
+ */
4842
+ function sub(x, y) {
4843
+ return new this(x).sub(y);
4844
+ }
4845
+
4846
+
4847
+ /*
4848
+ * Return a new Decimal whose value is the sum of the arguments, rounded to `precision`
4849
+ * significant digits using rounding mode `rounding`.
4850
+ *
4851
+ * Only the result is rounded, not the intermediate calculations.
4852
+ *
4853
+ * arguments {number|string|bigint|Decimal}
4854
+ *
4855
+ */
4856
+ function sum() {
4857
+ var i = 0,
4858
+ args = arguments,
4859
+ x = new this(args[i]);
4860
+
4861
+ external = false;
4862
+ for (; x.s && ++i < args.length;) x = x.plus(args[i]);
4863
+ external = true;
4864
+
4865
+ return finalise(x, this.precision, this.rounding);
4866
+ }
4867
+
4868
+
4869
+ /*
4870
+ * Return a new Decimal whose value is the tangent of `x`, rounded to `precision` significant
4871
+ * digits using rounding mode `rounding`.
4872
+ *
4873
+ * x {number|string|bigint|Decimal} A value in radians.
4874
+ *
4875
+ */
4876
+ function tan(x) {
4877
+ return new this(x).tan();
4878
+ }
4879
+
4880
+
4881
+ /*
4882
+ * Return a new Decimal whose value is the hyperbolic tangent of `x`, rounded to `precision`
4883
+ * significant digits using rounding mode `rounding`.
4884
+ *
4885
+ * x {number|string|bigint|Decimal} A value in radians.
4886
+ *
4887
+ */
4888
+ function tanh(x) {
4889
+ return new this(x).tanh();
4890
+ }
4891
+
4892
+
4893
+ /*
4894
+ * Return a new Decimal whose value is `x` truncated to an integer.
4895
+ *
4896
+ * x {number|string|bigint|Decimal}
4897
+ *
4898
+ */
4899
+ function trunc(x) {
4900
+ return finalise(x = new this(x), x.e + 1, 1);
4901
+ }
4902
+
4903
+
4904
+ P[Symbol.for('nodejs.util.inspect.custom')] = P.toString;
4905
+ P[Symbol.toStringTag] = 'Decimal';
4906
+
4907
+ // Create and configure initial Decimal constructor.
4908
+ export var Decimal = P.constructor = clone(DEFAULTS);
4909
+
4910
+ // Create the internal constants from their string values.
4911
+ LN10 = new Decimal(LN10);
4912
+ PI = new Decimal(PI);
4913
+
4914
+ export default Decimal;