bootstrap-table-multiple-sort.js 77 KB

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