bootstrap-table-export.js 74 KB

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