UNPKG

93.9 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
563// `Object.keys` method
564// https://tc39.github.io/ecma262/#sec-object.keys
565var objectKeys = Object.keys || function keys(O) {
566 return objectKeysInternal(O, enumBugKeys);
567};
568
569// `ToObject` abstract operation
570// https://tc39.github.io/ecma262/#sec-toobject
571var toObject = function (argument) {
572 return Object(requireObjectCoercible(argument));
573};
574
575var nativeAssign = Object.assign;
576
577// `Object.assign` method
578// https://tc39.github.io/ecma262/#sec-object.assign
579// should work with symbols and should have deterministic property order (V8 bug)
580var objectAssign = !nativeAssign || fails(function () {
581 var A = {};
582 var B = {};
583 // eslint-disable-next-line no-undef
584 var symbol = Symbol();
585 var alphabet = 'abcdefghijklmnopqrst';
586 A[symbol] = 7;
587 alphabet.split('').forEach(function (chr) { B[chr] = chr; });
588 return nativeAssign({}, A)[symbol] != 7 || objectKeys(nativeAssign({}, B)).join('') != alphabet;
589}) ? function assign(target, source) { // eslint-disable-line no-unused-vars
590 var T = toObject(target);
591 var argumentsLength = arguments.length;
592 var index = 1;
593 var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
594 var propertyIsEnumerable = objectPropertyIsEnumerable.f;
595 while (argumentsLength > index) {
596 var S = indexedObject(arguments[index++]);
597 var keys = getOwnPropertySymbols ? objectKeys(S).concat(getOwnPropertySymbols(S)) : objectKeys(S);
598 var length = keys.length;
599 var j = 0;
600 var key;
601 while (length > j) {
602 key = keys[j++];
603 if (!descriptors || propertyIsEnumerable.call(S, key)) T[key] = S[key];
604 }
605 } return T;
606} : nativeAssign;
607
608// `Object.assign` method
609// https://tc39.github.io/ecma262/#sec-object.assign
610_export({ target: 'Object', stat: true, forced: Object.assign !== objectAssign }, {
611 assign: objectAssign
612});
613
614var VERSION = '1.4.0';
615var DEFAULTS = {
616 name: '',
617 placeholder: '',
618 data: undefined,
619 locale: undefined,
620 selectAll: true,
621 single: false,
622 singleRadio: false,
623 multiple: false,
624 hideOptgroupCheckboxes: false,
625 multipleWidth: 80,
626 width: undefined,
627 dropWidth: undefined,
628 maxHeight: 250,
629 position: 'bottom',
630 displayValues: false,
631 displayTitle: false,
632 displayDelimiter: ', ',
633 minimumCountSelected: 3,
634 ellipsis: false,
635 isOpen: false,
636 keepOpen: false,
637 openOnHover: false,
638 container: null,
639 filter: false,
640 filterGroup: false,
641 filterPlaceholder: '',
642 filterAcceptOnEnter: false,
643 animate: undefined,
644 styler: function styler() {
645 return false;
646 },
647 textTemplate: function textTemplate($elm) {
648 return $elm[0].innerHTML;
649 },
650 labelTemplate: function labelTemplate($elm) {
651 return $elm[0].getAttribute('label');
652 },
653 onOpen: function onOpen() {
654 return false;
655 },
656 onClose: function onClose() {
657 return false;
658 },
659 onCheckAll: function onCheckAll() {
660 return false;
661 },
662 onUncheckAll: function onUncheckAll() {
663 return false;
664 },
665 onFocus: function onFocus() {
666 return false;
667 },
668 onBlur: function onBlur() {
669 return false;
670 },
671 onOptgroupClick: function onOptgroupClick() {
672 return false;
673 },
674 onClick: function onClick() {
675 return false;
676 },
677 onFilter: function onFilter() {
678 return false;
679 },
680 onAfterCreate: function onAfterCreate() {
681 return false;
682 }
683};
684var EN = {
685 formatSelectAll: function formatSelectAll() {
686 return '[Select all]';
687 },
688 formatAllSelected: function formatAllSelected() {
689 return 'All selected';
690 },
691 formatCountSelected: function formatCountSelected(count, total) {
692 return count + ' of ' + total + ' selected';
693 },
694 formatNoMatchesFound: function formatNoMatchesFound() {
695 return 'No matches found';
696 }
697};
698var METHODS = ['getOptions', 'refreshOptions', 'getSelects', 'setSelects', 'enable', 'disable', 'open', 'close', 'checkAll', 'uncheckAll', 'focus', 'blur', 'refresh', 'destroy'];
699Object.assign(DEFAULTS, EN);
700var Constants = {
701 VERSION: VERSION,
702 DEFAULTS: DEFAULTS,
703 METHODS: METHODS,
704 LOCALES: {
705 en: EN,
706 'en-US': EN
707 }
708};
709
710var aFunction$1 = function (it) {
711 if (typeof it != 'function') {
712 throw TypeError(String(it) + ' is not a function');
713 } return it;
714};
715
716// optional / simple context binding
717var bindContext = function (fn, that, length) {
718 aFunction$1(fn);
719 if (that === undefined) return fn;
720 switch (length) {
721 case 0: return function () {
722 return fn.call(that);
723 };
724 case 1: return function (a) {
725 return fn.call(that, a);
726 };
727 case 2: return function (a, b) {
728 return fn.call(that, a, b);
729 };
730 case 3: return function (a, b, c) {
731 return fn.call(that, a, b, c);
732 };
733 }
734 return function (/* ...args */) {
735 return fn.apply(that, arguments);
736 };
737};
738
739// `IsArray` abstract operation
740// https://tc39.github.io/ecma262/#sec-isarray
741var isArray = Array.isArray || function isArray(arg) {
742 return classofRaw(arg) == 'Array';
743};
744
745var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () {
746 // Chrome 38 Symbol has incorrect toString conversion
747 // eslint-disable-next-line no-undef
748 return !String(Symbol());
749});
750
751var Symbol$1 = global_1.Symbol;
752var store$1 = shared('wks');
753
754var wellKnownSymbol = function (name) {
755 return store$1[name] || (store$1[name] = nativeSymbol && Symbol$1[name]
756 || (nativeSymbol ? Symbol$1 : uid)('Symbol.' + name));
757};
758
759var SPECIES = wellKnownSymbol('species');
760
761// `ArraySpeciesCreate` abstract operation
762// https://tc39.github.io/ecma262/#sec-arrayspeciescreate
763var arraySpeciesCreate = function (originalArray, length) {
764 var C;
765 if (isArray(originalArray)) {
766 C = originalArray.constructor;
767 // cross-realm fallback
768 if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;
769 else if (isObject(C)) {
770 C = C[SPECIES];
771 if (C === null) C = undefined;
772 }
773 } return new (C === undefined ? Array : C)(length === 0 ? 0 : length);
774};
775
776var push = [].push;
777
778// `Array.prototype.{ forEach, map, filter, some, every, find, findIndex }` methods implementation
779var createMethod$1 = function (TYPE) {
780 var IS_MAP = TYPE == 1;
781 var IS_FILTER = TYPE == 2;
782 var IS_SOME = TYPE == 3;
783 var IS_EVERY = TYPE == 4;
784 var IS_FIND_INDEX = TYPE == 6;
785 var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
786 return function ($this, callbackfn, that, specificCreate) {
787 var O = toObject($this);
788 var self = indexedObject(O);
789 var boundFunction = bindContext(callbackfn, that, 3);
790 var length = toLength(self.length);
791 var index = 0;
792 var create = specificCreate || arraySpeciesCreate;
793 var target = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;
794 var value, result;
795 for (;length > index; index++) if (NO_HOLES || index in self) {
796 value = self[index];
797 result = boundFunction(value, index, O);
798 if (TYPE) {
799 if (IS_MAP) target[index] = result; // map
800 else if (result) switch (TYPE) {
801 case 3: return true; // some
802 case 5: return value; // find
803 case 6: return index; // findIndex
804 case 2: push.call(target, value); // filter
805 } else if (IS_EVERY) return false; // every
806 }
807 }
808 return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
809 };
810};
811
812var arrayIteration = {
813 // `Array.prototype.forEach` method
814 // https://tc39.github.io/ecma262/#sec-array.prototype.foreach
815 forEach: createMethod$1(0),
816 // `Array.prototype.map` method
817 // https://tc39.github.io/ecma262/#sec-array.prototype.map
818 map: createMethod$1(1),
819 // `Array.prototype.filter` method
820 // https://tc39.github.io/ecma262/#sec-array.prototype.filter
821 filter: createMethod$1(2),
822 // `Array.prototype.some` method
823 // https://tc39.github.io/ecma262/#sec-array.prototype.some
824 some: createMethod$1(3),
825 // `Array.prototype.every` method
826 // https://tc39.github.io/ecma262/#sec-array.prototype.every
827 every: createMethod$1(4),
828 // `Array.prototype.find` method
829 // https://tc39.github.io/ecma262/#sec-array.prototype.find
830 find: createMethod$1(5),
831 // `Array.prototype.findIndex` method
832 // https://tc39.github.io/ecma262/#sec-array.prototype.findIndex
833 findIndex: createMethod$1(6)
834};
835
836var SPECIES$1 = wellKnownSymbol('species');
837
838var arrayMethodHasSpeciesSupport = function (METHOD_NAME) {
839 return !fails(function () {
840 var array = [];
841 var constructor = array.constructor = {};
842 constructor[SPECIES$1] = function () {
843 return { foo: 1 };
844 };
845 return array[METHOD_NAME](Boolean).foo !== 1;
846 });
847};
848
849var $filter = arrayIteration.filter;
850
851
852// `Array.prototype.filter` method
853// https://tc39.github.io/ecma262/#sec-array.prototype.filter
854// with adding support of @@species
855_export({ target: 'Array', proto: true, forced: !arrayMethodHasSpeciesSupport('filter') }, {
856 filter: function filter(callbackfn /* , thisArg */) {
857 return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
858 }
859});
860
861// `Object.defineProperties` method
862// https://tc39.github.io/ecma262/#sec-object.defineproperties
863var objectDefineProperties = descriptors ? Object.defineProperties : function defineProperties(O, Properties) {
864 anObject(O);
865 var keys = objectKeys(Properties);
866 var length = keys.length;
867 var index = 0;
868 var key;
869 while (length > index) objectDefineProperty.f(O, key = keys[index++], Properties[key]);
870 return O;
871};
872
873var html = getBuiltIn('document', 'documentElement');
874
875var IE_PROTO = sharedKey('IE_PROTO');
876
877var PROTOTYPE = 'prototype';
878var Empty = function () { /* empty */ };
879
880// Create object with fake `null` prototype: use iframe Object with cleared prototype
881var createDict = function () {
882 // Thrash, waste and sodomy: IE GC bug
883 var iframe = documentCreateElement('iframe');
884 var length = enumBugKeys.length;
885 var lt = '<';
886 var script = 'script';
887 var gt = '>';
888 var js = 'java' + script + ':';
889 var iframeDocument;
890 iframe.style.display = 'none';
891 html.appendChild(iframe);
892 iframe.src = String(js);
893 iframeDocument = iframe.contentWindow.document;
894 iframeDocument.open();
895 iframeDocument.write(lt + script + gt + 'document.F=Object' + lt + '/' + script + gt);
896 iframeDocument.close();
897 createDict = iframeDocument.F;
898 while (length--) delete createDict[PROTOTYPE][enumBugKeys[length]];
899 return createDict();
900};
901
902// `Object.create` method
903// https://tc39.github.io/ecma262/#sec-object.create
904var objectCreate = Object.create || function create(O, Properties) {
905 var result;
906 if (O !== null) {
907 Empty[PROTOTYPE] = anObject(O);
908 result = new Empty();
909 Empty[PROTOTYPE] = null;
910 // add "__proto__" for Object.getPrototypeOf polyfill
911 result[IE_PROTO] = O;
912 } else result = createDict();
913 return Properties === undefined ? result : objectDefineProperties(result, Properties);
914};
915
916hiddenKeys[IE_PROTO] = true;
917
918var UNSCOPABLES = wellKnownSymbol('unscopables');
919var ArrayPrototype = Array.prototype;
920
921// Array.prototype[@@unscopables]
922// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
923if (ArrayPrototype[UNSCOPABLES] == undefined) {
924 hide(ArrayPrototype, UNSCOPABLES, objectCreate(null));
925}
926
927// add a key to Array.prototype[@@unscopables]
928var addToUnscopables = function (key) {
929 ArrayPrototype[UNSCOPABLES][key] = true;
930};
931
932var $find = arrayIteration.find;
933
934
935var FIND = 'find';
936var SKIPS_HOLES = true;
937
938// Shouldn't skip holes
939if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });
940
941// `Array.prototype.find` method
942// https://tc39.github.io/ecma262/#sec-array.prototype.find
943_export({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
944 find: function find(callbackfn /* , that = undefined */) {
945 return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
946 }
947});
948
949// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
950addToUnscopables(FIND);
951
952var $includes = arrayIncludes.includes;
953
954
955// `Array.prototype.includes` method
956// https://tc39.github.io/ecma262/#sec-array.prototype.includes
957_export({ target: 'Array', proto: true }, {
958 includes: function includes(el /* , fromIndex = 0 */) {
959 return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
960 }
961});
962
963// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
964addToUnscopables('includes');
965
966var sloppyArrayMethod = function (METHOD_NAME, argument) {
967 var method = [][METHOD_NAME];
968 return !method || !fails(function () {
969 // eslint-disable-next-line no-useless-call,no-throw-literal
970 method.call(null, argument || function () { throw 1; }, 1);
971 });
972};
973
974var nativeJoin = [].join;
975
976var ES3_STRINGS = indexedObject != Object;
977var SLOPPY_METHOD = sloppyArrayMethod('join', ',');
978
979// `Array.prototype.join` method
980// https://tc39.github.io/ecma262/#sec-array.prototype.join
981_export({ target: 'Array', proto: true, forced: ES3_STRINGS || SLOPPY_METHOD }, {
982 join: function join(separator) {
983 return nativeJoin.call(toIndexedObject(this), separator === undefined ? ',' : separator);
984 }
985});
986
987var $map = arrayIteration.map;
988
989
990// `Array.prototype.map` method
991// https://tc39.github.io/ecma262/#sec-array.prototype.map
992// with adding support of @@species
993_export({ target: 'Array', proto: true, forced: !arrayMethodHasSpeciesSupport('map') }, {
994 map: function map(callbackfn /* , thisArg */) {
995 return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
996 }
997});
998
999var createProperty = function (object, key, value) {
1000 var propertyKey = toPrimitive(key);
1001 if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value));
1002 else object[propertyKey] = value;
1003};
1004
1005var SPECIES$2 = wellKnownSymbol('species');
1006var nativeSlice = [].slice;
1007var max$1 = Math.max;
1008
1009// `Array.prototype.slice` method
1010// https://tc39.github.io/ecma262/#sec-array.prototype.slice
1011// fallback for not array-like ES3 strings and DOM objects
1012_export({ target: 'Array', proto: true, forced: !arrayMethodHasSpeciesSupport('slice') }, {
1013 slice: function slice(start, end) {
1014 var O = toIndexedObject(this);
1015 var length = toLength(O.length);
1016 var k = toAbsoluteIndex(start, length);
1017 var fin = toAbsoluteIndex(end === undefined ? length : end, length);
1018 // inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible
1019 var Constructor, result, n;
1020 if (isArray(O)) {
1021 Constructor = O.constructor;
1022 // cross-realm fallback
1023 if (typeof Constructor == 'function' && (Constructor === Array || isArray(Constructor.prototype))) {
1024 Constructor = undefined;
1025 } else if (isObject(Constructor)) {
1026 Constructor = Constructor[SPECIES$2];
1027 if (Constructor === null) Constructor = undefined;
1028 }
1029 if (Constructor === Array || Constructor === undefined) {
1030 return nativeSlice.call(O, k, fin);
1031 }
1032 }
1033 result = new (Constructor === undefined ? Array : Constructor)(max$1(fin - k, 0));
1034 for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]);
1035 result.length = n;
1036 return result;
1037 }
1038});
1039
1040var defineProperty = objectDefineProperty.f;
1041
1042var FunctionPrototype = Function.prototype;
1043var FunctionPrototypeToString = FunctionPrototype.toString;
1044var nameRE = /^\s*function ([^ (]*)/;
1045var NAME = 'name';
1046
1047// Function instances `.name` property
1048// https://tc39.github.io/ecma262/#sec-function-instances-name
1049if (descriptors && !(NAME in FunctionPrototype)) {
1050 defineProperty(FunctionPrototype, NAME, {
1051 configurable: true,
1052 get: function () {
1053 try {
1054 return FunctionPrototypeToString.call(this).match(nameRE)[1];
1055 } catch (error) {
1056 return '';
1057 }
1058 }
1059 });
1060}
1061
1062var MATCH = wellKnownSymbol('match');
1063
1064// `IsRegExp` abstract operation
1065// https://tc39.github.io/ecma262/#sec-isregexp
1066var isRegexp = function (it) {
1067 var isRegExp;
1068 return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classofRaw(it) == 'RegExp');
1069};
1070
1071var notARegexp = function (it) {
1072 if (isRegexp(it)) {
1073 throw TypeError("The method doesn't accept regular expressions");
1074 } return it;
1075};
1076
1077var MATCH$1 = wellKnownSymbol('match');
1078
1079var correctIsRegexpLogic = function (METHOD_NAME) {
1080 var regexp = /./;
1081 try {
1082 '/./'[METHOD_NAME](regexp);
1083 } catch (e) {
1084 try {
1085 regexp[MATCH$1] = false;
1086 return '/./'[METHOD_NAME](regexp);
1087 } catch (f) { /* empty */ }
1088 } return false;
1089};
1090
1091// `String.prototype.includes` method
1092// https://tc39.github.io/ecma262/#sec-string.prototype.includes
1093_export({ target: 'String', proto: true, forced: !correctIsRegexpLogic('includes') }, {
1094 includes: function includes(searchString /* , position = 0 */) {
1095 return !!~String(requireObjectCoercible(this))
1096 .indexOf(notARegexp(searchString), arguments.length > 1 ? arguments[1] : undefined);
1097 }
1098});
1099
1100// `RegExp.prototype.flags` getter implementation
1101// https://tc39.github.io/ecma262/#sec-get-regexp.prototype.flags
1102var regexpFlags = function () {
1103 var that = anObject(this);
1104 var result = '';
1105 if (that.global) result += 'g';
1106 if (that.ignoreCase) result += 'i';
1107 if (that.multiline) result += 'm';
1108 if (that.dotAll) result += 's';
1109 if (that.unicode) result += 'u';
1110 if (that.sticky) result += 'y';
1111 return result;
1112};
1113
1114var nativeExec = RegExp.prototype.exec;
1115// This always refers to the native implementation, because the
1116// String#replace polyfill uses ./fix-regexp-well-known-symbol-logic.js,
1117// which loads this file before patching the method.
1118var nativeReplace = String.prototype.replace;
1119
1120var patchedExec = nativeExec;
1121
1122var UPDATES_LAST_INDEX_WRONG = (function () {
1123 var re1 = /a/;
1124 var re2 = /b*/g;
1125 nativeExec.call(re1, 'a');
1126 nativeExec.call(re2, 'a');
1127 return re1.lastIndex !== 0 || re2.lastIndex !== 0;
1128})();
1129
1130// nonparticipating capturing group, copied from es5-shim's String#split patch.
1131var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
1132
1133var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED;
1134
1135if (PATCH) {
1136 patchedExec = function exec(str) {
1137 var re = this;
1138 var lastIndex, reCopy, match, i;
1139
1140 if (NPCG_INCLUDED) {
1141 reCopy = new RegExp('^' + re.source + '$(?!\\s)', regexpFlags.call(re));
1142 }
1143 if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;
1144
1145 match = nativeExec.call(re, str);
1146
1147 if (UPDATES_LAST_INDEX_WRONG && match) {
1148 re.lastIndex = re.global ? match.index + match[0].length : lastIndex;
1149 }
1150 if (NPCG_INCLUDED && match && match.length > 1) {
1151 // Fix browsers whose `exec` methods don't consistently return `undefined`
1152 // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/
1153 nativeReplace.call(match[0], reCopy, function () {
1154 for (i = 1; i < arguments.length - 2; i++) {
1155 if (arguments[i] === undefined) match[i] = undefined;
1156 }
1157 });
1158 }
1159
1160 return match;
1161 };
1162}
1163
1164var regexpExec = patchedExec;
1165
1166var SPECIES$3 = wellKnownSymbol('species');
1167
1168var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () {
1169 // #replace needs built-in support for named groups.
1170 // #match works fine because it just return the exec results, even if it has
1171 // a "grops" property.
1172 var re = /./;
1173 re.exec = function () {
1174 var result = [];
1175 result.groups = { a: '7' };
1176 return result;
1177 };
1178 return ''.replace(re, '$<a>') !== '7';
1179});
1180
1181// Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec
1182// Weex JS has frozen built-in prototypes, so use try / catch wrapper
1183var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () {
1184 var re = /(?:)/;
1185 var originalExec = re.exec;
1186 re.exec = function () { return originalExec.apply(this, arguments); };
1187 var result = 'ab'.split(re);
1188 return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b';
1189});
1190
1191var fixRegexpWellKnownSymbolLogic = function (KEY, length, exec, sham) {
1192 var SYMBOL = wellKnownSymbol(KEY);
1193
1194 var DELEGATES_TO_SYMBOL = !fails(function () {
1195 // String methods call symbol-named RegEp methods
1196 var O = {};
1197 O[SYMBOL] = function () { return 7; };
1198 return ''[KEY](O) != 7;
1199 });
1200
1201 var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails(function () {
1202 // Symbol-named RegExp methods call .exec
1203 var execCalled = false;
1204 var re = /a/;
1205 re.exec = function () { execCalled = true; return null; };
1206
1207 if (KEY === 'split') {
1208 // RegExp[@@split] doesn't call the regex's exec method, but first creates
1209 // a new one. We need to return the patched regex when creating the new one.
1210 re.constructor = {};
1211 re.constructor[SPECIES$3] = function () { return re; };
1212 }
1213
1214 re[SYMBOL]('');
1215 return !execCalled;
1216 });
1217
1218 if (
1219 !DELEGATES_TO_SYMBOL ||
1220 !DELEGATES_TO_EXEC ||
1221 (KEY === 'replace' && !REPLACE_SUPPORTS_NAMED_GROUPS) ||
1222 (KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC)
1223 ) {
1224 var nativeRegExpMethod = /./[SYMBOL];
1225 var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {
1226 if (regexp.exec === regexpExec) {
1227 if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
1228 // The native String method already delegates to @@method (this
1229 // polyfilled function), leasing to infinite recursion.
1230 // We avoid it by directly calling the native @@method method.
1231 return { done: true, value: nativeRegExpMethod.call(regexp, str, arg2) };
1232 }
1233 return { done: true, value: nativeMethod.call(str, regexp, arg2) };
1234 }
1235 return { done: false };
1236 });
1237 var stringMethod = methods[0];
1238 var regexMethod = methods[1];
1239
1240 redefine(String.prototype, KEY, stringMethod);
1241 redefine(RegExp.prototype, SYMBOL, length == 2
1242 // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue)
1243 // 21.2.5.11 RegExp.prototype[@@split](string, limit)
1244 ? function (string, arg) { return regexMethod.call(string, this, arg); }
1245 // 21.2.5.6 RegExp.prototype[@@match](string)
1246 // 21.2.5.9 RegExp.prototype[@@search](string)
1247 : function (string) { return regexMethod.call(string, this); }
1248 );
1249 if (sham) hide(RegExp.prototype[SYMBOL], 'sham', true);
1250 }
1251};
1252
1253var SPECIES$4 = wellKnownSymbol('species');
1254
1255// `SpeciesConstructor` abstract operation
1256// https://tc39.github.io/ecma262/#sec-speciesconstructor
1257var speciesConstructor = function (O, defaultConstructor) {
1258 var C = anObject(O).constructor;
1259 var S;
1260 return C === undefined || (S = anObject(C)[SPECIES$4]) == undefined ? defaultConstructor : aFunction$1(S);
1261};
1262
1263// `String.prototype.{ codePointAt, at }` methods implementation
1264var createMethod$2 = function (CONVERT_TO_STRING) {
1265 return function ($this, pos) {
1266 var S = String(requireObjectCoercible($this));
1267 var position = toInteger(pos);
1268 var size = S.length;
1269 var first, second;
1270 if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
1271 first = S.charCodeAt(position);
1272 return first < 0xD800 || first > 0xDBFF || position + 1 === size
1273 || (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF
1274 ? CONVERT_TO_STRING ? S.charAt(position) : first
1275 : CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
1276 };
1277};
1278
1279var stringMultibyte = {
1280 // `String.prototype.codePointAt` method
1281 // https://tc39.github.io/ecma262/#sec-string.prototype.codepointat
1282 codeAt: createMethod$2(false),
1283 // `String.prototype.at` method
1284 // https://github.com/mathiasbynens/String.prototype.at
1285 charAt: createMethod$2(true)
1286};
1287
1288var charAt = stringMultibyte.charAt;
1289
1290// `AdvanceStringIndex` abstract operation
1291// https://tc39.github.io/ecma262/#sec-advancestringindex
1292var advanceStringIndex = function (S, index, unicode) {
1293 return index + (unicode ? charAt(S, index).length : 1);
1294};
1295
1296// `RegExpExec` abstract operation
1297// https://tc39.github.io/ecma262/#sec-regexpexec
1298var regexpExecAbstract = function (R, S) {
1299 var exec = R.exec;
1300 if (typeof exec === 'function') {
1301 var result = exec.call(R, S);
1302 if (typeof result !== 'object') {
1303 throw TypeError('RegExp exec method returned something other than an Object or null');
1304 }
1305 return result;
1306 }
1307
1308 if (classofRaw(R) !== 'RegExp') {
1309 throw TypeError('RegExp#exec called on incompatible receiver');
1310 }
1311
1312 return regexpExec.call(R, S);
1313};
1314
1315var arrayPush = [].push;
1316var min$2 = Math.min;
1317var MAX_UINT32 = 0xFFFFFFFF;
1318
1319// babel-minify transpiles RegExp('x', 'y') -> /x/y and it causes SyntaxError
1320var SUPPORTS_Y = !fails(function () { return !RegExp(MAX_UINT32, 'y'); });
1321
1322// @@split logic
1323fixRegexpWellKnownSymbolLogic('split', 2, function (SPLIT, nativeSplit, maybeCallNative) {
1324 var internalSplit;
1325 if (
1326 'abbc'.split(/(b)*/)[1] == 'c' ||
1327 'test'.split(/(?:)/, -1).length != 4 ||
1328 'ab'.split(/(?:ab)*/).length != 2 ||
1329 '.'.split(/(.?)(.?)/).length != 4 ||
1330 '.'.split(/()()/).length > 1 ||
1331 ''.split(/.?/).length
1332 ) {
1333 // based on es5-shim implementation, need to rework it
1334 internalSplit = function (separator, limit) {
1335 var string = String(requireObjectCoercible(this));
1336 var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
1337 if (lim === 0) return [];
1338 if (separator === undefined) return [string];
1339 // If `separator` is not a regex, use native split
1340 if (!isRegexp(separator)) {
1341 return nativeSplit.call(string, separator, lim);
1342 }
1343 var output = [];
1344 var flags = (separator.ignoreCase ? 'i' : '') +
1345 (separator.multiline ? 'm' : '') +
1346 (separator.unicode ? 'u' : '') +
1347 (separator.sticky ? 'y' : '');
1348 var lastLastIndex = 0;
1349 // Make `global` and avoid `lastIndex` issues by working with a copy
1350 var separatorCopy = new RegExp(separator.source, flags + 'g');
1351 var match, lastIndex, lastLength;
1352 while (match = regexpExec.call(separatorCopy, string)) {
1353 lastIndex = separatorCopy.lastIndex;
1354 if (lastIndex > lastLastIndex) {
1355 output.push(string.slice(lastLastIndex, match.index));
1356 if (match.length > 1 && match.index < string.length) arrayPush.apply(output, match.slice(1));
1357 lastLength = match[0].length;
1358 lastLastIndex = lastIndex;
1359 if (output.length >= lim) break;
1360 }
1361 if (separatorCopy.lastIndex === match.index) separatorCopy.lastIndex++; // Avoid an infinite loop
1362 }
1363 if (lastLastIndex === string.length) {
1364 if (lastLength || !separatorCopy.test('')) output.push('');
1365 } else output.push(string.slice(lastLastIndex));
1366 return output.length > lim ? output.slice(0, lim) : output;
1367 };
1368 // Chakra, V8
1369 } else if ('0'.split(undefined, 0).length) {
1370 internalSplit = function (separator, limit) {
1371 return separator === undefined && limit === 0 ? [] : nativeSplit.call(this, separator, limit);
1372 };
1373 } else internalSplit = nativeSplit;
1374
1375 return [
1376 // `String.prototype.split` method
1377 // https://tc39.github.io/ecma262/#sec-string.prototype.split
1378 function split(separator, limit) {
1379 var O = requireObjectCoercible(this);
1380 var splitter = separator == undefined ? undefined : separator[SPLIT];
1381 return splitter !== undefined
1382 ? splitter.call(separator, O, limit)
1383 : internalSplit.call(String(O), separator, limit);
1384 },
1385 // `RegExp.prototype[@@split]` method
1386 // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@split
1387 //
1388 // NOTE: This cannot be properly polyfilled in engines that don't support
1389 // the 'y' flag.
1390 function (regexp, limit) {
1391 var res = maybeCallNative(internalSplit, regexp, this, limit, internalSplit !== nativeSplit);
1392 if (res.done) return res.value;
1393
1394 var rx = anObject(regexp);
1395 var S = String(this);
1396 var C = speciesConstructor(rx, RegExp);
1397
1398 var unicodeMatching = rx.unicode;
1399 var flags = (rx.ignoreCase ? 'i' : '') +
1400 (rx.multiline ? 'm' : '') +
1401 (rx.unicode ? 'u' : '') +
1402 (SUPPORTS_Y ? 'y' : 'g');
1403
1404 // ^(? + rx + ) is needed, in combination with some S slicing, to
1405 // simulate the 'y' flag.
1406 var splitter = new C(SUPPORTS_Y ? rx : '^(?:' + rx.source + ')', flags);
1407 var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
1408 if (lim === 0) return [];
1409 if (S.length === 0) return regexpExecAbstract(splitter, S) === null ? [S] : [];
1410 var p = 0;
1411 var q = 0;
1412 var A = [];
1413 while (q < S.length) {
1414 splitter.lastIndex = SUPPORTS_Y ? q : 0;
1415 var z = regexpExecAbstract(splitter, SUPPORTS_Y ? S : S.slice(q));
1416 var e;
1417 if (
1418 z === null ||
1419 (e = min$2(toLength(splitter.lastIndex + (SUPPORTS_Y ? 0 : q)), S.length)) === p
1420 ) {
1421 q = advanceStringIndex(S, q, unicodeMatching);
1422 } else {
1423 A.push(S.slice(p, q));
1424 if (A.length === lim) return A;
1425 for (var i = 1; i <= z.length - 1; i++) {
1426 A.push(z[i]);
1427 if (A.length === lim) return A;
1428 }
1429 q = p = e;
1430 }
1431 }
1432 A.push(S.slice(p));
1433 return A;
1434 }
1435 ];
1436}, !SUPPORTS_Y);
1437
1438// a string of all valid unicode whitespaces
1439// eslint-disable-next-line max-len
1440var 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';
1441
1442var whitespace = '[' + whitespaces + ']';
1443var ltrim = RegExp('^' + whitespace + whitespace + '*');
1444var rtrim = RegExp(whitespace + whitespace + '*$');
1445
1446// `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
1447var createMethod$3 = function (TYPE) {
1448 return function ($this) {
1449 var string = String(requireObjectCoercible($this));
1450 if (TYPE & 1) string = string.replace(ltrim, '');
1451 if (TYPE & 2) string = string.replace(rtrim, '');
1452 return string;
1453 };
1454};
1455
1456var stringTrim = {
1457 // `String.prototype.{ trimLeft, trimStart }` methods
1458 // https://tc39.github.io/ecma262/#sec-string.prototype.trimstart
1459 start: createMethod$3(1),
1460 // `String.prototype.{ trimRight, trimEnd }` methods
1461 // https://tc39.github.io/ecma262/#sec-string.prototype.trimend
1462 end: createMethod$3(2),
1463 // `String.prototype.trim` method
1464 // https://tc39.github.io/ecma262/#sec-string.prototype.trim
1465 trim: createMethod$3(3)
1466};
1467
1468var non = '\u200B\u0085\u180E';
1469
1470// check that a method works with the correct list
1471// of whitespaces and has a correct name
1472var forcedStringTrimMethod = function (METHOD_NAME) {
1473 return fails(function () {
1474 return !!whitespaces[METHOD_NAME]() || non[METHOD_NAME]() != non || whitespaces[METHOD_NAME].name !== METHOD_NAME;
1475 });
1476};
1477
1478var $trim = stringTrim.trim;
1479
1480
1481// `String.prototype.trim` method
1482// https://tc39.github.io/ecma262/#sec-string.prototype.trim
1483_export({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, {
1484 trim: function trim() {
1485 return $trim(this);
1486 }
1487});
1488
1489// iterable DOM collections
1490// flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
1491var domIterables = {
1492 CSSRuleList: 0,
1493 CSSStyleDeclaration: 0,
1494 CSSValueList: 0,
1495 ClientRectList: 0,
1496 DOMRectList: 0,
1497 DOMStringList: 0,
1498 DOMTokenList: 1,
1499 DataTransferItemList: 0,
1500 FileList: 0,
1501 HTMLAllCollection: 0,
1502 HTMLCollection: 0,
1503 HTMLFormElement: 0,
1504 HTMLSelectElement: 0,
1505 MediaList: 0,
1506 MimeTypeArray: 0,
1507 NamedNodeMap: 0,
1508 NodeList: 1,
1509 PaintRequestList: 0,
1510 Plugin: 0,
1511 PluginArray: 0,
1512 SVGLengthList: 0,
1513 SVGNumberList: 0,
1514 SVGPathSegList: 0,
1515 SVGPointList: 0,
1516 SVGStringList: 0,
1517 SVGTransformList: 0,
1518 SourceBufferList: 0,
1519 StyleSheetList: 0,
1520 TextTrackCueList: 0,
1521 TextTrackList: 0,
1522 TouchList: 0
1523};
1524
1525var $forEach = arrayIteration.forEach;
1526
1527
1528// `Array.prototype.forEach` method implementation
1529// https://tc39.github.io/ecma262/#sec-array.prototype.foreach
1530var arrayForEach = sloppyArrayMethod('forEach') ? function forEach(callbackfn /* , thisArg */) {
1531 return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
1532} : [].forEach;
1533
1534for (var COLLECTION_NAME in domIterables) {
1535 var Collection = global_1[COLLECTION_NAME];
1536 var CollectionPrototype = Collection && Collection.prototype;
1537 // some Chrome versions have non-configurable methods on DOMTokenList
1538 if (CollectionPrototype && CollectionPrototype.forEach !== arrayForEach) try {
1539 hide(CollectionPrototype, 'forEach', arrayForEach);
1540 } catch (error) {
1541 CollectionPrototype.forEach = arrayForEach;
1542 }
1543}
1544
1545var FAILS_ON_PRIMITIVES = fails(function () { objectKeys(1); });
1546
1547// `Object.keys` method
1548// https://tc39.github.io/ecma262/#sec-object.keys
1549_export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
1550 keys: function keys(it) {
1551 return objectKeys(toObject(it));
1552 }
1553});
1554
1555var max$2 = Math.max;
1556var min$3 = Math.min;
1557var floor$1 = Math.floor;
1558var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d\d?|<[^>]*>)/g;
1559var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d\d?)/g;
1560
1561var maybeToString = function (it) {
1562 return it === undefined ? it : String(it);
1563};
1564
1565// @@replace logic
1566fixRegexpWellKnownSymbolLogic('replace', 2, function (REPLACE, nativeReplace, maybeCallNative) {
1567 return [
1568 // `String.prototype.replace` method
1569 // https://tc39.github.io/ecma262/#sec-string.prototype.replace
1570 function replace(searchValue, replaceValue) {
1571 var O = requireObjectCoercible(this);
1572 var replacer = searchValue == undefined ? undefined : searchValue[REPLACE];
1573 return replacer !== undefined
1574 ? replacer.call(searchValue, O, replaceValue)
1575 : nativeReplace.call(String(O), searchValue, replaceValue);
1576 },
1577 // `RegExp.prototype[@@replace]` method
1578 // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@replace
1579 function (regexp, replaceValue) {
1580 var res = maybeCallNative(nativeReplace, regexp, this, replaceValue);
1581 if (res.done) return res.value;
1582
1583 var rx = anObject(regexp);
1584 var S = String(this);
1585
1586 var functionalReplace = typeof replaceValue === 'function';
1587 if (!functionalReplace) replaceValue = String(replaceValue);
1588
1589 var global = rx.global;
1590 if (global) {
1591 var fullUnicode = rx.unicode;
1592 rx.lastIndex = 0;
1593 }
1594 var results = [];
1595 while (true) {
1596 var result = regexpExecAbstract(rx, S);
1597 if (result === null) break;
1598
1599 results.push(result);
1600 if (!global) break;
1601
1602 var matchStr = String(result[0]);
1603 if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
1604 }
1605
1606 var accumulatedResult = '';
1607 var nextSourcePosition = 0;
1608 for (var i = 0; i < results.length; i++) {
1609 result = results[i];
1610
1611 var matched = String(result[0]);
1612 var position = max$2(min$3(toInteger(result.index), S.length), 0);
1613 var captures = [];
1614 // NOTE: This is equivalent to
1615 // captures = result.slice(1).map(maybeToString)
1616 // but for some reason `nativeSlice.call(result, 1, result.length)` (called in
1617 // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and
1618 // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.
1619 for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j]));
1620 var namedCaptures = result.groups;
1621 if (functionalReplace) {
1622 var replacerArgs = [matched].concat(captures, position, S);
1623 if (namedCaptures !== undefined) replacerArgs.push(namedCaptures);
1624 var replacement = String(replaceValue.apply(undefined, replacerArgs));
1625 } else {
1626 replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
1627 }
1628 if (position >= nextSourcePosition) {
1629 accumulatedResult += S.slice(nextSourcePosition, position) + replacement;
1630 nextSourcePosition = position + matched.length;
1631 }
1632 }
1633 return accumulatedResult + S.slice(nextSourcePosition);
1634 }
1635 ];
1636
1637 // https://tc39.github.io/ecma262/#sec-getsubstitution
1638 function getSubstitution(matched, str, position, captures, namedCaptures, replacement) {
1639 var tailPos = position + matched.length;
1640 var m = captures.length;
1641 var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
1642 if (namedCaptures !== undefined) {
1643 namedCaptures = toObject(namedCaptures);
1644 symbols = SUBSTITUTION_SYMBOLS;
1645 }
1646 return nativeReplace.call(replacement, symbols, function (match, ch) {
1647 var capture;
1648 switch (ch.charAt(0)) {
1649 case '$': return '$';
1650 case '&': return matched;
1651 case '`': return str.slice(0, position);
1652 case "'": return str.slice(tailPos);
1653 case '<':
1654 capture = namedCaptures[ch.slice(1, -1)];
1655 break;
1656 default: // \d\d?
1657 var n = +ch;
1658 if (n === 0) return match;
1659 if (n > m) {
1660 var f = floor$1(n / 10);
1661 if (f === 0) return match;
1662 if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1);
1663 return match;
1664 }
1665 capture = captures[n - 1];
1666 }
1667 return capture === undefined ? '' : capture;
1668 });
1669 }
1670});
1671
1672// sprintf format specifiers
1673var s = 's';
1674
1675var sprintf = function sprintf(strings) {
1676 for (var _len = arguments.length, formats = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1677 formats[_key - 1] = arguments[_key];
1678 }
1679
1680 return function () {
1681 for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
1682 args[_key2] = arguments[_key2];
1683 }
1684
1685 var retStr = '';
1686 return strings.slice(0, -1).some(function (str, i) {
1687 switch (formats[i]) {
1688 default:
1689 throw new TypeError('Unrecognized sprintf format');
1690
1691 case 's':
1692 {
1693 var arg = args[i];
1694
1695 if (arg === null || arg === undefined) {
1696 return true;
1697 }
1698
1699 retStr += str + arg;
1700 return false;
1701 }
1702 }
1703 }) ? '' : retStr + strings.slice(-1);
1704 };
1705};
1706
1707var compareObjects = function compareObjects(objectA, objectB, compareLength) {
1708 var aKeys = Object.keys(objectA);
1709 var bKeys = Object.keys(objectB);
1710
1711 if (compareLength && aKeys.length !== bKeys.length) {
1712 return false;
1713 }
1714
1715 for (var _i = 0, _aKeys = aKeys; _i < _aKeys.length; _i++) {
1716 var key = _aKeys[_i];
1717
1718 if (bKeys.includes(key) && objectA[key] !== objectB[key]) {
1719 return false;
1720 }
1721 }
1722
1723 return true;
1724};
1725
1726var removeDiacritics = function removeDiacritics(str) {
1727 if (str.normalize) {
1728 return str.normalize('NFD').replace(/[\u0300-\u036F]/g, '');
1729 }
1730
1731 var defaultDiacriticsRemovalMap = [{
1732 'base': 'A',
1733 '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
1734 }, {
1735 'base': 'AA',
1736 'letters': /[\uA732]/g
1737 }, {
1738 'base': 'AE',
1739 'letters': /[\u00C6\u01FC\u01E2]/g
1740 }, {
1741 'base': 'AO',
1742 'letters': /[\uA734]/g
1743 }, {
1744 'base': 'AU',
1745 'letters': /[\uA736]/g
1746 }, {
1747 'base': 'AV',
1748 'letters': /[\uA738\uA73A]/g
1749 }, {
1750 'base': 'AY',
1751 'letters': /[\uA73C]/g
1752 }, {
1753 'base': 'B',
1754 'letters': /[\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181]/g
1755 }, {
1756 'base': 'C',
1757 'letters': /[\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E]/g
1758 }, {
1759 'base': 'D',
1760 'letters': /[\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779]/g
1761 }, {
1762 'base': 'DZ',
1763 'letters': /[\u01F1\u01C4]/g
1764 }, {
1765 'base': 'Dz',
1766 'letters': /[\u01F2\u01C5]/g
1767 }, {
1768 'base': 'E',
1769 '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
1770 }, {
1771 'base': 'F',
1772 'letters': /[\u0046\u24BB\uFF26\u1E1E\u0191\uA77B]/g
1773 }, {
1774 'base': 'G',
1775 'letters': /[\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E]/g
1776 }, {
1777 'base': 'H',
1778 'letters': /[\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D]/g
1779 }, {
1780 'base': 'I',
1781 'letters': /[\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197]/g
1782 }, {
1783 'base': 'J',
1784 'letters': /[\u004A\u24BF\uFF2A\u0134\u0248]/g
1785 }, {
1786 'base': 'K',
1787 'letters': /[\u004B\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2]/g
1788 }, {
1789 'base': 'L',
1790 'letters': /[\u004C\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780]/g
1791 }, {
1792 'base': 'LJ',
1793 'letters': /[\u01C7]/g
1794 }, {
1795 'base': 'Lj',
1796 'letters': /[\u01C8]/g
1797 }, {
1798 'base': 'M',
1799 'letters': /[\u004D\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C]/g
1800 }, {
1801 'base': 'N',
1802 'letters': /[\u004E\u24C3\uFF2E\u01F8\u0143\u00D1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4]/g
1803 }, {
1804 'base': 'NJ',
1805 'letters': /[\u01CA]/g
1806 }, {
1807 'base': 'Nj',
1808 'letters': /[\u01CB]/g
1809 }, {
1810 'base': 'O',
1811 '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
1812 }, {
1813 'base': 'OI',
1814 'letters': /[\u01A2]/g
1815 }, {
1816 'base': 'OO',
1817 'letters': /[\uA74E]/g
1818 }, {
1819 'base': 'OU',
1820 'letters': /[\u0222]/g
1821 }, {
1822 'base': 'P',
1823 'letters': /[\u0050\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754]/g
1824 }, {
1825 'base': 'Q',
1826 'letters': /[\u0051\u24C6\uFF31\uA756\uA758\u024A]/g
1827 }, {
1828 'base': 'R',
1829 'letters': /[\u0052\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782]/g
1830 }, {
1831 'base': 'S',
1832 'letters': /[\u0053\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784]/g
1833 }, {
1834 'base': 'T',
1835 'letters': /[\u0054\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786]/g
1836 }, {
1837 'base': 'TZ',
1838 'letters': /[\uA728]/g
1839 }, {
1840 'base': 'U',
1841 '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
1842 }, {
1843 'base': 'V',
1844 'letters': /[\u0056\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245]/g
1845 }, {
1846 'base': 'VY',
1847 'letters': /[\uA760]/g
1848 }, {
1849 'base': 'W',
1850 'letters': /[\u0057\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72]/g
1851 }, {
1852 'base': 'X',
1853 'letters': /[\u0058\u24CD\uFF38\u1E8A\u1E8C]/g
1854 }, {
1855 'base': 'Y',
1856 'letters': /[\u0059\u24CE\uFF39\u1EF2\u00DD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE]/g
1857 }, {
1858 'base': 'Z',
1859 'letters': /[\u005A\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762]/g
1860 }, {
1861 'base': 'a',
1862 '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
1863 }, {
1864 'base': 'aa',
1865 'letters': /[\uA733]/g
1866 }, {
1867 'base': 'ae',
1868 'letters': /[\u00E6\u01FD\u01E3]/g
1869 }, {
1870 'base': 'ao',
1871 'letters': /[\uA735]/g
1872 }, {
1873 'base': 'au',
1874 'letters': /[\uA737]/g
1875 }, {
1876 'base': 'av',
1877 'letters': /[\uA739\uA73B]/g
1878 }, {
1879 'base': 'ay',
1880 'letters': /[\uA73D]/g
1881 }, {
1882 'base': 'b',
1883 'letters': /[\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253]/g
1884 }, {
1885 'base': 'c',
1886 'letters': /[\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184]/g
1887 }, {
1888 'base': 'd',
1889 'letters': /[\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A]/g
1890 }, {
1891 'base': 'dz',
1892 'letters': /[\u01F3\u01C6]/g
1893 }, {
1894 'base': 'e',
1895 '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
1896 }, {
1897 'base': 'f',
1898 'letters': /[\u0066\u24D5\uFF46\u1E1F\u0192\uA77C]/g
1899 }, {
1900 'base': 'g',
1901 'letters': /[\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F]/g
1902 }, {
1903 'base': 'h',
1904 'letters': /[\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265]/g
1905 }, {
1906 'base': 'hv',
1907 'letters': /[\u0195]/g
1908 }, {
1909 'base': 'i',
1910 'letters': /[\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131]/g
1911 }, {
1912 'base': 'j',
1913 'letters': /[\u006A\u24D9\uFF4A\u0135\u01F0\u0249]/g
1914 }, {
1915 'base': 'k',
1916 'letters': /[\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3]/g
1917 }, {
1918 'base': 'l',
1919 'letters': /[\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747]/g
1920 }, {
1921 'base': 'lj',
1922 'letters': /[\u01C9]/g
1923 }, {
1924 'base': 'm',
1925 'letters': /[\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F]/g
1926 }, {
1927 'base': 'n',
1928 'letters': /[\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5]/g
1929 }, {
1930 'base': 'nj',
1931 'letters': /[\u01CC]/g
1932 }, {
1933 'base': 'o',
1934 '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
1935 }, {
1936 'base': 'oi',
1937 'letters': /[\u01A3]/g
1938 }, {
1939 'base': 'ou',
1940 'letters': /[\u0223]/g
1941 }, {
1942 'base': 'oo',
1943 'letters': /[\uA74F]/g
1944 }, {
1945 'base': 'p',
1946 'letters': /[\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755]/g
1947 }, {
1948 'base': 'q',
1949 'letters': /[\u0071\u24E0\uFF51\u024B\uA757\uA759]/g
1950 }, {
1951 'base': 'r',
1952 'letters': /[\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783]/g
1953 }, {
1954 'base': 's',
1955 'letters': /[\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B]/g
1956 }, {
1957 'base': 't',
1958 'letters': /[\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787]/g
1959 }, {
1960 'base': 'tz',
1961 'letters': /[\uA729]/g
1962 }, {
1963 'base': 'u',
1964 '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
1965 }, {
1966 'base': 'v',
1967 'letters': /[\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C]/g
1968 }, {
1969 'base': 'vy',
1970 'letters': /[\uA761]/g
1971 }, {
1972 'base': 'w',
1973 'letters': /[\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73]/g
1974 }, {
1975 'base': 'x',
1976 'letters': /[\u0078\u24E7\uFF58\u1E8B\u1E8D]/g
1977 }, {
1978 'base': 'y',
1979 'letters': /[\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF]/g
1980 }, {
1981 'base': 'z',
1982 'letters': /[\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763]/g
1983 }];
1984 return defaultDiacriticsRemovalMap.reduce(function (string, _ref) {
1985 var letters = _ref.letters,
1986 base = _ref.base;
1987 return string.replace(letters, base);
1988 }, str);
1989};
1990
1991function _templateObject23() {
1992 var data = _taggedTemplateLiteral(["[data-group=\"", "\"]"]);
1993
1994 _templateObject23 = function _templateObject23() {
1995 return data;
1996 };
1997
1998 return data;
1999}
2000
2001function _templateObject22() {
2002 var data = _taggedTemplateLiteral(["[value=\"", "\"]"]);
2003
2004 _templateObject22 = function _templateObject22() {
2005 return data;
2006 };
2007
2008 return data;
2009}
2010
2011function _templateObject21() {
2012 var data = _taggedTemplateLiteral(["[value=\"", "\"]"]);
2013
2014 _templateObject21 = function _templateObject21() {
2015 return data;
2016 };
2017
2018 return data;
2019}
2020
2021function _templateObject20() {
2022 var data = _taggedTemplateLiteral(["[", "][data-group=\"", "\"]"]);
2023
2024 _templateObject20 = function _templateObject20() {
2025 return data;
2026 };
2027
2028 return data;
2029}
2030
2031function _templateObject19() {
2032 var data = _taggedTemplateLiteral(["input[", "]:checked"]);
2033
2034 _templateObject19 = function _templateObject19() {
2035 return data;
2036 };
2037
2038 return data;
2039}
2040
2041function _templateObject18() {
2042 var data = _taggedTemplateLiteral(["[data-group=\"", "\"]"]);
2043
2044 _templateObject18 = function _templateObject18() {
2045 return data;
2046 };
2047
2048 return data;
2049}
2050
2051function _templateObject17() {
2052 var data = _taggedTemplateLiteral(["[data-group=\"", "\"]"]);
2053
2054 _templateObject17 = function _templateObject17() {
2055 return data;
2056 };
2057
2058 return data;
2059}
2060
2061function _templateObject16() {
2062 var data = _taggedTemplateLiteral(["<span>", "</span>"]);
2063
2064 _templateObject16 = function _templateObject16() {
2065 return data;
2066 };
2067
2068 return data;
2069}
2070
2071function _templateObject15() {
2072 var data = _taggedTemplateLiteral([" data-group=\"", "\""]);
2073
2074 _templateObject15 = function _templateObject15() {
2075 return data;
2076 };
2077
2078 return data;
2079}
2080
2081function _templateObject14() {
2082 var data = _taggedTemplateLiteral(["<input type=\"", "\" value=\"", "\" ", "", "", "", ">"]);
2083
2084 _templateObject14 = function _templateObject14() {
2085 return data;
2086 };
2087
2088 return data;
2089}
2090
2091function _templateObject13() {
2092 var data = _taggedTemplateLiteral(["<label class=\"", "\">"]);
2093
2094 _templateObject13 = function _templateObject13() {
2095 return data;
2096 };
2097
2098 return data;
2099}
2100
2101function _templateObject12() {
2102 var data = _taggedTemplateLiteral(["<li class=\"", " ", "\" ", " ", ">"]);
2103
2104 _templateObject12 = function _templateObject12() {
2105 return data;
2106 };
2107
2108 return data;
2109}
2110
2111function _templateObject11() {
2112 var data = _taggedTemplateLiteral(["style=\"", "\""]);
2113
2114 _templateObject11 = function _templateObject11() {
2115 return data;
2116 };
2117
2118 return data;
2119}
2120
2121function _templateObject10() {
2122 var data = _taggedTemplateLiteral(["<input type=\"checkbox\" ", " ", ">"]);
2123
2124 _templateObject10 = function _templateObject10() {
2125 return data;
2126 };
2127
2128 return data;
2129}
2130
2131function _templateObject9() {
2132 var data = _taggedTemplateLiteral(["<label class=\"optgroup ", "\" data-group=\"", "\">"]);
2133
2134 _templateObject9 = function _templateObject9() {
2135 return data;
2136 };
2137
2138 return data;
2139}
2140
2141function _templateObject8() {
2142 var data = _taggedTemplateLiteral(["title=\"", "\""]);
2143
2144 _templateObject8 = function _templateObject8() {
2145 return data;
2146 };
2147
2148 return data;
2149}
2150
2151function _templateObject7() {
2152 var data = _taggedTemplateLiteral(["<li class=\"ms-no-results\">", "</li>"]);
2153
2154 _templateObject7 = function _templateObject7() {
2155 return data;
2156 };
2157
2158 return data;
2159}
2160
2161function _templateObject6() {
2162 var data = _taggedTemplateLiteral(["<input type=\"checkbox\" ", " />"]);
2163
2164 _templateObject6 = function _templateObject6() {
2165 return data;
2166 };
2167
2168 return data;
2169}
2170
2171function _templateObject5() {
2172 var data = _taggedTemplateLiteral(["placeholder=\"", "\""]);
2173
2174 _templateObject5 = function _templateObject5() {
2175 return data;
2176 };
2177
2178 return data;
2179}
2180
2181function _templateObject4() {
2182 var data = _taggedTemplateLiteral(["<div class=\"ms-drop ", "\"></div>"]);
2183
2184 _templateObject4 = function _templateObject4() {
2185 return data;
2186 };
2187
2188 return data;
2189}
2190
2191function _templateObject3() {
2192 var data = _taggedTemplateLiteral(["\n <button type=\"button\" class=\"ms-choice\">\n <span class=\"placeholder\">", "</span>\n <div></div>\n </button>\n "]);
2193
2194 _templateObject3 = function _templateObject3() {
2195 return data;
2196 };
2197
2198 return data;
2199}
2200
2201function _templateObject2() {
2202 var data = _taggedTemplateLiteral(["title=\"", "\""]);
2203
2204 _templateObject2 = function _templateObject2() {
2205 return data;
2206 };
2207
2208 return data;
2209}
2210
2211function _templateObject() {
2212 var data = _taggedTemplateLiteral(["<div class=\"ms-parent ", "\" ", "/>"]);
2213
2214 _templateObject = function _templateObject() {
2215 return data;
2216 };
2217
2218 return data;
2219}
2220
2221var MultipleSelect =
2222/*#__PURE__*/
2223function () {
2224 function MultipleSelect($el, options) {
2225 _classCallCheck(this, MultipleSelect);
2226
2227 this.$el = $el;
2228 this.options = $.extend({}, Constants.DEFAULTS, options);
2229 }
2230
2231 _createClass(MultipleSelect, [{
2232 key: "init",
2233 value: function init() {
2234 this.initLocale();
2235 this.initContainer();
2236 this.initData();
2237 this.initDrop();
2238 }
2239 }, {
2240 key: "initLocale",
2241 value: function initLocale() {
2242 if (this.options.locale) {
2243 var locales = $.fn.multipleSelect.locales;
2244 var parts = this.options.locale.split(/-|_/);
2245 parts[0] = parts[0].toLowerCase();
2246
2247 if (parts[1]) {
2248 parts[1] = parts[1].toUpperCase();
2249 }
2250
2251 if (locales[this.options.locale]) {
2252 $.extend(this.options, locales[this.options.locale]);
2253 } else if (locales[parts.join('-')]) {
2254 $.extend(this.options, locales[parts.join('-')]);
2255 } else if (locales[parts[0]]) {
2256 $.extend(this.options, locales[parts[0]]);
2257 }
2258 }
2259 }
2260 }, {
2261 key: "initContainer",
2262 value: function initContainer() {
2263 var _this = this;
2264
2265 var el = this.$el[0];
2266 var name = el.getAttribute('name') || this.options.name || ''; // hide select element
2267
2268 this.$el = this.$el.hide(); // label element
2269
2270 this.$label = this.$el.closest('label');
2271
2272 if (!this.$label.length && this.$el.attr('id')) {
2273 this.$label = $("label[for=\"".concat(this.$el.attr('id'), "\"]"));
2274 } // restore class and title from select element
2275
2276
2277 this.$parent = $(sprintf(_templateObject(), s, s)(el.getAttribute('class') || '', sprintf(_templateObject2(), s)(el.getAttribute('title')))); // add placeholder to choice button
2278
2279 this.options.placeholder = this.options.placeholder || el.getAttribute('placeholder') || '';
2280 this.$choice = $(sprintf(_templateObject3(), s)(this.options.placeholder)); // default position is bottom
2281
2282 this.$drop = $(sprintf(_templateObject4(), s)(this.options.position));
2283
2284 if (this.options.dropWidth) {
2285 this.$drop.css('width', this.options.dropWidth);
2286 }
2287
2288 this.$el.after(this.$parent);
2289 this.$parent.append(this.$choice);
2290 this.$parent.append(this.$drop);
2291
2292 if (el.disabled) {
2293 this.$choice.addClass('disabled');
2294 }
2295
2296 this.$parent.css('width', this.options.width || this.$el.css('width') || this.$el.outerWidth() + 20);
2297 this.selectAllName = "data-name=\"selectAll".concat(name, "\"");
2298 this.selectGroupName = "data-name=\"selectGroup".concat(name, "\"");
2299 this.selectItemName = "data-name=\"selectItem".concat(name, "\"");
2300
2301 if (!this.options.keepOpen) {
2302 $(document).click(function (e) {
2303 if ($(e.target)[0] === _this.$choice[0] || $(e.target).parents('.ms-choice')[0] === _this.$choice[0]) {
2304 return;
2305 }
2306
2307 if (($(e.target)[0] === _this.$drop[0] || $(e.target).parents('.ms-drop')[0] !== _this.$drop[0] && e.target !== el) && _this.options.isOpen) {
2308 _this.close();
2309 }
2310 });
2311 }
2312
2313 this.options.onAfterCreate();
2314 }
2315 }, {
2316 key: "initData",
2317 value: function initData() {
2318 var _this2 = this;
2319
2320 var data = [];
2321
2322 if (this.options.data) {
2323 this.options.data.forEach(function (row, i) {
2324 if (row.type === 'optgroup') {
2325 row.group = row.group || "group_".concat(i);
2326 row.children.forEach(function (child) {
2327 child.group = child.group || row.group;
2328 });
2329 }
2330 });
2331 this.data = this.options.data;
2332 return;
2333 }
2334
2335 $.each(this.$el.children(), function (i, elm) {
2336 var row = _this2.initRow(i, elm);
2337
2338 if (row) {
2339 data.push(_this2.initRow(i, elm));
2340 }
2341 });
2342 this.options.data = data;
2343 this.data = data;
2344 }
2345 }, {
2346 key: "initRow",
2347 value: function initRow(i, elm, group, groupDisabled) {
2348 var _this3 = this;
2349
2350 var row = {};
2351 var $elm = $(elm);
2352
2353 if ($elm.is('option')) {
2354 row.type = 'option';
2355 row.group = group;
2356 row.text = this.options.textTemplate($elm);
2357 row.value = elm.value;
2358 row.selected = elm.selected;
2359 row.disabled = groupDisabled || elm.disabled;
2360 row.classes = elm.getAttribute('class') || '';
2361 row.title = elm.getAttribute('title');
2362 return row;
2363 }
2364
2365 if ($elm.is('optgroup')) {
2366 row.type = 'optgroup';
2367 row.group = "group_".concat(i);
2368 row.label = this.options.labelTemplate($elm);
2369 row.disabled = elm.disabled;
2370 row.children = [];
2371 $.each($elm.children(), function (j, elem) {
2372 row.children.push(_this3.initRow(j, elem, row.group, row.disabled));
2373 });
2374 return row;
2375 }
2376
2377 return null;
2378 }
2379 }, {
2380 key: "initDrop",
2381 value: function initDrop() {
2382 var _this4 = this;
2383
2384 this.initList();
2385 this.events();
2386 this.updateSelectAll();
2387 this.update(true);
2388 this.updateOptGroupSelect(true);
2389
2390 if (this.options.isOpen) {
2391 this.open();
2392 }
2393
2394 if (this.options.openOnHover) {
2395 this.$parent.hover(function () {
2396 _this4.open();
2397 }, function () {
2398 _this4.close();
2399 });
2400 }
2401 }
2402 }, {
2403 key: "initList",
2404 value: function initList() {
2405 var _this5 = this;
2406
2407 var html = [];
2408
2409 if (this.options.filter) {
2410 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 "));
2411 }
2412
2413 html.push('<ul>');
2414
2415 if (this.options.selectAll && !this.options.single) {
2416 html.push(['<li class="ms-select-all">', '<label>', sprintf(_templateObject6(), s)(this.selectAllName), "<span>".concat(this.options.formatSelectAll(), "</span>"), '</label>', '</li>'].join(''));
2417 }
2418
2419 html.push(this.data.map(function (row) {
2420 return _this5.initListItem(row);
2421 }).join(''));
2422 html.push(sprintf(_templateObject7(), s)(this.options.formatNoMatchesFound()));
2423 html.push('</ul>');
2424 this.$drop.html(html.join(''));
2425 this.$drop.find('ul').css('max-height', "".concat(this.options.maxHeight, "px"));
2426 this.$drop.find('.multiple').css('width', "".concat(this.options.multipleWidth, "px"));
2427 this.$searchInput = this.$drop.find('.ms-search input');
2428 this.$selectAll = this.$drop.find("input[".concat(this.selectAllName, "]"));
2429 this.$selectGroups = this.$drop.find("input[".concat(this.selectGroupName, "]"));
2430 this.$selectItems = this.$drop.find("input[".concat(this.selectItemName, "]:enabled"));
2431 this.$disableItems = this.$drop.find("input[".concat(this.selectItemName, "]:disabled"));
2432 this.$noResults = this.$drop.find('.ms-no-results');
2433 }
2434 }, {
2435 key: "initListItem",
2436 value: function initListItem(row) {
2437 var _this6 = this;
2438
2439 var title = sprintf(_templateObject8(), s)(row.title);
2440 var multiple = this.options.multiple ? 'multiple' : '';
2441 var type = this.options.single ? 'radio' : 'checkbox';
2442
2443 if (row.type === 'optgroup') {
2444 var html = [];
2445 html.push(['<li class="group">', sprintf(_templateObject9(), s, s)(row.disabled ? 'disabled' : '', row.group), this.options.hideOptgroupCheckboxes || this.options.single ? '' : sprintf(_templateObject10(), s, s)(this.selectGroupName, row.disabled ? 'disabled="disabled"' : ''), row.label, '</label>', '</li>'].join(''));
2446 html.push(row.children.map(function (child) {
2447 return _this6.initListItem(child);
2448 }).join(''));
2449 return html.join('');
2450 }
2451
2452 var customStyle = this.options.styler(row.value);
2453 var style = customStyle ? sprintf(_templateObject11(), s)(customStyle) : '';
2454 var classes = row.classes;
2455
2456 if (this.options.single && !this.options.singleRadio) {
2457 classes += ' hide-radio';
2458 }
2459
2460 return [sprintf(_templateObject12(), s, s, s, s)(multiple, classes || '', title, style), sprintf(_templateObject13(), s)(row.disabled ? 'disabled' : ''), sprintf(_templateObject14(), s, s, s, s, s, s)(type, row.value, this.selectItemName, row.selected ? ' checked="checked"' : '', row.disabled ? ' disabled="disabled"' : '', sprintf(_templateObject15(), s)(row.group)), sprintf(_templateObject16(), s)(row.text), '</label>', '</li>'].join('');
2461 }
2462 }, {
2463 key: "events",
2464 value: function events() {
2465 var _this7 = this;
2466
2467 var toggleOpen = function toggleOpen(e) {
2468 e.preventDefault();
2469
2470 _this7[_this7.options.isOpen ? 'close' : 'open']();
2471 };
2472
2473 if (this.$label.length) {
2474 this.$label.off('click').on('click', function (e) {
2475 if (e.target.nodeName.toLowerCase() !== 'label') {
2476 return;
2477 }
2478
2479 toggleOpen(e);
2480
2481 if (!_this7.options.filter || !_this7.options.isOpen) {
2482 _this7.focus();
2483 }
2484
2485 e.stopPropagation(); // Causes lost focus otherwise
2486 });
2487 }
2488
2489 this.$choice.off('click').on('click', toggleOpen).off('focus').on('focus', this.options.onFocus).off('blur').on('blur', this.options.onBlur);
2490 this.$parent.off('keydown').on('keydown', function (e) {
2491 // esc key
2492 if (e.which === 27) {
2493 _this7.close();
2494
2495 _this7.$choice.focus();
2496 }
2497 });
2498 this.$searchInput.off('keydown').on('keydown', function (e) {
2499 // Ensure shift-tab causes lost focus from filter as with clicking away
2500 if (e.keyCode === 9 && e.shiftKey) {
2501 _this7.close();
2502 }
2503 }).off('keyup').on('keyup', function (e) {
2504 // enter or space
2505 // Avoid selecting/deselecting if no choices made
2506 if (_this7.options.filterAcceptOnEnter && [13, 32].includes(e.which) && _this7.$searchInput.val()) {
2507 _this7.$selectAll.click();
2508
2509 _this7.close();
2510
2511 _this7.focus();
2512
2513 return;
2514 }
2515
2516 _this7.filter();
2517 });
2518 this.$selectAll.off('click').on('click', function (e) {
2519 var checked = $(e.currentTarget).prop('checked');
2520
2521 var $items = _this7.$selectItems.filter(':visible');
2522
2523 if ($items.length === _this7.$selectItems.length) {
2524 _this7[checked ? 'checkAll' : 'uncheckAll']();
2525 } else {
2526 // when the filter option is true
2527 _this7.$selectGroups.prop('checked', checked);
2528
2529 $items.prop('checked', checked);
2530
2531 _this7.options[checked ? 'onCheckAll' : 'onUncheckAll']();
2532
2533 _this7.update();
2534 }
2535 });
2536 this.$selectGroups.off('click').on('click', function (e) {
2537 var $this = $(e.currentTarget);
2538 var group = $this.parent()[0].getAttribute('data-group');
2539
2540 var $items = _this7.$selectItems.filter(':visible');
2541
2542 var $children = $items.filter(sprintf(_templateObject17(), s)(group));
2543 var checked = $children.length !== $children.filter(':checked').length;
2544 $children.prop('checked', checked);
2545
2546 _this7.updateSelectAll(true);
2547
2548 _this7.update();
2549
2550 _this7.options.onOptgroupClick({
2551 label: $this.parent().text(),
2552 checked: checked,
2553 children: $children.get().map(function (el) {
2554 return {
2555 label: $(el).parent().text(),
2556 value: $(el).val(),
2557 check: $(el).prop('checked')
2558 };
2559 })
2560 });
2561 });
2562 this.$selectItems.off('click').on('click', function (e) {
2563 var $this = $(e.currentTarget);
2564
2565 if (_this7.options.single) {
2566 var clickedVal = $this.val();
2567
2568 _this7.$selectItems.filter(function (i, el) {
2569 return $(el).val() !== clickedVal;
2570 }).each(function (i, el) {
2571 $(el).prop('checked', false);
2572 });
2573 }
2574
2575 _this7.updateSelectAll(true);
2576
2577 _this7.update();
2578
2579 _this7.updateOptGroupSelect();
2580
2581 _this7.options.onClick({
2582 label: $this.parent().text(),
2583 value: $this.val(),
2584 checked: $this.prop('checked')
2585 });
2586
2587 if (_this7.options.single && _this7.options.isOpen && !_this7.options.keepOpen) {
2588 _this7.close();
2589 }
2590 });
2591 }
2592 }, {
2593 key: "open",
2594 value: function open() {
2595 if (this.$choice.hasClass('disabled')) {
2596 return;
2597 }
2598
2599 this.options.isOpen = true;
2600 this.$choice.find('>div').addClass('open');
2601 this.$drop[this.animateMethod('show')](); // fix filter bug: no results show
2602
2603 this.$selectAll.parent().show();
2604 this.$noResults.hide(); // Fix #77: 'All selected' when no options
2605
2606 if (!this.data.length) {
2607 this.$selectAll.parent().hide();
2608 this.$noResults.show();
2609 }
2610
2611 if (this.options.container) {
2612 var offset = this.$drop.offset();
2613 this.$drop.appendTo($(this.options.container));
2614 this.$drop.offset({
2615 top: offset.top,
2616 left: offset.left
2617 });
2618 this.$drop.outerWidth(this.$parent.outerWidth());
2619 }
2620
2621 if (this.data.length && this.options.filter) {
2622 this.$searchInput.val('');
2623 this.$searchInput.focus();
2624 this.filter();
2625 }
2626
2627 this.options.onOpen();
2628 }
2629 }, {
2630 key: "close",
2631 value: function close() {
2632 this.options.isOpen = false;
2633 this.$choice.find('>div').removeClass('open');
2634 this.$drop[this.animateMethod('hide')]();
2635
2636 if (this.options.container) {
2637 this.$parent.append(this.$drop);
2638 this.$drop.css({
2639 'top': 'auto',
2640 'left': 'auto'
2641 });
2642 }
2643
2644 this.options.onClose();
2645 }
2646 }, {
2647 key: "animateMethod",
2648 value: function animateMethod(method) {
2649 var methods = {
2650 show: {
2651 fade: 'fadeIn',
2652 slide: 'slideDown'
2653 },
2654 hide: {
2655 fade: 'fadeOut',
2656 slide: 'slideUp'
2657 }
2658 };
2659 return methods[method][this.options.animate] || method;
2660 }
2661 }, {
2662 key: "update",
2663 value: function update(ignoreTrigger) {
2664 var valueSelects = this.getSelects();
2665 var textSelects = this.options.displayValues ? valueSelects : this.getSelects('text');
2666 var $span = this.$choice.find('>span');
2667 var sl = valueSelects.length;
2668 var html = '';
2669
2670 if (sl === 0) {
2671 $span.addClass('placeholder').html(this.options.placeholder);
2672 } else if (sl < this.options.minimumCountSelected) {
2673 html = textSelects.join(this.options.displayDelimiter);
2674 } else if (this.options.formatAllSelected() && sl === this.$selectItems.length + this.$disableItems.length) {
2675 html = this.options.formatAllSelected();
2676 } else if (this.options.ellipsis && sl > this.options.minimumCountSelected) {
2677 html = "".concat(textSelects.slice(0, this.options.minimumCountSelected).join(this.options.displayDelimiter), "...");
2678 } else if (this.options.formatCountSelected() && sl > this.options.minimumCountSelected) {
2679 html = this.options.formatCountSelected(sl, this.$selectItems.length + this.$disableItems.length);
2680 } else {
2681 html = textSelects.join(this.options.displayDelimiter);
2682 }
2683
2684 if (html) {
2685 $span.removeClass('placeholder').html(html);
2686 }
2687
2688 if (this.options.displayTitle) {
2689 $span.prop('title', this.getSelects('text'));
2690 } // set selects to select
2691
2692
2693 this.$el.val(this.getSelects()); // add selected class to selected li
2694
2695 this.$drop.find('li').removeClass('selected');
2696 this.$drop.find('input:checked').each(function (i, el) {
2697 $(el).parents('li').first().addClass('selected');
2698 }); // trigger <select> change event
2699
2700 if (!ignoreTrigger) {
2701 this.$el.trigger('change');
2702 }
2703 }
2704 }, {
2705 key: "updateSelectAll",
2706 value: function updateSelectAll(triggerEvent) {
2707 var $items = this.$selectItems.filter(':visible');
2708
2709 if (!$items.length) {
2710 return;
2711 }
2712
2713 var selectedLength = $items.filter(':checked').length;
2714 this.$selectAll.prop('checked', selectedLength === $items.length);
2715
2716 if (triggerEvent) {
2717 if (selectedLength === $items.length) {
2718 this.options.onCheckAll();
2719 } else if (selectedLength === 0) {
2720 this.options.onUncheckAll();
2721 }
2722 }
2723 }
2724 }, {
2725 key: "updateOptGroupSelect",
2726 value: function updateOptGroupSelect(isInit) {
2727 var $items = this.$selectItems;
2728
2729 if (!isInit) {
2730 $items = $items.filter(':visible');
2731 }
2732
2733 $.each(this.$selectGroups, function (i, val) {
2734 var group = $(val).parent()[0].getAttribute('data-group');
2735 var $children = $items.filter(sprintf(_templateObject18(), s)(group));
2736 $(val).prop('checked', $children.length && $children.length === $children.filter(':checked').length);
2737 });
2738 }
2739 }, {
2740 key: "getOptions",
2741 value: function getOptions() {
2742 // deep copy and remove data
2743 var options = $.extend({}, this.options);
2744 delete options.data;
2745 return $.extend(true, {}, options);
2746 }
2747 }, {
2748 key: "refreshOptions",
2749 value: function refreshOptions(options) {
2750 // If the objects are equivalent then avoid the call of destroy / init methods
2751 if (compareObjects(this.options, options, true)) {
2752 return;
2753 }
2754
2755 this.options = $.extend(this.options, options);
2756 this.destroy();
2757 this.init();
2758 } // value or text, default: 'value'
2759
2760 }, {
2761 key: "getSelects",
2762 value: function getSelects(type) {
2763 var _this8 = this;
2764
2765 var texts = [];
2766 var values = [];
2767 this.$drop.find(sprintf(_templateObject19(), s)(this.selectItemName)).each(function (i, el) {
2768 texts.push($(el).parents('li').first().text());
2769 values.push($(el).val());
2770 });
2771
2772 if (type === 'text' && this.$selectGroups.length) {
2773 texts = [];
2774 this.$selectGroups.each(function (i, el) {
2775 var html = [];
2776 var text = $.trim($(el).parent().text());
2777 var group = $(el).parent().data('group');
2778
2779 var $children = _this8.$drop.find(sprintf(_templateObject20(), s, s)(_this8.selectItemName, group));
2780
2781 var $selected = $children.filter(':checked');
2782
2783 if (!$selected.length) {
2784 return;
2785 }
2786
2787 html.push('[');
2788 html.push(text);
2789
2790 if ($children.length > $selected.length) {
2791 var list = [];
2792 $selected.each(function (j, elem) {
2793 list.push($(elem).parent().text());
2794 });
2795 html.push(": ".concat(list.join(', ')));
2796 }
2797
2798 html.push(']');
2799 texts.push(html.join(''));
2800 });
2801 }
2802
2803 return type === 'text' ? texts : values;
2804 }
2805 }, {
2806 key: "setSelects",
2807 value: function setSelects(values) {
2808 var _this9 = this;
2809
2810 this.$selectItems.prop('checked', false);
2811 this.$disableItems.prop('checked', false);
2812 $.each(values, function (i, value) {
2813 _this9.$selectItems.filter(sprintf(_templateObject21(), s)(value)).prop('checked', true);
2814
2815 _this9.$disableItems.filter(sprintf(_templateObject22(), s)(value)).prop('checked', true);
2816 });
2817 this.$selectAll.prop('checked', this.$selectItems.length === this.$selectItems.filter(':checked').length + this.$disableItems.filter(':checked').length);
2818 $.each(this.$selectGroups, function (i, val) {
2819 var group = $(val).parent()[0].getAttribute('data-group');
2820
2821 var $children = _this9.$selectItems.filter("[data-group=\"".concat(group, "\"]"));
2822
2823 $(val).prop('checked', $children.length && $children.length === $children.filter(':checked').length);
2824 });
2825 this.update(false);
2826 }
2827 }, {
2828 key: "enable",
2829 value: function enable() {
2830 this.$choice.removeClass('disabled');
2831 }
2832 }, {
2833 key: "disable",
2834 value: function disable() {
2835 this.$choice.addClass('disabled');
2836 }
2837 }, {
2838 key: "checkAll",
2839 value: function checkAll() {
2840 this.$selectItems.prop('checked', true);
2841 this.$selectGroups.prop('checked', true);
2842 this.$selectAll.prop('checked', true);
2843 this.update();
2844 this.options.onCheckAll();
2845 }
2846 }, {
2847 key: "uncheckAll",
2848 value: function uncheckAll() {
2849 this.$selectItems.prop('checked', false);
2850 this.$selectGroups.prop('checked', false);
2851 this.$selectAll.prop('checked', false);
2852 this.update();
2853 this.options.onUncheckAll();
2854 }
2855 }, {
2856 key: "focus",
2857 value: function focus() {
2858 this.$choice.focus();
2859 this.options.onFocus();
2860 }
2861 }, {
2862 key: "blur",
2863 value: function blur() {
2864 this.$choice.blur();
2865 this.options.onBlur();
2866 }
2867 }, {
2868 key: "refresh",
2869 value: function refresh() {
2870 this.init();
2871 }
2872 }, {
2873 key: "filter",
2874 value: function filter() {
2875 var _this10 = this;
2876
2877 var text = $.trim(this.$searchInput.val()).toLowerCase();
2878
2879 if (text.length === 0) {
2880 this.$selectAll.closest('li').show();
2881 this.$selectItems.closest('li').show();
2882 this.$disableItems.closest('li').show();
2883 this.$selectGroups.closest('li').show();
2884 this.$noResults.hide();
2885 } else {
2886 if (!this.options.filterGroup) {
2887 this.$selectItems.each(function (i, el) {
2888 var $parent = $(el).parent();
2889 var hasText = removeDiacritics($parent.text().toLowerCase()).includes(removeDiacritics(text));
2890 $parent.closest('li')[hasText ? 'show' : 'hide']();
2891 });
2892 }
2893
2894 this.$disableItems.closest('li').hide();
2895 this.$selectGroups.each(function (i, el) {
2896 var $parent = $(el).parent();
2897 var group = $parent[0].getAttribute('data-group');
2898
2899 if (_this10.options.filterGroup) {
2900 var hasText = removeDiacritics($parent.text().toLowerCase()).includes(removeDiacritics(text));
2901 var func = hasText ? 'show' : 'hide';
2902 $parent.closest('li')[func]();
2903
2904 _this10.$selectItems.filter("[data-group=\"".concat(group, "\"]")).closest('li')[func]();
2905 } else {
2906 var $items = _this10.$selectItems.filter(':visible');
2907
2908 var _hasText = $items.filter(sprintf(_templateObject23(), s)(group)).length;
2909 $parent.closest('li')[_hasText ? 'show' : 'hide']();
2910 }
2911 }); // Check if no matches found
2912
2913 if (this.$selectItems.closest('li').filter(':visible').length) {
2914 this.$selectAll.closest('li').show();
2915 this.$noResults.hide();
2916 } else {
2917 this.$selectAll.closest('li').hide();
2918 this.$noResults.show();
2919 }
2920 }
2921
2922 this.updateOptGroupSelect();
2923 this.updateSelectAll();
2924 this.options.onFilter(text);
2925 }
2926 }, {
2927 key: "destroy",
2928 value: function destroy() {
2929 if (!this.$parent) {
2930 return;
2931 }
2932
2933 this.$el.before(this.$parent).show();
2934 this.$parent.remove();
2935 }
2936 }]);
2937
2938 return MultipleSelect;
2939}();
2940
2941$.fn.multipleSelect = function (option) {
2942 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
2943 args[_key - 1] = arguments[_key];
2944 }
2945
2946 var value;
2947 this.each(function (i, el) {
2948 var $this = $(el);
2949 var data = $this.data('multipleSelect');
2950 var options = $.extend({}, $this.data(), _typeof(option) === 'object' && option);
2951
2952 if (!data) {
2953 data = new MultipleSelect($this, options);
2954 $this.data('multipleSelect', data);
2955 }
2956
2957 if (typeof option === 'string') {
2958 var _data;
2959
2960 if ($.inArray(option, Constants.METHODS) < 0) {
2961 throw new Error("Unknown method: ".concat(option));
2962 }
2963
2964 value = (_data = data)[option].apply(_data, args);
2965
2966 if (option === 'destroy') {
2967 $this.removeData('multipleSelect');
2968 }
2969 } else {
2970 data.init();
2971 }
2972 });
2973 return typeof value !== 'undefined' ? value : this;
2974};
2975
2976$.fn.multipleSelect.defaults = Constants.DEFAULTS;
2977$.fn.multipleSelect.locales = Constants.LOCALES;
2978$.fn.multipleSelect.methods = Constants.METHODS;