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