utils.js 84 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434
  1. (function (global, factory) {
  2. typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('jquery')) :
  3. typeof define === 'function' && define.amd ? define(['exports', 'jquery'], factory) :
  4. (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.BootstrapTable = {}, global.jQuery));
  5. }(this, (function (exports, $) { 'use strict';
  6. function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
  7. var $__default = /*#__PURE__*/_interopDefaultLegacy($);
  8. function _typeof(obj) {
  9. "@babel/helpers - typeof";
  10. if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
  11. _typeof = function (obj) {
  12. return typeof obj;
  13. };
  14. } else {
  15. _typeof = function (obj) {
  16. return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
  17. };
  18. }
  19. return _typeof(obj);
  20. }
  21. var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
  22. function createCommonjsModule(fn, module) {
  23. return module = { exports: {} }, fn(module, module.exports), module.exports;
  24. }
  25. var check = function (it) {
  26. return it && it.Math == Math && it;
  27. };
  28. // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
  29. var global_1 =
  30. /* global globalThis -- safe */
  31. check(typeof globalThis == 'object' && globalThis) ||
  32. check(typeof window == 'object' && window) ||
  33. check(typeof self == 'object' && self) ||
  34. check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
  35. // eslint-disable-next-line no-new-func -- fallback
  36. (function () { return this; })() || Function('return this')();
  37. var fails = function (exec) {
  38. try {
  39. return !!exec();
  40. } catch (error) {
  41. return true;
  42. }
  43. };
  44. // Detect IE8's incomplete defineProperty implementation
  45. var descriptors = !fails(function () {
  46. return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
  47. });
  48. var nativePropertyIsEnumerable = {}.propertyIsEnumerable;
  49. var getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
  50. // Nashorn ~ JDK8 bug
  51. var NASHORN_BUG = getOwnPropertyDescriptor$1 && !nativePropertyIsEnumerable.call({ 1: 2 }, 1);
  52. // `Object.prototype.propertyIsEnumerable` method implementation
  53. // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
  54. var f$4 = NASHORN_BUG ? function propertyIsEnumerable(V) {
  55. var descriptor = getOwnPropertyDescriptor$1(this, V);
  56. return !!descriptor && descriptor.enumerable;
  57. } : nativePropertyIsEnumerable;
  58. var objectPropertyIsEnumerable = {
  59. f: f$4
  60. };
  61. var createPropertyDescriptor = function (bitmap, value) {
  62. return {
  63. enumerable: !(bitmap & 1),
  64. configurable: !(bitmap & 2),
  65. writable: !(bitmap & 4),
  66. value: value
  67. };
  68. };
  69. var toString = {}.toString;
  70. var classofRaw = function (it) {
  71. return toString.call(it).slice(8, -1);
  72. };
  73. var split = ''.split;
  74. // fallback for non-array-like ES3 and non-enumerable old V8 strings
  75. var indexedObject = fails(function () {
  76. // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
  77. // eslint-disable-next-line no-prototype-builtins -- safe
  78. return !Object('z').propertyIsEnumerable(0);
  79. }) ? function (it) {
  80. return classofRaw(it) == 'String' ? split.call(it, '') : Object(it);
  81. } : Object;
  82. // `RequireObjectCoercible` abstract operation
  83. // https://tc39.es/ecma262/#sec-requireobjectcoercible
  84. var requireObjectCoercible = function (it) {
  85. if (it == undefined) throw TypeError("Can't call method on " + it);
  86. return it;
  87. };
  88. // toObject with fallback for non-array-like ES3 strings
  89. var toIndexedObject = function (it) {
  90. return indexedObject(requireObjectCoercible(it));
  91. };
  92. var isObject = function (it) {
  93. return typeof it === 'object' ? it !== null : typeof it === 'function';
  94. };
  95. // `ToPrimitive` abstract operation
  96. // https://tc39.es/ecma262/#sec-toprimitive
  97. // instead of the ES6 spec version, we didn't implement @@toPrimitive case
  98. // and the second argument - flag - preferred type is a string
  99. var toPrimitive = function (input, PREFERRED_STRING) {
  100. if (!isObject(input)) return input;
  101. var fn, val;
  102. if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
  103. if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val;
  104. if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
  105. throw TypeError("Can't convert object to primitive value");
  106. };
  107. var hasOwnProperty = {}.hasOwnProperty;
  108. var has$1 = function (it, key) {
  109. return hasOwnProperty.call(it, key);
  110. };
  111. var document$1 = global_1.document;
  112. // typeof document.createElement is 'object' in old IE
  113. var EXISTS = isObject(document$1) && isObject(document$1.createElement);
  114. var documentCreateElement = function (it) {
  115. return EXISTS ? document$1.createElement(it) : {};
  116. };
  117. // Thank's IE8 for his funny defineProperty
  118. var ie8DomDefine = !descriptors && !fails(function () {
  119. return Object.defineProperty(documentCreateElement('div'), 'a', {
  120. get: function () { return 7; }
  121. }).a != 7;
  122. });
  123. var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  124. // `Object.getOwnPropertyDescriptor` method
  125. // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
  126. var f$3 = descriptors ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
  127. O = toIndexedObject(O);
  128. P = toPrimitive(P, true);
  129. if (ie8DomDefine) try {
  130. return nativeGetOwnPropertyDescriptor(O, P);
  131. } catch (error) { /* empty */ }
  132. if (has$1(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]);
  133. };
  134. var objectGetOwnPropertyDescriptor = {
  135. f: f$3
  136. };
  137. var anObject = function (it) {
  138. if (!isObject(it)) {
  139. throw TypeError(String(it) + ' is not an object');
  140. } return it;
  141. };
  142. var nativeDefineProperty = Object.defineProperty;
  143. // `Object.defineProperty` method
  144. // https://tc39.es/ecma262/#sec-object.defineproperty
  145. var f$2 = descriptors ? nativeDefineProperty : function defineProperty(O, P, Attributes) {
  146. anObject(O);
  147. P = toPrimitive(P, true);
  148. anObject(Attributes);
  149. if (ie8DomDefine) try {
  150. return nativeDefineProperty(O, P, Attributes);
  151. } catch (error) { /* empty */ }
  152. if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
  153. if ('value' in Attributes) O[P] = Attributes.value;
  154. return O;
  155. };
  156. var objectDefineProperty = {
  157. f: f$2
  158. };
  159. var createNonEnumerableProperty = descriptors ? function (object, key, value) {
  160. return objectDefineProperty.f(object, key, createPropertyDescriptor(1, value));
  161. } : function (object, key, value) {
  162. object[key] = value;
  163. return object;
  164. };
  165. var setGlobal = function (key, value) {
  166. try {
  167. createNonEnumerableProperty(global_1, key, value);
  168. } catch (error) {
  169. global_1[key] = value;
  170. } return value;
  171. };
  172. var SHARED = '__core-js_shared__';
  173. var store$1 = global_1[SHARED] || setGlobal(SHARED, {});
  174. var sharedStore = store$1;
  175. var functionToString = Function.toString;
  176. // this helper broken in `3.4.1-3.4.4`, so we can't use `shared` helper
  177. if (typeof sharedStore.inspectSource != 'function') {
  178. sharedStore.inspectSource = function (it) {
  179. return functionToString.call(it);
  180. };
  181. }
  182. var inspectSource = sharedStore.inspectSource;
  183. var WeakMap$1 = global_1.WeakMap;
  184. var nativeWeakMap = typeof WeakMap$1 === 'function' && /native code/.test(inspectSource(WeakMap$1));
  185. var shared = createCommonjsModule(function (module) {
  186. (module.exports = function (key, value) {
  187. return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {});
  188. })('versions', []).push({
  189. version: '3.9.1',
  190. mode: 'global',
  191. copyright: '© 2021 Denis Pushkarev (zloirock.ru)'
  192. });
  193. });
  194. var id = 0;
  195. var postfix = Math.random();
  196. var uid = function (key) {
  197. return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);
  198. };
  199. var keys = shared('keys');
  200. var sharedKey = function (key) {
  201. return keys[key] || (keys[key] = uid(key));
  202. };
  203. var hiddenKeys$1 = {};
  204. var WeakMap = global_1.WeakMap;
  205. var set, get, has;
  206. var enforce = function (it) {
  207. return has(it) ? get(it) : set(it, {});
  208. };
  209. var getterFor = function (TYPE) {
  210. return function (it) {
  211. var state;
  212. if (!isObject(it) || (state = get(it)).type !== TYPE) {
  213. throw TypeError('Incompatible receiver, ' + TYPE + ' required');
  214. } return state;
  215. };
  216. };
  217. if (nativeWeakMap) {
  218. var store = sharedStore.state || (sharedStore.state = new WeakMap());
  219. var wmget = store.get;
  220. var wmhas = store.has;
  221. var wmset = store.set;
  222. set = function (it, metadata) {
  223. metadata.facade = it;
  224. wmset.call(store, it, metadata);
  225. return metadata;
  226. };
  227. get = function (it) {
  228. return wmget.call(store, it) || {};
  229. };
  230. has = function (it) {
  231. return wmhas.call(store, it);
  232. };
  233. } else {
  234. var STATE = sharedKey('state');
  235. hiddenKeys$1[STATE] = true;
  236. set = function (it, metadata) {
  237. metadata.facade = it;
  238. createNonEnumerableProperty(it, STATE, metadata);
  239. return metadata;
  240. };
  241. get = function (it) {
  242. return has$1(it, STATE) ? it[STATE] : {};
  243. };
  244. has = function (it) {
  245. return has$1(it, STATE);
  246. };
  247. }
  248. var internalState = {
  249. set: set,
  250. get: get,
  251. has: has,
  252. enforce: enforce,
  253. getterFor: getterFor
  254. };
  255. var redefine = createCommonjsModule(function (module) {
  256. var getInternalState = internalState.get;
  257. var enforceInternalState = internalState.enforce;
  258. var TEMPLATE = String(String).split('String');
  259. (module.exports = function (O, key, value, options) {
  260. var unsafe = options ? !!options.unsafe : false;
  261. var simple = options ? !!options.enumerable : false;
  262. var noTargetGet = options ? !!options.noTargetGet : false;
  263. var state;
  264. if (typeof value == 'function') {
  265. if (typeof key == 'string' && !has$1(value, 'name')) {
  266. createNonEnumerableProperty(value, 'name', key);
  267. }
  268. state = enforceInternalState(value);
  269. if (!state.source) {
  270. state.source = TEMPLATE.join(typeof key == 'string' ? key : '');
  271. }
  272. }
  273. if (O === global_1) {
  274. if (simple) O[key] = value;
  275. else setGlobal(key, value);
  276. return;
  277. } else if (!unsafe) {
  278. delete O[key];
  279. } else if (!noTargetGet && O[key]) {
  280. simple = true;
  281. }
  282. if (simple) O[key] = value;
  283. else createNonEnumerableProperty(O, key, value);
  284. // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
  285. })(Function.prototype, 'toString', function toString() {
  286. return typeof this == 'function' && getInternalState(this).source || inspectSource(this);
  287. });
  288. });
  289. var path = global_1;
  290. var aFunction$1 = function (variable) {
  291. return typeof variable == 'function' ? variable : undefined;
  292. };
  293. var getBuiltIn = function (namespace, method) {
  294. return arguments.length < 2 ? aFunction$1(path[namespace]) || aFunction$1(global_1[namespace])
  295. : path[namespace] && path[namespace][method] || global_1[namespace] && global_1[namespace][method];
  296. };
  297. var ceil = Math.ceil;
  298. var floor$1 = Math.floor;
  299. // `ToInteger` abstract operation
  300. // https://tc39.es/ecma262/#sec-tointeger
  301. var toInteger = function (argument) {
  302. return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor$1 : ceil)(argument);
  303. };
  304. var min$3 = Math.min;
  305. // `ToLength` abstract operation
  306. // https://tc39.es/ecma262/#sec-tolength
  307. var toLength = function (argument) {
  308. return argument > 0 ? min$3(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
  309. };
  310. var max$1 = Math.max;
  311. var min$2 = Math.min;
  312. // Helper for a popular repeating case of the spec:
  313. // Let integer be ? ToInteger(index).
  314. // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
  315. var toAbsoluteIndex = function (index, length) {
  316. var integer = toInteger(index);
  317. return integer < 0 ? max$1(integer + length, 0) : min$2(integer, length);
  318. };
  319. // `Array.prototype.{ indexOf, includes }` methods implementation
  320. var createMethod$3 = function (IS_INCLUDES) {
  321. return function ($this, el, fromIndex) {
  322. var O = toIndexedObject($this);
  323. var length = toLength(O.length);
  324. var index = toAbsoluteIndex(fromIndex, length);
  325. var value;
  326. // Array#includes uses SameValueZero equality algorithm
  327. // eslint-disable-next-line no-self-compare -- NaN check
  328. if (IS_INCLUDES && el != el) while (length > index) {
  329. value = O[index++];
  330. // eslint-disable-next-line no-self-compare -- NaN check
  331. if (value != value) return true;
  332. // Array#indexOf ignores holes, Array#includes - not
  333. } else for (;length > index; index++) {
  334. if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
  335. } return !IS_INCLUDES && -1;
  336. };
  337. };
  338. var arrayIncludes = {
  339. // `Array.prototype.includes` method
  340. // https://tc39.es/ecma262/#sec-array.prototype.includes
  341. includes: createMethod$3(true),
  342. // `Array.prototype.indexOf` method
  343. // https://tc39.es/ecma262/#sec-array.prototype.indexof
  344. indexOf: createMethod$3(false)
  345. };
  346. var indexOf = arrayIncludes.indexOf;
  347. var objectKeysInternal = function (object, names) {
  348. var O = toIndexedObject(object);
  349. var i = 0;
  350. var result = [];
  351. var key;
  352. for (key in O) !has$1(hiddenKeys$1, key) && has$1(O, key) && result.push(key);
  353. // Don't enum bug & hidden keys
  354. while (names.length > i) if (has$1(O, key = names[i++])) {
  355. ~indexOf(result, key) || result.push(key);
  356. }
  357. return result;
  358. };
  359. // IE8- don't enum bug keys
  360. var enumBugKeys = [
  361. 'constructor',
  362. 'hasOwnProperty',
  363. 'isPrototypeOf',
  364. 'propertyIsEnumerable',
  365. 'toLocaleString',
  366. 'toString',
  367. 'valueOf'
  368. ];
  369. var hiddenKeys = enumBugKeys.concat('length', 'prototype');
  370. // `Object.getOwnPropertyNames` method
  371. // https://tc39.es/ecma262/#sec-object.getownpropertynames
  372. var f$1 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
  373. return objectKeysInternal(O, hiddenKeys);
  374. };
  375. var objectGetOwnPropertyNames = {
  376. f: f$1
  377. };
  378. var f = Object.getOwnPropertySymbols;
  379. var objectGetOwnPropertySymbols = {
  380. f: f
  381. };
  382. // all object keys, includes non-enumerable and symbols
  383. var ownKeys = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
  384. var keys = objectGetOwnPropertyNames.f(anObject(it));
  385. var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
  386. return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
  387. };
  388. var copyConstructorProperties = function (target, source) {
  389. var keys = ownKeys(source);
  390. var defineProperty = objectDefineProperty.f;
  391. var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
  392. for (var i = 0; i < keys.length; i++) {
  393. var key = keys[i];
  394. if (!has$1(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
  395. }
  396. };
  397. var replacement = /#|\.prototype\./;
  398. var isForced = function (feature, detection) {
  399. var value = data[normalize(feature)];
  400. return value == POLYFILL ? true
  401. : value == NATIVE ? false
  402. : typeof detection == 'function' ? fails(detection)
  403. : !!detection;
  404. };
  405. var normalize = isForced.normalize = function (string) {
  406. return String(string).replace(replacement, '.').toLowerCase();
  407. };
  408. var data = isForced.data = {};
  409. var NATIVE = isForced.NATIVE = 'N';
  410. var POLYFILL = isForced.POLYFILL = 'P';
  411. var isForced_1 = isForced;
  412. var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
  413. /*
  414. options.target - name of the target object
  415. options.global - target is the global object
  416. options.stat - export as static methods of target
  417. options.proto - export as prototype methods of target
  418. options.real - real prototype method for the `pure` version
  419. options.forced - export even if the native feature is available
  420. options.bind - bind methods to the target, required for the `pure` version
  421. options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
  422. options.unsafe - use the simple assignment of property instead of delete + defineProperty
  423. options.sham - add a flag to not completely full polyfills
  424. options.enumerable - export as enumerable property
  425. options.noTargetGet - prevent calling a getter on target
  426. */
  427. var _export = function (options, source) {
  428. var TARGET = options.target;
  429. var GLOBAL = options.global;
  430. var STATIC = options.stat;
  431. var FORCED, target, key, targetProperty, sourceProperty, descriptor;
  432. if (GLOBAL) {
  433. target = global_1;
  434. } else if (STATIC) {
  435. target = global_1[TARGET] || setGlobal(TARGET, {});
  436. } else {
  437. target = (global_1[TARGET] || {}).prototype;
  438. }
  439. if (target) for (key in source) {
  440. sourceProperty = source[key];
  441. if (options.noTargetGet) {
  442. descriptor = getOwnPropertyDescriptor(target, key);
  443. targetProperty = descriptor && descriptor.value;
  444. } else targetProperty = target[key];
  445. FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
  446. // contained in target
  447. if (!FORCED && targetProperty !== undefined) {
  448. if (typeof sourceProperty === typeof targetProperty) continue;
  449. copyConstructorProperties(sourceProperty, targetProperty);
  450. }
  451. // add a flag to not completely full polyfills
  452. if (options.sham || (targetProperty && targetProperty.sham)) {
  453. createNonEnumerableProperty(sourceProperty, 'sham', true);
  454. }
  455. // extend global
  456. redefine(target, key, sourceProperty, options);
  457. }
  458. };
  459. var aFunction = function (it) {
  460. if (typeof it != 'function') {
  461. throw TypeError(String(it) + ' is not a function');
  462. } return it;
  463. };
  464. // optional / simple context binding
  465. var functionBindContext = function (fn, that, length) {
  466. aFunction(fn);
  467. if (that === undefined) return fn;
  468. switch (length) {
  469. case 0: return function () {
  470. return fn.call(that);
  471. };
  472. case 1: return function (a) {
  473. return fn.call(that, a);
  474. };
  475. case 2: return function (a, b) {
  476. return fn.call(that, a, b);
  477. };
  478. case 3: return function (a, b, c) {
  479. return fn.call(that, a, b, c);
  480. };
  481. }
  482. return function (/* ...args */) {
  483. return fn.apply(that, arguments);
  484. };
  485. };
  486. // `ToObject` abstract operation
  487. // https://tc39.es/ecma262/#sec-toobject
  488. var toObject = function (argument) {
  489. return Object(requireObjectCoercible(argument));
  490. };
  491. // `IsArray` abstract operation
  492. // https://tc39.es/ecma262/#sec-isarray
  493. var isArray = Array.isArray || function isArray(arg) {
  494. return classofRaw(arg) == 'Array';
  495. };
  496. var engineIsNode = classofRaw(global_1.process) == 'process';
  497. var engineUserAgent = getBuiltIn('navigator', 'userAgent') || '';
  498. var process = global_1.process;
  499. var versions = process && process.versions;
  500. var v8 = versions && versions.v8;
  501. var match, version;
  502. if (v8) {
  503. match = v8.split('.');
  504. version = match[0] + match[1];
  505. } else if (engineUserAgent) {
  506. match = engineUserAgent.match(/Edge\/(\d+)/);
  507. if (!match || match[1] >= 74) {
  508. match = engineUserAgent.match(/Chrome\/(\d+)/);
  509. if (match) version = match[1];
  510. }
  511. }
  512. var engineV8Version = version && +version;
  513. var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () {
  514. /* global Symbol -- required for testing */
  515. return !Symbol.sham &&
  516. // Chrome 38 Symbol has incorrect toString conversion
  517. // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
  518. (engineIsNode ? engineV8Version === 38 : engineV8Version > 37 && engineV8Version < 41);
  519. });
  520. var useSymbolAsUid = nativeSymbol
  521. /* global Symbol -- safe */
  522. && !Symbol.sham
  523. && typeof Symbol.iterator == 'symbol';
  524. var WellKnownSymbolsStore = shared('wks');
  525. var Symbol$1 = global_1.Symbol;
  526. var createWellKnownSymbol = useSymbolAsUid ? Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid;
  527. var wellKnownSymbol = function (name) {
  528. if (!has$1(WellKnownSymbolsStore, name) || !(nativeSymbol || typeof WellKnownSymbolsStore[name] == 'string')) {
  529. if (nativeSymbol && has$1(Symbol$1, name)) {
  530. WellKnownSymbolsStore[name] = Symbol$1[name];
  531. } else {
  532. WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name);
  533. }
  534. } return WellKnownSymbolsStore[name];
  535. };
  536. var SPECIES$3 = wellKnownSymbol('species');
  537. // `ArraySpeciesCreate` abstract operation
  538. // https://tc39.es/ecma262/#sec-arrayspeciescreate
  539. var arraySpeciesCreate = function (originalArray, length) {
  540. var C;
  541. if (isArray(originalArray)) {
  542. C = originalArray.constructor;
  543. // cross-realm fallback
  544. if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;
  545. else if (isObject(C)) {
  546. C = C[SPECIES$3];
  547. if (C === null) C = undefined;
  548. }
  549. } return new (C === undefined ? Array : C)(length === 0 ? 0 : length);
  550. };
  551. var push = [].push;
  552. // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterOut }` methods implementation
  553. var createMethod$2 = function (TYPE) {
  554. var IS_MAP = TYPE == 1;
  555. var IS_FILTER = TYPE == 2;
  556. var IS_SOME = TYPE == 3;
  557. var IS_EVERY = TYPE == 4;
  558. var IS_FIND_INDEX = TYPE == 6;
  559. var IS_FILTER_OUT = TYPE == 7;
  560. var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
  561. return function ($this, callbackfn, that, specificCreate) {
  562. var O = toObject($this);
  563. var self = indexedObject(O);
  564. var boundFunction = functionBindContext(callbackfn, that, 3);
  565. var length = toLength(self.length);
  566. var index = 0;
  567. var create = specificCreate || arraySpeciesCreate;
  568. var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_OUT ? create($this, 0) : undefined;
  569. var value, result;
  570. for (;length > index; index++) if (NO_HOLES || index in self) {
  571. value = self[index];
  572. result = boundFunction(value, index, O);
  573. if (TYPE) {
  574. if (IS_MAP) target[index] = result; // map
  575. else if (result) switch (TYPE) {
  576. case 3: return true; // some
  577. case 5: return value; // find
  578. case 6: return index; // findIndex
  579. case 2: push.call(target, value); // filter
  580. } else switch (TYPE) {
  581. case 4: return false; // every
  582. case 7: push.call(target, value); // filterOut
  583. }
  584. }
  585. }
  586. return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
  587. };
  588. };
  589. var arrayIteration = {
  590. // `Array.prototype.forEach` method
  591. // https://tc39.es/ecma262/#sec-array.prototype.foreach
  592. forEach: createMethod$2(0),
  593. // `Array.prototype.map` method
  594. // https://tc39.es/ecma262/#sec-array.prototype.map
  595. map: createMethod$2(1),
  596. // `Array.prototype.filter` method
  597. // https://tc39.es/ecma262/#sec-array.prototype.filter
  598. filter: createMethod$2(2),
  599. // `Array.prototype.some` method
  600. // https://tc39.es/ecma262/#sec-array.prototype.some
  601. some: createMethod$2(3),
  602. // `Array.prototype.every` method
  603. // https://tc39.es/ecma262/#sec-array.prototype.every
  604. every: createMethod$2(4),
  605. // `Array.prototype.find` method
  606. // https://tc39.es/ecma262/#sec-array.prototype.find
  607. find: createMethod$2(5),
  608. // `Array.prototype.findIndex` method
  609. // https://tc39.es/ecma262/#sec-array.prototype.findIndex
  610. findIndex: createMethod$2(6),
  611. // `Array.prototype.filterOut` method
  612. // https://github.com/tc39/proposal-array-filtering
  613. filterOut: createMethod$2(7)
  614. };
  615. // `Object.keys` method
  616. // https://tc39.es/ecma262/#sec-object.keys
  617. var objectKeys = Object.keys || function keys(O) {
  618. return objectKeysInternal(O, enumBugKeys);
  619. };
  620. // `Object.defineProperties` method
  621. // https://tc39.es/ecma262/#sec-object.defineproperties
  622. var objectDefineProperties = descriptors ? Object.defineProperties : function defineProperties(O, Properties) {
  623. anObject(O);
  624. var keys = objectKeys(Properties);
  625. var length = keys.length;
  626. var index = 0;
  627. var key;
  628. while (length > index) objectDefineProperty.f(O, key = keys[index++], Properties[key]);
  629. return O;
  630. };
  631. var html = getBuiltIn('document', 'documentElement');
  632. var GT = '>';
  633. var LT = '<';
  634. var PROTOTYPE = 'prototype';
  635. var SCRIPT = 'script';
  636. var IE_PROTO = sharedKey('IE_PROTO');
  637. var EmptyConstructor = function () { /* empty */ };
  638. var scriptTag = function (content) {
  639. return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
  640. };
  641. // Create object with fake `null` prototype: use ActiveX Object with cleared prototype
  642. var NullProtoObjectViaActiveX = function (activeXDocument) {
  643. activeXDocument.write(scriptTag(''));
  644. activeXDocument.close();
  645. var temp = activeXDocument.parentWindow.Object;
  646. activeXDocument = null; // avoid memory leak
  647. return temp;
  648. };
  649. // Create object with fake `null` prototype: use iframe Object with cleared prototype
  650. var NullProtoObjectViaIFrame = function () {
  651. // Thrash, waste and sodomy: IE GC bug
  652. var iframe = documentCreateElement('iframe');
  653. var JS = 'java' + SCRIPT + ':';
  654. var iframeDocument;
  655. iframe.style.display = 'none';
  656. html.appendChild(iframe);
  657. // https://github.com/zloirock/core-js/issues/475
  658. iframe.src = String(JS);
  659. iframeDocument = iframe.contentWindow.document;
  660. iframeDocument.open();
  661. iframeDocument.write(scriptTag('document.F=Object'));
  662. iframeDocument.close();
  663. return iframeDocument.F;
  664. };
  665. // Check for document.domain and active x support
  666. // No need to use active x approach when document.domain is not set
  667. // see https://github.com/es-shims/es5-shim/issues/150
  668. // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
  669. // avoid IE GC bug
  670. var activeXDocument;
  671. var NullProtoObject = function () {
  672. try {
  673. /* global ActiveXObject -- old IE */
  674. activeXDocument = document.domain && new ActiveXObject('htmlfile');
  675. } catch (error) { /* ignore */ }
  676. NullProtoObject = activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame();
  677. var length = enumBugKeys.length;
  678. while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
  679. return NullProtoObject();
  680. };
  681. hiddenKeys$1[IE_PROTO] = true;
  682. // `Object.create` method
  683. // https://tc39.es/ecma262/#sec-object.create
  684. var objectCreate = Object.create || function create(O, Properties) {
  685. var result;
  686. if (O !== null) {
  687. EmptyConstructor[PROTOTYPE] = anObject(O);
  688. result = new EmptyConstructor();
  689. EmptyConstructor[PROTOTYPE] = null;
  690. // add "__proto__" for Object.getPrototypeOf polyfill
  691. result[IE_PROTO] = O;
  692. } else result = NullProtoObject();
  693. return Properties === undefined ? result : objectDefineProperties(result, Properties);
  694. };
  695. var UNSCOPABLES = wellKnownSymbol('unscopables');
  696. var ArrayPrototype = Array.prototype;
  697. // Array.prototype[@@unscopables]
  698. // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
  699. if (ArrayPrototype[UNSCOPABLES] == undefined) {
  700. objectDefineProperty.f(ArrayPrototype, UNSCOPABLES, {
  701. configurable: true,
  702. value: objectCreate(null)
  703. });
  704. }
  705. // add a key to Array.prototype[@@unscopables]
  706. var addToUnscopables = function (key) {
  707. ArrayPrototype[UNSCOPABLES][key] = true;
  708. };
  709. var $find = arrayIteration.find;
  710. var FIND = 'find';
  711. var SKIPS_HOLES = true;
  712. // Shouldn't skip holes
  713. if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });
  714. // `Array.prototype.find` method
  715. // https://tc39.es/ecma262/#sec-array.prototype.find
  716. _export({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
  717. find: function find(callbackfn /* , that = undefined */) {
  718. return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  719. }
  720. });
  721. // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
  722. addToUnscopables(FIND);
  723. var TO_STRING_TAG$1 = wellKnownSymbol('toStringTag');
  724. var test$1 = {};
  725. test$1[TO_STRING_TAG$1] = 'z';
  726. var toStringTagSupport = String(test$1) === '[object z]';
  727. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  728. // ES3 wrong here
  729. var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
  730. // fallback for IE11 Script Access Denied error
  731. var tryGet = function (it, key) {
  732. try {
  733. return it[key];
  734. } catch (error) { /* empty */ }
  735. };
  736. // getting tag from ES6+ `Object.prototype.toString`
  737. var classof = toStringTagSupport ? classofRaw : function (it) {
  738. var O, tag, result;
  739. return it === undefined ? 'Undefined' : it === null ? 'Null'
  740. // @@toStringTag case
  741. : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG)) == 'string' ? tag
  742. // builtinTag case
  743. : CORRECT_ARGUMENTS ? classofRaw(O)
  744. // ES3 arguments fallback
  745. : (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result;
  746. };
  747. // `Object.prototype.toString` method implementation
  748. // https://tc39.es/ecma262/#sec-object.prototype.tostring
  749. var objectToString = toStringTagSupport ? {}.toString : function toString() {
  750. return '[object ' + classof(this) + ']';
  751. };
  752. // `Object.prototype.toString` method
  753. // https://tc39.es/ecma262/#sec-object.prototype.tostring
  754. if (!toStringTagSupport) {
  755. redefine(Object.prototype, 'toString', objectToString, { unsafe: true });
  756. }
  757. // `RegExp.prototype.flags` getter implementation
  758. // https://tc39.es/ecma262/#sec-get-regexp.prototype.flags
  759. var regexpFlags = function () {
  760. var that = anObject(this);
  761. var result = '';
  762. if (that.global) result += 'g';
  763. if (that.ignoreCase) result += 'i';
  764. if (that.multiline) result += 'm';
  765. if (that.dotAll) result += 's';
  766. if (that.unicode) result += 'u';
  767. if (that.sticky) result += 'y';
  768. return result;
  769. };
  770. var TO_STRING = 'toString';
  771. var RegExpPrototype = RegExp.prototype;
  772. var nativeToString = RegExpPrototype[TO_STRING];
  773. var NOT_GENERIC = fails(function () { return nativeToString.call({ source: 'a', flags: 'b' }) != '/a/b'; });
  774. // FF44- RegExp#toString has a wrong name
  775. var INCORRECT_NAME = nativeToString.name != TO_STRING;
  776. // `RegExp.prototype.toString` method
  777. // https://tc39.es/ecma262/#sec-regexp.prototype.tostring
  778. if (NOT_GENERIC || INCORRECT_NAME) {
  779. redefine(RegExp.prototype, TO_STRING, function toString() {
  780. var R = anObject(this);
  781. var p = String(R.source);
  782. var rf = R.flags;
  783. var f = String(rf === undefined && R instanceof RegExp && !('flags' in RegExpPrototype) ? regexpFlags.call(R) : rf);
  784. return '/' + p + '/' + f;
  785. }, { unsafe: true });
  786. }
  787. // a string of all valid unicode whitespaces
  788. var whitespaces = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' +
  789. '\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
  790. var whitespace = '[' + whitespaces + ']';
  791. var ltrim = RegExp('^' + whitespace + whitespace + '*');
  792. var rtrim = RegExp(whitespace + whitespace + '*$');
  793. // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
  794. var createMethod$1 = function (TYPE) {
  795. return function ($this) {
  796. var string = String(requireObjectCoercible($this));
  797. if (TYPE & 1) string = string.replace(ltrim, '');
  798. if (TYPE & 2) string = string.replace(rtrim, '');
  799. return string;
  800. };
  801. };
  802. var stringTrim = {
  803. // `String.prototype.{ trimLeft, trimStart }` methods
  804. // https://tc39.es/ecma262/#sec-string.prototype.trimstart
  805. start: createMethod$1(1),
  806. // `String.prototype.{ trimRight, trimEnd }` methods
  807. // https://tc39.es/ecma262/#sec-string.prototype.trimend
  808. end: createMethod$1(2),
  809. // `String.prototype.trim` method
  810. // https://tc39.es/ecma262/#sec-string.prototype.trim
  811. trim: createMethod$1(3)
  812. };
  813. var non = '\u200B\u0085\u180E';
  814. // check that a method works with the correct list
  815. // of whitespaces and has a correct name
  816. var stringTrimForced = function (METHOD_NAME) {
  817. return fails(function () {
  818. return !!whitespaces[METHOD_NAME]() || non[METHOD_NAME]() != non || whitespaces[METHOD_NAME].name !== METHOD_NAME;
  819. });
  820. };
  821. var $trim = stringTrim.trim;
  822. // `String.prototype.trim` method
  823. // https://tc39.es/ecma262/#sec-string.prototype.trim
  824. _export({ target: 'String', proto: true, forced: stringTrimForced('trim') }, {
  825. trim: function trim() {
  826. return $trim(this);
  827. }
  828. });
  829. var createProperty = function (object, key, value) {
  830. var propertyKey = toPrimitive(key);
  831. if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value));
  832. else object[propertyKey] = value;
  833. };
  834. var SPECIES$2 = wellKnownSymbol('species');
  835. var arrayMethodHasSpeciesSupport = function (METHOD_NAME) {
  836. // We can't use this feature detection in V8 since it causes
  837. // deoptimization and serious performance degradation
  838. // https://github.com/zloirock/core-js/issues/677
  839. return engineV8Version >= 51 || !fails(function () {
  840. var array = [];
  841. var constructor = array.constructor = {};
  842. constructor[SPECIES$2] = function () {
  843. return { foo: 1 };
  844. };
  845. return array[METHOD_NAME](Boolean).foo !== 1;
  846. });
  847. };
  848. var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
  849. var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
  850. var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';
  851. // We can't use this feature detection in V8 since it causes
  852. // deoptimization and serious performance degradation
  853. // https://github.com/zloirock/core-js/issues/679
  854. var IS_CONCAT_SPREADABLE_SUPPORT = engineV8Version >= 51 || !fails(function () {
  855. var array = [];
  856. array[IS_CONCAT_SPREADABLE] = false;
  857. return array.concat()[0] !== array;
  858. });
  859. var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
  860. var isConcatSpreadable = function (O) {
  861. if (!isObject(O)) return false;
  862. var spreadable = O[IS_CONCAT_SPREADABLE];
  863. return spreadable !== undefined ? !!spreadable : isArray(O);
  864. };
  865. var FORCED$1 = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
  866. // `Array.prototype.concat` method
  867. // https://tc39.es/ecma262/#sec-array.prototype.concat
  868. // with adding support of @@isConcatSpreadable and @@species
  869. _export({ target: 'Array', proto: true, forced: FORCED$1 }, {
  870. // eslint-disable-next-line no-unused-vars -- required for `.length`
  871. concat: function concat(arg) {
  872. var O = toObject(this);
  873. var A = arraySpeciesCreate(O, 0);
  874. var n = 0;
  875. var i, k, length, len, E;
  876. for (i = -1, length = arguments.length; i < length; i++) {
  877. E = i === -1 ? O : arguments[i];
  878. if (isConcatSpreadable(E)) {
  879. len = toLength(E.length);
  880. if (n + len > MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
  881. for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
  882. } else {
  883. if (n >= MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
  884. createProperty(A, n++, E);
  885. }
  886. }
  887. A.length = n;
  888. return A;
  889. }
  890. });
  891. var arrayMethodIsStrict = function (METHOD_NAME, argument) {
  892. var method = [][METHOD_NAME];
  893. return !!method && fails(function () {
  894. // eslint-disable-next-line no-useless-call,no-throw-literal -- required for testing
  895. method.call(null, argument || function () { throw 1; }, 1);
  896. });
  897. };
  898. var test = [];
  899. var nativeSort = test.sort;
  900. // IE8-
  901. var FAILS_ON_UNDEFINED = fails(function () {
  902. test.sort(undefined);
  903. });
  904. // V8 bug
  905. var FAILS_ON_NULL = fails(function () {
  906. test.sort(null);
  907. });
  908. // Old WebKit
  909. var STRICT_METHOD$3 = arrayMethodIsStrict('sort');
  910. var FORCED = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD$3;
  911. // `Array.prototype.sort` method
  912. // https://tc39.es/ecma262/#sec-array.prototype.sort
  913. _export({ target: 'Array', proto: true, forced: FORCED }, {
  914. sort: function sort(comparefn) {
  915. return comparefn === undefined
  916. ? nativeSort.call(toObject(this))
  917. : nativeSort.call(toObject(this), aFunction(comparefn));
  918. }
  919. });
  920. // babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError,
  921. // so we use an intermediate function.
  922. function RE(s, f) {
  923. return RegExp(s, f);
  924. }
  925. var UNSUPPORTED_Y$1 = fails(function () {
  926. // babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError
  927. var re = RE('a', 'y');
  928. re.lastIndex = 2;
  929. return re.exec('abcd') != null;
  930. });
  931. var BROKEN_CARET = fails(function () {
  932. // https://bugzilla.mozilla.org/show_bug.cgi?id=773687
  933. var re = RE('^r', 'gy');
  934. re.lastIndex = 2;
  935. return re.exec('str') != null;
  936. });
  937. var regexpStickyHelpers = {
  938. UNSUPPORTED_Y: UNSUPPORTED_Y$1,
  939. BROKEN_CARET: BROKEN_CARET
  940. };
  941. var nativeExec = RegExp.prototype.exec;
  942. // This always refers to the native implementation, because the
  943. // String#replace polyfill uses ./fix-regexp-well-known-symbol-logic.js,
  944. // which loads this file before patching the method.
  945. var nativeReplace = String.prototype.replace;
  946. var patchedExec = nativeExec;
  947. var UPDATES_LAST_INDEX_WRONG = (function () {
  948. var re1 = /a/;
  949. var re2 = /b*/g;
  950. nativeExec.call(re1, 'a');
  951. nativeExec.call(re2, 'a');
  952. return re1.lastIndex !== 0 || re2.lastIndex !== 0;
  953. })();
  954. var UNSUPPORTED_Y = regexpStickyHelpers.UNSUPPORTED_Y || regexpStickyHelpers.BROKEN_CARET;
  955. // nonparticipating capturing group, copied from es5-shim's String#split patch.
  956. // eslint-disable-next-line regexp/no-assertion-capturing-group, regexp/no-empty-group -- required for testing
  957. var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
  958. var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y;
  959. if (PATCH) {
  960. patchedExec = function exec(str) {
  961. var re = this;
  962. var lastIndex, reCopy, match, i;
  963. var sticky = UNSUPPORTED_Y && re.sticky;
  964. var flags = regexpFlags.call(re);
  965. var source = re.source;
  966. var charsAdded = 0;
  967. var strCopy = str;
  968. if (sticky) {
  969. flags = flags.replace('y', '');
  970. if (flags.indexOf('g') === -1) {
  971. flags += 'g';
  972. }
  973. strCopy = String(str).slice(re.lastIndex);
  974. // Support anchored sticky behavior.
  975. if (re.lastIndex > 0 && (!re.multiline || re.multiline && str[re.lastIndex - 1] !== '\n')) {
  976. source = '(?: ' + source + ')';
  977. strCopy = ' ' + strCopy;
  978. charsAdded++;
  979. }
  980. // ^(? + rx + ) is needed, in combination with some str slicing, to
  981. // simulate the 'y' flag.
  982. reCopy = new RegExp('^(?:' + source + ')', flags);
  983. }
  984. if (NPCG_INCLUDED) {
  985. reCopy = new RegExp('^' + source + '$(?!\\s)', flags);
  986. }
  987. if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;
  988. match = nativeExec.call(sticky ? reCopy : re, strCopy);
  989. if (sticky) {
  990. if (match) {
  991. match.input = match.input.slice(charsAdded);
  992. match[0] = match[0].slice(charsAdded);
  993. match.index = re.lastIndex;
  994. re.lastIndex += match[0].length;
  995. } else re.lastIndex = 0;
  996. } else if (UPDATES_LAST_INDEX_WRONG && match) {
  997. re.lastIndex = re.global ? match.index + match[0].length : lastIndex;
  998. }
  999. if (NPCG_INCLUDED && match && match.length > 1) {
  1000. // Fix browsers whose `exec` methods don't consistently return `undefined`
  1001. // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/
  1002. nativeReplace.call(match[0], reCopy, function () {
  1003. for (i = 1; i < arguments.length - 2; i++) {
  1004. if (arguments[i] === undefined) match[i] = undefined;
  1005. }
  1006. });
  1007. }
  1008. return match;
  1009. };
  1010. }
  1011. var regexpExec = patchedExec;
  1012. // `RegExp.prototype.exec` method
  1013. // https://tc39.es/ecma262/#sec-regexp.prototype.exec
  1014. _export({ target: 'RegExp', proto: true, forced: /./.exec !== regexpExec }, {
  1015. exec: regexpExec
  1016. });
  1017. // TODO: Remove from `core-js@4` since it's moved to entry points
  1018. var SPECIES$1 = wellKnownSymbol('species');
  1019. var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () {
  1020. // #replace needs built-in support for named groups.
  1021. // #match works fine because it just return the exec results, even if it has
  1022. // a "grops" property.
  1023. var re = /./;
  1024. re.exec = function () {
  1025. var result = [];
  1026. result.groups = { a: '7' };
  1027. return result;
  1028. };
  1029. return ''.replace(re, '$<a>') !== '7';
  1030. });
  1031. // IE <= 11 replaces $0 with the whole match, as if it was $&
  1032. // https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0
  1033. var REPLACE_KEEPS_$0 = (function () {
  1034. return 'a'.replace(/./, '$0') === '$0';
  1035. })();
  1036. var REPLACE = wellKnownSymbol('replace');
  1037. // Safari <= 13.0.3(?) substitutes nth capture where n>m with an empty string
  1038. var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () {
  1039. if (/./[REPLACE]) {
  1040. return /./[REPLACE]('a', '$0') === '';
  1041. }
  1042. return false;
  1043. })();
  1044. // Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec
  1045. // Weex JS has frozen built-in prototypes, so use try / catch wrapper
  1046. var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () {
  1047. // eslint-disable-next-line regexp/no-empty-group -- required for testing
  1048. var re = /(?:)/;
  1049. var originalExec = re.exec;
  1050. re.exec = function () { return originalExec.apply(this, arguments); };
  1051. var result = 'ab'.split(re);
  1052. return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b';
  1053. });
  1054. var fixRegexpWellKnownSymbolLogic = function (KEY, length, exec, sham) {
  1055. var SYMBOL = wellKnownSymbol(KEY);
  1056. var DELEGATES_TO_SYMBOL = !fails(function () {
  1057. // String methods call symbol-named RegEp methods
  1058. var O = {};
  1059. O[SYMBOL] = function () { return 7; };
  1060. return ''[KEY](O) != 7;
  1061. });
  1062. var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails(function () {
  1063. // Symbol-named RegExp methods call .exec
  1064. var execCalled = false;
  1065. var re = /a/;
  1066. if (KEY === 'split') {
  1067. // We can't use real regex here since it causes deoptimization
  1068. // and serious performance degradation in V8
  1069. // https://github.com/zloirock/core-js/issues/306
  1070. re = {};
  1071. // RegExp[@@split] doesn't call the regex's exec method, but first creates
  1072. // a new one. We need to return the patched regex when creating the new one.
  1073. re.constructor = {};
  1074. re.constructor[SPECIES$1] = function () { return re; };
  1075. re.flags = '';
  1076. re[SYMBOL] = /./[SYMBOL];
  1077. }
  1078. re.exec = function () { execCalled = true; return null; };
  1079. re[SYMBOL]('');
  1080. return !execCalled;
  1081. });
  1082. if (
  1083. !DELEGATES_TO_SYMBOL ||
  1084. !DELEGATES_TO_EXEC ||
  1085. (KEY === 'replace' && !(
  1086. REPLACE_SUPPORTS_NAMED_GROUPS &&
  1087. REPLACE_KEEPS_$0 &&
  1088. !REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE
  1089. )) ||
  1090. (KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC)
  1091. ) {
  1092. var nativeRegExpMethod = /./[SYMBOL];
  1093. var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {
  1094. if (regexp.exec === regexpExec) {
  1095. if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
  1096. // The native String method already delegates to @@method (this
  1097. // polyfilled function), leasing to infinite recursion.
  1098. // We avoid it by directly calling the native @@method method.
  1099. return { done: true, value: nativeRegExpMethod.call(regexp, str, arg2) };
  1100. }
  1101. return { done: true, value: nativeMethod.call(str, regexp, arg2) };
  1102. }
  1103. return { done: false };
  1104. }, {
  1105. REPLACE_KEEPS_$0: REPLACE_KEEPS_$0,
  1106. REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE: REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE
  1107. });
  1108. var stringMethod = methods[0];
  1109. var regexMethod = methods[1];
  1110. redefine(String.prototype, KEY, stringMethod);
  1111. redefine(RegExp.prototype, SYMBOL, length == 2
  1112. // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue)
  1113. // 21.2.5.11 RegExp.prototype[@@split](string, limit)
  1114. ? function (string, arg) { return regexMethod.call(string, this, arg); }
  1115. // 21.2.5.6 RegExp.prototype[@@match](string)
  1116. // 21.2.5.9 RegExp.prototype[@@search](string)
  1117. : function (string) { return regexMethod.call(string, this); }
  1118. );
  1119. }
  1120. if (sham) createNonEnumerableProperty(RegExp.prototype[SYMBOL], 'sham', true);
  1121. };
  1122. // `String.prototype.{ codePointAt, at }` methods implementation
  1123. var createMethod = function (CONVERT_TO_STRING) {
  1124. return function ($this, pos) {
  1125. var S = String(requireObjectCoercible($this));
  1126. var position = toInteger(pos);
  1127. var size = S.length;
  1128. var first, second;
  1129. if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
  1130. first = S.charCodeAt(position);
  1131. return first < 0xD800 || first > 0xDBFF || position + 1 === size
  1132. || (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF
  1133. ? CONVERT_TO_STRING ? S.charAt(position) : first
  1134. : CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
  1135. };
  1136. };
  1137. var stringMultibyte = {
  1138. // `String.prototype.codePointAt` method
  1139. // https://tc39.es/ecma262/#sec-string.prototype.codepointat
  1140. codeAt: createMethod(false),
  1141. // `String.prototype.at` method
  1142. // https://github.com/mathiasbynens/String.prototype.at
  1143. charAt: createMethod(true)
  1144. };
  1145. var charAt = stringMultibyte.charAt;
  1146. // `AdvanceStringIndex` abstract operation
  1147. // https://tc39.es/ecma262/#sec-advancestringindex
  1148. var advanceStringIndex = function (S, index, unicode) {
  1149. return index + (unicode ? charAt(S, index).length : 1);
  1150. };
  1151. var floor = Math.floor;
  1152. var replace = ''.replace;
  1153. var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d{1,2}|<[^>]*>)/g;
  1154. var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d{1,2})/g;
  1155. // https://tc39.es/ecma262/#sec-getsubstitution
  1156. var getSubstitution = function (matched, str, position, captures, namedCaptures, replacement) {
  1157. var tailPos = position + matched.length;
  1158. var m = captures.length;
  1159. var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
  1160. if (namedCaptures !== undefined) {
  1161. namedCaptures = toObject(namedCaptures);
  1162. symbols = SUBSTITUTION_SYMBOLS;
  1163. }
  1164. return replace.call(replacement, symbols, function (match, ch) {
  1165. var capture;
  1166. switch (ch.charAt(0)) {
  1167. case '$': return '$';
  1168. case '&': return matched;
  1169. case '`': return str.slice(0, position);
  1170. case "'": return str.slice(tailPos);
  1171. case '<':
  1172. capture = namedCaptures[ch.slice(1, -1)];
  1173. break;
  1174. default: // \d\d?
  1175. var n = +ch;
  1176. if (n === 0) return match;
  1177. if (n > m) {
  1178. var f = floor(n / 10);
  1179. if (f === 0) return match;
  1180. if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1);
  1181. return match;
  1182. }
  1183. capture = captures[n - 1];
  1184. }
  1185. return capture === undefined ? '' : capture;
  1186. });
  1187. };
  1188. // `RegExpExec` abstract operation
  1189. // https://tc39.es/ecma262/#sec-regexpexec
  1190. var regexpExecAbstract = function (R, S) {
  1191. var exec = R.exec;
  1192. if (typeof exec === 'function') {
  1193. var result = exec.call(R, S);
  1194. if (typeof result !== 'object') {
  1195. throw TypeError('RegExp exec method returned something other than an Object or null');
  1196. }
  1197. return result;
  1198. }
  1199. if (classofRaw(R) !== 'RegExp') {
  1200. throw TypeError('RegExp#exec called on incompatible receiver');
  1201. }
  1202. return regexpExec.call(R, S);
  1203. };
  1204. var max = Math.max;
  1205. var min$1 = Math.min;
  1206. var maybeToString = function (it) {
  1207. return it === undefined ? it : String(it);
  1208. };
  1209. // @@replace logic
  1210. fixRegexpWellKnownSymbolLogic('replace', 2, function (REPLACE, nativeReplace, maybeCallNative, reason) {
  1211. var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = reason.REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE;
  1212. var REPLACE_KEEPS_$0 = reason.REPLACE_KEEPS_$0;
  1213. var UNSAFE_SUBSTITUTE = REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE ? '$' : '$0';
  1214. return [
  1215. // `String.prototype.replace` method
  1216. // https://tc39.es/ecma262/#sec-string.prototype.replace
  1217. function replace(searchValue, replaceValue) {
  1218. var O = requireObjectCoercible(this);
  1219. var replacer = searchValue == undefined ? undefined : searchValue[REPLACE];
  1220. return replacer !== undefined
  1221. ? replacer.call(searchValue, O, replaceValue)
  1222. : nativeReplace.call(String(O), searchValue, replaceValue);
  1223. },
  1224. // `RegExp.prototype[@@replace]` method
  1225. // https://tc39.es/ecma262/#sec-regexp.prototype-@@replace
  1226. function (regexp, replaceValue) {
  1227. if (
  1228. (!REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE && REPLACE_KEEPS_$0) ||
  1229. (typeof replaceValue === 'string' && replaceValue.indexOf(UNSAFE_SUBSTITUTE) === -1)
  1230. ) {
  1231. var res = maybeCallNative(nativeReplace, regexp, this, replaceValue);
  1232. if (res.done) return res.value;
  1233. }
  1234. var rx = anObject(regexp);
  1235. var S = String(this);
  1236. var functionalReplace = typeof replaceValue === 'function';
  1237. if (!functionalReplace) replaceValue = String(replaceValue);
  1238. var global = rx.global;
  1239. if (global) {
  1240. var fullUnicode = rx.unicode;
  1241. rx.lastIndex = 0;
  1242. }
  1243. var results = [];
  1244. while (true) {
  1245. var result = regexpExecAbstract(rx, S);
  1246. if (result === null) break;
  1247. results.push(result);
  1248. if (!global) break;
  1249. var matchStr = String(result[0]);
  1250. if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
  1251. }
  1252. var accumulatedResult = '';
  1253. var nextSourcePosition = 0;
  1254. for (var i = 0; i < results.length; i++) {
  1255. result = results[i];
  1256. var matched = String(result[0]);
  1257. var position = max(min$1(toInteger(result.index), S.length), 0);
  1258. var captures = [];
  1259. // NOTE: This is equivalent to
  1260. // captures = result.slice(1).map(maybeToString)
  1261. // but for some reason `nativeSlice.call(result, 1, result.length)` (called in
  1262. // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and
  1263. // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.
  1264. for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j]));
  1265. var namedCaptures = result.groups;
  1266. if (functionalReplace) {
  1267. var replacerArgs = [matched].concat(captures, position, S);
  1268. if (namedCaptures !== undefined) replacerArgs.push(namedCaptures);
  1269. var replacement = String(replaceValue.apply(undefined, replacerArgs));
  1270. } else {
  1271. replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
  1272. }
  1273. if (position >= nextSourcePosition) {
  1274. accumulatedResult += S.slice(nextSourcePosition, position) + replacement;
  1275. nextSourcePosition = position + matched.length;
  1276. }
  1277. }
  1278. return accumulatedResult + S.slice(nextSourcePosition);
  1279. }
  1280. ];
  1281. });
  1282. var $filter = arrayIteration.filter;
  1283. var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('filter');
  1284. // `Array.prototype.filter` method
  1285. // https://tc39.es/ecma262/#sec-array.prototype.filter
  1286. // with adding support of @@species
  1287. _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
  1288. filter: function filter(callbackfn /* , thisArg */) {
  1289. return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  1290. }
  1291. });
  1292. // @@match logic
  1293. fixRegexpWellKnownSymbolLogic('match', 1, function (MATCH, nativeMatch, maybeCallNative) {
  1294. return [
  1295. // `String.prototype.match` method
  1296. // https://tc39.es/ecma262/#sec-string.prototype.match
  1297. function match(regexp) {
  1298. var O = requireObjectCoercible(this);
  1299. var matcher = regexp == undefined ? undefined : regexp[MATCH];
  1300. return matcher !== undefined ? matcher.call(regexp, O) : new RegExp(regexp)[MATCH](String(O));
  1301. },
  1302. // `RegExp.prototype[@@match]` method
  1303. // https://tc39.es/ecma262/#sec-regexp.prototype-@@match
  1304. function (regexp) {
  1305. var res = maybeCallNative(nativeMatch, regexp, this);
  1306. if (res.done) return res.value;
  1307. var rx = anObject(regexp);
  1308. var S = String(this);
  1309. if (!rx.global) return regexpExecAbstract(rx, S);
  1310. var fullUnicode = rx.unicode;
  1311. rx.lastIndex = 0;
  1312. var A = [];
  1313. var n = 0;
  1314. var result;
  1315. while ((result = regexpExecAbstract(rx, S)) !== null) {
  1316. var matchStr = String(result[0]);
  1317. A[n] = matchStr;
  1318. if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
  1319. n++;
  1320. }
  1321. return n === 0 ? null : A;
  1322. }
  1323. ];
  1324. });
  1325. var MATCH = wellKnownSymbol('match');
  1326. // `IsRegExp` abstract operation
  1327. // https://tc39.es/ecma262/#sec-isregexp
  1328. var isRegexp = function (it) {
  1329. var isRegExp;
  1330. return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classofRaw(it) == 'RegExp');
  1331. };
  1332. var SPECIES = wellKnownSymbol('species');
  1333. // `SpeciesConstructor` abstract operation
  1334. // https://tc39.es/ecma262/#sec-speciesconstructor
  1335. var speciesConstructor = function (O, defaultConstructor) {
  1336. var C = anObject(O).constructor;
  1337. var S;
  1338. return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? defaultConstructor : aFunction(S);
  1339. };
  1340. var arrayPush = [].push;
  1341. var min = Math.min;
  1342. var MAX_UINT32 = 0xFFFFFFFF;
  1343. // babel-minify transpiles RegExp('x', 'y') -> /x/y and it causes SyntaxError
  1344. var SUPPORTS_Y = !fails(function () { return !RegExp(MAX_UINT32, 'y'); });
  1345. // @@split logic
  1346. fixRegexpWellKnownSymbolLogic('split', 2, function (SPLIT, nativeSplit, maybeCallNative) {
  1347. var internalSplit;
  1348. if (
  1349. 'abbc'.split(/(b)*/)[1] == 'c' ||
  1350. // eslint-disable-next-line regexp/no-empty-group -- required for testing
  1351. 'test'.split(/(?:)/, -1).length != 4 ||
  1352. 'ab'.split(/(?:ab)*/).length != 2 ||
  1353. '.'.split(/(.?)(.?)/).length != 4 ||
  1354. // eslint-disable-next-line regexp/no-assertion-capturing-group, regexp/no-empty-group -- required for testing
  1355. '.'.split(/()()/).length > 1 ||
  1356. ''.split(/.?/).length
  1357. ) {
  1358. // based on es5-shim implementation, need to rework it
  1359. internalSplit = function (separator, limit) {
  1360. var string = String(requireObjectCoercible(this));
  1361. var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
  1362. if (lim === 0) return [];
  1363. if (separator === undefined) return [string];
  1364. // If `separator` is not a regex, use native split
  1365. if (!isRegexp(separator)) {
  1366. return nativeSplit.call(string, separator, lim);
  1367. }
  1368. var output = [];
  1369. var flags = (separator.ignoreCase ? 'i' : '') +
  1370. (separator.multiline ? 'm' : '') +
  1371. (separator.unicode ? 'u' : '') +
  1372. (separator.sticky ? 'y' : '');
  1373. var lastLastIndex = 0;
  1374. // Make `global` and avoid `lastIndex` issues by working with a copy
  1375. var separatorCopy = new RegExp(separator.source, flags + 'g');
  1376. var match, lastIndex, lastLength;
  1377. while (match = regexpExec.call(separatorCopy, string)) {
  1378. lastIndex = separatorCopy.lastIndex;
  1379. if (lastIndex > lastLastIndex) {
  1380. output.push(string.slice(lastLastIndex, match.index));
  1381. if (match.length > 1 && match.index < string.length) arrayPush.apply(output, match.slice(1));
  1382. lastLength = match[0].length;
  1383. lastLastIndex = lastIndex;
  1384. if (output.length >= lim) break;
  1385. }
  1386. if (separatorCopy.lastIndex === match.index) separatorCopy.lastIndex++; // Avoid an infinite loop
  1387. }
  1388. if (lastLastIndex === string.length) {
  1389. if (lastLength || !separatorCopy.test('')) output.push('');
  1390. } else output.push(string.slice(lastLastIndex));
  1391. return output.length > lim ? output.slice(0, lim) : output;
  1392. };
  1393. // Chakra, V8
  1394. } else if ('0'.split(undefined, 0).length) {
  1395. internalSplit = function (separator, limit) {
  1396. return separator === undefined && limit === 0 ? [] : nativeSplit.call(this, separator, limit);
  1397. };
  1398. } else internalSplit = nativeSplit;
  1399. return [
  1400. // `String.prototype.split` method
  1401. // https://tc39.es/ecma262/#sec-string.prototype.split
  1402. function split(separator, limit) {
  1403. var O = requireObjectCoercible(this);
  1404. var splitter = separator == undefined ? undefined : separator[SPLIT];
  1405. return splitter !== undefined
  1406. ? splitter.call(separator, O, limit)
  1407. : internalSplit.call(String(O), separator, limit);
  1408. },
  1409. // `RegExp.prototype[@@split]` method
  1410. // https://tc39.es/ecma262/#sec-regexp.prototype-@@split
  1411. //
  1412. // NOTE: This cannot be properly polyfilled in engines that don't support
  1413. // the 'y' flag.
  1414. function (regexp, limit) {
  1415. var res = maybeCallNative(internalSplit, regexp, this, limit, internalSplit !== nativeSplit);
  1416. if (res.done) return res.value;
  1417. var rx = anObject(regexp);
  1418. var S = String(this);
  1419. var C = speciesConstructor(rx, RegExp);
  1420. var unicodeMatching = rx.unicode;
  1421. var flags = (rx.ignoreCase ? 'i' : '') +
  1422. (rx.multiline ? 'm' : '') +
  1423. (rx.unicode ? 'u' : '') +
  1424. (SUPPORTS_Y ? 'y' : 'g');
  1425. // ^(? + rx + ) is needed, in combination with some S slicing, to
  1426. // simulate the 'y' flag.
  1427. var splitter = new C(SUPPORTS_Y ? rx : '^(?:' + rx.source + ')', flags);
  1428. var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
  1429. if (lim === 0) return [];
  1430. if (S.length === 0) return regexpExecAbstract(splitter, S) === null ? [S] : [];
  1431. var p = 0;
  1432. var q = 0;
  1433. var A = [];
  1434. while (q < S.length) {
  1435. splitter.lastIndex = SUPPORTS_Y ? q : 0;
  1436. var z = regexpExecAbstract(splitter, SUPPORTS_Y ? S : S.slice(q));
  1437. var e;
  1438. if (
  1439. z === null ||
  1440. (e = min(toLength(splitter.lastIndex + (SUPPORTS_Y ? 0 : q)), S.length)) === p
  1441. ) {
  1442. q = advanceStringIndex(S, q, unicodeMatching);
  1443. } else {
  1444. A.push(S.slice(p, q));
  1445. if (A.length === lim) return A;
  1446. for (var i = 1; i <= z.length - 1; i++) {
  1447. A.push(z[i]);
  1448. if (A.length === lim) return A;
  1449. }
  1450. q = p = e;
  1451. }
  1452. }
  1453. A.push(S.slice(p));
  1454. return A;
  1455. }
  1456. ];
  1457. }, !SUPPORTS_Y);
  1458. var $includes = arrayIncludes.includes;
  1459. // `Array.prototype.includes` method
  1460. // https://tc39.es/ecma262/#sec-array.prototype.includes
  1461. _export({ target: 'Array', proto: true }, {
  1462. includes: function includes(el /* , fromIndex = 0 */) {
  1463. return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
  1464. }
  1465. });
  1466. // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
  1467. addToUnscopables('includes');
  1468. // iterable DOM collections
  1469. // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
  1470. var domIterables = {
  1471. CSSRuleList: 0,
  1472. CSSStyleDeclaration: 0,
  1473. CSSValueList: 0,
  1474. ClientRectList: 0,
  1475. DOMRectList: 0,
  1476. DOMStringList: 0,
  1477. DOMTokenList: 1,
  1478. DataTransferItemList: 0,
  1479. FileList: 0,
  1480. HTMLAllCollection: 0,
  1481. HTMLCollection: 0,
  1482. HTMLFormElement: 0,
  1483. HTMLSelectElement: 0,
  1484. MediaList: 0,
  1485. MimeTypeArray: 0,
  1486. NamedNodeMap: 0,
  1487. NodeList: 1,
  1488. PaintRequestList: 0,
  1489. Plugin: 0,
  1490. PluginArray: 0,
  1491. SVGLengthList: 0,
  1492. SVGNumberList: 0,
  1493. SVGPathSegList: 0,
  1494. SVGPointList: 0,
  1495. SVGStringList: 0,
  1496. SVGTransformList: 0,
  1497. SourceBufferList: 0,
  1498. StyleSheetList: 0,
  1499. TextTrackCueList: 0,
  1500. TextTrackList: 0,
  1501. TouchList: 0
  1502. };
  1503. var $forEach = arrayIteration.forEach;
  1504. var STRICT_METHOD$2 = arrayMethodIsStrict('forEach');
  1505. // `Array.prototype.forEach` method implementation
  1506. // https://tc39.es/ecma262/#sec-array.prototype.foreach
  1507. var arrayForEach = !STRICT_METHOD$2 ? function forEach(callbackfn /* , thisArg */) {
  1508. return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  1509. } : [].forEach;
  1510. for (var COLLECTION_NAME in domIterables) {
  1511. var Collection = global_1[COLLECTION_NAME];
  1512. var CollectionPrototype = Collection && Collection.prototype;
  1513. // some Chrome versions have non-configurable methods on DOMTokenList
  1514. if (CollectionPrototype && CollectionPrototype.forEach !== arrayForEach) try {
  1515. createNonEnumerableProperty(CollectionPrototype, 'forEach', arrayForEach);
  1516. } catch (error) {
  1517. CollectionPrototype.forEach = arrayForEach;
  1518. }
  1519. }
  1520. var FAILS_ON_PRIMITIVES = fails(function () { objectKeys(1); });
  1521. // `Object.keys` method
  1522. // https://tc39.es/ecma262/#sec-object.keys
  1523. _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
  1524. keys: function keys(it) {
  1525. return objectKeys(toObject(it));
  1526. }
  1527. });
  1528. var nativeJoin = [].join;
  1529. var ES3_STRINGS = indexedObject != Object;
  1530. var STRICT_METHOD$1 = arrayMethodIsStrict('join', ',');
  1531. // `Array.prototype.join` method
  1532. // https://tc39.es/ecma262/#sec-array.prototype.join
  1533. _export({ target: 'Array', proto: true, forced: ES3_STRINGS || !STRICT_METHOD$1 }, {
  1534. join: function join(separator) {
  1535. return nativeJoin.call(toIndexedObject(this), separator === undefined ? ',' : separator);
  1536. }
  1537. });
  1538. var $indexOf = arrayIncludes.indexOf;
  1539. var nativeIndexOf = [].indexOf;
  1540. var NEGATIVE_ZERO = !!nativeIndexOf && 1 / [1].indexOf(1, -0) < 0;
  1541. var STRICT_METHOD = arrayMethodIsStrict('indexOf');
  1542. // `Array.prototype.indexOf` method
  1543. // https://tc39.es/ecma262/#sec-array.prototype.indexof
  1544. _export({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || !STRICT_METHOD }, {
  1545. indexOf: function indexOf(searchElement /* , fromIndex = 0 */) {
  1546. return NEGATIVE_ZERO
  1547. // convert -0 to +0
  1548. ? nativeIndexOf.apply(this, arguments) || 0
  1549. : $indexOf(this, searchElement, arguments.length > 1 ? arguments[1] : undefined);
  1550. }
  1551. });
  1552. var Utils = $__default['default'].fn.bootstrapTable.utils;
  1553. var searchControls = 'select, input:not([type="checkbox"]):not([type="radio"])';
  1554. function getOptionsFromSelectControl(selectControl) {
  1555. return selectControl.get(selectControl.length - 1).options;
  1556. }
  1557. function getControlContainer(that) {
  1558. if (that.options.filterControlContainer) {
  1559. return $__default['default']("".concat(that.options.filterControlContainer));
  1560. }
  1561. return that.$header;
  1562. }
  1563. function getSearchControls(that) {
  1564. return getControlContainer(that).find(searchControls);
  1565. }
  1566. function hideUnusedSelectOptions(selectControl, uniqueValues) {
  1567. var options = getOptionsFromSelectControl(selectControl);
  1568. for (var i = 0; i < options.length; i++) {
  1569. if (options[i].value !== '') {
  1570. if (!uniqueValues.hasOwnProperty(options[i].value)) {
  1571. selectControl.find(Utils.sprintf('option[value=\'%s\']', options[i].value)).hide();
  1572. } else {
  1573. selectControl.find(Utils.sprintf('option[value=\'%s\']', options[i].value)).show();
  1574. }
  1575. }
  1576. }
  1577. }
  1578. function existOptionInSelectControl(selectControl, value) {
  1579. var options = getOptionsFromSelectControl(selectControl);
  1580. for (var i = 0; i < options.length; i++) {
  1581. if (options[i].value === Utils.unescapeHTML(value.toString())) {
  1582. // The value is not valid to add
  1583. return true;
  1584. }
  1585. } // If we get here, the value is valid to add
  1586. return false;
  1587. }
  1588. function addOptionToSelectControl(selectControl, _value, text, selected) {
  1589. var value = _value === undefined || _value === null ? '' : _value.toString().trim();
  1590. var $selectControl = $__default['default'](selectControl.get(selectControl.length - 1));
  1591. if (!existOptionInSelectControl(selectControl, value)) {
  1592. var option = $__default['default']("<option value=\"".concat(value, "\">").concat(text, "</option>"));
  1593. if (value === selected) {
  1594. option.attr('selected', true);
  1595. }
  1596. $selectControl.append(option);
  1597. }
  1598. }
  1599. function sortSelectControl(selectControl, orderBy) {
  1600. var $selectControl = $__default['default'](selectControl.get(selectControl.length - 1));
  1601. var $opts = $selectControl.find('option:gt(0)');
  1602. if (orderBy !== 'server') {
  1603. $opts.sort(function (a, b) {
  1604. return Utils.sort(a.textContent, b.textContent, orderBy === 'desc' ? -1 : 1);
  1605. });
  1606. }
  1607. $selectControl.find('option:gt(0)').remove();
  1608. $selectControl.append($opts);
  1609. }
  1610. function fixHeaderCSS(_ref) {
  1611. var $tableHeader = _ref.$tableHeader;
  1612. $tableHeader.css('height', '89px');
  1613. }
  1614. function getElementClass($element) {
  1615. return $element.attr('class').replace('form-control', '').replace('focus-temp', '').replace('search-input', '').trim();
  1616. }
  1617. function getCursorPosition(el) {
  1618. if (Utils.isIEBrowser()) {
  1619. if ($__default['default'](el).is('input[type=text]')) {
  1620. var pos = 0;
  1621. if ('selectionStart' in el) {
  1622. pos = el.selectionStart;
  1623. } else if ('selection' in document) {
  1624. el.focus();
  1625. var Sel = document.selection.createRange();
  1626. var SelLength = document.selection.createRange().text.length;
  1627. Sel.moveStart('character', -el.value.length);
  1628. pos = Sel.text.length - SelLength;
  1629. }
  1630. return pos;
  1631. }
  1632. return -1;
  1633. }
  1634. return -1;
  1635. }
  1636. function setCursorPosition(el) {
  1637. $__default['default'](el).val(el.value);
  1638. }
  1639. function copyValues(that) {
  1640. var searchControls = getSearchControls(that);
  1641. that.options.valuesFilterControl = [];
  1642. searchControls.each(function () {
  1643. var $field = $__default['default'](this);
  1644. if (that.options.height) {
  1645. var fieldClass = getElementClass($field);
  1646. $field = $__default['default'](".fixed-table-header .".concat(fieldClass));
  1647. }
  1648. that.options.valuesFilterControl.push({
  1649. field: $field.closest('[data-field]').data('field'),
  1650. value: $field.val(),
  1651. position: getCursorPosition($field.get(0)),
  1652. hasFocus: $field.is(':focus')
  1653. });
  1654. });
  1655. }
  1656. function setValues(that) {
  1657. var field = null;
  1658. var result = [];
  1659. var searchControls = getSearchControls(that);
  1660. if (that.options.valuesFilterControl.length > 0) {
  1661. // Callback to apply after settings fields values
  1662. var fieldToFocusCallback = null;
  1663. searchControls.each(function (i, el) {
  1664. var $this = $__default['default'](el);
  1665. field = $this.closest('[data-field]').data('field');
  1666. result = that.options.valuesFilterControl.filter(function (valueObj) {
  1667. return valueObj.field === field;
  1668. });
  1669. if (result.length > 0) {
  1670. if ($this.is('[type=radio]')) {
  1671. return;
  1672. }
  1673. $this.val(result[0].value);
  1674. if (result[0].hasFocus && result[0].value !== '') {
  1675. // set callback if the field had the focus.
  1676. fieldToFocusCallback = function (fieldToFocus, carretPosition) {
  1677. // Closure here to capture the field and cursor position
  1678. var closedCallback = function closedCallback() {
  1679. fieldToFocus.focus();
  1680. setCursorPosition(fieldToFocus);
  1681. };
  1682. return closedCallback;
  1683. }($this.get(0), result[0].position);
  1684. }
  1685. }
  1686. }); // Callback call.
  1687. if (fieldToFocusCallback !== null) {
  1688. fieldToFocusCallback();
  1689. }
  1690. }
  1691. }
  1692. function collectBootstrapCookies() {
  1693. var cookies = [];
  1694. var foundCookies = document.cookie.match(/(?:bs.table.)(\w*)/g);
  1695. var foundLocalStorage = localStorage;
  1696. if (foundCookies) {
  1697. $__default['default'].each(foundCookies, function (i, _cookie) {
  1698. var cookie = _cookie;
  1699. if (/./.test(cookie)) {
  1700. cookie = cookie.split('.').pop();
  1701. }
  1702. if ($__default['default'].inArray(cookie, cookies) === -1) {
  1703. cookies.push(cookie);
  1704. }
  1705. });
  1706. }
  1707. if (foundLocalStorage) {
  1708. for (var i = 0; i < foundLocalStorage.length; i++) {
  1709. var cookie = foundLocalStorage.key(i);
  1710. if (/./.test(cookie)) {
  1711. cookie = cookie.split('.').pop();
  1712. }
  1713. if (!cookies.includes(cookie)) {
  1714. cookies.push(cookie);
  1715. }
  1716. }
  1717. }
  1718. return cookies;
  1719. }
  1720. function escapeID(id) {
  1721. // eslint-disable-next-line no-useless-escape
  1722. return String(id).replace(/([:.\[\],])/g, '\\$1');
  1723. }
  1724. function isColumnSearchableViaSelect(_ref2) {
  1725. var filterControl = _ref2.filterControl,
  1726. searchable = _ref2.searchable;
  1727. return filterControl && filterControl.toLowerCase() === 'select' && searchable;
  1728. }
  1729. function isFilterDataNotGiven(_ref3) {
  1730. var filterData = _ref3.filterData;
  1731. return filterData === undefined || filterData.toLowerCase() === 'column';
  1732. }
  1733. function hasSelectControlElement(selectControl) {
  1734. return selectControl && selectControl.length > 0;
  1735. }
  1736. function initFilterSelectControls(that) {
  1737. var data = that.data;
  1738. var z = that.options.pagination ? that.options.sidePagination === 'server' ? that.pageTo : that.options.totalRows : that.pageTo;
  1739. $__default['default'].each(that.header.fields, function (j, field) {
  1740. var column = that.columns[that.fieldsColumnsIndex[field]];
  1741. var selectControl = getControlContainer(that).find("select.bootstrap-table-filter-control-".concat(escapeID(column.field)));
  1742. if (isColumnSearchableViaSelect(column) && isFilterDataNotGiven(column) && hasSelectControlElement(selectControl)) {
  1743. if (selectControl.get(selectControl.length - 1).options.length === 0) {
  1744. // Added the default option, must use a non-breaking space(&nbsp;) to pass the W3C validator
  1745. addOptionToSelectControl(selectControl, '', column.filterControlPlaceholder || '&nbsp;', column.filterDefault);
  1746. }
  1747. var uniqueValues = {};
  1748. for (var i = 0; i < z; i++) {
  1749. // Added a new value
  1750. var fieldValue = Utils.getItemField(data[i], field, false);
  1751. var formatter = that.options.editable && column.editable ? column._formatter : that.header.formatters[j];
  1752. var formattedValue = Utils.calculateObjectValue(that.header, formatter, [fieldValue, data[i], i], fieldValue);
  1753. if (column.filterDataCollector) {
  1754. formattedValue = Utils.calculateObjectValue(that.header, column.filterDataCollector, [fieldValue, data[i], formattedValue], formattedValue);
  1755. }
  1756. if (column.searchFormatter) {
  1757. fieldValue = formattedValue;
  1758. }
  1759. uniqueValues[formattedValue] = fieldValue;
  1760. if (_typeof(formattedValue) === 'object' && formattedValue !== null) {
  1761. formattedValue.forEach(function (value) {
  1762. addOptionToSelectControl(selectControl, value, value, column.filterDefault);
  1763. });
  1764. continue;
  1765. } // eslint-disable-next-line guard-for-in
  1766. for (var key in uniqueValues) {
  1767. addOptionToSelectControl(selectControl, uniqueValues[key], key, column.filterDefault);
  1768. }
  1769. }
  1770. sortSelectControl(selectControl, column.filterOrderBy);
  1771. if (that.options.hideUnusedSelectOptions) {
  1772. hideUnusedSelectOptions(selectControl, uniqueValues);
  1773. }
  1774. }
  1775. });
  1776. }
  1777. function getFilterDataMethod(objFilterDataMethod, searchTerm) {
  1778. var keys = Object.keys(objFilterDataMethod);
  1779. for (var i = 0; i < keys.length; i++) {
  1780. if (keys[i] === searchTerm) {
  1781. return objFilterDataMethod[searchTerm];
  1782. }
  1783. }
  1784. return null;
  1785. }
  1786. function createControls(that, header) {
  1787. var addedFilterControl = false;
  1788. var html;
  1789. $__default['default'].each(that.columns, function (_, column) {
  1790. html = [];
  1791. if (!column.visible) {
  1792. return;
  1793. }
  1794. if (!column.filterControl && !that.options.filterControlContainer) {
  1795. html.push('<div class="no-filter-control"></div>');
  1796. } else if (that.options.filterControlContainer) {
  1797. var $filterControls = $__default['default'](".bootstrap-table-filter-control-".concat(column.field));
  1798. $__default['default'].each($filterControls, function (_, filterControl) {
  1799. var $filterControl = $__default['default'](filterControl);
  1800. if (!$filterControl.is('[type=radio]')) {
  1801. var placeholder = column.filterControlPlaceholder ? column.filterControlPlaceholder : '';
  1802. $filterControl.attr('placeholder', placeholder).val(column.filterDefault);
  1803. }
  1804. $filterControl.attr('data-field', column.field);
  1805. });
  1806. addedFilterControl = true;
  1807. } else {
  1808. var nameControl = column.filterControl.toLowerCase();
  1809. html.push('<div class="filter-control">');
  1810. addedFilterControl = true;
  1811. if (column.searchable && that.options.filterTemplate[nameControl]) {
  1812. html.push(that.options.filterTemplate[nameControl](that, column.field, column.filterControlPlaceholder ? column.filterControlPlaceholder : '', column.filterDefault));
  1813. }
  1814. }
  1815. if (!column.filterControl && '' !== column.filterDefault && 'undefined' !== typeof column.filterDefault) {
  1816. if ($__default['default'].isEmptyObject(that.filterColumnsPartial)) {
  1817. that.filterColumnsPartial = {};
  1818. }
  1819. that.filterColumnsPartial[column.field] = column.filterDefault;
  1820. }
  1821. $__default['default'].each(header.find('th'), function (i, th) {
  1822. var $th = $__default['default'](th);
  1823. if ($th.data('field') === column.field) {
  1824. $th.find('.fht-cell').append(html.join(''));
  1825. return false;
  1826. }
  1827. });
  1828. if (column.filterData && column.filterData.toLowerCase() !== 'column') {
  1829. var filterDataType = getFilterDataMethod(
  1830. /* eslint-disable no-use-before-define */
  1831. filterDataMethods, column.filterData.substring(0, column.filterData.indexOf(':')));
  1832. var filterDataSource;
  1833. var selectControl;
  1834. if (filterDataType) {
  1835. filterDataSource = column.filterData.substring(column.filterData.indexOf(':') + 1, column.filterData.length);
  1836. selectControl = header.find(".bootstrap-table-filter-control-".concat(escapeID(column.field)));
  1837. addOptionToSelectControl(selectControl, '', column.filterControlPlaceholder, column.filterDefault);
  1838. filterDataType(filterDataSource, selectControl, that.options.filterOrderBy, column.filterDefault);
  1839. } else {
  1840. throw new SyntaxError('Error. You should use any of these allowed filter data methods: var, obj, json, url, func.' + ' Use like this: var: {key: "value"}');
  1841. }
  1842. }
  1843. });
  1844. if (addedFilterControl) {
  1845. header.off('keyup', 'input').on('keyup', 'input', function (_ref4, obj) {
  1846. var currentTarget = _ref4.currentTarget,
  1847. keyCode = _ref4.keyCode;
  1848. syncControls(that); // Simulate enter key action from clear button
  1849. keyCode = obj ? obj.keyCode : keyCode;
  1850. if (that.options.searchOnEnterKey && keyCode !== 13) {
  1851. return;
  1852. }
  1853. if ($__default['default'].inArray(keyCode, [37, 38, 39, 40]) > -1) {
  1854. return;
  1855. }
  1856. var $currentTarget = $__default['default'](currentTarget);
  1857. if ($currentTarget.is(':checkbox') || $currentTarget.is(':radio')) {
  1858. return;
  1859. }
  1860. clearTimeout(currentTarget.timeoutId || 0);
  1861. currentTarget.timeoutId = setTimeout(function () {
  1862. that.onColumnSearch({
  1863. currentTarget: currentTarget,
  1864. keyCode: keyCode
  1865. });
  1866. }, that.options.searchTimeOut);
  1867. });
  1868. header.off('change', 'select:not(".ms-offscreen")').on('change', 'select:not(".ms-offscreen")', function (_ref5) {
  1869. var currentTarget = _ref5.currentTarget,
  1870. keyCode = _ref5.keyCode;
  1871. syncControls(that);
  1872. var $select = $__default['default'](currentTarget);
  1873. var value = $select.val();
  1874. if (value && value.length > 0 && value.trim()) {
  1875. $select.find('option[selected]').removeAttr('selected');
  1876. $select.find("option[value=\"".concat(value, "\"]")).attr('selected', true);
  1877. } else {
  1878. $select.find('option[selected]').removeAttr('selected');
  1879. }
  1880. clearTimeout(currentTarget.timeoutId || 0);
  1881. currentTarget.timeoutId = setTimeout(function () {
  1882. that.onColumnSearch({
  1883. currentTarget: currentTarget,
  1884. keyCode: keyCode
  1885. });
  1886. }, that.options.searchTimeOut);
  1887. });
  1888. header.off('mouseup', 'input:not([type=radio])').on('mouseup', 'input:not([type=radio])', function (_ref6) {
  1889. var currentTarget = _ref6.currentTarget,
  1890. keyCode = _ref6.keyCode;
  1891. var $input = $__default['default'](currentTarget);
  1892. var oldValue = $input.val();
  1893. if (oldValue === '') {
  1894. return;
  1895. }
  1896. setTimeout(function () {
  1897. syncControls(that);
  1898. var newValue = $input.val();
  1899. if (newValue === '') {
  1900. clearTimeout(currentTarget.timeoutId || 0);
  1901. currentTarget.timeoutId = setTimeout(function () {
  1902. that.onColumnSearch({
  1903. currentTarget: currentTarget,
  1904. keyCode: keyCode
  1905. });
  1906. }, that.options.searchTimeOut);
  1907. }
  1908. }, 1);
  1909. });
  1910. header.off('change', 'input[type=radio]').on('change', 'input[type=radio]', function (_ref7) {
  1911. var currentTarget = _ref7.currentTarget,
  1912. keyCode = _ref7.keyCode;
  1913. clearTimeout(currentTarget.timeoutId || 0);
  1914. currentTarget.timeoutId = setTimeout(function () {
  1915. syncControls(that);
  1916. that.onColumnSearch({
  1917. currentTarget: currentTarget,
  1918. keyCode: keyCode
  1919. });
  1920. }, that.options.searchTimeOut);
  1921. });
  1922. if (header.find('.date-filter-control').length > 0) {
  1923. $__default['default'].each(that.columns, function (i, _ref8) {
  1924. var filterDefault = _ref8.filterDefault,
  1925. filterControl = _ref8.filterControl,
  1926. field = _ref8.field,
  1927. filterDatepickerOptions = _ref8.filterDatepickerOptions;
  1928. if (filterControl !== undefined && filterControl.toLowerCase() === 'datepicker') {
  1929. var $datepicker = header.find(".date-filter-control.bootstrap-table-filter-control-".concat(field));
  1930. $datepicker.datepicker(filterDatepickerOptions);
  1931. if (filterDefault) {
  1932. $datepicker.datepicker('setDate', filterDefault);
  1933. }
  1934. $datepicker.on('changeDate', function (_ref9) {
  1935. var currentTarget = _ref9.currentTarget,
  1936. keyCode = _ref9.keyCode;
  1937. clearTimeout(currentTarget.timeoutId || 0);
  1938. currentTarget.timeoutId = setTimeout(function () {
  1939. syncControls(that);
  1940. that.onColumnSearch({
  1941. currentTarget: currentTarget,
  1942. keyCode: keyCode
  1943. });
  1944. }, that.options.searchTimeOut);
  1945. });
  1946. }
  1947. });
  1948. }
  1949. if (that.options.sidePagination !== 'server' && !that.options.height) {
  1950. that.triggerSearch();
  1951. }
  1952. if (!that.options.filterControlVisible) {
  1953. header.find('.filter-control, .no-filter-control').hide();
  1954. }
  1955. } else {
  1956. header.find('.filter-control, .no-filter-control').hide();
  1957. }
  1958. that.trigger('created-controls');
  1959. }
  1960. function getDirectionOfSelectOptions(_alignment) {
  1961. var alignment = _alignment === undefined ? 'left' : _alignment.toLowerCase();
  1962. switch (alignment) {
  1963. case 'left':
  1964. return 'ltr';
  1965. case 'right':
  1966. return 'rtl';
  1967. case 'auto':
  1968. return 'auto';
  1969. default:
  1970. return 'ltr';
  1971. }
  1972. }
  1973. function syncControls(that) {
  1974. if (that.options.height) {
  1975. var controlsTableHeader = that.$tableHeader.find(searchControls);
  1976. that.$header.find(searchControls).each(function (_, control) {
  1977. var $control = $__default['default'](control);
  1978. var controlClass = getElementClass($control);
  1979. var foundControl = controlsTableHeader.filter(function (_, ele) {
  1980. var eleClass = getElementClass($__default['default'](ele));
  1981. return controlClass === eleClass;
  1982. });
  1983. if (foundControl.length === 0) {
  1984. return;
  1985. }
  1986. if ($control.is('select')) {
  1987. $control.find('option:selected').removeAttr('selected');
  1988. $control.find("option[value='".concat(foundControl.val(), "']")).attr('selected', true);
  1989. } else {
  1990. $control.val(foundControl.val());
  1991. }
  1992. });
  1993. }
  1994. }
  1995. var filterDataMethods = {
  1996. func: function func(filterDataSource, selectControl, filterOrderBy, selected) {
  1997. var variableValues = window[filterDataSource].apply(); // eslint-disable-next-line guard-for-in
  1998. for (var key in variableValues) {
  1999. addOptionToSelectControl(selectControl, key, variableValues[key], selected);
  2000. }
  2001. sortSelectControl(selectControl, filterOrderBy);
  2002. },
  2003. obj: function obj(filterDataSource, selectControl, filterOrderBy, selected) {
  2004. var objectKeys = filterDataSource.split('.');
  2005. var variableName = objectKeys.shift();
  2006. var variableValues = window[variableName];
  2007. if (objectKeys.length > 0) {
  2008. objectKeys.forEach(function (key) {
  2009. variableValues = variableValues[key];
  2010. });
  2011. } // eslint-disable-next-line guard-for-in
  2012. for (var key in variableValues) {
  2013. addOptionToSelectControl(selectControl, key, variableValues[key], selected);
  2014. }
  2015. sortSelectControl(selectControl, filterOrderBy);
  2016. },
  2017. var: function _var(filterDataSource, selectControl, filterOrderBy, selected) {
  2018. var variableValues = window[filterDataSource];
  2019. var isArray = Array.isArray(variableValues);
  2020. for (var key in variableValues) {
  2021. if (isArray) {
  2022. addOptionToSelectControl(selectControl, variableValues[key], variableValues[key], selected);
  2023. } else {
  2024. addOptionToSelectControl(selectControl, key, variableValues[key], selected);
  2025. }
  2026. }
  2027. sortSelectControl(selectControl, filterOrderBy);
  2028. },
  2029. url: function url(filterDataSource, selectControl, filterOrderBy, selected) {
  2030. $__default['default'].ajax({
  2031. url: filterDataSource,
  2032. dataType: 'json',
  2033. success: function success(data) {
  2034. // eslint-disable-next-line guard-for-in
  2035. for (var key in data) {
  2036. addOptionToSelectControl(selectControl, key, data[key], selected);
  2037. }
  2038. sortSelectControl(selectControl, filterOrderBy);
  2039. }
  2040. });
  2041. },
  2042. json: function json(filterDataSource, selectControl, filterOrderBy, selected) {
  2043. var variableValues = JSON.parse(filterDataSource); // eslint-disable-next-line guard-for-in
  2044. for (var key in variableValues) {
  2045. addOptionToSelectControl(selectControl, key, variableValues[key], selected);
  2046. }
  2047. sortSelectControl(selectControl, filterOrderBy);
  2048. }
  2049. };
  2050. exports.addOptionToSelectControl = addOptionToSelectControl;
  2051. exports.collectBootstrapCookies = collectBootstrapCookies;
  2052. exports.copyValues = copyValues;
  2053. exports.createControls = createControls;
  2054. exports.escapeID = escapeID;
  2055. exports.existOptionInSelectControl = existOptionInSelectControl;
  2056. exports.fixHeaderCSS = fixHeaderCSS;
  2057. exports.getControlContainer = getControlContainer;
  2058. exports.getCursorPosition = getCursorPosition;
  2059. exports.getDirectionOfSelectOptions = getDirectionOfSelectOptions;
  2060. exports.getElementClass = getElementClass;
  2061. exports.getFilterDataMethod = getFilterDataMethod;
  2062. exports.getOptionsFromSelectControl = getOptionsFromSelectControl;
  2063. exports.getSearchControls = getSearchControls;
  2064. exports.hasSelectControlElement = hasSelectControlElement;
  2065. exports.hideUnusedSelectOptions = hideUnusedSelectOptions;
  2066. exports.initFilterSelectControls = initFilterSelectControls;
  2067. exports.isColumnSearchableViaSelect = isColumnSearchableViaSelect;
  2068. exports.isFilterDataNotGiven = isFilterDataNotGiven;
  2069. exports.setCursorPosition = setCursorPosition;
  2070. exports.setValues = setValues;
  2071. exports.sortSelectControl = sortSelectControl;
  2072. exports.syncControls = syncControls;
  2073. Object.defineProperty(exports, '__esModule', { value: true });
  2074. })));