bootstrap-table-multiple-sort.js 73 KB

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