index.js 95 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130
  1. (function (global, factory) {
  2. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  3. typeof define === 'function' && define.amd ? define(factory) :
  4. (global['jest-mock'] = factory());
  5. }(this, (function () { 'use strict';
  6. var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
  7. function unwrapExports (x) {
  8. return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
  9. }
  10. function createCommonjsModule(fn, module) {
  11. return module = { exports: {} }, fn(module, module.exports), module.exports;
  12. }
  13. var _global = createCommonjsModule(function (module) {
  14. // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
  15. var global = module.exports = typeof window != 'undefined' && window.Math == Math
  16. ? window : typeof self != 'undefined' && self.Math == Math ? self
  17. // eslint-disable-next-line no-new-func
  18. : Function('return this')();
  19. if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef
  20. });
  21. var _core = createCommonjsModule(function (module) {
  22. var core = module.exports = { version: '2.5.3' };
  23. if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef
  24. });
  25. var _core_1 = _core.version;
  26. var _aFunction = function (it) {
  27. if (typeof it != 'function') throw TypeError(it + ' is not a function!');
  28. return it;
  29. };
  30. // optional / simple context binding
  31. var _ctx = function (fn, that, length) {
  32. _aFunction(fn);
  33. if (that === undefined) return fn;
  34. switch (length) {
  35. case 1: return function (a) {
  36. return fn.call(that, a);
  37. };
  38. case 2: return function (a, b) {
  39. return fn.call(that, a, b);
  40. };
  41. case 3: return function (a, b, c) {
  42. return fn.call(that, a, b, c);
  43. };
  44. }
  45. return function (/* ...args */) {
  46. return fn.apply(that, arguments);
  47. };
  48. };
  49. var _isObject = function (it) {
  50. return typeof it === 'object' ? it !== null : typeof it === 'function';
  51. };
  52. var _anObject = function (it) {
  53. if (!_isObject(it)) throw TypeError(it + ' is not an object!');
  54. return it;
  55. };
  56. var _fails = function (exec) {
  57. try {
  58. return !!exec();
  59. } catch (e) {
  60. return true;
  61. }
  62. };
  63. // Thank's IE8 for his funny defineProperty
  64. var _descriptors = !_fails(function () {
  65. return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
  66. });
  67. var document$1 = _global.document;
  68. // typeof document.createElement is 'object' in old IE
  69. var is = _isObject(document$1) && _isObject(document$1.createElement);
  70. var _domCreate = function (it) {
  71. return is ? document$1.createElement(it) : {};
  72. };
  73. var _ie8DomDefine = !_descriptors && !_fails(function () {
  74. return Object.defineProperty(_domCreate('div'), 'a', { get: function () { return 7; } }).a != 7;
  75. });
  76. // 7.1.1 ToPrimitive(input [, PreferredType])
  77. // instead of the ES6 spec version, we didn't implement @@toPrimitive case
  78. // and the second argument - flag - preferred type is a string
  79. var _toPrimitive = function (it, S) {
  80. if (!_isObject(it)) return it;
  81. var fn, val;
  82. if (S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) return val;
  83. if (typeof (fn = it.valueOf) == 'function' && !_isObject(val = fn.call(it))) return val;
  84. if (!S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) return val;
  85. throw TypeError("Can't convert object to primitive value");
  86. };
  87. var dP = Object.defineProperty;
  88. var f = _descriptors ? Object.defineProperty : function defineProperty(O, P, Attributes) {
  89. _anObject(O);
  90. P = _toPrimitive(P, true);
  91. _anObject(Attributes);
  92. if (_ie8DomDefine) try {
  93. return dP(O, P, Attributes);
  94. } catch (e) { /* empty */ }
  95. if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');
  96. if ('value' in Attributes) O[P] = Attributes.value;
  97. return O;
  98. };
  99. var _objectDp = {
  100. f: f
  101. };
  102. var _propertyDesc = function (bitmap, value) {
  103. return {
  104. enumerable: !(bitmap & 1),
  105. configurable: !(bitmap & 2),
  106. writable: !(bitmap & 4),
  107. value: value
  108. };
  109. };
  110. var _hide = _descriptors ? function (object, key, value) {
  111. return _objectDp.f(object, key, _propertyDesc(1, value));
  112. } : function (object, key, value) {
  113. object[key] = value;
  114. return object;
  115. };
  116. var PROTOTYPE = 'prototype';
  117. var $export = function (type, name, source) {
  118. var IS_FORCED = type & $export.F;
  119. var IS_GLOBAL = type & $export.G;
  120. var IS_STATIC = type & $export.S;
  121. var IS_PROTO = type & $export.P;
  122. var IS_BIND = type & $export.B;
  123. var IS_WRAP = type & $export.W;
  124. var exports = IS_GLOBAL ? _core : _core[name] || (_core[name] = {});
  125. var expProto = exports[PROTOTYPE];
  126. var target = IS_GLOBAL ? _global : IS_STATIC ? _global[name] : (_global[name] || {})[PROTOTYPE];
  127. var key, own, out;
  128. if (IS_GLOBAL) source = name;
  129. for (key in source) {
  130. // contains in native
  131. own = !IS_FORCED && target && target[key] !== undefined;
  132. if (own && key in exports) continue;
  133. // export native or passed
  134. out = own ? target[key] : source[key];
  135. // prevent global pollution for namespaces
  136. exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]
  137. // bind timers to global for call from export context
  138. : IS_BIND && own ? _ctx(out, _global)
  139. // wrap global constructors for prevent change them in library
  140. : IS_WRAP && target[key] == out ? (function (C) {
  141. var F = function (a, b, c) {
  142. if (this instanceof C) {
  143. switch (arguments.length) {
  144. case 0: return new C();
  145. case 1: return new C(a);
  146. case 2: return new C(a, b);
  147. } return new C(a, b, c);
  148. } return C.apply(this, arguments);
  149. };
  150. F[PROTOTYPE] = C[PROTOTYPE];
  151. return F;
  152. // make static versions for prototype methods
  153. })(out) : IS_PROTO && typeof out == 'function' ? _ctx(Function.call, out) : out;
  154. // export proto methods to core.%CONSTRUCTOR%.methods.%NAME%
  155. if (IS_PROTO) {
  156. (exports.virtual || (exports.virtual = {}))[key] = out;
  157. // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME%
  158. if (type & $export.R && expProto && !expProto[key]) _hide(expProto, key, out);
  159. }
  160. }
  161. };
  162. // type bitmap
  163. $export.F = 1; // forced
  164. $export.G = 2; // global
  165. $export.S = 4; // static
  166. $export.P = 8; // proto
  167. $export.B = 16; // bind
  168. $export.W = 32; // wrap
  169. $export.U = 64; // safe
  170. $export.R = 128; // real proto method for `library`
  171. var _export = $export;
  172. // 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes)
  173. _export(_export.S + _export.F * !_descriptors, 'Object', { defineProperty: _objectDp.f });
  174. var $Object = _core.Object;
  175. var defineProperty$1 = function defineProperty(it, key, desc) {
  176. return $Object.defineProperty(it, key, desc);
  177. };
  178. var defineProperty = createCommonjsModule(function (module) {
  179. module.exports = { "default": defineProperty$1, __esModule: true };
  180. });
  181. var _Object$defineProperty = unwrapExports(defineProperty);
  182. // 7.1.4 ToInteger
  183. var ceil = Math.ceil;
  184. var floor = Math.floor;
  185. var _toInteger = function (it) {
  186. return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
  187. };
  188. // 7.2.1 RequireObjectCoercible(argument)
  189. var _defined = function (it) {
  190. if (it == undefined) throw TypeError("Can't call method on " + it);
  191. return it;
  192. };
  193. // true -> String#at
  194. // false -> String#codePointAt
  195. var _stringAt = function (TO_STRING) {
  196. return function (that, pos) {
  197. var s = String(_defined(that));
  198. var i = _toInteger(pos);
  199. var l = s.length;
  200. var a, b;
  201. if (i < 0 || i >= l) return TO_STRING ? '' : undefined;
  202. a = s.charCodeAt(i);
  203. return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
  204. ? TO_STRING ? s.charAt(i) : a
  205. : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
  206. };
  207. };
  208. var _library = true;
  209. var _redefine = _hide;
  210. var hasOwnProperty = {}.hasOwnProperty;
  211. var _has = function (it, key) {
  212. return hasOwnProperty.call(it, key);
  213. };
  214. var _iterators = {};
  215. var toString = {}.toString;
  216. var _cof = function (it) {
  217. return toString.call(it).slice(8, -1);
  218. };
  219. // fallback for non-array-like ES3 and non-enumerable old V8 strings
  220. // eslint-disable-next-line no-prototype-builtins
  221. var _iobject = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
  222. return _cof(it) == 'String' ? it.split('') : Object(it);
  223. };
  224. // to indexed object, toObject with fallback for non-array-like ES3 strings
  225. var _toIobject = function (it) {
  226. return _iobject(_defined(it));
  227. };
  228. // 7.1.15 ToLength
  229. var min = Math.min;
  230. var _toLength = function (it) {
  231. return it > 0 ? min(_toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
  232. };
  233. var max = Math.max;
  234. var min$1 = Math.min;
  235. var _toAbsoluteIndex = function (index, length) {
  236. index = _toInteger(index);
  237. return index < 0 ? max(index + length, 0) : min$1(index, length);
  238. };
  239. // false -> Array#indexOf
  240. // true -> Array#includes
  241. var _arrayIncludes = function (IS_INCLUDES) {
  242. return function ($this, el, fromIndex) {
  243. var O = _toIobject($this);
  244. var length = _toLength(O.length);
  245. var index = _toAbsoluteIndex(fromIndex, length);
  246. var value;
  247. // Array#includes uses SameValueZero equality algorithm
  248. // eslint-disable-next-line no-self-compare
  249. if (IS_INCLUDES && el != el) while (length > index) {
  250. value = O[index++];
  251. // eslint-disable-next-line no-self-compare
  252. if (value != value) return true;
  253. // Array#indexOf ignores holes, Array#includes - not
  254. } else for (;length > index; index++) if (IS_INCLUDES || index in O) {
  255. if (O[index] === el) return IS_INCLUDES || index || 0;
  256. } return !IS_INCLUDES && -1;
  257. };
  258. };
  259. var SHARED = '__core-js_shared__';
  260. var store = _global[SHARED] || (_global[SHARED] = {});
  261. var _shared = function (key) {
  262. return store[key] || (store[key] = {});
  263. };
  264. var id = 0;
  265. var px = Math.random();
  266. var _uid = function (key) {
  267. return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
  268. };
  269. var shared = _shared('keys');
  270. var _sharedKey = function (key) {
  271. return shared[key] || (shared[key] = _uid(key));
  272. };
  273. var arrayIndexOf = _arrayIncludes(false);
  274. var IE_PROTO$1 = _sharedKey('IE_PROTO');
  275. var _objectKeysInternal = function (object, names) {
  276. var O = _toIobject(object);
  277. var i = 0;
  278. var result = [];
  279. var key;
  280. for (key in O) if (key != IE_PROTO$1) _has(O, key) && result.push(key);
  281. // Don't enum bug & hidden keys
  282. while (names.length > i) if (_has(O, key = names[i++])) {
  283. ~arrayIndexOf(result, key) || result.push(key);
  284. }
  285. return result;
  286. };
  287. // IE 8- don't enum bug keys
  288. var _enumBugKeys = (
  289. 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
  290. ).split(',');
  291. // 19.1.2.14 / 15.2.3.14 Object.keys(O)
  292. var _objectKeys = Object.keys || function keys(O) {
  293. return _objectKeysInternal(O, _enumBugKeys);
  294. };
  295. var _objectDps = _descriptors ? Object.defineProperties : function defineProperties(O, Properties) {
  296. _anObject(O);
  297. var keys = _objectKeys(Properties);
  298. var length = keys.length;
  299. var i = 0;
  300. var P;
  301. while (length > i) _objectDp.f(O, P = keys[i++], Properties[P]);
  302. return O;
  303. };
  304. var document$2 = _global.document;
  305. var _html = document$2 && document$2.documentElement;
  306. // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
  307. var IE_PROTO = _sharedKey('IE_PROTO');
  308. var Empty = function () { /* empty */ };
  309. var PROTOTYPE$1 = 'prototype';
  310. // Create object with fake `null` prototype: use iframe Object with cleared prototype
  311. var createDict = function () {
  312. // Thrash, waste and sodomy: IE GC bug
  313. var iframe = _domCreate('iframe');
  314. var i = _enumBugKeys.length;
  315. var lt = '<';
  316. var gt = '>';
  317. var iframeDocument;
  318. iframe.style.display = 'none';
  319. _html.appendChild(iframe);
  320. iframe.src = 'javascript:'; // eslint-disable-line no-script-url
  321. // createDict = iframe.contentWindow.Object;
  322. // html.removeChild(iframe);
  323. iframeDocument = iframe.contentWindow.document;
  324. iframeDocument.open();
  325. iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);
  326. iframeDocument.close();
  327. createDict = iframeDocument.F;
  328. while (i--) delete createDict[PROTOTYPE$1][_enumBugKeys[i]];
  329. return createDict();
  330. };
  331. var _objectCreate = Object.create || function create(O, Properties) {
  332. var result;
  333. if (O !== null) {
  334. Empty[PROTOTYPE$1] = _anObject(O);
  335. result = new Empty();
  336. Empty[PROTOTYPE$1] = null;
  337. // add "__proto__" for Object.getPrototypeOf polyfill
  338. result[IE_PROTO] = O;
  339. } else result = createDict();
  340. return Properties === undefined ? result : _objectDps(result, Properties);
  341. };
  342. var _wks = createCommonjsModule(function (module) {
  343. var store = _shared('wks');
  344. var Symbol = _global.Symbol;
  345. var USE_SYMBOL = typeof Symbol == 'function';
  346. var $exports = module.exports = function (name) {
  347. return store[name] || (store[name] =
  348. USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : _uid)('Symbol.' + name));
  349. };
  350. $exports.store = store;
  351. });
  352. var def = _objectDp.f;
  353. var TAG = _wks('toStringTag');
  354. var _setToStringTag = function (it, tag, stat) {
  355. if (it && !_has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag });
  356. };
  357. var IteratorPrototype = {};
  358. // 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
  359. _hide(IteratorPrototype, _wks('iterator'), function () { return this; });
  360. var _iterCreate = function (Constructor, NAME, next) {
  361. Constructor.prototype = _objectCreate(IteratorPrototype, { next: _propertyDesc(1, next) });
  362. _setToStringTag(Constructor, NAME + ' Iterator');
  363. };
  364. // 7.1.13 ToObject(argument)
  365. var _toObject = function (it) {
  366. return Object(_defined(it));
  367. };
  368. // 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
  369. var IE_PROTO$2 = _sharedKey('IE_PROTO');
  370. var ObjectProto = Object.prototype;
  371. var _objectGpo = Object.getPrototypeOf || function (O) {
  372. O = _toObject(O);
  373. if (_has(O, IE_PROTO$2)) return O[IE_PROTO$2];
  374. if (typeof O.constructor == 'function' && O instanceof O.constructor) {
  375. return O.constructor.prototype;
  376. } return O instanceof Object ? ObjectProto : null;
  377. };
  378. var ITERATOR = _wks('iterator');
  379. var BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next`
  380. var FF_ITERATOR = '@@iterator';
  381. var KEYS = 'keys';
  382. var VALUES = 'values';
  383. var returnThis = function () { return this; };
  384. var _iterDefine = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) {
  385. _iterCreate(Constructor, NAME, next);
  386. var getMethod = function (kind) {
  387. if (!BUGGY && kind in proto) return proto[kind];
  388. switch (kind) {
  389. case KEYS: return function keys() { return new Constructor(this, kind); };
  390. case VALUES: return function values() { return new Constructor(this, kind); };
  391. } return function entries() { return new Constructor(this, kind); };
  392. };
  393. var TAG = NAME + ' Iterator';
  394. var DEF_VALUES = DEFAULT == VALUES;
  395. var VALUES_BUG = false;
  396. var proto = Base.prototype;
  397. var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT];
  398. var $default = (!BUGGY && $native) || getMethod(DEFAULT);
  399. var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined;
  400. var $anyNative = NAME == 'Array' ? proto.entries || $native : $native;
  401. var methods, key, IteratorPrototype;
  402. // Fix native
  403. if ($anyNative) {
  404. IteratorPrototype = _objectGpo($anyNative.call(new Base()));
  405. if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) {
  406. // Set @@toStringTag to native iterators
  407. _setToStringTag(IteratorPrototype, TAG, true);
  408. // fix for some old engines
  409. if (!_library && !_has(IteratorPrototype, ITERATOR)) _hide(IteratorPrototype, ITERATOR, returnThis);
  410. }
  411. }
  412. // fix Array#{values, @@iterator}.name in V8 / FF
  413. if (DEF_VALUES && $native && $native.name !== VALUES) {
  414. VALUES_BUG = true;
  415. $default = function values() { return $native.call(this); };
  416. }
  417. // Define iterator
  418. if ((!_library || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) {
  419. _hide(proto, ITERATOR, $default);
  420. }
  421. // Plug for library
  422. _iterators[NAME] = $default;
  423. _iterators[TAG] = returnThis;
  424. if (DEFAULT) {
  425. methods = {
  426. values: DEF_VALUES ? $default : getMethod(VALUES),
  427. keys: IS_SET ? $default : getMethod(KEYS),
  428. entries: $entries
  429. };
  430. if (FORCED) for (key in methods) {
  431. if (!(key in proto)) _redefine(proto, key, methods[key]);
  432. } else _export(_export.P + _export.F * (BUGGY || VALUES_BUG), NAME, methods);
  433. }
  434. return methods;
  435. };
  436. var $at = _stringAt(true);
  437. // 21.1.3.27 String.prototype[@@iterator]()
  438. _iterDefine(String, 'String', function (iterated) {
  439. this._t = String(iterated); // target
  440. this._i = 0; // next index
  441. // 21.1.5.2.1 %StringIteratorPrototype%.next()
  442. }, function () {
  443. var O = this._t;
  444. var index = this._i;
  445. var point;
  446. if (index >= O.length) return { value: undefined, done: true };
  447. point = $at(O, index);
  448. this._i += point.length;
  449. return { value: point, done: false };
  450. });
  451. var _iterStep = function (done, value) {
  452. return { value: value, done: !!done };
  453. };
  454. // 22.1.3.4 Array.prototype.entries()
  455. // 22.1.3.13 Array.prototype.keys()
  456. // 22.1.3.29 Array.prototype.values()
  457. // 22.1.3.30 Array.prototype[@@iterator]()
  458. var es6_array_iterator = _iterDefine(Array, 'Array', function (iterated, kind) {
  459. this._t = _toIobject(iterated); // target
  460. this._i = 0; // next index
  461. this._k = kind; // kind
  462. // 22.1.5.2.1 %ArrayIteratorPrototype%.next()
  463. }, function () {
  464. var O = this._t;
  465. var kind = this._k;
  466. var index = this._i++;
  467. if (!O || index >= O.length) {
  468. this._t = undefined;
  469. return _iterStep(1);
  470. }
  471. if (kind == 'keys') return _iterStep(0, index);
  472. if (kind == 'values') return _iterStep(0, O[index]);
  473. return _iterStep(0, [index, O[index]]);
  474. }, 'values');
  475. // argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)
  476. _iterators.Arguments = _iterators.Array;
  477. var TO_STRING_TAG = _wks('toStringTag');
  478. var DOMIterables = ('CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,' +
  479. 'DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,' +
  480. 'MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,' +
  481. 'SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,' +
  482. 'TextTrackList,TouchList').split(',');
  483. for (var i = 0; i < DOMIterables.length; i++) {
  484. var NAME = DOMIterables[i];
  485. var Collection = _global[NAME];
  486. var proto = Collection && Collection.prototype;
  487. if (proto && !proto[TO_STRING_TAG]) _hide(proto, TO_STRING_TAG, NAME);
  488. _iterators[NAME] = _iterators.Array;
  489. }
  490. var f$1 = _wks;
  491. var _wksExt = {
  492. f: f$1
  493. };
  494. var iterator$2 = _wksExt.f('iterator');
  495. var iterator = createCommonjsModule(function (module) {
  496. module.exports = { "default": iterator$2, __esModule: true };
  497. });
  498. unwrapExports(iterator);
  499. var _meta = createCommonjsModule(function (module) {
  500. var META = _uid('meta');
  501. var setDesc = _objectDp.f;
  502. var id = 0;
  503. var isExtensible = Object.isExtensible || function () {
  504. return true;
  505. };
  506. var FREEZE = !_fails(function () {
  507. return isExtensible(Object.preventExtensions({}));
  508. });
  509. var setMeta = function (it) {
  510. setDesc(it, META, { value: {
  511. i: 'O' + ++id, // object ID
  512. w: {} // weak collections IDs
  513. } });
  514. };
  515. var fastKey = function (it, create) {
  516. // return primitive with prefix
  517. if (!_isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
  518. if (!_has(it, META)) {
  519. // can't set metadata to uncaught frozen object
  520. if (!isExtensible(it)) return 'F';
  521. // not necessary to add metadata
  522. if (!create) return 'E';
  523. // add missing metadata
  524. setMeta(it);
  525. // return object ID
  526. } return it[META].i;
  527. };
  528. var getWeak = function (it, create) {
  529. if (!_has(it, META)) {
  530. // can't set metadata to uncaught frozen object
  531. if (!isExtensible(it)) return true;
  532. // not necessary to add metadata
  533. if (!create) return false;
  534. // add missing metadata
  535. setMeta(it);
  536. // return hash weak collections IDs
  537. } return it[META].w;
  538. };
  539. // add metadata on freeze-family methods calling
  540. var onFreeze = function (it) {
  541. if (FREEZE && meta.NEED && isExtensible(it) && !_has(it, META)) setMeta(it);
  542. return it;
  543. };
  544. var meta = module.exports = {
  545. KEY: META,
  546. NEED: false,
  547. fastKey: fastKey,
  548. getWeak: getWeak,
  549. onFreeze: onFreeze
  550. };
  551. });
  552. var _meta_1 = _meta.KEY;
  553. var _meta_2 = _meta.NEED;
  554. var _meta_3 = _meta.fastKey;
  555. var _meta_4 = _meta.getWeak;
  556. var _meta_5 = _meta.onFreeze;
  557. var defineProperty$3 = _objectDp.f;
  558. var _wksDefine = function (name) {
  559. var $Symbol = _core.Symbol || (_core.Symbol = _library ? {} : _global.Symbol || {});
  560. if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty$3($Symbol, name, { value: _wksExt.f(name) });
  561. };
  562. var f$2 = Object.getOwnPropertySymbols;
  563. var _objectGops = {
  564. f: f$2
  565. };
  566. var f$3 = {}.propertyIsEnumerable;
  567. var _objectPie = {
  568. f: f$3
  569. };
  570. // all enumerable object keys, includes symbols
  571. var _enumKeys = function (it) {
  572. var result = _objectKeys(it);
  573. var getSymbols = _objectGops.f;
  574. if (getSymbols) {
  575. var symbols = getSymbols(it);
  576. var isEnum = _objectPie.f;
  577. var i = 0;
  578. var key;
  579. while (symbols.length > i) if (isEnum.call(it, key = symbols[i++])) result.push(key);
  580. } return result;
  581. };
  582. // 7.2.2 IsArray(argument)
  583. var _isArray = Array.isArray || function isArray(arg) {
  584. return _cof(arg) == 'Array';
  585. };
  586. // 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)
  587. var hiddenKeys = _enumBugKeys.concat('length', 'prototype');
  588. var f$5 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
  589. return _objectKeysInternal(O, hiddenKeys);
  590. };
  591. var _objectGopn = {
  592. f: f$5
  593. };
  594. // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
  595. var gOPN$1 = _objectGopn.f;
  596. var toString$1 = {}.toString;
  597. var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
  598. ? Object.getOwnPropertyNames(window) : [];
  599. var getWindowNames = function (it) {
  600. try {
  601. return gOPN$1(it);
  602. } catch (e) {
  603. return windowNames.slice();
  604. }
  605. };
  606. var f$4 = function getOwnPropertyNames(it) {
  607. return windowNames && toString$1.call(it) == '[object Window]' ? getWindowNames(it) : gOPN$1(_toIobject(it));
  608. };
  609. var _objectGopnExt = {
  610. f: f$4
  611. };
  612. var gOPD$1 = Object.getOwnPropertyDescriptor;
  613. var f$6 = _descriptors ? gOPD$1 : function getOwnPropertyDescriptor(O, P) {
  614. O = _toIobject(O);
  615. P = _toPrimitive(P, true);
  616. if (_ie8DomDefine) try {
  617. return gOPD$1(O, P);
  618. } catch (e) { /* empty */ }
  619. if (_has(O, P)) return _propertyDesc(!_objectPie.f.call(O, P), O[P]);
  620. };
  621. var _objectGopd = {
  622. f: f$6
  623. };
  624. // ECMAScript 6 symbols shim
  625. var META = _meta.KEY;
  626. var gOPD = _objectGopd.f;
  627. var dP$1 = _objectDp.f;
  628. var gOPN = _objectGopnExt.f;
  629. var $Symbol = _global.Symbol;
  630. var $JSON = _global.JSON;
  631. var _stringify = $JSON && $JSON.stringify;
  632. var PROTOTYPE$2 = 'prototype';
  633. var HIDDEN = _wks('_hidden');
  634. var TO_PRIMITIVE = _wks('toPrimitive');
  635. var isEnum = {}.propertyIsEnumerable;
  636. var SymbolRegistry = _shared('symbol-registry');
  637. var AllSymbols = _shared('symbols');
  638. var OPSymbols = _shared('op-symbols');
  639. var ObjectProto$1 = Object[PROTOTYPE$2];
  640. var USE_NATIVE = typeof $Symbol == 'function';
  641. var QObject = _global.QObject;
  642. // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
  643. var setter = !QObject || !QObject[PROTOTYPE$2] || !QObject[PROTOTYPE$2].findChild;
  644. // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
  645. var setSymbolDesc = _descriptors && _fails(function () {
  646. return _objectCreate(dP$1({}, 'a', {
  647. get: function () { return dP$1(this, 'a', { value: 7 }).a; }
  648. })).a != 7;
  649. }) ? function (it, key, D) {
  650. var protoDesc = gOPD(ObjectProto$1, key);
  651. if (protoDesc) delete ObjectProto$1[key];
  652. dP$1(it, key, D);
  653. if (protoDesc && it !== ObjectProto$1) dP$1(ObjectProto$1, key, protoDesc);
  654. } : dP$1;
  655. var wrap = function (tag) {
  656. var sym = AllSymbols[tag] = _objectCreate($Symbol[PROTOTYPE$2]);
  657. sym._k = tag;
  658. return sym;
  659. };
  660. var isSymbol = USE_NATIVE && typeof $Symbol.iterator == 'symbol' ? function (it) {
  661. return typeof it == 'symbol';
  662. } : function (it) {
  663. return it instanceof $Symbol;
  664. };
  665. var $defineProperty = function defineProperty(it, key, D) {
  666. if (it === ObjectProto$1) $defineProperty(OPSymbols, key, D);
  667. _anObject(it);
  668. key = _toPrimitive(key, true);
  669. _anObject(D);
  670. if (_has(AllSymbols, key)) {
  671. if (!D.enumerable) {
  672. if (!_has(it, HIDDEN)) dP$1(it, HIDDEN, _propertyDesc(1, {}));
  673. it[HIDDEN][key] = true;
  674. } else {
  675. if (_has(it, HIDDEN) && it[HIDDEN][key]) it[HIDDEN][key] = false;
  676. D = _objectCreate(D, { enumerable: _propertyDesc(0, false) });
  677. } return setSymbolDesc(it, key, D);
  678. } return dP$1(it, key, D);
  679. };
  680. var $defineProperties = function defineProperties(it, P) {
  681. _anObject(it);
  682. var keys = _enumKeys(P = _toIobject(P));
  683. var i = 0;
  684. var l = keys.length;
  685. var key;
  686. while (l > i) $defineProperty(it, key = keys[i++], P[key]);
  687. return it;
  688. };
  689. var $create = function create(it, P) {
  690. return P === undefined ? _objectCreate(it) : $defineProperties(_objectCreate(it), P);
  691. };
  692. var $propertyIsEnumerable = function propertyIsEnumerable(key) {
  693. var E = isEnum.call(this, key = _toPrimitive(key, true));
  694. if (this === ObjectProto$1 && _has(AllSymbols, key) && !_has(OPSymbols, key)) return false;
  695. return E || !_has(this, key) || !_has(AllSymbols, key) || _has(this, HIDDEN) && this[HIDDEN][key] ? E : true;
  696. };
  697. var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key) {
  698. it = _toIobject(it);
  699. key = _toPrimitive(key, true);
  700. if (it === ObjectProto$1 && _has(AllSymbols, key) && !_has(OPSymbols, key)) return;
  701. var D = gOPD(it, key);
  702. if (D && _has(AllSymbols, key) && !(_has(it, HIDDEN) && it[HIDDEN][key])) D.enumerable = true;
  703. return D;
  704. };
  705. var $getOwnPropertyNames = function getOwnPropertyNames(it) {
  706. var names = gOPN(_toIobject(it));
  707. var result = [];
  708. var i = 0;
  709. var key;
  710. while (names.length > i) {
  711. if (!_has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META) result.push(key);
  712. } return result;
  713. };
  714. var $getOwnPropertySymbols = function getOwnPropertySymbols(it) {
  715. var IS_OP = it === ObjectProto$1;
  716. var names = gOPN(IS_OP ? OPSymbols : _toIobject(it));
  717. var result = [];
  718. var i = 0;
  719. var key;
  720. while (names.length > i) {
  721. if (_has(AllSymbols, key = names[i++]) && (IS_OP ? _has(ObjectProto$1, key) : true)) result.push(AllSymbols[key]);
  722. } return result;
  723. };
  724. // 19.4.1.1 Symbol([description])
  725. if (!USE_NATIVE) {
  726. $Symbol = function Symbol() {
  727. if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor!');
  728. var tag = _uid(arguments.length > 0 ? arguments[0] : undefined);
  729. var $set = function (value) {
  730. if (this === ObjectProto$1) $set.call(OPSymbols, value);
  731. if (_has(this, HIDDEN) && _has(this[HIDDEN], tag)) this[HIDDEN][tag] = false;
  732. setSymbolDesc(this, tag, _propertyDesc(1, value));
  733. };
  734. if (_descriptors && setter) setSymbolDesc(ObjectProto$1, tag, { configurable: true, set: $set });
  735. return wrap(tag);
  736. };
  737. _redefine($Symbol[PROTOTYPE$2], 'toString', function toString() {
  738. return this._k;
  739. });
  740. _objectGopd.f = $getOwnPropertyDescriptor;
  741. _objectDp.f = $defineProperty;
  742. _objectGopn.f = _objectGopnExt.f = $getOwnPropertyNames;
  743. _objectPie.f = $propertyIsEnumerable;
  744. _objectGops.f = $getOwnPropertySymbols;
  745. if (_descriptors && !_library) {
  746. _redefine(ObjectProto$1, 'propertyIsEnumerable', $propertyIsEnumerable, true);
  747. }
  748. _wksExt.f = function (name) {
  749. return wrap(_wks(name));
  750. };
  751. }
  752. _export(_export.G + _export.W + _export.F * !USE_NATIVE, { Symbol: $Symbol });
  753. for (var es6Symbols = (
  754. // 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14
  755. 'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables'
  756. ).split(','), j = 0; es6Symbols.length > j;)_wks(es6Symbols[j++]);
  757. for (var wellKnownSymbols = _objectKeys(_wks.store), k = 0; wellKnownSymbols.length > k;) _wksDefine(wellKnownSymbols[k++]);
  758. _export(_export.S + _export.F * !USE_NATIVE, 'Symbol', {
  759. // 19.4.2.1 Symbol.for(key)
  760. 'for': function (key) {
  761. return _has(SymbolRegistry, key += '')
  762. ? SymbolRegistry[key]
  763. : SymbolRegistry[key] = $Symbol(key);
  764. },
  765. // 19.4.2.5 Symbol.keyFor(sym)
  766. keyFor: function keyFor(sym) {
  767. if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol!');
  768. for (var key in SymbolRegistry) if (SymbolRegistry[key] === sym) return key;
  769. },
  770. useSetter: function () { setter = true; },
  771. useSimple: function () { setter = false; }
  772. });
  773. _export(_export.S + _export.F * !USE_NATIVE, 'Object', {
  774. // 19.1.2.2 Object.create(O [, Properties])
  775. create: $create,
  776. // 19.1.2.4 Object.defineProperty(O, P, Attributes)
  777. defineProperty: $defineProperty,
  778. // 19.1.2.3 Object.defineProperties(O, Properties)
  779. defineProperties: $defineProperties,
  780. // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
  781. getOwnPropertyDescriptor: $getOwnPropertyDescriptor,
  782. // 19.1.2.7 Object.getOwnPropertyNames(O)
  783. getOwnPropertyNames: $getOwnPropertyNames,
  784. // 19.1.2.8 Object.getOwnPropertySymbols(O)
  785. getOwnPropertySymbols: $getOwnPropertySymbols
  786. });
  787. // 24.3.2 JSON.stringify(value [, replacer [, space]])
  788. $JSON && _export(_export.S + _export.F * (!USE_NATIVE || _fails(function () {
  789. var S = $Symbol();
  790. // MS Edge converts symbol values to JSON as {}
  791. // WebKit converts symbol values to JSON as null
  792. // V8 throws on boxed symbols
  793. return _stringify([S]) != '[null]' || _stringify({ a: S }) != '{}' || _stringify(Object(S)) != '{}';
  794. })), 'JSON', {
  795. stringify: function stringify(it) {
  796. var args = [it];
  797. var i = 1;
  798. var replacer, $replacer;
  799. while (arguments.length > i) args.push(arguments[i++]);
  800. $replacer = replacer = args[1];
  801. if (!_isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined
  802. if (!_isArray(replacer)) replacer = function (key, value) {
  803. if (typeof $replacer == 'function') value = $replacer.call(this, key, value);
  804. if (!isSymbol(value)) return value;
  805. };
  806. args[1] = replacer;
  807. return _stringify.apply($JSON, args);
  808. }
  809. });
  810. // 19.4.3.4 Symbol.prototype[@@toPrimitive](hint)
  811. $Symbol[PROTOTYPE$2][TO_PRIMITIVE] || _hide($Symbol[PROTOTYPE$2], TO_PRIMITIVE, $Symbol[PROTOTYPE$2].valueOf);
  812. // 19.4.3.5 Symbol.prototype[@@toStringTag]
  813. _setToStringTag($Symbol, 'Symbol');
  814. // 20.2.1.9 Math[@@toStringTag]
  815. _setToStringTag(Math, 'Math', true);
  816. // 24.3.3 JSON[@@toStringTag]
  817. _setToStringTag(_global.JSON, 'JSON', true);
  818. _wksDefine('asyncIterator');
  819. _wksDefine('observable');
  820. var symbol$2 = _core.Symbol;
  821. var symbol = createCommonjsModule(function (module) {
  822. module.exports = { "default": symbol$2, __esModule: true };
  823. });
  824. unwrapExports(symbol);
  825. var _typeof_1 = createCommonjsModule(function (module, exports) {
  826. exports.__esModule = true;
  827. var _iterator2 = _interopRequireDefault(iterator);
  828. var _symbol2 = _interopRequireDefault(symbol);
  829. var _typeof = typeof _symbol2.default === "function" && typeof _iterator2.default === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj; };
  830. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  831. exports.default = typeof _symbol2.default === "function" && _typeof(_iterator2.default) === "symbol" ? function (obj) {
  832. return typeof obj === "undefined" ? "undefined" : _typeof(obj);
  833. } : function (obj) {
  834. return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj === "undefined" ? "undefined" : _typeof(obj);
  835. };
  836. });
  837. var _typeof = unwrapExports(_typeof_1);
  838. var _redefineAll = function (target, src, safe) {
  839. for (var key in src) {
  840. if (safe && target[key]) target[key] = src[key];
  841. else _hide(target, key, src[key]);
  842. } return target;
  843. };
  844. var _anInstance = function (it, Constructor, name, forbiddenField) {
  845. if (!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)) {
  846. throw TypeError(name + ': incorrect invocation!');
  847. } return it;
  848. };
  849. // call something on iterator step with safe closing on error
  850. var _iterCall = function (iterator, fn, value, entries) {
  851. try {
  852. return entries ? fn(_anObject(value)[0], value[1]) : fn(value);
  853. // 7.4.6 IteratorClose(iterator, completion)
  854. } catch (e) {
  855. var ret = iterator['return'];
  856. if (ret !== undefined) _anObject(ret.call(iterator));
  857. throw e;
  858. }
  859. };
  860. // check on default Array iterator
  861. var ITERATOR$1 = _wks('iterator');
  862. var ArrayProto = Array.prototype;
  863. var _isArrayIter = function (it) {
  864. return it !== undefined && (_iterators.Array === it || ArrayProto[ITERATOR$1] === it);
  865. };
  866. // getting tag from 19.1.3.6 Object.prototype.toString()
  867. var TAG$1 = _wks('toStringTag');
  868. // ES3 wrong here
  869. var ARG = _cof(function () { return arguments; }()) == 'Arguments';
  870. // fallback for IE11 Script Access Denied error
  871. var tryGet = function (it, key) {
  872. try {
  873. return it[key];
  874. } catch (e) { /* empty */ }
  875. };
  876. var _classof = function (it) {
  877. var O, T, B;
  878. return it === undefined ? 'Undefined' : it === null ? 'Null'
  879. // @@toStringTag case
  880. : typeof (T = tryGet(O = Object(it), TAG$1)) == 'string' ? T
  881. // builtinTag case
  882. : ARG ? _cof(O)
  883. // ES3 arguments fallback
  884. : (B = _cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;
  885. };
  886. var ITERATOR$2 = _wks('iterator');
  887. var core_getIteratorMethod = _core.getIteratorMethod = function (it) {
  888. if (it != undefined) return it[ITERATOR$2]
  889. || it['@@iterator']
  890. || _iterators[_classof(it)];
  891. };
  892. var _forOf = createCommonjsModule(function (module) {
  893. var BREAK = {};
  894. var RETURN = {};
  895. var exports = module.exports = function (iterable, entries, fn, that, ITERATOR) {
  896. var iterFn = ITERATOR ? function () { return iterable; } : core_getIteratorMethod(iterable);
  897. var f = _ctx(fn, that, entries ? 2 : 1);
  898. var index = 0;
  899. var length, step, iterator, result;
  900. if (typeof iterFn != 'function') throw TypeError(iterable + ' is not iterable!');
  901. // fast case for arrays with default iterator
  902. if (_isArrayIter(iterFn)) for (length = _toLength(iterable.length); length > index; index++) {
  903. result = entries ? f(_anObject(step = iterable[index])[0], step[1]) : f(iterable[index]);
  904. if (result === BREAK || result === RETURN) return result;
  905. } else for (iterator = iterFn.call(iterable); !(step = iterator.next()).done;) {
  906. result = _iterCall(iterator, f, step.value, entries);
  907. if (result === BREAK || result === RETURN) return result;
  908. }
  909. };
  910. exports.BREAK = BREAK;
  911. exports.RETURN = RETURN;
  912. });
  913. var SPECIES = _wks('species');
  914. var _setSpecies = function (KEY) {
  915. var C = typeof _core[KEY] == 'function' ? _core[KEY] : _global[KEY];
  916. if (_descriptors && C && !C[SPECIES]) _objectDp.f(C, SPECIES, {
  917. configurable: true,
  918. get: function () { return this; }
  919. });
  920. };
  921. var _validateCollection = function (it, TYPE) {
  922. if (!_isObject(it) || it._t !== TYPE) throw TypeError('Incompatible receiver, ' + TYPE + ' required!');
  923. return it;
  924. };
  925. var dP$2 = _objectDp.f;
  926. var fastKey = _meta.fastKey;
  927. var SIZE = _descriptors ? '_s' : 'size';
  928. var getEntry = function (that, key) {
  929. // fast case
  930. var index = fastKey(key);
  931. var entry;
  932. if (index !== 'F') return that._i[index];
  933. // frozen object case
  934. for (entry = that._f; entry; entry = entry.n) {
  935. if (entry.k == key) return entry;
  936. }
  937. };
  938. var _collectionStrong = {
  939. getConstructor: function (wrapper, NAME, IS_MAP, ADDER) {
  940. var C = wrapper(function (that, iterable) {
  941. _anInstance(that, C, NAME, '_i');
  942. that._t = NAME; // collection type
  943. that._i = _objectCreate(null); // index
  944. that._f = undefined; // first entry
  945. that._l = undefined; // last entry
  946. that[SIZE] = 0; // size
  947. if (iterable != undefined) _forOf(iterable, IS_MAP, that[ADDER], that);
  948. });
  949. _redefineAll(C.prototype, {
  950. // 23.1.3.1 Map.prototype.clear()
  951. // 23.2.3.2 Set.prototype.clear()
  952. clear: function clear() {
  953. for (var that = _validateCollection(this, NAME), data = that._i, entry = that._f; entry; entry = entry.n) {
  954. entry.r = true;
  955. if (entry.p) entry.p = entry.p.n = undefined;
  956. delete data[entry.i];
  957. }
  958. that._f = that._l = undefined;
  959. that[SIZE] = 0;
  960. },
  961. // 23.1.3.3 Map.prototype.delete(key)
  962. // 23.2.3.4 Set.prototype.delete(value)
  963. 'delete': function (key) {
  964. var that = _validateCollection(this, NAME);
  965. var entry = getEntry(that, key);
  966. if (entry) {
  967. var next = entry.n;
  968. var prev = entry.p;
  969. delete that._i[entry.i];
  970. entry.r = true;
  971. if (prev) prev.n = next;
  972. if (next) next.p = prev;
  973. if (that._f == entry) that._f = next;
  974. if (that._l == entry) that._l = prev;
  975. that[SIZE]--;
  976. } return !!entry;
  977. },
  978. // 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined)
  979. // 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined)
  980. forEach: function forEach(callbackfn /* , that = undefined */) {
  981. _validateCollection(this, NAME);
  982. var f = _ctx(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3);
  983. var entry;
  984. while (entry = entry ? entry.n : this._f) {
  985. f(entry.v, entry.k, this);
  986. // revert to the last existing entry
  987. while (entry && entry.r) entry = entry.p;
  988. }
  989. },
  990. // 23.1.3.7 Map.prototype.has(key)
  991. // 23.2.3.7 Set.prototype.has(value)
  992. has: function has(key) {
  993. return !!getEntry(_validateCollection(this, NAME), key);
  994. }
  995. });
  996. if (_descriptors) dP$2(C.prototype, 'size', {
  997. get: function () {
  998. return _validateCollection(this, NAME)[SIZE];
  999. }
  1000. });
  1001. return C;
  1002. },
  1003. def: function (that, key, value) {
  1004. var entry = getEntry(that, key);
  1005. var prev, index;
  1006. // change existing entry
  1007. if (entry) {
  1008. entry.v = value;
  1009. // create new entry
  1010. } else {
  1011. that._l = entry = {
  1012. i: index = fastKey(key, true), // <- index
  1013. k: key, // <- key
  1014. v: value, // <- value
  1015. p: prev = that._l, // <- previous entry
  1016. n: undefined, // <- next entry
  1017. r: false // <- removed
  1018. };
  1019. if (!that._f) that._f = entry;
  1020. if (prev) prev.n = entry;
  1021. that[SIZE]++;
  1022. // add to index
  1023. if (index !== 'F') that._i[index] = entry;
  1024. } return that;
  1025. },
  1026. getEntry: getEntry,
  1027. setStrong: function (C, NAME, IS_MAP) {
  1028. // add .keys, .values, .entries, [@@iterator]
  1029. // 23.1.3.4, 23.1.3.8, 23.1.3.11, 23.1.3.12, 23.2.3.5, 23.2.3.8, 23.2.3.10, 23.2.3.11
  1030. _iterDefine(C, NAME, function (iterated, kind) {
  1031. this._t = _validateCollection(iterated, NAME); // target
  1032. this._k = kind; // kind
  1033. this._l = undefined; // previous
  1034. }, function () {
  1035. var that = this;
  1036. var kind = that._k;
  1037. var entry = that._l;
  1038. // revert to the last existing entry
  1039. while (entry && entry.r) entry = entry.p;
  1040. // get next entry
  1041. if (!that._t || !(that._l = entry = entry ? entry.n : that._t._f)) {
  1042. // or finish the iteration
  1043. that._t = undefined;
  1044. return _iterStep(1);
  1045. }
  1046. // return step by kind
  1047. if (kind == 'keys') return _iterStep(0, entry.k);
  1048. if (kind == 'values') return _iterStep(0, entry.v);
  1049. return _iterStep(0, [entry.k, entry.v]);
  1050. }, IS_MAP ? 'entries' : 'values', !IS_MAP, true);
  1051. // add [@@species], 23.1.2.2, 23.2.2.2
  1052. _setSpecies(NAME);
  1053. }
  1054. };
  1055. var SPECIES$1 = _wks('species');
  1056. var _arraySpeciesConstructor = function (original) {
  1057. var C;
  1058. if (_isArray(original)) {
  1059. C = original.constructor;
  1060. // cross-realm fallback
  1061. if (typeof C == 'function' && (C === Array || _isArray(C.prototype))) C = undefined;
  1062. if (_isObject(C)) {
  1063. C = C[SPECIES$1];
  1064. if (C === null) C = undefined;
  1065. }
  1066. } return C === undefined ? Array : C;
  1067. };
  1068. // 9.4.2.3 ArraySpeciesCreate(originalArray, length)
  1069. var _arraySpeciesCreate = function (original, length) {
  1070. return new (_arraySpeciesConstructor(original))(length);
  1071. };
  1072. // 0 -> Array#forEach
  1073. // 1 -> Array#map
  1074. // 2 -> Array#filter
  1075. // 3 -> Array#some
  1076. // 4 -> Array#every
  1077. // 5 -> Array#find
  1078. // 6 -> Array#findIndex
  1079. var _arrayMethods = function (TYPE, $create) {
  1080. var IS_MAP = TYPE == 1;
  1081. var IS_FILTER = TYPE == 2;
  1082. var IS_SOME = TYPE == 3;
  1083. var IS_EVERY = TYPE == 4;
  1084. var IS_FIND_INDEX = TYPE == 6;
  1085. var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
  1086. var create = $create || _arraySpeciesCreate;
  1087. return function ($this, callbackfn, that) {
  1088. var O = _toObject($this);
  1089. var self = _iobject(O);
  1090. var f = _ctx(callbackfn, that, 3);
  1091. var length = _toLength(self.length);
  1092. var index = 0;
  1093. var result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;
  1094. var val, res;
  1095. for (;length > index; index++) if (NO_HOLES || index in self) {
  1096. val = self[index];
  1097. res = f(val, index, O);
  1098. if (TYPE) {
  1099. if (IS_MAP) result[index] = res; // map
  1100. else if (res) switch (TYPE) {
  1101. case 3: return true; // some
  1102. case 5: return val; // find
  1103. case 6: return index; // findIndex
  1104. case 2: result.push(val); // filter
  1105. } else if (IS_EVERY) return false; // every
  1106. }
  1107. }
  1108. return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result;
  1109. };
  1110. };
  1111. var dP$3 = _objectDp.f;
  1112. var each = _arrayMethods(0);
  1113. var _collection = function (NAME, wrapper, methods, common, IS_MAP, IS_WEAK) {
  1114. var Base = _global[NAME];
  1115. var C = Base;
  1116. var ADDER = IS_MAP ? 'set' : 'add';
  1117. var proto = C && C.prototype;
  1118. var O = {};
  1119. if (!_descriptors || typeof C != 'function' || !(IS_WEAK || proto.forEach && !_fails(function () {
  1120. new C().entries().next();
  1121. }))) {
  1122. // create collection constructor
  1123. C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER);
  1124. _redefineAll(C.prototype, methods);
  1125. _meta.NEED = true;
  1126. } else {
  1127. C = wrapper(function (target, iterable) {
  1128. _anInstance(target, C, NAME, '_c');
  1129. target._c = new Base();
  1130. if (iterable != undefined) _forOf(iterable, IS_MAP, target[ADDER], target);
  1131. });
  1132. each('add,clear,delete,forEach,get,has,set,keys,values,entries,toJSON'.split(','), function (KEY) {
  1133. var IS_ADDER = KEY == 'add' || KEY == 'set';
  1134. if (KEY in proto && !(IS_WEAK && KEY == 'clear')) _hide(C.prototype, KEY, function (a, b) {
  1135. _anInstance(this, C, KEY);
  1136. if (!IS_ADDER && IS_WEAK && !_isObject(a)) return KEY == 'get' ? undefined : false;
  1137. var result = this._c[KEY](a === 0 ? 0 : a, b);
  1138. return IS_ADDER ? this : result;
  1139. });
  1140. });
  1141. IS_WEAK || dP$3(C.prototype, 'size', {
  1142. get: function () {
  1143. return this._c.size;
  1144. }
  1145. });
  1146. }
  1147. _setToStringTag(C, NAME);
  1148. O[NAME] = C;
  1149. _export(_export.G + _export.W + _export.F, O);
  1150. if (!IS_WEAK) common.setStrong(C, NAME, IS_MAP);
  1151. return C;
  1152. };
  1153. var MAP = 'Map';
  1154. // 23.1 Map Objects
  1155. var es6_map = _collection(MAP, function (get) {
  1156. return function Map() { return get(this, arguments.length > 0 ? arguments[0] : undefined); };
  1157. }, {
  1158. // 23.1.3.6 Map.prototype.get(key)
  1159. get: function get(key) {
  1160. var entry = _collectionStrong.getEntry(_validateCollection(this, MAP), key);
  1161. return entry && entry.v;
  1162. },
  1163. // 23.1.3.9 Map.prototype.set(key, value)
  1164. set: function set(key, value) {
  1165. return _collectionStrong.def(_validateCollection(this, MAP), key === 0 ? 0 : key, value);
  1166. }
  1167. }, _collectionStrong, true);
  1168. var _arrayFromIterable = function (iter, ITERATOR) {
  1169. var result = [];
  1170. _forOf(iter, false, result.push, result, ITERATOR);
  1171. return result;
  1172. };
  1173. // https://github.com/DavidBruant/Map-Set.prototype.toJSON
  1174. var _collectionToJson = function (NAME) {
  1175. return function toJSON() {
  1176. if (_classof(this) != NAME) throw TypeError(NAME + "#toJSON isn't generic");
  1177. return _arrayFromIterable(this);
  1178. };
  1179. };
  1180. // https://github.com/DavidBruant/Map-Set.prototype.toJSON
  1181. _export(_export.P + _export.R, 'Map', { toJSON: _collectionToJson('Map') });
  1182. // https://tc39.github.io/proposal-setmap-offrom/
  1183. var _setCollectionOf = function (COLLECTION) {
  1184. _export(_export.S, COLLECTION, { of: function of() {
  1185. var length = arguments.length;
  1186. var A = new Array(length);
  1187. while (length--) A[length] = arguments[length];
  1188. return new this(A);
  1189. } });
  1190. };
  1191. // https://tc39.github.io/proposal-setmap-offrom/#sec-map.of
  1192. _setCollectionOf('Map');
  1193. // https://tc39.github.io/proposal-setmap-offrom/
  1194. var _setCollectionFrom = function (COLLECTION) {
  1195. _export(_export.S, COLLECTION, { from: function from(source /* , mapFn, thisArg */) {
  1196. var mapFn = arguments[1];
  1197. var mapping, A, n, cb;
  1198. _aFunction(this);
  1199. mapping = mapFn !== undefined;
  1200. if (mapping) _aFunction(mapFn);
  1201. if (source == undefined) return new this();
  1202. A = [];
  1203. if (mapping) {
  1204. n = 0;
  1205. cb = _ctx(mapFn, arguments[2], 2);
  1206. _forOf(source, false, function (nextItem) {
  1207. A.push(cb(nextItem, n++));
  1208. });
  1209. } else {
  1210. _forOf(source, false, A.push, A);
  1211. }
  1212. return new this(A);
  1213. } });
  1214. };
  1215. // https://tc39.github.io/proposal-setmap-offrom/#sec-map.from
  1216. _setCollectionFrom('Map');
  1217. var map$1 = _core.Map;
  1218. var map = createCommonjsModule(function (module) {
  1219. module.exports = { "default": map$1, __esModule: true };
  1220. });
  1221. var _Map = unwrapExports(map);
  1222. var SET = 'Set';
  1223. // 23.2 Set Objects
  1224. var es6_set = _collection(SET, function (get) {
  1225. return function Set() { return get(this, arguments.length > 0 ? arguments[0] : undefined); };
  1226. }, {
  1227. // 23.2.3.1 Set.prototype.add(value)
  1228. add: function add(value) {
  1229. return _collectionStrong.def(_validateCollection(this, SET), value = value === 0 ? 0 : value, value);
  1230. }
  1231. }, _collectionStrong);
  1232. // https://github.com/DavidBruant/Map-Set.prototype.toJSON
  1233. _export(_export.P + _export.R, 'Set', { toJSON: _collectionToJson('Set') });
  1234. // https://tc39.github.io/proposal-setmap-offrom/#sec-set.of
  1235. _setCollectionOf('Set');
  1236. // https://tc39.github.io/proposal-setmap-offrom/#sec-set.from
  1237. _setCollectionFrom('Set');
  1238. var set$1 = _core.Set;
  1239. var set = createCommonjsModule(function (module) {
  1240. module.exports = { "default": set$1, __esModule: true };
  1241. });
  1242. var _Set = unwrapExports(set);
  1243. // 19.1.2.1 Object.assign(target, source, ...)
  1244. var $assign = Object.assign;
  1245. // should work with symbols and should have deterministic property order (V8 bug)
  1246. var _objectAssign = !$assign || _fails(function () {
  1247. var A = {};
  1248. var B = {};
  1249. // eslint-disable-next-line no-undef
  1250. var S = Symbol();
  1251. var K = 'abcdefghijklmnopqrst';
  1252. A[S] = 7;
  1253. K.split('').forEach(function (k) { B[k] = k; });
  1254. return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;
  1255. }) ? function assign(target, source) { // eslint-disable-line no-unused-vars
  1256. var T = _toObject(target);
  1257. var aLen = arguments.length;
  1258. var index = 1;
  1259. var getSymbols = _objectGops.f;
  1260. var isEnum = _objectPie.f;
  1261. while (aLen > index) {
  1262. var S = _iobject(arguments[index++]);
  1263. var keys = getSymbols ? _objectKeys(S).concat(getSymbols(S)) : _objectKeys(S);
  1264. var length = keys.length;
  1265. var j = 0;
  1266. var key;
  1267. while (length > j) if (isEnum.call(S, key = keys[j++])) T[key] = S[key];
  1268. } return T;
  1269. } : $assign;
  1270. var getWeak = _meta.getWeak;
  1271. var arrayFind = _arrayMethods(5);
  1272. var arrayFindIndex = _arrayMethods(6);
  1273. var id$1 = 0;
  1274. // fallback for uncaught frozen keys
  1275. var uncaughtFrozenStore = function (that) {
  1276. return that._l || (that._l = new UncaughtFrozenStore());
  1277. };
  1278. var UncaughtFrozenStore = function () {
  1279. this.a = [];
  1280. };
  1281. var findUncaughtFrozen = function (store, key) {
  1282. return arrayFind(store.a, function (it) {
  1283. return it[0] === key;
  1284. });
  1285. };
  1286. UncaughtFrozenStore.prototype = {
  1287. get: function (key) {
  1288. var entry = findUncaughtFrozen(this, key);
  1289. if (entry) return entry[1];
  1290. },
  1291. has: function (key) {
  1292. return !!findUncaughtFrozen(this, key);
  1293. },
  1294. set: function (key, value) {
  1295. var entry = findUncaughtFrozen(this, key);
  1296. if (entry) entry[1] = value;
  1297. else this.a.push([key, value]);
  1298. },
  1299. 'delete': function (key) {
  1300. var index = arrayFindIndex(this.a, function (it) {
  1301. return it[0] === key;
  1302. });
  1303. if (~index) this.a.splice(index, 1);
  1304. return !!~index;
  1305. }
  1306. };
  1307. var _collectionWeak = {
  1308. getConstructor: function (wrapper, NAME, IS_MAP, ADDER) {
  1309. var C = wrapper(function (that, iterable) {
  1310. _anInstance(that, C, NAME, '_i');
  1311. that._t = NAME; // collection type
  1312. that._i = id$1++; // collection id
  1313. that._l = undefined; // leak store for uncaught frozen objects
  1314. if (iterable != undefined) _forOf(iterable, IS_MAP, that[ADDER], that);
  1315. });
  1316. _redefineAll(C.prototype, {
  1317. // 23.3.3.2 WeakMap.prototype.delete(key)
  1318. // 23.4.3.3 WeakSet.prototype.delete(value)
  1319. 'delete': function (key) {
  1320. if (!_isObject(key)) return false;
  1321. var data = getWeak(key);
  1322. if (data === true) return uncaughtFrozenStore(_validateCollection(this, NAME))['delete'](key);
  1323. return data && _has(data, this._i) && delete data[this._i];
  1324. },
  1325. // 23.3.3.4 WeakMap.prototype.has(key)
  1326. // 23.4.3.4 WeakSet.prototype.has(value)
  1327. has: function has(key) {
  1328. if (!_isObject(key)) return false;
  1329. var data = getWeak(key);
  1330. if (data === true) return uncaughtFrozenStore(_validateCollection(this, NAME)).has(key);
  1331. return data && _has(data, this._i);
  1332. }
  1333. });
  1334. return C;
  1335. },
  1336. def: function (that, key, value) {
  1337. var data = getWeak(_anObject(key), true);
  1338. if (data === true) uncaughtFrozenStore(that).set(key, value);
  1339. else data[that._i] = value;
  1340. return that;
  1341. },
  1342. ufstore: uncaughtFrozenStore
  1343. };
  1344. var es6_weakMap = createCommonjsModule(function (module) {
  1345. var each = _arrayMethods(0);
  1346. var WEAK_MAP = 'WeakMap';
  1347. var getWeak = _meta.getWeak;
  1348. var isExtensible = Object.isExtensible;
  1349. var uncaughtFrozenStore = _collectionWeak.ufstore;
  1350. var tmp = {};
  1351. var InternalMap;
  1352. var wrapper = function (get) {
  1353. return function WeakMap() {
  1354. return get(this, arguments.length > 0 ? arguments[0] : undefined);
  1355. };
  1356. };
  1357. var methods = {
  1358. // 23.3.3.3 WeakMap.prototype.get(key)
  1359. get: function get(key) {
  1360. if (_isObject(key)) {
  1361. var data = getWeak(key);
  1362. if (data === true) return uncaughtFrozenStore(_validateCollection(this, WEAK_MAP)).get(key);
  1363. return data ? data[this._i] : undefined;
  1364. }
  1365. },
  1366. // 23.3.3.5 WeakMap.prototype.set(key, value)
  1367. set: function set(key, value) {
  1368. return _collectionWeak.def(_validateCollection(this, WEAK_MAP), key, value);
  1369. }
  1370. };
  1371. // 23.3 WeakMap Objects
  1372. var $WeakMap = module.exports = _collection(WEAK_MAP, wrapper, methods, _collectionWeak, true, true);
  1373. // IE11 WeakMap frozen keys fix
  1374. if (_fails(function () { return new $WeakMap().set((Object.freeze || Object)(tmp), 7).get(tmp) != 7; })) {
  1375. InternalMap = _collectionWeak.getConstructor(wrapper, WEAK_MAP);
  1376. _objectAssign(InternalMap.prototype, methods);
  1377. _meta.NEED = true;
  1378. each(['delete', 'has', 'get', 'set'], function (key) {
  1379. var proto = $WeakMap.prototype;
  1380. var method = proto[key];
  1381. _redefine(proto, key, function (a, b) {
  1382. // store frozen objects on internal weakmap shim
  1383. if (_isObject(a) && !isExtensible(a)) {
  1384. if (!this._f) this._f = new InternalMap();
  1385. var result = this._f[key](a, b);
  1386. return key == 'set' ? this : result;
  1387. // store all the rest on native weakmap
  1388. } return method.call(this, a, b);
  1389. });
  1390. });
  1391. }
  1392. });
  1393. // https://tc39.github.io/proposal-setmap-offrom/#sec-weakmap.of
  1394. _setCollectionOf('WeakMap');
  1395. // https://tc39.github.io/proposal-setmap-offrom/#sec-weakmap.from
  1396. _setCollectionFrom('WeakMap');
  1397. var weakMap$1 = _core.WeakMap;
  1398. var weakMap = createCommonjsModule(function (module) {
  1399. module.exports = { "default": weakMap$1, __esModule: true };
  1400. });
  1401. var _WeakMap = unwrapExports(weakMap);
  1402. var classCallCheck = createCommonjsModule(function (module, exports) {
  1403. exports.__esModule = true;
  1404. exports.default = function (instance, Constructor) {
  1405. if (!(instance instanceof Constructor)) {
  1406. throw new TypeError("Cannot call a class as a function");
  1407. }
  1408. };
  1409. });
  1410. var _classCallCheck = unwrapExports(classCallCheck);
  1411. var createClass = createCommonjsModule(function (module, exports) {
  1412. exports.__esModule = true;
  1413. var _defineProperty2 = _interopRequireDefault(defineProperty);
  1414. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1415. exports.default = function () {
  1416. function defineProperties(target, props) {
  1417. for (var i = 0; i < props.length; i++) {
  1418. var descriptor = props[i];
  1419. descriptor.enumerable = descriptor.enumerable || false;
  1420. descriptor.configurable = true;
  1421. if ("value" in descriptor) descriptor.writable = true;
  1422. (0, _defineProperty2.default)(target, descriptor.key, descriptor);
  1423. }
  1424. }
  1425. return function (Constructor, protoProps, staticProps) {
  1426. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  1427. if (staticProps) defineProperties(Constructor, staticProps);
  1428. return Constructor;
  1429. };
  1430. }();
  1431. });
  1432. var _createClass = unwrapExports(createClass);
  1433. // 7.3.20 SpeciesConstructor(O, defaultConstructor)
  1434. var SPECIES$2 = _wks('species');
  1435. var _speciesConstructor = function (O, D) {
  1436. var C = _anObject(O).constructor;
  1437. var S;
  1438. return C === undefined || (S = _anObject(C)[SPECIES$2]) == undefined ? D : _aFunction(S);
  1439. };
  1440. // fast apply, http://jsperf.lnkit.com/fast-apply/5
  1441. var _invoke = function (fn, args, that) {
  1442. var un = that === undefined;
  1443. switch (args.length) {
  1444. case 0: return un ? fn()
  1445. : fn.call(that);
  1446. case 1: return un ? fn(args[0])
  1447. : fn.call(that, args[0]);
  1448. case 2: return un ? fn(args[0], args[1])
  1449. : fn.call(that, args[0], args[1]);
  1450. case 3: return un ? fn(args[0], args[1], args[2])
  1451. : fn.call(that, args[0], args[1], args[2]);
  1452. case 4: return un ? fn(args[0], args[1], args[2], args[3])
  1453. : fn.call(that, args[0], args[1], args[2], args[3]);
  1454. } return fn.apply(that, args);
  1455. };
  1456. var process$1 = _global.process;
  1457. var setTask = _global.setImmediate;
  1458. var clearTask = _global.clearImmediate;
  1459. var MessageChannel = _global.MessageChannel;
  1460. var Dispatch = _global.Dispatch;
  1461. var counter = 0;
  1462. var queue = {};
  1463. var ONREADYSTATECHANGE = 'onreadystatechange';
  1464. var defer;
  1465. var channel;
  1466. var port;
  1467. var run = function () {
  1468. var id = +this;
  1469. // eslint-disable-next-line no-prototype-builtins
  1470. if (queue.hasOwnProperty(id)) {
  1471. var fn = queue[id];
  1472. delete queue[id];
  1473. fn();
  1474. }
  1475. };
  1476. var listener = function (event) {
  1477. run.call(event.data);
  1478. };
  1479. // Node.js 0.9+ & IE10+ has setImmediate, otherwise:
  1480. if (!setTask || !clearTask) {
  1481. setTask = function setImmediate(fn) {
  1482. var args = [];
  1483. var i = 1;
  1484. while (arguments.length > i) args.push(arguments[i++]);
  1485. queue[++counter] = function () {
  1486. // eslint-disable-next-line no-new-func
  1487. _invoke(typeof fn == 'function' ? fn : Function(fn), args);
  1488. };
  1489. defer(counter);
  1490. return counter;
  1491. };
  1492. clearTask = function clearImmediate(id) {
  1493. delete queue[id];
  1494. };
  1495. // Node.js 0.8-
  1496. if (_cof(process$1) == 'process') {
  1497. defer = function (id) {
  1498. process$1.nextTick(_ctx(run, id, 1));
  1499. };
  1500. // Sphere (JS game engine) Dispatch API
  1501. } else if (Dispatch && Dispatch.now) {
  1502. defer = function (id) {
  1503. Dispatch.now(_ctx(run, id, 1));
  1504. };
  1505. // Browsers with MessageChannel, includes WebWorkers
  1506. } else if (MessageChannel) {
  1507. channel = new MessageChannel();
  1508. port = channel.port2;
  1509. channel.port1.onmessage = listener;
  1510. defer = _ctx(port.postMessage, port, 1);
  1511. // Browsers with postMessage, skip WebWorkers
  1512. // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
  1513. } else if (_global.addEventListener && typeof postMessage == 'function' && !_global.importScripts) {
  1514. defer = function (id) {
  1515. _global.postMessage(id + '', '*');
  1516. };
  1517. _global.addEventListener('message', listener, false);
  1518. // IE8-
  1519. } else if (ONREADYSTATECHANGE in _domCreate('script')) {
  1520. defer = function (id) {
  1521. _html.appendChild(_domCreate('script'))[ONREADYSTATECHANGE] = function () {
  1522. _html.removeChild(this);
  1523. run.call(id);
  1524. };
  1525. };
  1526. // Rest old browsers
  1527. } else {
  1528. defer = function (id) {
  1529. setTimeout(_ctx(run, id, 1), 0);
  1530. };
  1531. }
  1532. }
  1533. var _task = {
  1534. set: setTask,
  1535. clear: clearTask
  1536. };
  1537. var macrotask = _task.set;
  1538. var Observer = _global.MutationObserver || _global.WebKitMutationObserver;
  1539. var process$2 = _global.process;
  1540. var Promise = _global.Promise;
  1541. var isNode$1 = _cof(process$2) == 'process';
  1542. var _microtask = function () {
  1543. var head, last, notify;
  1544. var flush = function () {
  1545. var parent, fn;
  1546. if (isNode$1 && (parent = process$2.domain)) parent.exit();
  1547. while (head) {
  1548. fn = head.fn;
  1549. head = head.next;
  1550. try {
  1551. fn();
  1552. } catch (e) {
  1553. if (head) notify();
  1554. else last = undefined;
  1555. throw e;
  1556. }
  1557. } last = undefined;
  1558. if (parent) parent.enter();
  1559. };
  1560. // Node.js
  1561. if (isNode$1) {
  1562. notify = function () {
  1563. process$2.nextTick(flush);
  1564. };
  1565. // browsers with MutationObserver, except iOS Safari - https://github.com/zloirock/core-js/issues/339
  1566. } else if (Observer && !(_global.navigator && _global.navigator.standalone)) {
  1567. var toggle = true;
  1568. var node = document.createTextNode('');
  1569. new Observer(flush).observe(node, { characterData: true }); // eslint-disable-line no-new
  1570. notify = function () {
  1571. node.data = toggle = !toggle;
  1572. };
  1573. // environments with maybe non-completely correct, but existent Promise
  1574. } else if (Promise && Promise.resolve) {
  1575. var promise = Promise.resolve();
  1576. notify = function () {
  1577. promise.then(flush);
  1578. };
  1579. // for other environments - macrotask based on:
  1580. // - setImmediate
  1581. // - MessageChannel
  1582. // - window.postMessag
  1583. // - onreadystatechange
  1584. // - setTimeout
  1585. } else {
  1586. notify = function () {
  1587. // strange IE + webpack dev server bug - use .call(global)
  1588. macrotask.call(_global, flush);
  1589. };
  1590. }
  1591. return function (fn) {
  1592. var task = { fn: fn, next: undefined };
  1593. if (last) last.next = task;
  1594. if (!head) {
  1595. head = task;
  1596. notify();
  1597. } last = task;
  1598. };
  1599. };
  1600. // 25.4.1.5 NewPromiseCapability(C)
  1601. function PromiseCapability(C) {
  1602. var resolve, reject;
  1603. this.promise = new C(function ($$resolve, $$reject) {
  1604. if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');
  1605. resolve = $$resolve;
  1606. reject = $$reject;
  1607. });
  1608. this.resolve = _aFunction(resolve);
  1609. this.reject = _aFunction(reject);
  1610. }
  1611. var f$7 = function (C) {
  1612. return new PromiseCapability(C);
  1613. };
  1614. var _newPromiseCapability = {
  1615. f: f$7
  1616. };
  1617. var _perform = function (exec) {
  1618. try {
  1619. return { e: false, v: exec() };
  1620. } catch (e) {
  1621. return { e: true, v: e };
  1622. }
  1623. };
  1624. var _promiseResolve = function (C, x) {
  1625. _anObject(C);
  1626. if (_isObject(x) && x.constructor === C) return x;
  1627. var promiseCapability = _newPromiseCapability.f(C);
  1628. var resolve = promiseCapability.resolve;
  1629. resolve(x);
  1630. return promiseCapability.promise;
  1631. };
  1632. var ITERATOR$3 = _wks('iterator');
  1633. var SAFE_CLOSING = false;
  1634. try {
  1635. var riter = [7][ITERATOR$3]();
  1636. riter['return'] = function () { SAFE_CLOSING = true; };
  1637. // eslint-disable-next-line no-throw-literal
  1638. } catch (e) { /* empty */ }
  1639. var _iterDetect = function (exec, skipClosing) {
  1640. if (!skipClosing && !SAFE_CLOSING) return false;
  1641. var safe = false;
  1642. try {
  1643. var arr = [7];
  1644. var iter = arr[ITERATOR$3]();
  1645. iter.next = function () { return { done: safe = true }; };
  1646. arr[ITERATOR$3] = function () { return iter; };
  1647. exec(arr);
  1648. } catch (e) { /* empty */ }
  1649. return safe;
  1650. };
  1651. var task = _task.set;
  1652. var microtask = _microtask();
  1653. var PROMISE = 'Promise';
  1654. var TypeError$1 = _global.TypeError;
  1655. var process = _global.process;
  1656. var $Promise = _global[PROMISE];
  1657. var isNode = _classof(process) == 'process';
  1658. var empty = function () { /* empty */ };
  1659. var Internal;
  1660. var newGenericPromiseCapability;
  1661. var OwnPromiseCapability;
  1662. var Wrapper;
  1663. var newPromiseCapability = newGenericPromiseCapability = _newPromiseCapability.f;
  1664. var USE_NATIVE$1 = !!function () {
  1665. try {
  1666. // correct subclassing with @@species support
  1667. var promise = $Promise.resolve(1);
  1668. var FakePromise = (promise.constructor = {})[_wks('species')] = function (exec) {
  1669. exec(empty, empty);
  1670. };
  1671. // unhandled rejections tracking support, NodeJS Promise without it fails @@species test
  1672. return (isNode || typeof PromiseRejectionEvent == 'function') && promise.then(empty) instanceof FakePromise;
  1673. } catch (e) { /* empty */ }
  1674. }();
  1675. // helpers
  1676. var isThenable = function (it) {
  1677. var then;
  1678. return _isObject(it) && typeof (then = it.then) == 'function' ? then : false;
  1679. };
  1680. var notify = function (promise, isReject) {
  1681. if (promise._n) return;
  1682. promise._n = true;
  1683. var chain = promise._c;
  1684. microtask(function () {
  1685. var value = promise._v;
  1686. var ok = promise._s == 1;
  1687. var i = 0;
  1688. var run = function (reaction) {
  1689. var handler = ok ? reaction.ok : reaction.fail;
  1690. var resolve = reaction.resolve;
  1691. var reject = reaction.reject;
  1692. var domain = reaction.domain;
  1693. var result, then;
  1694. try {
  1695. if (handler) {
  1696. if (!ok) {
  1697. if (promise._h == 2) onHandleUnhandled(promise);
  1698. promise._h = 1;
  1699. }
  1700. if (handler === true) result = value;
  1701. else {
  1702. if (domain) domain.enter();
  1703. result = handler(value);
  1704. if (domain) domain.exit();
  1705. }
  1706. if (result === reaction.promise) {
  1707. reject(TypeError$1('Promise-chain cycle'));
  1708. } else if (then = isThenable(result)) {
  1709. then.call(result, resolve, reject);
  1710. } else resolve(result);
  1711. } else reject(value);
  1712. } catch (e) {
  1713. reject(e);
  1714. }
  1715. };
  1716. while (chain.length > i) run(chain[i++]); // variable length - can't use forEach
  1717. promise._c = [];
  1718. promise._n = false;
  1719. if (isReject && !promise._h) onUnhandled(promise);
  1720. });
  1721. };
  1722. var onUnhandled = function (promise) {
  1723. task.call(_global, function () {
  1724. var value = promise._v;
  1725. var unhandled = isUnhandled(promise);
  1726. var result, handler, console;
  1727. if (unhandled) {
  1728. result = _perform(function () {
  1729. if (isNode) {
  1730. process.emit('unhandledRejection', value, promise);
  1731. } else if (handler = _global.onunhandledrejection) {
  1732. handler({ promise: promise, reason: value });
  1733. } else if ((console = _global.console) && console.error) {
  1734. console.error('Unhandled promise rejection', value);
  1735. }
  1736. });
  1737. // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
  1738. promise._h = isNode || isUnhandled(promise) ? 2 : 1;
  1739. } promise._a = undefined;
  1740. if (unhandled && result.e) throw result.v;
  1741. });
  1742. };
  1743. var isUnhandled = function (promise) {
  1744. return promise._h !== 1 && (promise._a || promise._c).length === 0;
  1745. };
  1746. var onHandleUnhandled = function (promise) {
  1747. task.call(_global, function () {
  1748. var handler;
  1749. if (isNode) {
  1750. process.emit('rejectionHandled', promise);
  1751. } else if (handler = _global.onrejectionhandled) {
  1752. handler({ promise: promise, reason: promise._v });
  1753. }
  1754. });
  1755. };
  1756. var $reject = function (value) {
  1757. var promise = this;
  1758. if (promise._d) return;
  1759. promise._d = true;
  1760. promise = promise._w || promise; // unwrap
  1761. promise._v = value;
  1762. promise._s = 2;
  1763. if (!promise._a) promise._a = promise._c.slice();
  1764. notify(promise, true);
  1765. };
  1766. var $resolve = function (value) {
  1767. var promise = this;
  1768. var then;
  1769. if (promise._d) return;
  1770. promise._d = true;
  1771. promise = promise._w || promise; // unwrap
  1772. try {
  1773. if (promise === value) throw TypeError$1("Promise can't be resolved itself");
  1774. if (then = isThenable(value)) {
  1775. microtask(function () {
  1776. var wrapper = { _w: promise, _d: false }; // wrap
  1777. try {
  1778. then.call(value, _ctx($resolve, wrapper, 1), _ctx($reject, wrapper, 1));
  1779. } catch (e) {
  1780. $reject.call(wrapper, e);
  1781. }
  1782. });
  1783. } else {
  1784. promise._v = value;
  1785. promise._s = 1;
  1786. notify(promise, false);
  1787. }
  1788. } catch (e) {
  1789. $reject.call({ _w: promise, _d: false }, e); // wrap
  1790. }
  1791. };
  1792. // constructor polyfill
  1793. if (!USE_NATIVE$1) {
  1794. // 25.4.3.1 Promise(executor)
  1795. $Promise = function Promise(executor) {
  1796. _anInstance(this, $Promise, PROMISE, '_h');
  1797. _aFunction(executor);
  1798. Internal.call(this);
  1799. try {
  1800. executor(_ctx($resolve, this, 1), _ctx($reject, this, 1));
  1801. } catch (err) {
  1802. $reject.call(this, err);
  1803. }
  1804. };
  1805. // eslint-disable-next-line no-unused-vars
  1806. Internal = function Promise(executor) {
  1807. this._c = []; // <- awaiting reactions
  1808. this._a = undefined; // <- checked in isUnhandled reactions
  1809. this._s = 0; // <- state
  1810. this._d = false; // <- done
  1811. this._v = undefined; // <- value
  1812. this._h = 0; // <- rejection state, 0 - default, 1 - handled, 2 - unhandled
  1813. this._n = false; // <- notify
  1814. };
  1815. Internal.prototype = _redefineAll($Promise.prototype, {
  1816. // 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected)
  1817. then: function then(onFulfilled, onRejected) {
  1818. var reaction = newPromiseCapability(_speciesConstructor(this, $Promise));
  1819. reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true;
  1820. reaction.fail = typeof onRejected == 'function' && onRejected;
  1821. reaction.domain = isNode ? process.domain : undefined;
  1822. this._c.push(reaction);
  1823. if (this._a) this._a.push(reaction);
  1824. if (this._s) notify(this, false);
  1825. return reaction.promise;
  1826. },
  1827. // 25.4.5.1 Promise.prototype.catch(onRejected)
  1828. 'catch': function (onRejected) {
  1829. return this.then(undefined, onRejected);
  1830. }
  1831. });
  1832. OwnPromiseCapability = function () {
  1833. var promise = new Internal();
  1834. this.promise = promise;
  1835. this.resolve = _ctx($resolve, promise, 1);
  1836. this.reject = _ctx($reject, promise, 1);
  1837. };
  1838. _newPromiseCapability.f = newPromiseCapability = function (C) {
  1839. return C === $Promise || C === Wrapper
  1840. ? new OwnPromiseCapability(C)
  1841. : newGenericPromiseCapability(C);
  1842. };
  1843. }
  1844. _export(_export.G + _export.W + _export.F * !USE_NATIVE$1, { Promise: $Promise });
  1845. _setToStringTag($Promise, PROMISE);
  1846. _setSpecies(PROMISE);
  1847. Wrapper = _core[PROMISE];
  1848. // statics
  1849. _export(_export.S + _export.F * !USE_NATIVE$1, PROMISE, {
  1850. // 25.4.4.5 Promise.reject(r)
  1851. reject: function reject(r) {
  1852. var capability = newPromiseCapability(this);
  1853. var $$reject = capability.reject;
  1854. $$reject(r);
  1855. return capability.promise;
  1856. }
  1857. });
  1858. _export(_export.S + _export.F * (_library || !USE_NATIVE$1), PROMISE, {
  1859. // 25.4.4.6 Promise.resolve(x)
  1860. resolve: function resolve(x) {
  1861. return _promiseResolve(_library && this === Wrapper ? $Promise : this, x);
  1862. }
  1863. });
  1864. _export(_export.S + _export.F * !(USE_NATIVE$1 && _iterDetect(function (iter) {
  1865. $Promise.all(iter)['catch'](empty);
  1866. })), PROMISE, {
  1867. // 25.4.4.1 Promise.all(iterable)
  1868. all: function all(iterable) {
  1869. var C = this;
  1870. var capability = newPromiseCapability(C);
  1871. var resolve = capability.resolve;
  1872. var reject = capability.reject;
  1873. var result = _perform(function () {
  1874. var values = [];
  1875. var index = 0;
  1876. var remaining = 1;
  1877. _forOf(iterable, false, function (promise) {
  1878. var $index = index++;
  1879. var alreadyCalled = false;
  1880. values.push(undefined);
  1881. remaining++;
  1882. C.resolve(promise).then(function (value) {
  1883. if (alreadyCalled) return;
  1884. alreadyCalled = true;
  1885. values[$index] = value;
  1886. --remaining || resolve(values);
  1887. }, reject);
  1888. });
  1889. --remaining || resolve(values);
  1890. });
  1891. if (result.e) reject(result.v);
  1892. return capability.promise;
  1893. },
  1894. // 25.4.4.4 Promise.race(iterable)
  1895. race: function race(iterable) {
  1896. var C = this;
  1897. var capability = newPromiseCapability(C);
  1898. var reject = capability.reject;
  1899. var result = _perform(function () {
  1900. _forOf(iterable, false, function (promise) {
  1901. C.resolve(promise).then(capability.resolve, reject);
  1902. });
  1903. });
  1904. if (result.e) reject(result.v);
  1905. return capability.promise;
  1906. }
  1907. });
  1908. _export(_export.P + _export.R, 'Promise', { 'finally': function (onFinally) {
  1909. var C = _speciesConstructor(this, _core.Promise || _global.Promise);
  1910. var isFunction = typeof onFinally == 'function';
  1911. return this.then(
  1912. isFunction ? function (x) {
  1913. return _promiseResolve(C, onFinally()).then(function () { return x; });
  1914. } : onFinally,
  1915. isFunction ? function (e) {
  1916. return _promiseResolve(C, onFinally()).then(function () { throw e; });
  1917. } : onFinally
  1918. );
  1919. } });
  1920. // https://github.com/tc39/proposal-promise-try
  1921. _export(_export.S, 'Promise', { 'try': function (callbackfn) {
  1922. var promiseCapability = _newPromiseCapability.f(this);
  1923. var result = _perform(callbackfn);
  1924. (result.e ? promiseCapability.reject : promiseCapability.resolve)(result.v);
  1925. return promiseCapability.promise;
  1926. } });
  1927. var promise$1 = _core.Promise;
  1928. var promise = createCommonjsModule(function (module) {
  1929. module.exports = { "default": promise$1, __esModule: true };
  1930. });
  1931. var _Promise = unwrapExports(promise);
  1932. // most Object methods by ES6 should accept primitives
  1933. var _objectSap = function (KEY, exec) {
  1934. var fn = (_core.Object || {})[KEY] || Object[KEY];
  1935. var exp = {};
  1936. exp[KEY] = exec(fn);
  1937. _export(_export.S + _export.F * _fails(function () { fn(1); }), 'Object', exp);
  1938. };
  1939. // 19.1.2.14 Object.keys(O)
  1940. _objectSap('keys', function () {
  1941. return function keys(it) {
  1942. return _objectKeys(_toObject(it));
  1943. };
  1944. });
  1945. var keys$1 = _core.Object.keys;
  1946. var keys = createCommonjsModule(function (module) {
  1947. module.exports = { "default": keys$1, __esModule: true };
  1948. });
  1949. var _Object$keys = unwrapExports(keys);
  1950. // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
  1951. var $getOwnPropertyDescriptor$1 = _objectGopd.f;
  1952. _objectSap('getOwnPropertyDescriptor', function () {
  1953. return function getOwnPropertyDescriptor(it, key) {
  1954. return $getOwnPropertyDescriptor$1(_toIobject(it), key);
  1955. };
  1956. });
  1957. var $Object$1 = _core.Object;
  1958. var getOwnPropertyDescriptor$1 = function getOwnPropertyDescriptor(it, key) {
  1959. return $Object$1.getOwnPropertyDescriptor(it, key);
  1960. };
  1961. var getOwnPropertyDescriptor = createCommonjsModule(function (module) {
  1962. module.exports = { "default": getOwnPropertyDescriptor$1, __esModule: true };
  1963. });
  1964. var _Object$getOwnPropertyDescriptor = unwrapExports(getOwnPropertyDescriptor);
  1965. // 19.1.2.7 Object.getOwnPropertyNames(O)
  1966. _objectSap('getOwnPropertyNames', function () {
  1967. return _objectGopnExt.f;
  1968. });
  1969. var $Object$2 = _core.Object;
  1970. var getOwnPropertyNames$1 = function getOwnPropertyNames(it) {
  1971. return $Object$2.getOwnPropertyNames(it);
  1972. };
  1973. var getOwnPropertyNames = createCommonjsModule(function (module) {
  1974. module.exports = { "default": getOwnPropertyNames$1, __esModule: true };
  1975. });
  1976. var _Object$getOwnPropertyNames = unwrapExports(getOwnPropertyNames);
  1977. // 19.1.2.9 Object.getPrototypeOf(O)
  1978. _objectSap('getPrototypeOf', function () {
  1979. return function getPrototypeOf(it) {
  1980. return _objectGpo(_toObject(it));
  1981. };
  1982. });
  1983. var getPrototypeOf$1 = _core.Object.getPrototypeOf;
  1984. var getPrototypeOf = createCommonjsModule(function (module) {
  1985. module.exports = { "default": getPrototypeOf$1, __esModule: true };
  1986. });
  1987. var _Object$getPrototypeOf = unwrapExports(getPrototypeOf);
  1988. // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
  1989. _export(_export.S, 'Object', { create: _objectCreate });
  1990. var $Object$3 = _core.Object;
  1991. var create$1 = function create(P, D) {
  1992. return $Object$3.create(P, D);
  1993. };
  1994. var create = createCommonjsModule(function (module) {
  1995. module.exports = { "default": create$1, __esModule: true };
  1996. });
  1997. var _Object$create = unwrapExports(create);
  1998. // 19.1.3.1 Object.assign(target, source)
  1999. _export(_export.S + _export.F, 'Object', { assign: _objectAssign });
  2000. var assign$1 = _core.Object.assign;
  2001. var assign = createCommonjsModule(function (module) {
  2002. module.exports = { "default": assign$1, __esModule: true };
  2003. });
  2004. var _Object$assign = unwrapExports(assign);
  2005. var src = createCommonjsModule(function (module) {
  2006. /**
  2007. * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
  2008. *
  2009. * This source code is licensed under the MIT license found in the
  2010. * LICENSE file in the root directory of this source tree.
  2011. *
  2012. *
  2013. */
  2014. var MOCK_CONSTRUCTOR_NAME = 'mockConstructor';
  2015. var FUNCTION_NAME_RESERVED_PATTERN = /[\s!-\/:-@\[-`{-~]/;
  2016. var FUNCTION_NAME_RESERVED_REPLACE = new RegExp(FUNCTION_NAME_RESERVED_PATTERN.source, 'g');
  2017. var RESERVED_KEYWORDS = _Object$assign(_Object$create(null), {
  2018. arguments: true,
  2019. await: true,
  2020. break: true,
  2021. case: true,
  2022. catch: true,
  2023. class: true,
  2024. const: true,
  2025. continue: true,
  2026. debugger: true,
  2027. default: true,
  2028. delete: true,
  2029. do: true,
  2030. else: true,
  2031. enum: true,
  2032. eval: true,
  2033. export: true,
  2034. extends: true,
  2035. false: true,
  2036. finally: true,
  2037. for: true,
  2038. function: true,
  2039. if: true,
  2040. implements: true,
  2041. import: true,
  2042. in: true,
  2043. instanceof: true,
  2044. interface: true,
  2045. let: true,
  2046. new: true,
  2047. null: true,
  2048. package: true,
  2049. private: true,
  2050. protected: true,
  2051. public: true,
  2052. return: true,
  2053. static: true,
  2054. super: true,
  2055. switch: true,
  2056. this: true,
  2057. throw: true,
  2058. true: true,
  2059. try: true,
  2060. typeof: true,
  2061. var: true,
  2062. void: true,
  2063. while: true,
  2064. with: true,
  2065. yield: true
  2066. });
  2067. function matchArity(fn, length) {
  2068. var mockConstructor = void 0;
  2069. switch (length) {
  2070. case 1:
  2071. mockConstructor = function mockConstructor(a) {
  2072. return fn.apply(this, arguments);
  2073. };
  2074. break;
  2075. case 2:
  2076. mockConstructor = function mockConstructor(a, b) {
  2077. return fn.apply(this, arguments);
  2078. };
  2079. break;
  2080. case 3:
  2081. mockConstructor = function mockConstructor(a, b, c) {
  2082. return fn.apply(this, arguments);
  2083. };
  2084. break;
  2085. case 4:
  2086. mockConstructor = function mockConstructor(a, b, c, d) {
  2087. return fn.apply(this, arguments);
  2088. };
  2089. break;
  2090. case 5:
  2091. mockConstructor = function mockConstructor(a, b, c, d, e) {
  2092. return fn.apply(this, arguments);
  2093. };
  2094. break;
  2095. case 6:
  2096. mockConstructor = function mockConstructor(a, b, c, d, e, f) {
  2097. return fn.apply(this, arguments);
  2098. };
  2099. break;
  2100. case 7:
  2101. mockConstructor = function mockConstructor(a, b, c, d, e, f, g) {
  2102. return fn.apply(this, arguments);
  2103. };
  2104. break;
  2105. case 8:
  2106. mockConstructor = function mockConstructor(a, b, c, d, e, f, g, h) {
  2107. return fn.apply(this, arguments);
  2108. };
  2109. break;
  2110. case 9:
  2111. mockConstructor = function mockConstructor(a, b, c, d, e, f, g, h, i) {
  2112. return fn.apply(this, arguments);
  2113. };
  2114. break;
  2115. default:
  2116. mockConstructor = function mockConstructor() {
  2117. return fn.apply(this, arguments);
  2118. };
  2119. break;
  2120. }
  2121. return mockConstructor;
  2122. }
  2123. function isA(typeName, value) {
  2124. return Object.prototype.toString.apply(value) === '[object ' + typeName + ']';
  2125. }
  2126. function getType(ref) {
  2127. if (isA('Function', ref) || isA('AsyncFunction', ref)) {
  2128. return 'function';
  2129. } else if (Array.isArray(ref)) {
  2130. return 'array';
  2131. } else if (isA('Object', ref)) {
  2132. return 'object';
  2133. } else if (isA('Number', ref) || isA('String', ref) || isA('Boolean', ref) || isA('Symbol', ref)) {
  2134. return 'constant';
  2135. } else if (isA('Map', ref) || isA('WeakMap', ref) || isA('Set', ref)) {
  2136. return 'collection';
  2137. } else if (isA('RegExp', ref)) {
  2138. return 'regexp';
  2139. } else if (ref === undefined) {
  2140. return 'undefined';
  2141. } else if (ref === null) {
  2142. return 'null';
  2143. } else {
  2144. return null;
  2145. }
  2146. }
  2147. function isReadonlyProp(object, prop) {
  2148. return (prop === 'arguments' || prop === 'caller' || prop === 'callee' || prop === 'name' || prop === 'length') && (isA('Function', object) || isA('AsyncFunction', object)) || (prop === 'source' || prop === 'global' || prop === 'ignoreCase' || prop === 'multiline') && isA('RegExp', object);
  2149. }
  2150. function getSlots(object) {
  2151. var slots = {};
  2152. if (!object) {
  2153. return [];
  2154. }
  2155. var parent = _Object$getPrototypeOf(object);
  2156. do {
  2157. if (object === _Object$getPrototypeOf(Function)) {
  2158. break;
  2159. }
  2160. var ownNames = _Object$getOwnPropertyNames(object);
  2161. for (var i = 0; i < ownNames.length; i++) {
  2162. var prop = ownNames[i];
  2163. if (!isReadonlyProp(object, prop)) {
  2164. var propDesc = _Object$getOwnPropertyDescriptor(object, prop);
  2165. if (!propDesc.get || object.__esModule) {
  2166. slots[prop] = true;
  2167. }
  2168. }
  2169. }
  2170. object = parent;
  2171. } while (object && (parent = _Object$getPrototypeOf(object)) !== null);
  2172. return _Object$keys(slots);
  2173. }
  2174. function wrapAsyncParam(fn, asyncAction) {
  2175. if (asyncAction === 'reject') {
  2176. return function (value) {
  2177. return fn(_Promise.reject(value));
  2178. };
  2179. }
  2180. return function (value) {
  2181. return fn(_Promise.resolve(value));
  2182. };
  2183. }
  2184. var ModuleMockerClass = function () {
  2185. /**
  2186. * @see README.md
  2187. * @param global Global object of the test environment, used to create
  2188. * mocks
  2189. */
  2190. function ModuleMockerClass(global) {
  2191. _classCallCheck(this, ModuleMockerClass);
  2192. this._environmentGlobal = global;
  2193. this._mockState = new _WeakMap();
  2194. this._mockConfigRegistry = new _WeakMap();
  2195. this._spyState = new _Set();
  2196. this.ModuleMocker = ModuleMockerClass;
  2197. }
  2198. _createClass(ModuleMockerClass, [{
  2199. key: '_ensureMockConfig',
  2200. value: function _ensureMockConfig(f) {
  2201. var config = this._mockConfigRegistry.get(f);
  2202. if (!config) {
  2203. config = this._defaultMockConfig();
  2204. this._mockConfigRegistry.set(f, config);
  2205. }
  2206. return config;
  2207. }
  2208. }, {
  2209. key: '_ensureMockState',
  2210. value: function _ensureMockState(f) {
  2211. var state = this._mockState.get(f);
  2212. if (!state) {
  2213. state = this._defaultMockState();
  2214. this._mockState.set(f, state);
  2215. }
  2216. return state;
  2217. }
  2218. }, {
  2219. key: '_defaultMockConfig',
  2220. value: function _defaultMockConfig() {
  2221. return {
  2222. defaultReturnValue: undefined,
  2223. isReturnValueLastSet: false,
  2224. mockImpl: undefined,
  2225. mockName: 'jest.fn()',
  2226. specificMockImpls: [],
  2227. specificReturnValues: []
  2228. };
  2229. }
  2230. }, {
  2231. key: '_defaultMockState',
  2232. value: function _defaultMockState() {
  2233. return {
  2234. calls: [],
  2235. instances: [],
  2236. timestamps: []
  2237. };
  2238. }
  2239. }, {
  2240. key: '_makeComponent',
  2241. value: function _makeComponent(metadata, restore) {
  2242. var _this2 = this;
  2243. if (metadata.type === 'object') {
  2244. return new this._environmentGlobal.Object();
  2245. } else if (metadata.type === 'array') {
  2246. return new this._environmentGlobal.Array();
  2247. } else if (metadata.type === 'regexp') {
  2248. return new this._environmentGlobal.RegExp('');
  2249. } else if (metadata.type === 'constant' || metadata.type === 'collection' || metadata.type === 'null' || metadata.type === 'undefined') {
  2250. return metadata.value;
  2251. } else if (metadata.type === 'function') {
  2252. /* eslint-disable prefer-const */
  2253. var f = void 0;
  2254. /* eslint-enable prefer-const */
  2255. var prototype = metadata.members && metadata.members.prototype && metadata.members.prototype.members || {};
  2256. var prototypeSlots = getSlots(prototype);
  2257. var mocker = this;
  2258. var mockConstructor = matchArity(function () {
  2259. var _this = this;
  2260. var mockState = mocker._ensureMockState(f);
  2261. var mockConfig = mocker._ensureMockConfig(f);
  2262. mockState.instances.push(this);
  2263. mockState.calls.push(Array.prototype.slice.call(arguments));
  2264. mockState.timestamps.push(Date.now());
  2265. if (this instanceof f) {
  2266. // This is probably being called as a constructor
  2267. prototypeSlots.forEach(function (slot) {
  2268. // Copy prototype methods to the instance to make
  2269. // it easier to interact with mock instance call and
  2270. // return values
  2271. if (prototype[slot].type === 'function') {
  2272. var protoImpl = _this[slot];
  2273. _this[slot] = mocker.generateFromMetadata(prototype[slot]);
  2274. _this[slot]._protoImpl = protoImpl;
  2275. }
  2276. });
  2277. // Run the mock constructor implementation
  2278. var mockImpl = mockConfig.specificMockImpls.length ? mockConfig.specificMockImpls.shift() : mockConfig.mockImpl;
  2279. return mockImpl && mockImpl.apply(this, arguments);
  2280. }
  2281. var returnValue = mockConfig.defaultReturnValue;
  2282. // If return value is last set, either specific or default, i.e.
  2283. // mockReturnValueOnce()/mockReturnValue() is called and no
  2284. // mockImplementationOnce()/mockImplementation() is called after that.
  2285. // use the set return value.
  2286. if (mockConfig.specificReturnValues.length) {
  2287. return mockConfig.specificReturnValues.shift();
  2288. }
  2289. if (mockConfig.isReturnValueLastSet) {
  2290. return mockConfig.defaultReturnValue;
  2291. }
  2292. // If mockImplementationOnce()/mockImplementation() is last set,
  2293. // or specific return values are used up, use the mock implementation.
  2294. var specificMockImpl = void 0;
  2295. if (returnValue === undefined) {
  2296. specificMockImpl = mockConfig.specificMockImpls.shift();
  2297. if (specificMockImpl === undefined) {
  2298. specificMockImpl = mockConfig.mockImpl;
  2299. }
  2300. if (specificMockImpl) {
  2301. return specificMockImpl.apply(this, arguments);
  2302. }
  2303. }
  2304. // Otherwise use prototype implementation
  2305. if (returnValue === undefined && f._protoImpl) {
  2306. return f._protoImpl.apply(this, arguments);
  2307. }
  2308. return returnValue;
  2309. }, metadata.length || 0);
  2310. f = this._createMockFunction(metadata, mockConstructor);
  2311. f._isMockFunction = true;
  2312. f.getMockImplementation = function () {
  2313. return _this2._ensureMockConfig(f).mockImpl;
  2314. };
  2315. if (typeof restore === 'function') {
  2316. this._spyState.add(restore);
  2317. }
  2318. this._mockState.set(f, this._defaultMockState());
  2319. this._mockConfigRegistry.set(f, this._defaultMockConfig());
  2320. // $FlowFixMe - defineProperty getters not supported
  2321. Object.defineProperty(f, 'mock', {
  2322. configurable: false,
  2323. enumerable: true,
  2324. get: function get() {
  2325. return _this2._ensureMockState(f);
  2326. },
  2327. set: function set$$1(val) {
  2328. return _this2._mockState.set(f, val);
  2329. }
  2330. });
  2331. f.mockClear = function () {
  2332. _this2._mockState.delete(f);
  2333. return f;
  2334. };
  2335. f.mockReset = function () {
  2336. _this2._mockState.delete(f);
  2337. _this2._mockConfigRegistry.delete(f);
  2338. return f;
  2339. };
  2340. f.mockReturnValueOnce = function (value) {
  2341. // next function call will return this value or default return value
  2342. var mockConfig = _this2._ensureMockConfig(f);
  2343. mockConfig.specificReturnValues.push(value);
  2344. return f;
  2345. };
  2346. f.mockResolvedValueOnce = wrapAsyncParam(f.mockReturnValueOnce, 'resolve');
  2347. f.mockRejectedValueOnce = wrapAsyncParam(f.mockReturnValueOnce, 'reject');
  2348. f.mockReturnValue = function (value) {
  2349. // next function call will return specified return value or this one
  2350. var mockConfig = _this2._ensureMockConfig(f);
  2351. mockConfig.isReturnValueLastSet = true;
  2352. mockConfig.defaultReturnValue = value;
  2353. return f;
  2354. };
  2355. f.mockResolvedValue = wrapAsyncParam(f.mockReturnValue, 'resolve');
  2356. f.mockRejectedValue = wrapAsyncParam(f.mockReturnValue, 'reject');
  2357. f.mockImplementationOnce = function (fn) {
  2358. // next function call will use this mock implementation return value
  2359. // or default mock implementation return value
  2360. var mockConfig = _this2._ensureMockConfig(f);
  2361. mockConfig.isReturnValueLastSet = false;
  2362. mockConfig.specificMockImpls.push(fn);
  2363. return f;
  2364. };
  2365. f.mockImplementation = function (fn) {
  2366. // next function call will use mock implementation return value
  2367. var mockConfig = _this2._ensureMockConfig(f);
  2368. mockConfig.isReturnValueLastSet = false;
  2369. mockConfig.defaultReturnValue = undefined;
  2370. mockConfig.mockImpl = fn;
  2371. return f;
  2372. };
  2373. f.mockReturnThis = function () {
  2374. return f.mockImplementation(function () {
  2375. return this;
  2376. });
  2377. };
  2378. f.mockName = function (name) {
  2379. if (name) {
  2380. var mockConfig = _this2._ensureMockConfig(f);
  2381. mockConfig.mockName = name;
  2382. }
  2383. return f;
  2384. };
  2385. f.getMockName = function () {
  2386. var mockConfig = _this2._ensureMockConfig(f);
  2387. return mockConfig.mockName || 'jest.fn()';
  2388. };
  2389. if (metadata.mockImpl) {
  2390. f.mockImplementation(metadata.mockImpl);
  2391. }
  2392. f.mockRestore = restore ? restore : function () {};
  2393. return f;
  2394. } else {
  2395. var unknownType = metadata.type || 'undefined type';
  2396. throw new Error('Unrecognized type ' + unknownType);
  2397. }
  2398. }
  2399. }, {
  2400. key: '_createMockFunction',
  2401. value: function _createMockFunction(metadata, mockConstructor) {
  2402. var name = metadata.name;
  2403. if (!name) {
  2404. return mockConstructor;
  2405. }
  2406. // Preserve `name` property of mocked function.
  2407. var boundFunctionPrefix = 'bound ';
  2408. var bindCall = '';
  2409. // if-do-while for perf reasons. The common case is for the if to fail.
  2410. if (name && name.startsWith(boundFunctionPrefix)) {
  2411. do {
  2412. name = name.substring(boundFunctionPrefix.length);
  2413. // Call bind() just to alter the function name.
  2414. bindCall = '.bind(null)';
  2415. } while (name && name.startsWith(boundFunctionPrefix));
  2416. }
  2417. // Special case functions named `mockConstructor` to guard for infinite
  2418. // loops.
  2419. if (name === MOCK_CONSTRUCTOR_NAME) {
  2420. return mockConstructor;
  2421. }
  2422. // It's a syntax error to define functions with a reserved keyword
  2423. // as name.
  2424. if (RESERVED_KEYWORDS[name]) {
  2425. name = '$' + name;
  2426. }
  2427. // It's also a syntax error to define a function with a reserved character
  2428. // as part of it's name.
  2429. if (FUNCTION_NAME_RESERVED_PATTERN.test(name)) {
  2430. name = name.replace(FUNCTION_NAME_RESERVED_REPLACE, '$');
  2431. }
  2432. var body = 'return function ' + name + '() {' + 'return ' + MOCK_CONSTRUCTOR_NAME + '.apply(this,arguments);' + '}' + bindCall;
  2433. var createConstructor = new this._environmentGlobal.Function(MOCK_CONSTRUCTOR_NAME, body);
  2434. return createConstructor(mockConstructor);
  2435. }
  2436. }, {
  2437. key: '_generateMock',
  2438. value: function _generateMock(metadata, callbacks, refs) {
  2439. var _this3 = this;
  2440. var mock = this._makeComponent(metadata);
  2441. if (metadata.refID != null) {
  2442. refs[metadata.refID] = mock;
  2443. }
  2444. getSlots(metadata.members).forEach(function (slot) {
  2445. var slotMetadata = metadata.members && metadata.members[slot] || {};
  2446. if (slotMetadata.ref != null) {
  2447. callbacks.push(function () {
  2448. return mock[slot] = refs[slotMetadata.ref];
  2449. });
  2450. } else {
  2451. mock[slot] = _this3._generateMock(slotMetadata, callbacks, refs);
  2452. }
  2453. });
  2454. if (metadata.type !== 'undefined' && metadata.type !== 'null' && mock.prototype) {
  2455. mock.prototype.constructor = mock;
  2456. }
  2457. return mock;
  2458. }
  2459. /**
  2460. * @see README.md
  2461. * @param metadata Metadata for the mock in the schema returned by the
  2462. * getMetadata method of this module.
  2463. */
  2464. }, {
  2465. key: 'generateFromMetadata',
  2466. value: function generateFromMetadata(_metadata) {
  2467. var callbacks = [];
  2468. var refs = {};
  2469. var mock = this._generateMock(_metadata, callbacks, refs);
  2470. callbacks.forEach(function (setter) {
  2471. return setter();
  2472. });
  2473. return mock;
  2474. }
  2475. /**
  2476. * @see README.md
  2477. * @param component The component for which to retrieve metadata.
  2478. */
  2479. }, {
  2480. key: 'getMetadata',
  2481. value: function getMetadata(component, _refs) {
  2482. var _this4 = this;
  2483. var refs = _refs || new _Map();
  2484. var ref = refs.get(component);
  2485. if (ref != null) {
  2486. return { ref: ref };
  2487. }
  2488. var type = getType(component);
  2489. if (!type) {
  2490. return null;
  2491. }
  2492. var metadata = { type: type };
  2493. if (type === 'constant' || type === 'collection' || type === 'undefined' || type === 'null') {
  2494. metadata.value = component;
  2495. return metadata;
  2496. } else if (type === 'function') {
  2497. metadata.name = component.name;
  2498. if (component._isMockFunction) {
  2499. metadata.mockImpl = component.getMockImplementation();
  2500. }
  2501. }
  2502. metadata.refID = refs.size;
  2503. refs.set(component, metadata.refID);
  2504. var members = null;
  2505. // Leave arrays alone
  2506. if (type !== 'array') {
  2507. if (type !== 'undefined') {
  2508. getSlots(component).forEach(function (slot) {
  2509. if (type === 'function' && component._isMockFunction && slot.match(/^mock/)) {
  2510. return;
  2511. }
  2512. if (!component.hasOwnProperty && component[slot] !== undefined || component.hasOwnProperty && component.hasOwnProperty(slot) || type === 'object' && component[slot] != Object.prototype[slot]) {
  2513. var slotMetadata = _this4.getMetadata(component[slot], refs);
  2514. if (slotMetadata) {
  2515. if (!members) {
  2516. members = {};
  2517. }
  2518. members[slot] = slotMetadata;
  2519. }
  2520. }
  2521. });
  2522. }
  2523. // If component is native code function, prototype might be undefined
  2524. if (type === 'function' && component.prototype) {
  2525. var prototype = this.getMetadata(component.prototype, refs);
  2526. if (prototype && prototype.members) {
  2527. if (!members) {
  2528. members = {};
  2529. }
  2530. members.prototype = prototype;
  2531. }
  2532. }
  2533. }
  2534. if (members) {
  2535. metadata.members = members;
  2536. }
  2537. return metadata;
  2538. }
  2539. }, {
  2540. key: 'isMockFunction',
  2541. value: function isMockFunction(fn) {
  2542. return !!(fn && fn._isMockFunction);
  2543. }
  2544. }, {
  2545. key: 'fn',
  2546. value: function fn(implementation) {
  2547. var length = implementation ? implementation.length : 0;
  2548. var fn = this._makeComponent({ length: length, type: 'function' });
  2549. if (implementation) {
  2550. fn.mockImplementation(implementation);
  2551. }
  2552. return fn;
  2553. }
  2554. }, {
  2555. key: 'spyOn',
  2556. value: function spyOn(object, methodName, accessType) {
  2557. if (accessType) {
  2558. return this._spyOnProperty(object, methodName, accessType);
  2559. }
  2560. if ((typeof object === 'undefined' ? 'undefined' : _typeof(object)) !== 'object' && typeof object !== 'function') {
  2561. throw new Error('Cannot spyOn on a primitive value; ' + this._typeOf(object) + ' given');
  2562. }
  2563. var original = object[methodName];
  2564. if (!this.isMockFunction(original)) {
  2565. if (typeof original !== 'function') {
  2566. throw new Error('Cannot spy the ' + methodName + ' property because it is not a function; ' + this._typeOf(original) + ' given instead');
  2567. }
  2568. object[methodName] = this._makeComponent({ type: 'function' }, function () {
  2569. object[methodName] = original;
  2570. });
  2571. object[methodName].mockImplementation(function () {
  2572. return original.apply(this, arguments);
  2573. });
  2574. }
  2575. return object[methodName];
  2576. }
  2577. }, {
  2578. key: '_spyOnProperty',
  2579. value: function _spyOnProperty(obj, propertyName) {
  2580. var accessType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'get';
  2581. if ((typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) !== 'object' && typeof obj !== 'function') {
  2582. throw new Error('Cannot spyOn on a primitive value; ' + this._typeOf(obj) + ' given');
  2583. }
  2584. if (!obj) {
  2585. throw new Error('spyOn could not find an object to spy upon for ' + propertyName + '');
  2586. }
  2587. if (!propertyName) {
  2588. throw new Error('No property name supplied');
  2589. }
  2590. var descriptor = _Object$getOwnPropertyDescriptor(obj, propertyName);
  2591. if (!descriptor) {
  2592. throw new Error(propertyName + ' property does not exist');
  2593. }
  2594. if (!descriptor.configurable) {
  2595. throw new Error(propertyName + ' is not declared configurable');
  2596. }
  2597. if (!descriptor[accessType]) {
  2598. throw new Error('Property ' + propertyName + ' does not have access type ' + accessType);
  2599. }
  2600. var original = descriptor[accessType];
  2601. if (!this.isMockFunction(original)) {
  2602. if (typeof original !== 'function') {
  2603. throw new Error('Cannot spy the ' + propertyName + ' property because it is not a function; ' + this._typeOf(original) + ' given instead');
  2604. }
  2605. descriptor[accessType] = this._makeComponent({ type: 'function' }, function () {
  2606. descriptor[accessType] = original;
  2607. _Object$defineProperty(obj, propertyName, descriptor);
  2608. });
  2609. descriptor[accessType].mockImplementation(function () {
  2610. return original.apply(this, arguments);
  2611. });
  2612. }
  2613. _Object$defineProperty(obj, propertyName, descriptor);
  2614. return descriptor[accessType];
  2615. }
  2616. }, {
  2617. key: 'clearAllMocks',
  2618. value: function clearAllMocks() {
  2619. this._mockState = new _WeakMap();
  2620. }
  2621. }, {
  2622. key: 'resetAllMocks',
  2623. value: function resetAllMocks() {
  2624. this._mockConfigRegistry = new _WeakMap();
  2625. this._mockState = new _WeakMap();
  2626. }
  2627. }, {
  2628. key: 'restoreAllMocks',
  2629. value: function restoreAllMocks() {
  2630. this._spyState.forEach(function (restore) {
  2631. return restore();
  2632. });
  2633. this._spyState = new _Set();
  2634. }
  2635. }, {
  2636. key: '_typeOf',
  2637. value: function _typeOf(value) {
  2638. return value == null ? '' + value : typeof value === 'undefined' ? 'undefined' : _typeof(value);
  2639. }
  2640. }]);
  2641. return ModuleMockerClass;
  2642. }();
  2643. module.exports = new ModuleMockerClass(commonjsGlobal);
  2644. });
  2645. var index = unwrapExports(src);
  2646. return index;
  2647. })));