bootstrap-table-multiple-sort.js 74 KB

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