bootstrap-table-export.js 84 KB

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