UNPKG

53.7 kBJavaScriptView Raw
1(function (global, factory) {
2 typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) :
3 typeof define === 'function' && define.amd ? define(['jquery'], factory) :
4 (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.jQuery));
5})(this, (function ($) { 'use strict';
6
7 function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
9 var $__default = /*#__PURE__*/_interopDefaultLegacy($);
10
11 var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
12
13 function createCommonjsModule(fn, module) {
14 return module = { exports: {} }, fn(module, module.exports), module.exports;
15 }
16
17 var check = function (it) {
18 return it && it.Math == Math && it;
19 };
20
21 // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
22 var global_1 =
23 // eslint-disable-next-line es-x/no-global-this -- safe
24 check(typeof globalThis == 'object' && globalThis) ||
25 check(typeof window == 'object' && window) ||
26 // eslint-disable-next-line no-restricted-globals -- safe
27 check(typeof self == 'object' && self) ||
28 check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
29 // eslint-disable-next-line no-new-func -- fallback
30 (function () { return this; })() || Function('return this')();
31
32 var fails = function (exec) {
33 try {
34 return !!exec();
35 } catch (error) {
36 return true;
37 }
38 };
39
40 // Detect IE8's incomplete defineProperty implementation
41 var descriptors = !fails(function () {
42 // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
43 return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
44 });
45
46 var functionBindNative = !fails(function () {
47 // eslint-disable-next-line es-x/no-function-prototype-bind -- safe
48 var test = (function () { /* empty */ }).bind();
49 // eslint-disable-next-line no-prototype-builtins -- safe
50 return typeof test != 'function' || test.hasOwnProperty('prototype');
51 });
52
53 var call$1 = Function.prototype.call;
54
55 var functionCall = functionBindNative ? call$1.bind(call$1) : function () {
56 return call$1.apply(call$1, arguments);
57 };
58
59 var $propertyIsEnumerable = {}.propertyIsEnumerable;
60 // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
61 var getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
62
63 // Nashorn ~ JDK8 bug
64 var NASHORN_BUG = getOwnPropertyDescriptor$1 && !$propertyIsEnumerable.call({ 1: 2 }, 1);
65
66 // `Object.prototype.propertyIsEnumerable` method implementation
67 // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
68 var f$4 = NASHORN_BUG ? function propertyIsEnumerable(V) {
69 var descriptor = getOwnPropertyDescriptor$1(this, V);
70 return !!descriptor && descriptor.enumerable;
71 } : $propertyIsEnumerable;
72
73 var objectPropertyIsEnumerable = {
74 f: f$4
75 };
76
77 var createPropertyDescriptor = function (bitmap, value) {
78 return {
79 enumerable: !(bitmap & 1),
80 configurable: !(bitmap & 2),
81 writable: !(bitmap & 4),
82 value: value
83 };
84 };
85
86 var FunctionPrototype$1 = Function.prototype;
87 var bind$1 = FunctionPrototype$1.bind;
88 var call = FunctionPrototype$1.call;
89 var uncurryThis = functionBindNative && bind$1.bind(call, call);
90
91 var functionUncurryThis = functionBindNative ? function (fn) {
92 return fn && uncurryThis(fn);
93 } : function (fn) {
94 return fn && function () {
95 return call.apply(fn, arguments);
96 };
97 };
98
99 var toString$1 = functionUncurryThis({}.toString);
100 var stringSlice = functionUncurryThis(''.slice);
101
102 var classofRaw = function (it) {
103 return stringSlice(toString$1(it), 8, -1);
104 };
105
106 var Object$4 = global_1.Object;
107 var split = functionUncurryThis(''.split);
108
109 // fallback for non-array-like ES3 and non-enumerable old V8 strings
110 var indexedObject = fails(function () {
111 // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
112 // eslint-disable-next-line no-prototype-builtins -- safe
113 return !Object$4('z').propertyIsEnumerable(0);
114 }) ? function (it) {
115 return classofRaw(it) == 'String' ? split(it, '') : Object$4(it);
116 } : Object$4;
117
118 var TypeError$7 = global_1.TypeError;
119
120 // `RequireObjectCoercible` abstract operation
121 // https://tc39.es/ecma262/#sec-requireobjectcoercible
122 var requireObjectCoercible = function (it) {
123 if (it == undefined) throw TypeError$7("Can't call method on " + it);
124 return it;
125 };
126
127 // toObject with fallback for non-array-like ES3 strings
128
129
130
131 var toIndexedObject = function (it) {
132 return indexedObject(requireObjectCoercible(it));
133 };
134
135 // `IsCallable` abstract operation
136 // https://tc39.es/ecma262/#sec-iscallable
137 var isCallable = function (argument) {
138 return typeof argument == 'function';
139 };
140
141 var isObject = function (it) {
142 return typeof it == 'object' ? it !== null : isCallable(it);
143 };
144
145 var aFunction = function (argument) {
146 return isCallable(argument) ? argument : undefined;
147 };
148
149 var getBuiltIn = function (namespace, method) {
150 return arguments.length < 2 ? aFunction(global_1[namespace]) : global_1[namespace] && global_1[namespace][method];
151 };
152
153 var objectIsPrototypeOf = functionUncurryThis({}.isPrototypeOf);
154
155 var engineUserAgent = getBuiltIn('navigator', 'userAgent') || '';
156
157 var process = global_1.process;
158 var Deno = global_1.Deno;
159 var versions = process && process.versions || Deno && Deno.version;
160 var v8 = versions && versions.v8;
161 var match, version;
162
163 if (v8) {
164 match = v8.split('.');
165 // in old Chrome, versions of V8 isn't V8 = Chrome / 10
166 // but their correct versions are not interesting for us
167 version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
168 }
169
170 // BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
171 // so check `userAgent` even if `.v8` exists, but 0
172 if (!version && engineUserAgent) {
173 match = engineUserAgent.match(/Edge\/(\d+)/);
174 if (!match || match[1] >= 74) {
175 match = engineUserAgent.match(/Chrome\/(\d+)/);
176 if (match) version = +match[1];
177 }
178 }
179
180 var engineV8Version = version;
181
182 /* eslint-disable es-x/no-symbol -- required for testing */
183
184
185
186 // eslint-disable-next-line es-x/no-object-getownpropertysymbols -- required for testing
187 var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () {
188 var symbol = Symbol();
189 // Chrome 38 Symbol has incorrect toString conversion
190 // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
191 return !String(symbol) || !(Object(symbol) instanceof Symbol) ||
192 // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
193 !Symbol.sham && engineV8Version && engineV8Version < 41;
194 });
195
196 /* eslint-disable es-x/no-symbol -- required for testing */
197
198
199 var useSymbolAsUid = nativeSymbol
200 && !Symbol.sham
201 && typeof Symbol.iterator == 'symbol';
202
203 var Object$3 = global_1.Object;
204
205 var isSymbol = useSymbolAsUid ? function (it) {
206 return typeof it == 'symbol';
207 } : function (it) {
208 var $Symbol = getBuiltIn('Symbol');
209 return isCallable($Symbol) && objectIsPrototypeOf($Symbol.prototype, Object$3(it));
210 };
211
212 var String$3 = global_1.String;
213
214 var tryToString = function (argument) {
215 try {
216 return String$3(argument);
217 } catch (error) {
218 return 'Object';
219 }
220 };
221
222 var TypeError$6 = global_1.TypeError;
223
224 // `Assert: IsCallable(argument) is true`
225 var aCallable = function (argument) {
226 if (isCallable(argument)) return argument;
227 throw TypeError$6(tryToString(argument) + ' is not a function');
228 };
229
230 // `GetMethod` abstract operation
231 // https://tc39.es/ecma262/#sec-getmethod
232 var getMethod = function (V, P) {
233 var func = V[P];
234 return func == null ? undefined : aCallable(func);
235 };
236
237 var TypeError$5 = global_1.TypeError;
238
239 // `OrdinaryToPrimitive` abstract operation
240 // https://tc39.es/ecma262/#sec-ordinarytoprimitive
241 var ordinaryToPrimitive = function (input, pref) {
242 var fn, val;
243 if (pref === 'string' && isCallable(fn = input.toString) && !isObject(val = functionCall(fn, input))) return val;
244 if (isCallable(fn = input.valueOf) && !isObject(val = functionCall(fn, input))) return val;
245 if (pref !== 'string' && isCallable(fn = input.toString) && !isObject(val = functionCall(fn, input))) return val;
246 throw TypeError$5("Can't convert object to primitive value");
247 };
248
249 // eslint-disable-next-line es-x/no-object-defineproperty -- safe
250 var defineProperty = Object.defineProperty;
251
252 var setGlobal = function (key, value) {
253 try {
254 defineProperty(global_1, key, { value: value, configurable: true, writable: true });
255 } catch (error) {
256 global_1[key] = value;
257 } return value;
258 };
259
260 var SHARED = '__core-js_shared__';
261 var store$1 = global_1[SHARED] || setGlobal(SHARED, {});
262
263 var sharedStore = store$1;
264
265 var shared = createCommonjsModule(function (module) {
266 (module.exports = function (key, value) {
267 return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {});
268 })('versions', []).push({
269 version: '3.22.4',
270 mode: 'global',
271 copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
272 license: 'https://github.com/zloirock/core-js/blob/v3.22.4/LICENSE',
273 source: 'https://github.com/zloirock/core-js'
274 });
275 });
276
277 var Object$2 = global_1.Object;
278
279 // `ToObject` abstract operation
280 // https://tc39.es/ecma262/#sec-toobject
281 var toObject = function (argument) {
282 return Object$2(requireObjectCoercible(argument));
283 };
284
285 var hasOwnProperty = functionUncurryThis({}.hasOwnProperty);
286
287 // `HasOwnProperty` abstract operation
288 // https://tc39.es/ecma262/#sec-hasownproperty
289 // eslint-disable-next-line es-x/no-object-hasown -- safe
290 var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
291 return hasOwnProperty(toObject(it), key);
292 };
293
294 var id = 0;
295 var postfix = Math.random();
296 var toString = functionUncurryThis(1.0.toString);
297
298 var uid = function (key) {
299 return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id + postfix, 36);
300 };
301
302 var WellKnownSymbolsStore = shared('wks');
303 var Symbol$2 = global_1.Symbol;
304 var symbolFor = Symbol$2 && Symbol$2['for'];
305 var createWellKnownSymbol = useSymbolAsUid ? Symbol$2 : Symbol$2 && Symbol$2.withoutSetter || uid;
306
307 var wellKnownSymbol = function (name) {
308 if (!hasOwnProperty_1(WellKnownSymbolsStore, name) || !(nativeSymbol || typeof WellKnownSymbolsStore[name] == 'string')) {
309 var description = 'Symbol.' + name;
310 if (nativeSymbol && hasOwnProperty_1(Symbol$2, name)) {
311 WellKnownSymbolsStore[name] = Symbol$2[name];
312 } else if (useSymbolAsUid && symbolFor) {
313 WellKnownSymbolsStore[name] = symbolFor(description);
314 } else {
315 WellKnownSymbolsStore[name] = createWellKnownSymbol(description);
316 }
317 } return WellKnownSymbolsStore[name];
318 };
319
320 var TypeError$4 = global_1.TypeError;
321 var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
322
323 // `ToPrimitive` abstract operation
324 // https://tc39.es/ecma262/#sec-toprimitive
325 var toPrimitive = function (input, pref) {
326 if (!isObject(input) || isSymbol(input)) return input;
327 var exoticToPrim = getMethod(input, TO_PRIMITIVE);
328 var result;
329 if (exoticToPrim) {
330 if (pref === undefined) pref = 'default';
331 result = functionCall(exoticToPrim, input, pref);
332 if (!isObject(result) || isSymbol(result)) return result;
333 throw TypeError$4("Can't convert object to primitive value");
334 }
335 if (pref === undefined) pref = 'number';
336 return ordinaryToPrimitive(input, pref);
337 };
338
339 // `ToPropertyKey` abstract operation
340 // https://tc39.es/ecma262/#sec-topropertykey
341 var toPropertyKey = function (argument) {
342 var key = toPrimitive(argument, 'string');
343 return isSymbol(key) ? key : key + '';
344 };
345
346 var document = global_1.document;
347 // typeof document.createElement is 'object' in old IE
348 var EXISTS$1 = isObject(document) && isObject(document.createElement);
349
350 var documentCreateElement = function (it) {
351 return EXISTS$1 ? document.createElement(it) : {};
352 };
353
354 // Thanks to IE8 for its funny defineProperty
355 var ie8DomDefine = !descriptors && !fails(function () {
356 // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
357 return Object.defineProperty(documentCreateElement('div'), 'a', {
358 get: function () { return 7; }
359 }).a != 7;
360 });
361
362 // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
363 var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
364
365 // `Object.getOwnPropertyDescriptor` method
366 // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
367 var f$3 = descriptors ? $getOwnPropertyDescriptor$1 : function getOwnPropertyDescriptor(O, P) {
368 O = toIndexedObject(O);
369 P = toPropertyKey(P);
370 if (ie8DomDefine) try {
371 return $getOwnPropertyDescriptor$1(O, P);
372 } catch (error) { /* empty */ }
373 if (hasOwnProperty_1(O, P)) return createPropertyDescriptor(!functionCall(objectPropertyIsEnumerable.f, O, P), O[P]);
374 };
375
376 var objectGetOwnPropertyDescriptor = {
377 f: f$3
378 };
379
380 // V8 ~ Chrome 36-
381 // https://bugs.chromium.org/p/v8/issues/detail?id=3334
382 var v8PrototypeDefineBug = descriptors && fails(function () {
383 // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
384 return Object.defineProperty(function () { /* empty */ }, 'prototype', {
385 value: 42,
386 writable: false
387 }).prototype != 42;
388 });
389
390 var String$2 = global_1.String;
391 var TypeError$3 = global_1.TypeError;
392
393 // `Assert: Type(argument) is Object`
394 var anObject = function (argument) {
395 if (isObject(argument)) return argument;
396 throw TypeError$3(String$2(argument) + ' is not an object');
397 };
398
399 var TypeError$2 = global_1.TypeError;
400 // eslint-disable-next-line es-x/no-object-defineproperty -- safe
401 var $defineProperty = Object.defineProperty;
402 // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
403 var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
404 var ENUMERABLE = 'enumerable';
405 var CONFIGURABLE$1 = 'configurable';
406 var WRITABLE = 'writable';
407
408 // `Object.defineProperty` method
409 // https://tc39.es/ecma262/#sec-object.defineproperty
410 var f$2 = descriptors ? v8PrototypeDefineBug ? function defineProperty(O, P, Attributes) {
411 anObject(O);
412 P = toPropertyKey(P);
413 anObject(Attributes);
414 if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
415 var current = $getOwnPropertyDescriptor(O, P);
416 if (current && current[WRITABLE]) {
417 O[P] = Attributes.value;
418 Attributes = {
419 configurable: CONFIGURABLE$1 in Attributes ? Attributes[CONFIGURABLE$1] : current[CONFIGURABLE$1],
420 enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
421 writable: false
422 };
423 }
424 } return $defineProperty(O, P, Attributes);
425 } : $defineProperty : function defineProperty(O, P, Attributes) {
426 anObject(O);
427 P = toPropertyKey(P);
428 anObject(Attributes);
429 if (ie8DomDefine) try {
430 return $defineProperty(O, P, Attributes);
431 } catch (error) { /* empty */ }
432 if ('get' in Attributes || 'set' in Attributes) throw TypeError$2('Accessors not supported');
433 if ('value' in Attributes) O[P] = Attributes.value;
434 return O;
435 };
436
437 var objectDefineProperty = {
438 f: f$2
439 };
440
441 var createNonEnumerableProperty = descriptors ? function (object, key, value) {
442 return objectDefineProperty.f(object, key, createPropertyDescriptor(1, value));
443 } : function (object, key, value) {
444 object[key] = value;
445 return object;
446 };
447
448 var FunctionPrototype = Function.prototype;
449 // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
450 var getDescriptor = descriptors && Object.getOwnPropertyDescriptor;
451
452 var EXISTS = hasOwnProperty_1(FunctionPrototype, 'name');
453 // additional protection from minified / mangled / dropped function names
454 var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
455 var CONFIGURABLE = EXISTS && (!descriptors || (descriptors && getDescriptor(FunctionPrototype, 'name').configurable));
456
457 var functionName = {
458 EXISTS: EXISTS,
459 PROPER: PROPER,
460 CONFIGURABLE: CONFIGURABLE
461 };
462
463 var functionToString = functionUncurryThis(Function.toString);
464
465 // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
466 if (!isCallable(sharedStore.inspectSource)) {
467 sharedStore.inspectSource = function (it) {
468 return functionToString(it);
469 };
470 }
471
472 var inspectSource = sharedStore.inspectSource;
473
474 var WeakMap$1 = global_1.WeakMap;
475
476 var nativeWeakMap = isCallable(WeakMap$1) && /native code/.test(inspectSource(WeakMap$1));
477
478 var keys = shared('keys');
479
480 var sharedKey = function (key) {
481 return keys[key] || (keys[key] = uid(key));
482 };
483
484 var hiddenKeys$1 = {};
485
486 var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
487 var TypeError$1 = global_1.TypeError;
488 var WeakMap = global_1.WeakMap;
489 var set, get, has;
490
491 var enforce = function (it) {
492 return has(it) ? get(it) : set(it, {});
493 };
494
495 var getterFor = function (TYPE) {
496 return function (it) {
497 var state;
498 if (!isObject(it) || (state = get(it)).type !== TYPE) {
499 throw TypeError$1('Incompatible receiver, ' + TYPE + ' required');
500 } return state;
501 };
502 };
503
504 if (nativeWeakMap || sharedStore.state) {
505 var store = sharedStore.state || (sharedStore.state = new WeakMap());
506 var wmget = functionUncurryThis(store.get);
507 var wmhas = functionUncurryThis(store.has);
508 var wmset = functionUncurryThis(store.set);
509 set = function (it, metadata) {
510 if (wmhas(store, it)) throw new TypeError$1(OBJECT_ALREADY_INITIALIZED);
511 metadata.facade = it;
512 wmset(store, it, metadata);
513 return metadata;
514 };
515 get = function (it) {
516 return wmget(store, it) || {};
517 };
518 has = function (it) {
519 return wmhas(store, it);
520 };
521 } else {
522 var STATE = sharedKey('state');
523 hiddenKeys$1[STATE] = true;
524 set = function (it, metadata) {
525 if (hasOwnProperty_1(it, STATE)) throw new TypeError$1(OBJECT_ALREADY_INITIALIZED);
526 metadata.facade = it;
527 createNonEnumerableProperty(it, STATE, metadata);
528 return metadata;
529 };
530 get = function (it) {
531 return hasOwnProperty_1(it, STATE) ? it[STATE] : {};
532 };
533 has = function (it) {
534 return hasOwnProperty_1(it, STATE);
535 };
536 }
537
538 var internalState = {
539 set: set,
540 get: get,
541 has: has,
542 enforce: enforce,
543 getterFor: getterFor
544 };
545
546 var makeBuiltIn_1 = createCommonjsModule(function (module) {
547 var defineProperty = objectDefineProperty.f;
548 var CONFIGURABLE_FUNCTION_NAME = functionName.CONFIGURABLE;
549
550
551
552 var enforceInternalState = internalState.enforce;
553 var getInternalState = internalState.get;
554
555 var CONFIGURABLE_LENGTH = !fails(function () {
556 return defineProperty(function () { /* empty */ }, 'length', { value: 8 }).length !== 8;
557 });
558
559 var TEMPLATE = String(String).split('String');
560
561 var makeBuiltIn = module.exports = function (value, name, options) {
562 if (String(name).slice(0, 7) === 'Symbol(') {
563 name = '[' + String(name).replace(/^Symbol\(([^)]*)\)/, '$1') + ']';
564 }
565 if (options && options.getter) name = 'get ' + name;
566 if (options && options.setter) name = 'set ' + name;
567 if (!hasOwnProperty_1(value, 'name') || (CONFIGURABLE_FUNCTION_NAME && value.name !== name)) {
568 defineProperty(value, 'name', { value: name, configurable: true });
569 }
570 if (CONFIGURABLE_LENGTH && options && hasOwnProperty_1(options, 'arity') && value.length !== options.arity) {
571 defineProperty(value, 'length', { value: options.arity });
572 }
573 var state = enforceInternalState(value);
574 if (!hasOwnProperty_1(state, 'source')) {
575 state.source = TEMPLATE.join(typeof name == 'string' ? name : '');
576 } return value;
577 };
578
579 // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
580 // eslint-disable-next-line no-extend-native -- required
581 Function.prototype.toString = makeBuiltIn(function toString() {
582 return isCallable(this) && getInternalState(this).source || inspectSource(this);
583 }, 'toString');
584 });
585
586 var defineBuiltIn = function (O, key, value, options) {
587 var unsafe = options ? !!options.unsafe : false;
588 var simple = options ? !!options.enumerable : false;
589 var noTargetGet = options ? !!options.noTargetGet : false;
590 var name = options && options.name !== undefined ? options.name : key;
591 if (isCallable(value)) makeBuiltIn_1(value, name, options);
592 if (O === global_1) {
593 if (simple) O[key] = value;
594 else setGlobal(key, value);
595 return O;
596 } else if (!unsafe) {
597 delete O[key];
598 } else if (!noTargetGet && O[key]) {
599 simple = true;
600 }
601 if (simple) O[key] = value;
602 else createNonEnumerableProperty(O, key, value);
603 return O;
604 };
605
606 var ceil = Math.ceil;
607 var floor = Math.floor;
608
609 // `ToIntegerOrInfinity` abstract operation
610 // https://tc39.es/ecma262/#sec-tointegerorinfinity
611 var toIntegerOrInfinity = function (argument) {
612 var number = +argument;
613 // eslint-disable-next-line no-self-compare -- safe
614 return number !== number || number === 0 ? 0 : (number > 0 ? floor : ceil)(number);
615 };
616
617 var max$1 = Math.max;
618 var min$1 = Math.min;
619
620 // Helper for a popular repeating case of the spec:
621 // Let integer be ? ToInteger(index).
622 // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
623 var toAbsoluteIndex = function (index, length) {
624 var integer = toIntegerOrInfinity(index);
625 return integer < 0 ? max$1(integer + length, 0) : min$1(integer, length);
626 };
627
628 var min = Math.min;
629
630 // `ToLength` abstract operation
631 // https://tc39.es/ecma262/#sec-tolength
632 var toLength = function (argument) {
633 return argument > 0 ? min(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
634 };
635
636 // `LengthOfArrayLike` abstract operation
637 // https://tc39.es/ecma262/#sec-lengthofarraylike
638 var lengthOfArrayLike = function (obj) {
639 return toLength(obj.length);
640 };
641
642 // `Array.prototype.{ indexOf, includes }` methods implementation
643 var createMethod$2 = function (IS_INCLUDES) {
644 return function ($this, el, fromIndex) {
645 var O = toIndexedObject($this);
646 var length = lengthOfArrayLike(O);
647 var index = toAbsoluteIndex(fromIndex, length);
648 var value;
649 // Array#includes uses SameValueZero equality algorithm
650 // eslint-disable-next-line no-self-compare -- NaN check
651 if (IS_INCLUDES && el != el) while (length > index) {
652 value = O[index++];
653 // eslint-disable-next-line no-self-compare -- NaN check
654 if (value != value) return true;
655 // Array#indexOf ignores holes, Array#includes - not
656 } else for (;length > index; index++) {
657 if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
658 } return !IS_INCLUDES && -1;
659 };
660 };
661
662 var arrayIncludes = {
663 // `Array.prototype.includes` method
664 // https://tc39.es/ecma262/#sec-array.prototype.includes
665 includes: createMethod$2(true),
666 // `Array.prototype.indexOf` method
667 // https://tc39.es/ecma262/#sec-array.prototype.indexof
668 indexOf: createMethod$2(false)
669 };
670
671 var indexOf = arrayIncludes.indexOf;
672
673
674 var push$1 = functionUncurryThis([].push);
675
676 var objectKeysInternal = function (object, names) {
677 var O = toIndexedObject(object);
678 var i = 0;
679 var result = [];
680 var key;
681 for (key in O) !hasOwnProperty_1(hiddenKeys$1, key) && hasOwnProperty_1(O, key) && push$1(result, key);
682 // Don't enum bug & hidden keys
683 while (names.length > i) if (hasOwnProperty_1(O, key = names[i++])) {
684 ~indexOf(result, key) || push$1(result, key);
685 }
686 return result;
687 };
688
689 // IE8- don't enum bug keys
690 var enumBugKeys = [
691 'constructor',
692 'hasOwnProperty',
693 'isPrototypeOf',
694 'propertyIsEnumerable',
695 'toLocaleString',
696 'toString',
697 'valueOf'
698 ];
699
700 var hiddenKeys = enumBugKeys.concat('length', 'prototype');
701
702 // `Object.getOwnPropertyNames` method
703 // https://tc39.es/ecma262/#sec-object.getownpropertynames
704 // eslint-disable-next-line es-x/no-object-getownpropertynames -- safe
705 var f$1 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
706 return objectKeysInternal(O, hiddenKeys);
707 };
708
709 var objectGetOwnPropertyNames = {
710 f: f$1
711 };
712
713 // eslint-disable-next-line es-x/no-object-getownpropertysymbols -- safe
714 var f = Object.getOwnPropertySymbols;
715
716 var objectGetOwnPropertySymbols = {
717 f: f
718 };
719
720 var concat = functionUncurryThis([].concat);
721
722 // all object keys, includes non-enumerable and symbols
723 var ownKeys = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
724 var keys = objectGetOwnPropertyNames.f(anObject(it));
725 var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
726 return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys;
727 };
728
729 var copyConstructorProperties = function (target, source, exceptions) {
730 var keys = ownKeys(source);
731 var defineProperty = objectDefineProperty.f;
732 var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
733 for (var i = 0; i < keys.length; i++) {
734 var key = keys[i];
735 if (!hasOwnProperty_1(target, key) && !(exceptions && hasOwnProperty_1(exceptions, key))) {
736 defineProperty(target, key, getOwnPropertyDescriptor(source, key));
737 }
738 }
739 };
740
741 var replacement = /#|\.prototype\./;
742
743 var isForced = function (feature, detection) {
744 var value = data[normalize(feature)];
745 return value == POLYFILL ? true
746 : value == NATIVE ? false
747 : isCallable(detection) ? fails(detection)
748 : !!detection;
749 };
750
751 var normalize = isForced.normalize = function (string) {
752 return String(string).replace(replacement, '.').toLowerCase();
753 };
754
755 var data = isForced.data = {};
756 var NATIVE = isForced.NATIVE = 'N';
757 var POLYFILL = isForced.POLYFILL = 'P';
758
759 var isForced_1 = isForced;
760
761 var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
762
763
764
765
766
767
768 /*
769 options.target - name of the target object
770 options.global - target is the global object
771 options.stat - export as static methods of target
772 options.proto - export as prototype methods of target
773 options.real - real prototype method for the `pure` version
774 options.forced - export even if the native feature is available
775 options.bind - bind methods to the target, required for the `pure` version
776 options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
777 options.unsafe - use the simple assignment of property instead of delete + defineProperty
778 options.sham - add a flag to not completely full polyfills
779 options.enumerable - export as enumerable property
780 options.noTargetGet - prevent calling a getter on target
781 options.name - the .name of the function if it does not match the key
782 */
783 var _export = function (options, source) {
784 var TARGET = options.target;
785 var GLOBAL = options.global;
786 var STATIC = options.stat;
787 var FORCED, target, key, targetProperty, sourceProperty, descriptor;
788 if (GLOBAL) {
789 target = global_1;
790 } else if (STATIC) {
791 target = global_1[TARGET] || setGlobal(TARGET, {});
792 } else {
793 target = (global_1[TARGET] || {}).prototype;
794 }
795 if (target) for (key in source) {
796 sourceProperty = source[key];
797 if (options.noTargetGet) {
798 descriptor = getOwnPropertyDescriptor(target, key);
799 targetProperty = descriptor && descriptor.value;
800 } else targetProperty = target[key];
801 FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
802 // contained in target
803 if (!FORCED && targetProperty !== undefined) {
804 if (typeof sourceProperty == typeof targetProperty) continue;
805 copyConstructorProperties(sourceProperty, targetProperty);
806 }
807 // add a flag to not completely full polyfills
808 if (options.sham || (targetProperty && targetProperty.sham)) {
809 createNonEnumerableProperty(sourceProperty, 'sham', true);
810 }
811 defineBuiltIn(target, key, sourceProperty, options);
812 }
813 };
814
815 // `IsArray` abstract operation
816 // https://tc39.es/ecma262/#sec-isarray
817 // eslint-disable-next-line es-x/no-array-isarray -- safe
818 var isArray = Array.isArray || function isArray(argument) {
819 return classofRaw(argument) == 'Array';
820 };
821
822 var TO_STRING_TAG$1 = wellKnownSymbol('toStringTag');
823 var test = {};
824
825 test[TO_STRING_TAG$1] = 'z';
826
827 var toStringTagSupport = String(test) === '[object z]';
828
829 var TO_STRING_TAG = wellKnownSymbol('toStringTag');
830 var Object$1 = global_1.Object;
831
832 // ES3 wrong here
833 var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
834
835 // fallback for IE11 Script Access Denied error
836 var tryGet = function (it, key) {
837 try {
838 return it[key];
839 } catch (error) { /* empty */ }
840 };
841
842 // getting tag from ES6+ `Object.prototype.toString`
843 var classof = toStringTagSupport ? classofRaw : function (it) {
844 var O, tag, result;
845 return it === undefined ? 'Undefined' : it === null ? 'Null'
846 // @@toStringTag case
847 : typeof (tag = tryGet(O = Object$1(it), TO_STRING_TAG)) == 'string' ? tag
848 // builtinTag case
849 : CORRECT_ARGUMENTS ? classofRaw(O)
850 // ES3 arguments fallback
851 : (result = classofRaw(O)) == 'Object' && isCallable(O.callee) ? 'Arguments' : result;
852 };
853
854 var noop = function () { /* empty */ };
855 var empty = [];
856 var construct = getBuiltIn('Reflect', 'construct');
857 var constructorRegExp = /^\s*(?:class|function)\b/;
858 var exec$1 = functionUncurryThis(constructorRegExp.exec);
859 var INCORRECT_TO_STRING = !constructorRegExp.exec(noop);
860
861 var isConstructorModern = function isConstructor(argument) {
862 if (!isCallable(argument)) return false;
863 try {
864 construct(noop, empty, argument);
865 return true;
866 } catch (error) {
867 return false;
868 }
869 };
870
871 var isConstructorLegacy = function isConstructor(argument) {
872 if (!isCallable(argument)) return false;
873 switch (classof(argument)) {
874 case 'AsyncFunction':
875 case 'GeneratorFunction':
876 case 'AsyncGeneratorFunction': return false;
877 }
878 try {
879 // we can't check .prototype since constructors produced by .bind haven't it
880 // `Function#toString` throws on some built-it function in some legacy engines
881 // (for example, `DOMQuad` and similar in FF41-)
882 return INCORRECT_TO_STRING || !!exec$1(constructorRegExp, inspectSource(argument));
883 } catch (error) {
884 return true;
885 }
886 };
887
888 isConstructorLegacy.sham = true;
889
890 // `IsConstructor` abstract operation
891 // https://tc39.es/ecma262/#sec-isconstructor
892 var isConstructor = !construct || fails(function () {
893 var called;
894 return isConstructorModern(isConstructorModern.call)
895 || !isConstructorModern(Object)
896 || !isConstructorModern(function () { called = true; })
897 || called;
898 }) ? isConstructorLegacy : isConstructorModern;
899
900 var createProperty = function (object, key, value) {
901 var propertyKey = toPropertyKey(key);
902 if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value));
903 else object[propertyKey] = value;
904 };
905
906 var SPECIES$2 = wellKnownSymbol('species');
907
908 var arrayMethodHasSpeciesSupport = function (METHOD_NAME) {
909 // We can't use this feature detection in V8 since it causes
910 // deoptimization and serious performance degradation
911 // https://github.com/zloirock/core-js/issues/677
912 return engineV8Version >= 51 || !fails(function () {
913 var array = [];
914 var constructor = array.constructor = {};
915 constructor[SPECIES$2] = function () {
916 return { foo: 1 };
917 };
918 return array[METHOD_NAME](Boolean).foo !== 1;
919 });
920 };
921
922 var arraySlice = functionUncurryThis([].slice);
923
924 var HAS_SPECIES_SUPPORT$1 = arrayMethodHasSpeciesSupport('slice');
925
926 var SPECIES$1 = wellKnownSymbol('species');
927 var Array$2 = global_1.Array;
928 var max = Math.max;
929
930 // `Array.prototype.slice` method
931 // https://tc39.es/ecma262/#sec-array.prototype.slice
932 // fallback for not array-like ES3 strings and DOM objects
933 _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$1 }, {
934 slice: function slice(start, end) {
935 var O = toIndexedObject(this);
936 var length = lengthOfArrayLike(O);
937 var k = toAbsoluteIndex(start, length);
938 var fin = toAbsoluteIndex(end === undefined ? length : end, length);
939 // inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible
940 var Constructor, result, n;
941 if (isArray(O)) {
942 Constructor = O.constructor;
943 // cross-realm fallback
944 if (isConstructor(Constructor) && (Constructor === Array$2 || isArray(Constructor.prototype))) {
945 Constructor = undefined;
946 } else if (isObject(Constructor)) {
947 Constructor = Constructor[SPECIES$1];
948 if (Constructor === null) Constructor = undefined;
949 }
950 if (Constructor === Array$2 || Constructor === undefined) {
951 return arraySlice(O, k, fin);
952 }
953 }
954 result = new (Constructor === undefined ? Array$2 : Constructor)(max(fin - k, 0));
955 for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]);
956 result.length = n;
957 return result;
958 }
959 });
960
961 var String$1 = global_1.String;
962
963 var toString_1 = function (argument) {
964 if (classof(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string');
965 return String$1(argument);
966 };
967
968 // a string of all valid unicode whitespaces
969 var whitespaces = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' +
970 '\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
971
972 var replace = functionUncurryThis(''.replace);
973 var whitespace = '[' + whitespaces + ']';
974 var ltrim = RegExp('^' + whitespace + whitespace + '*');
975 var rtrim = RegExp(whitespace + whitespace + '*$');
976
977 // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
978 var createMethod$1 = function (TYPE) {
979 return function ($this) {
980 var string = toString_1(requireObjectCoercible($this));
981 if (TYPE & 1) string = replace(string, ltrim, '');
982 if (TYPE & 2) string = replace(string, rtrim, '');
983 return string;
984 };
985 };
986
987 var stringTrim = {
988 // `String.prototype.{ trimLeft, trimStart }` methods
989 // https://tc39.es/ecma262/#sec-string.prototype.trimstart
990 start: createMethod$1(1),
991 // `String.prototype.{ trimRight, trimEnd }` methods
992 // https://tc39.es/ecma262/#sec-string.prototype.trimend
993 end: createMethod$1(2),
994 // `String.prototype.trim` method
995 // https://tc39.es/ecma262/#sec-string.prototype.trim
996 trim: createMethod$1(3)
997 };
998
999 var trim = stringTrim.trim;
1000
1001
1002 var $parseInt = global_1.parseInt;
1003 var Symbol$1 = global_1.Symbol;
1004 var ITERATOR = Symbol$1 && Symbol$1.iterator;
1005 var hex = /^[+-]?0x/i;
1006 var exec = functionUncurryThis(hex.exec);
1007 var FORCED = $parseInt(whitespaces + '08') !== 8 || $parseInt(whitespaces + '0x16') !== 22
1008 // MS Edge 18- broken with boxed symbols
1009 || (ITERATOR && !fails(function () { $parseInt(Object(ITERATOR)); }));
1010
1011 // `parseInt` method
1012 // https://tc39.es/ecma262/#sec-parseint-string-radix
1013 var numberParseInt = FORCED ? function parseInt(string, radix) {
1014 var S = trim(toString_1(string));
1015 return $parseInt(S, (radix >>> 0) || (exec(hex, S) ? 16 : 10));
1016 } : $parseInt;
1017
1018 // `parseInt` method
1019 // https://tc39.es/ecma262/#sec-parseint-string-radix
1020 _export({ global: true, forced: parseInt != numberParseInt }, {
1021 parseInt: numberParseInt
1022 });
1023
1024 var arrayMethodIsStrict = function (METHOD_NAME, argument) {
1025 var method = [][METHOD_NAME];
1026 return !!method && fails(function () {
1027 // eslint-disable-next-line no-useless-call -- required for testing
1028 method.call(null, argument || function () { return 1; }, 1);
1029 });
1030 };
1031
1032 /* eslint-disable es-x/no-array-prototype-indexof -- required for testing */
1033
1034
1035 var $IndexOf = arrayIncludes.indexOf;
1036
1037
1038 var un$IndexOf = functionUncurryThis([].indexOf);
1039
1040 var NEGATIVE_ZERO = !!un$IndexOf && 1 / un$IndexOf([1], 1, -0) < 0;
1041 var STRICT_METHOD = arrayMethodIsStrict('indexOf');
1042
1043 // `Array.prototype.indexOf` method
1044 // https://tc39.es/ecma262/#sec-array.prototype.indexof
1045 _export({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || !STRICT_METHOD }, {
1046 indexOf: function indexOf(searchElement /* , fromIndex = 0 */) {
1047 var fromIndex = arguments.length > 1 ? arguments[1] : undefined;
1048 return NEGATIVE_ZERO
1049 // convert -0 to +0
1050 ? un$IndexOf(this, searchElement, fromIndex) || 0
1051 : $IndexOf(this, searchElement, fromIndex);
1052 }
1053 });
1054
1055 var bind = functionUncurryThis(functionUncurryThis.bind);
1056
1057 // optional / simple context binding
1058 var functionBindContext = function (fn, that) {
1059 aCallable(fn);
1060 return that === undefined ? fn : functionBindNative ? bind(fn, that) : function (/* ...args */) {
1061 return fn.apply(that, arguments);
1062 };
1063 };
1064
1065 var SPECIES = wellKnownSymbol('species');
1066 var Array$1 = global_1.Array;
1067
1068 // a part of `ArraySpeciesCreate` abstract operation
1069 // https://tc39.es/ecma262/#sec-arrayspeciescreate
1070 var arraySpeciesConstructor = function (originalArray) {
1071 var C;
1072 if (isArray(originalArray)) {
1073 C = originalArray.constructor;
1074 // cross-realm fallback
1075 if (isConstructor(C) && (C === Array$1 || isArray(C.prototype))) C = undefined;
1076 else if (isObject(C)) {
1077 C = C[SPECIES];
1078 if (C === null) C = undefined;
1079 }
1080 } return C === undefined ? Array$1 : C;
1081 };
1082
1083 // `ArraySpeciesCreate` abstract operation
1084 // https://tc39.es/ecma262/#sec-arrayspeciescreate
1085 var arraySpeciesCreate = function (originalArray, length) {
1086 return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
1087 };
1088
1089 var push = functionUncurryThis([].push);
1090
1091 // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterReject }` methods implementation
1092 var createMethod = function (TYPE) {
1093 var IS_MAP = TYPE == 1;
1094 var IS_FILTER = TYPE == 2;
1095 var IS_SOME = TYPE == 3;
1096 var IS_EVERY = TYPE == 4;
1097 var IS_FIND_INDEX = TYPE == 6;
1098 var IS_FILTER_REJECT = TYPE == 7;
1099 var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
1100 return function ($this, callbackfn, that, specificCreate) {
1101 var O = toObject($this);
1102 var self = indexedObject(O);
1103 var boundFunction = functionBindContext(callbackfn, that);
1104 var length = lengthOfArrayLike(self);
1105 var index = 0;
1106 var create = specificCreate || arraySpeciesCreate;
1107 var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_REJECT ? create($this, 0) : undefined;
1108 var value, result;
1109 for (;length > index; index++) if (NO_HOLES || index in self) {
1110 value = self[index];
1111 result = boundFunction(value, index, O);
1112 if (TYPE) {
1113 if (IS_MAP) target[index] = result; // map
1114 else if (result) switch (TYPE) {
1115 case 3: return true; // some
1116 case 5: return value; // find
1117 case 6: return index; // findIndex
1118 case 2: push(target, value); // filter
1119 } else switch (TYPE) {
1120 case 4: return false; // every
1121 case 7: push(target, value); // filterReject
1122 }
1123 }
1124 }
1125 return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
1126 };
1127 };
1128
1129 var arrayIteration = {
1130 // `Array.prototype.forEach` method
1131 // https://tc39.es/ecma262/#sec-array.prototype.foreach
1132 forEach: createMethod(0),
1133 // `Array.prototype.map` method
1134 // https://tc39.es/ecma262/#sec-array.prototype.map
1135 map: createMethod(1),
1136 // `Array.prototype.filter` method
1137 // https://tc39.es/ecma262/#sec-array.prototype.filter
1138 filter: createMethod(2),
1139 // `Array.prototype.some` method
1140 // https://tc39.es/ecma262/#sec-array.prototype.some
1141 some: createMethod(3),
1142 // `Array.prototype.every` method
1143 // https://tc39.es/ecma262/#sec-array.prototype.every
1144 every: createMethod(4),
1145 // `Array.prototype.find` method
1146 // https://tc39.es/ecma262/#sec-array.prototype.find
1147 find: createMethod(5),
1148 // `Array.prototype.findIndex` method
1149 // https://tc39.es/ecma262/#sec-array.prototype.findIndex
1150 findIndex: createMethod(6),
1151 // `Array.prototype.filterReject` method
1152 // https://github.com/tc39/proposal-array-filtering
1153 filterReject: createMethod(7)
1154 };
1155
1156 var $filter = arrayIteration.filter;
1157
1158
1159 var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('filter');
1160
1161 // `Array.prototype.filter` method
1162 // https://tc39.es/ecma262/#sec-array.prototype.filter
1163 // with adding support of @@species
1164 _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
1165 filter: function filter(callbackfn /* , thisArg */) {
1166 return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
1167 }
1168 });
1169
1170 // `Object.prototype.toString` method implementation
1171 // https://tc39.es/ecma262/#sec-object.prototype.tostring
1172 var objectToString = toStringTagSupport ? {}.toString : function toString() {
1173 return '[object ' + classof(this) + ']';
1174 };
1175
1176 // `Object.prototype.toString` method
1177 // https://tc39.es/ecma262/#sec-object.prototype.tostring
1178 if (!toStringTagSupport) {
1179 defineBuiltIn(Object.prototype, 'toString', objectToString, { unsafe: true });
1180 }
1181
1182 /**
1183 * @author doug-the-guy
1184 * @version v1.0.0
1185 *
1186 * Bootstrap Table Pipeline
1187 * -----------------------
1188 *
1189 * This plugin enables client side data caching for server side requests which will
1190 * eliminate the need to issue a new request every page change. This will allow
1191 * for a performance balance for a large data set between returning all data at once
1192 * (client side paging) and a new server side request (server side paging).
1193 *
1194 * There are two new options:
1195 * - usePipeline: enables this feature
1196 * - pipelineSize: the size of each cache window
1197 *
1198 * The size of the pipeline must be evenly divisible by the current page size. This is
1199 * assured by rounding up to the nearest evenly divisible value. For example, if
1200 * the pipeline size is 4990 and the current page size is 25, then pipeline size will
1201 * be dynamically set to 5000.
1202 *
1203 * The cache windows are computed based on the pipeline size and the total number of rows
1204 * returned by the server side query. For example, with pipeline size 500 and total rows
1205 * 1300, the cache windows will be:
1206 *
1207 * [{'lower': 0, 'upper': 499}, {'lower': 500, 'upper': 999}, {'lower': 1000, 'upper': 1499}]
1208 *
1209 * Using the limit (i.e. the pipelineSize) and offset parameters, the server side request
1210 * **MUST** return only the data in the requested cache window **AND** the total number of rows.
1211 * To wit, the server side code must use the offset and limit parameters to prepare the response
1212 * data.
1213 *
1214 * On a page change, the new offset is checked if it is within the current cache window. If so,
1215 * the requested page data is returned from the cached data set. Otherwise, a new server side
1216 * request will be issued for the new cache window.
1217 *
1218 * The current cached data is only invalidated on these events:
1219 * * sorting
1220 * * searching
1221 * * page size change
1222 * * page change moves into a new cache window
1223 *
1224 * There are two new events:
1225 * - cached-data-hit.bs.table: issued when cached data is used on a page change
1226 * - cached-data-reset.bs.table: issued when the cached data is invalidated and a
1227 * new server side request is issued
1228 *
1229 **/
1230
1231 var Utils = $__default["default"].fn.bootstrapTable.utils;
1232 $__default["default"].extend($__default["default"].fn.bootstrapTable.defaults, {
1233 usePipeline: false,
1234 pipelineSize: 1000,
1235 // eslint-disable-next-line no-unused-vars
1236 onCachedDataHit: function onCachedDataHit(data) {
1237 return false;
1238 },
1239 // eslint-disable-next-line no-unused-vars
1240 onCachedDataReset: function onCachedDataReset(data) {
1241 return false;
1242 }
1243 });
1244 $__default["default"].extend($__default["default"].fn.bootstrapTable.Constructor.EVENTS, {
1245 'cached-data-hit.bs.table': 'onCachedDataHit',
1246 'cached-data-reset.bs.table': 'onCachedDataReset'
1247 });
1248 var BootstrapTable = $__default["default"].fn.bootstrapTable.Constructor;
1249 var _init = BootstrapTable.prototype.init;
1250 var _onSearch = BootstrapTable.prototype.onSearch;
1251 var _onSort = BootstrapTable.prototype.onSort;
1252 var _onPageListChange = BootstrapTable.prototype.onPageListChange;
1253
1254 BootstrapTable.prototype.init = function () {
1255 // needs to be called before initServer()
1256 this.initPipeline();
1257
1258 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1259 args[_key] = arguments[_key];
1260 }
1261
1262 _init.apply(this, Array.prototype.slice.apply(args));
1263 };
1264
1265 BootstrapTable.prototype.initPipeline = function () {
1266 this.cacheRequestJSON = {};
1267 this.cacheWindows = [];
1268 this.currWindow = 0;
1269 this.resetCache = true;
1270 };
1271
1272 BootstrapTable.prototype.onSearch = function () {
1273 /* force a cache reset on search */
1274 if (this.options.usePipeline) {
1275 this.resetCache = true;
1276 }
1277
1278 _onSearch.apply(this, Array.prototype.slice.apply(arguments));
1279 };
1280
1281 BootstrapTable.prototype.onSort = function () {
1282 /* force a cache reset on sort */
1283 if (this.options.usePipeline) {
1284 this.resetCache = true;
1285 }
1286
1287 _onSort.apply(this, Array.prototype.slice.apply(arguments));
1288 };
1289
1290 BootstrapTable.prototype.onPageListChange = function (event) {
1291 /* rebuild cache window on page size change */
1292 var target = $__default["default"](event.currentTarget);
1293 var newPageSize = parseInt(target.text(), 10);
1294 this.options.pipelineSize = this.calculatePipelineSize(this.options.pipelineSize, newPageSize);
1295 this.resetCache = true;
1296
1297 _onPageListChange.apply(this, Array.prototype.slice.apply(arguments));
1298 };
1299
1300 BootstrapTable.prototype.calculatePipelineSize = function (pipelineSize, pageSize) {
1301 /* calculate pipeline size by rounding up to the nearest value evenly divisible
1302 * by the pageSize */
1303 if (pageSize === 0) return 0;
1304 return Math.ceil(pipelineSize / pageSize) * pageSize;
1305 };
1306
1307 BootstrapTable.prototype.setCacheWindows = function () {
1308 /* set cache windows based on the total number of rows returned by server side
1309 * request and the pipelineSize */
1310 this.cacheWindows = [];
1311 var numWindows = this.options.totalRows / this.options.pipelineSize;
1312
1313 for (var i = 0; i <= numWindows; i++) {
1314 var b = i * this.options.pipelineSize;
1315 this.cacheWindows[i] = {
1316 lower: b,
1317 upper: b + this.options.pipelineSize - 1
1318 };
1319 }
1320 };
1321
1322 BootstrapTable.prototype.setCurrWindow = function (offset) {
1323 /* set the current cache window index, based on where the current offset falls */
1324 this.currWindow = 0;
1325
1326 for (var i = 0; i < this.cacheWindows.length; i++) {
1327 if (this.cacheWindows[i].lower <= offset && offset <= this.cacheWindows[i].upper) {
1328 this.currWindow = i;
1329 break;
1330 }
1331 }
1332 };
1333
1334 BootstrapTable.prototype.drawFromCache = function (offset, limit) {
1335 /* draw rows from the cache using offset and limit */
1336 var res = $__default["default"].extend(true, {}, this.cacheRequestJSON);
1337 var drawStart = offset - this.cacheWindows[this.currWindow].lower;
1338 var drawEnd = drawStart + limit;
1339 res.rows = res.rows.slice(drawStart, drawEnd);
1340 return res;
1341 };
1342
1343 BootstrapTable.prototype.initServer = function (silent, query, url) {
1344 /* determine if requested data is in cache (on paging) or if
1345 * a new ajax request needs to be issued (sorting, searching, paging
1346 * moving outside of cached data, page size change)
1347 * initial version of this extension will entirely override base initServer
1348 **/
1349 var data = {};
1350 var index = this.header.fields.indexOf(this.options.sortName);
1351 var params = {
1352 searchText: this.searchText,
1353 sortName: this.options.sortName,
1354 sortOrder: this.options.sortOrder
1355 };
1356 var request = null;
1357
1358 if (this.header.sortNames[index]) {
1359 params.sortName = this.header.sortNames[index];
1360 }
1361
1362 if (this.options.pagination && this.options.sidePagination === 'server') {
1363 params.pageSize = this.options.pageSize === this.options.formatAllRows() ? this.options.totalRows : this.options.pageSize;
1364 params.pageNumber = this.options.pageNumber;
1365 }
1366
1367 if (!(url || this.options.url) && !this.options.ajax) {
1368 return;
1369 }
1370
1371 var useAjax = true;
1372
1373 if (this.options.queryParamsType === 'limit') {
1374 params = {
1375 searchText: params.searchText,
1376 sortName: params.sortName,
1377 sortOrder: params.sortOrder
1378 };
1379
1380 if (this.options.pagination && this.options.sidePagination === 'server') {
1381 params.limit = this.options.pageSize === this.options.formatAllRows() ? this.options.totalRows : this.options.pageSize;
1382 params.offset = (this.options.pageSize === this.options.formatAllRows() ? this.options.totalRows : this.options.pageSize) * (this.options.pageNumber - 1);
1383
1384 if (this.options.usePipeline) {
1385 // if cacheWindows is empty, this is the initial request
1386 if (!this.cacheWindows.length) {
1387 useAjax = true;
1388 params.drawOffset = params.offset; // cache exists: determine if the page request is entirely within the current cached window
1389 } else {
1390 var w = this.cacheWindows[this.currWindow]; // case 1: reset cache but stay within current window (e.g. column sort)
1391 // case 2: move outside of the current window (e.g. search or paging)
1392 // since each cache window is aligned with the current page size
1393 // checking if params.offset is outside the current window is sufficient.
1394 // need to requery for preceding or succeeding cache window
1395 // also handle case
1396
1397 if (this.resetCache || params.offset < w.lower || params.offset > w.upper) {
1398 useAjax = true;
1399 this.setCurrWindow(params.offset); // store the relative offset for drawing the page data afterwards
1400
1401 params.drawOffset = params.offset; // now set params.offset to the lower bound of the new cache window
1402 // the server will return that whole cache window
1403
1404 params.offset = this.cacheWindows[this.currWindow].lower; // within current cache window
1405 } else {
1406 useAjax = false;
1407 }
1408 }
1409 } else if (params.limit === 0) {
1410 delete params.limit;
1411 }
1412 }
1413 } // force an ajax call - this is on search, sort or page size change
1414
1415
1416 if (this.resetCache) {
1417 useAjax = true;
1418 this.resetCache = false;
1419 }
1420
1421 if (this.options.usePipeline && useAjax) {
1422 /* in this scenario limit is used on the server to get the cache window
1423 * and drawLimit is used to get the page data afterwards */
1424 params.drawLimit = params.limit;
1425 params.limit = this.options.pipelineSize;
1426 } // cached results can be used
1427
1428
1429 if (!useAjax) {
1430 var res = this.drawFromCache(params.offset, params.limit);
1431 this.load(res);
1432 this.trigger('load-success', res);
1433 this.trigger('cached-data-hit', res);
1434 return;
1435 } // cached results can't be used
1436 // continue base initServer code
1437
1438
1439 if (!$__default["default"].isEmptyObject(this.filterColumnsPartial)) {
1440 params.filter = JSON.stringify(this.filterColumnsPartial, null);
1441 }
1442
1443 data = Utils.calculateObjectValue(this.options, this.options.queryParams, [params], data);
1444 $__default["default"].extend(data, query || {}); // false to stop request
1445
1446 if (data === false) {
1447 return;
1448 }
1449
1450 if (!silent) {
1451 this.$tableLoading.show();
1452 }
1453
1454 var self = this;
1455 request = $__default["default"].extend({}, Utils.calculateObjectValue(null, this.options.ajaxOptions), {
1456 type: this.options.method,
1457 url: url || this.options.url,
1458 data: this.options.contentType === 'application/json' && this.options.method === 'post' ? JSON.stringify(data) : data,
1459 cache: this.options.cache,
1460 contentType: this.options.contentType,
1461 dataType: this.options.dataType,
1462 success: function success(res) {
1463 res = Utils.calculateObjectValue(self.options, self.options.responseHandler, [res], res); // cache results if using pipelining
1464
1465 if (self.options.usePipeline) {
1466 // store entire request in cache
1467 self.cacheRequestJSON = $__default["default"].extend(true, {}, res); // this gets set in load() also but needs to be set before
1468 // setting cacheWindows
1469
1470 self.options.totalRows = res[self.options.totalField]; // if this is a search, potentially less results will be returned
1471 // so cache windows need to be rebuilt. Otherwise it
1472 // will come out the same
1473
1474 self.setCacheWindows();
1475 self.setCurrWindow(params.drawOffset); // just load data for the page
1476
1477 res = self.drawFromCache(params.drawOffset, params.drawLimit);
1478 self.trigger('cached-data-reset', res);
1479 }
1480
1481 self.load(res);
1482 self.trigger('load-success', res);
1483
1484 if (!silent) {
1485 self.hideLoading();
1486 }
1487 },
1488 error: function error(res) {
1489 var data = [];
1490
1491 if (self.options.sidePagination === 'server') {
1492 data = {};
1493 data[self.options.totalField] = 0;
1494 data[self.options.dataField] = [];
1495 }
1496
1497 self.load(data);
1498 self.trigger('load-error', res.status, res);
1499
1500 if (!silent) {
1501 self.hideLoading();
1502 }
1503 }
1504 });
1505
1506 if (this.options.ajax) {
1507 Utils.calculateObjectValue(this, this.options.ajax, [request], null);
1508 } else {
1509 if (this._xhr && this._xhr.readyState !== 4) {
1510 this._xhr.abort();
1511 }
1512
1513 this._xhr = $__default["default"].ajax(request);
1514 }
1515 };
1516
1517}));