@univerjs/engine-formula 0.2.7 → 0.2.8

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 (396) hide show
  1. package/lib/cjs/index.js +1 -1
  2. package/lib/es/index.js +2690 -237
  3. package/lib/types/basics/calculate.d.ts +0 -1
  4. package/lib/types/basics/common.d.ts +0 -1
  5. package/lib/types/basics/date.d.ts +4 -1
  6. package/lib/types/basics/dirty.d.ts +0 -1
  7. package/lib/types/basics/engineering.d.ts +25 -0
  8. package/lib/types/basics/financial.d.ts +18 -0
  9. package/lib/types/basics/function.d.ts +0 -1
  10. package/lib/types/basics/match-token.d.ts +0 -1
  11. package/lib/types/basics/object-class-type.d.ts +0 -1
  12. package/lib/types/basics/runtime.d.ts +0 -1
  13. package/lib/types/commands/mutations/register-function.mutation.d.ts +0 -1
  14. package/lib/types/commands/mutations/set-array-formula-data.mutation.d.ts +0 -1
  15. package/lib/types/commands/mutations/set-defined-name.mutation.d.ts +0 -1
  16. package/lib/types/commands/mutations/set-feature-calculation.mutation.d.ts +0 -1
  17. package/lib/types/commands/mutations/set-formula-calculation.mutation.d.ts +0 -1
  18. package/lib/types/commands/mutations/set-formula-data.mutation.d.ts +0 -1
  19. package/lib/types/commands/mutations/set-other-formula.mutation.d.ts +0 -1
  20. package/lib/types/commands/mutations/set-super-table.mutation.d.ts +0 -1
  21. package/lib/types/controller/calculate.controller.d.ts +0 -1
  22. package/lib/types/controller/formula.controller.d.ts +0 -1
  23. package/lib/types/controller/set-defined-name.controller.d.ts +0 -1
  24. package/lib/types/controller/set-dependency.controller.d.ts +0 -1
  25. package/lib/types/controller/set-feature-calculation.controller.d.ts +0 -1
  26. package/lib/types/controller/set-other-formula.controller.d.ts +0 -1
  27. package/lib/types/controller/set-super-table.controller.d.ts +0 -1
  28. package/lib/types/engine/analysis/__tests__/create-command-test-bed.d.ts +0 -1
  29. package/lib/types/engine/analysis/lexer-node.d.ts +0 -1
  30. package/lib/types/engine/analysis/lexer-tree-builder.d.ts +0 -1
  31. package/lib/types/engine/analysis/lexer.d.ts +0 -1
  32. package/lib/types/engine/analysis/parser.d.ts +0 -1
  33. package/lib/types/engine/ast-node/ast-root-node.d.ts +0 -1
  34. package/lib/types/engine/ast-node/base-ast-node-factory.d.ts +0 -1
  35. package/lib/types/engine/ast-node/base-ast-node.d.ts +0 -1
  36. package/lib/types/engine/ast-node/function-node.d.ts +0 -1
  37. package/lib/types/engine/ast-node/lambda-node.d.ts +0 -1
  38. package/lib/types/engine/ast-node/lambda-parameter-node.d.ts +0 -1
  39. package/lib/types/engine/ast-node/null-node.d.ts +0 -1
  40. package/lib/types/engine/ast-node/operator-node.d.ts +0 -1
  41. package/lib/types/engine/ast-node/prefix-node.d.ts +0 -1
  42. package/lib/types/engine/ast-node/reference-node.d.ts +0 -1
  43. package/lib/types/engine/ast-node/suffix-node.d.ts +0 -1
  44. package/lib/types/engine/ast-node/union-node.d.ts +0 -1
  45. package/lib/types/engine/ast-node/value-node.d.ts +0 -1
  46. package/lib/types/engine/dependency/dependency-tree.d.ts +0 -1
  47. package/lib/types/engine/dependency/formula-dependency.d.ts +0 -1
  48. package/lib/types/engine/interpreter/interpreter.d.ts +0 -1
  49. package/lib/types/engine/reference-object/base-reference-object.d.ts +0 -1
  50. package/lib/types/engine/reference-object/cell-reference-object.d.ts +0 -1
  51. package/lib/types/engine/reference-object/column-reference-object.d.ts +0 -1
  52. package/lib/types/engine/reference-object/range-reference-object.d.ts +0 -1
  53. package/lib/types/engine/reference-object/row-reference-object.d.ts +0 -1
  54. package/lib/types/engine/reference-object/table-reference-object.d.ts +0 -1
  55. package/lib/types/engine/utils/array-object.d.ts +0 -1
  56. package/lib/types/engine/utils/ast-node-tool.d.ts +0 -1
  57. package/lib/types/engine/utils/cell.d.ts +0 -1
  58. package/lib/types/engine/utils/check-variant-error.d.ts +20 -0
  59. package/lib/types/engine/utils/compare.d.ts +0 -1
  60. package/lib/types/engine/utils/function-definition.d.ts +0 -1
  61. package/lib/types/engine/utils/get-runtime-feature-cell.d.ts +4 -0
  62. package/lib/types/engine/utils/node-type.d.ts +0 -1
  63. package/lib/types/engine/utils/numfmt-kit.d.ts +0 -1
  64. package/lib/types/engine/utils/object-compare.d.ts +0 -1
  65. package/lib/types/engine/utils/prefixHandler.d.ts +0 -1
  66. package/lib/types/engine/utils/r1c1-reference.d.ts +0 -1
  67. package/lib/types/engine/utils/reference.d.ts +0 -1
  68. package/lib/types/engine/utils/relative-formula.d.ts +0 -1
  69. package/lib/types/engine/utils/sequence.d.ts +0 -1
  70. package/lib/types/engine/utils/value-object.d.ts +0 -1
  71. package/lib/types/engine/value-object/array-value-object.d.ts +0 -1
  72. package/lib/types/engine/value-object/base-value-object.d.ts +0 -1
  73. package/lib/types/engine/value-object/cube-value-object.d.ts +0 -1
  74. package/lib/types/engine/value-object/lambda-value-object.d.ts +0 -1
  75. package/lib/types/engine/value-object/primitive-object.d.ts +0 -1
  76. package/lib/types/functions/__tests__/create-function-test-bed.d.ts +0 -1
  77. package/lib/types/functions/base-function.d.ts +0 -1
  78. package/lib/types/functions/compatibility/function-map.d.ts +0 -1
  79. package/lib/types/functions/custom-function.d.ts +0 -1
  80. package/lib/types/functions/date/date/index.d.ts +0 -1
  81. package/lib/types/functions/date/datedif/index.d.ts +0 -1
  82. package/lib/types/functions/date/datevalue/index.d.ts +0 -1
  83. package/lib/types/functions/date/day/index.d.ts +0 -1
  84. package/lib/types/functions/date/days/index.d.ts +0 -1
  85. package/lib/types/functions/date/days360/index.d.ts +0 -2
  86. package/lib/types/functions/date/edate/index.d.ts +0 -1
  87. package/lib/types/functions/date/eomonth/index.d.ts +0 -1
  88. package/lib/types/functions/date/function-map.d.ts +0 -1
  89. package/lib/types/functions/date/hour/index.d.ts +0 -1
  90. package/lib/types/functions/date/isoweeknum/index.d.ts +0 -1
  91. package/lib/types/functions/date/minute/index.d.ts +0 -1
  92. package/lib/types/functions/date/month/index.d.ts +0 -1
  93. package/lib/types/functions/date/networkdays/index.d.ts +0 -1
  94. package/lib/types/functions/date/networkdays-intl/index.d.ts +0 -1
  95. package/lib/types/functions/date/now/index.d.ts +0 -1
  96. package/lib/types/functions/date/second/index.d.ts +0 -1
  97. package/lib/types/functions/date/time/index.d.ts +0 -1
  98. package/lib/types/functions/date/timevalue/index.d.ts +0 -1
  99. package/lib/types/functions/date/today/index.d.ts +0 -1
  100. package/lib/types/functions/date/weekday/index.d.ts +0 -1
  101. package/lib/types/functions/date/weeknum/index.d.ts +0 -1
  102. package/lib/types/functions/date/workday/index.d.ts +0 -1
  103. package/lib/types/functions/date/workday-intl/index.d.ts +0 -1
  104. package/lib/types/functions/date/year/index.d.ts +0 -1
  105. package/lib/types/functions/date/yearfrac/index.d.ts +0 -5
  106. package/lib/types/functions/engineering/besseli/__tests__/index.spec.d.ts +16 -0
  107. package/lib/types/functions/engineering/besseli/index.d.ts +8 -0
  108. package/lib/types/functions/engineering/besselj/__tests__/index.spec.d.ts +16 -0
  109. package/lib/types/functions/engineering/besselj/index.d.ts +8 -0
  110. package/lib/types/functions/engineering/besselk/__tests__/index.spec.d.ts +16 -0
  111. package/lib/types/functions/engineering/besselk/index.d.ts +8 -0
  112. package/lib/types/functions/engineering/bessely/__tests__/index.spec.d.ts +16 -0
  113. package/lib/types/functions/engineering/bessely/index.d.ts +8 -0
  114. package/lib/types/functions/engineering/bin2dec/__tests__/index.spec.d.ts +16 -0
  115. package/lib/types/functions/engineering/bin2dec/index.d.ts +8 -0
  116. package/lib/types/functions/engineering/bin2hex/__tests__/index.spec.d.ts +16 -0
  117. package/lib/types/functions/engineering/bin2hex/index.d.ts +8 -0
  118. package/lib/types/functions/engineering/bin2oct/__tests__/index.spec.d.ts +16 -0
  119. package/lib/types/functions/engineering/bin2oct/index.d.ts +8 -0
  120. package/lib/types/functions/engineering/bitand/__tests__/index.spec.d.ts +16 -0
  121. package/lib/types/functions/engineering/bitand/index.d.ts +7 -0
  122. package/lib/types/functions/engineering/bitlshift/__tests__/index.spec.d.ts +16 -0
  123. package/lib/types/functions/engineering/bitlshift/index.d.ts +7 -0
  124. package/lib/types/functions/engineering/bitor/__tests__/index.spec.d.ts +16 -0
  125. package/lib/types/functions/engineering/bitor/index.d.ts +7 -0
  126. package/lib/types/functions/engineering/bitrshift/__tests__/index.spec.d.ts +16 -0
  127. package/lib/types/functions/engineering/bitrshift/index.d.ts +7 -0
  128. package/lib/types/functions/engineering/bitxor/__tests__/index.spec.d.ts +16 -0
  129. package/lib/types/functions/engineering/bitxor/index.d.ts +7 -0
  130. package/lib/types/functions/engineering/complex/__tests__/index.spec.d.ts +16 -0
  131. package/lib/types/functions/engineering/complex/index.d.ts +8 -0
  132. package/lib/types/functions/engineering/convert/__tests__/index.spec.d.ts +16 -0
  133. package/lib/types/functions/engineering/convert/index.d.ts +20 -0
  134. package/lib/types/functions/engineering/dec2bin/__tests__/index.spec.d.ts +16 -0
  135. package/lib/types/functions/engineering/dec2bin/index.d.ts +8 -0
  136. package/lib/types/functions/engineering/dec2hex/__tests__/index.spec.d.ts +16 -0
  137. package/lib/types/functions/engineering/dec2hex/index.d.ts +8 -0
  138. package/lib/types/functions/engineering/dec2oct/__tests__/index.spec.d.ts +16 -0
  139. package/lib/types/functions/engineering/dec2oct/index.d.ts +8 -0
  140. package/lib/types/functions/engineering/delta/__tests__/index.spec.d.ts +16 -0
  141. package/lib/types/functions/engineering/delta/index.d.ts +8 -0
  142. package/lib/types/functions/engineering/erf/__tests__/index.spec.d.ts +16 -0
  143. package/lib/types/functions/engineering/erf/index.d.ts +8 -0
  144. package/lib/types/functions/engineering/erf-precise/__tests__/index.spec.d.ts +16 -0
  145. package/lib/types/functions/engineering/erf-precise/index.d.ts +8 -0
  146. package/lib/types/functions/engineering/erfc/__tests__/index.spec.d.ts +16 -0
  147. package/lib/types/functions/engineering/erfc/index.d.ts +8 -0
  148. package/lib/types/functions/engineering/erfc-precise/__tests__/index.spec.d.ts +16 -0
  149. package/lib/types/functions/engineering/erfc-precise/index.d.ts +8 -0
  150. package/lib/types/functions/engineering/function-map.d.ts +4 -16
  151. package/lib/types/functions/engineering/hex2bin/__tests__/index.spec.d.ts +16 -0
  152. package/lib/types/functions/engineering/hex2bin/index.d.ts +8 -0
  153. package/lib/types/functions/engineering/hex2dec/__tests__/index.spec.d.ts +16 -0
  154. package/lib/types/functions/engineering/hex2dec/index.d.ts +8 -0
  155. package/lib/types/functions/engineering/hex2oct/__tests__/index.spec.d.ts +16 -0
  156. package/lib/types/functions/engineering/hex2oct/index.d.ts +8 -0
  157. package/lib/types/functions/engineering/oct2bin/__tests__/index.spec.d.ts +16 -0
  158. package/lib/types/functions/engineering/oct2bin/index.d.ts +8 -0
  159. package/lib/types/functions/engineering/oct2dec/__tests__/index.spec.d.ts +16 -0
  160. package/lib/types/functions/engineering/oct2dec/index.d.ts +8 -0
  161. package/lib/types/functions/engineering/oct2hex/__tests__/index.spec.d.ts +16 -0
  162. package/lib/types/functions/engineering/oct2hex/index.d.ts +8 -0
  163. package/lib/types/functions/financial/accrint/__tests__/index.spec.d.ts +16 -0
  164. package/lib/types/functions/financial/accrint/index.d.ts +9 -0
  165. package/lib/types/functions/financial/accrintm/__tests__/index.spec.d.ts +16 -0
  166. package/lib/types/functions/financial/accrintm/index.d.ts +8 -0
  167. package/lib/types/functions/financial/amorlinc/__tests__/index.spec.d.ts +16 -0
  168. package/lib/types/functions/financial/amorlinc/index.d.ts +9 -0
  169. package/lib/types/functions/financial/coupdaybs/__tests__/index.spec.d.ts +16 -0
  170. package/lib/types/functions/financial/coupdaybs/index.d.ts +8 -0
  171. package/lib/types/functions/financial/coupdays/__tests__/index.spec.d.ts +16 -0
  172. package/lib/types/functions/financial/coupdays/index.d.ts +8 -0
  173. package/lib/types/functions/financial/coupdaysnc/__tests__/index.spec.d.ts +16 -0
  174. package/lib/types/functions/financial/coupdaysnc/index.d.ts +8 -0
  175. package/lib/types/functions/financial/coupncd/__tests__/index.spec.d.ts +16 -0
  176. package/lib/types/functions/financial/coupncd/index.d.ts +8 -0
  177. package/lib/types/functions/financial/coupnum/__tests__/index.spec.d.ts +16 -0
  178. package/lib/types/functions/financial/coupnum/index.d.ts +8 -0
  179. package/lib/types/functions/financial/couppcd/__tests__/index.spec.d.ts +16 -0
  180. package/lib/types/functions/financial/couppcd/index.d.ts +8 -0
  181. package/lib/types/functions/financial/cumipmt/__tests__/index.spec.d.ts +16 -0
  182. package/lib/types/functions/financial/cumipmt/index.d.ts +9 -0
  183. package/lib/types/functions/financial/cumprinc/__tests__/index.spec.d.ts +16 -0
  184. package/lib/types/functions/financial/cumprinc/index.d.ts +9 -0
  185. package/lib/types/functions/financial/db/__tests__/index.spec.d.ts +16 -0
  186. package/lib/types/functions/financial/db/index.d.ts +8 -0
  187. package/lib/types/functions/financial/ddb/__tests__/index.spec.d.ts +16 -0
  188. package/lib/types/functions/financial/ddb/index.d.ts +8 -0
  189. package/lib/types/functions/financial/disc/__tests__/index.spec.d.ts +16 -0
  190. package/lib/types/functions/financial/disc/index.d.ts +8 -0
  191. package/lib/types/functions/financial/dollarde/__tests__/index.spec.d.ts +16 -0
  192. package/lib/types/functions/financial/dollarde/index.d.ts +8 -0
  193. package/lib/types/functions/financial/dollarfr/__tests__/index.spec.d.ts +16 -0
  194. package/lib/types/functions/financial/dollarfr/index.d.ts +8 -0
  195. package/lib/types/functions/financial/effect/__tests__/index.spec.d.ts +16 -0
  196. package/lib/types/functions/financial/effect/index.d.ts +8 -0
  197. package/lib/types/functions/financial/function-map.d.ts +5 -16
  198. package/lib/types/functions/financial/fv/__tests__/index.spec.d.ts +16 -0
  199. package/lib/types/functions/financial/fv/index.d.ts +7 -0
  200. package/lib/types/functions/financial/fvschedule/__tests__/index.spec.d.ts +16 -0
  201. package/lib/types/functions/financial/fvschedule/index.d.ts +8 -0
  202. package/lib/types/functions/financial/intrate/__tests__/index.spec.d.ts +16 -0
  203. package/lib/types/functions/financial/intrate/index.d.ts +8 -0
  204. package/lib/types/functions/financial/ipmt/__tests__/index.spec.d.ts +16 -0
  205. package/lib/types/functions/financial/ipmt/index.d.ts +7 -0
  206. package/lib/types/functions/financial/ispmt/__tests__/index.spec.d.ts +16 -0
  207. package/lib/types/functions/financial/ispmt/index.d.ts +7 -0
  208. package/lib/types/functions/financial/nominal/__tests__/index.spec.d.ts +16 -0
  209. package/lib/types/functions/financial/nominal/index.d.ts +8 -0
  210. package/lib/types/functions/financial/nper/__tests__/index.spec.d.ts +16 -0
  211. package/lib/types/functions/financial/nper/index.d.ts +7 -0
  212. package/lib/types/functions/financial/pmt/__tests__/index.spec.d.ts +16 -0
  213. package/lib/types/functions/financial/pmt/index.d.ts +7 -0
  214. package/lib/types/functions/financial/ppmt/__tests__/index.spec.d.ts +16 -0
  215. package/lib/types/functions/financial/ppmt/index.d.ts +7 -0
  216. package/lib/types/functions/financial/pv/__tests__/index.spec.d.ts +16 -0
  217. package/lib/types/functions/financial/pv/index.d.ts +7 -0
  218. package/lib/types/functions/financial/rate/__tests__/index.spec.d.ts +16 -0
  219. package/lib/types/functions/financial/rate/index.d.ts +8 -0
  220. package/lib/types/functions/information/cell/index.d.ts +0 -1
  221. package/lib/types/functions/information/error-type/index.d.ts +0 -1
  222. package/lib/types/functions/information/function-map.d.ts +0 -1
  223. package/lib/types/functions/information/isblank/index.d.ts +0 -1
  224. package/lib/types/functions/information/iserr/index.d.ts +0 -1
  225. package/lib/types/functions/information/iserror/index.d.ts +0 -1
  226. package/lib/types/functions/information/iseven/iseven.d.ts +0 -1
  227. package/lib/types/functions/information/islogical/index.d.ts +0 -1
  228. package/lib/types/functions/information/isna/index.d.ts +0 -1
  229. package/lib/types/functions/information/isnontext/index.d.ts +0 -1
  230. package/lib/types/functions/information/isnumber/index.d.ts +0 -1
  231. package/lib/types/functions/information/isodd/isodd.d.ts +0 -1
  232. package/lib/types/functions/information/isref/index.d.ts +0 -1
  233. package/lib/types/functions/information/istext/index.d.ts +0 -1
  234. package/lib/types/functions/information/type/index.d.ts +0 -1
  235. package/lib/types/functions/logical/and/index.d.ts +0 -1
  236. package/lib/types/functions/logical/false/index.d.ts +0 -1
  237. package/lib/types/functions/logical/function-map.d.ts +0 -1
  238. package/lib/types/functions/logical/if/index.d.ts +0 -1
  239. package/lib/types/functions/logical/iferror/index.d.ts +0 -1
  240. package/lib/types/functions/logical/ifna/index.d.ts +0 -1
  241. package/lib/types/functions/logical/ifs/index.d.ts +0 -1
  242. package/lib/types/functions/logical/lambda/index.d.ts +0 -1
  243. package/lib/types/functions/logical/let/index.d.ts +10 -0
  244. package/lib/types/functions/logical/makearray/index.d.ts +0 -1
  245. package/lib/types/functions/logical/not/index.d.ts +2 -2
  246. package/lib/types/functions/logical/or/index.d.ts +0 -1
  247. package/lib/types/functions/logical/switch/index.d.ts +0 -1
  248. package/lib/types/functions/logical/true/index.d.ts +0 -1
  249. package/lib/types/functions/logical/xor/index.d.ts +0 -1
  250. package/lib/types/functions/lookup/address/index.d.ts +0 -1
  251. package/lib/types/functions/lookup/areas/index.d.ts +0 -1
  252. package/lib/types/functions/lookup/choose/index.d.ts +0 -1
  253. package/lib/types/functions/lookup/choosecols/index.d.ts +0 -1
  254. package/lib/types/functions/lookup/chooserows/index.d.ts +0 -1
  255. package/lib/types/functions/lookup/column/index.d.ts +0 -1
  256. package/lib/types/functions/lookup/columns/index.d.ts +0 -1
  257. package/lib/types/functions/lookup/filter/index.d.ts +0 -1
  258. package/lib/types/functions/lookup/function-map.d.ts +0 -1
  259. package/lib/types/functions/lookup/hlookup/index.d.ts +0 -1
  260. package/lib/types/functions/lookup/hstack/index.d.ts +0 -1
  261. package/lib/types/functions/lookup/index/index.d.ts +0 -1
  262. package/lib/types/functions/lookup/indirect/index.d.ts +0 -1
  263. package/lib/types/functions/lookup/lookup/index.d.ts +0 -1
  264. package/lib/types/functions/lookup/match/index.d.ts +0 -1
  265. package/lib/types/functions/lookup/offset/index.d.ts +0 -1
  266. package/lib/types/functions/lookup/row/index.d.ts +0 -1
  267. package/lib/types/functions/lookup/rows/index.d.ts +0 -1
  268. package/lib/types/functions/lookup/sort/index.d.ts +0 -1
  269. package/lib/types/functions/lookup/sortby/index.d.ts +0 -1
  270. package/lib/types/functions/lookup/transpose/index.d.ts +0 -1
  271. package/lib/types/functions/lookup/unique/index.d.ts +0 -1
  272. package/lib/types/functions/lookup/vlookup/index.d.ts +0 -1
  273. package/lib/types/functions/lookup/vstack/index.d.ts +0 -1
  274. package/lib/types/functions/lookup/xlookup/index.d.ts +0 -1
  275. package/lib/types/functions/lookup/xmatch/index.d.ts +0 -1
  276. package/lib/types/functions/math/abs/index.d.ts +0 -1
  277. package/lib/types/functions/math/acos/index.d.ts +0 -1
  278. package/lib/types/functions/math/acosh/index.d.ts +0 -1
  279. package/lib/types/functions/math/acot/index.d.ts +0 -1
  280. package/lib/types/functions/math/acoth/index.d.ts +0 -1
  281. package/lib/types/functions/math/asin/index.d.ts +0 -1
  282. package/lib/types/functions/math/asinh/index.d.ts +0 -1
  283. package/lib/types/functions/math/atan/index.d.ts +0 -1
  284. package/lib/types/functions/math/atan2/index.d.ts +0 -1
  285. package/lib/types/functions/math/atanh/index.d.ts +0 -1
  286. package/lib/types/functions/math/base/index.d.ts +0 -1
  287. package/lib/types/functions/math/ceiling/index.d.ts +0 -1
  288. package/lib/types/functions/math/ceiling-math/index.d.ts +0 -1
  289. package/lib/types/functions/math/ceiling-precise/index.d.ts +0 -1
  290. package/lib/types/functions/math/cos/index.d.ts +0 -1
  291. package/lib/types/functions/math/cosh/index.d.ts +0 -1
  292. package/lib/types/functions/math/cot/index.d.ts +0 -1
  293. package/lib/types/functions/math/coth/index.d.ts +0 -1
  294. package/lib/types/functions/math/csc/index.d.ts +0 -1
  295. package/lib/types/functions/math/csch/index.d.ts +0 -1
  296. package/lib/types/functions/math/decimal/index.d.ts +0 -1
  297. package/lib/types/functions/math/degrees/index.d.ts +0 -1
  298. package/lib/types/functions/math/even/index.d.ts +0 -1
  299. package/lib/types/functions/math/exp/index.d.ts +0 -1
  300. package/lib/types/functions/math/floor/index.d.ts +0 -1
  301. package/lib/types/functions/math/floor-math/index.d.ts +0 -1
  302. package/lib/types/functions/math/floor-precise/index.d.ts +0 -1
  303. package/lib/types/functions/math/function-map.d.ts +0 -1
  304. package/lib/types/functions/math/ln/index.d.ts +0 -1
  305. package/lib/types/functions/math/log/index.d.ts +0 -1
  306. package/lib/types/functions/math/log10/index.d.ts +0 -1
  307. package/lib/types/functions/math/mod/index.d.ts +0 -1
  308. package/lib/types/functions/math/mround/index.d.ts +0 -1
  309. package/lib/types/functions/math/odd/index.d.ts +0 -1
  310. package/lib/types/functions/math/pi/index.d.ts +0 -1
  311. package/lib/types/functions/math/power/index.d.ts +0 -1
  312. package/lib/types/functions/math/product/index.d.ts +0 -1
  313. package/lib/types/functions/math/radians/index.d.ts +0 -1
  314. package/lib/types/functions/math/rand/index.d.ts +0 -1
  315. package/lib/types/functions/math/randarray/index.d.ts +0 -1
  316. package/lib/types/functions/math/randbetween/index.d.ts +0 -1
  317. package/lib/types/functions/math/round/index.d.ts +0 -1
  318. package/lib/types/functions/math/rounddown/index.d.ts +0 -1
  319. package/lib/types/functions/math/roundup/index.d.ts +0 -1
  320. package/lib/types/functions/math/sec/index.d.ts +0 -1
  321. package/lib/types/functions/math/sech/index.d.ts +0 -1
  322. package/lib/types/functions/math/sin/index.d.ts +0 -1
  323. package/lib/types/functions/math/sinh/index.d.ts +0 -1
  324. package/lib/types/functions/math/sqrt/index.d.ts +0 -1
  325. package/lib/types/functions/math/sqrtpi/index.d.ts +0 -1
  326. package/lib/types/functions/math/subtotal/index.d.ts +0 -1
  327. package/lib/types/functions/math/sum/index.d.ts +0 -1
  328. package/lib/types/functions/math/sumif/index.d.ts +0 -1
  329. package/lib/types/functions/math/sumifs/index.d.ts +0 -1
  330. package/lib/types/functions/math/sumproduct/index.d.ts +0 -1
  331. package/lib/types/functions/math/sumsq/index.d.ts +0 -1
  332. package/lib/types/functions/math/sumx2my2/index.d.ts +0 -1
  333. package/lib/types/functions/math/sumx2py2/index.d.ts +0 -1
  334. package/lib/types/functions/math/sumxmy2/index.d.ts +0 -1
  335. package/lib/types/functions/math/tan/index.d.ts +0 -1
  336. package/lib/types/functions/math/tanh/index.d.ts +0 -1
  337. package/lib/types/functions/math/trunc/index.d.ts +0 -1
  338. package/lib/types/functions/meta/compare/index.d.ts +0 -1
  339. package/lib/types/functions/meta/cube/index.d.ts +0 -1
  340. package/lib/types/functions/meta/divided/index.d.ts +0 -1
  341. package/lib/types/functions/meta/function-map.d.ts +0 -1
  342. package/lib/types/functions/meta/minus/index.d.ts +0 -1
  343. package/lib/types/functions/meta/multiply/index.d.ts +0 -1
  344. package/lib/types/functions/meta/plus/index.d.ts +0 -1
  345. package/lib/types/functions/statistical/avedev/index.d.ts +0 -1
  346. package/lib/types/functions/statistical/average/index.d.ts +0 -1
  347. package/lib/types/functions/statistical/averagea/index.d.ts +0 -1
  348. package/lib/types/functions/statistical/averageif/index.d.ts +0 -1
  349. package/lib/types/functions/statistical/averageifs/index.d.ts +0 -1
  350. package/lib/types/functions/statistical/count/index.d.ts +0 -1
  351. package/lib/types/functions/statistical/counta/index.d.ts +0 -1
  352. package/lib/types/functions/statistical/countblank/index.d.ts +0 -1
  353. package/lib/types/functions/statistical/countif/index.d.ts +0 -1
  354. package/lib/types/functions/statistical/countifs/index.d.ts +0 -1
  355. package/lib/types/functions/statistical/function-map.d.ts +0 -1
  356. package/lib/types/functions/statistical/max/index.d.ts +0 -1
  357. package/lib/types/functions/statistical/maxa/index.d.ts +0 -1
  358. package/lib/types/functions/statistical/maxifs/index.d.ts +0 -1
  359. package/lib/types/functions/statistical/min/index.d.ts +0 -1
  360. package/lib/types/functions/statistical/mina/index.d.ts +0 -1
  361. package/lib/types/functions/statistical/minifs/index.d.ts +0 -1
  362. package/lib/types/functions/statistical/stdev-p/index.d.ts +0 -1
  363. package/lib/types/functions/statistical/stdev-s/index.d.ts +0 -1
  364. package/lib/types/functions/statistical/stdeva/index.d.ts +0 -1
  365. package/lib/types/functions/statistical/stdevpa/index.d.ts +0 -1
  366. package/lib/types/functions/statistical/var-p/index.d.ts +0 -1
  367. package/lib/types/functions/statistical/var-s/index.d.ts +0 -1
  368. package/lib/types/functions/statistical/vara/index.d.ts +0 -1
  369. package/lib/types/functions/statistical/varpa/index.d.ts +0 -1
  370. package/lib/types/functions/text/concat/index.d.ts +0 -1
  371. package/lib/types/functions/text/concatenate/index.d.ts +0 -1
  372. package/lib/types/functions/text/function-map.d.ts +0 -1
  373. package/lib/types/functions/text/len/index.d.ts +0 -1
  374. package/lib/types/functions/text/lenb/index.d.ts +0 -1
  375. package/lib/types/functions/text/lower/index.d.ts +0 -1
  376. package/lib/types/functions/text/rept/index.d.ts +0 -1
  377. package/lib/types/functions/text/text/index.d.ts +0 -1
  378. package/lib/types/functions/text/textafter/index.d.ts +0 -1
  379. package/lib/types/functions/text/textbefore/index.d.ts +0 -1
  380. package/lib/types/functions/text/textsplit/index.d.ts +0 -1
  381. package/lib/types/models/__tests__/create-command-test-bed.d.ts +0 -1
  382. package/lib/types/models/formula-data.model.d.ts +0 -1
  383. package/lib/types/models/utils/formula-data-util.d.ts +0 -1
  384. package/lib/types/plugin.d.ts +0 -1
  385. package/lib/types/services/active-dirty-manager.service.d.ts +0 -1
  386. package/lib/types/services/calculate-formula.service.d.ts +0 -1
  387. package/lib/types/services/current-data.service.d.ts +0 -1
  388. package/lib/types/services/defined-names.service.d.ts +0 -1
  389. package/lib/types/services/dependency-manager.service.d.ts +0 -1
  390. package/lib/types/services/feature-calculation-manager.service.d.ts +0 -1
  391. package/lib/types/services/function.service.d.ts +0 -1
  392. package/lib/types/services/other-formula-manager.service.d.ts +0 -1
  393. package/lib/types/services/runtime.service.d.ts +1 -1
  394. package/lib/types/services/super-table.service.d.ts +0 -1
  395. package/lib/umd/index.js +1 -1
  396. package/package.json +7 -9
package/lib/es/index.js CHANGED
@@ -4215,7 +4215,7 @@ const _ArrayValueObject = class _ArrayValueObject extends BaseValueObject {
4215
4215
  column + startColumn,
4216
4216
  currentValue.getErrorType(),
4217
4217
  r + startRow
4218
- ) : currentValue.isNull() ? CELL_INVERTED_INDEX_CACHE.set(unitId, sheetId, column + startColumn, "", r + startRow) : CELL_INVERTED_INDEX_CACHE.set(
4218
+ ) : CELL_INVERTED_INDEX_CACHE.set(
4219
4219
  unitId,
4220
4220
  sheetId,
4221
4221
  column + startColumn,
@@ -4361,6 +4361,19 @@ function getCellValue(cell) {
4361
4361
  return (cell == null ? void 0 : cell.v) || 0;
4362
4362
  }
4363
4363
  __name(getCellValue, "getCellValue");
4364
+ function getRuntimeFeatureCell(row, column, sheetId, unitId, runtimeFeatureCellData) {
4365
+ var _a24;
4366
+ const featureKeys = Object.keys(runtimeFeatureCellData);
4367
+ for (const featureId of featureKeys) {
4368
+ const data = runtimeFeatureCellData[featureId], CellData = (_a24 = data == null ? void 0 : data[unitId]) == null ? void 0 : _a24[sheetId];
4369
+ if (CellData == null)
4370
+ continue;
4371
+ const value = CellData.getValue(row, column);
4372
+ if (value != null)
4373
+ return value;
4374
+ }
4375
+ }
4376
+ __name(getRuntimeFeatureCell, "getRuntimeFeatureCell");
4364
4377
  const FORMULA_CACHE_LRU_COUNT$1 = 1e5, FORMULA_REF_TO_ARRAY_CACHE = new FormulaAstLRU(FORMULA_CACHE_LRU_COUNT$1), _BaseReferenceObject = class _BaseReferenceObject extends ObjectClassType {
4365
4378
  constructor(_token) {
4366
4379
  super();
@@ -4635,16 +4648,7 @@ const FORMULA_CACHE_LRU_COUNT$1 = 1e5, FORMULA_REF_TO_ARRAY_CACHE = new FormulaA
4635
4648
  return (activeRuntimeData == null ? void 0 : activeRuntimeData.getValue(row, column)) || (activeRuntimeArrayFormulaCellData == null ? void 0 : activeRuntimeArrayFormulaCellData.getValue(row, column)) || this.getRuntimeFeatureCellValue(row, column) || (activeArrayFormulaCellData == null ? void 0 : activeArrayFormulaCellData.getValue(row, column)) || (activeSheetData == null ? void 0 : activeSheetData.cellData.getValue(row, column));
4636
4649
  }
4637
4650
  getRuntimeFeatureCellValue(row, column) {
4638
- var _a24;
4639
- const featureKeys = Object.keys(this._runtimeFeatureCellData);
4640
- for (const featureId of featureKeys) {
4641
- const data = this._runtimeFeatureCellData[featureId], runtimeFeatureCellData = (_a24 = data == null ? void 0 : data[this.getUnitId()]) == null ? void 0 : _a24[this.getSheetId()];
4642
- if (runtimeFeatureCellData == null)
4643
- continue;
4644
- const value = runtimeFeatureCellData.getValue(row, column);
4645
- if (value != null)
4646
- return value;
4647
- }
4651
+ return getRuntimeFeatureCell(row, column, this.getSheetId(), this.getUnitId(), this._runtimeFeatureCellData);
4648
4652
  }
4649
4653
  getCellByPosition(row, column) {
4650
4654
  row || (row = this._rangeData.startRow), column || (column = this._rangeData.startColumn);
@@ -5609,6 +5613,72 @@ function getWeekDayByDateSerialNumber(dateSerialNumber) {
5609
5613
  return !isDate19000229 && dateTime <= leapDayDateTime && (date = new Date(dateTime - 24 * 3600 * 1e3)), new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate())).getUTCDay();
5610
5614
  }
5611
5615
  __name(getWeekDayByDateSerialNumber, "getWeekDayByDateSerialNumber");
5616
+ function getTwoDateDaysByBasis(startDateSerialNumber, endDateSerialNumber, basis) {
5617
+ switch (basis) {
5618
+ case 0:
5619
+ return getDaysByNASD(startDateSerialNumber, endDateSerialNumber);
5620
+ case 1:
5621
+ return getDaysByActual(startDateSerialNumber, endDateSerialNumber);
5622
+ case 2:
5623
+ return {
5624
+ days: Math.abs(endDateSerialNumber - startDateSerialNumber),
5625
+ yearDays: 360
5626
+ };
5627
+ case 3:
5628
+ return {
5629
+ days: Math.abs(endDateSerialNumber - startDateSerialNumber),
5630
+ yearDays: 365
5631
+ };
5632
+ case 4:
5633
+ return getDaysByEuropean(startDateSerialNumber, endDateSerialNumber);
5634
+ default:
5635
+ return {
5636
+ days: Math.abs(endDateSerialNumber - startDateSerialNumber),
5637
+ yearDays: 365
5638
+ };
5639
+ }
5640
+ }
5641
+ __name(getTwoDateDaysByBasis, "getTwoDateDaysByBasis");
5642
+ function getDaysByNASD(startDateSerialNumber, endDateSerialNumber) {
5643
+ const startDateDate = excelSerialToDate(startDateSerialNumber), startYear = startDateSerialNumber > 0 ? startDateDate.getUTCFullYear() : 1900, startMonth = startDateSerialNumber > 0 ? startDateDate.getUTCMonth() + 1 : 1;
5644
+ let startDay = startDateSerialNumber > 0 ? startDateDate.getUTCDate() : 0, endDateDate = excelSerialToDate(endDateSerialNumber), endYear = endDateSerialNumber > 0 ? endDateDate.getUTCFullYear() : 1900, endMonth = endDateSerialNumber > 0 ? endDateDate.getUTCMonth() + 1 : 1, endDay = endDateSerialNumber > 0 ? endDateDate.getUTCDate() : 0;
5645
+ startMonth === 2 ? excelSerialToDate(startDateSerialNumber + 1).getUTCMonth() + 1 === 3 && (startDay = 30) : startDay === 31 && (startDay = 30), endDay === 31 && (startDay < 30 ? (endDateDate = excelSerialToDate(endDateSerialNumber + 1), endYear = endDateDate.getUTCFullYear(), endMonth = endDateDate.getUTCMonth() + 1, endDay = endDateDate.getUTCDate()) : endDay = 30);
5646
+ const daysInYears = (endYear - startYear) * 360, daysInStartMonth = endDateSerialNumber >= startDateSerialNumber ? 30 - startDay : -startDay, daysInEndMonth = endDateSerialNumber >= startDateSerialNumber ? endDay : endDay - 30, daysInMidMonths = (endDateSerialNumber >= startDateSerialNumber ? endMonth - startMonth - 1 : endMonth - startMonth + 1) * 30;
5647
+ return {
5648
+ days: Math.abs(daysInYears + daysInStartMonth + daysInEndMonth + daysInMidMonths),
5649
+ yearDays: 360
5650
+ };
5651
+ }
5652
+ __name(getDaysByNASD, "getDaysByNASD");
5653
+ function getDaysByActual(startDateSerialNumber, endDateSerialNumber) {
5654
+ const startDateDate = excelSerialToDate(startDateSerialNumber), startYear = startDateSerialNumber > 0 ? startDateDate.getUTCFullYear() : 1900, endDateDate = excelSerialToDate(endDateSerialNumber), endYear = endDateSerialNumber > 0 ? endDateDate.getUTCFullYear() : 1900, totalDays = Math.abs(endDateSerialNumber - startDateSerialNumber), totalYear = Math.abs(endYear - startYear) + 1;
5655
+ let startYearFirstDaySerialNumber, endYearLastDaySerialNumber;
5656
+ if (endYear < startYear) {
5657
+ const startYearFirstDay = new Date(Date.UTC(endYear, 0, 1)), endYearLastDay = new Date(Date.UTC(startYear, 11, 31));
5658
+ startYearFirstDaySerialNumber = excelDateSerial(startYearFirstDay), endYearLastDaySerialNumber = excelDateSerial(endYearLastDay), endYear === 1900 && (startYearFirstDaySerialNumber += 1);
5659
+ } else {
5660
+ const startYearFirstDay = new Date(Date.UTC(startYear, 0, 1)), endYearLastDay = new Date(Date.UTC(endYear, 11, 31));
5661
+ startYearFirstDaySerialNumber = excelDateSerial(startYearFirstDay), endYearLastDaySerialNumber = excelDateSerial(endYearLastDay), startYear === 1900 && (startYearFirstDaySerialNumber += 1);
5662
+ }
5663
+ return {
5664
+ days: totalDays,
5665
+ yearDays: (endYearLastDaySerialNumber - startYearFirstDaySerialNumber + 1) / totalYear
5666
+ };
5667
+ }
5668
+ __name(getDaysByActual, "getDaysByActual");
5669
+ function getDaysByEuropean(startDateSerialNumber, endDateSerialNumber) {
5670
+ const startDateDate = excelSerialToDate(startDateSerialNumber), startYear = startDateSerialNumber > 0 ? startDateDate.getUTCFullYear() : 1900, startMonth = startDateSerialNumber > 0 ? startDateDate.getUTCMonth() + 1 : 1;
5671
+ let startDay = startDateSerialNumber > 0 ? startDateDate.getUTCDate() : 0;
5672
+ const endDateDate = excelSerialToDate(endDateSerialNumber), endYear = endDateSerialNumber > 0 ? endDateDate.getUTCFullYear() : 1900, endMonth = endDateSerialNumber > 0 ? endDateDate.getUTCMonth() + 1 : 1;
5673
+ let endDay = endDateSerialNumber > 0 ? endDateDate.getUTCDate() : 0;
5674
+ startDay === 31 && (startDay = 30), endDay === 31 && (endDay = 30);
5675
+ const daysInYears = (endYear - startYear) * 360, daysInStartMonth = endDateSerialNumber >= startDateSerialNumber ? 30 - startDay : -startDay, daysInEndMonth = endDateSerialNumber >= startDateSerialNumber ? endDay : endDay - 30, daysInMidMonths = (endDateSerialNumber >= startDateSerialNumber ? endMonth - startMonth - 1 : endMonth - startMonth + 1) * 30;
5676
+ return {
5677
+ days: Math.abs(daysInYears + daysInStartMonth + daysInEndMonth + daysInMidMonths),
5678
+ yearDays: 360
5679
+ };
5680
+ }
5681
+ __name(getDaysByEuropean, "getDaysByEuropean");
5612
5682
  const _DateFunction = class _DateFunction extends BaseFunction {
5613
5683
  constructor() {
5614
5684
  super(...arguments);
@@ -5819,17 +5889,15 @@ const _Days360 = class _Days360 extends BaseFunction {
5819
5889
  if (endDateObject.isError())
5820
5890
  return endDateObject;
5821
5891
  const endDateSerialNumber = getDateSerialNumberByObject(endDateObject);
5822
- return typeof endDateSerialNumber != "number" ? endDateSerialNumber : (methodObject.isString() && (methodObject = methodObject.convertToNumberObjectValue()), methodObject.isError() ? methodObject : this._getResult(startDateSerialNumber, endDateSerialNumber, methodObject));
5892
+ if (typeof endDateSerialNumber != "number")
5893
+ return endDateSerialNumber;
5894
+ if (methodObject.isString() && (methodObject = methodObject.convertToNumberObjectValue()), methodObject.isError())
5895
+ return methodObject;
5896
+ const methodValue = +methodObject.getValue(), { days } = getTwoDateDaysByBasis(startDateSerialNumber, endDateSerialNumber, methodValue ? 4 : 0), result = endDateSerialNumber >= startDateSerialNumber ? days : -days;
5897
+ return NumberValueObject.create(result);
5823
5898
  });
5824
5899
  return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
5825
5900
  }
5826
- _getResult(startDateSerialNumber, endDateSerialNumber, methodObject) {
5827
- const startDateDate = excelSerialToDate(startDateSerialNumber), startYear = startDateSerialNumber > 0 ? startDateDate.getUTCFullYear() : 1900, startMonth = startDateSerialNumber > 0 ? startDateDate.getUTCMonth() + 1 : 1;
5828
- let startDay = startDateSerialNumber > 0 ? startDateDate.getUTCDate() : 0, endDateDate = excelSerialToDate(endDateSerialNumber), endYear = endDateSerialNumber > 0 ? endDateDate.getUTCFullYear() : 1900, endMonth = endDateSerialNumber > 0 ? endDateDate.getUTCMonth() + 1 : 1, endDay = endDateSerialNumber > 0 ? endDateDate.getUTCDate() : 0;
5829
- +methodObject.getValue() ? (startDay === 31 && (startDay = 30), endDay === 31 && (endDay = 30)) : (startDay === 31 && (startDay = 30), endDay === 31 && (startDay < 30 ? (endDateDate = excelSerialToDate(endDateSerialNumber + 1), endYear = endDateDate.getUTCFullYear(), endMonth = endDateDate.getUTCMonth() + 1, endDay = endDateDate.getUTCDate()) : endDay = 30));
5830
- const daysInYears = (endYear - startYear) * 360, daysInStartMonth = endDateSerialNumber >= startDateSerialNumber ? 30 - startDay : -startDay, daysInEndMonth = endDateSerialNumber >= startDateSerialNumber ? endDay : endDay - 30, daysInMidMonths = (endDateSerialNumber >= startDateSerialNumber ? endMonth - startMonth - 1 : endMonth - startMonth + 1) * 30, totalDays = daysInYears + daysInStartMonth + daysInEndMonth + daysInMidMonths;
5831
- return NumberValueObject.create(totalDays);
5832
- }
5833
5901
  };
5834
5902
  __name(_Days360, "Days360");
5835
5903
  let Days360 = _Days360;
@@ -6449,228 +6517,2593 @@ const _Workday = class _Workday extends BaseFunction {
6449
6517
  return typeof result != "number" ? result : NumberValueObject.create(result);
6450
6518
  }
6451
6519
  };
6452
- __name(_Workday, "Workday");
6453
- let Workday = _Workday;
6454
- const _WorkdayIntl = class _WorkdayIntl extends BaseFunction {
6520
+ __name(_Workday, "Workday");
6521
+ let Workday = _Workday;
6522
+ const _WorkdayIntl = class _WorkdayIntl extends BaseFunction {
6523
+ constructor() {
6524
+ super(...arguments);
6525
+ __publicField(this, "minParams", 2);
6526
+ __publicField(this, "maxParams", 4);
6527
+ }
6528
+ calculate(startDate, days, weekend, holidays) {
6529
+ return startDate.isError() ? startDate : days.isError() ? days : weekend != null && weekend.isError() ? weekend : holidays != null && holidays.isError() ? holidays : weekend != null && weekend.isArray() ? weekend.map((weekendItem) => this._handleSingleObject(startDate, days, weekendItem, holidays)) : this._handleSingleObject(startDate, days, weekend, holidays);
6530
+ }
6531
+ _handleSingleObject(startDate, days, weekend, holidays) {
6532
+ const _weekend = weekend != null ? weekend : NumberValueObject.create(1), _startDate = this._checkArrayError(startDate);
6533
+ if (_startDate.isError())
6534
+ return _startDate;
6535
+ const _days = this._checkArrayError(days);
6536
+ if (_days.isError())
6537
+ return _days;
6538
+ if (_startDate.isBoolean() || _days.isBoolean())
6539
+ return ErrorValueObject.create(ErrorType$1.VALUE);
6540
+ const startDateSerialNumber = getDateSerialNumberByObject(startDate);
6541
+ if (typeof startDateSerialNumber != "number")
6542
+ return startDateSerialNumber;
6543
+ const workingDays = +days.getValue();
6544
+ if (Number.isNaN(workingDays))
6545
+ return ErrorValueObject.create(ErrorType$1.VALUE);
6546
+ let weekendValue = _weekend.getValue();
6547
+ if (_weekend.isBoolean() && (weekendValue = +weekendValue), _weekend.isString() && (!isValidWeekend(weekendValue) || weekendValue === "1111111"))
6548
+ return ErrorValueObject.create(ErrorType$1.VALUE);
6549
+ if (!isValidWeekend(weekendValue))
6550
+ return ErrorValueObject.create(ErrorType$1.NUM);
6551
+ if (holidays)
6552
+ return this._getResultByHolidays(startDateSerialNumber, workingDays, weekendValue, holidays);
6553
+ const result = getDateSerialNumberByWorkingDays(startDateSerialNumber, workingDays, weekendValue);
6554
+ return typeof result != "number" ? result : NumberValueObject.create(result);
6555
+ }
6556
+ _checkArrayError(variant) {
6557
+ let _variant = variant;
6558
+ if (_variant.isArray()) {
6559
+ const rowCount = _variant.getRowCount(), columnCount = _variant.getColumnCount();
6560
+ if (rowCount > 1 || columnCount > 1)
6561
+ return ErrorValueObject.create(ErrorType$1.VALUE);
6562
+ _variant = _variant.get(0, 0);
6563
+ }
6564
+ return _variant.isError(), _variant;
6565
+ }
6566
+ _getResultByHolidays(startDateSerialNumber, workingDays, weekendValue, holidays) {
6567
+ const holidaysValueArray = [];
6568
+ if (holidays != null && holidays.isArray()) {
6569
+ const rowCount = holidays.getRowCount(), columnCount = holidays.getColumnCount();
6570
+ for (let r = 0; r < rowCount; r++)
6571
+ for (let c = 0; c < columnCount; c++) {
6572
+ const cell = holidays.get(r, c);
6573
+ if (cell.isBoolean())
6574
+ return ErrorValueObject.create(ErrorType$1.VALUE);
6575
+ const holidaySerialNumber = getDateSerialNumberByObject(cell);
6576
+ if (typeof holidaySerialNumber != "number")
6577
+ return holidaySerialNumber;
6578
+ holidaysValueArray.push(holidaySerialNumber);
6579
+ }
6580
+ } else {
6581
+ if (holidays.isBoolean())
6582
+ return ErrorValueObject.create(ErrorType$1.VALUE);
6583
+ const holidaySerialNumber = getDateSerialNumberByObject(holidays);
6584
+ if (typeof holidaySerialNumber != "number")
6585
+ return holidaySerialNumber;
6586
+ holidaysValueArray.push(holidaySerialNumber);
6587
+ }
6588
+ const result = getDateSerialNumberByWorkingDays(startDateSerialNumber, workingDays, weekendValue, holidaysValueArray);
6589
+ return typeof result != "number" ? result : NumberValueObject.create(result);
6590
+ }
6591
+ };
6592
+ __name(_WorkdayIntl, "WorkdayIntl");
6593
+ let WorkdayIntl = _WorkdayIntl;
6594
+ const _Year = class _Year extends BaseFunction {
6595
+ constructor() {
6596
+ super(...arguments);
6597
+ __publicField(this, "minParams", 1);
6598
+ __publicField(this, "maxParams", 1);
6599
+ }
6600
+ calculate(serialNumber) {
6601
+ return serialNumber.isArray() ? serialNumber.map((serialNumberObject) => this._handleSingleObject(serialNumberObject)) : this._handleSingleObject(serialNumber);
6602
+ }
6603
+ _handleSingleObject(serialNumberObject) {
6604
+ if (serialNumberObject.isError())
6605
+ return serialNumberObject;
6606
+ let date;
6607
+ const dateValue = serialNumberObject.getValue();
6608
+ if (serialNumberObject.isString()) {
6609
+ if (!isValidDateStr(`${dateValue}`))
6610
+ return ErrorValueObject.create(ErrorType$1.VALUE);
6611
+ date = /* @__PURE__ */ new Date(`${dateValue}`);
6612
+ } else {
6613
+ const dateSerial = +dateValue;
6614
+ if (dateSerial < 0)
6615
+ return ErrorValueObject.create(ErrorType$1.NUM);
6616
+ if (dateSerial === 0)
6617
+ return NumberValueObject.create(1900);
6618
+ date = excelSerialToDate(dateSerial);
6619
+ }
6620
+ const year = date.getUTCFullYear();
6621
+ return NumberValueObject.create(year);
6622
+ }
6623
+ };
6624
+ __name(_Year, "Year");
6625
+ let Year = _Year;
6626
+ function checkVariantErrorIsArray(variant) {
6627
+ let _variant = variant;
6628
+ if (variant.isArray()) {
6629
+ const rowCount = variant.getRowCount(), columnCount = variant.getColumnCount();
6630
+ if (rowCount > 1 || columnCount > 1)
6631
+ return ErrorValueObject.create(ErrorType$1.VALUE);
6632
+ _variant = variant.get(0, 0);
6633
+ }
6634
+ return _variant.isError(), _variant;
6635
+ }
6636
+ __name(checkVariantErrorIsArray, "checkVariantErrorIsArray");
6637
+ function checkVariantsErrorIsArrayOrBoolean(...variants) {
6638
+ for (let i = 0; i < variants.length; i++) {
6639
+ const variant = checkVariantErrorIsArray(variants[i]);
6640
+ if (variant.isError())
6641
+ return {
6642
+ isError: !0,
6643
+ errorObject: variant
6644
+ };
6645
+ if (variant.isBoolean())
6646
+ return {
6647
+ isError: !0,
6648
+ errorObject: ErrorValueObject.create(ErrorType$1.VALUE)
6649
+ };
6650
+ variants[i] = variant;
6651
+ }
6652
+ return {
6653
+ isError: !1,
6654
+ variants
6655
+ };
6656
+ }
6657
+ __name(checkVariantsErrorIsArrayOrBoolean, "checkVariantsErrorIsArrayOrBoolean");
6658
+ function checkVariantsErrorIsStringToNumber(...variants) {
6659
+ for (let i = 0; i < variants.length; i++) {
6660
+ let variant = variants[i];
6661
+ if (variant.isString() && (variant = variant.convertToNumberObjectValue()), variant.isError())
6662
+ return {
6663
+ isError: !0,
6664
+ errorObject: variant
6665
+ };
6666
+ variants[i] = variant;
6667
+ }
6668
+ return {
6669
+ isError: !1,
6670
+ variants
6671
+ };
6672
+ }
6673
+ __name(checkVariantsErrorIsStringToNumber, "checkVariantsErrorIsStringToNumber");
6674
+ const _Yearfrac = class _Yearfrac extends BaseFunction {
6675
+ constructor() {
6676
+ super(...arguments);
6677
+ __publicField(this, "minParams", 2);
6678
+ __publicField(this, "maxParams", 3);
6679
+ }
6680
+ calculate(startDate, endDate, basis) {
6681
+ let _basis = basis != null ? basis : NumberValueObject.create(0);
6682
+ const _startDate = checkVariantErrorIsArray(startDate);
6683
+ if (_startDate.isError())
6684
+ return _startDate;
6685
+ const _endDate = checkVariantErrorIsArray(endDate);
6686
+ if (_endDate.isError())
6687
+ return _endDate;
6688
+ if (_basis = checkVariantErrorIsArray(_basis), _basis.isError())
6689
+ return _basis;
6690
+ if (_startDate.isBoolean() || _endDate.isBoolean() || _basis.isBoolean())
6691
+ return ErrorValueObject.create(ErrorType$1.VALUE);
6692
+ const startDateSerialNumber = getDateSerialNumberByObject(_startDate);
6693
+ if (typeof startDateSerialNumber != "number")
6694
+ return startDateSerialNumber;
6695
+ const endDateSerialNumber = getDateSerialNumberByObject(_endDate);
6696
+ if (typeof endDateSerialNumber != "number")
6697
+ return endDateSerialNumber;
6698
+ const basisValue = Math.floor(+_basis.getValue());
6699
+ if (Number.isNaN(basisValue))
6700
+ return ErrorValueObject.create(ErrorType$1.VALUE);
6701
+ if (basisValue < 0 || basisValue > 4)
6702
+ return ErrorValueObject.create(ErrorType$1.NUM);
6703
+ const { days, yearDays } = getTwoDateDaysByBasis(startDateSerialNumber, endDateSerialNumber, basisValue), result = days / yearDays;
6704
+ return NumberValueObject.create(result);
6705
+ }
6706
+ };
6707
+ __name(_Yearfrac, "Yearfrac");
6708
+ let Yearfrac = _Yearfrac;
6709
+ const functionDate = [
6710
+ [DateFunction, FUNCTION_NAMES_DATE.DATE],
6711
+ [Datedif, FUNCTION_NAMES_DATE.DATEDIF],
6712
+ [Datevalue, FUNCTION_NAMES_DATE.DATEVALUE],
6713
+ [Day, FUNCTION_NAMES_DATE.DAY],
6714
+ [Days, FUNCTION_NAMES_DATE.DAYS],
6715
+ [Days360, FUNCTION_NAMES_DATE.DAYS360],
6716
+ [Edate, FUNCTION_NAMES_DATE.EDATE],
6717
+ [Eomonth, FUNCTION_NAMES_DATE.EOMONTH],
6718
+ [Hour, FUNCTION_NAMES_DATE.HOUR],
6719
+ [Isoweeknum, FUNCTION_NAMES_DATE.ISOWEEKNUM],
6720
+ [Minute, FUNCTION_NAMES_DATE.MINUTE],
6721
+ [Month, FUNCTION_NAMES_DATE.MONTH],
6722
+ [Networkdays, FUNCTION_NAMES_DATE.NETWORKDAYS],
6723
+ [NetworkdaysIntl, FUNCTION_NAMES_DATE.NETWORKDAYS_INTL],
6724
+ [Now, FUNCTION_NAMES_DATE.NOW],
6725
+ [Second, FUNCTION_NAMES_DATE.SECOND],
6726
+ [Time, FUNCTION_NAMES_DATE.TIME],
6727
+ [Timevalue, FUNCTION_NAMES_DATE.TIMEVALUE],
6728
+ [Today, FUNCTION_NAMES_DATE.TODAY],
6729
+ [Weekday, FUNCTION_NAMES_DATE.WEEKDAY],
6730
+ [Weeknum, FUNCTION_NAMES_DATE.WEEKNUM],
6731
+ [Workday, FUNCTION_NAMES_DATE.WORKDAY],
6732
+ [WorkdayIntl, FUNCTION_NAMES_DATE.WORKDAY_INTL],
6733
+ [Year, FUNCTION_NAMES_DATE.YEAR],
6734
+ [Yearfrac, FUNCTION_NAMES_DATE.YEARFRAC]
6735
+ ];
6736
+ var FUNCTION_NAMES_ENGINEERING = /* @__PURE__ */ ((FUNCTION_NAMES_ENGINEERING2) => (FUNCTION_NAMES_ENGINEERING2.BESSELI = "BESSELI", FUNCTION_NAMES_ENGINEERING2.BESSELJ = "BESSELJ", FUNCTION_NAMES_ENGINEERING2.BESSELK = "BESSELK", FUNCTION_NAMES_ENGINEERING2.BESSELY = "BESSELY", FUNCTION_NAMES_ENGINEERING2.BIN2DEC = "BIN2DEC", FUNCTION_NAMES_ENGINEERING2.BIN2HEX = "BIN2HEX", FUNCTION_NAMES_ENGINEERING2.BIN2OCT = "BIN2OCT", FUNCTION_NAMES_ENGINEERING2.BITAND = "BITAND", FUNCTION_NAMES_ENGINEERING2.BITLSHIFT = "BITLSHIFT", FUNCTION_NAMES_ENGINEERING2.BITOR = "BITOR", FUNCTION_NAMES_ENGINEERING2.BITRSHIFT = "BITRSHIFT", FUNCTION_NAMES_ENGINEERING2.BITXOR = "BITXOR", FUNCTION_NAMES_ENGINEERING2.COMPLEX = "COMPLEX", FUNCTION_NAMES_ENGINEERING2.CONVERT = "CONVERT", FUNCTION_NAMES_ENGINEERING2.DEC2BIN = "DEC2BIN", FUNCTION_NAMES_ENGINEERING2.DEC2HEX = "DEC2HEX", FUNCTION_NAMES_ENGINEERING2.DEC2OCT = "DEC2OCT", FUNCTION_NAMES_ENGINEERING2.DELTA = "DELTA", FUNCTION_NAMES_ENGINEERING2.ERF = "ERF", FUNCTION_NAMES_ENGINEERING2.ERF_PRECISE = "ERF.PRECISE", FUNCTION_NAMES_ENGINEERING2.ERFC = "ERFC", FUNCTION_NAMES_ENGINEERING2.ERFC_PRECISE = "ERFC.PRECISE", FUNCTION_NAMES_ENGINEERING2.GESTEP = "GESTEP", FUNCTION_NAMES_ENGINEERING2.HEX2BIN = "HEX2BIN", FUNCTION_NAMES_ENGINEERING2.HEX2DEC = "HEX2DEC", FUNCTION_NAMES_ENGINEERING2.HEX2OCT = "HEX2OCT", FUNCTION_NAMES_ENGINEERING2.IMABS = "IMABS", FUNCTION_NAMES_ENGINEERING2.IMAGINARY = "IMAGINARY", FUNCTION_NAMES_ENGINEERING2.IMARGUMENT = "IMARGUMENT", FUNCTION_NAMES_ENGINEERING2.IMCONJUGATE = "IMCONJUGATE", FUNCTION_NAMES_ENGINEERING2.IMCOS = "IMCOS", FUNCTION_NAMES_ENGINEERING2.IMCOSH = "IMCOSH", FUNCTION_NAMES_ENGINEERING2.IMCOT = "IMCOT", FUNCTION_NAMES_ENGINEERING2.IMCSC = "IMCSC", FUNCTION_NAMES_ENGINEERING2.IMCSCH = "IMCSCH", FUNCTION_NAMES_ENGINEERING2.IMDIV = "IMDIV", FUNCTION_NAMES_ENGINEERING2.IMEXP = "IMEXP", FUNCTION_NAMES_ENGINEERING2.IMLN = "IMLN", FUNCTION_NAMES_ENGINEERING2.IMLOG10 = "IMLOG10", FUNCTION_NAMES_ENGINEERING2.IMLOG2 = "IMLOG2", FUNCTION_NAMES_ENGINEERING2.IMPOWER = "IMPOWER", FUNCTION_NAMES_ENGINEERING2.IMPRODUCT = "IMPRODUCT", FUNCTION_NAMES_ENGINEERING2.IMREAL = "IMREAL", FUNCTION_NAMES_ENGINEERING2.IMSEC = "IMSEC", FUNCTION_NAMES_ENGINEERING2.IMSECH = "IMSECH", FUNCTION_NAMES_ENGINEERING2.IMSIN = "IMSIN", FUNCTION_NAMES_ENGINEERING2.IMSINH = "IMSINH", FUNCTION_NAMES_ENGINEERING2.IMSQRT = "IMSQRT", FUNCTION_NAMES_ENGINEERING2.IMSUB = "IMSUB", FUNCTION_NAMES_ENGINEERING2.IMSUM = "IMSUM", FUNCTION_NAMES_ENGINEERING2.IMTAN = "IMTAN", FUNCTION_NAMES_ENGINEERING2.OCT2BIN = "OCT2BIN", FUNCTION_NAMES_ENGINEERING2.OCT2DEC = "OCT2DEC", FUNCTION_NAMES_ENGINEERING2.OCT2HEX = "OCT2HEX", FUNCTION_NAMES_ENGINEERING2))(FUNCTION_NAMES_ENGINEERING || {}), BESSEL;
6737
+ ((BESSEL2) => {
6738
+ const W = 0.636619772;
6739
+ function _horner(arr, v) {
6740
+ let z = 0;
6741
+ for (let i = 0; i < arr.length; ++i)
6742
+ z = v * z + arr[i];
6743
+ return z;
6744
+ }
6745
+ __name(_horner, "_horner");
6746
+ function _bessel_iter(x, n, f0, f1, sign) {
6747
+ if (n === 0)
6748
+ return f0;
6749
+ if (n === 1)
6750
+ return f1;
6751
+ const tdx = 2 / x;
6752
+ let _f0 = f0, _f1 = f1, f2 = f1;
6753
+ for (let o = 1; o < n; ++o)
6754
+ f2 = _f1 * o * tdx + sign * _f0, _f0 = _f1, _f1 = f2;
6755
+ return f2;
6756
+ }
6757
+ __name(_bessel_iter, "_bessel_iter");
6758
+ function _bessel_wrap(bessel0, bessel1, nonzero, sign) {
6759
+ return /* @__PURE__ */ __name(function(x, n) {
6760
+ if (nonzero) {
6761
+ if (x === 0)
6762
+ return nonzero === 1 ? -1 / 0 : 1 / 0;
6763
+ if (x < 0)
6764
+ return Number.NaN;
6765
+ }
6766
+ if (n === 0)
6767
+ return bessel0(x);
6768
+ if (n === 1)
6769
+ return bessel1(x);
6770
+ if (n < 0)
6771
+ return Number.NaN;
6772
+ const _n = n | 0, b0 = bessel0(x), b1 = bessel1(x);
6773
+ return _bessel_iter(x, _n, b0, b1, sign);
6774
+ }, "bessel");
6775
+ }
6776
+ __name(_bessel_wrap, "_bessel_wrap"), BESSEL2.besselj = /* @__PURE__ */ (() => {
6777
+ const b0_a1a = [-184.9052456, 77392.33017, -1121442418e-2, 6516196407e-1, -13362590354, 57568490574], b0_a2a = [1, 267.8532712, 59272.64853, 9494680718e-3, 1029532985, 57568490411], b0_a1b = [2093887211e-16, -2073370639e-15, 2734510407e-14, -0.001098628627, 1], b0_a2b = [-934935152e-16, 7621095161e-16, -6911147651e-15, 1430488765e-13, -0.01562499995];
6778
+ function bessel0(x) {
6779
+ let a = 0, a1 = 0, a2 = 0, y = x * x;
6780
+ if (x < 8)
6781
+ a1 = _horner(b0_a1a, y), a2 = _horner(b0_a2a, y), a = a1 / a2;
6782
+ else {
6783
+ const xx = x - 0.785398164;
6784
+ y = 64 / y, a1 = _horner(b0_a1b, y), a2 = _horner(b0_a2b, y), a = Math.sqrt(W / x) * (Math.cos(xx) * a1 - Math.sin(xx) * a2 * 8 / x);
6785
+ }
6786
+ return a;
6787
+ }
6788
+ __name(bessel0, "bessel0");
6789
+ const b1_a1a = [-30.16036606, 15704.4826, -2972611439e-3, 2423968531e-1, -7895059235, 72362614232], b1_a2a = [1, 376.9991397, 99447.43394, 1858330474e-2, 2300535178, 144725228442], b1_a1b = [-240337019e-15, 2457520174e-15, -3516396496e-14, 183105e-8, 1], b1_a2b = [105787412e-15, -88228987e-14, 8449199096e-15, -2002690873e-13, 0.04687499995];
6790
+ function bessel1(x) {
6791
+ let a = 0, a1 = 0, a2 = 0, y = x * x;
6792
+ const xx = Math.abs(x) - 2.356194491;
6793
+ return Math.abs(x) < 8 ? (a1 = x * _horner(b1_a1a, y), a2 = _horner(b1_a2a, y), a = a1 / a2) : (y = 64 / y, a1 = _horner(b1_a1b, y), a2 = _horner(b1_a2b, y), a = Math.sqrt(W / Math.abs(x)) * (Math.cos(xx) * a1 - Math.sin(xx) * a2 * 8 / Math.abs(x)), x < 0 && (a = -a)), a;
6794
+ }
6795
+ return __name(bessel1, "bessel1"), /* @__PURE__ */ __name(function besselj2(x, n) {
6796
+ const _n = Math.round(n);
6797
+ if (!Number.isFinite(x))
6798
+ return Number.isNaN(x) ? x : 0;
6799
+ if (_n < 0)
6800
+ return (_n % 2 ? -1 : 1) * besselj2(x, -_n);
6801
+ if (x < 0)
6802
+ return (_n % 2 ? -1 : 1) * besselj2(-x, _n);
6803
+ if (_n === 0)
6804
+ return bessel0(x);
6805
+ if (_n === 1)
6806
+ return bessel1(x);
6807
+ if (x === 0)
6808
+ return 0;
6809
+ let ret = 0;
6810
+ if (x > _n)
6811
+ ret = _bessel_iter(x, _n, bessel0(x), bessel1(x), -1);
6812
+ else {
6813
+ const m = 2 * Math.floor((_n + Math.floor(Math.sqrt(40 * _n))) / 2);
6814
+ let jsum = !1, bjp = 0, sum = 0, bj = 1, bjm = 0;
6815
+ const tox = 2 / x;
6816
+ for (let j = m; j > 0; j--)
6817
+ bjm = j * tox * bj - bjp, bjp = bj, bj = bjm, Math.abs(bj) > 1e10 && (bj *= 1e-10, bjp *= 1e-10, ret *= 1e-10, sum *= 1e-10), jsum && (sum += bj), jsum = !jsum, j === _n && (ret = bjp);
6818
+ sum = 2 * sum - bj, ret /= sum;
6819
+ }
6820
+ return ret;
6821
+ }, "besselj2");
6822
+ })(), BESSEL2.bessely = (() => {
6823
+ const b0_a1a = [228.4622733, -86327.92757, 1087988129e-2, -5123598036e-1, 7062834065, -2957821389], b0_a2a = [1, 226.1030244, 47447.2647, 7189466438e-3, 7452499648e-1, 40076544269], b0_a1b = [2093887211e-16, -2073370639e-15, 2734510407e-14, -0.001098628627, 1], b0_a2b = [-934945152e-16, 7621095161e-16, -6911147651e-15, 1430488765e-13, -0.01562499995];
6824
+ function bessel0(x) {
6825
+ let a = 0, a1 = 0, a2 = 0, y = x * x;
6826
+ const xx = x - 0.785398164;
6827
+ return x < 8 ? (a1 = _horner(b0_a1a, y), a2 = _horner(b0_a2a, y), a = a1 / a2 + W * (0, BESSEL2.besselj)(x, 0) * Math.log(x)) : (y = 64 / y, a1 = _horner(b0_a1b, y), a2 = _horner(b0_a2b, y), a = Math.sqrt(W / x) * (Math.sin(xx) * a1 + Math.cos(xx) * a2 * 8 / x)), a;
6828
+ }
6829
+ __name(bessel0, "bessel0");
6830
+ const b1_a1a = [8511.937935, -4237922726e-3, 7349264551e-1, -51534381390, 127527439e4, -4900604943e3], b1_a2a = [1, 354.9632885, 102042.605, 2245904002e-2, 3733650367, 424441966400, 249958057e5], b1_a1b = [-240337019e-15, 2457520174e-15, -3516396496e-14, 183105e-8, 1], b1_a2b = [105787412e-15, -88228987e-14, 8449199096e-15, -2002690873e-13, 0.04687499995];
6831
+ function bessel1(x) {
6832
+ let a = 0, a1 = 0, a2 = 0, y = x * x;
6833
+ const xx = x - 2.356194491;
6834
+ return x < 8 ? (a1 = x * _horner(b1_a1a, y), a2 = _horner(b1_a2a, y), a = a1 / a2 + W * ((0, BESSEL2.besselj)(x, 1) * Math.log(x) - 1 / x)) : (y = 64 / y, a1 = _horner(b1_a1b, y), a2 = _horner(b1_a2b, y), a = Math.sqrt(W / x) * (Math.sin(xx) * a1 + Math.cos(xx) * a2 * 8 / x)), a;
6835
+ }
6836
+ return __name(bessel1, "bessel1"), _bessel_wrap(bessel0, bessel1, 1, -1);
6837
+ })(), BESSEL2.besseli = /* @__PURE__ */ (() => {
6838
+ const b0_a = [45813e-7, 0.0360768, 0.2659732, 1.2067492, 3.0899424, 3.5156229, 1], b0_b = [392377e-8, -0.01647633, 0.02635537, -0.02057706, 916281e-8, -157565e-8, 225319e-8, 0.01328592, 0.39894228];
6839
+ function bessel0(x) {
6840
+ return x <= 3.75 ? _horner(b0_a, x * x / (3.75 * 3.75)) : Math.exp(Math.abs(x)) / Math.sqrt(Math.abs(x)) * _horner(b0_b, 3.75 / Math.abs(x));
6841
+ }
6842
+ __name(bessel0, "bessel0");
6843
+ const b1_a = [32411e-8, 301532e-8, 0.02658733, 0.15084934, 0.51498869, 0.87890594, 0.5], b1_b = [-420059e-8, 0.01787654, -0.02895312, 0.02282967, -0.01031555, 163801e-8, -362018e-8, -0.03988024, 0.39894228];
6844
+ function bessel1(x) {
6845
+ return x < 3.75 ? x * _horner(b1_a, x * x / (3.75 * 3.75)) : (x < 0 ? -1 : 1) * Math.exp(Math.abs(x)) / Math.sqrt(Math.abs(x)) * _horner(b1_b, 3.75 / Math.abs(x));
6846
+ }
6847
+ return __name(bessel1, "bessel1"), /* @__PURE__ */ __name(function besseli2(x, n) {
6848
+ const _n = Math.round(n);
6849
+ if (_n === 0)
6850
+ return bessel0(x);
6851
+ if (_n === 1)
6852
+ return bessel1(x);
6853
+ if (_n < 0)
6854
+ return Number.NaN;
6855
+ if (Math.abs(x) === 0)
6856
+ return 0;
6857
+ if (x === 1 / 0)
6858
+ return 1 / 0;
6859
+ let ret = 0, j;
6860
+ const tox = 2 / Math.abs(x);
6861
+ let bip = 0, bi = 1, bim = 0;
6862
+ const m = 2 * Math.round((_n + Math.round(Math.sqrt(40 * _n))) / 2);
6863
+ for (j = m; j > 0; j--)
6864
+ bim = j * tox * bi + bip, bip = bi, bi = bim, Math.abs(bi) > 1e10 && (bi *= 1e-10, bip *= 1e-10, ret *= 1e-10), j === _n && (ret = bip);
6865
+ return ret *= besseli2(x, 0) / bi, x < 0 && _n % 2 ? -ret : ret;
6866
+ }, "besseli2");
6867
+ })(), BESSEL2.besselk = (() => {
6868
+ const b0_a = [74e-7, 1075e-7, 262698e-8, 0.0348859, 0.23069756, 0.4227842, -0.57721566], b0_b = [53208e-8, -25154e-7, 587872e-8, -0.01062446, 0.02189568, -0.07832358, 1.25331414];
6869
+ function bessel0(x) {
6870
+ return x <= 2 ? -Math.log(x / 2) * (0, BESSEL2.besseli)(x, 0) + _horner(b0_a, x * x / 4) : Math.exp(-x) / Math.sqrt(x) * _horner(b0_b, 2 / x);
6871
+ }
6872
+ __name(bessel0, "bessel0");
6873
+ const b1_a = [-4686e-8, -110404e-8, -0.01919402, -0.18156897, -0.67278579, 0.15443144, 1], b1_b = [-68245e-8, 325614e-8, -780353e-8, 0.01504268, -0.0365562, 0.23498619, 1.25331414];
6874
+ function bessel1(x) {
6875
+ return x <= 2 ? Math.log(x / 2) * (0, BESSEL2.besseli)(x, 1) + 1 / x * _horner(b1_a, x * x / 4) : Math.exp(-x) / Math.sqrt(x) * _horner(b1_b, 2 / x);
6876
+ }
6877
+ return __name(bessel1, "bessel1"), _bessel_wrap(bessel0, bessel1, 2, 1);
6878
+ })();
6879
+ })(BESSEL || (BESSEL = {}));
6880
+ function isValidBinaryNumber(number) {
6881
+ return /^[01]{1,10}$/.test(number);
6882
+ }
6883
+ __name(isValidBinaryNumber, "isValidBinaryNumber");
6884
+ function isValidOctalNumber(number) {
6885
+ return /^[0-7]{1,10}$/.test(number);
6886
+ }
6887
+ __name(isValidOctalNumber, "isValidOctalNumber");
6888
+ function isValidHexadecimalNumber(number) {
6889
+ return /^[0-9A-Fa-f]{1,10}$/.test(number);
6890
+ }
6891
+ __name(isValidHexadecimalNumber, "isValidHexadecimalNumber");
6892
+ function erf(x) {
6893
+ if (x === 0)
6894
+ return 0;
6895
+ const cof = [
6896
+ -1.3026537197817094,
6897
+ 0.6419697923564902,
6898
+ 0.019476473204185836,
6899
+ -0.00956151478680863,
6900
+ -946595344482036e-18,
6901
+ 366839497852761e-18,
6902
+ 42523324806907e-18,
6903
+ -20278578112534e-18,
6904
+ -1624290004647e-18,
6905
+ 130365583558e-17,
6906
+ 15626441722e-18,
6907
+ -85238095915e-18,
6908
+ 6529054439e-18,
6909
+ 5059343495e-18,
6910
+ -991364156e-18,
6911
+ -227365122e-18,
6912
+ 96467911e-18,
6913
+ 2394038e-18,
6914
+ -6886027e-18,
6915
+ 894487e-18,
6916
+ 313092e-18,
6917
+ -112708e-18,
6918
+ 381e-18,
6919
+ 7106e-18,
6920
+ -1523e-18,
6921
+ -94e-18,
6922
+ 121e-18,
6923
+ -28e-18
6924
+ ];
6925
+ let _x = x, isneg = !1;
6926
+ _x < 0 && (_x = -_x, isneg = !0);
6927
+ const t = 2 / (2 + _x), ty = 4 * t - 2;
6928
+ let d = 0, dd = 0, tmp;
6929
+ for (let j = cof.length - 1; j > 0; j--)
6930
+ tmp = d, d = ty * d - dd + cof[j], dd = tmp;
6931
+ const res = t * Math.exp(-_x * _x + 0.5 * (cof[0] + ty * d) - dd);
6932
+ return isneg ? res - 1 : 1 - res;
6933
+ }
6934
+ __name(erf, "erf");
6935
+ const _Besseli = class _Besseli extends BaseFunction {
6936
+ constructor() {
6937
+ super(...arguments);
6938
+ __publicField(this, "minParams", 2);
6939
+ __publicField(this, "maxParams", 2);
6940
+ }
6941
+ calculate(x, n) {
6942
+ if (x.isNull() || n.isNull())
6943
+ return ErrorValueObject.create(ErrorType$1.NA);
6944
+ const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(x, n);
6945
+ if (isError)
6946
+ return errorObject;
6947
+ const [xObject, nObject] = variants, xValue = +xObject.getValue(), nValue = Math.floor(+nObject.getValue());
6948
+ if (Number.isNaN(xValue) || Number.isNaN(nValue))
6949
+ return ErrorValueObject.create(ErrorType$1.VALUE);
6950
+ if (nValue < 0)
6951
+ return ErrorValueObject.create(ErrorType$1.NUM);
6952
+ const result = BESSEL.besseli(xValue, nValue);
6953
+ return Number.isNaN(result) || !Number.isFinite(result) ? ErrorValueObject.create(ErrorType$1.NUM) : NumberValueObject.create(result);
6954
+ }
6955
+ };
6956
+ __name(_Besseli, "Besseli");
6957
+ let Besseli = _Besseli;
6958
+ const _Besselj = class _Besselj extends BaseFunction {
6959
+ constructor() {
6960
+ super(...arguments);
6961
+ __publicField(this, "minParams", 2);
6962
+ __publicField(this, "maxParams", 2);
6963
+ }
6964
+ calculate(x, n) {
6965
+ if (x.isNull() || n.isNull())
6966
+ return ErrorValueObject.create(ErrorType$1.NA);
6967
+ const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(x, n);
6968
+ if (isError)
6969
+ return errorObject;
6970
+ const [xObject, nObject] = variants, xValue = +xObject.getValue(), nValue = Math.floor(+nObject.getValue());
6971
+ if (Number.isNaN(xValue) || Number.isNaN(nValue))
6972
+ return ErrorValueObject.create(ErrorType$1.VALUE);
6973
+ if (nValue < 0)
6974
+ return ErrorValueObject.create(ErrorType$1.NUM);
6975
+ const result = BESSEL.besselj(xValue, nValue);
6976
+ return Number.isNaN(result) || !Number.isFinite(result) ? ErrorValueObject.create(ErrorType$1.NUM) : NumberValueObject.create(result);
6977
+ }
6978
+ };
6979
+ __name(_Besselj, "Besselj");
6980
+ let Besselj = _Besselj;
6981
+ const _Besselk = class _Besselk extends BaseFunction {
6982
+ constructor() {
6983
+ super(...arguments);
6984
+ __publicField(this, "minParams", 2);
6985
+ __publicField(this, "maxParams", 2);
6986
+ }
6987
+ calculate(x, n) {
6988
+ if (x.isNull() || n.isNull())
6989
+ return ErrorValueObject.create(ErrorType$1.NA);
6990
+ const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(x, n);
6991
+ if (isError)
6992
+ return errorObject;
6993
+ const [xObject, nObject] = variants, xValue = +xObject.getValue(), nValue = Math.floor(+nObject.getValue());
6994
+ if (Number.isNaN(xValue) || Number.isNaN(nValue))
6995
+ return ErrorValueObject.create(ErrorType$1.VALUE);
6996
+ if (nValue < 0)
6997
+ return ErrorValueObject.create(ErrorType$1.NUM);
6998
+ const result = BESSEL.besselk(xValue, nValue);
6999
+ return Number.isNaN(result) || !Number.isFinite(result) ? ErrorValueObject.create(ErrorType$1.NUM) : NumberValueObject.create(result);
7000
+ }
7001
+ };
7002
+ __name(_Besselk, "Besselk");
7003
+ let Besselk = _Besselk;
7004
+ const _Bessely = class _Bessely extends BaseFunction {
7005
+ constructor() {
7006
+ super(...arguments);
7007
+ __publicField(this, "minParams", 2);
7008
+ __publicField(this, "maxParams", 2);
7009
+ }
7010
+ calculate(x, n) {
7011
+ if (x.isNull() || n.isNull())
7012
+ return ErrorValueObject.create(ErrorType$1.NA);
7013
+ const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(x, n);
7014
+ if (isError)
7015
+ return errorObject;
7016
+ const [xObject, nObject] = variants, xValue = +xObject.getValue(), nValue = Math.floor(+nObject.getValue());
7017
+ if (Number.isNaN(xValue) || Number.isNaN(nValue))
7018
+ return ErrorValueObject.create(ErrorType$1.VALUE);
7019
+ if (nValue < 0)
7020
+ return ErrorValueObject.create(ErrorType$1.NUM);
7021
+ const result = BESSEL.bessely(xValue, nValue);
7022
+ return Number.isNaN(result) || !Number.isFinite(result) ? ErrorValueObject.create(ErrorType$1.NUM) : NumberValueObject.create(result);
7023
+ }
7024
+ };
7025
+ __name(_Bessely, "Bessely");
7026
+ let Bessely = _Bessely;
7027
+ const _Bin2dec = class _Bin2dec extends BaseFunction {
7028
+ constructor() {
7029
+ super(...arguments);
7030
+ __publicField(this, "minParams", 1);
7031
+ __publicField(this, "maxParams", 1);
7032
+ }
7033
+ calculate(number) {
7034
+ const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(number);
7035
+ if (isError)
7036
+ return errorObject;
7037
+ const [numberObject] = variants, numberValue = `${numberObject.getValue()}`;
7038
+ if (!isValidBinaryNumber(numberValue))
7039
+ return ErrorValueObject.create(ErrorType$1.NUM);
7040
+ let result;
7041
+ return numberValue.length === 10 && numberValue.substring(0, 1) === "1" ? result = Number.parseInt(numberValue.substring(1), 2) - 512 : result = Number.parseInt(numberValue, 2), NumberValueObject.create(result);
7042
+ }
7043
+ };
7044
+ __name(_Bin2dec, "Bin2dec");
7045
+ let Bin2dec = _Bin2dec;
7046
+ const _Bin2hex = class _Bin2hex extends BaseFunction {
7047
+ constructor() {
7048
+ super(...arguments);
7049
+ __publicField(this, "minParams", 1);
7050
+ __publicField(this, "maxParams", 2);
7051
+ }
7052
+ calculate(number, places) {
7053
+ if (number.isNull())
7054
+ return ErrorValueObject.create(ErrorType$1.NA);
7055
+ let placesValue = 0;
7056
+ if (places) {
7057
+ const { isError: isError2, errorObject: errorObject2, variants: variants2 } = checkVariantsErrorIsArrayOrBoolean(places);
7058
+ if (isError2)
7059
+ return errorObject2;
7060
+ const [placesObject] = variants2;
7061
+ if (placesValue = Math.floor(+placesObject.getValue()), Number.isNaN(placesValue))
7062
+ return ErrorValueObject.create(ErrorType$1.VALUE);
7063
+ if (placesValue < 0 || placesValue > 10)
7064
+ return ErrorValueObject.create(ErrorType$1.NUM);
7065
+ }
7066
+ const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(number);
7067
+ if (isError)
7068
+ return errorObject;
7069
+ const [numberObject] = variants, numberValue = `${numberObject.getValue()}`;
7070
+ if (!isValidBinaryNumber(numberValue))
7071
+ return ErrorValueObject.create(ErrorType$1.NUM);
7072
+ let result;
7073
+ if (numberValue.length === 10 && numberValue.substring(0, 1) === "1")
7074
+ result = (1099511627264 + Number.parseInt(numberValue.substring(1), 2)).toString(16);
7075
+ else if (result = Number.parseInt(numberValue, 2).toString(16), places) {
7076
+ if (placesValue < result.length)
7077
+ return ErrorValueObject.create(ErrorType$1.NUM);
7078
+ result = "0".repeat(placesValue - result.length) + result;
7079
+ }
7080
+ return StringValueObject.create(result.toLocaleUpperCase());
7081
+ }
7082
+ };
7083
+ __name(_Bin2hex, "Bin2hex");
7084
+ let Bin2hex = _Bin2hex;
7085
+ const _Bin2oct = class _Bin2oct extends BaseFunction {
7086
+ constructor() {
7087
+ super(...arguments);
7088
+ __publicField(this, "minParams", 1);
7089
+ __publicField(this, "maxParams", 2);
7090
+ }
7091
+ calculate(number, places) {
7092
+ if (number.isNull())
7093
+ return ErrorValueObject.create(ErrorType$1.NA);
7094
+ let placesValue = 0;
7095
+ if (places) {
7096
+ const { isError: isError2, errorObject: errorObject2, variants: variants2 } = checkVariantsErrorIsArrayOrBoolean(places);
7097
+ if (isError2)
7098
+ return errorObject2;
7099
+ const [placesObject] = variants2;
7100
+ if (placesValue = Math.floor(+placesObject.getValue()), Number.isNaN(placesValue))
7101
+ return ErrorValueObject.create(ErrorType$1.VALUE);
7102
+ if (placesValue < 0 || placesValue > 10)
7103
+ return ErrorValueObject.create(ErrorType$1.NUM);
7104
+ }
7105
+ const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(number);
7106
+ if (isError)
7107
+ return errorObject;
7108
+ const [numberObject] = variants, numberValue = `${numberObject.getValue()}`;
7109
+ if (!isValidBinaryNumber(numberValue))
7110
+ return ErrorValueObject.create(ErrorType$1.NUM);
7111
+ let result;
7112
+ if (numberValue.length === 10 && numberValue.substring(0, 1) === "1")
7113
+ result = (1073741312 + Number.parseInt(numberValue.substring(1), 2)).toString(8);
7114
+ else if (result = Number.parseInt(numberValue, 2).toString(8), places) {
7115
+ if (placesValue < result.length)
7116
+ return ErrorValueObject.create(ErrorType$1.NUM);
7117
+ result = "0".repeat(placesValue - result.length) + result;
7118
+ }
7119
+ return StringValueObject.create(result);
7120
+ }
7121
+ };
7122
+ __name(_Bin2oct, "Bin2oct");
7123
+ let Bin2oct = _Bin2oct;
7124
+ const _Bitand = class _Bitand extends BaseFunction {
7125
+ constructor() {
7126
+ super(...arguments);
7127
+ __publicField(this, "minParams", 2);
7128
+ __publicField(this, "maxParams", 2);
7129
+ }
7130
+ calculate(number1, number2) {
7131
+ if (number1.isError())
7132
+ return number1;
7133
+ if (number2.isError())
7134
+ return number2;
7135
+ const maxRowLength = Math.max(
7136
+ number1.isArray() ? number1.getRowCount() : 1,
7137
+ number2.isArray() ? number2.getRowCount() : 1
7138
+ ), maxColumnLength = Math.max(
7139
+ number1.isArray() ? number1.getColumnCount() : 1,
7140
+ number2.isArray() ? number2.getColumnCount() : 1
7141
+ ), number1Array = expandArrayValueObject(maxRowLength, maxColumnLength, number1, ErrorValueObject.create(ErrorType$1.NA)), number2Array = expandArrayValueObject(maxRowLength, maxColumnLength, number2, ErrorValueObject.create(ErrorType$1.NA)), resultArray = number1Array.map((itemObject, rowIndex, columnIndex) => {
7142
+ let number1Object = itemObject;
7143
+ if (number1Object.isString() && (number1Object = number1Object.convertToNumberObjectValue()), number1Object.isError())
7144
+ return number1Object;
7145
+ let number2Object = number2Array.get(rowIndex, columnIndex);
7146
+ if (number2Object.isString() && (number2Object = number2Object.convertToNumberObjectValue()), number2Object.isError())
7147
+ return number2Object;
7148
+ const number1Value = +number1Object.getValue(), number2Value = +number2Object.getValue();
7149
+ if (number1Value < 0 || number2Value < 0 || Math.floor(number1Value) !== number1Value || Math.floor(number2Value) !== number2Value || number1Value > 281474976710655 || number2Value > 281474976710655)
7150
+ return ErrorValueObject.create(ErrorType$1.NUM);
7151
+ const result = number1Value & number2Value;
7152
+ return NumberValueObject.create(result);
7153
+ });
7154
+ return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
7155
+ }
7156
+ };
7157
+ __name(_Bitand, "Bitand");
7158
+ let Bitand = _Bitand;
7159
+ const _Bitlshift = class _Bitlshift extends BaseFunction {
7160
+ constructor() {
7161
+ super(...arguments);
7162
+ __publicField(this, "minParams", 2);
7163
+ __publicField(this, "maxParams", 2);
7164
+ }
7165
+ calculate(number, shiftAmount) {
7166
+ if (number.isError())
7167
+ return number;
7168
+ if (shiftAmount.isError())
7169
+ return shiftAmount;
7170
+ const maxRowLength = Math.max(
7171
+ number.isArray() ? number.getRowCount() : 1,
7172
+ shiftAmount.isArray() ? shiftAmount.getRowCount() : 1
7173
+ ), maxColumnLength = Math.max(
7174
+ number.isArray() ? number.getColumnCount() : 1,
7175
+ shiftAmount.isArray() ? shiftAmount.getColumnCount() : 1
7176
+ ), numberArray = expandArrayValueObject(maxRowLength, maxColumnLength, number, ErrorValueObject.create(ErrorType$1.NA)), shiftAmountArray = expandArrayValueObject(maxRowLength, maxColumnLength, shiftAmount, ErrorValueObject.create(ErrorType$1.NA)), resultArray = numberArray.map((itemObject, rowIndex, columnIndex) => {
7177
+ let numberObject = itemObject;
7178
+ if (numberObject.isString() && (numberObject = numberObject.convertToNumberObjectValue()), numberObject.isError())
7179
+ return numberObject;
7180
+ let shiftAmountObject = shiftAmountArray.get(rowIndex, columnIndex);
7181
+ if (shiftAmountObject.isString() && (shiftAmountObject = shiftAmountObject.convertToNumberObjectValue()), shiftAmountObject.isError())
7182
+ return shiftAmountObject;
7183
+ const numberValue = +numberObject.getValue();
7184
+ let shiftAmountValue = +shiftAmountObject.getValue();
7185
+ if (numberValue < 0 || Math.floor(numberValue) !== numberValue || numberValue > 281474976710655 || Math.abs(shiftAmountValue) > 53)
7186
+ return ErrorValueObject.create(ErrorType$1.NUM);
7187
+ shiftAmountValue = Math.trunc(shiftAmountValue);
7188
+ const result = Number(shiftAmountValue >= 0 ? BigInt(numberValue) << BigInt(shiftAmountValue) : BigInt(numberValue) >> BigInt(-shiftAmountValue));
7189
+ return result > 281474976710655 ? ErrorValueObject.create(ErrorType$1.NUM) : NumberValueObject.create(result);
7190
+ });
7191
+ return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
7192
+ }
7193
+ };
7194
+ __name(_Bitlshift, "Bitlshift");
7195
+ let Bitlshift = _Bitlshift;
7196
+ const _Bitor = class _Bitor extends BaseFunction {
7197
+ constructor() {
7198
+ super(...arguments);
7199
+ __publicField(this, "minParams", 2);
7200
+ __publicField(this, "maxParams", 2);
7201
+ }
7202
+ calculate(number1, number2) {
7203
+ if (number1.isError())
7204
+ return number1;
7205
+ if (number2.isError())
7206
+ return number2;
7207
+ const maxRowLength = Math.max(
7208
+ number1.isArray() ? number1.getRowCount() : 1,
7209
+ number2.isArray() ? number2.getRowCount() : 1
7210
+ ), maxColumnLength = Math.max(
7211
+ number1.isArray() ? number1.getColumnCount() : 1,
7212
+ number2.isArray() ? number2.getColumnCount() : 1
7213
+ ), number1Array = expandArrayValueObject(maxRowLength, maxColumnLength, number1, ErrorValueObject.create(ErrorType$1.NA)), number2Array = expandArrayValueObject(maxRowLength, maxColumnLength, number2, ErrorValueObject.create(ErrorType$1.NA)), resultArray = number1Array.map((itemObject, rowIndex, columnIndex) => {
7214
+ let number1Object = itemObject;
7215
+ if (number1Object.isString() && (number1Object = number1Object.convertToNumberObjectValue()), number1Object.isError())
7216
+ return number1Object;
7217
+ let number2Object = number2Array.get(rowIndex, columnIndex);
7218
+ if (number2Object.isString() && (number2Object = number2Object.convertToNumberObjectValue()), number2Object.isError())
7219
+ return number2Object;
7220
+ const number1Value = +number1Object.getValue(), number2Value = +number2Object.getValue();
7221
+ if (number1Value < 0 || number2Value < 0 || Math.floor(number1Value) !== number1Value || Math.floor(number2Value) !== number2Value || number1Value > 281474976710655 || number2Value > 281474976710655)
7222
+ return ErrorValueObject.create(ErrorType$1.NUM);
7223
+ const result = Number(BigInt(number1Value) | BigInt(number2Value));
7224
+ return NumberValueObject.create(result);
7225
+ });
7226
+ return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
7227
+ }
7228
+ };
7229
+ __name(_Bitor, "Bitor");
7230
+ let Bitor = _Bitor;
7231
+ const _Bitrshift = class _Bitrshift extends BaseFunction {
7232
+ constructor() {
7233
+ super(...arguments);
7234
+ __publicField(this, "minParams", 2);
7235
+ __publicField(this, "maxParams", 2);
7236
+ }
7237
+ calculate(number, shiftAmount) {
7238
+ if (number.isError())
7239
+ return number;
7240
+ if (shiftAmount.isError())
7241
+ return shiftAmount;
7242
+ const maxRowLength = Math.max(
7243
+ number.isArray() ? number.getRowCount() : 1,
7244
+ shiftAmount.isArray() ? shiftAmount.getRowCount() : 1
7245
+ ), maxColumnLength = Math.max(
7246
+ number.isArray() ? number.getColumnCount() : 1,
7247
+ shiftAmount.isArray() ? shiftAmount.getColumnCount() : 1
7248
+ ), numberArray = expandArrayValueObject(maxRowLength, maxColumnLength, number, ErrorValueObject.create(ErrorType$1.NA)), shiftAmountArray = expandArrayValueObject(maxRowLength, maxColumnLength, shiftAmount, ErrorValueObject.create(ErrorType$1.NA)), resultArray = numberArray.map((itemObject, rowIndex, columnIndex) => {
7249
+ let numberObject = itemObject;
7250
+ if (numberObject.isString() && (numberObject = numberObject.convertToNumberObjectValue()), numberObject.isError())
7251
+ return numberObject;
7252
+ let shiftAmountObject = shiftAmountArray.get(rowIndex, columnIndex);
7253
+ if (shiftAmountObject.isString() && (shiftAmountObject = shiftAmountObject.convertToNumberObjectValue()), shiftAmountObject.isError())
7254
+ return shiftAmountObject;
7255
+ const numberValue = +numberObject.getValue();
7256
+ let shiftAmountValue = +shiftAmountObject.getValue();
7257
+ if (numberValue < 0 || Math.floor(numberValue) !== numberValue || numberValue > 281474976710655 || Math.abs(shiftAmountValue) > 53)
7258
+ return ErrorValueObject.create(ErrorType$1.NUM);
7259
+ shiftAmountValue = Math.trunc(shiftAmountValue);
7260
+ const result = Number(shiftAmountValue >= 0 ? BigInt(numberValue) >> BigInt(shiftAmountValue) : BigInt(numberValue) << BigInt(-shiftAmountValue));
7261
+ return result > 281474976710655 ? ErrorValueObject.create(ErrorType$1.NUM) : NumberValueObject.create(result);
7262
+ });
7263
+ return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
7264
+ }
7265
+ };
7266
+ __name(_Bitrshift, "Bitrshift");
7267
+ let Bitrshift = _Bitrshift;
7268
+ const _Bitxor = class _Bitxor extends BaseFunction {
7269
+ constructor() {
7270
+ super(...arguments);
7271
+ __publicField(this, "minParams", 2);
7272
+ __publicField(this, "maxParams", 2);
7273
+ }
7274
+ calculate(number1, number2) {
7275
+ if (number1.isError())
7276
+ return number1;
7277
+ if (number2.isError())
7278
+ return number2;
7279
+ const maxRowLength = Math.max(
7280
+ number1.isArray() ? number1.getRowCount() : 1,
7281
+ number2.isArray() ? number2.getRowCount() : 1
7282
+ ), maxColumnLength = Math.max(
7283
+ number1.isArray() ? number1.getColumnCount() : 1,
7284
+ number2.isArray() ? number2.getColumnCount() : 1
7285
+ ), number1Array = expandArrayValueObject(maxRowLength, maxColumnLength, number1, ErrorValueObject.create(ErrorType$1.NA)), number2Array = expandArrayValueObject(maxRowLength, maxColumnLength, number2, ErrorValueObject.create(ErrorType$1.NA)), resultArray = number1Array.map((itemObject, rowIndex, columnIndex) => {
7286
+ let number1Object = itemObject;
7287
+ if (number1Object.isString() && (number1Object = number1Object.convertToNumberObjectValue()), number1Object.isError())
7288
+ return number1Object;
7289
+ let number2Object = number2Array.get(rowIndex, columnIndex);
7290
+ if (number2Object.isString() && (number2Object = number2Object.convertToNumberObjectValue()), number2Object.isError())
7291
+ return number2Object;
7292
+ const number1Value = +number1Object.getValue(), number2Value = +number2Object.getValue();
7293
+ if (number1Value < 0 || number2Value < 0 || Math.floor(number1Value) !== number1Value || Math.floor(number2Value) !== number2Value || number1Value > 281474976710655 || number2Value > 281474976710655)
7294
+ return ErrorValueObject.create(ErrorType$1.NUM);
7295
+ const result = number1Value ^ number2Value;
7296
+ return NumberValueObject.create(result);
7297
+ });
7298
+ return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
7299
+ }
7300
+ };
7301
+ __name(_Bitxor, "Bitxor");
7302
+ let Bitxor = _Bitxor;
7303
+ const _Complex = class _Complex extends BaseFunction {
7304
+ constructor() {
7305
+ super(...arguments);
7306
+ __publicField(this, "minParams", 2);
7307
+ __publicField(this, "maxParams", 3);
7308
+ }
7309
+ calculate(realNum, iNum, suffix) {
7310
+ const _suffix = suffix != null ? suffix : StringValueObject.create("i"), { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(realNum, iNum, _suffix);
7311
+ if (isError)
7312
+ return errorObject;
7313
+ const [realNumObject, iNumObject, suffixObject] = variants, realNumValue = +realNumObject.getValue(), iNumValue = +iNumObject.getValue(), suffixValue = `${suffixObject.getValue()}`;
7314
+ if (Number.isNaN(realNumValue) || Number.isNaN(iNumValue) || suffixValue !== "i" && suffixValue !== "j")
7315
+ return ErrorValueObject.create(ErrorType$1.VALUE);
7316
+ if (realNumValue === 0 && iNumValue === 0)
7317
+ return NumberValueObject.create(0);
7318
+ if (realNumValue === 0)
7319
+ return iNumValue === 1 ? StringValueObject.create(suffixValue) : StringValueObject.create(`${iNumValue}${suffixValue}`);
7320
+ if (iNumValue === 0)
7321
+ return NumberValueObject.create(realNumValue);
7322
+ const sign = iNumValue > 0 ? "+" : "", suffixStr = iNumValue === 1 ? suffixValue : `${iNumValue}${suffixValue}`;
7323
+ return StringValueObject.create(`${realNumValue}${sign}${suffixStr}`);
7324
+ }
7325
+ };
7326
+ __name(_Complex, "Complex");
7327
+ let Complex = _Complex;
7328
+ const _Convert = class _Convert extends BaseFunction {
7329
+ constructor() {
7330
+ super(...arguments);
7331
+ __publicField(this, "minParams", 3);
7332
+ __publicField(this, "maxParams", 3);
7333
+ // List of units supported by CONVERT and units defined by the International System of Units
7334
+ // [Name, Symbol, Alternate symbols, Quantity, ISU, CONVERT, Conversion ratio]
7335
+ __publicField(this, "_units", [
7336
+ ["a.u. of action", "?", null, "action", !1, !1, 105457168181818e-48],
7337
+ ["a.u. of charge", "e", null, "electric_charge", !1, !1, 160217653141414e-33],
7338
+ ["a.u. of energy", "Eh", null, "energy", !1, !1, 435974417757576e-32],
7339
+ ["a.u. of length", "a?", null, "length", !1, !1, 529177210818182e-25],
7340
+ ["a.u. of mass", "m?", null, "mass", !1, !1, 910938261616162e-45],
7341
+ ["a.u. of time", "?/Eh", null, "time", !1, !1, 241888432650516e-31],
7342
+ ["admiralty knot", "admkn", null, "speed", !1, !0, 0.514773333],
7343
+ ["ampere", "A", null, "electric_current", !0, !1, 1],
7344
+ ["ampere per meter", "A/m", null, "magnetic_field_intensity", !0, !1, 1],
7345
+ ["ångström", "Å", ["ang"], "length", !1, !0, 1e-10],
7346
+ ["are", "ar", null, "area", !1, !0, 100],
7347
+ ["astronomical unit", "ua", null, "length", !1, !1, 149597870691667e-25],
7348
+ ["bar", "bar", null, "pressure", !1, !1, 1e5],
7349
+ ["barn", "b", null, "area", !1, !1, 1e-28],
7350
+ ["becquerel", "Bq", null, "radioactivity", !0, !1, 1],
7351
+ ["bit", "bit", ["b"], "information", !1, !0, 1],
7352
+ ["btu", "BTU", ["btu"], "energy", !1, !0, 1055.05585262],
7353
+ ["byte", "byte", null, "information", !1, !0, 8],
7354
+ ["candela", "cd", null, "luminous_intensity", !0, !1, 1],
7355
+ ["candela per square metre", "cd/m?", null, "luminance", !0, !1, 1],
7356
+ ["centigrade", "C", ["cel"], "temperature", !0, !1, 1],
7357
+ ["cubic ångström", "ang3", ["ang^3"], "volume", !1, !0, 1e-30],
7358
+ ["cubic foot", "ft3", ["ft^3"], "volume", !1, !0, 0.028316846592],
7359
+ ["cubic inch", "in3", ["in^3"], "volume", !1, !0, 16387064e-12],
7360
+ ["cubic light-year", "ly3", ["ly^3"], "volume", !1, !0, 846786664623715e-61],
7361
+ ["cubic metre", "m3", ["m^3"], "volume", !0, !0, 1],
7362
+ ["cubic mile", "mi3", ["mi^3"], "volume", !1, !0, 416818182544058e-5],
7363
+ ["cubic nautical mile", "Nmi3", ["Nmi^3"], "volume", !1, !0, 6352182208],
7364
+ ["cubic Pica", "Pica3", ["Picapt3", "Pica^3", "Picapt^3"], "volume", !1, !0, 758660370370369e-22],
7365
+ ["cubic yard", "yd3", ["yd^3"], "volume", !1, !0, 0.764554857984],
7366
+ ["cup", "cup", null, "volume", !1, !0, 2365882365e-13],
7367
+ ["dalton", "Da", ["u"], "mass", !1, !1, 166053886282828e-41],
7368
+ ["day", "d", ["day"], "time", !1, !0, 86400],
7369
+ ["degree", "°", null, "angle", !1, !1, 0.0174532925199433],
7370
+ ["dyne", "dyn", ["dy"], "force", !1, !0, 1e-5],
7371
+ ["electronvolt", "eV", ["ev"], "energy", !1, !0, 1.60217656514141],
7372
+ ["ell", "ell", null, "length", !1, !0, 1.143],
7373
+ ["erg", "erg", ["e"], "energy", !1, !0, 1e-7],
7374
+ ["fahrenheit", "F", ["fah"], "temperature", !0, !1, 1],
7375
+ ["fluid ounce", "oz", null, "volume", !1, !0, 295735295625e-16],
7376
+ ["foot", "ft", null, "length", !1, !0, 0.3048],
7377
+ ["foot-pound", "flb", null, "energy", !1, !0, 1.3558179483314],
7378
+ ["gal", "Gal", null, "acceleration", !1, !1, 0.01],
7379
+ ["gallon", "gal", null, "volume", !1, !0, 0.003785411784],
7380
+ ["gauss", "G", ["ga"], "magnetic_flux_density", !1, !0, 1],
7381
+ ["grain", "grain", null, "mass", !1, !0, 647989e-10],
7382
+ ["gram", "g", null, "mass", !1, !0, 1e-3],
7383
+ ["gray", "Gy", null, "absorbed_dose", !0, !1, 1],
7384
+ ["gross registered ton", "GRT", ["regton"], "volume", !1, !0, 2.8316846592],
7385
+ ["hectare", "ha", null, "area", !1, !0, 1e4],
7386
+ ["henry", "H", null, "inductance", !0, !1, 1],
7387
+ ["hertz", "Hz", null, "frequency", !0, !1, 1],
7388
+ ["horsepower", "HP", ["h"], "power", !1, !0, 745.69987158227],
7389
+ ["horsepower-hour", "HPh", ["hh", "hph"], "energy", !1, !0, 2684519538e-3],
7390
+ ["hour", "h", ["hr"], "time", !1, !0, 3600],
7391
+ ["imperial gallon (U.K.)", "uk_gal", null, "volume", !1, !0, 454609e-8],
7392
+ ["imperial hundredweight", "lcwt", ["uk_cwt", "hweight"], "mass", !1, !0, 50.802345],
7393
+ ["imperial quart (U.K)", "uk_qt", null, "volume", !1, !0, 0.0011365225],
7394
+ ["imperial ton", "brton", ["uk_ton", "LTON"], "mass", !1, !0, 1016.046909],
7395
+ ["inch", "in", null, "length", !1, !0, 0.0254],
7396
+ ["international acre", "uk_acre", null, "area", !1, !0, 4046.8564224],
7397
+ ["IT calorie", "cal", null, "energy", !1, !0, 4.1868],
7398
+ ["joule", "J", null, "energy", !0, !0, 1],
7399
+ ["katal", "kat", null, "catalytic_activity", !0, !1, 1],
7400
+ ["kelvin", "K", ["kel"], "temperature", !0, !0, 1],
7401
+ ["kilogram", "kg", null, "mass", !0, !0, 1],
7402
+ ["knot", "kn", null, "speed", !1, !0, 0.514444444444444],
7403
+ ["light-year", "ly", null, "length", !1, !0, 9460730472580800],
7404
+ ["litre", "L", ["l", "lt"], "volume", !1, !0, 1e-3],
7405
+ ["lumen", "lm", null, "luminous_flux", !0, !1, 1],
7406
+ ["lux", "lx", null, "illuminance", !0, !1, 1],
7407
+ ["maxwell", "Mx", null, "magnetic_flux", !1, !1, 1e-18],
7408
+ ["measurement ton", "MTON", null, "volume", !1, !0, 1.13267386368],
7409
+ ["meter per hour", "m/h", ["m/hr"], "speed", !1, !0, 27777777777778e-17],
7410
+ ["meter per second", "m/s", ["m/sec"], "speed", !0, !0, 1],
7411
+ ["meter per second squared", "m?s??", null, "acceleration", !0, !1, 1],
7412
+ ["parsec", "pc", ["parsec"], "length", !1, !0, 30856775814671900],
7413
+ ["meter squared per second", "m?/s", null, "kinematic_viscosity", !0, !1, 1],
7414
+ ["metre", "m", null, "length", !0, !0, 1],
7415
+ ["miles per hour", "mph", null, "speed", !1, !0, 0.44704],
7416
+ ["millimetre of mercury", "mmHg", null, "pressure", !1, !1, 133.322],
7417
+ ["minute", "?", null, "angle", !1, !1, 290888208665722e-18],
7418
+ ["minute", "min", ["mn"], "time", !1, !0, 60],
7419
+ ["modern teaspoon", "tspm", null, "volume", !1, !0, 5e-6],
7420
+ ["mole", "mol", null, "amount_of_substance", !0, !1, 1],
7421
+ ["morgen", "Morgen", null, "area", !1, !0, 2500],
7422
+ ["n.u. of action", "?", null, "action", !1, !1, 105457168181818e-48],
7423
+ ["n.u. of mass", "m?", null, "mass", !1, !1, 910938261616162e-45],
7424
+ ["n.u. of speed", "c?", null, "speed", !1, !1, 299792458],
7425
+ ["n.u. of time", "?/(me?c??)", null, "time", !1, !1, 128808866778687e-35],
7426
+ ["nautical mile", "M", ["Nmi"], "length", !1, !0, 1852],
7427
+ ["newton", "N", null, "force", !0, !0, 1],
7428
+ ["œrsted", "Oe ", null, "magnetic_field_intensity", !1, !1, 79.5774715459477],
7429
+ ["ohm", "Ω", null, "electric_resistance", !0, !1, 1],
7430
+ ["ounce mass", "ozm", null, "mass", !1, !0, 0.028349523125],
7431
+ ["pascal", "Pa", null, "pressure", !0, !1, 1],
7432
+ ["pascal second", "Pa?s", null, "dynamic_viscosity", !0, !1, 1],
7433
+ ["pferdestärke", "PS", null, "power", !1, !0, 735.49875],
7434
+ ["phot", "ph", null, "illuminance", !1, !1, 1e-4],
7435
+ ["pica (1/6 inch)", "pica", null, "length", !1, !0, 35277777777778e-17],
7436
+ ["pica (1/72 inch)", "Pica", ["Picapt"], "length", !1, !0, 0.00423333333333333],
7437
+ ["poise", "P", null, "dynamic_viscosity", !1, !1, 0.1],
7438
+ ["pond", "pond", null, "force", !1, !0, 980665e-8],
7439
+ ["pound force", "lbf", null, "force", !1, !0, 4.4482216152605],
7440
+ ["pound mass", "lbm", null, "mass", !1, !0, 0.45359237],
7441
+ ["quart", "qt", null, "volume", !1, !0, 946352946e-12],
7442
+ ["radian", "rad", null, "angle", !0, !1, 1],
7443
+ ["rankine", "Rank", null, "temperature", !1, !0, 1],
7444
+ ["reaumur", "Reau", null, "temperature", !1, !0, 1],
7445
+ ["second", "?", null, "angle", !1, !1, 484813681109536e-20],
7446
+ ["second", "s", ["sec"], "time", !0, !0, 1],
7447
+ ["short hundredweight", "cwt", ["shweight"], "mass", !1, !0, 45.359237],
7448
+ ["siemens", "S", null, "electrical_conductance", !0, !1, 1],
7449
+ ["sievert", "Sv", null, "equivalent_dose", !0, !1, 1],
7450
+ ["slug", "sg", null, "mass", !1, !0, 14.59390294],
7451
+ ["square ångström", "ang2", ["ang^2"], "area", !1, !0, 1e-20],
7452
+ ["square foot", "ft2", ["ft^2"], "area", !1, !0, 0.09290304],
7453
+ ["square inch", "in2", ["in^2"], "area", !1, !0, 64516e-8],
7454
+ ["square light-year", "ly2", ["ly^2"], "area", !1, !0, 895054210748189e17],
7455
+ ["square meter", "m?", null, "area", !0, !0, 1],
7456
+ ["square mile", "mi2", ["mi^2"], "area", !1, !0, 2589988110336e-6],
7457
+ ["square nautical mile", "Nmi2", ["Nmi^2"], "area", !1, !0, 3429904],
7458
+ ["square Pica", "Pica2", ["Picapt2", "Pica^2", "Picapt^2"], "area", !1, !0, 1792111111111e-17],
7459
+ ["square yard", "yd2", ["yd^2"], "area", !1, !0, 0.83612736],
7460
+ ["statute mile", "mi", null, "length", !1, !0, 1609.344],
7461
+ ["steradian", "sr", null, "solid_angle", !0, !1, 1],
7462
+ ["stilb", "sb", null, "luminance", !1, !1, 1e-4],
7463
+ ["stokes", "St", null, "kinematic_viscosity", !1, !1, 1e-4],
7464
+ ["stone", "stone", null, "mass", !1, !0, 6.35029318],
7465
+ ["tablespoon", "tbs", null, "volume", !1, !0, 147868e-10],
7466
+ ["teaspoon", "tsp", null, "volume", !1, !0, 492892e-11],
7467
+ ["tesla", "T", null, "magnetic_flux_density", !0, !0, 1],
7468
+ ["thermodynamic calorie", "c", null, "energy", !1, !0, 4.184],
7469
+ ["ton", "ton", null, "mass", !1, !0, 907.18474],
7470
+ ["tonne", "t", null, "mass", !1, !1, 1e3],
7471
+ ["U.K. pint", "uk_pt", null, "volume", !1, !0, 56826125e-11],
7472
+ ["U.S. bushel", "bushel", null, "volume", !1, !0, 0.03523907],
7473
+ ["U.S. oil barrel", "barrel", null, "volume", !1, !0, 0.158987295],
7474
+ ["U.S. pint", "pt", ["us_pt"], "volume", !1, !0, 473176473e-12],
7475
+ ["U.S. survey mile", "survey_mi", null, "length", !1, !0, 1609.347219],
7476
+ ["U.S. survey/statute acre", "us_acre", null, "area", !1, !0, 4046.87261],
7477
+ ["volt", "V", null, "voltage", !0, !1, 1],
7478
+ ["watt", "W", null, "power", !0, !0, 1],
7479
+ ["watt-hour", "Wh", ["wh"], "energy", !1, !0, 3600],
7480
+ ["weber", "Wb", null, "magnetic_flux", !0, !1, 1],
7481
+ ["yard", "yd", null, "length", !1, !0, 0.9144],
7482
+ ["year", "yr", null, "time", !1, !0, 31557600]
7483
+ ]);
7484
+ // Binary prefixes
7485
+ // [Name, Prefix power of 2 value, Previx value, Abbreviation, Derived from]
7486
+ __publicField(this, "_binaryPrefixes", {
7487
+ Yi: ["yobi", 80, 12089258196146292e8, "Yi", "yotta"],
7488
+ Zi: ["zebi", 70, 11805916207174113e5, "Zi", "zetta"],
7489
+ Ei: ["exbi", 60, 1152921504606847e3, "Ei", "exa"],
7490
+ Pi: ["pebi", 50, 1125899906842624, "Pi", "peta"],
7491
+ Ti: ["tebi", 40, 1099511627776, "Ti", "tera"],
7492
+ Gi: ["gibi", 30, 1073741824, "Gi", "giga"],
7493
+ Mi: ["mebi", 20, 1048576, "Mi", "mega"],
7494
+ ki: ["kibi", 10, 1024, "ki", "kilo"]
7495
+ });
7496
+ // Unit prefixes
7497
+ // [Name, Multiplier, Abbreviation]
7498
+ __publicField(this, "_unitPrefixes", {
7499
+ Y: ["yotta", 1e24, "Y"],
7500
+ Z: ["zetta", 1e21, "Z"],
7501
+ E: ["exa", 1e18, "E"],
7502
+ P: ["peta", 1e15, "P"],
7503
+ T: ["tera", 1e12, "T"],
7504
+ G: ["giga", 1e9, "G"],
7505
+ M: ["mega", 1e6, "M"],
7506
+ k: ["kilo", 1e3, "k"],
7507
+ h: ["hecto", 100, "h"],
7508
+ e: ["dekao", 10, "e"],
7509
+ d: ["deci", 0.1, "d"],
7510
+ c: ["centi", 0.01, "c"],
7511
+ m: ["milli", 1e-3, "m"],
7512
+ u: ["micro", 1e-6, "u"],
7513
+ n: ["nano", 1e-9, "n"],
7514
+ p: ["pico", 1e-12, "p"],
7515
+ f: ["femto", 1e-15, "f"],
7516
+ a: ["atto", 1e-18, "a"],
7517
+ z: ["zepto", 1e-21, "z"],
7518
+ y: ["yocto", 1e-24, "y"]
7519
+ });
7520
+ }
7521
+ calculate(number, fromUnit, toUnit) {
7522
+ const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(number, fromUnit, toUnit);
7523
+ if (isError)
7524
+ return errorObject;
7525
+ const [numberObject, fromUnitObject, toUnitObject] = variants, numberValue = +numberObject.getValue(), fromUnitValue = `${fromUnitObject.getValue()}`, toUnitValue = `${toUnitObject.getValue()}`;
7526
+ if (Number.isNaN(numberValue))
7527
+ return ErrorValueObject.create(ErrorType$1.VALUE);
7528
+ let from, fromMultiplier = 1, to, toMultiplier = 1;
7529
+ const { _from, _to } = this._lookupFromAndToUnits(fromUnitValue, toUnitValue);
7530
+ if (from = _from, to = _to, from === null) {
7531
+ const { _from: _from2, _fromMultiplier } = this._lookupFromPrefix(fromUnitValue);
7532
+ from = _from2, fromMultiplier = _fromMultiplier;
7533
+ }
7534
+ if (to === null) {
7535
+ const { _to: _to2, _toMultiplier } = this._lookupToPrefix(toUnitValue);
7536
+ to = _to2, toMultiplier = _toMultiplier;
7537
+ }
7538
+ if (from === null || to === null || from[3] !== to[3])
7539
+ return ErrorValueObject.create(ErrorType$1.NA);
7540
+ let result;
7541
+ return from[3] === "temperature" ? result = this._getTemperatureConversion(numberValue, from[1], to[1]) : result = numberValue * from[6] * fromMultiplier / (to[6] * toMultiplier), NumberValueObject.create(result);
7542
+ }
7543
+ _lookupFromAndToUnits(fromUnitValue, toUnitValue) {
7544
+ let _from = null, _to = null, alt;
7545
+ for (let i = 0; i < this._units.length; i++)
7546
+ alt = this._units[i][2] === null ? [] : this._units[i][2], (this._units[i][1] === fromUnitValue || alt.indexOf(fromUnitValue) >= 0) && (_from = this._units[i]), (this._units[i][1] === toUnitValue || alt.indexOf(toUnitValue) >= 0) && (_to = this._units[i]);
7547
+ return {
7548
+ _from,
7549
+ _to
7550
+ };
7551
+ }
7552
+ _lookupFromPrefix(fromUnitValue) {
7553
+ let _from = null, _fromMultiplier = 1, baseFromUnit = fromUnitValue, alt;
7554
+ const fromBinaryPrefix = this._binaryPrefixes[fromUnitValue.substring(0, 2)];
7555
+ let fromUnitPrefix = this._unitPrefixes[fromUnitValue.substring(0, 1)];
7556
+ fromUnitValue.substring(0, 2) === "da" && (fromUnitPrefix = ["dekao", 10, "da"]), fromBinaryPrefix ? (_fromMultiplier = fromBinaryPrefix[2], baseFromUnit = fromUnitValue.substring(2)) : fromUnitPrefix && (_fromMultiplier = fromUnitPrefix[1], baseFromUnit = fromUnitValue.substring(fromUnitPrefix[2].length));
7557
+ for (let j = 0; j < this._units.length; j++)
7558
+ alt = this._units[j][2] === null ? [] : this._units[j][2], (this._units[j][1] === baseFromUnit || alt.indexOf(baseFromUnit) >= 0) && (_from = this._units[j]);
7559
+ return {
7560
+ _from,
7561
+ _fromMultiplier
7562
+ };
7563
+ }
7564
+ _lookupToPrefix(toUnitValue) {
7565
+ let _to = null, _toMultiplier = 1, baseToUnit = toUnitValue, alt;
7566
+ const toBinaryPrefix = this._binaryPrefixes[toUnitValue.substring(0, 2)];
7567
+ let toUnitPrefix = this._unitPrefixes[toUnitValue.substring(0, 1)];
7568
+ toUnitValue.substring(0, 2) === "da" && (toUnitPrefix = ["dekao", 10, "da"]), toBinaryPrefix ? (_toMultiplier = toBinaryPrefix[2], baseToUnit = toUnitValue.substring(2)) : toUnitPrefix && (_toMultiplier = toUnitPrefix[1], baseToUnit = toUnitValue.substring(toUnitPrefix[2].length));
7569
+ for (let k = 0; k < this._units.length; k++)
7570
+ alt = this._units[k][2] === null ? [] : this._units[k][2], (this._units[k][1] === baseToUnit || alt.indexOf(baseToUnit) >= 0) && (_to = this._units[k]);
7571
+ return {
7572
+ _to,
7573
+ _toMultiplier
7574
+ };
7575
+ }
7576
+ _getTemperatureConversion(number, from, to) {
7577
+ switch (from) {
7578
+ case "C":
7579
+ return this._centigradeConversion(number, to);
7580
+ case "F":
7581
+ return this._fahrenheitConversion(number, to);
7582
+ case "K":
7583
+ return this._kelvinConversion(number, to);
7584
+ case "Rank":
7585
+ return this._rankineConversion(number, to);
7586
+ case "Reau":
7587
+ return this._reaumurConversion(number, to);
7588
+ default:
7589
+ return number;
7590
+ }
7591
+ }
7592
+ _centigradeConversion(number, to) {
7593
+ switch (to) {
7594
+ case "F":
7595
+ return number * 9 / 5 + 32;
7596
+ case "K":
7597
+ return number + 273.15;
7598
+ case "Rank":
7599
+ return (number + 273.15) * 9 / 5;
7600
+ case "Reau":
7601
+ return number * 4 / 5;
7602
+ default:
7603
+ return number;
7604
+ }
7605
+ }
7606
+ _fahrenheitConversion(number, to) {
7607
+ switch (to) {
7608
+ case "C":
7609
+ return (number - 32) * 5 / 9;
7610
+ case "K":
7611
+ return (number - 32) * 5 / 9 + 273.15;
7612
+ case "Rank":
7613
+ return number + 459.67;
7614
+ case "Reau":
7615
+ return (number - 32) * 4 / 9;
7616
+ default:
7617
+ return number;
7618
+ }
7619
+ }
7620
+ _kelvinConversion(number, to) {
7621
+ switch (to) {
7622
+ case "C":
7623
+ return number - 273.15;
7624
+ case "F":
7625
+ return (number - 273.15) * 9 / 5 + 32;
7626
+ case "Rank":
7627
+ return number * 9 / 5;
7628
+ case "Reau":
7629
+ return (number - 273.15) * 4 / 5;
7630
+ default:
7631
+ return number;
7632
+ }
7633
+ }
7634
+ _rankineConversion(number, to) {
7635
+ switch (to) {
7636
+ case "C":
7637
+ return (number - 491.67) * 5 / 9;
7638
+ case "F":
7639
+ return number - 459.67;
7640
+ case "K":
7641
+ return number * 5 / 9;
7642
+ case "Reau":
7643
+ return (number - 491.67) * 4 / 9;
7644
+ default:
7645
+ return number;
7646
+ }
7647
+ }
7648
+ _reaumurConversion(number, to) {
7649
+ switch (to) {
7650
+ case "C":
7651
+ return number * 5 / 4;
7652
+ case "F":
7653
+ return number * 9 / 4 + 32;
7654
+ case "K":
7655
+ return number * 5 / 4 + 273.15;
7656
+ case "Rank":
7657
+ return number * 9 / 4 + 491.67;
7658
+ default:
7659
+ return number;
7660
+ }
7661
+ }
7662
+ };
7663
+ __name(_Convert, "Convert");
7664
+ let Convert = _Convert;
7665
+ const _Dec2bin = class _Dec2bin extends BaseFunction {
7666
+ constructor() {
7667
+ super(...arguments);
7668
+ __publicField(this, "minParams", 1);
7669
+ __publicField(this, "maxParams", 2);
7670
+ }
7671
+ calculate(number, places) {
7672
+ if (number.isNull())
7673
+ return ErrorValueObject.create(ErrorType$1.NA);
7674
+ let placesValue = 0;
7675
+ if (places) {
7676
+ const { isError: isError2, errorObject: errorObject2, variants: variants2 } = checkVariantsErrorIsArrayOrBoolean(places);
7677
+ if (isError2)
7678
+ return errorObject2;
7679
+ const [placesObject] = variants2;
7680
+ if (placesValue = Math.floor(+placesObject.getValue()), Number.isNaN(placesValue))
7681
+ return ErrorValueObject.create(ErrorType$1.VALUE);
7682
+ if (placesValue < 0 || placesValue > 10)
7683
+ return ErrorValueObject.create(ErrorType$1.NUM);
7684
+ }
7685
+ const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(number);
7686
+ if (isError)
7687
+ return errorObject;
7688
+ const [numberObject] = variants, numberValue = Math.trunc(+numberObject.getValue());
7689
+ if (Number.isNaN(numberValue))
7690
+ return ErrorValueObject.create(ErrorType$1.VALUE);
7691
+ if (!/^-?[0-9]{1,3}$/.test(`${numberValue}`) || numberValue < -512 || numberValue > 511)
7692
+ return ErrorValueObject.create(ErrorType$1.NUM);
7693
+ let result;
7694
+ if (numberValue < 0) {
7695
+ const toStr = (512 + numberValue).toString(2);
7696
+ result = `1${"0".repeat(9 - toStr.length)}${toStr}`;
7697
+ } else if (result = Number.parseInt(`${numberValue}`, 10).toString(2), places) {
7698
+ if (placesValue < result.length)
7699
+ return ErrorValueObject.create(ErrorType$1.NUM);
7700
+ result = "0".repeat(placesValue - result.length) + result;
7701
+ }
7702
+ return StringValueObject.create(result);
7703
+ }
7704
+ };
7705
+ __name(_Dec2bin, "Dec2bin");
7706
+ let Dec2bin = _Dec2bin;
7707
+ const _Dec2hex = class _Dec2hex extends BaseFunction {
7708
+ constructor() {
7709
+ super(...arguments);
7710
+ __publicField(this, "minParams", 1);
7711
+ __publicField(this, "maxParams", 2);
7712
+ }
7713
+ calculate(number, places) {
7714
+ if (number.isNull())
7715
+ return ErrorValueObject.create(ErrorType$1.NA);
7716
+ let placesValue = 0;
7717
+ if (places) {
7718
+ const { isError: isError2, errorObject: errorObject2, variants: variants2 } = checkVariantsErrorIsArrayOrBoolean(places);
7719
+ if (isError2)
7720
+ return errorObject2;
7721
+ const [placesObject] = variants2;
7722
+ if (placesValue = Math.floor(+placesObject.getValue()), Number.isNaN(placesValue))
7723
+ return ErrorValueObject.create(ErrorType$1.VALUE);
7724
+ if (placesValue < 0 || placesValue > 10)
7725
+ return ErrorValueObject.create(ErrorType$1.NUM);
7726
+ }
7727
+ const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(number);
7728
+ if (isError)
7729
+ return errorObject;
7730
+ const [numberObject] = variants, numberValue = Math.trunc(+numberObject.getValue());
7731
+ if (Number.isNaN(numberValue))
7732
+ return ErrorValueObject.create(ErrorType$1.VALUE);
7733
+ if (!/^-?[0-9]{1,12}$/.test(`${numberValue}`) || numberValue < -549755813888 || numberValue > 549755813887)
7734
+ return ErrorValueObject.create(ErrorType$1.NUM);
7735
+ let result;
7736
+ if (numberValue < 0)
7737
+ result = (1099511627776 + numberValue).toString(16);
7738
+ else if (result = Number.parseInt(`${numberValue}`, 10).toString(16), places) {
7739
+ if (placesValue < result.length)
7740
+ return ErrorValueObject.create(ErrorType$1.NUM);
7741
+ result = "0".repeat(placesValue - result.length) + result;
7742
+ }
7743
+ return StringValueObject.create(result.toLocaleUpperCase());
7744
+ }
7745
+ };
7746
+ __name(_Dec2hex, "Dec2hex");
7747
+ let Dec2hex = _Dec2hex;
7748
+ const _Dec2oct = class _Dec2oct extends BaseFunction {
7749
+ constructor() {
7750
+ super(...arguments);
7751
+ __publicField(this, "minParams", 1);
7752
+ __publicField(this, "maxParams", 2);
7753
+ }
7754
+ calculate(number, places) {
7755
+ if (number.isNull())
7756
+ return ErrorValueObject.create(ErrorType$1.NA);
7757
+ let placesValue = 0;
7758
+ if (places) {
7759
+ const { isError: isError2, errorObject: errorObject2, variants: variants2 } = checkVariantsErrorIsArrayOrBoolean(places);
7760
+ if (isError2)
7761
+ return errorObject2;
7762
+ const [placesObject] = variants2;
7763
+ if (placesValue = Math.floor(+placesObject.getValue()), Number.isNaN(placesValue))
7764
+ return ErrorValueObject.create(ErrorType$1.VALUE);
7765
+ if (placesValue < 0 || placesValue > 10)
7766
+ return ErrorValueObject.create(ErrorType$1.NUM);
7767
+ }
7768
+ const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(number);
7769
+ if (isError)
7770
+ return errorObject;
7771
+ const [numberObject] = variants, numberValue = Math.trunc(+numberObject.getValue());
7772
+ if (Number.isNaN(numberValue))
7773
+ return ErrorValueObject.create(ErrorType$1.VALUE);
7774
+ if (!/^-?[0-9]{1,9}$/.test(`${numberValue}`) || numberValue < -536870912 || numberValue > 536870911)
7775
+ return ErrorValueObject.create(ErrorType$1.NUM);
7776
+ let result;
7777
+ if (numberValue < 0)
7778
+ result = (1073741824 + numberValue).toString(8);
7779
+ else if (result = Number.parseInt(`${numberValue}`, 10).toString(8), places) {
7780
+ if (placesValue < result.length)
7781
+ return ErrorValueObject.create(ErrorType$1.NUM);
7782
+ result = "0".repeat(placesValue - result.length) + result;
7783
+ }
7784
+ return StringValueObject.create(result);
7785
+ }
7786
+ };
7787
+ __name(_Dec2oct, "Dec2oct");
7788
+ let Dec2oct = _Dec2oct;
7789
+ const _Delta = class _Delta extends BaseFunction {
7790
+ constructor() {
7791
+ super(...arguments);
7792
+ __publicField(this, "minParams", 1);
7793
+ __publicField(this, "maxParams", 2);
7794
+ }
7795
+ calculate(number1, number2) {
7796
+ const _number2 = number2 != null ? number2 : NumberValueObject.create(0), { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(number1, _number2);
7797
+ if (isError)
7798
+ return errorObject;
7799
+ const [number1Object, number2Object] = variants, number1Value = +number1Object.getValue(), number2Value = +number2Object.getValue();
7800
+ if (Number.isNaN(number1Value) || Number.isNaN(number2Value))
7801
+ return ErrorValueObject.create(ErrorType$1.VALUE);
7802
+ const result = number1Value === number2Value ? 1 : 0;
7803
+ return NumberValueObject.create(result);
7804
+ }
7805
+ };
7806
+ __name(_Delta, "Delta");
7807
+ let Delta = _Delta;
7808
+ const _Erf = class _Erf extends BaseFunction {
7809
+ constructor() {
7810
+ super(...arguments);
7811
+ __publicField(this, "minParams", 1);
7812
+ __publicField(this, "maxParams", 2);
7813
+ }
7814
+ calculate(lowerLimit, upperLimit) {
7815
+ let result;
7816
+ if (upperLimit) {
7817
+ const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(lowerLimit, upperLimit);
7818
+ if (isError)
7819
+ return errorObject;
7820
+ const [lowerLimitObject, upperLimitObject] = variants, lowerLimitValue = +lowerLimitObject.getValue(), upperLimitValue = +upperLimitObject.getValue();
7821
+ if (Number.isNaN(lowerLimitValue) || Number.isNaN(upperLimitValue))
7822
+ return ErrorValueObject.create(ErrorType$1.VALUE);
7823
+ result = erf(upperLimitValue) - erf(lowerLimitValue);
7824
+ } else {
7825
+ const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(lowerLimit);
7826
+ if (isError)
7827
+ return errorObject;
7828
+ const [lowerLimitObject] = variants, lowerLimitValue = +lowerLimitObject.getValue();
7829
+ if (Number.isNaN(lowerLimitValue))
7830
+ return ErrorValueObject.create(ErrorType$1.VALUE);
7831
+ result = erf(lowerLimitValue);
7832
+ }
7833
+ return NumberValueObject.create(result);
7834
+ }
7835
+ };
7836
+ __name(_Erf, "Erf");
7837
+ let Erf = _Erf;
7838
+ const _ErfPrecise = class _ErfPrecise extends BaseFunction {
7839
+ constructor() {
7840
+ super(...arguments);
7841
+ __publicField(this, "minParams", 1);
7842
+ __publicField(this, "maxParams", 1);
7843
+ }
7844
+ calculate(x) {
7845
+ const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(x);
7846
+ if (isError)
7847
+ return errorObject;
7848
+ const [xObject] = variants, xValue = +xObject.getValue();
7849
+ if (Number.isNaN(xValue))
7850
+ return ErrorValueObject.create(ErrorType$1.VALUE);
7851
+ const result = erf(xValue);
7852
+ return NumberValueObject.create(result);
7853
+ }
7854
+ };
7855
+ __name(_ErfPrecise, "ErfPrecise");
7856
+ let ErfPrecise = _ErfPrecise;
7857
+ const _Erfc = class _Erfc extends BaseFunction {
7858
+ constructor() {
7859
+ super(...arguments);
7860
+ __publicField(this, "minParams", 1);
7861
+ __publicField(this, "maxParams", 1);
7862
+ }
7863
+ calculate(x) {
7864
+ const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(x);
7865
+ if (isError)
7866
+ return errorObject;
7867
+ const [xObject] = variants, xValue = +xObject.getValue();
7868
+ if (Number.isNaN(xValue))
7869
+ return ErrorValueObject.create(ErrorType$1.VALUE);
7870
+ const result = 1 - erf(xValue);
7871
+ return NumberValueObject.create(result);
7872
+ }
7873
+ };
7874
+ __name(_Erfc, "Erfc");
7875
+ let Erfc = _Erfc;
7876
+ const _ErfcPrecise = class _ErfcPrecise extends BaseFunction {
7877
+ constructor() {
7878
+ super(...arguments);
7879
+ __publicField(this, "minParams", 1);
7880
+ __publicField(this, "maxParams", 1);
7881
+ }
7882
+ calculate(x) {
7883
+ const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(x);
7884
+ if (isError)
7885
+ return errorObject;
7886
+ const [xObject] = variants, xValue = +xObject.getValue();
7887
+ if (Number.isNaN(xValue))
7888
+ return ErrorValueObject.create(ErrorType$1.VALUE);
7889
+ const result = 1 - erf(xValue);
7890
+ return NumberValueObject.create(result);
7891
+ }
7892
+ };
7893
+ __name(_ErfcPrecise, "ErfcPrecise");
7894
+ let ErfcPrecise = _ErfcPrecise;
7895
+ const _Hex2bin = class _Hex2bin extends BaseFunction {
7896
+ constructor() {
7897
+ super(...arguments);
7898
+ __publicField(this, "minParams", 1);
7899
+ __publicField(this, "maxParams", 2);
7900
+ }
7901
+ calculate(number, places) {
7902
+ if (number.isNull())
7903
+ return ErrorValueObject.create(ErrorType$1.NA);
7904
+ let placesValue = 0;
7905
+ if (places) {
7906
+ const { isError: isError2, errorObject: errorObject2, variants: variants2 } = checkVariantsErrorIsArrayOrBoolean(places);
7907
+ if (isError2)
7908
+ return errorObject2;
7909
+ const [placesObject] = variants2;
7910
+ if (placesValue = Math.floor(+placesObject.getValue()), Number.isNaN(placesValue))
7911
+ return ErrorValueObject.create(ErrorType$1.VALUE);
7912
+ if (placesValue < 0 || placesValue > 10)
7913
+ return ErrorValueObject.create(ErrorType$1.NUM);
7914
+ }
7915
+ const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(number);
7916
+ if (isError)
7917
+ return errorObject;
7918
+ const [numberObject] = variants, numberValue = `${numberObject.getValue()}`;
7919
+ if (!isValidHexadecimalNumber(numberValue))
7920
+ return ErrorValueObject.create(ErrorType$1.NUM);
7921
+ const negative = numberValue.length === 10 && numberValue.substring(0, 1).toLocaleUpperCase() === "F", decimal = negative ? Number.parseInt(numberValue, 16) - 1099511627776 : Number.parseInt(numberValue, 16);
7922
+ if (decimal < -512 || decimal > 511)
7923
+ return ErrorValueObject.create(ErrorType$1.NUM);
7924
+ let result;
7925
+ if (negative) {
7926
+ const toStr = (512 + decimal).toString(2);
7927
+ result = `1${"0".repeat(9 - toStr.length)}${toStr}`;
7928
+ } else if (result = decimal.toString(2), places) {
7929
+ if (placesValue < result.length)
7930
+ return ErrorValueObject.create(ErrorType$1.NUM);
7931
+ result = "0".repeat(placesValue - result.length) + result;
7932
+ }
7933
+ return StringValueObject.create(result);
7934
+ }
7935
+ };
7936
+ __name(_Hex2bin, "Hex2bin");
7937
+ let Hex2bin = _Hex2bin;
7938
+ const _Hex2dec = class _Hex2dec extends BaseFunction {
7939
+ constructor() {
7940
+ super(...arguments);
7941
+ __publicField(this, "minParams", 1);
7942
+ __publicField(this, "maxParams", 1);
7943
+ }
7944
+ calculate(number) {
7945
+ const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(number);
7946
+ if (isError)
7947
+ return errorObject;
7948
+ const [numberObject] = variants, numberValue = `${numberObject.getValue()}`;
7949
+ if (!isValidHexadecimalNumber(numberValue))
7950
+ return ErrorValueObject.create(ErrorType$1.NUM);
7951
+ let result = Number.parseInt(numberValue, 16);
7952
+ return result >= 549755813888 && (result -= 1099511627776), NumberValueObject.create(result);
7953
+ }
7954
+ };
7955
+ __name(_Hex2dec, "Hex2dec");
7956
+ let Hex2dec = _Hex2dec;
7957
+ const _Hex2oct = class _Hex2oct extends BaseFunction {
7958
+ constructor() {
7959
+ super(...arguments);
7960
+ __publicField(this, "minParams", 1);
7961
+ __publicField(this, "maxParams", 2);
7962
+ }
7963
+ calculate(number, places) {
7964
+ if (number.isNull())
7965
+ return ErrorValueObject.create(ErrorType$1.NA);
7966
+ let placesValue = 0;
7967
+ if (places) {
7968
+ const { isError: isError2, errorObject: errorObject2, variants: variants2 } = checkVariantsErrorIsArrayOrBoolean(places);
7969
+ if (isError2)
7970
+ return errorObject2;
7971
+ const [placesObject] = variants2;
7972
+ if (placesValue = Math.floor(+placesObject.getValue()), Number.isNaN(placesValue))
7973
+ return ErrorValueObject.create(ErrorType$1.VALUE);
7974
+ if (placesValue < 0 || placesValue > 10)
7975
+ return ErrorValueObject.create(ErrorType$1.NUM);
7976
+ }
7977
+ const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(number);
7978
+ if (isError)
7979
+ return errorObject;
7980
+ const [numberObject] = variants, numberValue = `${numberObject.getValue()}`;
7981
+ if (!isValidHexadecimalNumber(numberValue))
7982
+ return ErrorValueObject.create(ErrorType$1.NUM);
7983
+ const decimal = Number.parseInt(numberValue, 16);
7984
+ if (decimal > 536870911 && decimal < 1098974756864)
7985
+ return ErrorValueObject.create(ErrorType$1.NUM);
7986
+ let result;
7987
+ if (decimal >= 1098974756864)
7988
+ result = (decimal - 1098437885952).toString(8);
7989
+ else if (result = decimal.toString(8), places) {
7990
+ if (placesValue < result.length)
7991
+ return ErrorValueObject.create(ErrorType$1.NUM);
7992
+ result = "0".repeat(placesValue - result.length) + result;
7993
+ }
7994
+ return StringValueObject.create(result);
7995
+ }
7996
+ };
7997
+ __name(_Hex2oct, "Hex2oct");
7998
+ let Hex2oct = _Hex2oct;
7999
+ const _Oct2bin = class _Oct2bin extends BaseFunction {
8000
+ constructor() {
8001
+ super(...arguments);
8002
+ __publicField(this, "minParams", 1);
8003
+ __publicField(this, "maxParams", 2);
8004
+ }
8005
+ calculate(number, places) {
8006
+ if (number.isNull())
8007
+ return ErrorValueObject.create(ErrorType$1.NA);
8008
+ let placesValue = 0;
8009
+ if (places) {
8010
+ const { isError: isError2, errorObject: errorObject2, variants: variants2 } = checkVariantsErrorIsArrayOrBoolean(places);
8011
+ if (isError2)
8012
+ return errorObject2;
8013
+ const [placesObject] = variants2;
8014
+ if (placesValue = Math.floor(+placesObject.getValue()), Number.isNaN(placesValue))
8015
+ return ErrorValueObject.create(ErrorType$1.VALUE);
8016
+ if (placesValue < 0 || placesValue > 10)
8017
+ return ErrorValueObject.create(ErrorType$1.NUM);
8018
+ }
8019
+ const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(number);
8020
+ if (isError)
8021
+ return errorObject;
8022
+ const [numberObject] = variants, numberValue = `${numberObject.getValue()}`;
8023
+ if (!isValidOctalNumber(numberValue))
8024
+ return ErrorValueObject.create(ErrorType$1.NUM);
8025
+ const negative = numberValue.length === 10 && numberValue.substring(0, 1) === "7", decimal = negative ? Number.parseInt(numberValue, 8) - 1073741824 : Number.parseInt(numberValue, 8);
8026
+ if (decimal < -512 || decimal > 511)
8027
+ return ErrorValueObject.create(ErrorType$1.NUM);
8028
+ let result;
8029
+ if (negative) {
8030
+ const toStr = (512 + decimal).toString(2);
8031
+ result = `1${"0".repeat(9 - toStr.length)}${toStr}`;
8032
+ } else if (result = decimal.toString(2), places) {
8033
+ if (placesValue < result.length)
8034
+ return ErrorValueObject.create(ErrorType$1.NUM);
8035
+ result = "0".repeat(placesValue - result.length) + result;
8036
+ }
8037
+ return StringValueObject.create(result);
8038
+ }
8039
+ };
8040
+ __name(_Oct2bin, "Oct2bin");
8041
+ let Oct2bin = _Oct2bin;
8042
+ const _Oct2dec = class _Oct2dec extends BaseFunction {
8043
+ constructor() {
8044
+ super(...arguments);
8045
+ __publicField(this, "minParams", 1);
8046
+ __publicField(this, "maxParams", 1);
8047
+ }
8048
+ calculate(number) {
8049
+ const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(number);
8050
+ if (isError)
8051
+ return errorObject;
8052
+ const [numberObject] = variants, numberValue = `${numberObject.getValue()}`;
8053
+ if (!isValidOctalNumber(numberValue))
8054
+ return ErrorValueObject.create(ErrorType$1.NUM);
8055
+ let result = Number.parseInt(numberValue, 8);
8056
+ return result >= 536870912 && (result -= 1073741824), NumberValueObject.create(result);
8057
+ }
8058
+ };
8059
+ __name(_Oct2dec, "Oct2dec");
8060
+ let Oct2dec = _Oct2dec;
8061
+ const _Oct2hex = class _Oct2hex extends BaseFunction {
8062
+ constructor() {
8063
+ super(...arguments);
8064
+ __publicField(this, "minParams", 1);
8065
+ __publicField(this, "maxParams", 2);
8066
+ }
8067
+ calculate(number, places) {
8068
+ if (number.isNull())
8069
+ return ErrorValueObject.create(ErrorType$1.NA);
8070
+ let placesValue = 0;
8071
+ if (places) {
8072
+ const { isError: isError2, errorObject: errorObject2, variants: variants2 } = checkVariantsErrorIsArrayOrBoolean(places);
8073
+ if (isError2)
8074
+ return errorObject2;
8075
+ const [placesObject] = variants2;
8076
+ if (placesValue = Math.floor(+placesObject.getValue()), Number.isNaN(placesValue))
8077
+ return ErrorValueObject.create(ErrorType$1.VALUE);
8078
+ if (placesValue < 0 || placesValue > 10)
8079
+ return ErrorValueObject.create(ErrorType$1.NUM);
8080
+ }
8081
+ const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(number);
8082
+ if (isError)
8083
+ return errorObject;
8084
+ const [numberObject] = variants, numberValue = `${numberObject.getValue()}`;
8085
+ if (!isValidOctalNumber(numberValue))
8086
+ return ErrorValueObject.create(ErrorType$1.NUM);
8087
+ const decimal = Number.parseInt(numberValue, 8);
8088
+ let result;
8089
+ if (decimal >= 536870912)
8090
+ result = `ff${(decimal + 3221225472).toString(16)}`;
8091
+ else if (result = decimal.toString(16), places) {
8092
+ if (placesValue < result.length)
8093
+ return ErrorValueObject.create(ErrorType$1.NUM);
8094
+ result = "0".repeat(placesValue - result.length) + result;
8095
+ }
8096
+ return StringValueObject.create(result.toLocaleUpperCase());
8097
+ }
8098
+ };
8099
+ __name(_Oct2hex, "Oct2hex");
8100
+ let Oct2hex = _Oct2hex;
8101
+ const functionEngineering = [
8102
+ [Besseli, FUNCTION_NAMES_ENGINEERING.BESSELI],
8103
+ [Besselj, FUNCTION_NAMES_ENGINEERING.BESSELJ],
8104
+ [Besselk, FUNCTION_NAMES_ENGINEERING.BESSELK],
8105
+ [Bessely, FUNCTION_NAMES_ENGINEERING.BESSELY],
8106
+ [Bin2dec, FUNCTION_NAMES_ENGINEERING.BIN2DEC],
8107
+ [Bin2hex, FUNCTION_NAMES_ENGINEERING.BIN2HEX],
8108
+ [Bin2oct, FUNCTION_NAMES_ENGINEERING.BIN2OCT],
8109
+ [Bitand, FUNCTION_NAMES_ENGINEERING.BITAND],
8110
+ [Bitlshift, FUNCTION_NAMES_ENGINEERING.BITLSHIFT],
8111
+ [Bitor, FUNCTION_NAMES_ENGINEERING.BITOR],
8112
+ [Bitrshift, FUNCTION_NAMES_ENGINEERING.BITRSHIFT],
8113
+ [Bitxor, FUNCTION_NAMES_ENGINEERING.BITXOR],
8114
+ [Complex, FUNCTION_NAMES_ENGINEERING.COMPLEX],
8115
+ [Convert, FUNCTION_NAMES_ENGINEERING.CONVERT],
8116
+ [Dec2bin, FUNCTION_NAMES_ENGINEERING.DEC2BIN],
8117
+ [Dec2hex, FUNCTION_NAMES_ENGINEERING.DEC2HEX],
8118
+ [Dec2oct, FUNCTION_NAMES_ENGINEERING.DEC2OCT],
8119
+ [Delta, FUNCTION_NAMES_ENGINEERING.DELTA],
8120
+ [Erf, FUNCTION_NAMES_ENGINEERING.ERF],
8121
+ [ErfPrecise, FUNCTION_NAMES_ENGINEERING.ERF_PRECISE],
8122
+ [Erfc, FUNCTION_NAMES_ENGINEERING.ERFC],
8123
+ [ErfcPrecise, FUNCTION_NAMES_ENGINEERING.ERFC_PRECISE],
8124
+ [Hex2bin, FUNCTION_NAMES_ENGINEERING.HEX2BIN],
8125
+ [Hex2dec, FUNCTION_NAMES_ENGINEERING.HEX2DEC],
8126
+ [Hex2oct, FUNCTION_NAMES_ENGINEERING.HEX2OCT],
8127
+ [Oct2bin, FUNCTION_NAMES_ENGINEERING.OCT2BIN],
8128
+ [Oct2dec, FUNCTION_NAMES_ENGINEERING.OCT2DEC],
8129
+ [Oct2hex, FUNCTION_NAMES_ENGINEERING.OCT2HEX]
8130
+ ];
8131
+ var FUNCTION_NAMES_FINANCIAL = /* @__PURE__ */ ((FUNCTION_NAMES_FINANCIAL2) => (FUNCTION_NAMES_FINANCIAL2.ACCRINT = "ACCRINT", FUNCTION_NAMES_FINANCIAL2.ACCRINTM = "ACCRINTM", FUNCTION_NAMES_FINANCIAL2.AMORDEGRC = "AMORDEGRC", FUNCTION_NAMES_FINANCIAL2.AMORLINC = "AMORLINC", FUNCTION_NAMES_FINANCIAL2.COUPDAYBS = "COUPDAYBS", FUNCTION_NAMES_FINANCIAL2.COUPDAYS = "COUPDAYS", FUNCTION_NAMES_FINANCIAL2.COUPDAYSNC = "COUPDAYSNC", FUNCTION_NAMES_FINANCIAL2.COUPNCD = "COUPNCD", FUNCTION_NAMES_FINANCIAL2.COUPNUM = "COUPNUM", FUNCTION_NAMES_FINANCIAL2.COUPPCD = "COUPPCD", FUNCTION_NAMES_FINANCIAL2.CUMIPMT = "CUMIPMT", FUNCTION_NAMES_FINANCIAL2.CUMPRINC = "CUMPRINC", FUNCTION_NAMES_FINANCIAL2.DB = "DB", FUNCTION_NAMES_FINANCIAL2.DDB = "DDB", FUNCTION_NAMES_FINANCIAL2.DISC = "DISC", FUNCTION_NAMES_FINANCIAL2.DOLLARDE = "DOLLARDE", FUNCTION_NAMES_FINANCIAL2.DOLLARFR = "DOLLARFR", FUNCTION_NAMES_FINANCIAL2.DURATION = "DURATION", FUNCTION_NAMES_FINANCIAL2.EFFECT = "EFFECT", FUNCTION_NAMES_FINANCIAL2.FV = "FV", FUNCTION_NAMES_FINANCIAL2.FVSCHEDULE = "FVSCHEDULE", FUNCTION_NAMES_FINANCIAL2.INTRATE = "INTRATE", FUNCTION_NAMES_FINANCIAL2.IPMT = "IPMT", FUNCTION_NAMES_FINANCIAL2.IRR = "IRR", FUNCTION_NAMES_FINANCIAL2.ISPMT = "ISPMT", FUNCTION_NAMES_FINANCIAL2.MDURATION = "MDURATION", FUNCTION_NAMES_FINANCIAL2.MIRR = "MIRR", FUNCTION_NAMES_FINANCIAL2.NOMINAL = "NOMINAL", FUNCTION_NAMES_FINANCIAL2.NPER = "NPER", FUNCTION_NAMES_FINANCIAL2.NPV = "NPV", FUNCTION_NAMES_FINANCIAL2.ODDFPRICE = "ODDFPRICE", FUNCTION_NAMES_FINANCIAL2.ODDFYIELD = "ODDFYIELD", FUNCTION_NAMES_FINANCIAL2.ODDLPRICE = "ODDLPRICE", FUNCTION_NAMES_FINANCIAL2.ODDLYIELD = "ODDLYIELD", FUNCTION_NAMES_FINANCIAL2.PDURATION = "PDURATION", FUNCTION_NAMES_FINANCIAL2.PMT = "PMT", FUNCTION_NAMES_FINANCIAL2.PPMT = "PPMT", FUNCTION_NAMES_FINANCIAL2.PRICE = "PRICE", FUNCTION_NAMES_FINANCIAL2.PRICEDISC = "PRICEDISC", FUNCTION_NAMES_FINANCIAL2.PRICEMAT = "PRICEMAT", FUNCTION_NAMES_FINANCIAL2.PV = "PV", FUNCTION_NAMES_FINANCIAL2.RATE = "RATE", FUNCTION_NAMES_FINANCIAL2.RECEIVED = "RECEIVED", FUNCTION_NAMES_FINANCIAL2.RRI = "RRI", FUNCTION_NAMES_FINANCIAL2.SLN = "SLN", FUNCTION_NAMES_FINANCIAL2.SYD = "SYD", FUNCTION_NAMES_FINANCIAL2.TBILLEQ = "TBILLEQ", FUNCTION_NAMES_FINANCIAL2.TBILLPRICE = "TBILLPRICE", FUNCTION_NAMES_FINANCIAL2.TBILLYIELD = "TBILLYIELD", FUNCTION_NAMES_FINANCIAL2.VDB = "VDB", FUNCTION_NAMES_FINANCIAL2.XIRR = "XIRR", FUNCTION_NAMES_FINANCIAL2.XNPV = "XNPV", FUNCTION_NAMES_FINANCIAL2.YIELD = "YIELD", FUNCTION_NAMES_FINANCIAL2.YIELDDISC = "YIELDDISC", FUNCTION_NAMES_FINANCIAL2.YIELDMAT = "YIELDMAT", FUNCTION_NAMES_FINANCIAL2))(FUNCTION_NAMES_FINANCIAL || {});
8132
+ const _Accrint = class _Accrint extends BaseFunction {
8133
+ constructor() {
8134
+ super(...arguments);
8135
+ __publicField(this, "minParams", 6);
8136
+ __publicField(this, "maxParams", 8);
8137
+ }
8138
+ calculate(issue, firstInterest, settlement, rate, par, frequency, basis, calcMethod) {
8139
+ const _basis = basis != null ? basis : NumberValueObject.create(0), _calcMethod = calcMethod != null ? calcMethod : BooleanValueObject.create(!0), { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(issue, firstInterest, settlement, rate, par, frequency, _basis);
8140
+ if (isError)
8141
+ return errorObject;
8142
+ const [issueObject, firstInterestObject, settlementObject, rateObject, parObject, frequencyObject, basisObject] = variants, issueSerialNumber = getDateSerialNumberByObject(issueObject);
8143
+ if (typeof issueSerialNumber != "number")
8144
+ return issueSerialNumber;
8145
+ const firstInterestSerialNumber = getDateSerialNumberByObject(firstInterestObject);
8146
+ if (typeof firstInterestSerialNumber != "number")
8147
+ return firstInterestSerialNumber;
8148
+ const settlementSerialNumber = getDateSerialNumberByObject(settlementObject);
8149
+ if (typeof settlementSerialNumber != "number")
8150
+ return settlementSerialNumber;
8151
+ const rateValue = +rateObject.getValue(), parValue = +parObject.getValue(), frequencyValue = Math.floor(+frequencyObject.getValue()), basisValue = Math.floor(+basisObject.getValue()), calcMethodValue = +_calcMethod.getValue();
8152
+ return Number.isNaN(rateValue) || Number.isNaN(parValue) || Number.isNaN(frequencyValue) || Number.isNaN(basisValue) || Number.isNaN(calcMethodValue) ? ErrorValueObject.create(ErrorType$1.VALUE) : rateValue <= 0 || parValue <= 0 || ![1, 2, 4].includes(frequencyValue) || basisValue < 0 || basisValue > 4 || Math.floor(issueSerialNumber) >= Math.floor(settlementSerialNumber) ? ErrorValueObject.create(ErrorType$1.NUM) : this._getResult(issueSerialNumber, firstInterestSerialNumber, settlementSerialNumber, rateValue, parValue, frequencyValue, basisValue, calcMethodValue);
8153
+ }
8154
+ _getResult(issueSerialNumber, firstInterestSerialNumber, settlementSerialNumber, rateValue, parValue, frequencyValue, basisValue, calcMethodValue) {
8155
+ let TwoDateDays;
8156
+ Math.floor(settlementSerialNumber) >= Math.floor(firstInterestSerialNumber) && !calcMethodValue ? TwoDateDays = getTwoDateDaysByBasis(firstInterestSerialNumber, settlementSerialNumber, basisValue) : TwoDateDays = getTwoDateDaysByBasis(issueSerialNumber, settlementSerialNumber, basisValue);
8157
+ const { days, yearDays } = TwoDateDays, NC = Math.ceil(days / yearDays * frequencyValue), NLi = yearDays / frequencyValue;
8158
+ let accruedDaysSum = 0;
8159
+ for (let i = 1; i <= NC; i++)
8160
+ if (i * NLi > days) {
8161
+ const Ai = days - (i - 1) * NLi;
8162
+ accruedDaysSum += Ai / NLi;
8163
+ } else
8164
+ accruedDaysSum += 1;
8165
+ const result = parValue * (rateValue / frequencyValue) * accruedDaysSum;
8166
+ return NumberValueObject.create(result);
8167
+ }
8168
+ };
8169
+ __name(_Accrint, "Accrint");
8170
+ let Accrint = _Accrint;
8171
+ const _Accrintm = class _Accrintm extends BaseFunction {
8172
+ constructor() {
8173
+ super(...arguments);
8174
+ __publicField(this, "minParams", 4);
8175
+ __publicField(this, "maxParams", 5);
8176
+ }
8177
+ calculate(issue, settlement, rate, par, basis) {
8178
+ const _basis = basis != null ? basis : NumberValueObject.create(0), { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(issue, settlement, rate, par, _basis);
8179
+ if (isError)
8180
+ return errorObject;
8181
+ const [issueObject, settlementObject, rateObject, parObject, basisObject] = variants, issueSerialNumber = getDateSerialNumberByObject(issueObject);
8182
+ if (typeof issueSerialNumber != "number")
8183
+ return issueSerialNumber;
8184
+ const settlementSerialNumber = getDateSerialNumberByObject(settlementObject);
8185
+ if (typeof settlementSerialNumber != "number")
8186
+ return settlementSerialNumber;
8187
+ const rateValue = +rateObject.getValue(), parValue = +parObject.getValue(), basisValue = Math.floor(+basisObject.getValue());
8188
+ if (Number.isNaN(rateValue) || Number.isNaN(parValue) || Number.isNaN(basisValue))
8189
+ return ErrorValueObject.create(ErrorType$1.VALUE);
8190
+ if (rateValue <= 0 || parValue <= 0 || basisValue < 0 || basisValue > 4 || Math.floor(issueSerialNumber) > Math.floor(settlementSerialNumber))
8191
+ return ErrorValueObject.create(ErrorType$1.NUM);
8192
+ if (Math.floor(issueSerialNumber) === Math.floor(settlementSerialNumber))
8193
+ return NumberValueObject.create(0);
8194
+ const { days, yearDays } = getTwoDateDaysByBasis(issueSerialNumber, settlementSerialNumber, basisValue), result = parValue * rateValue * days / yearDays;
8195
+ return NumberValueObject.create(result);
8196
+ }
8197
+ };
8198
+ __name(_Accrintm, "Accrintm");
8199
+ let Accrintm = _Accrintm;
8200
+ const _Amorlinc = class _Amorlinc extends BaseFunction {
8201
+ constructor() {
8202
+ super(...arguments);
8203
+ __publicField(this, "minParams", 6);
8204
+ __publicField(this, "maxParams", 7);
8205
+ }
8206
+ calculate(cost, datePurchased, firstPeriod, salvage, period, rate, basis) {
8207
+ const _basis = basis != null ? basis : NumberValueObject.create(0), { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(cost, datePurchased, firstPeriod, salvage, period, rate, _basis);
8208
+ if (isError)
8209
+ return errorObject;
8210
+ const [costObject, datePurchasedObject, firstPeriodObject, salvageObject, periodObject, rateObject, basisObject] = variants, datePurchasedSerialNumber = getDateSerialNumberByObject(datePurchasedObject);
8211
+ if (typeof datePurchasedSerialNumber != "number")
8212
+ return datePurchasedSerialNumber;
8213
+ const firstPeriodSerialNumber = getDateSerialNumberByObject(firstPeriodObject);
8214
+ if (typeof firstPeriodSerialNumber != "number")
8215
+ return firstPeriodSerialNumber;
8216
+ const costValue = +costObject.getValue(), salvageValue = +salvageObject.getValue();
8217
+ let periodValue = +periodObject.getValue();
8218
+ const rateValue = +rateObject.getValue(), basisValue = Math.floor(+basisObject.getValue());
8219
+ return Number.isNaN(costValue) || Number.isNaN(salvageValue) || Number.isNaN(periodValue) || Number.isNaN(rateValue) || Number.isNaN(basisValue) ? ErrorValueObject.create(ErrorType$1.VALUE) : costValue <= 0 || salvageValue < 0 || costValue < salvageValue || Math.floor(datePurchasedSerialNumber) > Math.floor(firstPeriodSerialNumber) || periodValue < 0 || rateValue <= 0 || ![0, 1, 3, 4].includes(basisValue) ? ErrorValueObject.create(ErrorType$1.NUM) : (periodValue > 1 ? periodValue = Math.floor(periodValue) : periodValue = Math.ceil(periodValue), this._getResult(costValue, datePurchasedSerialNumber, firstPeriodSerialNumber, salvageValue, periodValue, rateValue, basisValue));
8220
+ }
8221
+ _getResult(costValue, datePurchasedSerialNumber, firstPeriodSerialNumber, salvageValue, periodValue, rateValue, basisValue) {
8222
+ const totalDepreciation = costValue - salvageValue, baseDepreciation = costValue * rateValue, { days, yearDays } = getTwoDateDaysByBasis(datePurchasedSerialNumber, firstPeriodSerialNumber, basisValue), firstPeriodYearsFraction = days / yearDays, life = Math.ceil(totalDepreciation / baseDepreciation - firstPeriodYearsFraction);
8223
+ if (life < 0)
8224
+ return NumberValueObject.create(costValue);
8225
+ let result = baseDepreciation;
8226
+ return periodValue === 0 ? result = baseDepreciation * firstPeriodYearsFraction : periodValue === life ? result = totalDepreciation - baseDepreciation * (firstPeriodYearsFraction + periodValue - 1) : periodValue > life && (result = 0), NumberValueObject.create(result);
8227
+ }
8228
+ };
8229
+ __name(_Amorlinc, "Amorlinc");
8230
+ let Amorlinc = _Amorlinc;
8231
+ const _Coupdaybs = class _Coupdaybs extends BaseFunction {
8232
+ constructor() {
8233
+ super(...arguments);
8234
+ __publicField(this, "minParams", 3);
8235
+ __publicField(this, "maxParams", 4);
8236
+ }
8237
+ calculate(settlement, maturity, frequency, basis) {
8238
+ const _basis = basis != null ? basis : NumberValueObject.create(0), { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(settlement, maturity, frequency, _basis);
8239
+ if (isError)
8240
+ return errorObject;
8241
+ const [settlementObject, maturityObject, frequencyObject, basisObject] = variants, settlementSerialNumber = getDateSerialNumberByObject(settlementObject);
8242
+ if (typeof settlementSerialNumber != "number")
8243
+ return settlementSerialNumber;
8244
+ const maturitySerialNumber = getDateSerialNumberByObject(maturityObject);
8245
+ if (typeof maturitySerialNumber != "number")
8246
+ return maturitySerialNumber;
8247
+ const frequencyValue = Math.floor(+frequencyObject.getValue()), basisValue = Math.floor(+basisObject.getValue());
8248
+ if (Number.isNaN(frequencyValue) || Number.isNaN(basisValue))
8249
+ return ErrorValueObject.create(ErrorType$1.VALUE);
8250
+ if (![1, 2, 4].includes(frequencyValue) || basisValue < 0 || basisValue > 4 || Math.floor(settlementSerialNumber) >= Math.floor(maturitySerialNumber))
8251
+ return ErrorValueObject.create(ErrorType$1.NUM);
8252
+ const settlementDate = excelSerialToDate(settlementSerialNumber), coupDate = excelSerialToDate(maturitySerialNumber);
8253
+ for (coupDate.setUTCFullYear(settlementDate.getUTCFullYear()), coupDate < settlementDate && coupDate.setUTCFullYear(coupDate.getUTCFullYear() + 1); coupDate > settlementDate; )
8254
+ coupDate.setUTCMonth(coupDate.getUTCMonth() - 12 / frequencyValue);
8255
+ let coupDateSerialNumber = excelDateSerial(coupDate);
8256
+ coupDateSerialNumber < 0 && (coupDateSerialNumber = 0);
8257
+ const { days } = getTwoDateDaysByBasis(coupDateSerialNumber, settlementSerialNumber, basisValue);
8258
+ return NumberValueObject.create(days);
8259
+ }
8260
+ };
8261
+ __name(_Coupdaybs, "Coupdaybs");
8262
+ let Coupdaybs = _Coupdaybs;
8263
+ const _Coupdays = class _Coupdays extends BaseFunction {
8264
+ constructor() {
8265
+ super(...arguments);
8266
+ __publicField(this, "minParams", 3);
8267
+ __publicField(this, "maxParams", 4);
8268
+ }
8269
+ calculate(settlement, maturity, frequency, basis) {
8270
+ const _basis = basis != null ? basis : NumberValueObject.create(0), { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(settlement, maturity, frequency, _basis);
8271
+ if (isError)
8272
+ return errorObject;
8273
+ const [settlementObject, maturityObject, frequencyObject, basisObject] = variants, settlementSerialNumber = getDateSerialNumberByObject(settlementObject);
8274
+ if (typeof settlementSerialNumber != "number")
8275
+ return settlementSerialNumber;
8276
+ const maturitySerialNumber = getDateSerialNumberByObject(maturityObject);
8277
+ if (typeof maturitySerialNumber != "number")
8278
+ return maturitySerialNumber;
8279
+ const frequencyValue = Math.floor(+frequencyObject.getValue()), basisValue = Math.floor(+basisObject.getValue());
8280
+ if (Number.isNaN(frequencyValue) || Number.isNaN(basisValue))
8281
+ return ErrorValueObject.create(ErrorType$1.VALUE);
8282
+ if (![1, 2, 4].includes(frequencyValue) || basisValue < 0 || basisValue > 4 || Math.floor(settlementSerialNumber) >= Math.floor(maturitySerialNumber))
8283
+ return ErrorValueObject.create(ErrorType$1.NUM);
8284
+ let result;
8285
+ if (basisValue === 1) {
8286
+ const settlementDate = excelSerialToDate(settlementSerialNumber), coupDate = excelSerialToDate(maturitySerialNumber);
8287
+ for (coupDate.setUTCFullYear(settlementDate.getUTCFullYear()), coupDate < settlementDate && coupDate.setUTCFullYear(coupDate.getUTCFullYear() + 1); coupDate > settlementDate; )
8288
+ coupDate.setUTCMonth(coupDate.getUTCMonth() - 12 / frequencyValue);
8289
+ const beforeSettlementDateSerialNumber = excelDateSerial(coupDate);
8290
+ coupDate.setUTCMonth(coupDate.getUTCMonth() + 12 / frequencyValue);
8291
+ const afterSettlementDateSerialNumber = excelDateSerial(coupDate);
8292
+ beforeSettlementDateSerialNumber < 0 && frequencyValue === 1 ? result = 365 : result = afterSettlementDateSerialNumber - beforeSettlementDateSerialNumber;
8293
+ } else basisValue === 3 ? result = 365 / frequencyValue : result = 360 / frequencyValue;
8294
+ return NumberValueObject.create(result);
8295
+ }
8296
+ };
8297
+ __name(_Coupdays, "Coupdays");
8298
+ let Coupdays = _Coupdays;
8299
+ const _Coupdaysnc = class _Coupdaysnc extends BaseFunction {
8300
+ constructor() {
8301
+ super(...arguments);
8302
+ __publicField(this, "minParams", 3);
8303
+ __publicField(this, "maxParams", 4);
8304
+ }
8305
+ calculate(settlement, maturity, frequency, basis) {
8306
+ const _basis = basis != null ? basis : NumberValueObject.create(0), { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(settlement, maturity, frequency, _basis);
8307
+ if (isError)
8308
+ return errorObject;
8309
+ const [settlementObject, maturityObject, frequencyObject, basisObject] = variants, settlementSerialNumber = getDateSerialNumberByObject(settlementObject);
8310
+ if (typeof settlementSerialNumber != "number")
8311
+ return settlementSerialNumber;
8312
+ const maturitySerialNumber = getDateSerialNumberByObject(maturityObject);
8313
+ if (typeof maturitySerialNumber != "number")
8314
+ return maturitySerialNumber;
8315
+ const frequencyValue = Math.floor(+frequencyObject.getValue()), basisValue = Math.floor(+basisObject.getValue());
8316
+ if (Number.isNaN(frequencyValue) || Number.isNaN(basisValue))
8317
+ return ErrorValueObject.create(ErrorType$1.VALUE);
8318
+ if (![1, 2, 4].includes(frequencyValue) || basisValue < 0 || basisValue > 4 || Math.floor(settlementSerialNumber) >= Math.floor(maturitySerialNumber))
8319
+ return ErrorValueObject.create(ErrorType$1.NUM);
8320
+ const settlementDate = excelSerialToDate(settlementSerialNumber), coupDate = excelSerialToDate(maturitySerialNumber);
8321
+ for (coupDate.setUTCFullYear(settlementDate.getUTCFullYear()), coupDate < settlementDate && coupDate.setUTCFullYear(coupDate.getUTCFullYear() + 1); coupDate > settlementDate; )
8322
+ coupDate.setUTCMonth(coupDate.getUTCMonth() - 12 / frequencyValue);
8323
+ coupDate.setUTCMonth(coupDate.getUTCMonth() + 12 / frequencyValue);
8324
+ const coupDateSerialNumber = excelDateSerial(coupDate), { days } = getTwoDateDaysByBasis(settlementSerialNumber, coupDateSerialNumber, basisValue);
8325
+ return NumberValueObject.create(days);
8326
+ }
8327
+ };
8328
+ __name(_Coupdaysnc, "Coupdaysnc");
8329
+ let Coupdaysnc = _Coupdaysnc;
8330
+ const _Coupncd = class _Coupncd extends BaseFunction {
8331
+ constructor() {
8332
+ super(...arguments);
8333
+ __publicField(this, "minParams", 3);
8334
+ __publicField(this, "maxParams", 4);
8335
+ }
8336
+ calculate(settlement, maturity, frequency, basis) {
8337
+ const _basis = basis != null ? basis : NumberValueObject.create(0), { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(settlement, maturity, frequency, _basis);
8338
+ if (isError)
8339
+ return errorObject;
8340
+ const [settlementObject, maturityObject, frequencyObject, basisObject] = variants, settlementSerialNumber = getDateSerialNumberByObject(settlementObject);
8341
+ if (typeof settlementSerialNumber != "number")
8342
+ return settlementSerialNumber;
8343
+ const maturitySerialNumber = getDateSerialNumberByObject(maturityObject);
8344
+ if (typeof maturitySerialNumber != "number")
8345
+ return maturitySerialNumber;
8346
+ const frequencyValue = Math.floor(+frequencyObject.getValue()), basisValue = Math.floor(+basisObject.getValue());
8347
+ if (Number.isNaN(frequencyValue) || Number.isNaN(basisValue))
8348
+ return ErrorValueObject.create(ErrorType$1.VALUE);
8349
+ if (![1, 2, 4].includes(frequencyValue) || basisValue < 0 || basisValue > 4 || Math.floor(settlementSerialNumber) >= Math.floor(maturitySerialNumber))
8350
+ return ErrorValueObject.create(ErrorType$1.NUM);
8351
+ const settlementDate = excelSerialToDate(settlementSerialNumber), coupDate = excelSerialToDate(maturitySerialNumber);
8352
+ for (coupDate.setUTCFullYear(settlementDate.getUTCFullYear()), coupDate < settlementDate && coupDate.setUTCFullYear(coupDate.getUTCFullYear() + 1); coupDate > settlementDate; )
8353
+ coupDate.setUTCMonth(coupDate.getUTCMonth() - 12 / frequencyValue);
8354
+ coupDate.setUTCMonth(coupDate.getUTCMonth() + 12 / frequencyValue);
8355
+ const coupDateSerialNumber = excelDateSerial(coupDate);
8356
+ return NumberValueObject.create(coupDateSerialNumber);
8357
+ }
8358
+ };
8359
+ __name(_Coupncd, "Coupncd");
8360
+ let Coupncd = _Coupncd;
8361
+ const _Coupnum = class _Coupnum extends BaseFunction {
8362
+ constructor() {
8363
+ super(...arguments);
8364
+ __publicField(this, "minParams", 3);
8365
+ __publicField(this, "maxParams", 4);
8366
+ }
8367
+ calculate(settlement, maturity, frequency, basis) {
8368
+ const _basis = basis != null ? basis : NumberValueObject.create(0), { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(settlement, maturity, frequency, _basis);
8369
+ if (isError)
8370
+ return errorObject;
8371
+ const [settlementObject, maturityObject, frequencyObject, basisObject] = variants, settlementSerialNumber = getDateSerialNumberByObject(settlementObject);
8372
+ if (typeof settlementSerialNumber != "number")
8373
+ return settlementSerialNumber;
8374
+ const maturitySerialNumber = getDateSerialNumberByObject(maturityObject);
8375
+ if (typeof maturitySerialNumber != "number")
8376
+ return maturitySerialNumber;
8377
+ const frequencyValue = Math.floor(+frequencyObject.getValue()), basisValue = Math.floor(+basisObject.getValue());
8378
+ if (Number.isNaN(frequencyValue) || Number.isNaN(basisValue))
8379
+ return ErrorValueObject.create(ErrorType$1.VALUE);
8380
+ if (![1, 2, 4].includes(frequencyValue) || basisValue < 0 || basisValue > 4 || Math.floor(settlementSerialNumber) >= Math.floor(maturitySerialNumber))
8381
+ return ErrorValueObject.create(ErrorType$1.NUM);
8382
+ let result = 0;
8383
+ const settlementDate = excelSerialToDate(settlementSerialNumber), coupDate = excelSerialToDate(maturitySerialNumber);
8384
+ for (; coupDate > settlementDate; )
8385
+ coupDate.setUTCMonth(coupDate.getUTCMonth() - 12 / frequencyValue), result++;
8386
+ return excelDateSerial(coupDate) < 0 ? ErrorValueObject.create(ErrorType$1.NUM) : NumberValueObject.create(result);
8387
+ }
8388
+ };
8389
+ __name(_Coupnum, "Coupnum");
8390
+ let Coupnum = _Coupnum;
8391
+ const _Couppcd = class _Couppcd extends BaseFunction {
8392
+ constructor() {
8393
+ super(...arguments);
8394
+ __publicField(this, "minParams", 3);
8395
+ __publicField(this, "maxParams", 4);
8396
+ }
8397
+ calculate(settlement, maturity, frequency, basis) {
8398
+ const _basis = basis != null ? basis : NumberValueObject.create(0), { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(settlement, maturity, frequency, _basis);
8399
+ if (isError)
8400
+ return errorObject;
8401
+ const [settlementObject, maturityObject, frequencyObject, basisObject] = variants, settlementSerialNumber = getDateSerialNumberByObject(settlementObject);
8402
+ if (typeof settlementSerialNumber != "number")
8403
+ return settlementSerialNumber;
8404
+ const maturitySerialNumber = getDateSerialNumberByObject(maturityObject);
8405
+ if (typeof maturitySerialNumber != "number")
8406
+ return maturitySerialNumber;
8407
+ const frequencyValue = Math.floor(+frequencyObject.getValue()), basisValue = Math.floor(+basisObject.getValue());
8408
+ if (Number.isNaN(frequencyValue) || Number.isNaN(basisValue))
8409
+ return ErrorValueObject.create(ErrorType$1.VALUE);
8410
+ if (![1, 2, 4].includes(frequencyValue) || basisValue < 0 || basisValue > 4 || Math.floor(settlementSerialNumber) >= Math.floor(maturitySerialNumber))
8411
+ return ErrorValueObject.create(ErrorType$1.NUM);
8412
+ const settlementDate = excelSerialToDate(settlementSerialNumber), coupDate = excelSerialToDate(maturitySerialNumber);
8413
+ for (coupDate.setUTCFullYear(settlementDate.getUTCFullYear()), coupDate < settlementDate && coupDate.setUTCFullYear(coupDate.getUTCFullYear() + 1); coupDate > settlementDate; )
8414
+ coupDate.setUTCMonth(coupDate.getUTCMonth() - 12 / frequencyValue);
8415
+ let coupDateSerialNumber = excelDateSerial(coupDate);
8416
+ return coupDateSerialNumber < 0 && (coupDateSerialNumber = 0), NumberValueObject.create(coupDateSerialNumber);
8417
+ }
8418
+ };
8419
+ __name(_Couppcd, "Couppcd");
8420
+ let Couppcd = _Couppcd;
8421
+ function calculatePMT(rate, nper, pv, fv, type) {
8422
+ let result;
8423
+ if (rate === 0)
8424
+ result = (pv + fv) / nper;
8425
+ else {
8426
+ const term = (1 + rate) ** nper;
8427
+ result = type === 1 ? (fv * rate / (term - 1) + pv * rate / (1 - 1 / term)) / (1 + rate) : fv * rate / (term - 1) + pv * rate / (1 - 1 / term);
8428
+ }
8429
+ return -result;
8430
+ }
8431
+ __name(calculatePMT, "calculatePMT");
8432
+ function calculateFV(rate, nper, pmt, pv, type) {
8433
+ let result;
8434
+ if (rate === 0)
8435
+ result = pv + pmt * nper;
8436
+ else {
8437
+ const term = (1 + rate) ** nper;
8438
+ result = type === 1 ? pv * term + pmt * (1 + rate) * (term - 1) / rate : pv * term + pmt * (term - 1) / rate;
8439
+ }
8440
+ return -result;
8441
+ }
8442
+ __name(calculateFV, "calculateFV");
8443
+ function calculateIPMT(rate, per, nper, pv, fv, type) {
8444
+ const payment = calculatePMT(rate, nper, pv, fv, type);
8445
+ return (per === 1 ? type === 1 ? 0 : -pv : type === 1 ? calculateFV(rate, per - 2, payment, pv, 1) - payment : calculateFV(rate, per - 1, payment, pv, 0)) * rate;
8446
+ }
8447
+ __name(calculateIPMT, "calculateIPMT");
8448
+ const _Cumipmt = class _Cumipmt extends BaseFunction {
8449
+ constructor() {
8450
+ super(...arguments);
8451
+ __publicField(this, "minParams", 6);
8452
+ __publicField(this, "maxParams", 6);
8453
+ }
8454
+ calculate(rate, nper, pv, startPeriod, endPeriod, type) {
8455
+ const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(rate, nper, pv, startPeriod, endPeriod, type);
8456
+ if (isError)
8457
+ return errorObject;
8458
+ const [rateObject, nperObject, pvObject, startPeriodObject, endPeriodObject, typeObject] = variants, rateValue = +rateObject.getValue(), nperValue = +nperObject.getValue(), pvValue = +pvObject.getValue(), startPeriodValue = +startPeriodObject.getValue(), endPeriodValue = +endPeriodObject.getValue(), typeValue = +typeObject.getValue();
8459
+ return Number.isNaN(rateValue) || Number.isNaN(nperValue) || Number.isNaN(pvValue) || Number.isNaN(startPeriodValue) || Number.isNaN(endPeriodValue) || Number.isNaN(typeValue) ? ErrorValueObject.create(ErrorType$1.VALUE) : rateValue <= 0 || nperValue <= 0 || pvValue <= 0 || startPeriodValue < 1 || endPeriodValue < 1 || startPeriodValue > endPeriodValue || startPeriodValue > nperValue || endPeriodValue > nperValue || ![0, 1].includes(typeValue) ? ErrorValueObject.create(ErrorType$1.NUM) : Math.trunc(startPeriodValue) !== startPeriodValue && Math.trunc(endPeriodValue) !== endPeriodValue && Math.trunc(startPeriodValue) === Math.trunc(endPeriodValue) ? NumberValueObject.create(0) : this._getResult(rateValue, nperValue, pvValue, startPeriodValue, endPeriodValue, typeValue);
8460
+ }
8461
+ _getResult(rateValue, nperValue, pvValue, startPeriodValue, endPeriodValue, typeValue) {
8462
+ const payment = calculatePMT(rateValue, nperValue, pvValue, 0, typeValue);
8463
+ let result = 0, _startPeriodValue = Math.ceil(startPeriodValue);
8464
+ _startPeriodValue === 1 && (typeValue === 0 && (result = -pvValue), _startPeriodValue++);
8465
+ let canNotCalculate = !1;
8466
+ for (let i = _startPeriodValue; i <= endPeriodValue; i++) {
8467
+ const principal = typeValue === 1 ? calculateFV(rateValue, i - 2, payment, pvValue, 1) : calculateFV(rateValue, i - 1, payment, pvValue, 0);
8468
+ if (principal === 0) {
8469
+ canNotCalculate = !0;
8470
+ break;
8471
+ }
8472
+ result += typeValue === 1 ? principal - payment : principal;
8473
+ }
8474
+ return result *= rateValue, (result < payment * (endPeriodValue - startPeriodValue + 1) || canNotCalculate) && (result = payment * (endPeriodValue - startPeriodValue + 1)), NumberValueObject.create(result);
8475
+ }
8476
+ };
8477
+ __name(_Cumipmt, "Cumipmt");
8478
+ let Cumipmt = _Cumipmt;
8479
+ const _Cumprinc = class _Cumprinc extends BaseFunction {
8480
+ constructor() {
8481
+ super(...arguments);
8482
+ __publicField(this, "minParams", 6);
8483
+ __publicField(this, "maxParams", 6);
8484
+ }
8485
+ calculate(rate, nper, pv, startPeriod, endPeriod, type) {
8486
+ const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(rate, nper, pv, startPeriod, endPeriod, type);
8487
+ if (isError)
8488
+ return errorObject;
8489
+ const [rateObject, nperObject, pvObject, startPeriodObject, endPeriodObject, typeObject] = variants, rateValue = +rateObject.getValue(), nperValue = +nperObject.getValue(), pvValue = +pvObject.getValue(), startPeriodValue = +startPeriodObject.getValue(), endPeriodValue = +endPeriodObject.getValue(), typeValue = +typeObject.getValue();
8490
+ return Number.isNaN(rateValue) || Number.isNaN(nperValue) || Number.isNaN(pvValue) || Number.isNaN(startPeriodValue) || Number.isNaN(endPeriodValue) || Number.isNaN(typeValue) ? ErrorValueObject.create(ErrorType$1.VALUE) : rateValue <= 0 || nperValue <= 0 || pvValue <= 0 || startPeriodValue < 1 || endPeriodValue < 1 || startPeriodValue > endPeriodValue || ![0, 1].includes(typeValue) ? ErrorValueObject.create(ErrorType$1.NUM) : Math.trunc(startPeriodValue) !== startPeriodValue && Math.trunc(endPeriodValue) !== endPeriodValue && Math.trunc(startPeriodValue) === Math.trunc(endPeriodValue) ? NumberValueObject.create(0) : this._getResult(rateValue, nperValue, pvValue, startPeriodValue, endPeriodValue, typeValue);
8491
+ }
8492
+ _getResult(rateValue, nperValue, pvValue, startPeriodValue, endPeriodValue, typeValue) {
8493
+ const payment = calculatePMT(rateValue, nperValue, pvValue, 0, typeValue);
8494
+ let result = 0, _startPeriodValue = Math.ceil(startPeriodValue);
8495
+ _startPeriodValue === 1 && (result = typeValue === 0 ? payment + pvValue * rateValue : payment, _startPeriodValue++);
8496
+ for (let i = _startPeriodValue; i <= endPeriodValue; i++)
8497
+ result += typeValue === 1 ? payment - (calculateFV(rateValue, i - 2, payment, pvValue, 1) - payment) * rateValue : payment - calculateFV(rateValue, i - 1, payment, pvValue, 0) * rateValue;
8498
+ return NumberValueObject.create(result);
8499
+ }
8500
+ };
8501
+ __name(_Cumprinc, "Cumprinc");
8502
+ let Cumprinc = _Cumprinc;
8503
+ const _Db = class _Db extends BaseFunction {
8504
+ constructor() {
8505
+ super(...arguments);
8506
+ __publicField(this, "minParams", 4);
8507
+ __publicField(this, "maxParams", 5);
8508
+ }
8509
+ calculate(cost, salvage, life, period, month) {
8510
+ let _month = month != null ? month : NumberValueObject.create(12);
8511
+ _month.isNull() && (_month = NumberValueObject.create(12));
8512
+ const maxRowLength = Math.max(
8513
+ cost.isArray() ? cost.getRowCount() : 1,
8514
+ salvage.isArray() ? salvage.getRowCount() : 1,
8515
+ life.isArray() ? life.getRowCount() : 1,
8516
+ period.isArray() ? period.getRowCount() : 1,
8517
+ _month.isArray() ? _month.getRowCount() : 1
8518
+ ), maxColumnLength = Math.max(
8519
+ cost.isArray() ? cost.getColumnCount() : 1,
8520
+ salvage.isArray() ? salvage.getColumnCount() : 1,
8521
+ life.isArray() ? life.getColumnCount() : 1,
8522
+ period.isArray() ? period.getColumnCount() : 1,
8523
+ _month.isArray() ? _month.getColumnCount() : 1
8524
+ ), costArray = expandArrayValueObject(maxRowLength, maxColumnLength, cost, ErrorValueObject.create(ErrorType$1.NA)), salvageArray = expandArrayValueObject(maxRowLength, maxColumnLength, salvage, ErrorValueObject.create(ErrorType$1.NA)), lifeArray = expandArrayValueObject(maxRowLength, maxColumnLength, life, ErrorValueObject.create(ErrorType$1.NA)), periodArray = expandArrayValueObject(maxRowLength, maxColumnLength, period, ErrorValueObject.create(ErrorType$1.NA)), monthArray = expandArrayValueObject(maxRowLength, maxColumnLength, _month, ErrorValueObject.create(ErrorType$1.NA)), resultArray = costArray.map((costObject, rowIndex, columnIndex) => {
8525
+ const salvageObject = salvageArray.get(rowIndex, columnIndex), lifeObject = lifeArray.get(rowIndex, columnIndex), periodObject = periodArray.get(rowIndex, columnIndex), monthObject = monthArray.get(rowIndex, columnIndex), { isError, errorObject, variants } = checkVariantsErrorIsStringToNumber(costObject, salvageObject, lifeObject, periodObject, monthObject);
8526
+ if (isError)
8527
+ return errorObject;
8528
+ const [_costObject, _salvageObject, _lifeObject, _periodObject, _monthObject] = variants, costValue = +_costObject.getValue(), salvageValue = +_salvageObject.getValue(), lifeValue = +_lifeObject.getValue();
8529
+ let periodValue = +_periodObject.getValue();
8530
+ const monthValue = Math.floor(+_monthObject.getValue());
8531
+ return costValue < 0 || salvageValue < 0 || lifeValue <= 0 || periodValue <= 0 || Math.floor(periodValue) > Math.floor(lifeValue) || monthValue < 1 || monthValue > 12 ? ErrorValueObject.create(ErrorType$1.NUM) : (periodValue < 1 && (periodValue = 1), periodValue = Math.floor(periodValue), this._getResult(costValue, salvageValue, lifeValue, periodValue, monthValue, rowIndex, columnIndex));
8532
+ });
8533
+ return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
8534
+ }
8535
+ _getResult(costValue, salvageValue, lifeValue, periodValue, monthValue, rowIndex, columnIndex) {
8536
+ const rate = +(1 - (salvageValue / costValue) ** (1 / lifeValue)).toFixed(3), initial = costValue * rate * monthValue / 12;
8537
+ let total = initial, current = 0;
8538
+ const ceiling = periodValue === lifeValue ? lifeValue - 1 : periodValue;
8539
+ for (let i = 2; i <= ceiling; i++)
8540
+ current = (costValue - total) * rate, total += current;
8541
+ let result;
8542
+ return periodValue === 1 ? result = initial : periodValue === lifeValue ? result = (costValue - total) * rate : result = current, Number.isNaN(result) || !Number.isFinite(result) ? ErrorValueObject.create(ErrorType$1.NUM) : rowIndex === 0 && columnIndex === 0 ? NumberValueObject.create(result, '"¥"#,##0.00_);[Red]("¥"#,##0.00)') : NumberValueObject.create(result);
8543
+ }
8544
+ };
8545
+ __name(_Db, "Db");
8546
+ let Db = _Db;
8547
+ const _Ddb = class _Ddb extends BaseFunction {
8548
+ constructor() {
8549
+ super(...arguments);
8550
+ __publicField(this, "minParams", 4);
8551
+ __publicField(this, "maxParams", 5);
8552
+ }
8553
+ calculate(cost, salvage, life, period, factor) {
8554
+ let _factor = factor != null ? factor : NumberValueObject.create(2);
8555
+ _factor.isNull() && (_factor = NumberValueObject.create(2));
8556
+ const maxRowLength = Math.max(
8557
+ cost.isArray() ? cost.getRowCount() : 1,
8558
+ salvage.isArray() ? salvage.getRowCount() : 1,
8559
+ life.isArray() ? life.getRowCount() : 1,
8560
+ period.isArray() ? period.getRowCount() : 1,
8561
+ _factor.isArray() ? _factor.getRowCount() : 1
8562
+ ), maxColumnLength = Math.max(
8563
+ cost.isArray() ? cost.getColumnCount() : 1,
8564
+ salvage.isArray() ? salvage.getColumnCount() : 1,
8565
+ life.isArray() ? life.getColumnCount() : 1,
8566
+ period.isArray() ? period.getColumnCount() : 1,
8567
+ _factor.isArray() ? _factor.getColumnCount() : 1
8568
+ ), costArray = expandArrayValueObject(maxRowLength, maxColumnLength, cost, ErrorValueObject.create(ErrorType$1.NA)), salvageArray = expandArrayValueObject(maxRowLength, maxColumnLength, salvage, ErrorValueObject.create(ErrorType$1.NA)), lifeArray = expandArrayValueObject(maxRowLength, maxColumnLength, life, ErrorValueObject.create(ErrorType$1.NA)), periodArray = expandArrayValueObject(maxRowLength, maxColumnLength, period, ErrorValueObject.create(ErrorType$1.NA)), factorArray = expandArrayValueObject(maxRowLength, maxColumnLength, _factor, ErrorValueObject.create(ErrorType$1.NA)), resultArray = costArray.map((costObject, rowIndex, columnIndex) => {
8569
+ const salvageObject = salvageArray.get(rowIndex, columnIndex), lifeObject = lifeArray.get(rowIndex, columnIndex), periodObject = periodArray.get(rowIndex, columnIndex), factorObject = factorArray.get(rowIndex, columnIndex), { isError, errorObject, variants } = checkVariantsErrorIsStringToNumber(costObject, salvageObject, lifeObject, periodObject, factorObject);
8570
+ if (isError)
8571
+ return errorObject;
8572
+ const [_costObject, _salvageObject, _lifeObject, _periodObject, _factorObject] = variants, costValue = +_costObject.getValue(), salvageValue = +_salvageObject.getValue(), lifeValue = +_lifeObject.getValue(), periodValue = Math.ceil(+_periodObject.getValue()), factorValue = +_factorObject.getValue();
8573
+ return costValue < 0 || salvageValue < 0 || lifeValue <= 0 || periodValue <= 0 || Math.floor(periodValue) > Math.floor(lifeValue) || factorValue <= 0 ? ErrorValueObject.create(ErrorType$1.NUM) : this._getResult(costValue, salvageValue, lifeValue, periodValue, factorValue, rowIndex, columnIndex);
8574
+ });
8575
+ return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
8576
+ }
8577
+ _getResult(costValue, salvageValue, lifeValue, periodValue, factorValue, rowIndex, columnIndex) {
8578
+ let total = 0, result = 0;
8579
+ if (salvageValue < costValue)
8580
+ for (let i = 1; i <= periodValue; i++)
8581
+ result = Math.min((costValue - total) * (factorValue / lifeValue), costValue - salvageValue - total), total += result;
8582
+ return Number.isNaN(result) || !Number.isFinite(result) ? ErrorValueObject.create(ErrorType$1.NUM) : rowIndex === 0 && columnIndex === 0 ? NumberValueObject.create(result, '"¥"#,##0.00_);[Red]("¥"#,##0.00)') : NumberValueObject.create(result);
8583
+ }
8584
+ };
8585
+ __name(_Ddb, "Ddb");
8586
+ let Ddb = _Ddb;
8587
+ const _Disc = class _Disc extends BaseFunction {
8588
+ constructor() {
8589
+ super(...arguments);
8590
+ __publicField(this, "minParams", 4);
8591
+ __publicField(this, "maxParams", 5);
8592
+ }
8593
+ calculate(settlement, maturity, pr, redemption, basis) {
8594
+ const _basis = basis != null ? basis : NumberValueObject.create(0), { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(settlement, maturity, pr, redemption, _basis);
8595
+ if (isError)
8596
+ return errorObject;
8597
+ const [settlementObject, maturityObject, prObject, redemptionObject, basisObject] = variants, settlementSerialNumber = getDateSerialNumberByObject(settlementObject);
8598
+ if (typeof settlementSerialNumber != "number")
8599
+ return settlementSerialNumber;
8600
+ const maturitySerialNumber = getDateSerialNumberByObject(maturityObject);
8601
+ if (typeof maturitySerialNumber != "number")
8602
+ return maturitySerialNumber;
8603
+ const prValue = +prObject.getValue(), redemptionValue = +redemptionObject.getValue(), basisValue = Math.floor(+basisObject.getValue());
8604
+ if (Number.isNaN(prValue) || Number.isNaN(redemptionValue) || Number.isNaN(basisValue))
8605
+ return ErrorValueObject.create(ErrorType$1.VALUE);
8606
+ if (prValue <= 0 || redemptionValue <= 0 || basisValue < 0 || basisValue > 4 || Math.floor(settlementSerialNumber) >= Math.floor(maturitySerialNumber))
8607
+ return ErrorValueObject.create(ErrorType$1.NUM);
8608
+ const { days, yearDays } = getTwoDateDaysByBasis(settlementSerialNumber, maturitySerialNumber, basisValue), result = (redemptionValue - prValue) / redemptionValue * (yearDays / days);
8609
+ return NumberValueObject.create(result);
8610
+ }
8611
+ };
8612
+ __name(_Disc, "Disc");
8613
+ let Disc = _Disc;
8614
+ const _Dollarde = class _Dollarde extends BaseFunction {
8615
+ constructor() {
8616
+ super(...arguments);
8617
+ __publicField(this, "minParams", 2);
8618
+ __publicField(this, "maxParams", 2);
8619
+ }
8620
+ calculate(fractionalDollar, fraction) {
8621
+ const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(fractionalDollar, fraction);
8622
+ if (isError)
8623
+ return errorObject;
8624
+ const [fractionalDollarObject, fractionObject] = variants, fractionalDollarValue = +fractionalDollarObject.getValue();
8625
+ let fractionValue = Math.floor(+fractionObject.getValue());
8626
+ if (Number.isNaN(fractionalDollarValue) || Number.isNaN(fractionValue))
8627
+ return ErrorValueObject.create(ErrorType$1.VALUE);
8628
+ if (fractionValue < 0)
8629
+ return ErrorValueObject.create(ErrorType$1.NUM);
8630
+ if (fractionValue >= 0 && fractionValue < 1)
8631
+ return ErrorValueObject.create(ErrorType$1.DIV_BY_ZERO);
8632
+ fractionValue = Number.parseInt(`${fractionValue}`, 10);
8633
+ let result = Number.parseInt(`${fractionalDollarValue}`, 10);
8634
+ result += fractionalDollarValue % 1 * 10 ** Math.ceil(Math.log(fractionValue) / Math.LN10) / fractionValue;
8635
+ const power = 10 ** (Math.ceil(Math.log(fractionValue) / Math.LN2) + 1);
8636
+ return result = Math.round(result * power) / power, NumberValueObject.create(result);
8637
+ }
8638
+ };
8639
+ __name(_Dollarde, "Dollarde");
8640
+ let Dollarde = _Dollarde;
8641
+ const _Dollarfr = class _Dollarfr extends BaseFunction {
8642
+ constructor() {
8643
+ super(...arguments);
8644
+ __publicField(this, "minParams", 2);
8645
+ __publicField(this, "maxParams", 2);
8646
+ }
8647
+ calculate(decimalDollar, fraction) {
8648
+ const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(decimalDollar, fraction);
8649
+ if (isError)
8650
+ return errorObject;
8651
+ const [decimalDollarObject, fractionObject] = variants, decimalDollarValue = +decimalDollarObject.getValue();
8652
+ let fractionValue = Math.floor(+fractionObject.getValue());
8653
+ if (Number.isNaN(decimalDollarValue) || Number.isNaN(fractionValue))
8654
+ return ErrorValueObject.create(ErrorType$1.VALUE);
8655
+ if (fractionValue < 0)
8656
+ return ErrorValueObject.create(ErrorType$1.NUM);
8657
+ if (fractionValue >= 0 && fractionValue < 1)
8658
+ return ErrorValueObject.create(ErrorType$1.DIV_BY_ZERO);
8659
+ fractionValue = Number.parseInt(`${fractionValue}`, 10);
8660
+ let result = Number.parseInt(`${decimalDollarValue}`, 10);
8661
+ return result += decimalDollarValue % 1 * 10 ** -Math.ceil(Math.log(fractionValue) / Math.LN10) * fractionValue, NumberValueObject.create(result);
8662
+ }
8663
+ };
8664
+ __name(_Dollarfr, "Dollarfr");
8665
+ let Dollarfr = _Dollarfr;
8666
+ const _Effect = class _Effect extends BaseFunction {
8667
+ constructor() {
8668
+ super(...arguments);
8669
+ __publicField(this, "minParams", 2);
8670
+ __publicField(this, "maxParams", 2);
8671
+ }
8672
+ calculate(nominalRate, npery) {
8673
+ const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(nominalRate, npery);
8674
+ if (isError)
8675
+ return errorObject;
8676
+ const [nominalRateObject, nperyObject] = variants, nominalRateValue = +nominalRateObject.getValue();
8677
+ let nperyValue = Math.floor(+nperyObject.getValue());
8678
+ if (Number.isNaN(nominalRateValue) || Number.isNaN(nperyValue))
8679
+ return ErrorValueObject.create(ErrorType$1.VALUE);
8680
+ if (nominalRateValue <= 0 || nperyValue < 1)
8681
+ return ErrorValueObject.create(ErrorType$1.NUM);
8682
+ nperyValue = Number.parseInt(`${nperyValue}`, 10);
8683
+ const result = (1 + nominalRateValue / nperyValue) ** nperyValue - 1;
8684
+ return NumberValueObject.create(result);
8685
+ }
8686
+ };
8687
+ __name(_Effect, "Effect");
8688
+ let Effect = _Effect;
8689
+ const _Fv = class _Fv extends BaseFunction {
8690
+ constructor() {
8691
+ super(...arguments);
8692
+ __publicField(this, "minParams", 3);
8693
+ __publicField(this, "maxParams", 5);
8694
+ }
8695
+ calculate(rate, nper, pmt, pv, type) {
8696
+ const _pv = pv != null ? pv : NumberValueObject.create(0), _type = type != null ? type : NumberValueObject.create(0), maxRowLength = Math.max(
8697
+ rate.isArray() ? rate.getRowCount() : 1,
8698
+ nper.isArray() ? nper.getRowCount() : 1,
8699
+ pmt.isArray() ? pmt.getRowCount() : 1,
8700
+ _pv.isArray() ? _pv.getRowCount() : 1,
8701
+ _type.isArray() ? _type.getRowCount() : 1
8702
+ ), maxColumnLength = Math.max(
8703
+ rate.isArray() ? rate.getColumnCount() : 1,
8704
+ nper.isArray() ? nper.getColumnCount() : 1,
8705
+ pmt.isArray() ? pmt.getColumnCount() : 1,
8706
+ _pv.isArray() ? _pv.getColumnCount() : 1,
8707
+ _type.isArray() ? _type.getColumnCount() : 1
8708
+ ), rateArray = expandArrayValueObject(maxRowLength, maxColumnLength, rate, ErrorValueObject.create(ErrorType$1.NA)), nperArray = expandArrayValueObject(maxRowLength, maxColumnLength, nper, ErrorValueObject.create(ErrorType$1.NA)), pmtArray = expandArrayValueObject(maxRowLength, maxColumnLength, pmt, ErrorValueObject.create(ErrorType$1.NA)), pvArray = expandArrayValueObject(maxRowLength, maxColumnLength, _pv, ErrorValueObject.create(ErrorType$1.NA)), typeArray = expandArrayValueObject(maxRowLength, maxColumnLength, _type, ErrorValueObject.create(ErrorType$1.NA)), resultArray = rateArray.map((rateObject, rowIndex, columnIndex) => {
8709
+ const nperObject = nperArray.get(rowIndex, columnIndex), pmtObject = pmtArray.get(rowIndex, columnIndex), pvObject = pvArray.get(rowIndex, columnIndex), typeObject = typeArray.get(rowIndex, columnIndex), { isError, errorObject, variants } = checkVariantsErrorIsStringToNumber(rateObject, nperObject, pmtObject, pvObject, typeObject);
8710
+ if (isError)
8711
+ return errorObject;
8712
+ const [_rateObject, _nperObject, _pmtObject, _pvObject, _typeObject] = variants, rateValue = +_rateObject.getValue(), nperValue = +_nperObject.getValue(), pmtValue = +_pmtObject.getValue(), pvValue = +_pvObject.getValue(), typeValue = +_typeObject.getValue(), result = calculateFV(rateValue, nperValue, pmtValue, pvValue, typeValue ? 1 : 0);
8713
+ return Number.isNaN(result) || !Number.isFinite(result) ? ErrorValueObject.create(ErrorType$1.NUM) : rowIndex === 0 && columnIndex === 0 ? NumberValueObject.create(result, '"¥"#,##0.00_);[Red]("¥"#,##0.00)') : NumberValueObject.create(result);
8714
+ });
8715
+ return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
8716
+ }
8717
+ };
8718
+ __name(_Fv, "Fv");
8719
+ let Fv = _Fv;
8720
+ const _Fvschedule = class _Fvschedule extends BaseFunction {
8721
+ constructor() {
8722
+ super(...arguments);
8723
+ __publicField(this, "minParams", 2);
8724
+ __publicField(this, "maxParams", 2);
8725
+ }
8726
+ calculate(principal, schedule) {
8727
+ const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(principal);
8728
+ if (isError)
8729
+ return errorObject;
8730
+ const [principalObject] = variants, principalValue = +principalObject.getValue();
8731
+ if (Number.isNaN(principalValue))
8732
+ return ErrorValueObject.create(ErrorType$1.VALUE);
8733
+ let result = principalValue;
8734
+ if (schedule.isArray()) {
8735
+ const scheduleValues = schedule.getArrayValue().flat();
8736
+ for (let i = 0; i < scheduleValues.length; i++) {
8737
+ const scheduleObject = scheduleValues[i];
8738
+ if (scheduleObject.isBoolean())
8739
+ return ErrorValueObject.create(ErrorType$1.VALUE);
8740
+ const scheduleValue = +scheduleObject.getValue();
8741
+ if (Number.isNaN(scheduleValue))
8742
+ return ErrorValueObject.create(ErrorType$1.VALUE);
8743
+ result *= 1 + scheduleValue;
8744
+ }
8745
+ } else {
8746
+ if (schedule.isBoolean())
8747
+ return ErrorValueObject.create(ErrorType$1.VALUE);
8748
+ const scheduleValue = +schedule.getValue();
8749
+ if (Number.isNaN(scheduleValue))
8750
+ return ErrorValueObject.create(ErrorType$1.VALUE);
8751
+ result *= 1 + scheduleValue;
8752
+ }
8753
+ return NumberValueObject.create(result);
8754
+ }
8755
+ };
8756
+ __name(_Fvschedule, "Fvschedule");
8757
+ let Fvschedule = _Fvschedule;
8758
+ const _Intrate = class _Intrate extends BaseFunction {
8759
+ constructor() {
8760
+ super(...arguments);
8761
+ __publicField(this, "minParams", 4);
8762
+ __publicField(this, "maxParams", 5);
8763
+ }
8764
+ calculate(settlement, maturity, investment, redemption, basis) {
8765
+ const _basis = basis != null ? basis : NumberValueObject.create(0), { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(settlement, maturity, investment, redemption, _basis);
8766
+ if (isError)
8767
+ return errorObject;
8768
+ const [settlementObject, maturityObject, investmentObject, redemptionObject, basisObject] = variants, settlementSerialNumber = getDateSerialNumberByObject(settlementObject);
8769
+ if (typeof settlementSerialNumber != "number")
8770
+ return settlementSerialNumber;
8771
+ const maturitySerialNumber = getDateSerialNumberByObject(maturityObject);
8772
+ if (typeof maturitySerialNumber != "number")
8773
+ return maturitySerialNumber;
8774
+ const investmentValue = +investmentObject.getValue(), redemptionValue = +redemptionObject.getValue(), basisValue = Math.floor(+basisObject.getValue());
8775
+ if (Number.isNaN(investmentValue) || Number.isNaN(redemptionValue) || Number.isNaN(basisValue))
8776
+ return ErrorValueObject.create(ErrorType$1.VALUE);
8777
+ if (investmentValue <= 0 || redemptionValue <= 0 || basisValue < 0 || basisValue > 4 || Math.floor(settlementSerialNumber) >= Math.floor(maturitySerialNumber))
8778
+ return ErrorValueObject.create(ErrorType$1.NUM);
8779
+ const { days, yearDays } = getTwoDateDaysByBasis(settlementSerialNumber, maturitySerialNumber, basisValue), result = (redemptionValue - investmentValue) / investmentValue * (yearDays / days);
8780
+ return NumberValueObject.create(result);
8781
+ }
8782
+ };
8783
+ __name(_Intrate, "Intrate");
8784
+ let Intrate = _Intrate;
8785
+ const _Ipmt = class _Ipmt extends BaseFunction {
6455
8786
  constructor() {
6456
8787
  super(...arguments);
6457
- __publicField(this, "minParams", 2);
8788
+ __publicField(this, "minParams", 4);
8789
+ __publicField(this, "maxParams", 6);
8790
+ }
8791
+ calculate(rate, per, nper, pv, fv, type) {
8792
+ const _fv = fv != null ? fv : NumberValueObject.create(0), _type = type != null ? type : NumberValueObject.create(0), maxRowLength = Math.max(
8793
+ rate.isArray() ? rate.getRowCount() : 1,
8794
+ per.isArray() ? per.getRowCount() : 1,
8795
+ nper.isArray() ? nper.getRowCount() : 1,
8796
+ pv.isArray() ? pv.getRowCount() : 1,
8797
+ _fv.isArray() ? _fv.getRowCount() : 1,
8798
+ _type.isArray() ? _type.getRowCount() : 1
8799
+ ), maxColumnLength = Math.max(
8800
+ rate.isArray() ? rate.getColumnCount() : 1,
8801
+ per.isArray() ? per.getColumnCount() : 1,
8802
+ nper.isArray() ? nper.getColumnCount() : 1,
8803
+ pv.isArray() ? pv.getColumnCount() : 1,
8804
+ _fv.isArray() ? _fv.getColumnCount() : 1,
8805
+ _type.isArray() ? _type.getColumnCount() : 1
8806
+ ), rateArray = expandArrayValueObject(maxRowLength, maxColumnLength, rate, ErrorValueObject.create(ErrorType$1.NA)), perArray = expandArrayValueObject(maxRowLength, maxColumnLength, per, ErrorValueObject.create(ErrorType$1.NA)), nperArray = expandArrayValueObject(maxRowLength, maxColumnLength, nper, ErrorValueObject.create(ErrorType$1.NA)), pvArray = expandArrayValueObject(maxRowLength, maxColumnLength, pv, ErrorValueObject.create(ErrorType$1.NA)), fvArray = expandArrayValueObject(maxRowLength, maxColumnLength, _fv, ErrorValueObject.create(ErrorType$1.NA)), typeArray = expandArrayValueObject(maxRowLength, maxColumnLength, _type, ErrorValueObject.create(ErrorType$1.NA)), resultArray = rateArray.map((rateObject, rowIndex, columnIndex) => {
8807
+ const perObject = perArray.get(rowIndex, columnIndex), nperObject = nperArray.get(rowIndex, columnIndex), pvObject = pvArray.get(rowIndex, columnIndex), fvObject = fvArray.get(rowIndex, columnIndex), typeObject = typeArray.get(rowIndex, columnIndex), { isError, errorObject, variants } = checkVariantsErrorIsStringToNumber(rateObject, perObject, nperObject, pvObject, fvObject, typeObject);
8808
+ if (isError)
8809
+ return errorObject;
8810
+ const [_rateObject, _perObject, _nperObject, _pvObject, _fvObject, _typeObject] = variants, rateValue = +_rateObject.getValue(), perValue = +_perObject.getValue(), nperValue = +_nperObject.getValue(), pvValue = +_pvObject.getValue(), fvValue = +_fvObject.getValue(), typeValue = +_typeObject.getValue();
8811
+ if (perValue < 1 || Math.floor(perValue) > Math.ceil(nperValue))
8812
+ return ErrorValueObject.create(ErrorType$1.NUM);
8813
+ const result = calculateIPMT(rateValue, perValue, nperValue, pvValue, fvValue, typeValue ? 1 : 0);
8814
+ return Number.isNaN(result) || !Number.isFinite(result) ? ErrorValueObject.create(ErrorType$1.NUM) : rowIndex === 0 && columnIndex === 0 ? NumberValueObject.create(result, '"¥"#,##0.00_);[Red]("¥"#,##0.00)') : NumberValueObject.create(result);
8815
+ });
8816
+ return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
8817
+ }
8818
+ };
8819
+ __name(_Ipmt, "Ipmt");
8820
+ let Ipmt = _Ipmt;
8821
+ const _Ispmt = class _Ispmt extends BaseFunction {
8822
+ constructor() {
8823
+ super(...arguments);
8824
+ __publicField(this, "minParams", 4);
6458
8825
  __publicField(this, "maxParams", 4);
6459
8826
  }
6460
- calculate(startDate, days, weekend, holidays) {
6461
- return startDate.isError() ? startDate : days.isError() ? days : weekend != null && weekend.isError() ? weekend : holidays != null && holidays.isError() ? holidays : weekend != null && weekend.isArray() ? weekend.map((weekendItem) => this._handleSingleObject(startDate, days, weekendItem, holidays)) : this._handleSingleObject(startDate, days, weekend, holidays);
8827
+ calculate(rate, per, nper, pv) {
8828
+ const maxRowLength = Math.max(
8829
+ rate.isArray() ? rate.getRowCount() : 1,
8830
+ per.isArray() ? per.getRowCount() : 1,
8831
+ nper.isArray() ? nper.getRowCount() : 1,
8832
+ pv.isArray() ? pv.getRowCount() : 1
8833
+ ), maxColumnLength = Math.max(
8834
+ rate.isArray() ? rate.getColumnCount() : 1,
8835
+ per.isArray() ? per.getColumnCount() : 1,
8836
+ nper.isArray() ? nper.getColumnCount() : 1,
8837
+ pv.isArray() ? pv.getColumnCount() : 1
8838
+ ), rateArray = expandArrayValueObject(maxRowLength, maxColumnLength, rate, ErrorValueObject.create(ErrorType$1.NA)), perArray = expandArrayValueObject(maxRowLength, maxColumnLength, per, ErrorValueObject.create(ErrorType$1.NA)), nperArray = expandArrayValueObject(maxRowLength, maxColumnLength, nper, ErrorValueObject.create(ErrorType$1.NA)), pvArray = expandArrayValueObject(maxRowLength, maxColumnLength, pv, ErrorValueObject.create(ErrorType$1.NA)), resultArray = rateArray.map((rateObject, rowIndex, columnIndex) => {
8839
+ const perObject = perArray.get(rowIndex, columnIndex), nperObject = nperArray.get(rowIndex, columnIndex), pvObject = pvArray.get(rowIndex, columnIndex), { isError, errorObject, variants } = checkVariantsErrorIsStringToNumber(rateObject, perObject, nperObject, pvObject);
8840
+ if (isError)
8841
+ return errorObject;
8842
+ const [_rateObject, _perObject, _nperObject, _pvObject] = variants, rateValue = +_rateObject.getValue(), perValue = +_perObject.getValue(), nperValue = +_nperObject.getValue(), pvValue = +_pvObject.getValue();
8843
+ if (nperValue === 0)
8844
+ return ErrorValueObject.create(ErrorType$1.DIV_BY_ZERO);
8845
+ const result = pvValue * rateValue * (perValue / nperValue - 1);
8846
+ return NumberValueObject.create(result);
8847
+ });
8848
+ return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
6462
8849
  }
6463
- _handleSingleObject(startDate, days, weekend, holidays) {
6464
- const _weekend = weekend != null ? weekend : NumberValueObject.create(1), _startDate = this._checkArrayError(startDate);
6465
- if (_startDate.isError())
6466
- return _startDate;
6467
- const _days = this._checkArrayError(days);
6468
- if (_days.isError())
6469
- return _days;
6470
- if (_startDate.isBoolean() || _days.isBoolean())
6471
- return ErrorValueObject.create(ErrorType$1.VALUE);
6472
- const startDateSerialNumber = getDateSerialNumberByObject(startDate);
6473
- if (typeof startDateSerialNumber != "number")
6474
- return startDateSerialNumber;
6475
- const workingDays = +days.getValue();
6476
- if (Number.isNaN(workingDays))
6477
- return ErrorValueObject.create(ErrorType$1.VALUE);
6478
- let weekendValue = _weekend.getValue();
6479
- if (_weekend.isBoolean() && (weekendValue = +weekendValue), _weekend.isString() && (!isValidWeekend(weekendValue) || weekendValue === "1111111"))
8850
+ };
8851
+ __name(_Ispmt, "Ispmt");
8852
+ let Ispmt = _Ispmt;
8853
+ const _Nominal = class _Nominal extends BaseFunction {
8854
+ constructor() {
8855
+ super(...arguments);
8856
+ __publicField(this, "minParams", 2);
8857
+ __publicField(this, "maxParams", 2);
8858
+ }
8859
+ calculate(effectRate, npery) {
8860
+ const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(effectRate, npery);
8861
+ if (isError)
8862
+ return errorObject;
8863
+ const [effectRateObject, nperyObject] = variants, effectRateValue = +effectRateObject.getValue();
8864
+ let nperyValue = Math.floor(+nperyObject.getValue());
8865
+ if (Number.isNaN(effectRateValue) || Number.isNaN(nperyValue))
6480
8866
  return ErrorValueObject.create(ErrorType$1.VALUE);
6481
- if (!isValidWeekend(weekendValue))
8867
+ if (effectRateValue <= 0 || nperyValue < 1)
6482
8868
  return ErrorValueObject.create(ErrorType$1.NUM);
6483
- if (holidays)
6484
- return this._getResultByHolidays(startDateSerialNumber, workingDays, weekendValue, holidays);
6485
- const result = getDateSerialNumberByWorkingDays(startDateSerialNumber, workingDays, weekendValue);
6486
- return typeof result != "number" ? result : NumberValueObject.create(result);
8869
+ nperyValue = Number.parseInt(`${nperyValue}`, 10);
8870
+ const result = ((effectRateValue + 1) ** (1 / nperyValue) - 1) * nperyValue;
8871
+ return NumberValueObject.create(result);
6487
8872
  }
6488
- _checkArrayError(variant) {
6489
- let _variant = variant;
6490
- if (_variant.isArray()) {
6491
- const rowCount = _variant.getRowCount(), columnCount = _variant.getColumnCount();
6492
- if (rowCount > 1 || columnCount > 1)
6493
- return ErrorValueObject.create(ErrorType$1.VALUE);
6494
- _variant = _variant.get(0, 0);
6495
- }
6496
- return _variant.isError(), _variant;
8873
+ };
8874
+ __name(_Nominal, "Nominal");
8875
+ let Nominal = _Nominal;
8876
+ const _Nper = class _Nper extends BaseFunction {
8877
+ constructor() {
8878
+ super(...arguments);
8879
+ __publicField(this, "minParams", 3);
8880
+ __publicField(this, "maxParams", 5);
6497
8881
  }
6498
- _getResultByHolidays(startDateSerialNumber, workingDays, weekendValue, holidays) {
6499
- const holidaysValueArray = [];
6500
- if (holidays != null && holidays.isArray()) {
6501
- const rowCount = holidays.getRowCount(), columnCount = holidays.getColumnCount();
6502
- for (let r = 0; r < rowCount; r++)
6503
- for (let c = 0; c < columnCount; c++) {
6504
- const cell = holidays.get(r, c);
6505
- if (cell.isBoolean())
6506
- return ErrorValueObject.create(ErrorType$1.VALUE);
6507
- const holidaySerialNumber = getDateSerialNumberByObject(cell);
6508
- if (typeof holidaySerialNumber != "number")
6509
- return holidaySerialNumber;
6510
- holidaysValueArray.push(holidaySerialNumber);
6511
- }
6512
- } else {
6513
- if (holidays.isBoolean())
6514
- return ErrorValueObject.create(ErrorType$1.VALUE);
6515
- const holidaySerialNumber = getDateSerialNumberByObject(holidays);
6516
- if (typeof holidaySerialNumber != "number")
6517
- return holidaySerialNumber;
6518
- holidaysValueArray.push(holidaySerialNumber);
6519
- }
6520
- const result = getDateSerialNumberByWorkingDays(startDateSerialNumber, workingDays, weekendValue, holidaysValueArray);
6521
- return typeof result != "number" ? result : NumberValueObject.create(result);
8882
+ calculate(rate, pmt, pv, fv, type) {
8883
+ const _fv = fv != null ? fv : NumberValueObject.create(0), _type = type != null ? type : NumberValueObject.create(0), maxRowLength = Math.max(
8884
+ rate.isArray() ? rate.getRowCount() : 1,
8885
+ pmt.isArray() ? pmt.getRowCount() : 1,
8886
+ pv.isArray() ? pv.getRowCount() : 1,
8887
+ _fv.isArray() ? _fv.getRowCount() : 1,
8888
+ _type.isArray() ? _type.getRowCount() : 1
8889
+ ), maxColumnLength = Math.max(
8890
+ rate.isArray() ? rate.getColumnCount() : 1,
8891
+ pmt.isArray() ? pmt.getColumnCount() : 1,
8892
+ pv.isArray() ? pv.getColumnCount() : 1,
8893
+ _fv.isArray() ? _fv.getColumnCount() : 1,
8894
+ _type.isArray() ? _type.getColumnCount() : 1
8895
+ ), rateArray = expandArrayValueObject(maxRowLength, maxColumnLength, rate, ErrorValueObject.create(ErrorType$1.NA)), pmtArray = expandArrayValueObject(maxRowLength, maxColumnLength, pmt, ErrorValueObject.create(ErrorType$1.NA)), pvArray = expandArrayValueObject(maxRowLength, maxColumnLength, pv, ErrorValueObject.create(ErrorType$1.NA)), fvArray = expandArrayValueObject(maxRowLength, maxColumnLength, _fv, ErrorValueObject.create(ErrorType$1.NA)), typeArray = expandArrayValueObject(maxRowLength, maxColumnLength, _type, ErrorValueObject.create(ErrorType$1.NA)), resultArray = rateArray.map((rateObject, rowIndex, columnIndex) => {
8896
+ const pmtObject = pmtArray.get(rowIndex, columnIndex), pvObject = pvArray.get(rowIndex, columnIndex), fvObject = fvArray.get(rowIndex, columnIndex), typeObject = typeArray.get(rowIndex, columnIndex), { isError, errorObject, variants } = checkVariantsErrorIsStringToNumber(rateObject, pmtObject, pvObject, fvObject, typeObject);
8897
+ if (isError)
8898
+ return errorObject;
8899
+ const [_rateObject, _pmtObject, _pvObject, _fvObject, _typeObject] = variants, rateValue = +_rateObject.getValue(), pmtValue = +_pmtObject.getValue(), pvValue = +_pvObject.getValue(), fvValue = +_fvObject.getValue();
8900
+ let typeValue = +_typeObject.getValue();
8901
+ if (typeValue = typeValue ? 1 : 0, rateValue === 0 && pmtValue === 0)
8902
+ return ErrorValueObject.create(ErrorType$1.DIV_BY_ZERO);
8903
+ let result;
8904
+ if (rateValue === 0)
8905
+ result = -(pvValue + fvValue) / pmtValue;
8906
+ else {
8907
+ const num = pmtValue * (1 + rateValue * typeValue) - fvValue * rateValue, den = pvValue * rateValue + pmtValue * (1 + rateValue * typeValue);
8908
+ result = Math.log(num / den) / Math.log(1 + rateValue);
8909
+ }
8910
+ return Number.isNaN(result) || !Number.isFinite(result) ? ErrorValueObject.create(ErrorType$1.NUM) : NumberValueObject.create(result);
8911
+ });
8912
+ return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
6522
8913
  }
6523
8914
  };
6524
- __name(_WorkdayIntl, "WorkdayIntl");
6525
- let WorkdayIntl = _WorkdayIntl;
6526
- const _Year = class _Year extends BaseFunction {
8915
+ __name(_Nper, "Nper");
8916
+ let Nper = _Nper;
8917
+ const _Pmt = class _Pmt extends BaseFunction {
6527
8918
  constructor() {
6528
8919
  super(...arguments);
6529
- __publicField(this, "minParams", 1);
6530
- __publicField(this, "maxParams", 1);
8920
+ __publicField(this, "minParams", 3);
8921
+ __publicField(this, "maxParams", 5);
6531
8922
  }
6532
- calculate(serialNumber) {
6533
- return serialNumber.isArray() ? serialNumber.map((serialNumberObject) => this._handleSingleObject(serialNumberObject)) : this._handleSingleObject(serialNumber);
8923
+ calculate(rate, nper, pv, fv, type) {
8924
+ const _fv = fv != null ? fv : NumberValueObject.create(0), _type = type != null ? type : NumberValueObject.create(0), maxRowLength = Math.max(
8925
+ rate.isArray() ? rate.getRowCount() : 1,
8926
+ nper.isArray() ? nper.getRowCount() : 1,
8927
+ pv.isArray() ? pv.getRowCount() : 1,
8928
+ _fv.isArray() ? _fv.getRowCount() : 1,
8929
+ _type.isArray() ? _type.getRowCount() : 1
8930
+ ), maxColumnLength = Math.max(
8931
+ rate.isArray() ? rate.getColumnCount() : 1,
8932
+ nper.isArray() ? nper.getColumnCount() : 1,
8933
+ pv.isArray() ? pv.getColumnCount() : 1,
8934
+ _fv.isArray() ? _fv.getColumnCount() : 1,
8935
+ _type.isArray() ? _type.getColumnCount() : 1
8936
+ ), rateArray = expandArrayValueObject(maxRowLength, maxColumnLength, rate, ErrorValueObject.create(ErrorType$1.NA)), nperArray = expandArrayValueObject(maxRowLength, maxColumnLength, nper, ErrorValueObject.create(ErrorType$1.NA)), pvArray = expandArrayValueObject(maxRowLength, maxColumnLength, pv, ErrorValueObject.create(ErrorType$1.NA)), fvArray = expandArrayValueObject(maxRowLength, maxColumnLength, _fv, ErrorValueObject.create(ErrorType$1.NA)), typeArray = expandArrayValueObject(maxRowLength, maxColumnLength, _type, ErrorValueObject.create(ErrorType$1.NA)), resultArray = rateArray.map((rateObject, rowIndex, columnIndex) => {
8937
+ const nperObject = nperArray.get(rowIndex, columnIndex), pvObject = pvArray.get(rowIndex, columnIndex), fvObject = fvArray.get(rowIndex, columnIndex), typeObject = typeArray.get(rowIndex, columnIndex), { isError, errorObject, variants } = checkVariantsErrorIsStringToNumber(rateObject, nperObject, pvObject, fvObject, typeObject);
8938
+ if (isError)
8939
+ return errorObject;
8940
+ const [_rateObject, _nperObject, _pvObject, _fvObject, _typeObject] = variants, rateValue = +_rateObject.getValue(), nperValue = +_nperObject.getValue(), pvValue = +_pvObject.getValue(), fvValue = +_fvObject.getValue(), typeValue = +_typeObject.getValue();
8941
+ if (rateValue <= -1)
8942
+ return ErrorValueObject.create(ErrorType$1.NUM);
8943
+ const result = calculatePMT(rateValue, nperValue, pvValue, fvValue, typeValue ? 1 : 0);
8944
+ return Number.isNaN(result) || !Number.isFinite(result) ? ErrorValueObject.create(ErrorType$1.NUM) : rowIndex === 0 && columnIndex === 0 ? NumberValueObject.create(result, '"¥"#,##0.00_);[Red]("¥"#,##0.00)') : NumberValueObject.create(result);
8945
+ });
8946
+ return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
6534
8947
  }
6535
- _handleSingleObject(serialNumberObject) {
6536
- if (serialNumberObject.isError())
6537
- return serialNumberObject;
6538
- let date;
6539
- const dateValue = serialNumberObject.getValue();
6540
- if (serialNumberObject.isString()) {
6541
- if (!isValidDateStr(`${dateValue}`))
6542
- return ErrorValueObject.create(ErrorType$1.VALUE);
6543
- date = /* @__PURE__ */ new Date(`${dateValue}`);
6544
- } else {
6545
- const dateSerial = +dateValue;
6546
- if (dateSerial < 0)
8948
+ };
8949
+ __name(_Pmt, "Pmt");
8950
+ let Pmt = _Pmt;
8951
+ const _Ppmt = class _Ppmt extends BaseFunction {
8952
+ constructor() {
8953
+ super(...arguments);
8954
+ __publicField(this, "minParams", 4);
8955
+ __publicField(this, "maxParams", 6);
8956
+ }
8957
+ calculate(rate, per, nper, pv, fv, type) {
8958
+ const _fv = fv != null ? fv : NumberValueObject.create(0), _type = type != null ? type : NumberValueObject.create(0), maxRowLength = Math.max(
8959
+ rate.isArray() ? rate.getRowCount() : 1,
8960
+ per.isArray() ? per.getRowCount() : 1,
8961
+ nper.isArray() ? nper.getRowCount() : 1,
8962
+ pv.isArray() ? pv.getRowCount() : 1,
8963
+ _fv.isArray() ? _fv.getRowCount() : 1,
8964
+ _type.isArray() ? _type.getRowCount() : 1
8965
+ ), maxColumnLength = Math.max(
8966
+ rate.isArray() ? rate.getColumnCount() : 1,
8967
+ per.isArray() ? per.getColumnCount() : 1,
8968
+ nper.isArray() ? nper.getColumnCount() : 1,
8969
+ pv.isArray() ? pv.getColumnCount() : 1,
8970
+ _fv.isArray() ? _fv.getColumnCount() : 1,
8971
+ _type.isArray() ? _type.getColumnCount() : 1
8972
+ ), rateArray = expandArrayValueObject(maxRowLength, maxColumnLength, rate, ErrorValueObject.create(ErrorType$1.NA)), perArray = expandArrayValueObject(maxRowLength, maxColumnLength, per, ErrorValueObject.create(ErrorType$1.NA)), nperArray = expandArrayValueObject(maxRowLength, maxColumnLength, nper, ErrorValueObject.create(ErrorType$1.NA)), pvArray = expandArrayValueObject(maxRowLength, maxColumnLength, pv, ErrorValueObject.create(ErrorType$1.NA)), fvArray = expandArrayValueObject(maxRowLength, maxColumnLength, _fv, ErrorValueObject.create(ErrorType$1.NA)), typeArray = expandArrayValueObject(maxRowLength, maxColumnLength, _type, ErrorValueObject.create(ErrorType$1.NA)), resultArray = rateArray.map((rateObject, rowIndex, columnIndex) => {
8973
+ const perObject = perArray.get(rowIndex, columnIndex), nperObject = nperArray.get(rowIndex, columnIndex), pvObject = pvArray.get(rowIndex, columnIndex), fvObject = fvArray.get(rowIndex, columnIndex), typeObject = typeArray.get(rowIndex, columnIndex), { isError, errorObject, variants } = checkVariantsErrorIsStringToNumber(rateObject, perObject, nperObject, pvObject, fvObject, typeObject);
8974
+ if (isError)
8975
+ return errorObject;
8976
+ const [_rateObject, _perObject, _nperObject, _pvObject, _fvObject, _typeObject] = variants, rateValue = +_rateObject.getValue(), perValue = +_perObject.getValue(), nperValue = +_nperObject.getValue(), pvValue = +_pvObject.getValue(), fvValue = +_fvObject.getValue(), typeValue = +_typeObject.getValue();
8977
+ if (perValue < 1 || Math.floor(perValue) > Math.ceil(nperValue) || perValue - nperValue >= 1)
6547
8978
  return ErrorValueObject.create(ErrorType$1.NUM);
6548
- if (dateSerial === 0)
6549
- return NumberValueObject.create(1900);
6550
- date = excelSerialToDate(dateSerial);
6551
- }
6552
- const year = date.getUTCFullYear();
6553
- return NumberValueObject.create(year);
8979
+ const result = calculatePMT(rateValue, nperValue, pvValue, fvValue, typeValue ? 1 : 0) - calculateIPMT(rateValue, perValue, nperValue, pvValue, fvValue, typeValue ? 1 : 0);
8980
+ return Number.isNaN(result) || !Number.isFinite(result) ? ErrorValueObject.create(ErrorType$1.NUM) : rowIndex === 0 && columnIndex === 0 ? NumberValueObject.create(result, '"¥"#,##0.00_);[Red]("¥"#,##0.00)') : NumberValueObject.create(result);
8981
+ });
8982
+ return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
6554
8983
  }
6555
8984
  };
6556
- __name(_Year, "Year");
6557
- let Year = _Year;
6558
- const _Yearfrac = class _Yearfrac extends BaseFunction {
8985
+ __name(_Ppmt, "Ppmt");
8986
+ let Ppmt = _Ppmt;
8987
+ const _Pv = class _Pv extends BaseFunction {
6559
8988
  constructor() {
6560
8989
  super(...arguments);
6561
- __publicField(this, "minParams", 2);
6562
- __publicField(this, "maxParams", 3);
8990
+ __publicField(this, "minParams", 3);
8991
+ __publicField(this, "maxParams", 5);
6563
8992
  }
6564
- calculate(startDate, endDate, basis) {
6565
- let _basis = basis != null ? basis : NumberValueObject.create(0);
6566
- const _startDate = this._checkArrayError(startDate);
6567
- if (_startDate.isError())
6568
- return _startDate;
6569
- const _endDate = this._checkArrayError(endDate);
6570
- if (_endDate.isError())
6571
- return _endDate;
6572
- if (_basis = this._checkArrayError(_basis), _basis.isError())
6573
- return _basis;
6574
- if (_startDate.isBoolean() || _endDate.isBoolean() || _basis.isBoolean())
6575
- return ErrorValueObject.create(ErrorType$1.VALUE);
6576
- const startDateSerialNumber = getDateSerialNumberByObject(_startDate);
6577
- if (typeof startDateSerialNumber != "number")
6578
- return startDateSerialNumber;
6579
- const endDateSerialNumber = getDateSerialNumberByObject(_endDate);
6580
- if (typeof endDateSerialNumber != "number")
6581
- return endDateSerialNumber;
6582
- const basisValue = Math.floor(+_basis.getValue());
6583
- if (Number.isNaN(basisValue))
6584
- return ErrorValueObject.create(ErrorType$1.VALUE);
6585
- if (basisValue < 0 || basisValue > 4)
6586
- return ErrorValueObject.create(ErrorType$1.NUM);
6587
- switch (basisValue) {
6588
- case 0:
6589
- return this._getResultByNASD(startDateSerialNumber, endDateSerialNumber);
6590
- case 1:
6591
- return this._getResultByActual(startDateSerialNumber, endDateSerialNumber);
6592
- case 2:
6593
- return NumberValueObject.create(Math.abs(endDateSerialNumber - startDateSerialNumber) / 360);
6594
- case 3:
6595
- return NumberValueObject.create(Math.abs(endDateSerialNumber - startDateSerialNumber) / 365);
6596
- case 4:
6597
- return this._getResultByEuropean(startDateSerialNumber, endDateSerialNumber);
6598
- default:
6599
- return NumberValueObject.create(0);
6600
- }
8993
+ calculate(rate, nper, pmt, fv, type) {
8994
+ const _fv = fv != null ? fv : NumberValueObject.create(0), _type = type != null ? type : NumberValueObject.create(0), maxRowLength = Math.max(
8995
+ rate.isArray() ? rate.getRowCount() : 1,
8996
+ nper.isArray() ? nper.getRowCount() : 1,
8997
+ pmt.isArray() ? pmt.getRowCount() : 1,
8998
+ _fv.isArray() ? _fv.getRowCount() : 1,
8999
+ _type.isArray() ? _type.getRowCount() : 1
9000
+ ), maxColumnLength = Math.max(
9001
+ rate.isArray() ? rate.getColumnCount() : 1,
9002
+ nper.isArray() ? nper.getColumnCount() : 1,
9003
+ pmt.isArray() ? pmt.getColumnCount() : 1,
9004
+ _fv.isArray() ? _fv.getColumnCount() : 1,
9005
+ _type.isArray() ? _type.getColumnCount() : 1
9006
+ ), rateArray = expandArrayValueObject(maxRowLength, maxColumnLength, rate, ErrorValueObject.create(ErrorType$1.NA)), nperArray = expandArrayValueObject(maxRowLength, maxColumnLength, nper, ErrorValueObject.create(ErrorType$1.NA)), pmtArray = expandArrayValueObject(maxRowLength, maxColumnLength, pmt, ErrorValueObject.create(ErrorType$1.NA)), fvArray = expandArrayValueObject(maxRowLength, maxColumnLength, _fv, ErrorValueObject.create(ErrorType$1.NA)), typeArray = expandArrayValueObject(maxRowLength, maxColumnLength, _type, ErrorValueObject.create(ErrorType$1.NA)), resultArray = rateArray.map((rateObject, rowIndex, columnIndex) => {
9007
+ const nperObject = nperArray.get(rowIndex, columnIndex), pmtObject = pmtArray.get(rowIndex, columnIndex), fvObject = fvArray.get(rowIndex, columnIndex), typeObject = typeArray.get(rowIndex, columnIndex), { isError, errorObject, variants } = checkVariantsErrorIsStringToNumber(rateObject, nperObject, pmtObject, fvObject, typeObject);
9008
+ if (isError)
9009
+ return errorObject;
9010
+ const [_rateObject, _nperObject, _pmtObject, _fvObject, _typeObject] = variants, rateValue = +_rateObject.getValue(), nperValue = +_nperObject.getValue(), pmtValue = +_pmtObject.getValue(), fvValue = +_fvObject.getValue();
9011
+ let typeValue = +_typeObject.getValue();
9012
+ typeValue = typeValue ? 1 : 0;
9013
+ const result = rateValue === 0 ? -pmtValue * nperValue - fvValue : ((1 - (1 + rateValue) ** nperValue) / rateValue * pmtValue * (1 + rateValue * typeValue) - fvValue) / (1 + rateValue) ** nperValue;
9014
+ return Number.isNaN(result) || !Number.isFinite(result) ? ErrorValueObject.create(ErrorType$1.NUM) : rowIndex === 0 && columnIndex === 0 ? NumberValueObject.create(result, '"¥"#,##0.00_);[Red]("¥"#,##0.00)') : NumberValueObject.create(result);
9015
+ });
9016
+ return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
6601
9017
  }
6602
- _checkArrayError(variant) {
6603
- let _variant = variant;
6604
- if (_variant.isArray()) {
6605
- const rowCount = _variant.getRowCount(), columnCount = _variant.getColumnCount();
6606
- if (rowCount > 1 || columnCount > 1)
6607
- return ErrorValueObject.create(ErrorType$1.VALUE);
6608
- _variant = _variant.get(0, 0);
6609
- }
6610
- return _variant.isError(), _variant;
9018
+ };
9019
+ __name(_Pv, "Pv");
9020
+ let Pv = _Pv;
9021
+ const _Rate = class _Rate extends BaseFunction {
9022
+ constructor() {
9023
+ super(...arguments);
9024
+ __publicField(this, "minParams", 3);
9025
+ __publicField(this, "maxParams", 6);
6611
9026
  }
6612
- _getResultByNASD(startDateSerialNumber, endDateSerialNumber) {
6613
- const startDateDate = excelSerialToDate(startDateSerialNumber), startYear = startDateSerialNumber > 0 ? startDateDate.getUTCFullYear() : 1900, startMonth = startDateSerialNumber > 0 ? startDateDate.getUTCMonth() + 1 : 1;
6614
- let startDay = startDateSerialNumber > 0 ? startDateDate.getUTCDate() : 0, endDateDate = excelSerialToDate(endDateSerialNumber), endYear = endDateSerialNumber > 0 ? endDateDate.getUTCFullYear() : 1900, endMonth = endDateSerialNumber > 0 ? endDateDate.getUTCMonth() + 1 : 1, endDay = endDateSerialNumber > 0 ? endDateDate.getUTCDate() : 0;
6615
- startDay === 31 && (startDay = 30), endDay === 31 && (startDay < 30 ? (endDateDate = excelSerialToDate(endDateSerialNumber + 1), endYear = endDateDate.getUTCFullYear(), endMonth = endDateDate.getUTCMonth() + 1, endDay = endDateDate.getUTCDate()) : endDay = 30);
6616
- const daysInYears = (endYear - startYear) * 360, daysInStartMonth = endDateSerialNumber >= startDateSerialNumber ? 30 - startDay : -startDay, daysInEndMonth = endDateSerialNumber >= startDateSerialNumber ? endDay : endDay - 30, daysInMidMonths = (endDateSerialNumber >= startDateSerialNumber ? endMonth - startMonth - 1 : endMonth - startMonth + 1) * 30, result = Math.abs(daysInYears + daysInStartMonth + daysInEndMonth + daysInMidMonths) / 360;
6617
- return NumberValueObject.create(result);
9027
+ calculate(nper, pmt, pv, fv, type, guess) {
9028
+ const _fv = fv != null ? fv : NumberValueObject.create(0), _type = type != null ? type : NumberValueObject.create(0), _guess = guess != null ? guess : NumberValueObject.create(0.1), maxRowLength = Math.max(
9029
+ nper.isArray() ? nper.getRowCount() : 1,
9030
+ pmt.isArray() ? pmt.getRowCount() : 1,
9031
+ pv.isArray() ? pv.getRowCount() : 1,
9032
+ _fv.isArray() ? _fv.getRowCount() : 1,
9033
+ _type.isArray() ? _type.getRowCount() : 1,
9034
+ _guess.isArray() ? _guess.getRowCount() : 1
9035
+ ), maxColumnLength = Math.max(
9036
+ nper.isArray() ? nper.getColumnCount() : 1,
9037
+ pmt.isArray() ? pmt.getColumnCount() : 1,
9038
+ pv.isArray() ? pv.getColumnCount() : 1,
9039
+ _fv.isArray() ? _fv.getColumnCount() : 1,
9040
+ _type.isArray() ? _type.getColumnCount() : 1,
9041
+ _guess.isArray() ? _guess.getColumnCount() : 1
9042
+ ), nperArray = expandArrayValueObject(maxRowLength, maxColumnLength, nper, ErrorValueObject.create(ErrorType$1.NA)), pmtArray = expandArrayValueObject(maxRowLength, maxColumnLength, pmt, ErrorValueObject.create(ErrorType$1.NA)), pvArray = expandArrayValueObject(maxRowLength, maxColumnLength, pv, ErrorValueObject.create(ErrorType$1.NA)), fvArray = expandArrayValueObject(maxRowLength, maxColumnLength, _fv, ErrorValueObject.create(ErrorType$1.NA)), typeArray = expandArrayValueObject(maxRowLength, maxColumnLength, _type, ErrorValueObject.create(ErrorType$1.NA)), guessArray = expandArrayValueObject(maxRowLength, maxColumnLength, _guess, ErrorValueObject.create(ErrorType$1.NA)), resultArray = nperArray.map((nperObject, rowIndex, columnIndex) => {
9043
+ const pmtObject = pmtArray.get(rowIndex, columnIndex), pvObject = pvArray.get(rowIndex, columnIndex), fvObject = fvArray.get(rowIndex, columnIndex), typeObject = typeArray.get(rowIndex, columnIndex), guessObject = guessArray.get(rowIndex, columnIndex), { isError, errorObject, variants } = checkVariantsErrorIsStringToNumber(nperObject, pmtObject, pvObject, fvObject, typeObject, guessObject);
9044
+ if (isError)
9045
+ return errorObject;
9046
+ const [_nperObject, _pmtObject, _pvObject, _fvObject, _typeObject, _guessObject] = variants, nperValue = +_nperObject.getValue(), pmtValue = +_pmtObject.getValue(), pvValue = +_pvObject.getValue(), fvValue = +_fvObject.getValue();
9047
+ let typeValue = +_typeObject.getValue();
9048
+ const guessValue = +_guessObject.getValue();
9049
+ return typeValue = typeValue ? 1 : 0, nperValue <= 0 || pmtValue >= 0 ? ErrorValueObject.create(ErrorType$1.NUM) : this._getResult(nperValue, pmtValue, pvValue, fvValue, typeValue, guessValue, rowIndex, columnIndex);
9050
+ });
9051
+ return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
6618
9052
  }
6619
- _getResultByActual(startDateSerialNumber, endDateSerialNumber) {
6620
- const startDateDate = excelSerialToDate(startDateSerialNumber), startYear = startDateSerialNumber > 0 ? startDateDate.getUTCFullYear() : 1900, endDateDate = excelSerialToDate(endDateSerialNumber), endYear = endDateSerialNumber > 0 ? endDateDate.getUTCFullYear() : 1900, totalDays = Math.abs(endDateSerialNumber - startDateSerialNumber), totalYear = Math.abs(endYear - startYear) + 1;
6621
- let startYearFirstDaySerialNumber, endYearLastDaySerialNumber;
6622
- if (endYear < startYear) {
6623
- const startYearFirstDay = new Date(Date.UTC(endYear, 0, 1)), endYearLastDay = new Date(Date.UTC(startYear, 11, 31));
6624
- startYearFirstDaySerialNumber = excelDateSerial(startYearFirstDay), endYearLastDaySerialNumber = excelDateSerial(endYearLastDay), endYear === 1900 && (startYearFirstDaySerialNumber += 1);
6625
- } else {
6626
- const startYearFirstDay = new Date(Date.UTC(startYear, 0, 1)), endYearLastDay = new Date(Date.UTC(endYear, 11, 31));
6627
- startYearFirstDaySerialNumber = excelDateSerial(startYearFirstDay), endYearLastDaySerialNumber = excelDateSerial(endYearLastDay), startYear === 1900 && (startYearFirstDaySerialNumber += 1);
9053
+ _getResult(nperValue, pmtValue, pvValue, fvValue, typeValue, guessValue, rowIndex, columnIndex) {
9054
+ let result = guessValue;
9055
+ for (let i = 0; i < 20; i++) {
9056
+ if (result <= -1)
9057
+ return ErrorValueObject.create(ErrorType$1.NUM);
9058
+ let y, f;
9059
+ if (Math.abs(result) < 1e-10 ? y = pvValue * (1 + nperValue * result) + pmtValue * (1 + result * typeValue) * nperValue + fvValue : (f = (1 + result) ** nperValue, y = pvValue * f + pmtValue * (1 / result + typeValue) * (f - 1) + fvValue), Math.abs(y) < 1e-10)
9060
+ break;
9061
+ let dy;
9062
+ if (Math.abs(result) < 1e-10)
9063
+ dy = pvValue * nperValue + pmtValue * typeValue * nperValue;
9064
+ else {
9065
+ f = (1 + result) ** nperValue;
9066
+ const df = nperValue * (1 + result) ** (nperValue - 1);
9067
+ dy = pvValue * df + pmtValue * (1 / result + typeValue) * df + pmtValue * (-1 / (result * result)) * (f - 1);
9068
+ }
9069
+ result -= y / dy;
6628
9070
  }
6629
- const result = totalDays / ((endYearLastDaySerialNumber - startYearFirstDaySerialNumber + 1) / totalYear);
6630
- return NumberValueObject.create(result);
6631
- }
6632
- _getResultByEuropean(startDateSerialNumber, endDateSerialNumber) {
6633
- const startDateDate = excelSerialToDate(startDateSerialNumber), startYear = startDateSerialNumber > 0 ? startDateDate.getUTCFullYear() : 1900, startMonth = startDateSerialNumber > 0 ? startDateDate.getUTCMonth() + 1 : 1;
6634
- let startDay = startDateSerialNumber > 0 ? startDateDate.getUTCDate() : 0;
6635
- const endDateDate = excelSerialToDate(endDateSerialNumber), endYear = endDateSerialNumber > 0 ? endDateDate.getUTCFullYear() : 1900, endMonth = endDateSerialNumber > 0 ? endDateDate.getUTCMonth() + 1 : 1;
6636
- let endDay = endDateSerialNumber > 0 ? endDateDate.getUTCDate() : 0;
6637
- startDay === 31 && (startDay = 30), endDay === 31 && (endDay = 30);
6638
- const daysInYears = (endYear - startYear) * 360, daysInStartMonth = endDateSerialNumber >= startDateSerialNumber ? 30 - startDay : -startDay, daysInEndMonth = endDateSerialNumber >= startDateSerialNumber ? endDay : endDay - 30, daysInMidMonths = (endDateSerialNumber >= startDateSerialNumber ? endMonth - startMonth - 1 : endMonth - startMonth + 1) * 30, result = Math.abs(daysInYears + daysInStartMonth + daysInEndMonth + daysInMidMonths) / 360;
6639
- return NumberValueObject.create(result);
9071
+ return rowIndex === 0 && columnIndex === 0 ? NumberValueObject.create(result, "0%") : NumberValueObject.create(result);
6640
9072
  }
6641
9073
  };
6642
- __name(_Yearfrac, "Yearfrac");
6643
- let Yearfrac = _Yearfrac;
6644
- const functionDate = [
6645
- [DateFunction, FUNCTION_NAMES_DATE.DATE],
6646
- [Datedif, FUNCTION_NAMES_DATE.DATEDIF],
6647
- [Datevalue, FUNCTION_NAMES_DATE.DATEVALUE],
6648
- [Day, FUNCTION_NAMES_DATE.DAY],
6649
- [Days, FUNCTION_NAMES_DATE.DAYS],
6650
- [Days360, FUNCTION_NAMES_DATE.DAYS360],
6651
- [Edate, FUNCTION_NAMES_DATE.EDATE],
6652
- [Eomonth, FUNCTION_NAMES_DATE.EOMONTH],
6653
- [Hour, FUNCTION_NAMES_DATE.HOUR],
6654
- [Isoweeknum, FUNCTION_NAMES_DATE.ISOWEEKNUM],
6655
- [Minute, FUNCTION_NAMES_DATE.MINUTE],
6656
- [Month, FUNCTION_NAMES_DATE.MONTH],
6657
- [Networkdays, FUNCTION_NAMES_DATE.NETWORKDAYS],
6658
- [NetworkdaysIntl, FUNCTION_NAMES_DATE.NETWORKDAYS_INTL],
6659
- [Now, FUNCTION_NAMES_DATE.NOW],
6660
- [Second, FUNCTION_NAMES_DATE.SECOND],
6661
- [Time, FUNCTION_NAMES_DATE.TIME],
6662
- [Timevalue, FUNCTION_NAMES_DATE.TIMEVALUE],
6663
- [Today, FUNCTION_NAMES_DATE.TODAY],
6664
- [Weekday, FUNCTION_NAMES_DATE.WEEKDAY],
6665
- [Weeknum, FUNCTION_NAMES_DATE.WEEKNUM],
6666
- [Workday, FUNCTION_NAMES_DATE.WORKDAY],
6667
- [WorkdayIntl, FUNCTION_NAMES_DATE.WORKDAY_INTL],
6668
- [Year, FUNCTION_NAMES_DATE.YEAR],
6669
- [Yearfrac, FUNCTION_NAMES_DATE.YEARFRAC]
6670
- ], functionEngineering = [];
6671
- var FUNCTION_NAMES_ENGINEERING = /* @__PURE__ */ ((FUNCTION_NAMES_ENGINEERING2) => (FUNCTION_NAMES_ENGINEERING2.BESSELI = "BESSELI", FUNCTION_NAMES_ENGINEERING2.BESSELJ = "BESSELJ", FUNCTION_NAMES_ENGINEERING2.BESSELK = "BESSELK", FUNCTION_NAMES_ENGINEERING2.BESSELY = "BESSELY", FUNCTION_NAMES_ENGINEERING2.BIN2DEC = "BIN2DEC", FUNCTION_NAMES_ENGINEERING2.BIN2HEX = "BIN2HEX", FUNCTION_NAMES_ENGINEERING2.BIN2OCT = "BIN2OCT", FUNCTION_NAMES_ENGINEERING2.BITAND = "BITAND", FUNCTION_NAMES_ENGINEERING2.BITLSHIFT = "BITLSHIFT", FUNCTION_NAMES_ENGINEERING2.BITOR = "BITOR", FUNCTION_NAMES_ENGINEERING2.BITRSHIFT = "BITRSHIFT", FUNCTION_NAMES_ENGINEERING2.BITXOR = "BITXOR", FUNCTION_NAMES_ENGINEERING2.COMPLEX = "COMPLEX", FUNCTION_NAMES_ENGINEERING2.CONVERT = "CONVERT", FUNCTION_NAMES_ENGINEERING2.DEC2BIN = "DEC2BIN", FUNCTION_NAMES_ENGINEERING2.DEC2HEX = "DEC2HEX", FUNCTION_NAMES_ENGINEERING2.DEC2OCT = "DEC2OCT", FUNCTION_NAMES_ENGINEERING2.DELTA = "DELTA", FUNCTION_NAMES_ENGINEERING2.ERF = "ERF", FUNCTION_NAMES_ENGINEERING2.ERF_PRECISE = "ERF.PRECISE", FUNCTION_NAMES_ENGINEERING2.ERFC = "ERFC", FUNCTION_NAMES_ENGINEERING2.ERFC_PRECISE = "ERFC.PRECISE", FUNCTION_NAMES_ENGINEERING2.GESTEP = "GESTEP", FUNCTION_NAMES_ENGINEERING2.HEX2BIN = "HEX2BIN", FUNCTION_NAMES_ENGINEERING2.HEX2DEC = "HEX2DEC", FUNCTION_NAMES_ENGINEERING2.HEX2OCT = "HEX2OCT", FUNCTION_NAMES_ENGINEERING2.IMABS = "IMABS", FUNCTION_NAMES_ENGINEERING2.IMAGINARY = "IMAGINARY", FUNCTION_NAMES_ENGINEERING2.IMARGUMENT = "IMARGUMENT", FUNCTION_NAMES_ENGINEERING2.IMCONJUGATE = "IMCONJUGATE", FUNCTION_NAMES_ENGINEERING2.IMCOS = "IMCOS", FUNCTION_NAMES_ENGINEERING2.IMCOSH = "IMCOSH", FUNCTION_NAMES_ENGINEERING2.IMCOT = "IMCOT", FUNCTION_NAMES_ENGINEERING2.IMCSC = "IMCSC", FUNCTION_NAMES_ENGINEERING2.IMCSCH = "IMCSCH", FUNCTION_NAMES_ENGINEERING2.IMDIV = "IMDIV", FUNCTION_NAMES_ENGINEERING2.IMEXP = "IMEXP", FUNCTION_NAMES_ENGINEERING2.IMLN = "IMLN", FUNCTION_NAMES_ENGINEERING2.IMLOG10 = "IMLOG10", FUNCTION_NAMES_ENGINEERING2.IMLOG2 = "IMLOG2", FUNCTION_NAMES_ENGINEERING2.IMPOWER = "IMPOWER", FUNCTION_NAMES_ENGINEERING2.IMPRODUCT = "IMPRODUCT", FUNCTION_NAMES_ENGINEERING2.IMREAL = "IMREAL", FUNCTION_NAMES_ENGINEERING2.IMSEC = "IMSEC", FUNCTION_NAMES_ENGINEERING2.IMSECH = "IMSECH", FUNCTION_NAMES_ENGINEERING2.IMSIN = "IMSIN", FUNCTION_NAMES_ENGINEERING2.IMSINH = "IMSINH", FUNCTION_NAMES_ENGINEERING2.IMSQRT = "IMSQRT", FUNCTION_NAMES_ENGINEERING2.IMSUB = "IMSUB", FUNCTION_NAMES_ENGINEERING2.IMSUM = "IMSUM", FUNCTION_NAMES_ENGINEERING2.IMTAN = "IMTAN", FUNCTION_NAMES_ENGINEERING2.OCT2BIN = "OCT2BIN", FUNCTION_NAMES_ENGINEERING2.OCT2DEC = "OCT2DEC", FUNCTION_NAMES_ENGINEERING2.OCT2HEX = "OCT2HEX", FUNCTION_NAMES_ENGINEERING2))(FUNCTION_NAMES_ENGINEERING || {});
6672
- const functionFinancial = [];
6673
- var FUNCTION_NAMES_FINANCIAL = /* @__PURE__ */ ((FUNCTION_NAMES_FINANCIAL2) => (FUNCTION_NAMES_FINANCIAL2.ACCRINT = "ACCRINT", FUNCTION_NAMES_FINANCIAL2.ACCRINTM = "ACCRINTM", FUNCTION_NAMES_FINANCIAL2.AMORDEGRC = "AMORDEGRC", FUNCTION_NAMES_FINANCIAL2.AMORLINC = "AMORLINC", FUNCTION_NAMES_FINANCIAL2.COUPDAYBS = "COUPDAYBS", FUNCTION_NAMES_FINANCIAL2.COUPDAYS = "COUPDAYS", FUNCTION_NAMES_FINANCIAL2.COUPDAYSNC = "COUPDAYSNC", FUNCTION_NAMES_FINANCIAL2.COUPNCD = "COUPNCD", FUNCTION_NAMES_FINANCIAL2.COUPNUM = "COUPNUM", FUNCTION_NAMES_FINANCIAL2.COUPPCD = "COUPPCD", FUNCTION_NAMES_FINANCIAL2.CUMIPMT = "CUMIPMT", FUNCTION_NAMES_FINANCIAL2.CUMPRINC = "CUMPRINC", FUNCTION_NAMES_FINANCIAL2.DB = "DB", FUNCTION_NAMES_FINANCIAL2.DDB = "DDB", FUNCTION_NAMES_FINANCIAL2.DISC = "DISC", FUNCTION_NAMES_FINANCIAL2.DOLLARDE = "DOLLARDE", FUNCTION_NAMES_FINANCIAL2.DOLLARFR = "DOLLARFR", FUNCTION_NAMES_FINANCIAL2.DURATION = "DURATION", FUNCTION_NAMES_FINANCIAL2.EFFECT = "EFFECT", FUNCTION_NAMES_FINANCIAL2.FV = "FV", FUNCTION_NAMES_FINANCIAL2.FVSCHEDULE = "FVSCHEDULE", FUNCTION_NAMES_FINANCIAL2.INTRATE = "INTRATE", FUNCTION_NAMES_FINANCIAL2.IPMT = "IPMT", FUNCTION_NAMES_FINANCIAL2.IRR = "IRR", FUNCTION_NAMES_FINANCIAL2.ISPMT = "ISPMT", FUNCTION_NAMES_FINANCIAL2.MDURATION = "MDURATION", FUNCTION_NAMES_FINANCIAL2.MIRR = "MIRR", FUNCTION_NAMES_FINANCIAL2.NOMINAL = "NOMINAL", FUNCTION_NAMES_FINANCIAL2.NPER = "NPER", FUNCTION_NAMES_FINANCIAL2.NPV = "NPV", FUNCTION_NAMES_FINANCIAL2.ODDFPRICE = "ODDFPRICE", FUNCTION_NAMES_FINANCIAL2.ODDFYIELD = "ODDFYIELD", FUNCTION_NAMES_FINANCIAL2.ODDLPRICE = "ODDLPRICE", FUNCTION_NAMES_FINANCIAL2.ODDLYIELD = "ODDLYIELD", FUNCTION_NAMES_FINANCIAL2.PDURATION = "PDURATION", FUNCTION_NAMES_FINANCIAL2.PMT = "PMT", FUNCTION_NAMES_FINANCIAL2.PPMT = "PPMT", FUNCTION_NAMES_FINANCIAL2.PRICE = "PRICE", FUNCTION_NAMES_FINANCIAL2.PRICEDISC = "PRICEDISC", FUNCTION_NAMES_FINANCIAL2.PRICEMAT = "PRICEMAT", FUNCTION_NAMES_FINANCIAL2.PV = "PV", FUNCTION_NAMES_FINANCIAL2.RATE = "RATE", FUNCTION_NAMES_FINANCIAL2.RECEIVED = "RECEIVED", FUNCTION_NAMES_FINANCIAL2.RRI = "RRI", FUNCTION_NAMES_FINANCIAL2.SLN = "SLN", FUNCTION_NAMES_FINANCIAL2.SYD = "SYD", FUNCTION_NAMES_FINANCIAL2.TBILLEQ = "TBILLEQ", FUNCTION_NAMES_FINANCIAL2.TBILLPRICE = "TBILLPRICE", FUNCTION_NAMES_FINANCIAL2.TBILLYIELD = "TBILLYIELD", FUNCTION_NAMES_FINANCIAL2.VDB = "VDB", FUNCTION_NAMES_FINANCIAL2.XIRR = "XIRR", FUNCTION_NAMES_FINANCIAL2.XNPV = "XNPV", FUNCTION_NAMES_FINANCIAL2.YIELD = "YIELD", FUNCTION_NAMES_FINANCIAL2.YIELDDISC = "YIELDDISC", FUNCTION_NAMES_FINANCIAL2.YIELDMAT = "YIELDMAT", FUNCTION_NAMES_FINANCIAL2))(FUNCTION_NAMES_FINANCIAL || {}), FUNCTION_NAMES_INFORMATION = /* @__PURE__ */ ((FUNCTION_NAMES_INFORMATION2) => (FUNCTION_NAMES_INFORMATION2.CELL = "CELL", FUNCTION_NAMES_INFORMATION2.ERROR_TYPE = "ERROR.TYPE", FUNCTION_NAMES_INFORMATION2.INFO = "INFO", FUNCTION_NAMES_INFORMATION2.ISBLANK = "ISBLANK", FUNCTION_NAMES_INFORMATION2.ISERR = "ISERR", FUNCTION_NAMES_INFORMATION2.ISERROR = "ISERROR", FUNCTION_NAMES_INFORMATION2.ISEVEN = "ISEVEN", FUNCTION_NAMES_INFORMATION2.ISFORMULA = "ISFORMULA", FUNCTION_NAMES_INFORMATION2.ISLOGICAL = "ISLOGICAL", FUNCTION_NAMES_INFORMATION2.ISNA = "ISNA", FUNCTION_NAMES_INFORMATION2.ISNONTEXT = "ISNONTEXT", FUNCTION_NAMES_INFORMATION2.ISNUMBER = "ISNUMBER", FUNCTION_NAMES_INFORMATION2.ISODD = "ISODD", FUNCTION_NAMES_INFORMATION2.ISOMITTED = "ISOMITTED", FUNCTION_NAMES_INFORMATION2.ISREF = "ISREF", FUNCTION_NAMES_INFORMATION2.ISTEXT = "ISTEXT", FUNCTION_NAMES_INFORMATION2.N = "N", FUNCTION_NAMES_INFORMATION2.NA = "NA", FUNCTION_NAMES_INFORMATION2.SHEET = "SHEET", FUNCTION_NAMES_INFORMATION2.SHEETS = "SHEETS", FUNCTION_NAMES_INFORMATION2.TYPE = "TYPE", FUNCTION_NAMES_INFORMATION2))(FUNCTION_NAMES_INFORMATION || {});
9074
+ __name(_Rate, "Rate");
9075
+ let Rate = _Rate;
9076
+ const functionFinancial = [
9077
+ [Accrint, FUNCTION_NAMES_FINANCIAL.ACCRINT],
9078
+ [Accrintm, FUNCTION_NAMES_FINANCIAL.ACCRINTM],
9079
+ [Amorlinc, FUNCTION_NAMES_FINANCIAL.AMORLINC],
9080
+ [Coupdaybs, FUNCTION_NAMES_FINANCIAL.COUPDAYBS],
9081
+ [Coupdays, FUNCTION_NAMES_FINANCIAL.COUPDAYS],
9082
+ [Coupdaysnc, FUNCTION_NAMES_FINANCIAL.COUPDAYSNC],
9083
+ [Coupncd, FUNCTION_NAMES_FINANCIAL.COUPNCD],
9084
+ [Coupnum, FUNCTION_NAMES_FINANCIAL.COUPNUM],
9085
+ [Couppcd, FUNCTION_NAMES_FINANCIAL.COUPPCD],
9086
+ [Cumipmt, FUNCTION_NAMES_FINANCIAL.CUMIPMT],
9087
+ [Cumprinc, FUNCTION_NAMES_FINANCIAL.CUMPRINC],
9088
+ [Db, FUNCTION_NAMES_FINANCIAL.DB],
9089
+ [Ddb, FUNCTION_NAMES_FINANCIAL.DDB],
9090
+ [Disc, FUNCTION_NAMES_FINANCIAL.DISC],
9091
+ [Dollarde, FUNCTION_NAMES_FINANCIAL.DOLLARDE],
9092
+ [Dollarfr, FUNCTION_NAMES_FINANCIAL.DOLLARFR],
9093
+ [Effect, FUNCTION_NAMES_FINANCIAL.EFFECT],
9094
+ [Fv, FUNCTION_NAMES_FINANCIAL.FV],
9095
+ [Fvschedule, FUNCTION_NAMES_FINANCIAL.FVSCHEDULE],
9096
+ [Intrate, FUNCTION_NAMES_FINANCIAL.INTRATE],
9097
+ [Ipmt, FUNCTION_NAMES_FINANCIAL.IPMT],
9098
+ [Ispmt, FUNCTION_NAMES_FINANCIAL.ISPMT],
9099
+ [Nominal, FUNCTION_NAMES_FINANCIAL.NOMINAL],
9100
+ [Nper, FUNCTION_NAMES_FINANCIAL.NPER],
9101
+ [Pmt, FUNCTION_NAMES_FINANCIAL.PMT],
9102
+ [Ppmt, FUNCTION_NAMES_FINANCIAL.PPMT],
9103
+ [Pv, FUNCTION_NAMES_FINANCIAL.PV],
9104
+ [Rate, FUNCTION_NAMES_FINANCIAL.RATE]
9105
+ ];
9106
+ var FUNCTION_NAMES_INFORMATION = /* @__PURE__ */ ((FUNCTION_NAMES_INFORMATION2) => (FUNCTION_NAMES_INFORMATION2.CELL = "CELL", FUNCTION_NAMES_INFORMATION2.ERROR_TYPE = "ERROR.TYPE", FUNCTION_NAMES_INFORMATION2.INFO = "INFO", FUNCTION_NAMES_INFORMATION2.ISBLANK = "ISBLANK", FUNCTION_NAMES_INFORMATION2.ISERR = "ISERR", FUNCTION_NAMES_INFORMATION2.ISERROR = "ISERROR", FUNCTION_NAMES_INFORMATION2.ISEVEN = "ISEVEN", FUNCTION_NAMES_INFORMATION2.ISFORMULA = "ISFORMULA", FUNCTION_NAMES_INFORMATION2.ISLOGICAL = "ISLOGICAL", FUNCTION_NAMES_INFORMATION2.ISNA = "ISNA", FUNCTION_NAMES_INFORMATION2.ISNONTEXT = "ISNONTEXT", FUNCTION_NAMES_INFORMATION2.ISNUMBER = "ISNUMBER", FUNCTION_NAMES_INFORMATION2.ISODD = "ISODD", FUNCTION_NAMES_INFORMATION2.ISOMITTED = "ISOMITTED", FUNCTION_NAMES_INFORMATION2.ISREF = "ISREF", FUNCTION_NAMES_INFORMATION2.ISTEXT = "ISTEXT", FUNCTION_NAMES_INFORMATION2.N = "N", FUNCTION_NAMES_INFORMATION2.NA = "NA", FUNCTION_NAMES_INFORMATION2.SHEET = "SHEET", FUNCTION_NAMES_INFORMATION2.SHEETS = "SHEETS", FUNCTION_NAMES_INFORMATION2.TYPE = "TYPE", FUNCTION_NAMES_INFORMATION2))(FUNCTION_NAMES_INFORMATION || {});
6674
9107
  const _Cell = class _Cell extends BaseFunction {
6675
9108
  constructor() {
6676
9109
  super(...arguments);
@@ -7134,35 +9567,33 @@ const _Ifs = class _Ifs extends BaseFunction {
7134
9567
  for (let i = 0; i < params.length; i++)
7135
9568
  if (params[i].isError())
7136
9569
  return params[i];
7137
- if (!params.some((param) => param.isArray())) {
7138
- for (let i = 0; i < params.length; i += 2) {
7139
- const condition = params[i], result = params[i + 1];
7140
- if (condition.isNull())
7141
- continue;
7142
- if (condition.getValue())
7143
- return result.isNull() ? ErrorValueObject.create(ErrorType$1.NA) : result;
7144
- }
7145
- return ErrorValueObject.create(ErrorType$1.NA);
7146
- }
7147
9570
  const maxRowLength = Math.max(
7148
9571
  ...params.map((param) => param.isArray() ? param.getRowCount() : 1)
7149
9572
  ), maxColumnLength = Math.max(
7150
9573
  ...params.map((param) => param.isArray() ? param.getColumnCount() : 1)
7151
9574
  ), expandedParams = params.map(
7152
9575
  (param) => expandArrayValueObject(maxRowLength, maxColumnLength, param, ErrorValueObject.create(ErrorType$1.NA))
7153
- );
7154
- return expandedParams[0].map((_, rowIndex, columnIndex) => {
9576
+ ), resultArray = expandedParams[0].map((_, rowIndex, columnIndex) => {
7155
9577
  for (let i = 0; i < expandedParams.length; i += 2) {
7156
9578
  const condition = expandedParams[i].get(rowIndex, columnIndex) || NullValueObject.create(), result = expandedParams[i + 1].get(rowIndex, columnIndex) || NullValueObject.create();
7157
9579
  if (condition.isNull())
7158
9580
  continue;
7159
9581
  if (condition.isError())
7160
9582
  return condition;
7161
- if (condition.getValue())
9583
+ const conditionValue = condition.getValue();
9584
+ if (condition.isString()) {
9585
+ if (`${conditionValue}`.toLocaleUpperCase() === "TRUE")
9586
+ return result;
9587
+ if (`${conditionValue}`.toLocaleUpperCase() === "FALSE")
9588
+ continue;
9589
+ return ErrorValueObject.create(ErrorType$1.VALUE);
9590
+ }
9591
+ if (+conditionValue)
7162
9592
  return result.isNull() ? ErrorValueObject.create(ErrorType$1.NA) : result;
7163
9593
  }
7164
9594
  return ErrorValueObject.create(ErrorType$1.NA);
7165
9595
  });
9596
+ return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
7166
9597
  }
7167
9598
  };
7168
9599
  __name(_Ifs, "Ifs");
@@ -7179,6 +9610,18 @@ const _Lambda = class _Lambda extends BaseFunction {
7179
9610
  };
7180
9611
  __name(_Lambda, "Lambda");
7181
9612
  let Lambda = _Lambda;
9613
+ const _Let = class _Let extends BaseFunction {
9614
+ constructor() {
9615
+ super(...arguments);
9616
+ __publicField(this, "minParams", 3);
9617
+ __publicField(this, "maxParams", 255);
9618
+ }
9619
+ calculate(...variants) {
9620
+ return ErrorValueObject.create(ErrorType$1.VALUE);
9621
+ }
9622
+ };
9623
+ __name(_Let, "Let");
9624
+ let Let = _Let;
7182
9625
  const _Makearray = class _Makearray extends BaseFunction {
7183
9626
  constructor() {
7184
9627
  super(...arguments);
@@ -7198,8 +9641,8 @@ const _Makearray = class _Makearray extends BaseFunction {
7198
9641
  for (let r = 0; r < row; r++) {
7199
9642
  result[r] == null && (result[r] = []);
7200
9643
  for (let c = 0; c < column; c++) {
7201
- const value = lambda.execute(NumberValueObject.create(r + 1), NumberValueObject.create(c + 1));
7202
- result[r][c] = value;
9644
+ let value = lambda.execute(NumberValueObject.create(r + 1), NumberValueObject.create(c + 1));
9645
+ value.isArray() && (value = value.get(0, 0)), result[r][c] = value;
7203
9646
  }
7204
9647
  }
7205
9648
  return new AsyncArrayObject(result);
@@ -7216,8 +9659,14 @@ const _Not = class _Not extends BaseFunction {
7216
9659
  __publicField(this, "minParams", 1);
7217
9660
  __publicField(this, "maxParams", 1);
7218
9661
  }
7219
- calculate(logicalValue) {
7220
- return logicalValue.isError() ? logicalValue : logicalValue.isArray() ? logicalValue.map((value) => value != null && value.isError() ? value : value != null && value.isBoolean() || value != null && value.isNumber() ? BooleanValueObject.create(!value.getValue()) : ErrorValueObject.create(ErrorType$1.VALUE)) : logicalValue.isBoolean() || logicalValue.isNumber() ? BooleanValueObject.create(!logicalValue.getValue()) : ErrorValueObject.create(ErrorType$1.VALUE);
9662
+ calculate(logical) {
9663
+ return logical.isArray() ? logical.map((logicalObject) => this._handleSingleObject(logicalObject)) : this._handleSingleObject(logical);
9664
+ }
9665
+ _handleSingleObject(logical) {
9666
+ if (logical.isError())
9667
+ return logical;
9668
+ const logicalValue = +logical.getValue();
9669
+ return Number.isNaN(logicalValue) ? ErrorValueObject.create(ErrorType$1.VALUE) : BooleanValueObject.create(!logicalValue);
7221
9670
  }
7222
9671
  };
7223
9672
  __name(_Not, "Not");
@@ -7264,7 +9713,7 @@ const _Switch = class _Switch extends BaseFunction {
7264
9713
  if (!switchValue.isNull()) {
7265
9714
  if (switchValue.isError())
7266
9715
  return switchValue;
7267
- if (expression.getValue() === switchValue.getValue())
9716
+ if (`${expression.getValue()}`.toLocaleLowerCase() === `${switchValue.getValue()}`.toLocaleLowerCase())
7268
9717
  return resultValue.isNull() ? ErrorValueObject.create(ErrorType$1.NA) : resultValue;
7269
9718
  }
7270
9719
  }
@@ -7288,7 +9737,7 @@ const _Switch = class _Switch extends BaseFunction {
7288
9737
  if (!switchValue.isNull()) {
7289
9738
  if (switchValue.isError() || expValue.isError())
7290
9739
  return switchValue.isError() ? switchValue : expValue;
7291
- if (expValue.getValue() === switchValue.getValue())
9740
+ if (`${expValue.getValue()}`.toLocaleLowerCase() === `${switchValue.getValue()}`.toLocaleLowerCase())
7292
9741
  return resultValue.isNull() ? ErrorValueObject.create(ErrorType$1.NA) : resultValue;
7293
9742
  }
7294
9743
  }
@@ -7344,6 +9793,7 @@ const functionLogical = [
7344
9793
  [Ifna, FUNCTION_NAMES_LOGICAL.IFNA],
7345
9794
  [Ifs, FUNCTION_NAMES_LOGICAL.IFS],
7346
9795
  [Lambda, FUNCTION_NAMES_LOGICAL.LAMBDA],
9796
+ [Let, FUNCTION_NAMES_LOGICAL.LET],
7347
9797
  [Makearray, FUNCTION_NAMES_LOGICAL.MAKEARRAY],
7348
9798
  [Not, FUNCTION_NAMES_LOGICAL.NOT],
7349
9799
  [Or, FUNCTION_NAMES_LOGICAL.OR],
@@ -7781,7 +10231,7 @@ const _Indirect = class _Indirect extends BaseFunction {
7781
10231
  if (new RegExp(REFERENCE_REGEX_COLUMN).test(refTextV))
7782
10232
  return this._setDefault(new ColumnReferenceObject(refTextV));
7783
10233
  const gridRange = deserializeRangeWithSheet(refTextV), { range, sheetName, unitId } = gridRange;
7784
- if (Number.isNaN(range.startRow))
10234
+ if (Number.isNaN(range.startRow) || range.endRow + 1 > 1048576 || Number.isNaN(range.startColumn) || range.endColumn + 1 > 16384)
7785
10235
  return ErrorValueObject.create(ErrorType$1.REF);
7786
10236
  const rangeReferenceObject = new RangeReferenceObject(range);
7787
10237
  return rangeReferenceObject.setForcedUnitIdDirect(unitId), rangeReferenceObject.setForcedSheetName(sheetName), this._setDefault(rangeReferenceObject);
@@ -12879,12 +15329,15 @@ let FormulaRuntimeService = (_a4 = class extends Disposable {
12879
15329
  const cell = (_f = (_e = (_d = this._runtimeData) == null ? void 0 : _d[formulaUnitId]) == null ? void 0 : _e[formulaSheetId]) == null ? void 0 : _f.getValue(r, c), arrayDataCell = (_i = (_h = (_g = this._runtimeArrayFormulaCellData) == null ? void 0 : _g[formulaUnitId]) == null ? void 0 : _h[formulaSheetId]) == null ? void 0 : _i.getValue(
12880
15330
  r,
12881
15331
  c
12882
- ), currentCell = (_l = (_k = (_j = unitData == null ? void 0 : unitData[formulaUnitId]) == null ? void 0 : _j[formulaSheetId]) == null ? void 0 : _k.cellData) == null ? void 0 : _l.getValue(r, c);
12883
- if (!isNullCell(cell) || !isNullCell(arrayDataCell) && !this._isInArrayFormulaRange(unitArrayFormulaRange, r, c) || !isNullCell(currentCell))
15332
+ ), currentCell = (_l = (_k = (_j = unitData == null ? void 0 : unitData[formulaUnitId]) == null ? void 0 : _j[formulaSheetId]) == null ? void 0 : _k.cellData) == null ? void 0 : _l.getValue(r, c), featureCell = this._getRuntimeFeatureCellValue(r, c, formulaSheetId, formulaUnitId);
15333
+ if (!isNullCell(cell) || !isNullCell(arrayDataCell) && !this._isInArrayFormulaRange(unitArrayFormulaRange, r, c) || !isNullCell(currentCell) || !isNullCell(featureCell))
12884
15334
  return !0;
12885
15335
  }
12886
15336
  return !1;
12887
15337
  }
15338
+ _getRuntimeFeatureCellValue(row, column, sheetId, unitId) {
15339
+ return getRuntimeFeatureCell(row, column, sheetId, unitId, this._runtimeFeatureCellData);
15340
+ }
12888
15341
  _isInArrayFormulaRange(range, r, c) {
12889
15342
  if (range == null)
12890
15343
  return !1;
@@ -13215,7 +15668,7 @@ const _FunctionNode = class _FunctionNode extends BaseAstNode {
13215
15668
  this._compatibility();
13216
15669
  for (let i = 0; i < childrenCount; i++) {
13217
15670
  const object = children[i].getValue();
13218
- object != null && (object.isReferenceObject() ? variants.push(object.toArrayValueObject()) : variants.push(object));
15671
+ object != null && (object.isReferenceObject() && !this._functionExecutor.needsReferenceObject ? variants.push(object.toArrayValueObject()) : variants.push(object));
13219
15672
  }
13220
15673
  const resultVariant = this._calculate(variants);
13221
15674
  let result;