utils.js 83 KB

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