UNPKG

79.8 kBJavaScriptView Raw
1(function (global, factory) {
2 typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) :
3 typeof define === 'function' && define.amd ? define(['jquery'], factory) :
4 (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.jQuery));
5}(this, (function ($) { 'use strict';
6
7 function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
9 var $__default = /*#__PURE__*/_interopDefaultLegacy($);
10
11 function _typeof(obj) {
12 "@babel/helpers - typeof";
13
14 if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
15 _typeof = function (obj) {
16 return typeof obj;
17 };
18 } else {
19 _typeof = function (obj) {
20 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
21 };
22 }
23
24 return _typeof(obj);
25 }
26
27 var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
28
29 function createCommonjsModule(fn, module) {
30 return module = { exports: {} }, fn(module, module.exports), module.exports;
31 }
32
33 var check = function (it) {
34 return it && it.Math == Math && it;
35 };
36
37 // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
38 var global_1 =
39 // eslint-disable-next-line es/no-global-this -- safe
40 check(typeof globalThis == 'object' && globalThis) ||
41 check(typeof window == 'object' && window) ||
42 // eslint-disable-next-line no-restricted-globals -- safe
43 check(typeof self == 'object' && self) ||
44 check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
45 // eslint-disable-next-line no-new-func -- fallback
46 (function () { return this; })() || Function('return this')();
47
48 var fails = function (exec) {
49 try {
50 return !!exec();
51 } catch (error) {
52 return true;
53 }
54 };
55
56 // Detect IE8's incomplete defineProperty implementation
57 var descriptors = !fails(function () {
58 // eslint-disable-next-line es/no-object-defineproperty -- required for testing
59 return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
60 });
61
62 var $propertyIsEnumerable = {}.propertyIsEnumerable;
63 // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
64 var getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
65
66 // Nashorn ~ JDK8 bug
67 var NASHORN_BUG = getOwnPropertyDescriptor$1 && !$propertyIsEnumerable.call({ 1: 2 }, 1);
68
69 // `Object.prototype.propertyIsEnumerable` method implementation
70 // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
71 var f$4 = NASHORN_BUG ? function propertyIsEnumerable(V) {
72 var descriptor = getOwnPropertyDescriptor$1(this, V);
73 return !!descriptor && descriptor.enumerable;
74 } : $propertyIsEnumerable;
75
76 var objectPropertyIsEnumerable = {
77 f: f$4
78 };
79
80 var createPropertyDescriptor = function (bitmap, value) {
81 return {
82 enumerable: !(bitmap & 1),
83 configurable: !(bitmap & 2),
84 writable: !(bitmap & 4),
85 value: value
86 };
87 };
88
89 var toString = {}.toString;
90
91 var classofRaw = function (it) {
92 return toString.call(it).slice(8, -1);
93 };
94
95 var split = ''.split;
96
97 // fallback for non-array-like ES3 and non-enumerable old V8 strings
98 var indexedObject = fails(function () {
99 // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
100 // eslint-disable-next-line no-prototype-builtins -- safe
101 return !Object('z').propertyIsEnumerable(0);
102 }) ? function (it) {
103 return classofRaw(it) == 'String' ? split.call(it, '') : Object(it);
104 } : Object;
105
106 // `RequireObjectCoercible` abstract operation
107 // https://tc39.es/ecma262/#sec-requireobjectcoercible
108 var requireObjectCoercible = function (it) {
109 if (it == undefined) throw TypeError("Can't call method on " + it);
110 return it;
111 };
112
113 // toObject with fallback for non-array-like ES3 strings
114
115
116
117 var toIndexedObject = function (it) {
118 return indexedObject(requireObjectCoercible(it));
119 };
120
121 var isObject = function (it) {
122 return typeof it === 'object' ? it !== null : typeof it === 'function';
123 };
124
125 // `ToPrimitive` abstract operation
126 // https://tc39.es/ecma262/#sec-toprimitive
127 // instead of the ES6 spec version, we didn't implement @@toPrimitive case
128 // and the second argument - flag - preferred type is a string
129 var toPrimitive = function (input, PREFERRED_STRING) {
130 if (!isObject(input)) return input;
131 var fn, val;
132 if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
133 if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val;
134 if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
135 throw TypeError("Can't convert object to primitive value");
136 };
137
138 var hasOwnProperty = {}.hasOwnProperty;
139
140 var has$1 = function (it, key) {
141 return hasOwnProperty.call(it, key);
142 };
143
144 var document$1 = global_1.document;
145 // typeof document.createElement is 'object' in old IE
146 var EXISTS = isObject(document$1) && isObject(document$1.createElement);
147
148 var documentCreateElement = function (it) {
149 return EXISTS ? document$1.createElement(it) : {};
150 };
151
152 // Thank's IE8 for his funny defineProperty
153 var ie8DomDefine = !descriptors && !fails(function () {
154 // eslint-disable-next-line es/no-object-defineproperty -- requied for testing
155 return Object.defineProperty(documentCreateElement('div'), 'a', {
156 get: function () { return 7; }
157 }).a != 7;
158 });
159
160 // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
161 var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
162
163 // `Object.getOwnPropertyDescriptor` method
164 // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
165 var f$3 = descriptors ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
166 O = toIndexedObject(O);
167 P = toPrimitive(P, true);
168 if (ie8DomDefine) try {
169 return $getOwnPropertyDescriptor(O, P);
170 } catch (error) { /* empty */ }
171 if (has$1(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]);
172 };
173
174 var objectGetOwnPropertyDescriptor = {
175 f: f$3
176 };
177
178 var anObject = function (it) {
179 if (!isObject(it)) {
180 throw TypeError(String(it) + ' is not an object');
181 } return it;
182 };
183
184 // eslint-disable-next-line es/no-object-defineproperty -- safe
185 var $defineProperty = Object.defineProperty;
186
187 // `Object.defineProperty` method
188 // https://tc39.es/ecma262/#sec-object.defineproperty
189 var f$2 = descriptors ? $defineProperty : function defineProperty(O, P, Attributes) {
190 anObject(O);
191 P = toPrimitive(P, true);
192 anObject(Attributes);
193 if (ie8DomDefine) try {
194 return $defineProperty(O, P, Attributes);
195 } catch (error) { /* empty */ }
196 if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
197 if ('value' in Attributes) O[P] = Attributes.value;
198 return O;
199 };
200
201 var objectDefineProperty = {
202 f: f$2
203 };
204
205 var createNonEnumerableProperty = descriptors ? function (object, key, value) {
206 return objectDefineProperty.f(object, key, createPropertyDescriptor(1, value));
207 } : function (object, key, value) {
208 object[key] = value;
209 return object;
210 };
211
212 var setGlobal = function (key, value) {
213 try {
214 createNonEnumerableProperty(global_1, key, value);
215 } catch (error) {
216 global_1[key] = value;
217 } return value;
218 };
219
220 var SHARED = '__core-js_shared__';
221 var store$1 = global_1[SHARED] || setGlobal(SHARED, {});
222
223 var sharedStore = store$1;
224
225 var functionToString = Function.toString;
226
227 // this helper broken in `3.4.1-3.4.4`, so we can't use `shared` helper
228 if (typeof sharedStore.inspectSource != 'function') {
229 sharedStore.inspectSource = function (it) {
230 return functionToString.call(it);
231 };
232 }
233
234 var inspectSource = sharedStore.inspectSource;
235
236 var WeakMap$1 = global_1.WeakMap;
237
238 var nativeWeakMap = typeof WeakMap$1 === 'function' && /native code/.test(inspectSource(WeakMap$1));
239
240 var shared = createCommonjsModule(function (module) {
241 (module.exports = function (key, value) {
242 return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {});
243 })('versions', []).push({
244 version: '3.10.1',
245 mode: 'global',
246 copyright: '© 2021 Denis Pushkarev (zloirock.ru)'
247 });
248 });
249
250 var id = 0;
251 var postfix = Math.random();
252
253 var uid = function (key) {
254 return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);
255 };
256
257 var keys = shared('keys');
258
259 var sharedKey = function (key) {
260 return keys[key] || (keys[key] = uid(key));
261 };
262
263 var hiddenKeys$1 = {};
264
265 var WeakMap = global_1.WeakMap;
266 var set, get, has;
267
268 var enforce = function (it) {
269 return has(it) ? get(it) : set(it, {});
270 };
271
272 var getterFor = function (TYPE) {
273 return function (it) {
274 var state;
275 if (!isObject(it) || (state = get(it)).type !== TYPE) {
276 throw TypeError('Incompatible receiver, ' + TYPE + ' required');
277 } return state;
278 };
279 };
280
281 if (nativeWeakMap) {
282 var store = sharedStore.state || (sharedStore.state = new WeakMap());
283 var wmget = store.get;
284 var wmhas = store.has;
285 var wmset = store.set;
286 set = function (it, metadata) {
287 metadata.facade = it;
288 wmset.call(store, it, metadata);
289 return metadata;
290 };
291 get = function (it) {
292 return wmget.call(store, it) || {};
293 };
294 has = function (it) {
295 return wmhas.call(store, it);
296 };
297 } else {
298 var STATE = sharedKey('state');
299 hiddenKeys$1[STATE] = true;
300 set = function (it, metadata) {
301 metadata.facade = it;
302 createNonEnumerableProperty(it, STATE, metadata);
303 return metadata;
304 };
305 get = function (it) {
306 return has$1(it, STATE) ? it[STATE] : {};
307 };
308 has = function (it) {
309 return has$1(it, STATE);
310 };
311 }
312
313 var internalState = {
314 set: set,
315 get: get,
316 has: has,
317 enforce: enforce,
318 getterFor: getterFor
319 };
320
321 var redefine = createCommonjsModule(function (module) {
322 var getInternalState = internalState.get;
323 var enforceInternalState = internalState.enforce;
324 var TEMPLATE = String(String).split('String');
325
326 (module.exports = function (O, key, value, options) {
327 var unsafe = options ? !!options.unsafe : false;
328 var simple = options ? !!options.enumerable : false;
329 var noTargetGet = options ? !!options.noTargetGet : false;
330 var state;
331 if (typeof value == 'function') {
332 if (typeof key == 'string' && !has$1(value, 'name')) {
333 createNonEnumerableProperty(value, 'name', key);
334 }
335 state = enforceInternalState(value);
336 if (!state.source) {
337 state.source = TEMPLATE.join(typeof key == 'string' ? key : '');
338 }
339 }
340 if (O === global_1) {
341 if (simple) O[key] = value;
342 else setGlobal(key, value);
343 return;
344 } else if (!unsafe) {
345 delete O[key];
346 } else if (!noTargetGet && O[key]) {
347 simple = true;
348 }
349 if (simple) O[key] = value;
350 else createNonEnumerableProperty(O, key, value);
351 // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
352 })(Function.prototype, 'toString', function toString() {
353 return typeof this == 'function' && getInternalState(this).source || inspectSource(this);
354 });
355 });
356
357 var path = global_1;
358
359 var aFunction$1 = function (variable) {
360 return typeof variable == 'function' ? variable : undefined;
361 };
362
363 var getBuiltIn = function (namespace, method) {
364 return arguments.length < 2 ? aFunction$1(path[namespace]) || aFunction$1(global_1[namespace])
365 : path[namespace] && path[namespace][method] || global_1[namespace] && global_1[namespace][method];
366 };
367
368 var ceil = Math.ceil;
369 var floor = Math.floor;
370
371 // `ToInteger` abstract operation
372 // https://tc39.es/ecma262/#sec-tointeger
373 var toInteger = function (argument) {
374 return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument);
375 };
376
377 var min$2 = Math.min;
378
379 // `ToLength` abstract operation
380 // https://tc39.es/ecma262/#sec-tolength
381 var toLength = function (argument) {
382 return argument > 0 ? min$2(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
383 };
384
385 var max$2 = Math.max;
386 var min$1 = Math.min;
387
388 // Helper for a popular repeating case of the spec:
389 // Let integer be ? ToInteger(index).
390 // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
391 var toAbsoluteIndex = function (index, length) {
392 var integer = toInteger(index);
393 return integer < 0 ? max$2(integer + length, 0) : min$1(integer, length);
394 };
395
396 // `Array.prototype.{ indexOf, includes }` methods implementation
397 var createMethod$2 = function (IS_INCLUDES) {
398 return function ($this, el, fromIndex) {
399 var O = toIndexedObject($this);
400 var length = toLength(O.length);
401 var index = toAbsoluteIndex(fromIndex, length);
402 var value;
403 // Array#includes uses SameValueZero equality algorithm
404 // eslint-disable-next-line no-self-compare -- NaN check
405 if (IS_INCLUDES && el != el) while (length > index) {
406 value = O[index++];
407 // eslint-disable-next-line no-self-compare -- NaN check
408 if (value != value) return true;
409 // Array#indexOf ignores holes, Array#includes - not
410 } else for (;length > index; index++) {
411 if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
412 } return !IS_INCLUDES && -1;
413 };
414 };
415
416 var arrayIncludes = {
417 // `Array.prototype.includes` method
418 // https://tc39.es/ecma262/#sec-array.prototype.includes
419 includes: createMethod$2(true),
420 // `Array.prototype.indexOf` method
421 // https://tc39.es/ecma262/#sec-array.prototype.indexof
422 indexOf: createMethod$2(false)
423 };
424
425 var indexOf = arrayIncludes.indexOf;
426
427
428 var objectKeysInternal = function (object, names) {
429 var O = toIndexedObject(object);
430 var i = 0;
431 var result = [];
432 var key;
433 for (key in O) !has$1(hiddenKeys$1, key) && has$1(O, key) && result.push(key);
434 // Don't enum bug & hidden keys
435 while (names.length > i) if (has$1(O, key = names[i++])) {
436 ~indexOf(result, key) || result.push(key);
437 }
438 return result;
439 };
440
441 // IE8- don't enum bug keys
442 var enumBugKeys = [
443 'constructor',
444 'hasOwnProperty',
445 'isPrototypeOf',
446 'propertyIsEnumerable',
447 'toLocaleString',
448 'toString',
449 'valueOf'
450 ];
451
452 var hiddenKeys = enumBugKeys.concat('length', 'prototype');
453
454 // `Object.getOwnPropertyNames` method
455 // https://tc39.es/ecma262/#sec-object.getownpropertynames
456 // eslint-disable-next-line es/no-object-getownpropertynames -- safe
457 var f$1 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
458 return objectKeysInternal(O, hiddenKeys);
459 };
460
461 var objectGetOwnPropertyNames = {
462 f: f$1
463 };
464
465 // eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
466 var f = Object.getOwnPropertySymbols;
467
468 var objectGetOwnPropertySymbols = {
469 f: f
470 };
471
472 // all object keys, includes non-enumerable and symbols
473 var ownKeys = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
474 var keys = objectGetOwnPropertyNames.f(anObject(it));
475 var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
476 return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
477 };
478
479 var copyConstructorProperties = function (target, source) {
480 var keys = ownKeys(source);
481 var defineProperty = objectDefineProperty.f;
482 var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
483 for (var i = 0; i < keys.length; i++) {
484 var key = keys[i];
485 if (!has$1(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
486 }
487 };
488
489 var replacement = /#|\.prototype\./;
490
491 var isForced = function (feature, detection) {
492 var value = data[normalize(feature)];
493 return value == POLYFILL ? true
494 : value == NATIVE ? false
495 : typeof detection == 'function' ? fails(detection)
496 : !!detection;
497 };
498
499 var normalize = isForced.normalize = function (string) {
500 return String(string).replace(replacement, '.').toLowerCase();
501 };
502
503 var data = isForced.data = {};
504 var NATIVE = isForced.NATIVE = 'N';
505 var POLYFILL = isForced.POLYFILL = 'P';
506
507 var isForced_1 = isForced;
508
509 var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
510
511
512
513
514
515
516 /*
517 options.target - name of the target object
518 options.global - target is the global object
519 options.stat - export as static methods of target
520 options.proto - export as prototype methods of target
521 options.real - real prototype method for the `pure` version
522 options.forced - export even if the native feature is available
523 options.bind - bind methods to the target, required for the `pure` version
524 options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
525 options.unsafe - use the simple assignment of property instead of delete + defineProperty
526 options.sham - add a flag to not completely full polyfills
527 options.enumerable - export as enumerable property
528 options.noTargetGet - prevent calling a getter on target
529 */
530 var _export = function (options, source) {
531 var TARGET = options.target;
532 var GLOBAL = options.global;
533 var STATIC = options.stat;
534 var FORCED, target, key, targetProperty, sourceProperty, descriptor;
535 if (GLOBAL) {
536 target = global_1;
537 } else if (STATIC) {
538 target = global_1[TARGET] || setGlobal(TARGET, {});
539 } else {
540 target = (global_1[TARGET] || {}).prototype;
541 }
542 if (target) for (key in source) {
543 sourceProperty = source[key];
544 if (options.noTargetGet) {
545 descriptor = getOwnPropertyDescriptor(target, key);
546 targetProperty = descriptor && descriptor.value;
547 } else targetProperty = target[key];
548 FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
549 // contained in target
550 if (!FORCED && targetProperty !== undefined) {
551 if (typeof sourceProperty === typeof targetProperty) continue;
552 copyConstructorProperties(sourceProperty, targetProperty);
553 }
554 // add a flag to not completely full polyfills
555 if (options.sham || (targetProperty && targetProperty.sham)) {
556 createNonEnumerableProperty(sourceProperty, 'sham', true);
557 }
558 // extend global
559 redefine(target, key, sourceProperty, options);
560 }
561 };
562
563 var aFunction = function (it) {
564 if (typeof it != 'function') {
565 throw TypeError(String(it) + ' is not a function');
566 } return it;
567 };
568
569 // optional / simple context binding
570 var functionBindContext = function (fn, that, length) {
571 aFunction(fn);
572 if (that === undefined) return fn;
573 switch (length) {
574 case 0: return function () {
575 return fn.call(that);
576 };
577 case 1: return function (a) {
578 return fn.call(that, a);
579 };
580 case 2: return function (a, b) {
581 return fn.call(that, a, b);
582 };
583 case 3: return function (a, b, c) {
584 return fn.call(that, a, b, c);
585 };
586 }
587 return function (/* ...args */) {
588 return fn.apply(that, arguments);
589 };
590 };
591
592 // `ToObject` abstract operation
593 // https://tc39.es/ecma262/#sec-toobject
594 var toObject = function (argument) {
595 return Object(requireObjectCoercible(argument));
596 };
597
598 // `IsArray` abstract operation
599 // https://tc39.es/ecma262/#sec-isarray
600 // eslint-disable-next-line es/no-array-isarray -- safe
601 var isArray = Array.isArray || function isArray(arg) {
602 return classofRaw(arg) == 'Array';
603 };
604
605 var engineIsNode = classofRaw(global_1.process) == 'process';
606
607 var engineUserAgent = getBuiltIn('navigator', 'userAgent') || '';
608
609 var process = global_1.process;
610 var versions = process && process.versions;
611 var v8 = versions && versions.v8;
612 var match, version;
613
614 if (v8) {
615 match = v8.split('.');
616 version = match[0] + match[1];
617 } else if (engineUserAgent) {
618 match = engineUserAgent.match(/Edge\/(\d+)/);
619 if (!match || match[1] >= 74) {
620 match = engineUserAgent.match(/Chrome\/(\d+)/);
621 if (match) version = match[1];
622 }
623 }
624
625 var engineV8Version = version && +version;
626
627 // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
628 var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () {
629 // eslint-disable-next-line es/no-symbol -- required for testing
630 return !Symbol.sham &&
631 // Chrome 38 Symbol has incorrect toString conversion
632 // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
633 (engineIsNode ? engineV8Version === 38 : engineV8Version > 37 && engineV8Version < 41);
634 });
635
636 /* eslint-disable es/no-symbol -- required for testing */
637
638
639 var useSymbolAsUid = nativeSymbol
640 && !Symbol.sham
641 && typeof Symbol.iterator == 'symbol';
642
643 var WellKnownSymbolsStore = shared('wks');
644 var Symbol$1 = global_1.Symbol;
645 var createWellKnownSymbol = useSymbolAsUid ? Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid;
646
647 var wellKnownSymbol = function (name) {
648 if (!has$1(WellKnownSymbolsStore, name) || !(nativeSymbol || typeof WellKnownSymbolsStore[name] == 'string')) {
649 if (nativeSymbol && has$1(Symbol$1, name)) {
650 WellKnownSymbolsStore[name] = Symbol$1[name];
651 } else {
652 WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name);
653 }
654 } return WellKnownSymbolsStore[name];
655 };
656
657 var SPECIES$2 = wellKnownSymbol('species');
658
659 // `ArraySpeciesCreate` abstract operation
660 // https://tc39.es/ecma262/#sec-arrayspeciescreate
661 var arraySpeciesCreate = function (originalArray, length) {
662 var C;
663 if (isArray(originalArray)) {
664 C = originalArray.constructor;
665 // cross-realm fallback
666 if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;
667 else if (isObject(C)) {
668 C = C[SPECIES$2];
669 if (C === null) C = undefined;
670 }
671 } return new (C === undefined ? Array : C)(length === 0 ? 0 : length);
672 };
673
674 var push = [].push;
675
676 // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterOut }` methods implementation
677 var createMethod$1 = function (TYPE) {
678 var IS_MAP = TYPE == 1;
679 var IS_FILTER = TYPE == 2;
680 var IS_SOME = TYPE == 3;
681 var IS_EVERY = TYPE == 4;
682 var IS_FIND_INDEX = TYPE == 6;
683 var IS_FILTER_OUT = TYPE == 7;
684 var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
685 return function ($this, callbackfn, that, specificCreate) {
686 var O = toObject($this);
687 var self = indexedObject(O);
688 var boundFunction = functionBindContext(callbackfn, that, 3);
689 var length = toLength(self.length);
690 var index = 0;
691 var create = specificCreate || arraySpeciesCreate;
692 var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_OUT ? create($this, 0) : undefined;
693 var value, result;
694 for (;length > index; index++) if (NO_HOLES || index in self) {
695 value = self[index];
696 result = boundFunction(value, index, O);
697 if (TYPE) {
698 if (IS_MAP) target[index] = result; // map
699 else if (result) switch (TYPE) {
700 case 3: return true; // some
701 case 5: return value; // find
702 case 6: return index; // findIndex
703 case 2: push.call(target, value); // filter
704 } else switch (TYPE) {
705 case 4: return false; // every
706 case 7: push.call(target, value); // filterOut
707 }
708 }
709 }
710 return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
711 };
712 };
713
714 var arrayIteration = {
715 // `Array.prototype.forEach` method
716 // https://tc39.es/ecma262/#sec-array.prototype.foreach
717 forEach: createMethod$1(0),
718 // `Array.prototype.map` method
719 // https://tc39.es/ecma262/#sec-array.prototype.map
720 map: createMethod$1(1),
721 // `Array.prototype.filter` method
722 // https://tc39.es/ecma262/#sec-array.prototype.filter
723 filter: createMethod$1(2),
724 // `Array.prototype.some` method
725 // https://tc39.es/ecma262/#sec-array.prototype.some
726 some: createMethod$1(3),
727 // `Array.prototype.every` method
728 // https://tc39.es/ecma262/#sec-array.prototype.every
729 every: createMethod$1(4),
730 // `Array.prototype.find` method
731 // https://tc39.es/ecma262/#sec-array.prototype.find
732 find: createMethod$1(5),
733 // `Array.prototype.findIndex` method
734 // https://tc39.es/ecma262/#sec-array.prototype.findIndex
735 findIndex: createMethod$1(6),
736 // `Array.prototype.filterOut` method
737 // https://github.com/tc39/proposal-array-filtering
738 filterOut: createMethod$1(7)
739 };
740
741 // `Object.keys` method
742 // https://tc39.es/ecma262/#sec-object.keys
743 // eslint-disable-next-line es/no-object-keys -- safe
744 var objectKeys = Object.keys || function keys(O) {
745 return objectKeysInternal(O, enumBugKeys);
746 };
747
748 // `Object.defineProperties` method
749 // https://tc39.es/ecma262/#sec-object.defineproperties
750 // eslint-disable-next-line es/no-object-defineproperties -- safe
751 var objectDefineProperties = descriptors ? Object.defineProperties : function defineProperties(O, Properties) {
752 anObject(O);
753 var keys = objectKeys(Properties);
754 var length = keys.length;
755 var index = 0;
756 var key;
757 while (length > index) objectDefineProperty.f(O, key = keys[index++], Properties[key]);
758 return O;
759 };
760
761 var html = getBuiltIn('document', 'documentElement');
762
763 var GT = '>';
764 var LT = '<';
765 var PROTOTYPE = 'prototype';
766 var SCRIPT = 'script';
767 var IE_PROTO = sharedKey('IE_PROTO');
768
769 var EmptyConstructor = function () { /* empty */ };
770
771 var scriptTag = function (content) {
772 return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
773 };
774
775 // Create object with fake `null` prototype: use ActiveX Object with cleared prototype
776 var NullProtoObjectViaActiveX = function (activeXDocument) {
777 activeXDocument.write(scriptTag(''));
778 activeXDocument.close();
779 var temp = activeXDocument.parentWindow.Object;
780 activeXDocument = null; // avoid memory leak
781 return temp;
782 };
783
784 // Create object with fake `null` prototype: use iframe Object with cleared prototype
785 var NullProtoObjectViaIFrame = function () {
786 // Thrash, waste and sodomy: IE GC bug
787 var iframe = documentCreateElement('iframe');
788 var JS = 'java' + SCRIPT + ':';
789 var iframeDocument;
790 iframe.style.display = 'none';
791 html.appendChild(iframe);
792 // https://github.com/zloirock/core-js/issues/475
793 iframe.src = String(JS);
794 iframeDocument = iframe.contentWindow.document;
795 iframeDocument.open();
796 iframeDocument.write(scriptTag('document.F=Object'));
797 iframeDocument.close();
798 return iframeDocument.F;
799 };
800
801 // Check for document.domain and active x support
802 // No need to use active x approach when document.domain is not set
803 // see https://github.com/es-shims/es5-shim/issues/150
804 // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
805 // avoid IE GC bug
806 var activeXDocument;
807 var NullProtoObject = function () {
808 try {
809 /* global ActiveXObject -- old IE */
810 activeXDocument = document.domain && new ActiveXObject('htmlfile');
811 } catch (error) { /* ignore */ }
812 NullProtoObject = activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame();
813 var length = enumBugKeys.length;
814 while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
815 return NullProtoObject();
816 };
817
818 hiddenKeys$1[IE_PROTO] = true;
819
820 // `Object.create` method
821 // https://tc39.es/ecma262/#sec-object.create
822 var objectCreate = Object.create || function create(O, Properties) {
823 var result;
824 if (O !== null) {
825 EmptyConstructor[PROTOTYPE] = anObject(O);
826 result = new EmptyConstructor();
827 EmptyConstructor[PROTOTYPE] = null;
828 // add "__proto__" for Object.getPrototypeOf polyfill
829 result[IE_PROTO] = O;
830 } else result = NullProtoObject();
831 return Properties === undefined ? result : objectDefineProperties(result, Properties);
832 };
833
834 var UNSCOPABLES = wellKnownSymbol('unscopables');
835 var ArrayPrototype = Array.prototype;
836
837 // Array.prototype[@@unscopables]
838 // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
839 if (ArrayPrototype[UNSCOPABLES] == undefined) {
840 objectDefineProperty.f(ArrayPrototype, UNSCOPABLES, {
841 configurable: true,
842 value: objectCreate(null)
843 });
844 }
845
846 // add a key to Array.prototype[@@unscopables]
847 var addToUnscopables = function (key) {
848 ArrayPrototype[UNSCOPABLES][key] = true;
849 };
850
851 var $find = arrayIteration.find;
852
853
854 var FIND = 'find';
855 var SKIPS_HOLES = true;
856
857 // Shouldn't skip holes
858 if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });
859
860 // `Array.prototype.find` method
861 // https://tc39.es/ecma262/#sec-array.prototype.find
862 _export({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
863 find: function find(callbackfn /* , that = undefined */) {
864 return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
865 }
866 });
867
868 // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
869 addToUnscopables(FIND);
870
871 var SPECIES$1 = wellKnownSymbol('species');
872
873 var arrayMethodHasSpeciesSupport = function (METHOD_NAME) {
874 // We can't use this feature detection in V8 since it causes
875 // deoptimization and serious performance degradation
876 // https://github.com/zloirock/core-js/issues/677
877 return engineV8Version >= 51 || !fails(function () {
878 var array = [];
879 var constructor = array.constructor = {};
880 constructor[SPECIES$1] = function () {
881 return { foo: 1 };
882 };
883 return array[METHOD_NAME](Boolean).foo !== 1;
884 });
885 };
886
887 var $map = arrayIteration.map;
888
889
890 var HAS_SPECIES_SUPPORT$2 = arrayMethodHasSpeciesSupport('map');
891
892 // `Array.prototype.map` method
893 // https://tc39.es/ecma262/#sec-array.prototype.map
894 // with adding support of @@species
895 _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$2 }, {
896 map: function map(callbackfn /* , thisArg */) {
897 return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
898 }
899 });
900
901 var arrayMethodIsStrict = function (METHOD_NAME, argument) {
902 var method = [][METHOD_NAME];
903 return !!method && fails(function () {
904 // eslint-disable-next-line no-useless-call,no-throw-literal -- required for testing
905 method.call(null, argument || function () { throw 1; }, 1);
906 });
907 };
908
909 var test$1 = [];
910 var nativeSort = test$1.sort;
911
912 // IE8-
913 var FAILS_ON_UNDEFINED = fails(function () {
914 test$1.sort(undefined);
915 });
916 // V8 bug
917 var FAILS_ON_NULL = fails(function () {
918 test$1.sort(null);
919 });
920 // Old WebKit
921 var STRICT_METHOD$1 = arrayMethodIsStrict('sort');
922
923 var FORCED$2 = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD$1;
924
925 // `Array.prototype.sort` method
926 // https://tc39.es/ecma262/#sec-array.prototype.sort
927 _export({ target: 'Array', proto: true, forced: FORCED$2 }, {
928 sort: function sort(comparefn) {
929 return comparefn === undefined
930 ? nativeSort.call(toObject(this))
931 : nativeSort.call(toObject(this), aFunction(comparefn));
932 }
933 });
934
935 var createProperty = function (object, key, value) {
936 var propertyKey = toPrimitive(key);
937 if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value));
938 else object[propertyKey] = value;
939 };
940
941 var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
942 var MAX_SAFE_INTEGER$1 = 0x1FFFFFFFFFFFFF;
943 var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';
944
945 // We can't use this feature detection in V8 since it causes
946 // deoptimization and serious performance degradation
947 // https://github.com/zloirock/core-js/issues/679
948 var IS_CONCAT_SPREADABLE_SUPPORT = engineV8Version >= 51 || !fails(function () {
949 var array = [];
950 array[IS_CONCAT_SPREADABLE] = false;
951 return array.concat()[0] !== array;
952 });
953
954 var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
955
956 var isConcatSpreadable = function (O) {
957 if (!isObject(O)) return false;
958 var spreadable = O[IS_CONCAT_SPREADABLE];
959 return spreadable !== undefined ? !!spreadable : isArray(O);
960 };
961
962 var FORCED$1 = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
963
964 // `Array.prototype.concat` method
965 // https://tc39.es/ecma262/#sec-array.prototype.concat
966 // with adding support of @@isConcatSpreadable and @@species
967 _export({ target: 'Array', proto: true, forced: FORCED$1 }, {
968 // eslint-disable-next-line no-unused-vars -- required for `.length`
969 concat: function concat(arg) {
970 var O = toObject(this);
971 var A = arraySpeciesCreate(O, 0);
972 var n = 0;
973 var i, k, length, len, E;
974 for (i = -1, length = arguments.length; i < length; i++) {
975 E = i === -1 ? O : arguments[i];
976 if (isConcatSpreadable(E)) {
977 len = toLength(E.length);
978 if (n + len > MAX_SAFE_INTEGER$1) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
979 for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
980 } else {
981 if (n >= MAX_SAFE_INTEGER$1) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
982 createProperty(A, n++, E);
983 }
984 }
985 A.length = n;
986 return A;
987 }
988 });
989
990 // eslint-disable-next-line es/no-object-assign -- safe
991 var $assign = Object.assign;
992 // eslint-disable-next-line es/no-object-defineproperty -- required for testing
993 var defineProperty = Object.defineProperty;
994
995 // `Object.assign` method
996 // https://tc39.es/ecma262/#sec-object.assign
997 var objectAssign = !$assign || fails(function () {
998 // should have correct order of operations (Edge bug)
999 if (descriptors && $assign({ b: 1 }, $assign(defineProperty({}, 'a', {
1000 enumerable: true,
1001 get: function () {
1002 defineProperty(this, 'b', {
1003 value: 3,
1004 enumerable: false
1005 });
1006 }
1007 }), { b: 2 })).b !== 1) return true;
1008 // should work with symbols and should have deterministic property order (V8 bug)
1009 var A = {};
1010 var B = {};
1011 // eslint-disable-next-line es/no-symbol -- safe
1012 var symbol = Symbol();
1013 var alphabet = 'abcdefghijklmnopqrst';
1014 A[symbol] = 7;
1015 alphabet.split('').forEach(function (chr) { B[chr] = chr; });
1016 return $assign({}, A)[symbol] != 7 || objectKeys($assign({}, B)).join('') != alphabet;
1017 }) ? function assign(target, source) { // eslint-disable-line no-unused-vars -- required for `.length`
1018 var T = toObject(target);
1019 var argumentsLength = arguments.length;
1020 var index = 1;
1021 var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
1022 var propertyIsEnumerable = objectPropertyIsEnumerable.f;
1023 while (argumentsLength > index) {
1024 var S = indexedObject(arguments[index++]);
1025 var keys = getOwnPropertySymbols ? objectKeys(S).concat(getOwnPropertySymbols(S)) : objectKeys(S);
1026 var length = keys.length;
1027 var j = 0;
1028 var key;
1029 while (length > j) {
1030 key = keys[j++];
1031 if (!descriptors || propertyIsEnumerable.call(S, key)) T[key] = S[key];
1032 }
1033 } return T;
1034 } : $assign;
1035
1036 // `Object.assign` method
1037 // https://tc39.es/ecma262/#sec-object.assign
1038 // eslint-disable-next-line es/no-object-assign -- required for testing
1039 _export({ target: 'Object', stat: true, forced: Object.assign !== objectAssign }, {
1040 assign: objectAssign
1041 });
1042
1043 var HAS_SPECIES_SUPPORT$1 = arrayMethodHasSpeciesSupport('slice');
1044
1045 var SPECIES = wellKnownSymbol('species');
1046 var nativeSlice = [].slice;
1047 var max$1 = Math.max;
1048
1049 // `Array.prototype.slice` method
1050 // https://tc39.es/ecma262/#sec-array.prototype.slice
1051 // fallback for not array-like ES3 strings and DOM objects
1052 _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$1 }, {
1053 slice: function slice(start, end) {
1054 var O = toIndexedObject(this);
1055 var length = toLength(O.length);
1056 var k = toAbsoluteIndex(start, length);
1057 var fin = toAbsoluteIndex(end === undefined ? length : end, length);
1058 // inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible
1059 var Constructor, result, n;
1060 if (isArray(O)) {
1061 Constructor = O.constructor;
1062 // cross-realm fallback
1063 if (typeof Constructor == 'function' && (Constructor === Array || isArray(Constructor.prototype))) {
1064 Constructor = undefined;
1065 } else if (isObject(Constructor)) {
1066 Constructor = Constructor[SPECIES];
1067 if (Constructor === null) Constructor = undefined;
1068 }
1069 if (Constructor === Array || Constructor === undefined) {
1070 return nativeSlice.call(O, k, fin);
1071 }
1072 }
1073 result = new (Constructor === undefined ? Array : Constructor)(max$1(fin - k, 0));
1074 for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]);
1075 result.length = n;
1076 return result;
1077 }
1078 });
1079
1080 var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('splice');
1081
1082 var max = Math.max;
1083 var min = Math.min;
1084 var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
1085 var MAXIMUM_ALLOWED_LENGTH_EXCEEDED = 'Maximum allowed length exceeded';
1086
1087 // `Array.prototype.splice` method
1088 // https://tc39.es/ecma262/#sec-array.prototype.splice
1089 // with adding support of @@species
1090 _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
1091 splice: function splice(start, deleteCount /* , ...items */) {
1092 var O = toObject(this);
1093 var len = toLength(O.length);
1094 var actualStart = toAbsoluteIndex(start, len);
1095 var argumentsLength = arguments.length;
1096 var insertCount, actualDeleteCount, A, k, from, to;
1097 if (argumentsLength === 0) {
1098 insertCount = actualDeleteCount = 0;
1099 } else if (argumentsLength === 1) {
1100 insertCount = 0;
1101 actualDeleteCount = len - actualStart;
1102 } else {
1103 insertCount = argumentsLength - 2;
1104 actualDeleteCount = min(max(toInteger(deleteCount), 0), len - actualStart);
1105 }
1106 if (len + insertCount - actualDeleteCount > MAX_SAFE_INTEGER) {
1107 throw TypeError(MAXIMUM_ALLOWED_LENGTH_EXCEEDED);
1108 }
1109 A = arraySpeciesCreate(O, actualDeleteCount);
1110 for (k = 0; k < actualDeleteCount; k++) {
1111 from = actualStart + k;
1112 if (from in O) createProperty(A, k, O[from]);
1113 }
1114 A.length = actualDeleteCount;
1115 if (insertCount < actualDeleteCount) {
1116 for (k = actualStart; k < len - actualDeleteCount; k++) {
1117 from = k + actualDeleteCount;
1118 to = k + insertCount;
1119 if (from in O) O[to] = O[from];
1120 else delete O[to];
1121 }
1122 for (k = len; k > len - actualDeleteCount + insertCount; k--) delete O[k - 1];
1123 } else if (insertCount > actualDeleteCount) {
1124 for (k = len - actualDeleteCount; k > actualStart; k--) {
1125 from = k + actualDeleteCount - 1;
1126 to = k + insertCount - 1;
1127 if (from in O) O[to] = O[from];
1128 else delete O[to];
1129 }
1130 }
1131 for (k = 0; k < insertCount; k++) {
1132 O[k + actualStart] = arguments[k + 2];
1133 }
1134 O.length = len - actualDeleteCount + insertCount;
1135 return A;
1136 }
1137 });
1138
1139 /* eslint-disable es/no-array-prototype-indexof -- required for testing */
1140
1141 var $indexOf = arrayIncludes.indexOf;
1142
1143
1144 var nativeIndexOf = [].indexOf;
1145
1146 var NEGATIVE_ZERO = !!nativeIndexOf && 1 / [1].indexOf(1, -0) < 0;
1147 var STRICT_METHOD = arrayMethodIsStrict('indexOf');
1148
1149 // `Array.prototype.indexOf` method
1150 // https://tc39.es/ecma262/#sec-array.prototype.indexof
1151 _export({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || !STRICT_METHOD }, {
1152 indexOf: function indexOf(searchElement /* , fromIndex = 0 */) {
1153 return NEGATIVE_ZERO
1154 // convert -0 to +0
1155 ? nativeIndexOf.apply(this, arguments) || 0
1156 : $indexOf(this, searchElement, arguments.length > 1 ? arguments[1] : undefined);
1157 }
1158 });
1159
1160 // a string of all valid unicode whitespaces
1161 var whitespaces = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' +
1162 '\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
1163
1164 var whitespace = '[' + whitespaces + ']';
1165 var ltrim = RegExp('^' + whitespace + whitespace + '*');
1166 var rtrim = RegExp(whitespace + whitespace + '*$');
1167
1168 // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
1169 var createMethod = function (TYPE) {
1170 return function ($this) {
1171 var string = String(requireObjectCoercible($this));
1172 if (TYPE & 1) string = string.replace(ltrim, '');
1173 if (TYPE & 2) string = string.replace(rtrim, '');
1174 return string;
1175 };
1176 };
1177
1178 var stringTrim = {
1179 // `String.prototype.{ trimLeft, trimStart }` methods
1180 // https://tc39.es/ecma262/#sec-string.prototype.trimstart
1181 start: createMethod(1),
1182 // `String.prototype.{ trimRight, trimEnd }` methods
1183 // https://tc39.es/ecma262/#sec-string.prototype.trimend
1184 end: createMethod(2),
1185 // `String.prototype.trim` method
1186 // https://tc39.es/ecma262/#sec-string.prototype.trim
1187 trim: createMethod(3)
1188 };
1189
1190 var trim = stringTrim.trim;
1191
1192
1193 var $parseFloat = global_1.parseFloat;
1194 var FORCED = 1 / $parseFloat(whitespaces + '-0') !== -Infinity;
1195
1196 // `parseFloat` method
1197 // https://tc39.es/ecma262/#sec-parsefloat-string
1198 var numberParseFloat = FORCED ? function parseFloat(string) {
1199 var trimmedString = trim(String(string));
1200 var result = $parseFloat(trimmedString);
1201 return result === 0 && trimmedString.charAt(0) == '-' ? -0 : result;
1202 } : $parseFloat;
1203
1204 // `parseFloat` method
1205 // https://tc39.es/ecma262/#sec-parsefloat-string
1206 _export({ global: true, forced: parseFloat != numberParseFloat }, {
1207 parseFloat: numberParseFloat
1208 });
1209
1210 var TO_STRING_TAG$1 = wellKnownSymbol('toStringTag');
1211 var test = {};
1212
1213 test[TO_STRING_TAG$1] = 'z';
1214
1215 var toStringTagSupport = String(test) === '[object z]';
1216
1217 var TO_STRING_TAG = wellKnownSymbol('toStringTag');
1218 // ES3 wrong here
1219 var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
1220
1221 // fallback for IE11 Script Access Denied error
1222 var tryGet = function (it, key) {
1223 try {
1224 return it[key];
1225 } catch (error) { /* empty */ }
1226 };
1227
1228 // getting tag from ES6+ `Object.prototype.toString`
1229 var classof = toStringTagSupport ? classofRaw : function (it) {
1230 var O, tag, result;
1231 return it === undefined ? 'Undefined' : it === null ? 'Null'
1232 // @@toStringTag case
1233 : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG)) == 'string' ? tag
1234 // builtinTag case
1235 : CORRECT_ARGUMENTS ? classofRaw(O)
1236 // ES3 arguments fallback
1237 : (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result;
1238 };
1239
1240 // `Object.prototype.toString` method implementation
1241 // https://tc39.es/ecma262/#sec-object.prototype.tostring
1242 var objectToString = toStringTagSupport ? {}.toString : function toString() {
1243 return '[object ' + classof(this) + ']';
1244 };
1245
1246 // `Object.prototype.toString` method
1247 // https://tc39.es/ecma262/#sec-object.prototype.tostring
1248 if (!toStringTagSupport) {
1249 redefine(Object.prototype, 'toString', objectToString, { unsafe: true });
1250 }
1251
1252 // `RegExp.prototype.flags` getter implementation
1253 // https://tc39.es/ecma262/#sec-get-regexp.prototype.flags
1254 var regexpFlags = function () {
1255 var that = anObject(this);
1256 var result = '';
1257 if (that.global) result += 'g';
1258 if (that.ignoreCase) result += 'i';
1259 if (that.multiline) result += 'm';
1260 if (that.dotAll) result += 's';
1261 if (that.unicode) result += 'u';
1262 if (that.sticky) result += 'y';
1263 return result;
1264 };
1265
1266 var TO_STRING = 'toString';
1267 var RegExpPrototype = RegExp.prototype;
1268 var nativeToString = RegExpPrototype[TO_STRING];
1269
1270 var NOT_GENERIC = fails(function () { return nativeToString.call({ source: 'a', flags: 'b' }) != '/a/b'; });
1271 // FF44- RegExp#toString has a wrong name
1272 var INCORRECT_NAME = nativeToString.name != TO_STRING;
1273
1274 // `RegExp.prototype.toString` method
1275 // https://tc39.es/ecma262/#sec-regexp.prototype.tostring
1276 if (NOT_GENERIC || INCORRECT_NAME) {
1277 redefine(RegExp.prototype, TO_STRING, function toString() {
1278 var R = anObject(this);
1279 var p = String(R.source);
1280 var rf = R.flags;
1281 var f = String(rf === undefined && R instanceof RegExp && !('flags' in RegExpPrototype) ? regexpFlags.call(R) : rf);
1282 return '/' + p + '/' + f;
1283 }, { unsafe: true });
1284 }
1285
1286 /**
1287 * @author Nadim Basalamah <dimbslmh@gmail.com>
1288 * @version: v1.1.0
1289 * https://github.com/dimbslmh/bootstrap-table/tree/master/src/extensions/multiple-sort/bootstrap-table-multiple-sort.js
1290 * Modification: ErwannNevou <https://github.com/ErwannNevou>
1291 */
1292
1293 var isSingleSort = false;
1294 var Utils = $__default['default'].fn.bootstrapTable.utils;
1295 $__default['default'].extend($__default['default'].fn.bootstrapTable.defaults.icons, {
1296 plus: {
1297 bootstrap3: 'glyphicon-plus',
1298 bootstrap4: 'fa-plus',
1299 bootstrap5: 'bi-plus',
1300 semantic: 'fa-plus',
1301 materialize: 'plus',
1302 foundation: 'fa-plus',
1303 bulma: 'fa-plus',
1304 'bootstrap-table': 'icon-plus'
1305 }[$__default['default'].fn.bootstrapTable.theme] || 'fa-clock',
1306 minus: {
1307 bootstrap3: 'glyphicon-minus',
1308 bootstrap4: 'fa-minus',
1309 bootstrap5: 'bi-dash',
1310 semantic: 'fa-minus',
1311 materialize: 'minus',
1312 foundation: 'fa-minus',
1313 bulma: 'fa-minus',
1314 'bootstrap-table': 'icon-minus'
1315 }[$__default['default'].fn.bootstrapTable.theme] || 'fa-clock',
1316 sort: {
1317 bootstrap3: 'glyphicon-sort',
1318 bootstrap4: 'fa-sort',
1319 bootstrap5: 'bi-arrow-down-up',
1320 semantic: 'fa-sort',
1321 materialize: 'sort',
1322 foundation: 'fa-sort',
1323 bulma: 'fa-sort',
1324 'bootstrap-table': 'icon-sort-amount-asc'
1325 }[$__default['default'].fn.bootstrapTable.theme] || 'fa-clock'
1326 });
1327 var theme = {
1328 bootstrap3: {
1329 html: {
1330 multipleSortModal: "\n <div class=\"modal fade\" id=\"%s\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"%sLabel\" aria-hidden=\"true\">\n <div class=\"modal-dialog\">\n <div class=\"modal-content\">\n <div class=\"modal-header\">\n <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-label=\"Close\"><span aria-hidden=\"true\">&times;</span></button>\n <h4 class=\"modal-title\" id=\"%sLabel\">%s</h4>\n </div>\n <div class=\"modal-body\">\n <div class=\"bootstrap-table\">\n <div class=\"fixed-table-toolbar\">\n <div class=\"bars\">\n <div id=\"toolbar\">\n <button id=\"add\" type=\"button\" class=\"btn btn-default\">%s %s</button>\n <button id=\"delete\" type=\"button\" class=\"btn btn-default\" disabled>%s %s</button>\n </div>\n </div>\n </div>\n <div class=\"fixed-table-container\">\n <table id=\"multi-sort\" class=\"table\">\n <thead>\n <tr>\n <th></th>\n <th><div class=\"th-inner\">%s</div></th>\n <th><div class=\"th-inner\">%s</div></th>\n </tr>\n </thead>\n <tbody></tbody>\n </table>\n </div>\n </div>\n </div>\n <div class=\"modal-footer\">\n <button type=\"button\" class=\"btn btn-default\" data-dismiss=\"modal\">%s</button>\n <button type=\"button\" class=\"btn btn-primary multi-sort-order-button\">%s</button>\n </div>\n </div>\n </div>\n </div>\n ",
1331 multipleSortButton: '<button class="multi-sort %s" type="button" data-toggle="modal" data-target="#%s" title="%s">%s</button>',
1332 multipleSortSelect: '<select class="%s %s form-control">'
1333 }
1334 },
1335 bootstrap4: {
1336 html: {
1337 multipleSortModal: "\n <div class=\"modal fade\" id=\"%s\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"%sLabel\" aria-hidden=\"true\">\n <div class=\"modal-dialog\" role=\"document\">\n <div class=\"modal-content\">\n <div class=\"modal-header\">\n <h5 class=\"modal-title\" id=\"%sLabel\">%s</h5>\n <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-label=\"Close\">\n <span aria-hidden=\"true\">&times;</span>\n </button>\n </div>\n <div class=\"modal-body\">\n <div class=\"bootstrap-table\">\n <div class=\"fixed-table-toolbar\">\n <div class=\"bars\">\n <div id=\"toolbar\" class=\"pb-3\">\n <button id=\"add\" type=\"button\" class=\"btn btn-secondary\">%s %s</button>\n <button id=\"delete\" type=\"button\" class=\"btn btn-secondary\" disabled>%s %s</button>\n </div>\n </div>\n </div>\n <div class=\"fixed-table-container\">\n <table id=\"multi-sort\" class=\"table\">\n <thead>\n <tr>\n <th></th>\n <th><div class=\"th-inner\">%s</div></th>\n <th><div class=\"th-inner\">%s</div></th>\n </tr>\n </thead>\n <tbody></tbody>\n </table>\n </div>\n </div>\n </div>\n <div class=\"modal-footer\">\n <button type=\"button\" class=\"btn btn-secondary\" data-dismiss=\"modal\">%s</button>\n <button type=\"button\" class=\"btn btn-primary multi-sort-order-button\">%s</button>\n </div>\n </div>\n </div>\n </div>\n ",
1338 multipleSortButton: '<button class="multi-sort %s" type="button" data-toggle="modal" data-target="#%s" title="%s">%s</button>',
1339 multipleSortSelect: '<select class="%s %s form-control">'
1340 }
1341 },
1342 bootstrap5: {
1343 html: {
1344 multipleSortModal: "\n <div class=\"modal fade\" id=\"%s\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"%sLabel\" aria-hidden=\"true\">\n <div class=\"modal-dialog\" role=\"document\">\n <div class=\"modal-content\">\n <div class=\"modal-header\">\n <h5 class=\"modal-title\" id=\"%sLabel\">%s</h5>\n <button type=\"button\" class=\"btn-close\" data-bs-dismiss=\"modal\" aria-label=\"Close\"></button>\n </div>\n <div class=\"modal-body\">\n <div class=\"bootstrap-table\">\n <div class=\"fixed-table-toolbar\">\n <div class=\"bars\">\n <div id=\"toolbar\" class=\"pb-3\">\n <button id=\"add\" type=\"button\" class=\"btn btn-secondary\">%s %s</button>\n <button id=\"delete\" type=\"button\" class=\"btn btn-secondary\" disabled>%s %s</button>\n </div>\n </div>\n </div>\n <div class=\"fixed-table-container\">\n <table id=\"multi-sort\" class=\"table\">\n <thead>\n <tr>\n <th></th>\n <th><div class=\"th-inner\">%s</div></th>\n <th><div class=\"th-inner\">%s</div></th>\n </tr>\n </thead>\n <tbody></tbody>\n </table>\n </div>\n </div>\n </div>\n <div class=\"modal-footer\">\n <button type=\"button\" class=\"btn btn-secondary\" data-bs-dismiss=\"modal\">%s</button>\n <button type=\"button\" class=\"btn btn-primary multi-sort-order-button\">%s</button>\n </div>\n </div>\n </div>\n </div>\n ",
1345 multipleSortButton: '<button class="multi-sort %s" type="button" data-bs-toggle="modal" data-bs-target="#%s" title="%s">%s</button>',
1346 multipleSortSelect: '<select class="%s %s form-control">'
1347 }
1348 },
1349 semantic: {
1350 html: {
1351 multipleSortModal: "\n <div class=\"ui modal tiny\" id=\"%s\" aria-labelledby=\"%sLabel\" aria-hidden=\"true\">\n <i class=\"close icon\"></i>\n <div class=\"header\" id=\"%sLabel\">\n %s\n </div>\n <div class=\"image content\">\n <div class=\"bootstrap-table\">\n <div class=\"fixed-table-toolbar\">\n <div class=\"bars\">\n <div id=\"toolbar\" class=\"pb-3\">\n <button id=\"add\" type=\"button\" class=\"ui button\">%s %s</button>\n <button id=\"delete\" type=\"button\" class=\"ui button\" disabled>%s %s</button>\n </div>\n </div>\n </div>\n <div class=\"fixed-table-container\">\n <table id=\"multi-sort\" class=\"table\">\n <thead>\n <tr>\n <th></th>\n <th><div class=\"th-inner\">%s</div></th>\n <th><div class=\"th-inner\">%s</div></th>\n </tr>\n </thead>\n <tbody></tbody>\n </table>\n </div>\n </div>\n </div>\n <div class=\"actions\">\n <div class=\"ui button deny\">%s</div>\n <div class=\"ui button approve multi-sort-order-button\">%s</div>\n </div>\n </div>\n ",
1352 multipleSortButton: '<button class="multi-sort %s" type="button" data-toggle="modal" data-target="#%s" title="%s">%s</button>',
1353 multipleSortSelect: '<select class="%s %s">'
1354 }
1355 },
1356 materialize: {
1357 html: {
1358 multipleSortModal: "\n <div id=\"%s\" class=\"modal\" aria-labelledby=\"%sLabel\" aria-hidden=\"true\">\n <div class=\"modal-content\" id=\"%sLabel\">\n <h4>%s</h4>\n <div class=\"bootstrap-table\">\n <div class=\"fixed-table-toolbar\">\n <div class=\"bars\">\n <div id=\"toolbar\" class=\"pb-3\">\n <button id=\"add\" type=\"button\" class=\"waves-effect waves-light btn\">%s %s</button>\n <button id=\"delete\" type=\"button\" class=\"waves-effect waves-light btn\" disabled>%s %s</button>\n </div>\n </div>\n </div>\n <div class=\"fixed-table-container\">\n <table id=\"multi-sort\" class=\"table\">\n <thead>\n <tr>\n <th></th>\n <th><div class=\"th-inner\">%s</div></th>\n <th><div class=\"th-inner\">%s</div></th>\n </tr>\n </thead>\n <tbody></tbody>\n </table>\n </div>\n </div>\n <div class=\"modal-footer\">\n <a href=\"javascript:void(0)\" class=\"modal-close waves-effect waves-light btn\">%s</a>\n <a href=\"javascript:void(0)\" class=\"modal-close waves-effect waves-light btn multi-sort-order-button\">%s</a>\n </div>\n </div>\n </div>\n ",
1359 multipleSortButton: '<a class="multi-sort %s modal-trigger" href="#%s" type="button" data-toggle="modal" title="%s">%s</a>',
1360 multipleSortSelect: '<select class="%s %s browser-default">'
1361 }
1362 },
1363 foundation: {
1364 html: {
1365 multipleSortModal: "\n <div class=\"reveal\" id=\"%s\" data-reveal aria-labelledby=\"%sLabel\" aria-hidden=\"true\">\n <div id=\"%sLabel\">\n <h1>%s</h1>\n <div class=\"bootstrap-table\">\n <div class=\"fixed-table-toolbar\">\n <div class=\"bars\">\n <div id=\"toolbar\" class=\"padding-bottom-2\">\n <button id=\"add\" type=\"button\" class=\"waves-effect waves-light button\">%s %s</button>\n <button id=\"delete\" type=\"button\" class=\"waves-effect waves-light button\" disabled>%s %s</button>\n </div>\n </div>\n </div>\n <div class=\"fixed-table-container\">\n <table id=\"multi-sort\" class=\"table\">\n <thead>\n <tr>\n <th></th>\n <th><div class=\"th-inner\">%s</div></th>\n <th><div class=\"th-inner\">%s</div></th>\n </tr>\n </thead>\n <tbody></tbody>\n </table>\n </div>\n </div>\n\n <button class=\"waves-effect waves-light button\" data-close aria-label=\"Close modal\" type=\"button\">\n <span aria-hidden=\"true\">%s</span>\n </button>\n <button class=\"waves-effect waves-light button multi-sort-order-button\" data-close aria-label=\"Order\" type=\"button\">\n <span aria-hidden=\"true\">%s</span>\n </button>\n </div>\n </div>\n ",
1366 multipleSortButton: '<button class="multi-sort %s" data-open="%s" title="%s">%s</button>',
1367 multipleSortSelect: '<select class="%s %s browser-default">'
1368 }
1369 },
1370 bulma: {
1371 html: {
1372 multipleSortModal: "\n <div class=\"modal\" id=\"%s\" aria-labelledby=\"%sLabel\" aria-hidden=\"true\">\n <div class=\"modal-background\"></div>\n <div class=\"modal-content\" id=\"%sLabel\">\n <div class=\"box\">\n <h2>%s</h2>\n <div class=\"bootstrap-table\">\n <div class=\"fixed-table-toolbar\">\n <div class=\"bars\">\n <div id=\"toolbar\" class=\"padding-bottom-2\">\n <button id=\"add\" type=\"button\" class=\"waves-effect waves-light button\">%s %s</button>\n <button id=\"delete\" type=\"button\" class=\"waves-effect waves-light button\" disabled>%s %s</button>\n </div>\n </div>\n </div>\n <div class=\"fixed-table-container\">\n <table id=\"multi-sort\" class=\"table\">\n <thead>\n <tr>\n <th></th>\n <th><div class=\"th-inner\">%s</div></th>\n <th><div class=\"th-inner\">%s</div></th>\n </tr>\n </thead>\n <tbody></tbody>\n </table>\n </div>\n </div>\n <button type=\"button\" class=\"waves-effect waves-light button\" data-close>%s</button>\n <button type=\"button\" class=\"waves-effect waves-light button multi-sort-order-button\" data-close>%s</button>\n </div>\n </div>\n </div>\n ",
1373 multipleSortButton: '<button class="multi-sort %s" data-target="%s" title="%s">%s</button>',
1374 multipleSortSelect: '<select class="%s %s browser-default">'
1375 }
1376 },
1377 'bootstrap-table': {
1378 html: {
1379 multipleSortModal: "\n <div class=\"modal\" id=\"%s\" aria-labelledby=\"%sLabel\" aria-hidden=\"true\">\n <div class=\"modal-background\"></div>\n <div class=\"modal-content\" id=\"%sLabel\">\n <div class=\"box\">\n <h2>%s</h2>\n <div class=\"bootstrap-table\">\n <div class=\"fixed-table-toolbar\">\n <div class=\"bars\">\n <div id=\"toolbar\" class=\"padding-bottom-2\">\n <button id=\"add\" type=\"button\" class=\"btn\">%s %s</button>\n <button id=\"delete\" type=\"button\" class=\"btn\" disabled>%s %s</button>\n </div>\n </div>\n </div>\n <div class=\"fixed-table-container\">\n <table id=\"multi-sort\" class=\"table\">\n <thead>\n <tr>\n <th></th>\n <th><div class=\"th-inner\">%s</div></th>\n <th><div class=\"th-inner\">%s</div></th>\n </tr>\n </thead>\n <tbody></tbody>\n </table>\n </div>\n </div>\n <div class=\"mt-30\">\n <button type=\"button\" class=\"btn\" data-close>%s</button>\n <button type=\"button\" class=\"btn multi-sort-order-button\" data-close>%s</button>\n </div>\n </div>\n </div>\n </div>\n ",
1380 multipleSortButton: '<button class="multi-sort %s" data-target="%s" title="%s">%s</button>',
1381 multipleSortSelect: '<select class="%s %s browser-default">'
1382 }
1383 }
1384 }[$__default['default'].fn.bootstrapTable.theme];
1385
1386 var showSortModal = function showSortModal(that) {
1387 var _selector = that.sortModalSelector;
1388
1389 var _id = "#".concat(_selector);
1390
1391 var o = that.options;
1392
1393 if (!$__default['default'](_id).hasClass('modal')) {
1394 var sModal = Utils.sprintf(theme.html.multipleSortModal, _selector, _selector, _selector, that.options.formatMultipleSort(), Utils.sprintf(that.constants.html.icon, o.iconsPrefix, o.icons.plus), that.options.formatAddLevel(), Utils.sprintf(that.constants.html.icon, o.iconsPrefix, o.icons.minus), that.options.formatDeleteLevel(), that.options.formatColumn(), that.options.formatOrder(), that.options.formatCancel(), that.options.formatSort());
1395 $__default['default']('body').append($__default['default'](sModal));
1396 that.$sortModal = $__default['default'](_id);
1397 var $rows = that.$sortModal.find('tbody > tr');
1398 that.$sortModal.off('click', '#add').on('click', '#add', function () {
1399 var total = that.$sortModal.find('.multi-sort-name:first option').length;
1400 var current = that.$sortModal.find('tbody tr').length;
1401
1402 if (current < total) {
1403 current++;
1404 that.addLevel();
1405 that.setButtonStates();
1406 }
1407 });
1408 that.$sortModal.off('click', '#delete').on('click', '#delete', function () {
1409 var total = that.$sortModal.find('.multi-sort-name:first option').length;
1410 var current = that.$sortModal.find('tbody tr').length;
1411
1412 if (current > 1 && current <= total) {
1413 current--;
1414 that.$sortModal.find('tbody tr:last').remove();
1415 that.setButtonStates();
1416 }
1417 });
1418 that.$sortModal.off('click', '.multi-sort-order-button').on('click', '.multi-sort-order-button', function () {
1419 var $rows = that.$sortModal.find('tbody > tr');
1420 var $alert = that.$sortModal.find('div.alert');
1421 var fields = [];
1422 var results = [];
1423 var sortPriority = $__default['default'].map($rows, function (row) {
1424 var $row = $__default['default'](row);
1425 var name = $row.find('.multi-sort-name').val();
1426 var order = $row.find('.multi-sort-order').val();
1427 fields.push(name);
1428 return {
1429 sortName: name,
1430 sortOrder: order
1431 };
1432 });
1433 var sorted_fields = fields.sort();
1434
1435 for (var i = 0; i < fields.length - 1; i++) {
1436 if (sorted_fields[i + 1] === sorted_fields[i]) {
1437 results.push(sorted_fields[i]);
1438 }
1439 }
1440
1441 if (results.length > 0) {
1442 if ($alert.length === 0) {
1443 $alert = "<div class=\"alert alert-danger\" role=\"alert\"><strong>".concat(that.options.formatDuplicateAlertTitle(), "</strong> ").concat(that.options.formatDuplicateAlertDescription(), "</div>");
1444 $__default['default']($alert).insertBefore(that.$sortModal.find('.bars'));
1445 }
1446 } else {
1447 if ($alert.length === 1) {
1448 $__default['default']($alert).remove();
1449 }
1450
1451 if ($__default['default'].inArray($__default['default'].fn.bootstrapTable.theme, ['bootstrap3', 'bootstrap4']) !== -1) {
1452 that.$sortModal.modal('hide');
1453 }
1454
1455 that.multiSort(sortPriority);
1456 }
1457 });
1458
1459 if (that.options.sortPriority === null || that.options.sortPriority.length === 0) {
1460 if (that.options.sortName) {
1461 that.options.sortPriority = [{
1462 sortName: that.options.sortName,
1463 sortOrder: that.options.sortOrder
1464 }];
1465 }
1466 }
1467
1468 if (that.options.sortPriority !== null && that.options.sortPriority.length > 0) {
1469 if ($rows.length < that.options.sortPriority.length && _typeof(that.options.sortPriority) === 'object') {
1470 for (var i = 0; i < that.options.sortPriority.length; i++) {
1471 that.addLevel(i, that.options.sortPriority[i]);
1472 }
1473 }
1474 } else {
1475 that.addLevel(0);
1476 }
1477
1478 that.setButtonStates();
1479 }
1480 };
1481
1482 $__default['default'].fn.bootstrapTable.methods.push('multipleSort');
1483 $__default['default'].fn.bootstrapTable.methods.push('multiSort');
1484 $__default['default'].extend($__default['default'].fn.bootstrapTable.defaults, {
1485 showMultiSort: false,
1486 showMultiSortButton: true,
1487 multiSortStrictSort: false,
1488 sortPriority: null,
1489 onMultipleSort: function onMultipleSort() {
1490 return false;
1491 }
1492 });
1493 $__default['default'].extend($__default['default'].fn.bootstrapTable.Constructor.EVENTS, {
1494 'multiple-sort.bs.table': 'onMultipleSort'
1495 });
1496 $__default['default'].extend($__default['default'].fn.bootstrapTable.locales, {
1497 formatMultipleSort: function formatMultipleSort() {
1498 return 'Multiple Sort';
1499 },
1500 formatAddLevel: function formatAddLevel() {
1501 return 'Add Level';
1502 },
1503 formatDeleteLevel: function formatDeleteLevel() {
1504 return 'Delete Level';
1505 },
1506 formatColumn: function formatColumn() {
1507 return 'Column';
1508 },
1509 formatOrder: function formatOrder() {
1510 return 'Order';
1511 },
1512 formatSortBy: function formatSortBy() {
1513 return 'Sort by';
1514 },
1515 formatThenBy: function formatThenBy() {
1516 return 'Then by';
1517 },
1518 formatSort: function formatSort() {
1519 return 'Sort';
1520 },
1521 formatCancel: function formatCancel() {
1522 return 'Cancel';
1523 },
1524 formatDuplicateAlertTitle: function formatDuplicateAlertTitle() {
1525 return 'Duplicate(s) detected!';
1526 },
1527 formatDuplicateAlertDescription: function formatDuplicateAlertDescription() {
1528 return 'Please remove or change any duplicate column.';
1529 },
1530 formatSortOrders: function formatSortOrders() {
1531 return {
1532 asc: 'Ascending',
1533 desc: 'Descending'
1534 };
1535 }
1536 });
1537 $__default['default'].extend($__default['default'].fn.bootstrapTable.defaults, $__default['default'].fn.bootstrapTable.locales);
1538 var BootstrapTable = $__default['default'].fn.bootstrapTable.Constructor;
1539 var _initToolbar = BootstrapTable.prototype.initToolbar;
1540 var _destroy = BootstrapTable.prototype.destroy;
1541
1542 BootstrapTable.prototype.initToolbar = function () {
1543 var _this = this;
1544
1545 this.showToolbar = this.showToolbar || this.options.showMultiSort;
1546 var that = this;
1547 var sortModalSelector = "sortModal_".concat(this.$el.attr('id'));
1548 var sortModalId = "#".concat(sortModalSelector);
1549 var $multiSortBtn = this.$toolbar.find('div.multi-sort');
1550 var o = this.options;
1551 this.$sortModal = $__default['default'](sortModalId);
1552 this.sortModalSelector = sortModalSelector;
1553
1554 if (that.options.sortPriority !== null) {
1555 that.onMultipleSort();
1556 }
1557
1558 if (this.options.showMultiSortButton) {
1559 this.buttons = Object.assign(this.buttons, {
1560 multipleSort: {
1561 html: Utils.sprintf(theme.html.multipleSortButton, that.constants.buttonsClass, that.sortModalSelector, this.options.formatMultipleSort(), Utils.sprintf(that.constants.html.icon, o.iconsPrefix, o.icons.sort))
1562 }
1563 });
1564 }
1565
1566 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1567 args[_key] = arguments[_key];
1568 }
1569
1570 _initToolbar.apply(this, Array.prototype.slice.apply(args));
1571
1572 if (that.options.sidePagination === 'server' && !isSingleSort && that.options.sortPriority !== null) {
1573 var t = that.options.queryParams;
1574
1575 that.options.queryParams = function (params) {
1576 params.multiSort = that.options.sortPriority;
1577 return t(params);
1578 };
1579 }
1580
1581 if (this.options.showMultiSort) {
1582 if (!$multiSortBtn.length && this.options.showMultiSortButton) {
1583 if ($__default['default'].fn.bootstrapTable.theme === 'semantic') {
1584 this.$toolbar.find('.multi-sort').on('click', function () {
1585 $__default['default'](sortModalId).modal('show');
1586 });
1587 } else if ($__default['default'].fn.bootstrapTable.theme === 'materialize') {
1588 this.$toolbar.find('.multi-sort').on('click', function () {
1589 $__default['default'](sortModalId).modal();
1590 });
1591 } else if ($__default['default'].fn.bootstrapTable.theme === 'bootstrap-table') {
1592 this.$toolbar.find('.multi-sort').on('click', function () {
1593 $__default['default'](sortModalId).addClass('show');
1594 });
1595 } else if ($__default['default'].fn.bootstrapTable.theme === 'foundation') {
1596 this.$toolbar.find('.multi-sort').on('click', function () {
1597 if (!_this.foundationModal) {
1598 // eslint-disable-next-line no-undef
1599 _this.foundationModal = new Foundation.Reveal($__default['default'](sortModalId));
1600 }
1601
1602 _this.foundationModal.open();
1603 });
1604 } else if ($__default['default'].fn.bootstrapTable.theme === 'bulma') {
1605 this.$toolbar.find('.multi-sort').on('click', function () {
1606 $__default['default']('html').toggleClass('is-clipped');
1607 $__default['default'](sortModalId).toggleClass('is-active');
1608 $__default['default']('button[data-close]').one('click', function () {
1609 $__default['default']('html').toggleClass('is-clipped');
1610 $__default['default'](sortModalId).toggleClass('is-active');
1611 });
1612 });
1613 }
1614
1615 showSortModal(that);
1616 }
1617
1618 this.$el.on('sort.bs.table', function () {
1619 isSingleSort = true;
1620 });
1621 this.$el.on('multiple-sort.bs.table', function () {
1622 isSingleSort = false;
1623 });
1624 this.$el.on('load-success.bs.table', function () {
1625 if (!isSingleSort && that.options.sortPriority !== null && _typeof(that.options.sortPriority) === 'object' && that.options.sidePagination !== 'server') {
1626 that.onMultipleSort();
1627 }
1628 });
1629 this.$el.on('column-switch.bs.table', function (field, checked) {
1630 if (that.options.sortPriority !== null && that.options.sortPriority.length > 0) {
1631 for (var i = 0; i < that.options.sortPriority.length; i++) {
1632 if (that.options.sortPriority[i].sortName === checked) {
1633 that.options.sortPriority.splice(i, 1);
1634 }
1635 }
1636
1637 that.assignSortableArrows();
1638 }
1639
1640 that.$sortModal.remove();
1641 showSortModal(that);
1642 });
1643 this.$el.on('reset-view.bs.table', function () {
1644 if (!isSingleSort && that.options.sortPriority !== null && _typeof(that.options.sortPriority) === 'object') {
1645 that.assignSortableArrows();
1646 }
1647 });
1648 }
1649 };
1650
1651 BootstrapTable.prototype.destroy = function () {
1652 for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
1653 args[_key2] = arguments[_key2];
1654 }
1655
1656 _destroy.apply(this, Array.prototype.slice.apply(args));
1657
1658 if (this.options.showMultiSort) {
1659 this.enableCustomSort = false;
1660 this.$sortModal.remove();
1661 }
1662 };
1663
1664 BootstrapTable.prototype.multipleSort = function () {
1665 var that = this;
1666
1667 if (!isSingleSort && that.options.sortPriority !== null && _typeof(that.options.sortPriority) === 'object' && that.options.sidePagination !== 'server') {
1668 that.onMultipleSort();
1669 }
1670 };
1671
1672 BootstrapTable.prototype.onMultipleSort = function () {
1673 var that = this;
1674
1675 var cmp = function cmp(x, y) {
1676 return x > y ? 1 : x < y ? -1 : 0;
1677 };
1678
1679 var arrayCmp = function arrayCmp(a, b) {
1680 var arr1 = [];
1681 var arr2 = [];
1682
1683 for (var i = 0; i < that.options.sortPriority.length; i++) {
1684 var fieldName = that.options.sortPriority[i].sortName;
1685 var fieldIndex = that.header.fields.indexOf(fieldName);
1686 var sorterName = that.header.sorters[that.header.fields.indexOf(fieldName)];
1687
1688 if (that.header.sortNames[fieldIndex]) {
1689 fieldName = that.header.sortNames[fieldIndex];
1690 }
1691
1692 var order = that.options.sortPriority[i].sortOrder === 'desc' ? -1 : 1;
1693 var aa = Utils.getItemField(a, fieldName);
1694 var bb = Utils.getItemField(b, fieldName);
1695 var value1 = $__default['default'].fn.bootstrapTable.utils.calculateObjectValue(that.header, sorterName, [aa, bb]);
1696 var value2 = $__default['default'].fn.bootstrapTable.utils.calculateObjectValue(that.header, sorterName, [bb, aa]);
1697
1698 if (value1 !== undefined && value2 !== undefined) {
1699 arr1.push(order * value1);
1700 arr2.push(order * value2);
1701 continue;
1702 }
1703
1704 if (aa === undefined || aa === null) aa = '';
1705 if (bb === undefined || bb === null) bb = '';
1706
1707 if ($__default['default'].isNumeric(aa) && $__default['default'].isNumeric(bb)) {
1708 aa = parseFloat(aa);
1709 bb = parseFloat(bb);
1710 } else {
1711 aa = aa.toString();
1712 bb = bb.toString();
1713
1714 if (that.options.multiSortStrictSort) {
1715 aa = aa.toLowerCase();
1716 bb = bb.toLowerCase();
1717 }
1718 }
1719
1720 arr1.push(order * cmp(aa, bb));
1721 arr2.push(order * cmp(bb, aa));
1722 }
1723
1724 return cmp(arr1, arr2);
1725 };
1726
1727 this.enableCustomSort = true;
1728 this.data.sort(function (a, b) {
1729 return arrayCmp(a, b);
1730 });
1731 this.initBody();
1732 this.assignSortableArrows();
1733 this.trigger('multiple-sort');
1734 };
1735
1736 BootstrapTable.prototype.addLevel = function (index, sortPriority) {
1737 var text = index === 0 ? this.options.formatSortBy() : this.options.formatThenBy();
1738 this.$sortModal.find('tbody').append($__default['default']('<tr>').append($__default['default']('<td>').text(text)).append($__default['default']('<td>').append($__default['default'](Utils.sprintf(theme.html.multipleSortSelect, this.constants.classes.paginationDropdown, 'multi-sort-name')))).append($__default['default']('<td>').append($__default['default'](Utils.sprintf(theme.html.multipleSortSelect, this.constants.classes.paginationDropdown, 'multi-sort-order')))));
1739 var $multiSortName = this.$sortModal.find('.multi-sort-name').last();
1740 var $multiSortOrder = this.$sortModal.find('.multi-sort-order').last();
1741 $__default['default'].each(this.columns, function (i, column) {
1742 if (column.sortable === false || column.visible === false) {
1743 return true;
1744 }
1745
1746 $multiSortName.append("<option value=\"".concat(column.field, "\">").concat(column.title, "</option>"));
1747 });
1748 $__default['default'].each(this.options.formatSortOrders(), function (value, order) {
1749 $multiSortOrder.append("<option value=\"".concat(value, "\">").concat(order, "</option>"));
1750 });
1751
1752 if (sortPriority !== undefined) {
1753 $multiSortName.find("option[value=\"".concat(sortPriority.sortName, "\"]")).attr('selected', true);
1754 $multiSortOrder.find("option[value=\"".concat(sortPriority.sortOrder, "\"]")).attr('selected', true);
1755 }
1756 };
1757
1758 BootstrapTable.prototype.assignSortableArrows = function () {
1759 var that = this;
1760 var headers = that.$header.find('th');
1761
1762 for (var i = 0; i < headers.length; i++) {
1763 for (var c = 0; c < that.options.sortPriority.length; c++) {
1764 if ($__default['default'](headers[i]).data('field') === that.options.sortPriority[c].sortName) {
1765 $__default['default'](headers[i]).find('.sortable').removeClass('desc asc').addClass(that.options.sortPriority[c].sortOrder);
1766 }
1767 }
1768 }
1769 };
1770
1771 BootstrapTable.prototype.setButtonStates = function () {
1772 var total = this.$sortModal.find('.multi-sort-name:first option').length;
1773 var current = this.$sortModal.find('tbody tr').length;
1774
1775 if (current === total) {
1776 this.$sortModal.find('#add').attr('disabled', 'disabled');
1777 }
1778
1779 if (current > 1) {
1780 this.$sortModal.find('#delete').removeAttr('disabled');
1781 }
1782
1783 if (current < total) {
1784 this.$sortModal.find('#add').removeAttr('disabled');
1785 }
1786
1787 if (current === 1) {
1788 this.$sortModal.find('#delete').attr('disabled', 'disabled');
1789 }
1790 };
1791
1792 BootstrapTable.prototype.multiSort = function (sortPriority) {
1793 var _this2 = this;
1794
1795 this.options.sortPriority = sortPriority;
1796 this.options.sortName = undefined;
1797
1798 if (this.options.sidePagination === 'server') {
1799 var queryParams = this.options.queryParams;
1800
1801 this.options.queryParams = function (params) {
1802 params.multiSort = _this2.options.sortPriority;
1803 return $__default['default'].fn.bootstrapTable.utils.calculateObjectValue(_this2.options, queryParams, [params]);
1804 };
1805
1806 isSingleSort = false;
1807 this.initServer(this.options.silentSort);
1808 return;
1809 }
1810
1811 this.onMultipleSort();
1812 };
1813
1814})));