bootstrap-table-natural-sorting.js 43 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265
  1. (function (global, factory) {
  2. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  3. typeof define === 'function' && define.amd ? define(factory) :
  4. (global = global || self, global.BootstrapTable = factory());
  5. }(this, function () { 'use strict';
  6. var fails = function (exec) {
  7. try {
  8. return !!exec();
  9. } catch (error) {
  10. return true;
  11. }
  12. };
  13. // Thank's IE8 for his funny defineProperty
  14. var descriptors = !fails(function () {
  15. return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
  16. });
  17. var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
  18. function createCommonjsModule(fn, module) {
  19. return module = { exports: {} }, fn(module, module.exports), module.exports;
  20. }
  21. var O = 'object';
  22. var check = function (it) {
  23. return it && it.Math == Math && it;
  24. };
  25. // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
  26. var global_1 =
  27. // eslint-disable-next-line no-undef
  28. check(typeof globalThis == O && globalThis) ||
  29. check(typeof window == O && window) ||
  30. check(typeof self == O && self) ||
  31. check(typeof commonjsGlobal == O && commonjsGlobal) ||
  32. // eslint-disable-next-line no-new-func
  33. Function('return this')();
  34. var replacement = /#|\.prototype\./;
  35. var isForced = function (feature, detection) {
  36. var value = data[normalize(feature)];
  37. return value == POLYFILL ? true
  38. : value == NATIVE ? false
  39. : typeof detection == 'function' ? fails(detection)
  40. : !!detection;
  41. };
  42. var normalize = isForced.normalize = function (string) {
  43. return String(string).replace(replacement, '.').toLowerCase();
  44. };
  45. var data = isForced.data = {};
  46. var NATIVE = isForced.NATIVE = 'N';
  47. var POLYFILL = isForced.POLYFILL = 'P';
  48. var isForced_1 = isForced;
  49. var isObject = function (it) {
  50. return typeof it === 'object' ? it !== null : typeof it === 'function';
  51. };
  52. var document = global_1.document;
  53. // typeof document.createElement is 'object' in old IE
  54. var EXISTS = isObject(document) && isObject(document.createElement);
  55. var documentCreateElement = function (it) {
  56. return EXISTS ? document.createElement(it) : {};
  57. };
  58. // Thank's IE8 for his funny defineProperty
  59. var ie8DomDefine = !descriptors && !fails(function () {
  60. return Object.defineProperty(documentCreateElement('div'), 'a', {
  61. get: function () { return 7; }
  62. }).a != 7;
  63. });
  64. var anObject = function (it) {
  65. if (!isObject(it)) {
  66. throw TypeError(String(it) + ' is not an object');
  67. } return it;
  68. };
  69. // `ToPrimitive` abstract operation
  70. // https://tc39.github.io/ecma262/#sec-toprimitive
  71. // instead of the ES6 spec version, we didn't implement @@toPrimitive case
  72. // and the second argument - flag - preferred type is a string
  73. var toPrimitive = function (input, PREFERRED_STRING) {
  74. if (!isObject(input)) return input;
  75. var fn, val;
  76. if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
  77. if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val;
  78. if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
  79. throw TypeError("Can't convert object to primitive value");
  80. };
  81. var nativeDefineProperty = Object.defineProperty;
  82. // `Object.defineProperty` method
  83. // https://tc39.github.io/ecma262/#sec-object.defineproperty
  84. var f = descriptors ? nativeDefineProperty : function defineProperty(O, P, Attributes) {
  85. anObject(O);
  86. P = toPrimitive(P, true);
  87. anObject(Attributes);
  88. if (ie8DomDefine) try {
  89. return nativeDefineProperty(O, P, Attributes);
  90. } catch (error) { /* empty */ }
  91. if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
  92. if ('value' in Attributes) O[P] = Attributes.value;
  93. return O;
  94. };
  95. var objectDefineProperty = {
  96. f: f
  97. };
  98. var createPropertyDescriptor = function (bitmap, value) {
  99. return {
  100. enumerable: !(bitmap & 1),
  101. configurable: !(bitmap & 2),
  102. writable: !(bitmap & 4),
  103. value: value
  104. };
  105. };
  106. var hide = descriptors ? function (object, key, value) {
  107. return objectDefineProperty.f(object, key, createPropertyDescriptor(1, value));
  108. } : function (object, key, value) {
  109. object[key] = value;
  110. return object;
  111. };
  112. var setGlobal = function (key, value) {
  113. try {
  114. hide(global_1, key, value);
  115. } catch (error) {
  116. global_1[key] = value;
  117. } return value;
  118. };
  119. var shared = createCommonjsModule(function (module) {
  120. var SHARED = '__core-js_shared__';
  121. var store = global_1[SHARED] || setGlobal(SHARED, {});
  122. (module.exports = function (key, value) {
  123. return store[key] || (store[key] = value !== undefined ? value : {});
  124. })('versions', []).push({
  125. version: '3.1.3',
  126. mode: 'global',
  127. copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
  128. });
  129. });
  130. var hasOwnProperty = {}.hasOwnProperty;
  131. var has = function (it, key) {
  132. return hasOwnProperty.call(it, key);
  133. };
  134. var functionToString = shared('native-function-to-string', Function.toString);
  135. var WeakMap = global_1.WeakMap;
  136. var nativeWeakMap = typeof WeakMap === 'function' && /native code/.test(functionToString.call(WeakMap));
  137. var id = 0;
  138. var postfix = Math.random();
  139. var uid = function (key) {
  140. return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);
  141. };
  142. var keys = shared('keys');
  143. var sharedKey = function (key) {
  144. return keys[key] || (keys[key] = uid(key));
  145. };
  146. var hiddenKeys = {};
  147. var WeakMap$1 = global_1.WeakMap;
  148. var set, get, has$1;
  149. var enforce = function (it) {
  150. return has$1(it) ? get(it) : set(it, {});
  151. };
  152. var getterFor = function (TYPE) {
  153. return function (it) {
  154. var state;
  155. if (!isObject(it) || (state = get(it)).type !== TYPE) {
  156. throw TypeError('Incompatible receiver, ' + TYPE + ' required');
  157. } return state;
  158. };
  159. };
  160. if (nativeWeakMap) {
  161. var store = new WeakMap$1();
  162. var wmget = store.get;
  163. var wmhas = store.has;
  164. var wmset = store.set;
  165. set = function (it, metadata) {
  166. wmset.call(store, it, metadata);
  167. return metadata;
  168. };
  169. get = function (it) {
  170. return wmget.call(store, it) || {};
  171. };
  172. has$1 = function (it) {
  173. return wmhas.call(store, it);
  174. };
  175. } else {
  176. var STATE = sharedKey('state');
  177. hiddenKeys[STATE] = true;
  178. set = function (it, metadata) {
  179. hide(it, STATE, metadata);
  180. return metadata;
  181. };
  182. get = function (it) {
  183. return has(it, STATE) ? it[STATE] : {};
  184. };
  185. has$1 = function (it) {
  186. return has(it, STATE);
  187. };
  188. }
  189. var internalState = {
  190. set: set,
  191. get: get,
  192. has: has$1,
  193. enforce: enforce,
  194. getterFor: getterFor
  195. };
  196. var redefine = createCommonjsModule(function (module) {
  197. var getInternalState = internalState.get;
  198. var enforceInternalState = internalState.enforce;
  199. var TEMPLATE = String(functionToString).split('toString');
  200. shared('inspectSource', function (it) {
  201. return functionToString.call(it);
  202. });
  203. (module.exports = function (O, key, value, options) {
  204. var unsafe = options ? !!options.unsafe : false;
  205. var simple = options ? !!options.enumerable : false;
  206. var noTargetGet = options ? !!options.noTargetGet : false;
  207. if (typeof value == 'function') {
  208. if (typeof key == 'string' && !has(value, 'name')) hide(value, 'name', key);
  209. enforceInternalState(value).source = TEMPLATE.join(typeof key == 'string' ? key : '');
  210. }
  211. if (O === global_1) {
  212. if (simple) O[key] = value;
  213. else setGlobal(key, value);
  214. return;
  215. } else if (!unsafe) {
  216. delete O[key];
  217. } else if (!noTargetGet && O[key]) {
  218. simple = true;
  219. }
  220. if (simple) O[key] = value;
  221. else hide(O, key, value);
  222. // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
  223. })(Function.prototype, 'toString', function toString() {
  224. return typeof this == 'function' && getInternalState(this).source || functionToString.call(this);
  225. });
  226. });
  227. var toString = {}.toString;
  228. var classofRaw = function (it) {
  229. return toString.call(it).slice(8, -1);
  230. };
  231. var aPossiblePrototype = function (it) {
  232. if (!isObject(it) && it !== null) {
  233. throw TypeError("Can't set " + String(it) + ' as a prototype');
  234. } return it;
  235. };
  236. // `Object.setPrototypeOf` method
  237. // https://tc39.github.io/ecma262/#sec-object.setprototypeof
  238. // Works with __proto__ only. Old v8 can't work with null proto objects.
  239. /* eslint-disable no-proto */
  240. var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {
  241. var CORRECT_SETTER = false;
  242. var test = {};
  243. var setter;
  244. try {
  245. setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set;
  246. setter.call(test, []);
  247. CORRECT_SETTER = test instanceof Array;
  248. } catch (error) { /* empty */ }
  249. return function setPrototypeOf(O, proto) {
  250. anObject(O);
  251. aPossiblePrototype(proto);
  252. if (CORRECT_SETTER) setter.call(O, proto);
  253. else O.__proto__ = proto;
  254. return O;
  255. };
  256. }() : undefined);
  257. // makes subclassing work correct for wrapped built-ins
  258. var inheritIfRequired = function ($this, dummy, Wrapper) {
  259. var NewTarget, NewTargetPrototype;
  260. if (
  261. // it can work only with native `setPrototypeOf`
  262. objectSetPrototypeOf &&
  263. // we haven't completely correct pre-ES6 way for getting `new.target`, so use this
  264. typeof (NewTarget = dummy.constructor) == 'function' &&
  265. NewTarget !== Wrapper &&
  266. isObject(NewTargetPrototype = NewTarget.prototype) &&
  267. NewTargetPrototype !== Wrapper.prototype
  268. ) objectSetPrototypeOf($this, NewTargetPrototype);
  269. return $this;
  270. };
  271. var split = ''.split;
  272. // fallback for non-array-like ES3 and non-enumerable old V8 strings
  273. var indexedObject = fails(function () {
  274. // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
  275. // eslint-disable-next-line no-prototype-builtins
  276. return !Object('z').propertyIsEnumerable(0);
  277. }) ? function (it) {
  278. return classofRaw(it) == 'String' ? split.call(it, '') : Object(it);
  279. } : Object;
  280. // `RequireObjectCoercible` abstract operation
  281. // https://tc39.github.io/ecma262/#sec-requireobjectcoercible
  282. var requireObjectCoercible = function (it) {
  283. if (it == undefined) throw TypeError("Can't call method on " + it);
  284. return it;
  285. };
  286. // toObject with fallback for non-array-like ES3 strings
  287. var toIndexedObject = function (it) {
  288. return indexedObject(requireObjectCoercible(it));
  289. };
  290. var ceil = Math.ceil;
  291. var floor = Math.floor;
  292. // `ToInteger` abstract operation
  293. // https://tc39.github.io/ecma262/#sec-tointeger
  294. var toInteger = function (argument) {
  295. return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument);
  296. };
  297. var min = Math.min;
  298. // `ToLength` abstract operation
  299. // https://tc39.github.io/ecma262/#sec-tolength
  300. var toLength = function (argument) {
  301. return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
  302. };
  303. var max = Math.max;
  304. var min$1 = Math.min;
  305. // Helper for a popular repeating case of the spec:
  306. // Let integer be ? ToInteger(index).
  307. // If integer < 0, let result be max((length + integer), 0); else let result be min(length, length).
  308. var toAbsoluteIndex = function (index, length) {
  309. var integer = toInteger(index);
  310. return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
  311. };
  312. // `Array.prototype.{ indexOf, includes }` methods implementation
  313. var createMethod = function (IS_INCLUDES) {
  314. return function ($this, el, fromIndex) {
  315. var O = toIndexedObject($this);
  316. var length = toLength(O.length);
  317. var index = toAbsoluteIndex(fromIndex, length);
  318. var value;
  319. // Array#includes uses SameValueZero equality algorithm
  320. // eslint-disable-next-line no-self-compare
  321. if (IS_INCLUDES && el != el) while (length > index) {
  322. value = O[index++];
  323. // eslint-disable-next-line no-self-compare
  324. if (value != value) return true;
  325. // Array#indexOf ignores holes, Array#includes - not
  326. } else for (;length > index; index++) {
  327. if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
  328. } return !IS_INCLUDES && -1;
  329. };
  330. };
  331. var arrayIncludes = {
  332. // `Array.prototype.includes` method
  333. // https://tc39.github.io/ecma262/#sec-array.prototype.includes
  334. includes: createMethod(true),
  335. // `Array.prototype.indexOf` method
  336. // https://tc39.github.io/ecma262/#sec-array.prototype.indexof
  337. indexOf: createMethod(false)
  338. };
  339. var indexOf = arrayIncludes.indexOf;
  340. var objectKeysInternal = function (object, names) {
  341. var O = toIndexedObject(object);
  342. var i = 0;
  343. var result = [];
  344. var key;
  345. for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key);
  346. // Don't enum bug & hidden keys
  347. while (names.length > i) if (has(O, key = names[i++])) {
  348. ~indexOf(result, key) || result.push(key);
  349. }
  350. return result;
  351. };
  352. // IE8- don't enum bug keys
  353. var enumBugKeys = [
  354. 'constructor',
  355. 'hasOwnProperty',
  356. 'isPrototypeOf',
  357. 'propertyIsEnumerable',
  358. 'toLocaleString',
  359. 'toString',
  360. 'valueOf'
  361. ];
  362. // `Object.keys` method
  363. // https://tc39.github.io/ecma262/#sec-object.keys
  364. var objectKeys = Object.keys || function keys(O) {
  365. return objectKeysInternal(O, enumBugKeys);
  366. };
  367. // `Object.defineProperties` method
  368. // https://tc39.github.io/ecma262/#sec-object.defineproperties
  369. var objectDefineProperties = descriptors ? Object.defineProperties : function defineProperties(O, Properties) {
  370. anObject(O);
  371. var keys = objectKeys(Properties);
  372. var length = keys.length;
  373. var index = 0;
  374. var key;
  375. while (length > index) objectDefineProperty.f(O, key = keys[index++], Properties[key]);
  376. return O;
  377. };
  378. var path = global_1;
  379. var aFunction = function (variable) {
  380. return typeof variable == 'function' ? variable : undefined;
  381. };
  382. var getBuiltIn = function (namespace, method) {
  383. return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global_1[namespace])
  384. : path[namespace] && path[namespace][method] || global_1[namespace] && global_1[namespace][method];
  385. };
  386. var html = getBuiltIn('document', 'documentElement');
  387. var IE_PROTO = sharedKey('IE_PROTO');
  388. var PROTOTYPE = 'prototype';
  389. var Empty = function () { /* empty */ };
  390. // Create object with fake `null` prototype: use iframe Object with cleared prototype
  391. var createDict = function () {
  392. // Thrash, waste and sodomy: IE GC bug
  393. var iframe = documentCreateElement('iframe');
  394. var length = enumBugKeys.length;
  395. var lt = '<';
  396. var script = 'script';
  397. var gt = '>';
  398. var js = 'java' + script + ':';
  399. var iframeDocument;
  400. iframe.style.display = 'none';
  401. html.appendChild(iframe);
  402. iframe.src = String(js);
  403. iframeDocument = iframe.contentWindow.document;
  404. iframeDocument.open();
  405. iframeDocument.write(lt + script + gt + 'document.F=Object' + lt + '/' + script + gt);
  406. iframeDocument.close();
  407. createDict = iframeDocument.F;
  408. while (length--) delete createDict[PROTOTYPE][enumBugKeys[length]];
  409. return createDict();
  410. };
  411. // `Object.create` method
  412. // https://tc39.github.io/ecma262/#sec-object.create
  413. var objectCreate = Object.create || function create(O, Properties) {
  414. var result;
  415. if (O !== null) {
  416. Empty[PROTOTYPE] = anObject(O);
  417. result = new Empty();
  418. Empty[PROTOTYPE] = null;
  419. // add "__proto__" for Object.getPrototypeOf polyfill
  420. result[IE_PROTO] = O;
  421. } else result = createDict();
  422. return Properties === undefined ? result : objectDefineProperties(result, Properties);
  423. };
  424. hiddenKeys[IE_PROTO] = true;
  425. var hiddenKeys$1 = enumBugKeys.concat('length', 'prototype');
  426. // `Object.getOwnPropertyNames` method
  427. // https://tc39.github.io/ecma262/#sec-object.getownpropertynames
  428. var f$1 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
  429. return objectKeysInternal(O, hiddenKeys$1);
  430. };
  431. var objectGetOwnPropertyNames = {
  432. f: f$1
  433. };
  434. var nativePropertyIsEnumerable = {}.propertyIsEnumerable;
  435. var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  436. // Nashorn ~ JDK8 bug
  437. var NASHORN_BUG = getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1);
  438. // `Object.prototype.propertyIsEnumerable` method implementation
  439. // https://tc39.github.io/ecma262/#sec-object.prototype.propertyisenumerable
  440. var f$2 = NASHORN_BUG ? function propertyIsEnumerable(V) {
  441. var descriptor = getOwnPropertyDescriptor(this, V);
  442. return !!descriptor && descriptor.enumerable;
  443. } : nativePropertyIsEnumerable;
  444. var objectPropertyIsEnumerable = {
  445. f: f$2
  446. };
  447. var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  448. // `Object.getOwnPropertyDescriptor` method
  449. // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor
  450. var f$3 = descriptors ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
  451. O = toIndexedObject(O);
  452. P = toPrimitive(P, true);
  453. if (ie8DomDefine) try {
  454. return nativeGetOwnPropertyDescriptor(O, P);
  455. } catch (error) { /* empty */ }
  456. if (has(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]);
  457. };
  458. var objectGetOwnPropertyDescriptor = {
  459. f: f$3
  460. };
  461. // a string of all valid unicode whitespaces
  462. // eslint-disable-next-line max-len
  463. var whitespaces = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
  464. var whitespace = '[' + whitespaces + ']';
  465. var ltrim = RegExp('^' + whitespace + whitespace + '*');
  466. var rtrim = RegExp(whitespace + whitespace + '*$');
  467. // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
  468. var createMethod$1 = function (TYPE) {
  469. return function ($this) {
  470. var string = String(requireObjectCoercible($this));
  471. if (TYPE & 1) string = string.replace(ltrim, '');
  472. if (TYPE & 2) string = string.replace(rtrim, '');
  473. return string;
  474. };
  475. };
  476. var stringTrim = {
  477. // `String.prototype.{ trimLeft, trimStart }` methods
  478. // https://tc39.github.io/ecma262/#sec-string.prototype.trimstart
  479. start: createMethod$1(1),
  480. // `String.prototype.{ trimRight, trimEnd }` methods
  481. // https://tc39.github.io/ecma262/#sec-string.prototype.trimend
  482. end: createMethod$1(2),
  483. // `String.prototype.trim` method
  484. // https://tc39.github.io/ecma262/#sec-string.prototype.trim
  485. trim: createMethod$1(3)
  486. };
  487. var getOwnPropertyNames = objectGetOwnPropertyNames.f;
  488. var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
  489. var defineProperty = objectDefineProperty.f;
  490. var trim = stringTrim.trim;
  491. var NUMBER = 'Number';
  492. var NativeNumber = global_1[NUMBER];
  493. var NumberPrototype = NativeNumber.prototype;
  494. // Opera ~12 has broken Object#toString
  495. var BROKEN_CLASSOF = classofRaw(objectCreate(NumberPrototype)) == NUMBER;
  496. // `ToNumber` abstract operation
  497. // https://tc39.github.io/ecma262/#sec-tonumber
  498. var toNumber = function (argument) {
  499. var it = toPrimitive(argument, false);
  500. var first, third, radix, maxCode, digits, length, index, code;
  501. if (typeof it == 'string' && it.length > 2) {
  502. it = trim(it);
  503. first = it.charCodeAt(0);
  504. if (first === 43 || first === 45) {
  505. third = it.charCodeAt(2);
  506. if (third === 88 || third === 120) return NaN; // Number('+0x1') should be NaN, old V8 fix
  507. } else if (first === 48) {
  508. switch (it.charCodeAt(1)) {
  509. case 66: case 98: radix = 2; maxCode = 49; break; // fast equal of /^0b[01]+$/i
  510. case 79: case 111: radix = 8; maxCode = 55; break; // fast equal of /^0o[0-7]+$/i
  511. default: return +it;
  512. }
  513. digits = it.slice(2);
  514. length = digits.length;
  515. for (index = 0; index < length; index++) {
  516. code = digits.charCodeAt(index);
  517. // parseInt parses a string to a first unavailable symbol
  518. // but ToNumber should return NaN if a string contains unavailable symbols
  519. if (code < 48 || code > maxCode) return NaN;
  520. } return parseInt(digits, radix);
  521. }
  522. } return +it;
  523. };
  524. // `Number` constructor
  525. // https://tc39.github.io/ecma262/#sec-number-constructor
  526. if (isForced_1(NUMBER, !NativeNumber(' 0o1') || !NativeNumber('0b1') || NativeNumber('+0x1'))) {
  527. var NumberWrapper = function Number(value) {
  528. var it = arguments.length < 1 ? 0 : value;
  529. var dummy = this;
  530. return dummy instanceof NumberWrapper
  531. // check on 1..constructor(foo) case
  532. && (BROKEN_CLASSOF ? fails(function () { NumberPrototype.valueOf.call(dummy); }) : classofRaw(dummy) != NUMBER)
  533. ? inheritIfRequired(new NativeNumber(toNumber(it)), dummy, NumberWrapper) : toNumber(it);
  534. };
  535. for (var keys$1 = descriptors ? getOwnPropertyNames(NativeNumber) : (
  536. // ES3:
  537. 'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' +
  538. // ES2015 (in case, if modules with ES2015 Number statics required before):
  539. 'EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,' +
  540. 'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger'
  541. ).split(','), j = 0, key; keys$1.length > j; j++) {
  542. if (has(NativeNumber, key = keys$1[j]) && !has(NumberWrapper, key)) {
  543. defineProperty(NumberWrapper, key, getOwnPropertyDescriptor$1(NativeNumber, key));
  544. }
  545. }
  546. NumberWrapper.prototype = NumberPrototype;
  547. NumberPrototype.constructor = NumberWrapper;
  548. redefine(global_1, NUMBER, NumberWrapper);
  549. }
  550. var f$4 = Object.getOwnPropertySymbols;
  551. var objectGetOwnPropertySymbols = {
  552. f: f$4
  553. };
  554. // all object keys, includes non-enumerable and symbols
  555. var ownKeys = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
  556. var keys = objectGetOwnPropertyNames.f(anObject(it));
  557. var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
  558. return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
  559. };
  560. var copyConstructorProperties = function (target, source) {
  561. var keys = ownKeys(source);
  562. var defineProperty = objectDefineProperty.f;
  563. var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
  564. for (var i = 0; i < keys.length; i++) {
  565. var key = keys[i];
  566. if (!has(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
  567. }
  568. };
  569. var getOwnPropertyDescriptor$2 = objectGetOwnPropertyDescriptor.f;
  570. /*
  571. options.target - name of the target object
  572. options.global - target is the global object
  573. options.stat - export as static methods of target
  574. options.proto - export as prototype methods of target
  575. options.real - real prototype method for the `pure` version
  576. options.forced - export even if the native feature is available
  577. options.bind - bind methods to the target, required for the `pure` version
  578. options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
  579. options.unsafe - use the simple assignment of property instead of delete + defineProperty
  580. options.sham - add a flag to not completely full polyfills
  581. options.enumerable - export as enumerable property
  582. options.noTargetGet - prevent calling a getter on target
  583. */
  584. var _export = function (options, source) {
  585. var TARGET = options.target;
  586. var GLOBAL = options.global;
  587. var STATIC = options.stat;
  588. var FORCED, target, key, targetProperty, sourceProperty, descriptor;
  589. if (GLOBAL) {
  590. target = global_1;
  591. } else if (STATIC) {
  592. target = global_1[TARGET] || setGlobal(TARGET, {});
  593. } else {
  594. target = (global_1[TARGET] || {}).prototype;
  595. }
  596. if (target) for (key in source) {
  597. sourceProperty = source[key];
  598. if (options.noTargetGet) {
  599. descriptor = getOwnPropertyDescriptor$2(target, key);
  600. targetProperty = descriptor && descriptor.value;
  601. } else targetProperty = target[key];
  602. FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
  603. // contained in target
  604. if (!FORCED && targetProperty !== undefined) {
  605. if (typeof sourceProperty === typeof targetProperty) continue;
  606. copyConstructorProperties(sourceProperty, targetProperty);
  607. }
  608. // add a flag to not completely full polyfills
  609. if (options.sham || (targetProperty && targetProperty.sham)) {
  610. hide(sourceProperty, 'sham', true);
  611. }
  612. // extend global
  613. redefine(target, key, sourceProperty, options);
  614. }
  615. };
  616. var trim$1 = stringTrim.trim;
  617. var nativeParseInt = global_1.parseInt;
  618. var hex = /^[+-]?0[Xx]/;
  619. var FORCED = nativeParseInt(whitespaces + '08') !== 8 || nativeParseInt(whitespaces + '0x16') !== 22;
  620. // `parseInt` method
  621. // https://tc39.github.io/ecma262/#sec-parseint-string-radix
  622. var _parseInt = FORCED ? function parseInt(string, radix) {
  623. var S = trim$1(String(string));
  624. return nativeParseInt(S, (radix >>> 0) || (hex.test(S) ? 16 : 10));
  625. } : nativeParseInt;
  626. // `parseInt` method
  627. // https://tc39.github.io/ecma262/#sec-parseint-string-radix
  628. _export({ global: true, forced: parseInt != _parseInt }, {
  629. parseInt: _parseInt
  630. });
  631. var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () {
  632. // Chrome 38 Symbol has incorrect toString conversion
  633. // eslint-disable-next-line no-undef
  634. return !String(Symbol());
  635. });
  636. var Symbol$1 = global_1.Symbol;
  637. var store$1 = shared('wks');
  638. var wellKnownSymbol = function (name) {
  639. return store$1[name] || (store$1[name] = nativeSymbol && Symbol$1[name]
  640. || (nativeSymbol ? Symbol$1 : uid)('Symbol.' + name));
  641. };
  642. var MATCH = wellKnownSymbol('match');
  643. // `IsRegExp` abstract operation
  644. // https://tc39.github.io/ecma262/#sec-isregexp
  645. var isRegexp = function (it) {
  646. var isRegExp;
  647. return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classofRaw(it) == 'RegExp');
  648. };
  649. // `RegExp.prototype.flags` getter implementation
  650. // https://tc39.github.io/ecma262/#sec-get-regexp.prototype.flags
  651. var regexpFlags = function () {
  652. var that = anObject(this);
  653. var result = '';
  654. if (that.global) result += 'g';
  655. if (that.ignoreCase) result += 'i';
  656. if (that.multiline) result += 'm';
  657. if (that.dotAll) result += 's';
  658. if (that.unicode) result += 'u';
  659. if (that.sticky) result += 'y';
  660. return result;
  661. };
  662. var SPECIES = wellKnownSymbol('species');
  663. var setSpecies = function (CONSTRUCTOR_NAME) {
  664. var Constructor = getBuiltIn(CONSTRUCTOR_NAME);
  665. var defineProperty = objectDefineProperty.f;
  666. if (descriptors && Constructor && !Constructor[SPECIES]) {
  667. defineProperty(Constructor, SPECIES, {
  668. configurable: true,
  669. get: function () { return this; }
  670. });
  671. }
  672. };
  673. var defineProperty$1 = objectDefineProperty.f;
  674. var getOwnPropertyNames$1 = objectGetOwnPropertyNames.f;
  675. var MATCH$1 = wellKnownSymbol('match');
  676. var NativeRegExp = global_1.RegExp;
  677. var RegExpPrototype = NativeRegExp.prototype;
  678. var re1 = /a/g;
  679. var re2 = /a/g;
  680. // "new" should create a new object, old webkit bug
  681. var CORRECT_NEW = new NativeRegExp(re1) !== re1;
  682. var FORCED$1 = descriptors && isForced_1('RegExp', (!CORRECT_NEW || fails(function () {
  683. re2[MATCH$1] = false;
  684. // RegExp constructor can alter flags and IsRegExp works correct with @@match
  685. return NativeRegExp(re1) != re1 || NativeRegExp(re2) == re2 || NativeRegExp(re1, 'i') != '/a/i';
  686. })));
  687. // `RegExp` constructor
  688. // https://tc39.github.io/ecma262/#sec-regexp-constructor
  689. if (FORCED$1) {
  690. var RegExpWrapper = function RegExp(pattern, flags) {
  691. var thisIsRegExp = this instanceof RegExpWrapper;
  692. var patternIsRegExp = isRegexp(pattern);
  693. var flagsAreUndefined = flags === undefined;
  694. return !thisIsRegExp && patternIsRegExp && pattern.constructor === RegExpWrapper && flagsAreUndefined ? pattern
  695. : inheritIfRequired(CORRECT_NEW
  696. ? new NativeRegExp(patternIsRegExp && !flagsAreUndefined ? pattern.source : pattern, flags)
  697. : NativeRegExp((patternIsRegExp = pattern instanceof RegExpWrapper)
  698. ? pattern.source
  699. : pattern, patternIsRegExp && flagsAreUndefined ? regexpFlags.call(pattern) : flags)
  700. , thisIsRegExp ? this : RegExpPrototype, RegExpWrapper);
  701. };
  702. var proxy = function (key) {
  703. key in RegExpWrapper || defineProperty$1(RegExpWrapper, key, {
  704. configurable: true,
  705. get: function () { return NativeRegExp[key]; },
  706. set: function (it) { NativeRegExp[key] = it; }
  707. });
  708. };
  709. var keys$2 = getOwnPropertyNames$1(NativeRegExp);
  710. var index = 0;
  711. while (keys$2.length > index) proxy(keys$2[index++]);
  712. RegExpPrototype.constructor = RegExpWrapper;
  713. RegExpWrapper.prototype = RegExpPrototype;
  714. redefine(global_1, 'RegExp', RegExpWrapper);
  715. }
  716. // https://tc39.github.io/ecma262/#sec-get-regexp-@@species
  717. setSpecies('RegExp');
  718. var TO_STRING = 'toString';
  719. var RegExpPrototype$1 = RegExp.prototype;
  720. var nativeToString = RegExpPrototype$1[TO_STRING];
  721. var NOT_GENERIC = fails(function () { return nativeToString.call({ source: 'a', flags: 'b' }) != '/a/b'; });
  722. // FF44- RegExp#toString has a wrong name
  723. var INCORRECT_NAME = nativeToString.name != TO_STRING;
  724. // `RegExp.prototype.toString` method
  725. // https://tc39.github.io/ecma262/#sec-regexp.prototype.tostring
  726. if (NOT_GENERIC || INCORRECT_NAME) {
  727. redefine(RegExp.prototype, TO_STRING, function toString() {
  728. var R = anObject(this);
  729. var p = String(R.source);
  730. var rf = R.flags;
  731. var f = String(rf === undefined && R instanceof RegExp && !('flags' in RegExpPrototype$1) ? regexpFlags.call(R) : rf);
  732. return '/' + p + '/' + f;
  733. }, { unsafe: true });
  734. }
  735. var nativeExec = RegExp.prototype.exec;
  736. // This always refers to the native implementation, because the
  737. // String#replace polyfill uses ./fix-regexp-well-known-symbol-logic.js,
  738. // which loads this file before patching the method.
  739. var nativeReplace = String.prototype.replace;
  740. var patchedExec = nativeExec;
  741. var UPDATES_LAST_INDEX_WRONG = (function () {
  742. var re1 = /a/;
  743. var re2 = /b*/g;
  744. nativeExec.call(re1, 'a');
  745. nativeExec.call(re2, 'a');
  746. return re1.lastIndex !== 0 || re2.lastIndex !== 0;
  747. })();
  748. // nonparticipating capturing group, copied from es5-shim's String#split patch.
  749. var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
  750. var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED;
  751. if (PATCH) {
  752. patchedExec = function exec(str) {
  753. var re = this;
  754. var lastIndex, reCopy, match, i;
  755. if (NPCG_INCLUDED) {
  756. reCopy = new RegExp('^' + re.source + '$(?!\\s)', regexpFlags.call(re));
  757. }
  758. if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;
  759. match = nativeExec.call(re, str);
  760. if (UPDATES_LAST_INDEX_WRONG && match) {
  761. re.lastIndex = re.global ? match.index + match[0].length : lastIndex;
  762. }
  763. if (NPCG_INCLUDED && match && match.length > 1) {
  764. // Fix browsers whose `exec` methods don't consistently return `undefined`
  765. // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/
  766. nativeReplace.call(match[0], reCopy, function () {
  767. for (i = 1; i < arguments.length - 2; i++) {
  768. if (arguments[i] === undefined) match[i] = undefined;
  769. }
  770. });
  771. }
  772. return match;
  773. };
  774. }
  775. var regexpExec = patchedExec;
  776. var SPECIES$1 = wellKnownSymbol('species');
  777. var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () {
  778. // #replace needs built-in support for named groups.
  779. // #match works fine because it just return the exec results, even if it has
  780. // a "grops" property.
  781. var re = /./;
  782. re.exec = function () {
  783. var result = [];
  784. result.groups = { a: '7' };
  785. return result;
  786. };
  787. return ''.replace(re, '$<a>') !== '7';
  788. });
  789. // Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec
  790. // Weex JS has frozen built-in prototypes, so use try / catch wrapper
  791. var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () {
  792. var re = /(?:)/;
  793. var originalExec = re.exec;
  794. re.exec = function () { return originalExec.apply(this, arguments); };
  795. var result = 'ab'.split(re);
  796. return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b';
  797. });
  798. var fixRegexpWellKnownSymbolLogic = function (KEY, length, exec, sham) {
  799. var SYMBOL = wellKnownSymbol(KEY);
  800. var DELEGATES_TO_SYMBOL = !fails(function () {
  801. // String methods call symbol-named RegEp methods
  802. var O = {};
  803. O[SYMBOL] = function () { return 7; };
  804. return ''[KEY](O) != 7;
  805. });
  806. var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails(function () {
  807. // Symbol-named RegExp methods call .exec
  808. var execCalled = false;
  809. var re = /a/;
  810. re.exec = function () { execCalled = true; return null; };
  811. if (KEY === 'split') {
  812. // RegExp[@@split] doesn't call the regex's exec method, but first creates
  813. // a new one. We need to return the patched regex when creating the new one.
  814. re.constructor = {};
  815. re.constructor[SPECIES$1] = function () { return re; };
  816. }
  817. re[SYMBOL]('');
  818. return !execCalled;
  819. });
  820. if (
  821. !DELEGATES_TO_SYMBOL ||
  822. !DELEGATES_TO_EXEC ||
  823. (KEY === 'replace' && !REPLACE_SUPPORTS_NAMED_GROUPS) ||
  824. (KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC)
  825. ) {
  826. var nativeRegExpMethod = /./[SYMBOL];
  827. var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {
  828. if (regexp.exec === regexpExec) {
  829. if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
  830. // The native String method already delegates to @@method (this
  831. // polyfilled function), leasing to infinite recursion.
  832. // We avoid it by directly calling the native @@method method.
  833. return { done: true, value: nativeRegExpMethod.call(regexp, str, arg2) };
  834. }
  835. return { done: true, value: nativeMethod.call(str, regexp, arg2) };
  836. }
  837. return { done: false };
  838. });
  839. var stringMethod = methods[0];
  840. var regexMethod = methods[1];
  841. redefine(String.prototype, KEY, stringMethod);
  842. redefine(RegExp.prototype, SYMBOL, length == 2
  843. // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue)
  844. // 21.2.5.11 RegExp.prototype[@@split](string, limit)
  845. ? function (string, arg) { return regexMethod.call(string, this, arg); }
  846. // 21.2.5.6 RegExp.prototype[@@match](string)
  847. // 21.2.5.9 RegExp.prototype[@@search](string)
  848. : function (string) { return regexMethod.call(string, this); }
  849. );
  850. if (sham) hide(RegExp.prototype[SYMBOL], 'sham', true);
  851. }
  852. };
  853. // `ToObject` abstract operation
  854. // https://tc39.github.io/ecma262/#sec-toobject
  855. var toObject = function (argument) {
  856. return Object(requireObjectCoercible(argument));
  857. };
  858. // `String.prototype.{ codePointAt, at }` methods implementation
  859. var createMethod$2 = function (CONVERT_TO_STRING) {
  860. return function ($this, pos) {
  861. var S = String(requireObjectCoercible($this));
  862. var position = toInteger(pos);
  863. var size = S.length;
  864. var first, second;
  865. if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
  866. first = S.charCodeAt(position);
  867. return first < 0xD800 || first > 0xDBFF || position + 1 === size
  868. || (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF
  869. ? CONVERT_TO_STRING ? S.charAt(position) : first
  870. : CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
  871. };
  872. };
  873. var stringMultibyte = {
  874. // `String.prototype.codePointAt` method
  875. // https://tc39.github.io/ecma262/#sec-string.prototype.codepointat
  876. codeAt: createMethod$2(false),
  877. // `String.prototype.at` method
  878. // https://github.com/mathiasbynens/String.prototype.at
  879. charAt: createMethod$2(true)
  880. };
  881. var charAt = stringMultibyte.charAt;
  882. // `AdvanceStringIndex` abstract operation
  883. // https://tc39.github.io/ecma262/#sec-advancestringindex
  884. var advanceStringIndex = function (S, index, unicode) {
  885. return index + (unicode ? charAt(S, index).length : 1);
  886. };
  887. // `RegExpExec` abstract operation
  888. // https://tc39.github.io/ecma262/#sec-regexpexec
  889. var regexpExecAbstract = function (R, S) {
  890. var exec = R.exec;
  891. if (typeof exec === 'function') {
  892. var result = exec.call(R, S);
  893. if (typeof result !== 'object') {
  894. throw TypeError('RegExp exec method returned something other than an Object or null');
  895. }
  896. return result;
  897. }
  898. if (classofRaw(R) !== 'RegExp') {
  899. throw TypeError('RegExp#exec called on incompatible receiver');
  900. }
  901. return regexpExec.call(R, S);
  902. };
  903. var max$1 = Math.max;
  904. var min$2 = Math.min;
  905. var floor$1 = Math.floor;
  906. var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d\d?|<[^>]*>)/g;
  907. var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d\d?)/g;
  908. var maybeToString = function (it) {
  909. return it === undefined ? it : String(it);
  910. };
  911. // @@replace logic
  912. fixRegexpWellKnownSymbolLogic('replace', 2, function (REPLACE, nativeReplace, maybeCallNative) {
  913. return [
  914. // `String.prototype.replace` method
  915. // https://tc39.github.io/ecma262/#sec-string.prototype.replace
  916. function replace(searchValue, replaceValue) {
  917. var O = requireObjectCoercible(this);
  918. var replacer = searchValue == undefined ? undefined : searchValue[REPLACE];
  919. return replacer !== undefined
  920. ? replacer.call(searchValue, O, replaceValue)
  921. : nativeReplace.call(String(O), searchValue, replaceValue);
  922. },
  923. // `RegExp.prototype[@@replace]` method
  924. // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@replace
  925. function (regexp, replaceValue) {
  926. var res = maybeCallNative(nativeReplace, regexp, this, replaceValue);
  927. if (res.done) return res.value;
  928. var rx = anObject(regexp);
  929. var S = String(this);
  930. var functionalReplace = typeof replaceValue === 'function';
  931. if (!functionalReplace) replaceValue = String(replaceValue);
  932. var global = rx.global;
  933. if (global) {
  934. var fullUnicode = rx.unicode;
  935. rx.lastIndex = 0;
  936. }
  937. var results = [];
  938. while (true) {
  939. var result = regexpExecAbstract(rx, S);
  940. if (result === null) break;
  941. results.push(result);
  942. if (!global) break;
  943. var matchStr = String(result[0]);
  944. if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
  945. }
  946. var accumulatedResult = '';
  947. var nextSourcePosition = 0;
  948. for (var i = 0; i < results.length; i++) {
  949. result = results[i];
  950. var matched = String(result[0]);
  951. var position = max$1(min$2(toInteger(result.index), S.length), 0);
  952. var captures = [];
  953. // NOTE: This is equivalent to
  954. // captures = result.slice(1).map(maybeToString)
  955. // but for some reason `nativeSlice.call(result, 1, result.length)` (called in
  956. // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and
  957. // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.
  958. for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j]));
  959. var namedCaptures = result.groups;
  960. if (functionalReplace) {
  961. var replacerArgs = [matched].concat(captures, position, S);
  962. if (namedCaptures !== undefined) replacerArgs.push(namedCaptures);
  963. var replacement = String(replaceValue.apply(undefined, replacerArgs));
  964. } else {
  965. replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
  966. }
  967. if (position >= nextSourcePosition) {
  968. accumulatedResult += S.slice(nextSourcePosition, position) + replacement;
  969. nextSourcePosition = position + matched.length;
  970. }
  971. }
  972. return accumulatedResult + S.slice(nextSourcePosition);
  973. }
  974. ];
  975. // https://tc39.github.io/ecma262/#sec-getsubstitution
  976. function getSubstitution(matched, str, position, captures, namedCaptures, replacement) {
  977. var tailPos = position + matched.length;
  978. var m = captures.length;
  979. var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
  980. if (namedCaptures !== undefined) {
  981. namedCaptures = toObject(namedCaptures);
  982. symbols = SUBSTITUTION_SYMBOLS;
  983. }
  984. return nativeReplace.call(replacement, symbols, function (match, ch) {
  985. var capture;
  986. switch (ch.charAt(0)) {
  987. case '$': return '$';
  988. case '&': return matched;
  989. case '`': return str.slice(0, position);
  990. case "'": return str.slice(tailPos);
  991. case '<':
  992. capture = namedCaptures[ch.slice(1, -1)];
  993. break;
  994. default: // \d\d?
  995. var n = +ch;
  996. if (n === 0) return match;
  997. if (n > m) {
  998. var f = floor$1(n / 10);
  999. if (f === 0) return match;
  1000. if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1);
  1001. return match;
  1002. }
  1003. capture = captures[n - 1];
  1004. }
  1005. return capture === undefined ? '' : capture;
  1006. });
  1007. }
  1008. });
  1009. /**
  1010. * @author: Brian Huisman
  1011. * @webSite: http://www.greywyvern.com
  1012. * JS functions to allow natural sorting on bootstrap-table columns
  1013. * add data-sorter="alphanum" or data-sorter="numericOnly" to any th
  1014. *
  1015. * @update Dennis Hernández <http://djhvscf.github.io/Blog>
  1016. * @update Duane May
  1017. */
  1018. function alphanum(a, b) {
  1019. function chunkify(t) {
  1020. var tz = [];
  1021. var y = -1;
  1022. var n = 0;
  1023. for (var i = 0; i <= t.length; i++) {
  1024. var char = t.charAt(i);
  1025. var charCode = char.charCodeAt(0);
  1026. var m = charCode === 46 || charCode >= 48 && charCode <= 57;
  1027. if (m !== n) {
  1028. tz[++y] = '';
  1029. n = m;
  1030. }
  1031. tz[y] += char;
  1032. }
  1033. return tz;
  1034. }
  1035. function stringfy(v) {
  1036. if (typeof v === 'number') {
  1037. v = "".concat(v);
  1038. }
  1039. if (!v) {
  1040. v = '';
  1041. }
  1042. return v;
  1043. }
  1044. var aa = chunkify(stringfy(a));
  1045. var bb = chunkify(stringfy(b));
  1046. for (var x = 0; aa[x] && bb[x]; x++) {
  1047. if (aa[x] !== bb[x]) {
  1048. var c = Number(aa[x]);
  1049. var d = Number(bb[x]);
  1050. if (c === aa[x] && d === bb[x]) {
  1051. return c - d;
  1052. }
  1053. return aa[x] > bb[x] ? 1 : -1;
  1054. }
  1055. }
  1056. return aa.length - bb.length;
  1057. }
  1058. function numericOnly(a, b) {
  1059. function stripNonNumber(s) {
  1060. s = s.replace(new RegExp(/[^0-9]/g), '');
  1061. return parseInt(s, 10);
  1062. }
  1063. return stripNonNumber(a) - stripNonNumber(b);
  1064. }
  1065. var bootstrapTableNaturalSorting = {
  1066. alphanum: alphanum,
  1067. numericOnly: numericOnly
  1068. };
  1069. return bootstrapTableNaturalSorting;
  1070. }));