bootstrap-table-reorder-columns.js 47 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477
  1. (function (global, factory) {
  2. typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) :
  3. typeof define === 'function' && define.amd ? define(['jquery'], factory) :
  4. (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.jQuery));
  5. }(this, (function ($) { 'use strict';
  6. function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
  7. var $__default = /*#__PURE__*/_interopDefaultLegacy($);
  8. function _classCallCheck(instance, Constructor) {
  9. if (!(instance instanceof Constructor)) {
  10. throw new TypeError("Cannot call a class as a function");
  11. }
  12. }
  13. function _defineProperties(target, props) {
  14. for (var i = 0; i < props.length; i++) {
  15. var descriptor = props[i];
  16. descriptor.enumerable = descriptor.enumerable || false;
  17. descriptor.configurable = true;
  18. if ("value" in descriptor) descriptor.writable = true;
  19. Object.defineProperty(target, descriptor.key, descriptor);
  20. }
  21. }
  22. function _createClass(Constructor, protoProps, staticProps) {
  23. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  24. if (staticProps) _defineProperties(Constructor, staticProps);
  25. return Constructor;
  26. }
  27. function _inherits(subClass, superClass) {
  28. if (typeof superClass !== "function" && superClass !== null) {
  29. throw new TypeError("Super expression must either be null or a function");
  30. }
  31. subClass.prototype = Object.create(superClass && superClass.prototype, {
  32. constructor: {
  33. value: subClass,
  34. writable: true,
  35. configurable: true
  36. }
  37. });
  38. if (superClass) _setPrototypeOf(subClass, superClass);
  39. }
  40. function _getPrototypeOf(o) {
  41. _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
  42. return o.__proto__ || Object.getPrototypeOf(o);
  43. };
  44. return _getPrototypeOf(o);
  45. }
  46. function _setPrototypeOf(o, p) {
  47. _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
  48. o.__proto__ = p;
  49. return o;
  50. };
  51. return _setPrototypeOf(o, p);
  52. }
  53. function _isNativeReflectConstruct() {
  54. if (typeof Reflect === "undefined" || !Reflect.construct) return false;
  55. if (Reflect.construct.sham) return false;
  56. if (typeof Proxy === "function") return true;
  57. try {
  58. Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
  59. return true;
  60. } catch (e) {
  61. return false;
  62. }
  63. }
  64. function _assertThisInitialized(self) {
  65. if (self === void 0) {
  66. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  67. }
  68. return self;
  69. }
  70. function _possibleConstructorReturn(self, call) {
  71. if (call && (typeof call === "object" || typeof call === "function")) {
  72. return call;
  73. }
  74. return _assertThisInitialized(self);
  75. }
  76. function _createSuper(Derived) {
  77. var hasNativeReflectConstruct = _isNativeReflectConstruct();
  78. return function _createSuperInternal() {
  79. var Super = _getPrototypeOf(Derived),
  80. result;
  81. if (hasNativeReflectConstruct) {
  82. var NewTarget = _getPrototypeOf(this).constructor;
  83. result = Reflect.construct(Super, arguments, NewTarget);
  84. } else {
  85. result = Super.apply(this, arguments);
  86. }
  87. return _possibleConstructorReturn(this, result);
  88. };
  89. }
  90. function _superPropBase(object, property) {
  91. while (!Object.prototype.hasOwnProperty.call(object, property)) {
  92. object = _getPrototypeOf(object);
  93. if (object === null) break;
  94. }
  95. return object;
  96. }
  97. function _get(target, property, receiver) {
  98. if (typeof Reflect !== "undefined" && Reflect.get) {
  99. _get = Reflect.get;
  100. } else {
  101. _get = function _get(target, property, receiver) {
  102. var base = _superPropBase(target, property);
  103. if (!base) return;
  104. var desc = Object.getOwnPropertyDescriptor(base, property);
  105. if (desc.get) {
  106. return desc.get.call(receiver);
  107. }
  108. return desc.value;
  109. };
  110. }
  111. return _get(target, property, receiver || target);
  112. }
  113. function _slicedToArray(arr, i) {
  114. return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
  115. }
  116. function _arrayWithHoles(arr) {
  117. if (Array.isArray(arr)) return arr;
  118. }
  119. function _iterableToArrayLimit(arr, i) {
  120. if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
  121. var _arr = [];
  122. var _n = true;
  123. var _d = false;
  124. var _e = undefined;
  125. try {
  126. for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
  127. _arr.push(_s.value);
  128. if (i && _arr.length === i) break;
  129. }
  130. } catch (err) {
  131. _d = true;
  132. _e = err;
  133. } finally {
  134. try {
  135. if (!_n && _i["return"] != null) _i["return"]();
  136. } finally {
  137. if (_d) throw _e;
  138. }
  139. }
  140. return _arr;
  141. }
  142. function _unsupportedIterableToArray(o, minLen) {
  143. if (!o) return;
  144. if (typeof o === "string") return _arrayLikeToArray(o, minLen);
  145. var n = Object.prototype.toString.call(o).slice(8, -1);
  146. if (n === "Object" && o.constructor) n = o.constructor.name;
  147. if (n === "Map" || n === "Set") return Array.from(o);
  148. if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
  149. }
  150. function _arrayLikeToArray(arr, len) {
  151. if (len == null || len > arr.length) len = arr.length;
  152. for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
  153. return arr2;
  154. }
  155. function _nonIterableRest() {
  156. throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  157. }
  158. var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
  159. function createCommonjsModule(fn, module) {
  160. return module = { exports: {} }, fn(module, module.exports), module.exports;
  161. }
  162. var check = function (it) {
  163. return it && it.Math == Math && it;
  164. };
  165. // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
  166. var global_1 =
  167. /* global globalThis -- safe */
  168. check(typeof globalThis == 'object' && globalThis) ||
  169. check(typeof window == 'object' && window) ||
  170. check(typeof self == 'object' && self) ||
  171. check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
  172. // eslint-disable-next-line no-new-func -- fallback
  173. (function () { return this; })() || Function('return this')();
  174. var fails = function (exec) {
  175. try {
  176. return !!exec();
  177. } catch (error) {
  178. return true;
  179. }
  180. };
  181. // Detect IE8's incomplete defineProperty implementation
  182. var descriptors = !fails(function () {
  183. return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
  184. });
  185. var nativePropertyIsEnumerable = {}.propertyIsEnumerable;
  186. var getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
  187. // Nashorn ~ JDK8 bug
  188. var NASHORN_BUG = getOwnPropertyDescriptor$1 && !nativePropertyIsEnumerable.call({ 1: 2 }, 1);
  189. // `Object.prototype.propertyIsEnumerable` method implementation
  190. // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
  191. var f$4 = NASHORN_BUG ? function propertyIsEnumerable(V) {
  192. var descriptor = getOwnPropertyDescriptor$1(this, V);
  193. return !!descriptor && descriptor.enumerable;
  194. } : nativePropertyIsEnumerable;
  195. var objectPropertyIsEnumerable = {
  196. f: f$4
  197. };
  198. var createPropertyDescriptor = function (bitmap, value) {
  199. return {
  200. enumerable: !(bitmap & 1),
  201. configurable: !(bitmap & 2),
  202. writable: !(bitmap & 4),
  203. value: value
  204. };
  205. };
  206. var toString = {}.toString;
  207. var classofRaw = function (it) {
  208. return toString.call(it).slice(8, -1);
  209. };
  210. var split = ''.split;
  211. // fallback for non-array-like ES3 and non-enumerable old V8 strings
  212. var indexedObject = fails(function () {
  213. // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
  214. // eslint-disable-next-line no-prototype-builtins -- safe
  215. return !Object('z').propertyIsEnumerable(0);
  216. }) ? function (it) {
  217. return classofRaw(it) == 'String' ? split.call(it, '') : Object(it);
  218. } : Object;
  219. // `RequireObjectCoercible` abstract operation
  220. // https://tc39.es/ecma262/#sec-requireobjectcoercible
  221. var requireObjectCoercible = function (it) {
  222. if (it == undefined) throw TypeError("Can't call method on " + it);
  223. return it;
  224. };
  225. // toObject with fallback for non-array-like ES3 strings
  226. var toIndexedObject = function (it) {
  227. return indexedObject(requireObjectCoercible(it));
  228. };
  229. var isObject = function (it) {
  230. return typeof it === 'object' ? it !== null : typeof it === 'function';
  231. };
  232. // `ToPrimitive` abstract operation
  233. // https://tc39.es/ecma262/#sec-toprimitive
  234. // instead of the ES6 spec version, we didn't implement @@toPrimitive case
  235. // and the second argument - flag - preferred type is a string
  236. var toPrimitive = function (input, PREFERRED_STRING) {
  237. if (!isObject(input)) return input;
  238. var fn, val;
  239. if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
  240. if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val;
  241. if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
  242. throw TypeError("Can't convert object to primitive value");
  243. };
  244. var hasOwnProperty = {}.hasOwnProperty;
  245. var has$1 = function (it, key) {
  246. return hasOwnProperty.call(it, key);
  247. };
  248. var document$1 = global_1.document;
  249. // typeof document.createElement is 'object' in old IE
  250. var EXISTS = isObject(document$1) && isObject(document$1.createElement);
  251. var documentCreateElement = function (it) {
  252. return EXISTS ? document$1.createElement(it) : {};
  253. };
  254. // Thank's IE8 for his funny defineProperty
  255. var ie8DomDefine = !descriptors && !fails(function () {
  256. return Object.defineProperty(documentCreateElement('div'), 'a', {
  257. get: function () { return 7; }
  258. }).a != 7;
  259. });
  260. var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  261. // `Object.getOwnPropertyDescriptor` method
  262. // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
  263. var f$3 = descriptors ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
  264. O = toIndexedObject(O);
  265. P = toPrimitive(P, true);
  266. if (ie8DomDefine) try {
  267. return nativeGetOwnPropertyDescriptor(O, P);
  268. } catch (error) { /* empty */ }
  269. if (has$1(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]);
  270. };
  271. var objectGetOwnPropertyDescriptor = {
  272. f: f$3
  273. };
  274. var anObject = function (it) {
  275. if (!isObject(it)) {
  276. throw TypeError(String(it) + ' is not an object');
  277. } return it;
  278. };
  279. var nativeDefineProperty = Object.defineProperty;
  280. // `Object.defineProperty` method
  281. // https://tc39.es/ecma262/#sec-object.defineproperty
  282. var f$2 = descriptors ? nativeDefineProperty : function defineProperty(O, P, Attributes) {
  283. anObject(O);
  284. P = toPrimitive(P, true);
  285. anObject(Attributes);
  286. if (ie8DomDefine) try {
  287. return nativeDefineProperty(O, P, Attributes);
  288. } catch (error) { /* empty */ }
  289. if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
  290. if ('value' in Attributes) O[P] = Attributes.value;
  291. return O;
  292. };
  293. var objectDefineProperty = {
  294. f: f$2
  295. };
  296. var createNonEnumerableProperty = descriptors ? function (object, key, value) {
  297. return objectDefineProperty.f(object, key, createPropertyDescriptor(1, value));
  298. } : function (object, key, value) {
  299. object[key] = value;
  300. return object;
  301. };
  302. var setGlobal = function (key, value) {
  303. try {
  304. createNonEnumerableProperty(global_1, key, value);
  305. } catch (error) {
  306. global_1[key] = value;
  307. } return value;
  308. };
  309. var SHARED = '__core-js_shared__';
  310. var store$1 = global_1[SHARED] || setGlobal(SHARED, {});
  311. var sharedStore = store$1;
  312. var functionToString = Function.toString;
  313. // this helper broken in `3.4.1-3.4.4`, so we can't use `shared` helper
  314. if (typeof sharedStore.inspectSource != 'function') {
  315. sharedStore.inspectSource = function (it) {
  316. return functionToString.call(it);
  317. };
  318. }
  319. var inspectSource = sharedStore.inspectSource;
  320. var WeakMap$1 = global_1.WeakMap;
  321. var nativeWeakMap = typeof WeakMap$1 === 'function' && /native code/.test(inspectSource(WeakMap$1));
  322. var shared = createCommonjsModule(function (module) {
  323. (module.exports = function (key, value) {
  324. return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {});
  325. })('versions', []).push({
  326. version: '3.9.1',
  327. mode: 'global',
  328. copyright: '© 2021 Denis Pushkarev (zloirock.ru)'
  329. });
  330. });
  331. var id = 0;
  332. var postfix = Math.random();
  333. var uid = function (key) {
  334. return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);
  335. };
  336. var keys = shared('keys');
  337. var sharedKey = function (key) {
  338. return keys[key] || (keys[key] = uid(key));
  339. };
  340. var hiddenKeys$1 = {};
  341. var WeakMap = global_1.WeakMap;
  342. var set, get, has;
  343. var enforce = function (it) {
  344. return has(it) ? get(it) : set(it, {});
  345. };
  346. var getterFor = function (TYPE) {
  347. return function (it) {
  348. var state;
  349. if (!isObject(it) || (state = get(it)).type !== TYPE) {
  350. throw TypeError('Incompatible receiver, ' + TYPE + ' required');
  351. } return state;
  352. };
  353. };
  354. if (nativeWeakMap) {
  355. var store = sharedStore.state || (sharedStore.state = new WeakMap());
  356. var wmget = store.get;
  357. var wmhas = store.has;
  358. var wmset = store.set;
  359. set = function (it, metadata) {
  360. metadata.facade = it;
  361. wmset.call(store, it, metadata);
  362. return metadata;
  363. };
  364. get = function (it) {
  365. return wmget.call(store, it) || {};
  366. };
  367. has = function (it) {
  368. return wmhas.call(store, it);
  369. };
  370. } else {
  371. var STATE = sharedKey('state');
  372. hiddenKeys$1[STATE] = true;
  373. set = function (it, metadata) {
  374. metadata.facade = it;
  375. createNonEnumerableProperty(it, STATE, metadata);
  376. return metadata;
  377. };
  378. get = function (it) {
  379. return has$1(it, STATE) ? it[STATE] : {};
  380. };
  381. has = function (it) {
  382. return has$1(it, STATE);
  383. };
  384. }
  385. var internalState = {
  386. set: set,
  387. get: get,
  388. has: has,
  389. enforce: enforce,
  390. getterFor: getterFor
  391. };
  392. var redefine = createCommonjsModule(function (module) {
  393. var getInternalState = internalState.get;
  394. var enforceInternalState = internalState.enforce;
  395. var TEMPLATE = String(String).split('String');
  396. (module.exports = function (O, key, value, options) {
  397. var unsafe = options ? !!options.unsafe : false;
  398. var simple = options ? !!options.enumerable : false;
  399. var noTargetGet = options ? !!options.noTargetGet : false;
  400. var state;
  401. if (typeof value == 'function') {
  402. if (typeof key == 'string' && !has$1(value, 'name')) {
  403. createNonEnumerableProperty(value, 'name', key);
  404. }
  405. state = enforceInternalState(value);
  406. if (!state.source) {
  407. state.source = TEMPLATE.join(typeof key == 'string' ? key : '');
  408. }
  409. }
  410. if (O === global_1) {
  411. if (simple) O[key] = value;
  412. else setGlobal(key, value);
  413. return;
  414. } else if (!unsafe) {
  415. delete O[key];
  416. } else if (!noTargetGet && O[key]) {
  417. simple = true;
  418. }
  419. if (simple) O[key] = value;
  420. else createNonEnumerableProperty(O, key, value);
  421. // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
  422. })(Function.prototype, 'toString', function toString() {
  423. return typeof this == 'function' && getInternalState(this).source || inspectSource(this);
  424. });
  425. });
  426. var path = global_1;
  427. var aFunction$1 = function (variable) {
  428. return typeof variable == 'function' ? variable : undefined;
  429. };
  430. var getBuiltIn = function (namespace, method) {
  431. return arguments.length < 2 ? aFunction$1(path[namespace]) || aFunction$1(global_1[namespace])
  432. : path[namespace] && path[namespace][method] || global_1[namespace] && global_1[namespace][method];
  433. };
  434. var ceil = Math.ceil;
  435. var floor = Math.floor;
  436. // `ToInteger` abstract operation
  437. // https://tc39.es/ecma262/#sec-tointeger
  438. var toInteger = function (argument) {
  439. return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument);
  440. };
  441. var min$1 = Math.min;
  442. // `ToLength` abstract operation
  443. // https://tc39.es/ecma262/#sec-tolength
  444. var toLength = function (argument) {
  445. return argument > 0 ? min$1(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
  446. };
  447. var max = Math.max;
  448. var min = Math.min;
  449. // Helper for a popular repeating case of the spec:
  450. // Let integer be ? ToInteger(index).
  451. // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
  452. var toAbsoluteIndex = function (index, length) {
  453. var integer = toInteger(index);
  454. return integer < 0 ? max(integer + length, 0) : min(integer, length);
  455. };
  456. // `Array.prototype.{ indexOf, includes }` methods implementation
  457. var createMethod$3 = function (IS_INCLUDES) {
  458. return function ($this, el, fromIndex) {
  459. var O = toIndexedObject($this);
  460. var length = toLength(O.length);
  461. var index = toAbsoluteIndex(fromIndex, length);
  462. var value;
  463. // Array#includes uses SameValueZero equality algorithm
  464. // eslint-disable-next-line no-self-compare -- NaN check
  465. if (IS_INCLUDES && el != el) while (length > index) {
  466. value = O[index++];
  467. // eslint-disable-next-line no-self-compare -- NaN check
  468. if (value != value) return true;
  469. // Array#indexOf ignores holes, Array#includes - not
  470. } else for (;length > index; index++) {
  471. if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
  472. } return !IS_INCLUDES && -1;
  473. };
  474. };
  475. var arrayIncludes = {
  476. // `Array.prototype.includes` method
  477. // https://tc39.es/ecma262/#sec-array.prototype.includes
  478. includes: createMethod$3(true),
  479. // `Array.prototype.indexOf` method
  480. // https://tc39.es/ecma262/#sec-array.prototype.indexof
  481. indexOf: createMethod$3(false)
  482. };
  483. var indexOf = arrayIncludes.indexOf;
  484. var objectKeysInternal = function (object, names) {
  485. var O = toIndexedObject(object);
  486. var i = 0;
  487. var result = [];
  488. var key;
  489. for (key in O) !has$1(hiddenKeys$1, key) && has$1(O, key) && result.push(key);
  490. // Don't enum bug & hidden keys
  491. while (names.length > i) if (has$1(O, key = names[i++])) {
  492. ~indexOf(result, key) || result.push(key);
  493. }
  494. return result;
  495. };
  496. // IE8- don't enum bug keys
  497. var enumBugKeys = [
  498. 'constructor',
  499. 'hasOwnProperty',
  500. 'isPrototypeOf',
  501. 'propertyIsEnumerable',
  502. 'toLocaleString',
  503. 'toString',
  504. 'valueOf'
  505. ];
  506. var hiddenKeys = enumBugKeys.concat('length', 'prototype');
  507. // `Object.getOwnPropertyNames` method
  508. // https://tc39.es/ecma262/#sec-object.getownpropertynames
  509. var f$1 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
  510. return objectKeysInternal(O, hiddenKeys);
  511. };
  512. var objectGetOwnPropertyNames = {
  513. f: f$1
  514. };
  515. var f = Object.getOwnPropertySymbols;
  516. var objectGetOwnPropertySymbols = {
  517. f: f
  518. };
  519. // all object keys, includes non-enumerable and symbols
  520. var ownKeys = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
  521. var keys = objectGetOwnPropertyNames.f(anObject(it));
  522. var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
  523. return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
  524. };
  525. var copyConstructorProperties = function (target, source) {
  526. var keys = ownKeys(source);
  527. var defineProperty = objectDefineProperty.f;
  528. var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
  529. for (var i = 0; i < keys.length; i++) {
  530. var key = keys[i];
  531. if (!has$1(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
  532. }
  533. };
  534. var replacement = /#|\.prototype\./;
  535. var isForced = function (feature, detection) {
  536. var value = data[normalize(feature)];
  537. return value == POLYFILL ? true
  538. : value == NATIVE ? false
  539. : typeof detection == 'function' ? fails(detection)
  540. : !!detection;
  541. };
  542. var normalize = isForced.normalize = function (string) {
  543. return String(string).replace(replacement, '.').toLowerCase();
  544. };
  545. var data = isForced.data = {};
  546. var NATIVE = isForced.NATIVE = 'N';
  547. var POLYFILL = isForced.POLYFILL = 'P';
  548. var isForced_1 = isForced;
  549. var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
  550. /*
  551. options.target - name of the target object
  552. options.global - target is the global object
  553. options.stat - export as static methods of target
  554. options.proto - export as prototype methods of target
  555. options.real - real prototype method for the `pure` version
  556. options.forced - export even if the native feature is available
  557. options.bind - bind methods to the target, required for the `pure` version
  558. options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
  559. options.unsafe - use the simple assignment of property instead of delete + defineProperty
  560. options.sham - add a flag to not completely full polyfills
  561. options.enumerable - export as enumerable property
  562. options.noTargetGet - prevent calling a getter on target
  563. */
  564. var _export = function (options, source) {
  565. var TARGET = options.target;
  566. var GLOBAL = options.global;
  567. var STATIC = options.stat;
  568. var FORCED, target, key, targetProperty, sourceProperty, descriptor;
  569. if (GLOBAL) {
  570. target = global_1;
  571. } else if (STATIC) {
  572. target = global_1[TARGET] || setGlobal(TARGET, {});
  573. } else {
  574. target = (global_1[TARGET] || {}).prototype;
  575. }
  576. if (target) for (key in source) {
  577. sourceProperty = source[key];
  578. if (options.noTargetGet) {
  579. descriptor = getOwnPropertyDescriptor(target, key);
  580. targetProperty = descriptor && descriptor.value;
  581. } else targetProperty = target[key];
  582. FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
  583. // contained in target
  584. if (!FORCED && targetProperty !== undefined) {
  585. if (typeof sourceProperty === typeof targetProperty) continue;
  586. copyConstructorProperties(sourceProperty, targetProperty);
  587. }
  588. // add a flag to not completely full polyfills
  589. if (options.sham || (targetProperty && targetProperty.sham)) {
  590. createNonEnumerableProperty(sourceProperty, 'sham', true);
  591. }
  592. // extend global
  593. redefine(target, key, sourceProperty, options);
  594. }
  595. };
  596. // `Object.keys` method
  597. // https://tc39.es/ecma262/#sec-object.keys
  598. var objectKeys = Object.keys || function keys(O) {
  599. return objectKeysInternal(O, enumBugKeys);
  600. };
  601. var propertyIsEnumerable = objectPropertyIsEnumerable.f;
  602. // `Object.{ entries, values }` methods implementation
  603. var createMethod$2 = function (TO_ENTRIES) {
  604. return function (it) {
  605. var O = toIndexedObject(it);
  606. var keys = objectKeys(O);
  607. var length = keys.length;
  608. var i = 0;
  609. var result = [];
  610. var key;
  611. while (length > i) {
  612. key = keys[i++];
  613. if (!descriptors || propertyIsEnumerable.call(O, key)) {
  614. result.push(TO_ENTRIES ? [key, O[key]] : O[key]);
  615. }
  616. }
  617. return result;
  618. };
  619. };
  620. var objectToArray = {
  621. // `Object.entries` method
  622. // https://tc39.es/ecma262/#sec-object.entries
  623. entries: createMethod$2(true),
  624. // `Object.values` method
  625. // https://tc39.es/ecma262/#sec-object.values
  626. values: createMethod$2(false)
  627. };
  628. var $entries = objectToArray.entries;
  629. // `Object.entries` method
  630. // https://tc39.es/ecma262/#sec-object.entries
  631. _export({ target: 'Object', stat: true }, {
  632. entries: function entries(O) {
  633. return $entries(O);
  634. }
  635. });
  636. var aFunction = function (it) {
  637. if (typeof it != 'function') {
  638. throw TypeError(String(it) + ' is not a function');
  639. } return it;
  640. };
  641. // optional / simple context binding
  642. var functionBindContext = function (fn, that, length) {
  643. aFunction(fn);
  644. if (that === undefined) return fn;
  645. switch (length) {
  646. case 0: return function () {
  647. return fn.call(that);
  648. };
  649. case 1: return function (a) {
  650. return fn.call(that, a);
  651. };
  652. case 2: return function (a, b) {
  653. return fn.call(that, a, b);
  654. };
  655. case 3: return function (a, b, c) {
  656. return fn.call(that, a, b, c);
  657. };
  658. }
  659. return function (/* ...args */) {
  660. return fn.apply(that, arguments);
  661. };
  662. };
  663. // `ToObject` abstract operation
  664. // https://tc39.es/ecma262/#sec-toobject
  665. var toObject = function (argument) {
  666. return Object(requireObjectCoercible(argument));
  667. };
  668. // `IsArray` abstract operation
  669. // https://tc39.es/ecma262/#sec-isarray
  670. var isArray = Array.isArray || function isArray(arg) {
  671. return classofRaw(arg) == 'Array';
  672. };
  673. var engineIsNode = classofRaw(global_1.process) == 'process';
  674. var engineUserAgent = getBuiltIn('navigator', 'userAgent') || '';
  675. var process = global_1.process;
  676. var versions = process && process.versions;
  677. var v8 = versions && versions.v8;
  678. var match, version;
  679. if (v8) {
  680. match = v8.split('.');
  681. version = match[0] + match[1];
  682. } else if (engineUserAgent) {
  683. match = engineUserAgent.match(/Edge\/(\d+)/);
  684. if (!match || match[1] >= 74) {
  685. match = engineUserAgent.match(/Chrome\/(\d+)/);
  686. if (match) version = match[1];
  687. }
  688. }
  689. var engineV8Version = version && +version;
  690. var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () {
  691. /* global Symbol -- required for testing */
  692. return !Symbol.sham &&
  693. // Chrome 38 Symbol has incorrect toString conversion
  694. // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
  695. (engineIsNode ? engineV8Version === 38 : engineV8Version > 37 && engineV8Version < 41);
  696. });
  697. var useSymbolAsUid = nativeSymbol
  698. /* global Symbol -- safe */
  699. && !Symbol.sham
  700. && typeof Symbol.iterator == 'symbol';
  701. var WellKnownSymbolsStore = shared('wks');
  702. var Symbol$1 = global_1.Symbol;
  703. var createWellKnownSymbol = useSymbolAsUid ? Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid;
  704. var wellKnownSymbol = function (name) {
  705. if (!has$1(WellKnownSymbolsStore, name) || !(nativeSymbol || typeof WellKnownSymbolsStore[name] == 'string')) {
  706. if (nativeSymbol && has$1(Symbol$1, name)) {
  707. WellKnownSymbolsStore[name] = Symbol$1[name];
  708. } else {
  709. WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name);
  710. }
  711. } return WellKnownSymbolsStore[name];
  712. };
  713. var SPECIES$1 = wellKnownSymbol('species');
  714. // `ArraySpeciesCreate` abstract operation
  715. // https://tc39.es/ecma262/#sec-arrayspeciescreate
  716. var arraySpeciesCreate = function (originalArray, length) {
  717. var C;
  718. if (isArray(originalArray)) {
  719. C = originalArray.constructor;
  720. // cross-realm fallback
  721. if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;
  722. else if (isObject(C)) {
  723. C = C[SPECIES$1];
  724. if (C === null) C = undefined;
  725. }
  726. } return new (C === undefined ? Array : C)(length === 0 ? 0 : length);
  727. };
  728. var push = [].push;
  729. // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterOut }` methods implementation
  730. var createMethod$1 = function (TYPE) {
  731. var IS_MAP = TYPE == 1;
  732. var IS_FILTER = TYPE == 2;
  733. var IS_SOME = TYPE == 3;
  734. var IS_EVERY = TYPE == 4;
  735. var IS_FIND_INDEX = TYPE == 6;
  736. var IS_FILTER_OUT = TYPE == 7;
  737. var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
  738. return function ($this, callbackfn, that, specificCreate) {
  739. var O = toObject($this);
  740. var self = indexedObject(O);
  741. var boundFunction = functionBindContext(callbackfn, that, 3);
  742. var length = toLength(self.length);
  743. var index = 0;
  744. var create = specificCreate || arraySpeciesCreate;
  745. var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_OUT ? create($this, 0) : undefined;
  746. var value, result;
  747. for (;length > index; index++) if (NO_HOLES || index in self) {
  748. value = self[index];
  749. result = boundFunction(value, index, O);
  750. if (TYPE) {
  751. if (IS_MAP) target[index] = result; // map
  752. else if (result) switch (TYPE) {
  753. case 3: return true; // some
  754. case 5: return value; // find
  755. case 6: return index; // findIndex
  756. case 2: push.call(target, value); // filter
  757. } else switch (TYPE) {
  758. case 4: return false; // every
  759. case 7: push.call(target, value); // filterOut
  760. }
  761. }
  762. }
  763. return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
  764. };
  765. };
  766. var arrayIteration = {
  767. // `Array.prototype.forEach` method
  768. // https://tc39.es/ecma262/#sec-array.prototype.foreach
  769. forEach: createMethod$1(0),
  770. // `Array.prototype.map` method
  771. // https://tc39.es/ecma262/#sec-array.prototype.map
  772. map: createMethod$1(1),
  773. // `Array.prototype.filter` method
  774. // https://tc39.es/ecma262/#sec-array.prototype.filter
  775. filter: createMethod$1(2),
  776. // `Array.prototype.some` method
  777. // https://tc39.es/ecma262/#sec-array.prototype.some
  778. some: createMethod$1(3),
  779. // `Array.prototype.every` method
  780. // https://tc39.es/ecma262/#sec-array.prototype.every
  781. every: createMethod$1(4),
  782. // `Array.prototype.find` method
  783. // https://tc39.es/ecma262/#sec-array.prototype.find
  784. find: createMethod$1(5),
  785. // `Array.prototype.findIndex` method
  786. // https://tc39.es/ecma262/#sec-array.prototype.findIndex
  787. findIndex: createMethod$1(6),
  788. // `Array.prototype.filterOut` method
  789. // https://github.com/tc39/proposal-array-filtering
  790. filterOut: createMethod$1(7)
  791. };
  792. // `Object.defineProperties` method
  793. // https://tc39.es/ecma262/#sec-object.defineproperties
  794. var objectDefineProperties = descriptors ? Object.defineProperties : function defineProperties(O, Properties) {
  795. anObject(O);
  796. var keys = objectKeys(Properties);
  797. var length = keys.length;
  798. var index = 0;
  799. var key;
  800. while (length > index) objectDefineProperty.f(O, key = keys[index++], Properties[key]);
  801. return O;
  802. };
  803. var html = getBuiltIn('document', 'documentElement');
  804. var GT = '>';
  805. var LT = '<';
  806. var PROTOTYPE = 'prototype';
  807. var SCRIPT = 'script';
  808. var IE_PROTO = sharedKey('IE_PROTO');
  809. var EmptyConstructor = function () { /* empty */ };
  810. var scriptTag = function (content) {
  811. return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
  812. };
  813. // Create object with fake `null` prototype: use ActiveX Object with cleared prototype
  814. var NullProtoObjectViaActiveX = function (activeXDocument) {
  815. activeXDocument.write(scriptTag(''));
  816. activeXDocument.close();
  817. var temp = activeXDocument.parentWindow.Object;
  818. activeXDocument = null; // avoid memory leak
  819. return temp;
  820. };
  821. // Create object with fake `null` prototype: use iframe Object with cleared prototype
  822. var NullProtoObjectViaIFrame = function () {
  823. // Thrash, waste and sodomy: IE GC bug
  824. var iframe = documentCreateElement('iframe');
  825. var JS = 'java' + SCRIPT + ':';
  826. var iframeDocument;
  827. iframe.style.display = 'none';
  828. html.appendChild(iframe);
  829. // https://github.com/zloirock/core-js/issues/475
  830. iframe.src = String(JS);
  831. iframeDocument = iframe.contentWindow.document;
  832. iframeDocument.open();
  833. iframeDocument.write(scriptTag('document.F=Object'));
  834. iframeDocument.close();
  835. return iframeDocument.F;
  836. };
  837. // Check for document.domain and active x support
  838. // No need to use active x approach when document.domain is not set
  839. // see https://github.com/es-shims/es5-shim/issues/150
  840. // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
  841. // avoid IE GC bug
  842. var activeXDocument;
  843. var NullProtoObject = function () {
  844. try {
  845. /* global ActiveXObject -- old IE */
  846. activeXDocument = document.domain && new ActiveXObject('htmlfile');
  847. } catch (error) { /* ignore */ }
  848. NullProtoObject = activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame();
  849. var length = enumBugKeys.length;
  850. while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
  851. return NullProtoObject();
  852. };
  853. hiddenKeys$1[IE_PROTO] = true;
  854. // `Object.create` method
  855. // https://tc39.es/ecma262/#sec-object.create
  856. var objectCreate = Object.create || function create(O, Properties) {
  857. var result;
  858. if (O !== null) {
  859. EmptyConstructor[PROTOTYPE] = anObject(O);
  860. result = new EmptyConstructor();
  861. EmptyConstructor[PROTOTYPE] = null;
  862. // add "__proto__" for Object.getPrototypeOf polyfill
  863. result[IE_PROTO] = O;
  864. } else result = NullProtoObject();
  865. return Properties === undefined ? result : objectDefineProperties(result, Properties);
  866. };
  867. var UNSCOPABLES = wellKnownSymbol('unscopables');
  868. var ArrayPrototype = Array.prototype;
  869. // Array.prototype[@@unscopables]
  870. // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
  871. if (ArrayPrototype[UNSCOPABLES] == undefined) {
  872. objectDefineProperty.f(ArrayPrototype, UNSCOPABLES, {
  873. configurable: true,
  874. value: objectCreate(null)
  875. });
  876. }
  877. // add a key to Array.prototype[@@unscopables]
  878. var addToUnscopables = function (key) {
  879. ArrayPrototype[UNSCOPABLES][key] = true;
  880. };
  881. var $find = arrayIteration.find;
  882. var FIND = 'find';
  883. var SKIPS_HOLES = true;
  884. // Shouldn't skip holes
  885. if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });
  886. // `Array.prototype.find` method
  887. // https://tc39.es/ecma262/#sec-array.prototype.find
  888. _export({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
  889. find: function find(callbackfn /* , that = undefined */) {
  890. return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  891. }
  892. });
  893. // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
  894. addToUnscopables(FIND);
  895. // a string of all valid unicode whitespaces
  896. var whitespaces = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' +
  897. '\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
  898. var whitespace = '[' + whitespaces + ']';
  899. var ltrim = RegExp('^' + whitespace + whitespace + '*');
  900. var rtrim = RegExp(whitespace + whitespace + '*$');
  901. // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
  902. var createMethod = function (TYPE) {
  903. return function ($this) {
  904. var string = String(requireObjectCoercible($this));
  905. if (TYPE & 1) string = string.replace(ltrim, '');
  906. if (TYPE & 2) string = string.replace(rtrim, '');
  907. return string;
  908. };
  909. };
  910. var stringTrim = {
  911. // `String.prototype.{ trimLeft, trimStart }` methods
  912. // https://tc39.es/ecma262/#sec-string.prototype.trimstart
  913. start: createMethod(1),
  914. // `String.prototype.{ trimRight, trimEnd }` methods
  915. // https://tc39.es/ecma262/#sec-string.prototype.trimend
  916. end: createMethod(2),
  917. // `String.prototype.trim` method
  918. // https://tc39.es/ecma262/#sec-string.prototype.trim
  919. trim: createMethod(3)
  920. };
  921. var trim = stringTrim.trim;
  922. var $parseInt = global_1.parseInt;
  923. var hex = /^[+-]?0[Xx]/;
  924. var FORCED$1 = $parseInt(whitespaces + '08') !== 8 || $parseInt(whitespaces + '0x16') !== 22;
  925. // `parseInt` method
  926. // https://tc39.es/ecma262/#sec-parseint-string-radix
  927. var numberParseInt = FORCED$1 ? function parseInt(string, radix) {
  928. var S = trim(String(string));
  929. return $parseInt(S, (radix >>> 0) || (hex.test(S) ? 16 : 10));
  930. } : $parseInt;
  931. // `parseInt` method
  932. // https://tc39.es/ecma262/#sec-parseint-string-radix
  933. _export({ global: true, forced: parseInt != numberParseInt }, {
  934. parseInt: numberParseInt
  935. });
  936. var SPECIES = wellKnownSymbol('species');
  937. var arrayMethodHasSpeciesSupport = function (METHOD_NAME) {
  938. // We can't use this feature detection in V8 since it causes
  939. // deoptimization and serious performance degradation
  940. // https://github.com/zloirock/core-js/issues/677
  941. return engineV8Version >= 51 || !fails(function () {
  942. var array = [];
  943. var constructor = array.constructor = {};
  944. constructor[SPECIES] = function () {
  945. return { foo: 1 };
  946. };
  947. return array[METHOD_NAME](Boolean).foo !== 1;
  948. });
  949. };
  950. var $filter = arrayIteration.filter;
  951. var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('filter');
  952. // `Array.prototype.filter` method
  953. // https://tc39.es/ecma262/#sec-array.prototype.filter
  954. // with adding support of @@species
  955. _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
  956. filter: function filter(callbackfn /* , thisArg */) {
  957. return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  958. }
  959. });
  960. var createProperty = function (object, key, value) {
  961. var propertyKey = toPrimitive(key);
  962. if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value));
  963. else object[propertyKey] = value;
  964. };
  965. var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
  966. var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
  967. var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';
  968. // We can't use this feature detection in V8 since it causes
  969. // deoptimization and serious performance degradation
  970. // https://github.com/zloirock/core-js/issues/679
  971. var IS_CONCAT_SPREADABLE_SUPPORT = engineV8Version >= 51 || !fails(function () {
  972. var array = [];
  973. array[IS_CONCAT_SPREADABLE] = false;
  974. return array.concat()[0] !== array;
  975. });
  976. var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
  977. var isConcatSpreadable = function (O) {
  978. if (!isObject(O)) return false;
  979. var spreadable = O[IS_CONCAT_SPREADABLE];
  980. return spreadable !== undefined ? !!spreadable : isArray(O);
  981. };
  982. var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
  983. // `Array.prototype.concat` method
  984. // https://tc39.es/ecma262/#sec-array.prototype.concat
  985. // with adding support of @@isConcatSpreadable and @@species
  986. _export({ target: 'Array', proto: true, forced: FORCED }, {
  987. // eslint-disable-next-line no-unused-vars -- required for `.length`
  988. concat: function concat(arg) {
  989. var O = toObject(this);
  990. var A = arraySpeciesCreate(O, 0);
  991. var n = 0;
  992. var i, k, length, len, E;
  993. for (i = -1, length = arguments.length; i < length; i++) {
  994. E = i === -1 ? O : arguments[i];
  995. if (isConcatSpreadable(E)) {
  996. len = toLength(E.length);
  997. if (n + len > MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
  998. for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
  999. } else {
  1000. if (n >= MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
  1001. createProperty(A, n++, E);
  1002. }
  1003. }
  1004. A.length = n;
  1005. return A;
  1006. }
  1007. });
  1008. /**
  1009. * @author: Dennis Hernández
  1010. * @webSite: http://djhvscf.github.io/Blog
  1011. * @update: https://github.com/wenzhixin
  1012. * @version: v1.2.0
  1013. */
  1014. $__default['default'].akottr.dragtable.prototype._restoreState = function (persistObj) {
  1015. var i = 0;
  1016. for (var _i = 0, _Object$entries = Object.entries(persistObj); _i < _Object$entries.length; _i++) {
  1017. var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
  1018. field = _Object$entries$_i[0],
  1019. value = _Object$entries$_i[1];
  1020. var $th = this.originalTable.el.find("th[data-field=\"".concat(field, "\"]"));
  1021. if (!$th.length) {
  1022. i++;
  1023. continue;
  1024. }
  1025. this.originalTable.startIndex = $th.prevAll().length + 1;
  1026. this.originalTable.endIndex = parseInt(value, 10) + 1 - i;
  1027. this._bubbleCols();
  1028. }
  1029. }; // From MDN site, https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter
  1030. var filterFn = function filterFn() {
  1031. if (!Array.prototype.filter) {
  1032. Array.prototype.filter = function (fun
  1033. /* , thisArg*/
  1034. ) {
  1035. if (this === undefined || this === null) {
  1036. throw new TypeError();
  1037. }
  1038. var t = Object(this);
  1039. var len = t.length >>> 0;
  1040. if (typeof fun !== 'function') {
  1041. throw new TypeError();
  1042. }
  1043. var res = [];
  1044. var thisArg = arguments.length >= 2 ? arguments[1] : undefined;
  1045. for (var i = 0; i < len; i++) {
  1046. if (i in t) {
  1047. var val = t[i]; // NOTE: Technically this should Object.defineProperty at
  1048. // the next index, as push can be affected by
  1049. // properties on Object.prototype and Array.prototype.
  1050. // But this method's new, and collisions should be
  1051. // rare, so use the more-compatible alternative.
  1052. if (fun.call(thisArg, val, i, t)) {
  1053. res.push(val);
  1054. }
  1055. }
  1056. }
  1057. return res;
  1058. };
  1059. }
  1060. };
  1061. $__default['default'].extend($__default['default'].fn.bootstrapTable.defaults, {
  1062. reorderableColumns: false,
  1063. maxMovingRows: 10,
  1064. // eslint-disable-next-line no-unused-vars
  1065. onReorderColumn: function onReorderColumn(headerFields) {
  1066. return false;
  1067. },
  1068. dragaccept: null
  1069. });
  1070. $__default['default'].extend($__default['default'].fn.bootstrapTable.Constructor.EVENTS, {
  1071. 'reorder-column.bs.table': 'onReorderColumn'
  1072. });
  1073. $__default['default'].fn.bootstrapTable.methods.push('orderColumns');
  1074. $__default['default'].BootstrapTable = /*#__PURE__*/function (_$$BootstrapTable) {
  1075. _inherits(_class, _$$BootstrapTable);
  1076. var _super = _createSuper(_class);
  1077. function _class() {
  1078. _classCallCheck(this, _class);
  1079. return _super.apply(this, arguments);
  1080. }
  1081. _createClass(_class, [{
  1082. key: "initHeader",
  1083. value: function initHeader() {
  1084. var _get2;
  1085. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  1086. args[_key] = arguments[_key];
  1087. }
  1088. (_get2 = _get(_getPrototypeOf(_class.prototype), "initHeader", this)).call.apply(_get2, [this].concat(args));
  1089. if (!this.options.reorderableColumns) {
  1090. return;
  1091. }
  1092. this.makeRowsReorderable();
  1093. }
  1094. }, {
  1095. key: "_toggleColumn",
  1096. value: function _toggleColumn() {
  1097. var _get3;
  1098. for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  1099. args[_key2] = arguments[_key2];
  1100. }
  1101. (_get3 = _get(_getPrototypeOf(_class.prototype), "_toggleColumn", this)).call.apply(_get3, [this].concat(args));
  1102. if (!this.options.reorderableColumns) {
  1103. return;
  1104. }
  1105. this.makeRowsReorderable();
  1106. }
  1107. }, {
  1108. key: "toggleView",
  1109. value: function toggleView() {
  1110. var _get4;
  1111. for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
  1112. args[_key3] = arguments[_key3];
  1113. }
  1114. (_get4 = _get(_getPrototypeOf(_class.prototype), "toggleView", this)).call.apply(_get4, [this].concat(args));
  1115. if (!this.options.reorderableColumns) {
  1116. return;
  1117. }
  1118. if (this.options.cardView) {
  1119. return;
  1120. }
  1121. this.makeRowsReorderable();
  1122. }
  1123. }, {
  1124. key: "resetView",
  1125. value: function resetView() {
  1126. var _get5;
  1127. for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
  1128. args[_key4] = arguments[_key4];
  1129. }
  1130. (_get5 = _get(_getPrototypeOf(_class.prototype), "resetView", this)).call.apply(_get5, [this].concat(args));
  1131. if (!this.options.reorderableColumns) {
  1132. return;
  1133. }
  1134. this.makeRowsReorderable();
  1135. }
  1136. }, {
  1137. key: "makeRowsReorderable",
  1138. value: function makeRowsReorderable() {
  1139. var _this = this;
  1140. var order = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  1141. try {
  1142. $__default['default'](this.$el).dragtable('destroy');
  1143. } catch (e) {// do nothing
  1144. }
  1145. $__default['default'](this.$el).dragtable({
  1146. maxMovingRows: this.options.maxMovingRows,
  1147. dragaccept: this.options.dragaccept,
  1148. clickDelay: 200,
  1149. dragHandle: '.th-inner',
  1150. restoreState: order ? order : this.columnsSortOrder,
  1151. beforeStop: function beforeStop(table) {
  1152. var sortOrder = {};
  1153. table.el.find('th').each(function (i, el) {
  1154. sortOrder[$__default['default'](el).data('field')] = i;
  1155. });
  1156. _this.columnsSortOrder = sortOrder;
  1157. if (_this.options.cookie) {
  1158. _this.persistReorderColumnsState(_this);
  1159. }
  1160. var ths = [];
  1161. var formatters = [];
  1162. var columns = [];
  1163. var columnsHidden = [];
  1164. var columnIndex = -1;
  1165. var optionsColumns = [];
  1166. _this.$header.find('th:not(.detail)').each(function (i, el) {
  1167. ths.push($__default['default'](el).data('field'));
  1168. formatters.push($__default['default'](el).data('formatter'));
  1169. }); // Exist columns not shown
  1170. if (ths.length < _this.columns.length) {
  1171. columnsHidden = _this.columns.filter(function (column) {
  1172. return !column.visible;
  1173. });
  1174. for (var i = 0; i < columnsHidden.length; i++) {
  1175. ths.push(columnsHidden[i].field);
  1176. formatters.push(columnsHidden[i].formatter);
  1177. }
  1178. }
  1179. for (var _i2 = 0; _i2 < ths.length; _i2++) {
  1180. columnIndex = _this.fieldsColumnsIndex[ths[_i2]];
  1181. if (columnIndex !== -1) {
  1182. _this.fieldsColumnsIndex[ths[_i2]] = _i2;
  1183. _this.columns[columnIndex].fieldIndex = _i2;
  1184. columns.push(_this.columns[columnIndex]);
  1185. }
  1186. }
  1187. _this.columns = columns;
  1188. filterFn(); // Support <IE9
  1189. $__default['default'].each(_this.columns, function (i, column) {
  1190. var found = false;
  1191. var field = column.field;
  1192. _this.options.columns[0].filter(function (item) {
  1193. if (!found && item['field'] === field) {
  1194. optionsColumns.push(item);
  1195. found = true;
  1196. return false;
  1197. }
  1198. return true;
  1199. });
  1200. });
  1201. _this.options.columns[0] = optionsColumns;
  1202. _this.header.fields = ths;
  1203. _this.header.formatters = formatters;
  1204. _this.initHeader();
  1205. _this.initToolbar();
  1206. _this.initSearchText();
  1207. _this.initBody();
  1208. _this.resetView();
  1209. _this.trigger('reorder-column', ths);
  1210. }
  1211. });
  1212. }
  1213. }, {
  1214. key: "orderColumns",
  1215. value: function orderColumns(order) {
  1216. this.columnsSortOrder = order;
  1217. this.makeRowsReorderable();
  1218. }
  1219. }]);
  1220. return _class;
  1221. }($__default['default'].BootstrapTable);
  1222. })));