bootstrap-table-export.js 85 KB

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