@univerjs/engine-formula 0.2.6 → 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 (403) hide show
  1. package/lib/cjs/index.js +1 -1
  2. package/lib/es/index.js +3377 -663
  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 +1 -2
  47. package/lib/types/engine/dependency/formula-dependency.d.ts +6 -2
  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 +2 -4
  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 +2 -4
  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/__tests__/index.spec.d.ts +16 -0
  237. package/lib/types/functions/logical/false/index.d.ts +7 -0
  238. package/lib/types/functions/logical/function-map.d.ts +2 -3
  239. package/lib/types/functions/logical/if/index.d.ts +0 -1
  240. package/lib/types/functions/logical/iferror/index.d.ts +0 -1
  241. package/lib/types/functions/logical/ifna/__tests__/index.spec.d.ts +16 -0
  242. package/lib/types/functions/logical/ifna/index.d.ts +8 -0
  243. package/lib/types/functions/logical/ifs/__tests__/index.spec.d.ts +16 -0
  244. package/lib/types/functions/logical/ifs/index.d.ts +7 -0
  245. package/lib/types/functions/logical/lambda/index.d.ts +0 -1
  246. package/lib/types/functions/logical/let/index.d.ts +10 -0
  247. package/lib/types/functions/logical/makearray/index.d.ts +0 -1
  248. package/lib/types/functions/logical/not/__tests__/index.spec.d.ts +16 -0
  249. package/lib/types/functions/logical/not/index.d.ts +8 -0
  250. package/lib/types/functions/logical/or/index.d.ts +0 -1
  251. package/lib/types/functions/logical/switch/__tests__/index.spec.d.ts +16 -0
  252. package/lib/types/functions/logical/switch/index.d.ts +8 -0
  253. package/lib/types/functions/logical/true/__tests__/index.spec.d.ts +16 -0
  254. package/lib/types/functions/logical/true/index.d.ts +7 -0
  255. package/lib/types/functions/logical/xor/__tests__/index.spec.d.ts +16 -0
  256. package/lib/types/functions/logical/xor/index.d.ts +7 -0
  257. package/lib/types/functions/lookup/address/index.d.ts +0 -1
  258. package/lib/types/functions/lookup/areas/index.d.ts +0 -1
  259. package/lib/types/functions/lookup/choose/index.d.ts +0 -1
  260. package/lib/types/functions/lookup/choosecols/index.d.ts +0 -1
  261. package/lib/types/functions/lookup/chooserows/index.d.ts +0 -1
  262. package/lib/types/functions/lookup/column/index.d.ts +0 -1
  263. package/lib/types/functions/lookup/columns/index.d.ts +0 -1
  264. package/lib/types/functions/lookup/filter/index.d.ts +0 -1
  265. package/lib/types/functions/lookup/function-map.d.ts +0 -1
  266. package/lib/types/functions/lookup/hlookup/index.d.ts +0 -1
  267. package/lib/types/functions/lookup/hstack/index.d.ts +0 -1
  268. package/lib/types/functions/lookup/index/index.d.ts +0 -1
  269. package/lib/types/functions/lookup/indirect/index.d.ts +1 -1
  270. package/lib/types/functions/lookup/lookup/index.d.ts +0 -1
  271. package/lib/types/functions/lookup/match/index.d.ts +0 -1
  272. package/lib/types/functions/lookup/offset/index.d.ts +0 -1
  273. package/lib/types/functions/lookup/row/index.d.ts +0 -1
  274. package/lib/types/functions/lookup/rows/index.d.ts +0 -1
  275. package/lib/types/functions/lookup/sort/index.d.ts +0 -1
  276. package/lib/types/functions/lookup/sortby/index.d.ts +0 -1
  277. package/lib/types/functions/lookup/transpose/index.d.ts +0 -1
  278. package/lib/types/functions/lookup/unique/index.d.ts +0 -1
  279. package/lib/types/functions/lookup/vlookup/index.d.ts +0 -1
  280. package/lib/types/functions/lookup/vstack/index.d.ts +0 -1
  281. package/lib/types/functions/lookup/xlookup/index.d.ts +0 -1
  282. package/lib/types/functions/lookup/xmatch/index.d.ts +0 -1
  283. package/lib/types/functions/math/abs/index.d.ts +0 -1
  284. package/lib/types/functions/math/acos/index.d.ts +0 -1
  285. package/lib/types/functions/math/acosh/index.d.ts +0 -1
  286. package/lib/types/functions/math/acot/index.d.ts +0 -1
  287. package/lib/types/functions/math/acoth/index.d.ts +0 -1
  288. package/lib/types/functions/math/asin/index.d.ts +0 -1
  289. package/lib/types/functions/math/asinh/index.d.ts +0 -1
  290. package/lib/types/functions/math/atan/index.d.ts +0 -1
  291. package/lib/types/functions/math/atan2/index.d.ts +0 -1
  292. package/lib/types/functions/math/atanh/index.d.ts +0 -1
  293. package/lib/types/functions/math/base/index.d.ts +0 -1
  294. package/lib/types/functions/math/ceiling/index.d.ts +0 -1
  295. package/lib/types/functions/math/ceiling-math/index.d.ts +0 -1
  296. package/lib/types/functions/math/ceiling-precise/index.d.ts +0 -1
  297. package/lib/types/functions/math/cos/index.d.ts +0 -1
  298. package/lib/types/functions/math/cosh/index.d.ts +0 -1
  299. package/lib/types/functions/math/cot/index.d.ts +0 -1
  300. package/lib/types/functions/math/coth/index.d.ts +0 -1
  301. package/lib/types/functions/math/csc/index.d.ts +0 -1
  302. package/lib/types/functions/math/csch/index.d.ts +0 -1
  303. package/lib/types/functions/math/decimal/index.d.ts +0 -1
  304. package/lib/types/functions/math/degrees/index.d.ts +0 -1
  305. package/lib/types/functions/math/even/index.d.ts +0 -1
  306. package/lib/types/functions/math/exp/index.d.ts +0 -1
  307. package/lib/types/functions/math/floor/index.d.ts +0 -1
  308. package/lib/types/functions/math/floor-math/index.d.ts +0 -1
  309. package/lib/types/functions/math/floor-precise/index.d.ts +0 -1
  310. package/lib/types/functions/math/function-map.d.ts +0 -1
  311. package/lib/types/functions/math/ln/index.d.ts +0 -1
  312. package/lib/types/functions/math/log/index.d.ts +0 -1
  313. package/lib/types/functions/math/log10/index.d.ts +0 -1
  314. package/lib/types/functions/math/mod/index.d.ts +0 -1
  315. package/lib/types/functions/math/mround/index.d.ts +0 -1
  316. package/lib/types/functions/math/odd/index.d.ts +0 -1
  317. package/lib/types/functions/math/pi/index.d.ts +0 -1
  318. package/lib/types/functions/math/power/index.d.ts +0 -1
  319. package/lib/types/functions/math/product/index.d.ts +0 -1
  320. package/lib/types/functions/math/radians/index.d.ts +0 -1
  321. package/lib/types/functions/math/rand/index.d.ts +0 -1
  322. package/lib/types/functions/math/randarray/index.d.ts +0 -1
  323. package/lib/types/functions/math/randbetween/index.d.ts +0 -1
  324. package/lib/types/functions/math/round/index.d.ts +0 -1
  325. package/lib/types/functions/math/rounddown/index.d.ts +0 -1
  326. package/lib/types/functions/math/roundup/index.d.ts +0 -1
  327. package/lib/types/functions/math/sec/index.d.ts +0 -1
  328. package/lib/types/functions/math/sech/index.d.ts +0 -1
  329. package/lib/types/functions/math/sin/index.d.ts +0 -1
  330. package/lib/types/functions/math/sinh/index.d.ts +0 -1
  331. package/lib/types/functions/math/sqrt/index.d.ts +0 -1
  332. package/lib/types/functions/math/sqrtpi/index.d.ts +0 -1
  333. package/lib/types/functions/math/subtotal/index.d.ts +0 -1
  334. package/lib/types/functions/math/sum/index.d.ts +0 -1
  335. package/lib/types/functions/math/sumif/index.d.ts +0 -1
  336. package/lib/types/functions/math/sumifs/index.d.ts +0 -1
  337. package/lib/types/functions/math/sumproduct/index.d.ts +0 -1
  338. package/lib/types/functions/math/sumsq/index.d.ts +0 -1
  339. package/lib/types/functions/math/sumx2my2/index.d.ts +0 -1
  340. package/lib/types/functions/math/sumx2py2/index.d.ts +0 -1
  341. package/lib/types/functions/math/sumxmy2/index.d.ts +0 -1
  342. package/lib/types/functions/math/tan/index.d.ts +0 -1
  343. package/lib/types/functions/math/tanh/index.d.ts +0 -1
  344. package/lib/types/functions/math/trunc/index.d.ts +0 -1
  345. package/lib/types/functions/meta/compare/index.d.ts +0 -1
  346. package/lib/types/functions/meta/cube/index.d.ts +0 -1
  347. package/lib/types/functions/meta/divided/index.d.ts +0 -1
  348. package/lib/types/functions/meta/function-map.d.ts +0 -1
  349. package/lib/types/functions/meta/minus/index.d.ts +0 -1
  350. package/lib/types/functions/meta/multiply/index.d.ts +0 -1
  351. package/lib/types/functions/meta/plus/index.d.ts +0 -1
  352. package/lib/types/functions/statistical/avedev/index.d.ts +0 -1
  353. package/lib/types/functions/statistical/average/index.d.ts +0 -1
  354. package/lib/types/functions/statistical/averagea/index.d.ts +0 -1
  355. package/lib/types/functions/statistical/averageif/index.d.ts +0 -1
  356. package/lib/types/functions/statistical/averageifs/index.d.ts +0 -1
  357. package/lib/types/functions/statistical/count/index.d.ts +0 -1
  358. package/lib/types/functions/statistical/counta/index.d.ts +0 -1
  359. package/lib/types/functions/statistical/countblank/index.d.ts +0 -1
  360. package/lib/types/functions/statistical/countif/index.d.ts +0 -1
  361. package/lib/types/functions/statistical/countifs/index.d.ts +0 -1
  362. package/lib/types/functions/statistical/function-map.d.ts +1 -2
  363. package/lib/types/functions/statistical/max/index.d.ts +0 -1
  364. package/lib/types/functions/statistical/maxa/index.d.ts +0 -1
  365. package/lib/types/functions/statistical/maxifs/index.d.ts +0 -1
  366. package/lib/types/functions/statistical/min/index.d.ts +0 -1
  367. package/lib/types/functions/statistical/mina/index.d.ts +0 -1
  368. package/lib/types/functions/statistical/minifs/index.d.ts +0 -1
  369. package/lib/types/functions/statistical/stdev-p/index.d.ts +0 -1
  370. package/lib/types/functions/statistical/stdev-s/index.d.ts +0 -1
  371. package/lib/types/functions/statistical/stdeva/index.d.ts +0 -1
  372. package/lib/types/functions/statistical/stdevpa/index.d.ts +0 -1
  373. package/lib/types/functions/statistical/var-p/index.d.ts +0 -1
  374. package/lib/types/functions/statistical/var-s/index.d.ts +0 -1
  375. package/lib/types/functions/statistical/vara/index.d.ts +0 -1
  376. package/lib/types/functions/statistical/varpa/index.d.ts +0 -1
  377. package/lib/types/functions/text/concat/index.d.ts +0 -1
  378. package/lib/types/functions/text/concatenate/index.d.ts +0 -1
  379. package/lib/types/functions/text/function-map.d.ts +0 -1
  380. package/lib/types/functions/text/len/index.d.ts +0 -1
  381. package/lib/types/functions/text/lenb/index.d.ts +0 -1
  382. package/lib/types/functions/text/lower/index.d.ts +0 -1
  383. package/lib/types/functions/text/rept/index.d.ts +0 -1
  384. package/lib/types/functions/text/text/index.d.ts +0 -1
  385. package/lib/types/functions/text/textafter/index.d.ts +0 -1
  386. package/lib/types/functions/text/textbefore/index.d.ts +0 -1
  387. package/lib/types/functions/text/textsplit/index.d.ts +0 -1
  388. package/lib/types/models/__tests__/create-command-test-bed.d.ts +0 -1
  389. package/lib/types/models/formula-data.model.d.ts +0 -1
  390. package/lib/types/models/utils/formula-data-util.d.ts +0 -1
  391. package/lib/types/plugin.d.ts +0 -1
  392. package/lib/types/services/active-dirty-manager.service.d.ts +0 -1
  393. package/lib/types/services/calculate-formula.service.d.ts +0 -1
  394. package/lib/types/services/current-data.service.d.ts +0 -1
  395. package/lib/types/services/defined-names.service.d.ts +0 -1
  396. package/lib/types/services/dependency-manager.service.d.ts +0 -1
  397. package/lib/types/services/feature-calculation-manager.service.d.ts +1 -3
  398. package/lib/types/services/function.service.d.ts +0 -1
  399. package/lib/types/services/other-formula-manager.service.d.ts +0 -1
  400. package/lib/types/services/runtime.service.d.ts +1 -1
  401. package/lib/types/services/super-table.service.d.ts +0 -1
  402. package/lib/umd/index.js +1 -1
  403. package/package.json +8 -10
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;
@@ -6555,6 +6623,54 @@ const _Year = class _Year extends BaseFunction {
6555
6623
  };
6556
6624
  __name(_Year, "Year");
6557
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");
6558
6674
  const _Yearfrac = class _Yearfrac extends BaseFunction {
6559
6675
  constructor() {
6560
6676
  super(...arguments);
@@ -6563,13 +6679,13 @@ const _Yearfrac = class _Yearfrac extends BaseFunction {
6563
6679
  }
6564
6680
  calculate(startDate, endDate, basis) {
6565
6681
  let _basis = basis != null ? basis : NumberValueObject.create(0);
6566
- const _startDate = this._checkArrayError(startDate);
6682
+ const _startDate = checkVariantErrorIsArray(startDate);
6567
6683
  if (_startDate.isError())
6568
6684
  return _startDate;
6569
- const _endDate = this._checkArrayError(endDate);
6685
+ const _endDate = checkVariantErrorIsArray(endDate);
6570
6686
  if (_endDate.isError())
6571
6687
  return _endDate;
6572
- if (_basis = this._checkArrayError(_basis), _basis.isError())
6688
+ if (_basis = checkVariantErrorIsArray(_basis), _basis.isError())
6573
6689
  return _basis;
6574
6690
  if (_startDate.isBoolean() || _endDate.isBoolean() || _basis.isBoolean())
6575
6691
  return ErrorValueObject.create(ErrorType$1.VALUE);
@@ -6584,58 +6700,7 @@ const _Yearfrac = class _Yearfrac extends BaseFunction {
6584
6700
  return ErrorValueObject.create(ErrorType$1.VALUE);
6585
6701
  if (basisValue < 0 || basisValue > 4)
6586
6702
  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
- }
6601
- }
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;
6611
- }
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);
6618
- }
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);
6628
- }
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;
6703
+ const { days, yearDays } = getTwoDateDaysByBasis(startDateSerialNumber, endDateSerialNumber, basisValue), result = days / yearDays;
6639
6704
  return NumberValueObject.create(result);
6640
6705
  }
6641
6706
  };
@@ -6667,176 +6732,2555 @@ const functionDate = [
6667
6732
  [WorkdayIntl, FUNCTION_NAMES_DATE.WORKDAY_INTL],
6668
6733
  [Year, FUNCTION_NAMES_DATE.YEAR],
6669
6734
  [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 || {});
6674
- const _Cell = class _Cell extends BaseFunction {
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 {
6675
6936
  constructor() {
6676
6937
  super(...arguments);
6677
- __publicField(this, "needsReferenceObject", !0);
6678
6938
  __publicField(this, "minParams", 2);
6679
6939
  __publicField(this, "maxParams", 2);
6680
6940
  }
6681
- calculate(infoType, reference) {
6682
- let _infoType = infoType;
6683
- if (_infoType.isError())
6684
- return _infoType;
6685
- if (_infoType.isReferenceObject() && (_infoType = _infoType.toArrayValueObject()), _infoType.isArray()) {
6686
- const rowCount = _infoType.getRowCount(), columnCount = _infoType.getColumnCount();
6687
- if (rowCount === 1 && columnCount === 1) {
6688
- const infoTypeObject = _infoType.get(0, 0);
6689
- return this._handleSingleObject(infoTypeObject, reference);
6690
- }
6691
- return _infoType.map((infoTypeObject) => infoTypeObject.isError() ? infoTypeObject : this._handleSingleObject(infoTypeObject, reference, !0));
6692
- }
6693
- return this._handleSingleObject(_infoType, reference);
6694
- }
6695
- _handleSingleObject(infoType, reference, infoTypeIsArray = !1) {
6696
- let _reference = reference;
6697
- if (_reference.isError())
6698
- return _reference;
6699
- if (!_reference.isReferenceObject())
6941
+ calculate(x, n) {
6942
+ if (x.isNull() || n.isNull())
6700
6943
  return ErrorValueObject.create(ErrorType$1.NA);
6701
- const currentActiveSheetData = _reference.getCurrentActiveSheetData(), { columnData, defaultColumnWidth } = currentActiveSheetData;
6702
- _reference = _reference.toArrayValueObject();
6703
- const _currentRow = _reference.getCurrentRow(), _currentColumn = _reference.getCurrentColumn();
6704
- _reference = _reference.getFirstCell();
6705
- const infoTypeValue = `${infoType.getValue()}`;
6706
- let result;
6707
- switch (infoTypeValue.toLocaleLowerCase()) {
6708
- case "address":
6709
- return StringValueObject.create(`$${Tools.chatAtABC(_currentColumn)}$${_currentRow + 1}`);
6710
- case "col":
6711
- return NumberValueObject.create(_currentColumn + 1);
6712
- case "color":
6713
- return NumberValueObject.create(0);
6714
- case "contents":
6715
- return _reference;
6716
- case "filename":
6717
- return ErrorValueObject.create(ErrorType$1.VALUE);
6718
- case "format":
6719
- return StringValueObject.create("G");
6720
- case "parentheses":
6721
- return NumberValueObject.create(0);
6722
- case "prefix":
6723
- return StringValueObject.create("");
6724
- case "protect":
6725
- return NumberValueObject.create(1);
6726
- case "row":
6727
- return NumberValueObject.create(_currentRow + 1);
6728
- case "type":
6729
- return result = "v", _reference.isNull() && (result = "b"), _reference.isString() && (result = "l"), StringValueObject.create(result);
6730
- case "width":
6731
- return this._getWidthResult(columnData, defaultColumnWidth, _currentColumn, infoTypeIsArray);
6732
- default:
6733
- return ErrorValueObject.create(ErrorType$1.VALUE);
6734
- }
6735
- }
6736
- _getWidthResult(columnData, defaultColumnWidth, _currentColumn, infoTypeIsArray) {
6737
- var _a24;
6738
- let result = (_a24 = columnData[_currentColumn]) == null ? void 0 : _a24.w;
6739
- if (!result && result !== 0 && (result = defaultColumnWidth), infoTypeIsArray)
6740
- return NumberValueObject.create(result);
6741
- const resultArray = [[result, result === defaultColumnWidth]];
6742
- return ArrayValueObject.createByArray(resultArray);
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);
6743
6954
  }
6744
6955
  };
6745
- __name(_Cell, "Cell");
6746
- let Cell = _Cell;
6747
- const _ErrorType = class _ErrorType extends BaseFunction {
6956
+ __name(_Besseli, "Besseli");
6957
+ let Besseli = _Besseli;
6958
+ const _Besselj = class _Besselj extends BaseFunction {
6748
6959
  constructor() {
6749
6960
  super(...arguments);
6750
- __publicField(this, "minParams", 1);
6751
- __publicField(this, "maxParams", 1);
6752
- __publicField(this, "_errorTypeValueMap", /* @__PURE__ */ new Map([
6753
- [ErrorType$1.NULL, 1],
6754
- [ErrorType$1.DIV_BY_ZERO, 2],
6755
- [ErrorType$1.VALUE, 3],
6756
- [ErrorType$1.REF, 4],
6757
- [ErrorType$1.NAME, 5],
6758
- [ErrorType$1.NUM, 6],
6759
- [ErrorType$1.NA, 7],
6760
- [ErrorType$1.CONNECT, 8],
6761
- [ErrorType$1.CALC, 14]
6762
- ]));
6763
- }
6764
- calculate(errorVal) {
6765
- return errorVal.isArray() ? errorVal.mapValue((errorValObject) => this._handleSingleObject(errorValObject)) : this._handleSingleObject(errorVal);
6961
+ __publicField(this, "minParams", 2);
6962
+ __publicField(this, "maxParams", 2);
6766
6963
  }
6767
- _handleSingleObject(errorVal) {
6768
- const errorValValue = errorVal.getValue(), result = this._errorTypeValueMap.get(errorValValue);
6769
- return result ? NumberValueObject.create(result) : ErrorValueObject.create(ErrorType$1.NA);
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);
6770
6977
  }
6771
6978
  };
6772
- __name(_ErrorType, "ErrorType");
6773
- let ErrorType = _ErrorType;
6774
- const _Isblank = class _Isblank extends BaseFunction {
6979
+ __name(_Besselj, "Besselj");
6980
+ let Besselj = _Besselj;
6981
+ const _Besselk = class _Besselk extends BaseFunction {
6775
6982
  constructor() {
6776
6983
  super(...arguments);
6777
- __publicField(this, "minParams", 1);
6778
- __publicField(this, "maxParams", 1);
6984
+ __publicField(this, "minParams", 2);
6985
+ __publicField(this, "maxParams", 2);
6779
6986
  }
6780
- calculate(value) {
6781
- return value.isNull() ? BooleanValueObject.create(!0) : value.isArray() ? value.mapValue((valueObject) => valueObject.isNull() ? BooleanValueObject.create(!0) : BooleanValueObject.create(!1)) : BooleanValueObject.create(!1);
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);
6782
7000
  }
6783
7001
  };
6784
- __name(_Isblank, "Isblank");
6785
- let Isblank = _Isblank;
6786
- const _Iserr = class _Iserr extends BaseFunction {
7002
+ __name(_Besselk, "Besselk");
7003
+ let Besselk = _Besselk;
7004
+ const _Bessely = class _Bessely extends BaseFunction {
6787
7005
  constructor() {
6788
7006
  super(...arguments);
6789
- __publicField(this, "minParams", 1);
6790
- __publicField(this, "maxParams", 1);
7007
+ __publicField(this, "minParams", 2);
7008
+ __publicField(this, "maxParams", 2);
6791
7009
  }
6792
- calculate(value) {
6793
- return value.getValue() === ErrorType$1.NA ? BooleanValueObject.create(!1) : value.isError() ? BooleanValueObject.create(!0) : value.isArray() ? value.mapValue((valueObject) => valueObject.getValue() === ErrorType$1.NA ? BooleanValueObject.create(!1) : valueObject.isError() ? BooleanValueObject.create(!0) : BooleanValueObject.create(!1)) : BooleanValueObject.create(!1);
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);
6794
7023
  }
6795
7024
  };
6796
- __name(_Iserr, "Iserr");
6797
- let Iserr = _Iserr;
6798
- const _Iserror = class _Iserror extends BaseFunction {
7025
+ __name(_Bessely, "Bessely");
7026
+ let Bessely = _Bessely;
7027
+ const _Bin2dec = class _Bin2dec extends BaseFunction {
6799
7028
  constructor() {
6800
7029
  super(...arguments);
6801
7030
  __publicField(this, "minParams", 1);
6802
7031
  __publicField(this, "maxParams", 1);
6803
7032
  }
6804
- calculate(value) {
6805
- return value.isError() ? BooleanValueObject.create(!0) : value.isArray() ? value.mapValue((valueObject) => valueObject.isError() ? BooleanValueObject.create(!0) : BooleanValueObject.create(!1)) : BooleanValueObject.create(!1);
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);
6806
7042
  }
6807
7043
  };
6808
- __name(_Iserror, "Iserror");
6809
- let Iserror = _Iserror;
6810
- const _Iseven = class _Iseven extends BaseFunction {
7044
+ __name(_Bin2dec, "Bin2dec");
7045
+ let Bin2dec = _Bin2dec;
7046
+ const _Bin2hex = class _Bin2hex extends BaseFunction {
6811
7047
  constructor() {
6812
7048
  super(...arguments);
6813
7049
  __publicField(this, "minParams", 1);
6814
- __publicField(this, "maxParams", 1);
7050
+ __publicField(this, "maxParams", 2);
6815
7051
  }
6816
- calculate(value) {
6817
- let _value = value;
6818
- if (_value.isArray() || _value.isBoolean() || !_value.isNumber() && (_value = _value.convertToNumberObjectValue(), !_value.isNumber()))
6819
- return ErrorValueObject.create(ErrorType$1.VALUE);
6820
- const val = _value.getValue(), floored = Math.floor(Math.abs(val));
6821
- return BooleanValueObject.create(floored % 2 === 0);
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());
6822
7081
  }
6823
7082
  };
6824
- __name(_Iseven, "Iseven");
6825
- let Iseven = _Iseven;
6826
- const _Islogical = class _Islogical extends BaseFunction {
7083
+ __name(_Bin2hex, "Bin2hex");
7084
+ let Bin2hex = _Bin2hex;
7085
+ const _Bin2oct = class _Bin2oct extends BaseFunction {
6827
7086
  constructor() {
6828
7087
  super(...arguments);
6829
7088
  __publicField(this, "minParams", 1);
6830
- __publicField(this, "maxParams", 1);
6831
- }
6832
- calculate(value) {
6833
- return value.isBoolean() ? BooleanValueObject.create(!0) : value.isArray() ? value.mapValue((valueObject) => valueObject.isBoolean() ? BooleanValueObject.create(!0) : BooleanValueObject.create(!1)) : BooleanValueObject.create(!1);
7089
+ __publicField(this, "maxParams", 2);
6834
7090
  }
6835
- };
6836
- __name(_Islogical, "Islogical");
6837
- let Islogical = _Islogical;
6838
- const _Isna = class _Isna extends BaseFunction {
6839
- constructor() {
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 {
8786
+ constructor() {
8787
+ super(...arguments);
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);
8825
+ __publicField(this, "maxParams", 4);
8826
+ }
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;
8849
+ }
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))
8866
+ return ErrorValueObject.create(ErrorType$1.VALUE);
8867
+ if (effectRateValue <= 0 || nperyValue < 1)
8868
+ return ErrorValueObject.create(ErrorType$1.NUM);
8869
+ nperyValue = Number.parseInt(`${nperyValue}`, 10);
8870
+ const result = ((effectRateValue + 1) ** (1 / nperyValue) - 1) * nperyValue;
8871
+ return NumberValueObject.create(result);
8872
+ }
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);
8881
+ }
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;
8913
+ }
8914
+ };
8915
+ __name(_Nper, "Nper");
8916
+ let Nper = _Nper;
8917
+ const _Pmt = class _Pmt extends BaseFunction {
8918
+ constructor() {
8919
+ super(...arguments);
8920
+ __publicField(this, "minParams", 3);
8921
+ __publicField(this, "maxParams", 5);
8922
+ }
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;
8947
+ }
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)
8978
+ return ErrorValueObject.create(ErrorType$1.NUM);
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;
8983
+ }
8984
+ };
8985
+ __name(_Ppmt, "Ppmt");
8986
+ let Ppmt = _Ppmt;
8987
+ const _Pv = class _Pv extends BaseFunction {
8988
+ constructor() {
8989
+ super(...arguments);
8990
+ __publicField(this, "minParams", 3);
8991
+ __publicField(this, "maxParams", 5);
8992
+ }
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;
9017
+ }
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);
9026
+ }
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;
9052
+ }
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;
9070
+ }
9071
+ return rowIndex === 0 && columnIndex === 0 ? NumberValueObject.create(result, "0%") : NumberValueObject.create(result);
9072
+ }
9073
+ };
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 || {});
9107
+ const _Cell = class _Cell extends BaseFunction {
9108
+ constructor() {
9109
+ super(...arguments);
9110
+ __publicField(this, "needsReferenceObject", !0);
9111
+ __publicField(this, "minParams", 2);
9112
+ __publicField(this, "maxParams", 2);
9113
+ }
9114
+ calculate(infoType, reference) {
9115
+ let _infoType = infoType;
9116
+ if (_infoType.isError())
9117
+ return _infoType;
9118
+ if (_infoType.isReferenceObject() && (_infoType = _infoType.toArrayValueObject()), _infoType.isArray()) {
9119
+ const rowCount = _infoType.getRowCount(), columnCount = _infoType.getColumnCount();
9120
+ if (rowCount === 1 && columnCount === 1) {
9121
+ const infoTypeObject = _infoType.get(0, 0);
9122
+ return this._handleSingleObject(infoTypeObject, reference);
9123
+ }
9124
+ return _infoType.map((infoTypeObject) => infoTypeObject.isError() ? infoTypeObject : this._handleSingleObject(infoTypeObject, reference, !0));
9125
+ }
9126
+ return this._handleSingleObject(_infoType, reference);
9127
+ }
9128
+ _handleSingleObject(infoType, reference, infoTypeIsArray = !1) {
9129
+ let _reference = reference;
9130
+ if (_reference.isError())
9131
+ return _reference;
9132
+ if (!_reference.isReferenceObject())
9133
+ return ErrorValueObject.create(ErrorType$1.NA);
9134
+ const currentActiveSheetData = _reference.getCurrentActiveSheetData(), { columnData, defaultColumnWidth } = currentActiveSheetData;
9135
+ _reference = _reference.toArrayValueObject();
9136
+ const _currentRow = _reference.getCurrentRow(), _currentColumn = _reference.getCurrentColumn();
9137
+ _reference = _reference.getFirstCell();
9138
+ const infoTypeValue = `${infoType.getValue()}`;
9139
+ let result;
9140
+ switch (infoTypeValue.toLocaleLowerCase()) {
9141
+ case "address":
9142
+ return StringValueObject.create(`$${Tools.chatAtABC(_currentColumn)}$${_currentRow + 1}`);
9143
+ case "col":
9144
+ return NumberValueObject.create(_currentColumn + 1);
9145
+ case "color":
9146
+ return NumberValueObject.create(0);
9147
+ case "contents":
9148
+ return _reference;
9149
+ case "filename":
9150
+ return ErrorValueObject.create(ErrorType$1.VALUE);
9151
+ case "format":
9152
+ return StringValueObject.create("G");
9153
+ case "parentheses":
9154
+ return NumberValueObject.create(0);
9155
+ case "prefix":
9156
+ return StringValueObject.create("");
9157
+ case "protect":
9158
+ return NumberValueObject.create(1);
9159
+ case "row":
9160
+ return NumberValueObject.create(_currentRow + 1);
9161
+ case "type":
9162
+ return result = "v", _reference.isNull() && (result = "b"), _reference.isString() && (result = "l"), StringValueObject.create(result);
9163
+ case "width":
9164
+ return this._getWidthResult(columnData, defaultColumnWidth, _currentColumn, infoTypeIsArray);
9165
+ default:
9166
+ return ErrorValueObject.create(ErrorType$1.VALUE);
9167
+ }
9168
+ }
9169
+ _getWidthResult(columnData, defaultColumnWidth, _currentColumn, infoTypeIsArray) {
9170
+ var _a24;
9171
+ let result = (_a24 = columnData[_currentColumn]) == null ? void 0 : _a24.w;
9172
+ if (!result && result !== 0 && (result = defaultColumnWidth), infoTypeIsArray)
9173
+ return NumberValueObject.create(result);
9174
+ const resultArray = [[result, result === defaultColumnWidth]];
9175
+ return ArrayValueObject.createByArray(resultArray);
9176
+ }
9177
+ };
9178
+ __name(_Cell, "Cell");
9179
+ let Cell = _Cell;
9180
+ const _ErrorType = class _ErrorType extends BaseFunction {
9181
+ constructor() {
9182
+ super(...arguments);
9183
+ __publicField(this, "minParams", 1);
9184
+ __publicField(this, "maxParams", 1);
9185
+ __publicField(this, "_errorTypeValueMap", /* @__PURE__ */ new Map([
9186
+ [ErrorType$1.NULL, 1],
9187
+ [ErrorType$1.DIV_BY_ZERO, 2],
9188
+ [ErrorType$1.VALUE, 3],
9189
+ [ErrorType$1.REF, 4],
9190
+ [ErrorType$1.NAME, 5],
9191
+ [ErrorType$1.NUM, 6],
9192
+ [ErrorType$1.NA, 7],
9193
+ [ErrorType$1.CONNECT, 8],
9194
+ [ErrorType$1.CALC, 14]
9195
+ ]));
9196
+ }
9197
+ calculate(errorVal) {
9198
+ return errorVal.isArray() ? errorVal.mapValue((errorValObject) => this._handleSingleObject(errorValObject)) : this._handleSingleObject(errorVal);
9199
+ }
9200
+ _handleSingleObject(errorVal) {
9201
+ const errorValValue = errorVal.getValue(), result = this._errorTypeValueMap.get(errorValValue);
9202
+ return result ? NumberValueObject.create(result) : ErrorValueObject.create(ErrorType$1.NA);
9203
+ }
9204
+ };
9205
+ __name(_ErrorType, "ErrorType");
9206
+ let ErrorType = _ErrorType;
9207
+ const _Isblank = class _Isblank extends BaseFunction {
9208
+ constructor() {
9209
+ super(...arguments);
9210
+ __publicField(this, "minParams", 1);
9211
+ __publicField(this, "maxParams", 1);
9212
+ }
9213
+ calculate(value) {
9214
+ return value.isNull() ? BooleanValueObject.create(!0) : value.isArray() ? value.mapValue((valueObject) => valueObject.isNull() ? BooleanValueObject.create(!0) : BooleanValueObject.create(!1)) : BooleanValueObject.create(!1);
9215
+ }
9216
+ };
9217
+ __name(_Isblank, "Isblank");
9218
+ let Isblank = _Isblank;
9219
+ const _Iserr = class _Iserr extends BaseFunction {
9220
+ constructor() {
9221
+ super(...arguments);
9222
+ __publicField(this, "minParams", 1);
9223
+ __publicField(this, "maxParams", 1);
9224
+ }
9225
+ calculate(value) {
9226
+ return value.getValue() === ErrorType$1.NA ? BooleanValueObject.create(!1) : value.isError() ? BooleanValueObject.create(!0) : value.isArray() ? value.mapValue((valueObject) => valueObject.getValue() === ErrorType$1.NA ? BooleanValueObject.create(!1) : valueObject.isError() ? BooleanValueObject.create(!0) : BooleanValueObject.create(!1)) : BooleanValueObject.create(!1);
9227
+ }
9228
+ };
9229
+ __name(_Iserr, "Iserr");
9230
+ let Iserr = _Iserr;
9231
+ const _Iserror = class _Iserror extends BaseFunction {
9232
+ constructor() {
9233
+ super(...arguments);
9234
+ __publicField(this, "minParams", 1);
9235
+ __publicField(this, "maxParams", 1);
9236
+ }
9237
+ calculate(value) {
9238
+ return value.isError() ? BooleanValueObject.create(!0) : value.isArray() ? value.mapValue((valueObject) => valueObject.isError() ? BooleanValueObject.create(!0) : BooleanValueObject.create(!1)) : BooleanValueObject.create(!1);
9239
+ }
9240
+ };
9241
+ __name(_Iserror, "Iserror");
9242
+ let Iserror = _Iserror;
9243
+ const _Iseven = class _Iseven extends BaseFunction {
9244
+ constructor() {
9245
+ super(...arguments);
9246
+ __publicField(this, "minParams", 1);
9247
+ __publicField(this, "maxParams", 1);
9248
+ }
9249
+ calculate(value) {
9250
+ let _value = value;
9251
+ if (_value.isArray()) {
9252
+ const rowCount = _value.getRowCount(), columnCount = _value.getColumnCount();
9253
+ if (rowCount > 1 || columnCount > 1)
9254
+ return ErrorValueObject.create(ErrorType$1.VALUE);
9255
+ _value = _value.get(0, 0);
9256
+ }
9257
+ if (_value.isError())
9258
+ return _value;
9259
+ if (_value.isBoolean())
9260
+ return ErrorValueObject.create(ErrorType$1.VALUE);
9261
+ const val = Math.trunc(+_value.getValue());
9262
+ if (Number.isNaN(val))
9263
+ return ErrorValueObject.create(ErrorType$1.VALUE);
9264
+ const result = val % 2 === 0;
9265
+ return BooleanValueObject.create(result);
9266
+ }
9267
+ };
9268
+ __name(_Iseven, "Iseven");
9269
+ let Iseven = _Iseven;
9270
+ const _Islogical = class _Islogical extends BaseFunction {
9271
+ constructor() {
9272
+ super(...arguments);
9273
+ __publicField(this, "minParams", 1);
9274
+ __publicField(this, "maxParams", 1);
9275
+ }
9276
+ calculate(value) {
9277
+ return value.isBoolean() ? BooleanValueObject.create(!0) : value.isArray() ? value.mapValue((valueObject) => valueObject.isBoolean() ? BooleanValueObject.create(!0) : BooleanValueObject.create(!1)) : BooleanValueObject.create(!1);
9278
+ }
9279
+ };
9280
+ __name(_Islogical, "Islogical");
9281
+ let Islogical = _Islogical;
9282
+ const _Isna = class _Isna extends BaseFunction {
9283
+ constructor() {
6840
9284
  super(...arguments);
6841
9285
  __publicField(this, "minParams", 1);
6842
9286
  __publicField(this, "maxParams", 1);
@@ -6879,10 +9323,21 @@ const _Isodd = class _Isodd extends BaseFunction {
6879
9323
  }
6880
9324
  calculate(value) {
6881
9325
  let _value = value;
6882
- if (_value.isArray() || _value.isBoolean() || !_value.isNumber() && (_value = _value.convertToNumberObjectValue(), !_value.isNumber()))
9326
+ if (_value.isArray()) {
9327
+ const rowCount = _value.getRowCount(), columnCount = _value.getColumnCount();
9328
+ if (rowCount > 1 || columnCount > 1)
9329
+ return ErrorValueObject.create(ErrorType$1.VALUE);
9330
+ _value = _value.get(0, 0);
9331
+ }
9332
+ if (_value.isError())
9333
+ return _value;
9334
+ if (_value.isBoolean())
6883
9335
  return ErrorValueObject.create(ErrorType$1.VALUE);
6884
- const val = _value.getValue(), floored = Math.floor(Math.abs(val));
6885
- return BooleanValueObject.create(floored % 2 !== 0);
9336
+ const val = Math.trunc(+_value.getValue());
9337
+ if (Number.isNaN(val))
9338
+ return ErrorValueObject.create(ErrorType$1.VALUE);
9339
+ const result = val % 2 !== 0;
9340
+ return BooleanValueObject.create(result);
6886
9341
  }
6887
9342
  };
6888
9343
  __name(_Isodd, "Isodd");
@@ -6956,17 +9411,19 @@ const functionInformation = [
6956
9411
  [ErrorType, FUNCTION_NAMES_INFORMATION.ERROR_TYPE],
6957
9412
  [Isblank, FUNCTION_NAMES_INFORMATION.ISBLANK],
6958
9413
  [Iserr, FUNCTION_NAMES_INFORMATION.ISERR],
6959
- [Iseven, FUNCTION_NAMES_INFORMATION.ISEVEN],
6960
- [Isodd, FUNCTION_NAMES_INFORMATION.ISODD],
6961
9414
  [Iserror, FUNCTION_NAMES_INFORMATION.ISERROR],
9415
+ [Iseven, FUNCTION_NAMES_INFORMATION.ISEVEN],
6962
9416
  [Islogical, FUNCTION_NAMES_INFORMATION.ISLOGICAL],
6963
9417
  [Isna, FUNCTION_NAMES_INFORMATION.ISNA],
6964
9418
  [Isnontext, FUNCTION_NAMES_INFORMATION.ISNONTEXT],
6965
9419
  [Isnumber, FUNCTION_NAMES_INFORMATION.ISNUMBER],
9420
+ [Isodd, FUNCTION_NAMES_INFORMATION.ISODD],
6966
9421
  [Isref, FUNCTION_NAMES_INFORMATION.ISREF],
6967
9422
  [Istext, FUNCTION_NAMES_INFORMATION.ISTEXT],
6968
9423
  [Type, FUNCTION_NAMES_INFORMATION.TYPE]
6969
- ], _And = class _And extends BaseFunction {
9424
+ ];
9425
+ var FUNCTION_NAMES_LOGICAL = /* @__PURE__ */ ((FUNCTION_NAMES_LOGICAL2) => (FUNCTION_NAMES_LOGICAL2.AND = "AND", FUNCTION_NAMES_LOGICAL2.BYCOL = "BYCOL", FUNCTION_NAMES_LOGICAL2.BYROW = "BYROW", FUNCTION_NAMES_LOGICAL2.FALSE = "FALSE", FUNCTION_NAMES_LOGICAL2.IF = "IF", FUNCTION_NAMES_LOGICAL2.IFERROR = "IFERROR", FUNCTION_NAMES_LOGICAL2.IFNA = "IFNA", FUNCTION_NAMES_LOGICAL2.IFS = "IFS", FUNCTION_NAMES_LOGICAL2.LAMBDA = "LAMBDA", FUNCTION_NAMES_LOGICAL2.LET = "LET", FUNCTION_NAMES_LOGICAL2.MAKEARRAY = "MAKEARRAY", FUNCTION_NAMES_LOGICAL2.MAP = "MAP", FUNCTION_NAMES_LOGICAL2.NOT = "NOT", FUNCTION_NAMES_LOGICAL2.OR = "OR", FUNCTION_NAMES_LOGICAL2.REDUCE = "REDUCE", FUNCTION_NAMES_LOGICAL2.SCAN = "SCAN", FUNCTION_NAMES_LOGICAL2.SWITCH = "SWITCH", FUNCTION_NAMES_LOGICAL2.TRUE = "TRUE", FUNCTION_NAMES_LOGICAL2.XOR = "XOR", FUNCTION_NAMES_LOGICAL2))(FUNCTION_NAMES_LOGICAL || {});
9426
+ const _And = class _And extends BaseFunction {
6970
9427
  constructor() {
6971
9428
  super(...arguments);
6972
9429
  __publicField(this, "minParams", 1);
@@ -6991,7 +9448,18 @@ const functionInformation = [
6991
9448
  };
6992
9449
  __name(_And, "And");
6993
9450
  let And = _And;
6994
- var FUNCTION_NAMES_LOGICAL = /* @__PURE__ */ ((FUNCTION_NAMES_LOGICAL2) => (FUNCTION_NAMES_LOGICAL2.AND = "AND", FUNCTION_NAMES_LOGICAL2.BYCOL = "BYCOL", FUNCTION_NAMES_LOGICAL2.BYROW = "BYROW", FUNCTION_NAMES_LOGICAL2.FALSE = "FALSE", FUNCTION_NAMES_LOGICAL2.IF = "IF", FUNCTION_NAMES_LOGICAL2.IFERROR = "IFERROR", FUNCTION_NAMES_LOGICAL2.IFNA = "IFNA", FUNCTION_NAMES_LOGICAL2.IFS = "IFS", FUNCTION_NAMES_LOGICAL2.LAMBDA = "LAMBDA", FUNCTION_NAMES_LOGICAL2.LET = "LET", FUNCTION_NAMES_LOGICAL2.MAKEARRAY = "MAKEARRAY", FUNCTION_NAMES_LOGICAL2.MAP = "MAP", FUNCTION_NAMES_LOGICAL2.NOT = "NOT", FUNCTION_NAMES_LOGICAL2.OR = "OR", FUNCTION_NAMES_LOGICAL2.REDUCE = "REDUCE", FUNCTION_NAMES_LOGICAL2.SCAN = "SCAN", FUNCTION_NAMES_LOGICAL2.SWITCH = "SWITCH", FUNCTION_NAMES_LOGICAL2.TRUE = "TRUE", FUNCTION_NAMES_LOGICAL2.XOR = "XOR", FUNCTION_NAMES_LOGICAL2))(FUNCTION_NAMES_LOGICAL || {});
9451
+ const _False = class _False extends BaseFunction {
9452
+ constructor() {
9453
+ super(...arguments);
9454
+ __publicField(this, "minParams", 0);
9455
+ __publicField(this, "maxParams", 0);
9456
+ }
9457
+ calculate() {
9458
+ return BooleanValueObject.create(!1);
9459
+ }
9460
+ };
9461
+ __name(_False, "False");
9462
+ let False = _False;
6995
9463
  const _If = class _If extends BaseFunction {
6996
9464
  constructor() {
6997
9465
  super(...arguments);
@@ -7060,6 +9528,76 @@ const _Iferror = class _Iferror extends BaseFunction {
7060
9528
  };
7061
9529
  __name(_Iferror, "Iferror");
7062
9530
  let Iferror = _Iferror;
9531
+ const _Ifna = class _Ifna extends BaseFunction {
9532
+ constructor() {
9533
+ super(...arguments);
9534
+ __publicField(this, "minParams", 2);
9535
+ __publicField(this, "maxParams", 2);
9536
+ }
9537
+ calculate(value, valueIfNa) {
9538
+ if (value.isError() && value.getErrorType() !== ErrorType$1.NA)
9539
+ return value;
9540
+ if (valueIfNa.isError())
9541
+ return valueIfNa;
9542
+ if (!value.isArray())
9543
+ return value.isError() && value.getErrorType() === ErrorType$1.NA ? valueIfNa : value;
9544
+ const maxRowLength = Math.max(
9545
+ value.isArray() ? value.getRowCount() : 1,
9546
+ valueIfNa.isArray() ? valueIfNa.getRowCount() : 1
9547
+ ), maxColumnLength = Math.max(
9548
+ value.isArray() ? value.getColumnCount() : 1,
9549
+ valueIfNa.isArray() ? valueIfNa.getColumnCount() : 1
9550
+ ), valueArray = expandArrayValueObject(maxRowLength, maxColumnLength, value), valueIfNaArray = expandArrayValueObject(maxRowLength, maxColumnLength, valueIfNa);
9551
+ return valueArray.iterator((cellValue, rowIndex, columnIndex) => {
9552
+ cellValue != null && cellValue.isError() && cellValue.getErrorType() === ErrorType$1.NA && valueArray.set(rowIndex, columnIndex, valueIfNaArray.get(rowIndex, columnIndex));
9553
+ }), valueArray;
9554
+ }
9555
+ };
9556
+ __name(_Ifna, "Ifna");
9557
+ let Ifna = _Ifna;
9558
+ const _Ifs = class _Ifs extends BaseFunction {
9559
+ constructor() {
9560
+ super(...arguments);
9561
+ __publicField(this, "minParams", 2);
9562
+ __publicField(this, "maxParams", 255);
9563
+ }
9564
+ calculate(...params) {
9565
+ if (params.length % 2 !== 0)
9566
+ return ErrorValueObject.create(ErrorType$1.NA);
9567
+ for (let i = 0; i < params.length; i++)
9568
+ if (params[i].isError())
9569
+ return params[i];
9570
+ const maxRowLength = Math.max(
9571
+ ...params.map((param) => param.isArray() ? param.getRowCount() : 1)
9572
+ ), maxColumnLength = Math.max(
9573
+ ...params.map((param) => param.isArray() ? param.getColumnCount() : 1)
9574
+ ), expandedParams = params.map(
9575
+ (param) => expandArrayValueObject(maxRowLength, maxColumnLength, param, ErrorValueObject.create(ErrorType$1.NA))
9576
+ ), resultArray = expandedParams[0].map((_, rowIndex, columnIndex) => {
9577
+ for (let i = 0; i < expandedParams.length; i += 2) {
9578
+ const condition = expandedParams[i].get(rowIndex, columnIndex) || NullValueObject.create(), result = expandedParams[i + 1].get(rowIndex, columnIndex) || NullValueObject.create();
9579
+ if (condition.isNull())
9580
+ continue;
9581
+ if (condition.isError())
9582
+ return condition;
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)
9592
+ return result.isNull() ? ErrorValueObject.create(ErrorType$1.NA) : result;
9593
+ }
9594
+ return ErrorValueObject.create(ErrorType$1.NA);
9595
+ });
9596
+ return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
9597
+ }
9598
+ };
9599
+ __name(_Ifs, "Ifs");
9600
+ let Ifs = _Ifs;
7063
9601
  const _Lambda = class _Lambda extends BaseFunction {
7064
9602
  constructor() {
7065
9603
  super(...arguments);
@@ -7072,6 +9610,18 @@ const _Lambda = class _Lambda extends BaseFunction {
7072
9610
  };
7073
9611
  __name(_Lambda, "Lambda");
7074
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;
7075
9625
  const _Makearray = class _Makearray extends BaseFunction {
7076
9626
  constructor() {
7077
9627
  super(...arguments);
@@ -7091,8 +9641,8 @@ const _Makearray = class _Makearray extends BaseFunction {
7091
9641
  for (let r = 0; r < row; r++) {
7092
9642
  result[r] == null && (result[r] = []);
7093
9643
  for (let c = 0; c < column; c++) {
7094
- const value = lambda.execute(NumberValueObject.create(r + 1), NumberValueObject.create(c + 1));
7095
- 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;
7096
9646
  }
7097
9647
  }
7098
9648
  return new AsyncArrayObject(result);
@@ -7103,6 +9653,24 @@ const _Makearray = class _Makearray extends BaseFunction {
7103
9653
  };
7104
9654
  __name(_Makearray, "Makearray");
7105
9655
  let Makearray = _Makearray;
9656
+ const _Not = class _Not extends BaseFunction {
9657
+ constructor() {
9658
+ super(...arguments);
9659
+ __publicField(this, "minParams", 1);
9660
+ __publicField(this, "maxParams", 1);
9661
+ }
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);
9670
+ }
9671
+ };
9672
+ __name(_Not, "Not");
9673
+ let Not = _Not;
7106
9674
  const _Or = class _Or extends BaseFunction {
7107
9675
  constructor() {
7108
9676
  super(...arguments);
@@ -7128,13 +9696,110 @@ const _Or = class _Or extends BaseFunction {
7128
9696
  };
7129
9697
  __name(_Or, "Or");
7130
9698
  let Or = _Or;
9699
+ const _Switch = class _Switch extends BaseFunction {
9700
+ constructor() {
9701
+ super(...arguments);
9702
+ __publicField(this, "minParams", 3);
9703
+ }
9704
+ calculate(expression, ...args) {
9705
+ if (expression.isError())
9706
+ return expression;
9707
+ const hasDefault = args.length % 2 !== 0, defaultValue = hasDefault ? args[args.length - 1] : NullValueObject.create();
9708
+ return !expression.isArray() && !args.some((arg) => arg.isArray()) ? this._handleNonArrayInputs(expression, args, defaultValue, hasDefault) : this._handleArrayInputs(expression, args, defaultValue, hasDefault);
9709
+ }
9710
+ _handleNonArrayInputs(expression, args, defaultValue, hasDefault) {
9711
+ for (let i = 0; i < args.length - (hasDefault ? 1 : 0); i += 2) {
9712
+ const switchValue = args[i], resultValue = args[i + 1];
9713
+ if (!switchValue.isNull()) {
9714
+ if (switchValue.isError())
9715
+ return switchValue;
9716
+ if (`${expression.getValue()}`.toLocaleLowerCase() === `${switchValue.getValue()}`.toLocaleLowerCase())
9717
+ return resultValue.isNull() ? ErrorValueObject.create(ErrorType$1.NA) : resultValue;
9718
+ }
9719
+ }
9720
+ return defaultValue.isNull() ? ErrorValueObject.create(ErrorType$1.NA) : defaultValue;
9721
+ }
9722
+ _handleArrayInputs(expression, args, defaultValue, hasDefault) {
9723
+ const maxRowLength = Math.max(
9724
+ expression.isArray() ? expression.getRowCount() : 1,
9725
+ ...args.map((arg) => arg.isArray() ? arg.getRowCount() : 1),
9726
+ defaultValue.isArray() ? defaultValue.getRowCount() : 1
9727
+ ), maxColumnLength = Math.max(
9728
+ expression.isArray() ? expression.getColumnCount() : 1,
9729
+ ...args.map((arg) => arg.isArray() ? arg.getColumnCount() : 1),
9730
+ defaultValue.isArray() ? defaultValue.getColumnCount() : 1
9731
+ ), expandedExpression = expandArrayValueObject(maxRowLength, maxColumnLength, expression), expandedArgs = args.map(
9732
+ (arg) => expandArrayValueObject(maxRowLength, maxColumnLength, arg, ErrorValueObject.create(ErrorType$1.NA))
9733
+ ), expandedDefault = expandArrayValueObject(maxRowLength, maxColumnLength, defaultValue, ErrorValueObject.create(ErrorType$1.NA));
9734
+ return expandedExpression.map((expValue, rowIndex, columnIndex) => {
9735
+ for (let i = 0; i < expandedArgs.length - (hasDefault ? 1 : 0); i += 2) {
9736
+ const switchValue = expandedArgs[i].get(rowIndex, columnIndex) || NullValueObject.create(), resultValue = expandedArgs[i + 1].get(rowIndex, columnIndex) || NullValueObject.create();
9737
+ if (!switchValue.isNull()) {
9738
+ if (switchValue.isError() || expValue.isError())
9739
+ return switchValue.isError() ? switchValue : expValue;
9740
+ if (`${expValue.getValue()}`.toLocaleLowerCase() === `${switchValue.getValue()}`.toLocaleLowerCase())
9741
+ return resultValue.isNull() ? ErrorValueObject.create(ErrorType$1.NA) : resultValue;
9742
+ }
9743
+ }
9744
+ const defaultCellValue = expandedDefault.get(rowIndex, columnIndex) || NullValueObject.create();
9745
+ return defaultCellValue.isNull() ? ErrorValueObject.create(ErrorType$1.NA) : defaultCellValue;
9746
+ });
9747
+ }
9748
+ };
9749
+ __name(_Switch, "Switch");
9750
+ let Switch = _Switch;
9751
+ const _True = class _True extends BaseFunction {
9752
+ constructor() {
9753
+ super(...arguments);
9754
+ __publicField(this, "minParams", 0);
9755
+ __publicField(this, "maxParams", 0);
9756
+ }
9757
+ calculate() {
9758
+ return BooleanValueObject.create(!0);
9759
+ }
9760
+ };
9761
+ __name(_True, "True");
9762
+ let True = _True;
9763
+ const _Xor = class _Xor extends BaseFunction {
9764
+ constructor() {
9765
+ super(...arguments);
9766
+ __publicField(this, "minParams", 1);
9767
+ __publicField(this, "maxParams", 255);
9768
+ }
9769
+ calculate(...logicalValues) {
9770
+ let trueCount = 0, noBoolean = !0, errorValue = null;
9771
+ for (const logicalValue of logicalValues) {
9772
+ if (logicalValue.isError())
9773
+ return logicalValue;
9774
+ if (logicalValue.isArray()) {
9775
+ if (logicalValue.iterator((value) => {
9776
+ if (value != null && value.isError())
9777
+ return errorValue = value, !1;
9778
+ (value != null && value.isBoolean() || value != null && value.isNumber()) && (value.getValue() && trueCount++, noBoolean = !1);
9779
+ }), errorValue)
9780
+ return errorValue;
9781
+ } else (logicalValue.isBoolean() || logicalValue.isNumber()) && (logicalValue.getValue() && trueCount++, noBoolean = !1);
9782
+ }
9783
+ return noBoolean ? ErrorValueObject.create(ErrorType$1.VALUE) : BooleanValueObject.create(trueCount % 2 === 1);
9784
+ }
9785
+ };
9786
+ __name(_Xor, "Xor");
9787
+ let Xor = _Xor;
7131
9788
  const functionLogical = [
7132
9789
  [And, FUNCTION_NAMES_LOGICAL.AND],
9790
+ [False, FUNCTION_NAMES_LOGICAL.FALSE],
7133
9791
  [If, FUNCTION_NAMES_LOGICAL.IF],
9792
+ [Iferror, FUNCTION_NAMES_LOGICAL.IFERROR],
9793
+ [Ifna, FUNCTION_NAMES_LOGICAL.IFNA],
9794
+ [Ifs, FUNCTION_NAMES_LOGICAL.IFS],
7134
9795
  [Lambda, FUNCTION_NAMES_LOGICAL.LAMBDA],
9796
+ [Let, FUNCTION_NAMES_LOGICAL.LET],
7135
9797
  [Makearray, FUNCTION_NAMES_LOGICAL.MAKEARRAY],
9798
+ [Not, FUNCTION_NAMES_LOGICAL.NOT],
7136
9799
  [Or, FUNCTION_NAMES_LOGICAL.OR],
7137
- [Iferror, FUNCTION_NAMES_LOGICAL.IFERROR]
9800
+ [Switch, FUNCTION_NAMES_LOGICAL.SWITCH],
9801
+ [True, FUNCTION_NAMES_LOGICAL.TRUE],
9802
+ [Xor, FUNCTION_NAMES_LOGICAL.XOR]
7138
9803
  ];
7139
9804
  var FUNCTION_NAMES_LOOKUP = /* @__PURE__ */ ((FUNCTION_NAMES_LOOKUP2) => (FUNCTION_NAMES_LOOKUP2.ADDRESS = "ADDRESS", FUNCTION_NAMES_LOOKUP2.AREAS = "AREAS", FUNCTION_NAMES_LOOKUP2.CHOOSE = "CHOOSE", FUNCTION_NAMES_LOOKUP2.CHOOSECOLS = "CHOOSECOLS", FUNCTION_NAMES_LOOKUP2.CHOOSEROWS = "CHOOSEROWS", FUNCTION_NAMES_LOOKUP2.COLUMN = "COLUMN", FUNCTION_NAMES_LOOKUP2.COLUMNS = "COLUMNS", FUNCTION_NAMES_LOOKUP2.DROP = "DROP", FUNCTION_NAMES_LOOKUP2.EXPAND = "EXPAND", FUNCTION_NAMES_LOOKUP2.FILTER = "FILTER", FUNCTION_NAMES_LOOKUP2.FORMULATEXT = "FORMULATEXT", FUNCTION_NAMES_LOOKUP2.GETPIVOTDATA = "GETPIVOTDATA", FUNCTION_NAMES_LOOKUP2.HLOOKUP = "HLOOKUP", FUNCTION_NAMES_LOOKUP2.HSTACK = "HSTACK", FUNCTION_NAMES_LOOKUP2.HYPERLINK = "HYPERLINK", FUNCTION_NAMES_LOOKUP2.IMAGE = "IMAGE", FUNCTION_NAMES_LOOKUP2.INDEX = "INDEX", FUNCTION_NAMES_LOOKUP2.INDIRECT = "INDIRECT", FUNCTION_NAMES_LOOKUP2.LOOKUP = "LOOKUP", FUNCTION_NAMES_LOOKUP2.MATCH = "MATCH", FUNCTION_NAMES_LOOKUP2.OFFSET = "OFFSET", FUNCTION_NAMES_LOOKUP2.ROW = "ROW", FUNCTION_NAMES_LOOKUP2.ROWS = "ROWS", FUNCTION_NAMES_LOOKUP2.RTD = "RTD", FUNCTION_NAMES_LOOKUP2.SORT = "SORT", FUNCTION_NAMES_LOOKUP2.SORTBY = "SORTBY", FUNCTION_NAMES_LOOKUP2.TAKE = "TAKE", FUNCTION_NAMES_LOOKUP2.TOCOL = "TOCOL", FUNCTION_NAMES_LOOKUP2.TOROW = "TOROW", FUNCTION_NAMES_LOOKUP2.TRANSPOSE = "TRANSPOSE", FUNCTION_NAMES_LOOKUP2.UNIQUE = "UNIQUE", FUNCTION_NAMES_LOOKUP2.VLOOKUP = "VLOOKUP", FUNCTION_NAMES_LOOKUP2.VSTACK = "VSTACK", FUNCTION_NAMES_LOOKUP2.WRAPCOLS = "WRAPCOLS", FUNCTION_NAMES_LOOKUP2.WRAPROWS = "WRAPROWS", FUNCTION_NAMES_LOOKUP2.XLOOKUP = "XLOOKUP", FUNCTION_NAMES_LOOKUP2.XMATCH = "XMATCH", FUNCTION_NAMES_LOOKUP2))(FUNCTION_NAMES_LOOKUP || {});
7140
9805
  const _Address = class _Address extends BaseFunction {
@@ -7535,20 +10200,26 @@ const _Indirect = class _Indirect extends BaseFunction {
7535
10200
  return !0;
7536
10201
  }
7537
10202
  calculate(refText, a1) {
7538
- let _refText = refText;
7539
- if (_refText.isError())
7540
- return _refText;
10203
+ if (refText.isError())
10204
+ return refText;
10205
+ if (a1 != null && a1.isError())
10206
+ return a1;
7541
10207
  let a1Value = this.getZeroOrOneByOneDefault(a1);
7542
- if (a1Value == null && (a1Value = 1), _refText.isArray()) {
7543
- const refTextArray = _refText;
7544
- if (refTextArray.getRowCount() === 1 && refTextArray.getColumnCount() === 1)
7545
- _refText = refTextArray.getFirstCell();
7546
- else
7547
- return refTextArray.map(() => ErrorValueObject.create(ErrorType$1.VALUE));
10208
+ a1Value == null && (a1Value = 1);
10209
+ let _refText = refText;
10210
+ if (refText.isArray()) {
10211
+ const rowCount = refText.getRowCount(), columnCount = refText.getColumnCount();
10212
+ if (rowCount > 1 || columnCount > 1)
10213
+ return refText.map(() => ErrorValueObject.create(ErrorType$1.VALUE));
10214
+ _refText = refText.getFirstCell();
7548
10215
  }
7549
- if (!_refText.isString())
10216
+ return this._handleSingleObject(_refText, a1Value);
10217
+ }
10218
+ _handleSingleObject(refTextObject, a1Value) {
10219
+ const refTextValue = `${refTextObject.getValue()}`;
10220
+ if (refTextValue.trim() === "")
7550
10221
  return ErrorValueObject.create(ErrorType$1.REF);
7551
- const refTextV = this._convertToDefinedName(_refText.getValue());
10222
+ const refTextV = this._convertToDefinedName(refTextValue);
7552
10223
  if (a1Value === 0) {
7553
10224
  const gridRange2 = deserializeRangeForR1C1(refTextV), { range: range2, sheetName: sheetName2, unitId: unitId2 } = gridRange2, rangeReferenceObject2 = new RangeReferenceObject(range2);
7554
10225
  return rangeReferenceObject2.setForcedUnitIdDirect(unitId2), rangeReferenceObject2.setForcedSheetName(sheetName2), this._setDefault(rangeReferenceObject2);
@@ -7559,7 +10230,10 @@ const _Indirect = class _Indirect extends BaseFunction {
7559
10230
  return this._setDefault(new RowReferenceObject(refTextV));
7560
10231
  if (new RegExp(REFERENCE_REGEX_COLUMN).test(refTextV))
7561
10232
  return this._setDefault(new ColumnReferenceObject(refTextV));
7562
- const gridRange = deserializeRangeWithSheet(refTextV), { range, sheetName, unitId } = gridRange, rangeReferenceObject = new RangeReferenceObject(range);
10233
+ const gridRange = deserializeRangeWithSheet(refTextV), { range, sheetName, unitId } = gridRange;
10234
+ if (Number.isNaN(range.startRow) || range.endRow + 1 > 1048576 || Number.isNaN(range.startColumn) || range.endColumn + 1 > 16384)
10235
+ return ErrorValueObject.create(ErrorType$1.REF);
10236
+ const rangeReferenceObject = new RangeReferenceObject(range);
7563
10237
  return rangeReferenceObject.setForcedUnitIdDirect(unitId), rangeReferenceObject.setForcedSheetName(sheetName), this._setDefault(rangeReferenceObject);
7564
10238
  }
7565
10239
  _setDefault(object) {
@@ -10035,21 +12709,90 @@ const _Sumifs = class _Sumifs extends BaseFunction {
10035
12709
  const booleanResults = getBooleanResults(variants, maxRowLength, maxColumnLength, !0);
10036
12710
  return this._aggregateResults(sumRange, booleanResults);
10037
12711
  }
10038
- _aggregateResults(sumRange, booleanResults) {
10039
- const sumResults = booleanResults.map((row) => row.map((booleanResult) => sumRange.pick(booleanResult).sum())), arrayValueObjectData = {
10040
- calculateValueList: sumResults,
10041
- rowCount: sumResults.length,
10042
- columnCount: sumResults[0].length,
10043
- unitId: this.unitId || "",
10044
- sheetId: this.subUnitId || "",
10045
- row: this.row,
10046
- column: this.column
10047
- };
10048
- return ArrayValueObject.create(arrayValueObjectData);
12712
+ _aggregateResults(sumRange, booleanResults) {
12713
+ const sumResults = booleanResults.map((row) => row.map((booleanResult) => sumRange.pick(booleanResult).sum())), arrayValueObjectData = {
12714
+ calculateValueList: sumResults,
12715
+ rowCount: sumResults.length,
12716
+ columnCount: sumResults[0].length,
12717
+ unitId: this.unitId || "",
12718
+ sheetId: this.subUnitId || "",
12719
+ row: this.row,
12720
+ column: this.column
12721
+ };
12722
+ return ArrayValueObject.create(arrayValueObjectData);
12723
+ }
12724
+ };
12725
+ __name(_Sumifs, "Sumifs");
12726
+ let Sumifs = _Sumifs;
12727
+ const _Sumproduct = class _Sumproduct extends BaseFunction {
12728
+ constructor() {
12729
+ super(...arguments);
12730
+ __publicField(this, "minParams", 1);
12731
+ __publicField(this, "maxParams", 255);
12732
+ }
12733
+ calculate(array1, ...variants) {
12734
+ if (array1.isError())
12735
+ return array1;
12736
+ const _array1 = this._initArray1(array1);
12737
+ if (variants.length > 0) {
12738
+ const rowCount = _array1.getRowCount(), columnCount = _array1.getColumnCount();
12739
+ let resultArray = this._getResultArrayByArray1(rowCount, columnCount, _array1);
12740
+ if (resultArray instanceof ErrorValueObject)
12741
+ return resultArray;
12742
+ resultArray = resultArray;
12743
+ for (let i = 0; i < variants.length; i++) {
12744
+ if (variants[i].isError())
12745
+ return variants[i];
12746
+ let variantRowCount = 1, variantColumnCount = 1;
12747
+ if (variants[i].isArray() && (variantRowCount = variants[i].getRowCount(), variantColumnCount = variants[i].getColumnCount()), variantRowCount !== rowCount || variantColumnCount !== columnCount)
12748
+ return ErrorValueObject.create(ErrorType$1.VALUE);
12749
+ for (let r = 0; r < rowCount; r++) {
12750
+ const row = [];
12751
+ for (let c = 0; c < columnCount; c++) {
12752
+ let variantValueObject = variants[i];
12753
+ if (variants[i].isArray() && (variantValueObject = variants[i].get(r, c)), variantValueObject.isError())
12754
+ return variantValueObject;
12755
+ const variantValue = variantValueObject.getValue();
12756
+ !variantValue || !isRealNum(variantValue) ? row.push(0) : row.push(+variantValue * resultArray[r][c]);
12757
+ }
12758
+ resultArray[r] = row;
12759
+ }
12760
+ }
12761
+ const result = resultArray.reduce((acc, cur) => acc.concat(cur)).reduce((acc, cur) => acc + cur, 0);
12762
+ return NumberValueObject.create(result);
12763
+ } else
12764
+ return _array1.sum();
12765
+ }
12766
+ _initArray1(array1) {
12767
+ let _array1 = array1;
12768
+ return _array1.isArray() || (_array1 = ArrayValueObject.create({
12769
+ calculateValueList: [[_array1]],
12770
+ rowCount: 1,
12771
+ columnCount: 1,
12772
+ unitId: "",
12773
+ sheetId: "",
12774
+ row: 0,
12775
+ column: 0
12776
+ })), _array1;
12777
+ }
12778
+ _getResultArrayByArray1(rowCount, columnCount, array1) {
12779
+ const resultArray = [];
12780
+ for (let r = 0; r < rowCount; r++) {
12781
+ const row = [];
12782
+ for (let c = 0; c < columnCount; c++) {
12783
+ const array1ValueObject = array1.get(r, c);
12784
+ if (array1ValueObject.isError())
12785
+ return array1ValueObject;
12786
+ const array1Value = array1ValueObject.getValue();
12787
+ !array1Value || !isRealNum(array1Value) ? row.push(0) : row.push(+array1Value);
12788
+ }
12789
+ resultArray.push(row);
12790
+ }
12791
+ return resultArray;
10049
12792
  }
10050
12793
  };
10051
- __name(_Sumifs, "Sumifs");
10052
- let Sumifs = _Sumifs;
12794
+ __name(_Sumproduct, "Sumproduct");
12795
+ let Sumproduct = _Sumproduct;
10053
12796
  const _Sumsq = class _Sumsq extends BaseFunction {
10054
12797
  constructor() {
10055
12798
  super(...arguments);
@@ -10241,75 +12984,6 @@ const _Sumxmy2 = class _Sumxmy2 extends BaseFunction {
10241
12984
  };
10242
12985
  __name(_Sumxmy2, "Sumxmy2");
10243
12986
  let Sumxmy2 = _Sumxmy2;
10244
- const _Sumproduct = class _Sumproduct extends BaseFunction {
10245
- constructor() {
10246
- super(...arguments);
10247
- __publicField(this, "minParams", 1);
10248
- __publicField(this, "maxParams", 255);
10249
- }
10250
- calculate(array1, ...variants) {
10251
- if (array1.isError())
10252
- return array1;
10253
- const _array1 = this._initArray1(array1);
10254
- if (variants.length > 0) {
10255
- const rowCount = _array1.getRowCount(), columnCount = _array1.getColumnCount();
10256
- let resultArray = this._getResultArrayByArray1(rowCount, columnCount, _array1);
10257
- if (resultArray instanceof ErrorValueObject)
10258
- return resultArray;
10259
- resultArray = resultArray;
10260
- for (let i = 0; i < variants.length; i++) {
10261
- if (variants[i].isError())
10262
- return variants[i];
10263
- let variantRowCount = 1, variantColumnCount = 1;
10264
- if (variants[i].isArray() && (variantRowCount = variants[i].getRowCount(), variantColumnCount = variants[i].getColumnCount()), variantRowCount !== rowCount || variantColumnCount !== columnCount)
10265
- return ErrorValueObject.create(ErrorType$1.VALUE);
10266
- for (let r = 0; r < rowCount; r++) {
10267
- const row = [];
10268
- for (let c = 0; c < columnCount; c++) {
10269
- let variantValueObject = variants[i];
10270
- if (variants[i].isArray() && (variantValueObject = variants[i].get(r, c)), variantValueObject.isError())
10271
- return variantValueObject;
10272
- const variantValue = variantValueObject.getValue();
10273
- !variantValue || !isRealNum(variantValue) ? row.push(0) : row.push(+variantValue * resultArray[r][c]);
10274
- }
10275
- resultArray[r] = row;
10276
- }
10277
- }
10278
- const result = resultArray.reduce((acc, cur) => acc.concat(cur)).reduce((acc, cur) => acc + cur, 0);
10279
- return NumberValueObject.create(result);
10280
- } else
10281
- return _array1.sum();
10282
- }
10283
- _initArray1(array1) {
10284
- let _array1 = array1;
10285
- return _array1.isArray() || (_array1 = ArrayValueObject.create({
10286
- calculateValueList: [[_array1]],
10287
- rowCount: 1,
10288
- columnCount: 1,
10289
- unitId: "",
10290
- sheetId: "",
10291
- row: 0,
10292
- column: 0
10293
- })), _array1;
10294
- }
10295
- _getResultArrayByArray1(rowCount, columnCount, array1) {
10296
- const resultArray = [];
10297
- for (let r = 0; r < rowCount; r++) {
10298
- const row = [];
10299
- for (let c = 0; c < columnCount; c++) {
10300
- const array1ValueObject = array1.get(r, c);
10301
- if (array1ValueObject.isError())
10302
- return array1ValueObject;
10303
- const array1Value = array1ValueObject.getValue();
10304
- !array1Value || !isRealNum(array1Value) ? row.push(0) : row.push(+array1Value);
10305
- }
10306
- resultArray.push(row);
10307
- }
10308
- return resultArray;
10309
- }
10310
- };
10311
- __name(_Sumproduct, "Sumproduct");
10312
- let Sumproduct = _Sumproduct;
10313
12987
  const _Tan = class _Tan extends BaseFunction {
10314
12988
  constructor() {
10315
12989
  super(...arguments);
@@ -10391,14 +13065,14 @@ const functionMath = [
10391
13065
  [Floor, FUNCTION_NAMES_MATH.FLOOR],
10392
13066
  [FloorMath, FUNCTION_NAMES_MATH.FLOOR_MATH],
10393
13067
  [FloorPrecise, FUNCTION_NAMES_MATH.FLOOR_PRECISE],
10394
- [Log, FUNCTION_NAMES_MATH.LOG],
10395
13068
  [Ln, FUNCTION_NAMES_MATH.LN],
13069
+ [Log, FUNCTION_NAMES_MATH.LOG],
10396
13070
  [Log10, FUNCTION_NAMES_MATH.LOG10],
10397
13071
  [Mod, FUNCTION_NAMES_MATH.MOD],
10398
13072
  [Mround, FUNCTION_NAMES_MATH.MROUND],
10399
- [Power, FUNCTION_NAMES_MATH.POWER],
10400
13073
  [Odd, FUNCTION_NAMES_MATH.ODD],
10401
13074
  [Pi, FUNCTION_NAMES_MATH.PI],
13075
+ [Power, FUNCTION_NAMES_MATH.POWER],
10402
13076
  [Product, FUNCTION_NAMES_MATH.PRODUCT],
10403
13077
  [Radians, FUNCTION_NAMES_MATH.RADIANS],
10404
13078
  [Rand, FUNCTION_NAMES_MATH.RAND],
@@ -10417,11 +13091,11 @@ const functionMath = [
10417
13091
  [Sum, FUNCTION_NAMES_MATH.SUM],
10418
13092
  [Sumif, FUNCTION_NAMES_MATH.SUMIF],
10419
13093
  [Sumifs, FUNCTION_NAMES_MATH.SUMIFS],
13094
+ [Sumproduct, FUNCTION_NAMES_MATH.SUMPRODUCT],
10420
13095
  [Sumsq, FUNCTION_NAMES_MATH.SUMSQ],
10421
13096
  [Sumx2my2, FUNCTION_NAMES_MATH.SUMX2MY2],
10422
13097
  [Sumx2py2, FUNCTION_NAMES_MATH.SUMX2PY2],
10423
13098
  [Sumxmy2, FUNCTION_NAMES_MATH.SUMXMY2],
10424
- [Sumproduct, FUNCTION_NAMES_MATH.SUMPRODUCT],
10425
13099
  [Tan, FUNCTION_NAMES_MATH.TAN],
10426
13100
  [Tanh, FUNCTION_NAMES_MATH.TANH],
10427
13101
  [Trunc, FUNCTION_NAMES_MATH.TRUNC]
@@ -10571,7 +13245,9 @@ const functionMeta = [
10571
13245
  [Multiply, FUNCTION_NAMES_META.MULTIPLY],
10572
13246
  [Plus, FUNCTION_NAMES_META.PLUS],
10573
13247
  [Cube, FUNCTION_NAMES_META.CUBE]
10574
- ], _Average = class _Average extends BaseFunction {
13248
+ ];
13249
+ var FUNCTION_NAMES_STATISTICAL = /* @__PURE__ */ ((FUNCTION_NAMES_STATISTICAL2) => (FUNCTION_NAMES_STATISTICAL2.AVEDEV = "AVEDEV", FUNCTION_NAMES_STATISTICAL2.AVERAGE = "AVERAGE", FUNCTION_NAMES_STATISTICAL2.AVERAGEA = "AVERAGEA", FUNCTION_NAMES_STATISTICAL2.AVERAGEIF = "AVERAGEIF", FUNCTION_NAMES_STATISTICAL2.AVERAGEIFS = "AVERAGEIFS", FUNCTION_NAMES_STATISTICAL2.BETA_DIST = "BETA.DIST", FUNCTION_NAMES_STATISTICAL2.BETA_INV = "BETA.INV", FUNCTION_NAMES_STATISTICAL2.BINOM_DIST = "BINOM.DIST", FUNCTION_NAMES_STATISTICAL2.BINOM_DIST_RANGE = "BINOM.DIST.RANGE", FUNCTION_NAMES_STATISTICAL2.BINOM_INV = "BINOM.INV", FUNCTION_NAMES_STATISTICAL2.CHISQ_DIST = "CHISQ.DIST", FUNCTION_NAMES_STATISTICAL2.CHISQ_DIST_RT = "CHISQ.DIST.RT", FUNCTION_NAMES_STATISTICAL2.CHISQ_INV = "CHISQ.INV", FUNCTION_NAMES_STATISTICAL2.CHISQ_INV_RT = "CHISQ.INV.RT", FUNCTION_NAMES_STATISTICAL2.CHISQ_TEST = "CHISQ.TEST", FUNCTION_NAMES_STATISTICAL2.CONFIDENCE_NORM = "CONFIDENCE.NORM", FUNCTION_NAMES_STATISTICAL2.CONFIDENCE_T = "CONFIDENCE.T", FUNCTION_NAMES_STATISTICAL2.CORREL = "CORREL", FUNCTION_NAMES_STATISTICAL2.COUNT = "COUNT", FUNCTION_NAMES_STATISTICAL2.COUNTA = "COUNTA", FUNCTION_NAMES_STATISTICAL2.COUNTBLANK = "COUNTBLANK", FUNCTION_NAMES_STATISTICAL2.COUNTIF = "COUNTIF", FUNCTION_NAMES_STATISTICAL2.COUNTIFS = "COUNTIFS", FUNCTION_NAMES_STATISTICAL2.COVARIANCE_P = "COVARIANCE.P", FUNCTION_NAMES_STATISTICAL2.COVARIANCE_S = "COVARIANCE.S", FUNCTION_NAMES_STATISTICAL2.DEVSQ = "DEVSQ", FUNCTION_NAMES_STATISTICAL2.EXPON_DIST = "EXPON.DIST", FUNCTION_NAMES_STATISTICAL2.F_DIST = "F.DIST", FUNCTION_NAMES_STATISTICAL2.F_DIST_RT = "F.DIST.RT", FUNCTION_NAMES_STATISTICAL2.F_INV = "F.INV", FUNCTION_NAMES_STATISTICAL2.F_INV_RT = "F.INV.RT", FUNCTION_NAMES_STATISTICAL2.F_TEST = "F.TEST", FUNCTION_NAMES_STATISTICAL2.FISHER = "FISHER", FUNCTION_NAMES_STATISTICAL2.FISHERINV = "FISHERINV", FUNCTION_NAMES_STATISTICAL2.FORECAST = "FORECAST", FUNCTION_NAMES_STATISTICAL2.FORECAST_ETS = "FORECAST.ETS", FUNCTION_NAMES_STATISTICAL2.FORECAST_ETS_CONFINT = "FORECAST.ETS.CONFINT", FUNCTION_NAMES_STATISTICAL2.FORECAST_ETS_SEASONALITY = "FORECAST.ETS.SEASONALITY", FUNCTION_NAMES_STATISTICAL2.FORECAST_ETS_STAT = "FORECAST.ETS.STAT", FUNCTION_NAMES_STATISTICAL2.FORECAST_LINEAR = "FORECAST.LINEAR", FUNCTION_NAMES_STATISTICAL2.FREQUENCY = "FREQUENCY", FUNCTION_NAMES_STATISTICAL2.GAMMA = "GAMMA", FUNCTION_NAMES_STATISTICAL2.GAMMA_DIST = "GAMMA.DIST", FUNCTION_NAMES_STATISTICAL2.GAMMA_INV = "GAMMA.INV", FUNCTION_NAMES_STATISTICAL2.GAMMALN = "GAMMALN", FUNCTION_NAMES_STATISTICAL2.GAMMALN_PRECISE = "GAMMALN.PRECISE", FUNCTION_NAMES_STATISTICAL2.GAUSS = "GAUSS", FUNCTION_NAMES_STATISTICAL2.GEOMEAN = "GEOMEAN", FUNCTION_NAMES_STATISTICAL2.GROWTH = "GROWTH", FUNCTION_NAMES_STATISTICAL2.HARMEAN = "HARMEAN", FUNCTION_NAMES_STATISTICAL2.HYPGEOM_DIST = "HYPGEOM.DIST", FUNCTION_NAMES_STATISTICAL2.INTERCEPT = "INTERCEPT", FUNCTION_NAMES_STATISTICAL2.KURT = "KURT", FUNCTION_NAMES_STATISTICAL2.LARGE = "LARGE", FUNCTION_NAMES_STATISTICAL2.LINEST = "LINEST", FUNCTION_NAMES_STATISTICAL2.LOGEST = "LOGEST", FUNCTION_NAMES_STATISTICAL2.LOGNORM_DIST = "LOGNORM.DIST", FUNCTION_NAMES_STATISTICAL2.LOGNORM_INV = "LOGNORM.INV", FUNCTION_NAMES_STATISTICAL2.MAX = "MAX", FUNCTION_NAMES_STATISTICAL2.MAXA = "MAXA", FUNCTION_NAMES_STATISTICAL2.MAXIFS = "MAXIFS", FUNCTION_NAMES_STATISTICAL2.MEDIAN = "MEDIAN", FUNCTION_NAMES_STATISTICAL2.MIN = "MIN", FUNCTION_NAMES_STATISTICAL2.MINA = "MINA", FUNCTION_NAMES_STATISTICAL2.MINIFS = "MINIFS", FUNCTION_NAMES_STATISTICAL2.MODE_MULT = "MODE.MULT", FUNCTION_NAMES_STATISTICAL2.MODE_SNGL = "MODE.SNGL", FUNCTION_NAMES_STATISTICAL2.NEGBINOM_DIST = "NEGBINOM.DIST", FUNCTION_NAMES_STATISTICAL2.NORM_DIST = "NORM.DIST", FUNCTION_NAMES_STATISTICAL2.NORM_INV = "NORM.INV", FUNCTION_NAMES_STATISTICAL2.NORM_S_DIST = "NORM.S.DIST", FUNCTION_NAMES_STATISTICAL2.NORM_S_INV = "NORM.S.INV", FUNCTION_NAMES_STATISTICAL2.PEARSON = "PEARSON", FUNCTION_NAMES_STATISTICAL2.PERCENTILE_EXC = "PERCENTILE.EXC", FUNCTION_NAMES_STATISTICAL2.PERCENTILE_INC = "PERCENTILE.INC", FUNCTION_NAMES_STATISTICAL2.PERCENTRANK_EXC = "PERCENTRANK.EXC", FUNCTION_NAMES_STATISTICAL2.PERCENTRANK_INC = "PERCENTRANK.INC", FUNCTION_NAMES_STATISTICAL2.PERMUT = "PERMUT", FUNCTION_NAMES_STATISTICAL2.PERMUTATIONA = "PERMUTATIONA", FUNCTION_NAMES_STATISTICAL2.PHI = "PHI", FUNCTION_NAMES_STATISTICAL2.POISSON_DIST = "POISSON.DIST", FUNCTION_NAMES_STATISTICAL2.PROB = "PROB", FUNCTION_NAMES_STATISTICAL2.QUARTILE_EXC = "QUARTILE.EXC", FUNCTION_NAMES_STATISTICAL2.QUARTILE_INC = "QUARTILE.INC", FUNCTION_NAMES_STATISTICAL2.RANK_AVG = "RANK.AVG", FUNCTION_NAMES_STATISTICAL2.RANK_EQ = "RANK.EQ", FUNCTION_NAMES_STATISTICAL2.RSQ = "RSQ", FUNCTION_NAMES_STATISTICAL2.SKEW = "SKEW", FUNCTION_NAMES_STATISTICAL2.SKEW_P = "SKEW.P", FUNCTION_NAMES_STATISTICAL2.SLOPE = "SLOPE", FUNCTION_NAMES_STATISTICAL2.SMALL = "SMALL", FUNCTION_NAMES_STATISTICAL2.STANDARDIZE = "STANDARDIZE", FUNCTION_NAMES_STATISTICAL2.STDEV_P = "STDEV.P", FUNCTION_NAMES_STATISTICAL2.STDEV_S = "STDEV.S", FUNCTION_NAMES_STATISTICAL2.STDEVA = "STDEVA", FUNCTION_NAMES_STATISTICAL2.STDEVPA = "STDEVPA", FUNCTION_NAMES_STATISTICAL2.STEYX = "STEYX", FUNCTION_NAMES_STATISTICAL2.T_DIST = "T.DIST", FUNCTION_NAMES_STATISTICAL2.T_DIST_2T = "T.DIST.2T", FUNCTION_NAMES_STATISTICAL2.T_DIST_RT = "T.DIST.RT", FUNCTION_NAMES_STATISTICAL2.T_INV = "T.INV", FUNCTION_NAMES_STATISTICAL2.T_INV_2T = "T.INV.2T", FUNCTION_NAMES_STATISTICAL2.T_TEST = "T.TEST", FUNCTION_NAMES_STATISTICAL2.TREND = "TREND", FUNCTION_NAMES_STATISTICAL2.TRIMMEAN = "TRIMMEAN", FUNCTION_NAMES_STATISTICAL2.VAR_P = "VAR.P", FUNCTION_NAMES_STATISTICAL2.VAR_S = "VAR.S", FUNCTION_NAMES_STATISTICAL2.VARA = "VARA", FUNCTION_NAMES_STATISTICAL2.VARPA = "VARPA", FUNCTION_NAMES_STATISTICAL2.WEIBULL_DIST = "WEIBULL.DIST", FUNCTION_NAMES_STATISTICAL2.Z_TEST = "Z.TEST", FUNCTION_NAMES_STATISTICAL2))(FUNCTION_NAMES_STATISTICAL || {});
13250
+ const _Avedev = class _Avedev extends BaseFunction {
10575
13251
  constructor() {
10576
13252
  super(...arguments);
10577
13253
  __publicField(this, "minParams", 1);
@@ -10581,197 +13257,70 @@ const functionMeta = [
10581
13257
  let accumulatorSum = NumberValueObject.create(0), accumulatorCount = NumberValueObject.create(0);
10582
13258
  for (let i = 0; i < variants.length; i++) {
10583
13259
  let variant = variants[i];
10584
- if ((variant.isString() || variant.isBoolean()) && (variant = variant.convertToNumberObjectValue()), variant.isError())
13260
+ if (variant.isString() && (variant = variant.convertToNumberObjectValue()), variant.isError())
10585
13261
  return variant;
10586
13262
  if (variant.isArray()) {
10587
- if (accumulatorSum = accumulatorSum.plus(variant.sum()), accumulatorSum.isError())
13263
+ if (variant = filterNumberValueObject(variant), variant.isError())
13264
+ return variant;
13265
+ if (variants[i] = variant, accumulatorSum = accumulatorSum.plus(variant.sum()), accumulatorSum.isError())
10588
13266
  return accumulatorSum;
10589
13267
  accumulatorCount = accumulatorCount.plus(variant.count());
10590
- } else variant.isNull() || (accumulatorSum = accumulatorSum.plus(variant), accumulatorCount = accumulatorCount.plus(NumberValueObject.create(1)));
10591
- }
10592
- return accumulatorSum.divided(accumulatorCount);
10593
- }
10594
- };
10595
- __name(_Average, "Average");
10596
- let Average = _Average;
10597
- const _Count = class _Count extends BaseFunction {
10598
- constructor() {
10599
- super(...arguments);
10600
- __publicField(this, "minParams", 1);
10601
- __publicField(this, "maxParams", 255);
10602
- }
10603
- calculate(...variants) {
10604
- let accumulatorAll = NumberValueObject.create(0);
10605
- for (let i = 0; i < variants.length; i++) {
10606
- const variant = variants[i];
10607
- variant.isError() || (variant.isArray() ? accumulatorAll = accumulatorAll.plus(variant.count()) : variant.isString() ? variant.convertToNumberObjectValue().isError() || (accumulatorAll = accumulatorAll.plus(NumberValueObject.create(1))) : variant.isNull() || (accumulatorAll = accumulatorAll.plus(NumberValueObject.create(1))));
10608
- }
10609
- return accumulatorAll;
10610
- }
10611
- };
10612
- __name(_Count, "Count");
10613
- let Count = _Count;
10614
- const _Counta = class _Counta extends BaseFunction {
10615
- constructor() {
10616
- super(...arguments);
10617
- __publicField(this, "minParams", 1);
10618
- __publicField(this, "maxParams", 255);
10619
- }
10620
- calculate(...variants) {
10621
- let accumulatorAll = NumberValueObject.create(0);
10622
- for (let i = 0; i < variants.length; i++) {
10623
- let variant = variants[i];
10624
- if (variant.isError()) {
10625
- accumulatorAll = accumulatorAll.plus(NumberValueObject.create(1));
10626
- continue;
10627
- }
10628
- variant.isArray() ? (variant = variant.countA(), accumulatorAll = accumulatorAll.plus(variant)) : variant.isNull() || (accumulatorAll = accumulatorAll.plus(NumberValueObject.create(1)));
10629
- }
10630
- return accumulatorAll;
10631
- }
10632
- };
10633
- __name(_Counta, "Counta");
10634
- let Counta = _Counta;
10635
- var FUNCTION_NAMES_STATISTICAL = /* @__PURE__ */ ((FUNCTION_NAMES_STATISTICAL2) => (FUNCTION_NAMES_STATISTICAL2.AVEDEV = "AVEDEV", FUNCTION_NAMES_STATISTICAL2.AVERAGE = "AVERAGE", FUNCTION_NAMES_STATISTICAL2.AVERAGEA = "AVERAGEA", FUNCTION_NAMES_STATISTICAL2.AVERAGEIF = "AVERAGEIF", FUNCTION_NAMES_STATISTICAL2.AVERAGEIFS = "AVERAGEIFS", FUNCTION_NAMES_STATISTICAL2.BETA_DIST = "BETA.DIST", FUNCTION_NAMES_STATISTICAL2.BETA_INV = "BETA.INV", FUNCTION_NAMES_STATISTICAL2.BINOM_DIST = "BINOM.DIST", FUNCTION_NAMES_STATISTICAL2.BINOM_DIST_RANGE = "BINOM.DIST.RANGE", FUNCTION_NAMES_STATISTICAL2.BINOM_INV = "BINOM.INV", FUNCTION_NAMES_STATISTICAL2.CHISQ_DIST = "CHISQ.DIST", FUNCTION_NAMES_STATISTICAL2.CHISQ_DIST_RT = "CHISQ.DIST.RT", FUNCTION_NAMES_STATISTICAL2.CHISQ_INV = "CHISQ.INV", FUNCTION_NAMES_STATISTICAL2.CHISQ_INV_RT = "CHISQ.INV.RT", FUNCTION_NAMES_STATISTICAL2.CHISQ_TEST = "CHISQ.TEST", FUNCTION_NAMES_STATISTICAL2.CONFIDENCE_NORM = "CONFIDENCE.NORM", FUNCTION_NAMES_STATISTICAL2.CONFIDENCE_T = "CONFIDENCE.T", FUNCTION_NAMES_STATISTICAL2.CORREL = "CORREL", FUNCTION_NAMES_STATISTICAL2.COUNT = "COUNT", FUNCTION_NAMES_STATISTICAL2.COUNTA = "COUNTA", FUNCTION_NAMES_STATISTICAL2.COUNTBLANK = "COUNTBLANK", FUNCTION_NAMES_STATISTICAL2.COUNTIF = "COUNTIF", FUNCTION_NAMES_STATISTICAL2.COUNTIFS = "COUNTIFS", FUNCTION_NAMES_STATISTICAL2.COVARIANCE_P = "COVARIANCE.P", FUNCTION_NAMES_STATISTICAL2.COVARIANCE_S = "COVARIANCE.S", FUNCTION_NAMES_STATISTICAL2.DEVSQ = "DEVSQ", FUNCTION_NAMES_STATISTICAL2.EXPON_DIST = "EXPON.DIST", FUNCTION_NAMES_STATISTICAL2.F_DIST = "F.DIST", FUNCTION_NAMES_STATISTICAL2.F_DIST_RT = "F.DIST.RT", FUNCTION_NAMES_STATISTICAL2.F_INV = "F.INV", FUNCTION_NAMES_STATISTICAL2.F_INV_RT = "F.INV.RT", FUNCTION_NAMES_STATISTICAL2.F_TEST = "F.TEST", FUNCTION_NAMES_STATISTICAL2.FISHER = "FISHER", FUNCTION_NAMES_STATISTICAL2.FISHERINV = "FISHERINV", FUNCTION_NAMES_STATISTICAL2.FORECAST = "FORECAST", FUNCTION_NAMES_STATISTICAL2.FORECAST_ETS = "FORECAST.ETS", FUNCTION_NAMES_STATISTICAL2.FORECAST_ETS_CONFINT = "FORECAST.ETS.CONFINT", FUNCTION_NAMES_STATISTICAL2.FORECAST_ETS_SEASONALITY = "FORECAST.ETS.SEASONALITY", FUNCTION_NAMES_STATISTICAL2.FORECAST_ETS_STAT = "FORECAST.ETS.STAT", FUNCTION_NAMES_STATISTICAL2.FORECAST_LINEAR = "FORECAST.LINEAR", FUNCTION_NAMES_STATISTICAL2.FREQUENCY = "FREQUENCY", FUNCTION_NAMES_STATISTICAL2.GAMMA = "GAMMA", FUNCTION_NAMES_STATISTICAL2.GAMMA_DIST = "GAMMA.DIST", FUNCTION_NAMES_STATISTICAL2.GAMMA_INV = "GAMMA.INV", FUNCTION_NAMES_STATISTICAL2.GAMMALN = "GAMMALN", FUNCTION_NAMES_STATISTICAL2.GAMMALN_PRECISE = "GAMMALN.PRECISE", FUNCTION_NAMES_STATISTICAL2.GAUSS = "GAUSS", FUNCTION_NAMES_STATISTICAL2.GEOMEAN = "GEOMEAN", FUNCTION_NAMES_STATISTICAL2.GROWTH = "GROWTH", FUNCTION_NAMES_STATISTICAL2.HARMEAN = "HARMEAN", FUNCTION_NAMES_STATISTICAL2.HYPGEOM_DIST = "HYPGEOM.DIST", FUNCTION_NAMES_STATISTICAL2.INTERCEPT = "INTERCEPT", FUNCTION_NAMES_STATISTICAL2.KURT = "KURT", FUNCTION_NAMES_STATISTICAL2.LARGE = "LARGE", FUNCTION_NAMES_STATISTICAL2.LINEST = "LINEST", FUNCTION_NAMES_STATISTICAL2.LOGEST = "LOGEST", FUNCTION_NAMES_STATISTICAL2.LOGNORM_DIST = "LOGNORM.DIST", FUNCTION_NAMES_STATISTICAL2.LOGNORM_INV = "LOGNORM.INV", FUNCTION_NAMES_STATISTICAL2.MAX = "MAX", FUNCTION_NAMES_STATISTICAL2.MAXA = "MAXA", FUNCTION_NAMES_STATISTICAL2.MAXIFS = "MAXIFS", FUNCTION_NAMES_STATISTICAL2.MEDIAN = "MEDIAN", FUNCTION_NAMES_STATISTICAL2.MIN = "MIN", FUNCTION_NAMES_STATISTICAL2.MINA = "MINA", FUNCTION_NAMES_STATISTICAL2.MINIFS = "MINIFS", FUNCTION_NAMES_STATISTICAL2.MODE_MULT = "MODE.MULT", FUNCTION_NAMES_STATISTICAL2.MODE_SNGL = "MODE.SNGL", FUNCTION_NAMES_STATISTICAL2.NEGBINOM_DIST = "NEGBINOM.DIST", FUNCTION_NAMES_STATISTICAL2.NORM_DIST = "NORM.DIST", FUNCTION_NAMES_STATISTICAL2.NORM_INV = "NORM.INV", FUNCTION_NAMES_STATISTICAL2.NORM_S_DIST = "NORM.S.DIST", FUNCTION_NAMES_STATISTICAL2.NORM_S_INV = "NORM.S.INV", FUNCTION_NAMES_STATISTICAL2.PEARSON = "PEARSON", FUNCTION_NAMES_STATISTICAL2.PERCENTILE_EXC = "PERCENTILE.EXC", FUNCTION_NAMES_STATISTICAL2.PERCENTILE_INC = "PERCENTILE.INC", FUNCTION_NAMES_STATISTICAL2.PERCENTRANK_EXC = "PERCENTRANK.EXC", FUNCTION_NAMES_STATISTICAL2.PERCENTRANK_INC = "PERCENTRANK.INC", FUNCTION_NAMES_STATISTICAL2.PERMUT = "PERMUT", FUNCTION_NAMES_STATISTICAL2.PERMUTATIONA = "PERMUTATIONA", FUNCTION_NAMES_STATISTICAL2.PHI = "PHI", FUNCTION_NAMES_STATISTICAL2.POISSON_DIST = "POISSON.DIST", FUNCTION_NAMES_STATISTICAL2.PROB = "PROB", FUNCTION_NAMES_STATISTICAL2.QUARTILE_EXC = "QUARTILE.EXC", FUNCTION_NAMES_STATISTICAL2.QUARTILE_INC = "QUARTILE.INC", FUNCTION_NAMES_STATISTICAL2.RANK_AVG = "RANK.AVG", FUNCTION_NAMES_STATISTICAL2.RANK_EQ = "RANK.EQ", FUNCTION_NAMES_STATISTICAL2.RSQ = "RSQ", FUNCTION_NAMES_STATISTICAL2.SKEW = "SKEW", FUNCTION_NAMES_STATISTICAL2.SKEW_P = "SKEW.P", FUNCTION_NAMES_STATISTICAL2.SLOPE = "SLOPE", FUNCTION_NAMES_STATISTICAL2.SMALL = "SMALL", FUNCTION_NAMES_STATISTICAL2.STANDARDIZE = "STANDARDIZE", FUNCTION_NAMES_STATISTICAL2.STDEV_P = "STDEV.P", FUNCTION_NAMES_STATISTICAL2.STDEV_S = "STDEV.S", FUNCTION_NAMES_STATISTICAL2.STDEVA = "STDEVA", FUNCTION_NAMES_STATISTICAL2.STDEVPA = "STDEVPA", FUNCTION_NAMES_STATISTICAL2.STEYX = "STEYX", FUNCTION_NAMES_STATISTICAL2.T_DIST = "T.DIST", FUNCTION_NAMES_STATISTICAL2.T_DIST_2T = "T.DIST.2T", FUNCTION_NAMES_STATISTICAL2.T_DIST_RT = "T.DIST.RT", FUNCTION_NAMES_STATISTICAL2.T_INV = "T.INV", FUNCTION_NAMES_STATISTICAL2.T_INV_2T = "T.INV.2T", FUNCTION_NAMES_STATISTICAL2.T_TEST = "T.TEST", FUNCTION_NAMES_STATISTICAL2.TREND = "TREND", FUNCTION_NAMES_STATISTICAL2.TRIMMEAN = "TRIMMEAN", FUNCTION_NAMES_STATISTICAL2.VAR_P = "VAR.P", FUNCTION_NAMES_STATISTICAL2.VAR_S = "VAR.S", FUNCTION_NAMES_STATISTICAL2.VARA = "VARA", FUNCTION_NAMES_STATISTICAL2.VARPA = "VARPA", FUNCTION_NAMES_STATISTICAL2.WEIBULL_DIST = "WEIBULL.DIST", FUNCTION_NAMES_STATISTICAL2.Z_TEST = "Z.TEST", FUNCTION_NAMES_STATISTICAL2))(FUNCTION_NAMES_STATISTICAL || {});
10636
- const _Max = class _Max extends BaseFunction {
10637
- constructor() {
10638
- super(...arguments);
10639
- __publicField(this, "minParams", 1);
10640
- __publicField(this, "maxParams", 255);
10641
- }
10642
- calculate(...variants) {
10643
- let accumulatorAll = NumberValueObject.create(Number.NEGATIVE_INFINITY);
10644
- for (let i = 0; i < variants.length; i++) {
10645
- let variant = variants[i];
10646
- if (!variant.isNull()) {
10647
- if ((variant.isString() || variant.isBoolean()) && (variant = variant.convertToNumberObjectValue()), variant.isArray() && (variant = variant.max()), variant.isError())
10648
- return variant;
10649
- accumulatorAll = this._validator(accumulatorAll, variant);
10650
- }
10651
- }
10652
- return accumulatorAll.getValue() === Number.NEGATIVE_INFINITY ? NumberValueObject.create(0) : accumulatorAll;
10653
- }
10654
- _validator(accumulatorAll, valueObject) {
10655
- const validator = accumulatorAll.isLessThan(valueObject);
10656
- let _accumulatorAll = accumulatorAll;
10657
- return validator.getValue() && (_accumulatorAll = valueObject), _accumulatorAll;
10658
- }
10659
- };
10660
- __name(_Max, "Max");
10661
- let Max = _Max;
10662
- const _Min = class _Min extends BaseFunction {
10663
- constructor() {
10664
- super(...arguments);
10665
- __publicField(this, "minParams", 1);
10666
- __publicField(this, "maxParams", 255);
10667
- }
10668
- calculate(...variants) {
10669
- let accumulatorAll = NumberValueObject.create(Number.POSITIVE_INFINITY);
10670
- for (let i = 0; i < variants.length; i++) {
10671
- let variant = variants[i];
10672
- if (!variant.isNull()) {
10673
- if ((variant.isString() || variant.isBoolean()) && (variant = variant.convertToNumberObjectValue()), variant.isArray() && (variant = variant.min()), variant.isError())
10674
- return variant;
10675
- accumulatorAll = this._validator(accumulatorAll, variant);
10676
- }
10677
- }
10678
- return accumulatorAll.getValue() === Number.POSITIVE_INFINITY ? NumberValueObject.create(0) : accumulatorAll;
10679
- }
10680
- _validator(accumulatorAll, valueObject) {
10681
- const validator = accumulatorAll.isGreaterThan(valueObject);
10682
- let _accumulatorAll = accumulatorAll;
10683
- return validator.getValue() && (_accumulatorAll = valueObject), _accumulatorAll;
10684
- }
10685
- };
10686
- __name(_Min, "Min");
10687
- let Min = _Min;
10688
- const _Stdeva = class _Stdeva extends BaseFunction {
10689
- constructor() {
10690
- super(...arguments);
10691
- __publicField(this, "minParams", 1);
10692
- __publicField(this, "maxParams", 255);
10693
- }
10694
- calculate(...variants) {
10695
- const flattenArray = this.flattenArray(variants, !1);
10696
- return flattenArray.isError() ? flattenArray : flattenArray.std(1);
10697
- }
10698
- };
10699
- __name(_Stdeva, "Stdeva");
10700
- let Stdeva = _Stdeva;
10701
- const _Stdevpa = class _Stdevpa extends BaseFunction {
10702
- constructor() {
10703
- super(...arguments);
10704
- __publicField(this, "minParams", 1);
10705
- __publicField(this, "maxParams", 255);
10706
- }
10707
- calculate(...variants) {
10708
- const flattenArray = this.flattenArray(variants, !1);
10709
- return flattenArray.isError() ? flattenArray : flattenArray.std();
10710
- }
10711
- };
10712
- __name(_Stdevpa, "Stdevpa");
10713
- let Stdevpa = _Stdevpa;
10714
- const _Vara = class _Vara extends BaseFunction {
10715
- constructor() {
10716
- super(...arguments);
10717
- __publicField(this, "minParams", 1);
10718
- __publicField(this, "maxParams", 255);
10719
- }
10720
- calculate(...variants) {
10721
- const flattenArray = this.flattenArray(variants, !1);
10722
- return flattenArray.isError() ? flattenArray : flattenArray.var(1);
13268
+ } else variant.isNull() || (accumulatorSum = accumulatorSum.plus(variant), accumulatorCount = accumulatorCount.plus(NumberValueObject.create(1)));
13269
+ }
13270
+ if (accumulatorCount.getValue() === 0)
13271
+ return ErrorValueObject.create(ErrorType$1.NUM);
13272
+ const average = accumulatorSum.divided(accumulatorCount);
13273
+ if (average.isError())
13274
+ return average;
13275
+ let accumulatorAveDev = NumberValueObject.create(0);
13276
+ for (let i = 0; i < variants.length; i++) {
13277
+ let variant = variants[i];
13278
+ if (variant.isString() && (variant = variant.convertToNumberObjectValue()), variant.isError())
13279
+ return variant;
13280
+ if (variant.isArray()) {
13281
+ if (accumulatorAveDev = accumulatorAveDev.plus(variant.minus(average).abs().sum()), accumulatorAveDev.isError())
13282
+ return accumulatorAveDev;
13283
+ } else variant.isNull() || (accumulatorAveDev = accumulatorAveDev.plus(variant.minus(average).abs()));
13284
+ }
13285
+ return accumulatorAveDev.divided(accumulatorCount);
10723
13286
  }
10724
13287
  };
10725
- __name(_Vara, "Vara");
10726
- let Vara = _Vara;
10727
- const _Varpa = class _Varpa extends BaseFunction {
13288
+ __name(_Avedev, "Avedev");
13289
+ let Avedev = _Avedev;
13290
+ function filterNumberValueObject(array) {
13291
+ const newArray = [];
13292
+ newArray[0] = [];
13293
+ let isError = null;
13294
+ return array.iterator((valueObject, _rowIndex, _columnIndex) => {
13295
+ if (valueObject != null && valueObject.isError())
13296
+ return isError = valueObject, !1;
13297
+ valueObject != null && valueObject.isNumber() && newArray[0].push(valueObject);
13298
+ }), isError || createNewArray(newArray, 1, newArray[0].length);
13299
+ }
13300
+ __name(filterNumberValueObject, "filterNumberValueObject");
13301
+ const _Average = class _Average extends BaseFunction {
10728
13302
  constructor() {
10729
13303
  super(...arguments);
10730
13304
  __publicField(this, "minParams", 1);
10731
13305
  __publicField(this, "maxParams", 255);
10732
13306
  }
10733
13307
  calculate(...variants) {
10734
- const flattenArray = this.flattenArray(variants, !1);
10735
- return flattenArray.isError() ? flattenArray : flattenArray.var();
10736
- }
10737
- };
10738
- __name(_Varpa, "Varpa");
10739
- let Varpa = _Varpa;
10740
- const _Maxifs = class _Maxifs extends BaseFunction {
10741
- constructor() {
10742
- super(...arguments);
10743
- __publicField(this, "minParams", 3);
10744
- __publicField(this, "maxParams", 255);
10745
- }
10746
- calculate(maxRange, ...variants) {
10747
- if (maxRange.isError())
10748
- return ErrorValueObject.create(ErrorType$1.NA);
10749
- if (!maxRange.isArray() || variants.length % 2 !== 0 || variants.some((variant, i) => i % 2 === 0 && !variant.isArray()))
10750
- return ErrorValueObject.create(ErrorType$1.VALUE);
10751
- const { maxRowLength, maxColumnLength } = calculateMaxDimensions(variants), errorArray = getErrorArray(variants, maxRange, maxRowLength, maxColumnLength);
10752
- if (errorArray)
10753
- return errorArray;
10754
- const booleanResults = getBooleanResults(variants, maxRowLength, maxColumnLength, !0);
10755
- return this._aggregateResults(maxRange, booleanResults);
10756
- }
10757
- _aggregateResults(maxRange, booleanResults) {
10758
- const maxResults = booleanResults.map((row) => row.map((booleanResult) => {
10759
- const picked = maxRange.pick(booleanResult);
10760
- return picked.getColumnCount() === 0 ? ArrayValueObject.create("0") : picked.max();
10761
- })), arrayValueObjectData = {
10762
- calculateValueList: maxResults,
10763
- rowCount: maxResults.length,
10764
- columnCount: maxResults[0].length,
10765
- unitId: this.unitId || "",
10766
- sheetId: this.subUnitId || "",
10767
- row: this.row,
10768
- column: this.column
10769
- };
10770
- return ArrayValueObject.create(arrayValueObjectData);
13308
+ let accumulatorSum = NumberValueObject.create(0), accumulatorCount = NumberValueObject.create(0);
13309
+ for (let i = 0; i < variants.length; i++) {
13310
+ let variant = variants[i];
13311
+ if ((variant.isString() || variant.isBoolean()) && (variant = variant.convertToNumberObjectValue()), variant.isError())
13312
+ return variant;
13313
+ if (variant.isArray()) {
13314
+ if (accumulatorSum = accumulatorSum.plus(variant.sum()), accumulatorSum.isError())
13315
+ return accumulatorSum;
13316
+ accumulatorCount = accumulatorCount.plus(variant.count());
13317
+ } else variant.isNull() || (accumulatorSum = accumulatorSum.plus(variant), accumulatorCount = accumulatorCount.plus(NumberValueObject.create(1)));
13318
+ }
13319
+ return accumulatorSum.divided(accumulatorCount);
10771
13320
  }
10772
13321
  };
10773
- __name(_Maxifs, "Maxifs");
10774
- let Maxifs = _Maxifs;
13322
+ __name(_Average, "Average");
13323
+ let Average = _Average;
10775
13324
  const _Averagea = class _Averagea extends BaseFunction {
10776
13325
  constructor() {
10777
13326
  super(...arguments);
@@ -10801,41 +13350,6 @@ const _Averagea = class _Averagea extends BaseFunction {
10801
13350
  };
10802
13351
  __name(_Averagea, "Averagea");
10803
13352
  let Averagea = _Averagea;
10804
- const _Minifs = class _Minifs extends BaseFunction {
10805
- constructor() {
10806
- super(...arguments);
10807
- __publicField(this, "minParams", 3);
10808
- __publicField(this, "maxParams", 255);
10809
- }
10810
- calculate(minRange, ...variants) {
10811
- if (minRange.isError())
10812
- return ErrorValueObject.create(ErrorType$1.NA);
10813
- if (!minRange.isArray() || variants.length % 2 !== 0 || variants.some((variant, i) => i % 2 === 0 && !variant.isArray()))
10814
- return ErrorValueObject.create(ErrorType$1.VALUE);
10815
- const { maxRowLength, maxColumnLength } = calculateMaxDimensions(variants), errorArray = getErrorArray(variants, minRange, maxRowLength, maxColumnLength);
10816
- if (errorArray)
10817
- return errorArray;
10818
- const booleanResults = getBooleanResults(variants, maxRowLength, maxColumnLength, !0);
10819
- return this._aggregateResults(minRange, booleanResults);
10820
- }
10821
- _aggregateResults(minRange, booleanResults) {
10822
- const maxResults = booleanResults.map((row) => row.map((booleanResult) => {
10823
- const picked = minRange.pick(booleanResult);
10824
- return picked.getColumnCount() === 0 ? ArrayValueObject.create("0") : picked.min();
10825
- })), arrayValueObjectData = {
10826
- calculateValueList: maxResults,
10827
- rowCount: maxResults.length,
10828
- columnCount: maxResults[0].length,
10829
- unitId: this.unitId || "",
10830
- sheetId: this.subUnitId || "",
10831
- row: this.row,
10832
- column: this.column
10833
- };
10834
- return ArrayValueObject.create(arrayValueObjectData);
10835
- }
10836
- };
10837
- __name(_Minifs, "Minifs");
10838
- let Minifs = _Minifs;
10839
13353
  const _Averageif = class _Averageif extends BaseFunction {
10840
13354
  constructor() {
10841
13355
  super(...arguments);
@@ -10925,6 +13439,56 @@ const _Averageifs = class _Averageifs extends BaseFunction {
10925
13439
  };
10926
13440
  __name(_Averageifs, "Averageifs");
10927
13441
  let Averageifs = _Averageifs;
13442
+ const _Count = class _Count extends BaseFunction {
13443
+ constructor() {
13444
+ super(...arguments);
13445
+ __publicField(this, "minParams", 1);
13446
+ __publicField(this, "maxParams", 255);
13447
+ }
13448
+ calculate(...variants) {
13449
+ let accumulatorAll = NumberValueObject.create(0);
13450
+ for (let i = 0; i < variants.length; i++) {
13451
+ const variant = variants[i];
13452
+ variant.isError() || (variant.isArray() ? accumulatorAll = accumulatorAll.plus(variant.count()) : variant.isString() ? variant.convertToNumberObjectValue().isError() || (accumulatorAll = accumulatorAll.plus(NumberValueObject.create(1))) : variant.isNull() || (accumulatorAll = accumulatorAll.plus(NumberValueObject.create(1))));
13453
+ }
13454
+ return accumulatorAll;
13455
+ }
13456
+ };
13457
+ __name(_Count, "Count");
13458
+ let Count = _Count;
13459
+ const _Counta = class _Counta extends BaseFunction {
13460
+ constructor() {
13461
+ super(...arguments);
13462
+ __publicField(this, "minParams", 1);
13463
+ __publicField(this, "maxParams", 255);
13464
+ }
13465
+ calculate(...variants) {
13466
+ let accumulatorAll = NumberValueObject.create(0);
13467
+ for (let i = 0; i < variants.length; i++) {
13468
+ let variant = variants[i];
13469
+ if (variant.isError()) {
13470
+ accumulatorAll = accumulatorAll.plus(NumberValueObject.create(1));
13471
+ continue;
13472
+ }
13473
+ variant.isArray() ? (variant = variant.countA(), accumulatorAll = accumulatorAll.plus(variant)) : variant.isNull() || (accumulatorAll = accumulatorAll.plus(NumberValueObject.create(1)));
13474
+ }
13475
+ return accumulatorAll;
13476
+ }
13477
+ };
13478
+ __name(_Counta, "Counta");
13479
+ let Counta = _Counta;
13480
+ const _Countblank = class _Countblank extends BaseFunction {
13481
+ constructor() {
13482
+ super(...arguments);
13483
+ __publicField(this, "minParams", 1);
13484
+ __publicField(this, "maxParams", 1);
13485
+ }
13486
+ calculate(variant) {
13487
+ return variant.isError() ? variant : variant.getValue() === "" || variant.isNull() ? NumberValueObject.create(1) : variant.isArray() ? variant.countBlank() : NumberValueObject.create(0);
13488
+ }
13489
+ };
13490
+ __name(_Countblank, "Countblank");
13491
+ let Countblank = _Countblank;
10928
13492
  const _Countif = class _Countif extends BaseFunction {
10929
13493
  constructor() {
10930
13494
  super(...arguments);
@@ -10941,34 +13505,135 @@ const _Countif = class _Countif extends BaseFunction {
10941
13505
  const picked = range.pick(resultArrayObject);
10942
13506
  return this._countA(picked);
10943
13507
  }
10944
- _countA(array) {
10945
- let accumulatorAll = NumberValueObject.create(0);
10946
- return array.iterator((valueObject) => {
10947
- if (valueObject == null)
10948
- return !0;
10949
- accumulatorAll = accumulatorAll.plusBy(1);
10950
- }), accumulatorAll;
13508
+ _countA(array) {
13509
+ let accumulatorAll = NumberValueObject.create(0);
13510
+ return array.iterator((valueObject) => {
13511
+ if (valueObject == null)
13512
+ return !0;
13513
+ accumulatorAll = accumulatorAll.plusBy(1);
13514
+ }), accumulatorAll;
13515
+ }
13516
+ };
13517
+ __name(_Countif, "Countif");
13518
+ let Countif = _Countif;
13519
+ const _Countifs = class _Countifs extends BaseFunction {
13520
+ constructor() {
13521
+ super(...arguments);
13522
+ __publicField(this, "minParams", 2);
13523
+ __publicField(this, "maxParams", 255);
13524
+ }
13525
+ calculate(...variants) {
13526
+ if (variants.length % 2 !== 0 || variants.some((variant, i) => i % 2 === 0 && !variant.isArray()))
13527
+ return ErrorValueObject.create(ErrorType$1.VALUE);
13528
+ const { maxRowLength, maxColumnLength } = calculateMaxDimensions(variants), errorArray = getErrorArray(variants, variants[0], maxRowLength, maxColumnLength);
13529
+ if (errorArray)
13530
+ return errorArray;
13531
+ const booleanResults = getBooleanResults(variants, maxRowLength, maxColumnLength, !0);
13532
+ return this._aggregateResults(booleanResults);
13533
+ }
13534
+ _aggregateResults(booleanResults) {
13535
+ const maxResults = booleanResults.map((row) => row.map((booleanResult) => countTrueValue(booleanResult))), arrayValueObjectData = {
13536
+ calculateValueList: maxResults,
13537
+ rowCount: maxResults.length,
13538
+ columnCount: maxResults[0].length,
13539
+ unitId: this.unitId || "",
13540
+ sheetId: this.subUnitId || "",
13541
+ row: this.row,
13542
+ column: this.column
13543
+ };
13544
+ return ArrayValueObject.create(arrayValueObjectData);
13545
+ }
13546
+ };
13547
+ __name(_Countifs, "Countifs");
13548
+ let Countifs = _Countifs;
13549
+ function countTrueValue(array) {
13550
+ let count = 0;
13551
+ return array.iterator((value) => {
13552
+ value != null && value.isBoolean() && value.getValue() === !0 && count++;
13553
+ }), NumberValueObject.create(count);
13554
+ }
13555
+ __name(countTrueValue, "countTrueValue");
13556
+ const _Max = class _Max extends BaseFunction {
13557
+ constructor() {
13558
+ super(...arguments);
13559
+ __publicField(this, "minParams", 1);
13560
+ __publicField(this, "maxParams", 255);
13561
+ }
13562
+ calculate(...variants) {
13563
+ let accumulatorAll = NumberValueObject.create(Number.NEGATIVE_INFINITY);
13564
+ for (let i = 0; i < variants.length; i++) {
13565
+ let variant = variants[i];
13566
+ if (!variant.isNull()) {
13567
+ if ((variant.isString() || variant.isBoolean()) && (variant = variant.convertToNumberObjectValue()), variant.isArray() && (variant = variant.max()), variant.isError())
13568
+ return variant;
13569
+ accumulatorAll = this._validator(accumulatorAll, variant);
13570
+ }
13571
+ }
13572
+ return accumulatorAll.getValue() === Number.NEGATIVE_INFINITY ? NumberValueObject.create(0) : accumulatorAll;
13573
+ }
13574
+ _validator(accumulatorAll, valueObject) {
13575
+ const validator = accumulatorAll.isLessThan(valueObject);
13576
+ let _accumulatorAll = accumulatorAll;
13577
+ return validator.getValue() && (_accumulatorAll = valueObject), _accumulatorAll;
13578
+ }
13579
+ };
13580
+ __name(_Max, "Max");
13581
+ let Max = _Max;
13582
+ const _Maxa = class _Maxa extends BaseFunction {
13583
+ constructor() {
13584
+ super(...arguments);
13585
+ __publicField(this, "minParams", 1);
13586
+ __publicField(this, "maxParams", 255);
13587
+ }
13588
+ calculate(...variants) {
13589
+ let accumulatorAll = NumberValueObject.create(Number.NEGATIVE_INFINITY);
13590
+ for (let i = 0; i < variants.length; i++) {
13591
+ let variant = variants[i];
13592
+ if (!variant.isNull()) {
13593
+ if ((variant.isString() || variant.isBoolean()) && (variant = variant.convertToNumberObjectValue()), variant.isError())
13594
+ return variant;
13595
+ if (variant.isArray() && variant.iterator((valueObject) => {
13596
+ let _valueObject = valueObject;
13597
+ if ((_valueObject == null || _valueObject.isNull() || _valueObject.isString()) && (_valueObject = NumberValueObject.create(0)), _valueObject.isBoolean() && (_valueObject = _valueObject.convertToNumberObjectValue()), _valueObject.isError())
13598
+ return accumulatorAll = _valueObject, !1;
13599
+ accumulatorAll = this._validator(accumulatorAll, _valueObject);
13600
+ }), accumulatorAll.isError())
13601
+ return accumulatorAll;
13602
+ accumulatorAll = this._validator(accumulatorAll, variant);
13603
+ }
13604
+ }
13605
+ return accumulatorAll.getValue() === Number.NEGATIVE_INFINITY ? NumberValueObject.create(0) : accumulatorAll;
13606
+ }
13607
+ _validator(accumulatorAll, valueObject) {
13608
+ const validator = accumulatorAll.isLessThan(valueObject);
13609
+ let _accumulatorAll = accumulatorAll;
13610
+ return validator.getValue() && (_accumulatorAll = valueObject), _accumulatorAll;
10951
13611
  }
10952
13612
  };
10953
- __name(_Countif, "Countif");
10954
- let Countif = _Countif;
10955
- const _Countifs = class _Countifs extends BaseFunction {
13613
+ __name(_Maxa, "Maxa");
13614
+ let Maxa = _Maxa;
13615
+ const _Maxifs = class _Maxifs extends BaseFunction {
10956
13616
  constructor() {
10957
13617
  super(...arguments);
10958
- __publicField(this, "minParams", 2);
13618
+ __publicField(this, "minParams", 3);
10959
13619
  __publicField(this, "maxParams", 255);
10960
13620
  }
10961
- calculate(...variants) {
10962
- if (variants.length % 2 !== 0 || variants.some((variant, i) => i % 2 === 0 && !variant.isArray()))
13621
+ calculate(maxRange, ...variants) {
13622
+ if (maxRange.isError())
13623
+ return ErrorValueObject.create(ErrorType$1.NA);
13624
+ if (!maxRange.isArray() || variants.length % 2 !== 0 || variants.some((variant, i) => i % 2 === 0 && !variant.isArray()))
10963
13625
  return ErrorValueObject.create(ErrorType$1.VALUE);
10964
- const { maxRowLength, maxColumnLength } = calculateMaxDimensions(variants), errorArray = getErrorArray(variants, variants[0], maxRowLength, maxColumnLength);
13626
+ const { maxRowLength, maxColumnLength } = calculateMaxDimensions(variants), errorArray = getErrorArray(variants, maxRange, maxRowLength, maxColumnLength);
10965
13627
  if (errorArray)
10966
13628
  return errorArray;
10967
13629
  const booleanResults = getBooleanResults(variants, maxRowLength, maxColumnLength, !0);
10968
- return this._aggregateResults(booleanResults);
13630
+ return this._aggregateResults(maxRange, booleanResults);
10969
13631
  }
10970
- _aggregateResults(booleanResults) {
10971
- const maxResults = booleanResults.map((row) => row.map((booleanResult) => countTrueValue(booleanResult))), arrayValueObjectData = {
13632
+ _aggregateResults(maxRange, booleanResults) {
13633
+ const maxResults = booleanResults.map((row) => row.map((booleanResult) => {
13634
+ const picked = maxRange.pick(booleanResult);
13635
+ return picked.getColumnCount() === 0 ? ArrayValueObject.create("0") : picked.max();
13636
+ })), arrayValueObjectData = {
10972
13637
  calculateValueList: maxResults,
10973
13638
  rowCount: maxResults.length,
10974
13639
  columnCount: maxResults[0].length,
@@ -10980,28 +13645,9 @@ const _Countifs = class _Countifs extends BaseFunction {
10980
13645
  return ArrayValueObject.create(arrayValueObjectData);
10981
13646
  }
10982
13647
  };
10983
- __name(_Countifs, "Countifs");
10984
- let Countifs = _Countifs;
10985
- function countTrueValue(array) {
10986
- let count = 0;
10987
- return array.iterator((value) => {
10988
- value != null && value.isBoolean() && value.getValue() === !0 && count++;
10989
- }), NumberValueObject.create(count);
10990
- }
10991
- __name(countTrueValue, "countTrueValue");
10992
- const _Countblank = class _Countblank extends BaseFunction {
10993
- constructor() {
10994
- super(...arguments);
10995
- __publicField(this, "minParams", 1);
10996
- __publicField(this, "maxParams", 1);
10997
- }
10998
- calculate(variant) {
10999
- return variant.isError() ? variant : variant.getValue() === "" || variant.isNull() ? NumberValueObject.create(1) : variant.isArray() ? variant.countBlank() : NumberValueObject.create(0);
11000
- }
11001
- };
11002
- __name(_Countblank, "Countblank");
11003
- let Countblank = _Countblank;
11004
- const _Mina = class _Mina extends BaseFunction {
13648
+ __name(_Maxifs, "Maxifs");
13649
+ let Maxifs = _Maxifs;
13650
+ const _Min = class _Min extends BaseFunction {
11005
13651
  constructor() {
11006
13652
  super(...arguments);
11007
13653
  __publicField(this, "minParams", 1);
@@ -11012,15 +13658,8 @@ const _Mina = class _Mina extends BaseFunction {
11012
13658
  for (let i = 0; i < variants.length; i++) {
11013
13659
  let variant = variants[i];
11014
13660
  if (!variant.isNull()) {
11015
- if ((variant.isString() || variant.isBoolean()) && (variant = variant.convertToNumberObjectValue()), variant.isError())
13661
+ if ((variant.isString() || variant.isBoolean()) && (variant = variant.convertToNumberObjectValue()), variant.isArray() && (variant = variant.min()), variant.isError())
11016
13662
  return variant;
11017
- if (variant.isArray() && variant.iterator((valueObject) => {
11018
- let _valueObject = valueObject;
11019
- if ((_valueObject == null || _valueObject.isNull() || _valueObject.isString()) && (_valueObject = NumberValueObject.create(0)), _valueObject.isBoolean() && (_valueObject = _valueObject.convertToNumberObjectValue()), _valueObject.isError())
11020
- return accumulatorAll = _valueObject, !1;
11021
- accumulatorAll = this._validator(accumulatorAll, _valueObject);
11022
- }), accumulatorAll.isError())
11023
- return accumulatorAll;
11024
13663
  accumulatorAll = this._validator(accumulatorAll, variant);
11025
13664
  }
11026
13665
  }
@@ -11032,16 +13671,16 @@ const _Mina = class _Mina extends BaseFunction {
11032
13671
  return validator.getValue() && (_accumulatorAll = valueObject), _accumulatorAll;
11033
13672
  }
11034
13673
  };
11035
- __name(_Mina, "Mina");
11036
- let Mina = _Mina;
11037
- const _Maxa = class _Maxa extends BaseFunction {
13674
+ __name(_Min, "Min");
13675
+ let Min = _Min;
13676
+ const _Mina = class _Mina extends BaseFunction {
11038
13677
  constructor() {
11039
13678
  super(...arguments);
11040
13679
  __publicField(this, "minParams", 1);
11041
13680
  __publicField(this, "maxParams", 255);
11042
13681
  }
11043
13682
  calculate(...variants) {
11044
- let accumulatorAll = NumberValueObject.create(Number.NEGATIVE_INFINITY);
13683
+ let accumulatorAll = NumberValueObject.create(Number.POSITIVE_INFINITY);
11045
13684
  for (let i = 0; i < variants.length; i++) {
11046
13685
  let variant = variants[i];
11047
13686
  if (!variant.isNull()) {
@@ -11057,67 +13696,103 @@ const _Maxa = class _Maxa extends BaseFunction {
11057
13696
  accumulatorAll = this._validator(accumulatorAll, variant);
11058
13697
  }
11059
13698
  }
11060
- return accumulatorAll.getValue() === Number.NEGATIVE_INFINITY ? NumberValueObject.create(0) : accumulatorAll;
13699
+ return accumulatorAll.getValue() === Number.POSITIVE_INFINITY ? NumberValueObject.create(0) : accumulatorAll;
11061
13700
  }
11062
13701
  _validator(accumulatorAll, valueObject) {
11063
- const validator = accumulatorAll.isLessThan(valueObject);
13702
+ const validator = accumulatorAll.isGreaterThan(valueObject);
11064
13703
  let _accumulatorAll = accumulatorAll;
11065
13704
  return validator.getValue() && (_accumulatorAll = valueObject), _accumulatorAll;
11066
13705
  }
11067
13706
  };
11068
- __name(_Maxa, "Maxa");
11069
- let Maxa = _Maxa;
11070
- const _Avedev = class _Avedev extends BaseFunction {
13707
+ __name(_Mina, "Mina");
13708
+ let Mina = _Mina;
13709
+ const _Minifs = class _Minifs extends BaseFunction {
13710
+ constructor() {
13711
+ super(...arguments);
13712
+ __publicField(this, "minParams", 3);
13713
+ __publicField(this, "maxParams", 255);
13714
+ }
13715
+ calculate(minRange, ...variants) {
13716
+ if (minRange.isError())
13717
+ return ErrorValueObject.create(ErrorType$1.NA);
13718
+ if (!minRange.isArray() || variants.length % 2 !== 0 || variants.some((variant, i) => i % 2 === 0 && !variant.isArray()))
13719
+ return ErrorValueObject.create(ErrorType$1.VALUE);
13720
+ const { maxRowLength, maxColumnLength } = calculateMaxDimensions(variants), errorArray = getErrorArray(variants, minRange, maxRowLength, maxColumnLength);
13721
+ if (errorArray)
13722
+ return errorArray;
13723
+ const booleanResults = getBooleanResults(variants, maxRowLength, maxColumnLength, !0);
13724
+ return this._aggregateResults(minRange, booleanResults);
13725
+ }
13726
+ _aggregateResults(minRange, booleanResults) {
13727
+ const maxResults = booleanResults.map((row) => row.map((booleanResult) => {
13728
+ const picked = minRange.pick(booleanResult);
13729
+ return picked.getColumnCount() === 0 ? ArrayValueObject.create("0") : picked.min();
13730
+ })), arrayValueObjectData = {
13731
+ calculateValueList: maxResults,
13732
+ rowCount: maxResults.length,
13733
+ columnCount: maxResults[0].length,
13734
+ unitId: this.unitId || "",
13735
+ sheetId: this.subUnitId || "",
13736
+ row: this.row,
13737
+ column: this.column
13738
+ };
13739
+ return ArrayValueObject.create(arrayValueObjectData);
13740
+ }
13741
+ };
13742
+ __name(_Minifs, "Minifs");
13743
+ let Minifs = _Minifs;
13744
+ const _Stdeva = class _Stdeva extends BaseFunction {
11071
13745
  constructor() {
11072
13746
  super(...arguments);
11073
13747
  __publicField(this, "minParams", 1);
11074
13748
  __publicField(this, "maxParams", 255);
11075
13749
  }
11076
13750
  calculate(...variants) {
11077
- let accumulatorSum = NumberValueObject.create(0), accumulatorCount = NumberValueObject.create(0);
11078
- for (let i = 0; i < variants.length; i++) {
11079
- let variant = variants[i];
11080
- if (variant.isString() && (variant = variant.convertToNumberObjectValue()), variant.isError())
11081
- return variant;
11082
- if (variant.isArray()) {
11083
- if (variant = filterNumberValueObject(variant), variant.isError())
11084
- return variant;
11085
- if (variants[i] = variant, accumulatorSum = accumulatorSum.plus(variant.sum()), accumulatorSum.isError())
11086
- return accumulatorSum;
11087
- accumulatorCount = accumulatorCount.plus(variant.count());
11088
- } else variant.isNull() || (accumulatorSum = accumulatorSum.plus(variant), accumulatorCount = accumulatorCount.plus(NumberValueObject.create(1)));
11089
- }
11090
- if (accumulatorCount.getValue() === 0)
11091
- return ErrorValueObject.create(ErrorType$1.NUM);
11092
- const average = accumulatorSum.divided(accumulatorCount);
11093
- if (average.isError())
11094
- return average;
11095
- let accumulatorAveDev = NumberValueObject.create(0);
11096
- for (let i = 0; i < variants.length; i++) {
11097
- let variant = variants[i];
11098
- if (variant.isString() && (variant = variant.convertToNumberObjectValue()), variant.isError())
11099
- return variant;
11100
- if (variant.isArray()) {
11101
- if (accumulatorAveDev = accumulatorAveDev.plus(variant.minus(average).abs().sum()), accumulatorAveDev.isError())
11102
- return accumulatorAveDev;
11103
- } else variant.isNull() || (accumulatorAveDev = accumulatorAveDev.plus(variant.minus(average).abs()));
11104
- }
11105
- return accumulatorAveDev.divided(accumulatorCount);
13751
+ const flattenArray = this.flattenArray(variants, !1);
13752
+ return flattenArray.isError() ? flattenArray : flattenArray.std(1);
11106
13753
  }
11107
13754
  };
11108
- __name(_Avedev, "Avedev");
11109
- let Avedev = _Avedev;
11110
- function filterNumberValueObject(array) {
11111
- const newArray = [];
11112
- newArray[0] = [];
11113
- let isError = null;
11114
- return array.iterator((valueObject, _rowIndex, _columnIndex) => {
11115
- if (valueObject != null && valueObject.isError())
11116
- return isError = valueObject, !1;
11117
- valueObject != null && valueObject.isNumber() && newArray[0].push(valueObject);
11118
- }), isError || createNewArray(newArray, 1, newArray[0].length);
11119
- }
11120
- __name(filterNumberValueObject, "filterNumberValueObject");
13755
+ __name(_Stdeva, "Stdeva");
13756
+ let Stdeva = _Stdeva;
13757
+ const _Stdevpa = class _Stdevpa extends BaseFunction {
13758
+ constructor() {
13759
+ super(...arguments);
13760
+ __publicField(this, "minParams", 1);
13761
+ __publicField(this, "maxParams", 255);
13762
+ }
13763
+ calculate(...variants) {
13764
+ const flattenArray = this.flattenArray(variants, !1);
13765
+ return flattenArray.isError() ? flattenArray : flattenArray.std();
13766
+ }
13767
+ };
13768
+ __name(_Stdevpa, "Stdevpa");
13769
+ let Stdevpa = _Stdevpa;
13770
+ const _Vara = class _Vara extends BaseFunction {
13771
+ constructor() {
13772
+ super(...arguments);
13773
+ __publicField(this, "minParams", 1);
13774
+ __publicField(this, "maxParams", 255);
13775
+ }
13776
+ calculate(...variants) {
13777
+ const flattenArray = this.flattenArray(variants, !1);
13778
+ return flattenArray.isError() ? flattenArray : flattenArray.var(1);
13779
+ }
13780
+ };
13781
+ __name(_Vara, "Vara");
13782
+ let Vara = _Vara;
13783
+ const _Varpa = class _Varpa extends BaseFunction {
13784
+ constructor() {
13785
+ super(...arguments);
13786
+ __publicField(this, "minParams", 1);
13787
+ __publicField(this, "maxParams", 255);
13788
+ }
13789
+ calculate(...variants) {
13790
+ const flattenArray = this.flattenArray(variants, !1);
13791
+ return flattenArray.isError() ? flattenArray : flattenArray.var();
13792
+ }
13793
+ };
13794
+ __name(_Varpa, "Varpa");
13795
+ let Varpa = _Varpa;
11121
13796
  const functionStatistical = [
11122
13797
  [Avedev, FUNCTION_NAMES_STATISTICAL.AVEDEV],
11123
13798
  [Average, FUNCTION_NAMES_STATISTICAL.AVERAGE],
@@ -12573,15 +15248,9 @@ let FormulaRuntimeService = (_a4 = class extends Disposable {
12573
15248
  sheetData.setValue(row, column, errorObject), clearArrayUnitData.setValue(row, column, errorObject);
12574
15249
  const unitData2 = this._currentConfigService.getUnitData();
12575
15250
  objectValueRefOrArray.iterator((_, rowIndex, columnIndex) => {
12576
- var _a24, _b, _c, _d, _e;
12577
- const currentRow = rowIndex - startRow + row, currentColumn = columnIndex - startColumn + column;
12578
- if (rowIndex === startRow && columnIndex === startColumn)
12579
- runtimeArrayUnitData.setValue(row, column, errorObject);
12580
- else if (((_c = (_b = (_a24 = unitData2[unitId]) == null ? void 0 : _a24[sheetId]) == null ? void 0 : _b.cellData) == null ? void 0 : _c.getValue(currentRow, currentColumn)) != null) {
12581
- const cell = (_e = (_d = unitData2[unitId]) == null ? void 0 : _d[sheetId]) == null ? void 0 : _e.cellData.getValue(currentRow, currentColumn);
12582
- runtimeArrayUnitData.setValue(currentRow, currentColumn, cell);
12583
- } else
12584
- runtimeArrayUnitData.setValue(currentRow, currentColumn, { v: "" });
15251
+ var _a24, _b;
15252
+ const currentRow = rowIndex - startRow + row, currentColumn = columnIndex - startColumn + column, cell = (_b = (_a24 = unitData2[unitId]) == null ? void 0 : _a24[sheetId]) == null ? void 0 : _b.cellData.getValue(currentRow, currentColumn);
15253
+ rowIndex === startRow && columnIndex === startColumn ? runtimeArrayUnitData.setValue(row, column, errorObject) : cell != null ? (cell.v == null && (cell.v = ""), runtimeArrayUnitData.setValue(currentRow, currentColumn, cell)) : runtimeArrayUnitData.setValue(currentRow, currentColumn, { v: "" });
12585
15254
  });
12586
15255
  } else {
12587
15256
  const spillError = ErrorValueObject.create(ErrorType$1.SPILL);
@@ -12660,12 +15329,15 @@ let FormulaRuntimeService = (_a4 = class extends Disposable {
12660
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(
12661
15330
  r,
12662
15331
  c
12663
- ), 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);
12664
- 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))
12665
15334
  return !0;
12666
15335
  }
12667
15336
  return !1;
12668
15337
  }
15338
+ _getRuntimeFeatureCellValue(row, column, sheetId, unitId) {
15339
+ return getRuntimeFeatureCell(row, column, sheetId, unitId, this._runtimeFeatureCellData);
15340
+ }
12669
15341
  _isInArrayFormulaRange(range, r, c) {
12670
15342
  if (range == null)
12671
15343
  return !1;
@@ -12996,7 +15668,7 @@ const _FunctionNode = class _FunctionNode extends BaseAstNode {
12996
15668
  this._compatibility();
12997
15669
  for (let i = 0; i < childrenCount; i++) {
12998
15670
  const object = children[i].getValue();
12999
- 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));
13000
15672
  }
13001
15673
  const resultVariant = this._calculate(variants);
13002
15674
  let result;
@@ -14439,9 +17111,10 @@ let FormulaDependencyGenerator = (_a14 = class extends Disposable {
14439
17111
  async generate() {
14440
17112
  this._updateRangeFlatten();
14441
17113
  const formulaData = this._currentConfigService.getFormulaData(), otherFormulaData = this._otherFormulaManagerService.getOtherFormulaData(), unitData = this._currentConfigService.getUnitData(), { treeList, dependencyTreeCache } = await this._generateTreeList(formulaData, otherFormulaData, unitData), updateTreeList = this._getUpdateTreeListAndMakeDependency(treeList, dependencyTreeCache);
14442
- this._checkIsCycleDependency(updateTreeList) && this._runtimeService.enableCycleDependency();
14443
- const finalTreeList = this._calculateRunList(updateTreeList);
14444
- return Promise.resolve(finalTreeList);
17114
+ let finalTreeList = this._calculateRunList(updateTreeList);
17115
+ return this._dependencyFeatureCalculation(finalTreeList) && (finalTreeList.forEach((tree) => {
17116
+ tree.resetState();
17117
+ }), finalTreeList = this._calculateRunList(finalTreeList)), this._checkIsCycleDependency(finalTreeList) && this._runtimeService.enableCycleDependency(), Promise.resolve(finalTreeList);
14445
17118
  }
14446
17119
  _isCyclicUtil(node, visited, recursionStack) {
14447
17120
  if (!visited.has(node)) {
@@ -14492,35 +17165,17 @@ let FormulaDependencyGenerator = (_a14 = class extends Disposable {
14492
17165
  this._featureCalculationManagerService.getReferenceExecutorMap().forEach((subUnitMap, _) => {
14493
17166
  subUnitMap.forEach((featureMap2, _2) => {
14494
17167
  featureMap2.forEach((params, featureId) => {
14495
- const { unitId, subUnitId, dependencyRanges, getDirtyData } = params;
14496
- if (this._dependencyManagerService.hasFeatureFormulaDependency(unitId, subUnitId, featureId))
14497
- return this._makePassiveDirtyForFeatureFormulas(this._dependencyManagerService.getFeatureFormulaDependency(unitId, subUnitId, featureId)), !0;
14498
- const FDtree = new FormulaDependencyTree();
14499
- FDtree.unitId = unitId, FDtree.subUnitId = subUnitId, FDtree.getDirtyData = getDirtyData, FDtree.featureId = featureId, FDtree.rangeList = dependencyRanges.map((range) => ({
14500
- gridRange: range,
14501
- token: serializeRangeToRefString({ ...range, sheetName: this._currentConfigService.getSheetName(range.unitId, range.sheetId) })
14502
- })), this._dependencyManagerService.addFeatureFormulaDependency(unitId, subUnitId, featureId, FDtree), this._makePassiveDirtyForFeatureFormulas(FDtree), treeList.push(FDtree);
17168
+ treeList.push(this._getFeatureFormulaTree(featureId, params));
14503
17169
  });
14504
17170
  });
14505
17171
  });
14506
17172
  }
14507
- _makePassiveDirtyForFeatureFormulas(tree) {
14508
- var _a24, _b;
14509
- const featureId = tree.featureId;
14510
- if (featureId == null) {
14511
- tree.isPassive = !0;
14512
- return;
14513
- }
14514
- const featureMap = this._currentConfigService.getDirtyUnitFeatureMap();
14515
- if (featureMap == null) {
14516
- tree.isPassive = !0;
14517
- return;
14518
- }
14519
- if (((_b = (_a24 = featureMap[tree.unitId]) == null ? void 0 : _a24[tree.subUnitId]) == null ? void 0 : _b[featureId]) == null) {
14520
- tree.isPassive = !0;
14521
- return;
14522
- }
14523
- tree.isPassive = !1;
17173
+ _getFeatureFormulaTree(featureId, params) {
17174
+ const { unitId, subUnitId, dependencyRanges, getDirtyData } = params, FDtree = new FormulaDependencyTree();
17175
+ return FDtree.unitId = unitId, FDtree.subUnitId = subUnitId, FDtree.getDirtyData = getDirtyData, FDtree.featureId = featureId, FDtree.rangeList = dependencyRanges.map((range) => ({
17176
+ gridRange: range,
17177
+ token: serializeRangeToRefString({ ...range, sheetName: this._currentConfigService.getSheetName(range.unitId, range.sheetId) })
17178
+ })), this._dependencyManagerService.addFeatureFormulaDependency(unitId, subUnitId, featureId, FDtree), FDtree;
14524
17179
  }
14525
17180
  _registerOtherFormulas(otherFormulaData, otherFormulaDataKeys, treeList) {
14526
17181
  for (const unitId of otherFormulaDataKeys) {
@@ -14669,6 +17324,65 @@ let FormulaDependencyGenerator = (_a14 = class extends Disposable {
14669
17324
  }
14670
17325
  return dependencyTreeCache.dispose(), newTreeList;
14671
17326
  }
17327
+ _dependencyFeatureCalculation(newTreeList) {
17328
+ this._clearFeatureCalculationNode(newTreeList);
17329
+ let hasFeatureCalculation = !1;
17330
+ return this._featureCalculationManagerService.getReferenceExecutorMap().forEach((subUnitMap, _) => {
17331
+ subUnitMap.forEach((featureMap2, _2) => {
17332
+ featureMap2.forEach((params, featureId) => {
17333
+ const { unitId, subUnitId, getDirtyData } = params, dirtyRanges = getDirtyData(this._currentConfigService.getDirtyData(), this._runtimeService.getAllRuntimeData()).dirtyRanges, dirtyRangesToMap = this._convertDirtyRangesToMap(dirtyRanges), intersectTrees = this._intersectFeatureCalculation(dirtyRangesToMap, newTreeList, { unitId, subUnitId, featureId });
17334
+ if (intersectTrees.length > 0) {
17335
+ let featureTree = this._getExistTreeList({ unitId, subUnitId, featureId }, newTreeList);
17336
+ featureTree == null && (featureTree = this._getFeatureFormulaTree(featureId, params), newTreeList.push(featureTree)), featureTree.parents = [], intersectTrees.forEach((tree) => {
17337
+ tree.children.includes(featureTree) || tree.pushChildren(featureTree);
17338
+ }), hasFeatureCalculation = !0;
17339
+ }
17340
+ });
17341
+ });
17342
+ }), hasFeatureCalculation;
17343
+ }
17344
+ _clearFeatureCalculationNode(newTreeList) {
17345
+ const featureMap = this._featureCalculationManagerService.getReferenceExecutorMap();
17346
+ newTreeList.forEach((tree) => {
17347
+ tree.children = tree.children.filter((child) => {
17348
+ var _a24, _b;
17349
+ return child.featureId ? !((_b = (_a24 = featureMap.get(tree.unitId)) == null ? void 0 : _a24.get(tree.subUnitId)) != null && _b.has(child.featureId)) : !0;
17350
+ }), tree.parents = tree.parents.filter((parent) => {
17351
+ var _a24, _b;
17352
+ return parent.featureId ? !((_b = (_a24 = featureMap.get(tree.unitId)) == null ? void 0 : _a24.get(tree.subUnitId)) != null && _b.has(parent.featureId)) : !0;
17353
+ });
17354
+ });
17355
+ }
17356
+ _getExistTreeList(param, treeList) {
17357
+ const { unitId, subUnitId, featureId } = param;
17358
+ for (let i = 0, len = treeList.length; i < len; i++) {
17359
+ const tree = treeList[i];
17360
+ if (tree.unitId === unitId && tree.subUnitId === subUnitId && tree.featureId === featureId)
17361
+ return tree;
17362
+ }
17363
+ }
17364
+ _convertDirtyRangesToMap(dirtyRanges) {
17365
+ const map = /* @__PURE__ */ new Map();
17366
+ for (const unitId in dirtyRanges) {
17367
+ const unitMap = dirtyRanges[unitId], unitRangeMap = /* @__PURE__ */ new Map();
17368
+ for (const subUnitId in unitMap) {
17369
+ const ranges = unitMap[subUnitId];
17370
+ unitRangeMap.set(subUnitId, ranges);
17371
+ }
17372
+ map.set(unitId, unitRangeMap);
17373
+ }
17374
+ return map;
17375
+ }
17376
+ _intersectFeatureCalculation(dirtyRangesToMap, newTreeList, param) {
17377
+ const dependencyTree = [];
17378
+ for (let i = 0, len = newTreeList.length; i < len; i++) {
17379
+ const tree = newTreeList[i];
17380
+ if (tree.unitId === param.unitId && tree.subUnitId === param.subUnitId && tree.featureId === param.featureId)
17381
+ continue;
17382
+ tree.dependencyRange(dirtyRangesToMap, {}) && dependencyTree.push(tree);
17383
+ }
17384
+ return dependencyTree;
17385
+ }
14672
17386
  _includeTreeFeature(tree) {
14673
17387
  var _a24, _b;
14674
17388
  const unitId = tree.unitId, subUnitId = tree.subUnitId, featureId = tree.featureId;
@@ -14870,7 +17584,7 @@ let CalculateFormulaService = (_a15 = class extends Disposable {
14870
17584
  tree.subUnitId,
14871
17585
  tree.unitId
14872
17586
  ), getDirtyData != null && tree.featureId != null) {
14873
- const { runtimeCellData, dirtyRanges } = getDirtyData(tree, this._currentConfigService.getDirtyData(), this._runtimeService.getAllRuntimeData());
17587
+ const { runtimeCellData, dirtyRanges } = getDirtyData(this._currentConfigService.getDirtyData(), this._runtimeService.getAllRuntimeData());
14874
17588
  this._runtimeService.setRuntimeFeatureCellData(tree.featureId, runtimeCellData), this._runtimeService.setRuntimeFeatureRange(tree.featureId, dirtyRanges);
14875
17589
  } else astNode != null && (interpreter.checkAsyncNode(astNode) ? value = await interpreter.executeAsync(astNode) : value = interpreter.execute(astNode), tree.formulaId != null ? this._runtimeService.setRuntimeOtherData(tree.formulaId, value) : this._runtimeService.setRuntimeData(value));
14876
17590
  isArrayFormulaState ? (this._runtimeService.setFormulaExecuteStage(