hyperformula
Version:
HyperFormula is a JavaScript engine for efficient processing of spreadsheet-like data and formulas
40 lines • 715 kB
JavaScript
/*!
* Copyright (c) HANDSONCODE sp. z o. o.
*
* HYPERFORMULA is a software distributed by HANDSONCODE sp. z o. o., a
* Polish corporation based in Gdynia, Poland, at Aleja Zwyciestwa 96-98,
* registered by the District Court in Gdansk under number 538651,
* EU VAT: PL5862294002, share capital: PLN 62,800.00.
*
* This software is dual-licensed, giving you the option to use it under
* either a proprietary license or the GNU General Public License version 3
* (GPLv3). The specific license under which you use the software is
* determined by the license key you apply. Each licensing option comes with
* its own terms and conditions as specified below.
*
* 1. PROPRIETARY LICENSE:
*
* Your use of this software is subject to the terms included in an
* applicable proprietary license agreement between you and HANDSONCODE.
* The proprietary license can be purchased from HANDSONCODE or an
* authorized reseller.
*
* 2. GNU GENERAL PUBLIC LICENSE v3:
*
* This software is also available under the terms of the GNU General
* Public License v3. You are permitted to run, modify, and distribute
* this software under the terms of the GPLv3, as published by the Free
* Software Foundation. The full text of the GPLv3 can be found at
* https://www.gnu.org/licenses/.
*
* UNLESS EXPRESSLY AGREED OTHERWISE, HANDSONCODE PROVIDES THIS SOFTWARE ON
* AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, AND IN NO
* EVENT AND UNDER NO LEGAL THEORY, SHALL HANDSONCODE BE LIABLE TO YOU FOR
* DAMAGES, INCLUDING ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR
* CONSEQUENTIAL DAMAGES OF ANY CHARACTER ARISING FROM USE OR INABILITY TO
* USE THIS SOFTWARE.
*
* Version: 3.1.0
* Release date: 14/10/2025 (built at 14/10/2025 09:42:01)
*/
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("HyperFormula",[],t):"object"==typeof exports?exports.HyperFormula=t():e.HyperFormula=t()}("undefined"!=typeof self?self:this,function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,r){e.exports=r(1)},function(e,t,r){"use strict";t.__esModule=!0,t.default=void 0;var n=r(2);t.ArraySize=n.ArraySize;var o=r(106);t.CellError=o.CellError,t.CellType=o.CellType,t.CellValueDetailedType=o.CellValueDetailedType,t.CellValueType=o.CellValueType,t.ErrorType=o.ErrorType;var s=r(232);t.DetailedCellError=s.DetailedCellError;var i=r(233),a=r(237);t.AlwaysDense=a.AlwaysDense,t.AlwaysSparse=a.AlwaysSparse,t.DenseSparseChooseBasedOnThreshold=a.DenseSparseChooseBasedOnThreshold;var u=r(207);t.ConfigValueTooBigError=u.ConfigValueTooBigError,t.ConfigValueTooSmallError=u.ConfigValueTooSmallError,t.EvaluationSuspendedError=u.EvaluationSuspendedError,t.ExpectedOneOfValuesError=u.ExpectedOneOfValuesError,t.ExpectedValueOfTypeError=u.ExpectedValueOfTypeError,t.FunctionPluginValidationError=u.FunctionPluginValidationError,t.InvalidAddressError=u.InvalidAddressError,t.InvalidArgumentsError=u.InvalidArgumentsError,t.LanguageAlreadyRegisteredError=u.LanguageAlreadyRegisteredError,t.LanguageNotRegisteredError=u.LanguageNotRegisteredError,t.MissingTranslationError=u.MissingTranslationError,t.NamedExpressionDoesNotExistError=u.NamedExpressionDoesNotExistError,t.NamedExpressionNameIsAlreadyTakenError=u.NamedExpressionNameIsAlreadyTakenError,t.NamedExpressionNameIsInvalidError=u.NamedExpressionNameIsInvalidError,t.NoOperationToRedoError=u.NoOperationToRedoError,t.NoOperationToUndoError=u.NoOperationToUndoError,t.NoRelativeAddressesAllowedError=u.NoRelativeAddressesAllowedError,t.NoSheetWithIdError=u.NoSheetWithIdError,t.NoSheetWithNameError=u.NoSheetWithNameError,t.NotAFormulaError=u.NotAFormulaError,t.NothingToPasteError=u.NothingToPasteError,t.ProtectedFunctionTranslationError=u.ProtectedFunctionTranslationError,t.SheetNameAlreadyTakenError=u.SheetNameAlreadyTakenError,t.SheetSizeLimitExceededError=u.SheetSizeLimitExceededError,t.SourceLocationHasArrayError=u.SourceLocationHasArrayError,t.TargetLocationHasArrayError=u.TargetLocationHasArrayError,t.UnableToParseError=u.UnableToParseError;var c=r(260);t.ExportedCellChange=c.ExportedCellChange,t.ExportedNamedExpressionChange=c.ExportedNamedExpressionChange;var l=r(242);t.HyperFormula=l.HyperFormula;var h,d=(h=r(278))&&h.__esModule?h:{default:h},p=r(227);t.FunctionPlugin=p.FunctionPlugin,t.FunctionArgumentType=p.FunctionArgumentType,t.EmptyValue=p.EmptyValue;var m=function(e,t){if("function"==typeof WeakMap)var r=new WeakMap,n=new WeakMap;return function(e,t){if(!t&&e&&e.__esModule)return e;var o,s,i={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return i;if(o=t?n:r){if(o.has(e))return o.get(e);o.set(e,i)}for(const t in e)"default"!==t&&{}.hasOwnProperty.call(e,t)&&((s=(o=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(s.get||s.set)?o(i,t,s):i[t]=e[t]);return i}(e,t)}(r(279)),g=r(199);t.SimpleRangeValue=g.SimpleRangeValue;class f extends l.HyperFormula{}f.HyperFormula=l.HyperFormula,f.ErrorType=o.ErrorType,f.CellError=o.CellError,f.CellType=o.CellType,f.CellValueType=o.CellValueType,f.CellValueDetailedType=o.CellValueDetailedType,f.DetailedCellError=s.DetailedCellError,f.ExportedCellChange=c.ExportedCellChange,f.ExportedNamedExpressionChange=c.ExportedNamedExpressionChange,f.ConfigValueTooBigError=u.ConfigValueTooBigError,f.ConfigValueTooSmallError=u.ConfigValueTooSmallError,f.EvaluationSuspendedError=u.EvaluationSuspendedError,f.ExpectedOneOfValuesError=u.ExpectedOneOfValuesError,f.ExpectedValueOfTypeError=u.ExpectedValueOfTypeError,f.ArraySize=n.ArraySize,f.SimpleRangeValue=g.SimpleRangeValue,f.EmptyValue=p.EmptyValue,f.FunctionPlugin=p.FunctionPlugin,f.FunctionArgumentType=p.FunctionArgumentType,f.FunctionPluginValidationError=u.FunctionPluginValidationError,f.InvalidAddressError=u.InvalidAddressError,f.InvalidArgumentsError=u.InvalidArgumentsError,f.LanguageNotRegisteredError=u.LanguageNotRegisteredError,f.LanguageAlreadyRegisteredError=u.LanguageAlreadyRegisteredError,f.MissingTranslationError=u.MissingTranslationError,f.NamedExpressionDoesNotExistError=u.NamedExpressionDoesNotExistError,f.NamedExpressionNameIsAlreadyTakenError=u.NamedExpressionNameIsAlreadyTakenError,f.NamedExpressionNameIsInvalidError=u.NamedExpressionNameIsInvalidError,f.NoOperationToRedoError=u.NoOperationToRedoError,f.NoOperationToUndoError=u.NoOperationToUndoError,f.NoRelativeAddressesAllowedError=u.NoRelativeAddressesAllowedError,f.NoSheetWithIdError=u.NoSheetWithIdError,f.NoSheetWithNameError=u.NoSheetWithNameError,f.NotAFormulaError=u.NotAFormulaError,f.NothingToPasteError=u.NothingToPasteError,f.ProtectedFunctionTranslationError=u.ProtectedFunctionTranslationError,f.SheetNameAlreadyTakenError=u.SheetNameAlreadyTakenError,f.SheetSizeLimitExceededError=u.SheetSizeLimitExceededError,f.SourceLocationHasArrayError=u.SourceLocationHasArrayError,f.TargetLocationHasArrayError=u.TargetLocationHasArrayError,f.UnableToParseError=u.UnableToParseError;const E=i.Config.defaultConfig.language;l.HyperFormula.registerLanguage(E,d.default),l.HyperFormula.languages[d.default.langCode]=d.default;for(const e of Object.getOwnPropertyNames(m))e.startsWith("_")||l.HyperFormula.registerFunctionPlugin(m[e]);t.default=f},function(e,t,r){"use strict";t.__esModule=!0,t.ArraySizePredictor=t.ArraySize=void 0,r(3),r(73),r(84),r(94);var n=r(105),o=r(226),s=r(227),i=r(136);class a{constructor(e,t,r=!1){this.width=e,this.height=t,this.isRef=r}static error(){return new a(1,1,!0)}static scalar(){return new a(1,1,!1)}isScalar(){return 1===this.width&&1===this.height||this.isRef}}t.ArraySize=a;t.ArraySizePredictor=class{constructor(e,t){this.config=e,this.functionRegistry=t}checkArraySize(e,t){return this.checkArraySizeForAst(e,{formulaAddress:t,arraysFlag:this.config.useArrayArithmetic})}checkArraySizeForAst(e,t){switch(e.type){case i.AstNodeType.FUNCTION_CALL:return this.checkArraySizeForFunction(e,t);case i.AstNodeType.COLUMN_RANGE:case i.AstNodeType.ROW_RANGE:case i.AstNodeType.CELL_RANGE:{const r=n.AbsoluteCellRange.fromAstOrUndef(e,t.formulaAddress);return void 0===r?a.error():new a(r.width(),r.height(),!0)}case i.AstNodeType.ARRAY:{const r=[],n=[];for(const o of e.args){const e=o.map(e=>this.checkArraySizeForAst(e,t)),s=Math.min(...e.map(e=>e.height)),i=e.reduce((e,t)=>e+t.width,0);r.push(s),n.push(i)}const o=r.reduce((e,t)=>e+t,0),s=Math.min(...n);return new a(s,o)}case i.AstNodeType.STRING:case i.AstNodeType.NUMBER:return a.scalar();case i.AstNodeType.CELL_REFERENCE:return new a(1,1,!0);case i.AstNodeType.DIV_OP:case i.AstNodeType.CONCATENATE_OP:case i.AstNodeType.EQUALS_OP:case i.AstNodeType.GREATER_THAN_OP:case i.AstNodeType.GREATER_THAN_OR_EQUAL_OP:case i.AstNodeType.LESS_THAN_OP:case i.AstNodeType.LESS_THAN_OR_EQUAL_OP:case i.AstNodeType.MINUS_OP:case i.AstNodeType.NOT_EQUAL_OP:case i.AstNodeType.PLUS_OP:case i.AstNodeType.POWER_OP:case i.AstNodeType.TIMES_OP:{const r=this.checkArraySizeForAst(e.left,t),n=this.checkArraySizeForAst(e.right,t);return!t.arraysFlag&&(r.height>1||r.width>1||n.height>1||n.width>1)?a.error():(o=r,s=n,new a(Math.max(o.width,s.width),Math.max(o.height,s.height)))}case i.AstNodeType.MINUS_UNARY_OP:case i.AstNodeType.PLUS_UNARY_OP:case i.AstNodeType.PERCENT_OP:{const n=this.checkArraySizeForAst(e.value,t);return!t.arraysFlag&&(n.height>1||n.width>1)?a.error():new a((r=n).width,r.height)}case i.AstNodeType.PARENTHESIS:return this.checkArraySizeForAst(e.expression,t);case i.AstNodeType.EMPTY:default:return a.error()}var r,o,s}checkArraySizeForFunction(e,t){const r=this.functionRegistry.getArraySizeFunction(e.procedureName);if(void 0!==r)return r(e,t);const n=this.functionRegistry.getMetadata(e.procedureName);if(void 0===n||n.expandRanges||!t.arraysFlag||n.vectorizationForbidden||void 0===n.parameters)return new a(1,1);const i=e.args.map(e=>{var r;return this.checkArraySizeForAst(e,new o.InterpreterState(t.formulaAddress,t.arraysFlag||null!==(r=null==n?void 0:n.enableArrayArithmeticForArguments)&&void 0!==r&&r))}),u=[...n.parameters];if(void 0!==n.repeatLastArgs&&u.length<i.length&&(i.length-u.length)%n.repeatLastArgs!==0)return a.error();for(;u.length<i.length;){if(void 0===n.repeatLastArgs)return a.error();u.push(...u.slice(u.length-n.repeatLastArgs))}let c=1,l=1;for(let e=0;e<i.length;e++)u[e].argumentType!==s.FunctionArgumentType.RANGE&&u[e].argumentType!==s.FunctionArgumentType.ANY&&(l=Math.max(l,i[e].height),c=Math.max(c,i[e].width));return new a(c,l)}}},function(e,t,r){"use strict";var n=r(4),o=r(41),s=r(65),i=r(70),a=r(72);n({target:"Array",proto:!0,arity:1,forced:r(9)(function(){return 4294967297!==[].push.call({length:4294967296},1)})||!function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(e){return e instanceof TypeError}}()},{push:function(e){var t=o(this),r=s(t),n=arguments.length;a(r+n);for(var u=0;u<n;u++)t[r]=arguments[u],r++;return i(t,r),r}})},function(e,t,r){"use strict";var n=r(5),o=r(7).f,s=r(45),i=r(49),a=r(39),u=r(57),c=r(69);e.exports=function(e,t){var r,l,h,d,p,m=e.target,g=e.global,f=e.stat;if(r=g?n:f?n[m]||a(m,{}):n[m]&&n[m].prototype)for(l in t){if(d=t[l],h=e.dontCallGetSet?(p=o(r,l))&&p.value:r[l],!c(g?l:m+(f?".":"#")+l,e.forced)&&void 0!==h){if(typeof d==typeof h)continue;u(d,h)}(e.sham||h&&h.sham)&&s(d,"sham",!0),i(r,l,d,e)}}},function(e,t,r){"use strict";(function(t){var r=function(e){return e&&e.Math===Math&&e};e.exports=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof t&&t)||r("object"==typeof this&&this)||function(){return this}()||Function("return this")()}).call(this,r(6))},function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){"use strict";var n=r(8),o=r(10),s=r(12),i=r(13),a=r(14),u=r(20),c=r(40),l=r(43),h=Object.getOwnPropertyDescriptor;t.f=n?h:function(e,t){if(e=a(e),t=u(t),l)try{return h(e,t)}catch(e){}if(c(e,t))return i(!o(s.f,e,t),e[t])}},function(e,t,r){"use strict";var n=r(9);e.exports=!n(function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})},function(e,t,r){"use strict";e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t,r){"use strict";var n=r(11),o=Function.prototype.call;e.exports=n?o.bind(o):function(){return o.apply(o,arguments)}},function(e,t,r){"use strict";var n=r(9);e.exports=!n(function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})},function(e,t,r){"use strict";var n={}.propertyIsEnumerable,o=Object.getOwnPropertyDescriptor,s=o&&!n.call({1:2},1);t.f=s?function(e){var t=o(this,e);return!!t&&t.enumerable}:n},function(e,t,r){"use strict";e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t,r){"use strict";var n=r(15),o=r(18);e.exports=function(e){return n(o(e))}},function(e,t,r){"use strict";var n=r(16),o=r(9),s=r(17),i=Object,a=n("".split);e.exports=o(function(){return!i("z").propertyIsEnumerable(0)})?function(e){return"String"===s(e)?a(e,""):i(e)}:i},function(e,t,r){"use strict";var n=r(11),o=Function.prototype,s=o.call,i=n&&o.bind.bind(s,s);e.exports=n?i:function(e){return function(){return s.apply(e,arguments)}}},function(e,t,r){"use strict";var n=r(16),o=n({}.toString),s=n("".slice);e.exports=function(e){return s(o(e),8,-1)}},function(e,t,r){"use strict";var n=r(19),o=TypeError;e.exports=function(e){if(n(e))throw new o("Can't call method on "+e);return e}},function(e,t,r){"use strict";e.exports=function(e){return null==e}},function(e,t,r){"use strict";var n=r(21),o=r(24);e.exports=function(e){var t=n(e,"string");return o(t)?t:t+""}},function(e,t,r){"use strict";var n=r(10),o=r(22),s=r(24),i=r(31),a=r(34),u=r(35),c=TypeError,l=u("toPrimitive");e.exports=function(e,t){if(!o(e)||s(e))return e;var r,u=i(e,l);if(u){if(void 0===t&&(t="default"),r=n(u,e,t),!o(r)||s(r))return r;throw new c("Can't convert object to primitive value")}return void 0===t&&(t="number"),a(e,t)}},function(e,t,r){"use strict";var n=r(23);e.exports=function(e){return"object"==typeof e?null!==e:n(e)}},function(e,t,r){"use strict";var n="object"==typeof document&&document.all;e.exports=void 0===n&&void 0!==n?function(e){return"function"==typeof e||e===n}:function(e){return"function"==typeof e}},function(e,t,r){"use strict";var n=r(25),o=r(23),s=r(26),i=r(27),a=Object;e.exports=i?function(e){return"symbol"==typeof e}:function(e){var t=n("Symbol");return o(t)&&s(t.prototype,a(e))}},function(e,t,r){"use strict";var n=r(5),o=r(23);e.exports=function(e,t){return arguments.length<2?(r=n[e],o(r)?r:void 0):n[e]&&n[e][t];var r}},function(e,t,r){"use strict";var n=r(16);e.exports=n({}.isPrototypeOf)},function(e,t,r){"use strict";var n=r(28);e.exports=n&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},function(e,t,r){"use strict";var n=r(29),o=r(9),s=r(5).String;e.exports=!!Object.getOwnPropertySymbols&&!o(function(){var e=Symbol("symbol detection");return!s(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&n&&n<41})},function(e,t,r){"use strict";var n,o,s=r(5),i=r(30),a=s.process,u=s.Deno,c=a&&a.versions||u&&u.version,l=c&&c.v8;l&&(o=(n=l.split("."))[0]>0&&n[0]<4?1:+(n[0]+n[1])),!o&&i&&(!(n=i.match(/Edge\/(\d+)/))||n[1]>=74)&&(n=i.match(/Chrome\/(\d+)/))&&(o=+n[1]),e.exports=o},function(e,t,r){"use strict";var n=r(5).navigator,o=n&&n.userAgent;e.exports=o?String(o):""},function(e,t,r){"use strict";var n=r(32),o=r(19);e.exports=function(e,t){var r=e[t];return o(r)?void 0:n(r)}},function(e,t,r){"use strict";var n=r(23),o=r(33),s=TypeError;e.exports=function(e){if(n(e))return e;throw new s(o(e)+" is not a function")}},function(e,t,r){"use strict";var n=String;e.exports=function(e){try{return n(e)}catch(e){return"Object"}}},function(e,t,r){"use strict";var n=r(10),o=r(23),s=r(22),i=TypeError;e.exports=function(e,t){var r,a;if("string"===t&&o(r=e.toString)&&!s(a=n(r,e)))return a;if(o(r=e.valueOf)&&!s(a=n(r,e)))return a;if("string"!==t&&o(r=e.toString)&&!s(a=n(r,e)))return a;throw new i("Can't convert object to primitive value")}},function(e,t,r){"use strict";var n=r(5),o=r(36),s=r(40),i=r(42),a=r(28),u=r(27),c=n.Symbol,l=o("wks"),h=u?c.for||c:c&&c.withoutSetter||i;e.exports=function(e){return s(l,e)||(l[e]=a&&s(c,e)?c[e]:h("Symbol."+e)),l[e]}},function(e,t,r){"use strict";var n=r(37);e.exports=function(e,t){return n[e]||(n[e]=t||{})}},function(e,t,r){"use strict";var n=r(38),o=r(5),s=r(39),i="__core-js_shared__",a=e.exports=o[i]||s(i,{});(a.versions||(a.versions=[])).push({version:"3.45.1",mode:n?"pure":"global",copyright:"© 2014-2025 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.45.1/LICENSE",source:"https://github.com/zloirock/core-js"})},function(e,t,r){"use strict";e.exports=!1},function(e,t,r){"use strict";var n=r(5),o=Object.defineProperty;e.exports=function(e,t){try{o(n,e,{value:t,configurable:!0,writable:!0})}catch(r){n[e]=t}return t}},function(e,t,r){"use strict";var n=r(16),o=r(41),s=n({}.hasOwnProperty);e.exports=Object.hasOwn||function(e,t){return s(o(e),t)}},function(e,t,r){"use strict";var n=r(18),o=Object;e.exports=function(e){return o(n(e))}},function(e,t,r){"use strict";var n=r(16),o=0,s=Math.random(),i=n(1.1.toString);e.exports=function(e){return"Symbol("+(void 0===e?"":e)+")_"+i(++o+s,36)}},function(e,t,r){"use strict";var n=r(8),o=r(9),s=r(44);e.exports=!n&&!o(function(){return 7!==Object.defineProperty(s("div"),"a",{get:function(){return 7}}).a})},function(e,t,r){"use strict";var n=r(5),o=r(22),s=n.document,i=o(s)&&o(s.createElement);e.exports=function(e){return i?s.createElement(e):{}}},function(e,t,r){"use strict";var n=r(8),o=r(46),s=r(13);e.exports=n?function(e,t,r){return o.f(e,t,s(1,r))}:function(e,t,r){return e[t]=r,e}},function(e,t,r){"use strict";var n=r(8),o=r(43),s=r(47),i=r(48),a=r(20),u=TypeError,c=Object.defineProperty,l=Object.getOwnPropertyDescriptor,h="enumerable",d="configurable",p="writable";t.f=n?s?function(e,t,r){if(i(e),t=a(t),i(r),"function"==typeof e&&"prototype"===t&&"value"in r&&p in r&&!r[p]){var n=l(e,t);n&&n[p]&&(e[t]=r.value,r={configurable:d in r?r[d]:n[d],enumerable:h in r?r[h]:n[h],writable:!1})}return c(e,t,r)}:c:function(e,t,r){if(i(e),t=a(t),i(r),o)try{return c(e,t,r)}catch(e){}if("get"in r||"set"in r)throw new u("Accessors not supported");return"value"in r&&(e[t]=r.value),e}},function(e,t,r){"use strict";var n=r(8),o=r(9);e.exports=n&&o(function(){return 42!==Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype})},function(e,t,r){"use strict";var n=r(22),o=String,s=TypeError;e.exports=function(e){if(n(e))return e;throw new s(o(e)+" is not an object")}},function(e,t,r){"use strict";var n=r(23),o=r(46),s=r(50),i=r(39);e.exports=function(e,t,r,a){a||(a={});var u=a.enumerable,c=void 0!==a.name?a.name:t;if(n(r)&&s(r,c,a),a.global)u?e[t]=r:i(t,r);else{try{a.unsafe?e[t]&&(u=!0):delete e[t]}catch(e){}u?e[t]=r:o.f(e,t,{value:r,enumerable:!1,configurable:!a.nonConfigurable,writable:!a.nonWritable})}return e}},function(e,t,r){"use strict";var n=r(16),o=r(9),s=r(23),i=r(40),a=r(8),u=r(51).CONFIGURABLE,c=r(52),l=r(53),h=l.enforce,d=l.get,p=String,m=Object.defineProperty,g=n("".slice),f=n("".replace),E=n([].join),T=a&&!o(function(){return 8!==m(function(){},"length",{value:8}).length}),y=String(String).split("String"),A=e.exports=function(e,t,r){"Symbol("===g(p(t),0,7)&&(t="["+f(p(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),r&&r.getter&&(t="get "+t),r&&r.setter&&(t="set "+t),(!i(e,"name")||u&&e.name!==t)&&(a?m(e,"name",{value:t,configurable:!0}):e.name=t),T&&r&&i(r,"arity")&&e.length!==r.arity&&m(e,"length",{value:r.arity});try{r&&i(r,"constructor")&&r.constructor?a&&m(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var n=h(e);return i(n,"source")||(n.source=E(y,"string"==typeof t?t:"")),e};Function.prototype.toString=A(function(){return s(this)&&d(this).source||c(this)},"toString")},function(e,t,r){"use strict";var n=r(8),o=r(40),s=Function.prototype,i=n&&Object.getOwnPropertyDescriptor,a=o(s,"name"),u=a&&"something"===function(){}.name,c=a&&(!n||n&&i(s,"name").configurable);e.exports={EXISTS:a,PROPER:u,CONFIGURABLE:c}},function(e,t,r){"use strict";var n=r(16),o=r(23),s=r(37),i=n(Function.toString);o(s.inspectSource)||(s.inspectSource=function(e){return i(e)}),e.exports=s.inspectSource},function(e,t,r){"use strict";var n,o,s,i=r(54),a=r(5),u=r(22),c=r(45),l=r(40),h=r(37),d=r(55),p=r(56),m="Object already initialized",g=a.TypeError,f=a.WeakMap;if(i||h.state){var E=h.state||(h.state=new f);E.get=E.get,E.has=E.has,E.set=E.set,n=function(e,t){if(E.has(e))throw new g(m);return t.facade=e,E.set(e,t),t},o=function(e){return E.get(e)||{}},s=function(e){return E.has(e)}}else{var T=d("state");p[T]=!0,n=function(e,t){if(l(e,T))throw new g(m);return t.facade=e,c(e,T,t),t},o=function(e){return l(e,T)?e[T]:{}},s=function(e){return l(e,T)}}e.exports={set:n,get:o,has:s,enforce:function(e){return s(e)?o(e):n(e,{})},getterFor:function(e){return function(t){var r;if(!u(t)||(r=o(t)).type!==e)throw new g("Incompatible receiver, "+e+" required");return r}}}},function(e,t,r){"use strict";var n=r(5),o=r(23),s=n.WeakMap;e.exports=o(s)&&/native code/.test(String(s))},function(e,t,r){"use strict";var n=r(36),o=r(42),s=n("keys");e.exports=function(e){return s[e]||(s[e]=o(e))}},function(e,t,r){"use strict";e.exports={}},function(e,t,r){"use strict";var n=r(40),o=r(58),s=r(7),i=r(46);e.exports=function(e,t,r){for(var a=o(t),u=i.f,c=s.f,l=0;l<a.length;l++){var h=a[l];n(e,h)||r&&n(r,h)||u(e,h,c(t,h))}}},function(e,t,r){"use strict";var n=r(25),o=r(16),s=r(59),i=r(68),a=r(48),u=o([].concat);e.exports=n("Reflect","ownKeys")||function(e){var t=s.f(a(e)),r=i.f;return r?u(t,r(e)):t}},function(e,t,r){"use strict";var n=r(60),o=r(67).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return n(e,o)}},function(e,t,r){"use strict";var n=r(16),o=r(40),s=r(14),i=r(61).indexOf,a=r(56),u=n([].push);e.exports=function(e,t){var r,n=s(e),c=0,l=[];for(r in n)!o(a,r)&&o(n,r)&&u(l,r);for(;t.length>c;)o(n,r=t[c++])&&(~i(l,r)||u(l,r));return l}},function(e,t,r){"use strict";var n=r(14),o=r(62),s=r(65),i=function(e){return function(t,r,i){var a=n(t),u=s(a);if(0===u)return!e&&-1;var c,l=o(i,u);if(e&&r!=r){for(;u>l;)if((c=a[l++])!=c)return!0}else for(;u>l;l++)if((e||l in a)&&a[l]===r)return e||l||0;return!e&&-1}};e.exports={includes:i(!0),indexOf:i(!1)}},function(e,t,r){"use strict";var n=r(63),o=Math.max,s=Math.min;e.exports=function(e,t){var r=n(e);return r<0?o(r+t,0):s(r,t)}},function(e,t,r){"use strict";var n=r(64);e.exports=function(e){var t=+e;return t!=t||0===t?0:n(t)}},function(e,t,r){"use strict";var n=Math.ceil,o=Math.floor;e.exports=Math.trunc||function(e){var t=+e;return(t>0?o:n)(t)}},function(e,t,r){"use strict";var n=r(66);e.exports=function(e){return n(e.length)}},function(e,t,r){"use strict";var n=r(63),o=Math.min;e.exports=function(e){var t=n(e);return t>0?o(t,9007199254740991):0}},function(e,t,r){"use strict";e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},function(e,t,r){"use strict";t.f=Object.getOwnPropertySymbols},function(e,t,r){"use strict";var n=r(9),o=r(23),s=/#|\.prototype\./,i=function(e,t){var r=u[a(e)];return r===l||r!==c&&(o(t)?n(t):!!t)},a=i.normalize=function(e){return String(e).replace(s,".").toLowerCase()},u=i.data={},c=i.NATIVE="N",l=i.POLYFILL="P";e.exports=i},function(e,t,r){"use strict";var n=r(8),o=r(71),s=TypeError,i=Object.getOwnPropertyDescriptor,a=n&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(e){return e instanceof TypeError}}();e.exports=a?function(e,t){if(o(e)&&!i(e,"length").writable)throw new s("Cannot set read only .length");return e.length=t}:function(e,t){return e.length=t}},function(e,t,r){"use strict";var n=r(17);e.exports=Array.isArray||function(e){return"Array"===n(e)}},function(e,t,r){"use strict";var n=TypeError;e.exports=function(e){if(e>9007199254740991)throw n("Maximum allowed index exceeded");return e}},function(e,t,r){"use strict";var n=r(4),o=r(5),s=r(74),i=r(48),a=r(23),u=r(75),c=r(77),l=r(78),h=r(9),d=r(40),p=r(35),m=r(79).IteratorPrototype,g=r(8),f=r(38),E="constructor",T="Iterator",y=p("toStringTag"),A=TypeError,R=o[T],N=f||!a(R)||R.prototype!==m||!h(function(){R({})}),S=function(){if(s(this,m),u(this)===m)throw new A("Abstract class Iterator not directly constructable")},C=function(e,t){g?c(m,e,{configurable:!0,get:function(){return t},set:function(t){if(i(this),this===m)throw new A("You can't redefine this property");d(this,e)?this[e]=t:l(this,e,t)}}):m[e]=t};d(m,y)||C(y,T),!N&&d(m,E)&&m[E]!==Object||C(E,S),S.prototype=m,n({global:!0,constructor:!0,forced:N},{Iterator:S})},function(e,t,r){"use strict";var n=r(26),o=TypeError;e.exports=function(e,t){if(n(t,e))return e;throw new o("Incorrect invocation")}},function(e,t,r){"use strict";var n=r(40),o=r(23),s=r(41),i=r(55),a=r(76),u=i("IE_PROTO"),c=Object,l=c.prototype;e.exports=a?c.getPrototypeOf:function(e){var t=s(e);if(n(t,u))return t[u];var r=t.constructor;return o(r)&&t instanceof r?r.prototype:t instanceof c?l:null}},function(e,t,r){"use strict";var n=r(9);e.exports=!n(function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})},function(e,t,r){"use strict";var n=r(50),o=r(46);e.exports=function(e,t,r){return r.get&&n(r.get,t,{getter:!0}),r.set&&n(r.set,t,{setter:!0}),o.f(e,t,r)}},function(e,t,r){"use strict";var n=r(8),o=r(46),s=r(13);e.exports=function(e,t,r){n?o.f(e,t,s(0,r)):e[t]=r}},function(e,t,r){"use strict";var n,o,s,i=r(9),a=r(23),u=r(22),c=r(80),l=r(75),h=r(49),d=r(35),p=r(38),m=d("iterator"),g=!1;[].keys&&("next"in(s=[].keys())?(o=l(l(s)))!==Object.prototype&&(n=o):g=!0),!u(n)||i(function(){var e={};return n[m].call(e)!==e})?n={}:p&&(n=c(n)),a(n[m])||h(n,m,function(){return this}),e.exports={IteratorPrototype:n,BUGGY_SAFARI_ITERATORS:g}},function(e,t,r){"use strict";var n,o=r(48),s=r(81),i=r(67),a=r(56),u=r(83),c=r(44),l=r(55),h="prototype",d="script",p=l("IE_PROTO"),m=function(){},g=function(e){return"<"+d+">"+e+"</"+d+">"},f=function(e){e.write(g("")),e.close();var t=e.parentWindow.Object;return e=null,t},E=function(){try{n=new ActiveXObject("htmlfile")}catch(e){}var e,t,r;E="undefined"!=typeof document?document.domain&&n?f(n):(t=c("iframe"),r="java"+d+":",t.style.display="none",u.appendChild(t),t.src=String(r),(e=t.contentWindow.document).open(),e.write(g("document.F=Object")),e.close(),e.F):f(n);for(var o=i.length;o--;)delete E[h][i[o]];return E()};a[p]=!0,e.exports=Object.create||function(e,t){var r;return null!==e?(m[h]=o(e),r=new m,m[h]=null,r[p]=e):r=E(),void 0===t?r:s.f(r,t)}},function(e,t,r){"use strict";var n=r(8),o=r(47),s=r(46),i=r(48),a=r(14),u=r(82);t.f=n&&!o?Object.defineProperties:function(e,t){i(e);for(var r,n=a(t),o=u(t),c=o.length,l=0;c>l;)s.f(e,r=o[l++],n[r]);return e}},function(e,t,r){"use strict";var n=r(60),o=r(67);e.exports=Object.keys||function(e){return n(e,o)}},function(e,t,r){"use strict";var n=r(25);e.exports=n("document","documentElement")},function(e,t,r){"use strict";var n=r(4),o=r(10),s=r(32),i=r(48),a=r(85),u=r(86),c=r(91),l=r(89),h=r(92),d=r(93),p=r(38),m=!p&&!h("map",function(){}),g=!p&&!m&&d("map",TypeError),f=p||m||g,E=u(function(){var e=this.iterator,t=i(o(this.next,e));if(!(this.done=!!t.done))return c(e,this.mapper,[t.value,this.counter++],!0)});n({target:"Iterator",proto:!0,real:!0,forced:f},{map:function(e){i(this);try{s(e)}catch(e){l(this,"throw",e)}return g?o(g,this,e):new E(a(this),{mapper:e})}})},function(e,t,r){"use strict";e.exports=function(e){return{iterator:e,next:e.next,done:!1}}},function(e,t,r){"use strict";var n=r(10),o=r(80),s=r(45),i=r(87),a=r(35),u=r(53),c=r(31),l=r(79).IteratorPrototype,h=r(88),d=r(89),p=r(90),m=a("toStringTag"),g="IteratorHelper",f="WrapForValidIterator",E="normal",T="throw",y=u.set,A=function(e){var t=u.getterFor(e?f:g);return i(o(l),{next:function(){var r=t(this);if(e)return r.nextHandler();if(r.done)return h(void 0,!0);try{var n=r.nextHandler();return r.returnHandlerResult?n:h(n,r.done)}catch(e){throw r.done=!0,e}},return:function(){var r=t(this),o=r.iterator;if(r.done=!0,e){var s=c(o,"return");return s?n(s,o):h(void 0,!0)}if(r.inner)try{d(r.inner.iterator,E)}catch(e){return d(o,T,e)}if(r.openIters)try{p(r.openIters,E)}catch(e){return d(o,T,e)}return o&&d(o,E),h(void 0,!0)}})},R=A(!0),N=A(!1);s(N,m,"Iterator Helper"),e.exports=function(e,t,r){var n=function(n,o){o?(o.iterator=n.iterator,o.next=n.next):o=n,o.type=t?f:g,o.returnHandlerResult=!!r,o.nextHandler=e,o.counter=0,o.done=!1,y(this,o)};return n.prototype=t?R:N,n}},function(e,t,r){"use strict";var n=r(49);e.exports=function(e,t,r){for(var o in t)n(e,o,t[o],r);return e}},function(e,t,r){"use strict";e.exports=function(e,t){return{value:e,done:t}}},function(e,t,r){"use strict";var n=r(10),o=r(48),s=r(31);e.exports=function(e,t,r){var i,a;o(e);try{if(!(i=s(e,"return"))){if("throw"===t)throw r;return r}i=n(i,e)}catch(e){a=!0,i=e}if("throw"===t)throw r;if(a)throw i;return o(i),r}},function(e,t,r){"use strict";var n=r(89);e.exports=function(e,t,r){for(var o=e.length-1;o>=0;o--)if(void 0!==e[o])try{r=n(e[o].iterator,t,r)}catch(e){t="throw",r=e}if("throw"===t)throw r;return r}},function(e,t,r){"use strict";var n=r(48),o=r(89);e.exports=function(e,t,r,s){try{return s?t(n(r)[0],r[1]):t(r)}catch(t){o(e,"throw",t)}}},function(e,t,r){"use strict";e.exports=function(e,t){var r="function"==typeof Iterator&&Iterator.prototype[e];if(r)try{r.call({next:null},t).next()}catch(e){return!0}}},function(e,t,r){"use strict";var n=r(5);e.exports=function(e,t){var r=n.Iterator,o=r&&r.prototype,s=o&&o[e],i=!1;if(s)try{s.call({next:function(){return{done:!0}},return:function(){i=!0}},-1)}catch(e){e instanceof t||(i=!1)}if(!i)return s}},function(e,t,r){"use strict";var n=r(4),o=r(95),s=r(32),i=r(48),a=r(85),u=r(89),c=r(93),l=r(104),h=r(9),d=TypeError,p=h(function(){[].keys().reduce(function(){},void 0)}),m=!p&&c("reduce",d);n({target:"Iterator",proto:!0,real:!0,forced:p||m},{reduce:function(e){i(this);try{s(e)}catch(e){u(this,"throw",e)}var t=arguments.length<2,r=t?void 0:arguments[1];if(m)return l(m,this,t?[e]:[e,r]);var n=a(this),c=0;if(o(n,function(n){t?(t=!1,r=n):r=e(r,n,c),c++},{IS_RECORD:!0}),t)throw new d("Reduce of empty iterator with no initial value");return r}})},function(e,t,r){"use strict";var n=r(96),o=r(10),s=r(48),i=r(33),a=r(98),u=r(65),c=r(26),l=r(100),h=r(101),d=r(89),p=TypeError,m=function(e,t){this.stopped=e,this.result=t},g=m.prototype;e.exports=function(e,t,r){var f,E,T,y,A,R,N,S=r&&r.that,C=!(!r||!r.AS_ENTRIES),v=!(!r||!r.IS_RECORD),O=!(!r||!r.IS_ITERATOR),I=!(!r||!r.INTERRUPTED),M=n(t,S),w=function(e){return f&&d(f,"normal"),new m(!0,e)},F=function(e){return C?(s(e),I?M(e[0],e[1],w):M(e[0],e[1])):I?M(e,w):M(e)};if(v)f=e.iterator;else if(O)f=e;else{if(!(E=h(e)))throw new p(i(e)+" is not iterable");if(a(E)){for(T=0,y=u(e);y>T;T++)if((A=F(e[T]))&&c(g,A))return A;return new m(!1)}f=l(e,E)}for(R=v?e.next:f.next;!(N=o(R,f)).done;){try{A=F(N.value)}catch(e){d(f,"throw",e)}if("object"==typeof A&&A&&c(g,A))return A}return new m(!1)}},function(e,t,r){"use strict";var n=r(97),o=r(32),s=r(11),i=n(n.bind);e.exports=function(e,t){return o(e),void 0===t?e:s?i(e,t):function(){return e.apply(t,arguments)}}},function(e,t,r){"use strict";var n=r(17),o=r(16);e.exports=function(e){if("Function"===n(e))return o(e)}},function(e,t,r){"use strict";var n=r(35),o=r(99),s=n("iterator"),i=Array.prototype;e.exports=function(e){return void 0!==e&&(o.Array===e||i[s]===e)}},function(e,t,r){"use strict";e.exports={}},function(e,t,r){"use strict";var n=r(10),o=r(32),s=r(48),i=r(33),a=r(101),u=TypeError;e.exports=function(e,t){var r=arguments.length<2?a(e):t;if(o(r))return s(n(r,e));throw new u(i(e)+" is not iterable")}},function(e,t,r){"use strict";var n=r(102),o=r(31),s=r(19),i=r(99),a=r(35)("iterator");e.exports=function(e){if(!s(e))return o(e,a)||o(e,"@@iterator")||i[n(e)]}},function(e,t,r){"use strict";var n=r(103),o=r(23),s=r(17),i=r(35)("toStringTag"),a=Object,u="Arguments"===s(function(){return arguments}());e.exports=n?s:function(e){var t,r,n;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(e){}}(t=a(e),i))?r:u?s(t):"Object"===(n=s(t))&&o(t.callee)?"Arguments":n}},function(e,t,r){"use strict";var n={};n[r(35)("toStringTag")]="z",e.exports="[object z]"===String(n)},function(e,t,r){"use strict";var n=r(11),o=Function.prototype,s=o.apply,i=o.call;e.exports="object"==typeof Reflect&&Reflect.apply||(n?i.bind(s):function(){return i.apply(s,arguments)})},function(e,t,r){"use strict";t.__esModule=!0,t.WRONG_RANGE_SIZE=t.AbsoluteRowRange=t.AbsoluteColumnRange=t.AbsoluteCellRange=void 0,t.isSimpleCellRange=function(e){if(!e||"object"!=typeof e&&"function"!=typeof e)return!1;{const t=e;return"start"in t&&(0,n.isSimpleCellAddress)(t.start)&&"end"in t&&(0,n.isSimpleCellAddress)(t.end)}},t.simpleCellRange=void 0,r(3);var n=r(106),o=r(207),s=r(136),i=r(201);const a=t.WRONG_RANGE_SIZE="AbsoluteCellRange: Wrong range size";t.simpleCellRange=(e,t)=>({start:e,end:t});class u{constructor(e,t){if(e.sheet!==t.sheet)throw new o.SheetsNotEqual(e.sheet,t.sheet);this.start=(0,n.simpleCellAddress)(e.sheet,e.col,e.row),this.end=(0,n.simpleCellAddress)(t.sheet,t.col,t.row)}get sheet(){return this.start.sheet}static fromSimpleCellAddresses(e,t){if(e.sheet!==t.sheet)throw new o.SheetsNotEqual(e.sheet,t.sheet);const r=t.col-e.col,n=t.row-e.row;return Number.isFinite(n)&&Number.isFinite(r)?new u(e,t):Number.isFinite(n)?new l(e.sheet,e.row,t.row):new c(e.sheet,e.col,t.col)}static fromAst(e,t){return e.type===s.AstNodeType.CELL_RANGE?u.fromCellRange(e,t):e.type===s.AstNodeType.COLUMN_RANGE?c.fromColumnRange(e,t):l.fromRowRangeAst(e,t)}static fromAstOrUndef(e,t){try{return u.fromAst(e,t)}catch(e){return}}static fromCellRange(e,t){return new u(e.start.toSimpleCellAddress(t),e.end.toSimpleCellAddress(t))}static spanFrom(e,t,r){const n=u.spanFromOrUndef(e,t,r);if(void 0===n)throw new Error(a);return n}static spanFromOrUndef(e,t,r){if(!Number.isFinite(t)&&Number.isFinite(r)){if(0!==e.col)return;return new l(e.sheet,e.row,e.row+r-1)}if(!Number.isFinite(r)&&Number.isFinite(t)){if(0!==e.row)return;return new c(e.sheet,e.col,e.col+t-1)}if(Number.isFinite(r)&&Number.isFinite(t))return new u(e,(0,n.simpleCellAddress)(e.sheet,e.col+t-1,e.row+r-1))}static fromCoordinates(e,t,r,o,s){return new u((0,n.simpleCellAddress)(e,t,r),(0,n.simpleCellAddress)(e,o,s))}isFinite(){return Number.isFinite(this.size())}doesOverlap(e){return this.start.sheet==e.start.sheet&&(!(this.end.row<e.start.row||this.start.row>e.end.row)&&!(this.end.col<e.start.col||this.start.col>e.end.col))}addressInRange(e){return this.sheet===e.sheet&&(this.start.row<=e.row&&this.end.row>=e.row&&this.start.col<=e.col&&this.end.col>=e.col)}columnInRange(e){return this.sheet===e.sheet&&(this.start.col<=e.col&&this.end.col>=e.col)}rowInRange(e){return this.sheet===e.sheet&&(this.start.row<=e.row&&this.end.row>=e.row)}containsRange(e){return this.addressInRange(e.start)&&this.addressInRange(e.end)}intersectionWith(e){if(this.sheet!==e.start.sheet)return;const t=Math.max(this.start.row,e.start.row),r=Math.min(this.end.row,e.end.row),o=Math.max(this.start.col,e.start.col),s=Math.min(this.end.col,e.end.col);return t>r||o>s?void 0:new u((0,n.simpleCellAddress)(this.sheet,o,t),(0,n.simpleCellAddress)(this.sheet,s,r))}includesRow(e){return this.start.row<e&&this.end.row>=e}includesColumn(e){return this.start.col<e&&this.end.col>=e}shiftByRows(e){this.start.row+=e,this.end.row+=e}expandByRows(e){this.end.row+=e}shiftByColumns(e){this.start.col+=e,this.end.col+=e}shifted(e,t){return u.spanFrom((0,n.simpleCellAddress)(this.sheet,this.start.col+e,this.start.row+t),this.width(),this.height())}expandByColumns(e){this.end.col+=e}moveToSheet(e){this.start.sheet=e,this.end.sheet=e}removeSpan(e){e instanceof i.RowsSpan?this.removeRows(e.start,e.end):this.removeColumns(e.start,e.end)}shouldBeRemoved(){return this.width()<=0||this.height()<=0}rangeWithSameWidth(e,t){return u.spanFrom((0,n.simpleCellAddress)(this.sheet,this.start.col,e),this.width(),t)}rangeWithSameHeight(e,t){return u.spanFrom((0,n.simpleCellAddress)(this.sheet,e,this.start.row),t,this.height())}toString(){return`${this.start.sheet},${this.start.col},${this.start.row},${this.end.col},${this.end.row}`}width(){return this.end.col-this.start.col+1}height(){return this.end.row-this.start.row+1}size(){return this.height()*this.width()}arrayOfAddressesInRange(){const e=[];for(let t=0;t<this.height();++t){e[t]=[];for(let r=0;r<this.width();++r){const o=(0,n.simpleCellAddress)(this.sheet,this.start.col+r,this.start.row+t);e[t].push(o)}}return e}withStart(e){return new u(e,this.end)}sameDimensionsAs(e){return this.width()===e.width()&&this.height()===e.height()}sameAs(e){return(0,n.equalSimpleCellAddress)(this.start,e.start)&&(0,n.equalSimpleCellAddress)(this.end,e.end)}addressesArrayMap(e,t){const r=[];let o=this.start.row;for(;o<=this.effectiveEndRow(e);){let s=this.start.col;const i=[];for(;s<=this.effectiveEndColumn(e);)i.push(t((0,n.simpleCellAddress)(this.start.sheet,s,o))),s++;r.push(i),o++}return r}addresses(e){const t=[];let r=this.start.row;const o=this.effectiveEndRow(e),s=this.effectiveEndColumn(e);for(;r<=o;){let e=this.start.col;for(;e<=s;)t.push((0,n.simpleCellAddress)(this.start.sheet,e,r)),e++;r++}return t}*addressesWithDirection(e,t,r){if(e>0)if(t>0){let e=this.effectiveEndRow(r);for(;e>=this.start.row;){let t=this.effectiveEndColumn(r);for(;t>=this.start.col;)yield(0,n.simpleCellAddress)(this.start.sheet,t,e),t-=1;e-=1}}else{let e=this.start.row;for(;e<=this.effectiveEndRow(r);){let t=this.effectiveEndColumn(r);for(;t>=this.start.col;)yield(0,n.simpleCellAddress)(this.start.sheet,t,e),t-=1;e+=1}}else if(t>0){let e=this.effectiveEndRow(r);for(;e>=this.start.row;){let t=this.start.col;for(;t<=this.effectiveEndColumn(r);)yield(0,n.simpleCellAddress)(this.start.sheet,t,e),t+=1;e-=1}}else{let e=this.start.row;for(;e<=this.effectiveEndRow(r);){let t=this.start.col;for(;t<=this.effectiveEndColumn(r);)yield(0,n.simpleCellAddress)(this.start.sheet,t,e),t+=1;e+=1}}}getAddress(e,t){if(e<0||t<0||t>this.height()-1||e>this.width()-1)throw Error("Index out of bound");return(0,n.simpleCellAddress)(this.start.sheet,this.start.col+e,this.start.row+t)}exceedsSheetSizeLimits(e,t){return this.end.col>=e||this.end.row>=t}effectiveEndColumn(e){return this.end.col}effectiveEndRow(e){return this.end.row}effectiveWidth(e){return this.width()}effectiveHeight(e){return this.height()}removeRows(e,t){if(!(e>this.end.row)){if(t<this.start.row){const r=t-e+1;return this.shiftByRows(-r)}e<=this.start.row&&(this.start.row=e),this.end.row-=Math.min(t,this.end.row)-e+1}}removeColumns(e,t){if(!(e>this.end.col)){if(t<this.start.col){const r=t-e+1;return this.shiftByColumns(-r)}e<=this.start.col&&(this.start.col=e),this.end.col-=Math.min(t,this.end.col)-e+1}}}t.AbsoluteCellRange=u;class c extends u{constructor(e,t,r){super((0,n.simpleCellAddress)(e,t,0),(0,n.simpleCellAddress)(e,r,Number.POSITIVE_INFINITY))}static fromColumnRange(e,t){const r=e.start.toSimpleColumnAddress(t),n=e.end.toSimpleColumnAddress(t);if(r.sheet!==n.sheet)throw new o.SheetsNotEqual(r.sheet,n.sheet);return new c(r.sheet,r.col,n.col)}shouldBeRemoved(){return this.width()<=0}shiftByRows(e){}expandByRows(e){}shifted(e,t){return new c(this.sheet,this.start.col+e,this.end.col+e)}rangeWithSameHeight(e,t){return new c(this.sheet,e,e+t-1)}exceedsSheetSizeLimits(e,t){return this.end.col>=e}effectiveEndRow(e){return this.effectiveHeight(e)-1}effectiveHeight(e){return e.getSheetHeight(this.sheet)}removeRows(e,t){}}t.AbsoluteColumnRange=c;class l extends u{constructor(e,t,r){super((0,n.simpleCellAddress)(e,0,t),(0,n.simpleCellAddress)(e,Number.POSITIVE_INFINITY,r))}static fromRowRangeAst(e,t){const r=e.start.toSimpleRowAddress(t),n=e.end.toSimpleRowAddress(t);if(r.sheet!==n.sheet)throw new o.SheetsNotEqual(r.sheet,n.sheet);return new l(r.sheet,r.row,n.row)}shouldBeRemoved(){return this.height()<=0}shiftByColumns(e){}expandByColumns(e){}shifted(e,t){return new l(this.sheet,this.start.row+t,this.end.row+t)}rangeWithSameWidth(e,t){return new l(this.sheet,e,e+t-1)}exceedsSheetSizeLimits(e,t){return this.end.row>=t}effectiveEndColumn(e){return this.effectiveWidth(e)-1}effectiveWidth(e){return e.getSheetWidth(this.sheet)}removeColumns(e,t){}}t.AbsoluteRowRange=l},function(e,t,r){"use strict";t.__esModule=!0,t.invalidSimpleRowAddress=t.invalidSimpleColumnAddress=t.invalidSimpleCellAddress=t.getCellValueType=t.getCellValueFormat=t.getCellValueDetailedType=t.getCellType=t.equalSimpleCellAddress=t.addressKey=t.absoluteSheetReference=t.ErrorType=t.CellValueTypeOrd=t.CellValueType=t.CellValueNoNumber=t.CellValueJustNumber=t.CellValueDetailedType=t.CellType=t.CellError=void 0,t.isSimpleCellAddress=function(e){var t,r,n;return e&&("object"==typeof e||"function"==typeof e)&&"number"==typeof(null===(t=e)||void 0===t?void 0:t.sheet)&&"number"==typeof(null===(r=e)||void 0===r?void 0:r.col)&&"number"==typeof(null===(n=e)||void 0===n?void 0:n.row)},t.simpleRowAddress=t.simpleColumnAddress=t.simpleCellAddress=t.movedSimpleCellAddress=void 0;var n,o,s=r(107),i=r(191),a=r(200),u=r(199);!function(e){e.DIV_BY_ZERO="DIV_BY_ZERO",e.NAME="NAME",e.VALUE="VALUE",e.NUM="NUM",e.NA="NA",e.CYCLE="CYCLE",e.REF="REF",e.SPILL="SPILL",e.LIC="LIC",e.ERROR="ERROR"}(n||(t.ErrorType=n={})),function(e){e.FORMULA="FORMULA",e.VALUE="VALUE",e.ARRAY="ARRAY",e.EMPTY="EMPTY",e.ARRAYFORMULA="ARRAYFORMULA"}(o||(t.CellType=o={}));var c,l;t.getCellType=(e,t)=>e instanceof s.ArrayVertex?e.isLeftCorner(t)?o.ARRAYFORMULA:o.ARRAY:e instanceof s.FormulaCellVertex||e instanceof s.ParsingErrorVertex?o.FORMULA:e instanceof s.ValueCellVertex?o.VALUE:o.EMPTY,function(e){e.EMPTY="EMPTY",e.NUMBER="NUMBER",e.STRING="STRING",e.BOOLEAN="BOOLEAN",e.ERROR="ERROR"}(c||(t.CellValueNoNumber=c={})),function(e){e.NUMBER="NUMBER"}(l||(t.CellValueJustNumber=l={}));const h=t.CellValueType=Object.assign(Object.assign({},c),l);t.CellValueDetailedType=Object.assign(Object.assign({},c),a.NumberType);t.CellValueTypeOrd=e=>{switch(e){case h.EMPTY:return 0;case h.NUMBER:return 1;case h.STRING:return 2;case h.BOOLEAN:return 3;case h.ERROR:return 4}throw new Error("Cell value not computed")};const d=e=>{if(e===a.EmptyValue)return h.EMPTY;if(e instanceof p||e instanceof u.SimpleRangeValue)return h.ERROR;if("string"==typeof e)return h.STRING;if((0,a.isExtendedNumber)(e))return h.NUMBER;if("boolean"==typeof e)return h.BOOLEAN;throw new Error("Cell value not computed")};t.getCellValueType=d;t.getCellValueDetailedType=e=>(0,a.isExtendedNumber)(e)?(0,a.getTypeOfExtendedNumber)(e):d(e);t.getCellValueFormat=e=>(0,a.isExtendedNumber)(e)?(0,a.getFormatOfExtendedNumber)(e):void 0;class p{constructor(e,t,r){this.type=e,this.message=t,this.root=r}static parsingError(e){return new p(n.ERROR,`${i.ErrorMessage.ParseError}${e?" "+e:""}`)}attachRootVertex(e){return void 0===this.root?new p(this.type,this.message,e):this}}t.CellError=p;t.simpleRowAddress=(e,t)=>({sheet:e,row:t});t.invalidSimpleRowAddress=e=>e.row<0;t.simpleColumnAddress=(e,t)=>({sheet:e,col:t});t.invalidSimpleColumnAddress=e=>e.col<0;const m=(e,t,r)=>({sheet:e,col:t,row:r});t.simpleCellAddress=m;t.invalidSimpleCellAddress=e=>e.col<0||e.row<0;t.movedSimpleCellAddress=(e,t,r,n)=>m(t,e.col+r,e.row+n);t.addressKey=e=>`${e.sheet},${e.row},${e.col}`;t.absoluteSheetReference=(e,t)=>{var r;return null!==(r=e.sheet)&&void 0!==r?r:t.sheet};t.equalSimpleCellAddress=(e,t)=>e.sheet===t.sheet&&e.col===t.col&&e.row===t.row},function(e,t,r){"use strict";t.__esModule=!0,t.ValueCellVertex=t.TopSort=t.SparseStrategy=t.SheetMapping=t.RangeVertex=t.RangeMapping=t.ParsingErrorVertex=t.Graph=t.FormulaCellVertex=t.EmptyCellVertex=t.DependencyGraph=t.DenseStrategy=t.ArrayVertex=t.ArrayMapping=t.AddressMapping=void 0;var n=r(108);t.DependencyGraph=n.DependencyGraph;var o=r(206);t.AddressMapping=o.AddressMapping;var s=r(213);t.Graph=s.Graph;var i=r(214);t.TopSort=i.TopSort;var a=r(216);t.RangeMapping=a.RangeMapping;var u=r(217);t.SheetMapping=u.SheetMapping;var c=r(208);t.ArrayMapping=c.ArrayMapping;var l=r(210);t.FormulaCellVertex=l.FormulaCellVertex,t.ArrayVertex=l.ArrayVertex;var h=r(220);t.EmptyCellVertex=h.EmptyCellVertex;var d=r(221);t.ValueCellVertex=d.ValueCellVertex;var p=r(222);t.ParsingErrorVertex=p.ParsingErrorVertex;var m=r(212);t.RangeVertex=m.RangeVertex;var g=r(224);t.SparseStrategy=g.SparseStrategy;var f=r(225);t.DenseStrategy=f.DenseStrategy},function(e,t,r){"use strict";t.__esModule=!0,t.DependencyGraph=void 0,r(3),r(73),r(109),r(110),r(84),r(111),r(122),r(124),r(126),r(128),r(130),r(133);var n=r(105),o=r(135),s=r(106),i=r(198),a=r(191),u=r(200),c=r(199),l=r(136),h=r(201),d=r(202),p=r(107),m=r(206),g=r(208),f=r(209),E=r(210),T=r(213),y=r(216),A=r(217);class R{constructor(e,t,r,a,u,c,h,d){this.addressMapping=e,this.rangeMapping=t,this.sheetMapping=r,this.arrayMapping=a,this.stats=u,this.lazilyTransformingAstService=c,this.functionRegistry=h,this.namedExpressions=d,this.changes=i.ContentChanges.empty(),this.dependencyQueryAddresses=e=>{if(e instanceof p.RangeVertex)return this.rangeDependencyQuery(e).map(([e,t])=>e);{const t=this.formulaDependencyQuery(e);if(void 0!==t){const[e,r]=t;return r.map(t=>t instanceof l.NamedExpressionDependency?this.namedExpressions.namedExpressionOrPlaceholder(t.name,e.sheet).address:(0,s.isSimpleCellAddress)(t)?t:(0,n.simpleCellRange)(t.start,t.end))}return[]}},this.dependencyQueryVertices=e=>{if(e instanceof p.RangeVertex)return this.rangeDependencyQuery(e);{const t=this.formulaDependencyQuery(e);if(void 0!==t){const[e,r]=t;return r.map(t=>{if(t instanceof n.AbsoluteCellRange)return[t.start,this.rangeMapping.fetchRange(t.start,t.end)];if(t instanceof l.NamedExpressionDependency){const r=this.namedExpressions.namedExpressionOrPlaceholder(t.name,e.sheet);return[r.address,this.addressMapping.fetchCell(r.address)]}return[t,this.addressMapping.fetchCell(t)]})}return[]}},this.rangeDependencyQuery=e=>{const t=[],{smallerRangeVertex:r,restRange:o}=this.rangeMapping.findSmallerRange(e.range);let s;void 0!==r&&this.graph.adjacentNodes(r).has(e)?(s=o,t.push([new n.AbsoluteCellRange(r.start,r.end),r])):s=e.range;for(const e of s.addresses(this)){const r=this.addressMapping.getCell(e);void 0!==r&&t.push([e,r])}return t},this.formulaDependencyQuery=e=>{let t,r;if(!(e instanceof E.FormulaVertex))return;r=e.getAddress(this.lazilyTransformingAstService),t=e.getFormula(this.lazilyTransformingAstService);const n=(0,l.collectDependencies)(t,this.functionRegistry);return[r,(0,o.absolutizeDependencies)(n,r)]},this.graph=new T.Graph(this.dependencyQueryVertices)}static buildEmpty(e,t,r,n,o){return new R(new m.AddressMapping(t.chooseAddressMappingPolicy),new y.RangeMapping,new A.SheetMapping(t.translationPackage),new g.ArrayMapping,o,e,r,n)}setFormulaToCell(e,t,r,n,o,s){const i=E.FormulaVertex.fromAst(t,e,n,this.lazilyTransformingAstService.version());return this.exchangeOrAddFormulaVertex(i),this.processCellDependencies(r,i),this.graph.markNodeAsDirty(i),o&&this.markAsVolatile(i),s&&this.markAsDependentOnStructureChange(i),this.correctInfiniteRangesDependency(e),this.getAndClearContentChanges()}setParsingErrorToCell(e,t){const r=this.shrinkPossibleArrayAndGetCell(e);return this.exchangeOrAddGraphNode(r,t),this.addressMapping.setCell(e,t),this.graph.markNodeAsDirty(t),this.correctInfiniteRangesDependency(e),this.getAndClearContentChanges()}setValueToCell(e,t){const r=this.shrinkPossibleArrayAndGetCell(e);if(r instanceof p.ArrayVertex&&this.arrayMapping.removeArray(r.getRange()),r instanceof p.ValueCellVertex){r.getValues().rawValue!==t.rawValue&&(r.setValues(t),this.graph.markNodeAsDirty(r))}else{const n=new p.ValueCellVertex(t.parsedValue,t.rawValue);this.exchangeOrAddGraphNode(r,n),this.addressMapping.setCell(e,n),this.graph.markNodeAsDirty(n)}return this.correctInfiniteRangesDependency(e),this.getAndClearContentChanges()}setCellEmpty(e){const t=this.shrinkPossibleArrayAndGetCell(e);if(void 0===t)return i.ContentChanges.empty();if(this.graph.adjacentNodes(t).size>0){const r=new p.EmptyCellVertex;this.exchangeGraphNode(t,r),0===this.graph.adjacentNodesCount(r)?(this.removeVertex(r),this.addressMapping.removeCell(e)):(this.graph.markNodeAsDirty(r),this.addressMapping.setCell(e,r))}else this.removeVertex(t),this.addressMapping.removeCell(e);return this.getAndClearContentChanges()}clearDirtyVertices(){this.graph.clearDirtyNodes()}verticesToRecompute(){return this.graph.getDirtyAndVolatileNodes()}processCellDependencies(e,t){const r=this.graph.getNodeId(t);e.forEach(e=>{if(e instanceof n.AbsoluteCellRange){const t=e;let n=this.getRange(t.start,t.end);void 0===n&&(n=new p.RangeVertex(t),this.rangeMapping.setRange(n)),this.graph.addNodeAndReturnId(n);const o=this.graph.getNodeId(n);t.isFinite()||this.graph.markNodeAsInfiniteRange(o);const{smallerRa