UNPKG

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