Created
February 25, 2022 10:09
-
-
Save aninde/e2af40cc6422d269015e2b8bf8ac536b to your computer and use it in GitHub Desktop.
This file has been truncated, but you can view the full file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*! | |
* Copyright (c) HANDSONCODE sp. z o. o. | |
* | |
* HANDSONTABLE is a software distributed by HANDSONCODE sp. z o. o., a Polish corporation based in | |
* Gdynia, Poland, at Aleja Zwycięstwa 96-98, registered by the District Court in Gdansk under number | |
* 538651, EU tax ID number: PL5862294002, share capital: PLN 62,800.00. | |
* | |
* This software is protected by applicable copyright laws, including international treaties, and dual- | |
* licensed – depending on whether your use for commercial purposes, meaning intended for or | |
* resulting in commercial advantage or monetary compensation, or not. | |
* | |
* If your use is strictly personal or solely for evaluation purposes, meaning for the purposes of testing | |
* the suitability, performance, and usefulness of this software outside the production environment, | |
* you agree to be bound by the terms included in the "handsontable-non-commercial-license.pdf" file. | |
* | |
* Your use of this software for commercial purposes is subject to the terms included in an applicable | |
* license agreement. | |
* | |
* In any case, you must not make any such use of this software as to develop software which may be | |
* considered competitive with this software. | |
* | |
* 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: 11.1.0 | |
* Release date: 13/01/2022 (built at 25/02/2022 10:49:28) | |
*/ | |
(function webpackUniversalModuleDefinition(root, factory) { | |
if(typeof exports === 'object' && typeof module === 'object') | |
module.exports = factory(); | |
else if(typeof define === 'function' && define.amd) | |
define("Handsontable", [], factory); | |
else if(typeof exports === 'object') | |
exports["Handsontable"] = factory(); | |
else | |
root["Handsontable"] = factory(); | |
})(typeof self !== 'undefined' ? self : this, function() { | |
return /******/ (function(modules) { // webpackBootstrap | |
/******/ // The module cache | |
/******/ var installedModules = {}; | |
/******/ | |
/******/ // The require function | |
/******/ function __webpack_require__(moduleId) { | |
/******/ | |
/******/ // Check if module is in cache | |
/******/ if(installedModules[moduleId]) { | |
/******/ return installedModules[moduleId].exports; | |
/******/ } | |
/******/ // Create a new module (and put it into the cache) | |
/******/ var module = installedModules[moduleId] = { | |
/******/ i: moduleId, | |
/******/ l: false, | |
/******/ exports: {} | |
/******/ }; | |
/******/ | |
/******/ // Execute the module function | |
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); | |
/******/ | |
/******/ // Flag the module as loaded | |
/******/ module.l = true; | |
/******/ | |
/******/ // Return the exports of the module | |
/******/ return module.exports; | |
/******/ } | |
/******/ | |
/******/ | |
/******/ // expose the modules object (__webpack_modules__) | |
/******/ __webpack_require__.m = modules; | |
/******/ | |
/******/ // expose the module cache | |
/******/ __webpack_require__.c = installedModules; | |
/******/ | |
/******/ // define getter function for harmony exports | |
/******/ __webpack_require__.d = function(exports, name, getter) { | |
/******/ if(!__webpack_require__.o(exports, name)) { | |
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); | |
/******/ } | |
/******/ }; | |
/******/ | |
/******/ // define __esModule on exports | |
/******/ __webpack_require__.r = function(exports) { | |
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { | |
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); | |
/******/ } | |
/******/ Object.defineProperty(exports, '__esModule', { value: true }); | |
/******/ }; | |
/******/ | |
/******/ // create a fake namespace object | |
/******/ // mode & 1: value is a module id, require it | |
/******/ // mode & 2: merge all properties of value into the ns | |
/******/ // mode & 4: return value when already ns object | |
/******/ // mode & 8|1: behave like require | |
/******/ __webpack_require__.t = function(value, mode) { | |
/******/ if(mode & 1) value = __webpack_require__(value); | |
/******/ if(mode & 8) return value; | |
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; | |
/******/ var ns = Object.create(null); | |
/******/ __webpack_require__.r(ns); | |
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); | |
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); | |
/******/ return ns; | |
/******/ }; | |
/******/ | |
/******/ // getDefaultExport function for compatibility with non-harmony modules | |
/******/ __webpack_require__.n = function(module) { | |
/******/ var getter = module && module.__esModule ? | |
/******/ function getDefault() { return module['default']; } : | |
/******/ function getModuleExports() { return module; }; | |
/******/ __webpack_require__.d(getter, 'a', getter); | |
/******/ return getter; | |
/******/ }; | |
/******/ | |
/******/ // Object.prototype.hasOwnProperty.call | |
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; | |
/******/ | |
/******/ // __webpack_public_path__ | |
/******/ __webpack_require__.p = ""; | |
/******/ | |
/******/ | |
/******/ // Load entry module and return exports | |
/******/ return __webpack_require__(__webpack_require__.s = 630); | |
/******/ }) | |
/************************************************************************/ | |
/******/ ([ | |
/* 0 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var TO_STRING_TAG_SUPPORT = __webpack_require__(246); | |
var redefine = __webpack_require__(103); | |
var toString = __webpack_require__(632); | |
// `Object.prototype.toString` method | |
// https://tc39.es/ecma262/#sec-object.prototype.tostring | |
if (!TO_STRING_TAG_SUPPORT) { | |
redefine(Object.prototype, 'toString', toString, { unsafe: true }); | |
} | |
/***/ }), | |
/* 1 */ | |
/***/ (function(module, exports) { | |
function _interopRequireDefault(obj) { | |
return obj && obj.__esModule ? obj : { | |
"default": obj | |
}; | |
} | |
module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports; | |
/***/ }), | |
/* 2 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var charAt = __webpack_require__(251).charAt; | |
var toString = __webpack_require__(74); | |
var InternalStateModule = __webpack_require__(113); | |
var defineIterator = __webpack_require__(252); | |
var STRING_ITERATOR = 'String Iterator'; | |
var setInternalState = InternalStateModule.set; | |
var getInternalState = InternalStateModule.getterFor(STRING_ITERATOR); | |
// `String.prototype[@@iterator]` method | |
// https://tc39.es/ecma262/#sec-string.prototype-@@iterator | |
defineIterator(String, 'String', function (iterated) { | |
setInternalState(this, { | |
type: STRING_ITERATOR, | |
string: toString(iterated), | |
index: 0 | |
}); | |
// `%StringIteratorPrototype%.next` method | |
// https://tc39.es/ecma262/#sec-%stringiteratorprototype%.next | |
}, function next() { | |
var state = getInternalState(this); | |
var string = state.string; | |
var index = state.index; | |
var point; | |
if (index >= string.length) return { value: undefined, done: true }; | |
point = charAt(string, index); | |
state.index += point.length; | |
return { value: point, done: false }; | |
}); | |
/***/ }), | |
/* 3 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var toIndexedObject = __webpack_require__(94); | |
var addToUnscopables = __webpack_require__(175); | |
var Iterators = __webpack_require__(174); | |
var InternalStateModule = __webpack_require__(113); | |
var defineProperty = __webpack_require__(86).f; | |
var defineIterator = __webpack_require__(252); | |
var IS_PURE = __webpack_require__(131); | |
var DESCRIPTORS = __webpack_require__(72); | |
var ARRAY_ITERATOR = 'Array Iterator'; | |
var setInternalState = InternalStateModule.set; | |
var getInternalState = InternalStateModule.getterFor(ARRAY_ITERATOR); | |
// `Array.prototype.entries` method | |
// https://tc39.es/ecma262/#sec-array.prototype.entries | |
// `Array.prototype.keys` method | |
// https://tc39.es/ecma262/#sec-array.prototype.keys | |
// `Array.prototype.values` method | |
// https://tc39.es/ecma262/#sec-array.prototype.values | |
// `Array.prototype[@@iterator]` method | |
// https://tc39.es/ecma262/#sec-array.prototype-@@iterator | |
// `CreateArrayIterator` internal method | |
// https://tc39.es/ecma262/#sec-createarrayiterator | |
module.exports = defineIterator(Array, 'Array', function (iterated, kind) { | |
setInternalState(this, { | |
type: ARRAY_ITERATOR, | |
target: toIndexedObject(iterated), // target | |
index: 0, // next index | |
kind: kind // kind | |
}); | |
// `%ArrayIteratorPrototype%.next` method | |
// https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next | |
}, function () { | |
var state = getInternalState(this); | |
var target = state.target; | |
var kind = state.kind; | |
var index = state.index++; | |
if (!target || index >= target.length) { | |
state.target = undefined; | |
return { value: undefined, done: true }; | |
} | |
if (kind == 'keys') return { value: index, done: false }; | |
if (kind == 'values') return { value: target[index], done: false }; | |
return { value: [index, target[index]], done: false }; | |
}, 'values'); | |
// argumentsList[@@iterator] is %ArrayProto_values% | |
// https://tc39.es/ecma262/#sec-createunmappedargumentsobject | |
// https://tc39.es/ecma262/#sec-createmappedargumentsobject | |
var values = Iterators.Arguments = Iterators.Array; | |
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables | |
addToUnscopables('keys'); | |
addToUnscopables('values'); | |
addToUnscopables('entries'); | |
// V8 ~ Chrome 45- bug | |
if (!IS_PURE && DESCRIPTORS && values.name !== 'values') try { | |
defineProperty(values, 'name', { value: 'values' }); | |
} catch (error) { /* empty */ } | |
/***/ }), | |
/* 4 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var global = __webpack_require__(30); | |
var DOMIterables = __webpack_require__(343); | |
var DOMTokenListPrototype = __webpack_require__(344); | |
var ArrayIteratorMethods = __webpack_require__(3); | |
var createNonEnumerableProperty = __webpack_require__(122); | |
var wellKnownSymbol = __webpack_require__(60); | |
var ITERATOR = wellKnownSymbol('iterator'); | |
var TO_STRING_TAG = wellKnownSymbol('toStringTag'); | |
var ArrayValues = ArrayIteratorMethods.values; | |
var handlePrototype = function (CollectionPrototype, COLLECTION_NAME) { | |
if (CollectionPrototype) { | |
// some Chrome versions have non-configurable methods on DOMTokenList | |
if (CollectionPrototype[ITERATOR] !== ArrayValues) try { | |
createNonEnumerableProperty(CollectionPrototype, ITERATOR, ArrayValues); | |
} catch (error) { | |
CollectionPrototype[ITERATOR] = ArrayValues; | |
} | |
if (!CollectionPrototype[TO_STRING_TAG]) { | |
createNonEnumerableProperty(CollectionPrototype, TO_STRING_TAG, COLLECTION_NAME); | |
} | |
if (DOMIterables[COLLECTION_NAME]) for (var METHOD_NAME in ArrayIteratorMethods) { | |
// some Chrome versions have non-configurable methods on DOMTokenList | |
if (CollectionPrototype[METHOD_NAME] !== ArrayIteratorMethods[METHOD_NAME]) try { | |
createNonEnumerableProperty(CollectionPrototype, METHOD_NAME, ArrayIteratorMethods[METHOD_NAME]); | |
} catch (error) { | |
CollectionPrototype[METHOD_NAME] = ArrayIteratorMethods[METHOD_NAME]; | |
} | |
} | |
} | |
}; | |
for (var COLLECTION_NAME in DOMIterables) { | |
handlePrototype(global[COLLECTION_NAME] && global[COLLECTION_NAME].prototype, COLLECTION_NAME); | |
} | |
handlePrototype(DOMTokenListPrototype, 'DOMTokenList'); | |
/***/ }), | |
/* 5 */ | |
/***/ (function(module, exports) { | |
function _classCallCheck(instance, Constructor) { | |
if (!(instance instanceof Constructor)) { | |
throw new TypeError("Cannot call a class as a function"); | |
} | |
} | |
module.exports = _classCallCheck, module.exports.__esModule = true, module.exports["default"] = module.exports; | |
/***/ }), | |
/* 6 */ | |
/***/ (function(module, exports) { | |
function _defineProperties(target, props) { | |
for (var i = 0; i < props.length; i++) { | |
var descriptor = props[i]; | |
descriptor.enumerable = descriptor.enumerable || false; | |
descriptor.configurable = true; | |
if ("value" in descriptor) descriptor.writable = true; | |
Object.defineProperty(target, descriptor.key, descriptor); | |
} | |
} | |
function _createClass(Constructor, protoProps, staticProps) { | |
if (protoProps) _defineProperties(Constructor.prototype, protoProps); | |
if (staticProps) _defineProperties(Constructor, staticProps); | |
Object.defineProperty(Constructor, "prototype", { | |
writable: false | |
}); | |
return Constructor; | |
} | |
module.exports = _createClass, module.exports.__esModule = true, module.exports["default"] = module.exports; | |
/***/ }), | |
/* 7 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var $ = __webpack_require__(31); | |
var getBuiltIn = __webpack_require__(120); | |
var apply = __webpack_require__(133); | |
var bind = __webpack_require__(633); | |
var aConstructor = __webpack_require__(330); | |
var anObject = __webpack_require__(66); | |
var isObject = __webpack_require__(65); | |
var create = __webpack_require__(134); | |
var fails = __webpack_require__(43); | |
var nativeConstruct = getBuiltIn('Reflect', 'construct'); | |
var ObjectPrototype = Object.prototype; | |
var push = [].push; | |
// `Reflect.construct` method | |
// https://tc39.es/ecma262/#sec-reflect.construct | |
// MS Edge supports only 2 arguments and argumentsList argument is optional | |
// FF Nightly sets third argument as `new.target`, but does not create `this` from it | |
var NEW_TARGET_BUG = fails(function () { | |
function F() { /* empty */ } | |
return !(nativeConstruct(function () { /* empty */ }, [], F) instanceof F); | |
}); | |
var ARGS_BUG = !fails(function () { | |
nativeConstruct(function () { /* empty */ }); | |
}); | |
var FORCED = NEW_TARGET_BUG || ARGS_BUG; | |
$({ target: 'Reflect', stat: true, forced: FORCED, sham: FORCED }, { | |
construct: function construct(Target, args /* , newTarget */) { | |
aConstructor(Target); | |
anObject(args); | |
var newTarget = arguments.length < 3 ? Target : aConstructor(arguments[2]); | |
if (ARGS_BUG && !NEW_TARGET_BUG) return nativeConstruct(Target, args, newTarget); | |
if (Target == newTarget) { | |
// w/o altered newTarget, optimization for 0-4 arguments | |
switch (args.length) { | |
case 0: return new Target(); | |
case 1: return new Target(args[0]); | |
case 2: return new Target(args[0], args[1]); | |
case 3: return new Target(args[0], args[1], args[2]); | |
case 4: return new Target(args[0], args[1], args[2], args[3]); | |
} | |
// w/o altered newTarget, lot of arguments case | |
var $args = [null]; | |
apply(push, $args, args); | |
return new (apply(bind, Target, $args))(); | |
} | |
// with altered newTarget, not support built-in constructors | |
var proto = newTarget.prototype; | |
var instance = create(isObject(proto) ? proto : ObjectPrototype); | |
var result = apply(Target, instance, args); | |
return isObject(result) ? result : instance; | |
} | |
}); | |
/***/ }), | |
/* 8 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
/* WEBPACK VAR INJECTION */(function(module) {var require;//! moment.js | |
;(function (global, factory) { | |
true ? module.exports = factory() : | |
undefined | |
}(this, (function () { 'use strict'; | |
var hookCallback; | |
function hooks () { | |
return hookCallback.apply(null, arguments); | |
} | |
// This is done to register the method called with moment() | |
// without creating circular dependencies. | |
function setHookCallback (callback) { | |
hookCallback = callback; | |
} | |
function isArray(input) { | |
return input instanceof Array || Object.prototype.toString.call(input) === '[object Array]'; | |
} | |
function isObject(input) { | |
// IE8 will treat undefined and null as object if it wasn't for | |
// input != null | |
return input != null && Object.prototype.toString.call(input) === '[object Object]'; | |
} | |
function isObjectEmpty(obj) { | |
if (Object.getOwnPropertyNames) { | |
return (Object.getOwnPropertyNames(obj).length === 0); | |
} else { | |
var k; | |
for (k in obj) { | |
if (obj.hasOwnProperty(k)) { | |
return false; | |
} | |
} | |
return true; | |
} | |
} | |
function isUndefined(input) { | |
return input === void 0; | |
} | |
function isNumber(input) { | |
return typeof input === 'number' || Object.prototype.toString.call(input) === '[object Number]'; | |
} | |
function isDate(input) { | |
return input instanceof Date || Object.prototype.toString.call(input) === '[object Date]'; | |
} | |
function map(arr, fn) { | |
var res = [], i; | |
for (i = 0; i < arr.length; ++i) { | |
res.push(fn(arr[i], i)); | |
} | |
return res; | |
} | |
function hasOwnProp(a, b) { | |
return Object.prototype.hasOwnProperty.call(a, b); | |
} | |
function extend(a, b) { | |
for (var i in b) { | |
if (hasOwnProp(b, i)) { | |
a[i] = b[i]; | |
} | |
} | |
if (hasOwnProp(b, 'toString')) { | |
a.toString = b.toString; | |
} | |
if (hasOwnProp(b, 'valueOf')) { | |
a.valueOf = b.valueOf; | |
} | |
return a; | |
} | |
function createUTC (input, format, locale, strict) { | |
return createLocalOrUTC(input, format, locale, strict, true).utc(); | |
} | |
function defaultParsingFlags() { | |
// We need to deep clone this object. | |
return { | |
empty : false, | |
unusedTokens : [], | |
unusedInput : [], | |
overflow : -2, | |
charsLeftOver : 0, | |
nullInput : false, | |
invalidMonth : null, | |
invalidFormat : false, | |
userInvalidated : false, | |
iso : false, | |
parsedDateParts : [], | |
meridiem : null, | |
rfc2822 : false, | |
weekdayMismatch : false | |
}; | |
} | |
function getParsingFlags(m) { | |
if (m._pf == null) { | |
m._pf = defaultParsingFlags(); | |
} | |
return m._pf; | |
} | |
var some; | |
if (Array.prototype.some) { | |
some = Array.prototype.some; | |
} else { | |
some = function (fun) { | |
var t = Object(this); | |
var len = t.length >>> 0; | |
for (var i = 0; i < len; i++) { | |
if (i in t && fun.call(this, t[i], i, t)) { | |
return true; | |
} | |
} | |
return false; | |
}; | |
} | |
function isValid(m) { | |
if (m._isValid == null) { | |
var flags = getParsingFlags(m); | |
var parsedParts = some.call(flags.parsedDateParts, function (i) { | |
return i != null; | |
}); | |
var isNowValid = !isNaN(m._d.getTime()) && | |
flags.overflow < 0 && | |
!flags.empty && | |
!flags.invalidMonth && | |
!flags.invalidWeekday && | |
!flags.weekdayMismatch && | |
!flags.nullInput && | |
!flags.invalidFormat && | |
!flags.userInvalidated && | |
(!flags.meridiem || (flags.meridiem && parsedParts)); | |
if (m._strict) { | |
isNowValid = isNowValid && | |
flags.charsLeftOver === 0 && | |
flags.unusedTokens.length === 0 && | |
flags.bigHour === undefined; | |
} | |
if (Object.isFrozen == null || !Object.isFrozen(m)) { | |
m._isValid = isNowValid; | |
} | |
else { | |
return isNowValid; | |
} | |
} | |
return m._isValid; | |
} | |
function createInvalid (flags) { | |
var m = createUTC(NaN); | |
if (flags != null) { | |
extend(getParsingFlags(m), flags); | |
} | |
else { | |
getParsingFlags(m).userInvalidated = true; | |
} | |
return m; | |
} | |
// Plugins that add properties should also add the key here (null value), | |
// so we can properly clone ourselves. | |
var momentProperties = hooks.momentProperties = []; | |
function copyConfig(to, from) { | |
var i, prop, val; | |
if (!isUndefined(from._isAMomentObject)) { | |
to._isAMomentObject = from._isAMomentObject; | |
} | |
if (!isUndefined(from._i)) { | |
to._i = from._i; | |
} | |
if (!isUndefined(from._f)) { | |
to._f = from._f; | |
} | |
if (!isUndefined(from._l)) { | |
to._l = from._l; | |
} | |
if (!isUndefined(from._strict)) { | |
to._strict = from._strict; | |
} | |
if (!isUndefined(from._tzm)) { | |
to._tzm = from._tzm; | |
} | |
if (!isUndefined(from._isUTC)) { | |
to._isUTC = from._isUTC; | |
} | |
if (!isUndefined(from._offset)) { | |
to._offset = from._offset; | |
} | |
if (!isUndefined(from._pf)) { | |
to._pf = getParsingFlags(from); | |
} | |
if (!isUndefined(from._locale)) { | |
to._locale = from._locale; | |
} | |
if (momentProperties.length > 0) { | |
for (i = 0; i < momentProperties.length; i++) { | |
prop = momentProperties[i]; | |
val = from[prop]; | |
if (!isUndefined(val)) { | |
to[prop] = val; | |
} | |
} | |
} | |
return to; | |
} | |
var updateInProgress = false; | |
// Moment prototype object | |
function Moment(config) { | |
copyConfig(this, config); | |
this._d = new Date(config._d != null ? config._d.getTime() : NaN); | |
if (!this.isValid()) { | |
this._d = new Date(NaN); | |
} | |
// Prevent infinite loop in case updateOffset creates new moment | |
// objects. | |
if (updateInProgress === false) { | |
updateInProgress = true; | |
hooks.updateOffset(this); | |
updateInProgress = false; | |
} | |
} | |
function isMoment (obj) { | |
return obj instanceof Moment || (obj != null && obj._isAMomentObject != null); | |
} | |
function absFloor (number) { | |
if (number < 0) { | |
// -0 -> 0 | |
return Math.ceil(number) || 0; | |
} else { | |
return Math.floor(number); | |
} | |
} | |
function toInt(argumentForCoercion) { | |
var coercedNumber = +argumentForCoercion, | |
value = 0; | |
if (coercedNumber !== 0 && isFinite(coercedNumber)) { | |
value = absFloor(coercedNumber); | |
} | |
return value; | |
} | |
// compare two arrays, return the number of differences | |
function compareArrays(array1, array2, dontConvert) { | |
var len = Math.min(array1.length, array2.length), | |
lengthDiff = Math.abs(array1.length - array2.length), | |
diffs = 0, | |
i; | |
for (i = 0; i < len; i++) { | |
if ((dontConvert && array1[i] !== array2[i]) || | |
(!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) { | |
diffs++; | |
} | |
} | |
return diffs + lengthDiff; | |
} | |
function warn(msg) { | |
if (hooks.suppressDeprecationWarnings === false && | |
(typeof console !== 'undefined') && console.warn) { | |
console.warn('Deprecation warning: ' + msg); | |
} | |
} | |
function deprecate(msg, fn) { | |
var firstTime = true; | |
return extend(function () { | |
if (hooks.deprecationHandler != null) { | |
hooks.deprecationHandler(null, msg); | |
} | |
if (firstTime) { | |
var args = []; | |
var arg; | |
for (var i = 0; i < arguments.length; i++) { | |
arg = ''; | |
if (typeof arguments[i] === 'object') { | |
arg += '\n[' + i + '] '; | |
for (var key in arguments[0]) { | |
arg += key + ': ' + arguments[0][key] + ', '; | |
} | |
arg = arg.slice(0, -2); // Remove trailing comma and space | |
} else { | |
arg = arguments[i]; | |
} | |
args.push(arg); | |
} | |
warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + (new Error()).stack); | |
firstTime = false; | |
} | |
return fn.apply(this, arguments); | |
}, fn); | |
} | |
var deprecations = {}; | |
function deprecateSimple(name, msg) { | |
if (hooks.deprecationHandler != null) { | |
hooks.deprecationHandler(name, msg); | |
} | |
if (!deprecations[name]) { | |
warn(msg); | |
deprecations[name] = true; | |
} | |
} | |
hooks.suppressDeprecationWarnings = false; | |
hooks.deprecationHandler = null; | |
function isFunction(input) { | |
return input instanceof Function || Object.prototype.toString.call(input) === '[object Function]'; | |
} | |
function set (config) { | |
var prop, i; | |
for (i in config) { | |
prop = config[i]; | |
if (isFunction(prop)) { | |
this[i] = prop; | |
} else { | |
this['_' + i] = prop; | |
} | |
} | |
this._config = config; | |
// Lenient ordinal parsing accepts just a number in addition to | |
// number + (possibly) stuff coming from _dayOfMonthOrdinalParse. | |
// TODO: Remove "ordinalParse" fallback in next major release. | |
this._dayOfMonthOrdinalParseLenient = new RegExp( | |
(this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) + | |
'|' + (/\d{1,2}/).source); | |
} | |
function mergeConfigs(parentConfig, childConfig) { | |
var res = extend({}, parentConfig), prop; | |
for (prop in childConfig) { | |
if (hasOwnProp(childConfig, prop)) { | |
if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) { | |
res[prop] = {}; | |
extend(res[prop], parentConfig[prop]); | |
extend(res[prop], childConfig[prop]); | |
} else if (childConfig[prop] != null) { | |
res[prop] = childConfig[prop]; | |
} else { | |
delete res[prop]; | |
} | |
} | |
} | |
for (prop in parentConfig) { | |
if (hasOwnProp(parentConfig, prop) && | |
!hasOwnProp(childConfig, prop) && | |
isObject(parentConfig[prop])) { | |
// make sure changes to properties don't modify parent config | |
res[prop] = extend({}, res[prop]); | |
} | |
} | |
return res; | |
} | |
function Locale(config) { | |
if (config != null) { | |
this.set(config); | |
} | |
} | |
var keys; | |
if (Object.keys) { | |
keys = Object.keys; | |
} else { | |
keys = function (obj) { | |
var i, res = []; | |
for (i in obj) { | |
if (hasOwnProp(obj, i)) { | |
res.push(i); | |
} | |
} | |
return res; | |
}; | |
} | |
var defaultCalendar = { | |
sameDay : '[Today at] LT', | |
nextDay : '[Tomorrow at] LT', | |
nextWeek : 'dddd [at] LT', | |
lastDay : '[Yesterday at] LT', | |
lastWeek : '[Last] dddd [at] LT', | |
sameElse : 'L' | |
}; | |
function calendar (key, mom, now) { | |
var output = this._calendar[key] || this._calendar['sameElse']; | |
return isFunction(output) ? output.call(mom, now) : output; | |
} | |
var defaultLongDateFormat = { | |
LTS : 'h:mm:ss A', | |
LT : 'h:mm A', | |
L : 'MM/DD/YYYY', | |
LL : 'MMMM D, YYYY', | |
LLL : 'MMMM D, YYYY h:mm A', | |
LLLL : 'dddd, MMMM D, YYYY h:mm A' | |
}; | |
function longDateFormat (key) { | |
var format = this._longDateFormat[key], | |
formatUpper = this._longDateFormat[key.toUpperCase()]; | |
if (format || !formatUpper) { | |
return format; | |
} | |
this._longDateFormat[key] = formatUpper.replace(/MMMM|MM|DD|dddd/g, function (val) { | |
return val.slice(1); | |
}); | |
return this._longDateFormat[key]; | |
} | |
var defaultInvalidDate = 'Invalid date'; | |
function invalidDate () { | |
return this._invalidDate; | |
} | |
var defaultOrdinal = '%d'; | |
var defaultDayOfMonthOrdinalParse = /\d{1,2}/; | |
function ordinal (number) { | |
return this._ordinal.replace('%d', number); | |
} | |
var defaultRelativeTime = { | |
future : 'in %s', | |
past : '%s ago', | |
s : 'a few seconds', | |
ss : '%d seconds', | |
m : 'a minute', | |
mm : '%d minutes', | |
h : 'an hour', | |
hh : '%d hours', | |
d : 'a day', | |
dd : '%d days', | |
M : 'a month', | |
MM : '%d months', | |
y : 'a year', | |
yy : '%d years' | |
}; | |
function relativeTime (number, withoutSuffix, string, isFuture) { | |
var output = this._relativeTime[string]; | |
return (isFunction(output)) ? | |
output(number, withoutSuffix, string, isFuture) : | |
output.replace(/%d/i, number); | |
} | |
function pastFuture (diff, output) { | |
var format = this._relativeTime[diff > 0 ? 'future' : 'past']; | |
return isFunction(format) ? format(output) : format.replace(/%s/i, output); | |
} | |
var aliases = {}; | |
function addUnitAlias (unit, shorthand) { | |
var lowerCase = unit.toLowerCase(); | |
aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit; | |
} | |
function normalizeUnits(units) { | |
return typeof units === 'string' ? aliases[units] || aliases[units.toLowerCase()] : undefined; | |
} | |
function normalizeObjectUnits(inputObject) { | |
var normalizedInput = {}, | |
normalizedProp, | |
prop; | |
for (prop in inputObject) { | |
if (hasOwnProp(inputObject, prop)) { | |
normalizedProp = normalizeUnits(prop); | |
if (normalizedProp) { | |
normalizedInput[normalizedProp] = inputObject[prop]; | |
} | |
} | |
} | |
return normalizedInput; | |
} | |
var priorities = {}; | |
function addUnitPriority(unit, priority) { | |
priorities[unit] = priority; | |
} | |
function getPrioritizedUnits(unitsObj) { | |
var units = []; | |
for (var u in unitsObj) { | |
units.push({unit: u, priority: priorities[u]}); | |
} | |
units.sort(function (a, b) { | |
return a.priority - b.priority; | |
}); | |
return units; | |
} | |
function zeroFill(number, targetLength, forceSign) { | |
var absNumber = '' + Math.abs(number), | |
zerosToFill = targetLength - absNumber.length, | |
sign = number >= 0; | |
return (sign ? (forceSign ? '+' : '') : '-') + | |
Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber; | |
} | |
var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g; | |
var localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g; | |
var formatFunctions = {}; | |
var formatTokenFunctions = {}; | |
// token: 'M' | |
// padded: ['MM', 2] | |
// ordinal: 'Mo' | |
// callback: function () { this.month() + 1 } | |
function addFormatToken (token, padded, ordinal, callback) { | |
var func = callback; | |
if (typeof callback === 'string') { | |
func = function () { | |
return this[callback](); | |
}; | |
} | |
if (token) { | |
formatTokenFunctions[token] = func; | |
} | |
if (padded) { | |
formatTokenFunctions[padded[0]] = function () { | |
return zeroFill(func.apply(this, arguments), padded[1], padded[2]); | |
}; | |
} | |
if (ordinal) { | |
formatTokenFunctions[ordinal] = function () { | |
return this.localeData().ordinal(func.apply(this, arguments), token); | |
}; | |
} | |
} | |
function removeFormattingTokens(input) { | |
if (input.match(/\[[\s\S]/)) { | |
return input.replace(/^\[|\]$/g, ''); | |
} | |
return input.replace(/\\/g, ''); | |
} | |
function makeFormatFunction(format) { | |
var array = format.match(formattingTokens), i, length; | |
for (i = 0, length = array.length; i < length; i++) { | |
if (formatTokenFunctions[array[i]]) { | |
array[i] = formatTokenFunctions[array[i]]; | |
} else { | |
array[i] = removeFormattingTokens(array[i]); | |
} | |
} | |
return function (mom) { | |
var output = '', i; | |
for (i = 0; i < length; i++) { | |
output += isFunction(array[i]) ? array[i].call(mom, format) : array[i]; | |
} | |
return output; | |
}; | |
} | |
// format date using native date object | |
function formatMoment(m, format) { | |
if (!m.isValid()) { | |
return m.localeData().invalidDate(); | |
} | |
format = expandFormat(format, m.localeData()); | |
formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format); | |
return formatFunctions[format](m); | |
} | |
function expandFormat(format, locale) { | |
var i = 5; | |
function replaceLongDateFormatTokens(input) { | |
return locale.longDateFormat(input) || input; | |
} | |
localFormattingTokens.lastIndex = 0; | |
while (i >= 0 && localFormattingTokens.test(format)) { | |
format = format.replace(localFormattingTokens, replaceLongDateFormatTokens); | |
localFormattingTokens.lastIndex = 0; | |
i -= 1; | |
} | |
return format; | |
} | |
var match1 = /\d/; // 0 - 9 | |
var match2 = /\d\d/; // 00 - 99 | |
var match3 = /\d{3}/; // 000 - 999 | |
var match4 = /\d{4}/; // 0000 - 9999 | |
var match6 = /[+-]?\d{6}/; // -999999 - 999999 | |
var match1to2 = /\d\d?/; // 0 - 99 | |
var match3to4 = /\d\d\d\d?/; // 999 - 9999 | |
var match5to6 = /\d\d\d\d\d\d?/; // 99999 - 999999 | |
var match1to3 = /\d{1,3}/; // 0 - 999 | |
var match1to4 = /\d{1,4}/; // 0 - 9999 | |
var match1to6 = /[+-]?\d{1,6}/; // -999999 - 999999 | |
var matchUnsigned = /\d+/; // 0 - inf | |
var matchSigned = /[+-]?\d+/; // -inf - inf | |
var matchOffset = /Z|[+-]\d\d:?\d\d/gi; // +00:00 -00:00 +0000 -0000 or Z | |
var matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi; // +00 -00 +00:00 -00:00 +0000 -0000 or Z | |
var matchTimestamp = /[+-]?\d+(\.\d{1,3})?/; // 123456789 123456789.123 | |
// any word (or two) characters or numbers including two/three word month in arabic. | |
// includes scottish gaelic two word and hyphenated months | |
var matchWord = /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i; | |
var regexes = {}; | |
function addRegexToken (token, regex, strictRegex) { | |
regexes[token] = isFunction(regex) ? regex : function (isStrict, localeData) { | |
return (isStrict && strictRegex) ? strictRegex : regex; | |
}; | |
} | |
function getParseRegexForToken (token, config) { | |
if (!hasOwnProp(regexes, token)) { | |
return new RegExp(unescapeFormat(token)); | |
} | |
return regexes[token](config._strict, config._locale); | |
} | |
// Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript | |
function unescapeFormat(s) { | |
return regexEscape(s.replace('\\', '').replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (matched, p1, p2, p3, p4) { | |
return p1 || p2 || p3 || p4; | |
})); | |
} | |
function regexEscape(s) { | |
return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'); | |
} | |
var tokens = {}; | |
function addParseToken (token, callback) { | |
var i, func = callback; | |
if (typeof token === 'string') { | |
token = [token]; | |
} | |
if (isNumber(callback)) { | |
func = function (input, array) { | |
array[callback] = toInt(input); | |
}; | |
} | |
for (i = 0; i < token.length; i++) { | |
tokens[token[i]] = func; | |
} | |
} | |
function addWeekParseToken (token, callback) { | |
addParseToken(token, function (input, array, config, token) { | |
config._w = config._w || {}; | |
callback(input, config._w, config, token); | |
}); | |
} | |
function addTimeToArrayFromToken(token, input, config) { | |
if (input != null && hasOwnProp(tokens, token)) { | |
tokens[token](input, config._a, config, token); | |
} | |
} | |
var YEAR = 0; | |
var MONTH = 1; | |
var DATE = 2; | |
var HOUR = 3; | |
var MINUTE = 4; | |
var SECOND = 5; | |
var MILLISECOND = 6; | |
var WEEK = 7; | |
var WEEKDAY = 8; | |
// FORMATTING | |
addFormatToken('Y', 0, 0, function () { | |
var y = this.year(); | |
return y <= 9999 ? '' + y : '+' + y; | |
}); | |
addFormatToken(0, ['YY', 2], 0, function () { | |
return this.year() % 100; | |
}); | |
addFormatToken(0, ['YYYY', 4], 0, 'year'); | |
addFormatToken(0, ['YYYYY', 5], 0, 'year'); | |
addFormatToken(0, ['YYYYYY', 6, true], 0, 'year'); | |
// ALIASES | |
addUnitAlias('year', 'y'); | |
// PRIORITIES | |
addUnitPriority('year', 1); | |
// PARSING | |
addRegexToken('Y', matchSigned); | |
addRegexToken('YY', match1to2, match2); | |
addRegexToken('YYYY', match1to4, match4); | |
addRegexToken('YYYYY', match1to6, match6); | |
addRegexToken('YYYYYY', match1to6, match6); | |
addParseToken(['YYYYY', 'YYYYYY'], YEAR); | |
addParseToken('YYYY', function (input, array) { | |
array[YEAR] = input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input); | |
}); | |
addParseToken('YY', function (input, array) { | |
array[YEAR] = hooks.parseTwoDigitYear(input); | |
}); | |
addParseToken('Y', function (input, array) { | |
array[YEAR] = parseInt(input, 10); | |
}); | |
// HELPERS | |
function daysInYear(year) { | |
return isLeapYear(year) ? 366 : 365; | |
} | |
function isLeapYear(year) { | |
return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0; | |
} | |
// HOOKS | |
hooks.parseTwoDigitYear = function (input) { | |
return toInt(input) + (toInt(input) > 68 ? 1900 : 2000); | |
}; | |
// MOMENTS | |
var getSetYear = makeGetSet('FullYear', true); | |
function getIsLeapYear () { | |
return isLeapYear(this.year()); | |
} | |
function makeGetSet (unit, keepTime) { | |
return function (value) { | |
if (value != null) { | |
set$1(this, unit, value); | |
hooks.updateOffset(this, keepTime); | |
return this; | |
} else { | |
return get(this, unit); | |
} | |
}; | |
} | |
function get (mom, unit) { | |
return mom.isValid() ? | |
mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]() : NaN; | |
} | |
function set$1 (mom, unit, value) { | |
if (mom.isValid() && !isNaN(value)) { | |
if (unit === 'FullYear' && isLeapYear(mom.year()) && mom.month() === 1 && mom.date() === 29) { | |
mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value, mom.month(), daysInMonth(value, mom.month())); | |
} | |
else { | |
mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value); | |
} | |
} | |
} | |
// MOMENTS | |
function stringGet (units) { | |
units = normalizeUnits(units); | |
if (isFunction(this[units])) { | |
return this[units](); | |
} | |
return this; | |
} | |
function stringSet (units, value) { | |
if (typeof units === 'object') { | |
units = normalizeObjectUnits(units); | |
var prioritized = getPrioritizedUnits(units); | |
for (var i = 0; i < prioritized.length; i++) { | |
this[prioritized[i].unit](units[prioritized[i].unit]); | |
} | |
} else { | |
units = normalizeUnits(units); | |
if (isFunction(this[units])) { | |
return this[units](value); | |
} | |
} | |
return this; | |
} | |
function mod(n, x) { | |
return ((n % x) + x) % x; | |
} | |
var indexOf; | |
if (Array.prototype.indexOf) { | |
indexOf = Array.prototype.indexOf; | |
} else { | |
indexOf = function (o) { | |
// I know | |
var i; | |
for (i = 0; i < this.length; ++i) { | |
if (this[i] === o) { | |
return i; | |
} | |
} | |
return -1; | |
}; | |
} | |
function daysInMonth(year, month) { | |
if (isNaN(year) || isNaN(month)) { | |
return NaN; | |
} | |
var modMonth = mod(month, 12); | |
year += (month - modMonth) / 12; | |
return modMonth === 1 ? (isLeapYear(year) ? 29 : 28) : (31 - modMonth % 7 % 2); | |
} | |
// FORMATTING | |
addFormatToken('M', ['MM', 2], 'Mo', function () { | |
return this.month() + 1; | |
}); | |
addFormatToken('MMM', 0, 0, function (format) { | |
return this.localeData().monthsShort(this, format); | |
}); | |
addFormatToken('MMMM', 0, 0, function (format) { | |
return this.localeData().months(this, format); | |
}); | |
// ALIASES | |
addUnitAlias('month', 'M'); | |
// PRIORITY | |
addUnitPriority('month', 8); | |
// PARSING | |
addRegexToken('M', match1to2); | |
addRegexToken('MM', match1to2, match2); | |
addRegexToken('MMM', function (isStrict, locale) { | |
return locale.monthsShortRegex(isStrict); | |
}); | |
addRegexToken('MMMM', function (isStrict, locale) { | |
return locale.monthsRegex(isStrict); | |
}); | |
addParseToken(['M', 'MM'], function (input, array) { | |
array[MONTH] = toInt(input) - 1; | |
}); | |
addParseToken(['MMM', 'MMMM'], function (input, array, config, token) { | |
var month = config._locale.monthsParse(input, token, config._strict); | |
// if we didn't find a month name, mark the date as invalid. | |
if (month != null) { | |
array[MONTH] = month; | |
} else { | |
getParsingFlags(config).invalidMonth = input; | |
} | |
}); | |
// LOCALES | |
var MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/; | |
var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'); | |
function localeMonths (m, format) { | |
if (!m) { | |
return isArray(this._months) ? this._months : | |
this._months['standalone']; | |
} | |
return isArray(this._months) ? this._months[m.month()] : | |
this._months[(this._months.isFormat || MONTHS_IN_FORMAT).test(format) ? 'format' : 'standalone'][m.month()]; | |
} | |
var defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'); | |
function localeMonthsShort (m, format) { | |
if (!m) { | |
return isArray(this._monthsShort) ? this._monthsShort : | |
this._monthsShort['standalone']; | |
} | |
return isArray(this._monthsShort) ? this._monthsShort[m.month()] : | |
this._monthsShort[MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'][m.month()]; | |
} | |
function handleStrictParse(monthName, format, strict) { | |
var i, ii, mom, llc = monthName.toLocaleLowerCase(); | |
if (!this._monthsParse) { | |
// this is not used | |
this._monthsParse = []; | |
this._longMonthsParse = []; | |
this._shortMonthsParse = []; | |
for (i = 0; i < 12; ++i) { | |
mom = createUTC([2000, i]); | |
this._shortMonthsParse[i] = this.monthsShort(mom, '').toLocaleLowerCase(); | |
this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase(); | |
} | |
} | |
if (strict) { | |
if (format === 'MMM') { | |
ii = indexOf.call(this._shortMonthsParse, llc); | |
return ii !== -1 ? ii : null; | |
} else { | |
ii = indexOf.call(this._longMonthsParse, llc); | |
return ii !== -1 ? ii : null; | |
} | |
} else { | |
if (format === 'MMM') { | |
ii = indexOf.call(this._shortMonthsParse, llc); | |
if (ii !== -1) { | |
return ii; | |
} | |
ii = indexOf.call(this._longMonthsParse, llc); | |
return ii !== -1 ? ii : null; | |
} else { | |
ii = indexOf.call(this._longMonthsParse, llc); | |
if (ii !== -1) { | |
return ii; | |
} | |
ii = indexOf.call(this._shortMonthsParse, llc); | |
return ii !== -1 ? ii : null; | |
} | |
} | |
} | |
function localeMonthsParse (monthName, format, strict) { | |
var i, mom, regex; | |
if (this._monthsParseExact) { | |
return handleStrictParse.call(this, monthName, format, strict); | |
} | |
if (!this._monthsParse) { | |
this._monthsParse = []; | |
this._longMonthsParse = []; | |
this._shortMonthsParse = []; | |
} | |
// TODO: add sorting | |
// Sorting makes sure if one month (or abbr) is a prefix of another | |
// see sorting in computeMonthsParse | |
for (i = 0; i < 12; i++) { | |
// make the regex if we don't have it already | |
mom = createUTC([2000, i]); | |
if (strict && !this._longMonthsParse[i]) { | |
this._longMonthsParse[i] = new RegExp('^' + this.months(mom, '').replace('.', '') + '$', 'i'); | |
this._shortMonthsParse[i] = new RegExp('^' + this.monthsShort(mom, '').replace('.', '') + '$', 'i'); | |
} | |
if (!strict && !this._monthsParse[i]) { | |
regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, ''); | |
this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i'); | |
} | |
// test the regex | |
if (strict && format === 'MMMM' && this._longMonthsParse[i].test(monthName)) { | |
return i; | |
} else if (strict && format === 'MMM' && this._shortMonthsParse[i].test(monthName)) { | |
return i; | |
} else if (!strict && this._monthsParse[i].test(monthName)) { | |
return i; | |
} | |
} | |
} | |
// MOMENTS | |
function setMonth (mom, value) { | |
var dayOfMonth; | |
if (!mom.isValid()) { | |
// No op | |
return mom; | |
} | |
if (typeof value === 'string') { | |
if (/^\d+$/.test(value)) { | |
value = toInt(value); | |
} else { | |
value = mom.localeData().monthsParse(value); | |
// TODO: Another silent failure? | |
if (!isNumber(value)) { | |
return mom; | |
} | |
} | |
} | |
dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value)); | |
mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth); | |
return mom; | |
} | |
function getSetMonth (value) { | |
if (value != null) { | |
setMonth(this, value); | |
hooks.updateOffset(this, true); | |
return this; | |
} else { | |
return get(this, 'Month'); | |
} | |
} | |
function getDaysInMonth () { | |
return daysInMonth(this.year(), this.month()); | |
} | |
var defaultMonthsShortRegex = matchWord; | |
function monthsShortRegex (isStrict) { | |
if (this._monthsParseExact) { | |
if (!hasOwnProp(this, '_monthsRegex')) { | |
computeMonthsParse.call(this); | |
} | |
if (isStrict) { | |
return this._monthsShortStrictRegex; | |
} else { | |
return this._monthsShortRegex; | |
} | |
} else { | |
if (!hasOwnProp(this, '_monthsShortRegex')) { | |
this._monthsShortRegex = defaultMonthsShortRegex; | |
} | |
return this._monthsShortStrictRegex && isStrict ? | |
this._monthsShortStrictRegex : this._monthsShortRegex; | |
} | |
} | |
var defaultMonthsRegex = matchWord; | |
function monthsRegex (isStrict) { | |
if (this._monthsParseExact) { | |
if (!hasOwnProp(this, '_monthsRegex')) { | |
computeMonthsParse.call(this); | |
} | |
if (isStrict) { | |
return this._monthsStrictRegex; | |
} else { | |
return this._monthsRegex; | |
} | |
} else { | |
if (!hasOwnProp(this, '_monthsRegex')) { | |
this._monthsRegex = defaultMonthsRegex; | |
} | |
return this._monthsStrictRegex && isStrict ? | |
this._monthsStrictRegex : this._monthsRegex; | |
} | |
} | |
function computeMonthsParse () { | |
function cmpLenRev(a, b) { | |
return b.length - a.length; | |
} | |
var shortPieces = [], longPieces = [], mixedPieces = [], | |
i, mom; | |
for (i = 0; i < 12; i++) { | |
// make the regex if we don't have it already | |
mom = createUTC([2000, i]); | |
shortPieces.push(this.monthsShort(mom, '')); | |
longPieces.push(this.months(mom, '')); | |
mixedPieces.push(this.months(mom, '')); | |
mixedPieces.push(this.monthsShort(mom, '')); | |
} | |
// Sorting makes sure if one month (or abbr) is a prefix of another it | |
// will match the longer piece. | |
shortPieces.sort(cmpLenRev); | |
longPieces.sort(cmpLenRev); | |
mixedPieces.sort(cmpLenRev); | |
for (i = 0; i < 12; i++) { | |
shortPieces[i] = regexEscape(shortPieces[i]); | |
longPieces[i] = regexEscape(longPieces[i]); | |
} | |
for (i = 0; i < 24; i++) { | |
mixedPieces[i] = regexEscape(mixedPieces[i]); | |
} | |
this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); | |
this._monthsShortRegex = this._monthsRegex; | |
this._monthsStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i'); | |
this._monthsShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i'); | |
} | |
function createDate (y, m, d, h, M, s, ms) { | |
// can't just apply() to create a date: | |
// https://stackoverflow.com/q/181348 | |
var date; | |
// the date constructor remaps years 0-99 to 1900-1999 | |
if (y < 100 && y >= 0) { | |
// preserve leap years using a full 400 year cycle, then reset | |
date = new Date(y + 400, m, d, h, M, s, ms); | |
if (isFinite(date.getFullYear())) { | |
date.setFullYear(y); | |
} | |
} else { | |
date = new Date(y, m, d, h, M, s, ms); | |
} | |
return date; | |
} | |
function createUTCDate (y) { | |
var date; | |
// the Date.UTC function remaps years 0-99 to 1900-1999 | |
if (y < 100 && y >= 0) { | |
var args = Array.prototype.slice.call(arguments); | |
// preserve leap years using a full 400 year cycle, then reset | |
args[0] = y + 400; | |
date = new Date(Date.UTC.apply(null, args)); | |
if (isFinite(date.getUTCFullYear())) { | |
date.setUTCFullYear(y); | |
} | |
} else { | |
date = new Date(Date.UTC.apply(null, arguments)); | |
} | |
return date; | |
} | |
// start-of-first-week - start-of-year | |
function firstWeekOffset(year, dow, doy) { | |
var // first-week day -- which january is always in the first week (4 for iso, 1 for other) | |
fwd = 7 + dow - doy, | |
// first-week day local weekday -- which local weekday is fwd | |
fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7; | |
return -fwdlw + fwd - 1; | |
} | |
// https://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday | |
function dayOfYearFromWeeks(year, week, weekday, dow, doy) { | |
var localWeekday = (7 + weekday - dow) % 7, | |
weekOffset = firstWeekOffset(year, dow, doy), | |
dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset, | |
resYear, resDayOfYear; | |
if (dayOfYear <= 0) { | |
resYear = year - 1; | |
resDayOfYear = daysInYear(resYear) + dayOfYear; | |
} else if (dayOfYear > daysInYear(year)) { | |
resYear = year + 1; | |
resDayOfYear = dayOfYear - daysInYear(year); | |
} else { | |
resYear = year; | |
resDayOfYear = dayOfYear; | |
} | |
return { | |
year: resYear, | |
dayOfYear: resDayOfYear | |
}; | |
} | |
function weekOfYear(mom, dow, doy) { | |
var weekOffset = firstWeekOffset(mom.year(), dow, doy), | |
week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1, | |
resWeek, resYear; | |
if (week < 1) { | |
resYear = mom.year() - 1; | |
resWeek = week + weeksInYear(resYear, dow, doy); | |
} else if (week > weeksInYear(mom.year(), dow, doy)) { | |
resWeek = week - weeksInYear(mom.year(), dow, doy); | |
resYear = mom.year() + 1; | |
} else { | |
resYear = mom.year(); | |
resWeek = week; | |
} | |
return { | |
week: resWeek, | |
year: resYear | |
}; | |
} | |
function weeksInYear(year, dow, doy) { | |
var weekOffset = firstWeekOffset(year, dow, doy), | |
weekOffsetNext = firstWeekOffset(year + 1, dow, doy); | |
return (daysInYear(year) - weekOffset + weekOffsetNext) / 7; | |
} | |
// FORMATTING | |
addFormatToken('w', ['ww', 2], 'wo', 'week'); | |
addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek'); | |
// ALIASES | |
addUnitAlias('week', 'w'); | |
addUnitAlias('isoWeek', 'W'); | |
// PRIORITIES | |
addUnitPriority('week', 5); | |
addUnitPriority('isoWeek', 5); | |
// PARSING | |
addRegexToken('w', match1to2); | |
addRegexToken('ww', match1to2, match2); | |
addRegexToken('W', match1to2); | |
addRegexToken('WW', match1to2, match2); | |
addWeekParseToken(['w', 'ww', 'W', 'WW'], function (input, week, config, token) { | |
week[token.substr(0, 1)] = toInt(input); | |
}); | |
// HELPERS | |
// LOCALES | |
function localeWeek (mom) { | |
return weekOfYear(mom, this._week.dow, this._week.doy).week; | |
} | |
var defaultLocaleWeek = { | |
dow : 0, // Sunday is the first day of the week. | |
doy : 6 // The week that contains Jan 6th is the first week of the year. | |
}; | |
function localeFirstDayOfWeek () { | |
return this._week.dow; | |
} | |
function localeFirstDayOfYear () { | |
return this._week.doy; | |
} | |
// MOMENTS | |
function getSetWeek (input) { | |
var week = this.localeData().week(this); | |
return input == null ? week : this.add((input - week) * 7, 'd'); | |
} | |
function getSetISOWeek (input) { | |
var week = weekOfYear(this, 1, 4).week; | |
return input == null ? week : this.add((input - week) * 7, 'd'); | |
} | |
// FORMATTING | |
addFormatToken('d', 0, 'do', 'day'); | |
addFormatToken('dd', 0, 0, function (format) { | |
return this.localeData().weekdaysMin(this, format); | |
}); | |
addFormatToken('ddd', 0, 0, function (format) { | |
return this.localeData().weekdaysShort(this, format); | |
}); | |
addFormatToken('dddd', 0, 0, function (format) { | |
return this.localeData().weekdays(this, format); | |
}); | |
addFormatToken('e', 0, 0, 'weekday'); | |
addFormatToken('E', 0, 0, 'isoWeekday'); | |
// ALIASES | |
addUnitAlias('day', 'd'); | |
addUnitAlias('weekday', 'e'); | |
addUnitAlias('isoWeekday', 'E'); | |
// PRIORITY | |
addUnitPriority('day', 11); | |
addUnitPriority('weekday', 11); | |
addUnitPriority('isoWeekday', 11); | |
// PARSING | |
addRegexToken('d', match1to2); | |
addRegexToken('e', match1to2); | |
addRegexToken('E', match1to2); | |
addRegexToken('dd', function (isStrict, locale) { | |
return locale.weekdaysMinRegex(isStrict); | |
}); | |
addRegexToken('ddd', function (isStrict, locale) { | |
return locale.weekdaysShortRegex(isStrict); | |
}); | |
addRegexToken('dddd', function (isStrict, locale) { | |
return locale.weekdaysRegex(isStrict); | |
}); | |
addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) { | |
var weekday = config._locale.weekdaysParse(input, token, config._strict); | |
// if we didn't get a weekday name, mark the date as invalid | |
if (weekday != null) { | |
week.d = weekday; | |
} else { | |
getParsingFlags(config).invalidWeekday = input; | |
} | |
}); | |
addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) { | |
week[token] = toInt(input); | |
}); | |
// HELPERS | |
function parseWeekday(input, locale) { | |
if (typeof input !== 'string') { | |
return input; | |
} | |
if (!isNaN(input)) { | |
return parseInt(input, 10); | |
} | |
input = locale.weekdaysParse(input); | |
if (typeof input === 'number') { | |
return input; | |
} | |
return null; | |
} | |
function parseIsoWeekday(input, locale) { | |
if (typeof input === 'string') { | |
return locale.weekdaysParse(input) % 7 || 7; | |
} | |
return isNaN(input) ? null : input; | |
} | |
// LOCALES | |
function shiftWeekdays (ws, n) { | |
return ws.slice(n, 7).concat(ws.slice(0, n)); | |
} | |
var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'); | |
function localeWeekdays (m, format) { | |
var weekdays = isArray(this._weekdays) ? this._weekdays : | |
this._weekdays[(m && m !== true && this._weekdays.isFormat.test(format)) ? 'format' : 'standalone']; | |
return (m === true) ? shiftWeekdays(weekdays, this._week.dow) | |
: (m) ? weekdays[m.day()] : weekdays; | |
} | |
var defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'); | |
function localeWeekdaysShort (m) { | |
return (m === true) ? shiftWeekdays(this._weekdaysShort, this._week.dow) | |
: (m) ? this._weekdaysShort[m.day()] : this._weekdaysShort; | |
} | |
var defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'); | |
function localeWeekdaysMin (m) { | |
return (m === true) ? shiftWeekdays(this._weekdaysMin, this._week.dow) | |
: (m) ? this._weekdaysMin[m.day()] : this._weekdaysMin; | |
} | |
function handleStrictParse$1(weekdayName, format, strict) { | |
var i, ii, mom, llc = weekdayName.toLocaleLowerCase(); | |
if (!this._weekdaysParse) { | |
this._weekdaysParse = []; | |
this._shortWeekdaysParse = []; | |
this._minWeekdaysParse = []; | |
for (i = 0; i < 7; ++i) { | |
mom = createUTC([2000, 1]).day(i); | |
this._minWeekdaysParse[i] = this.weekdaysMin(mom, '').toLocaleLowerCase(); | |
this._shortWeekdaysParse[i] = this.weekdaysShort(mom, '').toLocaleLowerCase(); | |
this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase(); | |
} | |
} | |
if (strict) { | |
if (format === 'dddd') { | |
ii = indexOf.call(this._weekdaysParse, llc); | |
return ii !== -1 ? ii : null; | |
} else if (format === 'ddd') { | |
ii = indexOf.call(this._shortWeekdaysParse, llc); | |
return ii !== -1 ? ii : null; | |
} else { | |
ii = indexOf.call(this._minWeekdaysParse, llc); | |
return ii !== -1 ? ii : null; | |
} | |
} else { | |
if (format === 'dddd') { | |
ii = indexOf.call(this._weekdaysParse, llc); | |
if (ii !== -1) { | |
return ii; | |
} | |
ii = indexOf.call(this._shortWeekdaysParse, llc); | |
if (ii !== -1) { | |
return ii; | |
} | |
ii = indexOf.call(this._minWeekdaysParse, llc); | |
return ii !== -1 ? ii : null; | |
} else if (format === 'ddd') { | |
ii = indexOf.call(this._shortWeekdaysParse, llc); | |
if (ii !== -1) { | |
return ii; | |
} | |
ii = indexOf.call(this._weekdaysParse, llc); | |
if (ii !== -1) { | |
return ii; | |
} | |
ii = indexOf.call(this._minWeekdaysParse, llc); | |
return ii !== -1 ? ii : null; | |
} else { | |
ii = indexOf.call(this._minWeekdaysParse, llc); | |
if (ii !== -1) { | |
return ii; | |
} | |
ii = indexOf.call(this._weekdaysParse, llc); | |
if (ii !== -1) { | |
return ii; | |
} | |
ii = indexOf.call(this._shortWeekdaysParse, llc); | |
return ii !== -1 ? ii : null; | |
} | |
} | |
} | |
function localeWeekdaysParse (weekdayName, format, strict) { | |
var i, mom, regex; | |
if (this._weekdaysParseExact) { | |
return handleStrictParse$1.call(this, weekdayName, format, strict); | |
} | |
if (!this._weekdaysParse) { | |
this._weekdaysParse = []; | |
this._minWeekdaysParse = []; | |
this._shortWeekdaysParse = []; | |
this._fullWeekdaysParse = []; | |
} | |
for (i = 0; i < 7; i++) { | |
// make the regex if we don't have it already | |
mom = createUTC([2000, 1]).day(i); | |
if (strict && !this._fullWeekdaysParse[i]) { | |
this._fullWeekdaysParse[i] = new RegExp('^' + this.weekdays(mom, '').replace('.', '\\.?') + '$', 'i'); | |
this._shortWeekdaysParse[i] = new RegExp('^' + this.weekdaysShort(mom, '').replace('.', '\\.?') + '$', 'i'); | |
this._minWeekdaysParse[i] = new RegExp('^' + this.weekdaysMin(mom, '').replace('.', '\\.?') + '$', 'i'); | |
} | |
if (!this._weekdaysParse[i]) { | |
regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, ''); | |
this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i'); | |
} | |
// test the regex | |
if (strict && format === 'dddd' && this._fullWeekdaysParse[i].test(weekdayName)) { | |
return i; | |
} else if (strict && format === 'ddd' && this._shortWeekdaysParse[i].test(weekdayName)) { | |
return i; | |
} else if (strict && format === 'dd' && this._minWeekdaysParse[i].test(weekdayName)) { | |
return i; | |
} else if (!strict && this._weekdaysParse[i].test(weekdayName)) { | |
return i; | |
} | |
} | |
} | |
// MOMENTS | |
function getSetDayOfWeek (input) { | |
if (!this.isValid()) { | |
return input != null ? this : NaN; | |
} | |
var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay(); | |
if (input != null) { | |
input = parseWeekday(input, this.localeData()); | |
return this.add(input - day, 'd'); | |
} else { | |
return day; | |
} | |
} | |
function getSetLocaleDayOfWeek (input) { | |
if (!this.isValid()) { | |
return input != null ? this : NaN; | |
} | |
var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7; | |
return input == null ? weekday : this.add(input - weekday, 'd'); | |
} | |
function getSetISODayOfWeek (input) { | |
if (!this.isValid()) { | |
return input != null ? this : NaN; | |
} | |
// behaves the same as moment#day except | |
// as a getter, returns 7 instead of 0 (1-7 range instead of 0-6) | |
// as a setter, sunday should belong to the previous week. | |
if (input != null) { | |
var weekday = parseIsoWeekday(input, this.localeData()); | |
return this.day(this.day() % 7 ? weekday : weekday - 7); | |
} else { | |
return this.day() || 7; | |
} | |
} | |
var defaultWeekdaysRegex = matchWord; | |
function weekdaysRegex (isStrict) { | |
if (this._weekdaysParseExact) { | |
if (!hasOwnProp(this, '_weekdaysRegex')) { | |
computeWeekdaysParse.call(this); | |
} | |
if (isStrict) { | |
return this._weekdaysStrictRegex; | |
} else { | |
return this._weekdaysRegex; | |
} | |
} else { | |
if (!hasOwnProp(this, '_weekdaysRegex')) { | |
this._weekdaysRegex = defaultWeekdaysRegex; | |
} | |
return this._weekdaysStrictRegex && isStrict ? | |
this._weekdaysStrictRegex : this._weekdaysRegex; | |
} | |
} | |
var defaultWeekdaysShortRegex = matchWord; | |
function weekdaysShortRegex (isStrict) { | |
if (this._weekdaysParseExact) { | |
if (!hasOwnProp(this, '_weekdaysRegex')) { | |
computeWeekdaysParse.call(this); | |
} | |
if (isStrict) { | |
return this._weekdaysShortStrictRegex; | |
} else { | |
return this._weekdaysShortRegex; | |
} | |
} else { | |
if (!hasOwnProp(this, '_weekdaysShortRegex')) { | |
this._weekdaysShortRegex = defaultWeekdaysShortRegex; | |
} | |
return this._weekdaysShortStrictRegex && isStrict ? | |
this._weekdaysShortStrictRegex : this._weekdaysShortRegex; | |
} | |
} | |
var defaultWeekdaysMinRegex = matchWord; | |
function weekdaysMinRegex (isStrict) { | |
if (this._weekdaysParseExact) { | |
if (!hasOwnProp(this, '_weekdaysRegex')) { | |
computeWeekdaysParse.call(this); | |
} | |
if (isStrict) { | |
return this._weekdaysMinStrictRegex; | |
} else { | |
return this._weekdaysMinRegex; | |
} | |
} else { | |
if (!hasOwnProp(this, '_weekdaysMinRegex')) { | |
this._weekdaysMinRegex = defaultWeekdaysMinRegex; | |
} | |
return this._weekdaysMinStrictRegex && isStrict ? | |
this._weekdaysMinStrictRegex : this._weekdaysMinRegex; | |
} | |
} | |
function computeWeekdaysParse () { | |
function cmpLenRev(a, b) { | |
return b.length - a.length; | |
} | |
var minPieces = [], shortPieces = [], longPieces = [], mixedPieces = [], | |
i, mom, minp, shortp, longp; | |
for (i = 0; i < 7; i++) { | |
// make the regex if we don't have it already | |
mom = createUTC([2000, 1]).day(i); | |
minp = this.weekdaysMin(mom, ''); | |
shortp = this.weekdaysShort(mom, ''); | |
longp = this.weekdays(mom, ''); | |
minPieces.push(minp); | |
shortPieces.push(shortp); | |
longPieces.push(longp); | |
mixedPieces.push(minp); | |
mixedPieces.push(shortp); | |
mixedPieces.push(longp); | |
} | |
// Sorting makes sure if one weekday (or abbr) is a prefix of another it | |
// will match the longer piece. | |
minPieces.sort(cmpLenRev); | |
shortPieces.sort(cmpLenRev); | |
longPieces.sort(cmpLenRev); | |
mixedPieces.sort(cmpLenRev); | |
for (i = 0; i < 7; i++) { | |
shortPieces[i] = regexEscape(shortPieces[i]); | |
longPieces[i] = regexEscape(longPieces[i]); | |
mixedPieces[i] = regexEscape(mixedPieces[i]); | |
} | |
this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); | |
this._weekdaysShortRegex = this._weekdaysRegex; | |
this._weekdaysMinRegex = this._weekdaysRegex; | |
this._weekdaysStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i'); | |
this._weekdaysShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i'); | |
this._weekdaysMinStrictRegex = new RegExp('^(' + minPieces.join('|') + ')', 'i'); | |
} | |
// FORMATTING | |
function hFormat() { | |
return this.hours() % 12 || 12; | |
} | |
function kFormat() { | |
return this.hours() || 24; | |
} | |
addFormatToken('H', ['HH', 2], 0, 'hour'); | |
addFormatToken('h', ['hh', 2], 0, hFormat); | |
addFormatToken('k', ['kk', 2], 0, kFormat); | |
addFormatToken('hmm', 0, 0, function () { | |
return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2); | |
}); | |
addFormatToken('hmmss', 0, 0, function () { | |
return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2) + | |
zeroFill(this.seconds(), 2); | |
}); | |
addFormatToken('Hmm', 0, 0, function () { | |
return '' + this.hours() + zeroFill(this.minutes(), 2); | |
}); | |
addFormatToken('Hmmss', 0, 0, function () { | |
return '' + this.hours() + zeroFill(this.minutes(), 2) + | |
zeroFill(this.seconds(), 2); | |
}); | |
function meridiem (token, lowercase) { | |
addFormatToken(token, 0, 0, function () { | |
return this.localeData().meridiem(this.hours(), this.minutes(), lowercase); | |
}); | |
} | |
meridiem('a', true); | |
meridiem('A', false); | |
// ALIASES | |
addUnitAlias('hour', 'h'); | |
// PRIORITY | |
addUnitPriority('hour', 13); | |
// PARSING | |
function matchMeridiem (isStrict, locale) { | |
return locale._meridiemParse; | |
} | |
addRegexToken('a', matchMeridiem); | |
addRegexToken('A', matchMeridiem); | |
addRegexToken('H', match1to2); | |
addRegexToken('h', match1to2); | |
addRegexToken('k', match1to2); | |
addRegexToken('HH', match1to2, match2); | |
addRegexToken('hh', match1to2, match2); | |
addRegexToken('kk', match1to2, match2); | |
addRegexToken('hmm', match3to4); | |
addRegexToken('hmmss', match5to6); | |
addRegexToken('Hmm', match3to4); | |
addRegexToken('Hmmss', match5to6); | |
addParseToken(['H', 'HH'], HOUR); | |
addParseToken(['k', 'kk'], function (input, array, config) { | |
var kInput = toInt(input); | |
array[HOUR] = kInput === 24 ? 0 : kInput; | |
}); | |
addParseToken(['a', 'A'], function (input, array, config) { | |
config._isPm = config._locale.isPM(input); | |
config._meridiem = input; | |
}); | |
addParseToken(['h', 'hh'], function (input, array, config) { | |
array[HOUR] = toInt(input); | |
getParsingFlags(config).bigHour = true; | |
}); | |
addParseToken('hmm', function (input, array, config) { | |
var pos = input.length - 2; | |
array[HOUR] = toInt(input.substr(0, pos)); | |
array[MINUTE] = toInt(input.substr(pos)); | |
getParsingFlags(config).bigHour = true; | |
}); | |
addParseToken('hmmss', function (input, array, config) { | |
var pos1 = input.length - 4; | |
var pos2 = input.length - 2; | |
array[HOUR] = toInt(input.substr(0, pos1)); | |
array[MINUTE] = toInt(input.substr(pos1, 2)); | |
array[SECOND] = toInt(input.substr(pos2)); | |
getParsingFlags(config).bigHour = true; | |
}); | |
addParseToken('Hmm', function (input, array, config) { | |
var pos = input.length - 2; | |
array[HOUR] = toInt(input.substr(0, pos)); | |
array[MINUTE] = toInt(input.substr(pos)); | |
}); | |
addParseToken('Hmmss', function (input, array, config) { | |
var pos1 = input.length - 4; | |
var pos2 = input.length - 2; | |
array[HOUR] = toInt(input.substr(0, pos1)); | |
array[MINUTE] = toInt(input.substr(pos1, 2)); | |
array[SECOND] = toInt(input.substr(pos2)); | |
}); | |
// LOCALES | |
function localeIsPM (input) { | |
// IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays | |
// Using charAt should be more compatible. | |
return ((input + '').toLowerCase().charAt(0) === 'p'); | |
} | |
var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i; | |
function localeMeridiem (hours, minutes, isLower) { | |
if (hours > 11) { | |
return isLower ? 'pm' : 'PM'; | |
} else { | |
return isLower ? 'am' : 'AM'; | |
} | |
} | |
// MOMENTS | |
// Setting the hour should keep the time, because the user explicitly | |
// specified which hour they want. So trying to maintain the same hour (in | |
// a new timezone) makes sense. Adding/subtracting hours does not follow | |
// this rule. | |
var getSetHour = makeGetSet('Hours', true); | |
var baseConfig = { | |
calendar: defaultCalendar, | |
longDateFormat: defaultLongDateFormat, | |
invalidDate: defaultInvalidDate, | |
ordinal: defaultOrdinal, | |
dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse, | |
relativeTime: defaultRelativeTime, | |
months: defaultLocaleMonths, | |
monthsShort: defaultLocaleMonthsShort, | |
week: defaultLocaleWeek, | |
weekdays: defaultLocaleWeekdays, | |
weekdaysMin: defaultLocaleWeekdaysMin, | |
weekdaysShort: defaultLocaleWeekdaysShort, | |
meridiemParse: defaultLocaleMeridiemParse | |
}; | |
// internal storage for locale config files | |
var locales = {}; | |
var localeFamilies = {}; | |
var globalLocale; | |
function normalizeLocale(key) { | |
return key ? key.toLowerCase().replace('_', '-') : key; | |
} | |
// pick the locale from the array | |
// try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each | |
// substring from most specific to least, but move to the next array item if it's a more specific variant than the current root | |
function chooseLocale(names) { | |
var i = 0, j, next, locale, split; | |
while (i < names.length) { | |
split = normalizeLocale(names[i]).split('-'); | |
j = split.length; | |
next = normalizeLocale(names[i + 1]); | |
next = next ? next.split('-') : null; | |
while (j > 0) { | |
locale = loadLocale(split.slice(0, j).join('-')); | |
if (locale) { | |
return locale; | |
} | |
if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) { | |
//the next array item is better than a shallower substring of this one | |
break; | |
} | |
j--; | |
} | |
i++; | |
} | |
return globalLocale; | |
} | |
function loadLocale(name) { | |
var oldLocale = null; | |
// TODO: Find a better way to register and load all the locales in Node | |
if (!locales[name] && (typeof module !== 'undefined') && | |
module && module.exports) { | |
try { | |
oldLocale = globalLocale._abbr; | |
var aliasedRequire = require; | |
__webpack_require__(727)("./" + name); | |
getSetGlobalLocale(oldLocale); | |
} catch (e) {} | |
} | |
return locales[name]; | |
} | |
// This function will load locale and then set the global locale. If | |
// no arguments are passed in, it will simply return the current global | |
// locale key. | |
function getSetGlobalLocale (key, values) { | |
var data; | |
if (key) { | |
if (isUndefined(values)) { | |
data = getLocale(key); | |
} | |
else { | |
data = defineLocale(key, values); | |
} | |
if (data) { | |
// moment.duration._locale = moment._locale = data; | |
globalLocale = data; | |
} | |
else { | |
if ((typeof console !== 'undefined') && console.warn) { | |
//warn user if arguments are passed but the locale could not be set | |
console.warn('Locale ' + key + ' not found. Did you forget to load it?'); | |
} | |
} | |
} | |
return globalLocale._abbr; | |
} | |
function defineLocale (name, config) { | |
if (config !== null) { | |
var locale, parentConfig = baseConfig; | |
config.abbr = name; | |
if (locales[name] != null) { | |
deprecateSimple('defineLocaleOverride', | |
'use moment.updateLocale(localeName, config) to change ' + | |
'an existing locale. moment.defineLocale(localeName, ' + | |
'config) should only be used for creating a new locale ' + | |
'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.'); | |
parentConfig = locales[name]._config; | |
} else if (config.parentLocale != null) { | |
if (locales[config.parentLocale] != null) { | |
parentConfig = locales[config.parentLocale]._config; | |
} else { | |
locale = loadLocale(config.parentLocale); | |
if (locale != null) { | |
parentConfig = locale._config; | |
} else { | |
if (!localeFamilies[config.parentLocale]) { | |
localeFamilies[config.parentLocale] = []; | |
} | |
localeFamilies[config.parentLocale].push({ | |
name: name, | |
config: config | |
}); | |
return null; | |
} | |
} | |
} | |
locales[name] = new Locale(mergeConfigs(parentConfig, config)); | |
if (localeFamilies[name]) { | |
localeFamilies[name].forEach(function (x) { | |
defineLocale(x.name, x.config); | |
}); | |
} | |
// backwards compat for now: also set the locale | |
// make sure we set the locale AFTER all child locales have been | |
// created, so we won't end up with the child locale set. | |
getSetGlobalLocale(name); | |
return locales[name]; | |
} else { | |
// useful for testing | |
delete locales[name]; | |
return null; | |
} | |
} | |
function updateLocale(name, config) { | |
if (config != null) { | |
var locale, tmpLocale, parentConfig = baseConfig; | |
// MERGE | |
tmpLocale = loadLocale(name); | |
if (tmpLocale != null) { | |
parentConfig = tmpLocale._config; | |
} | |
config = mergeConfigs(parentConfig, config); | |
locale = new Locale(config); | |
locale.parentLocale = locales[name]; | |
locales[name] = locale; | |
// backwards compat for now: also set the locale | |
getSetGlobalLocale(name); | |
} else { | |
// pass null for config to unupdate, useful for tests | |
if (locales[name] != null) { | |
if (locales[name].parentLocale != null) { | |
locales[name] = locales[name].parentLocale; | |
} else if (locales[name] != null) { | |
delete locales[name]; | |
} | |
} | |
} | |
return locales[name]; | |
} | |
// returns locale data | |
function getLocale (key) { | |
var locale; | |
if (key && key._locale && key._locale._abbr) { | |
key = key._locale._abbr; | |
} | |
if (!key) { | |
return globalLocale; | |
} | |
if (!isArray(key)) { | |
//short-circuit everything else | |
locale = loadLocale(key); | |
if (locale) { | |
return locale; | |
} | |
key = [key]; | |
} | |
return chooseLocale(key); | |
} | |
function listLocales() { | |
return keys(locales); | |
} | |
function checkOverflow (m) { | |
var overflow; | |
var a = m._a; | |
if (a && getParsingFlags(m).overflow === -2) { | |
overflow = | |
a[MONTH] < 0 || a[MONTH] > 11 ? MONTH : | |
a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) ? DATE : | |
a[HOUR] < 0 || a[HOUR] > 24 || (a[HOUR] === 24 && (a[MINUTE] !== 0 || a[SECOND] !== 0 || a[MILLISECOND] !== 0)) ? HOUR : | |
a[MINUTE] < 0 || a[MINUTE] > 59 ? MINUTE : | |
a[SECOND] < 0 || a[SECOND] > 59 ? SECOND : | |
a[MILLISECOND] < 0 || a[MILLISECOND] > 999 ? MILLISECOND : | |
-1; | |
if (getParsingFlags(m)._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) { | |
overflow = DATE; | |
} | |
if (getParsingFlags(m)._overflowWeeks && overflow === -1) { | |
overflow = WEEK; | |
} | |
if (getParsingFlags(m)._overflowWeekday && overflow === -1) { | |
overflow = WEEKDAY; | |
} | |
getParsingFlags(m).overflow = overflow; | |
} | |
return m; | |
} | |
// Pick the first defined of two or three arguments. | |
function defaults(a, b, c) { | |
if (a != null) { | |
return a; | |
} | |
if (b != null) { | |
return b; | |
} | |
return c; | |
} | |
function currentDateArray(config) { | |
// hooks is actually the exported moment object | |
var nowValue = new Date(hooks.now()); | |
if (config._useUTC) { | |
return [nowValue.getUTCFullYear(), nowValue.getUTCMonth(), nowValue.getUTCDate()]; | |
} | |
return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()]; | |
} | |
// convert an array to a date. | |
// the array should mirror the parameters below | |
// note: all values past the year are optional and will default to the lowest possible value. | |
// [year, month, day , hour, minute, second, millisecond] | |
function configFromArray (config) { | |
var i, date, input = [], currentDate, expectedWeekday, yearToUse; | |
if (config._d) { | |
return; | |
} | |
currentDate = currentDateArray(config); | |
//compute day of the year from weeks and weekdays | |
if (config._w && config._a[DATE] == null && config._a[MONTH] == null) { | |
dayOfYearFromWeekInfo(config); | |
} | |
//if the day of the year is set, figure out what it is | |
if (config._dayOfYear != null) { | |
yearToUse = defaults(config._a[YEAR], currentDate[YEAR]); | |
if (config._dayOfYear > daysInYear(yearToUse) || config._dayOfYear === 0) { | |
getParsingFlags(config)._overflowDayOfYear = true; | |
} | |
date = createUTCDate(yearToUse, 0, config._dayOfYear); | |
config._a[MONTH] = date.getUTCMonth(); | |
config._a[DATE] = date.getUTCDate(); | |
} | |
// Default to current date. | |
// * if no year, month, day of month are given, default to today | |
// * if day of month is given, default month and year | |
// * if month is given, default only year | |
// * if year is given, don't default anything | |
for (i = 0; i < 3 && config._a[i] == null; ++i) { | |
config._a[i] = input[i] = currentDate[i]; | |
} | |
// Zero out whatever was not defaulted, including time | |
for (; i < 7; i++) { | |
config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i]; | |
} | |
// Check for 24:00:00.000 | |
if (config._a[HOUR] === 24 && | |
config._a[MINUTE] === 0 && | |
config._a[SECOND] === 0 && | |
config._a[MILLISECOND] === 0) { | |
config._nextDay = true; | |
config._a[HOUR] = 0; | |
} | |
config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input); | |
expectedWeekday = config._useUTC ? config._d.getUTCDay() : config._d.getDay(); | |
// Apply timezone offset from input. The actual utcOffset can be changed | |
// with parseZone. | |
if (config._tzm != null) { | |
config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm); | |
} | |
if (config._nextDay) { | |
config._a[HOUR] = 24; | |
} | |
// check for mismatching day of week | |
if (config._w && typeof config._w.d !== 'undefined' && config._w.d !== expectedWeekday) { | |
getParsingFlags(config).weekdayMismatch = true; | |
} | |
} | |
function dayOfYearFromWeekInfo(config) { | |
var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow; | |
w = config._w; | |
if (w.GG != null || w.W != null || w.E != null) { | |
dow = 1; | |
doy = 4; | |
// TODO: We need to take the current isoWeekYear, but that depends on | |
// how we interpret now (local, utc, fixed offset). So create | |
// a now version of current config (take local/utc/offset flags, and | |
// create now). | |
weekYear = defaults(w.GG, config._a[YEAR], weekOfYear(createLocal(), 1, 4).year); | |
week = defaults(w.W, 1); | |
weekday = defaults(w.E, 1); | |
if (weekday < 1 || weekday > 7) { | |
weekdayOverflow = true; | |
} | |
} else { | |
dow = config._locale._week.dow; | |
doy = config._locale._week.doy; | |
var curWeek = weekOfYear(createLocal(), dow, doy); | |
weekYear = defaults(w.gg, config._a[YEAR], curWeek.year); | |
// Default to current week. | |
week = defaults(w.w, curWeek.week); | |
if (w.d != null) { | |
// weekday -- low day numbers are considered next week | |
weekday = w.d; | |
if (weekday < 0 || weekday > 6) { | |
weekdayOverflow = true; | |
} | |
} else if (w.e != null) { | |
// local weekday -- counting starts from beginning of week | |
weekday = w.e + dow; | |
if (w.e < 0 || w.e > 6) { | |
weekdayOverflow = true; | |
} | |
} else { | |
// default to beginning of week | |
weekday = dow; | |
} | |
} | |
if (week < 1 || week > weeksInYear(weekYear, dow, doy)) { | |
getParsingFlags(config)._overflowWeeks = true; | |
} else if (weekdayOverflow != null) { | |
getParsingFlags(config)._overflowWeekday = true; | |
} else { | |
temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy); | |
config._a[YEAR] = temp.year; | |
config._dayOfYear = temp.dayOfYear; | |
} | |
} | |
// iso 8601 regex | |
// 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00) | |
var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/; | |
var basicIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/; | |
var tzRegex = /Z|[+-]\d\d(?::?\d\d)?/; | |
var isoDates = [ | |
['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/], | |
['YYYY-MM-DD', /\d{4}-\d\d-\d\d/], | |
['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/], | |
['GGGG-[W]WW', /\d{4}-W\d\d/, false], | |
['YYYY-DDD', /\d{4}-\d{3}/], | |
['YYYY-MM', /\d{4}-\d\d/, false], | |
['YYYYYYMMDD', /[+-]\d{10}/], | |
['YYYYMMDD', /\d{8}/], | |
// YYYYMM is NOT allowed by the standard | |
['GGGG[W]WWE', /\d{4}W\d{3}/], | |
['GGGG[W]WW', /\d{4}W\d{2}/, false], | |
['YYYYDDD', /\d{7}/] | |
]; | |
// iso time formats and regexes | |
var isoTimes = [ | |
['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/], | |
['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/], | |
['HH:mm:ss', /\d\d:\d\d:\d\d/], | |
['HH:mm', /\d\d:\d\d/], | |
['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/], | |
['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/], | |
['HHmmss', /\d\d\d\d\d\d/], | |
['HHmm', /\d\d\d\d/], | |
['HH', /\d\d/] | |
]; | |
var aspNetJsonRegex = /^\/?Date\((\-?\d+)/i; | |
// date from iso format | |
function configFromISO(config) { | |
var i, l, | |
string = config._i, | |
match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string), | |
allowTime, dateFormat, timeFormat, tzFormat; | |
if (match) { | |
getParsingFlags(config).iso = true; | |
for (i = 0, l = isoDates.length; i < l; i++) { | |
if (isoDates[i][1].exec(match[1])) { | |
dateFormat = isoDates[i][0]; | |
allowTime = isoDates[i][2] !== false; | |
break; | |
} | |
} | |
if (dateFormat == null) { | |
config._isValid = false; | |
return; | |
} | |
if (match[3]) { | |
for (i = 0, l = isoTimes.length; i < l; i++) { | |
if (isoTimes[i][1].exec(match[3])) { | |
// match[2] should be 'T' or space | |
timeFormat = (match[2] || ' ') + isoTimes[i][0]; | |
break; | |
} | |
} | |
if (timeFormat == null) { | |
config._isValid = false; | |
return; | |
} | |
} | |
if (!allowTime && timeFormat != null) { | |
config._isValid = false; | |
return; | |
} | |
if (match[4]) { | |
if (tzRegex.exec(match[4])) { | |
tzFormat = 'Z'; | |
} else { | |
config._isValid = false; | |
return; | |
} | |
} | |
config._f = dateFormat + (timeFormat || '') + (tzFormat || ''); | |
configFromStringAndFormat(config); | |
} else { | |
config._isValid = false; | |
} | |
} | |
// RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3 | |
var rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/; | |
function extractFromRFC2822Strings(yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) { | |
var result = [ | |
untruncateYear(yearStr), | |
defaultLocaleMonthsShort.indexOf(monthStr), | |
parseInt(dayStr, 10), | |
parseInt(hourStr, 10), | |
parseInt(minuteStr, 10) | |
]; | |
if (secondStr) { | |
result.push(parseInt(secondStr, 10)); | |
} | |
return result; | |
} | |
function untruncateYear(yearStr) { | |
var year = parseInt(yearStr, 10); | |
if (year <= 49) { | |
return 2000 + year; | |
} else if (year <= 999) { | |
return 1900 + year; | |
} | |
return year; | |
} | |
function preprocessRFC2822(s) { | |
// Remove comments and folding whitespace and replace multiple-spaces with a single space | |
return s.replace(/\([^)]*\)|[\n\t]/g, ' ').replace(/(\s\s+)/g, ' ').replace(/^\s\s*/, '').replace(/\s\s*$/, ''); | |
} | |
function checkWeekday(weekdayStr, parsedInput, config) { | |
if (weekdayStr) { | |
// TODO: Replace the vanilla JS Date object with an indepentent day-of-week check. | |
var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr), | |
weekdayActual = new Date(parsedInput[0], parsedInput[1], parsedInput[2]).getDay(); | |
if (weekdayProvided !== weekdayActual) { | |
getParsingFlags(config).weekdayMismatch = true; | |
config._isValid = false; | |
return false; | |
} | |
} | |
return true; | |
} | |
var obsOffsets = { | |
UT: 0, | |
GMT: 0, | |
EDT: -4 * 60, | |
EST: -5 * 60, | |
CDT: -5 * 60, | |
CST: -6 * 60, | |
MDT: -6 * 60, | |
MST: -7 * 60, | |
PDT: -7 * 60, | |
PST: -8 * 60 | |
}; | |
function calculateOffset(obsOffset, militaryOffset, numOffset) { | |
if (obsOffset) { | |
return obsOffsets[obsOffset]; | |
} else if (militaryOffset) { | |
// the only allowed military tz is Z | |
return 0; | |
} else { | |
var hm = parseInt(numOffset, 10); | |
var m = hm % 100, h = (hm - m) / 100; | |
return h * 60 + m; | |
} | |
} | |
// date and time from ref 2822 format | |
function configFromRFC2822(config) { | |
var match = rfc2822.exec(preprocessRFC2822(config._i)); | |
if (match) { | |
var parsedArray = extractFromRFC2822Strings(match[4], match[3], match[2], match[5], match[6], match[7]); | |
if (!checkWeekday(match[1], parsedArray, config)) { | |
return; | |
} | |
config._a = parsedArray; | |
config._tzm = calculateOffset(match[8], match[9], match[10]); | |
config._d = createUTCDate.apply(null, config._a); | |
config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm); | |
getParsingFlags(config).rfc2822 = true; | |
} else { | |
config._isValid = false; | |
} | |
} | |
// date from iso format or fallback | |
function configFromString(config) { | |
var matched = aspNetJsonRegex.exec(config._i); | |
if (matched !== null) { | |
config._d = new Date(+matched[1]); | |
return; | |
} | |
configFromISO(config); | |
if (config._isValid === false) { | |
delete config._isValid; | |
} else { | |
return; | |
} | |
configFromRFC2822(config); | |
if (config._isValid === false) { | |
delete config._isValid; | |
} else { | |
return; | |
} | |
// Final attempt, use Input Fallback | |
hooks.createFromInputFallback(config); | |
} | |
hooks.createFromInputFallback = deprecate( | |
'value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), ' + | |
'which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are ' + | |
'discouraged and will be removed in an upcoming major release. Please refer to ' + | |
'http://momentjs.com/guides/#/warnings/js-date/ for more info.', | |
function (config) { | |
config._d = new Date(config._i + (config._useUTC ? ' UTC' : '')); | |
} | |
); | |
// constant that refers to the ISO standard | |
hooks.ISO_8601 = function () {}; | |
// constant that refers to the RFC 2822 form | |
hooks.RFC_2822 = function () {}; | |
// date from string and format string | |
function configFromStringAndFormat(config) { | |
// TODO: Move this to another part of the creation flow to prevent circular deps | |
if (config._f === hooks.ISO_8601) { | |
configFromISO(config); | |
return; | |
} | |
if (config._f === hooks.RFC_2822) { | |
configFromRFC2822(config); | |
return; | |
} | |
config._a = []; | |
getParsingFlags(config).empty = true; | |
// This array is used to make a Date, either with `new Date` or `Date.UTC` | |
var string = '' + config._i, | |
i, parsedInput, tokens, token, skipped, | |
stringLength = string.length, | |
totalParsedInputLength = 0; | |
tokens = expandFormat(config._f, config._locale).match(formattingTokens) || []; | |
for (i = 0; i < tokens.length; i++) { | |
token = tokens[i]; | |
parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0]; | |
// console.log('token', token, 'parsedInput', parsedInput, | |
// 'regex', getParseRegexForToken(token, config)); | |
if (parsedInput) { | |
skipped = string.substr(0, string.indexOf(parsedInput)); | |
if (skipped.length > 0) { | |
getParsingFlags(config).unusedInput.push(skipped); | |
} | |
string = string.slice(string.indexOf(parsedInput) + parsedInput.length); | |
totalParsedInputLength += parsedInput.length; | |
} | |
// don't parse if it's not a known token | |
if (formatTokenFunctions[token]) { | |
if (parsedInput) { | |
getParsingFlags(config).empty = false; | |
} | |
else { | |
getParsingFlags(config).unusedTokens.push(token); | |
} | |
addTimeToArrayFromToken(token, parsedInput, config); | |
} | |
else if (config._strict && !parsedInput) { | |
getParsingFlags(config).unusedTokens.push(token); | |
} | |
} | |
// add remaining unparsed input length to the string | |
getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength; | |
if (string.length > 0) { | |
getParsingFlags(config).unusedInput.push(string); | |
} | |
// clear _12h flag if hour is <= 12 | |
if (config._a[HOUR] <= 12 && | |
getParsingFlags(config).bigHour === true && | |
config._a[HOUR] > 0) { | |
getParsingFlags(config).bigHour = undefined; | |
} | |
getParsingFlags(config).parsedDateParts = config._a.slice(0); | |
getParsingFlags(config).meridiem = config._meridiem; | |
// handle meridiem | |
config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem); | |
configFromArray(config); | |
checkOverflow(config); | |
} | |
function meridiemFixWrap (locale, hour, meridiem) { | |
var isPm; | |
if (meridiem == null) { | |
// nothing to do | |
return hour; | |
} | |
if (locale.meridiemHour != null) { | |
return locale.meridiemHour(hour, meridiem); | |
} else if (locale.isPM != null) { | |
// Fallback | |
isPm = locale.isPM(meridiem); | |
if (isPm && hour < 12) { | |
hour += 12; | |
} | |
if (!isPm && hour === 12) { | |
hour = 0; | |
} | |
return hour; | |
} else { | |
// this is not supposed to happen | |
return hour; | |
} | |
} | |
// date from string and array of format strings | |
function configFromStringAndArray(config) { | |
var tempConfig, | |
bestMoment, | |
scoreToBeat, | |
i, | |
currentScore; | |
if (config._f.length === 0) { | |
getParsingFlags(config).invalidFormat = true; | |
config._d = new Date(NaN); | |
return; | |
} | |
for (i = 0; i < config._f.length; i++) { | |
currentScore = 0; | |
tempConfig = copyConfig({}, config); | |
if (config._useUTC != null) { | |
tempConfig._useUTC = config._useUTC; | |
} | |
tempConfig._f = config._f[i]; | |
configFromStringAndFormat(tempConfig); | |
if (!isValid(tempConfig)) { | |
continue; | |
} | |
// if there is any input that was not parsed add a penalty for that format | |
currentScore += getParsingFlags(tempConfig).charsLeftOver; | |
//or tokens | |
currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10; | |
getParsingFlags(tempConfig).score = currentScore; | |
if (scoreToBeat == null || currentScore < scoreToBeat) { | |
scoreToBeat = currentScore; | |
bestMoment = tempConfig; | |
} | |
} | |
extend(config, bestMoment || tempConfig); | |
} | |
function configFromObject(config) { | |
if (config._d) { | |
return; | |
} | |
var i = normalizeObjectUnits(config._i); | |
config._a = map([i.year, i.month, i.day || i.date, i.hour, i.minute, i.second, i.millisecond], function (obj) { | |
return obj && parseInt(obj, 10); | |
}); | |
configFromArray(config); | |
} | |
function createFromConfig (config) { | |
var res = new Moment(checkOverflow(prepareConfig(config))); | |
if (res._nextDay) { | |
// Adding is smart enough around DST | |
res.add(1, 'd'); | |
res._nextDay = undefined; | |
} | |
return res; | |
} | |
function prepareConfig (config) { | |
var input = config._i, | |
format = config._f; | |
config._locale = config._locale || getLocale(config._l); | |
if (input === null || (format === undefined && input === '')) { | |
return createInvalid({nullInput: true}); | |
} | |
if (typeof input === 'string') { | |
config._i = input = config._locale.preparse(input); | |
} | |
if (isMoment(input)) { | |
return new Moment(checkOverflow(input)); | |
} else if (isDate(input)) { | |
config._d = input; | |
} else if (isArray(format)) { | |
configFromStringAndArray(config); | |
} else if (format) { | |
configFromStringAndFormat(config); | |
} else { | |
configFromInput(config); | |
} | |
if (!isValid(config)) { | |
config._d = null; | |
} | |
return config; | |
} | |
function configFromInput(config) { | |
var input = config._i; | |
if (isUndefined(input)) { | |
config._d = new Date(hooks.now()); | |
} else if (isDate(input)) { | |
config._d = new Date(input.valueOf()); | |
} else if (typeof input === 'string') { | |
configFromString(config); | |
} else if (isArray(input)) { | |
config._a = map(input.slice(0), function (obj) { | |
return parseInt(obj, 10); | |
}); | |
configFromArray(config); | |
} else if (isObject(input)) { | |
configFromObject(config); | |
} else if (isNumber(input)) { | |
// from milliseconds | |
config._d = new Date(input); | |
} else { | |
hooks.createFromInputFallback(config); | |
} | |
} | |
function createLocalOrUTC (input, format, locale, strict, isUTC) { | |
var c = {}; | |
if (locale === true || locale === false) { | |
strict = locale; | |
locale = undefined; | |
} | |
if ((isObject(input) && isObjectEmpty(input)) || | |
(isArray(input) && input.length === 0)) { | |
input = undefined; | |
} | |
// object construction must be done this way. | |
// https://github.com/moment/moment/issues/1423 | |
c._isAMomentObject = true; | |
c._useUTC = c._isUTC = isUTC; | |
c._l = locale; | |
c._i = input; | |
c._f = format; | |
c._strict = strict; | |
return createFromConfig(c); | |
} | |
function createLocal (input, format, locale, strict) { | |
return createLocalOrUTC(input, format, locale, strict, false); | |
} | |
var prototypeMin = deprecate( | |
'moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/', | |
function () { | |
var other = createLocal.apply(null, arguments); | |
if (this.isValid() && other.isValid()) { | |
return other < this ? this : other; | |
} else { | |
return createInvalid(); | |
} | |
} | |
); | |
var prototypeMax = deprecate( | |
'moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/', | |
function () { | |
var other = createLocal.apply(null, arguments); | |
if (this.isValid() && other.isValid()) { | |
return other > this ? this : other; | |
} else { | |
return createInvalid(); | |
} | |
} | |
); | |
// Pick a moment m from moments so that m[fn](other) is true for all | |
// other. This relies on the function fn to be transitive. | |
// | |
// moments should either be an array of moment objects or an array, whose | |
// first element is an array of moment objects. | |
function pickBy(fn, moments) { | |
var res, i; | |
if (moments.length === 1 && isArray(moments[0])) { | |
moments = moments[0]; | |
} | |
if (!moments.length) { | |
return createLocal(); | |
} | |
res = moments[0]; | |
for (i = 1; i < moments.length; ++i) { | |
if (!moments[i].isValid() || moments[i][fn](res)) { | |
res = moments[i]; | |
} | |
} | |
return res; | |
} | |
// TODO: Use [].sort instead? | |
function min () { | |
var args = [].slice.call(arguments, 0); | |
return pickBy('isBefore', args); | |
} | |
function max () { | |
var args = [].slice.call(arguments, 0); | |
return pickBy('isAfter', args); | |
} | |
var now = function () { | |
return Date.now ? Date.now() : +(new Date()); | |
}; | |
var ordering = ['year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', 'millisecond']; | |
function isDurationValid(m) { | |
for (var key in m) { | |
if (!(indexOf.call(ordering, key) !== -1 && (m[key] == null || !isNaN(m[key])))) { | |
return false; | |
} | |
} | |
var unitHasDecimal = false; | |
for (var i = 0; i < ordering.length; ++i) { | |
if (m[ordering[i]]) { | |
if (unitHasDecimal) { | |
return false; // only allow non-integers for smallest unit | |
} | |
if (parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]])) { | |
unitHasDecimal = true; | |
} | |
} | |
} | |
return true; | |
} | |
function isValid$1() { | |
return this._isValid; | |
} | |
function createInvalid$1() { | |
return createDuration(NaN); | |
} | |
function Duration (duration) { | |
var normalizedInput = normalizeObjectUnits(duration), | |
years = normalizedInput.year || 0, | |
quarters = normalizedInput.quarter || 0, | |
months = normalizedInput.month || 0, | |
weeks = normalizedInput.week || normalizedInput.isoWeek || 0, | |
days = normalizedInput.day || 0, | |
hours = normalizedInput.hour || 0, | |
minutes = normalizedInput.minute || 0, | |
seconds = normalizedInput.second || 0, | |
milliseconds = normalizedInput.millisecond || 0; | |
this._isValid = isDurationValid(normalizedInput); | |
// representation for dateAddRemove | |
this._milliseconds = +milliseconds + | |
seconds * 1e3 + // 1000 | |
minutes * 6e4 + // 1000 * 60 | |
hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978 | |
// Because of dateAddRemove treats 24 hours as different from a | |
// day when working around DST, we need to store them separately | |
this._days = +days + | |
weeks * 7; | |
// It is impossible to translate months into days without knowing | |
// which months you are are talking about, so we have to store | |
// it separately. | |
this._months = +months + | |
quarters * 3 + | |
years * 12; | |
this._data = {}; | |
this._locale = getLocale(); | |
this._bubble(); | |
} | |
function isDuration (obj) { | |
return obj instanceof Duration; | |
} | |
function absRound (number) { | |
if (number < 0) { | |
return Math.round(-1 * number) * -1; | |
} else { | |
return Math.round(number); | |
} | |
} | |
// FORMATTING | |
function offset (token, separator) { | |
addFormatToken(token, 0, 0, function () { | |
var offset = this.utcOffset(); | |
var sign = '+'; | |
if (offset < 0) { | |
offset = -offset; | |
sign = '-'; | |
} | |
return sign + zeroFill(~~(offset / 60), 2) + separator + zeroFill(~~(offset) % 60, 2); | |
}); | |
} | |
offset('Z', ':'); | |
offset('ZZ', ''); | |
// PARSING | |
addRegexToken('Z', matchShortOffset); | |
addRegexToken('ZZ', matchShortOffset); | |
addParseToken(['Z', 'ZZ'], function (input, array, config) { | |
config._useUTC = true; | |
config._tzm = offsetFromString(matchShortOffset, input); | |
}); | |
// HELPERS | |
// timezone chunker | |
// '+10:00' > ['10', '00'] | |
// '-1530' > ['-15', '30'] | |
var chunkOffset = /([\+\-]|\d\d)/gi; | |
function offsetFromString(matcher, string) { | |
var matches = (string || '').match(matcher); | |
if (matches === null) { | |
return null; | |
} | |
var chunk = matches[matches.length - 1] || []; | |
var parts = (chunk + '').match(chunkOffset) || ['-', 0, 0]; | |
var minutes = +(parts[1] * 60) + toInt(parts[2]); | |
return minutes === 0 ? | |
0 : | |
parts[0] === '+' ? minutes : -minutes; | |
} | |
// Return a moment from input, that is local/utc/zone equivalent to model. | |
function cloneWithOffset(input, model) { | |
var res, diff; | |
if (model._isUTC) { | |
res = model.clone(); | |
diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf(); | |
// Use low-level api, because this fn is low-level api. | |
res._d.setTime(res._d.valueOf() + diff); | |
hooks.updateOffset(res, false); | |
return res; | |
} else { | |
return createLocal(input).local(); | |
} | |
} | |
function getDateOffset (m) { | |
// On Firefox.24 Date#getTimezoneOffset returns a floating point. | |
// https://github.com/moment/moment/pull/1871 | |
return -Math.round(m._d.getTimezoneOffset() / 15) * 15; | |
} | |
// HOOKS | |
// This function will be called whenever a moment is mutated. | |
// It is intended to keep the offset in sync with the timezone. | |
hooks.updateOffset = function () {}; | |
// MOMENTS | |
// keepLocalTime = true means only change the timezone, without | |
// affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]--> | |
// 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset | |
// +0200, so we adjust the time as needed, to be valid. | |
// | |
// Keeping the time actually adds/subtracts (one hour) | |
// from the actual represented time. That is why we call updateOffset | |
// a second time. In case it wants us to change the offset again | |
// _changeInProgress == true case, then we have to adjust, because | |
// there is no such time in the given timezone. | |
function getSetOffset (input, keepLocalTime, keepMinutes) { | |
var offset = this._offset || 0, | |
localAdjust; | |
if (!this.isValid()) { | |
return input != null ? this : NaN; | |
} | |
if (input != null) { | |
if (typeof input === 'string') { | |
input = offsetFromString(matchShortOffset, input); | |
if (input === null) { | |
return this; | |
} | |
} else if (Math.abs(input) < 16 && !keepMinutes) { | |
input = input * 60; | |
} | |
if (!this._isUTC && keepLocalTime) { | |
localAdjust = getDateOffset(this); | |
} | |
this._offset = input; | |
this._isUTC = true; | |
if (localAdjust != null) { | |
this.add(localAdjust, 'm'); | |
} | |
if (offset !== input) { | |
if (!keepLocalTime || this._changeInProgress) { | |
addSubtract(this, createDuration(input - offset, 'm'), 1, false); | |
} else if (!this._changeInProgress) { | |
this._changeInProgress = true; | |
hooks.updateOffset(this, true); | |
this._changeInProgress = null; | |
} | |
} | |
return this; | |
} else { | |
return this._isUTC ? offset : getDateOffset(this); | |
} | |
} | |
function getSetZone (input, keepLocalTime) { | |
if (input != null) { | |
if (typeof input !== 'string') { | |
input = -input; | |
} | |
this.utcOffset(input, keepLocalTime); | |
return this; | |
} else { | |
return -this.utcOffset(); | |
} | |
} | |
function setOffsetToUTC (keepLocalTime) { | |
return this.utcOffset(0, keepLocalTime); | |
} | |
function setOffsetToLocal (keepLocalTime) { | |
if (this._isUTC) { | |
this.utcOffset(0, keepLocalTime); | |
this._isUTC = false; | |
if (keepLocalTime) { | |
this.subtract(getDateOffset(this), 'm'); | |
} | |
} | |
return this; | |
} | |
function setOffsetToParsedOffset () { | |
if (this._tzm != null) { | |
this.utcOffset(this._tzm, false, true); | |
} else if (typeof this._i === 'string') { | |
var tZone = offsetFromString(matchOffset, this._i); | |
if (tZone != null) { | |
this.utcOffset(tZone); | |
} | |
else { | |
this.utcOffset(0, true); | |
} | |
} | |
return this; | |
} | |
function hasAlignedHourOffset (input) { | |
if (!this.isValid()) { | |
return false; | |
} | |
input = input ? createLocal(input).utcOffset() : 0; | |
return (this.utcOffset() - input) % 60 === 0; | |
} | |
function isDaylightSavingTime () { | |
return ( | |
this.utcOffset() > this.clone().month(0).utcOffset() || | |
this.utcOffset() > this.clone().month(5).utcOffset() | |
); | |
} | |
function isDaylightSavingTimeShifted () { | |
if (!isUndefined(this._isDSTShifted)) { | |
return this._isDSTShifted; | |
} | |
var c = {}; | |
copyConfig(c, this); | |
c = prepareConfig(c); | |
if (c._a) { | |
var other = c._isUTC ? createUTC(c._a) : createLocal(c._a); | |
this._isDSTShifted = this.isValid() && | |
compareArrays(c._a, other.toArray()) > 0; | |
} else { | |
this._isDSTShifted = false; | |
} | |
return this._isDSTShifted; | |
} | |
function isLocal () { | |
return this.isValid() ? !this._isUTC : false; | |
} | |
function isUtcOffset () { | |
return this.isValid() ? this._isUTC : false; | |
} | |
function isUtc () { | |
return this.isValid() ? this._isUTC && this._offset === 0 : false; | |
} | |
// ASP.NET json date format regex | |
var aspNetRegex = /^(\-|\+)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/; | |
// from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html | |
// somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere | |
// and further modified to allow for strings containing both week and day | |
var isoRegex = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/; | |
function createDuration (input, key) { | |
var duration = input, | |
// matching against regexp is expensive, do it on demand | |
match = null, | |
sign, | |
ret, | |
diffRes; | |
if (isDuration(input)) { | |
duration = { | |
ms : input._milliseconds, | |
d : input._days, | |
M : input._months | |
}; | |
} else if (isNumber(input)) { | |
duration = {}; | |
if (key) { | |
duration[key] = input; | |
} else { | |
duration.milliseconds = input; | |
} | |
} else if (!!(match = aspNetRegex.exec(input))) { | |
sign = (match[1] === '-') ? -1 : 1; | |
duration = { | |
y : 0, | |
d : toInt(match[DATE]) * sign, | |
h : toInt(match[HOUR]) * sign, | |
m : toInt(match[MINUTE]) * sign, | |
s : toInt(match[SECOND]) * sign, | |
ms : toInt(absRound(match[MILLISECOND] * 1000)) * sign // the millisecond decimal point is included in the match | |
}; | |
} else if (!!(match = isoRegex.exec(input))) { | |
sign = (match[1] === '-') ? -1 : 1; | |
duration = { | |
y : parseIso(match[2], sign), | |
M : parseIso(match[3], sign), | |
w : parseIso(match[4], sign), | |
d : parseIso(match[5], sign), | |
h : parseIso(match[6], sign), | |
m : parseIso(match[7], sign), | |
s : parseIso(match[8], sign) | |
}; | |
} else if (duration == null) {// checks for null or undefined | |
duration = {}; | |
} else if (typeof duration === 'object' && ('from' in duration || 'to' in duration)) { | |
diffRes = momentsDifference(createLocal(duration.from), createLocal(duration.to)); | |
duration = {}; | |
duration.ms = diffRes.milliseconds; | |
duration.M = diffRes.months; | |
} | |
ret = new Duration(duration); | |
if (isDuration(input) && hasOwnProp(input, '_locale')) { | |
ret._locale = input._locale; | |
} | |
return ret; | |
} | |
createDuration.fn = Duration.prototype; | |
createDuration.invalid = createInvalid$1; | |
function parseIso (inp, sign) { | |
// We'd normally use ~~inp for this, but unfortunately it also | |
// converts floats to ints. | |
// inp may be undefined, so careful calling replace on it. | |
var res = inp && parseFloat(inp.replace(',', '.')); | |
// apply sign while we're at it | |
return (isNaN(res) ? 0 : res) * sign; | |
} | |
function positiveMomentsDifference(base, other) { | |
var res = {}; | |
res.months = other.month() - base.month() + | |
(other.year() - base.year()) * 12; | |
if (base.clone().add(res.months, 'M').isAfter(other)) { | |
--res.months; | |
} | |
res.milliseconds = +other - +(base.clone().add(res.months, 'M')); | |
return res; | |
} | |
function momentsDifference(base, other) { | |
var res; | |
if (!(base.isValid() && other.isValid())) { | |
return {milliseconds: 0, months: 0}; | |
} | |
other = cloneWithOffset(other, base); | |
if (base.isBefore(other)) { | |
res = positiveMomentsDifference(base, other); | |
} else { | |
res = positiveMomentsDifference(other, base); | |
res.milliseconds = -res.milliseconds; | |
res.months = -res.months; | |
} | |
return res; | |
} | |
// TODO: remove 'name' arg after deprecation is removed | |
function createAdder(direction, name) { | |
return function (val, period) { | |
var dur, tmp; | |
//invert the arguments, but complain about it | |
if (period !== null && !isNaN(+period)) { | |
deprecateSimple(name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period). ' + | |
'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.'); | |
tmp = val; val = period; period = tmp; | |
} | |
val = typeof val === 'string' ? +val : val; | |
dur = createDuration(val, period); | |
addSubtract(this, dur, direction); | |
return this; | |
}; | |
} | |
function addSubtract (mom, duration, isAdding, updateOffset) { | |
var milliseconds = duration._milliseconds, | |
days = absRound(duration._days), | |
months = absRound(duration._months); | |
if (!mom.isValid()) { | |
// No op | |
return; | |
} | |
updateOffset = updateOffset == null ? true : updateOffset; | |
if (months) { | |
setMonth(mom, get(mom, 'Month') + months * isAdding); | |
} | |
if (days) { | |
set$1(mom, 'Date', get(mom, 'Date') + days * isAdding); | |
} | |
if (milliseconds) { | |
mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding); | |
} | |
if (updateOffset) { | |
hooks.updateOffset(mom, days || months); | |
} | |
} | |
var add = createAdder(1, 'add'); | |
var subtract = createAdder(-1, 'subtract'); | |
function getCalendarFormat(myMoment, now) { | |
var diff = myMoment.diff(now, 'days', true); | |
return diff < -6 ? 'sameElse' : | |
diff < -1 ? 'lastWeek' : | |
diff < 0 ? 'lastDay' : | |
diff < 1 ? 'sameDay' : | |
diff < 2 ? 'nextDay' : | |
diff < 7 ? 'nextWeek' : 'sameElse'; | |
} | |
function calendar$1 (time, formats) { | |
// We want to compare the start of today, vs this. | |
// Getting start-of-today depends on whether we're local/utc/offset or not. | |
var now = time || createLocal(), | |
sod = cloneWithOffset(now, this).startOf('day'), | |
format = hooks.calendarFormat(this, sod) || 'sameElse'; | |
var output = formats && (isFunction(formats[format]) ? formats[format].call(this, now) : formats[format]); | |
return this.format(output || this.localeData().calendar(format, this, createLocal(now))); | |
} | |
function clone () { | |
return new Moment(this); | |
} | |
function isAfter (input, units) { | |
var localInput = isMoment(input) ? input : createLocal(input); | |
if (!(this.isValid() && localInput.isValid())) { | |
return false; | |
} | |
units = normalizeUnits(units) || 'millisecond'; | |
if (units === 'millisecond') { | |
return this.valueOf() > localInput.valueOf(); | |
} else { | |
return localInput.valueOf() < this.clone().startOf(units).valueOf(); | |
} | |
} | |
function isBefore (input, units) { | |
var localInput = isMoment(input) ? input : createLocal(input); | |
if (!(this.isValid() && localInput.isValid())) { | |
return false; | |
} | |
units = normalizeUnits(units) || 'millisecond'; | |
if (units === 'millisecond') { | |
return this.valueOf() < localInput.valueOf(); | |
} else { | |
return this.clone().endOf(units).valueOf() < localInput.valueOf(); | |
} | |
} | |
function isBetween (from, to, units, inclusivity) { | |
var localFrom = isMoment(from) ? from : createLocal(from), | |
localTo = isMoment(to) ? to : createLocal(to); | |
if (!(this.isValid() && localFrom.isValid() && localTo.isValid())) { | |
return false; | |
} | |
inclusivity = inclusivity || '()'; | |
return (inclusivity[0] === '(' ? this.isAfter(localFrom, units) : !this.isBefore(localFrom, units)) && | |
(inclusivity[1] === ')' ? this.isBefore(localTo, units) : !this.isAfter(localTo, units)); | |
} | |
function isSame (input, units) { | |
var localInput = isMoment(input) ? input : createLocal(input), | |
inputMs; | |
if (!(this.isValid() && localInput.isValid())) { | |
return false; | |
} | |
units = normalizeUnits(units) || 'millisecond'; | |
if (units === 'millisecond') { | |
return this.valueOf() === localInput.valueOf(); | |
} else { | |
inputMs = localInput.valueOf(); | |
return this.clone().startOf(units).valueOf() <= inputMs && inputMs <= this.clone().endOf(units).valueOf(); | |
} | |
} | |
function isSameOrAfter (input, units) { | |
return this.isSame(input, units) || this.isAfter(input, units); | |
} | |
function isSameOrBefore (input, units) { | |
return this.isSame(input, units) || this.isBefore(input, units); | |
} | |
function diff (input, units, asFloat) { | |
var that, | |
zoneDelta, | |
output; | |
if (!this.isValid()) { | |
return NaN; | |
} | |
that = cloneWithOffset(input, this); | |
if (!that.isValid()) { | |
return NaN; | |
} | |
zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4; | |
units = normalizeUnits(units); | |
switch (units) { | |
case 'year': output = monthDiff(this, that) / 12; break; | |
case 'month': output = monthDiff(this, that); break; | |
case 'quarter': output = monthDiff(this, that) / 3; break; | |
case 'second': output = (this - that) / 1e3; break; // 1000 | |
case 'minute': output = (this - that) / 6e4; break; // 1000 * 60 | |
case 'hour': output = (this - that) / 36e5; break; // 1000 * 60 * 60 | |
case 'day': output = (this - that - zoneDelta) / 864e5; break; // 1000 * 60 * 60 * 24, negate dst | |
case 'week': output = (this - that - zoneDelta) / 6048e5; break; // 1000 * 60 * 60 * 24 * 7, negate dst | |
default: output = this - that; | |
} | |
return asFloat ? output : absFloor(output); | |
} | |
function monthDiff (a, b) { | |
// difference in months | |
var wholeMonthDiff = ((b.year() - a.year()) * 12) + (b.month() - a.month()), | |
// b is in (anchor - 1 month, anchor + 1 month) | |
anchor = a.clone().add(wholeMonthDiff, 'months'), | |
anchor2, adjust; | |
if (b - anchor < 0) { | |
anchor2 = a.clone().add(wholeMonthDiff - 1, 'months'); | |
// linear across the month | |
adjust = (b - anchor) / (anchor - anchor2); | |
} else { | |
anchor2 = a.clone().add(wholeMonthDiff + 1, 'months'); | |
// linear across the month | |
adjust = (b - anchor) / (anchor2 - anchor); | |
} | |
//check for negative zero, return zero if negative zero | |
return -(wholeMonthDiff + adjust) || 0; | |
} | |
hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ'; | |
hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]'; | |
function toString () { | |
return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ'); | |
} | |
function toISOString(keepOffset) { | |
if (!this.isValid()) { | |
return null; | |
} | |
var utc = keepOffset !== true; | |
var m = utc ? this.clone().utc() : this; | |
if (m.year() < 0 || m.year() > 9999) { | |
return formatMoment(m, utc ? 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYYYY-MM-DD[T]HH:mm:ss.SSSZ'); | |
} | |
if (isFunction(Date.prototype.toISOString)) { | |
// native implementation is ~50x faster, use it when we can | |
if (utc) { | |
return this.toDate().toISOString(); | |
} else { | |
return new Date(this.valueOf() + this.utcOffset() * 60 * 1000).toISOString().replace('Z', formatMoment(m, 'Z')); | |
} | |
} | |
return formatMoment(m, utc ? 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYY-MM-DD[T]HH:mm:ss.SSSZ'); | |
} | |
/** | |
* Return a human readable representation of a moment that can | |
* also be evaluated to get a new moment which is the same | |
* | |
* @link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | |
*/ | |
function inspect () { | |
if (!this.isValid()) { | |
return 'moment.invalid(/* ' + this._i + ' */)'; | |
} | |
var func = 'moment'; | |
var zone = ''; | |
if (!this.isLocal()) { | |
func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone'; | |
zone = 'Z'; | |
} | |
var prefix = '[' + func + '("]'; | |
var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY'; | |
var datetime = '-MM-DD[T]HH:mm:ss.SSS'; | |
var suffix = zone + '[")]'; | |
return this.format(prefix + year + datetime + suffix); | |
} | |
function format (inputString) { | |
if (!inputString) { | |
inputString = this.isUtc() ? hooks.defaultFormatUtc : hooks.defaultFormat; | |
} | |
var output = formatMoment(this, inputString); | |
return this.localeData().postformat(output); | |
} | |
function from (time, withoutSuffix) { | |
if (this.isValid() && | |
((isMoment(time) && time.isValid()) || | |
createLocal(time).isValid())) { | |
return createDuration({to: this, from: time}).locale(this.locale()).humanize(!withoutSuffix); | |
} else { | |
return this.localeData().invalidDate(); | |
} | |
} | |
function fromNow (withoutSuffix) { | |
return this.from(createLocal(), withoutSuffix); | |
} | |
function to (time, withoutSuffix) { | |
if (this.isValid() && | |
((isMoment(time) && time.isValid()) || | |
createLocal(time).isValid())) { | |
return createDuration({from: this, to: time}).locale(this.locale()).humanize(!withoutSuffix); | |
} else { | |
return this.localeData().invalidDate(); | |
} | |
} | |
function toNow (withoutSuffix) { | |
return this.to(createLocal(), withoutSuffix); | |
} | |
// If passed a locale key, it will set the locale for this | |
// instance. Otherwise, it will return the locale configuration | |
// variables for this instance. | |
function locale (key) { | |
var newLocaleData; | |
if (key === undefined) { | |
return this._locale._abbr; | |
} else { | |
newLocaleData = getLocale(key); | |
if (newLocaleData != null) { | |
this._locale = newLocaleData; | |
} | |
return this; | |
} | |
} | |
var lang = deprecate( | |
'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.', | |
function (key) { | |
if (key === undefined) { | |
return this.localeData(); | |
} else { | |
return this.locale(key); | |
} | |
} | |
); | |
function localeData () { | |
return this._locale; | |
} | |
var MS_PER_SECOND = 1000; | |
var MS_PER_MINUTE = 60 * MS_PER_SECOND; | |
var MS_PER_HOUR = 60 * MS_PER_MINUTE; | |
var MS_PER_400_YEARS = (365 * 400 + 97) * 24 * MS_PER_HOUR; | |
// actual modulo - handles negative numbers (for dates before 1970): | |
function mod$1(dividend, divisor) { | |
return (dividend % divisor + divisor) % divisor; | |
} | |
function localStartOfDate(y, m, d) { | |
// the date constructor remaps years 0-99 to 1900-1999 | |
if (y < 100 && y >= 0) { | |
// preserve leap years using a full 400 year cycle, then reset | |
return new Date(y + 400, m, d) - MS_PER_400_YEARS; | |
} else { | |
return new Date(y, m, d).valueOf(); | |
} | |
} | |
function utcStartOfDate(y, m, d) { | |
// Date.UTC remaps years 0-99 to 1900-1999 | |
if (y < 100 && y >= 0) { | |
// preserve leap years using a full 400 year cycle, then reset | |
return Date.UTC(y + 400, m, d) - MS_PER_400_YEARS; | |
} else { | |
return Date.UTC(y, m, d); | |
} | |
} | |
function startOf (units) { | |
var time; | |
units = normalizeUnits(units); | |
if (units === undefined || units === 'millisecond' || !this.isValid()) { | |
return this; | |
} | |
var startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate; | |
switch (units) { | |
case 'year': | |
time = startOfDate(this.year(), 0, 1); | |
break; | |
case 'quarter': | |
time = startOfDate(this.year(), this.month() - this.month() % 3, 1); | |
break; | |
case 'month': | |
time = startOfDate(this.year(), this.month(), 1); | |
break; | |
case 'week': | |
time = startOfDate(this.year(), this.month(), this.date() - this.weekday()); | |
break; | |
case 'isoWeek': | |
time = startOfDate(this.year(), this.month(), this.date() - (this.isoWeekday() - 1)); | |
break; | |
case 'day': | |
case 'date': | |
time = startOfDate(this.year(), this.month(), this.date()); | |
break; | |
case 'hour': | |
time = this._d.valueOf(); | |
time -= mod$1(time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE), MS_PER_HOUR); | |
break; | |
case 'minute': | |
time = this._d.valueOf(); | |
time -= mod$1(time, MS_PER_MINUTE); | |
break; | |
case 'second': | |
time = this._d.valueOf(); | |
time -= mod$1(time, MS_PER_SECOND); | |
break; | |
} | |
this._d.setTime(time); | |
hooks.updateOffset(this, true); | |
return this; | |
} | |
function endOf (units) { | |
var time; | |
units = normalizeUnits(units); | |
if (units === undefined || units === 'millisecond' || !this.isValid()) { | |
return this; | |
} | |
var startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate; | |
switch (units) { | |
case 'year': | |
time = startOfDate(this.year() + 1, 0, 1) - 1; | |
break; | |
case 'quarter': | |
time = startOfDate(this.year(), this.month() - this.month() % 3 + 3, 1) - 1; | |
break; | |
case 'month': | |
time = startOfDate(this.year(), this.month() + 1, 1) - 1; | |
break; | |
case 'week': | |
time = startOfDate(this.year(), this.month(), this.date() - this.weekday() + 7) - 1; | |
break; | |
case 'isoWeek': | |
time = startOfDate(this.year(), this.month(), this.date() - (this.isoWeekday() - 1) + 7) - 1; | |
break; | |
case 'day': | |
case 'date': | |
time = startOfDate(this.year(), this.month(), this.date() + 1) - 1; | |
break; | |
case 'hour': | |
time = this._d.valueOf(); | |
time += MS_PER_HOUR - mod$1(time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE), MS_PER_HOUR) - 1; | |
break; | |
case 'minute': | |
time = this._d.valueOf(); | |
time += MS_PER_MINUTE - mod$1(time, MS_PER_MINUTE) - 1; | |
break; | |
case 'second': | |
time = this._d.valueOf(); | |
time += MS_PER_SECOND - mod$1(time, MS_PER_SECOND) - 1; | |
break; | |
} | |
this._d.setTime(time); | |
hooks.updateOffset(this, true); | |
return this; | |
} | |
function valueOf () { | |
return this._d.valueOf() - ((this._offset || 0) * 60000); | |
} | |
function unix () { | |
return Math.floor(this.valueOf() / 1000); | |
} | |
function toDate () { | |
return new Date(this.valueOf()); | |
} | |
function toArray () { | |
var m = this; | |
return [m.year(), m.month(), m.date(), m.hour(), m.minute(), m.second(), m.millisecond()]; | |
} | |
function toObject () { | |
var m = this; | |
return { | |
years: m.year(), | |
months: m.month(), | |
date: m.date(), | |
hours: m.hours(), | |
minutes: m.minutes(), | |
seconds: m.seconds(), | |
milliseconds: m.milliseconds() | |
}; | |
} | |
function toJSON () { | |
// new Date(NaN).toJSON() === null | |
return this.isValid() ? this.toISOString() : null; | |
} | |
function isValid$2 () { | |
return isValid(this); | |
} | |
function parsingFlags () { | |
return extend({}, getParsingFlags(this)); | |
} | |
function invalidAt () { | |
return getParsingFlags(this).overflow; | |
} | |
function creationData() { | |
return { | |
input: this._i, | |
format: this._f, | |
locale: this._locale, | |
isUTC: this._isUTC, | |
strict: this._strict | |
}; | |
} | |
// FORMATTING | |
addFormatToken(0, ['gg', 2], 0, function () { | |
return this.weekYear() % 100; | |
}); | |
addFormatToken(0, ['GG', 2], 0, function () { | |
return this.isoWeekYear() % 100; | |
}); | |
function addWeekYearFormatToken (token, getter) { | |
addFormatToken(0, [token, token.length], 0, getter); | |
} | |
addWeekYearFormatToken('gggg', 'weekYear'); | |
addWeekYearFormatToken('ggggg', 'weekYear'); | |
addWeekYearFormatToken('GGGG', 'isoWeekYear'); | |
addWeekYearFormatToken('GGGGG', 'isoWeekYear'); | |
// ALIASES | |
addUnitAlias('weekYear', 'gg'); | |
addUnitAlias('isoWeekYear', 'GG'); | |
// PRIORITY | |
addUnitPriority('weekYear', 1); | |
addUnitPriority('isoWeekYear', 1); | |
// PARSING | |
addRegexToken('G', matchSigned); | |
addRegexToken('g', matchSigned); | |
addRegexToken('GG', match1to2, match2); | |
addRegexToken('gg', match1to2, match2); | |
addRegexToken('GGGG', match1to4, match4); | |
addRegexToken('gggg', match1to4, match4); | |
addRegexToken('GGGGG', match1to6, match6); | |
addRegexToken('ggggg', match1to6, match6); | |
addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (input, week, config, token) { | |
week[token.substr(0, 2)] = toInt(input); | |
}); | |
addWeekParseToken(['gg', 'GG'], function (input, week, config, token) { | |
week[token] = hooks.parseTwoDigitYear(input); | |
}); | |
// MOMENTS | |
function getSetWeekYear (input) { | |
return getSetWeekYearHelper.call(this, | |
input, | |
this.week(), | |
this.weekday(), | |
this.localeData()._week.dow, | |
this.localeData()._week.doy); | |
} | |
function getSetISOWeekYear (input) { | |
return getSetWeekYearHelper.call(this, | |
input, this.isoWeek(), this.isoWeekday(), 1, 4); | |
} | |
function getISOWeeksInYear () { | |
return weeksInYear(this.year(), 1, 4); | |
} | |
function getWeeksInYear () { | |
var weekInfo = this.localeData()._week; | |
return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy); | |
} | |
function getSetWeekYearHelper(input, week, weekday, dow, doy) { | |
var weeksTarget; | |
if (input == null) { | |
return weekOfYear(this, dow, doy).year; | |
} else { | |
weeksTarget = weeksInYear(input, dow, doy); | |
if (week > weeksTarget) { | |
week = weeksTarget; | |
} | |
return setWeekAll.call(this, input, week, weekday, dow, doy); | |
} | |
} | |
function setWeekAll(weekYear, week, weekday, dow, doy) { | |
var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy), | |
date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear); | |
this.year(date.getUTCFullYear()); | |
this.month(date.getUTCMonth()); | |
this.date(date.getUTCDate()); | |
return this; | |
} | |
// FORMATTING | |
addFormatToken('Q', 0, 'Qo', 'quarter'); | |
// ALIASES | |
addUnitAlias('quarter', 'Q'); | |
// PRIORITY | |
addUnitPriority('quarter', 7); | |
// PARSING | |
addRegexToken('Q', match1); | |
addParseToken('Q', function (input, array) { | |
array[MONTH] = (toInt(input) - 1) * 3; | |
}); | |
// MOMENTS | |
function getSetQuarter (input) { | |
return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3); | |
} | |
// FORMATTING | |
addFormatToken('D', ['DD', 2], 'Do', 'date'); | |
// ALIASES | |
addUnitAlias('date', 'D'); | |
// PRIORITY | |
addUnitPriority('date', 9); | |
// PARSING | |
addRegexToken('D', match1to2); | |
addRegexToken('DD', match1to2, match2); | |
addRegexToken('Do', function (isStrict, locale) { | |
// TODO: Remove "ordinalParse" fallback in next major release. | |
return isStrict ? | |
(locale._dayOfMonthOrdinalParse || locale._ordinalParse) : | |
locale._dayOfMonthOrdinalParseLenient; | |
}); | |
addParseToken(['D', 'DD'], DATE); | |
addParseToken('Do', function (input, array) { | |
array[DATE] = toInt(input.match(match1to2)[0]); | |
}); | |
// MOMENTS | |
var getSetDayOfMonth = makeGetSet('Date', true); | |
// FORMATTING | |
addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear'); | |
// ALIASES | |
addUnitAlias('dayOfYear', 'DDD'); | |
// PRIORITY | |
addUnitPriority('dayOfYear', 4); | |
// PARSING | |
addRegexToken('DDD', match1to3); | |
addRegexToken('DDDD', match3); | |
addParseToken(['DDD', 'DDDD'], function (input, array, config) { | |
config._dayOfYear = toInt(input); | |
}); | |
// HELPERS | |
// MOMENTS | |
function getSetDayOfYear (input) { | |
var dayOfYear = Math.round((this.clone().startOf('day') - this.clone().startOf('year')) / 864e5) + 1; | |
return input == null ? dayOfYear : this.add((input - dayOfYear), 'd'); | |
} | |
// FORMATTING | |
addFormatToken('m', ['mm', 2], 0, 'minute'); | |
// ALIASES | |
addUnitAlias('minute', 'm'); | |
// PRIORITY | |
addUnitPriority('minute', 14); | |
// PARSING | |
addRegexToken('m', match1to2); | |
addRegexToken('mm', match1to2, match2); | |
addParseToken(['m', 'mm'], MINUTE); | |
// MOMENTS | |
var getSetMinute = makeGetSet('Minutes', false); | |
// FORMATTING | |
addFormatToken('s', ['ss', 2], 0, 'second'); | |
// ALIASES | |
addUnitAlias('second', 's'); | |
// PRIORITY | |
addUnitPriority('second', 15); | |
// PARSING | |
addRegexToken('s', match1to2); | |
addRegexToken('ss', match1to2, match2); | |
addParseToken(['s', 'ss'], SECOND); | |
// MOMENTS | |
var getSetSecond = makeGetSet('Seconds', false); | |
// FORMATTING | |
addFormatToken('S', 0, 0, function () { | |
return ~~(this.millisecond() / 100); | |
}); | |
addFormatToken(0, ['SS', 2], 0, function () { | |
return ~~(this.millisecond() / 10); | |
}); | |
addFormatToken(0, ['SSS', 3], 0, 'millisecond'); | |
addFormatToken(0, ['SSSS', 4], 0, function () { | |
return this.millisecond() * 10; | |
}); | |
addFormatToken(0, ['SSSSS', 5], 0, function () { | |
return this.millisecond() * 100; | |
}); | |
addFormatToken(0, ['SSSSSS', 6], 0, function () { | |
return this.millisecond() * 1000; | |
}); | |
addFormatToken(0, ['SSSSSSS', 7], 0, function () { | |
return this.millisecond() * 10000; | |
}); | |
addFormatToken(0, ['SSSSSSSS', 8], 0, function () { | |
return this.millisecond() * 100000; | |
}); | |
addFormatToken(0, ['SSSSSSSSS', 9], 0, function () { | |
return this.millisecond() * 1000000; | |
}); | |
// ALIASES | |
addUnitAlias('millisecond', 'ms'); | |
// PRIORITY | |
addUnitPriority('millisecond', 16); | |
// PARSING | |
addRegexToken('S', match1to3, match1); | |
addRegexToken('SS', match1to3, match2); | |
addRegexToken('SSS', match1to3, match3); | |
var token; | |
for (token = 'SSSS'; token.length <= 9; token += 'S') { | |
addRegexToken(token, matchUnsigned); | |
} | |
function parseMs(input, array) { | |
array[MILLISECOND] = toInt(('0.' + input) * 1000); | |
} | |
for (token = 'S'; token.length <= 9; token += 'S') { | |
addParseToken(token, parseMs); | |
} | |
// MOMENTS | |
var getSetMillisecond = makeGetSet('Milliseconds', false); | |
// FORMATTING | |
addFormatToken('z', 0, 0, 'zoneAbbr'); | |
addFormatToken('zz', 0, 0, 'zoneName'); | |
// MOMENTS | |
function getZoneAbbr () { | |
return this._isUTC ? 'UTC' : ''; | |
} | |
function getZoneName () { | |
return this._isUTC ? 'Coordinated Universal Time' : ''; | |
} | |
var proto = Moment.prototype; | |
proto.add = add; | |
proto.calendar = calendar$1; | |
proto.clone = clone; | |
proto.diff = diff; | |
proto.endOf = endOf; | |
proto.format = format; | |
proto.from = from; | |
proto.fromNow = fromNow; | |
proto.to = to; | |
proto.toNow = toNow; | |
proto.get = stringGet; | |
proto.invalidAt = invalidAt; | |
proto.isAfter = isAfter; | |
proto.isBefore = isBefore; | |
proto.isBetween = isBetween; | |
proto.isSame = isSame; | |
proto.isSameOrAfter = isSameOrAfter; | |
proto.isSameOrBefore = isSameOrBefore; | |
proto.isValid = isValid$2; | |
proto.lang = lang; | |
proto.locale = locale; | |
proto.localeData = localeData; | |
proto.max = prototypeMax; | |
proto.min = prototypeMin; | |
proto.parsingFlags = parsingFlags; | |
proto.set = stringSet; | |
proto.startOf = startOf; | |
proto.subtract = subtract; | |
proto.toArray = toArray; | |
proto.toObject = toObject; | |
proto.toDate = toDate; | |
proto.toISOString = toISOString; | |
proto.inspect = inspect; | |
proto.toJSON = toJSON; | |
proto.toString = toString; | |
proto.unix = unix; | |
proto.valueOf = valueOf; | |
proto.creationData = creationData; | |
proto.year = getSetYear; | |
proto.isLeapYear = getIsLeapYear; | |
proto.weekYear = getSetWeekYear; | |
proto.isoWeekYear = getSetISOWeekYear; | |
proto.quarter = proto.quarters = getSetQuarter; | |
proto.month = getSetMonth; | |
proto.daysInMonth = getDaysInMonth; | |
proto.week = proto.weeks = getSetWeek; | |
proto.isoWeek = proto.isoWeeks = getSetISOWeek; | |
proto.weeksInYear = getWeeksInYear; | |
proto.isoWeeksInYear = getISOWeeksInYear; | |
proto.date = getSetDayOfMonth; | |
proto.day = proto.days = getSetDayOfWeek; | |
proto.weekday = getSetLocaleDayOfWeek; | |
proto.isoWeekday = getSetISODayOfWeek; | |
proto.dayOfYear = getSetDayOfYear; | |
proto.hour = proto.hours = getSetHour; | |
proto.minute = proto.minutes = getSetMinute; | |
proto.second = proto.seconds = getSetSecond; | |
proto.millisecond = proto.milliseconds = getSetMillisecond; | |
proto.utcOffset = getSetOffset; | |
proto.utc = setOffsetToUTC; | |
proto.local = setOffsetToLocal; | |
proto.parseZone = setOffsetToParsedOffset; | |
proto.hasAlignedHourOffset = hasAlignedHourOffset; | |
proto.isDST = isDaylightSavingTime; | |
proto.isLocal = isLocal; | |
proto.isUtcOffset = isUtcOffset; | |
proto.isUtc = isUtc; | |
proto.isUTC = isUtc; | |
proto.zoneAbbr = getZoneAbbr; | |
proto.zoneName = getZoneName; | |
proto.dates = deprecate('dates accessor is deprecated. Use date instead.', getSetDayOfMonth); | |
proto.months = deprecate('months accessor is deprecated. Use month instead', getSetMonth); | |
proto.years = deprecate('years accessor is deprecated. Use year instead', getSetYear); | |
proto.zone = deprecate('moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/', getSetZone); | |
proto.isDSTShifted = deprecate('isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information', isDaylightSavingTimeShifted); | |
function createUnix (input) { | |
return createLocal(input * 1000); | |
} | |
function createInZone () { | |
return createLocal.apply(null, arguments).parseZone(); | |
} | |
function preParsePostFormat (string) { | |
return string; | |
} | |
var proto$1 = Locale.prototype; | |
proto$1.calendar = calendar; | |
proto$1.longDateFormat = longDateFormat; | |
proto$1.invalidDate = invalidDate; | |
proto$1.ordinal = ordinal; | |
proto$1.preparse = preParsePostFormat; | |
proto$1.postformat = preParsePostFormat; | |
proto$1.relativeTime = relativeTime; | |
proto$1.pastFuture = pastFuture; | |
proto$1.set = set; | |
proto$1.months = localeMonths; | |
proto$1.monthsShort = localeMonthsShort; | |
proto$1.monthsParse = localeMonthsParse; | |
proto$1.monthsRegex = monthsRegex; | |
proto$1.monthsShortRegex = monthsShortRegex; | |
proto$1.week = localeWeek; | |
proto$1.firstDayOfYear = localeFirstDayOfYear; | |
proto$1.firstDayOfWeek = localeFirstDayOfWeek; | |
proto$1.weekdays = localeWeekdays; | |
proto$1.weekdaysMin = localeWeekdaysMin; | |
proto$1.weekdaysShort = localeWeekdaysShort; | |
proto$1.weekdaysParse = localeWeekdaysParse; | |
proto$1.weekdaysRegex = weekdaysRegex; | |
proto$1.weekdaysShortRegex = weekdaysShortRegex; | |
proto$1.weekdaysMinRegex = weekdaysMinRegex; | |
proto$1.isPM = localeIsPM; | |
proto$1.meridiem = localeMeridiem; | |
function get$1 (format, index, field, setter) { | |
var locale = getLocale(); | |
var utc = createUTC().set(setter, index); | |
return locale[field](utc, format); | |
} | |
function listMonthsImpl (format, index, field) { | |
if (isNumber(format)) { | |
index = format; | |
format = undefined; | |
} | |
format = format || ''; | |
if (index != null) { | |
return get$1(format, index, field, 'month'); | |
} | |
var i; | |
var out = []; | |
for (i = 0; i < 12; i++) { | |
out[i] = get$1(format, i, field, 'month'); | |
} | |
return out; | |
} | |
// () | |
// (5) | |
// (fmt, 5) | |
// (fmt) | |
// (true) | |
// (true, 5) | |
// (true, fmt, 5) | |
// (true, fmt) | |
function listWeekdaysImpl (localeSorted, format, index, field) { | |
if (typeof localeSorted === 'boolean') { | |
if (isNumber(format)) { | |
index = format; | |
format = undefined; | |
} | |
format = format || ''; | |
} else { | |
format = localeSorted; | |
index = format; | |
localeSorted = false; | |
if (isNumber(format)) { | |
index = format; | |
format = undefined; | |
} | |
format = format || ''; | |
} | |
var locale = getLocale(), | |
shift = localeSorted ? locale._week.dow : 0; | |
if (index != null) { | |
return get$1(format, (index + shift) % 7, field, 'day'); | |
} | |
var i; | |
var out = []; | |
for (i = 0; i < 7; i++) { | |
out[i] = get$1(format, (i + shift) % 7, field, 'day'); | |
} | |
return out; | |
} | |
function listMonths (format, index) { | |
return listMonthsImpl(format, index, 'months'); | |
} | |
function listMonthsShort (format, index) { | |
return listMonthsImpl(format, index, 'monthsShort'); | |
} | |
function listWeekdays (localeSorted, format, index) { | |
return listWeekdaysImpl(localeSorted, format, index, 'weekdays'); | |
} | |
function listWeekdaysShort (localeSorted, format, index) { | |
return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort'); | |
} | |
function listWeekdaysMin (localeSorted, format, index) { | |
return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin'); | |
} | |
getSetGlobalLocale('en', { | |
dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/, | |
ordinal : function (number) { | |
var b = number % 10, | |
output = (toInt(number % 100 / 10) === 1) ? 'th' : | |
(b === 1) ? 'st' : | |
(b === 2) ? 'nd' : | |
(b === 3) ? 'rd' : 'th'; | |
return number + output; | |
} | |
}); | |
// Side effect imports | |
hooks.lang = deprecate('moment.lang is deprecated. Use moment.locale instead.', getSetGlobalLocale); | |
hooks.langData = deprecate('moment.langData is deprecated. Use moment.localeData instead.', getLocale); | |
var mathAbs = Math.abs; | |
function abs () { | |
var data = this._data; | |
this._milliseconds = mathAbs(this._milliseconds); | |
this._days = mathAbs(this._days); | |
this._months = mathAbs(this._months); | |
data.milliseconds = mathAbs(data.milliseconds); | |
data.seconds = mathAbs(data.seconds); | |
data.minutes = mathAbs(data.minutes); | |
data.hours = mathAbs(data.hours); | |
data.months = mathAbs(data.months); | |
data.years = mathAbs(data.years); | |
return this; | |
} | |
function addSubtract$1 (duration, input, value, direction) { | |
var other = createDuration(input, value); | |
duration._milliseconds += direction * other._milliseconds; | |
duration._days += direction * other._days; | |
duration._months += direction * other._months; | |
return duration._bubble(); | |
} | |
// supports only 2.0-style add(1, 's') or add(duration) | |
function add$1 (input, value) { | |
return addSubtract$1(this, input, value, 1); | |
} | |
// supports only 2.0-style subtract(1, 's') or subtract(duration) | |
function subtract$1 (input, value) { | |
return addSubtract$1(this, input, value, -1); | |
} | |
function absCeil (number) { | |
if (number < 0) { | |
return Math.floor(number); | |
} else { | |
return Math.ceil(number); | |
} | |
} | |
function bubble () { | |
var milliseconds = this._milliseconds; | |
var days = this._days; | |
var months = this._months; | |
var data = this._data; | |
var seconds, minutes, hours, years, monthsFromDays; | |
// if we have a mix of positive and negative values, bubble down first | |
// check: https://github.com/moment/moment/issues/2166 | |
if (!((milliseconds >= 0 && days >= 0 && months >= 0) || | |
(milliseconds <= 0 && days <= 0 && months <= 0))) { | |
milliseconds += absCeil(monthsToDays(months) + days) * 864e5; | |
days = 0; | |
months = 0; | |
} | |
// The following code bubbles up values, see the tests for | |
// examples of what that means. | |
data.milliseconds = milliseconds % 1000; | |
seconds = absFloor(milliseconds / 1000); | |
data.seconds = seconds % 60; | |
minutes = absFloor(seconds / 60); | |
data.minutes = minutes % 60; | |
hours = absFloor(minutes / 60); | |
data.hours = hours % 24; | |
days += absFloor(hours / 24); | |
// convert days to months | |
monthsFromDays = absFloor(daysToMonths(days)); | |
months += monthsFromDays; | |
days -= absCeil(monthsToDays(monthsFromDays)); | |
// 12 months -> 1 year | |
years = absFloor(months / 12); | |
months %= 12; | |
data.days = days; | |
data.months = months; | |
data.years = years; | |
return this; | |
} | |
function daysToMonths (days) { | |
// 400 years have 146097 days (taking into account leap year rules) | |
// 400 years have 12 months === 4800 | |
return days * 4800 / 146097; | |
} | |
function monthsToDays (months) { | |
// the reverse of daysToMonths | |
return months * 146097 / 4800; | |
} | |
function as (units) { | |
if (!this.isValid()) { | |
return NaN; | |
} | |
var days; | |
var months; | |
var milliseconds = this._milliseconds; | |
units = normalizeUnits(units); | |
if (units === 'month' || units === 'quarter' || units === 'year') { | |
days = this._days + milliseconds / 864e5; | |
months = this._months + daysToMonths(days); | |
switch (units) { | |
case 'month': return months; | |
case 'quarter': return months / 3; | |
case 'year': return months / 12; | |
} | |
} else { | |
// handle milliseconds separately because of floating point math errors (issue #1867) | |
days = this._days + Math.round(monthsToDays(this._months)); | |
switch (units) { | |
case 'week' : return days / 7 + milliseconds / 6048e5; | |
case 'day' : return days + milliseconds / 864e5; | |
case 'hour' : return days * 24 + milliseconds / 36e5; | |
case 'minute' : return days * 1440 + milliseconds / 6e4; | |
case 'second' : return days * 86400 + milliseconds / 1000; | |
// Math.floor prevents floating point math errors here | |
case 'millisecond': return Math.floor(days * 864e5) + milliseconds; | |
default: throw new Error('Unknown unit ' + units); | |
} | |
} | |
} | |
// TODO: Use this.as('ms')? | |
function valueOf$1 () { | |
if (!this.isValid()) { | |
return NaN; | |
} | |
return ( | |
this._milliseconds + | |
this._days * 864e5 + | |
(this._months % 12) * 2592e6 + | |
toInt(this._months / 12) * 31536e6 | |
); | |
} | |
function makeAs (alias) { | |
return function () { | |
return this.as(alias); | |
}; | |
} | |
var asMilliseconds = makeAs('ms'); | |
var asSeconds = makeAs('s'); | |
var asMinutes = makeAs('m'); | |
var asHours = makeAs('h'); | |
var asDays = makeAs('d'); | |
var asWeeks = makeAs('w'); | |
var asMonths = makeAs('M'); | |
var asQuarters = makeAs('Q'); | |
var asYears = makeAs('y'); | |
function clone$1 () { | |
return createDuration(this); | |
} | |
function get$2 (units) { | |
units = normalizeUnits(units); | |
return this.isValid() ? this[units + 's']() : NaN; | |
} | |
function makeGetter(name) { | |
return function () { | |
return this.isValid() ? this._data[name] : NaN; | |
}; | |
} | |
var milliseconds = makeGetter('milliseconds'); | |
var seconds = makeGetter('seconds'); | |
var minutes = makeGetter('minutes'); | |
var hours = makeGetter('hours'); | |
var days = makeGetter('days'); | |
var months = makeGetter('months'); | |
var years = makeGetter('years'); | |
function weeks () { | |
return absFloor(this.days() / 7); | |
} | |
var round = Math.round; | |
var thresholds = { | |
ss: 44, // a few seconds to seconds | |
s : 45, // seconds to minute | |
m : 45, // minutes to hour | |
h : 22, // hours to day | |
d : 26, // days to month | |
M : 11 // months to year | |
}; | |
// helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize | |
function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) { | |
return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture); | |
} | |
function relativeTime$1 (posNegDuration, withoutSuffix, locale) { | |
var duration = createDuration(posNegDuration).abs(); | |
var seconds = round(duration.as('s')); | |
var minutes = round(duration.as('m')); | |
var hours = round(duration.as('h')); | |
var days = round(duration.as('d')); | |
var months = round(duration.as('M')); | |
var years = round(duration.as('y')); | |
var a = seconds <= thresholds.ss && ['s', seconds] || | |
seconds < thresholds.s && ['ss', seconds] || | |
minutes <= 1 && ['m'] || | |
minutes < thresholds.m && ['mm', minutes] || | |
hours <= 1 && ['h'] || | |
hours < thresholds.h && ['hh', hours] || | |
days <= 1 && ['d'] || | |
days < thresholds.d && ['dd', days] || | |
months <= 1 && ['M'] || | |
months < thresholds.M && ['MM', months] || | |
years <= 1 && ['y'] || ['yy', years]; | |
a[2] = withoutSuffix; | |
a[3] = +posNegDuration > 0; | |
a[4] = locale; | |
return substituteTimeAgo.apply(null, a); | |
} | |
// This function allows you to set the rounding function for relative time strings | |
function getSetRelativeTimeRounding (roundingFunction) { | |
if (roundingFunction === undefined) { | |
return round; | |
} | |
if (typeof(roundingFunction) === 'function') { | |
round = roundingFunction; | |
return true; | |
} | |
return false; | |
} | |
// This function allows you to set a threshold for relative time strings | |
function getSetRelativeTimeThreshold (threshold, limit) { | |
if (thresholds[threshold] === undefined) { | |
return false; | |
} | |
if (limit === undefined) { | |
return thresholds[threshold]; | |
} | |
thresholds[threshold] = limit; | |
if (threshold === 's') { | |
thresholds.ss = limit - 1; | |
} | |
return true; | |
} | |
function humanize (withSuffix) { | |
if (!this.isValid()) { | |
return this.localeData().invalidDate(); | |
} | |
var locale = this.localeData(); | |
var output = relativeTime$1(this, !withSuffix, locale); | |
if (withSuffix) { | |
output = locale.pastFuture(+this, output); | |
} | |
return locale.postformat(output); | |
} | |
var abs$1 = Math.abs; | |
function sign(x) { | |
return ((x > 0) - (x < 0)) || +x; | |
} | |
function toISOString$1() { | |
// for ISO strings we do not use the normal bubbling rules: | |
// * milliseconds bubble up until they become hours | |
// * days do not bubble at all | |
// * months bubble up until they become years | |
// This is because there is no context-free conversion between hours and days | |
// (think of clock changes) | |
// and also not between days and months (28-31 days per month) | |
if (!this.isValid()) { | |
return this.localeData().invalidDate(); | |
} | |
var seconds = abs$1(this._milliseconds) / 1000; | |
var days = abs$1(this._days); | |
var months = abs$1(this._months); | |
var minutes, hours, years; | |
// 3600 seconds -> 60 minutes -> 1 hour | |
minutes = absFloor(seconds / 60); | |
hours = absFloor(minutes / 60); | |
seconds %= 60; | |
minutes %= 60; | |
// 12 months -> 1 year | |
years = absFloor(months / 12); | |
months %= 12; | |
// inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js | |
var Y = years; | |
var M = months; | |
var D = days; | |
var h = hours; | |
var m = minutes; | |
var s = seconds ? seconds.toFixed(3).replace(/\.?0+$/, '') : ''; | |
var total = this.asSeconds(); | |
if (!total) { | |
// this is the same as C#'s (Noda) and python (isodate)... | |
// but not other JS (goog.date) | |
return 'P0D'; | |
} | |
var totalSign = total < 0 ? '-' : ''; | |
var ymSign = sign(this._months) !== sign(total) ? '-' : ''; | |
var daysSign = sign(this._days) !== sign(total) ? '-' : ''; | |
var hmsSign = sign(this._milliseconds) !== sign(total) ? '-' : ''; | |
return totalSign + 'P' + | |
(Y ? ymSign + Y + 'Y' : '') + | |
(M ? ymSign + M + 'M' : '') + | |
(D ? daysSign + D + 'D' : '') + | |
((h || m || s) ? 'T' : '') + | |
(h ? hmsSign + h + 'H' : '') + | |
(m ? hmsSign + m + 'M' : '') + | |
(s ? hmsSign + s + 'S' : ''); | |
} | |
var proto$2 = Duration.prototype; | |
proto$2.isValid = isValid$1; | |
proto$2.abs = abs; | |
proto$2.add = add$1; | |
proto$2.subtract = subtract$1; | |
proto$2.as = as; | |
proto$2.asMilliseconds = asMilliseconds; | |
proto$2.asSeconds = asSeconds; | |
proto$2.asMinutes = asMinutes; | |
proto$2.asHours = asHours; | |
proto$2.asDays = asDays; | |
proto$2.asWeeks = asWeeks; | |
proto$2.asMonths = asMonths; | |
proto$2.asQuarters = asQuarters; | |
proto$2.asYears = asYears; | |
proto$2.valueOf = valueOf$1; | |
proto$2._bubble = bubble; | |
proto$2.clone = clone$1; | |
proto$2.get = get$2; | |
proto$2.milliseconds = milliseconds; | |
proto$2.seconds = seconds; | |
proto$2.minutes = minutes; | |
proto$2.hours = hours; | |
proto$2.days = days; | |
proto$2.weeks = weeks; | |
proto$2.months = months; | |
proto$2.years = years; | |
proto$2.humanize = humanize; | |
proto$2.toISOString = toISOString$1; | |
proto$2.toString = toISOString$1; | |
proto$2.toJSON = toISOString$1; | |
proto$2.locale = locale; | |
proto$2.localeData = localeData; | |
proto$2.toIsoString = deprecate('toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)', toISOString$1); | |
proto$2.lang = lang; | |
// Side effect imports | |
// FORMATTING | |
addFormatToken('X', 0, 0, 'unix'); | |
addFormatToken('x', 0, 0, 'valueOf'); | |
// PARSING | |
addRegexToken('x', matchSigned); | |
addRegexToken('X', matchTimestamp); | |
addParseToken('X', function (input, array, config) { | |
config._d = new Date(parseFloat(input, 10) * 1000); | |
}); | |
addParseToken('x', function (input, array, config) { | |
config._d = new Date(toInt(input)); | |
}); | |
// Side effect imports | |
hooks.version = '2.24.0'; | |
setHookCallback(createLocal); | |
hooks.fn = proto; | |
hooks.min = min; | |
hooks.max = max; | |
hooks.now = now; | |
hooks.utc = createUTC; | |
hooks.unix = createUnix; | |
hooks.months = listMonths; | |
hooks.isDate = isDate; | |
hooks.locale = getSetGlobalLocale; | |
hooks.invalid = createInvalid; | |
hooks.duration = createDuration; | |
hooks.isMoment = isMoment; | |
hooks.weekdays = listWeekdays; | |
hooks.parseZone = createInZone; | |
hooks.localeData = getLocale; | |
hooks.isDuration = isDuration; | |
hooks.monthsShort = listMonthsShort; | |
hooks.weekdaysMin = listWeekdaysMin; | |
hooks.defineLocale = defineLocale; | |
hooks.updateLocale = updateLocale; | |
hooks.locales = listLocales; | |
hooks.weekdaysShort = listWeekdaysShort; | |
hooks.normalizeUnits = normalizeUnits; | |
hooks.relativeTimeRounding = getSetRelativeTimeRounding; | |
hooks.relativeTimeThreshold = getSetRelativeTimeThreshold; | |
hooks.calendarFormat = getCalendarFormat; | |
hooks.prototype = proto; | |
// currently HTML5 input type only supports 24-hour formats | |
hooks.HTML5_FMT = { | |
DATETIME_LOCAL: 'YYYY-MM-DDTHH:mm', // <input type="datetime-local" /> | |
DATETIME_LOCAL_SECONDS: 'YYYY-MM-DDTHH:mm:ss', // <input type="datetime-local" step="1" /> | |
DATETIME_LOCAL_MS: 'YYYY-MM-DDTHH:mm:ss.SSS', // <input type="datetime-local" step="0.001" /> | |
DATE: 'YYYY-MM-DD', // <input type="date" /> | |
TIME: 'HH:mm', // <input type="time" /> | |
TIME_SECONDS: 'HH:mm:ss', // <input type="time" step="1" /> | |
TIME_MS: 'HH:mm:ss.SSS', // <input type="time" step="0.001" /> | |
WEEK: 'GGGG-[W]WW', // <input type="week" /> | |
MONTH: 'YYYY-MM' // <input type="month" /> | |
}; | |
return hooks; | |
}))); | |
/*** EXPORTS FROM exports-to-window-loader ***/ | |
window['moment'] = __webpack_require__(8); | |
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(726)(module))) | |
/***/ }), | |
/* 9 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var $ = __webpack_require__(31); | |
var global = __webpack_require__(30); | |
var getBuiltIn = __webpack_require__(120); | |
var apply = __webpack_require__(133); | |
var call = __webpack_require__(78); | |
var uncurryThis = __webpack_require__(37); | |
var IS_PURE = __webpack_require__(131); | |
var DESCRIPTORS = __webpack_require__(72); | |
var NATIVE_SYMBOL = __webpack_require__(236); | |
var fails = __webpack_require__(43); | |
var hasOwn = __webpack_require__(73); | |
var isArray = __webpack_require__(171); | |
var isCallable = __webpack_require__(61); | |
var isObject = __webpack_require__(65); | |
var isPrototypeOf = __webpack_require__(121); | |
var isSymbol = __webpack_require__(201); | |
var anObject = __webpack_require__(66); | |
var toObject = __webpack_require__(92); | |
var toIndexedObject = __webpack_require__(94); | |
var toPropertyKey = __webpack_require__(200); | |
var $toString = __webpack_require__(74); | |
var createPropertyDescriptor = __webpack_require__(164); | |
var nativeObjectCreate = __webpack_require__(134); | |
var objectKeys = __webpack_require__(170); | |
var getOwnPropertyNamesModule = __webpack_require__(150); | |
var getOwnPropertyNamesExternal = __webpack_require__(244); | |
var getOwnPropertySymbolsModule = __webpack_require__(242); | |
var getOwnPropertyDescriptorModule = __webpack_require__(112); | |
var definePropertyModule = __webpack_require__(86); | |
var definePropertiesModule = __webpack_require__(331); | |
var propertyIsEnumerableModule = __webpack_require__(199); | |
var arraySlice = __webpack_require__(169); | |
var redefine = __webpack_require__(103); | |
var shared = __webpack_require__(203); | |
var sharedKey = __webpack_require__(206); | |
var hiddenKeys = __webpack_require__(167); | |
var uid = __webpack_require__(204); | |
var wellKnownSymbol = __webpack_require__(60); | |
var wrappedWellKnownSymbolModule = __webpack_require__(341); | |
var defineWellKnownSymbol = __webpack_require__(342); | |
var setToStringTag = __webpack_require__(211); | |
var InternalStateModule = __webpack_require__(113); | |
var $forEach = __webpack_require__(135).forEach; | |
var HIDDEN = sharedKey('hidden'); | |
var SYMBOL = 'Symbol'; | |
var PROTOTYPE = 'prototype'; | |
var TO_PRIMITIVE = wellKnownSymbol('toPrimitive'); | |
var setInternalState = InternalStateModule.set; | |
var getInternalState = InternalStateModule.getterFor(SYMBOL); | |
var ObjectPrototype = Object[PROTOTYPE]; | |
var $Symbol = global.Symbol; | |
var SymbolPrototype = $Symbol && $Symbol[PROTOTYPE]; | |
var TypeError = global.TypeError; | |
var QObject = global.QObject; | |
var $stringify = getBuiltIn('JSON', 'stringify'); | |
var nativeGetOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f; | |
var nativeDefineProperty = definePropertyModule.f; | |
var nativeGetOwnPropertyNames = getOwnPropertyNamesExternal.f; | |
var nativePropertyIsEnumerable = propertyIsEnumerableModule.f; | |
var push = uncurryThis([].push); | |
var AllSymbols = shared('symbols'); | |
var ObjectPrototypeSymbols = shared('op-symbols'); | |
var StringToSymbolRegistry = shared('string-to-symbol-registry'); | |
var SymbolToStringRegistry = shared('symbol-to-string-registry'); | |
var WellKnownSymbolsStore = shared('wks'); | |
// Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173 | |
var USE_SETTER = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild; | |
// fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687 | |
var setSymbolDescriptor = DESCRIPTORS && fails(function () { | |
return nativeObjectCreate(nativeDefineProperty({}, 'a', { | |
get: function () { return nativeDefineProperty(this, 'a', { value: 7 }).a; } | |
})).a != 7; | |
}) ? function (O, P, Attributes) { | |
var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor(ObjectPrototype, P); | |
if (ObjectPrototypeDescriptor) delete ObjectPrototype[P]; | |
nativeDefineProperty(O, P, Attributes); | |
if (ObjectPrototypeDescriptor && O !== ObjectPrototype) { | |
nativeDefineProperty(ObjectPrototype, P, ObjectPrototypeDescriptor); | |
} | |
} : nativeDefineProperty; | |
var wrap = function (tag, description) { | |
var symbol = AllSymbols[tag] = nativeObjectCreate(SymbolPrototype); | |
setInternalState(symbol, { | |
type: SYMBOL, | |
tag: tag, | |
description: description | |
}); | |
if (!DESCRIPTORS) symbol.description = description; | |
return symbol; | |
}; | |
var $defineProperty = function defineProperty(O, P, Attributes) { | |
if (O === ObjectPrototype) $defineProperty(ObjectPrototypeSymbols, P, Attributes); | |
anObject(O); | |
var key = toPropertyKey(P); | |
anObject(Attributes); | |
if (hasOwn(AllSymbols, key)) { | |
if (!Attributes.enumerable) { | |
if (!hasOwn(O, HIDDEN)) nativeDefineProperty(O, HIDDEN, createPropertyDescriptor(1, {})); | |
O[HIDDEN][key] = true; | |
} else { | |
if (hasOwn(O, HIDDEN) && O[HIDDEN][key]) O[HIDDEN][key] = false; | |
Attributes = nativeObjectCreate(Attributes, { enumerable: createPropertyDescriptor(0, false) }); | |
} return setSymbolDescriptor(O, key, Attributes); | |
} return nativeDefineProperty(O, key, Attributes); | |
}; | |
var $defineProperties = function defineProperties(O, Properties) { | |
anObject(O); | |
var properties = toIndexedObject(Properties); | |
var keys = objectKeys(properties).concat($getOwnPropertySymbols(properties)); | |
$forEach(keys, function (key) { | |
if (!DESCRIPTORS || call($propertyIsEnumerable, properties, key)) $defineProperty(O, key, properties[key]); | |
}); | |
return O; | |
}; | |
var $create = function create(O, Properties) { | |
return Properties === undefined ? nativeObjectCreate(O) : $defineProperties(nativeObjectCreate(O), Properties); | |
}; | |
var $propertyIsEnumerable = function propertyIsEnumerable(V) { | |
var P = toPropertyKey(V); | |
var enumerable = call(nativePropertyIsEnumerable, this, P); | |
if (this === ObjectPrototype && hasOwn(AllSymbols, P) && !hasOwn(ObjectPrototypeSymbols, P)) return false; | |
return enumerable || !hasOwn(this, P) || !hasOwn(AllSymbols, P) || hasOwn(this, HIDDEN) && this[HIDDEN][P] | |
? enumerable : true; | |
}; | |
var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(O, P) { | |
var it = toIndexedObject(O); | |
var key = toPropertyKey(P); | |
if (it === ObjectPrototype && hasOwn(AllSymbols, key) && !hasOwn(ObjectPrototypeSymbols, key)) return; | |
var descriptor = nativeGetOwnPropertyDescriptor(it, key); | |
if (descriptor && hasOwn(AllSymbols, key) && !(hasOwn(it, HIDDEN) && it[HIDDEN][key])) { | |
descriptor.enumerable = true; | |
} | |
return descriptor; | |
}; | |
var $getOwnPropertyNames = function getOwnPropertyNames(O) { | |
var names = nativeGetOwnPropertyNames(toIndexedObject(O)); | |
var result = []; | |
$forEach(names, function (key) { | |
if (!hasOwn(AllSymbols, key) && !hasOwn(hiddenKeys, key)) push(result, key); | |
}); | |
return result; | |
}; | |
var $getOwnPropertySymbols = function getOwnPropertySymbols(O) { | |
var IS_OBJECT_PROTOTYPE = O === ObjectPrototype; | |
var names = nativeGetOwnPropertyNames(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toIndexedObject(O)); | |
var result = []; | |
$forEach(names, function (key) { | |
if (hasOwn(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || hasOwn(ObjectPrototype, key))) { | |
push(result, AllSymbols[key]); | |
} | |
}); | |
return result; | |
}; | |
// `Symbol` constructor | |
// https://tc39.es/ecma262/#sec-symbol-constructor | |
if (!NATIVE_SYMBOL) { | |
$Symbol = function Symbol() { | |
if (isPrototypeOf(SymbolPrototype, this)) throw TypeError('Symbol is not a constructor'); | |
var description = !arguments.length || arguments[0] === undefined ? undefined : $toString(arguments[0]); | |
var tag = uid(description); | |
var setter = function (value) { | |
if (this === ObjectPrototype) call(setter, ObjectPrototypeSymbols, value); | |
if (hasOwn(this, HIDDEN) && hasOwn(this[HIDDEN], tag)) this[HIDDEN][tag] = false; | |
setSymbolDescriptor(this, tag, createPropertyDescriptor(1, value)); | |
}; | |
if (DESCRIPTORS && USE_SETTER) setSymbolDescriptor(ObjectPrototype, tag, { configurable: true, set: setter }); | |
return wrap(tag, description); | |
}; | |
SymbolPrototype = $Symbol[PROTOTYPE]; | |
redefine(SymbolPrototype, 'toString', function toString() { | |
return getInternalState(this).tag; | |
}); | |
redefine($Symbol, 'withoutSetter', function (description) { | |
return wrap(uid(description), description); | |
}); | |
propertyIsEnumerableModule.f = $propertyIsEnumerable; | |
definePropertyModule.f = $defineProperty; | |
definePropertiesModule.f = $defineProperties; | |
getOwnPropertyDescriptorModule.f = $getOwnPropertyDescriptor; | |
getOwnPropertyNamesModule.f = getOwnPropertyNamesExternal.f = $getOwnPropertyNames; | |
getOwnPropertySymbolsModule.f = $getOwnPropertySymbols; | |
wrappedWellKnownSymbolModule.f = function (name) { | |
return wrap(wellKnownSymbol(name), name); | |
}; | |
if (DESCRIPTORS) { | |
// https://github.com/tc39/proposal-Symbol-description | |
nativeDefineProperty(SymbolPrototype, 'description', { | |
configurable: true, | |
get: function description() { | |
return getInternalState(this).description; | |
} | |
}); | |
if (!IS_PURE) { | |
redefine(ObjectPrototype, 'propertyIsEnumerable', $propertyIsEnumerable, { unsafe: true }); | |
} | |
} | |
} | |
$({ global: true, wrap: true, forced: !NATIVE_SYMBOL, sham: !NATIVE_SYMBOL }, { | |
Symbol: $Symbol | |
}); | |
$forEach(objectKeys(WellKnownSymbolsStore), function (name) { | |
defineWellKnownSymbol(name); | |
}); | |
$({ target: SYMBOL, stat: true, forced: !NATIVE_SYMBOL }, { | |
// `Symbol.for` method | |
// https://tc39.es/ecma262/#sec-symbol.for | |
'for': function (key) { | |
var string = $toString(key); | |
if (hasOwn(StringToSymbolRegistry, string)) return StringToSymbolRegistry[string]; | |
var symbol = $Symbol(string); | |
StringToSymbolRegistry[string] = symbol; | |
SymbolToStringRegistry[symbol] = string; | |
return symbol; | |
}, | |
// `Symbol.keyFor` method | |
// https://tc39.es/ecma262/#sec-symbol.keyfor | |
keyFor: function keyFor(sym) { | |
if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol'); | |
if (hasOwn(SymbolToStringRegistry, sym)) return SymbolToStringRegistry[sym]; | |
}, | |
useSetter: function () { USE_SETTER = true; }, | |
useSimple: function () { USE_SETTER = false; } | |
}); | |
$({ target: 'Object', stat: true, forced: !NATIVE_SYMBOL, sham: !DESCRIPTORS }, { | |
// `Object.create` method | |
// https://tc39.es/ecma262/#sec-object.create | |
create: $create, | |
// `Object.defineProperty` method | |
// https://tc39.es/ecma262/#sec-object.defineproperty | |
defineProperty: $defineProperty, | |
// `Object.defineProperties` method | |
// https://tc39.es/ecma262/#sec-object.defineproperties | |
defineProperties: $defineProperties, | |
// `Object.getOwnPropertyDescriptor` method | |
// https://tc39.es/ecma262/#sec-object.getownpropertydescriptors | |
getOwnPropertyDescriptor: $getOwnPropertyDescriptor | |
}); | |
$({ target: 'Object', stat: true, forced: !NATIVE_SYMBOL }, { | |
// `Object.getOwnPropertyNames` method | |
// https://tc39.es/ecma262/#sec-object.getownpropertynames | |
getOwnPropertyNames: $getOwnPropertyNames, | |
// `Object.getOwnPropertySymbols` method | |
// https://tc39.es/ecma262/#sec-object.getownpropertysymbols | |
getOwnPropertySymbols: $getOwnPropertySymbols | |
}); | |
// Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives | |
// https://bugs.chromium.org/p/v8/issues/detail?id=3443 | |
$({ target: 'Object', stat: true, forced: fails(function () { getOwnPropertySymbolsModule.f(1); }) }, { | |
getOwnPropertySymbols: function getOwnPropertySymbols(it) { | |
return getOwnPropertySymbolsModule.f(toObject(it)); | |
} | |
}); | |
// `JSON.stringify` method behavior with symbols | |
// https://tc39.es/ecma262/#sec-json.stringify | |
if ($stringify) { | |
var FORCED_JSON_STRINGIFY = !NATIVE_SYMBOL || fails(function () { | |
var symbol = $Symbol(); | |
// MS Edge converts symbol values to JSON as {} | |
return $stringify([symbol]) != '[null]' | |
// WebKit converts symbol values to JSON as null | |
|| $stringify({ a: symbol }) != '{}' | |
// V8 throws on boxed symbols | |
|| $stringify(Object(symbol)) != '{}'; | |
}); | |
$({ target: 'JSON', stat: true, forced: FORCED_JSON_STRINGIFY }, { | |
// eslint-disable-next-line no-unused-vars -- required for `.length` | |
stringify: function stringify(it, replacer, space) { | |
var args = arraySlice(arguments); | |
var $replacer = replacer; | |
if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined | |
if (!isArray(replacer)) replacer = function (key, value) { | |
if (isCallable($replacer)) value = call($replacer, this, key, value); | |
if (!isSymbol(value)) return value; | |
}; | |
args[1] = replacer; | |
return apply($stringify, null, args); | |
} | |
}); | |
} | |
// `Symbol.prototype[@@toPrimitive]` method | |
// https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive | |
if (!SymbolPrototype[TO_PRIMITIVE]) { | |
var valueOf = SymbolPrototype.valueOf; | |
// eslint-disable-next-line no-unused-vars -- required for .length | |
redefine(SymbolPrototype, TO_PRIMITIVE, function (hint) { | |
// TODO: improve hint logic | |
return call(valueOf, this); | |
}); | |
} | |
// `Symbol.prototype[@@toStringTag]` property | |
// https://tc39.es/ecma262/#sec-symbol.prototype-@@tostringtag | |
setToStringTag($Symbol, SYMBOL); | |
hiddenKeys[HIDDEN] = true; | |
/***/ }), | |
/* 10 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
// `Symbol.prototype.description` getter | |
// https://tc39.es/ecma262/#sec-symbol.prototype.description | |
var $ = __webpack_require__(31); | |
var DESCRIPTORS = __webpack_require__(72); | |
var global = __webpack_require__(30); | |
var uncurryThis = __webpack_require__(37); | |
var hasOwn = __webpack_require__(73); | |
var isCallable = __webpack_require__(61); | |
var isPrototypeOf = __webpack_require__(121); | |
var toString = __webpack_require__(74); | |
var defineProperty = __webpack_require__(86).f; | |
var copyConstructorProperties = __webpack_require__(326); | |
var NativeSymbol = global.Symbol; | |
var SymbolPrototype = NativeSymbol && NativeSymbol.prototype; | |
if (DESCRIPTORS && isCallable(NativeSymbol) && (!('description' in SymbolPrototype) || | |
// Safari 12 bug | |
NativeSymbol().description !== undefined | |
)) { | |
var EmptyStringDescriptionStore = {}; | |
// wrap Symbol constructor for correct work with undefined description | |
var SymbolWrapper = function Symbol() { | |
var description = arguments.length < 1 || arguments[0] === undefined ? undefined : toString(arguments[0]); | |
var result = isPrototypeOf(SymbolPrototype, this) | |
? new NativeSymbol(description) | |
// in Edge 13, String(Symbol(undefined)) === 'Symbol(undefined)' | |
: description === undefined ? NativeSymbol() : NativeSymbol(description); | |
if (description === '') EmptyStringDescriptionStore[result] = true; | |
return result; | |
}; | |
copyConstructorProperties(SymbolWrapper, NativeSymbol); | |
SymbolWrapper.prototype = SymbolPrototype; | |
SymbolPrototype.constructor = SymbolWrapper; | |
var NATIVE_SYMBOL = String(NativeSymbol('test')) == 'Symbol(test)'; | |
var symbolToString = uncurryThis(SymbolPrototype.toString); | |
var symbolValueOf = uncurryThis(SymbolPrototype.valueOf); | |
var regexp = /^Symbol\((.*)\)[^)]+$/; | |
var replace = uncurryThis(''.replace); | |
var stringSlice = uncurryThis(''.slice); | |
defineProperty(SymbolPrototype, 'description', { | |
configurable: true, | |
get: function description() { | |
var symbol = symbolValueOf(this); | |
var string = symbolToString(symbol); | |
if (hasOwn(EmptyStringDescriptionStore, symbol)) return ''; | |
var desc = NATIVE_SYMBOL ? stringSlice(string, 7, -1) : replace(string, regexp, '$1'); | |
return desc === '' ? undefined : desc; | |
} | |
}); | |
$({ global: true, forced: true }, { | |
Symbol: SymbolWrapper | |
}); | |
} | |
/***/ }), | |
/* 11 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var defineWellKnownSymbol = __webpack_require__(342); | |
// `Symbol.iterator` well-known symbol | |
// https://tc39.es/ecma262/#sec-symbol.iterator | |
defineWellKnownSymbol('iterator'); | |
/***/ }), | |
/* 12 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var global = __webpack_require__(30); | |
var uncurryThis = __webpack_require__(37); | |
var redefineAll = __webpack_require__(259); | |
var InternalMetadataModule = __webpack_require__(176); | |
var collection = __webpack_require__(213); | |
var collectionWeak = __webpack_require__(372); | |
var isObject = __webpack_require__(65); | |
var isExtensible = __webpack_require__(346); | |
var enforceInternalState = __webpack_require__(113).enforce; | |
var NATIVE_WEAK_MAP = __webpack_require__(325); | |
var IS_IE11 = !global.ActiveXObject && 'ActiveXObject' in global; | |
var InternalWeakMap; | |
var wrapper = function (init) { | |
return function WeakMap() { | |
return init(this, arguments.length ? arguments[0] : undefined); | |
}; | |
}; | |
// `WeakMap` constructor | |
// https://tc39.es/ecma262/#sec-weakmap-constructor | |
var $WeakMap = collection('WeakMap', wrapper, collectionWeak); | |
// IE11 WeakMap frozen keys fix | |
// We can't use feature detection because it crash some old IE builds | |
// https://github.com/zloirock/core-js/issues/485 | |
if (NATIVE_WEAK_MAP && IS_IE11) { | |
InternalWeakMap = collectionWeak.getConstructor(wrapper, 'WeakMap', true); | |
InternalMetadataModule.enable(); | |
var WeakMapPrototype = $WeakMap.prototype; | |
var nativeDelete = uncurryThis(WeakMapPrototype['delete']); | |
var nativeHas = uncurryThis(WeakMapPrototype.has); | |
var nativeGet = uncurryThis(WeakMapPrototype.get); | |
var nativeSet = uncurryThis(WeakMapPrototype.set); | |
redefineAll(WeakMapPrototype, { | |
'delete': function (key) { | |
if (isObject(key) && !isExtensible(key)) { | |
var state = enforceInternalState(this); | |
if (!state.frozen) state.frozen = new InternalWeakMap(); | |
return nativeDelete(this, key) || state.frozen['delete'](key); | |
} return nativeDelete(this, key); | |
}, | |
has: function has(key) { | |
if (isObject(key) && !isExtensible(key)) { | |
var state = enforceInternalState(this); | |
if (!state.frozen) state.frozen = new InternalWeakMap(); | |
return nativeHas(this, key) || state.frozen.has(key); | |
} return nativeHas(this, key); | |
}, | |
get: function get(key) { | |
if (isObject(key) && !isExtensible(key)) { | |
var state = enforceInternalState(this); | |
if (!state.frozen) state.frozen = new InternalWeakMap(); | |
return nativeHas(this, key) ? nativeGet(this, key) : state.frozen.get(key); | |
} return nativeGet(this, key); | |
}, | |
set: function set(key, value) { | |
if (isObject(key) && !isExtensible(key)) { | |
var state = enforceInternalState(this); | |
if (!state.frozen) state.frozen = new InternalWeakMap(); | |
nativeHas(this, key) ? nativeSet(this, key, value) : state.frozen.set(key, value); | |
} else nativeSet(this, key, value); | |
return this; | |
} | |
}); | |
} | |
/***/ }), | |
/* 13 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var $ = __webpack_require__(31); | |
var exec = __webpack_require__(212); | |
// `RegExp.prototype.exec` method | |
// https://tc39.es/ecma262/#sec-regexp.prototype.exec | |
$({ target: 'RegExp', proto: true, forced: /./.exec !== exec }, { | |
exec: exec | |
}); | |
/***/ }), | |
/* 14 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var $ = __webpack_require__(31); | |
var global = __webpack_require__(30); | |
var isArray = __webpack_require__(171); | |
var isConstructor = __webpack_require__(210); | |
var isObject = __webpack_require__(65); | |
var toAbsoluteIndex = __webpack_require__(151); | |
var lengthOfArrayLike = __webpack_require__(98); | |
var toIndexedObject = __webpack_require__(94); | |
var createProperty = __webpack_require__(152); | |
var wellKnownSymbol = __webpack_require__(60); | |
var arrayMethodHasSpeciesSupport = __webpack_require__(172); | |
var un$Slice = __webpack_require__(169); | |
var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('slice'); | |
var SPECIES = wellKnownSymbol('species'); | |
var Array = global.Array; | |
var max = Math.max; | |
// `Array.prototype.slice` method | |
// https://tc39.es/ecma262/#sec-array.prototype.slice | |
// fallback for not array-like ES3 strings and DOM objects | |
$({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, { | |
slice: function slice(start, end) { | |
var O = toIndexedObject(this); | |
var length = lengthOfArrayLike(O); | |
var k = toAbsoluteIndex(start, length); | |
var fin = toAbsoluteIndex(end === undefined ? length : end, length); | |
// inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible | |
var Constructor, result, n; | |
if (isArray(O)) { | |
Constructor = O.constructor; | |
// cross-realm fallback | |
if (isConstructor(Constructor) && (Constructor === Array || isArray(Constructor.prototype))) { | |
Constructor = undefined; | |
} else if (isObject(Constructor)) { | |
Constructor = Constructor[SPECIES]; | |
if (Constructor === null) Constructor = undefined; | |
} | |
if (Constructor === Array || Constructor === undefined) { | |
return un$Slice(O, k, fin); | |
} | |
} | |
result = new (Constructor === undefined ? Array : Constructor)(max(fin - k, 0)); | |
for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]); | |
result.length = n; | |
return result; | |
} | |
}); | |
/***/ }), | |
/* 15 */ | |
/***/ (function(module, exports) { | |
function _getPrototypeOf(o) { | |
module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { | |
return o.__proto__ || Object.getPrototypeOf(o); | |
}, module.exports.__esModule = true, module.exports["default"] = module.exports; | |
return _getPrototypeOf(o); | |
} | |
module.exports = _getPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports; | |
/***/ }), | |
/* 16 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var setPrototypeOf = __webpack_require__(562); | |
function _inherits(subClass, superClass) { | |
if (typeof superClass !== "function" && superClass !== null) { | |
throw new TypeError("Super expression must either be null or a function"); | |
} | |
subClass.prototype = Object.create(superClass && superClass.prototype, { | |
constructor: { | |
value: subClass, | |
writable: true, | |
configurable: true | |
} | |
}); | |
Object.defineProperty(subClass, "prototype", { | |
writable: false | |
}); | |
if (superClass) setPrototypeOf(subClass, superClass); | |
} | |
module.exports = _inherits, module.exports.__esModule = true, module.exports["default"] = module.exports; | |
/***/ }), | |
/* 17 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var _typeof = __webpack_require__(22)["default"]; | |
var assertThisInitialized = __webpack_require__(48); | |
function _possibleConstructorReturn(self, call) { | |
if (call && (_typeof(call) === "object" || typeof call === "function")) { | |
return call; | |
} else if (call !== void 0) { | |
throw new TypeError("Derived constructors may only return object or undefined"); | |
} | |
return assertThisInitialized(self); | |
} | |
module.exports = _possibleConstructorReturn, module.exports.__esModule = true, module.exports["default"] = module.exports; | |
/***/ }), | |
/* 18 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var _interopRequireDefault = __webpack_require__(1); | |
exports.__esModule = true; | |
exports.clone = clone; | |
exports.createObjectPropListener = createObjectPropListener; | |
exports.deepClone = deepClone; | |
exports.deepExtend = deepExtend; | |
exports.deepObjectSize = deepObjectSize; | |
exports.defineGetter = defineGetter; | |
exports.duckSchema = duckSchema; | |
exports.extend = extend; | |
exports.getProperty = getProperty; | |
exports.hasOwnProperty = hasOwnProperty; | |
exports.inherit = inherit; | |
exports.isObject = isObject; | |
exports.isObjectEqual = isObjectEqual; | |
exports.mixin = mixin; | |
exports.objectEach = objectEach; | |
exports.setProperty = setProperty; | |
__webpack_require__(42); | |
__webpack_require__(52); | |
__webpack_require__(0); | |
__webpack_require__(13); | |
__webpack_require__(63); | |
__webpack_require__(28); | |
var _defineProperty2 = _interopRequireDefault(__webpack_require__(45)); | |
var _typeof2 = _interopRequireDefault(__webpack_require__(22)); | |
var _array = __webpack_require__(20); | |
/** | |
* Generate schema for passed object. | |
* | |
* @param {Array|object} object An object to analyze. | |
* @returns {Array|object} | |
*/ | |
function duckSchema(object) { | |
var schema; | |
if (Array.isArray(object)) { | |
schema = []; | |
} else { | |
schema = {}; | |
objectEach(object, function (value, key) { | |
if (key === '__children') { | |
return; | |
} | |
if (value && (0, _typeof2.default)(value) === 'object' && !Array.isArray(value)) { | |
schema[key] = duckSchema(value); | |
} else if (Array.isArray(value)) { | |
if (value.length && (0, _typeof2.default)(value[0]) === 'object' && !Array.isArray(value[0])) { | |
schema[key] = [duckSchema(value[0])]; | |
} else { | |
schema[key] = []; | |
} | |
} else { | |
schema[key] = null; | |
} | |
}); | |
} | |
return schema; | |
} | |
/** | |
* Inherit without without calling parent constructor, and setting `Child.prototype.constructor` to `Child` instead of `Parent`. | |
* Creates temporary dummy function to call it as constructor. | |
* Described in ticket: https://github.com/handsontable/handsontable/pull/516. | |
* | |
* @param {object} Child The child class. | |
* @param {object} Parent The parent class. | |
* @returns {object} | |
*/ | |
function inherit(Child, Parent) { | |
Parent.prototype.constructor = Parent; | |
Child.prototype = new Parent(); | |
Child.prototype.constructor = Child; | |
return Child; | |
} | |
/** | |
* Perform shallow extend of a target object with extension's own properties. | |
* | |
* @param {object} target An object that will receive the new properties. | |
* @param {object} extension An object containing additional properties to merge into the target. | |
* @param {string[]} [writableKeys] An array of keys that are writable to target object. | |
* @returns {object} | |
*/ | |
function extend(target, extension, writableKeys) { | |
var hasWritableKeys = Array.isArray(writableKeys); | |
objectEach(extension, function (value, key) { | |
if (hasWritableKeys === false || writableKeys.includes(key)) { | |
target[key] = value; | |
} | |
}); | |
return target; | |
} | |
/** | |
* Perform deep extend of a target object with extension's own properties. | |
* | |
* @param {object} target An object that will receive the new properties. | |
* @param {object} extension An object containing additional properties to merge into the target. | |
*/ | |
function deepExtend(target, extension) { | |
objectEach(extension, function (value, key) { | |
if (extension[key] && (0, _typeof2.default)(extension[key]) === 'object') { | |
if (!target[key]) { | |
if (Array.isArray(extension[key])) { | |
target[key] = []; | |
} else if (Object.prototype.toString.call(extension[key]) === '[object Date]') { | |
target[key] = extension[key]; | |
} else { | |
target[key] = {}; | |
} | |
} | |
deepExtend(target[key], extension[key]); | |
} else { | |
target[key] = extension[key]; | |
} | |
}); | |
} | |
/** | |
* Perform deep clone of an object. | |
* WARNING! Only clones JSON properties. Will cause error when `obj` contains a function, Date, etc. | |
* | |
* @param {object} obj An object that will be cloned. | |
* @returns {object} | |
*/ | |
function deepClone(obj) { | |
if ((0, _typeof2.default)(obj) === 'object') { | |
return JSON.parse(JSON.stringify(obj)); | |
} | |
return obj; | |
} | |
/** | |
* Shallow clone object. | |
* | |
* @param {object} object An object to clone. | |
* @returns {object} | |
*/ | |
function clone(object) { | |
var result = {}; | |
objectEach(object, function (value, key) { | |
result[key] = value; | |
}); | |
return result; | |
} | |
/** | |
* Extend the Base object (usually prototype) of the functionality the `mixins` objects. | |
* | |
* @param {object} Base Base object which will be extended. | |
* @param {object} mixins The object of the functionality will be "copied". | |
* @returns {object} | |
*/ | |
function mixin(Base) { | |
if (!Base.MIXINS) { | |
Base.MIXINS = []; | |
} | |
for (var _len = arguments.length, mixins = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | |
mixins[_key - 1] = arguments[_key]; | |
} | |
(0, _array.arrayEach)(mixins, function (mixinItem) { | |
Base.MIXINS.push(mixinItem.MIXIN_NAME); | |
objectEach(mixinItem, function (value, key) { | |
if (Base.prototype[key] !== void 0) { | |
throw new Error("Mixin conflict. Property '".concat(key, "' already exist and cannot be overwritten.")); | |
} | |
if (typeof value === 'function') { | |
Base.prototype[key] = value; | |
} else { | |
var getter = function _getter(property, initialValue) { | |
var propertyName = "_".concat(property); | |
var initValue = function initValue(newValue) { | |
var result = newValue; | |
if (Array.isArray(result) || isObject(result)) { | |
result = deepClone(result); | |
} | |
return result; | |
}; | |
return function () { | |
if (this[propertyName] === void 0) { | |
this[propertyName] = initValue(initialValue); | |
} | |
return this[propertyName]; | |
}; | |
}; | |
var setter = function _setter(property) { | |
var propertyName = "_".concat(property); | |
return function (newValue) { | |
this[propertyName] = newValue; | |
}; | |
}; | |
Object.defineProperty(Base.prototype, key, { | |
get: getter(key, value), | |
set: setter(key), | |
configurable: true | |
}); | |
} | |
}); | |
}); | |
return Base; | |
} | |
/** | |
* Checks if two objects or arrays are (deep) equal. | |
* | |
* @param {object|Array} object1 The first object to compare. | |
* @param {object|Array} object2 The second object to compare. | |
* @returns {boolean} | |
*/ | |
function isObjectEqual(object1, object2) { | |
return JSON.stringify(object1) === JSON.stringify(object2); | |
} | |
/** | |
* Determines whether given object is a plain Object. | |
* Note: String and Array are not plain Objects. | |
* | |
* @param {*} object An object to check. | |
* @returns {boolean} | |
*/ | |
function isObject(object) { | |
return Object.prototype.toString.call(object) === '[object Object]'; | |
} | |
/** | |
* @param {object} object The object on which to define the property. | |
* @param {string} property The name of the property to be defined or modified. | |
* @param {*} value The value associated with the property. | |
* @param {object} options The descriptor for the property being defined or modified. | |
*/ | |
function defineGetter(object, property, value, options) { | |
options.value = value; | |
options.writable = options.writable !== false; | |
options.enumerable = options.enumerable !== false; | |
options.configurable = options.configurable !== false; | |
Object.defineProperty(object, property, options); | |
} | |
/** | |
* A specialized version of `.forEach` for objects. | |
* | |
* @param {object} object The object to iterate over. | |
* @param {Function} iteratee The function invoked per iteration. | |
* @returns {object} Returns `object`. | |
*/ | |
function objectEach(object, iteratee) { | |
// eslint-disable-next-line no-restricted-syntax | |
for (var key in object) { | |
if (!object.hasOwnProperty || object.hasOwnProperty && Object.prototype.hasOwnProperty.call(object, key)) { | |
if (iteratee(object[key], key, object) === false) { | |
break; | |
} | |
} | |
} | |
return object; | |
} | |
/** | |
* Get object property by its name. Access to sub properties can be achieved by dot notation (e.q. `'foo.bar.baz'`). | |
* | |
* @param {object} object Object which value will be exported. | |
* @param {string} name Object property name. | |
* @returns {*} | |
*/ | |
function getProperty(object, name) { | |
var names = name.split('.'); | |
var result = object; | |
objectEach(names, function (nameItem) { | |
result = result[nameItem]; | |
if (result === void 0) { | |
result = void 0; | |
return false; | |
} | |
}); | |
return result; | |
} | |
/** | |
* Set a property value on the provided object. Works on nested object prop names as well (e.g. `first.name`). | |
* | |
* @param {object} object Object to work on. | |
* @param {string} name Prop name. | |
* @param {*} value Value to be assigned at the provided property. | |
*/ | |
function setProperty(object, name, value) { | |
var names = name.split('.'); | |
var workingObject = object; | |
names.forEach(function (propName, index) { | |
if (index !== names.length - 1) { | |
if (!hasOwnProperty(workingObject, propName)) { | |
workingObject[propName] = {}; | |
} | |
workingObject = workingObject[propName]; | |
} else { | |
workingObject[propName] = value; | |
} | |
}); | |
} | |
/** | |
* Return object length (recursively). | |
* | |
* @param {*} object Object for which we want get length. | |
* @returns {number} | |
*/ | |
function deepObjectSize(object) { | |
if (!isObject(object)) { | |
return 0; | |
} | |
var recursObjLen = function recursObjLen(obj) { | |
var result = 0; | |
if (isObject(obj)) { | |
objectEach(obj, function (value, key) { | |
if (key === '__children') { | |
return; | |
} | |
result += recursObjLen(value); | |
}); | |
} else { | |
result += 1; | |
} | |
return result; | |
}; | |
return recursObjLen(object); | |
} | |
/** | |
* Create object with property where its value change will be observed. | |
* | |
* @param {*} [defaultValue=undefined] Default value. | |
* @param {string} [propertyToListen='value'] Property to listen. | |
* @returns {object} | |
*/ | |
function createObjectPropListener(defaultValue) { | |
var _holder; | |
var propertyToListen = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'value'; | |
var privateProperty = "_".concat(propertyToListen); | |
var holder = (_holder = { | |
_touched: false | |
}, (0, _defineProperty2.default)(_holder, privateProperty, defaultValue), (0, _defineProperty2.default)(_holder, "isTouched", function isTouched() { | |
return this._touched; | |
}), _holder); | |
Object.defineProperty(holder, propertyToListen, { | |
get: function get() { | |
return this[privateProperty]; | |
}, | |
set: function set(value) { | |
this._touched = true; | |
this[privateProperty] = value; | |
}, | |
enumerable: true, | |
configurable: true | |
}); | |
return holder; | |
} | |
/** | |
* Check if at specified `key` there is any value for `object`. | |
* | |
* @param {object} object Object to search value at specyfic key. | |
* @param {string} key String key to check. | |
* @returns {boolean} | |
*/ | |
function hasOwnProperty(object, key) { | |
return Object.prototype.hasOwnProperty.call(object, key); | |
} | |
/***/ }), | |
/* 19 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var $ = __webpack_require__(31); | |
var fails = __webpack_require__(43); | |
var toIndexedObject = __webpack_require__(94); | |
var nativeGetOwnPropertyDescriptor = __webpack_require__(112).f; | |
var DESCRIPTORS = __webpack_require__(72); | |
var FAILS_ON_PRIMITIVES = fails(function () { nativeGetOwnPropertyDescriptor(1); }); | |
var FORCED = !DESCRIPTORS || FAILS_ON_PRIMITIVES; | |
// `Object.getOwnPropertyDescriptor` method | |
// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor | |
$({ target: 'Object', stat: true, forced: FORCED, sham: !DESCRIPTORS }, { | |
getOwnPropertyDescriptor: function getOwnPropertyDescriptor(it, key) { | |
return nativeGetOwnPropertyDescriptor(toIndexedObject(it), key); | |
} | |
}); | |
/***/ }), | |
/* 20 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
exports.__esModule = true; | |
exports.arrayAvg = arrayAvg; | |
exports.arrayEach = arrayEach; | |
exports.arrayFilter = arrayFilter; | |
exports.arrayFlatten = arrayFlatten; | |
exports.arrayMap = arrayMap; | |
exports.arrayMax = arrayMax; | |
exports.arrayMin = arrayMin; | |
exports.arrayReduce = arrayReduce; | |
exports.arraySum = arraySum; | |
exports.arrayUnique = arrayUnique; | |
exports.extendArray = extendArray; | |
exports.getDifferenceOfArrays = getDifferenceOfArrays; | |
exports.getIntersectionOfArrays = getIntersectionOfArrays; | |
exports.getUnionOfArrays = getUnionOfArrays; | |
exports.pivot = pivot; | |
exports.stringToArray = stringToArray; | |
exports.to2dArray = to2dArray; | |
__webpack_require__(23); | |
__webpack_require__(2); | |
__webpack_require__(21); | |
__webpack_require__(33); | |
__webpack_require__(14); | |
__webpack_require__(40); | |
__webpack_require__(0); | |
__webpack_require__(42); | |
__webpack_require__(52); | |
__webpack_require__(3); | |
__webpack_require__(58); | |
__webpack_require__(4); | |
__webpack_require__(13); | |
__webpack_require__(63); | |
/** | |
* @param {Array} arr An array to process. | |
*/ | |
function to2dArray(arr) { | |
var ilen = arr.length; | |
var i = 0; | |
while (i < ilen) { | |
arr[i] = [arr[i]]; | |
i += 1; | |
} | |
} | |
/** | |
* @param {Array} arr An array to extend. | |
* @param {Array} extension The data to extend from. | |
*/ | |
function extendArray(arr, extension) { | |
var ilen = extension.length; | |
var i = 0; | |
while (i < ilen) { | |
arr.push(extension[i]); | |
i += 1; | |
} | |
} | |
/** | |
* @param {Array} arr An array to pivot. | |
* @returns {Array} | |
*/ | |
function pivot(arr) { | |
var pivotedArr = []; | |
if (!arr || arr.length === 0 || !arr[0] || arr[0].length === 0) { | |
return pivotedArr; | |
} | |
var rowCount = arr.length; | |
var colCount = arr[0].length; | |
for (var i = 0; i < rowCount; i++) { | |
for (var j = 0; j < colCount; j++) { | |
if (!pivotedArr[j]) { | |
pivotedArr[j] = []; | |
} | |
pivotedArr[j][i] = arr[i][j]; | |
} | |
} | |
return pivotedArr; | |
} | |
/** | |
* A specialized version of `.reduce` for arrays without support for callback | |
* shorthands and `this` binding. | |
* | |
* {@link https://github.com/lodash/lodash/blob/master/lodash.js}. | |
* | |
* @param {Array} array The array to iterate over. | |
* @param {Function} iteratee The function invoked per iteration. | |
* @param {*} [accumulator] The initial value. | |
* @param {boolean} [initFromArray] Specify using the first element of `array` as the initial value. | |
* @returns {*} Returns the accumulated value. | |
*/ | |
function arrayReduce(array, iteratee, accumulator, initFromArray) { | |
var index = -1; | |
var iterable = array; | |
var result = accumulator; | |
if (!Array.isArray(array)) { | |
iterable = Array.from(array); | |
} | |
var length = iterable.length; | |
if (initFromArray && length) { | |
index += 1; | |
result = iterable[index]; | |
} | |
index += 1; | |
while (index < length) { | |
result = iteratee(result, iterable[index], index, iterable); | |
index += 1; | |
} | |
return result; | |
} | |
/** | |
* A specialized version of `.filter` for arrays without support for callback | |
* shorthands and `this` binding. | |
* | |
* {@link https://github.com/lodash/lodash/blob/master/lodash.js}. | |
* | |
* @param {Array} array The array to iterate over. | |
* @param {Function} predicate The function invoked per iteration. | |
* @returns {Array} Returns the new filtered array. | |
*/ | |
function arrayFilter(array, predicate) { | |
var index = 0; | |
var iterable = array; | |
if (!Array.isArray(array)) { | |
iterable = Array.from(array); | |
} | |
var length = iterable.length; | |
var result = []; | |
var resIndex = -1; | |
while (index < length) { | |
var value = iterable[index]; | |
if (predicate(value, index, iterable)) { | |
resIndex += 1; | |
result[resIndex] = value; | |
} | |
index += 1; | |
} | |
return result; | |
} | |
/** | |
* A specialized version of `.map` for arrays without support for callback | |
* shorthands and `this` binding. | |
* | |
* @param {Array} array The array to iterate over. | |
* @param {Function} iteratee The function invoked per iteration. | |
* @returns {Array} Returns the new filtered array. | |
*/ | |
function arrayMap(array, iteratee) { | |
var index = 0; | |
var iterable = array; | |
if (!Array.isArray(array)) { | |
iterable = Array.from(array); | |
} | |
var length = iterable.length; | |
var result = []; | |
var resIndex = -1; | |
while (index < length) { | |
var value = iterable[index]; | |
resIndex += 1; | |
result[resIndex] = iteratee(value, index, iterable); | |
index += 1; | |
} | |
return result; | |
} | |
/** | |
* A specialized version of `.forEach` for arrays without support for callback | |
* shorthands and `this` binding. | |
* | |
* {@link https://github.com/lodash/lodash/blob/master/lodash.js}. | |
* | |
* @param {Array|*} array The array to iterate over or an any element with implemented iterator protocol. | |
* @param {Function} iteratee The function invoked per iteration. | |
* @returns {Array} Returns `array`. | |
*/ | |
function arrayEach(array, iteratee) { | |
var index = 0; | |
var iterable = array; | |
if (!Array.isArray(array)) { | |
iterable = Array.from(array); | |
} | |
var length = iterable.length; | |
while (index < length) { | |
if (iteratee(iterable[index], index, iterable) === false) { | |
break; | |
} | |
index += 1; | |
} | |
return array; | |
} | |
/** | |
* Calculate sum value for each item of the array. | |
* | |
* @param {Array} array The array to process. | |
* @returns {number} Returns calculated sum value. | |
*/ | |
function arraySum(array) { | |
return arrayReduce(array, function (a, b) { | |
return a + b; | |
}, 0); | |
} | |
/** | |
* Returns the highest value from an array. Can be array of numbers or array of strings. | |
* NOTICE: Mixed values is not supported. | |
* | |
* @param {Array} array The array to process. | |
* @returns {number} Returns the highest value from an array. | |
*/ | |
function arrayMax(array) { | |
return arrayReduce(array, function (a, b) { | |
return a > b ? a : b; | |
}, Array.isArray(array) ? array[0] : void 0); | |
} | |
/** | |
* Returns the lowest value from an array. Can be array of numbers or array of strings. | |
* NOTICE: Mixed values is not supported. | |
* | |
* @param {Array} array The array to process. | |
* @returns {number} Returns the lowest value from an array. | |
*/ | |
function arrayMin(array) { | |
return arrayReduce(array, function (a, b) { | |
return a < b ? a : b; | |
}, Array.isArray(array) ? array[0] : void 0); | |
} | |
/** | |
* Calculate average value for each item of the array. | |
* | |
* @param {Array} array The array to process. | |
* @returns {number} Returns calculated average value. | |
*/ | |
function arrayAvg(array) { | |
if (!array.length) { | |
return 0; | |
} | |
return arraySum(array) / array.length; | |
} | |
/** | |
* Flatten multidimensional array. | |
* | |
* @param {Array} array Array of Arrays. | |
* @returns {Array} | |
*/ | |
function arrayFlatten(array) { | |
return arrayReduce(array, function (initial, value) { | |
return initial.concat(Array.isArray(value) ? arrayFlatten(value) : value); | |
}, []); | |
} | |
/** | |
* Unique values in the array. | |
* | |
* @param {Array} array The array to process. | |
* @returns {Array} | |
*/ | |
function arrayUnique(array) { | |
var unique = []; | |
arrayEach(array, function (value) { | |
if (unique.indexOf(value) === -1) { | |
unique.push(value); | |
} | |
}); | |
return unique; | |
} | |
/** | |
* Differences from two or more arrays. | |
* | |
* @param {...Array} arrays Array of strings or array of numbers. | |
* @returns {Array} Returns the difference between arrays. | |
*/ | |
function getDifferenceOfArrays() { | |
for (var _len = arguments.length, arrays = new Array(_len), _key = 0; _key < _len; _key++) { | |
arrays[_key] = arguments[_key]; | |
} | |
var _ref = [].concat(arrays), | |
first = _ref[0], | |
rest = _ref.slice(1); | |
var filteredFirstArray = first; | |
arrayEach(rest, function (array) { | |
filteredFirstArray = filteredFirstArray.filter(function (value) { | |
return !array.includes(value); | |
}); | |
}); | |
return filteredFirstArray; | |
} | |
/** | |
* Intersection of two or more arrays. | |
* | |
* @param {...Array} arrays Array of strings or array of numbers. | |
* @returns {Array} Returns elements that exists in every array. | |
*/ | |
function getIntersectionOfArrays() { | |
for (var _len2 = arguments.length, arrays = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { | |
arrays[_key2] = arguments[_key2]; | |
} | |
var _ref2 = [].concat(arrays), | |
first = _ref2[0], | |
rest = _ref2.slice(1); | |
var filteredFirstArray = first; | |
arrayEach(rest, function (array) { | |
filteredFirstArray = filteredFirstArray.filter(function (value) { | |
return array.includes(value); | |
}); | |
}); | |
return filteredFirstArray; | |
} | |
/** | |
* Union of two or more arrays. | |
* | |
* @param {...Array} arrays Array of strings or array of numbers. | |
* @returns {Array} Returns the elements that exist in any of the arrays, without duplicates. | |
*/ | |
function getUnionOfArrays() { | |
for (var _len3 = arguments.length, arrays = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { | |
arrays[_key3] = arguments[_key3]; | |
} | |
var _ref3 = [].concat(arrays), | |
first = _ref3[0], | |
rest = _ref3.slice(1); | |
var set = new Set(first); | |
arrayEach(rest, function (array) { | |
arrayEach(array, function (value) { | |
if (!set.has(value)) { | |
set.add(value); | |
} | |
}); | |
}); | |
return Array.from(set); | |
} | |
/** | |
* Convert a separated strings to an array of strings. | |
* | |
* @param {string} value A string of class name(s). | |
* @param {string|RegExp} delimiter The pattern describing where each split should occur. | |
* @returns {string[]} Returns array of string or empty array. | |
*/ | |
function stringToArray(value) { | |
var delimiter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ' '; | |
return value.split(delimiter); | |
} | |
/***/ }), | |
/* 21 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var $ = __webpack_require__(31); | |
var global = __webpack_require__(30); | |
var fails = __webpack_require__(43); | |
var isArray = __webpack_require__(171); | |
var isObject = __webpack_require__(65); | |
var toObject = __webpack_require__(92); | |
var lengthOfArrayLike = __webpack_require__(98); | |
var createProperty = __webpack_require__(152); | |
var arraySpeciesCreate = __webpack_require__(255); | |
var arrayMethodHasSpeciesSupport = __webpack_require__(172); | |
var wellKnownSymbol = __webpack_require__(60); | |
var V8_VERSION = __webpack_require__(166); | |
var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable'); | |
var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; | |
var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded'; | |
var TypeError = global.TypeError; | |
// We can't use this feature detection in V8 since it causes | |
// deoptimization and serious performance degradation | |
// https://github.com/zloirock/core-js/issues/679 | |
var IS_CONCAT_SPREADABLE_SUPPORT = V8_VERSION >= 51 || !fails(function () { | |
var array = []; | |
array[IS_CONCAT_SPREADABLE] = false; | |
return array.concat()[0] !== array; | |
}); | |
var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat'); | |
var isConcatSpreadable = function (O) { | |
if (!isObject(O)) return false; | |
var spreadable = O[IS_CONCAT_SPREADABLE]; | |
return spreadable !== undefined ? !!spreadable : isArray(O); | |
}; | |
var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT; | |
// `Array.prototype.concat` method | |
// https://tc39.es/ecma262/#sec-array.prototype.concat | |
// with adding support of @@isConcatSpreadable and @@species | |
$({ target: 'Array', proto: true, forced: FORCED }, { | |
// eslint-disable-next-line no-unused-vars -- required for `.length` | |
concat: function concat(arg) { | |
var O = toObject(this); | |
var A = arraySpeciesCreate(O, 0); | |
var n = 0; | |
var i, k, length, len, E; | |
for (i = -1, length = arguments.length; i < length; i++) { | |
E = i === -1 ? O : arguments[i]; | |
if (isConcatSpreadable(E)) { | |
len = lengthOfArrayLike(E); | |
if (n + len > MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED); | |
for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]); | |
} else { | |
if (n >= MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED); | |
createProperty(A, n++, E); | |
} | |
} | |
A.length = n; | |
return A; | |
} | |
}); | |
/***/ }), | |
/* 22 */ | |
/***/ (function(module, exports) { | |
function _typeof(obj) { | |
"@babel/helpers - typeof"; | |
return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { | |
return typeof obj; | |
} : function (obj) { | |
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; | |
}, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj); | |
} | |
module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports; | |
/***/ }), | |
/* 23 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var $ = __webpack_require__(31); | |
var from = __webpack_require__(634); | |
var checkCorrectnessOfIteration = __webpack_require__(336); | |
var INCORRECT_ITERATION = !checkCorrectnessOfIteration(function (iterable) { | |
// eslint-disable-next-line es/no-array-from -- required for testing | |
Array.from(iterable); | |
}); | |
// `Array.from` method | |
// https://tc39.es/ecma262/#sec-array.from | |
$({ target: 'Array', stat: true, forced: INCORRECT_ITERATION }, { | |
from: from | |
}); | |
/***/ }), | |
/* 24 */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ErrorType", function() { return ErrorType; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CellType", function() { return CellType; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getCellType", function() { return getCellType; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CellValueNoNumber", function() { return CellValueNoNumber; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CellValueJustNumber", function() { return CellValueJustNumber; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CellValueType", function() { return CellValueType; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CellValueDetailedType", function() { return CellValueDetailedType; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CellValueTypeOrd", function() { return CellValueTypeOrd; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getCellValueType", function() { return getCellValueType; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getCellValueDetailedType", function() { return getCellValueDetailedType; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getCellValueFormat", function() { return getCellValueFormat; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CellError", function() { return CellError; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "simpleRowAddress", function() { return simpleRowAddress; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "invalidSimpleRowAddress", function() { return invalidSimpleRowAddress; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "simpleColumnAddress", function() { return simpleColumnAddress; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "invalidSimpleColumnAddress", function() { return invalidSimpleColumnAddress; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "simpleCellAddress", function() { return simpleCellAddress; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "invalidSimpleCellAddress", function() { return invalidSimpleCellAddress; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "movedSimpleCellAddress", function() { return movedSimpleCellAddress; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addressKey", function() { return addressKey; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isSimpleCellAddress", function() { return isSimpleCellAddress; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "absoluteSheetReference", function() { return absoluteSheetReference; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "equalSimpleCellAddress", function() { return equalSimpleCellAddress; }); | |
/* harmony import */ var core_js_modules_es_object_assign_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(89); | |
/* harmony import */ var core_js_modules_es_object_assign_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_assign_js__WEBPACK_IMPORTED_MODULE_0__); | |
/* harmony import */ var core_js_modules_es_array_concat_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(21); | |
/* harmony import */ var core_js_modules_es_array_concat_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_concat_js__WEBPACK_IMPORTED_MODULE_1__); | |
/* harmony import */ var core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(9); | |
/* harmony import */ var core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_2__); | |
/* harmony import */ var core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(10); | |
/* harmony import */ var core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_3__); | |
/* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(0); | |
/* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_4__); | |
/* harmony import */ var core_js_modules_es_symbol_iterator_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(11); | |
/* harmony import */ var core_js_modules_es_symbol_iterator_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_symbol_iterator_js__WEBPACK_IMPORTED_MODULE_5__); | |
/* harmony import */ var core_js_modules_es_array_iterator_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(3); | |
/* harmony import */ var core_js_modules_es_array_iterator_js__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_iterator_js__WEBPACK_IMPORTED_MODULE_6__); | |
/* harmony import */ var core_js_modules_es_string_iterator_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(2); | |
/* harmony import */ var core_js_modules_es_string_iterator_js__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_string_iterator_js__WEBPACK_IMPORTED_MODULE_7__); | |
/* harmony import */ var core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(4); | |
/* harmony import */ var core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_8__); | |
/* harmony import */ var _DependencyGraph__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(124); | |
/* harmony import */ var _error_message__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(46); | |
/* harmony import */ var _interpreter_InterpreterValue__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(51); | |
/* harmony import */ var _interpreter_SimpleRangeValue__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(80); | |
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | |
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | |
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | |
/** | |
* @license | |
* Copyright (c) 2021 Handsoncode. All rights reserved. | |
*/ | |
/** | |
* Possible errors returned by our interpreter. | |
*/ | |
var ErrorType; | |
(function (ErrorType) { | |
/** Division by zero. */ | |
ErrorType["DIV_BY_ZERO"] = "DIV_BY_ZERO"; | |
/** Unknown function name. */ | |
ErrorType["NAME"] = "NAME"; | |
ErrorType["VALUE"] = "VALUE"; | |
ErrorType["NUM"] = "NUM"; | |
ErrorType["NA"] = "NA"; | |
/** Cyclic dependency. */ | |
ErrorType["CYCLE"] = "CYCLE"; | |
/** Wrong address reference. */ | |
ErrorType["REF"] = "REF"; | |
/** Array spill error. */ | |
ErrorType["SPILL"] = "SPILL"; | |
/** Invalid/missing licence error. */ | |
ErrorType["LIC"] = "LIC"; | |
/** Generic error */ | |
ErrorType["ERROR"] = "ERROR"; | |
})(ErrorType || (ErrorType = {})); | |
var CellType; | |
(function (CellType) { | |
CellType["FORMULA"] = "FORMULA"; | |
CellType["VALUE"] = "VALUE"; | |
CellType["ARRAY"] = "ARRAY"; | |
CellType["EMPTY"] = "EMPTY"; | |
CellType["ARRAYFORMULA"] = "ARRAYFORMULA"; | |
})(CellType || (CellType = {})); | |
var getCellType = function getCellType(vertex, address) { | |
if (vertex instanceof _DependencyGraph__WEBPACK_IMPORTED_MODULE_9__["ArrayVertex"]) { | |
if (vertex.isLeftCorner(address)) { | |
return CellType.ARRAYFORMULA; | |
} else { | |
return CellType.ARRAY; | |
} | |
} | |
if (vertex instanceof _DependencyGraph__WEBPACK_IMPORTED_MODULE_9__["FormulaCellVertex"] || vertex instanceof _DependencyGraph__WEBPACK_IMPORTED_MODULE_9__["ParsingErrorVertex"]) { | |
return CellType.FORMULA; | |
} | |
if (vertex instanceof _DependencyGraph__WEBPACK_IMPORTED_MODULE_9__["ValueCellVertex"]) { | |
return CellType.VALUE; | |
} | |
return CellType.EMPTY; | |
}; | |
var CellValueNoNumber; | |
(function (CellValueNoNumber) { | |
CellValueNoNumber["EMPTY"] = "EMPTY"; | |
CellValueNoNumber["NUMBER"] = "NUMBER"; | |
CellValueNoNumber["STRING"] = "STRING"; | |
CellValueNoNumber["BOOLEAN"] = "BOOLEAN"; | |
CellValueNoNumber["ERROR"] = "ERROR"; | |
})(CellValueNoNumber || (CellValueNoNumber = {})); | |
var CellValueJustNumber; | |
(function (CellValueJustNumber) { | |
CellValueJustNumber["NUMBER"] = "NUMBER"; | |
})(CellValueJustNumber || (CellValueJustNumber = {})); | |
var CellValueType = Object.assign(Object.assign({}, CellValueNoNumber), CellValueJustNumber); | |
var CellValueDetailedType = Object.assign(Object.assign({}, CellValueNoNumber), _interpreter_InterpreterValue__WEBPACK_IMPORTED_MODULE_11__["NumberType"]); | |
var CellValueTypeOrd = function CellValueTypeOrd(arg) { | |
switch (arg) { | |
case CellValueType.EMPTY: | |
return 0; | |
case CellValueType.NUMBER: | |
return 1; | |
case CellValueType.STRING: | |
return 2; | |
case CellValueType.BOOLEAN: | |
return 3; | |
case CellValueType.ERROR: | |
return 4; | |
} | |
throw new Error('Cell value not computed'); | |
}; | |
var getCellValueType = function getCellValueType(cellValue) { | |
if (cellValue === _interpreter_InterpreterValue__WEBPACK_IMPORTED_MODULE_11__["EmptyValue"]) { | |
return CellValueType.EMPTY; | |
} | |
if (cellValue instanceof CellError || cellValue instanceof _interpreter_SimpleRangeValue__WEBPACK_IMPORTED_MODULE_12__["SimpleRangeValue"]) { | |
return CellValueType.ERROR; | |
} | |
if (typeof cellValue === 'string') { | |
return CellValueType.STRING; | |
} else if (Object(_interpreter_InterpreterValue__WEBPACK_IMPORTED_MODULE_11__["isExtendedNumber"])(cellValue)) { | |
return CellValueType.NUMBER; | |
} else if (typeof cellValue === 'boolean') { | |
return CellValueType.BOOLEAN; | |
} | |
throw new Error('Cell value not computed'); | |
}; | |
var getCellValueDetailedType = function getCellValueDetailedType(cellValue) { | |
if (Object(_interpreter_InterpreterValue__WEBPACK_IMPORTED_MODULE_11__["isExtendedNumber"])(cellValue)) { | |
return Object(_interpreter_InterpreterValue__WEBPACK_IMPORTED_MODULE_11__["getTypeOfExtendedNumber"])(cellValue); | |
} else { | |
return getCellValueType(cellValue); | |
} | |
}; | |
var getCellValueFormat = function getCellValueFormat(cellValue) { | |
if (Object(_interpreter_InterpreterValue__WEBPACK_IMPORTED_MODULE_11__["isExtendedNumber"])(cellValue)) { | |
return Object(_interpreter_InterpreterValue__WEBPACK_IMPORTED_MODULE_11__["getFormatOfExtendedNumber"])(cellValue); | |
} else { | |
return undefined; | |
} | |
}; | |
var CellError = /*#__PURE__*/function () { | |
function CellError(type, message, root) { | |
_classCallCheck(this, CellError); | |
this.type = type; | |
this.message = message; | |
this.root = root; | |
} | |
_createClass(CellError, [{ | |
key: "attachRootVertex", | |
value: function attachRootVertex(vertex) { | |
if (this.root === undefined) { | |
return new CellError(this.type, this.message, vertex); | |
} else { | |
return this; | |
} | |
} | |
}], [{ | |
key: "parsingError", | |
value: function parsingError() { | |
return new CellError(ErrorType.ERROR, _error_message__WEBPACK_IMPORTED_MODULE_10__["ErrorMessage"].ParseError); | |
} | |
}]); | |
return CellError; | |
}(); | |
var simpleRowAddress = function simpleRowAddress(sheet, row) { | |
return { | |
sheet: sheet, | |
row: row | |
}; | |
}; | |
var invalidSimpleRowAddress = function invalidSimpleRowAddress(address) { | |
return address.row < 0; | |
}; | |
var simpleColumnAddress = function simpleColumnAddress(sheet, col) { | |
return { | |
sheet: sheet, | |
col: col | |
}; | |
}; | |
var invalidSimpleColumnAddress = function invalidSimpleColumnAddress(address) { | |
return address.col < 0; | |
}; | |
var simpleCellAddress = function simpleCellAddress(sheet, col, row) { | |
return { | |
sheet: sheet, | |
col: col, | |
row: row | |
}; | |
}; | |
var invalidSimpleCellAddress = function invalidSimpleCellAddress(address) { | |
return address.col < 0 || address.row < 0; | |
}; | |
var movedSimpleCellAddress = function movedSimpleCellAddress(address, toSheet, toRight, toBottom) { | |
return simpleCellAddress(toSheet, address.col + toRight, address.row + toBottom); | |
}; | |
var addressKey = function addressKey(address) { | |
return "".concat(address.sheet, ",").concat(address.row, ",").concat(address.col); | |
}; | |
function isSimpleCellAddress(obj) { | |
if (obj && (_typeof(obj) === 'object' || typeof obj === 'function')) { | |
return 'col' in obj && typeof obj.col === 'number' && 'row' in obj && typeof obj.row === 'number' && 'sheet' in obj && typeof obj.sheet === 'number'; | |
} else { | |
return false; | |
} | |
} | |
var absoluteSheetReference = function absoluteSheetReference(address, baseAddress) { | |
var _a; | |
return (_a = address.sheet) !== null && _a !== void 0 ? _a : baseAddress.sheet; | |
}; | |
var equalSimpleCellAddress = function equalSimpleCellAddress(left, right) { | |
return left.sheet === right.sheet && left.col === right.col && left.row === right.row; | |
}; | |
/***/ }), | |
/* 25 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var _interopRequireDefault = __webpack_require__(1); | |
exports.__esModule = true; | |
exports.HTML_CHARACTERS = void 0; | |
exports.addClass = addClass; | |
exports.addEvent = addEvent; | |
exports.clearTextSelection = clearTextSelection; | |
exports.closest = closest; | |
exports.closestDown = closestDown; | |
exports.empty = empty; | |
exports.fastInnerHTML = fastInnerHTML; | |
exports.fastInnerText = fastInnerText; | |
exports.getCaretPosition = getCaretPosition; | |
exports.getComputedStyle = getComputedStyle; | |
exports.getCssTransform = getCssTransform; | |
exports.getFrameElement = getFrameElement; | |
exports.getParent = getParent; | |
exports.getParentWindow = getParentWindow; | |
exports.getScrollLeft = getScrollLeft; | |
exports.getScrollTop = getScrollTop; | |
exports.getScrollableElement = getScrollableElement; | |
exports.getScrollbarWidth = getScrollbarWidth; | |
exports.getSelectionEndPosition = getSelectionEndPosition; | |
exports.getSelectionText = getSelectionText; | |
exports.getStyle = getStyle; | |
exports.getTrimmingContainer = getTrimmingContainer; | |
exports.getWindowScrollLeft = getWindowScrollLeft; | |
exports.getWindowScrollTop = getWindowScrollTop; | |
exports.hasAccessToParentWindow = hasAccessToParentWindow; | |
exports.hasClass = hasClass; | |
exports.hasHorizontalScrollbar = hasHorizontalScrollbar; | |
exports.hasVerticalScrollbar = hasVerticalScrollbar; | |
exports.index = index; | |
exports.innerHeight = innerHeight; | |
exports.innerWidth = innerWidth; | |
exports.isChildOf = isChildOf; | |
exports.isDetached = isDetached; | |
exports.isInput = isInput; | |
exports.isOutsideInput = isOutsideInput; | |
exports.isVisible = isVisible; | |
exports.matchesCSSRules = matchesCSSRules; | |
exports.offset = offset; | |
exports.outerHeight = outerHeight; | |
exports.outerWidth = outerWidth; | |
exports.overlayContainsElement = overlayContainsElement; | |
exports.removeClass = removeClass; | |
exports.removeEvent = removeEvent; | |
exports.removeTextNodes = removeTextNodes; | |
exports.resetCssTransform = resetCssTransform; | |
exports.selectElementIfAllowed = selectElementIfAllowed; | |
exports.setCaretPosition = setCaretPosition; | |
exports.setOverlayPosition = setOverlayPosition; | |
var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(44)); | |
__webpack_require__(27); | |
__webpack_require__(42); | |
__webpack_require__(52); | |
__webpack_require__(14); | |
__webpack_require__(33); | |
__webpack_require__(40); | |
__webpack_require__(0); | |
__webpack_require__(13); | |
__webpack_require__(63); | |
__webpack_require__(95); | |
__webpack_require__(67); | |
__webpack_require__(75); | |
__webpack_require__(107); | |
__webpack_require__(64); | |
__webpack_require__(21); | |
var _feature = __webpack_require__(127); | |
var _browser = __webpack_require__(105); | |
var _string = __webpack_require__(97); | |
/** | |
* Get the parent of the specified node in the DOM tree. | |
* | |
* @param {HTMLElement} element Element from which traversing is started. | |
* @param {number} [level=0] Traversing deep level. | |
* @returns {HTMLElement|null} | |
*/ | |
function getParent(element) { | |
var level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; | |
var iteration = -1; | |
var parent = null; | |
var elementToCheck = element; | |
while (elementToCheck !== null) { | |
if (iteration === level) { | |
parent = elementToCheck; | |
break; | |
} | |
if (elementToCheck.host && elementToCheck.nodeType === Node.DOCUMENT_FRAGMENT_NODE) { | |
elementToCheck = elementToCheck.host; | |
} else { | |
iteration += 1; | |
elementToCheck = elementToCheck.parentNode; | |
} | |
} | |
return parent; | |
} | |
/** | |
* Gets `frameElement` of the specified frame. Returns null if it is a top frame or if script has no access to read property. | |
* | |
* @param {Window} frame Frame from which should be get frameElement in safe way. | |
* @returns {HTMLIFrameElement|null} | |
*/ | |
function getFrameElement(frame) { | |
return Object.getPrototypeOf(frame.parent) && frame.frameElement; | |
} | |
/** | |
* Gets parent frame of the specified frame. Returns null if it is a top frame or if script has no access to read property. | |
* | |
* @param {Window} frame Frame from which should be get frameElement in safe way. | |
* @returns {Window|null} | |
*/ | |
function getParentWindow(frame) { | |
return getFrameElement(frame) && frame.parent; | |
} | |
/** | |
* Checks if script has access to read from parent frame of specified frame. | |
* | |
* @param {Window} frame Frame from which should be get frameElement in safe way. | |
* @returns {boolean} | |
*/ | |
function hasAccessToParentWindow(frame) { | |
return !!Object.getPrototypeOf(frame.parent); | |
} | |
/** | |
* Goes up the DOM tree (including given element) until it finds an parent element that matches the nodes or nodes name. | |
* This method goes up through web components. | |
* | |
* @param {Node} element Element from which traversing is started. | |
* @param {Array<string|Node>} [nodes] Array of elements or Array of elements name (in uppercase form). | |
* @param {Node} [until] The element until the traversing ends. | |
* @returns {Node|null} | |
*/ | |
function closest(element) { | |
var nodes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; | |
var until = arguments.length > 2 ? arguments[2] : undefined; | |
var _Node = Node, | |
ELEMENT_NODE = _Node.ELEMENT_NODE, | |
DOCUMENT_FRAGMENT_NODE = _Node.DOCUMENT_FRAGMENT_NODE; | |
var elementToCheck = element; | |
while (elementToCheck !== null && elementToCheck !== void 0 && elementToCheck !== until) { | |
var _elementToCheck = elementToCheck, | |
nodeType = _elementToCheck.nodeType, | |
nodeName = _elementToCheck.nodeName; | |
if (nodeType === ELEMENT_NODE && (nodes.includes(nodeName) || nodes.includes(elementToCheck))) { | |
return elementToCheck; | |
} | |
var _elementToCheck2 = elementToCheck, | |
host = _elementToCheck2.host; | |
if (host && nodeType === DOCUMENT_FRAGMENT_NODE) { | |
elementToCheck = host; | |
} else { | |
elementToCheck = elementToCheck.parentNode; | |
} | |
} | |
return null; | |
} | |
/** | |
* Goes "down" the DOM tree (including given element) until it finds an element that matches the nodes or nodes name. | |
* | |
* @param {HTMLElement} element Element from which traversing is started. | |
* @param {Array} nodes Array of elements or Array of elements name. | |
* @param {HTMLElement} [until] The list of elements until the traversing ends. | |
* @returns {HTMLElement|null} | |
*/ | |
function closestDown(element, nodes, until) { | |
var matched = []; | |
var elementToCheck = element; | |
while (elementToCheck) { | |
elementToCheck = closest(elementToCheck, nodes, until); | |
if (!elementToCheck || until && !until.contains(elementToCheck)) { | |
break; | |
} | |
matched.push(elementToCheck); | |
if (elementToCheck.host && elementToCheck.nodeType === Node.DOCUMENT_FRAGMENT_NODE) { | |
elementToCheck = elementToCheck.host; | |
} else { | |
elementToCheck = elementToCheck.parentNode; | |
} | |
} | |
var length = matched.length; | |
return length ? matched[length - 1] : null; | |
} | |
/** | |
* Goes up the DOM tree and checks if element is child of another element. | |
* | |
* @param {HTMLElement} child Child element An element to check. | |
* @param {object|string} parent Parent element OR selector of the parent element. | |
* If string provided, function returns `true` for the first occurrence of element with that class. | |
* @returns {boolean} | |
*/ | |
function isChildOf(child, parent) { | |
var node = child.parentNode; | |
var queriedParents = []; | |
if (typeof parent === 'string') { | |
if (child.defaultView) { | |
queriedParents = Array.prototype.slice.call(child.querySelectorAll(parent), 0); | |
} else { | |
queriedParents = Array.prototype.slice.call(child.ownerDocument.querySelectorAll(parent), 0); | |
} | |
} else { | |
queriedParents.push(parent); | |
} | |
while (node !== null) { | |
if (queriedParents.indexOf(node) > -1) { | |
return true; | |
} | |
node = node.parentNode; | |
} | |
return false; | |
} | |
/** | |
* Counts index of element within its parent. | |
* WARNING: for performance reasons, assumes there are only element nodes (no text nodes). This is true | |
* for Walkotnable, otherwise would need to check for nodeType or use previousElementSibling. | |
* | |
* @see http://jsperf.com/sibling-index/10 | |
* @param {Element} element The element to check. | |
* @returns {number} | |
*/ | |
function index(element) { | |
var i = 0; | |
var elementToCheck = element; | |
if (elementToCheck.previousSibling) { | |
/* eslint-disable no-cond-assign */ | |
while (elementToCheck = elementToCheck.previousSibling) { | |
i += 1; | |
} | |
} | |
return i; | |
} | |
/** | |
* Check if the provided overlay contains the provided element. | |
* | |
* @param {string} overlayType The type of the overlay. | |
* @param {HTMLElement} element An element to check. | |
* @param {HTMLElement} root The root element. | |
* @returns {boolean} | |
*/ | |
function overlayContainsElement(overlayType, element, root) { | |
var overlayElement = root.parentElement.querySelector(".ht_clone_".concat(overlayType)); | |
return overlayElement ? overlayElement.contains(element) : null; | |
} | |
var _hasClass; | |
var _addClass; | |
var _removeClass; | |
/** | |
* @param {string} classNames The element "class" attribute string. | |
* @returns {string[]} | |
*/ | |
function filterEmptyClassNames(classNames) { | |
if (!classNames || !classNames.length) { | |
return []; | |
} | |
return classNames.filter(function (x) { | |
return !!x; | |
}); | |
} | |
if ((0, _feature.isClassListSupported)()) { | |
var isSupportMultipleClassesArg = function isSupportMultipleClassesArg(rootDocument) { | |
var element = rootDocument.createElement('div'); | |
element.classList.add('test', 'test2'); | |
return element.classList.contains('test2'); | |
}; | |
_hasClass = function _hasClass(element, className) { | |
if (element.classList === void 0 || typeof className !== 'string' || className === '') { | |
return false; | |
} | |
return element.classList.contains(className); | |
}; | |
_addClass = function _addClass(element, classes) { | |
var rootDocument = element.ownerDocument; | |
var className = classes; | |
if (typeof className === 'string') { | |
className = className.split(' '); | |
} | |
className = filterEmptyClassNames(className); | |
if (className.length > 0) { | |
if (isSupportMultipleClassesArg(rootDocument)) { | |
var _element$classList; | |
(_element$classList = element.classList).add.apply(_element$classList, (0, _toConsumableArray2.default)(className)); | |
} else { | |
var len = 0; | |
while (className[len]) { | |
element.classList.add(className[len]); | |
len += 1; | |
} | |
} | |
} | |
}; | |
_removeClass = function _removeClass(element, classes) { | |
var rootDocument = element.ownerDocument; | |
var className = classes; | |
if (typeof className === 'string') { | |
className = className.split(' '); | |
} | |
className = filterEmptyClassNames(className); | |
if (className.length > 0) { | |
if (isSupportMultipleClassesArg(rootDocument)) { | |
var _element$classList2; | |
(_element$classList2 = element.classList).remove.apply(_element$classList2, (0, _toConsumableArray2.default)(className)); | |
} else { | |
var len = 0; | |
while (className[len]) { | |
element.classList.remove(className[len]); | |
len += 1; | |
} | |
} | |
} | |
}; | |
} else { | |
var createClassNameRegExp = function createClassNameRegExp(className) { | |
return new RegExp("(\\s|^)".concat(className, "(\\s|$)")); | |
}; | |
_hasClass = function _hasClass(element, className) { | |
// http://snipplr.com/view/3561/addclass-removeclass-hasclass/ | |
return element.className !== void 0 && createClassNameRegExp(className).test(element.className); | |
}; | |
_addClass = function _addClass(element, classes) { | |
var _className = element.className; | |
var className = classes; | |
if (typeof className === 'string') { | |
className = className.split(' '); | |
} | |
className = filterEmptyClassNames(className); | |
if (_className === '') { | |
_className = className.join(' '); | |
} else { | |
for (var len = 0; len < className.length; len++) { | |
if (className[len] && !createClassNameRegExp(className[len]).test(_className)) { | |
_className += " ".concat(className[len]); | |
} | |
} | |
} | |
element.className = _className; | |
}; | |
_removeClass = function _removeClass(element, classes) { | |
var len = 0; | |
var _className = element.className; | |
var className = classes; | |
if (typeof className === 'string') { | |
className = className.split(' '); | |
} | |
className = filterEmptyClassNames(className); | |
while (className[len]) { | |
// String.prototype.trim is defined in polyfill.js | |
_className = _className.replace(createClassNameRegExp(className[len]), ' ').trim(); | |
len += 1; | |
} | |
if (element.className !== _className) { | |
element.className = _className; | |
} | |
}; | |
} | |
/** | |
* Checks if element has class name. | |
* | |
* @param {HTMLElement} element An element to check. | |
* @param {string} className Class name to check. | |
* @returns {boolean} | |
*/ | |
function hasClass(element, className) { | |
return _hasClass(element, className); | |
} | |
/** | |
* Add class name to an element. | |
* | |
* @param {HTMLElement} element An element to process. | |
* @param {string|Array} className Class name as string or array of strings. | |
*/ | |
function addClass(element, className) { | |
_addClass(element, className); | |
} | |
/** | |
* Remove class name from an element. | |
* | |
* @param {HTMLElement} element An element to process. | |
* @param {string|Array} className Class name as string or array of strings. | |
*/ | |
function removeClass(element, className) { | |
_removeClass(element, className); | |
} | |
/** | |
* @param {HTMLElement} element An element from the text is removed. | |
*/ | |
function removeTextNodes(element) { | |
if (element.nodeType === 3) { | |
element.parentNode.removeChild(element); // bye text nodes! | |
} else if (['TABLE', 'THEAD', 'TBODY', 'TFOOT', 'TR'].indexOf(element.nodeName) > -1) { | |
var childs = element.childNodes; | |
for (var i = childs.length - 1; i >= 0; i--) { | |
removeTextNodes(childs[i]); | |
} | |
} | |
} | |
/** | |
* Remove childs function | |
* WARNING - this doesn't unload events and data attached by jQuery | |
* http://jsperf.com/jquery-html-vs-empty-vs-innerhtml/9 | |
* http://jsperf.com/jquery-html-vs-empty-vs-innerhtml/11 - no siginificant improvement with Chrome remove() method. | |
* | |
* @param {HTMLElement} element An element to clear. | |
*/ | |
function empty(element) { | |
var child; | |
/* eslint-disable no-cond-assign */ | |
while (child = element.lastChild) { | |
element.removeChild(child); | |
} | |
} | |
var HTML_CHARACTERS = /(<(.*)>|&(.*);)/; | |
/** | |
* Insert content into element trying avoid innerHTML method. | |
* | |
* @param {HTMLElement} element An element to write into. | |
* @param {string} content The text to write. | |
* @param {boolean} [sanitizeContent=true] If `true`, the content will be sanitized before writing to the element. | |
*/ | |
exports.HTML_CHARACTERS = HTML_CHARACTERS; | |
function fastInnerHTML(element, content) { | |
var sanitizeContent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; | |
if (HTML_CHARACTERS.test(content)) { | |
element.innerHTML = sanitizeContent ? (0, _string.sanitize)(content) : content; | |
} else { | |
fastInnerText(element, content); | |
} | |
} | |
/** | |
* Insert text content into element. | |
* | |
* @param {HTMLElement} element An element to write into. | |
* @param {string} content The text to write. | |
*/ | |
function fastInnerText(element, content) { | |
var child = element.firstChild; | |
if (child && child.nodeType === 3 && child.nextSibling === null) { | |
// fast lane - replace existing text node | |
if (_feature.isTextContentSupported) { | |
// http://jsperf.com/replace-text-vs-reuse | |
child.textContent = content; | |
} else { | |
// http://jsperf.com/replace-text-vs-reuse | |
child.data = content; | |
} | |
} else { | |
// slow lane - empty element and insert a text node | |
empty(element); | |
element.appendChild(element.ownerDocument.createTextNode(content)); | |
} | |
} | |
/** | |
* Returns true if element is attached to the DOM and visible, false otherwise. | |
* | |
* @param {HTMLElement} element An element to check. | |
* @returns {boolean} | |
*/ | |
function isVisible(element) { | |
var documentElement = element.ownerDocument.documentElement; | |
var next = element; | |
while (next !== documentElement) { | |
// until <html> reached | |
if (next === null) { | |
// parent detached from DOM | |
return false; | |
} else if (next.nodeType === Node.DOCUMENT_FRAGMENT_NODE) { | |
if (next.host) { | |
// this is Web Components Shadow DOM | |
// see: http://w3c.github.io/webcomponents/spec/shadow/#encapsulation | |
// according to spec, should be if (next.ownerDocument !== window.document), but that doesn't work yet | |
if (next.host.impl) { | |
// Chrome 33.0.1723.0 canary (2013-11-29) Web Platform features disabled | |
return isVisible(next.host.impl); | |
} else if (next.host) { | |
// Chrome 33.0.1723.0 canary (2013-11-29) Web Platform features enabled | |
return isVisible(next.host); | |
} | |
throw new Error('Lost in Web Components world'); | |
} else { | |
return false; // this is a node detached from document in IE8 | |
} | |
} else if (next.style && next.style.display === 'none') { | |
return false; | |
} | |
next = next.parentNode; | |
} | |
return true; | |
} | |
/** | |
* Returns elements top and left offset relative to the document. Function is not compatible with jQuery offset. | |
* | |
* @param {HTMLElement} element An element to get the offset position from. | |
* @returns {object} Returns object with `top` and `left` props. | |
*/ | |
function offset(element) { | |
var rootDocument = element.ownerDocument; | |
var rootWindow = rootDocument.defaultView; | |
var documentElement = rootDocument.documentElement; | |
var elementToCheck = element; | |
var offsetLeft; | |
var offsetTop; | |
var lastElem; | |
var box; | |
if ((0, _feature.hasCaptionProblem)() && elementToCheck.firstChild && elementToCheck.firstChild.nodeName === 'CAPTION') { | |
// fixes problem with Firefox ignoring <caption> in TABLE offset (see also export outerHeight) | |
// http://jsperf.com/offset-vs-getboundingclientrect/8 | |
box = elementToCheck.getBoundingClientRect(); | |
return { | |
top: box.top + (rootWindow.pageYOffset || documentElement.scrollTop) - (documentElement.clientTop || 0), | |
left: box.left + (rootWindow.pageXOffset || documentElement.scrollLeft) - (documentElement.clientLeft || 0) | |
}; | |
} | |
offsetLeft = elementToCheck.offsetLeft; | |
offsetTop = elementToCheck.offsetTop; | |
lastElem = elementToCheck; | |
/* eslint-disable no-cond-assign */ | |
while (elementToCheck = elementToCheck.offsetParent) { | |
// from my observation, document.body always has scrollLeft/scrollTop == 0 | |
if (elementToCheck === rootDocument.body) { | |
break; | |
} | |
offsetLeft += elementToCheck.offsetLeft; | |
offsetTop += elementToCheck.offsetTop; | |
lastElem = elementToCheck; | |
} // slow - http://jsperf.com/offset-vs-getboundingclientrect/6 | |
if (lastElem && lastElem.style.position === 'fixed') { | |
// if(lastElem !== document.body) { //faster but does gives false positive in Firefox | |
offsetLeft += rootWindow.pageXOffset || documentElement.scrollLeft; | |
offsetTop += rootWindow.pageYOffset || documentElement.scrollTop; | |
} | |
return { | |
left: offsetLeft, | |
top: offsetTop | |
}; | |
} | |
/** | |
* Returns the document's scrollTop property. | |
* | |
* @param {Window} [rootWindow] The document window owner. | |
* @returns {number} | |
*/ | |
// eslint-disable-next-line no-restricted-globals | |
function getWindowScrollTop() { | |
var rootWindow = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window; | |
var res = rootWindow.scrollY; | |
if (res === void 0) { | |
// IE8-11 | |
res = rootWindow.document.documentElement.scrollTop; | |
} | |
return res; | |
} | |
/** | |
* Returns the document's scrollLeft property. | |
* | |
* @param {Window} [rootWindow] The document window owner. | |
* @returns {number} | |
*/ | |
// eslint-disable-next-line no-restricted-globals | |
function getWindowScrollLeft() { | |
var rootWindow = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window; | |
var res = rootWindow.scrollX; | |
if (res === void 0) { | |
// IE8-11 | |
res = rootWindow.document.documentElement.scrollLeft; | |
} | |
return res; | |
} | |
/** | |
* Returns the provided element's scrollTop property. | |
* | |
* @param {HTMLElement} element An element to get the scroll top position from. | |
* @param {Window} [rootWindow] The document window owner. | |
* @returns {number} | |
*/ | |
// eslint-disable-next-line no-restricted-globals | |
function getScrollTop(element) { | |
var rootWindow = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : window; | |
if (element === rootWindow) { | |
return getWindowScrollTop(rootWindow); | |
} | |
return element.scrollTop; | |
} | |
/** | |
* Returns the provided element's scrollLeft property. | |
* | |
* @param {HTMLElement} element An element to get the scroll left position from. | |
* @param {Window} [rootWindow] The document window owner. | |
* @returns {number} | |
*/ | |
// eslint-disable-next-line no-restricted-globals | |
function getScrollLeft(element) { | |
var rootWindow = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : window; | |
if (element === rootWindow) { | |
return getWindowScrollLeft(rootWindow); | |
} | |
return element.scrollLeft; | |
} | |
/** | |
* Returns a DOM element responsible for scrolling of the provided element. | |
* | |
* @param {HTMLElement} element An element to get the scrollable element from. | |
* @returns {HTMLElement} Element's scrollable parent. | |
*/ | |
function getScrollableElement(element) { | |
var rootDocument = element.ownerDocument; | |
var rootWindow = rootDocument ? rootDocument.defaultView : void 0; | |
if (!rootDocument) { | |
rootDocument = element.document ? element.document : element; | |
rootWindow = rootDocument.defaultView; | |
} | |
var props = ['auto', 'scroll']; | |
var supportedGetComputedStyle = (0, _feature.isGetComputedStyleSupported)(); | |
var el = element.parentNode; | |
while (el && el.style && rootDocument.body !== el) { | |
var _el$style = el.style, | |
overflow = _el$style.overflow, | |
overflowX = _el$style.overflowX, | |
overflowY = _el$style.overflowY; | |
if ([overflow, overflowX, overflowY].includes('scroll')) { | |
return el; | |
} else if (supportedGetComputedStyle) { | |
var _rootWindow$getComput = rootWindow.getComputedStyle(el); | |
overflow = _rootWindow$getComput.overflow; | |
overflowX = _rootWindow$getComput.overflowX; | |
overflowY = _rootWindow$getComput.overflowY; | |
if (props.includes(overflow) || props.includes(overflowX) || props.includes(overflowY)) { | |
return el; | |
} | |
} // The '+ 1' after the scrollHeight/scrollWidth is to prevent problems with zoomed out Chrome. | |
if (el.clientHeight <= el.scrollHeight + 1 && (props.includes(overflowY) || props.includes(overflow))) { | |
return el; | |
} | |
if (el.clientWidth <= el.scrollWidth + 1 && (props.includes(overflowX) || props.includes(overflow))) { | |
return el; | |
} | |
el = el.parentNode; | |
} | |
return rootWindow; | |
} | |
/** | |
* Returns a DOM element responsible for trimming the provided element. | |
* | |
* @param {HTMLElement} base Base element. | |
* @returns {HTMLElement} Base element's trimming parent. | |
*/ | |
function getTrimmingContainer(base) { | |
var rootDocument = base.ownerDocument; | |
var rootWindow = rootDocument.defaultView; | |
var el = base.parentNode; | |
while (el && el.style && rootDocument.body !== el) { | |
if (el.style.overflow !== 'visible' && el.style.overflow !== '') { | |
return el; | |
} | |
var computedStyle = getComputedStyle(el, rootWindow); | |
var allowedProperties = ['scroll', 'hidden', 'auto']; | |
var property = computedStyle.getPropertyValue('overflow'); | |
var propertyY = computedStyle.getPropertyValue('overflow-y'); | |
var propertyX = computedStyle.getPropertyValue('overflow-x'); | |
if (allowedProperties.includes(property) || allowedProperties.includes(propertyY) || allowedProperties.includes(propertyX)) { | |
return el; | |
} | |
el = el.parentNode; | |
} | |
return rootWindow; | |
} | |
/** | |
* Returns a style property for the provided element. (Be it an inline or external style). | |
* | |
* @param {HTMLElement} element An element to get the style from. | |
* @param {string} prop Wanted property. | |
* @param {Window} [rootWindow] The document window owner. | |
* @returns {string|undefined} Element's style property. | |
*/ | |
// eslint-disable-next-line no-restricted-globals | |
function getStyle(element, prop) { | |
var rootWindow = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : window; | |
if (!element) { | |
return; | |
} else if (element === rootWindow) { | |
if (prop === 'width') { | |
return "".concat(rootWindow.innerWidth, "px"); | |
} else if (prop === 'height') { | |
return "".concat(rootWindow.innerHeight, "px"); | |
} | |
return; | |
} | |
var styleProp = element.style[prop]; | |
if (styleProp !== '' && styleProp !== void 0) { | |
return styleProp; | |
} | |
var computedStyle = getComputedStyle(element, rootWindow); | |
if (computedStyle[prop] !== '' && computedStyle[prop] !== void 0) { | |
return computedStyle[prop]; | |
} | |
} | |
/** | |
* Verifies if element fit to provided CSSRule. | |
* | |
* @param {Element} element Element to verify with selector text. | |
* @param {CSSRule} rule Selector text from CSSRule. | |
* @returns {boolean} | |
*/ | |
function matchesCSSRules(element, rule) { | |
var selectorText = rule.selectorText; | |
var result = false; | |
if (rule.type === CSSRule.STYLE_RULE && selectorText) { | |
if (element.msMatchesSelector) { | |
result = element.msMatchesSelector(selectorText); | |
} else if (element.matches) { | |
result = element.matches(selectorText); | |
} | |
} | |
return result; | |
} | |
/** | |
* Returns a computed style object for the provided element. (Needed if style is declared in external stylesheet). | |
* | |
* @param {HTMLElement} element An element to get style from. | |
* @param {Window} [rootWindow] The document window owner. | |
* @returns {IEElementStyle|CssStyle} Elements computed style object. | |
*/ | |
// eslint-disable-next-line no-restricted-globals | |
function getComputedStyle(element) { | |
var rootWindow = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : window; | |
return element.currentStyle || rootWindow.getComputedStyle(element); | |
} | |
/** | |
* Returns the element's outer width. | |
* | |
* @param {HTMLElement} element An element to get the width from. | |
* @returns {number} Element's outer width. | |
*/ | |
function outerWidth(element) { | |
return element.offsetWidth; | |
} | |
/** | |
* Returns the element's outer height. | |
* | |
* @param {HTMLElement} element An element to get the height from. | |
* @returns {number} Element's outer height. | |
*/ | |
function outerHeight(element) { | |
if ((0, _feature.hasCaptionProblem)() && element.firstChild && element.firstChild.nodeName === 'CAPTION') { | |
// fixes problem with Firefox ignoring <caption> in TABLE.offsetHeight | |
// jQuery (1.10.1) still has this unsolved | |
// may be better to just switch to getBoundingClientRect | |
// http://bililite.com/blog/2009/03/27/finding-the-size-of-a-table/ | |
// http://lists.w3.org/Archives/Public/www-style/2009Oct/0089.html | |
// http://bugs.jquery.com/ticket/2196 | |
// http://lists.w3.org/Archives/Public/www-style/2009Oct/0140.html#start140 | |
return element.offsetHeight + element.firstChild.offsetHeight; | |
} | |
return element.offsetHeight; | |
} | |
/** | |
* Returns the element's inner height. | |
* | |
* @param {HTMLElement} element An element to get the height from. | |
* @returns {number} Element's inner height. | |
*/ | |
function innerHeight(element) { | |
return element.clientHeight || element.innerHeight; | |
} | |
/** | |
* Returns the element's inner width. | |
* | |
* @param {HTMLElement} element An element to get the width from. | |
* @returns {number} Element's inner width. | |
*/ | |
function innerWidth(element) { | |
return element.clientWidth || element.innerWidth; | |
} | |
/** | |
* @param {HTMLElement} element An element to which the event is added. | |
* @param {string} event The event name. | |
* @param {Function} callback The callback to add. | |
*/ | |
function addEvent(element, event, callback) { | |
element.addEventListener(event, callback, false); | |
} | |
/** | |
* @param {HTMLElement} element An element from which the event is removed. | |
* @param {string} event The event name. | |
* @param {Function} callback The function reference to remove. | |
*/ | |
function removeEvent(element, event, callback) { | |
element.removeEventListener(event, callback, false); | |
} | |
/** | |
* Returns caret position in text input. | |
* | |
* @author https://stackoverflow.com/questions/263743/how-to-get-caret-position-in-textarea | |
* @param {HTMLElement} el An element to check. | |
* @returns {number} | |
*/ | |
function getCaretPosition(el) { | |
var rootDocument = el.ownerDocument; | |
if (el.selectionStart) { | |
return el.selectionStart; | |
} else if (rootDocument.selection) { | |
// IE8 | |
el.focus(); | |
var r = rootDocument.selection.createRange(); | |
if (r === null) { | |
return 0; | |
} | |
var re = el.createTextRange(); | |
var rc = re.duplicate(); | |
re.moveToBookmark(r.getBookmark()); | |
rc.setEndPoint('EndToStart', re); | |
return rc.text.length; | |
} | |
return 0; | |
} | |
/** | |
* Returns end of the selection in text input. | |
* | |
* @param {HTMLElement} el An element to check. | |
* @returns {number} | |
*/ | |
function getSelectionEndPosition(el) { | |
var rootDocument = el.ownerDocument; | |
if (el.selectionEnd) { | |
return el.selectionEnd; | |
} else if (rootDocument.selection) { | |
// IE8 | |
var r = rootDocument.selection.createRange(); | |
if (r === null) { | |
return 0; | |
} | |
var re = el.createTextRange(); | |
return re.text.indexOf(r.text) + r.text.length; | |
} | |
return 0; | |
} | |
/** | |
* Returns text under selection. | |
* | |
* @param {Window} [rootWindow] The document window owner. | |
* @returns {string} | |
*/ | |
// eslint-disable-next-line no-restricted-globals | |
function getSelectionText() { | |
var rootWindow = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window; | |
var rootDocument = rootWindow.document; | |
var text = ''; | |
if (rootWindow.getSelection) { | |
text = rootWindow.getSelection().toString(); | |
} else if (rootDocument.selection && rootDocument.selection.type !== 'Control') { | |
text = rootDocument.selection.createRange().text; | |
} | |
return text; | |
} | |
/** | |
* Cross-platform helper to clear text selection. | |
* | |
* @param {Window} [rootWindow] The document window owner. | |
*/ | |
// eslint-disable-next-line no-restricted-globals | |
function clearTextSelection() { | |
var rootWindow = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window; | |
var rootDocument = rootWindow.document; // http://stackoverflow.com/questions/3169786/clear-text-selection-with-javascript | |
if (rootWindow.getSelection) { | |
if (rootWindow.getSelection().empty) { | |
// Chrome | |
rootWindow.getSelection().empty(); | |
} else if (rootWindow.getSelection().removeAllRanges) { | |
// Firefox | |
rootWindow.getSelection().removeAllRanges(); | |
} | |
} else if (rootDocument.selection) { | |
// IE? | |
rootDocument.selection.empty(); | |
} | |
} | |
/** | |
* Sets caret position in text input. | |
* | |
* @author http://blog.vishalon.net/index.php/javascript-getting-and-setting-caret-position-in-textarea/ | |
* @param {Element} element An element to process. | |
* @param {number} pos The selection start position. | |
* @param {number} endPos The selection end position. | |
*/ | |
function setCaretPosition(element, pos, endPos) { | |
if (endPos === void 0) { | |
endPos = pos; | |
} | |
if (element.setSelectionRange) { | |
element.focus(); | |
try { | |
element.setSelectionRange(pos, endPos); | |
} catch (err) { | |
var elementParent = element.parentNode; | |
var parentDisplayValue = elementParent.style.display; | |
elementParent.style.display = 'block'; | |
element.setSelectionRange(pos, endPos); | |
elementParent.style.display = parentDisplayValue; | |
} | |
} | |
} | |
var cachedScrollbarWidth; | |
/** | |
* Helper to calculate scrollbar width. | |
* Source: https://stackoverflow.com/questions/986937/how-can-i-get-the-browsers-scrollbar-sizes. | |
* | |
* @private | |
* @param {Document} rootDocument The onwer of the document. | |
* @returns {number} | |
*/ | |
// eslint-disable-next-line no-restricted-globals | |
function walkontableCalculateScrollbarWidth() { | |
var rootDocument = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document; | |
var inner = rootDocument.createElement('div'); | |
inner.style.height = '200px'; | |
inner.style.width = '100%'; | |
var outer = rootDocument.createElement('div'); | |
outer.style.boxSizing = 'content-box'; | |
outer.style.height = '150px'; | |
outer.style.left = '0px'; | |
outer.style.overflow = 'hidden'; | |
outer.style.position = 'absolute'; | |
outer.style.top = '0px'; | |
outer.style.width = '200px'; | |
outer.style.visibility = 'hidden'; | |
outer.appendChild(inner); | |
(rootDocument.body || rootDocument.documentElement).appendChild(outer); | |
var w1 = inner.offsetWidth; | |
outer.style.overflow = 'scroll'; | |
var w2 = inner.offsetWidth; | |
if (w1 === w2) { | |
w2 = outer.clientWidth; | |
} | |
(rootDocument.body || rootDocument.documentElement).removeChild(outer); | |
return w1 - w2; | |
} | |
/** | |
* Returns the computed width of the native browser scroll bar. | |
* | |
* @param {Document} [rootDocument] The owner of the document. | |
* @returns {number} Width. | |
*/ | |
// eslint-disable-next-line no-restricted-globals | |
function getScrollbarWidth() { | |
var rootDocument = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document; | |
if (cachedScrollbarWidth === void 0) { | |
cachedScrollbarWidth = walkontableCalculateScrollbarWidth(rootDocument); | |
} | |
return cachedScrollbarWidth; | |
} | |
/** | |
* Checks if the provided element has a vertical scrollbar. | |
* | |
* @param {HTMLElement} element An element to check. | |
* @returns {boolean} | |
*/ | |
function hasVerticalScrollbar(element) { | |
return element.offsetWidth !== element.clientWidth; | |
} | |
/** | |
* Checks if the provided element has a vertical scrollbar. | |
* | |
* @param {HTMLElement} element An element to check. | |
* @returns {boolean} | |
*/ | |
function hasHorizontalScrollbar(element) { | |
return element.offsetHeight !== element.clientHeight; | |
} | |
/** | |
* Sets overlay position depending on it's type and used browser. | |
* | |
* @param {HTMLElement} overlayElem An element to process. | |
* @param {number|string} left The left position of the overlay. | |
* @param {number|string} top The top position of the overlay. | |
*/ | |
function setOverlayPosition(overlayElem, left, top) { | |
if ((0, _browser.isIE9)()) { | |
overlayElem.style.top = top; | |
overlayElem.style.left = left; | |
} else if ((0, _browser.isSafari)()) { | |
overlayElem.style['-webkit-transform'] = "translate3d(".concat(left, ",").concat(top, ",0)"); | |
} else { | |
overlayElem.style.transform = "translate3d(".concat(left, ",").concat(top, ",0)"); | |
} | |
} | |
/** | |
* @param {HTMLElement} element An element to process. | |
* @returns {number|Array} | |
*/ | |
function getCssTransform(element) { | |
var transform; | |
if (element.style.transform && (transform = element.style.transform) !== '') { | |
return ['transform', transform]; | |
} else if (element.style['-webkit-transform'] && (transform = element.style['-webkit-transform']) !== '') { | |
return ['-webkit-transform', transform]; | |
} | |
return -1; | |
} | |
/** | |
* @param {HTMLElement} element An element to process. | |
*/ | |
function resetCssTransform(element) { | |
if (element.style.transform && element.style.transform !== '') { | |
element.style.transform = ''; | |
} else if (element.style['-webkit-transform'] && element.style['-webkit-transform'] !== '') { | |
element.style['-webkit-transform'] = ''; | |
} | |
} | |
/** | |
* Determines if the given DOM element is an input field. | |
* Notice: By 'input' we mean input, textarea and select nodes. | |
* | |
* @param {HTMLElement} element - DOM element. | |
* @returns {boolean} | |
*/ | |
function isInput(element) { | |
var inputs = ['INPUT', 'SELECT', 'TEXTAREA']; | |
return element && (inputs.indexOf(element.nodeName) > -1 || element.contentEditable === 'true'); | |
} | |
/** | |
* Determines if the given DOM element is an input field placed OUTSIDE of HOT. | |
* Notice: By 'input' we mean input, textarea and select nodes which have defined 'data-hot-input' attribute. | |
* | |
* @param {HTMLElement} element - DOM element. | |
* @returns {boolean} | |
*/ | |
function isOutsideInput(element) { | |
return isInput(element) && element.hasAttribute('data-hot-input') === false; | |
} | |
/** | |
* Check if the given DOM element can be focused (by using "select" method). | |
* | |
* @param {HTMLElement} element - DOM element. | |
*/ | |
function selectElementIfAllowed(element) { | |
var activeElement = element.ownerDocument.activeElement; | |
if (!isOutsideInput(activeElement)) { | |
element.select(); | |
} | |
} | |
/** | |
* Check if the provided element is detached from DOM. | |
* | |
* @param {HTMLElement} element HTML element to be checked. | |
* @returns {boolean} `true` if the element is detached, `false` otherwise. | |
*/ | |
function isDetached(element) { | |
return !element.parentNode; | |
} | |
/***/ }), | |
/* 26 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var DESCRIPTORS = __webpack_require__(72); | |
var FUNCTION_NAME_EXISTS = __webpack_require__(168).EXISTS; | |
var uncurryThis = __webpack_require__(37); | |
var defineProperty = __webpack_require__(86).f; | |
var FunctionPrototype = Function.prototype; | |
var functionToString = uncurryThis(FunctionPrototype.toString); | |
var nameRE = /function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/; | |
var regExpExec = uncurryThis(nameRE.exec); | |
var NAME = 'name'; | |
// Function instances `.name` property | |
// https://tc39.es/ecma262/#sec-function-instances-name | |
if (DESCRIPTORS && !FUNCTION_NAME_EXISTS) { | |
defineProperty(FunctionPrototype, NAME, { | |
configurable: true, | |
get: function () { | |
try { | |
return regExpExec(nameRE, functionToString(this))[1]; | |
} catch (error) { | |
return ''; | |
} | |
} | |
}); | |
} | |
/***/ }), | |
/* 27 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var $ = __webpack_require__(31); | |
var fails = __webpack_require__(43); | |
var toObject = __webpack_require__(92); | |
var nativeGetPrototypeOf = __webpack_require__(208); | |
var CORRECT_PROTOTYPE_GETTER = __webpack_require__(329); | |
var FAILS_ON_PRIMITIVES = fails(function () { nativeGetPrototypeOf(1); }); | |
// `Object.getPrototypeOf` method | |
// https://tc39.es/ecma262/#sec-object.getprototypeof | |
$({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES, sham: !CORRECT_PROTOTYPE_GETTER }, { | |
getPrototypeOf: function getPrototypeOf(it) { | |
return nativeGetPrototypeOf(toObject(it)); | |
} | |
}); | |
/***/ }), | |
/* 28 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var global = __webpack_require__(30); | |
var DOMIterables = __webpack_require__(343); | |
var DOMTokenListPrototype = __webpack_require__(344); | |
var forEach = __webpack_require__(642); | |
var createNonEnumerableProperty = __webpack_require__(122); | |
var handlePrototype = function (CollectionPrototype) { | |
// some Chrome versions have non-configurable methods on DOMTokenList | |
if (CollectionPrototype && CollectionPrototype.forEach !== forEach) try { | |
createNonEnumerableProperty(CollectionPrototype, 'forEach', forEach); | |
} catch (error) { | |
CollectionPrototype.forEach = forEach; | |
} | |
}; | |
for (var COLLECTION_NAME in DOMIterables) { | |
if (DOMIterables[COLLECTION_NAME]) { | |
handlePrototype(global[COLLECTION_NAME] && global[COLLECTION_NAME].prototype); | |
} | |
} | |
handlePrototype(DOMTokenListPrototype); | |
/***/ }), | |
/* 29 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
exports.__esModule = true; | |
exports.FILTERS_VALUES_BLANK_CELLS = exports.FILTERS_NAMESPACE = exports.FILTERS_LABELS_DISJUNCTION = exports.FILTERS_LABELS_CONJUNCTION = exports.FILTERS_DIVS_FILTER_BY_VALUE = exports.FILTERS_DIVS_FILTER_BY_CONDITION = exports.FILTERS_CONDITIONS_YESTERDAY = exports.FILTERS_CONDITIONS_TOMORROW = exports.FILTERS_CONDITIONS_TODAY = exports.FILTERS_CONDITIONS_NOT_EQUAL = exports.FILTERS_CONDITIONS_NOT_EMPTY = exports.FILTERS_CONDITIONS_NOT_CONTAIN = exports.FILTERS_CONDITIONS_NOT_BETWEEN = exports.FILTERS_CONDITIONS_NONE = exports.FILTERS_CONDITIONS_NAMESPACE = exports.FILTERS_CONDITIONS_LESS_THAN_OR_EQUAL = exports.FILTERS_CONDITIONS_LESS_THAN = exports.FILTERS_CONDITIONS_GREATER_THAN_OR_EQUAL = exports.FILTERS_CONDITIONS_GREATER_THAN = exports.FILTERS_CONDITIONS_EQUAL = exports.FILTERS_CONDITIONS_ENDS_WITH = exports.FILTERS_CONDITIONS_EMPTY = exports.FILTERS_CONDITIONS_CONTAINS = exports.FILTERS_CONDITIONS_BY_VALUE = exports.FILTERS_CONDITIONS_BETWEEN = exports.FILTERS_CONDITIONS_BEGINS_WITH = exports.FILTERS_CONDITIONS_BEFORE = exports.FILTERS_CONDITIONS_AFTER = exports.FILTERS_BUTTONS_SELECT_ALL = exports.FILTERS_BUTTONS_PLACEHOLDER_VALUE = exports.FILTERS_BUTTONS_PLACEHOLDER_SECOND_VALUE = exports.FILTERS_BUTTONS_PLACEHOLDER_SEARCH = exports.FILTERS_BUTTONS_OK = exports.FILTERS_BUTTONS_CLEAR = exports.FILTERS_BUTTONS_CANCEL = exports.CONTEXT_MENU_ITEMS_NAMESPACE = exports.CONTEXTMENU_ITEMS_UNMERGE_CELLS = exports.CONTEXTMENU_ITEMS_UNFREEZE_COLUMN = exports.CONTEXTMENU_ITEMS_UNDO = exports.CONTEXTMENU_ITEMS_SHOW_ROW = exports.CONTEXTMENU_ITEMS_SHOW_COLUMN = exports.CONTEXTMENU_ITEMS_ROW_BELOW = exports.CONTEXTMENU_ITEMS_ROW_ABOVE = exports.CONTEXTMENU_ITEMS_REMOVE_ROW = exports.CONTEXTMENU_ITEMS_REMOVE_COMMENT = exports.CONTEXTMENU_ITEMS_REMOVE_COLUMN = exports.CONTEXTMENU_ITEMS_REMOVE_BORDERS = exports.CONTEXTMENU_ITEMS_REDO = exports.CONTEXTMENU_ITEMS_READ_ONLY_COMMENT = exports.CONTEXTMENU_ITEMS_READ_ONLY = exports.CONTEXTMENU_ITEMS_NO_ITEMS = exports.CONTEXTMENU_ITEMS_NESTED_ROWS_INSERT_CHILD = exports.CONTEXTMENU_ITEMS_NESTED_ROWS_DETACH_CHILD = exports.CONTEXTMENU_ITEMS_MERGE_CELLS = exports.CONTEXTMENU_ITEMS_INSERT_RIGHT = exports.CONTEXTMENU_ITEMS_INSERT_LEFT = exports.CONTEXTMENU_ITEMS_HIDE_ROW = exports.CONTEXTMENU_ITEMS_HIDE_COLUMN = exports.CONTEXTMENU_ITEMS_FREEZE_COLUMN = exports.CONTEXTMENU_ITEMS_EDIT_COMMENT = exports.CONTEXTMENU_ITEMS_CUT = exports.CONTEXTMENU_ITEMS_COPY = exports.CONTEXTMENU_ITEMS_CLEAR_COLUMN = exports.CONTEXTMENU_ITEMS_BORDERS_TOP = exports.CONTEXTMENU_ITEMS_BORDERS_RIGHT = exports.CONTEXTMENU_ITEMS_BORDERS_LEFT = exports.CONTEXTMENU_ITEMS_BORDERS_BOTTOM = exports.CONTEXTMENU_ITEMS_BORDERS = exports.CONTEXTMENU_ITEMS_ALIGNMENT_TOP = exports.CONTEXTMENU_ITEMS_ALIGNMENT_RIGHT = exports.CONTEXTMENU_ITEMS_ALIGNMENT_MIDDLE = exports.CONTEXTMENU_ITEMS_ALIGNMENT_LEFT = exports.CONTEXTMENU_ITEMS_ALIGNMENT_JUSTIFY = exports.CONTEXTMENU_ITEMS_ALIGNMENT_CENTER = exports.CONTEXTMENU_ITEMS_ALIGNMENT_BOTTOM = exports.CONTEXTMENU_ITEMS_ALIGNMENT = exports.CONTEXTMENU_ITEMS_ADD_COMMENT = void 0; | |
/** | |
* Constants for parts of translation. | |
*/ | |
var CONTEXT_MENU_ITEMS_NAMESPACE = 'ContextMenu:items'; | |
exports.CONTEXT_MENU_ITEMS_NAMESPACE = CONTEXT_MENU_ITEMS_NAMESPACE; | |
var CONTEXTMENU_ITEMS_NO_ITEMS = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".noItems"); | |
exports.CONTEXTMENU_ITEMS_NO_ITEMS = CONTEXTMENU_ITEMS_NO_ITEMS; | |
var CONTEXTMENU_ITEMS_ROW_ABOVE = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".insertRowAbove"); | |
exports.CONTEXTMENU_ITEMS_ROW_ABOVE = CONTEXTMENU_ITEMS_ROW_ABOVE; | |
var CONTEXTMENU_ITEMS_ROW_BELOW = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".insertRowBelow"); | |
exports.CONTEXTMENU_ITEMS_ROW_BELOW = CONTEXTMENU_ITEMS_ROW_BELOW; | |
var CONTEXTMENU_ITEMS_INSERT_LEFT = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".insertColumnOnTheLeft"); | |
exports.CONTEXTMENU_ITEMS_INSERT_LEFT = CONTEXTMENU_ITEMS_INSERT_LEFT; | |
var CONTEXTMENU_ITEMS_INSERT_RIGHT = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".insertColumnOnTheRight"); | |
exports.CONTEXTMENU_ITEMS_INSERT_RIGHT = CONTEXTMENU_ITEMS_INSERT_RIGHT; | |
var CONTEXTMENU_ITEMS_REMOVE_ROW = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".removeRow"); | |
exports.CONTEXTMENU_ITEMS_REMOVE_ROW = CONTEXTMENU_ITEMS_REMOVE_ROW; | |
var CONTEXTMENU_ITEMS_REMOVE_COLUMN = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".removeColumn"); | |
exports.CONTEXTMENU_ITEMS_REMOVE_COLUMN = CONTEXTMENU_ITEMS_REMOVE_COLUMN; | |
var CONTEXTMENU_ITEMS_UNDO = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".undo"); | |
exports.CONTEXTMENU_ITEMS_UNDO = CONTEXTMENU_ITEMS_UNDO; | |
var CONTEXTMENU_ITEMS_REDO = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".redo"); | |
exports.CONTEXTMENU_ITEMS_REDO = CONTEXTMENU_ITEMS_REDO; | |
var CONTEXTMENU_ITEMS_READ_ONLY = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".readOnly"); | |
exports.CONTEXTMENU_ITEMS_READ_ONLY = CONTEXTMENU_ITEMS_READ_ONLY; | |
var CONTEXTMENU_ITEMS_CLEAR_COLUMN = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".clearColumn"); | |
exports.CONTEXTMENU_ITEMS_CLEAR_COLUMN = CONTEXTMENU_ITEMS_CLEAR_COLUMN; | |
var CONTEXTMENU_ITEMS_COPY = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".copy"); | |
exports.CONTEXTMENU_ITEMS_COPY = CONTEXTMENU_ITEMS_COPY; | |
var CONTEXTMENU_ITEMS_CUT = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".cut"); | |
exports.CONTEXTMENU_ITEMS_CUT = CONTEXTMENU_ITEMS_CUT; | |
var CONTEXTMENU_ITEMS_FREEZE_COLUMN = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".freezeColumn"); | |
exports.CONTEXTMENU_ITEMS_FREEZE_COLUMN = CONTEXTMENU_ITEMS_FREEZE_COLUMN; | |
var CONTEXTMENU_ITEMS_UNFREEZE_COLUMN = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".unfreezeColumn"); | |
exports.CONTEXTMENU_ITEMS_UNFREEZE_COLUMN = CONTEXTMENU_ITEMS_UNFREEZE_COLUMN; | |
var CONTEXTMENU_ITEMS_MERGE_CELLS = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".mergeCells"); | |
exports.CONTEXTMENU_ITEMS_MERGE_CELLS = CONTEXTMENU_ITEMS_MERGE_CELLS; | |
var CONTEXTMENU_ITEMS_UNMERGE_CELLS = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".unmergeCells"); | |
exports.CONTEXTMENU_ITEMS_UNMERGE_CELLS = CONTEXTMENU_ITEMS_UNMERGE_CELLS; | |
var CONTEXTMENU_ITEMS_ADD_COMMENT = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".addComment"); | |
exports.CONTEXTMENU_ITEMS_ADD_COMMENT = CONTEXTMENU_ITEMS_ADD_COMMENT; | |
var CONTEXTMENU_ITEMS_EDIT_COMMENT = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".editComment"); | |
exports.CONTEXTMENU_ITEMS_EDIT_COMMENT = CONTEXTMENU_ITEMS_EDIT_COMMENT; | |
var CONTEXTMENU_ITEMS_REMOVE_COMMENT = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".removeComment"); | |
exports.CONTEXTMENU_ITEMS_REMOVE_COMMENT = CONTEXTMENU_ITEMS_REMOVE_COMMENT; | |
var CONTEXTMENU_ITEMS_READ_ONLY_COMMENT = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".readOnlyComment"); | |
exports.CONTEXTMENU_ITEMS_READ_ONLY_COMMENT = CONTEXTMENU_ITEMS_READ_ONLY_COMMENT; | |
var CONTEXTMENU_ITEMS_ALIGNMENT = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".align"); | |
exports.CONTEXTMENU_ITEMS_ALIGNMENT = CONTEXTMENU_ITEMS_ALIGNMENT; | |
var CONTEXTMENU_ITEMS_ALIGNMENT_LEFT = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".align.left"); | |
exports.CONTEXTMENU_ITEMS_ALIGNMENT_LEFT = CONTEXTMENU_ITEMS_ALIGNMENT_LEFT; | |
var CONTEXTMENU_ITEMS_ALIGNMENT_CENTER = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".align.center"); | |
exports.CONTEXTMENU_ITEMS_ALIGNMENT_CENTER = CONTEXTMENU_ITEMS_ALIGNMENT_CENTER; | |
var CONTEXTMENU_ITEMS_ALIGNMENT_RIGHT = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".align.right"); | |
exports.CONTEXTMENU_ITEMS_ALIGNMENT_RIGHT = CONTEXTMENU_ITEMS_ALIGNMENT_RIGHT; | |
var CONTEXTMENU_ITEMS_ALIGNMENT_JUSTIFY = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".align.justify"); | |
exports.CONTEXTMENU_ITEMS_ALIGNMENT_JUSTIFY = CONTEXTMENU_ITEMS_ALIGNMENT_JUSTIFY; | |
var CONTEXTMENU_ITEMS_ALIGNMENT_TOP = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".align.top"); | |
exports.CONTEXTMENU_ITEMS_ALIGNMENT_TOP = CONTEXTMENU_ITEMS_ALIGNMENT_TOP; | |
var CONTEXTMENU_ITEMS_ALIGNMENT_MIDDLE = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".align.middle"); | |
exports.CONTEXTMENU_ITEMS_ALIGNMENT_MIDDLE = CONTEXTMENU_ITEMS_ALIGNMENT_MIDDLE; | |
var CONTEXTMENU_ITEMS_ALIGNMENT_BOTTOM = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".align.bottom"); | |
exports.CONTEXTMENU_ITEMS_ALIGNMENT_BOTTOM = CONTEXTMENU_ITEMS_ALIGNMENT_BOTTOM; | |
var CONTEXTMENU_ITEMS_BORDERS = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".borders"); | |
exports.CONTEXTMENU_ITEMS_BORDERS = CONTEXTMENU_ITEMS_BORDERS; | |
var CONTEXTMENU_ITEMS_BORDERS_TOP = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".borders.top"); | |
exports.CONTEXTMENU_ITEMS_BORDERS_TOP = CONTEXTMENU_ITEMS_BORDERS_TOP; | |
var CONTEXTMENU_ITEMS_BORDERS_RIGHT = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".borders.right"); | |
exports.CONTEXTMENU_ITEMS_BORDERS_RIGHT = CONTEXTMENU_ITEMS_BORDERS_RIGHT; | |
var CONTEXTMENU_ITEMS_BORDERS_BOTTOM = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".borders.bottom"); | |
exports.CONTEXTMENU_ITEMS_BORDERS_BOTTOM = CONTEXTMENU_ITEMS_BORDERS_BOTTOM; | |
var CONTEXTMENU_ITEMS_BORDERS_LEFT = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".borders.left"); | |
exports.CONTEXTMENU_ITEMS_BORDERS_LEFT = CONTEXTMENU_ITEMS_BORDERS_LEFT; | |
var CONTEXTMENU_ITEMS_REMOVE_BORDERS = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".borders.remove"); | |
exports.CONTEXTMENU_ITEMS_REMOVE_BORDERS = CONTEXTMENU_ITEMS_REMOVE_BORDERS; | |
var CONTEXTMENU_ITEMS_NESTED_ROWS_INSERT_CHILD = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".nestedHeaders.insertChildRow"); // eslint-disable-line max-len | |
exports.CONTEXTMENU_ITEMS_NESTED_ROWS_INSERT_CHILD = CONTEXTMENU_ITEMS_NESTED_ROWS_INSERT_CHILD; | |
var CONTEXTMENU_ITEMS_NESTED_ROWS_DETACH_CHILD = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".nestedHeaders.detachFromParent"); // eslint-disable-line max-len | |
exports.CONTEXTMENU_ITEMS_NESTED_ROWS_DETACH_CHILD = CONTEXTMENU_ITEMS_NESTED_ROWS_DETACH_CHILD; | |
var CONTEXTMENU_ITEMS_HIDE_COLUMN = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".hideColumn"); | |
exports.CONTEXTMENU_ITEMS_HIDE_COLUMN = CONTEXTMENU_ITEMS_HIDE_COLUMN; | |
var CONTEXTMENU_ITEMS_SHOW_COLUMN = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".showColumn"); | |
exports.CONTEXTMENU_ITEMS_SHOW_COLUMN = CONTEXTMENU_ITEMS_SHOW_COLUMN; | |
var CONTEXTMENU_ITEMS_HIDE_ROW = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".hideRow"); | |
exports.CONTEXTMENU_ITEMS_HIDE_ROW = CONTEXTMENU_ITEMS_HIDE_ROW; | |
var CONTEXTMENU_ITEMS_SHOW_ROW = "".concat(CONTEXT_MENU_ITEMS_NAMESPACE, ".showRow"); | |
exports.CONTEXTMENU_ITEMS_SHOW_ROW = CONTEXTMENU_ITEMS_SHOW_ROW; | |
var FILTERS_NAMESPACE = 'Filters:'; | |
exports.FILTERS_NAMESPACE = FILTERS_NAMESPACE; | |
var FILTERS_CONDITIONS_NAMESPACE = "".concat(FILTERS_NAMESPACE, "conditions"); | |
exports.FILTERS_CONDITIONS_NAMESPACE = FILTERS_CONDITIONS_NAMESPACE; | |
var FILTERS_CONDITIONS_NONE = "".concat(FILTERS_CONDITIONS_NAMESPACE, ".none"); | |
exports.FILTERS_CONDITIONS_NONE = FILTERS_CONDITIONS_NONE; | |
var FILTERS_CONDITIONS_EMPTY = "".concat(FILTERS_CONDITIONS_NAMESPACE, ".isEmpty"); | |
exports.FILTERS_CONDITIONS_EMPTY = FILTERS_CONDITIONS_EMPTY; | |
var FILTERS_CONDITIONS_NOT_EMPTY = "".concat(FILTERS_CONDITIONS_NAMESPACE, ".isNotEmpty"); | |
exports.FILTERS_CONDITIONS_NOT_EMPTY = FILTERS_CONDITIONS_NOT_EMPTY; | |
var FILTERS_CONDITIONS_EQUAL = "".concat(FILTERS_CONDITIONS_NAMESPACE, ".isEqualTo"); | |
exports.FILTERS_CONDITIONS_EQUAL = FILTERS_CONDITIONS_EQUAL; | |
var FILTERS_CONDITIONS_NOT_EQUAL = "".concat(FILTERS_CONDITIONS_NAMESPACE, ".isNotEqualTo"); | |
exports.FILTERS_CONDITIONS_NOT_EQUAL = FILTERS_CONDITIONS_NOT_EQUAL; | |
var FILTERS_CONDITIONS_BEGINS_WITH = "".concat(FILTERS_CONDITIONS_NAMESPACE, ".beginsWith"); | |
exports.FILTERS_CONDITIONS_BEGINS_WITH = FILTERS_CONDITIONS_BEGINS_WITH; | |
var FILTERS_CONDITIONS_ENDS_WITH = "".concat(FILTERS_CONDITIONS_NAMESPACE, ".endsWith"); | |
exports.FILTERS_CONDITIONS_ENDS_WITH = FILTERS_CONDITIONS_ENDS_WITH; | |
var FILTERS_CONDITIONS_CONTAINS = "".concat(FILTERS_CONDITIONS_NAMESPACE, ".contains"); | |
exports.FILTERS_CONDITIONS_CONTAINS = FILTERS_CONDITIONS_CONTAINS; | |
var FILTERS_CONDITIONS_NOT_CONTAIN = "".concat(FILTERS_CONDITIONS_NAMESPACE, ".doesNotContain"); | |
exports.FILTERS_CONDITIONS_NOT_CONTAIN = FILTERS_CONDITIONS_NOT_CONTAIN; | |
var FILTERS_CONDITIONS_BY_VALUE = "".concat(FILTERS_CONDITIONS_NAMESPACE, ".byValue"); | |
exports.FILTERS_CONDITIONS_BY_VALUE = FILTERS_CONDITIONS_BY_VALUE; | |
var FILTERS_CONDITIONS_GREATER_THAN = "".concat(FILTERS_CONDITIONS_NAMESPACE, ".greaterThan"); | |
exports.FILTERS_CONDITIONS_GREATER_THAN = FILTERS_CONDITIONS_GREATER_THAN; | |
var FILTERS_CONDITIONS_GREATER_THAN_OR_EQUAL = "".concat(FILTERS_CONDITIONS_NAMESPACE, ".greaterThanOrEqualTo"); | |
exports.FILTERS_CONDITIONS_GREATER_THAN_OR_EQUAL = FILTERS_CONDITIONS_GREATER_THAN_OR_EQUAL; | |
var FILTERS_CONDITIONS_LESS_THAN = "".concat(FILTERS_CONDITIONS_NAMESPACE, ".lessThan"); | |
exports.FILTERS_CONDITIONS_LESS_THAN = FILTERS_CONDITIONS_LESS_THAN; | |
var FILTERS_CONDITIONS_LESS_THAN_OR_EQUAL = "".concat(FILTERS_CONDITIONS_NAMESPACE, ".lessThanOrEqualTo"); | |
exports.FILTERS_CONDITIONS_LESS_THAN_OR_EQUAL = FILTERS_CONDITIONS_LESS_THAN_OR_EQUAL; | |
var FILTERS_CONDITIONS_BETWEEN = "".concat(FILTERS_CONDITIONS_NAMESPACE, ".isBetween"); | |
exports.FILTERS_CONDITIONS_BETWEEN = FILTERS_CONDITIONS_BETWEEN; | |
var FILTERS_CONDITIONS_NOT_BETWEEN = "".concat(FILTERS_CONDITIONS_NAMESPACE, ".isNotBetween"); | |
exports.FILTERS_CONDITIONS_NOT_BETWEEN = FILTERS_CONDITIONS_NOT_BETWEEN; | |
var FILTERS_CONDITIONS_AFTER = "".concat(FILTERS_CONDITIONS_NAMESPACE, ".after"); | |
exports.FILTERS_CONDITIONS_AFTER = FILTERS_CONDITIONS_AFTER; | |
var FILTERS_CONDITIONS_BEFORE = "".concat(FILTERS_CONDITIONS_NAMESPACE, ".before"); | |
exports.FILTERS_CONDITIONS_BEFORE = FILTERS_CONDITIONS_BEFORE; | |
var FILTERS_CONDITIONS_TODAY = "".concat(FILTERS_CONDITIONS_NAMESPACE, ".today"); | |
exports.FILTERS_CONDITIONS_TODAY = FILTERS_CONDITIONS_TODAY; | |
var FILTERS_CONDITIONS_TOMORROW = "".concat(FILTERS_CONDITIONS_NAMESPACE, ".tomorrow"); | |
exports.FILTERS_CONDITIONS_TOMORROW = FILTERS_CONDITIONS_TOMORROW; | |
var FILTERS_CONDITIONS_YESTERDAY = "".concat(FILTERS_CONDITIONS_NAMESPACE, ".yesterday"); | |
exports.FILTERS_CONDITIONS_YESTERDAY = FILTERS_CONDITIONS_YESTERDAY; | |
var FILTERS_DIVS_FILTER_BY_CONDITION = "".concat(FILTERS_NAMESPACE, "labels.filterByCondition"); | |
exports.FILTERS_DIVS_FILTER_BY_CONDITION = FILTERS_DIVS_FILTER_BY_CONDITION; | |
var FILTERS_DIVS_FILTER_BY_VALUE = "".concat(FILTERS_NAMESPACE, "labels.filterByValue"); | |
exports.FILTERS_DIVS_FILTER_BY_VALUE = FILTERS_DIVS_FILTER_BY_VALUE; | |
var FILTERS_LABELS_CONJUNCTION = "".concat(FILTERS_NAMESPACE, "labels.conjunction"); | |
exports.FILTERS_LABELS_CONJUNCTION = FILTERS_LABELS_CONJUNCTION; | |
var FILTERS_LABELS_DISJUNCTION = "".concat(FILTERS_NAMESPACE, "labels.disjunction"); | |
exports.FILTERS_LABELS_DISJUNCTION = FILTERS_LABELS_DISJUNCTION; | |
var FILTERS_VALUES_BLANK_CELLS = "".concat(FILTERS_NAMESPACE, "values.blankCells"); | |
exports.FILTERS_VALUES_BLANK_CELLS = FILTERS_VALUES_BLANK_CELLS; | |
var FILTERS_BUTTONS_SELECT_ALL = "".concat(FILTERS_NAMESPACE, "buttons.selectAll"); | |
exports.FILTERS_BUTTONS_SELECT_ALL = FILTERS_BUTTONS_SELECT_ALL; | |
var FILTERS_BUTTONS_CLEAR = "".concat(FILTERS_NAMESPACE, "buttons.clear"); | |
exports.FILTERS_BUTTONS_CLEAR = FILTERS_BUTTONS_CLEAR; | |
var FILTERS_BUTTONS_OK = "".concat(FILTERS_NAMESPACE, "buttons.ok"); | |
exports.FILTERS_BUTTONS_OK = FILTERS_BUTTONS_OK; | |
var FILTERS_BUTTONS_CANCEL = "".concat(FILTERS_NAMESPACE, "buttons.cancel"); | |
exports.FILTERS_BUTTONS_CANCEL = FILTERS_BUTTONS_CANCEL; | |
var FILTERS_BUTTONS_PLACEHOLDER_SEARCH = "".concat(FILTERS_NAMESPACE, "buttons.placeholder.search"); | |
exports.FILTERS_BUTTONS_PLACEHOLDER_SEARCH = FILTERS_BUTTONS_PLACEHOLDER_SEARCH; | |
var FILTERS_BUTTONS_PLACEHOLDER_VALUE = "".concat(FILTERS_NAMESPACE, "buttons.placeholder.value"); | |
exports.FILTERS_BUTTONS_PLACEHOLDER_VALUE = FILTERS_BUTTONS_PLACEHOLDER_VALUE; | |
var FILTERS_BUTTONS_PLACEHOLDER_SECOND_VALUE = "".concat(FILTERS_NAMESPACE, "buttons.placeholder.secondValue"); | |
exports.FILTERS_BUTTONS_PLACEHOLDER_SECOND_VALUE = FILTERS_BUTTONS_PLACEHOLDER_SECOND_VALUE; | |
/***/ }), | |
/* 30 */ | |
/***/ (function(module, exports) { | |
var check = function (it) { | |
return it && it.Math == Math && it; | |
}; | |
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 | |
module.exports = | |
// eslint-disable-next-line es/no-global-this -- safe | |
check(typeof globalThis == 'object' && globalThis) || | |
check(typeof window == 'object' && window) || | |
// eslint-disable-next-line no-restricted-globals -- safe | |
check(typeof self == 'object' && self) || | |
check(typeof global == 'object' && global) || | |
// eslint-disable-next-line no-new-func -- fallback | |
(function () { return this; })() || Function('return this')(); | |
/***/ }), | |
/* 31 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var global = __webpack_require__(30); | |
var getOwnPropertyDescriptor = __webpack_require__(112).f; | |
var createNonEnumerableProperty = __webpack_require__(122); | |
var redefine = __webpack_require__(103); | |
var setGlobal = __webpack_require__(238); | |
var copyConstructorProperties = __webpack_require__(326); | |
var isForced = __webpack_require__(207); | |
/* | |
options.target - name of the target object | |
options.global - target is the global object | |
options.stat - export as static methods of target | |
options.proto - export as prototype methods of target | |
options.real - real prototype method for the `pure` version | |
options.forced - export even if the native feature is available | |
options.bind - bind methods to the target, required for the `pure` version | |
options.wrap - wrap constructors to preventing global pollution, required for the `pure` version | |
options.unsafe - use the simple assignment of property instead of delete + defineProperty | |
options.sham - add a flag to not completely full polyfills | |
options.enumerable - export as enumerable property | |
options.noTargetGet - prevent calling a getter on target | |
options.name - the .name of the function if it does not match the key | |
*/ | |
module.exports = function (options, source) { | |
var TARGET = options.target; | |
var GLOBAL = options.global; | |
var STATIC = options.stat; | |
var FORCED, target, key, targetProperty, sourceProperty, descriptor; | |
if (GLOBAL) { | |
target = global; | |
} else if (STATIC) { | |
target = global[TARGET] || setGlobal(TARGET, {}); | |
} else { | |
target = (global[TARGET] || {}).prototype; | |
} | |
if (target) for (key in source) { | |
sourceProperty = source[key]; | |
if (options.noTargetGet) { | |
descriptor = getOwnPropertyDescriptor(target, key); | |
targetProperty = descriptor && descriptor.value; | |
} else targetProperty = target[key]; | |
FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced); | |
// contained in target | |
if (!FORCED && targetProperty !== undefined) { | |
if (typeof sourceProperty == typeof targetProperty) continue; | |
copyConstructorProperties(sourceProperty, targetProperty); | |
} | |
// add a flag to not completely full polyfills | |
if (options.sham || (targetProperty && targetProperty.sham)) { | |
createNonEnumerableProperty(sourceProperty, 'sham', true); | |
} | |
// extend global | |
redefine(target, key, sourceProperty, options); | |
} | |
}; | |
/***/ }), | |
/* 32 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var superPropBase = __webpack_require__(772); | |
function _get() { | |
if (typeof Reflect !== "undefined" && Reflect.get) { | |
module.exports = _get = Reflect.get, module.exports.__esModule = true, module.exports["default"] = module.exports; | |
} else { | |
module.exports = _get = function _get(target, property, receiver) { | |
var base = superPropBase(target, property); | |
if (!base) return; | |
var desc = Object.getOwnPropertyDescriptor(base, property); | |
if (desc.get) { | |
return desc.get.call(arguments.length < 3 ? target : receiver); | |
} | |
return desc.value; | |
}, module.exports.__esModule = true, module.exports["default"] = module.exports; | |
} | |
return _get.apply(this, arguments); | |
} | |
module.exports = _get, module.exports.__esModule = true, module.exports["default"] = module.exports; | |
/***/ }), | |
/* 33 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/* eslint-disable es/no-array-prototype-indexof -- required for testing */ | |
var $ = __webpack_require__(31); | |
var uncurryThis = __webpack_require__(37); | |
var $IndexOf = __webpack_require__(240).indexOf; | |
var arrayMethodIsStrict = __webpack_require__(153); | |
var un$IndexOf = uncurryThis([].indexOf); | |
var NEGATIVE_ZERO = !!un$IndexOf && 1 / un$IndexOf([1], 1, -0) < 0; | |
var STRICT_METHOD = arrayMethodIsStrict('indexOf'); | |
// `Array.prototype.indexOf` method | |
// https://tc39.es/ecma262/#sec-array.prototype.indexof | |
$({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || !STRICT_METHOD }, { | |
indexOf: function indexOf(searchElement /* , fromIndex = 0 */) { | |
var fromIndex = arguments.length > 1 ? arguments[1] : undefined; | |
return NEGATIVE_ZERO | |
// convert -0 to +0 | |
? un$IndexOf(this, searchElement, fromIndex) || 0 | |
: $IndexOf(this, searchElement, fromIndex); | |
} | |
}); | |
/***/ }), | |
/* 34 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var _interopRequireDefault = __webpack_require__(1); | |
exports.__esModule = true; | |
exports._injectProductInfo = _injectProductInfo; | |
exports.isDefined = isDefined; | |
exports.isEmpty = isEmpty; | |
exports.isRegExp = isRegExp; | |
exports.isUndefined = isUndefined; | |
exports.stringify = stringify; | |
var _taggedTemplateLiteral2 = _interopRequireDefault(__webpack_require__(81)); | |
__webpack_require__(0); | |
__webpack_require__(67); | |
__webpack_require__(289); | |
__webpack_require__(13); | |
__webpack_require__(64); | |
__webpack_require__(63); | |
__webpack_require__(290); | |
var _typeof2 = _interopRequireDefault(__webpack_require__(22)); | |
var _moment = _interopRequireDefault(__webpack_require__(8)); | |
var _templateLiteralTag = __webpack_require__(82); | |
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6; | |
/** | |
* Converts any value to string. | |
* | |
* @param {*} value The value to stringify. | |
* @returns {string} | |
*/ | |
function stringify(value) { | |
var result; | |
switch ((0, _typeof2.default)(value)) { | |
case 'string': | |
case 'number': | |
result = "".concat(value); | |
break; | |
case 'object': | |
result = value === null ? '' : value.toString(); | |
break; | |
case 'undefined': | |
result = ''; | |
break; | |
default: | |
result = value.toString(); | |
break; | |
} | |
return result; | |
} | |
/** | |
* Checks if given variable is defined. | |
* | |
* @param {*} variable Variable to check. | |
* @returns {boolean} | |
*/ | |
function isDefined(variable) { | |
return typeof variable !== 'undefined'; | |
} | |
/** | |
* Checks if given variable is undefined. | |
* | |
* @param {*} variable Variable to check. | |
* @returns {boolean} | |
*/ | |
function isUndefined(variable) { | |
return typeof variable === 'undefined'; | |
} | |
/** | |
* Check if given variable is null, empty string or undefined. | |
* | |
* @param {*} variable Variable to check. | |
* @returns {boolean} | |
*/ | |
function isEmpty(variable) { | |
return variable === null || variable === '' || isUndefined(variable); | |
} | |
/** | |
* Check if given variable is a regular expression. | |
* | |
* @param {*} variable Variable to check. | |
* @returns {boolean} | |
*/ | |
function isRegExp(variable) { | |
return Object.prototype.toString.call(variable) === '[object RegExp]'; | |
} | |
/* eslint-disable */ | |
var _m = '\x6C\x65\x6E\x67\x74\x68'; | |
var _hd = function _hd(v) { | |
return parseInt(v, 16); | |
}; | |
var _pi = function _pi(v) { | |
return parseInt(v, 10); | |
}; | |
var _ss = function _ss(v, s, l) { | |
return v['\x73\x75\x62\x73\x74\x72'](s, l); | |
}; | |
var _cp = function _cp(v) { | |
return v['\x63\x6F\x64\x65\x50\x6F\x69\x6E\x74\x41\x74'](0) - 65; | |
}; | |
var _norm = function _norm(v) { | |
return "".concat(v).replace(/\-/g, ''); | |
}; | |
var _extractTime = function _extractTime(v) { | |
return _hd(_ss(_norm(v), _hd('12'), _cp('\x46'))) / (_hd(_ss(_norm(v), _cp('\x42'), ~~![][_m])) || 9); | |
}; | |
var _ignored = function _ignored() { | |
return typeof location !== 'undefined' && /^([a-z0-9\-]+\.)?\x68\x61\x6E\x64\x73\x6F\x6E\x74\x61\x62\x6C\x65\x2E\x63\x6F\x6D$/i.test(location.host); | |
}; | |
var _notified = false; | |
var consoleMessages = { | |
invalid: function invalid() { | |
return (0, _templateLiteralTag.toSingleLine)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n The license key for Handsontable is invalid. \n If you need any help, contact us at [email protected]."], ["\n The license key for Handsontable is invalid.\\x20\n If you need any help, contact us at [email protected]."]))); | |
}, | |
expired: function expired(_ref) { | |
var keyValidityDate = _ref.keyValidityDate, | |
hotVersion = _ref.hotVersion; | |
return (0, _templateLiteralTag.toSingleLine)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n The license key for Handsontable expired on ", ", and is not valid for the installed \n version ", ". Renew your license key at handsontable.com or downgrade to a version released prior \n to ", ". If you need any help, contact us at [email protected]."], ["\n The license key for Handsontable expired on ", ", and is not valid for the installed\\x20\n version ", ". Renew your license key at handsontable.com or downgrade to a version released prior\\x20\n to ", ". If you need any help, contact us at [email protected]."])), keyValidityDate, hotVersion, keyValidityDate); | |
}, | |
missing: function missing() { | |
return (0, _templateLiteralTag.toSingleLine)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n The license key for Handsontable is missing. Use your purchased key to activate the product. \n Alternatively, you can activate Handsontable to use for non-commercial purposes by \n passing the key: 'non-commercial-and-evaluation'. If you need any help, contact \n us at [email protected]."], ["\n The license key for Handsontable is missing. Use your purchased key to activate the product.\\x20\n Alternatively, you can activate Handsontable to use for non-commercial purposes by\\x20\n passing the key: 'non-commercial-and-evaluation'. If you need any help, contact\\x20\n us at [email protected]."]))); | |
}, | |
non_commercial: function non_commercial() { | |
return ''; | |
} | |
}; | |
var domMessages = { | |
invalid: function invalid() { | |
return (0, _templateLiteralTag.toSingleLine)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n The license key for Handsontable is invalid. \n <a href=\"https://handsontable.com/docs/tutorial-license-key.html\" target=\"_blank\">Read more</a> on how to \n install it properly or contact us at <a href=\"mailto:[email protected]\">[email protected]</a>."], ["\n The license key for Handsontable is invalid.\\x20\n <a href=\"https://handsontable.com/docs/tutorial-license-key.html\" target=\"_blank\">Read more</a> on how to\\x20\n install it properly or contact us at <a href=\"mailto:[email protected]\">[email protected]</a>."]))); | |
}, | |
expired: function expired(_ref2) { | |
var keyValidityDate = _ref2.keyValidityDate, | |
hotVersion = _ref2.hotVersion; | |
return (0, _templateLiteralTag.toSingleLine)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n The license key for Handsontable expired on ", ", and is not valid for the installed \n version ", ". <a href=\"https://handsontable.com/pricing\" target=\"_blank\">Renew</a> your \n license key or downgrade to a version released prior to ", ". If you need any \n help, contact us at <a href=\"mailto:[email protected]\">[email protected]</a>."], ["\n The license key for Handsontable expired on ", ", and is not valid for the installed\\x20\n version ", ". <a href=\"https://handsontable.com/pricing\" target=\"_blank\">Renew</a> your\\x20\n license key or downgrade to a version released prior to ", ". If you need any\\x20\n help, contact us at <a href=\"mailto:[email protected]\">[email protected]</a>."])), keyValidityDate, hotVersion, keyValidityDate); | |
}, | |
missing: function missing() { | |
return (0, _templateLiteralTag.toSingleLine)(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n The license key for Handsontable is missing. Use your purchased key to activate the product. \n Alternatively, you can activate Handsontable to use for non-commercial purposes by \n passing the key: 'non-commercial-and-evaluation'. \n <a href=\"https://handsontable.com/docs/tutorial-license-key.html\" target=\"_blank\">Read more</a> about it in \n the documentation or contact us at <a href=\"mailto:[email protected]\">[email protected]</a>."], ["\n The license key for Handsontable is missing. Use your purchased key to activate the product.\\x20\n Alternatively, you can activate Handsontable to use for non-commercial purposes by\\x20\n passing the key: 'non-commercial-and-evaluation'.\\x20\n <a href=\"https://handsontable.com/docs/tutorial-license-key.html\" target=\"_blank\">Read more</a> about it in\\x20\n the documentation or contact us at <a href=\"mailto:[email protected]\">[email protected]</a>."]))); | |
}, | |
non_commercial: function non_commercial() { | |
return ''; | |
} | |
}; | |
function _injectProductInfo(key, element) { | |
var hasValidType = !isEmpty(key); | |
var isNonCommercial = typeof key === 'string' && key.toLowerCase() === 'non-commercial-and-evaluation'; | |
var hotVersion = "11.1.0"; | |
var keyValidityDate; | |
var consoleMessageState = 'invalid'; | |
var domMessageState = 'invalid'; | |
key = _norm(key || ''); | |
var schemaValidity = _checkKeySchema(key); | |
if (hasValidType || isNonCommercial || schemaValidity) { | |
if (schemaValidity) { | |
var releaseDate = (0, _moment.default)("13/01/2022", 'DD/MM/YYYY'); | |
var releaseDays = Math.floor(releaseDate.toDate().getTime() / 8.64e7); | |
var keyValidityDays = _extractTime(key); | |
keyValidityDate = (0, _moment.default)((keyValidityDays + 1) * 8.64e7, 'x').format('MMMM DD, YYYY'); | |
if (releaseDays > keyValidityDays) { | |
var daysAfterRelease = (0, _moment.default)().diff(releaseDate, 'days'); | |
consoleMessageState = daysAfterRelease <= 1 ? 'valid' : 'expired'; | |
domMessageState = daysAfterRelease <= 15 ? 'valid' : 'expired'; | |
} else { | |
consoleMessageState = 'valid'; | |
domMessageState = 'valid'; | |
} | |
} else if (isNonCommercial) { | |
consoleMessageState = 'non_commercial'; | |
domMessageState = 'valid'; | |
} else { | |
consoleMessageState = 'invalid'; | |
domMessageState = 'invalid'; | |
} | |
} else { | |
consoleMessageState = 'missing'; | |
domMessageState = 'missing'; | |
} | |
if (_ignored()) { | |
consoleMessageState = 'valid'; | |
domMessageState = 'valid'; | |
} | |
if (!_notified && consoleMessageState !== 'valid') { | |
var message = consoleMessages[consoleMessageState]({ | |
keyValidityDate: keyValidityDate, | |
hotVersion: hotVersion | |
}); | |
if (message) { | |
console[consoleMessageState === 'non_commercial' ? 'info' : 'warn'](consoleMessages[consoleMessageState]({ | |
keyValidityDate: keyValidityDate, | |
hotVersion: hotVersion | |
})); | |
} | |
_notified = true; | |
} | |
if (domMessageState !== 'valid' && element.parentNode) { | |
var _message = domMessages[domMessageState]({ | |
keyValidityDate: keyValidityDate, | |
hotVersion: hotVersion | |
}); | |
if (_message) { | |
var messageNode = document.createElement('div'); | |
messageNode.id = 'hot-display-license-info'; | |
messageNode.innerHTML = domMessages[domMessageState]({ | |
keyValidityDate: keyValidityDate, | |
hotVersion: hotVersion | |
}); | |
element.parentNode.insertBefore(messageNode, element.nextSibling); | |
} | |
} | |
} | |
function _checkKeySchema(v) { | |
var z = [][_m]; | |
var p = z; | |
if (v[_m] !== _cp('\x5A')) { | |
return false; | |
} | |
for (var c = '', i = '\x42\x3C\x48\x34\x50\x2B'.split(''), j = _cp(i.shift()); j; j = _cp(i.shift() || 'A')) { | |
--j < ''[_m] ? p = p | (_pi("".concat(_pi(_hd(c) + (_hd(_ss(v, Math.abs(j), 2)) + []).padStart(2, '0')))) % 97 || 2) >> 1 : c = _ss(v, j, !j ? 6 : i[_m] === 1 ? 9 : 8); | |
} | |
return p === z; | |
} | |
/* eslint-enable */ | |
/***/ }), | |
/* 35 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var arrayWithHoles = __webpack_require__(429); | |
var iterableToArrayLimit = __webpack_require__(723); | |
var unsupportedIterableToArray = __webpack_require__(296); | |
var nonIterableRest = __webpack_require__(431); | |
function _slicedToArray(arr, i) { | |
return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest(); | |
} | |
module.exports = _slicedToArray, module.exports.__esModule = true, module.exports["default"] = module.exports; | |
/***/ }), | |
/* 36 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var collection = __webpack_require__(213); | |
var collectionStrong = __webpack_require__(348); | |
// `Map` constructor | |
// https://tc39.es/ecma262/#sec-map-objects | |
collection('Map', function (init) { | |
return function Map() { return init(this, arguments.length ? arguments[0] : undefined); }; | |
}, collectionStrong); | |
/***/ }), | |
/* 37 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var NATIVE_BIND = __webpack_require__(163); | |
var FunctionPrototype = Function.prototype; | |
var bind = FunctionPrototype.bind; | |
var call = FunctionPrototype.call; | |
var uncurryThis = NATIVE_BIND && bind.bind(call, call); | |
module.exports = NATIVE_BIND ? function (fn) { | |
return fn && uncurryThis(fn); | |
} : function (fn) { | |
return fn && function () { | |
return call.apply(fn, arguments); | |
}; | |
}; | |
/***/ }), | |
/* 38 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var $ = __webpack_require__(31); | |
var $map = __webpack_require__(135).map; | |
var arrayMethodHasSpeciesSupport = __webpack_require__(172); | |
var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('map'); | |
// `Array.prototype.map` method | |
// https://tc39.es/ecma262/#sec-array.prototype.map | |
// with adding support of @@species | |
$({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, { | |
map: function map(callbackfn /* , thisArg */) { | |
return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); | |
} | |
}); | |
/***/ }), | |
/* 39 */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ArgumentTypes", function() { return ArgumentTypes; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FunctionPlugin", function() { return FunctionPlugin; }); | |
/* harmony import */ var core_js_modules_es_array_map_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(38); | |
/* harmony import */ var core_js_modules_es_array_map_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_map_js__WEBPACK_IMPORTED_MODULE_0__); | |
/* harmony import */ var core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(14); | |
/* harmony import */ var core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_1__); | |
/* harmony import */ var core_js_modules_es_number_is_integer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(68); | |
/* harmony import */ var core_js_modules_es_number_is_integer_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_number_is_integer_js__WEBPACK_IMPORTED_MODULE_2__); | |
/* harmony import */ var core_js_modules_es_number_constructor_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(53); | |
/* harmony import */ var core_js_modules_es_number_constructor_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_number_constructor_js__WEBPACK_IMPORTED_MODULE_3__); | |
/* harmony import */ var core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(9); | |
/* harmony import */ var core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_4__); | |
/* harmony import */ var core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(10); | |
/* harmony import */ var core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_5__); | |
/* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(0); | |
/* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_6__); | |
/* harmony import */ var core_js_modules_es_symbol_iterator_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(11); | |
/* harmony import */ var core_js_modules_es_symbol_iterator_js__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_symbol_iterator_js__WEBPACK_IMPORTED_MODULE_7__); | |
/* harmony import */ var core_js_modules_es_array_iterator_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(3); | |
/* harmony import */ var core_js_modules_es_array_iterator_js__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_iterator_js__WEBPACK_IMPORTED_MODULE_8__); | |
/* harmony import */ var core_js_modules_es_string_iterator_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(2); | |
/* harmony import */ var core_js_modules_es_string_iterator_js__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_string_iterator_js__WEBPACK_IMPORTED_MODULE_9__); | |
/* harmony import */ var core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(4); | |
/* harmony import */ var core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_10__); | |
/* harmony import */ var core_js_modules_es_array_from_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(23); | |
/* harmony import */ var core_js_modules_es_array_from_js__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_from_js__WEBPACK_IMPORTED_MODULE_11__); | |
/* harmony import */ var core_js_modules_es_function_name_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(26); | |
/* harmony import */ var core_js_modules_es_function_name_js__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_function_name_js__WEBPACK_IMPORTED_MODULE_12__); | |
/* harmony import */ var core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(13); | |
/* harmony import */ var core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_13___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_13__); | |
/* harmony import */ var _AbsoluteCellRange__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(88); | |
/* harmony import */ var _Cell__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(24); | |
/* harmony import */ var _error_message__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(46); | |
/* harmony import */ var _parser__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(70); | |
/* harmony import */ var _ArithmeticHelper__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(104); | |
/* harmony import */ var _InterpreterValue__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(51); | |
/* harmony import */ var _SimpleRangeValue__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(80); | |
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } | |
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } | |
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } | |
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } | |
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } | |
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } | |
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } | |
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | |
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } | |
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } | |
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } | |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | |
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | |
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | |
/** | |
* @license | |
* Copyright (c) 2021 Handsoncode. All rights reserved. | |
*/ | |
var ArgumentTypes; | |
(function (ArgumentTypes) { | |
/** | |
* String type. | |
*/ | |
ArgumentTypes["STRING"] = "STRING"; | |
/** | |
* Floating point type. | |
*/ | |
ArgumentTypes["NUMBER"] = "NUMBER"; | |
/** | |
* Boolean type. | |
*/ | |
ArgumentTypes["BOOLEAN"] = "BOOLEAN"; | |
/** | |
* Any non-range value. | |
*/ | |
ArgumentTypes["SCALAR"] = "SCALAR"; | |
/** | |
* Any non-range, no-error type. | |
*/ | |
ArgumentTypes["NOERROR"] = "NOERROR"; | |
/** | |
* Range type. | |
*/ | |
ArgumentTypes["RANGE"] = "RANGE"; | |
/** | |
* Integer type. | |
*/ | |
ArgumentTypes["INTEGER"] = "INTEGER"; | |
/** | |
* String representing complex number. | |
*/ | |
ArgumentTypes["COMPLEX"] = "COMPLEX"; | |
/** | |
* Range or scalar. | |
*/ | |
ArgumentTypes["ANY"] = "ANY"; | |
})(ArgumentTypes || (ArgumentTypes = {})); | |
/** | |
* Abstract class representing interpreter function plugin. | |
* Plugin may contain multiple functions. Each function should be of type {@link PluginFunctionType} and needs to be | |
* included in {@link implementedFunctions} | |
*/ | |
var FunctionPlugin = /*#__PURE__*/function () { | |
function FunctionPlugin(interpreter) { | |
var _this = this; | |
_classCallCheck(this, FunctionPlugin); | |
this.coerceScalarToNumberOrError = function (arg) { | |
return _this.arithmeticHelper.coerceScalarToNumberOrError(arg); | |
}; | |
this.runFunction = function (args, state, metadata, fn) { | |
var _a, _b, _c, _d, _e; | |
var argumentDefinitions = metadata.parameters; | |
var argValues; | |
if (metadata.expandRanges) { | |
argValues = _this.listOfScalarValues(args, state); | |
} else { | |
argValues = args.map(function (ast) { | |
return [_this.evaluateAst(ast, state), false]; | |
}); | |
} | |
if (metadata.repeatLastArgs === undefined && argumentDefinitions.length < argValues.length) { | |
return new _Cell__WEBPACK_IMPORTED_MODULE_15__["CellError"](_Cell__WEBPACK_IMPORTED_MODULE_15__["ErrorType"].NA, _error_message__WEBPACK_IMPORTED_MODULE_16__["ErrorMessage"].WrongArgNumber); | |
} | |
if (metadata.repeatLastArgs !== undefined && argumentDefinitions.length < argValues.length && (argValues.length - argumentDefinitions.length) % metadata.repeatLastArgs !== 0) { | |
return new _Cell__WEBPACK_IMPORTED_MODULE_15__["CellError"](_Cell__WEBPACK_IMPORTED_MODULE_15__["ErrorType"].NA, _error_message__WEBPACK_IMPORTED_MODULE_16__["ErrorMessage"].WrongArgNumber); | |
} | |
argumentDefinitions = _toConsumableArray(argumentDefinitions); | |
while (argumentDefinitions.length < argValues.length) { | |
var _argumentDefinitions; | |
(_argumentDefinitions = argumentDefinitions).push.apply(_argumentDefinitions, _toConsumableArray(argumentDefinitions.slice(argumentDefinitions.length - metadata.repeatLastArgs))); | |
} | |
var maxWidth = 1; | |
var maxHeight = 1; | |
if (!metadata.vectorizationForbidden && state.arraysFlag) { | |
for (var i = 0; i < argValues.length; i++) { | |
var _argValues$i = _slicedToArray(argValues[i], 1), | |
val = _argValues$i[0]; | |
if (val instanceof _SimpleRangeValue__WEBPACK_IMPORTED_MODULE_20__["SimpleRangeValue"] && argumentDefinitions[i].argumentType !== ArgumentTypes.RANGE && argumentDefinitions[i].argumentType !== ArgumentTypes.ANY) { | |
maxHeight = Math.max(maxHeight, val.height()); | |
maxWidth = Math.max(maxWidth, val.width()); | |
} | |
} | |
} | |
for (var _i2 = argValues.length; _i2 < argumentDefinitions.length; _i2++) { | |
if (((_a = argumentDefinitions[_i2]) === null || _a === void 0 ? void 0 : _a.defaultValue) === undefined) { | |
if (!((_b = argumentDefinitions[_i2]) === null || _b === void 0 ? void 0 : _b.optionalArg)) { | |
//not enough values passed as arguments, and there was no default value and argument was not optional | |
return new _Cell__WEBPACK_IMPORTED_MODULE_15__["CellError"](_Cell__WEBPACK_IMPORTED_MODULE_15__["ErrorType"].NA, _error_message__WEBPACK_IMPORTED_MODULE_16__["ErrorMessage"].WrongArgNumber); | |
} | |
} | |
} | |
var retArr = []; | |
for (var row = 0; row < maxHeight; row++) { | |
var rowArr = []; | |
for (var col = 0; col < maxWidth; col++) { | |
var argCoerceFailure = undefined; | |
var coercedArguments = []; | |
for (var _i3 = 0; _i3 < argumentDefinitions.length; _i3++) { | |
// eslint-disable-next-line prefer-const | |
var _ref = (_c = argValues[_i3]) !== null && _c !== void 0 ? _c : [undefined, undefined], | |
_ref2 = _slicedToArray(_ref, 2), | |
_val = _ref2[0], | |
ignorable = _ref2[1]; | |
if (_val instanceof _SimpleRangeValue__WEBPACK_IMPORTED_MODULE_20__["SimpleRangeValue"] && argumentDefinitions[_i3].argumentType !== ArgumentTypes.RANGE && argumentDefinitions[_i3].argumentType !== ArgumentTypes.ANY) { | |
if (!metadata.vectorizationForbidden && state.arraysFlag) { | |
_val = (_d = _val.data[_val.height() !== 1 ? row : 0]) === null || _d === void 0 ? void 0 : _d[_val.width() !== 1 ? col : 0]; | |
} | |
} | |
var arg = _val !== null && _val !== void 0 ? _val : (_e = argumentDefinitions[_i3]) === null || _e === void 0 ? void 0 : _e.defaultValue; | |
if (arg === undefined) { | |
coercedArguments.push(undefined); //we verified in previous loop that this arg is optional | |
} else { | |
//we apply coerce only to non-default values | |
var coercedArg = _val !== undefined ? _this.coerceToType(arg, argumentDefinitions[_i3], state) : arg; | |
if (coercedArg !== undefined) { | |
if (coercedArg instanceof _Cell__WEBPACK_IMPORTED_MODULE_15__["CellError"] && argumentDefinitions[_i3].argumentType !== ArgumentTypes.SCALAR) { | |
//if this is first error encountered, store it | |
argCoerceFailure = argCoerceFailure !== null && argCoerceFailure !== void 0 ? argCoerceFailure : coercedArg; | |
} | |
coercedArguments.push(coercedArg); | |
} else if (!ignorable) { | |
//if this is first error encountered, store it | |
argCoerceFailure = argCoerceFailure !== null && argCoerceFailure !== void 0 ? argCoerceFailure : new _Cell__WEBPACK_IMPORTED_MODULE_15__["CellError"](_Cell__WEBPACK_IMPORTED_MODULE_15__["ErrorType"].VALUE, _error_message__WEBPACK_IMPORTED_MODULE_16__["ErrorMessage"].WrongType); | |
} | |
} | |
} | |
var ret = argCoerceFailure !== null && argCoerceFailure !== void 0 ? argCoerceFailure : _this.returnNumberWrapper(fn.apply(void 0, coercedArguments), metadata.returnNumberType); | |
if (maxHeight === 1 && maxWidth === 1) { | |
return ret; | |
} | |
if (ret instanceof _SimpleRangeValue__WEBPACK_IMPORTED_MODULE_20__["SimpleRangeValue"]) { | |
throw 'Function returning array cannot be vectorized.'; | |
} | |
rowArr.push(ret); | |
} | |
retArr.push(rowArr); | |
} | |
return _SimpleRangeValue__WEBPACK_IMPORTED_MODULE_20__["SimpleRangeValue"].onlyValues(retArr); | |
}; | |
this.runFunctionWithReferenceArgument = function (args, state, metadata, noArgCallback, referenceCallback) { | |
var nonReferenceCallback = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : function () { | |
return new _Cell__WEBPACK_IMPORTED_MODULE_15__["CellError"](_Cell__WEBPACK_IMPORTED_MODULE_15__["ErrorType"].NA, _error_message__WEBPACK_IMPORTED_MODULE_16__["ErrorMessage"].CellRefExpected); | |
}; | |
if (args.length === 0) { | |
return _this.returnNumberWrapper(noArgCallback(), metadata.returnNumberType); | |
} else if (args.length > 1) { | |
return new _Cell__WEBPACK_IMPORTED_MODULE_15__["CellError"](_Cell__WEBPACK_IMPORTED_MODULE_15__["ErrorType"].NA, _error_message__WEBPACK_IMPORTED_MODULE_16__["ErrorMessage"].WrongArgNumber); | |
} | |
var arg = args[0]; | |
while (arg.type === _parser__WEBPACK_IMPORTED_MODULE_17__["AstNodeType"].PARENTHESIS) { | |
arg = arg.expression; | |
} | |
var cellReference; | |
if (arg.type === _parser__WEBPACK_IMPORTED_MODULE_17__["AstNodeType"].CELL_REFERENCE) { | |
cellReference = arg.reference.toSimpleCellAddress(state.formulaAddress); | |
} else if (arg.type === _parser__WEBPACK_IMPORTED_MODULE_17__["AstNodeType"].CELL_RANGE || arg.type === _parser__WEBPACK_IMPORTED_MODULE_17__["AstNodeType"].COLUMN_RANGE || arg.type === _parser__WEBPACK_IMPORTED_MODULE_17__["AstNodeType"].ROW_RANGE) { | |
try { | |
cellReference = _AbsoluteCellRange__WEBPACK_IMPORTED_MODULE_14__["AbsoluteCellRange"].fromAst(arg, state.formulaAddress).start; | |
} catch (e) { | |
return new _Cell__WEBPACK_IMPORTED_MODULE_15__["CellError"](_Cell__WEBPACK_IMPORTED_MODULE_15__["ErrorType"].REF, _error_message__WEBPACK_IMPORTED_MODULE_16__["ErrorMessage"].CellRefExpected); | |
} | |
} | |
if (cellReference !== undefined) { | |
return _this.returnNumberWrapper(referenceCallback(cellReference), metadata.returnNumberType); | |
} | |
return _this.runFunction(args, state, metadata, nonReferenceCallback); | |
}; | |
this.interpreter = interpreter; | |
this.dependencyGraph = interpreter.dependencyGraph; | |
this.columnSearch = interpreter.columnSearch; | |
this.config = interpreter.config; | |
this.serialization = interpreter.serialization; | |
this.arraySizePredictor = interpreter.arraySizePredictor; | |
this.dateTimeHelper = interpreter.dateTimeHelper; | |
this.arithmeticHelper = interpreter.arithmeticHelper; | |
} | |
_createClass(FunctionPlugin, [{ | |
key: "evaluateAst", | |
value: function evaluateAst(ast, state) { | |
return this.interpreter.evaluateAst(ast, state); | |
} | |
}, { | |
key: "arraySizeForAst", | |
value: function arraySizeForAst(ast, state) { | |
return this.arraySizePredictor.checkArraySizeForAst(ast, state); | |
} | |
}, { | |
key: "listOfScalarValues", | |
value: function listOfScalarValues(asts, state) { | |
var ret = []; | |
var _iterator = _createForOfIteratorHelper(asts), | |
_step; | |
try { | |
for (_iterator.s(); !(_step = _iterator.n()).done;) { | |
var argAst = _step.value; | |
var value = this.evaluateAst(argAst, state); | |
if (value instanceof _SimpleRangeValue__WEBPACK_IMPORTED_MODULE_20__["SimpleRangeValue"]) { | |
var _iterator2 = _createForOfIteratorHelper(value.valuesFromTopLeftCorner()), | |
_step2; | |
try { | |
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { | |
var scalarValue = _step2.value; | |
ret.push([scalarValue, true]); | |
} | |
} catch (err) { | |
_iterator2.e(err); | |
} finally { | |
_iterator2.f(); | |
} | |
} else { | |
ret.push([value, false]); | |
} | |
} | |
} catch (err) { | |
_iterator.e(err); | |
} finally { | |
_iterator.f(); | |
} | |
return ret; | |
} | |
}, { | |
key: "coerceToType", | |
value: function coerceToType(arg, coercedType, state) { | |
var ret; | |
if (arg instanceof _SimpleRangeValue__WEBPACK_IMPORTED_MODULE_20__["SimpleRangeValue"]) { | |
switch (coercedType.argumentType) { | |
case ArgumentTypes.RANGE: | |
case ArgumentTypes.ANY: | |
ret = arg; | |
break; | |
default: | |
{ | |
var coerce = Object(_ArithmeticHelper__WEBPACK_IMPORTED_MODULE_18__["coerceRangeToScalar"])(arg, state); | |
if (coerce === undefined) { | |
return undefined; | |
} | |
arg = coerce; | |
} | |
} | |
} | |
if (!(arg instanceof _SimpleRangeValue__WEBPACK_IMPORTED_MODULE_20__["SimpleRangeValue"])) { | |
switch (coercedType.argumentType) { | |
case ArgumentTypes.INTEGER: | |
case ArgumentTypes.NUMBER: | |
// eslint-disable-next-line no-case-declarations | |
var coerced = this.coerceScalarToNumberOrError(arg); | |
if (!Object(_InterpreterValue__WEBPACK_IMPORTED_MODULE_19__["isExtendedNumber"])(coerced)) { | |
ret = coerced; | |
break; | |
} // eslint-disable-next-line no-case-declarations | |
var value = Object(_InterpreterValue__WEBPACK_IMPORTED_MODULE_19__["getRawValue"])(coerced); | |
if (coercedType.maxValue !== undefined && value > coercedType.maxValue) { | |
return new _Cell__WEBPACK_IMPORTED_MODULE_15__["CellError"](_Cell__WEBPACK_IMPORTED_MODULE_15__["ErrorType"].NUM, _error_message__WEBPACK_IMPORTED_MODULE_16__["ErrorMessage"].ValueLarge); | |
} | |
if (coercedType.minValue !== undefined && value < coercedType.minValue) { | |
return new _Cell__WEBPACK_IMPORTED_MODULE_15__["CellError"](_Cell__WEBPACK_IMPORTED_MODULE_15__["ErrorType"].NUM, _error_message__WEBPACK_IMPORTED_MODULE_16__["ErrorMessage"].ValueSmall); | |
} | |
if (coercedType.lessThan !== undefined && value >= coercedType.lessThan) { | |
return new _Cell__WEBPACK_IMPORTED_MODULE_15__["CellError"](_Cell__WEBPACK_IMPORTED_MODULE_15__["ErrorType"].NUM, _error_message__WEBPACK_IMPORTED_MODULE_16__["ErrorMessage"].ValueLarge); | |
} | |
if (coercedType.greaterThan !== undefined && value <= coercedType.greaterThan) { | |
return new _Cell__WEBPACK_IMPORTED_MODULE_15__["CellError"](_Cell__WEBPACK_IMPORTED_MODULE_15__["ErrorType"].NUM, _error_message__WEBPACK_IMPORTED_MODULE_16__["ErrorMessage"].ValueSmall); | |
} | |
if (coercedType.argumentType === ArgumentTypes.INTEGER && !Number.isInteger(value)) { | |
return new _Cell__WEBPACK_IMPORTED_MODULE_15__["CellError"](_Cell__WEBPACK_IMPORTED_MODULE_15__["ErrorType"].NUM, _error_message__WEBPACK_IMPORTED_MODULE_16__["ErrorMessage"].IntegerExpected); | |
} | |
ret = coerced; | |
break; | |
case ArgumentTypes.STRING: | |
ret = Object(_ArithmeticHelper__WEBPACK_IMPORTED_MODULE_18__["coerceScalarToString"])(arg); | |
break; | |
case ArgumentTypes.BOOLEAN: | |
ret = Object(_ArithmeticHelper__WEBPACK_IMPORTED_MODULE_18__["coerceScalarToBoolean"])(arg); | |
break; | |
case ArgumentTypes.SCALAR: | |
case ArgumentTypes.NOERROR: | |
case ArgumentTypes.ANY: | |
ret = arg; | |
break; | |
case ArgumentTypes.RANGE: | |
if (arg instanceof _Cell__WEBPACK_IMPORTED_MODULE_15__["CellError"]) { | |
return arg; | |
} | |
ret = Object(_ArithmeticHelper__WEBPACK_IMPORTED_MODULE_18__["coerceToRange"])(arg); | |
break; | |
case ArgumentTypes.COMPLEX: | |
return this.arithmeticHelper.coerceScalarToComplex(Object(_InterpreterValue__WEBPACK_IMPORTED_MODULE_19__["getRawValue"])(arg)); | |
} | |
} | |
if (coercedType.passSubtype || ret === undefined) { | |
return ret; | |
} else { | |
return Object(_InterpreterValue__WEBPACK_IMPORTED_MODULE_19__["getRawValue"])(ret); | |
} | |
} | |
}, { | |
key: "metadata", | |
value: function metadata(name) { | |
var params = this.constructor.implementedFunctions[name]; | |
if (params !== undefined) { | |
return params; | |
} | |
throw new Error("No metadata for function ".concat(name, ".")); | |
} | |
}, { | |
key: "returnNumberWrapper", | |
value: function returnNumberWrapper(val, type, format) { | |
if (type !== undefined && Object(_InterpreterValue__WEBPACK_IMPORTED_MODULE_19__["isExtendedNumber"])(val)) { | |
return this.arithmeticHelper.ExtendedNumberFactory(Object(_InterpreterValue__WEBPACK_IMPORTED_MODULE_19__["getRawValue"])(val), { | |
type: type, | |
format: format | |
}); | |
} else { | |
return val; | |
} | |
} | |
}]); | |
return FunctionPlugin; | |
}(); | |
/***/ }), | |
/* 40 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var $ = __webpack_require__(31); | |
var $filter = __webpack_require__(135).filter; | |
var arrayMethodHasSpeciesSupport = __webpack_require__(172); | |
var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('filter'); | |
// `Array.prototype.filter` method | |
// https://tc39.es/ecma262/#sec-array.prototype.filter | |
// with adding support of @@species | |
$({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, { | |
filter: function filter(callbackfn /* , thisArg */) { | |
return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); | |
} | |
}); | |
/***/ }), | |
/* 41 */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NoSheetWithIdError", function() { return NoSheetWithIdError; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NoSheetWithNameError", function() { return NoSheetWithNameError; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SheetNameAlreadyTakenError", function() { return SheetNameAlreadyTakenError; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SheetSizeLimitExceededError", function() { return SheetSizeLimitExceededError; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NotAFormulaError", function() { return NotAFormulaError; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "InvalidAddressError", function() { return InvalidAddressError; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "InvalidArgumentsError", function() { return InvalidArgumentsError; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SheetsNotEqual", function() { return SheetsNotEqual; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NamedExpressionNameIsAlreadyTakenError", function() { return NamedExpressionNameIsAlreadyTakenError; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NamedExpressionNameIsInvalidError", function() { return NamedExpressionNameIsInvalidError; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NamedExpressionDoesNotExistError", function() { return NamedExpressionDoesNotExistError; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NoOperationToUndoError", function() { return NoOperationToUndoError; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NoOperationToRedoError", function() { return NoOperationToRedoError; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NothingToPasteError", function() { return NothingToPasteError; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UnableToParseError", function() { return UnableToParseError; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ExpectedValueOfTypeError", function() { return ExpectedValueOfTypeError; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ConfigValueEmpty", function() { return ConfigValueEmpty; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ConfigValueTooSmallError", function() { return ConfigValueTooSmallError; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ConfigValueTooBigError", function() { return ConfigValueTooBigError; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ExpectedOneOfValuesError", function() { return ExpectedOneOfValuesError; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EvaluationSuspendedError", function() { return EvaluationSuspendedError; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MissingTranslationError", function() { return MissingTranslationError; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ProtectedFunctionTranslationError", function() { return ProtectedFunctionTranslationError; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LanguageNotRegisteredError", function() { return LanguageNotRegisteredError; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LanguageAlreadyRegisteredError", function() { return LanguageAlreadyRegisteredError; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FunctionPluginValidationError", function() { return FunctionPluginValidationError; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ProtectedFunctionError", function() { return ProtectedFunctionError; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SourceLocationHasArrayError", function() { return SourceLocationHasArrayError; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TargetLocationHasArrayError", function() { return TargetLocationHasArrayError; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NoRelativeAddressesAllowedError", function() { return NoRelativeAddressesAllowedError; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AliasAlreadyExisting", function() { return AliasAlreadyExisting; }); | |
/* harmony import */ var core_js_modules_es_array_concat_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(21); | |
/* harmony import */ var core_js_modules_es_array_concat_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_concat_js__WEBPACK_IMPORTED_MODULE_0__); | |
/* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(0); | |
/* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_1__); | |
/* harmony import */ var core_js_modules_es_regexp_to_string_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(67); | |
/* harmony import */ var core_js_modules_es_regexp_to_string_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_regexp_to_string_js__WEBPACK_IMPORTED_MODULE_2__); | |
/* harmony import */ var core_js_modules_es_regexp_constructor_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(95); | |
/* harmony import */ var core_js_modules_es_regexp_constructor_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_regexp_constructor_js__WEBPACK_IMPORTED_MODULE_3__); | |
/* harmony import */ var core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(13); | |
/* harmony import */ var core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_4__); | |
/* harmony import */ var core_js_modules_es_object_get_prototype_of_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(27); | |
/* harmony import */ var core_js_modules_es_object_get_prototype_of_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_get_prototype_of_js__WEBPACK_IMPORTED_MODULE_5__); | |
/* harmony import */ var core_js_modules_es_reflect_construct_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(7); | |
/* harmony import */ var core_js_modules_es_reflect_construct_js__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_reflect_construct_js__WEBPACK_IMPORTED_MODULE_6__); | |
/* harmony import */ var core_js_modules_es_array_iterator_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(3); | |
/* harmony import */ var core_js_modules_es_array_iterator_js__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_iterator_js__WEBPACK_IMPORTED_MODULE_7__); | |
/* harmony import */ var core_js_modules_es_map_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(36); | |
/* harmony import */ var core_js_modules_es_map_js__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_map_js__WEBPACK_IMPORTED_MODULE_8__); | |
/* harmony import */ var core_js_modules_es_string_iterator_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(2); | |
/* harmony import */ var core_js_modules_es_string_iterator_js__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_string_iterator_js__WEBPACK_IMPORTED_MODULE_9__); | |
/* harmony import */ var core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(4); | |
/* harmony import */ var core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_10__); | |
/* harmony import */ var core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(9); | |
/* harmony import */ var core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_11__); | |
/* harmony import */ var core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(10); | |
/* harmony import */ var core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_12__); | |
/* harmony import */ var core_js_modules_es_symbol_iterator_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(11); | |
/* harmony import */ var core_js_modules_es_symbol_iterator_js__WEBPACK_IMPORTED_MODULE_13___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_symbol_iterator_js__WEBPACK_IMPORTED_MODULE_13__); | |
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | |
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | |
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | |
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } | |
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | |
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } | |
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | |
function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); } | |
function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); } | |
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | |
function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; } | |
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | |
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | |
/** | |
* @license | |
* Copyright (c) 2021 Handsoncode. All rights reserved. | |
*/ | |
/** | |
* Error thrown when the sheet of a given ID does not exist. | |
*/ | |
var NoSheetWithIdError = /*#__PURE__*/function (_Error) { | |
_inherits(NoSheetWithIdError, _Error); | |
var _super = _createSuper(NoSheetWithIdError); | |
function NoSheetWithIdError(sheetId) { | |
_classCallCheck(this, NoSheetWithIdError); | |
return _super.call(this, "There's no sheet with id = ".concat(sheetId)); | |
} | |
return _createClass(NoSheetWithIdError); | |
}( /*#__PURE__*/_wrapNativeSuper(Error)); | |
/** | |
* Error thrown when the sheet of a given name does not exist. | |
*/ | |
var NoSheetWithNameError = /*#__PURE__*/function (_Error2) { | |
_inherits(NoSheetWithNameError, _Error2); | |
var _super2 = _createSuper(NoSheetWithNameError); | |
function NoSheetWithNameError(sheetName) { | |
_classCallCheck(this, NoSheetWithNameError); | |
return _super2.call(this, "There's no sheet with name '".concat(sheetName, "'")); | |
} | |
return _createClass(NoSheetWithNameError); | |
}( /*#__PURE__*/_wrapNativeSuper(Error)); | |
/** | |
* Error thrown when the sheet of a given name already exists. | |
*/ | |
var SheetNameAlreadyTakenError = /*#__PURE__*/function (_Error3) { | |
_inherits(SheetNameAlreadyTakenError, _Error3); | |
var _super3 = _createSuper(SheetNameAlreadyTakenError); | |
function SheetNameAlreadyTakenError(sheetName) { | |
_classCallCheck(this, SheetNameAlreadyTakenError); | |
return _super3.call(this, "Sheet with name ".concat(sheetName, " already exists")); | |
} | |
return _createClass(SheetNameAlreadyTakenError); | |
}( /*#__PURE__*/_wrapNativeSuper(Error)); | |
/** | |
* Error thrown when loaded sheet size exceeds configured limits. | |
*/ | |
var SheetSizeLimitExceededError = /*#__PURE__*/function (_Error4) { | |
_inherits(SheetSizeLimitExceededError, _Error4); | |
var _super4 = _createSuper(SheetSizeLimitExceededError); | |
function SheetSizeLimitExceededError() { | |
_classCallCheck(this, SheetSizeLimitExceededError); | |
return _super4.call(this, 'Sheet size limit exceeded'); | |
} | |
return _createClass(SheetSizeLimitExceededError); | |
}( /*#__PURE__*/_wrapNativeSuper(Error)); | |
/** | |
* Error thrown when the the provided string is not a valid formula, i.e does not start with "=" | |
*/ | |
var NotAFormulaError = /*#__PURE__*/function (_Error5) { | |
_inherits(NotAFormulaError, _Error5); | |
var _super5 = _createSuper(NotAFormulaError); | |
function NotAFormulaError() { | |
_classCallCheck(this, NotAFormulaError); | |
return _super5.call(this, 'This is not a formula'); | |
} | |
return _createClass(NotAFormulaError); | |
}( /*#__PURE__*/_wrapNativeSuper(Error)); | |
/** | |
* Error thrown when the given address is invalid. | |
*/ | |
var InvalidAddressError = /*#__PURE__*/function (_Error6) { | |
_inherits(InvalidAddressError, _Error6); | |
var _super6 = _createSuper(InvalidAddressError); | |
function InvalidAddressError(address) { | |
_classCallCheck(this, InvalidAddressError); | |
return _super6.call(this, "Address (row = ".concat(address.row, ", col = ").concat(address.col, ") is invalid")); | |
} | |
return _createClass(InvalidAddressError); | |
}( /*#__PURE__*/_wrapNativeSuper(Error)); | |
/** | |
* Error thrown when the given arguments are invalid | |
*/ | |
var InvalidArgumentsError = /*#__PURE__*/function (_Error7) { | |
_inherits(InvalidArgumentsError, _Error7); | |
var _super7 = _createSuper(InvalidArgumentsError); | |
function InvalidArgumentsError(expectedArguments) { | |
_classCallCheck(this, InvalidArgumentsError); | |
return _super7.call(this, "Invalid arguments, expected ".concat(expectedArguments)); | |
} | |
return _createClass(InvalidArgumentsError); | |
}( /*#__PURE__*/_wrapNativeSuper(Error)); | |
/** | |
* Error thrown when the given sheets are not equal. | |
*/ | |
var SheetsNotEqual = /*#__PURE__*/function (_Error8) { | |
_inherits(SheetsNotEqual, _Error8); | |
var _super8 = _createSuper(SheetsNotEqual); | |
function SheetsNotEqual(sheet1, sheet2) { | |
_classCallCheck(this, SheetsNotEqual); | |
return _super8.call(this, "Sheets ".concat(sheet1, " and ").concat(sheet2, " are not equal.")); | |
} | |
return _createClass(SheetsNotEqual); | |
}( /*#__PURE__*/_wrapNativeSuper(Error)); | |
/** | |
* Error thrown when the given named expression already exists in the workbook and therefore it cannot be added. | |
*/ | |
var NamedExpressionNameIsAlreadyTakenError = /*#__PURE__*/function (_Error9) { | |
_inherits(NamedExpressionNameIsAlreadyTakenError, _Error9); | |
var _super9 = _createSuper(NamedExpressionNameIsAlreadyTakenError); | |
function NamedExpressionNameIsAlreadyTakenError(expressionName) { | |
_classCallCheck(this, NamedExpressionNameIsAlreadyTakenError); | |
return _super9.call(this, "Name of Named Expression '".concat(expressionName, "' is already present")); | |
} | |
return _createClass(NamedExpressionNameIsAlreadyTakenError); | |
}( /*#__PURE__*/_wrapNativeSuper(Error)); | |
/** | |
* Error thrown when the name given for the named expression is invalid. | |
*/ | |
var NamedExpressionNameIsInvalidError = /*#__PURE__*/function (_Error10) { | |
_inherits(NamedExpressionNameIsInvalidError, _Error10); | |
var _super10 = _createSuper(NamedExpressionNameIsInvalidError); | |
function NamedExpressionNameIsInvalidError(expressionName) { | |
_classCallCheck(this, NamedExpressionNameIsInvalidError); | |
return _super10.call(this, "Name of Named Expression '".concat(expressionName, "' is invalid")); | |
} | |
return _createClass(NamedExpressionNameIsInvalidError); | |
}( /*#__PURE__*/_wrapNativeSuper(Error)); | |
/** | |
* Error thrown when the given named expression does not exist. | |
*/ | |
var NamedExpressionDoesNotExistError = /*#__PURE__*/function (_Error11) { | |
_inherits(NamedExpressionDoesNotExistError, _Error11); | |
var _super11 = _createSuper(NamedExpressionDoesNotExistError); | |
function NamedExpressionDoesNotExistError(expressionName) { | |
_classCallCheck(this, NamedExpressionDoesNotExistError); | |
return _super11.call(this, "Named Expression '".concat(expressionName, "' does not exist")); | |
} | |
return _createClass(NamedExpressionDoesNotExistError); | |
}( /*#__PURE__*/_wrapNativeSuper(Error)); | |
/** | |
* Error thrown when there are no operations to be undone by the [[undo]] method. | |
*/ | |
var NoOperationToUndoError = /*#__PURE__*/function (_Error12) { | |
_inherits(NoOperationToUndoError, _Error12); | |
var _super12 = _createSuper(NoOperationToUndoError); | |
function NoOperationToUndoError() { | |
_classCallCheck(this, NoOperationToUndoError); | |
return _super12.call(this, 'There is no operation to undo'); | |
} | |
return _createClass(NoOperationToUndoError); | |
}( /*#__PURE__*/_wrapNativeSuper(Error)); | |
/** | |
* Error thrown when there are no operations to redo by the [[redo]] method. | |
*/ | |
var NoOperationToRedoError = /*#__PURE__*/function (_Error13) { | |
_inherits(NoOperationToRedoError, _Error13); | |
var _super13 = _createSuper(NoOperationToRedoError); | |
function NoOperationToRedoError() { | |
_classCallCheck(this, NoOperationToRedoError); | |
return _super13.call(this, 'There is no operation to redo'); | |
} | |
return _createClass(NoOperationToRedoError); | |
}( /*#__PURE__*/_wrapNativeSuper(Error)); | |
/** | |
* Error thrown when there is nothing to paste by the [[paste]] method. | |
*/ | |
var NothingToPasteError = /*#__PURE__*/function (_Error14) { | |
_inherits(NothingToPasteError, _Error14); | |
var _super14 = _createSuper(NothingToPasteError); | |
function NothingToPasteError() { | |
_classCallCheck(this, NothingToPasteError); | |
return _super14.call(this, 'There is nothing to paste'); | |
} | |
return _createClass(NothingToPasteError); | |
}( /*#__PURE__*/_wrapNativeSuper(Error)); | |
function replacer(key, val) { | |
switch (_typeof(val)) { | |
case 'function': | |
case 'symbol': | |
return val.toString(); | |
case 'bigint': | |
return 'BigInt(' + val.toString() + ')'; | |
default: | |
{ | |
if (val instanceof RegExp) { | |
return 'RegExp(' + val.toString() + ')'; | |
} else { | |
return val; | |
} | |
} | |
} | |
} | |
/** | |
* Error thrown when the given value cannot be parsed. | |
* | |
* Checks against the validity in: | |
* | |
* @see [[buildFromArray]] | |
* @see [[buildFromSheets]] | |
* @see [[setCellsContents]] | |
*/ | |
var UnableToParseError = /*#__PURE__*/function (_Error15) { | |
_inherits(UnableToParseError, _Error15); | |
var _super15 = _createSuper(UnableToParseError); | |
function UnableToParseError(value) { | |
_classCallCheck(this, UnableToParseError); | |
return _super15.call(this, "Unable to parse value: ".concat(JSON.stringify(value, replacer, 4))); | |
} | |
return _createClass(UnableToParseError); | |
}( /*#__PURE__*/_wrapNativeSuper(Error)); | |
/** | |
* Error thrown when the expected value type differs from the given value type. | |
* It also displays the expected type. | |
* This error might be thrown while setting or updating the [[ConfigParams]]. | |
* The following methods accept [[ConfigParams]] as a parameter: | |
* | |
* @see [[buildEmpty]] | |
* @see [[buildFromArray]] | |
* @see [[buildFromSheets]] | |
* @see [[updateConfig]] | |
*/ | |
var ExpectedValueOfTypeError = /*#__PURE__*/function (_Error16) { | |
_inherits(ExpectedValueOfTypeError, _Error16); | |
var _super16 = _createSuper(ExpectedValueOfTypeError); | |
function ExpectedValueOfTypeError(expectedType, paramName) { | |
_classCallCheck(this, ExpectedValueOfTypeError); | |
return _super16.call(this, "Expected value of type: ".concat(expectedType, " for config parameter: ").concat(paramName)); | |
} | |
return _createClass(ExpectedValueOfTypeError); | |
}( /*#__PURE__*/_wrapNativeSuper(Error)); | |
/** | |
* Error thrown when supplied config parameter value is an empty string. | |
* This error might be thrown while setting or updating the [[ConfigParams]]. | |
* The following methods accept [[ConfigParams]] as a parameter: | |
* | |
* @see [[buildEmpty]] | |
* @see [[buildFromArray]] | |
* @see [[buildFromSheets]] | |
* @see [[updateConfig]] | |
*/ | |
var ConfigValueEmpty = /*#__PURE__*/function (_Error17) { | |
_inherits(ConfigValueEmpty, _Error17); | |
var _super17 = _createSuper(ConfigValueEmpty); | |
function ConfigValueEmpty(paramName) { | |
_classCallCheck(this, ConfigValueEmpty); | |
return _super17.call(this, "Config parameter ".concat(paramName, " cannot be empty.")); | |
} | |
return _createClass(ConfigValueEmpty); | |
}( /*#__PURE__*/_wrapNativeSuper(Error)); | |
/** | |
* Error thrown when supplied config parameter value is too small. | |
* This error might be thrown while setting or updating the [[ConfigParams]]. | |
* The following methods accept [[ConfigParams]] as a parameter: | |
* | |
* @see [[buildEmpty]] | |
* @see [[buildFromArray]] | |
* @see [[buildFromSheets]] | |
* @see [[updateConfig]] | |
*/ | |
var ConfigValueTooSmallError = /*#__PURE__*/function (_Error18) { | |
_inherits(ConfigValueTooSmallError, _Error18); | |
var _super18 = _createSuper(ConfigValueTooSmallError); | |
function ConfigValueTooSmallError(paramName, minimum) { | |
_classCallCheck(this, ConfigValueTooSmallError); | |
return _super18.call(this, "Config parameter ".concat(paramName, " should be at least ").concat(minimum)); | |
} | |
return _createClass(ConfigValueTooSmallError); | |
}( /*#__PURE__*/_wrapNativeSuper(Error)); | |
/** | |
* Error thrown when supplied config parameter value is too big. | |
* This error might be thrown while setting or updating the [[ConfigParams]]. | |
* The following methods accept [[ConfigParams]] as a parameter: | |
* | |
* @see [[buildEmpty]] | |
* @see [[buildFromArray]] | |
* @see [[buildFromSheets]] | |
* @see [[updateConfig]] | |
*/ | |
var ConfigValueTooBigError = /*#__PURE__*/function (_Error19) { | |
_inherits(ConfigValueTooBigError, _Error19); | |
var _super19 = _createSuper(ConfigValueTooBigError); | |
function ConfigValueTooBigError(paramName, maximum) { | |
_classCallCheck(this, ConfigValueTooBigError); | |
return _super19.call(this, "Config parameter ".concat(paramName, " should be at most ").concat(maximum)); | |
} | |
return _createClass(ConfigValueTooBigError); | |
}( /*#__PURE__*/_wrapNativeSuper(Error)); | |
/** | |
* Error thrown when the value was expected to be set for a config parameter. | |
* It also displays the expected value. | |
* This error might be thrown while setting or updating the [[ConfigParams]]. | |
* The following methods accept [[ConfigParams]] as a parameter: | |
* | |
* @see [[buildEmpty]] | |
* @see [[buildFromArray]] | |
* @see [[buildFromSheets]] | |
* @see [[updateConfig]] | |
*/ | |
var ExpectedOneOfValuesError = /*#__PURE__*/function (_Error20) { | |
_inherits(ExpectedOneOfValuesError, _Error20); | |
var _super20 = _createSuper(ExpectedOneOfValuesError); | |
function ExpectedOneOfValuesError(values, paramName) { | |
_classCallCheck(this, ExpectedOneOfValuesError); | |
return _super20.call(this, "Expected one of ".concat(values, " for config parameter: ").concat(paramName)); | |
} | |
return _createClass(ExpectedOneOfValuesError); | |
}( /*#__PURE__*/_wrapNativeSuper(Error)); | |
/** | |
* Error thrown when computations become suspended. | |
* To perform any other action wait for the batch to complete or resume the evaluation. | |
* Relates to: | |
* | |
* @see [[batch]] | |
* @see [[suspendEvaluation]] | |
* @see [[resumeEvaluation]] | |
*/ | |
var EvaluationSuspendedError = /*#__PURE__*/function (_Error21) { | |
_inherits(EvaluationSuspendedError, _Error21); | |
var _super21 = _createSuper(EvaluationSuspendedError); | |
function EvaluationSuspendedError() { | |
_classCallCheck(this, EvaluationSuspendedError); | |
return _super21.call(this, 'Computations are suspended'); | |
} | |
return _createClass(EvaluationSuspendedError); | |
}( /*#__PURE__*/_wrapNativeSuper(Error)); | |
/** | |
* Error thrown when translation is missing in translation package. | |
* | |
* TODO | |
*/ | |
var MissingTranslationError = /*#__PURE__*/function (_Error22) { | |
_inherits(MissingTranslationError, _Error22); | |
var _super22 = _createSuper(MissingTranslationError); | |
function MissingTranslationError(key) { | |
_classCallCheck(this, MissingTranslationError); | |
return _super22.call(this, "Translation for ".concat(key, " is missing in the translation package you're using.")); | |
} | |
return _createClass(MissingTranslationError); | |
}( /*#__PURE__*/_wrapNativeSuper(Error)); | |
/** | |
* Error thrown when trying to override protected translation. | |
* | |
* @see [[registerLanguage]] | |
* @see [[registerFunction]] | |
* @see [[registerFunctionPlugin]] | |
*/ | |
var ProtectedFunctionTranslationError = /*#__PURE__*/function (_Error23) { | |
_inherits(ProtectedFunctionTranslationError, _Error23); | |
var _super23 = _createSuper(ProtectedFunctionTranslationError); | |
function ProtectedFunctionTranslationError(key) { | |
_classCallCheck(this, ProtectedFunctionTranslationError); | |
return _super23.call(this, "Cannot register translation for function with id: ".concat(key)); | |
} | |
return _createClass(ProtectedFunctionTranslationError); | |
}( /*#__PURE__*/_wrapNativeSuper(Error)); | |
/** | |
* Error thrown when trying to retrieve not registered language | |
* | |
* @see [[getLanguage]] | |
* @see [[unregisterLanguage]] | |
*/ | |
var LanguageNotRegisteredError = /*#__PURE__*/function (_Error24) { | |
_inherits(LanguageNotRegisteredError, _Error24); | |
var _super24 = _createSuper(LanguageNotRegisteredError); | |
function LanguageNotRegisteredError() { | |
_classCallCheck(this, LanguageNotRegisteredError); | |
return _super24.call(this, 'Language not registered.'); | |
} | |
return _createClass(LanguageNotRegisteredError); | |
}( /*#__PURE__*/_wrapNativeSuper(Error)); | |
/** | |
* Error thrown when trying to register already registered language | |
* | |
* @see [[registerLanguage]] | |
*/ | |
var LanguageAlreadyRegisteredError = /*#__PURE__*/function (_Error25) { | |
_inherits(LanguageAlreadyRegisteredError, _Error25); | |
var _super25 = _createSuper(LanguageAlreadyRegisteredError); | |
function LanguageAlreadyRegisteredError() { | |
_classCallCheck(this, LanguageAlreadyRegisteredError); | |
return _super25.call(this, 'Language already registered.'); | |
} | |
return _createClass(LanguageAlreadyRegisteredError); | |
}( /*#__PURE__*/_wrapNativeSuper(Error)); | |
/** | |
* Error thrown when function plugin is invalid. | |
* | |
* @see [[registerFunction]] | |
* @see [[registerFunctionPlugin]] | |
* @see [[buildFromArray]] | |
* @see [[buildFromSheets]] | |
* */ | |
var FunctionPluginValidationError = /*#__PURE__*/function (_Error26) { | |
_inherits(FunctionPluginValidationError, _Error26); | |
var _super26 = _createSuper(FunctionPluginValidationError); | |
function FunctionPluginValidationError() { | |
_classCallCheck(this, FunctionPluginValidationError); | |
return _super26.apply(this, arguments); | |
} | |
_createClass(FunctionPluginValidationError, null, [{ | |
key: "functionNotDeclaredInPlugin", | |
value: function functionNotDeclaredInPlugin(functionId, pluginName) { | |
return new FunctionPluginValidationError("Function with id ".concat(functionId, " not declared in plugin ").concat(pluginName)); | |
} | |
}, { | |
key: "functionMethodNotFound", | |
value: function functionMethodNotFound(functionName, pluginName) { | |
return new FunctionPluginValidationError("Function method ".concat(functionName, " not found in plugin ").concat(pluginName)); | |
} | |
}]); | |
return FunctionPluginValidationError; | |
}( /*#__PURE__*/_wrapNativeSuper(Error)); | |
/** | |
* Error thrown when trying to register, override or remove function with reserved id. | |
* | |
* @see [[registerFunctionPlugin]] | |
* @see [[registerFunction]] | |
* @see [[unregisterFunction]] | |
* */ | |
var ProtectedFunctionError = /*#__PURE__*/function (_Error27) { | |
_inherits(ProtectedFunctionError, _Error27); | |
var _super27 = _createSuper(ProtectedFunctionError); | |
function ProtectedFunctionError() { | |
_classCallCheck(this, ProtectedFunctionError); | |
return _super27.apply(this, arguments); | |
} | |
_createClass(ProtectedFunctionError, null, [{ | |
key: "cannotRegisterFunctionWithId", | |
value: function cannotRegisterFunctionWithId(functionId) { | |
return new ProtectedFunctionError("Cannot register function with id ".concat(functionId)); | |
} | |
}, { | |
key: "cannotUnregisterFunctionWithId", | |
value: function cannotUnregisterFunctionWithId(functionId) { | |
return new ProtectedFunctionError("Cannot unregister function with id ".concat(functionId)); | |
} | |
}, { | |
key: "cannotUnregisterProtectedPlugin", | |
value: function cannotUnregisterProtectedPlugin() { | |
return new ProtectedFunctionError('Cannot unregister protected plugin'); | |
} | |
}]); | |
return ProtectedFunctionError; | |
}( /*#__PURE__*/_wrapNativeSuper(Error)); | |
/** | |
* Error thrown when selected source location has an array. | |
*/ | |
var SourceLocationHasArrayError = /*#__PURE__*/function (_Error28) { | |
_inherits(SourceLocationHasArrayError, _Error28); | |
var _super28 = _createSuper(SourceLocationHasArrayError); | |
function SourceLocationHasArrayError() { | |
_classCallCheck(this, SourceLocationHasArrayError); | |
return _super28.call(this, 'Cannot perform this operation, source location has an array inside.'); | |
} | |
return _createClass(SourceLocationHasArrayError); | |
}( /*#__PURE__*/_wrapNativeSuper(Error)); | |
/** | |
* Error thrown when selected target location has an array. | |
* | |
* @see [[addRows]] | |
* @see [[addColumns]] | |
* @see [[moveCells]] | |
* @see [[moveRows]] | |
* @see [[moveColumns]] | |
* @see [[paste]] | |
*/ | |
var TargetLocationHasArrayError = /*#__PURE__*/function (_Error29) { | |
_inherits(TargetLocationHasArrayError, _Error29); | |
var _super29 = _createSuper(TargetLocationHasArrayError); | |
function TargetLocationHasArrayError() { | |
_classCallCheck(this, TargetLocationHasArrayError); | |
return _super29.call(this, 'Cannot perform this operation, target location has an array inside.'); | |
} | |
return _createClass(TargetLocationHasArrayError); | |
}( /*#__PURE__*/_wrapNativeSuper(Error)); | |
/** | |
* Error thrown when named expression contains relative addresses. | |
* | |
* @see [[addNamedExpression]] | |
* @see [[changeNamedExpression]] | |
* */ | |
var NoRelativeAddressesAllowedError = /*#__PURE__*/function (_Error30) { | |
_inherits(NoRelativeAddressesAllowedError, _Error30); | |
var _super30 = _createSuper(NoRelativeAddressesAllowedError); | |
function NoRelativeAddressesAllowedError() { | |
_classCallCheck(this, NoRelativeAddressesAllowedError); | |
return _super30.call(this, 'Relative addresses not allowed in named expressions.'); | |
} | |
return _createClass(NoRelativeAddressesAllowedError); | |
}( /*#__PURE__*/_wrapNativeSuper(Error)); | |
/** | |
* Error thrown when alias to a function is already defined. | |
* | |
* @see [[registerFunctionPlugin]] | |
* @see [[registerFunction]] | |
*/ | |
var AliasAlreadyExisting = /*#__PURE__*/function (_Error31) { | |
_inherits(AliasAlreadyExisting, _Error31); | |
var _super31 = _createSuper(AliasAlreadyExisting); | |
function AliasAlreadyExisting(name, pluginName) { | |
_classCallCheck(this, AliasAlreadyExisting); | |
return _super31.call(this, "Alias id ".concat(name, " in plugin ").concat(pluginName, " already defined as a function or alias.")); | |
} | |
return _createClass(AliasAlreadyExisting); | |
}( /*#__PURE__*/_wrapNativeSuper(Error)); | |
/***/ }), | |
/* 42 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var $ = __webpack_require__(31); | |
var $includes = __webpack_require__(240).includes; | |
var addToUnscopables = __webpack_require__(175); | |
// `Array.prototype.includes` method | |
// https://tc39.es/ecma262/#sec-array.prototype.includes | |
$({ target: 'Array', proto: true }, { | |
includes: function includes(el /* , fromIndex = 0 */) { | |
return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined); | |
} | |
}); | |
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables | |
addToUnscopables('includes'); | |
/***/ }), | |
/* 43 */ | |
/***/ (function(module, exports) { | |
module.exports = function (exec) { | |
try { | |
return !!exec(); | |
} catch (error) { | |
return true; | |
} | |
}; | |
/***/ }), | |
/* 44 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var arrayWithoutHoles = __webpack_require__(724); | |
var iterableToArray = __webpack_require__(432); | |
var unsupportedIterableToArray = __webpack_require__(296); | |
var nonIterableSpread = __webpack_require__(725); | |
function _toConsumableArray(arr) { | |
return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread(); | |
} | |
module.exports = _toConsumableArray, module.exports.__esModule = true, module.exports["default"] = module.exports; | |
/***/ }), | |
/* 45 */ | |
/***/ (function(module, exports) { | |
function _defineProperty(obj, key, value) { | |
if (key in obj) { | |
Object.defineProperty(obj, key, { | |
value: value, | |
enumerable: true, | |
configurable: true, | |
writable: true | |
}); | |
} else { | |
obj[key] = value; | |
} | |
return obj; | |
} | |
module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports; | |
/***/ }), | |
/* 46 */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ErrorMessage", function() { return ErrorMessage; }); | |
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | |
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | |
/** | |
* @license | |
* Copyright (c) 2021 Handsoncode. All rights reserved. | |
*/ | |
/** | |
* This is a class for detailed error messages across HyperFormula. | |
*/ | |
var ErrorMessage = /*#__PURE__*/_createClass(function ErrorMessage() { | |
_classCallCheck(this, ErrorMessage); | |
}); | |
ErrorMessage.DistinctSigns = 'Distinct signs.'; | |
ErrorMessage.WrongArgNumber = 'Wrong number of arguments.'; | |
ErrorMessage.EmptyArg = 'Empty function argument.'; | |
ErrorMessage.EmptyArray = 'Empty array not allowed.'; | |
ErrorMessage.ArrayDimensions = 'Array dimensions are not compatible.'; | |
ErrorMessage.NoSpaceForArrayResult = 'No space for array result.'; | |
ErrorMessage.ValueSmall = 'Value too small.'; | |
ErrorMessage.ValueLarge = 'Value too large.'; | |
ErrorMessage.BadCriterion = 'Incorrect criterion.'; | |
ErrorMessage.RangeManySheets = 'Range spans more than one sheet.'; | |
ErrorMessage.CellRangeExpected = 'Cell range expected.'; | |
ErrorMessage.WrongDimension = 'Wrong range dimension.'; | |
ErrorMessage.ScalarExpected = 'Cell range not allowed.'; | |
ErrorMessage.NumberCoercion = 'Value cannot be coerced to number.'; | |
ErrorMessage.NumberExpected = 'Number argument expected.'; | |
ErrorMessage.IntegerExpected = 'Value needs to be an integer.'; | |
ErrorMessage.BadMode = 'Mode not recognized.'; | |
ErrorMessage.DateBounds = 'Date outside of bounds.'; | |
ErrorMessage.OutOfSheet = 'Resulting reference is out of the sheet.'; | |
ErrorMessage.WrongType = 'Wrong type of argument.'; | |
ErrorMessage.NaN = 'NaN or infinite value encountered.'; | |
ErrorMessage.EqualLength = 'Ranges need to be of equal length.'; | |
ErrorMessage.Negative = 'Value cannot be negative.'; | |
ErrorMessage.NotBinary = 'String does not represent a binary number.'; | |
ErrorMessage.NotOctal = 'String does not represent an octal number.'; | |
ErrorMessage.NotHex = 'String does not represent a hexadecimal number.'; | |
ErrorMessage.EndStartPeriod = 'End period needs to be at least start period.'; | |
ErrorMessage.CellRefExpected = 'Cell reference expected.'; | |
ErrorMessage.EmptyRange = 'Empty range not allowed.'; | |
ErrorMessage.BadRef = 'Address is not correct.'; | |
ErrorMessage.NumberRange = 'Number-only range expected.'; | |
ErrorMessage.ValueNotFound = 'Value not found.'; | |
ErrorMessage.ValueBaseLarge = 'Value in base too large.'; | |
ErrorMessage.ValueBaseSmall = 'Value in base too small.'; | |
ErrorMessage.ValueBaseLong = 'Value in base too long.'; | |
ErrorMessage.NegativeLength = 'Length cannot be negative.'; | |
ErrorMessage.PatternNotFound = 'Pattern not found.'; | |
ErrorMessage.OneValue = 'Needs at least one value.'; | |
ErrorMessage.TwoValues = 'Range needs to contain at least two elements.'; | |
ErrorMessage.ThreeValues = 'Range needs to contain at least three elements.'; | |
ErrorMessage.IndexBounds = 'Index out of bounds.'; | |
ErrorMessage.IndexLarge = 'Index too large.'; | |
ErrorMessage.Formula = 'Expected formula.'; | |
ErrorMessage.NegativeCount = 'Count cannot be negative.'; | |
ErrorMessage.ParseError = 'Parsing error.'; | |
ErrorMessage.SheetRef = 'Sheet does not exist.'; | |
ErrorMessage.PeriodLong = 'Period number cannot exceed life length.'; | |
ErrorMessage.InvalidDate = 'Invalid date.'; | |
ErrorMessage.BitshiftLong = 'Result of bitshift is too long.'; | |
ErrorMessage.EmptyString = 'Empty-string argument not allowed.'; | |
ErrorMessage.LengthBounds = 'Length out of bounds.'; | |
ErrorMessage.NegativeTime = 'Time cannot be negative.'; | |
ErrorMessage.NoDefault = 'No default option.'; | |
ErrorMessage.Selector = 'Selector cannot exceed the number of arguments.'; | |
ErrorMessage.StartEndDate = 'Start date needs to be earlier than end date.'; | |
ErrorMessage.IncorrectDateTime = 'String does not represent correct DateTime.'; | |
ErrorMessage.CharacterCodeBounds = 'Character code out of bounds.'; | |
ErrorMessage.NonZero = 'Argument cannot be 0.'; | |
ErrorMessage.LessThanOne = 'Argument cannot be less than 1.'; | |
ErrorMessage.WeekendString = 'Incorrect weekend bitmask string.'; | |
ErrorMessage.InvalidRoman = 'Invalid roman numeral.'; | |
ErrorMessage.WrongOrder = 'Wrong order of values.'; | |
ErrorMessage.ComplexNumberExpected = 'Complex number expected.'; | |
ErrorMessage.ShouldBeIorJ = 'Should be \'i\' or \'j\'.'; | |
ErrorMessage.SizeMismatch = 'Array dimensions mismatched.'; | |
ErrorMessage.FunctionName = function (arg) { | |
return "Function name ".concat(arg, " not recognized."); | |
}; | |
ErrorMessage.NamedExpressionName = function (arg) { | |
return "Named expression ".concat(arg, " not recognized."); | |
}; | |
ErrorMessage.LicenseKey = function (arg) { | |
return "License key is ".concat(arg, "."); | |
}; | |
/***/ }), | |
/* 47 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var _interopRequireDefault = __webpack_require__(1); | |
exports.__esModule = true; | |
exports.isNumeric = isNumeric; | |
exports.isNumericLike = isNumericLike; | |
exports.rangeEach = rangeEach; | |
exports.rangeEachReverse = rangeEachReverse; | |
exports.valueAccordingPercent = valueAccordingPercent; | |
__webpack_require__(13); | |
__webpack_require__(75); | |
__webpack_require__(38); | |
__webpack_require__(23); | |
__webpack_require__(2); | |
__webpack_require__(3); | |
__webpack_require__(0); | |
__webpack_require__(58); | |
__webpack_require__(4); | |
__webpack_require__(21); | |
__webpack_require__(95); | |
__webpack_require__(67); | |
__webpack_require__(107); | |
__webpack_require__(64); | |
var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(44)); | |
var _typeof2 = _interopRequireDefault(__webpack_require__(22)); | |
/* eslint-disable jsdoc/require-description-complete-sentence */ | |
/** | |
* Checks if the passed value is numeric one. For example these values (passed as string or number) | |
* are considered as numeric values: | |
* - 0.001 | |
* - .001 | |
* - - 10000 | |
* - 10000 | |
* - 1e+26 | |
* - 22e-26 | |
* - .45e+26 | |
* - 0xabcdef (hex) | |
* - 0x1 (hex) | |
* | |
* @param {*} value The value to check. | |
* @param {string[]} additionalDelimiters An additional delimiters to be used while checking the numeric value. | |
* @returns {boolean} | |
*/ | |
function isNumeric(value) { | |
var additionalDelimiters = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; | |
var type = (0, _typeof2.default)(value); | |
if (type === 'number') { | |
return !isNaN(value) && isFinite(value); | |
} else if (type === 'string') { | |
if (value.length === 0) { | |
return false; | |
} else if (value.length === 1) { | |
return /\d/.test(value); | |
} | |
var delimiter = Array.from(new Set(['.'].concat((0, _toConsumableArray2.default)(additionalDelimiters)))).map(function (d) { | |
return "\\".concat(d); | |
}).join('|'); | |
return new RegExp("^[+-]?\\s*(((".concat(delimiter, ")?\\d+((").concat(delimiter, ")\\d+)?(e[+-]?\\d+)?)|(0x[a-f\\d]+))$"), 'i').test(value.trim()); | |
} else if (type === 'object') { | |
return !!value && typeof value.valueOf() === 'number' && !(value instanceof Date); | |
} | |
return false; | |
} | |
/* eslint-enable jsdoc/require-description-complete-sentence */ | |
/** | |
* Checks if the passed value is numeric-like value. The helper returns `true` for the same | |
* values as for the `isNumeric` function plus `true` for numbers delimited by comma. | |
* | |
* @param {*} value The value to check. | |
* @returns {boolean} | |
*/ | |
function isNumericLike(value) { | |
return isNumeric(value, [',']); | |
} | |
/** | |
* A specialized version of `.forEach` defined by ranges. | |
* | |
* @param {number} rangeFrom The number from start iterate. | |
* @param {number|Function} rangeTo The number where finish iterate or function as a iteratee. | |
* @param {Function} [iteratee] The function invoked per iteration. | |
*/ | |
function rangeEach(rangeFrom, rangeTo, iteratee) { | |
var index = -1; | |
if (typeof rangeTo === 'function') { | |
iteratee = rangeTo; | |
rangeTo = rangeFrom; | |
} else { | |
index = rangeFrom - 1; | |
} | |
/* eslint-disable-next-line no-plusplus */ | |
while (++index <= rangeTo) { | |
if (iteratee(index) === false) { | |
break; | |
} | |
} | |
} | |
/** | |
* A specialized version of `.forEach` defined by ranges iterable in reverse order. | |
* | |
* @param {number} rangeFrom The number from start iterate. | |
* @param {number|Function} rangeTo The number where finish iterate or function as a iteratee. | |
* @param {Function} [iteratee] The function invoked per iteration. | |
*/ | |
function rangeEachReverse(rangeFrom, rangeTo, iteratee) { | |
var index = rangeFrom + 1; | |
if (typeof rangeTo === 'function') { | |
iteratee = rangeTo; | |
rangeTo = 0; | |
} | |
/* eslint-disable-next-line no-plusplus */ | |
while (--index >= rangeTo) { | |
if (iteratee(index) === false) { | |
break; | |
} | |
} | |
} | |
/** | |
* Calculate value from percent. | |
* | |
* @param {number} value Base value from percent will be calculated. | |
* @param {string|number} percent Can be number or string (eq. `'33%'`). | |
* @returns {number} | |
*/ | |
function valueAccordingPercent(value, percent) { | |
percent = parseInt(percent.toString().replace('%', ''), 10); | |
percent = isNaN(percent) ? 0 : percent; | |
return parseInt(value * percent / 100, 10); | |
} | |
/***/ }), | |
/* 48 */ | |
/***/ (function(module, exports) { | |
function _assertThisInitialized(self) { | |
if (self === void 0) { | |
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); | |
} | |
return self; | |
} | |
module.exports = _assertThisInitialized, module.exports.__esModule = true, module.exports["default"] = module.exports; | |
/***/ }), | |
/* 49 */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isEmpty", function() { return isEmpty; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "keys", function() { return keys; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "values", function() { return values; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mapValues", function() { return mapValues; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "map", function() { return map; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "flatten", function() { return flatten; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "first", function() { return first; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "last", function() { return last; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "forEach", function() { return forEach; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isString", function() { return isString; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isUndefined", function() { return isUndefined; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isFunction", function() { return isFunction; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drop", function() { return drop; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "dropRight", function() { return dropRight; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "filter", function() { return filter; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "reject", function() { return reject; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "pick", function() { return pick; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "has", function() { return has; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "contains", function() { return contains; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "cloneArr", function() { return cloneArr; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "cloneObj", function() { return cloneObj; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "find", function() { return find; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "findAll", function() { return findAll; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "reduce", function() { return reduce; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "compact", function() { return compact; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "uniq", function() { return uniq; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "partial", function() { return partial; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isArray", function() { return isArray; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isRegExp", function() { return isRegExp; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isObject", function() { return isObject; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "every", function() { return every; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "difference", function() { return difference; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "some", function() { return some; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "indexOf", function() { return indexOf; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sortBy", function() { return sortBy; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "zipObject", function() { return zipObject; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "assign", function() { return assign; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "assignNoOverwrite", function() { return assignNoOverwrite; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "defaults", function() { return defaults; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "groupBy", function() { return groupBy; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "merge", function() { return merge; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NOOP", function() { return NOOP; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IDENTITY", function() { return IDENTITY; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "packArray", function() { return packArray; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PRINT_ERROR", function() { return PRINT_ERROR; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PRINT_WARNING", function() { return PRINT_WARNING; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isES2015MapSupported", function() { return isES2015MapSupported; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "applyMixins", function() { return applyMixins; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toFastProperties", function() { return toFastProperties; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "peek", function() { return peek; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "timer", function() { return timer; }); | |
/* | |
Utils using lodash style API. (not necessarily 100% compliant) for functional and other utils. | |
These utils should replace usage of lodash in the production code base. not because they are any better... | |
but for the purpose of being a dependency free library. | |
The hotspots in the code are already written in imperative style for performance reasons. | |
so writing several dozen utils which may be slower than the original lodash, does not matter as much | |
considering they will not be invoked in hotspots... | |
*/ | |
function isEmpty(arr) { | |
return arr && arr.length === 0; | |
} | |
function keys(obj) { | |
if (obj === undefined || obj === null) { | |
return []; | |
} | |
return Object.keys(obj); | |
} | |
function values(obj) { | |
var vals = []; | |
var keys = Object.keys(obj); | |
for (var i = 0; i < keys.length; i++) { | |
vals.push(obj[keys[i]]); | |
} | |
return vals; | |
} | |
function mapValues(obj, callback) { | |
var result = []; | |
var objKeys = keys(obj); | |
for (var idx = 0; idx < objKeys.length; idx++) { | |
var currKey = objKeys[idx]; | |
result.push(callback.call(null, obj[currKey], currKey)); | |
} | |
return result; | |
} | |
function map(arr, callback) { | |
var result = []; | |
for (var idx = 0; idx < arr.length; idx++) { | |
result.push(callback.call(null, arr[idx], idx)); | |
} | |
return result; | |
} | |
function flatten(arr) { | |
var result = []; | |
for (var idx = 0; idx < arr.length; idx++) { | |
var currItem = arr[idx]; | |
if (Array.isArray(currItem)) { | |
result = result.concat(flatten(currItem)); | |
} | |
else { | |
result.push(currItem); | |
} | |
} | |
return result; | |
} | |
function first(arr) { | |
return isEmpty(arr) ? undefined : arr[0]; | |
} | |
function last(arr) { | |
var len = arr && arr.length; | |
return len ? arr[len - 1] : undefined; | |
} | |
function forEach(collection, iteratorCallback) { | |
/* istanbul ignore else */ | |
if (Array.isArray(collection)) { | |
for (var i = 0; i < collection.length; i++) { | |
iteratorCallback.call(null, collection[i], i); | |
} | |
} | |
else if (isObject(collection)) { | |
var colKeys = keys(collection); | |
for (var i = 0; i < colKeys.length; i++) { | |
var key = colKeys[i]; | |
var value = collection[key]; | |
iteratorCallback.call(null, value, key); | |
} | |
} | |
else { | |
throw Error("non exhaustive match"); | |
} | |
} | |
function isString(item) { | |
return typeof item === "string"; | |
} | |
function isUndefined(item) { | |
return item === undefined; | |
} | |
function isFunction(item) { | |
return item instanceof Function; | |
} | |
function drop(arr, howMuch) { | |
if (howMuch === void 0) { howMuch = 1; } | |
return arr.slice(howMuch, arr.length); | |
} | |
function dropRight(arr, howMuch) { | |
if (howMuch === void 0) { howMuch = 1; } | |
return arr.slice(0, arr.length - howMuch); | |
} | |
function filter(arr, predicate) { | |
var result = []; | |
if (Array.isArray(arr)) { | |
for (var i = 0; i < arr.length; i++) { | |
var item = arr[i]; | |
if (predicate.call(null, item)) { | |
result.push(item); | |
} | |
} | |
} | |
return result; | |
} | |
function reject(arr, predicate) { | |
return filter(arr, function (item) { return !predicate(item); }); | |
} | |
function pick(obj, predicate) { | |
var keys = Object.keys(obj); | |
var result = {}; | |
for (var i = 0; i < keys.length; i++) { | |
var currKey = keys[i]; | |
var currItem = obj[currKey]; | |
if (predicate(currItem)) { | |
result[currKey] = currItem; | |
} | |
} | |
return result; | |
} | |
function has(obj, prop) { | |
if (isObject(obj)) { | |
return obj.hasOwnProperty(prop); | |
} | |
return false; | |
} | |
function contains(arr, item) { | |
return find(arr, function (currItem) { return currItem === item; }) !== undefined ? true : false; | |
} | |
/** | |
* shallow clone | |
*/ | |
function cloneArr(arr) { | |
var newArr = []; | |
for (var i = 0; i < arr.length; i++) { | |
newArr.push(arr[i]); | |
} | |
return newArr; | |
} | |
/** | |
* shallow clone | |
*/ | |
function cloneObj(obj) { | |
var clonedObj = {}; | |
for (var key in obj) { | |
/* istanbul ignore else */ | |
if (Object.prototype.hasOwnProperty.call(obj, key)) { | |
clonedObj[key] = obj[key]; | |
} | |
} | |
return clonedObj; | |
} | |
function find(arr, predicate) { | |
for (var i = 0; i < arr.length; i++) { | |
var item = arr[i]; | |
if (predicate.call(null, item)) { | |
return item; | |
} | |
} | |
return undefined; | |
} | |
function findAll(arr, predicate) { | |
var found = []; | |
for (var i = 0; i < arr.length; i++) { | |
var item = arr[i]; | |
if (predicate.call(null, item)) { | |
found.push(item); | |
} | |
} | |
return found; | |
} | |
function reduce(arrOrObj, iterator, initial) { | |
var isArr = Array.isArray(arrOrObj); | |
var vals = isArr ? arrOrObj : values(arrOrObj); | |
var objKeys = isArr ? [] : keys(arrOrObj); | |
var accumulator = initial; | |
for (var i = 0; i < vals.length; i++) { | |
accumulator = iterator.call(null, accumulator, vals[i], isArr ? i : objKeys[i]); | |
} | |
return accumulator; | |
} | |
function compact(arr) { | |
return reject(arr, function (item) { return item === null || item === undefined; }); | |
} | |
function uniq(arr, identity) { | |
if (identity === void 0) { identity = function (item) { return item; }; } | |
var identities = []; | |
return reduce(arr, function (result, currItem) { | |
var currIdentity = identity(currItem); | |
if (contains(identities, currIdentity)) { | |
return result; | |
} | |
else { | |
identities.push(currIdentity); | |
return result.concat(currItem); | |
} | |
}, []); | |
} | |
function partial(func) { | |
var restArgs = []; | |
for (var _i = 1; _i < arguments.length; _i++) { | |
restArgs[_i - 1] = arguments[_i]; | |
} | |
var firstArg = [null]; | |
var allArgs = firstArg.concat(restArgs); | |
return Function.bind.apply(func, allArgs); | |
} | |
function isArray(obj) { | |
return Array.isArray(obj); | |
} | |
function isRegExp(obj) { | |
return obj instanceof RegExp; | |
} | |
function isObject(obj) { | |
return obj instanceof Object; | |
} | |
function every(arr, predicate) { | |
for (var i = 0; i < arr.length; i++) { | |
if (!predicate(arr[i], i)) { | |
return false; | |
} | |
} | |
return true; | |
} | |
function difference(arr, values) { | |
return reject(arr, function (item) { return contains(values, item); }); | |
} | |
function some(arr, predicate) { | |
for (var i = 0; i < arr.length; i++) { | |
if (predicate(arr[i])) { | |
return true; | |
} | |
} | |
return false; | |
} | |
function indexOf(arr, value) { | |
for (var i = 0; i < arr.length; i++) { | |
if (arr[i] === value) { | |
return i; | |
} | |
} | |
return -1; | |
} | |
function sortBy(arr, orderFunc) { | |
var result = cloneArr(arr); | |
result.sort(function (a, b) { return orderFunc(a) - orderFunc(b); }); | |
return result; | |
} | |
function zipObject(keys, values) { | |
if (keys.length !== values.length) { | |
throw Error("can't zipObject with different number of keys and values!"); | |
} | |
var result = {}; | |
for (var i = 0; i < keys.length; i++) { | |
result[keys[i]] = values[i]; | |
} | |
return result; | |
} | |
/** | |
* mutates! (and returns) target | |
*/ | |
function assign(target) { | |
var sources = []; | |
for (var _i = 1; _i < arguments.length; _i++) { | |
sources[_i - 1] = arguments[_i]; | |
} | |
for (var i = 0; i < sources.length; i++) { | |
var curSource = sources[i]; | |
var currSourceKeys = keys(curSource); | |
for (var j = 0; j < currSourceKeys.length; j++) { | |
var currKey = currSourceKeys[j]; | |
target[currKey] = curSource[currKey]; | |
} | |
} | |
return target; | |
} | |
/** | |
* mutates! (and returns) target | |
*/ | |
function assignNoOverwrite(target) { | |
var sources = []; | |
for (var _i = 1; _i < arguments.length; _i++) { | |
sources[_i - 1] = arguments[_i]; | |
} | |
for (var i = 0; i < sources.length; i++) { | |
var curSource = sources[i]; | |
if (isUndefined(curSource)) { | |
continue; | |
} | |
var currSourceKeys = keys(curSource); | |
for (var j = 0; j < currSourceKeys.length; j++) { | |
var currKey = currSourceKeys[j]; | |
if (!has(target, currKey)) { | |
target[currKey] = curSource[currKey]; | |
} | |
} | |
} | |
return target; | |
} | |
function defaults() { | |
var sources = []; | |
for (var _i = 0; _i < arguments.length; _i++) { | |
sources[_i] = arguments[_i]; | |
} | |
return assignNoOverwrite.apply(null, [{}].concat(sources)); | |
} | |
function groupBy(arr, groupKeyFunc) { | |
var result = {}; | |
forEach(arr, function (item) { | |
var currGroupKey = groupKeyFunc(item); | |
var currGroupArr = result[currGroupKey]; | |
if (currGroupArr) { | |
currGroupArr.push(item); | |
} | |
else { | |
result[currGroupKey] = [item]; | |
} | |
}); | |
return result; | |
} | |
/** | |
* Merge obj2 into obj1. | |
* Will overwrite existing properties with the same name | |
*/ | |
function merge(obj1, obj2) { | |
var result = cloneObj(obj1); | |
var keys2 = keys(obj2); | |
for (var i = 0; i < keys2.length; i++) { | |
var key = keys2[i]; | |
var value = obj2[key]; | |
result[key] = value; | |
} | |
return result; | |
} | |
function NOOP() { } | |
function IDENTITY(item) { | |
return item; | |
} | |
/** | |
* Will return a new packed array with same values. | |
*/ | |
function packArray(holeyArr) { | |
var result = []; | |
for (var i = 0; i < holeyArr.length; i++) { | |
var orgValue = holeyArr[i]; | |
result.push(orgValue !== undefined ? orgValue : undefined); | |
} | |
return result; | |
} | |
function PRINT_ERROR(msg) { | |
/* istanbul ignore else - can't override global.console in node.js */ | |
if (console && console.error) { | |
console.error("Error: " + msg); | |
} | |
} | |
function PRINT_WARNING(msg) { | |
/* istanbul ignore else - can't override global.console in node.js*/ | |
if (console && console.warn) { | |
// TODO: modify docs accordingly | |
console.warn("Warning: " + msg); | |
} | |
} | |
function isES2015MapSupported() { | |
return typeof Map === "function"; | |
} | |
function applyMixins(derivedCtor, baseCtors) { | |
baseCtors.forEach(function (baseCtor) { | |
var baseProto = baseCtor.prototype; | |
Object.getOwnPropertyNames(baseProto).forEach(function (propName) { | |
if (propName === "constructor") { | |
return; | |
} | |
var basePropDescriptor = Object.getOwnPropertyDescriptor(baseProto, propName); | |
// Handle Accessors | |
if (basePropDescriptor && | |
(basePropDescriptor.get || basePropDescriptor.set)) { | |
Object.defineProperty(derivedCtor.prototype, propName, basePropDescriptor); | |
} | |
else { | |
derivedCtor.prototype[propName] = baseCtor.prototype[propName]; | |
} | |
}); | |
}); | |
} | |
// base on: https://github.com/petkaantonov/bluebird/blob/b97c0d2d487e8c5076e8bd897e0dcd4622d31846/src/util.js#L201-L216 | |
function toFastProperties(toBecomeFast) { | |
function FakeConstructor() { } | |
// If our object is used as a constructor it would receive | |
FakeConstructor.prototype = toBecomeFast; | |
var fakeInstance = new FakeConstructor(); | |
function fakeAccess() { | |
return typeof fakeInstance.bar; | |
} | |
// help V8 understand this is a "real" prototype by actually using | |
// the fake instance. | |
fakeAccess(); | |
fakeAccess(); | |
return toBecomeFast; | |
// Eval prevents optimization of this method (even though this is dead code) | |
/* istanbul ignore next */ | |
// tslint:disable-next-line | |
eval(toBecomeFast); | |
} | |
function peek(arr) { | |
return arr[arr.length - 1]; | |
} | |
/* istanbul ignore next - for performance tracing*/ | |
function timer(func) { | |
var start = new Date().getTime(); | |
var val = func(); | |
var end = new Date().getTime(); | |
var total = end - start; | |
return { time: total, value: val }; | |
} | |
//# sourceMappingURL=utils.js.map | |
/***/ }), | |
/* 50 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
exports.__esModule = true; | |
exports.PLUGIN_KEY = exports.BasePlugin = void 0; | |
var _base = __webpack_require__(865); | |
exports.PLUGIN_KEY = _base.PLUGIN_KEY; | |
exports.BasePlugin = _base.BasePlugin; | |
/***/ }), | |
/* 51 */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EmptyValue", function() { return EmptyValue; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getRawValue", function() { return getRawValue; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RichNumber", function() { return RichNumber; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "cloneNumber", function() { return cloneNumber; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DateNumber", function() { return DateNumber; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CurrencyNumber", function() { return CurrencyNumber; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TimeNumber", function() { return TimeNumber; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DateTimeNumber", function() { return DateTimeNumber; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PercentNumber", function() { return PercentNumber; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isExtendedNumber", function() { return isExtendedNumber; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NumberType", function() { return NumberType; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTypeOfExtendedNumber", function() { return getTypeOfExtendedNumber; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getFormatOfExtendedNumber", function() { return getFormatOfExtendedNumber; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTypeFormatOfExtendedNumber", function() { return getTypeFormatOfExtendedNumber; }); | |
/* harmony import */ var core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9); | |
/* harmony import */ var core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_0__); | |
/* harmony import */ var core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(10); | |
/* harmony import */ var core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_1__); | |
/* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(0); | |
/* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_2__); | |
/* harmony import */ var core_js_modules_es_object_get_prototype_of_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(27); | |
/* harmony import */ var core_js_modules_es_object_get_prototype_of_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_get_prototype_of_js__WEBPACK_IMPORTED_MODULE_3__); | |
/* harmony import */ var core_js_modules_es_reflect_construct_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(7); | |
/* harmony import */ var core_js_modules_es_reflect_construct_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_reflect_construct_js__WEBPACK_IMPORTED_MODULE_4__); | |
/* harmony import */ var core_js_modules_es_symbol_iterator_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(11); | |
/* harmony import */ var core_js_modules_es_symbol_iterator_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_symbol_iterator_js__WEBPACK_IMPORTED_MODULE_5__); | |
/* harmony import */ var core_js_modules_es_array_iterator_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(3); | |
/* harmony import */ var core_js_modules_es_array_iterator_js__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_iterator_js__WEBPACK_IMPORTED_MODULE_6__); | |
/* harmony import */ var core_js_modules_es_string_iterator_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(2); | |
/* harmony import */ var core_js_modules_es_string_iterator_js__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_string_iterator_js__WEBPACK_IMPORTED_MODULE_7__); | |
/* harmony import */ var core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(4); | |
/* harmony import */ var core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_8__); | |
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | |
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } | |
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | |
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | |
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } | |
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | |
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | |
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | |
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | |
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | |
/** | |
* @license | |
* Copyright (c) 2021 Handsoncode. All rights reserved. | |
*/ | |
var EmptyValue = Symbol('Empty value'); | |
function getRawValue(num) { | |
if (num instanceof RichNumber) { | |
return num.val; | |
} else { | |
return num; | |
} | |
} | |
var RichNumber = /*#__PURE__*/function () { | |
function RichNumber(val, format) { | |
_classCallCheck(this, RichNumber); | |
this.val = val; | |
this.format = format; | |
} | |
_createClass(RichNumber, [{ | |
key: "fromNumber", | |
value: function fromNumber(val) { | |
return new this.constructor(val); | |
} | |
}]); | |
return RichNumber; | |
}(); | |
function cloneNumber(val, newVal) { | |
if (typeof val === 'number') { | |
return newVal; | |
} else { | |
var ret = val.fromNumber(newVal); | |
ret.format = val.format; | |
return ret; | |
} | |
} | |
var DateNumber = /*#__PURE__*/function (_RichNumber) { | |
_inherits(DateNumber, _RichNumber); | |
var _super = _createSuper(DateNumber); | |
function DateNumber() { | |
_classCallCheck(this, DateNumber); | |
return _super.apply(this, arguments); | |
} | |
_createClass(DateNumber, [{ | |
key: "getDetailedType", | |
value: function getDetailedType() { | |
return NumberType.NUMBER_DATE; | |
} | |
}]); | |
return DateNumber; | |
}(RichNumber); | |
var CurrencyNumber = /*#__PURE__*/function (_RichNumber2) { | |
_inherits(CurrencyNumber, _RichNumber2); | |
var _super2 = _createSuper(CurrencyNumber); | |
function CurrencyNumber() { | |
_classCallCheck(this, CurrencyNumber); | |
return _super2.apply(this, arguments); | |
} | |
_createClass(CurrencyNumber, [{ | |
key: "getDetailedType", | |
value: function getDetailedType() { | |
return NumberType.NUMBER_CURRENCY; | |
} | |
}]); | |
return CurrencyNumber; | |
}(RichNumber); | |
var TimeNumber = /*#__PURE__*/function (_RichNumber3) { | |
_inherits(TimeNumber, _RichNumber3); | |
var _super3 = _createSuper(TimeNumber); | |
function TimeNumber() { | |
_classCallCheck(this, TimeNumber); | |
return _super3.apply(this, arguments); | |
} | |
_createClass(TimeNumber, [{ | |
key: "getDetailedType", | |
value: function getDetailedType() { | |
return NumberType.NUMBER_TIME; | |
} | |
}]); | |
return TimeNumber; | |
}(RichNumber); | |
var DateTimeNumber = /*#__PURE__*/function (_RichNumber4) { | |
_inherits(DateTimeNumber, _RichNumber4); | |
var _super4 = _createSuper(DateTimeNumber); | |
function DateTimeNumber() { | |
_classCallCheck(this, DateTimeNumber); | |
return _super4.apply(this, arguments); | |
} | |
_createClass(DateTimeNumber, [{ | |
key: "getDetailedType", | |
value: function getDetailedType() { | |
return NumberType.NUMBER_DATETIME; | |
} | |
}]); | |
return DateTimeNumber; | |
}(RichNumber); | |
var PercentNumber = /*#__PURE__*/function (_RichNumber5) { | |
_inherits(PercentNumber, _RichNumber5); | |
var _super5 = _createSuper(PercentNumber); | |
function PercentNumber() { | |
_classCallCheck(this, PercentNumber); | |
return _super5.apply(this, arguments); | |
} | |
_createClass(PercentNumber, [{ | |
key: "getDetailedType", | |
value: function getDetailedType() { | |
return NumberType.NUMBER_PERCENT; | |
} | |
}]); | |
return PercentNumber; | |
}(RichNumber); | |
function isExtendedNumber(val) { | |
return typeof val === 'number' || val instanceof RichNumber; | |
} | |
var NumberType; | |
(function (NumberType) { | |
NumberType["NUMBER_RAW"] = "NUMBER_RAW"; | |
NumberType["NUMBER_DATE"] = "NUMBER_DATE"; | |
NumberType["NUMBER_TIME"] = "NUMBER_TIME"; | |
NumberType["NUMBER_DATETIME"] = "NUMBER_DATETIME"; | |
NumberType["NUMBER_CURRENCY"] = "NUMBER_CURRENCY"; | |
NumberType["NUMBER_PERCENT"] = "NUMBER_PERCENT"; | |
})(NumberType || (NumberType = {})); | |
function getTypeOfExtendedNumber(num) { | |
if (num instanceof RichNumber) { | |
return num.getDetailedType(); | |
} else { | |
return NumberType.NUMBER_RAW; | |
} | |
} | |
function getFormatOfExtendedNumber(num) { | |
if (num instanceof RichNumber) { | |
return num.format; | |
} else { | |
return undefined; | |
} | |
} | |
function getTypeFormatOfExtendedNumber(num) { | |
if (num instanceof RichNumber) { | |
return { | |
type: num.getDetailedType(), | |
format: num.format | |
}; | |
} else { | |
return { | |
type: NumberType.NUMBER_RAW | |
}; | |
} | |
} | |
/***/ }), | |
/* 52 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var $ = __webpack_require__(31); | |
var uncurryThis = __webpack_require__(37); | |
var notARegExp = __webpack_require__(247); | |
var requireObjectCoercible = __webpack_require__(91); | |
var toString = __webpack_require__(74); | |
var correctIsRegExpLogic = __webpack_require__(249); | |
var stringIndexOf = uncurryThis(''.indexOf); | |
// `String.prototype.includes` method | |
// https://tc39.es/ecma262/#sec-string.prototype.includes | |
$({ target: 'String', proto: true, forced: !correctIsRegExpLogic('includes') }, { | |
includes: function includes(searchString /* , position = 0 */) { | |
return !!~stringIndexOf( | |
toString(requireObjectCoercible(this)), | |
toString(notARegExp(searchString)), | |
arguments.length > 1 ? arguments[1] : undefined | |
); | |
} | |
}); | |
/***/ }), | |
/* 53 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var DESCRIPTORS = __webpack_require__(72); | |
var global = __webpack_require__(30); | |
var uncurryThis = __webpack_require__(37); | |
var isForced = __webpack_require__(207); | |
var redefine = __webpack_require__(103); | |
var hasOwn = __webpack_require__(73); | |
var inheritIfRequired = __webpack_require__(258); | |
var isPrototypeOf = __webpack_require__(121); | |
var isSymbol = __webpack_require__(201); | |
var toPrimitive = __webpack_require__(321); | |
var fails = __webpack_require__(43); | |
var getOwnPropertyNames = __webpack_require__(150).f; | |
var getOwnPropertyDescriptor = __webpack_require__(112).f; | |
var defineProperty = __webpack_require__(86).f; | |
var thisNumberValue = __webpack_require__(350); | |
var trim = __webpack_require__(351).trim; | |
var NUMBER = 'Number'; | |
var NativeNumber = global[NUMBER]; | |
var NumberPrototype = NativeNumber.prototype; | |
var TypeError = global.TypeError; | |
var arraySlice = uncurryThis(''.slice); | |
var charCodeAt = uncurryThis(''.charCodeAt); | |
// `ToNumeric` abstract operation | |
// https://tc39.es/ecma262/#sec-tonumeric | |
var toNumeric = function (value) { | |
var primValue = toPrimitive(value, 'number'); | |
return typeof primValue == 'bigint' ? primValue : toNumber(primValue); | |
}; | |
// `ToNumber` abstract operation | |
// https://tc39.es/ecma262/#sec-tonumber | |
var toNumber = function (argument) { | |
var it = toPrimitive(argument, 'number'); | |
var first, third, radix, maxCode, digits, length, index, code; | |
if (isSymbol(it)) throw TypeError('Cannot convert a Symbol value to a number'); | |
if (typeof it == 'string' && it.length > 2) { | |
it = trim(it); | |
first = charCodeAt(it, 0); | |
if (first === 43 || first === 45) { | |
third = charCodeAt(it, 2); | |
if (third === 88 || third === 120) return NaN; // Number('+0x1') should be NaN, old V8 fix | |
} else if (first === 48) { | |
switch (charCodeAt(it, 1)) { | |
case 66: case 98: radix = 2; maxCode = 49; break; // fast equal of /^0b[01]+$/i | |
case 79: case 111: radix = 8; maxCode = 55; break; // fast equal of /^0o[0-7]+$/i | |
default: return +it; | |
} | |
digits = arraySlice(it, 2); | |
length = digits.length; | |
for (index = 0; index < length; index++) { | |
code = charCodeAt(digits, index); | |
// parseInt parses a string to a first unavailable symbol | |
// but ToNumber should return NaN if a string contains unavailable symbols | |
if (code < 48 || code > maxCode) return NaN; | |
} return parseInt(digits, radix); | |
} | |
} return +it; | |
}; | |
// `Number` constructor | |
// https://tc39.es/ecma262/#sec-number-constructor | |
if (isForced(NUMBER, !NativeNumber(' 0o1') || !NativeNumber('0b1') || NativeNumber('+0x1'))) { | |
var NumberWrapper = function Number(value) { | |
var n = arguments.length < 1 ? 0 : NativeNumber(toNumeric(value)); | |
var dummy = this; | |
// check on 1..constructor(foo) case | |
return isPrototypeOf(NumberPrototype, dummy) && fails(function () { thisNumberValue(dummy); }) | |
? inheritIfRequired(Object(n), dummy, NumberWrapper) : n; | |
}; | |
for (var keys = DESCRIPTORS ? getOwnPropertyNames(NativeNumber) : ( | |
// ES3: | |
'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' + | |
// ES2015 (in case, if modules with ES2015 Number statics required before): | |
'EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,' + | |
// ESNext | |
'fromString,range' | |
).split(','), j = 0, key; keys.length > j; j++) { | |
if (hasOwn(NativeNumber, key = keys[j]) && !hasOwn(NumberWrapper, key)) { | |
defineProperty(NumberWrapper, key, getOwnPropertyDescriptor(NativeNumber, key)); | |
} | |
} | |
NumberWrapper.prototype = NumberPrototype; | |
NumberPrototype.constructor = NumberWrapper; | |
redefine(global, NUMBER, NumberWrapper); | |
} | |
/***/ }), | |
/* 54 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var $ = __webpack_require__(31); | |
var toObject = __webpack_require__(92); | |
var nativeKeys = __webpack_require__(170); | |
var fails = __webpack_require__(43); | |
var FAILS_ON_PRIMITIVES = fails(function () { nativeKeys(1); }); | |
// `Object.keys` method | |
// https://tc39.es/ecma262/#sec-object.keys | |
$({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, { | |
keys: function keys(it) { | |
return nativeKeys(toObject(it)); | |
} | |
}); | |
/***/ }), | |
/* 55 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var $ = __webpack_require__(31); | |
var global = __webpack_require__(30); | |
var toAbsoluteIndex = __webpack_require__(151); | |
var toIntegerOrInfinity = __webpack_require__(123); | |
var lengthOfArrayLike = __webpack_require__(98); | |
var toObject = __webpack_require__(92); | |
var arraySpeciesCreate = __webpack_require__(255); | |
var createProperty = __webpack_require__(152); | |
var arrayMethodHasSpeciesSupport = __webpack_require__(172); | |
var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('splice'); | |
var TypeError = global.TypeError; | |
var max = Math.max; | |
var min = Math.min; | |
var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; | |
var MAXIMUM_ALLOWED_LENGTH_EXCEEDED = 'Maximum allowed length exceeded'; | |
// `Array.prototype.splice` method | |
// https://tc39.es/ecma262/#sec-array.prototype.splice | |
// with adding support of @@species | |
$({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, { | |
splice: function splice(start, deleteCount /* , ...items */) { | |
var O = toObject(this); | |
var len = lengthOfArrayLike(O); | |
var actualStart = toAbsoluteIndex(start, len); | |
var argumentsLength = arguments.length; | |
var insertCount, actualDeleteCount, A, k, from, to; | |
if (argumentsLength === 0) { | |
insertCount = actualDeleteCount = 0; | |
} else if (argumentsLength === 1) { | |
insertCount = 0; | |
actualDeleteCount = len - actualStart; | |
} else { | |
insertCount = argumentsLength - 2; | |
actualDeleteCount = min(max(toIntegerOrInfinity(deleteCount), 0), len - actualStart); | |
} | |
if (len + insertCount - actualDeleteCount > MAX_SAFE_INTEGER) { | |
throw TypeError(MAXIMUM_ALLOWED_LENGTH_EXCEEDED); | |
} | |
A = arraySpeciesCreate(O, actualDeleteCount); | |
for (k = 0; k < actualDeleteCount; k++) { | |
from = actualStart + k; | |
if (from in O) createProperty(A, k, O[from]); | |
} | |
A.length = actualDeleteCount; | |
if (insertCount < actualDeleteCount) { | |
for (k = actualStart; k < len - actualDeleteCount; k++) { | |
from = k + actualDeleteCount; | |
to = k + insertCount; | |
if (from in O) O[to] = O[from]; | |
else delete O[to]; | |
} | |
for (k = len; k > len - actualDeleteCount + insertCount; k--) delete O[k - 1]; | |
} else if (insertCount > actualDeleteCount) { | |
for (k = len - actualDeleteCount; k > actualStart; k--) { | |
from = k + actualDeleteCount - 1; | |
to = k + insertCount - 1; | |
if (from in O) O[to] = O[from]; | |
else delete O[to]; | |
} | |
} | |
for (k = 0; k < insertCount; k++) { | |
O[k + actualStart] = arguments[k + 2]; | |
} | |
O.length = len - actualDeleteCount + insertCount; | |
return A; | |
} | |
}); | |
/***/ }), | |
/* 56 */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AbstractProduction", function() { return AbstractProduction; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NonTerminal", function() { return NonTerminal; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Rule", function() { return Rule; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Flat", function() { return Flat; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Option", function() { return Option; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RepetitionMandatory", function() { return RepetitionMandatory; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RepetitionMandatoryWithSeparator", function() { return RepetitionMandatoryWithSeparator; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Repetition", function() { return Repetition; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RepetitionWithSeparator", function() { return RepetitionWithSeparator; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Alternation", function() { return Alternation; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Terminal", function() { return Terminal; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "serializeGrammar", function() { return serializeGrammar; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "serializeProduction", function() { return serializeProduction; }); | |
/* harmony import */ var _utils_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(49); | |
/* harmony import */ var _scan_tokens_public__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(96); | |
var __extends = (undefined && undefined.__extends) || (function () { | |
var extendStatics = function (d, b) { | |
extendStatics = Object.setPrototypeOf || | |
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | |
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | |
return extendStatics(d, b); | |
}; | |
return function (d, b) { | |
extendStatics(d, b); | |
function __() { this.constructor = d; } | |
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | |
}; | |
})(); | |
var AbstractProduction = /** @class */ (function () { | |
function AbstractProduction(definition) { | |
this.definition = definition; | |
} | |
AbstractProduction.prototype.accept = function (visitor) { | |
visitor.visit(this); | |
Object(_utils_utils__WEBPACK_IMPORTED_MODULE_0__["forEach"])(this.definition, function (prod) { | |
prod.accept(visitor); | |
}); | |
}; | |
return AbstractProduction; | |
}()); | |
var NonTerminal = /** @class */ (function (_super) { | |
__extends(NonTerminal, _super); | |
function NonTerminal(options) { | |
var _this = _super.call(this, []) || this; | |
_this.idx = 1; | |
Object(_utils_utils__WEBPACK_IMPORTED_MODULE_0__["assign"])(_this, Object(_utils_utils__WEBPACK_IMPORTED_MODULE_0__["pick"])(options, function (v) { return v !== undefined; })); | |
return _this; | |
} | |
Object.defineProperty(NonTerminal.prototype, "definition", { | |
get: function () { | |
if (this.referencedRule !== undefined) { | |
return this.referencedRule.definition; | |
} | |
return []; | |
}, | |
set: function (definition) { | |
// immutable | |
}, | |
enumerable: true, | |
configurable: true | |
}); | |
NonTerminal.prototype.accept = function (visitor) { | |
visitor.visit(this); | |
// don't visit children of a reference, we will get cyclic infinite loops if we do so | |
}; | |
return NonTerminal; | |
}(AbstractProduction)); | |
var Rule = /** @class */ (function (_super) { | |
__extends(Rule, _super); | |
function Rule(options) { | |
var _this = _super.call(this, options.definition) || this; | |
_this.orgText = ""; | |
Object(_utils_utils__WEBPACK_IMPORTED_MODULE_0__["assign"])(_this, Object(_utils_utils__WEBPACK_IMPORTED_MODULE_0__["pick"])(options, function (v) { return v !== undefined; })); | |
return _this; | |
} | |
return Rule; | |
}(AbstractProduction)); | |
// TODO: is this only used in an Alternation? | |
// Perhaps `Flat` should be renamed to `Alternative`? | |
var Flat = /** @class */ (function (_super) { | |
__extends(Flat, _super); | |
// A named Flat production is used to indicate a Nested Rule in an alternation | |
function Flat(options) { | |
var _this = _super.call(this, options.definition) || this; | |
_this.ignoreAmbiguities = false; | |
Object(_utils_utils__WEBPACK_IMPORTED_MODULE_0__["assign"])(_this, Object(_utils_utils__WEBPACK_IMPORTED_MODULE_0__["pick"])(options, function (v) { return v !== undefined; })); | |
return _this; | |
} | |
return Flat; | |
}(AbstractProduction)); | |
var Option = /** @class */ (function (_super) { | |
__extends(Option, _super); | |
function Option(options) { | |
var _this = _super.call(this, options.definition) || this; | |
_this.idx = 1; | |
Object(_utils_utils__WEBPACK_IMPORTED_MODULE_0__["assign"])(_this, Object(_utils_utils__WEBPACK_IMPORTED_MODULE_0__["pick"])(options, function (v) { return v !== undefined; })); | |
return _this; | |
} | |
return Option; | |
}(AbstractProduction)); | |
var RepetitionMandatory = /** @class */ (function (_super) { | |
__extends(RepetitionMandatory, _super); | |
function RepetitionMandatory(options) { | |
var _this = _super.call(this, options.definition) || this; | |
_this.idx = 1; | |
Object(_utils_utils__WEBPACK_IMPORTED_MODULE_0__["assign"])(_this, Object(_utils_utils__WEBPACK_IMPORTED_MODULE_0__["pick"])(options, function (v) { return v !== undefined; })); | |
return _this; | |
} | |
return RepetitionMandatory; | |
}(AbstractProduction)); | |
var RepetitionMandatoryWithSeparator = /** @class */ (function (_super) { | |
__extends(RepetitionMandatoryWithSeparator, _super); | |
function RepetitionMandatoryWithSeparator(options) { | |
var _this = _super.call(this, options.definition) || this; | |
_this.idx = 1; | |
Object(_utils_utils__WEBPACK_IMPORTED_MODULE_0__["assign"])(_this, Object(_utils_utils__WEBPACK_IMPORTED_MODULE_0__["pick"])(options, function (v) { return v !== undefined; })); | |
return _this; | |
} | |
return RepetitionMandatoryWithSeparator; | |
}(AbstractProduction)); | |
var Repetition = /** @class */ (function (_super) { | |
__extends(Repetition, _super); | |
function Repetition(options) { | |
var _this = _super.call(this, options.definition) || this; | |
_this.idx = 1; | |
Object(_utils_utils__WEBPACK_IMPORTED_MODULE_0__["assign"])(_this, Object(_utils_utils__WEBPACK_IMPORTED_MODULE_0__["pick"])(options, function (v) { return v !== undefined; })); | |
return _this; | |
} | |
return Repetition; | |
}(AbstractProduction)); | |
var RepetitionWithSeparator = /** @class */ (function (_super) { | |
__extends(RepetitionWithSeparator, _super); | |
function RepetitionWithSeparator(options) { | |
var _this = _super.call(this, options.definition) || this; | |
_this.idx = 1; | |
Object(_utils_utils__WEBPACK_IMPORTED_MODULE_0__["assign"])(_this, Object(_utils_utils__WEBPACK_IMPORTED_MODULE_0__["pick"])(options, function (v) { return v !== undefined; })); | |
return _this; | |
} | |
return RepetitionWithSeparator; | |
}(AbstractProduction)); | |
var Alternation = /** @class */ (function (_super) { | |
__extends(Alternation, _super); | |
function Alternation(options) { | |
var _this = _super.call(this, options.definition) || this; | |
_this.idx = 1; | |
_this.ignoreAmbiguities = false; | |
_this.hasPredicates = false; | |
Object(_utils_utils__WEBPACK_IMPORTED_MODULE_0__["assign"])(_this, Object(_utils_utils__WEBPACK_IMPORTED_MODULE_0__["pick"])(options, function (v) { return v !== undefined; })); | |
return _this; | |
} | |
return Alternation; | |
}(AbstractProduction)); | |
var Terminal = /** @class */ (function () { | |
function Terminal(options) { | |
this.idx = 1; | |
Object(_utils_utils__WEBPACK_IMPORTED_MODULE_0__["assign"])(this, Object(_utils_utils__WEBPACK_IMPORTED_MODULE_0__["pick"])(options, function (v) { return v !== undefined; })); | |
} | |
Terminal.prototype.accept = function (visitor) { | |
visitor.visit(this); | |
}; | |
return Terminal; | |
}()); | |
function serializeGrammar(topRules) { | |
return Object(_utils_utils__WEBPACK_IMPORTED_MODULE_0__["map"])(topRules, serializeProduction); | |
} | |
function serializeProduction(node) { | |
function convertDefinition(definition) { | |
return Object(_utils_utils__WEBPACK_IMPORTED_MODULE_0__["map"])(definition, serializeProduction); | |
} | |
/* istanbul ignore else */ | |
if (node instanceof NonTerminal) { | |
return { | |
type: "NonTerminal", | |
name: node.nonTerminalName, | |
idx: node.idx | |
}; | |
} | |
else if (node instanceof Flat) { | |
return { | |
type: "Flat", | |
definition: convertDefinition(node.definition) | |
}; | |
} | |
else if (node instanceof Option) { | |
return { | |
type: "Option", | |
idx: node.idx, | |
definition: convertDefinition(node.definition) | |
}; | |
} | |
else if (node instanceof RepetitionMandatory) { | |
return { | |
type: "RepetitionMandatory", | |
name: node.name, | |
idx: node.idx, | |
definition: convertDefinition(node.definition) | |
}; | |
} | |
else if (node instanceof RepetitionMandatoryWithSeparator) { | |
return { | |
type: "RepetitionMandatoryWithSeparator", | |
name: node.name, | |
idx: node.idx, | |
separator: (serializeProduction(new Terminal({ terminalType: node.separator }))), | |
definition: convertDefinition(node.definition) | |
}; | |
} | |
else if (node instanceof RepetitionWithSeparator) { | |
return { | |
type: "RepetitionWithSeparator", | |
name: node.name, | |
idx: node.idx, | |
separator: (serializeProduction(new Terminal({ terminalType: node.separator }))), | |
definition: convertDefinition(node.definition) | |
}; | |
} | |
else if (node instanceof Repetition) { | |
return { | |
type: "Repetition", | |
name: node.name, | |
idx: node.idx, | |
definition: convertDefinition(node.definition) | |
}; | |
} | |
else if (node instanceof Alternation) { | |
return { | |
type: "Alternation", | |
name: node.name, | |
idx: node.idx, | |
definition: convertDefinition(node.definition) | |
}; | |
} | |
else if (node instanceof Terminal) { | |
var serializedTerminal = { | |
type: "Terminal", | |
name: node.terminalType.name, | |
label: Object(_scan_tokens_public__WEBPACK_IMPORTED_MODULE_1__["tokenLabel"])(node.terminalType), | |
idx: node.idx | |
}; | |
var pattern = node.terminalType.PATTERN; | |
if (node.terminalType.PATTERN) { | |
serializedTerminal.pattern = Object(_utils_utils__WEBPACK_IMPORTED_MODULE_0__["isRegExp"])(pattern) | |
? pattern.source | |
: pattern; | |
} | |
return serializedTerminal; | |
} | |
else if (node instanceof Rule) { | |
return { | |
type: "Rule", | |
name: node.name, | |
orgText: node.orgText, | |
definition: convertDefinition(node.definition) | |
}; | |
} | |
else { | |
throw Error("non exhaustive match"); | |
} | |
} | |
//# sourceMappingURL=gast_public.js.map | |
/***/ }), | |
/* 57 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
exports.__esModule = true; | |
exports.conditions = void 0; | |
exports.getCondition = getCondition; | |
exports.getConditionDescriptor = getConditionDescriptor; | |
exports.registerCondition = registerCondition; | |
__webpack_require__(21); | |
var conditions = {}; | |
/** | |
* Get condition closure with pre-bound arguments. | |
* | |
* @param {string} name Condition name. | |
* @param {Array} args Condition arguments. | |
* @returns {Function} | |
*/ | |
exports.conditions = conditions; | |
function getCondition(name, args) { | |
if (!conditions[name]) { | |
throw Error("Filter condition \"".concat(name, "\" does not exist.")); | |
} | |
var _conditions$name = conditions[name], | |
condition = _conditions$name.condition, | |
descriptor = _conditions$name.descriptor; | |
var conditionArguments = args; | |
if (descriptor.inputValuesDecorator) { | |
conditionArguments = descriptor.inputValuesDecorator(conditionArguments); | |
} | |
return function (dataRow) { | |
return condition.apply(dataRow.meta.instance, [].concat([dataRow], [conditionArguments])); | |
}; | |
} | |
/** | |
* Get condition object descriptor which defines some additional informations about this condition. | |
* | |
* @param {string} name Condition name. | |
* @returns {object} | |
*/ | |
function getConditionDescriptor(name) { | |
if (!conditions[name]) { | |
throw Error("Filter condition \"".concat(name, "\" does not exist.")); | |
} | |
return conditions[name].descriptor; | |
} | |
/** | |
* Condition registerer. | |
* | |
* @param {string} name Condition name. | |
* @param {Function} condition Condition function. | |
* @param {object} descriptor Condition descriptor. | |
*/ | |
function registerCondition(name, condition, descriptor) { | |
descriptor.key = name; | |
conditions[name] = { | |
condition: condition, | |
descriptor: descriptor | |
}; | |
} | |
/***/ }), | |
/* 58 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var collection = __webpack_require__(213); | |
var collectionStrong = __webpack_require__(348); | |
// `Set` constructor | |
// https://tc39.es/ecma262/#sec-set-objects | |
collection('Set', function (init) { | |
return function Set() { return init(this, arguments.length ? arguments[0] : undefined); }; | |
}, collectionStrong); | |
/***/ }), | |
/* 59 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var _interopRequireDefault = __webpack_require__(1); | |
exports.__esModule = true; | |
exports.default = void 0; | |
exports.getListenersCounter = getListenersCounter; | |
__webpack_require__(55); | |
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(5)); | |
var _createClass2 = _interopRequireDefault(__webpack_require__(6)); | |
var _feature = __webpack_require__(127); | |
var _event = __webpack_require__(83); | |
/** | |
* Counter which tracks unregistered listeners (useful for detecting memory leaks). | |
* | |
* @type {number} | |
*/ | |
var listenersCounter = 0; | |
/** | |
* Event DOM manager for internal use in Handsontable. | |
* | |
* @class EventManager | |
* @util | |
*/ | |
var EventManager = /*#__PURE__*/function () { | |
/** | |
* @param {object} [context=null] An object to which event listeners will be stored. | |
* @private | |
*/ | |
function EventManager() { | |
var context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; | |
(0, _classCallCheck2.default)(this, EventManager); | |
this.context = context || this; // TODO it modify external object. Rethink that. | |
if (!this.context.eventListeners) { | |
this.context.eventListeners = []; // TODO perf It would be more performant if every instance of EventManager tracked its own listeners only | |
} | |
} | |
/** | |
* Register specified listener (`eventName`) to the element. | |
* | |
* @param {Element} element Target element. | |
* @param {string} eventName Event name. | |
* @param {Function} callback Function which will be called after event occur. | |
* @param {AddEventListenerOptions|boolean} [options] Listener options if object or useCapture if boolean. | |
* @returns {Function} Returns function which you can easily call to remove that event. | |
*/ | |
(0, _createClass2.default)(EventManager, [{ | |
key: "addEventListener", | |
value: function addEventListener(element, eventName, callback) { | |
var _this = this; | |
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; | |
/** | |
* @param {Event} event The event object. | |
*/ | |
function callbackProxy(event) { | |
callback.call(this, extendEvent(event)); | |
} | |
if (typeof options !== 'boolean' && !(0, _feature.isPassiveEventSupported)()) { | |
options = false; | |
} | |
this.context.eventListeners.push({ | |
element: element, | |
event: eventName, | |
callback: callback, | |
callbackProxy: callbackProxy, | |
options: options, | |
eventManager: this | |
}); | |
element.addEventListener(eventName, callbackProxy, options); | |
listenersCounter += 1; | |
return function () { | |
_this.removeEventListener(element, eventName, callback); | |
}; | |
} | |
/** | |
* Remove the event listener previously registered. | |
* | |
* @param {Element} element Target element. | |
* @param {string} eventName Event name. | |
* @param {Function} callback Function to remove from the event target. It must be the same as during registration listener. | |
* @param {boolean} [onlyOwnEvents] Whether whould remove only events registered using this instance of EventManager. | |
*/ | |
}, { | |
key: "removeEventListener", | |
value: function removeEventListener(element, eventName, callback) { | |
var onlyOwnEvents = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; | |
var len = this.context.eventListeners.length; | |
var tmpEvent; | |
while (len) { | |
len -= 1; | |
tmpEvent = this.context.eventListeners[len]; | |
if (tmpEvent.event === eventName && tmpEvent.element === element) { | |
if (callback && callback !== tmpEvent.callback) { | |
/* eslint-disable no-continue */ | |
continue; | |
} // TODO rethink that, main bulk is that it needs multi instances to handle same context, but with a different scopes. | |
// TODO I suppose much more efficient way will be comparing string with scope id, or any similar approach. | |
if (onlyOwnEvents && tmpEvent.eventManager !== this) { | |
continue; | |
} | |
this.context.eventListeners.splice(len, 1); | |
tmpEvent.element.removeEventListener(tmpEvent.event, tmpEvent.callbackProxy, tmpEvent.options); | |
listenersCounter -= 1; | |
} | |
} | |
} | |
/** | |
* Clear all previously registered events. | |
* | |
* @private | |
* @since 0.15.0-beta3 | |
* @param {boolean} [onlyOwnEvents] Whether whould remove only events registered using this instance of EventManager. | |
*/ | |
}, { | |
key: "clearEvents", | |
value: function clearEvents() { | |
var onlyOwnEvents = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; | |
if (!this.context) { | |
return; | |
} | |
var len = this.context.eventListeners.length; | |
while (len) { | |
len -= 1; | |
var event = this.context.eventListeners[len]; | |
if (onlyOwnEvents && event.eventManager !== this) { | |
continue; | |
} | |
this.context.eventListeners.splice(len, 1); | |
event.element.removeEventListener(event.event, event.callbackProxy, event.options); | |
listenersCounter -= 1; | |
} | |
} | |
/** | |
* Clear all previously registered events. | |
*/ | |
}, { | |
key: "clear", | |
value: function clear() { | |
this.clearEvents(); | |
} | |
/** | |
* Destroy instance of EventManager, clearing all events of the context. | |
*/ | |
}, { | |
key: "destroy", | |
value: function destroy() { | |
this.clearEvents(); | |
this.context = null; | |
} | |
/** | |
* Destroy instance of EventManager, clearing only the own events. | |
*/ | |
}, { | |
key: "destroyWithOwnEventsOnly", | |
value: function destroyWithOwnEventsOnly() { | |
this.clearEvents(true); | |
this.context = null; | |
} | |
/** | |
* Trigger event at the specified target element. | |
* | |
* @param {Element} element Target element. | |
* @param {string} eventName Event name. | |
*/ | |
}, { | |
key: "fireEvent", | |
value: function fireEvent(element, eventName) { | |
var rootDocument = element.document; | |
var rootWindow = element; | |
if (!rootDocument) { | |
rootDocument = element.ownerDocument ? element.ownerDocument : element; | |
rootWindow = rootDocument.defaultView; | |
} | |
var options = { | |
bubbles: true, | |
cancelable: eventName !== 'mousemove', | |
view: rootWindow, | |
detail: 0, | |
screenX: 0, | |
screenY: 0, | |
clientX: 1, | |
clientY: 1, | |
ctrlKey: false, | |
altKey: false, | |
shiftKey: false, | |
metaKey: false, | |
button: 0, | |
relatedTarget: undefined | |
}; | |
var event; | |
if (rootDocument.createEvent) { | |
event = rootDocument.createEvent('MouseEvents'); | |
event.initMouseEvent(eventName, options.bubbles, options.cancelable, options.view, options.detail, options.screenX, options.screenY, options.clientX, options.clientY, options.ctrlKey, options.altKey, options.shiftKey, options.metaKey, options.button, options.relatedTarget || rootDocument.body.parentNode); | |
} else { | |
event = rootDocument.createEventObject(); | |
} | |
if (element.dispatchEvent) { | |
element.dispatchEvent(event); | |
} else { | |
element.fireEvent("on".concat(eventName), event); | |
} | |
} | |
}]); | |
return EventManager; | |
}(); | |
/** | |
* @private | |
* @param {Event} event The event object. | |
* @returns {Event} | |
*/ | |
function extendEvent(event) { | |
var nativeStopImmediatePropagation = event.stopImmediatePropagation; | |
event.stopImmediatePropagation = function () { | |
nativeStopImmediatePropagation.apply(this); | |
(0, _event.stopImmediatePropagation)(this); | |
}; | |
return event; | |
} | |
var _default = EventManager; | |
/** | |
* @returns {number} | |
*/ | |
exports.default = _default; | |
function getListenersCounter() { | |
return listenersCounter; | |
} | |
/***/ }), | |
/* 60 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var global = __webpack_require__(30); | |
var shared = __webpack_require__(203); | |
var hasOwn = __webpack_require__(73); | |
var uid = __webpack_require__(204); | |
var NATIVE_SYMBOL = __webpack_require__(236); | |
var USE_SYMBOL_AS_UID = __webpack_require__(322); | |
var WellKnownSymbolsStore = shared('wks'); | |
var Symbol = global.Symbol; | |
var symbolFor = Symbol && Symbol['for']; | |
var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol : Symbol && Symbol.withoutSetter || uid; | |
module.exports = function (name) { | |
if (!hasOwn(WellKnownSymbolsStore, name) || !(NATIVE_SYMBOL || typeof WellKnownSymbolsStore[name] == 'string')) { | |
var description = 'Symbol.' + name; | |
if (NATIVE_SYMBOL && hasOwn(Symbol, name)) { | |
WellKnownSymbolsStore[name] = Symbol[name]; | |
} else if (USE_SYMBOL_AS_UID && symbolFor) { | |
WellKnownSymbolsStore[name] = symbolFor(description); | |
} else { | |
WellKnownSymbolsStore[name] = createWellKnownSymbol(description); | |
} | |
} return WellKnownSymbolsStore[name]; | |
}; | |
/***/ }), | |
/* 61 */ | |
/***/ (function(module, exports) { | |
// `IsCallable` abstract operation | |
// https://tc39.es/ecma262/#sec-iscallable | |
module.exports = function (argument) { | |
return typeof argument == 'function'; | |
}; | |
/***/ }), | |
/* 62 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
__webpack_require__(3); | |
__webpack_require__(0); | |
__webpack_require__(2); | |
__webpack_require__(12); | |
__webpack_require__(4); | |
__webpack_require__(19); | |
var _interopRequireDefault = __webpack_require__(1); | |
var _typeof = __webpack_require__(22); | |
exports.__esModule = true; | |
exports.Renderer = void 0; | |
var _viewportColumns = _interopRequireDefault(__webpack_require__(563)); | |
exports.ViewportColumnsCalculator = _viewportColumns.default; | |
var _viewportRows = _interopRequireDefault(__webpack_require__(564)); | |
exports.ViewportRowsCalculator = _viewportRows.default; | |
var _coords = _interopRequireDefault(__webpack_require__(191)); | |
exports.CellCoords = _coords.default; | |
var _range = _interopRequireDefault(__webpack_require__(565)); | |
exports.CellRange = _range.default; | |
var _core = _interopRequireDefault(__webpack_require__(734)); | |
exports.default = _core.default; | |
exports.Core = _core.default; | |
var _selection = _interopRequireDefault(__webpack_require__(767)); | |
exports.Selection = _selection.default; | |
var Renderer = _interopRequireWildcard(__webpack_require__(567)); | |
exports.Renderer = Renderer; | |
var _orderView = __webpack_require__(229); | |
exports.OrderView = _orderView.OrderView; | |
exports.SharedOrderView = _orderView.SharedOrderView; | |
var _eventManager = __webpack_require__(59); | |
exports.getListenersCounter = _eventManager.getListenersCounter; | |
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | |
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | |
/***/ }), | |
/* 63 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var apply = __webpack_require__(133); | |
var call = __webpack_require__(78); | |
var uncurryThis = __webpack_require__(37); | |
var fixRegExpWellKnownSymbolLogic = __webpack_require__(214); | |
var isRegExp = __webpack_require__(248); | |
var anObject = __webpack_require__(66); | |
var requireObjectCoercible = __webpack_require__(91); | |
var speciesConstructor = __webpack_require__(644); | |
var advanceStringIndex = __webpack_require__(261); | |
var toLength = __webpack_require__(132); | |
var toString = __webpack_require__(74); | |
var getMethod = __webpack_require__(130); | |
var arraySlice = __webpack_require__(245); | |
var callRegExpExec = __webpack_require__(215); | |
var regexpExec = __webpack_require__(212); | |
var stickyHelpers = __webpack_require__(254); | |
var fails = __webpack_require__(43); | |
var UNSUPPORTED_Y = stickyHelpers.UNSUPPORTED_Y; | |
var MAX_UINT32 = 0xFFFFFFFF; | |
var min = Math.min; | |
var $push = [].push; | |
var exec = uncurryThis(/./.exec); | |
var push = uncurryThis($push); | |
var stringSlice = uncurryThis(''.slice); | |
// Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec | |
// Weex JS has frozen built-in prototypes, so use try / catch wrapper | |
var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () { | |
// eslint-disable-next-line regexp/no-empty-group -- required for testing | |
var re = /(?:)/; | |
var originalExec = re.exec; | |
re.exec = function () { return originalExec.apply(this, arguments); }; | |
var result = 'ab'.split(re); | |
return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b'; | |
}); | |
// @@split logic | |
fixRegExpWellKnownSymbolLogic('split', function (SPLIT, nativeSplit, maybeCallNative) { | |
var internalSplit; | |
if ( | |
'abbc'.split(/(b)*/)[1] == 'c' || | |
// eslint-disable-next-line regexp/no-empty-group -- required for testing | |
'test'.split(/(?:)/, -1).length != 4 || | |
'ab'.split(/(?:ab)*/).length != 2 || | |
'.'.split(/(.?)(.?)/).length != 4 || | |
// eslint-disable-next-line regexp/no-empty-capturing-group, regexp/no-empty-group -- required for testing | |
'.'.split(/()()/).length > 1 || | |
''.split(/.?/).length | |
) { | |
// based on es5-shim implementation, need to rework it | |
internalSplit = function (separator, limit) { | |
var string = toString(requireObjectCoercible(this)); | |
var lim = limit === undefined ? MAX_UINT32 : limit >>> 0; | |
if (lim === 0) return []; | |
if (separator === undefined) return [string]; | |
// If `separator` is not a regex, use native split | |
if (!isRegExp(separator)) { | |
return call(nativeSplit, string, separator, lim); | |
} | |
var output = []; | |
var flags = (separator.ignoreCase ? 'i' : '') + | |
(separator.multiline ? 'm' : '') + | |
(separator.unicode ? 'u' : '') + | |
(separator.sticky ? 'y' : ''); | |
var lastLastIndex = 0; | |
// Make `global` and avoid `lastIndex` issues by working with a copy | |
var separatorCopy = new RegExp(separator.source, flags + 'g'); | |
var match, lastIndex, lastLength; | |
while (match = call(regexpExec, separatorCopy, string)) { | |
lastIndex = separatorCopy.lastIndex; | |
if (lastIndex > lastLastIndex) { | |
push(output, stringSlice(string, lastLastIndex, match.index)); | |
if (match.length > 1 && match.index < string.length) apply($push, output, arraySlice(match, 1)); | |
lastLength = match[0].length; | |
lastLastIndex = lastIndex; | |
if (output.length >= lim) break; | |
} | |
if (separatorCopy.lastIndex === match.index) separatorCopy.lastIndex++; // Avoid an infinite loop | |
} | |
if (lastLastIndex === string.length) { | |
if (lastLength || !exec(separatorCopy, '')) push(output, ''); | |
} else push(output, stringSlice(string, lastLastIndex)); | |
return output.length > lim ? arraySlice(output, 0, lim) : output; | |
}; | |
// Chakra, V8 | |
} else if ('0'.split(undefined, 0).length) { | |
internalSplit = function (separator, limit) { | |
return separator === undefined && limit === 0 ? [] : call(nativeSplit, this, separator, limit); | |
}; | |
} else internalSplit = nativeSplit; | |
return [ | |
// `String.prototype.split` method | |
// https://tc39.es/ecma262/#sec-string.prototype.split | |
function split(separator, limit) { | |
var O = requireObjectCoercible(this); | |
var splitter = separator == undefined ? undefined : getMethod(separator, SPLIT); | |
return splitter | |
? call(splitter, separator, O, limit) | |
: call(internalSplit, toString(O), separator, limit); | |
}, | |
// `RegExp.prototype[@@split]` method | |
// https://tc39.es/ecma262/#sec-regexp.prototype-@@split | |
// | |
// NOTE: This cannot be properly polyfilled in engines that don't support | |
// the 'y' flag. | |
function (string, limit) { | |
var rx = anObject(this); | |
var S = toString(string); | |
var res = maybeCallNative(internalSplit, rx, S, limit, internalSplit !== nativeSplit); | |
if (res.done) return res.value; | |
var C = speciesConstructor(rx, RegExp); | |
var unicodeMatching = rx.unicode; | |
var flags = (rx.ignoreCase ? 'i' : '') + | |
(rx.multiline ? 'm' : '') + | |
(rx.unicode ? 'u' : '') + | |
(UNSUPPORTED_Y ? 'g' : 'y'); | |
// ^(? + rx + ) is needed, in combination with some S slicing, to | |
// simulate the 'y' flag. | |
var splitter = new C(UNSUPPORTED_Y ? '^(?:' + rx.source + ')' : rx, flags); | |
var lim = limit === undefined ? MAX_UINT32 : limit >>> 0; | |
if (lim === 0) return []; | |
if (S.length === 0) return callRegExpExec(splitter, S) === null ? [S] : []; | |
var p = 0; | |
var q = 0; | |
var A = []; | |
while (q < S.length) { | |
splitter.lastIndex = UNSUPPORTED_Y ? 0 : q; | |
var z = callRegExpExec(splitter, UNSUPPORTED_Y ? stringSlice(S, q) : S); | |
var e; | |
if ( | |
z === null || | |
(e = min(toLength(splitter.lastIndex + (UNSUPPORTED_Y ? q : 0)), S.length)) === p | |
) { | |
q = advanceStringIndex(S, q, unicodeMatching); | |
} else { | |
push(A, stringSlice(S, p, q)); | |
if (A.length === lim) return A; | |
for (var i = 1; i <= z.length - 1; i++) { | |
push(A, z[i]); | |
if (A.length === lim) return A; | |
} | |
q = p = e; | |
} | |
} | |
push(A, stringSlice(S, p)); | |
return A; | |
} | |
]; | |
}, !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC, UNSUPPORTED_Y); | |
/***/ }), | |
/* 64 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var apply = __webpack_require__(133); | |
var call = __webpack_require__(78); | |
var uncurryThis = __webpack_require__(37); | |
var fixRegExpWellKnownSymbolLogic = __webpack_require__(214); | |
var fails = __webpack_require__(43); | |
var anObject = __webpack_require__(66); | |
var isCallable = __webpack_require__(61); | |
var toIntegerOrInfinity = __webpack_require__(123); | |
var toLength = __webpack_require__(132); | |
var toString = __webpack_require__(74); | |
var requireObjectCoercible = __webpack_require__(91); | |
var advanceStringIndex = __webpack_require__(261); | |
var getMethod = __webpack_require__(130); | |
var getSubstitution = __webpack_require__(646); | |
var regExpExec = __webpack_require__(215); | |
var wellKnownSymbol = __webpack_require__(60); | |
var REPLACE = wellKnownSymbol('replace'); | |
var max = Math.max; | |
var min = Math.min; | |
var concat = uncurryThis([].concat); | |
var push = uncurryThis([].push); | |
var stringIndexOf = uncurryThis(''.indexOf); | |
var stringSlice = uncurryThis(''.slice); | |
var maybeToString = function (it) { | |
return it === undefined ? it : String(it); | |
}; | |
// IE <= 11 replaces $0 with the whole match, as if it was $& | |
// https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0 | |
var REPLACE_KEEPS_$0 = (function () { | |
// eslint-disable-next-line regexp/prefer-escape-replacement-dollar-char -- required for testing | |
return 'a'.replace(/./, '$0') === '$0'; | |
})(); | |
// Safari <= 13.0.3(?) substitutes nth capture where n>m with an empty string | |
var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () { | |
if (/./[REPLACE]) { | |
return /./[REPLACE]('a', '$0') === ''; | |
} | |
return false; | |
})(); | |
var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () { | |
var re = /./; | |
re.exec = function () { | |
var result = []; | |
result.groups = { a: '7' }; | |
return result; | |
}; | |
// eslint-disable-next-line regexp/no-useless-dollar-replacements -- false positive | |
return ''.replace(re, '$<a>') !== '7'; | |
}); | |
// @@replace logic | |
fixRegExpWellKnownSymbolLogic('replace', function (_, nativeReplace, maybeCallNative) { | |
var UNSAFE_SUBSTITUTE = REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE ? '$' : '$0'; | |
return [ | |
// `String.prototype.replace` method | |
// https://tc39.es/ecma262/#sec-string.prototype.replace | |
function replace(searchValue, replaceValue) { | |
var O = requireObjectCoercible(this); | |
var replacer = searchValue == undefined ? undefined : getMethod(searchValue, REPLACE); | |
return replacer | |
? call(replacer, searchValue, O, replaceValue) | |
: call(nativeReplace, toString(O), searchValue, replaceValue); | |
}, | |
// `RegExp.prototype[@@replace]` method | |
// https://tc39.es/ecma262/#sec-regexp.prototype-@@replace | |
function (string, replaceValue) { | |
var rx = anObject(this); | |
var S = toString(string); | |
if ( | |
typeof replaceValue == 'string' && | |
stringIndexOf(replaceValue, UNSAFE_SUBSTITUTE) === -1 && | |
stringIndexOf(replaceValue, '$<') === -1 | |
) { | |
var res = maybeCallNative(nativeReplace, rx, S, replaceValue); | |
if (res.done) return res.value; | |
} | |
var functionalReplace = isCallable(replaceValue); | |
if (!functionalReplace) replaceValue = toString(replaceValue); | |
var global = rx.global; | |
if (global) { | |
var fullUnicode = rx.unicode; | |
rx.lastIndex = 0; | |
} | |
var results = []; | |
while (true) { | |
var result = regExpExec(rx, S); | |
if (result === null) break; | |
push(results, result); | |
if (!global) break; | |
var matchStr = toString(result[0]); | |
if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode); | |
} | |
var accumulatedResult = ''; | |
var nextSourcePosition = 0; | |
for (var i = 0; i < results.length; i++) { | |
result = results[i]; | |
var matched = toString(result[0]); | |
var position = max(min(toIntegerOrInfinity(result.index), S.length), 0); | |
var captures = []; | |
// NOTE: This is equivalent to | |
// captures = result.slice(1).map(maybeToString) | |
// but for some reason `nativeSlice.call(result, 1, result.length)` (called in | |
// the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and | |
// causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it. | |
for (var j = 1; j < result.length; j++) push(captures, maybeToString(result[j])); | |
var namedCaptures = result.groups; | |
if (functionalReplace) { | |
var replacerArgs = concat([matched], captures, position, S); | |
if (namedCaptures !== undefined) push(replacerArgs, namedCaptures); | |
var replacement = toString(apply(replaceValue, undefined, replacerArgs)); | |
} else { | |
replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue); | |
} | |
if (position >= nextSourcePosition) { | |
accumulatedResult += stringSlice(S, nextSourcePosition, position) + replacement; | |
nextSourcePosition = position + matched.length; | |
} | |
} | |
return accumulatedResult + stringSlice(S, nextSourcePosition); | |
} | |
]; | |
}, !REPLACE_SUPPORTS_NAMED_GROUPS || !REPLACE_KEEPS_$0 || REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE); | |
/***/ }), | |
/* 65 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var isCallable = __webpack_require__(61); | |
module.exports = function (it) { | |
return typeof it == 'object' ? it !== null : isCallable(it); | |
}; | |
/***/ }), | |
/* 66 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var global = __webpack_require__(30); | |
var isObject = __webpack_require__(65); | |
var String = global.String; | |
var TypeError = global.TypeError; | |
// `Assert: Type(argument) is Object` | |
module.exports = function (argument) { | |
if (isObject(argument)) return argument; | |
throw TypeError(String(argument) + ' is not an object'); | |
}; | |
/***/ }), | |
/* 67 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var uncurryThis = __webpack_require__(37); | |
var PROPER_FUNCTION_NAME = __webpack_require__(168).PROPER; | |
var redefine = __webpack_require__(103); | |
var anObject = __webpack_require__(66); | |
var isPrototypeOf = __webpack_require__(121); | |
var $toString = __webpack_require__(74); | |
var fails = __webpack_require__(43); | |
var regExpFlags = __webpack_require__(253); | |
var TO_STRING = 'toString'; | |
var RegExpPrototype = RegExp.prototype; | |
var n$ToString = RegExpPrototype[TO_STRING]; | |
var getFlags = uncurryThis(regExpFlags); | |
var NOT_GENERIC = fails(function () { return n$ToString.call({ source: 'a', flags: 'b' }) != '/a/b'; }); | |
// FF44- RegExp#toString has a wrong name | |
var INCORRECT_NAME = PROPER_FUNCTION_NAME && n$ToString.name != TO_STRING; | |
// `RegExp.prototype.toString` method | |
// https://tc39.es/ecma262/#sec-regexp.prototype.tostring | |
if (NOT_GENERIC || INCORRECT_NAME) { | |
redefine(RegExp.prototype, TO_STRING, function toString() { | |
var R = anObject(this); | |
var p = $toString(R.source); | |
var rf = R.flags; | |
var f = $toString(rf === undefined && isPrototypeOf(RegExpPrototype, R) && !('flags' in RegExpPrototype) ? getFlags(R) : rf); | |
return '/' + p + '/' + f; | |
}, { unsafe: true }); | |
} | |
/***/ }), | |
/* 68 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var $ = __webpack_require__(31); | |
var isIntegralNumber = __webpack_require__(662); | |
// `Number.isInteger` method | |
// https://tc39.es/ecma262/#sec-number.isinteger | |
$({ target: 'Number', stat: true }, { | |
isInteger: isIntegralNumber | |
}); | |
/***/ }), | |
/* 69 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
exports.__esModule = true; | |
exports.curry = curry; | |
exports.curryRight = curryRight; | |
exports.debounce = debounce; | |
exports.fastCall = fastCall; | |
exports.isFunction = isFunction; | |
exports.partial = partial; | |
exports.pipe = pipe; | |
exports.throttle = throttle; | |
exports.throttleAfterHits = throttleAfterHits; | |
__webpack_require__(77); | |
__webpack_require__(14); | |
__webpack_require__(21); | |
__webpack_require__(139); | |
var _array = __webpack_require__(20); | |
var _mixed = __webpack_require__(34); | |
/** | |
* Checks if given variable is function. | |
* | |
* @param {*} func Variable to check. | |
* @returns {boolean} | |
*/ | |
function isFunction(func) { | |
return typeof func === 'function'; | |
} | |
/** | |
* Creates throttle function that enforces a maximum number of times a function (`func`) can be called over time (`wait`). | |
* | |
* @param {Function} func Function to invoke. | |
* @param {number} wait Delay in miliseconds. | |
* @returns {Function} | |
*/ | |
function throttle(func) { | |
var wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 200; | |
var lastCalled = 0; | |
var result = { | |
lastCallThrottled: true | |
}; | |
var lastTimer = null; | |
/** | |
* @param {...*} args The list of arguments passed during the function invocation. | |
* @returns {object} | |
*/ | |
function _throttle() { | |
var _this = this; | |
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | |
args[_key] = arguments[_key]; | |
} | |
var stamp = Date.now(); | |
var needCall = false; | |
result.lastCallThrottled = true; | |
if (!lastCalled) { | |
lastCalled = stamp; | |
needCall = true; | |
} | |
var remaining = wait - (stamp - lastCalled); | |
if (needCall) { | |
result.lastCallThrottled = false; | |
func.apply(this, args); | |
} else { | |
if (lastTimer) { | |
clearTimeout(lastTimer); | |
} | |
lastTimer = setTimeout(function () { | |
result.lastCallThrottled = false; | |
func.apply(_this, args); | |
lastCalled = 0; | |
lastTimer = void 0; | |
}, remaining); | |
} | |
return result; | |
} | |
return _throttle; | |
} | |
/** | |
* Creates throttle function that enforces a maximum number of times a function (`func`) can be called over | |
* time (`wait`) after specified hits. | |
* | |
* @param {Function} func Function to invoke. | |
* @param {number} wait Delay in miliseconds. | |
* @param {number} hits Number of hits after throttling will be applied. | |
* @returns {Function} | |
*/ | |
function throttleAfterHits(func) { | |
var wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 200; | |
var hits = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 10; | |
var funcThrottle = throttle(func, wait); | |
var remainHits = hits; | |
/** | |
* | |
*/ | |
function _clearHits() { | |
remainHits = hits; | |
} | |
/** | |
* @param {*} args The list of arguments passed during the function invocation. | |
* @returns {*} | |
*/ | |
function _throttleAfterHits() { | |
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { | |
args[_key2] = arguments[_key2]; | |
} | |
if (remainHits) { | |
remainHits -= 1; | |
return func.apply(this, args); | |
} | |
return funcThrottle.apply(this, args); | |
} | |
_throttleAfterHits.clearHits = _clearHits; | |
return _throttleAfterHits; | |
} | |
/** | |
* Creates debounce function that enforces a function (`func`) not be called again until a certain amount of time (`wait`) | |
* has passed without it being called. | |
* | |
* @param {Function} func Function to invoke. | |
* @param {number} wait Delay in milliseconds. | |
* @returns {Function} | |
*/ | |
function debounce(func) { | |
var wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 200; | |
var lastTimer = null; | |
var result; | |
/** | |
* @param {*} args The list of arguments passed during the function invocation. | |
* @returns {*} | |
*/ | |
function _debounce() { | |
var _this2 = this; | |
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { | |
args[_key3] = arguments[_key3]; | |
} | |
if (lastTimer) { | |
clearTimeout(lastTimer); | |
} | |
lastTimer = setTimeout(function () { | |
result = func.apply(_this2, args); | |
}, wait); | |
return result; | |
} | |
return _debounce; | |
} | |
/** | |
* Creates the function that returns the result of calling the given functions. Result of the first function is passed to | |
* the second as an argument and so on. Only first function in the chain can handle multiple arguments. | |
* | |
* @param {Function} functions Functions to compose. | |
* @returns {Function} | |
*/ | |
function pipe() { | |
for (var _len4 = arguments.length, functions = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { | |
functions[_key4] = arguments[_key4]; | |
} | |
var firstFunc = functions[0], | |
restFunc = functions.slice(1); | |
return function _pipe() { | |
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) { | |
args[_key5] = arguments[_key5]; | |
} | |
return (0, _array.arrayReduce)(restFunc, function (acc, fn) { | |
return fn(acc); | |
}, firstFunc.apply(this, args)); | |
}; | |
} | |
/** | |
* Creates the function that returns the function with cached arguments. | |
* | |
* @param {Function} func Function to partialization. | |
* @param {Array} params Function arguments to cache. | |
* @returns {Function} | |
*/ | |
function partial(func) { | |
for (var _len6 = arguments.length, params = new Array(_len6 > 1 ? _len6 - 1 : 0), _key6 = 1; _key6 < _len6; _key6++) { | |
params[_key6 - 1] = arguments[_key6]; | |
} | |
return function _partial() { | |
for (var _len7 = arguments.length, restParams = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) { | |
restParams[_key7] = arguments[_key7]; | |
} | |
return func.apply(this, params.concat(restParams)); | |
}; | |
} | |
/** | |
* Creates the functions that returns the function with cached arguments. If count if passed arguments will be matched | |
* to the arguments defined in `func` then function will be invoked. | |
* Arguments are added to the stack in direction from the left to the right. | |
* | |
* @example | |
* ``` | |
* var replace = curry(function(find, replace, string) { | |
* return string.replace(find, replace); | |
* }); | |
* | |
* // returns function with bounded first argument | |
* var replace = replace('foo') | |
* | |
* // returns replaced string - all arguments was passed so function was invoked | |
* replace('bar', 'Some test with foo...'); | |
* | |
* ``` | |
* | |
* @param {Function} func Function to currying. | |
* @returns {Function} | |
*/ | |
function curry(func) { | |
var argsLength = func.length; | |
/** | |
* @param {*} argsSoFar The list of arguments passed during the function invocation. | |
* @returns {Function} | |
*/ | |
function given(argsSoFar) { | |
return function _curry() { | |
for (var _len8 = arguments.length, params = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) { | |
params[_key8] = arguments[_key8]; | |
} | |
var passedArgsSoFar = argsSoFar.concat(params); | |
var result; | |
if (passedArgsSoFar.length >= argsLength) { | |
result = func.apply(this, passedArgsSoFar); | |
} else { | |
result = given(passedArgsSoFar); | |
} | |
return result; | |
}; | |
} | |
return given([]); | |
} | |
/** | |
* Creates the functions that returns the function with cached arguments. If count if passed arguments will be matched | |
* to the arguments defined in `func` then function will be invoked. | |
* Arguments are added to the stack in direction from the right to the left. | |
* | |
* @example | |
* ``` | |
* var replace = curry(function(find, replace, string) { | |
* return string.replace(find, replace); | |
* }); | |
* | |
* // returns function with bounded first argument | |
* var replace = replace('Some test with foo...') | |
* | |
* // returns replaced string - all arguments was passed so function was invoked | |
* replace('bar', 'foo'); | |
* | |
* ``` | |
* | |
* @param {Function} func Function to currying. | |
* @returns {Function} | |
*/ | |
function curryRight(func) { | |
var argsLength = func.length; | |
/** | |
* @param {*} argsSoFar The list of arguments passed during the function invocation. | |
* @returns {Function} | |
*/ | |
function given(argsSoFar) { | |
return function _curry() { | |
for (var _len9 = arguments.length, params = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) { | |
params[_key9] = arguments[_key9]; | |
} | |
var passedArgsSoFar = argsSoFar.concat(params.reverse()); | |
var result; | |
if (passedArgsSoFar.length >= argsLength) { | |
result = func.apply(this, passedArgsSoFar); | |
} else { | |
result = given(passedArgsSoFar); | |
} | |
return result; | |
}; | |
} | |
return given([]); | |
} | |
/** | |
* Calls a function in the quickest way available. | |
* | |
* In contrast to the `apply()` method that passes arguments as an array, | |
* the `call()` method passes arguments directly, to avoid garbage collection costs. | |
* | |
* @param {Function} func The function to call. | |
* @param {*} context The value to use as `this` when calling the `func` function. | |
* @param {*} [arg1] An argument passed to the `func` function. | |
* @param {*} [arg2] An argument passed to `func` function. | |
* @param {*} [arg3] An argument passed to `func` function. | |
* @param {*} [arg4] An argument passed to `func` function. | |
* @param {*} [arg5] An argument passed to `func` function. | |
* @param {*} [arg6] An argument passed to `func` function. | |
* @returns {*} | |
*/ | |
function fastCall(func, context, arg1, arg2, arg3, arg4, arg5, arg6) { | |
if ((0, _mixed.isDefined)(arg6)) { | |
return func.call(context, arg1, arg2, arg3, arg4, arg5, arg6); | |
} else if ((0, _mixed.isDefined)(arg5)) { | |
return func.call(context, arg1, arg2, arg3, arg4, arg5); | |
} else if ((0, _mixed.isDefined)(arg4)) { | |
return func.call(context, arg1, arg2, arg3, arg4); | |
} else if ((0, _mixed.isDefined)(arg3)) { | |
return func.call(context, arg1, arg2, arg3); | |
} else if ((0, _mixed.isDefined)(arg2)) { | |
return func.call(context, arg1, arg2); | |
} else if ((0, _mixed.isDefined)(arg1)) { | |
return func.call(context, arg1); | |
} | |
return func.call(context); | |
} | |
/***/ }), | |
/* 70 */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony import */ var _addressRepresentationConverters__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(99); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "cellAddressFromString", function() { return _addressRepresentationConverters__WEBPACK_IMPORTED_MODULE_0__["cellAddressFromString"]; }); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "simpleCellAddressFromString", function() { return _addressRepresentationConverters__WEBPACK_IMPORTED_MODULE_0__["simpleCellAddressFromString"]; }); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "simpleCellAddressToString", function() { return _addressRepresentationConverters__WEBPACK_IMPORTED_MODULE_0__["simpleCellAddressToString"]; }); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "simpleCellRangeFromString", function() { return _addressRepresentationConverters__WEBPACK_IMPORTED_MODULE_0__["simpleCellRangeFromString"]; }); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "simpleCellRangeToString", function() { return _addressRepresentationConverters__WEBPACK_IMPORTED_MODULE_0__["simpleCellRangeToString"]; }); | |
/* harmony import */ var _CellAddress__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(216); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CellAddress", function() { return _CellAddress__WEBPACK_IMPORTED_MODULE_1__["CellAddress"]; }); | |
/* harmony import */ var _ParserWithCaching__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(362); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ParserWithCaching", function() { return _ParserWithCaching__WEBPACK_IMPORTED_MODULE_2__["ParserWithCaching"]; }); | |
/* harmony import */ var _collectDependencies__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(365); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "collectDependencies", function() { return _collectDependencies__WEBPACK_IMPORTED_MODULE_3__["collectDependencies"]; }); | |
/* harmony import */ var _LexerConfig__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(177); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "buildLexerConfig", function() { return _LexerConfig__WEBPACK_IMPORTED_MODULE_4__["buildLexerConfig"]; }); | |
/* harmony import */ var _FormulaParser__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(269); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FormulaLexer", function() { return _FormulaParser__WEBPACK_IMPORTED_MODULE_5__["FormulaLexer"]; }); | |
/* harmony import */ var _Ast__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(101); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AstNodeType", function() { return _Ast__WEBPACK_IMPORTED_MODULE_6__["AstNodeType"]; }); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ParsingErrorType", function() { return _Ast__WEBPACK_IMPORTED_MODULE_6__["ParsingErrorType"]; }); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "buildProcedureAst", function() { return _Ast__WEBPACK_IMPORTED_MODULE_6__["buildProcedureAst"]; }); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "buildCellRangeAst", function() { return _Ast__WEBPACK_IMPORTED_MODULE_6__["buildCellRangeAst"]; }); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "buildParsingErrorAst", function() { return _Ast__WEBPACK_IMPORTED_MODULE_6__["buildParsingErrorAst"]; }); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "buildCellErrorAst", function() { return _Ast__WEBPACK_IMPORTED_MODULE_6__["buildCellErrorAst"]; }); | |
/* harmony import */ var _Unparser__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(270); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Unparser", function() { return _Unparser__WEBPACK_IMPORTED_MODULE_7__["Unparser"]; }); | |
/* harmony import */ var _RelativeDependency__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(155); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AddressDependency", function() { return _RelativeDependency__WEBPACK_IMPORTED_MODULE_8__["AddressDependency"]; }); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CellRangeDependency", function() { return _RelativeDependency__WEBPACK_IMPORTED_MODULE_8__["CellRangeDependency"]; }); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ColumnRangeDependency", function() { return _RelativeDependency__WEBPACK_IMPORTED_MODULE_8__["ColumnRangeDependency"]; }); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "RowRangeDependency", function() { return _RelativeDependency__WEBPACK_IMPORTED_MODULE_8__["RowRangeDependency"]; }); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "NamedExpressionDependency", function() { return _RelativeDependency__WEBPACK_IMPORTED_MODULE_8__["NamedExpressionDependency"]; }); | |
/** | |
* @license | |
* Copyright (c) 2021 Handsoncode. All rights reserved. | |
*/ | |
/***/ }), | |
/* 71 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var _interopRequireDefault = __webpack_require__(1); | |
exports.__esModule = true; | |
exports.default = void 0; | |
__webpack_require__(3); | |
__webpack_require__(36); | |
__webpack_require__(0); | |
__webpack_require__(2); | |
__webpack_require__(4); | |
__webpack_require__(33); | |
__webpack_require__(55); | |
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(5)); | |
var _createClass2 = _interopRequireDefault(__webpack_require__(6)); | |
var _taggedTemplateLiteral2 = _interopRequireDefault(__webpack_require__(81)); | |
var _array = __webpack_require__(20); | |
var _object = __webpack_require__(18); | |
var _string = __webpack_require__(97); | |
var _console = __webpack_require__(90); | |
var _templateLiteralTag = __webpack_require__(82); | |
var _function = __webpack_require__(69); | |
var _templateObject; | |
/** | |
* @description | |
* Handsontable events are the common interface that function in 2 ways: as __callbacks__ and as __hooks__. | |
* | |
* @example | |
* | |
* ```js | |
* // Using events as callbacks: | |
* ... | |
* const hot1 = new Handsontable(document.getElementById('example1'), { | |
* afterChange: function(changes, source) { | |
* $.ajax({ | |
* url: "save.php', | |
* data: change | |
* }); | |
* } | |
* }); | |
* ... | |
* ``` | |
* | |
* ```js | |
* // Using events as plugin hooks: | |
* ... | |
* const hot1 = new Handsontable(document.getElementById('example1'), { | |
* myPlugin: true | |
* }); | |
* | |
* const hot2 = new Handsontable(document.getElementById('example2'), { | |
* myPlugin: false | |
* }); | |
* | |
* // global hook | |
* Handsontable.hooks.add('afterChange', function() { | |
* // Fired twice - for hot1 and hot2 | |
* if (this.getSettings().myPlugin) { | |
* // function body - will only run for hot1 | |
* } | |
* }); | |
* | |
* // local hook (has same effect as a callback) | |
* hot2.addHook('afterChange', function() { | |
* // function body - will only run in #example2 | |
* }); | |
* ``` | |
* ... | |
*/ | |
// @TODO: Move plugin description hooks to plugin? | |
var REGISTERED_HOOKS = [ | |
/* eslint-disable jsdoc/require-description-complete-sentence */ | |
/** | |
* Fired after resetting a cell's meta. This happens when the {@link Core#updateSettings} method is called. | |
* | |
* @event Hooks#afterCellMetaReset | |
*/ | |
'afterCellMetaReset', | |
/** | |
* Fired after one or more cells has been changed. The changes are triggered in any situation when the | |
* value is entered using an editor or changed using API (e.q setDataAtCell). | |
* | |
* __Note:__ For performance reasons, the `changes` array is null for `"loadData"` source. | |
* | |
* @event Hooks#afterChange | |
* @param {Array} changes 2D array containing information about each of the edited cells `[[row, prop, oldVal, newVal], ...]`. | |
* @param {string} [source] String that identifies source of hook call ([list of all available sources](@/guides/getting-started/events-and-hooks.md#definition-for-source-argument)). | |
* @example | |
* ```js | |
* new Handsontable(element, { | |
* afterChange: (changes) => { | |
* changes.forEach(([row, prop, oldValue, newValue]) => { | |
* // Some logic... | |
* }); | |
* } | |
* }) | |
* ``` | |
*/ | |
'afterChange', | |
/** | |
* Fired each time user opens {@link ContextMenu} and after setting up the Context Menu's default options. These options are a collection | |
* which user can select by setting an array of keys or an array of objects in {@link Options#contextMenu} option. | |
* | |
* @event Hooks#afterContextMenuDefaultOptions | |
* @param {Array} predefinedItems An array of objects containing information about the pre-defined Context Menu items. | |
*/ | |
'afterContextMenuDefaultOptions', | |
/** | |
* Fired each time user opens {@link ContextMenu} plugin before setting up the Context Menu's items but after filtering these options by | |
* user (`contextMenu` option). This hook can by helpful to determine if user use specified menu item or to set up | |
* one of the menu item to by always visible. | |
* | |
* @event Hooks#beforeContextMenuSetItems | |
* @param {object[]} menuItems An array of objects containing information about to generated Context Menu items. | |
*/ | |
'beforeContextMenuSetItems', | |
/** | |
* Fired by {@link DropdownMenu} plugin after setting up the Dropdown Menu's default options. These options are a | |
* collection which user can select by setting an array of keys or an array of objects in {@link Options#dropdownMenu} | |
* option. | |
* | |
* @event Hooks#afterDropdownMenuDefaultOptions | |
* @param {object[]} predefinedItems An array of objects containing information about the pre-defined Context Menu items. | |
*/ | |
'afterDropdownMenuDefaultOptions', | |
/** | |
* Fired by {@link DropdownMenu} plugin before setting up the Dropdown Menu's items but after filtering these options | |
* by user (`dropdownMenu` option). This hook can by helpful to determine if user use specified menu item or to set | |
* up one of the menu item to by always visible. | |
* | |
* @event Hooks#beforeDropdownMenuSetItems | |
* @param {object[]} menuItems An array of objects containing information about to generated Dropdown Menu items. | |
*/ | |
'beforeDropdownMenuSetItems', | |
/** | |
* Fired by {@link ContextMenu} plugin after hiding the Context Menu. This hook is fired when {@link Options#contextMenu} | |
* option is enabled. | |
* | |
* @event Hooks#afterContextMenuHide | |
* @param {object} context The Context Menu plugin instance. | |
*/ | |
'afterContextMenuHide', | |
/** | |
* Fired by {@link ContextMenu} plugin before opening the Context Menu. This hook is fired when {@link Options#contextMenu} | |
* option is enabled. | |
* | |
* @event Hooks#beforeContextMenuShow | |
* @param {object} context The Context Menu instance. | |
*/ | |
'beforeContextMenuShow', | |
/** | |
* Fired by {@link ContextMenu} plugin after opening the Context Menu. This hook is fired when {@link Options#contextMenu} | |
* option is enabled. | |
* | |
* @event Hooks#afterContextMenuShow | |
* @param {object} context The Context Menu plugin instance. | |
*/ | |
'afterContextMenuShow', | |
/** | |
* Fired by {@link CopyPaste} plugin after reaching the copy limit while copying data. This hook is fired when | |
* {@link Options#copyPaste} option is enabled. | |
* | |
* @event Hooks#afterCopyLimit | |
* @param {number} selectedRows Count of selected copyable rows. | |
* @param {number} selectedColumns Count of selected copyable columns. | |
* @param {number} copyRowsLimit Current copy rows limit. | |
* @param {number} copyColumnsLimit Current copy columns limit. | |
*/ | |
'afterCopyLimit', | |
/** | |
* Fired before created a new column. | |
* | |
* @event Hooks#beforeCreateCol | |
* @param {number} index Represents the visual index of first newly created column in the data source array. | |
* @param {number} amount Number of newly created columns in the data source array. | |
* @param {string} [source] String that identifies source of hook call | |
* ([list of all available sources](@/guides/getting-started/events-and-hooks.md#definition-for-source-argument)). | |
* @returns {*} If `false` then creating columns is cancelled. | |
* @example | |
* ```js | |
* // Return `false` to cancel column inserting. | |
* new Handsontable(element, { | |
* beforeCreateCol: function(data, coords) { | |
* return false; | |
* } | |
* }); | |
* ``` | |
*/ | |
'beforeCreateCol', | |
/** | |
* Fired after created a new column. | |
* | |
* @event Hooks#afterCreateCol | |
* @param {number} index Represents the visual index of first newly created column in the data source. | |
* @param {number} amount Number of newly created columns in the data source. | |
* @param {string} [source] String that identifies source of hook call | |
* ([list of all available sources](@/guides/getting-started/events-and-hooks.md#definition-for-source-argument)). | |
*/ | |
'afterCreateCol', | |
/** | |
* Fired before created a new row. | |
* | |
* @event Hooks#beforeCreateRow | |
* @param {number} index Represents the visual index of first newly created row in the data source array. | |
* @param {number} amount Number of newly created rows in the data source array. | |
* @param {string} [source] String that identifies source of hook call | |
* ([list of all available sources](@/guides/getting-started/events-and-hooks.md#definition-for-source-argument)). | |
* @returns {*|boolean} If false is returned the action is canceled. | |
*/ | |
'beforeCreateRow', | |
/** | |
* Fired after created a new row. | |
* | |
* @event Hooks#afterCreateRow | |
* @param {number} index Represents the visual index of first newly created row in the data source array. | |
* @param {number} amount Number of newly created rows in the data source array. | |
* @param {string} [source] String that identifies source of hook call | |
* ([list of all available sources](@/guides/getting-started/events-and-hooks.md#definition-for-source-argument)). | |
*/ | |
'afterCreateRow', | |
/** | |
* Fired after the current cell is deselected. | |
* | |
* @event Hooks#afterDeselect | |
*/ | |
'afterDeselect', | |
/** | |
* Fired after destroying the Handsontable instance. | |
* | |
* @event Hooks#afterDestroy | |
*/ | |
'afterDestroy', | |
/** | |
* Hook fired after keydown event is handled. | |
* | |
* @event Hooks#afterDocumentKeyDown | |
* @param {Event} event A native `keydown` event object. | |
*/ | |
'afterDocumentKeyDown', | |
/** | |
* Fired inside the Walkontable's selection `draw` method. Can be used to add additional class names to cells, depending on the current selection. | |
* | |
* @event Hooks#afterDrawSelection | |
* @param {number} currentRow Row index of the currently processed cell. | |
* @param {number} currentColumn Column index of the currently cell. | |
* @param {number[]} cornersOfSelection Array of the current selection in a form of `[startRow, startColumn, endRow, endColumn]`. | |
* @param {number|undefined} layerLevel Number indicating which layer of selection is currently processed. | |
* @since 0.38.1 | |
* @returns {string|undefined} Can return a `String`, which will act as an additional `className` to be added to the currently processed cell. | |
*/ | |
'afterDrawSelection', | |
/** | |
* Fired inside the Walkontable's `refreshSelections` method. Can be used to remove additional class names from all cells in the table. | |
* | |
* @event Hooks#beforeRemoveCellClassNames | |
* @since 0.38.1 | |
* @returns {string[]|undefined} Can return an `Array` of `String`s. Each of these strings will act like class names to be removed from all the cells in the table. | |
*/ | |
'beforeRemoveCellClassNames', | |
/** | |
* Fired after getting the cell settings. | |
* | |
* @event Hooks#afterGetCellMeta | |
* @param {number} row Visual row index. | |
* @param {number} column Visual column index. | |
* @param {object} cellProperties Object containing the cell properties. | |
*/ | |
'afterGetCellMeta', | |
/** | |
* Fired after retrieving information about a column header and appending it to the table header. | |
* | |
* @event Hooks#afterGetColHeader | |
* @param {number} column Visual column index. | |
* @param {HTMLTableCellElement} TH Header's TH element. | |
*/ | |
'afterGetColHeader', | |
/** | |
* Fired after retrieving information about a row header and appending it to the table header. | |
* | |
* @event Hooks#afterGetRowHeader | |
* @param {number} row Visual row index. | |
* @param {HTMLTableCellElement} TH Header's TH element. | |
*/ | |
'afterGetRowHeader', | |
/** | |
* Fired after the Handsontable instance is initiated. | |
* | |
* @event Hooks#afterInit | |
*/ | |
'afterInit', | |
/** | |
* Fired after Handsontable's [`data`](@/api/options.md#data) | |
* gets modified by the [`loadData()`](@/api/core.md#loaddata) method | |
* or the [`updateSettings()`](@/api/core.md#updatesettings) method. | |
* | |
* Read more: | |
* - [Binding to data →](@/guides/getting-started/binding-to-data.md) | |
* - [Saving data →](@/guides/getting-started/saving-data.md) | |
* | |
* @event Hooks#afterLoadData | |
* @param {Array} sourceData An [array of arrays](@/guides/getting-started/binding-to-data.md#array-of-arrays), or an [array of objects](@/guides/getting-started/binding-to-data.md#array-of-objects), that contains Handsontable's data | |
* @param {boolean} initialLoad A flag that indicates whether the data was loaded at Handsontable's initialization (`true`) or later (`false`) | |
* @param {string} source The source of the call | |
*/ | |
'afterLoadData', | |
/** | |
* Fired after the [`updateData()`](@/api/core.md#updatedata) method | |
* modifies Handsontable's [`data`](@/api/options.md#data). | |
* | |
* Read more: | |
* - [Binding to data →](@/guides/getting-started/binding-to-data.md) | |
* - [Saving data →](@/guides/getting-started/saving-data.md) | |
* | |
* @event Hooks#afterUpdateData | |
* @since 11.1.0 | |
* @param {Array} sourceData An [array of arrays](@/guides/getting-started/binding-to-data.md#array-of-arrays), or an [array of objects](@/guides/getting-started/binding-to-data.md#array-of-objects), that contains Handsontable's data | |
* @param {boolean} initialLoad A flag that indicates whether the data was loaded at Handsontable's initialization (`true`) or later (`false`) | |
* @param {string} source The source of the call | |
*/ | |
'afterUpdateData', | |
/** | |
* Fired after a scroll event, which is identified as a momentum scroll (e.g. On an iPad). | |
* | |
* @event Hooks#afterMomentumScroll | |
*/ | |
'afterMomentumScroll', | |
/** | |
* Fired after a `mousedown` event is triggered on the cell corner (the drag handle). | |
* | |
* @event Hooks#afterOnCellCornerMouseDown | |
* @param {Event} event `mousedown` event object. | |
*/ | |
'afterOnCellCornerMouseDown', | |
/** | |
* Fired after a `dblclick` event is triggered on the cell corner (the drag handle). | |
* | |
* @event Hooks#afterOnCellCornerDblClick | |
* @param {Event} event `dblclick` event object. | |
*/ | |
'afterOnCellCornerDblClick', | |
/** | |
* Fired after clicking on a cell or row/column header. In case the row/column header was clicked, the coordinate | |
* indexes are negative. | |
* | |
* For example clicking on the row header of cell (0, 0) results with `afterOnCellMouseDown` called | |
* with coordinates `{row: 0, col: -1}`. | |
* | |
* @event Hooks#afterOnCellMouseDown | |
* @param {Event} event `mousedown` event object. | |
* @param {CellCoords} coords Coordinates object containing the visual row and visual column indexes of the clicked cell. | |
* @param {HTMLTableCellElement} TD Cell's TD (or TH) element. | |
*/ | |
'afterOnCellMouseDown', | |
/** | |
* Fired after clicking on a cell or row/column header. In case the row/column header was clicked, the coordinate | |
* indexes are negative. | |
* | |
* For example clicking on the row header of cell (0, 0) results with `afterOnCellMouseUp` called | |
* with coordinates `{row: 0, col: -1}`. | |
* | |
* @event Hooks#afterOnCellMouseUp | |
* @param {Event} event `mouseup` event object. | |
* @param {CellCoords} coords Coordinates object containing the visual row and visual column indexes of the clicked cell. | |
* @param {HTMLTableCellElement} TD Cell's TD (or TH) element. | |
*/ | |
'afterOnCellMouseUp', | |
/** | |
* Fired after clicking right mouse button on a cell or row/column header. | |
* | |
* For example clicking on the row header of cell (0, 0) results with `afterOnCellContextMenu` called | |
* with coordinates `{row: 0, col: -1}`. | |
* | |
* @event Hooks#afterOnCellContextMenu | |
* @since 4.1.0 | |
* @param {Event} event `contextmenu` event object. | |
* @param {CellCoords} coords Coordinates object containing the visual row and visual column indexes of the clicked cell. | |
* @param {HTMLTableCellElement} TD Cell's TD (or TH) element. | |
*/ | |
'afterOnCellContextMenu', | |
/** | |
* Fired after hovering a cell or row/column header with the mouse cursor. In case the row/column header was | |
* hovered, the index is negative. | |
* | |
* For example, hovering over the row header of cell (0, 0) results with `afterOnCellMouseOver` called | |
* with coords `{row: 0, col: -1}`. | |
* | |
* @event Hooks#afterOnCellMouseOver | |
* @param {Event} event `mouseover` event object. | |
* @param {CellCoords} coords Hovered cell's visual coordinate object. | |
* @param {HTMLTableCellElement} TD Cell's TD (or TH) element. | |
*/ | |
'afterOnCellMouseOver', | |
/** | |
* Fired after leaving a cell or row/column header with the mouse cursor. | |
* | |
* @event Hooks#afterOnCellMouseOut | |
* @param {Event} event `mouseout` event object. | |
* @param {CellCoords} coords Leaved cell's visual coordinate object. | |
* @param {HTMLTableCellElement} TD Cell's TD (or TH) element. | |
*/ | |
'afterOnCellMouseOut', | |
/** | |
* Fired after one or more columns are removed. | |
* | |
* @event Hooks#afterRemoveCol | |
* @param {number} index Visual index of starter column. | |
* @param {number} amount An amount of removed columns. | |
* @param {number[]} physicalColumns An array of physical columns removed from the data source. | |
* @param {string} [source] String that identifies source of hook call | |
* ([list of all available sources](@/guides/getting-started/events-and-hooks.md#definition-for-source-argument)). | |
*/ | |
'afterRemoveCol', | |
/** | |
* Fired after one or more rows are removed. | |
* | |
* @event Hooks#afterRemoveRow | |
* @param {number} index Visual index of starter row. | |
* @param {number} amount An amount of removed rows. | |
* @param {number[]} physicalRows An array of physical rows removed from the data source. | |
* @param {string} [source] String that identifies source of hook call | |
* ([list of all available sources](@/guides/getting-started/events-and-hooks.md#definition-for-source-argument)). | |
*/ | |
'afterRemoveRow', | |
/** | |
* Fired before starting rendering the cell. | |
* | |
* @event Hooks#beforeRenderer | |
* @param {HTMLTableCellElement} TD Currently rendered cell's TD element. | |
* @param {number} row Visual row index. | |
* @param {number} column Visual column index. | |
* @param {string|number} prop Column property name or a column index, if datasource is an array of arrays. | |
* @param {*} value Value of the rendered cell. | |
* @param {object} cellProperties Object containing the cell's properties. | |
*/ | |
'beforeRenderer', | |
/** | |
* Fired after finishing rendering the cell (after the renderer finishes). | |
* | |
* @event Hooks#afterRenderer | |
* @param {HTMLTableCellElement} TD Currently rendered cell's TD element. | |
* @param {number} row Visual row index. | |
* @param {number} column Visual column index. | |
* @param {string|number} prop Column property name or a column index, if datasource is an array of arrays. | |
* @param {*} value Value of the rendered cell. | |
* @param {object} cellProperties Object containing the cell's properties. | |
*/ | |
'afterRenderer', | |
/** | |
* Fired after the horizontal scroll event. | |
* | |
* @event Hooks#afterScrollHorizontally | |
*/ | |
'afterScrollHorizontally', | |
/** | |
* Fired after the vertical scroll event. | |
* | |
* @event Hooks#afterScrollVertically | |
*/ | |
'afterScrollVertically', | |
/** | |
* Fired after one or more cells are selected (e.g. During mouse move). | |
* | |
* @event Hooks#afterSelection | |
* @param {number} row Selection start visual row index. | |
* @param {number} column Selection start visual column index. | |
* @param {number} row2 Selection end visual row index. | |
* @param {number} column2 Selection end visual column index. | |
* @param {object} preventScrolling A reference to the observable object with the `value` property. | |
* Property `preventScrolling.value` expects a boolean value that | |
* Handsontable uses to control scroll behavior after selection. | |
* @param {object} preventScrolling Object with `value` property where its value change will be observed. | |
* @param {number} selectionLayerLevel The number which indicates what selection layer is currently modified. | |
* @example | |
* ```js | |
* new Handsontable(element, { | |
* afterSelection: (row, column, row2, column2, preventScrolling, selectionLayerLevel) => { | |
* // If set to `false` (default): when cell selection is outside the viewport, | |
* // Handsontable scrolls the viewport to cell selection's end corner. | |
* // If set to `true`: when cell selection is outside the viewport, | |
* // Handsontable doesn't scroll to cell selection's end corner. | |
* preventScrolling.value = true; | |
* } | |
* }) | |
* ``` | |
*/ | |
'afterSelection', | |
/** | |
* Fired after one or more cells are selected. | |
* | |
* The `prop` and `prop2` arguments represent the source object property name instead of the column number. | |
* | |
* @event Hooks#afterSelectionByProp | |
* @param {number} row Selection start visual row index. | |
* @param {string} prop Selection start data source object property name. | |
* @param {number} row2 Selection end visual row index. | |
* @param {string} prop2 Selection end data source object property name. | |
* @param {object} preventScrolling Object with `value` property where its value change will be observed. | |
* @param {number} selectionLayerLevel The number which indicates what selection layer is currently modified. | |
* @example | |
* ```js | |
* new Handsontable(element, { | |
* afterSelectionByProp: (row, column, row2, column2, preventScrolling, selectionLayerLevel) => { | |
* // setting if prevent scrolling after selection | |
* preventScrolling.value = true; | |
* } | |
* }) | |
* ``` | |
*/ | |
'afterSelectionByProp', | |
/** | |
* Fired after one or more cells are selected (e.g. On mouse up). | |
* | |
* @event Hooks#afterSelectionEnd | |
* @param {number} row Selection start visual row index. | |
* @param {number} column Selection start visual column index. | |
* @param {number} row2 Selection end visual row index. | |
* @param {number} column2 Selection end visual column index. | |
* @param {number} selectionLayerLevel The number which indicates what selection layer is currently modified. | |
*/ | |
'afterSelectionEnd', | |
/** | |
* Fired after one or more cells are selected (e.g. On mouse up). | |
* | |
* The `prop` and `prop2` arguments represent the source object property name instead of the column number. | |
* | |
* @event Hooks#afterSelectionEndByProp | |
* @param {number} row Selection start visual row index. | |
* @param {string} prop Selection start data source object property index. | |
* @param {number} row2 Selection end visual row index. | |
* @param {string} prop2 Selection end data source object property index. | |
* @param {number} selectionLayerLevel The number which indicates what selection layer is currently modified. | |
*/ | |
'afterSelectionEndByProp', | |
/** | |
* Fired after cell meta is changed. | |
* | |
* @event Hooks#afterSetCellMeta | |
* @param {number} row Visual row index. | |
* @param {number} column Visual column index. | |
* @param {string} key The updated meta key. | |
* @param {*} value The updated meta value. | |
*/ | |
'afterSetCellMeta', | |
/** | |
* Fired after cell meta is removed. | |
* | |
* @event Hooks#afterRemoveCellMeta | |
* @param {number} row Visual row index. | |
* @param {number} column Visual column index. | |
* @param {string} key The removed meta key. | |
* @param {*} value Value which was under removed key of cell meta. | |
*/ | |
'afterRemoveCellMeta', | |
/** | |
* Fired after cell data was changed. | |
* | |
* @event Hooks#afterSetDataAtCell | |
* @param {Array} changes An array of changes in format `[[row, column, oldValue, value], ...]`. | |
* @param {string} [source] String that identifies source of hook call | |
* ([list of all available sources](@/guides/getting-started/events-and-hooks.md#definition-for-source-argument)). | |
*/ | |
'afterSetDataAtCell', | |
/** | |
* Fired after cell data was changed. | |
* Called only when `setDataAtRowProp` was executed. | |
* | |
* @event Hooks#afterSetDataAtRowProp | |
* @param {Array} changes An array of changes in format `[[row, prop, oldValue, value], ...]`. | |
* @param {string} [source] String that identifies source of hook call | |
* ([list of all available sources](@/guides/getting-started/events-and-hooks.md#definition-for-source-argument)). | |
*/ | |
'afterSetDataAtRowProp', | |
/** | |
* Fired after cell source data was changed. | |
* | |
* @event Hooks#afterSetSourceDataAtCell | |
* @since 8.0.0 | |
* @param {Array} changes An array of changes in format `[[row, column, oldValue, value], ...]`. | |
* @param {string} [source] String that identifies source of hook call. | |
*/ | |
'afterSetSourceDataAtCell', | |
/** | |
* Fired after calling the `updateSettings` method. | |
* | |
* @event Hooks#afterUpdateSettings | |
* @param {object} newSettings New settings object. | |
*/ | |
'afterUpdateSettings', | |
/** | |
* @description | |
* A plugin hook executed after validator function, only if validator function is defined. | |
* Validation result is the first parameter. This can be used to determinate if validation passed successfully or not. | |
* | |
* __Returning false from the callback will mark the cell as invalid__. | |
* | |
* @event Hooks#afterValidate | |
* @param {boolean} isValid `true` if valid, `false` if not. | |
* @param {*} value The value in question. | |
* @param {number} row Visual row index. | |
* @param {string|number} prop Property name / visual column index. | |
* @param {string} [source] String that identifies source of hook call | |
* ([list of all available sources](@/guides/getting-started/events-and-hooks.md#definition-for-source-argument)). | |
* @returns {void | boolean} If `false` the cell will be marked as invalid, `true` otherwise. | |
*/ | |
'afterValidate', | |
/** | |
* Fired before successful change of language (when proper language code was set). | |
* | |
* @event Hooks#beforeLanguageChange | |
* @since 0.35.0 | |
* @param {string} languageCode New language code. | |
*/ | |
'beforeLanguageChange', | |
/** | |
* Fired after successful change of language (when proper language code was set). | |
* | |
* @event Hooks#afterLanguageChange | |
* @since 0.35.0 | |
* @param {string} languageCode New language code. | |
*/ | |
'afterLanguageChange', | |
/** | |
* Fired by {@link Autofill} plugin before populating the data in the autofill feature. This hook is fired when | |
* {@link Options#fillHandle} option is enabled. | |
* | |
* @event Hooks#beforeAutofill | |
* @param {Array[]} selectionData Data the autofill operation will start from. | |
* @param {CellRange} sourceRange The range values will be filled from. | |
* @param {CellRange} targetRange The range new values will be filled into. | |
* @param {string} direction Declares the direction of the autofill. Possible values: `up`, `down`, `left`, `right`. | |
* | |
* @returns {boolean|Array[]} If false, the operation is cancelled. If array of arrays, the returned data | |
* will be passed into `populateFromArray` instead of the default autofill | |
* algorithm's result. | |
*/ | |
'beforeAutofill', | |
/** | |
* Fired by {@link Autofill} plugin after populating the data in the autofill feature. This hook is fired when | |
* {@link Options#fillHandle} option is enabled. | |
* | |
* @event Hooks#afterAutofill | |
* @since 8.0.0 | |
* @param {Array[]} fillData The data that was used to fill the `targetRange`. If `beforeAutofill` was used | |
* and returned `[[]]`, this will be the same object that was returned from `beforeAutofill`. | |
* @param {CellRange} sourceRange The range values will be filled from. | |
* @param {CellRange} targetRange The range new values will be filled into. | |
* @param {string} direction Declares the direction of the autofill. Possible values: `up`, `down`, `left`, `right`. | |
*/ | |
'afterAutofill', | |
/** | |
* Fired before aligning the cell contents. | |
* | |
* @event Hooks#beforeCellAlignment | |
* @param {object} stateBefore An object with class names defining the cell alignment. | |
* @param {CellRange[]} range An array of CellRange coordinates where the alignment will be applied. | |
* @param {string} type Type of the alignment - either `horizontal` or `vertical`. | |
* @param {string} alignmentClass String defining the alignment class added to the cell. | |
* Possible values: | |
* * `htLeft` | |
* * `htCenter` | |
* * `htRight` | |
* * `htJustify` | |
* * `htTop` | |
* * `htMiddle` | |
* * `htBottom`. | |
*/ | |
'beforeCellAlignment', | |
/** | |
* Fired before one or more cells is changed. Its main purpose is to alter changes silently after input and before | |
* table rendering. | |
* | |
* @event Hooks#beforeChange | |
* @param {Array[]} changes 2D array containing information about each of the edited cells. | |
* @param {string} [source] String that identifies source of hook call | |
* ([list of all available sources](@/guides/getting-started/events-and-hooks.md#definition-for-source-argument)). | |
* @returns {void | boolean} If `false` all changes were cancelled, `true` otherwise. | |
* @example | |
* ```js | |
* // To disregard a single change, set changes[i] to null or remove it from array using changes.splice(i, 1). | |
* new Handsontable(element, { | |
* beforeChange: (changes, source) => { | |
* // [[row, prop, oldVal, newVal], ...] | |
* changes[0] = null; | |
* } | |
* }); | |
* // To alter a single change, overwrite the desired value to changes[i][3]. | |
* new Handsontable(element, { | |
* beforeChange: (changes, source) => { | |
* // [[row, prop, oldVal, newVal], ...] | |
* changes[0][3] = 10; | |
* } | |
* }); | |
* // To cancel all edit, return false from the callback or set array length to 0 (changes.length = 0). | |
* new Handsontable(element, { | |
* beforeChange: (changes, source) => { | |
* // [[row, prop, oldVal, newVal], ...] | |
* return false; | |
* } | |
* }); | |
* ``` | |
*/ | |
'beforeChange', | |
/** | |
* Fired right before rendering the changes. | |
* | |
* @event Hooks#beforeChangeRender | |
* @param {Array[]} changes Array in form of `[row, prop, oldValue, newValue]`. | |
* @param {string} [source] String that identifies source of hook call | |
* ([list of all available sources](@/guides/getting-started/events-and-hooks.md#definition-for-source-argument)). | |
*/ | |
'beforeChangeRender', | |
/** | |
* Fired before drawing the borders. | |
* | |
* @event Hooks#beforeDrawBorders | |
* @param {Array} corners Array specifying the current selection borders. | |
* @param {string} borderClassName Specifies the border class name. | |
*/ | |
'beforeDrawBorders', | |
/** | |
* Fired before getting cell settings. | |
* | |
* @event Hooks#beforeGetCellMeta | |
* @param {number} row Visual row index. | |
* @param {number} column Visual column index. | |
* @param {object} cellProperties Object containing the cell's properties. | |
*/ | |
'beforeGetCellMeta', | |
/** | |
* Fired before cell meta is removed. | |
* | |
* @event Hooks#beforeRemoveCellMeta | |
* @param {number} row Visual row index. | |
* @param {number} column Visual column index. | |
* @param {string} key The removed meta key. | |
* @param {*} value Value which is under removed key of cell meta. | |
* @returns {*|boolean} If false is returned the action is canceled. | |
*/ | |
'beforeRemoveCellMeta', | |
/** | |
* Fired before the Handsontable instance is initiated. | |
* | |
* @event Hooks#beforeInit | |
*/ | |
'beforeInit', | |
/** | |
* Fired before the Walkontable instance is initiated. | |
* | |
* @event Hooks#beforeInitWalkontable | |
* @param {object} walkontableConfig Walkontable configuration object. | |
*/ | |
'beforeInitWalkontable', | |
/** | |
* Fired before Handsontable's [`data`](@/api/options.md#data) | |
* gets modified by the [`loadData()`](@/api/core.md#loaddata) method | |
* or the [`updateSettings()`](@/api/core.md#updatesettings) method. | |
* | |
* Read more: | |
* - [Binding to data →](@/guides/getting-started/binding-to-data.md) | |
* - [Saving data →](@/guides/getting-started/saving-data.md) | |
* | |
* @event Hooks#beforeLoadData | |
* @since 8.0.0 | |
* @param {Array} sourceData An [array of arrays](@/guides/getting-started/binding-to-data.md#array-of-arrays), or an [array of objects](@/guides/getting-started/binding-to-data.md#array-of-objects), that contains Handsontable's data | |
* @param {boolean} initialLoad A flag that indicates whether the data was loaded at Handsontable's initialization (`true`) or later (`false`) | |
* @param {string} source The source of the call | |
* @returns {Array} The returned array will be used as Handsontable's new dataset. | |
*/ | |
'beforeLoadData', | |
/** | |
* Fired before the [`updateData()`](@/api/core.md#updatedata) method | |
* modifies Handsontable's [`data`](@/api/options.md#data). | |
* | |
* Read more: | |
* - [Binding to data →](@/guides/getting-started/binding-to-data.md) | |
* - [Saving data →](@/guides/getting-started/saving-data.md) | |
* | |
* @event Hooks#beforeUpdateData | |
* @since 11.1.0 | |
* @param {Array} sourceData An [array of arrays](@/guides/getting-started/binding-to-data.md#array-of-arrays), or an [array of objects](@/guides/getting-started/binding-to-data.md#array-of-objects), that contains Handsontable's data | |
* @param {boolean} initialLoad A flag that indicates whether the data was loaded at Handsontable's initialization (`true`) or later (`false`) | |
* @param {string} source The source of the call | |
* @returns {Array} The returned array will be used as Handsontable's new dataset. | |
*/ | |
'beforeUpdateData', | |
/** | |
* Hook fired before keydown event is handled. It can be used to stop default key bindings. | |
* | |
* __Note__: To prevent default behavior you need to call `false` in your `beforeKeyDown` handler. | |
* | |
* @event Hooks#beforeKeyDown | |
* @param {Event} event Original DOM event. | |
*/ | |
'beforeKeyDown', | |
/** | |
* Fired after the user clicked a cell, but before all the calculations related with it. | |
* | |
* @event Hooks#beforeOnCellMouseDown | |
* @param {Event} event The `mousedown` event object. | |
* @param {CellCoords} coords Cell coords object containing the visual coordinates of the clicked cell. | |
* @param {HTMLTableCellElement} TD TD element. | |
* @param {object} controller An object with properties `row`, `column` and `cell`. Each property contains | |
* a boolean value that allows or disallows changing the selection for that particular area. | |
*/ | |
'beforeOnCellMouseDown', | |
/** | |
* Fired after the user clicked a cell. | |
* | |
* @event Hooks#beforeOnCellMouseUp | |
* @param {Event} event The `mouseup` event object. | |
* @param {CellCoords} coords Cell coords object containing the visual coordinates of the clicked cell. | |
* @param {HTMLTableCellElement} TD TD element. | |
*/ | |
'beforeOnCellMouseUp', | |
/** | |
* Fired after the user clicked a cell, but before all the calculations related with it. | |
* | |
* @event Hooks#beforeOnCellContextMenu | |
* @since 4.1.0 | |
* @param {Event} event The `contextmenu` event object. | |
* @param {CellCoords} coords Cell coords object containing the visual coordinates of the clicked cell. | |
* @param {HTMLTableCellElement} TD TD element. | |
*/ | |
'beforeOnCellContextMenu', | |
/** | |
* Fired after the user moved cursor over a cell, but before all the calculations related with it. | |
* | |
* @event Hooks#beforeOnCellMouseOver | |
* @param {Event} event The `mouseover` event object. | |
* @param {CellCoords} coords CellCoords object containing the visual coordinates of the clicked cell. | |
* @param {HTMLTableCellElement} TD TD element. | |
* @param {object} controller An object with properties `row`, `column` and `cell`. Each property contains | |
* a boolean value that allows or disallows changing the selection for that particular area. | |
*/ | |
'beforeOnCellMouseOver', | |
/** | |
* Fired after the user moved cursor out from a cell, but before all the calculations related with it. | |
* | |
* @event Hooks#beforeOnCellMouseOut | |
* @param {Event} event The `mouseout` event object. | |
* @param {CellCoords} coords CellCoords object containing the visual coordinates of the leaved cell. | |
* @param {HTMLTableCellElement} TD TD element. | |
*/ | |
'beforeOnCellMouseOut', | |
/** | |
* Fired before one or more columns are about to be removed. | |
* | |
* @event Hooks#beforeRemoveCol | |
* @param {number} index Visual index of starter column. | |
* @param {number} amount Amount of columns to be removed. | |
* @param {number[]} physicalColumns An array of physical columns removed from the data source. | |
* @param {string} [source] String that identifies source of hook call | |
* ([list of all available sources](@/guides/getting-started/events-and-hooks.md#definition-for-source-argument)). | |
* @returns {*|boolean} If false is returned the action is canceled. | |
*/ | |
'beforeRemoveCol', | |
/** | |
* Fired when one or more rows are about to be removed. | |
* | |
* @event Hooks#beforeRemoveRow | |
* @param {number} index Visual index of starter row. | |
* @param {number} amount Amount of rows to be removed. | |
* @param {number[]} physicalRows An array of physical rows removed from the data source. | |
* @param {string} [source] String that identifies source of hook call | |
* ([list of all available sources](@/guides/getting-started/events-and-hooks.md#definition-for-source-argument)). | |
* @returns {*|boolean} If false is returned the action is canceled. | |
*/ | |
'beforeRemoveRow', | |
/** | |
* Fired before Handsontable's view-rendering engine is rendered. | |
* | |
* __Note:__ In Handsontable 9.x and earlier, the `beforeViewRender` hook was named `beforeRender`. | |
* | |
* @event Hooks#beforeViewRender | |
* @since 10.0.0 | |
* @param {boolean} isForced If set to `true`, the rendering gets triggered by a change of settings, a change of | |
* data, or a logic that needs a full Handsontable render cycle. | |
* If set to `false`, the rendering gets triggered by scrolling or moving the selection. | |
* @param {object} skipRender Object with `skipRender` property, if it is set to `true ` the next rendering cycle will be skipped. | |
*/ | |
'beforeViewRender', | |
/** | |
* Fired after Handsontable's view-rendering engine is rendered, | |
* but before redrawing the selection borders and before scroll syncing. | |
* | |
* __Note:__ In Handsontable 9.x and earlier, the `afterViewRender` hook was named `afterRender`. | |
* | |
* @event Hooks#afterViewRender | |
* @since 10.0.0 | |
* @param {boolean} isForced If set to `true`, the rendering gets triggered by a change of settings, a change of | |
* data, or a logic that needs a full Handsontable render cycle. | |
* If set to `false`, the rendering gets triggered by scrolling or moving the selection. | |
*/ | |
'afterViewRender', | |
/** | |
* Fired before Handsontable's view-rendering engine updates the view. | |
* | |
* The `beforeRender` event is fired right after the Handsontable | |
* business logic is executed and right before the rendering engine starts calling | |
* the Core logic, renderers, cell meta objects etc. to update the view. | |
* | |
* @event Hooks#beforeRender | |
* @param {boolean} isForced If set to `true`, the rendering gets triggered by a change of settings, a change of | |
* data, or a logic that needs a full Handsontable render cycle. | |
* If set to `false`, the rendering gets triggered by scrolling or moving the selection. | |
*/ | |
'beforeRender', | |
/** | |
* Fired after Handsontable's view-rendering engine updates the view. | |
* | |
* @event Hooks#afterRender | |
* @param {boolean} isForced If set to `true`, the rendering gets triggered by a change of settings, a change of | |
* data, or a logic that needs a full Handsontable render cycle. | |
* If set to `false`, the rendering gets triggered by scrolling or moving the selection. | |
*/ | |
'afterRender', | |
/** | |
* Fired before cell meta is changed. | |
* | |
* @event Hooks#beforeSetCellMeta | |
* @since 8.0.0 | |
* @param {number} row Visual row index. | |
* @param {number} column Visual column index. | |
* @param {string} key The updated meta key. | |
* @param {*} value The updated meta value. | |
* @returns {*|boolean} If false is returned the action is canceled. | |
*/ | |
'beforeSetCellMeta', | |
/** | |
* Fired before setting range is started but not finished yet. | |
* | |
* @event Hooks#beforeSetRangeStartOnly | |
* @param {CellCoords} coords CellCoords instance. | |
*/ | |
'beforeSetRangeStartOnly', | |
/** | |
* Fired before setting range is started. | |
* | |
* @event Hooks#beforeSetRangeStart | |
* @param {CellCoords} coords CellCoords instance. | |
*/ | |
'beforeSetRangeStart', | |
/** | |
* Fired before setting range is ended. | |
* | |
* @event Hooks#beforeSetRangeEnd | |
* @param {CellCoords} coords CellCoords instance. | |
*/ | |
'beforeSetRangeEnd', | |
/** | |
* Fired before the logic of handling a touch scroll, when user started scrolling on a touch-enabled device. | |
* | |
* @event Hooks#beforeTouchScroll | |
*/ | |
'beforeTouchScroll', | |
/** | |
* Fired before cell validation, only if validator function is defined. This can be used to manipulate the value | |
* of changed cell before it is applied to the validator function. | |
* | |
* __Note:__ this will not affect values of changes. This will change value *ONLY* for validation. | |
* | |
* @event Hooks#beforeValidate | |
* @param {*} value Value of the cell. | |
* @param {number} row Visual row index. | |
* @param {string|number} prop Property name / column index. | |
* @param {string} [source] String that identifies source of hook call | |
* ([list of all available sources](@/guides/getting-started/events-and-hooks.md#definition-for-source-argument)). | |
*/ | |
'beforeValidate', | |
/** | |
* Fired before cell value is rendered into the DOM (through renderer function). This can be used to manipulate the | |
* value which is passed to the renderer without modifying the renderer itself. | |
* | |
* @event Hooks#beforeValueRender | |
* @param {*} value Cell value to render. | |
* @param {object} cellProperties An object containing the cell properties. | |
*/ | |
'beforeValueRender', | |
/** | |
* Fired after Handsontable instance is constructed (using `new` operator). | |
* | |
* @event Hooks#construct | |
*/ | |
'construct', | |
/** | |
* Fired after Handsontable instance is initiated but before table is rendered. | |
* | |
* @event Hooks#init | |
*/ | |
'init', | |
/** | |
* Fired when a column header index is about to be modified by a callback function. | |
* | |
* @event Hooks#modifyColHeader | |
* @param {number} column Visual column header index. | |
*/ | |
'modifyColHeader', | |
/** | |
* Fired when a column width is about to be modified by a callback function. | |
* | |
* @event Hooks#modifyColWidth | |
* @param {number} width Current column width. | |
* @param {number} column Visual column index. | |
*/ | |
'modifyColWidth', | |
/** | |
* Fired when a row header index is about to be modified by a callback function. | |
* | |
* @event Hooks#modifyRowHeader | |
* @param {number} row Visual row header index. | |
*/ | |
'modifyRowHeader', | |
/** | |
* Fired when a row height is about to be modified by a callback function. | |
* | |
* @event Hooks#modifyRowHeight | |
* @param {number} height Row height. | |
* @param {number} row Visual row index. | |
*/ | |
'modifyRowHeight', | |
/** | |
* Fired when a data was retrieved or modified. | |
* | |
* @event Hooks#modifyData | |
* @param {number} row Physical row height. | |
* @param {number} column Physical column index. | |
* @param {object} valueHolder Object which contains original value which can be modified by overwriting `.value` property. | |
* @param {string} ioMode String which indicates for what operation hook is fired (`get` or `set`). | |
*/ | |
'modifyData', | |
/** | |
* Fired when a data was retrieved or modified from the source data set. | |
* | |
* @event Hooks#modifySourceData | |
* @since 8.0.0 | |
* @param {number} row Physical row index. | |
* @param {number} column Physical column index. | |
* @param {object} valueHolder Object which contains original value which can be modified by overwriting `.value` property. | |
* @param {string} ioMode String which indicates for what operation hook is fired (`get` or `set`). | |
*/ | |
'modifySourceData', | |
/** | |
* Fired when a data was retrieved or modified. | |
* | |
* @event Hooks#modifyRowData | |
* @param {number} row Physical row index. | |
*/ | |
'modifyRowData', | |
/** | |
* Used to modify the cell coordinates when using the `getCell` method, opening editor, getting value from the editor | |
* and saving values from the closed editor. | |
* | |
* @event Hooks#modifyGetCellCoords | |
* @since 0.36.0 | |
* @param {number} row Visual row index. | |
* @param {number} column Visual column index. | |
* @param {boolean} topmost If set to `true`, it returns the TD element from the topmost overlay. For example, | |
* if the wanted cell is in the range of fixed rows, it will return a TD element | |
* from the `top` overlay. | |
*/ | |
'modifyGetCellCoords', | |
/** | |
* Allows modify the visual row index that is used to retrieve the row header element (TH) before it's | |
* highlighted (proper CSS class names are added). Modifying the visual row index allows building a custom | |
* implementation of the nested headers feature or other features that require highlighting other DOM | |
* elements than that the rendering engine, by default, would have highlighted. | |
* | |
* @event Hooks#beforeHighlightingRowHeader | |
* @since 8.4.0 | |
* @param {number} row Visual row index. | |
* @param {number} headerLevel Column header level (0 = most distant to the table). | |
* @param {object} highlightMeta An object that contains additional information about processed selection. | |
* @returns {number|undefined} | |
*/ | |
'beforeHighlightingRowHeader', | |
/** | |
* Allows modify the visual column index that is used to retrieve the column header element (TH) before it's | |
* highlighted (proper CSS class names are added). Modifying the visual column index allows building a custom | |
* implementation of the nested headers feature or other features that require highlighting other DOM | |
* elements than that the rendering engine, by default, would have highlighted. | |
* | |
* @event Hooks#beforeHighlightingColumnHeader | |
* @since 8.4.0 | |
* @param {number} column Visual column index. | |
* @param {number} headerLevel Row header level (0 = most distant to the table). | |
* @param {object} highlightMeta An object that contains additional information about processed selection. | |
* @returns {number|undefined} | |
*/ | |
'beforeHighlightingColumnHeader', | |
/** | |
* Fired by {@link PersistentState} plugin, after loading value, saved under given key, from browser local storage. This hook is fired when | |
* {@link Options#persistentState} option is enabled. | |
* | |
* @event Hooks#persistentStateLoad | |
* @param {string} key Key. | |
* @param {object} valuePlaceholder Object containing the loaded value under `valuePlaceholder.value` (if no value have been saved, `value` key will be undefined). | |
*/ | |
'persistentStateLoad', | |
/** | |
* Fired by {@link PersistentState} plugin after resetting data from local storage. If no key is given, all values associated with table will be cleared. | |
* This hook is fired when {@link Options#persistentState} option is enabled. | |
* | |
* @event Hooks#persistentStateReset | |
* @param {string} [key] Key. | |
*/ | |
'persistentStateReset', | |
/** | |
* Fired by {@link PersistentState} plugin, after saving value under given key in browser local storage. This hook is fired when | |
* {@link Options#persistentState} option is enabled. | |
* | |
* @event Hooks#persistentStateSave | |
* @param {string} key Key. | |
* @param {Mixed} value Value to save. | |
*/ | |
'persistentStateSave', | |
/** | |
* Fired by {@link ColumnSorting} and {@link MultiColumnSorting} plugins before sorting the column. If you return `false` value inside callback for hook, then sorting | |
* will be not applied by the Handsontable (useful for server-side sorting). | |
* | |
* This hook is fired when {@link Options#columnSorting} or {@link Options#multiColumnSorting} option is enabled. | |
* | |
* @event Hooks#beforeColumnSort | |
* @param {Array} currentSortConfig Current sort configuration (for all sorted columns). | |
* @param {Array} destinationSortConfigs Destination sort configuration (for all sorted columns). | |
* @returns {boolean | void} If `false` the column will not be sorted, `true` otherwise. | |
*/ | |
'beforeColumnSort', | |
/** | |
* Fired by {@link ColumnSorting} and {@link MultiColumnSorting} plugins after sorting the column. This hook is fired when {@link Options#columnSorting} | |
* or {@link Options#multiColumnSorting} option is enabled. | |
* | |
* @event Hooks#afterColumnSort | |
* @param {Array} currentSortConfig Current sort configuration (for all sorted columns). | |
* @param {Array} destinationSortConfigs Destination sort configuration (for all sorted columns). | |
*/ | |
'afterColumnSort', | |
/** | |
* Fired by {@link Autofill} plugin after setting range of autofill. This hook is fired when {@link Options#fillHandle} | |
* option is enabled. | |
* | |
* @event Hooks#modifyAutofillRange | |
* @param {Array} startArea Array of visual coordinates of the starting point for the drag-down operation (`[startRow, startColumn, endRow, endColumn]`). | |
* @param {Array} entireArea Array of visual coordinates of the entire area of the drag-down operation (`[startRow, startColumn, endRow, endColumn]`). | |
*/ | |
'modifyAutofillRange', | |
/** | |
* Fired to allow modifying the copyable range with a callback function. | |
* | |
* @event Hooks#modifyCopyableRange | |
* @param {Array[]} copyableRanges Array of objects defining copyable cells. | |
*/ | |
'modifyCopyableRange', | |
/** | |
* Fired by {@link CopyPaste} plugin before copying the values into clipboard and before clearing values of | |
* the selected cells. This hook is fired when {@link Options#copyPaste} option is enabled. | |
* | |
* @event Hooks#beforeCut | |
* @param {Array[]} data An array of arrays which contains data to cut. | |
* @param {object[]} coords An array of objects with ranges of the visual indexes (`startRow`, `startCol`, `endRow`, `endCol`) | |
* which will be cut out. | |
* @returns {*} If returns `false` then operation of the cutting out is canceled. | |
* @example | |
* ```js | |
* // To disregard a single row, remove it from the array using data.splice(i, 1). | |
* new Handsontable(element, { | |
* beforeCut: function(data, coords) { | |
* // data -> [[1, 2, 3], [4, 5, 6]] | |
* data.splice(0, 1); | |
* // data -> [[4, 5, 6]] | |
* // coords -> [{startRow: 0, startCol: 0, endRow: 1, endCol: 2}] | |
* } | |
* }); | |
* // To cancel a cutting action, just return `false`. | |
* new Handsontable(element, { | |
* beforeCut: function(data, coords) { | |
* return false; | |
* } | |
* }); | |
* ``` | |
*/ | |
'beforeCut', | |
/** | |
* Fired by {@link CopyPaste} plugin after data was cut out from the table. This hook is fired when | |
* {@link Options#copyPaste} option is enabled. | |
* | |
* @event Hooks#afterCut | |
* @param {Array[]} data An array of arrays which contains the cutted out data. | |
* @param {object[]} coords An array of objects with ranges of the visual indexes (`startRow`, `startCol`, `endRow`, `endCol`) | |
* which was cut out. | |
*/ | |
'afterCut', | |
/** | |
* Fired before values are copied into clipboard. | |
* | |
* @event Hooks#beforeCopy | |
* @param {Array[]} data An array of arrays which contains data to copied. | |
* @param {object[]} coords An array of objects with ranges of the visual indexes (`startRow`, `startCol`, `endRow`, `endCol`) | |
* which will copied. | |
* @returns {*} If returns `false` then copying is canceled. | |
* | |
* @example | |
* ```js | |
* // To disregard a single row, remove it from array using data.splice(i, 1). | |
* ... | |
* new Handsontable(document.getElementById('example'), { | |
* beforeCopy: (data, coords) => { | |
* // data -> [[1, 2, 3], [4, 5, 6]] | |
* data.splice(0, 1); | |
* // data -> [[4, 5, 6]] | |
* // coords -> [{startRow: 0, startCol: 0, endRow: 1, endCol: 2}] | |
* } | |
* }); | |
* ... | |
* | |
* // To cancel copying, return false from the callback. | |
* ... | |
* new Handsontable(document.getElementById('example'), { | |
* beforeCopy: (data, coords) => { | |
* return false; | |
* } | |
* }); | |
* ... | |
* ``` | |
*/ | |
'beforeCopy', | |
/** | |
* Fired by {@link CopyPaste} plugin after data are pasted into table. This hook is fired when {@link Options#copyPaste} | |
* option is enabled. | |
* | |
* @event Hooks#afterCopy | |
* @param {Array[]} data An array of arrays which contains the copied data. | |
* @param {object[]} coords An array of objects with ranges of the visual indexes (`startRow`, `startCol`, `endRow`, `endCol`) | |
* which was copied. | |
*/ | |
'afterCopy', | |
/** | |
* Fired by {@link CopyPaste} plugin before values are pasted into table. This hook is fired when | |
* {@link Options#copyPaste} option is enabled. | |
* | |
* @event Hooks#beforePaste | |
* @param {Array[]} data An array of arrays which contains data to paste. | |
* @param {object[]} coords An array of objects with ranges of the visual indexes (`startRow`, `startCol`, `endRow`, `endCol`) | |
* that correspond to the previously selected area. | |
* @returns {*} If returns `false` then pasting is canceled. | |
* @example | |
* ```js | |
* // To disregard a single row, remove it from array using data.splice(i, 1). | |
* new Handsontable(example, { | |
* beforePaste: (data, coords) => { | |
* // data -> [[1, 2, 3], [4, 5, 6]] | |
* data.splice(0, 1); | |
* // data -> [[4, 5, 6]] | |
* // coords -> [{startRow: 0, startCol: 0, endRow: 1, endCol: 2}] | |
* } | |
* }); | |
* // To cancel pasting, return false from the callback. | |
* new Handsontable(example, { | |
* beforePaste: (data, coords) => { | |
* return false; | |
* } | |
* }); | |
* ``` | |
*/ | |
'beforePaste', | |
/** | |
* Fired by {@link CopyPaste} plugin after values are pasted into table. This hook is fired when | |
* {@link Options#copyPaste} option is enabled. | |
* | |
* @event Hooks#afterPaste | |
* @param {Array[]} data An array of arrays which contains the pasted data. | |
* @param {object[]} coords An array of objects with ranges of the visual indexes (`startRow`, `startCol`, `endRow`, `endCol`) | |
* that correspond to the previously selected area. | |
*/ | |
'afterPaste', | |
/** | |
* Fired by {@link ManualColumnMove} plugin before change order of the visual indexes. This hook is fired when | |
* {@link Options#manualColumnMove} option is enabled. | |
* | |
* @event Hooks#beforeColumnMove | |
* @param {Array} movedColumns Array of visual column indexes to be moved. | |
* @param {number} finalIndex Visual column index, being a start index for the moved columns. | |
* Points to where the elements will be placed after the moving action. | |
* To check visualization of final index please take a look at | |
* [documentation](@/guides/columns/column-moving.md). | |
* @param {number|undefined} dropIndex Visual column index, being a drop index for the moved columns. | |
* Points to where we are going to drop the moved elements. To check | |
* visualization of drop index please take a look at | |
* [documentation](@/guides/columns/column-moving.md). | |
* It's `undefined` when `dragColumns` function wasn't called. | |
* @param {boolean} movePossible Indicates if it's possible to move rows to the desired position. | |
* @returns {void | boolean} If `false` the column will not be moved, `true` otherwise. | |
*/ | |
'beforeColumnMove', | |
/** | |
* Fired by {@link ManualColumnMove} plugin after changing order of the visual indexes. | |
* This hook is fired when {@link Options#manualColumnMove} option is enabled. | |
* | |
* @event Hooks#afterColumnMove | |
* @param {Array} movedColumns Array of visual column indexes to be moved. | |
* @param {number} finalIndex Visual column index, being a start index for the moved columns. | |
* Points to where the elements will be placed after the moving action. | |
* To check visualization of final index please take a look at | |
* [documentation](@/guides/columns/column-moving.md). | |
* @param {number|undefined} dropIndex Visual column index, being a drop index for the moved columns. | |
* Points to where we are going to drop the moved elements. | |
* To check visualization of drop index please take a look at | |
* [documentation](@/guides/columns/column-moving.md). | |
* It's `undefined` when `dragColumns` function wasn't called. | |
* @param {boolean} movePossible Indicates if it was possible to move columns to the desired position. | |
* @param {boolean} orderChanged Indicates if order of columns was changed by move. | |
*/ | |
'afterColumnMove', | |
/** | |
* Fired by {@link ManualRowMove} plugin before changing the order of the visual indexes. This hook is fired when | |
* {@link Options#manualRowMove} option is enabled. | |
* | |
* @event Hooks#beforeRowMove | |
* @param {Array} movedRows Array of visual row indexes to be moved. | |
* @param {number} finalIndex Visual row index, being a start index for the moved rows. | |
* Points to where the elements will be placed after the moving action. | |
* To check visualization of final index please take a look at | |
* [documentation](@/guides/rows/row-moving.md). | |
* @param {number|undefined} dropIndex Visual row index, being a drop index for the moved rows. | |
* Points to where we are going to drop the moved elements. | |
* To check visualization of drop index please take a look at | |
* [documentation](@/guides/rows/row-moving.md). | |
* It's `undefined` when `dragRows` function wasn't called. | |
* @param {boolean} movePossible Indicates if it's possible to move rows to the desired position. | |
* @returns {*|boolean} If false is returned the action is canceled. | |
*/ | |
'beforeRowMove', | |
/** | |
* Fired by {@link ManualRowMove} plugin after changing the order of the visual indexes. | |
* This hook is fired when {@link Options#manualRowMove} option is enabled. | |
* | |
* @event Hooks#afterRowMove | |
* @param {Array} movedRows Array of visual row indexes to be moved. | |
* @param {number} finalIndex Visual row index, being a start index for the moved rows. | |
* Points to where the elements will be placed after the moving action. | |
* To check visualization of final index please take a look at | |
* [documentation](@/guides/rows/row-moving.md). | |
* @param {number|undefined} dropIndex Visual row index, being a drop index for the moved rows. | |
* Points to where we are going to drop the moved elements. | |
* To check visualization of drop index please take a look at | |
* [documentation](@/guides/rows/row-moving.md). | |
* It's `undefined` when `dragRows` function wasn't called. | |
* @param {boolean} movePossible Indicates if it was possible to move rows to the desired position. | |
* @param {boolean} orderChanged Indicates if order of rows was changed by move. | |
*/ | |
'afterRowMove', | |
/** | |
* Fired by {@link ManualColumnResize} plugin before rendering the table with modified column sizes. This hook is | |
* fired when {@link Options#manualColumnResize} option is enabled. | |
* | |
* @event Hooks#beforeColumnResize | |
* @param {number} newSize Calculated new column width. | |
* @param {number} column Visual index of the resized column. | |
* @param {boolean} isDoubleClick Flag that determines whether there was a double-click. | |
* @returns {number} Returns a new column size or `undefined`, if column size should be calculated automatically. | |
*/ | |
'beforeColumnResize', | |
/** | |
* Fired by {@link ManualColumnResize} plugin after rendering the table with modified column sizes. This hook is | |
* fired when {@link Options#manualColumnResize} option is enabled. | |
* | |
* @event Hooks#afterColumnResize | |
* @param {number} newSize Calculated new column width. | |
* @param {number} column Visual index of the resized column. | |
* @param {boolean} isDoubleClick Flag that determines whether there was a double-click. | |
*/ | |
'afterColumnResize', | |
/** | |
* Fired by {@link ManualRowResize} plugin before rendering the table with modified row sizes. This hook is | |
* fired when {@link Options#manualRowResize} option is enabled. | |
* | |
* @event Hooks#beforeRowResize | |
* @param {number} newSize Calculated new row height. | |
* @param {number} row Visual index of the resized row. | |
* @param {boolean} isDoubleClick Flag that determines whether there was a double-click. | |
* @returns {number} Returns the new row size or `undefined` if row size should be calculated automatically. | |
*/ | |
'beforeRowResize', | |
/** | |
* Fired by {@link ManualRowResize} plugin after rendering the table with modified row sizes. This hook is | |
* fired when {@link Options#manualRowResize} option is enabled. | |
* | |
* @event Hooks#afterRowResize | |
* @param {number} newSize Calculated new row height. | |
* @param {number} row Visual index of the resized row. | |
* @param {boolean} isDoubleClick Flag that determines whether there was a double-click. | |
*/ | |
'afterRowResize', | |
/** | |
* Fired after getting the column header renderers. | |
* | |
* @event Hooks#afterGetColumnHeaderRenderers | |
* @param {Function[]} renderers An array of the column header renderers. | |
*/ | |
'afterGetColumnHeaderRenderers', | |
/** | |
* Fired after getting the row header renderers. | |
* | |
* @event Hooks#afterGetRowHeaderRenderers | |
* @param {Function[]} renderers An array of the row header renderers. | |
*/ | |
'afterGetRowHeaderRenderers', | |
/** | |
* Fired before applying stretched column width to column. | |
* | |
* @event Hooks#beforeStretchingColumnWidth | |
* @param {number} stretchedWidth Calculated width. | |
* @param {number} column Visual column index. | |
* @returns {number} Returns new width which will be applied to the column element. | |
*/ | |
'beforeStretchingColumnWidth', | |
/** | |
* Fired by {@link Filters} plugin before applying [filtering](@/guides/columns/column-filter.md). | |
* This hook is fired when {@link Options#filters} option is enabled. | |
* | |
* @event Hooks#beforeFilter | |
* @param {object[]} conditionsStack An array of objects with added formulas. | |
* ```js | |
* // Example format of the conditionsStack argument: | |
* [ | |
* { | |
* column: 2, | |
* conditions: [ | |
* {name: 'begins_with', args: [['S']]} | |
* ], | |
* operation: 'conjunction' | |
* }, | |
* { | |
* column: 4, | |
* conditions: [ | |
* {name: 'not_empty', args: []} | |
* ], | |
* operation: 'conjunction' | |
* }, | |
* ] | |
* ``` | |
* @returns {boolean} If hook returns `false` value then filtering won't be applied on the UI side (server-side filtering). | |
*/ | |
'beforeFilter', | |
/** | |
* Fired by {@link Filters} plugin after applying [filtering](@/guides/columns/column-filter.md). | |
* This hook is fired when {@link Options#filters} option is enabled. | |
* | |
* @event Hooks#afterFilter | |
* @param {object[]} conditionsStack An array of objects with added conditions. | |
* ```js | |
* // Example format of the conditionsStack argument: | |
* [ | |
* { | |
* column: 2, | |
* conditions: [ | |
* {name: 'begins_with', args: [['S']]} | |
* ], | |
* operation: 'conjunction' | |
* }, | |
* { | |
* column: 4, | |
* conditions: [ | |
* {name: 'not_empty', args: []} | |
* ], | |
* operation: 'conjunction' | |
* }, | |
* ] | |
* ``` | |
*/ | |
'afterFilter', | |
/** | |
* Called when a value is updated in the engine. | |
* | |
* @since 9.0.0 | |
* @event Hooks#afterFormulasValuesUpdate | |
* @param {Array} changes The values and location of applied changes. | |
*/ | |
'afterFormulasValuesUpdate', | |
/** | |
* Called when a named expression is added to the Formulas' engine instance. | |
* | |
* @since 9.0.0 | |
* @event Hooks#afterNamedExpressionAdded | |
* @param {string} namedExpressionName The name of the added expression. | |
* @param {Array} changes The values and location of applied changes. | |
*/ | |
'afterNamedExpressionAdded', | |
/** | |
* Called when a named expression is removed from the Formulas' engine instance. | |
* | |
* @since 9.0.0 | |
* @event Hooks#afterNamedExpressionRemoved | |
* @param {string} namedExpressionName The name of the removed expression. | |
* @param {Array} changes The values and location of applied changes. | |
*/ | |
'afterNamedExpressionRemoved', | |
/** | |
* Called when a new sheet is added to the Formulas' engine instance. | |
* | |
* @since 9.0.0 | |
* @event Hooks#afterSheetAdded | |
* @param {string} addedSheetDisplayName The name of the added sheet. | |
*/ | |
'afterSheetAdded', | |
/** | |
* Called when a sheet in the Formulas' engine instance is renamed. | |
* | |
* @since 9.0.0 | |
* @event Hooks#afterSheetRenamed | |
* @param {string} oldDisplayName The old name of the sheet. | |
* @param {string} newDisplayName The new name of the sheet. | |
*/ | |
'afterSheetRenamed', | |
/** | |
* Called when a sheet is removed from the Formulas' engine instance. | |
* | |
* @since 9.0.0 | |
* @event Hooks#afterSheetRemoved | |
* @param {string} removedSheetDisplayName The removed sheet name. | |
* @param {Array} changes The values and location of applied changes. | |
*/ | |
'afterSheetRemoved', | |
/** | |
* Fired while retrieving the column header height. | |
* | |
* @event Hooks#modifyColumnHeaderHeight | |
*/ | |
'modifyColumnHeaderHeight', | |
/** | |
* Fired by {@link UndoRedo} plugin before the undo action. Contains information about the action that is being undone. | |
* This hook is fired when {@link Options#undo} option is enabled. | |
* | |
* @event Hooks#beforeUndo | |
* @param {object} action The action object. Contains information about the action being undone. The `actionType` | |
* property of the object specifies the type of the action in a String format. (e.g. `'remove_row'`). | |
* @returns {*|boolean} If false is returned the action is canceled. | |
*/ | |
'beforeUndo', | |
/** | |
* Fired by {@link UndoRedo} plugin before changing undo stack. | |
* | |
* @event Hooks#beforeUndoStackChange | |
* @since 8.4.0 | |
* @param {Array} doneActions Stack of actions which may be undone. | |
* @param {string} [source] String that identifies source of action | |
* ([list of all available sources](@/guides/getting-started/events-and-hooks.md#definition-for-source-argument)). | |
* @returns {*|boolean} If false is returned the action of changing undo stack is canceled. | |
*/ | |
'beforeUndoStackChange', | |
/** | |
* Fired by {@link UndoRedo} plugin after the undo action. Contains information about the action that is being undone. | |
* This hook is fired when {@link Options#undo} option is enabled. | |
* | |
* @event Hooks#afterUndo | |
* @param {object} action The action object. Contains information about the action being undone. The `actionType` | |
* property of the object specifies the type of the action in a String format. (e.g. `'remove_row'`). | |
*/ | |
'afterUndo', | |
/** | |
* Fired by {@link UndoRedo} plugin after changing undo stack. | |
* | |
* @event Hooks#afterUndoStackChange | |
* @since 8.4.0 | |
* @param {Array} doneActionsBefore Stack of actions which could be undone before performing new action. | |
* @param {Array} doneActionsAfter Stack of actions which can be undone after performing new action. | |
*/ | |
'afterUndoStackChange', | |
/** | |
* Fired by {@link UndoRedo} plugin before the redo action. Contains information about the action that is being redone. | |
* This hook is fired when {@link Options#undo} option is enabled. | |
* | |
* @event Hooks#beforeRedo | |
* @param {object} action The action object. Contains information about the action being redone. The `actionType` | |
* property of the object specifies the type of the action in a String format (e.g. `'remove_row'`). | |
* @returns {*|boolean} If false is returned the action is canceled. | |
*/ | |
'beforeRedo', | |
/** | |
* Fired by {@link UndoRedo} plugin before changing redo stack. | |
* | |
* @event Hooks#beforeRedoStackChange | |
* @since 8.4.0 | |
* @param {Array} undoneActions Stack of actions which may be redone. | |
*/ | |
'beforeRedoStackChange', | |
/** | |
* Fired by {@link UndoRedo} plugin after the redo action. Contains information about the action that is being redone. | |
* This hook is fired when {@link Options#undo} option is enabled. | |
* | |
* @event Hooks#afterRedo | |
* @param {object} action The action object. Contains information about the action being redone. The `actionType` | |
* property of the object specifies the type of the action in a String format (e.g. `'remove_row'`). | |
*/ | |
'afterRedo', | |
/** | |
* Fired by {@link UndoRedo} plugin after changing redo stack. | |
* | |
* @event Hooks#afterRedoStackChange | |
* @since 8.4.0 | |
* @param {Array} undoneActionsBefore Stack of actions which could be redone before performing new action. | |
* @param {Array} undoneActionsAfter Stack of actions which can be redone after performing new action. | |
*/ | |
'afterRedoStackChange', | |
/** | |
* Fired while retrieving the row header width. | |
* | |
* @event Hooks#modifyRowHeaderWidth | |
* @param {number} rowHeaderWidth Row header width. | |
*/ | |
'modifyRowHeaderWidth', | |
/** | |
* Fired from the `populateFromArray` method during the `autofill` process. Fired for each "autofilled" cell individually. | |
* | |
* @deprecated | |
* @event Hooks#beforeAutofillInsidePopulate | |
* @param {object} index Object containing `row` and `col` properties, defining the number of rows/columns from the initial cell of the autofill. | |
* @param {string} direction Declares the direction of the autofill. Possible values: `up`, `down`, `left`, `right`. | |
* @param {Array[]} input Contains an array of rows with data being used in the autofill. | |
* @param {Array} deltas The deltas array passed to the `populateFromArray` method. | |
*/ | |
'beforeAutofillInsidePopulate', | |
/** | |
* Fired when the start of the selection is being modified (e.g. Moving the selection with the arrow keys). | |
* | |
* @event Hooks#modifyTransformStart | |
* @param {CellCoords} delta Cell coords object declaring the delta of the new selection relative to the previous one. | |
*/ | |
'modifyTransformStart', | |
/** | |
* Fired when the end of the selection is being modified (e.g. Moving the selection with the arrow keys). | |
* | |
* @event Hooks#modifyTransformEnd | |
* @param {CellCoords} delta Cell coords object declaring the delta of the new selection relative to the previous one. | |
*/ | |
'modifyTransformEnd', | |
/** | |
* Fired after the start of the selection is being modified (e.g. Moving the selection with the arrow keys). | |
* | |
* @event Hooks#afterModifyTransformStart | |
* @param {CellCoords} coords Coords of the freshly selected cell. | |
* @param {number} rowTransformDir `-1` if trying to select a cell with a negative row index. `0` otherwise. | |
* @param {number} colTransformDir `-1` if trying to select a cell with a negative column index. `0` otherwise. | |
*/ | |
'afterModifyTransformStart', | |
/** | |
* Fired after the end of the selection is being modified (e.g. Moving the selection with the arrow keys). | |
* | |
* @event Hooks#afterModifyTransformEnd | |
* @param {CellCoords} coords Visual coords of the freshly selected cell. | |
* @param {number} rowTransformDir `-1` if trying to select a cell with a negative row index. `0` otherwise. | |
* @param {number} colTransformDir `-1` if trying to select a cell with a negative column index. `0` otherwise. | |
*/ | |
'afterModifyTransformEnd', | |
/** | |
* Fired inside the `viewportRowCalculatorOverride` method. Allows modifying the row calculator parameters. | |
* | |
* @event Hooks#afterViewportRowCalculatorOverride | |
* @param {object} calc The row calculator. | |
*/ | |
'afterViewportRowCalculatorOverride', | |
/** | |
* Fired inside the `viewportColumnCalculatorOverride` method. Allows modifying the row calculator parameters. | |
* | |
* @event Hooks#afterViewportColumnCalculatorOverride | |
* @param {object} calc The row calculator. | |
*/ | |
'afterViewportColumnCalculatorOverride', | |
/** | |
* Fired after initializing all the plugins. | |
* This hook should be added before Handsontable is initialized. | |
* | |
* @event Hooks#afterPluginsInitialized | |
* | |
* @example | |
* ```js | |
* Handsontable.hooks.add('afterPluginsInitialized', myCallback); | |
* ``` | |
*/ | |
'afterPluginsInitialized', | |
/** | |
* Fired by {@link HiddenRows} plugin before marking the rows as hidden. Fired only if the {@link Options#hiddenRows} option is enabled. | |
* Returning `false` in the callback will prevent the hiding action from completing. | |
* | |
* @event Hooks#beforeHideRows | |
* @param {Array} currentHideConfig Current hide configuration - a list of hidden physical row indexes. | |
* @param {Array} destinationHideConfig Destination hide configuration - a list of hidden physical row indexes. | |
* @param {boolean} actionPossible `true`, if provided row indexes are valid, `false` otherwise. | |
* @returns {undefined|boolean} If the callback returns `false`, the hiding action will not be completed. | |
*/ | |
'beforeHideRows', | |
/** | |
* Fired by {@link HiddenRows} plugin after marking the rows as hidden. Fired only if the {@link Options#hiddenRows} option is enabled. | |
* | |
* @event Hooks#afterHideRows | |
* @param {Array} currentHideConfig Current hide configuration - a list of hidden physical row indexes. | |
* @param {Array} destinationHideConfig Destination hide configuration - a list of hidden physical row indexes. | |
* @param {boolean} actionPossible `true`, if provided row indexes are valid, `false` otherwise. | |
* @param {boolean} stateChanged `true`, if the action affected any non-hidden rows, `false` otherwise. | |
*/ | |
'afterHideRows', | |
/** | |
* Fired by {@link HiddenRows} plugin before marking the rows as not hidden. Fired only if the {@link Options#hiddenRows} option is enabled. | |
* Returning `false` in the callback will prevent the row revealing action from completing. | |
* | |
* @event Hooks#beforeUnhideRows | |
* @param {Array} currentHideConfig Current hide configuration - a list of hidden physical row indexes. | |
* @param {Array} destinationHideConfig Destination hide configuration - a list of hidden physical row indexes. | |
* @param {boolean} actionPossible `true`, if provided row indexes are valid, `false` otherwise. | |
* @returns {undefined|boolean} If the callback returns `false`, the revealing action will not be completed. | |
*/ | |
'beforeUnhideRows', | |
/** | |
* Fired by {@link HiddenRows} plugin after marking the rows as not hidden. Fired only if the {@link Options#hiddenRows} option is enabled. | |
* | |
* @event Hooks#afterUnhideRows | |
* @param {Array} currentHideConfig Current hide configuration - a list of hidden physical row indexes. | |
* @param {Array} destinationHideConfig Destination hide configuration - a list of hidden physical row indexes. | |
* @param {boolean} actionPossible `true`, if provided row indexes are valid, `false` otherwise. | |
* @param {boolean} stateChanged `true`, if the action affected any hidden rows, `false` otherwise. | |
*/ | |
'afterUnhideRows', | |
/** | |
* Fired by {@link HiddenColumns} plugin before marking the columns as hidden. Fired only if the {@link Options#hiddenColumns} option is enabled. | |
* Returning `false` in the callback will prevent the hiding action from completing. | |
* | |
* @event Hooks#beforeHideColumns | |
* @param {Array} currentHideConfig Current hide configuration - a list of hidden physical column indexes. | |
* @param {Array} destinationHideConfig Destination hide configuration - a list of hidden physical column indexes. | |
* @param {boolean} actionPossible `true`, if the provided column indexes are valid, `false` otherwise. | |
* @returns {undefined|boolean} If the callback returns `false`, the hiding action will not be completed. | |
*/ | |
'beforeHideColumns', | |
/** | |
* Fired by {@link HiddenColumns} plugin after marking the columns as hidden. Fired only if the {@link Options#hiddenColumns} option is enabled. | |
* | |
* @event Hooks#afterHideColumns | |
* @param {Array} currentHideConfig Current hide configuration - a list of hidden physical column indexes. | |
* @param {Array} destinationHideConfig Destination hide configuration - a list of hidden physical column indexes. | |
* @param {boolean} actionPossible `true`, if the provided column indexes are valid, `false` otherwise. | |
* @param {boolean} stateChanged `true`, if the action affected any non-hidden columns, `false` otherwise. | |
*/ | |
'afterHideColumns', | |
/** | |
* Fired by {@link HiddenColumns} plugin before marking the columns as not hidden. Fired only if the {@link Options#hiddenColumns} option is enabled. | |
* Returning `false` in the callback will prevent the column revealing action from completing. | |
* | |
* @event Hooks#beforeUnhideColumns | |
* @param {Array} currentHideConfig Current hide configuration - a list of hidden physical column indexes. | |
* @param {Array} destinationHideConfig Destination hide configuration - a list of hidden physical column indexes. | |
* @param {boolean} actionPossible `true`, if the provided column indexes are valid, `false` otherwise. | |
* @returns {undefined|boolean} If the callback returns `false`, the hiding action will not be completed. | |
*/ | |
'beforeUnhideColumns', | |
/** | |
* Fired by {@link HiddenColumns} plugin after marking the columns as not hidden. Fired only if the {@link Options#hiddenColumns} option is enabled. | |
* | |
* @event Hooks#afterUnhideColumns | |
* @param {Array} currentHideConfig Current hide configuration - a list of hidden physical column indexes. | |
* @param {Array} destinationHideConfig Destination hide configuration - a list of hidden physical column indexes. | |
* @param {boolean} actionPossible `true`, if the provided column indexes are valid, `false` otherwise. | |
* @param {boolean} stateChanged `true`, if the action affected any hidden columns, `false` otherwise. | |
*/ | |
'afterUnhideColumns', | |
/** | |
* Fired by {@link TrimRows} plugin before trimming rows. This hook is fired when {@link Options#trimRows} option is enabled. | |
* | |
* @event Hooks#beforeTrimRow | |
* @param {Array} currentTrimConfig Current trim configuration - a list of trimmed physical row indexes. | |
* @param {Array} destinationTrimConfig Destination trim configuration - a list of trimmed physical row indexes. | |
* @param {boolean} actionPossible `true`, if all of the row indexes are withing the bounds of the table, `false` otherwise. | |
* @returns {undefined|boolean} If the callback returns `false`, the trimming action will not be completed. | |
*/ | |
'beforeTrimRow', | |
/** | |
* Fired by {@link TrimRows} plugin after trimming rows. This hook is fired when {@link Options#trimRows} option is enabled. | |
* | |
* @event Hooks#afterTrimRow | |
* @param {Array} currentTrimConfig Current trim configuration - a list of trimmed physical row indexes. | |
* @param {Array} destinationTrimConfig Destination trim configuration - a list of trimmed physical row indexes. | |
* @param {boolean} actionPossible `true`, if all of the row indexes are withing the bounds of the table, `false` otherwise. | |
* @param {boolean} stateChanged `true`, if the action affected any non-trimmed rows, `false` otherwise. | |
* @returns {undefined|boolean} If the callback returns `false`, the trimming action will not be completed. | |
*/ | |
'afterTrimRow', | |
/** | |
* Fired by {@link TrimRows} plugin before untrimming rows. This hook is fired when {@link Options#trimRows} option is enabled. | |
* | |
* @event Hooks#beforeUntrimRow | |
* @param {Array} currentTrimConfig Current trim configuration - a list of trimmed physical row indexes. | |
* @param {Array} destinationTrimConfig Destination trim configuration - a list of trimmed physical row indexes. | |
* @param {boolean} actionPossible `true`, if all of the row indexes are withing the bounds of the table, `false` otherwise. | |
* @returns {undefined|boolean} If the callback returns `false`, the untrimming action will not be completed. | |
*/ | |
'beforeUntrimRow', | |
/** | |
* Fired by {@link TrimRows} plugin after untrimming rows. This hook is fired when {@link Options#trimRows} option is enabled. | |
* | |
* @event Hooks#afterUntrimRow | |
* @param {Array} currentTrimConfig Current trim configuration - a list of trimmed physical row indexes. | |
* @param {Array} destinationTrimConfig Destination trim configuration - a list of trimmed physical row indexes. | |
* @param {boolean} actionPossible `true`, if all of the row indexes are withing the bounds of the table, `false` otherwise. | |
* @param {boolean} stateChanged `true`, if the action affected any trimmed rows, `false` otherwise. | |
* @returns {undefined|boolean} If the callback returns `false`, the untrimming action will not be completed. | |
*/ | |
'afterUntrimRow', | |
/** | |
* Fired by {@link DropdownMenu} plugin before opening the dropdown menu. This hook is fired when {@link Options#dropdownMenu} | |
* option is enabled. | |
* | |
* @event Hooks#beforeDropdownMenuShow | |
* @param {DropdownMenu} dropdownMenu The DropdownMenu instance. | |
*/ | |
'beforeDropdownMenuShow', | |
/** | |
* Fired by {@link DropdownMenu} plugin after opening the Dropdown Menu. This hook is fired when {@link Options#dropdownMenu} | |
* option is enabled. | |
* | |
* @event Hooks#afterDropdownMenuShow | |
* @param {DropdownMenu} dropdownMenu The DropdownMenu instance. | |
*/ | |
'afterDropdownMenuShow', | |
/** | |
* Fired by {@link DropdownMenu} plugin after hiding the Dropdown Menu. This hook is fired when {@link Options#dropdownMenu} | |
* option is enabled. | |
* | |
* @event Hooks#afterDropdownMenuHide | |
* @param {DropdownMenu} instance The DropdownMenu instance. | |
*/ | |
'afterDropdownMenuHide', | |
/** | |
* Fired by {@link NestedRows} plugin before adding a children to the NestedRows structure. This hook is fired when | |
* {@link Options#nestedRows} option is enabled. | |
* | |
* @event Hooks#beforeAddChild | |
* @param {object} parent The parent object. | |
* @param {object|undefined} element The element added as a child. If `undefined`, a blank child was added. | |
* @param {number|undefined} index The index within the parent where the new child was added. If `undefined`, the element was added as the last child. | |
*/ | |
'beforeAddChild', | |
/** | |
* Fired by {@link NestedRows} plugin after adding a children to the NestedRows structure. This hook is fired when | |
* {@link Options#nestedRows} option is enabled. | |
* | |
* @event Hooks#afterAddChild | |
* @param {object} parent The parent object. | |
* @param {object|undefined} element The element added as a child. If `undefined`, a blank child was added. | |
* @param {number|undefined} index The index within the parent where the new child was added. If `undefined`, the element was added as the last child. | |
*/ | |
'afterAddChild', | |
/** | |
* Fired by {@link NestedRows} plugin before detaching a child from its parent. This hook is fired when | |
* {@link Options#nestedRows} option is enabled. | |
* | |
* @event Hooks#beforeDetachChild | |
* @param {object} parent An object representing the parent from which the element is to be detached. | |
* @param {object} element The detached element. | |
*/ | |
'beforeDetachChild', | |
/** | |
* Fired by {@link NestedRows} plugin after detaching a child from its parent. This hook is fired when | |
* {@link Options#nestedRows} option is enabled. | |
* | |
* @event Hooks#afterDetachChild | |
* @param {object} parent An object representing the parent from which the element was detached. | |
* @param {object} element The detached element. | |
* @param {number} finalElementPosition The final row index of the detached element. | |
*/ | |
'afterDetachChild', | |
/** | |
* Fired after the editor is opened and rendered. | |
* | |
* @event Hooks#afterBeginEditing | |
* @param {number} row Visual row index of the edited cell. | |
* @param {number} column Visual column index of the edited cell. | |
*/ | |
'afterBeginEditing', | |
/** | |
* Fired by {@link MergeCells} plugin before cell merging. This hook is fired when {@link Options#mergeCells} | |
* option is enabled. | |
* | |
* @event Hooks#beforeMergeCells | |
* @param {CellRange} cellRange Selection cell range. | |
* @param {boolean} [auto=false] `true` if called automatically by the plugin. | |
*/ | |
'beforeMergeCells', | |
/** | |
* Fired by {@link MergeCells} plugin after cell merging. This hook is fired when {@link Options#mergeCells} | |
* option is enabled. | |
* | |
* @event Hooks#afterMergeCells | |
* @param {CellRange} cellRange Selection cell range. | |
* @param {object} mergeParent The parent collection of the provided cell range. | |
* @param {boolean} [auto=false] `true` if called automatically by the plugin. | |
*/ | |
'afterMergeCells', | |
/** | |
* Fired by {@link MergeCells} plugin before unmerging the cells. This hook is fired when {@link Options#mergeCells} | |
* option is enabled. | |
* | |
* @event Hooks#beforeUnmergeCells | |
* @param {CellRange} cellRange Selection cell range. | |
* @param {boolean} [auto=false] `true` if called automatically by the plugin. | |
*/ | |
'beforeUnmergeCells', | |
/** | |
* Fired by {@link MergeCells} plugin after unmerging the cells. This hook is fired when {@link Options#mergeCells} | |
* option is enabled. | |
* | |
* @event Hooks#afterUnmergeCells | |
* @param {CellRange} cellRange Selection cell range. | |
* @param {boolean} [auto=false] `true` if called automatically by the plugin. | |
*/ | |
'afterUnmergeCells', | |
/** | |
* Fired after the table was switched into listening mode. This allows Handsontable to capture keyboard events and | |
* respond in the right way. | |
* | |
* @event Hooks#afterListen | |
*/ | |
'afterListen', | |
/** | |
* Fired after the table was switched off from the listening mode. This makes the Handsontable inert for any | |
* keyboard events. | |
* | |
* @event Hooks#afterUnlisten | |
*/ | |
'afterUnlisten', | |
/** | |
* Fired after the window was resized. | |
* | |
* @event Hooks#afterRefreshDimensions | |
* @param {object} previousDimensions Previous dimensions of the container. | |
* @param {object} currentDimensions Current dimensions of the container. | |
* @param {boolean} stateChanged `true`, if the container was re-render, `false` otherwise. | |
*/ | |
'afterRefreshDimensions', | |
/** | |
* Cancellable hook, called after resizing a window, but before redrawing a table. | |
* | |
* @event Hooks#beforeRefreshDimensions | |
* @param {object} previousDimensions Previous dimensions of the container. | |
* @param {object} currentDimensions Current dimensions of the container. | |
* @param {boolean} actionPossible `true`, if current and previous dimensions are different, `false` otherwise. | |
* @returns {undefined|boolean} If the callback returns `false`, the refresh action will not be completed. | |
*/ | |
'beforeRefreshDimensions', | |
/** | |
* Fired by {@link CollapsibleColumns} plugin before columns collapse. This hook is fired when {@link Options#collapsibleColumns} option is enabled. | |
* | |
* @event Hooks#beforeColumnCollapse | |
* @since 8.0.0 | |
* @param {Array} currentCollapsedColumns Current collapsible configuration - a list of collapsible physical column indexes. | |
* @param {Array} destinationCollapsedColumns Destination collapsible configuration - a list of collapsible physical column indexes. | |
* @param {boolean} collapsePossible `true`, if all of the column indexes are withing the bounds of the collapsed sections, `false` otherwise. | |
* @returns {undefined|boolean} If the callback returns `false`, the collapsing action will not be completed. | |
*/ | |
'beforeColumnCollapse', | |
/** | |
* Fired by {@link CollapsibleColumns} plugin before columns collapse. This hook is fired when {@link Options#collapsibleColumns} option is enabled. | |
* | |
* @event Hooks#afterColumnCollapse | |
* @since 8.0.0 | |
* @param {Array} currentCollapsedColumns Current collapsible configuration - a list of collapsible physical column indexes. | |
* @param {Array} destinationCollapsedColumns Destination collapsible configuration - a list of collapsible physical column indexes. | |
* @param {boolean} collapsePossible `true`, if all of the column indexes are withing the bounds of the collapsed sections, `false` otherwise. | |
* @param {boolean} successfullyCollapsed `true`, if the action affected any non-collapsible column, `false` otherwise. | |
*/ | |
'afterColumnCollapse', | |
/** | |
* Fired by {@link CollapsibleColumns} plugin before columns expand. This hook is fired when {@link Options#collapsibleColumns} option is enabled. | |
* | |
* @event Hooks#beforeColumnExpand | |
* @since 8.0.0 | |
* @param {Array} currentCollapsedColumns Current collapsible configuration - a list of collapsible physical column indexes. | |
* @param {Array} destinationCollapsedColumns Destination collapsible configuration - a list of collapsible physical column indexes. | |
* @param {boolean} expandPossible `true`, if all of the column indexes are withing the bounds of the collapsed sections, `false` otherwise. | |
* @returns {undefined|boolean} If the callback returns `false`, the expanding action will not be completed. | |
*/ | |
'beforeColumnExpand', | |
/** | |
* Fired by {@link CollapsibleColumns} plugin before columns expand. This hook is fired when {@link Options#collapsibleColumns} option is enabled. | |
* | |
* @event Hooks#afterColumnExpand | |
* @since 8.0.0 | |
* @param {Array} currentCollapsedColumns Current collapsible configuration - a list of collapsible physical column indexes. | |
* @param {Array} destinationCollapsedColumns Destination collapsible configuration - a list of collapsible physical column indexes. | |
* @param {boolean} expandPossible `true`, if all of the column indexes are withing the bounds of the collapsed sections, `false` otherwise. | |
* @param {boolean} successfullyExpanded `true`, if the action affected any non-collapsible column, `false` otherwise. | |
*/ | |
'afterColumnExpand', | |
/** | |
* Fired by {@link AutoColumnSize} plugin within SampleGenerator utility. | |
* | |
* @event Hooks#modifyAutoColumnSizeSeed | |
* @since 8.4.0 | |
* @param {string|undefined} seed Seed ID, unique name to categorize samples. | |
* @param {object} cellProperties Object containing the cell properties. | |
* @param {*} cellValue Value of the cell. | |
*/ | |
'modifyAutoColumnSizeSeed']; | |
/** | |
* Template warning message for removed hooks. | |
* | |
* @type {string} | |
*/ | |
var REMOVED_MESSAGE = (0, _templateLiteralTag.toSingleLine)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["The plugin hook \"[hookName]\" was removed in Handsontable [removedInVersion]. \n Please consult release notes https://github.com/handsontable/handsontable/releases/tag/[removedInVersion] to \n learn about the migration path."], ["The plugin hook \"[hookName]\" was removed in Handsontable [removedInVersion].\\x20\n Please consult release notes https://github.com/handsontable/handsontable/releases/tag/[removedInVersion] to\\x20\n learn about the migration path."]))); | |
/** | |
* The list of the hooks which are removed from the API. The warning message is printed out in | |
* the developer console when the hook is used. | |
* | |
* The Map key is represented by hook name and its value points to the Handsontable version | |
* in which it was removed. | |
* | |
* @type {Map<string, string>} | |
*/ | |
var REMOVED_HOOKS = new Map([['modifyRow', '8.0.0'], ['modifyCol', '8.0.0'], ['unmodifyRow', '8.0.0'], ['unmodifyCol', '8.0.0'], ['skipLengthCache', '8.0.0'], ['hiddenColumn', '8.0.0'], ['hiddenRow', '8.0.0']]); | |
/* eslint-disable jsdoc/require-description-complete-sentence */ | |
/** | |
* The list of the hooks which are deprecated. The warning message is printed out in | |
* the developer console when the hook is used. | |
* | |
* The Map key is represented by hook name and its value keeps message which whould be | |
* printed out when the hook is used. | |
* | |
* Usage: | |
* ```js | |
* ... | |
* New Map([ | |
* ['beforeColumnExpand', 'The plugin hook "beforeColumnExpand" is deprecated. Use "beforeColumnExpand2" instead.'], | |
* ]) | |
* ... | |
* ``` | |
* | |
* | |
* @type {Map<string, string>} | |
*/ | |
/* eslint-enable jsdoc/require-description-complete-sentence */ | |
var DEPRECATED_HOOKS = new Map([['beforeAutofillInsidePopulate', 'The plugin hook "beforeAutofillInsidePopulate" is deprecated and will be removed in the next major release.']]); | |
var Hooks = /*#__PURE__*/function () { | |
/** | |
* | |
*/ | |
function Hooks() { | |
(0, _classCallCheck2.default)(this, Hooks); | |
this.globalBucket = this.createEmptyBucket(); | |
} | |
/** | |
* Returns a new object with empty handlers related to every registered hook name. | |
* | |
* @returns {object} The empty bucket object. | |
* | |
* @example | |
* ```js | |
* Handsontable.hooks.createEmptyBucket(); | |
* // Results: | |
* { | |
* ... | |
* afterCreateCol: [], | |
* afterCreateRow: [], | |
* beforeInit: [], | |
* ... | |
* } | |
* ``` | |
*/ | |
(0, _createClass2.default)(Hooks, [{ | |
key: "createEmptyBucket", | |
value: function createEmptyBucket() { | |
var bucket = Object.create(null); // eslint-disable-next-line no-return-assign | |
(0, _array.arrayEach)(REGISTERED_HOOKS, function (hook) { | |
return bucket[hook] = []; | |
}); | |
return bucket; | |
} | |
/** | |
* Get hook bucket based on the context of the object or if argument is `undefined`, get the global hook bucket. | |
* | |
* @param {object} [context=null] A Handsontable instance. | |
* @returns {object} Returns a global or Handsontable instance bucket. | |
*/ | |
}, { | |
key: "getBucket", | |
value: function getBucket() { | |
var context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; | |
if (context) { | |
if (!context.pluginHookBucket) { | |
context.pluginHookBucket = this.createEmptyBucket(); | |
} | |
return context.pluginHookBucket; | |
} | |
return this.globalBucket; | |
} | |
/** | |
* Adds a listener (globally or locally) to a specified hook name. | |
* If the `context` parameter is provided, the hook will be added only to the instance it references. | |
* Otherwise, the callback will be used everytime the hook fires on any Handsontable instance. | |
* You can provide an array of callback functions as the `callback` argument, this way they will all be fired | |
* once the hook is triggered. | |
* | |
* @see Core#addHook | |
* @param {string} key Hook name. | |
* @param {Function|Array} callback Callback function or an array of functions. | |
* @param {object} [context=null] The context for the hook callback to be added - a Handsontable instance or leave empty. | |
* @returns {Hooks} Instance of Hooks. | |
* | |
* @example | |
* ```js | |
* // single callback, added locally | |
* Handsontable.hooks.add('beforeInit', myCallback, hotInstance); | |
* | |
* // single callback, added globally | |
* Handsontable.hooks.add('beforeInit', myCallback); | |
* | |
* // multiple callbacks, added locally | |
* Handsontable.hooks.add('beforeInit', [myCallback, anotherCallback], hotInstance); | |
* | |
* // multiple callbacks, added globally | |
* Handsontable.hooks.add('beforeInit', [myCallback, anotherCallback]); | |
* ``` | |
*/ | |
}, { | |
key: "add", | |
value: function add(key, callback) { | |
var _this = this; | |
var context = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; | |
if (Array.isArray(callback)) { | |
(0, _array.arrayEach)(callback, function (c) { | |
return _this.add(key, c, context); | |
}); | |
} else { | |
if (REMOVED_HOOKS.has(key)) { | |
(0, _console.warn)((0, _string.substitute)(REMOVED_MESSAGE, { | |
hookName: key, | |
removedInVersion: REMOVED_HOOKS.get(key) | |
})); | |
} | |
if (DEPRECATED_HOOKS.has(key)) { | |
(0, _console.warn)(DEPRECATED_HOOKS.get(key)); | |
} | |
var bucket = this.getBucket(context); | |
if (typeof bucket[key] === 'undefined') { | |
this.register(key); | |
bucket[key] = []; | |
} | |
callback.skip = false; | |
if (bucket[key].indexOf(callback) === -1) { | |
// only add a hook if it has not already been added (adding the same hook twice is now silently ignored) | |
var foundInitialHook = false; | |
if (callback.initialHook) { | |
(0, _array.arrayEach)(bucket[key], function (cb, i) { | |
if (cb.initialHook) { | |
bucket[key][i] = callback; | |
foundInitialHook = true; | |
return false; | |
} | |
}); | |
} | |
if (!foundInitialHook) { | |
bucket[key].push(callback); | |
} | |
} | |
} | |
return this; | |
} | |
/** | |
* Adds a listener to a specified hook. After the hook runs this listener will be automatically removed from the bucket. | |
* | |
* @see Core#addHookOnce | |
* @param {string} key Hook/Event name. | |
* @param {Function|Array} callback Callback function. | |
* @param {object} [context=null] A Handsontable instance. | |
* | |
* @example | |
* ```js | |
* Handsontable.hooks.once('beforeInit', myCallback, hotInstance); | |
* ``` | |
*/ | |
}, { | |
key: "once", | |
value: function once(key, callback) { | |
var _this2 = this; | |
var context = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; | |
if (Array.isArray(callback)) { | |
(0, _array.arrayEach)(callback, function (c) { | |
return _this2.once(key, c, context); | |
}); | |
} else { | |
callback.runOnce = true; | |
this.add(key, callback, context); | |
} | |
} | |
/** | |
* Removes a listener from a hook with a given name. If the `context` argument is provided, it removes a listener from a local hook assigned to the given Handsontable instance. | |
* | |
* @see Core#removeHook | |
* @param {string} key Hook/Event name. | |
* @param {Function} callback Callback function (needs the be the function that was previously added to the hook). | |
* @param {object} [context=null] Handsontable instance. | |
* @returns {boolean} Returns `true` if hook was removed, `false` otherwise. | |
* | |
* @example | |
* ```js | |
* Handsontable.hooks.remove('beforeInit', myCallback); | |
* ``` | |
*/ | |
}, { | |
key: "remove", | |
value: function remove(key, callback) { | |
var context = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; | |
var bucket = this.getBucket(context); | |
if (typeof bucket[key] !== 'undefined') { | |
if (bucket[key].indexOf(callback) >= 0) { | |
callback.skip = true; | |
return true; | |
} | |
} | |
return false; | |
} | |
/** | |
* Checks whether there are any registered listeners for the provided hook name. | |
* If the `context` parameter is provided, it only checks for listeners assigned to the given Handsontable instance. | |
* | |
* @param {string} key Hook name. | |
* @param {object} [context=null] A Handsontable instance. | |
* @returns {boolean} `true` for success, `false` otherwise. | |
*/ | |
}, { | |
key: "has", | |
value: function has(key) { | |
var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; | |
var bucket = this.getBucket(context); | |
return !!(bucket[key] !== void 0 && bucket[key].length); | |
} | |
/** | |
* Runs all local and global callbacks assigned to the hook identified by the `key` parameter. | |
* It returns either a return value from the last called callback or the first parameter (`p1`) passed to the `run` function. | |
* | |
* @see Core#runHooks | |
* @param {object} context Handsontable instance. | |
* @param {string} key Hook/Event name. | |
* @param {*} [p1] Parameter to be passed as an argument to the callback function. | |
* @param {*} [p2] Parameter to be passed as an argument to the callback function. | |
* @param {*} [p3] Parameter to be passed as an argument to the callback function. | |
* @param {*} [p4] Parameter to be passed as an argument to the callback function. | |
* @param {*} [p5] Parameter to be passed as an argument to the callback function. | |
* @param {*} [p6] Parameter to be passed as an argument to the callback function. | |
* @returns {*} Either a return value from the last called callback or `p1`. | |
* | |
* @example | |
* ```js | |
* Handsontable.hooks.run(hot, 'beforeInit'); | |
* ``` | |
*/ | |
}, { | |
key: "run", | |
value: function run(context, key, p1, p2, p3, p4, p5, p6) { | |
{ | |
var globalHandlers = this.globalBucket[key]; | |
var length = globalHandlers ? globalHandlers.length : 0; | |
var index = 0; | |
if (length) { | |
// Do not optimise this loop with arrayEach or arrow function! If you do You'll decrease perf because of GC. | |
while (index < length) { | |
if (!globalHandlers[index] || globalHandlers[index].skip) { | |
index += 1; | |
/* eslint-disable no-continue */ | |
continue; | |
} | |
var res = (0, _function.fastCall)(globalHandlers[index], context, p1, p2, p3, p4, p5, p6); | |
if (res !== void 0) { | |
// eslint-disable-next-line no-param-reassign | |
p1 = res; | |
} | |
if (globalHandlers[index] && globalHandlers[index].runOnce) { | |
this.remove(key, globalHandlers[index]); | |
} | |
index += 1; | |
} | |
} | |
} | |
{ | |
var localHandlers = this.getBucket(context)[key]; | |
var _length = localHandlers ? localHandlers.length : 0; | |
var _index = 0; | |
if (_length) { | |
// Do not optimise this loop with arrayEach or arrow function! If you do You'll decrease perf because of GC. | |
while (_index < _length) { | |
if (!localHandlers[_index] || localHandlers[_index].skip) { | |
_index += 1; | |
/* eslint-disable no-continue */ | |
continue; | |
} | |
var _res = (0, _function.fastCall)(localHandlers[_index], context, p1, p2, p3, p4, p5, p6); | |
if (_res !== void 0) { | |
// eslint-disable-next-line no-param-reassign | |
p1 = _res; | |
} | |
if (localHandlers[_index] && localHandlers[_index].runOnce) { | |
this.remove(key, localHandlers[_index], context); | |
} | |
_index += 1; | |
} | |
} | |
} | |
return p1; | |
} | |
/** | |
* Destroy all listeners connected to the context. If no context is provided, the global listeners will be destroyed. | |
* | |
* @param {object} [context=null] A Handsontable instance. | |
* @example | |
* ```js | |
* // destroy the global listeners | |
* Handsontable.hooks.destroy(); | |
* | |
* // destroy the local listeners | |
* Handsontable.hooks.destroy(hotInstance); | |
* ``` | |
*/ | |
}, { | |
key: "destroy", | |
value: function destroy() { | |
var context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; | |
// eslint-disable-next-line no-return-assign | |
(0, _object.objectEach)(this.getBucket(context), function (value, key, bucket) { | |
return bucket[key].length = 0; | |
}); | |
} | |
/** | |
* Registers a hook name (adds it to the list of the known hook names). Used by plugins. | |
* It is not necessary to call register, but if you use it, your plugin hook will be used returned by | |
* the `getRegistered` method. (which itself is used in the [demo](@/guides/getting-started/events-and-hooks.md)). | |
* | |
* @param {string} key The hook name. | |
* | |
* @example | |
* ```js | |
* Handsontable.hooks.register('myHook'); | |
* ``` | |
*/ | |
}, { | |
key: "register", | |
value: function register(key) { | |
if (!this.isRegistered(key)) { | |
REGISTERED_HOOKS.push(key); | |
} | |
} | |
/** | |
* Deregisters a hook name (removes it from the list of known hook names). | |
* | |
* @param {string} key The hook name. | |
* | |
* @example | |
* ```js | |
* Handsontable.hooks.deregister('myHook'); | |
* ``` | |
*/ | |
}, { | |
key: "deregister", | |
value: function deregister(key) { | |
if (this.isRegistered(key)) { | |
REGISTERED_HOOKS.splice(REGISTERED_HOOKS.indexOf(key), 1); | |
} | |
} | |
/** | |
* Returns a boolean value depending on if a hook by such name has been removed or deprecated. | |
* | |
* @param {string} hookName The hook name to check. | |
* @returns {boolean} Returns `true` if the provided hook name was marked as deprecated or | |
* removed from API, `false` otherwise. | |
* @example | |
* ```js | |
* Handsontable.hooks.isDeprecated('skipLengthCache'); | |
* | |
* // Results: | |
* true | |
* ``` | |
*/ | |
}, { | |
key: "isDeprecated", | |
value: function isDeprecated(hookName) { | |
return DEPRECATED_HOOKS.has(hookName) || REMOVED_HOOKS.has(hookName); | |
} | |
/** | |
* Returns a boolean depending on if a hook by such name has been registered. | |
* | |
* @param {string} hookName The hook name to check. | |
* @returns {boolean} `true` for success, `false` otherwise. | |
* @example | |
* ```js | |
* Handsontable.hooks.isRegistered('beforeInit'); | |
* | |
* // Results: | |
* true | |
* ``` | |
*/ | |
}, { | |
key: "isRegistered", | |
value: function isRegistered(hookName) { | |
return REGISTERED_HOOKS.indexOf(hookName) >= 0; | |
} | |
/** | |
* Returns an array of registered hooks. | |
* | |
* @returns {Array} An array of registered hooks. | |
* | |
* @example | |
* ```js | |
* Handsontable.hooks.getRegistered(); | |
* | |
* // Results: | |
* [ | |
* ... | |
* 'beforeInit', | |
* 'beforeRender', | |
* 'beforeSetRangeEnd', | |
* 'beforeDrawBorders', | |
* 'beforeChange', | |
* ... | |
* ] | |
* ``` | |
*/ | |
}, { | |
key: "getRegistered", | |
value: function getRegistered() { | |
return REGISTERED_HOOKS; | |
} | |
}], [{ | |
key: "getSingleton", | |
value: function getSingleton() { | |
return getGlobalSingleton(); | |
} | |
}]); | |
return Hooks; | |
}(); | |
var globalSingleton = new Hooks(); | |
/** | |
* @returns {Hooks} | |
*/ | |
function getGlobalSingleton() { | |
return globalSingleton; | |
} | |
var _default = Hooks; | |
exports.default = _default; | |
/***/ }), | |
/* 72 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var fails = __webpack_require__(43); | |
// Detect IE8's incomplete defineProperty implementation | |
module.exports = !fails(function () { | |
// eslint-disable-next-line es/no-object-defineproperty -- required for testing | |
return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7; | |
}); | |
/***/ }), | |
/* 73 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var uncurryThis = __webpack_require__(37); | |
var toObject = __webpack_require__(92); | |
var hasOwnProperty = uncurryThis({}.hasOwnProperty); | |
// `HasOwnProperty` abstract operation | |
// https://tc39.es/ecma262/#sec-hasownproperty | |
module.exports = Object.hasOwn || function hasOwn(it, key) { | |
return hasOwnProperty(toObject(it), key); | |
}; | |
/***/ }), | |
/* 74 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var global = __webpack_require__(30); | |
var classof = __webpack_require__(209); | |
var String = global.String; | |
module.exports = function (argument) { | |
if (classof(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string'); | |
return String(argument); | |
}; | |
/***/ }), | |
/* 75 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var $ = __webpack_require__(31); | |
var uncurryThis = __webpack_require__(37); | |
var IndexedObject = __webpack_require__(165); | |
var toIndexedObject = __webpack_require__(94); | |
var arrayMethodIsStrict = __webpack_require__(153); | |
var un$Join = uncurryThis([].join); | |
var ES3_STRINGS = IndexedObject != Object; | |
var STRICT_METHOD = arrayMethodIsStrict('join', ','); | |
// `Array.prototype.join` method | |
// https://tc39.es/ecma262/#sec-array.prototype.join | |
$({ target: 'Array', proto: true, forced: ES3_STRINGS || !STRICT_METHOD }, { | |
join: function join(separator) { | |
return un$Join(toIndexedObject(this), separator === undefined ? ',' : separator); | |
} | |
}); | |
/***/ }), | |
/* 76 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var $ = __webpack_require__(31); | |
var uncurryThis = __webpack_require__(37); | |
var aCallable = __webpack_require__(149); | |
var toObject = __webpack_require__(92); | |
var lengthOfArrayLike = __webpack_require__(98); | |
var toString = __webpack_require__(74); | |
var fails = __webpack_require__(43); | |
var internalSort = __webpack_require__(669); | |
var arrayMethodIsStrict = __webpack_require__(153); | |
var FF = __webpack_require__(670); | |
var IE_OR_EDGE = __webpack_require__(671); | |
var V8 = __webpack_require__(166); | |
var WEBKIT = __webpack_require__(672); | |
var test = []; | |
var un$Sort = uncurryThis(test.sort); | |
var push = uncurryThis(test.push); | |
// IE8- | |
var FAILS_ON_UNDEFINED = fails(function () { | |
test.sort(undefined); | |
}); | |
// V8 bug | |
var FAILS_ON_NULL = fails(function () { | |
test.sort(null); | |
}); | |
// Old WebKit | |
var STRICT_METHOD = arrayMethodIsStrict('sort'); | |
var STABLE_SORT = !fails(function () { | |
// feature detection can be too slow, so check engines versions | |
if (V8) return V8 < 70; | |
if (FF && FF > 3) return; | |
if (IE_OR_EDGE) return true; | |
if (WEBKIT) return WEBKIT < 603; | |
var result = ''; | |
var code, chr, value, index; | |
// generate an array with more 512 elements (Chakra and old V8 fails only in this case) | |
for (code = 65; code < 76; code++) { | |
chr = String.fromCharCode(code); | |
switch (code) { | |
case 66: case 69: case 70: case 72: value = 3; break; | |
case 68: case 71: value = 4; break; | |
default: value = 2; | |
} | |
for (index = 0; index < 47; index++) { | |
test.push({ k: chr + index, v: value }); | |
} | |
} | |
test.sort(function (a, b) { return b.v - a.v; }); | |
for (index = 0; index < test.length; index++) { | |
chr = test[index].k.charAt(0); | |
if (result.charAt(result.length - 1) !== chr) result += chr; | |
} | |
return result !== 'DGBEFHACIJK'; | |
}); | |
var FORCED = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD || !STABLE_SORT; | |
var getSortCompare = function (comparefn) { | |
return function (x, y) { | |
if (y === undefined) return -1; | |
if (x === undefined) return 1; | |
if (comparefn !== undefined) return +comparefn(x, y) || 0; | |
return toString(x) > toString(y) ? 1 : -1; | |
}; | |
}; | |
// `Array.prototype.sort` method | |
// https://tc39.es/ecma262/#sec-array.prototype.sort | |
$({ target: 'Array', proto: true, forced: FORCED }, { | |
sort: function sort(comparefn) { | |
if (comparefn !== undefined) aCallable(comparefn); | |
var array = toObject(this); | |
if (STABLE_SORT) return comparefn === undefined ? un$Sort(array) : un$Sort(array, comparefn); | |
var items = []; | |
var arrayLength = lengthOfArrayLike(array); | |
var itemsLength, index; | |
for (index = 0; index < arrayLength; index++) { | |
if (index in array) push(items, array[index]); | |
} | |
internalSort(items, getSortCompare(comparefn)); | |
itemsLength = items.length; | |
index = 0; | |
while (index < itemsLength) array[index] = items[index++]; | |
while (index < arrayLength) delete array[index++]; | |
return array; | |
} | |
}); | |
/***/ }), | |
/* 77 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var $ = __webpack_require__(31); | |
var global = __webpack_require__(30); | |
var apply = __webpack_require__(133); | |
var isCallable = __webpack_require__(61); | |
var userAgent = __webpack_require__(129); | |
var arraySlice = __webpack_require__(169); | |
var validateArgumentsLength = __webpack_require__(428); | |
var MSIE = /MSIE .\./.test(userAgent); // <- dirty ie9- check | |
var Function = global.Function; | |
var wrap = function (scheduler) { | |
return function (handler, timeout /* , ...arguments */) { | |
var boundArgs = validateArgumentsLength(arguments.length, 1) > 2; | |
var fn = isCallable(handler) ? handler : Function(handler); | |
var args = boundArgs ? arraySlice(arguments, 2) : undefined; | |
return scheduler(boundArgs ? function () { | |
apply(fn, this, args); | |
} : fn, timeout); | |
}; | |
}; | |
// ie9- setTimeout & setInterval additional parameters fix | |
// https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#timers | |
$({ global: true, bind: true, forced: MSIE }, { | |
// `setTimeout` method | |
// https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-settimeout | |
setTimeout: wrap(global.setTimeout), | |
// `setInterval` method | |
// https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-setinterval | |
setInterval: wrap(global.setInterval) | |
}); | |
/***/ }), | |
/* 78 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var NATIVE_BIND = __webpack_require__(163); | |
var call = Function.prototype.call; | |
module.exports = NATIVE_BIND ? call.bind(call) : function () { | |
return call.apply(call, arguments); | |
}; | |
/***/ }), | |
/* 79 */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "END_OF_FILE", function() { return END_OF_FILE; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DEFAULT_PARSER_CONFIG", function() { return DEFAULT_PARSER_CONFIG; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DEFAULT_RULE_CONFIG", function() { return DEFAULT_RULE_CONFIG; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ParserDefinitionErrorType", function() { return ParserDefinitionErrorType; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EMPTY_ALT", function() { return EMPTY_ALT; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Parser", function() { return Parser; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CstParser", function() { return CstParser; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EmbeddedActionsParser", function() { return EmbeddedActionsParser; }); | |
/* harmony import */ var _utils_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(49); | |
/* harmony import */ var _grammar_follow__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(647); | |
/* harmony import */ var _scan_tokens_public__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(96); | |
/* harmony import */ var _cst_cst__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(267); | |
/* harmony import */ var _errors_public__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(137); | |
/* harmony import */ var _grammar_gast_gast_resolver_public__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(181); | |
/* harmony import */ var _traits_recoverable__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(358); | |
/* harmony import */ var _traits_looksahead__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(650); | |
/* harmony import */ var _traits_tree_builder__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(651); | |
/* harmony import */ var _traits_lexer_adapter__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(653); | |
/* harmony import */ var _traits_recognizer_api__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(654); | |
/* harmony import */ var _traits_recognizer_engine__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(655); | |
/* harmony import */ var _traits_error_handler__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(656); | |
/* harmony import */ var _traits_context_assist__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(657); | |
/* harmony import */ var _traits_gast_recorder__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(658); | |
/* harmony import */ var _traits_perf_tracer__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(659); | |
var __extends = (undefined && undefined.__extends) || (function () { | |
var extendStatics = function (d, b) { | |
extendStatics = Object.setPrototypeOf || | |
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | |
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | |
return extendStatics(d, b); | |
}; | |
return function (d, b) { | |
extendStatics(d, b); | |
function __() { this.constructor = d; } | |
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | |
}; | |
})(); | |
var END_OF_FILE = Object(_scan_tokens_public__WEBPACK_IMPORTED_MODULE_2__["createTokenInstance"])(_scan_tokens_public__WEBPACK_IMPORTED_MODULE_2__["EOF"], "", NaN, NaN, NaN, NaN, NaN, NaN); | |
Object.freeze(END_OF_FILE); | |
var DEFAULT_PARSER_CONFIG = Object.freeze({ | |
recoveryEnabled: false, | |
maxLookahead: 4, | |
ignoredIssues: {}, | |
dynamicTokensEnabled: false, | |
outputCst: true, | |
errorMessageProvider: _errors_public__WEBPACK_IMPORTED_MODULE_4__["defaultParserErrorProvider"], | |
nodeLocationTracking: "none", | |
traceInitPerf: false, | |
skipValidations: false | |
}); | |
var DEFAULT_RULE_CONFIG = Object.freeze({ | |
recoveryValueFunc: function () { return undefined; }, | |
resyncEnabled: true | |
}); | |
var ParserDefinitionErrorType; | |
(function (ParserDefinitionErrorType) { | |
ParserDefinitionErrorType[ParserDefinitionErrorType["INVALID_RULE_NAME"] = 0] = "INVALID_RULE_NAME"; | |
ParserDefinitionErrorType[ParserDefinitionErrorType["DUPLICATE_RULE_NAME"] = 1] = "DUPLICATE_RULE_NAME"; | |
ParserDefinitionErrorType[ParserDefinitionErrorType["INVALID_RULE_OVERRIDE"] = 2] = "INVALID_RULE_OVERRIDE"; | |
ParserDefinitionErrorType[ParserDefinitionErrorType["DUPLICATE_PRODUCTIONS"] = 3] = "DUPLICATE_PRODUCTIONS"; | |
ParserDefinitionErrorType[ParserDefinitionErrorType["UNRESOLVED_SUBRULE_REF"] = 4] = "UNRESOLVED_SUBRULE_REF"; | |
ParserDefinitionErrorType[ParserDefinitionErrorType["LEFT_RECURSION"] = 5] = "LEFT_RECURSION"; | |
ParserDefinitionErrorType[ParserDefinitionErrorType["NONE_LAST_EMPTY_ALT"] = 6] = "NONE_LAST_EMPTY_ALT"; | |
ParserDefinitionErrorType[ParserDefinitionErrorType["AMBIGUOUS_ALTS"] = 7] = "AMBIGUOUS_ALTS"; | |
ParserDefinitionErrorType[ParserDefinitionErrorType["CONFLICT_TOKENS_RULES_NAMESPACE"] = 8] = "CONFLICT_TOKENS_RULES_NAMESPACE"; | |
ParserDefinitionErrorType[ParserDefinitionErrorType["INVALID_TOKEN_NAME"] = 9] = "INVALID_TOKEN_NAME"; | |
ParserDefinitionErrorType[ParserDefinitionErrorType["INVALID_NESTED_RULE_NAME"] = 10] = "INVALID_NESTED_RULE_NAME"; | |
ParserDefinitionErrorType[ParserDefinitionErrorType["DUPLICATE_NESTED_NAME"] = 11] = "DUPLICATE_NESTED_NAME"; | |
ParserDefinitionErrorType[ParserDefinitionErrorType["NO_NON_EMPTY_LOOKAHEAD"] = 12] = "NO_NON_EMPTY_LOOKAHEAD"; | |
ParserDefinitionErrorType[ParserDefinitionErrorType["AMBIGUOUS_PREFIX_ALTS"] = 13] = "AMBIGUOUS_PREFIX_ALTS"; | |
ParserDefinitionErrorType[ParserDefinitionErrorType["TOO_MANY_ALTS"] = 14] = "TOO_MANY_ALTS"; | |
})(ParserDefinitionErrorType || (ParserDefinitionErrorType = {})); | |
function EMPTY_ALT(value) { | |
if (value === void 0) { value = undefined; } | |
return function () { | |
return value; | |
}; | |
} | |
var Parser = /** @class */ (function () { | |
function Parser(tokenVocabulary, config) { | |
if (config === void 0) { config = DEFAULT_PARSER_CONFIG; } | |
this.ignoredIssues = DEFAULT_PARSER_CONFIG.ignoredIssues; | |
this.definitionErrors = []; | |
this.selfAnalysisDone = false; | |
var that = this; | |
that.initErrorHandler(config); | |
that.initLexerAdapter(); | |
that.initLooksAhead(config); | |
that.initRecognizerEngine(tokenVocabulary, config); | |
that.initRecoverable(config); | |
that.initTreeBuilder(config); | |
that.initContentAssist(); | |
that.initGastRecorder(config); | |
that.initPerformanceTracer(config); | |
/* istanbul ignore if - complete over-kill to test this, we should only add a test when we actually hard deprecate it and throw an error... */ | |
if (Object(_utils_utils__WEBPACK_IMPORTED_MODULE_0__["has"])(config, "ignoredIssues") && | |
config.ignoredIssues !== DEFAULT_PARSER_CONFIG.ignoredIssues) { | |
Object(_utils_utils__WEBPACK_IMPORTED_MODULE_0__["PRINT_WARNING"])("The <ignoredIssues> IParserConfig property is soft-deprecated and will be removed in future versions.\n\t" + | |
"Please use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead."); | |
} | |
this.ignoredIssues = Object(_utils_utils__WEBPACK_IMPORTED_MODULE_0__["has"])(config, "ignoredIssues") | |
? config.ignoredIssues | |
: DEFAULT_PARSER_CONFIG.ignoredIssues; | |
this.skipValidations = Object(_utils_utils__WEBPACK_IMPORTED_MODULE_0__["has"])(config, "skipValidations") | |
? config.skipValidations | |
: DEFAULT_PARSER_CONFIG.skipValidations; | |
} | |
/** | |
* @deprecated use the **instance** method with the same name instead | |
*/ | |
Parser.performSelfAnalysis = function (parserInstance) { | |
; | |
parserInstance.performSelfAnalysis(); | |
}; | |
Parser.prototype.performSelfAnalysis = function () { | |
var _this = this; | |
this.TRACE_INIT("performSelfAnalysis", function () { | |
var defErrorsMsgs; | |
_this.selfAnalysisDone = true; | |
var className = _this.className; | |
_this.TRACE_INIT("toFastProps", function () { | |
// Without this voodoo magic the parser would be x3-x4 slower | |
// It seems it is better to invoke `toFastProperties` **before** | |
// Any manipulations of the `this` object done during the recording phase. | |
Object(_utils_utils__WEBPACK_IMPORTED_MODULE_0__["toFastProperties"])(_this); | |
}); | |
_this.TRACE_INIT("Grammar Recording", function () { | |
try { | |
_this.enableRecording(); | |
// Building the GAST | |
Object(_utils_utils__WEBPACK_IMPORTED_MODULE_0__["forEach"])(_this.definedRulesNames, function (currRuleName) { | |
var wrappedRule = _this[currRuleName]; | |
var originalGrammarAction = wrappedRule["originalGrammarAction"]; | |
var recordedRuleGast = undefined; | |
_this.TRACE_INIT(currRuleName + " Rule", function () { | |
recordedRuleGast = _this.topLevelRuleRecord(currRuleName, originalGrammarAction); | |
}); | |
_this.gastProductionsCache[currRuleName] = recordedRuleGast; | |
}); | |
} | |
finally { | |
_this.disableRecording(); | |
} | |
}); | |
var resolverErrors = []; | |
_this.TRACE_INIT("Grammar Resolving", function () { | |
resolverErrors = Object(_grammar_gast_gast_resolver_public__WEBPACK_IMPORTED_MODULE_5__["resolveGrammar"])({ | |
rules: Object(_utils_utils__WEBPACK_IMPORTED_MODULE_0__["values"])(_this.gastProductionsCache) | |
}); | |
_this.definitionErrors.push.apply(_this.definitionErrors, resolverErrors); // mutability for the win? | |
}); | |
_this.TRACE_INIT("Grammar Validations", function () { | |
// only perform additional grammar validations IFF no resolving errors have occurred. | |
// as unresolved grammar may lead to unhandled runtime exceptions in the follow up validations. | |
if (Object(_utils_utils__WEBPACK_IMPORTED_MODULE_0__["isEmpty"])(resolverErrors) && _this.skipValidations === false) { | |
var validationErrors = Object(_grammar_gast_gast_resolver_public__WEBPACK_IMPORTED_MODULE_5__["validateGrammar"])({ | |
rules: Object(_utils_utils__WEBPACK_IMPORTED_MODULE_0__["values"])(_this.gastProductionsCache), | |
maxLookahead: _this.maxLookahead, | |
tokenTypes: Object(_utils_utils__WEBPACK_IMPORTED_MODULE_0__["values"])(_this.tokensMap), | |
ignoredIssues: _this.ignoredIssues, | |
errMsgProvider: _errors_public__WEBPACK_IMPORTED_MODULE_4__["defaultGrammarValidatorErrorProvider"], | |
grammarName: className | |
}); | |
_this.definitionErrors.push.apply(_this.definitionErrors, validationErrors); // mutability for the win? | |
} | |
}); | |
// this analysis may fail if the grammar is not perfectly valid | |
if (Object(_utils_utils__WEBPACK_IMPORTED_MODULE_0__["isEmpty"])(_this.definitionErrors)) { | |
// The results of these computations are not needed unless error recovery is enabled. | |
if (_this.recoveryEnabled) { | |
_this.TRACE_INIT("computeAllProdsFollows", function () { | |
var allFollows = Object(_grammar_follow__WEBPACK_IMPORTED_MODULE_1__["computeAllProdsFollows"])(Object(_utils_utils__WEBPACK_IMPORTED_MODULE_0__["values"])(_this.gastProductionsCache)); | |
_this.resyncFollows = allFollows; | |
}); | |
} | |
_this.TRACE_INIT("ComputeLookaheadFunctions", function () { | |
_this.preComputeLookaheadFunctions(Object(_utils_utils__WEBPACK_IMPORTED_MODULE_0__["values"])(_this.gastProductionsCache)); | |
}); | |
} | |
_this.TRACE_INIT("expandAllNestedRuleNames", function () { | |
// TODO: is this needed for EmbeddedActionsParser? | |
var cstAnalysisResult = Object(_cst_cst__WEBPACK_IMPORTED_MODULE_3__["expandAllNestedRuleNames"])(Object(_utils_utils__WEBPACK_IMPORTED_MODULE_0__["values"])(_this.gastProductionsCache), _this.fullRuleNameToShort); | |
_this.allRuleNames = cstAnalysisResult.allRuleNames; | |
}); | |
if (!Parser.DEFER_DEFINITION_ERRORS_HANDLING && | |
!Object(_utils_utils__WEBPACK_IMPORTED_MODULE_0__["isEmpty"])(_this.definitionErrors)) { | |
defErrorsMsgs = Object(_utils_utils__WEBPACK_IMPORTED_MODULE_0__["map"])(_this.definitionErrors, function (defError) { return defError.message; }); | |
throw new Error("Parser Definition Errors detected:\n " + defErrorsMsgs.join("\n-------------------------------\n")); | |
} | |
}); | |
}; | |
// Set this flag to true if you don't want the Parser to throw error when problems in it's definition are detected. | |
// (normally during the parser's constructor). | |
// This is a design time flag, it will not affect the runtime error handling of the parser, just design time errors, | |
// for example: duplicate rule names, referencing an unresolved subrule, ect... | |
// This flag should not be enabled during normal usage, it is used in special situations, for example when | |
// needing to display the parser definition errors in some GUI(online playground). | |
Parser.DEFER_DEFINITION_ERRORS_HANDLING = false; | |
return Parser; | |
}()); | |
Object(_utils_utils__WEBPACK_IMPORTED_MODULE_0__["applyMixins"])(Parser, [ | |
_traits_recoverable__WEBPACK_IMPORTED_MODULE_6__["Recoverable"], | |
_traits_looksahead__WEBPACK_IMPORTED_MODULE_7__["LooksAhead"], | |
_traits_tree_builder__WEBPACK_IMPORTED_MODULE_8__["TreeBuilder"], | |
_traits_lexer_adapter__WEBPACK_IMPORTED_MODULE_9__["LexerAdapter"], | |
_traits_recognizer_engine__WEBPACK_IMPORTED_MODULE_11__["RecognizerEngine"], | |
_traits_recognizer_api__WEBPACK_IMPORTED_MODULE_10__["RecognizerApi"], | |
_traits_error_handler__WEBPACK_IMPORTED_MODULE_12__["ErrorHandler"], | |
_traits_context_assist__WEBPACK_IMPORTED_MODULE_13__["ContentAssist"], | |
_traits_gast_recorder__WEBPACK_IMPORTED_MODULE_14__["GastRecorder"], | |
_traits_perf_tracer__WEBPACK_IMPORTED_MODULE_15__["PerformanceTracer"] | |
]); | |
var CstParser = /** @class */ (function (_super) { | |
__extends(CstParser, _super); | |
function CstParser(tokenVocabulary, config) { | |
if (config === void 0) { config = DEFAULT_PARSER_CONFIG; } | |
var _this = this; | |
var configClone = Object(_utils_utils__WEBPACK_IMPORTED_MODULE_0__["cloneObj"])(config); | |
configClone.outputCst = true; | |
_this = _super.call(this, tokenVocabulary, configClone) || this; | |
return _this; | |
} | |
return CstParser; | |
}(Parser)); | |
var EmbeddedActionsParser = /** @class */ (function (_super) { | |
__extends(EmbeddedActionsParser, _super); | |
function EmbeddedActionsParser(tokenVocabulary, config) { | |
if (config === void 0) { config = DEFAULT_PARSER_CONFIG; } | |
var _this = this; | |
var configClone = Object(_utils_utils__WEBPACK_IMPORTED_MODULE_0__["cloneObj"])(config); | |
configClone.outputCst = false; | |
_this = _super.call(this, tokenVocabulary, configClone) || this; | |
return _this; | |
} | |
return EmbeddedActionsParser; | |
}(Parser)); | |
//# sourceMappingURL=parser.js.map | |
/***/ }), | |
/* 80 */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SimpleRangeValue", function() { return SimpleRangeValue; }); | |
/* harmony import */ var core_js_modules_es_string_iterator_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2); | |
/* harmony import */ var core_js_modules_es_string_iterator_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_string_iterator_js__WEBPACK_IMPORTED_MODULE_0__); | |
/* harmony import */ var core_js_modules_es_array_iterator_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3); | |
/* harmony import */ var core_js_modules_es_array_iterator_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_iterator_js__WEBPACK_IMPORTED_MODULE_1__); | |
/* harmony import */ var core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4); | |
/* harmony import */ var core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_2__); | |
/* harmony import */ var core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(14); | |
/* harmony import */ var core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_3__); | |
/* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(0); | |
/* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_4__); | |
/* harmony import */ var core_js_modules_es_function_name_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(26); | |
/* harmony import */ var core_js_modules_es_function_name_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_function_name_js__WEBPACK_IMPORTED_MODULE_5__); | |
/* harmony import */ var core_js_modules_es_array_from_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(23); | |
/* harmony import */ var core_js_modules_es_array_from_js__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_from_js__WEBPACK_IMPORTED_MODULE_6__); | |
/* harmony import */ var core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(13); | |
/* harmony import */ var core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_7__); | |
/* harmony import */ var core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(9); | |
/* harmony import */ var core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_8__); | |
/* harmony import */ var core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(10); | |
/* harmony import */ var core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_9__); | |
/* harmony import */ var core_js_modules_es_symbol_iterator_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(11); | |
/* harmony import */ var core_js_modules_es_symbol_iterator_js__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_symbol_iterator_js__WEBPACK_IMPORTED_MODULE_10__); | |
/* harmony import */ var regenerator_runtime_runtime_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(87); | |
/* harmony import */ var regenerator_runtime_runtime_js__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(regenerator_runtime_runtime_js__WEBPACK_IMPORTED_MODULE_11__); | |
/* harmony import */ var _ArraySize__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(125); | |
/* harmony import */ var _Cell__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(24); | |
/* harmony import */ var _error_message__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(46); | |
/* harmony import */ var _InterpreterValue__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(51); | |
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } | |
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | |
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } | |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | |
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | |
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | |
/** | |
* @license | |
* Copyright (c) 2021 Handsoncode. All rights reserved. | |
*/ | |
var SimpleRangeValue = /*#__PURE__*/function () { | |
function SimpleRangeValue(_data, range, dependencyGraph, _hasOnlyNumbers) { | |
_classCallCheck(this, SimpleRangeValue); | |
this._data = _data; | |
this.range = range; | |
this.dependencyGraph = dependencyGraph; | |
this._hasOnlyNumbers = _hasOnlyNumbers; | |
if (_data === undefined) { | |
this.size = new _ArraySize__WEBPACK_IMPORTED_MODULE_12__["ArraySize"](range.effectiveWidth(dependencyGraph), range.effectiveHeight(dependencyGraph)); | |
} else { | |
this.size = new _ArraySize__WEBPACK_IMPORTED_MODULE_12__["ArraySize"](_data[0].length, _data.length); | |
} | |
} | |
_createClass(SimpleRangeValue, [{ | |
key: "data", | |
get: function get() { | |
this.ensureThatComputed(); | |
return this._data; | |
} | |
}, { | |
key: "isAdHoc", | |
value: function isAdHoc() { | |
return this.range === undefined; | |
} | |
}, { | |
key: "width", | |
value: function width() { | |
return this.size.width; //should be equal to this.data[0].length | |
} | |
}, { | |
key: "height", | |
value: function height() { | |
return this.size.height; //should be equal to this.data.length | |
} | |
}, { | |
key: "valuesFromTopLeftCorner", | |
value: function valuesFromTopLeftCorner() { | |
this.ensureThatComputed(); | |
var ret = []; | |
for (var i = 0; i < this._data.length; i++) { | |
for (var j = 0; j < this._data[0].length; j++) { | |
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | |
ret.push(this._data[i][j]); | |
} | |
} | |
return ret; | |
} | |
}, { | |
key: "effectiveAddressesFromData", | |
value: /*#__PURE__*/regeneratorRuntime.mark(function effectiveAddressesFromData(leftCorner) { | |
var row, rowData, col; | |
return regeneratorRuntime.wrap(function effectiveAddressesFromData$(_context) { | |
while (1) { | |
switch (_context.prev = _context.next) { | |
case 0: | |
row = 0; | |
case 1: | |
if (!(row < this.data.length)) { | |
_context.next = 13; | |
break; | |
} | |
rowData = this.data[row]; | |
col = 0; | |
case 4: | |
if (!(col < rowData.length)) { | |
_context.next = 10; | |
break; | |
} | |
_context.next = 7; | |
return Object(_Cell__WEBPACK_IMPORTED_MODULE_13__["simpleCellAddress"])(leftCorner.sheet, leftCorner.col + col, leftCorner.row + row); | |
case 7: | |
++col; | |
_context.next = 4; | |
break; | |
case 10: | |
++row; | |
_context.next = 1; | |
break; | |
case 13: | |
case "end": | |
return _context.stop(); | |
} | |
} | |
}, effectiveAddressesFromData, this); | |
}) | |
}, { | |
key: "entriesFromTopLeftCorner", | |
value: /*#__PURE__*/regeneratorRuntime.mark(function entriesFromTopLeftCorner(leftCorner) { | |
var row, col; | |
return regeneratorRuntime.wrap(function entriesFromTopLeftCorner$(_context2) { | |
while (1) { | |
switch (_context2.prev = _context2.next) { | |
case 0: | |
this.ensureThatComputed(); | |
row = 0; | |
case 2: | |
if (!(row < this.size.height)) { | |
_context2.next = 13; | |
break; | |
} | |
col = 0; | |
case 4: | |
if (!(col < this.size.width)) { | |
_context2.next = 10; | |
break; | |
} | |
_context2.next = 7; | |
return [this._data[row][col], Object(_Cell__WEBPACK_IMPORTED_MODULE_13__["simpleCellAddress"])(leftCorner.sheet, leftCorner.col + col, leftCorner.row + row)]; | |
case 7: | |
++col; | |
_context2.next = 4; | |
break; | |
case 10: | |
++row; | |
_context2.next = 2; | |
break; | |
case 13: | |
case "end": | |
return _context2.stop(); | |
} | |
} | |
}, entriesFromTopLeftCorner, this); | |
}) | |
}, { | |
key: "iterateValuesFromTopLeftCorner", | |
value: /*#__PURE__*/regeneratorRuntime.mark(function iterateValuesFromTopLeftCorner() { | |
return regeneratorRuntime.wrap(function iterateValuesFromTopLeftCorner$(_context3) { | |
while (1) { | |
switch (_context3.prev = _context3.next) { | |
case 0: | |
return _context3.delegateYield(this.valuesFromTopLeftCorner(), "t0", 1); | |
case 1: | |
case "end": | |
return _context3.stop(); | |
} | |
} | |
}, iterateValuesFromTopLeftCorner, this); | |
}) | |
}, { | |
key: "numberOfElements", | |
value: function numberOfElements() { | |
return this.size.width * this.size.height; | |
} | |
}, { | |
key: "hasOnlyNumbers", | |
value: function hasOnlyNumbers() { | |
if (this._hasOnlyNumbers === undefined) { | |
this._hasOnlyNumbers = true; | |
var _iterator = _createForOfIteratorHelper(this.data), | |
_step; | |
try { | |
for (_iterator.s(); !(_step = _iterator.n()).done;) { | |
var row = _step.value; | |
var _iterator2 = _createForOfIteratorHelper(row), | |
_step2; | |
try { | |
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { | |
var v = _step2.value; | |
if (typeof v !== 'number') { | |
this._hasOnlyNumbers = false; | |
return false; | |
} | |
} | |
} catch (err) { | |
_iterator2.e(err); | |
} finally { | |
_iterator2.f(); | |
} | |
} | |
} catch (err) { | |
_iterator.e(err); | |
} finally { | |
_iterator.f(); | |
} | |
} | |
return this._hasOnlyNumbers; | |
} | |
}, { | |
key: "rawNumbers", | |
value: function rawNumbers() { | |
return this._data; | |
} | |
}, { | |
key: "rawData", | |
value: function rawData() { | |
var _a; | |
this.ensureThatComputed(); | |
return (_a = this._data) !== null && _a !== void 0 ? _a : []; | |
} | |
}, { | |
key: "sameDimensionsAs", | |
value: function sameDimensionsAs(other) { | |
return this.width() === other.width() && this.height() === other.height(); | |
} | |
}, { | |
key: "ensureThatComputed", | |
value: function ensureThatComputed() { | |
var _this = this; | |
if (this._data !== undefined) { | |
return; | |
} | |
this._hasOnlyNumbers = true; | |
this._data = this.range.addressesArrayMap(this.dependencyGraph, function (cellFromRange) { | |
var value = _this.dependencyGraph.getCellValue(cellFromRange); | |
if (value instanceof SimpleRangeValue) { | |
_this._hasOnlyNumbers = false; | |
return new _Cell__WEBPACK_IMPORTED_MODULE_13__["CellError"](_Cell__WEBPACK_IMPORTED_MODULE_13__["ErrorType"].VALUE, _error_message__WEBPACK_IMPORTED_MODULE_14__["ErrorMessage"].ScalarExpected); | |
} else if (Object(_InterpreterValue__WEBPACK_IMPORTED_MODULE_15__["isExtendedNumber"])(value)) { | |
return value; | |
} else { | |
_this._hasOnlyNumbers = false; | |
return value; | |
} | |
}); | |
} | |
}], [{ | |
key: "fromRange", | |
value: function fromRange(data, range, dependencyGraph) { | |
return new SimpleRangeValue(data, range, dependencyGraph, true); | |
} | |
}, { | |
key: "onlyNumbers", | |
value: function onlyNumbers(data) { | |
return new SimpleRangeValue(data, undefined, undefined, true); | |
} | |
}, { | |
key: "onlyValues", | |
value: function onlyValues(data) { | |
return new SimpleRangeValue(data, undefined, undefined, undefined); | |
} | |
}, { | |
key: "onlyRange", | |
value: function onlyRange(range, dependencyGraph) { | |
return new SimpleRangeValue(undefined, range, dependencyGraph, undefined); | |
} | |
}, { | |
key: "fromScalar", | |
value: function fromScalar(scalar) { | |
return new SimpleRangeValue([[scalar]], undefined, undefined, undefined); | |
} | |
}]); | |
return SimpleRangeValue; | |
}(); | |
/***/ }), | |
/* 81 */ | |
/***/ (function(module, exports) { | |
function _taggedTemplateLiteral(strings, raw) { | |
if (!raw) { | |
raw = strings.slice(0); | |
} | |
return Object.freeze(Object.defineProperties(strings, { | |
raw: { | |
value: Object.freeze(raw) | |
} | |
})); | |
} | |
module.exports = _taggedTemplateLiteral, module.exports.__esModule = true, module.exports["default"] = module.exports; | |
/***/ }), | |
/* 82 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
exports.__esModule = true; | |
exports.toSingleLine = toSingleLine; | |
__webpack_require__(13); | |
__webpack_require__(64); | |
__webpack_require__(107); | |
var _array = __webpack_require__(20); | |
/** | |
* Tags a multiline string and return new one without line break characters and following spaces. | |
* | |
* @param {Array} strings Parts of the entire string without expressions. | |
* @param {...string} expressions Expressions converted to strings, which are added to the entire string. | |
* @returns {string} | |
*/ | |
function toSingleLine(strings) { | |
for (var _len = arguments.length, expressions = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | |
expressions[_key - 1] = arguments[_key]; | |
} | |
var result = (0, _array.arrayReduce)(strings, function (previousValue, currentValue, index) { | |
var valueWithoutWhiteSpaces = currentValue.replace(/\r?\n\s*/g, ''); | |
var expressionForIndex = expressions[index] ? expressions[index] : ''; | |
return previousValue + valueWithoutWhiteSpaces + expressionForIndex; | |
}, ''); | |
return result.trim(); | |
} | |
/***/ }), | |
/* 83 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
exports.__esModule = true; | |
exports.isImmediatePropagationStopped = isImmediatePropagationStopped; | |
exports.isLeftClick = isLeftClick; | |
exports.isRightClick = isRightClick; | |
exports.stopImmediatePropagation = stopImmediatePropagation; | |
/** | |
* Prevent other listeners of the same event from being called. | |
* | |
* @param {Event} event The mouse event object. | |
*/ | |
function stopImmediatePropagation(event) { | |
event.isImmediatePropagationEnabled = false; | |
event.cancelBubble = true; | |
} | |
/** | |
* Check if event was stopped by `stopImmediatePropagation`. | |
* | |
* @param {Event} event The mouse event object. | |
* @returns {boolean} | |
*/ | |
function isImmediatePropagationStopped(event) { | |
return event.isImmediatePropagationEnabled === false; | |
} | |
/** | |
* Check if provided event was triggered by clicking the right mouse button. | |
* | |
* @param {Event} event The mouse event object. | |
* @returns {boolean} | |
*/ | |
function isRightClick(event) { | |
return event.button === 2; | |
} | |
/** | |
* Check if provided event was triggered by clicking the left mouse button. | |
* | |
* @param {Event} event The mouse event object. | |
* @returns {boolean} | |
*/ | |
function isLeftClick(event) { | |
return event.button === 0; | |
} | |
/***/ }), | |
/* 84 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
__webpack_require__(0); | |
__webpack_require__(28); | |
__webpack_require__(54); | |
exports.__esModule = true; | |
var _exportNames = { | |
IndexMapper: true, | |
getRegisteredMapsCounter: true, | |
getIncreasedIndexes: true, | |
getDecreasedIndexes: true, | |
alterUtilsFactory: true | |
}; | |
exports.getRegisteredMapsCounter = exports.getIncreasedIndexes = exports.getDecreasedIndexes = exports.alterUtilsFactory = exports.IndexMapper = void 0; | |
var _indexMapper = __webpack_require__(770); | |
exports.IndexMapper = _indexMapper.IndexMapper; | |
var _mapCollection = __webpack_require__(305); | |
exports.getRegisteredMapsCounter = _mapCollection.getRegisteredMapsCounter; | |
var _utils = __webpack_require__(577); | |
exports.getIncreasedIndexes = _utils.getIncreasedIndexes; | |
exports.getDecreasedIndexes = _utils.getDecreasedIndexes; | |
exports.alterUtilsFactory = _utils.alterUtilsFactory; | |
var _maps = __webpack_require__(575); | |
Object.keys(_maps).forEach(function (key) { | |
if (key === "default" || key === "__esModule") return; | |
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | |
if (key in exports && exports[key] === _maps[key]) return; | |
exports[key] = _maps[key]; | |
}); | |
/***/ }), | |
/* 85 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var $ = __webpack_require__(31); | |
var DESCRIPTORS = __webpack_require__(72); | |
var ownKeys = __webpack_require__(327); | |
var toIndexedObject = __webpack_require__(94); | |
var getOwnPropertyDescriptorModule = __webpack_require__(112); | |
var createProperty = __webpack_require__(152); | |
// `Object.getOwnPropertyDescriptors` method | |
// https://tc39.es/ecma262/#sec-object.getownpropertydescriptors | |
$({ target: 'Object', stat: true, sham: !DESCRIPTORS }, { | |
getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object) { | |
var O = toIndexedObject(object); | |
var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f; | |
var keys = ownKeys(O); | |
var result = {}; | |
var index = 0; | |
var key, descriptor; | |
while (keys.length > index) { | |
descriptor = getOwnPropertyDescriptor(O, key = keys[index++]); | |
if (descriptor !== undefined) createProperty(result, key, descriptor); | |
} | |
return result; | |
} | |
}); | |
/***/ }), | |
/* 86 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var global = __webpack_require__(30); | |
var DESCRIPTORS = __webpack_require__(72); | |
var IE8_DOM_DEFINE = __webpack_require__(323); | |
var V8_PROTOTYPE_DEFINE_BUG = __webpack_require__(324); | |
var anObject = __webpack_require__(66); | |
var toPropertyKey = __webpack_require__(200); | |
var TypeError = global.TypeError; | |
// eslint-disable-next-line es/no-object-defineproperty -- safe | |
var $defineProperty = Object.defineProperty; | |
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe | |
var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; | |
var ENUMERABLE = 'enumerable'; | |
var CONFIGURABLE = 'configurable'; | |
var WRITABLE = 'writable'; | |
// `Object.defineProperty` method | |
// https://tc39.es/ecma262/#sec-object.defineproperty | |
exports.f = DESCRIPTORS ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty(O, P, Attributes) { | |
anObject(O); | |
P = toPropertyKey(P); | |
anObject(Attributes); | |
if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) { | |
var current = $getOwnPropertyDescriptor(O, P); | |
if (current && current[WRITABLE]) { | |
O[P] = Attributes.value; | |
Attributes = { | |
configurable: CONFIGURABLE in Attributes ? Attributes[CONFIGURABLE] : current[CONFIGURABLE], | |
enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE], | |
writable: false | |
}; | |
} | |
} return $defineProperty(O, P, Attributes); | |
} : $defineProperty : function defineProperty(O, P, Attributes) { | |
anObject(O); | |
P = toPropertyKey(P); | |
anObject(Attributes); | |
if (IE8_DOM_DEFINE) try { | |
return $defineProperty(O, P, Attributes); | |
} catch (error) { /* empty */ } | |
if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported'); | |
if ('value' in Attributes) O[P] = Attributes.value; | |
return O; | |
}; | |
/***/ }), | |
/* 87 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
/** | |
* Copyright (c) 2014-present, Facebook, Inc. | |
* | |
* This source code is licensed under the MIT license found in the | |
* LICENSE file in the root directory of this source tree. | |
*/ | |
var runtime = (function (exports) { | |
"use strict"; | |
var Op = Object.prototype; | |
var hasOwn = Op.hasOwnProperty; | |
var undefined; // More compressible than void 0. | |
var $Symbol = typeof Symbol === "function" ? Symbol : {}; | |
var iteratorSymbol = $Symbol.iterator || "@@iterator"; | |
var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator"; | |
var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; | |
function define(obj, key, value) { | |
Object.defineProperty(obj, key, { | |
value: value, | |
enumerable: true, | |
configurable: true, | |
writable: true | |
}); | |
return obj[key]; | |
} | |
try { | |
// IE 8 has a broken Object.defineProperty that only works on DOM objects. | |
define({}, ""); | |
} catch (err) { | |
define = function(obj, key, value) { | |
return obj[key] = value; | |
}; | |
} | |
function wrap(innerFn, outerFn, self, tryLocsList) { | |
// If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator. | |
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator; | |
var generator = Object.create(protoGenerator.prototype); | |
var context = new Context(tryLocsList || []); | |
// The ._invoke method unifies the implementations of the .next, | |
// .throw, and .return methods. | |
generator._invoke = makeInvokeMethod(innerFn, self, context); | |
return generator; | |
} | |
exports.wrap = wrap; | |
// Try/catch helper to minimize deoptimizations. Returns a completion | |
// record like context.tryEntries[i].completion. This interface could | |
// have been (and was previously) designed to take a closure to be | |
// invoked without arguments, but in all the cases we care about we | |
// already have an existing method we want to call, so there's no need | |
// to create a new function object. We can even get away with assuming | |
// the method takes exactly one argument, since that happens to be true | |
// in every case, so we don't have to touch the arguments object. The | |
// only additional allocation required is the completion record, which | |
// has a stable shape and so hopefully should be cheap to allocate. | |
function tryCatch(fn, obj, arg) { | |
try { | |
return { type: "normal", arg: fn.call(obj, arg) }; | |
} catch (err) { | |
return { type: "throw", arg: err }; | |
} | |
} | |
var GenStateSuspendedStart = "suspendedStart"; | |
var GenStateSuspendedYield = "suspendedYield"; | |
var GenStateExecuting = "executing"; | |
var GenStateCompleted = "completed"; | |
// Returning this object from the innerFn has the same effect as | |
// breaking out of the dispatch switch statement. | |
var ContinueSentinel = {}; | |
// Dummy constructor functions that we use as the .constructor and | |
// .constructor.prototype properties for functions that return Generator | |
// objects. For full spec compliance, you may wish to configure your | |
// minifier not to mangle the names of these two functions. | |
function Generator() {} | |
function GeneratorFunction() {} | |
function GeneratorFunctionPrototype() {} | |
// This is a polyfill for %IteratorPrototype% for environments that | |
// don't natively support it. | |
var IteratorPrototype = {}; | |
define(IteratorPrototype, iteratorSymbol, function () { | |
return this; | |
}); | |
var getProto = Object.getPrototypeOf; | |
var NativeIteratorPrototype = getProto && getProto(getProto(values([]))); | |
if (NativeIteratorPrototype && | |
NativeIteratorPrototype !== Op && | |
hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) { | |
// This environment has a native %IteratorPrototype%; use it instead | |
// of the polyfill. | |
IteratorPrototype = NativeIteratorPrototype; | |
} | |
var Gp = GeneratorFunctionPrototype.prototype = | |
Generator.prototype = Object.create(IteratorPrototype); | |
GeneratorFunction.prototype = GeneratorFunctionPrototype; | |
define(Gp, "constructor", GeneratorFunctionPrototype); | |
define(GeneratorFunctionPrototype, "constructor", GeneratorFunction); | |
GeneratorFunction.displayName = define( | |
GeneratorFunctionPrototype, | |
toStringTagSymbol, | |
"GeneratorFunction" | |
); | |
// Helper for defining the .next, .throw, and .return methods of the | |
// Iterator interface in terms of a single ._invoke method. | |
function defineIteratorMethods(prototype) { | |
["next", "throw", "return"].forEach(function(method) { | |
define(prototype, method, function(arg) { | |
return this._invoke(method, arg); | |
}); | |
}); | |
} | |
exports.isGeneratorFunction = function(genFun) { | |
var ctor = typeof genFun === "function" && genFun.constructor; | |
return ctor | |
? ctor === GeneratorFunction || | |
// For the native GeneratorFunction constructor, the best we can | |
// do is to check its .name property. | |
(ctor.displayName || ctor.name) === "GeneratorFunction" | |
: false; | |
}; | |
exports.mark = function(genFun) { | |
if (Object.setPrototypeOf) { | |
Object.setPrototypeOf(genFun, GeneratorFunctionPrototype); | |
} else { | |
genFun.__proto__ = GeneratorFunctionPrototype; | |
define(genFun, toStringTagSymbol, "GeneratorFunction"); | |
} | |
genFun.prototype = Object.create(Gp); | |
return genFun; | |
}; | |
// Within the body of any async function, `await x` is transformed to | |
// `yield regeneratorRuntime.awrap(x)`, so that the runtime can test | |
// `hasOwn.call(value, "__await")` to determine if the yielded value is | |
// meant to be awaited. | |
exports.awrap = function(arg) { | |
return { __await: arg }; | |
}; | |
function AsyncIterator(generator, PromiseImpl) { | |
function invoke(method, arg, resolve, reject) { | |
var record = tryCatch(generator[method], generator, arg); | |
if (record.type === "throw") { | |
reject(record.arg); | |
} else { | |
var result = record.arg; | |
var value = result.value; | |
if (value && | |
typeof value === "object" && | |
hasOwn.call(value, "__await")) { | |
return PromiseImpl.resolve(value.__await).then(function(value) { | |
invoke("next", value, resolve, reject); | |
}, function(err) { | |
invoke("throw", err, resolve, reject); | |
}); | |
} | |
return PromiseImpl.resolve(value).then(function(unwrapped) { | |
// When a yielded Promise is resolved, its final value becomes | |
// the .value of the Promise<{value,done}> result for the | |
// current iteration. | |
result.value = unwrapped; | |
resolve(result); | |
}, function(error) { | |
// If a rejected Promise was yielded, throw the rejection back | |
// into the async generator function so it can be handled there. | |
return invoke("throw", error, resolve, reject); | |
}); | |
} | |
} | |
var previousPromise; | |
function enqueue(method, arg) { | |
function callInvokeWithMethodAndArg() { | |
return new PromiseImpl(function(resolve, reject) { | |
invoke(method, arg, resolve, reject); | |
}); | |
} | |
return previousPromise = | |
// If enqueue has been called before, then we want to wait until | |
// all previous Promises have been resolved before calling invoke, | |
// so that results are always delivered in the correct order. If | |
// enqueue has not been called before, then it is important to | |
// call invoke immediately, without waiting on a callback to fire, | |
// so that the async generator function has the opportunity to do | |
// any necessary setup in a predictable way. This predictability | |
// is why the Promise constructor synchronously invokes its | |
// executor callback, and why async functions synchronously | |
// execute code before the first await. Since we implement simple | |
// async functions in terms of async generators, it is especially | |
// important to get this right, even though it requires care. | |
previousPromise ? previousPromise.then( | |
callInvokeWithMethodAndArg, | |
// Avoid propagating failures to Promises returned by later | |
// invocations of the iterator. | |
callInvokeWithMethodAndArg | |
) : callInvokeWithMethodAndArg(); | |
} | |
// Define the unified helper method that is used to implement .next, | |
// .throw, and .return (see defineIteratorMethods). | |
this._invoke = enqueue; | |
} | |
defineIteratorMethods(AsyncIterator.prototype); | |
define(AsyncIterator.prototype, asyncIteratorSymbol, function () { | |
return this; | |
}); | |
exports.AsyncIterator = AsyncIterator; | |
// Note that simple async functions are implemented on top of | |
// AsyncIterator objects; they just return a Promise for the value of | |
// the final result produced by the iterator. | |
exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) { | |
if (PromiseImpl === void 0) PromiseImpl = Promise; | |
var iter = new AsyncIterator( | |
wrap(innerFn, outerFn, self, tryLocsList), | |
PromiseImpl | |
); | |
return exports.isGeneratorFunction(outerFn) | |
? iter // If outerFn is a generator, return the full iterator. | |
: iter.next().then(function(result) { | |
return result.done ? result.value : iter.next(); | |
}); | |
}; | |
function makeInvokeMethod(innerFn, self, context) { | |
var state = GenStateSuspendedStart; | |
return function invoke(method, arg) { | |
if (state === GenStateExecuting) { | |
throw new Error("Generator is already running"); | |
} | |
if (state === GenStateCompleted) { | |
if (method === "throw") { | |
throw arg; | |
} | |
// Be forgiving, per 25.3.3.3.3 of the spec: | |
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume | |
return doneResult(); | |
} | |
context.method = method; | |
context.arg = arg; | |
while (true) { | |
var delegate = context.delegate; | |
if (delegate) { | |
var delegateResult = maybeInvokeDelegate(delegate, context); | |
if (delegateResult) { | |
if (delegateResult === ContinueSentinel) continue; | |
return delegateResult; | |
} | |
} | |
if (context.method === "next") { | |
// Setting context._sent for legacy support of Babel's | |
// function.sent implementation. | |
context.sent = context._sent = context.arg; | |
} else if (context.method === "throw") { | |
if (state === GenStateSuspendedStart) { | |
state = GenStateCompleted; | |
throw context.arg; | |
} | |
context.dispatchException(context.arg); | |
} else if (context.method === "return") { | |
context.abrupt("return", context.arg); | |
} | |
state = GenStateExecuting; | |
var record = tryCatch(innerFn, self, context); | |
if (record.type === "normal") { | |
// If an exception is thrown from innerFn, we leave state === | |
// GenStateExecuting and loop back for another invocation. | |
state = context.done | |
? GenStateCompleted | |
: GenStateSuspendedYield; | |
if (record.arg === ContinueSentinel) { | |
continue; | |
} | |
return { | |
value: record.arg, | |
done: context.done | |
}; | |
} else if (record.type === "throw") { | |
state = GenStateCompleted; | |
// Dispatch the exception by looping back around to the | |
// context.dispatchException(context.arg) call above. | |
context.method = "throw"; | |
context.arg = record.arg; | |
} | |
} | |
}; | |
} | |
// Call delegate.iterator[context.method](context.arg) and handle the | |
// result, either by returning a { value, done } result from the | |
// delegate iterator, or by modifying context.method and context.arg, | |
// setting context.delegate to null, and returning the ContinueSentinel. | |
function maybeInvokeDelegate(delegate, context) { | |
var method = delegate.iterator[context.method]; | |
if (method === undefined) { | |
// A .throw or .return when the delegate iterator has no .throw | |
// method always terminates the yield* loop. | |
context.delegate = null; | |
if (context.method === "throw") { | |
// Note: ["return"] must be used for ES3 parsing compatibility. | |
if (delegate.iterator["return"]) { | |
// If the delegate iterator has a return method, give it a | |
// chance to clean up. | |
context.method = "return"; | |
context.arg = undefined; | |
maybeInvokeDelegate(delegate, context); | |
if (context.method === "throw") { | |
// If maybeInvokeDelegate(context) changed context.method from | |
// "return" to "throw", let that override the TypeError below. | |
return ContinueSentinel; | |
} | |
} | |
context.method = "throw"; | |
context.arg = new TypeError( | |
"The iterator does not provide a 'throw' method"); | |
} | |
return ContinueSentinel; | |
} | |
var record = tryCatch(method, delegate.iterator, context.arg); | |
if (record.type === "throw") { | |
context.method = "throw"; | |
context.arg = record.arg; | |
context.delegate = null; | |
return ContinueSentinel; | |
} | |
var info = record.arg; | |
if (! info) { | |
context.method = "throw"; | |
context.arg = new TypeError("iterator result is not an object"); | |
context.delegate = null; | |
return ContinueSentinel; | |
} | |
if (info.done) { | |
// Assign the result of the finished delegate to the temporary | |
// variable specified by delegate.resultName (see delegateYield). | |
context[delegate.resultName] = info.value; | |
// Resume execution at the desired location (see delegateYield). | |
context.next = delegate.nextLoc; | |
// If context.method was "throw" but the delegate handled the | |
// exception, let the outer generator proceed normally. If | |
// context.method was "next", forget context.arg since it has been | |
// "consumed" by the delegate iterator. If context.method was | |
// "return", allow the original .return call to continue in the | |
// outer generator. | |
if (context.method !== "return") { | |
context.method = "next"; | |
context.arg = undefined; | |
} | |
} else { | |
// Re-yield the result returned by the delegate method. | |
return info; | |
} | |
// The delegate iterator is finished, so forget it and continue with | |
// the outer generator. | |
context.delegate = null; | |
return ContinueSentinel; | |
} | |
// Define Generator.prototype.{next,throw,return} in terms of the | |
// unified ._invoke helper method. | |
defineIteratorMethods(Gp); | |
define(Gp, toStringTagSymbol, "Generator"); | |
// A Generator should always return itself as the iterator object when the | |
// @@iterator function is called on it. Some browsers' implementations of the | |
// iterator prototype chain incorrectly implement this, causing the Generator | |
// object to not be returned from this call. This ensures that doesn't happen. | |
// See https://github.com/facebook/regenerator/issues/274 for more details. | |
define(Gp, iteratorSymbol, function() { | |
return this; | |
}); | |
define(Gp, "toString", function() { | |
return "[object Generator]"; | |
}); | |
function pushTryEntry(locs) { | |
var entry = { tryLoc: locs[0] }; | |
if (1 in locs) { | |
entry.catchLoc = locs[1]; | |
} | |
if (2 in locs) { | |
entry.finallyLoc = locs[2]; | |
entry.afterLoc = locs[3]; | |
} | |
this.tryEntries.push(entry); | |
} | |
function resetTryEntry(entry) { | |
var record = entry.completion || {}; | |
record.type = "normal"; | |
delete record.arg; | |
entry.completion = record; | |
} | |
function Context(tryLocsList) { | |
// The root entry object (effectively a try statement without a catch | |
// or a finally block) gives us a place to store values thrown from | |
// locations where there is no enclosing try statement. | |
this.tryEntries = [{ tryLoc: "root" }]; | |
tryLocsList.forEach(pushTryEntry, this); | |
this.reset(true); | |
} | |
exports.keys = function(object) { | |
var keys = []; | |
for (var key in object) { | |
keys.push(key); | |
} | |
keys.reverse(); | |
// Rather than returning an object with a next method, we keep | |
// things simple and return the next function itself. | |
return function next() { | |
while (keys.length) { | |
var key = keys.pop(); | |
if (key in object) { | |
next.value = key; | |
next.done = false; | |
return next; | |
} | |
} | |
// To avoid creating an additional object, we just hang the .value | |
// and .done properties off the next function object itself. This | |
// also ensures that the minifier will not anonymize the function. | |
next.done = true; | |
return next; | |
}; | |
}; | |
function values(iterable) { | |
if (iterable) { | |
var iteratorMethod = iterable[iteratorSymbol]; | |
if (iteratorMethod) { | |
return iteratorMethod.call(iterable); | |
} | |
if (typeof iterable.next === "function") { | |
return iterable; | |
} | |
if (!isNaN(iterable.length)) { | |
var i = -1, next = function next() { | |
while (++i < iterable.length) { | |
if (hasOwn.call(iterable, i)) { | |
next.value = iterable[i]; | |
next.done = false; | |
return next; | |
} | |
} | |
next.value = undefined; | |
next.done = true; | |
return next; | |
}; | |
return next.next = next; | |
} | |
} | |
// Return an iterator with no values. | |
return { next: doneResult }; | |
} | |
exports.values = values; | |
function doneResult() { | |
return { value: undefined, done: true }; | |
} | |
Context.prototype = { | |
constructor: Context, | |
reset: function(skipTempReset) { | |
this.prev = 0; | |
this.next = 0; | |
// Resetting context._sent for legacy support of Babel's | |
// function.sent implementation. | |
this.sent = this._sent = undefined; | |
this.done = false; | |
this.delegate = null; | |
this.method = "next"; | |
this.arg = undefined; | |
this.tryEntries.forEach(resetTryEntry); | |
if (!skipTempReset) { | |
for (var name in this) { | |
// Not sure about the optimal order of these conditions: | |
if (name.charAt(0) === "t" && | |
hasOwn.call(this, name) && | |
!isNaN(+name.slice(1))) { | |
this[name] = undefined; | |
} | |
} | |
} | |
}, | |
stop: function() { | |
this.done = true; | |
var rootEntry = this.tryEntries[0]; | |
var rootRecord = rootEntry.completion; | |
if (rootRecord.type === "throw") { | |
throw rootRecord.arg; | |
} | |
return this.rval; | |
}, | |
dispatchException: function(exception) { | |
if (this.done) { | |
throw exception; | |
} | |
var context = this; | |
function handle(loc, caught) { | |
record.type = "throw"; | |
record.arg = exception; | |
context.next = loc; | |
if (caught) { | |
// If the dispatched exception was caught by a catch block, | |
// then let that catch block handle the exception normally. | |
context.method = "next"; | |
context.arg = undefined; | |
} | |
return !! caught; | |
} | |
for (var i = this.tryEntries.length - 1; i >= 0; --i) { | |
var entry = this.tryEntries[i]; | |
var record = entry.completion; | |
if (entry.tryLoc === "root") { | |
// Exception thrown outside of any try block that could handle | |
// it, so set the completion value of the entire function to | |
// throw the exception. | |
return handle("end"); | |
} | |
if (entry.tryLoc <= this.prev) { | |
var hasCatch = hasOwn.call(entry, "catchLoc"); | |
var hasFinally = hasOwn.call(entry, "finallyLoc"); | |
if (hasCatch && hasFinally) { | |
if (this.prev < entry.catchLoc) { | |
return handle(entry.catchLoc, true); | |
} else if (this.prev < entry.finallyLoc) { | |
return handle(entry.finallyLoc); | |
} | |
} else if (hasCatch) { | |
if (this.prev < entry.catchLoc) { | |
return handle(entry.catchLoc, true); | |
} | |
} else if (hasFinally) { | |
if (this.prev < entry.finallyLoc) { | |
return handle(entry.finallyLoc); | |
} | |
} else { | |
throw new Error("try statement without catch or finally"); | |
} | |
} | |
} | |
}, | |
abrupt: function(type, arg) { | |
for (var i = this.tryEntries.length - 1; i >= 0; --i) { | |
var entry = this.tryEntries[i]; | |
if (entry.tryLoc <= this.prev && | |
hasOwn.call(entry, "finallyLoc") && | |
this.prev < entry.finallyLoc) { | |
var finallyEntry = entry; | |
break; | |
} | |
} | |
if (finallyEntry && | |
(type === "break" || | |
type === "continue") && | |
finallyEntry.tryLoc <= arg && | |
arg <= finallyEntry.finallyLoc) { | |
// Ignore the finally entry if control is not jumping to a | |
// location outside the try/catch block. | |
finallyEntry = null; | |
} | |
var record = finallyEntry ? finallyEntry.completion : {}; | |
record.type = type; | |
record.arg = arg; | |
if (finallyEntry) { | |
this.method = "next"; | |
this.next = finallyEntry.finallyLoc; | |
return ContinueSentinel; | |
} | |
return this.complete(record); | |
}, | |
complete: function(record, afterLoc) { | |
if (record.type === "throw") { | |
throw record.arg; | |
} | |
if (record.type === "break" || | |
record.type === "continue") { | |
this.next = record.arg; | |
} else if (record.type === "return") { | |
this.rval = this.arg = record.arg; | |
this.method = "return"; | |
this.next = "end"; | |
} else if (record.type === "normal" && afterLoc) { | |
this.next = afterLoc; | |
} | |
return ContinueSentinel; | |
}, | |
finish: function(finallyLoc) { | |
for (var i = this.tryEntries.length - 1; i >= 0; --i) { | |
var entry = this.tryEntries[i]; | |
if (entry.finallyLoc === finallyLoc) { | |
this.complete(entry.completion, entry.afterLoc); | |
resetTryEntry(entry); | |
return ContinueSentinel; | |
} | |
} | |
}, | |
"catch": function(tryLoc) { | |
for (var i = this.tryEntries.length - 1; i >= 0; --i) { | |
var entry = this.tryEntries[i]; | |
if (entry.tryLoc === tryLoc) { | |
var record = entry.completion; | |
if (record.type === "throw") { | |
var thrown = record.arg; | |
resetTryEntry(entry); | |
} | |
return thrown; | |
} | |
} | |
// The context.catch method must only be called with a location | |
// argument that corresponds to a known catch block. | |
throw new Error("illegal catch attempt"); | |
}, | |
delegateYield: function(iterable, resultName, nextLoc) { | |
this.delegate = { | |
iterator: values(iterable), | |
resultName: resultName, | |
nextLoc: nextLoc | |
}; | |
if (this.method === "next") { | |
// Deliberately forget the last sent value so that we don't | |
// accidentally pass it on to the delegate. | |
this.arg = undefined; | |
} | |
return ContinueSentinel; | |
} | |
}; | |
// Regardless of whether this script is executing as a CommonJS module | |
// or not, return the runtime object so that we can declare the variable | |
// regeneratorRuntime in the outer scope, which allows this module to be | |
// injected easily by `bin/regenerator --include-runtime script.js`. | |
return exports; | |
}( | |
// If this script is executing as a CommonJS module, use module.exports | |
// as the regeneratorRuntime namespace. Otherwise create a new empty | |
// object. Either way, the resulting object will be used to initialize | |
// the regeneratorRuntime variable at the top of this file. | |
true ? module.exports : undefined | |
)); | |
try { | |
regeneratorRuntime = runtime; | |
} catch (accidentalStrictMode) { | |
// This module should not be running in strict mode, so the above | |
// assignment should always work unless something is misconfigured. Just | |
// in case runtime.js accidentally runs in strict mode, in modern engines | |
// we can explicitly access globalThis. In older engines we can escape | |
// strict mode using a global Function call. This could conceivably fail | |
// if a Content Security Policy forbids using Function, but in that case | |
// the proper solution is to fix the accidental strict mode problem. If | |
// you've misconfigured your bundler to force strict mode and applied a | |
// CSP to forbid Function, and you're not willing to fix either of those | |
// problems, please detail your unique predicament in a GitHub issue. | |
if (typeof globalThis === "object") { | |
globalThis.regeneratorRuntime = runtime; | |
} else { | |
Function("r", "regeneratorRuntime = r")(runtime); | |
} | |
} | |
/***/ }), | |
/* 88 */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WRONG_RANGE_SIZE", function() { return WRONG_RANGE_SIZE; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isSimpleCellRange", function() { return isSimpleCellRange; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "simpleCellRange", function() { return simpleCellRange; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AbsoluteCellRange", function() { return AbsoluteCellRange; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AbsoluteColumnRange", function() { return AbsoluteColumnRange; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AbsoluteRowRange", function() { return AbsoluteRowRange; }); | |
/* harmony import */ var regenerator_runtime_runtime_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(87); | |
/* harmony import */ var regenerator_runtime_runtime_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(regenerator_runtime_runtime_js__WEBPACK_IMPORTED_MODULE_0__); | |
/* harmony import */ var core_js_modules_es_number_is_finite_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(260); | |
/* harmony import */ var core_js_modules_es_number_is_finite_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_number_is_finite_js__WEBPACK_IMPORTED_MODULE_1__); | |
/* harmony import */ var core_js_modules_es_number_constructor_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(53); | |
/* harmony import */ var core_js_modules_es_number_constructor_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_number_constructor_js__WEBPACK_IMPORTED_MODULE_2__); | |
/* harmony import */ var core_js_modules_es_array_concat_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(21); | |
/* harmony import */ var core_js_modules_es_array_concat_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_concat_js__WEBPACK_IMPORTED_MODULE_3__); | |
/* harmony import */ var core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(9); | |
/* harmony import */ var core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_4__); | |
/* harmony import */ var core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(10); | |
/* harmony import */ var core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_5__); | |
/* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(0); | |
/* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_6__); | |
/* harmony import */ var core_js_modules_es_symbol_iterator_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(11); | |
/* harmony import */ var core_js_modules_es_symbol_iterator_js__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_symbol_iterator_js__WEBPACK_IMPORTED_MODULE_7__); | |
/* harmony import */ var core_js_modules_es_array_iterator_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(3); | |
/* harmony import */ var core_js_modules_es_array_iterator_js__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_iterator_js__WEBPACK_IMPORTED_MODULE_8__); | |
/* harmony import */ var core_js_modules_es_string_iterator_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(2); | |
/* harmony import */ var core_js_modules_es_string_iterator_js__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_string_iterator_js__WEBPACK_IMPORTED_MODULE_9__); | |
/* harmony import */ var core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(4); | |
/* harmony import */ var core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_10__); | |
/* harmony import */ var core_js_modules_es_object_get_prototype_of_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(27); | |
/* harmony import */ var core_js_modules_es_object_get_prototype_of_js__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_get_prototype_of_js__WEBPACK_IMPORTED_MODULE_11__); | |
/* harmony import */ var core_js_modules_es_reflect_construct_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(7); | |
/* harmony import */ var core_js_modules_es_reflect_construct_js__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_reflect_construct_js__WEBPACK_IMPORTED_MODULE_12__); | |
/* harmony import */ var _Cell__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(24); | |
/* harmony import */ var _errors__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(41); | |
/* harmony import */ var _parser__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(70); | |
/* harmony import */ var _Span__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(182); | |
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } | |
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | |
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | |
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } | |
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | |
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | |
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | |
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | |
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | |
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | |
/** | |
* @license | |
* Copyright (c) 2021 Handsoncode. All rights reserved. | |
*/ | |
var WRONG_RANGE_SIZE = 'AbsoluteCellRange: Wrong range size'; | |
function isSimpleCellRange(obj) { | |
if (obj && (_typeof(obj) === 'object' || typeof obj === 'function')) { | |
return 'start' in obj && Object(_Cell__WEBPACK_IMPORTED_MODULE_13__["isSimpleCellAddress"])(obj.start) && 'end' in obj && Object(_Cell__WEBPACK_IMPORTED_MODULE_13__["isSimpleCellAddress"])(obj.end); | |
} else { | |
return false; | |
} | |
} | |
var simpleCellRange = function simpleCellRange(start, end) { | |
return { | |
start: start, | |
end: end | |
}; | |
}; | |
var AbsoluteCellRange = /*#__PURE__*/function () { | |
function AbsoluteCellRange(start, end) { | |
_classCallCheck(this, AbsoluteCellRange); | |
if (start.sheet !== end.sheet) { | |
throw new _errors__WEBPACK_IMPORTED_MODULE_14__["SheetsNotEqual"](start.sheet, end.sheet); | |
} | |
this.start = Object(_Cell__WEBPACK_IMPORTED_MODULE_13__["simpleCellAddress"])(start.sheet, start.col, start.row); | |
this.end = Object(_Cell__WEBPACK_IMPORTED_MODULE_13__["simpleCellAddress"])(end.sheet, end.col, end.row); | |
} | |
_createClass(AbsoluteCellRange, [{ | |
key: "sheet", | |
get: function get() { | |
return this.start.sheet; | |
} | |
}, { | |
key: "isFinite", | |
value: function isFinite() { | |
return Number.isFinite(this.size()); | |
} | |
}, { | |
key: "doesOverlap", | |
value: function doesOverlap(other) { | |
if (this.start.sheet != other.start.sheet) { | |
return false; | |
} | |
if (this.end.row < other.start.row || this.start.row > other.end.row) { | |
return false; | |
} | |
if (this.end.col < other.start.col || this.start.col > other.end.col) { | |
return false; | |
} | |
return true; | |
} | |
}, { | |
key: "addressInRange", | |
value: function addressInRange(address) { | |
if (this.sheet !== address.sheet) { | |
return false; | |
} | |
return this.start.row <= address.row && this.end.row >= address.row && this.start.col <= address.col && this.end.col >= address.col; | |
} | |
}, { | |
key: "columnInRange", | |
value: function columnInRange(address) { | |
if (this.sheet !== address.sheet) { | |
return false; | |
} | |
return this.start.col <= address.col && this.end.col >= address.col; | |
} | |
}, { | |
key: "rowInRange", | |
value: function rowInRange(address) { | |
if (this.sheet !== address.sheet) { | |
return false; | |
} | |
return this.start.row <= address.row && this.end.row >= address.row; | |
} | |
}, { | |
key: "containsRange", | |
value: function containsRange(range) { | |
return this.addressInRange(range.start) && this.addressInRange(range.end); | |
} | |
}, { | |
key: "intersectionWith", | |
value: function intersectionWith(other) { | |
if (this.sheet !== other.start.sheet) { | |
return undefined; | |
} | |
var startRow = Math.max(this.start.row, other.start.row); | |
var endRow = Math.min(this.end.row, other.end.row); | |
var startCol = Math.max(this.start.col, other.start.col); | |
var endCol = Math.min(this.end.col, other.end.col); | |
if (startRow > endRow || startCol > endCol) { | |
return undefined; | |
} | |
return new AbsoluteCellRange(Object(_Cell__WEBPACK_IMPORTED_MODULE_13__["simpleCellAddress"])(this.sheet, startCol, startRow), Object(_Cell__WEBPACK_IMPORTED_MODULE_13__["simpleCellAddress"])(this.sheet, endCol, endRow)); | |
} | |
}, { | |
key: "includesRow", | |
value: function includesRow(row) { | |
return this.start.row < row && this.end.row >= row; | |
} | |
}, { | |
key: "includesColumn", | |
value: function includesColumn(column) { | |
return this.start.col < column && this.end.col >= column; | |
} | |
}, { | |
key: "shiftByRows", | |
value: function shiftByRows(numberOfRows) { | |
this.start.row += numberOfRows; | |
this.end.row += numberOfRows; | |
} | |
}, { | |
key: "expandByRows", | |
value: function expandByRows(numberOfRows) { | |
this.end.row += numberOfRows; | |
} | |
}, { | |
key: "shiftByColumns", | |
value: function shiftByColumns(numberOfColumns) { | |
this.start.col += numberOfColumns; | |
this.end.col += numberOfColumns; | |
} | |
}, { | |
key: "shifted", | |
value: function shifted(byCols, byRows) { | |
return AbsoluteCellRange.spanFrom(Object(_Cell__WEBPACK_IMPORTED_MODULE_13__["simpleCellAddress"])(this.sheet, this.start.col + byCols, this.start.row + byRows), this.width(), this.height()); | |
} | |
}, { | |
key: "expandByColumns", | |
value: function expandByColumns(numberOfColumns) { | |
this.end.col += numberOfColumns; | |
} | |
}, { | |
key: "moveToSheet", | |
value: function moveToSheet(toSheet) { | |
this.start.sheet = toSheet; | |
this.end.sheet = toSheet; | |
} | |
}, { | |
key: "removeSpan", | |
value: function removeSpan(span) { | |
if (span instanceof _Span__WEBPACK_IMPORTED_MODULE_16__["RowsSpan"]) { | |
this.removeRows(span.start, span.end); | |
} else { | |
this.removeColumns(span.start, span.end); | |
} | |
} | |
}, { | |
key: "shouldBeRemoved", | |
value: function shouldBeRemoved() { | |
return this.width() <= 0 || this.height() <= 0; | |
} | |
}, { | |
key: "rangeWithSameWidth", | |
value: function rangeWithSameWidth(startRow, numberOfRows) { | |
return AbsoluteCellRange.spanFrom(Object(_Cell__WEBPACK_IMPORTED_MODULE_13__["simpleCellAddress"])(this.sheet, this.start.col, startRow), this.width(), numberOfRows); | |
} | |
}, { | |
key: "rangeWithSameHeight", | |
value: function rangeWithSameHeight(startColumn, numberOfColumns) { | |
return AbsoluteCellRange.spanFrom(Object(_Cell__WEBPACK_IMPORTED_MODULE_13__["simpleCellAddress"])(this.sheet, startColumn, this.start.row), numberOfColumns, this.height()); | |
} | |
}, { | |
key: "toString", | |
value: function toString() { | |
return "".concat(this.start.sheet, ",").concat(this.start.col, ",").concat(this.start.row, ",").concat(this.end.col, ",").concat(this.end.row); | |
} | |
}, { | |
key: "width", | |
value: function width() { | |
return this.end.col - this.start.col + 1; | |
} | |
}, { | |
key: "height", | |
value: function height() { | |
return this.end.row - this.start.row + 1; | |
} | |
}, { | |
key: "size", | |
value: function size() { | |
return this.height() * this.width(); | |
} | |
}, { | |
key: "arrayOfAddressesInRange", | |
value: function arrayOfAddressesInRange() { | |
var result = []; | |
for (var y = 0; y < this.height(); ++y) { | |
result[y] = []; | |
for (var x = 0; x < this.width(); ++x) { | |
var value = Object(_Cell__WEBPACK_IMPORTED_MODULE_13__["simpleCellAddress"])(this.sheet, this.start.col + x, this.start.row + y); | |
result[y].push(value); | |
} | |
} | |
return result; | |
} | |
}, { | |
key: "withStart", | |
value: function withStart(newStart) { | |
return new AbsoluteCellRange(newStart, this.end); | |
} | |
}, { | |
key: "sameDimensionsAs", | |
value: function sameDimensionsAs(other) { | |
return this.width() === other.width() && this.height() === other.height(); | |
} | |
}, { | |
key: "sameAs", | |
value: function sameAs(other) { | |
return Object(_Cell__WEBPACK_IMPORTED_MODULE_13__["equalSimpleCellAddress"])(this.start, other.start) && Object(_Cell__WEBPACK_IMPORTED_MODULE_13__["equalSimpleCellAddress"])(this.end, other.end); | |
} | |
}, { | |
key: "addressesArrayMap", | |
value: function addressesArrayMap(dependencyGraph, op) { | |
var ret = []; | |
var currentRow = this.start.row; | |
while (currentRow <= this.effectiveEndRow(dependencyGraph)) { | |
var currentColumn = this.start.col; | |
var tmp = []; | |
while (currentColumn <= this.effectiveEndColumn(dependencyGraph)) { | |
tmp.push(op(Object(_Cell__WEBPACK_IMPORTED_MODULE_13__["simpleCellAddress"])(this.start.sheet, currentColumn, currentRow))); | |
currentColumn++; | |
} | |
ret.push(tmp); | |
currentRow++; | |
} | |
return ret; | |
} | |
}, { | |
key: "addresses", | |
value: function addresses(dependencyGraph) { | |
var ret = []; | |
var currentRow = this.start.row; | |
var limitRow = this.effectiveEndRow(dependencyGraph); | |
var limitColumn = this.effectiveEndColumn(dependencyGraph); | |
while (currentRow <= limitRow) { | |
var currentColumn = this.start.col; | |
while (currentColumn <= limitColumn) { | |
ret.push(Object(_Cell__WEBPACK_IMPORTED_MODULE_13__["simpleCellAddress"])(this.start.sheet, currentColumn, currentRow)); | |
currentColumn++; | |
} | |
currentRow++; | |
} | |
return ret; | |
} | |
}, { | |
key: "addressesWithDirection", | |
value: /*#__PURE__*/regeneratorRuntime.mark(function addressesWithDirection(right, bottom, dependencyGraph) { | |
var currentRow, currentColumn, _currentRow, _currentColumn, _currentRow2, _currentColumn2, _currentRow3, _currentColumn3; | |
return regeneratorRuntime.wrap(function addressesWithDirection$(_context) { | |
while (1) { | |
switch (_context.prev = _context.next) { | |
case 0: | |
if (!(right > 0)) { | |
_context.next = 30; | |
break; | |
} | |
if (!(bottom > 0)) { | |
_context.next = 16; | |
break; | |
} | |
currentRow = this.effectiveEndRow(dependencyGraph); | |
case 3: | |
if (!(currentRow >= this.start.row)) { | |
_context.next = 14; | |
break; | |
} | |
currentColumn = this.effectiveEndColumn(dependencyGraph); | |
case 5: | |
if (!(currentColumn >= this.start.col)) { | |
_context.next = 11; | |
break; | |
} | |
_context.next = 8; | |
return Object(_Cell__WEBPACK_IMPORTED_MODULE_13__["simpleCellAddress"])(this.start.sheet, currentColumn, currentRow); | |
case 8: | |
currentColumn -= 1; | |
_context.next = 5; | |
break; | |
case 11: | |
currentRow -= 1; | |
_context.next = 3; | |
break; | |
case 14: | |
_context.next = 28; | |
break; | |
case 16: | |
_currentRow = this.start.row; | |
case 17: | |
if (!(_currentRow <= this.effectiveEndRow(dependencyGraph))) { | |
_context.next = 28; | |
break; | |
} | |
_currentColumn = this.effectiveEndColumn(dependencyGraph); | |
case 19: | |
if (!(_currentColumn >= this.start.col)) { | |
_context.next = 25; | |
break; | |
} | |
_context.next = 22; | |
return Object(_Cell__WEBPACK_IMPORTED_MODULE_13__["simpleCellAddress"])(this.start.sheet, _currentColumn, _currentRow); | |
case 22: | |
_currentColumn -= 1; | |
_context.next = 19; | |
break; | |
case 25: | |
_currentRow += 1; | |
_context.next = 17; | |
break; | |
case 28: | |
_context.next = 57; | |
break; | |
case 30: | |
if (!(bottom > 0)) { | |
_context.next = 45; | |
break; | |
} | |
_currentRow2 = this.effectiveEndRow(dependencyGraph); | |
case 32: | |
if (!(_currentRow2 >= this.start.row)) { | |
_context.next = 43; | |
break; | |
} | |
_currentColumn2 = this.start.col; | |
case 34: | |
if (!(_currentColumn2 <= this.effectiveEndColumn(dependencyGraph))) { | |
_context.next = 40; | |
break; | |
} | |
_context.next = 37; | |
return Object(_Cell__WEBPACK_IMPORTED_MODULE_13__["simpleCellAddress"])(this.start.sheet, _currentColumn2, _currentRow2); | |
case 37: | |
_currentColumn2 += 1; | |
_context.next = 34; | |
break; | |
case 40: | |
_currentRow2 -= 1; | |
_context.next = 32; | |
break; | |
case 43: | |
_context.next = 57; | |
break; | |
case 45: | |
_currentRow3 = this.start.row; | |
case 46: | |
if (!(_currentRow3 <= this.effectiveEndRow(dependencyGraph))) { | |
_context.next = 57; | |
break; | |
} | |
_currentColumn3 = this.start.col; | |
case 48: | |
if (!(_currentColumn3 <= this.effectiveEndColumn(dependencyGraph))) { | |
_context.next = 54; | |
break; | |
} | |
_context.next = 51; | |
return Object(_Cell__WEBPACK_IMPORTED_MODULE_13__["simpleCellAddress"])(this.start.sheet, _currentColumn3, _currentRow3); | |
case 51: | |
_currentColumn3 += 1; | |
_context.next = 48; | |
break; | |
case 54: | |
_currentRow3 += 1; | |
_context.next = 46; | |
break; | |
case 57: | |
case "end": | |
return _context.stop(); | |
} | |
} | |
}, addressesWithDirection, this); | |
}) | |
}, { | |
key: "getAddress", | |
value: function getAddress(col, row) { | |
if (col < 0 || row < 0 || row > this.height() - 1 || col > this.width() - 1) { | |
throw Error('Index out of bound'); | |
} | |
return Object(_Cell__WEBPACK_IMPORTED_MODULE_13__["simpleCellAddress"])(this.start.sheet, this.start.col + col, this.start.row + row); | |
} | |
}, { | |
key: "exceedsSheetSizeLimits", | |
value: function exceedsSheetSizeLimits(maxColumns, maxRows) { | |
return this.end.col >= maxColumns || this.end.row >= maxRows; | |
} | |
}, { | |
key: "effectiveEndColumn", | |
value: function effectiveEndColumn(_dependencyGraph) { | |
return this.end.col; | |
} | |
}, { | |
key: "effectiveEndRow", | |
value: function effectiveEndRow(_dependencyGraph) { | |
return this.end.row; | |
} | |
}, { | |
key: "effectiveWidth", | |
value: function effectiveWidth(_dependencyGraph) { | |
return this.width(); | |
} | |
}, { | |
key: "effectiveHeight", | |
value: function effectiveHeight(_dependencyGraph) { | |
return this.height(); | |
} | |
}, { | |
key: "removeRows", | |
value: function removeRows(rowStart, rowEnd) { | |
if (rowStart > this.end.row) { | |
return; | |
} | |
if (rowEnd < this.start.row) { | |
var numberOfRows = rowEnd - rowStart + 1; | |
return this.shiftByRows(-numberOfRows); | |
} | |
if (rowStart <= this.start.row) { | |
this.start.row = rowStart; | |
} | |
this.end.row -= Math.min(rowEnd, this.end.row) - rowStart + 1; | |
} | |
}, { | |
key: "removeColumns", | |
value: function removeColumns(columnStart, columnEnd) { | |
if (columnStart > this.end.col) { | |
return; | |
} | |
if (columnEnd < this.start.col) { | |
var numberOfColumns = columnEnd - columnStart + 1; | |
return this.shiftByColumns(-numberOfColumns); | |
} | |
if (columnStart <= this.start.col) { | |
this.start.col = columnStart; | |
} | |
this.end.col -= Math.min(columnEnd, this.end.col) - columnStart + 1; | |
} | |
}], [{ | |
key: "fromAst", | |
value: function fromAst(ast, baseAddress) { | |
if (ast.type === _parser__WEBPACK_IMPORTED_MODULE_15__["AstNodeType"].CELL_RANGE) { | |
return AbsoluteCellRange.fromCellRange(ast, baseAddress); | |
} else if (ast.type === _parser__WEBPACK_IMPORTED_MODULE_15__["AstNodeType"].COLUMN_RANGE) { | |
return AbsoluteColumnRange.fromColumnRange(ast, baseAddress); | |
} else { | |
return AbsoluteRowRange.fromRowRangeAst(ast, baseAddress); | |
} | |
} | |
}, { | |
key: "fromAstOrUndef", | |
value: function fromAstOrUndef(ast, baseAddress) { | |
try { | |
return AbsoluteCellRange.fromAst(ast, baseAddress); | |
} catch (_e) { | |
return undefined; | |
} | |
} | |
}, { | |
key: "fromCellRange", | |
value: function fromCellRange(x, baseAddress) { | |
return new AbsoluteCellRange(x.start.toSimpleCellAddress(baseAddress), x.end.toSimpleCellAddress(baseAddress)); | |
} | |
}, { | |
key: "spanFrom", | |
value: function spanFrom(topLeftCorner, width, height) { | |
var ret = AbsoluteCellRange.spanFromOrUndef(topLeftCorner, width, height); | |
if (ret === undefined) { | |
throw new Error(WRONG_RANGE_SIZE); | |
} | |
return ret; | |
} | |
}, { | |
key: "spanFromOrUndef", | |
value: function spanFromOrUndef(topLeftCorner, width, height) { | |
if (!Number.isFinite(width) && Number.isFinite(height)) { | |
if (topLeftCorner.col !== 0) { | |
return undefined; | |
} | |
return new AbsoluteRowRange(topLeftCorner.sheet, topLeftCorner.row, topLeftCorner.row + height - 1); | |
} else if (!Number.isFinite(height) && Number.isFinite(width)) { | |
if (topLeftCorner.row !== 0) { | |
return undefined; | |
} | |
return new AbsoluteColumnRange(topLeftCorner.sheet, topLeftCorner.col, topLeftCorner.col + width - 1); | |
} else if (Number.isFinite(height) && Number.isFinite(width)) { | |
return new AbsoluteCellRange(topLeftCorner, Object(_Cell__WEBPACK_IMPORTED_MODULE_13__["simpleCellAddress"])(topLeftCorner.sheet, topLeftCorner.col + width - 1, topLeftCorner.row + height - 1)); | |
} | |
return undefined; | |
} | |
}, { | |
key: "fromCoordinates", | |
value: function fromCoordinates(sheet, x1, y1, x2, y2) { | |
return new AbsoluteCellRange(Object(_Cell__WEBPACK_IMPORTED_MODULE_13__["simpleCellAddress"])(sheet, x1, y1), Object(_Cell__WEBPACK_IMPORTED_MODULE_13__["simpleCellAddress"])(sheet, x2, y2)); | |
} | |
}]); | |
return AbsoluteCellRange; | |
}(); | |
var AbsoluteColumnRange = /*#__PURE__*/function (_AbsoluteCellRange) { | |
_inherits(AbsoluteColumnRange, _AbsoluteCellRange); | |
var _super = _createSuper(AbsoluteColumnRange); | |
function AbsoluteColumnRange(sheet, columnStart, columnEnd) { | |
_classCallCheck(this, AbsoluteColumnRange); | |
return _super.call(this, Object(_Cell__WEBPACK_IMPORTED_MODULE_13__["simpleCellAddress"])(sheet, columnStart, 0), Object(_Cell__WEBPACK_IMPORTED_MODULE_13__["simpleCellAddress"])(sheet, columnEnd, Number.POSITIVE_INFINITY)); | |
} | |
_createClass(AbsoluteColumnRange, [{ | |
key: "shouldBeRemoved", | |
value: function shouldBeRemoved() { | |
return this.width() <= 0; | |
} | |
}, { | |
key: "shiftByRows", | |
value: function shiftByRows(_numberOfRows) { | |
return; | |
} | |
}, { | |
key: "expandByRows", | |
value: function expandByRows(_numberOfRows) { | |
return; | |
} | |
}, { | |
key: "shifted", | |
value: function shifted(byCols, _byRows) { | |
return new AbsoluteColumnRange(this.sheet, this.start.col + byCols, this.end.col + byCols); | |
} | |
}, { | |
key: "rangeWithSameHeight", | |
value: function rangeWithSameHeight(startColumn, numberOfColumns) { | |
return new AbsoluteColumnRange(this.sheet, startColumn, startColumn + numberOfColumns - 1); | |
} | |
}, { | |
key: "exceedsSheetSizeLimits", | |
value: function exceedsSheetSizeLimits(maxColumns, _maxRows) { | |
return this.end.col >= maxColumns; | |
} | |
}, { | |
key: "effectiveEndRow", | |
value: function effectiveEndRow(dependencyGraph) { | |
return this.effectiveHeight(dependencyGraph) - 1; | |
} | |
}, { | |
key: "effectiveHeight", | |
value: function effectiveHeight(dependencyGraph) { | |
return dependencyGraph.getSheetHeight(this.sheet); | |
} | |
}, { | |
key: "removeRows", | |
value: function removeRows(_rowStart, _rowEnd) { | |
return; | |
} | |
}], [{ | |
key: "fromColumnRange", | |
value: function fromColumnRange(x, baseAddress) { | |
var start = x.start.toSimpleColumnAddress(baseAddress); | |
var end = x.end.toSimpleColumnAddress(baseAddress); | |
if (start.sheet !== end.sheet) { | |
throw new _errors__WEBPACK_IMPORTED_MODULE_14__["SheetsNotEqual"](start.sheet, end.sheet); | |
} | |
return new AbsoluteColumnRange(start.sheet, start.col, end.col); | |
} | |
}]); | |
return AbsoluteColumnRange; | |
}(AbsoluteCellRange); | |
var AbsoluteRowRange = /*#__PURE__*/function (_AbsoluteCellRange2) { | |
_inherits(AbsoluteRowRange, _AbsoluteCellRange2); | |
var _super2 = _createSuper(AbsoluteRowRange); | |
function AbsoluteRowRange(sheet, rowStart, rowEnd) { | |
_classCallCheck(this, AbsoluteRowRange); | |
return _super2.call(this, Object(_Cell__WEBPACK_IMPORTED_MODULE_13__["simpleCellAddress"])(sheet, 0, rowStart), Object(_Cell__WEBPACK_IMPORTED_MODULE_13__["simpleCellAddress"])(sheet, Number.POSITIVE_INFINITY, rowEnd)); | |
} | |
_createClass(AbsoluteRowRange, [{ | |
key: "shouldBeRemoved", | |
value: function shouldBeRemoved() { | |
return this.height() <= 0; | |
} | |
}, { | |
key: "shiftByColumns", | |
value: function shiftByColumns(_numberOfColumns) { | |
return; | |
} | |
}, { | |
key: "expandByColumns", | |
value: function expandByColumns(_numberOfColumns) { | |
return; | |
} | |
}, { | |
key: "shifted", | |
value: function shifted(byCols, byRows) { | |
return new AbsoluteRowRange(this.sheet, this.start.row + byRows, this.end.row + byRows); | |
} | |
}, { | |
key: "rangeWithSameWidth", | |
value: function rangeWithSameWidth(startRow, numberOfRows) { | |
return new AbsoluteRowRange(this.sheet, startRow, startRow + numberOfRows - 1); | |
} | |
}, { | |
key: "exceedsSheetSizeLimits", | |
value: function exceedsSheetSizeLimits(_maxColumns, maxRows) { | |
return this.end.row >= maxRows; | |
} | |
}, { | |
key: "effectiveEndColumn", | |
value: function effectiveEndColumn(dependencyGraph) { | |
return this.effectiveWidth(dependencyGraph) - 1; | |
} | |
}, { | |
key: "effectiveWidth", | |
value: function effectiveWidth(dependencyGraph) { | |
return dependencyGraph.getSheetWidth(this.sheet); | |
} | |
}, { | |
key: "removeColumns", | |
value: function removeColumns(_columnStart, _columnEnd) { | |
return; | |
} | |
}], [{ | |
key: "fromRowRangeAst", | |
value: function fromRowRangeAst(x, baseAddress) { | |
var start = x.start.toSimpleRowAddress(baseAddress); | |
var end = x.end.toSimpleRowAddress(baseAddress); | |
if (start.sheet !== end.sheet) { | |
throw new _errors__WEBPACK_IMPORTED_MODULE_14__["SheetsNotEqual"](start.sheet, end.sheet); | |
} | |
return new AbsoluteRowRange(start.sheet, start.row, end.row); | |
} | |
}]); | |
return AbsoluteRowRange; | |
}(AbsoluteCellRange); | |
/***/ }), | |
/* 89 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var $ = __webpack_require__(31); | |
var assign = __webpack_require__(640); | |
// `Object.assign` method | |
// https://tc39.es/ecma262/#sec-object.assign | |
// eslint-disable-next-line es/no-object-assign -- required for testing | |
$({ target: 'Object', stat: true, forced: Object.assign !== assign }, { | |
assign: assign | |
}); | |
/***/ }), | |
/* 90 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
exports.__esModule = true; | |
exports.error = error; | |
exports.info = info; | |
exports.log = log; | |
exports.warn = warn; | |
var _mixed = __webpack_require__(34); | |
/* eslint-disable no-console */ | |
/* eslint-disable no-restricted-globals */ | |
/** | |
* "In Internet Explorer 9 (and 8), the console object is only exposed when the developer tools are opened | |
* for a particular tab.". | |
* | |
* Source: https://stackoverflow.com/a/5473193. | |
*/ | |
/** | |
* Logs message to the console if the `console` object is exposed. | |
* | |
* @param {...*} args Values which will be logged. | |
*/ | |
function log() { | |
if ((0, _mixed.isDefined)(console)) { | |
var _console; | |
(_console = console).log.apply(_console, arguments); | |
} | |
} | |
/** | |
* Logs warn to the console if the `console` object is exposed. | |
* | |
* @param {...*} args Values which will be logged. | |
*/ | |
function warn() { | |
if ((0, _mixed.isDefined)(console)) { | |
var _console2; | |
(_console2 = console).warn.apply(_console2, arguments); | |
} | |
} | |
/** | |
* Logs info to the console if the `console` object is exposed. | |
* | |
* @param {...*} args Values which will be logged. | |
*/ | |
function info() { | |
if ((0, _mixed.isDefined)(console)) { | |
var _console3; | |
(_console3 = console).info.apply(_console3, arguments); | |
} | |
} | |
/** | |
* Logs error to the console if the `console` object is exposed. | |
* | |
* @param {...*} args Values which will be logged. | |
*/ | |
function error() { | |
if ((0, _mixed.isDefined)(console)) { | |
var _console4; | |
(_console4 = console).error.apply(_console4, arguments); | |
} | |
} | |
/***/ }), | |
/* 91 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var global = __webpack_require__(30); | |
var TypeError = global.TypeError; | |
// `RequireObjectCoercible` abstract operation | |
// https://tc39.es/ecma262/#sec-requireobjectcoercible | |
module.exports = function (it) { | |
if (it == undefined) throw TypeError("Can't call method on " + it); | |
return it; | |
}; | |
/***/ }), | |
/* 92 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var global = __webpack_require__(30); | |
var requireObjectCoercible = __webpack_require__(91); | |
var Object = global.Object; | |
// `ToObject` abstract operation | |
// https://tc39.es/ecma262/#sec-toobject | |
module.exports = function (argument) { | |
return Object(requireObjectCoercible(argument)); | |
}; | |
/***/ }), | |
/* 93 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
exports.__esModule = true; | |
exports.default = void 0; | |
var _object = __webpack_require__(18); | |
var _function = __webpack_require__(69); | |
var MIXIN_NAME = 'localHooks'; | |
/** | |
* Mixin object to extend objects functionality for local hooks. | |
* | |
* @type {object} | |
*/ | |
var localHooks = { | |
/** | |
* Internal hooks storage. | |
*/ | |
_localHooks: Object.create(null), | |
/** | |
* Add hook to the collection. | |
* | |
* @param {string} key The hook name. | |
* @param {Function} callback The hook callback. | |
* @returns {object} | |
*/ | |
addLocalHook: function addLocalHook(key, callback) { | |
if (!this._localHooks[key]) { | |
this._localHooks[key] = []; | |
} | |
this._localHooks[key].push(callback); | |
return this; | |
}, | |
/** | |
* Run hooks. | |
* | |
* @param {string} key The name of the hook to run. | |
* @param {*} [arg1] An additional parameter passed to the callback function. | |
* @param {*} [arg2] An additional parameter passed to the callback function. | |
* @param {*} [arg3] An additional parameter passed to the callback function. | |
* @param {*} [arg4] An additional parameter passed to the callback function. | |
* @param {*} [arg5] An additional parameter passed to the callback function. | |
* @param {*} [arg6] An additional parameter passed to the callback function. | |
*/ | |
runLocalHooks: function runLocalHooks(key, arg1, arg2, arg3, arg4, arg5, arg6) { | |
if (this._localHooks[key]) { | |
var length = this._localHooks[key].length; // don't optimize this loop with the `arrayEach()` method or arrow functions | |
// otherwise, performance will decrease because of garbage collection | |
// using the `...rest` syntax (ES6 and later) will decrease performance as well | |
for (var i = 0; i < length; i++) { | |
(0, _function.fastCall)(this._localHooks[key][i], this, arg1, arg2, arg3, arg4, arg5, arg6); | |
} | |
} | |
}, | |
/** | |
* Clear all added hooks. | |
* | |
* @returns {object} | |
*/ | |
clearLocalHooks: function clearLocalHooks() { | |
this._localHooks = {}; | |
return this; | |
} | |
}; | |
(0, _object.defineGetter)(localHooks, 'MIXIN_NAME', MIXIN_NAME, { | |
writable: false, | |
enumerable: false | |
}); | |
var _default = localHooks; | |
exports.default = _default; | |
/***/ }), | |
/* 94 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
// toObject with fallback for non-array-like ES3 strings | |
var IndexedObject = __webpack_require__(165); | |
var requireObjectCoercible = __webpack_require__(91); | |
module.exports = function (it) { | |
return IndexedObject(requireObjectCoercible(it)); | |
}; | |
/***/ }), | |
/* 95 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var DESCRIPTORS = __webpack_require__(72); | |
var global = __webpack_require__(30); | |
var uncurryThis = __webpack_require__(37); | |
var isForced = __webpack_require__(207); | |
var inheritIfRequired = __webpack_require__(258); | |
var createNonEnumerableProperty = __webpack_require__(122); | |
var defineProperty = __webpack_require__(86).f; | |
var getOwnPropertyNames = __webpack_require__(150).f; | |
var isPrototypeOf = __webpack_require__(121); | |
var isRegExp = __webpack_require__(248); | |
var toString = __webpack_require__(74); | |
var regExpFlags = __webpack_require__(253); | |
var stickyHelpers = __webpack_require__(254); | |
var redefine = __webpack_require__(103); | |
var fails = __webpack_require__(43); | |
var hasOwn = __webpack_require__(73); | |
var enforceInternalState = __webpack_require__(113).enforce; | |
var setSpecies = __webpack_require__(349); | |
var wellKnownSymbol = __webpack_require__(60); | |
var UNSUPPORTED_DOT_ALL = __webpack_require__(339); | |
var UNSUPPORTED_NCG = __webpack_require__(340); | |
var MATCH = wellKnownSymbol('match'); | |
var NativeRegExp = global.RegExp; | |
var RegExpPrototype = NativeRegExp.prototype; | |
var SyntaxError = global.SyntaxError; | |
var getFlags = uncurryThis(regExpFlags); | |
var exec = uncurryThis(RegExpPrototype.exec); | |
var charAt = uncurryThis(''.charAt); | |
var replace = uncurryThis(''.replace); | |
var stringIndexOf = uncurryThis(''.indexOf); | |
var stringSlice = uncurryThis(''.slice); | |
// TODO: Use only propper RegExpIdentifierName | |
var IS_NCG = /^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/; | |
var re1 = /a/g; | |
var re2 = /a/g; | |
// "new" should create a new object, old webkit bug | |
var CORRECT_NEW = new NativeRegExp(re1) !== re1; | |
var MISSED_STICKY = stickyHelpers.MISSED_STICKY; | |
var UNSUPPORTED_Y = stickyHelpers.UNSUPPORTED_Y; | |
var BASE_FORCED = DESCRIPTORS && | |
(!CORRECT_NEW || MISSED_STICKY || UNSUPPORTED_DOT_ALL || UNSUPPORTED_NCG || fails(function () { | |
re2[MATCH] = false; | |
// RegExp constructor can alter flags and IsRegExp works correct with @@match | |
return NativeRegExp(re1) != re1 || NativeRegExp(re2) == re2 || NativeRegExp(re1, 'i') != '/a/i'; | |
})); | |
var handleDotAll = function (string) { | |
var length = string.length; | |
var index = 0; | |
var result = ''; | |
var brackets = false; | |
var chr; | |
for (; index <= length; index++) { | |
chr = charAt(string, index); | |
if (chr === '\\') { | |
result += chr + charAt(string, ++index); | |
continue; | |
} | |
if (!brackets && chr === '.') { | |
result += '[\\s\\S]'; | |
} else { | |
if (chr === '[') { | |
brackets = true; | |
} else if (chr === ']') { | |
brackets = false; | |
} result += chr; | |
} | |
} return result; | |
}; | |
var handleNCG = function (string) { | |
var length = string.length; | |
var index = 0; | |
var result = ''; | |
var named = []; | |
var names = {}; | |
var brackets = false; | |
var ncg = false; | |
var groupid = 0; | |
var groupname = ''; | |
var chr; | |
for (; index <= length; index++) { | |
chr = charAt(string, index); | |
if (chr === '\\') { | |
chr = chr + charAt(string, ++index); | |
} else if (chr === ']') { | |
brackets = false; | |
} else if (!brackets) switch (true) { | |
case chr === '[': | |
brackets = true; | |
break; | |
case chr === '(': | |
if (exec(IS_NCG, stringSlice(string, index + 1))) { | |
index += 2; | |
ncg = true; | |
} | |
result += chr; | |
groupid++; | |
continue; | |
case chr === '>' && ncg: | |
if (groupname === '' || hasOwn(names, groupname)) { | |
throw new SyntaxError('Invalid capture group name'); | |
} | |
names[groupname] = true; | |
named[named.length] = [groupname, groupid]; | |
ncg = false; | |
groupname = ''; | |
continue; | |
} | |
if (ncg) groupname += chr; | |
else result += chr; | |
} return [result, named]; | |
}; | |
// `RegExp` constructor | |
// https://tc39.es/ecma262/#sec-regexp-constructor | |
if (isForced('RegExp', BASE_FORCED)) { | |
var RegExpWrapper = function RegExp(pattern, flags) { | |
var thisIsRegExp = isPrototypeOf(RegExpPrototype, this); | |
var patternIsRegExp = isRegExp(pattern); | |
var flagsAreUndefined = flags === undefined; | |
var groups = []; | |
var rawPattern = pattern; | |
var rawFlags, dotAll, sticky, handled, result, state; | |
if (!thisIsRegExp && patternIsRegExp && flagsAreUndefined && pattern.constructor === RegExpWrapper) { | |
return pattern; | |
} | |
if (patternIsRegExp || isPrototypeOf(RegExpPrototype, pattern)) { | |
pattern = pattern.source; | |
if (flagsAreUndefined) flags = 'flags' in rawPattern ? rawPattern.flags : getFlags(rawPattern); | |
} | |
pattern = pattern === undefined ? '' : toString(pattern); | |
flags = flags === undefined ? '' : toString(flags); | |
rawPattern = pattern; | |
if (UNSUPPORTED_DOT_ALL && 'dotAll' in re1) { | |
dotAll = !!flags && stringIndexOf(flags, 's') > -1; | |
if (dotAll) flags = replace(flags, /s/g, ''); | |
} | |
rawFlags = flags; | |
if (MISSED_STICKY && 'sticky' in re1) { | |
sticky = !!flags && stringIndexOf(flags, 'y') > -1; | |
if (sticky && UNSUPPORTED_Y) flags = replace(flags, /y/g, ''); | |
} | |
if (UNSUPPORTED_NCG) { | |
handled = handleNCG(pattern); | |
pattern = handled[0]; | |
groups = handled[1]; | |
} | |
result = inheritIfRequired(NativeRegExp(pattern, flags), thisIsRegExp ? this : RegExpPrototype, RegExpWrapper); | |
if (dotAll || sticky || groups.length) { | |
state = enforceInternalState(result); | |
if (dotAll) { | |
state.dotAll = true; | |
state.raw = RegExpWrapper(handleDotAll(pattern), rawFlags); | |
} | |
if (sticky) state.sticky = true; | |
if (groups.length) state.groups = groups; | |
} | |
if (pattern !== rawPattern) try { | |
// fails in old engines, but we have no alternatives for unsupported regex syntax | |
createNonEnumerableProperty(result, 'source', rawPattern === '' ? '(?:)' : rawPattern); | |
} catch (error) { /* empty */ } | |
return result; | |
}; | |
var proxy = function (key) { | |
key in RegExpWrapper || defineProperty(RegExpWrapper, key, { | |
configurable: true, | |
get: function () { return NativeRegExp[key]; }, | |
set: function (it) { NativeRegExp[key] = it; } | |
}); | |
}; | |
for (var keys = getOwnPropertyNames(NativeRegExp), index = 0; keys.length > index;) { | |
proxy(keys[index++]); | |
} | |
RegExpPrototype.constructor = RegExpWrapper; | |
RegExpWrapper.prototype = RegExpPrototype; | |
redefine(global, 'RegExp', RegExpWrapper); | |
} | |
// https://tc39.es/ecma262/#sec-get-regexp-@@species | |
setSpecies('RegExp'); | |
/***/ }), | |
/* 96 */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "tokenLabel", function() { return tokenLabel; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "tokenName", function() { return tokenName; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hasTokenLabel", function() { return hasTokenLabel; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createToken", function() { return createToken; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EOF", function() { return EOF; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createTokenInstance", function() { return createTokenInstance; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "tokenMatcher", function() { return tokenMatcher; }); | |
/* harmony import */ var _utils_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(49); | |
/* harmony import */ var _lexer_public__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(154); | |
/* harmony import */ var _tokens__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(178); | |
function tokenLabel(tokType) { | |
if (hasTokenLabel(tokType)) { | |
return tokType.LABEL; | |
} | |
else { | |
return tokType.name; | |
} | |
} | |
function tokenName(tokType) { | |
return tokType.name; | |
} | |
function hasTokenLabel(obj) { | |
return Object(_utils_utils__WEBPACK_IMPORTED_MODULE_0__["isString"])(obj.LABEL) && obj.LABEL !== ""; | |
} | |
var PARENT = "parent"; | |
var CATEGORIES = "categories"; | |
var LABEL = "label"; | |
var GROUP = "group"; | |
var PUSH_MODE = "push_mode"; | |
var POP_MODE = "pop_mode"; | |
var LONGER_ALT = "longer_alt"; | |
var LINE_BREAKS = "line_breaks"; | |
var START_CHARS_HINT = "start_chars_hint"; | |
function createToken(config) { | |
return createTokenInternal(config); | |
} | |
function createTokenInternal(config) { | |
var pattern = config.pattern; | |
var tokenType = {}; | |
tokenType.name = config.name; | |
if (!Object(_utils_utils__WEBPACK_IMPORTED_MODULE_0__["isUndefined"])(pattern)) { | |
tokenType.PATTERN = pattern; | |
} | |
if (Object(_utils_utils__WEBPACK_IMPORTED_MODULE_0__["has"])(config, PARENT)) { | |
throw "The parent property is no longer supported.\n" + | |
"See: https://github.com/SAP/chevrotain/issues/564#issuecomment-349062346 for details."; | |
} | |
if (Object(_utils_utils__WEBPACK_IMPORTED_MODULE_0__["has"])(config, CATEGORIES)) { | |
// casting to ANY as this will be fixed inside `augmentTokenTypes`` | |
tokenType.CATEGORIES = config[CATEGORIES]; | |
} | |
Object(_tokens__WEBPACK_IMPORTED_MODULE_2__["augmentTokenTypes"])([tokenType]); | |
if (Object(_utils_utils__WEBPACK_IMPORTED_MODULE_0__["has"])(config, LABEL)) { | |
tokenType.LABEL = config[LABEL]; | |
} | |
if (Object(_utils_utils__WEBPACK_IMPORTED_MODULE_0__["has"])(config, GROUP)) { | |
tokenType.GROUP = config[GROUP]; | |
} | |
if (Object(_utils_utils__WEBPACK_IMPORTED_MODULE_0__["has"])(config, POP_MODE)) { | |
tokenType.POP_MODE = config[POP_MODE]; | |
} | |
if (Object(_utils_utils__WEBPACK_IMPORTED_MODULE_0__["has"])(config, PUSH_MODE)) { | |
tokenType.PUSH_MODE = config[PUSH_MODE]; | |
} | |
if (Object(_utils_utils__WEBPACK_IMPORTED_MODULE_0__["has"])(config, LONGER_ALT)) { | |
tokenType.LONGER_ALT = config[LONGER_ALT]; | |
} | |
if (Object(_utils_utils__WEBPACK_IMPORTED_MODULE_0__["has"])(config, LINE_BREAKS)) { | |
tokenType.LINE_BREAKS = config[LINE_BREAKS]; | |
} | |
if (Object(_utils_utils__WEBPACK_IMPORTED_MODULE_0__["has"])(config, START_CHARS_HINT)) { | |
tokenType.START_CHARS_HINT = config[START_CHARS_HINT]; | |
} | |
return tokenType; | |
} | |
var EOF = createToken({ name: "EOF", pattern: _lexer_public__WEBPACK_IMPORTED_MODULE_1__["Lexer"].NA }); | |
Object(_tokens__WEBPACK_IMPORTED_MODULE_2__["augmentTokenTypes"])([EOF]); | |
function createTokenInstance(tokType, image, startOffset, endOffset, startLine, endLine, startColumn, endColumn) { | |
return { | |
image: image, | |
startOffset: startOffset, | |
endOffset: endOffset, | |
startLine: startLine, | |
endLine: endLine, | |
startColumn: startColumn, | |
endColumn: endColumn, | |
tokenTypeIdx: tokType.tokenTypeIdx, | |
tokenType: tokType | |
}; | |
} | |
function tokenMatcher(token, tokType) { | |
return Object(_tokens__WEBPACK_IMPORTED_MODULE_2__["tokenStructuredMatcher"])(token, tokType); | |
} | |
//# sourceMappingURL=tokens_public.js.map | |
/***/ }), | |
/* 97 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var _interopRequireDefault = __webpack_require__(1); | |
exports.__esModule = true; | |
exports.equalsIgnoreCase = equalsIgnoreCase; | |
exports.isPercentValue = isPercentValue; | |
exports.randomString = randomString; | |
exports.sanitize = sanitize; | |
exports.stripTags = stripTags; | |
exports.substitute = substitute; | |
exports.toUpperCaseFirst = toUpperCaseFirst; | |
__webpack_require__(33); | |
__webpack_require__(0); | |
__webpack_require__(67); | |
__webpack_require__(13); | |
__webpack_require__(64); | |
var _dompurify = _interopRequireDefault(__webpack_require__(433)); | |
var _mixed = __webpack_require__(34); | |
/** | |
* Convert string to upper case first letter. | |
* | |
* @param {string} string String to convert. | |
* @returns {string} | |
*/ | |
function toUpperCaseFirst(string) { | |
return string[0].toUpperCase() + string.substr(1); | |
} | |
/** | |
* Compare strings case insensitively. | |
* | |
* @param {...string} strings Strings to compare. | |
* @returns {boolean} | |
*/ | |
function equalsIgnoreCase() { | |
var unique = []; | |
for (var _len = arguments.length, strings = new Array(_len), _key = 0; _key < _len; _key++) { | |
strings[_key] = arguments[_key]; | |
} | |
var length = strings.length; | |
while (length) { | |
length -= 1; | |
var string = (0, _mixed.stringify)(strings[length]).toLowerCase(); | |
if (unique.indexOf(string) === -1) { | |
unique.push(string); | |
} | |
} | |
return unique.length === 1; | |
} | |
/** | |
* Generates a random hex string. Used as namespace for Handsontable instance events. | |
* | |
* @returns {string} Returns 16-long character random string (eq. `'92b1bfc74ec4'`). | |
*/ | |
function randomString() { | |
/** | |
* @returns {string} | |
*/ | |
function s4() { | |
return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); | |
} | |
return s4() + s4() + s4() + s4(); | |
} | |
/** | |
* Checks if value is valid percent. | |
* | |
* @param {string} value The value to check. | |
* @returns {boolean} | |
*/ | |
function isPercentValue(value) { | |
return /^([0-9][0-9]?%$)|(^100%$)/.test(value); | |
} | |
/** | |
* Substitute strings placed beetwen square brackets into value defined in `variables` object. String names defined in | |
* square brackets must be the same as property name of `variables` object. | |
* | |
* @param {string} template Template string. | |
* @param {object} variables Object which contains all available values which can be injected into template. | |
* @returns {string} | |
*/ | |
function substitute(template) { | |
var variables = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | |
return "".concat(template).replace(/(?:\\)?\[([^[\]]+)]/g, function (match, name) { | |
if (match.charAt(0) === '\\') { | |
return match.substr(1, match.length - 1); | |
} | |
return variables[name] === void 0 ? '' : variables[name]; | |
}); | |
} | |
/** | |
* Strip any HTML tag from the string. | |
* | |
* @param {string} string String to cut HTML from. | |
* @returns {string} | |
*/ | |
function stripTags(string) { | |
return sanitize("".concat(string), { | |
ALLOWED_TAGS: [] | |
}); | |
} | |
/** | |
* Sanitizes string from potential security vulnerabilities. | |
* | |
* @param {string} string String to sanitize. | |
* @param {object} [options] DOMPurify's configuration object. | |
* @returns {string} | |
*/ | |
function sanitize(string, options) { | |
return _dompurify.default.sanitize(string, options); | |
} | |
/***/ }), | |
/* 98 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var toLength = __webpack_require__(132); | |
// `LengthOfArrayLike` abstract operation | |
// https://tc39.es/ecma262/#sec-lengthofarraylike | |
module.exports = function (obj) { | |
return toLength(obj.length); | |
}; | |
/***/ }), | |
/* 99 */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "cellAddressFromString", function() { return cellAddressFromString; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "columnAddressFromString", function() { return columnAddressFromString; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "rowAddressFromString", function() { return rowAddressFromString; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "simpleCellAddressFromString", function() { return simpleCellAddressFromString; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "simpleCellRangeFromString", function() { return simpleCellRangeFromString; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "simpleCellAddressToString", function() { return simpleCellAddressToString; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "simpleCellRangeToString", function() { return simpleCellRangeToString; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "columnIndexToLabel", function() { return columnIndexToLabel; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sheetIndexToString", function() { return sheetIndexToString; }); | |
/* harmony import */ var core_js_modules_es_regexp_constructor_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(95); | |
/* harmony import */ var core_js_modules_es_regexp_constructor_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_regexp_constructor_js__WEBPACK_IMPORTED_MODULE_0__); | |
/* harmony import */ var core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(13); | |
/* harmony import */ var core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_1__); | |
/* harmony import */ var core_js_modules_es_regexp_to_string_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(67); | |
/* harmony import */ var core_js_modules_es_regexp_to_string_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_regexp_to_string_js__WEBPACK_IMPORTED_MODULE_2__); | |
/* harmony import */ var core_js_modules_es_array_concat_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(21); | |
/* harmony import */ var core_js_modules_es_array_concat_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_concat_js__WEBPACK_IMPORTED_MODULE_3__); | |
/* harmony import */ var core_js_modules_es_number_constructor_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(53); | |
/* harmony import */ var core_js_modules_es_number_constructor_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_number_constructor_js__WEBPACK_IMPORTED_MODULE_4__); | |
/* harmony import */ var core_js_modules_es_string_split_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(63); | |
/* harmony import */ var core_js_modules_es_string_split_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_string_split_js__WEBPACK_IMPORTED_MODULE_5__); | |
/* harmony import */ var core_js_modules_es_array_reduce_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(100); | |
/* harmony import */ var core_js_modules_es_array_reduce_js__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_reduce_js__WEBPACK_IMPORTED_MODULE_6__); | |
/* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(0); | |
/* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_7__); | |
/* harmony import */ var core_js_modules_es_string_replace_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(64); | |
/* harmony import */ var core_js_modules_es_string_replace_js__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_string_replace_js__WEBPACK_IMPORTED_MODULE_8__); | |
/* harmony import */ var core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(9); | |
/* harmony import */ var core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_9__); | |
/* harmony import */ var core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(10); | |
/* harmony import */ var core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_10__); | |
/* harmony import */ var core_js_modules_es_symbol_iterator_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(11); | |
/* harmony import */ var core_js_modules_es_symbol_iterator_js__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_symbol_iterator_js__WEBPACK_IMPORTED_MODULE_11__); | |
/* harmony import */ var core_js_modules_es_array_iterator_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(3); | |
/* harmony import */ var core_js_modules_es_array_iterator_js__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_iterator_js__WEBPACK_IMPORTED_MODULE_12__); | |
/* harmony import */ var core_js_modules_es_string_iterator_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(2); | |
/* harmony import */ var core_js_modules_es_string_iterator_js__WEBPACK_IMPORTED_MODULE_13___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_string_iterator_js__WEBPACK_IMPORTED_MODULE_13__); | |
/* harmony import */ var core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(4); | |
/* harmony import */ var core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_14___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_14__); | |
/* harmony import */ var core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(14); | |
/* harmony import */ var core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_15___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_15__); | |
/* harmony import */ var core_js_modules_es_function_name_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(26); | |
/* harmony import */ var core_js_modules_es_function_name_js__WEBPACK_IMPORTED_MODULE_16___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_function_name_js__WEBPACK_IMPORTED_MODULE_16__); | |
/* harmony import */ var core_js_modules_es_array_from_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(23); | |
/* harmony import */ var core_js_modules_es_array_from_js__WEBPACK_IMPORTED_MODULE_17___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_from_js__WEBPACK_IMPORTED_MODULE_17__); | |
/* harmony import */ var _AbsoluteCellRange__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(88); | |
/* harmony import */ var _Cell__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(24); | |
/* harmony import */ var _CellAddress__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(216); | |
/* harmony import */ var _ColumnAddress__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(354); | |
/* harmony import */ var _LexerConfig__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(177); | |
/* harmony import */ var _RowAddress__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(361); | |
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } | |
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } | |
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | |
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } | |
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } | |
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } | |
/** | |
* @license | |
* Copyright (c) 2021 Handsoncode. All rights reserved. | |
*/ | |
var addressRegex = new RegExp("^(".concat(_LexerConfig__WEBPACK_IMPORTED_MODULE_22__["sheetNameRegexp"], ")?(\\").concat(_LexerConfig__WEBPACK_IMPORTED_MODULE_22__["ABSOLUTE_OPERATOR"], "?)([A-Za-z]+)(\\").concat(_LexerConfig__WEBPACK_IMPORTED_MODULE_22__["ABSOLUTE_OPERATOR"], "?)([0-9]+)$")); | |
var columnRegex = new RegExp("^(".concat(_LexerConfig__WEBPACK_IMPORTED_MODULE_22__["sheetNameRegexp"], ")?(\\").concat(_LexerConfig__WEBPACK_IMPORTED_MODULE_22__["ABSOLUTE_OPERATOR"], "?)([A-Za-z]+)$")); | |
var rowRegex = new RegExp("^(".concat(_LexerConfig__WEBPACK_IMPORTED_MODULE_22__["sheetNameRegexp"], ")?(\\").concat(_LexerConfig__WEBPACK_IMPORTED_MODULE_22__["ABSOLUTE_OPERATOR"], "?)([0-9]+)$")); | |
var simpleSheetNameRegex = new RegExp("^".concat(_LexerConfig__WEBPACK_IMPORTED_MODULE_22__["simpleSheetName"], "$")); | |
/** | |
* Computes R0C0 representation of cell address based on it's string representation and base address. | |
* | |
* @param sheetMapping - mapping function needed to change name of a sheet to index | |
* @param stringAddress - string representation of cell address, e.g. 'C64' | |
* @param baseAddress - base address for R0C0 conversion | |
* @returns object representation of address | |
*/ | |
var cellAddressFromString = function cellAddressFromString(sheetMapping, stringAddress, baseAddress) { | |
var result = addressRegex.exec(stringAddress); | |
var col = columnLabelToIndex(result[6]); | |
var sheet = extractSheetNumber(result, sheetMapping); | |
if (sheet === undefined) { | |
return undefined; | |
} | |
if (sheet === null) { | |
sheet = undefined; | |
} | |
var row = Number(result[8]) - 1; | |
if (result[5] === _LexerConfig__WEBPACK_IMPORTED_MODULE_22__["ABSOLUTE_OPERATOR"] && result[7] === _LexerConfig__WEBPACK_IMPORTED_MODULE_22__["ABSOLUTE_OPERATOR"]) { | |
return _CellAddress__WEBPACK_IMPORTED_MODULE_20__["CellAddress"].absolute(col, row, sheet); | |
} else if (result[5] === _LexerConfig__WEBPACK_IMPORTED_MODULE_22__["ABSOLUTE_OPERATOR"]) { | |
return _CellAddress__WEBPACK_IMPORTED_MODULE_20__["CellAddress"].absoluteCol(col, row - baseAddress.row, sheet); | |
} else if (result[7] === _LexerConfig__WEBPACK_IMPORTED_MODULE_22__["ABSOLUTE_OPERATOR"]) { | |
return _CellAddress__WEBPACK_IMPORTED_MODULE_20__["CellAddress"].absoluteRow(col - baseAddress.col, row, sheet); | |
} else { | |
return _CellAddress__WEBPACK_IMPORTED_MODULE_20__["CellAddress"].relative(row - baseAddress.row, col - baseAddress.col, sheet); | |
} | |
}; | |
var columnAddressFromString = function columnAddressFromString(sheetMapping, stringAddress, baseAddress) { | |
var result = columnRegex.exec(stringAddress); | |
var sheet = extractSheetNumber(result, sheetMapping); | |
if (sheet === undefined) { | |
return undefined; | |
} | |
if (sheet === null) { | |
sheet = undefined; | |
} | |
var col = columnLabelToIndex(result[6]); | |
if (result[5] === _LexerConfig__WEBPACK_IMPORTED_MODULE_22__["ABSOLUTE_OPERATOR"]) { | |
return _ColumnAddress__WEBPACK_IMPORTED_MODULE_21__["ColumnAddress"].absolute(col, sheet); | |
} else { | |
return _ColumnAddress__WEBPACK_IMPORTED_MODULE_21__["ColumnAddress"].relative(col - baseAddress.col, sheet); | |
} | |
}; | |
var rowAddressFromString = function rowAddressFromString(sheetMapping, stringAddress, baseAddress) { | |
var result = rowRegex.exec(stringAddress); | |
var sheet = extractSheetNumber(result, sheetMapping); | |
if (sheet === undefined) { | |
return undefined; | |
} | |
if (sheet === null) { | |
sheet = undefined; | |
} | |
var row = Number(result[6]) - 1; | |
if (result[5] === _LexerConfig__WEBPACK_IMPORTED_MODULE_22__["ABSOLUTE_OPERATOR"]) { | |
return _RowAddress__WEBPACK_IMPORTED_MODULE_23__["RowAddress"].absolute(row, sheet); | |
} else { | |
return _RowAddress__WEBPACK_IMPORTED_MODULE_23__["RowAddress"].relative(row - baseAddress.row, sheet); | |
} | |
}; | |
/** | |
* Computes simple (absolute) address of a cell address based on its string representation. | |
* If sheet name present in string representation but is not present in sheet mapping, returns undefined. | |
* If sheet name is not present in string representation, returns {@param sheetContext} as sheet number | |
* | |
* @param sheetMapping - mapping function needed to change name of a sheet to index | |
* @param stringAddress - string representation of cell address, e.g. 'C64' | |
* @param sheetContext - sheet in context of which we should parse the address | |
* @returns absolute representation of address, e.g. { sheet: 0, col: 1, row: 1 } | |
*/ | |
var simpleCellAddressFromString = function simpleCellAddressFromString(sheetMapping, stringAddress, sheetContext) { | |
var result = addressRegex.exec(stringAddress); | |
var col = columnLabelToIndex(result[6]); | |
var sheet = extractSheetNumber(result, sheetMapping); | |
if (sheet === undefined) { | |
return undefined; | |
} | |
if (sheet === null) { | |
sheet = sheetContext; | |
} | |
var row = Number(result[8]) - 1; | |
return Object(_Cell__WEBPACK_IMPORTED_MODULE_19__["simpleCellAddress"])(sheet, col, row); | |
}; | |
var simpleCellRangeFromString = function simpleCellRangeFromString(sheetMapping, stringAddress, sheetContext) { | |
var split = stringAddress.split(_LexerConfig__WEBPACK_IMPORTED_MODULE_22__["RANGE_OPERATOR"]); | |
if (split.length !== 2) { | |
return undefined; | |
} | |
var _split = _slicedToArray(split, 2), | |
startString = _split[0], | |
endString = _split[1]; | |
var start = simpleCellAddressFromString(sheetMapping, startString, sheetContext); | |
if (start === undefined) { | |
return undefined; | |
} | |
var end = simpleCellAddressFromString(sheetMapping, endString, start.sheet); | |
if (end === undefined) { | |
return undefined; | |
} | |
if (start.sheet !== end.sheet) { | |
return undefined; | |
} | |
return Object(_AbsoluteCellRange__WEBPACK_IMPORTED_MODULE_18__["simpleCellRange"])(start, end); | |
}; | |
/** | |
* Returns string representation of absolute address | |
* If sheet index is not present in sheet mapping, returns undefined | |
* | |
* @param sheetIndexMapping - mapping function needed to change sheet index to sheet name | |
* @param address - object representation of absolute address | |
* @param sheetIndex - if is not equal with address sheet index, string representation will contain sheet name | |
* */ | |
var simpleCellAddressToString = function simpleCellAddressToString(sheetIndexMapping, address, sheetIndex) { | |
var column = columnIndexToLabel(address.col); | |
var sheetName = sheetIndexToString(address.sheet, sheetIndexMapping); | |
if (sheetName === undefined) { | |
return undefined; | |
} | |
if (sheetIndex !== address.sheet) { | |
return "".concat(sheetName, "!").concat(column).concat(address.row + 1); | |
} else { | |
return "".concat(column).concat(address.row + 1); | |
} | |
}; | |
var simpleCellRangeToString = function simpleCellRangeToString(sheetIndexMapping, address, sheetIndex) { | |
var startString = simpleCellAddressToString(sheetIndexMapping, address.start, sheetIndex); | |
var endString = simpleCellAddressToString(sheetIndexMapping, address.end, address.start.sheet); | |
if (startString === undefined || endString === undefined) { | |
return undefined; | |
} else { | |
return "".concat(startString).concat(_LexerConfig__WEBPACK_IMPORTED_MODULE_22__["RANGE_OPERATOR"]).concat(endString); | |
} | |
}; | |
/** | |
* Convert column label to index | |
* | |
* @param columnStringRepresentation - column label (e.g. 'AAB') | |
* @returns column index | |
* */ | |
function columnLabelToIndex(columnStringRepresentation) { | |
if (columnStringRepresentation.length === 1) { | |
return columnStringRepresentation.toUpperCase().charCodeAt(0) - 65; | |
} else { | |
return columnStringRepresentation.split('').reduce(function (currentColumn, nextLetter) { | |
return currentColumn * 26 + (nextLetter.toUpperCase().charCodeAt(0) - 64); | |
}, 0) - 1; | |
} | |
} | |
/** | |
* Converts column index to label | |
* | |
* @param column - address to convert | |
* @returns string representation, e.g. 'AAB' | |
*/ | |
function columnIndexToLabel(column) { | |
var result = ''; | |
while (column >= 0) { | |
result = String.fromCharCode(column % 26 + 97) + result; | |
column = Math.floor(column / 26) - 1; | |
} | |
return result.toUpperCase(); | |
} | |
function sheetIndexToString(sheetId, sheetMappingFn) { | |
var sheetName = sheetMappingFn(sheetId); | |
if (sheetName === undefined) { | |
return undefined; | |
} | |
if (simpleSheetNameRegex.test(sheetName)) { | |
return sheetName; | |
} else { | |
sheetName = sheetName.replace(/'/g, "''"); | |
return "'".concat(sheetName, "'"); | |
} | |
} | |
function extractSheetNumber(regexResult, sheetMapping) { | |
var _a; | |
var maybeSheetName = (_a = regexResult[3]) !== null && _a !== void 0 ? _a : regexResult[2]; | |
if (maybeSheetName) { | |
maybeSheetName = maybeSheetName.replace(/''/g, "'"); | |
return sheetMapping(maybeSheetName); | |
} else { | |
return null; | |
} | |
} | |
/***/ }), | |
/* 100 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var $ = __webpack_require__(31); | |
var $reduce = __webpack_require__(645).left; | |
var arrayMethodIsStrict = __webpack_require__(153); | |
var CHROME_VERSION = __webpack_require__(166); | |
var IS_NODE = __webpack_require__(353); | |
var STRICT_METHOD = arrayMethodIsStrict('reduce'); | |
// Chrome 80-82 has a critical bug | |
// https://bugs.chromium.org/p/chromium/issues/detail?id=1049982 | |
var CHROME_BUG = !IS_NODE && CHROME_VERSION > 79 && CHROME_VERSION < 83; | |
// `Array.prototype.reduce` method | |
// https://tc39.es/ecma262/#sec-array.prototype.reduce | |
$({ target: 'Array', proto: true, forced: !STRICT_METHOD || CHROME_BUG }, { | |
reduce: function reduce(callbackfn /* , initialValue */) { | |
var length = arguments.length; | |
return $reduce(this, callbackfn, length, length > 1 ? arguments[1] : undefined); | |
} | |
}); | |
/***/ }), | |
/* 101 */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parsingError", function() { return parsingError; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ParsingErrorType", function() { return ParsingErrorType; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AstNodeType", function() { return AstNodeType; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RangeSheetReferenceType", function() { return RangeSheetReferenceType; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "buildEmptyArgAst", function() { return buildEmptyArgAst; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "buildNumberAst", function() { return buildNumberAst; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "buildStringAst", function() { return buildStringAst; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "buildCellReferenceAst", function() { return buildCellReferenceAst; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "buildCellRangeAst", function() { return buildCellRangeAst; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "buildColumnRangeAst", function() { return buildColumnRangeAst; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "buildRowRangeAst", function() { return buildRowRangeAst; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "buildConcatenateOpAst", function() { return buildConcatenateOpAst; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "buildEqualsOpAst", function() { return buildEqualsOpAst; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "buildNotEqualOpAst", function() { return buildNotEqualOpAst; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "buildGreaterThanOpAst", function() { return buildGreaterThanOpAst; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "buildLessThanOpAst", function() { return buildLessThanOpAst; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "buildGreaterThanOrEqualOpAst", function() { return buildGreaterThanOrEqualOpAst; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "buildLessThanOrEqualOpAst", function() { return buildLessThanOrEqualOpAst; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "buildPlusOpAst", function() { return buildPlusOpAst; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "buildMinusOpAst", function() { return buildMinusOpAst; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "buildTimesOpAst", function() { return buildTimesOpAst; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "buildDivOpAst", function() { return buildDivOpAst; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "buildPowerOpAst", function() { return buildPowerOpAst; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "buildMinusUnaryOpAst", function() { return buildMinusUnaryOpAst; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "buildPlusUnaryOpAst", function() { return buildPlusUnaryOpAst; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "buildPercentOpAst", function() { return buildPercentOpAst; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "buildProcedureAst", function() { return buildProcedureAst; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "buildArrayAst", function() { return buildArrayAst; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "buildNamedExpressionAst", function() { return buildNamedExpressionAst; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "buildParenthesisAst", function() { return buildParenthesisAst; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "buildCellErrorAst", function() { return buildCellErrorAst; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "buildErrorWithRawInputAst", function() { return buildErrorWithRawInputAst; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "buildParsingErrorAst", function() { return buildParsingErrorAst; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "imageWithWhitespace", function() { return imageWithWhitespace; }); | |
/* harmony import */ var core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(14); | |
/* harmony import */ var core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_0__); | |
/* harmony import */ var _Cell__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(24); | |
/** | |
* @license | |
* Copyright (c) 2021 Handsoncode. All rights reserved. | |
*/ | |
var parsingError = function parsingError(type, message) { | |
return { | |
type: type, | |
message: message | |
}; | |
}; | |
var ParsingErrorType; | |
(function (ParsingErrorType) { | |
ParsingErrorType["LexingError"] = "LexingError"; | |
ParsingErrorType["ParserError"] = "ParsingError"; | |
ParsingErrorType["StaticOffsetError"] = "StaticOffsetError"; | |
ParsingErrorType["StaticOffsetOutOfRangeError"] = "StaticOffsetOutOfRangeError"; | |
ParsingErrorType["RangeOffsetNotAllowed"] = "RangeOffsetNotAllowed"; | |
})(ParsingErrorType || (ParsingErrorType = {})); | |
var AstNodeType; | |
(function (AstNodeType) { | |
AstNodeType["EMPTY"] = "EMPTY"; | |
AstNodeType["NUMBER"] = "NUMBER"; | |
AstNodeType["STRING"] = "STRING"; | |
AstNodeType["MINUS_UNARY_OP"] = "MINUS_UNARY_OP"; | |
AstNodeType["PLUS_UNARY_OP"] = "PLUS_UNARY_OP"; | |
AstNodeType["PERCENT_OP"] = "PERCENT_OP"; | |
AstNodeType["CONCATENATE_OP"] = "CONCATENATE_OP"; | |
AstNodeType["EQUALS_OP"] = "EQUALS_OP"; | |
AstNodeType["NOT_EQUAL_OP"] = "NOT_EQUAL_OP"; | |
AstNodeType["GREATER_THAN_OP"] = "GREATER_THAN_OP"; | |
AstNodeType["LESS_THAN_OP"] = "LESS_THAN_OP"; | |
AstNodeType["GREATER_THAN_OR_EQUAL_OP"] = "GREATER_THAN_OR_EQUAL_OP"; | |
AstNodeType["LESS_THAN_OR_EQUAL_OP"] = "LESS_THAN_OR_EQUAL_OP"; | |
AstNodeType["PLUS_OP"] = "PLUS_OP"; | |
AstNodeType["MINUS_OP"] = "MINUS_OP"; | |
AstNodeType["TIMES_OP"] = "TIMES_OP"; | |
AstNodeType["DIV_OP"] = "DIV_OP"; | |
AstNodeType["POWER_OP"] = "POWER_OP"; | |
AstNodeType["FUNCTION_CALL"] = "FUNCTION_CALL"; | |
AstNodeType["NAMED_EXPRESSION"] = "NAMED_EXPRESSION"; | |
AstNodeType["PARENTHESIS"] = "PARENTHESES"; | |
AstNodeType["CELL_REFERENCE"] = "CELL_REFERENCE"; | |
AstNodeType["CELL_RANGE"] = "CELL_RANGE"; | |
AstNodeType["COLUMN_RANGE"] = "COLUMN_RANGE"; | |
AstNodeType["ROW_RANGE"] = "ROW_RANGE"; | |
AstNodeType["ERROR"] = "ERROR"; | |
AstNodeType["ERROR_WITH_RAW_INPUT"] = "ERROR_WITH_RAW_INPUT"; | |
AstNodeType["ARRAY"] = "ARRAY"; | |
})(AstNodeType || (AstNodeType = {})); | |
var RangeSheetReferenceType; | |
(function (RangeSheetReferenceType) { | |
RangeSheetReferenceType[RangeSheetReferenceType["RELATIVE"] = 0] = "RELATIVE"; | |
RangeSheetReferenceType[RangeSheetReferenceType["START_ABSOLUTE"] = 1] = "START_ABSOLUTE"; | |
RangeSheetReferenceType[RangeSheetReferenceType["BOTH_ABSOLUTE"] = 2] = "BOTH_ABSOLUTE"; | |
})(RangeSheetReferenceType || (RangeSheetReferenceType = {})); | |
var buildEmptyArgAst = function buildEmptyArgAst(leadingWhitespace) { | |
return { | |
type: AstNodeType.EMPTY, | |
leadingWhitespace: leadingWhitespace === null || leadingWhitespace === void 0 ? void 0 : leadingWhitespace.image | |
}; | |
}; | |
var buildNumberAst = function buildNumberAst(value, leadingWhitespace) { | |
return { | |
type: AstNodeType.NUMBER, | |
value: value, | |
leadingWhitespace: leadingWhitespace === null || leadingWhitespace === void 0 ? void 0 : leadingWhitespace.image | |
}; | |
}; | |
var buildStringAst = function buildStringAst(token) { | |
var _a; | |
return { | |
type: AstNodeType.STRING, | |
value: token.image.slice(1, -1), | |
leadingWhitespace: (_a = token.leadingWhitespace) === null || _a === void 0 ? void 0 : _a.image | |
}; | |
}; | |
var buildCellReferenceAst = function buildCellReferenceAst(reference, leadingWhitespace) { | |
return { | |
type: AstNodeType.CELL_REFERENCE, | |
reference: reference, | |
leadingWhitespace: leadingWhitespace === null || leadingWhitespace === void 0 ? void 0 : leadingWhitespace.image | |
}; | |
}; | |
var buildCellRangeAst = function buildCellRangeAst(start, end, sheetReferenceType, leadingWhitespace) { | |
assertRangeConsistency(start, end, sheetReferenceType); | |
return { | |
type: AstNodeType.CELL_RANGE, | |
start: start, | |
end: end, | |
sheetReferenceType: sheetReferenceType, | |
leadingWhitespace: leadingWhitespace | |
}; | |
}; | |
var buildColumnRangeAst = function buildColumnRangeAst(start, end, sheetReferenceType, leadingWhitespace) { | |
assertRangeConsistency(start, end, sheetReferenceType); | |
return { | |
type: AstNodeType.COLUMN_RANGE, | |
start: start, | |
end: end, | |
sheetReferenceType: sheetReferenceType, | |
leadingWhitespace: leadingWhitespace === null || leadingWhitespace === void 0 ? void 0 : leadingWhitespace.image | |
}; | |
}; | |
var buildRowRangeAst = function buildRowRangeAst(start, end, sheetReferenceType, leadingWhitespace) { | |
assertRangeConsistency(start, end, sheetReferenceType); | |
return { | |
type: AstNodeType.ROW_RANGE, | |
start: start, | |
end: end, | |
sheetReferenceType: sheetReferenceType, | |
leadingWhitespace: leadingWhitespace === null || leadingWhitespace === void 0 ? void 0 : leadingWhitespace.image | |
}; | |
}; | |
var buildConcatenateOpAst = function buildConcatenateOpAst(left, right, leadingWhitespace) { | |
return { | |
type: AstNodeType.CONCATENATE_OP, | |
left: left, | |
right: right, | |
leadingWhitespace: leadingWhitespace === null || leadingWhitespace === void 0 ? void 0 : leadingWhitespace.image | |
}; | |
}; | |
var buildEqualsOpAst = function buildEqualsOpAst(left, right, leadingWhitespace) { | |
return { | |
type: AstNodeType.EQUALS_OP, | |
left: left, | |
right: right, | |
leadingWhitespace: leadingWhitespace === null || leadingWhitespace === void 0 ? void 0 : leadingWhitespace.image | |
}; | |
}; | |
var buildNotEqualOpAst = function buildNotEqualOpAst(left, right, leadingWhitespace) { | |
return { | |
type: AstNodeType.NOT_EQUAL_OP, | |
left: left, | |
right: right, | |
leadingWhitespace: leadingWhitespace === null || leadingWhitespace === void 0 ? void 0 : leadingWhitespace.image | |
}; | |
}; | |
var buildGreaterThanOpAst = function buildGreaterThanOpAst(left, right, leadingWhitespace) { | |
return { | |
type: AstNodeType.GREATER_THAN_OP, | |
left: left, | |
right: right, | |
leadingWhitespace: leadingWhitespace === null || leadingWhitespace === void 0 ? void 0 : leadingWhitespace.image | |
}; | |
}; | |
var buildLessThanOpAst = function buildLessThanOpAst(left, right, leadingWhitespace) { | |
return { | |
type: AstNodeType.LESS_THAN_OP, | |
left: left, | |
right: right, | |
leadingWhitespace: leadingWhitespace === null || leadingWhitespace === void 0 ? void 0 : leadingWhitespace.image | |
}; | |
}; | |
var buildGreaterThanOrEqualOpAst = function buildGreaterThanOrEqualOpAst(left, right, leadingWhitespace) { | |
return { | |
type: AstNodeType.GREATER_THAN_OR_EQUAL_OP, | |
left: left, | |
right: right, | |
leadingWhitespace: leadingWhitespace === null || leadingWhitespace === void 0 ? void 0 : leadingWhitespace.image | |
}; | |
}; | |
var buildLessThanOrEqualOpAst = function buildLessThanOrEqualOpAst(left, right, leadingWhitespace) { | |
return { | |
type: AstNodeType.LESS_THAN_OR_EQUAL_OP, | |
left: left, | |
right: right, | |
leadingWhitespace: leadingWhitespace === null || leadingWhitespace === void 0 ? void 0 : leadingWhitespace.image | |
}; | |
}; | |
var buildPlusOpAst = function buildPlusOpAst(left, right, leadingWhitespace) { | |
return { | |
type: AstNodeType.PLUS_OP, | |
left: left, | |
right: right, | |
leadingWhitespace: leadingWhitespace === null || leadingWhitespace === void 0 ? void 0 : leadingWhitespace.image | |
}; | |
}; | |
var buildMinusOpAst = function buildMinusOpAst(left, right, leadingWhitespace) { | |
return { | |
type: AstNodeType.MINUS_OP, | |
left: left, | |
right: right, | |
leadingWhitespace: leadingWhitespace === null || leadingWhitespace === void 0 ? void 0 : leadingWhitespace.image | |
}; | |
}; | |
var buildTimesOpAst = function buildTimesOpAst(left, right, leadingWhitespace) { | |
return { | |
type: AstNodeType.TIMES_OP, | |
left: left, | |
right: right, | |
leadingWhitespace: leadingWhitespace === null || leadingWhitespace === void 0 ? void 0 : leadingWhitespace.image | |
}; | |
}; | |
var buildDivOpAst = function buildDivOpAst(left, right, leadingWhitespace) { | |
return { | |
type: AstNodeType.DIV_OP, | |
left: left, | |
right: right, | |
leadingWhitespace: leadingWhitespace === null || leadingWhitespace === void 0 ? void 0 : leadingWhitespace.image | |
}; | |
}; | |
var buildPowerOpAst = function buildPowerOpAst(left, right, leadingWhitespace) { | |
return { | |
type: AstNodeType.POWER_OP, | |
left: left, | |
right: right, | |
leadingWhitespace: leadingWhitespace === null || leadingWhitespace === void 0 ? void 0 : leadingWhitespace.image | |
}; | |
}; | |
var buildMinusUnaryOpAst = function buildMinusUnaryOpAst(value, leadingWhitespace) { | |
return { | |
type: AstNodeType.MINUS_UNARY_OP, | |
value: value, | |
leadingWhitespace: leadingWhitespace === null || leadingWhitespace === void 0 ? void 0 : leadingWhitespace.image | |
}; | |
}; | |
var buildPlusUnaryOpAst = function buildPlusUnaryOpAst(value, leadingWhitespace) { | |
return { | |
type: AstNodeType.PLUS_UNARY_OP, | |
value: value, | |
leadingWhitespace: leadingWhitespace === null || leadingWhitespace === void 0 ? void 0 : leadingWhitespace.image | |
}; | |
}; | |
var buildPercentOpAst = function buildPercentOpAst(value, leadingWhitespace) { | |
return { | |
type: AstNodeType.PERCENT_OP, | |
value: value, | |
leadingWhitespace: leadingWhitespace === null || leadingWhitespace === void 0 ? void 0 : leadingWhitespace.image | |
}; | |
}; | |
var buildProcedureAst = function buildProcedureAst(procedureName, args, leadingWhitespace, internalWhitespace) { | |
return { | |
type: AstNodeType.FUNCTION_CALL, | |
procedureName: procedureName, | |
args: args, | |
leadingWhitespace: leadingWhitespace === null || leadingWhitespace === void 0 ? void 0 : leadingWhitespace.image, | |
internalWhitespace: internalWhitespace === null || internalWhitespace === void 0 ? void 0 : internalWhitespace.image | |
}; | |
}; | |
var buildArrayAst = function buildArrayAst(args, leadingWhitespace, internalWhitespace) { | |
return { | |
type: AstNodeType.ARRAY, | |
args: args, | |
leadingWhitespace: leadingWhitespace === null || leadingWhitespace === void 0 ? void 0 : leadingWhitespace.image, | |
internalWhitespace: internalWhitespace === null || internalWhitespace === void 0 ? void 0 : internalWhitespace.image | |
}; | |
}; | |
var buildNamedExpressionAst = function buildNamedExpressionAst(expressionName, leadingWhitespace) { | |
return { | |
type: AstNodeType.NAMED_EXPRESSION, | |
expressionName: expressionName, | |
leadingWhitespace: leadingWhitespace === null || leadingWhitespace === void 0 ? void 0 : leadingWhitespace.image | |
}; | |
}; | |
var buildParenthesisAst = function buildParenthesisAst(expression, leadingWhitespace, internalWhitespace) { | |
return { | |
type: AstNodeType.PARENTHESIS, | |
expression: expression, | |
leadingWhitespace: leadingWhitespace === null || leadingWhitespace === void 0 ? void 0 : leadingWhitespace.image, | |
internalWhitespace: internalWhitespace === null || internalWhitespace === void 0 ? void 0 : internalWhitespace.image | |
}; | |
}; | |
var buildCellErrorAst = function buildCellErrorAst(error, leadingWhitespace) { | |
return { | |
type: AstNodeType.ERROR, | |
error: error, | |
leadingWhitespace: leadingWhitespace === null || leadingWhitespace === void 0 ? void 0 : leadingWhitespace.image | |
}; | |
}; | |
var buildErrorWithRawInputAst = function buildErrorWithRawInputAst(rawInput, error, leadingWhitespace) { | |
return { | |
type: AstNodeType.ERROR_WITH_RAW_INPUT, | |
error: error, | |
rawInput: rawInput, | |
leadingWhitespace: leadingWhitespace === null || leadingWhitespace === void 0 ? void 0 : leadingWhitespace.image | |
}; | |
}; | |
var buildParsingErrorAst = function buildParsingErrorAst() { | |
return { | |
type: AstNodeType.ERROR, | |
error: _Cell__WEBPACK_IMPORTED_MODULE_1__["CellError"].parsingError() | |
}; | |
}; | |
function assertRangeConsistency(start, end, sheetReferenceType) { | |
if (start.sheet !== undefined && end.sheet === undefined || start.sheet === undefined && end.sheet !== undefined) { | |
throw new Error('Start address inconsistent with end address'); | |
} | |
if (start.sheet === undefined && sheetReferenceType !== RangeSheetReferenceType.RELATIVE || start.sheet !== undefined && sheetReferenceType === RangeSheetReferenceType.RELATIVE) { | |
throw new Error('Sheet address inconsistent with sheet reference type'); | |
} | |
} | |
function imageWithWhitespace(image, leadingWhitespace) { | |
return (leadingWhitespace !== null && leadingWhitespace !== void 0 ? leadingWhitespace : '') + image; | |
} | |
/***/ }), | |
/* 102 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
exports.__esModule = true; | |
exports.align = align; | |
exports.checkSelectionConsistency = checkSelectionConsistency; | |
exports.filterSeparators = filterSeparators; | |
exports.getAlignmentClasses = getAlignmentClasses; | |
exports.getValidSelection = getValidSelection; | |
exports.hasSubMenu = hasSubMenu; | |
exports.isDisabled = isDisabled; | |
exports.isItemHidden = isItemHidden; | |
exports.isSelectionDisabled = isSelectionDisabled; | |
exports.isSeparator = isSeparator; | |
exports.markLabelAsSelected = markLabelAsSelected; | |
exports.normalizeSelection = normalizeSelection; | |
exports.prepareHorizontalAlignClass = prepareHorizontalAlignClass; | |
exports.prepareVerticalAlignClass = prepareVerticalAlignClass; | |
__webpack_require__(33); | |
__webpack_require__(13); | |
__webpack_require__(64); | |
__webpack_require__(21); | |
__webpack_require__(14); | |
__webpack_require__(26); | |
__webpack_require__(139); | |
var _array = __webpack_require__(20); | |
var _element = __webpack_require__(25); | |
var _separator = __webpack_require__(313); | |
/** | |
* @param {CellRange[]} selRanges An array of the cell ranges. | |
* @returns {object[]} | |
*/ | |
function normalizeSelection(selRanges) { | |
return (0, _array.arrayMap)(selRanges, function (range) { | |
return { | |
start: range.getTopLeftCorner(), | |
end: range.getBottomRightCorner() | |
}; | |
}); | |
} | |
/** | |
* @param {HTMLElement} cell The HTML cell element to check. | |
* @returns {boolean} | |
*/ | |
function isSeparator(cell) { | |
return (0, _element.hasClass)(cell, 'htSeparator'); | |
} | |
/** | |
* @param {HTMLElement} cell The HTML cell element to check. | |
* @returns {boolean} | |
*/ | |
function hasSubMenu(cell) { | |
return (0, _element.hasClass)(cell, 'htSubmenu'); | |
} | |
/** | |
* @param {HTMLElement} cell The HTML cell element to check. | |
* @returns {boolean} | |
*/ | |
function isDisabled(cell) { | |
return (0, _element.hasClass)(cell, 'htDisabled'); | |
} | |
/** | |
* @param {HTMLElement} cell The HTML cell element to check. | |
* @returns {boolean} | |
*/ | |
function isSelectionDisabled(cell) { | |
return (0, _element.hasClass)(cell, 'htSelectionDisabled'); | |
} | |
/** | |
* @param {Core} hot The Handsontable instance. | |
* @returns {Array[]|null} | |
*/ | |
function getValidSelection(hot) { | |
var selected = hot.getSelected(); | |
if (!selected) { | |
return null; | |
} | |
if (selected[0] < 0) { | |
return null; | |
} | |
return selected; | |
} | |
/** | |
* @param {string} className The full element class name to process. | |
* @param {string} alignment The slignment class name to compare with. | |
* @returns {string} | |
*/ | |
function prepareVerticalAlignClass(className, alignment) { | |
if (className.indexOf(alignment) !== -1) { | |
return className; | |
} | |
var replacedClassName = className.replace('htTop', '').replace('htMiddle', '').replace('htBottom', '').replace(' ', ''); | |
return "".concat(replacedClassName, " ").concat(alignment); | |
} | |
/** | |
* @param {string} className The full element class name to process. | |
* @param {string} alignment The slignment class name to compare with. | |
* @returns {string} | |
*/ | |
function prepareHorizontalAlignClass(className, alignment) { | |
if (className.indexOf(alignment) !== -1) { | |
return className; | |
} | |
var replacedClassName = className.replace('htLeft', '').replace('htCenter', '').replace('htRight', '').replace('htJustify', '').replace(' ', ''); | |
return "".concat(replacedClassName, " ").concat(alignment); | |
} | |
/** | |
* @param {CellRange[]} ranges An array of the cell ranges. | |
* @param {Function} callback The callback function. | |
* @returns {object} | |
*/ | |
function getAlignmentClasses(ranges, callback) { | |
var classes = {}; | |
(0, _array.arrayEach)(ranges, function (range) { | |
range.forAll(function (row, col) { | |
// Alignment classes should only collected within cell ranges. We skip header coordinates. | |
if (row >= 0 && col >= 0) { | |
if (!classes[row]) { | |
classes[row] = []; | |
} | |
classes[row][col] = callback(row, col); | |
} | |
}); | |
}); | |
return classes; | |
} | |
/** | |
* @param {CellRange[]} ranges An array of the cell ranges. | |
* @param {string} type The type of the alignment axis ('horizontal' or 'vertical'). | |
* @param {string} alignment CSS class name to add. | |
* @param {Function} cellDescriptor The function which fetches the cell meta object based in passed coordinates. | |
* @param {Function} propertySetter The function which contains logic for added/removed alignment. | |
*/ | |
function align(ranges, type, alignment, cellDescriptor, propertySetter) { | |
(0, _array.arrayEach)(ranges, function (range) { | |
range.forAll(function (row, col) { | |
// Alignment classes should only collected within cell ranges. We skip header coordinates. | |
if (row >= 0 && col >= 0) { | |
applyAlignClassName(row, col, type, alignment, cellDescriptor, propertySetter); | |
} | |
}); | |
}); | |
} | |
/** | |
* @param {number} row The visual row index. | |
* @param {number} col The visual column index. | |
* @param {string} type The type of the alignment axis ('horizontal' or 'vertical'). | |
* @param {string} alignment CSS class name to add. | |
* @param {Function} cellDescriptor The function which fetches the cell meta object based in passed coordinates. | |
* @param {Function} propertySetter The function which contains logic for added/removed alignment. | |
*/ | |
function applyAlignClassName(row, col, type, alignment, cellDescriptor, propertySetter) { | |
var cellMeta = cellDescriptor(row, col); | |
var className = alignment; | |
if (cellMeta.className) { | |
if (type === 'vertical') { | |
className = prepareVerticalAlignClass(cellMeta.className, alignment); | |
} else { | |
className = prepareHorizontalAlignClass(cellMeta.className, alignment); | |
} | |
} | |
propertySetter(row, col, 'className', className); | |
} | |
/** | |
* @param {CellRange[]} ranges An array of the cell ranges. | |
* @param {Function} comparator The comparator function. | |
* @returns {boolean} | |
*/ | |
function checkSelectionConsistency(ranges, comparator) { | |
var result = false; | |
if (Array.isArray(ranges)) { | |
(0, _array.arrayEach)(ranges, function (range) { | |
range.forAll(function (row, col) { | |
// Selection consistency should only check within cell ranges. We skip header coordinates. | |
if (row >= 0 && col >= 0 && comparator(row, col)) { | |
result = true; | |
return false; | |
} | |
}); | |
return result; | |
}); | |
} | |
return result; | |
} | |
/** | |
* @param {string} label The label text. | |
* @returns {string} | |
*/ | |
function markLabelAsSelected(label) { | |
// workaround for https://github.com/handsontable/handsontable/issues/1946 | |
return "<span class=\"selected\">".concat(String.fromCharCode(10003), "</span>").concat(label); | |
} | |
/** | |
* @param {object} item The object which describes the context menu item properties. | |
* @param {Core} instance The Handsontable instance. | |
* @returns {boolean} | |
*/ | |
function isItemHidden(item, instance) { | |
return !item.hidden || !(typeof item.hidden === 'function' && item.hidden.call(instance)); | |
} | |
/** | |
* @param {object[]} items The context menu items collection. | |
* @param {string} separator The string which identifies the context menu separator item. | |
* @returns {object[]} | |
*/ | |
function shiftSeparators(items, separator) { | |
var result = items.slice(0); | |
for (var i = 0; i < result.length;) { | |
if (result[i].name === separator) { | |
result.shift(); | |
} else { | |
break; | |
} | |
} | |
return result; | |
} | |
/** | |
* @param {object[]} items The context menu items collection. | |
* @param {string} separator The string which identifies the context menu separator item. | |
* @returns {object[]} | |
*/ | |
function popSeparators(items, separator) { | |
var result = items.slice(0); | |
result.reverse(); | |
result = shiftSeparators(result, separator); | |
result.reverse(); | |
return result; | |
} | |
/** | |
* Removes duplicated menu separators from the context menu items collection. | |
* | |
* @param {object[]} items The context menu items collection. | |
* @returns {object[]} | |
*/ | |
function removeDuplicatedSeparators(items) { | |
var result = []; | |
(0, _array.arrayEach)(items, function (value, index) { | |
if (index > 0) { | |
if (result[result.length - 1].name !== value.name) { | |
result.push(value); | |
} | |
} else { | |
result.push(value); | |
} | |
}); | |
return result; | |
} | |
/** | |
* Removes menu separators from the context menu items collection. | |
* | |
* @param {object[]} items The context menu items collection. | |
* @param {string} separator The string which identifies the context menu separator item. | |
* @returns {object[]} | |
*/ | |
function filterSeparators(items) { | |
var separator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _separator.KEY; | |
var result = items.slice(0); | |
result = shiftSeparators(result, separator); | |
result = popSeparators(result, separator); | |
result = removeDuplicatedSeparators(result); | |
return result; | |
} | |
/***/ }), | |
/* 103 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var global = __webpack_require__(30); | |
var isCallable = __webpack_require__(61); | |
var hasOwn = __webpack_require__(73); | |
var createNonEnumerableProperty = __webpack_require__(122); | |
var setGlobal = __webpack_require__(238); | |
var inspectSource = __webpack_require__(239); | |
var InternalStateModule = __webpack_require__(113); | |
var CONFIGURABLE_FUNCTION_NAME = __webpack_require__(168).CONFIGURABLE; | |
var getInternalState = InternalStateModule.get; | |
var enforceInternalState = InternalStateModule.enforce; | |
var TEMPLATE = String(String).split('String'); | |
(module.exports = function (O, key, value, options) { | |
var unsafe = options ? !!options.unsafe : false; | |
var simple = options ? !!options.enumerable : false; | |
var noTargetGet = options ? !!options.noTargetGet : false; | |
var name = options && options.name !== undefined ? options.name : key; | |
var state; | |
if (isCallable(value)) { | |
if (String(name).slice(0, 7) === 'Symbol(') { | |
name = '[' + String(name).replace(/^Symbol\(([^)]*)\)/, '$1') + ']'; | |
} | |
if (!hasOwn(value, 'name') || (CONFIGURABLE_FUNCTION_NAME && value.name !== name)) { | |
createNonEnumerableProperty(value, 'name', name); | |
} | |
state = enforceInternalState(value); | |
if (!state.source) { | |
state.source = TEMPLATE.join(typeof name == 'string' ? name : ''); | |
} | |
} | |
if (O === global) { | |
if (simple) O[key] = value; | |
else setGlobal(key, value); | |
return; | |
} else if (!unsafe) { | |
delete O[key]; | |
} else if (!noTargetGet && O[key]) { | |
simple = true; | |
} | |
if (simple) O[key] = value; | |
else createNonEnumerableProperty(O, key, value); | |
// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative | |
})(Function.prototype, 'toString', function toString() { | |
return isCallable(this) && getInternalState(this).source || inspectSource(this); | |
}); | |
/***/ }), | |
/* 104 */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ArithmeticHelper", function() { return ArithmeticHelper; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "coerceComplexToString", function() { return coerceComplexToString; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "coerceToRange", function() { return coerceToRange; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "coerceToRangeNumbersOrError", function() { return coerceToRangeNumbersOrError; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "coerceBooleanToNumber", function() { return coerceBooleanToNumber; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "coerceEmptyToValue", function() { return coerceEmptyToValue; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "coerceScalarToBoolean", function() { return coerceScalarToBoolean; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "coerceScalarToString", function() { return coerceScalarToString; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "zeroIfEmpty", function() { return zeroIfEmpty; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "numberCmp", function() { return numberCmp; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isNumberOverflow", function() { return isNumberOverflow; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fixNegativeZero", function() { return fixNegativeZero; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "forceNormalizeString", function() { return forceNormalizeString; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "coerceRangeToScalar", function() { return coerceRangeToScalar; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "normalizeString", function() { return _normalizeString; }); | |
/* harmony import */ var core_js_modules_es_array_concat_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(21); | |
/* harmony import */ var core_js_modules_es_array_concat_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_concat_js__WEBPACK_IMPORTED_MODULE_0__); | |
/* harmony import */ var core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(13); | |
/* harmony import */ var core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_1__); | |
/* harmony import */ var core_js_modules_es_string_trim_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(107); | |
/* harmony import */ var core_js_modules_es_string_trim_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_string_trim_js__WEBPACK_IMPORTED_MODULE_2__); | |
/* harmony import */ var core_js_modules_es_number_constructor_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(53); | |
/* harmony import */ var core_js_modules_es_number_constructor_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_number_constructor_js__WEBPACK_IMPORTED_MODULE_3__); | |
/* harmony import */ var core_js_modules_es_regexp_constructor_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(95); | |
/* harmony import */ var core_js_modules_es_regexp_constructor_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_regexp_constructor_js__WEBPACK_IMPORTED_MODULE_4__); | |
/* harmony import */ var core_js_modules_es_regexp_to_string_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(67); | |
/* harmony import */ var core_js_modules_es_regexp_to_string_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_regexp_to_string_js__WEBPACK_IMPORTED_MODULE_5__); | |
/* harmony import */ var core_js_modules_es_string_replace_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(64); | |
/* harmony import */ var core_js_modules_es_string_replace_js__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_string_replace_js__WEBPACK_IMPORTED_MODULE_6__); | |
/* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(0); | |
/* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_7__); | |
/* harmony import */ var core_js_modules_es_array_includes_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(42); | |
/* harmony import */ var core_js_modules_es_array_includes_js__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_includes_js__WEBPACK_IMPORTED_MODULE_8__); | |
/* harmony import */ var core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(14); | |
/* harmony import */ var core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_9__); | |
/* harmony import */ var core_js_modules_es_function_name_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(26); | |
/* harmony import */ var core_js_modules_es_function_name_js__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_function_name_js__WEBPACK_IMPORTED_MODULE_10__); | |
/* harmony import */ var core_js_modules_es_array_from_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(23); | |
/* harmony import */ var core_js_modules_es_array_from_js__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_from_js__WEBPACK_IMPORTED_MODULE_11__); | |
/* harmony import */ var core_js_modules_es_string_iterator_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(2); | |
/* harmony import */ var core_js_modules_es_string_iterator_js__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_string_iterator_js__WEBPACK_IMPORTED_MODULE_12__); | |
/* harmony import */ var core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(9); | |
/* harmony import */ var core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_13___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_13__); | |
/* harmony import */ var core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(10); | |
/* harmony import */ var core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_14___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_14__); | |
/* harmony import */ var core_js_modules_es_symbol_iterator_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(11); | |
/* harmony import */ var core_js_modules_es_symbol_iterator_js__WEBPACK_IMPORTED_MODULE_15___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_symbol_iterator_js__WEBPACK_IMPORTED_MODULE_15__); | |
/* harmony import */ var core_js_modules_es_array_iterator_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(3); | |
/* harmony import */ var core_js_modules_es_array_iterator_js__WEBPACK_IMPORTED_MODULE_16___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_iterator_js__WEBPACK_IMPORTED_MODULE_16__); | |
/* harmony import */ var core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(4); | |
/* harmony import */ var core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_17___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_17__); | |
/* harmony import */ var unorm__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(665); | |
/* harmony import */ var unorm__WEBPACK_IMPORTED_MODULE_18___default = /*#__PURE__*/__webpack_require__.n(unorm__WEBPACK_IMPORTED_MODULE_18__); | |
/* harmony import */ var _Cell__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(24); | |
/* harmony import */ var _error_message__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(46); | |
/* harmony import */ var _StringHelper__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(666); | |
/* harmony import */ var _InterpreterValue__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(51); | |
/* harmony import */ var _SimpleRangeValue__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(80); | |
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } | |
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } | |
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } | |
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } | |
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } | |
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } | |
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } | |
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } | |
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } | |
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | |
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } | |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | |
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | |
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | |
/** | |
* @license | |
* Copyright (c) 2021 Handsoncode. All rights reserved. | |
*/ | |
var COMPLEX_NUMBER_SYMBOL = 'i'; | |
var complexParsingRegexp = /^\s*([+-]?)\s*(([\d\.,]+(e[+-]?\d+)?)\s*([ij]?)|([ij]))\s*(([+-])\s*([+-]?)\s*(([\d\.,]+(e[+-]?\d+)?)\s*([ij]?)|([ij])))?$/; | |
var ArithmeticHelper = /*#__PURE__*/function () { | |
function ArithmeticHelper(config, dateTimeHelper, numberLiteralsHelper) { | |
var _this = this; | |
_classCallCheck(this, ArithmeticHelper); | |
this.config = config; | |
this.dateTimeHelper = dateTimeHelper; | |
this.numberLiteralsHelper = numberLiteralsHelper; | |
this.lt = function (left, right) { | |
return _this.compare(left, right) < 0; | |
}; | |
this.leq = function (left, right) { | |
return _this.compare(left, right) <= 0; | |
}; | |
this.gt = function (left, right) { | |
return _this.compare(left, right) > 0; | |
}; | |
this.geq = function (left, right) { | |
return _this.compare(left, right) >= 0; | |
}; | |
this.eq = function (left, right) { | |
return _this.compare(left, right) === 0; | |
}; | |
this.neq = function (left, right) { | |
return _this.compare(left, right) !== 0; | |
}; | |
this.pow = function (left, right) { | |
return Math.pow(Object(_InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["getRawValue"])(left), Object(_InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["getRawValue"])(right)); | |
}; | |
this.addWithEpsilonRaw = function (left, right) { | |
var ret = left + right; | |
if (Math.abs(ret) < _this.actualEps * Math.abs(left)) { | |
return 0; | |
} else { | |
return ret; | |
} | |
}; | |
this.addWithEpsilon = function (left, right) { | |
var typeOfResult = inferExtendedNumberTypeAdditive(left, right); | |
return _this.ExtendedNumberFactory(_this.addWithEpsilonRaw(Object(_InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["getRawValue"])(left), Object(_InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["getRawValue"])(right)), typeOfResult); | |
}; | |
this.unaryMinus = function (arg) { | |
return Object(_InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["cloneNumber"])(arg, -Object(_InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["getRawValue"])(arg)); | |
}; | |
this.unaryPlus = function (arg) { | |
return arg; | |
}; | |
this.unaryPercent = function (arg) { | |
return new _InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["PercentNumber"](Object(_InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["getRawValue"])(arg) / 100); | |
}; | |
this.concat = function (left, right) { | |
return left.concat(right); | |
}; | |
this.nonstrictadd = function (left, right) { | |
if (left instanceof _Cell__WEBPACK_IMPORTED_MODULE_19__["CellError"]) { | |
return left; | |
} else if (right instanceof _Cell__WEBPACK_IMPORTED_MODULE_19__["CellError"]) { | |
return right; | |
} else if (typeof left === 'number') { | |
if (typeof right === 'number') { | |
return _this.addWithEpsilonRaw(left, right); | |
} else { | |
return left; | |
} | |
} else if (typeof right === 'number') { | |
return right; | |
} else { | |
return 0; | |
} | |
}; | |
/** | |
* Subtracts two numbers | |
* | |
* Implementation of subtracting which is used in interpreter. | |
* | |
* @param left - left operand of subtraction | |
* @param right - right operand of subtraction | |
* @param eps - precision of comparison | |
*/ | |
this.subtract = function (leftArg, rightArg) { | |
var typeOfResult = inferExtendedNumberTypeAdditive(leftArg, rightArg); | |
var left = Object(_InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["getRawValue"])(leftArg); | |
var right = Object(_InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["getRawValue"])(rightArg); | |
var ret = left - right; | |
if (Math.abs(ret) < _this.actualEps * Math.abs(left)) { | |
ret = 0; | |
} | |
return _this.ExtendedNumberFactory(ret, typeOfResult); | |
}; | |
this.divide = function (leftArg, rightArg) { | |
var left = Object(_InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["getRawValue"])(leftArg); | |
var right = Object(_InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["getRawValue"])(rightArg); | |
if (right === 0) { | |
return new _Cell__WEBPACK_IMPORTED_MODULE_19__["CellError"](_Cell__WEBPACK_IMPORTED_MODULE_19__["ErrorType"].DIV_BY_ZERO); | |
} else { | |
var typeOfResult = inferExtendedNumberTypeMultiplicative(leftArg, rightArg); | |
return _this.ExtendedNumberFactory(left / right, typeOfResult); | |
} | |
}; | |
this.multiply = function (left, right) { | |
var typeOfResult = inferExtendedNumberTypeMultiplicative(left, right); | |
return _this.ExtendedNumberFactory(Object(_InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["getRawValue"])(left) * Object(_InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["getRawValue"])(right), typeOfResult); | |
}; | |
this.manyToExactComplex = function (args) { | |
var ret = []; | |
var _iterator = _createForOfIteratorHelper(args), | |
_step; | |
try { | |
for (_iterator.s(); !(_step = _iterator.n()).done;) { | |
var arg = _step.value; | |
if (arg instanceof _Cell__WEBPACK_IMPORTED_MODULE_19__["CellError"]) { | |
return arg; | |
} else if (Object(_InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["isExtendedNumber"])(arg) || typeof arg === 'string') { | |
var coerced = _this.coerceScalarToComplex(arg); | |
if (!(coerced instanceof _Cell__WEBPACK_IMPORTED_MODULE_19__["CellError"])) { | |
ret.push(coerced); | |
} | |
} | |
} | |
} catch (err) { | |
_iterator.e(err); | |
} finally { | |
_iterator.f(); | |
} | |
return ret; | |
}; | |
this.coerceNumbersExactRanges = function (args) { | |
return _this.manyToNumbers(args, _this.manyToExactNumbers); | |
}; | |
this.coerceNumbersCoerceRangesDropNulls = function (args) { | |
return _this.manyToNumbers(args, _this.manyToCoercedNumbersDropNulls); | |
}; | |
this.manyToExactNumbers = function (args) { | |
var ret = []; | |
var _iterator2 = _createForOfIteratorHelper(args), | |
_step2; | |
try { | |
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { | |
var arg = _step2.value; | |
if (arg instanceof _Cell__WEBPACK_IMPORTED_MODULE_19__["CellError"]) { | |
return arg; | |
} else if (Object(_InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["isExtendedNumber"])(arg)) { | |
ret.push(Object(_InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["getRawValue"])(arg)); | |
} | |
} | |
} catch (err) { | |
_iterator2.e(err); | |
} finally { | |
_iterator2.f(); | |
} | |
return ret; | |
}; | |
this.manyToOnlyNumbersDropNulls = function (args) { | |
var ret = []; | |
var _iterator3 = _createForOfIteratorHelper(args), | |
_step3; | |
try { | |
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) { | |
var arg = _step3.value; | |
if (arg instanceof _Cell__WEBPACK_IMPORTED_MODULE_19__["CellError"]) { | |
return arg; | |
} else if (Object(_InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["isExtendedNumber"])(arg)) { | |
ret.push(Object(_InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["getRawValue"])(arg)); | |
} else if (arg !== _InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["EmptyValue"]) { | |
return new _Cell__WEBPACK_IMPORTED_MODULE_19__["CellError"](_Cell__WEBPACK_IMPORTED_MODULE_19__["ErrorType"].VALUE, _error_message__WEBPACK_IMPORTED_MODULE_20__["ErrorMessage"].NumberExpected); | |
} | |
} | |
} catch (err) { | |
_iterator3.e(err); | |
} finally { | |
_iterator3.f(); | |
} | |
return ret; | |
}; | |
this.manyToCoercedNumbersDropNulls = function (args) { | |
var ret = []; | |
var _iterator4 = _createForOfIteratorHelper(args), | |
_step4; | |
try { | |
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) { | |
var arg = _step4.value; | |
if (arg instanceof _Cell__WEBPACK_IMPORTED_MODULE_19__["CellError"]) { | |
return arg; | |
} | |
if (arg === _InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["EmptyValue"]) { | |
continue; | |
} | |
var coerced = _this.coerceScalarToNumberOrError(arg); | |
if (Object(_InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["isExtendedNumber"])(coerced)) { | |
ret.push(Object(_InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["getRawValue"])(coerced)); | |
} | |
} | |
} catch (err) { | |
_iterator4.e(err); | |
} finally { | |
_iterator4.f(); | |
} | |
return ret; | |
}; | |
this.collator = Object(_StringHelper__WEBPACK_IMPORTED_MODULE_21__["collatorFromConfig"])(config); | |
this.actualEps = config.smartRounding ? config.precisionEpsilon : 0; | |
} | |
_createClass(ArithmeticHelper, [{ | |
key: "eqMatcherFunction", | |
value: function eqMatcherFunction(pattern) { | |
var _this2 = this; | |
var regexp = this.buildRegex(pattern); | |
return function (cellValue) { | |
return typeof cellValue === 'string' && regexp.test(_this2.normalizeString(cellValue)); | |
}; | |
} | |
}, { | |
key: "neqMatcherFunction", | |
value: function neqMatcherFunction(pattern) { | |
var _this3 = this; | |
var regexp = this.buildRegex(pattern); | |
return function (cellValue) { | |
return !(typeof cellValue === 'string') || !regexp.test(_this3.normalizeString(cellValue)); | |
}; | |
} | |
}, { | |
key: "searchString", | |
value: function searchString(pattern, text) { | |
var _a; | |
var regexp = this.buildRegex(pattern, false); | |
var result = regexp.exec(text); | |
return (_a = result === null || result === void 0 ? void 0 : result.index) !== null && _a !== void 0 ? _a : -1; | |
} | |
}, { | |
key: "requiresRegex", | |
value: function requiresRegex(pattern) { | |
if (!this.config.useRegularExpressions && !this.config.useWildcards) { | |
return !this.config.matchWholeCell; | |
} | |
for (var i = 0; i < pattern.length; i++) { | |
var c = pattern.charAt(i); | |
if (isWildcard(c) || this.config.useRegularExpressions && needsEscape(c)) { | |
return true; | |
} | |
} | |
return false; | |
} | |
}, { | |
key: "floatCmp", | |
value: function floatCmp(leftArg, rightArg) { | |
var left = Object(_InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["getRawValue"])(leftArg); | |
var right = Object(_InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["getRawValue"])(rightArg); | |
var mod = 1 + this.actualEps; | |
if (right >= 0 && left * mod >= right && left <= right * mod) { | |
return 0; | |
} else if (right <= 0 && left * mod <= right && left >= right * mod) { | |
return 0; | |
} else if (left > right) { | |
return 1; | |
} else { | |
return -1; | |
} | |
} | |
}, { | |
key: "coerceScalarToNumberOrError", | |
value: function coerceScalarToNumberOrError(arg) { | |
var _a; | |
if (arg instanceof _Cell__WEBPACK_IMPORTED_MODULE_19__["CellError"]) { | |
return arg; | |
} | |
return (_a = this.coerceToMaybeNumber(arg)) !== null && _a !== void 0 ? _a : new _Cell__WEBPACK_IMPORTED_MODULE_19__["CellError"](_Cell__WEBPACK_IMPORTED_MODULE_19__["ErrorType"].VALUE, _error_message__WEBPACK_IMPORTED_MODULE_20__["ErrorMessage"].NumberCoercion); | |
} | |
}, { | |
key: "coerceToMaybeNumber", | |
value: function coerceToMaybeNumber(arg) { | |
var _a; | |
return (_a = this.coerceNonDateScalarToMaybeNumber(arg)) !== null && _a !== void 0 ? _a : typeof arg === 'string' ? this.dateTimeHelper.dateStringToDateNumber(arg) : undefined; | |
} | |
}, { | |
key: "coerceNonDateScalarToMaybeNumber", | |
value: function coerceNonDateScalarToMaybeNumber(arg) { | |
if (arg === _InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["EmptyValue"]) { | |
return 0; | |
} else if (typeof arg === 'string') { | |
if (arg === '') { | |
return 0; | |
} | |
return this.numberLiteralsHelper.numericStringToMaybeNumber(arg.trim()); | |
} else if (Object(_InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["isExtendedNumber"])(arg)) { | |
return arg; | |
} else if (typeof arg === 'boolean') { | |
return Number(arg); | |
} else { | |
return undefined; | |
} | |
} | |
}, { | |
key: "coerceComplexExactRanges", | |
value: function coerceComplexExactRanges(args) { | |
var vals = []; | |
var _iterator5 = _createForOfIteratorHelper(args), | |
_step5; | |
try { | |
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) { | |
var arg = _step5.value; | |
if (arg instanceof _SimpleRangeValue__WEBPACK_IMPORTED_MODULE_23__["SimpleRangeValue"]) { | |
vals.push(arg); | |
} else if (arg !== _InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["EmptyValue"]) { | |
var coerced = this.coerceScalarToComplex(arg); | |
if (coerced instanceof _Cell__WEBPACK_IMPORTED_MODULE_19__["CellError"]) { | |
return coerced; | |
} else { | |
vals.push(coerced); | |
} | |
} | |
} | |
} catch (err) { | |
_iterator5.e(err); | |
} finally { | |
_iterator5.f(); | |
} | |
var expandedVals = []; | |
for (var _i = 0, _vals = vals; _i < _vals.length; _i++) { | |
var val = _vals[_i]; | |
if (val instanceof _SimpleRangeValue__WEBPACK_IMPORTED_MODULE_23__["SimpleRangeValue"]) { | |
var arr = this.manyToExactComplex(val.valuesFromTopLeftCorner()); | |
if (arr instanceof _Cell__WEBPACK_IMPORTED_MODULE_19__["CellError"]) { | |
return arr; | |
} else { | |
expandedVals.push.apply(expandedVals, _toConsumableArray(arr)); | |
} | |
} else { | |
expandedVals.push(val); | |
} | |
} | |
return expandedVals; | |
} | |
}, { | |
key: "coerceScalarToComplex", | |
value: function coerceScalarToComplex(arg) { | |
if (arg instanceof _Cell__WEBPACK_IMPORTED_MODULE_19__["CellError"]) { | |
return arg; | |
} else if (arg === _InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["EmptyValue"]) { | |
return [0, 0]; | |
} else if (Object(_InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["isExtendedNumber"])(arg)) { | |
return [Object(_InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["getRawValue"])(arg), 0]; | |
} else if (typeof arg === 'string') { | |
return this.coerceStringToComplex(arg); | |
} else { | |
return new _Cell__WEBPACK_IMPORTED_MODULE_19__["CellError"](_Cell__WEBPACK_IMPORTED_MODULE_19__["ErrorType"].NUM, _error_message__WEBPACK_IMPORTED_MODULE_20__["ErrorMessage"].ComplexNumberExpected); | |
} | |
} | |
}, { | |
key: "ExtendedNumberFactory", | |
value: function ExtendedNumberFactory(value, typeFormat) { | |
var type = typeFormat.type, | |
format = typeFormat.format; | |
switch (type) { | |
case _InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["NumberType"].NUMBER_RAW: | |
return value; | |
case _InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["NumberType"].NUMBER_CURRENCY: | |
{ | |
return new _InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["CurrencyNumber"](value, format !== null && format !== void 0 ? format : this.config.currencySymbol[0]); | |
} | |
case _InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["NumberType"].NUMBER_DATE: | |
return new _InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["DateNumber"](value, format); | |
case _InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["NumberType"].NUMBER_DATETIME: | |
return new _InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["DateTimeNumber"](value, format); | |
case _InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["NumberType"].NUMBER_TIME: | |
return new _InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["TimeNumber"](value, format); | |
case _InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["NumberType"].NUMBER_PERCENT: | |
return new _InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["PercentNumber"](value, format); | |
} | |
} | |
}, { | |
key: "buildRegex", | |
value: function buildRegex(pattern) { | |
var matchWholeCell = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; | |
pattern = this.normalizeString(pattern); | |
var regexpStr; | |
var useWildcards = this.config.useWildcards; | |
var useRegularExpressions = this.config.useRegularExpressions; | |
if (useRegularExpressions) { | |
try { | |
RegExp(pattern); | |
} catch (e) { | |
useRegularExpressions = false; | |
useWildcards = false; | |
} | |
} | |
if (useRegularExpressions) { | |
regexpStr = escapeNoCharacters(pattern, this.config.caseSensitive); | |
} else if (useWildcards) { | |
regexpStr = escapeNonWildcards(pattern, this.config.caseSensitive); | |
} else { | |
regexpStr = escapeAllCharacters(pattern, this.config.caseSensitive); | |
} | |
if (this.config.matchWholeCell && matchWholeCell) { | |
return RegExp('^(' + regexpStr + ')$'); | |
} else { | |
return RegExp(regexpStr); | |
} | |
} | |
}, { | |
key: "normalizeString", | |
value: function normalizeString(str) { | |
if (!this.config.caseSensitive) { | |
str = str.toLowerCase(); | |
} | |
if (!this.config.accentSensitive) { | |
str = _normalizeString(str, 'nfd').replace(/[\u0300-\u036f]/g, ''); | |
} | |
return str; | |
} | |
}, { | |
key: "compare", | |
value: function compare(left, right) { | |
if (typeof left === 'string' || typeof right === 'string') { | |
var leftTmp = typeof left === 'string' ? this.dateTimeHelper.dateStringToDateNumber(left) : left; | |
var rightTmp = typeof right === 'string' ? this.dateTimeHelper.dateStringToDateNumber(right) : right; | |
if (Object(_InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["isExtendedNumber"])(leftTmp) && Object(_InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["isExtendedNumber"])(rightTmp)) { | |
return this.floatCmp(leftTmp, rightTmp); | |
} | |
} | |
if (left === _InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["EmptyValue"]) { | |
left = coerceEmptyToValue(right); | |
} else if (right === _InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["EmptyValue"]) { | |
right = coerceEmptyToValue(left); | |
} | |
if (typeof left === 'string' && typeof right === 'string') { | |
return this.stringCmp(left, right); | |
} else if (typeof left === 'boolean' && typeof right === 'boolean') { | |
return numberCmp(coerceBooleanToNumber(left), coerceBooleanToNumber(right)); | |
} else if (Object(_InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["isExtendedNumber"])(left) && Object(_InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["isExtendedNumber"])(right)) { | |
return this.floatCmp(left, right); | |
} else if (left === _InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["EmptyValue"] && right === _InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["EmptyValue"]) { | |
return 0; | |
} else { | |
return numberCmp(Object(_Cell__WEBPACK_IMPORTED_MODULE_19__["CellValueTypeOrd"])(Object(_Cell__WEBPACK_IMPORTED_MODULE_19__["getCellValueType"])(left)), Object(_Cell__WEBPACK_IMPORTED_MODULE_19__["CellValueTypeOrd"])(Object(_Cell__WEBPACK_IMPORTED_MODULE_19__["getCellValueType"])(right))); | |
} | |
} | |
}, { | |
key: "stringCmp", | |
value: function stringCmp(left, right) { | |
return this.collator.compare(left, right); | |
} | |
}, { | |
key: "manyToNumbers", | |
value: function manyToNumbers(args, rangeFn) { | |
var vals = []; | |
var _iterator6 = _createForOfIteratorHelper(args), | |
_step6; | |
try { | |
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) { | |
var arg = _step6.value; | |
if (arg instanceof _SimpleRangeValue__WEBPACK_IMPORTED_MODULE_23__["SimpleRangeValue"]) { | |
vals.push(arg); | |
} else { | |
var coerced = Object(_InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["getRawValue"])(this.coerceScalarToNumberOrError(arg)); | |
if (coerced instanceof _Cell__WEBPACK_IMPORTED_MODULE_19__["CellError"]) { | |
return coerced; | |
} else { | |
vals.push(coerced); | |
} | |
} | |
} | |
} catch (err) { | |
_iterator6.e(err); | |
} finally { | |
_iterator6.f(); | |
} | |
var expandedVals = []; | |
for (var _i2 = 0, _vals2 = vals; _i2 < _vals2.length; _i2++) { | |
var val = _vals2[_i2]; | |
if (val instanceof _SimpleRangeValue__WEBPACK_IMPORTED_MODULE_23__["SimpleRangeValue"]) { | |
var arr = rangeFn(val.valuesFromTopLeftCorner()); | |
if (arr instanceof _Cell__WEBPACK_IMPORTED_MODULE_19__["CellError"]) { | |
return arr; | |
} else { | |
expandedVals.push.apply(expandedVals, _toConsumableArray(arr)); | |
} | |
} else { | |
expandedVals.push(val); | |
} | |
} | |
return expandedVals; | |
} | |
}, { | |
key: "coerceStringToComplex", | |
value: function coerceStringToComplex(arg) { | |
var match = complexParsingRegexp.exec(arg); | |
if (match === null) { | |
return new _Cell__WEBPACK_IMPORTED_MODULE_19__["CellError"](_Cell__WEBPACK_IMPORTED_MODULE_19__["ErrorType"].NUM, _error_message__WEBPACK_IMPORTED_MODULE_20__["ErrorMessage"].ComplexNumberExpected); | |
} | |
var val1; | |
if (match[6] !== undefined) { | |
val1 = match[1] === '-' ? [0, -1] : [0, 1]; | |
} else { | |
val1 = this.parseComplexToken(match[1] + match[3], match[5]); | |
} | |
if (val1 instanceof _Cell__WEBPACK_IMPORTED_MODULE_19__["CellError"]) { | |
return val1; | |
} | |
if (match[8] === undefined) { | |
return val1; | |
} | |
var val2; | |
if (match[14] !== undefined) { | |
val2 = match[9] === '-' ? [0, -1] : [0, 1]; | |
} else { | |
val2 = this.parseComplexToken(match[9] + match[11], match[13]); | |
} | |
if (val2 instanceof _Cell__WEBPACK_IMPORTED_MODULE_19__["CellError"]) { | |
return val2; | |
} | |
if (match[5] !== '' || match[13] === '') { | |
return new _Cell__WEBPACK_IMPORTED_MODULE_19__["CellError"](_Cell__WEBPACK_IMPORTED_MODULE_19__["ErrorType"].NUM, _error_message__WEBPACK_IMPORTED_MODULE_20__["ErrorMessage"].ComplexNumberExpected); | |
} | |
if (match[8] === '+') { | |
return [val1[0] + val2[0], val1[1] + val2[1]]; | |
} else { | |
return [val1[0] - val2[0], val1[1] - val2[1]]; | |
} | |
} | |
}, { | |
key: "parseComplexToken", | |
value: function parseComplexToken(arg, mod) { | |
var val = Object(_InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["getRawValue"])(this.coerceNonDateScalarToMaybeNumber(arg)); | |
if (val === undefined) { | |
return new _Cell__WEBPACK_IMPORTED_MODULE_19__["CellError"](_Cell__WEBPACK_IMPORTED_MODULE_19__["ErrorType"].NUM, _error_message__WEBPACK_IMPORTED_MODULE_20__["ErrorMessage"].ComplexNumberExpected); | |
} | |
if (mod === '') { | |
return [val, 0]; | |
} else { | |
return [0, val]; | |
} | |
} | |
}]); | |
return ArithmeticHelper; | |
}(); | |
function coerceComplexToString(_ref, symb) { | |
var _ref2 = _slicedToArray(_ref, 2), | |
re = _ref2[0], | |
im = _ref2[1]; | |
if (!isFinite(re) || !isFinite(im)) { | |
return new _Cell__WEBPACK_IMPORTED_MODULE_19__["CellError"](_Cell__WEBPACK_IMPORTED_MODULE_19__["ErrorType"].NUM, _error_message__WEBPACK_IMPORTED_MODULE_20__["ErrorMessage"].NaN); | |
} | |
symb = symb !== null && symb !== void 0 ? symb : COMPLEX_NUMBER_SYMBOL; | |
if (im === 0) { | |
return "".concat(re); | |
} | |
var imStr = "".concat(im === -1 || im === 1 ? '' : Math.abs(im)).concat(symb); | |
if (re === 0) { | |
return "".concat(im < 0 ? '-' : '').concat(imStr); | |
} | |
return "".concat(re).concat(im < 0 ? '-' : '+').concat(imStr); | |
} | |
function coerceToRange(arg) { | |
if (arg instanceof _SimpleRangeValue__WEBPACK_IMPORTED_MODULE_23__["SimpleRangeValue"]) { | |
return arg; | |
} else { | |
return _SimpleRangeValue__WEBPACK_IMPORTED_MODULE_23__["SimpleRangeValue"].fromScalar(arg); | |
} | |
} | |
function coerceToRangeNumbersOrError(arg) { | |
if (arg instanceof _SimpleRangeValue__WEBPACK_IMPORTED_MODULE_23__["SimpleRangeValue"] && arg.hasOnlyNumbers() || arg instanceof _Cell__WEBPACK_IMPORTED_MODULE_19__["CellError"]) { | |
return arg; | |
} else if (Object(_InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["isExtendedNumber"])(arg)) { | |
return _SimpleRangeValue__WEBPACK_IMPORTED_MODULE_23__["SimpleRangeValue"].fromScalar(arg); | |
} else { | |
return null; | |
} | |
} | |
function coerceBooleanToNumber(arg) { | |
return Number(arg); | |
} | |
function coerceEmptyToValue(arg) { | |
if (typeof arg === 'string') { | |
return ''; | |
} else if (Object(_InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["isExtendedNumber"])(arg)) { | |
return 0; | |
} else if (typeof arg === 'boolean') { | |
return false; | |
} else { | |
return _InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["EmptyValue"]; | |
} | |
} | |
/** | |
* Coerce scalar value to boolean if possible, or error if value is an error | |
* | |
* @param arg | |
*/ | |
function coerceScalarToBoolean(arg) { | |
if (arg instanceof _Cell__WEBPACK_IMPORTED_MODULE_19__["CellError"] || typeof arg === 'boolean') { | |
return arg; | |
} else if (arg === _InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["EmptyValue"]) { | |
return false; | |
} else if (Object(_InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["isExtendedNumber"])(arg)) { | |
return Object(_InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["getRawValue"])(arg) !== 0; | |
} else { | |
var argUppered = arg.toUpperCase(); | |
if (argUppered === 'TRUE') { | |
return true; | |
} else if (argUppered === 'FALSE') { | |
return false; | |
} else if (argUppered === '') { | |
return false; | |
} else { | |
return undefined; | |
} | |
} | |
} | |
function coerceScalarToString(arg) { | |
if (arg instanceof _Cell__WEBPACK_IMPORTED_MODULE_19__["CellError"] || typeof arg === 'string') { | |
return arg; | |
} else if (arg === _InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["EmptyValue"]) { | |
return ''; | |
} else if (Object(_InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["isExtendedNumber"])(arg)) { | |
return Object(_InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["getRawValue"])(arg).toString(); | |
} else { | |
return arg ? 'TRUE' : 'FALSE'; | |
} | |
} | |
function zeroIfEmpty(arg) { | |
return arg === _InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["EmptyValue"] ? 0 : arg; | |
} | |
function numberCmp(leftArg, rightArg) { | |
var left = Object(_InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["getRawValue"])(leftArg); | |
var right = Object(_InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["getRawValue"])(rightArg); | |
if (left > right) { | |
return 1; | |
} else if (left < right) { | |
return -1; | |
} else { | |
return 0; | |
} | |
} | |
function isNumberOverflow(arg) { | |
return isNaN(arg) || arg === Infinity || arg === -Infinity; | |
} | |
function fixNegativeZero(arg) { | |
if (arg === 0) { | |
return 0; | |
} else { | |
return arg; | |
} | |
} | |
function isWildcard(c) { | |
return ['*', '?'].includes(c); | |
} | |
var escapedCharacters = ['{', '}', '[', ']', '(', ')', '<', '>', '=', '.', '+', '-', ',', '\\', '$', '^', '!']; | |
function needsEscape(c) { | |
return escapedCharacters.includes(c); | |
} | |
function escapeNonWildcards(pattern, caseSensitive) { | |
var str = ''; | |
for (var i = 0; i < pattern.length; i++) { | |
var c = pattern.charAt(i); | |
if (c === '~') { | |
if (i == pattern.length - 1) { | |
str += '~'; | |
continue; | |
} | |
var d = pattern.charAt(i + 1); | |
if (isWildcard(d) || needsEscape(d)) { | |
str += '\\' + d; | |
i++; | |
} else { | |
str += d; | |
i++; | |
} | |
} else if (isWildcard(c)) { | |
str += '.' + c; | |
} else if (needsEscape(c)) { | |
str += '\\' + c; | |
} else if (caseSensitive) { | |
str += c; | |
} else { | |
str += c.toLowerCase(); | |
} | |
} | |
return str; | |
} | |
function escapeAllCharacters(pattern, caseSensitive) { | |
var str = ''; | |
for (var i = 0; i < pattern.length; i++) { | |
var c = pattern.charAt(i); | |
if (isWildcard(c) || needsEscape(c)) { | |
str += '\\' + c; | |
} else if (caseSensitive) { | |
str += c; | |
} else { | |
str += c.toLowerCase(); | |
} | |
} | |
return str; | |
} | |
function escapeNoCharacters(pattern, caseSensitive) { | |
var str = ''; | |
for (var i = 0; i < pattern.length; i++) { | |
var c = pattern.charAt(i); | |
if (isWildcard(c) || needsEscape(c)) { | |
str += c; | |
} else if (caseSensitive) { | |
str += c; | |
} else { | |
str += c.toLowerCase(); | |
} | |
} | |
return str; | |
} | |
function inferExtendedNumberTypeAdditive(leftArg, rightArg) { | |
var _getTypeFormatOfExten = Object(_InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["getTypeFormatOfExtendedNumber"])(leftArg), | |
leftType = _getTypeFormatOfExten.type, | |
leftFormat = _getTypeFormatOfExten.format; | |
var _getTypeFormatOfExten2 = Object(_InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["getTypeFormatOfExtendedNumber"])(rightArg), | |
rightType = _getTypeFormatOfExten2.type, | |
rightFormat = _getTypeFormatOfExten2.format; | |
if (leftType === _InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["NumberType"].NUMBER_RAW) { | |
return { | |
type: rightType, | |
format: rightFormat | |
}; | |
} | |
if (rightType === _InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["NumberType"].NUMBER_RAW) { | |
return { | |
type: leftType, | |
format: leftFormat | |
}; | |
} | |
if ((leftType === _InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["NumberType"].NUMBER_DATETIME || leftType === _InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["NumberType"].NUMBER_DATE) && (rightType === _InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["NumberType"].NUMBER_DATETIME || rightType === _InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["NumberType"].NUMBER_DATE)) { | |
return { | |
type: _InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["NumberType"].NUMBER_RAW | |
}; | |
} | |
if (leftType === _InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["NumberType"].NUMBER_TIME) { | |
if (rightType === _InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["NumberType"].NUMBER_DATE) { | |
return { | |
type: _InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["NumberType"].NUMBER_DATETIME, | |
format: rightFormat + ' ' + leftFormat | |
}; | |
} | |
if (rightType === _InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["NumberType"].NUMBER_DATETIME) { | |
return { | |
type: _InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["NumberType"].NUMBER_DATETIME, | |
format: rightFormat | |
}; | |
} | |
} | |
if (rightType === _InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["NumberType"].NUMBER_TIME) { | |
if (leftType === _InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["NumberType"].NUMBER_DATE) { | |
return { | |
type: _InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["NumberType"].NUMBER_DATETIME, | |
format: leftFormat + ' ' + rightFormat | |
}; | |
} | |
if (leftType === _InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["NumberType"].NUMBER_DATETIME) { | |
return { | |
type: _InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["NumberType"].NUMBER_DATETIME, | |
format: leftFormat | |
}; | |
} | |
} | |
return { | |
type: leftType, | |
format: leftFormat | |
}; | |
} | |
function inferExtendedNumberTypeMultiplicative(leftArg, rightArg) { | |
var _getTypeFormatOfExten3 = Object(_InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["getTypeFormatOfExtendedNumber"])(leftArg), | |
leftType = _getTypeFormatOfExten3.type, | |
leftFormat = _getTypeFormatOfExten3.format; | |
var _getTypeFormatOfExten4 = Object(_InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["getTypeFormatOfExtendedNumber"])(rightArg), | |
rightType = _getTypeFormatOfExten4.type, | |
rightFormat = _getTypeFormatOfExten4.format; | |
if (leftType === _InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["NumberType"].NUMBER_PERCENT) { | |
leftType = _InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["NumberType"].NUMBER_RAW; | |
leftFormat = undefined; | |
} | |
if (rightType === _InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["NumberType"].NUMBER_PERCENT) { | |
rightType = _InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["NumberType"].NUMBER_RAW; | |
rightFormat = undefined; | |
} | |
if (leftType === _InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["NumberType"].NUMBER_RAW) { | |
return { | |
type: rightType, | |
format: rightFormat | |
}; | |
} | |
if (rightType === _InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["NumberType"].NUMBER_RAW) { | |
return { | |
type: leftType, | |
format: leftFormat | |
}; | |
} | |
return { | |
type: _InterpreterValue__WEBPACK_IMPORTED_MODULE_22__["NumberType"].NUMBER_RAW | |
}; | |
} | |
function forceNormalizeString(str) { | |
return _normalizeString(str.toLowerCase(), 'nfd').replace(/[\u0300-\u036f]/g, ''); | |
} | |
function coerceRangeToScalar(arg, state) { | |
var _a; | |
if (arg.isAdHoc()) { | |
return (_a = arg.data[0]) === null || _a === void 0 ? void 0 : _a[0]; | |
} | |
var range = arg.range; | |
if (state.formulaAddress.sheet === range.sheet) { | |
if (range.width() === 1) { | |
var offset = state.formulaAddress.row - range.start.row; | |
if (offset >= 0 && offset < range.height()) { | |
return arg.data[offset][0]; | |
} | |
} else if (range.height() === 1) { | |
var _offset = state.formulaAddress.col - range.start.col; | |
if (_offset >= 0 && _offset < range.width()) { | |
return arg.data[0][_offset]; | |
} | |
} | |
} | |
return undefined; | |
} | |
function _normalizeString(str, form) { | |
return typeof str.normalize === 'function' ? str.normalize(form.toUpperCase()) : unorm__WEBPACK_IMPORTED_MODULE_18___default.a[form](str); | |
} | |
/***/ }), | |
/* 105 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
exports.__esModule = true; | |
exports.isChrome = isChrome; | |
exports.isChromeWebKit = isChromeWebKit; | |
exports.isEdge = isEdge; | |
exports.isEdgeWebKit = isEdgeWebKit; | |
exports.isFirefox = isFirefox; | |
exports.isFirefoxWebKit = isFirefoxWebKit; | |
exports.isIE = isIE; | |
exports.isIE9 = isIE9; | |
exports.isIOS = isIOS; | |
exports.isIpadOS = isIpadOS; | |
exports.isLinuxOS = isLinuxOS; | |
exports.isMSBrowser = isMSBrowser; | |
exports.isMacOS = isMacOS; | |
exports.isMobileBrowser = isMobileBrowser; | |
exports.isSafari = isSafari; | |
exports.isWindowsOS = isWindowsOS; | |
exports.setBrowserMeta = setBrowserMeta; | |
exports.setPlatformMeta = setPlatformMeta; | |
__webpack_require__(13); | |
var _object = __webpack_require__(18); | |
var tester = function tester(testerFunc) { | |
var result = { | |
value: false | |
}; | |
result.test = function (ua, vendor) { | |
result.value = testerFunc(ua, vendor); | |
}; | |
return result; | |
}; | |
var browsers = { | |
chrome: tester(function (ua, vendor) { | |
return /Chrome/.test(ua) && /Google/.test(vendor); | |
}), | |
chromeWebKit: tester(function (ua) { | |
return /CriOS/.test(ua); | |
}), | |
edge: tester(function (ua) { | |
return /Edge/.test(ua); | |
}), | |
edgeWebKit: tester(function (ua) { | |
return /EdgiOS/.test(ua); | |
}), | |
firefox: tester(function (ua) { | |
return /Firefox/.test(ua); | |
}), | |
firefoxWebKit: tester(function (ua) { | |
return /FxiOS/.test(ua); | |
}), | |
ie: tester(function (ua) { | |
return /Trident/.test(ua); | |
}), | |
// eslint-disable-next-line no-restricted-globals | |
ie9: tester(function () { | |
return !!document.documentMode; | |
}), | |
mobile: tester(function (ua) { | |
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(ua); | |
}), | |
safari: tester(function (ua, vendor) { | |
return /Safari/.test(ua) && /Apple Computer/.test(vendor); | |
}) | |
}; | |
var platforms = { | |
mac: tester(function (platform) { | |
return /^Mac/.test(platform); | |
}), | |
win: tester(function (platform) { | |
return /^Win/.test(platform); | |
}), | |
linux: tester(function (platform) { | |
return /^Linux/.test(platform); | |
}), | |
ios: tester(function (ua) { | |
return /iPhone|iPad|iPod/i.test(ua); | |
}) | |
}; | |
/** | |
* @param {object} [metaObject] The browser identity collection. | |
* @param {object} [metaObject.userAgent] The user agent reported by browser. | |
* @param {object} [metaObject.vendor] The vendor name reported by browser. | |
*/ | |
function setBrowserMeta() { | |
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, | |
_ref$userAgent = _ref.userAgent, | |
userAgent = _ref$userAgent === void 0 ? navigator.userAgent : _ref$userAgent, | |
_ref$vendor = _ref.vendor, | |
vendor = _ref$vendor === void 0 ? navigator.vendor : _ref$vendor; | |
(0, _object.objectEach)(browsers, function (_ref2) { | |
var test = _ref2.test; | |
return void test(userAgent, vendor); | |
}); | |
} | |
/** | |
* @param {object} [metaObject] The platform identity collection. | |
* @param {object} [metaObject.platform] The platform ID. | |
*/ | |
function setPlatformMeta() { | |
var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, | |
_ref3$platform = _ref3.platform, | |
platform = _ref3$platform === void 0 ? navigator.platform : _ref3$platform; | |
(0, _object.objectEach)(platforms, function (_ref4) { | |
var test = _ref4.test; | |
return void test(platform); | |
}); | |
} | |
setBrowserMeta(); | |
setPlatformMeta(); | |
/** | |
* @returns {boolean} | |
*/ | |
function isChrome() { | |
return browsers.chrome.value; | |
} | |
/** | |
* @returns {boolean} | |
*/ | |
function isChromeWebKit() { | |
return browsers.chromeWebKit.value; | |
} | |
/** | |
* @returns {boolean} | |
*/ | |
function isFirefox() { | |
return browsers.firefox.value; | |
} | |
/** | |
* @returns {boolean} | |
*/ | |
function isFirefoxWebKit() { | |
return browsers.firefoxWebKit.value; | |
} | |
/** | |
* @returns {boolean} | |
*/ | |
function isSafari() { | |
return browsers.safari.value; | |
} | |
/** | |
* @returns {boolean} | |
*/ | |
function isEdge() { | |
return browsers.edge.value; | |
} | |
/** | |
* @returns {boolean} | |
*/ | |
function isEdgeWebKit() { | |
return browsers.edgeWebKit.value; | |
} | |
/** | |
* @returns {boolean} | |
*/ | |
function isIE() { | |
return browsers.ie.value; | |
} | |
/** | |
* @returns {boolean} | |
*/ | |
function isIE9() { | |
return browsers.ie9.value; | |
} | |
/** | |
* @returns {boolean} | |
*/ | |
function isMSBrowser() { | |
return browsers.ie.value || browsers.edge.value; | |
} | |
/** | |
* @returns {boolean} | |
*/ | |
function isMobileBrowser() { | |
return browsers.mobile.value; | |
} | |
/** | |
* @returns {boolean} | |
*/ | |
function isIOS() { | |
return platforms.ios.value; | |
} | |
/** | |
* A hacky way to recognize the iPad. Since iOS 13, the iPad on Safari mimics macOS behavior and user agent. | |
* | |
* @see {@https://stackoverflow.com/a/57838385} | |
* @param {object} [metaObject] The browser identity collection. | |
* @param {number} [metaObject.maxTouchPoints] The maximum number of simultanous touch points. | |
* @returns {boolean} | |
*/ | |
function isIpadOS() { | |
var _ref5 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : navigator, | |
maxTouchPoints = _ref5.maxTouchPoints; | |
return maxTouchPoints > 2 && platforms.mac.value; | |
} | |
/** | |
* @returns {boolean} | |
*/ | |
function isWindowsOS() { | |
return platforms.win.value; | |
} | |
/** | |
* @returns {boolean} | |
*/ | |
function isMacOS() { | |
return platforms.mac.value; | |
} | |
/** | |
* @returns {boolean} | |
*/ | |
function isLinuxOS() { | |
return platforms.linux.value; | |
} | |
/***/ }), | |
/* 106 */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isRecognitionException", function() { return isRecognitionException; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MismatchedTokenException", function() { return MismatchedTokenException; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NoViableAltException", function() { return NoViableAltException; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NotAllInputParsedException", function() { return NotAllInputParsedException; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EarlyExitException", function() { return EarlyExitException; }); | |
/* harmony import */ var _utils_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(49); | |
var MISMATCHED_TOKEN_EXCEPTION = "MismatchedTokenException"; | |
var NO_VIABLE_ALT_EXCEPTION = "NoViableAltException"; | |
var EARLY_EXIT_EXCEPTION = "EarlyExitException"; | |
var NOT_ALL_INPUT_PARSED_EXCEPTION = "NotAllInputParsedException"; | |
var RECOGNITION_EXCEPTION_NAMES = [ | |
MISMATCHED_TOKEN_EXCEPTION, | |
NO_VIABLE_ALT_EXCEPTION, | |
EARLY_EXIT_EXCEPTION, | |
NOT_ALL_INPUT_PARSED_EXCEPTION | |
]; | |
Object.freeze(RECOGNITION_EXCEPTION_NAMES); | |
// hacks to bypass no support for custom Errors in javascript/typescript | |
function isRecognitionException(error) { | |
// can't do instanceof on hacked custom js exceptions | |
return Object(_utils_utils__WEBPACK_IMPORTED_MODULE_0__["contains"])(RECOGNITION_EXCEPTION_NAMES, error.name); | |
} | |
function MismatchedTokenException(message, token, previousToken) { | |
this.name = MISMATCHED_TOKEN_EXCEPTION; | |
this.message = message; | |
this.token = token; | |
this.previousToken = previousToken; | |
this.resyncedTokens = []; | |
} | |
// must use the "Error.prototype" instead of "new Error" | |
// because the stack trace points to where "new Error" was invoked" | |
MismatchedTokenException.prototype = Error.prototype; | |
function NoViableAltException(message, token, previousToken) { | |
this.name = NO_VIABLE_ALT_EXCEPTION; | |
this.message = message; | |
this.token = token; | |
this.previousToken = previousToken; | |
this.resyncedTokens = []; | |
} | |
NoViableAltException.prototype = Error.prototype; | |
function NotAllInputParsedException(message, token) { | |
this.name = NOT_ALL_INPUT_PARSED_EXCEPTION; | |
this.message = message; | |
this.token = token; | |
this.resyncedTokens = []; | |
} | |
NotAllInputParsedException.prototype = Error.prototype; | |
function EarlyExitException(message, token, previousToken) { | |
this.name = EARLY_EXIT_EXCEPTION; | |
this.message = message; | |
this.token = token; | |
this.previousToken = previousToken; | |
this.resyncedTokens = []; | |
} | |
EarlyExitException.prototype = Error.prototype; | |
//# sourceMappingURL=exceptions_public.js.map | |
/***/ }), | |
/* 107 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var $ = __webpack_require__(31); | |
var $trim = __webpack_require__(351).trim; | |
var forcedStringTrimMethod = __webpack_require__(664); | |
// `String.prototype.trim` method | |
// https://tc39.es/ecma262/#sec-string.prototype.trim | |
$({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, { | |
trim: function trim() { | |
return $trim(this); | |
} | |
}); | |
/***/ }), | |
/* 108 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var _interopRequireDefault = __webpack_require__(1); | |
exports.__esModule = true; | |
exports.collection = void 0; | |
exports.default = staticRegister; | |
var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(44)); | |
__webpack_require__(3); | |
__webpack_require__(36); | |
__webpack_require__(0); | |
__webpack_require__(2); | |
__webpack_require__(4); | |
var collection = new Map(); | |
/** | |
* @param {string} namespace The namespace for the storage. | |
* @returns {object} | |
*/ | |
exports.collection = collection; | |
function staticRegister() { | |
var namespace = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'common'; | |
if (!collection.has(namespace)) { | |
collection.set(namespace, new Map()); | |
} | |
var subCollection = collection.get(namespace); | |
/** | |
* Register an item to the collection. If the item under the same was exist earlier then this item will be replaced with new one. | |
* | |
* @param {string} name Identification of the item. | |
* @param {*} item Item to save in the collection. | |
*/ | |
function register(name, item) { | |
subCollection.set(name, item); | |
} | |
/** | |
* Retrieve the item from the collection. | |
* | |
* @param {string} name Identification of the item. | |
* @returns {*} Returns item which was saved in the collection. | |
*/ | |
function getItem(name) { | |
return subCollection.get(name); | |
} | |
/** | |
* Check if item under specified name is exists. | |
* | |
* @param {string} name Identification of the item. | |
* @returns {boolean} Returns `true` or `false` depends on if element exists in the collection. | |
*/ | |
function hasItem(name) { | |
return subCollection.has(name); | |
} | |
/** | |
* Retrieve list of names registered from the collection. | |
* | |
* @returns {Array} Returns an array of strings with all names under which objects are stored. | |
*/ | |
function getNames() { | |
return (0, _toConsumableArray2.default)(subCollection.keys()); | |
} | |
/** | |
* Retrieve all registered values from the collection. | |
* | |
* @returns {Array} Returns an array with all values stored in the collection. | |
*/ | |
function getValues() { | |
return (0, _toConsumableArray2.default)(subCollection.values()); | |
} | |
return { | |
register: register, | |
getItem: getItem, | |
hasItem: hasItem, | |
getNames: getNames, | |
getValues: getValues | |
}; | |
} | |
/***/ }), | |
/* 109 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var classApplyDescriptorGet = __webpack_require__(779); | |
var classExtractFieldDescriptor = __webpack_require__(578); | |
function _classPrivateFieldGet(receiver, privateMap) { | |
var descriptor = classExtractFieldDescriptor(receiver, privateMap, "get"); | |
return classApplyDescriptorGet(receiver, descriptor); | |
} | |
module.exports = _classPrivateFieldGet, module.exports.__esModule = true, module.exports["default"] = module.exports; | |
/***/ }), | |
/* 110 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var classApplyDescriptorSet = __webpack_require__(780); | |
var classExtractFieldDescriptor = __webpack_require__(578); | |
function _classPrivateFieldSet(receiver, privateMap, value) { | |
var descriptor = classExtractFieldDescriptor(receiver, privateMap, "set"); | |
classApplyDescriptorSet(receiver, descriptor, value); | |
return value; | |
} | |
module.exports = _classPrivateFieldSet, module.exports.__esModule = true, module.exports["default"] = module.exports; | |
/***/ }), | |
/* 111 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
exports.__esModule = true; | |
exports.HEADER_TYPE = exports.FILL_TYPE = exports.CUSTOM_SELECTION_TYPE = exports.CELL_TYPE = exports.AREA_TYPE = exports.ACTIVE_HEADER_TYPE = void 0; | |
var ACTIVE_HEADER_TYPE = 'active-header'; | |
exports.ACTIVE_HEADER_TYPE = ACTIVE_HEADER_TYPE; | |
var AREA_TYPE = 'area'; | |
exports.AREA_TYPE = AREA_TYPE; | |
var CELL_TYPE = 'cell'; | |
exports.CELL_TYPE = CELL_TYPE; | |
var FILL_TYPE = 'fill'; | |
exports.FILL_TYPE = FILL_TYPE; | |
var HEADER_TYPE = 'header'; | |
exports.HEADER_TYPE = HEADER_TYPE; | |
var CUSTOM_SELECTION_TYPE = 'custom-selection'; | |
exports.CUSTOM_SELECTION_TYPE = CUSTOM_SELECTION_TYPE; | |
/***/ }), | |
/* 112 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var DESCRIPTORS = __webpack_require__(72); | |
var call = __webpack_require__(78); | |
var propertyIsEnumerableModule = __webpack_require__(199); | |
var createPropertyDescriptor = __webpack_require__(164); | |
var toIndexedObject = __webpack_require__(94); | |
var toPropertyKey = __webpack_require__(200); | |
var hasOwn = __webpack_require__(73); | |
var IE8_DOM_DEFINE = __webpack_require__(323); | |
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe | |
var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; | |
// `Object.getOwnPropertyDescriptor` method | |
// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor | |
exports.f = DESCRIPTORS ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) { | |
O = toIndexedObject(O); | |
P = toPropertyKey(P); | |
if (IE8_DOM_DEFINE) try { | |
return $getOwnPropertyDescriptor(O, P); | |
} catch (error) { /* empty */ } | |
if (hasOwn(O, P)) return createPropertyDescriptor(!call(propertyIsEnumerableModule.f, O, P), O[P]); | |
}; | |
/***/ }), | |
/* 113 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var NATIVE_WEAK_MAP = __webpack_require__(325); | |
var global = __webpack_require__(30); | |
var uncurryThis = __webpack_require__(37); | |
var isObject = __webpack_require__(65); | |
var createNonEnumerableProperty = __webpack_require__(122); | |
var hasOwn = __webpack_require__(73); | |
var shared = __webpack_require__(237); | |
var sharedKey = __webpack_require__(206); | |
var hiddenKeys = __webpack_require__(167); | |
var OBJECT_ALREADY_INITIALIZED = 'Object already initialized'; | |
var TypeError = global.TypeError; | |
var WeakMap = global.WeakMap; | |
var set, get, has; | |
var enforce = function (it) { | |
return has(it) ? get(it) : set(it, {}); | |
}; | |
var getterFor = function (TYPE) { | |
return function (it) { | |
var state; | |
if (!isObject(it) || (state = get(it)).type !== TYPE) { | |
throw TypeError('Incompatible receiver, ' + TYPE + ' required'); | |
} return state; | |
}; | |
}; | |
if (NATIVE_WEAK_MAP || shared.state) { | |
var store = shared.state || (shared.state = new WeakMap()); | |
var wmget = uncurryThis(store.get); | |
var wmhas = uncurryThis(store.has); | |
var wmset = uncurryThis(store.set); | |
set = function (it, metadata) { | |
if (wmhas(store, it)) throw new TypeError(OBJECT_ALREADY_INITIALIZED); | |
metadata.facade = it; | |
wmset(store, it, metadata); | |
return metadata; | |
}; | |
get = function (it) { | |
return wmget(store, it) || {}; | |
}; | |
has = function (it) { | |
return wmhas(store, it); | |
}; | |
} else { | |
var STATE = sharedKey('state'); | |
hiddenKeys[STATE] = true; | |
set = function (it, metadata) { | |
if (hasOwn(it, STATE)) throw new TypeError(OBJECT_ALREADY_INITIALIZED); | |
metadata.facade = it; | |
createNonEnumerableProperty(it, STATE, metadata); | |
return metadata; | |
}; | |
get = function (it) { | |
return hasOwn(it, STATE) ? it[STATE] : {}; | |
}; | |
has = function (it) { | |
return hasOwn(it, STATE); | |
}; | |
} | |
module.exports = { | |
set: set, | |
get: get, | |
has: has, | |
enforce: enforce, | |
getterFor: getterFor | |
}; | |
/***/ }), | |
/* 114 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var $ = __webpack_require__(31); | |
var uncurryThis = __webpack_require__(37); | |
var getOwnPropertyDescriptor = __webpack_require__(112).f; | |
var toLength = __webpack_require__(132); | |
var toString = __webpack_require__(74); | |
var notARegExp = __webpack_require__(247); | |
var requireObjectCoercible = __webpack_require__(91); | |
var correctIsRegExpLogic = __webpack_require__(249); | |
var IS_PURE = __webpack_require__(131); | |
// eslint-disable-next-line es/no-string-prototype-startswith -- safe | |
var un$StartsWith = uncurryThis(''.startsWith); | |
var stringSlice = uncurryThis(''.slice); | |
var min = Math.min; | |
var CORRECT_IS_REGEXP_LOGIC = correctIsRegExpLogic('startsWith'); | |
// https://github.com/zloirock/core-js/pull/702 | |
var MDN_POLYFILL_BUG = !IS_PURE && !CORRECT_IS_REGEXP_LOGIC && !!function () { | |
var descriptor = getOwnPropertyDescriptor(String.prototype, 'startsWith'); | |
return descriptor && !descriptor.writable; | |
}(); | |
// `String.prototype.startsWith` method | |
// https://tc39.es/ecma262/#sec-string.prototype.startswith | |
$({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG && !CORRECT_IS_REGEXP_LOGIC }, { | |
startsWith: function startsWith(searchString /* , position = 0 */) { | |
var that = toString(requireObjectCoercible(this)); | |
notARegExp(searchString); | |
var index = toLength(min(arguments.length > 1 ? arguments[1] : undefined, that.length)); | |
var search = toString(searchString); | |
return un$StartsWith | |
? un$StartsWith(that, search, index) | |
: stringSlice(that, index, index + search.length) === search; | |
} | |
}); | |
/***/ }), | |
/* 115 */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FormulaVertex", function() { return FormulaVertex; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ArrayVertex", function() { return ArrayVertex; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FormulaCellVertex", function() { return FormulaCellVertex; }); | |
/* harmony import */ var core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9); | |
/* harmony import */ var core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_0__); | |
/* harmony import */ var core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(10); | |
/* harmony import */ var core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_1__); | |
/* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(0); | |
/* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_2__); | |
/* harmony import */ var core_js_modules_es_symbol_iterator_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(11); | |
/* harmony import */ var core_js_modules_es_symbol_iterator_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_symbol_iterator_js__WEBPACK_IMPORTED_MODULE_3__); | |
/* harmony import */ var core_js_modules_es_array_iterator_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(3); | |
/* harmony import */ var core_js_modules_es_array_iterator_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_iterator_js__WEBPACK_IMPORTED_MODULE_4__); | |
/* harmony import */ var core_js_modules_es_string_iterator_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(2); | |
/* harmony import */ var core_js_modules_es_string_iterator_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_string_iterator_js__WEBPACK_IMPORTED_MODULE_5__); | |
/* harmony import */ var core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(4); | |
/* harmony import */ var core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_6__); | |
/* harmony import */ var core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(14); | |
/* harmony import */ var core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_7__); | |
/* harmony import */ var core_js_modules_es_function_name_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(26); | |
/* harmony import */ var core_js_modules_es_function_name_js__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_function_name_js__WEBPACK_IMPORTED_MODULE_8__); | |
/* harmony import */ var core_js_modules_es_array_from_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(23); | |
/* harmony import */ var core_js_modules_es_array_from_js__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_from_js__WEBPACK_IMPORTED_MODULE_9__); | |
/* harmony import */ var core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(13); | |
/* harmony import */ var core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_10__); | |
/* harmony import */ var core_js_modules_es_object_get_prototype_of_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(27); | |
/* harmony import */ var core_js_modules_es_object_get_prototype_of_js__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_get_prototype_of_js__WEBPACK_IMPORTED_MODULE_11__); | |
/* harmony import */ var core_js_modules_es_reflect_construct_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(7); | |
/* harmony import */ var core_js_modules_es_reflect_construct_js__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_reflect_construct_js__WEBPACK_IMPORTED_MODULE_12__); | |
/* harmony import */ var _AbsoluteCellRange__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(88); | |
/* harmony import */ var _ArraySize__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(125); | |
/* harmony import */ var _ArrayValue__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(367); | |
/* harmony import */ var _Cell__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(24); | |
/* harmony import */ var _error_message__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(46); | |
/* harmony import */ var _interpreter_InterpreterValue__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(51); | |
/* harmony import */ var _Span__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(182); | |
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | |
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } | |
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | |
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | |
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } | |
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | |
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | |
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | |
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } | |
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } | |
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | |
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } | |
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } | |
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } | |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | |
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | |
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | |
/** | |
* @license | |
* Copyright (c) 2021 Handsoncode. All rights reserved. | |
*/ | |
var FormulaVertex = /*#__PURE__*/function () { | |
function FormulaVertex(formula, cellAddress, version) { | |
_classCallCheck(this, FormulaVertex); | |
this.formula = formula; | |
this.cellAddress = cellAddress; | |
this.version = version; | |
} | |
_createClass(FormulaVertex, [{ | |
key: "width", | |
get: function get() { | |
return 1; | |
} | |
}, { | |
key: "height", | |
get: function get() { | |
return 1; | |
} | |
}, { | |
key: "getFormula", | |
value: | |
/** | |
* Returns formula stored in this vertex | |
*/ | |
function getFormula(updatingService) { | |
this.ensureRecentData(updatingService); | |
return this.formula; | |
} | |
}, { | |
key: "ensureRecentData", | |
value: function ensureRecentData(updatingService) { | |
if (this.version != updatingService.version()) { | |
var _updatingService$appl = updatingService.applyTransformations(this.formula, this.cellAddress, this.version), | |
_updatingService$appl2 = _slicedToArray(_updatingService$appl, 3), | |
newAst = _updatingService$appl2[0], | |
newAddress = _updatingService$appl2[1], | |
newVersion = _updatingService$appl2[2]; | |
this.formula = newAst; | |
this.cellAddress = newAddress; | |
this.version = newVersion; | |
} | |
} | |
/** | |
* Returns address of the cell associated with vertex | |
*/ | |
}, { | |
key: "getAddress", | |
value: function getAddress(updatingService) { | |
this.ensureRecentData(updatingService); | |
return this.cellAddress; | |
} | |
}], [{ | |
key: "fromAst", | |
value: function fromAst(formula, address, size, version) { | |
if (size.isScalar()) { | |
return new FormulaCellVertex(formula, address, version); | |
} else { | |
return new ArrayVertex(formula, address, size, version); | |
} | |
} | |
}]); | |
return FormulaVertex; | |
}(); | |
var ArrayVertex = /*#__PURE__*/function (_FormulaVertex) { | |
_inherits(ArrayVertex, _FormulaVertex); | |
var _super = _createSuper(ArrayVertex); | |
function ArrayVertex(formula, cellAddress, size) { | |
var _this; | |
var version = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0; | |
_classCallCheck(this, ArrayVertex); | |
_this = _super.call(this, formula, cellAddress, version); | |
if (size.isRef) { | |
_this.array = new _ArrayValue__WEBPACK_IMPORTED_MODULE_15__["ErroredArray"](new _Cell__WEBPACK_IMPORTED_MODULE_16__["CellError"](_Cell__WEBPACK_IMPORTED_MODULE_16__["ErrorType"].REF, _error_message__WEBPACK_IMPORTED_MODULE_17__["ErrorMessage"].NoSpaceForArrayResult), _ArraySize__WEBPACK_IMPORTED_MODULE_14__["ArraySize"].error()); | |
} else { | |
_this.array = new _ArrayValue__WEBPACK_IMPORTED_MODULE_15__["NotComputedArray"](size); | |
} | |
return _this; | |
} | |
_createClass(ArrayVertex, [{ | |
key: "width", | |
get: function get() { | |
return this.array.width(); | |
} | |
}, { | |
key: "height", | |
get: function get() { | |
return this.array.height(); | |
} | |
}, { | |
key: "sheet", | |
get: function get() { | |
return this.cellAddress.sheet; | |
} | |
}, { | |
key: "leftCorner", | |
get: function get() { | |
return this.cellAddress; | |
} | |
}, { | |
key: "setCellValue", | |
value: function setCellValue(value) { | |
if (value instanceof _Cell__WEBPACK_IMPORTED_MODULE_16__["CellError"]) { | |
this.setErrorValue(value); | |
return value; | |
} | |
var array = _ArrayValue__WEBPACK_IMPORTED_MODULE_15__["ArrayValue"].fromInterpreterValue(value); | |
array.resize(this.array.size); | |
this.array = array; | |
return value; | |
} | |
}, { | |
key: "getCellValue", | |
value: function getCellValue() { | |
if (this.array instanceof _ArrayValue__WEBPACK_IMPORTED_MODULE_15__["NotComputedArray"]) { | |
throw Error('Array not computed yet.'); | |
} | |
return this.array.simpleRangeValue(); | |
} | |
}, { | |
key: "valueOrUndef", | |
value: function valueOrUndef() { | |
if (this.array instanceof _ArrayValue__WEBPACK_IMPORTED_MODULE_15__["NotComputedArray"]) { | |
return undefined; | |
} | |
return this.array.simpleRangeValue(); | |
} | |
}, { | |
key: "getArrayCellValue", | |
value: function getArrayCellValue(address) { | |
var col = address.col - this.cellAddress.col; | |
var row = address.row - this.cellAddress.row; | |
try { | |
return this.array.get(col, row); | |
} catch (e) { | |
return new _Cell__WEBPACK_IMPORTED_MODULE_16__["CellError"](_Cell__WEBPACK_IMPORTED_MODULE_16__["ErrorType"].REF); | |
} | |
} | |
}, { | |
key: "getArrayCellRawValue", | |
value: function getArrayCellRawValue(address) { | |
var val = this.getArrayCellValue(address); | |
if (val instanceof _Cell__WEBPACK_IMPORTED_MODULE_16__["CellError"] || val === _interpreter_InterpreterValue__WEBPACK_IMPORTED_MODULE_18__["EmptyValue"]) { | |
return undefined; | |
} else { | |
return Object(_interpreter_InterpreterValue__WEBPACK_IMPORTED_MODULE_18__["getRawValue"])(val); | |
} | |
} | |
}, { | |
key: "setArrayCellValue", | |
value: function setArrayCellValue(address, value) { | |
var col = address.col - this.cellAddress.col; | |
var row = address.row - this.cellAddress.row; | |
if (this.array instanceof _ArrayValue__WEBPACK_IMPORTED_MODULE_15__["ArrayValue"]) { | |
this.array.set(col, row, value); | |
} | |
} | |
}, { | |
key: "setNoSpace", | |
value: function setNoSpace() { | |
this.array = new _ArrayValue__WEBPACK_IMPORTED_MODULE_15__["ErroredArray"](new _Cell__WEBPACK_IMPORTED_MODULE_16__["CellError"](_Cell__WEBPACK_IMPORTED_MODULE_16__["ErrorType"].SPILL, _error_message__WEBPACK_IMPORTED_MODULE_17__["ErrorMessage"].NoSpaceForArrayResult), _ArraySize__WEBPACK_IMPORTED_MODULE_14__["ArraySize"].error()); | |
return this.getCellValue(); | |
} | |
}, { | |
key: "getRange", | |
value: function getRange() { | |
return _AbsoluteCellRange__WEBPACK_IMPORTED_MODULE_13__["AbsoluteCellRange"].spanFrom(this.cellAddress, this.width, this.height); | |
} | |
}, { | |
key: "getRangeOrUndef", | |
value: function getRangeOrUndef() { | |
return _AbsoluteCellRange__WEBPACK_IMPORTED_MODULE_13__["AbsoluteCellRange"].spanFromOrUndef(this.cellAddress, this.width, this.height); | |
} | |
}, { | |
key: "setAddress", | |
value: function setAddress(address) { | |
this.cellAddress = address; | |
} | |
}, { | |
key: "setFormula", | |
value: function setFormula(newFormula) { | |
this.formula = newFormula; | |
} | |
}, { | |
key: "spansThroughSheetRows", | |
value: function spansThroughSheetRows(sheet, startRow) { | |
var endRow = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : startRow; | |
return this.cellAddress.sheet === sheet && this.cellAddress.row <= endRow && startRow < this.cellAddress.row + this.height; | |
} | |
}, { | |
key: "spansThroughSheetColumn", | |
value: function spansThroughSheetColumn(sheet, col) { | |
var columnEnd = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : col; | |
return this.cellAddress.sheet === sheet && this.cellAddress.col <= columnEnd && col < this.cellAddress.col + this.width; | |
} | |
}, { | |
key: "isComputed", | |
value: function isComputed() { | |
return !(this.array instanceof _ArrayValue__WEBPACK_IMPORTED_MODULE_15__["NotComputedArray"]); | |
} | |
}, { | |
key: "columnsFromArray", | |
value: function columnsFromArray() { | |
return _Span__WEBPACK_IMPORTED_MODULE_19__["ColumnsSpan"].fromNumberOfColumns(this.cellAddress.sheet, this.cellAddress.col, this.width); | |
} | |
}, { | |
key: "rowsFromArray", | |
value: function rowsFromArray() { | |
return _Span__WEBPACK_IMPORTED_MODULE_19__["RowsSpan"].fromNumberOfRows(this.cellAddress.sheet, this.cellAddress.row, this.height); | |
} | |
/** | |
* No-op as array vertices are transformed eagerly. | |
* */ | |
}, { | |
key: "ensureRecentData", | |
value: function ensureRecentData(_updatingService) {} | |
}, { | |
key: "isLeftCorner", | |
value: function isLeftCorner(address) { | |
return Object(_Cell__WEBPACK_IMPORTED_MODULE_16__["equalSimpleCellAddress"])(this.cellAddress, address); | |
} | |
}, { | |
key: "setErrorValue", | |
value: function setErrorValue(error) { | |
this.array = new _ArrayValue__WEBPACK_IMPORTED_MODULE_15__["ErroredArray"](error, this.array.size); | |
} | |
}]); | |
return ArrayVertex; | |
}(FormulaVertex); | |
/** | |
* Represents vertex which keeps formula | |
*/ | |
var FormulaCellVertex = /*#__PURE__*/function (_FormulaVertex2) { | |
_inherits(FormulaCellVertex, _FormulaVertex2); | |
var _super2 = _createSuper(FormulaCellVertex); | |
function FormulaCellVertex( | |
/** Formula in AST format */ | |
formula, | |
/** Address which this vertex represents */ | |
address, version) { | |
_classCallCheck(this, FormulaCellVertex); | |
return _super2.call(this, formula, address, version); | |
} | |
_createClass(FormulaCellVertex, [{ | |
key: "valueOrUndef", | |
value: function valueOrUndef() { | |
return this.cachedCellValue; | |
} | |
/** | |
* Sets computed cell value stored in this vertex | |
*/ | |
}, { | |
key: "setCellValue", | |
value: function setCellValue(cellValue) { | |
this.cachedCellValue = cellValue; | |
return this.cachedCellValue; | |
} | |
/** | |
* Returns cell value stored in vertex | |
*/ | |
}, { | |
key: "getCellValue", | |
value: function getCellValue() { | |
if (this.cachedCellValue !== undefined) { | |
return this.cachedCellValue; | |
} else { | |
throw Error('Value of the formula cell is not computed.'); | |
} | |
} | |
}, { | |
key: "isComputed", | |
value: function isComputed() { | |
return this.cachedCellValue !== undefined; | |
} | |
}]); | |
return FormulaCellVertex; | |
}(FormulaVertex); | |
/***/ }), | |
/* 116 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
exports.__esModule = true; | |
exports.KEY_CODES = void 0; | |
exports.isCtrlKey = isCtrlKey; | |
exports.isCtrlMetaKey = isCtrlMetaKey; | |
exports.isFunctionKey = isFunctionKey; | |
exports.isKey = isKey; | |
exports.isPrintableChar = isPrintableChar; | |
__webpack_require__(42); | |
__webpack_require__(52); | |
__webpack_require__(13); | |
__webpack_require__(63); | |
var _array = __webpack_require__(20); | |
var _browser = __webpack_require__(105); | |
var KEY_CODES = { | |
ALT: 18, | |
ARROW_DOWN: 40, | |
ARROW_LEFT: 37, | |
ARROW_RIGHT: 39, | |
ARROW_UP: 38, | |
AUDIO_DOWN: (0, _browser.isFirefox)() ? 182 : 174, | |
AUDIO_MUTE: (0, _browser.isFirefox)() ? 181 : 173, | |
AUDIO_UP: (0, _browser.isFirefox)() ? 183 : 175, | |
BACKSPACE: 8, | |
CAPS_LOCK: 20, | |
COMMA: 188, | |
COMMAND_LEFT: 91, | |
COMMAND_RIGHT: 93, | |
COMMAND_FIREFOX: 224, | |
CONTROL: 17, | |
DELETE: 46, | |
END: 35, | |
ENTER: 13, | |
ESCAPE: 27, | |
F1: 112, | |
F2: 113, | |
F3: 114, | |
F4: 115, | |
F5: 116, | |
F6: 117, | |
F7: 118, | |
F8: 119, | |
F9: 120, | |
F10: 121, | |
F11: 122, | |
F12: 123, | |
F13: 124, | |
F14: 125, | |
F15: 126, | |
F16: 127, | |
F17: 128, | |
F18: 129, | |
F19: 130, | |
HOME: 36, | |
INSERT: 45, | |
MEDIA_NEXT: 176, | |
MEDIA_PLAY_PAUSE: 179, | |
MEDIA_PREV: 177, | |
MEDIA_STOP: 178, | |
NULL: 0, | |
NUM_LOCK: 144, | |
PAGE_DOWN: 34, | |
PAGE_UP: 33, | |
PAUSE: 19, | |
PERIOD: 190, | |
SCROLL_LOCK: 145, | |
SHIFT: 16, | |
SPACE: 32, | |
TAB: 9, | |
A: 65, | |
C: 67, | |
D: 68, | |
F: 70, | |
L: 76, | |
O: 79, | |
P: 80, | |
S: 83, | |
V: 86, | |
X: 88, | |
Y: 89, | |
Z: 90 | |
}; | |
exports.KEY_CODES = KEY_CODES; | |
var FUNCTION_KEYS = [KEY_CODES.ALT, KEY_CODES.ARROW_DOWN, KEY_CODES.ARROW_LEFT, KEY_CODES.ARROW_RIGHT, KEY_CODES.ARROW_UP, KEY_CODES.AUDIO_DOWN, KEY_CODES.AUDIO_MUTE, KEY_CODES.AUDIO_UP, KEY_CODES.BACKSPACE, KEY_CODES.CAPS_LOCK, KEY_CODES.DELETE, KEY_CODES.END, KEY_CODES.ENTER, KEY_CODES.ESCAPE, KEY_CODES.F1, KEY_CODES.F2, KEY_CODES.F3, KEY_CODES.F4, KEY_CODES.F5, KEY_CODES.F6, KEY_CODES.F7, KEY_CODES.F8, KEY_CODES.F9, KEY_CODES.F10, KEY_CODES.F11, KEY_CODES.F12, KEY_CODES.F13, KEY_CODES.F14, KEY_CODES.F15, KEY_CODES.F16, KEY_CODES.F17, KEY_CODES.F18, KEY_CODES.F19, KEY_CODES.HOME, KEY_CODES.INSERT, KEY_CODES.MEDIA_NEXT, KEY_CODES.MEDIA_PLAY_PAUSE, KEY_CODES.MEDIA_PREV, KEY_CODES.MEDIA_STOP, KEY_CODES.NULL, KEY_CODES.NUM_LOCK, KEY_CODES.PAGE_DOWN, KEY_CODES.PAGE_UP, KEY_CODES.PAUSE, KEY_CODES.SCROLL_LOCK, KEY_CODES.SHIFT, KEY_CODES.TAB]; | |
/** | |
* Returns true if keyCode represents a printable character. | |
* | |
* @param {number} keyCode The keyboard key code. | |
* @returns {boolean} | |
*/ | |
function isPrintableChar(keyCode) { | |
return keyCode === 32 || // space | |
keyCode >= 48 && keyCode <= 57 || // 0-9 | |
keyCode >= 96 && keyCode <= 111 || // numpad | |
keyCode >= 186 && keyCode <= 192 || // ;=,-./` | |
keyCode >= 219 && keyCode <= 222 || // []{}\|"' | |
keyCode >= 226 || // special chars (229 for Asian chars) | |
keyCode >= 65 && keyCode <= 90; // a-z | |
} | |
/** | |
* @param {number} keyCode The keyboard key code. | |
* @returns {boolean} | |
*/ | |
function isFunctionKey(keyCode) { | |
return FUNCTION_KEYS.includes(keyCode); | |
} | |
/** | |
* Checks if passed key code is ctrl or cmd key. Depends on what OS the code runs it check key code based on | |
* different meta key codes. | |
* | |
* @param {number} keyCode The keyboard key code. | |
* @returns {boolean} | |
*/ | |
function isCtrlKey(keyCode) { | |
var keys = []; | |
if ((0, _browser.isMacOS)()) { | |
keys.push(KEY_CODES.COMMAND_LEFT, KEY_CODES.COMMAND_RIGHT, KEY_CODES.COMMAND_FIREFOX); | |
} else { | |
keys.push(KEY_CODES.CONTROL); | |
} | |
return keys.includes(keyCode); | |
} | |
/** | |
* Checks if passed key code is ctrl or cmd key. This helper checks if the key code matches to meta keys | |
* regardless of the OS on which it is running. | |
* | |
* @param {number} keyCode The keyboard key code. | |
* @returns {boolean} | |
*/ | |
function isCtrlMetaKey(keyCode) { | |
return [KEY_CODES.CONTROL, KEY_CODES.COMMAND_LEFT, KEY_CODES.COMMAND_RIGHT, KEY_CODES.COMMAND_FIREFOX].includes(keyCode); | |
} | |
/** | |
* @param {number} keyCode The keyboard key code. | |
* @param {string} baseCode The list of the key codes to compare with. | |
* @returns {boolean} | |
*/ | |
function isKey(keyCode, baseCode) { | |
var keys = baseCode.split('|'); | |
var result = false; | |
(0, _array.arrayEach)(keys, function (key) { | |
if (keyCode === KEY_CODES[key]) { | |
result = true; | |
return false; | |
} | |
}); | |
return result; | |
} | |
/***/ }), | |
/* 117 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var objectWithoutPropertiesLoose = __webpack_require__(788); | |
function _objectWithoutProperties(source, excluded) { | |
if (source == null) return {}; | |
var target = objectWithoutPropertiesLoose(source, excluded); | |
var key, i; | |
if (Object.getOwnPropertySymbols) { | |
var sourceSymbolKeys = Object.getOwnPropertySymbols(source); | |
for (i = 0; i < sourceSymbolKeys.length; i++) { | |
key = sourceSymbolKeys[i]; | |
if (excluded.indexOf(key) >= 0) continue; | |
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; | |
target[key] = source[key]; | |
} | |
} | |
return target; | |
} | |
module.exports = _objectWithoutProperties, module.exports.__esModule = true, module.exports["default"] = module.exports; | |
/***/ }), | |
/* 118 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
__webpack_require__(3); | |
__webpack_require__(0); | |
__webpack_require__(2); | |
__webpack_require__(12); | |
__webpack_require__(4); | |
__webpack_require__(19); | |
var _interopRequireDefault = __webpack_require__(1); | |
var _typeof = __webpack_require__(22); | |
exports.__esModule = true; | |
exports.UNDO = exports.SEPARATOR = exports.ROW_BELOW = exports.ROW_ABOVE = exports.REMOVE_ROW = exports.REMOVE_COLUMN = exports.REDO = exports.READ_ONLY = exports.NO_ITEMS = exports.ITEMS = exports.COLUMN_RIGHT = exports.COLUMN_LEFT = exports.CLEAR_COLUMN = exports.ALIGNMENT = void 0; | |
exports.addItem = addItem; | |
exports.predefinedItems = predefinedItems; | |
__webpack_require__(33); | |
var _defineProperty2 = _interopRequireDefault(__webpack_require__(45)); | |
var _object = __webpack_require__(18); | |
var _alignment = _interopRequireWildcard(__webpack_require__(897)); | |
exports.ALIGNMENT = _alignment.KEY; | |
var _clearColumn = _interopRequireWildcard(__webpack_require__(898)); | |
exports.CLEAR_COLUMN = _clearColumn.KEY; | |
var _columnLeft = _interopRequireWildcard(__webpack_require__(899)); | |
exports.COLUMN_LEFT = _columnLeft.KEY; | |
var _columnRight = _interopRequireWildcard(__webpack_require__(900)); | |
exports.COLUMN_RIGHT = _columnRight.KEY; | |
var _readOnly = _interopRequireWildcard(__webpack_require__(901)); | |
exports.READ_ONLY = _readOnly.KEY; | |
var _redo = _interopRequireWildcard(__webpack_require__(902)); | |
exports.REDO = _redo.KEY; | |
var _removeColumn = _interopRequireWildcard(__webpack_require__(903)); | |
exports.REMOVE_COLUMN = _removeColumn.KEY; | |
var _removeRow = _interopRequireWildcard(__webpack_require__(904)); | |
exports.REMOVE_ROW = _removeRow.KEY; | |
var _rowAbove = _interopRequireWildcard(__webpack_require__(905)); | |
exports.ROW_ABOVE = _rowAbove.KEY; | |
var _rowBelow = _interopRequireWildcard(__webpack_require__(906)); | |
exports.ROW_BELOW = _rowBelow.KEY; | |
var _separator = _interopRequireWildcard(__webpack_require__(313)); | |
exports.SEPARATOR = _separator.KEY; | |
var _noItems = _interopRequireWildcard(__webpack_require__(907)); | |
exports.NO_ITEMS = _noItems.KEY; | |
var _undo = _interopRequireWildcard(__webpack_require__(908)); | |
exports.UNDO = _undo.KEY; | |
var _predefinedItems2; | |
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | |
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | |
var ITEMS = [_rowAbove.KEY, _rowBelow.KEY, _columnLeft.KEY, _columnRight.KEY, _clearColumn.KEY, _removeRow.KEY, _removeColumn.KEY, _undo.KEY, _redo.KEY, _readOnly.KEY, _alignment.KEY, _separator.KEY, _noItems.KEY]; | |
exports.ITEMS = ITEMS; | |
var _predefinedItems = (_predefinedItems2 = {}, (0, _defineProperty2.default)(_predefinedItems2, _separator.KEY, _separator.default), (0, _defineProperty2.default)(_predefinedItems2, _noItems.KEY, _noItems.default), (0, _defineProperty2.default)(_predefinedItems2, _rowAbove.KEY, _rowAbove.default), (0, _defineProperty2.default)(_predefinedItems2, _rowBelow.KEY, _rowBelow.default), (0, _defineProperty2.default)(_predefinedItems2, _columnLeft.KEY, _columnLeft.default), (0, _defineProperty2.default)(_predefinedItems2, _columnRight.KEY, _columnRight.default), (0, _defineProperty2.default)(_predefinedItems2, _clearColumn.KEY, _clearColumn.default), (0, _defineProperty2.default)(_predefinedItems2, _removeRow.KEY, _removeRow.default), (0, _defineProperty2.default)(_predefinedItems2, _removeColumn.KEY, _removeColumn.default), (0, _defineProperty2.default)(_predefinedItems2, _undo.KEY, _undo.default), (0, _defineProperty2.default)(_predefinedItems2, _redo.KEY, _redo.default), (0, _defineProperty2.default)(_predefinedItems2, _readOnly.KEY, _readOnly.default), (0, _defineProperty2.default)(_predefinedItems2, _alignment.KEY, _alignment.default), _predefinedItems2); | |
/** | |
* Gets new object with all predefined menu items. | |
* | |
* @returns {object} | |
*/ | |
function predefinedItems() { | |
var items = {}; | |
(0, _object.objectEach)(_predefinedItems, function (itemFactory, key) { | |
items[key] = itemFactory(); | |
}); | |
return items; | |
} | |
/** | |
* Add new predefined menu item to the collection. | |
* | |
* @param {string} key Menu command id. | |
* @param {object} item Object command descriptor. | |
*/ | |
function addItem(key, item) { | |
if (ITEMS.indexOf(key) === -1) { | |
_predefinedItems[key] = item; | |
} | |
} | |
/***/ }), | |
/* 119 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var uncurryThis = __webpack_require__(37); | |
var toString = uncurryThis({}.toString); | |
var stringSlice = uncurryThis(''.slice); | |
module.exports = function (it) { | |
return stringSlice(toString(it), 8, -1); | |
}; | |
/***/ }), | |
/* 120 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var global = __webpack_require__(30); | |
var isCallable = __webpack_require__(61); | |
var aFunction = function (argument) { | |
return isCallable(argument) ? argument : undefined; | |
}; | |
module.exports = function (namespace, method) { | |
return arguments.length < 2 ? aFunction(global[namespace]) : global[namespace] && global[namespace][method]; | |
}; | |
/***/ }), | |
/* 121 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var uncurryThis = __webpack_require__(37); | |
module.exports = uncurryThis({}.isPrototypeOf); | |
/***/ }), | |
/* 122 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var DESCRIPTORS = __webpack_require__(72); | |
var definePropertyModule = __webpack_require__(86); | |
var createPropertyDescriptor = __webpack_require__(164); | |
module.exports = DESCRIPTORS ? function (object, key, value) { | |
return definePropertyModule.f(object, key, createPropertyDescriptor(1, value)); | |
} : function (object, key, value) { | |
object[key] = value; | |
return object; | |
}; | |
/***/ }), | |
/* 123 */ | |
/***/ (function(module, exports) { | |
var ceil = Math.ceil; | |
var floor = Math.floor; | |
// `ToIntegerOrInfinity` abstract operation | |
// https://tc39.es/ecma262/#sec-tointegerorinfinity | |
module.exports = function (argument) { | |
var number = +argument; | |
// eslint-disable-next-line no-self-compare -- safe | |
return number !== number || number === 0 ? 0 : (number > 0 ? floor : ceil)(number); | |
}; | |
/***/ }), | |
/* 124 */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony import */ var _DependencyGraph__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(345); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DependencyGraph", function() { return _DependencyGraph__WEBPACK_IMPORTED_MODULE_0__["DependencyGraph"]; }); | |
/* harmony import */ var _AddressMapping_AddressMapping__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(274); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AddressMapping", function() { return _AddressMapping_AddressMapping__WEBPACK_IMPORTED_MODULE_1__["AddressMapping"]; }); | |
/* harmony import */ var _Graph__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(277); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Graph", function() { return _Graph__WEBPACK_IMPORTED_MODULE_2__["Graph"]; }); | |
/* harmony import */ var _RangeMapping__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(278); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "RangeMapping", function() { return _RangeMapping__WEBPACK_IMPORTED_MODULE_3__["RangeMapping"]; }); | |
/* harmony import */ var _SheetMapping__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(279); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SheetMapping", function() { return _SheetMapping__WEBPACK_IMPORTED_MODULE_4__["SheetMapping"]; }); | |
/* harmony import */ var _ArrayMapping__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(275); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ArrayMapping", function() { return _ArrayMapping__WEBPACK_IMPORTED_MODULE_5__["ArrayMapping"]; }); | |
/* harmony import */ var _FormulaCellVertex__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(115); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FormulaCellVertex", function() { return _FormulaCellVertex__WEBPACK_IMPORTED_MODULE_6__["FormulaCellVertex"]; }); | |
/* harmony import */ var _EmptyCellVertex__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(369); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "EmptyCellVertex", function() { return _EmptyCellVertex__WEBPACK_IMPORTED_MODULE_7__["EmptyCellVertex"]; }); | |
/* harmony import */ var _ValueCellVertex__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(370); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ValueCellVertex", function() { return _ValueCellVertex__WEBPACK_IMPORTED_MODULE_8__["ValueCellVertex"]; }); | |
/* harmony import */ var _ParsingErrorVertex__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(371); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ParsingErrorVertex", function() { return _ParsingErrorVertex__WEBPACK_IMPORTED_MODULE_9__["ParsingErrorVertex"]; }); | |
/* harmony import */ var _RangeVertex__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(276); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "RangeVertex", function() { return _RangeVertex__WEBPACK_IMPORTED_MODULE_10__["RangeVertex"]; }); | |
/* harmony import */ var _AddressMapping_SparseStrategy__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(282); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SparseStrategy", function() { return _AddressMapping_SparseStrategy__WEBPACK_IMPORTED_MODULE_11__["SparseStrategy"]; }); | |
/* harmony import */ var _AddressMapping_DenseStrategy__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(283); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DenseStrategy", function() { return _AddressMapping_DenseStrategy__WEBPACK_IMPORTED_MODULE_12__["DenseStrategy"]; }); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ArrayVertex", function() { return _FormulaCellVertex__WEBPACK_IMPORTED_MODULE_6__["ArrayVertex"]; }); | |
/** | |
* @license | |
* Copyright (c) 2021 Handsoncode. All rights reserved. | |
*/ | |
/***/ }), | |
/* 125 */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ArraySize", function() { return ArraySize; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ArraySizePredictor", function() { return ArraySizePredictor; }); | |
/* harmony import */ var core_js_modules_es_array_reduce_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(100); | |
/* harmony import */ var core_js_modules_es_array_reduce_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_reduce_js__WEBPACK_IMPORTED_MODULE_0__); | |
/* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(0); | |
/* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_1__); | |
/* harmony import */ var core_js_modules_es_array_map_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(38); | |
/* harmony import */ var core_js_modules_es_array_map_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_map_js__WEBPACK_IMPORTED_MODULE_2__); | |
/* harmony import */ var core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(14); | |
/* harmony import */ var core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_3__); | |
/* harmony import */ var core_js_modules_es_function_name_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(26); | |
/* harmony import */ var core_js_modules_es_function_name_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_function_name_js__WEBPACK_IMPORTED_MODULE_4__); | |
/* harmony import */ var core_js_modules_es_array_from_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(23); | |
/* harmony import */ var core_js_modules_es_array_from_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_from_js__WEBPACK_IMPORTED_MODULE_5__); | |
/* harmony import */ var core_js_modules_es_string_iterator_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(2); | |
/* harmony import */ var core_js_modules_es_string_iterator_js__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_string_iterator_js__WEBPACK_IMPORTED_MODULE_6__); | |
/* harmony import */ var core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(13); | |
/* harmony import */ var core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_7__); | |
/* harmony import */ var core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(9); | |
/* harmony import */ var core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_8__); | |
/* harmony import */ var core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(10); | |
/* harmony import */ var core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_9__); | |
/* harmony import */ var core_js_modules_es_symbol_iterator_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(11); | |
/* harmony import */ var core_js_modules_es_symbol_iterator_js__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_symbol_iterator_js__WEBPACK_IMPORTED_MODULE_10__); | |
/* harmony import */ var core_js_modules_es_array_iterator_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(3); | |
/* harmony import */ var core_js_modules_es_array_iterator_js__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_iterator_js__WEBPACK_IMPORTED_MODULE_11__); | |
/* harmony import */ var core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(4); | |
/* harmony import */ var core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_12__); | |
/* harmony import */ var _AbsoluteCellRange__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(88); | |
/* harmony import */ var _interpreter_InterpreterState__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(183); | |
/* harmony import */ var _interpreter_plugin_FunctionPlugin__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(39); | |
/* harmony import */ var _parser__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(70); | |
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } | |
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } | |
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } | |
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } | |
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } | |
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | |
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } | |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | |
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | |
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | |
/** | |
* @license | |
* Copyright (c) 2021 Handsoncode. All rights reserved. | |
*/ | |
var ArraySize = /*#__PURE__*/function () { | |
function ArraySize(width, height) { | |
var isRef = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; | |
_classCallCheck(this, ArraySize); | |
this.width = width; | |
this.height = height; | |
this.isRef = isRef; | |
if (width <= 0 || height <= 0) { | |
throw Error('Incorrect array size'); | |
} | |
} | |
_createClass(ArraySize, [{ | |
key: "isScalar", | |
value: function isScalar() { | |
return this.width <= 1 && this.height <= 1 || this.isRef; | |
} | |
}], [{ | |
key: "fromArray", | |
value: function fromArray(array) { | |
return new ArraySize(array.length > 0 ? array[0].length : 0, array.length); | |
} | |
}, { | |
key: "error", | |
value: function error() { | |
return new ArraySize(1, 1, true); | |
} | |
}, { | |
key: "scalar", | |
value: function scalar() { | |
return new ArraySize(1, 1, false); | |
} | |
}]); | |
return ArraySize; | |
}(); | |
function arraySizeForBinaryOp(leftArraySize, rightArraySize) { | |
return new ArraySize(Math.max(leftArraySize.width, rightArraySize.width), Math.max(leftArraySize.height, rightArraySize.height)); | |
} | |
function arraySizeForUnaryOp(arraySize) { | |
return new ArraySize(arraySize.width, arraySize.height); | |
} | |
var ArraySizePredictor = /*#__PURE__*/function () { | |
function ArraySizePredictor(config, functionRegistry) { | |
_classCallCheck(this, ArraySizePredictor); | |
this.config = config; | |
this.functionRegistry = functionRegistry; | |
} | |
_createClass(ArraySizePredictor, [{ | |
key: "checkArraySize", | |
value: function checkArraySize(ast, formulaAddress) { | |
return this.checkArraySizeForAst(ast, { | |
formulaAddress: formulaAddress, | |
arraysFlag: this.config.useArrayArithmetic | |
}); | |
} | |
}, { | |
key: "checkArraySizeForAst", | |
value: function checkArraySizeForAst(ast, state) { | |
var _this = this; | |
switch (ast.type) { | |
case _parser__WEBPACK_IMPORTED_MODULE_16__["AstNodeType"].FUNCTION_CALL: | |
{ | |
return this.checkArraySizeForFunction(ast, state); | |
} | |
case _parser__WEBPACK_IMPORTED_MODULE_16__["AstNodeType"].COLUMN_RANGE: | |
case _parser__WEBPACK_IMPORTED_MODULE_16__["AstNodeType"].ROW_RANGE: | |
case _parser__WEBPACK_IMPORTED_MODULE_16__["AstNodeType"].CELL_RANGE: | |
{ | |
var range = _AbsoluteCellRange__WEBPACK_IMPORTED_MODULE_13__["AbsoluteCellRange"].fromAstOrUndef(ast, state.formulaAddress); | |
if (range === undefined) { | |
return ArraySize.error(); | |
} else { | |
return new ArraySize(range.width(), range.height(), true); | |
} | |
} | |
case _parser__WEBPACK_IMPORTED_MODULE_16__["AstNodeType"].ARRAY: | |
{ | |
var heights = []; | |
var widths = []; | |
var _iterator = _createForOfIteratorHelper(ast.args), | |
_step; | |
try { | |
for (_iterator.s(); !(_step = _iterator.n()).done;) { | |
var row = _step.value; | |
var sizes = row.map(function (ast) { | |
return _this.checkArraySizeForAst(ast, state); | |
}); | |
var h = Math.min.apply(Math, _toConsumableArray(sizes.map(function (size) { | |
return size.height; | |
}))); | |
var w = sizes.reduce(function (total, size) { | |
return total + size.width; | |
}, 0); | |
heights.push(h); | |
widths.push(w); | |
} | |
} catch (err) { | |
_iterator.e(err); | |
} finally { | |
_iterator.f(); | |
} | |
var height = heights.reduce(function (total, h) { | |
return total + h; | |
}, 0); | |
var width = Math.min.apply(Math, widths); | |
return new ArraySize(width, height); | |
} | |
case _parser__WEBPACK_IMPORTED_MODULE_16__["AstNodeType"].STRING: | |
case _parser__WEBPACK_IMPORTED_MODULE_16__["AstNodeType"].NUMBER: | |
return ArraySize.scalar(); | |
case _parser__WEBPACK_IMPORTED_MODULE_16__["AstNodeType"].CELL_REFERENCE: | |
return new ArraySize(1, 1, true); | |
case _parser__WEBPACK_IMPORTED_MODULE_16__["AstNodeType"].DIV_OP: | |
case _parser__WEBPACK_IMPORTED_MODULE_16__["AstNodeType"].CONCATENATE_OP: | |
case _parser__WEBPACK_IMPORTED_MODULE_16__["AstNodeType"].EQUALS_OP: | |
case _parser__WEBPACK_IMPORTED_MODULE_16__["AstNodeType"].GREATER_THAN_OP: | |
case _parser__WEBPACK_IMPORTED_MODULE_16__["AstNodeType"].GREATER_THAN_OR_EQUAL_OP: | |
case _parser__WEBPACK_IMPORTED_MODULE_16__["AstNodeType"].LESS_THAN_OP: | |
case _parser__WEBPACK_IMPORTED_MODULE_16__["AstNodeType"].LESS_THAN_OR_EQUAL_OP: | |
case _parser__WEBPACK_IMPORTED_MODULE_16__["AstNodeType"].MINUS_OP: | |
case _parser__WEBPACK_IMPORTED_MODULE_16__["AstNodeType"].NOT_EQUAL_OP: | |
case _parser__WEBPACK_IMPORTED_MODULE_16__["AstNodeType"].PLUS_OP: | |
case _parser__WEBPACK_IMPORTED_MODULE_16__["AstNodeType"].POWER_OP: | |
case _parser__WEBPACK_IMPORTED_MODULE_16__["AstNodeType"].TIMES_OP: | |
{ | |
var left = this.checkArraySizeForAst(ast.left, state); | |
var right = this.checkArraySizeForAst(ast.right, state); | |
if (!state.arraysFlag && (left.height > 1 || left.width > 1 || right.height > 1 || right.width > 1)) { | |
return ArraySize.error(); | |
} | |
return arraySizeForBinaryOp(left, right); | |
} | |
case _parser__WEBPACK_IMPORTED_MODULE_16__["AstNodeType"].MINUS_UNARY_OP: | |
case _parser__WEBPACK_IMPORTED_MODULE_16__["AstNodeType"].PLUS_UNARY_OP: | |
case _parser__WEBPACK_IMPORTED_MODULE_16__["AstNodeType"].PERCENT_OP: | |
{ | |
var val = this.checkArraySizeForAst(ast.value, state); | |
if (!state.arraysFlag && (val.height > 1 || val.width > 1)) { | |
return ArraySize.error(); | |
} | |
return arraySizeForUnaryOp(val); | |
} | |
case _parser__WEBPACK_IMPORTED_MODULE_16__["AstNodeType"].PARENTHESIS: | |
{ | |
return this.checkArraySizeForAst(ast.expression, state); | |
} | |
case _parser__WEBPACK_IMPORTED_MODULE_16__["AstNodeType"].EMPTY: | |
return ArraySize.error(); | |
default: | |
return ArraySize.error(); | |
} | |
} | |
}, { | |
key: "checkArraySizeForFunction", | |
value: function checkArraySizeForFunction(ast, state) { | |
var _this2 = this; | |
var metadata = this.functionRegistry.getMetadata(ast.procedureName); | |
var pluginArraySizeFunction = this.functionRegistry.getArraySizeFunction(ast.procedureName); | |
if (pluginArraySizeFunction !== undefined) { | |
return pluginArraySizeFunction(ast, state); | |
} | |
var subChecks = ast.args.map(function (arg) { | |
var _a; | |
return _this2.checkArraySizeForAst(arg, new _interpreter_InterpreterState__WEBPACK_IMPORTED_MODULE_14__["InterpreterState"](state.formulaAddress, state.arraysFlag || ((_a = metadata === null || metadata === void 0 ? void 0 : metadata.arrayFunction) !== null && _a !== void 0 ? _a : false))); | |
}); | |
if (metadata === undefined || metadata.expandRanges || !state.arraysFlag || metadata.vectorizationForbidden || metadata.parameters === undefined) { | |
return new ArraySize(1, 1); | |
} | |
var argumentDefinitions = _toConsumableArray(metadata.parameters); | |
if (metadata.repeatLastArgs === undefined && argumentDefinitions.length < subChecks.length) { | |
return ArraySize.error(); | |
} | |
if (metadata.repeatLastArgs !== undefined && argumentDefinitions.length < subChecks.length && (subChecks.length - argumentDefinitions.length) % metadata.repeatLastArgs !== 0) { | |
return ArraySize.error(); | |
} | |
while (argumentDefinitions.length < subChecks.length) { | |
argumentDefinitions.push.apply(argumentDefinitions, _toConsumableArray(argumentDefinitions.slice(argumentDefinitions.length - metadata.repeatLastArgs))); | |
} | |
var maxWidth = 1; | |
var maxHeight = 1; | |
for (var i = 0; i < subChecks.length; i++) { | |
if (argumentDefinitions[i].argumentType !== _interpreter_plugin_FunctionPlugin__WEBPACK_IMPORTED_MODULE_15__["ArgumentTypes"].RANGE && argumentDefinitions[i].argumentType !== _interpreter_plugin_FunctionPlugin__WEBPACK_IMPORTED_MODULE_15__["ArgumentTypes"].ANY) { | |
maxHeight = Math.max(maxHeight, subChecks[i].height); | |
maxWidth = Math.max(maxWidth, subChecks[i].width); | |
} | |
} | |
return new ArraySize(maxWidth, maxHeight); | |
} | |
}]); | |
return ArraySizePredictor; | |
}(); | |
/***/ }), | |
/* 126 */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony import */ var _EmptyStatistics__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(366); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "EmptyStatistics", function() { return _EmptyStatistics__WEBPACK_IMPORTED_MODULE_0__["EmptyStatistics"]; }); | |
/* harmony import */ var _Statistics__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(272); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Statistics", function() { return _Statistics__WEBPACK_IMPORTED_MODULE_1__["Statistics"]; }); | |
/* harmony import */ var _StatType__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(273); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "StatType", function() { return _StatType__WEBPACK_IMPORTED_MODULE_2__["StatType"]; }); | |
/** | |
* @license | |
* Copyright (c) 2021 Handsoncode. All rights reserved. | |
*/ | |
/***/ }), | |
/* 127 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var _interopRequireDefault = __webpack_require__(1); | |
exports.__esModule = true; | |
exports.cancelAnimationFrame = cancelAnimationFrame; | |
exports.getComparisonFunction = getComparisonFunction; | |
exports.hasCaptionProblem = hasCaptionProblem; | |
exports.isClassListSupported = isClassListSupported; | |
exports.isGetComputedStyleSupported = isGetComputedStyleSupported; | |
exports.isPassiveEventSupported = isPassiveEventSupported; | |
exports.isTextContentSupported = isTextContentSupported; | |
exports.isTouchSupported = isTouchSupported; | |
exports.requestAnimationFrame = requestAnimationFrame; | |
var _typeof2 = _interopRequireDefault(__webpack_require__(22)); | |
__webpack_require__(77); | |
// https://gist.github.com/paulirish/1579671 | |
/* eslint-disable no-restricted-globals */ | |
var lastTime = 0; | |
var vendors = ['ms', 'moz', 'webkit', 'o']; | |
var _requestAnimationFrame = window.requestAnimationFrame; | |
var _cancelAnimationFrame = window.cancelAnimationFrame; | |
for (var x = 0; x < vendors.length && !_requestAnimationFrame; ++x) { | |
_requestAnimationFrame = window["".concat(vendors[x], "RequestAnimationFrame")]; | |
_cancelAnimationFrame = window["".concat(vendors[x], "CancelAnimationFrame")] || window["".concat(vendors[x], "CancelRequestAnimationFrame")]; | |
} | |
if (!_requestAnimationFrame) { | |
_requestAnimationFrame = function _requestAnimationFrame(callback) { | |
var currTime = new Date().getTime(); | |
var timeToCall = Math.max(0, 16 - (currTime - lastTime)); | |
var id = window.setTimeout(function () { | |
callback(currTime + timeToCall); | |
}, timeToCall); | |
lastTime = currTime + timeToCall; | |
return id; | |
}; | |
} | |
if (!_cancelAnimationFrame) { | |
_cancelAnimationFrame = function _cancelAnimationFrame(id) { | |
clearTimeout(id); | |
}; | |
} | |
/** | |
* Polyfill for requestAnimationFrame. | |
* | |
* @param {Function} callback The function to call when it's time. | |
* @returns {number} | |
*/ | |
function requestAnimationFrame(callback) { | |
return _requestAnimationFrame.call(window, callback); | |
} | |
/** | |
* @returns {boolean} | |
*/ | |
function isClassListSupported() { | |
return !!document.documentElement.classList; | |
} | |
/** | |
* @returns {boolean} | |
*/ | |
function isTextContentSupported() { | |
return !!document.createTextNode('test').textContent; | |
} | |
/** | |
* @returns {boolean} | |
*/ | |
function isGetComputedStyleSupported() { | |
return !!window.getComputedStyle; | |
} | |
/** | |
* Polyfill for cancelAnimationFrame. | |
* | |
* @param {number} id The request Id, generated by `requestAnimationFrame`. | |
*/ | |
function cancelAnimationFrame(id) { | |
_cancelAnimationFrame.call(window, id); | |
} | |
/** | |
* @returns {boolean} | |
*/ | |
function isTouchSupported() { | |
return 'ontouchstart' in window; | |
} | |
var _hasCaptionProblem; | |
/** | |
* | |
*/ | |
function detectCaptionProblem() { | |
var TABLE = document.createElement('TABLE'); | |
TABLE.style.borderSpacing = '0'; | |
TABLE.style.borderWidth = '0'; | |
TABLE.style.padding = '0'; | |
var TBODY = document.createElement('TBODY'); | |
TABLE.appendChild(TBODY); | |
TBODY.appendChild(document.createElement('TR')); | |
TBODY.firstChild.appendChild(document.createElement('TD')); | |
TBODY.firstChild.firstChild.innerHTML = '<tr><td>t<br>t</td></tr>'; | |
var CAPTION = document.createElement('CAPTION'); | |
CAPTION.innerHTML = 'c<br>c<br>c<br>c'; | |
CAPTION.style.padding = '0'; | |
CAPTION.style.margin = '0'; | |
TABLE.insertBefore(CAPTION, TBODY); | |
document.body.appendChild(TABLE); | |
_hasCaptionProblem = TABLE.offsetHeight < 2 * TABLE.lastChild.offsetHeight; // boolean | |
document.body.removeChild(TABLE); | |
} | |
/** | |
* @returns {boolean} | |
*/ | |
function hasCaptionProblem() { | |
if (_hasCaptionProblem === void 0) { | |
detectCaptionProblem(); | |
} | |
return _hasCaptionProblem; | |
} | |
var comparisonFunction; | |
/** | |
* Get string comparison function for sorting purposes. It supports multilingual string comparison base on Internationalization API. | |
* | |
* @param {string} [language] The language code used for phrases sorting. | |
* @param {object} [options] Additional options for sort comparator. | |
* @returns {*} | |
*/ | |
function getComparisonFunction(language) { | |
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | |
if (comparisonFunction) { | |
return comparisonFunction; | |
} | |
if ((typeof Intl === "undefined" ? "undefined" : (0, _typeof2.default)(Intl)) === 'object') { | |
comparisonFunction = new Intl.Collator(language, options).compare; | |
} else if (typeof String.prototype.localeCompare === 'function') { | |
comparisonFunction = function comparisonFunction(a, b) { | |
return "".concat(a).localeCompare(b); | |
}; | |
} else { | |
comparisonFunction = function comparisonFunction(a, b) { | |
if (a === b) { | |
return 0; | |
} | |
return a > b ? -1 : 1; | |
}; | |
} | |
return comparisonFunction; | |
} | |
var passiveSupported; | |
/** | |
* Checks if browser supports passive events. | |
* | |
* @returns {boolean} | |
*/ | |
function isPassiveEventSupported() { | |
if (passiveSupported !== void 0) { | |
return passiveSupported; | |
} | |
try { | |
var options = { | |
get passive() { | |
passiveSupported = true; | |
} | |
}; // eslint-disable-next-line no-restricted-globals | |
window.addEventListener('test', options, options); // eslint-disable-next-line no-restricted-globals | |
window.removeEventListener('test', options, options); | |
} catch (err) { | |
passiveSupported = false; | |
} | |
return passiveSupported; | |
} | |
/***/ }), | |
/* 128 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
__webpack_require__(76); | |
exports.__esModule = true; | |
var _registry = __webpack_require__(607); | |
exports.registerRootComparator = _registry.registerRootComparator; | |
exports.getRootComparator = _registry.getRootComparator; | |
exports.getCompareFunctionFactory = _registry.getCompareFunctionFactory; | |
var _engine = __webpack_require__(884); | |
exports.FIRST_AFTER_SECOND = _engine.FIRST_AFTER_SECOND; | |
exports.FIRST_BEFORE_SECOND = _engine.FIRST_BEFORE_SECOND; | |
exports.DO_NOT_SWAP = _engine.DO_NOT_SWAP; | |
exports.sort = _engine.sort; | |
/***/ }), | |
/* 129 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var getBuiltIn = __webpack_require__(120); | |
module.exports = getBuiltIn('navigator', 'userAgent') || ''; | |
/***/ }), | |
/* 130 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var aCallable = __webpack_require__(149); | |
// `GetMethod` abstract operation | |
// https://tc39.es/ecma262/#sec-getmethod | |
module.exports = function (V, P) { | |
var func = V[P]; | |
return func == null ? undefined : aCallable(func); | |
}; | |
/***/ }), | |
/* 131 */ | |
/***/ (function(module, exports) { | |
module.exports = false; | |
/***/ }), | |
/* 132 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var toIntegerOrInfinity = __webpack_require__(123); | |
var min = Math.min; | |
// `ToLength` abstract operation | |
// https://tc39.es/ecma262/#sec-tolength | |
module.exports = function (argument) { | |
return argument > 0 ? min(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991 | |
}; | |
/***/ }), | |
/* 133 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var NATIVE_BIND = __webpack_require__(163); | |
var FunctionPrototype = Function.prototype; | |
var apply = FunctionPrototype.apply; | |
var call = FunctionPrototype.call; | |
// eslint-disable-next-line es/no-reflect -- safe | |
module.exports = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND ? call.bind(apply) : function () { | |
return call.apply(apply, arguments); | |
}); | |
/***/ }), | |
/* 134 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
/* global ActiveXObject -- old IE, WSH */ | |
var anObject = __webpack_require__(66); | |
var definePropertiesModule = __webpack_require__(331); | |
var enumBugKeys = __webpack_require__(241); | |
var hiddenKeys = __webpack_require__(167); | |
var html = __webpack_require__(332); | |
var documentCreateElement = __webpack_require__(205); | |
var sharedKey = __webpack_require__(206); | |
var GT = '>'; | |
var LT = '<'; | |
var PROTOTYPE = 'prototype'; | |
var SCRIPT = 'script'; | |
var IE_PROTO = sharedKey('IE_PROTO'); | |
var EmptyConstructor = function () { /* empty */ }; | |
var scriptTag = function (content) { | |
return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT; | |
}; | |
// Create object with fake `null` prototype: use ActiveX Object with cleared prototype | |
var NullProtoObjectViaActiveX = function (activeXDocument) { | |
activeXDocument.write(scriptTag('')); | |
activeXDocument.close(); | |
var temp = activeXDocument.parentWindow.Object; | |
activeXDocument = null; // avoid memory leak | |
return temp; | |
}; | |
// Create object with fake `null` prototype: use iframe Object with cleared prototype | |
var NullProtoObjectViaIFrame = function () { | |
// Thrash, waste and sodomy: IE GC bug | |
var iframe = documentCreateElement('iframe'); | |
var JS = 'java' + SCRIPT + ':'; | |
var iframeDocument; | |
iframe.style.display = 'none'; | |
html.appendChild(iframe); | |
// https://github.com/zloirock/core-js/issues/475 | |
iframe.src = String(JS); | |
iframeDocument = iframe.contentWindow.document; | |
iframeDocument.open(); | |
iframeDocument.write(scriptTag('document.F=Object')); | |
iframeDocument.close(); | |
return iframeDocument.F; | |
}; | |
// Check for document.domain and active x support | |
// No need to use active x approach when document.domain is not set | |
// see https://github.com/es-shims/es5-shim/issues/150 | |
// variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346 | |
// avoid IE GC bug | |
var activeXDocument; | |
var NullProtoObject = function () { | |
try { | |
activeXDocument = new ActiveXObject('htmlfile'); | |
} catch (error) { /* ignore */ } | |
NullProtoObject = typeof document != 'undefined' | |
? document.domain && activeXDocument | |
? NullProtoObjectViaActiveX(activeXDocument) // old IE | |
: NullProtoObjectViaIFrame() | |
: NullProtoObjectViaActiveX(activeXDocument); // WSH | |
var length = enumBugKeys.length; | |
while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]]; | |
return NullProtoObject(); | |
}; | |
hiddenKeys[IE_PROTO] = true; | |
// `Object.create` method | |
// https://tc39.es/ecma262/#sec-object.create | |
module.exports = Object.create || function create(O, Properties) { | |
var result; | |
if (O !== null) { | |
EmptyConstructor[PROTOTYPE] = anObject(O); | |
result = new EmptyConstructor(); | |
EmptyConstructor[PROTOTYPE] = null; | |
// add "__proto__" for Object.getPrototypeOf polyfill | |
result[IE_PROTO] = O; | |
} else result = NullProtoObject(); | |
return Properties === undefined ? result : definePropertiesModule.f(result, Properties); | |
}; | |
/***/ }), | |
/* 135 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var bind = __webpack_require__(173); | |
var uncurryThis = __webpack_require__(37); | |
var IndexedObject = __webpack_require__(165); | |
var toObject = __webpack_require__(92); | |
var lengthOfArrayLike = __webpack_require__(98); | |
var arraySpeciesCreate = __webpack_require__(255); | |
var push = uncurryThis([].push); | |
// `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterReject }` methods implementation | |
var createMethod = function (TYPE) { | |
var IS_MAP = TYPE == 1; | |
var IS_FILTER = TYPE == 2; | |
var IS_SOME = TYPE == 3; | |
var IS_EVERY = TYPE == 4; | |
var IS_FIND_INDEX = TYPE == 6; | |
var IS_FILTER_REJECT = TYPE == 7; | |
var NO_HOLES = TYPE == 5 || IS_FIND_INDEX; | |
return function ($this, callbackfn, that, specificCreate) { | |
var O = toObject($this); | |
var self = IndexedObject(O); | |
var boundFunction = bind(callbackfn, that); | |
var length = lengthOfArrayLike(self); | |
var index = 0; | |
var create = specificCreate || arraySpeciesCreate; | |
var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_REJECT ? create($this, 0) : undefined; | |
var value, result; | |
for (;length > index; index++) if (NO_HOLES || index in self) { | |
value = self[index]; | |
result = boundFunction(value, index, O); | |
if (TYPE) { | |
if (IS_MAP) target[index] = result; // map | |
else if (result) switch (TYPE) { | |
case 3: return true; // some | |
case 5: return value; // find | |
case 6: return index; // findIndex | |
case 2: push(target, value); // filter | |
} else switch (TYPE) { | |
case 4: return false; // every | |
case 7: push(target, value); // filterReject | |
} | |
} | |
} | |
return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target; | |
}; | |
}; | |
module.exports = { | |
// `Array.prototype.forEach` method | |
// https://tc39.es/ecma262/#sec-array.prototype.foreach | |
forEach: createMethod(0), | |
// `Array.prototype.map` method | |
// https://tc39.es/ecma262/#sec-array.prototype.map | |
map: createMethod(1), | |
// `Array.prototype.filter` method | |
// https://tc39.es/ecma262/#sec-array.prototype.filter | |
filter: createMethod(2), | |
// `Array.prototype.some` method | |
// https://tc39.es/ecma262/#sec-array.prototype.some | |
some: createMethod(3), | |
// `Array.prototype.every` method | |
// https://tc39.es/ecma262/#sec-array.prototype.every | |
every: createMethod(4), | |
// `Array.prototype.find` method | |
// https://tc39.es/ecma262/#sec-array.prototype.find | |
find: createMethod(5), | |
// `Array.prototype.findIndex` method | |
// https://tc39.es/ecma262/#sec-array.prototype.findIndex | |
findIndex: createMethod(6), | |
// `Array.prototype.filterReject` method | |
// https://github.com/tc39/proposal-array-filtering | |
filterReject: createMethod(7) | |
}; | |
/***/ }), | |
/* 136 */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GAstVisitor", function() { return GAstVisitor; }); | |
/* harmony import */ var _gast_public__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(56); | |
var GAstVisitor = /** @class */ (function () { | |
function GAstVisitor() { | |
} | |
GAstVisitor.prototype.visit = function (node) { | |
var nodeAny = node; | |
switch (nodeAny.constructor) { | |
case _gast_public__WEBPACK_IMPORTED_MODULE_0__["NonTerminal"]: | |
return this.visitNonTerminal(nodeAny); | |
case _gast_public__WEBPACK_IMPORTED_MODULE_0__["Flat"]: | |
return this.visitFlat(nodeAny); | |
case _gast_public__WEBPACK_IMPORTED_MODULE_0__["Option"]: | |
return this.visitOption(nodeAny); | |
case _gast_public__WEBPACK_IMPORTED_MODULE_0__["RepetitionMandatory"]: | |
return this.visitRepetitionMandatory(nodeAny); | |
case _gast_public__WEBPACK_IMPORTED_MODULE_0__["RepetitionMandatoryWithSeparator"]: | |
return this.visitRepetitionMandatoryWithSeparator(nodeAny); | |
case _gast_public__WEBPACK_IMPORTED_MODULE_0__["RepetitionWithSeparator"]: | |
return this.visitRepetitionWithSeparator(nodeAny); | |
case _gast_public__WEBPACK_IMPORTED_MODULE_0__["Repetition"]: | |
return this.visitRepetition(nodeAny); | |
case _gast_public__WEBPACK_IMPORTED_MODULE_0__["Alternation"]: | |
return this.visitAlternation(nodeAny); | |
case _gast_public__WEBPACK_IMPORTED_MODULE_0__["Terminal"]: | |
return this.visitTerminal(nodeAny); | |
case _gast_public__WEBPACK_IMPORTED_MODULE_0__["Rule"]: | |
return this.visitRule(nodeAny); | |
/* istanbul ignore next */ | |
default: | |
throw Error("non exhaustive match"); | |
} | |
}; | |
GAstVisitor.prototype.visitNonTerminal = function (node) { }; | |
GAstVisitor.prototype.visitFlat = function (node) { }; | |
GAstVisitor.prototype.visitOption = function (node) { }; | |
GAstVisitor.prototype.visitRepetition = function (node) { }; | |
GAstVisitor.prototype.visitRepetitionMandatory = function (node) { }; | |
GAstVisitor.prototype.visitRepetitionMandatoryWithSeparator = function (node) { }; | |
GAstVisitor.prototype.visitRepetitionWithSeparator = function (node) { }; | |
GAstVisitor.prototype.visitAlternation = function (node) { }; | |
GAstVisitor.prototype.visitTerminal = function (node) { }; | |
GAstVisitor.prototype.visitRule = function (node) { }; | |
return GAstVisitor; | |
}()); | |
//# sourceMappingURL=gast_visitor_public.js.map | |
/***/ }), | |
/* 137 */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "defaultParserErrorProvider", function() { return defaultParserErrorProvider; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "defaultGrammarResolverErrorProvider", function() { return defaultGrammarResolverErrorProvider; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "defaultGrammarValidatorErrorProvider", function() { return defaultGrammarValidatorErrorProvider; }); | |
/* harmony import */ var _scan_tokens_public__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(96); | |
/* harmony import */ var _utils_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(49); | |
/* harmony import */ var _grammar_gast_gast_public__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(56); | |
/* harmony import */ var _grammar_gast_gast__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(179); | |
/* harmony import */ var _grammar_checks__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(218); | |
var defaultParserErrorProvider = { | |
buildMismatchTokenMessage: function (_a) { | |
var expected = _a.expected, actual = _a.actual, previous = _a.previous, ruleName = _a.ruleName; | |
var hasLabel = Object(_scan_tokens_public__WEBPACK_IMPORTED_MODULE_0__["hasTokenLabel"])(expected); | |
var expectedMsg = hasLabel | |
? "--> " + Object(_scan_tokens_public__WEBPACK_IMPORTED_MODULE_0__["tokenLabel"])(expected) + " <--" | |
: "token of type --> " + expected.name + " <--"; | |
var msg = "Expecting " + expectedMsg + " but found --> '" + actual.image + "' <--"; | |
return msg; | |
}, | |
buildNotAllInputParsedMessage: function (_a) { | |
var firstRedundant = _a.firstRedundant, ruleName = _a.ruleName; | |
return ("Redundant input, expecting EOF but found: " + firstRedundant.image); | |
}, | |
buildNoViableAltMessage: function (_a) { | |
var expectedPathsPerAlt = _a.expectedPathsPerAlt, actual = _a.actual, previous = _a.previous, customUserDescription = _a.customUserDescription, ruleName = _a.ruleName; | |
var errPrefix = "Expecting: "; | |
// TODO: issue: No Viable Alternative Error may have incomplete details. #502 | |
var actualText = Object(_utils_utils__WEBPACK_IMPORTED_MODULE_1__["first"])(actual).image; | |
var errSuffix = "\nbut found: '" + actualText + "'"; | |
if (customUserDescription) { | |
return errPrefix + customUserDescription + errSuffix; | |
} | |
else { | |
var allLookAheadPaths = Object(_utils_utils__WEBPACK_IMPORTED_MODULE_1__["reduce"])(expectedPathsPerAlt, function (result, currAltPaths) { return result.concat(currAltPaths); }, []); | |
var nextValidTokenSequences = Object(_utils_utils__WEBPACK_IMPORTED_MODULE_1__["map"])(allLookAheadPaths, function (currPath) { | |
return "[" + Object(_utils_utils__WEBPACK_IMPORTED_MODULE_1__["map"])(currPath, function (currTokenType) { | |
return Object(_scan_tokens_public__WEBPACK_IMPORTED_MODULE_0__["tokenLabel"])(currTokenType); | |
}).join(", ") + "]"; | |
}); | |
var nextValidSequenceItems = Object(_utils_utils__WEBPACK_IMPORTED_MODULE_1__["map"])(nextValidTokenSequences, function (itemMsg, idx) { return " " + (idx + 1) + ". " + itemMsg; }); | |
var calculatedDescription = "one of these possible Token sequences:\n" + nextValidSequenceItems.join("\n"); | |
return errPrefix + calculatedDescription + errSuffix; | |
} | |
}, | |
buildEarlyExitMessage: function (_a) { | |
var expectedIterationPaths = _a.expectedIterationPaths, actual = _a.actual, customUserDescription = _a.customUserDescription, ruleName = _a.ruleName; | |
var errPrefix = "Expecting: "; | |
// TODO: issue: No Viable Alternative Error may have incomplete details. #502 | |
var actualText = Object(_utils_utils__WEBPACK_IMPORTED_MODULE_1__["first"])(actual).image; | |
var errSuffix = "\nbut found: '" + actualText + "'"; | |
if (customUserDescription) { | |
return errPrefix + customUserDescription + errSuffix; | |
} | |
else { | |
var nextValidTokenSequences = Object(_utils_utils__WEBPACK_IMPORTED_MODULE_1__["map"])(expectedIterationPaths, function (currPath) { | |
return "[" + Object(_utils_utils__WEBPACK_IMPORTED_MODULE_1__["map"])(currPath, function (currTokenType) { | |
return Object(_scan_tokens_public__WEBPACK_IMPORTED_MODULE_0__["tokenLabel"])(currTokenType); | |
}).join(",") + "]"; | |
}); | |
var calculatedDescription = "expecting at least one iteration which starts with one of these possible Token sequences::\n " + | |
("<" + nextValidTokenSequences.join(" ,") + ">"); | |
return errPrefix + calculatedDescription + errSuffix; | |
} | |
} | |
}; | |
Object.freeze(defaultParserErrorProvider); | |
var defaultGrammarResolverErrorProvider = { | |
buildRuleNotFoundError: function (topLevelRule, undefinedRule) { | |
var msg = "Invalid grammar, reference to a rule which is not defined: ->" + | |
undefinedRule.nonTerminalName + | |
"<-\n" + | |
"inside top level rule: ->" + | |
topLevelRule.name + | |
"<-"; | |
return msg; | |
} | |
}; | |
var defaultGrammarValidatorErrorProvider = { | |
buildDuplicateFoundError: function (topLevelRule, duplicateProds) { | |
function getExtraProductionArgument(prod) { | |
if (prod instanceof _grammar_gast_gast_public__WEBPACK_IMPORTED_MODULE_2__["Terminal"]) { | |
return prod.terminalType.name; | |
} | |
else if (prod instanceof _grammar_gast_gast_public__WEBPACK_IMPORTED_MODULE_2__["NonTerminal"]) { | |
return prod.nonTerminalName; | |
} | |
else { | |
return ""; | |
} | |
} | |
var topLevelName = topLevelRule.name; | |
var duplicateProd = Object(_utils_utils__WEBPACK_IMPORTED_MODULE_1__["first"])(duplicateProds); | |
var index = duplicateProd.idx; | |
var dslName = Object(_grammar_gast_gast__WEBPACK_IMPORTED_MODULE_3__["getProductionDslName"])(duplicateProd); | |
var extraArgument = getExtraProductionArgument(duplicateProd); | |
var hasExplicitIndex = index > 0; | |
var msg = "->" + dslName + (hasExplicitIndex ? index : "") + "<- " + (extraArgument ? "with argument: ->" + extraArgument + "<-" : "") + "\n appears more than once (" + duplicateProds.length + " times) in the top level rule: ->" + topLevelName + "<-. \n For further details see: https://sap.github.io/chevrotain/docs/FAQ.html#NUMERICAL_SUFFIXES \n "; | |
// white space trimming time! better to trim afterwards as it allows to use WELL formatted multi line template strings... | |
msg = msg.replace(/[ \t]+/g, " "); | |
msg = msg.replace(/\s\s+/g, "\n"); | |
return msg; | |
}, | |
buildInvalidNestedRuleNameError: function (topLevelRule, nestedProd) { | |
var msg = "Invalid nested rule name: ->" + nestedProd.name + "<- inside rule: ->" + topLevelRule.name + "<-\n" + | |
("it must match the pattern: ->" + _grammar_checks__WEBPACK_IMPORTED_MODULE_4__["validNestedRuleName"].toString() + "<-.\n") + | |
"Note that this means a nested rule name must start with the '$'(dollar) sign."; | |
return msg; | |
}, | |
buildDuplicateNestedRuleNameError: function (topLevelRule, nestedProd) { | |
var duplicateName = Object(_utils_utils__WEBPACK_IMPORTED_MODULE_1__["first"])(nestedProd).name; | |
var errMsg = "Duplicate nested rule name: ->" + duplicateName + "<- inside rule: ->" + topLevelRule.name + "<-\n" + | |
"A nested name must be unique in the scope of a top level grammar rule."; | |
return errMsg; | |
}, | |
buildNamespaceConflictError: function (rule) { | |
var errMsg = "Namespace conflict found in grammar.\n" + | |
("The grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <" + rule.name + ">.\n") + | |
"To resolve this make sure each Terminal and Non-Terminal names are unique\n" + | |
"This is easy to accomplish by using the convention that Terminal names start with an uppercase letter\n" + | |
"and Non-Terminal names start with a lower case letter."; | |
return errMsg; | |
}, | |
buildAlternationPrefixAmbiguityError: function (options) { | |
var pathMsg = Object(_utils_utils__WEBPACK_IMPORTED_MODULE_1__["map"])(options.prefixPath, function (currTok) { | |
return Object(_scan_tokens_public__WEBPACK_IMPORTED_MODULE_0__["tokenLabel"])(currTok); | |
}).join(", "); | |
var occurrence = options.alternation.idx === 0 ? "" : options.alternation.idx; | |
var errMsg = "Ambiguous alternatives: <" + options.ambiguityIndices.join(" ,") + "> due to common lookahead prefix\n" + | |
("in <OR" + occurrence + "> inside <" + options.topLevelRule.name + "> Rule,\n") + | |
("<" + pathMsg + "> may appears as a prefix path in all these alternatives.\n") + | |
"See: https://sap.github.io/chevrotain/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX\n" + | |
"For Further details."; | |
return errMsg; | |
}, | |
buildAlternationAmbiguityError: function (options) { | |
var pathMsg = Object(_utils_utils__WEBPACK_IMPORTED_MODULE_1__["map"])(options.prefixPath, function (currtok) { | |
return Object(_scan_tokens_public__WEBPACK_IMPORTED_MODULE_0__["tokenLabel"])(currtok); | |
}).join(", "); | |
var occurrence = options.alternation.idx === 0 ? "" : options.alternation.idx; | |
var currMessage = "Ambiguous Alternatives Detected: <" + options.ambiguityIndices.join(" ,") + "> in <OR" + occurrence + ">" + | |
(" inside <" + options.topLevelRule.name + "> Rule,\n") + | |
("<" + pathMsg + "> may appears as a prefix path in all these alternatives.\n"); | |
currMessage = | |
currMessage + | |
"See: https://sap.github.io/chevrotain/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES\n" + | |
"For Further details."; | |
return currMessage; | |
}, | |
buildEmptyRepetitionError: function (options) { | |
var dslName = Object(_grammar_gast_gast__WEBPACK_IMPORTED_MODULE_3__["getProductionDslName"])(options.repetition); | |
if (options.repetition.idx !== 0) { | |
dslName += options.repetition.idx; | |
} | |
var errMsg = "The repetition <" + dslName + "> within Rule <" + options.topLevelRule.name + "> can never consume any tokens.\n" + | |
"This could lead to an infinite loop."; | |
return errMsg; | |
}, | |
buildTokenNameError: function (options) { | |
var tokTypeName = options.tokenType.name; | |
var errMsg = "Invalid Grammar Token name: ->" + tokTypeName + "<- it must match the pattern: ->" + options.expectedPattern.toString() + "<-"; | |
return errMsg; | |
}, | |
buildEmptyAlternationError: function (options) { | |
var errMsg = "Ambiguous empty alternative: <" + (options.emptyChoiceIdx + 1) + ">" + | |
(" in <OR" + options.alternation.idx + "> inside <" + options.topLevelRule.name + "> Rule.\n") + | |
"Only the last alternative may be an empty alternative."; | |
return errMsg; | |
}, | |
buildTooManyAlternativesError: function (options) { | |
var errMsg = "An Alternation cannot have more than 256 alternatives:\n" + | |
("<OR" + options.alternation.idx + "> inside <" + options.topLevelRule.name + "> Rule.\n has " + (options.alternation.definition.length + | |
1) + " alternatives."); | |
return errMsg; | |
}, | |
buildLeftRecursionError: function (options) { | |
var ruleName = options.topLevelRule.name; | |
var pathNames = _utils_utils__WEBPACK_IMPORTED_MODULE_1__["map"](options.leftRecursionPath, function (currRule) { return currRule.name; }); | |
var leftRecursivePath = ruleName + " --> " + pathNames | |
.concat([ruleName]) | |
.join(" --> "); | |
var errMsg = "Left Recursion found in grammar.\n" + | |
("rule: <" + ruleName + "> can be invoked from itself (directly or indirectly)\n") + | |
("without consuming any Tokens. The grammar path that causes this is: \n " + leftRecursivePath + "\n") + | |
" To fix this refactor your grammar to remove the left recursion.\n" + | |
"see: https://en.wikipedia.org/wiki/LL_parser#Left_Factoring."; | |
return errMsg; | |
}, | |
buildInvalidRuleNameError: function (options) { | |
var ruleName = options.topLevelRule.name; | |
var expectedPatternString = options.expectedPattern.toString(); | |
var errMsg = "Invalid grammar rule name: ->" + ruleName + "<- it must match the pattern: ->" + expectedPatternString + "<-"; | |
return errMsg; | |
}, | |
buildDuplicateRuleNameError: function (options) { | |
var ruleName; | |
if (options.topLevelRule instanceof _grammar_gast_gast_public__WEBPACK_IMPORTED_MODULE_2__["Rule"]) { | |
ruleName = options.topLevelRule.name; | |
} | |
else { | |
ruleName = options.topLevelRule; | |
} | |
var errMsg = "Duplicate definition, rule: ->" + ruleName + "<- is already defined in the grammar: ->" + options.grammarName + "<-"; | |
return errMsg; | |
} | |
}; | |
//# sourceMappingURL=errors_public.js.map | |
/***/ }), | |
/* 138 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var $ = __webpack_require__(31); | |
var fill = __webpack_require__(667); | |
var addToUnscopables = __webpack_require__(175); | |
// `Array.prototype.fill` method | |
// https://tc39.es/ecma262/#sec-array.prototype.fill | |
$({ target: 'Array', proto: true }, { | |
fill: fill | |
}); | |
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables | |
addToUnscopables('fill'); | |
/***/ }), | |
/* 139 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var $ = __webpack_require__(31); | |
var uncurryThis = __webpack_require__(37); | |
var isArray = __webpack_require__(171); | |
var un$Reverse = uncurryThis([].reverse); | |
var test = [1, 2]; | |
// `Array.prototype.reverse` method | |
// https://tc39.es/ecma262/#sec-array.prototype.reverse | |
// fix for Safari 12.0 bug | |
// https://bugs.webkit.org/show_bug.cgi?id=188794 | |
$({ target: 'Array', proto: true, forced: String(test) === String(test.reverse()) }, { | |
reverse: function reverse() { | |
// eslint-disable-next-line no-self-assign -- dirty hack | |
if (isArray(this)) this.length = this.length; | |
return un$Reverse(this); | |
} | |
}); | |
/***/ }), | |
/* 140 */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Transformer", function() { return Transformer; }); | |
/* harmony import */ var core_js_modules_es_object_assign_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(89); | |
/* harmony import */ var core_js_modules_es_object_assign_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_assign_js__WEBPACK_IMPORTED_MODULE_0__); | |
/* harmony import */ var core_js_modules_es_array_map_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(38); | |
/* harmony import */ var core_js_modules_es_array_map_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_map_js__WEBPACK_IMPORTED_MODULE_1__); | |
/* harmony import */ var core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(14); | |
/* harmony import */ var core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_2__); | |
/* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(0); | |
/* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_3__); | |
/* harmony import */ var core_js_modules_es_function_name_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(26); | |
/* harmony import */ var core_js_modules_es_function_name_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_function_name_js__WEBPACK_IMPORTED_MODULE_4__); | |
/* harmony import */ var core_js_modules_es_array_from_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(23); | |
/* harmony import */ var core_js_modules_es_array_from_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_from_js__WEBPACK_IMPORTED_MODULE_5__); | |
/* harmony import */ var core_js_modules_es_string_iterator_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(2); | |
/* harmony import */ var core_js_modules_es_string_iterator_js__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_string_iterator_js__WEBPACK_IMPORTED_MODULE_6__); | |
/* harmony import */ var core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(13); | |
/* harmony import */ var core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_7__); | |
/* harmony import */ var core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(9); | |
/* harmony import */ var core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_8__); | |
/* harmony import */ var core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(10); | |
/* harmony import */ var core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_9__); | |
/* harmony import */ var core_js_modules_es_symbol_iterator_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(11); | |
/* harmony import */ var core_js_modules_es_symbol_iterator_js__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_symbol_iterator_js__WEBPACK_IMPORTED_MODULE_10__); | |
/* harmony import */ var core_js_modules_es_array_iterator_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(3); | |
/* harmony import */ var core_js_modules_es_array_iterator_js__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_iterator_js__WEBPACK_IMPORTED_MODULE_11__); | |
/* harmony import */ var core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(4); | |
/* harmony import */ var core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_12__); | |
/* harmony import */ var _Cell__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(24); | |
/* harmony import */ var _parser__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(70); | |
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } | |
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } | |
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } | |
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } | |
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } | |
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | |
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } | |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | |
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | |
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | |
/** | |
* @license | |
* Copyright (c) 2021 Handsoncode. All rights reserved. | |
*/ | |
var Transformer = /*#__PURE__*/function () { | |
function Transformer() { | |
_classCallCheck(this, Transformer); | |
} | |
_createClass(Transformer, [{ | |
key: "performEagerTransformations", | |
value: function performEagerTransformations(graph, parser) { | |
var _iterator = _createForOfIteratorHelper(graph.arrayFormulaNodes()), | |
_step; | |
try { | |
for (_iterator.s(); !(_step = _iterator.n()).done;) { | |
var node = _step.value; | |
var _this$transformSingle = this.transformSingleAst(node.getFormula(graph.lazilyTransformingAstService), node.getAddress(graph.lazilyTransformingAstService)), | |
_this$transformSingle2 = _slicedToArray(_this$transformSingle, 2), | |
newAst = _this$transformSingle2[0], | |
newAddress = _this$transformSingle2[1]; | |
var cachedAst = parser.rememberNewAst(newAst); | |
node.setFormula(cachedAst); | |
node.setAddress(newAddress); | |
} | |
} catch (err) { | |
_iterator.e(err); | |
} finally { | |
_iterator.f(); | |
} | |
} | |
}, { | |
key: "transformSingleAst", | |
value: function transformSingleAst(ast, address) { | |
var newAst = this.transformAst(ast, address); | |
var newAddress = this.fixNodeAddress(address); | |
return [newAst, newAddress]; | |
} | |
}, { | |
key: "transformAst", | |
value: function transformAst(ast, address) { | |
var _this = this; | |
switch (ast.type) { | |
case _parser__WEBPACK_IMPORTED_MODULE_14__["AstNodeType"].CELL_REFERENCE: | |
{ | |
return this.transformCellReferenceAst(ast, address); | |
} | |
case _parser__WEBPACK_IMPORTED_MODULE_14__["AstNodeType"].CELL_RANGE: | |
{ | |
return this.transformCellRangeAst(ast, address); | |
} | |
case _parser__WEBPACK_IMPORTED_MODULE_14__["AstNodeType"].COLUMN_RANGE: | |
{ | |
return this.transformColumnRangeAst(ast, address); | |
} | |
case _parser__WEBPACK_IMPORTED_MODULE_14__["AstNodeType"].ROW_RANGE: | |
{ | |
return this.transformRowRangeAst(ast, address); | |
} | |
case _parser__WEBPACK_IMPORTED_MODULE_14__["AstNodeType"].EMPTY: | |
case _parser__WEBPACK_IMPORTED_MODULE_14__["AstNodeType"].ERROR: | |
case _parser__WEBPACK_IMPORTED_MODULE_14__["AstNodeType"].NUMBER: | |
case _parser__WEBPACK_IMPORTED_MODULE_14__["AstNodeType"].NAMED_EXPRESSION: | |
case _parser__WEBPACK_IMPORTED_MODULE_14__["AstNodeType"].ERROR_WITH_RAW_INPUT: | |
case _parser__WEBPACK_IMPORTED_MODULE_14__["AstNodeType"].STRING: | |
{ | |
return ast; | |
} | |
case _parser__WEBPACK_IMPORTED_MODULE_14__["AstNodeType"].PERCENT_OP: | |
case _parser__WEBPACK_IMPORTED_MODULE_14__["AstNodeType"].MINUS_UNARY_OP: | |
case _parser__WEBPACK_IMPORTED_MODULE_14__["AstNodeType"].PLUS_UNARY_OP: | |
{ | |
return Object.assign(Object.assign({}, ast), { | |
value: this.transformAst(ast.value, address) | |
}); | |
} | |
case _parser__WEBPACK_IMPORTED_MODULE_14__["AstNodeType"].FUNCTION_CALL: | |
{ | |
return Object.assign(Object.assign({}, ast), { | |
procedureName: ast.procedureName, | |
args: ast.args.map(function (arg) { | |
return _this.transformAst(arg, address); | |
}) | |
}); | |
} | |
case _parser__WEBPACK_IMPORTED_MODULE_14__["AstNodeType"].PARENTHESIS: | |
{ | |
return Object.assign(Object.assign({}, ast), { | |
expression: this.transformAst(ast.expression, address) | |
}); | |
} | |
case _parser__WEBPACK_IMPORTED_MODULE_14__["AstNodeType"].ARRAY: | |
{ | |
return Object.assign(Object.assign({}, ast), { | |
args: ast.args.map(function (row) { | |
return row.map(function (val) { | |
return _this.transformAst(val, address); | |
}); | |
}) | |
}); | |
} | |
default: | |
{ | |
return Object.assign(Object.assign({}, ast), { | |
left: this.transformAst(ast.left, address), | |
right: this.transformAst(ast.right, address) | |
}); | |
} | |
} | |
} | |
}, { | |
key: "transformCellReferenceAst", | |
value: function transformCellReferenceAst(ast, formulaAddress) { | |
var newCellAddress = this.transformCellAddress(ast.reference, formulaAddress); | |
if (newCellAddress instanceof _parser__WEBPACK_IMPORTED_MODULE_14__["CellAddress"]) { | |
return Object.assign(Object.assign({}, ast), { | |
reference: newCellAddress | |
}); | |
} else if (newCellAddress === _Cell__WEBPACK_IMPORTED_MODULE_13__["ErrorType"].REF) { | |
return Object(_parser__WEBPACK_IMPORTED_MODULE_14__["buildCellErrorAst"])(new _Cell__WEBPACK_IMPORTED_MODULE_13__["CellError"](_Cell__WEBPACK_IMPORTED_MODULE_13__["ErrorType"].REF)); | |
} else { | |
return ast; | |
} | |
} | |
}, { | |
key: "transformCellRangeAst", | |
value: function transformCellRangeAst(ast, formulaAddress) { | |
var newRange = this.transformCellRange(ast.start, ast.end, formulaAddress); | |
if (Array.isArray(newRange)) { | |
return Object.assign(Object.assign({}, ast), { | |
start: newRange[0], | |
end: newRange[1] | |
}); | |
} else if (newRange === _Cell__WEBPACK_IMPORTED_MODULE_13__["ErrorType"].REF) { | |
return Object(_parser__WEBPACK_IMPORTED_MODULE_14__["buildCellErrorAst"])(new _Cell__WEBPACK_IMPORTED_MODULE_13__["CellError"](_Cell__WEBPACK_IMPORTED_MODULE_13__["ErrorType"].REF)); | |
} else { | |
return ast; | |
} | |
} | |
}, { | |
key: "transformColumnRangeAst", | |
value: function transformColumnRangeAst(ast, formulaAddress) { | |
var newRange = this.transformColumnRange(ast.start, ast.end, formulaAddress); | |
if (Array.isArray(newRange)) { | |
return Object.assign(Object.assign({}, ast), { | |
start: newRange[0], | |
end: newRange[1] | |
}); | |
} else if (newRange === _Cell__WEBPACK_IMPORTED_MODULE_13__["ErrorType"].REF) { | |
return Object(_parser__WEBPACK_IMPORTED_MODULE_14__["buildCellErrorAst"])(new _Cell__WEBPACK_IMPORTED_MODULE_13__["CellError"](_Cell__WEBPACK_IMPORTED_MODULE_13__["ErrorType"].REF)); | |
} else { | |
return ast; | |
} | |
} | |
}, { | |
key: "transformRowRangeAst", | |
value: function transformRowRangeAst(ast, formulaAddress) { | |
var newRange = this.transformRowRange(ast.start, ast.end, formulaAddress); | |
if (Array.isArray(newRange)) { | |
return Object.assign(Object.assign({}, ast), { | |
start: newRange[0], | |
end: newRange[1] | |
}); | |
} else if (newRange === _Cell__WEBPACK_IMPORTED_MODULE_13__["ErrorType"].REF) { | |
return Object(_parser__WEBPACK_IMPORTED_MODULE_14__["buildCellErrorAst"])(new _Cell__WEBPACK_IMPORTED_MODULE_13__["CellError"](_Cell__WEBPACK_IMPORTED_MODULE_13__["ErrorType"].REF)); | |
} else { | |
return ast; | |
} | |
} | |
}]); | |
return Transformer; | |
}(); | |
/***/ }), | |
/* 141 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var $ = __webpack_require__(31); | |
var $find = __webpack_require__(135).find; | |
var addToUnscopables = __webpack_require__(175); | |
var FIND = 'find'; | |
var SKIPS_HOLES = true; | |
// Shouldn't skip holes | |
if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; }); | |
// `Array.prototype.find` method | |
// https://tc39.es/ecma262/#sec-array.prototype.find | |
$({ target: 'Array', proto: true, forced: SKIPS_HOLES }, { | |
find: function find(callbackfn /* , that = undefined */) { | |
return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); | |
} | |
}); | |
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables | |
addToUnscopables(FIND); | |
/***/ }), | |
/* 142 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var $ = __webpack_require__(31); | |
var ceil = Math.ceil; | |
var floor = Math.floor; | |
// `Math.trunc` method | |
// https://tc39.es/ecma262/#sec-math.trunc | |
$({ target: 'Math', stat: true }, { | |
trunc: function trunc(it) { | |
return (it > 0 ? floor : ceil)(it); | |
} | |
}); | |
/***/ }), | |
/* 143 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var setPrototypeOf = __webpack_require__(562); | |
var isNativeReflectConstruct = __webpack_require__(733); | |
function _construct(Parent, args, Class) { | |
if (isNativeReflectConstruct()) { | |
module.exports = _construct = Reflect.construct, module.exports.__esModule = true, module.exports["default"] = module.exports; | |
} else { | |
module.exports = _construct = function _construct(Parent, args, Class) { | |
var a = [null]; | |
a.push.apply(a, args); | |
var Constructor = Function.bind.apply(Parent, a); | |
var instance = new Constructor(); | |
if (Class) setPrototypeOf(instance, Class.prototype); | |
return instance; | |
}, module.exports.__esModule = true, module.exports["default"] = module.exports; | |
} | |
return _construct.apply(null, arguments); | |
} | |
module.exports = _construct, module.exports.__esModule = true, module.exports["default"] = module.exports; | |
/***/ }), | |
/* 144 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
__webpack_require__(0); | |
__webpack_require__(28); | |
__webpack_require__(54); | |
exports.__esModule = true; | |
var _exportNames = { | |
BottomLeftCornerOverlay: true, | |
BottomOverlay: true, | |
LeftOverlay: true, | |
Overlay: true, | |
TopLeftCornerOverlay: true, | |
TopOverlay: true | |
}; | |
exports.TopOverlay = exports.TopLeftCornerOverlay = exports.Overlay = exports.LeftOverlay = exports.BottomOverlay = exports.BottomLeftCornerOverlay = void 0; | |
var _bottomLeftCorner = __webpack_require__(737); | |
exports.BottomLeftCornerOverlay = _bottomLeftCorner.BottomLeftCornerOverlay; | |
var _bottom = __webpack_require__(755); | |
exports.BottomOverlay = _bottom.BottomOverlay; | |
var _left = __webpack_require__(757); | |
exports.LeftOverlay = _left.LeftOverlay; | |
var _base = __webpack_require__(159); | |
exports.Overlay = _base.Overlay; | |
var _topLeftCorner = __webpack_require__(759); | |
exports.TopLeftCornerOverlay = _topLeftCorner.TopLeftCornerOverlay; | |
var _top = __webpack_require__(761); | |
exports.TopOverlay = _top.TopOverlay; | |
var _constants = __webpack_require__(145); | |
Object.keys(_constants).forEach(function (key) { | |
if (key === "default" || key === "__esModule") return; | |
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | |
if (key in exports && exports[key] === _constants[key]) return; | |
exports[key] = _constants[key]; | |
}); | |
/***/ }), | |
/* 145 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
exports.__esModule = true; | |
exports.CLONE_TYPES = exports.CLONE_TOP_LEFT_CORNER = exports.CLONE_TOP = exports.CLONE_LEFT = exports.CLONE_BOTTOM_LEFT_CORNER = exports.CLONE_BOTTOM = void 0; | |
/** | |
* @typedef {'top'|'bottom'|'left'|'top_left_corner'|'bottom_left_corner'} CLONE_TYPES_ENUM | |
*/ | |
var CLONE_TOP = 'top'; | |
exports.CLONE_TOP = CLONE_TOP; | |
var CLONE_BOTTOM = 'bottom'; | |
exports.CLONE_BOTTOM = CLONE_BOTTOM; | |
var CLONE_LEFT = 'left'; | |
exports.CLONE_LEFT = CLONE_LEFT; | |
var CLONE_TOP_LEFT_CORNER = 'top_left_corner'; | |
exports.CLONE_TOP_LEFT_CORNER = CLONE_TOP_LEFT_CORNER; | |
var CLONE_BOTTOM_LEFT_CORNER = 'bottom_left_corner'; | |
exports.CLONE_BOTTOM_LEFT_CORNER = CLONE_BOTTOM_LEFT_CORNER; | |
var CLONE_TYPES = [CLONE_TOP, CLONE_BOTTOM, CLONE_LEFT, CLONE_TOP_LEFT_CORNER, CLONE_BOTTOM_LEFT_CORNER]; | |
exports.CLONE_TYPES = CLONE_TYPES; | |
/***/ }), | |
/* 146 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var _interopRequireDefault = __webpack_require__(1); | |
exports.__esModule = true; | |
exports.cellMethodLookupFactory = cellMethodLookupFactory; | |
exports.countFirstRowKeys = countFirstRowKeys; | |
exports.createEmptySpreadsheetData = createEmptySpreadsheetData; | |
exports.createSpreadsheetData = createSpreadsheetData; | |
exports.createSpreadsheetObjectData = createSpreadsheetObjectData; | |
exports.dataRowToChangesArray = dataRowToChangesArray; | |
exports.isArrayOfArrays = isArrayOfArrays; | |
exports.isArrayOfObjects = isArrayOfObjects; | |
exports.spreadsheetColumnIndex = spreadsheetColumnIndex; | |
exports.spreadsheetColumnLabel = spreadsheetColumnLabel; | |
var _typeof2 = _interopRequireDefault(__webpack_require__(22)); | |
__webpack_require__(27); | |
__webpack_require__(0); | |
__webpack_require__(28); | |
__webpack_require__(54); | |
var _registry = __webpack_require__(160); | |
var _object = __webpack_require__(18); | |
var COLUMN_LABEL_BASE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; | |
var COLUMN_LABEL_BASE_LENGTH = COLUMN_LABEL_BASE.length; | |
/** | |
* Generates spreadsheet-like column names: A, B, C, ..., Z, AA, AB, etc. | |
* | |
* @param {number} index Column index. | |
* @returns {string} | |
*/ | |
function spreadsheetColumnLabel(index) { | |
var dividend = index + 1; | |
var columnLabel = ''; | |
var modulo; | |
while (dividend > 0) { | |
modulo = (dividend - 1) % COLUMN_LABEL_BASE_LENGTH; | |
columnLabel = String.fromCharCode(65 + modulo) + columnLabel; | |
dividend = parseInt((dividend - modulo) / COLUMN_LABEL_BASE_LENGTH, 10); | |
} | |
return columnLabel; | |
} | |
/** | |
* Generates spreadsheet-like column index from theirs labels: A, B, C ...., Z, AA, AB, etc. | |
* | |
* @param {string} label Column label. | |
* @returns {number} | |
*/ | |
function spreadsheetColumnIndex(label) { | |
var result = 0; | |
if (label) { | |
for (var i = 0, j = label.length - 1; i < label.length; i += 1, j -= 1) { | |
result += Math.pow(COLUMN_LABEL_BASE_LENGTH, j) * (COLUMN_LABEL_BASE.indexOf(label[i]) + 1); | |
} | |
} | |
result -= 1; | |
return result; | |
} | |
/** | |
* Creates 2D array of Excel-like values "A1", "A2", ... | |
* | |
* @param {number} rows Number of rows to generate. | |
* @param {number} columns Number of columns to generate. | |
* @returns {Array} | |
*/ | |
function createSpreadsheetData() { | |
var rows = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 100; | |
var columns = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 4; | |
var _rows = []; | |
var i; | |
var j; | |
for (i = 0; i < rows; i++) { | |
var row = []; | |
for (j = 0; j < columns; j++) { | |
row.push(spreadsheetColumnLabel(j) + (i + 1)); | |
} | |
_rows.push(row); | |
} | |
return _rows; | |
} | |
/** | |
* Creates 2D array of Excel-like values "A1", "A2", as an array of objects. | |
* | |
* @param {number} rows Number of rows to generate. | |
* @param {number} colCount Number of columns to generate. | |
* @returns {Array} | |
*/ | |
function createSpreadsheetObjectData() { | |
var rows = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 100; | |
var colCount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 4; | |
var _rows = []; | |
var i; | |
var j; | |
for (i = 0; i < rows; i++) { | |
var row = {}; | |
for (j = 0; j < colCount; j++) { | |
row["prop".concat(j)] = spreadsheetColumnLabel(j) + (i + 1); | |
} | |
_rows.push(row); | |
} | |
return _rows; | |
} | |
/** | |
* Generates an empty data object. | |
* | |
* @param {number} rows Number of rows to generate. | |
* @param {number} columns Number of columns to generate. | |
* @returns {Array} | |
*/ | |
function createEmptySpreadsheetData(rows, columns) { | |
var data = []; | |
var row; | |
for (var i = 0; i < rows; i++) { | |
row = []; | |
for (var j = 0; j < columns; j++) { | |
row.push(''); | |
} | |
data.push(row); | |
} | |
return data; | |
} | |
/** | |
* Factory that produces a function for searching methods (or any properties) which could be defined directly in | |
* table configuration or implicitly, within cell type definition. | |
* | |
* For example: renderer can be defined explicitly using "renderer" property in column configuration or it can be | |
* defined implicitly using "type" property. | |
* | |
* Methods/properties defined explicitly always takes precedence over those defined through "type". | |
* | |
* If the method/property is not found in an object, searching is continued recursively through prototype chain, until | |
* it reaches the Object.prototype. | |
* | |
* @param {string} methodName Name of the method/property to search (i.e. 'renderer', 'validator', 'copyable'). | |
* @param {boolean} [allowUndefined] If `false`, the search is continued if methodName has not been found in cell | |
* "type". | |
* @returns {Function} | |
*/ | |
function cellMethodLookupFactory(methodName, allowUndefined) { | |
var isUndefinedAllowed = typeof allowUndefined === 'undefined' ? true : allowUndefined; | |
return function cellMethodLookup(row, col) { | |
return function getMethodFromProperties(properties) { | |
if (!properties) { | |
return; // method or property not found | |
} | |
if ((0, _object.hasOwnProperty)(properties, methodName) && properties[methodName] !== void 0) { | |
// check if it is own and is not empty | |
return properties[methodName]; // method defined directly | |
} else if ((0, _object.hasOwnProperty)(properties, 'type') && properties.type) { | |
// check if it is own and is not empty | |
if (typeof properties.type !== 'string') { | |
throw new Error('Cell "type" must be a string'); | |
} | |
var type = (0, _registry.getCellType)(properties.type); | |
if ((0, _object.hasOwnProperty)(type, methodName)) { | |
return type[methodName]; // method defined in type. | |
} else if (isUndefinedAllowed) { | |
return; // method does not defined in type (eg. validator), returns undefined | |
} | |
} | |
return getMethodFromProperties(Object.getPrototypeOf(properties)); | |
}(typeof row === 'number' ? this.getCellMeta(row, col) : row); | |
}; | |
} | |
/** | |
* Transform a data row (either an array or an object) or an array of data rows to array of changes in a form of `[row, | |
* prop/col, value]`. Convenient to use with `setDataAtRowProp` and `setSourceDataAtCell` methods. | |
* | |
* @param {Array|object} dataRow Object of row data, array of row data or an array of either. | |
* @param {number} rowOffset Row offset to be passed to the resulting change list. Defaults to `0`. | |
* @returns {Array} Array of changes (in a form of an array). | |
*/ | |
function dataRowToChangesArray(dataRow) { | |
var rowOffset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; | |
var dataRows = dataRow; | |
var changesArray = []; | |
if (!Array.isArray(dataRow) || !Array.isArray(dataRow[0])) { | |
dataRows = [dataRow]; | |
} | |
dataRows.forEach(function (row, rowIndex) { | |
if (Array.isArray(row)) { | |
row.forEach(function (value, column) { | |
changesArray.push([rowIndex + rowOffset, column, value]); | |
}); | |
} else { | |
Object.keys(row).forEach(function (propName) { | |
changesArray.push([rowIndex + rowOffset, propName, row[propName]]); | |
}); | |
} | |
}); | |
return changesArray; | |
} | |
/** | |
* Count the number of keys (or, basically, columns when the data is an array or arrays) in the first row of the | |
* provided dataset. | |
* | |
* @param {Array} data The dataset. | |
* @returns {number} Number of keys in the first row of the dataset. | |
*/ | |
function countFirstRowKeys(data) { | |
var result = 0; | |
if (Array.isArray(data)) { | |
if (data[0] && Array.isArray(data[0])) { | |
result = data[0].length; | |
} else if (data[0] && (0, _object.isObject)(data[0])) { | |
result = (0, _object.deepObjectSize)(data[0]); | |
} | |
} | |
return result; | |
} | |
/** | |
* Check whether the provided dataset is a *non-empty* array of arrays. | |
* | |
* @param {Array} data Dataset to be checked. | |
* @returns {boolean} `true` if data is an array of arrays, `false` otherwise. | |
*/ | |
function isArrayOfArrays(data) { | |
return !!(Array.isArray(data) && data.length && data.every(function (el) { | |
return Array.isArray(el); | |
})); | |
} | |
/** | |
* Check whether the provided dataset is a *non-empty* array of objects. | |
* | |
* @param {Array} data Dataset to be checked. | |
* @returns {boolean} `true` if data is an array of objects, `false` otherwise. | |
*/ | |
function isArrayOfObjects(data) { | |
return !!(Array.isArray(data) && data.length && data.every(function (el) { | |
return (0, _typeof2.default)(el) === 'object' && !Array.isArray(el) && el !== null; | |
})); | |
} | |
/***/ }), | |
/* 147 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
exports.__esModule = true; | |
exports.TextEditor = exports.EDITOR_TYPE = void 0; | |
var _textEditor = __webpack_require__(811); | |
exports.EDITOR_TYPE = _textEditor.EDITOR_TYPE; | |
exports.TextEditor = _textEditor.TextEditor; | |
/***/ }), | |
/* 148 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
exports.__esModule = true; | |
exports.textRenderer = exports.RENDERER_TYPE = void 0; | |
var _textRenderer = __webpack_require__(816); | |
exports.RENDERER_TYPE = _textRenderer.RENDERER_TYPE; | |
exports.textRenderer = _textRenderer.textRenderer; | |
/***/ }), | |
/* 149 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var global = __webpack_require__(30); | |
var isCallable = __webpack_require__(61); | |
var tryToString = __webpack_require__(202); | |
var TypeError = global.TypeError; | |
// `Assert: IsCallable(argument) is true` | |
module.exports = function (argument) { | |
if (isCallable(argument)) return argument; | |
throw TypeError(tryToString(argument) + ' is not a function'); | |
}; | |
/***/ }), | |
/* 150 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var internalObjectKeys = __webpack_require__(328); | |
var enumBugKeys = __webpack_require__(241); | |
var hiddenKeys = enumBugKeys.concat('length', 'prototype'); | |
// `Object.getOwnPropertyNames` method | |
// https://tc39.es/ecma262/#sec-object.getownpropertynames | |
// eslint-disable-next-line es/no-object-getownpropertynames -- safe | |
exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { | |
return internalObjectKeys(O, hiddenKeys); | |
}; | |
/***/ }), | |
/* 151 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var toIntegerOrInfinity = __webpack_require__(123); | |
var max = Math.max; | |
var min = Math.min; | |
// Helper for a popular repeating case of the spec: | |
// Let integer be ? ToInteger(index). | |
// If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length). | |
module.exports = function (index, length) { | |
var integer = toIntegerOrInfinity(index); | |
return integer < 0 ? max(integer + length, 0) : min(integer, length); | |
}; | |
/***/ }), | |
/* 152 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var toPropertyKey = __webpack_require__(200); | |
var definePropertyModule = __webpack_require__(86); | |
var createPropertyDescriptor = __webpack_require__(164); | |
module.exports = function (object, key, value) { | |
var propertyKey = toPropertyKey(key); | |
if (propertyKey in object) definePropertyModule.f(object, propertyKey, createPropertyDescriptor(0, value)); | |
else object[propertyKey] = value; | |
}; | |
/***/ }), | |
/* 153 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var fails = __webpack_require__(43); | |
module.exports = function (METHOD_NAME, argument) { | |
var method = [][METHOD_NAME]; | |
return !!method && fails(function () { | |
// eslint-disable-next-line no-useless-call -- required for testing | |
method.call(null, argument || function () { return 1; }, 1); | |
}); | |
}; | |
/***/ }), | |
/* 154 */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LexerDefinitionErrorType", function() { return LexerDefinitionErrorType; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Lexer", function() { return Lexer; }); | |
/* harmony import */ var _lexer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(355); | |
/* harmony import */ var _utils_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(49); | |
/* harmony import */ var _tokens__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(178); | |
/* harmony import */ var _scan_lexer_errors_public__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(266); | |
/* harmony import */ var _reg_exp_parser__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(265); | |
var LexerDefinitionErrorType; | |
(function (LexerDefinitionErrorType) { | |
LexerDefinitionErrorType[LexerDefinitionErrorType["MISSING_PATTERN"] = 0] = "MISSING_PATTERN"; | |
LexerDefinitionErrorType[LexerDefinitionErrorType["INVALID_PATTERN"] = 1] = "INVALID_PATTERN"; | |
LexerDefinitionErrorType[LexerDefinitionErrorType["EOI_ANCHOR_FOUND"] = 2] = "EOI_ANCHOR_FOUND"; | |
LexerDefinitionErrorType[LexerDefinitionErrorType["UNSUPPORTED_FLAGS_FOUND"] = 3] = "UNSUPPORTED_FLAGS_FOUND"; | |
LexerDefinitionErrorType[LexerDefinitionErrorType["DUPLICATE_PATTERNS_FOUND"] = 4] = "DUPLICATE_PATTERNS_FOUND"; | |
LexerDefinitionErrorType[LexerDefinitionErrorType["INVALID_GROUP_TYPE_FOUND"] = 5] = "INVALID_GROUP_TYPE_FOUND"; | |
LexerDefinitionErrorType[LexerDefinitionErrorType["PUSH_MODE_DOES_NOT_EXIST"] = 6] = "PUSH_MODE_DOES_NOT_EXIST"; | |
LexerDefinitionErrorType[LexerDefinitionErrorType["MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE"] = 7] = "MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE"; | |
LexerDefinitionErrorType[LexerDefinitionErrorType["MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY"] = 8] = "MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY"; | |
LexerDefinitionErrorType[LexerDefinitionErrorType["MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST"] = 9] = "MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST"; | |
LexerDefinitionErrorType[LexerDefinitionErrorType["LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED"] = 10] = "LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED"; | |
LexerDefinitionErrorType[LexerDefinitionErrorType["SOI_ANCHOR_FOUND"] = 11] = "SOI_ANCHOR_FOUND"; | |
LexerDefinitionErrorType[LexerDefinitionErrorType["EMPTY_MATCH_PATTERN"] = 12] = "EMPTY_MATCH_PATTERN"; | |
LexerDefinitionErrorType[LexerDefinitionErrorType["NO_LINE_BREAKS_FLAGS"] = 13] = "NO_LINE_BREAKS_FLAGS"; | |
LexerDefinitionErrorType[LexerDefinitionErrorType["UNREACHABLE_PATTERN"] = 14] = "UNREACHABLE_PATTERN"; | |
LexerDefinitionErrorType[LexerDefinitionErrorType["IDENTIFY_TERMINATOR"] = 15] = "IDENTIFY_TERMINATOR"; | |
LexerDefinitionErrorType[LexerDefinitionErrorType["CUSTOM_LINE_BREAK"] = 16] = "CUSTOM_LINE_BREAK"; | |
})(LexerDefinitionErrorType || (LexerDefinitionErrorType = {})); | |
var DEFAULT_LEXER_CONFIG = { | |
deferDefinitionErrorsHandling: false, | |
positionTracking: "full", | |
lineTerminatorsPattern: /\n|\r\n?/g, | |
lineTerminatorCharacters: ["\n", "\r"], | |
ensureOptimizations: false, | |
safeMode: false, | |
errorMessageProvider: _scan_lexer_errors_public__WEBPACK_IMPORTED_MODULE_3__["defaultLexerErrorProvider"], | |
traceInitPerf: false, | |
skipValidations: false | |
}; | |
Object.freeze(DEFAULT_LEXER_CONFIG); | |
var Lexer = /** @class */ (function () { | |
function Lexer(lexerDefinition, config) { | |
var _this = this; | |
if (config === void 0) { config = DEFAULT_LEXER_CONFIG; } | |
this.lexerDefinition = lexerDefinition; | |
this.lexerDefinitionErrors = []; | |
this.lexerDefinitionWarning = []; | |
this.patternIdxToConfig = {}; | |
this.charCodeToPatternIdxToConfig = {}; | |
this.modes = []; | |
this.emptyGroups = {}; | |
this.config = undefined; | |
this.trackStartLines = true; | |
this.trackEndLines = true; | |
this.hasCustom = false; | |
this.canModeBeOptimized = {}; | |
if (typeof config === "boolean") { | |
throw Error("The second argument to the Lexer constructor is now an ILexerConfig Object.\n" + | |
"a boolean 2nd argument is no longer supported"); | |
} | |
// todo: defaults func? | |
this.config |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment