bootstrap-table-cookie.js 65 KB

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