utils.js 85 KB

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