UNPKG

300 kBJavaScriptView Raw
1(function (global, factory) {
2 typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('jquery')) :
3 typeof define === 'function' && define.amd ? define(['jquery'], factory) :
4 (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.BootstrapTable = factory(global.jQuery));
5})(this, (function ($) { 'use strict';
6
7 function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
9 var $__default = /*#__PURE__*/_interopDefaultLegacy($);
10
11 function _typeof(obj) {
12 "@babel/helpers - typeof";
13
14 return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
15 return typeof obj;
16 } : function (obj) {
17 return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
18 }, _typeof(obj);
19 }
20
21 function _classCallCheck(instance, Constructor) {
22 if (!(instance instanceof Constructor)) {
23 throw new TypeError("Cannot call a class as a function");
24 }
25 }
26
27 function _defineProperties(target, props) {
28 for (var i = 0; i < props.length; i++) {
29 var descriptor = props[i];
30 descriptor.enumerable = descriptor.enumerable || false;
31 descriptor.configurable = true;
32 if ("value" in descriptor) descriptor.writable = true;
33 Object.defineProperty(target, descriptor.key, descriptor);
34 }
35 }
36
37 function _createClass(Constructor, protoProps, staticProps) {
38 if (protoProps) _defineProperties(Constructor.prototype, protoProps);
39 if (staticProps) _defineProperties(Constructor, staticProps);
40 Object.defineProperty(Constructor, "prototype", {
41 writable: false
42 });
43 return Constructor;
44 }
45
46 function _slicedToArray(arr, i) {
47 return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
48 }
49
50 function _toConsumableArray(arr) {
51 return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
52 }
53
54 function _arrayWithoutHoles(arr) {
55 if (Array.isArray(arr)) return _arrayLikeToArray(arr);
56 }
57
58 function _arrayWithHoles(arr) {
59 if (Array.isArray(arr)) return arr;
60 }
61
62 function _iterableToArray(iter) {
63 if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
64 }
65
66 function _iterableToArrayLimit(arr, i) {
67 var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
68
69 if (_i == null) return;
70 var _arr = [];
71 var _n = true;
72 var _d = false;
73
74 var _s, _e;
75
76 try {
77 for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
78 _arr.push(_s.value);
79
80 if (i && _arr.length === i) break;
81 }
82 } catch (err) {
83 _d = true;
84 _e = err;
85 } finally {
86 try {
87 if (!_n && _i["return"] != null) _i["return"]();
88 } finally {
89 if (_d) throw _e;
90 }
91 }
92
93 return _arr;
94 }
95
96 function _unsupportedIterableToArray(o, minLen) {
97 if (!o) return;
98 if (typeof o === "string") return _arrayLikeToArray(o, minLen);
99 var n = Object.prototype.toString.call(o).slice(8, -1);
100 if (n === "Object" && o.constructor) n = o.constructor.name;
101 if (n === "Map" || n === "Set") return Array.from(o);
102 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
103 }
104
105 function _arrayLikeToArray(arr, len) {
106 if (len == null || len > arr.length) len = arr.length;
107
108 for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
109
110 return arr2;
111 }
112
113 function _nonIterableSpread() {
114 throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
115 }
116
117 function _nonIterableRest() {
118 throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
119 }
120
121 function _createForOfIteratorHelper(o, allowArrayLike) {
122 var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
123
124 if (!it) {
125 if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
126 if (it) o = it;
127 var i = 0;
128
129 var F = function () {};
130
131 return {
132 s: F,
133 n: function () {
134 if (i >= o.length) return {
135 done: true
136 };
137 return {
138 done: false,
139 value: o[i++]
140 };
141 },
142 e: function (e) {
143 throw e;
144 },
145 f: F
146 };
147 }
148
149 throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
150 }
151
152 var normalCompletion = true,
153 didErr = false,
154 err;
155 return {
156 s: function () {
157 it = it.call(o);
158 },
159 n: function () {
160 var step = it.next();
161 normalCompletion = step.done;
162 return step;
163 },
164 e: function (e) {
165 didErr = true;
166 err = e;
167 },
168 f: function () {
169 try {
170 if (!normalCompletion && it.return != null) it.return();
171 } finally {
172 if (didErr) throw err;
173 }
174 }
175 };
176 }
177
178 var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
179
180 function createCommonjsModule(fn, module) {
181 return module = { exports: {} }, fn(module, module.exports), module.exports;
182 }
183
184 var check = function (it) {
185 return it && it.Math == Math && it;
186 };
187
188 // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
189 var global_1 =
190 // eslint-disable-next-line es-x/no-global-this -- safe
191 check(typeof globalThis == 'object' && globalThis) ||
192 check(typeof window == 'object' && window) ||
193 // eslint-disable-next-line no-restricted-globals -- safe
194 check(typeof self == 'object' && self) ||
195 check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
196 // eslint-disable-next-line no-new-func -- fallback
197 (function () { return this; })() || Function('return this')();
198
199 var fails = function (exec) {
200 try {
201 return !!exec();
202 } catch (error) {
203 return true;
204 }
205 };
206
207 // Detect IE8's incomplete defineProperty implementation
208 var descriptors = !fails(function () {
209 // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
210 return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
211 });
212
213 var functionBindNative = !fails(function () {
214 // eslint-disable-next-line es-x/no-function-prototype-bind -- safe
215 var test = (function () { /* empty */ }).bind();
216 // eslint-disable-next-line no-prototype-builtins -- safe
217 return typeof test != 'function' || test.hasOwnProperty('prototype');
218 });
219
220 var call$2 = Function.prototype.call;
221
222 var functionCall = functionBindNative ? call$2.bind(call$2) : function () {
223 return call$2.apply(call$2, arguments);
224 };
225
226 var $propertyIsEnumerable$1 = {}.propertyIsEnumerable;
227 // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
228 var getOwnPropertyDescriptor$4 = Object.getOwnPropertyDescriptor;
229
230 // Nashorn ~ JDK8 bug
231 var NASHORN_BUG = getOwnPropertyDescriptor$4 && !$propertyIsEnumerable$1.call({ 1: 2 }, 1);
232
233 // `Object.prototype.propertyIsEnumerable` method implementation
234 // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
235 var f$5 = NASHORN_BUG ? function propertyIsEnumerable(V) {
236 var descriptor = getOwnPropertyDescriptor$4(this, V);
237 return !!descriptor && descriptor.enumerable;
238 } : $propertyIsEnumerable$1;
239
240 var objectPropertyIsEnumerable = {
241 f: f$5
242 };
243
244 var createPropertyDescriptor = function (bitmap, value) {
245 return {
246 enumerable: !(bitmap & 1),
247 configurable: !(bitmap & 2),
248 writable: !(bitmap & 4),
249 value: value
250 };
251 };
252
253 var FunctionPrototype$2 = Function.prototype;
254 var bind$1 = FunctionPrototype$2.bind;
255 var call$1 = FunctionPrototype$2.call;
256 var uncurryThis = functionBindNative && bind$1.bind(call$1, call$1);
257
258 var functionUncurryThis = functionBindNative ? function (fn) {
259 return fn && uncurryThis(fn);
260 } : function (fn) {
261 return fn && function () {
262 return call$1.apply(fn, arguments);
263 };
264 };
265
266 var toString$1 = functionUncurryThis({}.toString);
267 var stringSlice$7 = functionUncurryThis(''.slice);
268
269 var classofRaw = function (it) {
270 return stringSlice$7(toString$1(it), 8, -1);
271 };
272
273 var Object$5 = global_1.Object;
274 var split = functionUncurryThis(''.split);
275
276 // fallback for non-array-like ES3 and non-enumerable old V8 strings
277 var indexedObject = fails(function () {
278 // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
279 // eslint-disable-next-line no-prototype-builtins -- safe
280 return !Object$5('z').propertyIsEnumerable(0);
281 }) ? function (it) {
282 return classofRaw(it) == 'String' ? split(it, '') : Object$5(it);
283 } : Object$5;
284
285 var TypeError$e = global_1.TypeError;
286
287 // `RequireObjectCoercible` abstract operation
288 // https://tc39.es/ecma262/#sec-requireobjectcoercible
289 var requireObjectCoercible = function (it) {
290 if (it == undefined) throw TypeError$e("Can't call method on " + it);
291 return it;
292 };
293
294 // toObject with fallback for non-array-like ES3 strings
295
296
297
298 var toIndexedObject = function (it) {
299 return indexedObject(requireObjectCoercible(it));
300 };
301
302 // `IsCallable` abstract operation
303 // https://tc39.es/ecma262/#sec-iscallable
304 var isCallable = function (argument) {
305 return typeof argument == 'function';
306 };
307
308 var isObject = function (it) {
309 return typeof it == 'object' ? it !== null : isCallable(it);
310 };
311
312 var aFunction = function (argument) {
313 return isCallable(argument) ? argument : undefined;
314 };
315
316 var getBuiltIn = function (namespace, method) {
317 return arguments.length < 2 ? aFunction(global_1[namespace]) : global_1[namespace] && global_1[namespace][method];
318 };
319
320 var objectIsPrototypeOf = functionUncurryThis({}.isPrototypeOf);
321
322 var engineUserAgent = getBuiltIn('navigator', 'userAgent') || '';
323
324 var process = global_1.process;
325 var Deno = global_1.Deno;
326 var versions = process && process.versions || Deno && Deno.version;
327 var v8 = versions && versions.v8;
328 var match, version;
329
330 if (v8) {
331 match = v8.split('.');
332 // in old Chrome, versions of V8 isn't V8 = Chrome / 10
333 // but their correct versions are not interesting for us
334 version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
335 }
336
337 // BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
338 // so check `userAgent` even if `.v8` exists, but 0
339 if (!version && engineUserAgent) {
340 match = engineUserAgent.match(/Edge\/(\d+)/);
341 if (!match || match[1] >= 74) {
342 match = engineUserAgent.match(/Chrome\/(\d+)/);
343 if (match) version = +match[1];
344 }
345 }
346
347 var engineV8Version = version;
348
349 /* eslint-disable es-x/no-symbol -- required for testing */
350
351
352
353 // eslint-disable-next-line es-x/no-object-getownpropertysymbols -- required for testing
354 var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () {
355 var symbol = Symbol();
356 // Chrome 38 Symbol has incorrect toString conversion
357 // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
358 return !String(symbol) || !(Object(symbol) instanceof Symbol) ||
359 // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
360 !Symbol.sham && engineV8Version && engineV8Version < 41;
361 });
362
363 /* eslint-disable es-x/no-symbol -- required for testing */
364
365
366 var useSymbolAsUid = nativeSymbol
367 && !Symbol.sham
368 && typeof Symbol.iterator == 'symbol';
369
370 var Object$4 = global_1.Object;
371
372 var isSymbol = useSymbolAsUid ? function (it) {
373 return typeof it == 'symbol';
374 } : function (it) {
375 var $Symbol = getBuiltIn('Symbol');
376 return isCallable($Symbol) && objectIsPrototypeOf($Symbol.prototype, Object$4(it));
377 };
378
379 var String$4 = global_1.String;
380
381 var tryToString = function (argument) {
382 try {
383 return String$4(argument);
384 } catch (error) {
385 return 'Object';
386 }
387 };
388
389 var TypeError$d = global_1.TypeError;
390
391 // `Assert: IsCallable(argument) is true`
392 var aCallable = function (argument) {
393 if (isCallable(argument)) return argument;
394 throw TypeError$d(tryToString(argument) + ' is not a function');
395 };
396
397 // `GetMethod` abstract operation
398 // https://tc39.es/ecma262/#sec-getmethod
399 var getMethod = function (V, P) {
400 var func = V[P];
401 return func == null ? undefined : aCallable(func);
402 };
403
404 var TypeError$c = global_1.TypeError;
405
406 // `OrdinaryToPrimitive` abstract operation
407 // https://tc39.es/ecma262/#sec-ordinarytoprimitive
408 var ordinaryToPrimitive = function (input, pref) {
409 var fn, val;
410 if (pref === 'string' && isCallable(fn = input.toString) && !isObject(val = functionCall(fn, input))) return val;
411 if (isCallable(fn = input.valueOf) && !isObject(val = functionCall(fn, input))) return val;
412 if (pref !== 'string' && isCallable(fn = input.toString) && !isObject(val = functionCall(fn, input))) return val;
413 throw TypeError$c("Can't convert object to primitive value");
414 };
415
416 // eslint-disable-next-line es-x/no-object-defineproperty -- safe
417 var defineProperty$5 = Object.defineProperty;
418
419 var setGlobal = function (key, value) {
420 try {
421 defineProperty$5(global_1, key, { value: value, configurable: true, writable: true });
422 } catch (error) {
423 global_1[key] = value;
424 } return value;
425 };
426
427 var SHARED = '__core-js_shared__';
428 var store$1 = global_1[SHARED] || setGlobal(SHARED, {});
429
430 var sharedStore = store$1;
431
432 var shared = createCommonjsModule(function (module) {
433 (module.exports = function (key, value) {
434 return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {});
435 })('versions', []).push({
436 version: '3.22.4',
437 mode: 'global',
438 copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
439 license: 'https://github.com/zloirock/core-js/blob/v3.22.4/LICENSE',
440 source: 'https://github.com/zloirock/core-js'
441 });
442 });
443
444 var Object$3 = global_1.Object;
445
446 // `ToObject` abstract operation
447 // https://tc39.es/ecma262/#sec-toobject
448 var toObject = function (argument) {
449 return Object$3(requireObjectCoercible(argument));
450 };
451
452 var hasOwnProperty = functionUncurryThis({}.hasOwnProperty);
453
454 // `HasOwnProperty` abstract operation
455 // https://tc39.es/ecma262/#sec-hasownproperty
456 // eslint-disable-next-line es-x/no-object-hasown -- safe
457 var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
458 return hasOwnProperty(toObject(it), key);
459 };
460
461 var id = 0;
462 var postfix = Math.random();
463 var toString = functionUncurryThis(1.0.toString);
464
465 var uid = function (key) {
466 return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id + postfix, 36);
467 };
468
469 var WellKnownSymbolsStore = shared('wks');
470 var Symbol$3 = global_1.Symbol;
471 var symbolFor = Symbol$3 && Symbol$3['for'];
472 var createWellKnownSymbol = useSymbolAsUid ? Symbol$3 : Symbol$3 && Symbol$3.withoutSetter || uid;
473
474 var wellKnownSymbol = function (name) {
475 if (!hasOwnProperty_1(WellKnownSymbolsStore, name) || !(nativeSymbol || typeof WellKnownSymbolsStore[name] == 'string')) {
476 var description = 'Symbol.' + name;
477 if (nativeSymbol && hasOwnProperty_1(Symbol$3, name)) {
478 WellKnownSymbolsStore[name] = Symbol$3[name];
479 } else if (useSymbolAsUid && symbolFor) {
480 WellKnownSymbolsStore[name] = symbolFor(description);
481 } else {
482 WellKnownSymbolsStore[name] = createWellKnownSymbol(description);
483 }
484 } return WellKnownSymbolsStore[name];
485 };
486
487 var TypeError$b = global_1.TypeError;
488 var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
489
490 // `ToPrimitive` abstract operation
491 // https://tc39.es/ecma262/#sec-toprimitive
492 var toPrimitive = function (input, pref) {
493 if (!isObject(input) || isSymbol(input)) return input;
494 var exoticToPrim = getMethod(input, TO_PRIMITIVE);
495 var result;
496 if (exoticToPrim) {
497 if (pref === undefined) pref = 'default';
498 result = functionCall(exoticToPrim, input, pref);
499 if (!isObject(result) || isSymbol(result)) return result;
500 throw TypeError$b("Can't convert object to primitive value");
501 }
502 if (pref === undefined) pref = 'number';
503 return ordinaryToPrimitive(input, pref);
504 };
505
506 // `ToPropertyKey` abstract operation
507 // https://tc39.es/ecma262/#sec-topropertykey
508 var toPropertyKey = function (argument) {
509 var key = toPrimitive(argument, 'string');
510 return isSymbol(key) ? key : key + '';
511 };
512
513 var document$1 = global_1.document;
514 // typeof document.createElement is 'object' in old IE
515 var EXISTS$1 = isObject(document$1) && isObject(document$1.createElement);
516
517 var documentCreateElement = function (it) {
518 return EXISTS$1 ? document$1.createElement(it) : {};
519 };
520
521 // Thanks to IE8 for its funny defineProperty
522 var ie8DomDefine = !descriptors && !fails(function () {
523 // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
524 return Object.defineProperty(documentCreateElement('div'), 'a', {
525 get: function () { return 7; }
526 }).a != 7;
527 });
528
529 // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
530 var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
531
532 // `Object.getOwnPropertyDescriptor` method
533 // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
534 var f$4 = descriptors ? $getOwnPropertyDescriptor$1 : function getOwnPropertyDescriptor(O, P) {
535 O = toIndexedObject(O);
536 P = toPropertyKey(P);
537 if (ie8DomDefine) try {
538 return $getOwnPropertyDescriptor$1(O, P);
539 } catch (error) { /* empty */ }
540 if (hasOwnProperty_1(O, P)) return createPropertyDescriptor(!functionCall(objectPropertyIsEnumerable.f, O, P), O[P]);
541 };
542
543 var objectGetOwnPropertyDescriptor = {
544 f: f$4
545 };
546
547 // V8 ~ Chrome 36-
548 // https://bugs.chromium.org/p/v8/issues/detail?id=3334
549 var v8PrototypeDefineBug = descriptors && fails(function () {
550 // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
551 return Object.defineProperty(function () { /* empty */ }, 'prototype', {
552 value: 42,
553 writable: false
554 }).prototype != 42;
555 });
556
557 var String$3 = global_1.String;
558 var TypeError$a = global_1.TypeError;
559
560 // `Assert: Type(argument) is Object`
561 var anObject = function (argument) {
562 if (isObject(argument)) return argument;
563 throw TypeError$a(String$3(argument) + ' is not an object');
564 };
565
566 var TypeError$9 = global_1.TypeError;
567 // eslint-disable-next-line es-x/no-object-defineproperty -- safe
568 var $defineProperty = Object.defineProperty;
569 // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
570 var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
571 var ENUMERABLE = 'enumerable';
572 var CONFIGURABLE$1 = 'configurable';
573 var WRITABLE = 'writable';
574
575 // `Object.defineProperty` method
576 // https://tc39.es/ecma262/#sec-object.defineproperty
577 var f$3 = descriptors ? v8PrototypeDefineBug ? function defineProperty(O, P, Attributes) {
578 anObject(O);
579 P = toPropertyKey(P);
580 anObject(Attributes);
581 if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
582 var current = $getOwnPropertyDescriptor(O, P);
583 if (current && current[WRITABLE]) {
584 O[P] = Attributes.value;
585 Attributes = {
586 configurable: CONFIGURABLE$1 in Attributes ? Attributes[CONFIGURABLE$1] : current[CONFIGURABLE$1],
587 enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
588 writable: false
589 };
590 }
591 } return $defineProperty(O, P, Attributes);
592 } : $defineProperty : function defineProperty(O, P, Attributes) {
593 anObject(O);
594 P = toPropertyKey(P);
595 anObject(Attributes);
596 if (ie8DomDefine) try {
597 return $defineProperty(O, P, Attributes);
598 } catch (error) { /* empty */ }
599 if ('get' in Attributes || 'set' in Attributes) throw TypeError$9('Accessors not supported');
600 if ('value' in Attributes) O[P] = Attributes.value;
601 return O;
602 };
603
604 var objectDefineProperty = {
605 f: f$3
606 };
607
608 var createNonEnumerableProperty = descriptors ? function (object, key, value) {
609 return objectDefineProperty.f(object, key, createPropertyDescriptor(1, value));
610 } : function (object, key, value) {
611 object[key] = value;
612 return object;
613 };
614
615 var FunctionPrototype$1 = Function.prototype;
616 // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
617 var getDescriptor = descriptors && Object.getOwnPropertyDescriptor;
618
619 var EXISTS = hasOwnProperty_1(FunctionPrototype$1, 'name');
620 // additional protection from minified / mangled / dropped function names
621 var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
622 var CONFIGURABLE = EXISTS && (!descriptors || (descriptors && getDescriptor(FunctionPrototype$1, 'name').configurable));
623
624 var functionName = {
625 EXISTS: EXISTS,
626 PROPER: PROPER,
627 CONFIGURABLE: CONFIGURABLE
628 };
629
630 var functionToString = functionUncurryThis(Function.toString);
631
632 // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
633 if (!isCallable(sharedStore.inspectSource)) {
634 sharedStore.inspectSource = function (it) {
635 return functionToString(it);
636 };
637 }
638
639 var inspectSource = sharedStore.inspectSource;
640
641 var WeakMap$1 = global_1.WeakMap;
642
643 var nativeWeakMap = isCallable(WeakMap$1) && /native code/.test(inspectSource(WeakMap$1));
644
645 var keys$2 = shared('keys');
646
647 var sharedKey = function (key) {
648 return keys$2[key] || (keys$2[key] = uid(key));
649 };
650
651 var hiddenKeys$1 = {};
652
653 var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
654 var TypeError$8 = global_1.TypeError;
655 var WeakMap = global_1.WeakMap;
656 var set, get, has;
657
658 var enforce = function (it) {
659 return has(it) ? get(it) : set(it, {});
660 };
661
662 var getterFor = function (TYPE) {
663 return function (it) {
664 var state;
665 if (!isObject(it) || (state = get(it)).type !== TYPE) {
666 throw TypeError$8('Incompatible receiver, ' + TYPE + ' required');
667 } return state;
668 };
669 };
670
671 if (nativeWeakMap || sharedStore.state) {
672 var store = sharedStore.state || (sharedStore.state = new WeakMap());
673 var wmget = functionUncurryThis(store.get);
674 var wmhas = functionUncurryThis(store.has);
675 var wmset = functionUncurryThis(store.set);
676 set = function (it, metadata) {
677 if (wmhas(store, it)) throw new TypeError$8(OBJECT_ALREADY_INITIALIZED);
678 metadata.facade = it;
679 wmset(store, it, metadata);
680 return metadata;
681 };
682 get = function (it) {
683 return wmget(store, it) || {};
684 };
685 has = function (it) {
686 return wmhas(store, it);
687 };
688 } else {
689 var STATE = sharedKey('state');
690 hiddenKeys$1[STATE] = true;
691 set = function (it, metadata) {
692 if (hasOwnProperty_1(it, STATE)) throw new TypeError$8(OBJECT_ALREADY_INITIALIZED);
693 metadata.facade = it;
694 createNonEnumerableProperty(it, STATE, metadata);
695 return metadata;
696 };
697 get = function (it) {
698 return hasOwnProperty_1(it, STATE) ? it[STATE] : {};
699 };
700 has = function (it) {
701 return hasOwnProperty_1(it, STATE);
702 };
703 }
704
705 var internalState = {
706 set: set,
707 get: get,
708 has: has,
709 enforce: enforce,
710 getterFor: getterFor
711 };
712
713 var makeBuiltIn_1 = createCommonjsModule(function (module) {
714 var defineProperty = objectDefineProperty.f;
715 var CONFIGURABLE_FUNCTION_NAME = functionName.CONFIGURABLE;
716
717
718
719 var enforceInternalState = internalState.enforce;
720 var getInternalState = internalState.get;
721
722 var CONFIGURABLE_LENGTH = !fails(function () {
723 return defineProperty(function () { /* empty */ }, 'length', { value: 8 }).length !== 8;
724 });
725
726 var TEMPLATE = String(String).split('String');
727
728 var makeBuiltIn = module.exports = function (value, name, options) {
729 if (String(name).slice(0, 7) === 'Symbol(') {
730 name = '[' + String(name).replace(/^Symbol\(([^)]*)\)/, '$1') + ']';
731 }
732 if (options && options.getter) name = 'get ' + name;
733 if (options && options.setter) name = 'set ' + name;
734 if (!hasOwnProperty_1(value, 'name') || (CONFIGURABLE_FUNCTION_NAME && value.name !== name)) {
735 defineProperty(value, 'name', { value: name, configurable: true });
736 }
737 if (CONFIGURABLE_LENGTH && options && hasOwnProperty_1(options, 'arity') && value.length !== options.arity) {
738 defineProperty(value, 'length', { value: options.arity });
739 }
740 var state = enforceInternalState(value);
741 if (!hasOwnProperty_1(state, 'source')) {
742 state.source = TEMPLATE.join(typeof name == 'string' ? name : '');
743 } return value;
744 };
745
746 // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
747 // eslint-disable-next-line no-extend-native -- required
748 Function.prototype.toString = makeBuiltIn(function toString() {
749 return isCallable(this) && getInternalState(this).source || inspectSource(this);
750 }, 'toString');
751 });
752
753 var defineBuiltIn = function (O, key, value, options) {
754 var unsafe = options ? !!options.unsafe : false;
755 var simple = options ? !!options.enumerable : false;
756 var noTargetGet = options ? !!options.noTargetGet : false;
757 var name = options && options.name !== undefined ? options.name : key;
758 if (isCallable(value)) makeBuiltIn_1(value, name, options);
759 if (O === global_1) {
760 if (simple) O[key] = value;
761 else setGlobal(key, value);
762 return O;
763 } else if (!unsafe) {
764 delete O[key];
765 } else if (!noTargetGet && O[key]) {
766 simple = true;
767 }
768 if (simple) O[key] = value;
769 else createNonEnumerableProperty(O, key, value);
770 return O;
771 };
772
773 var ceil = Math.ceil;
774 var floor$2 = Math.floor;
775
776 // `ToIntegerOrInfinity` abstract operation
777 // https://tc39.es/ecma262/#sec-tointegerorinfinity
778 var toIntegerOrInfinity = function (argument) {
779 var number = +argument;
780 // eslint-disable-next-line no-self-compare -- safe
781 return number !== number || number === 0 ? 0 : (number > 0 ? floor$2 : ceil)(number);
782 };
783
784 var max$4 = Math.max;
785 var min$6 = Math.min;
786
787 // Helper for a popular repeating case of the spec:
788 // Let integer be ? ToInteger(index).
789 // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
790 var toAbsoluteIndex = function (index, length) {
791 var integer = toIntegerOrInfinity(index);
792 return integer < 0 ? max$4(integer + length, 0) : min$6(integer, length);
793 };
794
795 var min$5 = Math.min;
796
797 // `ToLength` abstract operation
798 // https://tc39.es/ecma262/#sec-tolength
799 var toLength = function (argument) {
800 return argument > 0 ? min$5(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
801 };
802
803 // `LengthOfArrayLike` abstract operation
804 // https://tc39.es/ecma262/#sec-lengthofarraylike
805 var lengthOfArrayLike = function (obj) {
806 return toLength(obj.length);
807 };
808
809 // `Array.prototype.{ indexOf, includes }` methods implementation
810 var createMethod$4 = function (IS_INCLUDES) {
811 return function ($this, el, fromIndex) {
812 var O = toIndexedObject($this);
813 var length = lengthOfArrayLike(O);
814 var index = toAbsoluteIndex(fromIndex, length);
815 var value;
816 // Array#includes uses SameValueZero equality algorithm
817 // eslint-disable-next-line no-self-compare -- NaN check
818 if (IS_INCLUDES && el != el) while (length > index) {
819 value = O[index++];
820 // eslint-disable-next-line no-self-compare -- NaN check
821 if (value != value) return true;
822 // Array#indexOf ignores holes, Array#includes - not
823 } else for (;length > index; index++) {
824 if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
825 } return !IS_INCLUDES && -1;
826 };
827 };
828
829 var arrayIncludes = {
830 // `Array.prototype.includes` method
831 // https://tc39.es/ecma262/#sec-array.prototype.includes
832 includes: createMethod$4(true),
833 // `Array.prototype.indexOf` method
834 // https://tc39.es/ecma262/#sec-array.prototype.indexof
835 indexOf: createMethod$4(false)
836 };
837
838 var indexOf$1 = arrayIncludes.indexOf;
839
840
841 var push$5 = functionUncurryThis([].push);
842
843 var objectKeysInternal = function (object, names) {
844 var O = toIndexedObject(object);
845 var i = 0;
846 var result = [];
847 var key;
848 for (key in O) !hasOwnProperty_1(hiddenKeys$1, key) && hasOwnProperty_1(O, key) && push$5(result, key);
849 // Don't enum bug & hidden keys
850 while (names.length > i) if (hasOwnProperty_1(O, key = names[i++])) {
851 ~indexOf$1(result, key) || push$5(result, key);
852 }
853 return result;
854 };
855
856 // IE8- don't enum bug keys
857 var enumBugKeys = [
858 'constructor',
859 'hasOwnProperty',
860 'isPrototypeOf',
861 'propertyIsEnumerable',
862 'toLocaleString',
863 'toString',
864 'valueOf'
865 ];
866
867 var hiddenKeys = enumBugKeys.concat('length', 'prototype');
868
869 // `Object.getOwnPropertyNames` method
870 // https://tc39.es/ecma262/#sec-object.getownpropertynames
871 // eslint-disable-next-line es-x/no-object-getownpropertynames -- safe
872 var f$2 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
873 return objectKeysInternal(O, hiddenKeys);
874 };
875
876 var objectGetOwnPropertyNames = {
877 f: f$2
878 };
879
880 // eslint-disable-next-line es-x/no-object-getownpropertysymbols -- safe
881 var f$1 = Object.getOwnPropertySymbols;
882
883 var objectGetOwnPropertySymbols = {
884 f: f$1
885 };
886
887 var concat$2 = functionUncurryThis([].concat);
888
889 // all object keys, includes non-enumerable and symbols
890 var ownKeys = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
891 var keys = objectGetOwnPropertyNames.f(anObject(it));
892 var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
893 return getOwnPropertySymbols ? concat$2(keys, getOwnPropertySymbols(it)) : keys;
894 };
895
896 var copyConstructorProperties = function (target, source, exceptions) {
897 var keys = ownKeys(source);
898 var defineProperty = objectDefineProperty.f;
899 var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
900 for (var i = 0; i < keys.length; i++) {
901 var key = keys[i];
902 if (!hasOwnProperty_1(target, key) && !(exceptions && hasOwnProperty_1(exceptions, key))) {
903 defineProperty(target, key, getOwnPropertyDescriptor(source, key));
904 }
905 }
906 };
907
908 var replacement = /#|\.prototype\./;
909
910 var isForced = function (feature, detection) {
911 var value = data[normalize(feature)];
912 return value == POLYFILL ? true
913 : value == NATIVE ? false
914 : isCallable(detection) ? fails(detection)
915 : !!detection;
916 };
917
918 var normalize = isForced.normalize = function (string) {
919 return String(string).replace(replacement, '.').toLowerCase();
920 };
921
922 var data = isForced.data = {};
923 var NATIVE = isForced.NATIVE = 'N';
924 var POLYFILL = isForced.POLYFILL = 'P';
925
926 var isForced_1 = isForced;
927
928 var getOwnPropertyDescriptor$3 = objectGetOwnPropertyDescriptor.f;
929
930
931
932
933
934
935 /*
936 options.target - name of the target object
937 options.global - target is the global object
938 options.stat - export as static methods of target
939 options.proto - export as prototype methods of target
940 options.real - real prototype method for the `pure` version
941 options.forced - export even if the native feature is available
942 options.bind - bind methods to the target, required for the `pure` version
943 options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
944 options.unsafe - use the simple assignment of property instead of delete + defineProperty
945 options.sham - add a flag to not completely full polyfills
946 options.enumerable - export as enumerable property
947 options.noTargetGet - prevent calling a getter on target
948 options.name - the .name of the function if it does not match the key
949 */
950 var _export = function (options, source) {
951 var TARGET = options.target;
952 var GLOBAL = options.global;
953 var STATIC = options.stat;
954 var FORCED, target, key, targetProperty, sourceProperty, descriptor;
955 if (GLOBAL) {
956 target = global_1;
957 } else if (STATIC) {
958 target = global_1[TARGET] || setGlobal(TARGET, {});
959 } else {
960 target = (global_1[TARGET] || {}).prototype;
961 }
962 if (target) for (key in source) {
963 sourceProperty = source[key];
964 if (options.noTargetGet) {
965 descriptor = getOwnPropertyDescriptor$3(target, key);
966 targetProperty = descriptor && descriptor.value;
967 } else targetProperty = target[key];
968 FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
969 // contained in target
970 if (!FORCED && targetProperty !== undefined) {
971 if (typeof sourceProperty == typeof targetProperty) continue;
972 copyConstructorProperties(sourceProperty, targetProperty);
973 }
974 // add a flag to not completely full polyfills
975 if (options.sham || (targetProperty && targetProperty.sham)) {
976 createNonEnumerableProperty(sourceProperty, 'sham', true);
977 }
978 defineBuiltIn(target, key, sourceProperty, options);
979 }
980 };
981
982 // `Object.keys` method
983 // https://tc39.es/ecma262/#sec-object.keys
984 // eslint-disable-next-line es-x/no-object-keys -- safe
985 var objectKeys = Object.keys || function keys(O) {
986 return objectKeysInternal(O, enumBugKeys);
987 };
988
989 // eslint-disable-next-line es-x/no-object-assign -- safe
990 var $assign = Object.assign;
991 // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
992 var defineProperty$4 = Object.defineProperty;
993 var concat$1 = functionUncurryThis([].concat);
994
995 // `Object.assign` method
996 // https://tc39.es/ecma262/#sec-object.assign
997 var objectAssign = !$assign || fails(function () {
998 // should have correct order of operations (Edge bug)
999 if (descriptors && $assign({ b: 1 }, $assign(defineProperty$4({}, 'a', {
1000 enumerable: true,
1001 get: function () {
1002 defineProperty$4(this, 'b', {
1003 value: 3,
1004 enumerable: false
1005 });
1006 }
1007 }), { b: 2 })).b !== 1) return true;
1008 // should work with symbols and should have deterministic property order (V8 bug)
1009 var A = {};
1010 var B = {};
1011 // eslint-disable-next-line es-x/no-symbol -- safe
1012 var symbol = Symbol();
1013 var alphabet = 'abcdefghijklmnopqrst';
1014 A[symbol] = 7;
1015 alphabet.split('').forEach(function (chr) { B[chr] = chr; });
1016 return $assign({}, A)[symbol] != 7 || objectKeys($assign({}, B)).join('') != alphabet;
1017 }) ? function assign(target, source) { // eslint-disable-line no-unused-vars -- required for `.length`
1018 var T = toObject(target);
1019 var argumentsLength = arguments.length;
1020 var index = 1;
1021 var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
1022 var propertyIsEnumerable = objectPropertyIsEnumerable.f;
1023 while (argumentsLength > index) {
1024 var S = indexedObject(arguments[index++]);
1025 var keys = getOwnPropertySymbols ? concat$1(objectKeys(S), getOwnPropertySymbols(S)) : objectKeys(S);
1026 var length = keys.length;
1027 var j = 0;
1028 var key;
1029 while (length > j) {
1030 key = keys[j++];
1031 if (!descriptors || functionCall(propertyIsEnumerable, S, key)) T[key] = S[key];
1032 }
1033 } return T;
1034 } : $assign;
1035
1036 // `Object.assign` method
1037 // https://tc39.es/ecma262/#sec-object.assign
1038 // eslint-disable-next-line es-x/no-object-assign -- required for testing
1039 _export({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== objectAssign }, {
1040 assign: objectAssign
1041 });
1042
1043 var TO_STRING_TAG$3 = wellKnownSymbol('toStringTag');
1044 var test$2 = {};
1045
1046 test$2[TO_STRING_TAG$3] = 'z';
1047
1048 var toStringTagSupport = String(test$2) === '[object z]';
1049
1050 var TO_STRING_TAG$2 = wellKnownSymbol('toStringTag');
1051 var Object$2 = global_1.Object;
1052
1053 // ES3 wrong here
1054 var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
1055
1056 // fallback for IE11 Script Access Denied error
1057 var tryGet = function (it, key) {
1058 try {
1059 return it[key];
1060 } catch (error) { /* empty */ }
1061 };
1062
1063 // getting tag from ES6+ `Object.prototype.toString`
1064 var classof = toStringTagSupport ? classofRaw : function (it) {
1065 var O, tag, result;
1066 return it === undefined ? 'Undefined' : it === null ? 'Null'
1067 // @@toStringTag case
1068 : typeof (tag = tryGet(O = Object$2(it), TO_STRING_TAG$2)) == 'string' ? tag
1069 // builtinTag case
1070 : CORRECT_ARGUMENTS ? classofRaw(O)
1071 // ES3 arguments fallback
1072 : (result = classofRaw(O)) == 'Object' && isCallable(O.callee) ? 'Arguments' : result;
1073 };
1074
1075 var String$2 = global_1.String;
1076
1077 var toString_1 = function (argument) {
1078 if (classof(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string');
1079 return String$2(argument);
1080 };
1081
1082 // a string of all valid unicode whitespaces
1083 var whitespaces = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' +
1084 '\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
1085
1086 var replace$3 = functionUncurryThis(''.replace);
1087 var whitespace = '[' + whitespaces + ']';
1088 var ltrim = RegExp('^' + whitespace + whitespace + '*');
1089 var rtrim = RegExp(whitespace + whitespace + '*$');
1090
1091 // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
1092 var createMethod$3 = function (TYPE) {
1093 return function ($this) {
1094 var string = toString_1(requireObjectCoercible($this));
1095 if (TYPE & 1) string = replace$3(string, ltrim, '');
1096 if (TYPE & 2) string = replace$3(string, rtrim, '');
1097 return string;
1098 };
1099 };
1100
1101 var stringTrim = {
1102 // `String.prototype.{ trimLeft, trimStart }` methods
1103 // https://tc39.es/ecma262/#sec-string.prototype.trimstart
1104 start: createMethod$3(1),
1105 // `String.prototype.{ trimRight, trimEnd }` methods
1106 // https://tc39.es/ecma262/#sec-string.prototype.trimend
1107 end: createMethod$3(2),
1108 // `String.prototype.trim` method
1109 // https://tc39.es/ecma262/#sec-string.prototype.trim
1110 trim: createMethod$3(3)
1111 };
1112
1113 var PROPER_FUNCTION_NAME$2 = functionName.PROPER;
1114
1115
1116
1117 var non = '\u200B\u0085\u180E';
1118
1119 // check that a method works with the correct list
1120 // of whitespaces and has a correct name
1121 var stringTrimForced = function (METHOD_NAME) {
1122 return fails(function () {
1123 return !!whitespaces[METHOD_NAME]()
1124 || non[METHOD_NAME]() !== non
1125 || (PROPER_FUNCTION_NAME$2 && whitespaces[METHOD_NAME].name !== METHOD_NAME);
1126 });
1127 };
1128
1129 var $trim = stringTrim.trim;
1130
1131
1132 // `String.prototype.trim` method
1133 // https://tc39.es/ecma262/#sec-string.prototype.trim
1134 _export({ target: 'String', proto: true, forced: stringTrimForced('trim') }, {
1135 trim: function trim() {
1136 return $trim(this);
1137 }
1138 });
1139
1140 var arrayMethodIsStrict = function (METHOD_NAME, argument) {
1141 var method = [][METHOD_NAME];
1142 return !!method && fails(function () {
1143 // eslint-disable-next-line no-useless-call -- required for testing
1144 method.call(null, argument || function () { return 1; }, 1);
1145 });
1146 };
1147
1148 var un$Join = functionUncurryThis([].join);
1149
1150 var ES3_STRINGS = indexedObject != Object;
1151 var STRICT_METHOD$3 = arrayMethodIsStrict('join', ',');
1152
1153 // `Array.prototype.join` method
1154 // https://tc39.es/ecma262/#sec-array.prototype.join
1155 _export({ target: 'Array', proto: true, forced: ES3_STRINGS || !STRICT_METHOD$3 }, {
1156 join: function join(separator) {
1157 return un$Join(toIndexedObject(this), separator === undefined ? ',' : separator);
1158 }
1159 });
1160
1161 // `RegExp.prototype.flags` getter implementation
1162 // https://tc39.es/ecma262/#sec-get-regexp.prototype.flags
1163 var regexpFlags = function () {
1164 var that = anObject(this);
1165 var result = '';
1166 if (that.hasIndices) result += 'd';
1167 if (that.global) result += 'g';
1168 if (that.ignoreCase) result += 'i';
1169 if (that.multiline) result += 'm';
1170 if (that.dotAll) result += 's';
1171 if (that.unicode) result += 'u';
1172 if (that.sticky) result += 'y';
1173 return result;
1174 };
1175
1176 // babel-minify and Closure Compiler transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError
1177 var $RegExp$2 = global_1.RegExp;
1178
1179 var UNSUPPORTED_Y$3 = fails(function () {
1180 var re = $RegExp$2('a', 'y');
1181 re.lastIndex = 2;
1182 return re.exec('abcd') != null;
1183 });
1184
1185 // UC Browser bug
1186 // https://github.com/zloirock/core-js/issues/1008
1187 var MISSED_STICKY$1 = UNSUPPORTED_Y$3 || fails(function () {
1188 return !$RegExp$2('a', 'y').sticky;
1189 });
1190
1191 var BROKEN_CARET = UNSUPPORTED_Y$3 || fails(function () {
1192 // https://bugzilla.mozilla.org/show_bug.cgi?id=773687
1193 var re = $RegExp$2('^r', 'gy');
1194 re.lastIndex = 2;
1195 return re.exec('str') != null;
1196 });
1197
1198 var regexpStickyHelpers = {
1199 BROKEN_CARET: BROKEN_CARET,
1200 MISSED_STICKY: MISSED_STICKY$1,
1201 UNSUPPORTED_Y: UNSUPPORTED_Y$3
1202 };
1203
1204 // `Object.defineProperties` method
1205 // https://tc39.es/ecma262/#sec-object.defineproperties
1206 // eslint-disable-next-line es-x/no-object-defineproperties -- safe
1207 var f = descriptors && !v8PrototypeDefineBug ? Object.defineProperties : function defineProperties(O, Properties) {
1208 anObject(O);
1209 var props = toIndexedObject(Properties);
1210 var keys = objectKeys(Properties);
1211 var length = keys.length;
1212 var index = 0;
1213 var key;
1214 while (length > index) objectDefineProperty.f(O, key = keys[index++], props[key]);
1215 return O;
1216 };
1217
1218 var objectDefineProperties = {
1219 f: f
1220 };
1221
1222 var html = getBuiltIn('document', 'documentElement');
1223
1224 /* global ActiveXObject -- old IE, WSH */
1225
1226
1227
1228
1229
1230
1231
1232
1233 var GT = '>';
1234 var LT = '<';
1235 var PROTOTYPE = 'prototype';
1236 var SCRIPT = 'script';
1237 var IE_PROTO$1 = sharedKey('IE_PROTO');
1238
1239 var EmptyConstructor = function () { /* empty */ };
1240
1241 var scriptTag = function (content) {
1242 return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
1243 };
1244
1245 // Create object with fake `null` prototype: use ActiveX Object with cleared prototype
1246 var NullProtoObjectViaActiveX = function (activeXDocument) {
1247 activeXDocument.write(scriptTag(''));
1248 activeXDocument.close();
1249 var temp = activeXDocument.parentWindow.Object;
1250 activeXDocument = null; // avoid memory leak
1251 return temp;
1252 };
1253
1254 // Create object with fake `null` prototype: use iframe Object with cleared prototype
1255 var NullProtoObjectViaIFrame = function () {
1256 // Thrash, waste and sodomy: IE GC bug
1257 var iframe = documentCreateElement('iframe');
1258 var JS = 'java' + SCRIPT + ':';
1259 var iframeDocument;
1260 iframe.style.display = 'none';
1261 html.appendChild(iframe);
1262 // https://github.com/zloirock/core-js/issues/475
1263 iframe.src = String(JS);
1264 iframeDocument = iframe.contentWindow.document;
1265 iframeDocument.open();
1266 iframeDocument.write(scriptTag('document.F=Object'));
1267 iframeDocument.close();
1268 return iframeDocument.F;
1269 };
1270
1271 // Check for document.domain and active x support
1272 // No need to use active x approach when document.domain is not set
1273 // see https://github.com/es-shims/es5-shim/issues/150
1274 // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
1275 // avoid IE GC bug
1276 var activeXDocument;
1277 var NullProtoObject = function () {
1278 try {
1279 activeXDocument = new ActiveXObject('htmlfile');
1280 } catch (error) { /* ignore */ }
1281 NullProtoObject = typeof document != 'undefined'
1282 ? document.domain && activeXDocument
1283 ? NullProtoObjectViaActiveX(activeXDocument) // old IE
1284 : NullProtoObjectViaIFrame()
1285 : NullProtoObjectViaActiveX(activeXDocument); // WSH
1286 var length = enumBugKeys.length;
1287 while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
1288 return NullProtoObject();
1289 };
1290
1291 hiddenKeys$1[IE_PROTO$1] = true;
1292
1293 // `Object.create` method
1294 // https://tc39.es/ecma262/#sec-object.create
1295 // eslint-disable-next-line es-x/no-object-create -- safe
1296 var objectCreate = Object.create || function create(O, Properties) {
1297 var result;
1298 if (O !== null) {
1299 EmptyConstructor[PROTOTYPE] = anObject(O);
1300 result = new EmptyConstructor();
1301 EmptyConstructor[PROTOTYPE] = null;
1302 // add "__proto__" for Object.getPrototypeOf polyfill
1303 result[IE_PROTO$1] = O;
1304 } else result = NullProtoObject();
1305 return Properties === undefined ? result : objectDefineProperties.f(result, Properties);
1306 };
1307
1308 // babel-minify and Closure Compiler transpiles RegExp('.', 's') -> /./s and it causes SyntaxError
1309 var $RegExp$1 = global_1.RegExp;
1310
1311 var regexpUnsupportedDotAll = fails(function () {
1312 var re = $RegExp$1('.', 's');
1313 return !(re.dotAll && re.exec('\n') && re.flags === 's');
1314 });
1315
1316 // babel-minify and Closure Compiler transpiles RegExp('(?<a>b)', 'g') -> /(?<a>b)/g and it causes SyntaxError
1317 var $RegExp = global_1.RegExp;
1318
1319 var regexpUnsupportedNcg = fails(function () {
1320 var re = $RegExp('(?<a>b)', 'g');
1321 return re.exec('b').groups.a !== 'b' ||
1322 'b'.replace(re, '$<a>c') !== 'bc';
1323 });
1324
1325 /* eslint-disable regexp/no-empty-capturing-group, regexp/no-empty-group, regexp/no-lazy-ends -- testing */
1326 /* eslint-disable regexp/no-useless-quantifier -- testing */
1327
1328
1329
1330
1331
1332
1333
1334 var getInternalState$1 = internalState.get;
1335
1336
1337
1338 var nativeReplace = shared('native-string-replace', String.prototype.replace);
1339 var nativeExec = RegExp.prototype.exec;
1340 var patchedExec = nativeExec;
1341 var charAt$5 = functionUncurryThis(''.charAt);
1342 var indexOf = functionUncurryThis(''.indexOf);
1343 var replace$2 = functionUncurryThis(''.replace);
1344 var stringSlice$6 = functionUncurryThis(''.slice);
1345
1346 var UPDATES_LAST_INDEX_WRONG = (function () {
1347 var re1 = /a/;
1348 var re2 = /b*/g;
1349 functionCall(nativeExec, re1, 'a');
1350 functionCall(nativeExec, re2, 'a');
1351 return re1.lastIndex !== 0 || re2.lastIndex !== 0;
1352 })();
1353
1354 var UNSUPPORTED_Y$2 = regexpStickyHelpers.BROKEN_CARET;
1355
1356 // nonparticipating capturing group, copied from es5-shim's String#split patch.
1357 var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
1358
1359 var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y$2 || regexpUnsupportedDotAll || regexpUnsupportedNcg;
1360
1361 if (PATCH) {
1362 patchedExec = function exec(string) {
1363 var re = this;
1364 var state = getInternalState$1(re);
1365 var str = toString_1(string);
1366 var raw = state.raw;
1367 var result, reCopy, lastIndex, match, i, object, group;
1368
1369 if (raw) {
1370 raw.lastIndex = re.lastIndex;
1371 result = functionCall(patchedExec, raw, str);
1372 re.lastIndex = raw.lastIndex;
1373 return result;
1374 }
1375
1376 var groups = state.groups;
1377 var sticky = UNSUPPORTED_Y$2 && re.sticky;
1378 var flags = functionCall(regexpFlags, re);
1379 var source = re.source;
1380 var charsAdded = 0;
1381 var strCopy = str;
1382
1383 if (sticky) {
1384 flags = replace$2(flags, 'y', '');
1385 if (indexOf(flags, 'g') === -1) {
1386 flags += 'g';
1387 }
1388
1389 strCopy = stringSlice$6(str, re.lastIndex);
1390 // Support anchored sticky behavior.
1391 if (re.lastIndex > 0 && (!re.multiline || re.multiline && charAt$5(str, re.lastIndex - 1) !== '\n')) {
1392 source = '(?: ' + source + ')';
1393 strCopy = ' ' + strCopy;
1394 charsAdded++;
1395 }
1396 // ^(? + rx + ) is needed, in combination with some str slicing, to
1397 // simulate the 'y' flag.
1398 reCopy = new RegExp('^(?:' + source + ')', flags);
1399 }
1400
1401 if (NPCG_INCLUDED) {
1402 reCopy = new RegExp('^' + source + '$(?!\\s)', flags);
1403 }
1404 if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;
1405
1406 match = functionCall(nativeExec, sticky ? reCopy : re, strCopy);
1407
1408 if (sticky) {
1409 if (match) {
1410 match.input = stringSlice$6(match.input, charsAdded);
1411 match[0] = stringSlice$6(match[0], charsAdded);
1412 match.index = re.lastIndex;
1413 re.lastIndex += match[0].length;
1414 } else re.lastIndex = 0;
1415 } else if (UPDATES_LAST_INDEX_WRONG && match) {
1416 re.lastIndex = re.global ? match.index + match[0].length : lastIndex;
1417 }
1418 if (NPCG_INCLUDED && match && match.length > 1) {
1419 // Fix browsers whose `exec` methods don't consistently return `undefined`
1420 // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/
1421 functionCall(nativeReplace, match[0], reCopy, function () {
1422 for (i = 1; i < arguments.length - 2; i++) {
1423 if (arguments[i] === undefined) match[i] = undefined;
1424 }
1425 });
1426 }
1427
1428 if (match && groups) {
1429 match.groups = object = objectCreate(null);
1430 for (i = 0; i < groups.length; i++) {
1431 group = groups[i];
1432 object[group[0]] = match[group[1]];
1433 }
1434 }
1435
1436 return match;
1437 };
1438 }
1439
1440 var regexpExec = patchedExec;
1441
1442 // `RegExp.prototype.exec` method
1443 // https://tc39.es/ecma262/#sec-regexp.prototype.exec
1444 _export({ target: 'RegExp', proto: true, forced: /./.exec !== regexpExec }, {
1445 exec: regexpExec
1446 });
1447
1448 var FunctionPrototype = Function.prototype;
1449 var apply = FunctionPrototype.apply;
1450 var call = FunctionPrototype.call;
1451
1452 // eslint-disable-next-line es-x/no-reflect -- safe
1453 var functionApply = typeof Reflect == 'object' && Reflect.apply || (functionBindNative ? call.bind(apply) : function () {
1454 return call.apply(apply, arguments);
1455 });
1456
1457 // TODO: Remove from `core-js@4` since it's moved to entry points
1458
1459
1460
1461
1462
1463
1464
1465
1466 var SPECIES$5 = wellKnownSymbol('species');
1467 var RegExpPrototype$3 = RegExp.prototype;
1468
1469 var fixRegexpWellKnownSymbolLogic = function (KEY, exec, FORCED, SHAM) {
1470 var SYMBOL = wellKnownSymbol(KEY);
1471
1472 var DELEGATES_TO_SYMBOL = !fails(function () {
1473 // String methods call symbol-named RegEp methods
1474 var O = {};
1475 O[SYMBOL] = function () { return 7; };
1476 return ''[KEY](O) != 7;
1477 });
1478
1479 var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails(function () {
1480 // Symbol-named RegExp methods call .exec
1481 var execCalled = false;
1482 var re = /a/;
1483
1484 if (KEY === 'split') {
1485 // We can't use real regex here since it causes deoptimization
1486 // and serious performance degradation in V8
1487 // https://github.com/zloirock/core-js/issues/306
1488 re = {};
1489 // RegExp[@@split] doesn't call the regex's exec method, but first creates
1490 // a new one. We need to return the patched regex when creating the new one.
1491 re.constructor = {};
1492 re.constructor[SPECIES$5] = function () { return re; };
1493 re.flags = '';
1494 re[SYMBOL] = /./[SYMBOL];
1495 }
1496
1497 re.exec = function () { execCalled = true; return null; };
1498
1499 re[SYMBOL]('');
1500 return !execCalled;
1501 });
1502
1503 if (
1504 !DELEGATES_TO_SYMBOL ||
1505 !DELEGATES_TO_EXEC ||
1506 FORCED
1507 ) {
1508 var uncurriedNativeRegExpMethod = functionUncurryThis(/./[SYMBOL]);
1509 var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {
1510 var uncurriedNativeMethod = functionUncurryThis(nativeMethod);
1511 var $exec = regexp.exec;
1512 if ($exec === regexpExec || $exec === RegExpPrototype$3.exec) {
1513 if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
1514 // The native String method already delegates to @@method (this
1515 // polyfilled function), leasing to infinite recursion.
1516 // We avoid it by directly calling the native @@method method.
1517 return { done: true, value: uncurriedNativeRegExpMethod(regexp, str, arg2) };
1518 }
1519 return { done: true, value: uncurriedNativeMethod(str, regexp, arg2) };
1520 }
1521 return { done: false };
1522 });
1523
1524 defineBuiltIn(String.prototype, KEY, methods[0]);
1525 defineBuiltIn(RegExpPrototype$3, SYMBOL, methods[1]);
1526 }
1527
1528 if (SHAM) createNonEnumerableProperty(RegExpPrototype$3[SYMBOL], 'sham', true);
1529 };
1530
1531 var MATCH$2 = wellKnownSymbol('match');
1532
1533 // `IsRegExp` abstract operation
1534 // https://tc39.es/ecma262/#sec-isregexp
1535 var isRegexp = function (it) {
1536 var isRegExp;
1537 return isObject(it) && ((isRegExp = it[MATCH$2]) !== undefined ? !!isRegExp : classofRaw(it) == 'RegExp');
1538 };
1539
1540 var noop = function () { /* empty */ };
1541 var empty = [];
1542 var construct = getBuiltIn('Reflect', 'construct');
1543 var constructorRegExp = /^\s*(?:class|function)\b/;
1544 var exec$3 = functionUncurryThis(constructorRegExp.exec);
1545 var INCORRECT_TO_STRING = !constructorRegExp.exec(noop);
1546
1547 var isConstructorModern = function isConstructor(argument) {
1548 if (!isCallable(argument)) return false;
1549 try {
1550 construct(noop, empty, argument);
1551 return true;
1552 } catch (error) {
1553 return false;
1554 }
1555 };
1556
1557 var isConstructorLegacy = function isConstructor(argument) {
1558 if (!isCallable(argument)) return false;
1559 switch (classof(argument)) {
1560 case 'AsyncFunction':
1561 case 'GeneratorFunction':
1562 case 'AsyncGeneratorFunction': return false;
1563 }
1564 try {
1565 // we can't check .prototype since constructors produced by .bind haven't it
1566 // `Function#toString` throws on some built-it function in some legacy engines
1567 // (for example, `DOMQuad` and similar in FF41-)
1568 return INCORRECT_TO_STRING || !!exec$3(constructorRegExp, inspectSource(argument));
1569 } catch (error) {
1570 return true;
1571 }
1572 };
1573
1574 isConstructorLegacy.sham = true;
1575
1576 // `IsConstructor` abstract operation
1577 // https://tc39.es/ecma262/#sec-isconstructor
1578 var isConstructor = !construct || fails(function () {
1579 var called;
1580 return isConstructorModern(isConstructorModern.call)
1581 || !isConstructorModern(Object)
1582 || !isConstructorModern(function () { called = true; })
1583 || called;
1584 }) ? isConstructorLegacy : isConstructorModern;
1585
1586 var TypeError$7 = global_1.TypeError;
1587
1588 // `Assert: IsConstructor(argument) is true`
1589 var aConstructor = function (argument) {
1590 if (isConstructor(argument)) return argument;
1591 throw TypeError$7(tryToString(argument) + ' is not a constructor');
1592 };
1593
1594 var SPECIES$4 = wellKnownSymbol('species');
1595
1596 // `SpeciesConstructor` abstract operation
1597 // https://tc39.es/ecma262/#sec-speciesconstructor
1598 var speciesConstructor = function (O, defaultConstructor) {
1599 var C = anObject(O).constructor;
1600 var S;
1601 return C === undefined || (S = anObject(C)[SPECIES$4]) == undefined ? defaultConstructor : aConstructor(S);
1602 };
1603
1604 var charAt$4 = functionUncurryThis(''.charAt);
1605 var charCodeAt$1 = functionUncurryThis(''.charCodeAt);
1606 var stringSlice$5 = functionUncurryThis(''.slice);
1607
1608 var createMethod$2 = function (CONVERT_TO_STRING) {
1609 return function ($this, pos) {
1610 var S = toString_1(requireObjectCoercible($this));
1611 var position = toIntegerOrInfinity(pos);
1612 var size = S.length;
1613 var first, second;
1614 if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
1615 first = charCodeAt$1(S, position);
1616 return first < 0xD800 || first > 0xDBFF || position + 1 === size
1617 || (second = charCodeAt$1(S, position + 1)) < 0xDC00 || second > 0xDFFF
1618 ? CONVERT_TO_STRING
1619 ? charAt$4(S, position)
1620 : first
1621 : CONVERT_TO_STRING
1622 ? stringSlice$5(S, position, position + 2)
1623 : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
1624 };
1625 };
1626
1627 var stringMultibyte = {
1628 // `String.prototype.codePointAt` method
1629 // https://tc39.es/ecma262/#sec-string.prototype.codepointat
1630 codeAt: createMethod$2(false),
1631 // `String.prototype.at` method
1632 // https://github.com/mathiasbynens/String.prototype.at
1633 charAt: createMethod$2(true)
1634 };
1635
1636 var charAt$3 = stringMultibyte.charAt;
1637
1638 // `AdvanceStringIndex` abstract operation
1639 // https://tc39.es/ecma262/#sec-advancestringindex
1640 var advanceStringIndex = function (S, index, unicode) {
1641 return index + (unicode ? charAt$3(S, index).length : 1);
1642 };
1643
1644 var createProperty = function (object, key, value) {
1645 var propertyKey = toPropertyKey(key);
1646 if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value));
1647 else object[propertyKey] = value;
1648 };
1649
1650 var Array$3 = global_1.Array;
1651 var max$3 = Math.max;
1652
1653 var arraySliceSimple = function (O, start, end) {
1654 var length = lengthOfArrayLike(O);
1655 var k = toAbsoluteIndex(start, length);
1656 var fin = toAbsoluteIndex(end === undefined ? length : end, length);
1657 var result = Array$3(max$3(fin - k, 0));
1658 for (var n = 0; k < fin; k++, n++) createProperty(result, n, O[k]);
1659 result.length = n;
1660 return result;
1661 };
1662
1663 var TypeError$6 = global_1.TypeError;
1664
1665 // `RegExpExec` abstract operation
1666 // https://tc39.es/ecma262/#sec-regexpexec
1667 var regexpExecAbstract = function (R, S) {
1668 var exec = R.exec;
1669 if (isCallable(exec)) {
1670 var result = functionCall(exec, R, S);
1671 if (result !== null) anObject(result);
1672 return result;
1673 }
1674 if (classofRaw(R) === 'RegExp') return functionCall(regexpExec, R, S);
1675 throw TypeError$6('RegExp#exec called on incompatible receiver');
1676 };
1677
1678 var UNSUPPORTED_Y$1 = regexpStickyHelpers.UNSUPPORTED_Y;
1679 var MAX_UINT32 = 0xFFFFFFFF;
1680 var min$4 = Math.min;
1681 var $push = [].push;
1682 var exec$2 = functionUncurryThis(/./.exec);
1683 var push$4 = functionUncurryThis($push);
1684 var stringSlice$4 = functionUncurryThis(''.slice);
1685
1686 // Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec
1687 // Weex JS has frozen built-in prototypes, so use try / catch wrapper
1688 var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () {
1689 // eslint-disable-next-line regexp/no-empty-group -- required for testing
1690 var re = /(?:)/;
1691 var originalExec = re.exec;
1692 re.exec = function () { return originalExec.apply(this, arguments); };
1693 var result = 'ab'.split(re);
1694 return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b';
1695 });
1696
1697 // @@split logic
1698 fixRegexpWellKnownSymbolLogic('split', function (SPLIT, nativeSplit, maybeCallNative) {
1699 var internalSplit;
1700 if (
1701 'abbc'.split(/(b)*/)[1] == 'c' ||
1702 // eslint-disable-next-line regexp/no-empty-group -- required for testing
1703 'test'.split(/(?:)/, -1).length != 4 ||
1704 'ab'.split(/(?:ab)*/).length != 2 ||
1705 '.'.split(/(.?)(.?)/).length != 4 ||
1706 // eslint-disable-next-line regexp/no-empty-capturing-group, regexp/no-empty-group -- required for testing
1707 '.'.split(/()()/).length > 1 ||
1708 ''.split(/.?/).length
1709 ) {
1710 // based on es5-shim implementation, need to rework it
1711 internalSplit = function (separator, limit) {
1712 var string = toString_1(requireObjectCoercible(this));
1713 var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
1714 if (lim === 0) return [];
1715 if (separator === undefined) return [string];
1716 // If `separator` is not a regex, use native split
1717 if (!isRegexp(separator)) {
1718 return functionCall(nativeSplit, string, separator, lim);
1719 }
1720 var output = [];
1721 var flags = (separator.ignoreCase ? 'i' : '') +
1722 (separator.multiline ? 'm' : '') +
1723 (separator.unicode ? 'u' : '') +
1724 (separator.sticky ? 'y' : '');
1725 var lastLastIndex = 0;
1726 // Make `global` and avoid `lastIndex` issues by working with a copy
1727 var separatorCopy = new RegExp(separator.source, flags + 'g');
1728 var match, lastIndex, lastLength;
1729 while (match = functionCall(regexpExec, separatorCopy, string)) {
1730 lastIndex = separatorCopy.lastIndex;
1731 if (lastIndex > lastLastIndex) {
1732 push$4(output, stringSlice$4(string, lastLastIndex, match.index));
1733 if (match.length > 1 && match.index < string.length) functionApply($push, output, arraySliceSimple(match, 1));
1734 lastLength = match[0].length;
1735 lastLastIndex = lastIndex;
1736 if (output.length >= lim) break;
1737 }
1738 if (separatorCopy.lastIndex === match.index) separatorCopy.lastIndex++; // Avoid an infinite loop
1739 }
1740 if (lastLastIndex === string.length) {
1741 if (lastLength || !exec$2(separatorCopy, '')) push$4(output, '');
1742 } else push$4(output, stringSlice$4(string, lastLastIndex));
1743 return output.length > lim ? arraySliceSimple(output, 0, lim) : output;
1744 };
1745 // Chakra, V8
1746 } else if ('0'.split(undefined, 0).length) {
1747 internalSplit = function (separator, limit) {
1748 return separator === undefined && limit === 0 ? [] : functionCall(nativeSplit, this, separator, limit);
1749 };
1750 } else internalSplit = nativeSplit;
1751
1752 return [
1753 // `String.prototype.split` method
1754 // https://tc39.es/ecma262/#sec-string.prototype.split
1755 function split(separator, limit) {
1756 var O = requireObjectCoercible(this);
1757 var splitter = separator == undefined ? undefined : getMethod(separator, SPLIT);
1758 return splitter
1759 ? functionCall(splitter, separator, O, limit)
1760 : functionCall(internalSplit, toString_1(O), separator, limit);
1761 },
1762 // `RegExp.prototype[@@split]` method
1763 // https://tc39.es/ecma262/#sec-regexp.prototype-@@split
1764 //
1765 // NOTE: This cannot be properly polyfilled in engines that don't support
1766 // the 'y' flag.
1767 function (string, limit) {
1768 var rx = anObject(this);
1769 var S = toString_1(string);
1770 var res = maybeCallNative(internalSplit, rx, S, limit, internalSplit !== nativeSplit);
1771
1772 if (res.done) return res.value;
1773
1774 var C = speciesConstructor(rx, RegExp);
1775
1776 var unicodeMatching = rx.unicode;
1777 var flags = (rx.ignoreCase ? 'i' : '') +
1778 (rx.multiline ? 'm' : '') +
1779 (rx.unicode ? 'u' : '') +
1780 (UNSUPPORTED_Y$1 ? 'g' : 'y');
1781
1782 // ^(? + rx + ) is needed, in combination with some S slicing, to
1783 // simulate the 'y' flag.
1784 var splitter = new C(UNSUPPORTED_Y$1 ? '^(?:' + rx.source + ')' : rx, flags);
1785 var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
1786 if (lim === 0) return [];
1787 if (S.length === 0) return regexpExecAbstract(splitter, S) === null ? [S] : [];
1788 var p = 0;
1789 var q = 0;
1790 var A = [];
1791 while (q < S.length) {
1792 splitter.lastIndex = UNSUPPORTED_Y$1 ? 0 : q;
1793 var z = regexpExecAbstract(splitter, UNSUPPORTED_Y$1 ? stringSlice$4(S, q) : S);
1794 var e;
1795 if (
1796 z === null ||
1797 (e = min$4(toLength(splitter.lastIndex + (UNSUPPORTED_Y$1 ? q : 0)), S.length)) === p
1798 ) {
1799 q = advanceStringIndex(S, q, unicodeMatching);
1800 } else {
1801 push$4(A, stringSlice$4(S, p, q));
1802 if (A.length === lim) return A;
1803 for (var i = 1; i <= z.length - 1; i++) {
1804 push$4(A, z[i]);
1805 if (A.length === lim) return A;
1806 }
1807 q = p = e;
1808 }
1809 }
1810 push$4(A, stringSlice$4(S, p));
1811 return A;
1812 }
1813 ];
1814 }, !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC, UNSUPPORTED_Y$1);
1815
1816 var $propertyIsEnumerable = objectPropertyIsEnumerable.f;
1817
1818 var propertyIsEnumerable = functionUncurryThis($propertyIsEnumerable);
1819 var push$3 = functionUncurryThis([].push);
1820
1821 // `Object.{ entries, values }` methods implementation
1822 var createMethod$1 = function (TO_ENTRIES) {
1823 return function (it) {
1824 var O = toIndexedObject(it);
1825 var keys = objectKeys(O);
1826 var length = keys.length;
1827 var i = 0;
1828 var result = [];
1829 var key;
1830 while (length > i) {
1831 key = keys[i++];
1832 if (!descriptors || propertyIsEnumerable(O, key)) {
1833 push$3(result, TO_ENTRIES ? [key, O[key]] : O[key]);
1834 }
1835 }
1836 return result;
1837 };
1838 };
1839
1840 var objectToArray = {
1841 // `Object.entries` method
1842 // https://tc39.es/ecma262/#sec-object.entries
1843 entries: createMethod$1(true),
1844 // `Object.values` method
1845 // https://tc39.es/ecma262/#sec-object.values
1846 values: createMethod$1(false)
1847 };
1848
1849 var $entries = objectToArray.entries;
1850
1851 // `Object.entries` method
1852 // https://tc39.es/ecma262/#sec-object.entries
1853 _export({ target: 'Object', stat: true }, {
1854 entries: function entries(O) {
1855 return $entries(O);
1856 }
1857 });
1858
1859 var UNSCOPABLES = wellKnownSymbol('unscopables');
1860 var ArrayPrototype = Array.prototype;
1861
1862 // Array.prototype[@@unscopables]
1863 // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
1864 if (ArrayPrototype[UNSCOPABLES] == undefined) {
1865 objectDefineProperty.f(ArrayPrototype, UNSCOPABLES, {
1866 configurable: true,
1867 value: objectCreate(null)
1868 });
1869 }
1870
1871 // add a key to Array.prototype[@@unscopables]
1872 var addToUnscopables = function (key) {
1873 ArrayPrototype[UNSCOPABLES][key] = true;
1874 };
1875
1876 var $includes = arrayIncludes.includes;
1877
1878
1879
1880 // FF99+ bug
1881 var BROKEN_ON_SPARSE = fails(function () {
1882 return !Array(1).includes();
1883 });
1884
1885 // `Array.prototype.includes` method
1886 // https://tc39.es/ecma262/#sec-array.prototype.includes
1887 _export({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE }, {
1888 includes: function includes(el /* , fromIndex = 0 */) {
1889 return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
1890 }
1891 });
1892
1893 // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
1894 addToUnscopables('includes');
1895
1896 // `IsArray` abstract operation
1897 // https://tc39.es/ecma262/#sec-isarray
1898 // eslint-disable-next-line es-x/no-array-isarray -- safe
1899 var isArray = Array.isArray || function isArray(argument) {
1900 return classofRaw(argument) == 'Array';
1901 };
1902
1903 var SPECIES$3 = wellKnownSymbol('species');
1904 var Array$2 = global_1.Array;
1905
1906 // a part of `ArraySpeciesCreate` abstract operation
1907 // https://tc39.es/ecma262/#sec-arrayspeciescreate
1908 var arraySpeciesConstructor = function (originalArray) {
1909 var C;
1910 if (isArray(originalArray)) {
1911 C = originalArray.constructor;
1912 // cross-realm fallback
1913 if (isConstructor(C) && (C === Array$2 || isArray(C.prototype))) C = undefined;
1914 else if (isObject(C)) {
1915 C = C[SPECIES$3];
1916 if (C === null) C = undefined;
1917 }
1918 } return C === undefined ? Array$2 : C;
1919 };
1920
1921 // `ArraySpeciesCreate` abstract operation
1922 // https://tc39.es/ecma262/#sec-arrayspeciescreate
1923 var arraySpeciesCreate = function (originalArray, length) {
1924 return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
1925 };
1926
1927 var SPECIES$2 = wellKnownSymbol('species');
1928
1929 var arrayMethodHasSpeciesSupport = function (METHOD_NAME) {
1930 // We can't use this feature detection in V8 since it causes
1931 // deoptimization and serious performance degradation
1932 // https://github.com/zloirock/core-js/issues/677
1933 return engineV8Version >= 51 || !fails(function () {
1934 var array = [];
1935 var constructor = array.constructor = {};
1936 constructor[SPECIES$2] = function () {
1937 return { foo: 1 };
1938 };
1939 return array[METHOD_NAME](Boolean).foo !== 1;
1940 });
1941 };
1942
1943 var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
1944 var MAX_SAFE_INTEGER$1 = 0x1FFFFFFFFFFFFF;
1945 var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';
1946 var TypeError$5 = global_1.TypeError;
1947
1948 // We can't use this feature detection in V8 since it causes
1949 // deoptimization and serious performance degradation
1950 // https://github.com/zloirock/core-js/issues/679
1951 var IS_CONCAT_SPREADABLE_SUPPORT = engineV8Version >= 51 || !fails(function () {
1952 var array = [];
1953 array[IS_CONCAT_SPREADABLE] = false;
1954 return array.concat()[0] !== array;
1955 });
1956
1957 var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
1958
1959 var isConcatSpreadable = function (O) {
1960 if (!isObject(O)) return false;
1961 var spreadable = O[IS_CONCAT_SPREADABLE];
1962 return spreadable !== undefined ? !!spreadable : isArray(O);
1963 };
1964
1965 var FORCED$3 = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
1966
1967 // `Array.prototype.concat` method
1968 // https://tc39.es/ecma262/#sec-array.prototype.concat
1969 // with adding support of @@isConcatSpreadable and @@species
1970 _export({ target: 'Array', proto: true, arity: 1, forced: FORCED$3 }, {
1971 // eslint-disable-next-line no-unused-vars -- required for `.length`
1972 concat: function concat(arg) {
1973 var O = toObject(this);
1974 var A = arraySpeciesCreate(O, 0);
1975 var n = 0;
1976 var i, k, length, len, E;
1977 for (i = -1, length = arguments.length; i < length; i++) {
1978 E = i === -1 ? O : arguments[i];
1979 if (isConcatSpreadable(E)) {
1980 len = lengthOfArrayLike(E);
1981 if (n + len > MAX_SAFE_INTEGER$1) throw TypeError$5(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
1982 for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
1983 } else {
1984 if (n >= MAX_SAFE_INTEGER$1) throw TypeError$5(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
1985 createProperty(A, n++, E);
1986 }
1987 }
1988 A.length = n;
1989 return A;
1990 }
1991 });
1992
1993 var bind = functionUncurryThis(functionUncurryThis.bind);
1994
1995 // optional / simple context binding
1996 var functionBindContext = function (fn, that) {
1997 aCallable(fn);
1998 return that === undefined ? fn : functionBindNative ? bind(fn, that) : function (/* ...args */) {
1999 return fn.apply(that, arguments);
2000 };
2001 };
2002
2003 var push$2 = functionUncurryThis([].push);
2004
2005 // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterReject }` methods implementation
2006 var createMethod = function (TYPE) {
2007 var IS_MAP = TYPE == 1;
2008 var IS_FILTER = TYPE == 2;
2009 var IS_SOME = TYPE == 3;
2010 var IS_EVERY = TYPE == 4;
2011 var IS_FIND_INDEX = TYPE == 6;
2012 var IS_FILTER_REJECT = TYPE == 7;
2013 var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
2014 return function ($this, callbackfn, that, specificCreate) {
2015 var O = toObject($this);
2016 var self = indexedObject(O);
2017 var boundFunction = functionBindContext(callbackfn, that);
2018 var length = lengthOfArrayLike(self);
2019 var index = 0;
2020 var create = specificCreate || arraySpeciesCreate;
2021 var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_REJECT ? create($this, 0) : undefined;
2022 var value, result;
2023 for (;length > index; index++) if (NO_HOLES || index in self) {
2024 value = self[index];
2025 result = boundFunction(value, index, O);
2026 if (TYPE) {
2027 if (IS_MAP) target[index] = result; // map
2028 else if (result) switch (TYPE) {
2029 case 3: return true; // some
2030 case 5: return value; // find
2031 case 6: return index; // findIndex
2032 case 2: push$2(target, value); // filter
2033 } else switch (TYPE) {
2034 case 4: return false; // every
2035 case 7: push$2(target, value); // filterReject
2036 }
2037 }
2038 }
2039 return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
2040 };
2041 };
2042
2043 var arrayIteration = {
2044 // `Array.prototype.forEach` method
2045 // https://tc39.es/ecma262/#sec-array.prototype.foreach
2046 forEach: createMethod(0),
2047 // `Array.prototype.map` method
2048 // https://tc39.es/ecma262/#sec-array.prototype.map
2049 map: createMethod(1),
2050 // `Array.prototype.filter` method
2051 // https://tc39.es/ecma262/#sec-array.prototype.filter
2052 filter: createMethod(2),
2053 // `Array.prototype.some` method
2054 // https://tc39.es/ecma262/#sec-array.prototype.some
2055 some: createMethod(3),
2056 // `Array.prototype.every` method
2057 // https://tc39.es/ecma262/#sec-array.prototype.every
2058 every: createMethod(4),
2059 // `Array.prototype.find` method
2060 // https://tc39.es/ecma262/#sec-array.prototype.find
2061 find: createMethod(5),
2062 // `Array.prototype.findIndex` method
2063 // https://tc39.es/ecma262/#sec-array.prototype.findIndex
2064 findIndex: createMethod(6),
2065 // `Array.prototype.filterReject` method
2066 // https://github.com/tc39/proposal-array-filtering
2067 filterReject: createMethod(7)
2068 };
2069
2070 var $find = arrayIteration.find;
2071
2072
2073 var FIND = 'find';
2074 var SKIPS_HOLES$1 = true;
2075
2076 // Shouldn't skip holes
2077 if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES$1 = false; });
2078
2079 // `Array.prototype.find` method
2080 // https://tc39.es/ecma262/#sec-array.prototype.find
2081 _export({ target: 'Array', proto: true, forced: SKIPS_HOLES$1 }, {
2082 find: function find(callbackfn /* , that = undefined */) {
2083 return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
2084 }
2085 });
2086
2087 // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
2088 addToUnscopables(FIND);
2089
2090 // `Object.prototype.toString` method implementation
2091 // https://tc39.es/ecma262/#sec-object.prototype.tostring
2092 var objectToString = toStringTagSupport ? {}.toString : function toString() {
2093 return '[object ' + classof(this) + ']';
2094 };
2095
2096 // `Object.prototype.toString` method
2097 // https://tc39.es/ecma262/#sec-object.prototype.tostring
2098 if (!toStringTagSupport) {
2099 defineBuiltIn(Object.prototype, 'toString', objectToString, { unsafe: true });
2100 }
2101
2102 var TypeError$4 = global_1.TypeError;
2103
2104 var notARegexp = function (it) {
2105 if (isRegexp(it)) {
2106 throw TypeError$4("The method doesn't accept regular expressions");
2107 } return it;
2108 };
2109
2110 var MATCH$1 = wellKnownSymbol('match');
2111
2112 var correctIsRegexpLogic = function (METHOD_NAME) {
2113 var regexp = /./;
2114 try {
2115 '/./'[METHOD_NAME](regexp);
2116 } catch (error1) {
2117 try {
2118 regexp[MATCH$1] = false;
2119 return '/./'[METHOD_NAME](regexp);
2120 } catch (error2) { /* empty */ }
2121 } return false;
2122 };
2123
2124 var stringIndexOf$2 = functionUncurryThis(''.indexOf);
2125
2126 // `String.prototype.includes` method
2127 // https://tc39.es/ecma262/#sec-string.prototype.includes
2128 _export({ target: 'String', proto: true, forced: !correctIsRegexpLogic('includes') }, {
2129 includes: function includes(searchString /* , position = 0 */) {
2130 return !!~stringIndexOf$2(
2131 toString_1(requireObjectCoercible(this)),
2132 toString_1(notARegexp(searchString)),
2133 arguments.length > 1 ? arguments[1] : undefined
2134 );
2135 }
2136 });
2137
2138 // iterable DOM collections
2139 // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
2140 var domIterables = {
2141 CSSRuleList: 0,
2142 CSSStyleDeclaration: 0,
2143 CSSValueList: 0,
2144 ClientRectList: 0,
2145 DOMRectList: 0,
2146 DOMStringList: 0,
2147 DOMTokenList: 1,
2148 DataTransferItemList: 0,
2149 FileList: 0,
2150 HTMLAllCollection: 0,
2151 HTMLCollection: 0,
2152 HTMLFormElement: 0,
2153 HTMLSelectElement: 0,
2154 MediaList: 0,
2155 MimeTypeArray: 0,
2156 NamedNodeMap: 0,
2157 NodeList: 1,
2158 PaintRequestList: 0,
2159 Plugin: 0,
2160 PluginArray: 0,
2161 SVGLengthList: 0,
2162 SVGNumberList: 0,
2163 SVGPathSegList: 0,
2164 SVGPointList: 0,
2165 SVGStringList: 0,
2166 SVGTransformList: 0,
2167 SourceBufferList: 0,
2168 StyleSheetList: 0,
2169 TextTrackCueList: 0,
2170 TextTrackList: 0,
2171 TouchList: 0
2172 };
2173
2174 // in old WebKit versions, `element.classList` is not an instance of global `DOMTokenList`
2175
2176
2177 var classList = documentCreateElement('span').classList;
2178 var DOMTokenListPrototype = classList && classList.constructor && classList.constructor.prototype;
2179
2180 var domTokenListPrototype = DOMTokenListPrototype === Object.prototype ? undefined : DOMTokenListPrototype;
2181
2182 var $forEach = arrayIteration.forEach;
2183
2184
2185 var STRICT_METHOD$2 = arrayMethodIsStrict('forEach');
2186
2187 // `Array.prototype.forEach` method implementation
2188 // https://tc39.es/ecma262/#sec-array.prototype.foreach
2189 var arrayForEach = !STRICT_METHOD$2 ? function forEach(callbackfn /* , thisArg */) {
2190 return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
2191 // eslint-disable-next-line es-x/no-array-prototype-foreach -- safe
2192 } : [].forEach;
2193
2194 var handlePrototype$1 = function (CollectionPrototype) {
2195 // some Chrome versions have non-configurable methods on DOMTokenList
2196 if (CollectionPrototype && CollectionPrototype.forEach !== arrayForEach) try {
2197 createNonEnumerableProperty(CollectionPrototype, 'forEach', arrayForEach);
2198 } catch (error) {
2199 CollectionPrototype.forEach = arrayForEach;
2200 }
2201 };
2202
2203 for (var COLLECTION_NAME$1 in domIterables) {
2204 if (domIterables[COLLECTION_NAME$1]) {
2205 handlePrototype$1(global_1[COLLECTION_NAME$1] && global_1[COLLECTION_NAME$1].prototype);
2206 }
2207 }
2208
2209 handlePrototype$1(domTokenListPrototype);
2210
2211 var trim$2 = stringTrim.trim;
2212
2213
2214 var charAt$2 = functionUncurryThis(''.charAt);
2215 var n$ParseFloat = global_1.parseFloat;
2216 var Symbol$2 = global_1.Symbol;
2217 var ITERATOR$4 = Symbol$2 && Symbol$2.iterator;
2218 var FORCED$2 = 1 / n$ParseFloat(whitespaces + '-0') !== -Infinity
2219 // MS Edge 18- broken with boxed symbols
2220 || (ITERATOR$4 && !fails(function () { n$ParseFloat(Object(ITERATOR$4)); }));
2221
2222 // `parseFloat` method
2223 // https://tc39.es/ecma262/#sec-parsefloat-string
2224 var numberParseFloat = FORCED$2 ? function parseFloat(string) {
2225 var trimmedString = trim$2(toString_1(string));
2226 var result = n$ParseFloat(trimmedString);
2227 return result === 0 && charAt$2(trimmedString, 0) == '-' ? -0 : result;
2228 } : n$ParseFloat;
2229
2230 // `parseFloat` method
2231 // https://tc39.es/ecma262/#sec-parsefloat-string
2232 _export({ global: true, forced: parseFloat != numberParseFloat }, {
2233 parseFloat: numberParseFloat
2234 });
2235
2236 /* eslint-disable es-x/no-array-prototype-indexof -- required for testing */
2237
2238
2239 var $IndexOf = arrayIncludes.indexOf;
2240
2241
2242 var un$IndexOf = functionUncurryThis([].indexOf);
2243
2244 var NEGATIVE_ZERO = !!un$IndexOf && 1 / un$IndexOf([1], 1, -0) < 0;
2245 var STRICT_METHOD$1 = arrayMethodIsStrict('indexOf');
2246
2247 // `Array.prototype.indexOf` method
2248 // https://tc39.es/ecma262/#sec-array.prototype.indexof
2249 _export({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || !STRICT_METHOD$1 }, {
2250 indexOf: function indexOf(searchElement /* , fromIndex = 0 */) {
2251 var fromIndex = arguments.length > 1 ? arguments[1] : undefined;
2252 return NEGATIVE_ZERO
2253 // convert -0 to +0
2254 ? un$IndexOf(this, searchElement, fromIndex) || 0
2255 : $IndexOf(this, searchElement, fromIndex);
2256 }
2257 });
2258
2259 var floor$1 = Math.floor;
2260
2261 var mergeSort = function (array, comparefn) {
2262 var length = array.length;
2263 var middle = floor$1(length / 2);
2264 return length < 8 ? insertionSort(array, comparefn) : merge(
2265 array,
2266 mergeSort(arraySliceSimple(array, 0, middle), comparefn),
2267 mergeSort(arraySliceSimple(array, middle), comparefn),
2268 comparefn
2269 );
2270 };
2271
2272 var insertionSort = function (array, comparefn) {
2273 var length = array.length;
2274 var i = 1;
2275 var element, j;
2276
2277 while (i < length) {
2278 j = i;
2279 element = array[i];
2280 while (j && comparefn(array[j - 1], element) > 0) {
2281 array[j] = array[--j];
2282 }
2283 if (j !== i++) array[j] = element;
2284 } return array;
2285 };
2286
2287 var merge = function (array, left, right, comparefn) {
2288 var llength = left.length;
2289 var rlength = right.length;
2290 var lindex = 0;
2291 var rindex = 0;
2292
2293 while (lindex < llength || rindex < rlength) {
2294 array[lindex + rindex] = (lindex < llength && rindex < rlength)
2295 ? comparefn(left[lindex], right[rindex]) <= 0 ? left[lindex++] : right[rindex++]
2296 : lindex < llength ? left[lindex++] : right[rindex++];
2297 } return array;
2298 };
2299
2300 var arraySort = mergeSort;
2301
2302 var firefox = engineUserAgent.match(/firefox\/(\d+)/i);
2303
2304 var engineFfVersion = !!firefox && +firefox[1];
2305
2306 var engineIsIeOrEdge = /MSIE|Trident/.test(engineUserAgent);
2307
2308 var webkit = engineUserAgent.match(/AppleWebKit\/(\d+)\./);
2309
2310 var engineWebkitVersion = !!webkit && +webkit[1];
2311
2312 var test$1 = [];
2313 var un$Sort = functionUncurryThis(test$1.sort);
2314 var push$1 = functionUncurryThis(test$1.push);
2315
2316 // IE8-
2317 var FAILS_ON_UNDEFINED = fails(function () {
2318 test$1.sort(undefined);
2319 });
2320 // V8 bug
2321 var FAILS_ON_NULL = fails(function () {
2322 test$1.sort(null);
2323 });
2324 // Old WebKit
2325 var STRICT_METHOD = arrayMethodIsStrict('sort');
2326
2327 var STABLE_SORT = !fails(function () {
2328 // feature detection can be too slow, so check engines versions
2329 if (engineV8Version) return engineV8Version < 70;
2330 if (engineFfVersion && engineFfVersion > 3) return;
2331 if (engineIsIeOrEdge) return true;
2332 if (engineWebkitVersion) return engineWebkitVersion < 603;
2333
2334 var result = '';
2335 var code, chr, value, index;
2336
2337 // generate an array with more 512 elements (Chakra and old V8 fails only in this case)
2338 for (code = 65; code < 76; code++) {
2339 chr = String.fromCharCode(code);
2340
2341 switch (code) {
2342 case 66: case 69: case 70: case 72: value = 3; break;
2343 case 68: case 71: value = 4; break;
2344 default: value = 2;
2345 }
2346
2347 for (index = 0; index < 47; index++) {
2348 test$1.push({ k: chr + index, v: value });
2349 }
2350 }
2351
2352 test$1.sort(function (a, b) { return b.v - a.v; });
2353
2354 for (index = 0; index < test$1.length; index++) {
2355 chr = test$1[index].k.charAt(0);
2356 if (result.charAt(result.length - 1) !== chr) result += chr;
2357 }
2358
2359 return result !== 'DGBEFHACIJK';
2360 });
2361
2362 var FORCED$1 = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD || !STABLE_SORT;
2363
2364 var getSortCompare = function (comparefn) {
2365 return function (x, y) {
2366 if (y === undefined) return -1;
2367 if (x === undefined) return 1;
2368 if (comparefn !== undefined) return +comparefn(x, y) || 0;
2369 return toString_1(x) > toString_1(y) ? 1 : -1;
2370 };
2371 };
2372
2373 // `Array.prototype.sort` method
2374 // https://tc39.es/ecma262/#sec-array.prototype.sort
2375 _export({ target: 'Array', proto: true, forced: FORCED$1 }, {
2376 sort: function sort(comparefn) {
2377 if (comparefn !== undefined) aCallable(comparefn);
2378
2379 var array = toObject(this);
2380
2381 if (STABLE_SORT) return comparefn === undefined ? un$Sort(array) : un$Sort(array, comparefn);
2382
2383 var items = [];
2384 var arrayLength = lengthOfArrayLike(array);
2385 var itemsLength, index;
2386
2387 for (index = 0; index < arrayLength; index++) {
2388 if (index in array) push$1(items, array[index]);
2389 }
2390
2391 arraySort(items, getSortCompare(comparefn));
2392
2393 itemsLength = items.length;
2394 index = 0;
2395
2396 while (index < itemsLength) array[index] = items[index++];
2397 while (index < arrayLength) delete array[index++];
2398
2399 return array;
2400 }
2401 });
2402
2403 var floor = Math.floor;
2404 var charAt$1 = functionUncurryThis(''.charAt);
2405 var replace$1 = functionUncurryThis(''.replace);
2406 var stringSlice$3 = functionUncurryThis(''.slice);
2407 var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d{1,2}|<[^>]*>)/g;
2408 var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d{1,2})/g;
2409
2410 // `GetSubstitution` abstract operation
2411 // https://tc39.es/ecma262/#sec-getsubstitution
2412 var getSubstitution = function (matched, str, position, captures, namedCaptures, replacement) {
2413 var tailPos = position + matched.length;
2414 var m = captures.length;
2415 var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
2416 if (namedCaptures !== undefined) {
2417 namedCaptures = toObject(namedCaptures);
2418 symbols = SUBSTITUTION_SYMBOLS;
2419 }
2420 return replace$1(replacement, symbols, function (match, ch) {
2421 var capture;
2422 switch (charAt$1(ch, 0)) {
2423 case '$': return '$';
2424 case '&': return matched;
2425 case '`': return stringSlice$3(str, 0, position);
2426 case "'": return stringSlice$3(str, tailPos);
2427 case '<':
2428 capture = namedCaptures[stringSlice$3(ch, 1, -1)];
2429 break;
2430 default: // \d\d?
2431 var n = +ch;
2432 if (n === 0) return match;
2433 if (n > m) {
2434 var f = floor(n / 10);
2435 if (f === 0) return match;
2436 if (f <= m) return captures[f - 1] === undefined ? charAt$1(ch, 1) : captures[f - 1] + charAt$1(ch, 1);
2437 return match;
2438 }
2439 capture = captures[n - 1];
2440 }
2441 return capture === undefined ? '' : capture;
2442 });
2443 };
2444
2445 var REPLACE = wellKnownSymbol('replace');
2446 var max$2 = Math.max;
2447 var min$3 = Math.min;
2448 var concat = functionUncurryThis([].concat);
2449 var push = functionUncurryThis([].push);
2450 var stringIndexOf$1 = functionUncurryThis(''.indexOf);
2451 var stringSlice$2 = functionUncurryThis(''.slice);
2452
2453 var maybeToString = function (it) {
2454 return it === undefined ? it : String(it);
2455 };
2456
2457 // IE <= 11 replaces $0 with the whole match, as if it was $&
2458 // https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0
2459 var REPLACE_KEEPS_$0 = (function () {
2460 // eslint-disable-next-line regexp/prefer-escape-replacement-dollar-char -- required for testing
2461 return 'a'.replace(/./, '$0') === '$0';
2462 })();
2463
2464 // Safari <= 13.0.3(?) substitutes nth capture where n>m with an empty string
2465 var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () {
2466 if (/./[REPLACE]) {
2467 return /./[REPLACE]('a', '$0') === '';
2468 }
2469 return false;
2470 })();
2471
2472 var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () {
2473 var re = /./;
2474 re.exec = function () {
2475 var result = [];
2476 result.groups = { a: '7' };
2477 return result;
2478 };
2479 // eslint-disable-next-line regexp/no-useless-dollar-replacements -- false positive
2480 return ''.replace(re, '$<a>') !== '7';
2481 });
2482
2483 // @@replace logic
2484 fixRegexpWellKnownSymbolLogic('replace', function (_, nativeReplace, maybeCallNative) {
2485 var UNSAFE_SUBSTITUTE = REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE ? '$' : '$0';
2486
2487 return [
2488 // `String.prototype.replace` method
2489 // https://tc39.es/ecma262/#sec-string.prototype.replace
2490 function replace(searchValue, replaceValue) {
2491 var O = requireObjectCoercible(this);
2492 var replacer = searchValue == undefined ? undefined : getMethod(searchValue, REPLACE);
2493 return replacer
2494 ? functionCall(replacer, searchValue, O, replaceValue)
2495 : functionCall(nativeReplace, toString_1(O), searchValue, replaceValue);
2496 },
2497 // `RegExp.prototype[@@replace]` method
2498 // https://tc39.es/ecma262/#sec-regexp.prototype-@@replace
2499 function (string, replaceValue) {
2500 var rx = anObject(this);
2501 var S = toString_1(string);
2502
2503 if (
2504 typeof replaceValue == 'string' &&
2505 stringIndexOf$1(replaceValue, UNSAFE_SUBSTITUTE) === -1 &&
2506 stringIndexOf$1(replaceValue, '$<') === -1
2507 ) {
2508 var res = maybeCallNative(nativeReplace, rx, S, replaceValue);
2509 if (res.done) return res.value;
2510 }
2511
2512 var functionalReplace = isCallable(replaceValue);
2513 if (!functionalReplace) replaceValue = toString_1(replaceValue);
2514
2515 var global = rx.global;
2516 if (global) {
2517 var fullUnicode = rx.unicode;
2518 rx.lastIndex = 0;
2519 }
2520 var results = [];
2521 while (true) {
2522 var result = regexpExecAbstract(rx, S);
2523 if (result === null) break;
2524
2525 push(results, result);
2526 if (!global) break;
2527
2528 var matchStr = toString_1(result[0]);
2529 if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
2530 }
2531
2532 var accumulatedResult = '';
2533 var nextSourcePosition = 0;
2534 for (var i = 0; i < results.length; i++) {
2535 result = results[i];
2536
2537 var matched = toString_1(result[0]);
2538 var position = max$2(min$3(toIntegerOrInfinity(result.index), S.length), 0);
2539 var captures = [];
2540 // NOTE: This is equivalent to
2541 // captures = result.slice(1).map(maybeToString)
2542 // but for some reason `nativeSlice.call(result, 1, result.length)` (called in
2543 // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and
2544 // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.
2545 for (var j = 1; j < result.length; j++) push(captures, maybeToString(result[j]));
2546 var namedCaptures = result.groups;
2547 if (functionalReplace) {
2548 var replacerArgs = concat([matched], captures, position, S);
2549 if (namedCaptures !== undefined) push(replacerArgs, namedCaptures);
2550 var replacement = toString_1(functionApply(replaceValue, undefined, replacerArgs));
2551 } else {
2552 replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
2553 }
2554 if (position >= nextSourcePosition) {
2555 accumulatedResult += stringSlice$2(S, nextSourcePosition, position) + replacement;
2556 nextSourcePosition = position + matched.length;
2557 }
2558 }
2559 return accumulatedResult + stringSlice$2(S, nextSourcePosition);
2560 }
2561 ];
2562 }, !REPLACE_SUPPORTS_NAMED_GROUPS || !REPLACE_KEEPS_$0 || REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE);
2563
2564 var $filter = arrayIteration.filter;
2565
2566
2567 var HAS_SPECIES_SUPPORT$3 = arrayMethodHasSpeciesSupport('filter');
2568
2569 // `Array.prototype.filter` method
2570 // https://tc39.es/ecma262/#sec-array.prototype.filter
2571 // with adding support of @@species
2572 _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$3 }, {
2573 filter: function filter(callbackfn /* , thisArg */) {
2574 return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
2575 }
2576 });
2577
2578 // `SameValue` abstract operation
2579 // https://tc39.es/ecma262/#sec-samevalue
2580 // eslint-disable-next-line es-x/no-object-is -- safe
2581 var sameValue = Object.is || function is(x, y) {
2582 // eslint-disable-next-line no-self-compare -- NaN check
2583 return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y;
2584 };
2585
2586 // @@search logic
2587 fixRegexpWellKnownSymbolLogic('search', function (SEARCH, nativeSearch, maybeCallNative) {
2588 return [
2589 // `String.prototype.search` method
2590 // https://tc39.es/ecma262/#sec-string.prototype.search
2591 function search(regexp) {
2592 var O = requireObjectCoercible(this);
2593 var searcher = regexp == undefined ? undefined : getMethod(regexp, SEARCH);
2594 return searcher ? functionCall(searcher, regexp, O) : new RegExp(regexp)[SEARCH](toString_1(O));
2595 },
2596 // `RegExp.prototype[@@search]` method
2597 // https://tc39.es/ecma262/#sec-regexp.prototype-@@search
2598 function (string) {
2599 var rx = anObject(this);
2600 var S = toString_1(string);
2601 var res = maybeCallNative(nativeSearch, rx, S);
2602
2603 if (res.done) return res.value;
2604
2605 var previousLastIndex = rx.lastIndex;
2606 if (!sameValue(previousLastIndex, 0)) rx.lastIndex = 0;
2607 var result = regexpExecAbstract(rx, S);
2608 if (!sameValue(rx.lastIndex, previousLastIndex)) rx.lastIndex = previousLastIndex;
2609 return result === null ? -1 : result.index;
2610 }
2611 ];
2612 });
2613
2614 var trim$1 = stringTrim.trim;
2615
2616
2617 var $parseInt = global_1.parseInt;
2618 var Symbol$1 = global_1.Symbol;
2619 var ITERATOR$3 = Symbol$1 && Symbol$1.iterator;
2620 var hex = /^[+-]?0x/i;
2621 var exec$1 = functionUncurryThis(hex.exec);
2622 var FORCED = $parseInt(whitespaces + '08') !== 8 || $parseInt(whitespaces + '0x16') !== 22
2623 // MS Edge 18- broken with boxed symbols
2624 || (ITERATOR$3 && !fails(function () { $parseInt(Object(ITERATOR$3)); }));
2625
2626 // `parseInt` method
2627 // https://tc39.es/ecma262/#sec-parseint-string-radix
2628 var numberParseInt = FORCED ? function parseInt(string, radix) {
2629 var S = trim$1(toString_1(string));
2630 return $parseInt(S, (radix >>> 0) || (exec$1(hex, S) ? 16 : 10));
2631 } : $parseInt;
2632
2633 // `parseInt` method
2634 // https://tc39.es/ecma262/#sec-parseint-string-radix
2635 _export({ global: true, forced: parseInt != numberParseInt }, {
2636 parseInt: numberParseInt
2637 });
2638
2639 var $map = arrayIteration.map;
2640
2641
2642 var HAS_SPECIES_SUPPORT$2 = arrayMethodHasSpeciesSupport('map');
2643
2644 // `Array.prototype.map` method
2645 // https://tc39.es/ecma262/#sec-array.prototype.map
2646 // with adding support of @@species
2647 _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$2 }, {
2648 map: function map(callbackfn /* , thisArg */) {
2649 return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
2650 }
2651 });
2652
2653 var $findIndex = arrayIteration.findIndex;
2654
2655
2656 var FIND_INDEX = 'findIndex';
2657 var SKIPS_HOLES = true;
2658
2659 // Shouldn't skip holes
2660 if (FIND_INDEX in []) Array(1)[FIND_INDEX](function () { SKIPS_HOLES = false; });
2661
2662 // `Array.prototype.findIndex` method
2663 // https://tc39.es/ecma262/#sec-array.prototype.findindex
2664 _export({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
2665 findIndex: function findIndex(callbackfn /* , that = undefined */) {
2666 return $findIndex(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
2667 }
2668 });
2669
2670 // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
2671 addToUnscopables(FIND_INDEX);
2672
2673 var String$1 = global_1.String;
2674 var TypeError$3 = global_1.TypeError;
2675
2676 var aPossiblePrototype = function (argument) {
2677 if (typeof argument == 'object' || isCallable(argument)) return argument;
2678 throw TypeError$3("Can't set " + String$1(argument) + ' as a prototype');
2679 };
2680
2681 /* eslint-disable no-proto -- safe */
2682
2683
2684
2685
2686 // `Object.setPrototypeOf` method
2687 // https://tc39.es/ecma262/#sec-object.setprototypeof
2688 // Works with __proto__ only. Old v8 can't work with null proto objects.
2689 // eslint-disable-next-line es-x/no-object-setprototypeof -- safe
2690 var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {
2691 var CORRECT_SETTER = false;
2692 var test = {};
2693 var setter;
2694 try {
2695 // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
2696 setter = functionUncurryThis(Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set);
2697 setter(test, []);
2698 CORRECT_SETTER = test instanceof Array;
2699 } catch (error) { /* empty */ }
2700 return function setPrototypeOf(O, proto) {
2701 anObject(O);
2702 aPossiblePrototype(proto);
2703 if (CORRECT_SETTER) setter(O, proto);
2704 else O.__proto__ = proto;
2705 return O;
2706 };
2707 }() : undefined);
2708
2709 // makes subclassing work correct for wrapped built-ins
2710 var inheritIfRequired = function ($this, dummy, Wrapper) {
2711 var NewTarget, NewTargetPrototype;
2712 if (
2713 // it can work only with native `setPrototypeOf`
2714 objectSetPrototypeOf &&
2715 // we haven't completely correct pre-ES6 way for getting `new.target`, so use this
2716 isCallable(NewTarget = dummy.constructor) &&
2717 NewTarget !== Wrapper &&
2718 isObject(NewTargetPrototype = NewTarget.prototype) &&
2719 NewTargetPrototype !== Wrapper.prototype
2720 ) objectSetPrototypeOf($this, NewTargetPrototype);
2721 return $this;
2722 };
2723
2724 var RegExpPrototype$2 = RegExp.prototype;
2725
2726 var regexpGetFlags = function (R) {
2727 var flags = R.flags;
2728 return flags === undefined && !('flags' in RegExpPrototype$2) && !hasOwnProperty_1(R, 'flags') && objectIsPrototypeOf(RegExpPrototype$2, R)
2729 ? functionCall(regexpFlags, R) : flags;
2730 };
2731
2732 var defineProperty$3 = objectDefineProperty.f;
2733
2734 var proxyAccessor = function (Target, Source, key) {
2735 key in Target || defineProperty$3(Target, key, {
2736 configurable: true,
2737 get: function () { return Source[key]; },
2738 set: function (it) { Source[key] = it; }
2739 });
2740 };
2741
2742 var SPECIES$1 = wellKnownSymbol('species');
2743
2744 var setSpecies = function (CONSTRUCTOR_NAME) {
2745 var Constructor = getBuiltIn(CONSTRUCTOR_NAME);
2746 var defineProperty = objectDefineProperty.f;
2747
2748 if (descriptors && Constructor && !Constructor[SPECIES$1]) {
2749 defineProperty(Constructor, SPECIES$1, {
2750 configurable: true,
2751 get: function () { return this; }
2752 });
2753 }
2754 };
2755
2756 var getOwnPropertyNames$1 = objectGetOwnPropertyNames.f;
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766 var enforceInternalState = internalState.enforce;
2767
2768
2769
2770
2771
2772 var MATCH = wellKnownSymbol('match');
2773 var NativeRegExp = global_1.RegExp;
2774 var RegExpPrototype$1 = NativeRegExp.prototype;
2775 var SyntaxError = global_1.SyntaxError;
2776 var exec = functionUncurryThis(RegExpPrototype$1.exec);
2777 var charAt = functionUncurryThis(''.charAt);
2778 var replace = functionUncurryThis(''.replace);
2779 var stringIndexOf = functionUncurryThis(''.indexOf);
2780 var stringSlice$1 = functionUncurryThis(''.slice);
2781 // TODO: Use only propper RegExpIdentifierName
2782 var IS_NCG = /^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/;
2783 var re1 = /a/g;
2784 var re2 = /a/g;
2785
2786 // "new" should create a new object, old webkit bug
2787 var CORRECT_NEW = new NativeRegExp(re1) !== re1;
2788
2789 var MISSED_STICKY = regexpStickyHelpers.MISSED_STICKY;
2790 var UNSUPPORTED_Y = regexpStickyHelpers.UNSUPPORTED_Y;
2791
2792 var BASE_FORCED = descriptors &&
2793 (!CORRECT_NEW || MISSED_STICKY || regexpUnsupportedDotAll || regexpUnsupportedNcg || fails(function () {
2794 re2[MATCH] = false;
2795 // RegExp constructor can alter flags and IsRegExp works correct with @@match
2796 return NativeRegExp(re1) != re1 || NativeRegExp(re2) == re2 || NativeRegExp(re1, 'i') != '/a/i';
2797 }));
2798
2799 var handleDotAll = function (string) {
2800 var length = string.length;
2801 var index = 0;
2802 var result = '';
2803 var brackets = false;
2804 var chr;
2805 for (; index <= length; index++) {
2806 chr = charAt(string, index);
2807 if (chr === '\\') {
2808 result += chr + charAt(string, ++index);
2809 continue;
2810 }
2811 if (!brackets && chr === '.') {
2812 result += '[\\s\\S]';
2813 } else {
2814 if (chr === '[') {
2815 brackets = true;
2816 } else if (chr === ']') {
2817 brackets = false;
2818 } result += chr;
2819 }
2820 } return result;
2821 };
2822
2823 var handleNCG = function (string) {
2824 var length = string.length;
2825 var index = 0;
2826 var result = '';
2827 var named = [];
2828 var names = {};
2829 var brackets = false;
2830 var ncg = false;
2831 var groupid = 0;
2832 var groupname = '';
2833 var chr;
2834 for (; index <= length; index++) {
2835 chr = charAt(string, index);
2836 if (chr === '\\') {
2837 chr = chr + charAt(string, ++index);
2838 } else if (chr === ']') {
2839 brackets = false;
2840 } else if (!brackets) switch (true) {
2841 case chr === '[':
2842 brackets = true;
2843 break;
2844 case chr === '(':
2845 if (exec(IS_NCG, stringSlice$1(string, index + 1))) {
2846 index += 2;
2847 ncg = true;
2848 }
2849 result += chr;
2850 groupid++;
2851 continue;
2852 case chr === '>' && ncg:
2853 if (groupname === '' || hasOwnProperty_1(names, groupname)) {
2854 throw new SyntaxError('Invalid capture group name');
2855 }
2856 names[groupname] = true;
2857 named[named.length] = [groupname, groupid];
2858 ncg = false;
2859 groupname = '';
2860 continue;
2861 }
2862 if (ncg) groupname += chr;
2863 else result += chr;
2864 } return [result, named];
2865 };
2866
2867 // `RegExp` constructor
2868 // https://tc39.es/ecma262/#sec-regexp-constructor
2869 if (isForced_1('RegExp', BASE_FORCED)) {
2870 var RegExpWrapper = function RegExp(pattern, flags) {
2871 var thisIsRegExp = objectIsPrototypeOf(RegExpPrototype$1, this);
2872 var patternIsRegExp = isRegexp(pattern);
2873 var flagsAreUndefined = flags === undefined;
2874 var groups = [];
2875 var rawPattern = pattern;
2876 var rawFlags, dotAll, sticky, handled, result, state;
2877
2878 if (!thisIsRegExp && patternIsRegExp && flagsAreUndefined && pattern.constructor === RegExpWrapper) {
2879 return pattern;
2880 }
2881
2882 if (patternIsRegExp || objectIsPrototypeOf(RegExpPrototype$1, pattern)) {
2883 pattern = pattern.source;
2884 if (flagsAreUndefined) flags = regexpGetFlags(rawPattern);
2885 }
2886
2887 pattern = pattern === undefined ? '' : toString_1(pattern);
2888 flags = flags === undefined ? '' : toString_1(flags);
2889 rawPattern = pattern;
2890
2891 if (regexpUnsupportedDotAll && 'dotAll' in re1) {
2892 dotAll = !!flags && stringIndexOf(flags, 's') > -1;
2893 if (dotAll) flags = replace(flags, /s/g, '');
2894 }
2895
2896 rawFlags = flags;
2897
2898 if (MISSED_STICKY && 'sticky' in re1) {
2899 sticky = !!flags && stringIndexOf(flags, 'y') > -1;
2900 if (sticky && UNSUPPORTED_Y) flags = replace(flags, /y/g, '');
2901 }
2902
2903 if (regexpUnsupportedNcg) {
2904 handled = handleNCG(pattern);
2905 pattern = handled[0];
2906 groups = handled[1];
2907 }
2908
2909 result = inheritIfRequired(NativeRegExp(pattern, flags), thisIsRegExp ? this : RegExpPrototype$1, RegExpWrapper);
2910
2911 if (dotAll || sticky || groups.length) {
2912 state = enforceInternalState(result);
2913 if (dotAll) {
2914 state.dotAll = true;
2915 state.raw = RegExpWrapper(handleDotAll(pattern), rawFlags);
2916 }
2917 if (sticky) state.sticky = true;
2918 if (groups.length) state.groups = groups;
2919 }
2920
2921 if (pattern !== rawPattern) try {
2922 // fails in old engines, but we have no alternatives for unsupported regex syntax
2923 createNonEnumerableProperty(result, 'source', rawPattern === '' ? '(?:)' : rawPattern);
2924 } catch (error) { /* empty */ }
2925
2926 return result;
2927 };
2928
2929 for (var keys$1 = getOwnPropertyNames$1(NativeRegExp), index = 0; keys$1.length > index;) {
2930 proxyAccessor(RegExpWrapper, NativeRegExp, keys$1[index++]);
2931 }
2932
2933 RegExpPrototype$1.constructor = RegExpWrapper;
2934 RegExpWrapper.prototype = RegExpPrototype$1;
2935 defineBuiltIn(global_1, 'RegExp', RegExpWrapper);
2936 }
2937
2938 // https://tc39.es/ecma262/#sec-get-regexp-@@species
2939 setSpecies('RegExp');
2940
2941 var PROPER_FUNCTION_NAME$1 = functionName.PROPER;
2942
2943
2944
2945
2946
2947
2948 var TO_STRING = 'toString';
2949 var RegExpPrototype = RegExp.prototype;
2950 var n$ToString = RegExpPrototype[TO_STRING];
2951
2952 var NOT_GENERIC = fails(function () { return n$ToString.call({ source: 'a', flags: 'b' }) != '/a/b'; });
2953 // FF44- RegExp#toString has a wrong name
2954 var INCORRECT_NAME = PROPER_FUNCTION_NAME$1 && n$ToString.name != TO_STRING;
2955
2956 // `RegExp.prototype.toString` method
2957 // https://tc39.es/ecma262/#sec-regexp.prototype.tostring
2958 if (NOT_GENERIC || INCORRECT_NAME) {
2959 defineBuiltIn(RegExp.prototype, TO_STRING, function toString() {
2960 var R = anObject(this);
2961 var pattern = toString_1(R.source);
2962 var flags = toString_1(regexpGetFlags(R));
2963 return '/' + pattern + '/' + flags;
2964 }, { unsafe: true });
2965 }
2966
2967 var arraySlice$1 = functionUncurryThis([].slice);
2968
2969 var HAS_SPECIES_SUPPORT$1 = arrayMethodHasSpeciesSupport('slice');
2970
2971 var SPECIES = wellKnownSymbol('species');
2972 var Array$1 = global_1.Array;
2973 var max$1 = Math.max;
2974
2975 // `Array.prototype.slice` method
2976 // https://tc39.es/ecma262/#sec-array.prototype.slice
2977 // fallback for not array-like ES3 strings and DOM objects
2978 _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$1 }, {
2979 slice: function slice(start, end) {
2980 var O = toIndexedObject(this);
2981 var length = lengthOfArrayLike(O);
2982 var k = toAbsoluteIndex(start, length);
2983 var fin = toAbsoluteIndex(end === undefined ? length : end, length);
2984 // inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible
2985 var Constructor, result, n;
2986 if (isArray(O)) {
2987 Constructor = O.constructor;
2988 // cross-realm fallback
2989 if (isConstructor(Constructor) && (Constructor === Array$1 || isArray(Constructor.prototype))) {
2990 Constructor = undefined;
2991 } else if (isObject(Constructor)) {
2992 Constructor = Constructor[SPECIES];
2993 if (Constructor === null) Constructor = undefined;
2994 }
2995 if (Constructor === Array$1 || Constructor === undefined) {
2996 return arraySlice$1(O, k, fin);
2997 }
2998 }
2999 result = new (Constructor === undefined ? Array$1 : Constructor)(max$1(fin - k, 0));
3000 for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]);
3001 result.length = n;
3002 return result;
3003 }
3004 });
3005
3006 var iterators = {};
3007
3008 var correctPrototypeGetter = !fails(function () {
3009 function F() { /* empty */ }
3010 F.prototype.constructor = null;
3011 // eslint-disable-next-line es-x/no-object-getprototypeof -- required for testing
3012 return Object.getPrototypeOf(new F()) !== F.prototype;
3013 });
3014
3015 var IE_PROTO = sharedKey('IE_PROTO');
3016 var Object$1 = global_1.Object;
3017 var ObjectPrototype = Object$1.prototype;
3018
3019 // `Object.getPrototypeOf` method
3020 // https://tc39.es/ecma262/#sec-object.getprototypeof
3021 var objectGetPrototypeOf = correctPrototypeGetter ? Object$1.getPrototypeOf : function (O) {
3022 var object = toObject(O);
3023 if (hasOwnProperty_1(object, IE_PROTO)) return object[IE_PROTO];
3024 var constructor = object.constructor;
3025 if (isCallable(constructor) && object instanceof constructor) {
3026 return constructor.prototype;
3027 } return object instanceof Object$1 ? ObjectPrototype : null;
3028 };
3029
3030 var ITERATOR$2 = wellKnownSymbol('iterator');
3031 var BUGGY_SAFARI_ITERATORS$1 = false;
3032
3033 // `%IteratorPrototype%` object
3034 // https://tc39.es/ecma262/#sec-%iteratorprototype%-object
3035 var IteratorPrototype$2, PrototypeOfArrayIteratorPrototype, arrayIterator;
3036
3037 /* eslint-disable es-x/no-array-prototype-keys -- safe */
3038 if ([].keys) {
3039 arrayIterator = [].keys();
3040 // Safari 8 has buggy iterators w/o `next`
3041 if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS$1 = true;
3042 else {
3043 PrototypeOfArrayIteratorPrototype = objectGetPrototypeOf(objectGetPrototypeOf(arrayIterator));
3044 if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype$2 = PrototypeOfArrayIteratorPrototype;
3045 }
3046 }
3047
3048 var NEW_ITERATOR_PROTOTYPE = IteratorPrototype$2 == undefined || fails(function () {
3049 var test = {};
3050 // FF44- legacy iterators case
3051 return IteratorPrototype$2[ITERATOR$2].call(test) !== test;
3052 });
3053
3054 if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype$2 = {};
3055
3056 // `%IteratorPrototype%[@@iterator]()` method
3057 // https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator
3058 if (!isCallable(IteratorPrototype$2[ITERATOR$2])) {
3059 defineBuiltIn(IteratorPrototype$2, ITERATOR$2, function () {
3060 return this;
3061 });
3062 }
3063
3064 var iteratorsCore = {
3065 IteratorPrototype: IteratorPrototype$2,
3066 BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS$1
3067 };
3068
3069 var defineProperty$2 = objectDefineProperty.f;
3070
3071
3072
3073 var TO_STRING_TAG$1 = wellKnownSymbol('toStringTag');
3074
3075 var setToStringTag = function (target, TAG, STATIC) {
3076 if (target && !STATIC) target = target.prototype;
3077 if (target && !hasOwnProperty_1(target, TO_STRING_TAG$1)) {
3078 defineProperty$2(target, TO_STRING_TAG$1, { configurable: true, value: TAG });
3079 }
3080 };
3081
3082 var IteratorPrototype$1 = iteratorsCore.IteratorPrototype;
3083
3084
3085
3086
3087
3088 var returnThis$1 = function () { return this; };
3089
3090 var createIteratorConstructor = function (IteratorConstructor, NAME, next, ENUMERABLE_NEXT) {
3091 var TO_STRING_TAG = NAME + ' Iterator';
3092 IteratorConstructor.prototype = objectCreate(IteratorPrototype$1, { next: createPropertyDescriptor(+!ENUMERABLE_NEXT, next) });
3093 setToStringTag(IteratorConstructor, TO_STRING_TAG, false);
3094 iterators[TO_STRING_TAG] = returnThis$1;
3095 return IteratorConstructor;
3096 };
3097
3098 var PROPER_FUNCTION_NAME = functionName.PROPER;
3099 var CONFIGURABLE_FUNCTION_NAME = functionName.CONFIGURABLE;
3100 var IteratorPrototype = iteratorsCore.IteratorPrototype;
3101 var BUGGY_SAFARI_ITERATORS = iteratorsCore.BUGGY_SAFARI_ITERATORS;
3102 var ITERATOR$1 = wellKnownSymbol('iterator');
3103 var KEYS = 'keys';
3104 var VALUES = 'values';
3105 var ENTRIES = 'entries';
3106
3107 var returnThis = function () { return this; };
3108
3109 var defineIterator = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
3110 createIteratorConstructor(IteratorConstructor, NAME, next);
3111
3112 var getIterationMethod = function (KIND) {
3113 if (KIND === DEFAULT && defaultIterator) return defaultIterator;
3114 if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype) return IterablePrototype[KIND];
3115 switch (KIND) {
3116 case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };
3117 case VALUES: return function values() { return new IteratorConstructor(this, KIND); };
3118 case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };
3119 } return function () { return new IteratorConstructor(this); };
3120 };
3121
3122 var TO_STRING_TAG = NAME + ' Iterator';
3123 var INCORRECT_VALUES_NAME = false;
3124 var IterablePrototype = Iterable.prototype;
3125 var nativeIterator = IterablePrototype[ITERATOR$1]
3126 || IterablePrototype['@@iterator']
3127 || DEFAULT && IterablePrototype[DEFAULT];
3128 var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
3129 var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
3130 var CurrentIteratorPrototype, methods, KEY;
3131
3132 // fix native
3133 if (anyNativeIterator) {
3134 CurrentIteratorPrototype = objectGetPrototypeOf(anyNativeIterator.call(new Iterable()));
3135 if (CurrentIteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
3136 if (objectGetPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {
3137 if (objectSetPrototypeOf) {
3138 objectSetPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);
3139 } else if (!isCallable(CurrentIteratorPrototype[ITERATOR$1])) {
3140 defineBuiltIn(CurrentIteratorPrototype, ITERATOR$1, returnThis);
3141 }
3142 }
3143 // Set @@toStringTag to native iterators
3144 setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true);
3145 }
3146 }
3147
3148 // fix Array.prototype.{ values, @@iterator }.name in V8 / FF
3149 if (PROPER_FUNCTION_NAME && DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
3150 if (CONFIGURABLE_FUNCTION_NAME) {
3151 createNonEnumerableProperty(IterablePrototype, 'name', VALUES);
3152 } else {
3153 INCORRECT_VALUES_NAME = true;
3154 defaultIterator = function values() { return functionCall(nativeIterator, this); };
3155 }
3156 }
3157
3158 // export additional methods
3159 if (DEFAULT) {
3160 methods = {
3161 values: getIterationMethod(VALUES),
3162 keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
3163 entries: getIterationMethod(ENTRIES)
3164 };
3165 if (FORCED) for (KEY in methods) {
3166 if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
3167 defineBuiltIn(IterablePrototype, KEY, methods[KEY]);
3168 }
3169 } else _export({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);
3170 }
3171
3172 // define iterator
3173 if (IterablePrototype[ITERATOR$1] !== defaultIterator) {
3174 defineBuiltIn(IterablePrototype, ITERATOR$1, defaultIterator, { name: DEFAULT });
3175 }
3176 iterators[NAME] = defaultIterator;
3177
3178 return methods;
3179 };
3180
3181 var defineProperty$1 = objectDefineProperty.f;
3182
3183
3184
3185
3186 var ARRAY_ITERATOR = 'Array Iterator';
3187 var setInternalState = internalState.set;
3188 var getInternalState = internalState.getterFor(ARRAY_ITERATOR);
3189
3190 // `Array.prototype.entries` method
3191 // https://tc39.es/ecma262/#sec-array.prototype.entries
3192 // `Array.prototype.keys` method
3193 // https://tc39.es/ecma262/#sec-array.prototype.keys
3194 // `Array.prototype.values` method
3195 // https://tc39.es/ecma262/#sec-array.prototype.values
3196 // `Array.prototype[@@iterator]` method
3197 // https://tc39.es/ecma262/#sec-array.prototype-@@iterator
3198 // `CreateArrayIterator` internal method
3199 // https://tc39.es/ecma262/#sec-createarrayiterator
3200 var es_array_iterator = defineIterator(Array, 'Array', function (iterated, kind) {
3201 setInternalState(this, {
3202 type: ARRAY_ITERATOR,
3203 target: toIndexedObject(iterated), // target
3204 index: 0, // next index
3205 kind: kind // kind
3206 });
3207 // `%ArrayIteratorPrototype%.next` method
3208 // https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next
3209 }, function () {
3210 var state = getInternalState(this);
3211 var target = state.target;
3212 var kind = state.kind;
3213 var index = state.index++;
3214 if (!target || index >= target.length) {
3215 state.target = undefined;
3216 return { value: undefined, done: true };
3217 }
3218 if (kind == 'keys') return { value: index, done: false };
3219 if (kind == 'values') return { value: target[index], done: false };
3220 return { value: [index, target[index]], done: false };
3221 }, 'values');
3222
3223 // argumentsList[@@iterator] is %ArrayProto_values%
3224 // https://tc39.es/ecma262/#sec-createunmappedargumentsobject
3225 // https://tc39.es/ecma262/#sec-createmappedargumentsobject
3226 var values = iterators.Arguments = iterators.Array;
3227
3228 // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
3229 addToUnscopables('keys');
3230 addToUnscopables('values');
3231 addToUnscopables('entries');
3232
3233 // V8 ~ Chrome 45- bug
3234 if (descriptors && values.name !== 'values') try {
3235 defineProperty$1(values, 'name', { value: 'values' });
3236 } catch (error) { /* empty */ }
3237
3238 var ITERATOR = wellKnownSymbol('iterator');
3239 var TO_STRING_TAG = wellKnownSymbol('toStringTag');
3240 var ArrayValues = es_array_iterator.values;
3241
3242 var handlePrototype = function (CollectionPrototype, COLLECTION_NAME) {
3243 if (CollectionPrototype) {
3244 // some Chrome versions have non-configurable methods on DOMTokenList
3245 if (CollectionPrototype[ITERATOR] !== ArrayValues) try {
3246 createNonEnumerableProperty(CollectionPrototype, ITERATOR, ArrayValues);
3247 } catch (error) {
3248 CollectionPrototype[ITERATOR] = ArrayValues;
3249 }
3250 if (!CollectionPrototype[TO_STRING_TAG]) {
3251 createNonEnumerableProperty(CollectionPrototype, TO_STRING_TAG, COLLECTION_NAME);
3252 }
3253 if (domIterables[COLLECTION_NAME]) for (var METHOD_NAME in es_array_iterator) {
3254 // some Chrome versions have non-configurable methods on DOMTokenList
3255 if (CollectionPrototype[METHOD_NAME] !== es_array_iterator[METHOD_NAME]) try {
3256 createNonEnumerableProperty(CollectionPrototype, METHOD_NAME, es_array_iterator[METHOD_NAME]);
3257 } catch (error) {
3258 CollectionPrototype[METHOD_NAME] = es_array_iterator[METHOD_NAME];
3259 }
3260 }
3261 }
3262 };
3263
3264 for (var COLLECTION_NAME in domIterables) {
3265 handlePrototype(global_1[COLLECTION_NAME] && global_1[COLLECTION_NAME].prototype, COLLECTION_NAME);
3266 }
3267
3268 handlePrototype(domTokenListPrototype, 'DOMTokenList');
3269
3270 var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('splice');
3271
3272 var TypeError$2 = global_1.TypeError;
3273 var max = Math.max;
3274 var min$2 = Math.min;
3275 var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
3276 var MAXIMUM_ALLOWED_LENGTH_EXCEEDED = 'Maximum allowed length exceeded';
3277
3278 // `Array.prototype.splice` method
3279 // https://tc39.es/ecma262/#sec-array.prototype.splice
3280 // with adding support of @@species
3281 _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
3282 splice: function splice(start, deleteCount /* , ...items */) {
3283 var O = toObject(this);
3284 var len = lengthOfArrayLike(O);
3285 var actualStart = toAbsoluteIndex(start, len);
3286 var argumentsLength = arguments.length;
3287 var insertCount, actualDeleteCount, A, k, from, to;
3288 if (argumentsLength === 0) {
3289 insertCount = actualDeleteCount = 0;
3290 } else if (argumentsLength === 1) {
3291 insertCount = 0;
3292 actualDeleteCount = len - actualStart;
3293 } else {
3294 insertCount = argumentsLength - 2;
3295 actualDeleteCount = min$2(max(toIntegerOrInfinity(deleteCount), 0), len - actualStart);
3296 }
3297 if (len + insertCount - actualDeleteCount > MAX_SAFE_INTEGER) {
3298 throw TypeError$2(MAXIMUM_ALLOWED_LENGTH_EXCEEDED);
3299 }
3300 A = arraySpeciesCreate(O, actualDeleteCount);
3301 for (k = 0; k < actualDeleteCount; k++) {
3302 from = actualStart + k;
3303 if (from in O) createProperty(A, k, O[from]);
3304 }
3305 A.length = actualDeleteCount;
3306 if (insertCount < actualDeleteCount) {
3307 for (k = actualStart; k < len - actualDeleteCount; k++) {
3308 from = k + actualDeleteCount;
3309 to = k + insertCount;
3310 if (from in O) O[to] = O[from];
3311 else delete O[to];
3312 }
3313 for (k = len; k > len - actualDeleteCount + insertCount; k--) delete O[k - 1];
3314 } else if (insertCount > actualDeleteCount) {
3315 for (k = len - actualDeleteCount; k > actualStart; k--) {
3316 from = k + actualDeleteCount - 1;
3317 to = k + insertCount - 1;
3318 if (from in O) O[to] = O[from];
3319 else delete O[to];
3320 }
3321 }
3322 for (k = 0; k < insertCount; k++) {
3323 O[k + actualStart] = arguments[k + 2];
3324 }
3325 O.length = len - actualDeleteCount + insertCount;
3326 return A;
3327 }
3328 });
3329
3330 // `thisNumberValue` abstract operation
3331 // https://tc39.es/ecma262/#sec-thisnumbervalue
3332 var thisNumberValue = functionUncurryThis(1.0.valueOf);
3333
3334 var getOwnPropertyNames = objectGetOwnPropertyNames.f;
3335 var getOwnPropertyDescriptor$2 = objectGetOwnPropertyDescriptor.f;
3336 var defineProperty = objectDefineProperty.f;
3337
3338 var trim = stringTrim.trim;
3339
3340 var NUMBER = 'Number';
3341 var NativeNumber = global_1[NUMBER];
3342 var NumberPrototype = NativeNumber.prototype;
3343 var TypeError$1 = global_1.TypeError;
3344 var arraySlice = functionUncurryThis(''.slice);
3345 var charCodeAt = functionUncurryThis(''.charCodeAt);
3346
3347 // `ToNumeric` abstract operation
3348 // https://tc39.es/ecma262/#sec-tonumeric
3349 var toNumeric = function (value) {
3350 var primValue = toPrimitive(value, 'number');
3351 return typeof primValue == 'bigint' ? primValue : toNumber(primValue);
3352 };
3353
3354 // `ToNumber` abstract operation
3355 // https://tc39.es/ecma262/#sec-tonumber
3356 var toNumber = function (argument) {
3357 var it = toPrimitive(argument, 'number');
3358 var first, third, radix, maxCode, digits, length, index, code;
3359 if (isSymbol(it)) throw TypeError$1('Cannot convert a Symbol value to a number');
3360 if (typeof it == 'string' && it.length > 2) {
3361 it = trim(it);
3362 first = charCodeAt(it, 0);
3363 if (first === 43 || first === 45) {
3364 third = charCodeAt(it, 2);
3365 if (third === 88 || third === 120) return NaN; // Number('+0x1') should be NaN, old V8 fix
3366 } else if (first === 48) {
3367 switch (charCodeAt(it, 1)) {
3368 case 66: case 98: radix = 2; maxCode = 49; break; // fast equal of /^0b[01]+$/i
3369 case 79: case 111: radix = 8; maxCode = 55; break; // fast equal of /^0o[0-7]+$/i
3370 default: return +it;
3371 }
3372 digits = arraySlice(it, 2);
3373 length = digits.length;
3374 for (index = 0; index < length; index++) {
3375 code = charCodeAt(digits, index);
3376 // parseInt parses a string to a first unavailable symbol
3377 // but ToNumber should return NaN if a string contains unavailable symbols
3378 if (code < 48 || code > maxCode) return NaN;
3379 } return parseInt(digits, radix);
3380 }
3381 } return +it;
3382 };
3383
3384 // `Number` constructor
3385 // https://tc39.es/ecma262/#sec-number-constructor
3386 if (isForced_1(NUMBER, !NativeNumber(' 0o1') || !NativeNumber('0b1') || NativeNumber('+0x1'))) {
3387 var NumberWrapper = function Number(value) {
3388 var n = arguments.length < 1 ? 0 : NativeNumber(toNumeric(value));
3389 var dummy = this;
3390 // check on 1..constructor(foo) case
3391 return objectIsPrototypeOf(NumberPrototype, dummy) && fails(function () { thisNumberValue(dummy); })
3392 ? inheritIfRequired(Object(n), dummy, NumberWrapper) : n;
3393 };
3394 for (var keys = descriptors ? getOwnPropertyNames(NativeNumber) : (
3395 // ES3:
3396 'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' +
3397 // ES2015 (in case, if modules with ES2015 Number statics required before):
3398 'EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,' +
3399 // ESNext
3400 'fromString,range'
3401 ).split(','), j = 0, key; keys.length > j; j++) {
3402 if (hasOwnProperty_1(NativeNumber, key = keys[j]) && !hasOwnProperty_1(NumberWrapper, key)) {
3403 defineProperty(NumberWrapper, key, getOwnPropertyDescriptor$2(NativeNumber, key));
3404 }
3405 }
3406 NumberWrapper.prototype = NumberPrototype;
3407 NumberPrototype.constructor = NumberWrapper;
3408 defineBuiltIn(global_1, NUMBER, NumberWrapper);
3409 }
3410
3411 var un$Reverse = functionUncurryThis([].reverse);
3412 var test = [1, 2];
3413
3414 // `Array.prototype.reverse` method
3415 // https://tc39.es/ecma262/#sec-array.prototype.reverse
3416 // fix for Safari 12.0 bug
3417 // https://bugs.webkit.org/show_bug.cgi?id=188794
3418 _export({ target: 'Array', proto: true, forced: String(test) === String(test.reverse()) }, {
3419 reverse: function reverse() {
3420 // eslint-disable-next-line no-self-assign -- dirty hack
3421 if (isArray(this)) this.length = this.length;
3422 return un$Reverse(this);
3423 }
3424 });
3425
3426 var FAILS_ON_PRIMITIVES = fails(function () { objectKeys(1); });
3427
3428 // `Object.keys` method
3429 // https://tc39.es/ecma262/#sec-object.keys
3430 _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
3431 keys: function keys(it) {
3432 return objectKeys(toObject(it));
3433 }
3434 });
3435
3436 // @@match logic
3437 fixRegexpWellKnownSymbolLogic('match', function (MATCH, nativeMatch, maybeCallNative) {
3438 return [
3439 // `String.prototype.match` method
3440 // https://tc39.es/ecma262/#sec-string.prototype.match
3441 function match(regexp) {
3442 var O = requireObjectCoercible(this);
3443 var matcher = regexp == undefined ? undefined : getMethod(regexp, MATCH);
3444 return matcher ? functionCall(matcher, regexp, O) : new RegExp(regexp)[MATCH](toString_1(O));
3445 },
3446 // `RegExp.prototype[@@match]` method
3447 // https://tc39.es/ecma262/#sec-regexp.prototype-@@match
3448 function (string) {
3449 var rx = anObject(this);
3450 var S = toString_1(string);
3451 var res = maybeCallNative(nativeMatch, rx, S);
3452
3453 if (res.done) return res.value;
3454
3455 if (!rx.global) return regexpExecAbstract(rx, S);
3456
3457 var fullUnicode = rx.unicode;
3458 rx.lastIndex = 0;
3459 var A = [];
3460 var n = 0;
3461 var result;
3462 while ((result = regexpExecAbstract(rx, S)) !== null) {
3463 var matchStr = toString_1(result[0]);
3464 A[n] = matchStr;
3465 if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
3466 n++;
3467 }
3468 return n === 0 ? null : A;
3469 }
3470 ];
3471 });
3472
3473 var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
3474
3475
3476
3477
3478
3479
3480
3481 // eslint-disable-next-line es-x/no-string-prototype-startswith -- safe
3482 var un$StartsWith = functionUncurryThis(''.startsWith);
3483 var stringSlice = functionUncurryThis(''.slice);
3484 var min$1 = Math.min;
3485
3486 var CORRECT_IS_REGEXP_LOGIC$1 = correctIsRegexpLogic('startsWith');
3487 // https://github.com/zloirock/core-js/pull/702
3488 var MDN_POLYFILL_BUG$1 = !CORRECT_IS_REGEXP_LOGIC$1 && !!function () {
3489 var descriptor = getOwnPropertyDescriptor$1(String.prototype, 'startsWith');
3490 return descriptor && !descriptor.writable;
3491 }();
3492
3493 // `String.prototype.startsWith` method
3494 // https://tc39.es/ecma262/#sec-string.prototype.startswith
3495 _export({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG$1 && !CORRECT_IS_REGEXP_LOGIC$1 }, {
3496 startsWith: function startsWith(searchString /* , position = 0 */) {
3497 var that = toString_1(requireObjectCoercible(this));
3498 notARegexp(searchString);
3499 var index = toLength(min$1(arguments.length > 1 ? arguments[1] : undefined, that.length));
3500 var search = toString_1(searchString);
3501 return un$StartsWith
3502 ? un$StartsWith(that, search, index)
3503 : stringSlice(that, index, index + search.length) === search;
3504 }
3505 });
3506
3507 var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
3508
3509
3510
3511
3512
3513
3514
3515 // eslint-disable-next-line es-x/no-string-prototype-endswith -- safe
3516 var un$EndsWith = functionUncurryThis(''.endsWith);
3517 var slice = functionUncurryThis(''.slice);
3518 var min = Math.min;
3519
3520 var CORRECT_IS_REGEXP_LOGIC = correctIsRegexpLogic('endsWith');
3521 // https://github.com/zloirock/core-js/pull/702
3522 var MDN_POLYFILL_BUG = !CORRECT_IS_REGEXP_LOGIC && !!function () {
3523 var descriptor = getOwnPropertyDescriptor(String.prototype, 'endsWith');
3524 return descriptor && !descriptor.writable;
3525 }();
3526
3527 // `String.prototype.endsWith` method
3528 // https://tc39.es/ecma262/#sec-string.prototype.endswith
3529 _export({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG && !CORRECT_IS_REGEXP_LOGIC }, {
3530 endsWith: function endsWith(searchString /* , endPosition = @length */) {
3531 var that = toString_1(requireObjectCoercible(this));
3532 notARegexp(searchString);
3533 var endPosition = arguments.length > 1 ? arguments[1] : undefined;
3534 var len = that.length;
3535 var end = endPosition === undefined ? len : min(toLength(endPosition), len);
3536 var search = toString_1(searchString);
3537 return un$EndsWith
3538 ? un$EndsWith(that, search, end)
3539 : slice(that, end - search.length, end) === search;
3540 }
3541 });
3542
3543 var Utils = {
3544 getBootstrapVersion: function getBootstrapVersion() {
3545 var bootstrapVersion = 5;
3546
3547 try {
3548 var rawVersion = $__default["default"].fn.dropdown.Constructor.VERSION; // Only try to parse VERSION if it is defined.
3549 // It is undefined in older versions of Bootstrap (tested with 3.1.1).
3550
3551 if (rawVersion !== undefined) {
3552 bootstrapVersion = parseInt(rawVersion, 10);
3553 }
3554 } catch (e) {// ignore
3555 }
3556
3557 try {
3558 // eslint-disable-next-line no-undef
3559 var _rawVersion = bootstrap.Tooltip.VERSION;
3560
3561 if (_rawVersion !== undefined) {
3562 bootstrapVersion = parseInt(_rawVersion, 10);
3563 }
3564 } catch (e) {// ignore
3565 }
3566
3567 return bootstrapVersion;
3568 },
3569 getIconsPrefix: function getIconsPrefix(theme) {
3570 return {
3571 bootstrap3: 'glyphicon',
3572 bootstrap4: 'fa',
3573 bootstrap5: 'bi',
3574 'bootstrap-table': 'icon',
3575 bulma: 'fa',
3576 foundation: 'fa',
3577 materialize: 'material-icons',
3578 semantic: 'fa'
3579 }[theme] || 'fa';
3580 },
3581 getIcons: function getIcons(prefix) {
3582 return {
3583 glyphicon: {
3584 paginationSwitchDown: 'glyphicon-collapse-down icon-chevron-down',
3585 paginationSwitchUp: 'glyphicon-collapse-up icon-chevron-up',
3586 refresh: 'glyphicon-refresh icon-refresh',
3587 toggleOff: 'glyphicon-list-alt icon-list-alt',
3588 toggleOn: 'glyphicon-list-alt icon-list-alt',
3589 columns: 'glyphicon-th icon-th',
3590 detailOpen: 'glyphicon-plus icon-plus',
3591 detailClose: 'glyphicon-minus icon-minus',
3592 fullscreen: 'glyphicon-fullscreen',
3593 search: 'glyphicon-search',
3594 clearSearch: 'glyphicon-trash'
3595 },
3596 fa: {
3597 paginationSwitchDown: 'fa-caret-square-down',
3598 paginationSwitchUp: 'fa-caret-square-up',
3599 refresh: 'fa-sync',
3600 toggleOff: 'fa-toggle-off',
3601 toggleOn: 'fa-toggle-on',
3602 columns: 'fa-th-list',
3603 detailOpen: 'fa-plus',
3604 detailClose: 'fa-minus',
3605 fullscreen: 'fa-arrows-alt',
3606 search: 'fa-search',
3607 clearSearch: 'fa-trash'
3608 },
3609 bi: {
3610 paginationSwitchDown: 'bi-caret-down-square',
3611 paginationSwitchUp: 'bi-caret-up-square',
3612 refresh: 'bi-arrow-clockwise',
3613 toggleOff: 'bi-toggle-off',
3614 toggleOn: 'bi-toggle-on',
3615 columns: 'bi-list-ul',
3616 detailOpen: 'bi-plus',
3617 detailClose: 'bi-dash',
3618 fullscreen: 'bi-arrows-move',
3619 search: 'bi-search',
3620 clearSearch: 'bi-trash'
3621 },
3622 icon: {
3623 paginationSwitchDown: 'icon-arrow-up-circle',
3624 paginationSwitchUp: 'icon-arrow-down-circle',
3625 refresh: 'icon-refresh-cw',
3626 toggleOff: 'icon-toggle-right',
3627 toggleOn: 'icon-toggle-right',
3628 columns: 'icon-list',
3629 detailOpen: 'icon-plus',
3630 detailClose: 'icon-minus',
3631 fullscreen: 'icon-maximize',
3632 search: 'icon-search',
3633 clearSearch: 'icon-trash-2'
3634 },
3635 'material-icons': {
3636 paginationSwitchDown: 'grid_on',
3637 paginationSwitchUp: 'grid_off',
3638 refresh: 'refresh',
3639 toggleOff: 'tablet',
3640 toggleOn: 'tablet_android',
3641 columns: 'view_list',
3642 detailOpen: 'add',
3643 detailClose: 'remove',
3644 fullscreen: 'fullscreen',
3645 sort: 'sort',
3646 search: 'search',
3647 clearSearch: 'delete'
3648 }
3649 }[prefix];
3650 },
3651 getSearchInput: function getSearchInput(that) {
3652 if (typeof that.options.searchSelector === 'string') {
3653 return $__default["default"](that.options.searchSelector);
3654 }
3655
3656 return that.$toolbar.find('.search input');
3657 },
3658 // it only does '%s', and return '' when arguments are undefined
3659 sprintf: function sprintf(_str) {
3660 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
3661 args[_key - 1] = arguments[_key];
3662 }
3663
3664 var flag = true;
3665 var i = 0;
3666
3667 var str = _str.replace(/%s/g, function () {
3668 var arg = args[i++];
3669
3670 if (typeof arg === 'undefined') {
3671 flag = false;
3672 return '';
3673 }
3674
3675 return arg;
3676 });
3677
3678 return flag ? str : '';
3679 },
3680 isObject: function isObject(val) {
3681 return val instanceof Object && !Array.isArray(val);
3682 },
3683 isEmptyObject: function isEmptyObject() {
3684 var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
3685 return Object.entries(obj).length === 0 && obj.constructor === Object;
3686 },
3687 isNumeric: function isNumeric(n) {
3688 return !isNaN(parseFloat(n)) && isFinite(n);
3689 },
3690 getFieldTitle: function getFieldTitle(list, value) {
3691 var _iterator = _createForOfIteratorHelper(list),
3692 _step;
3693
3694 try {
3695 for (_iterator.s(); !(_step = _iterator.n()).done;) {
3696 var item = _step.value;
3697
3698 if (item.field === value) {
3699 return item.title;
3700 }
3701 }
3702 } catch (err) {
3703 _iterator.e(err);
3704 } finally {
3705 _iterator.f();
3706 }
3707
3708 return '';
3709 },
3710 setFieldIndex: function setFieldIndex(columns) {
3711 var totalCol = 0;
3712 var flag = [];
3713
3714 var _iterator2 = _createForOfIteratorHelper(columns[0]),
3715 _step2;
3716
3717 try {
3718 for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
3719 var column = _step2.value;
3720 totalCol += column.colspan || 1;
3721 }
3722 } catch (err) {
3723 _iterator2.e(err);
3724 } finally {
3725 _iterator2.f();
3726 }
3727
3728 for (var i = 0; i < columns.length; i++) {
3729 flag[i] = [];
3730
3731 for (var j = 0; j < totalCol; j++) {
3732 flag[i][j] = false;
3733 }
3734 }
3735
3736 for (var _i = 0; _i < columns.length; _i++) {
3737 var _iterator3 = _createForOfIteratorHelper(columns[_i]),
3738 _step3;
3739
3740 try {
3741 for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
3742 var r = _step3.value;
3743 var rowspan = r.rowspan || 1;
3744 var colspan = r.colspan || 1;
3745
3746 var index = flag[_i].indexOf(false);
3747
3748 r.colspanIndex = index;
3749
3750 if (colspan === 1) {
3751 r.fieldIndex = index; // when field is undefined, use index instead
3752
3753 if (typeof r.field === 'undefined') {
3754 r.field = index;
3755 }
3756 } else {
3757 r.colspanGroup = r.colspan;
3758 }
3759
3760 for (var _j = 0; _j < rowspan; _j++) {
3761 for (var k = 0; k < colspan; k++) {
3762 flag[_i + _j][index + k] = true;
3763 }
3764 }
3765 }
3766 } catch (err) {
3767 _iterator3.e(err);
3768 } finally {
3769 _iterator3.f();
3770 }
3771 }
3772 },
3773 normalizeAccent: function normalizeAccent(value) {
3774 if (typeof value !== 'string') {
3775 return value;
3776 }
3777
3778 return value.normalize('NFD').replace(/[\u0300-\u036f]/g, '');
3779 },
3780 updateFieldGroup: function updateFieldGroup(columns, fieldColumns) {
3781 var _ref;
3782
3783 var allColumns = (_ref = []).concat.apply(_ref, _toConsumableArray(columns));
3784
3785 var _iterator4 = _createForOfIteratorHelper(columns),
3786 _step4;
3787
3788 try {
3789 for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
3790 var c = _step4.value;
3791
3792 var _iterator6 = _createForOfIteratorHelper(c),
3793 _step6;
3794
3795 try {
3796 for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
3797 var r = _step6.value;
3798
3799 if (r.colspanGroup > 1) {
3800 var colspan = 0;
3801
3802 var _loop = function _loop(i) {
3803 var column = allColumns.find(function (col) {
3804 return col.fieldIndex === i;
3805 });
3806
3807 if (column.visible) {
3808 colspan++;
3809 }
3810 };
3811
3812 for (var i = r.colspanIndex; i < r.colspanIndex + r.colspanGroup; i++) {
3813 _loop(i);
3814 }
3815
3816 r.colspan = colspan;
3817 r.visible = colspan > 0;
3818 }
3819 }
3820 } catch (err) {
3821 _iterator6.e(err);
3822 } finally {
3823 _iterator6.f();
3824 }
3825 }
3826 } catch (err) {
3827 _iterator4.e(err);
3828 } finally {
3829 _iterator4.f();
3830 }
3831
3832 if (columns.length < 2) {
3833 return;
3834 }
3835
3836 var _iterator5 = _createForOfIteratorHelper(fieldColumns),
3837 _step5;
3838
3839 try {
3840 var _loop2 = function _loop2() {
3841 var column = _step5.value;
3842 var sameColumns = allColumns.filter(function (col) {
3843 return col.fieldIndex === column.fieldIndex;
3844 });
3845
3846 if (sameColumns.length > 1) {
3847 var _iterator7 = _createForOfIteratorHelper(sameColumns),
3848 _step7;
3849
3850 try {
3851 for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
3852 var _c = _step7.value;
3853 _c.visible = column.visible;
3854 }
3855 } catch (err) {
3856 _iterator7.e(err);
3857 } finally {
3858 _iterator7.f();
3859 }
3860 }
3861 };
3862
3863 for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
3864 _loop2();
3865 }
3866 } catch (err) {
3867 _iterator5.e(err);
3868 } finally {
3869 _iterator5.f();
3870 }
3871 },
3872 getScrollBarWidth: function getScrollBarWidth() {
3873 if (this.cachedWidth === undefined) {
3874 var $inner = $__default["default"]('<div/>').addClass('fixed-table-scroll-inner');
3875 var $outer = $__default["default"]('<div/>').addClass('fixed-table-scroll-outer');
3876 $outer.append($inner);
3877 $__default["default"]('body').append($outer);
3878 var w1 = $inner[0].offsetWidth;
3879 $outer.css('overflow', 'scroll');
3880 var w2 = $inner[0].offsetWidth;
3881
3882 if (w1 === w2) {
3883 w2 = $outer[0].clientWidth;
3884 }
3885
3886 $outer.remove();
3887 this.cachedWidth = w1 - w2;
3888 }
3889
3890 return this.cachedWidth;
3891 },
3892 calculateObjectValue: function calculateObjectValue(self, name, args, defaultValue) {
3893 var func = name;
3894
3895 if (typeof name === 'string') {
3896 // support obj.func1.func2
3897 var names = name.split('.');
3898
3899 if (names.length > 1) {
3900 func = window;
3901
3902 var _iterator8 = _createForOfIteratorHelper(names),
3903 _step8;
3904
3905 try {
3906 for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
3907 var f = _step8.value;
3908 func = func[f];
3909 }
3910 } catch (err) {
3911 _iterator8.e(err);
3912 } finally {
3913 _iterator8.f();
3914 }
3915 } else {
3916 func = window[name];
3917 }
3918 }
3919
3920 if (func !== null && _typeof(func) === 'object') {
3921 return func;
3922 }
3923
3924 if (typeof func === 'function') {
3925 return func.apply(self, args || []);
3926 }
3927
3928 if (!func && typeof name === 'string' && args && this.sprintf.apply(this, [name].concat(_toConsumableArray(args)))) {
3929 return this.sprintf.apply(this, [name].concat(_toConsumableArray(args)));
3930 }
3931
3932 return defaultValue;
3933 },
3934 compareObjects: function compareObjects(objectA, objectB, compareLength) {
3935 var aKeys = Object.keys(objectA);
3936 var bKeys = Object.keys(objectB);
3937
3938 if (compareLength && aKeys.length !== bKeys.length) {
3939 return false;
3940 }
3941
3942 for (var _i2 = 0, _aKeys = aKeys; _i2 < _aKeys.length; _i2++) {
3943 var key = _aKeys[_i2];
3944
3945 if (bKeys.includes(key) && objectA[key] !== objectB[key]) {
3946 return false;
3947 }
3948 }
3949
3950 return true;
3951 },
3952 regexCompare: function regexCompare(value, search) {
3953 try {
3954 var regexpParts = search.match(/^\/(.*?)\/([gim]*)$/);
3955
3956 if (value.toString().search(regexpParts ? new RegExp(regexpParts[1], regexpParts[2]) : new RegExp(search, 'gim')) !== -1) {
3957 return true;
3958 }
3959 } catch (e) {
3960 return false;
3961 }
3962 },
3963 escapeHTML: function escapeHTML(text) {
3964 if (!text) {
3965 return text;
3966 }
3967
3968 return text.toString().replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#39;');
3969 },
3970 unescapeHTML: function unescapeHTML(text) {
3971 if (typeof text !== 'string' || !text) {
3972 return text;
3973 }
3974
3975 return text.toString().replace(/&amp;/g, '&').replace(/&lt;/g, '<').replace(/&gt;/g, '>').replace(/&quot;/g, '"').replace(/&#39;/g, '\'');
3976 },
3977 removeHTML: function removeHTML(text) {
3978 if (!text) {
3979 return text;
3980 }
3981
3982 return text.toString().replace(/(<([^>]+)>)/ig, '').replace(/&[#A-Za-z0-9]+;/gi, '').trim();
3983 },
3984 getRealDataAttr: function getRealDataAttr(dataAttr) {
3985 for (var _i3 = 0, _Object$entries = Object.entries(dataAttr); _i3 < _Object$entries.length; _i3++) {
3986 var _Object$entries$_i = _slicedToArray(_Object$entries[_i3], 2),
3987 attr = _Object$entries$_i[0],
3988 value = _Object$entries$_i[1];
3989
3990 var auxAttr = attr.split(/(?=[A-Z])/).join('-').toLowerCase();
3991
3992 if (auxAttr !== attr) {
3993 dataAttr[auxAttr] = value;
3994 delete dataAttr[attr];
3995 }
3996 }
3997
3998 return dataAttr;
3999 },
4000 getItemField: function getItemField(item, field, escape) {
4001 var columnEscape = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : undefined;
4002 var value = item; // use column escape if it is defined
4003
4004 if (typeof columnEscape !== 'undefined') {
4005 escape = columnEscape;
4006 }
4007
4008 if (typeof field !== 'string' || item.hasOwnProperty(field)) {
4009 return escape ? this.escapeHTML(item[field]) : item[field];
4010 }
4011
4012 var props = field.split('.');
4013
4014 var _iterator9 = _createForOfIteratorHelper(props),
4015 _step9;
4016
4017 try {
4018 for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
4019 var p = _step9.value;
4020 value = value && value[p];
4021 }
4022 } catch (err) {
4023 _iterator9.e(err);
4024 } finally {
4025 _iterator9.f();
4026 }
4027
4028 return escape ? this.escapeHTML(value) : value;
4029 },
4030 isIEBrowser: function isIEBrowser() {
4031 return navigator.userAgent.includes('MSIE ') || /Trident.*rv:11\./.test(navigator.userAgent);
4032 },
4033 findIndex: function findIndex(items, item) {
4034 var _iterator10 = _createForOfIteratorHelper(items),
4035 _step10;
4036
4037 try {
4038 for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
4039 var it = _step10.value;
4040
4041 if (JSON.stringify(it) === JSON.stringify(item)) {
4042 return items.indexOf(it);
4043 }
4044 }
4045 } catch (err) {
4046 _iterator10.e(err);
4047 } finally {
4048 _iterator10.f();
4049 }
4050
4051 return -1;
4052 },
4053 trToData: function trToData(columns, $els) {
4054 var _this = this;
4055
4056 var data = [];
4057 var m = [];
4058 $els.each(function (y, el) {
4059 var $el = $__default["default"](el);
4060 var row = {}; // save tr's id, class and data-* attributes
4061
4062 row._id = $el.attr('id');
4063 row._class = $el.attr('class');
4064 row._data = _this.getRealDataAttr($el.data());
4065 row._style = $el.attr('style');
4066 $el.find('>td,>th').each(function (_x, el) {
4067 var $el = $__default["default"](el);
4068 var cspan = +$el.attr('colspan') || 1;
4069 var rspan = +$el.attr('rowspan') || 1;
4070 var x = _x; // skip already occupied cells in current row
4071
4072 for (; m[y] && m[y][x]; x++) {// ignore
4073 } // mark matrix elements occupied by current cell with true
4074
4075
4076 for (var tx = x; tx < x + cspan; tx++) {
4077 for (var ty = y; ty < y + rspan; ty++) {
4078 if (!m[ty]) {
4079 // fill missing rows
4080 m[ty] = [];
4081 }
4082
4083 m[ty][tx] = true;
4084 }
4085 }
4086
4087 var field = columns[x].field;
4088 row[field] = $el.html().trim(); // save td's id, class and data-* attributes
4089
4090 row["_".concat(field, "_id")] = $el.attr('id');
4091 row["_".concat(field, "_class")] = $el.attr('class');
4092 row["_".concat(field, "_rowspan")] = $el.attr('rowspan');
4093 row["_".concat(field, "_colspan")] = $el.attr('colspan');
4094 row["_".concat(field, "_title")] = $el.attr('title');
4095 row["_".concat(field, "_data")] = _this.getRealDataAttr($el.data());
4096 row["_".concat(field, "_style")] = $el.attr('style');
4097 });
4098 data.push(row);
4099 });
4100 return data;
4101 },
4102 sort: function sort(a, b, order, sortStable, aPosition, bPosition) {
4103 if (a === undefined || a === null) {
4104 a = '';
4105 }
4106
4107 if (b === undefined || b === null) {
4108 b = '';
4109 }
4110
4111 if (sortStable && a === b) {
4112 a = aPosition;
4113 b = bPosition;
4114 } // If both values are numeric, do a numeric comparison
4115
4116
4117 if (this.isNumeric(a) && this.isNumeric(b)) {
4118 // Convert numerical values form string to float.
4119 a = parseFloat(a);
4120 b = parseFloat(b);
4121
4122 if (a < b) {
4123 return order * -1;
4124 }
4125
4126 if (a > b) {
4127 return order;
4128 }
4129
4130 return 0;
4131 }
4132
4133 if (a === b) {
4134 return 0;
4135 } // If value is not a string, convert to string
4136
4137
4138 if (typeof a !== 'string') {
4139 a = a.toString();
4140 }
4141
4142 if (a.localeCompare(b) === -1) {
4143 return order * -1;
4144 }
4145
4146 return order;
4147 },
4148 getEventName: function getEventName(eventPrefix) {
4149 var id = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
4150 id = id || "".concat(+new Date()).concat(~~(Math.random() * 1000000));
4151 return "".concat(eventPrefix, "-").concat(id);
4152 },
4153 hasDetailViewIcon: function hasDetailViewIcon(options) {
4154 return options.detailView && options.detailViewIcon && !options.cardView;
4155 },
4156 getDetailViewIndexOffset: function getDetailViewIndexOffset(options) {
4157 return this.hasDetailViewIcon(options) && options.detailViewAlign !== 'right' ? 1 : 0;
4158 },
4159 checkAutoMergeCells: function checkAutoMergeCells(data) {
4160 var _iterator11 = _createForOfIteratorHelper(data),
4161 _step11;
4162
4163 try {
4164 for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
4165 var row = _step11.value;
4166
4167 for (var _i4 = 0, _Object$keys = Object.keys(row); _i4 < _Object$keys.length; _i4++) {
4168 var key = _Object$keys[_i4];
4169
4170 if (key.startsWith('_') && (key.endsWith('_rowspan') || key.endsWith('_colspan'))) {
4171 return true;
4172 }
4173 }
4174 }
4175 } catch (err) {
4176 _iterator11.e(err);
4177 } finally {
4178 _iterator11.f();
4179 }
4180
4181 return false;
4182 },
4183 deepCopy: function deepCopy(arg) {
4184 if (arg === undefined) {
4185 return arg;
4186 }
4187
4188 return $__default["default"].extend(true, Array.isArray(arg) ? [] : {}, arg);
4189 },
4190 debounce: function debounce(func, wait, immediate) {
4191 var timeout;
4192 return function executedFunction() {
4193 var context = this;
4194 var args = arguments;
4195
4196 var later = function later() {
4197 timeout = null;
4198 if (!immediate) func.apply(context, args);
4199 };
4200
4201 var callNow = immediate && !timeout;
4202 clearTimeout(timeout);
4203 timeout = setTimeout(later, wait);
4204 if (callNow) func.apply(context, args);
4205 };
4206 }
4207 };
4208
4209 var VERSION = '1.20.1';
4210 var bootstrapVersion = Utils.getBootstrapVersion();
4211 var CONSTANTS = {
4212 3: {
4213 classes: {
4214 buttonsPrefix: 'btn',
4215 buttons: 'default',
4216 buttonsGroup: 'btn-group',
4217 buttonsDropdown: 'btn-group',
4218 pull: 'pull',
4219 inputGroup: 'input-group',
4220 inputPrefix: 'input-',
4221 input: 'form-control',
4222 select: 'form-control',
4223 paginationDropdown: 'btn-group dropdown',
4224 dropup: 'dropup',
4225 dropdownActive: 'active',
4226 paginationActive: 'active',
4227 buttonActive: 'active'
4228 },
4229 html: {
4230 toolbarDropdown: ['<ul class="dropdown-menu" role="menu">', '</ul>'],
4231 toolbarDropdownItem: '<li class="dropdown-item-marker" role="menuitem"><label>%s</label></li>',
4232 toolbarDropdownSeparator: '<li class="divider"></li>',
4233 pageDropdown: ['<ul class="dropdown-menu" role="menu">', '</ul>'],
4234 pageDropdownItem: '<li role="menuitem" class="%s"><a href="#">%s</a></li>',
4235 dropdownCaret: '<span class="caret"></span>',
4236 pagination: ['<ul class="pagination%s">', '</ul>'],
4237 paginationItem: '<li class="page-item%s"><a class="page-link" aria-label="%s" href="javascript:void(0)">%s</a></li>',
4238 icon: '<i class="%s %s"></i>',
4239 inputGroup: '<div class="input-group">%s<span class="input-group-btn">%s</span></div>',
4240 searchInput: '<input class="%s%s" type="text" placeholder="%s">',
4241 searchButton: '<button class="%s" type="button" name="search" title="%s">%s %s</button>',
4242 searchClearButton: '<button class="%s" type="button" name="clearSearch" title="%s">%s %s</button>'
4243 }
4244 },
4245 4: {
4246 classes: {
4247 buttonsPrefix: 'btn',
4248 buttons: 'secondary',
4249 buttonsGroup: 'btn-group',
4250 buttonsDropdown: 'btn-group',
4251 pull: 'float',
4252 inputGroup: 'btn-group',
4253 inputPrefix: 'form-control-',
4254 input: 'form-control',
4255 select: 'form-control',
4256 paginationDropdown: 'btn-group dropdown',
4257 dropup: 'dropup',
4258 dropdownActive: 'active',
4259 paginationActive: 'active',
4260 buttonActive: 'active'
4261 },
4262 html: {
4263 toolbarDropdown: ['<div class="dropdown-menu dropdown-menu-right">', '</div>'],
4264 toolbarDropdownItem: '<label class="dropdown-item dropdown-item-marker">%s</label>',
4265 pageDropdown: ['<div class="dropdown-menu">', '</div>'],
4266 pageDropdownItem: '<a class="dropdown-item %s" href="#">%s</a>',
4267 toolbarDropdownSeparator: '<div class="dropdown-divider"></div>',
4268 dropdownCaret: '<span class="caret"></span>',
4269 pagination: ['<ul class="pagination%s">', '</ul>'],
4270 paginationItem: '<li class="page-item%s"><a class="page-link" aria-label="%s" href="javascript:void(0)">%s</a></li>',
4271 icon: '<i class="%s %s"></i>',
4272 inputGroup: '<div class="input-group">%s<div class="input-group-append">%s</div></div>',
4273 searchInput: '<input class="%s%s" type="text" placeholder="%s">',
4274 searchButton: '<button class="%s" type="button" name="search" title="%s">%s %s</button>',
4275 searchClearButton: '<button class="%s" type="button" name="clearSearch" title="%s">%s %s</button>'
4276 }
4277 },
4278 5: {
4279 classes: {
4280 buttonsPrefix: 'btn',
4281 buttons: 'secondary',
4282 buttonsGroup: 'btn-group',
4283 buttonsDropdown: 'btn-group',
4284 pull: 'float',
4285 inputGroup: 'btn-group',
4286 inputPrefix: 'form-control-',
4287 input: 'form-control',
4288 select: 'form-select',
4289 paginationDropdown: 'btn-group dropdown',
4290 dropup: 'dropup',
4291 dropdownActive: 'active',
4292 paginationActive: 'active',
4293 buttonActive: 'active'
4294 },
4295 html: {
4296 dataToggle: 'data-bs-toggle',
4297 toolbarDropdown: ['<div class="dropdown-menu dropdown-menu-right">', '</div>'],
4298 toolbarDropdownItem: '<label class="dropdown-item dropdown-item-marker">%s</label>',
4299 pageDropdown: ['<div class="dropdown-menu">', '</div>'],
4300 pageDropdownItem: '<a class="dropdown-item %s" href="#">%s</a>',
4301 toolbarDropdownSeparator: '<div class="dropdown-divider"></div>',
4302 dropdownCaret: '<span class="caret"></span>',
4303 pagination: ['<ul class="pagination%s">', '</ul>'],
4304 paginationItem: '<li class="page-item%s"><a class="page-link" aria-label="%s" href="javascript:void(0)">%s</a></li>',
4305 icon: '<i class="%s %s"></i>',
4306 inputGroup: '<div class="input-group">%s%s</div>',
4307 searchInput: '<input class="%s%s" type="text" placeholder="%s">',
4308 searchButton: '<button class="%s" type="button" name="search" title="%s">%s %s</button>',
4309 searchClearButton: '<button class="%s" type="button" name="clearSearch" title="%s">%s %s</button>'
4310 }
4311 }
4312 }[bootstrapVersion];
4313 var DEFAULTS = {
4314 height: undefined,
4315 classes: 'table table-bordered table-hover',
4316 buttons: {},
4317 theadClasses: '',
4318 headerStyle: function headerStyle(column) {
4319 return {};
4320 },
4321 rowStyle: function rowStyle(row, index) {
4322 return {};
4323 },
4324 rowAttributes: function rowAttributes(row, index) {
4325 return {};
4326 },
4327 undefinedText: '-',
4328 locale: undefined,
4329 virtualScroll: false,
4330 virtualScrollItemHeight: undefined,
4331 sortable: true,
4332 sortClass: undefined,
4333 silentSort: true,
4334 sortName: undefined,
4335 sortOrder: undefined,
4336 sortReset: false,
4337 sortStable: false,
4338 rememberOrder: false,
4339 serverSort: true,
4340 customSort: undefined,
4341 columns: [[]],
4342 data: [],
4343 url: undefined,
4344 method: 'get',
4345 cache: true,
4346 contentType: 'application/json',
4347 dataType: 'json',
4348 ajax: undefined,
4349 ajaxOptions: {},
4350 queryParams: function queryParams(params) {
4351 return params;
4352 },
4353 queryParamsType: 'limit',
4354 // 'limit', undefined
4355 responseHandler: function responseHandler(res) {
4356 return res;
4357 },
4358 totalField: 'total',
4359 totalNotFilteredField: 'totalNotFiltered',
4360 dataField: 'rows',
4361 footerField: 'footer',
4362 pagination: false,
4363 paginationParts: ['pageInfo', 'pageSize', 'pageList'],
4364 showExtendedPagination: false,
4365 paginationLoop: true,
4366 sidePagination: 'client',
4367 // client or server
4368 totalRows: 0,
4369 totalNotFiltered: 0,
4370 pageNumber: 1,
4371 pageSize: 10,
4372 pageList: [10, 25, 50, 100],
4373 paginationHAlign: 'right',
4374 // right, left
4375 paginationVAlign: 'bottom',
4376 // bottom, top, both
4377 paginationDetailHAlign: 'left',
4378 // right, left
4379 paginationPreText: '&lsaquo;',
4380 paginationNextText: '&rsaquo;',
4381 paginationSuccessivelySize: 5,
4382 // Maximum successively number of pages in a row
4383 paginationPagesBySide: 1,
4384 // Number of pages on each side (right, left) of the current page.
4385 paginationUseIntermediate: false,
4386 // Calculate intermediate pages for quick access
4387 search: false,
4388 searchHighlight: false,
4389 searchOnEnterKey: false,
4390 strictSearch: false,
4391 regexSearch: false,
4392 searchSelector: false,
4393 visibleSearch: false,
4394 showButtonIcons: true,
4395 showButtonText: false,
4396 showSearchButton: false,
4397 showSearchClearButton: false,
4398 trimOnSearch: true,
4399 searchAlign: 'right',
4400 searchTimeOut: 500,
4401 searchText: '',
4402 customSearch: undefined,
4403 showHeader: true,
4404 showFooter: false,
4405 footerStyle: function footerStyle(column) {
4406 return {};
4407 },
4408 searchAccentNeutralise: false,
4409 showColumns: false,
4410 showColumnsToggleAll: false,
4411 showColumnsSearch: false,
4412 minimumCountColumns: 1,
4413 showPaginationSwitch: false,
4414 showRefresh: false,
4415 showToggle: false,
4416 showFullscreen: false,
4417 smartDisplay: true,
4418 escape: false,
4419 filterOptions: {
4420 filterAlgorithm: 'and'
4421 },
4422 idField: undefined,
4423 selectItemName: 'btSelectItem',
4424 clickToSelect: false,
4425 ignoreClickToSelectOn: function ignoreClickToSelectOn(_ref) {
4426 var tagName = _ref.tagName;
4427 return ['A', 'BUTTON'].includes(tagName);
4428 },
4429 singleSelect: false,
4430 checkboxHeader: true,
4431 maintainMetaData: false,
4432 multipleSelectRow: false,
4433 uniqueId: undefined,
4434 cardView: false,
4435 detailView: false,
4436 detailViewIcon: true,
4437 detailViewByClick: false,
4438 detailViewAlign: 'left',
4439 detailFormatter: function detailFormatter(index, row) {
4440 return '';
4441 },
4442 detailFilter: function detailFilter(index, row) {
4443 return true;
4444 },
4445 toolbar: undefined,
4446 toolbarAlign: 'left',
4447 buttonsToolbar: undefined,
4448 buttonsAlign: 'right',
4449 buttonsOrder: ['paginationSwitch', 'refresh', 'toggle', 'fullscreen', 'columns'],
4450 buttonsPrefix: CONSTANTS.classes.buttonsPrefix,
4451 buttonsClass: CONSTANTS.classes.buttons,
4452 iconsPrefix: undefined,
4453 // init in initConstants
4454 icons: {},
4455 // init in initConstants
4456 iconSize: undefined,
4457 loadingFontSize: 'auto',
4458 loadingTemplate: function loadingTemplate(loadingMessage) {
4459 return "<span class=\"loading-wrap\">\n <span class=\"loading-text\">".concat(loadingMessage, "</span>\n <span class=\"animation-wrap\"><span class=\"animation-dot\"></span></span>\n </span>\n ");
4460 },
4461 onAll: function onAll(name, args) {
4462 return false;
4463 },
4464 onClickCell: function onClickCell(field, value, row, $element) {
4465 return false;
4466 },
4467 onDblClickCell: function onDblClickCell(field, value, row, $element) {
4468 return false;
4469 },
4470 onClickRow: function onClickRow(item, $element) {
4471 return false;
4472 },
4473 onDblClickRow: function onDblClickRow(item, $element) {
4474 return false;
4475 },
4476 onSort: function onSort(name, order) {
4477 return false;
4478 },
4479 onCheck: function onCheck(row) {
4480 return false;
4481 },
4482 onUncheck: function onUncheck(row) {
4483 return false;
4484 },
4485 onCheckAll: function onCheckAll(rows) {
4486 return false;
4487 },
4488 onUncheckAll: function onUncheckAll(rows) {
4489 return false;
4490 },
4491 onCheckSome: function onCheckSome(rows) {
4492 return false;
4493 },
4494 onUncheckSome: function onUncheckSome(rows) {
4495 return false;
4496 },
4497 onLoadSuccess: function onLoadSuccess(data) {
4498 return false;
4499 },
4500 onLoadError: function onLoadError(status) {
4501 return false;
4502 },
4503 onColumnSwitch: function onColumnSwitch(field, checked) {
4504 return false;
4505 },
4506 onColumnSwitchAll: function onColumnSwitchAll(checked) {
4507 return false;
4508 },
4509 onPageChange: function onPageChange(number, size) {
4510 return false;
4511 },
4512 onSearch: function onSearch(text) {
4513 return false;
4514 },
4515 onToggle: function onToggle(cardView) {
4516 return false;
4517 },
4518 onPreBody: function onPreBody(data) {
4519 return false;
4520 },
4521 onPostBody: function onPostBody() {
4522 return false;
4523 },
4524 onPostHeader: function onPostHeader() {
4525 return false;
4526 },
4527 onPostFooter: function onPostFooter() {
4528 return false;
4529 },
4530 onExpandRow: function onExpandRow(index, row, $detail) {
4531 return false;
4532 },
4533 onCollapseRow: function onCollapseRow(index, row) {
4534 return false;
4535 },
4536 onRefreshOptions: function onRefreshOptions(options) {
4537 return false;
4538 },
4539 onRefresh: function onRefresh(params) {
4540 return false;
4541 },
4542 onResetView: function onResetView() {
4543 return false;
4544 },
4545 onScrollBody: function onScrollBody() {
4546 return false;
4547 },
4548 onTogglePagination: function onTogglePagination(newState) {
4549 return false;
4550 },
4551 onVirtualScroll: function onVirtualScroll(startIndex, endIndex) {
4552 return false;
4553 }
4554 };
4555 var EN = {
4556 formatLoadingMessage: function formatLoadingMessage() {
4557 return 'Loading, please wait';
4558 },
4559 formatRecordsPerPage: function formatRecordsPerPage(pageNumber) {
4560 return "".concat(pageNumber, " rows per page");
4561 },
4562 formatShowingRows: function formatShowingRows(pageFrom, pageTo, totalRows, totalNotFiltered) {
4563 if (totalNotFiltered !== undefined && totalNotFiltered > 0 && totalNotFiltered > totalRows) {
4564 return "Showing ".concat(pageFrom, " to ").concat(pageTo, " of ").concat(totalRows, " rows (filtered from ").concat(totalNotFiltered, " total rows)");
4565 }
4566
4567 return "Showing ".concat(pageFrom, " to ").concat(pageTo, " of ").concat(totalRows, " rows");
4568 },
4569 formatSRPaginationPreText: function formatSRPaginationPreText() {
4570 return 'previous page';
4571 },
4572 formatSRPaginationPageText: function formatSRPaginationPageText(page) {
4573 return "to page ".concat(page);
4574 },
4575 formatSRPaginationNextText: function formatSRPaginationNextText() {
4576 return 'next page';
4577 },
4578 formatDetailPagination: function formatDetailPagination(totalRows) {
4579 return "Showing ".concat(totalRows, " rows");
4580 },
4581 formatSearch: function formatSearch() {
4582 return 'Search';
4583 },
4584 formatClearSearch: function formatClearSearch() {
4585 return 'Clear Search';
4586 },
4587 formatNoMatches: function formatNoMatches() {
4588 return 'No matching records found';
4589 },
4590 formatPaginationSwitch: function formatPaginationSwitch() {
4591 return 'Hide/Show pagination';
4592 },
4593 formatPaginationSwitchDown: function formatPaginationSwitchDown() {
4594 return 'Show pagination';
4595 },
4596 formatPaginationSwitchUp: function formatPaginationSwitchUp() {
4597 return 'Hide pagination';
4598 },
4599 formatRefresh: function formatRefresh() {
4600 return 'Refresh';
4601 },
4602 formatToggle: function formatToggle() {
4603 return 'Toggle';
4604 },
4605 formatToggleOn: function formatToggleOn() {
4606 return 'Show card view';
4607 },
4608 formatToggleOff: function formatToggleOff() {
4609 return 'Hide card view';
4610 },
4611 formatColumns: function formatColumns() {
4612 return 'Columns';
4613 },
4614 formatColumnsToggleAll: function formatColumnsToggleAll() {
4615 return 'Toggle all';
4616 },
4617 formatFullscreen: function formatFullscreen() {
4618 return 'Fullscreen';
4619 },
4620 formatAllRows: function formatAllRows() {
4621 return 'All';
4622 }
4623 };
4624 var COLUMN_DEFAULTS = {
4625 field: undefined,
4626 title: undefined,
4627 titleTooltip: undefined,
4628 class: undefined,
4629 width: undefined,
4630 widthUnit: 'px',
4631 rowspan: undefined,
4632 colspan: undefined,
4633 align: undefined,
4634 // left, right, center
4635 halign: undefined,
4636 // left, right, center
4637 falign: undefined,
4638 // left, right, center
4639 valign: undefined,
4640 // top, middle, bottom
4641 cellStyle: undefined,
4642 radio: false,
4643 checkbox: false,
4644 checkboxEnabled: true,
4645 clickToSelect: true,
4646 showSelectTitle: false,
4647 sortable: false,
4648 sortName: undefined,
4649 order: 'asc',
4650 // asc, desc
4651 sorter: undefined,
4652 visible: true,
4653 switchable: true,
4654 cardVisible: true,
4655 searchable: true,
4656 formatter: undefined,
4657 footerFormatter: undefined,
4658 detailFormatter: undefined,
4659 searchFormatter: true,
4660 searchHighlightFormatter: false,
4661 escape: undefined,
4662 events: undefined
4663 };
4664 var METHODS = ['getOptions', 'refreshOptions', 'getData', 'getSelections', 'load', 'append', 'prepend', 'remove', 'removeAll', 'insertRow', 'updateRow', 'getRowByUniqueId', 'updateByUniqueId', 'removeByUniqueId', 'updateCell', 'updateCellByUniqueId', 'showRow', 'hideRow', 'getHiddenRows', 'showColumn', 'hideColumn', 'getVisibleColumns', 'getHiddenColumns', 'showAllColumns', 'hideAllColumns', 'mergeCells', 'checkAll', 'uncheckAll', 'checkInvert', 'check', 'uncheck', 'checkBy', 'uncheckBy', 'refresh', 'destroy', 'resetView', 'showLoading', 'hideLoading', 'togglePagination', 'toggleFullscreen', 'toggleView', 'resetSearch', 'filterBy', 'scrollTo', 'getScrollPosition', 'selectPage', 'prevPage', 'nextPage', 'toggleDetailView', 'expandRow', 'collapseRow', 'expandRowByUniqueId', 'collapseRowByUniqueId', 'expandAllRows', 'collapseAllRows', 'updateColumnTitle', 'updateFormatText'];
4665 var EVENTS = {
4666 'all.bs.table': 'onAll',
4667 'click-row.bs.table': 'onClickRow',
4668 'dbl-click-row.bs.table': 'onDblClickRow',
4669 'click-cell.bs.table': 'onClickCell',
4670 'dbl-click-cell.bs.table': 'onDblClickCell',
4671 'sort.bs.table': 'onSort',
4672 'check.bs.table': 'onCheck',
4673 'uncheck.bs.table': 'onUncheck',
4674 'check-all.bs.table': 'onCheckAll',
4675 'uncheck-all.bs.table': 'onUncheckAll',
4676 'check-some.bs.table': 'onCheckSome',
4677 'uncheck-some.bs.table': 'onUncheckSome',
4678 'load-success.bs.table': 'onLoadSuccess',
4679 'load-error.bs.table': 'onLoadError',
4680 'column-switch.bs.table': 'onColumnSwitch',
4681 'column-switch-all.bs.table': 'onColumnSwitchAll',
4682 'page-change.bs.table': 'onPageChange',
4683 'search.bs.table': 'onSearch',
4684 'toggle.bs.table': 'onToggle',
4685 'pre-body.bs.table': 'onPreBody',
4686 'post-body.bs.table': 'onPostBody',
4687 'post-header.bs.table': 'onPostHeader',
4688 'post-footer.bs.table': 'onPostFooter',
4689 'expand-row.bs.table': 'onExpandRow',
4690 'collapse-row.bs.table': 'onCollapseRow',
4691 'refresh-options.bs.table': 'onRefreshOptions',
4692 'reset-view.bs.table': 'onResetView',
4693 'refresh.bs.table': 'onRefresh',
4694 'scroll-body.bs.table': 'onScrollBody',
4695 'toggle-pagination.bs.table': 'onTogglePagination',
4696 'virtual-scroll.bs.table': 'onVirtualScroll'
4697 };
4698 Object.assign(DEFAULTS, EN);
4699 var Constants = {
4700 VERSION: VERSION,
4701 THEME: "bootstrap".concat(bootstrapVersion),
4702 CONSTANTS: CONSTANTS,
4703 DEFAULTS: DEFAULTS,
4704 COLUMN_DEFAULTS: COLUMN_DEFAULTS,
4705 METHODS: METHODS,
4706 EVENTS: EVENTS,
4707 LOCALES: {
4708 en: EN,
4709 'en-US': EN
4710 }
4711 };
4712
4713 var BLOCK_ROWS = 50;
4714 var CLUSTER_BLOCKS = 4;
4715
4716 var VirtualScroll = /*#__PURE__*/function () {
4717 function VirtualScroll(options) {
4718 var _this = this;
4719
4720 _classCallCheck(this, VirtualScroll);
4721
4722 this.rows = options.rows;
4723 this.scrollEl = options.scrollEl;
4724 this.contentEl = options.contentEl;
4725 this.callback = options.callback;
4726 this.itemHeight = options.itemHeight;
4727 this.cache = {};
4728 this.scrollTop = this.scrollEl.scrollTop;
4729 this.initDOM(this.rows, options.fixedScroll);
4730 this.scrollEl.scrollTop = this.scrollTop;
4731 this.lastCluster = 0;
4732
4733 var onScroll = function onScroll() {
4734 if (_this.lastCluster !== (_this.lastCluster = _this.getNum())) {
4735 _this.initDOM(_this.rows);
4736
4737 _this.callback(_this.startIndex, _this.endIndex);
4738 }
4739 };
4740
4741 this.scrollEl.addEventListener('scroll', onScroll, false);
4742
4743 this.destroy = function () {
4744 _this.contentEl.innerHtml = '';
4745
4746 _this.scrollEl.removeEventListener('scroll', onScroll, false);
4747 };
4748 }
4749
4750 _createClass(VirtualScroll, [{
4751 key: "initDOM",
4752 value: function initDOM(rows, fixedScroll) {
4753 if (typeof this.clusterHeight === 'undefined') {
4754 this.cache.scrollTop = this.scrollEl.scrollTop;
4755 this.cache.data = this.contentEl.innerHTML = rows[0] + rows[0] + rows[0];
4756 this.getRowsHeight(rows);
4757 }
4758
4759 var data = this.initData(rows, this.getNum(fixedScroll));
4760 var thisRows = data.rows.join('');
4761 var dataChanged = this.checkChanges('data', thisRows);
4762 var topOffsetChanged = this.checkChanges('top', data.topOffset);
4763 var bottomOffsetChanged = this.checkChanges('bottom', data.bottomOffset);
4764 var html = [];
4765
4766 if (dataChanged && topOffsetChanged) {
4767 if (data.topOffset) {
4768 html.push(this.getExtra('top', data.topOffset));
4769 }
4770
4771 html.push(thisRows);
4772
4773 if (data.bottomOffset) {
4774 html.push(this.getExtra('bottom', data.bottomOffset));
4775 }
4776
4777 this.startIndex = data.start;
4778 this.endIndex = data.end;
4779 this.contentEl.innerHTML = html.join('');
4780
4781 if (fixedScroll) {
4782 this.contentEl.scrollTop = this.cache.scrollTop;
4783 }
4784 } else if (bottomOffsetChanged) {
4785 this.contentEl.lastChild.style.height = "".concat(data.bottomOffset, "px");
4786 }
4787 }
4788 }, {
4789 key: "getRowsHeight",
4790 value: function getRowsHeight() {
4791 if (typeof this.itemHeight === 'undefined') {
4792 var nodes = this.contentEl.children;
4793 var node = nodes[Math.floor(nodes.length / 2)];
4794 this.itemHeight = node.offsetHeight;
4795 }
4796
4797 this.blockHeight = this.itemHeight * BLOCK_ROWS;
4798 this.clusterRows = BLOCK_ROWS * CLUSTER_BLOCKS;
4799 this.clusterHeight = this.blockHeight * CLUSTER_BLOCKS;
4800 }
4801 }, {
4802 key: "getNum",
4803 value: function getNum(fixedScroll) {
4804 this.scrollTop = fixedScroll ? this.cache.scrollTop : this.scrollEl.scrollTop;
4805 return Math.floor(this.scrollTop / (this.clusterHeight - this.blockHeight)) || 0;
4806 }
4807 }, {
4808 key: "initData",
4809 value: function initData(rows, num) {
4810 if (rows.length < BLOCK_ROWS) {
4811 return {
4812 topOffset: 0,
4813 bottomOffset: 0,
4814 rowsAbove: 0,
4815 rows: rows
4816 };
4817 }
4818
4819 var start = Math.max((this.clusterRows - BLOCK_ROWS) * num, 0);
4820 var end = start + this.clusterRows;
4821 var topOffset = Math.max(start * this.itemHeight, 0);
4822 var bottomOffset = Math.max((rows.length - end) * this.itemHeight, 0);
4823 var thisRows = [];
4824 var rowsAbove = start;
4825
4826 if (topOffset < 1) {
4827 rowsAbove++;
4828 }
4829
4830 for (var i = start; i < end; i++) {
4831 rows[i] && thisRows.push(rows[i]);
4832 }
4833
4834 return {
4835 start: start,
4836 end: end,
4837 topOffset: topOffset,
4838 bottomOffset: bottomOffset,
4839 rowsAbove: rowsAbove,
4840 rows: thisRows
4841 };
4842 }
4843 }, {
4844 key: "checkChanges",
4845 value: function checkChanges(type, value) {
4846 var changed = value !== this.cache[type];
4847 this.cache[type] = value;
4848 return changed;
4849 }
4850 }, {
4851 key: "getExtra",
4852 value: function getExtra(className, height) {
4853 var tag = document.createElement('tr');
4854 tag.className = "virtual-scroll-".concat(className);
4855
4856 if (height) {
4857 tag.style.height = "".concat(height, "px");
4858 }
4859
4860 return tag.outerHTML;
4861 }
4862 }]);
4863
4864 return VirtualScroll;
4865 }();
4866
4867 var BootstrapTable = /*#__PURE__*/function () {
4868 function BootstrapTable(el, options) {
4869 _classCallCheck(this, BootstrapTable);
4870
4871 this.options = options;
4872 this.$el = $__default["default"](el);
4873 this.$el_ = this.$el.clone();
4874 this.timeoutId_ = 0;
4875 this.timeoutFooter_ = 0;
4876 }
4877
4878 _createClass(BootstrapTable, [{
4879 key: "init",
4880 value: function init() {
4881 this.initConstants();
4882 this.initLocale();
4883 this.initContainer();
4884 this.initTable();
4885 this.initHeader();
4886 this.initData();
4887 this.initHiddenRows();
4888 this.initToolbar();
4889 this.initPagination();
4890 this.initBody();
4891 this.initSearchText();
4892 this.initServer();
4893 }
4894 }, {
4895 key: "initConstants",
4896 value: function initConstants() {
4897 var opts = this.options;
4898 this.constants = Constants.CONSTANTS;
4899 this.constants.theme = $__default["default"].fn.bootstrapTable.theme;
4900 this.constants.dataToggle = this.constants.html.dataToggle || 'data-toggle'; // init iconsPrefix and icons
4901
4902 var iconsPrefix = Utils.getIconsPrefix($__default["default"].fn.bootstrapTable.theme);
4903 var icons = Utils.getIcons(iconsPrefix);
4904
4905 if (typeof opts.icons === 'string') {
4906 opts.icons = Utils.calculateObjectValue(null, opts.icons);
4907 }
4908
4909 opts.iconsPrefix = opts.iconsPrefix || $__default["default"].fn.bootstrapTable.defaults.iconsPrefix || iconsPrefix;
4910 opts.icons = Object.assign(icons, $__default["default"].fn.bootstrapTable.defaults.icons, opts.icons); // init buttons class
4911
4912 var buttonsPrefix = opts.buttonsPrefix ? "".concat(opts.buttonsPrefix, "-") : '';
4913 this.constants.buttonsClass = [opts.buttonsPrefix, buttonsPrefix + opts.buttonsClass, Utils.sprintf("".concat(buttonsPrefix, "%s"), opts.iconSize)].join(' ').trim();
4914 this.buttons = Utils.calculateObjectValue(this, opts.buttons, [], {});
4915
4916 if (_typeof(this.buttons) !== 'object') {
4917 this.buttons = {};
4918 }
4919 }
4920 }, {
4921 key: "initLocale",
4922 value: function initLocale() {
4923 if (this.options.locale) {
4924 var locales = $__default["default"].fn.bootstrapTable.locales;
4925 var parts = this.options.locale.split(/-|_/);
4926 parts[0] = parts[0].toLowerCase();
4927
4928 if (parts[1]) {
4929 parts[1] = parts[1].toUpperCase();
4930 }
4931
4932 var localesToExtend = {};
4933
4934 if (locales[this.options.locale]) {
4935 localesToExtend = locales[this.options.locale];
4936 } else if (locales[parts.join('-')]) {
4937 localesToExtend = locales[parts.join('-')];
4938 } else if (locales[parts[0]]) {
4939 localesToExtend = locales[parts[0]];
4940 }
4941
4942 for (var _i = 0, _Object$entries = Object.entries(localesToExtend); _i < _Object$entries.length; _i++) {
4943 var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
4944 formatName = _Object$entries$_i[0],
4945 func = _Object$entries$_i[1];
4946
4947 if (this.options[formatName] !== BootstrapTable.DEFAULTS[formatName]) {
4948 continue;
4949 }
4950
4951 this.options[formatName] = func;
4952 }
4953 }
4954 }
4955 }, {
4956 key: "initContainer",
4957 value: function initContainer() {
4958 var topPagination = ['top', 'both'].includes(this.options.paginationVAlign) ? '<div class="fixed-table-pagination clearfix"></div>' : '';
4959 var bottomPagination = ['bottom', 'both'].includes(this.options.paginationVAlign) ? '<div class="fixed-table-pagination"></div>' : '';
4960 var loadingTemplate = Utils.calculateObjectValue(this.options, this.options.loadingTemplate, [this.options.formatLoadingMessage()]);
4961 this.$container = $__default["default"]("\n <div class=\"bootstrap-table ".concat(this.constants.theme, "\">\n <div class=\"fixed-table-toolbar\"></div>\n ").concat(topPagination, "\n <div class=\"fixed-table-container\">\n <div class=\"fixed-table-header\"><table></table></div>\n <div class=\"fixed-table-body\">\n <div class=\"fixed-table-loading\">\n ").concat(loadingTemplate, "\n </div>\n </div>\n <div class=\"fixed-table-footer\"></div>\n </div>\n ").concat(bottomPagination, "\n </div>\n "));
4962 this.$container.insertAfter(this.$el);
4963 this.$tableContainer = this.$container.find('.fixed-table-container');
4964 this.$tableHeader = this.$container.find('.fixed-table-header');
4965 this.$tableBody = this.$container.find('.fixed-table-body');
4966 this.$tableLoading = this.$container.find('.fixed-table-loading');
4967 this.$tableFooter = this.$el.find('tfoot'); // checking if custom table-toolbar exists or not
4968
4969 if (this.options.buttonsToolbar) {
4970 this.$toolbar = $__default["default"]('body').find(this.options.buttonsToolbar);
4971 } else {
4972 this.$toolbar = this.$container.find('.fixed-table-toolbar');
4973 }
4974
4975 this.$pagination = this.$container.find('.fixed-table-pagination');
4976 this.$tableBody.append(this.$el);
4977 this.$container.after('<div class="clearfix"></div>');
4978 this.$el.addClass(this.options.classes);
4979 this.$tableLoading.addClass(this.options.classes);
4980
4981 if (this.options.height) {
4982 this.$tableContainer.addClass('fixed-height');
4983
4984 if (this.options.showFooter) {
4985 this.$tableContainer.addClass('has-footer');
4986 }
4987
4988 if (this.options.classes.split(' ').includes('table-bordered')) {
4989 this.$tableBody.append('<div class="fixed-table-border"></div>');
4990 this.$tableBorder = this.$tableBody.find('.fixed-table-border');
4991 this.$tableLoading.addClass('fixed-table-border');
4992 }
4993
4994 this.$tableFooter = this.$container.find('.fixed-table-footer');
4995 }
4996 }
4997 }, {
4998 key: "initTable",
4999 value: function initTable() {
5000 var _this = this;
5001
5002 var columns = [];
5003 this.$header = this.$el.find('>thead');
5004
5005 if (!this.$header.length) {
5006 this.$header = $__default["default"]("<thead class=\"".concat(this.options.theadClasses, "\"></thead>")).appendTo(this.$el);
5007 } else if (this.options.theadClasses) {
5008 this.$header.addClass(this.options.theadClasses);
5009 }
5010
5011 this._headerTrClasses = [];
5012 this._headerTrStyles = [];
5013 this.$header.find('tr').each(function (i, el) {
5014 var $tr = $__default["default"](el);
5015 var column = [];
5016 $tr.find('th').each(function (i, el) {
5017 var $th = $__default["default"](el); // #2014: getFieldIndex and elsewhere assume this is string, causes issues if not
5018
5019 if (typeof $th.data('field') !== 'undefined') {
5020 $th.data('field', "".concat($th.data('field')));
5021 }
5022
5023 column.push($__default["default"].extend({}, {
5024 title: $th.html(),
5025 class: $th.attr('class'),
5026 titleTooltip: $th.attr('title'),
5027 rowspan: $th.attr('rowspan') ? +$th.attr('rowspan') : undefined,
5028 colspan: $th.attr('colspan') ? +$th.attr('colspan') : undefined
5029 }, $th.data()));
5030 });
5031 columns.push(column);
5032
5033 if ($tr.attr('class')) {
5034 _this._headerTrClasses.push($tr.attr('class'));
5035 }
5036
5037 if ($tr.attr('style')) {
5038 _this._headerTrStyles.push($tr.attr('style'));
5039 }
5040 });
5041
5042 if (!Array.isArray(this.options.columns[0])) {
5043 this.options.columns = [this.options.columns];
5044 }
5045
5046 this.options.columns = $__default["default"].extend(true, [], columns, this.options.columns);
5047 this.columns = [];
5048 this.fieldsColumnsIndex = [];
5049 Utils.setFieldIndex(this.options.columns);
5050 this.options.columns.forEach(function (columns, i) {
5051 columns.forEach(function (_column, j) {
5052 var column = $__default["default"].extend({}, BootstrapTable.COLUMN_DEFAULTS, _column);
5053
5054 if (typeof column.fieldIndex !== 'undefined') {
5055 _this.columns[column.fieldIndex] = column;
5056 _this.fieldsColumnsIndex[column.field] = column.fieldIndex;
5057 }
5058
5059 _this.options.columns[i][j] = column;
5060 });
5061 }); // if options.data is setting, do not process tbody and tfoot data
5062
5063 if (!this.options.data.length) {
5064 var htmlData = Utils.trToData(this.columns, this.$el.find('>tbody>tr'));
5065
5066 if (htmlData.length) {
5067 this.options.data = htmlData;
5068 this.fromHtml = true;
5069 }
5070 }
5071
5072 if (!(this.options.pagination && this.options.sidePagination !== 'server')) {
5073 this.footerData = Utils.trToData(this.columns, this.$el.find('>tfoot>tr'));
5074 }
5075
5076 if (this.footerData) {
5077 this.$el.find('tfoot').html('<tr></tr>');
5078 }
5079
5080 if (!this.options.showFooter || this.options.cardView) {
5081 this.$tableFooter.hide();
5082 } else {
5083 this.$tableFooter.show();
5084 }
5085 }
5086 }, {
5087 key: "initHeader",
5088 value: function initHeader() {
5089 var _this2 = this;
5090
5091 var visibleColumns = {};
5092 var headerHtml = [];
5093 this.header = {
5094 fields: [],
5095 styles: [],
5096 classes: [],
5097 formatters: [],
5098 detailFormatters: [],
5099 events: [],
5100 sorters: [],
5101 sortNames: [],
5102 cellStyles: [],
5103 searchables: []
5104 };
5105 Utils.updateFieldGroup(this.options.columns, this.columns);
5106 this.options.columns.forEach(function (columns, i) {
5107 var html = [];
5108 html.push("<tr".concat(Utils.sprintf(' class="%s"', _this2._headerTrClasses[i]), " ").concat(Utils.sprintf(' style="%s"', _this2._headerTrStyles[i]), ">"));
5109 var detailViewTemplate = '';
5110
5111 if (i === 0 && Utils.hasDetailViewIcon(_this2.options)) {
5112 var rowspan = _this2.options.columns.length > 1 ? " rowspan=\"".concat(_this2.options.columns.length, "\"") : '';
5113 detailViewTemplate = "<th class=\"detail\"".concat(rowspan, ">\n <div class=\"fht-cell\"></div>\n </th>");
5114 }
5115
5116 if (detailViewTemplate && _this2.options.detailViewAlign !== 'right') {
5117 html.push(detailViewTemplate);
5118 }
5119
5120 columns.forEach(function (column, j) {
5121 var class_ = Utils.sprintf(' class="%s"', column['class']);
5122 var unitWidth = column.widthUnit;
5123 var width = parseFloat(column.width);
5124 var halign = Utils.sprintf('text-align: %s; ', column.halign ? column.halign : column.align);
5125 var align = Utils.sprintf('text-align: %s; ', column.align);
5126 var style = Utils.sprintf('vertical-align: %s; ', column.valign);
5127 style += Utils.sprintf('width: %s; ', (column.checkbox || column.radio) && !width ? !column.showSelectTitle ? '36px' : undefined : width ? width + unitWidth : undefined);
5128
5129 if (typeof column.fieldIndex === 'undefined' && !column.visible) {
5130 return;
5131 }
5132
5133 var headerStyle = Utils.calculateObjectValue(null, _this2.options.headerStyle, [column]);
5134 var csses = [];
5135 var classes = '';
5136
5137 if (headerStyle && headerStyle.css) {
5138 for (var _i2 = 0, _Object$entries2 = Object.entries(headerStyle.css); _i2 < _Object$entries2.length; _i2++) {
5139 var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i2], 2),
5140 key = _Object$entries2$_i[0],
5141 value = _Object$entries2$_i[1];
5142
5143 csses.push("".concat(key, ": ").concat(value));
5144 }
5145 }
5146
5147 if (headerStyle && headerStyle.classes) {
5148 classes = Utils.sprintf(' class="%s"', column['class'] ? [column['class'], headerStyle.classes].join(' ') : headerStyle.classes);
5149 }
5150
5151 if (typeof column.fieldIndex !== 'undefined') {
5152 _this2.header.fields[column.fieldIndex] = column.field;
5153 _this2.header.styles[column.fieldIndex] = align + style;
5154 _this2.header.classes[column.fieldIndex] = class_;
5155 _this2.header.formatters[column.fieldIndex] = column.formatter;
5156 _this2.header.detailFormatters[column.fieldIndex] = column.detailFormatter;
5157 _this2.header.events[column.fieldIndex] = column.events;
5158 _this2.header.sorters[column.fieldIndex] = column.sorter;
5159 _this2.header.sortNames[column.fieldIndex] = column.sortName;
5160 _this2.header.cellStyles[column.fieldIndex] = column.cellStyle;
5161 _this2.header.searchables[column.fieldIndex] = column.searchable;
5162
5163 if (!column.visible) {
5164 return;
5165 }
5166
5167 if (_this2.options.cardView && !column.cardVisible) {
5168 return;
5169 }
5170
5171 visibleColumns[column.field] = column;
5172 }
5173
5174 html.push("<th".concat(Utils.sprintf(' title="%s"', column.titleTooltip)), column.checkbox || column.radio ? Utils.sprintf(' class="bs-checkbox %s"', column['class'] || '') : classes || class_, Utils.sprintf(' style="%s"', halign + style + csses.join('; ')), Utils.sprintf(' rowspan="%s"', column.rowspan), Utils.sprintf(' colspan="%s"', column.colspan), Utils.sprintf(' data-field="%s"', column.field), // If `column` is not the first element of `this.options.columns[0]`, then className 'data-not-first-th' should be added.
5175 j === 0 && i > 0 ? ' data-not-first-th' : '', '>');
5176 html.push(Utils.sprintf('<div class="th-inner %s">', _this2.options.sortable && column.sortable ? 'sortable both' : ''));
5177 var text = _this2.options.escape ? Utils.escapeHTML(column.title) : column.title;
5178 var title = text;
5179
5180 if (column.checkbox) {
5181 text = '';
5182
5183 if (!_this2.options.singleSelect && _this2.options.checkboxHeader) {
5184 text = '<label><input name="btSelectAll" type="checkbox" /><span></span></label>';
5185 }
5186
5187 _this2.header.stateField = column.field;
5188 }
5189
5190 if (column.radio) {
5191 text = '';
5192 _this2.header.stateField = column.field;
5193 }
5194
5195 if (!text && column.showSelectTitle) {
5196 text += title;
5197 }
5198
5199 html.push(text);
5200 html.push('</div>');
5201 html.push('<div class="fht-cell"></div>');
5202 html.push('</div>');
5203 html.push('</th>');
5204 });
5205
5206 if (detailViewTemplate && _this2.options.detailViewAlign === 'right') {
5207 html.push(detailViewTemplate);
5208 }
5209
5210 html.push('</tr>');
5211
5212 if (html.length > 3) {
5213 headerHtml.push(html.join(''));
5214 }
5215 });
5216 this.$header.html(headerHtml.join(''));
5217 this.$header.find('th[data-field]').each(function (i, el) {
5218 $__default["default"](el).data(visibleColumns[$__default["default"](el).data('field')]);
5219 });
5220 this.$container.off('click', '.th-inner').on('click', '.th-inner', function (e) {
5221 var $this = $__default["default"](e.currentTarget);
5222
5223 if (_this2.options.detailView && !$this.parent().hasClass('bs-checkbox')) {
5224 if ($this.closest('.bootstrap-table')[0] !== _this2.$container[0]) {
5225 return false;
5226 }
5227 }
5228
5229 if (_this2.options.sortable && $this.parent().data().sortable) {
5230 _this2.onSort(e);
5231 }
5232 });
5233 var resizeEvent = Utils.getEventName('resize.bootstrap-table', this.$el.attr('id'));
5234 $__default["default"](window).off(resizeEvent);
5235
5236 if (!this.options.showHeader || this.options.cardView) {
5237 this.$header.hide();
5238 this.$tableHeader.hide();
5239 this.$tableLoading.css('top', 0);
5240 } else {
5241 this.$header.show();
5242 this.$tableHeader.show();
5243 this.$tableLoading.css('top', this.$header.outerHeight() + 1); // Assign the correct sortable arrow
5244
5245 this.getCaret();
5246 $__default["default"](window).on(resizeEvent, function () {
5247 return _this2.resetView();
5248 });
5249 }
5250
5251 this.$selectAll = this.$header.find('[name="btSelectAll"]');
5252 this.$selectAll.off('click').on('click', function (e) {
5253 e.stopPropagation();
5254 var checked = $__default["default"](e.currentTarget).prop('checked');
5255
5256 _this2[checked ? 'checkAll' : 'uncheckAll']();
5257
5258 _this2.updateSelected();
5259 });
5260 }
5261 }, {
5262 key: "initData",
5263 value: function initData(data, type) {
5264 if (type === 'append') {
5265 this.options.data = this.options.data.concat(data);
5266 } else if (type === 'prepend') {
5267 this.options.data = [].concat(data).concat(this.options.data);
5268 } else {
5269 data = data || Utils.deepCopy(this.options.data);
5270 this.options.data = Array.isArray(data) ? data : data[this.options.dataField];
5271 }
5272
5273 this.data = _toConsumableArray(this.options.data);
5274
5275 if (this.options.sortReset) {
5276 this.unsortedData = _toConsumableArray(this.data);
5277 }
5278
5279 if (this.options.sidePagination === 'server') {
5280 return;
5281 }
5282
5283 this.initSort();
5284 }
5285 }, {
5286 key: "initSort",
5287 value: function initSort() {
5288 var _this3 = this;
5289
5290 var name = this.options.sortName;
5291 var order = this.options.sortOrder === 'desc' ? -1 : 1;
5292 var index = this.header.fields.indexOf(this.options.sortName);
5293 var timeoutId = 0;
5294
5295 if (index !== -1) {
5296 if (this.options.sortStable) {
5297 this.data.forEach(function (row, i) {
5298 if (!row.hasOwnProperty('_position')) {
5299 row._position = i;
5300 }
5301 });
5302 }
5303
5304 if (this.options.customSort) {
5305 Utils.calculateObjectValue(this.options, this.options.customSort, [this.options.sortName, this.options.sortOrder, this.data]);
5306 } else {
5307 this.data.sort(function (a, b) {
5308 if (_this3.header.sortNames[index]) {
5309 name = _this3.header.sortNames[index];
5310 }
5311
5312 var aa = Utils.getItemField(a, name, _this3.options.escape);
5313 var bb = Utils.getItemField(b, name, _this3.options.escape);
5314 var value = Utils.calculateObjectValue(_this3.header, _this3.header.sorters[index], [aa, bb, a, b]);
5315
5316 if (value !== undefined) {
5317 if (_this3.options.sortStable && value === 0) {
5318 return order * (a._position - b._position);
5319 }
5320
5321 return order * value;
5322 }
5323
5324 return Utils.sort(aa, bb, order, _this3.options.sortStable, a._position, b._position);
5325 });
5326 }
5327
5328 if (this.options.sortClass !== undefined) {
5329 clearTimeout(timeoutId);
5330 timeoutId = setTimeout(function () {
5331 _this3.$el.removeClass(_this3.options.sortClass);
5332
5333 var index = _this3.$header.find("[data-field=\"".concat(_this3.options.sortName, "\"]")).index();
5334
5335 _this3.$el.find("tr td:nth-child(".concat(index + 1, ")")).addClass(_this3.options.sortClass);
5336 }, 250);
5337 }
5338 } else if (this.options.sortReset) {
5339 this.data = _toConsumableArray(this.unsortedData);
5340 }
5341 }
5342 }, {
5343 key: "onSort",
5344 value: function onSort(_ref) {
5345 var type = _ref.type,
5346 currentTarget = _ref.currentTarget;
5347 var $this = type === 'keypress' ? $__default["default"](currentTarget) : $__default["default"](currentTarget).parent();
5348 var $this_ = this.$header.find('th').eq($this.index());
5349 this.$header.add(this.$header_).find('span.order').remove();
5350
5351 if (this.options.sortName === $this.data('field')) {
5352 var currentSortOrder = this.options.sortOrder;
5353
5354 if (currentSortOrder === undefined) {
5355 this.options.sortOrder = 'asc';
5356 } else if (currentSortOrder === 'asc') {
5357 this.options.sortOrder = 'desc';
5358 } else if (this.options.sortOrder === 'desc') {
5359 this.options.sortOrder = this.options.sortReset ? undefined : 'asc';
5360 }
5361
5362 if (this.options.sortOrder === undefined) {
5363 this.options.sortName = undefined;
5364 }
5365 } else {
5366 this.options.sortName = $this.data('field');
5367
5368 if (this.options.rememberOrder) {
5369 this.options.sortOrder = $this.data('order') === 'asc' ? 'desc' : 'asc';
5370 } else {
5371 this.options.sortOrder = this.columns[this.fieldsColumnsIndex[$this.data('field')]].sortOrder || this.columns[this.fieldsColumnsIndex[$this.data('field')]].order;
5372 }
5373 }
5374
5375 this.trigger('sort', this.options.sortName, this.options.sortOrder);
5376 $this.add($this_).data('order', this.options.sortOrder); // Assign the correct sortable arrow
5377
5378 this.getCaret();
5379
5380 if (this.options.sidePagination === 'server' && this.options.serverSort) {
5381 this.options.pageNumber = 1;
5382 this.initServer(this.options.silentSort);
5383 return;
5384 }
5385
5386 this.initSort();
5387 this.initBody();
5388 }
5389 }, {
5390 key: "initToolbar",
5391 value: function initToolbar() {
5392 var _this4 = this;
5393
5394 var opts = this.options;
5395 var html = [];
5396 var timeoutId = 0;
5397 var $keepOpen;
5398 var switchableCount = 0;
5399
5400 if (this.$toolbar.find('.bs-bars').children().length) {
5401 $__default["default"]('body').append($__default["default"](opts.toolbar));
5402 }
5403
5404 this.$toolbar.html('');
5405
5406 if (typeof opts.toolbar === 'string' || _typeof(opts.toolbar) === 'object') {
5407 $__default["default"](Utils.sprintf('<div class="bs-bars %s-%s"></div>', this.constants.classes.pull, opts.toolbarAlign)).appendTo(this.$toolbar).append($__default["default"](opts.toolbar));
5408 } // showColumns, showToggle, showRefresh
5409
5410
5411 html = ["<div class=\"".concat(['columns', "columns-".concat(opts.buttonsAlign), this.constants.classes.buttonsGroup, "".concat(this.constants.classes.pull, "-").concat(opts.buttonsAlign)].join(' '), "\">")];
5412
5413 if (typeof opts.buttonsOrder === 'string') {
5414 opts.buttonsOrder = opts.buttonsOrder.replace(/\[|\]| |'/g, '').split(',');
5415 }
5416
5417 this.buttons = Object.assign(this.buttons, {
5418 paginationSwitch: {
5419 text: opts.pagination ? opts.formatPaginationSwitchUp() : opts.formatPaginationSwitchDown(),
5420 icon: opts.pagination ? opts.icons.paginationSwitchDown : opts.icons.paginationSwitchUp,
5421 render: false,
5422 event: this.togglePagination,
5423 attributes: {
5424 'aria-label': opts.formatPaginationSwitch(),
5425 title: opts.formatPaginationSwitch()
5426 }
5427 },
5428 refresh: {
5429 text: opts.formatRefresh(),
5430 icon: opts.icons.refresh,
5431 render: false,
5432 event: this.refresh,
5433 attributes: {
5434 'aria-label': opts.formatRefresh(),
5435 title: opts.formatRefresh()
5436 }
5437 },
5438 toggle: {
5439 text: opts.formatToggle(),
5440 icon: opts.icons.toggleOff,
5441 render: false,
5442 event: this.toggleView,
5443 attributes: {
5444 'aria-label': opts.formatToggleOn(),
5445 title: opts.formatToggleOn()
5446 }
5447 },
5448 fullscreen: {
5449 text: opts.formatFullscreen(),
5450 icon: opts.icons.fullscreen,
5451 render: false,
5452 event: this.toggleFullscreen,
5453 attributes: {
5454 'aria-label': opts.formatFullscreen(),
5455 title: opts.formatFullscreen()
5456 }
5457 },
5458 columns: {
5459 render: false,
5460 html: function html() {
5461 var html = [];
5462 html.push("<div class=\"keep-open ".concat(_this4.constants.classes.buttonsDropdown, "\" title=\"").concat(opts.formatColumns(), "\">\n <button class=\"").concat(_this4.constants.buttonsClass, " dropdown-toggle\" type=\"button\" ").concat(_this4.constants.dataToggle, "=\"dropdown\"\n aria-label=\"Columns\" title=\"").concat(opts.formatColumns(), "\">\n ").concat(opts.showButtonIcons ? Utils.sprintf(_this4.constants.html.icon, opts.iconsPrefix, opts.icons.columns) : '', "\n ").concat(opts.showButtonText ? opts.formatColumns() : '', "\n ").concat(_this4.constants.html.dropdownCaret, "\n </button>\n ").concat(_this4.constants.html.toolbarDropdown[0]));
5463
5464 if (opts.showColumnsSearch) {
5465 html.push(Utils.sprintf(_this4.constants.html.toolbarDropdownItem, Utils.sprintf('<input type="text" class="%s" name="columnsSearch" placeholder="%s" autocomplete="off">', _this4.constants.classes.input, opts.formatSearch())));
5466 html.push(_this4.constants.html.toolbarDropdownSeparator);
5467 }
5468
5469 if (opts.showColumnsToggleAll) {
5470 var allFieldsVisible = _this4.getVisibleColumns().length === _this4.columns.filter(function (column) {
5471 return !_this4.isSelectionColumn(column);
5472 }).length;
5473
5474 html.push(Utils.sprintf(_this4.constants.html.toolbarDropdownItem, Utils.sprintf('<input type="checkbox" class="toggle-all" %s> <span>%s</span>', allFieldsVisible ? 'checked="checked"' : '', opts.formatColumnsToggleAll())));
5475 html.push(_this4.constants.html.toolbarDropdownSeparator);
5476 }
5477
5478 var visibleColumns = 0;
5479
5480 _this4.columns.forEach(function (column) {
5481 if (column.visible) {
5482 visibleColumns++;
5483 }
5484 });
5485
5486 _this4.columns.forEach(function (column, i) {
5487 if (_this4.isSelectionColumn(column)) {
5488 return;
5489 }
5490
5491 if (opts.cardView && !column.cardVisible) {
5492 return;
5493 }
5494
5495 var checked = column.visible ? ' checked="checked"' : '';
5496 var disabled = visibleColumns <= opts.minimumCountColumns && checked ? ' disabled="disabled"' : '';
5497
5498 if (column.switchable) {
5499 html.push(Utils.sprintf(_this4.constants.html.toolbarDropdownItem, Utils.sprintf('<input type="checkbox" data-field="%s" value="%s"%s%s> <span>%s</span>', column.field, i, checked, disabled, column.title)));
5500 switchableCount++;
5501 }
5502 });
5503
5504 html.push(_this4.constants.html.toolbarDropdown[1], '</div>');
5505 return html.join('');
5506 }
5507 }
5508 });
5509 var buttonsHtml = {};
5510
5511 for (var _i3 = 0, _Object$entries3 = Object.entries(this.buttons); _i3 < _Object$entries3.length; _i3++) {
5512 var _Object$entries3$_i = _slicedToArray(_Object$entries3[_i3], 2),
5513 buttonName = _Object$entries3$_i[0],
5514 buttonConfig = _Object$entries3$_i[1];
5515
5516 var buttonHtml = void 0;
5517
5518 if (buttonConfig.hasOwnProperty('html')) {
5519 if (typeof buttonConfig.html === 'function') {
5520 buttonHtml = buttonConfig.html();
5521 } else if (typeof buttonConfig.html === 'string') {
5522 buttonHtml = buttonConfig.html;
5523 }
5524 } else {
5525 buttonHtml = "<button class=\"".concat(this.constants.buttonsClass, "\" type=\"button\" name=\"").concat(buttonName, "\"");
5526
5527 if (buttonConfig.hasOwnProperty('attributes')) {
5528 for (var _i4 = 0, _Object$entries4 = Object.entries(buttonConfig.attributes); _i4 < _Object$entries4.length; _i4++) {
5529 var _Object$entries4$_i = _slicedToArray(_Object$entries4[_i4], 2),
5530 attributeName = _Object$entries4$_i[0],
5531 value = _Object$entries4$_i[1];
5532
5533 buttonHtml += " ".concat(attributeName, "=\"").concat(value, "\"");
5534 }
5535 }
5536
5537 buttonHtml += '>';
5538
5539 if (opts.showButtonIcons && buttonConfig.hasOwnProperty('icon')) {
5540 buttonHtml += "".concat(Utils.sprintf(this.constants.html.icon, opts.iconsPrefix, buttonConfig.icon), " ");
5541 }
5542
5543 if (opts.showButtonText && buttonConfig.hasOwnProperty('text')) {
5544 buttonHtml += buttonConfig.text;
5545 }
5546
5547 buttonHtml += '</button>';
5548 }
5549
5550 buttonsHtml[buttonName] = buttonHtml;
5551 var optionName = "show".concat(buttonName.charAt(0).toUpperCase()).concat(buttonName.substring(1));
5552 var showOption = opts[optionName];
5553
5554 if ((!buttonConfig.hasOwnProperty('render') || buttonConfig.hasOwnProperty('render') && buttonConfig.render) && (showOption === undefined || showOption === true)) {
5555 opts[optionName] = true;
5556 }
5557
5558 if (!opts.buttonsOrder.includes(buttonName)) {
5559 opts.buttonsOrder.push(buttonName);
5560 }
5561 } // Adding the button html to the final toolbar html when the showOption is true
5562
5563
5564 var _iterator = _createForOfIteratorHelper(opts.buttonsOrder),
5565 _step;
5566
5567 try {
5568 for (_iterator.s(); !(_step = _iterator.n()).done;) {
5569 var button = _step.value;
5570 var _showOption = opts["show".concat(button.charAt(0).toUpperCase()).concat(button.substring(1))];
5571
5572 if (_showOption) {
5573 html.push(buttonsHtml[button]);
5574 }
5575 }
5576 } catch (err) {
5577 _iterator.e(err);
5578 } finally {
5579 _iterator.f();
5580 }
5581
5582 html.push('</div>'); // Fix #188: this.showToolbar is for extensions
5583
5584 if (this.showToolbar || html.length > 2) {
5585 this.$toolbar.append(html.join(''));
5586 }
5587
5588 for (var _i5 = 0, _Object$entries5 = Object.entries(this.buttons); _i5 < _Object$entries5.length; _i5++) {
5589 var _Object$entries5$_i = _slicedToArray(_Object$entries5[_i5], 2),
5590 _buttonName = _Object$entries5$_i[0],
5591 _buttonConfig = _Object$entries5$_i[1];
5592
5593 if (_buttonConfig.hasOwnProperty('event')) {
5594 if (typeof _buttonConfig.event === 'function' || typeof _buttonConfig.event === 'string') {
5595 var _ret = function () {
5596 var event = typeof _buttonConfig.event === 'string' ? window[_buttonConfig.event] : _buttonConfig.event;
5597
5598 _this4.$toolbar.find("button[name=\"".concat(_buttonName, "\"]")).off('click').on('click', function () {
5599 return event.call(_this4);
5600 });
5601
5602 return "continue";
5603 }();
5604
5605 if (_ret === "continue") continue;
5606 }
5607
5608 var _loop = function _loop() {
5609 var _Object$entries6$_i = _slicedToArray(_Object$entries6[_i6], 2),
5610 eventType = _Object$entries6$_i[0],
5611 eventFunction = _Object$entries6$_i[1];
5612
5613 var event = typeof eventFunction === 'string' ? window[eventFunction] : eventFunction;
5614
5615 _this4.$toolbar.find("button[name=\"".concat(_buttonName, "\"]")).off(eventType).on(eventType, function () {
5616 return event.call(_this4);
5617 });
5618 };
5619
5620 for (var _i6 = 0, _Object$entries6 = Object.entries(_buttonConfig.event); _i6 < _Object$entries6.length; _i6++) {
5621 _loop();
5622 }
5623 }
5624 }
5625
5626 if (opts.showColumns) {
5627 $keepOpen = this.$toolbar.find('.keep-open');
5628 var $checkboxes = $keepOpen.find('input[type="checkbox"]:not(".toggle-all")');
5629 var $toggleAll = $keepOpen.find('input[type="checkbox"].toggle-all');
5630
5631 if (switchableCount <= opts.minimumCountColumns) {
5632 $keepOpen.find('input').prop('disabled', true);
5633 }
5634
5635 $keepOpen.find('li, label').off('click').on('click', function (e) {
5636 e.stopImmediatePropagation();
5637 });
5638 $checkboxes.off('click').on('click', function (_ref2) {
5639 var currentTarget = _ref2.currentTarget;
5640 var $this = $__default["default"](currentTarget);
5641
5642 _this4._toggleColumn($this.val(), $this.prop('checked'), false);
5643
5644 _this4.trigger('column-switch', $this.data('field'), $this.prop('checked'));
5645
5646 $toggleAll.prop('checked', $checkboxes.filter(':checked').length === _this4.columns.filter(function (column) {
5647 return !_this4.isSelectionColumn(column);
5648 }).length);
5649 });
5650 $toggleAll.off('click').on('click', function (_ref3) {
5651 var currentTarget = _ref3.currentTarget;
5652
5653 _this4._toggleAllColumns($__default["default"](currentTarget).prop('checked'));
5654
5655 _this4.trigger('column-switch-all', $__default["default"](currentTarget).prop('checked'));
5656 });
5657
5658 if (opts.showColumnsSearch) {
5659 var $columnsSearch = $keepOpen.find('[name="columnsSearch"]');
5660 var $listItems = $keepOpen.find('.dropdown-item-marker');
5661 $columnsSearch.on('keyup paste change', function (_ref4) {
5662 var currentTarget = _ref4.currentTarget;
5663 var $this = $__default["default"](currentTarget);
5664 var searchValue = $this.val().toLowerCase();
5665 $listItems.show();
5666 $checkboxes.each(function (i, el) {
5667 var $checkbox = $__default["default"](el);
5668 var $listItem = $checkbox.parents('.dropdown-item-marker');
5669 var text = $listItem.text().toLowerCase();
5670
5671 if (!text.includes(searchValue)) {
5672 $listItem.hide();
5673 }
5674 });
5675 });
5676 }
5677 }
5678
5679 var handleInputEvent = function handleInputEvent($searchInput) {
5680 var eventTriggers = 'keyup drop blur mouseup';
5681 $searchInput.off(eventTriggers).on(eventTriggers, function (event) {
5682 if (opts.searchOnEnterKey && event.keyCode !== 13) {
5683 return;
5684 }
5685
5686 if ([37, 38, 39, 40].includes(event.keyCode)) {
5687 return;
5688 }
5689
5690 clearTimeout(timeoutId); // doesn't matter if it's 0
5691
5692 timeoutId = setTimeout(function () {
5693 _this4.onSearch({
5694 currentTarget: event.currentTarget
5695 });
5696 }, opts.searchTimeOut);
5697 });
5698 }; // Fix #4516: this.showSearchClearButton is for extensions
5699
5700
5701 if ((opts.search || this.showSearchClearButton) && typeof opts.searchSelector !== 'string') {
5702 html = [];
5703 var showSearchButton = Utils.sprintf(this.constants.html.searchButton, this.constants.buttonsClass, opts.formatSearch(), opts.showButtonIcons ? Utils.sprintf(this.constants.html.icon, opts.iconsPrefix, opts.icons.search) : '', opts.showButtonText ? opts.formatSearch() : '');
5704 var showSearchClearButton = Utils.sprintf(this.constants.html.searchClearButton, this.constants.buttonsClass, opts.formatClearSearch(), opts.showButtonIcons ? Utils.sprintf(this.constants.html.icon, opts.iconsPrefix, opts.icons.clearSearch) : '', opts.showButtonText ? opts.formatClearSearch() : '');
5705 var searchInputHtml = "<input class=\"".concat(this.constants.classes.input, "\n ").concat(Utils.sprintf(' %s%s', this.constants.classes.inputPrefix, opts.iconSize), "\n search-input\" type=\"search\" placeholder=\"").concat(opts.formatSearch(), "\" autocomplete=\"off\">");
5706 var searchInputFinalHtml = searchInputHtml;
5707
5708 if (opts.showSearchButton || opts.showSearchClearButton) {
5709 var _buttonsHtml = (opts.showSearchButton ? showSearchButton : '') + (opts.showSearchClearButton ? showSearchClearButton : '');
5710
5711 searchInputFinalHtml = opts.search ? Utils.sprintf(this.constants.html.inputGroup, searchInputHtml, _buttonsHtml) : _buttonsHtml;
5712 }
5713
5714 html.push(Utils.sprintf("\n <div class=\"".concat(this.constants.classes.pull, "-").concat(opts.searchAlign, " search ").concat(this.constants.classes.inputGroup, "\">\n %s\n </div>\n "), searchInputFinalHtml));
5715 this.$toolbar.append(html.join(''));
5716 var $searchInput = Utils.getSearchInput(this);
5717
5718 if (opts.showSearchButton) {
5719 this.$toolbar.find('.search button[name=search]').off('click').on('click', function () {
5720 clearTimeout(timeoutId); // doesn't matter if it's 0
5721
5722 timeoutId = setTimeout(function () {
5723 _this4.onSearch({
5724 currentTarget: $searchInput
5725 });
5726 }, opts.searchTimeOut);
5727 });
5728
5729 if (opts.searchOnEnterKey) {
5730 handleInputEvent($searchInput);
5731 }
5732 } else {
5733 handleInputEvent($searchInput);
5734 }
5735
5736 if (opts.showSearchClearButton) {
5737 this.$toolbar.find('.search button[name=clearSearch]').click(function () {
5738 _this4.resetSearch();
5739 });
5740 }
5741 } else if (typeof opts.searchSelector === 'string') {
5742 var _$searchInput = Utils.getSearchInput(this);
5743
5744 handleInputEvent(_$searchInput);
5745 }
5746 }
5747 }, {
5748 key: "onSearch",
5749 value: function onSearch() {
5750 var _ref5 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
5751 currentTarget = _ref5.currentTarget,
5752 firedByInitSearchText = _ref5.firedByInitSearchText;
5753
5754 var overwriteSearchText = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
5755
5756 if (currentTarget !== undefined && $__default["default"](currentTarget).length && overwriteSearchText) {
5757 var text = $__default["default"](currentTarget).val().trim();
5758
5759 if (this.options.trimOnSearch && $__default["default"](currentTarget).val() !== text) {
5760 $__default["default"](currentTarget).val(text);
5761 }
5762
5763 if (this.searchText === text) {
5764 return;
5765 }
5766
5767 var $searchInput = Utils.getSearchInput(this);
5768 var $currentTarget = currentTarget instanceof jQuery ? currentTarget : $__default["default"](currentTarget);
5769
5770 if ($currentTarget.is($searchInput) || $currentTarget.hasClass('search-input')) {
5771 this.searchText = text;
5772 this.options.searchText = text;
5773 }
5774 }
5775
5776 if (!firedByInitSearchText && !this.options.cookie) {
5777 this.options.pageNumber = 1;
5778 }
5779
5780 this.initSearch();
5781
5782 if (firedByInitSearchText) {
5783 if (this.options.sidePagination === 'client') {
5784 this.updatePagination();
5785 }
5786 } else {
5787 this.updatePagination();
5788 }
5789
5790 this.trigger('search', this.searchText);
5791 }
5792 }, {
5793 key: "initSearch",
5794 value: function initSearch() {
5795 var _this5 = this;
5796
5797 this.filterOptions = this.filterOptions || this.options.filterOptions;
5798
5799 if (this.options.sidePagination !== 'server') {
5800 if (this.options.customSearch) {
5801 this.data = Utils.calculateObjectValue(this.options, this.options.customSearch, [this.options.data, this.searchText, this.filterColumns]);
5802
5803 if (this.options.sortReset) {
5804 this.unsortedData = _toConsumableArray(this.data);
5805 }
5806
5807 return;
5808 }
5809
5810 var rawSearchText = this.searchText && (this.fromHtml ? Utils.escapeHTML(this.searchText) : this.searchText);
5811 var searchText = rawSearchText ? rawSearchText.toLowerCase() : '';
5812 var f = Utils.isEmptyObject(this.filterColumns) ? null : this.filterColumns;
5813
5814 if (this.options.searchAccentNeutralise) {
5815 searchText = Utils.normalizeAccent(searchText);
5816 } // Check filter
5817
5818
5819 if (typeof this.filterOptions.filterAlgorithm === 'function') {
5820 this.data = this.options.data.filter(function (item) {
5821 return _this5.filterOptions.filterAlgorithm.apply(null, [item, f]);
5822 });
5823 } else if (typeof this.filterOptions.filterAlgorithm === 'string') {
5824 this.data = f ? this.options.data.filter(function (item) {
5825 var filterAlgorithm = _this5.filterOptions.filterAlgorithm;
5826
5827 if (filterAlgorithm === 'and') {
5828 for (var key in f) {
5829 if (Array.isArray(f[key]) && !f[key].includes(item[key]) || !Array.isArray(f[key]) && item[key] !== f[key]) {
5830 return false;
5831 }
5832 }
5833 } else if (filterAlgorithm === 'or') {
5834 var match = false;
5835
5836 for (var _key in f) {
5837 if (Array.isArray(f[_key]) && f[_key].includes(item[_key]) || !Array.isArray(f[_key]) && item[_key] === f[_key]) {
5838 match = true;
5839 }
5840 }
5841
5842 return match;
5843 }
5844
5845 return true;
5846 }) : _toConsumableArray(this.options.data);
5847 }
5848
5849 var visibleFields = this.getVisibleFields();
5850 this.data = searchText ? this.data.filter(function (item, i) {
5851 for (var j = 0; j < _this5.header.fields.length; j++) {
5852 if (!_this5.header.searchables[j] || _this5.options.visibleSearch && visibleFields.indexOf(_this5.header.fields[j]) === -1) {
5853 continue;
5854 }
5855
5856 var key = Utils.isNumeric(_this5.header.fields[j]) ? parseInt(_this5.header.fields[j], 10) : _this5.header.fields[j];
5857 var column = _this5.columns[_this5.fieldsColumnsIndex[key]];
5858 var value = void 0;
5859
5860 if (typeof key === 'string') {
5861 value = item;
5862 var props = key.split('.');
5863
5864 for (var _i7 = 0; _i7 < props.length; _i7++) {
5865 if (value[props[_i7]] !== null) {
5866 value = value[props[_i7]];
5867 }
5868 }
5869 } else {
5870 value = item[key];
5871 }
5872
5873 if (_this5.options.searchAccentNeutralise) {
5874 value = Utils.normalizeAccent(value);
5875 } // Fix #142: respect searchFormatter boolean
5876
5877
5878 if (column && column.searchFormatter) {
5879 value = Utils.calculateObjectValue(column, _this5.header.formatters[j], [value, item, i, column.field], value);
5880 }
5881
5882 if (typeof value === 'string' || typeof value === 'number') {
5883 if (_this5.options.strictSearch && "".concat(value).toLowerCase() === searchText || _this5.options.regexSearch && Utils.regexCompare(value, rawSearchText)) {
5884 return true;
5885 }
5886
5887 var largerSmallerEqualsRegex = /(?:(<=|=>|=<|>=|>|<)(?:\s+)?(-?\d+)?|(-?\d+)?(\s+)?(<=|=>|=<|>=|>|<))/gm;
5888 var matches = largerSmallerEqualsRegex.exec(_this5.searchText);
5889 var comparisonCheck = false;
5890
5891 if (matches) {
5892 var operator = matches[1] || "".concat(matches[5], "l");
5893 var comparisonValue = matches[2] || matches[3];
5894 var int = parseInt(value, 10);
5895 var comparisonInt = parseInt(comparisonValue, 10);
5896
5897 switch (operator) {
5898 case '>':
5899 case '<l':
5900 comparisonCheck = int > comparisonInt;
5901 break;
5902
5903 case '<':
5904 case '>l':
5905 comparisonCheck = int < comparisonInt;
5906 break;
5907
5908 case '<=':
5909 case '=<':
5910 case '>=l':
5911 case '=>l':
5912 comparisonCheck = int <= comparisonInt;
5913 break;
5914
5915 case '>=':
5916 case '=>':
5917 case '<=l':
5918 case '=<l':
5919 comparisonCheck = int >= comparisonInt;
5920 break;
5921 }
5922 }
5923
5924 if (comparisonCheck || "".concat(value).toLowerCase().includes(searchText)) {
5925 return true;
5926 }
5927 }
5928 }
5929
5930 return false;
5931 }) : this.data;
5932
5933 if (this.options.sortReset) {
5934 this.unsortedData = _toConsumableArray(this.data);
5935 }
5936
5937 this.initSort();
5938 }
5939 }
5940 }, {
5941 key: "initPagination",
5942 value: function initPagination() {
5943 var _this6 = this;
5944
5945 var opts = this.options;
5946
5947 if (!opts.pagination) {
5948 this.$pagination.hide();
5949 return;
5950 }
5951
5952 this.$pagination.show();
5953 var html = [];
5954 var allSelected = false;
5955 var i;
5956 var from;
5957 var to;
5958 var $pageList;
5959 var $pre;
5960 var $next;
5961 var $number;
5962 var data = this.getData({
5963 includeHiddenRows: false
5964 });
5965 var pageList = opts.pageList;
5966
5967 if (typeof pageList === 'string') {
5968 pageList = pageList.replace(/\[|\]| /g, '').toLowerCase().split(',');
5969 }
5970
5971 pageList = pageList.map(function (value) {
5972 if (typeof value === 'string') {
5973 return value.toLowerCase() === opts.formatAllRows().toLowerCase() || ['all', 'unlimited'].includes(value.toLowerCase()) ? opts.formatAllRows() : +value;
5974 }
5975
5976 return value;
5977 });
5978 this.paginationParts = opts.paginationParts;
5979
5980 if (typeof this.paginationParts === 'string') {
5981 this.paginationParts = this.paginationParts.replace(/\[|\]| |'/g, '').split(',');
5982 }
5983
5984 if (opts.sidePagination !== 'server') {
5985 opts.totalRows = data.length;
5986 }
5987
5988 this.totalPages = 0;
5989
5990 if (opts.totalRows) {
5991 if (opts.pageSize === opts.formatAllRows()) {
5992 opts.pageSize = opts.totalRows;
5993 allSelected = true;
5994 }
5995
5996 this.totalPages = ~~((opts.totalRows - 1) / opts.pageSize) + 1;
5997 opts.totalPages = this.totalPages;
5998 }
5999
6000 if (this.totalPages > 0 && opts.pageNumber > this.totalPages) {
6001 opts.pageNumber = this.totalPages;
6002 }
6003
6004 this.pageFrom = (opts.pageNumber - 1) * opts.pageSize + 1;
6005 this.pageTo = opts.pageNumber * opts.pageSize;
6006
6007 if (this.pageTo > opts.totalRows) {
6008 this.pageTo = opts.totalRows;
6009 }
6010
6011 if (this.options.pagination && this.options.sidePagination !== 'server') {
6012 this.options.totalNotFiltered = this.options.data.length;
6013 }
6014
6015 if (!this.options.showExtendedPagination) {
6016 this.options.totalNotFiltered = undefined;
6017 }
6018
6019 if (this.paginationParts.includes('pageInfo') || this.paginationParts.includes('pageInfoShort') || this.paginationParts.includes('pageSize')) {
6020 html.push("<div class=\"".concat(this.constants.classes.pull, "-").concat(opts.paginationDetailHAlign, " pagination-detail\">"));
6021 }
6022
6023 if (this.paginationParts.includes('pageInfo') || this.paginationParts.includes('pageInfoShort')) {
6024 var paginationInfo = this.paginationParts.includes('pageInfoShort') ? opts.formatDetailPagination(opts.totalRows) : opts.formatShowingRows(this.pageFrom, this.pageTo, opts.totalRows, opts.totalNotFiltered);
6025 html.push("<span class=\"pagination-info\">\n ".concat(paginationInfo, "\n </span>"));
6026 }
6027
6028 if (this.paginationParts.includes('pageSize')) {
6029 html.push('<div class="page-list">');
6030 var pageNumber = ["<div class=\"".concat(this.constants.classes.paginationDropdown, "\">\n <button class=\"").concat(this.constants.buttonsClass, " dropdown-toggle\" type=\"button\" ").concat(this.constants.dataToggle, "=\"dropdown\">\n <span class=\"page-size\">\n ").concat(allSelected ? opts.formatAllRows() : opts.pageSize, "\n </span>\n ").concat(this.constants.html.dropdownCaret, "\n </button>\n ").concat(this.constants.html.pageDropdown[0])];
6031 pageList.forEach(function (page, i) {
6032 if (!opts.smartDisplay || i === 0 || pageList[i - 1] < opts.totalRows || page === opts.formatAllRows()) {
6033 var active;
6034
6035 if (allSelected) {
6036 active = page === opts.formatAllRows() ? _this6.constants.classes.dropdownActive : '';
6037 } else {
6038 active = page === opts.pageSize ? _this6.constants.classes.dropdownActive : '';
6039 }
6040
6041 pageNumber.push(Utils.sprintf(_this6.constants.html.pageDropdownItem, active, page));
6042 }
6043 });
6044 pageNumber.push("".concat(this.constants.html.pageDropdown[1], "</div>"));
6045 html.push(opts.formatRecordsPerPage(pageNumber.join('')));
6046 }
6047
6048 if (this.paginationParts.includes('pageInfo') || this.paginationParts.includes('pageInfoShort') || this.paginationParts.includes('pageSize')) {
6049 html.push('</div></div>');
6050 }
6051
6052 if (this.paginationParts.includes('pageList')) {
6053 html.push("<div class=\"".concat(this.constants.classes.pull, "-").concat(opts.paginationHAlign, " pagination\">"), Utils.sprintf(this.constants.html.pagination[0], Utils.sprintf(' pagination-%s', opts.iconSize)), Utils.sprintf(this.constants.html.paginationItem, ' page-pre', opts.formatSRPaginationPreText(), opts.paginationPreText));
6054
6055 if (this.totalPages < opts.paginationSuccessivelySize) {
6056 from = 1;
6057 to = this.totalPages;
6058 } else {
6059 from = opts.pageNumber - opts.paginationPagesBySide;
6060 to = from + opts.paginationPagesBySide * 2;
6061 }
6062
6063 if (opts.pageNumber < opts.paginationSuccessivelySize - 1) {
6064 to = opts.paginationSuccessivelySize;
6065 }
6066
6067 if (opts.paginationSuccessivelySize > this.totalPages - from) {
6068 from = from - (opts.paginationSuccessivelySize - (this.totalPages - from)) + 1;
6069 }
6070
6071 if (from < 1) {
6072 from = 1;
6073 }
6074
6075 if (to > this.totalPages) {
6076 to = this.totalPages;
6077 }
6078
6079 var middleSize = Math.round(opts.paginationPagesBySide / 2);
6080
6081 var pageItem = function pageItem(i) {
6082 var classes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
6083 return Utils.sprintf(_this6.constants.html.paginationItem, classes + (i === opts.pageNumber ? " ".concat(_this6.constants.classes.paginationActive) : ''), opts.formatSRPaginationPageText(i), i);
6084 };
6085
6086 if (from > 1) {
6087 var max = opts.paginationPagesBySide;
6088 if (max >= from) max = from - 1;
6089
6090 for (i = 1; i <= max; i++) {
6091 html.push(pageItem(i));
6092 }
6093
6094 if (from - 1 === max + 1) {
6095 i = from - 1;
6096 html.push(pageItem(i));
6097 } else if (from - 1 > max) {
6098 if (from - opts.paginationPagesBySide * 2 > opts.paginationPagesBySide && opts.paginationUseIntermediate) {
6099 i = Math.round((from - middleSize) / 2 + middleSize);
6100 html.push(pageItem(i, ' page-intermediate'));
6101 } else {
6102 html.push(Utils.sprintf(this.constants.html.paginationItem, ' page-first-separator disabled', '', '...'));
6103 }
6104 }
6105 }
6106
6107 for (i = from; i <= to; i++) {
6108 html.push(pageItem(i));
6109 }
6110
6111 if (this.totalPages > to) {
6112 var min = this.totalPages - (opts.paginationPagesBySide - 1);
6113 if (to >= min) min = to + 1;
6114
6115 if (to + 1 === min - 1) {
6116 i = to + 1;
6117 html.push(pageItem(i));
6118 } else if (min > to + 1) {
6119 if (this.totalPages - to > opts.paginationPagesBySide * 2 && opts.paginationUseIntermediate) {
6120 i = Math.round((this.totalPages - middleSize - to) / 2 + to);
6121 html.push(pageItem(i, ' page-intermediate'));
6122 } else {
6123 html.push(Utils.sprintf(this.constants.html.paginationItem, ' page-last-separator disabled', '', '...'));
6124 }
6125 }
6126
6127 for (i = min; i <= this.totalPages; i++) {
6128 html.push(pageItem(i));
6129 }
6130 }
6131
6132 html.push(Utils.sprintf(this.constants.html.paginationItem, ' page-next', opts.formatSRPaginationNextText(), opts.paginationNextText));
6133 html.push(this.constants.html.pagination[1], '</div>');
6134 }
6135
6136 this.$pagination.html(html.join(''));
6137 var dropupClass = ['bottom', 'both'].includes(opts.paginationVAlign) ? " ".concat(this.constants.classes.dropup) : '';
6138 this.$pagination.last().find('.page-list > div').addClass(dropupClass);
6139
6140 if (!opts.onlyInfoPagination) {
6141 $pageList = this.$pagination.find('.page-list a');
6142 $pre = this.$pagination.find('.page-pre');
6143 $next = this.$pagination.find('.page-next');
6144 $number = this.$pagination.find('.page-item').not('.page-next, .page-pre, .page-last-separator, .page-first-separator');
6145
6146 if (this.totalPages <= 1) {
6147 this.$pagination.find('div.pagination').hide();
6148 }
6149
6150 if (opts.smartDisplay) {
6151 if (pageList.length < 2 || opts.totalRows <= pageList[0]) {
6152 this.$pagination.find('div.page-list').hide();
6153 }
6154 } // when data is empty, hide the pagination
6155
6156
6157 this.$pagination[this.getData().length ? 'show' : 'hide']();
6158
6159 if (!opts.paginationLoop) {
6160 if (opts.pageNumber === 1) {
6161 $pre.addClass('disabled');
6162 }
6163
6164 if (opts.pageNumber === this.totalPages) {
6165 $next.addClass('disabled');
6166 }
6167 }
6168
6169 if (allSelected) {
6170 opts.pageSize = opts.formatAllRows();
6171 } // removed the events for last and first, onPageNumber executeds the same logic
6172
6173
6174 $pageList.off('click').on('click', function (e) {
6175 return _this6.onPageListChange(e);
6176 });
6177 $pre.off('click').on('click', function (e) {
6178 return _this6.onPagePre(e);
6179 });
6180 $next.off('click').on('click', function (e) {
6181 return _this6.onPageNext(e);
6182 });
6183 $number.off('click').on('click', function (e) {
6184 return _this6.onPageNumber(e);
6185 });
6186 }
6187 }
6188 }, {
6189 key: "updatePagination",
6190 value: function updatePagination(event) {
6191 // Fix #171: IE disabled button can be clicked bug.
6192 if (event && $__default["default"](event.currentTarget).hasClass('disabled')) {
6193 return;
6194 }
6195
6196 if (!this.options.maintainMetaData) {
6197 this.resetRows();
6198 }
6199
6200 this.initPagination();
6201 this.trigger('page-change', this.options.pageNumber, this.options.pageSize);
6202
6203 if (this.options.sidePagination === 'server') {
6204 this.initServer();
6205 } else {
6206 this.initBody();
6207 }
6208 }
6209 }, {
6210 key: "onPageListChange",
6211 value: function onPageListChange(event) {
6212 event.preventDefault();
6213 var $this = $__default["default"](event.currentTarget);
6214 $this.parent().addClass(this.constants.classes.dropdownActive).siblings().removeClass(this.constants.classes.dropdownActive);
6215 this.options.pageSize = $this.text().toUpperCase() === this.options.formatAllRows().toUpperCase() ? this.options.formatAllRows() : +$this.text();
6216 this.$toolbar.find('.page-size').text(this.options.pageSize);
6217 this.updatePagination(event);
6218 return false;
6219 }
6220 }, {
6221 key: "onPagePre",
6222 value: function onPagePre(event) {
6223 if ($__default["default"](event.target).hasClass('disabled')) {
6224 return;
6225 }
6226
6227 event.preventDefault();
6228
6229 if (this.options.pageNumber - 1 === 0) {
6230 this.options.pageNumber = this.options.totalPages;
6231 } else {
6232 this.options.pageNumber--;
6233 }
6234
6235 this.updatePagination(event);
6236 return false;
6237 }
6238 }, {
6239 key: "onPageNext",
6240 value: function onPageNext(event) {
6241 if ($__default["default"](event.target).hasClass('disabled')) {
6242 return;
6243 }
6244
6245 event.preventDefault();
6246
6247 if (this.options.pageNumber + 1 > this.options.totalPages) {
6248 this.options.pageNumber = 1;
6249 } else {
6250 this.options.pageNumber++;
6251 }
6252
6253 this.updatePagination(event);
6254 return false;
6255 }
6256 }, {
6257 key: "onPageNumber",
6258 value: function onPageNumber(event) {
6259 event.preventDefault();
6260
6261 if (this.options.pageNumber === +$__default["default"](event.currentTarget).text()) {
6262 return;
6263 }
6264
6265 this.options.pageNumber = +$__default["default"](event.currentTarget).text();
6266 this.updatePagination(event);
6267 return false;
6268 } // eslint-disable-next-line no-unused-vars
6269
6270 }, {
6271 key: "initRow",
6272 value: function initRow(item, i, data, trFragments) {
6273 var _this7 = this;
6274
6275 var html = [];
6276 var style = {};
6277 var csses = [];
6278 var data_ = '';
6279 var attributes = {};
6280 var htmlAttributes = [];
6281
6282 if (Utils.findIndex(this.hiddenRows, item) > -1) {
6283 return;
6284 }
6285
6286 style = Utils.calculateObjectValue(this.options, this.options.rowStyle, [item, i], style);
6287
6288 if (style && style.css) {
6289 for (var _i8 = 0, _Object$entries7 = Object.entries(style.css); _i8 < _Object$entries7.length; _i8++) {
6290 var _Object$entries7$_i = _slicedToArray(_Object$entries7[_i8], 2),
6291 key = _Object$entries7$_i[0],
6292 value = _Object$entries7$_i[1];
6293
6294 csses.push("".concat(key, ": ").concat(value));
6295 }
6296 }
6297
6298 attributes = Utils.calculateObjectValue(this.options, this.options.rowAttributes, [item, i], attributes);
6299
6300 if (attributes) {
6301 for (var _i9 = 0, _Object$entries8 = Object.entries(attributes); _i9 < _Object$entries8.length; _i9++) {
6302 var _Object$entries8$_i = _slicedToArray(_Object$entries8[_i9], 2),
6303 _key2 = _Object$entries8$_i[0],
6304 _value = _Object$entries8$_i[1];
6305
6306 htmlAttributes.push("".concat(_key2, "=\"").concat(Utils.escapeHTML(_value), "\""));
6307 }
6308 }
6309
6310 if (item._data && !Utils.isEmptyObject(item._data)) {
6311 for (var _i10 = 0, _Object$entries9 = Object.entries(item._data); _i10 < _Object$entries9.length; _i10++) {
6312 var _Object$entries9$_i = _slicedToArray(_Object$entries9[_i10], 2),
6313 k = _Object$entries9$_i[0],
6314 v = _Object$entries9$_i[1];
6315
6316 // ignore data-index
6317 if (k === 'index') {
6318 return;
6319 }
6320
6321 data_ += " data-".concat(k, "='").concat(_typeof(v) === 'object' ? JSON.stringify(v) : v, "'");
6322 }
6323 }
6324
6325 html.push('<tr', Utils.sprintf(' %s', htmlAttributes.length ? htmlAttributes.join(' ') : undefined), Utils.sprintf(' id="%s"', Array.isArray(item) ? undefined : item._id), Utils.sprintf(' class="%s"', style.classes || (Array.isArray(item) ? undefined : item._class)), Utils.sprintf(' style="%s"', Array.isArray(item) ? undefined : item._style), " data-index=\"".concat(i, "\""), Utils.sprintf(' data-uniqueid="%s"', Utils.getItemField(item, this.options.uniqueId, false)), Utils.sprintf(' data-has-detail-view="%s"', this.options.detailView && Utils.calculateObjectValue(null, this.options.detailFilter, [i, item]) ? 'true' : undefined), Utils.sprintf('%s', data_), '>');
6326
6327 if (this.options.cardView) {
6328 html.push("<td colspan=\"".concat(this.header.fields.length, "\"><div class=\"card-views\">"));
6329 }
6330
6331 var detailViewTemplate = '';
6332
6333 if (Utils.hasDetailViewIcon(this.options)) {
6334 detailViewTemplate = '<td>';
6335
6336 if (Utils.calculateObjectValue(null, this.options.detailFilter, [i, item])) {
6337 detailViewTemplate += "\n <a class=\"detail-icon\" href=\"#\">\n ".concat(Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, this.options.icons.detailOpen), "\n </a>\n ");
6338 }
6339
6340 detailViewTemplate += '</td>';
6341 }
6342
6343 if (detailViewTemplate && this.options.detailViewAlign !== 'right') {
6344 html.push(detailViewTemplate);
6345 }
6346
6347 this.header.fields.forEach(function (field, j) {
6348 var column = _this7.columns[j];
6349 var text = '';
6350 var value_ = Utils.getItemField(item, field, _this7.options.escape, column.escape);
6351 var value = '';
6352 var type = '';
6353 var cellStyle = {};
6354 var id_ = '';
6355 var class_ = _this7.header.classes[j];
6356 var style_ = '';
6357 var styleToAdd_ = '';
6358 var data_ = '';
6359 var rowspan_ = '';
6360 var colspan_ = '';
6361 var title_ = '';
6362
6363 if ((_this7.fromHtml || _this7.autoMergeCells) && typeof value_ === 'undefined') {
6364 if (!column.checkbox && !column.radio) {
6365 return;
6366 }
6367 }
6368
6369 if (!column.visible) {
6370 return;
6371 }
6372
6373 if (_this7.options.cardView && !column.cardVisible) {
6374 return;
6375 }
6376
6377 if (column.escape) {
6378 value_ = Utils.escapeHTML(value_);
6379 } // Style concat
6380
6381
6382 if (csses.concat([_this7.header.styles[j]]).length) {
6383 styleToAdd_ += "".concat(csses.concat([_this7.header.styles[j]]).join('; '));
6384 }
6385
6386 if (item["_".concat(field, "_style")]) {
6387 styleToAdd_ += "".concat(item["_".concat(field, "_style")]);
6388 }
6389
6390 if (styleToAdd_) {
6391 style_ = " style=\"".concat(styleToAdd_, "\"");
6392 } // Style concat
6393 // handle id and class of td
6394
6395
6396 if (item["_".concat(field, "_id")]) {
6397 id_ = Utils.sprintf(' id="%s"', item["_".concat(field, "_id")]);
6398 }
6399
6400 if (item["_".concat(field, "_class")]) {
6401 class_ = Utils.sprintf(' class="%s"', item["_".concat(field, "_class")]);
6402 }
6403
6404 if (item["_".concat(field, "_rowspan")]) {
6405 rowspan_ = Utils.sprintf(' rowspan="%s"', item["_".concat(field, "_rowspan")]);
6406 }
6407
6408 if (item["_".concat(field, "_colspan")]) {
6409 colspan_ = Utils.sprintf(' colspan="%s"', item["_".concat(field, "_colspan")]);
6410 }
6411
6412 if (item["_".concat(field, "_title")]) {
6413 title_ = Utils.sprintf(' title="%s"', item["_".concat(field, "_title")]);
6414 }
6415
6416 cellStyle = Utils.calculateObjectValue(_this7.header, _this7.header.cellStyles[j], [value_, item, i, field], cellStyle);
6417
6418 if (cellStyle.classes) {
6419 class_ = " class=\"".concat(cellStyle.classes, "\"");
6420 }
6421
6422 if (cellStyle.css) {
6423 var csses_ = [];
6424
6425 for (var _i11 = 0, _Object$entries10 = Object.entries(cellStyle.css); _i11 < _Object$entries10.length; _i11++) {
6426 var _Object$entries10$_i = _slicedToArray(_Object$entries10[_i11], 2),
6427 _key3 = _Object$entries10$_i[0],
6428 _value2 = _Object$entries10$_i[1];
6429
6430 csses_.push("".concat(_key3, ": ").concat(_value2));
6431 }
6432
6433 style_ = " style=\"".concat(csses_.concat(_this7.header.styles[j]).join('; '), "\"");
6434 }
6435
6436 value = Utils.calculateObjectValue(column, _this7.header.formatters[j], [value_, item, i, field], value_);
6437
6438 if (!(column.checkbox || column.radio)) {
6439 value = typeof value === 'undefined' || value === null ? _this7.options.undefinedText : value;
6440 }
6441
6442 if (column.searchable && _this7.searchText && _this7.options.searchHighlight && !(column.checkbox || column.radio)) {
6443 var defValue = '';
6444 var regExp = new RegExp("(".concat(_this7.searchText.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), ")"), 'gim');
6445 var marker = '<mark>$1</mark>';
6446 var isHTML = value && /<(?=.*? .*?\/ ?>|br|hr|input|!--|wbr)[a-z]+.*?>|<([a-z]+).*?<\/\1>/i.test(value);
6447
6448 if (isHTML) {
6449 // value can contains a HTML tags
6450 var textContent = new DOMParser().parseFromString(value.toString(), 'text/html').documentElement.textContent;
6451 var textReplaced = textContent.replace(regExp, marker);
6452 textContent = textContent.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
6453 defValue = value.replace(new RegExp("(>\\s*)(".concat(textContent, ")(\\s*)"), 'gm'), "$1".concat(textReplaced, "$3"));
6454 } else {
6455 // but usually not
6456 defValue = value.toString().replace(regExp, marker);
6457 }
6458
6459 value = Utils.calculateObjectValue(column, column.searchHighlightFormatter, [value, _this7.searchText], defValue);
6460 }
6461
6462 if (item["_".concat(field, "_data")] && !Utils.isEmptyObject(item["_".concat(field, "_data")])) {
6463 for (var _i12 = 0, _Object$entries11 = Object.entries(item["_".concat(field, "_data")]); _i12 < _Object$entries11.length; _i12++) {
6464 var _Object$entries11$_i = _slicedToArray(_Object$entries11[_i12], 2),
6465 _k = _Object$entries11$_i[0],
6466 _v = _Object$entries11$_i[1];
6467
6468 // ignore data-index
6469 if (_k === 'index') {
6470 return;
6471 }
6472
6473 data_ += " data-".concat(_k, "=\"").concat(_v, "\"");
6474 }
6475 }
6476
6477 if (column.checkbox || column.radio) {
6478 type = column.checkbox ? 'checkbox' : type;
6479 type = column.radio ? 'radio' : type;
6480 var c = column['class'] || '';
6481 var isChecked = Utils.isObject(value) && value.hasOwnProperty('checked') ? value.checked : (value === true || value_) && value !== false;
6482 var isDisabled = !column.checkboxEnabled || value && value.disabled;
6483 text = [_this7.options.cardView ? "<div class=\"card-view ".concat(c, "\">") : "<td class=\"bs-checkbox ".concat(c, "\"").concat(class_).concat(style_, ">"), "<label>\n <input\n data-index=\"".concat(i, "\"\n name=\"").concat(_this7.options.selectItemName, "\"\n type=\"").concat(type, "\"\n ").concat(Utils.sprintf('value="%s"', item[_this7.options.idField]), "\n ").concat(Utils.sprintf('checked="%s"', isChecked ? 'checked' : undefined), "\n ").concat(Utils.sprintf('disabled="%s"', isDisabled ? 'disabled' : undefined), " />\n <span></span>\n </label>"), _this7.header.formatters[j] && typeof value === 'string' ? value : '', _this7.options.cardView ? '</div>' : '</td>'].join('');
6484 item[_this7.header.stateField] = value === true || !!value_ || value && value.checked;
6485 } else if (_this7.options.cardView) {
6486 var cardTitle = _this7.options.showHeader ? "<span class=\"card-view-title ".concat(cellStyle.classes || '', "\"").concat(style_, ">").concat(Utils.getFieldTitle(_this7.columns, field), "</span>") : '';
6487 text = "<div class=\"card-view\">".concat(cardTitle, "<span class=\"card-view-value ").concat(cellStyle.classes || '', "\"").concat(style_, ">").concat(value, "</span></div>");
6488
6489 if (_this7.options.smartDisplay && value === '') {
6490 text = '<div class="card-view"></div>';
6491 }
6492 } else {
6493 text = "<td".concat(id_).concat(class_).concat(style_).concat(data_).concat(rowspan_).concat(colspan_).concat(title_, ">").concat(value, "</td>");
6494 }
6495
6496 html.push(text);
6497 });
6498
6499 if (detailViewTemplate && this.options.detailViewAlign === 'right') {
6500 html.push(detailViewTemplate);
6501 }
6502
6503 if (this.options.cardView) {
6504 html.push('</div></td>');
6505 }
6506
6507 html.push('</tr>');
6508 return html.join('');
6509 }
6510 }, {
6511 key: "initBody",
6512 value: function initBody(fixedScroll, updatedUid) {
6513 var _this8 = this;
6514
6515 var data = this.getData();
6516 this.trigger('pre-body', data);
6517 this.$body = this.$el.find('>tbody');
6518
6519 if (!this.$body.length) {
6520 this.$body = $__default["default"]('<tbody></tbody>').appendTo(this.$el);
6521 } // Fix #389 Bootstrap-table-flatJSON is not working
6522
6523
6524 if (!this.options.pagination || this.options.sidePagination === 'server') {
6525 this.pageFrom = 1;
6526 this.pageTo = data.length;
6527 }
6528
6529 var rows = [];
6530 var trFragments = $__default["default"](document.createDocumentFragment());
6531 var hasTr = false;
6532 var toExpand = [];
6533 this.autoMergeCells = Utils.checkAutoMergeCells(data.slice(this.pageFrom - 1, this.pageTo));
6534
6535 for (var i = this.pageFrom - 1; i < this.pageTo; i++) {
6536 var item = data[i];
6537 var tr = this.initRow(item, i, data, trFragments);
6538 hasTr = hasTr || !!tr;
6539
6540 if (tr && typeof tr === 'string') {
6541 var uniqueId = this.options.uniqueId;
6542
6543 if (uniqueId && item.hasOwnProperty(uniqueId)) {
6544 var itemUniqueId = item[uniqueId];
6545 var oldTr = this.$body.find(Utils.sprintf('> tr[data-uniqueid="%s"][data-has-detail-view]', itemUniqueId));
6546 var oldTrNext = oldTr.next();
6547
6548 if (oldTrNext.is('tr.detail-view')) {
6549 toExpand.push(i);
6550
6551 if (!updatedUid || itemUniqueId !== updatedUid) {
6552 tr += oldTrNext[0].outerHTML;
6553 }
6554 }
6555 }
6556
6557 if (!this.options.virtualScroll) {
6558 trFragments.append(tr);
6559 } else {
6560 rows.push(tr);
6561 }
6562 }
6563 } // show no records
6564
6565
6566 if (!hasTr) {
6567 this.$body.html("<tr class=\"no-records-found\">".concat(Utils.sprintf('<td colspan="%s">%s</td>', this.getVisibleFields().length + Utils.getDetailViewIndexOffset(this.options), this.options.formatNoMatches()), "</tr>"));
6568 } else if (!this.options.virtualScroll) {
6569 this.$body.html(trFragments);
6570 } else {
6571 if (this.virtualScroll) {
6572 this.virtualScroll.destroy();
6573 }
6574
6575 this.virtualScroll = new VirtualScroll({
6576 rows: rows,
6577 fixedScroll: fixedScroll,
6578 scrollEl: this.$tableBody[0],
6579 contentEl: this.$body[0],
6580 itemHeight: this.options.virtualScrollItemHeight,
6581 callback: function callback(startIndex, endIndex) {
6582 _this8.fitHeader();
6583
6584 _this8.initBodyEvent();
6585
6586 _this8.trigger('virtual-scroll', startIndex, endIndex);
6587 }
6588 });
6589 }
6590
6591 toExpand.forEach(function (index) {
6592 _this8.expandRow(index);
6593 });
6594
6595 if (!fixedScroll) {
6596 this.scrollTo(0);
6597 }
6598
6599 this.initBodyEvent();
6600 this.initFooter();
6601 this.resetView();
6602 this.updateSelected();
6603
6604 if (this.options.sidePagination !== 'server') {
6605 this.options.totalRows = data.length;
6606 }
6607
6608 this.trigger('post-body', data);
6609 }
6610 }, {
6611 key: "initBodyEvent",
6612 value: function initBodyEvent() {
6613 var _this9 = this;
6614
6615 // click to select by column
6616 this.$body.find('> tr[data-index] > td').off('click dblclick').on('click dblclick', function (e) {
6617 var $td = $__default["default"](e.currentTarget);
6618 var $tr = $td.parent();
6619 var $cardViewArr = $__default["default"](e.target).parents('.card-views').children();
6620 var $cardViewTarget = $__default["default"](e.target).parents('.card-view');
6621 var rowIndex = $tr.data('index');
6622 var item = _this9.data[rowIndex];
6623 var index = _this9.options.cardView ? $cardViewArr.index($cardViewTarget) : $td[0].cellIndex;
6624
6625 var fields = _this9.getVisibleFields();
6626
6627 var field = fields[index - Utils.getDetailViewIndexOffset(_this9.options)];
6628 var column = _this9.columns[_this9.fieldsColumnsIndex[field]];
6629 var value = Utils.getItemField(item, field, _this9.options.escape, column.escape);
6630
6631 if ($td.find('.detail-icon').length) {
6632 return;
6633 }
6634
6635 _this9.trigger(e.type === 'click' ? 'click-cell' : 'dbl-click-cell', field, value, item, $td);
6636
6637 _this9.trigger(e.type === 'click' ? 'click-row' : 'dbl-click-row', item, $tr, field); // if click to select - then trigger the checkbox/radio click
6638
6639
6640 if (e.type === 'click' && _this9.options.clickToSelect && column.clickToSelect && !Utils.calculateObjectValue(_this9.options, _this9.options.ignoreClickToSelectOn, [e.target])) {
6641 var $selectItem = $tr.find(Utils.sprintf('[name="%s"]', _this9.options.selectItemName));
6642
6643 if ($selectItem.length) {
6644 $selectItem[0].click();
6645 }
6646 }
6647
6648 if (e.type === 'click' && _this9.options.detailViewByClick) {
6649 _this9.toggleDetailView(rowIndex, _this9.header.detailFormatters[_this9.fieldsColumnsIndex[field]]);
6650 }
6651 }).off('mousedown').on('mousedown', function (e) {
6652 // https://github.com/jquery/jquery/issues/1741
6653 _this9.multipleSelectRowCtrlKey = e.ctrlKey || e.metaKey;
6654 _this9.multipleSelectRowShiftKey = e.shiftKey;
6655 });
6656 this.$body.find('> tr[data-index] > td > .detail-icon').off('click').on('click', function (e) {
6657 e.preventDefault();
6658
6659 _this9.toggleDetailView($__default["default"](e.currentTarget).parent().parent().data('index'));
6660
6661 return false;
6662 });
6663 this.$selectItem = this.$body.find(Utils.sprintf('[name="%s"]', this.options.selectItemName));
6664 this.$selectItem.off('click').on('click', function (e) {
6665 e.stopImmediatePropagation();
6666 var $this = $__default["default"](e.currentTarget);
6667
6668 _this9._toggleCheck($this.prop('checked'), $this.data('index'));
6669 });
6670 this.header.events.forEach(function (_events, i) {
6671 var events = _events;
6672
6673 if (!events) {
6674 return;
6675 } // fix bug, if events is defined with namespace
6676
6677
6678 if (typeof events === 'string') {
6679 events = Utils.calculateObjectValue(null, events);
6680 }
6681
6682 if (!events) {
6683 throw new Error("Unknown event in the scope: ".concat(_events));
6684 }
6685
6686 var field = _this9.header.fields[i];
6687
6688 var fieldIndex = _this9.getVisibleFields().indexOf(field);
6689
6690 if (fieldIndex === -1) {
6691 return;
6692 }
6693
6694 fieldIndex += Utils.getDetailViewIndexOffset(_this9.options);
6695
6696 var _loop2 = function _loop2(key) {
6697 if (!events.hasOwnProperty(key)) {
6698 return "continue";
6699 }
6700
6701 var event = events[key];
6702
6703 _this9.$body.find('>tr:not(.no-records-found)').each(function (i, tr) {
6704 var $tr = $__default["default"](tr);
6705 var $td = $tr.find(_this9.options.cardView ? '.card-views>.card-view' : '>td').eq(fieldIndex);
6706 var index = key.indexOf(' ');
6707 var name = key.substring(0, index);
6708 var el = key.substring(index + 1);
6709 $td.find(el).off(name).on(name, function (e) {
6710 var index = $tr.data('index');
6711 var row = _this9.data[index];
6712 var value = row[field];
6713 event.apply(_this9, [e, value, row, index]);
6714 });
6715 });
6716 };
6717
6718 for (var key in events) {
6719 var _ret2 = _loop2(key);
6720
6721 if (_ret2 === "continue") continue;
6722 }
6723 });
6724 }
6725 }, {
6726 key: "initServer",
6727 value: function initServer(silent, query, url) {
6728 var _this10 = this;
6729
6730 var data = {};
6731 var index = this.header.fields.indexOf(this.options.sortName);
6732 var params = {
6733 searchText: this.searchText,
6734 sortName: this.options.sortName,
6735 sortOrder: this.options.sortOrder
6736 };
6737
6738 if (this.header.sortNames[index]) {
6739 params.sortName = this.header.sortNames[index];
6740 }
6741
6742 if (this.options.pagination && this.options.sidePagination === 'server') {
6743 params.pageSize = this.options.pageSize === this.options.formatAllRows() ? this.options.totalRows : this.options.pageSize;
6744 params.pageNumber = this.options.pageNumber;
6745 }
6746
6747 if (!(url || this.options.url) && !this.options.ajax) {
6748 return;
6749 }
6750
6751 if (this.options.queryParamsType === 'limit') {
6752 params = {
6753 search: params.searchText,
6754 sort: params.sortName,
6755 order: params.sortOrder
6756 };
6757
6758 if (this.options.pagination && this.options.sidePagination === 'server') {
6759 params.offset = this.options.pageSize === this.options.formatAllRows() ? 0 : this.options.pageSize * (this.options.pageNumber - 1);
6760 params.limit = this.options.pageSize;
6761
6762 if (params.limit === 0 || this.options.pageSize === this.options.formatAllRows()) {
6763 delete params.limit;
6764 }
6765 }
6766 }
6767
6768 if (this.options.search && this.options.sidePagination === 'server' && this.columns.filter(function (column) {
6769 return !column.searchable;
6770 }).length) {
6771 params.searchable = [];
6772
6773 var _iterator2 = _createForOfIteratorHelper(this.columns),
6774 _step2;
6775
6776 try {
6777 for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
6778 var column = _step2.value;
6779
6780 if (!column.checkbox && column.searchable && (this.options.visibleSearch && column.visible || !this.options.visibleSearch)) {
6781 params.searchable.push(column.field);
6782 }
6783 }
6784 } catch (err) {
6785 _iterator2.e(err);
6786 } finally {
6787 _iterator2.f();
6788 }
6789 }
6790
6791 if (!Utils.isEmptyObject(this.filterColumnsPartial)) {
6792 params.filter = JSON.stringify(this.filterColumnsPartial, null);
6793 }
6794
6795 $__default["default"].extend(params, query || {});
6796 data = Utils.calculateObjectValue(this.options, this.options.queryParams, [params], data); // false to stop request
6797
6798 if (data === false) {
6799 return;
6800 }
6801
6802 if (!silent) {
6803 this.showLoading();
6804 }
6805
6806 var request = $__default["default"].extend({}, Utils.calculateObjectValue(null, this.options.ajaxOptions), {
6807 type: this.options.method,
6808 url: url || this.options.url,
6809 data: this.options.contentType === 'application/json' && this.options.method === 'post' ? JSON.stringify(data) : data,
6810 cache: this.options.cache,
6811 contentType: this.options.contentType,
6812 dataType: this.options.dataType,
6813 success: function success(_res, textStatus, jqXHR) {
6814 var res = Utils.calculateObjectValue(_this10.options, _this10.options.responseHandler, [_res, jqXHR], _res);
6815
6816 _this10.load(res);
6817
6818 _this10.trigger('load-success', res, jqXHR && jqXHR.status, jqXHR);
6819
6820 if (!silent) {
6821 _this10.hideLoading();
6822 }
6823
6824 if (_this10.options.sidePagination === 'server' && _this10.options.pageNumber > 1 && res[_this10.options.totalField] > 0 && !res[_this10.options.dataField].length) {
6825 _this10.updatePagination();
6826 }
6827 },
6828 error: function error(jqXHR) {
6829 // abort ajax by multiple request
6830 if (jqXHR && jqXHR.status === 0 && _this10._xhrAbort) {
6831 _this10._xhrAbort = false;
6832 return;
6833 }
6834
6835 var data = [];
6836
6837 if (_this10.options.sidePagination === 'server') {
6838 data = {};
6839 data[_this10.options.totalField] = 0;
6840 data[_this10.options.dataField] = [];
6841 }
6842
6843 _this10.load(data);
6844
6845 _this10.trigger('load-error', jqXHR && jqXHR.status, jqXHR);
6846
6847 if (!silent) {
6848 _this10.hideLoading();
6849 }
6850 }
6851 });
6852
6853 if (this.options.ajax) {
6854 Utils.calculateObjectValue(this, this.options.ajax, [request], null);
6855 } else {
6856 if (this._xhr && this._xhr.readyState !== 4) {
6857 this._xhrAbort = true;
6858
6859 this._xhr.abort();
6860 }
6861
6862 this._xhr = $__default["default"].ajax(request);
6863 }
6864
6865 return data;
6866 }
6867 }, {
6868 key: "initSearchText",
6869 value: function initSearchText() {
6870 if (this.options.search) {
6871 this.searchText = '';
6872
6873 if (this.options.searchText !== '') {
6874 var $search = Utils.getSearchInput(this);
6875 $search.val(this.options.searchText);
6876 this.onSearch({
6877 currentTarget: $search,
6878 firedByInitSearchText: true
6879 });
6880 }
6881 }
6882 }
6883 }, {
6884 key: "getCaret",
6885 value: function getCaret() {
6886 var _this11 = this;
6887
6888 this.$header.find('th').each(function (i, th) {
6889 $__default["default"](th).find('.sortable').removeClass('desc asc').addClass($__default["default"](th).data('field') === _this11.options.sortName ? _this11.options.sortOrder : 'both');
6890 });
6891 }
6892 }, {
6893 key: "updateSelected",
6894 value: function updateSelected() {
6895 var checkAll = this.$selectItem.filter(':enabled').length && this.$selectItem.filter(':enabled').length === this.$selectItem.filter(':enabled').filter(':checked').length;
6896 this.$selectAll.add(this.$selectAll_).prop('checked', checkAll);
6897 this.$selectItem.each(function (i, el) {
6898 $__default["default"](el).closest('tr')[$__default["default"](el).prop('checked') ? 'addClass' : 'removeClass']('selected');
6899 });
6900 }
6901 }, {
6902 key: "updateRows",
6903 value: function updateRows() {
6904 var _this12 = this;
6905
6906 this.$selectItem.each(function (i, el) {
6907 _this12.data[$__default["default"](el).data('index')][_this12.header.stateField] = $__default["default"](el).prop('checked');
6908 });
6909 }
6910 }, {
6911 key: "resetRows",
6912 value: function resetRows() {
6913 var _iterator3 = _createForOfIteratorHelper(this.data),
6914 _step3;
6915
6916 try {
6917 for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
6918 var row = _step3.value;
6919 this.$selectAll.prop('checked', false);
6920 this.$selectItem.prop('checked', false);
6921
6922 if (this.header.stateField) {
6923 row[this.header.stateField] = false;
6924 }
6925 }
6926 } catch (err) {
6927 _iterator3.e(err);
6928 } finally {
6929 _iterator3.f();
6930 }
6931
6932 this.initHiddenRows();
6933 }
6934 }, {
6935 key: "trigger",
6936 value: function trigger(_name) {
6937 var _this$options, _this$options2;
6938
6939 var name = "".concat(_name, ".bs.table");
6940
6941 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key4 = 1; _key4 < _len; _key4++) {
6942 args[_key4 - 1] = arguments[_key4];
6943 }
6944
6945 (_this$options = this.options)[BootstrapTable.EVENTS[name]].apply(_this$options, [].concat(args, [this]));
6946
6947 this.$el.trigger($__default["default"].Event(name, {
6948 sender: this
6949 }), args);
6950
6951 (_this$options2 = this.options).onAll.apply(_this$options2, [name].concat([].concat(args, [this])));
6952
6953 this.$el.trigger($__default["default"].Event('all.bs.table', {
6954 sender: this
6955 }), [name, args]);
6956 }
6957 }, {
6958 key: "resetHeader",
6959 value: function resetHeader() {
6960 var _this13 = this;
6961
6962 // fix #61: the hidden table reset header bug.
6963 // fix bug: get $el.css('width') error sometime (height = 500)
6964 clearTimeout(this.timeoutId_);
6965 this.timeoutId_ = setTimeout(function () {
6966 return _this13.fitHeader();
6967 }, this.$el.is(':hidden') ? 100 : 0);
6968 }
6969 }, {
6970 key: "fitHeader",
6971 value: function fitHeader() {
6972 var _this14 = this;
6973
6974 if (this.$el.is(':hidden')) {
6975 this.timeoutId_ = setTimeout(function () {
6976 return _this14.fitHeader();
6977 }, 100);
6978 return;
6979 }
6980
6981 var fixedBody = this.$tableBody.get(0);
6982 var scrollWidth = this.hasScrollBar && fixedBody.scrollHeight > fixedBody.clientHeight + this.$header.outerHeight() ? Utils.getScrollBarWidth() : 0;
6983 this.$el.css('margin-top', -this.$header.outerHeight());
6984 var focused = $__default["default"](':focus');
6985
6986 if (focused.length > 0) {
6987 var $th = focused.parents('th');
6988
6989 if ($th.length > 0) {
6990 var dataField = $th.attr('data-field');
6991
6992 if (dataField !== undefined) {
6993 var $headerTh = this.$header.find("[data-field='".concat(dataField, "']"));
6994
6995 if ($headerTh.length > 0) {
6996 $headerTh.find(':input').addClass('focus-temp');
6997 }
6998 }
6999 }
7000 }
7001
7002 this.$header_ = this.$header.clone(true, true);
7003 this.$selectAll_ = this.$header_.find('[name="btSelectAll"]');
7004 this.$tableHeader.css('margin-right', scrollWidth).find('table').css('width', this.$el.outerWidth()).html('').attr('class', this.$el.attr('class')).append(this.$header_);
7005 this.$tableLoading.css('width', this.$el.outerWidth());
7006 var focusedTemp = $__default["default"]('.focus-temp:visible:eq(0)');
7007
7008 if (focusedTemp.length > 0) {
7009 focusedTemp.focus();
7010 this.$header.find('.focus-temp').removeClass('focus-temp');
7011 } // fix bug: $.data() is not working as expected after $.append()
7012
7013
7014 this.$header.find('th[data-field]').each(function (i, el) {
7015 _this14.$header_.find(Utils.sprintf('th[data-field="%s"]', $__default["default"](el).data('field'))).data($__default["default"](el).data());
7016 });
7017 var visibleFields = this.getVisibleFields();
7018 var $ths = this.$header_.find('th');
7019 var $tr = this.$body.find('>tr:not(.no-records-found,.virtual-scroll-top)').eq(0);
7020
7021 while ($tr.length && $tr.find('>td[colspan]:not([colspan="1"])').length) {
7022 $tr = $tr.next();
7023 }
7024
7025 var trLength = $tr.find('> *').length;
7026 $tr.find('> *').each(function (i, el) {
7027 var $this = $__default["default"](el);
7028
7029 if (Utils.hasDetailViewIcon(_this14.options)) {
7030 if (i === 0 && _this14.options.detailViewAlign !== 'right' || i === trLength - 1 && _this14.options.detailViewAlign === 'right') {
7031 var $thDetail = $ths.filter('.detail');
7032
7033 var _zoomWidth = $thDetail.innerWidth() - $thDetail.find('.fht-cell').width();
7034
7035 $thDetail.find('.fht-cell').width($this.innerWidth() - _zoomWidth);
7036 return;
7037 }
7038 }
7039
7040 var index = i - Utils.getDetailViewIndexOffset(_this14.options);
7041
7042 var $th = _this14.$header_.find(Utils.sprintf('th[data-field="%s"]', visibleFields[index]));
7043
7044 if ($th.length > 1) {
7045 $th = $__default["default"]($ths[$this[0].cellIndex]);
7046 }
7047
7048 var zoomWidth = $th.innerWidth() - $th.find('.fht-cell').width();
7049 $th.find('.fht-cell').width($this.innerWidth() - zoomWidth);
7050 });
7051 this.horizontalScroll();
7052 this.trigger('post-header');
7053 }
7054 }, {
7055 key: "initFooter",
7056 value: function initFooter() {
7057 if (!this.options.showFooter || this.options.cardView) {
7058 // do nothing
7059 return;
7060 }
7061
7062 var data = this.getData();
7063 var html = [];
7064 var detailTemplate = '';
7065
7066 if (Utils.hasDetailViewIcon(this.options)) {
7067 detailTemplate = '<th class="detail"><div class="th-inner"></div><div class="fht-cell"></div></th>';
7068 }
7069
7070 if (detailTemplate && this.options.detailViewAlign !== 'right') {
7071 html.push(detailTemplate);
7072 }
7073
7074 var _iterator4 = _createForOfIteratorHelper(this.columns),
7075 _step4;
7076
7077 try {
7078 for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
7079 var column = _step4.value;
7080 var falign = '';
7081 var valign = '';
7082 var csses = [];
7083 var style = {};
7084 var class_ = Utils.sprintf(' class="%s"', column['class']);
7085
7086 if (!column.visible || this.footerData && this.footerData.length > 0 && !(column.field in this.footerData[0])) {
7087 continue;
7088 }
7089
7090 if (this.options.cardView && !column.cardVisible) {
7091 return;
7092 }
7093
7094 falign = Utils.sprintf('text-align: %s; ', column.falign ? column.falign : column.align);
7095 valign = Utils.sprintf('vertical-align: %s; ', column.valign);
7096 style = Utils.calculateObjectValue(null, this.options.footerStyle, [column]);
7097
7098 if (style && style.css) {
7099 for (var _i13 = 0, _Object$entries12 = Object.entries(style.css); _i13 < _Object$entries12.length; _i13++) {
7100 var _Object$entries12$_i = _slicedToArray(_Object$entries12[_i13], 2),
7101 key = _Object$entries12$_i[0],
7102 _value3 = _Object$entries12$_i[1];
7103
7104 csses.push("".concat(key, ": ").concat(_value3));
7105 }
7106 }
7107
7108 if (style && style.classes) {
7109 class_ = Utils.sprintf(' class="%s"', column['class'] ? [column['class'], style.classes].join(' ') : style.classes);
7110 }
7111
7112 html.push('<th', class_, Utils.sprintf(' style="%s"', falign + valign + csses.concat().join('; ')));
7113 var colspan = 0;
7114
7115 if (this.footerData && this.footerData.length > 0) {
7116 colspan = this.footerData[0]["_".concat(column.field, "_colspan")] || 0;
7117 }
7118
7119 if (colspan) {
7120 html.push(" colspan=\"".concat(colspan, "\" "));
7121 }
7122
7123 html.push('>');
7124 html.push('<div class="th-inner">');
7125 var value = '';
7126
7127 if (this.footerData && this.footerData.length > 0) {
7128 value = this.footerData[0][column.field] || '';
7129 }
7130
7131 html.push(Utils.calculateObjectValue(column, column.footerFormatter, [data, value], value));
7132 html.push('</div>');
7133 html.push('<div class="fht-cell"></div>');
7134 html.push('</div>');
7135 html.push('</th>');
7136 }
7137 } catch (err) {
7138 _iterator4.e(err);
7139 } finally {
7140 _iterator4.f();
7141 }
7142
7143 if (detailTemplate && this.options.detailViewAlign === 'right') {
7144 html.push(detailTemplate);
7145 }
7146
7147 if (!this.options.height && !this.$tableFooter.length) {
7148 this.$el.append('<tfoot><tr></tr></tfoot>');
7149 this.$tableFooter = this.$el.find('tfoot');
7150 }
7151
7152 if (!this.$tableFooter.find('tr').length) {
7153 this.$tableFooter.html('<table><thead><tr></tr></thead></table>');
7154 }
7155
7156 this.$tableFooter.find('tr').html(html.join(''));
7157 this.trigger('post-footer', this.$tableFooter);
7158 }
7159 }, {
7160 key: "fitFooter",
7161 value: function fitFooter() {
7162 var _this15 = this;
7163
7164 if (this.$el.is(':hidden')) {
7165 setTimeout(function () {
7166 return _this15.fitFooter();
7167 }, 100);
7168 return;
7169 }
7170
7171 var fixedBody = this.$tableBody.get(0);
7172 var scrollWidth = this.hasScrollBar && fixedBody.scrollHeight > fixedBody.clientHeight + this.$header.outerHeight() ? Utils.getScrollBarWidth() : 0;
7173 this.$tableFooter.css('margin-right', scrollWidth).find('table').css('width', this.$el.outerWidth()).attr('class', this.$el.attr('class'));
7174 var $ths = this.$tableFooter.find('th');
7175 var $tr = this.$body.find('>tr:first-child:not(.no-records-found)');
7176 $ths.find('.fht-cell').width('auto');
7177
7178 while ($tr.length && $tr.find('>td[colspan]:not([colspan="1"])').length) {
7179 $tr = $tr.next();
7180 }
7181
7182 var trLength = $tr.find('> *').length;
7183 $tr.find('> *').each(function (i, el) {
7184 var $this = $__default["default"](el);
7185
7186 if (Utils.hasDetailViewIcon(_this15.options)) {
7187 if (i === 0 && _this15.options.detailViewAlign === 'left' || i === trLength - 1 && _this15.options.detailViewAlign === 'right') {
7188 var $thDetail = $ths.filter('.detail');
7189
7190 var _zoomWidth2 = $thDetail.innerWidth() - $thDetail.find('.fht-cell').width();
7191
7192 $thDetail.find('.fht-cell').width($this.innerWidth() - _zoomWidth2);
7193 return;
7194 }
7195 }
7196
7197 var $th = $ths.eq(i);
7198 var zoomWidth = $th.innerWidth() - $th.find('.fht-cell').width();
7199 $th.find('.fht-cell').width($this.innerWidth() - zoomWidth);
7200 });
7201 this.horizontalScroll();
7202 }
7203 }, {
7204 key: "horizontalScroll",
7205 value: function horizontalScroll() {
7206 var _this16 = this;
7207
7208 // horizontal scroll event
7209 // TODO: it's probably better improving the layout than binding to scroll event
7210 this.$tableBody.off('scroll').on('scroll', function () {
7211 var scrollLeft = _this16.$tableBody.scrollLeft();
7212
7213 if (_this16.options.showHeader && _this16.options.height) {
7214 _this16.$tableHeader.scrollLeft(scrollLeft);
7215 }
7216
7217 if (_this16.options.showFooter && !_this16.options.cardView) {
7218 _this16.$tableFooter.scrollLeft(scrollLeft);
7219 }
7220
7221 _this16.trigger('scroll-body', _this16.$tableBody);
7222 });
7223 }
7224 }, {
7225 key: "getVisibleFields",
7226 value: function getVisibleFields() {
7227 var visibleFields = [];
7228
7229 var _iterator5 = _createForOfIteratorHelper(this.header.fields),
7230 _step5;
7231
7232 try {
7233 for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
7234 var field = _step5.value;
7235 var column = this.columns[this.fieldsColumnsIndex[field]];
7236
7237 if (!column || !column.visible || this.options.cardView && !column.cardVisible) {
7238 continue;
7239 }
7240
7241 visibleFields.push(field);
7242 }
7243 } catch (err) {
7244 _iterator5.e(err);
7245 } finally {
7246 _iterator5.f();
7247 }
7248
7249 return visibleFields;
7250 }
7251 }, {
7252 key: "initHiddenRows",
7253 value: function initHiddenRows() {
7254 this.hiddenRows = [];
7255 } // PUBLIC FUNCTION DEFINITION
7256 // =======================
7257
7258 }, {
7259 key: "getOptions",
7260 value: function getOptions() {
7261 // deep copy and remove data
7262 var options = $__default["default"].extend({}, this.options);
7263 delete options.data;
7264 return $__default["default"].extend(true, {}, options);
7265 }
7266 }, {
7267 key: "refreshOptions",
7268 value: function refreshOptions(options) {
7269 // If the objects are equivalent then avoid the call of destroy / init methods
7270 if (Utils.compareObjects(this.options, options, true)) {
7271 return;
7272 }
7273
7274 this.options = $__default["default"].extend(this.options, options);
7275 this.trigger('refresh-options', this.options);
7276 this.destroy();
7277 this.init();
7278 }
7279 }, {
7280 key: "getData",
7281 value: function getData(params) {
7282 var _this17 = this;
7283
7284 var data = this.options.data;
7285
7286 if ((this.searchText || this.options.customSearch || this.options.sortName !== undefined || this.enableCustomSort || // Fix #4616: this.enableCustomSort is for extensions
7287 !Utils.isEmptyObject(this.filterColumns) || typeof this.options.filterOptions.filterAlgorithm === 'function' || !Utils.isEmptyObject(this.filterColumnsPartial)) && (!params || !params.unfiltered)) {
7288 data = this.data;
7289 }
7290
7291 if (params && params.useCurrentPage) {
7292 data = data.slice(this.pageFrom - 1, this.pageTo);
7293 }
7294
7295 if (params && !params.includeHiddenRows) {
7296 var hiddenRows = this.getHiddenRows();
7297 data = data.filter(function (row) {
7298 return Utils.findIndex(hiddenRows, row) === -1;
7299 });
7300 }
7301
7302 if (params && params.formatted) {
7303 data.forEach(function (row) {
7304 for (var _i14 = 0, _Object$entries13 = Object.entries(row); _i14 < _Object$entries13.length; _i14++) {
7305 var _Object$entries13$_i = _slicedToArray(_Object$entries13[_i14], 2),
7306 key = _Object$entries13$_i[0],
7307 value = _Object$entries13$_i[1];
7308
7309 var column = _this17.columns[_this17.fieldsColumnsIndex[key]];
7310
7311 if (!column) {
7312 return;
7313 }
7314
7315 row[key] = Utils.calculateObjectValue(column, _this17.header.formatters[column.fieldIndex], [value, row, row.index, column.field], value);
7316 }
7317 });
7318 }
7319
7320 return data;
7321 }
7322 }, {
7323 key: "getSelections",
7324 value: function getSelections() {
7325 var _this18 = this;
7326
7327 return (this.options.maintainMetaData ? this.options.data : this.data).filter(function (row) {
7328 return row[_this18.header.stateField] === true;
7329 });
7330 }
7331 }, {
7332 key: "load",
7333 value: function load(_data) {
7334 var fixedScroll = false;
7335 var data = _data; // #431: support pagination
7336
7337 if (this.options.pagination && this.options.sidePagination === 'server') {
7338 this.options.totalRows = data[this.options.totalField];
7339 this.options.totalNotFiltered = data[this.options.totalNotFilteredField];
7340 this.footerData = data[this.options.footerField] ? [data[this.options.footerField]] : undefined;
7341 }
7342
7343 fixedScroll = data.fixedScroll;
7344 data = Array.isArray(data) ? data : data[this.options.dataField];
7345 this.initData(data);
7346 this.initSearch();
7347 this.initPagination();
7348 this.initBody(fixedScroll);
7349 }
7350 }, {
7351 key: "append",
7352 value: function append(data) {
7353 this.initData(data, 'append');
7354 this.initSearch();
7355 this.initPagination();
7356 this.initSort();
7357 this.initBody(true);
7358 }
7359 }, {
7360 key: "prepend",
7361 value: function prepend(data) {
7362 this.initData(data, 'prepend');
7363 this.initSearch();
7364 this.initPagination();
7365 this.initSort();
7366 this.initBody(true);
7367 }
7368 }, {
7369 key: "remove",
7370 value: function remove(params) {
7371 var removed = 0;
7372
7373 for (var i = this.options.data.length - 1; i >= 0; i--) {
7374 var row = this.options.data[i];
7375
7376 if (!row.hasOwnProperty(params.field) && params.field !== '$index') {
7377 continue;
7378 }
7379
7380 if (!row.hasOwnProperty(params.field) && params.field === '$index' && params.values.includes(i) || params.values.includes(row[params.field])) {
7381 removed++;
7382 this.options.data.splice(i, 1);
7383 }
7384 }
7385
7386 if (!removed) {
7387 return;
7388 }
7389
7390 if (this.options.sidePagination === 'server') {
7391 this.options.totalRows -= removed;
7392 this.data = _toConsumableArray(this.options.data);
7393 }
7394
7395 this.initSearch();
7396 this.initPagination();
7397 this.initSort();
7398 this.initBody(true);
7399 }
7400 }, {
7401 key: "removeAll",
7402 value: function removeAll() {
7403 if (this.options.data.length > 0) {
7404 this.options.data.splice(0, this.options.data.length);
7405 this.initSearch();
7406 this.initPagination();
7407 this.initBody(true);
7408 }
7409 }
7410 }, {
7411 key: "insertRow",
7412 value: function insertRow(params) {
7413 if (!params.hasOwnProperty('index') || !params.hasOwnProperty('row')) {
7414 return;
7415 }
7416
7417 this.options.data.splice(params.index, 0, params.row);
7418 this.initSearch();
7419 this.initPagination();
7420 this.initSort();
7421 this.initBody(true);
7422 }
7423 }, {
7424 key: "updateRow",
7425 value: function updateRow(params) {
7426 var allParams = Array.isArray(params) ? params : [params];
7427
7428 var _iterator6 = _createForOfIteratorHelper(allParams),
7429 _step6;
7430
7431 try {
7432 for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
7433 var _params = _step6.value;
7434
7435 if (!_params.hasOwnProperty('index') || !_params.hasOwnProperty('row')) {
7436 continue;
7437 }
7438
7439 if (_params.hasOwnProperty('replace') && _params.replace) {
7440 this.options.data[_params.index] = _params.row;
7441 } else {
7442 $__default["default"].extend(this.options.data[_params.index], _params.row);
7443 }
7444 }
7445 } catch (err) {
7446 _iterator6.e(err);
7447 } finally {
7448 _iterator6.f();
7449 }
7450
7451 this.initSearch();
7452 this.initPagination();
7453 this.initSort();
7454 this.initBody(true);
7455 }
7456 }, {
7457 key: "getRowByUniqueId",
7458 value: function getRowByUniqueId(_id) {
7459 var uniqueId = this.options.uniqueId;
7460 var len = this.options.data.length;
7461 var id = _id;
7462 var dataRow = null;
7463 var i;
7464 var row;
7465 var rowUniqueId;
7466
7467 for (i = len - 1; i >= 0; i--) {
7468 row = this.options.data[i];
7469
7470 if (row.hasOwnProperty(uniqueId)) {
7471 // uniqueId is a column
7472 rowUniqueId = row[uniqueId];
7473 } else if (row._data && row._data.hasOwnProperty(uniqueId)) {
7474 // uniqueId is a row data property
7475 rowUniqueId = row._data[uniqueId];
7476 } else {
7477 continue;
7478 }
7479
7480 if (typeof rowUniqueId === 'string') {
7481 id = id.toString();
7482 } else if (typeof rowUniqueId === 'number') {
7483 if (Number(rowUniqueId) === rowUniqueId && rowUniqueId % 1 === 0) {
7484 id = parseInt(id, 10);
7485 } else if (rowUniqueId === Number(rowUniqueId) && rowUniqueId !== 0) {
7486 id = parseFloat(id);
7487 }
7488 }
7489
7490 if (rowUniqueId === id) {
7491 dataRow = row;
7492 break;
7493 }
7494 }
7495
7496 return dataRow;
7497 }
7498 }, {
7499 key: "updateByUniqueId",
7500 value: function updateByUniqueId(params) {
7501 var allParams = Array.isArray(params) ? params : [params];
7502 var updatedUid = null;
7503
7504 var _iterator7 = _createForOfIteratorHelper(allParams),
7505 _step7;
7506
7507 try {
7508 for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
7509 var _params2 = _step7.value;
7510
7511 if (!_params2.hasOwnProperty('id') || !_params2.hasOwnProperty('row')) {
7512 continue;
7513 }
7514
7515 var rowId = this.options.data.indexOf(this.getRowByUniqueId(_params2.id));
7516
7517 if (rowId === -1) {
7518 continue;
7519 }
7520
7521 if (_params2.hasOwnProperty('replace') && _params2.replace) {
7522 this.options.data[rowId] = _params2.row;
7523 } else {
7524 $__default["default"].extend(this.options.data[rowId], _params2.row);
7525 }
7526
7527 updatedUid = _params2.id;
7528 }
7529 } catch (err) {
7530 _iterator7.e(err);
7531 } finally {
7532 _iterator7.f();
7533 }
7534
7535 this.initSearch();
7536 this.initPagination();
7537 this.initSort();
7538 this.initBody(true, updatedUid);
7539 }
7540 }, {
7541 key: "removeByUniqueId",
7542 value: function removeByUniqueId(id) {
7543 var len = this.options.data.length;
7544 var row = this.getRowByUniqueId(id);
7545
7546 if (row) {
7547 this.options.data.splice(this.options.data.indexOf(row), 1);
7548 }
7549
7550 if (len === this.options.data.length) {
7551 return;
7552 }
7553
7554 if (this.options.sidePagination === 'server') {
7555 this.options.totalRows -= 1;
7556 this.data = _toConsumableArray(this.options.data);
7557 }
7558
7559 this.initSearch();
7560 this.initPagination();
7561 this.initBody(true);
7562 }
7563 }, {
7564 key: "updateCell",
7565 value: function updateCell(params) {
7566 if (!params.hasOwnProperty('index') || !params.hasOwnProperty('field') || !params.hasOwnProperty('value')) {
7567 return;
7568 }
7569
7570 this.data[params.index][params.field] = params.value;
7571
7572 if (params.reinit === false) {
7573 return;
7574 }
7575
7576 this.initSort();
7577 this.initBody(true);
7578 }
7579 }, {
7580 key: "updateCellByUniqueId",
7581 value: function updateCellByUniqueId(params) {
7582 var _this19 = this;
7583
7584 var allParams = Array.isArray(params) ? params : [params];
7585 allParams.forEach(function (_ref6) {
7586 var id = _ref6.id,
7587 field = _ref6.field,
7588 value = _ref6.value;
7589
7590 var rowId = _this19.options.data.indexOf(_this19.getRowByUniqueId(id));
7591
7592 if (rowId === -1) {
7593 return;
7594 }
7595
7596 _this19.options.data[rowId][field] = value;
7597 });
7598
7599 if (params.reinit === false) {
7600 return;
7601 }
7602
7603 this.initSort();
7604 this.initBody(true);
7605 }
7606 }, {
7607 key: "showRow",
7608 value: function showRow(params) {
7609 this._toggleRow(params, true);
7610 }
7611 }, {
7612 key: "hideRow",
7613 value: function hideRow(params) {
7614 this._toggleRow(params, false);
7615 }
7616 }, {
7617 key: "_toggleRow",
7618 value: function _toggleRow(params, visible) {
7619 var row;
7620
7621 if (params.hasOwnProperty('index')) {
7622 row = this.getData()[params.index];
7623 } else if (params.hasOwnProperty('uniqueId')) {
7624 row = this.getRowByUniqueId(params.uniqueId);
7625 }
7626
7627 if (!row) {
7628 return;
7629 }
7630
7631 var index = Utils.findIndex(this.hiddenRows, row);
7632
7633 if (!visible && index === -1) {
7634 this.hiddenRows.push(row);
7635 } else if (visible && index > -1) {
7636 this.hiddenRows.splice(index, 1);
7637 }
7638
7639 this.initBody(true);
7640 this.initPagination();
7641 }
7642 }, {
7643 key: "getHiddenRows",
7644 value: function getHiddenRows(show) {
7645 if (show) {
7646 this.initHiddenRows();
7647 this.initBody(true);
7648 this.initPagination();
7649 return;
7650 }
7651
7652 var data = this.getData();
7653 var rows = [];
7654
7655 var _iterator8 = _createForOfIteratorHelper(data),
7656 _step8;
7657
7658 try {
7659 for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
7660 var row = _step8.value;
7661
7662 if (this.hiddenRows.includes(row)) {
7663 rows.push(row);
7664 }
7665 }
7666 } catch (err) {
7667 _iterator8.e(err);
7668 } finally {
7669 _iterator8.f();
7670 }
7671
7672 this.hiddenRows = rows;
7673 return rows;
7674 }
7675 }, {
7676 key: "showColumn",
7677 value: function showColumn(field) {
7678 var _this20 = this;
7679
7680 var fields = Array.isArray(field) ? field : [field];
7681 fields.forEach(function (field) {
7682 _this20._toggleColumn(_this20.fieldsColumnsIndex[field], true, true);
7683 });
7684 }
7685 }, {
7686 key: "hideColumn",
7687 value: function hideColumn(field) {
7688 var _this21 = this;
7689
7690 var fields = Array.isArray(field) ? field : [field];
7691 fields.forEach(function (field) {
7692 _this21._toggleColumn(_this21.fieldsColumnsIndex[field], false, true);
7693 });
7694 }
7695 }, {
7696 key: "_toggleColumn",
7697 value: function _toggleColumn(index, checked, needUpdate) {
7698 if (index === -1 || this.columns[index].visible === checked) {
7699 return;
7700 }
7701
7702 this.columns[index].visible = checked;
7703 this.initHeader();
7704 this.initSearch();
7705 this.initPagination();
7706 this.initBody();
7707
7708 if (this.options.showColumns) {
7709 var $items = this.$toolbar.find('.keep-open input:not(".toggle-all")').prop('disabled', false);
7710
7711 if (needUpdate) {
7712 $items.filter(Utils.sprintf('[value="%s"]', index)).prop('checked', checked);
7713 }
7714
7715 if ($items.filter(':checked').length <= this.options.minimumCountColumns) {
7716 $items.filter(':checked').prop('disabled', true);
7717 }
7718 }
7719 }
7720 }, {
7721 key: "getVisibleColumns",
7722 value: function getVisibleColumns() {
7723 var _this22 = this;
7724
7725 return this.columns.filter(function (column) {
7726 return column.visible && !_this22.isSelectionColumn(column);
7727 });
7728 }
7729 }, {
7730 key: "getHiddenColumns",
7731 value: function getHiddenColumns() {
7732 return this.columns.filter(function (_ref7) {
7733 var visible = _ref7.visible;
7734 return !visible;
7735 });
7736 }
7737 }, {
7738 key: "isSelectionColumn",
7739 value: function isSelectionColumn(column) {
7740 return column.radio || column.checkbox;
7741 }
7742 }, {
7743 key: "showAllColumns",
7744 value: function showAllColumns() {
7745 this._toggleAllColumns(true);
7746 }
7747 }, {
7748 key: "hideAllColumns",
7749 value: function hideAllColumns() {
7750 this._toggleAllColumns(false);
7751 }
7752 }, {
7753 key: "_toggleAllColumns",
7754 value: function _toggleAllColumns(visible) {
7755 var _this23 = this;
7756
7757 var _iterator9 = _createForOfIteratorHelper(this.columns.slice().reverse()),
7758 _step9;
7759
7760 try {
7761 for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
7762 var column = _step9.value;
7763
7764 if (column.switchable) {
7765 if (!visible && this.options.showColumns && this.getVisibleColumns().filter(function (it) {
7766 return it.switchable;
7767 }).length === this.options.minimumCountColumns) {
7768 continue;
7769 }
7770
7771 column.visible = visible;
7772 }
7773 }
7774 } catch (err) {
7775 _iterator9.e(err);
7776 } finally {
7777 _iterator9.f();
7778 }
7779
7780 this.initHeader();
7781 this.initSearch();
7782 this.initPagination();
7783 this.initBody();
7784
7785 if (this.options.showColumns) {
7786 var $items = this.$toolbar.find('.keep-open input[type="checkbox"]:not(".toggle-all")').prop('disabled', false);
7787
7788 if (visible) {
7789 $items.prop('checked', visible);
7790 } else {
7791 $items.get().reverse().forEach(function (item) {
7792 if ($items.filter(':checked').length > _this23.options.minimumCountColumns) {
7793 $__default["default"](item).prop('checked', visible);
7794 }
7795 });
7796 }
7797
7798 if ($items.filter(':checked').length <= this.options.minimumCountColumns) {
7799 $items.filter(':checked').prop('disabled', true);
7800 }
7801 }
7802 }
7803 }, {
7804 key: "mergeCells",
7805 value: function mergeCells(options) {
7806 var row = options.index;
7807 var col = this.getVisibleFields().indexOf(options.field);
7808 var rowspan = options.rowspan || 1;
7809 var colspan = options.colspan || 1;
7810 var i;
7811 var j;
7812 var $tr = this.$body.find('>tr[data-index]');
7813 col += Utils.getDetailViewIndexOffset(this.options);
7814 var $td = $tr.eq(row).find('>td').eq(col);
7815
7816 if (row < 0 || col < 0 || row >= this.data.length) {
7817 return;
7818 }
7819
7820 for (i = row; i < row + rowspan; i++) {
7821 for (j = col; j < col + colspan; j++) {
7822 $tr.eq(i).find('>td').eq(j).hide();
7823 }
7824 }
7825
7826 $td.attr('rowspan', rowspan).attr('colspan', colspan).show();
7827 }
7828 }, {
7829 key: "checkAll",
7830 value: function checkAll() {
7831 this._toggleCheckAll(true);
7832 }
7833 }, {
7834 key: "uncheckAll",
7835 value: function uncheckAll() {
7836 this._toggleCheckAll(false);
7837 }
7838 }, {
7839 key: "_toggleCheckAll",
7840 value: function _toggleCheckAll(checked) {
7841 var rowsBefore = this.getSelections();
7842 this.$selectAll.add(this.$selectAll_).prop('checked', checked);
7843 this.$selectItem.filter(':enabled').prop('checked', checked);
7844 this.updateRows();
7845 this.updateSelected();
7846 var rowsAfter = this.getSelections();
7847
7848 if (checked) {
7849 this.trigger('check-all', rowsAfter, rowsBefore);
7850 return;
7851 }
7852
7853 this.trigger('uncheck-all', rowsAfter, rowsBefore);
7854 }
7855 }, {
7856 key: "checkInvert",
7857 value: function checkInvert() {
7858 var $items = this.$selectItem.filter(':enabled');
7859 var checked = $items.filter(':checked');
7860 $items.each(function (i, el) {
7861 $__default["default"](el).prop('checked', !$__default["default"](el).prop('checked'));
7862 });
7863 this.updateRows();
7864 this.updateSelected();
7865 this.trigger('uncheck-some', checked);
7866 checked = this.getSelections();
7867 this.trigger('check-some', checked);
7868 }
7869 }, {
7870 key: "check",
7871 value: function check(index) {
7872 this._toggleCheck(true, index);
7873 }
7874 }, {
7875 key: "uncheck",
7876 value: function uncheck(index) {
7877 this._toggleCheck(false, index);
7878 }
7879 }, {
7880 key: "_toggleCheck",
7881 value: function _toggleCheck(checked, index) {
7882 var $el = this.$selectItem.filter("[data-index=\"".concat(index, "\"]"));
7883 var row = this.data[index];
7884
7885 if ($el.is(':radio') || this.options.singleSelect || this.options.multipleSelectRow && !this.multipleSelectRowCtrlKey && !this.multipleSelectRowShiftKey) {
7886 var _iterator10 = _createForOfIteratorHelper(this.options.data),
7887 _step10;
7888
7889 try {
7890 for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
7891 var r = _step10.value;
7892 r[this.header.stateField] = false;
7893 }
7894 } catch (err) {
7895 _iterator10.e(err);
7896 } finally {
7897 _iterator10.f();
7898 }
7899
7900 this.$selectItem.filter(':checked').not($el).prop('checked', false);
7901 }
7902
7903 row[this.header.stateField] = checked;
7904
7905 if (this.options.multipleSelectRow) {
7906 if (this.multipleSelectRowShiftKey && this.multipleSelectRowLastSelectedIndex >= 0) {
7907 var _ref8 = this.multipleSelectRowLastSelectedIndex < index ? [this.multipleSelectRowLastSelectedIndex, index] : [index, this.multipleSelectRowLastSelectedIndex],
7908 _ref9 = _slicedToArray(_ref8, 2),
7909 fromIndex = _ref9[0],
7910 toIndex = _ref9[1];
7911
7912 for (var i = fromIndex + 1; i < toIndex; i++) {
7913 this.data[i][this.header.stateField] = true;
7914 this.$selectItem.filter("[data-index=\"".concat(i, "\"]")).prop('checked', true);
7915 }
7916 }
7917
7918 this.multipleSelectRowCtrlKey = false;
7919 this.multipleSelectRowShiftKey = false;
7920 this.multipleSelectRowLastSelectedIndex = checked ? index : -1;
7921 }
7922
7923 $el.prop('checked', checked);
7924 this.updateSelected();
7925 this.trigger(checked ? 'check' : 'uncheck', this.data[index], $el);
7926 }
7927 }, {
7928 key: "checkBy",
7929 value: function checkBy(obj) {
7930 this._toggleCheckBy(true, obj);
7931 }
7932 }, {
7933 key: "uncheckBy",
7934 value: function uncheckBy(obj) {
7935 this._toggleCheckBy(false, obj);
7936 }
7937 }, {
7938 key: "_toggleCheckBy",
7939 value: function _toggleCheckBy(checked, obj) {
7940 var _this24 = this;
7941
7942 if (!obj.hasOwnProperty('field') || !obj.hasOwnProperty('values')) {
7943 return;
7944 }
7945
7946 var rows = [];
7947 this.data.forEach(function (row, i) {
7948 if (!row.hasOwnProperty(obj.field)) {
7949 return false;
7950 }
7951
7952 if (obj.values.includes(row[obj.field])) {
7953 var $el = _this24.$selectItem.filter(':enabled').filter(Utils.sprintf('[data-index="%s"]', i));
7954
7955 var onlyCurrentPage = obj.hasOwnProperty('onlyCurrentPage') ? obj.onlyCurrentPage : false;
7956 $el = checked ? $el.not(':checked') : $el.filter(':checked');
7957
7958 if (!$el.length && onlyCurrentPage) {
7959 return;
7960 }
7961
7962 $el.prop('checked', checked);
7963 row[_this24.header.stateField] = checked;
7964 rows.push(row);
7965
7966 _this24.trigger(checked ? 'check' : 'uncheck', row, $el);
7967 }
7968 });
7969 this.updateSelected();
7970 this.trigger(checked ? 'check-some' : 'uncheck-some', rows);
7971 }
7972 }, {
7973 key: "refresh",
7974 value: function refresh(params) {
7975 if (params && params.url) {
7976 this.options.url = params.url;
7977 }
7978
7979 if (params && params.pageNumber) {
7980 this.options.pageNumber = params.pageNumber;
7981 }
7982
7983 if (params && params.pageSize) {
7984 this.options.pageSize = params.pageSize;
7985 }
7986
7987 this.trigger('refresh', this.initServer(params && params.silent, params && params.query, params && params.url));
7988 }
7989 }, {
7990 key: "destroy",
7991 value: function destroy() {
7992 this.$el.insertBefore(this.$container);
7993 $__default["default"](this.options.toolbar).insertBefore(this.$el);
7994 this.$container.next().remove();
7995 this.$container.remove();
7996 this.$el.html(this.$el_.html()).css('margin-top', '0').attr('class', this.$el_.attr('class') || ''); // reset the class
7997 }
7998 }, {
7999 key: "resetView",
8000 value: function resetView(params) {
8001 var padding = 0;
8002
8003 if (params && params.height) {
8004 this.options.height = params.height;
8005 }
8006
8007 this.$tableContainer.toggleClass('has-card-view', this.options.cardView);
8008
8009 if (this.options.height) {
8010 var fixedBody = this.$tableBody.get(0);
8011 this.hasScrollBar = fixedBody.scrollWidth > fixedBody.clientWidth;
8012 }
8013
8014 if (!this.options.cardView && this.options.showHeader && this.options.height) {
8015 this.$tableHeader.show();
8016 this.resetHeader();
8017 padding += this.$header.outerHeight(true) + 1;
8018 } else {
8019 this.$tableHeader.hide();
8020 this.trigger('post-header');
8021 }
8022
8023 if (!this.options.cardView && this.options.showFooter) {
8024 this.$tableFooter.show();
8025 this.fitFooter();
8026
8027 if (this.options.height) {
8028 padding += this.$tableFooter.outerHeight(true);
8029 }
8030 }
8031
8032 if (this.$container.hasClass('fullscreen')) {
8033 this.$tableContainer.css('height', '');
8034 this.$tableContainer.css('width', '');
8035 } else if (this.options.height) {
8036 if (this.$tableBorder) {
8037 this.$tableBorder.css('width', '');
8038 this.$tableBorder.css('height', '');
8039 }
8040
8041 var toolbarHeight = this.$toolbar.outerHeight(true);
8042 var paginationHeight = this.$pagination.outerHeight(true);
8043 var height = this.options.height - toolbarHeight - paginationHeight;
8044 var $bodyTable = this.$tableBody.find('>table');
8045 var tableHeight = $bodyTable.outerHeight();
8046 this.$tableContainer.css('height', "".concat(height, "px"));
8047
8048 if (this.$tableBorder && $bodyTable.is(':visible')) {
8049 var tableBorderHeight = height - tableHeight - 2;
8050
8051 if (this.hasScrollBar) {
8052 tableBorderHeight -= Utils.getScrollBarWidth();
8053 }
8054
8055 this.$tableBorder.css('width', "".concat($bodyTable.outerWidth(), "px"));
8056 this.$tableBorder.css('height', "".concat(tableBorderHeight, "px"));
8057 }
8058 }
8059
8060 if (this.options.cardView) {
8061 // remove the element css
8062 this.$el.css('margin-top', '0');
8063 this.$tableContainer.css('padding-bottom', '0');
8064 this.$tableFooter.hide();
8065 } else {
8066 // Assign the correct sortable arrow
8067 this.getCaret();
8068 this.$tableContainer.css('padding-bottom', "".concat(padding, "px"));
8069 }
8070
8071 this.trigger('reset-view');
8072 }
8073 }, {
8074 key: "showLoading",
8075 value: function showLoading() {
8076 this.$tableLoading.toggleClass('open', true);
8077 var fontSize = this.options.loadingFontSize;
8078
8079 if (this.options.loadingFontSize === 'auto') {
8080 fontSize = this.$tableLoading.width() * 0.04;
8081 fontSize = Math.max(12, fontSize);
8082 fontSize = Math.min(32, fontSize);
8083 fontSize = "".concat(fontSize, "px");
8084 }
8085
8086 this.$tableLoading.find('.loading-text').css('font-size', fontSize);
8087 }
8088 }, {
8089 key: "hideLoading",
8090 value: function hideLoading() {
8091 this.$tableLoading.toggleClass('open', false);
8092 }
8093 }, {
8094 key: "togglePagination",
8095 value: function togglePagination() {
8096 this.options.pagination = !this.options.pagination;
8097 var icon = this.options.showButtonIcons ? this.options.pagination ? this.options.icons.paginationSwitchDown : this.options.icons.paginationSwitchUp : '';
8098 var text = this.options.showButtonText ? this.options.pagination ? this.options.formatPaginationSwitchUp() : this.options.formatPaginationSwitchDown() : '';
8099 this.$toolbar.find('button[name="paginationSwitch"]').html("".concat(Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, icon), " ").concat(text));
8100 this.updatePagination();
8101 this.trigger('toggle-pagination', this.options.pagination);
8102 }
8103 }, {
8104 key: "toggleFullscreen",
8105 value: function toggleFullscreen() {
8106 this.$el.closest('.bootstrap-table').toggleClass('fullscreen');
8107 this.resetView();
8108 }
8109 }, {
8110 key: "toggleView",
8111 value: function toggleView() {
8112 this.options.cardView = !this.options.cardView;
8113 this.initHeader();
8114 var icon = this.options.showButtonIcons ? this.options.cardView ? this.options.icons.toggleOn : this.options.icons.toggleOff : '';
8115 var text = this.options.showButtonText ? this.options.cardView ? this.options.formatToggleOff() : this.options.formatToggleOn() : '';
8116 this.$toolbar.find('button[name="toggle"]').html("".concat(Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, icon), " ").concat(text));
8117 this.initBody();
8118 this.trigger('toggle', this.options.cardView);
8119 }
8120 }, {
8121 key: "resetSearch",
8122 value: function resetSearch(text) {
8123 var $search = Utils.getSearchInput(this);
8124 var textToUse = text || '';
8125 $search.val(textToUse);
8126 this.searchText = textToUse;
8127 this.onSearch({
8128 currentTarget: $search
8129 }, false);
8130 }
8131 }, {
8132 key: "filterBy",
8133 value: function filterBy(columns, options) {
8134 this.filterOptions = Utils.isEmptyObject(options) ? this.options.filterOptions : $__default["default"].extend(this.options.filterOptions, options);
8135 this.filterColumns = Utils.isEmptyObject(columns) ? {} : columns;
8136 this.options.pageNumber = 1;
8137 this.initSearch();
8138 this.updatePagination();
8139 }
8140 }, {
8141 key: "scrollTo",
8142 value: function scrollTo(params) {
8143 var options = {
8144 unit: 'px',
8145 value: 0
8146 };
8147
8148 if (_typeof(params) === 'object') {
8149 options = Object.assign(options, params);
8150 } else if (typeof params === 'string' && params === 'bottom') {
8151 options.value = this.$tableBody[0].scrollHeight;
8152 } else if (typeof params === 'string' || typeof params === 'number') {
8153 options.value = params;
8154 }
8155
8156 var scrollTo = options.value;
8157
8158 if (options.unit === 'rows') {
8159 scrollTo = 0;
8160 this.$body.find("> tr:lt(".concat(options.value, ")")).each(function (i, el) {
8161 scrollTo += $__default["default"](el).outerHeight(true);
8162 });
8163 }
8164
8165 this.$tableBody.scrollTop(scrollTo);
8166 }
8167 }, {
8168 key: "getScrollPosition",
8169 value: function getScrollPosition() {
8170 return this.$tableBody.scrollTop();
8171 }
8172 }, {
8173 key: "selectPage",
8174 value: function selectPage(page) {
8175 if (page > 0 && page <= this.options.totalPages) {
8176 this.options.pageNumber = page;
8177 this.updatePagination();
8178 }
8179 }
8180 }, {
8181 key: "prevPage",
8182 value: function prevPage() {
8183 if (this.options.pageNumber > 1) {
8184 this.options.pageNumber--;
8185 this.updatePagination();
8186 }
8187 }
8188 }, {
8189 key: "nextPage",
8190 value: function nextPage() {
8191 if (this.options.pageNumber < this.options.totalPages) {
8192 this.options.pageNumber++;
8193 this.updatePagination();
8194 }
8195 }
8196 }, {
8197 key: "toggleDetailView",
8198 value: function toggleDetailView(index, _columnDetailFormatter) {
8199 var $tr = this.$body.find(Utils.sprintf('> tr[data-index="%s"]', index));
8200
8201 if ($tr.next().is('tr.detail-view')) {
8202 this.collapseRow(index);
8203 } else {
8204 this.expandRow(index, _columnDetailFormatter);
8205 }
8206
8207 this.resetView();
8208 }
8209 }, {
8210 key: "expandRow",
8211 value: function expandRow(index, _columnDetailFormatter) {
8212 var row = this.data[index];
8213 var $tr = this.$body.find(Utils.sprintf('> tr[data-index="%s"][data-has-detail-view]', index));
8214
8215 if (this.options.detailViewIcon) {
8216 $tr.find('a.detail-icon').html(Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, this.options.icons.detailClose));
8217 }
8218
8219 if ($tr.next().is('tr.detail-view')) {
8220 return;
8221 }
8222
8223 $tr.after(Utils.sprintf('<tr class="detail-view"><td colspan="%s"></td></tr>', $tr.children('td').length));
8224 var $element = $tr.next().find('td');
8225 var detailFormatter = _columnDetailFormatter || this.options.detailFormatter;
8226 var content = Utils.calculateObjectValue(this.options, detailFormatter, [index, row, $element], '');
8227
8228 if ($element.length === 1) {
8229 $element.append(content);
8230 }
8231
8232 this.trigger('expand-row', index, row, $element);
8233 }
8234 }, {
8235 key: "expandRowByUniqueId",
8236 value: function expandRowByUniqueId(uniqueId) {
8237 var row = this.getRowByUniqueId(uniqueId);
8238
8239 if (!row) {
8240 return;
8241 }
8242
8243 this.expandRow(this.data.indexOf(row));
8244 }
8245 }, {
8246 key: "collapseRow",
8247 value: function collapseRow(index) {
8248 var row = this.data[index];
8249 var $tr = this.$body.find(Utils.sprintf('> tr[data-index="%s"][data-has-detail-view]', index));
8250
8251 if (!$tr.next().is('tr.detail-view')) {
8252 return;
8253 }
8254
8255 if (this.options.detailViewIcon) {
8256 $tr.find('a.detail-icon').html(Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, this.options.icons.detailOpen));
8257 }
8258
8259 this.trigger('collapse-row', index, row, $tr.next());
8260 $tr.next().remove();
8261 }
8262 }, {
8263 key: "collapseRowByUniqueId",
8264 value: function collapseRowByUniqueId(uniqueId) {
8265 var row = this.getRowByUniqueId(uniqueId);
8266
8267 if (!row) {
8268 return;
8269 }
8270
8271 this.collapseRow(this.data.indexOf(row));
8272 }
8273 }, {
8274 key: "expandAllRows",
8275 value: function expandAllRows() {
8276 var trs = this.$body.find('> tr[data-index][data-has-detail-view]');
8277
8278 for (var i = 0; i < trs.length; i++) {
8279 this.expandRow($__default["default"](trs[i]).data('index'));
8280 }
8281 }
8282 }, {
8283 key: "collapseAllRows",
8284 value: function collapseAllRows() {
8285 var trs = this.$body.find('> tr[data-index][data-has-detail-view]');
8286
8287 for (var i = 0; i < trs.length; i++) {
8288 this.collapseRow($__default["default"](trs[i]).data('index'));
8289 }
8290 }
8291 }, {
8292 key: "updateColumnTitle",
8293 value: function updateColumnTitle(params) {
8294 if (!params.hasOwnProperty('field') || !params.hasOwnProperty('title')) {
8295 return;
8296 }
8297
8298 this.columns[this.fieldsColumnsIndex[params.field]].title = this.options.escape ? Utils.escapeHTML(params.title) : params.title;
8299
8300 if (this.columns[this.fieldsColumnsIndex[params.field]].visible) {
8301 this.$header.find('th[data-field]').each(function (i, el) {
8302 if ($__default["default"](el).data('field') === params.field) {
8303 $__default["default"]($__default["default"](el).find('.th-inner')[0]).text(params.title);
8304 return false;
8305 }
8306 });
8307 this.resetView();
8308 }
8309 }
8310 }, {
8311 key: "updateFormatText",
8312 value: function updateFormatText(formatName, text) {
8313 if (!/^format/.test(formatName) || !this.options[formatName]) {
8314 return;
8315 }
8316
8317 if (typeof text === 'string') {
8318 this.options[formatName] = function () {
8319 return text;
8320 };
8321 } else if (typeof text === 'function') {
8322 this.options[formatName] = text;
8323 }
8324
8325 this.initToolbar();
8326 this.initPagination();
8327 this.initBody();
8328 }
8329 }]);
8330
8331 return BootstrapTable;
8332 }();
8333
8334 BootstrapTable.VERSION = Constants.VERSION;
8335 BootstrapTable.DEFAULTS = Constants.DEFAULTS;
8336 BootstrapTable.LOCALES = Constants.LOCALES;
8337 BootstrapTable.COLUMN_DEFAULTS = Constants.COLUMN_DEFAULTS;
8338 BootstrapTable.METHODS = Constants.METHODS;
8339 BootstrapTable.EVENTS = Constants.EVENTS; // BOOTSTRAP TABLE PLUGIN DEFINITION
8340 // =======================
8341
8342 $__default["default"].BootstrapTable = BootstrapTable;
8343
8344 $__default["default"].fn.bootstrapTable = function (option) {
8345 for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key5 = 1; _key5 < _len2; _key5++) {
8346 args[_key5 - 1] = arguments[_key5];
8347 }
8348
8349 var value;
8350 this.each(function (i, el) {
8351 var data = $__default["default"](el).data('bootstrap.table');
8352 var options = $__default["default"].extend({}, BootstrapTable.DEFAULTS, $__default["default"](el).data(), _typeof(option) === 'object' && option);
8353
8354 if (typeof option === 'string') {
8355 var _data2;
8356
8357 if (!Constants.METHODS.includes(option)) {
8358 throw new Error("Unknown method: ".concat(option));
8359 }
8360
8361 if (!data) {
8362 return;
8363 }
8364
8365 value = (_data2 = data)[option].apply(_data2, args);
8366
8367 if (option === 'destroy') {
8368 $__default["default"](el).removeData('bootstrap.table');
8369 }
8370 }
8371
8372 if (!data) {
8373 data = new $__default["default"].BootstrapTable(el, options);
8374 $__default["default"](el).data('bootstrap.table', data);
8375 data.init();
8376 }
8377 });
8378 return typeof value === 'undefined' ? this : value;
8379 };
8380
8381 $__default["default"].fn.bootstrapTable.Constructor = BootstrapTable;
8382 $__default["default"].fn.bootstrapTable.theme = Constants.THEME;
8383 $__default["default"].fn.bootstrapTable.VERSION = Constants.VERSION;
8384 $__default["default"].fn.bootstrapTable.defaults = BootstrapTable.DEFAULTS;
8385 $__default["default"].fn.bootstrapTable.columnDefaults = BootstrapTable.COLUMN_DEFAULTS;
8386 $__default["default"].fn.bootstrapTable.events = BootstrapTable.EVENTS;
8387 $__default["default"].fn.bootstrapTable.locales = BootstrapTable.LOCALES;
8388 $__default["default"].fn.bootstrapTable.methods = BootstrapTable.METHODS;
8389 $__default["default"].fn.bootstrapTable.utils = Utils; // BOOTSTRAP TABLE INIT
8390 // =======================
8391
8392 $__default["default"](function () {
8393 $__default["default"]('[data-toggle="table"]').bootstrapTable();
8394 });
8395
8396 return BootstrapTable;
8397
8398}));