bootstrap-table-cookie.js 75 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226
  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 = global || self, factory(global.jQuery));
  5. }(this, (function ($) { 'use strict';
  6. $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
  7. var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
  8. function createCommonjsModule(fn, module) {
  9. return module = { exports: {} }, fn(module, module.exports), module.exports;
  10. }
  11. var check = function (it) {
  12. return it && it.Math == Math && it;
  13. };
  14. // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
  15. var global_1 =
  16. // eslint-disable-next-line no-undef
  17. check(typeof globalThis == 'object' && globalThis) ||
  18. check(typeof window == 'object' && window) ||
  19. check(typeof self == 'object' && self) ||
  20. check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
  21. // eslint-disable-next-line no-new-func
  22. Function('return this')();
  23. var fails = function (exec) {
  24. try {
  25. return !!exec();
  26. } catch (error) {
  27. return true;
  28. }
  29. };
  30. // Thank's IE8 for his funny defineProperty
  31. var descriptors = !fails(function () {
  32. return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
  33. });
  34. var nativePropertyIsEnumerable = {}.propertyIsEnumerable;
  35. var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  36. // Nashorn ~ JDK8 bug
  37. var NASHORN_BUG = getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1);
  38. // `Object.prototype.propertyIsEnumerable` method implementation
  39. // https://tc39.github.io/ecma262/#sec-object.prototype.propertyisenumerable
  40. var f = NASHORN_BUG ? function propertyIsEnumerable(V) {
  41. var descriptor = getOwnPropertyDescriptor(this, V);
  42. return !!descriptor && descriptor.enumerable;
  43. } : nativePropertyIsEnumerable;
  44. var objectPropertyIsEnumerable = {
  45. f: f
  46. };
  47. var createPropertyDescriptor = function (bitmap, value) {
  48. return {
  49. enumerable: !(bitmap & 1),
  50. configurable: !(bitmap & 2),
  51. writable: !(bitmap & 4),
  52. value: value
  53. };
  54. };
  55. var toString = {}.toString;
  56. var classofRaw = function (it) {
  57. return toString.call(it).slice(8, -1);
  58. };
  59. var split = ''.split;
  60. // fallback for non-array-like ES3 and non-enumerable old V8 strings
  61. var indexedObject = fails(function () {
  62. // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
  63. // eslint-disable-next-line no-prototype-builtins
  64. return !Object('z').propertyIsEnumerable(0);
  65. }) ? function (it) {
  66. return classofRaw(it) == 'String' ? split.call(it, '') : Object(it);
  67. } : Object;
  68. // `RequireObjectCoercible` abstract operation
  69. // https://tc39.github.io/ecma262/#sec-requireobjectcoercible
  70. var requireObjectCoercible = function (it) {
  71. if (it == undefined) throw TypeError("Can't call method on " + it);
  72. return it;
  73. };
  74. // toObject with fallback for non-array-like ES3 strings
  75. var toIndexedObject = function (it) {
  76. return indexedObject(requireObjectCoercible(it));
  77. };
  78. var isObject = function (it) {
  79. return typeof it === 'object' ? it !== null : typeof it === 'function';
  80. };
  81. // `ToPrimitive` abstract operation
  82. // https://tc39.github.io/ecma262/#sec-toprimitive
  83. // instead of the ES6 spec version, we didn't implement @@toPrimitive case
  84. // and the second argument - flag - preferred type is a string
  85. var toPrimitive = function (input, PREFERRED_STRING) {
  86. if (!isObject(input)) return input;
  87. var fn, val;
  88. if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
  89. if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val;
  90. if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
  91. throw TypeError("Can't convert object to primitive value");
  92. };
  93. var hasOwnProperty = {}.hasOwnProperty;
  94. var has = function (it, key) {
  95. return hasOwnProperty.call(it, key);
  96. };
  97. var document$1 = global_1.document;
  98. // typeof document.createElement is 'object' in old IE
  99. var EXISTS = isObject(document$1) && isObject(document$1.createElement);
  100. var documentCreateElement = function (it) {
  101. return EXISTS ? document$1.createElement(it) : {};
  102. };
  103. // Thank's IE8 for his funny defineProperty
  104. var ie8DomDefine = !descriptors && !fails(function () {
  105. return Object.defineProperty(documentCreateElement('div'), 'a', {
  106. get: function () { return 7; }
  107. }).a != 7;
  108. });
  109. var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  110. // `Object.getOwnPropertyDescriptor` method
  111. // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor
  112. var f$1 = descriptors ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
  113. O = toIndexedObject(O);
  114. P = toPrimitive(P, true);
  115. if (ie8DomDefine) try {
  116. return nativeGetOwnPropertyDescriptor(O, P);
  117. } catch (error) { /* empty */ }
  118. if (has(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]);
  119. };
  120. var objectGetOwnPropertyDescriptor = {
  121. f: f$1
  122. };
  123. var anObject = function (it) {
  124. if (!isObject(it)) {
  125. throw TypeError(String(it) + ' is not an object');
  126. } return it;
  127. };
  128. var nativeDefineProperty = Object.defineProperty;
  129. // `Object.defineProperty` method
  130. // https://tc39.github.io/ecma262/#sec-object.defineproperty
  131. var f$2 = descriptors ? nativeDefineProperty : function defineProperty(O, P, Attributes) {
  132. anObject(O);
  133. P = toPrimitive(P, true);
  134. anObject(Attributes);
  135. if (ie8DomDefine) try {
  136. return nativeDefineProperty(O, P, Attributes);
  137. } catch (error) { /* empty */ }
  138. if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
  139. if ('value' in Attributes) O[P] = Attributes.value;
  140. return O;
  141. };
  142. var objectDefineProperty = {
  143. f: f$2
  144. };
  145. var createNonEnumerableProperty = descriptors ? function (object, key, value) {
  146. return objectDefineProperty.f(object, key, createPropertyDescriptor(1, value));
  147. } : function (object, key, value) {
  148. object[key] = value;
  149. return object;
  150. };
  151. var setGlobal = function (key, value) {
  152. try {
  153. createNonEnumerableProperty(global_1, key, value);
  154. } catch (error) {
  155. global_1[key] = value;
  156. } return value;
  157. };
  158. var SHARED = '__core-js_shared__';
  159. var store = global_1[SHARED] || setGlobal(SHARED, {});
  160. var sharedStore = store;
  161. var functionToString = Function.toString;
  162. // this helper broken in `3.4.1-3.4.4`, so we can't use `shared` helper
  163. if (typeof sharedStore.inspectSource != 'function') {
  164. sharedStore.inspectSource = function (it) {
  165. return functionToString.call(it);
  166. };
  167. }
  168. var inspectSource = sharedStore.inspectSource;
  169. var WeakMap = global_1.WeakMap;
  170. var nativeWeakMap = typeof WeakMap === 'function' && /native code/.test(inspectSource(WeakMap));
  171. var shared = createCommonjsModule(function (module) {
  172. (module.exports = function (key, value) {
  173. return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {});
  174. })('versions', []).push({
  175. version: '3.6.0',
  176. mode: 'global',
  177. copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
  178. });
  179. });
  180. var id = 0;
  181. var postfix = Math.random();
  182. var uid = function (key) {
  183. return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);
  184. };
  185. var keys = shared('keys');
  186. var sharedKey = function (key) {
  187. return keys[key] || (keys[key] = uid(key));
  188. };
  189. var hiddenKeys = {};
  190. var WeakMap$1 = global_1.WeakMap;
  191. var set, get, has$1;
  192. var enforce = function (it) {
  193. return has$1(it) ? get(it) : set(it, {});
  194. };
  195. var getterFor = function (TYPE) {
  196. return function (it) {
  197. var state;
  198. if (!isObject(it) || (state = get(it)).type !== TYPE) {
  199. throw TypeError('Incompatible receiver, ' + TYPE + ' required');
  200. } return state;
  201. };
  202. };
  203. if (nativeWeakMap) {
  204. var store$1 = new WeakMap$1();
  205. var wmget = store$1.get;
  206. var wmhas = store$1.has;
  207. var wmset = store$1.set;
  208. set = function (it, metadata) {
  209. wmset.call(store$1, it, metadata);
  210. return metadata;
  211. };
  212. get = function (it) {
  213. return wmget.call(store$1, it) || {};
  214. };
  215. has$1 = function (it) {
  216. return wmhas.call(store$1, it);
  217. };
  218. } else {
  219. var STATE = sharedKey('state');
  220. hiddenKeys[STATE] = true;
  221. set = function (it, metadata) {
  222. createNonEnumerableProperty(it, STATE, metadata);
  223. return metadata;
  224. };
  225. get = function (it) {
  226. return has(it, STATE) ? it[STATE] : {};
  227. };
  228. has$1 = function (it) {
  229. return has(it, STATE);
  230. };
  231. }
  232. var internalState = {
  233. set: set,
  234. get: get,
  235. has: has$1,
  236. enforce: enforce,
  237. getterFor: getterFor
  238. };
  239. var redefine = createCommonjsModule(function (module) {
  240. var getInternalState = internalState.get;
  241. var enforceInternalState = internalState.enforce;
  242. var TEMPLATE = String(String).split('String');
  243. (module.exports = function (O, key, value, options) {
  244. var unsafe = options ? !!options.unsafe : false;
  245. var simple = options ? !!options.enumerable : false;
  246. var noTargetGet = options ? !!options.noTargetGet : false;
  247. if (typeof value == 'function') {
  248. if (typeof key == 'string' && !has(value, 'name')) createNonEnumerableProperty(value, 'name', key);
  249. enforceInternalState(value).source = TEMPLATE.join(typeof key == 'string' ? key : '');
  250. }
  251. if (O === global_1) {
  252. if (simple) O[key] = value;
  253. else setGlobal(key, value);
  254. return;
  255. } else if (!unsafe) {
  256. delete O[key];
  257. } else if (!noTargetGet && O[key]) {
  258. simple = true;
  259. }
  260. if (simple) O[key] = value;
  261. else createNonEnumerableProperty(O, key, value);
  262. // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
  263. })(Function.prototype, 'toString', function toString() {
  264. return typeof this == 'function' && getInternalState(this).source || inspectSource(this);
  265. });
  266. });
  267. var path = global_1;
  268. var aFunction = function (variable) {
  269. return typeof variable == 'function' ? variable : undefined;
  270. };
  271. var getBuiltIn = function (namespace, method) {
  272. return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global_1[namespace])
  273. : path[namespace] && path[namespace][method] || global_1[namespace] && global_1[namespace][method];
  274. };
  275. var ceil = Math.ceil;
  276. var floor = Math.floor;
  277. // `ToInteger` abstract operation
  278. // https://tc39.github.io/ecma262/#sec-tointeger
  279. var toInteger = function (argument) {
  280. return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument);
  281. };
  282. var min = Math.min;
  283. // `ToLength` abstract operation
  284. // https://tc39.github.io/ecma262/#sec-tolength
  285. var toLength = function (argument) {
  286. return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
  287. };
  288. var max = Math.max;
  289. var min$1 = Math.min;
  290. // Helper for a popular repeating case of the spec:
  291. // Let integer be ? ToInteger(index).
  292. // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
  293. var toAbsoluteIndex = function (index, length) {
  294. var integer = toInteger(index);
  295. return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
  296. };
  297. // `Array.prototype.{ indexOf, includes }` methods implementation
  298. var createMethod = function (IS_INCLUDES) {
  299. return function ($this, el, fromIndex) {
  300. var O = toIndexedObject($this);
  301. var length = toLength(O.length);
  302. var index = toAbsoluteIndex(fromIndex, length);
  303. var value;
  304. // Array#includes uses SameValueZero equality algorithm
  305. // eslint-disable-next-line no-self-compare
  306. if (IS_INCLUDES && el != el) while (length > index) {
  307. value = O[index++];
  308. // eslint-disable-next-line no-self-compare
  309. if (value != value) return true;
  310. // Array#indexOf ignores holes, Array#includes - not
  311. } else for (;length > index; index++) {
  312. if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
  313. } return !IS_INCLUDES && -1;
  314. };
  315. };
  316. var arrayIncludes = {
  317. // `Array.prototype.includes` method
  318. // https://tc39.github.io/ecma262/#sec-array.prototype.includes
  319. includes: createMethod(true),
  320. // `Array.prototype.indexOf` method
  321. // https://tc39.github.io/ecma262/#sec-array.prototype.indexof
  322. indexOf: createMethod(false)
  323. };
  324. var indexOf = arrayIncludes.indexOf;
  325. var objectKeysInternal = function (object, names) {
  326. var O = toIndexedObject(object);
  327. var i = 0;
  328. var result = [];
  329. var key;
  330. for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key);
  331. // Don't enum bug & hidden keys
  332. while (names.length > i) if (has(O, key = names[i++])) {
  333. ~indexOf(result, key) || result.push(key);
  334. }
  335. return result;
  336. };
  337. // IE8- don't enum bug keys
  338. var enumBugKeys = [
  339. 'constructor',
  340. 'hasOwnProperty',
  341. 'isPrototypeOf',
  342. 'propertyIsEnumerable',
  343. 'toLocaleString',
  344. 'toString',
  345. 'valueOf'
  346. ];
  347. var hiddenKeys$1 = enumBugKeys.concat('length', 'prototype');
  348. // `Object.getOwnPropertyNames` method
  349. // https://tc39.github.io/ecma262/#sec-object.getownpropertynames
  350. var f$3 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
  351. return objectKeysInternal(O, hiddenKeys$1);
  352. };
  353. var objectGetOwnPropertyNames = {
  354. f: f$3
  355. };
  356. var f$4 = Object.getOwnPropertySymbols;
  357. var objectGetOwnPropertySymbols = {
  358. f: f$4
  359. };
  360. // all object keys, includes non-enumerable and symbols
  361. var ownKeys = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
  362. var keys = objectGetOwnPropertyNames.f(anObject(it));
  363. var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
  364. return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
  365. };
  366. var copyConstructorProperties = function (target, source) {
  367. var keys = ownKeys(source);
  368. var defineProperty = objectDefineProperty.f;
  369. var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
  370. for (var i = 0; i < keys.length; i++) {
  371. var key = keys[i];
  372. if (!has(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
  373. }
  374. };
  375. var replacement = /#|\.prototype\./;
  376. var isForced = function (feature, detection) {
  377. var value = data[normalize(feature)];
  378. return value == POLYFILL ? true
  379. : value == NATIVE ? false
  380. : typeof detection == 'function' ? fails(detection)
  381. : !!detection;
  382. };
  383. var normalize = isForced.normalize = function (string) {
  384. return String(string).replace(replacement, '.').toLowerCase();
  385. };
  386. var data = isForced.data = {};
  387. var NATIVE = isForced.NATIVE = 'N';
  388. var POLYFILL = isForced.POLYFILL = 'P';
  389. var isForced_1 = isForced;
  390. var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
  391. /*
  392. options.target - name of the target object
  393. options.global - target is the global object
  394. options.stat - export as static methods of target
  395. options.proto - export as prototype methods of target
  396. options.real - real prototype method for the `pure` version
  397. options.forced - export even if the native feature is available
  398. options.bind - bind methods to the target, required for the `pure` version
  399. options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
  400. options.unsafe - use the simple assignment of property instead of delete + defineProperty
  401. options.sham - add a flag to not completely full polyfills
  402. options.enumerable - export as enumerable property
  403. options.noTargetGet - prevent calling a getter on target
  404. */
  405. var _export = function (options, source) {
  406. var TARGET = options.target;
  407. var GLOBAL = options.global;
  408. var STATIC = options.stat;
  409. var FORCED, target, key, targetProperty, sourceProperty, descriptor;
  410. if (GLOBAL) {
  411. target = global_1;
  412. } else if (STATIC) {
  413. target = global_1[TARGET] || setGlobal(TARGET, {});
  414. } else {
  415. target = (global_1[TARGET] || {}).prototype;
  416. }
  417. if (target) for (key in source) {
  418. sourceProperty = source[key];
  419. if (options.noTargetGet) {
  420. descriptor = getOwnPropertyDescriptor$1(target, key);
  421. targetProperty = descriptor && descriptor.value;
  422. } else targetProperty = target[key];
  423. FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
  424. // contained in target
  425. if (!FORCED && targetProperty !== undefined) {
  426. if (typeof sourceProperty === typeof targetProperty) continue;
  427. copyConstructorProperties(sourceProperty, targetProperty);
  428. }
  429. // add a flag to not completely full polyfills
  430. if (options.sham || (targetProperty && targetProperty.sham)) {
  431. createNonEnumerableProperty(sourceProperty, 'sham', true);
  432. }
  433. // extend global
  434. redefine(target, key, sourceProperty, options);
  435. }
  436. };
  437. // `IsArray` abstract operation
  438. // https://tc39.github.io/ecma262/#sec-isarray
  439. var isArray = Array.isArray || function isArray(arg) {
  440. return classofRaw(arg) == 'Array';
  441. };
  442. // `ToObject` abstract operation
  443. // https://tc39.github.io/ecma262/#sec-toobject
  444. var toObject = function (argument) {
  445. return Object(requireObjectCoercible(argument));
  446. };
  447. var createProperty = function (object, key, value) {
  448. var propertyKey = toPrimitive(key);
  449. if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value));
  450. else object[propertyKey] = value;
  451. };
  452. var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () {
  453. // Chrome 38 Symbol has incorrect toString conversion
  454. // eslint-disable-next-line no-undef
  455. return !String(Symbol());
  456. });
  457. var useSymbolAsUid = nativeSymbol
  458. // eslint-disable-next-line no-undef
  459. && !Symbol.sham
  460. // eslint-disable-next-line no-undef
  461. && typeof Symbol() == 'symbol';
  462. var WellKnownSymbolsStore = shared('wks');
  463. var Symbol$1 = global_1.Symbol;
  464. var createWellKnownSymbol = useSymbolAsUid ? Symbol$1 : uid;
  465. var wellKnownSymbol = function (name) {
  466. if (!has(WellKnownSymbolsStore, name)) {
  467. if (nativeSymbol && has(Symbol$1, name)) WellKnownSymbolsStore[name] = Symbol$1[name];
  468. else WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name);
  469. } return WellKnownSymbolsStore[name];
  470. };
  471. var SPECIES = wellKnownSymbol('species');
  472. // `ArraySpeciesCreate` abstract operation
  473. // https://tc39.github.io/ecma262/#sec-arrayspeciescreate
  474. var arraySpeciesCreate = function (originalArray, length) {
  475. var C;
  476. if (isArray(originalArray)) {
  477. C = originalArray.constructor;
  478. // cross-realm fallback
  479. if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;
  480. else if (isObject(C)) {
  481. C = C[SPECIES];
  482. if (C === null) C = undefined;
  483. }
  484. } return new (C === undefined ? Array : C)(length === 0 ? 0 : length);
  485. };
  486. var userAgent = getBuiltIn('navigator', 'userAgent') || '';
  487. var process = global_1.process;
  488. var versions = process && process.versions;
  489. var v8 = versions && versions.v8;
  490. var match, version;
  491. if (v8) {
  492. match = v8.split('.');
  493. version = match[0] + match[1];
  494. } else if (userAgent) {
  495. match = userAgent.match(/Edge\/(\d+)/);
  496. if (!match || match[1] >= 74) {
  497. match = userAgent.match(/Chrome\/(\d+)/);
  498. if (match) version = match[1];
  499. }
  500. }
  501. var v8Version = version && +version;
  502. var SPECIES$1 = wellKnownSymbol('species');
  503. var arrayMethodHasSpeciesSupport = function (METHOD_NAME) {
  504. // We can't use this feature detection in V8 since it causes
  505. // deoptimization and serious performance degradation
  506. // https://github.com/zloirock/core-js/issues/677
  507. return v8Version >= 51 || !fails(function () {
  508. var array = [];
  509. var constructor = array.constructor = {};
  510. constructor[SPECIES$1] = function () {
  511. return { foo: 1 };
  512. };
  513. return array[METHOD_NAME](Boolean).foo !== 1;
  514. });
  515. };
  516. var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
  517. var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
  518. var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';
  519. // We can't use this feature detection in V8 since it causes
  520. // deoptimization and serious performance degradation
  521. // https://github.com/zloirock/core-js/issues/679
  522. var IS_CONCAT_SPREADABLE_SUPPORT = v8Version >= 51 || !fails(function () {
  523. var array = [];
  524. array[IS_CONCAT_SPREADABLE] = false;
  525. return array.concat()[0] !== array;
  526. });
  527. var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
  528. var isConcatSpreadable = function (O) {
  529. if (!isObject(O)) return false;
  530. var spreadable = O[IS_CONCAT_SPREADABLE];
  531. return spreadable !== undefined ? !!spreadable : isArray(O);
  532. };
  533. var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
  534. // `Array.prototype.concat` method
  535. // https://tc39.github.io/ecma262/#sec-array.prototype.concat
  536. // with adding support of @@isConcatSpreadable and @@species
  537. _export({ target: 'Array', proto: true, forced: FORCED }, {
  538. concat: function concat(arg) { // eslint-disable-line no-unused-vars
  539. var O = toObject(this);
  540. var A = arraySpeciesCreate(O, 0);
  541. var n = 0;
  542. var i, k, length, len, E;
  543. for (i = -1, length = arguments.length; i < length; i++) {
  544. E = i === -1 ? O : arguments[i];
  545. if (isConcatSpreadable(E)) {
  546. len = toLength(E.length);
  547. if (n + len > MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
  548. for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
  549. } else {
  550. if (n >= MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
  551. createProperty(A, n++, E);
  552. }
  553. }
  554. A.length = n;
  555. return A;
  556. }
  557. });
  558. var aFunction$1 = function (it) {
  559. if (typeof it != 'function') {
  560. throw TypeError(String(it) + ' is not a function');
  561. } return it;
  562. };
  563. // optional / simple context binding
  564. var bindContext = function (fn, that, length) {
  565. aFunction$1(fn);
  566. if (that === undefined) return fn;
  567. switch (length) {
  568. case 0: return function () {
  569. return fn.call(that);
  570. };
  571. case 1: return function (a) {
  572. return fn.call(that, a);
  573. };
  574. case 2: return function (a, b) {
  575. return fn.call(that, a, b);
  576. };
  577. case 3: return function (a, b, c) {
  578. return fn.call(that, a, b, c);
  579. };
  580. }
  581. return function (/* ...args */) {
  582. return fn.apply(that, arguments);
  583. };
  584. };
  585. var push = [].push;
  586. // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex }` methods implementation
  587. var createMethod$1 = function (TYPE) {
  588. var IS_MAP = TYPE == 1;
  589. var IS_FILTER = TYPE == 2;
  590. var IS_SOME = TYPE == 3;
  591. var IS_EVERY = TYPE == 4;
  592. var IS_FIND_INDEX = TYPE == 6;
  593. var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
  594. return function ($this, callbackfn, that, specificCreate) {
  595. var O = toObject($this);
  596. var self = indexedObject(O);
  597. var boundFunction = bindContext(callbackfn, that, 3);
  598. var length = toLength(self.length);
  599. var index = 0;
  600. var create = specificCreate || arraySpeciesCreate;
  601. var target = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;
  602. var value, result;
  603. for (;length > index; index++) if (NO_HOLES || index in self) {
  604. value = self[index];
  605. result = boundFunction(value, index, O);
  606. if (TYPE) {
  607. if (IS_MAP) target[index] = result; // map
  608. else if (result) switch (TYPE) {
  609. case 3: return true; // some
  610. case 5: return value; // find
  611. case 6: return index; // findIndex
  612. case 2: push.call(target, value); // filter
  613. } else if (IS_EVERY) return false; // every
  614. }
  615. }
  616. return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
  617. };
  618. };
  619. var arrayIteration = {
  620. // `Array.prototype.forEach` method
  621. // https://tc39.github.io/ecma262/#sec-array.prototype.foreach
  622. forEach: createMethod$1(0),
  623. // `Array.prototype.map` method
  624. // https://tc39.github.io/ecma262/#sec-array.prototype.map
  625. map: createMethod$1(1),
  626. // `Array.prototype.filter` method
  627. // https://tc39.github.io/ecma262/#sec-array.prototype.filter
  628. filter: createMethod$1(2),
  629. // `Array.prototype.some` method
  630. // https://tc39.github.io/ecma262/#sec-array.prototype.some
  631. some: createMethod$1(3),
  632. // `Array.prototype.every` method
  633. // https://tc39.github.io/ecma262/#sec-array.prototype.every
  634. every: createMethod$1(4),
  635. // `Array.prototype.find` method
  636. // https://tc39.github.io/ecma262/#sec-array.prototype.find
  637. find: createMethod$1(5),
  638. // `Array.prototype.findIndex` method
  639. // https://tc39.github.io/ecma262/#sec-array.prototype.findIndex
  640. findIndex: createMethod$1(6)
  641. };
  642. var $filter = arrayIteration.filter;
  643. var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('filter');
  644. // Edge 14- issue
  645. var USES_TO_LENGTH = HAS_SPECIES_SUPPORT && !fails(function () {
  646. [].filter.call({ length: -1, 0: 1 }, function (it) { throw it; });
  647. });
  648. // `Array.prototype.filter` method
  649. // https://tc39.github.io/ecma262/#sec-array.prototype.filter
  650. // with adding support of @@species
  651. _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT || !USES_TO_LENGTH }, {
  652. filter: function filter(callbackfn /* , thisArg */) {
  653. return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  654. }
  655. });
  656. // `Object.keys` method
  657. // https://tc39.github.io/ecma262/#sec-object.keys
  658. var objectKeys = Object.keys || function keys(O) {
  659. return objectKeysInternal(O, enumBugKeys);
  660. };
  661. // `Object.defineProperties` method
  662. // https://tc39.github.io/ecma262/#sec-object.defineproperties
  663. var objectDefineProperties = descriptors ? Object.defineProperties : function defineProperties(O, Properties) {
  664. anObject(O);
  665. var keys = objectKeys(Properties);
  666. var length = keys.length;
  667. var index = 0;
  668. var key;
  669. while (length > index) objectDefineProperty.f(O, key = keys[index++], Properties[key]);
  670. return O;
  671. };
  672. var html = getBuiltIn('document', 'documentElement');
  673. var GT = '>';
  674. var LT = '<';
  675. var PROTOTYPE = 'prototype';
  676. var SCRIPT = 'script';
  677. var IE_PROTO = sharedKey('IE_PROTO');
  678. var EmptyConstructor = function () { /* empty */ };
  679. var scriptTag = function (content) {
  680. return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
  681. };
  682. // Create object with fake `null` prototype: use ActiveX Object with cleared prototype
  683. var NullProtoObjectViaActiveX = function (activeXDocument) {
  684. activeXDocument.write(scriptTag(''));
  685. activeXDocument.close();
  686. var temp = activeXDocument.parentWindow.Object;
  687. activeXDocument = null; // avoid memory leak
  688. return temp;
  689. };
  690. // Create object with fake `null` prototype: use iframe Object with cleared prototype
  691. var NullProtoObjectViaIFrame = function () {
  692. // Thrash, waste and sodomy: IE GC bug
  693. var iframe = documentCreateElement('iframe');
  694. var JS = 'java' + SCRIPT + ':';
  695. var iframeDocument;
  696. iframe.style.display = 'none';
  697. html.appendChild(iframe);
  698. // https://github.com/zloirock/core-js/issues/475
  699. iframe.src = String(JS);
  700. iframeDocument = iframe.contentWindow.document;
  701. iframeDocument.open();
  702. iframeDocument.write(scriptTag('document.F=Object'));
  703. iframeDocument.close();
  704. return iframeDocument.F;
  705. };
  706. // Check for document.domain and active x support
  707. // No need to use active x approach when document.domain is not set
  708. // see https://github.com/es-shims/es5-shim/issues/150
  709. // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
  710. // avoid IE GC bug
  711. var activeXDocument;
  712. var NullProtoObject = function () {
  713. try {
  714. /* global ActiveXObject */
  715. activeXDocument = document.domain && new ActiveXObject('htmlfile');
  716. } catch (error) { /* ignore */ }
  717. NullProtoObject = activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame();
  718. var length = enumBugKeys.length;
  719. while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
  720. return NullProtoObject();
  721. };
  722. hiddenKeys[IE_PROTO] = true;
  723. // `Object.create` method
  724. // https://tc39.github.io/ecma262/#sec-object.create
  725. var objectCreate = Object.create || function create(O, Properties) {
  726. var result;
  727. if (O !== null) {
  728. EmptyConstructor[PROTOTYPE] = anObject(O);
  729. result = new EmptyConstructor();
  730. EmptyConstructor[PROTOTYPE] = null;
  731. // add "__proto__" for Object.getPrototypeOf polyfill
  732. result[IE_PROTO] = O;
  733. } else result = NullProtoObject();
  734. return Properties === undefined ? result : objectDefineProperties(result, Properties);
  735. };
  736. var UNSCOPABLES = wellKnownSymbol('unscopables');
  737. var ArrayPrototype = Array.prototype;
  738. // Array.prototype[@@unscopables]
  739. // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
  740. if (ArrayPrototype[UNSCOPABLES] == undefined) {
  741. objectDefineProperty.f(ArrayPrototype, UNSCOPABLES, {
  742. configurable: true,
  743. value: objectCreate(null)
  744. });
  745. }
  746. // add a key to Array.prototype[@@unscopables]
  747. var addToUnscopables = function (key) {
  748. ArrayPrototype[UNSCOPABLES][key] = true;
  749. };
  750. var $find = arrayIteration.find;
  751. var FIND = 'find';
  752. var SKIPS_HOLES = true;
  753. // Shouldn't skip holes
  754. if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });
  755. // `Array.prototype.find` method
  756. // https://tc39.github.io/ecma262/#sec-array.prototype.find
  757. _export({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
  758. find: function find(callbackfn /* , that = undefined */) {
  759. return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  760. }
  761. });
  762. // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
  763. addToUnscopables(FIND);
  764. var sloppyArrayMethod = function (METHOD_NAME, argument) {
  765. var method = [][METHOD_NAME];
  766. return !method || !fails(function () {
  767. // eslint-disable-next-line no-useless-call,no-throw-literal
  768. method.call(null, argument || function () { throw 1; }, 1);
  769. });
  770. };
  771. var nativeJoin = [].join;
  772. var ES3_STRINGS = indexedObject != Object;
  773. var SLOPPY_METHOD = sloppyArrayMethod('join', ',');
  774. // `Array.prototype.join` method
  775. // https://tc39.github.io/ecma262/#sec-array.prototype.join
  776. _export({ target: 'Array', proto: true, forced: ES3_STRINGS || SLOPPY_METHOD }, {
  777. join: function join(separator) {
  778. return nativeJoin.call(toIndexedObject(this), separator === undefined ? ',' : separator);
  779. }
  780. });
  781. // `RegExp.prototype.flags` getter implementation
  782. // https://tc39.github.io/ecma262/#sec-get-regexp.prototype.flags
  783. var regexpFlags = function () {
  784. var that = anObject(this);
  785. var result = '';
  786. if (that.global) result += 'g';
  787. if (that.ignoreCase) result += 'i';
  788. if (that.multiline) result += 'm';
  789. if (that.dotAll) result += 's';
  790. if (that.unicode) result += 'u';
  791. if (that.sticky) result += 'y';
  792. return result;
  793. };
  794. // babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError,
  795. // so we use an intermediate function.
  796. function RE(s, f) {
  797. return RegExp(s, f);
  798. }
  799. var UNSUPPORTED_Y = fails(function () {
  800. // babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError
  801. var re = RE('a', 'y');
  802. re.lastIndex = 2;
  803. return re.exec('abcd') != null;
  804. });
  805. var BROKEN_CARET = fails(function () {
  806. // https://bugzilla.mozilla.org/show_bug.cgi?id=773687
  807. var re = RE('^r', 'gy');
  808. re.lastIndex = 2;
  809. return re.exec('str') != null;
  810. });
  811. var regexpStickyHelpers = {
  812. UNSUPPORTED_Y: UNSUPPORTED_Y,
  813. BROKEN_CARET: BROKEN_CARET
  814. };
  815. var nativeExec = RegExp.prototype.exec;
  816. // This always refers to the native implementation, because the
  817. // String#replace polyfill uses ./fix-regexp-well-known-symbol-logic.js,
  818. // which loads this file before patching the method.
  819. var nativeReplace = String.prototype.replace;
  820. var patchedExec = nativeExec;
  821. var UPDATES_LAST_INDEX_WRONG = (function () {
  822. var re1 = /a/;
  823. var re2 = /b*/g;
  824. nativeExec.call(re1, 'a');
  825. nativeExec.call(re2, 'a');
  826. return re1.lastIndex !== 0 || re2.lastIndex !== 0;
  827. })();
  828. var UNSUPPORTED_Y$1 = regexpStickyHelpers.UNSUPPORTED_Y || regexpStickyHelpers.BROKEN_CARET;
  829. // nonparticipating capturing group, copied from es5-shim's String#split patch.
  830. var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
  831. var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y$1;
  832. if (PATCH) {
  833. patchedExec = function exec(str) {
  834. var re = this;
  835. var lastIndex, reCopy, match, i;
  836. var sticky = UNSUPPORTED_Y$1 && re.sticky;
  837. var flags = regexpFlags.call(re);
  838. var source = re.source;
  839. var charsAdded = 0;
  840. var strCopy = str;
  841. if (sticky) {
  842. flags = flags.replace('y', '');
  843. if (flags.indexOf('g') === -1) {
  844. flags += 'g';
  845. }
  846. strCopy = String(str).slice(re.lastIndex);
  847. // Support anchored sticky behavior.
  848. if (re.lastIndex > 0 && (!re.multiline || re.multiline && str[re.lastIndex - 1] !== '\n')) {
  849. source = '(?: ' + source + ')';
  850. strCopy = ' ' + strCopy;
  851. charsAdded++;
  852. }
  853. // ^(? + rx + ) is needed, in combination with some str slicing, to
  854. // simulate the 'y' flag.
  855. reCopy = new RegExp('^(?:' + source + ')', flags);
  856. }
  857. if (NPCG_INCLUDED) {
  858. reCopy = new RegExp('^' + source + '$(?!\\s)', flags);
  859. }
  860. if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;
  861. match = nativeExec.call(sticky ? reCopy : re, strCopy);
  862. if (sticky) {
  863. if (match) {
  864. match.input = match.input.slice(charsAdded);
  865. match[0] = match[0].slice(charsAdded);
  866. match.index = re.lastIndex;
  867. re.lastIndex += match[0].length;
  868. } else re.lastIndex = 0;
  869. } else if (UPDATES_LAST_INDEX_WRONG && match) {
  870. re.lastIndex = re.global ? match.index + match[0].length : lastIndex;
  871. }
  872. if (NPCG_INCLUDED && match && match.length > 1) {
  873. // Fix browsers whose `exec` methods don't consistently return `undefined`
  874. // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/
  875. nativeReplace.call(match[0], reCopy, function () {
  876. for (i = 1; i < arguments.length - 2; i++) {
  877. if (arguments[i] === undefined) match[i] = undefined;
  878. }
  879. });
  880. }
  881. return match;
  882. };
  883. }
  884. var regexpExec = patchedExec;
  885. _export({ target: 'RegExp', proto: true, forced: /./.exec !== regexpExec }, {
  886. exec: regexpExec
  887. });
  888. var SPECIES$2 = wellKnownSymbol('species');
  889. var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () {
  890. // #replace needs built-in support for named groups.
  891. // #match works fine because it just return the exec results, even if it has
  892. // a "grops" property.
  893. var re = /./;
  894. re.exec = function () {
  895. var result = [];
  896. result.groups = { a: '7' };
  897. return result;
  898. };
  899. return ''.replace(re, '$<a>') !== '7';
  900. });
  901. // IE <= 11 replaces $0 with the whole match, as if it was $&
  902. // https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0
  903. var REPLACE_KEEPS_$0 = (function () {
  904. return 'a'.replace(/./, '$0') === '$0';
  905. })();
  906. // Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec
  907. // Weex JS has frozen built-in prototypes, so use try / catch wrapper
  908. var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () {
  909. var re = /(?:)/;
  910. var originalExec = re.exec;
  911. re.exec = function () { return originalExec.apply(this, arguments); };
  912. var result = 'ab'.split(re);
  913. return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b';
  914. });
  915. var fixRegexpWellKnownSymbolLogic = function (KEY, length, exec, sham) {
  916. var SYMBOL = wellKnownSymbol(KEY);
  917. var DELEGATES_TO_SYMBOL = !fails(function () {
  918. // String methods call symbol-named RegEp methods
  919. var O = {};
  920. O[SYMBOL] = function () { return 7; };
  921. return ''[KEY](O) != 7;
  922. });
  923. var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails(function () {
  924. // Symbol-named RegExp methods call .exec
  925. var execCalled = false;
  926. var re = /a/;
  927. if (KEY === 'split') {
  928. // We can't use real regex here since it causes deoptimization
  929. // and serious performance degradation in V8
  930. // https://github.com/zloirock/core-js/issues/306
  931. re = {};
  932. // RegExp[@@split] doesn't call the regex's exec method, but first creates
  933. // a new one. We need to return the patched regex when creating the new one.
  934. re.constructor = {};
  935. re.constructor[SPECIES$2] = function () { return re; };
  936. re.flags = '';
  937. re[SYMBOL] = /./[SYMBOL];
  938. }
  939. re.exec = function () { execCalled = true; return null; };
  940. re[SYMBOL]('');
  941. return !execCalled;
  942. });
  943. if (
  944. !DELEGATES_TO_SYMBOL ||
  945. !DELEGATES_TO_EXEC ||
  946. (KEY === 'replace' && !(REPLACE_SUPPORTS_NAMED_GROUPS && REPLACE_KEEPS_$0)) ||
  947. (KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC)
  948. ) {
  949. var nativeRegExpMethod = /./[SYMBOL];
  950. var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {
  951. if (regexp.exec === regexpExec) {
  952. if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
  953. // The native String method already delegates to @@method (this
  954. // polyfilled function), leasing to infinite recursion.
  955. // We avoid it by directly calling the native @@method method.
  956. return { done: true, value: nativeRegExpMethod.call(regexp, str, arg2) };
  957. }
  958. return { done: true, value: nativeMethod.call(str, regexp, arg2) };
  959. }
  960. return { done: false };
  961. }, { REPLACE_KEEPS_$0: REPLACE_KEEPS_$0 });
  962. var stringMethod = methods[0];
  963. var regexMethod = methods[1];
  964. redefine(String.prototype, KEY, stringMethod);
  965. redefine(RegExp.prototype, SYMBOL, length == 2
  966. // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue)
  967. // 21.2.5.11 RegExp.prototype[@@split](string, limit)
  968. ? function (string, arg) { return regexMethod.call(string, this, arg); }
  969. // 21.2.5.6 RegExp.prototype[@@match](string)
  970. // 21.2.5.9 RegExp.prototype[@@search](string)
  971. : function (string) { return regexMethod.call(string, this); }
  972. );
  973. }
  974. if (sham) createNonEnumerableProperty(RegExp.prototype[SYMBOL], 'sham', true);
  975. };
  976. // `String.prototype.{ codePointAt, at }` methods implementation
  977. var createMethod$2 = function (CONVERT_TO_STRING) {
  978. return function ($this, pos) {
  979. var S = String(requireObjectCoercible($this));
  980. var position = toInteger(pos);
  981. var size = S.length;
  982. var first, second;
  983. if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
  984. first = S.charCodeAt(position);
  985. return first < 0xD800 || first > 0xDBFF || position + 1 === size
  986. || (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF
  987. ? CONVERT_TO_STRING ? S.charAt(position) : first
  988. : CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
  989. };
  990. };
  991. var stringMultibyte = {
  992. // `String.prototype.codePointAt` method
  993. // https://tc39.github.io/ecma262/#sec-string.prototype.codepointat
  994. codeAt: createMethod$2(false),
  995. // `String.prototype.at` method
  996. // https://github.com/mathiasbynens/String.prototype.at
  997. charAt: createMethod$2(true)
  998. };
  999. var charAt = stringMultibyte.charAt;
  1000. // `AdvanceStringIndex` abstract operation
  1001. // https://tc39.github.io/ecma262/#sec-advancestringindex
  1002. var advanceStringIndex = function (S, index, unicode) {
  1003. return index + (unicode ? charAt(S, index).length : 1);
  1004. };
  1005. // `RegExpExec` abstract operation
  1006. // https://tc39.github.io/ecma262/#sec-regexpexec
  1007. var regexpExecAbstract = function (R, S) {
  1008. var exec = R.exec;
  1009. if (typeof exec === 'function') {
  1010. var result = exec.call(R, S);
  1011. if (typeof result !== 'object') {
  1012. throw TypeError('RegExp exec method returned something other than an Object or null');
  1013. }
  1014. return result;
  1015. }
  1016. if (classofRaw(R) !== 'RegExp') {
  1017. throw TypeError('RegExp#exec called on incompatible receiver');
  1018. }
  1019. return regexpExec.call(R, S);
  1020. };
  1021. var max$1 = Math.max;
  1022. var min$2 = Math.min;
  1023. var floor$1 = Math.floor;
  1024. var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d\d?|<[^>]*>)/g;
  1025. var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d\d?)/g;
  1026. var maybeToString = function (it) {
  1027. return it === undefined ? it : String(it);
  1028. };
  1029. // @@replace logic
  1030. fixRegexpWellKnownSymbolLogic('replace', 2, function (REPLACE, nativeReplace, maybeCallNative, reason) {
  1031. return [
  1032. // `String.prototype.replace` method
  1033. // https://tc39.github.io/ecma262/#sec-string.prototype.replace
  1034. function replace(searchValue, replaceValue) {
  1035. var O = requireObjectCoercible(this);
  1036. var replacer = searchValue == undefined ? undefined : searchValue[REPLACE];
  1037. return replacer !== undefined
  1038. ? replacer.call(searchValue, O, replaceValue)
  1039. : nativeReplace.call(String(O), searchValue, replaceValue);
  1040. },
  1041. // `RegExp.prototype[@@replace]` method
  1042. // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@replace
  1043. function (regexp, replaceValue) {
  1044. if (reason.REPLACE_KEEPS_$0 || (typeof replaceValue === 'string' && replaceValue.indexOf('$0') === -1)) {
  1045. var res = maybeCallNative(nativeReplace, regexp, this, replaceValue);
  1046. if (res.done) return res.value;
  1047. }
  1048. var rx = anObject(regexp);
  1049. var S = String(this);
  1050. var functionalReplace = typeof replaceValue === 'function';
  1051. if (!functionalReplace) replaceValue = String(replaceValue);
  1052. var global = rx.global;
  1053. if (global) {
  1054. var fullUnicode = rx.unicode;
  1055. rx.lastIndex = 0;
  1056. }
  1057. var results = [];
  1058. while (true) {
  1059. var result = regexpExecAbstract(rx, S);
  1060. if (result === null) break;
  1061. results.push(result);
  1062. if (!global) break;
  1063. var matchStr = String(result[0]);
  1064. if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
  1065. }
  1066. var accumulatedResult = '';
  1067. var nextSourcePosition = 0;
  1068. for (var i = 0; i < results.length; i++) {
  1069. result = results[i];
  1070. var matched = String(result[0]);
  1071. var position = max$1(min$2(toInteger(result.index), S.length), 0);
  1072. var captures = [];
  1073. // NOTE: This is equivalent to
  1074. // captures = result.slice(1).map(maybeToString)
  1075. // but for some reason `nativeSlice.call(result, 1, result.length)` (called in
  1076. // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and
  1077. // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.
  1078. for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j]));
  1079. var namedCaptures = result.groups;
  1080. if (functionalReplace) {
  1081. var replacerArgs = [matched].concat(captures, position, S);
  1082. if (namedCaptures !== undefined) replacerArgs.push(namedCaptures);
  1083. var replacement = String(replaceValue.apply(undefined, replacerArgs));
  1084. } else {
  1085. replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
  1086. }
  1087. if (position >= nextSourcePosition) {
  1088. accumulatedResult += S.slice(nextSourcePosition, position) + replacement;
  1089. nextSourcePosition = position + matched.length;
  1090. }
  1091. }
  1092. return accumulatedResult + S.slice(nextSourcePosition);
  1093. }
  1094. ];
  1095. // https://tc39.github.io/ecma262/#sec-getsubstitution
  1096. function getSubstitution(matched, str, position, captures, namedCaptures, replacement) {
  1097. var tailPos = position + matched.length;
  1098. var m = captures.length;
  1099. var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
  1100. if (namedCaptures !== undefined) {
  1101. namedCaptures = toObject(namedCaptures);
  1102. symbols = SUBSTITUTION_SYMBOLS;
  1103. }
  1104. return nativeReplace.call(replacement, symbols, function (match, ch) {
  1105. var capture;
  1106. switch (ch.charAt(0)) {
  1107. case '$': return '$';
  1108. case '&': return matched;
  1109. case '`': return str.slice(0, position);
  1110. case "'": return str.slice(tailPos);
  1111. case '<':
  1112. capture = namedCaptures[ch.slice(1, -1)];
  1113. break;
  1114. default: // \d\d?
  1115. var n = +ch;
  1116. if (n === 0) return match;
  1117. if (n > m) {
  1118. var f = floor$1(n / 10);
  1119. if (f === 0) return match;
  1120. if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1);
  1121. return match;
  1122. }
  1123. capture = captures[n - 1];
  1124. }
  1125. return capture === undefined ? '' : capture;
  1126. });
  1127. }
  1128. });
  1129. // `SameValue` abstract operation
  1130. // https://tc39.github.io/ecma262/#sec-samevalue
  1131. var sameValue = Object.is || function is(x, y) {
  1132. // eslint-disable-next-line no-self-compare
  1133. return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y;
  1134. };
  1135. // @@search logic
  1136. fixRegexpWellKnownSymbolLogic('search', 1, function (SEARCH, nativeSearch, maybeCallNative) {
  1137. return [
  1138. // `String.prototype.search` method
  1139. // https://tc39.github.io/ecma262/#sec-string.prototype.search
  1140. function search(regexp) {
  1141. var O = requireObjectCoercible(this);
  1142. var searcher = regexp == undefined ? undefined : regexp[SEARCH];
  1143. return searcher !== undefined ? searcher.call(regexp, O) : new RegExp(regexp)[SEARCH](String(O));
  1144. },
  1145. // `RegExp.prototype[@@search]` method
  1146. // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@search
  1147. function (regexp) {
  1148. var res = maybeCallNative(nativeSearch, regexp, this);
  1149. if (res.done) return res.value;
  1150. var rx = anObject(regexp);
  1151. var S = String(this);
  1152. var previousLastIndex = rx.lastIndex;
  1153. if (!sameValue(previousLastIndex, 0)) rx.lastIndex = 0;
  1154. var result = regexpExecAbstract(rx, S);
  1155. if (!sameValue(rx.lastIndex, previousLastIndex)) rx.lastIndex = previousLastIndex;
  1156. return result === null ? -1 : result.index;
  1157. }
  1158. ];
  1159. });
  1160. var MATCH = wellKnownSymbol('match');
  1161. // `IsRegExp` abstract operation
  1162. // https://tc39.github.io/ecma262/#sec-isregexp
  1163. var isRegexp = function (it) {
  1164. var isRegExp;
  1165. return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classofRaw(it) == 'RegExp');
  1166. };
  1167. var SPECIES$3 = wellKnownSymbol('species');
  1168. // `SpeciesConstructor` abstract operation
  1169. // https://tc39.github.io/ecma262/#sec-speciesconstructor
  1170. var speciesConstructor = function (O, defaultConstructor) {
  1171. var C = anObject(O).constructor;
  1172. var S;
  1173. return C === undefined || (S = anObject(C)[SPECIES$3]) == undefined ? defaultConstructor : aFunction$1(S);
  1174. };
  1175. var arrayPush = [].push;
  1176. var min$3 = Math.min;
  1177. var MAX_UINT32 = 0xFFFFFFFF;
  1178. // babel-minify transpiles RegExp('x', 'y') -> /x/y and it causes SyntaxError
  1179. var SUPPORTS_Y = !fails(function () { return !RegExp(MAX_UINT32, 'y'); });
  1180. // @@split logic
  1181. fixRegexpWellKnownSymbolLogic('split', 2, function (SPLIT, nativeSplit, maybeCallNative) {
  1182. var internalSplit;
  1183. if (
  1184. 'abbc'.split(/(b)*/)[1] == 'c' ||
  1185. 'test'.split(/(?:)/, -1).length != 4 ||
  1186. 'ab'.split(/(?:ab)*/).length != 2 ||
  1187. '.'.split(/(.?)(.?)/).length != 4 ||
  1188. '.'.split(/()()/).length > 1 ||
  1189. ''.split(/.?/).length
  1190. ) {
  1191. // based on es5-shim implementation, need to rework it
  1192. internalSplit = function (separator, limit) {
  1193. var string = String(requireObjectCoercible(this));
  1194. var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
  1195. if (lim === 0) return [];
  1196. if (separator === undefined) return [string];
  1197. // If `separator` is not a regex, use native split
  1198. if (!isRegexp(separator)) {
  1199. return nativeSplit.call(string, separator, lim);
  1200. }
  1201. var output = [];
  1202. var flags = (separator.ignoreCase ? 'i' : '') +
  1203. (separator.multiline ? 'm' : '') +
  1204. (separator.unicode ? 'u' : '') +
  1205. (separator.sticky ? 'y' : '');
  1206. var lastLastIndex = 0;
  1207. // Make `global` and avoid `lastIndex` issues by working with a copy
  1208. var separatorCopy = new RegExp(separator.source, flags + 'g');
  1209. var match, lastIndex, lastLength;
  1210. while (match = regexpExec.call(separatorCopy, string)) {
  1211. lastIndex = separatorCopy.lastIndex;
  1212. if (lastIndex > lastLastIndex) {
  1213. output.push(string.slice(lastLastIndex, match.index));
  1214. if (match.length > 1 && match.index < string.length) arrayPush.apply(output, match.slice(1));
  1215. lastLength = match[0].length;
  1216. lastLastIndex = lastIndex;
  1217. if (output.length >= lim) break;
  1218. }
  1219. if (separatorCopy.lastIndex === match.index) separatorCopy.lastIndex++; // Avoid an infinite loop
  1220. }
  1221. if (lastLastIndex === string.length) {
  1222. if (lastLength || !separatorCopy.test('')) output.push('');
  1223. } else output.push(string.slice(lastLastIndex));
  1224. return output.length > lim ? output.slice(0, lim) : output;
  1225. };
  1226. // Chakra, V8
  1227. } else if ('0'.split(undefined, 0).length) {
  1228. internalSplit = function (separator, limit) {
  1229. return separator === undefined && limit === 0 ? [] : nativeSplit.call(this, separator, limit);
  1230. };
  1231. } else internalSplit = nativeSplit;
  1232. return [
  1233. // `String.prototype.split` method
  1234. // https://tc39.github.io/ecma262/#sec-string.prototype.split
  1235. function split(separator, limit) {
  1236. var O = requireObjectCoercible(this);
  1237. var splitter = separator == undefined ? undefined : separator[SPLIT];
  1238. return splitter !== undefined
  1239. ? splitter.call(separator, O, limit)
  1240. : internalSplit.call(String(O), separator, limit);
  1241. },
  1242. // `RegExp.prototype[@@split]` method
  1243. // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@split
  1244. //
  1245. // NOTE: This cannot be properly polyfilled in engines that don't support
  1246. // the 'y' flag.
  1247. function (regexp, limit) {
  1248. var res = maybeCallNative(internalSplit, regexp, this, limit, internalSplit !== nativeSplit);
  1249. if (res.done) return res.value;
  1250. var rx = anObject(regexp);
  1251. var S = String(this);
  1252. var C = speciesConstructor(rx, RegExp);
  1253. var unicodeMatching = rx.unicode;
  1254. var flags = (rx.ignoreCase ? 'i' : '') +
  1255. (rx.multiline ? 'm' : '') +
  1256. (rx.unicode ? 'u' : '') +
  1257. (SUPPORTS_Y ? 'y' : 'g');
  1258. // ^(? + rx + ) is needed, in combination with some S slicing, to
  1259. // simulate the 'y' flag.
  1260. var splitter = new C(SUPPORTS_Y ? rx : '^(?:' + rx.source + ')', flags);
  1261. var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
  1262. if (lim === 0) return [];
  1263. if (S.length === 0) return regexpExecAbstract(splitter, S) === null ? [S] : [];
  1264. var p = 0;
  1265. var q = 0;
  1266. var A = [];
  1267. while (q < S.length) {
  1268. splitter.lastIndex = SUPPORTS_Y ? q : 0;
  1269. var z = regexpExecAbstract(splitter, SUPPORTS_Y ? S : S.slice(q));
  1270. var e;
  1271. if (
  1272. z === null ||
  1273. (e = min$3(toLength(splitter.lastIndex + (SUPPORTS_Y ? 0 : q)), S.length)) === p
  1274. ) {
  1275. q = advanceStringIndex(S, q, unicodeMatching);
  1276. } else {
  1277. A.push(S.slice(p, q));
  1278. if (A.length === lim) return A;
  1279. for (var i = 1; i <= z.length - 1; i++) {
  1280. A.push(z[i]);
  1281. if (A.length === lim) return A;
  1282. }
  1283. q = p = e;
  1284. }
  1285. }
  1286. A.push(S.slice(p));
  1287. return A;
  1288. }
  1289. ];
  1290. }, !SUPPORTS_Y);
  1291. // iterable DOM collections
  1292. // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
  1293. var domIterables = {
  1294. CSSRuleList: 0,
  1295. CSSStyleDeclaration: 0,
  1296. CSSValueList: 0,
  1297. ClientRectList: 0,
  1298. DOMRectList: 0,
  1299. DOMStringList: 0,
  1300. DOMTokenList: 1,
  1301. DataTransferItemList: 0,
  1302. FileList: 0,
  1303. HTMLAllCollection: 0,
  1304. HTMLCollection: 0,
  1305. HTMLFormElement: 0,
  1306. HTMLSelectElement: 0,
  1307. MediaList: 0,
  1308. MimeTypeArray: 0,
  1309. NamedNodeMap: 0,
  1310. NodeList: 1,
  1311. PaintRequestList: 0,
  1312. Plugin: 0,
  1313. PluginArray: 0,
  1314. SVGLengthList: 0,
  1315. SVGNumberList: 0,
  1316. SVGPathSegList: 0,
  1317. SVGPointList: 0,
  1318. SVGStringList: 0,
  1319. SVGTransformList: 0,
  1320. SourceBufferList: 0,
  1321. StyleSheetList: 0,
  1322. TextTrackCueList: 0,
  1323. TextTrackList: 0,
  1324. TouchList: 0
  1325. };
  1326. var $forEach = arrayIteration.forEach;
  1327. // `Array.prototype.forEach` method implementation
  1328. // https://tc39.github.io/ecma262/#sec-array.prototype.foreach
  1329. var arrayForEach = sloppyArrayMethod('forEach') ? function forEach(callbackfn /* , thisArg */) {
  1330. return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  1331. } : [].forEach;
  1332. for (var COLLECTION_NAME in domIterables) {
  1333. var Collection = global_1[COLLECTION_NAME];
  1334. var CollectionPrototype = Collection && Collection.prototype;
  1335. // some Chrome versions have non-configurable methods on DOMTokenList
  1336. if (CollectionPrototype && CollectionPrototype.forEach !== arrayForEach) try {
  1337. createNonEnumerableProperty(CollectionPrototype, 'forEach', arrayForEach);
  1338. } catch (error) {
  1339. CollectionPrototype.forEach = arrayForEach;
  1340. }
  1341. }
  1342. function _classCallCheck(instance, Constructor) {
  1343. if (!(instance instanceof Constructor)) {
  1344. throw new TypeError("Cannot call a class as a function");
  1345. }
  1346. }
  1347. function _defineProperties(target, props) {
  1348. for (var i = 0; i < props.length; i++) {
  1349. var descriptor = props[i];
  1350. descriptor.enumerable = descriptor.enumerable || false;
  1351. descriptor.configurable = true;
  1352. if ("value" in descriptor) descriptor.writable = true;
  1353. Object.defineProperty(target, descriptor.key, descriptor);
  1354. }
  1355. }
  1356. function _createClass(Constructor, protoProps, staticProps) {
  1357. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  1358. if (staticProps) _defineProperties(Constructor, staticProps);
  1359. return Constructor;
  1360. }
  1361. function _inherits(subClass, superClass) {
  1362. if (typeof superClass !== "function" && superClass !== null) {
  1363. throw new TypeError("Super expression must either be null or a function");
  1364. }
  1365. subClass.prototype = Object.create(superClass && superClass.prototype, {
  1366. constructor: {
  1367. value: subClass,
  1368. writable: true,
  1369. configurable: true
  1370. }
  1371. });
  1372. if (superClass) _setPrototypeOf(subClass, superClass);
  1373. }
  1374. function _getPrototypeOf(o) {
  1375. _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
  1376. return o.__proto__ || Object.getPrototypeOf(o);
  1377. };
  1378. return _getPrototypeOf(o);
  1379. }
  1380. function _setPrototypeOf(o, p) {
  1381. _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
  1382. o.__proto__ = p;
  1383. return o;
  1384. };
  1385. return _setPrototypeOf(o, p);
  1386. }
  1387. function _assertThisInitialized(self) {
  1388. if (self === void 0) {
  1389. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  1390. }
  1391. return self;
  1392. }
  1393. function _possibleConstructorReturn(self, call) {
  1394. if (call && (typeof call === "object" || typeof call === "function")) {
  1395. return call;
  1396. }
  1397. return _assertThisInitialized(self);
  1398. }
  1399. function _superPropBase(object, property) {
  1400. while (!Object.prototype.hasOwnProperty.call(object, property)) {
  1401. object = _getPrototypeOf(object);
  1402. if (object === null) break;
  1403. }
  1404. return object;
  1405. }
  1406. function _get(target, property, receiver) {
  1407. if (typeof Reflect !== "undefined" && Reflect.get) {
  1408. _get = Reflect.get;
  1409. } else {
  1410. _get = function _get(target, property, receiver) {
  1411. var base = _superPropBase(target, property);
  1412. if (!base) return;
  1413. var desc = Object.getOwnPropertyDescriptor(base, property);
  1414. if (desc.get) {
  1415. return desc.get.call(receiver);
  1416. }
  1417. return desc.value;
  1418. };
  1419. }
  1420. return _get(target, property, receiver || target);
  1421. }
  1422. /**
  1423. * @author: Dennis Hernández
  1424. * @webSite: http://djhvscf.github.io/Blog
  1425. * @update zhixin wen <wenzhixin2010@gmail.com>
  1426. */
  1427. var Utils = $.fn.bootstrapTable.utils;
  1428. var UtilsCookie = {
  1429. cookieIds: {
  1430. sortOrder: 'bs.table.sortOrder',
  1431. sortName: 'bs.table.sortName',
  1432. pageNumber: 'bs.table.pageNumber',
  1433. pageList: 'bs.table.pageList',
  1434. columns: 'bs.table.columns',
  1435. searchText: 'bs.table.searchText',
  1436. reorderColumns: 'bs.table.reorderColumns',
  1437. filterControl: 'bs.table.filterControl',
  1438. filterBy: 'bs.table.filterBy'
  1439. },
  1440. getCurrentHeader: function getCurrentHeader(that) {
  1441. var header = that.$header;
  1442. if (that.options.height) {
  1443. header = that.$tableHeader;
  1444. }
  1445. return header;
  1446. },
  1447. getCurrentSearchControls: function getCurrentSearchControls(that) {
  1448. var searchControls = 'select, input';
  1449. if (that.options.height) {
  1450. searchControls = 'table select, table input';
  1451. }
  1452. return searchControls;
  1453. },
  1454. cookieEnabled: function cookieEnabled() {
  1455. return !!navigator.cookieEnabled;
  1456. },
  1457. inArrayCookiesEnabled: function inArrayCookiesEnabled(cookieName, cookiesEnabled) {
  1458. var index = -1;
  1459. for (var i = 0; i < cookiesEnabled.length; i++) {
  1460. if (cookieName.toLowerCase() === cookiesEnabled[i].toLowerCase()) {
  1461. index = i;
  1462. break;
  1463. }
  1464. }
  1465. return index;
  1466. },
  1467. setCookie: function setCookie(that, cookieName, cookieValue) {
  1468. if (!that.options.cookie || !UtilsCookie.cookieEnabled() || that.options.cookieIdTable === '') {
  1469. return;
  1470. }
  1471. if (UtilsCookie.inArrayCookiesEnabled(cookieName, that.options.cookiesEnabled) === -1) {
  1472. return;
  1473. }
  1474. cookieName = "".concat(that.options.cookieIdTable, ".").concat(cookieName);
  1475. switch (that.options.cookieStorage) {
  1476. case 'cookieStorage':
  1477. document.cookie = [cookieName, '=', encodeURIComponent(cookieValue), "; expires=".concat(UtilsCookie.calculateExpiration(that.options.cookieExpire)), that.options.cookiePath ? "; path=".concat(that.options.cookiePath) : '', that.options.cookieDomain ? "; domain=".concat(that.options.cookieDomain) : '', that.options.cookieSecure ? '; secure' : ''].join('');
  1478. break;
  1479. case 'localStorage':
  1480. localStorage.setItem(cookieName, cookieValue);
  1481. break;
  1482. case 'sessionStorage':
  1483. sessionStorage.setItem(cookieName, cookieValue);
  1484. break;
  1485. case 'customStorage':
  1486. if (!that.options.cookieCustomStorageSet || !that.options.cookieCustomStorageGet || !that.options.cookieCustomStorageDelete) {
  1487. throw new Error('The following options must be set while using the customStorage: cookieCustomStorageSet, cookieCustomStorageGet and cookieCustomStorageDelete');
  1488. }
  1489. Utils.calculateObjectValue(that.options, that.options.cookieCustomStorageSet, [cookieName, cookieValue], '');
  1490. break;
  1491. default:
  1492. return false;
  1493. }
  1494. return true;
  1495. },
  1496. getCookie: function getCookie(that, tableName, cookieName) {
  1497. if (!cookieName) {
  1498. return null;
  1499. }
  1500. if (UtilsCookie.inArrayCookiesEnabled(cookieName, that.options.cookiesEnabled) === -1) {
  1501. return null;
  1502. }
  1503. cookieName = "".concat(tableName, ".").concat(cookieName);
  1504. switch (that.options.cookieStorage) {
  1505. case 'cookieStorage':
  1506. var value = "; ".concat(document.cookie);
  1507. var parts = value.split("; ".concat(cookieName, "="));
  1508. return parts.length === 2 ? decodeURIComponent(parts.pop().split(';').shift()) : null;
  1509. case 'localStorage':
  1510. return localStorage.getItem(cookieName);
  1511. case 'sessionStorage':
  1512. return sessionStorage.getItem(cookieName);
  1513. case 'customStorage':
  1514. if (!that.options.cookieCustomStorageSet || !that.options.cookieCustomStorageGet || !that.options.cookieCustomStorageDelete) {
  1515. throw new Error('The following options must be set while using the customStorage: cookieCustomStorageSet, cookieCustomStorageGet and cookieCustomStorageDelete');
  1516. }
  1517. return Utils.calculateObjectValue(that.options, that.options.cookieCustomStorageGet, [cookieName], '');
  1518. default:
  1519. return null;
  1520. }
  1521. },
  1522. deleteCookie: function deleteCookie(that, tableName, cookieName) {
  1523. cookieName = "".concat(tableName, ".").concat(cookieName);
  1524. switch (that.options.cookieStorage) {
  1525. case 'cookieStorage':
  1526. document.cookie = [encodeURIComponent(cookieName), '=', '; expires=Thu, 01 Jan 1970 00:00:00 GMT', that.options.cookiePath ? "; path=".concat(that.options.cookiePath) : '', that.options.cookieDomain ? "; domain=".concat(that.options.cookieDomain) : ''].join('');
  1527. break;
  1528. case 'localStorage':
  1529. localStorage.removeItem(cookieName);
  1530. break;
  1531. case 'sessionStorage':
  1532. sessionStorage.removeItem(cookieName);
  1533. break;
  1534. case 'customStorage':
  1535. if (!that.options.cookieCustomStorageSet || !that.options.cookieCustomStorageGet || !that.options.cookieCustomStorageDelete) {
  1536. throw new Error('The following options must be set while using the customStorage: cookieCustomStorageSet, cookieCustomStorageGet and cookieCustomStorageDelete');
  1537. }
  1538. Utils.calculateObjectValue(that.options, that.options.cookieCustomStorageDelete, [cookieName], '');
  1539. break;
  1540. default:
  1541. return false;
  1542. }
  1543. return true;
  1544. },
  1545. calculateExpiration: function calculateExpiration(cookieExpire) {
  1546. var time = cookieExpire.replace(/[0-9]*/, ''); // s,mi,h,d,m,y
  1547. cookieExpire = cookieExpire.replace(/[A-Za-z]{1,2}/, ''); // number
  1548. switch (time.toLowerCase()) {
  1549. case 's':
  1550. cookieExpire = +cookieExpire;
  1551. break;
  1552. case 'mi':
  1553. cookieExpire *= 60;
  1554. break;
  1555. case 'h':
  1556. cookieExpire = cookieExpire * 60 * 60;
  1557. break;
  1558. case 'd':
  1559. cookieExpire = cookieExpire * 24 * 60 * 60;
  1560. break;
  1561. case 'm':
  1562. cookieExpire = cookieExpire * 30 * 24 * 60 * 60;
  1563. break;
  1564. case 'y':
  1565. cookieExpire = cookieExpire * 365 * 24 * 60 * 60;
  1566. break;
  1567. default:
  1568. cookieExpire = undefined;
  1569. break;
  1570. }
  1571. if (!cookieExpire) {
  1572. return '';
  1573. }
  1574. var d = new Date();
  1575. d.setTime(d.getTime() + cookieExpire * 1000);
  1576. return d.toGMTString();
  1577. },
  1578. initCookieFilters: function initCookieFilters(bootstrapTable) {
  1579. setTimeout(function () {
  1580. var parsedCookieFilters = JSON.parse(UtilsCookie.getCookie(bootstrapTable, bootstrapTable.options.cookieIdTable, UtilsCookie.cookieIds.filterControl));
  1581. if (!bootstrapTable.options.filterControlValuesLoaded && parsedCookieFilters) {
  1582. var cachedFilters = {};
  1583. var header = UtilsCookie.getCurrentHeader(bootstrapTable);
  1584. var searchControls = UtilsCookie.getCurrentSearchControls(bootstrapTable);
  1585. var applyCookieFilters = function applyCookieFilters(element, filteredCookies) {
  1586. filteredCookies.forEach(function (cookie) {
  1587. if (cookie.text !== '' && element.tagName === 'INPUT') {
  1588. element.value = cookie.text;
  1589. cachedFilters[cookie.field] = cookie.text;
  1590. } else if (cookie.text !== '' && element.tagName === 'SELECT') {
  1591. var option = document.createElement('option');
  1592. option.value = cookie.text;
  1593. option.text = cookie.text;
  1594. element.add(option, element[1]);
  1595. element.selectedIndex = 1;
  1596. cachedFilters[cookie.field] = cookie.text;
  1597. }
  1598. });
  1599. };
  1600. header.find(searchControls).each(function () {
  1601. var field = $(this).closest('[data-field]').data('field');
  1602. var filteredCookies = parsedCookieFilters.filter(function (cookie) {
  1603. return cookie.field === field;
  1604. });
  1605. applyCookieFilters(this, filteredCookies);
  1606. });
  1607. bootstrapTable.initColumnSearch(cachedFilters);
  1608. bootstrapTable.options.filterControlValuesLoaded = true;
  1609. bootstrapTable.initServer();
  1610. }
  1611. }, 250);
  1612. }
  1613. };
  1614. $.extend($.fn.bootstrapTable.defaults, {
  1615. cookie: false,
  1616. cookieExpire: '2h',
  1617. cookiePath: null,
  1618. cookieDomain: null,
  1619. cookieSecure: null,
  1620. cookieIdTable: '',
  1621. cookiesEnabled: ['bs.table.sortOrder', 'bs.table.sortName', 'bs.table.pageNumber', 'bs.table.pageList', 'bs.table.columns', 'bs.table.searchText', 'bs.table.filterControl', 'bs.table.filterBy', 'bs.table.reorderColumns'],
  1622. cookieStorage: 'cookieStorage',
  1623. // localStorage, sessionStorage, customStorage
  1624. // internal variable
  1625. filterControls: [],
  1626. filterControlValuesLoaded: false
  1627. });
  1628. $.fn.bootstrapTable.methods.push('getCookies');
  1629. $.fn.bootstrapTable.methods.push('deleteCookie');
  1630. $.extend($.fn.bootstrapTable.utils, {
  1631. setCookie: UtilsCookie.setCookie,
  1632. getCookie: UtilsCookie.getCookie
  1633. });
  1634. $.BootstrapTable =
  1635. /*#__PURE__*/
  1636. function (_$$BootstrapTable) {
  1637. _inherits(_class, _$$BootstrapTable);
  1638. function _class() {
  1639. _classCallCheck(this, _class);
  1640. return _possibleConstructorReturn(this, _getPrototypeOf(_class).apply(this, arguments));
  1641. }
  1642. _createClass(_class, [{
  1643. key: "init",
  1644. value: function init() {
  1645. if (this.options.cookie) {
  1646. // FilterBy logic
  1647. var filterByCookieValue = UtilsCookie.getCookie(this, this.options.cookieIdTable, UtilsCookie.cookieIds.filterBy);
  1648. if (typeof filterByCookieValue === 'boolean' && !filterByCookieValue) {
  1649. throw new Error('The cookie value of filterBy must be a json!');
  1650. }
  1651. var filterByCookie = {};
  1652. try {
  1653. filterByCookie = JSON.parse(filterByCookieValue);
  1654. } catch (e) {
  1655. throw new Error('Could not parse the json of the filterBy cookie!');
  1656. }
  1657. this.filterColumns = filterByCookie ? filterByCookie : {}; // FilterControl logic
  1658. this.options.filterControls = [];
  1659. this.options.filterControlValuesLoaded = false;
  1660. this.options.cookiesEnabled = typeof this.options.cookiesEnabled === 'string' ? this.options.cookiesEnabled.replace('[', '').replace(']', '').replace(/'/g, '').replace(/ /g, '').toLowerCase().split(',') : this.options.cookiesEnabled;
  1661. if (this.options.filterControl) {
  1662. var that = this;
  1663. this.$el.on('column-search.bs.table', function (e, field, text) {
  1664. var isNewField = true;
  1665. for (var i = 0; i < that.options.filterControls.length; i++) {
  1666. if (that.options.filterControls[i].field === field) {
  1667. that.options.filterControls[i].text = text;
  1668. isNewField = false;
  1669. break;
  1670. }
  1671. }
  1672. if (isNewField) {
  1673. that.options.filterControls.push({
  1674. field: field,
  1675. text: text
  1676. });
  1677. }
  1678. UtilsCookie.setCookie(that, UtilsCookie.cookieIds.filterControl, JSON.stringify(that.options.filterControls));
  1679. }).on('created-controls.bs.table', UtilsCookie.initCookieFilters(that));
  1680. }
  1681. }
  1682. _get(_getPrototypeOf(_class.prototype), "init", this).call(this);
  1683. }
  1684. }, {
  1685. key: "initServer",
  1686. value: function initServer() {
  1687. var _get2;
  1688. if (this.options.cookie && this.options.filterControl && !this.options.filterControlValuesLoaded) {
  1689. var cookie = JSON.parse(UtilsCookie.getCookie(this, this.options.cookieIdTable, UtilsCookie.cookieIds.filterControl));
  1690. if (cookie) {
  1691. return;
  1692. }
  1693. }
  1694. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  1695. args[_key] = arguments[_key];
  1696. }
  1697. (_get2 = _get(_getPrototypeOf(_class.prototype), "initServer", this)).call.apply(_get2, [this].concat(args));
  1698. }
  1699. }, {
  1700. key: "initTable",
  1701. value: function initTable() {
  1702. var _get3;
  1703. for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  1704. args[_key2] = arguments[_key2];
  1705. }
  1706. (_get3 = _get(_getPrototypeOf(_class.prototype), "initTable", this)).call.apply(_get3, [this].concat(args));
  1707. this.initCookie();
  1708. }
  1709. }, {
  1710. key: "onSort",
  1711. value: function onSort() {
  1712. var _get4;
  1713. for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
  1714. args[_key3] = arguments[_key3];
  1715. }
  1716. (_get4 = _get(_getPrototypeOf(_class.prototype), "onSort", this)).call.apply(_get4, [this].concat(args));
  1717. UtilsCookie.setCookie(this, UtilsCookie.cookieIds.sortOrder, this.options.sortOrder);
  1718. UtilsCookie.setCookie(this, UtilsCookie.cookieIds.sortName, this.options.sortName);
  1719. }
  1720. }, {
  1721. key: "onPageNumber",
  1722. value: function onPageNumber() {
  1723. var _get5;
  1724. for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
  1725. args[_key4] = arguments[_key4];
  1726. }
  1727. (_get5 = _get(_getPrototypeOf(_class.prototype), "onPageNumber", this)).call.apply(_get5, [this].concat(args));
  1728. UtilsCookie.setCookie(this, UtilsCookie.cookieIds.pageNumber, this.options.pageNumber);
  1729. }
  1730. }, {
  1731. key: "onPageListChange",
  1732. value: function onPageListChange() {
  1733. var _get6;
  1734. for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
  1735. args[_key5] = arguments[_key5];
  1736. }
  1737. (_get6 = _get(_getPrototypeOf(_class.prototype), "onPageListChange", this)).call.apply(_get6, [this].concat(args));
  1738. UtilsCookie.setCookie(this, UtilsCookie.cookieIds.pageList, this.options.pageSize);
  1739. UtilsCookie.setCookie(this, UtilsCookie.cookieIds.pageNumber, this.options.pageNumber);
  1740. }
  1741. }, {
  1742. key: "onPagePre",
  1743. value: function onPagePre() {
  1744. var _get7;
  1745. for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
  1746. args[_key6] = arguments[_key6];
  1747. }
  1748. (_get7 = _get(_getPrototypeOf(_class.prototype), "onPagePre", this)).call.apply(_get7, [this].concat(args));
  1749. UtilsCookie.setCookie(this, UtilsCookie.cookieIds.pageNumber, this.options.pageNumber);
  1750. }
  1751. }, {
  1752. key: "onPageNext",
  1753. value: function onPageNext() {
  1754. var _get8;
  1755. for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
  1756. args[_key7] = arguments[_key7];
  1757. }
  1758. (_get8 = _get(_getPrototypeOf(_class.prototype), "onPageNext", this)).call.apply(_get8, [this].concat(args));
  1759. UtilsCookie.setCookie(this, UtilsCookie.cookieIds.pageNumber, this.options.pageNumber);
  1760. }
  1761. }, {
  1762. key: "_toggleColumn",
  1763. value: function _toggleColumn() {
  1764. var _get9;
  1765. for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
  1766. args[_key8] = arguments[_key8];
  1767. }
  1768. (_get9 = _get(_getPrototypeOf(_class.prototype), "_toggleColumn", this)).call.apply(_get9, [this].concat(args));
  1769. var visibleColumns = [];
  1770. $.each(this.columns, function (i, column) {
  1771. if (column.visible) {
  1772. visibleColumns.push(column.field);
  1773. }
  1774. });
  1775. UtilsCookie.setCookie(this, UtilsCookie.cookieIds.columns, JSON.stringify(visibleColumns));
  1776. }
  1777. }, {
  1778. key: "selectPage",
  1779. value: function selectPage(page) {
  1780. _get(_getPrototypeOf(_class.prototype), "selectPage", this).call(this, page);
  1781. UtilsCookie.setCookie(this, UtilsCookie.cookieIds.pageNumber, page);
  1782. }
  1783. }, {
  1784. key: "onSearch",
  1785. value: function onSearch(event) {
  1786. _get(_getPrototypeOf(_class.prototype), "onSearch", this).call(this, event);
  1787. if (this.options.search) {
  1788. UtilsCookie.setCookie(this, UtilsCookie.cookieIds.searchText, this.searchText);
  1789. }
  1790. UtilsCookie.setCookie(this, UtilsCookie.cookieIds.pageNumber, this.options.pageNumber);
  1791. }
  1792. }, {
  1793. key: "initHeader",
  1794. value: function initHeader() {
  1795. var _get10;
  1796. if (this.options.reorderableColumns) {
  1797. this.columnsSortOrder = JSON.parse(UtilsCookie.getCookie(this, this.options.cookieIdTable, UtilsCookie.cookieIds.reorderColumns));
  1798. }
  1799. for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
  1800. args[_key9] = arguments[_key9];
  1801. }
  1802. (_get10 = _get(_getPrototypeOf(_class.prototype), "initHeader", this)).call.apply(_get10, [this].concat(args));
  1803. }
  1804. }, {
  1805. key: "persistReorderColumnsState",
  1806. value: function persistReorderColumnsState(that) {
  1807. UtilsCookie.setCookie(that, UtilsCookie.cookieIds.reorderColumns, JSON.stringify(that.columnsSortOrder));
  1808. }
  1809. }, {
  1810. key: "filterBy",
  1811. value: function filterBy() {
  1812. var _get11;
  1813. for (var _len10 = arguments.length, args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
  1814. args[_key10] = arguments[_key10];
  1815. }
  1816. (_get11 = _get(_getPrototypeOf(_class.prototype), "filterBy", this)).call.apply(_get11, [this].concat(args));
  1817. UtilsCookie.setCookie(this, UtilsCookie.cookieIds.filterBy, JSON.stringify(this.filterColumns));
  1818. }
  1819. }, {
  1820. key: "initCookie",
  1821. value: function initCookie() {
  1822. if (!this.options.cookie) {
  1823. return;
  1824. }
  1825. if (this.options.cookieIdTable === '' || this.options.cookieExpire === '' || !UtilsCookie.cookieEnabled()) {
  1826. console.error('Configuration error. Please review the cookieIdTable and the cookieExpire property. If the properties are correct, then this browser does not support cookies.');
  1827. this.options.cookie = false; // Make sure that the cookie extension is disabled
  1828. return;
  1829. }
  1830. var sortOrderCookie = UtilsCookie.getCookie(this, this.options.cookieIdTable, UtilsCookie.cookieIds.sortOrder);
  1831. var sortOrderNameCookie = UtilsCookie.getCookie(this, this.options.cookieIdTable, UtilsCookie.cookieIds.sortName);
  1832. var pageNumberCookie = UtilsCookie.getCookie(this, this.options.cookieIdTable, UtilsCookie.cookieIds.pageNumber);
  1833. var pageListCookie = UtilsCookie.getCookie(this, this.options.cookieIdTable, UtilsCookie.cookieIds.pageList);
  1834. var searchTextCookie = UtilsCookie.getCookie(this, this.options.cookieIdTable, UtilsCookie.cookieIds.searchText);
  1835. var columnsCookieValue = UtilsCookie.getCookie(this, this.options.cookieIdTable, UtilsCookie.cookieIds.columns);
  1836. if (typeof columnsCookieValue === 'boolean' && !columnsCookieValue) {
  1837. throw new Error('The cookie value of filterBy must be a json!');
  1838. }
  1839. var columnsCookie = {};
  1840. try {
  1841. columnsCookie = JSON.parse(columnsCookieValue);
  1842. } catch (e) {
  1843. throw new Error('Could not parse the json of the columns cookie!', columnsCookieValue);
  1844. } // sortOrder
  1845. this.options.sortOrder = sortOrderCookie ? sortOrderCookie : this.options.sortOrder; // sortName
  1846. this.options.sortName = sortOrderNameCookie ? sortOrderNameCookie : this.options.sortName; // pageNumber
  1847. this.options.pageNumber = pageNumberCookie ? +pageNumberCookie : this.options.pageNumber; // pageSize
  1848. this.options.pageSize = pageListCookie ? pageListCookie === this.options.formatAllRows() ? pageListCookie : +pageListCookie : this.options.pageSize; // searchText
  1849. this.options.searchText = searchTextCookie ? searchTextCookie : '';
  1850. if (columnsCookie) {
  1851. $.each(this.columns, function (i, column) {
  1852. column.visible = $.inArray(column.field, columnsCookie) !== -1;
  1853. });
  1854. }
  1855. }
  1856. }, {
  1857. key: "getCookies",
  1858. value: function getCookies() {
  1859. var bootstrapTable = this;
  1860. var cookies = {};
  1861. $.each(UtilsCookie.cookieIds, function (key, value) {
  1862. cookies[key] = UtilsCookie.getCookie(bootstrapTable, bootstrapTable.options.cookieIdTable, value);
  1863. if (key === 'columns') {
  1864. cookies[key] = JSON.parse(cookies[key]);
  1865. }
  1866. });
  1867. return cookies;
  1868. }
  1869. }, {
  1870. key: "deleteCookie",
  1871. value: function deleteCookie(cookieName) {
  1872. if (cookieName === '' || !UtilsCookie.cookieEnabled()) {
  1873. return;
  1874. }
  1875. UtilsCookie.deleteCookie(this, this.options.cookieIdTable, UtilsCookie.cookieIds[cookieName]);
  1876. }
  1877. }]);
  1878. return _class;
  1879. }($.BootstrapTable);
  1880. })));