bootstrap-table-filter-control.js 107 KB

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