UNPKG

125 kBJavaScriptView Raw
1function _typeof(obj) {
2 if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
3 _typeof = function (obj) {
4 return typeof obj;
5 };
6 } else {
7 _typeof = function (obj) {
8 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
9 };
10 }
11
12 return _typeof(obj);
13}
14
15function _classCallCheck(instance, Constructor) {
16 if (!(instance instanceof Constructor)) {
17 throw new TypeError("Cannot call a class as a function");
18 }
19}
20
21function _defineProperties(target, props) {
22 for (var i = 0; i < props.length; i++) {
23 var descriptor = props[i];
24 descriptor.enumerable = descriptor.enumerable || false;
25 descriptor.configurable = true;
26 if ("value" in descriptor) descriptor.writable = true;
27 Object.defineProperty(target, descriptor.key, descriptor);
28 }
29}
30
31function _createClass(Constructor, protoProps, staticProps) {
32 if (protoProps) _defineProperties(Constructor.prototype, protoProps);
33 if (staticProps) _defineProperties(Constructor, staticProps);
34 return Constructor;
35}
36
37function _taggedTemplateLiteral(strings, raw) {
38 if (!raw) {
39 raw = strings.slice(0);
40 }
41
42 return Object.freeze(Object.defineProperties(strings, {
43 raw: {
44 value: Object.freeze(raw)
45 }
46 }));
47}
48
49var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
50
51function createCommonjsModule(fn, module) {
52 return module = { exports: {} }, fn(module, module.exports), module.exports;
53}
54
55var O = 'object';
56var check = function (it) {
57 return it && it.Math == Math && it;
58};
59
60// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
61var global_1 =
62 // eslint-disable-next-line no-undef
63 check(typeof globalThis == O && globalThis) ||
64 check(typeof window == O && window) ||
65 check(typeof self == O && self) ||
66 check(typeof commonjsGlobal == O && commonjsGlobal) ||
67 // eslint-disable-next-line no-new-func
68 Function('return this')();
69
70var fails = function (exec) {
71 try {
72 return !!exec();
73 } catch (error) {
74 return true;
75 }
76};
77
78// Thank's IE8 for his funny defineProperty
79var descriptors = !fails(function () {
80 return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
81});
82
83var nativePropertyIsEnumerable = {}.propertyIsEnumerable;
84var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
85
86// Nashorn ~ JDK8 bug
87var NASHORN_BUG = getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1);
88
89// `Object.prototype.propertyIsEnumerable` method implementation
90// https://tc39.github.io/ecma262/#sec-object.prototype.propertyisenumerable
91var f = NASHORN_BUG ? function propertyIsEnumerable(V) {
92 var descriptor = getOwnPropertyDescriptor(this, V);
93 return !!descriptor && descriptor.enumerable;
94} : nativePropertyIsEnumerable;
95
96var objectPropertyIsEnumerable = {
97 f: f
98};
99
100var createPropertyDescriptor = function (bitmap, value) {
101 return {
102 enumerable: !(bitmap & 1),
103 configurable: !(bitmap & 2),
104 writable: !(bitmap & 4),
105 value: value
106 };
107};
108
109var toString = {}.toString;
110
111var classofRaw = function (it) {
112 return toString.call(it).slice(8, -1);
113};
114
115var split = ''.split;
116
117// fallback for non-array-like ES3 and non-enumerable old V8 strings
118var indexedObject = fails(function () {
119 // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
120 // eslint-disable-next-line no-prototype-builtins
121 return !Object('z').propertyIsEnumerable(0);
122}) ? function (it) {
123 return classofRaw(it) == 'String' ? split.call(it, '') : Object(it);
124} : Object;
125
126// `RequireObjectCoercible` abstract operation
127// https://tc39.github.io/ecma262/#sec-requireobjectcoercible
128var requireObjectCoercible = function (it) {
129 if (it == undefined) throw TypeError("Can't call method on " + it);
130 return it;
131};
132
133// toObject with fallback for non-array-like ES3 strings
134
135
136
137var toIndexedObject = function (it) {
138 return indexedObject(requireObjectCoercible(it));
139};
140
141var isObject = function (it) {
142 return typeof it === 'object' ? it !== null : typeof it === 'function';
143};
144
145// `ToPrimitive` abstract operation
146// https://tc39.github.io/ecma262/#sec-toprimitive
147// instead of the ES6 spec version, we didn't implement @@toPrimitive case
148// and the second argument - flag - preferred type is a string
149var toPrimitive = function (input, PREFERRED_STRING) {
150 if (!isObject(input)) return input;
151 var fn, val;
152 if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
153 if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val;
154 if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
155 throw TypeError("Can't convert object to primitive value");
156};
157
158var hasOwnProperty = {}.hasOwnProperty;
159
160var has = function (it, key) {
161 return hasOwnProperty.call(it, key);
162};
163
164var document$1 = global_1.document;
165// typeof document.createElement is 'object' in old IE
166var EXISTS = isObject(document$1) && isObject(document$1.createElement);
167
168var documentCreateElement = function (it) {
169 return EXISTS ? document$1.createElement(it) : {};
170};
171
172// Thank's IE8 for his funny defineProperty
173var ie8DomDefine = !descriptors && !fails(function () {
174 return Object.defineProperty(documentCreateElement('div'), 'a', {
175 get: function () { return 7; }
176 }).a != 7;
177});
178
179var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
180
181// `Object.getOwnPropertyDescriptor` method
182// https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor
183var f$1 = descriptors ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
184 O = toIndexedObject(O);
185 P = toPrimitive(P, true);
186 if (ie8DomDefine) try {
187 return nativeGetOwnPropertyDescriptor(O, P);
188 } catch (error) { /* empty */ }
189 if (has(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]);
190};
191
192var objectGetOwnPropertyDescriptor = {
193 f: f$1
194};
195
196var anObject = function (it) {
197 if (!isObject(it)) {
198 throw TypeError(String(it) + ' is not an object');
199 } return it;
200};
201
202var nativeDefineProperty = Object.defineProperty;
203
204// `Object.defineProperty` method
205// https://tc39.github.io/ecma262/#sec-object.defineproperty
206var f$2 = descriptors ? nativeDefineProperty : function defineProperty(O, P, Attributes) {
207 anObject(O);
208 P = toPrimitive(P, true);
209 anObject(Attributes);
210 if (ie8DomDefine) try {
211 return nativeDefineProperty(O, P, Attributes);
212 } catch (error) { /* empty */ }
213 if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
214 if ('value' in Attributes) O[P] = Attributes.value;
215 return O;
216};
217
218var objectDefineProperty = {
219 f: f$2
220};
221
222var hide = descriptors ? function (object, key, value) {
223 return objectDefineProperty.f(object, key, createPropertyDescriptor(1, value));
224} : function (object, key, value) {
225 object[key] = value;
226 return object;
227};
228
229var setGlobal = function (key, value) {
230 try {
231 hide(global_1, key, value);
232 } catch (error) {
233 global_1[key] = value;
234 } return value;
235};
236
237var shared = createCommonjsModule(function (module) {
238var SHARED = '__core-js_shared__';
239var store = global_1[SHARED] || setGlobal(SHARED, {});
240
241(module.exports = function (key, value) {
242 return store[key] || (store[key] = value !== undefined ? value : {});
243})('versions', []).push({
244 version: '3.2.1',
245 mode: 'global',
246 copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
247});
248});
249
250var functionToString = shared('native-function-to-string', Function.toString);
251
252var WeakMap = global_1.WeakMap;
253
254var nativeWeakMap = typeof WeakMap === 'function' && /native code/.test(functionToString.call(WeakMap));
255
256var id = 0;
257var postfix = Math.random();
258
259var uid = function (key) {
260 return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);
261};
262
263var keys = shared('keys');
264
265var sharedKey = function (key) {
266 return keys[key] || (keys[key] = uid(key));
267};
268
269var hiddenKeys = {};
270
271var WeakMap$1 = global_1.WeakMap;
272var set, get, has$1;
273
274var enforce = function (it) {
275 return has$1(it) ? get(it) : set(it, {});
276};
277
278var getterFor = function (TYPE) {
279 return function (it) {
280 var state;
281 if (!isObject(it) || (state = get(it)).type !== TYPE) {
282 throw TypeError('Incompatible receiver, ' + TYPE + ' required');
283 } return state;
284 };
285};
286
287if (nativeWeakMap) {
288 var store = new WeakMap$1();
289 var wmget = store.get;
290 var wmhas = store.has;
291 var wmset = store.set;
292 set = function (it, metadata) {
293 wmset.call(store, it, metadata);
294 return metadata;
295 };
296 get = function (it) {
297 return wmget.call(store, it) || {};
298 };
299 has$1 = function (it) {
300 return wmhas.call(store, it);
301 };
302} else {
303 var STATE = sharedKey('state');
304 hiddenKeys[STATE] = true;
305 set = function (it, metadata) {
306 hide(it, STATE, metadata);
307 return metadata;
308 };
309 get = function (it) {
310 return has(it, STATE) ? it[STATE] : {};
311 };
312 has$1 = function (it) {
313 return has(it, STATE);
314 };
315}
316
317var internalState = {
318 set: set,
319 get: get,
320 has: has$1,
321 enforce: enforce,
322 getterFor: getterFor
323};
324
325var redefine = createCommonjsModule(function (module) {
326var getInternalState = internalState.get;
327var enforceInternalState = internalState.enforce;
328var TEMPLATE = String(functionToString).split('toString');
329
330shared('inspectSource', function (it) {
331 return functionToString.call(it);
332});
333
334(module.exports = function (O, key, value, options) {
335 var unsafe = options ? !!options.unsafe : false;
336 var simple = options ? !!options.enumerable : false;
337 var noTargetGet = options ? !!options.noTargetGet : false;
338 if (typeof value == 'function') {
339 if (typeof key == 'string' && !has(value, 'name')) hide(value, 'name', key);
340 enforceInternalState(value).source = TEMPLATE.join(typeof key == 'string' ? key : '');
341 }
342 if (O === global_1) {
343 if (simple) O[key] = value;
344 else setGlobal(key, value);
345 return;
346 } else if (!unsafe) {
347 delete O[key];
348 } else if (!noTargetGet && O[key]) {
349 simple = true;
350 }
351 if (simple) O[key] = value;
352 else hide(O, key, value);
353// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
354})(Function.prototype, 'toString', function toString() {
355 return typeof this == 'function' && getInternalState(this).source || functionToString.call(this);
356});
357});
358
359var path = global_1;
360
361var aFunction = function (variable) {
362 return typeof variable == 'function' ? variable : undefined;
363};
364
365var getBuiltIn = function (namespace, method) {
366 return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global_1[namespace])
367 : path[namespace] && path[namespace][method] || global_1[namespace] && global_1[namespace][method];
368};
369
370var ceil = Math.ceil;
371var floor = Math.floor;
372
373// `ToInteger` abstract operation
374// https://tc39.github.io/ecma262/#sec-tointeger
375var toInteger = function (argument) {
376 return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument);
377};
378
379var min = Math.min;
380
381// `ToLength` abstract operation
382// https://tc39.github.io/ecma262/#sec-tolength
383var toLength = function (argument) {
384 return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
385};
386
387var max = Math.max;
388var min$1 = Math.min;
389
390// Helper for a popular repeating case of the spec:
391// Let integer be ? ToInteger(index).
392// If integer < 0, let result be max((length + integer), 0); else let result be min(length, length).
393var toAbsoluteIndex = function (index, length) {
394 var integer = toInteger(index);
395 return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
396};
397
398// `Array.prototype.{ indexOf, includes }` methods implementation
399var createMethod = function (IS_INCLUDES) {
400 return function ($this, el, fromIndex) {
401 var O = toIndexedObject($this);
402 var length = toLength(O.length);
403 var index = toAbsoluteIndex(fromIndex, length);
404 var value;
405 // Array#includes uses SameValueZero equality algorithm
406 // eslint-disable-next-line no-self-compare
407 if (IS_INCLUDES && el != el) while (length > index) {
408 value = O[index++];
409 // eslint-disable-next-line no-self-compare
410 if (value != value) return true;
411 // Array#indexOf ignores holes, Array#includes - not
412 } else for (;length > index; index++) {
413 if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
414 } return !IS_INCLUDES && -1;
415 };
416};
417
418var arrayIncludes = {
419 // `Array.prototype.includes` method
420 // https://tc39.github.io/ecma262/#sec-array.prototype.includes
421 includes: createMethod(true),
422 // `Array.prototype.indexOf` method
423 // https://tc39.github.io/ecma262/#sec-array.prototype.indexof
424 indexOf: createMethod(false)
425};
426
427var indexOf = arrayIncludes.indexOf;
428
429
430var objectKeysInternal = function (object, names) {
431 var O = toIndexedObject(object);
432 var i = 0;
433 var result = [];
434 var key;
435 for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key);
436 // Don't enum bug & hidden keys
437 while (names.length > i) if (has(O, key = names[i++])) {
438 ~indexOf(result, key) || result.push(key);
439 }
440 return result;
441};
442
443// IE8- don't enum bug keys
444var enumBugKeys = [
445 'constructor',
446 'hasOwnProperty',
447 'isPrototypeOf',
448 'propertyIsEnumerable',
449 'toLocaleString',
450 'toString',
451 'valueOf'
452];
453
454var hiddenKeys$1 = enumBugKeys.concat('length', 'prototype');
455
456// `Object.getOwnPropertyNames` method
457// https://tc39.github.io/ecma262/#sec-object.getownpropertynames
458var f$3 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
459 return objectKeysInternal(O, hiddenKeys$1);
460};
461
462var objectGetOwnPropertyNames = {
463 f: f$3
464};
465
466var f$4 = Object.getOwnPropertySymbols;
467
468var objectGetOwnPropertySymbols = {
469 f: f$4
470};
471
472// all object keys, includes non-enumerable and symbols
473var 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
479var 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(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
486 }
487};
488
489var replacement = /#|\.prototype\./;
490
491var 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
499var normalize = isForced.normalize = function (string) {
500 return String(string).replace(replacement, '.').toLowerCase();
501};
502
503var data = isForced.data = {};
504var NATIVE = isForced.NATIVE = 'N';
505var POLYFILL = isForced.POLYFILL = 'P';
506
507var isForced_1 = isForced;
508
509var getOwnPropertyDescriptor$1 = 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*/
530var _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$1(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 hide(sourceProperty, 'sham', true);
557 }
558 // extend global
559 redefine(target, key, sourceProperty, options);
560 }
561};
562
563var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () {
564 // Chrome 38 Symbol has incorrect toString conversion
565 // eslint-disable-next-line no-undef
566 return !String(Symbol());
567});
568
569var Symbol$1 = global_1.Symbol;
570var store$1 = shared('wks');
571
572var wellKnownSymbol = function (name) {
573 return store$1[name] || (store$1[name] = nativeSymbol && Symbol$1[name]
574 || (nativeSymbol ? Symbol$1 : uid)('Symbol.' + name));
575};
576
577// `Object.keys` method
578// https://tc39.github.io/ecma262/#sec-object.keys
579var objectKeys = Object.keys || function keys(O) {
580 return objectKeysInternal(O, enumBugKeys);
581};
582
583// `Object.defineProperties` method
584// https://tc39.github.io/ecma262/#sec-object.defineproperties
585var objectDefineProperties = descriptors ? Object.defineProperties : function defineProperties(O, Properties) {
586 anObject(O);
587 var keys = objectKeys(Properties);
588 var length = keys.length;
589 var index = 0;
590 var key;
591 while (length > index) objectDefineProperty.f(O, key = keys[index++], Properties[key]);
592 return O;
593};
594
595var html = getBuiltIn('document', 'documentElement');
596
597var IE_PROTO = sharedKey('IE_PROTO');
598
599var PROTOTYPE = 'prototype';
600var Empty = function () { /* empty */ };
601
602// Create object with fake `null` prototype: use iframe Object with cleared prototype
603var createDict = function () {
604 // Thrash, waste and sodomy: IE GC bug
605 var iframe = documentCreateElement('iframe');
606 var length = enumBugKeys.length;
607 var lt = '<';
608 var script = 'script';
609 var gt = '>';
610 var js = 'java' + script + ':';
611 var iframeDocument;
612 iframe.style.display = 'none';
613 html.appendChild(iframe);
614 iframe.src = String(js);
615 iframeDocument = iframe.contentWindow.document;
616 iframeDocument.open();
617 iframeDocument.write(lt + script + gt + 'document.F=Object' + lt + '/' + script + gt);
618 iframeDocument.close();
619 createDict = iframeDocument.F;
620 while (length--) delete createDict[PROTOTYPE][enumBugKeys[length]];
621 return createDict();
622};
623
624// `Object.create` method
625// https://tc39.github.io/ecma262/#sec-object.create
626var objectCreate = Object.create || function create(O, Properties) {
627 var result;
628 if (O !== null) {
629 Empty[PROTOTYPE] = anObject(O);
630 result = new Empty();
631 Empty[PROTOTYPE] = null;
632 // add "__proto__" for Object.getPrototypeOf polyfill
633 result[IE_PROTO] = O;
634 } else result = createDict();
635 return Properties === undefined ? result : objectDefineProperties(result, Properties);
636};
637
638hiddenKeys[IE_PROTO] = true;
639
640var UNSCOPABLES = wellKnownSymbol('unscopables');
641var ArrayPrototype = Array.prototype;
642
643// Array.prototype[@@unscopables]
644// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
645if (ArrayPrototype[UNSCOPABLES] == undefined) {
646 hide(ArrayPrototype, UNSCOPABLES, objectCreate(null));
647}
648
649// add a key to Array.prototype[@@unscopables]
650var addToUnscopables = function (key) {
651 ArrayPrototype[UNSCOPABLES][key] = true;
652};
653
654var $includes = arrayIncludes.includes;
655
656
657// `Array.prototype.includes` method
658// https://tc39.github.io/ecma262/#sec-array.prototype.includes
659_export({ target: 'Array', proto: true }, {
660 includes: function includes(el /* , fromIndex = 0 */) {
661 return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
662 }
663});
664
665// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
666addToUnscopables('includes');
667
668// `ToObject` abstract operation
669// https://tc39.github.io/ecma262/#sec-toobject
670var toObject = function (argument) {
671 return Object(requireObjectCoercible(argument));
672};
673
674var nativeAssign = Object.assign;
675
676// `Object.assign` method
677// https://tc39.github.io/ecma262/#sec-object.assign
678// should work with symbols and should have deterministic property order (V8 bug)
679var objectAssign = !nativeAssign || fails(function () {
680 var A = {};
681 var B = {};
682 // eslint-disable-next-line no-undef
683 var symbol = Symbol();
684 var alphabet = 'abcdefghijklmnopqrst';
685 A[symbol] = 7;
686 alphabet.split('').forEach(function (chr) { B[chr] = chr; });
687 return nativeAssign({}, A)[symbol] != 7 || objectKeys(nativeAssign({}, B)).join('') != alphabet;
688}) ? function assign(target, source) { // eslint-disable-line no-unused-vars
689 var T = toObject(target);
690 var argumentsLength = arguments.length;
691 var index = 1;
692 var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
693 var propertyIsEnumerable = objectPropertyIsEnumerable.f;
694 while (argumentsLength > index) {
695 var S = indexedObject(arguments[index++]);
696 var keys = getOwnPropertySymbols ? objectKeys(S).concat(getOwnPropertySymbols(S)) : objectKeys(S);
697 var length = keys.length;
698 var j = 0;
699 var key;
700 while (length > j) {
701 key = keys[j++];
702 if (!descriptors || propertyIsEnumerable.call(S, key)) T[key] = S[key];
703 }
704 } return T;
705} : nativeAssign;
706
707// `Object.assign` method
708// https://tc39.github.io/ecma262/#sec-object.assign
709_export({ target: 'Object', stat: true, forced: Object.assign !== objectAssign }, {
710 assign: objectAssign
711});
712
713var MATCH = wellKnownSymbol('match');
714
715// `IsRegExp` abstract operation
716// https://tc39.github.io/ecma262/#sec-isregexp
717var isRegexp = function (it) {
718 var isRegExp;
719 return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classofRaw(it) == 'RegExp');
720};
721
722var notARegexp = function (it) {
723 if (isRegexp(it)) {
724 throw TypeError("The method doesn't accept regular expressions");
725 } return it;
726};
727
728var MATCH$1 = wellKnownSymbol('match');
729
730var correctIsRegexpLogic = function (METHOD_NAME) {
731 var regexp = /./;
732 try {
733 '/./'[METHOD_NAME](regexp);
734 } catch (e) {
735 try {
736 regexp[MATCH$1] = false;
737 return '/./'[METHOD_NAME](regexp);
738 } catch (f) { /* empty */ }
739 } return false;
740};
741
742// `String.prototype.includes` method
743// https://tc39.github.io/ecma262/#sec-string.prototype.includes
744_export({ target: 'String', proto: true, forced: !correctIsRegexpLogic('includes') }, {
745 includes: function includes(searchString /* , position = 0 */) {
746 return !!~String(requireObjectCoercible(this))
747 .indexOf(notARegexp(searchString), arguments.length > 1 ? arguments[1] : undefined);
748 }
749});
750
751var VERSION = '1.4.1';
752var DEFAULTS = {
753 name: '',
754 placeholder: '',
755 data: undefined,
756 locale: undefined,
757 selectAll: true,
758 single: false,
759 singleRadio: false,
760 multiple: false,
761 hideOptgroupCheckboxes: false,
762 multipleWidth: 80,
763 width: undefined,
764 dropWidth: undefined,
765 maxHeight: 250,
766 position: 'bottom',
767 displayHtml: false,
768 displayValues: false,
769 displayTitle: false,
770 displayDelimiter: ', ',
771 minimumCountSelected: 3,
772 ellipsis: false,
773 isOpen: false,
774 keepOpen: false,
775 openOnHover: false,
776 container: null,
777 filter: false,
778 filterGroup: false,
779 filterPlaceholder: '',
780 filterAcceptOnEnter: false,
781 filterByDataLength: undefined,
782 customFilter: function customFilter(label, text) {
783 // originalLabel, originalText
784 return label.includes(text);
785 },
786 animate: undefined,
787 styler: function styler() {
788 return false;
789 },
790 textTemplate: function textTemplate($elm) {
791 return $elm[0].innerHTML;
792 },
793 labelTemplate: function labelTemplate($elm) {
794 return $elm[0].getAttribute('label');
795 },
796 onOpen: function onOpen() {
797 return false;
798 },
799 onClose: function onClose() {
800 return false;
801 },
802 onCheckAll: function onCheckAll() {
803 return false;
804 },
805 onUncheckAll: function onUncheckAll() {
806 return false;
807 },
808 onFocus: function onFocus() {
809 return false;
810 },
811 onBlur: function onBlur() {
812 return false;
813 },
814 onOptgroupClick: function onOptgroupClick() {
815 return false;
816 },
817 onClick: function onClick() {
818 return false;
819 },
820 onFilter: function onFilter() {
821 return false;
822 },
823 onAfterCreate: function onAfterCreate() {
824 return false;
825 }
826};
827var EN = {
828 formatSelectAll: function formatSelectAll() {
829 return '[Select all]';
830 },
831 formatAllSelected: function formatAllSelected() {
832 return 'All selected';
833 },
834 formatCountSelected: function formatCountSelected(count, total) {
835 return count + ' of ' + total + ' selected';
836 },
837 formatNoMatchesFound: function formatNoMatchesFound() {
838 return 'No matches found';
839 }
840};
841var METHODS = ['getOptions', 'refreshOptions', 'getSelects', 'setSelects', 'enable', 'disable', 'open', 'close', 'check', 'uncheck', 'checkAll', 'uncheckAll', 'checkInvert', 'focus', 'blur', 'refresh', 'destroy'];
842Object.assign(DEFAULTS, EN);
843var Constants = {
844 VERSION: VERSION,
845 DEFAULTS: DEFAULTS,
846 METHODS: METHODS,
847 LOCALES: {
848 en: EN,
849 'en-US': EN
850 }
851};
852
853// `IsArray` abstract operation
854// https://tc39.github.io/ecma262/#sec-isarray
855var isArray = Array.isArray || function isArray(arg) {
856 return classofRaw(arg) == 'Array';
857};
858
859var nativeGetOwnPropertyNames = objectGetOwnPropertyNames.f;
860
861var toString$1 = {}.toString;
862
863var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
864 ? Object.getOwnPropertyNames(window) : [];
865
866var getWindowNames = function (it) {
867 try {
868 return nativeGetOwnPropertyNames(it);
869 } catch (error) {
870 return windowNames.slice();
871 }
872};
873
874// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
875var f$5 = function getOwnPropertyNames(it) {
876 return windowNames && toString$1.call(it) == '[object Window]'
877 ? getWindowNames(it)
878 : nativeGetOwnPropertyNames(toIndexedObject(it));
879};
880
881var objectGetOwnPropertyNamesExternal = {
882 f: f$5
883};
884
885var f$6 = wellKnownSymbol;
886
887var wrappedWellKnownSymbol = {
888 f: f$6
889};
890
891var defineProperty = objectDefineProperty.f;
892
893var defineWellKnownSymbol = function (NAME) {
894 var Symbol = path.Symbol || (path.Symbol = {});
895 if (!has(Symbol, NAME)) defineProperty(Symbol, NAME, {
896 value: wrappedWellKnownSymbol.f(NAME)
897 });
898};
899
900var defineProperty$1 = objectDefineProperty.f;
901
902
903
904var TO_STRING_TAG = wellKnownSymbol('toStringTag');
905
906var setToStringTag = function (it, TAG, STATIC) {
907 if (it && !has(it = STATIC ? it : it.prototype, TO_STRING_TAG)) {
908 defineProperty$1(it, TO_STRING_TAG, { configurable: true, value: TAG });
909 }
910};
911
912var aFunction$1 = function (it) {
913 if (typeof it != 'function') {
914 throw TypeError(String(it) + ' is not a function');
915 } return it;
916};
917
918// optional / simple context binding
919var bindContext = function (fn, that, length) {
920 aFunction$1(fn);
921 if (that === undefined) return fn;
922 switch (length) {
923 case 0: return function () {
924 return fn.call(that);
925 };
926 case 1: return function (a) {
927 return fn.call(that, a);
928 };
929 case 2: return function (a, b) {
930 return fn.call(that, a, b);
931 };
932 case 3: return function (a, b, c) {
933 return fn.call(that, a, b, c);
934 };
935 }
936 return function (/* ...args */) {
937 return fn.apply(that, arguments);
938 };
939};
940
941var SPECIES = wellKnownSymbol('species');
942
943// `ArraySpeciesCreate` abstract operation
944// https://tc39.github.io/ecma262/#sec-arrayspeciescreate
945var arraySpeciesCreate = function (originalArray, length) {
946 var C;
947 if (isArray(originalArray)) {
948 C = originalArray.constructor;
949 // cross-realm fallback
950 if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;
951 else if (isObject(C)) {
952 C = C[SPECIES];
953 if (C === null) C = undefined;
954 }
955 } return new (C === undefined ? Array : C)(length === 0 ? 0 : length);
956};
957
958var push = [].push;
959
960// `Array.prototype.{ forEach, map, filter, some, every, find, findIndex }` methods implementation
961var createMethod$1 = function (TYPE) {
962 var IS_MAP = TYPE == 1;
963 var IS_FILTER = TYPE == 2;
964 var IS_SOME = TYPE == 3;
965 var IS_EVERY = TYPE == 4;
966 var IS_FIND_INDEX = TYPE == 6;
967 var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
968 return function ($this, callbackfn, that, specificCreate) {
969 var O = toObject($this);
970 var self = indexedObject(O);
971 var boundFunction = bindContext(callbackfn, that, 3);
972 var length = toLength(self.length);
973 var index = 0;
974 var create = specificCreate || arraySpeciesCreate;
975 var target = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;
976 var value, result;
977 for (;length > index; index++) if (NO_HOLES || index in self) {
978 value = self[index];
979 result = boundFunction(value, index, O);
980 if (TYPE) {
981 if (IS_MAP) target[index] = result; // map
982 else if (result) switch (TYPE) {
983 case 3: return true; // some
984 case 5: return value; // find
985 case 6: return index; // findIndex
986 case 2: push.call(target, value); // filter
987 } else if (IS_EVERY) return false; // every
988 }
989 }
990 return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
991 };
992};
993
994var arrayIteration = {
995 // `Array.prototype.forEach` method
996 // https://tc39.github.io/ecma262/#sec-array.prototype.foreach
997 forEach: createMethod$1(0),
998 // `Array.prototype.map` method
999 // https://tc39.github.io/ecma262/#sec-array.prototype.map
1000 map: createMethod$1(1),
1001 // `Array.prototype.filter` method
1002 // https://tc39.github.io/ecma262/#sec-array.prototype.filter
1003 filter: createMethod$1(2),
1004 // `Array.prototype.some` method
1005 // https://tc39.github.io/ecma262/#sec-array.prototype.some
1006 some: createMethod$1(3),
1007 // `Array.prototype.every` method
1008 // https://tc39.github.io/ecma262/#sec-array.prototype.every
1009 every: createMethod$1(4),
1010 // `Array.prototype.find` method
1011 // https://tc39.github.io/ecma262/#sec-array.prototype.find
1012 find: createMethod$1(5),
1013 // `Array.prototype.findIndex` method
1014 // https://tc39.github.io/ecma262/#sec-array.prototype.findIndex
1015 findIndex: createMethod$1(6)
1016};
1017
1018var $forEach = arrayIteration.forEach;
1019
1020var HIDDEN = sharedKey('hidden');
1021var SYMBOL = 'Symbol';
1022var PROTOTYPE$1 = 'prototype';
1023var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
1024var setInternalState = internalState.set;
1025var getInternalState = internalState.getterFor(SYMBOL);
1026var ObjectPrototype = Object[PROTOTYPE$1];
1027var $Symbol = global_1.Symbol;
1028var JSON = global_1.JSON;
1029var nativeJSONStringify = JSON && JSON.stringify;
1030var nativeGetOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
1031var nativeDefineProperty$1 = objectDefineProperty.f;
1032var nativeGetOwnPropertyNames$1 = objectGetOwnPropertyNamesExternal.f;
1033var nativePropertyIsEnumerable$1 = objectPropertyIsEnumerable.f;
1034var AllSymbols = shared('symbols');
1035var ObjectPrototypeSymbols = shared('op-symbols');
1036var StringToSymbolRegistry = shared('string-to-symbol-registry');
1037var SymbolToStringRegistry = shared('symbol-to-string-registry');
1038var WellKnownSymbolsStore = shared('wks');
1039var QObject = global_1.QObject;
1040// Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
1041var USE_SETTER = !QObject || !QObject[PROTOTYPE$1] || !QObject[PROTOTYPE$1].findChild;
1042
1043// fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
1044var setSymbolDescriptor = descriptors && fails(function () {
1045 return objectCreate(nativeDefineProperty$1({}, 'a', {
1046 get: function () { return nativeDefineProperty$1(this, 'a', { value: 7 }).a; }
1047 })).a != 7;
1048}) ? function (O, P, Attributes) {
1049 var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor$1(ObjectPrototype, P);
1050 if (ObjectPrototypeDescriptor) delete ObjectPrototype[P];
1051 nativeDefineProperty$1(O, P, Attributes);
1052 if (ObjectPrototypeDescriptor && O !== ObjectPrototype) {
1053 nativeDefineProperty$1(ObjectPrototype, P, ObjectPrototypeDescriptor);
1054 }
1055} : nativeDefineProperty$1;
1056
1057var wrap = function (tag, description) {
1058 var symbol = AllSymbols[tag] = objectCreate($Symbol[PROTOTYPE$1]);
1059 setInternalState(symbol, {
1060 type: SYMBOL,
1061 tag: tag,
1062 description: description
1063 });
1064 if (!descriptors) symbol.description = description;
1065 return symbol;
1066};
1067
1068var isSymbol = nativeSymbol && typeof $Symbol.iterator == 'symbol' ? function (it) {
1069 return typeof it == 'symbol';
1070} : function (it) {
1071 return Object(it) instanceof $Symbol;
1072};
1073
1074var $defineProperty = function defineProperty(O, P, Attributes) {
1075 if (O === ObjectPrototype) $defineProperty(ObjectPrototypeSymbols, P, Attributes);
1076 anObject(O);
1077 var key = toPrimitive(P, true);
1078 anObject(Attributes);
1079 if (has(AllSymbols, key)) {
1080 if (!Attributes.enumerable) {
1081 if (!has(O, HIDDEN)) nativeDefineProperty$1(O, HIDDEN, createPropertyDescriptor(1, {}));
1082 O[HIDDEN][key] = true;
1083 } else {
1084 if (has(O, HIDDEN) && O[HIDDEN][key]) O[HIDDEN][key] = false;
1085 Attributes = objectCreate(Attributes, { enumerable: createPropertyDescriptor(0, false) });
1086 } return setSymbolDescriptor(O, key, Attributes);
1087 } return nativeDefineProperty$1(O, key, Attributes);
1088};
1089
1090var $defineProperties = function defineProperties(O, Properties) {
1091 anObject(O);
1092 var properties = toIndexedObject(Properties);
1093 var keys = objectKeys(properties).concat($getOwnPropertySymbols(properties));
1094 $forEach(keys, function (key) {
1095 if (!descriptors || $propertyIsEnumerable.call(properties, key)) $defineProperty(O, key, properties[key]);
1096 });
1097 return O;
1098};
1099
1100var $create = function create(O, Properties) {
1101 return Properties === undefined ? objectCreate(O) : $defineProperties(objectCreate(O), Properties);
1102};
1103
1104var $propertyIsEnumerable = function propertyIsEnumerable(V) {
1105 var P = toPrimitive(V, true);
1106 var enumerable = nativePropertyIsEnumerable$1.call(this, P);
1107 if (this === ObjectPrototype && has(AllSymbols, P) && !has(ObjectPrototypeSymbols, P)) return false;
1108 return enumerable || !has(this, P) || !has(AllSymbols, P) || has(this, HIDDEN) && this[HIDDEN][P] ? enumerable : true;
1109};
1110
1111var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(O, P) {
1112 var it = toIndexedObject(O);
1113 var key = toPrimitive(P, true);
1114 if (it === ObjectPrototype && has(AllSymbols, key) && !has(ObjectPrototypeSymbols, key)) return;
1115 var descriptor = nativeGetOwnPropertyDescriptor$1(it, key);
1116 if (descriptor && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) {
1117 descriptor.enumerable = true;
1118 }
1119 return descriptor;
1120};
1121
1122var $getOwnPropertyNames = function getOwnPropertyNames(O) {
1123 var names = nativeGetOwnPropertyNames$1(toIndexedObject(O));
1124 var result = [];
1125 $forEach(names, function (key) {
1126 if (!has(AllSymbols, key) && !has(hiddenKeys, key)) result.push(key);
1127 });
1128 return result;
1129};
1130
1131var $getOwnPropertySymbols = function getOwnPropertySymbols(O) {
1132 var IS_OBJECT_PROTOTYPE = O === ObjectPrototype;
1133 var names = nativeGetOwnPropertyNames$1(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toIndexedObject(O));
1134 var result = [];
1135 $forEach(names, function (key) {
1136 if (has(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || has(ObjectPrototype, key))) {
1137 result.push(AllSymbols[key]);
1138 }
1139 });
1140 return result;
1141};
1142
1143// `Symbol` constructor
1144// https://tc39.github.io/ecma262/#sec-symbol-constructor
1145if (!nativeSymbol) {
1146 $Symbol = function Symbol() {
1147 if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor');
1148 var description = !arguments.length || arguments[0] === undefined ? undefined : String(arguments[0]);
1149 var tag = uid(description);
1150 var setter = function (value) {
1151 if (this === ObjectPrototype) setter.call(ObjectPrototypeSymbols, value);
1152 if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false;
1153 setSymbolDescriptor(this, tag, createPropertyDescriptor(1, value));
1154 };
1155 if (descriptors && USE_SETTER) setSymbolDescriptor(ObjectPrototype, tag, { configurable: true, set: setter });
1156 return wrap(tag, description);
1157 };
1158
1159 redefine($Symbol[PROTOTYPE$1], 'toString', function toString() {
1160 return getInternalState(this).tag;
1161 });
1162
1163 objectPropertyIsEnumerable.f = $propertyIsEnumerable;
1164 objectDefineProperty.f = $defineProperty;
1165 objectGetOwnPropertyDescriptor.f = $getOwnPropertyDescriptor;
1166 objectGetOwnPropertyNames.f = objectGetOwnPropertyNamesExternal.f = $getOwnPropertyNames;
1167 objectGetOwnPropertySymbols.f = $getOwnPropertySymbols;
1168
1169 if (descriptors) {
1170 // https://github.com/tc39/proposal-Symbol-description
1171 nativeDefineProperty$1($Symbol[PROTOTYPE$1], 'description', {
1172 configurable: true,
1173 get: function description() {
1174 return getInternalState(this).description;
1175 }
1176 });
1177 {
1178 redefine(ObjectPrototype, 'propertyIsEnumerable', $propertyIsEnumerable, { unsafe: true });
1179 }
1180 }
1181
1182 wrappedWellKnownSymbol.f = function (name) {
1183 return wrap(wellKnownSymbol(name), name);
1184 };
1185}
1186
1187_export({ global: true, wrap: true, forced: !nativeSymbol, sham: !nativeSymbol }, {
1188 Symbol: $Symbol
1189});
1190
1191$forEach(objectKeys(WellKnownSymbolsStore), function (name) {
1192 defineWellKnownSymbol(name);
1193});
1194
1195_export({ target: SYMBOL, stat: true, forced: !nativeSymbol }, {
1196 // `Symbol.for` method
1197 // https://tc39.github.io/ecma262/#sec-symbol.for
1198 'for': function (key) {
1199 var string = String(key);
1200 if (has(StringToSymbolRegistry, string)) return StringToSymbolRegistry[string];
1201 var symbol = $Symbol(string);
1202 StringToSymbolRegistry[string] = symbol;
1203 SymbolToStringRegistry[symbol] = string;
1204 return symbol;
1205 },
1206 // `Symbol.keyFor` method
1207 // https://tc39.github.io/ecma262/#sec-symbol.keyfor
1208 keyFor: function keyFor(sym) {
1209 if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol');
1210 if (has(SymbolToStringRegistry, sym)) return SymbolToStringRegistry[sym];
1211 },
1212 useSetter: function () { USE_SETTER = true; },
1213 useSimple: function () { USE_SETTER = false; }
1214});
1215
1216_export({ target: 'Object', stat: true, forced: !nativeSymbol, sham: !descriptors }, {
1217 // `Object.create` method
1218 // https://tc39.github.io/ecma262/#sec-object.create
1219 create: $create,
1220 // `Object.defineProperty` method
1221 // https://tc39.github.io/ecma262/#sec-object.defineproperty
1222 defineProperty: $defineProperty,
1223 // `Object.defineProperties` method
1224 // https://tc39.github.io/ecma262/#sec-object.defineproperties
1225 defineProperties: $defineProperties,
1226 // `Object.getOwnPropertyDescriptor` method
1227 // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptors
1228 getOwnPropertyDescriptor: $getOwnPropertyDescriptor
1229});
1230
1231_export({ target: 'Object', stat: true, forced: !nativeSymbol }, {
1232 // `Object.getOwnPropertyNames` method
1233 // https://tc39.github.io/ecma262/#sec-object.getownpropertynames
1234 getOwnPropertyNames: $getOwnPropertyNames,
1235 // `Object.getOwnPropertySymbols` method
1236 // https://tc39.github.io/ecma262/#sec-object.getownpropertysymbols
1237 getOwnPropertySymbols: $getOwnPropertySymbols
1238});
1239
1240// Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives
1241// https://bugs.chromium.org/p/v8/issues/detail?id=3443
1242_export({ target: 'Object', stat: true, forced: fails(function () { objectGetOwnPropertySymbols.f(1); }) }, {
1243 getOwnPropertySymbols: function getOwnPropertySymbols(it) {
1244 return objectGetOwnPropertySymbols.f(toObject(it));
1245 }
1246});
1247
1248// `JSON.stringify` method behavior with symbols
1249// https://tc39.github.io/ecma262/#sec-json.stringify
1250JSON && _export({ target: 'JSON', stat: true, forced: !nativeSymbol || fails(function () {
1251 var symbol = $Symbol();
1252 // MS Edge converts symbol values to JSON as {}
1253 return nativeJSONStringify([symbol]) != '[null]'
1254 // WebKit converts symbol values to JSON as null
1255 || nativeJSONStringify({ a: symbol }) != '{}'
1256 // V8 throws on boxed symbols
1257 || nativeJSONStringify(Object(symbol)) != '{}';
1258}) }, {
1259 stringify: function stringify(it) {
1260 var args = [it];
1261 var index = 1;
1262 var replacer, $replacer;
1263 while (arguments.length > index) args.push(arguments[index++]);
1264 $replacer = replacer = args[1];
1265 if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined
1266 if (!isArray(replacer)) replacer = function (key, value) {
1267 if (typeof $replacer == 'function') value = $replacer.call(this, key, value);
1268 if (!isSymbol(value)) return value;
1269 };
1270 args[1] = replacer;
1271 return nativeJSONStringify.apply(JSON, args);
1272 }
1273});
1274
1275// `Symbol.prototype[@@toPrimitive]` method
1276// https://tc39.github.io/ecma262/#sec-symbol.prototype-@@toprimitive
1277if (!$Symbol[PROTOTYPE$1][TO_PRIMITIVE]) hide($Symbol[PROTOTYPE$1], TO_PRIMITIVE, $Symbol[PROTOTYPE$1].valueOf);
1278// `Symbol.prototype[@@toStringTag]` property
1279// https://tc39.github.io/ecma262/#sec-symbol.prototype-@@tostringtag
1280setToStringTag($Symbol, SYMBOL);
1281
1282hiddenKeys[HIDDEN] = true;
1283
1284var defineProperty$2 = objectDefineProperty.f;
1285
1286
1287var NativeSymbol = global_1.Symbol;
1288
1289if (descriptors && typeof NativeSymbol == 'function' && (!('description' in NativeSymbol.prototype) ||
1290 // Safari 12 bug
1291 NativeSymbol().description !== undefined
1292)) {
1293 var EmptyStringDescriptionStore = {};
1294 // wrap Symbol constructor for correct work with undefined description
1295 var SymbolWrapper = function Symbol() {
1296 var description = arguments.length < 1 || arguments[0] === undefined ? undefined : String(arguments[0]);
1297 var result = this instanceof SymbolWrapper
1298 ? new NativeSymbol(description)
1299 // in Edge 13, String(Symbol(undefined)) === 'Symbol(undefined)'
1300 : description === undefined ? NativeSymbol() : NativeSymbol(description);
1301 if (description === '') EmptyStringDescriptionStore[result] = true;
1302 return result;
1303 };
1304 copyConstructorProperties(SymbolWrapper, NativeSymbol);
1305 var symbolPrototype = SymbolWrapper.prototype = NativeSymbol.prototype;
1306 symbolPrototype.constructor = SymbolWrapper;
1307
1308 var symbolToString = symbolPrototype.toString;
1309 var native = String(NativeSymbol('test')) == 'Symbol(test)';
1310 var regexp = /^Symbol\((.*)\)[^)]+$/;
1311 defineProperty$2(symbolPrototype, 'description', {
1312 configurable: true,
1313 get: function description() {
1314 var symbol = isObject(this) ? this.valueOf() : this;
1315 var string = symbolToString.call(symbol);
1316 if (has(EmptyStringDescriptionStore, symbol)) return '';
1317 var desc = native ? string.slice(7, -1) : string.replace(regexp, '$1');
1318 return desc === '' ? undefined : desc;
1319 }
1320 });
1321
1322 _export({ global: true, forced: true }, {
1323 Symbol: SymbolWrapper
1324 });
1325}
1326
1327// `Symbol.iterator` well-known symbol
1328// https://tc39.github.io/ecma262/#sec-symbol.iterator
1329defineWellKnownSymbol('iterator');
1330
1331var createProperty = function (object, key, value) {
1332 var propertyKey = toPrimitive(key);
1333 if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value));
1334 else object[propertyKey] = value;
1335};
1336
1337var SPECIES$1 = wellKnownSymbol('species');
1338
1339var arrayMethodHasSpeciesSupport = function (METHOD_NAME) {
1340 return !fails(function () {
1341 var array = [];
1342 var constructor = array.constructor = {};
1343 constructor[SPECIES$1] = function () {
1344 return { foo: 1 };
1345 };
1346 return array[METHOD_NAME](Boolean).foo !== 1;
1347 });
1348};
1349
1350var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
1351var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
1352var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';
1353
1354var IS_CONCAT_SPREADABLE_SUPPORT = !fails(function () {
1355 var array = [];
1356 array[IS_CONCAT_SPREADABLE] = false;
1357 return array.concat()[0] !== array;
1358});
1359
1360var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
1361
1362var isConcatSpreadable = function (O) {
1363 if (!isObject(O)) return false;
1364 var spreadable = O[IS_CONCAT_SPREADABLE];
1365 return spreadable !== undefined ? !!spreadable : isArray(O);
1366};
1367
1368var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
1369
1370// `Array.prototype.concat` method
1371// https://tc39.github.io/ecma262/#sec-array.prototype.concat
1372// with adding support of @@isConcatSpreadable and @@species
1373_export({ target: 'Array', proto: true, forced: FORCED }, {
1374 concat: function concat(arg) { // eslint-disable-line no-unused-vars
1375 var O = toObject(this);
1376 var A = arraySpeciesCreate(O, 0);
1377 var n = 0;
1378 var i, k, length, len, E;
1379 for (i = -1, length = arguments.length; i < length; i++) {
1380 E = i === -1 ? O : arguments[i];
1381 if (isConcatSpreadable(E)) {
1382 len = toLength(E.length);
1383 if (n + len > MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
1384 for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
1385 } else {
1386 if (n >= MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
1387 createProperty(A, n++, E);
1388 }
1389 }
1390 A.length = n;
1391 return A;
1392 }
1393});
1394
1395var $filter = arrayIteration.filter;
1396
1397
1398// `Array.prototype.filter` method
1399// https://tc39.github.io/ecma262/#sec-array.prototype.filter
1400// with adding support of @@species
1401_export({ target: 'Array', proto: true, forced: !arrayMethodHasSpeciesSupport('filter') }, {
1402 filter: function filter(callbackfn /* , thisArg */) {
1403 return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
1404 }
1405});
1406
1407var $find = arrayIteration.find;
1408
1409
1410var FIND = 'find';
1411var SKIPS_HOLES = true;
1412
1413// Shouldn't skip holes
1414if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });
1415
1416// `Array.prototype.find` method
1417// https://tc39.github.io/ecma262/#sec-array.prototype.find
1418_export({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
1419 find: function find(callbackfn /* , that = undefined */) {
1420 return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
1421 }
1422});
1423
1424// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
1425addToUnscopables(FIND);
1426
1427var correctPrototypeGetter = !fails(function () {
1428 function F() { /* empty */ }
1429 F.prototype.constructor = null;
1430 return Object.getPrototypeOf(new F()) !== F.prototype;
1431});
1432
1433var IE_PROTO$1 = sharedKey('IE_PROTO');
1434var ObjectPrototype$1 = Object.prototype;
1435
1436// `Object.getPrototypeOf` method
1437// https://tc39.github.io/ecma262/#sec-object.getprototypeof
1438var objectGetPrototypeOf = correctPrototypeGetter ? Object.getPrototypeOf : function (O) {
1439 O = toObject(O);
1440 if (has(O, IE_PROTO$1)) return O[IE_PROTO$1];
1441 if (typeof O.constructor == 'function' && O instanceof O.constructor) {
1442 return O.constructor.prototype;
1443 } return O instanceof Object ? ObjectPrototype$1 : null;
1444};
1445
1446var ITERATOR = wellKnownSymbol('iterator');
1447var BUGGY_SAFARI_ITERATORS = false;
1448
1449var returnThis = function () { return this; };
1450
1451// `%IteratorPrototype%` object
1452// https://tc39.github.io/ecma262/#sec-%iteratorprototype%-object
1453var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;
1454
1455if ([].keys) {
1456 arrayIterator = [].keys();
1457 // Safari 8 has buggy iterators w/o `next`
1458 if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true;
1459 else {
1460 PrototypeOfArrayIteratorPrototype = objectGetPrototypeOf(objectGetPrototypeOf(arrayIterator));
1461 if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype;
1462 }
1463}
1464
1465if (IteratorPrototype == undefined) IteratorPrototype = {};
1466
1467// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
1468if ( !has(IteratorPrototype, ITERATOR)) hide(IteratorPrototype, ITERATOR, returnThis);
1469
1470var iteratorsCore = {
1471 IteratorPrototype: IteratorPrototype,
1472 BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS
1473};
1474
1475var IteratorPrototype$1 = iteratorsCore.IteratorPrototype;
1476
1477var createIteratorConstructor = function (IteratorConstructor, NAME, next) {
1478 var TO_STRING_TAG = NAME + ' Iterator';
1479 IteratorConstructor.prototype = objectCreate(IteratorPrototype$1, { next: createPropertyDescriptor(1, next) });
1480 setToStringTag(IteratorConstructor, TO_STRING_TAG, false);
1481 return IteratorConstructor;
1482};
1483
1484var aPossiblePrototype = function (it) {
1485 if (!isObject(it) && it !== null) {
1486 throw TypeError("Can't set " + String(it) + ' as a prototype');
1487 } return it;
1488};
1489
1490// `Object.setPrototypeOf` method
1491// https://tc39.github.io/ecma262/#sec-object.setprototypeof
1492// Works with __proto__ only. Old v8 can't work with null proto objects.
1493/* eslint-disable no-proto */
1494var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {
1495 var CORRECT_SETTER = false;
1496 var test = {};
1497 var setter;
1498 try {
1499 setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set;
1500 setter.call(test, []);
1501 CORRECT_SETTER = test instanceof Array;
1502 } catch (error) { /* empty */ }
1503 return function setPrototypeOf(O, proto) {
1504 anObject(O);
1505 aPossiblePrototype(proto);
1506 if (CORRECT_SETTER) setter.call(O, proto);
1507 else O.__proto__ = proto;
1508 return O;
1509 };
1510}() : undefined);
1511
1512var IteratorPrototype$2 = iteratorsCore.IteratorPrototype;
1513var BUGGY_SAFARI_ITERATORS$1 = iteratorsCore.BUGGY_SAFARI_ITERATORS;
1514var ITERATOR$1 = wellKnownSymbol('iterator');
1515var KEYS = 'keys';
1516var VALUES = 'values';
1517var ENTRIES = 'entries';
1518
1519var returnThis$1 = function () { return this; };
1520
1521var defineIterator = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
1522 createIteratorConstructor(IteratorConstructor, NAME, next);
1523
1524 var getIterationMethod = function (KIND) {
1525 if (KIND === DEFAULT && defaultIterator) return defaultIterator;
1526 if (!BUGGY_SAFARI_ITERATORS$1 && KIND in IterablePrototype) return IterablePrototype[KIND];
1527 switch (KIND) {
1528 case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };
1529 case VALUES: return function values() { return new IteratorConstructor(this, KIND); };
1530 case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };
1531 } return function () { return new IteratorConstructor(this); };
1532 };
1533
1534 var TO_STRING_TAG = NAME + ' Iterator';
1535 var INCORRECT_VALUES_NAME = false;
1536 var IterablePrototype = Iterable.prototype;
1537 var nativeIterator = IterablePrototype[ITERATOR$1]
1538 || IterablePrototype['@@iterator']
1539 || DEFAULT && IterablePrototype[DEFAULT];
1540 var defaultIterator = !BUGGY_SAFARI_ITERATORS$1 && nativeIterator || getIterationMethod(DEFAULT);
1541 var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
1542 var CurrentIteratorPrototype, methods, KEY;
1543
1544 // fix native
1545 if (anyNativeIterator) {
1546 CurrentIteratorPrototype = objectGetPrototypeOf(anyNativeIterator.call(new Iterable()));
1547 if (IteratorPrototype$2 !== Object.prototype && CurrentIteratorPrototype.next) {
1548 if ( objectGetPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype$2) {
1549 if (objectSetPrototypeOf) {
1550 objectSetPrototypeOf(CurrentIteratorPrototype, IteratorPrototype$2);
1551 } else if (typeof CurrentIteratorPrototype[ITERATOR$1] != 'function') {
1552 hide(CurrentIteratorPrototype, ITERATOR$1, returnThis$1);
1553 }
1554 }
1555 // Set @@toStringTag to native iterators
1556 setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true);
1557 }
1558 }
1559
1560 // fix Array#{values, @@iterator}.name in V8 / FF
1561 if (DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
1562 INCORRECT_VALUES_NAME = true;
1563 defaultIterator = function values() { return nativeIterator.call(this); };
1564 }
1565
1566 // define iterator
1567 if ( IterablePrototype[ITERATOR$1] !== defaultIterator) {
1568 hide(IterablePrototype, ITERATOR$1, defaultIterator);
1569 }
1570
1571 // export additional methods
1572 if (DEFAULT) {
1573 methods = {
1574 values: getIterationMethod(VALUES),
1575 keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
1576 entries: getIterationMethod(ENTRIES)
1577 };
1578 if (FORCED) for (KEY in methods) {
1579 if (BUGGY_SAFARI_ITERATORS$1 || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
1580 redefine(IterablePrototype, KEY, methods[KEY]);
1581 }
1582 } else _export({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS$1 || INCORRECT_VALUES_NAME }, methods);
1583 }
1584
1585 return methods;
1586};
1587
1588var ARRAY_ITERATOR = 'Array Iterator';
1589var setInternalState$1 = internalState.set;
1590var getInternalState$1 = internalState.getterFor(ARRAY_ITERATOR);
1591
1592// `Array.prototype.entries` method
1593// https://tc39.github.io/ecma262/#sec-array.prototype.entries
1594// `Array.prototype.keys` method
1595// https://tc39.github.io/ecma262/#sec-array.prototype.keys
1596// `Array.prototype.values` method
1597// https://tc39.github.io/ecma262/#sec-array.prototype.values
1598// `Array.prototype[@@iterator]` method
1599// https://tc39.github.io/ecma262/#sec-array.prototype-@@iterator
1600// `CreateArrayIterator` internal method
1601// https://tc39.github.io/ecma262/#sec-createarrayiterator
1602var es_array_iterator = defineIterator(Array, 'Array', function (iterated, kind) {
1603 setInternalState$1(this, {
1604 type: ARRAY_ITERATOR,
1605 target: toIndexedObject(iterated), // target
1606 index: 0, // next index
1607 kind: kind // kind
1608 });
1609// `%ArrayIteratorPrototype%.next` method
1610// https://tc39.github.io/ecma262/#sec-%arrayiteratorprototype%.next
1611}, function () {
1612 var state = getInternalState$1(this);
1613 var target = state.target;
1614 var kind = state.kind;
1615 var index = state.index++;
1616 if (!target || index >= target.length) {
1617 state.target = undefined;
1618 return { value: undefined, done: true };
1619 }
1620 if (kind == 'keys') return { value: index, done: false };
1621 if (kind == 'values') return { value: target[index], done: false };
1622 return { value: [index, target[index]], done: false };
1623}, 'values');
1624
1625// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
1626addToUnscopables('keys');
1627addToUnscopables('values');
1628addToUnscopables('entries');
1629
1630var sloppyArrayMethod = function (METHOD_NAME, argument) {
1631 var method = [][METHOD_NAME];
1632 return !method || !fails(function () {
1633 // eslint-disable-next-line no-useless-call,no-throw-literal
1634 method.call(null, argument || function () { throw 1; }, 1);
1635 });
1636};
1637
1638var nativeJoin = [].join;
1639
1640var ES3_STRINGS = indexedObject != Object;
1641var SLOPPY_METHOD = sloppyArrayMethod('join', ',');
1642
1643// `Array.prototype.join` method
1644// https://tc39.github.io/ecma262/#sec-array.prototype.join
1645_export({ target: 'Array', proto: true, forced: ES3_STRINGS || SLOPPY_METHOD }, {
1646 join: function join(separator) {
1647 return nativeJoin.call(toIndexedObject(this), separator === undefined ? ',' : separator);
1648 }
1649});
1650
1651var $map = arrayIteration.map;
1652
1653
1654// `Array.prototype.map` method
1655// https://tc39.github.io/ecma262/#sec-array.prototype.map
1656// with adding support of @@species
1657_export({ target: 'Array', proto: true, forced: !arrayMethodHasSpeciesSupport('map') }, {
1658 map: function map(callbackfn /* , thisArg */) {
1659 return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
1660 }
1661});
1662
1663var SPECIES$2 = wellKnownSymbol('species');
1664var nativeSlice = [].slice;
1665var max$1 = Math.max;
1666
1667// `Array.prototype.slice` method
1668// https://tc39.github.io/ecma262/#sec-array.prototype.slice
1669// fallback for not array-like ES3 strings and DOM objects
1670_export({ target: 'Array', proto: true, forced: !arrayMethodHasSpeciesSupport('slice') }, {
1671 slice: function slice(start, end) {
1672 var O = toIndexedObject(this);
1673 var length = toLength(O.length);
1674 var k = toAbsoluteIndex(start, length);
1675 var fin = toAbsoluteIndex(end === undefined ? length : end, length);
1676 // inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible
1677 var Constructor, result, n;
1678 if (isArray(O)) {
1679 Constructor = O.constructor;
1680 // cross-realm fallback
1681 if (typeof Constructor == 'function' && (Constructor === Array || isArray(Constructor.prototype))) {
1682 Constructor = undefined;
1683 } else if (isObject(Constructor)) {
1684 Constructor = Constructor[SPECIES$2];
1685 if (Constructor === null) Constructor = undefined;
1686 }
1687 if (Constructor === Array || Constructor === undefined) {
1688 return nativeSlice.call(O, k, fin);
1689 }
1690 }
1691 result = new (Constructor === undefined ? Array : Constructor)(max$1(fin - k, 0));
1692 for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]);
1693 result.length = n;
1694 return result;
1695 }
1696});
1697
1698var defineProperty$3 = objectDefineProperty.f;
1699
1700var FunctionPrototype = Function.prototype;
1701var FunctionPrototypeToString = FunctionPrototype.toString;
1702var nameRE = /^\s*function ([^ (]*)/;
1703var NAME = 'name';
1704
1705// Function instances `.name` property
1706// https://tc39.github.io/ecma262/#sec-function-instances-name
1707if (descriptors && !(NAME in FunctionPrototype)) {
1708 defineProperty$3(FunctionPrototype, NAME, {
1709 configurable: true,
1710 get: function () {
1711 try {
1712 return FunctionPrototypeToString.call(this).match(nameRE)[1];
1713 } catch (error) {
1714 return '';
1715 }
1716 }
1717 });
1718}
1719
1720var TO_STRING_TAG$1 = wellKnownSymbol('toStringTag');
1721// ES3 wrong here
1722var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
1723
1724// fallback for IE11 Script Access Denied error
1725var tryGet = function (it, key) {
1726 try {
1727 return it[key];
1728 } catch (error) { /* empty */ }
1729};
1730
1731// getting tag from ES6+ `Object.prototype.toString`
1732var classof = function (it) {
1733 var O, tag, result;
1734 return it === undefined ? 'Undefined' : it === null ? 'Null'
1735 // @@toStringTag case
1736 : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG$1)) == 'string' ? tag
1737 // builtinTag case
1738 : CORRECT_ARGUMENTS ? classofRaw(O)
1739 // ES3 arguments fallback
1740 : (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result;
1741};
1742
1743var TO_STRING_TAG$2 = wellKnownSymbol('toStringTag');
1744var test = {};
1745
1746test[TO_STRING_TAG$2] = 'z';
1747
1748// `Object.prototype.toString` method implementation
1749// https://tc39.github.io/ecma262/#sec-object.prototype.tostring
1750var objectToString = String(test) !== '[object z]' ? function toString() {
1751 return '[object ' + classof(this) + ']';
1752} : test.toString;
1753
1754var ObjectPrototype$2 = Object.prototype;
1755
1756// `Object.prototype.toString` method
1757// https://tc39.github.io/ecma262/#sec-object.prototype.tostring
1758if (objectToString !== ObjectPrototype$2.toString) {
1759 redefine(ObjectPrototype$2, 'toString', objectToString, { unsafe: true });
1760}
1761
1762// `String.prototype.{ codePointAt, at }` methods implementation
1763var createMethod$2 = function (CONVERT_TO_STRING) {
1764 return function ($this, pos) {
1765 var S = String(requireObjectCoercible($this));
1766 var position = toInteger(pos);
1767 var size = S.length;
1768 var first, second;
1769 if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
1770 first = S.charCodeAt(position);
1771 return first < 0xD800 || first > 0xDBFF || position + 1 === size
1772 || (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF
1773 ? CONVERT_TO_STRING ? S.charAt(position) : first
1774 : CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
1775 };
1776};
1777
1778var stringMultibyte = {
1779 // `String.prototype.codePointAt` method
1780 // https://tc39.github.io/ecma262/#sec-string.prototype.codepointat
1781 codeAt: createMethod$2(false),
1782 // `String.prototype.at` method
1783 // https://github.com/mathiasbynens/String.prototype.at
1784 charAt: createMethod$2(true)
1785};
1786
1787var charAt = stringMultibyte.charAt;
1788
1789
1790
1791var STRING_ITERATOR = 'String Iterator';
1792var setInternalState$2 = internalState.set;
1793var getInternalState$2 = internalState.getterFor(STRING_ITERATOR);
1794
1795// `String.prototype[@@iterator]` method
1796// https://tc39.github.io/ecma262/#sec-string.prototype-@@iterator
1797defineIterator(String, 'String', function (iterated) {
1798 setInternalState$2(this, {
1799 type: STRING_ITERATOR,
1800 string: String(iterated),
1801 index: 0
1802 });
1803// `%StringIteratorPrototype%.next` method
1804// https://tc39.github.io/ecma262/#sec-%stringiteratorprototype%.next
1805}, function next() {
1806 var state = getInternalState$2(this);
1807 var string = state.string;
1808 var index = state.index;
1809 var point;
1810 if (index >= string.length) return { value: undefined, done: true };
1811 point = charAt(string, index);
1812 state.index += point.length;
1813 return { value: point, done: false };
1814});
1815
1816// `RegExp.prototype.flags` getter implementation
1817// https://tc39.github.io/ecma262/#sec-get-regexp.prototype.flags
1818var regexpFlags = function () {
1819 var that = anObject(this);
1820 var result = '';
1821 if (that.global) result += 'g';
1822 if (that.ignoreCase) result += 'i';
1823 if (that.multiline) result += 'm';
1824 if (that.dotAll) result += 's';
1825 if (that.unicode) result += 'u';
1826 if (that.sticky) result += 'y';
1827 return result;
1828};
1829
1830var nativeExec = RegExp.prototype.exec;
1831// This always refers to the native implementation, because the
1832// String#replace polyfill uses ./fix-regexp-well-known-symbol-logic.js,
1833// which loads this file before patching the method.
1834var nativeReplace = String.prototype.replace;
1835
1836var patchedExec = nativeExec;
1837
1838var UPDATES_LAST_INDEX_WRONG = (function () {
1839 var re1 = /a/;
1840 var re2 = /b*/g;
1841 nativeExec.call(re1, 'a');
1842 nativeExec.call(re2, 'a');
1843 return re1.lastIndex !== 0 || re2.lastIndex !== 0;
1844})();
1845
1846// nonparticipating capturing group, copied from es5-shim's String#split patch.
1847var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
1848
1849var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED;
1850
1851if (PATCH) {
1852 patchedExec = function exec(str) {
1853 var re = this;
1854 var lastIndex, reCopy, match, i;
1855
1856 if (NPCG_INCLUDED) {
1857 reCopy = new RegExp('^' + re.source + '$(?!\\s)', regexpFlags.call(re));
1858 }
1859 if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;
1860
1861 match = nativeExec.call(re, str);
1862
1863 if (UPDATES_LAST_INDEX_WRONG && match) {
1864 re.lastIndex = re.global ? match.index + match[0].length : lastIndex;
1865 }
1866 if (NPCG_INCLUDED && match && match.length > 1) {
1867 // Fix browsers whose `exec` methods don't consistently return `undefined`
1868 // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/
1869 nativeReplace.call(match[0], reCopy, function () {
1870 for (i = 1; i < arguments.length - 2; i++) {
1871 if (arguments[i] === undefined) match[i] = undefined;
1872 }
1873 });
1874 }
1875
1876 return match;
1877 };
1878}
1879
1880var regexpExec = patchedExec;
1881
1882var SPECIES$3 = wellKnownSymbol('species');
1883
1884var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () {
1885 // #replace needs built-in support for named groups.
1886 // #match works fine because it just return the exec results, even if it has
1887 // a "grops" property.
1888 var re = /./;
1889 re.exec = function () {
1890 var result = [];
1891 result.groups = { a: '7' };
1892 return result;
1893 };
1894 return ''.replace(re, '$<a>') !== '7';
1895});
1896
1897// Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec
1898// Weex JS has frozen built-in prototypes, so use try / catch wrapper
1899var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () {
1900 var re = /(?:)/;
1901 var originalExec = re.exec;
1902 re.exec = function () { return originalExec.apply(this, arguments); };
1903 var result = 'ab'.split(re);
1904 return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b';
1905});
1906
1907var fixRegexpWellKnownSymbolLogic = function (KEY, length, exec, sham) {
1908 var SYMBOL = wellKnownSymbol(KEY);
1909
1910 var DELEGATES_TO_SYMBOL = !fails(function () {
1911 // String methods call symbol-named RegEp methods
1912 var O = {};
1913 O[SYMBOL] = function () { return 7; };
1914 return ''[KEY](O) != 7;
1915 });
1916
1917 var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails(function () {
1918 // Symbol-named RegExp methods call .exec
1919 var execCalled = false;
1920 var re = /a/;
1921 re.exec = function () { execCalled = true; return null; };
1922
1923 if (KEY === 'split') {
1924 // RegExp[@@split] doesn't call the regex's exec method, but first creates
1925 // a new one. We need to return the patched regex when creating the new one.
1926 re.constructor = {};
1927 re.constructor[SPECIES$3] = function () { return re; };
1928 }
1929
1930 re[SYMBOL]('');
1931 return !execCalled;
1932 });
1933
1934 if (
1935 !DELEGATES_TO_SYMBOL ||
1936 !DELEGATES_TO_EXEC ||
1937 (KEY === 'replace' && !REPLACE_SUPPORTS_NAMED_GROUPS) ||
1938 (KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC)
1939 ) {
1940 var nativeRegExpMethod = /./[SYMBOL];
1941 var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {
1942 if (regexp.exec === regexpExec) {
1943 if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
1944 // The native String method already delegates to @@method (this
1945 // polyfilled function), leasing to infinite recursion.
1946 // We avoid it by directly calling the native @@method method.
1947 return { done: true, value: nativeRegExpMethod.call(regexp, str, arg2) };
1948 }
1949 return { done: true, value: nativeMethod.call(str, regexp, arg2) };
1950 }
1951 return { done: false };
1952 });
1953 var stringMethod = methods[0];
1954 var regexMethod = methods[1];
1955
1956 redefine(String.prototype, KEY, stringMethod);
1957 redefine(RegExp.prototype, SYMBOL, length == 2
1958 // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue)
1959 // 21.2.5.11 RegExp.prototype[@@split](string, limit)
1960 ? function (string, arg) { return regexMethod.call(string, this, arg); }
1961 // 21.2.5.6 RegExp.prototype[@@match](string)
1962 // 21.2.5.9 RegExp.prototype[@@search](string)
1963 : function (string) { return regexMethod.call(string, this); }
1964 );
1965 if (sham) hide(RegExp.prototype[SYMBOL], 'sham', true);
1966 }
1967};
1968
1969var SPECIES$4 = wellKnownSymbol('species');
1970
1971// `SpeciesConstructor` abstract operation
1972// https://tc39.github.io/ecma262/#sec-speciesconstructor
1973var speciesConstructor = function (O, defaultConstructor) {
1974 var C = anObject(O).constructor;
1975 var S;
1976 return C === undefined || (S = anObject(C)[SPECIES$4]) == undefined ? defaultConstructor : aFunction$1(S);
1977};
1978
1979var charAt$1 = stringMultibyte.charAt;
1980
1981// `AdvanceStringIndex` abstract operation
1982// https://tc39.github.io/ecma262/#sec-advancestringindex
1983var advanceStringIndex = function (S, index, unicode) {
1984 return index + (unicode ? charAt$1(S, index).length : 1);
1985};
1986
1987// `RegExpExec` abstract operation
1988// https://tc39.github.io/ecma262/#sec-regexpexec
1989var regexpExecAbstract = function (R, S) {
1990 var exec = R.exec;
1991 if (typeof exec === 'function') {
1992 var result = exec.call(R, S);
1993 if (typeof result !== 'object') {
1994 throw TypeError('RegExp exec method returned something other than an Object or null');
1995 }
1996 return result;
1997 }
1998
1999 if (classofRaw(R) !== 'RegExp') {
2000 throw TypeError('RegExp#exec called on incompatible receiver');
2001 }
2002
2003 return regexpExec.call(R, S);
2004};
2005
2006var arrayPush = [].push;
2007var min$2 = Math.min;
2008var MAX_UINT32 = 0xFFFFFFFF;
2009
2010// babel-minify transpiles RegExp('x', 'y') -> /x/y and it causes SyntaxError
2011var SUPPORTS_Y = !fails(function () { return !RegExp(MAX_UINT32, 'y'); });
2012
2013// @@split logic
2014fixRegexpWellKnownSymbolLogic('split', 2, function (SPLIT, nativeSplit, maybeCallNative) {
2015 var internalSplit;
2016 if (
2017 'abbc'.split(/(b)*/)[1] == 'c' ||
2018 'test'.split(/(?:)/, -1).length != 4 ||
2019 'ab'.split(/(?:ab)*/).length != 2 ||
2020 '.'.split(/(.?)(.?)/).length != 4 ||
2021 '.'.split(/()()/).length > 1 ||
2022 ''.split(/.?/).length
2023 ) {
2024 // based on es5-shim implementation, need to rework it
2025 internalSplit = function (separator, limit) {
2026 var string = String(requireObjectCoercible(this));
2027 var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
2028 if (lim === 0) return [];
2029 if (separator === undefined) return [string];
2030 // If `separator` is not a regex, use native split
2031 if (!isRegexp(separator)) {
2032 return nativeSplit.call(string, separator, lim);
2033 }
2034 var output = [];
2035 var flags = (separator.ignoreCase ? 'i' : '') +
2036 (separator.multiline ? 'm' : '') +
2037 (separator.unicode ? 'u' : '') +
2038 (separator.sticky ? 'y' : '');
2039 var lastLastIndex = 0;
2040 // Make `global` and avoid `lastIndex` issues by working with a copy
2041 var separatorCopy = new RegExp(separator.source, flags + 'g');
2042 var match, lastIndex, lastLength;
2043 while (match = regexpExec.call(separatorCopy, string)) {
2044 lastIndex = separatorCopy.lastIndex;
2045 if (lastIndex > lastLastIndex) {
2046 output.push(string.slice(lastLastIndex, match.index));
2047 if (match.length > 1 && match.index < string.length) arrayPush.apply(output, match.slice(1));
2048 lastLength = match[0].length;
2049 lastLastIndex = lastIndex;
2050 if (output.length >= lim) break;
2051 }
2052 if (separatorCopy.lastIndex === match.index) separatorCopy.lastIndex++; // Avoid an infinite loop
2053 }
2054 if (lastLastIndex === string.length) {
2055 if (lastLength || !separatorCopy.test('')) output.push('');
2056 } else output.push(string.slice(lastLastIndex));
2057 return output.length > lim ? output.slice(0, lim) : output;
2058 };
2059 // Chakra, V8
2060 } else if ('0'.split(undefined, 0).length) {
2061 internalSplit = function (separator, limit) {
2062 return separator === undefined && limit === 0 ? [] : nativeSplit.call(this, separator, limit);
2063 };
2064 } else internalSplit = nativeSplit;
2065
2066 return [
2067 // `String.prototype.split` method
2068 // https://tc39.github.io/ecma262/#sec-string.prototype.split
2069 function split(separator, limit) {
2070 var O = requireObjectCoercible(this);
2071 var splitter = separator == undefined ? undefined : separator[SPLIT];
2072 return splitter !== undefined
2073 ? splitter.call(separator, O, limit)
2074 : internalSplit.call(String(O), separator, limit);
2075 },
2076 // `RegExp.prototype[@@split]` method
2077 // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@split
2078 //
2079 // NOTE: This cannot be properly polyfilled in engines that don't support
2080 // the 'y' flag.
2081 function (regexp, limit) {
2082 var res = maybeCallNative(internalSplit, regexp, this, limit, internalSplit !== nativeSplit);
2083 if (res.done) return res.value;
2084
2085 var rx = anObject(regexp);
2086 var S = String(this);
2087 var C = speciesConstructor(rx, RegExp);
2088
2089 var unicodeMatching = rx.unicode;
2090 var flags = (rx.ignoreCase ? 'i' : '') +
2091 (rx.multiline ? 'm' : '') +
2092 (rx.unicode ? 'u' : '') +
2093 (SUPPORTS_Y ? 'y' : 'g');
2094
2095 // ^(? + rx + ) is needed, in combination with some S slicing, to
2096 // simulate the 'y' flag.
2097 var splitter = new C(SUPPORTS_Y ? rx : '^(?:' + rx.source + ')', flags);
2098 var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
2099 if (lim === 0) return [];
2100 if (S.length === 0) return regexpExecAbstract(splitter, S) === null ? [S] : [];
2101 var p = 0;
2102 var q = 0;
2103 var A = [];
2104 while (q < S.length) {
2105 splitter.lastIndex = SUPPORTS_Y ? q : 0;
2106 var z = regexpExecAbstract(splitter, SUPPORTS_Y ? S : S.slice(q));
2107 var e;
2108 if (
2109 z === null ||
2110 (e = min$2(toLength(splitter.lastIndex + (SUPPORTS_Y ? 0 : q)), S.length)) === p
2111 ) {
2112 q = advanceStringIndex(S, q, unicodeMatching);
2113 } else {
2114 A.push(S.slice(p, q));
2115 if (A.length === lim) return A;
2116 for (var i = 1; i <= z.length - 1; i++) {
2117 A.push(z[i]);
2118 if (A.length === lim) return A;
2119 }
2120 q = p = e;
2121 }
2122 }
2123 A.push(S.slice(p));
2124 return A;
2125 }
2126 ];
2127}, !SUPPORTS_Y);
2128
2129// a string of all valid unicode whitespaces
2130// eslint-disable-next-line max-len
2131var 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';
2132
2133var whitespace = '[' + whitespaces + ']';
2134var ltrim = RegExp('^' + whitespace + whitespace + '*');
2135var rtrim = RegExp(whitespace + whitespace + '*$');
2136
2137// `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
2138var createMethod$3 = function (TYPE) {
2139 return function ($this) {
2140 var string = String(requireObjectCoercible($this));
2141 if (TYPE & 1) string = string.replace(ltrim, '');
2142 if (TYPE & 2) string = string.replace(rtrim, '');
2143 return string;
2144 };
2145};
2146
2147var stringTrim = {
2148 // `String.prototype.{ trimLeft, trimStart }` methods
2149 // https://tc39.github.io/ecma262/#sec-string.prototype.trimstart
2150 start: createMethod$3(1),
2151 // `String.prototype.{ trimRight, trimEnd }` methods
2152 // https://tc39.github.io/ecma262/#sec-string.prototype.trimend
2153 end: createMethod$3(2),
2154 // `String.prototype.trim` method
2155 // https://tc39.github.io/ecma262/#sec-string.prototype.trim
2156 trim: createMethod$3(3)
2157};
2158
2159var non = '\u200B\u0085\u180E';
2160
2161// check that a method works with the correct list
2162// of whitespaces and has a correct name
2163var forcedStringTrimMethod = function (METHOD_NAME) {
2164 return fails(function () {
2165 return !!whitespaces[METHOD_NAME]() || non[METHOD_NAME]() != non || whitespaces[METHOD_NAME].name !== METHOD_NAME;
2166 });
2167};
2168
2169var $trim = stringTrim.trim;
2170
2171
2172// `String.prototype.trim` method
2173// https://tc39.github.io/ecma262/#sec-string.prototype.trim
2174_export({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, {
2175 trim: function trim() {
2176 return $trim(this);
2177 }
2178});
2179
2180// iterable DOM collections
2181// flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
2182var domIterables = {
2183 CSSRuleList: 0,
2184 CSSStyleDeclaration: 0,
2185 CSSValueList: 0,
2186 ClientRectList: 0,
2187 DOMRectList: 0,
2188 DOMStringList: 0,
2189 DOMTokenList: 1,
2190 DataTransferItemList: 0,
2191 FileList: 0,
2192 HTMLAllCollection: 0,
2193 HTMLCollection: 0,
2194 HTMLFormElement: 0,
2195 HTMLSelectElement: 0,
2196 MediaList: 0,
2197 MimeTypeArray: 0,
2198 NamedNodeMap: 0,
2199 NodeList: 1,
2200 PaintRequestList: 0,
2201 Plugin: 0,
2202 PluginArray: 0,
2203 SVGLengthList: 0,
2204 SVGNumberList: 0,
2205 SVGPathSegList: 0,
2206 SVGPointList: 0,
2207 SVGStringList: 0,
2208 SVGTransformList: 0,
2209 SourceBufferList: 0,
2210 StyleSheetList: 0,
2211 TextTrackCueList: 0,
2212 TextTrackList: 0,
2213 TouchList: 0
2214};
2215
2216var $forEach$1 = arrayIteration.forEach;
2217
2218
2219// `Array.prototype.forEach` method implementation
2220// https://tc39.github.io/ecma262/#sec-array.prototype.foreach
2221var arrayForEach = sloppyArrayMethod('forEach') ? function forEach(callbackfn /* , thisArg */) {
2222 return $forEach$1(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
2223} : [].forEach;
2224
2225for (var COLLECTION_NAME in domIterables) {
2226 var Collection = global_1[COLLECTION_NAME];
2227 var CollectionPrototype = Collection && Collection.prototype;
2228 // some Chrome versions have non-configurable methods on DOMTokenList
2229 if (CollectionPrototype && CollectionPrototype.forEach !== arrayForEach) try {
2230 hide(CollectionPrototype, 'forEach', arrayForEach);
2231 } catch (error) {
2232 CollectionPrototype.forEach = arrayForEach;
2233 }
2234}
2235
2236var ITERATOR$2 = wellKnownSymbol('iterator');
2237var TO_STRING_TAG$3 = wellKnownSymbol('toStringTag');
2238var ArrayValues = es_array_iterator.values;
2239
2240for (var COLLECTION_NAME$1 in domIterables) {
2241 var Collection$1 = global_1[COLLECTION_NAME$1];
2242 var CollectionPrototype$1 = Collection$1 && Collection$1.prototype;
2243 if (CollectionPrototype$1) {
2244 // some Chrome versions have non-configurable methods on DOMTokenList
2245 if (CollectionPrototype$1[ITERATOR$2] !== ArrayValues) try {
2246 hide(CollectionPrototype$1, ITERATOR$2, ArrayValues);
2247 } catch (error) {
2248 CollectionPrototype$1[ITERATOR$2] = ArrayValues;
2249 }
2250 if (!CollectionPrototype$1[TO_STRING_TAG$3]) hide(CollectionPrototype$1, TO_STRING_TAG$3, COLLECTION_NAME$1);
2251 if (domIterables[COLLECTION_NAME$1]) for (var METHOD_NAME in es_array_iterator) {
2252 // some Chrome versions have non-configurable methods on DOMTokenList
2253 if (CollectionPrototype$1[METHOD_NAME] !== es_array_iterator[METHOD_NAME]) try {
2254 hide(CollectionPrototype$1, METHOD_NAME, es_array_iterator[METHOD_NAME]);
2255 } catch (error) {
2256 CollectionPrototype$1[METHOD_NAME] = es_array_iterator[METHOD_NAME];
2257 }
2258 }
2259 }
2260}
2261
2262var FAILS_ON_PRIMITIVES = fails(function () { objectKeys(1); });
2263
2264// `Object.keys` method
2265// https://tc39.github.io/ecma262/#sec-object.keys
2266_export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
2267 keys: function keys(it) {
2268 return objectKeys(toObject(it));
2269 }
2270});
2271
2272var max$2 = Math.max;
2273var min$3 = Math.min;
2274var floor$1 = Math.floor;
2275var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d\d?|<[^>]*>)/g;
2276var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d\d?)/g;
2277
2278var maybeToString = function (it) {
2279 return it === undefined ? it : String(it);
2280};
2281
2282// @@replace logic
2283fixRegexpWellKnownSymbolLogic('replace', 2, function (REPLACE, nativeReplace, maybeCallNative) {
2284 return [
2285 // `String.prototype.replace` method
2286 // https://tc39.github.io/ecma262/#sec-string.prototype.replace
2287 function replace(searchValue, replaceValue) {
2288 var O = requireObjectCoercible(this);
2289 var replacer = searchValue == undefined ? undefined : searchValue[REPLACE];
2290 return replacer !== undefined
2291 ? replacer.call(searchValue, O, replaceValue)
2292 : nativeReplace.call(String(O), searchValue, replaceValue);
2293 },
2294 // `RegExp.prototype[@@replace]` method
2295 // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@replace
2296 function (regexp, replaceValue) {
2297 var res = maybeCallNative(nativeReplace, regexp, this, replaceValue);
2298 if (res.done) return res.value;
2299
2300 var rx = anObject(regexp);
2301 var S = String(this);
2302
2303 var functionalReplace = typeof replaceValue === 'function';
2304 if (!functionalReplace) replaceValue = String(replaceValue);
2305
2306 var global = rx.global;
2307 if (global) {
2308 var fullUnicode = rx.unicode;
2309 rx.lastIndex = 0;
2310 }
2311 var results = [];
2312 while (true) {
2313 var result = regexpExecAbstract(rx, S);
2314 if (result === null) break;
2315
2316 results.push(result);
2317 if (!global) break;
2318
2319 var matchStr = String(result[0]);
2320 if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
2321 }
2322
2323 var accumulatedResult = '';
2324 var nextSourcePosition = 0;
2325 for (var i = 0; i < results.length; i++) {
2326 result = results[i];
2327
2328 var matched = String(result[0]);
2329 var position = max$2(min$3(toInteger(result.index), S.length), 0);
2330 var captures = [];
2331 // NOTE: This is equivalent to
2332 // captures = result.slice(1).map(maybeToString)
2333 // but for some reason `nativeSlice.call(result, 1, result.length)` (called in
2334 // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and
2335 // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.
2336 for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j]));
2337 var namedCaptures = result.groups;
2338 if (functionalReplace) {
2339 var replacerArgs = [matched].concat(captures, position, S);
2340 if (namedCaptures !== undefined) replacerArgs.push(namedCaptures);
2341 var replacement = String(replaceValue.apply(undefined, replacerArgs));
2342 } else {
2343 replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
2344 }
2345 if (position >= nextSourcePosition) {
2346 accumulatedResult += S.slice(nextSourcePosition, position) + replacement;
2347 nextSourcePosition = position + matched.length;
2348 }
2349 }
2350 return accumulatedResult + S.slice(nextSourcePosition);
2351 }
2352 ];
2353
2354 // https://tc39.github.io/ecma262/#sec-getsubstitution
2355 function getSubstitution(matched, str, position, captures, namedCaptures, replacement) {
2356 var tailPos = position + matched.length;
2357 var m = captures.length;
2358 var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
2359 if (namedCaptures !== undefined) {
2360 namedCaptures = toObject(namedCaptures);
2361 symbols = SUBSTITUTION_SYMBOLS;
2362 }
2363 return nativeReplace.call(replacement, symbols, function (match, ch) {
2364 var capture;
2365 switch (ch.charAt(0)) {
2366 case '$': return '$';
2367 case '&': return matched;
2368 case '`': return str.slice(0, position);
2369 case "'": return str.slice(tailPos);
2370 case '<':
2371 capture = namedCaptures[ch.slice(1, -1)];
2372 break;
2373 default: // \d\d?
2374 var n = +ch;
2375 if (n === 0) return match;
2376 if (n > m) {
2377 var f = floor$1(n / 10);
2378 if (f === 0) return match;
2379 if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1);
2380 return match;
2381 }
2382 capture = captures[n - 1];
2383 }
2384 return capture === undefined ? '' : capture;
2385 });
2386 }
2387});
2388
2389// sprintf format specifiers
2390var s = 's';
2391
2392var sprintf = function sprintf(strings) {
2393 for (var _len = arguments.length, formats = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
2394 formats[_key - 1] = arguments[_key];
2395 }
2396
2397 return function () {
2398 for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
2399 args[_key2] = arguments[_key2];
2400 }
2401
2402 var retStr = '';
2403 return strings.slice(0, -1).some(function (str, i) {
2404 switch (formats[i]) {
2405 default:
2406 throw new TypeError('Unrecognized sprintf format');
2407
2408 case 's':
2409 {
2410 var arg = args[i];
2411
2412 if (arg === null || arg === undefined) {
2413 return true;
2414 }
2415
2416 retStr += str + arg;
2417 return false;
2418 }
2419 }
2420 }) ? '' : retStr + strings.slice(-1);
2421 };
2422};
2423
2424var compareObjects = function compareObjects(objectA, objectB, compareLength) {
2425 var aKeys = Object.keys(objectA);
2426 var bKeys = Object.keys(objectB);
2427
2428 if (compareLength && aKeys.length !== bKeys.length) {
2429 return false;
2430 }
2431
2432 for (var _i = 0, _aKeys = aKeys; _i < _aKeys.length; _i++) {
2433 var key = _aKeys[_i];
2434
2435 if (bKeys.includes(key) && objectA[key] !== objectB[key]) {
2436 return false;
2437 }
2438 }
2439
2440 return true;
2441};
2442
2443var removeDiacritics = function removeDiacritics(str) {
2444 if (str.normalize) {
2445 return str.normalize('NFD').replace(/[\u0300-\u036F]/g, '');
2446 }
2447
2448 var defaultDiacriticsRemovalMap = [{
2449 'base': 'A',
2450 'letters': /[\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F]/g
2451 }, {
2452 'base': 'AA',
2453 'letters': /[\uA732]/g
2454 }, {
2455 'base': 'AE',
2456 'letters': /[\u00C6\u01FC\u01E2]/g
2457 }, {
2458 'base': 'AO',
2459 'letters': /[\uA734]/g
2460 }, {
2461 'base': 'AU',
2462 'letters': /[\uA736]/g
2463 }, {
2464 'base': 'AV',
2465 'letters': /[\uA738\uA73A]/g
2466 }, {
2467 'base': 'AY',
2468 'letters': /[\uA73C]/g
2469 }, {
2470 'base': 'B',
2471 'letters': /[\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181]/g
2472 }, {
2473 'base': 'C',
2474 'letters': /[\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E]/g
2475 }, {
2476 'base': 'D',
2477 'letters': /[\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779]/g
2478 }, {
2479 'base': 'DZ',
2480 'letters': /[\u01F1\u01C4]/g
2481 }, {
2482 'base': 'Dz',
2483 'letters': /[\u01F2\u01C5]/g
2484 }, {
2485 'base': 'E',
2486 'letters': /[\u0045\u24BA\uFF25\u00C8\u00C9\u00CA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\u00CB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E]/g
2487 }, {
2488 'base': 'F',
2489 'letters': /[\u0046\u24BB\uFF26\u1E1E\u0191\uA77B]/g
2490 }, {
2491 'base': 'G',
2492 'letters': /[\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E]/g
2493 }, {
2494 'base': 'H',
2495 'letters': /[\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D]/g
2496 }, {
2497 'base': 'I',
2498 'letters': /[\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197]/g
2499 }, {
2500 'base': 'J',
2501 'letters': /[\u004A\u24BF\uFF2A\u0134\u0248]/g
2502 }, {
2503 'base': 'K',
2504 'letters': /[\u004B\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2]/g
2505 }, {
2506 'base': 'L',
2507 'letters': /[\u004C\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780]/g
2508 }, {
2509 'base': 'LJ',
2510 'letters': /[\u01C7]/g
2511 }, {
2512 'base': 'Lj',
2513 'letters': /[\u01C8]/g
2514 }, {
2515 'base': 'M',
2516 'letters': /[\u004D\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C]/g
2517 }, {
2518 'base': 'N',
2519 'letters': /[\u004E\u24C3\uFF2E\u01F8\u0143\u00D1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4]/g
2520 }, {
2521 'base': 'NJ',
2522 'letters': /[\u01CA]/g
2523 }, {
2524 'base': 'Nj',
2525 'letters': /[\u01CB]/g
2526 }, {
2527 'base': 'O',
2528 'letters': /[\u004F\u24C4\uFF2F\u00D2\u00D3\u00D4\u1ED2\u1ED0\u1ED6\u1ED4\u00D5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\u00D6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\u00D8\u01FE\u0186\u019F\uA74A\uA74C]/g
2529 }, {
2530 'base': 'OI',
2531 'letters': /[\u01A2]/g
2532 }, {
2533 'base': 'OO',
2534 'letters': /[\uA74E]/g
2535 }, {
2536 'base': 'OU',
2537 'letters': /[\u0222]/g
2538 }, {
2539 'base': 'P',
2540 'letters': /[\u0050\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754]/g
2541 }, {
2542 'base': 'Q',
2543 'letters': /[\u0051\u24C6\uFF31\uA756\uA758\u024A]/g
2544 }, {
2545 'base': 'R',
2546 'letters': /[\u0052\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782]/g
2547 }, {
2548 'base': 'S',
2549 'letters': /[\u0053\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784]/g
2550 }, {
2551 'base': 'T',
2552 'letters': /[\u0054\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786]/g
2553 }, {
2554 'base': 'TZ',
2555 'letters': /[\uA728]/g
2556 }, {
2557 'base': 'U',
2558 'letters': /[\u0055\u24CA\uFF35\u00D9\u00DA\u00DB\u0168\u1E78\u016A\u1E7A\u016C\u00DC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244]/g
2559 }, {
2560 'base': 'V',
2561 'letters': /[\u0056\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245]/g
2562 }, {
2563 'base': 'VY',
2564 'letters': /[\uA760]/g
2565 }, {
2566 'base': 'W',
2567 'letters': /[\u0057\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72]/g
2568 }, {
2569 'base': 'X',
2570 'letters': /[\u0058\u24CD\uFF38\u1E8A\u1E8C]/g
2571 }, {
2572 'base': 'Y',
2573 'letters': /[\u0059\u24CE\uFF39\u1EF2\u00DD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE]/g
2574 }, {
2575 'base': 'Z',
2576 'letters': /[\u005A\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762]/g
2577 }, {
2578 'base': 'a',
2579 'letters': /[\u0061\u24D0\uFF41\u1E9A\u00E0\u00E1\u00E2\u1EA7\u1EA5\u1EAB\u1EA9\u00E3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\u00E4\u01DF\u1EA3\u00E5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250]/g
2580 }, {
2581 'base': 'aa',
2582 'letters': /[\uA733]/g
2583 }, {
2584 'base': 'ae',
2585 'letters': /[\u00E6\u01FD\u01E3]/g
2586 }, {
2587 'base': 'ao',
2588 'letters': /[\uA735]/g
2589 }, {
2590 'base': 'au',
2591 'letters': /[\uA737]/g
2592 }, {
2593 'base': 'av',
2594 'letters': /[\uA739\uA73B]/g
2595 }, {
2596 'base': 'ay',
2597 'letters': /[\uA73D]/g
2598 }, {
2599 'base': 'b',
2600 'letters': /[\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253]/g
2601 }, {
2602 'base': 'c',
2603 'letters': /[\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184]/g
2604 }, {
2605 'base': 'd',
2606 'letters': /[\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A]/g
2607 }, {
2608 'base': 'dz',
2609 'letters': /[\u01F3\u01C6]/g
2610 }, {
2611 'base': 'e',
2612 'letters': /[\u0065\u24D4\uFF45\u00E8\u00E9\u00EA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\u00EB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD]/g
2613 }, {
2614 'base': 'f',
2615 'letters': /[\u0066\u24D5\uFF46\u1E1F\u0192\uA77C]/g
2616 }, {
2617 'base': 'g',
2618 'letters': /[\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F]/g
2619 }, {
2620 'base': 'h',
2621 'letters': /[\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265]/g
2622 }, {
2623 'base': 'hv',
2624 'letters': /[\u0195]/g
2625 }, {
2626 'base': 'i',
2627 'letters': /[\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131]/g
2628 }, {
2629 'base': 'j',
2630 'letters': /[\u006A\u24D9\uFF4A\u0135\u01F0\u0249]/g
2631 }, {
2632 'base': 'k',
2633 'letters': /[\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3]/g
2634 }, {
2635 'base': 'l',
2636 'letters': /[\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747]/g
2637 }, {
2638 'base': 'lj',
2639 'letters': /[\u01C9]/g
2640 }, {
2641 'base': 'm',
2642 'letters': /[\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F]/g
2643 }, {
2644 'base': 'n',
2645 'letters': /[\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5]/g
2646 }, {
2647 'base': 'nj',
2648 'letters': /[\u01CC]/g
2649 }, {
2650 'base': 'o',
2651 'letters': /[\u006F\u24DE\uFF4F\u00F2\u00F3\u00F4\u1ED3\u1ED1\u1ED7\u1ED5\u00F5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\u00F6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\u00F8\u01FF\u0254\uA74B\uA74D\u0275]/g
2652 }, {
2653 'base': 'oi',
2654 'letters': /[\u01A3]/g
2655 }, {
2656 'base': 'ou',
2657 'letters': /[\u0223]/g
2658 }, {
2659 'base': 'oo',
2660 'letters': /[\uA74F]/g
2661 }, {
2662 'base': 'p',
2663 'letters': /[\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755]/g
2664 }, {
2665 'base': 'q',
2666 'letters': /[\u0071\u24E0\uFF51\u024B\uA757\uA759]/g
2667 }, {
2668 'base': 'r',
2669 'letters': /[\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783]/g
2670 }, {
2671 'base': 's',
2672 'letters': /[\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B]/g
2673 }, {
2674 'base': 't',
2675 'letters': /[\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787]/g
2676 }, {
2677 'base': 'tz',
2678 'letters': /[\uA729]/g
2679 }, {
2680 'base': 'u',
2681 'letters': /[\u0075\u24E4\uFF55\u00F9\u00FA\u00FB\u0169\u1E79\u016B\u1E7B\u016D\u00FC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289]/g
2682 }, {
2683 'base': 'v',
2684 'letters': /[\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C]/g
2685 }, {
2686 'base': 'vy',
2687 'letters': /[\uA761]/g
2688 }, {
2689 'base': 'w',
2690 'letters': /[\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73]/g
2691 }, {
2692 'base': 'x',
2693 'letters': /[\u0078\u24E7\uFF58\u1E8B\u1E8D]/g
2694 }, {
2695 'base': 'y',
2696 'letters': /[\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF]/g
2697 }, {
2698 'base': 'z',
2699 'letters': /[\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763]/g
2700 }];
2701 return defaultDiacriticsRemovalMap.reduce(function (string, _ref) {
2702 var letters = _ref.letters,
2703 base = _ref.base;
2704 return string.replace(letters, base);
2705 }, str);
2706};
2707
2708function _templateObject26() {
2709 var data = _taggedTemplateLiteral(["[data-group=\"", "\"]"]);
2710
2711 _templateObject26 = function _templateObject26() {
2712 return data;
2713 };
2714
2715 return data;
2716}
2717
2718function _templateObject25() {
2719 var data = _taggedTemplateLiteral(["[value=\"", "\"]"]);
2720
2721 _templateObject25 = function _templateObject25() {
2722 return data;
2723 };
2724
2725 return data;
2726}
2727
2728function _templateObject24() {
2729 var data = _taggedTemplateLiteral(["[value=\"", "\"]"]);
2730
2731 _templateObject24 = function _templateObject24() {
2732 return data;
2733 };
2734
2735 return data;
2736}
2737
2738function _templateObject23() {
2739 var data = _taggedTemplateLiteral(["[value=\"", "\"]"]);
2740
2741 _templateObject23 = function _templateObject23() {
2742 return data;
2743 };
2744
2745 return data;
2746}
2747
2748function _templateObject22() {
2749 var data = _taggedTemplateLiteral(["[value=\"", "\"]"]);
2750
2751 _templateObject22 = function _templateObject22() {
2752 return data;
2753 };
2754
2755 return data;
2756}
2757
2758function _templateObject21() {
2759 var data = _taggedTemplateLiteral(["[", "][data-group=\"", "\"]"]);
2760
2761 _templateObject21 = function _templateObject21() {
2762 return data;
2763 };
2764
2765 return data;
2766}
2767
2768function _templateObject20() {
2769 var data = _taggedTemplateLiteral(["input[", "]:checked"]);
2770
2771 _templateObject20 = function _templateObject20() {
2772 return data;
2773 };
2774
2775 return data;
2776}
2777
2778function _templateObject19() {
2779 var data = _taggedTemplateLiteral(["[data-group=\"", "\"]"]);
2780
2781 _templateObject19 = function _templateObject19() {
2782 return data;
2783 };
2784
2785 return data;
2786}
2787
2788function _templateObject18() {
2789 var data = _taggedTemplateLiteral(["[data-group=\"", "\"]"]);
2790
2791 _templateObject18 = function _templateObject18() {
2792 return data;
2793 };
2794
2795 return data;
2796}
2797
2798function _templateObject17() {
2799 var data = _taggedTemplateLiteral(["<span>", "</span>"]);
2800
2801 _templateObject17 = function _templateObject17() {
2802 return data;
2803 };
2804
2805 return data;
2806}
2807
2808function _templateObject16() {
2809 var data = _taggedTemplateLiteral([" data-group=\"", "\""]);
2810
2811 _templateObject16 = function _templateObject16() {
2812 return data;
2813 };
2814
2815 return data;
2816}
2817
2818function _templateObject15() {
2819 var data = _taggedTemplateLiteral(["<input type=\"", "\" value=\"", "\" ", "", "", "", ">"]);
2820
2821 _templateObject15 = function _templateObject15() {
2822 return data;
2823 };
2824
2825 return data;
2826}
2827
2828function _templateObject14() {
2829 var data = _taggedTemplateLiteral(["<label class=\"", "\">"]);
2830
2831 _templateObject14 = function _templateObject14() {
2832 return data;
2833 };
2834
2835 return data;
2836}
2837
2838function _templateObject13() {
2839 var data = _taggedTemplateLiteral(["<li class=\"", " ", "\" ", " ", ">"]);
2840
2841 _templateObject13 = function _templateObject13() {
2842 return data;
2843 };
2844
2845 return data;
2846}
2847
2848function _templateObject12() {
2849 var data = _taggedTemplateLiteral(["style=\"", "\""]);
2850
2851 _templateObject12 = function _templateObject12() {
2852 return data;
2853 };
2854
2855 return data;
2856}
2857
2858function _templateObject11() {
2859 var data = _taggedTemplateLiteral(["<input type=\"checkbox\" ", " ", ">"]);
2860
2861 _templateObject11 = function _templateObject11() {
2862 return data;
2863 };
2864
2865 return data;
2866}
2867
2868function _templateObject10() {
2869 var data = _taggedTemplateLiteral(["<label class=\"optgroup ", "\" data-group=\"", "\">"]);
2870
2871 _templateObject10 = function _templateObject10() {
2872 return data;
2873 };
2874
2875 return data;
2876}
2877
2878function _templateObject9() {
2879 var data = _taggedTemplateLiteral(["style=\"", "\""]);
2880
2881 _templateObject9 = function _templateObject9() {
2882 return data;
2883 };
2884
2885 return data;
2886}
2887
2888function _templateObject8() {
2889 var data = _taggedTemplateLiteral(["title=\"", "\""]);
2890
2891 _templateObject8 = function _templateObject8() {
2892 return data;
2893 };
2894
2895 return data;
2896}
2897
2898function _templateObject7() {
2899 var data = _taggedTemplateLiteral(["<li class=\"ms-no-results\">", "</li>"]);
2900
2901 _templateObject7 = function _templateObject7() {
2902 return data;
2903 };
2904
2905 return data;
2906}
2907
2908function _templateObject6() {
2909 var data = _taggedTemplateLiteral(["<input type=\"checkbox\" ", " />"]);
2910
2911 _templateObject6 = function _templateObject6() {
2912 return data;
2913 };
2914
2915 return data;
2916}
2917
2918function _templateObject5() {
2919 var data = _taggedTemplateLiteral(["placeholder=\"", "\""]);
2920
2921 _templateObject5 = function _templateObject5() {
2922 return data;
2923 };
2924
2925 return data;
2926}
2927
2928function _templateObject4() {
2929 var data = _taggedTemplateLiteral(["<div class=\"ms-drop ", "\"></div>"]);
2930
2931 _templateObject4 = function _templateObject4() {
2932 return data;
2933 };
2934
2935 return data;
2936}
2937
2938function _templateObject3() {
2939 var data = _taggedTemplateLiteral(["\n <button type=\"button\" class=\"ms-choice\">\n <span class=\"placeholder\">", "</span>\n <div></div>\n </button>\n "]);
2940
2941 _templateObject3 = function _templateObject3() {
2942 return data;
2943 };
2944
2945 return data;
2946}
2947
2948function _templateObject2() {
2949 var data = _taggedTemplateLiteral(["title=\"", "\""]);
2950
2951 _templateObject2 = function _templateObject2() {
2952 return data;
2953 };
2954
2955 return data;
2956}
2957
2958function _templateObject() {
2959 var data = _taggedTemplateLiteral(["<div class=\"ms-parent ", "\" ", "/>"]);
2960
2961 _templateObject = function _templateObject() {
2962 return data;
2963 };
2964
2965 return data;
2966}
2967
2968var MultipleSelect =
2969/*#__PURE__*/
2970function () {
2971 function MultipleSelect($el, options) {
2972 _classCallCheck(this, MultipleSelect);
2973
2974 this.$el = $el;
2975 this.options = $.extend({}, Constants.DEFAULTS, options);
2976 }
2977
2978 _createClass(MultipleSelect, [{
2979 key: "init",
2980 value: function init() {
2981 this.initLocale();
2982 this.initContainer();
2983 this.initData();
2984 this.initFilter();
2985 this.initDrop();
2986 this.initView();
2987 }
2988 }, {
2989 key: "initLocale",
2990 value: function initLocale() {
2991 if (this.options.locale) {
2992 var locales = $.fn.multipleSelect.locales;
2993 var parts = this.options.locale.split(/-|_/);
2994 parts[0] = parts[0].toLowerCase();
2995
2996 if (parts[1]) {
2997 parts[1] = parts[1].toUpperCase();
2998 }
2999
3000 if (locales[this.options.locale]) {
3001 $.extend(this.options, locales[this.options.locale]);
3002 } else if (locales[parts.join('-')]) {
3003 $.extend(this.options, locales[parts.join('-')]);
3004 } else if (locales[parts[0]]) {
3005 $.extend(this.options, locales[parts[0]]);
3006 }
3007 }
3008 }
3009 }, {
3010 key: "initContainer",
3011 value: function initContainer() {
3012 var _this = this;
3013
3014 var el = this.$el[0];
3015 var name = el.getAttribute('name') || this.options.name || ''; // hide select element
3016
3017 this.$el = this.$el.hide(); // label element
3018
3019 this.$label = this.$el.closest('label');
3020
3021 if (!this.$label.length && this.$el.attr('id')) {
3022 this.$label = $("label[for=\"".concat(this.$el.attr('id'), "\"]"));
3023 }
3024
3025 if (this.$label.find('>input').length) {
3026 this.$label = null;
3027 } // restore class and title from select element
3028
3029
3030 this.$parent = $(sprintf(_templateObject(), s, s)(el.getAttribute('class') || '', sprintf(_templateObject2(), s)(el.getAttribute('title')))); // add placeholder to choice button
3031
3032 this.options.placeholder = this.options.placeholder || el.getAttribute('placeholder') || '';
3033 this.$choice = $(sprintf(_templateObject3(), s)(this.options.placeholder)); // default position is bottom
3034
3035 this.$drop = $(sprintf(_templateObject4(), s)(this.options.position));
3036
3037 if (this.options.dropWidth) {
3038 this.$drop.css('width', this.options.dropWidth);
3039 }
3040
3041 this.$el.after(this.$parent);
3042 this.$parent.append(this.$choice);
3043 this.$parent.append(this.$drop);
3044
3045 if (el.disabled) {
3046 this.$choice.addClass('disabled');
3047 }
3048
3049 this.selectAllName = "data-name=\"selectAll".concat(name, "\"");
3050 this.selectGroupName = "data-name=\"selectGroup".concat(name, "\"");
3051 this.selectItemName = "data-name=\"selectItem".concat(name, "\"");
3052
3053 if (!this.options.keepOpen) {
3054 $(document).click(function (e) {
3055 if ($(e.target)[0] === _this.$choice[0] || $(e.target).parents('.ms-choice')[0] === _this.$choice[0]) {
3056 return;
3057 }
3058
3059 if (($(e.target)[0] === _this.$drop[0] || $(e.target).parents('.ms-drop')[0] !== _this.$drop[0] && e.target !== el) && _this.options.isOpen) {
3060 _this.close();
3061 }
3062 });
3063 }
3064
3065 this.options.onAfterCreate();
3066 }
3067 }, {
3068 key: "initData",
3069 value: function initData() {
3070 var _this2 = this;
3071
3072 var data = [];
3073
3074 if (this.options.data) {
3075 this.options.data.forEach(function (row, i) {
3076 if (row.type === 'optgroup') {
3077 row.group = row.group || "group_".concat(i);
3078 row.children.forEach(function (child) {
3079 child.group = child.group || row.group;
3080 });
3081 }
3082 });
3083 this.data = this.options.data;
3084 return;
3085 }
3086
3087 $.each(this.$el.children(), function (i, elm) {
3088 var row = _this2.initRow(i, elm);
3089
3090 if (row) {
3091 data.push(_this2.initRow(i, elm));
3092 }
3093 });
3094 this.options.data = data;
3095 this.data = data;
3096 this.fromHtml = true;
3097 }
3098 }, {
3099 key: "initRow",
3100 value: function initRow(i, elm, group, groupDisabled) {
3101 var _this3 = this;
3102
3103 var row = {};
3104 var $elm = $(elm);
3105
3106 if ($elm.is('option')) {
3107 row.type = 'option';
3108 row.group = group;
3109 row.text = this.options.textTemplate($elm);
3110 row.value = elm.value;
3111 row.selected = elm.selected;
3112 row.disabled = groupDisabled || elm.disabled;
3113 row.classes = elm.getAttribute('class') || '';
3114 row.title = elm.getAttribute('title');
3115 return row;
3116 }
3117
3118 if ($elm.is('optgroup')) {
3119 row.type = 'optgroup';
3120 row.group = "group_".concat(i);
3121 row.label = this.options.labelTemplate($elm);
3122 row.disabled = elm.disabled;
3123 row.children = [];
3124 $.each($elm.children(), function (j, elem) {
3125 row.children.push(_this3.initRow(j, elem, row.group, row.disabled));
3126 });
3127 return row;
3128 }
3129
3130 return null;
3131 }
3132 }, {
3133 key: "initFilter",
3134 value: function initFilter() {
3135 if (this.options.filter || !this.options.filterByDataLength) {
3136 return;
3137 }
3138
3139 var length = 0;
3140 var _iteratorNormalCompletion = true;
3141 var _didIteratorError = false;
3142 var _iteratorError = undefined;
3143
3144 try {
3145 for (var _iterator = this.data[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
3146 var option = _step.value;
3147
3148 if (option.type === 'optgroup') {
3149 length += option.children.length;
3150 } else {
3151 length += 1;
3152 }
3153 }
3154 } catch (err) {
3155 _didIteratorError = true;
3156 _iteratorError = err;
3157 } finally {
3158 try {
3159 if (!_iteratorNormalCompletion && _iterator.return != null) {
3160 _iterator.return();
3161 }
3162 } finally {
3163 if (_didIteratorError) {
3164 throw _iteratorError;
3165 }
3166 }
3167 }
3168
3169 this.options.filter = length > this.options.filterByDataLength;
3170 }
3171 }, {
3172 key: "initDrop",
3173 value: function initDrop() {
3174 var _this4 = this;
3175
3176 this.initList();
3177 this.events();
3178 this.update(true);
3179 this.updateOptGroupSelect(true);
3180 this.updateSelectAll(false, true);
3181
3182 if (this.options.isOpen) {
3183 this.open();
3184 }
3185
3186 if (this.options.openOnHover) {
3187 this.$parent.hover(function () {
3188 _this4.open();
3189 }, function () {
3190 _this4.close();
3191 });
3192 }
3193 }
3194 }, {
3195 key: "initList",
3196 value: function initList() {
3197 var _this5 = this;
3198
3199 var html = [];
3200
3201 if (this.options.filter) {
3202 html.push("\n <div class=\"ms-search\">\n <input type=\"text\" autocomplete=\"off\" autocorrect=\"off\"\n autocapitalize=\"off\" spellcheck=\"false\"\n ".concat(sprintf(_templateObject5(), s)(this.options.filterPlaceholder), ">\n </div>\n "));
3203 }
3204
3205 html.push('<ul>');
3206
3207 if (this.options.selectAll && !this.options.single) {
3208 html.push(['<li class="ms-select-all">', '<label>', sprintf(_templateObject6(), s)(this.selectAllName), "<span>".concat(this.options.formatSelectAll(), "</span>"), '</label>', '</li>'].join(''));
3209 }
3210
3211 html.push(this.data.map(function (row) {
3212 return _this5.initListItem(row);
3213 }).join(''));
3214 html.push(sprintf(_templateObject7(), s)(this.options.formatNoMatchesFound()));
3215 html.push('</ul>');
3216 this.$drop.html(html.join(''));
3217 this.$drop.find('ul').css('max-height', "".concat(this.options.maxHeight, "px"));
3218 this.$drop.find('.multiple').css('width', "".concat(this.options.multipleWidth, "px"));
3219 this.$searchInput = this.$drop.find('.ms-search input');
3220 this.$selectAll = this.$drop.find("input[".concat(this.selectAllName, "]"));
3221 this.$selectGroups = this.$drop.find("input[".concat(this.selectGroupName, "]"));
3222 this.$selectItems = this.$drop.find("input[".concat(this.selectItemName, "]:enabled"));
3223 this.$disableItems = this.$drop.find("input[".concat(this.selectItemName, "]:disabled"));
3224 this.$noResults = this.$drop.find('.ms-no-results');
3225 }
3226 }, {
3227 key: "initListItem",
3228 value: function initListItem(row) {
3229 var _this6 = this;
3230
3231 var level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
3232 var title = sprintf(_templateObject8(), s)(row.title);
3233 var multiple = this.options.multiple ? 'multiple' : '';
3234 var type = this.options.single ? 'radio' : 'checkbox';
3235 var classes = '';
3236
3237 if (this.options.single && !this.options.singleRadio) {
3238 classes = 'hide-radio ';
3239 }
3240
3241 if (row.type === 'optgroup') {
3242 var _customStyle = this.options.styler(row);
3243
3244 var _style = _customStyle ? sprintf(_templateObject9(), s)(_customStyle) : '';
3245
3246 var html = [];
3247 html.push(["<li class=\"group ".concat(classes, "\" ").concat(_style, ">"), sprintf(_templateObject10(), s, s)(row.disabled ? 'disabled' : '', row.group), this.options.hideOptgroupCheckboxes || this.options.single ? '' : sprintf(_templateObject11(), s, s)(this.selectGroupName, row.disabled ? 'disabled="disabled"' : ''), row.label, '</label>', '</li>'].join(''));
3248 html.push(row.children.map(function (child) {
3249 return _this6.initListItem(child, 1);
3250 }).join(''));
3251 return html.join('');
3252 }
3253
3254 var customStyle = this.options.styler(row);
3255 var style = customStyle ? sprintf(_templateObject12(), s)(customStyle) : '';
3256 classes += row.classes || '';
3257
3258 if (level && this.options.single) {
3259 classes += "option-level-".concat(level, " ");
3260 }
3261
3262 return [sprintf(_templateObject13(), s, s, s, s)(multiple, classes, title, style), sprintf(_templateObject14(), s)(row.disabled ? 'disabled' : ''), sprintf(_templateObject15(), s, s, s, s, s, s)(type, row.value, this.selectItemName, row.selected ? ' checked="checked"' : '', row.disabled ? ' disabled="disabled"' : '', sprintf(_templateObject16(), s)(row.group)), sprintf(_templateObject17(), s)(row.text), '</label>', '</li>'].join('');
3263 }
3264 }, {
3265 key: "initView",
3266 value: function initView() {
3267 var computedWidth;
3268
3269 if (window.getComputedStyle) {
3270 computedWidth = window.getComputedStyle(this.$el[0]).width;
3271
3272 if (computedWidth === 'auto') {
3273 computedWidth = this.$drop.outerWidth() + 20;
3274 }
3275 } else {
3276 computedWidth = this.$el.outerWidth() + 20;
3277 }
3278
3279 this.$parent.css('width', this.options.width || computedWidth);
3280 }
3281 }, {
3282 key: "events",
3283 value: function events() {
3284 var _this7 = this;
3285
3286 var toggleOpen = function toggleOpen(e) {
3287 e.preventDefault();
3288
3289 _this7[_this7.options.isOpen ? 'close' : 'open']();
3290 };
3291
3292 if (this.$label && this.$label.length) {
3293 this.$label.off('click').on('click', function (e) {
3294 if (e.target.nodeName.toLowerCase() !== 'label') {
3295 return;
3296 }
3297
3298 toggleOpen(e);
3299
3300 if (!_this7.options.filter || !_this7.options.isOpen) {
3301 _this7.focus();
3302 }
3303
3304 e.stopPropagation(); // Causes lost focus otherwise
3305 });
3306 }
3307
3308 this.$choice.off('click').on('click', toggleOpen).off('focus').on('focus', this.options.onFocus).off('blur').on('blur', this.options.onBlur);
3309 this.$parent.off('keydown').on('keydown', function (e) {
3310 // esc key
3311 if (e.which === 27 && !_this7.options.keepOpen) {
3312 _this7.close();
3313
3314 _this7.$choice.focus();
3315 }
3316 });
3317 this.$searchInput.off('keydown').on('keydown', function (e) {
3318 // Ensure shift-tab causes lost focus from filter as with clicking away
3319 if (e.keyCode === 9 && e.shiftKey) {
3320 _this7.close();
3321 }
3322 }).off('keyup').on('keyup', function (e) {
3323 // enter or space
3324 // Avoid selecting/deselecting if no choices made
3325 if (_this7.options.filterAcceptOnEnter && [13, 32].includes(e.which) && _this7.$searchInput.val()) {
3326 if (_this7.options.single) {
3327 var $items = _this7.$selectItems.closest('li').filter(':visible');
3328
3329 if ($items.length) {
3330 _this7.setSelects([$items.first().find("input[".concat(_this7.selectItemName, "]")).val()]);
3331 }
3332 } else {
3333 _this7.$selectAll.click();
3334 }
3335
3336 _this7.close();
3337
3338 _this7.focus();
3339
3340 return;
3341 }
3342
3343 _this7.filter();
3344 });
3345 this.$selectAll.off('click').on('click', function (e) {
3346 var checked = $(e.currentTarget).prop('checked');
3347
3348 var $items = _this7.$selectItems.filter(':visible');
3349
3350 if ($items.length === _this7.$selectItems.length) {
3351 _this7[checked ? 'checkAll' : 'uncheckAll']();
3352 } else {
3353 // when the filter option is true
3354 _this7.$selectGroups.prop('checked', checked);
3355
3356 $items.prop('checked', checked);
3357
3358 _this7.options[checked ? 'onCheckAll' : 'onUncheckAll']();
3359
3360 _this7.update();
3361 }
3362 });
3363 this.$selectGroups.off('click').on('click', function (e) {
3364 var $this = $(e.currentTarget);
3365 var group = $this.parent()[0].getAttribute('data-group');
3366
3367 var $items = _this7.$selectItems.filter(':visible');
3368
3369 var $children = $items.filter(sprintf(_templateObject18(), s)(group));
3370 var checked = $children.length !== $children.filter(':checked').length;
3371 $children.prop('checked', checked);
3372
3373 _this7.updateSelectAll(true);
3374
3375 _this7.update();
3376
3377 _this7.options.onOptgroupClick({
3378 label: $this.parent().text(),
3379 checked: checked,
3380 children: $children.get().map(function (el) {
3381 return {
3382 label: $(el).parent().text(),
3383 value: $(el).val(),
3384 check: $(el).prop('checked')
3385 };
3386 })
3387 });
3388 });
3389 this.$selectItems.off('click').on('click', function (e) {
3390 var $this = $(e.currentTarget);
3391
3392 if (_this7.options.single) {
3393 var clickedVal = $this.val();
3394
3395 _this7.$selectItems.filter(function (i, el) {
3396 return $(el).val() !== clickedVal;
3397 }).each(function (i, el) {
3398 $(el).prop('checked', false);
3399 });
3400 }
3401
3402 _this7.updateSelectAll(true);
3403
3404 _this7.update();
3405
3406 _this7.updateOptGroupSelect();
3407
3408 _this7.options.onClick({
3409 label: $this.parent().text(),
3410 value: $this.val(),
3411 checked: $this.prop('checked')
3412 });
3413
3414 if (_this7.options.single && _this7.options.isOpen && !_this7.options.keepOpen) {
3415 _this7.close();
3416 }
3417 });
3418 }
3419 }, {
3420 key: "open",
3421 value: function open() {
3422 if (this.$choice.hasClass('disabled')) {
3423 return;
3424 }
3425
3426 this.options.isOpen = true;
3427 this.$choice.find('>div').addClass('open');
3428 this.$drop[this.animateMethod('show')](); // fix filter bug: no results show
3429
3430 this.$selectAll.parent().show();
3431 this.$noResults.hide(); // Fix #77: 'All selected' when no options
3432
3433 if (!this.data.length) {
3434 this.$selectAll.parent().hide();
3435 this.$noResults.show();
3436 }
3437
3438 if (this.options.container) {
3439 var offset = this.$drop.offset();
3440 this.$drop.appendTo($(this.options.container));
3441 this.$drop.offset({
3442 top: offset.top,
3443 left: offset.left
3444 }).css('min-width', 'auto').outerWidth(this.$parent.outerWidth());
3445 }
3446
3447 if (this.data.length && this.options.filter) {
3448 this.$searchInput.val('');
3449 this.$searchInput.focus();
3450 this.filter();
3451 }
3452
3453 this.options.onOpen();
3454 }
3455 }, {
3456 key: "close",
3457 value: function close() {
3458 this.options.isOpen = false;
3459 this.$choice.find('>div').removeClass('open');
3460 this.$drop[this.animateMethod('hide')]();
3461
3462 if (this.options.container) {
3463 this.$parent.append(this.$drop);
3464 this.$drop.css({
3465 'top': 'auto',
3466 'left': 'auto'
3467 });
3468 }
3469
3470 this.options.onClose();
3471 }
3472 }, {
3473 key: "animateMethod",
3474 value: function animateMethod(method) {
3475 var methods = {
3476 show: {
3477 fade: 'fadeIn',
3478 slide: 'slideDown'
3479 },
3480 hide: {
3481 fade: 'fadeOut',
3482 slide: 'slideUp'
3483 }
3484 };
3485 return methods[method][this.options.animate] || method;
3486 }
3487 }, {
3488 key: "update",
3489 value: function update(ignoreTrigger) {
3490 var textSelects = this.getSelects('text');
3491
3492 if (this.options.displayHtml) {
3493 textSelects = this.getSelects('html');
3494 } else if (this.options.displayValues) {
3495 textSelects = this.getSelects();
3496 }
3497
3498 var $span = this.$choice.find('>span');
3499 var sl = textSelects.length;
3500 var html = '';
3501
3502 if (sl === 0) {
3503 $span.addClass('placeholder').html(this.options.placeholder);
3504 } else if (sl < this.options.minimumCountSelected) {
3505 html = textSelects.join(this.options.displayDelimiter);
3506 } else if (this.options.formatAllSelected() && sl === this.$selectItems.length + this.$disableItems.length) {
3507 html = this.options.formatAllSelected();
3508 } else if (this.options.ellipsis && sl > this.options.minimumCountSelected) {
3509 html = "".concat(textSelects.slice(0, this.options.minimumCountSelected).join(this.options.displayDelimiter), "...");
3510 } else if (this.options.formatCountSelected() && sl > this.options.minimumCountSelected) {
3511 html = this.options.formatCountSelected(sl, this.$selectItems.length + this.$disableItems.length);
3512 } else {
3513 html = textSelects.join(this.options.displayDelimiter);
3514 }
3515
3516 if (html) {
3517 $span.removeClass('placeholder').html(html);
3518 }
3519
3520 if (this.options.displayTitle) {
3521 $span.prop('title', this.getSelects('text'));
3522 } // set selects to select
3523
3524
3525 this.$el.val(this.getSelects()); // add selected class to selected li
3526
3527 this.$drop.find('li').removeClass('selected');
3528 this.$drop.find('input:checked').each(function (i, el) {
3529 $(el).parents('li').first().addClass('selected');
3530 }); // trigger <select> change event
3531
3532 if (!ignoreTrigger) {
3533 this.$el.trigger('change');
3534 }
3535 }
3536 }, {
3537 key: "updateSelectAll",
3538 value: function updateSelectAll(triggerEvent) {
3539 var all = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
3540 var $items = this.$selectItems;
3541
3542 if (!all) {
3543 $items = $items.filter(':visible');
3544 }
3545
3546 var selectedLength = $items.filter(':checked').length;
3547 this.$selectAll.prop('checked', selectedLength === $items.length);
3548
3549 if (triggerEvent) {
3550 if (selectedLength === $items.length) {
3551 this.options.onCheckAll();
3552 } else if (selectedLength === 0) {
3553 this.options.onUncheckAll();
3554 }
3555 }
3556 }
3557 }, {
3558 key: "updateOptGroupSelect",
3559 value: function updateOptGroupSelect() {
3560 var all = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
3561 var $items = this.$selectItems;
3562
3563 if (!all) {
3564 $items = $items.filter(':visible');
3565 }
3566
3567 $.each(this.$selectGroups, function (i, val) {
3568 var group = $(val).parent()[0].getAttribute('data-group');
3569 var $children = $items.filter(sprintf(_templateObject19(), s)(group));
3570 $(val).prop('checked', $children.length && $children.length === $children.filter(':checked').length);
3571 });
3572 }
3573 }, {
3574 key: "getOptions",
3575 value: function getOptions() {
3576 // deep copy and remove data
3577 var options = $.extend({}, this.options);
3578 delete options.data;
3579 return $.extend(true, {}, options);
3580 }
3581 }, {
3582 key: "refreshOptions",
3583 value: function refreshOptions(options) {
3584 // If the objects are equivalent then avoid the call of destroy / init methods
3585 if (compareObjects(this.options, options, true)) {
3586 return;
3587 }
3588
3589 this.options = $.extend(this.options, options);
3590 this.destroy();
3591 this.init();
3592 } // value html, or text, default: 'value'
3593
3594 }, {
3595 key: "getSelects",
3596 value: function getSelects(type) {
3597 var _this8 = this;
3598
3599 var texts = [];
3600 var values = [];
3601 this.$drop.find(sprintf(_templateObject20(), s)(this.selectItemName)).each(function (i, el) {
3602 texts.push($(el).next()[type === 'html' ? 'html' : 'text']());
3603 values.push($(el).val());
3604 });
3605
3606 if (type === 'text' && this.$selectGroups.length) {
3607 texts = [];
3608 this.$selectGroups.each(function (i, el) {
3609 var html = [];
3610 var text = $.trim($(el).parent().text());
3611 var group = $(el).parent().data('group');
3612
3613 var $children = _this8.$drop.find(sprintf(_templateObject21(), s, s)(_this8.selectItemName, group));
3614
3615 var $selected = $children.filter(':checked');
3616
3617 if (!$selected.length) {
3618 return;
3619 }
3620
3621 html.push('[');
3622 html.push(text);
3623
3624 if ($children.length > $selected.length) {
3625 var list = [];
3626 $selected.each(function (j, elem) {
3627 list.push($(elem).parent().text());
3628 });
3629 html.push(": ".concat(list.join(', ')));
3630 }
3631
3632 html.push(']');
3633 texts.push(html.join(''));
3634 });
3635 }
3636
3637 return ['html', 'text'].includes(type) ? texts : values;
3638 }
3639 }, {
3640 key: "setSelects",
3641 value: function setSelects(values) {
3642 var _this9 = this;
3643
3644 this.$selectItems.prop('checked', false);
3645 this.$disableItems.prop('checked', false);
3646 $.each(values, function (i, value) {
3647 _this9.$selectItems.filter(sprintf(_templateObject22(), s)(value)).prop('checked', true);
3648
3649 _this9.$disableItems.filter(sprintf(_templateObject23(), s)(value)).prop('checked', true);
3650 });
3651 this.$selectAll.prop('checked', this.$selectItems.length === this.$selectItems.filter(':checked').length + this.$disableItems.filter(':checked').length);
3652 $.each(this.$selectGroups, function (i, val) {
3653 var group = $(val).parent()[0].getAttribute('data-group');
3654
3655 var $children = _this9.$selectItems.filter("[data-group=\"".concat(group, "\"]"));
3656
3657 $(val).prop('checked', $children.length && $children.length === $children.filter(':checked').length);
3658 });
3659 this.update(false);
3660 }
3661 }, {
3662 key: "enable",
3663 value: function enable() {
3664 this.$choice.removeClass('disabled');
3665 }
3666 }, {
3667 key: "disable",
3668 value: function disable() {
3669 this.$choice.addClass('disabled');
3670 }
3671 }, {
3672 key: "check",
3673 value: function check(value) {
3674 if (this.options.single) {
3675 this.$selectItems.prop('checked', false);
3676 this.$disableItems.prop('checked', false);
3677 }
3678
3679 this._check(value, true);
3680 }
3681 }, {
3682 key: "uncheck",
3683 value: function uncheck(value) {
3684 this._check(value, false);
3685 }
3686 }, {
3687 key: "_check",
3688 value: function _check(value, checked) {
3689 this.$selectItems.filter(sprintf(_templateObject24(), s)(value)).prop('checked', checked);
3690 this.$disableItems.filter(sprintf(_templateObject25(), s)(value)).prop('checked', checked);
3691 this.update();
3692 this.updateOptGroupSelect(true);
3693 this.updateSelectAll(true, true);
3694 }
3695 }, {
3696 key: "checkAll",
3697 value: function checkAll() {
3698 this._checkAll(true);
3699
3700 this.options.onCheckAll();
3701 }
3702 }, {
3703 key: "uncheckAll",
3704 value: function uncheckAll() {
3705 this._checkAll(false);
3706
3707 this.options.onUncheckAll();
3708 }
3709 }, {
3710 key: "_checkAll",
3711 value: function _checkAll(checked) {
3712 this.$selectItems.prop('checked', checked);
3713 this.$selectGroups.prop('checked', checked);
3714 this.$selectAll.prop('checked', checked);
3715 this.update();
3716 }
3717 }, {
3718 key: "checkInvert",
3719 value: function checkInvert() {
3720 if (this.options.single) {
3721 return;
3722 }
3723
3724 this.$selectItems.each(function (i, el) {
3725 $(el).prop('checked', !$(el).prop('checked'));
3726 });
3727 this.update();
3728 this.updateOptGroupSelect(true);
3729 this.updateSelectAll(true, true);
3730 }
3731 }, {
3732 key: "focus",
3733 value: function focus() {
3734 this.$choice.focus();
3735 this.options.onFocus();
3736 }
3737 }, {
3738 key: "blur",
3739 value: function blur() {
3740 this.$choice.blur();
3741 this.options.onBlur();
3742 }
3743 }, {
3744 key: "refresh",
3745 value: function refresh() {
3746 this.destroy();
3747 this.init();
3748 }
3749 }, {
3750 key: "filter",
3751 value: function filter() {
3752 var _this10 = this;
3753
3754 var originalText = $.trim(this.$searchInput.val());
3755 var text = originalText.toLowerCase();
3756
3757 if (text.length === 0) {
3758 this.$selectAll.closest('li').show();
3759 this.$selectItems.closest('li').show();
3760 this.$disableItems.closest('li').show();
3761 this.$selectGroups.closest('li').show();
3762 this.$noResults.hide();
3763 } else {
3764 if (!this.options.filterGroup) {
3765 this.$selectItems.each(function (i, el) {
3766 var $parent = $(el).parent();
3767
3768 var hasText = _this10.options.customFilter(removeDiacritics($parent.text().toLowerCase()), removeDiacritics(text), $parent.text(), originalText);
3769
3770 $parent.closest('li')[hasText ? 'show' : 'hide']();
3771 });
3772 }
3773
3774 this.$disableItems.closest('li').hide();
3775 this.$selectGroups.each(function (i, el) {
3776 var $parent = $(el).parent();
3777 var group = $parent[0].getAttribute('data-group');
3778
3779 if (_this10.options.filterGroup) {
3780 var hasText = _this10.options.customFilter(removeDiacritics($parent.text().toLowerCase()), removeDiacritics(text), $parent.text(), originalText);
3781
3782 var func = hasText ? 'show' : 'hide';
3783 $parent.closest('li')[func]();
3784
3785 _this10.$selectItems.filter("[data-group=\"".concat(group, "\"]")).closest('li')[func]();
3786 } else {
3787 var $items = _this10.$selectItems.filter(':visible');
3788
3789 var _hasText = $items.filter(sprintf(_templateObject26(), s)(group)).length;
3790 $parent.closest('li')[_hasText ? 'show' : 'hide']();
3791 }
3792 }); // Check if no matches found
3793
3794 if (this.$selectItems.closest('li').filter(':visible').length) {
3795 this.$selectAll.closest('li').show();
3796 this.$noResults.hide();
3797 } else {
3798 this.$selectAll.closest('li').hide();
3799 this.$noResults.show();
3800 }
3801 }
3802
3803 this.updateOptGroupSelect();
3804 this.updateSelectAll();
3805 this.options.onFilter(text);
3806 }
3807 }, {
3808 key: "destroy",
3809 value: function destroy() {
3810 if (!this.$parent) {
3811 return;
3812 }
3813
3814 this.$el.before(this.$parent).show();
3815 this.$parent.remove();
3816
3817 if (this.fromHtml) {
3818 delete this.options.data;
3819 this.fromHtml = false;
3820 }
3821 }
3822 }]);
3823
3824 return MultipleSelect;
3825}();
3826
3827$.fn.multipleSelect = function (option) {
3828 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
3829 args[_key - 1] = arguments[_key];
3830 }
3831
3832 var value;
3833 this.each(function (i, el) {
3834 var $this = $(el);
3835 var data = $this.data('multipleSelect');
3836 var options = $.extend({}, $this.data(), _typeof(option) === 'object' && option);
3837
3838 if (!data) {
3839 data = new MultipleSelect($this, options);
3840 $this.data('multipleSelect', data);
3841 }
3842
3843 if (typeof option === 'string') {
3844 var _data;
3845
3846 if ($.inArray(option, Constants.METHODS) < 0) {
3847 throw new Error("Unknown method: ".concat(option));
3848 }
3849
3850 value = (_data = data)[option].apply(_data, args);
3851
3852 if (option === 'destroy') {
3853 $this.removeData('multipleSelect');
3854 }
3855 } else {
3856 data.init();
3857 }
3858 });
3859 return typeof value !== 'undefined' ? value : this;
3860};
3861
3862$.fn.multipleSelect.defaults = Constants.DEFAULTS;
3863$.fn.multipleSelect.locales = Constants.LOCALES;
3864$.fn.multipleSelect.methods = Constants.METHODS;