bootstrap-table-filter-control.js 109 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140
  1. (function (global, factory) {
  2. typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) :
  3. typeof define === 'function' && define.amd ? define(['jquery'], factory) :
  4. (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.jQuery));
  5. }(this, (function ($) { 'use strict';
  6. function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
  7. var $__default = /*#__PURE__*/_interopDefaultLegacy($);
  8. function _typeof(obj) {
  9. "@babel/helpers - typeof";
  10. if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
  11. _typeof = function (obj) {
  12. return typeof obj;
  13. };
  14. } else {
  15. _typeof = function (obj) {
  16. return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
  17. };
  18. }
  19. return _typeof(obj);
  20. }
  21. function _classCallCheck(instance, Constructor) {
  22. if (!(instance instanceof Constructor)) {
  23. throw new TypeError("Cannot call a class as a function");
  24. }
  25. }
  26. function _defineProperties(target, props) {
  27. for (var i = 0; i < props.length; i++) {
  28. var descriptor = props[i];
  29. descriptor.enumerable = descriptor.enumerable || false;
  30. descriptor.configurable = true;
  31. if ("value" in descriptor) descriptor.writable = true;
  32. Object.defineProperty(target, descriptor.key, descriptor);
  33. }
  34. }
  35. function _createClass(Constructor, protoProps, staticProps) {
  36. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  37. if (staticProps) _defineProperties(Constructor, staticProps);
  38. return Constructor;
  39. }
  40. function _inherits(subClass, superClass) {
  41. if (typeof superClass !== "function" && superClass !== null) {
  42. throw new TypeError("Super expression must either be null or a function");
  43. }
  44. subClass.prototype = Object.create(superClass && superClass.prototype, {
  45. constructor: {
  46. value: subClass,
  47. writable: true,
  48. configurable: true
  49. }
  50. });
  51. if (superClass) _setPrototypeOf(subClass, superClass);
  52. }
  53. function _getPrototypeOf(o) {
  54. _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
  55. return o.__proto__ || Object.getPrototypeOf(o);
  56. };
  57. return _getPrototypeOf(o);
  58. }
  59. function _setPrototypeOf(o, p) {
  60. _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
  61. o.__proto__ = p;
  62. return o;
  63. };
  64. return _setPrototypeOf(o, p);
  65. }
  66. function _isNativeReflectConstruct() {
  67. if (typeof Reflect === "undefined" || !Reflect.construct) return false;
  68. if (Reflect.construct.sham) return false;
  69. if (typeof Proxy === "function") return true;
  70. try {
  71. Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
  72. return true;
  73. } catch (e) {
  74. return false;
  75. }
  76. }
  77. function _assertThisInitialized(self) {
  78. if (self === void 0) {
  79. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  80. }
  81. return self;
  82. }
  83. function _possibleConstructorReturn(self, call) {
  84. if (call && (typeof call === "object" || typeof call === "function")) {
  85. return call;
  86. }
  87. return _assertThisInitialized(self);
  88. }
  89. function _createSuper(Derived) {
  90. var hasNativeReflectConstruct = _isNativeReflectConstruct();
  91. return function _createSuperInternal() {
  92. var Super = _getPrototypeOf(Derived),
  93. result;
  94. if (hasNativeReflectConstruct) {
  95. var NewTarget = _getPrototypeOf(this).constructor;
  96. result = Reflect.construct(Super, arguments, NewTarget);
  97. } else {
  98. result = Super.apply(this, arguments);
  99. }
  100. return _possibleConstructorReturn(this, result);
  101. };
  102. }
  103. function _superPropBase(object, property) {
  104. while (!Object.prototype.hasOwnProperty.call(object, property)) {
  105. object = _getPrototypeOf(object);
  106. if (object === null) break;
  107. }
  108. return object;
  109. }
  110. function _get(target, property, receiver) {
  111. if (typeof Reflect !== "undefined" && Reflect.get) {
  112. _get = Reflect.get;
  113. } else {
  114. _get = function _get(target, property, receiver) {
  115. var base = _superPropBase(target, property);
  116. if (!base) return;
  117. var desc = Object.getOwnPropertyDescriptor(base, property);
  118. if (desc.get) {
  119. return desc.get.call(receiver);
  120. }
  121. return desc.value;
  122. };
  123. }
  124. return _get(target, property, receiver || target);
  125. }
  126. function _toConsumableArray(arr) {
  127. return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
  128. }
  129. function _arrayWithoutHoles(arr) {
  130. if (Array.isArray(arr)) return _arrayLikeToArray(arr);
  131. }
  132. function _iterableToArray(iter) {
  133. if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
  134. }
  135. function _unsupportedIterableToArray(o, minLen) {
  136. if (!o) return;
  137. if (typeof o === "string") return _arrayLikeToArray(o, minLen);
  138. var n = Object.prototype.toString.call(o).slice(8, -1);
  139. if (n === "Object" && o.constructor) n = o.constructor.name;
  140. if (n === "Map" || n === "Set") return Array.from(o);
  141. if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
  142. }
  143. function _arrayLikeToArray(arr, len) {
  144. if (len == null || len > arr.length) len = arr.length;
  145. for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
  146. return arr2;
  147. }
  148. function _nonIterableSpread() {
  149. throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  150. }
  151. var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
  152. function createCommonjsModule(fn, module) {
  153. return module = { exports: {} }, fn(module, module.exports), module.exports;
  154. }
  155. var check = function (it) {
  156. return it && it.Math == Math && it;
  157. };
  158. // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
  159. var global_1 =
  160. /* global globalThis -- safe */
  161. check(typeof globalThis == 'object' && globalThis) ||
  162. check(typeof window == 'object' && window) ||
  163. check(typeof self == 'object' && self) ||
  164. check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
  165. // eslint-disable-next-line no-new-func -- fallback
  166. (function () { return this; })() || Function('return this')();
  167. var fails = function (exec) {
  168. try {
  169. return !!exec();
  170. } catch (error) {
  171. return true;
  172. }
  173. };
  174. // Detect IE8's incomplete defineProperty implementation
  175. var descriptors = !fails(function () {
  176. return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
  177. });
  178. var nativePropertyIsEnumerable = {}.propertyIsEnumerable;
  179. var getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
  180. // Nashorn ~ JDK8 bug
  181. var NASHORN_BUG = getOwnPropertyDescriptor$1 && !nativePropertyIsEnumerable.call({ 1: 2 }, 1);
  182. // `Object.prototype.propertyIsEnumerable` method implementation
  183. // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
  184. var f$4 = NASHORN_BUG ? function propertyIsEnumerable(V) {
  185. var descriptor = getOwnPropertyDescriptor$1(this, V);
  186. return !!descriptor && descriptor.enumerable;
  187. } : nativePropertyIsEnumerable;
  188. var objectPropertyIsEnumerable = {
  189. f: f$4
  190. };
  191. var createPropertyDescriptor = function (bitmap, value) {
  192. return {
  193. enumerable: !(bitmap & 1),
  194. configurable: !(bitmap & 2),
  195. writable: !(bitmap & 4),
  196. value: value
  197. };
  198. };
  199. var toString = {}.toString;
  200. var classofRaw = function (it) {
  201. return toString.call(it).slice(8, -1);
  202. };
  203. var split = ''.split;
  204. // fallback for non-array-like ES3 and non-enumerable old V8 strings
  205. var indexedObject = fails(function () {
  206. // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
  207. // eslint-disable-next-line no-prototype-builtins -- safe
  208. return !Object('z').propertyIsEnumerable(0);
  209. }) ? function (it) {
  210. return classofRaw(it) == 'String' ? split.call(it, '') : Object(it);
  211. } : Object;
  212. // `RequireObjectCoercible` abstract operation
  213. // https://tc39.es/ecma262/#sec-requireobjectcoercible
  214. var requireObjectCoercible = function (it) {
  215. if (it == undefined) throw TypeError("Can't call method on " + it);
  216. return it;
  217. };
  218. // toObject with fallback for non-array-like ES3 strings
  219. var toIndexedObject = function (it) {
  220. return indexedObject(requireObjectCoercible(it));
  221. };
  222. var isObject = function (it) {
  223. return typeof it === 'object' ? it !== null : typeof it === 'function';
  224. };
  225. // `ToPrimitive` abstract operation
  226. // https://tc39.es/ecma262/#sec-toprimitive
  227. // instead of the ES6 spec version, we didn't implement @@toPrimitive case
  228. // and the second argument - flag - preferred type is a string
  229. var toPrimitive = function (input, PREFERRED_STRING) {
  230. if (!isObject(input)) return input;
  231. var fn, val;
  232. if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
  233. if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val;
  234. if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
  235. throw TypeError("Can't convert object to primitive value");
  236. };
  237. var hasOwnProperty = {}.hasOwnProperty;
  238. var has$1 = function (it, key) {
  239. return hasOwnProperty.call(it, key);
  240. };
  241. var document$1 = global_1.document;
  242. // typeof document.createElement is 'object' in old IE
  243. var EXISTS = isObject(document$1) && isObject(document$1.createElement);
  244. var documentCreateElement = function (it) {
  245. return EXISTS ? document$1.createElement(it) : {};
  246. };
  247. // Thank's IE8 for his funny defineProperty
  248. var ie8DomDefine = !descriptors && !fails(function () {
  249. return Object.defineProperty(documentCreateElement('div'), 'a', {
  250. get: function () { return 7; }
  251. }).a != 7;
  252. });
  253. var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  254. // `Object.getOwnPropertyDescriptor` method
  255. // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
  256. var f$3 = descriptors ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
  257. O = toIndexedObject(O);
  258. P = toPrimitive(P, true);
  259. if (ie8DomDefine) try {
  260. return nativeGetOwnPropertyDescriptor(O, P);
  261. } catch (error) { /* empty */ }
  262. if (has$1(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]);
  263. };
  264. var objectGetOwnPropertyDescriptor = {
  265. f: f$3
  266. };
  267. var anObject = function (it) {
  268. if (!isObject(it)) {
  269. throw TypeError(String(it) + ' is not an object');
  270. } return it;
  271. };
  272. var nativeDefineProperty = Object.defineProperty;
  273. // `Object.defineProperty` method
  274. // https://tc39.es/ecma262/#sec-object.defineproperty
  275. var f$2 = descriptors ? nativeDefineProperty : function defineProperty(O, P, Attributes) {
  276. anObject(O);
  277. P = toPrimitive(P, true);
  278. anObject(Attributes);
  279. if (ie8DomDefine) try {
  280. return nativeDefineProperty(O, P, Attributes);
  281. } catch (error) { /* empty */ }
  282. if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
  283. if ('value' in Attributes) O[P] = Attributes.value;
  284. return O;
  285. };
  286. var objectDefineProperty = {
  287. f: f$2
  288. };
  289. var createNonEnumerableProperty = descriptors ? function (object, key, value) {
  290. return objectDefineProperty.f(object, key, createPropertyDescriptor(1, value));
  291. } : function (object, key, value) {
  292. object[key] = value;
  293. return object;
  294. };
  295. var setGlobal = function (key, value) {
  296. try {
  297. createNonEnumerableProperty(global_1, key, value);
  298. } catch (error) {
  299. global_1[key] = value;
  300. } return value;
  301. };
  302. var SHARED = '__core-js_shared__';
  303. var store$1 = global_1[SHARED] || setGlobal(SHARED, {});
  304. var sharedStore = store$1;
  305. var functionToString = Function.toString;
  306. // this helper broken in `3.4.1-3.4.4`, so we can't use `shared` helper
  307. if (typeof sharedStore.inspectSource != 'function') {
  308. sharedStore.inspectSource = function (it) {
  309. return functionToString.call(it);
  310. };
  311. }
  312. var inspectSource = sharedStore.inspectSource;
  313. var WeakMap$1 = global_1.WeakMap;
  314. var nativeWeakMap = typeof WeakMap$1 === 'function' && /native code/.test(inspectSource(WeakMap$1));
  315. var shared = createCommonjsModule(function (module) {
  316. (module.exports = function (key, value) {
  317. return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {});
  318. })('versions', []).push({
  319. version: '3.9.1',
  320. mode: 'global',
  321. copyright: '© 2021 Denis Pushkarev (zloirock.ru)'
  322. });
  323. });
  324. var id = 0;
  325. var postfix = Math.random();
  326. var uid = function (key) {
  327. return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);
  328. };
  329. var keys = shared('keys');
  330. var sharedKey = function (key) {
  331. return keys[key] || (keys[key] = uid(key));
  332. };
  333. var hiddenKeys$1 = {};
  334. var WeakMap = global_1.WeakMap;
  335. var set, get, has;
  336. var enforce = function (it) {
  337. return has(it) ? get(it) : set(it, {});
  338. };
  339. var getterFor = function (TYPE) {
  340. return function (it) {
  341. var state;
  342. if (!isObject(it) || (state = get(it)).type !== TYPE) {
  343. throw TypeError('Incompatible receiver, ' + TYPE + ' required');
  344. } return state;
  345. };
  346. };
  347. if (nativeWeakMap) {
  348. var store = sharedStore.state || (sharedStore.state = new WeakMap());
  349. var wmget = store.get;
  350. var wmhas = store.has;
  351. var wmset = store.set;
  352. set = function (it, metadata) {
  353. metadata.facade = it;
  354. wmset.call(store, it, metadata);
  355. return metadata;
  356. };
  357. get = function (it) {
  358. return wmget.call(store, it) || {};
  359. };
  360. has = function (it) {
  361. return wmhas.call(store, it);
  362. };
  363. } else {
  364. var STATE = sharedKey('state');
  365. hiddenKeys$1[STATE] = true;
  366. set = function (it, metadata) {
  367. metadata.facade = it;
  368. createNonEnumerableProperty(it, STATE, metadata);
  369. return metadata;
  370. };
  371. get = function (it) {
  372. return has$1(it, STATE) ? it[STATE] : {};
  373. };
  374. has = function (it) {
  375. return has$1(it, STATE);
  376. };
  377. }
  378. var internalState = {
  379. set: set,
  380. get: get,
  381. has: has,
  382. enforce: enforce,
  383. getterFor: getterFor
  384. };
  385. var redefine = createCommonjsModule(function (module) {
  386. var getInternalState = internalState.get;
  387. var enforceInternalState = internalState.enforce;
  388. var TEMPLATE = String(String).split('String');
  389. (module.exports = function (O, key, value, options) {
  390. var unsafe = options ? !!options.unsafe : false;
  391. var simple = options ? !!options.enumerable : false;
  392. var noTargetGet = options ? !!options.noTargetGet : false;
  393. var state;
  394. if (typeof value == 'function') {
  395. if (typeof key == 'string' && !has$1(value, 'name')) {
  396. createNonEnumerableProperty(value, 'name', key);
  397. }
  398. state = enforceInternalState(value);
  399. if (!state.source) {
  400. state.source = TEMPLATE.join(typeof key == 'string' ? key : '');
  401. }
  402. }
  403. if (O === global_1) {
  404. if (simple) O[key] = value;
  405. else setGlobal(key, value);
  406. return;
  407. } else if (!unsafe) {
  408. delete O[key];
  409. } else if (!noTargetGet && O[key]) {
  410. simple = true;
  411. }
  412. if (simple) O[key] = value;
  413. else createNonEnumerableProperty(O, key, value);
  414. // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
  415. })(Function.prototype, 'toString', function toString() {
  416. return typeof this == 'function' && getInternalState(this).source || inspectSource(this);
  417. });
  418. });
  419. var path = global_1;
  420. var aFunction$1 = function (variable) {
  421. return typeof variable == 'function' ? variable : undefined;
  422. };
  423. var getBuiltIn = function (namespace, method) {
  424. return arguments.length < 2 ? aFunction$1(path[namespace]) || aFunction$1(global_1[namespace])
  425. : path[namespace] && path[namespace][method] || global_1[namespace] && global_1[namespace][method];
  426. };
  427. var ceil = Math.ceil;
  428. var floor$1 = Math.floor;
  429. // `ToInteger` abstract operation
  430. // https://tc39.es/ecma262/#sec-tointeger
  431. var toInteger = function (argument) {
  432. return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor$1 : ceil)(argument);
  433. };
  434. var min$3 = Math.min;
  435. // `ToLength` abstract operation
  436. // https://tc39.es/ecma262/#sec-tolength
  437. var toLength = function (argument) {
  438. return argument > 0 ? min$3(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
  439. };
  440. var max$1 = Math.max;
  441. var min$2 = Math.min;
  442. // Helper for a popular repeating case of the spec:
  443. // Let integer be ? ToInteger(index).
  444. // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
  445. var toAbsoluteIndex = function (index, length) {
  446. var integer = toInteger(index);
  447. return integer < 0 ? max$1(integer + length, 0) : min$2(integer, length);
  448. };
  449. // `Array.prototype.{ indexOf, includes }` methods implementation
  450. var createMethod$3 = function (IS_INCLUDES) {
  451. return function ($this, el, fromIndex) {
  452. var O = toIndexedObject($this);
  453. var length = toLength(O.length);
  454. var index = toAbsoluteIndex(fromIndex, length);
  455. var value;
  456. // Array#includes uses SameValueZero equality algorithm
  457. // eslint-disable-next-line no-self-compare -- NaN check
  458. if (IS_INCLUDES && el != el) while (length > index) {
  459. value = O[index++];
  460. // eslint-disable-next-line no-self-compare -- NaN check
  461. if (value != value) return true;
  462. // Array#indexOf ignores holes, Array#includes - not
  463. } else for (;length > index; index++) {
  464. if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
  465. } return !IS_INCLUDES && -1;
  466. };
  467. };
  468. var arrayIncludes = {
  469. // `Array.prototype.includes` method
  470. // https://tc39.es/ecma262/#sec-array.prototype.includes
  471. includes: createMethod$3(true),
  472. // `Array.prototype.indexOf` method
  473. // https://tc39.es/ecma262/#sec-array.prototype.indexof
  474. indexOf: createMethod$3(false)
  475. };
  476. var indexOf = arrayIncludes.indexOf;
  477. var objectKeysInternal = function (object, names) {
  478. var O = toIndexedObject(object);
  479. var i = 0;
  480. var result = [];
  481. var key;
  482. for (key in O) !has$1(hiddenKeys$1, key) && has$1(O, key) && result.push(key);
  483. // Don't enum bug & hidden keys
  484. while (names.length > i) if (has$1(O, key = names[i++])) {
  485. ~indexOf(result, key) || result.push(key);
  486. }
  487. return result;
  488. };
  489. // IE8- don't enum bug keys
  490. var enumBugKeys = [
  491. 'constructor',
  492. 'hasOwnProperty',
  493. 'isPrototypeOf',
  494. 'propertyIsEnumerable',
  495. 'toLocaleString',
  496. 'toString',
  497. 'valueOf'
  498. ];
  499. var hiddenKeys = enumBugKeys.concat('length', 'prototype');
  500. // `Object.getOwnPropertyNames` method
  501. // https://tc39.es/ecma262/#sec-object.getownpropertynames
  502. var f$1 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
  503. return objectKeysInternal(O, hiddenKeys);
  504. };
  505. var objectGetOwnPropertyNames = {
  506. f: f$1
  507. };
  508. var f = Object.getOwnPropertySymbols;
  509. var objectGetOwnPropertySymbols = {
  510. f: f
  511. };
  512. // all object keys, includes non-enumerable and symbols
  513. var ownKeys = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
  514. var keys = objectGetOwnPropertyNames.f(anObject(it));
  515. var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
  516. return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
  517. };
  518. var copyConstructorProperties = function (target, source) {
  519. var keys = ownKeys(source);
  520. var defineProperty = objectDefineProperty.f;
  521. var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
  522. for (var i = 0; i < keys.length; i++) {
  523. var key = keys[i];
  524. if (!has$1(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
  525. }
  526. };
  527. var replacement = /#|\.prototype\./;
  528. var isForced = function (feature, detection) {
  529. var value = data[normalize(feature)];
  530. return value == POLYFILL ? true
  531. : value == NATIVE ? false
  532. : typeof detection == 'function' ? fails(detection)
  533. : !!detection;
  534. };
  535. var normalize = isForced.normalize = function (string) {
  536. return String(string).replace(replacement, '.').toLowerCase();
  537. };
  538. var data = isForced.data = {};
  539. var NATIVE = isForced.NATIVE = 'N';
  540. var POLYFILL = isForced.POLYFILL = 'P';
  541. var isForced_1 = isForced;
  542. var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
  543. /*
  544. options.target - name of the target object
  545. options.global - target is the global object
  546. options.stat - export as static methods of target
  547. options.proto - export as prototype methods of target
  548. options.real - real prototype method for the `pure` version
  549. options.forced - export even if the native feature is available
  550. options.bind - bind methods to the target, required for the `pure` version
  551. options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
  552. options.unsafe - use the simple assignment of property instead of delete + defineProperty
  553. options.sham - add a flag to not completely full polyfills
  554. options.enumerable - export as enumerable property
  555. options.noTargetGet - prevent calling a getter on target
  556. */
  557. var _export = function (options, source) {
  558. var TARGET = options.target;
  559. var GLOBAL = options.global;
  560. var STATIC = options.stat;
  561. var FORCED, target, key, targetProperty, sourceProperty, descriptor;
  562. if (GLOBAL) {
  563. target = global_1;
  564. } else if (STATIC) {
  565. target = global_1[TARGET] || setGlobal(TARGET, {});
  566. } else {
  567. target = (global_1[TARGET] || {}).prototype;
  568. }
  569. if (target) for (key in source) {
  570. sourceProperty = source[key];
  571. if (options.noTargetGet) {
  572. descriptor = getOwnPropertyDescriptor(target, key);
  573. targetProperty = descriptor && descriptor.value;
  574. } else targetProperty = target[key];
  575. FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
  576. // contained in target
  577. if (!FORCED && targetProperty !== undefined) {
  578. if (typeof sourceProperty === typeof targetProperty) continue;
  579. copyConstructorProperties(sourceProperty, targetProperty);
  580. }
  581. // add a flag to not completely full polyfills
  582. if (options.sham || (targetProperty && targetProperty.sham)) {
  583. createNonEnumerableProperty(sourceProperty, 'sham', true);
  584. }
  585. // extend global
  586. redefine(target, key, sourceProperty, options);
  587. }
  588. };
  589. var aFunction = function (it) {
  590. if (typeof it != 'function') {
  591. throw TypeError(String(it) + ' is not a function');
  592. } return it;
  593. };
  594. // optional / simple context binding
  595. var functionBindContext = function (fn, that, length) {
  596. aFunction(fn);
  597. if (that === undefined) return fn;
  598. switch (length) {
  599. case 0: return function () {
  600. return fn.call(that);
  601. };
  602. case 1: return function (a) {
  603. return fn.call(that, a);
  604. };
  605. case 2: return function (a, b) {
  606. return fn.call(that, a, b);
  607. };
  608. case 3: return function (a, b, c) {
  609. return fn.call(that, a, b, c);
  610. };
  611. }
  612. return function (/* ...args */) {
  613. return fn.apply(that, arguments);
  614. };
  615. };
  616. // `ToObject` abstract operation
  617. // https://tc39.es/ecma262/#sec-toobject
  618. var toObject = function (argument) {
  619. return Object(requireObjectCoercible(argument));
  620. };
  621. // `IsArray` abstract operation
  622. // https://tc39.es/ecma262/#sec-isarray
  623. var isArray = Array.isArray || function isArray(arg) {
  624. return classofRaw(arg) == 'Array';
  625. };
  626. var engineIsNode = classofRaw(global_1.process) == 'process';
  627. var engineUserAgent = getBuiltIn('navigator', 'userAgent') || '';
  628. var process = global_1.process;
  629. var versions = process && process.versions;
  630. var v8 = versions && versions.v8;
  631. var match, version;
  632. if (v8) {
  633. match = v8.split('.');
  634. version = match[0] + match[1];
  635. } else if (engineUserAgent) {
  636. match = engineUserAgent.match(/Edge\/(\d+)/);
  637. if (!match || match[1] >= 74) {
  638. match = engineUserAgent.match(/Chrome\/(\d+)/);
  639. if (match) version = match[1];
  640. }
  641. }
  642. var engineV8Version = version && +version;
  643. var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () {
  644. /* global Symbol -- required for testing */
  645. return !Symbol.sham &&
  646. // Chrome 38 Symbol has incorrect toString conversion
  647. // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
  648. (engineIsNode ? engineV8Version === 38 : engineV8Version > 37 && engineV8Version < 41);
  649. });
  650. var useSymbolAsUid = nativeSymbol
  651. /* global Symbol -- safe */
  652. && !Symbol.sham
  653. && typeof Symbol.iterator == 'symbol';
  654. var WellKnownSymbolsStore = shared('wks');
  655. var Symbol$1 = global_1.Symbol;
  656. var createWellKnownSymbol = useSymbolAsUid ? Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid;
  657. var wellKnownSymbol = function (name) {
  658. if (!has$1(WellKnownSymbolsStore, name) || !(nativeSymbol || typeof WellKnownSymbolsStore[name] == 'string')) {
  659. if (nativeSymbol && has$1(Symbol$1, name)) {
  660. WellKnownSymbolsStore[name] = Symbol$1[name];
  661. } else {
  662. WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name);
  663. }
  664. } return WellKnownSymbolsStore[name];
  665. };
  666. var SPECIES$3 = wellKnownSymbol('species');
  667. // `ArraySpeciesCreate` abstract operation
  668. // https://tc39.es/ecma262/#sec-arrayspeciescreate
  669. var arraySpeciesCreate = function (originalArray, length) {
  670. var C;
  671. if (isArray(originalArray)) {
  672. C = originalArray.constructor;
  673. // cross-realm fallback
  674. if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;
  675. else if (isObject(C)) {
  676. C = C[SPECIES$3];
  677. if (C === null) C = undefined;
  678. }
  679. } return new (C === undefined ? Array : C)(length === 0 ? 0 : length);
  680. };
  681. var push = [].push;
  682. // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterOut }` methods implementation
  683. var createMethod$2 = function (TYPE) {
  684. var IS_MAP = TYPE == 1;
  685. var IS_FILTER = TYPE == 2;
  686. var IS_SOME = TYPE == 3;
  687. var IS_EVERY = TYPE == 4;
  688. var IS_FIND_INDEX = TYPE == 6;
  689. var IS_FILTER_OUT = TYPE == 7;
  690. var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
  691. return function ($this, callbackfn, that, specificCreate) {
  692. var O = toObject($this);
  693. var self = indexedObject(O);
  694. var boundFunction = functionBindContext(callbackfn, that, 3);
  695. var length = toLength(self.length);
  696. var index = 0;
  697. var create = specificCreate || arraySpeciesCreate;
  698. var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_OUT ? create($this, 0) : undefined;
  699. var value, result;
  700. for (;length > index; index++) if (NO_HOLES || index in self) {
  701. value = self[index];
  702. result = boundFunction(value, index, O);
  703. if (TYPE) {
  704. if (IS_MAP) target[index] = result; // map
  705. else if (result) switch (TYPE) {
  706. case 3: return true; // some
  707. case 5: return value; // find
  708. case 6: return index; // findIndex
  709. case 2: push.call(target, value); // filter
  710. } else switch (TYPE) {
  711. case 4: return false; // every
  712. case 7: push.call(target, value); // filterOut
  713. }
  714. }
  715. }
  716. return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
  717. };
  718. };
  719. var arrayIteration = {
  720. // `Array.prototype.forEach` method
  721. // https://tc39.es/ecma262/#sec-array.prototype.foreach
  722. forEach: createMethod$2(0),
  723. // `Array.prototype.map` method
  724. // https://tc39.es/ecma262/#sec-array.prototype.map
  725. map: createMethod$2(1),
  726. // `Array.prototype.filter` method
  727. // https://tc39.es/ecma262/#sec-array.prototype.filter
  728. filter: createMethod$2(2),
  729. // `Array.prototype.some` method
  730. // https://tc39.es/ecma262/#sec-array.prototype.some
  731. some: createMethod$2(3),
  732. // `Array.prototype.every` method
  733. // https://tc39.es/ecma262/#sec-array.prototype.every
  734. every: createMethod$2(4),
  735. // `Array.prototype.find` method
  736. // https://tc39.es/ecma262/#sec-array.prototype.find
  737. find: createMethod$2(5),
  738. // `Array.prototype.findIndex` method
  739. // https://tc39.es/ecma262/#sec-array.prototype.findIndex
  740. findIndex: createMethod$2(6),
  741. // `Array.prototype.filterOut` method
  742. // https://github.com/tc39/proposal-array-filtering
  743. filterOut: createMethod$2(7)
  744. };
  745. // `Object.keys` method
  746. // https://tc39.es/ecma262/#sec-object.keys
  747. var objectKeys = Object.keys || function keys(O) {
  748. return objectKeysInternal(O, enumBugKeys);
  749. };
  750. // `Object.defineProperties` method
  751. // https://tc39.es/ecma262/#sec-object.defineproperties
  752. var objectDefineProperties = descriptors ? Object.defineProperties : function defineProperties(O, Properties) {
  753. anObject(O);
  754. var keys = objectKeys(Properties);
  755. var length = keys.length;
  756. var index = 0;
  757. var key;
  758. while (length > index) objectDefineProperty.f(O, key = keys[index++], Properties[key]);
  759. return O;
  760. };
  761. var html = getBuiltIn('document', 'documentElement');
  762. var GT = '>';
  763. var LT = '<';
  764. var PROTOTYPE = 'prototype';
  765. var SCRIPT = 'script';
  766. var IE_PROTO = sharedKey('IE_PROTO');
  767. var EmptyConstructor = function () { /* empty */ };
  768. var scriptTag = function (content) {
  769. return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
  770. };
  771. // Create object with fake `null` prototype: use ActiveX Object with cleared prototype
  772. var NullProtoObjectViaActiveX = function (activeXDocument) {
  773. activeXDocument.write(scriptTag(''));
  774. activeXDocument.close();
  775. var temp = activeXDocument.parentWindow.Object;
  776. activeXDocument = null; // avoid memory leak
  777. return temp;
  778. };
  779. // Create object with fake `null` prototype: use iframe Object with cleared prototype
  780. var NullProtoObjectViaIFrame = function () {
  781. // Thrash, waste and sodomy: IE GC bug
  782. var iframe = documentCreateElement('iframe');
  783. var JS = 'java' + SCRIPT + ':';
  784. var iframeDocument;
  785. iframe.style.display = 'none';
  786. html.appendChild(iframe);
  787. // https://github.com/zloirock/core-js/issues/475
  788. iframe.src = String(JS);
  789. iframeDocument = iframe.contentWindow.document;
  790. iframeDocument.open();
  791. iframeDocument.write(scriptTag('document.F=Object'));
  792. iframeDocument.close();
  793. return iframeDocument.F;
  794. };
  795. // Check for document.domain and active x support
  796. // No need to use active x approach when document.domain is not set
  797. // see https://github.com/es-shims/es5-shim/issues/150
  798. // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
  799. // avoid IE GC bug
  800. var activeXDocument;
  801. var NullProtoObject = function () {
  802. try {
  803. /* global ActiveXObject -- old IE */
  804. activeXDocument = document.domain && new ActiveXObject('htmlfile');
  805. } catch (error) { /* ignore */ }
  806. NullProtoObject = activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame();
  807. var length = enumBugKeys.length;
  808. while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
  809. return NullProtoObject();
  810. };
  811. hiddenKeys$1[IE_PROTO] = true;
  812. // `Object.create` method
  813. // https://tc39.es/ecma262/#sec-object.create
  814. var objectCreate = Object.create || function create(O, Properties) {
  815. var result;
  816. if (O !== null) {
  817. EmptyConstructor[PROTOTYPE] = anObject(O);
  818. result = new EmptyConstructor();
  819. EmptyConstructor[PROTOTYPE] = null;
  820. // add "__proto__" for Object.getPrototypeOf polyfill
  821. result[IE_PROTO] = O;
  822. } else result = NullProtoObject();
  823. return Properties === undefined ? result : objectDefineProperties(result, Properties);
  824. };
  825. var UNSCOPABLES = wellKnownSymbol('unscopables');
  826. var ArrayPrototype = Array.prototype;
  827. // Array.prototype[@@unscopables]
  828. // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
  829. if (ArrayPrototype[UNSCOPABLES] == undefined) {
  830. objectDefineProperty.f(ArrayPrototype, UNSCOPABLES, {
  831. configurable: true,
  832. value: objectCreate(null)
  833. });
  834. }
  835. // add a key to Array.prototype[@@unscopables]
  836. var addToUnscopables = function (key) {
  837. ArrayPrototype[UNSCOPABLES][key] = true;
  838. };
  839. var $find = arrayIteration.find;
  840. var FIND = 'find';
  841. var SKIPS_HOLES = true;
  842. // Shouldn't skip holes
  843. if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });
  844. // `Array.prototype.find` method
  845. // https://tc39.es/ecma262/#sec-array.prototype.find
  846. _export({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
  847. find: function find(callbackfn /* , that = undefined */) {
  848. return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  849. }
  850. });
  851. // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
  852. addToUnscopables(FIND);
  853. var SPECIES$2 = wellKnownSymbol('species');
  854. var arrayMethodHasSpeciesSupport = function (METHOD_NAME) {
  855. // We can't use this feature detection in V8 since it causes
  856. // deoptimization and serious performance degradation
  857. // https://github.com/zloirock/core-js/issues/677
  858. return engineV8Version >= 51 || !fails(function () {
  859. var array = [];
  860. var constructor = array.constructor = {};
  861. constructor[SPECIES$2] = function () {
  862. return { foo: 1 };
  863. };
  864. return array[METHOD_NAME](Boolean).foo !== 1;
  865. });
  866. };
  867. var $filter = arrayIteration.filter;
  868. var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('filter');
  869. // `Array.prototype.filter` method
  870. // https://tc39.es/ecma262/#sec-array.prototype.filter
  871. // with adding support of @@species
  872. _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
  873. filter: function filter(callbackfn /* , thisArg */) {
  874. return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  875. }
  876. });
  877. var FAILS_ON_PRIMITIVES = fails(function () { objectKeys(1); });
  878. // `Object.keys` method
  879. // https://tc39.es/ecma262/#sec-object.keys
  880. _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
  881. keys: function keys(it) {
  882. return objectKeys(toObject(it));
  883. }
  884. });
  885. var createProperty = function (object, key, value) {
  886. var propertyKey = toPrimitive(key);
  887. if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value));
  888. else object[propertyKey] = value;
  889. };
  890. var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
  891. var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
  892. var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';
  893. // We can't use this feature detection in V8 since it causes
  894. // deoptimization and serious performance degradation
  895. // https://github.com/zloirock/core-js/issues/679
  896. var IS_CONCAT_SPREADABLE_SUPPORT = engineV8Version >= 51 || !fails(function () {
  897. var array = [];
  898. array[IS_CONCAT_SPREADABLE] = false;
  899. return array.concat()[0] !== array;
  900. });
  901. var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
  902. var isConcatSpreadable = function (O) {
  903. if (!isObject(O)) return false;
  904. var spreadable = O[IS_CONCAT_SPREADABLE];
  905. return spreadable !== undefined ? !!spreadable : isArray(O);
  906. };
  907. var FORCED$2 = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
  908. // `Array.prototype.concat` method
  909. // https://tc39.es/ecma262/#sec-array.prototype.concat
  910. // with adding support of @@isConcatSpreadable and @@species
  911. _export({ target: 'Array', proto: true, forced: FORCED$2 }, {
  912. // eslint-disable-next-line no-unused-vars -- required for `.length`
  913. concat: function concat(arg) {
  914. var O = toObject(this);
  915. var A = arraySpeciesCreate(O, 0);
  916. var n = 0;
  917. var i, k, length, len, E;
  918. for (i = -1, length = arguments.length; i < length; i++) {
  919. E = i === -1 ? O : arguments[i];
  920. if (isConcatSpreadable(E)) {
  921. len = toLength(E.length);
  922. if (n + len > MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
  923. for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
  924. } else {
  925. if (n >= MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
  926. createProperty(A, n++, E);
  927. }
  928. }
  929. A.length = n;
  930. return A;
  931. }
  932. });
  933. var $includes = arrayIncludes.includes;
  934. // `Array.prototype.includes` method
  935. // https://tc39.es/ecma262/#sec-array.prototype.includes
  936. _export({ target: 'Array', proto: true }, {
  937. includes: function includes(el /* , fromIndex = 0 */) {
  938. return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
  939. }
  940. });
  941. // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
  942. addToUnscopables('includes');
  943. var MATCH$1 = wellKnownSymbol('match');
  944. // `IsRegExp` abstract operation
  945. // https://tc39.es/ecma262/#sec-isregexp
  946. var isRegexp = function (it) {
  947. var isRegExp;
  948. return isObject(it) && ((isRegExp = it[MATCH$1]) !== undefined ? !!isRegExp : classofRaw(it) == 'RegExp');
  949. };
  950. var notARegexp = function (it) {
  951. if (isRegexp(it)) {
  952. throw TypeError("The method doesn't accept regular expressions");
  953. } return it;
  954. };
  955. var MATCH = wellKnownSymbol('match');
  956. var correctIsRegexpLogic = function (METHOD_NAME) {
  957. var regexp = /./;
  958. try {
  959. '/./'[METHOD_NAME](regexp);
  960. } catch (error1) {
  961. try {
  962. regexp[MATCH] = false;
  963. return '/./'[METHOD_NAME](regexp);
  964. } catch (error2) { /* empty */ }
  965. } return false;
  966. };
  967. // `String.prototype.includes` method
  968. // https://tc39.es/ecma262/#sec-string.prototype.includes
  969. _export({ target: 'String', proto: true, forced: !correctIsRegexpLogic('includes') }, {
  970. includes: function includes(searchString /* , position = 0 */) {
  971. return !!~String(requireObjectCoercible(this))
  972. .indexOf(notARegexp(searchString), arguments.length > 1 ? arguments[1] : undefined);
  973. }
  974. });
  975. // iterable DOM collections
  976. // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
  977. var domIterables = {
  978. CSSRuleList: 0,
  979. CSSStyleDeclaration: 0,
  980. CSSValueList: 0,
  981. ClientRectList: 0,
  982. DOMRectList: 0,
  983. DOMStringList: 0,
  984. DOMTokenList: 1,
  985. DataTransferItemList: 0,
  986. FileList: 0,
  987. HTMLAllCollection: 0,
  988. HTMLCollection: 0,
  989. HTMLFormElement: 0,
  990. HTMLSelectElement: 0,
  991. MediaList: 0,
  992. MimeTypeArray: 0,
  993. NamedNodeMap: 0,
  994. NodeList: 1,
  995. PaintRequestList: 0,
  996. Plugin: 0,
  997. PluginArray: 0,
  998. SVGLengthList: 0,
  999. SVGNumberList: 0,
  1000. SVGPathSegList: 0,
  1001. SVGPointList: 0,
  1002. SVGStringList: 0,
  1003. SVGTransformList: 0,
  1004. SourceBufferList: 0,
  1005. StyleSheetList: 0,
  1006. TextTrackCueList: 0,
  1007. TextTrackList: 0,
  1008. TouchList: 0
  1009. };
  1010. var arrayMethodIsStrict = function (METHOD_NAME, argument) {
  1011. var method = [][METHOD_NAME];
  1012. return !!method && fails(function () {
  1013. // eslint-disable-next-line no-useless-call,no-throw-literal -- required for testing
  1014. method.call(null, argument || function () { throw 1; }, 1);
  1015. });
  1016. };
  1017. var $forEach = arrayIteration.forEach;
  1018. var STRICT_METHOD$3 = arrayMethodIsStrict('forEach');
  1019. // `Array.prototype.forEach` method implementation
  1020. // https://tc39.es/ecma262/#sec-array.prototype.foreach
  1021. var arrayForEach = !STRICT_METHOD$3 ? function forEach(callbackfn /* , thisArg */) {
  1022. return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  1023. } : [].forEach;
  1024. for (var COLLECTION_NAME in domIterables) {
  1025. var Collection = global_1[COLLECTION_NAME];
  1026. var CollectionPrototype = Collection && Collection.prototype;
  1027. // some Chrome versions have non-configurable methods on DOMTokenList
  1028. if (CollectionPrototype && CollectionPrototype.forEach !== arrayForEach) try {
  1029. createNonEnumerableProperty(CollectionPrototype, 'forEach', arrayForEach);
  1030. } catch (error) {
  1031. CollectionPrototype.forEach = arrayForEach;
  1032. }
  1033. }
  1034. var TO_STRING_TAG$1 = wellKnownSymbol('toStringTag');
  1035. var test$1 = {};
  1036. test$1[TO_STRING_TAG$1] = 'z';
  1037. var toStringTagSupport = String(test$1) === '[object z]';
  1038. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  1039. // ES3 wrong here
  1040. var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
  1041. // fallback for IE11 Script Access Denied error
  1042. var tryGet = function (it, key) {
  1043. try {
  1044. return it[key];
  1045. } catch (error) { /* empty */ }
  1046. };
  1047. // getting tag from ES6+ `Object.prototype.toString`
  1048. var classof = toStringTagSupport ? classofRaw : function (it) {
  1049. var O, tag, result;
  1050. return it === undefined ? 'Undefined' : it === null ? 'Null'
  1051. // @@toStringTag case
  1052. : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG)) == 'string' ? tag
  1053. // builtinTag case
  1054. : CORRECT_ARGUMENTS ? classofRaw(O)
  1055. // ES3 arguments fallback
  1056. : (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result;
  1057. };
  1058. // `Object.prototype.toString` method implementation
  1059. // https://tc39.es/ecma262/#sec-object.prototype.tostring
  1060. var objectToString = toStringTagSupport ? {}.toString : function toString() {
  1061. return '[object ' + classof(this) + ']';
  1062. };
  1063. // `Object.prototype.toString` method
  1064. // https://tc39.es/ecma262/#sec-object.prototype.tostring
  1065. if (!toStringTagSupport) {
  1066. redefine(Object.prototype, 'toString', objectToString, { unsafe: true });
  1067. }
  1068. // `RegExp.prototype.flags` getter implementation
  1069. // https://tc39.es/ecma262/#sec-get-regexp.prototype.flags
  1070. var regexpFlags = function () {
  1071. var that = anObject(this);
  1072. var result = '';
  1073. if (that.global) result += 'g';
  1074. if (that.ignoreCase) result += 'i';
  1075. if (that.multiline) result += 'm';
  1076. if (that.dotAll) result += 's';
  1077. if (that.unicode) result += 'u';
  1078. if (that.sticky) result += 'y';
  1079. return result;
  1080. };
  1081. var TO_STRING = 'toString';
  1082. var RegExpPrototype = RegExp.prototype;
  1083. var nativeToString = RegExpPrototype[TO_STRING];
  1084. var NOT_GENERIC = fails(function () { return nativeToString.call({ source: 'a', flags: 'b' }) != '/a/b'; });
  1085. // FF44- RegExp#toString has a wrong name
  1086. var INCORRECT_NAME = nativeToString.name != TO_STRING;
  1087. // `RegExp.prototype.toString` method
  1088. // https://tc39.es/ecma262/#sec-regexp.prototype.tostring
  1089. if (NOT_GENERIC || INCORRECT_NAME) {
  1090. redefine(RegExp.prototype, TO_STRING, function toString() {
  1091. var R = anObject(this);
  1092. var p = String(R.source);
  1093. var rf = R.flags;
  1094. var f = String(rf === undefined && R instanceof RegExp && !('flags' in RegExpPrototype) ? regexpFlags.call(R) : rf);
  1095. return '/' + p + '/' + f;
  1096. }, { unsafe: true });
  1097. }
  1098. var $indexOf = arrayIncludes.indexOf;
  1099. var nativeIndexOf = [].indexOf;
  1100. var NEGATIVE_ZERO = !!nativeIndexOf && 1 / [1].indexOf(1, -0) < 0;
  1101. var STRICT_METHOD$2 = arrayMethodIsStrict('indexOf');
  1102. // `Array.prototype.indexOf` method
  1103. // https://tc39.es/ecma262/#sec-array.prototype.indexof
  1104. _export({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || !STRICT_METHOD$2 }, {
  1105. indexOf: function indexOf(searchElement /* , fromIndex = 0 */) {
  1106. return NEGATIVE_ZERO
  1107. // convert -0 to +0
  1108. ? nativeIndexOf.apply(this, arguments) || 0
  1109. : $indexOf(this, searchElement, arguments.length > 1 ? arguments[1] : undefined);
  1110. }
  1111. });
  1112. // babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError,
  1113. // so we use an intermediate function.
  1114. function RE(s, f) {
  1115. return RegExp(s, f);
  1116. }
  1117. var UNSUPPORTED_Y$1 = fails(function () {
  1118. // babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError
  1119. var re = RE('a', 'y');
  1120. re.lastIndex = 2;
  1121. return re.exec('abcd') != null;
  1122. });
  1123. var BROKEN_CARET = fails(function () {
  1124. // https://bugzilla.mozilla.org/show_bug.cgi?id=773687
  1125. var re = RE('^r', 'gy');
  1126. re.lastIndex = 2;
  1127. return re.exec('str') != null;
  1128. });
  1129. var regexpStickyHelpers = {
  1130. UNSUPPORTED_Y: UNSUPPORTED_Y$1,
  1131. BROKEN_CARET: BROKEN_CARET
  1132. };
  1133. var nativeExec = RegExp.prototype.exec;
  1134. // This always refers to the native implementation, because the
  1135. // String#replace polyfill uses ./fix-regexp-well-known-symbol-logic.js,
  1136. // which loads this file before patching the method.
  1137. var nativeReplace = String.prototype.replace;
  1138. var patchedExec = nativeExec;
  1139. var UPDATES_LAST_INDEX_WRONG = (function () {
  1140. var re1 = /a/;
  1141. var re2 = /b*/g;
  1142. nativeExec.call(re1, 'a');
  1143. nativeExec.call(re2, 'a');
  1144. return re1.lastIndex !== 0 || re2.lastIndex !== 0;
  1145. })();
  1146. var UNSUPPORTED_Y = regexpStickyHelpers.UNSUPPORTED_Y || regexpStickyHelpers.BROKEN_CARET;
  1147. // nonparticipating capturing group, copied from es5-shim's String#split patch.
  1148. // eslint-disable-next-line regexp/no-assertion-capturing-group, regexp/no-empty-group -- required for testing
  1149. var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
  1150. var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y;
  1151. if (PATCH) {
  1152. patchedExec = function exec(str) {
  1153. var re = this;
  1154. var lastIndex, reCopy, match, i;
  1155. var sticky = UNSUPPORTED_Y && re.sticky;
  1156. var flags = regexpFlags.call(re);
  1157. var source = re.source;
  1158. var charsAdded = 0;
  1159. var strCopy = str;
  1160. if (sticky) {
  1161. flags = flags.replace('y', '');
  1162. if (flags.indexOf('g') === -1) {
  1163. flags += 'g';
  1164. }
  1165. strCopy = String(str).slice(re.lastIndex);
  1166. // Support anchored sticky behavior.
  1167. if (re.lastIndex > 0 && (!re.multiline || re.multiline && str[re.lastIndex - 1] !== '\n')) {
  1168. source = '(?: ' + source + ')';
  1169. strCopy = ' ' + strCopy;
  1170. charsAdded++;
  1171. }
  1172. // ^(? + rx + ) is needed, in combination with some str slicing, to
  1173. // simulate the 'y' flag.
  1174. reCopy = new RegExp('^(?:' + source + ')', flags);
  1175. }
  1176. if (NPCG_INCLUDED) {
  1177. reCopy = new RegExp('^' + source + '$(?!\\s)', flags);
  1178. }
  1179. if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;
  1180. match = nativeExec.call(sticky ? reCopy : re, strCopy);
  1181. if (sticky) {
  1182. if (match) {
  1183. match.input = match.input.slice(charsAdded);
  1184. match[0] = match[0].slice(charsAdded);
  1185. match.index = re.lastIndex;
  1186. re.lastIndex += match[0].length;
  1187. } else re.lastIndex = 0;
  1188. } else if (UPDATES_LAST_INDEX_WRONG && match) {
  1189. re.lastIndex = re.global ? match.index + match[0].length : lastIndex;
  1190. }
  1191. if (NPCG_INCLUDED && match && match.length > 1) {
  1192. // Fix browsers whose `exec` methods don't consistently return `undefined`
  1193. // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/
  1194. nativeReplace.call(match[0], reCopy, function () {
  1195. for (i = 1; i < arguments.length - 2; i++) {
  1196. if (arguments[i] === undefined) match[i] = undefined;
  1197. }
  1198. });
  1199. }
  1200. return match;
  1201. };
  1202. }
  1203. var regexpExec = patchedExec;
  1204. // `RegExp.prototype.exec` method
  1205. // https://tc39.es/ecma262/#sec-regexp.prototype.exec
  1206. _export({ target: 'RegExp', proto: true, forced: /./.exec !== regexpExec }, {
  1207. exec: regexpExec
  1208. });
  1209. // a string of all valid unicode whitespaces
  1210. var whitespaces = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' +
  1211. '\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
  1212. var whitespace = '[' + whitespaces + ']';
  1213. var ltrim = RegExp('^' + whitespace + whitespace + '*');
  1214. var rtrim = RegExp(whitespace + whitespace + '*$');
  1215. // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
  1216. var createMethod$1 = function (TYPE) {
  1217. return function ($this) {
  1218. var string = String(requireObjectCoercible($this));
  1219. if (TYPE & 1) string = string.replace(ltrim, '');
  1220. if (TYPE & 2) string = string.replace(rtrim, '');
  1221. return string;
  1222. };
  1223. };
  1224. var stringTrim = {
  1225. // `String.prototype.{ trimLeft, trimStart }` methods
  1226. // https://tc39.es/ecma262/#sec-string.prototype.trimstart
  1227. start: createMethod$1(1),
  1228. // `String.prototype.{ trimRight, trimEnd }` methods
  1229. // https://tc39.es/ecma262/#sec-string.prototype.trimend
  1230. end: createMethod$1(2),
  1231. // `String.prototype.trim` method
  1232. // https://tc39.es/ecma262/#sec-string.prototype.trim
  1233. trim: createMethod$1(3)
  1234. };
  1235. var trim = stringTrim.trim;
  1236. var $parseInt = global_1.parseInt;
  1237. var hex = /^[+-]?0[Xx]/;
  1238. var FORCED$1 = $parseInt(whitespaces + '08') !== 8 || $parseInt(whitespaces + '0x16') !== 22;
  1239. // `parseInt` method
  1240. // https://tc39.es/ecma262/#sec-parseint-string-radix
  1241. var numberParseInt = FORCED$1 ? function parseInt(string, radix) {
  1242. var S = trim(String(string));
  1243. return $parseInt(S, (radix >>> 0) || (hex.test(S) ? 16 : 10));
  1244. } : $parseInt;
  1245. // `parseInt` method
  1246. // https://tc39.es/ecma262/#sec-parseint-string-radix
  1247. _export({ global: true, forced: parseInt != numberParseInt }, {
  1248. parseInt: numberParseInt
  1249. });
  1250. var non = '\u200B\u0085\u180E';
  1251. // check that a method works with the correct list
  1252. // of whitespaces and has a correct name
  1253. var stringTrimForced = function (METHOD_NAME) {
  1254. return fails(function () {
  1255. return !!whitespaces[METHOD_NAME]() || non[METHOD_NAME]() != non || whitespaces[METHOD_NAME].name !== METHOD_NAME;
  1256. });
  1257. };
  1258. var $trim = stringTrim.trim;
  1259. // `String.prototype.trim` method
  1260. // https://tc39.es/ecma262/#sec-string.prototype.trim
  1261. _export({ target: 'String', proto: true, forced: stringTrimForced('trim') }, {
  1262. trim: function trim() {
  1263. return $trim(this);
  1264. }
  1265. });
  1266. var nativeAssign = Object.assign;
  1267. var defineProperty = Object.defineProperty;
  1268. // `Object.assign` method
  1269. // https://tc39.es/ecma262/#sec-object.assign
  1270. var objectAssign = !nativeAssign || fails(function () {
  1271. // should have correct order of operations (Edge bug)
  1272. if (descriptors && nativeAssign({ b: 1 }, nativeAssign(defineProperty({}, 'a', {
  1273. enumerable: true,
  1274. get: function () {
  1275. defineProperty(this, 'b', {
  1276. value: 3,
  1277. enumerable: false
  1278. });
  1279. }
  1280. }), { b: 2 })).b !== 1) return true;
  1281. // should work with symbols and should have deterministic property order (V8 bug)
  1282. var A = {};
  1283. var B = {};
  1284. /* global Symbol -- required for testing */
  1285. var symbol = Symbol();
  1286. var alphabet = 'abcdefghijklmnopqrst';
  1287. A[symbol] = 7;
  1288. alphabet.split('').forEach(function (chr) { B[chr] = chr; });
  1289. return nativeAssign({}, A)[symbol] != 7 || objectKeys(nativeAssign({}, B)).join('') != alphabet;
  1290. }) ? function assign(target, source) { // eslint-disable-line no-unused-vars -- required for `.length`
  1291. var T = toObject(target);
  1292. var argumentsLength = arguments.length;
  1293. var index = 1;
  1294. var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
  1295. var propertyIsEnumerable = objectPropertyIsEnumerable.f;
  1296. while (argumentsLength > index) {
  1297. var S = indexedObject(arguments[index++]);
  1298. var keys = getOwnPropertySymbols ? objectKeys(S).concat(getOwnPropertySymbols(S)) : objectKeys(S);
  1299. var length = keys.length;
  1300. var j = 0;
  1301. var key;
  1302. while (length > j) {
  1303. key = keys[j++];
  1304. if (!descriptors || propertyIsEnumerable.call(S, key)) T[key] = S[key];
  1305. }
  1306. } return T;
  1307. } : nativeAssign;
  1308. // `Object.assign` method
  1309. // https://tc39.es/ecma262/#sec-object.assign
  1310. _export({ target: 'Object', stat: true, forced: Object.assign !== objectAssign }, {
  1311. assign: objectAssign
  1312. });
  1313. var test = [];
  1314. var nativeSort = test.sort;
  1315. // IE8-
  1316. var FAILS_ON_UNDEFINED = fails(function () {
  1317. test.sort(undefined);
  1318. });
  1319. // V8 bug
  1320. var FAILS_ON_NULL = fails(function () {
  1321. test.sort(null);
  1322. });
  1323. // Old WebKit
  1324. var STRICT_METHOD$1 = arrayMethodIsStrict('sort');
  1325. var FORCED = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD$1;
  1326. // `Array.prototype.sort` method
  1327. // https://tc39.es/ecma262/#sec-array.prototype.sort
  1328. _export({ target: 'Array', proto: true, forced: FORCED }, {
  1329. sort: function sort(comparefn) {
  1330. return comparefn === undefined
  1331. ? nativeSort.call(toObject(this))
  1332. : nativeSort.call(toObject(this), aFunction(comparefn));
  1333. }
  1334. });
  1335. // TODO: Remove from `core-js@4` since it's moved to entry points
  1336. var SPECIES$1 = wellKnownSymbol('species');
  1337. var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () {
  1338. // #replace needs built-in support for named groups.
  1339. // #match works fine because it just return the exec results, even if it has
  1340. // a "grops" property.
  1341. var re = /./;
  1342. re.exec = function () {
  1343. var result = [];
  1344. result.groups = { a: '7' };
  1345. return result;
  1346. };
  1347. return ''.replace(re, '$<a>') !== '7';
  1348. });
  1349. // IE <= 11 replaces $0 with the whole match, as if it was $&
  1350. // https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0
  1351. var REPLACE_KEEPS_$0 = (function () {
  1352. return 'a'.replace(/./, '$0') === '$0';
  1353. })();
  1354. var REPLACE = wellKnownSymbol('replace');
  1355. // Safari <= 13.0.3(?) substitutes nth capture where n>m with an empty string
  1356. var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () {
  1357. if (/./[REPLACE]) {
  1358. return /./[REPLACE]('a', '$0') === '';
  1359. }
  1360. return false;
  1361. })();
  1362. // Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec
  1363. // Weex JS has frozen built-in prototypes, so use try / catch wrapper
  1364. var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () {
  1365. // eslint-disable-next-line regexp/no-empty-group -- required for testing
  1366. var re = /(?:)/;
  1367. var originalExec = re.exec;
  1368. re.exec = function () { return originalExec.apply(this, arguments); };
  1369. var result = 'ab'.split(re);
  1370. return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b';
  1371. });
  1372. var fixRegexpWellKnownSymbolLogic = function (KEY, length, exec, sham) {
  1373. var SYMBOL = wellKnownSymbol(KEY);
  1374. var DELEGATES_TO_SYMBOL = !fails(function () {
  1375. // String methods call symbol-named RegEp methods
  1376. var O = {};
  1377. O[SYMBOL] = function () { return 7; };
  1378. return ''[KEY](O) != 7;
  1379. });
  1380. var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails(function () {
  1381. // Symbol-named RegExp methods call .exec
  1382. var execCalled = false;
  1383. var re = /a/;
  1384. if (KEY === 'split') {
  1385. // We can't use real regex here since it causes deoptimization
  1386. // and serious performance degradation in V8
  1387. // https://github.com/zloirock/core-js/issues/306
  1388. re = {};
  1389. // RegExp[@@split] doesn't call the regex's exec method, but first creates
  1390. // a new one. We need to return the patched regex when creating the new one.
  1391. re.constructor = {};
  1392. re.constructor[SPECIES$1] = function () { return re; };
  1393. re.flags = '';
  1394. re[SYMBOL] = /./[SYMBOL];
  1395. }
  1396. re.exec = function () { execCalled = true; return null; };
  1397. re[SYMBOL]('');
  1398. return !execCalled;
  1399. });
  1400. if (
  1401. !DELEGATES_TO_SYMBOL ||
  1402. !DELEGATES_TO_EXEC ||
  1403. (KEY === 'replace' && !(
  1404. REPLACE_SUPPORTS_NAMED_GROUPS &&
  1405. REPLACE_KEEPS_$0 &&
  1406. !REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE
  1407. )) ||
  1408. (KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC)
  1409. ) {
  1410. var nativeRegExpMethod = /./[SYMBOL];
  1411. var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {
  1412. if (regexp.exec === regexpExec) {
  1413. if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
  1414. // The native String method already delegates to @@method (this
  1415. // polyfilled function), leasing to infinite recursion.
  1416. // We avoid it by directly calling the native @@method method.
  1417. return { done: true, value: nativeRegExpMethod.call(regexp, str, arg2) };
  1418. }
  1419. return { done: true, value: nativeMethod.call(str, regexp, arg2) };
  1420. }
  1421. return { done: false };
  1422. }, {
  1423. REPLACE_KEEPS_$0: REPLACE_KEEPS_$0,
  1424. REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE: REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE
  1425. });
  1426. var stringMethod = methods[0];
  1427. var regexMethod = methods[1];
  1428. redefine(String.prototype, KEY, stringMethod);
  1429. redefine(RegExp.prototype, SYMBOL, length == 2
  1430. // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue)
  1431. // 21.2.5.11 RegExp.prototype[@@split](string, limit)
  1432. ? function (string, arg) { return regexMethod.call(string, this, arg); }
  1433. // 21.2.5.6 RegExp.prototype[@@match](string)
  1434. // 21.2.5.9 RegExp.prototype[@@search](string)
  1435. : function (string) { return regexMethod.call(string, this); }
  1436. );
  1437. }
  1438. if (sham) createNonEnumerableProperty(RegExp.prototype[SYMBOL], 'sham', true);
  1439. };
  1440. // `String.prototype.{ codePointAt, at }` methods implementation
  1441. var createMethod = function (CONVERT_TO_STRING) {
  1442. return function ($this, pos) {
  1443. var S = String(requireObjectCoercible($this));
  1444. var position = toInteger(pos);
  1445. var size = S.length;
  1446. var first, second;
  1447. if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
  1448. first = S.charCodeAt(position);
  1449. return first < 0xD800 || first > 0xDBFF || position + 1 === size
  1450. || (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF
  1451. ? CONVERT_TO_STRING ? S.charAt(position) : first
  1452. : CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
  1453. };
  1454. };
  1455. var stringMultibyte = {
  1456. // `String.prototype.codePointAt` method
  1457. // https://tc39.es/ecma262/#sec-string.prototype.codepointat
  1458. codeAt: createMethod(false),
  1459. // `String.prototype.at` method
  1460. // https://github.com/mathiasbynens/String.prototype.at
  1461. charAt: createMethod(true)
  1462. };
  1463. var charAt = stringMultibyte.charAt;
  1464. // `AdvanceStringIndex` abstract operation
  1465. // https://tc39.es/ecma262/#sec-advancestringindex
  1466. var advanceStringIndex = function (S, index, unicode) {
  1467. return index + (unicode ? charAt(S, index).length : 1);
  1468. };
  1469. var floor = Math.floor;
  1470. var replace = ''.replace;
  1471. var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d{1,2}|<[^>]*>)/g;
  1472. var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d{1,2})/g;
  1473. // https://tc39.es/ecma262/#sec-getsubstitution
  1474. var getSubstitution = function (matched, str, position, captures, namedCaptures, replacement) {
  1475. var tailPos = position + matched.length;
  1476. var m = captures.length;
  1477. var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
  1478. if (namedCaptures !== undefined) {
  1479. namedCaptures = toObject(namedCaptures);
  1480. symbols = SUBSTITUTION_SYMBOLS;
  1481. }
  1482. return replace.call(replacement, symbols, function (match, ch) {
  1483. var capture;
  1484. switch (ch.charAt(0)) {
  1485. case '$': return '$';
  1486. case '&': return matched;
  1487. case '`': return str.slice(0, position);
  1488. case "'": return str.slice(tailPos);
  1489. case '<':
  1490. capture = namedCaptures[ch.slice(1, -1)];
  1491. break;
  1492. default: // \d\d?
  1493. var n = +ch;
  1494. if (n === 0) return match;
  1495. if (n > m) {
  1496. var f = floor(n / 10);
  1497. if (f === 0) return match;
  1498. if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1);
  1499. return match;
  1500. }
  1501. capture = captures[n - 1];
  1502. }
  1503. return capture === undefined ? '' : capture;
  1504. });
  1505. };
  1506. // `RegExpExec` abstract operation
  1507. // https://tc39.es/ecma262/#sec-regexpexec
  1508. var regexpExecAbstract = function (R, S) {
  1509. var exec = R.exec;
  1510. if (typeof exec === 'function') {
  1511. var result = exec.call(R, S);
  1512. if (typeof result !== 'object') {
  1513. throw TypeError('RegExp exec method returned something other than an Object or null');
  1514. }
  1515. return result;
  1516. }
  1517. if (classofRaw(R) !== 'RegExp') {
  1518. throw TypeError('RegExp#exec called on incompatible receiver');
  1519. }
  1520. return regexpExec.call(R, S);
  1521. };
  1522. var max = Math.max;
  1523. var min$1 = Math.min;
  1524. var maybeToString = function (it) {
  1525. return it === undefined ? it : String(it);
  1526. };
  1527. // @@replace logic
  1528. fixRegexpWellKnownSymbolLogic('replace', 2, function (REPLACE, nativeReplace, maybeCallNative, reason) {
  1529. var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = reason.REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE;
  1530. var REPLACE_KEEPS_$0 = reason.REPLACE_KEEPS_$0;
  1531. var UNSAFE_SUBSTITUTE = REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE ? '$' : '$0';
  1532. return [
  1533. // `String.prototype.replace` method
  1534. // https://tc39.es/ecma262/#sec-string.prototype.replace
  1535. function replace(searchValue, replaceValue) {
  1536. var O = requireObjectCoercible(this);
  1537. var replacer = searchValue == undefined ? undefined : searchValue[REPLACE];
  1538. return replacer !== undefined
  1539. ? replacer.call(searchValue, O, replaceValue)
  1540. : nativeReplace.call(String(O), searchValue, replaceValue);
  1541. },
  1542. // `RegExp.prototype[@@replace]` method
  1543. // https://tc39.es/ecma262/#sec-regexp.prototype-@@replace
  1544. function (regexp, replaceValue) {
  1545. if (
  1546. (!REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE && REPLACE_KEEPS_$0) ||
  1547. (typeof replaceValue === 'string' && replaceValue.indexOf(UNSAFE_SUBSTITUTE) === -1)
  1548. ) {
  1549. var res = maybeCallNative(nativeReplace, regexp, this, replaceValue);
  1550. if (res.done) return res.value;
  1551. }
  1552. var rx = anObject(regexp);
  1553. var S = String(this);
  1554. var functionalReplace = typeof replaceValue === 'function';
  1555. if (!functionalReplace) replaceValue = String(replaceValue);
  1556. var global = rx.global;
  1557. if (global) {
  1558. var fullUnicode = rx.unicode;
  1559. rx.lastIndex = 0;
  1560. }
  1561. var results = [];
  1562. while (true) {
  1563. var result = regexpExecAbstract(rx, S);
  1564. if (result === null) break;
  1565. results.push(result);
  1566. if (!global) break;
  1567. var matchStr = String(result[0]);
  1568. if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
  1569. }
  1570. var accumulatedResult = '';
  1571. var nextSourcePosition = 0;
  1572. for (var i = 0; i < results.length; i++) {
  1573. result = results[i];
  1574. var matched = String(result[0]);
  1575. var position = max(min$1(toInteger(result.index), S.length), 0);
  1576. var captures = [];
  1577. // NOTE: This is equivalent to
  1578. // captures = result.slice(1).map(maybeToString)
  1579. // but for some reason `nativeSlice.call(result, 1, result.length)` (called in
  1580. // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and
  1581. // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.
  1582. for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j]));
  1583. var namedCaptures = result.groups;
  1584. if (functionalReplace) {
  1585. var replacerArgs = [matched].concat(captures, position, S);
  1586. if (namedCaptures !== undefined) replacerArgs.push(namedCaptures);
  1587. var replacement = String(replaceValue.apply(undefined, replacerArgs));
  1588. } else {
  1589. replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
  1590. }
  1591. if (position >= nextSourcePosition) {
  1592. accumulatedResult += S.slice(nextSourcePosition, position) + replacement;
  1593. nextSourcePosition = position + matched.length;
  1594. }
  1595. }
  1596. return accumulatedResult + S.slice(nextSourcePosition);
  1597. }
  1598. ];
  1599. });
  1600. // @@match logic
  1601. fixRegexpWellKnownSymbolLogic('match', 1, function (MATCH, nativeMatch, maybeCallNative) {
  1602. return [
  1603. // `String.prototype.match` method
  1604. // https://tc39.es/ecma262/#sec-string.prototype.match
  1605. function match(regexp) {
  1606. var O = requireObjectCoercible(this);
  1607. var matcher = regexp == undefined ? undefined : regexp[MATCH];
  1608. return matcher !== undefined ? matcher.call(regexp, O) : new RegExp(regexp)[MATCH](String(O));
  1609. },
  1610. // `RegExp.prototype[@@match]` method
  1611. // https://tc39.es/ecma262/#sec-regexp.prototype-@@match
  1612. function (regexp) {
  1613. var res = maybeCallNative(nativeMatch, regexp, this);
  1614. if (res.done) return res.value;
  1615. var rx = anObject(regexp);
  1616. var S = String(this);
  1617. if (!rx.global) return regexpExecAbstract(rx, S);
  1618. var fullUnicode = rx.unicode;
  1619. rx.lastIndex = 0;
  1620. var A = [];
  1621. var n = 0;
  1622. var result;
  1623. while ((result = regexpExecAbstract(rx, S)) !== null) {
  1624. var matchStr = String(result[0]);
  1625. A[n] = matchStr;
  1626. if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
  1627. n++;
  1628. }
  1629. return n === 0 ? null : A;
  1630. }
  1631. ];
  1632. });
  1633. var SPECIES = wellKnownSymbol('species');
  1634. // `SpeciesConstructor` abstract operation
  1635. // https://tc39.es/ecma262/#sec-speciesconstructor
  1636. var speciesConstructor = function (O, defaultConstructor) {
  1637. var C = anObject(O).constructor;
  1638. var S;
  1639. return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? defaultConstructor : aFunction(S);
  1640. };
  1641. var arrayPush = [].push;
  1642. var min = Math.min;
  1643. var MAX_UINT32 = 0xFFFFFFFF;
  1644. // babel-minify transpiles RegExp('x', 'y') -> /x/y and it causes SyntaxError
  1645. var SUPPORTS_Y = !fails(function () { return !RegExp(MAX_UINT32, 'y'); });
  1646. // @@split logic
  1647. fixRegexpWellKnownSymbolLogic('split', 2, function (SPLIT, nativeSplit, maybeCallNative) {
  1648. var internalSplit;
  1649. if (
  1650. 'abbc'.split(/(b)*/)[1] == 'c' ||
  1651. // eslint-disable-next-line regexp/no-empty-group -- required for testing
  1652. 'test'.split(/(?:)/, -1).length != 4 ||
  1653. 'ab'.split(/(?:ab)*/).length != 2 ||
  1654. '.'.split(/(.?)(.?)/).length != 4 ||
  1655. // eslint-disable-next-line regexp/no-assertion-capturing-group, regexp/no-empty-group -- required for testing
  1656. '.'.split(/()()/).length > 1 ||
  1657. ''.split(/.?/).length
  1658. ) {
  1659. // based on es5-shim implementation, need to rework it
  1660. internalSplit = function (separator, limit) {
  1661. var string = String(requireObjectCoercible(this));
  1662. var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
  1663. if (lim === 0) return [];
  1664. if (separator === undefined) return [string];
  1665. // If `separator` is not a regex, use native split
  1666. if (!isRegexp(separator)) {
  1667. return nativeSplit.call(string, separator, lim);
  1668. }
  1669. var output = [];
  1670. var flags = (separator.ignoreCase ? 'i' : '') +
  1671. (separator.multiline ? 'm' : '') +
  1672. (separator.unicode ? 'u' : '') +
  1673. (separator.sticky ? 'y' : '');
  1674. var lastLastIndex = 0;
  1675. // Make `global` and avoid `lastIndex` issues by working with a copy
  1676. var separatorCopy = new RegExp(separator.source, flags + 'g');
  1677. var match, lastIndex, lastLength;
  1678. while (match = regexpExec.call(separatorCopy, string)) {
  1679. lastIndex = separatorCopy.lastIndex;
  1680. if (lastIndex > lastLastIndex) {
  1681. output.push(string.slice(lastLastIndex, match.index));
  1682. if (match.length > 1 && match.index < string.length) arrayPush.apply(output, match.slice(1));
  1683. lastLength = match[0].length;
  1684. lastLastIndex = lastIndex;
  1685. if (output.length >= lim) break;
  1686. }
  1687. if (separatorCopy.lastIndex === match.index) separatorCopy.lastIndex++; // Avoid an infinite loop
  1688. }
  1689. if (lastLastIndex === string.length) {
  1690. if (lastLength || !separatorCopy.test('')) output.push('');
  1691. } else output.push(string.slice(lastLastIndex));
  1692. return output.length > lim ? output.slice(0, lim) : output;
  1693. };
  1694. // Chakra, V8
  1695. } else if ('0'.split(undefined, 0).length) {
  1696. internalSplit = function (separator, limit) {
  1697. return separator === undefined && limit === 0 ? [] : nativeSplit.call(this, separator, limit);
  1698. };
  1699. } else internalSplit = nativeSplit;
  1700. return [
  1701. // `String.prototype.split` method
  1702. // https://tc39.es/ecma262/#sec-string.prototype.split
  1703. function split(separator, limit) {
  1704. var O = requireObjectCoercible(this);
  1705. var splitter = separator == undefined ? undefined : separator[SPLIT];
  1706. return splitter !== undefined
  1707. ? splitter.call(separator, O, limit)
  1708. : internalSplit.call(String(O), separator, limit);
  1709. },
  1710. // `RegExp.prototype[@@split]` method
  1711. // https://tc39.es/ecma262/#sec-regexp.prototype-@@split
  1712. //
  1713. // NOTE: This cannot be properly polyfilled in engines that don't support
  1714. // the 'y' flag.
  1715. function (regexp, limit) {
  1716. var res = maybeCallNative(internalSplit, regexp, this, limit, internalSplit !== nativeSplit);
  1717. if (res.done) return res.value;
  1718. var rx = anObject(regexp);
  1719. var S = String(this);
  1720. var C = speciesConstructor(rx, RegExp);
  1721. var unicodeMatching = rx.unicode;
  1722. var flags = (rx.ignoreCase ? 'i' : '') +
  1723. (rx.multiline ? 'm' : '') +
  1724. (rx.unicode ? 'u' : '') +
  1725. (SUPPORTS_Y ? 'y' : 'g');
  1726. // ^(? + rx + ) is needed, in combination with some S slicing, to
  1727. // simulate the 'y' flag.
  1728. var splitter = new C(SUPPORTS_Y ? rx : '^(?:' + rx.source + ')', flags);
  1729. var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
  1730. if (lim === 0) return [];
  1731. if (S.length === 0) return regexpExecAbstract(splitter, S) === null ? [S] : [];
  1732. var p = 0;
  1733. var q = 0;
  1734. var A = [];
  1735. while (q < S.length) {
  1736. splitter.lastIndex = SUPPORTS_Y ? q : 0;
  1737. var z = regexpExecAbstract(splitter, SUPPORTS_Y ? S : S.slice(q));
  1738. var e;
  1739. if (
  1740. z === null ||
  1741. (e = min(toLength(splitter.lastIndex + (SUPPORTS_Y ? 0 : q)), S.length)) === p
  1742. ) {
  1743. q = advanceStringIndex(S, q, unicodeMatching);
  1744. } else {
  1745. A.push(S.slice(p, q));
  1746. if (A.length === lim) return A;
  1747. for (var i = 1; i <= z.length - 1; i++) {
  1748. A.push(z[i]);
  1749. if (A.length === lim) return A;
  1750. }
  1751. q = p = e;
  1752. }
  1753. }
  1754. A.push(S.slice(p));
  1755. return A;
  1756. }
  1757. ];
  1758. }, !SUPPORTS_Y);
  1759. var nativeJoin = [].join;
  1760. var ES3_STRINGS = indexedObject != Object;
  1761. var STRICT_METHOD = arrayMethodIsStrict('join', ',');
  1762. // `Array.prototype.join` method
  1763. // https://tc39.es/ecma262/#sec-array.prototype.join
  1764. _export({ target: 'Array', proto: true, forced: ES3_STRINGS || !STRICT_METHOD }, {
  1765. join: function join(separator) {
  1766. return nativeJoin.call(toIndexedObject(this), separator === undefined ? ',' : separator);
  1767. }
  1768. });
  1769. var Utils$1 = $__default['default'].fn.bootstrapTable.utils;
  1770. var searchControls = 'select, input:not([type="checkbox"]):not([type="radio"])';
  1771. function getOptionsFromSelectControl(selectControl) {
  1772. return selectControl.get(selectControl.length - 1).options;
  1773. }
  1774. function getControlContainer(that) {
  1775. if (that.options.filterControlContainer) {
  1776. return $__default['default']("".concat(that.options.filterControlContainer));
  1777. }
  1778. return that.$header;
  1779. }
  1780. function getSearchControls(that) {
  1781. return getControlContainer(that).find(searchControls);
  1782. }
  1783. function hideUnusedSelectOptions(selectControl, uniqueValues) {
  1784. var options = getOptionsFromSelectControl(selectControl);
  1785. for (var i = 0; i < options.length; i++) {
  1786. if (options[i].value !== '') {
  1787. if (!uniqueValues.hasOwnProperty(options[i].value)) {
  1788. selectControl.find(Utils$1.sprintf('option[value=\'%s\']', options[i].value)).hide();
  1789. } else {
  1790. selectControl.find(Utils$1.sprintf('option[value=\'%s\']', options[i].value)).show();
  1791. }
  1792. }
  1793. }
  1794. }
  1795. function existOptionInSelectControl(selectControl, value) {
  1796. var options = getOptionsFromSelectControl(selectControl);
  1797. for (var i = 0; i < options.length; i++) {
  1798. if (options[i].value === Utils$1.unescapeHTML(value.toString())) {
  1799. // The value is not valid to add
  1800. return true;
  1801. }
  1802. } // If we get here, the value is valid to add
  1803. return false;
  1804. }
  1805. function addOptionToSelectControl(selectControl, _value, text, selected) {
  1806. var value = _value === undefined || _value === null ? '' : _value.toString().trim();
  1807. var $selectControl = $__default['default'](selectControl.get(selectControl.length - 1));
  1808. if (!existOptionInSelectControl(selectControl, value)) {
  1809. var option = $__default['default']("<option value=\"".concat(value, "\">").concat(text, "</option>"));
  1810. if (value === selected) {
  1811. option.attr('selected', true);
  1812. }
  1813. $selectControl.append(option);
  1814. }
  1815. }
  1816. function sortSelectControl(selectControl, orderBy) {
  1817. var $selectControl = $__default['default'](selectControl.get(selectControl.length - 1));
  1818. var $opts = $selectControl.find('option:gt(0)');
  1819. if (orderBy !== 'server') {
  1820. $opts.sort(function (a, b) {
  1821. return Utils$1.sort(a.textContent, b.textContent, orderBy === 'desc' ? -1 : 1);
  1822. });
  1823. }
  1824. $selectControl.find('option:gt(0)').remove();
  1825. $selectControl.append($opts);
  1826. }
  1827. function fixHeaderCSS(_ref) {
  1828. var $tableHeader = _ref.$tableHeader;
  1829. $tableHeader.css('height', '89px');
  1830. }
  1831. function getElementClass($element) {
  1832. return $element.attr('class').replace('form-control', '').replace('focus-temp', '').replace('search-input', '').trim();
  1833. }
  1834. function getCursorPosition(el) {
  1835. if (Utils$1.isIEBrowser()) {
  1836. if ($__default['default'](el).is('input[type=text]')) {
  1837. var pos = 0;
  1838. if ('selectionStart' in el) {
  1839. pos = el.selectionStart;
  1840. } else if ('selection' in document) {
  1841. el.focus();
  1842. var Sel = document.selection.createRange();
  1843. var SelLength = document.selection.createRange().text.length;
  1844. Sel.moveStart('character', -el.value.length);
  1845. pos = Sel.text.length - SelLength;
  1846. }
  1847. return pos;
  1848. }
  1849. return -1;
  1850. }
  1851. return -1;
  1852. }
  1853. function setCursorPosition(el) {
  1854. $__default['default'](el).val(el.value);
  1855. }
  1856. function copyValues(that) {
  1857. var searchControls = getSearchControls(that);
  1858. that.options.valuesFilterControl = [];
  1859. searchControls.each(function () {
  1860. var $field = $__default['default'](this);
  1861. if (that.options.height) {
  1862. var fieldClass = getElementClass($field);
  1863. $field = $__default['default'](".fixed-table-header .".concat(fieldClass));
  1864. }
  1865. that.options.valuesFilterControl.push({
  1866. field: $field.closest('[data-field]').data('field'),
  1867. value: $field.val(),
  1868. position: getCursorPosition($field.get(0)),
  1869. hasFocus: $field.is(':focus')
  1870. });
  1871. });
  1872. }
  1873. function setValues(that) {
  1874. var field = null;
  1875. var result = [];
  1876. var searchControls = getSearchControls(that);
  1877. if (that.options.valuesFilterControl.length > 0) {
  1878. // Callback to apply after settings fields values
  1879. var fieldToFocusCallback = null;
  1880. searchControls.each(function (i, el) {
  1881. var $this = $__default['default'](el);
  1882. field = $this.closest('[data-field]').data('field');
  1883. result = that.options.valuesFilterControl.filter(function (valueObj) {
  1884. return valueObj.field === field;
  1885. });
  1886. if (result.length > 0) {
  1887. if ($this.is('[type=radio]')) {
  1888. return;
  1889. }
  1890. $this.val(result[0].value);
  1891. if (result[0].hasFocus && result[0].value !== '') {
  1892. // set callback if the field had the focus.
  1893. fieldToFocusCallback = function (fieldToFocus, carretPosition) {
  1894. // Closure here to capture the field and cursor position
  1895. var closedCallback = function closedCallback() {
  1896. fieldToFocus.focus();
  1897. setCursorPosition(fieldToFocus);
  1898. };
  1899. return closedCallback;
  1900. }($this.get(0), result[0].position);
  1901. }
  1902. }
  1903. }); // Callback call.
  1904. if (fieldToFocusCallback !== null) {
  1905. fieldToFocusCallback();
  1906. }
  1907. }
  1908. }
  1909. function collectBootstrapCookies() {
  1910. var cookies = [];
  1911. var foundCookies = document.cookie.match(/(?:bs.table.)(\w*)/g);
  1912. var foundLocalStorage = localStorage;
  1913. if (foundCookies) {
  1914. $__default['default'].each(foundCookies, function (i, _cookie) {
  1915. var cookie = _cookie;
  1916. if (/./.test(cookie)) {
  1917. cookie = cookie.split('.').pop();
  1918. }
  1919. if ($__default['default'].inArray(cookie, cookies) === -1) {
  1920. cookies.push(cookie);
  1921. }
  1922. });
  1923. }
  1924. if (foundLocalStorage) {
  1925. for (var i = 0; i < foundLocalStorage.length; i++) {
  1926. var cookie = foundLocalStorage.key(i);
  1927. if (/./.test(cookie)) {
  1928. cookie = cookie.split('.').pop();
  1929. }
  1930. if (!cookies.includes(cookie)) {
  1931. cookies.push(cookie);
  1932. }
  1933. }
  1934. }
  1935. return cookies;
  1936. }
  1937. function escapeID(id) {
  1938. // eslint-disable-next-line no-useless-escape
  1939. return String(id).replace(/([:.\[\],])/g, '\\$1');
  1940. }
  1941. function isColumnSearchableViaSelect(_ref2) {
  1942. var filterControl = _ref2.filterControl,
  1943. searchable = _ref2.searchable;
  1944. return filterControl && filterControl.toLowerCase() === 'select' && searchable;
  1945. }
  1946. function isFilterDataNotGiven(_ref3) {
  1947. var filterData = _ref3.filterData;
  1948. return filterData === undefined || filterData.toLowerCase() === 'column';
  1949. }
  1950. function hasSelectControlElement(selectControl) {
  1951. return selectControl && selectControl.length > 0;
  1952. }
  1953. function initFilterSelectControls(that) {
  1954. var data = that.data;
  1955. var z = that.options.pagination ? that.options.sidePagination === 'server' ? that.pageTo : that.options.totalRows : that.pageTo;
  1956. $__default['default'].each(that.header.fields, function (j, field) {
  1957. var column = that.columns[that.fieldsColumnsIndex[field]];
  1958. var selectControl = getControlContainer(that).find("select.bootstrap-table-filter-control-".concat(escapeID(column.field)));
  1959. if (isColumnSearchableViaSelect(column) && isFilterDataNotGiven(column) && hasSelectControlElement(selectControl)) {
  1960. if (selectControl.get(selectControl.length - 1).options.length === 0) {
  1961. // Added the default option, must use a non-breaking space(&nbsp;) to pass the W3C validator
  1962. addOptionToSelectControl(selectControl, '', column.filterControlPlaceholder || '&nbsp;', column.filterDefault);
  1963. }
  1964. var uniqueValues = {};
  1965. for (var i = 0; i < z; i++) {
  1966. // Added a new value
  1967. var fieldValue = Utils$1.getItemField(data[i], field, false);
  1968. var formatter = that.options.editable && column.editable ? column._formatter : that.header.formatters[j];
  1969. var formattedValue = Utils$1.calculateObjectValue(that.header, formatter, [fieldValue, data[i], i], fieldValue);
  1970. if (column.filterDataCollector) {
  1971. formattedValue = Utils$1.calculateObjectValue(that.header, column.filterDataCollector, [fieldValue, data[i], formattedValue], formattedValue);
  1972. }
  1973. if (column.searchFormatter) {
  1974. fieldValue = formattedValue;
  1975. }
  1976. uniqueValues[formattedValue] = fieldValue;
  1977. if (_typeof(formattedValue) === 'object' && formattedValue !== null) {
  1978. formattedValue.forEach(function (value) {
  1979. addOptionToSelectControl(selectControl, value, value, column.filterDefault);
  1980. });
  1981. continue;
  1982. } // eslint-disable-next-line guard-for-in
  1983. for (var key in uniqueValues) {
  1984. addOptionToSelectControl(selectControl, uniqueValues[key], key, column.filterDefault);
  1985. }
  1986. }
  1987. sortSelectControl(selectControl, column.filterOrderBy);
  1988. if (that.options.hideUnusedSelectOptions) {
  1989. hideUnusedSelectOptions(selectControl, uniqueValues);
  1990. }
  1991. }
  1992. });
  1993. }
  1994. function getFilterDataMethod(objFilterDataMethod, searchTerm) {
  1995. var keys = Object.keys(objFilterDataMethod);
  1996. for (var i = 0; i < keys.length; i++) {
  1997. if (keys[i] === searchTerm) {
  1998. return objFilterDataMethod[searchTerm];
  1999. }
  2000. }
  2001. return null;
  2002. }
  2003. function createControls(that, header) {
  2004. var addedFilterControl = false;
  2005. var html;
  2006. $__default['default'].each(that.columns, function (_, column) {
  2007. html = [];
  2008. if (!column.visible) {
  2009. return;
  2010. }
  2011. if (!column.filterControl && !that.options.filterControlContainer) {
  2012. html.push('<div class="no-filter-control"></div>');
  2013. } else if (that.options.filterControlContainer) {
  2014. var $filterControls = $__default['default'](".bootstrap-table-filter-control-".concat(column.field));
  2015. $__default['default'].each($filterControls, function (_, filterControl) {
  2016. var $filterControl = $__default['default'](filterControl);
  2017. if (!$filterControl.is('[type=radio]')) {
  2018. var placeholder = column.filterControlPlaceholder ? column.filterControlPlaceholder : '';
  2019. $filterControl.attr('placeholder', placeholder).val(column.filterDefault);
  2020. }
  2021. $filterControl.attr('data-field', column.field);
  2022. });
  2023. addedFilterControl = true;
  2024. } else {
  2025. var nameControl = column.filterControl.toLowerCase();
  2026. html.push('<div class="filter-control">');
  2027. addedFilterControl = true;
  2028. if (column.searchable && that.options.filterTemplate[nameControl]) {
  2029. html.push(that.options.filterTemplate[nameControl](that, column.field, column.filterControlPlaceholder ? column.filterControlPlaceholder : '', column.filterDefault));
  2030. }
  2031. }
  2032. if (!column.filterControl && '' !== column.filterDefault && 'undefined' !== typeof column.filterDefault) {
  2033. if ($__default['default'].isEmptyObject(that.filterColumnsPartial)) {
  2034. that.filterColumnsPartial = {};
  2035. }
  2036. that.filterColumnsPartial[column.field] = column.filterDefault;
  2037. }
  2038. $__default['default'].each(header.find('th'), function (i, th) {
  2039. var $th = $__default['default'](th);
  2040. if ($th.data('field') === column.field) {
  2041. $th.find('.fht-cell').append(html.join(''));
  2042. return false;
  2043. }
  2044. });
  2045. if (column.filterData && column.filterData.toLowerCase() !== 'column') {
  2046. var filterDataType = getFilterDataMethod(
  2047. /* eslint-disable no-use-before-define */
  2048. filterDataMethods, column.filterData.substring(0, column.filterData.indexOf(':')));
  2049. var filterDataSource;
  2050. var selectControl;
  2051. if (filterDataType) {
  2052. filterDataSource = column.filterData.substring(column.filterData.indexOf(':') + 1, column.filterData.length);
  2053. selectControl = header.find(".bootstrap-table-filter-control-".concat(escapeID(column.field)));
  2054. addOptionToSelectControl(selectControl, '', column.filterControlPlaceholder, column.filterDefault);
  2055. filterDataType(filterDataSource, selectControl, that.options.filterOrderBy, column.filterDefault);
  2056. } else {
  2057. 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"}');
  2058. }
  2059. }
  2060. });
  2061. if (addedFilterControl) {
  2062. header.off('keyup', 'input').on('keyup', 'input', function (_ref4, obj) {
  2063. var currentTarget = _ref4.currentTarget,
  2064. keyCode = _ref4.keyCode;
  2065. syncControls(that); // Simulate enter key action from clear button
  2066. keyCode = obj ? obj.keyCode : keyCode;
  2067. if (that.options.searchOnEnterKey && keyCode !== 13) {
  2068. return;
  2069. }
  2070. if ($__default['default'].inArray(keyCode, [37, 38, 39, 40]) > -1) {
  2071. return;
  2072. }
  2073. var $currentTarget = $__default['default'](currentTarget);
  2074. if ($currentTarget.is(':checkbox') || $currentTarget.is(':radio')) {
  2075. return;
  2076. }
  2077. clearTimeout(currentTarget.timeoutId || 0);
  2078. currentTarget.timeoutId = setTimeout(function () {
  2079. that.onColumnSearch({
  2080. currentTarget: currentTarget,
  2081. keyCode: keyCode
  2082. });
  2083. }, that.options.searchTimeOut);
  2084. });
  2085. header.off('change', 'select:not(".ms-offscreen")').on('change', 'select:not(".ms-offscreen")', function (_ref5) {
  2086. var currentTarget = _ref5.currentTarget,
  2087. keyCode = _ref5.keyCode;
  2088. syncControls(that);
  2089. var $select = $__default['default'](currentTarget);
  2090. var value = $select.val();
  2091. if (value && value.length > 0 && value.trim()) {
  2092. $select.find('option[selected]').removeAttr('selected');
  2093. $select.find("option[value=\"".concat(value, "\"]")).attr('selected', true);
  2094. } else {
  2095. $select.find('option[selected]').removeAttr('selected');
  2096. }
  2097. clearTimeout(currentTarget.timeoutId || 0);
  2098. currentTarget.timeoutId = setTimeout(function () {
  2099. that.onColumnSearch({
  2100. currentTarget: currentTarget,
  2101. keyCode: keyCode
  2102. });
  2103. }, that.options.searchTimeOut);
  2104. });
  2105. header.off('mouseup', 'input:not([type=radio])').on('mouseup', 'input:not([type=radio])', function (_ref6) {
  2106. var currentTarget = _ref6.currentTarget,
  2107. keyCode = _ref6.keyCode;
  2108. var $input = $__default['default'](currentTarget);
  2109. var oldValue = $input.val();
  2110. if (oldValue === '') {
  2111. return;
  2112. }
  2113. setTimeout(function () {
  2114. syncControls(that);
  2115. var newValue = $input.val();
  2116. if (newValue === '') {
  2117. clearTimeout(currentTarget.timeoutId || 0);
  2118. currentTarget.timeoutId = setTimeout(function () {
  2119. that.onColumnSearch({
  2120. currentTarget: currentTarget,
  2121. keyCode: keyCode
  2122. });
  2123. }, that.options.searchTimeOut);
  2124. }
  2125. }, 1);
  2126. });
  2127. header.off('change', 'input[type=radio]').on('change', 'input[type=radio]', function (_ref7) {
  2128. var currentTarget = _ref7.currentTarget,
  2129. keyCode = _ref7.keyCode;
  2130. clearTimeout(currentTarget.timeoutId || 0);
  2131. currentTarget.timeoutId = setTimeout(function () {
  2132. syncControls(that);
  2133. that.onColumnSearch({
  2134. currentTarget: currentTarget,
  2135. keyCode: keyCode
  2136. });
  2137. }, that.options.searchTimeOut);
  2138. });
  2139. if (header.find('.date-filter-control').length > 0) {
  2140. $__default['default'].each(that.columns, function (i, _ref8) {
  2141. var filterDefault = _ref8.filterDefault,
  2142. filterControl = _ref8.filterControl,
  2143. field = _ref8.field,
  2144. filterDatepickerOptions = _ref8.filterDatepickerOptions;
  2145. if (filterControl !== undefined && filterControl.toLowerCase() === 'datepicker') {
  2146. var $datepicker = header.find(".date-filter-control.bootstrap-table-filter-control-".concat(field));
  2147. $datepicker.datepicker(filterDatepickerOptions);
  2148. if (filterDefault) {
  2149. $datepicker.datepicker('setDate', filterDefault);
  2150. }
  2151. $datepicker.on('changeDate', function (_ref9) {
  2152. var currentTarget = _ref9.currentTarget,
  2153. keyCode = _ref9.keyCode;
  2154. clearTimeout(currentTarget.timeoutId || 0);
  2155. currentTarget.timeoutId = setTimeout(function () {
  2156. syncControls(that);
  2157. that.onColumnSearch({
  2158. currentTarget: currentTarget,
  2159. keyCode: keyCode
  2160. });
  2161. }, that.options.searchTimeOut);
  2162. });
  2163. }
  2164. });
  2165. }
  2166. if (that.options.sidePagination !== 'server' && !that.options.height) {
  2167. that.triggerSearch();
  2168. }
  2169. if (!that.options.filterControlVisible) {
  2170. header.find('.filter-control, .no-filter-control').hide();
  2171. }
  2172. } else {
  2173. header.find('.filter-control, .no-filter-control').hide();
  2174. }
  2175. that.trigger('created-controls');
  2176. }
  2177. function getDirectionOfSelectOptions(_alignment) {
  2178. var alignment = _alignment === undefined ? 'left' : _alignment.toLowerCase();
  2179. switch (alignment) {
  2180. case 'left':
  2181. return 'ltr';
  2182. case 'right':
  2183. return 'rtl';
  2184. case 'auto':
  2185. return 'auto';
  2186. default:
  2187. return 'ltr';
  2188. }
  2189. }
  2190. function syncControls(that) {
  2191. if (that.options.height) {
  2192. var controlsTableHeader = that.$tableHeader.find(searchControls);
  2193. that.$header.find(searchControls).each(function (_, control) {
  2194. var $control = $__default['default'](control);
  2195. var controlClass = getElementClass($control);
  2196. var foundControl = controlsTableHeader.filter(function (_, ele) {
  2197. var eleClass = getElementClass($__default['default'](ele));
  2198. return controlClass === eleClass;
  2199. });
  2200. if (foundControl.length === 0) {
  2201. return;
  2202. }
  2203. if ($control.is('select')) {
  2204. $control.find('option:selected').removeAttr('selected');
  2205. $control.find("option[value='".concat(foundControl.val(), "']")).attr('selected', true);
  2206. } else {
  2207. $control.val(foundControl.val());
  2208. }
  2209. });
  2210. }
  2211. }
  2212. var filterDataMethods = {
  2213. func: function func(filterDataSource, selectControl, filterOrderBy, selected) {
  2214. var variableValues = window[filterDataSource].apply(); // eslint-disable-next-line guard-for-in
  2215. for (var key in variableValues) {
  2216. addOptionToSelectControl(selectControl, key, variableValues[key], selected);
  2217. }
  2218. sortSelectControl(selectControl, filterOrderBy);
  2219. },
  2220. obj: function obj(filterDataSource, selectControl, filterOrderBy, selected) {
  2221. var objectKeys = filterDataSource.split('.');
  2222. var variableName = objectKeys.shift();
  2223. var variableValues = window[variableName];
  2224. if (objectKeys.length > 0) {
  2225. objectKeys.forEach(function (key) {
  2226. variableValues = variableValues[key];
  2227. });
  2228. } // eslint-disable-next-line guard-for-in
  2229. for (var key in variableValues) {
  2230. addOptionToSelectControl(selectControl, key, variableValues[key], selected);
  2231. }
  2232. sortSelectControl(selectControl, filterOrderBy);
  2233. },
  2234. var: function _var(filterDataSource, selectControl, filterOrderBy, selected) {
  2235. var variableValues = window[filterDataSource];
  2236. var isArray = Array.isArray(variableValues);
  2237. for (var key in variableValues) {
  2238. if (isArray) {
  2239. addOptionToSelectControl(selectControl, variableValues[key], variableValues[key], selected);
  2240. } else {
  2241. addOptionToSelectControl(selectControl, key, variableValues[key], selected);
  2242. }
  2243. }
  2244. sortSelectControl(selectControl, filterOrderBy);
  2245. },
  2246. url: function url(filterDataSource, selectControl, filterOrderBy, selected) {
  2247. $__default['default'].ajax({
  2248. url: filterDataSource,
  2249. dataType: 'json',
  2250. success: function success(data) {
  2251. // eslint-disable-next-line guard-for-in
  2252. for (var key in data) {
  2253. addOptionToSelectControl(selectControl, key, data[key], selected);
  2254. }
  2255. sortSelectControl(selectControl, filterOrderBy);
  2256. }
  2257. });
  2258. },
  2259. json: function json(filterDataSource, selectControl, filterOrderBy, selected) {
  2260. var variableValues = JSON.parse(filterDataSource); // eslint-disable-next-line guard-for-in
  2261. for (var key in variableValues) {
  2262. addOptionToSelectControl(selectControl, key, variableValues[key], selected);
  2263. }
  2264. sortSelectControl(selectControl, filterOrderBy);
  2265. }
  2266. };
  2267. var Utils = $__default['default'].fn.bootstrapTable.utils;
  2268. $__default['default'].extend($__default['default'].fn.bootstrapTable.defaults, {
  2269. filterControl: false,
  2270. filterControlVisible: true,
  2271. // eslint-disable-next-line no-unused-vars
  2272. onColumnSearch: function onColumnSearch(field, text) {
  2273. return false;
  2274. },
  2275. onCreatedControls: function onCreatedControls() {
  2276. return false;
  2277. },
  2278. alignmentSelectControlOptions: undefined,
  2279. filterTemplate: {
  2280. input: function input(that, field, placeholder, value) {
  2281. return Utils.sprintf('<input type="search" class="form-control bootstrap-table-filter-control-%s search-input" style="width: 100%;" placeholder="%s" value="%s">', field, 'undefined' === typeof placeholder ? '' : placeholder, 'undefined' === typeof value ? '' : value);
  2282. },
  2283. select: function select(_ref, field) {
  2284. var options = _ref.options;
  2285. return Utils.sprintf('<select class="form-control bootstrap-table-filter-control-%s" style="width: 100%;" dir="%s"></select>', field, getDirectionOfSelectOptions(options.alignmentSelectControlOptions));
  2286. },
  2287. datepicker: function datepicker(that, field, value) {
  2288. return Utils.sprintf('<input type="text" class="form-control date-filter-control bootstrap-table-filter-control-%s" style="width: 100%;" value="%s">', field, 'undefined' === typeof value ? '' : value);
  2289. }
  2290. },
  2291. disableControlWhenSearch: false,
  2292. searchOnEnterKey: false,
  2293. showFilterControlSwitch: false,
  2294. // internal variables
  2295. valuesFilterControl: []
  2296. });
  2297. $__default['default'].extend($__default['default'].fn.bootstrapTable.columnDefaults, {
  2298. filterControl: undefined,
  2299. // input, select, datepicker
  2300. filterDataCollector: undefined,
  2301. filterData: undefined,
  2302. filterDatepickerOptions: {},
  2303. filterStrictSearch: false,
  2304. filterStartsWithSearch: false,
  2305. filterControlPlaceholder: '',
  2306. filterDefault: '',
  2307. filterOrderBy: 'asc' // asc || desc
  2308. });
  2309. $__default['default'].extend($__default['default'].fn.bootstrapTable.Constructor.EVENTS, {
  2310. 'column-search.bs.table': 'onColumnSearch',
  2311. 'created-controls.bs.table': 'onCreatedControls'
  2312. });
  2313. $__default['default'].extend($__default['default'].fn.bootstrapTable.defaults.icons, {
  2314. clear: {
  2315. bootstrap3: 'glyphicon-trash icon-clear'
  2316. }[$__default['default'].fn.bootstrapTable.theme] || 'fa-trash',
  2317. filterControlSwitchHide: {
  2318. bootstrap3: 'glyphicon-zoom-out icon-zoom-out',
  2319. materialize: 'zoom_out'
  2320. }[$__default['default'].fn.bootstrapTable.theme] || 'fa-search-minus',
  2321. filterControlSwitchShow: {
  2322. bootstrap3: 'glyphicon-zoom-in icon-zoom-in',
  2323. materialize: 'zoom_in'
  2324. }[$__default['default'].fn.bootstrapTable.theme] || 'fa-search-plus'
  2325. });
  2326. $__default['default'].extend($__default['default'].fn.bootstrapTable.locales, {
  2327. formatFilterControlSwitch: function formatFilterControlSwitch() {
  2328. return 'Hide/Show controls';
  2329. },
  2330. formatFilterControlSwitchHide: function formatFilterControlSwitchHide() {
  2331. return 'Hide controls';
  2332. },
  2333. formatFilterControlSwitchShow: function formatFilterControlSwitchShow() {
  2334. return 'Show controls';
  2335. }
  2336. });
  2337. $__default['default'].extend($__default['default'].fn.bootstrapTable.defaults, $__default['default'].fn.bootstrapTable.locales);
  2338. $__default['default'].extend($__default['default'].fn.bootstrapTable.defaults, {
  2339. formatClearSearch: function formatClearSearch() {
  2340. return 'Clear filters';
  2341. }
  2342. });
  2343. $__default['default'].fn.bootstrapTable.methods.push('triggerSearch');
  2344. $__default['default'].fn.bootstrapTable.methods.push('clearFilterControl');
  2345. $__default['default'].fn.bootstrapTable.methods.push('toggleFilterControl');
  2346. $__default['default'].BootstrapTable = /*#__PURE__*/function (_$$BootstrapTable) {
  2347. _inherits(_class, _$$BootstrapTable);
  2348. var _super = _createSuper(_class);
  2349. function _class() {
  2350. _classCallCheck(this, _class);
  2351. return _super.apply(this, arguments);
  2352. }
  2353. _createClass(_class, [{
  2354. key: "init",
  2355. value: function init() {
  2356. var _this = this;
  2357. // Make sure that the filterControl option is set
  2358. if (this.options.filterControl) {
  2359. // Make sure that the internal variables are set correctly
  2360. this.options.valuesFilterControl = [];
  2361. this.$el.on('reset-view.bs.table', function () {
  2362. // Create controls on $tableHeader if the height is set
  2363. if (!_this.options.height) {
  2364. return;
  2365. } // Avoid recreate the controls
  2366. var $controlContainer = getControlContainer(_this);
  2367. if (($controlContainer.find('select').length > 0 || $controlContainer.find('input:not([type="checkbox"]):not([type="radio"])').length > 0) && !_this.options.filterControlContainer) {
  2368. return;
  2369. }
  2370. createControls(_this, $controlContainer);
  2371. }).on('post-header.bs.table', function () {
  2372. setValues(_this);
  2373. }).on('post-body.bs.table', function () {
  2374. if (_this.options.height && !_this.options.filterControlContainer) {
  2375. fixHeaderCSS(_this);
  2376. }
  2377. _this.$tableLoading.css('top', _this.$header.outerHeight() + 1);
  2378. }).on('column-switch.bs.table', function () {
  2379. setValues(_this);
  2380. }).on('load-success.bs.table', function () {
  2381. _this.enableControls(true);
  2382. }).on('load-error.bs.table', function () {
  2383. _this.enableControls(true);
  2384. });
  2385. }
  2386. _get(_getPrototypeOf(_class.prototype), "init", this).call(this);
  2387. }
  2388. }, {
  2389. key: "initHeader",
  2390. value: function initHeader() {
  2391. _get(_getPrototypeOf(_class.prototype), "initHeader", this).call(this);
  2392. if (!this.options.filterControl || this.options.height) {
  2393. return;
  2394. }
  2395. createControls(this, getControlContainer(this));
  2396. }
  2397. }, {
  2398. key: "initBody",
  2399. value: function initBody() {
  2400. _get(_getPrototypeOf(_class.prototype), "initBody", this).call(this);
  2401. syncControls(this);
  2402. initFilterSelectControls(this);
  2403. }
  2404. }, {
  2405. key: "initSearch",
  2406. value: function initSearch() {
  2407. var _this2 = this;
  2408. var that = this;
  2409. var fp = $__default['default'].isEmptyObject(that.filterColumnsPartial) ? null : that.filterColumnsPartial;
  2410. _get(_getPrototypeOf(_class.prototype), "initSearch", this).call(this);
  2411. if (this.options.sidePagination === 'server' || fp === null) {
  2412. return;
  2413. } // Check partial column filter
  2414. that.data = fp ? that.data.filter(function (item, i) {
  2415. var itemIsExpected = [];
  2416. var keys1 = Object.keys(item);
  2417. var keys2 = Object.keys(fp);
  2418. var keys = keys1.concat(keys2.filter(function (item) {
  2419. return !keys1.includes(item);
  2420. }));
  2421. keys.forEach(function (key) {
  2422. var thisColumn = that.columns[that.fieldsColumnsIndex[key]];
  2423. var fval = (fp[key] || '').toLowerCase();
  2424. var value = Utils.unescapeHTML(Utils.getItemField(item, key, false));
  2425. var tmpItemIsExpected;
  2426. if (fval === '') {
  2427. tmpItemIsExpected = true;
  2428. } else {
  2429. // Fix #142: search use formatted data
  2430. if (thisColumn && thisColumn.searchFormatter) {
  2431. value = $__default['default'].fn.bootstrapTable.utils.calculateObjectValue(that.header, that.header.formatters[$__default['default'].inArray(key, that.header.fields)], [value, item, i], value);
  2432. }
  2433. if ($__default['default'].inArray(key, that.header.fields) !== -1) {
  2434. if (value === undefined || value === null) {
  2435. tmpItemIsExpected = false;
  2436. } else if (_typeof(value) === 'object') {
  2437. value.forEach(function (objectValue) {
  2438. if (tmpItemIsExpected) {
  2439. return;
  2440. }
  2441. if (_this2.options.searchAccentNeutralise) {
  2442. objectValue = Utils.normalizeAccent(objectValue);
  2443. }
  2444. tmpItemIsExpected = that.isValueExpected(fval, objectValue, thisColumn, key);
  2445. });
  2446. } else if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
  2447. if (_this2.options.searchAccentNeutralise) {
  2448. value = Utils.normalizeAccent(value);
  2449. }
  2450. tmpItemIsExpected = that.isValueExpected(fval, value, thisColumn, key);
  2451. }
  2452. }
  2453. }
  2454. itemIsExpected.push(tmpItemIsExpected);
  2455. });
  2456. return !itemIsExpected.includes(false);
  2457. }) : that.data;
  2458. that.unsortedData = _toConsumableArray(that.data);
  2459. }
  2460. }, {
  2461. key: "isValueExpected",
  2462. value: function isValueExpected(searchValue, value, column, key) {
  2463. var tmpItemIsExpected = false;
  2464. if (column.filterStrictSearch) {
  2465. tmpItemIsExpected = value.toString().toLowerCase() === searchValue.toString().toLowerCase();
  2466. } else if (column.filterStartsWithSearch) {
  2467. tmpItemIsExpected = "".concat(value).toLowerCase().indexOf(searchValue) === 0;
  2468. } else {
  2469. tmpItemIsExpected = "".concat(value).toLowerCase().includes(searchValue);
  2470. }
  2471. var largerSmallerEqualsRegex = /(?:(<=|=>|=<|>=|>|<)(?:\s+)?(\d+)?|(\d+)?(\s+)?(<=|=>|=<|>=|>|<))/gm;
  2472. var matches = largerSmallerEqualsRegex.exec(searchValue);
  2473. if (matches) {
  2474. var operator = matches[1] || "".concat(matches[5], "l");
  2475. var comparisonValue = matches[2] || matches[3];
  2476. var int = parseInt(value, 10);
  2477. var comparisonInt = parseInt(comparisonValue, 10);
  2478. switch (operator) {
  2479. case '>':
  2480. case '<l':
  2481. tmpItemIsExpected = int > comparisonInt;
  2482. break;
  2483. case '<':
  2484. case '>l':
  2485. tmpItemIsExpected = int < comparisonInt;
  2486. break;
  2487. case '<=':
  2488. case '=<':
  2489. case '>=l':
  2490. case '=>l':
  2491. tmpItemIsExpected = int <= comparisonInt;
  2492. break;
  2493. case '>=':
  2494. case '=>':
  2495. case '<=l':
  2496. case '=<l':
  2497. tmpItemIsExpected = int >= comparisonInt;
  2498. break;
  2499. }
  2500. }
  2501. if (column.filterCustomSearch) {
  2502. var customSearchResult = Utils.calculateObjectValue(this, column.filterCustomSearch, [searchValue, value, key, this.options.data], true);
  2503. if (customSearchResult !== null) {
  2504. tmpItemIsExpected = customSearchResult;
  2505. }
  2506. }
  2507. return tmpItemIsExpected;
  2508. }
  2509. }, {
  2510. key: "initColumnSearch",
  2511. value: function initColumnSearch(filterColumnsDefaults) {
  2512. copyValues(this);
  2513. if (filterColumnsDefaults) {
  2514. this.filterColumnsPartial = filterColumnsDefaults;
  2515. this.updatePagination(); // eslint-disable-next-line guard-for-in
  2516. for (var filter in filterColumnsDefaults) {
  2517. this.trigger('column-search', filter, filterColumnsDefaults[filter]);
  2518. }
  2519. }
  2520. }
  2521. }, {
  2522. key: "onColumnSearch",
  2523. value: function onColumnSearch(_ref2) {
  2524. var currentTarget = _ref2.currentTarget,
  2525. keyCode = _ref2.keyCode;
  2526. if ($__default['default'].inArray(keyCode, [37, 38, 39, 40]) > -1) {
  2527. return;
  2528. }
  2529. copyValues(this);
  2530. var text = $__default['default'].trim($__default['default'](currentTarget).val());
  2531. var $field = $__default['default'](currentTarget).closest('[data-field]').data('field');
  2532. this.trigger('column-search', $field, text);
  2533. if ($__default['default'].isEmptyObject(this.filterColumnsPartial)) {
  2534. this.filterColumnsPartial = {};
  2535. }
  2536. if (text) {
  2537. this.filterColumnsPartial[$field] = text;
  2538. } else {
  2539. delete this.filterColumnsPartial[$field];
  2540. }
  2541. this.options.pageNumber = 1;
  2542. this.enableControls(false);
  2543. this.onSearch({
  2544. currentTarget: currentTarget
  2545. }, false);
  2546. }
  2547. }, {
  2548. key: "initToolbar",
  2549. value: function initToolbar() {
  2550. this.showToolbar = this.showToolbar || this.options.showFilterControlSwitch;
  2551. this.showSearchClearButton = this.options.filterControl && this.options.showSearchClearButton;
  2552. if (this.options.showFilterControlSwitch) {
  2553. this.buttons = Object.assign(this.buttons, {
  2554. filterControlSwitch: {
  2555. text: this.options.filterControlVisible ? this.options.formatFilterControlSwitchHide() : this.options.formatFilterControlSwitchShow(),
  2556. icon: this.options.filterControlVisible ? this.options.icons.filterControlSwitchHide : this.options.icons.filterControlSwitchShow,
  2557. event: this.toggleFilterControl,
  2558. attributes: {
  2559. 'aria-label': this.options.formatFilterControlSwitch(),
  2560. title: this.options.formatFilterControlSwitch()
  2561. }
  2562. }
  2563. });
  2564. }
  2565. _get(_getPrototypeOf(_class.prototype), "initToolbar", this).call(this);
  2566. }
  2567. }, {
  2568. key: "resetSearch",
  2569. value: function resetSearch(text) {
  2570. if (this.options.filterControl && this.options.showSearchClearButton) {
  2571. this.clearFilterControl();
  2572. }
  2573. _get(_getPrototypeOf(_class.prototype), "resetSearch", this).call(this, text);
  2574. }
  2575. }, {
  2576. key: "clearFilterControl",
  2577. value: function clearFilterControl() {
  2578. if (this.options.filterControl) {
  2579. var that = this;
  2580. var cookies = collectBootstrapCookies();
  2581. var table = this.$el.closest('table');
  2582. var controls = getSearchControls(that);
  2583. var search = Utils.getSearchInput(this);
  2584. var hasValues = false;
  2585. var timeoutId = 0;
  2586. $__default['default'].each(that.options.valuesFilterControl, function (i, item) {
  2587. hasValues = hasValues ? true : item.value !== '';
  2588. item.value = '';
  2589. });
  2590. $__default['default'].each(that.options.filterControls, function (i, item) {
  2591. item.text = '';
  2592. });
  2593. setValues(that); // clear cookies once the filters are clean
  2594. clearTimeout(timeoutId);
  2595. timeoutId = setTimeout(function () {
  2596. if (cookies && cookies.length > 0) {
  2597. $__default['default'].each(cookies, function (i, item) {
  2598. if (that.deleteCookie !== undefined) {
  2599. that.deleteCookie(item);
  2600. }
  2601. });
  2602. }
  2603. }, that.options.searchTimeOut); // If there is not any value in the controls exit this method
  2604. if (!hasValues) {
  2605. return;
  2606. } // Clear each type of filter if it exists.
  2607. // Requires the body to reload each time a type of filter is found because we never know
  2608. // which ones are going to be present.
  2609. if (controls.length > 0) {
  2610. this.filterColumnsPartial = {};
  2611. $__default['default'](controls[0]).trigger(controls[0].tagName === 'INPUT' ? 'keyup' : 'change', {
  2612. keyCode: 13
  2613. });
  2614. } else {
  2615. return;
  2616. }
  2617. if (search.length > 0) {
  2618. that.resetSearch();
  2619. } // use the default sort order if it exists. do nothing if it does not
  2620. if (that.options.sortName !== table.data('sortName') || that.options.sortOrder !== table.data('sortOrder')) {
  2621. var sorter = this.$header.find(Utils.sprintf('[data-field="%s"]', $__default['default'](controls[0]).closest('table').data('sortName')));
  2622. if (sorter.length > 0) {
  2623. that.onSort({
  2624. type: 'keypress',
  2625. currentTarget: sorter
  2626. });
  2627. $__default['default'](sorter).find('.sortable').trigger('click');
  2628. }
  2629. }
  2630. }
  2631. }
  2632. }, {
  2633. key: "triggerSearch",
  2634. value: function triggerSearch() {
  2635. var searchControls = getSearchControls(this);
  2636. searchControls.each(function () {
  2637. var el = $__default['default'](this);
  2638. if (el.is('select')) {
  2639. el.change();
  2640. } else {
  2641. el.keyup();
  2642. }
  2643. });
  2644. }
  2645. }, {
  2646. key: "enableControls",
  2647. value: function enableControls(enable) {
  2648. if (this.options.disableControlWhenSearch && this.options.sidePagination === 'server') {
  2649. var searchControls = getSearchControls(this);
  2650. if (!enable) {
  2651. searchControls.prop('disabled', 'disabled');
  2652. } else {
  2653. searchControls.removeProp('disabled');
  2654. }
  2655. }
  2656. }
  2657. }, {
  2658. key: "toggleFilterControl",
  2659. value: function toggleFilterControl() {
  2660. this.options.filterControlVisible = !this.options.filterControlVisible;
  2661. var $filterControls = getControlContainer(this).find('.filter-control, .no-filter-control');
  2662. if (this.options.filterControlVisible) {
  2663. $filterControls.show();
  2664. } else {
  2665. $filterControls.hide();
  2666. this.clearFilterControl();
  2667. }
  2668. var icon = this.options.showButtonIcons ? this.options.filterControlVisible ? this.options.icons.filterControlSwitchHide : this.options.icons.filterControlSwitchShow : '';
  2669. var text = this.options.showButtonText ? this.options.filterControlVisible ? this.options.formatFilterControlSwitchHide() : this.options.formatFilterControlSwitchShow() : '';
  2670. this.$toolbar.find('>.columns').find('.filter-control-switch').html("".concat(Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, icon), " ").concat(text));
  2671. }
  2672. }]);
  2673. return _class;
  2674. }($__default['default'].BootstrapTable);
  2675. })));