UNPKG

86.6 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 = global || self, factory(global.jQuery));
5}(this, function ($) { 'use strict';
6
7 $ = $ && $.hasOwnProperty('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 O = 'object';
16 var check = function (it) {
17 return it && it.Math == Math && it;
18 };
19
20 // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
21 var global_1 =
22 // eslint-disable-next-line no-undef
23 check(typeof globalThis == O && globalThis) ||
24 check(typeof window == O && window) ||
25 check(typeof self == O && self) ||
26 check(typeof commonjsGlobal == O && commonjsGlobal) ||
27 // eslint-disable-next-line no-new-func
28 Function('return this')();
29
30 var fails = function (exec) {
31 try {
32 return !!exec();
33 } catch (error) {
34 return true;
35 }
36 };
37
38 // Thank's IE8 for his funny defineProperty
39 var descriptors = !fails(function () {
40 return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
41 });
42
43 var nativePropertyIsEnumerable = {}.propertyIsEnumerable;
44 var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
45
46 // Nashorn ~ JDK8 bug
47 var NASHORN_BUG = getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1);
48
49 // `Object.prototype.propertyIsEnumerable` method implementation
50 // https://tc39.github.io/ecma262/#sec-object.prototype.propertyisenumerable
51 var f = NASHORN_BUG ? function propertyIsEnumerable(V) {
52 var descriptor = getOwnPropertyDescriptor(this, V);
53 return !!descriptor && descriptor.enumerable;
54 } : nativePropertyIsEnumerable;
55
56 var objectPropertyIsEnumerable = {
57 f: f
58 };
59
60 var createPropertyDescriptor = function (bitmap, value) {
61 return {
62 enumerable: !(bitmap & 1),
63 configurable: !(bitmap & 2),
64 writable: !(bitmap & 4),
65 value: value
66 };
67 };
68
69 var toString = {}.toString;
70
71 var classofRaw = function (it) {
72 return toString.call(it).slice(8, -1);
73 };
74
75 var split = ''.split;
76
77 // fallback for non-array-like ES3 and non-enumerable old V8 strings
78 var indexedObject = fails(function () {
79 // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
80 // eslint-disable-next-line no-prototype-builtins
81 return !Object('z').propertyIsEnumerable(0);
82 }) ? function (it) {
83 return classofRaw(it) == 'String' ? split.call(it, '') : Object(it);
84 } : Object;
85
86 // `RequireObjectCoercible` abstract operation
87 // https://tc39.github.io/ecma262/#sec-requireobjectcoercible
88 var requireObjectCoercible = function (it) {
89 if (it == undefined) throw TypeError("Can't call method on " + it);
90 return it;
91 };
92
93 // toObject with fallback for non-array-like ES3 strings
94
95
96
97 var toIndexedObject = function (it) {
98 return indexedObject(requireObjectCoercible(it));
99 };
100
101 var isObject = function (it) {
102 return typeof it === 'object' ? it !== null : typeof it === 'function';
103 };
104
105 // `ToPrimitive` abstract operation
106 // https://tc39.github.io/ecma262/#sec-toprimitive
107 // instead of the ES6 spec version, we didn't implement @@toPrimitive case
108 // and the second argument - flag - preferred type is a string
109 var toPrimitive = function (input, PREFERRED_STRING) {
110 if (!isObject(input)) return input;
111 var fn, val;
112 if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
113 if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val;
114 if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
115 throw TypeError("Can't convert object to primitive value");
116 };
117
118 var hasOwnProperty = {}.hasOwnProperty;
119
120 var has = function (it, key) {
121 return hasOwnProperty.call(it, key);
122 };
123
124 var document$1 = global_1.document;
125 // typeof document.createElement is 'object' in old IE
126 var EXISTS = isObject(document$1) && isObject(document$1.createElement);
127
128 var documentCreateElement = function (it) {
129 return EXISTS ? document$1.createElement(it) : {};
130 };
131
132 // Thank's IE8 for his funny defineProperty
133 var ie8DomDefine = !descriptors && !fails(function () {
134 return Object.defineProperty(documentCreateElement('div'), 'a', {
135 get: function () { return 7; }
136 }).a != 7;
137 });
138
139 var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
140
141 // `Object.getOwnPropertyDescriptor` method
142 // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor
143 var f$1 = descriptors ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
144 O = toIndexedObject(O);
145 P = toPrimitive(P, true);
146 if (ie8DomDefine) try {
147 return nativeGetOwnPropertyDescriptor(O, P);
148 } catch (error) { /* empty */ }
149 if (has(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]);
150 };
151
152 var objectGetOwnPropertyDescriptor = {
153 f: f$1
154 };
155
156 var anObject = function (it) {
157 if (!isObject(it)) {
158 throw TypeError(String(it) + ' is not an object');
159 } return it;
160 };
161
162 var nativeDefineProperty = Object.defineProperty;
163
164 // `Object.defineProperty` method
165 // https://tc39.github.io/ecma262/#sec-object.defineproperty
166 var f$2 = descriptors ? nativeDefineProperty : function defineProperty(O, P, Attributes) {
167 anObject(O);
168 P = toPrimitive(P, true);
169 anObject(Attributes);
170 if (ie8DomDefine) try {
171 return nativeDefineProperty(O, P, Attributes);
172 } catch (error) { /* empty */ }
173 if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
174 if ('value' in Attributes) O[P] = Attributes.value;
175 return O;
176 };
177
178 var objectDefineProperty = {
179 f: f$2
180 };
181
182 var hide = descriptors ? function (object, key, value) {
183 return objectDefineProperty.f(object, key, createPropertyDescriptor(1, value));
184 } : function (object, key, value) {
185 object[key] = value;
186 return object;
187 };
188
189 var setGlobal = function (key, value) {
190 try {
191 hide(global_1, key, value);
192 } catch (error) {
193 global_1[key] = value;
194 } return value;
195 };
196
197 var shared = createCommonjsModule(function (module) {
198 var SHARED = '__core-js_shared__';
199 var store = global_1[SHARED] || setGlobal(SHARED, {});
200
201 (module.exports = function (key, value) {
202 return store[key] || (store[key] = value !== undefined ? value : {});
203 })('versions', []).push({
204 version: '3.1.3',
205 mode: 'global',
206 copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
207 });
208 });
209
210 var functionToString = shared('native-function-to-string', Function.toString);
211
212 var WeakMap = global_1.WeakMap;
213
214 var nativeWeakMap = typeof WeakMap === 'function' && /native code/.test(functionToString.call(WeakMap));
215
216 var id = 0;
217 var postfix = Math.random();
218
219 var uid = function (key) {
220 return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);
221 };
222
223 var keys = shared('keys');
224
225 var sharedKey = function (key) {
226 return keys[key] || (keys[key] = uid(key));
227 };
228
229 var hiddenKeys = {};
230
231 var WeakMap$1 = global_1.WeakMap;
232 var set, get, has$1;
233
234 var enforce = function (it) {
235 return has$1(it) ? get(it) : set(it, {});
236 };
237
238 var getterFor = function (TYPE) {
239 return function (it) {
240 var state;
241 if (!isObject(it) || (state = get(it)).type !== TYPE) {
242 throw TypeError('Incompatible receiver, ' + TYPE + ' required');
243 } return state;
244 };
245 };
246
247 if (nativeWeakMap) {
248 var store = new WeakMap$1();
249 var wmget = store.get;
250 var wmhas = store.has;
251 var wmset = store.set;
252 set = function (it, metadata) {
253 wmset.call(store, it, metadata);
254 return metadata;
255 };
256 get = function (it) {
257 return wmget.call(store, it) || {};
258 };
259 has$1 = function (it) {
260 return wmhas.call(store, it);
261 };
262 } else {
263 var STATE = sharedKey('state');
264 hiddenKeys[STATE] = true;
265 set = function (it, metadata) {
266 hide(it, STATE, metadata);
267 return metadata;
268 };
269 get = function (it) {
270 return has(it, STATE) ? it[STATE] : {};
271 };
272 has$1 = function (it) {
273 return has(it, STATE);
274 };
275 }
276
277 var internalState = {
278 set: set,
279 get: get,
280 has: has$1,
281 enforce: enforce,
282 getterFor: getterFor
283 };
284
285 var redefine = createCommonjsModule(function (module) {
286 var getInternalState = internalState.get;
287 var enforceInternalState = internalState.enforce;
288 var TEMPLATE = String(functionToString).split('toString');
289
290 shared('inspectSource', function (it) {
291 return functionToString.call(it);
292 });
293
294 (module.exports = function (O, key, value, options) {
295 var unsafe = options ? !!options.unsafe : false;
296 var simple = options ? !!options.enumerable : false;
297 var noTargetGet = options ? !!options.noTargetGet : false;
298 if (typeof value == 'function') {
299 if (typeof key == 'string' && !has(value, 'name')) hide(value, 'name', key);
300 enforceInternalState(value).source = TEMPLATE.join(typeof key == 'string' ? key : '');
301 }
302 if (O === global_1) {
303 if (simple) O[key] = value;
304 else setGlobal(key, value);
305 return;
306 } else if (!unsafe) {
307 delete O[key];
308 } else if (!noTargetGet && O[key]) {
309 simple = true;
310 }
311 if (simple) O[key] = value;
312 else hide(O, key, value);
313 // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
314 })(Function.prototype, 'toString', function toString() {
315 return typeof this == 'function' && getInternalState(this).source || functionToString.call(this);
316 });
317 });
318
319 var path = global_1;
320
321 var aFunction = function (variable) {
322 return typeof variable == 'function' ? variable : undefined;
323 };
324
325 var getBuiltIn = function (namespace, method) {
326 return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global_1[namespace])
327 : path[namespace] && path[namespace][method] || global_1[namespace] && global_1[namespace][method];
328 };
329
330 var ceil = Math.ceil;
331 var floor = Math.floor;
332
333 // `ToInteger` abstract operation
334 // https://tc39.github.io/ecma262/#sec-tointeger
335 var toInteger = function (argument) {
336 return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument);
337 };
338
339 var min = Math.min;
340
341 // `ToLength` abstract operation
342 // https://tc39.github.io/ecma262/#sec-tolength
343 var toLength = function (argument) {
344 return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
345 };
346
347 var max = Math.max;
348 var min$1 = Math.min;
349
350 // Helper for a popular repeating case of the spec:
351 // Let integer be ? ToInteger(index).
352 // If integer < 0, let result be max((length + integer), 0); else let result be min(length, length).
353 var toAbsoluteIndex = function (index, length) {
354 var integer = toInteger(index);
355 return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
356 };
357
358 // `Array.prototype.{ indexOf, includes }` methods implementation
359 var createMethod = function (IS_INCLUDES) {
360 return function ($this, el, fromIndex) {
361 var O = toIndexedObject($this);
362 var length = toLength(O.length);
363 var index = toAbsoluteIndex(fromIndex, length);
364 var value;
365 // Array#includes uses SameValueZero equality algorithm
366 // eslint-disable-next-line no-self-compare
367 if (IS_INCLUDES && el != el) while (length > index) {
368 value = O[index++];
369 // eslint-disable-next-line no-self-compare
370 if (value != value) return true;
371 // Array#indexOf ignores holes, Array#includes - not
372 } else for (;length > index; index++) {
373 if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
374 } return !IS_INCLUDES && -1;
375 };
376 };
377
378 var arrayIncludes = {
379 // `Array.prototype.includes` method
380 // https://tc39.github.io/ecma262/#sec-array.prototype.includes
381 includes: createMethod(true),
382 // `Array.prototype.indexOf` method
383 // https://tc39.github.io/ecma262/#sec-array.prototype.indexof
384 indexOf: createMethod(false)
385 };
386
387 var indexOf = arrayIncludes.indexOf;
388
389
390 var objectKeysInternal = function (object, names) {
391 var O = toIndexedObject(object);
392 var i = 0;
393 var result = [];
394 var key;
395 for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key);
396 // Don't enum bug & hidden keys
397 while (names.length > i) if (has(O, key = names[i++])) {
398 ~indexOf(result, key) || result.push(key);
399 }
400 return result;
401 };
402
403 // IE8- don't enum bug keys
404 var enumBugKeys = [
405 'constructor',
406 'hasOwnProperty',
407 'isPrototypeOf',
408 'propertyIsEnumerable',
409 'toLocaleString',
410 'toString',
411 'valueOf'
412 ];
413
414 var hiddenKeys$1 = enumBugKeys.concat('length', 'prototype');
415
416 // `Object.getOwnPropertyNames` method
417 // https://tc39.github.io/ecma262/#sec-object.getownpropertynames
418 var f$3 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
419 return objectKeysInternal(O, hiddenKeys$1);
420 };
421
422 var objectGetOwnPropertyNames = {
423 f: f$3
424 };
425
426 var f$4 = Object.getOwnPropertySymbols;
427
428 var objectGetOwnPropertySymbols = {
429 f: f$4
430 };
431
432 // all object keys, includes non-enumerable and symbols
433 var ownKeys = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
434 var keys = objectGetOwnPropertyNames.f(anObject(it));
435 var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
436 return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
437 };
438
439 var copyConstructorProperties = function (target, source) {
440 var keys = ownKeys(source);
441 var defineProperty = objectDefineProperty.f;
442 var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
443 for (var i = 0; i < keys.length; i++) {
444 var key = keys[i];
445 if (!has(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
446 }
447 };
448
449 var replacement = /#|\.prototype\./;
450
451 var isForced = function (feature, detection) {
452 var value = data[normalize(feature)];
453 return value == POLYFILL ? true
454 : value == NATIVE ? false
455 : typeof detection == 'function' ? fails(detection)
456 : !!detection;
457 };
458
459 var normalize = isForced.normalize = function (string) {
460 return String(string).replace(replacement, '.').toLowerCase();
461 };
462
463 var data = isForced.data = {};
464 var NATIVE = isForced.NATIVE = 'N';
465 var POLYFILL = isForced.POLYFILL = 'P';
466
467 var isForced_1 = isForced;
468
469 var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
470
471
472
473
474
475
476 /*
477 options.target - name of the target object
478 options.global - target is the global object
479 options.stat - export as static methods of target
480 options.proto - export as prototype methods of target
481 options.real - real prototype method for the `pure` version
482 options.forced - export even if the native feature is available
483 options.bind - bind methods to the target, required for the `pure` version
484 options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
485 options.unsafe - use the simple assignment of property instead of delete + defineProperty
486 options.sham - add a flag to not completely full polyfills
487 options.enumerable - export as enumerable property
488 options.noTargetGet - prevent calling a getter on target
489 */
490 var _export = function (options, source) {
491 var TARGET = options.target;
492 var GLOBAL = options.global;
493 var STATIC = options.stat;
494 var FORCED, target, key, targetProperty, sourceProperty, descriptor;
495 if (GLOBAL) {
496 target = global_1;
497 } else if (STATIC) {
498 target = global_1[TARGET] || setGlobal(TARGET, {});
499 } else {
500 target = (global_1[TARGET] || {}).prototype;
501 }
502 if (target) for (key in source) {
503 sourceProperty = source[key];
504 if (options.noTargetGet) {
505 descriptor = getOwnPropertyDescriptor$1(target, key);
506 targetProperty = descriptor && descriptor.value;
507 } else targetProperty = target[key];
508 FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
509 // contained in target
510 if (!FORCED && targetProperty !== undefined) {
511 if (typeof sourceProperty === typeof targetProperty) continue;
512 copyConstructorProperties(sourceProperty, targetProperty);
513 }
514 // add a flag to not completely full polyfills
515 if (options.sham || (targetProperty && targetProperty.sham)) {
516 hide(sourceProperty, 'sham', true);
517 }
518 // extend global
519 redefine(target, key, sourceProperty, options);
520 }
521 };
522
523 var aFunction$1 = function (it) {
524 if (typeof it != 'function') {
525 throw TypeError(String(it) + ' is not a function');
526 } return it;
527 };
528
529 // optional / simple context binding
530 var bindContext = function (fn, that, length) {
531 aFunction$1(fn);
532 if (that === undefined) return fn;
533 switch (length) {
534 case 0: return function () {
535 return fn.call(that);
536 };
537 case 1: return function (a) {
538 return fn.call(that, a);
539 };
540 case 2: return function (a, b) {
541 return fn.call(that, a, b);
542 };
543 case 3: return function (a, b, c) {
544 return fn.call(that, a, b, c);
545 };
546 }
547 return function (/* ...args */) {
548 return fn.apply(that, arguments);
549 };
550 };
551
552 // `ToObject` abstract operation
553 // https://tc39.github.io/ecma262/#sec-toobject
554 var toObject = function (argument) {
555 return Object(requireObjectCoercible(argument));
556 };
557
558 // `IsArray` abstract operation
559 // https://tc39.github.io/ecma262/#sec-isarray
560 var isArray = Array.isArray || function isArray(arg) {
561 return classofRaw(arg) == 'Array';
562 };
563
564 var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () {
565 // Chrome 38 Symbol has incorrect toString conversion
566 // eslint-disable-next-line no-undef
567 return !String(Symbol());
568 });
569
570 var Symbol$1 = global_1.Symbol;
571 var store$1 = shared('wks');
572
573 var wellKnownSymbol = function (name) {
574 return store$1[name] || (store$1[name] = nativeSymbol && Symbol$1[name]
575 || (nativeSymbol ? Symbol$1 : uid)('Symbol.' + name));
576 };
577
578 var SPECIES = wellKnownSymbol('species');
579
580 // `ArraySpeciesCreate` abstract operation
581 // https://tc39.github.io/ecma262/#sec-arrayspeciescreate
582 var arraySpeciesCreate = function (originalArray, length) {
583 var C;
584 if (isArray(originalArray)) {
585 C = originalArray.constructor;
586 // cross-realm fallback
587 if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;
588 else if (isObject(C)) {
589 C = C[SPECIES];
590 if (C === null) C = undefined;
591 }
592 } return new (C === undefined ? Array : C)(length === 0 ? 0 : length);
593 };
594
595 var push = [].push;
596
597 // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex }` methods implementation
598 var createMethod$1 = function (TYPE) {
599 var IS_MAP = TYPE == 1;
600 var IS_FILTER = TYPE == 2;
601 var IS_SOME = TYPE == 3;
602 var IS_EVERY = TYPE == 4;
603 var IS_FIND_INDEX = TYPE == 6;
604 var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
605 return function ($this, callbackfn, that, specificCreate) {
606 var O = toObject($this);
607 var self = indexedObject(O);
608 var boundFunction = bindContext(callbackfn, that, 3);
609 var length = toLength(self.length);
610 var index = 0;
611 var create = specificCreate || arraySpeciesCreate;
612 var target = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;
613 var value, result;
614 for (;length > index; index++) if (NO_HOLES || index in self) {
615 value = self[index];
616 result = boundFunction(value, index, O);
617 if (TYPE) {
618 if (IS_MAP) target[index] = result; // map
619 else if (result) switch (TYPE) {
620 case 3: return true; // some
621 case 5: return value; // find
622 case 6: return index; // findIndex
623 case 2: push.call(target, value); // filter
624 } else if (IS_EVERY) return false; // every
625 }
626 }
627 return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
628 };
629 };
630
631 var arrayIteration = {
632 // `Array.prototype.forEach` method
633 // https://tc39.github.io/ecma262/#sec-array.prototype.foreach
634 forEach: createMethod$1(0),
635 // `Array.prototype.map` method
636 // https://tc39.github.io/ecma262/#sec-array.prototype.map
637 map: createMethod$1(1),
638 // `Array.prototype.filter` method
639 // https://tc39.github.io/ecma262/#sec-array.prototype.filter
640 filter: createMethod$1(2),
641 // `Array.prototype.some` method
642 // https://tc39.github.io/ecma262/#sec-array.prototype.some
643 some: createMethod$1(3),
644 // `Array.prototype.every` method
645 // https://tc39.github.io/ecma262/#sec-array.prototype.every
646 every: createMethod$1(4),
647 // `Array.prototype.find` method
648 // https://tc39.github.io/ecma262/#sec-array.prototype.find
649 find: createMethod$1(5),
650 // `Array.prototype.findIndex` method
651 // https://tc39.github.io/ecma262/#sec-array.prototype.findIndex
652 findIndex: createMethod$1(6)
653 };
654
655 var SPECIES$1 = wellKnownSymbol('species');
656
657 var arrayMethodHasSpeciesSupport = function (METHOD_NAME) {
658 return !fails(function () {
659 var array = [];
660 var constructor = array.constructor = {};
661 constructor[SPECIES$1] = function () {
662 return { foo: 1 };
663 };
664 return array[METHOD_NAME](Boolean).foo !== 1;
665 });
666 };
667
668 var $filter = arrayIteration.filter;
669
670
671 // `Array.prototype.filter` method
672 // https://tc39.github.io/ecma262/#sec-array.prototype.filter
673 // with adding support of @@species
674 _export({ target: 'Array', proto: true, forced: !arrayMethodHasSpeciesSupport('filter') }, {
675 filter: function filter(callbackfn /* , thisArg */) {
676 return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
677 }
678 });
679
680 // `Object.keys` method
681 // https://tc39.github.io/ecma262/#sec-object.keys
682 var objectKeys = Object.keys || function keys(O) {
683 return objectKeysInternal(O, enumBugKeys);
684 };
685
686 // `Object.defineProperties` method
687 // https://tc39.github.io/ecma262/#sec-object.defineproperties
688 var objectDefineProperties = descriptors ? Object.defineProperties : function defineProperties(O, Properties) {
689 anObject(O);
690 var keys = objectKeys(Properties);
691 var length = keys.length;
692 var index = 0;
693 var key;
694 while (length > index) objectDefineProperty.f(O, key = keys[index++], Properties[key]);
695 return O;
696 };
697
698 var html = getBuiltIn('document', 'documentElement');
699
700 var IE_PROTO = sharedKey('IE_PROTO');
701
702 var PROTOTYPE = 'prototype';
703 var Empty = function () { /* empty */ };
704
705 // Create object with fake `null` prototype: use iframe Object with cleared prototype
706 var createDict = function () {
707 // Thrash, waste and sodomy: IE GC bug
708 var iframe = documentCreateElement('iframe');
709 var length = enumBugKeys.length;
710 var lt = '<';
711 var script = 'script';
712 var gt = '>';
713 var js = 'java' + script + ':';
714 var iframeDocument;
715 iframe.style.display = 'none';
716 html.appendChild(iframe);
717 iframe.src = String(js);
718 iframeDocument = iframe.contentWindow.document;
719 iframeDocument.open();
720 iframeDocument.write(lt + script + gt + 'document.F=Object' + lt + '/' + script + gt);
721 iframeDocument.close();
722 createDict = iframeDocument.F;
723 while (length--) delete createDict[PROTOTYPE][enumBugKeys[length]];
724 return createDict();
725 };
726
727 // `Object.create` method
728 // https://tc39.github.io/ecma262/#sec-object.create
729 var objectCreate = Object.create || function create(O, Properties) {
730 var result;
731 if (O !== null) {
732 Empty[PROTOTYPE] = anObject(O);
733 result = new Empty();
734 Empty[PROTOTYPE] = null;
735 // add "__proto__" for Object.getPrototypeOf polyfill
736 result[IE_PROTO] = O;
737 } else result = createDict();
738 return Properties === undefined ? result : objectDefineProperties(result, Properties);
739 };
740
741 hiddenKeys[IE_PROTO] = true;
742
743 var UNSCOPABLES = wellKnownSymbol('unscopables');
744 var ArrayPrototype = Array.prototype;
745
746 // Array.prototype[@@unscopables]
747 // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
748 if (ArrayPrototype[UNSCOPABLES] == undefined) {
749 hide(ArrayPrototype, UNSCOPABLES, objectCreate(null));
750 }
751
752 // add a key to Array.prototype[@@unscopables]
753 var addToUnscopables = function (key) {
754 ArrayPrototype[UNSCOPABLES][key] = true;
755 };
756
757 var $find = arrayIteration.find;
758
759
760 var FIND = 'find';
761 var SKIPS_HOLES = true;
762
763 // Shouldn't skip holes
764 if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });
765
766 // `Array.prototype.find` method
767 // https://tc39.github.io/ecma262/#sec-array.prototype.find
768 _export({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
769 find: function find(callbackfn /* , that = undefined */) {
770 return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
771 }
772 });
773
774 // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
775 addToUnscopables(FIND);
776
777 var $includes = arrayIncludes.includes;
778
779
780 // `Array.prototype.includes` method
781 // https://tc39.github.io/ecma262/#sec-array.prototype.includes
782 _export({ target: 'Array', proto: true }, {
783 includes: function includes(el /* , fromIndex = 0 */) {
784 return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
785 }
786 });
787
788 // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
789 addToUnscopables('includes');
790
791 var sloppyArrayMethod = function (METHOD_NAME, argument) {
792 var method = [][METHOD_NAME];
793 return !method || !fails(function () {
794 // eslint-disable-next-line no-useless-call,no-throw-literal
795 method.call(null, argument || function () { throw 1; }, 1);
796 });
797 };
798
799 var $indexOf = arrayIncludes.indexOf;
800
801
802 var nativeIndexOf = [].indexOf;
803
804 var NEGATIVE_ZERO = !!nativeIndexOf && 1 / [1].indexOf(1, -0) < 0;
805 var SLOPPY_METHOD = sloppyArrayMethod('indexOf');
806
807 // `Array.prototype.indexOf` method
808 // https://tc39.github.io/ecma262/#sec-array.prototype.indexof
809 _export({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || SLOPPY_METHOD }, {
810 indexOf: function indexOf(searchElement /* , fromIndex = 0 */) {
811 return NEGATIVE_ZERO
812 // convert -0 to +0
813 ? nativeIndexOf.apply(this, arguments) || 0
814 : $indexOf(this, searchElement, arguments.length > 1 ? arguments[1] : undefined);
815 }
816 });
817
818 var nativeJoin = [].join;
819
820 var ES3_STRINGS = indexedObject != Object;
821 var SLOPPY_METHOD$1 = sloppyArrayMethod('join', ',');
822
823 // `Array.prototype.join` method
824 // https://tc39.github.io/ecma262/#sec-array.prototype.join
825 _export({ target: 'Array', proto: true, forced: ES3_STRINGS || SLOPPY_METHOD$1 }, {
826 join: function join(separator) {
827 return nativeJoin.call(toIndexedObject(this), separator === undefined ? ',' : separator);
828 }
829 });
830
831 var nativeSort = [].sort;
832 var test = [1, 2, 3];
833
834 // IE8-
835 var FAILS_ON_UNDEFINED = fails(function () {
836 test.sort(undefined);
837 });
838 // V8 bug
839 var FAILS_ON_NULL = fails(function () {
840 test.sort(null);
841 });
842 // Old WebKit
843 var SLOPPY_METHOD$2 = sloppyArrayMethod('sort');
844
845 var FORCED = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || SLOPPY_METHOD$2;
846
847 // `Array.prototype.sort` method
848 // https://tc39.github.io/ecma262/#sec-array.prototype.sort
849 _export({ target: 'Array', proto: true, forced: FORCED }, {
850 sort: function sort(comparefn) {
851 return comparefn === undefined
852 ? nativeSort.call(toObject(this))
853 : nativeSort.call(toObject(this), aFunction$1(comparefn));
854 }
855 });
856
857 var FAILS_ON_PRIMITIVES = fails(function () { objectKeys(1); });
858
859 // `Object.keys` method
860 // https://tc39.github.io/ecma262/#sec-object.keys
861 _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
862 keys: function keys(it) {
863 return objectKeys(toObject(it));
864 }
865 });
866
867 var TO_STRING_TAG = wellKnownSymbol('toStringTag');
868 // ES3 wrong here
869 var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
870
871 // fallback for IE11 Script Access Denied error
872 var tryGet = function (it, key) {
873 try {
874 return it[key];
875 } catch (error) { /* empty */ }
876 };
877
878 // getting tag from ES6+ `Object.prototype.toString`
879 var classof = function (it) {
880 var O, tag, result;
881 return it === undefined ? 'Undefined' : it === null ? 'Null'
882 // @@toStringTag case
883 : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG)) == 'string' ? tag
884 // builtinTag case
885 : CORRECT_ARGUMENTS ? classofRaw(O)
886 // ES3 arguments fallback
887 : (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result;
888 };
889
890 var TO_STRING_TAG$1 = wellKnownSymbol('toStringTag');
891 var test$1 = {};
892
893 test$1[TO_STRING_TAG$1] = 'z';
894
895 // `Object.prototype.toString` method implementation
896 // https://tc39.github.io/ecma262/#sec-object.prototype.tostring
897 var objectToString = String(test$1) !== '[object z]' ? function toString() {
898 return '[object ' + classof(this) + ']';
899 } : test$1.toString;
900
901 var ObjectPrototype = Object.prototype;
902
903 // `Object.prototype.toString` method
904 // https://tc39.github.io/ecma262/#sec-object.prototype.tostring
905 if (objectToString !== ObjectPrototype.toString) {
906 redefine(ObjectPrototype, 'toString', objectToString, { unsafe: true });
907 }
908
909 // `RegExp.prototype.flags` getter implementation
910 // https://tc39.github.io/ecma262/#sec-get-regexp.prototype.flags
911 var regexpFlags = function () {
912 var that = anObject(this);
913 var result = '';
914 if (that.global) result += 'g';
915 if (that.ignoreCase) result += 'i';
916 if (that.multiline) result += 'm';
917 if (that.dotAll) result += 's';
918 if (that.unicode) result += 'u';
919 if (that.sticky) result += 'y';
920 return result;
921 };
922
923 var TO_STRING = 'toString';
924 var RegExpPrototype = RegExp.prototype;
925 var nativeToString = RegExpPrototype[TO_STRING];
926
927 var NOT_GENERIC = fails(function () { return nativeToString.call({ source: 'a', flags: 'b' }) != '/a/b'; });
928 // FF44- RegExp#toString has a wrong name
929 var INCORRECT_NAME = nativeToString.name != TO_STRING;
930
931 // `RegExp.prototype.toString` method
932 // https://tc39.github.io/ecma262/#sec-regexp.prototype.tostring
933 if (NOT_GENERIC || INCORRECT_NAME) {
934 redefine(RegExp.prototype, TO_STRING, function toString() {
935 var R = anObject(this);
936 var p = String(R.source);
937 var rf = R.flags;
938 var f = String(rf === undefined && R instanceof RegExp && !('flags' in RegExpPrototype) ? regexpFlags.call(R) : rf);
939 return '/' + p + '/' + f;
940 }, { unsafe: true });
941 }
942
943 var MATCH = wellKnownSymbol('match');
944
945 // `IsRegExp` abstract operation
946 // https://tc39.github.io/ecma262/#sec-isregexp
947 var isRegexp = function (it) {
948 var isRegExp;
949 return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classofRaw(it) == 'RegExp');
950 };
951
952 var notARegexp = function (it) {
953 if (isRegexp(it)) {
954 throw TypeError("The method doesn't accept regular expressions");
955 } return it;
956 };
957
958 var MATCH$1 = wellKnownSymbol('match');
959
960 var correctIsRegexpLogic = function (METHOD_NAME) {
961 var regexp = /./;
962 try {
963 '/./'[METHOD_NAME](regexp);
964 } catch (e) {
965 try {
966 regexp[MATCH$1] = false;
967 return '/./'[METHOD_NAME](regexp);
968 } catch (f) { /* empty */ }
969 } return false;
970 };
971
972 // `String.prototype.includes` method
973 // https://tc39.github.io/ecma262/#sec-string.prototype.includes
974 _export({ target: 'String', proto: true, forced: !correctIsRegexpLogic('includes') }, {
975 includes: function includes(searchString /* , position = 0 */) {
976 return !!~String(requireObjectCoercible(this))
977 .indexOf(notARegexp(searchString), arguments.length > 1 ? arguments[1] : undefined);
978 }
979 });
980
981 var nativeExec = RegExp.prototype.exec;
982 // This always refers to the native implementation, because the
983 // String#replace polyfill uses ./fix-regexp-well-known-symbol-logic.js,
984 // which loads this file before patching the method.
985 var nativeReplace = String.prototype.replace;
986
987 var patchedExec = nativeExec;
988
989 var UPDATES_LAST_INDEX_WRONG = (function () {
990 var re1 = /a/;
991 var re2 = /b*/g;
992 nativeExec.call(re1, 'a');
993 nativeExec.call(re2, 'a');
994 return re1.lastIndex !== 0 || re2.lastIndex !== 0;
995 })();
996
997 // nonparticipating capturing group, copied from es5-shim's String#split patch.
998 var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
999
1000 var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED;
1001
1002 if (PATCH) {
1003 patchedExec = function exec(str) {
1004 var re = this;
1005 var lastIndex, reCopy, match, i;
1006
1007 if (NPCG_INCLUDED) {
1008 reCopy = new RegExp('^' + re.source + '$(?!\\s)', regexpFlags.call(re));
1009 }
1010 if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;
1011
1012 match = nativeExec.call(re, str);
1013
1014 if (UPDATES_LAST_INDEX_WRONG && match) {
1015 re.lastIndex = re.global ? match.index + match[0].length : lastIndex;
1016 }
1017 if (NPCG_INCLUDED && match && match.length > 1) {
1018 // Fix browsers whose `exec` methods don't consistently return `undefined`
1019 // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/
1020 nativeReplace.call(match[0], reCopy, function () {
1021 for (i = 1; i < arguments.length - 2; i++) {
1022 if (arguments[i] === undefined) match[i] = undefined;
1023 }
1024 });
1025 }
1026
1027 return match;
1028 };
1029 }
1030
1031 var regexpExec = patchedExec;
1032
1033 var SPECIES$2 = wellKnownSymbol('species');
1034
1035 var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () {
1036 // #replace needs built-in support for named groups.
1037 // #match works fine because it just return the exec results, even if it has
1038 // a "grops" property.
1039 var re = /./;
1040 re.exec = function () {
1041 var result = [];
1042 result.groups = { a: '7' };
1043 return result;
1044 };
1045 return ''.replace(re, '$<a>') !== '7';
1046 });
1047
1048 // Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec
1049 // Weex JS has frozen built-in prototypes, so use try / catch wrapper
1050 var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () {
1051 var re = /(?:)/;
1052 var originalExec = re.exec;
1053 re.exec = function () { return originalExec.apply(this, arguments); };
1054 var result = 'ab'.split(re);
1055 return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b';
1056 });
1057
1058 var fixRegexpWellKnownSymbolLogic = function (KEY, length, exec, sham) {
1059 var SYMBOL = wellKnownSymbol(KEY);
1060
1061 var DELEGATES_TO_SYMBOL = !fails(function () {
1062 // String methods call symbol-named RegEp methods
1063 var O = {};
1064 O[SYMBOL] = function () { return 7; };
1065 return ''[KEY](O) != 7;
1066 });
1067
1068 var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails(function () {
1069 // Symbol-named RegExp methods call .exec
1070 var execCalled = false;
1071 var re = /a/;
1072 re.exec = function () { execCalled = true; return null; };
1073
1074 if (KEY === 'split') {
1075 // RegExp[@@split] doesn't call the regex's exec method, but first creates
1076 // a new one. We need to return the patched regex when creating the new one.
1077 re.constructor = {};
1078 re.constructor[SPECIES$2] = function () { return re; };
1079 }
1080
1081 re[SYMBOL]('');
1082 return !execCalled;
1083 });
1084
1085 if (
1086 !DELEGATES_TO_SYMBOL ||
1087 !DELEGATES_TO_EXEC ||
1088 (KEY === 'replace' && !REPLACE_SUPPORTS_NAMED_GROUPS) ||
1089 (KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC)
1090 ) {
1091 var nativeRegExpMethod = /./[SYMBOL];
1092 var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {
1093 if (regexp.exec === regexpExec) {
1094 if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
1095 // The native String method already delegates to @@method (this
1096 // polyfilled function), leasing to infinite recursion.
1097 // We avoid it by directly calling the native @@method method.
1098 return { done: true, value: nativeRegExpMethod.call(regexp, str, arg2) };
1099 }
1100 return { done: true, value: nativeMethod.call(str, regexp, arg2) };
1101 }
1102 return { done: false };
1103 });
1104 var stringMethod = methods[0];
1105 var regexMethod = methods[1];
1106
1107 redefine(String.prototype, KEY, stringMethod);
1108 redefine(RegExp.prototype, SYMBOL, length == 2
1109 // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue)
1110 // 21.2.5.11 RegExp.prototype[@@split](string, limit)
1111 ? function (string, arg) { return regexMethod.call(string, this, arg); }
1112 // 21.2.5.6 RegExp.prototype[@@match](string)
1113 // 21.2.5.9 RegExp.prototype[@@search](string)
1114 : function (string) { return regexMethod.call(string, this); }
1115 );
1116 if (sham) hide(RegExp.prototype[SYMBOL], 'sham', true);
1117 }
1118 };
1119
1120 // `String.prototype.{ codePointAt, at }` methods implementation
1121 var createMethod$2 = function (CONVERT_TO_STRING) {
1122 return function ($this, pos) {
1123 var S = String(requireObjectCoercible($this));
1124 var position = toInteger(pos);
1125 var size = S.length;
1126 var first, second;
1127 if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
1128 first = S.charCodeAt(position);
1129 return first < 0xD800 || first > 0xDBFF || position + 1 === size
1130 || (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF
1131 ? CONVERT_TO_STRING ? S.charAt(position) : first
1132 : CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
1133 };
1134 };
1135
1136 var stringMultibyte = {
1137 // `String.prototype.codePointAt` method
1138 // https://tc39.github.io/ecma262/#sec-string.prototype.codepointat
1139 codeAt: createMethod$2(false),
1140 // `String.prototype.at` method
1141 // https://github.com/mathiasbynens/String.prototype.at
1142 charAt: createMethod$2(true)
1143 };
1144
1145 var charAt = stringMultibyte.charAt;
1146
1147 // `AdvanceStringIndex` abstract operation
1148 // https://tc39.github.io/ecma262/#sec-advancestringindex
1149 var advanceStringIndex = function (S, index, unicode) {
1150 return index + (unicode ? charAt(S, index).length : 1);
1151 };
1152
1153 // `RegExpExec` abstract operation
1154 // https://tc39.github.io/ecma262/#sec-regexpexec
1155 var regexpExecAbstract = function (R, S) {
1156 var exec = R.exec;
1157 if (typeof exec === 'function') {
1158 var result = exec.call(R, S);
1159 if (typeof result !== 'object') {
1160 throw TypeError('RegExp exec method returned something other than an Object or null');
1161 }
1162 return result;
1163 }
1164
1165 if (classofRaw(R) !== 'RegExp') {
1166 throw TypeError('RegExp#exec called on incompatible receiver');
1167 }
1168
1169 return regexpExec.call(R, S);
1170 };
1171
1172 // @@match logic
1173 fixRegexpWellKnownSymbolLogic('match', 1, function (MATCH, nativeMatch, maybeCallNative) {
1174 return [
1175 // `String.prototype.match` method
1176 // https://tc39.github.io/ecma262/#sec-string.prototype.match
1177 function match(regexp) {
1178 var O = requireObjectCoercible(this);
1179 var matcher = regexp == undefined ? undefined : regexp[MATCH];
1180 return matcher !== undefined ? matcher.call(regexp, O) : new RegExp(regexp)[MATCH](String(O));
1181 },
1182 // `RegExp.prototype[@@match]` method
1183 // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@match
1184 function (regexp) {
1185 var res = maybeCallNative(nativeMatch, regexp, this);
1186 if (res.done) return res.value;
1187
1188 var rx = anObject(regexp);
1189 var S = String(this);
1190
1191 if (!rx.global) return regexpExecAbstract(rx, S);
1192
1193 var fullUnicode = rx.unicode;
1194 rx.lastIndex = 0;
1195 var A = [];
1196 var n = 0;
1197 var result;
1198 while ((result = regexpExecAbstract(rx, S)) !== null) {
1199 var matchStr = String(result[0]);
1200 A[n] = matchStr;
1201 if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
1202 n++;
1203 }
1204 return n === 0 ? null : A;
1205 }
1206 ];
1207 });
1208
1209 var max$1 = Math.max;
1210 var min$2 = Math.min;
1211 var floor$1 = Math.floor;
1212 var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d\d?|<[^>]*>)/g;
1213 var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d\d?)/g;
1214
1215 var maybeToString = function (it) {
1216 return it === undefined ? it : String(it);
1217 };
1218
1219 // @@replace logic
1220 fixRegexpWellKnownSymbolLogic('replace', 2, function (REPLACE, nativeReplace, maybeCallNative) {
1221 return [
1222 // `String.prototype.replace` method
1223 // https://tc39.github.io/ecma262/#sec-string.prototype.replace
1224 function replace(searchValue, replaceValue) {
1225 var O = requireObjectCoercible(this);
1226 var replacer = searchValue == undefined ? undefined : searchValue[REPLACE];
1227 return replacer !== undefined
1228 ? replacer.call(searchValue, O, replaceValue)
1229 : nativeReplace.call(String(O), searchValue, replaceValue);
1230 },
1231 // `RegExp.prototype[@@replace]` method
1232 // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@replace
1233 function (regexp, replaceValue) {
1234 var res = maybeCallNative(nativeReplace, regexp, this, replaceValue);
1235 if (res.done) return res.value;
1236
1237 var rx = anObject(regexp);
1238 var S = String(this);
1239
1240 var functionalReplace = typeof replaceValue === 'function';
1241 if (!functionalReplace) replaceValue = String(replaceValue);
1242
1243 var global = rx.global;
1244 if (global) {
1245 var fullUnicode = rx.unicode;
1246 rx.lastIndex = 0;
1247 }
1248 var results = [];
1249 while (true) {
1250 var result = regexpExecAbstract(rx, S);
1251 if (result === null) break;
1252
1253 results.push(result);
1254 if (!global) break;
1255
1256 var matchStr = String(result[0]);
1257 if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
1258 }
1259
1260 var accumulatedResult = '';
1261 var nextSourcePosition = 0;
1262 for (var i = 0; i < results.length; i++) {
1263 result = results[i];
1264
1265 var matched = String(result[0]);
1266 var position = max$1(min$2(toInteger(result.index), S.length), 0);
1267 var captures = [];
1268 // NOTE: This is equivalent to
1269 // captures = result.slice(1).map(maybeToString)
1270 // but for some reason `nativeSlice.call(result, 1, result.length)` (called in
1271 // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and
1272 // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.
1273 for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j]));
1274 var namedCaptures = result.groups;
1275 if (functionalReplace) {
1276 var replacerArgs = [matched].concat(captures, position, S);
1277 if (namedCaptures !== undefined) replacerArgs.push(namedCaptures);
1278 var replacement = String(replaceValue.apply(undefined, replacerArgs));
1279 } else {
1280 replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
1281 }
1282 if (position >= nextSourcePosition) {
1283 accumulatedResult += S.slice(nextSourcePosition, position) + replacement;
1284 nextSourcePosition = position + matched.length;
1285 }
1286 }
1287 return accumulatedResult + S.slice(nextSourcePosition);
1288 }
1289 ];
1290
1291 // https://tc39.github.io/ecma262/#sec-getsubstitution
1292 function getSubstitution(matched, str, position, captures, namedCaptures, replacement) {
1293 var tailPos = position + matched.length;
1294 var m = captures.length;
1295 var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
1296 if (namedCaptures !== undefined) {
1297 namedCaptures = toObject(namedCaptures);
1298 symbols = SUBSTITUTION_SYMBOLS;
1299 }
1300 return nativeReplace.call(replacement, symbols, function (match, ch) {
1301 var capture;
1302 switch (ch.charAt(0)) {
1303 case '$': return '$';
1304 case '&': return matched;
1305 case '`': return str.slice(0, position);
1306 case "'": return str.slice(tailPos);
1307 case '<':
1308 capture = namedCaptures[ch.slice(1, -1)];
1309 break;
1310 default: // \d\d?
1311 var n = +ch;
1312 if (n === 0) return match;
1313 if (n > m) {
1314 var f = floor$1(n / 10);
1315 if (f === 0) return match;
1316 if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1);
1317 return match;
1318 }
1319 capture = captures[n - 1];
1320 }
1321 return capture === undefined ? '' : capture;
1322 });
1323 }
1324 });
1325
1326 var SPECIES$3 = wellKnownSymbol('species');
1327
1328 // `SpeciesConstructor` abstract operation
1329 // https://tc39.github.io/ecma262/#sec-speciesconstructor
1330 var speciesConstructor = function (O, defaultConstructor) {
1331 var C = anObject(O).constructor;
1332 var S;
1333 return C === undefined || (S = anObject(C)[SPECIES$3]) == undefined ? defaultConstructor : aFunction$1(S);
1334 };
1335
1336 var arrayPush = [].push;
1337 var min$3 = Math.min;
1338 var MAX_UINT32 = 0xFFFFFFFF;
1339
1340 // babel-minify transpiles RegExp('x', 'y') -> /x/y and it causes SyntaxError
1341 var SUPPORTS_Y = !fails(function () { return !RegExp(MAX_UINT32, 'y'); });
1342
1343 // @@split logic
1344 fixRegexpWellKnownSymbolLogic('split', 2, function (SPLIT, nativeSplit, maybeCallNative) {
1345 var internalSplit;
1346 if (
1347 'abbc'.split(/(b)*/)[1] == 'c' ||
1348 'test'.split(/(?:)/, -1).length != 4 ||
1349 'ab'.split(/(?:ab)*/).length != 2 ||
1350 '.'.split(/(.?)(.?)/).length != 4 ||
1351 '.'.split(/()()/).length > 1 ||
1352 ''.split(/.?/).length
1353 ) {
1354 // based on es5-shim implementation, need to rework it
1355 internalSplit = function (separator, limit) {
1356 var string = String(requireObjectCoercible(this));
1357 var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
1358 if (lim === 0) return [];
1359 if (separator === undefined) return [string];
1360 // If `separator` is not a regex, use native split
1361 if (!isRegexp(separator)) {
1362 return nativeSplit.call(string, separator, lim);
1363 }
1364 var output = [];
1365 var flags = (separator.ignoreCase ? 'i' : '') +
1366 (separator.multiline ? 'm' : '') +
1367 (separator.unicode ? 'u' : '') +
1368 (separator.sticky ? 'y' : '');
1369 var lastLastIndex = 0;
1370 // Make `global` and avoid `lastIndex` issues by working with a copy
1371 var separatorCopy = new RegExp(separator.source, flags + 'g');
1372 var match, lastIndex, lastLength;
1373 while (match = regexpExec.call(separatorCopy, string)) {
1374 lastIndex = separatorCopy.lastIndex;
1375 if (lastIndex > lastLastIndex) {
1376 output.push(string.slice(lastLastIndex, match.index));
1377 if (match.length > 1 && match.index < string.length) arrayPush.apply(output, match.slice(1));
1378 lastLength = match[0].length;
1379 lastLastIndex = lastIndex;
1380 if (output.length >= lim) break;
1381 }
1382 if (separatorCopy.lastIndex === match.index) separatorCopy.lastIndex++; // Avoid an infinite loop
1383 }
1384 if (lastLastIndex === string.length) {
1385 if (lastLength || !separatorCopy.test('')) output.push('');
1386 } else output.push(string.slice(lastLastIndex));
1387 return output.length > lim ? output.slice(0, lim) : output;
1388 };
1389 // Chakra, V8
1390 } else if ('0'.split(undefined, 0).length) {
1391 internalSplit = function (separator, limit) {
1392 return separator === undefined && limit === 0 ? [] : nativeSplit.call(this, separator, limit);
1393 };
1394 } else internalSplit = nativeSplit;
1395
1396 return [
1397 // `String.prototype.split` method
1398 // https://tc39.github.io/ecma262/#sec-string.prototype.split
1399 function split(separator, limit) {
1400 var O = requireObjectCoercible(this);
1401 var splitter = separator == undefined ? undefined : separator[SPLIT];
1402 return splitter !== undefined
1403 ? splitter.call(separator, O, limit)
1404 : internalSplit.call(String(O), separator, limit);
1405 },
1406 // `RegExp.prototype[@@split]` method
1407 // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@split
1408 //
1409 // NOTE: This cannot be properly polyfilled in engines that don't support
1410 // the 'y' flag.
1411 function (regexp, limit) {
1412 var res = maybeCallNative(internalSplit, regexp, this, limit, internalSplit !== nativeSplit);
1413 if (res.done) return res.value;
1414
1415 var rx = anObject(regexp);
1416 var S = String(this);
1417 var C = speciesConstructor(rx, RegExp);
1418
1419 var unicodeMatching = rx.unicode;
1420 var flags = (rx.ignoreCase ? 'i' : '') +
1421 (rx.multiline ? 'm' : '') +
1422 (rx.unicode ? 'u' : '') +
1423 (SUPPORTS_Y ? 'y' : 'g');
1424
1425 // ^(? + rx + ) is needed, in combination with some S slicing, to
1426 // simulate the 'y' flag.
1427 var splitter = new C(SUPPORTS_Y ? rx : '^(?:' + rx.source + ')', flags);
1428 var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
1429 if (lim === 0) return [];
1430 if (S.length === 0) return regexpExecAbstract(splitter, S) === null ? [S] : [];
1431 var p = 0;
1432 var q = 0;
1433 var A = [];
1434 while (q < S.length) {
1435 splitter.lastIndex = SUPPORTS_Y ? q : 0;
1436 var z = regexpExecAbstract(splitter, SUPPORTS_Y ? S : S.slice(q));
1437 var e;
1438 if (
1439 z === null ||
1440 (e = min$3(toLength(splitter.lastIndex + (SUPPORTS_Y ? 0 : q)), S.length)) === p
1441 ) {
1442 q = advanceStringIndex(S, q, unicodeMatching);
1443 } else {
1444 A.push(S.slice(p, q));
1445 if (A.length === lim) return A;
1446 for (var i = 1; i <= z.length - 1; i++) {
1447 A.push(z[i]);
1448 if (A.length === lim) return A;
1449 }
1450 q = p = e;
1451 }
1452 }
1453 A.push(S.slice(p));
1454 return A;
1455 }
1456 ];
1457 }, !SUPPORTS_Y);
1458
1459 // a string of all valid unicode whitespaces
1460 // eslint-disable-next-line max-len
1461 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';
1462
1463 var whitespace = '[' + whitespaces + ']';
1464 var ltrim = RegExp('^' + whitespace + whitespace + '*');
1465 var rtrim = RegExp(whitespace + whitespace + '*$');
1466
1467 // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
1468 var createMethod$3 = function (TYPE) {
1469 return function ($this) {
1470 var string = String(requireObjectCoercible($this));
1471 if (TYPE & 1) string = string.replace(ltrim, '');
1472 if (TYPE & 2) string = string.replace(rtrim, '');
1473 return string;
1474 };
1475 };
1476
1477 var stringTrim = {
1478 // `String.prototype.{ trimLeft, trimStart }` methods
1479 // https://tc39.github.io/ecma262/#sec-string.prototype.trimstart
1480 start: createMethod$3(1),
1481 // `String.prototype.{ trimRight, trimEnd }` methods
1482 // https://tc39.github.io/ecma262/#sec-string.prototype.trimend
1483 end: createMethod$3(2),
1484 // `String.prototype.trim` method
1485 // https://tc39.github.io/ecma262/#sec-string.prototype.trim
1486 trim: createMethod$3(3)
1487 };
1488
1489 var non = '\u200B\u0085\u180E';
1490
1491 // check that a method works with the correct list
1492 // of whitespaces and has a correct name
1493 var forcedStringTrimMethod = function (METHOD_NAME) {
1494 return fails(function () {
1495 return !!whitespaces[METHOD_NAME]() || non[METHOD_NAME]() != non || whitespaces[METHOD_NAME].name !== METHOD_NAME;
1496 });
1497 };
1498
1499 var $trim = stringTrim.trim;
1500
1501
1502 // `String.prototype.trim` method
1503 // https://tc39.github.io/ecma262/#sec-string.prototype.trim
1504 _export({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, {
1505 trim: function trim() {
1506 return $trim(this);
1507 }
1508 });
1509
1510 // iterable DOM collections
1511 // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
1512 var domIterables = {
1513 CSSRuleList: 0,
1514 CSSStyleDeclaration: 0,
1515 CSSValueList: 0,
1516 ClientRectList: 0,
1517 DOMRectList: 0,
1518 DOMStringList: 0,
1519 DOMTokenList: 1,
1520 DataTransferItemList: 0,
1521 FileList: 0,
1522 HTMLAllCollection: 0,
1523 HTMLCollection: 0,
1524 HTMLFormElement: 0,
1525 HTMLSelectElement: 0,
1526 MediaList: 0,
1527 MimeTypeArray: 0,
1528 NamedNodeMap: 0,
1529 NodeList: 1,
1530 PaintRequestList: 0,
1531 Plugin: 0,
1532 PluginArray: 0,
1533 SVGLengthList: 0,
1534 SVGNumberList: 0,
1535 SVGPathSegList: 0,
1536 SVGPointList: 0,
1537 SVGStringList: 0,
1538 SVGTransformList: 0,
1539 SourceBufferList: 0,
1540 StyleSheetList: 0,
1541 TextTrackCueList: 0,
1542 TextTrackList: 0,
1543 TouchList: 0
1544 };
1545
1546 var $forEach = arrayIteration.forEach;
1547
1548
1549 // `Array.prototype.forEach` method implementation
1550 // https://tc39.github.io/ecma262/#sec-array.prototype.foreach
1551 var arrayForEach = sloppyArrayMethod('forEach') ? function forEach(callbackfn /* , thisArg */) {
1552 return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
1553 } : [].forEach;
1554
1555 for (var COLLECTION_NAME in domIterables) {
1556 var Collection = global_1[COLLECTION_NAME];
1557 var CollectionPrototype = Collection && Collection.prototype;
1558 // some Chrome versions have non-configurable methods on DOMTokenList
1559 if (CollectionPrototype && CollectionPrototype.forEach !== arrayForEach) try {
1560 hide(CollectionPrototype, 'forEach', arrayForEach);
1561 } catch (error) {
1562 CollectionPrototype.forEach = arrayForEach;
1563 }
1564 }
1565
1566 function _typeof(obj) {
1567 if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
1568 _typeof = function (obj) {
1569 return typeof obj;
1570 };
1571 } else {
1572 _typeof = function (obj) {
1573 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
1574 };
1575 }
1576
1577 return _typeof(obj);
1578 }
1579
1580 function _classCallCheck(instance, Constructor) {
1581 if (!(instance instanceof Constructor)) {
1582 throw new TypeError("Cannot call a class as a function");
1583 }
1584 }
1585
1586 function _defineProperties(target, props) {
1587 for (var i = 0; i < props.length; i++) {
1588 var descriptor = props[i];
1589 descriptor.enumerable = descriptor.enumerable || false;
1590 descriptor.configurable = true;
1591 if ("value" in descriptor) descriptor.writable = true;
1592 Object.defineProperty(target, descriptor.key, descriptor);
1593 }
1594 }
1595
1596 function _createClass(Constructor, protoProps, staticProps) {
1597 if (protoProps) _defineProperties(Constructor.prototype, protoProps);
1598 if (staticProps) _defineProperties(Constructor, staticProps);
1599 return Constructor;
1600 }
1601
1602 function _inherits(subClass, superClass) {
1603 if (typeof superClass !== "function" && superClass !== null) {
1604 throw new TypeError("Super expression must either be null or a function");
1605 }
1606
1607 subClass.prototype = Object.create(superClass && superClass.prototype, {
1608 constructor: {
1609 value: subClass,
1610 writable: true,
1611 configurable: true
1612 }
1613 });
1614 if (superClass) _setPrototypeOf(subClass, superClass);
1615 }
1616
1617 function _getPrototypeOf(o) {
1618 _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
1619 return o.__proto__ || Object.getPrototypeOf(o);
1620 };
1621 return _getPrototypeOf(o);
1622 }
1623
1624 function _setPrototypeOf(o, p) {
1625 _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
1626 o.__proto__ = p;
1627 return o;
1628 };
1629
1630 return _setPrototypeOf(o, p);
1631 }
1632
1633 function _assertThisInitialized(self) {
1634 if (self === void 0) {
1635 throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
1636 }
1637
1638 return self;
1639 }
1640
1641 function _possibleConstructorReturn(self, call) {
1642 if (call && (typeof call === "object" || typeof call === "function")) {
1643 return call;
1644 }
1645
1646 return _assertThisInitialized(self);
1647 }
1648
1649 function _superPropBase(object, property) {
1650 while (!Object.prototype.hasOwnProperty.call(object, property)) {
1651 object = _getPrototypeOf(object);
1652 if (object === null) break;
1653 }
1654
1655 return object;
1656 }
1657
1658 function _get(target, property, receiver) {
1659 if (typeof Reflect !== "undefined" && Reflect.get) {
1660 _get = Reflect.get;
1661 } else {
1662 _get = function _get(target, property, receiver) {
1663 var base = _superPropBase(target, property);
1664
1665 if (!base) return;
1666 var desc = Object.getOwnPropertyDescriptor(base, property);
1667
1668 if (desc.get) {
1669 return desc.get.call(receiver);
1670 }
1671
1672 return desc.value;
1673 };
1674 }
1675
1676 return _get(target, property, receiver || target);
1677 }
1678
1679 /**
1680 * @author: Dennis Hernández
1681 * @webSite: http://djhvscf.github.io/Blog
1682 * @version: v2.2.0
1683 */
1684
1685 var Utils = $.fn.bootstrapTable.utils;
1686 var UtilsFilterControl = {
1687 getOptionsFromSelectControl: function getOptionsFromSelectControl(selectControl) {
1688 return selectControl.get(selectControl.length - 1).options;
1689 },
1690 hideUnusedSelectOptions: function hideUnusedSelectOptions(selectControl, uniqueValues) {
1691 var options = UtilsFilterControl.getOptionsFromSelectControl(selectControl);
1692
1693 for (var i = 0; i < options.length; i++) {
1694 if (options[i].value !== '') {
1695 if (!uniqueValues.hasOwnProperty(options[i].value)) {
1696 selectControl.find(Utils.sprintf('option[value=\'%s\']', options[i].value)).hide();
1697 } else {
1698 selectControl.find(Utils.sprintf('option[value=\'%s\']', options[i].value)).show();
1699 }
1700 }
1701 }
1702 },
1703 addOptionToSelectControl: function addOptionToSelectControl(selectControl, _value, text, selected) {
1704 var value = $.trim(_value);
1705 var $selectControl = $(selectControl.get(selectControl.length - 1));
1706
1707 if (!UtilsFilterControl.existOptionInSelectControl(selectControl, value)) {
1708 var option = $($('<option></option>').attr('value', value).text($('<div />').html(text).text()));
1709
1710 if (value === selected) {
1711 option.attr('selected', true);
1712 }
1713
1714 $selectControl.append(option);
1715 }
1716 },
1717 sortSelectControl: function sortSelectControl(selectControl, orderBy) {
1718 var $selectControl = $(selectControl.get(selectControl.length - 1));
1719 var $opts = $selectControl.find('option:gt(0)');
1720 $opts.sort(function (a, b) {
1721 return Utils.sort(a.textContent, b.textContent, orderBy === 'desc' ? -1 : 1);
1722 });
1723 $selectControl.find('option:gt(0)').remove();
1724 $selectControl.append($opts);
1725 },
1726 existOptionInSelectControl: function existOptionInSelectControl(selectControl, value) {
1727 var options = UtilsFilterControl.getOptionsFromSelectControl(selectControl);
1728
1729 for (var i = 0; i < options.length; i++) {
1730 if (options[i].value === value.toString()) {
1731 // The value is not valid to add
1732 return true;
1733 }
1734 } // If we get here, the value is valid to add
1735
1736
1737 return false;
1738 },
1739 fixHeaderCSS: function fixHeaderCSS(_ref) {
1740 var $tableHeader = _ref.$tableHeader;
1741 $tableHeader.css('height', '77px');
1742 },
1743 getCurrentHeader: function getCurrentHeader(_ref2) {
1744 var $header = _ref2.$header,
1745 options = _ref2.options,
1746 $tableHeader = _ref2.$tableHeader;
1747 var header = $header;
1748
1749 if (options.height) {
1750 header = $tableHeader;
1751 }
1752
1753 return header;
1754 },
1755 getCurrentSearchControls: function getCurrentSearchControls(_ref3) {
1756 var options = _ref3.options;
1757 var searchControls = 'select, input';
1758
1759 if (options.height) {
1760 searchControls = 'table select, table input';
1761 }
1762
1763 return searchControls;
1764 },
1765 getCursorPosition: function getCursorPosition(el) {
1766 if (Utils.isIEBrowser()) {
1767 if ($(el).is('input[type=text]')) {
1768 var pos = 0;
1769
1770 if ('selectionStart' in el) {
1771 pos = el.selectionStart;
1772 } else if ('selection' in document) {
1773 el.focus();
1774 var Sel = document.selection.createRange();
1775 var SelLength = document.selection.createRange().text.length;
1776 Sel.moveStart('character', -el.value.length);
1777 pos = Sel.text.length - SelLength;
1778 }
1779
1780 return pos;
1781 }
1782
1783 return -1;
1784 }
1785
1786 return -1;
1787 },
1788 setCursorPosition: function setCursorPosition(el) {
1789 $(el).val(el.value);
1790 },
1791 copyValues: function copyValues(that) {
1792 var header = UtilsFilterControl.getCurrentHeader(that);
1793 var searchControls = UtilsFilterControl.getCurrentSearchControls(that);
1794 that.options.valuesFilterControl = [];
1795 header.find(searchControls).each(function () {
1796 that.options.valuesFilterControl.push({
1797 field: $(this).closest('[data-field]').data('field'),
1798 value: $(this).val(),
1799 position: UtilsFilterControl.getCursorPosition($(this).get(0)),
1800 hasFocus: $(this).is(':focus')
1801 });
1802 });
1803 },
1804 setValues: function setValues(that) {
1805 var field = null;
1806 var result = [];
1807 var header = UtilsFilterControl.getCurrentHeader(that);
1808 var searchControls = UtilsFilterControl.getCurrentSearchControls(that);
1809
1810 if (that.options.valuesFilterControl.length > 0) {
1811 // Callback to apply after settings fields values
1812 var fieldToFocusCallback = null;
1813 header.find(searchControls).each(function (index, ele) {
1814 field = $(this).closest('[data-field]').data('field');
1815 result = that.options.valuesFilterControl.filter(function (valueObj) {
1816 return valueObj.field === field;
1817 });
1818
1819 if (result.length > 0) {
1820 $(this).val(result[0].value);
1821
1822 if (result[0].hasFocus) {
1823 // set callback if the field had the focus.
1824 fieldToFocusCallback = function (fieldToFocus, carretPosition) {
1825 // Closure here to capture the field and cursor position
1826 var closedCallback = function closedCallback() {
1827 fieldToFocus.focus();
1828 UtilsFilterControl.setCursorPosition(fieldToFocus, carretPosition);
1829 };
1830
1831 return closedCallback;
1832 }($(this).get(0), result[0].position);
1833 }
1834 }
1835 }); // Callback call.
1836
1837 if (fieldToFocusCallback !== null) {
1838 fieldToFocusCallback();
1839 }
1840 }
1841 },
1842 collectBootstrapCookies: function collectBootstrapCookies() {
1843 var cookies = [];
1844 var foundCookies = document.cookie.match(/(?:bs.table.)(\w*)/g);
1845
1846 if (foundCookies) {
1847 $.each(foundCookies, function (i, _cookie) {
1848 var cookie = _cookie;
1849
1850 if (/./.test(cookie)) {
1851 cookie = cookie.split('.').pop();
1852 }
1853
1854 if ($.inArray(cookie, cookies) === -1) {
1855 cookies.push(cookie);
1856 }
1857 });
1858 return cookies;
1859 }
1860 },
1861 escapeID: function escapeID(id) {
1862 return String(id).replace(/(:|\.|\[|\]|,)/g, '\\$1');
1863 },
1864 isColumnSearchableViaSelect: function isColumnSearchableViaSelect(_ref4) {
1865 var filterControl = _ref4.filterControl,
1866 searchable = _ref4.searchable;
1867 return filterControl && filterControl.toLowerCase() === 'select' && searchable;
1868 },
1869 isFilterDataNotGiven: function isFilterDataNotGiven(_ref5) {
1870 var filterData = _ref5.filterData;
1871 return filterData === undefined || filterData.toLowerCase() === 'column';
1872 },
1873 hasSelectControlElement: function hasSelectControlElement(selectControl) {
1874 return selectControl && selectControl.length > 0;
1875 },
1876 initFilterSelectControls: function initFilterSelectControls(that) {
1877 var data = that.data;
1878 var itemsPerPage = that.pageTo < that.options.data.length ? that.options.data.length : that.pageTo;
1879 var z = that.options.pagination ? that.options.sidePagination === 'server' ? that.pageTo : that.options.totalRows : that.pageTo;
1880 $.each(that.header.fields, function (j, field) {
1881 var column = that.columns[that.fieldsColumnsIndex[field]];
1882 var selectControl = that.$tableBody.find(".bootstrap-table-filter-control-".concat(UtilsFilterControl.escapeID(column.field)));
1883
1884 if (UtilsFilterControl.isColumnSearchableViaSelect(column) && UtilsFilterControl.isFilterDataNotGiven(column) && UtilsFilterControl.hasSelectControlElement(selectControl)) {
1885 if (selectControl.get(selectControl.length - 1).options.length === 0) {
1886 // Added the default option
1887 UtilsFilterControl.addOptionToSelectControl(selectControl, '', column.filterControlPlaceholder, column.filterDefault);
1888 }
1889
1890 var uniqueValues = {};
1891
1892 for (var i = 0; i < z; i++) {
1893 // Added a new value
1894 var fieldValue = data[i][field];
1895 var formattedValue = Utils.calculateObjectValue(that.header, that.header.formatters[j], [fieldValue, data[i], i], fieldValue);
1896
1897 if (column.filterDataCollector) {
1898 formattedValue = Utils.calculateObjectValue(that.header, column.filterDataCollector, [fieldValue, data[i], formattedValue], formattedValue);
1899 }
1900
1901 if (_typeof(formattedValue) === 'object' && formattedValue !== null) {
1902 formattedValue.forEach(function (value) {
1903 UtilsFilterControl.addOptionToSelectControl(selectControl, value, value, column.filterDefault);
1904 });
1905 continue;
1906 }
1907
1908 UtilsFilterControl.addOptionToSelectControl(selectControl, formattedValue, formattedValue, column.filterDefault);
1909 }
1910
1911 UtilsFilterControl.sortSelectControl(selectControl, column.filterOrderBy);
1912
1913 if (that.options.hideUnusedSelectOptions) {
1914 UtilsFilterControl.hideUnusedSelectOptions(selectControl, uniqueValues);
1915 }
1916 }
1917 });
1918 that.trigger('created-controls');
1919 },
1920 getFilterDataMethod: function getFilterDataMethod(objFilterDataMethod, searchTerm) {
1921 var keys = Object.keys(objFilterDataMethod);
1922
1923 for (var i = 0; i < keys.length; i++) {
1924 if (keys[i] === searchTerm) {
1925 return objFilterDataMethod[searchTerm];
1926 }
1927 }
1928
1929 return null;
1930 },
1931 createControls: function createControls(that, header) {
1932 var addedFilterControl = false;
1933 var isVisible;
1934 var html;
1935 $.each(that.columns, function (i, column) {
1936 isVisible = 'hidden';
1937 html = [];
1938
1939 if (!column.visible) {
1940 return;
1941 }
1942
1943 if (!column.filterControl) {
1944 html.push('<div class="no-filter-control"></div>');
1945 } else {
1946 html.push('<div class="filter-control">');
1947 var nameControl = column.filterControl.toLowerCase();
1948
1949 if (column.searchable && that.options.filterTemplate[nameControl]) {
1950 addedFilterControl = true;
1951 isVisible = 'visible';
1952 html.push(that.options.filterTemplate[nameControl](that, column.field, isVisible, column.filterControlPlaceholder ? column.filterControlPlaceholder : '', column.filterDefault));
1953
1954 if ('' !== column.filterDefault && 'undefined' !== typeof column.filterDefault) {
1955 if ($.isEmptyObject(that.filterColumnsPartial)) {
1956 that.filterColumnsPartial = {};
1957 }
1958
1959 that.filterColumnsPartial[column.field] = column.filterDefault;
1960 }
1961 }
1962 }
1963
1964 $.each(header.children().children(), function (i, tr) {
1965 var $tr = $(tr);
1966
1967 if ($tr.data('field') === column.field) {
1968 $tr.find('.fht-cell').append(html.join(''));
1969 return false;
1970 }
1971 });
1972
1973 if (column.filterData !== undefined && column.filterData.toLowerCase() !== 'column') {
1974 var filterDataType = UtilsFilterControl.getFilterDataMethod(
1975 /* eslint-disable no-use-before-define */
1976 filterDataMethods, column.filterData.substring(0, column.filterData.indexOf(':')));
1977 var filterDataSource;
1978 var selectControl;
1979
1980 if (filterDataType !== null) {
1981 filterDataSource = column.filterData.substring(column.filterData.indexOf(':') + 1, column.filterData.length);
1982 selectControl = that.$tableBody.find(".bootstrap-table-filter-control-".concat(UtilsFilterControl.escapeID(column.field)));
1983 UtilsFilterControl.addOptionToSelectControl(selectControl, '', column.filterControlPlaceholder, column.filterDefault);
1984 filterDataType(filterDataSource, selectControl, column.filterDefault);
1985 } else {
1986 throw new SyntaxError('Error. You should use any of these allowed filter data methods: var, json, url.' + ' Use like this: var: {key: "value"}');
1987 }
1988
1989 var variableValues;
1990 var key; // eslint-disable-next-line default-case
1991
1992 switch (filterDataType) {
1993 case 'url':
1994 $.ajax({
1995 url: filterDataSource,
1996 dataType: 'json',
1997 success: function success(data) {
1998 // eslint-disable-next-line guard-for-in
1999 for (var _key in data) {
2000 UtilsFilterControl.addOptionToSelectControl(selectControl, _key, data[_key], column.filterDefault);
2001 }
2002
2003 UtilsFilterControl.sortSelectControl(selectControl, column.filterOrderBy);
2004 }
2005 });
2006 break;
2007
2008 case 'var':
2009 variableValues = window[filterDataSource]; // eslint-disable-next-line guard-for-in
2010
2011 for (key in variableValues) {
2012 UtilsFilterControl.addOptionToSelectControl(selectControl, key, variableValues[key], column.filterDefault);
2013 }
2014
2015 UtilsFilterControl.sortSelectControl(selectControl, column.filterOrderBy);
2016 break;
2017
2018 case 'jso':
2019 variableValues = JSON.parse(filterDataSource); // eslint-disable-next-line guard-for-in
2020
2021 for (key in variableValues) {
2022 UtilsFilterControl.addOptionToSelectControl(selectControl, key, variableValues[key], column.filterDefault);
2023 }
2024
2025 UtilsFilterControl.sortSelectControl(selectControl, column.filterOrderBy);
2026 break;
2027 }
2028 }
2029 });
2030
2031 if (addedFilterControl) {
2032 header.off('keyup', 'input').on('keyup', 'input', function (event, obj) {
2033 // Simulate enter key action from clear button
2034 event.keyCode = obj ? obj.keyCode : event.keyCode;
2035
2036 if (that.options.searchOnEnterKey && event.keyCode !== 13) {
2037 return;
2038 }
2039
2040 if ($.inArray(event.keyCode, [37, 38, 39, 40]) > -1) {
2041 return;
2042 }
2043
2044 var $currentTarget = $(event.currentTarget);
2045
2046 if ($currentTarget.is(':checkbox') || $currentTarget.is(':radio')) {
2047 return;
2048 }
2049
2050 clearTimeout(event.currentTarget.timeoutId || 0);
2051 event.currentTarget.timeoutId = setTimeout(function () {
2052 that.onColumnSearch(event);
2053 }, that.options.searchTimeOut);
2054 });
2055 header.off('change', 'select').on('change', 'select', function (event) {
2056 if (that.options.searchOnEnterKey && event.keyCode !== 13) {
2057 return;
2058 }
2059
2060 if ($.inArray(event.keyCode, [37, 38, 39, 40]) > -1) {
2061 return;
2062 }
2063
2064 clearTimeout(event.currentTarget.timeoutId || 0);
2065 event.currentTarget.timeoutId = setTimeout(function () {
2066 that.onColumnSearch(event);
2067 }, that.options.searchTimeOut);
2068 });
2069 header.off('mouseup', 'input').on('mouseup', 'input', function (event) {
2070 var $input = $(this);
2071 var oldValue = $input.val();
2072
2073 if (oldValue === '') {
2074 return;
2075 }
2076
2077 setTimeout(function () {
2078 var newValue = $input.val();
2079
2080 if (newValue === '') {
2081 clearTimeout(event.currentTarget.timeoutId || 0);
2082 event.currentTarget.timeoutId = setTimeout(function () {
2083 that.onColumnSearch(event);
2084 }, that.options.searchTimeOut);
2085 }
2086 }, 1);
2087 });
2088
2089 if (header.find('.date-filter-control').length > 0) {
2090 $.each(that.columns, function (i, _ref6) {
2091 var filterControl = _ref6.filterControl,
2092 field = _ref6.field,
2093 filterDatepickerOptions = _ref6.filterDatepickerOptions;
2094
2095 if (filterControl !== undefined && filterControl.toLowerCase() === 'datepicker') {
2096 header.find(".date-filter-control.bootstrap-table-filter-control-".concat(field)).datepicker(filterDatepickerOptions).on('changeDate', function (event) {
2097 clearTimeout(event.currentTarget.timeoutId || 0);
2098 event.currentTarget.timeoutId = setTimeout(function () {
2099 that.onColumnSearch(event);
2100 }, that.options.searchTimeOut);
2101 });
2102 }
2103 });
2104 }
2105
2106 if (that.options.sidePagination !== 'server') {
2107 header.find('[class*=\'bootstrap-table-filter-control\']').each(function (k, input) {
2108 $(input).trigger('change');
2109 });
2110 }
2111 } else {
2112 header.find('.filterControl').hide();
2113 }
2114 },
2115 getDirectionOfSelectOptions: function getDirectionOfSelectOptions(_alignment) {
2116 var alignment = _alignment === undefined ? 'left' : _alignment.toLowerCase();
2117
2118 switch (alignment) {
2119 case 'left':
2120 return 'ltr';
2121
2122 case 'right':
2123 return 'rtl';
2124
2125 case 'auto':
2126 return 'auto';
2127
2128 default:
2129 return 'ltr';
2130 }
2131 }
2132 };
2133 var filterDataMethods = {
2134 var: function _var(filterDataSource, selectControl, filterOrderBy, selected) {
2135 var variableValues = window[filterDataSource]; // eslint-disable-next-line guard-for-in
2136
2137 for (var key in variableValues) {
2138 UtilsFilterControl.addOptionToSelectControl(selectControl, key, variableValues[key], selected);
2139 }
2140
2141 UtilsFilterControl.sortSelectControl(selectControl, filterOrderBy);
2142 },
2143 url: function url(filterDataSource, selectControl, filterOrderBy, selected) {
2144 $.ajax({
2145 url: filterDataSource,
2146 dataType: 'json',
2147 success: function success(data) {
2148 // eslint-disable-next-line guard-for-in
2149 for (var key in data) {
2150 UtilsFilterControl.addOptionToSelectControl(selectControl, key, data[key], selected);
2151 }
2152
2153 UtilsFilterControl.sortSelectControl(selectControl, filterOrderBy);
2154 }
2155 });
2156 },
2157 json: function json(filterDataSource, selectControl, filterOrderBy, selected) {
2158 var variableValues = JSON.parse(filterDataSource); // eslint-disable-next-line guard-for-in
2159
2160 for (var key in variableValues) {
2161 UtilsFilterControl.addOptionToSelectControl(selectControl, key, variableValues[key], selected);
2162 }
2163
2164 UtilsFilterControl.sortSelectControl(selectControl, filterOrderBy);
2165 }
2166 };
2167 $.extend($.fn.bootstrapTable.defaults, {
2168 filterControl: false,
2169 onColumnSearch: function onColumnSearch(field, text) {
2170 return false;
2171 },
2172 onCreatedControls: function onCreatedControls() {
2173 return true;
2174 },
2175 alignmentSelectControlOptions: undefined,
2176 filterTemplate: {
2177 input: function input(that, field, isVisible, placeholder, value) {
2178 return Utils.sprintf('<input type="text" class="form-control bootstrap-table-filter-control-%s" style="width: 100%; visibility: %s" placeholder="%s" value="%s">', field, isVisible, 'undefined' === typeof placeholder ? '' : placeholder, 'undefined' === typeof value ? '' : value);
2179 },
2180 select: function select(_ref7, field, isVisible) {
2181 var options = _ref7.options;
2182 return Utils.sprintf('<select class="form-control bootstrap-table-filter-control-%s" style="width: 100%; visibility: %s" dir="%s"></select>', field, isVisible, UtilsFilterControl.getDirectionOfSelectOptions(options.alignmentSelectControlOptions));
2183 },
2184 datepicker: function datepicker(that, field, isVisible, value) {
2185 return Utils.sprintf('<input type="text" class="form-control date-filter-control bootstrap-table-filter-control-%s" style="width: 100%; visibility: %s" value="%s">', field, isVisible, 'undefined' === typeof value ? '' : value);
2186 }
2187 },
2188 disableControlWhenSearch: false,
2189 searchOnEnterKey: false,
2190 // internal variables
2191 valuesFilterControl: []
2192 });
2193 $.extend($.fn.bootstrapTable.columnDefaults, {
2194 filterControl: undefined,
2195 filterDataCollector: undefined,
2196 filterData: undefined,
2197 filterDatepickerOptions: undefined,
2198 filterStrictSearch: false,
2199 filterStartsWithSearch: false,
2200 filterControlPlaceholder: '',
2201 filterDefault: '',
2202 filterOrderBy: 'asc' // asc || desc
2203
2204 });
2205 $.extend($.fn.bootstrapTable.Constructor.EVENTS, {
2206 'column-search.bs.table': 'onColumnSearch',
2207 'created-controls.bs.table': 'onCreatedControls'
2208 });
2209 $.extend($.fn.bootstrapTable.defaults.icons, {
2210 clear: {
2211 bootstrap3: 'glyphicon-trash icon-clear'
2212 }[$.fn.bootstrapTable.theme] || 'fa-trash'
2213 });
2214 $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales);
2215 $.extend($.fn.bootstrapTable.defaults, {
2216 formatClearSearch: function formatClearSearch() {
2217 return 'Clear filters';
2218 }
2219 });
2220 $.fn.bootstrapTable.methods.push('triggerSearch');
2221 $.fn.bootstrapTable.methods.push('clearFilterControl');
2222
2223 $.BootstrapTable =
2224 /*#__PURE__*/
2225 function (_$$BootstrapTable) {
2226 _inherits(_class, _$$BootstrapTable);
2227
2228 function _class() {
2229 _classCallCheck(this, _class);
2230
2231 return _possibleConstructorReturn(this, _getPrototypeOf(_class).apply(this, arguments));
2232 }
2233
2234 _createClass(_class, [{
2235 key: "init",
2236 value: function init() {
2237 var _this = this;
2238
2239 // Make sure that the filterControl option is set
2240 if (this.options.filterControl) {
2241 var that = this; // Make sure that the internal variables are set correctly
2242
2243 this.options.valuesFilterControl = [];
2244 this.$el.on('reset-view.bs.table', function () {
2245 // Create controls on $tableHeader if the height is set
2246 if (!that.options.height) {
2247 return;
2248 } // Avoid recreate the controls
2249
2250
2251 if (that.$tableHeader.find('select').length > 0 || that.$tableHeader.find('input').length > 0) {
2252 return;
2253 }
2254
2255 UtilsFilterControl.createControls(that, that.$tableHeader);
2256 }).on('post-header.bs.table', function () {
2257 UtilsFilterControl.setValues(that);
2258 }).on('post-body.bs.table', function () {
2259 if (that.options.height) {
2260 UtilsFilterControl.fixHeaderCSS(that);
2261 }
2262
2263 _this.$tableLoading.css('top', _this.$header.outerHeight() + 1);
2264 }).on('column-switch.bs.table', function () {
2265 UtilsFilterControl.setValues(that);
2266 }).on('load-success.bs.table', function () {
2267 that.EnableControls(true);
2268 }).on('load-error.bs.table', function () {
2269 that.EnableControls(true);
2270 });
2271 }
2272
2273 _get(_getPrototypeOf(_class.prototype), "init", this).call(this);
2274 }
2275 }, {
2276 key: "initHeader",
2277 value: function initHeader() {
2278 _get(_getPrototypeOf(_class.prototype), "initHeader", this).call(this);
2279
2280 if (!this.options.filterControl) {
2281 return;
2282 }
2283
2284 UtilsFilterControl.createControls(this, this.$header);
2285 }
2286 }, {
2287 key: "initBody",
2288 value: function initBody() {
2289 _get(_getPrototypeOf(_class.prototype), "initBody", this).call(this);
2290
2291 UtilsFilterControl.initFilterSelectControls(this);
2292 }
2293 }, {
2294 key: "initSearch",
2295 value: function initSearch() {
2296 var that = this;
2297 var fp = $.isEmptyObject(that.filterColumnsPartial) ? null : that.filterColumnsPartial;
2298
2299 if (fp === null || Object.keys(fp).length <= 1) {
2300 _get(_getPrototypeOf(_class.prototype), "initSearch", this).call(this);
2301 }
2302
2303 if (this.options.sidePagination === 'server') {
2304 return;
2305 }
2306
2307 if (fp === null) {
2308 return;
2309 } // Check partial column filter
2310
2311
2312 that.data = fp ? that.options.data.filter(function (item, i) {
2313 var itemIsExpected = [];
2314 Object.keys(item).forEach(function (x, index) {
2315 var key = that.header.fields[index];
2316 var thisColumn = that.columns[that.fieldsColumnsIndex[key]];
2317 var fval = (fp[key] || '').toLowerCase();
2318 var value = Utils.getItemField(item, key, false);
2319
2320 if (fval === '') {
2321 itemIsExpected.push(true);
2322 } else {
2323 // Fix #142: search use formated data
2324 if (thisColumn && thisColumn.searchFormatter) {
2325 value = $.fn.bootstrapTable.utils.calculateObjectValue(that.header, that.header.formatters[$.inArray(key, that.header.fields)], [value, item, i], value);
2326 }
2327
2328 if ($.inArray(key, that.header.fields) !== -1) {
2329 if (value === undefined || value === null) {
2330 itemIsExpected.push(false);
2331 } else if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
2332 if (thisColumn.filterStrictSearch) {
2333 itemIsExpected.push(value.toString().toLowerCase() === fval.toString().toLowerCase());
2334 } else if (thisColumn.filterStartsWithSearch) {
2335 itemIsExpected.push("".concat(value).toLowerCase().indexOf(fval) === 0);
2336 } else {
2337 itemIsExpected.push("".concat(value).toLowerCase().includes(fval));
2338 }
2339 }
2340 }
2341 }
2342 });
2343 return !itemIsExpected.includes(false);
2344 }) : that.data;
2345 }
2346 }, {
2347 key: "initColumnSearch",
2348 value: function initColumnSearch(filterColumnsDefaults) {
2349 UtilsFilterControl.copyValues(this);
2350
2351 if (filterColumnsDefaults) {
2352 this.filterColumnsPartial = filterColumnsDefaults;
2353 this.updatePagination(); // eslint-disable-next-line guard-for-in
2354
2355 for (var filter in filterColumnsDefaults) {
2356 this.trigger('column-search', filter, filterColumnsDefaults[filter]);
2357 }
2358 }
2359 }
2360 }, {
2361 key: "onColumnSearch",
2362 value: function onColumnSearch(event) {
2363 if ($.inArray(event.keyCode, [37, 38, 39, 40]) > -1) {
2364 return;
2365 }
2366
2367 UtilsFilterControl.copyValues(this);
2368 var text = $.trim($(event.currentTarget).val());
2369 var $field = $(event.currentTarget).closest('[data-field]').data('field');
2370
2371 if ($.isEmptyObject(this.filterColumnsPartial)) {
2372 this.filterColumnsPartial = {};
2373 }
2374
2375 if (text) {
2376 this.filterColumnsPartial[$field] = text;
2377 } else {
2378 delete this.filterColumnsPartial[$field];
2379 }
2380
2381 this.options.pageNumber = 1;
2382 this.EnableControls(false);
2383 this.onSearch(event, false);
2384 this.trigger('column-search', $field, text);
2385 }
2386 }, {
2387 key: "initToolbar",
2388 value: function initToolbar() {
2389 this.showSearchClearButton = this.options.filterControl && this.options.showSearchClearButton;
2390
2391 _get(_getPrototypeOf(_class.prototype), "initToolbar", this).call(this);
2392 }
2393 }, {
2394 key: "resetSearch",
2395 value: function resetSearch() {
2396 if (this.options.filterControl && this.options.showSearchClearButton) {
2397 this.clearFilterControl();
2398 }
2399
2400 _get(_getPrototypeOf(_class.prototype), "resetSearch", this).call(this);
2401 }
2402 }, {
2403 key: "clearFilterControl",
2404 value: function clearFilterControl() {
2405 if (this.options.filterControl) {
2406 var that = this;
2407 var cookies = UtilsFilterControl.collectBootstrapCookies();
2408 var header = UtilsFilterControl.getCurrentHeader(that);
2409 var table = header.closest('table');
2410 var controls = header.find(UtilsFilterControl.getCurrentSearchControls(that));
2411 var search = that.$toolbar.find('.search input');
2412 var hasValues = false;
2413 var timeoutId = 0;
2414 $.each(that.options.valuesFilterControl, function (i, item) {
2415 hasValues = hasValues ? true : item.value !== '';
2416 item.value = '';
2417 });
2418 $.each(that.options.filterControls, function (i, item) {
2419 item.text = '';
2420 });
2421 UtilsFilterControl.setValues(that); // clear cookies once the filters are clean
2422
2423 clearTimeout(timeoutId);
2424 timeoutId = setTimeout(function () {
2425 if (cookies && cookies.length > 0) {
2426 $.each(cookies, function (i, item) {
2427 if (that.deleteCookie !== undefined) {
2428 that.deleteCookie(item);
2429 }
2430 });
2431 }
2432 }, that.options.searchTimeOut); // If there is not any value in the controls exit this method
2433
2434 if (!hasValues) {
2435 return;
2436 } // Clear each type of filter if it exists.
2437 // Requires the body to reload each time a type of filter is found because we never know
2438 // which ones are going to be present.
2439
2440
2441 if (controls.length > 0) {
2442 this.filterColumnsPartial = {};
2443 $(controls[0]).trigger(controls[0].tagName === 'INPUT' ? 'keyup' : 'change', {
2444 keyCode: 13
2445 });
2446 } else {
2447 return;
2448 }
2449
2450 if (search.length > 0) {
2451 that.resetSearch();
2452 } // use the default sort order if it exists. do nothing if it does not
2453
2454
2455 if (that.options.sortName !== table.data('sortName') || that.options.sortOrder !== table.data('sortOrder')) {
2456 var sorter = header.find(Utils.sprintf('[data-field="%s"]', $(controls[0]).closest('table').data('sortName')));
2457
2458 if (sorter.length > 0) {
2459 that.onSort({
2460 type: 'keypress',
2461 currentTarget: sorter
2462 });
2463 $(sorter).find('.sortable').trigger('click');
2464 }
2465 }
2466 }
2467 }
2468 }, {
2469 key: "triggerSearch",
2470 value: function triggerSearch() {
2471 var header = UtilsFilterControl.getCurrentHeader(this);
2472 var searchControls = UtilsFilterControl.getCurrentSearchControls(this);
2473 header.find(searchControls).each(function () {
2474 var el = $(this);
2475
2476 if (el.is('select')) {
2477 el.change();
2478 } else {
2479 el.keyup();
2480 }
2481 });
2482 }
2483 }, {
2484 key: "EnableControls",
2485 value: function EnableControls(enable) {
2486 if (this.options.disableControlWhenSearch && this.options.sidePagination === 'server') {
2487 var header = UtilsFilterControl.getCurrentHeader(this);
2488 var searchControls = UtilsFilterControl.getCurrentSearchControls(this);
2489
2490 if (!enable) {
2491 header.find(searchControls).prop('disabled', 'disabled');
2492 } else {
2493 header.find(searchControls).removeProp('disabled');
2494 }
2495 }
2496 }
2497 }]);
2498
2499 return _class;
2500 }($.BootstrapTable);
2501
2502}));